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 -x language -v -### --help[=class[,...]]
81 --target-help --version -pass-exit-codes -pipe -specs=file
82 -wrapper @file -ffile-prefix-map=old=new -fplugin=file
83 -fplugin-arg-name=arg -fdump-ada-spec[-slim]
84 -fada-spec-parent=unit -fdump-go-spec=file
85
86 C Language Options
87 -ansi -std=standard -fgnu89-inline
88 -fpermitted-flt-eval-methods=standard -aux-info filename
89 -fallow-parameterless-variadic-functions -fno-asm -fno-builtin
90 -fno-builtin-function -fgimple -fhosted -ffreestanding -fopenacc
91 -fopenacc-dim=geom -fopenmp -fopenmp-simd -fms-extensions
92 -fplan9-extensions -fsso-struct=endianness
93 -fallow-single-precision -fcond-mismatch -flax-vector-conversions
94 -fsigned-bitfields -fsigned-char -funsigned-bitfields
95 -funsigned-char
96
97 C++ Language Options
98 -fabi-version=n -fno-access-control -faligned-new=n
99 -fargs-in-order=n -fchar8_t -fcheck-new -fconstexpr-depth=n
100 -fconstexpr-cache-depth=n -fconstexpr-loop-limit=n
101 -fconstexpr-ops-limit=n -fno-elide-constructors
102 -fno-enforce-eh-specs -fno-gnu-keywords -fno-implicit-templates
103 -fno-implicit-inline-templates -fno-implement-inlines
104 -fms-extensions -fnew-inheriting-ctors -fnew-ttp-matching
105 -fno-nonansi-builtins -fnothrow-opt -fno-operator-names
106 -fno-optional-diags -fpermissive -fno-pretty-templates -fno-rtti
107 -fsized-deallocation -ftemplate-backtrace-limit=n
108 -ftemplate-depth=n -fno-threadsafe-statics -fuse-cxa-atexit
109 -fno-weak -nostdinc++ -fvisibility-inlines-hidden
110 -fvisibility-ms-compat -fext-numeric-literals -Wabi-tag
111 -Wcatch-value -Wcatch-value=n -Wno-class-conversion
112 -Wclass-memaccess -Wcomma-subscript -Wconditionally-supported
113 -Wno-conversion-null -Wctor-dtor-privacy -Wno-delete-incomplete
114 -Wdelete-non-virtual-dtor -Wdeprecated-copy
115 -Wdeprecated-copy-dtor -Weffc++ -Wextra-semi
116 -Wno-inaccessible-base -Wno-inherited-variadic-ctor
117 -Wno-init-list-lifetime -Wno-invalid-offsetof -Wno-literal-suffix
118 -Wmismatched-tags -Wmultiple-inheritance -Wnamespaces -Wnarrowing
119 -Wnoexcept -Wnoexcept-type -Wnon-virtual-dtor -Wpessimizing-move
120 -Wno-placement-new -Wplacement-new=n -Wredundant-move
121 -Wredundant-tags -Wreorder -Wregister -Wstrict-null-sentinel
122 -Wno-subobject-linkage -Wtemplates -Wno-non-template-friend
123 -Wold-style-cast -Woverloaded-virtual -Wno-pmf-conversions
124 -Wsign-promo -Wsized-deallocation -Wsuggest-final-methods
125 -Wsuggest-final-types -Wsuggest-override -Wno-terminate
126 -Wuseless-cast -Wvirtual-inheritance -Wno-virtual-move-assign
127 -Wvolatile -Wzero-as-null-pointer-constant
128
129 Objective-C and Objective-C++ Language Options
130 -fconstant-string-class=class-name -fgnu-runtime -fnext-runtime
131 -fno-nil-receivers -fobjc-abi-version=n -fobjc-call-cxx-cdtors
132 -fobjc-direct-dispatch -fobjc-exceptions -fobjc-gc -fobjc-nilcheck
133 -fobjc-std=objc1 -fno-local-ivars
134 -fivar-visibility=[public|protected|private|package]
135 -freplace-objc-classes -fzero-link -gen-decls -Wassign-intercept
136 -Wno-property-assign-default -Wno-protocol -Wselector
137 -Wstrict-selector-match -Wundeclared-selector
138
139 Diagnostic Message Formatting Options
140 -fmessage-length=n -fdiagnostics-show-location=[once|every-line]
141 -fdiagnostics-color=[auto|never|always]
142 -fdiagnostics-urls=[auto|never|always]
143 -fdiagnostics-format=[text|json] -fno-diagnostics-show-option
144 -fno-diagnostics-show-caret -fno-diagnostics-show-labels
145 -fno-diagnostics-show-line-numbers -fno-diagnostics-show-cwe
146 -fdiagnostics-minimum-margin-width=width
147 -fdiagnostics-parseable-fixits -fdiagnostics-generate-patch
148 -fdiagnostics-show-template-tree -fno-elide-type
149 -fdiagnostics-path-format=[none|separate-events|inline-events]
150 -fdiagnostics-show-path-depths -fno-show-column
151
152 Warning Options
153 -fsyntax-only -fmax-errors=n -Wpedantic -pedantic-errors -w
154 -Wextra -Wall -Wabi=n -Waddress -Wno-address-of-packed-member
155 -Waggregate-return -Walloc-size-larger-than=byte-size -Walloc-zero
156 -Walloca -Walloca-larger-than=byte-size
157 -Wno-aggressive-loop-optimizations -Warith-conversion
158 -Warray-bounds -Warray-bounds=n -Wno-attributes
159 -Wattribute-alias=n -Wno-attribute-alias -Wno-attribute-warning
160 -Wbool-compare -Wbool-operation -Wno-builtin-declaration-mismatch
161 -Wno-builtin-macro-redefined -Wc90-c99-compat -Wc99-c11-compat
162 -Wc11-c2x-compat -Wc++-compat -Wc++11-compat -Wc++14-compat
163 -Wc++17-compat -Wc++20-compat -Wcast-align -Wcast-align=strict
164 -Wcast-function-type -Wcast-qual -Wchar-subscripts -Wclobbered
165 -Wcomment -Wconversion -Wno-coverage-mismatch -Wno-cpp
166 -Wdangling-else -Wdate-time -Wno-deprecated
167 -Wno-deprecated-declarations -Wno-designated-init
168 -Wdisabled-optimization -Wno-discarded-array-qualifiers
169 -Wno-discarded-qualifiers -Wno-div-by-zero -Wdouble-promotion
170 -Wduplicated-branches -Wduplicated-cond -Wempty-body
171 -Wno-endif-labels -Wenum-compare -Wenum-conversion -Werror
172 -Werror=* -Wexpansion-to-defined -Wfatal-errors
173 -Wfloat-conversion -Wfloat-equal -Wformat -Wformat=2
174 -Wno-format-contains-nul -Wno-format-extra-args
175 -Wformat-nonliteral -Wformat-overflow=n -Wformat-security
176 -Wformat-signedness -Wformat-truncation=n -Wformat-y2k
177 -Wframe-address -Wframe-larger-than=byte-size
178 -Wno-free-nonheap-object -Wno-hsa -Wno-if-not-aligned
179 -Wno-ignored-attributes -Wignored-qualifiers
180 -Wno-incompatible-pointer-types -Wimplicit -Wimplicit-fallthrough
181 -Wimplicit-fallthrough=n -Wno-implicit-function-declaration
182 -Wno-implicit-int -Winit-self -Winline -Wno-int-conversion
183 -Wint-in-bool-context -Wno-int-to-pointer-cast
184 -Wno-invalid-memory-model -Winvalid-pch -Wjump-misses-init
185 -Wlarger-than=byte-size -Wlogical-not-parentheses -Wlogical-op
186 -Wlong-long -Wno-lto-type-mismatch -Wmain -Wmaybe-uninitialized
187 -Wmemset-elt-size -Wmemset-transposed-args
188 -Wmisleading-indentation -Wmissing-attributes -Wmissing-braces
189 -Wmissing-field-initializers -Wmissing-format-attribute
190 -Wmissing-include-dirs -Wmissing-noreturn -Wno-missing-profile
191 -Wno-multichar -Wmultistatement-macros -Wnonnull
192 -Wnonnull-compare -Wnormalized=[none|id|nfc|nfkc]
193 -Wnull-dereference -Wno-odr -Wopenmp-simd -Wno-overflow
194 -Woverlength-strings -Wno-override-init-side-effects -Wpacked
195 -Wno-packed-bitfield-compat -Wpacked-not-aligned -Wpadded
196 -Wparentheses -Wno-pedantic-ms-format -Wpointer-arith
197 -Wno-pointer-compare -Wno-pointer-to-int-cast -Wno-pragmas
198 -Wno-prio-ctor-dtor -Wredundant-decls -Wrestrict
199 -Wno-return-local-addr -Wreturn-type -Wno-scalar-storage-order
200 -Wsequence-point -Wshadow -Wshadow=global -Wshadow=local
201 -Wshadow=compatible-local -Wno-shadow-ivar
202 -Wno-shift-count-negative -Wno-shift-count-overflow
203 -Wshift-negative-value -Wno-shift-overflow -Wshift-overflow=n
204 -Wsign-compare -Wsign-conversion -Wno-sizeof-array-argument
205 -Wsizeof-pointer-div -Wsizeof-pointer-memaccess -Wstack-protector
206 -Wstack-usage=byte-size -Wstrict-aliasing -Wstrict-aliasing=n
207 -Wstrict-overflow -Wstrict-overflow=n -Wstring-compare
208 -Wstringop-overflow=n -Wno-stringop-truncation
209 -Wsuggest-attribute=[pure|const|noreturn|format|malloc] -Wswitch
210 -Wno-switch-bool -Wswitch-default -Wswitch-enum
211 -Wno-switch-outside-range -Wno-switch-unreachable -Wsync-nand
212 -Wsystem-headers -Wtautological-compare -Wtrampolines
213 -Wtrigraphs -Wtype-limits -Wundef -Wuninitialized
214 -Wunknown-pragmas -Wunsuffixed-float-constants -Wunused
215 -Wunused-but-set-parameter -Wunused-but-set-variable
216 -Wunused-const-variable -Wunused-const-variable=n
217 -Wunused-function -Wunused-label -Wunused-local-typedefs
218 -Wunused-macros -Wunused-parameter -Wno-unused-result
219 -Wunused-value -Wunused-variable -Wno-varargs -Wvariadic-macros
220 -Wvector-operation-performance -Wvla -Wvla-larger-than=byte-size
221 -Wno-vla-larger-than -Wvolatile-register-var -Wwrite-strings
222 -Wzero-length-bounds
223
224 Static Analyzer Options
225 -fanalyzer -fanalyzer-call-summaries -fanalyzer-checker=name
226 -fanalyzer-fine-grained -fanalyzer-state-merge
227 -fanalyzer-state-purge -fanalyzer-transitivity
228 -fanalyzer-verbose-edges -fanalyzer-verbose-state-changes
229 -fanalyzer-verbosity=level -fdump-analyzer -fdump-analyzer-stderr
230 -fdump-analyzer-callgraph -fdump-analyzer-exploded-graph
231 -fdump-analyzer-exploded-nodes -fdump-analyzer-exploded-nodes-2
232 -fdump-analyzer-exploded-nodes-3 -fdump-analyzer-state-purge
233 -fdump-analyzer-supergraph -Wno-analyzer-double-fclose
234 -Wno-analyzer-double-free
235 -Wno-analyzer-exposure-through-output-file -Wno-analyzer-file-leak
236 -Wno-analyzer-free-of-non-heap -Wno-analyzer-malloc-leak
237 -Wno-analyzer-null-argument -Wno-analyzer-null-dereference
238 -Wno-analyzer-possible-null-argument
239 -Wno-analyzer-possible-null-dereference
240 -Wno-analyzer-stale-setjmp-buffer -Wno-analyzer-tainted-array-index
241 -Wanalyzer-too-complex
242 -Wno-analyzer-unsafe-call-within-signal-handler
243 -Wno-analyzer-use-after-free
244 -Wno-analyzer-use-of-pointer-in-stale-stack-frame
245 -Wno-analyzer-use-of-uninitialized-value
246
247 C and Objective-C-only Warning Options
248 -Wbad-function-cast -Wmissing-declarations
249 -Wmissing-parameter-type -Wmissing-prototypes -Wnested-externs
250 -Wold-style-declaration -Wold-style-definition -Wstrict-prototypes
251 -Wtraditional -Wtraditional-conversion
252 -Wdeclaration-after-statement -Wpointer-sign
253
254 Debugging Options
255 -g -glevel -gdwarf -gdwarf-version -ggdb -grecord-gcc-switches
256 -gno-record-gcc-switches -gstabs -gstabs+ -gstrict-dwarf
257 -gno-strict-dwarf -gas-loc-support -gno-as-loc-support
258 -gas-locview-support -gno-as-locview-support -gcolumn-info
259 -gno-column-info -gstatement-frontiers -gno-statement-frontiers
260 -gvariable-location-views -gno-variable-location-views
261 -ginternal-reset-location-views -gno-internal-reset-location-views
262 -ginline-points -gno-inline-points -gvms -gxcoff -gxcoff+
263 -gz[=type] -gsplit-dwarf -gdescribe-dies -gno-describe-dies
264 -fdebug-prefix-map=old=new -fdebug-types-section
265 -fno-eliminate-unused-debug-types -femit-struct-debug-baseonly
266 -femit-struct-debug-reduced -femit-struct-debug-detailed[=spec-
267 list] -fno-eliminate-unused-debug-symbols
268 -femit-class-debug-always -fno-merge-debug-strings
269 -fno-dwarf2-cfi-asm -fvar-tracking -fvar-tracking-assignments
270
271 Optimization Options
272 -faggressive-loop-optimizations -falign-functions[=n[:m:[n2[:m2]]]]
273 -falign-jumps[=n[:m:[n2[:m2]]]] -falign-labels[=n[:m:[n2[:m2]]]]
274 -falign-loops[=n[:m:[n2[:m2]]]] -fno-allocation-dce
275 -fallow-store-data-races -fassociative-math -fauto-profile
276 -fauto-profile[=path] -fauto-inc-dec -fbranch-probabilities
277 -fcaller-saves -fcombine-stack-adjustments -fconserve-stack
278 -fcompare-elim -fcprop-registers -fcrossjumping
279 -fcse-follow-jumps -fcse-skip-blocks -fcx-fortran-rules
280 -fcx-limited-range -fdata-sections -fdce -fdelayed-branch
281 -fdelete-null-pointer-checks -fdevirtualize
282 -fdevirtualize-speculatively -fdevirtualize-at-ltrans -fdse
283 -fearly-inlining -fipa-sra -fexpensive-optimizations
284 -ffat-lto-objects -ffast-math -ffinite-math-only -ffloat-store
285 -fexcess-precision=style -ffinite-loops -fforward-propagate
286 -ffp-contract=style -ffunction-sections -fgcse
287 -fgcse-after-reload -fgcse-las -fgcse-lm -fgraphite-identity
288 -fgcse-sm -fhoist-adjacent-loads -fif-conversion -fif-conversion2
289 -findirect-inlining -finline-functions
290 -finline-functions-called-once -finline-limit=n
291 -finline-small-functions -fipa-cp -fipa-cp-clone -fipa-bit-cp
292 -fipa-vrp -fipa-pta -fipa-profile -fipa-pure-const
293 -fipa-reference -fipa-reference-addressable -fipa-stack-alignment
294 -fipa-icf -fira-algorithm=algorithm -flive-patching=level
295 -fira-region=region -fira-hoist-pressure -fira-loop-pressure
296 -fno-ira-share-save-slots -fno-ira-share-spill-slots
297 -fisolate-erroneous-paths-dereference
298 -fisolate-erroneous-paths-attribute -fivopts
299 -fkeep-inline-functions -fkeep-static-functions
300 -fkeep-static-consts -flimit-function-alignment
301 -flive-range-shrinkage -floop-block -floop-interchange
302 -floop-strip-mine -floop-unroll-and-jam -floop-nest-optimize
303 -floop-parallelize-all -flra-remat -flto -flto-compression-level
304 -flto-partition=alg -fmerge-all-constants -fmerge-constants
305 -fmodulo-sched -fmodulo-sched-allow-regmoves
306 -fmove-loop-invariants -fno-branch-count-reg -fno-defer-pop
307 -fno-fp-int-builtin-inexact -fno-function-cse
308 -fno-guess-branch-probability -fno-inline -fno-math-errno
309 -fno-peephole -fno-peephole2 -fno-printf-return-value
310 -fno-sched-interblock -fno-sched-spec -fno-signed-zeros
311 -fno-toplevel-reorder -fno-trapping-math
312 -fno-zero-initialized-in-bss -fomit-frame-pointer
313 -foptimize-sibling-calls -fpartial-inlining -fpeel-loops
314 -fpredictive-commoning -fprefetch-loop-arrays -fprofile-correction
315 -fprofile-use -fprofile-use=path -fprofile-partial-training
316 -fprofile-values -fprofile-reorder-functions -freciprocal-math
317 -free -frename-registers -freorder-blocks
318 -freorder-blocks-algorithm=algorithm -freorder-blocks-and-partition
319 -freorder-functions -frerun-cse-after-loop
320 -freschedule-modulo-scheduled-loops -frounding-math
321 -fsave-optimization-record -fsched2-use-superblocks
322 -fsched-pressure -fsched-spec-load -fsched-spec-load-dangerous
323 -fsched-stalled-insns-dep[=n] -fsched-stalled-insns[=n]
324 -fsched-group-heuristic -fsched-critical-path-heuristic
325 -fsched-spec-insn-heuristic -fsched-rank-heuristic
326 -fsched-last-insn-heuristic -fsched-dep-count-heuristic
327 -fschedule-fusion -fschedule-insns -fschedule-insns2
328 -fsection-anchors -fselective-scheduling -fselective-scheduling2
329 -fsel-sched-pipelining -fsel-sched-pipelining-outer-loops
330 -fsemantic-interposition -fshrink-wrap -fshrink-wrap-separate
331 -fsignaling-nans -fsingle-precision-constant
332 -fsplit-ivs-in-unroller -fsplit-loops -fsplit-paths
333 -fsplit-wide-types -fsplit-wide-types-early -fssa-backprop
334 -fssa-phiopt -fstdarg-opt -fstore-merging -fstrict-aliasing
335 -fthread-jumps -ftracer -ftree-bit-ccp -ftree-builtin-call-dce
336 -ftree-ccp -ftree-ch -ftree-coalesce-vars -ftree-copy-prop
337 -ftree-dce -ftree-dominator-opts -ftree-dse -ftree-forwprop
338 -ftree-fre -fcode-hoisting -ftree-loop-if-convert -ftree-loop-im
339 -ftree-phiprop -ftree-loop-distribution
340 -ftree-loop-distribute-patterns -ftree-loop-ivcanon
341 -ftree-loop-linear -ftree-loop-optimize -ftree-loop-vectorize
342 -ftree-parallelize-loops=n -ftree-pre -ftree-partial-pre
343 -ftree-pta -ftree-reassoc -ftree-scev-cprop -ftree-sink
344 -ftree-slsr -ftree-sra -ftree-switch-conversion -ftree-tail-merge
345 -ftree-ter -ftree-vectorize -ftree-vrp -funconstrained-commons
346 -funit-at-a-time -funroll-all-loops -funroll-loops
347 -funsafe-math-optimizations -funswitch-loops -fipa-ra
348 -fvariable-expansion-in-unroller -fvect-cost-model -fvpt -fweb
349 -fwhole-program -fwpa -fuse-linker-plugin --param name=value -O
350 -O0 -O1 -O2 -O3 -Os -Ofast -Og
351
352 Program Instrumentation Options
353 -p -pg -fprofile-arcs --coverage -ftest-coverage
354 -fprofile-abs-path -fprofile-dir=path -fprofile-generate
355 -fprofile-generate=path -fprofile-note=path
356 -fprofile-prefix-path=path -fprofile-update=method
357 -fprofile-filter-files=regex -fprofile-exclude-files=regex
358 -fprofile-reproducibility -fsanitize=style -fsanitize-recover
359 -fsanitize-recover=style -fasan-shadow-offset=number
360 -fsanitize-sections=s1,s2,... -fsanitize-undefined-trap-on-error
361 -fbounds-check -fcf-protection=[full|branch|return|none]
362 -fstack-protector -fstack-protector-all -fstack-protector-strong
363 -fstack-protector-explicit -fstack-check
364 -fstack-limit-register=reg -fstack-limit-symbol=sym
365 -fno-stack-limit -fsplit-stack -fvtable-verify=[std|preinit|none]
366 -fvtv-counts -fvtv-debug -finstrument-functions
367 -finstrument-functions-exclude-function-list=sym,sym,...
368 -finstrument-functions-exclude-file-list=file,file,...
369
370 Preprocessor Options
371 -Aquestion=answer -A-question[=answer] -C -CC -Dmacro[=defn] -dD
372 -dI -dM -dN -dU -fdebug-cpp -fdirectives-only
373 -fdollars-in-identifiers -fexec-charset=charset
374 -fextended-identifiers -finput-charset=charset
375 -fmacro-prefix-map=old=new -fmax-include-depth=depth
376 -fno-canonical-system-headers -fpch-deps -fpch-preprocess
377 -fpreprocessed -ftabstop=width -ftrack-macro-expansion
378 -fwide-exec-charset=charset -fworking-directory -H -imacros file
379 -include file -M -MD -MF -MG -MM -MMD -MP -MQ -MT
380 -no-integrated-cpp -P -pthread -remap -traditional
381 -traditional-cpp -trigraphs -Umacro -undef -Wp,option
382 -Xpreprocessor option
383
384 Assembler Options
385 -Wa,option -Xassembler option
386
387 Linker Options
388 object-file-name -fuse-ld=linker -llibrary -nostartfiles
389 -nodefaultlibs -nolibc -nostdlib -e entry --entry=entry -pie
390 -pthread -r -rdynamic -s -static -static-pie -static-libgcc
391 -static-libstdc++ -static-libasan -static-libtsan -static-liblsan
392 -static-libubsan -shared -shared-libgcc -symbolic -T script
393 -Wl,option -Xlinker option -u symbol -z keyword
394
395 Directory Options
396 -Bprefix -Idir -I- -idirafter dir -imacros file -imultilib dir
397 -iplugindir=dir -iprefix file -iquote dir -isysroot dir -isystem
398 dir -iwithprefix dir -iwithprefixbefore dir -Ldir
399 -no-canonical-prefixes --no-sysroot-suffix -nostdinc -nostdinc++
400 --sysroot=dir
401
402 Code Generation Options
403 -fcall-saved-reg -fcall-used-reg -ffixed-reg -fexceptions
404 -fnon-call-exceptions -fdelete-dead-exceptions -funwind-tables
405 -fasynchronous-unwind-tables -fno-gnu-unique
406 -finhibit-size-directive -fcommon -fno-ident -fpcc-struct-return
407 -fpic -fPIC -fpie -fPIE -fno-plt -fno-jump-tables
408 -frecord-gcc-switches -freg-struct-return -fshort-enums
409 -fshort-wchar -fverbose-asm -fpack-struct[=n] -fleading-underscore
410 -ftls-model=model -fstack-reuse=reuse_level -ftrampolines -ftrapv
411 -fwrapv -fvisibility=[default|internal|hidden|protected]
412 -fstrict-volatile-bitfields -fsync-libcalls
413
414 Developer Options
415 -dletters -dumpspecs -dumpmachine -dumpversion -dumpfullversion
416 -fcallgraph-info[=su,da] -fchecking -fchecking=n -fdbg-cnt-list
417 -fdbg-cnt=counter-value-list -fdisable-ipa-pass_name
418 -fdisable-rtl-pass_name -fdisable-rtl-pass-name=range-list
419 -fdisable-tree-pass_name -fdisable-tree-pass-name=range-list
420 -fdump-debug -fdump-earlydebug -fdump-noaddr -fdump-unnumbered
421 -fdump-unnumbered-links -fdump-final-insns[=file] -fdump-ipa-all
422 -fdump-ipa-cgraph -fdump-ipa-inline -fdump-lang-all
423 -fdump-lang-switch -fdump-lang-switch-options
424 -fdump-lang-switch-options=filename -fdump-passes -fdump-rtl-pass
425 -fdump-rtl-pass=filename -fdump-statistics -fdump-tree-all
426 -fdump-tree-switch -fdump-tree-switch-options
427 -fdump-tree-switch-options=filename -fcompare-debug[=opts]
428 -fcompare-debug-second -fenable-kind-pass -fenable-kind-pass=range-
429 list -fira-verbose=n -flto-report -flto-report-wpa
430 -fmem-report-wpa -fmem-report -fpre-ipa-mem-report
431 -fpost-ipa-mem-report -fopt-info -fopt-info-options[=file]
432 -fprofile-report -frandom-seed=string -fsched-verbose=n
433 -fsel-sched-verbose -fsel-sched-dump-cfg
434 -fsel-sched-pipelining-verbose -fstats -fstack-usage
435 -ftime-report -ftime-report-details
436 -fvar-tracking-assignments-toggle -gtoggle
437 -print-file-name=library -print-libgcc-file-name
438 -print-multi-directory -print-multi-lib -print-multi-os-directory
439 -print-prog-name=program -print-search-dirs -Q -print-sysroot
440 -print-sysroot-headers-suffix -save-temps -save-temps=cwd
441 -save-temps=obj -time[=file]
442
443 Machine-Dependent Options
444 AArch64 Options -mabi=name -mbig-endian -mlittle-endian
445 -mgeneral-regs-only -mcmodel=tiny -mcmodel=small -mcmodel=large
446 -mstrict-align -mno-strict-align -momit-leaf-frame-pointer
447 -mtls-dialect=desc -mtls-dialect=traditional -mtls-size=size
448 -mfix-cortex-a53-835769 -mfix-cortex-a53-843419
449 -mlow-precision-recip-sqrt -mlow-precision-sqrt
450 -mlow-precision-div -mpc-relative-literal-loads
451 -msign-return-address=scope -mbranch-protection=none|standard|pac-
452 ret[+leaf +b-key]|bti -march=name -mcpu=name -mtune=name
453 -moverride=string -mverbose-cost-dump
454 -mstack-protector-guard=guard -mstack-protector-guard-reg=sysreg
455 -mstack-protector-guard-offset=offset -mtrack-speculation
456 -moutline-atomics
457
458 Adapteva Epiphany Options -mhalf-reg-file -mprefer-short-insn-regs
459 -mbranch-cost=num -mcmove -mnops=num -msoft-cmpsf -msplit-lohi
460 -mpost-inc -mpost-modify -mstack-offset=num -mround-nearest
461 -mlong-calls -mshort-calls -msmall16 -mfp-mode=mode
462 -mvect-double -max-vect-align=num -msplit-vecmove-early
463 -m1reg-reg
464
465 AMD GCN Options -march=gpu -mtune=gpu -mstack-size=bytes
466
467 ARC Options -mbarrel-shifter -mjli-always -mcpu=cpu -mA6
468 -mARC600 -mA7 -mARC700 -mdpfp -mdpfp-compact -mdpfp-fast
469 -mno-dpfp-lrsr -mea -mno-mpy -mmul32x16 -mmul64 -matomic -mnorm
470 -mspfp -mspfp-compact -mspfp-fast -msimd -msoft-float -mswap
471 -mcrc -mdsp-packa -mdvbf -mlock -mmac-d16 -mmac-24 -mrtsc
472 -mswape -mtelephony -mxy -misize -mannotate-align -marclinux
473 -marclinux_prof -mlong-calls -mmedium-calls -msdata
474 -mirq-ctrl-saved -mrgf-banked-regs -mlpc-width=width -G num
475 -mvolatile-cache -mtp-regno=regno -malign-call -mauto-modify-reg
476 -mbbit-peephole -mno-brcc -mcase-vector-pcrel -mcompact-casesi
477 -mno-cond-exec -mearly-cbranchsi -mexpand-adddi -mindexed-loads
478 -mlra -mlra-priority-none -mlra-priority-compact mlra-priority-
479 noncompact -mmillicode -mmixed-code -mq-class -mRcq -mRcw
480 -msize-level=level -mtune=cpu -mmultcost=num -mcode-density-frame
481 -munalign-prob-threshold=probability -mmpy-option=multo -mdiv-rem
482 -mcode-density -mll64 -mfpu=fpu -mrf16 -mbranch-index
483
484 ARM Options -mapcs-frame -mno-apcs-frame -mabi=name
485 -mapcs-stack-check -mno-apcs-stack-check -mapcs-reentrant
486 -mno-apcs-reentrant -mgeneral-regs-only -msched-prolog
487 -mno-sched-prolog -mlittle-endian -mbig-endian -mbe8 -mbe32
488 -mfloat-abi=name -mfp16-format=name -mthumb-interwork
489 -mno-thumb-interwork -mcpu=name -march=name -mfpu=name
490 -mtune=name -mprint-tune-info -mstructure-size-boundary=n
491 -mabort-on-noreturn -mlong-calls -mno-long-calls -msingle-pic-base
492 -mno-single-pic-base -mpic-register=reg -mnop-fun-dllimport
493 -mpoke-function-name -mthumb -marm -mflip-thumb -mtpcs-frame
494 -mtpcs-leaf-frame -mcaller-super-interworking
495 -mcallee-super-interworking -mtp=name -mtls-dialect=dialect
496 -mword-relocations -mfix-cortex-m3-ldrd -munaligned-access
497 -mneon-for-64bits -mslow-flash-data -masm-syntax-unified
498 -mrestrict-it -mverbose-cost-dump -mpure-code -mcmse -mfdpic
499
500 AVR Options -mmcu=mcu -mabsdata -maccumulate-args
501 -mbranch-cost=cost -mcall-prologues -mgas-isr-prologues -mint8
502 -mdouble=bits -mlong-double=bits -mn_flash=size -mno-interrupts
503 -mmain-is-OS_task -mrelax -mrmw -mstrict-X -mtiny-stack
504 -mfract-convert-truncate -mshort-calls -nodevicelib
505 -nodevicespecs -Waddr-space-convert -Wmisspelled-isr
506
507 Blackfin Options -mcpu=cpu[-sirevision] -msim
508 -momit-leaf-frame-pointer -mno-omit-leaf-frame-pointer
509 -mspecld-anomaly -mno-specld-anomaly -mcsync-anomaly
510 -mno-csync-anomaly -mlow-64k -mno-low64k -mstack-check-l1
511 -mid-shared-library -mno-id-shared-library -mshared-library-id=n
512 -mleaf-id-shared-library -mno-leaf-id-shared-library -msep-data
513 -mno-sep-data -mlong-calls -mno-long-calls -mfast-fp
514 -minline-plt -mmulticore -mcorea -mcoreb -msdram -micplb
515
516 C6X Options -mbig-endian -mlittle-endian -march=cpu -msim
517 -msdata=sdata-type
518
519 CRIS Options -mcpu=cpu -march=cpu -mtune=cpu -mmax-stack-frame=n
520 -melinux-stacksize=n -metrax4 -metrax100 -mpdebug -mcc-init
521 -mno-side-effects -mstack-align -mdata-align -mconst-align
522 -m32-bit -m16-bit -m8-bit -mno-prologue-epilogue -mno-gotplt
523 -melf -maout -melinux -mlinux -sim -sim2 -mmul-bug-workaround
524 -mno-mul-bug-workaround
525
526 CR16 Options -mmac -mcr16cplus -mcr16c -msim -mint32 -mbit-ops
527 -mdata-model=model
528
529 C-SKY Options -march=arch -mcpu=cpu -mbig-endian -EB
530 -mlittle-endian -EL -mhard-float -msoft-float -mfpu=fpu
531 -mdouble-float -mfdivdu -melrw -mistack -mmp -mcp -mcache
532 -msecurity -mtrust -mdsp -medsp -mvdsp -mdiv -msmart
533 -mhigh-registers -manchor -mpushpop -mmultiple-stld -mconstpool
534 -mstack-size -mccrt -mbranch-cost=n -mcse-cc -msched-prolog
535
536 Darwin Options -all_load -allowable_client -arch
537 -arch_errors_fatal -arch_only -bind_at_load -bundle
538 -bundle_loader -client_name -compatibility_version
539 -current_version -dead_strip -dependency-file -dylib_file
540 -dylinker_install_name -dynamic -dynamiclib
541 -exported_symbols_list -filelist -flat_namespace
542 -force_cpusubtype_ALL -force_flat_namespace
543 -headerpad_max_install_names -iframework -image_base -init
544 -install_name -keep_private_externs -multi_module
545 -multiply_defined -multiply_defined_unused -noall_load
546 -no_dead_strip_inits_and_terms -nofixprebinding -nomultidefs
547 -noprebind -noseglinkedit -pagezero_size -prebind
548 -prebind_all_twolevel_modules -private_bundle -read_only_relocs
549 -sectalign -sectobjectsymbols -whyload -seg1addr -sectcreate
550 -sectobjectsymbols -sectorder -segaddr -segs_read_only_addr
551 -segs_read_write_addr -seg_addr_table -seg_addr_table_filename
552 -seglinkedit -segprot -segs_read_only_addr -segs_read_write_addr
553 -single_module -static -sub_library -sub_umbrella
554 -twolevel_namespace -umbrella -undefined -unexported_symbols_list
555 -weak_reference_mismatches -whatsloaded -F -gused -gfull
556 -mmacosx-version-min=version -mkernel -mone-byte-bool
557
558 DEC Alpha Options -mno-fp-regs -msoft-float -mieee
559 -mieee-with-inexact -mieee-conformant -mfp-trap-mode=mode
560 -mfp-rounding-mode=mode -mtrap-precision=mode -mbuild-constants
561 -mcpu=cpu-type -mtune=cpu-type -mbwx -mmax -mfix -mcix
562 -mfloat-vax -mfloat-ieee -mexplicit-relocs -msmall-data
563 -mlarge-data -msmall-text -mlarge-text -mmemory-latency=time
564
565 eBPF Options -mbig-endian -mlittle-endian -mkernel=version
566 -mframe-limit=bytes
567
568 FR30 Options -msmall-model -mno-lsim
569
570 FT32 Options -msim -mlra -mnodiv -mft32b -mcompress -mnopm
571
572 FRV Options -mgpr-32 -mgpr-64 -mfpr-32 -mfpr-64 -mhard-float
573 -msoft-float -malloc-cc -mfixed-cc -mdword -mno-dword -mdouble
574 -mno-double -mmedia -mno-media -mmuladd -mno-muladd -mfdpic
575 -minline-plt -mgprel-ro -multilib-library-pic -mlinked-fp
576 -mlong-calls -malign-labels -mlibrary-pic -macc-4 -macc-8 -mpack
577 -mno-pack -mno-eflags -mcond-move -mno-cond-move
578 -moptimize-membar -mno-optimize-membar -mscc -mno-scc
579 -mcond-exec -mno-cond-exec -mvliw-branch -mno-vliw-branch
580 -mmulti-cond-exec -mno-multi-cond-exec -mnested-cond-exec
581 -mno-nested-cond-exec -mtomcat-stats -mTLS -mtls -mcpu=cpu
582
583 GNU/Linux Options -mglibc -muclibc -mmusl -mbionic -mandroid
584 -tno-android-cc -tno-android-ld
585
586 H8/300 Options -mrelax -mh -ms -mn -mexr -mno-exr -mint32
587 -malign-300
588
589 HPPA Options -march=architecture-type -mcaller-copies
590 -mdisable-fpregs -mdisable-indexing -mfast-indirect-calls -mgas
591 -mgnu-ld -mhp-ld -mfixed-range=register-range -mjump-in-delay
592 -mlinker-opt -mlong-calls -mlong-load-store -mno-disable-fpregs
593 -mno-disable-indexing -mno-fast-indirect-calls -mno-gas
594 -mno-jump-in-delay -mno-long-load-store -mno-portable-runtime
595 -mno-soft-float -mno-space-regs -msoft-float -mpa-risc-1-0
596 -mpa-risc-1-1 -mpa-risc-2-0 -mportable-runtime -mschedule=cpu-
597 type -mspace-regs -msio -mwsio -munix=unix-std -nolibdld
598 -static -threads
599
600 IA-64 Options -mbig-endian -mlittle-endian -mgnu-as -mgnu-ld
601 -mno-pic -mvolatile-asm-stop -mregister-names -msdata -mno-sdata
602 -mconstant-gp -mauto-pic -mfused-madd
603 -minline-float-divide-min-latency
604 -minline-float-divide-max-throughput -mno-inline-float-divide
605 -minline-int-divide-min-latency -minline-int-divide-max-throughput
606 -mno-inline-int-divide -minline-sqrt-min-latency
607 -minline-sqrt-max-throughput -mno-inline-sqrt -mdwarf2-asm
608 -mearly-stop-bits -mfixed-range=register-range -mtls-size=tls-size
609 -mtune=cpu-type -milp32 -mlp64 -msched-br-data-spec
610 -msched-ar-data-spec -msched-control-spec -msched-br-in-data-spec
611 -msched-ar-in-data-spec -msched-in-control-spec -msched-spec-ldc
612 -msched-spec-control-ldc -msched-prefer-non-data-spec-insns
613 -msched-prefer-non-control-spec-insns
614 -msched-stop-bits-after-every-cycle
615 -msched-count-spec-in-critical-path
616 -msel-sched-dont-check-control-spec -msched-fp-mem-deps-zero-cost
617 -msched-max-memory-insns-hard-limit -msched-max-memory-insns=max-
618 insns
619
620 LM32 Options -mbarrel-shift-enabled -mdivide-enabled
621 -mmultiply-enabled -msign-extend-enabled -muser-enabled
622
623 M32R/D Options -m32r2 -m32rx -m32r -mdebug -malign-loops
624 -mno-align-loops -missue-rate=number -mbranch-cost=number
625 -mmodel=code-size-model-type -msdata=sdata-type -mno-flush-func
626 -mflush-func=name -mno-flush-trap -mflush-trap=number -G num
627
628 M32C Options -mcpu=cpu -msim -memregs=number
629
630 M680x0 Options -march=arch -mcpu=cpu -mtune=tune -m68000 -m68020
631 -m68020-40 -m68020-60 -m68030 -m68040 -m68060 -mcpu32 -m5200
632 -m5206e -m528x -m5307 -m5407 -mcfv4e -mbitfield -mno-bitfield
633 -mc68000 -mc68020 -mnobitfield -mrtd -mno-rtd -mdiv -mno-div
634 -mshort -mno-short -mhard-float -m68881 -msoft-float -mpcrel
635 -malign-int -mstrict-align -msep-data -mno-sep-data
636 -mshared-library-id=n -mid-shared-library -mno-id-shared-library
637 -mxgot -mno-xgot -mlong-jump-table-offsets
638
639 MCore Options -mhardlit -mno-hardlit -mdiv -mno-div
640 -mrelax-immediates -mno-relax-immediates -mwide-bitfields
641 -mno-wide-bitfields -m4byte-functions -mno-4byte-functions
642 -mcallgraph-data -mno-callgraph-data -mslow-bytes -mno-slow-bytes
643 -mno-lsim -mlittle-endian -mbig-endian -m210 -m340
644 -mstack-increment
645
646 MeP Options -mabsdiff -mall-opts -maverage -mbased=n -mbitops
647 -mc=n -mclip -mconfig=name -mcop -mcop32 -mcop64 -mivc2 -mdc
648 -mdiv -meb -mel -mio-volatile -ml -mleadz -mm -mminmax
649 -mmult -mno-opts -mrepeat -ms -msatur -msdram -msim
650 -msimnovec -mtf -mtiny=n
651
652 MicroBlaze Options -msoft-float -mhard-float -msmall-divides
653 -mcpu=cpu -mmemcpy -mxl-soft-mul -mxl-soft-div -mxl-barrel-shift
654 -mxl-pattern-compare -mxl-stack-check -mxl-gp-opt -mno-clearbss
655 -mxl-multiply-high -mxl-float-convert -mxl-float-sqrt
656 -mbig-endian -mlittle-endian -mxl-reorder -mxl-mode-app-model
657 -mpic-data-is-text-relative
658
659 MIPS Options -EL -EB -march=arch -mtune=arch -mips1 -mips2
660 -mips3 -mips4 -mips32 -mips32r2 -mips32r3 -mips32r5 -mips32r6
661 -mips64 -mips64r2 -mips64r3 -mips64r5 -mips64r6 -mips16
662 -mno-mips16 -mflip-mips16 -minterlink-compressed
663 -mno-interlink-compressed -minterlink-mips16 -mno-interlink-mips16
664 -mabi=abi -mabicalls -mno-abicalls -mshared -mno-shared -mplt
665 -mno-plt -mxgot -mno-xgot -mgp32 -mgp64 -mfp32 -mfpxx -mfp64
666 -mhard-float -msoft-float -mno-float -msingle-float
667 -mdouble-float -modd-spreg -mno-odd-spreg -mabs=mode
668 -mnan=encoding -mdsp -mno-dsp -mdspr2 -mno-dspr2 -mmcu
669 -mmno-mcu -meva -mno-eva -mvirt -mno-virt -mxpa -mno-xpa -mcrc
670 -mno-crc -mginv -mno-ginv -mmicromips -mno-micromips -mmsa
671 -mno-msa -mloongson-mmi -mno-loongson-mmi -mloongson-ext
672 -mno-loongson-ext -mloongson-ext2 -mno-loongson-ext2 -mfpu=fpu-
673 type -msmartmips -mno-smartmips -mpaired-single
674 -mno-paired-single -mdmx -mno-mdmx -mips3d -mno-mips3d -mmt
675 -mno-mt -mllsc -mno-llsc -mlong64 -mlong32 -msym32 -mno-sym32
676 -Gnum -mlocal-sdata -mno-local-sdata -mextern-sdata
677 -mno-extern-sdata -mgpopt -mno-gopt -membedded-data
678 -mno-embedded-data -muninit-const-in-rodata
679 -mno-uninit-const-in-rodata -mcode-readable=setting
680 -msplit-addresses -mno-split-addresses -mexplicit-relocs
681 -mno-explicit-relocs -mcheck-zero-division
682 -mno-check-zero-division -mdivide-traps -mdivide-breaks
683 -mload-store-pairs -mno-load-store-pairs -mmemcpy -mno-memcpy
684 -mlong-calls -mno-long-calls -mmad -mno-mad -mimadd -mno-imadd
685 -mfused-madd -mno-fused-madd -nocpp -mfix-24k -mno-fix-24k
686 -mfix-r4000 -mno-fix-r4000 -mfix-r4400 -mno-fix-r4400
687 -mfix-r5900 -mno-fix-r5900 -mfix-r10000 -mno-fix-r10000
688 -mfix-rm7000 -mno-fix-rm7000 -mfix-vr4120 -mno-fix-vr4120
689 -mfix-vr4130 -mno-fix-vr4130 -mfix-sb1 -mno-fix-sb1
690 -mflush-func=func -mno-flush-func -mbranch-cost=num
691 -mbranch-likely -mno-branch-likely -mcompact-branches=policy
692 -mfp-exceptions -mno-fp-exceptions -mvr4130-align
693 -mno-vr4130-align -msynci -mno-synci -mlxc1-sxc1 -mno-lxc1-sxc1
694 -mmadd4 -mno-madd4 -mrelax-pic-calls -mno-relax-pic-calls
695 -mmcount-ra-address -mframe-header-opt -mno-frame-header-opt
696
697 MMIX Options -mlibfuncs -mno-libfuncs -mepsilon -mno-epsilon
698 -mabi=gnu -mabi=mmixware -mzero-extend -mknuthdiv
699 -mtoplevel-symbols -melf -mbranch-predict -mno-branch-predict
700 -mbase-addresses -mno-base-addresses -msingle-exit
701 -mno-single-exit
702
703 MN10300 Options -mmult-bug -mno-mult-bug -mno-am33 -mam33
704 -mam33-2 -mam34 -mtune=cpu-type -mreturn-pointer-on-d0 -mno-crt0
705 -mrelax -mliw -msetlb
706
707 Moxie Options -meb -mel -mmul.x -mno-crt0
708
709 MSP430 Options -msim -masm-hex -mmcu= -mcpu= -mlarge -msmall
710 -mrelax -mwarn-mcu -mcode-region= -mdata-region= -msilicon-errata=
711 -msilicon-errata-warn= -mhwmult= -minrt -mtiny-printf
712
713 NDS32 Options -mbig-endian -mlittle-endian -mreduced-regs
714 -mfull-regs -mcmov -mno-cmov -mext-perf -mno-ext-perf -mext-perf2
715 -mno-ext-perf2 -mext-string -mno-ext-string -mv3push -mno-v3push
716 -m16bit -mno-16bit -misr-vector-size=num -mcache-block-size=num
717 -march=arch -mcmodel=code-model -mctor-dtor -mrelax
718
719 Nios II Options -G num -mgpopt=option -mgpopt -mno-gpopt
720 -mgprel-sec=regexp -mr0rel-sec=regexp -mel -meb -mno-bypass-cache
721 -mbypass-cache -mno-cache-volatile -mcache-volatile
722 -mno-fast-sw-div -mfast-sw-div -mhw-mul -mno-hw-mul -mhw-mulx
723 -mno-hw-mulx -mno-hw-div -mhw-div -mcustom-insn=N
724 -mno-custom-insn -mcustom-fpu-cfg=name -mhal -msmallc
725 -msys-crt0=name -msys-lib=name -march=arch -mbmx -mno-bmx -mcdx
726 -mno-cdx
727
728 Nvidia PTX Options -m32 -m64 -mmainkernel -moptimize
729
730 OpenRISC Options -mboard=name -mnewlib -mhard-mul -mhard-div
731 -msoft-mul -msoft-div -msoft-float -mhard-float -mdouble-float
732 -munordered-float -mcmov -mror -mrori -msext -msfimm -mshftimm
733
734 PDP-11 Options -mfpu -msoft-float -mac0 -mno-ac0 -m40 -m45
735 -m10 -mint32 -mno-int16 -mint16 -mno-int32 -msplit -munix-asm
736 -mdec-asm -mgnu-asm -mlra
737
738 picoChip Options -mae=ae_type -mvliw-lookahead=N
739 -msymbol-as-address -mno-inefficient-warnings
740
741 PowerPC Options See RS/6000 and PowerPC Options.
742
743 PRU Options -mmcu=mcu -minrt -mno-relax -mloop -mabi=variant
744
745 RISC-V Options -mbranch-cost=N-instruction -mplt -mno-plt
746 -mabi=ABI-string -mfdiv -mno-fdiv -mdiv -mno-div -march=ISA-
747 string -mtune=processor-string -mpreferred-stack-boundary=num
748 -msmall-data-limit=N-bytes -msave-restore -mno-save-restore
749 -mstrict-align -mno-strict-align -mcmodel=medlow -mcmodel=medany
750 -mexplicit-relocs -mno-explicit-relocs -mrelax -mno-relax
751 -mriscv-attribute -mmo-riscv-attribute -malign-data=type
752
753 RL78 Options -msim -mmul=none -mmul=g13 -mmul=g14 -mallregs
754 -mcpu=g10 -mcpu=g13 -mcpu=g14 -mg10 -mg13 -mg14
755 -m64bit-doubles -m32bit-doubles -msave-mduc-in-interrupts
756
757 RS/6000 and PowerPC Options -mcpu=cpu-type -mtune=cpu-type
758 -mcmodel=code-model -mpowerpc64 -maltivec -mno-altivec
759 -mpowerpc-gpopt -mno-powerpc-gpopt -mpowerpc-gfxopt
760 -mno-powerpc-gfxopt -mmfcrf -mno-mfcrf -mpopcntb -mno-popcntb
761 -mpopcntd -mno-popcntd -mfprnd -mno-fprnd -mcmpb -mno-cmpb
762 -mhard-dfp -mno-hard-dfp -mfull-toc -mminimal-toc
763 -mno-fp-in-toc -mno-sum-in-toc -m64 -m32 -mxl-compat
764 -mno-xl-compat -mpe -malign-power -malign-natural -msoft-float
765 -mhard-float -mmultiple -mno-multiple -mupdate -mno-update
766 -mavoid-indexed-addresses -mno-avoid-indexed-addresses
767 -mfused-madd -mno-fused-madd -mbit-align -mno-bit-align
768 -mstrict-align -mno-strict-align -mrelocatable -mno-relocatable
769 -mrelocatable-lib -mno-relocatable-lib -mtoc -mno-toc -mlittle
770 -mlittle-endian -mbig -mbig-endian -mdynamic-no-pic -mswdiv
771 -msingle-pic-base -mprioritize-restricted-insns=priority
772 -msched-costly-dep=dependence_type -minsert-sched-nops=scheme
773 -mcall-aixdesc -mcall-eabi -mcall-freebsd -mcall-linux
774 -mcall-netbsd -mcall-openbsd -mcall-sysv -mcall-sysv-eabi
775 -mcall-sysv-noeabi -mtraceback=traceback_type -maix-struct-return
776 -msvr4-struct-return -mabi=abi-type -msecure-plt -mbss-plt
777 -mlongcall -mno-longcall -mpltseq -mno-pltseq
778 -mblock-move-inline-limit=num -mblock-compare-inline-limit=num
779 -mblock-compare-inline-loop-limit=num
780 -mstring-compare-inline-limit=num -misel -mno-isel -mvrsave
781 -mno-vrsave -mmulhw -mno-mulhw -mdlmzb -mno-dlmzb -mprototype
782 -mno-prototype -msim -mmvme -mads -myellowknife -memb -msdata
783 -msdata=opt -mreadonly-in-sdata -mvxworks -G num -mrecip
784 -mrecip=opt -mno-recip -mrecip-precision -mno-recip-precision
785 -mveclibabi=type -mfriz -mno-friz -mpointers-to-nested-functions
786 -mno-pointers-to-nested-functions -msave-toc-indirect
787 -mno-save-toc-indirect -mpower8-fusion -mno-mpower8-fusion
788 -mpower8-vector -mno-power8-vector -mcrypto -mno-crypto -mhtm
789 -mno-htm -mquad-memory -mno-quad-memory -mquad-memory-atomic
790 -mno-quad-memory-atomic -mcompat-align-parm -mno-compat-align-parm
791 -mfloat128 -mno-float128 -mfloat128-hardware
792 -mno-float128-hardware -mgnu-attribute -mno-gnu-attribute
793 -mstack-protector-guard=guard -mstack-protector-guard-reg=reg
794 -mstack-protector-guard-offset=offset -mprefixed -mno-prefixed
795 -mpcrel -mno-pcrel
796
797 RX Options -m64bit-doubles -m32bit-doubles -fpu -nofpu -mcpu=
798 -mbig-endian-data -mlittle-endian-data -msmall-data -msim
799 -mno-sim -mas100-syntax -mno-as100-syntax -mrelax
800 -mmax-constant-size= -mint-register= -mpid -mallow-string-insns
801 -mno-allow-string-insns -mjsr -mno-warn-multiple-fast-interrupts
802 -msave-acc-in-interrupts
803
804 S/390 and zSeries Options -mtune=cpu-type -march=cpu-type
805 -mhard-float -msoft-float -mhard-dfp -mno-hard-dfp
806 -mlong-double-64 -mlong-double-128 -mbackchain -mno-backchain
807 -mpacked-stack -mno-packed-stack -msmall-exec -mno-small-exec
808 -mmvcle -mno-mvcle -m64 -m31 -mdebug -mno-debug -mesa -mzarch
809 -mhtm -mvx -mzvector -mtpf-trace -mno-tpf-trace
810 -mtpf-trace-skip -mno-tpf-trace-skip -mfused-madd -mno-fused-madd
811 -mwarn-framesize -mwarn-dynamicstack -mstack-size -mstack-guard
812 -mhotpatch=halfwords,halfwords
813
814 Score Options -meb -mel -mnhwloop -muls -mmac -mscore5 -mscore5u
815 -mscore7 -mscore7d
816
817 SH Options -m1 -m2 -m2e -m2a-nofpu -m2a-single-only -m2a-single
818 -m2a -m3 -m3e -m4-nofpu -m4-single-only -m4-single -m4
819 -m4a-nofpu -m4a-single-only -m4a-single -m4a -m4al -mb -ml
820 -mdalign -mrelax -mbigtable -mfmovd -mrenesas -mno-renesas
821 -mnomacsave -mieee -mno-ieee -mbitops -misize
822 -minline-ic_invalidate -mpadstruct -mprefergot -musermode
823 -multcost=number -mdiv=strategy -mdivsi3_libfunc=name
824 -mfixed-range=register-range -maccumulate-outgoing-args
825 -matomic-model=atomic-model -mbranch-cost=num -mzdcbranch
826 -mno-zdcbranch -mcbranch-force-delay-slot -mfused-madd
827 -mno-fused-madd -mfsca -mno-fsca -mfsrra -mno-fsrra
828 -mpretend-cmove -mtas
829
830 Solaris 2 Options -mclear-hwcap -mno-clear-hwcap -mimpure-text
831 -mno-impure-text -pthreads
832
833 SPARC Options -mcpu=cpu-type -mtune=cpu-type -mcmodel=code-model
834 -mmemory-model=mem-model -m32 -m64 -mapp-regs -mno-app-regs
835 -mfaster-structs -mno-faster-structs -mflat -mno-flat -mfpu
836 -mno-fpu -mhard-float -msoft-float -mhard-quad-float
837 -msoft-quad-float -mstack-bias -mno-stack-bias -mstd-struct-return
838 -mno-std-struct-return -munaligned-doubles -mno-unaligned-doubles
839 -muser-mode -mno-user-mode -mv8plus -mno-v8plus -mvis -mno-vis
840 -mvis2 -mno-vis2 -mvis3 -mno-vis3 -mvis4 -mno-vis4 -mvis4b
841 -mno-vis4b -mcbcond -mno-cbcond -mfmaf -mno-fmaf -mfsmuld
842 -mno-fsmuld -mpopc -mno-popc -msubxc -mno-subxc -mfix-at697f
843 -mfix-ut699 -mfix-ut700 -mfix-gr712rc -mlra -mno-lra
844
845 System V Options -Qy -Qn -YP,paths -Ym,dir
846
847 TILE-Gx Options -mcpu=CPU -m32 -m64 -mbig-endian
848 -mlittle-endian -mcmodel=code-model
849
850 TILEPro Options -mcpu=cpu -m32
851
852 V850 Options -mlong-calls -mno-long-calls -mep -mno-ep
853 -mprolog-function -mno-prolog-function -mspace -mtda=n -msda=n
854 -mzda=n -mapp-regs -mno-app-regs -mdisable-callt
855 -mno-disable-callt -mv850e2v3 -mv850e2 -mv850e1 -mv850es -mv850e
856 -mv850 -mv850e3v5 -mloop -mrelax -mlong-jumps -msoft-float
857 -mhard-float -mgcc-abi -mrh850-abi -mbig-switch
858
859 VAX Options -mg -mgnu -munix
860
861 Visium Options -mdebug -msim -mfpu -mno-fpu -mhard-float
862 -msoft-float -mcpu=cpu-type -mtune=cpu-type -msv-mode
863 -muser-mode
864
865 VMS Options -mvms-return-codes -mdebug-main=prefix -mmalloc64
866 -mpointer-size=size
867
868 VxWorks Options -mrtp -non-static -Bstatic -Bdynamic -Xbind-lazy
869 -Xbind-now
870
871 x86 Options -mtune=cpu-type -march=cpu-type -mtune-ctrl=feature-
872 list -mdump-tune-features -mno-default -mfpmath=unit
873 -masm=dialect -mno-fancy-math-387 -mno-fp-ret-in-387 -m80387
874 -mhard-float -msoft-float -mno-wide-multiply -mrtd
875 -malign-double -mpreferred-stack-boundary=num
876 -mincoming-stack-boundary=num -mcld -mcx16 -msahf -mmovbe
877 -mcrc32 -mrecip -mrecip=opt -mvzeroupper -mprefer-avx128
878 -mprefer-vector-width=opt -mmmx -msse -msse2 -msse3 -mssse3
879 -msse4.1 -msse4.2 -msse4 -mavx -mavx2 -mavx512f -mavx512pf
880 -mavx512er -mavx512cd -mavx512vl -mavx512bw -mavx512dq
881 -mavx512ifma -mavx512vbmi -msha -maes -mpclmul -mfsgsbase
882 -mrdrnd -mf16c -mfma -mpconfig -mwbnoinvd -mptwrite
883 -mprefetchwt1 -mclflushopt -mclwb -mxsavec -mxsaves -msse4a
884 -m3dnow -m3dnowa -mpopcnt -mabm -mbmi -mtbm -mfma4 -mxop
885 -madx -mlzcnt -mbmi2 -mfxsr -mxsave -mxsaveopt -mrtm -mhle
886 -mlwp -mmwaitx -mclzero -mpku -mthreads -mgfni -mvaes
887 -mwaitpkg -mshstk -mmanual-endbr -mforce-indirect-call
888 -mavx512vbmi2 -mavx512bf16 -menqcmd -mvpclmulqdq -mavx512bitalg
889 -mmovdiri -mmovdir64b -mavx512vpopcntdq -mavx5124fmaps
890 -mavx512vnni -mavx5124vnniw -mprfchw -mrdpid -mrdseed -msgx
891 -mavx512vp2intersect -mcldemote -mms-bitfields
892 -mno-align-stringops -minline-all-stringops
893 -minline-stringops-dynamically -mstringop-strategy=alg
894 -mmemcpy-strategy=strategy -mmemset-strategy=strategy -mpush-args
895 -maccumulate-outgoing-args -m128bit-long-double
896 -m96bit-long-double -mlong-double-64 -mlong-double-80
897 -mlong-double-128 -mregparm=num -msseregparm -mveclibabi=type
898 -mvect8-ret-in-mem -mpc32 -mpc64 -mpc80 -mstackrealign
899 -momit-leaf-frame-pointer -mno-red-zone -mno-tls-direct-seg-refs
900 -mcmodel=code-model -mabi=name -maddress-mode=mode -m32 -m64
901 -mx32 -m16 -miamcu -mlarge-data-threshold=num -msse2avx
902 -mfentry -mrecord-mcount -mnop-mcount -m8bit-idiv
903 -minstrument-return=type -mfentry-name=name -mfentry-section=name
904 -mavx256-split-unaligned-load -mavx256-split-unaligned-store
905 -malign-data=type -mstack-protector-guard=guard
906 -mstack-protector-guard-reg=reg
907 -mstack-protector-guard-offset=offset
908 -mstack-protector-guard-symbol=symbol -mgeneral-regs-only
909 -mcall-ms2sysv-xlogues -mindirect-branch=choice
910 -mfunction-return=choice -mindirect-branch-register
911
912 x86 Windows Options -mconsole -mcygwin -mno-cygwin -mdll
913 -mnop-fun-dllimport -mthread -municode -mwin32 -mwindows
914 -fno-set-stack-executable
915
916 Xstormy16 Options -msim
917
918 Xtensa Options -mconst16 -mno-const16 -mfused-madd
919 -mno-fused-madd -mforce-no-pic -mserialize-volatile
920 -mno-serialize-volatile -mtext-section-literals
921 -mno-text-section-literals -mauto-litpools -mno-auto-litpools
922 -mtarget-align -mno-target-align -mlongcalls -mno-longcalls
923
924 zSeries Options See S/390 and zSeries Options.
925
926 Options Controlling the Kind of Output
927 Compilation can involve up to four stages: preprocessing, compilation
928 proper, assembly and linking, always in that order. GCC is capable of
929 preprocessing and compiling several files either into several assembler
930 input files, or into one assembler input file; then each assembler
931 input file produces an object file, and linking combines all the object
932 files (those newly compiled, and those specified as input) into an
933 executable file.
934
935 For any given input file, the file name suffix determines what kind of
936 compilation is done:
937
938 file.c
939 C source code that must be preprocessed.
940
941 file.i
942 C source code that should not be preprocessed.
943
944 file.ii
945 C++ source code that should not be preprocessed.
946
947 file.m
948 Objective-C source code. Note that you must link with the libobjc
949 library to make an Objective-C program work.
950
951 file.mi
952 Objective-C source code that should not be preprocessed.
953
954 file.mm
955 file.M
956 Objective-C++ source code. Note that you must link with the
957 libobjc library to make an Objective-C++ program work. Note that
958 .M refers to a literal capital M.
959
960 file.mii
961 Objective-C++ source code that should not be preprocessed.
962
963 file.h
964 C, C++, Objective-C or Objective-C++ header file to be turned into
965 a precompiled header (default), or C, C++ header file to be turned
966 into an Ada spec (via the -fdump-ada-spec switch).
967
968 file.cc
969 file.cp
970 file.cxx
971 file.cpp
972 file.CPP
973 file.c++
974 file.C
975 C++ source code that must be preprocessed. Note that in .cxx, the
976 last two letters must both be literally x. Likewise, .C refers to
977 a literal capital C.
978
979 file.mm
980 file.M
981 Objective-C++ source code that must be preprocessed.
982
983 file.mii
984 Objective-C++ source code that should not be preprocessed.
985
986 file.hh
987 file.H
988 file.hp
989 file.hxx
990 file.hpp
991 file.HPP
992 file.h++
993 file.tcc
994 C++ header file to be turned into a precompiled header or Ada spec.
995
996 file.f
997 file.for
998 file.ftn
999 Fixed form Fortran source code that should not be preprocessed.
1000
1001 file.F
1002 file.FOR
1003 file.fpp
1004 file.FPP
1005 file.FTN
1006 Fixed form Fortran source code that must be preprocessed (with the
1007 traditional preprocessor).
1008
1009 file.f90
1010 file.f95
1011 file.f03
1012 file.f08
1013 Free form Fortran source code that should not be preprocessed.
1014
1015 file.F90
1016 file.F95
1017 file.F03
1018 file.F08
1019 Free form Fortran source code that must be preprocessed (with the
1020 traditional preprocessor).
1021
1022 file.go
1023 Go source code.
1024
1025 file.brig
1026 BRIG files (binary representation of HSAIL).
1027
1028 file.d
1029 D source code.
1030
1031 file.di
1032 D interface file.
1033
1034 file.dd
1035 D documentation code (Ddoc).
1036
1037 file.ads
1038 Ada source code file that contains a library unit declaration (a
1039 declaration of a package, subprogram, or generic, or a generic
1040 instantiation), or a library unit renaming declaration (a package,
1041 generic, or subprogram renaming declaration). Such files are also
1042 called specs.
1043
1044 file.adb
1045 Ada source code file containing a library unit body (a subprogram
1046 or package body). Such files are also called bodies.
1047
1048 file.s
1049 Assembler code.
1050
1051 file.S
1052 file.sx
1053 Assembler code that must be preprocessed.
1054
1055 other
1056 An object file to be fed straight into linking. Any file name with
1057 no recognized suffix is treated this way.
1058
1059 You can specify the input language explicitly with the -x option:
1060
1061 -x language
1062 Specify explicitly the language for the following input files
1063 (rather than letting the compiler choose a default based on the
1064 file name suffix). This option applies to all following input
1065 files until the next -x option. Possible values for language are:
1066
1067 c c-header cpp-output
1068 c++ c++-header c++-cpp-output
1069 objective-c objective-c-header objective-c-cpp-output
1070 objective-c++ objective-c++-header objective-c++-cpp-output
1071 assembler assembler-with-cpp
1072 ada
1073 d
1074 f77 f77-cpp-input f95 f95-cpp-input
1075 go
1076 brig
1077
1078 -x none
1079 Turn off any specification of a language, so that subsequent files
1080 are handled according to their file name suffixes (as they are if
1081 -x has not been used at all).
1082
1083 If you only want some of the stages of compilation, you can use -x (or
1084 filename suffixes) to tell gcc where to start, and one of the options
1085 -c, -S, or -E to say where gcc is to stop. Note that some combinations
1086 (for example, -x cpp-output -E) instruct gcc to do nothing at all.
1087
1088 -c Compile or assemble the source files, but do not link. The linking
1089 stage simply is not done. The ultimate output is in the form of an
1090 object file for each source file.
1091
1092 By default, the object file name for a source file is made by
1093 replacing the suffix .c, .i, .s, etc., with .o.
1094
1095 Unrecognized input files, not requiring compilation or assembly,
1096 are ignored.
1097
1098 -S Stop after the stage of compilation proper; do not assemble. The
1099 output is in the form of an assembler code file for each non-
1100 assembler input file specified.
1101
1102 By default, the assembler file name for a source file is made by
1103 replacing the suffix .c, .i, etc., with .s.
1104
1105 Input files that don't require compilation are ignored.
1106
1107 -E Stop after the preprocessing stage; do not run the compiler proper.
1108 The output is in the form of preprocessed source code, which is
1109 sent to the standard output.
1110
1111 Input files that don't require preprocessing are ignored.
1112
1113 -o file
1114 Place output in file file. This applies to whatever sort of output
1115 is being produced, whether it be an executable file, an object
1116 file, an assembler file or preprocessed C code.
1117
1118 If -o is not specified, the default is to put an executable file in
1119 a.out, the object file for source.suffix in source.o, its assembler
1120 file in source.s, a precompiled header file in source.suffix.gch,
1121 and all preprocessed C source on standard output.
1122
1123 -v Print (on standard error output) the commands executed to run the
1124 stages of compilation. Also print the version number of the
1125 compiler driver program and of the preprocessor and the compiler
1126 proper.
1127
1128 -###
1129 Like -v except the commands are not executed and arguments are
1130 quoted unless they contain only alphanumeric characters or "./-_".
1131 This is useful for shell scripts to capture the driver-generated
1132 command lines.
1133
1134 --help
1135 Print (on the standard output) a description of the command-line
1136 options understood by gcc. If the -v option is also specified then
1137 --help is also passed on to the various processes invoked by gcc,
1138 so that they can display the command-line options they accept. If
1139 the -Wextra option has also been specified (prior to the --help
1140 option), then command-line options that have no documentation
1141 associated with them are also displayed.
1142
1143 --target-help
1144 Print (on the standard output) a description of target-specific
1145 command-line options for each tool. For some targets extra target-
1146 specific information may also be printed.
1147
1148 --help={class|[^]qualifier}[,...]
1149 Print (on the standard output) a description of the command-line
1150 options understood by the compiler that fit into all specified
1151 classes and qualifiers. These are the supported classes:
1152
1153 optimizers
1154 Display all of the optimization options supported by the
1155 compiler.
1156
1157 warnings
1158 Display all of the options controlling warning messages
1159 produced by the compiler.
1160
1161 target
1162 Display target-specific options. Unlike the --target-help
1163 option however, target-specific options of the linker and
1164 assembler are not displayed. This is because those tools do
1165 not currently support the extended --help= syntax.
1166
1167 params
1168 Display the values recognized by the --param option.
1169
1170 language
1171 Display the options supported for language, where language is
1172 the name of one of the languages supported in this version of
1173 GCC. If an option is supported by all languages, one needs to
1174 select common class.
1175
1176 common
1177 Display the options that are common to all languages.
1178
1179 These are the supported qualifiers:
1180
1181 undocumented
1182 Display only those options that are undocumented.
1183
1184 joined
1185 Display options taking an argument that appears after an equal
1186 sign in the same continuous piece of text, such as:
1187 --help=target.
1188
1189 separate
1190 Display options taking an argument that appears as a separate
1191 word following the original option, such as: -o output-file.
1192
1193 Thus for example to display all the undocumented target-specific
1194 switches supported by the compiler, use:
1195
1196 --help=target,undocumented
1197
1198 The sense of a qualifier can be inverted by prefixing it with the ^
1199 character, so for example to display all binary warning options
1200 (i.e., ones that are either on or off and that do not take an
1201 argument) that have a description, use:
1202
1203 --help=warnings,^joined,^undocumented
1204
1205 The argument to --help= should not consist solely of inverted
1206 qualifiers.
1207
1208 Combining several classes is possible, although this usually
1209 restricts the output so much that there is nothing to display. One
1210 case where it does work, however, is when one of the classes is
1211 target. For example, to display all the target-specific
1212 optimization options, use:
1213
1214 --help=target,optimizers
1215
1216 The --help= option can be repeated on the command line. Each
1217 successive use displays its requested class of options, skipping
1218 those that have already been displayed. If --help is also
1219 specified anywhere on the command line then this takes precedence
1220 over any --help= option.
1221
1222 If the -Q option appears on the command line before the --help=
1223 option, then the descriptive text displayed by --help= is changed.
1224 Instead of describing the displayed options, an indication is given
1225 as to whether the option is enabled, disabled or set to a specific
1226 value (assuming that the compiler knows this at the point where the
1227 --help= option is used).
1228
1229 Here is a truncated example from the ARM port of gcc:
1230
1231 % gcc -Q -mabi=2 --help=target -c
1232 The following options are target specific:
1233 -mabi= 2
1234 -mabort-on-noreturn [disabled]
1235 -mapcs [disabled]
1236
1237 The output is sensitive to the effects of previous command-line
1238 options, so for example it is possible to find out which
1239 optimizations are enabled at -O2 by using:
1240
1241 -Q -O2 --help=optimizers
1242
1243 Alternatively you can discover which binary optimizations are
1244 enabled by -O3 by using:
1245
1246 gcc -c -Q -O3 --help=optimizers > /tmp/O3-opts
1247 gcc -c -Q -O2 --help=optimizers > /tmp/O2-opts
1248 diff /tmp/O2-opts /tmp/O3-opts | grep enabled
1249
1250 --version
1251 Display the version number and copyrights of the invoked GCC.
1252
1253 -pass-exit-codes
1254 Normally the gcc program exits with the code of 1 if any phase of
1255 the compiler returns a non-success return code. If you specify
1256 -pass-exit-codes, the gcc program instead returns with the
1257 numerically highest error produced by any phase returning an error
1258 indication. The C, C++, and Fortran front ends return 4 if an
1259 internal compiler error is encountered.
1260
1261 -pipe
1262 Use pipes rather than temporary files for communication between the
1263 various stages of compilation. This fails to work on some systems
1264 where the assembler is unable to read from a pipe; but the GNU
1265 assembler has no trouble.
1266
1267 -specs=file
1268 Process file after the compiler reads in the standard specs file,
1269 in order to override the defaults which the gcc driver program uses
1270 when determining what switches to pass to cc1, cc1plus, as, ld,
1271 etc. More than one -specs=file can be specified on the command
1272 line, and they are processed in order, from left to right.
1273
1274 -wrapper
1275 Invoke all subcommands under a wrapper program. The name of the
1276 wrapper program and its parameters are passed as a comma separated
1277 list.
1278
1279 gcc -c t.c -wrapper gdb,--args
1280
1281 This invokes all subprograms of gcc under gdb --args, thus the
1282 invocation of cc1 is gdb --args cc1 ....
1283
1284 -ffile-prefix-map=old=new
1285 When compiling files residing in directory old, record any
1286 references to them in the result of the compilation as if the files
1287 resided in directory new instead. Specifying this option is
1288 equivalent to specifying all the individual -f*-prefix-map options.
1289 This can be used to make reproducible builds that are location
1290 independent. See also -fmacro-prefix-map and -fdebug-prefix-map.
1291
1292 -fplugin=name.so
1293 Load the plugin code in file name.so, assumed to be a shared object
1294 to be dlopen'd by the compiler. The base name of the shared object
1295 file is used to identify the plugin for the purposes of argument
1296 parsing (See -fplugin-arg-name-key=value below). Each plugin
1297 should define the callback functions specified in the Plugins API.
1298
1299 -fplugin-arg-name-key=value
1300 Define an argument called key with a value of value for the plugin
1301 called name.
1302
1303 -fdump-ada-spec[-slim]
1304 For C and C++ source and include files, generate corresponding Ada
1305 specs.
1306
1307 -fada-spec-parent=unit
1308 In conjunction with -fdump-ada-spec[-slim] above, generate Ada
1309 specs as child units of parent unit.
1310
1311 -fdump-go-spec=file
1312 For input files in any language, generate corresponding Go
1313 declarations in file. This generates Go "const", "type", "var",
1314 and "func" declarations which may be a useful way to start writing
1315 a Go interface to code written in some other language.
1316
1317 @file
1318 Read command-line options from file. The options read are inserted
1319 in place of the original @file option. If file does not exist, or
1320 cannot be read, then the option will be treated literally, and not
1321 removed.
1322
1323 Options in file are separated by whitespace. A whitespace
1324 character may be included in an option by surrounding the entire
1325 option in either single or double quotes. Any character (including
1326 a backslash) may be included by prefixing the character to be
1327 included with a backslash. The file may itself contain additional
1328 @file options; any such options will be processed recursively.
1329
1330 Compiling C++ Programs
1331 C++ source files conventionally use one of the suffixes .C, .cc, .cpp,
1332 .CPP, .c++, .cp, or .cxx; C++ header files often use .hh, .hpp, .H, or
1333 (for shared template code) .tcc; and preprocessed C++ files use the
1334 suffix .ii. GCC recognizes files with these names and compiles them as
1335 C++ programs even if you call the compiler the same way as for
1336 compiling C programs (usually with the name gcc).
1337
1338 However, the use of gcc does not add the C++ library. g++ is a program
1339 that calls GCC and automatically specifies linking against the C++
1340 library. It treats .c, .h and .i files as C++ source files instead of
1341 C source files unless -x is used. This program is also useful when
1342 precompiling a C header file with a .h extension for use in C++
1343 compilations. On many systems, g++ is also installed with the name
1344 c++.
1345
1346 When you compile C++ programs, you may specify many of the same
1347 command-line options that you use for compiling programs in any
1348 language; or command-line options meaningful for C and related
1349 languages; or options that are meaningful only for C++ programs.
1350
1351 Options Controlling C Dialect
1352 The following options control the dialect of C (or languages derived
1353 from C, such as C++, Objective-C and Objective-C++) that the compiler
1354 accepts:
1355
1356 -ansi
1357 In C mode, this is equivalent to -std=c90. In C++ mode, it is
1358 equivalent to -std=c++98.
1359
1360 This turns off certain features of GCC that are incompatible with
1361 ISO C90 (when compiling C code), or of standard C++ (when compiling
1362 C++ code), such as the "asm" and "typeof" keywords, and predefined
1363 macros such as "unix" and "vax" that identify the type of system
1364 you are using. It also enables the undesirable and rarely used ISO
1365 trigraph feature. For the C compiler, it disables recognition of
1366 C++ style // comments as well as the "inline" keyword.
1367
1368 The alternate keywords "__asm__", "__extension__", "__inline__" and
1369 "__typeof__" continue to work despite -ansi. You would not want to
1370 use them in an ISO C program, of course, but it is useful to put
1371 them in header files that might be included in compilations done
1372 with -ansi. Alternate predefined macros such as "__unix__" and
1373 "__vax__" are also available, with or without -ansi.
1374
1375 The -ansi option does not cause non-ISO programs to be rejected
1376 gratuitously. For that, -Wpedantic is required in addition to
1377 -ansi.
1378
1379 The macro "__STRICT_ANSI__" is predefined when the -ansi option is
1380 used. Some header files may notice this macro and refrain from
1381 declaring certain functions or defining certain macros that the ISO
1382 standard doesn't call for; this is to avoid interfering with any
1383 programs that might use these names for other things.
1384
1385 Functions that are normally built in but do not have semantics
1386 defined by ISO C (such as "alloca" and "ffs") are not built-in
1387 functions when -ansi is used.
1388
1389 -std=
1390 Determine the language standard. This option is currently only
1391 supported when compiling C or C++.
1392
1393 The compiler can accept several base standards, such as c90 or
1394 c++98, and GNU dialects of those standards, such as gnu90 or
1395 gnu++98. When a base standard is specified, the compiler accepts
1396 all programs following that standard plus those using GNU
1397 extensions that do not contradict it. For example, -std=c90 turns
1398 off certain features of GCC that are incompatible with ISO C90,
1399 such as the "asm" and "typeof" keywords, but not other GNU
1400 extensions that do not have a meaning in ISO C90, such as omitting
1401 the middle term of a "?:" expression. On the other hand, when a GNU
1402 dialect of a standard is specified, all features supported by the
1403 compiler are enabled, even when those features change the meaning
1404 of the base standard. As a result, some strict-conforming programs
1405 may be rejected. The particular standard is used by -Wpedantic to
1406 identify which features are GNU extensions given that version of
1407 the standard. For example -std=gnu90 -Wpedantic warns about C++
1408 style // comments, while -std=gnu99 -Wpedantic does not.
1409
1410 A value for this option must be provided; possible values are
1411
1412 c90
1413 c89
1414 iso9899:1990
1415 Support all ISO C90 programs (certain GNU extensions that
1416 conflict with ISO C90 are disabled). Same as -ansi for C code.
1417
1418 iso9899:199409
1419 ISO C90 as modified in amendment 1.
1420
1421 c99
1422 c9x
1423 iso9899:1999
1424 iso9899:199x
1425 ISO C99. This standard is substantially completely supported,
1426 modulo bugs and floating-point issues (mainly but not entirely
1427 relating to optional C99 features from Annexes F and G). See
1428 <http://gcc.gnu.org/c99status.html> for more information. The
1429 names c9x and iso9899:199x are deprecated.
1430
1431 c11
1432 c1x
1433 iso9899:2011
1434 ISO C11, the 2011 revision of the ISO C standard. This
1435 standard is substantially completely supported, modulo bugs,
1436 floating-point issues (mainly but not entirely relating to
1437 optional C11 features from Annexes F and G) and the optional
1438 Annexes K (Bounds-checking interfaces) and L (Analyzability).
1439 The name c1x is deprecated.
1440
1441 c17
1442 c18
1443 iso9899:2017
1444 iso9899:2018
1445 ISO C17, the 2017 revision of the ISO C standard (published in
1446 2018). This standard is same as C11 except for corrections of
1447 defects (all of which are also applied with -std=c11) and a new
1448 value of "__STDC_VERSION__", and so is supported to the same
1449 extent as C11.
1450
1451 c2x The next version of the ISO C standard, still under
1452 development. The support for this version is experimental and
1453 incomplete.
1454
1455 gnu90
1456 gnu89
1457 GNU dialect of ISO C90 (including some C99 features).
1458
1459 gnu99
1460 gnu9x
1461 GNU dialect of ISO C99. The name gnu9x is deprecated.
1462
1463 gnu11
1464 gnu1x
1465 GNU dialect of ISO C11. The name gnu1x is deprecated.
1466
1467 gnu17
1468 gnu18
1469 GNU dialect of ISO C17. This is the default for C code.
1470
1471 gnu2x
1472 The next version of the ISO C standard, still under
1473 development, plus GNU extensions. The support for this version
1474 is experimental and incomplete.
1475
1476 c++98
1477 c++03
1478 The 1998 ISO C++ standard plus the 2003 technical corrigendum
1479 and some additional defect reports. Same as -ansi for C++ code.
1480
1481 gnu++98
1482 gnu++03
1483 GNU dialect of -std=c++98.
1484
1485 c++11
1486 c++0x
1487 The 2011 ISO C++ standard plus amendments. The name c++0x is
1488 deprecated.
1489
1490 gnu++11
1491 gnu++0x
1492 GNU dialect of -std=c++11. The name gnu++0x is deprecated.
1493
1494 c++14
1495 c++1y
1496 The 2014 ISO C++ standard plus amendments. The name c++1y is
1497 deprecated.
1498
1499 gnu++14
1500 gnu++1y
1501 GNU dialect of -std=c++14. This is the default for C++ code.
1502 The name gnu++1y is deprecated.
1503
1504 c++17
1505 c++1z
1506 The 2017 ISO C++ standard plus amendments. The name c++1z is
1507 deprecated.
1508
1509 gnu++17
1510 gnu++1z
1511 GNU dialect of -std=c++17. The name gnu++1z is deprecated.
1512
1513 c++20
1514 c++2a
1515 The next revision of the ISO C++ standard, planned for 2020.
1516 Support is highly experimental, and will almost certainly
1517 change in incompatible ways in future releases.
1518
1519 gnu++20
1520 gnu++2a
1521 GNU dialect of -std=c++20. Support is highly experimental, and
1522 will almost certainly change in incompatible ways in future
1523 releases.
1524
1525 -fgnu89-inline
1526 The option -fgnu89-inline tells GCC to use the traditional GNU
1527 semantics for "inline" functions when in C99 mode.
1528
1529 Using this option is roughly equivalent to adding the "gnu_inline"
1530 function attribute to all inline functions.
1531
1532 The option -fno-gnu89-inline explicitly tells GCC to use the C99
1533 semantics for "inline" when in C99 or gnu99 mode (i.e., it
1534 specifies the default behavior). This option is not supported in
1535 -std=c90 or -std=gnu90 mode.
1536
1537 The preprocessor macros "__GNUC_GNU_INLINE__" and
1538 "__GNUC_STDC_INLINE__" may be used to check which semantics are in
1539 effect for "inline" functions.
1540
1541 -fpermitted-flt-eval-methods=style
1542 ISO/IEC TS 18661-3 defines new permissible values for
1543 "FLT_EVAL_METHOD" that indicate that operations and constants with
1544 a semantic type that is an interchange or extended format should be
1545 evaluated to the precision and range of that type. These new
1546 values are a superset of those permitted under C99/C11, which does
1547 not specify the meaning of other positive values of
1548 "FLT_EVAL_METHOD". As such, code conforming to C11 may not have
1549 been written expecting the possibility of the new values.
1550
1551 -fpermitted-flt-eval-methods specifies whether the compiler should
1552 allow only the values of "FLT_EVAL_METHOD" specified in C99/C11, or
1553 the extended set of values specified in ISO/IEC TS 18661-3.
1554
1555 style is either "c11" or "ts-18661-3" as appropriate.
1556
1557 The default when in a standards compliant mode (-std=c11 or
1558 similar) is -fpermitted-flt-eval-methods=c11. The default when in
1559 a GNU dialect (-std=gnu11 or similar) is
1560 -fpermitted-flt-eval-methods=ts-18661-3.
1561
1562 -aux-info filename
1563 Output to the given filename prototyped declarations for all
1564 functions declared and/or defined in a translation unit, including
1565 those in header files. This option is silently ignored in any
1566 language other than C.
1567
1568 Besides declarations, the file indicates, in comments, the origin
1569 of each declaration (source file and line), whether the declaration
1570 was implicit, prototyped or unprototyped (I, N for new or O for
1571 old, respectively, in the first character after the line number and
1572 the colon), and whether it came from a declaration or a definition
1573 (C or F, respectively, in the following character). In the case of
1574 function definitions, a K&R-style list of arguments followed by
1575 their declarations is also provided, inside comments, after the
1576 declaration.
1577
1578 -fallow-parameterless-variadic-functions
1579 Accept variadic functions without named parameters.
1580
1581 Although it is possible to define such a function, this is not very
1582 useful as it is not possible to read the arguments. This is only
1583 supported for C as this construct is allowed by C++.
1584
1585 -fno-asm
1586 Do not recognize "asm", "inline" or "typeof" as a keyword, so that
1587 code can use these words as identifiers. You can use the keywords
1588 "__asm__", "__inline__" and "__typeof__" instead. -ansi implies
1589 -fno-asm.
1590
1591 In C++, this switch only affects the "typeof" keyword, since "asm"
1592 and "inline" are standard keywords. You may want to use the
1593 -fno-gnu-keywords flag instead, which has the same effect. In C99
1594 mode (-std=c99 or -std=gnu99), this switch only affects the "asm"
1595 and "typeof" keywords, since "inline" is a standard keyword in ISO
1596 C99.
1597
1598 -fno-builtin
1599 -fno-builtin-function
1600 Don't recognize built-in functions that do not begin with
1601 __builtin_ as prefix.
1602
1603 GCC normally generates special code to handle certain built-in
1604 functions more efficiently; for instance, calls to "alloca" may
1605 become single instructions which adjust the stack directly, and
1606 calls to "memcpy" may become inline copy loops. The resulting code
1607 is often both smaller and faster, but since the function calls no
1608 longer appear as such, you cannot set a breakpoint on those calls,
1609 nor can you change the behavior of the functions by linking with a
1610 different library. In addition, when a function is recognized as a
1611 built-in function, GCC may use information about that function to
1612 warn about problems with calls to that function, or to generate
1613 more efficient code, even if the resulting code still contains
1614 calls to that function. For example, warnings are given with
1615 -Wformat for bad calls to "printf" when "printf" is built in and
1616 "strlen" is known not to modify global memory.
1617
1618 With the -fno-builtin-function option only the built-in function
1619 function is disabled. function must not begin with __builtin_. If
1620 a function is named that is not built-in in this version of GCC,
1621 this option is ignored. There is no corresponding
1622 -fbuiltin-function option; if you wish to enable built-in functions
1623 selectively when using -fno-builtin or -ffreestanding, you may
1624 define macros such as:
1625
1626 #define abs(n) __builtin_abs ((n))
1627 #define strcpy(d, s) __builtin_strcpy ((d), (s))
1628
1629 -fgimple
1630 Enable parsing of function definitions marked with "__GIMPLE".
1631 This is an experimental feature that allows unit testing of GIMPLE
1632 passes.
1633
1634 -fhosted
1635 Assert that compilation targets a hosted environment. This implies
1636 -fbuiltin. A hosted environment is one in which the entire
1637 standard library is available, and in which "main" has a return
1638 type of "int". Examples are nearly everything except a kernel.
1639 This is equivalent to -fno-freestanding.
1640
1641 -ffreestanding
1642 Assert that compilation targets a freestanding environment. This
1643 implies -fno-builtin. A freestanding environment is one in which
1644 the standard library may not exist, and program startup may not
1645 necessarily be at "main". The most obvious example is an OS
1646 kernel. This is equivalent to -fno-hosted.
1647
1648 -fopenacc
1649 Enable handling of OpenACC directives "#pragma acc" in C/C++ and
1650 "!$acc" in Fortran. When -fopenacc is specified, the compiler
1651 generates accelerated code according to the OpenACC Application
1652 Programming Interface v2.6 <https://www.openacc.org>. This option
1653 implies -pthread, and thus is only supported on targets that have
1654 support for -pthread.
1655
1656 -fopenacc-dim=geom
1657 Specify default compute dimensions for parallel offload regions
1658 that do not explicitly specify. The geom value is a triple of
1659 ':'-separated sizes, in order 'gang', 'worker' and, 'vector'. A
1660 size can be omitted, to use a target-specific default value.
1661
1662 -fopenmp
1663 Enable handling of OpenMP directives "#pragma omp" in C/C++ and
1664 "!$omp" in Fortran. When -fopenmp is specified, the compiler
1665 generates parallel code according to the OpenMP Application Program
1666 Interface v4.5 <https://www.openmp.org>. This option implies
1667 -pthread, and thus is only supported on targets that have support
1668 for -pthread. -fopenmp implies -fopenmp-simd.
1669
1670 -fopenmp-simd
1671 Enable handling of OpenMP's SIMD directives with "#pragma omp" in
1672 C/C++ and "!$omp" in Fortran. Other OpenMP directives are ignored.
1673
1674 -fgnu-tm
1675 When the option -fgnu-tm is specified, the compiler generates code
1676 for the Linux variant of Intel's current Transactional Memory ABI
1677 specification document (Revision 1.1, May 6 2009). This is an
1678 experimental feature whose interface may change in future versions
1679 of GCC, as the official specification changes. Please note that
1680 not all architectures are supported for this feature.
1681
1682 For more information on GCC's support for transactional memory,
1683
1684 Note that the transactional memory feature is not supported with
1685 non-call exceptions (-fnon-call-exceptions).
1686
1687 -fms-extensions
1688 Accept some non-standard constructs used in Microsoft header files.
1689
1690 In C++ code, this allows member names in structures to be similar
1691 to previous types declarations.
1692
1693 typedef int UOW;
1694 struct ABC {
1695 UOW UOW;
1696 };
1697
1698 Some cases of unnamed fields in structures and unions are only
1699 accepted with this option.
1700
1701 Note that this option is off for all targets except for x86 targets
1702 using ms-abi.
1703
1704 -fplan9-extensions
1705 Accept some non-standard constructs used in Plan 9 code.
1706
1707 This enables -fms-extensions, permits passing pointers to
1708 structures with anonymous fields to functions that expect pointers
1709 to elements of the type of the field, and permits referring to
1710 anonymous fields declared using a typedef. This is only
1711 supported for C, not C++.
1712
1713 -fcond-mismatch
1714 Allow conditional expressions with mismatched types in the second
1715 and third arguments. The value of such an expression is void.
1716 This option is not supported for C++.
1717
1718 -flax-vector-conversions
1719 Allow implicit conversions between vectors with differing numbers
1720 of elements and/or incompatible element types. This option should
1721 not be used for new code.
1722
1723 -funsigned-char
1724 Let the type "char" be unsigned, like "unsigned char".
1725
1726 Each kind of machine has a default for what "char" should be. It
1727 is either like "unsigned char" by default or like "signed char" by
1728 default.
1729
1730 Ideally, a portable program should always use "signed char" or
1731 "unsigned char" when it depends on the signedness of an object.
1732 But many programs have been written to use plain "char" and expect
1733 it to be signed, or expect it to be unsigned, depending on the
1734 machines they were written for. This option, and its inverse, let
1735 you make such a program work with the opposite default.
1736
1737 The type "char" is always a distinct type from each of "signed
1738 char" or "unsigned char", even though its behavior is always just
1739 like one of those two.
1740
1741 -fsigned-char
1742 Let the type "char" be signed, like "signed char".
1743
1744 Note that this is equivalent to -fno-unsigned-char, which is the
1745 negative form of -funsigned-char. Likewise, the option
1746 -fno-signed-char is equivalent to -funsigned-char.
1747
1748 -fsigned-bitfields
1749 -funsigned-bitfields
1750 -fno-signed-bitfields
1751 -fno-unsigned-bitfields
1752 These options control whether a bit-field is signed or unsigned,
1753 when the declaration does not use either "signed" or "unsigned".
1754 By default, such a bit-field is signed, because this is consistent:
1755 the basic integer types such as "int" are signed types.
1756
1757 -fsso-struct=endianness
1758 Set the default scalar storage order of structures and unions to
1759 the specified endianness. The accepted values are big-endian,
1760 little-endian and native for the native endianness of the target
1761 (the default). This option is not supported for C++.
1762
1763 Warning: the -fsso-struct switch causes GCC to generate code that
1764 is not binary compatible with code generated without it if the
1765 specified endianness is not the native endianness of the target.
1766
1767 Options Controlling C++ Dialect
1768 This section describes the command-line options that are only
1769 meaningful for C++ programs. You can also use most of the GNU compiler
1770 options regardless of what language your program is in. For example,
1771 you might compile a file firstClass.C like this:
1772
1773 g++ -g -fstrict-enums -O -c firstClass.C
1774
1775 In this example, only -fstrict-enums is an option meant only for C++
1776 programs; you can use the other options with any language supported by
1777 GCC.
1778
1779 Some options for compiling C programs, such as -std, are also relevant
1780 for C++ programs.
1781
1782 Here is a list of options that are only for compiling C++ programs:
1783
1784 -fabi-version=n
1785 Use version n of the C++ ABI. The default is version 0.
1786
1787 Version 0 refers to the version conforming most closely to the C++
1788 ABI specification. Therefore, the ABI obtained using version 0
1789 will change in different versions of G++ as ABI bugs are fixed.
1790
1791 Version 1 is the version of the C++ ABI that first appeared in G++
1792 3.2.
1793
1794 Version 2 is the version of the C++ ABI that first appeared in G++
1795 3.4, and was the default through G++ 4.9.
1796
1797 Version 3 corrects an error in mangling a constant address as a
1798 template argument.
1799
1800 Version 4, which first appeared in G++ 4.5, implements a standard
1801 mangling for vector types.
1802
1803 Version 5, which first appeared in G++ 4.6, corrects the mangling
1804 of attribute const/volatile on function pointer types, decltype of
1805 a plain decl, and use of a function parameter in the declaration of
1806 another parameter.
1807
1808 Version 6, which first appeared in G++ 4.7, corrects the promotion
1809 behavior of C++11 scoped enums and the mangling of template
1810 argument packs, const/static_cast, prefix ++ and --, and a class
1811 scope function used as a template argument.
1812
1813 Version 7, which first appeared in G++ 4.8, that treats nullptr_t
1814 as a builtin type and corrects the mangling of lambdas in default
1815 argument scope.
1816
1817 Version 8, which first appeared in G++ 4.9, corrects the
1818 substitution behavior of function types with function-cv-
1819 qualifiers.
1820
1821 Version 9, which first appeared in G++ 5.2, corrects the alignment
1822 of "nullptr_t".
1823
1824 Version 10, which first appeared in G++ 6.1, adds mangling of
1825 attributes that affect type identity, such as ia32 calling
1826 convention attributes (e.g. stdcall).
1827
1828 Version 11, which first appeared in G++ 7, corrects the mangling of
1829 sizeof... expressions and operator names. For multiple entities
1830 with the same name within a function, that are declared in
1831 different scopes, the mangling now changes starting with the
1832 twelfth occurrence. It also implies -fnew-inheriting-ctors.
1833
1834 Version 12, which first appeared in G++ 8, corrects the calling
1835 conventions for empty classes on the x86_64 target and for classes
1836 with only deleted copy/move constructors. It accidentally changes
1837 the calling convention for classes with a deleted copy constructor
1838 and a trivial move constructor.
1839
1840 Version 13, which first appeared in G++ 8.2, fixes the accidental
1841 change in version 12.
1842
1843 Version 14, which first appeared in G++ 10, corrects the mangling
1844 of the nullptr expression.
1845
1846 See also -Wabi.
1847
1848 -fabi-compat-version=n
1849 On targets that support strong aliases, G++ works around mangling
1850 changes by creating an alias with the correct mangled name when
1851 defining a symbol with an incorrect mangled name. This switch
1852 specifies which ABI version to use for the alias.
1853
1854 With -fabi-version=0 (the default), this defaults to 11 (GCC 7
1855 compatibility). If another ABI version is explicitly selected,
1856 this defaults to 0. For compatibility with GCC versions 3.2
1857 through 4.9, use -fabi-compat-version=2.
1858
1859 If this option is not provided but -Wabi=n is, that version is used
1860 for compatibility aliases. If this option is provided along with
1861 -Wabi (without the version), the version from this option is used
1862 for the warning.
1863
1864 -fno-access-control
1865 Turn off all access checking. This switch is mainly useful for
1866 working around bugs in the access control code.
1867
1868 -faligned-new
1869 Enable support for C++17 "new" of types that require more alignment
1870 than "void* ::operator new(std::size_t)" provides. A numeric
1871 argument such as "-faligned-new=32" can be used to specify how much
1872 alignment (in bytes) is provided by that function, but few users
1873 will need to override the default of "alignof(std::max_align_t)".
1874
1875 This flag is enabled by default for -std=c++17.
1876
1877 -fchar8_t
1878 -fno-char8_t
1879 Enable support for "char8_t" as adopted for C++2a. This includes
1880 the addition of a new "char8_t" fundamental type, changes to the
1881 types of UTF-8 string and character literals, new signatures for
1882 user-defined literals, associated standard library updates, and new
1883 "__cpp_char8_t" and "__cpp_lib_char8_t" feature test macros.
1884
1885 This option enables functions to be overloaded for ordinary and
1886 UTF-8 strings:
1887
1888 int f(const char *); // #1
1889 int f(const char8_t *); // #2
1890 int v1 = f("text"); // Calls #1
1891 int v2 = f(u8"text"); // Calls #2
1892
1893 and introduces new signatures for user-defined literals:
1894
1895 int operator""_udl1(char8_t);
1896 int v3 = u8'x'_udl1;
1897 int operator""_udl2(const char8_t*, std::size_t);
1898 int v4 = u8"text"_udl2;
1899 template<typename T, T...> int operator""_udl3();
1900 int v5 = u8"text"_udl3;
1901
1902 The change to the types of UTF-8 string and character literals
1903 introduces incompatibilities with ISO C++11 and later standards.
1904 For example, the following code is well-formed under ISO C++11, but
1905 is ill-formed when -fchar8_t is specified.
1906
1907 char ca[] = u8"xx"; // error: char-array initialized from wide
1908 // string
1909 const char *cp = u8"xx";// error: invalid conversion from
1910 // `const char8_t*' to `const char*'
1911 int f(const char*);
1912 auto v = f(u8"xx"); // error: invalid conversion from
1913 // `const char8_t*' to `const char*'
1914 std::string s{u8"xx"}; // error: no matching function for call to
1915 // `std::basic_string<char>::basic_string()'
1916 using namespace std::literals;
1917 s = u8"xx"s; // error: conversion from
1918 // `basic_string<char8_t>' to non-scalar
1919 // type `basic_string<char>' requested
1920
1921 -fcheck-new
1922 Check that the pointer returned by "operator new" is non-null
1923 before attempting to modify the storage allocated. This check is
1924 normally unnecessary because the C++ standard specifies that
1925 "operator new" only returns 0 if it is declared "throw()", in which
1926 case the compiler always checks the return value even without this
1927 option. In all other cases, when "operator new" has a non-empty
1928 exception specification, memory exhaustion is signalled by throwing
1929 "std::bad_alloc". See also new (nothrow).
1930
1931 -fconcepts
1932 -fconcepts-ts
1933 Below -std=c++2a, -fconcepts enables support for the C++ Extensions
1934 for Concepts Technical Specification, ISO 19217 (2015).
1935
1936 With -std=c++2a and above, Concepts are part of the language
1937 standard, so -fconcepts defaults to on. But the standard
1938 specification of Concepts differs significantly from the TS, so
1939 some constructs that were allowed in the TS but didn't make it into
1940 the standard can still be enabled by -fconcepts-ts.
1941
1942 -fconstexpr-depth=n
1943 Set the maximum nested evaluation depth for C++11 constexpr
1944 functions to n. A limit is needed to detect endless recursion
1945 during constant expression evaluation. The minimum specified by
1946 the standard is 512.
1947
1948 -fconstexpr-cache-depth=n
1949 Set the maximum level of nested evaluation depth for C++11
1950 constexpr functions that will be cached to n. This is a heuristic
1951 that trades off compilation speed (when the cache avoids repeated
1952 calculations) against memory consumption (when the cache grows very
1953 large from highly recursive evaluations). The default is 8. Very
1954 few users are likely to want to adjust it, but if your code does
1955 heavy constexpr calculations you might want to experiment to find
1956 which value works best for you.
1957
1958 -fconstexpr-loop-limit=n
1959 Set the maximum number of iterations for a loop in C++14 constexpr
1960 functions to n. A limit is needed to detect infinite loops during
1961 constant expression evaluation. The default is 262144 (1<<18).
1962
1963 -fconstexpr-ops-limit=n
1964 Set the maximum number of operations during a single constexpr
1965 evaluation. Even when number of iterations of a single loop is
1966 limited with the above limit, if there are several nested loops and
1967 each of them has many iterations but still smaller than the above
1968 limit, or if in a body of some loop or even outside of a loop too
1969 many expressions need to be evaluated, the resulting constexpr
1970 evaluation might take too long. The default is 33554432 (1<<25).
1971
1972 -fcoroutines
1973 Enable support for the C++ coroutines extension (experimental).
1974
1975 -fno-elide-constructors
1976 The C++ standard allows an implementation to omit creating a
1977 temporary that is only used to initialize another object of the
1978 same type. Specifying this option disables that optimization, and
1979 forces G++ to call the copy constructor in all cases. This option
1980 also causes G++ to call trivial member functions which otherwise
1981 would be expanded inline.
1982
1983 In C++17, the compiler is required to omit these temporaries, but
1984 this option still affects trivial member functions.
1985
1986 -fno-enforce-eh-specs
1987 Don't generate code to check for violation of exception
1988 specifications at run time. This option violates the C++ standard,
1989 but may be useful for reducing code size in production builds, much
1990 like defining "NDEBUG". This does not give user code permission to
1991 throw exceptions in violation of the exception specifications; the
1992 compiler still optimizes based on the specifications, so throwing
1993 an unexpected exception results in undefined behavior at run time.
1994
1995 -fextern-tls-init
1996 -fno-extern-tls-init
1997 The C++11 and OpenMP standards allow "thread_local" and
1998 "threadprivate" variables to have dynamic (runtime) initialization.
1999 To support this, any use of such a variable goes through a wrapper
2000 function that performs any necessary initialization. When the use
2001 and definition of the variable are in the same translation unit,
2002 this overhead can be optimized away, but when the use is in a
2003 different translation unit there is significant overhead even if
2004 the variable doesn't actually need dynamic initialization. If the
2005 programmer can be sure that no use of the variable in a non-
2006 defining TU needs to trigger dynamic initialization (either because
2007 the variable is statically initialized, or a use of the variable in
2008 the defining TU will be executed before any uses in another TU),
2009 they can avoid this overhead with the -fno-extern-tls-init option.
2010
2011 On targets that support symbol aliases, the default is
2012 -fextern-tls-init. On targets that do not support symbol aliases,
2013 the default is -fno-extern-tls-init.
2014
2015 -fno-gnu-keywords
2016 Do not recognize "typeof" as a keyword, so that code can use this
2017 word as an identifier. You can use the keyword "__typeof__"
2018 instead. This option is implied by the strict ISO C++ dialects:
2019 -ansi, -std=c++98, -std=c++11, etc.
2020
2021 -fno-implicit-templates
2022 Never emit code for non-inline templates that are instantiated
2023 implicitly (i.e. by use); only emit code for explicit
2024 instantiations. If you use this option, you must take care to
2025 structure your code to include all the necessary explicit
2026 instantiations to avoid getting undefined symbols at link time.
2027
2028 -fno-implicit-inline-templates
2029 Don't emit code for implicit instantiations of inline templates,
2030 either. The default is to handle inlines differently so that
2031 compiles with and without optimization need the same set of
2032 explicit instantiations.
2033
2034 -fno-implement-inlines
2035 To save space, do not emit out-of-line copies of inline functions
2036 controlled by "#pragma implementation". This causes linker errors
2037 if these functions are not inlined everywhere they are called.
2038
2039 -fms-extensions
2040 Disable Wpedantic warnings about constructs used in MFC, such as
2041 implicit int and getting a pointer to member function via non-
2042 standard syntax.
2043
2044 -fnew-inheriting-ctors
2045 Enable the P0136 adjustment to the semantics of C++11 constructor
2046 inheritance. This is part of C++17 but also considered to be a
2047 Defect Report against C++11 and C++14. This flag is enabled by
2048 default unless -fabi-version=10 or lower is specified.
2049
2050 -fnew-ttp-matching
2051 Enable the P0522 resolution to Core issue 150, template template
2052 parameters and default arguments: this allows a template with
2053 default template arguments as an argument for a template template
2054 parameter with fewer template parameters. This flag is enabled by
2055 default for -std=c++17.
2056
2057 -fno-nonansi-builtins
2058 Disable built-in declarations of functions that are not mandated by
2059 ANSI/ISO C. These include "ffs", "alloca", "_exit", "index",
2060 "bzero", "conjf", and other related functions.
2061
2062 -fnothrow-opt
2063 Treat a "throw()" exception specification as if it were a
2064 "noexcept" specification to reduce or eliminate the text size
2065 overhead relative to a function with no exception specification.
2066 If the function has local variables of types with non-trivial
2067 destructors, the exception specification actually makes the
2068 function smaller because the EH cleanups for those variables can be
2069 optimized away. The semantic effect is that an exception thrown
2070 out of a function with such an exception specification results in a
2071 call to "terminate" rather than "unexpected".
2072
2073 -fno-operator-names
2074 Do not treat the operator name keywords "and", "bitand", "bitor",
2075 "compl", "not", "or" and "xor" as synonyms as keywords.
2076
2077 -fno-optional-diags
2078 Disable diagnostics that the standard says a compiler does not need
2079 to issue. Currently, the only such diagnostic issued by G++ is the
2080 one for a name having multiple meanings within a class.
2081
2082 -fpermissive
2083 Downgrade some diagnostics about nonconformant code from errors to
2084 warnings. Thus, using -fpermissive allows some nonconforming code
2085 to compile.
2086
2087 -fno-pretty-templates
2088 When an error message refers to a specialization of a function
2089 template, the compiler normally prints the signature of the
2090 template followed by the template arguments and any typedefs or
2091 typenames in the signature (e.g. "void f(T) [with T = int]" rather
2092 than "void f(int)") so that it's clear which template is involved.
2093 When an error message refers to a specialization of a class
2094 template, the compiler omits any template arguments that match the
2095 default template arguments for that template. If either of these
2096 behaviors make it harder to understand the error message rather
2097 than easier, you can use -fno-pretty-templates to disable them.
2098
2099 -fno-rtti
2100 Disable generation of information about every class with virtual
2101 functions for use by the C++ run-time type identification features
2102 ("dynamic_cast" and "typeid"). If you don't use those parts of the
2103 language, you can save some space by using this flag. Note that
2104 exception handling uses the same information, but G++ generates it
2105 as needed. The "dynamic_cast" operator can still be used for casts
2106 that do not require run-time type information, i.e. casts to "void
2107 *" or to unambiguous base classes.
2108
2109 Mixing code compiled with -frtti with that compiled with -fno-rtti
2110 may not work. For example, programs may fail to link if a class
2111 compiled with -fno-rtti is used as a base for a class compiled with
2112 -frtti.
2113
2114 -fsized-deallocation
2115 Enable the built-in global declarations
2116
2117 void operator delete (void *, std::size_t) noexcept;
2118 void operator delete[] (void *, std::size_t) noexcept;
2119
2120 as introduced in C++14. This is useful for user-defined
2121 replacement deallocation functions that, for example, use the size
2122 of the object to make deallocation faster. Enabled by default
2123 under -std=c++14 and above. The flag -Wsized-deallocation warns
2124 about places that might want to add a definition.
2125
2126 -fstrict-enums
2127 Allow the compiler to optimize using the assumption that a value of
2128 enumerated type can only be one of the values of the enumeration
2129 (as defined in the C++ standard; basically, a value that can be
2130 represented in the minimum number of bits needed to represent all
2131 the enumerators). This assumption may not be valid if the program
2132 uses a cast to convert an arbitrary integer value to the enumerated
2133 type.
2134
2135 -fstrong-eval-order
2136 Evaluate member access, array subscripting, and shift expressions
2137 in left-to-right order, and evaluate assignment in right-to-left
2138 order, as adopted for C++17. Enabled by default with -std=c++17.
2139 -fstrong-eval-order=some enables just the ordering of member access
2140 and shift expressions, and is the default without -std=c++17.
2141
2142 -ftemplate-backtrace-limit=n
2143 Set the maximum number of template instantiation notes for a single
2144 warning or error to n. The default value is 10.
2145
2146 -ftemplate-depth=n
2147 Set the maximum instantiation depth for template classes to n. A
2148 limit on the template instantiation depth is needed to detect
2149 endless recursions during template class instantiation. ANSI/ISO
2150 C++ conforming programs must not rely on a maximum depth greater
2151 than 17 (changed to 1024 in C++11). The default value is 900, as
2152 the compiler can run out of stack space before hitting 1024 in some
2153 situations.
2154
2155 -fno-threadsafe-statics
2156 Do not emit the extra code to use the routines specified in the C++
2157 ABI for thread-safe initialization of local statics. You can use
2158 this option to reduce code size slightly in code that doesn't need
2159 to be thread-safe.
2160
2161 -fuse-cxa-atexit
2162 Register destructors for objects with static storage duration with
2163 the "__cxa_atexit" function rather than the "atexit" function.
2164 This option is required for fully standards-compliant handling of
2165 static destructors, but only works if your C library supports
2166 "__cxa_atexit".
2167
2168 -fno-use-cxa-get-exception-ptr
2169 Don't use the "__cxa_get_exception_ptr" runtime routine. This
2170 causes "std::uncaught_exception" to be incorrect, but is necessary
2171 if the runtime routine is not available.
2172
2173 -fvisibility-inlines-hidden
2174 This switch declares that the user does not attempt to compare
2175 pointers to inline functions or methods where the addresses of the
2176 two functions are taken in different shared objects.
2177
2178 The effect of this is that GCC may, effectively, mark inline
2179 methods with "__attribute__ ((visibility ("hidden")))" so that they
2180 do not appear in the export table of a DSO and do not require a PLT
2181 indirection when used within the DSO. Enabling this option can
2182 have a dramatic effect on load and link times of a DSO as it
2183 massively reduces the size of the dynamic export table when the
2184 library makes heavy use of templates.
2185
2186 The behavior of this switch is not quite the same as marking the
2187 methods as hidden directly, because it does not affect static
2188 variables local to the function or cause the compiler to deduce
2189 that the function is defined in only one shared object.
2190
2191 You may mark a method as having a visibility explicitly to negate
2192 the effect of the switch for that method. For example, if you do
2193 want to compare pointers to a particular inline method, you might
2194 mark it as having default visibility. Marking the enclosing class
2195 with explicit visibility has no effect.
2196
2197 Explicitly instantiated inline methods are unaffected by this
2198 option as their linkage might otherwise cross a shared library
2199 boundary.
2200
2201 -fvisibility-ms-compat
2202 This flag attempts to use visibility settings to make GCC's C++
2203 linkage model compatible with that of Microsoft Visual Studio.
2204
2205 The flag makes these changes to GCC's linkage model:
2206
2207 1. It sets the default visibility to "hidden", like
2208 -fvisibility=hidden.
2209
2210 2. Types, but not their members, are not hidden by default.
2211
2212 3. The One Definition Rule is relaxed for types without explicit
2213 visibility specifications that are defined in more than one
2214 shared object: those declarations are permitted if they are
2215 permitted when this option is not used.
2216
2217 In new code it is better to use -fvisibility=hidden and export
2218 those classes that are intended to be externally visible.
2219 Unfortunately it is possible for code to rely, perhaps
2220 accidentally, on the Visual Studio behavior.
2221
2222 Among the consequences of these changes are that static data
2223 members of the same type with the same name but defined in
2224 different shared objects are different, so changing one does not
2225 change the other; and that pointers to function members defined in
2226 different shared objects may not compare equal. When this flag is
2227 given, it is a violation of the ODR to define types with the same
2228 name differently.
2229
2230 -fno-weak
2231 Do not use weak symbol support, even if it is provided by the
2232 linker. By default, G++ uses weak symbols if they are available.
2233 This option exists only for testing, and should not be used by end-
2234 users; it results in inferior code and has no benefits. This
2235 option may be removed in a future release of G++.
2236
2237 -fext-numeric-literals (C++ and Objective-C++ only)
2238 Accept imaginary, fixed-point, or machine-defined literal number
2239 suffixes as GNU extensions. When this option is turned off these
2240 suffixes are treated as C++11 user-defined literal numeric
2241 suffixes. This is on by default for all pre-C++11 dialects and all
2242 GNU dialects: -std=c++98, -std=gnu++98, -std=gnu++11, -std=gnu++14.
2243 This option is off by default for ISO C++11 onwards (-std=c++11,
2244 ...).
2245
2246 -nostdinc++
2247 Do not search for header files in the standard directories specific
2248 to C++, but do still search the other standard directories. (This
2249 option is used when building the C++ library.)
2250
2251 In addition, these warning options have meanings only for C++ programs:
2252
2253 -Wabi-tag (C++ and Objective-C++ only)
2254 Warn when a type with an ABI tag is used in a context that does not
2255 have that ABI tag. See C++ Attributes for more information about
2256 ABI tags.
2257
2258 -Wcomma-subscript (C++ and Objective-C++ only)
2259 Warn about uses of a comma expression within a subscripting
2260 expression. This usage was deprecated in C++2a. However, a comma
2261 expression wrapped in "( )" is not deprecated. Example:
2262
2263 void f(int *a, int b, int c) {
2264 a[b,c]; // deprecated
2265 a[(b,c)]; // OK
2266 }
2267
2268 Enabled by default with -std=c++2a.
2269
2270 -Wctor-dtor-privacy (C++ and Objective-C++ only)
2271 Warn when a class seems unusable because all the constructors or
2272 destructors in that class are private, and it has neither friends
2273 nor public static member functions. Also warn if there are no non-
2274 private methods, and there's at least one private member function
2275 that isn't a constructor or destructor.
2276
2277 -Wdelete-non-virtual-dtor (C++ and Objective-C++ only)
2278 Warn when "delete" is used to destroy an instance of a class that
2279 has virtual functions and non-virtual destructor. It is unsafe to
2280 delete an instance of a derived class through a pointer to a base
2281 class if the base class does not have a virtual destructor. This
2282 warning is enabled by -Wall.
2283
2284 -Wdeprecated-copy (C++ and Objective-C++ only)
2285 Warn that the implicit declaration of a copy constructor or copy
2286 assignment operator is deprecated if the class has a user-provided
2287 copy constructor or copy assignment operator, in C++11 and up.
2288 This warning is enabled by -Wextra. With -Wdeprecated-copy-dtor,
2289 also deprecate if the class has a user-provided destructor.
2290
2291 -Wno-init-list-lifetime (C++ and Objective-C++ only)
2292 Do not warn about uses of "std::initializer_list" that are likely
2293 to result in dangling pointers. Since the underlying array for an
2294 "initializer_list" is handled like a normal C++ temporary object,
2295 it is easy to inadvertently keep a pointer to the array past the
2296 end of the array's lifetime. For example:
2297
2298 * If a function returns a temporary "initializer_list", or a
2299 local "initializer_list" variable, the array's lifetime ends at
2300 the end of the return statement, so the value returned has a
2301 dangling pointer.
2302
2303 * If a new-expression creates an "initializer_list", the array
2304 only lives until the end of the enclosing full-expression, so
2305 the "initializer_list" in the heap has a dangling pointer.
2306
2307 * When an "initializer_list" variable is assigned from a brace-
2308 enclosed initializer list, the temporary array created for the
2309 right side of the assignment only lives until the end of the
2310 full-expression, so at the next statement the
2311 "initializer_list" variable has a dangling pointer.
2312
2313 // li's initial underlying array lives as long as li
2314 std::initializer_list<int> li = { 1,2,3 };
2315 // assignment changes li to point to a temporary array
2316 li = { 4, 5 };
2317 // now the temporary is gone and li has a dangling pointer
2318 int i = li.begin()[0] // undefined behavior
2319
2320 * When a list constructor stores the "begin" pointer from the
2321 "initializer_list" argument, this doesn't extend the lifetime
2322 of the array, so if a class variable is constructed from a
2323 temporary "initializer_list", the pointer is left dangling by
2324 the end of the variable declaration statement.
2325
2326 -Wno-literal-suffix (C++ and Objective-C++ only)
2327 Do not warn when a string or character literal is followed by a ud-
2328 suffix which does not begin with an underscore. As a conforming
2329 extension, GCC treats such suffixes as separate preprocessing
2330 tokens in order to maintain backwards compatibility with code that
2331 uses formatting macros from "<inttypes.h>". For example:
2332
2333 #define __STDC_FORMAT_MACROS
2334 #include <inttypes.h>
2335 #include <stdio.h>
2336
2337 int main() {
2338 int64_t i64 = 123;
2339 printf("My int64: %" PRId64"\n", i64);
2340 }
2341
2342 In this case, "PRId64" is treated as a separate preprocessing
2343 token.
2344
2345 This option also controls warnings when a user-defined literal
2346 operator is declared with a literal suffix identifier that doesn't
2347 begin with an underscore. Literal suffix identifiers that don't
2348 begin with an underscore are reserved for future standardization.
2349
2350 These warnings are enabled by default.
2351
2352 -Wno-narrowing (C++ and Objective-C++ only)
2353 For C++11 and later standards, narrowing conversions are diagnosed
2354 by default, as required by the standard. A narrowing conversion
2355 from a constant produces an error, and a narrowing conversion from
2356 a non-constant produces a warning, but -Wno-narrowing suppresses
2357 the diagnostic. Note that this does not affect the meaning of
2358 well-formed code; narrowing conversions are still considered ill-
2359 formed in SFINAE contexts.
2360
2361 With -Wnarrowing in C++98, warn when a narrowing conversion
2362 prohibited by C++11 occurs within { }, e.g.
2363
2364 int i = { 2.2 }; // error: narrowing from double to int
2365
2366 This flag is included in -Wall and -Wc++11-compat.
2367
2368 -Wnoexcept (C++ and Objective-C++ only)
2369 Warn when a noexcept-expression evaluates to false because of a
2370 call to a function that does not have a non-throwing exception
2371 specification (i.e. "throw()" or "noexcept") but is known by the
2372 compiler to never throw an exception.
2373
2374 -Wnoexcept-type (C++ and Objective-C++ only)
2375 Warn if the C++17 feature making "noexcept" part of a function type
2376 changes the mangled name of a symbol relative to C++14. Enabled by
2377 -Wabi and -Wc++17-compat.
2378
2379 As an example:
2380
2381 template <class T> void f(T t) { t(); };
2382 void g() noexcept;
2383 void h() { f(g); }
2384
2385 In C++14, "f" calls "f<void(*)()>", but in C++17 it calls
2386 "f<void(*)()noexcept>".
2387
2388 -Wclass-memaccess (C++ and Objective-C++ only)
2389 Warn when the destination of a call to a raw memory function such
2390 as "memset" or "memcpy" is an object of class type, and when
2391 writing into such an object might bypass the class non-trivial or
2392 deleted constructor or copy assignment, violate const-correctness
2393 or encapsulation, or corrupt virtual table pointers. Modifying the
2394 representation of such objects may violate invariants maintained by
2395 member functions of the class. For example, the call to "memset"
2396 below is undefined because it modifies a non-trivial class object
2397 and is, therefore, diagnosed. The safe way to either initialize or
2398 clear the storage of objects of such types is by using the
2399 appropriate constructor or assignment operator, if one is
2400 available.
2401
2402 std::string str = "abc";
2403 memset (&str, 0, sizeof str);
2404
2405 The -Wclass-memaccess option is enabled by -Wall. Explicitly
2406 casting the pointer to the class object to "void *" or to a type
2407 that can be safely accessed by the raw memory function suppresses
2408 the warning.
2409
2410 -Wnon-virtual-dtor (C++ and Objective-C++ only)
2411 Warn when a class has virtual functions and an accessible non-
2412 virtual destructor itself or in an accessible polymorphic base
2413 class, in which case it is possible but unsafe to delete an
2414 instance of a derived class through a pointer to the class itself
2415 or base class. This warning is automatically enabled if -Weffc++
2416 is specified.
2417
2418 -Wregister (C++ and Objective-C++ only)
2419 Warn on uses of the "register" storage class specifier, except when
2420 it is part of the GNU Explicit Register Variables extension. The
2421 use of the "register" keyword as storage class specifier has been
2422 deprecated in C++11 and removed in C++17. Enabled by default with
2423 -std=c++17.
2424
2425 -Wreorder (C++ and Objective-C++ only)
2426 Warn when the order of member initializers given in the code does
2427 not match the order in which they must be executed. For instance:
2428
2429 struct A {
2430 int i;
2431 int j;
2432 A(): j (0), i (1) { }
2433 };
2434
2435 The compiler rearranges the member initializers for "i" and "j" to
2436 match the declaration order of the members, emitting a warning to
2437 that effect. This warning is enabled by -Wall.
2438
2439 -Wno-pessimizing-move (C++ and Objective-C++ only)
2440 This warning warns when a call to "std::move" prevents copy
2441 elision. A typical scenario when copy elision can occur is when
2442 returning in a function with a class return type, when the
2443 expression being returned is the name of a non-volatile automatic
2444 object, and is not a function parameter, and has the same type as
2445 the function return type.
2446
2447 struct T {
2448 ...
2449 };
2450 T fn()
2451 {
2452 T t;
2453 ...
2454 return std::move (t);
2455 }
2456
2457 But in this example, the "std::move" call prevents copy elision.
2458
2459 This warning is enabled by -Wall.
2460
2461 -Wno-redundant-move (C++ and Objective-C++ only)
2462 This warning warns about redundant calls to "std::move"; that is,
2463 when a move operation would have been performed even without the
2464 "std::move" call. This happens because the compiler is forced to
2465 treat the object as if it were an rvalue in certain situations such
2466 as returning a local variable, where copy elision isn't applicable.
2467 Consider:
2468
2469 struct T {
2470 ...
2471 };
2472 T fn(T t)
2473 {
2474 ...
2475 return std::move (t);
2476 }
2477
2478 Here, the "std::move" call is redundant. Because G++ implements
2479 Core Issue 1579, another example is:
2480
2481 struct T { // convertible to U
2482 ...
2483 };
2484 struct U {
2485 ...
2486 };
2487 U fn()
2488 {
2489 T t;
2490 ...
2491 return std::move (t);
2492 }
2493
2494 In this example, copy elision isn't applicable because the type of
2495 the expression being returned and the function return type differ,
2496 yet G++ treats the return value as if it were designated by an
2497 rvalue.
2498
2499 This warning is enabled by -Wextra.
2500
2501 -Wredundant-tags (C++ and Objective-C++ only)
2502 Warn about redundant class-key and enum-key in references to class
2503 types and enumerated types in contexts where the key can be
2504 eliminated without causing an ambiguity. For example:
2505
2506 struct foo;
2507 struct foo *p; // warn that keyword struct can be eliminated
2508
2509 On the other hand, in this example there is no warning:
2510
2511 struct foo;
2512 void foo (); // "hides" struct foo
2513 void bar (struct foo&); // no warning, keyword struct is necessary
2514
2515 -Wno-subobject-linkage (C++ and Objective-C++ only)
2516 Do not warn if a class type has a base or a field whose type uses
2517 the anonymous namespace or depends on a type with no linkage. If a
2518 type A depends on a type B with no or internal linkage, defining it
2519 in multiple translation units would be an ODR violation because the
2520 meaning of B is different in each translation unit. If A only
2521 appears in a single translation unit, the best way to silence the
2522 warning is to give it internal linkage by putting it in an
2523 anonymous namespace as well. The compiler doesn't give this
2524 warning for types defined in the main .C file, as those are
2525 unlikely to have multiple definitions. -Wsubobject-linkage is
2526 enabled by default.
2527
2528 -Weffc++ (C++ and Objective-C++ only)
2529 Warn about violations of the following style guidelines from Scott
2530 Meyers' Effective C++ series of books:
2531
2532 * Define a copy constructor and an assignment operator for
2533 classes with dynamically-allocated memory.
2534
2535 * Prefer initialization to assignment in constructors.
2536
2537 * Have "operator=" return a reference to *this.
2538
2539 * Don't try to return a reference when you must return an object.
2540
2541 * Distinguish between prefix and postfix forms of increment and
2542 decrement operators.
2543
2544 * Never overload "&&", "||", or ",".
2545
2546 This option also enables -Wnon-virtual-dtor, which is also one of
2547 the effective C++ recommendations. However, the check is extended
2548 to warn about the lack of virtual destructor in accessible non-
2549 polymorphic bases classes too.
2550
2551 When selecting this option, be aware that the standard library
2552 headers do not obey all of these guidelines; use grep -v to filter
2553 out those warnings.
2554
2555 -Wstrict-null-sentinel (C++ and Objective-C++ only)
2556 Warn about the use of an uncasted "NULL" as sentinel. When
2557 compiling only with GCC this is a valid sentinel, as "NULL" is
2558 defined to "__null". Although it is a null pointer constant rather
2559 than a null pointer, it is guaranteed to be of the same size as a
2560 pointer. But this use is not portable across different compilers.
2561
2562 -Wno-non-template-friend (C++ and Objective-C++ only)
2563 Disable warnings when non-template friend functions are declared
2564 within a template. In very old versions of GCC that predate
2565 implementation of the ISO standard, declarations such as friend int
2566 foo(int), where the name of the friend is an unqualified-id, could
2567 be interpreted as a particular specialization of a template
2568 function; the warning exists to diagnose compatibility problems,
2569 and is enabled by default.
2570
2571 -Wold-style-cast (C++ and Objective-C++ only)
2572 Warn if an old-style (C-style) cast to a non-void type is used
2573 within a C++ program. The new-style casts ("dynamic_cast",
2574 "static_cast", "reinterpret_cast", and "const_cast") are less
2575 vulnerable to unintended effects and much easier to search for.
2576
2577 -Woverloaded-virtual (C++ and Objective-C++ only)
2578 Warn when a function declaration hides virtual functions from a
2579 base class. For example, in:
2580
2581 struct A {
2582 virtual void f();
2583 };
2584
2585 struct B: public A {
2586 void f(int);
2587 };
2588
2589 the "A" class version of "f" is hidden in "B", and code like:
2590
2591 B* b;
2592 b->f();
2593
2594 fails to compile.
2595
2596 -Wno-pmf-conversions (C++ and Objective-C++ only)
2597 Disable the diagnostic for converting a bound pointer to member
2598 function to a plain pointer.
2599
2600 -Wsign-promo (C++ and Objective-C++ only)
2601 Warn when overload resolution chooses a promotion from unsigned or
2602 enumerated type to a signed type, over a conversion to an unsigned
2603 type of the same size. Previous versions of G++ tried to preserve
2604 unsignedness, but the standard mandates the current behavior.
2605
2606 -Wtemplates (C++ and Objective-C++ only)
2607 Warn when a primary template declaration is encountered. Some
2608 coding rules disallow templates, and this may be used to enforce
2609 that rule. The warning is inactive inside a system header file,
2610 such as the STL, so one can still use the STL. One may also
2611 instantiate or specialize templates.
2612
2613 -Wmismatched-tags (C++ and Objective-C++ only)
2614 Warn for declarations of structs, classes, and class templates and
2615 their specializations with a class-key that does not match either
2616 the definition or the first declaration if no definition is
2617 provided.
2618
2619 For example, the declaration of "struct Object" in the argument
2620 list of "draw" triggers the warning. To avoid it, either remove
2621 the redundant class-key "struct" or replace it with "class" to
2622 match its definition.
2623
2624 class Object {
2625 public:
2626 virtual ~Object () = 0;
2627 };
2628 void draw (struct Object*);
2629
2630 It is not wrong to declare a class with the class-key "struct" as
2631 the example above shows. The -Wmismatched-tags option is intended
2632 to help achieve a consistent style of class declarations. In code
2633 that is intended to be portable to Windows-based compilers the
2634 warning helps prevent unresolved references due to the difference
2635 in the mangling of symbols declared with different class-keys. The
2636 option can be used either on its own or in conjunction with
2637 -Wredundant-tags.
2638
2639 -Wmultiple-inheritance (C++ and Objective-C++ only)
2640 Warn when a class is defined with multiple direct base classes.
2641 Some coding rules disallow multiple inheritance, and this may be
2642 used to enforce that rule. The warning is inactive inside a system
2643 header file, such as the STL, so one can still use the STL. One
2644 may also define classes that indirectly use multiple inheritance.
2645
2646 -Wvirtual-inheritance
2647 Warn when a class is defined with a virtual direct base class.
2648 Some coding rules disallow multiple inheritance, and this may be
2649 used to enforce that rule. The warning is inactive inside a system
2650 header file, such as the STL, so one can still use the STL. One
2651 may also define classes that indirectly use virtual inheritance.
2652
2653 -Wno-virtual-move-assign
2654 Suppress warnings about inheriting from a virtual base with a non-
2655 trivial C++11 move assignment operator. This is dangerous because
2656 if the virtual base is reachable along more than one path, it is
2657 moved multiple times, which can mean both objects end up in the
2658 moved-from state. If the move assignment operator is written to
2659 avoid moving from a moved-from object, this warning can be
2660 disabled.
2661
2662 -Wnamespaces
2663 Warn when a namespace definition is opened. Some coding rules
2664 disallow namespaces, and this may be used to enforce that rule.
2665 The warning is inactive inside a system header file, such as the
2666 STL, so one can still use the STL. One may also use using
2667 directives and qualified names.
2668
2669 -Wno-terminate (C++ and Objective-C++ only)
2670 Disable the warning about a throw-expression that will immediately
2671 result in a call to "terminate".
2672
2673 -Wno-class-conversion (C++ and Objective-C++ only)
2674 Do not warn when a conversion function converts an object to the
2675 same type, to a base class of that type, or to void; such a
2676 conversion function will never be called.
2677
2678 -Wvolatile (C++ and Objective-C++ only)
2679 Warn about deprecated uses of the "volatile" qualifier. This
2680 includes postfix and prefix "++" and "--" expressions of
2681 "volatile"-qualified types, using simple assignments where the left
2682 operand is a "volatile"-qualified non-class type for their value,
2683 compound assignments where the left operand is a
2684 "volatile"-qualified non-class type, "volatile"-qualified function
2685 return type, "volatile"-qualified parameter type, and structured
2686 bindings of a "volatile"-qualified type. This usage was deprecated
2687 in C++20.
2688
2689 Enabled by default with -std=c++2a.
2690
2691 -Wzero-as-null-pointer-constant (C++ and Objective-C++ only)
2692 Warn when a literal 0 is used as null pointer constant. This can
2693 be useful to facilitate the conversion to "nullptr" in C++11.
2694
2695 -Waligned-new
2696 Warn about a new-expression of a type that requires greater
2697 alignment than the "alignof(std::max_align_t)" but uses an
2698 allocation function without an explicit alignment parameter. This
2699 option is enabled by -Wall.
2700
2701 Normally this only warns about global allocation functions, but
2702 -Waligned-new=all also warns about class member allocation
2703 functions.
2704
2705 -Wno-placement-new
2706 -Wplacement-new=n
2707 Warn about placement new expressions with undefined behavior, such
2708 as constructing an object in a buffer that is smaller than the type
2709 of the object. For example, the placement new expression below is
2710 diagnosed because it attempts to construct an array of 64 integers
2711 in a buffer only 64 bytes large.
2712
2713 char buf [64];
2714 new (buf) int[64];
2715
2716 This warning is enabled by default.
2717
2718 -Wplacement-new=1
2719 This is the default warning level of -Wplacement-new. At this
2720 level the warning is not issued for some strictly undefined
2721 constructs that GCC allows as extensions for compatibility with
2722 legacy code. For example, the following "new" expression is
2723 not diagnosed at this level even though it has undefined
2724 behavior according to the C++ standard because it writes past
2725 the end of the one-element array.
2726
2727 struct S { int n, a[1]; };
2728 S *s = (S *)malloc (sizeof *s + 31 * sizeof s->a[0]);
2729 new (s->a)int [32]();
2730
2731 -Wplacement-new=2
2732 At this level, in addition to diagnosing all the same
2733 constructs as at level 1, a diagnostic is also issued for
2734 placement new expressions that construct an object in the last
2735 member of structure whose type is an array of a single element
2736 and whose size is less than the size of the object being
2737 constructed. While the previous example would be diagnosed,
2738 the following construct makes use of the flexible member array
2739 extension to avoid the warning at level 2.
2740
2741 struct S { int n, a[]; };
2742 S *s = (S *)malloc (sizeof *s + 32 * sizeof s->a[0]);
2743 new (s->a)int [32]();
2744
2745 -Wcatch-value
2746 -Wcatch-value=n (C++ and Objective-C++ only)
2747 Warn about catch handlers that do not catch via reference. With
2748 -Wcatch-value=1 (or -Wcatch-value for short) warn about polymorphic
2749 class types that are caught by value. With -Wcatch-value=2 warn
2750 about all class types that are caught by value. With
2751 -Wcatch-value=3 warn about all types that are not caught by
2752 reference. -Wcatch-value is enabled by -Wall.
2753
2754 -Wconditionally-supported (C++ and Objective-C++ only)
2755 Warn for conditionally-supported (C++11 [intro.defs]) constructs.
2756
2757 -Wno-delete-incomplete (C++ and Objective-C++ only)
2758 Do not warn when deleting a pointer to incomplete type, which may
2759 cause undefined behavior at runtime. This warning is enabled by
2760 default.
2761
2762 -Wextra-semi (C++, Objective-C++ only)
2763 Warn about redundant semicolons after in-class function
2764 definitions.
2765
2766 -Wno-inaccessible-base (C++, Objective-C++ only)
2767 This option controls warnings when a base class is inaccessible in
2768 a class derived from it due to ambiguity. The warning is enabled
2769 by default. Note that the warning for ambiguous virtual bases is
2770 enabled by the -Wextra option.
2771
2772 struct A { int a; };
2773
2774 struct B : A { };
2775
2776 struct C : B, A { };
2777
2778 -Wno-inherited-variadic-ctor
2779 Suppress warnings about use of C++11 inheriting constructors when
2780 the base class inherited from has a C variadic constructor; the
2781 warning is on by default because the ellipsis is not inherited.
2782
2783 -Wno-invalid-offsetof (C++ and Objective-C++ only)
2784 Suppress warnings from applying the "offsetof" macro to a non-POD
2785 type. According to the 2014 ISO C++ standard, applying "offsetof"
2786 to a non-standard-layout type is undefined. In existing C++
2787 implementations, however, "offsetof" typically gives meaningful
2788 results. This flag is for users who are aware that they are
2789 writing nonportable code and who have deliberately chosen to ignore
2790 the warning about it.
2791
2792 The restrictions on "offsetof" may be relaxed in a future version
2793 of the C++ standard.
2794
2795 -Wsized-deallocation (C++ and Objective-C++ only)
2796 Warn about a definition of an unsized deallocation function
2797
2798 void operator delete (void *) noexcept;
2799 void operator delete[] (void *) noexcept;
2800
2801 without a definition of the corresponding sized deallocation
2802 function
2803
2804 void operator delete (void *, std::size_t) noexcept;
2805 void operator delete[] (void *, std::size_t) noexcept;
2806
2807 or vice versa. Enabled by -Wextra along with -fsized-deallocation.
2808
2809 -Wsuggest-final-types
2810 Warn about types with virtual methods where code quality would be
2811 improved if the type were declared with the C++11 "final"
2812 specifier, or, if possible, declared in an anonymous namespace.
2813 This allows GCC to more aggressively devirtualize the polymorphic
2814 calls. This warning is more effective with link-time optimization,
2815 where the information about the class hierarchy graph is more
2816 complete.
2817
2818 -Wsuggest-final-methods
2819 Warn about virtual methods where code quality would be improved if
2820 the method were declared with the C++11 "final" specifier, or, if
2821 possible, its type were declared in an anonymous namespace or with
2822 the "final" specifier. This warning is more effective with link-
2823 time optimization, where the information about the class hierarchy
2824 graph is more complete. It is recommended to first consider
2825 suggestions of -Wsuggest-final-types and then rebuild with new
2826 annotations.
2827
2828 -Wsuggest-override
2829 Warn about overriding virtual functions that are not marked with
2830 the "override" keyword.
2831
2832 -Wuseless-cast (C++ and Objective-C++ only)
2833 Warn when an expression is casted to its own type.
2834
2835 -Wno-conversion-null (C++ and Objective-C++ only)
2836 Do not warn for conversions between "NULL" and non-pointer types.
2837 -Wconversion-null is enabled by default.
2838
2839 Options Controlling Objective-C and Objective-C++ Dialects
2840 (NOTE: This manual does not describe the Objective-C and Objective-C++
2841 languages themselves.
2842
2843 This section describes the command-line options that are only
2844 meaningful for Objective-C and Objective-C++ programs. You can also
2845 use most of the language-independent GNU compiler options. For
2846 example, you might compile a file some_class.m like this:
2847
2848 gcc -g -fgnu-runtime -O -c some_class.m
2849
2850 In this example, -fgnu-runtime is an option meant only for Objective-C
2851 and Objective-C++ programs; you can use the other options with any
2852 language supported by GCC.
2853
2854 Note that since Objective-C is an extension of the C language,
2855 Objective-C compilations may also use options specific to the C front-
2856 end (e.g., -Wtraditional). Similarly, Objective-C++ compilations may
2857 use C++-specific options (e.g., -Wabi).
2858
2859 Here is a list of options that are only for compiling Objective-C and
2860 Objective-C++ programs:
2861
2862 -fconstant-string-class=class-name
2863 Use class-name as the name of the class to instantiate for each
2864 literal string specified with the syntax "@"..."". The default
2865 class name is "NXConstantString" if the GNU runtime is being used,
2866 and "NSConstantString" if the NeXT runtime is being used (see
2867 below). The -fconstant-cfstrings option, if also present,
2868 overrides the -fconstant-string-class setting and cause "@"...""
2869 literals to be laid out as constant CoreFoundation strings.
2870
2871 -fgnu-runtime
2872 Generate object code compatible with the standard GNU Objective-C
2873 runtime. This is the default for most types of systems.
2874
2875 -fnext-runtime
2876 Generate output compatible with the NeXT runtime. This is the
2877 default for NeXT-based systems, including Darwin and Mac OS X. The
2878 macro "__NEXT_RUNTIME__" is predefined if (and only if) this option
2879 is used.
2880
2881 -fno-nil-receivers
2882 Assume that all Objective-C message dispatches ("[receiver
2883 message:arg]") in this translation unit ensure that the receiver is
2884 not "nil". This allows for more efficient entry points in the
2885 runtime to be used. This option is only available in conjunction
2886 with the NeXT runtime and ABI version 0 or 1.
2887
2888 -fobjc-abi-version=n
2889 Use version n of the Objective-C ABI for the selected runtime.
2890 This option is currently supported only for the NeXT runtime. In
2891 that case, Version 0 is the traditional (32-bit) ABI without
2892 support for properties and other Objective-C 2.0 additions.
2893 Version 1 is the traditional (32-bit) ABI with support for
2894 properties and other Objective-C 2.0 additions. Version 2 is the
2895 modern (64-bit) ABI. If nothing is specified, the default is
2896 Version 0 on 32-bit target machines, and Version 2 on 64-bit target
2897 machines.
2898
2899 -fobjc-call-cxx-cdtors
2900 For each Objective-C class, check if any of its instance variables
2901 is a C++ object with a non-trivial default constructor. If so,
2902 synthesize a special "- (id) .cxx_construct" instance method which
2903 runs non-trivial default constructors on any such instance
2904 variables, in order, and then return "self". Similarly, check if
2905 any instance variable is a C++ object with a non-trivial
2906 destructor, and if so, synthesize a special "- (void)
2907 .cxx_destruct" method which runs all such default destructors, in
2908 reverse order.
2909
2910 The "- (id) .cxx_construct" and "- (void) .cxx_destruct" methods
2911 thusly generated only operate on instance variables declared in the
2912 current Objective-C class, and not those inherited from
2913 superclasses. It is the responsibility of the Objective-C runtime
2914 to invoke all such methods in an object's inheritance hierarchy.
2915 The "- (id) .cxx_construct" methods are invoked by the runtime
2916 immediately after a new object instance is allocated; the "- (void)
2917 .cxx_destruct" methods are invoked immediately before the runtime
2918 deallocates an object instance.
2919
2920 As of this writing, only the NeXT runtime on Mac OS X 10.4 and
2921 later has support for invoking the "- (id) .cxx_construct" and "-
2922 (void) .cxx_destruct" methods.
2923
2924 -fobjc-direct-dispatch
2925 Allow fast jumps to the message dispatcher. On Darwin this is
2926 accomplished via the comm page.
2927
2928 -fobjc-exceptions
2929 Enable syntactic support for structured exception handling in
2930 Objective-C, similar to what is offered by C++. This option is
2931 required to use the Objective-C keywords @try, @throw, @catch,
2932 @finally and @synchronized. This option is available with both the
2933 GNU runtime and the NeXT runtime (but not available in conjunction
2934 with the NeXT runtime on Mac OS X 10.2 and earlier).
2935
2936 -fobjc-gc
2937 Enable garbage collection (GC) in Objective-C and Objective-C++
2938 programs. This option is only available with the NeXT runtime; the
2939 GNU runtime has a different garbage collection implementation that
2940 does not require special compiler flags.
2941
2942 -fobjc-nilcheck
2943 For the NeXT runtime with version 2 of the ABI, check for a nil
2944 receiver in method invocations before doing the actual method call.
2945 This is the default and can be disabled using -fno-objc-nilcheck.
2946 Class methods and super calls are never checked for nil in this way
2947 no matter what this flag is set to. Currently this flag does
2948 nothing when the GNU runtime, or an older version of the NeXT
2949 runtime ABI, is used.
2950
2951 -fobjc-std=objc1
2952 Conform to the language syntax of Objective-C 1.0, the language
2953 recognized by GCC 4.0. This only affects the Objective-C additions
2954 to the C/C++ language; it does not affect conformance to C/C++
2955 standards, which is controlled by the separate C/C++ dialect option
2956 flags. When this option is used with the Objective-C or
2957 Objective-C++ compiler, any Objective-C syntax that is not
2958 recognized by GCC 4.0 is rejected. This is useful if you need to
2959 make sure that your Objective-C code can be compiled with older
2960 versions of GCC.
2961
2962 -freplace-objc-classes
2963 Emit a special marker instructing ld(1) not to statically link in
2964 the resulting object file, and allow dyld(1) to load it in at run
2965 time instead. This is used in conjunction with the Fix-and-
2966 Continue debugging mode, where the object file in question may be
2967 recompiled and dynamically reloaded in the course of program
2968 execution, without the need to restart the program itself.
2969 Currently, Fix-and-Continue functionality is only available in
2970 conjunction with the NeXT runtime on Mac OS X 10.3 and later.
2971
2972 -fzero-link
2973 When compiling for the NeXT runtime, the compiler ordinarily
2974 replaces calls to "objc_getClass("...")" (when the name of the
2975 class is known at compile time) with static class references that
2976 get initialized at load time, which improves run-time performance.
2977 Specifying the -fzero-link flag suppresses this behavior and causes
2978 calls to "objc_getClass("...")" to be retained. This is useful in
2979 Zero-Link debugging mode, since it allows for individual class
2980 implementations to be modified during program execution. The GNU
2981 runtime currently always retains calls to "objc_get_class("...")"
2982 regardless of command-line options.
2983
2984 -fno-local-ivars
2985 By default instance variables in Objective-C can be accessed as if
2986 they were local variables from within the methods of the class
2987 they're declared in. This can lead to shadowing between instance
2988 variables and other variables declared either locally inside a
2989 class method or globally with the same name. Specifying the
2990 -fno-local-ivars flag disables this behavior thus avoiding variable
2991 shadowing issues.
2992
2993 -fivar-visibility=[public|protected|private|package]
2994 Set the default instance variable visibility to the specified
2995 option so that instance variables declared outside the scope of any
2996 access modifier directives default to the specified visibility.
2997
2998 -gen-decls
2999 Dump interface declarations for all classes seen in the source file
3000 to a file named sourcename.decl.
3001
3002 -Wassign-intercept (Objective-C and Objective-C++ only)
3003 Warn whenever an Objective-C assignment is being intercepted by the
3004 garbage collector.
3005
3006 -Wno-property-assign-default (Objective-C and Objective-C++ only)
3007 Do not warn if a property for an Objective-C object has no assign
3008 semantics specified.
3009
3010 -Wno-protocol (Objective-C and Objective-C++ only)
3011 If a class is declared to implement a protocol, a warning is issued
3012 for every method in the protocol that is not implemented by the
3013 class. The default behavior is to issue a warning for every method
3014 not explicitly implemented in the class, even if a method
3015 implementation is inherited from the superclass. If you use the
3016 -Wno-protocol option, then methods inherited from the superclass
3017 are considered to be implemented, and no warning is issued for
3018 them.
3019
3020 -Wselector (Objective-C and Objective-C++ only)
3021 Warn if multiple methods of different types for the same selector
3022 are found during compilation. The check is performed on the list
3023 of methods in the final stage of compilation. Additionally, a
3024 check is performed for each selector appearing in a
3025 "@selector(...)" expression, and a corresponding method for that
3026 selector has been found during compilation. Because these checks
3027 scan the method table only at the end of compilation, these
3028 warnings are not produced if the final stage of compilation is not
3029 reached, for example because an error is found during compilation,
3030 or because the -fsyntax-only option is being used.
3031
3032 -Wstrict-selector-match (Objective-C and Objective-C++ only)
3033 Warn if multiple methods with differing argument and/or return
3034 types are found for a given selector when attempting to send a
3035 message using this selector to a receiver of type "id" or "Class".
3036 When this flag is off (which is the default behavior), the compiler
3037 omits such warnings if any differences found are confined to types
3038 that share the same size and alignment.
3039
3040 -Wundeclared-selector (Objective-C and Objective-C++ only)
3041 Warn if a "@selector(...)" expression referring to an undeclared
3042 selector is found. A selector is considered undeclared if no
3043 method with that name has been declared before the "@selector(...)"
3044 expression, either explicitly in an @interface or @protocol
3045 declaration, or implicitly in an @implementation section. This
3046 option always performs its checks as soon as a "@selector(...)"
3047 expression is found, while -Wselector only performs its checks in
3048 the final stage of compilation. This also enforces the coding
3049 style convention that methods and selectors must be declared before
3050 being used.
3051
3052 -print-objc-runtime-info
3053 Generate C header describing the largest structure that is passed
3054 by value, if any.
3055
3056 Options to Control Diagnostic Messages Formatting
3057 Traditionally, diagnostic messages have been formatted irrespective of
3058 the output device's aspect (e.g. its width, ...). You can use the
3059 options described below to control the formatting algorithm for
3060 diagnostic messages, e.g. how many characters per line, how often
3061 source location information should be reported. Note that some
3062 language front ends may not honor these options.
3063
3064 -fmessage-length=n
3065 Try to format error messages so that they fit on lines of about n
3066 characters. If n is zero, then no line-wrapping is done; each
3067 error message appears on a single line. This is the default for
3068 all front ends.
3069
3070 Note - this option also affects the display of the #error and
3071 #warning pre-processor directives, and the deprecated
3072 function/type/variable attribute. It does not however affect the
3073 pragma GCC warning and pragma GCC error pragmas.
3074
3075 -fdiagnostics-show-location=once
3076 Only meaningful in line-wrapping mode. Instructs the diagnostic
3077 messages reporter to emit source location information once; that
3078 is, in case the message is too long to fit on a single physical
3079 line and has to be wrapped, the source location won't be emitted
3080 (as prefix) again, over and over, in subsequent continuation lines.
3081 This is the default behavior.
3082
3083 -fdiagnostics-show-location=every-line
3084 Only meaningful in line-wrapping mode. Instructs the diagnostic
3085 messages reporter to emit the same source location information (as
3086 prefix) for physical lines that result from the process of breaking
3087 a message which is too long to fit on a single line.
3088
3089 -fdiagnostics-color[=WHEN]
3090 -fno-diagnostics-color
3091 Use color in diagnostics. WHEN is never, always, or auto. The
3092 default depends on how the compiler has been configured, it can be
3093 any of the above WHEN options or also never if GCC_COLORS
3094 environment variable isn't present in the environment, and auto
3095 otherwise. auto makes GCC use color only when the standard error
3096 is a terminal, and when not executing in an emacs shell. The forms
3097 -fdiagnostics-color and -fno-diagnostics-color are aliases for
3098 -fdiagnostics-color=always and -fdiagnostics-color=never,
3099 respectively.
3100
3101 The colors are defined by the environment variable GCC_COLORS. Its
3102 value is a colon-separated list of capabilities and Select Graphic
3103 Rendition (SGR) substrings. SGR commands are interpreted by the
3104 terminal or terminal emulator. (See the section in the
3105 documentation of your text terminal for permitted values and their
3106 meanings as character attributes.) These substring values are
3107 integers in decimal representation and can be concatenated with
3108 semicolons. Common values to concatenate include 1 for bold, 4 for
3109 underline, 5 for blink, 7 for inverse, 39 for default foreground
3110 color, 30 to 37 for foreground colors, 90 to 97 for 16-color mode
3111 foreground colors, 38;5;0 to 38;5;255 for 88-color and 256-color
3112 modes foreground colors, 49 for default background color, 40 to 47
3113 for background colors, 100 to 107 for 16-color mode background
3114 colors, and 48;5;0 to 48;5;255 for 88-color and 256-color modes
3115 background colors.
3116
3117 The default GCC_COLORS is
3118
3119 error=01;31:warning=01;35:note=01;36:range1=32:range2=34:locus=01:\
3120 quote=01:path=01;36:fixit-insert=32:fixit-delete=31:\
3121 diff-filename=01:diff-hunk=32:diff-delete=31:diff-insert=32:\
3122 type-diff=01;32
3123
3124 where 01;31 is bold red, 01;35 is bold magenta, 01;36 is bold cyan,
3125 32 is green, 34 is blue, 01 is bold, and 31 is red. Setting
3126 GCC_COLORS to the empty string disables colors. Supported
3127 capabilities are as follows.
3128
3129 "error="
3130 SGR substring for error: markers.
3131
3132 "warning="
3133 SGR substring for warning: markers.
3134
3135 "note="
3136 SGR substring for note: markers.
3137
3138 "path="
3139 SGR substring for colorizing paths of control-flow events as
3140 printed via -fdiagnostics-path-format=, such as the identifiers
3141 of individual events and lines indicating interprocedural calls
3142 and returns.
3143
3144 "range1="
3145 SGR substring for first additional range.
3146
3147 "range2="
3148 SGR substring for second additional range.
3149
3150 "locus="
3151 SGR substring for location information, file:line or
3152 file:line:column etc.
3153
3154 "quote="
3155 SGR substring for information printed within quotes.
3156
3157 "fixit-insert="
3158 SGR substring for fix-it hints suggesting text to be inserted
3159 or replaced.
3160
3161 "fixit-delete="
3162 SGR substring for fix-it hints suggesting text to be deleted.
3163
3164 "diff-filename="
3165 SGR substring for filename headers within generated patches.
3166
3167 "diff-hunk="
3168 SGR substring for the starts of hunks within generated patches.
3169
3170 "diff-delete="
3171 SGR substring for deleted lines within generated patches.
3172
3173 "diff-insert="
3174 SGR substring for inserted lines within generated patches.
3175
3176 "type-diff="
3177 SGR substring for highlighting mismatching types within
3178 template arguments in the C++ frontend.
3179
3180 -fdiagnostics-urls[=WHEN]
3181 Use escape sequences to embed URLs in diagnostics. For example,
3182 when -fdiagnostics-show-option emits text showing the command-line
3183 option controlling a diagnostic, embed a URL for documentation of
3184 that option.
3185
3186 WHEN is never, always, or auto. auto makes GCC use URL escape
3187 sequences only when the standard error is a terminal, and when not
3188 executing in an emacs shell or any graphical terminal which is
3189 known to be incompatible with this feature, see below.
3190
3191 The default depends on how the compiler has been configured. It
3192 can be any of the above WHEN options.
3193
3194 GCC can also be configured (via the
3195 --with-diagnostics-urls=auto-if-env configure-time option) so that
3196 the default is affected by environment variables. Under such a
3197 configuration, GCC defaults to using auto if either GCC_URLS or
3198 TERM_URLS environment variables are present and non-empty in the
3199 environment of the compiler, or never if neither are.
3200
3201 However, even with -fdiagnostics-urls=always the behavior is
3202 dependent on those environment variables: If GCC_URLS is set to
3203 empty or no, do not embed URLs in diagnostics. If set to st, URLs
3204 use ST escape sequences. If set to bel, the default, URLs use BEL
3205 escape sequences. Any other non-empty value enables the feature.
3206 If GCC_URLS is not set, use TERM_URLS as a fallback. Note: ST is
3207 an ANSI escape sequence, string terminator ESC \, BEL is an ASCII
3208 character, CTRL-G that usually sounds like a beep.
3209
3210 At this time GCC tries to detect also a few terminals that are
3211 known to not implement the URL feature, and have bugs or at least
3212 had bugs in some versions that are still in use, where the URL
3213 escapes are likely to misbehave, i.e. print garbage on the screen.
3214 That list is currently xfce4-terminal, certain known to be buggy
3215 gnome-terminal versions, the linux console, and mingw. This check
3216 can be skipped with the -fdiagnostics-urls=always.
3217
3218 -fno-diagnostics-show-option
3219 By default, each diagnostic emitted includes text indicating the
3220 command-line option that directly controls the diagnostic (if such
3221 an option is known to the diagnostic machinery). Specifying the
3222 -fno-diagnostics-show-option flag suppresses that behavior.
3223
3224 -fno-diagnostics-show-caret
3225 By default, each diagnostic emitted includes the original source
3226 line and a caret ^ indicating the column. This option suppresses
3227 this information. The source line is truncated to n characters, if
3228 the -fmessage-length=n option is given. When the output is done to
3229 the terminal, the width is limited to the width given by the
3230 COLUMNS environment variable or, if not set, to the terminal width.
3231
3232 -fno-diagnostics-show-labels
3233 By default, when printing source code (via
3234 -fdiagnostics-show-caret), diagnostics can label ranges of source
3235 code with pertinent information, such as the types of expressions:
3236
3237 printf ("foo %s bar", long_i + long_j);
3238 ~^ ~~~~~~~~~~~~~~~
3239 | |
3240 char * long int
3241
3242 This option suppresses the printing of these labels (in the example
3243 above, the vertical bars and the "char *" and "long int" text).
3244
3245 -fno-diagnostics-show-cwe
3246 Diagnostic messages can optionally have an associated
3247 @url{https://cwe.mitre.org/index.html, CWE} identifier. GCC itself
3248 only provides such metadata for some of the -fanalyzer diagnostics.
3249 GCC plugins may also provide diagnostics with such metadata. By
3250 default, if this information is present, it will be printed with
3251 the diagnostic. This option suppresses the printing of this
3252 metadata.
3253
3254 -fno-diagnostics-show-line-numbers
3255 By default, when printing source code (via
3256 -fdiagnostics-show-caret), a left margin is printed, showing line
3257 numbers. This option suppresses this left margin.
3258
3259 -fdiagnostics-minimum-margin-width=width
3260 This option controls the minimum width of the left margin printed
3261 by -fdiagnostics-show-line-numbers. It defaults to 6.
3262
3263 -fdiagnostics-parseable-fixits
3264 Emit fix-it hints in a machine-parseable format, suitable for
3265 consumption by IDEs. For each fix-it, a line will be printed after
3266 the relevant diagnostic, starting with the string "fix-it:". For
3267 example:
3268
3269 fix-it:"test.c":{45:3-45:21}:"gtk_widget_show_all"
3270
3271 The location is expressed as a half-open range, expressed as a
3272 count of bytes, starting at byte 1 for the initial column. In the
3273 above example, bytes 3 through 20 of line 45 of "test.c" are to be
3274 replaced with the given string:
3275
3276 00000000011111111112222222222
3277 12345678901234567890123456789
3278 gtk_widget_showall (dlg);
3279 ^^^^^^^^^^^^^^^^^^
3280 gtk_widget_show_all
3281
3282 The filename and replacement string escape backslash as "\\", tab
3283 as "\t", newline as "\n", double quotes as "\"", non-printable
3284 characters as octal (e.g. vertical tab as "\013").
3285
3286 An empty replacement string indicates that the given range is to be
3287 removed. An empty range (e.g. "45:3-45:3") indicates that the
3288 string is to be inserted at the given position.
3289
3290 -fdiagnostics-generate-patch
3291 Print fix-it hints to stderr in unified diff format, after any
3292 diagnostics are printed. For example:
3293
3294 --- test.c
3295 +++ test.c
3296 @ -42,5 +42,5 @
3297
3298 void show_cb(GtkDialog *dlg)
3299 {
3300 - gtk_widget_showall(dlg);
3301 + gtk_widget_show_all(dlg);
3302 }
3303
3304 The diff may or may not be colorized, following the same rules as
3305 for diagnostics (see -fdiagnostics-color).
3306
3307 -fdiagnostics-show-template-tree
3308 In the C++ frontend, when printing diagnostics showing mismatching
3309 template types, such as:
3310
3311 could not convert 'std::map<int, std::vector<double> >()'
3312 from 'map<[...],vector<double>>' to 'map<[...],vector<float>>
3313
3314 the -fdiagnostics-show-template-tree flag enables printing a tree-
3315 like structure showing the common and differing parts of the types,
3316 such as:
3317
3318 map<
3319 [...],
3320 vector<
3321 [double != float]>>
3322
3323 The parts that differ are highlighted with color ("double" and
3324 "float" in this case).
3325
3326 -fno-elide-type
3327 By default when the C++ frontend prints diagnostics showing
3328 mismatching template types, common parts of the types are printed
3329 as "[...]" to simplify the error message. For example:
3330
3331 could not convert 'std::map<int, std::vector<double> >()'
3332 from 'map<[...],vector<double>>' to 'map<[...],vector<float>>
3333
3334 Specifying the -fno-elide-type flag suppresses that behavior. This
3335 flag also affects the output of the
3336 -fdiagnostics-show-template-tree flag.
3337
3338 -fdiagnostics-path-format=KIND
3339 Specify how to print paths of control-flow events for diagnostics
3340 that have such a path associated with them.
3341
3342 KIND is none, separate-events, or inline-events, the default.
3343
3344 none means to not print diagnostic paths.
3345
3346 separate-events means to print a separate "note" diagnostic for
3347 each event within the diagnostic. For example:
3348
3349 test.c:29:5: error: passing NULL as argument 1 to 'PyList_Append' which requires a non-NULL parameter
3350 test.c:25:10: note: (1) when 'PyList_New' fails, returning NULL
3351 test.c:27:3: note: (2) when 'i < count'
3352 test.c:29:5: note: (3) when calling 'PyList_Append', passing NULL from (1) as argument 1
3353
3354 inline-events means to print the events "inline" within the source
3355 code. This view attempts to consolidate the events into runs of
3356 sufficiently-close events, printing them as labelled ranges within
3357 the source.
3358
3359 For example, the same events as above might be printed as:
3360
3361 'test': events 1-3
3362 |
3363 | 25 | list = PyList_New(0);
3364 | | ^~~~~~~~~~~~~
3365 | | |
3366 | | (1) when 'PyList_New' fails, returning NULL
3367 | 26 |
3368 | 27 | for (i = 0; i < count; i++) {
3369 | | ~~~
3370 | | |
3371 | | (2) when 'i < count'
3372 | 28 | item = PyLong_FromLong(random());
3373 | 29 | PyList_Append(list, item);
3374 | | ~~~~~~~~~~~~~~~~~~~~~~~~~
3375 | | |
3376 | | (3) when calling 'PyList_Append', passing NULL from (1) as argument 1
3377 |
3378
3379 Interprocedural control flow is shown by grouping the events by
3380 stack frame, and using indentation to show how stack frames are
3381 nested, pushed, and popped.
3382
3383 For example:
3384
3385 'test': events 1-2
3386 |
3387 | 133 | {
3388 | | ^
3389 | | |
3390 | | (1) entering 'test'
3391 | 134 | boxed_int *obj = make_boxed_int (i);
3392 | | ~~~~~~~~~~~~~~~~~~
3393 | | |
3394 | | (2) calling 'make_boxed_int'
3395 |
3396 +--> 'make_boxed_int': events 3-4
3397 |
3398 | 120 | {
3399 | | ^
3400 | | |
3401 | | (3) entering 'make_boxed_int'
3402 | 121 | boxed_int *result = (boxed_int *)wrapped_malloc (sizeof (boxed_int));
3403 | | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3404 | | |
3405 | | (4) calling 'wrapped_malloc'
3406 |
3407 +--> 'wrapped_malloc': events 5-6
3408 |
3409 | 7 | {
3410 | | ^
3411 | | |
3412 | | (5) entering 'wrapped_malloc'
3413 | 8 | return malloc (size);
3414 | | ~~~~~~~~~~~~~
3415 | | |
3416 | | (6) calling 'malloc'
3417 |
3418 <-------------+
3419 |
3420 'test': event 7
3421 |
3422 | 138 | free_boxed_int (obj);
3423 | | ^~~~~~~~~~~~~~~~~~~~
3424 | | |
3425 | | (7) calling 'free_boxed_int'
3426 |
3427 (etc)
3428
3429 -fdiagnostics-show-path-depths
3430 This option provides additional information when printing control-
3431 flow paths associated with a diagnostic.
3432
3433 If this is option is provided then the stack depth will be printed
3434 for each run of events within
3435 -fdiagnostics-path-format=separate-events.
3436
3437 This is intended for use by GCC developers and plugin developers
3438 when debugging diagnostics that report interprocedural control
3439 flow.
3440
3441 -fno-show-column
3442 Do not print column numbers in diagnostics. This may be necessary
3443 if diagnostics are being scanned by a program that does not
3444 understand the column numbers, such as dejagnu.
3445
3446 -fdiagnostics-format=FORMAT
3447 Select a different format for printing diagnostics. FORMAT is text
3448 or json. The default is text.
3449
3450 The json format consists of a top-level JSON array containing JSON
3451 objects representing the diagnostics.
3452
3453 The JSON is emitted as one line, without formatting; the examples
3454 below have been formatted for clarity.
3455
3456 Diagnostics can have child diagnostics. For example, this error
3457 and note:
3458
3459 misleading-indentation.c:15:3: warning: this 'if' clause does not
3460 guard... [-Wmisleading-indentation]
3461 15 | if (flag)
3462 | ^~
3463 misleading-indentation.c:17:5: note: ...this statement, but the latter
3464 is misleadingly indented as if it were guarded by the 'if'
3465 17 | y = 2;
3466 | ^
3467
3468 might be printed in JSON form (after formatting) like this:
3469
3470 [
3471 {
3472 "kind": "warning",
3473 "locations": [
3474 {
3475 "caret": {
3476 "column": 3,
3477 "file": "misleading-indentation.c",
3478 "line": 15
3479 },
3480 "finish": {
3481 "column": 4,
3482 "file": "misleading-indentation.c",
3483 "line": 15
3484 }
3485 }
3486 ],
3487 "message": "this \u2018if\u2019 clause does not guard...",
3488 "option": "-Wmisleading-indentation",
3489 "option_url": "https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wmisleading-indentation",
3490 "children": [
3491 {
3492 "kind": "note",
3493 "locations": [
3494 {
3495 "caret": {
3496 "column": 5,
3497 "file": "misleading-indentation.c",
3498 "line": 17
3499 }
3500 }
3501 ],
3502 "message": "...this statement, but the latter is ..."
3503 }
3504 ]
3505 },
3506 ...
3507 ]
3508
3509 where the "note" is a child of the "warning".
3510
3511 A diagnostic has a "kind". If this is "warning", then there is an
3512 "option" key describing the command-line option controlling the
3513 warning.
3514
3515 A diagnostic can contain zero or more locations. Each location has
3516 up to three positions within it: a "caret" position and optional
3517 "start" and "finish" positions. A location can also have an
3518 optional "label" string. For example, this error:
3519
3520 bad-binary-ops.c:64:23: error: invalid operands to binary + (have 'S' {aka
3521 'struct s'} and 'T' {aka 'struct t'})
3522 64 | return callee_4a () + callee_4b ();
3523 | ~~~~~~~~~~~~ ^ ~~~~~~~~~~~~
3524 | | |
3525 | | T {aka struct t}
3526 | S {aka struct s}
3527
3528 has three locations. Its primary location is at the "+" token at
3529 column 23. It has two secondary locations, describing the left and
3530 right-hand sides of the expression, which have labels. It might be
3531 printed in JSON form as:
3532
3533 {
3534 "children": [],
3535 "kind": "error",
3536 "locations": [
3537 {
3538 "caret": {
3539 "column": 23, "file": "bad-binary-ops.c", "line": 64
3540 }
3541 },
3542 {
3543 "caret": {
3544 "column": 10, "file": "bad-binary-ops.c", "line": 64
3545 },
3546 "finish": {
3547 "column": 21, "file": "bad-binary-ops.c", "line": 64
3548 },
3549 "label": "S {aka struct s}"
3550 },
3551 {
3552 "caret": {
3553 "column": 25, "file": "bad-binary-ops.c", "line": 64
3554 },
3555 "finish": {
3556 "column": 36, "file": "bad-binary-ops.c", "line": 64
3557 },
3558 "label": "T {aka struct t}"
3559 }
3560 ],
3561 "message": "invalid operands to binary + ..."
3562 }
3563
3564 If a diagnostic contains fix-it hints, it has a "fixits" array,
3565 consisting of half-open intervals, similar to the output of
3566 -fdiagnostics-parseable-fixits. For example, this diagnostic with
3567 a replacement fix-it hint:
3568
3569 demo.c:8:15: error: 'struct s' has no member named 'colour'; did you
3570 mean 'color'?
3571 8 | return ptr->colour;
3572 | ^~~~~~
3573 | color
3574
3575 might be printed in JSON form as:
3576
3577 {
3578 "children": [],
3579 "fixits": [
3580 {
3581 "next": {
3582 "column": 21,
3583 "file": "demo.c",
3584 "line": 8
3585 },
3586 "start": {
3587 "column": 15,
3588 "file": "demo.c",
3589 "line": 8
3590 },
3591 "string": "color"
3592 }
3593 ],
3594 "kind": "error",
3595 "locations": [
3596 {
3597 "caret": {
3598 "column": 15,
3599 "file": "demo.c",
3600 "line": 8
3601 },
3602 "finish": {
3603 "column": 20,
3604 "file": "demo.c",
3605 "line": 8
3606 }
3607 }
3608 ],
3609 "message": "\u2018struct s\u2019 has no member named ..."
3610 }
3611
3612 where the fix-it hint suggests replacing the text from "start" up
3613 to but not including "next" with "string"'s value. Deletions are
3614 expressed via an empty value for "string", insertions by having
3615 "start" equal "next".
3616
3617 If the diagnostic has a path of control-flow events associated with
3618 it, it has a "path" array of objects representing the events. Each
3619 event object has a "description" string, a "location" object, along
3620 with a "function" string and a "depth" number for representing
3621 interprocedural paths. The "function" represents the current
3622 function at that event, and the "depth" represents the stack depth
3623 relative to some baseline: the higher, the more frames are within
3624 the stack.
3625
3626 For example, the intraprocedural example shown for
3627 -fdiagnostics-path-format= might have this JSON for its path:
3628
3629 "path": [
3630 {
3631 "depth": 0,
3632 "description": "when 'PyList_New' fails, returning NULL",
3633 "function": "test",
3634 "location": {
3635 "column": 10,
3636 "file": "test.c",
3637 "line": 25
3638 }
3639 },
3640 {
3641 "depth": 0,
3642 "description": "when 'i < count'",
3643 "function": "test",
3644 "location": {
3645 "column": 3,
3646 "file": "test.c",
3647 "line": 27
3648 }
3649 },
3650 {
3651 "depth": 0,
3652 "description": "when calling 'PyList_Append', passing NULL from (1) as argument 1",
3653 "function": "test",
3654 "location": {
3655 "column": 5,
3656 "file": "test.c",
3657 "line": 29
3658 }
3659 }
3660 ]
3661
3662 Options to Request or Suppress Warnings
3663 Warnings are diagnostic messages that report constructions that are not
3664 inherently erroneous but that are risky or suggest there may have been
3665 an error.
3666
3667 The following language-independent options do not enable specific
3668 warnings but control the kinds of diagnostics produced by GCC.
3669
3670 -fsyntax-only
3671 Check the code for syntax errors, but don't do anything beyond
3672 that.
3673
3674 -fmax-errors=n
3675 Limits the maximum number of error messages to n, at which point
3676 GCC bails out rather than attempting to continue processing the
3677 source code. If n is 0 (the default), there is no limit on the
3678 number of error messages produced. If -Wfatal-errors is also
3679 specified, then -Wfatal-errors takes precedence over this option.
3680
3681 -w Inhibit all warning messages.
3682
3683 -Werror
3684 Make all warnings into errors.
3685
3686 -Werror=
3687 Make the specified warning into an error. The specifier for a
3688 warning is appended; for example -Werror=switch turns the warnings
3689 controlled by -Wswitch into errors. This switch takes a negative
3690 form, to be used to negate -Werror for specific warnings; for
3691 example -Wno-error=switch makes -Wswitch warnings not be errors,
3692 even when -Werror is in effect.
3693
3694 The warning message for each controllable warning includes the
3695 option that controls the warning. That option can then be used
3696 with -Werror= and -Wno-error= as described above. (Printing of the
3697 option in the warning message can be disabled using the
3698 -fno-diagnostics-show-option flag.)
3699
3700 Note that specifying -Werror=foo automatically implies -Wfoo.
3701 However, -Wno-error=foo does not imply anything.
3702
3703 -Wfatal-errors
3704 This option causes the compiler to abort compilation on the first
3705 error occurred rather than trying to keep going and printing
3706 further error messages.
3707
3708 You can request many specific warnings with options beginning with -W,
3709 for example -Wimplicit to request warnings on implicit declarations.
3710 Each of these specific warning options also has a negative form
3711 beginning -Wno- to turn off warnings; for example, -Wno-implicit. This
3712 manual lists only one of the two forms, whichever is not the default.
3713 For further language-specific options also refer to C++ Dialect Options
3714 and Objective-C and Objective-C++ Dialect Options. Additional warnings
3715 can be produced by enabling the static analyzer;
3716
3717 Some options, such as -Wall and -Wextra, turn on other options, such as
3718 -Wunused, which may turn on further options, such as -Wunused-value.
3719 The combined effect of positive and negative forms is that more
3720 specific options have priority over less specific ones, independently
3721 of their position in the command-line. For options of the same
3722 specificity, the last one takes effect. Options enabled or disabled via
3723 pragmas take effect as if they appeared at the end of the command-line.
3724
3725 When an unrecognized warning option is requested (e.g.,
3726 -Wunknown-warning), GCC emits a diagnostic stating that the option is
3727 not recognized. However, if the -Wno- form is used, the behavior is
3728 slightly different: no diagnostic is produced for -Wno-unknown-warning
3729 unless other diagnostics are being produced. This allows the use of
3730 new -Wno- options with old compilers, but if something goes wrong, the
3731 compiler warns that an unrecognized option is present.
3732
3733 The effectiveness of some warnings depends on optimizations also being
3734 enabled. For example -Wsuggest-final-types is more effective with link-
3735 time optimization and -Wmaybe-uninitialized does not warn at all unless
3736 optimization is enabled.
3737
3738 -Wpedantic
3739 -pedantic
3740 Issue all the warnings demanded by strict ISO C and ISO C++; reject
3741 all programs that use forbidden extensions, and some other programs
3742 that do not follow ISO C and ISO C++. For ISO C, follows the
3743 version of the ISO C standard specified by any -std option used.
3744
3745 Valid ISO C and ISO C++ programs should compile properly with or
3746 without this option (though a rare few require -ansi or a -std
3747 option specifying the required version of ISO C). However, without
3748 this option, certain GNU extensions and traditional C and C++
3749 features are supported as well. With this option, they are
3750 rejected.
3751
3752 -Wpedantic does not cause warning messages for use of the alternate
3753 keywords whose names begin and end with __. This alternate format
3754 can also be used to disable warnings for non-ISO __intN types, i.e.
3755 __intN__. Pedantic warnings are also disabled in the expression
3756 that follows "__extension__". However, only system header files
3757 should use these escape routes; application programs should avoid
3758 them.
3759
3760 Some users try to use -Wpedantic to check programs for strict ISO C
3761 conformance. They soon find that it does not do quite what they
3762 want: it finds some non-ISO practices, but not all---only those for
3763 which ISO C requires a diagnostic, and some others for which
3764 diagnostics have been added.
3765
3766 A feature to report any failure to conform to ISO C might be useful
3767 in some instances, but would require considerable additional work
3768 and would be quite different from -Wpedantic. We don't have plans
3769 to support such a feature in the near future.
3770
3771 Where the standard specified with -std represents a GNU extended
3772 dialect of C, such as gnu90 or gnu99, there is a corresponding base
3773 standard, the version of ISO C on which the GNU extended dialect is
3774 based. Warnings from -Wpedantic are given where they are required
3775 by the base standard. (It does not make sense for such warnings to
3776 be given only for features not in the specified GNU C dialect,
3777 since by definition the GNU dialects of C include all features the
3778 compiler supports with the given option, and there would be nothing
3779 to warn about.)
3780
3781 -pedantic-errors
3782 Give an error whenever the base standard (see -Wpedantic) requires
3783 a diagnostic, in some cases where there is undefined behavior at
3784 compile-time and in some other cases that do not prevent
3785 compilation of programs that are valid according to the standard.
3786 This is not equivalent to -Werror=pedantic, since there are errors
3787 enabled by this option and not enabled by the latter and vice
3788 versa.
3789
3790 -Wall
3791 This enables all the warnings about constructions that some users
3792 consider questionable, and that are easy to avoid (or modify to
3793 prevent the warning), even in conjunction with macros. This also
3794 enables some language-specific warnings described in C++ Dialect
3795 Options and Objective-C and Objective-C++ Dialect Options.
3796
3797 -Wall turns on the following warning flags:
3798
3799 -Waddress -Warray-bounds=1 (only with -O2) -Wbool-compare
3800 -Wbool-operation -Wc++11-compat -Wc++14-compat -Wcatch-value (C++
3801 and Objective-C++ only) -Wchar-subscripts -Wcomment
3802 -Wduplicate-decl-specifier (C and Objective-C only) -Wenum-compare
3803 (in C/ObjC; this is on by default in C++) -Wenum-conversion in
3804 C/ObjC; -Wformat -Wformat-overflow -Wformat-truncation
3805 -Wint-in-bool-context -Wimplicit (C and Objective-C only)
3806 -Wimplicit-int (C and Objective-C only)
3807 -Wimplicit-function-declaration (C and Objective-C only)
3808 -Winit-self (only for C++) -Wlogical-not-parentheses -Wmain (only
3809 for C/ObjC and unless -ffreestanding) -Wmaybe-uninitialized
3810 -Wmemset-elt-size -Wmemset-transposed-args -Wmisleading-indentation
3811 (only for C/C++) -Wmissing-attributes -Wmissing-braces (only for
3812 C/ObjC) -Wmultistatement-macros -Wnarrowing (only for C++)
3813 -Wnonnull -Wnonnull-compare -Wopenmp-simd -Wparentheses
3814 -Wpessimizing-move (only for C++) -Wpointer-sign -Wreorder
3815 -Wrestrict -Wreturn-type -Wsequence-point -Wsign-compare (only in
3816 C++) -Wsizeof-pointer-div -Wsizeof-pointer-memaccess
3817 -Wstrict-aliasing -Wstrict-overflow=1 -Wswitch
3818 -Wtautological-compare -Wtrigraphs -Wuninitialized
3819 -Wunknown-pragmas -Wunused-function -Wunused-label -Wunused-value
3820 -Wunused-variable -Wvolatile-register-var -Wzero-length-bounds
3821
3822 Note that some warning flags are not implied by -Wall. Some of
3823 them warn about constructions that users generally do not consider
3824 questionable, but which occasionally you might wish to check for;
3825 others warn about constructions that are necessary or hard to avoid
3826 in some cases, and there is no simple way to modify the code to
3827 suppress the warning. Some of them are enabled by -Wextra but many
3828 of them must be enabled individually.
3829
3830 -Wextra
3831 This enables some extra warning flags that are not enabled by
3832 -Wall. (This option used to be called -W. The older name is still
3833 supported, but the newer name is more descriptive.)
3834
3835 -Wclobbered -Wcast-function-type -Wdeprecated-copy (C++ only)
3836 -Wempty-body -Wignored-qualifiers -Wimplicit-fallthrough=3
3837 -Wmissing-field-initializers -Wmissing-parameter-type (C only)
3838 -Wold-style-declaration (C only) -Woverride-init -Wsign-compare (C
3839 only) -Wstring-compare -Wredundant-move (only for C++)
3840 -Wtype-limits -Wuninitialized -Wshift-negative-value (in C++03 and
3841 in C99 and newer) -Wunused-parameter (only with -Wunused or -Wall)
3842 -Wunused-but-set-parameter (only with -Wunused or -Wall)
3843
3844 The option -Wextra also prints warning messages for the following
3845 cases:
3846
3847 * A pointer is compared against integer zero with "<", "<=", ">",
3848 or ">=".
3849
3850 * (C++ only) An enumerator and a non-enumerator both appear in a
3851 conditional expression.
3852
3853 * (C++ only) Ambiguous virtual bases.
3854
3855 * (C++ only) Subscripting an array that has been declared
3856 "register".
3857
3858 * (C++ only) Taking the address of a variable that has been
3859 declared "register".
3860
3861 * (C++ only) A base class is not initialized in the copy
3862 constructor of a derived class.
3863
3864 -Wabi (C, Objective-C, C++ and Objective-C++ only)
3865 Warn about code affected by ABI changes. This includes code that
3866 may not be compatible with the vendor-neutral C++ ABI as well as
3867 the psABI for the particular target.
3868
3869 Since G++ now defaults to updating the ABI with each major release,
3870 normally -Wabi warns only about C++ ABI compatibility problems if
3871 there is a check added later in a release series for an ABI issue
3872 discovered since the initial release. -Wabi warns about more
3873 things if an older ABI version is selected (with -fabi-version=n).
3874
3875 -Wabi can also be used with an explicit version number to warn
3876 about C++ ABI compatibility with a particular -fabi-version level,
3877 e.g. -Wabi=2 to warn about changes relative to -fabi-version=2.
3878
3879 If an explicit version number is provided and -fabi-compat-version
3880 is not specified, the version number from this option is used for
3881 compatibility aliases. If no explicit version number is provided
3882 with this option, but -fabi-compat-version is specified, that
3883 version number is used for C++ ABI warnings.
3884
3885 Although an effort has been made to warn about all such cases,
3886 there are probably some cases that are not warned about, even
3887 though G++ is generating incompatible code. There may also be
3888 cases where warnings are emitted even though the code that is
3889 generated is compatible.
3890
3891 You should rewrite your code to avoid these warnings if you are
3892 concerned about the fact that code generated by G++ may not be
3893 binary compatible with code generated by other compilers.
3894
3895 Known incompatibilities in -fabi-version=2 (which was the default
3896 from GCC 3.4 to 4.9) include:
3897
3898 * A template with a non-type template parameter of reference type
3899 was mangled incorrectly:
3900
3901 extern int N;
3902 template <int &> struct S {};
3903 void n (S<N>) {2}
3904
3905 This was fixed in -fabi-version=3.
3906
3907 * SIMD vector types declared using "__attribute ((vector_size))"
3908 were mangled in a non-standard way that does not allow for
3909 overloading of functions taking vectors of different sizes.
3910
3911 The mangling was changed in -fabi-version=4.
3912
3913 * "__attribute ((const))" and "noreturn" were mangled as type
3914 qualifiers, and "decltype" of a plain declaration was folded
3915 away.
3916
3917 These mangling issues were fixed in -fabi-version=5.
3918
3919 * Scoped enumerators passed as arguments to a variadic function
3920 are promoted like unscoped enumerators, causing "va_arg" to
3921 complain. On most targets this does not actually affect the
3922 parameter passing ABI, as there is no way to pass an argument
3923 smaller than "int".
3924
3925 Also, the ABI changed the mangling of template argument packs,
3926 "const_cast", "static_cast", prefix increment/decrement, and a
3927 class scope function used as a template argument.
3928
3929 These issues were corrected in -fabi-version=6.
3930
3931 * Lambdas in default argument scope were mangled incorrectly, and
3932 the ABI changed the mangling of "nullptr_t".
3933
3934 These issues were corrected in -fabi-version=7.
3935
3936 * When mangling a function type with function-cv-qualifiers, the
3937 un-qualified function type was incorrectly treated as a
3938 substitution candidate.
3939
3940 This was fixed in -fabi-version=8, the default for GCC 5.1.
3941
3942 * "decltype(nullptr)" incorrectly had an alignment of 1, leading
3943 to unaligned accesses. Note that this did not affect the ABI
3944 of a function with a "nullptr_t" parameter, as parameters have
3945 a minimum alignment.
3946
3947 This was fixed in -fabi-version=9, the default for GCC 5.2.
3948
3949 * Target-specific attributes that affect the identity of a type,
3950 such as ia32 calling conventions on a function type (stdcall,
3951 regparm, etc.), did not affect the mangled name, leading to
3952 name collisions when function pointers were used as template
3953 arguments.
3954
3955 This was fixed in -fabi-version=10, the default for GCC 6.1.
3956
3957 This option also enables warnings about psABI-related changes. The
3958 known psABI changes at this point include:
3959
3960 * For SysV/x86-64, unions with "long double" members are passed
3961 in memory as specified in psABI. Prior to GCC 4.4, this was
3962 not the case. For example:
3963
3964 union U {
3965 long double ld;
3966 int i;
3967 };
3968
3969 "union U" is now always passed in memory.
3970
3971 -Wchar-subscripts
3972 Warn if an array subscript has type "char". This is a common cause
3973 of error, as programmers often forget that this type is signed on
3974 some machines. This warning is enabled by -Wall.
3975
3976 -Wno-coverage-mismatch
3977 Warn if feedback profiles do not match when using the -fprofile-use
3978 option. If a source file is changed between compiling with
3979 -fprofile-generate and with -fprofile-use, the files with the
3980 profile feedback can fail to match the source file and GCC cannot
3981 use the profile feedback information. By default, this warning is
3982 enabled and is treated as an error. -Wno-coverage-mismatch can be
3983 used to disable the warning or -Wno-error=coverage-mismatch can be
3984 used to disable the error. Disabling the error for this warning
3985 can result in poorly optimized code and is useful only in the case
3986 of very minor changes such as bug fixes to an existing code-base.
3987 Completely disabling the warning is not recommended.
3988
3989 -Wno-cpp
3990 (C, Objective-C, C++, Objective-C++ and Fortran only) Suppress
3991 warning messages emitted by "#warning" directives.
3992
3993 -Wdouble-promotion (C, C++, Objective-C and Objective-C++ only)
3994 Give a warning when a value of type "float" is implicitly promoted
3995 to "double". CPUs with a 32-bit "single-precision" floating-point
3996 unit implement "float" in hardware, but emulate "double" in
3997 software. On such a machine, doing computations using "double"
3998 values is much more expensive because of the overhead required for
3999 software emulation.
4000
4001 It is easy to accidentally do computations with "double" because
4002 floating-point literals are implicitly of type "double". For
4003 example, in:
4004
4005 float area(float radius)
4006 {
4007 return 3.14159 * radius * radius;
4008 }
4009
4010 the compiler performs the entire computation with "double" because
4011 the floating-point literal is a "double".
4012
4013 -Wduplicate-decl-specifier (C and Objective-C only)
4014 Warn if a declaration has duplicate "const", "volatile", "restrict"
4015 or "_Atomic" specifier. This warning is enabled by -Wall.
4016
4017 -Wformat
4018 -Wformat=n
4019 Check calls to "printf" and "scanf", etc., to make sure that the
4020 arguments supplied have types appropriate to the format string
4021 specified, and that the conversions specified in the format string
4022 make sense. This includes standard functions, and others specified
4023 by format attributes, in the "printf", "scanf", "strftime" and
4024 "strfmon" (an X/Open extension, not in the C standard) families (or
4025 other target-specific families). Which functions are checked
4026 without format attributes having been specified depends on the
4027 standard version selected, and such checks of functions without the
4028 attribute specified are disabled by -ffreestanding or -fno-builtin.
4029
4030 The formats are checked against the format features supported by
4031 GNU libc version 2.2. These include all ISO C90 and C99 features,
4032 as well as features from the Single Unix Specification and some BSD
4033 and GNU extensions. Other library implementations may not support
4034 all these features; GCC does not support warning about features
4035 that go beyond a particular library's limitations. However, if
4036 -Wpedantic is used with -Wformat, warnings are given about format
4037 features not in the selected standard version (but not for
4038 "strfmon" formats, since those are not in any version of the C
4039 standard).
4040
4041 -Wformat=1
4042 -Wformat
4043 Option -Wformat is equivalent to -Wformat=1, and -Wno-format is
4044 equivalent to -Wformat=0. Since -Wformat also checks for null
4045 format arguments for several functions, -Wformat also implies
4046 -Wnonnull. Some aspects of this level of format checking can
4047 be disabled by the options: -Wno-format-contains-nul,
4048 -Wno-format-extra-args, and -Wno-format-zero-length. -Wformat
4049 is enabled by -Wall.
4050
4051 -Wformat=2
4052 Enable -Wformat plus additional format checks. Currently
4053 equivalent to -Wformat -Wformat-nonliteral -Wformat-security
4054 -Wformat-y2k.
4055
4056 -Wno-format-contains-nul
4057 If -Wformat is specified, do not warn about format strings that
4058 contain NUL bytes.
4059
4060 -Wno-format-extra-args
4061 If -Wformat is specified, do not warn about excess arguments to a
4062 "printf" or "scanf" format function. The C standard specifies that
4063 such arguments are ignored.
4064
4065 Where the unused arguments lie between used arguments that are
4066 specified with $ operand number specifications, normally warnings
4067 are still given, since the implementation could not know what type
4068 to pass to "va_arg" to skip the unused arguments. However, in the
4069 case of "scanf" formats, this option suppresses the warning if the
4070 unused arguments are all pointers, since the Single Unix
4071 Specification says that such unused arguments are allowed.
4072
4073 -Wformat-overflow
4074 -Wformat-overflow=level
4075 Warn about calls to formatted input/output functions such as
4076 "sprintf" and "vsprintf" that might overflow the destination
4077 buffer. When the exact number of bytes written by a format
4078 directive cannot be determined at compile-time it is estimated
4079 based on heuristics that depend on the level argument and on
4080 optimization. While enabling optimization will in most cases
4081 improve the accuracy of the warning, it may also result in false
4082 positives.
4083
4084 -Wformat-overflow
4085 -Wformat-overflow=1
4086 Level 1 of -Wformat-overflow enabled by -Wformat employs a
4087 conservative approach that warns only about calls that most
4088 likely overflow the buffer. At this level, numeric arguments
4089 to format directives with unknown values are assumed to have
4090 the value of one, and strings of unknown length to be empty.
4091 Numeric arguments that are known to be bounded to a subrange of
4092 their type, or string arguments whose output is bounded either
4093 by their directive's precision or by a finite set of string
4094 literals, are assumed to take on the value within the range
4095 that results in the most bytes on output. For example, the
4096 call to "sprintf" below is diagnosed because even with both a
4097 and b equal to zero, the terminating NUL character ('\0')
4098 appended by the function to the destination buffer will be
4099 written past its end. Increasing the size of the buffer by a
4100 single byte is sufficient to avoid the warning, though it may
4101 not be sufficient to avoid the overflow.
4102
4103 void f (int a, int b)
4104 {
4105 char buf [13];
4106 sprintf (buf, "a = %i, b = %i\n", a, b);
4107 }
4108
4109 -Wformat-overflow=2
4110 Level 2 warns also about calls that might overflow the
4111 destination buffer given an argument of sufficient length or
4112 magnitude. At level 2, unknown numeric arguments are assumed
4113 to have the minimum representable value for signed types with a
4114 precision greater than 1, and the maximum representable value
4115 otherwise. Unknown string arguments whose length cannot be
4116 assumed to be bounded either by the directive's precision, or
4117 by a finite set of string literals they may evaluate to, or the
4118 character array they may point to, are assumed to be 1
4119 character long.
4120
4121 At level 2, the call in the example above is again diagnosed,
4122 but this time because with a equal to a 32-bit "INT_MIN" the
4123 first %i directive will write some of its digits beyond the end
4124 of the destination buffer. To make the call safe regardless of
4125 the values of the two variables, the size of the destination
4126 buffer must be increased to at least 34 bytes. GCC includes
4127 the minimum size of the buffer in an informational note
4128 following the warning.
4129
4130 An alternative to increasing the size of the destination buffer
4131 is to constrain the range of formatted values. The maximum
4132 length of string arguments can be bounded by specifying the
4133 precision in the format directive. When numeric arguments of
4134 format directives can be assumed to be bounded by less than the
4135 precision of their type, choosing an appropriate length
4136 modifier to the format specifier will reduce the required
4137 buffer size. For example, if a and b in the example above can
4138 be assumed to be within the precision of the "short int" type
4139 then using either the %hi format directive or casting the
4140 argument to "short" reduces the maximum required size of the
4141 buffer to 24 bytes.
4142
4143 void f (int a, int b)
4144 {
4145 char buf [23];
4146 sprintf (buf, "a = %hi, b = %i\n", a, (short)b);
4147 }
4148
4149 -Wno-format-zero-length
4150 If -Wformat is specified, do not warn about zero-length formats.
4151 The C standard specifies that zero-length formats are allowed.
4152
4153 -Wformat-nonliteral
4154 If -Wformat is specified, also warn if the format string is not a
4155 string literal and so cannot be checked, unless the format function
4156 takes its format arguments as a "va_list".
4157
4158 -Wformat-security
4159 If -Wformat is specified, also warn about uses of format functions
4160 that represent possible security problems. At present, this warns
4161 about calls to "printf" and "scanf" functions where the format
4162 string is not a string literal and there are no format arguments,
4163 as in "printf (foo);". This may be a security hole if the format
4164 string came from untrusted input and contains %n. (This is
4165 currently a subset of what -Wformat-nonliteral warns about, but in
4166 future warnings may be added to -Wformat-security that are not
4167 included in -Wformat-nonliteral.)
4168
4169 -Wformat-signedness
4170 If -Wformat is specified, also warn if the format string requires
4171 an unsigned argument and the argument is signed and vice versa.
4172
4173 -Wformat-truncation
4174 -Wformat-truncation=level
4175 Warn about calls to formatted input/output functions such as
4176 "snprintf" and "vsnprintf" that might result in output truncation.
4177 When the exact number of bytes written by a format directive cannot
4178 be determined at compile-time it is estimated based on heuristics
4179 that depend on the level argument and on optimization. While
4180 enabling optimization will in most cases improve the accuracy of
4181 the warning, it may also result in false positives. Except as
4182 noted otherwise, the option uses the same logic -Wformat-overflow.
4183
4184 -Wformat-truncation
4185 -Wformat-truncation=1
4186 Level 1 of -Wformat-truncation enabled by -Wformat employs a
4187 conservative approach that warns only about calls to bounded
4188 functions whose return value is unused and that will most
4189 likely result in output truncation.
4190
4191 -Wformat-truncation=2
4192 Level 2 warns also about calls to bounded functions whose
4193 return value is used and that might result in truncation given
4194 an argument of sufficient length or magnitude.
4195
4196 -Wformat-y2k
4197 If -Wformat is specified, also warn about "strftime" formats that
4198 may yield only a two-digit year.
4199
4200 -Wnonnull
4201 Warn about passing a null pointer for arguments marked as requiring
4202 a non-null value by the "nonnull" function attribute.
4203
4204 -Wnonnull is included in -Wall and -Wformat. It can be disabled
4205 with the -Wno-nonnull option.
4206
4207 -Wnonnull-compare
4208 Warn when comparing an argument marked with the "nonnull" function
4209 attribute against null inside the function.
4210
4211 -Wnonnull-compare is included in -Wall. It can be disabled with
4212 the -Wno-nonnull-compare option.
4213
4214 -Wnull-dereference
4215 Warn if the compiler detects paths that trigger erroneous or
4216 undefined behavior due to dereferencing a null pointer. This
4217 option is only active when -fdelete-null-pointer-checks is active,
4218 which is enabled by optimizations in most targets. The precision
4219 of the warnings depends on the optimization options used.
4220
4221 -Winit-self (C, C++, Objective-C and Objective-C++ only)
4222 Warn about uninitialized variables that are initialized with
4223 themselves. Note this option can only be used with the
4224 -Wuninitialized option.
4225
4226 For example, GCC warns about "i" being uninitialized in the
4227 following snippet only when -Winit-self has been specified:
4228
4229 int f()
4230 {
4231 int i = i;
4232 return i;
4233 }
4234
4235 This warning is enabled by -Wall in C++.
4236
4237 -Wno-implicit-int (C and Objective-C only)
4238 This option controls warnings when a declaration does not specify a
4239 type. This warning is enabled by default in C99 and later dialects
4240 of C, and also by -Wall.
4241
4242 -Wno-implicit-function-declaration (C and Objective-C only)
4243 This option controls warnings when a function is used before being
4244 declared. This warning is enabled by default in C99 and later
4245 dialects of C, and also by -Wall. The warning is made into an
4246 error by -pedantic-errors.
4247
4248 -Wimplicit (C and Objective-C only)
4249 Same as -Wimplicit-int and -Wimplicit-function-declaration. This
4250 warning is enabled by -Wall.
4251
4252 -Wimplicit-fallthrough
4253 -Wimplicit-fallthrough is the same as -Wimplicit-fallthrough=3 and
4254 -Wno-implicit-fallthrough is the same as -Wimplicit-fallthrough=0.
4255
4256 -Wimplicit-fallthrough=n
4257 Warn when a switch case falls through. For example:
4258
4259 switch (cond)
4260 {
4261 case 1:
4262 a = 1;
4263 break;
4264 case 2:
4265 a = 2;
4266 case 3:
4267 a = 3;
4268 break;
4269 }
4270
4271 This warning does not warn when the last statement of a case cannot
4272 fall through, e.g. when there is a return statement or a call to
4273 function declared with the noreturn attribute.
4274 -Wimplicit-fallthrough= also takes into account control flow
4275 statements, such as ifs, and only warns when appropriate. E.g.
4276
4277 switch (cond)
4278 {
4279 case 1:
4280 if (i > 3) {
4281 bar (5);
4282 break;
4283 } else if (i < 1) {
4284 bar (0);
4285 } else
4286 return;
4287 default:
4288 ...
4289 }
4290
4291 Since there are occasions where a switch case fall through is
4292 desirable, GCC provides an attribute, "__attribute__
4293 ((fallthrough))", that is to be used along with a null statement to
4294 suppress this warning that would normally occur:
4295
4296 switch (cond)
4297 {
4298 case 1:
4299 bar (0);
4300 __attribute__ ((fallthrough));
4301 default:
4302 ...
4303 }
4304
4305 C++17 provides a standard way to suppress the
4306 -Wimplicit-fallthrough warning using "[[fallthrough]];" instead of
4307 the GNU attribute. In C++11 or C++14 users can use
4308 "[[gnu::fallthrough]];", which is a GNU extension. Instead of
4309 these attributes, it is also possible to add a fallthrough comment
4310 to silence the warning. The whole body of the C or C++ style
4311 comment should match the given regular expressions listed below.
4312 The option argument n specifies what kind of comments are accepted:
4313
4314 *<-Wimplicit-fallthrough=0 disables the warning altogether.>
4315 *<-Wimplicit-fallthrough=1 matches ".*" regular>
4316 expression, any comment is used as fallthrough comment.
4317
4318 *<-Wimplicit-fallthrough=2 case insensitively matches>
4319 ".*falls?[ \t-]*thr(ough|u).*" regular expression.
4320
4321 *<-Wimplicit-fallthrough=3 case sensitively matches one of the>
4322 following regular expressions:
4323
4324 *<"-fallthrough">
4325 *<"@fallthrough@">
4326 *<"lint -fallthrough[ \t]*">
4327 *<"[ \t.!]*(ELSE,? |INTENTIONAL(LY)? )?FALL(S |
4328 |-)?THR(OUGH|U)[ \t.!]*(-[^\n\r]*)?">
4329 *<"[ \t.!]*(Else,? |Intentional(ly)? )?Fall((s |
4330 |-)[Tt]|t)hr(ough|u)[ \t.!]*(-[^\n\r]*)?">
4331 *<"[ \t.!]*([Ee]lse,? |[Ii]ntentional(ly)? )?fall(s |
4332 |-)?thr(ough|u)[ \t.!]*(-[^\n\r]*)?">
4333 *<-Wimplicit-fallthrough=4 case sensitively matches one of the>
4334 following regular expressions:
4335
4336 *<"-fallthrough">
4337 *<"@fallthrough@">
4338 *<"lint -fallthrough[ \t]*">
4339 *<"[ \t]*FALLTHR(OUGH|U)[ \t]*">
4340 *<-Wimplicit-fallthrough=5 doesn't recognize any comments as>
4341 fallthrough comments, only attributes disable the warning.
4342
4343 The comment needs to be followed after optional whitespace and
4344 other comments by "case" or "default" keywords or by a user label
4345 that precedes some "case" or "default" label.
4346
4347 switch (cond)
4348 {
4349 case 1:
4350 bar (0);
4351 /* FALLTHRU */
4352 default:
4353 ...
4354 }
4355
4356 The -Wimplicit-fallthrough=3 warning is enabled by -Wextra.
4357
4358 -Wno-if-not-aligned (C, C++, Objective-C and Objective-C++ only)
4359 Control if warnings triggered by the "warn_if_not_aligned"
4360 attribute should be issued. These warnings are enabled by default.
4361
4362 -Wignored-qualifiers (C and C++ only)
4363 Warn if the return type of a function has a type qualifier such as
4364 "const". For ISO C such a type qualifier has no effect, since the
4365 value returned by a function is not an lvalue. For C++, the
4366 warning is only emitted for scalar types or "void". ISO C
4367 prohibits qualified "void" return types on function definitions, so
4368 such return types always receive a warning even without this
4369 option.
4370
4371 This warning is also enabled by -Wextra.
4372
4373 -Wno-ignored-attributes (C and C++ only)
4374 This option controls warnings when an attribute is ignored. This
4375 is different from the -Wattributes option in that it warns whenever
4376 the compiler decides to drop an attribute, not that the attribute
4377 is either unknown, used in a wrong place, etc. This warning is
4378 enabled by default.
4379
4380 -Wmain
4381 Warn if the type of "main" is suspicious. "main" should be a
4382 function with external linkage, returning int, taking either zero
4383 arguments, two, or three arguments of appropriate types. This
4384 warning is enabled by default in C++ and is enabled by either -Wall
4385 or -Wpedantic.
4386
4387 -Wmisleading-indentation (C and C++ only)
4388 Warn when the indentation of the code does not reflect the block
4389 structure. Specifically, a warning is issued for "if", "else",
4390 "while", and "for" clauses with a guarded statement that does not
4391 use braces, followed by an unguarded statement with the same
4392 indentation.
4393
4394 In the following example, the call to "bar" is misleadingly
4395 indented as if it were guarded by the "if" conditional.
4396
4397 if (some_condition ())
4398 foo ();
4399 bar (); /* Gotcha: this is not guarded by the "if". */
4400
4401 In the case of mixed tabs and spaces, the warning uses the
4402 -ftabstop= option to determine if the statements line up
4403 (defaulting to 8).
4404
4405 The warning is not issued for code involving multiline preprocessor
4406 logic such as the following example.
4407
4408 if (flagA)
4409 foo (0);
4410 #if SOME_CONDITION_THAT_DOES_NOT_HOLD
4411 if (flagB)
4412 #endif
4413 foo (1);
4414
4415 The warning is not issued after a "#line" directive, since this
4416 typically indicates autogenerated code, and no assumptions can be
4417 made about the layout of the file that the directive references.
4418
4419 This warning is enabled by -Wall in C and C++.
4420
4421 -Wmissing-attributes
4422 Warn when a declaration of a function is missing one or more
4423 attributes that a related function is declared with and whose
4424 absence may adversely affect the correctness or efficiency of
4425 generated code. For example, the warning is issued for
4426 declarations of aliases that use attributes to specify less
4427 restrictive requirements than those of their targets. This
4428 typically represents a potential optimization opportunity. By
4429 contrast, the -Wattribute-alias=2 option controls warnings issued
4430 when the alias is more restrictive than the target, which could
4431 lead to incorrect code generation. Attributes considered include
4432 "alloc_align", "alloc_size", "cold", "const", "hot", "leaf",
4433 "malloc", "nonnull", "noreturn", "nothrow", "pure",
4434 "returns_nonnull", and "returns_twice".
4435
4436 In C++, the warning is issued when an explicit specialization of a
4437 primary template declared with attribute "alloc_align",
4438 "alloc_size", "assume_aligned", "format", "format_arg", "malloc",
4439 or "nonnull" is declared without it. Attributes "deprecated",
4440 "error", and "warning" suppress the warning..
4441
4442 You can use the "copy" attribute to apply the same set of
4443 attributes to a declaration as that on another declaration without
4444 explicitly enumerating the attributes. This attribute can be
4445 applied to declarations of functions, variables, or types.
4446
4447 -Wmissing-attributes is enabled by -Wall.
4448
4449 For example, since the declaration of the primary function template
4450 below makes use of both attribute "malloc" and "alloc_size" the
4451 declaration of the explicit specialization of the template is
4452 diagnosed because it is missing one of the attributes.
4453
4454 template <class T>
4455 T* __attribute__ ((malloc, alloc_size (1)))
4456 allocate (size_t);
4457
4458 template <>
4459 void* __attribute__ ((malloc)) // missing alloc_size
4460 allocate<void> (size_t);
4461
4462 -Wmissing-braces
4463 Warn if an aggregate or union initializer is not fully bracketed.
4464 In the following example, the initializer for "a" is not fully
4465 bracketed, but that for "b" is fully bracketed.
4466
4467 int a[2][2] = { 0, 1, 2, 3 };
4468 int b[2][2] = { { 0, 1 }, { 2, 3 } };
4469
4470 This warning is enabled by -Wall.
4471
4472 -Wmissing-include-dirs (C, C++, Objective-C and Objective-C++ only)
4473 Warn if a user-supplied include directory does not exist.
4474
4475 -Wno-missing-profile
4476 This option controls warnings if feedback profiles are missing when
4477 using the -fprofile-use option. This option diagnoses those cases
4478 where a new function or a new file is added between compiling with
4479 -fprofile-generate and with -fprofile-use, without regenerating the
4480 profiles. In these cases, the profile feedback data files do not
4481 contain any profile feedback information for the newly added
4482 function or file respectively. Also, in the case when profile
4483 count data (.gcda) files are removed, GCC cannot use any profile
4484 feedback information. In all these cases, warnings are issued to
4485 inform you that a profile generation step is due. Ignoring the
4486 warning can result in poorly optimized code. -Wno-missing-profile
4487 can be used to disable the warning, but this is not recommended and
4488 should be done only when non-existent profile data is justified.
4489
4490 -Wmultistatement-macros
4491 Warn about unsafe multiple statement macros that appear to be
4492 guarded by a clause such as "if", "else", "for", "switch", or
4493 "while", in which only the first statement is actually guarded
4494 after the macro is expanded.
4495
4496 For example:
4497
4498 #define DOIT x++; y++
4499 if (c)
4500 DOIT;
4501
4502 will increment "y" unconditionally, not just when "c" holds. The
4503 can usually be fixed by wrapping the macro in a do-while loop:
4504
4505 #define DOIT do { x++; y++; } while (0)
4506 if (c)
4507 DOIT;
4508
4509 This warning is enabled by -Wall in C and C++.
4510
4511 -Wparentheses
4512 Warn if parentheses are omitted in certain contexts, such as when
4513 there is an assignment in a context where a truth value is
4514 expected, or when operators are nested whose precedence people
4515 often get confused about.
4516
4517 Also warn if a comparison like "x<=y<=z" appears; this is
4518 equivalent to "(x<=y ? 1 : 0) <= z", which is a different
4519 interpretation from that of ordinary mathematical notation.
4520
4521 Also warn for dangerous uses of the GNU extension to "?:" with
4522 omitted middle operand. When the condition in the "?": operator is
4523 a boolean expression, the omitted value is always 1. Often
4524 programmers expect it to be a value computed inside the conditional
4525 expression instead.
4526
4527 For C++ this also warns for some cases of unnecessary parentheses
4528 in declarations, which can indicate an attempt at a function call
4529 instead of a declaration:
4530
4531 {
4532 // Declares a local variable called mymutex.
4533 std::unique_lock<std::mutex> (mymutex);
4534 // User meant std::unique_lock<std::mutex> lock (mymutex);
4535 }
4536
4537 This warning is enabled by -Wall.
4538
4539 -Wsequence-point
4540 Warn about code that may have undefined semantics because of
4541 violations of sequence point rules in the C and C++ standards.
4542
4543 The C and C++ standards define the order in which expressions in a
4544 C/C++ program are evaluated in terms of sequence points, which
4545 represent a partial ordering between the execution of parts of the
4546 program: those executed before the sequence point, and those
4547 executed after it. These occur after the evaluation of a full
4548 expression (one which is not part of a larger expression), after
4549 the evaluation of the first operand of a "&&", "||", "? :" or ","
4550 (comma) operator, before a function is called (but after the
4551 evaluation of its arguments and the expression denoting the called
4552 function), and in certain other places. Other than as expressed by
4553 the sequence point rules, the order of evaluation of subexpressions
4554 of an expression is not specified. All these rules describe only a
4555 partial order rather than a total order, since, for example, if two
4556 functions are called within one expression with no sequence point
4557 between them, the order in which the functions are called is not
4558 specified. However, the standards committee have ruled that
4559 function calls do not overlap.
4560
4561 It is not specified when between sequence points modifications to
4562 the values of objects take effect. Programs whose behavior depends
4563 on this have undefined behavior; the C and C++ standards specify
4564 that "Between the previous and next sequence point an object shall
4565 have its stored value modified at most once by the evaluation of an
4566 expression. Furthermore, the prior value shall be read only to
4567 determine the value to be stored.". If a program breaks these
4568 rules, the results on any particular implementation are entirely
4569 unpredictable.
4570
4571 Examples of code with undefined behavior are "a = a++;", "a[n] =
4572 b[n++]" and "a[i++] = i;". Some more complicated cases are not
4573 diagnosed by this option, and it may give an occasional false
4574 positive result, but in general it has been found fairly effective
4575 at detecting this sort of problem in programs.
4576
4577 The C++17 standard will define the order of evaluation of operands
4578 in more cases: in particular it requires that the right-hand side
4579 of an assignment be evaluated before the left-hand side, so the
4580 above examples are no longer undefined. But this option will still
4581 warn about them, to help people avoid writing code that is
4582 undefined in C and earlier revisions of C++.
4583
4584 The standard is worded confusingly, therefore there is some debate
4585 over the precise meaning of the sequence point rules in subtle
4586 cases. Links to discussions of the problem, including proposed
4587 formal definitions, may be found on the GCC readings page, at
4588 <http://gcc.gnu.org/readings.html>.
4589
4590 This warning is enabled by -Wall for C and C++.
4591
4592 -Wno-return-local-addr
4593 Do not warn about returning a pointer (or in C++, a reference) to a
4594 variable that goes out of scope after the function returns.
4595
4596 -Wreturn-type
4597 Warn whenever a function is defined with a return type that
4598 defaults to "int". Also warn about any "return" statement with no
4599 return value in a function whose return type is not "void" (falling
4600 off the end of the function body is considered returning without a
4601 value).
4602
4603 For C only, warn about a "return" statement with an expression in a
4604 function whose return type is "void", unless the expression type is
4605 also "void". As a GNU extension, the latter case is accepted
4606 without a warning unless -Wpedantic is used. Attempting to use the
4607 return value of a non-"void" function other than "main" that flows
4608 off the end by reaching the closing curly brace that terminates the
4609 function is undefined.
4610
4611 Unlike in C, in C++, flowing off the end of a non-"void" function
4612 other than "main" results in undefined behavior even when the value
4613 of the function is not used.
4614
4615 This warning is enabled by default in C++ and by -Wall otherwise.
4616
4617 -Wno-shift-count-negative
4618 Controls warnings if a shift count is negative. This warning is
4619 enabled by default.
4620
4621 -Wno-shift-count-overflow
4622 Controls warnings if a shift count is greater than or equal to the
4623 bit width of the type. This warning is enabled by default.
4624
4625 -Wshift-negative-value
4626 Warn if left shifting a negative value. This warning is enabled by
4627 -Wextra in C99 and C++11 modes (and newer).
4628
4629 -Wno-shift-overflow
4630 -Wshift-overflow=n
4631 These options control warnings about left shift overflows.
4632
4633 -Wshift-overflow=1
4634 This is the warning level of -Wshift-overflow and is enabled by
4635 default in C99 and C++11 modes (and newer). This warning level
4636 does not warn about left-shifting 1 into the sign bit.
4637 (However, in C, such an overflow is still rejected in contexts
4638 where an integer constant expression is required.) No warning
4639 is emitted in C++2A mode (and newer), as signed left shifts
4640 always wrap.
4641
4642 -Wshift-overflow=2
4643 This warning level also warns about left-shifting 1 into the
4644 sign bit, unless C++14 mode (or newer) is active.
4645
4646 -Wswitch
4647 Warn whenever a "switch" statement has an index of enumerated type
4648 and lacks a "case" for one or more of the named codes of that
4649 enumeration. (The presence of a "default" label prevents this
4650 warning.) "case" labels outside the enumeration range also provoke
4651 warnings when this option is used (even if there is a "default"
4652 label). This warning is enabled by -Wall.
4653
4654 -Wswitch-default
4655 Warn whenever a "switch" statement does not have a "default" case.
4656
4657 -Wswitch-enum
4658 Warn whenever a "switch" statement has an index of enumerated type
4659 and lacks a "case" for one or more of the named codes of that
4660 enumeration. "case" labels outside the enumeration range also
4661 provoke warnings when this option is used. The only difference
4662 between -Wswitch and this option is that this option gives a
4663 warning about an omitted enumeration code even if there is a
4664 "default" label.
4665
4666 -Wno-switch-bool
4667 Do not warn when a "switch" statement has an index of boolean type
4668 and the case values are outside the range of a boolean type. It is
4669 possible to suppress this warning by casting the controlling
4670 expression to a type other than "bool". For example:
4671
4672 switch ((int) (a == 4))
4673 {
4674 ...
4675 }
4676
4677 This warning is enabled by default for C and C++ programs.
4678
4679 -Wno-switch-outside-range
4680 This option controls warnings when a "switch" case has a value that
4681 is outside of its respective type range. This warning is enabled
4682 by default for C and C++ programs.
4683
4684 -Wno-switch-unreachable
4685 Do not warn when a "switch" statement contains statements between
4686 the controlling expression and the first case label, which will
4687 never be executed. For example:
4688
4689 switch (cond)
4690 {
4691 i = 15;
4692 ...
4693 case 5:
4694 ...
4695 }
4696
4697 -Wswitch-unreachable does not warn if the statement between the
4698 controlling expression and the first case label is just a
4699 declaration:
4700
4701 switch (cond)
4702 {
4703 int i;
4704 ...
4705 case 5:
4706 i = 5;
4707 ...
4708 }
4709
4710 This warning is enabled by default for C and C++ programs.
4711
4712 -Wsync-nand (C and C++ only)
4713 Warn when "__sync_fetch_and_nand" and "__sync_nand_and_fetch"
4714 built-in functions are used. These functions changed semantics in
4715 GCC 4.4.
4716
4717 -Wunused-but-set-parameter
4718 Warn whenever a function parameter is assigned to, but otherwise
4719 unused (aside from its declaration).
4720
4721 To suppress this warning use the "unused" attribute.
4722
4723 This warning is also enabled by -Wunused together with -Wextra.
4724
4725 -Wunused-but-set-variable
4726 Warn whenever a local variable is assigned to, but otherwise unused
4727 (aside from its declaration). This warning is enabled by -Wall.
4728
4729 To suppress this warning use the "unused" attribute.
4730
4731 This warning is also enabled by -Wunused, which is enabled by
4732 -Wall.
4733
4734 -Wunused-function
4735 Warn whenever a static function is declared but not defined or a
4736 non-inline static function is unused. This warning is enabled by
4737 -Wall.
4738
4739 -Wunused-label
4740 Warn whenever a label is declared but not used. This warning is
4741 enabled by -Wall.
4742
4743 To suppress this warning use the "unused" attribute.
4744
4745 -Wunused-local-typedefs (C, Objective-C, C++ and Objective-C++ only)
4746 Warn when a typedef locally defined in a function is not used.
4747 This warning is enabled by -Wall.
4748
4749 -Wunused-parameter
4750 Warn whenever a function parameter is unused aside from its
4751 declaration.
4752
4753 To suppress this warning use the "unused" attribute.
4754
4755 -Wno-unused-result
4756 Do not warn if a caller of a function marked with attribute
4757 "warn_unused_result" does not use its return value. The default is
4758 -Wunused-result.
4759
4760 -Wunused-variable
4761 Warn whenever a local or static variable is unused aside from its
4762 declaration. This option implies -Wunused-const-variable=1 for C,
4763 but not for C++. This warning is enabled by -Wall.
4764
4765 To suppress this warning use the "unused" attribute.
4766
4767 -Wunused-const-variable
4768 -Wunused-const-variable=n
4769 Warn whenever a constant static variable is unused aside from its
4770 declaration. -Wunused-const-variable=1 is enabled by
4771 -Wunused-variable for C, but not for C++. In C this declares
4772 variable storage, but in C++ this is not an error since const
4773 variables take the place of "#define"s.
4774
4775 To suppress this warning use the "unused" attribute.
4776
4777 -Wunused-const-variable=1
4778 This is the warning level that is enabled by -Wunused-variable
4779 for C. It warns only about unused static const variables
4780 defined in the main compilation unit, but not about static
4781 const variables declared in any header included.
4782
4783 -Wunused-const-variable=2
4784 This warning level also warns for unused constant static
4785 variables in headers (excluding system headers). This is the
4786 warning level of -Wunused-const-variable and must be explicitly
4787 requested since in C++ this isn't an error and in C it might be
4788 harder to clean up all headers included.
4789
4790 -Wunused-value
4791 Warn whenever a statement computes a result that is explicitly not
4792 used. To suppress this warning cast the unused expression to
4793 "void". This includes an expression-statement or the left-hand side
4794 of a comma expression that contains no side effects. For example,
4795 an expression such as "x[i,j]" causes a warning, while
4796 "x[(void)i,j]" does not.
4797
4798 This warning is enabled by -Wall.
4799
4800 -Wunused
4801 All the above -Wunused options combined.
4802
4803 In order to get a warning about an unused function parameter, you
4804 must either specify -Wextra -Wunused (note that -Wall implies
4805 -Wunused), or separately specify -Wunused-parameter.
4806
4807 -Wuninitialized
4808 Warn if an automatic variable is used without first being
4809 initialized. In C++, warn if a non-static reference or non-static
4810 "const" member appears in a class without constructors.
4811
4812 If you want to warn about code that uses the uninitialized value of
4813 the variable in its own initializer, use the -Winit-self option.
4814
4815 These warnings occur for individual uninitialized elements of
4816 structure, union or array variables as well as for variables that
4817 are uninitialized as a whole. They do not occur for variables or
4818 elements declared "volatile". Because these warnings depend on
4819 optimization, the exact variables or elements for which there are
4820 warnings depend on the precise optimization options and version of
4821 GCC used.
4822
4823 Note that there may be no warning about a variable that is used
4824 only to compute a value that itself is never used, because such
4825 computations may be deleted by data flow analysis before the
4826 warnings are printed.
4827
4828 -Wno-invalid-memory-model
4829 This option controls warnings for invocations of __atomic Builtins,
4830 __sync Builtins, and the C11 atomic generic functions with a memory
4831 consistency argument that is either invalid for the operation or
4832 outside the range of values of the "memory_order" enumeration. For
4833 example, since the "__atomic_store" and "__atomic_store_n" built-
4834 ins are only defined for the relaxed, release, and sequentially
4835 consistent memory orders the following code is diagnosed:
4836
4837 void store (int *i)
4838 {
4839 __atomic_store_n (i, 0, memory_order_consume);
4840 }
4841
4842 -Winvalid-memory-model is enabled by default.
4843
4844 -Wmaybe-uninitialized
4845 For an automatic (i.e. local) variable, if there exists a path from
4846 the function entry to a use of the variable that is initialized,
4847 but there exist some other paths for which the variable is not
4848 initialized, the compiler emits a warning if it cannot prove the
4849 uninitialized paths are not executed at run time.
4850
4851 These warnings are only possible in optimizing compilation, because
4852 otherwise GCC does not keep track of the state of variables.
4853
4854 These warnings are made optional because GCC may not be able to
4855 determine when the code is correct in spite of appearing to have an
4856 error. Here is one example of how this can happen:
4857
4858 {
4859 int x;
4860 switch (y)
4861 {
4862 case 1: x = 1;
4863 break;
4864 case 2: x = 4;
4865 break;
4866 case 3: x = 5;
4867 }
4868 foo (x);
4869 }
4870
4871 If the value of "y" is always 1, 2 or 3, then "x" is always
4872 initialized, but GCC doesn't know this. To suppress the warning,
4873 you need to provide a default case with assert(0) or similar code.
4874
4875 This option also warns when a non-volatile automatic variable might
4876 be changed by a call to "longjmp". The compiler sees only the
4877 calls to "setjmp". It cannot know where "longjmp" will be called;
4878 in fact, a signal handler could call it at any point in the code.
4879 As a result, you may get a warning even when there is in fact no
4880 problem because "longjmp" cannot in fact be called at the place
4881 that would cause a problem.
4882
4883 Some spurious warnings can be avoided if you declare all the
4884 functions you use that never return as "noreturn".
4885
4886 This warning is enabled by -Wall or -Wextra.
4887
4888 -Wunknown-pragmas
4889 Warn when a "#pragma" directive is encountered that is not
4890 understood by GCC. If this command-line option is used, warnings
4891 are even issued for unknown pragmas in system header files. This
4892 is not the case if the warnings are only enabled by the -Wall
4893 command-line option.
4894
4895 -Wno-pragmas
4896 Do not warn about misuses of pragmas, such as incorrect parameters,
4897 invalid syntax, or conflicts between pragmas. See also
4898 -Wunknown-pragmas.
4899
4900 -Wno-prio-ctor-dtor
4901 Do not warn if a priority from 0 to 100 is used for constructor or
4902 destructor. The use of constructor and destructor attributes allow
4903 you to assign a priority to the constructor/destructor to control
4904 its order of execution before "main" is called or after it returns.
4905 The priority values must be greater than 100 as the compiler
4906 reserves priority values between 0--100 for the implementation.
4907
4908 -Wstrict-aliasing
4909 This option is only active when -fstrict-aliasing is active. It
4910 warns about code that might break the strict aliasing rules that
4911 the compiler is using for optimization. The warning does not catch
4912 all cases, but does attempt to catch the more common pitfalls. It
4913 is included in -Wall. It is equivalent to -Wstrict-aliasing=3
4914
4915 -Wstrict-aliasing=n
4916 This option is only active when -fstrict-aliasing is active. It
4917 warns about code that might break the strict aliasing rules that
4918 the compiler is using for optimization. Higher levels correspond
4919 to higher accuracy (fewer false positives). Higher levels also
4920 correspond to more effort, similar to the way -O works.
4921 -Wstrict-aliasing is equivalent to -Wstrict-aliasing=3.
4922
4923 Level 1: Most aggressive, quick, least accurate. Possibly useful
4924 when higher levels do not warn but -fstrict-aliasing still breaks
4925 the code, as it has very few false negatives. However, it has many
4926 false positives. Warns for all pointer conversions between
4927 possibly incompatible types, even if never dereferenced. Runs in
4928 the front end only.
4929
4930 Level 2: Aggressive, quick, not too precise. May still have many
4931 false positives (not as many as level 1 though), and few false
4932 negatives (but possibly more than level 1). Unlike level 1, it
4933 only warns when an address is taken. Warns about incomplete types.
4934 Runs in the front end only.
4935
4936 Level 3 (default for -Wstrict-aliasing): Should have very few false
4937 positives and few false negatives. Slightly slower than levels 1
4938 or 2 when optimization is enabled. Takes care of the common
4939 pun+dereference pattern in the front end: "*(int*)&some_float". If
4940 optimization is enabled, it also runs in the back end, where it
4941 deals with multiple statement cases using flow-sensitive points-to
4942 information. Only warns when the converted pointer is
4943 dereferenced. Does not warn about incomplete types.
4944
4945 -Wstrict-overflow
4946 -Wstrict-overflow=n
4947 This option is only active when signed overflow is undefined. It
4948 warns about cases where the compiler optimizes based on the
4949 assumption that signed overflow does not occur. Note that it does
4950 not warn about all cases where the code might overflow: it only
4951 warns about cases where the compiler implements some optimization.
4952 Thus this warning depends on the optimization level.
4953
4954 An optimization that assumes that signed overflow does not occur is
4955 perfectly safe if the values of the variables involved are such
4956 that overflow never does, in fact, occur. Therefore this warning
4957 can easily give a false positive: a warning about code that is not
4958 actually a problem. To help focus on important issues, several
4959 warning levels are defined. No warnings are issued for the use of
4960 undefined signed overflow when estimating how many iterations a
4961 loop requires, in particular when determining whether a loop will
4962 be executed at all.
4963
4964 -Wstrict-overflow=1
4965 Warn about cases that are both questionable and easy to avoid.
4966 For example the compiler simplifies "x + 1 > x" to 1. This
4967 level of -Wstrict-overflow is enabled by -Wall; higher levels
4968 are not, and must be explicitly requested.
4969
4970 -Wstrict-overflow=2
4971 Also warn about other cases where a comparison is simplified to
4972 a constant. For example: "abs (x) >= 0". This can only be
4973 simplified when signed integer overflow is undefined, because
4974 "abs (INT_MIN)" overflows to "INT_MIN", which is less than
4975 zero. -Wstrict-overflow (with no level) is the same as
4976 -Wstrict-overflow=2.
4977
4978 -Wstrict-overflow=3
4979 Also warn about other cases where a comparison is simplified.
4980 For example: "x + 1 > 1" is simplified to "x > 0".
4981
4982 -Wstrict-overflow=4
4983 Also warn about other simplifications not covered by the above
4984 cases. For example: "(x * 10) / 5" is simplified to "x * 2".
4985
4986 -Wstrict-overflow=5
4987 Also warn about cases where the compiler reduces the magnitude
4988 of a constant involved in a comparison. For example: "x + 2 >
4989 y" is simplified to "x + 1 >= y". This is reported only at the
4990 highest warning level because this simplification applies to
4991 many comparisons, so this warning level gives a very large
4992 number of false positives.
4993
4994 -Wstring-compare
4995 Warn for calls to "strcmp" and "strncmp" whose result is determined
4996 to be either zero or non-zero in tests for such equality owing to
4997 the length of one argument being greater than the size of the array
4998 the other argument is stored in (or the bound in the case of
4999 "strncmp"). Such calls could be mistakes. For example, the call
5000 to "strcmp" below is diagnosed because its result is necessarily
5001 non-zero irrespective of the contents of the array "a".
5002
5003 extern char a[4];
5004 void f (char *d)
5005 {
5006 strcpy (d, "string");
5007 ...
5008 if (0 == strcmp (a, d)) // cannot be true
5009 puts ("a and d are the same");
5010 }
5011
5012 -Wstring-compare is enabled by -Wextra.
5013
5014 -Wstringop-overflow
5015 -Wstringop-overflow=type
5016 Warn for calls to string manipulation functions such as "memcpy"
5017 and "strcpy" that are determined to overflow the destination
5018 buffer. The optional argument is one greater than the type of
5019 Object Size Checking to perform to determine the size of the
5020 destination. The argument is meaningful only for functions that
5021 operate on character arrays but not for raw memory functions like
5022 "memcpy" which always make use of Object Size type-0. The option
5023 also warns for calls that specify a size in excess of the largest
5024 possible object or at most "SIZE_MAX / 2" bytes. The option
5025 produces the best results with optimization enabled but can detect
5026 a small subset of simple buffer overflows even without optimization
5027 in calls to the GCC built-in functions like "__builtin_memcpy" that
5028 correspond to the standard functions. In any case, the option
5029 warns about just a subset of buffer overflows detected by the
5030 corresponding overflow checking built-ins. For example, the option
5031 issues a warning for the "strcpy" call below because it copies at
5032 least 5 characters (the string "blue" including the terminating
5033 NUL) into the buffer of size 4.
5034
5035 enum Color { blue, purple, yellow };
5036 const char* f (enum Color clr)
5037 {
5038 static char buf [4];
5039 const char *str;
5040 switch (clr)
5041 {
5042 case blue: str = "blue"; break;
5043 case purple: str = "purple"; break;
5044 case yellow: str = "yellow"; break;
5045 }
5046
5047 return strcpy (buf, str); // warning here
5048 }
5049
5050 Option -Wstringop-overflow=2 is enabled by default.
5051
5052 -Wstringop-overflow
5053 -Wstringop-overflow=1
5054 The -Wstringop-overflow=1 option uses type-zero Object Size
5055 Checking to determine the sizes of destination objects. This
5056 is the default setting of the option. At this setting the
5057 option does not warn for writes past the end of subobjects of
5058 larger objects accessed by pointers unless the size of the
5059 largest surrounding object is known. When the destination may
5060 be one of several objects it is assumed to be the largest one
5061 of them. On Linux systems, when optimization is enabled at
5062 this setting the option warns for the same code as when the
5063 "_FORTIFY_SOURCE" macro is defined to a non-zero value.
5064
5065 -Wstringop-overflow=2
5066 The -Wstringop-overflow=2 option uses type-one Object Size
5067 Checking to determine the sizes of destination objects. At
5068 this setting the option warna about overflows when writing to
5069 members of the largest complete objects whose exact size is
5070 known. However, it does not warn for excessive writes to the
5071 same members of unknown objects referenced by pointers since
5072 they may point to arrays containing unknown numbers of
5073 elements.
5074
5075 -Wstringop-overflow=3
5076 The -Wstringop-overflow=3 option uses type-two Object Size
5077 Checking to determine the sizes of destination objects. At
5078 this setting the option warns about overflowing the smallest
5079 object or data member. This is the most restrictive setting of
5080 the option that may result in warnings for safe code.
5081
5082 -Wstringop-overflow=4
5083 The -Wstringop-overflow=4 option uses type-three Object Size
5084 Checking to determine the sizes of destination objects. At
5085 this setting the option warns about overflowing any data
5086 members, and when the destination is one of several objects it
5087 uses the size of the largest of them to decide whether to issue
5088 a warning. Similarly to -Wstringop-overflow=3 this setting of
5089 the option may result in warnings for benign code.
5090
5091 -Wno-stringop-truncation
5092 Do not warn for calls to bounded string manipulation functions such
5093 as "strncat", "strncpy", and "stpncpy" that may either truncate the
5094 copied string or leave the destination unchanged.
5095
5096 In the following example, the call to "strncat" specifies a bound
5097 that is less than the length of the source string. As a result,
5098 the copy of the source will be truncated and so the call is
5099 diagnosed. To avoid the warning use "bufsize - strlen (buf) - 1)"
5100 as the bound.
5101
5102 void append (char *buf, size_t bufsize)
5103 {
5104 strncat (buf, ".txt", 3);
5105 }
5106
5107 As another example, the following call to "strncpy" results in
5108 copying to "d" just the characters preceding the terminating NUL,
5109 without appending the NUL to the end. Assuming the result of
5110 "strncpy" is necessarily a NUL-terminated string is a common
5111 mistake, and so the call is diagnosed. To avoid the warning when
5112 the result is not expected to be NUL-terminated, call "memcpy"
5113 instead.
5114
5115 void copy (char *d, const char *s)
5116 {
5117 strncpy (d, s, strlen (s));
5118 }
5119
5120 In the following example, the call to "strncpy" specifies the size
5121 of the destination buffer as the bound. If the length of the
5122 source string is equal to or greater than this size the result of
5123 the copy will not be NUL-terminated. Therefore, the call is also
5124 diagnosed. To avoid the warning, specify "sizeof buf - 1" as the
5125 bound and set the last element of the buffer to "NUL".
5126
5127 void copy (const char *s)
5128 {
5129 char buf[80];
5130 strncpy (buf, s, sizeof buf);
5131 ...
5132 }
5133
5134 In situations where a character array is intended to store a
5135 sequence of bytes with no terminating "NUL" such an array may be
5136 annotated with attribute "nonstring" to avoid this warning. Such
5137 arrays, however, are not suitable arguments to functions that
5138 expect "NUL"-terminated strings. To help detect accidental misuses
5139 of such arrays GCC issues warnings unless it can prove that the use
5140 is safe.
5141
5142 -Wsuggest-attribute=[pure|const|noreturn|format|cold|malloc]
5143 Warn for cases where adding an attribute may be beneficial. The
5144 attributes currently supported are listed below.
5145
5146 -Wsuggest-attribute=pure
5147 -Wsuggest-attribute=const
5148 -Wsuggest-attribute=noreturn
5149 -Wmissing-noreturn
5150 -Wsuggest-attribute=malloc
5151 Warn about functions that might be candidates for attributes
5152 "pure", "const" or "noreturn" or "malloc". The compiler only
5153 warns for functions visible in other compilation units or (in
5154 the case of "pure" and "const") if it cannot prove that the
5155 function returns normally. A function returns normally if it
5156 doesn't contain an infinite loop or return abnormally by
5157 throwing, calling "abort" or trapping. This analysis requires
5158 option -fipa-pure-const, which is enabled by default at -O and
5159 higher. Higher optimization levels improve the accuracy of the
5160 analysis.
5161
5162 -Wsuggest-attribute=format
5163 -Wmissing-format-attribute
5164 Warn about function pointers that might be candidates for
5165 "format" attributes. Note these are only possible candidates,
5166 not absolute ones. GCC guesses that function pointers with
5167 "format" attributes that are used in assignment,
5168 initialization, parameter passing or return statements should
5169 have a corresponding "format" attribute in the resulting type.
5170 I.e. the left-hand side of the assignment or initialization,
5171 the type of the parameter variable, or the return type of the
5172 containing function respectively should also have a "format"
5173 attribute to avoid the warning.
5174
5175 GCC also warns about function definitions that might be
5176 candidates for "format" attributes. Again, these are only
5177 possible candidates. GCC guesses that "format" attributes
5178 might be appropriate for any function that calls a function
5179 like "vprintf" or "vscanf", but this might not always be the
5180 case, and some functions for which "format" attributes are
5181 appropriate may not be detected.
5182
5183 -Wsuggest-attribute=cold
5184 Warn about functions that might be candidates for "cold"
5185 attribute. This is based on static detection and generally
5186 only warns about functions which always leads to a call to
5187 another "cold" function such as wrappers of C++ "throw" or
5188 fatal error reporting functions leading to "abort".
5189
5190 -Walloc-zero
5191 Warn about calls to allocation functions decorated with attribute
5192 "alloc_size" that specify zero bytes, including those to the built-
5193 in forms of the functions "aligned_alloc", "alloca", "calloc",
5194 "malloc", and "realloc". Because the behavior of these functions
5195 when called with a zero size differs among implementations (and in
5196 the case of "realloc" has been deprecated) relying on it may result
5197 in subtle portability bugs and should be avoided.
5198
5199 -Walloc-size-larger-than=byte-size
5200 Warn about calls to functions decorated with attribute "alloc_size"
5201 that attempt to allocate objects larger than the specified number
5202 of bytes, or where the result of the size computation in an integer
5203 type with infinite precision would exceed the value of PTRDIFF_MAX
5204 on the target. -Walloc-size-larger-than=PTRDIFF_MAX is enabled by
5205 default. Warnings controlled by the option can be disabled either
5206 by specifying byte-size of SIZE_MAX or more or by
5207 -Wno-alloc-size-larger-than.
5208
5209 -Wno-alloc-size-larger-than
5210 Disable -Walloc-size-larger-than= warnings. The option is
5211 equivalent to -Walloc-size-larger-than=SIZE_MAX or larger.
5212
5213 -Walloca
5214 This option warns on all uses of "alloca" in the source.
5215
5216 -Walloca-larger-than=byte-size
5217 This option warns on calls to "alloca" with an integer argument
5218 whose value is either zero, or that is not bounded by a controlling
5219 predicate that limits its value to at most byte-size. It also
5220 warns for calls to "alloca" where the bound value is unknown.
5221 Arguments of non-integer types are considered unbounded even if
5222 they appear to be constrained to the expected range.
5223
5224 For example, a bounded case of "alloca" could be:
5225
5226 void func (size_t n)
5227 {
5228 void *p;
5229 if (n <= 1000)
5230 p = alloca (n);
5231 else
5232 p = malloc (n);
5233 f (p);
5234 }
5235
5236 In the above example, passing "-Walloca-larger-than=1000" would not
5237 issue a warning because the call to "alloca" is known to be at most
5238 1000 bytes. However, if "-Walloca-larger-than=500" were passed,
5239 the compiler would emit a warning.
5240
5241 Unbounded uses, on the other hand, are uses of "alloca" with no
5242 controlling predicate constraining its integer argument. For
5243 example:
5244
5245 void func ()
5246 {
5247 void *p = alloca (n);
5248 f (p);
5249 }
5250
5251 If "-Walloca-larger-than=500" were passed, the above would trigger
5252 a warning, but this time because of the lack of bounds checking.
5253
5254 Note, that even seemingly correct code involving signed integers
5255 could cause a warning:
5256
5257 void func (signed int n)
5258 {
5259 if (n < 500)
5260 {
5261 p = alloca (n);
5262 f (p);
5263 }
5264 }
5265
5266 In the above example, n could be negative, causing a larger than
5267 expected argument to be implicitly cast into the "alloca" call.
5268
5269 This option also warns when "alloca" is used in a loop.
5270
5271 -Walloca-larger-than=PTRDIFF_MAX is enabled by default but is
5272 usually only effective when -ftree-vrp is active (default for -O2
5273 and above).
5274
5275 See also -Wvla-larger-than=byte-size.
5276
5277 -Wno-alloca-larger-than
5278 Disable -Walloca-larger-than= warnings. The option is equivalent
5279 to -Walloca-larger-than=SIZE_MAX or larger.
5280
5281 -Warith-conversion
5282 Do warn about implicit conversions from arithmetic operations even
5283 when conversion of the operands to the same type cannot change
5284 their values. This affects warnings from -Wconversion,
5285 -Wfloat-conversion, and -Wsign-conversion.
5286
5287 void f (char c, int i)
5288 {
5289 c = c + i; // warns with B<-Wconversion>
5290 c = c + 1; // only warns with B<-Warith-conversion>
5291 }
5292
5293 -Warray-bounds
5294 -Warray-bounds=n
5295 This option is only active when -ftree-vrp is active (default for
5296 -O2 and above). It warns about subscripts to arrays that are always
5297 out of bounds. This warning is enabled by -Wall.
5298
5299 -Warray-bounds=1
5300 This is the warning level of -Warray-bounds and is enabled by
5301 -Wall; higher levels are not, and must be explicitly requested.
5302
5303 -Warray-bounds=2
5304 This warning level also warns about out of bounds access for
5305 arrays at the end of a struct and for arrays accessed through
5306 pointers. This warning level may give a larger number of false
5307 positives and is deactivated by default.
5308
5309 -Wattribute-alias=n
5310 -Wno-attribute-alias
5311 Warn about declarations using the "alias" and similar attributes
5312 whose target is incompatible with the type of the alias.
5313
5314 -Wattribute-alias=1
5315 The default warning level of the -Wattribute-alias option
5316 diagnoses incompatibilities between the type of the alias
5317 declaration and that of its target. Such incompatibilities are
5318 typically indicative of bugs.
5319
5320 -Wattribute-alias=2
5321 At this level -Wattribute-alias also diagnoses cases where the
5322 attributes of the alias declaration are more restrictive than
5323 the attributes applied to its target. These mismatches can
5324 potentially result in incorrect code generation. In other
5325 cases they may be benign and could be resolved simply by adding
5326 the missing attribute to the target. For comparison, see the
5327 -Wmissing-attributes option, which controls diagnostics when
5328 the alias declaration is less restrictive than the target,
5329 rather than more restrictive.
5330
5331 Attributes considered include "alloc_align", "alloc_size",
5332 "cold", "const", "hot", "leaf", "malloc", "nonnull",
5333 "noreturn", "nothrow", "pure", "returns_nonnull", and
5334 "returns_twice".
5335
5336 -Wattribute-alias is equivalent to -Wattribute-alias=1. This is
5337 the default. You can disable these warnings with either
5338 -Wno-attribute-alias or -Wattribute-alias=0.
5339
5340 -Wbool-compare
5341 Warn about boolean expression compared with an integer value
5342 different from "true"/"false". For instance, the following
5343 comparison is always false:
5344
5345 int n = 5;
5346 ...
5347 if ((n > 1) == 2) { ... }
5348
5349 This warning is enabled by -Wall.
5350
5351 -Wbool-operation
5352 Warn about suspicious operations on expressions of a boolean type.
5353 For instance, bitwise negation of a boolean is very likely a bug in
5354 the program. For C, this warning also warns about incrementing or
5355 decrementing a boolean, which rarely makes sense. (In C++,
5356 decrementing a boolean is always invalid. Incrementing a boolean
5357 is invalid in C++17, and deprecated otherwise.)
5358
5359 This warning is enabled by -Wall.
5360
5361 -Wduplicated-branches
5362 Warn when an if-else has identical branches. This warning detects
5363 cases like
5364
5365 if (p != NULL)
5366 return 0;
5367 else
5368 return 0;
5369
5370 It doesn't warn when both branches contain just a null statement.
5371 This warning also warn for conditional operators:
5372
5373 int i = x ? *p : *p;
5374
5375 -Wduplicated-cond
5376 Warn about duplicated conditions in an if-else-if chain. For
5377 instance, warn for the following code:
5378
5379 if (p->q != NULL) { ... }
5380 else if (p->q != NULL) { ... }
5381
5382 -Wframe-address
5383 Warn when the __builtin_frame_address or __builtin_return_address
5384 is called with an argument greater than 0. Such calls may return
5385 indeterminate values or crash the program. The warning is included
5386 in -Wall.
5387
5388 -Wno-discarded-qualifiers (C and Objective-C only)
5389 Do not warn if type qualifiers on pointers are being discarded.
5390 Typically, the compiler warns if a "const char *" variable is
5391 passed to a function that takes a "char *" parameter. This option
5392 can be used to suppress such a warning.
5393
5394 -Wno-discarded-array-qualifiers (C and Objective-C only)
5395 Do not warn if type qualifiers on arrays which are pointer targets
5396 are being discarded. Typically, the compiler warns if a "const int
5397 (*)[]" variable is passed to a function that takes a "int (*)[]"
5398 parameter. This option can be used to suppress such a warning.
5399
5400 -Wno-incompatible-pointer-types (C and Objective-C only)
5401 Do not warn when there is a conversion between pointers that have
5402 incompatible types. This warning is for cases not covered by
5403 -Wno-pointer-sign, which warns for pointer argument passing or
5404 assignment with different signedness.
5405
5406 -Wno-int-conversion (C and Objective-C only)
5407 Do not warn about incompatible integer to pointer and pointer to
5408 integer conversions. This warning is about implicit conversions;
5409 for explicit conversions the warnings -Wno-int-to-pointer-cast and
5410 -Wno-pointer-to-int-cast may be used.
5411
5412 -Wzero-length-bounds
5413 Warn about accesses to elements of zero-length array members that
5414 might overlap other members of the same object. Declaring interior
5415 zero-length arrays is discouraged because accesses to them are
5416 undefined. See
5417
5418 For example, the first two stores in function "bad" are diagnosed
5419 because the array elements overlap the subsequent members "b" and
5420 "c". The third store is diagnosed by -Warray-bounds because it is
5421 beyond the bounds of the enclosing object.
5422
5423 struct X { int a[0]; int b, c; };
5424 struct X x;
5425
5426 void bad (void)
5427 {
5428 x.a[0] = 0; // -Wzero-length-bounds
5429 x.a[1] = 1; // -Wzero-length-bounds
5430 x.a[2] = 2; // -Warray-bounds
5431 }
5432
5433 Option -Wzero-length-bounds is enabled by -Warray-bounds.
5434
5435 -Wno-div-by-zero
5436 Do not warn about compile-time integer division by zero. Floating-
5437 point division by zero is not warned about, as it can be a
5438 legitimate way of obtaining infinities and NaNs.
5439
5440 -Wsystem-headers
5441 Print warning messages for constructs found in system header files.
5442 Warnings from system headers are normally suppressed, on the
5443 assumption that they usually do not indicate real problems and
5444 would only make the compiler output harder to read. Using this
5445 command-line option tells GCC to emit warnings from system headers
5446 as if they occurred in user code. However, note that using -Wall
5447 in conjunction with this option does not warn about unknown pragmas
5448 in system headers---for that, -Wunknown-pragmas must also be used.
5449
5450 -Wtautological-compare
5451 Warn if a self-comparison always evaluates to true or false. This
5452 warning detects various mistakes such as:
5453
5454 int i = 1;
5455 ...
5456 if (i > i) { ... }
5457
5458 This warning also warns about bitwise comparisons that always
5459 evaluate to true or false, for instance:
5460
5461 if ((a & 16) == 10) { ... }
5462
5463 will always be false.
5464
5465 This warning is enabled by -Wall.
5466
5467 -Wtrampolines
5468 Warn about trampolines generated for pointers to nested functions.
5469 A trampoline is a small piece of data or code that is created at
5470 run time on the stack when the address of a nested function is
5471 taken, and is used to call the nested function indirectly. For
5472 some targets, it is made up of data only and thus requires no
5473 special treatment. But, for most targets, it is made up of code
5474 and thus requires the stack to be made executable in order for the
5475 program to work properly.
5476
5477 -Wfloat-equal
5478 Warn if floating-point values are used in equality comparisons.
5479
5480 The idea behind this is that sometimes it is convenient (for the
5481 programmer) to consider floating-point values as approximations to
5482 infinitely precise real numbers. If you are doing this, then you
5483 need to compute (by analyzing the code, or in some other way) the
5484 maximum or likely maximum error that the computation introduces,
5485 and allow for it when performing comparisons (and when producing
5486 output, but that's a different problem). In particular, instead of
5487 testing for equality, you should check to see whether the two
5488 values have ranges that overlap; and this is done with the
5489 relational operators, so equality comparisons are probably
5490 mistaken.
5491
5492 -Wtraditional (C and Objective-C only)
5493 Warn about certain constructs that behave differently in
5494 traditional and ISO C. Also warn about ISO C constructs that have
5495 no traditional C equivalent, and/or problematic constructs that
5496 should be avoided.
5497
5498 * Macro parameters that appear within string literals in the
5499 macro body. In traditional C macro replacement takes place
5500 within string literals, but in ISO C it does not.
5501
5502 * In traditional C, some preprocessor directives did not exist.
5503 Traditional preprocessors only considered a line to be a
5504 directive if the # appeared in column 1 on the line. Therefore
5505 -Wtraditional warns about directives that traditional C
5506 understands but ignores because the # does not appear as the
5507 first character on the line. It also suggests you hide
5508 directives like "#pragma" not understood by traditional C by
5509 indenting them. Some traditional implementations do not
5510 recognize "#elif", so this option suggests avoiding it
5511 altogether.
5512
5513 * A function-like macro that appears without arguments.
5514
5515 * The unary plus operator.
5516
5517 * The U integer constant suffix, or the F or L floating-point
5518 constant suffixes. (Traditional C does support the L suffix on
5519 integer constants.) Note, these suffixes appear in macros
5520 defined in the system headers of most modern systems, e.g. the
5521 _MIN/_MAX macros in "<limits.h>". Use of these macros in user
5522 code might normally lead to spurious warnings, however GCC's
5523 integrated preprocessor has enough context to avoid warning in
5524 these cases.
5525
5526 * A function declared external in one block and then used after
5527 the end of the block.
5528
5529 * A "switch" statement has an operand of type "long".
5530
5531 * A non-"static" function declaration follows a "static" one.
5532 This construct is not accepted by some traditional C compilers.
5533
5534 * The ISO type of an integer constant has a different width or
5535 signedness from its traditional type. This warning is only
5536 issued if the base of the constant is ten. I.e. hexadecimal or
5537 octal values, which typically represent bit patterns, are not
5538 warned about.
5539
5540 * Usage of ISO string concatenation is detected.
5541
5542 * Initialization of automatic aggregates.
5543
5544 * Identifier conflicts with labels. Traditional C lacks a
5545 separate namespace for labels.
5546
5547 * Initialization of unions. If the initializer is zero, the
5548 warning is omitted. This is done under the assumption that the
5549 zero initializer in user code appears conditioned on e.g.
5550 "__STDC__" to avoid missing initializer warnings and relies on
5551 default initialization to zero in the traditional C case.
5552
5553 * Conversions by prototypes between fixed/floating-point values
5554 and vice versa. The absence of these prototypes when compiling
5555 with traditional C causes serious problems. This is a subset
5556 of the possible conversion warnings; for the full set use
5557 -Wtraditional-conversion.
5558
5559 * Use of ISO C style function definitions. This warning
5560 intentionally is not issued for prototype declarations or
5561 variadic functions because these ISO C features appear in your
5562 code when using libiberty's traditional C compatibility macros,
5563 "PARAMS" and "VPARAMS". This warning is also bypassed for
5564 nested functions because that feature is already a GCC
5565 extension and thus not relevant to traditional C compatibility.
5566
5567 -Wtraditional-conversion (C and Objective-C only)
5568 Warn if a prototype causes a type conversion that is different from
5569 what would happen to the same argument in the absence of a
5570 prototype. This includes conversions of fixed point to floating
5571 and vice versa, and conversions changing the width or signedness of
5572 a fixed-point argument except when the same as the default
5573 promotion.
5574
5575 -Wdeclaration-after-statement (C and Objective-C only)
5576 Warn when a declaration is found after a statement in a block.
5577 This construct, known from C++, was introduced with ISO C99 and is
5578 by default allowed in GCC. It is not supported by ISO C90.
5579
5580 -Wshadow
5581 Warn whenever a local variable or type declaration shadows another
5582 variable, parameter, type, class member (in C++), or instance
5583 variable (in Objective-C) or whenever a built-in function is
5584 shadowed. Note that in C++, the compiler warns if a local variable
5585 shadows an explicit typedef, but not if it shadows a
5586 struct/class/enum. If this warning is enabled, it includes also
5587 all instances of local shadowing. This means that
5588 -Wno-shadow=local and -Wno-shadow=compatible-local are ignored when
5589 -Wshadow is used. Same as -Wshadow=global.
5590
5591 -Wno-shadow-ivar (Objective-C only)
5592 Do not warn whenever a local variable shadows an instance variable
5593 in an Objective-C method.
5594
5595 -Wshadow=global
5596 Warn for any shadowing. Same as -Wshadow.
5597
5598 -Wshadow=local
5599 Warn when a local variable shadows another local variable or
5600 parameter.
5601
5602 -Wshadow=compatible-local
5603 Warn when a local variable shadows another local variable or
5604 parameter whose type is compatible with that of the shadowing
5605 variable. In C++, type compatibility here means the type of the
5606 shadowing variable can be converted to that of the shadowed
5607 variable. The creation of this flag (in addition to
5608 -Wshadow=local) is based on the idea that when a local variable
5609 shadows another one of incompatible type, it is most likely
5610 intentional, not a bug or typo, as shown in the following example:
5611
5612 for (SomeIterator i = SomeObj.begin(); i != SomeObj.end(); ++i)
5613 {
5614 for (int i = 0; i < N; ++i)
5615 {
5616 ...
5617 }
5618 ...
5619 }
5620
5621 Since the two variable "i" in the example above have incompatible
5622 types, enabling only -Wshadow=compatible-local does not emit a
5623 warning. Because their types are incompatible, if a programmer
5624 accidentally uses one in place of the other, type checking is
5625 expected to catch that and emit an error or warning. Use of this
5626 flag instead of -Wshadow=local can possibly reduce the number of
5627 warnings triggered by intentional shadowing. Note that this also
5628 means that shadowing "const char *i" by "char *i" does not emit a
5629 warning.
5630
5631 This warning is also enabled by -Wshadow=local.
5632
5633 -Wlarger-than=byte-size
5634 Warn whenever an object is defined whose size exceeds byte-size.
5635 -Wlarger-than=PTRDIFF_MAX is enabled by default. Warnings
5636 controlled by the option can be disabled either by specifying byte-
5637 size of SIZE_MAX or more or by -Wno-larger-than.
5638
5639 -Wno-larger-than
5640 Disable -Wlarger-than= warnings. The option is equivalent to
5641 -Wlarger-than=SIZE_MAX or larger.
5642
5643 -Wframe-larger-than=byte-size
5644 Warn if the size of a function frame exceeds byte-size. The
5645 computation done to determine the stack frame size is approximate
5646 and not conservative. The actual requirements may be somewhat
5647 greater than byte-size even if you do not get a warning. In
5648 addition, any space allocated via "alloca", variable-length arrays,
5649 or related constructs is not included by the compiler when
5650 determining whether or not to issue a warning.
5651 -Wframe-larger-than=PTRDIFF_MAX is enabled by default. Warnings
5652 controlled by the option can be disabled either by specifying byte-
5653 size of SIZE_MAX or more or by -Wno-frame-larger-than.
5654
5655 -Wno-frame-larger-than
5656 Disable -Wframe-larger-than= warnings. The option is equivalent to
5657 -Wframe-larger-than=SIZE_MAX or larger.
5658
5659 -Wno-free-nonheap-object
5660 Do not warn when attempting to free an object that was not
5661 allocated on the heap.
5662
5663 -Wstack-usage=byte-size
5664 Warn if the stack usage of a function might exceed byte-size. The
5665 computation done to determine the stack usage is conservative. Any
5666 space allocated via "alloca", variable-length arrays, or related
5667 constructs is included by the compiler when determining whether or
5668 not to issue a warning.
5669
5670 The message is in keeping with the output of -fstack-usage.
5671
5672 * If the stack usage is fully static but exceeds the specified
5673 amount, it's:
5674
5675 warning: stack usage is 1120 bytes
5676
5677 * If the stack usage is (partly) dynamic but bounded, it's:
5678
5679 warning: stack usage might be 1648 bytes
5680
5681 * If the stack usage is (partly) dynamic and not bounded, it's:
5682
5683 warning: stack usage might be unbounded
5684
5685 -Wstack-usage=PTRDIFF_MAX is enabled by default. Warnings
5686 controlled by the option can be disabled either by specifying byte-
5687 size of SIZE_MAX or more or by -Wno-stack-usage.
5688
5689 -Wno-stack-usage
5690 Disable -Wstack-usage= warnings. The option is equivalent to
5691 -Wstack-usage=SIZE_MAX or larger.
5692
5693 -Wunsafe-loop-optimizations
5694 Warn if the loop cannot be optimized because the compiler cannot
5695 assume anything on the bounds of the loop indices. With
5696 -funsafe-loop-optimizations warn if the compiler makes such
5697 assumptions.
5698
5699 -Wno-pedantic-ms-format (MinGW targets only)
5700 When used in combination with -Wformat and -pedantic without GNU
5701 extensions, this option disables the warnings about non-ISO
5702 "printf" / "scanf" format width specifiers "I32", "I64", and "I"
5703 used on Windows targets, which depend on the MS runtime.
5704
5705 -Wpointer-arith
5706 Warn about anything that depends on the "size of" a function type
5707 or of "void". GNU C assigns these types a size of 1, for
5708 convenience in calculations with "void *" pointers and pointers to
5709 functions. In C++, warn also when an arithmetic operation involves
5710 "NULL". This warning is also enabled by -Wpedantic.
5711
5712 -Wno-pointer-compare
5713 Do not warn if a pointer is compared with a zero character
5714 constant. This usually means that the pointer was meant to be
5715 dereferenced. For example:
5716
5717 const char *p = foo ();
5718 if (p == '\0')
5719 return 42;
5720
5721 Note that the code above is invalid in C++11.
5722
5723 This warning is enabled by default.
5724
5725 -Wtype-limits
5726 Warn if a comparison is always true or always false due to the
5727 limited range of the data type, but do not warn for constant
5728 expressions. For example, warn if an unsigned variable is compared
5729 against zero with "<" or ">=". This warning is also enabled by
5730 -Wextra.
5731
5732 -Wabsolute-value (C and Objective-C only)
5733 Warn for calls to standard functions that compute the absolute
5734 value of an argument when a more appropriate standard function is
5735 available. For example, calling "abs(3.14)" triggers the warning
5736 because the appropriate function to call to compute the absolute
5737 value of a double argument is "fabs". The option also triggers
5738 warnings when the argument in a call to such a function has an
5739 unsigned type. This warning can be suppressed with an explicit
5740 type cast and it is also enabled by -Wextra.
5741
5742 -Wcomment
5743 -Wcomments
5744 Warn whenever a comment-start sequence /* appears in a /* comment,
5745 or whenever a backslash-newline appears in a // comment. This
5746 warning is enabled by -Wall.
5747
5748 -Wtrigraphs
5749 Warn if any trigraphs are encountered that might change the meaning
5750 of the program. Trigraphs within comments are not warned about,
5751 except those that would form escaped newlines.
5752
5753 This option is implied by -Wall. If -Wall is not given, this
5754 option is still enabled unless trigraphs are enabled. To get
5755 trigraph conversion without warnings, but get the other -Wall
5756 warnings, use -trigraphs -Wall -Wno-trigraphs.
5757
5758 -Wundef
5759 Warn if an undefined identifier is evaluated in an "#if" directive.
5760 Such identifiers are replaced with zero.
5761
5762 -Wexpansion-to-defined
5763 Warn whenever defined is encountered in the expansion of a macro
5764 (including the case where the macro is expanded by an #if
5765 directive). Such usage is not portable. This warning is also
5766 enabled by -Wpedantic and -Wextra.
5767
5768 -Wunused-macros
5769 Warn about macros defined in the main file that are unused. A
5770 macro is used if it is expanded or tested for existence at least
5771 once. The preprocessor also warns if the macro has not been used
5772 at the time it is redefined or undefined.
5773
5774 Built-in macros, macros defined on the command line, and macros
5775 defined in include files are not warned about.
5776
5777 Note: If a macro is actually used, but only used in skipped
5778 conditional blocks, then the preprocessor reports it as unused. To
5779 avoid the warning in such a case, you might improve the scope of
5780 the macro's definition by, for example, moving it into the first
5781 skipped block. Alternatively, you could provide a dummy use with
5782 something like:
5783
5784 #if defined the_macro_causing_the_warning
5785 #endif
5786
5787 -Wno-endif-labels
5788 Do not warn whenever an "#else" or an "#endif" are followed by
5789 text. This sometimes happens in older programs with code of the
5790 form
5791
5792 #if FOO
5793 ...
5794 #else FOO
5795 ...
5796 #endif FOO
5797
5798 The second and third "FOO" should be in comments. This warning is
5799 on by default.
5800
5801 -Wbad-function-cast (C and Objective-C only)
5802 Warn when a function call is cast to a non-matching type. For
5803 example, warn if a call to a function returning an integer type is
5804 cast to a pointer type.
5805
5806 -Wc90-c99-compat (C and Objective-C only)
5807 Warn about features not present in ISO C90, but present in ISO C99.
5808 For instance, warn about use of variable length arrays, "long long"
5809 type, "bool" type, compound literals, designated initializers, and
5810 so on. This option is independent of the standards mode. Warnings
5811 are disabled in the expression that follows "__extension__".
5812
5813 -Wc99-c11-compat (C and Objective-C only)
5814 Warn about features not present in ISO C99, but present in ISO C11.
5815 For instance, warn about use of anonymous structures and unions,
5816 "_Atomic" type qualifier, "_Thread_local" storage-class specifier,
5817 "_Alignas" specifier, "Alignof" operator, "_Generic" keyword, and
5818 so on. This option is independent of the standards mode. Warnings
5819 are disabled in the expression that follows "__extension__".
5820
5821 -Wc11-c2x-compat (C and Objective-C only)
5822 Warn about features not present in ISO C11, but present in ISO C2X.
5823 For instance, warn about omitting the string in "_Static_assert",
5824 use of [[]] syntax for attributes, use of decimal floating-point
5825 types, and so on. This option is independent of the standards
5826 mode. Warnings are disabled in the expression that follows
5827 "__extension__".
5828
5829 -Wc++-compat (C and Objective-C only)
5830 Warn about ISO C constructs that are outside of the common subset
5831 of ISO C and ISO C++, e.g. request for implicit conversion from
5832 "void *" to a pointer to non-"void" type.
5833
5834 -Wc++11-compat (C++ and Objective-C++ only)
5835 Warn about C++ constructs whose meaning differs between ISO C++
5836 1998 and ISO C++ 2011, e.g., identifiers in ISO C++ 1998 that are
5837 keywords in ISO C++ 2011. This warning turns on -Wnarrowing and is
5838 enabled by -Wall.
5839
5840 -Wc++14-compat (C++ and Objective-C++ only)
5841 Warn about C++ constructs whose meaning differs between ISO C++
5842 2011 and ISO C++ 2014. This warning is enabled by -Wall.
5843
5844 -Wc++17-compat (C++ and Objective-C++ only)
5845 Warn about C++ constructs whose meaning differs between ISO C++
5846 2014 and ISO C++ 2017. This warning is enabled by -Wall.
5847
5848 -Wc++20-compat (C++ and Objective-C++ only)
5849 Warn about C++ constructs whose meaning differs between ISO C++
5850 2017 and ISO C++ 2020. This warning is enabled by -Wall.
5851
5852 -Wcast-qual
5853 Warn whenever a pointer is cast so as to remove a type qualifier
5854 from the target type. For example, warn if a "const char *" is
5855 cast to an ordinary "char *".
5856
5857 Also warn when making a cast that introduces a type qualifier in an
5858 unsafe way. For example, casting "char **" to "const char **" is
5859 unsafe, as in this example:
5860
5861 /* p is char ** value. */
5862 const char **q = (const char **) p;
5863 /* Assignment of readonly string to const char * is OK. */
5864 *q = "string";
5865 /* Now char** pointer points to read-only memory. */
5866 **p = 'b';
5867
5868 -Wcast-align
5869 Warn whenever a pointer is cast such that the required alignment of
5870 the target is increased. For example, warn if a "char *" is cast
5871 to an "int *" on machines where integers can only be accessed at
5872 two- or four-byte boundaries.
5873
5874 -Wcast-align=strict
5875 Warn whenever a pointer is cast such that the required alignment of
5876 the target is increased. For example, warn if a "char *" is cast
5877 to an "int *" regardless of the target machine.
5878
5879 -Wcast-function-type
5880 Warn when a function pointer is cast to an incompatible function
5881 pointer. In a cast involving function types with a variable
5882 argument list only the types of initial arguments that are provided
5883 are considered. Any parameter of pointer-type matches any other
5884 pointer-type. Any benign differences in integral types are
5885 ignored, like "int" vs. "long" on ILP32 targets. Likewise type
5886 qualifiers are ignored. The function type "void (*) (void)" is
5887 special and matches everything, which can be used to suppress this
5888 warning. In a cast involving pointer to member types this warning
5889 warns whenever the type cast is changing the pointer to member
5890 type. This warning is enabled by -Wextra.
5891
5892 -Wwrite-strings
5893 When compiling C, give string constants the type "const
5894 char[length]" so that copying the address of one into a non-"const"
5895 "char *" pointer produces a warning. These warnings help you find
5896 at compile time code that can try to write into a string constant,
5897 but only if you have been very careful about using "const" in
5898 declarations and prototypes. Otherwise, it is just a nuisance.
5899 This is why we did not make -Wall request these warnings.
5900
5901 When compiling C++, warn about the deprecated conversion from
5902 string literals to "char *". This warning is enabled by default
5903 for C++ programs.
5904
5905 -Wclobbered
5906 Warn for variables that might be changed by "longjmp" or "vfork".
5907 This warning is also enabled by -Wextra.
5908
5909 -Wconversion
5910 Warn for implicit conversions that may alter a value. This includes
5911 conversions between real and integer, like "abs (x)" when "x" is
5912 "double"; conversions between signed and unsigned, like "unsigned
5913 ui = -1"; and conversions to smaller types, like "sqrtf (M_PI)". Do
5914 not warn for explicit casts like "abs ((int) x)" and "ui =
5915 (unsigned) -1", or if the value is not changed by the conversion
5916 like in "abs (2.0)". Warnings about conversions between signed and
5917 unsigned integers can be disabled by using -Wno-sign-conversion.
5918
5919 For C++, also warn for confusing overload resolution for user-
5920 defined conversions; and conversions that never use a type
5921 conversion operator: conversions to "void", the same type, a base
5922 class or a reference to them. Warnings about conversions between
5923 signed and unsigned integers are disabled by default in C++ unless
5924 -Wsign-conversion is explicitly enabled.
5925
5926 Warnings about conversion from arithmetic on a small type back to
5927 that type are only given with -Warith-conversion.
5928
5929 -Wdangling-else
5930 Warn about constructions where there may be confusion to which "if"
5931 statement an "else" branch belongs. Here is an example of such a
5932 case:
5933
5934 {
5935 if (a)
5936 if (b)
5937 foo ();
5938 else
5939 bar ();
5940 }
5941
5942 In C/C++, every "else" branch belongs to the innermost possible
5943 "if" statement, which in this example is "if (b)". This is often
5944 not what the programmer expected, as illustrated in the above
5945 example by indentation the programmer chose. When there is the
5946 potential for this confusion, GCC issues a warning when this flag
5947 is specified. To eliminate the warning, add explicit braces around
5948 the innermost "if" statement so there is no way the "else" can
5949 belong to the enclosing "if". The resulting code looks like this:
5950
5951 {
5952 if (a)
5953 {
5954 if (b)
5955 foo ();
5956 else
5957 bar ();
5958 }
5959 }
5960
5961 This warning is enabled by -Wparentheses.
5962
5963 -Wdate-time
5964 Warn when macros "__TIME__", "__DATE__" or "__TIMESTAMP__" are
5965 encountered as they might prevent bit-wise-identical reproducible
5966 compilations.
5967
5968 -Wempty-body
5969 Warn if an empty body occurs in an "if", "else" or "do while"
5970 statement. This warning is also enabled by -Wextra.
5971
5972 -Wno-endif-labels
5973 Do not warn about stray tokens after "#else" and "#endif".
5974
5975 -Wenum-compare
5976 Warn about a comparison between values of different enumerated
5977 types. In C++ enumerated type mismatches in conditional
5978 expressions are also diagnosed and the warning is enabled by
5979 default. In C this warning is enabled by -Wall.
5980
5981 -Wenum-conversion (C, Objective-C only)
5982 Warn when a value of enumerated type is implicitly converted to a
5983 different enumerated type. This warning is enabled by -Wextra.
5984
5985 -Wjump-misses-init (C, Objective-C only)
5986 Warn if a "goto" statement or a "switch" statement jumps forward
5987 across the initialization of a variable, or jumps backward to a
5988 label after the variable has been initialized. This only warns
5989 about variables that are initialized when they are declared. This
5990 warning is only supported for C and Objective-C; in C++ this sort
5991 of branch is an error in any case.
5992
5993 -Wjump-misses-init is included in -Wc++-compat. It can be disabled
5994 with the -Wno-jump-misses-init option.
5995
5996 -Wsign-compare
5997 Warn when a comparison between signed and unsigned values could
5998 produce an incorrect result when the signed value is converted to
5999 unsigned. In C++, this warning is also enabled by -Wall. In C, it
6000 is also enabled by -Wextra.
6001
6002 -Wsign-conversion
6003 Warn for implicit conversions that may change the sign of an
6004 integer value, like assigning a signed integer expression to an
6005 unsigned integer variable. An explicit cast silences the warning.
6006 In C, this option is enabled also by -Wconversion.
6007
6008 -Wfloat-conversion
6009 Warn for implicit conversions that reduce the precision of a real
6010 value. This includes conversions from real to integer, and from
6011 higher precision real to lower precision real values. This option
6012 is also enabled by -Wconversion.
6013
6014 -Wno-scalar-storage-order
6015 Do not warn on suspicious constructs involving reverse scalar
6016 storage order.
6017
6018 -Wsizeof-pointer-div
6019 Warn for suspicious divisions of two sizeof expressions that divide
6020 the pointer size by the element size, which is the usual way to
6021 compute the array size but won't work out correctly with pointers.
6022 This warning warns e.g. about "sizeof (ptr) / sizeof (ptr[0])" if
6023 "ptr" is not an array, but a pointer. This warning is enabled by
6024 -Wall.
6025
6026 -Wsizeof-pointer-memaccess
6027 Warn for suspicious length parameters to certain string and memory
6028 built-in functions if the argument uses "sizeof". This warning
6029 triggers for example for "memset (ptr, 0, sizeof (ptr));" if "ptr"
6030 is not an array, but a pointer, and suggests a possible fix, or
6031 about "memcpy (&foo, ptr, sizeof (&foo));".
6032 -Wsizeof-pointer-memaccess also warns about calls to bounded string
6033 copy functions like "strncat" or "strncpy" that specify as the
6034 bound a "sizeof" expression of the source array. For example, in
6035 the following function the call to "strncat" specifies the size of
6036 the source string as the bound. That is almost certainly a mistake
6037 and so the call is diagnosed.
6038
6039 void make_file (const char *name)
6040 {
6041 char path[PATH_MAX];
6042 strncpy (path, name, sizeof path - 1);
6043 strncat (path, ".text", sizeof ".text");
6044 ...
6045 }
6046
6047 The -Wsizeof-pointer-memaccess option is enabled by -Wall.
6048
6049 -Wno-sizeof-array-argument
6050 Do not warn when the "sizeof" operator is applied to a parameter
6051 that is declared as an array in a function definition. This
6052 warning is enabled by default for C and C++ programs.
6053
6054 -Wmemset-elt-size
6055 Warn for suspicious calls to the "memset" built-in function, if the
6056 first argument references an array, and the third argument is a
6057 number equal to the number of elements, but not equal to the size
6058 of the array in memory. This indicates that the user has omitted a
6059 multiplication by the element size. This warning is enabled by
6060 -Wall.
6061
6062 -Wmemset-transposed-args
6063 Warn for suspicious calls to the "memset" built-in function where
6064 the second argument is not zero and the third argument is zero.
6065 For example, the call "memset (buf, sizeof buf, 0)" is diagnosed
6066 because "memset (buf, 0, sizeof buf)" was meant instead. The
6067 diagnostic is only emitted if the third argument is a literal zero.
6068 Otherwise, if it is an expression that is folded to zero, or a cast
6069 of zero to some type, it is far less likely that the arguments have
6070 been mistakenly transposed and no warning is emitted. This warning
6071 is enabled by -Wall.
6072
6073 -Waddress
6074 Warn about suspicious uses of memory addresses. These include using
6075 the address of a function in a conditional expression, such as
6076 "void func(void); if (func)", and comparisons against the memory
6077 address of a string literal, such as "if (x == "abc")". Such uses
6078 typically indicate a programmer error: the address of a function
6079 always evaluates to true, so their use in a conditional usually
6080 indicate that the programmer forgot the parentheses in a function
6081 call; and comparisons against string literals result in unspecified
6082 behavior and are not portable in C, so they usually indicate that
6083 the programmer intended to use "strcmp". This warning is enabled
6084 by -Wall.
6085
6086 -Wno-address-of-packed-member
6087 Do not warn when the address of packed member of struct or union is
6088 taken, which usually results in an unaligned pointer value. This
6089 is enabled by default.
6090
6091 -Wlogical-op
6092 Warn about suspicious uses of logical operators in expressions.
6093 This includes using logical operators in contexts where a bit-wise
6094 operator is likely to be expected. Also warns when the operands of
6095 a logical operator are the same:
6096
6097 extern int a;
6098 if (a < 0 && a < 0) { ... }
6099
6100 -Wlogical-not-parentheses
6101 Warn about logical not used on the left hand side operand of a
6102 comparison. This option does not warn if the right operand is
6103 considered to be a boolean expression. Its purpose is to detect
6104 suspicious code like the following:
6105
6106 int a;
6107 ...
6108 if (!a > 1) { ... }
6109
6110 It is possible to suppress the warning by wrapping the LHS into
6111 parentheses:
6112
6113 if ((!a) > 1) { ... }
6114
6115 This warning is enabled by -Wall.
6116
6117 -Waggregate-return
6118 Warn if any functions that return structures or unions are defined
6119 or called. (In languages where you can return an array, this also
6120 elicits a warning.)
6121
6122 -Wno-aggressive-loop-optimizations
6123 Warn if in a loop with constant number of iterations the compiler
6124 detects undefined behavior in some statement during one or more of
6125 the iterations.
6126
6127 -Wno-attributes
6128 Do not warn if an unexpected "__attribute__" is used, such as
6129 unrecognized attributes, function attributes applied to variables,
6130 etc. This does not stop errors for incorrect use of supported
6131 attributes.
6132
6133 -Wno-builtin-declaration-mismatch
6134 Warn if a built-in function is declared with an incompatible
6135 signature or as a non-function, or when a built-in function
6136 declared with a type that does not include a prototype is called
6137 with arguments whose promoted types do not match those expected by
6138 the function. When -Wextra is specified, also warn when a built-in
6139 function that takes arguments is declared without a prototype. The
6140 -Wbuiltin-declaration-mismatch warning is enabled by default. To
6141 avoid the warning include the appropriate header to bring the
6142 prototypes of built-in functions into scope.
6143
6144 For example, the call to "memset" below is diagnosed by the warning
6145 because the function expects a value of type "size_t" as its
6146 argument but the type of 32 is "int". With -Wextra, the
6147 declaration of the function is diagnosed as well.
6148
6149 extern void* memset ();
6150 void f (void *d)
6151 {
6152 memset (d, '\0', 32);
6153 }
6154
6155 -Wno-builtin-macro-redefined
6156 Do not warn if certain built-in macros are redefined. This
6157 suppresses warnings for redefinition of "__TIMESTAMP__",
6158 "__TIME__", "__DATE__", "__FILE__", and "__BASE_FILE__".
6159
6160 -Wstrict-prototypes (C and Objective-C only)
6161 Warn if a function is declared or defined without specifying the
6162 argument types. (An old-style function definition is permitted
6163 without a warning if preceded by a declaration that specifies the
6164 argument types.)
6165
6166 -Wold-style-declaration (C and Objective-C only)
6167 Warn for obsolescent usages, according to the C Standard, in a
6168 declaration. For example, warn if storage-class specifiers like
6169 "static" are not the first things in a declaration. This warning
6170 is also enabled by -Wextra.
6171
6172 -Wold-style-definition (C and Objective-C only)
6173 Warn if an old-style function definition is used. A warning is
6174 given even if there is a previous prototype. A definition using ()
6175 is not considered an old-style definition in C2X mode, because it
6176 is equivalent to (void) in that case, but is considered an old-
6177 style definition for older standards.
6178
6179 -Wmissing-parameter-type (C and Objective-C only)
6180 A function parameter is declared without a type specifier in
6181 K&R-style functions:
6182
6183 void foo(bar) { }
6184
6185 This warning is also enabled by -Wextra.
6186
6187 -Wmissing-prototypes (C and Objective-C only)
6188 Warn if a global function is defined without a previous prototype
6189 declaration. This warning is issued even if the definition itself
6190 provides a prototype. Use this option to detect global functions
6191 that do not have a matching prototype declaration in a header file.
6192 This option is not valid for C++ because all function declarations
6193 provide prototypes and a non-matching declaration declares an
6194 overload rather than conflict with an earlier declaration. Use
6195 -Wmissing-declarations to detect missing declarations in C++.
6196
6197 -Wmissing-declarations
6198 Warn if a global function is defined without a previous
6199 declaration. Do so even if the definition itself provides a
6200 prototype. Use this option to detect global functions that are not
6201 declared in header files. In C, no warnings are issued for
6202 functions with previous non-prototype declarations; use
6203 -Wmissing-prototypes to detect missing prototypes. In C++, no
6204 warnings are issued for function templates, or for inline
6205 functions, or for functions in anonymous namespaces.
6206
6207 -Wmissing-field-initializers
6208 Warn if a structure's initializer has some fields missing. For
6209 example, the following code causes such a warning, because "x.h" is
6210 implicitly zero:
6211
6212 struct s { int f, g, h; };
6213 struct s x = { 3, 4 };
6214
6215 This option does not warn about designated initializers, so the
6216 following modification does not trigger a warning:
6217
6218 struct s { int f, g, h; };
6219 struct s x = { .f = 3, .g = 4 };
6220
6221 In C this option does not warn about the universal zero initializer
6222 { 0 }:
6223
6224 struct s { int f, g, h; };
6225 struct s x = { 0 };
6226
6227 Likewise, in C++ this option does not warn about the empty { }
6228 initializer, for example:
6229
6230 struct s { int f, g, h; };
6231 s x = { };
6232
6233 This warning is included in -Wextra. To get other -Wextra warnings
6234 without this one, use -Wextra -Wno-missing-field-initializers.
6235
6236 -Wno-multichar
6237 Do not warn if a multicharacter constant ('FOOF') is used. Usually
6238 they indicate a typo in the user's code, as they have
6239 implementation-defined values, and should not be used in portable
6240 code.
6241
6242 -Wnormalized=[none|id|nfc|nfkc]
6243 In ISO C and ISO C++, two identifiers are different if they are
6244 different sequences of characters. However, sometimes when
6245 characters outside the basic ASCII character set are used, you can
6246 have two different character sequences that look the same. To
6247 avoid confusion, the ISO 10646 standard sets out some normalization
6248 rules which when applied ensure that two sequences that look the
6249 same are turned into the same sequence. GCC can warn you if you
6250 are using identifiers that have not been normalized; this option
6251 controls that warning.
6252
6253 There are four levels of warning supported by GCC. The default is
6254 -Wnormalized=nfc, which warns about any identifier that is not in
6255 the ISO 10646 "C" normalized form, NFC. NFC is the recommended
6256 form for most uses. It is equivalent to -Wnormalized.
6257
6258 Unfortunately, there are some characters allowed in identifiers by
6259 ISO C and ISO C++ that, when turned into NFC, are not allowed in
6260 identifiers. That is, there's no way to use these symbols in
6261 portable ISO C or C++ and have all your identifiers in NFC.
6262 -Wnormalized=id suppresses the warning for these characters. It is
6263 hoped that future versions of the standards involved will correct
6264 this, which is why this option is not the default.
6265
6266 You can switch the warning off for all characters by writing
6267 -Wnormalized=none or -Wno-normalized. You should only do this if
6268 you are using some other normalization scheme (like "D"), because
6269 otherwise you can easily create bugs that are literally impossible
6270 to see.
6271
6272 Some characters in ISO 10646 have distinct meanings but look
6273 identical in some fonts or display methodologies, especially once
6274 formatting has been applied. For instance "\u207F", "SUPERSCRIPT
6275 LATIN SMALL LETTER N", displays just like a regular "n" that has
6276 been placed in a superscript. ISO 10646 defines the NFKC
6277 normalization scheme to convert all these into a standard form as
6278 well, and GCC warns if your code is not in NFKC if you use
6279 -Wnormalized=nfkc. This warning is comparable to warning about
6280 every identifier that contains the letter O because it might be
6281 confused with the digit 0, and so is not the default, but may be
6282 useful as a local coding convention if the programming environment
6283 cannot be fixed to display these characters distinctly.
6284
6285 -Wno-attribute-warning
6286 Do not warn about usage of functions declared with "warning"
6287 attribute. By default, this warning is enabled.
6288 -Wno-attribute-warning can be used to disable the warning or
6289 -Wno-error=attribute-warning can be used to disable the error when
6290 compiled with -Werror flag.
6291
6292 -Wno-deprecated
6293 Do not warn about usage of deprecated features.
6294
6295 -Wno-deprecated-declarations
6296 Do not warn about uses of functions, variables, and types marked as
6297 deprecated by using the "deprecated" attribute.
6298
6299 -Wno-overflow
6300 Do not warn about compile-time overflow in constant expressions.
6301
6302 -Wno-odr
6303 Warn about One Definition Rule violations during link-time
6304 optimization. Enabled by default.
6305
6306 -Wopenmp-simd
6307 Warn if the vectorizer cost model overrides the OpenMP simd
6308 directive set by user. The -fsimd-cost-model=unlimited option can
6309 be used to relax the cost model.
6310
6311 -Woverride-init (C and Objective-C only)
6312 Warn if an initialized field without side effects is overridden
6313 when using designated initializers.
6314
6315 This warning is included in -Wextra. To get other -Wextra warnings
6316 without this one, use -Wextra -Wno-override-init.
6317
6318 -Wno-override-init-side-effects (C and Objective-C only)
6319 Do not warn if an initialized field with side effects is overridden
6320 when using designated initializers. This warning is enabled by
6321 default.
6322
6323 -Wpacked
6324 Warn if a structure is given the packed attribute, but the packed
6325 attribute has no effect on the layout or size of the structure.
6326 Such structures may be mis-aligned for little benefit. For
6327 instance, in this code, the variable "f.x" in "struct bar" is
6328 misaligned even though "struct bar" does not itself have the packed
6329 attribute:
6330
6331 struct foo {
6332 int x;
6333 char a, b, c, d;
6334 } __attribute__((packed));
6335 struct bar {
6336 char z;
6337 struct foo f;
6338 };
6339
6340 -Wnopacked-bitfield-compat
6341 The 4.1, 4.2 and 4.3 series of GCC ignore the "packed" attribute on
6342 bit-fields of type "char". This was fixed in GCC 4.4 but the
6343 change can lead to differences in the structure layout. GCC
6344 informs you when the offset of such a field has changed in GCC 4.4.
6345 For example there is no longer a 4-bit padding between field "a"
6346 and "b" in this structure:
6347
6348 struct foo
6349 {
6350 char a:4;
6351 char b:8;
6352 } __attribute__ ((packed));
6353
6354 This warning is enabled by default. Use
6355 -Wno-packed-bitfield-compat to disable this warning.
6356
6357 -Wpacked-not-aligned (C, C++, Objective-C and Objective-C++ only)
6358 Warn if a structure field with explicitly specified alignment in a
6359 packed struct or union is misaligned. For example, a warning will
6360 be issued on "struct S", like, "warning: alignment 1 of 'struct S'
6361 is less than 8", in this code:
6362
6363 struct __attribute__ ((aligned (8))) S8 { char a[8]; };
6364 struct __attribute__ ((packed)) S {
6365 struct S8 s8;
6366 };
6367
6368 This warning is enabled by -Wall.
6369
6370 -Wpadded
6371 Warn if padding is included in a structure, either to align an
6372 element of the structure or to align the whole structure.
6373 Sometimes when this happens it is possible to rearrange the fields
6374 of the structure to reduce the padding and so make the structure
6375 smaller.
6376
6377 -Wredundant-decls
6378 Warn if anything is declared more than once in the same scope, even
6379 in cases where multiple declaration is valid and changes nothing.
6380
6381 -Wrestrict
6382 Warn when an object referenced by a "restrict"-qualified parameter
6383 (or, in C++, a "__restrict"-qualified parameter) is aliased by
6384 another argument, or when copies between such objects overlap. For
6385 example, the call to the "strcpy" function below attempts to
6386 truncate the string by replacing its initial characters with the
6387 last four. However, because the call writes the terminating NUL
6388 into "a[4]", the copies overlap and the call is diagnosed.
6389
6390 void foo (void)
6391 {
6392 char a[] = "abcd1234";
6393 strcpy (a, a + 4);
6394 ...
6395 }
6396
6397 The -Wrestrict option detects some instances of simple overlap even
6398 without optimization but works best at -O2 and above. It is
6399 included in -Wall.
6400
6401 -Wnested-externs (C and Objective-C only)
6402 Warn if an "extern" declaration is encountered within a function.
6403
6404 -Winline
6405 Warn if a function that is declared as inline cannot be inlined.
6406 Even with this option, the compiler does not warn about failures to
6407 inline functions declared in system headers.
6408
6409 The compiler uses a variety of heuristics to determine whether or
6410 not to inline a function. For example, the compiler takes into
6411 account the size of the function being inlined and the amount of
6412 inlining that has already been done in the current function.
6413 Therefore, seemingly insignificant changes in the source program
6414 can cause the warnings produced by -Winline to appear or disappear.
6415
6416 -Wint-in-bool-context
6417 Warn for suspicious use of integer values where boolean values are
6418 expected, such as conditional expressions (?:) using non-boolean
6419 integer constants in boolean context, like "if (a <= b ? 2 : 3)".
6420 Or left shifting of signed integers in boolean context, like "for
6421 (a = 0; 1 << a; a++);". Likewise for all kinds of multiplications
6422 regardless of the data type. This warning is enabled by -Wall.
6423
6424 -Wno-int-to-pointer-cast
6425 Suppress warnings from casts to pointer type of an integer of a
6426 different size. In C++, casting to a pointer type of smaller size
6427 is an error. Wint-to-pointer-cast is enabled by default.
6428
6429 -Wno-pointer-to-int-cast (C and Objective-C only)
6430 Suppress warnings from casts from a pointer to an integer type of a
6431 different size.
6432
6433 -Winvalid-pch
6434 Warn if a precompiled header is found in the search path but cannot
6435 be used.
6436
6437 -Wlong-long
6438 Warn if "long long" type is used. This is enabled by either
6439 -Wpedantic or -Wtraditional in ISO C90 and C++98 modes. To inhibit
6440 the warning messages, use -Wno-long-long.
6441
6442 -Wvariadic-macros
6443 Warn if variadic macros are used in ISO C90 mode, or if the GNU
6444 alternate syntax is used in ISO C99 mode. This is enabled by
6445 either -Wpedantic or -Wtraditional. To inhibit the warning
6446 messages, use -Wno-variadic-macros.
6447
6448 -Wno-varargs
6449 Do not warn upon questionable usage of the macros used to handle
6450 variable arguments like "va_start". These warnings are enabled by
6451 default.
6452
6453 -Wvector-operation-performance
6454 Warn if vector operation is not implemented via SIMD capabilities
6455 of the architecture. Mainly useful for the performance tuning.
6456 Vector operation can be implemented "piecewise", which means that
6457 the scalar operation is performed on every vector element; "in
6458 parallel", which means that the vector operation is implemented
6459 using scalars of wider type, which normally is more performance
6460 efficient; and "as a single scalar", which means that vector fits
6461 into a scalar type.
6462
6463 -Wvla
6464 Warn if a variable-length array is used in the code. -Wno-vla
6465 prevents the -Wpedantic warning of the variable-length array.
6466
6467 -Wvla-larger-than=byte-size
6468 If this option is used, the compiler warns for declarations of
6469 variable-length arrays whose size is either unbounded, or bounded
6470 by an argument that allows the array size to exceed byte-size
6471 bytes. This is similar to how -Walloca-larger-than=byte-size
6472 works, but with variable-length arrays.
6473
6474 Note that GCC may optimize small variable-length arrays of a known
6475 value into plain arrays, so this warning may not get triggered for
6476 such arrays.
6477
6478 -Wvla-larger-than=PTRDIFF_MAX is enabled by default but is
6479 typically only effective when -ftree-vrp is active (default for -O2
6480 and above).
6481
6482 See also -Walloca-larger-than=byte-size.
6483
6484 -Wno-vla-larger-than
6485 Disable -Wvla-larger-than= warnings. The option is equivalent to
6486 -Wvla-larger-than=SIZE_MAX or larger.
6487
6488 -Wvolatile-register-var
6489 Warn if a register variable is declared volatile. The volatile
6490 modifier does not inhibit all optimizations that may eliminate
6491 reads and/or writes to register variables. This warning is enabled
6492 by -Wall.
6493
6494 -Wdisabled-optimization
6495 Warn if a requested optimization pass is disabled. This warning
6496 does not generally indicate that there is anything wrong with your
6497 code; it merely indicates that GCC's optimizers are unable to
6498 handle the code effectively. Often, the problem is that your code
6499 is too big or too complex; GCC refuses to optimize programs when
6500 the optimization itself is likely to take inordinate amounts of
6501 time.
6502
6503 -Wpointer-sign (C and Objective-C only)
6504 Warn for pointer argument passing or assignment with different
6505 signedness. This option is only supported for C and Objective-C.
6506 It is implied by -Wall and by -Wpedantic, which can be disabled
6507 with -Wno-pointer-sign.
6508
6509 -Wstack-protector
6510 This option is only active when -fstack-protector is active. It
6511 warns about functions that are not protected against stack
6512 smashing.
6513
6514 -Woverlength-strings
6515 Warn about string constants that are longer than the "minimum
6516 maximum" length specified in the C standard. Modern compilers
6517 generally allow string constants that are much longer than the
6518 standard's minimum limit, but very portable programs should avoid
6519 using longer strings.
6520
6521 The limit applies after string constant concatenation, and does not
6522 count the trailing NUL. In C90, the limit was 509 characters; in
6523 C99, it was raised to 4095. C++98 does not specify a normative
6524 minimum maximum, so we do not diagnose overlength strings in C++.
6525
6526 This option is implied by -Wpedantic, and can be disabled with
6527 -Wno-overlength-strings.
6528
6529 -Wunsuffixed-float-constants (C and Objective-C only)
6530 Issue a warning for any floating constant that does not have a
6531 suffix. When used together with -Wsystem-headers it warns about
6532 such constants in system header files. This can be useful when
6533 preparing code to use with the "FLOAT_CONST_DECIMAL64" pragma from
6534 the decimal floating-point extension to C99.
6535
6536 -Wno-lto-type-mismatch
6537 During the link-time optimization, do not warn about type
6538 mismatches in global declarations from different compilation units.
6539 Requires -flto to be enabled. Enabled by default.
6540
6541 -Wno-designated-init (C and Objective-C only)
6542 Suppress warnings when a positional initializer is used to
6543 initialize a structure that has been marked with the
6544 "designated_init" attribute.
6545
6546 -Wno-hsa
6547 Do not warn when HSAIL cannot be emitted for the compiled function
6548 or OpenMP construct. These warnings are enabled by default.
6549
6550 Options That Control Static Analysis
6551 -fanalyzer
6552 This option enables an static analysis of program flow which looks
6553 for "interesting" interprocedural paths through the code, and
6554 issues warnings for problems found on them.
6555
6556 This analysis is much more expensive than other GCC warnings.
6557
6558 Enabling this option effectively enables the following warnings:
6559
6560 -Wanalyzer-double-fclose -Wanalyzer-double-free
6561 -Wanalyzer-exposure-through-output-file -Wanalyzer-file-leak
6562 -Wanalyzer-free-of-non-heap -Wanalyzer-malloc-leak
6563 -Wanalyzer-possible-null-argument
6564 -Wanalyzer-possible-null-dereference -Wanalyzer-null-argument
6565 -Wanalyzer-null-dereference -Wanalyzer-stale-setjmp-buffer
6566 -Wanalyzer-tainted-array-index
6567 -Wanalyzer-unsafe-call-within-signal-handler
6568 -Wanalyzer-use-after-free
6569 -Wanalyzer-use-of-pointer-in-stale-stack-frame
6570
6571 This option is only available if GCC was configured with analyzer
6572 support enabled.
6573
6574 -Wanalyzer-too-complex
6575 If -fanalyzer is enabled, the analyzer uses various heuristics to
6576 attempt to explore the control flow and data flow in the program,
6577 but these can be defeated by sufficiently complicated code.
6578
6579 By default, the analysis silently stops if the code is too
6580 complicated for the analyzer to fully explore and it reaches an
6581 internal limit. The -Wanalyzer-too-complex option warns if this
6582 occurs.
6583
6584 -Wno-analyzer-double-fclose
6585 This warning requires -fanalyzer, which enables it; use
6586 -Wno-analyzer-double-fclose to disable it.
6587
6588 This diagnostic warns for paths through the code in which a "FILE
6589 *" can have "fclose" called on it more than once.
6590
6591 -Wno-analyzer-double-free
6592 This warning requires -fanalyzer, which enables it; use
6593 -Wno-analyzer-double-free to disable it.
6594
6595 This diagnostic warns for paths through the code in which a pointer
6596 can have "free" called on it more than once.
6597
6598 -Wno-analyzer-exposure-through-output-file
6599 This warning requires -fanalyzer, which enables it; use
6600 -Wno-analyzer-exposure-through-output-file to disable it.
6601
6602 This diagnostic warns for paths through the code in which a
6603 security-sensitive value is written to an output file (such as
6604 writing a password to a log file).
6605
6606 -Wno-analyzer-file-leak
6607 This warning requires -fanalyzer, which enables it; use
6608 -Wno-analyzer-file-leak to disable it.
6609
6610 This diagnostic warns for paths through the code in which a
6611 "<stdio.h>" "FILE *" stream object is leaked.
6612
6613 -Wno-analyzer-free-of-non-heap
6614 This warning requires -fanalyzer, which enables it; use
6615 -Wno-analyzer-free-of-non-heap to disable it.
6616
6617 This diagnostic warns for paths through the code in which "free" is
6618 called on a non-heap pointer (e.g. an on-stack buffer, or a
6619 global).
6620
6621 -Wno-analyzer-malloc-leak
6622 This warning requires -fanalyzer, which enables it; use
6623 -Wno-analyzer-malloc-leak to disable it.
6624
6625 This diagnostic warns for paths through the code in which a pointer
6626 allocated via "malloc" is leaked.
6627
6628 -Wno-analyzer-possible-null-argument
6629 This warning requires -fanalyzer, which enables it; use
6630 -Wno-analyzer-possible-null-argument to disable it.
6631
6632 This diagnostic warns for paths through the code in which a
6633 possibly-NULL value is passed to a function argument marked with
6634 "__attribute__((nonnull))" as requiring a non-NULL value.
6635
6636 -Wno-analyzer-possible-null-dereference
6637 This warning requires -fanalyzer, which enables it; use
6638 -Wno-analyzer-possible-null-dereference to disable it.
6639
6640 This diagnostic warns for paths through the code in which a
6641 possibly-NULL value is dereferenced.
6642
6643 -Wno-analyzer-null-argument
6644 This warning requires -fanalyzer, which enables it; use
6645 -Wno-analyzer-null-argument to disable it.
6646
6647 This diagnostic warns for paths through the code in which a value
6648 known to be NULL is passed to a function argument marked with
6649 "__attribute__((nonnull))" as requiring a non-NULL value.
6650
6651 -Wno-analyzer-null-dereference
6652 This warning requires -fanalyzer, which enables it; use
6653 -Wno-analyzer-null-dereference to disable it.
6654
6655 This diagnostic warns for paths through the code in which a value
6656 known to be NULL is dereferenced.
6657
6658 -Wno-analyzer-stale-setjmp-buffer
6659 This warning requires -fanalyzer, which enables it; use
6660 -Wno-analyzer-stale-setjmp-buffer to disable it.
6661
6662 This diagnostic warns for paths through the code in which "longjmp"
6663 is called to rewind to a "jmp_buf" relating to a "setjmp" call in a
6664 function that has returned.
6665
6666 When "setjmp" is called on a "jmp_buf" to record a rewind location,
6667 it records the stack frame. The stack frame becomes invalid when
6668 the function containing the "setjmp" call returns. Attempting to
6669 rewind to it via "longjmp" would reference a stack frame that no
6670 longer exists, and likely lead to a crash (or worse).
6671
6672 -Wno-analyzer-tainted-array-index
6673 This warning requires both -fanalyzer and -fanalyzer-checker=taint
6674 to enable it; use -Wno-analyzer-tainted-array-index to disable it.
6675
6676 This diagnostic warns for paths through the code in which a value
6677 that could be under an attacker's control is used as the index of
6678 an array access without being sanitized.
6679
6680 -Wno-analyzer-unsafe-call-within-signal-handler
6681 This warning requires -fanalyzer, which enables it; use
6682 -Wno-analyzer-unsafe-call-within-signal-handler to disable it.
6683
6684 This diagnostic warns for paths through the code in which a
6685 function known to be async-signal-unsafe (such as "fprintf") is
6686 called from a signal handler.
6687
6688 -Wno-analyzer-use-after-free
6689 This warning requires -fanalyzer, which enables it; use
6690 -Wno-analyzer-use-after-free to disable it.
6691
6692 This diagnostic warns for paths through the code in which a pointer
6693 is used after "free" is called on it.
6694
6695 -Wno-analyzer-use-of-pointer-in-stale-stack-frame
6696 This warning requires -fanalyzer, which enables it; use
6697 -Wno-analyzer-use-of-pointer-in-stale-stack-frame to disable it.
6698
6699 This diagnostic warns for paths through the code in which a pointer
6700 is dereferenced that points to a variable in a stale stack frame.
6701
6702 Pertinent parameters for controlling the exploration are: --param
6703 analyzer-bb-explosion-factor=value, --param
6704 analyzer-max-enodes-per-program-point=value, --param
6705 analyzer-max-recursion-depth=value, and --param
6706 analyzer-min-snodes-for-call-summary=value.
6707
6708 The following options control the analyzer.
6709
6710 -fanalyzer-call-summaries
6711 Simplify interprocedural analysis by computing the effect of
6712 certain calls, rather than exploring all paths through the function
6713 from callsite to each possible return.
6714
6715 If enabled, call summaries are only used for functions with more
6716 than one call site, and that are sufficiently complicated (as per
6717 --param analyzer-min-snodes-for-call-summary=value).
6718
6719 -fanalyzer-checker=name
6720 Restrict the analyzer to run just the named checker, and enable it.
6721
6722 Some checkers are disabled by default (even with -fanalyzer), such
6723 as the "taint" checker that implements
6724 -Wanalyzer-tainted-array-index, and this option is required to
6725 enable them.
6726
6727 -fanalyzer-fine-grained
6728 This option is intended for analyzer developers.
6729
6730 Internally the analyzer builds an "exploded graph" that combines
6731 control flow graphs with data flow information.
6732
6733 By default, an edge in this graph can contain the effects of a run
6734 of multiple statements within a basic block. With
6735 -fanalyzer-fine-grained, each statement gets its own edge.
6736
6737 -fanalyzer-show-duplicate-count
6738 This option is intended for analyzer developers: if multiple
6739 diagnostics have been detected as being duplicates of each other,
6740 it emits a note when reporting the best diagnostic, giving the
6741 number of additional diagnostics that were suppressed by the
6742 deduplication logic.
6743
6744 -fno-analyzer-state-merge
6745 This option is intended for analyzer developers.
6746
6747 By default the analyzer attempts to simplify analysis by merging
6748 sufficiently similar states at each program point as it builds its
6749 "exploded graph". With -fno-analyzer-state-merge this merging can
6750 be suppressed, for debugging state-handling issues.
6751
6752 -fno-analyzer-state-purge
6753 This option is intended for analyzer developers.
6754
6755 By default the analyzer attempts to simplify analysis by purging
6756 aspects of state at a program point that appear to no longer be
6757 relevant e.g. the values of locals that aren't accessed later in
6758 the function and which aren't relevant to leak analysis.
6759
6760 With -fno-analyzer-state-purge this purging of state can be
6761 suppressed, for debugging state-handling issues.
6762
6763 -fanalyzer-transitivity
6764 This option enables transitivity of constraints within the
6765 analyzer.
6766
6767 -fanalyzer-verbose-edges
6768 This option is intended for analyzer developers. It enables more
6769 verbose, lower-level detail in the descriptions of control flow
6770 within diagnostic paths.
6771
6772 -fanalyzer-verbose-state-changes
6773 This option is intended for analyzer developers. It enables more
6774 verbose, lower-level detail in the descriptions of events relating
6775 to state machines within diagnostic paths.
6776
6777 -fanalyzer-verbosity=level
6778 This option controls the complexity of the control flow paths that
6779 are emitted for analyzer diagnostics.
6780
6781 The level can be one of:
6782
6783 0 At this level, interprocedural call and return events are
6784 displayed, along with the most pertinent state-change events
6785 relating to a diagnostic. For example, for a double-"free"
6786 diagnostic, both calls to "free" will be shown.
6787
6788 1 As per the previous level, but also show events for the entry
6789 to each function.
6790
6791 2 As per the previous level, but also show events relating to
6792 control flow that are significant to triggering the issue (e.g.
6793 "true path taken" at a conditional).
6794
6795 This level is the default.
6796
6797 3 As per the previous level, but show all control flow events,
6798 not just significant ones.
6799
6800 4 This level is intended for analyzer developers; it adds various
6801 other events intended for debugging the analyzer.
6802
6803 -fdump-analyzer
6804 Dump internal details about what the analyzer is doing to
6805 file.analyzer.txt. This option is overridden by
6806 -fdump-analyzer-stderr.
6807
6808 -fdump-analyzer-stderr
6809 Dump internal details about what the analyzer is doing to stderr.
6810 This option overrides -fdump-analyzer.
6811
6812 -fdump-analyzer-callgraph
6813 Dump a representation of the call graph suitable for viewing with
6814 GraphViz to file.callgraph.dot.
6815
6816 -fdump-analyzer-exploded-graph
6817 Dump a representation of the "exploded graph" suitable for viewing
6818 with GraphViz to file.eg.dot. Nodes are color-coded based on
6819 state-machine states to emphasize state changes.
6820
6821 -fdump-analyzer-exploded-nodes
6822 Emit diagnostics showing where nodes in the "exploded graph" are in
6823 relation to the program source.
6824
6825 -fdump-analyzer-exploded-nodes-2
6826 Dump a textual representation of the "exploded graph" to
6827 file.eg.txt.
6828
6829 -fdump-analyzer-exploded-nodes-3
6830 Dump a textual representation of the "exploded graph" to one dump
6831 file per node, to file.eg-id.txt. This is typically a large number
6832 of dump files.
6833
6834 -fdump-analyzer-state-purge
6835 As per -fdump-analyzer-supergraph, dump a representation of the
6836 "supergraph" suitable for viewing with GraphViz, but annotate the
6837 graph with information on what state will be purged at each node.
6838 The graph is written to file.state-purge.dot.
6839
6840 -fdump-analyzer-supergraph
6841 Dump representations of the "supergraph" suitable for viewing with
6842 GraphViz to file.supergraph.dot and to file.supergraph-eg.dot.
6843 These show all of the control flow graphs in the program, with
6844 interprocedural edges for calls and returns. The second dump
6845 contains annotations showing nodes in the "exploded graph" and
6846 diagnostics associated with them.
6847
6848 Options for Debugging Your Program
6849 To tell GCC to emit extra information for use by a debugger, in almost
6850 all cases you need only to add -g to your other options.
6851
6852 GCC allows you to use -g with -O. The shortcuts taken by optimized
6853 code may occasionally be surprising: some variables you declared may
6854 not exist at all; flow of control may briefly move where you did not
6855 expect it; some statements may not be executed because they compute
6856 constant results or their values are already at hand; some statements
6857 may execute in different places because they have been moved out of
6858 loops. Nevertheless it is possible to debug optimized output. This
6859 makes it reasonable to use the optimizer for programs that might have
6860 bugs.
6861
6862 If you are not using some other optimization option, consider using -Og
6863 with -g. With no -O option at all, some compiler passes that collect
6864 information useful for debugging do not run at all, so that -Og may
6865 result in a better debugging experience.
6866
6867 -g Produce debugging information in the operating system's native
6868 format (stabs, COFF, XCOFF, or DWARF). GDB can work with this
6869 debugging information.
6870
6871 On most systems that use stabs format, -g enables use of extra
6872 debugging information that only GDB can use; this extra information
6873 makes debugging work better in GDB but probably makes other
6874 debuggers crash or refuse to read the program. If you want to
6875 control for certain whether to generate the extra information, use
6876 -gstabs+, -gstabs, -gxcoff+, -gxcoff, or -gvms (see below).
6877
6878 -ggdb
6879 Produce debugging information for use by GDB. This means to use
6880 the most expressive format available (DWARF, stabs, or the native
6881 format if neither of those are supported), including GDB extensions
6882 if at all possible.
6883
6884 -gdwarf
6885 -gdwarf-version
6886 Produce debugging information in DWARF format (if that is
6887 supported). The value of version may be either 2, 3, 4 or 5; the
6888 default version for most targets is 4. DWARF Version 5 is only
6889 experimental.
6890
6891 Note that with DWARF Version 2, some ports require and always use
6892 some non-conflicting DWARF 3 extensions in the unwind tables.
6893
6894 Version 4 may require GDB 7.0 and -fvar-tracking-assignments for
6895 maximum benefit.
6896
6897 GCC no longer supports DWARF Version 1, which is substantially
6898 different than Version 2 and later. For historical reasons, some
6899 other DWARF-related options such as -fno-dwarf2-cfi-asm) retain a
6900 reference to DWARF Version 2 in their names, but apply to all
6901 currently-supported versions of DWARF.
6902
6903 -gstabs
6904 Produce debugging information in stabs format (if that is
6905 supported), without GDB extensions. This is the format used by DBX
6906 on most BSD systems. On MIPS, Alpha and System V Release 4 systems
6907 this option produces stabs debugging output that is not understood
6908 by DBX. On System V Release 4 systems this option requires the GNU
6909 assembler.
6910
6911 -gstabs+
6912 Produce debugging information in stabs format (if that is
6913 supported), using GNU extensions understood only by the GNU
6914 debugger (GDB). The use of these extensions is likely to make
6915 other debuggers crash or refuse to read the program.
6916
6917 -gxcoff
6918 Produce debugging information in XCOFF format (if that is
6919 supported). This is the format used by the DBX debugger on IBM
6920 RS/6000 systems.
6921
6922 -gxcoff+
6923 Produce debugging information in XCOFF format (if that is
6924 supported), using GNU extensions understood only by the GNU
6925 debugger (GDB). The use of these extensions is likely to make
6926 other debuggers crash or refuse to read the program, and may cause
6927 assemblers other than the GNU assembler (GAS) to fail with an
6928 error.
6929
6930 -gvms
6931 Produce debugging information in Alpha/VMS debug format (if that is
6932 supported). This is the format used by DEBUG on Alpha/VMS systems.
6933
6934 -glevel
6935 -ggdblevel
6936 -gstabslevel
6937 -gxcofflevel
6938 -gvmslevel
6939 Request debugging information and also use level to specify how
6940 much information. The default level is 2.
6941
6942 Level 0 produces no debug information at all. Thus, -g0 negates
6943 -g.
6944
6945 Level 1 produces minimal information, enough for making backtraces
6946 in parts of the program that you don't plan to debug. This
6947 includes descriptions of functions and external variables, and line
6948 number tables, but no information about local variables.
6949
6950 Level 3 includes extra information, such as all the macro
6951 definitions present in the program. Some debuggers support macro
6952 expansion when you use -g3.
6953
6954 If you use multiple -g options, with or without level numbers, the
6955 last such option is the one that is effective.
6956
6957 -gdwarf does not accept a concatenated debug level, to avoid
6958 confusion with -gdwarf-level. Instead use an additional -glevel
6959 option to change the debug level for DWARF.
6960
6961 -fno-eliminate-unused-debug-symbols
6962 By default, no debug information is produced for symbols that are
6963 not actually used. Use this option if you want debug information
6964 for all symbols.
6965
6966 -femit-class-debug-always
6967 Instead of emitting debugging information for a C++ class in only
6968 one object file, emit it in all object files using the class. This
6969 option should be used only with debuggers that are unable to handle
6970 the way GCC normally emits debugging information for classes
6971 because using this option increases the size of debugging
6972 information by as much as a factor of two.
6973
6974 -fno-merge-debug-strings
6975 Direct the linker to not merge together strings in the debugging
6976 information that are identical in different object files. Merging
6977 is not supported by all assemblers or linkers. Merging decreases
6978 the size of the debug information in the output file at the cost of
6979 increasing link processing time. Merging is enabled by default.
6980
6981 -fdebug-prefix-map=old=new
6982 When compiling files residing in directory old, record debugging
6983 information describing them as if the files resided in directory
6984 new instead. This can be used to replace a build-time path with an
6985 install-time path in the debug info. It can also be used to change
6986 an absolute path to a relative path by using . for new. This can
6987 give more reproducible builds, which are location independent, but
6988 may require an extra command to tell GDB where to find the source
6989 files. See also -ffile-prefix-map.
6990
6991 -fvar-tracking
6992 Run variable tracking pass. It computes where variables are stored
6993 at each position in code. Better debugging information is then
6994 generated (if the debugging information format supports this
6995 information).
6996
6997 It is enabled by default when compiling with optimization (-Os, -O,
6998 -O2, ...), debugging information (-g) and the debug info format
6999 supports it.
7000
7001 -fvar-tracking-assignments
7002 Annotate assignments to user variables early in the compilation and
7003 attempt to carry the annotations over throughout the compilation
7004 all the way to the end, in an attempt to improve debug information
7005 while optimizing. Use of -gdwarf-4 is recommended along with it.
7006
7007 It can be enabled even if var-tracking is disabled, in which case
7008 annotations are created and maintained, but discarded at the end.
7009 By default, this flag is enabled together with -fvar-tracking,
7010 except when selective scheduling is enabled.
7011
7012 -gsplit-dwarf
7013 Separate as much DWARF debugging information as possible into a
7014 separate output file with the extension .dwo. This option allows
7015 the build system to avoid linking files with debug information. To
7016 be useful, this option requires a debugger capable of reading .dwo
7017 files.
7018
7019 -gdescribe-dies
7020 Add description attributes to some DWARF DIEs that have no name
7021 attribute, such as artificial variables, external references and
7022 call site parameter DIEs.
7023
7024 -gpubnames
7025 Generate DWARF ".debug_pubnames" and ".debug_pubtypes" sections.
7026
7027 -ggnu-pubnames
7028 Generate ".debug_pubnames" and ".debug_pubtypes" sections in a
7029 format suitable for conversion into a GDB index. This option is
7030 only useful with a linker that can produce GDB index version 7.
7031
7032 -fdebug-types-section
7033 When using DWARF Version 4 or higher, type DIEs can be put into
7034 their own ".debug_types" section instead of making them part of the
7035 ".debug_info" section. It is more efficient to put them in a
7036 separate comdat section since the linker can then remove
7037 duplicates. But not all DWARF consumers support ".debug_types"
7038 sections yet and on some objects ".debug_types" produces larger
7039 instead of smaller debugging information.
7040
7041 -grecord-gcc-switches
7042 -gno-record-gcc-switches
7043 This switch causes the command-line options used to invoke the
7044 compiler that may affect code generation to be appended to the
7045 DW_AT_producer attribute in DWARF debugging information. The
7046 options are concatenated with spaces separating them from each
7047 other and from the compiler version. It is enabled by default.
7048 See also -frecord-gcc-switches for another way of storing compiler
7049 options into the object file.
7050
7051 -gstrict-dwarf
7052 Disallow using extensions of later DWARF standard version than
7053 selected with -gdwarf-version. On most targets using non-
7054 conflicting DWARF extensions from later standard versions is
7055 allowed.
7056
7057 -gno-strict-dwarf
7058 Allow using extensions of later DWARF standard version than
7059 selected with -gdwarf-version.
7060
7061 -gas-loc-support
7062 Inform the compiler that the assembler supports ".loc" directives.
7063 It may then use them for the assembler to generate DWARF2+ line
7064 number tables.
7065
7066 This is generally desirable, because assembler-generated line-
7067 number tables are a lot more compact than those the compiler can
7068 generate itself.
7069
7070 This option will be enabled by default if, at GCC configure time,
7071 the assembler was found to support such directives.
7072
7073 -gno-as-loc-support
7074 Force GCC to generate DWARF2+ line number tables internally, if
7075 DWARF2+ line number tables are to be generated.
7076
7077 -gas-locview-support
7078 Inform the compiler that the assembler supports "view" assignment
7079 and reset assertion checking in ".loc" directives.
7080
7081 This option will be enabled by default if, at GCC configure time,
7082 the assembler was found to support them.
7083
7084 -gno-as-locview-support
7085 Force GCC to assign view numbers internally, if
7086 -gvariable-location-views are explicitly requested.
7087
7088 -gcolumn-info
7089 -gno-column-info
7090 Emit location column information into DWARF debugging information,
7091 rather than just file and line. This option is enabled by default.
7092
7093 -gstatement-frontiers
7094 -gno-statement-frontiers
7095 This option causes GCC to create markers in the internal
7096 representation at the beginning of statements, and to keep them
7097 roughly in place throughout compilation, using them to guide the
7098 output of "is_stmt" markers in the line number table. This is
7099 enabled by default when compiling with optimization (-Os, -O, -O2,
7100 ...), and outputting DWARF 2 debug information at the normal level.
7101
7102 -gvariable-location-views
7103 -gvariable-location-views=incompat5
7104 -gno-variable-location-views
7105 Augment variable location lists with progressive view numbers
7106 implied from the line number table. This enables debug information
7107 consumers to inspect state at certain points of the program, even
7108 if no instructions associated with the corresponding source
7109 locations are present at that point. If the assembler lacks
7110 support for view numbers in line number tables, this will cause the
7111 compiler to emit the line number table, which generally makes them
7112 somewhat less compact. The augmented line number tables and
7113 location lists are fully backward-compatible, so they can be
7114 consumed by debug information consumers that are not aware of these
7115 augmentations, but they won't derive any benefit from them either.
7116
7117 This is enabled by default when outputting DWARF 2 debug
7118 information at the normal level, as long as there is assembler
7119 support, -fvar-tracking-assignments is enabled and -gstrict-dwarf
7120 is not. When assembler support is not available, this may still be
7121 enabled, but it will force GCC to output internal line number
7122 tables, and if -ginternal-reset-location-views is not enabled, that
7123 will most certainly lead to silently mismatching location views.
7124
7125 There is a proposed representation for view numbers that is not
7126 backward compatible with the location list format introduced in
7127 DWARF 5, that can be enabled with
7128 -gvariable-location-views=incompat5. This option may be removed in
7129 the future, is only provided as a reference implementation of the
7130 proposed representation. Debug information consumers are not
7131 expected to support this extended format, and they would be
7132 rendered unable to decode location lists using it.
7133
7134 -ginternal-reset-location-views
7135 -gno-internal-reset-location-views
7136 Attempt to determine location views that can be omitted from
7137 location view lists. This requires the compiler to have very
7138 accurate insn length estimates, which isn't always the case, and it
7139 may cause incorrect view lists to be generated silently when using
7140 an assembler that does not support location view lists. The GNU
7141 assembler will flag any such error as a "view number mismatch".
7142 This is only enabled on ports that define a reliable estimation
7143 function.
7144
7145 -ginline-points
7146 -gno-inline-points
7147 Generate extended debug information for inlined functions.
7148 Location view tracking markers are inserted at inlined entry
7149 points, so that address and view numbers can be computed and output
7150 in debug information. This can be enabled independently of
7151 location views, in which case the view numbers won't be output, but
7152 it can only be enabled along with statement frontiers, and it is
7153 only enabled by default if location views are enabled.
7154
7155 -gz[=type]
7156 Produce compressed debug sections in DWARF format, if that is
7157 supported. If type is not given, the default type depends on the
7158 capabilities of the assembler and linker used. type may be one of
7159 none (don't compress debug sections), zlib (use zlib compression in
7160 ELF gABI format), or zlib-gnu (use zlib compression in traditional
7161 GNU format). If the linker doesn't support writing compressed
7162 debug sections, the option is rejected. Otherwise, if the
7163 assembler does not support them, -gz is silently ignored when
7164 producing object files.
7165
7166 -femit-struct-debug-baseonly
7167 Emit debug information for struct-like types only when the base
7168 name of the compilation source file matches the base name of file
7169 in which the struct is defined.
7170
7171 This option substantially reduces the size of debugging
7172 information, but at significant potential loss in type information
7173 to the debugger. See -femit-struct-debug-reduced for a less
7174 aggressive option. See -femit-struct-debug-detailed for more
7175 detailed control.
7176
7177 This option works only with DWARF debug output.
7178
7179 -femit-struct-debug-reduced
7180 Emit debug information for struct-like types only when the base
7181 name of the compilation source file matches the base name of file
7182 in which the type is defined, unless the struct is a template or
7183 defined in a system header.
7184
7185 This option significantly reduces the size of debugging
7186 information, with some potential loss in type information to the
7187 debugger. See -femit-struct-debug-baseonly for a more aggressive
7188 option. See -femit-struct-debug-detailed for more detailed
7189 control.
7190
7191 This option works only with DWARF debug output.
7192
7193 -femit-struct-debug-detailed[=spec-list]
7194 Specify the struct-like types for which the compiler generates
7195 debug information. The intent is to reduce duplicate struct debug
7196 information between different object files within the same program.
7197
7198 This option is a detailed version of -femit-struct-debug-reduced
7199 and -femit-struct-debug-baseonly, which serves for most needs.
7200
7201 A specification has the
7202 syntax[dir:|ind:][ord:|gen:](any|sys|base|none)
7203
7204 The optional first word limits the specification to structs that
7205 are used directly (dir:) or used indirectly (ind:). A struct type
7206 is used directly when it is the type of a variable, member.
7207 Indirect uses arise through pointers to structs. That is, when use
7208 of an incomplete struct is valid, the use is indirect. An example
7209 is struct one direct; struct two * indirect;.
7210
7211 The optional second word limits the specification to ordinary
7212 structs (ord:) or generic structs (gen:). Generic structs are a
7213 bit complicated to explain. For C++, these are non-explicit
7214 specializations of template classes, or non-template classes within
7215 the above. Other programming languages have generics, but
7216 -femit-struct-debug-detailed does not yet implement them.
7217
7218 The third word specifies the source files for those structs for
7219 which the compiler should emit debug information. The values none
7220 and any have the normal meaning. The value base means that the
7221 base of name of the file in which the type declaration appears must
7222 match the base of the name of the main compilation file. In
7223 practice, this means that when compiling foo.c, debug information
7224 is generated for types declared in that file and foo.h, but not
7225 other header files. The value sys means those types satisfying
7226 base or declared in system or compiler headers.
7227
7228 You may need to experiment to determine the best settings for your
7229 application.
7230
7231 The default is -femit-struct-debug-detailed=all.
7232
7233 This option works only with DWARF debug output.
7234
7235 -fno-dwarf2-cfi-asm
7236 Emit DWARF unwind info as compiler generated ".eh_frame" section
7237 instead of using GAS ".cfi_*" directives.
7238
7239 -fno-eliminate-unused-debug-types
7240 Normally, when producing DWARF output, GCC avoids producing debug
7241 symbol output for types that are nowhere used in the source file
7242 being compiled. Sometimes it is useful to have GCC emit debugging
7243 information for all types declared in a compilation unit,
7244 regardless of whether or not they are actually used in that
7245 compilation unit, for example if, in the debugger, you want to cast
7246 a value to a type that is not actually used in your program (but is
7247 declared). More often, however, this results in a significant
7248 amount of wasted space.
7249
7250 Options That Control Optimization
7251 These options control various sorts of optimizations.
7252
7253 Without any optimization option, the compiler's goal is to reduce the
7254 cost of compilation and to make debugging produce the expected results.
7255 Statements are independent: if you stop the program with a breakpoint
7256 between statements, you can then assign a new value to any variable or
7257 change the program counter to any other statement in the function and
7258 get exactly the results you expect from the source code.
7259
7260 Turning on optimization flags makes the compiler attempt to improve the
7261 performance and/or code size at the expense of compilation time and
7262 possibly the ability to debug the program.
7263
7264 The compiler performs optimization based on the knowledge it has of the
7265 program. Compiling multiple files at once to a single output file mode
7266 allows the compiler to use information gained from all of the files
7267 when compiling each of them.
7268
7269 Not all optimizations are controlled directly by a flag. Only
7270 optimizations that have a flag are listed in this section.
7271
7272 Most optimizations are completely disabled at -O0 or if an -O level is
7273 not set on the command line, even if individual optimization flags are
7274 specified. Similarly, -Og suppresses many optimization passes.
7275
7276 Depending on the target and how GCC was configured, a slightly
7277 different set of optimizations may be enabled at each -O level than
7278 those listed here. You can invoke GCC with -Q --help=optimizers to
7279 find out the exact set of optimizations that are enabled at each level.
7280
7281 -O
7282 -O1 Optimize. Optimizing compilation takes somewhat more time, and a
7283 lot more memory for a large function.
7284
7285 With -O, the compiler tries to reduce code size and execution time,
7286 without performing any optimizations that take a great deal of
7287 compilation time.
7288
7289 -O turns on the following optimization flags:
7290
7291 -fauto-inc-dec -fbranch-count-reg -fcombine-stack-adjustments
7292 -fcompare-elim -fcprop-registers -fdce -fdefer-pop -fdelayed-branch
7293 -fdse -fforward-propagate -fguess-branch-probability
7294 -fif-conversion -fif-conversion2 -finline-functions-called-once
7295 -fipa-profile -fipa-pure-const -fipa-reference
7296 -fipa-reference-addressable -fmerge-constants
7297 -fmove-loop-invariants -fomit-frame-pointer -freorder-blocks
7298 -fshrink-wrap -fshrink-wrap-separate -fsplit-wide-types
7299 -fssa-backprop -fssa-phiopt -ftree-bit-ccp -ftree-ccp -ftree-ch
7300 -ftree-coalesce-vars -ftree-copy-prop -ftree-dce
7301 -ftree-dominator-opts -ftree-dse -ftree-forwprop -ftree-fre
7302 -ftree-phiprop -ftree-pta -ftree-scev-cprop -ftree-sink -ftree-slsr
7303 -ftree-sra -ftree-ter -funit-at-a-time
7304
7305 -O2 Optimize even more. GCC performs nearly all supported
7306 optimizations that do not involve a space-speed tradeoff. As
7307 compared to -O, this option increases both compilation time and the
7308 performance of the generated code.
7309
7310 -O2 turns on all optimization flags specified by -O. It also turns
7311 on the following optimization flags:
7312
7313 -falign-functions -falign-jumps -falign-labels -falign-loops
7314 -fcaller-saves -fcode-hoisting -fcrossjumping -fcse-follow-jumps
7315 -fcse-skip-blocks -fdelete-null-pointer-checks -fdevirtualize
7316 -fdevirtualize-speculatively -fexpensive-optimizations
7317 -ffinite-loops -fgcse -fgcse-lm -fhoist-adjacent-loads
7318 -finline-functions -finline-small-functions -findirect-inlining
7319 -fipa-bit-cp -fipa-cp -fipa-icf -fipa-ra -fipa-sra -fipa-vrp
7320 -fisolate-erroneous-paths-dereference -flra-remat
7321 -foptimize-sibling-calls -foptimize-strlen -fpartial-inlining
7322 -fpeephole2 -freorder-blocks-algorithm=stc
7323 -freorder-blocks-and-partition -freorder-functions
7324 -frerun-cse-after-loop -fschedule-insns -fschedule-insns2
7325 -fsched-interblock -fsched-spec -fstore-merging -fstrict-aliasing
7326 -fthread-jumps -ftree-builtin-call-dce -ftree-pre
7327 -ftree-switch-conversion -ftree-tail-merge -ftree-vrp
7328
7329 Please note the warning under -fgcse about invoking -O2 on programs
7330 that use computed gotos.
7331
7332 -O3 Optimize yet more. -O3 turns on all optimizations specified by -O2
7333 and also turns on the following optimization flags:
7334
7335 -fgcse-after-reload -fipa-cp-clone -floop-interchange
7336 -floop-unroll-and-jam -fpeel-loops -fpredictive-commoning
7337 -fsplit-loops -fsplit-paths -ftree-loop-distribution
7338 -ftree-loop-vectorize -ftree-partial-pre -ftree-slp-vectorize
7339 -funswitch-loops -fvect-cost-model -fvect-cost-model=dynamic
7340 -fversion-loops-for-strides
7341
7342 -O0 Reduce compilation time and make debugging produce the expected
7343 results. This is the default.
7344
7345 -Os Optimize for size. -Os enables all -O2 optimizations except those
7346 that often increase code size:
7347
7348 -falign-functions -falign-jumps -falign-labels -falign-loops
7349 -fprefetch-loop-arrays -freorder-blocks-algorithm=stc
7350
7351 It also enables -finline-functions, causes the compiler to tune for
7352 code size rather than execution speed, and performs further
7353 optimizations designed to reduce code size.
7354
7355 -Ofast
7356 Disregard strict standards compliance. -Ofast enables all -O3
7357 optimizations. It also enables optimizations that are not valid
7358 for all standard-compliant programs. It turns on -ffast-math,
7359 -fallow-store-data-races and the Fortran-specific -fstack-arrays,
7360 unless -fmax-stack-var-size is specified, and -fno-protect-parens.
7361
7362 -Og Optimize debugging experience. -Og should be the optimization
7363 level of choice for the standard edit-compile-debug cycle, offering
7364 a reasonable level of optimization while maintaining fast
7365 compilation and a good debugging experience. It is a better choice
7366 than -O0 for producing debuggable code because some compiler passes
7367 that collect debug information are disabled at -O0.
7368
7369 Like -O0, -Og completely disables a number of optimization passes
7370 so that individual options controlling them have no effect.
7371 Otherwise -Og enables all -O1 optimization flags except for those
7372 that may interfere with debugging:
7373
7374 -fbranch-count-reg -fdelayed-branch -fdse -fif-conversion
7375 -fif-conversion2 -finline-functions-called-once
7376 -fmove-loop-invariants -fssa-phiopt -ftree-bit-ccp -ftree-dse
7377 -ftree-pta -ftree-sra
7378
7379 If you use multiple -O options, with or without level numbers, the last
7380 such option is the one that is effective.
7381
7382 Options of the form -fflag specify machine-independent flags. Most
7383 flags have both positive and negative forms; the negative form of -ffoo
7384 is -fno-foo. In the table below, only one of the forms is listed---the
7385 one you typically use. You can figure out the other form by either
7386 removing no- or adding it.
7387
7388 The following options control specific optimizations. They are either
7389 activated by -O options or are related to ones that are. You can use
7390 the following flags in the rare cases when "fine-tuning" of
7391 optimizations to be performed is desired.
7392
7393 -fno-defer-pop
7394 For machines that must pop arguments after a function call, always
7395 pop the arguments as soon as each function returns. At levels -O1
7396 and higher, -fdefer-pop is the default; this allows the compiler to
7397 let arguments accumulate on the stack for several function calls
7398 and pop them all at once.
7399
7400 -fforward-propagate
7401 Perform a forward propagation pass on RTL. The pass tries to
7402 combine two instructions and checks if the result can be
7403 simplified. If loop unrolling is active, two passes are performed
7404 and the second is scheduled after loop unrolling.
7405
7406 This option is enabled by default at optimization levels -O, -O2,
7407 -O3, -Os.
7408
7409 -ffp-contract=style
7410 -ffp-contract=off disables floating-point expression contraction.
7411 -ffp-contract=fast enables floating-point expression contraction
7412 such as forming of fused multiply-add operations if the target has
7413 native support for them. -ffp-contract=on enables floating-point
7414 expression contraction if allowed by the language standard. This
7415 is currently not implemented and treated equal to
7416 -ffp-contract=off.
7417
7418 The default is -ffp-contract=fast.
7419
7420 -fomit-frame-pointer
7421 Omit the frame pointer in functions that don't need one. This
7422 avoids the instructions to save, set up and restore the frame
7423 pointer; on many targets it also makes an extra register available.
7424
7425 On some targets this flag has no effect because the standard
7426 calling sequence always uses a frame pointer, so it cannot be
7427 omitted.
7428
7429 Note that -fno-omit-frame-pointer doesn't guarantee the frame
7430 pointer is used in all functions. Several targets always omit the
7431 frame pointer in leaf functions.
7432
7433 Enabled by default at -O and higher.
7434
7435 -foptimize-sibling-calls
7436 Optimize sibling and tail recursive calls.
7437
7438 Enabled at levels -O2, -O3, -Os.
7439
7440 -foptimize-strlen
7441 Optimize various standard C string functions (e.g. "strlen",
7442 "strchr" or "strcpy") and their "_FORTIFY_SOURCE" counterparts into
7443 faster alternatives.
7444
7445 Enabled at levels -O2, -O3.
7446
7447 -fno-inline
7448 Do not expand any functions inline apart from those marked with the
7449 "always_inline" attribute. This is the default when not
7450 optimizing.
7451
7452 Single functions can be exempted from inlining by marking them with
7453 the "noinline" attribute.
7454
7455 -finline-small-functions
7456 Integrate functions into their callers when their body is smaller
7457 than expected function call code (so overall size of program gets
7458 smaller). The compiler heuristically decides which functions are
7459 simple enough to be worth integrating in this way. This inlining
7460 applies to all functions, even those not declared inline.
7461
7462 Enabled at levels -O2, -O3, -Os.
7463
7464 -findirect-inlining
7465 Inline also indirect calls that are discovered to be known at
7466 compile time thanks to previous inlining. This option has any
7467 effect only when inlining itself is turned on by the
7468 -finline-functions or -finline-small-functions options.
7469
7470 Enabled at levels -O2, -O3, -Os.
7471
7472 -finline-functions
7473 Consider all functions for inlining, even if they are not declared
7474 inline. The compiler heuristically decides which functions are
7475 worth integrating in this way.
7476
7477 If all calls to a given function are integrated, and the function
7478 is declared "static", then the function is normally not output as
7479 assembler code in its own right.
7480
7481 Enabled at levels -O2, -O3, -Os. Also enabled by -fprofile-use and
7482 -fauto-profile.
7483
7484 -finline-functions-called-once
7485 Consider all "static" functions called once for inlining into their
7486 caller even if they are not marked "inline". If a call to a given
7487 function is integrated, then the function is not output as
7488 assembler code in its own right.
7489
7490 Enabled at levels -O1, -O2, -O3 and -Os, but not -Og.
7491
7492 -fearly-inlining
7493 Inline functions marked by "always_inline" and functions whose body
7494 seems smaller than the function call overhead early before doing
7495 -fprofile-generate instrumentation and real inlining pass. Doing
7496 so makes profiling significantly cheaper and usually inlining
7497 faster on programs having large chains of nested wrapper functions.
7498
7499 Enabled by default.
7500
7501 -fipa-sra
7502 Perform interprocedural scalar replacement of aggregates, removal
7503 of unused parameters and replacement of parameters passed by
7504 reference by parameters passed by value.
7505
7506 Enabled at levels -O2, -O3 and -Os.
7507
7508 -finline-limit=n
7509 By default, GCC limits the size of functions that can be inlined.
7510 This flag allows coarse control of this limit. n is the size of
7511 functions that can be inlined in number of pseudo instructions.
7512
7513 Inlining is actually controlled by a number of parameters, which
7514 may be specified individually by using --param name=value. The
7515 -finline-limit=n option sets some of these parameters as follows:
7516
7517 max-inline-insns-single
7518 is set to n/2.
7519
7520 max-inline-insns-auto
7521 is set to n/2.
7522
7523 See below for a documentation of the individual parameters
7524 controlling inlining and for the defaults of these parameters.
7525
7526 Note: there may be no value to -finline-limit that results in
7527 default behavior.
7528
7529 Note: pseudo instruction represents, in this particular context, an
7530 abstract measurement of function's size. In no way does it
7531 represent a count of assembly instructions and as such its exact
7532 meaning might change from one release to an another.
7533
7534 -fno-keep-inline-dllexport
7535 This is a more fine-grained version of -fkeep-inline-functions,
7536 which applies only to functions that are declared using the
7537 "dllexport" attribute or declspec.
7538
7539 -fkeep-inline-functions
7540 In C, emit "static" functions that are declared "inline" into the
7541 object file, even if the function has been inlined into all of its
7542 callers. This switch does not affect functions using the "extern
7543 inline" extension in GNU C90. In C++, emit any and all inline
7544 functions into the object file.
7545
7546 -fkeep-static-functions
7547 Emit "static" functions into the object file, even if the function
7548 is never used.
7549
7550 -fkeep-static-consts
7551 Emit variables declared "static const" when optimization isn't
7552 turned on, even if the variables aren't referenced.
7553
7554 GCC enables this option by default. If you want to force the
7555 compiler to check if a variable is referenced, regardless of
7556 whether or not optimization is turned on, use the
7557 -fno-keep-static-consts option.
7558
7559 -fmerge-constants
7560 Attempt to merge identical constants (string constants and
7561 floating-point constants) across compilation units.
7562
7563 This option is the default for optimized compilation if the
7564 assembler and linker support it. Use -fno-merge-constants to
7565 inhibit this behavior.
7566
7567 Enabled at levels -O, -O2, -O3, -Os.
7568
7569 -fmerge-all-constants
7570 Attempt to merge identical constants and identical variables.
7571
7572 This option implies -fmerge-constants. In addition to
7573 -fmerge-constants this considers e.g. even constant initialized
7574 arrays or initialized constant variables with integral or floating-
7575 point types. Languages like C or C++ require each variable,
7576 including multiple instances of the same variable in recursive
7577 calls, to have distinct locations, so using this option results in
7578 non-conforming behavior.
7579
7580 -fmodulo-sched
7581 Perform swing modulo scheduling immediately before the first
7582 scheduling pass. This pass looks at innermost loops and reorders
7583 their instructions by overlapping different iterations.
7584
7585 -fmodulo-sched-allow-regmoves
7586 Perform more aggressive SMS-based modulo scheduling with register
7587 moves allowed. By setting this flag certain anti-dependences edges
7588 are deleted, which triggers the generation of reg-moves based on
7589 the life-range analysis. This option is effective only with
7590 -fmodulo-sched enabled.
7591
7592 -fno-branch-count-reg
7593 Disable the optimization pass that scans for opportunities to use
7594 "decrement and branch" instructions on a count register instead of
7595 instruction sequences that decrement a register, compare it against
7596 zero, and then branch based upon the result. This option is only
7597 meaningful on architectures that support such instructions, which
7598 include x86, PowerPC, IA-64 and S/390. Note that the
7599 -fno-branch-count-reg option doesn't remove the decrement and
7600 branch instructions from the generated instruction stream
7601 introduced by other optimization passes.
7602
7603 The default is -fbranch-count-reg at -O1 and higher, except for
7604 -Og.
7605
7606 -fno-function-cse
7607 Do not put function addresses in registers; make each instruction
7608 that calls a constant function contain the function's address
7609 explicitly.
7610
7611 This option results in less efficient code, but some strange hacks
7612 that alter the assembler output may be confused by the
7613 optimizations performed when this option is not used.
7614
7615 The default is -ffunction-cse
7616
7617 -fno-zero-initialized-in-bss
7618 If the target supports a BSS section, GCC by default puts variables
7619 that are initialized to zero into BSS. This can save space in the
7620 resulting code.
7621
7622 This option turns off this behavior because some programs
7623 explicitly rely on variables going to the data section---e.g., so
7624 that the resulting executable can find the beginning of that
7625 section and/or make assumptions based on that.
7626
7627 The default is -fzero-initialized-in-bss.
7628
7629 -fthread-jumps
7630 Perform optimizations that check to see if a jump branches to a
7631 location where another comparison subsumed by the first is found.
7632 If so, the first branch is redirected to either the destination of
7633 the second branch or a point immediately following it, depending on
7634 whether the condition is known to be true or false.
7635
7636 Enabled at levels -O2, -O3, -Os.
7637
7638 -fsplit-wide-types
7639 When using a type that occupies multiple registers, such as "long
7640 long" on a 32-bit system, split the registers apart and allocate
7641 them independently. This normally generates better code for those
7642 types, but may make debugging more difficult.
7643
7644 Enabled at levels -O, -O2, -O3, -Os.
7645
7646 -fsplit-wide-types-early
7647 Fully split wide types early, instead of very late. This option
7648 has no effect unless -fsplit-wide-types is turned on.
7649
7650 This is the default on some targets.
7651
7652 -fcse-follow-jumps
7653 In common subexpression elimination (CSE), scan through jump
7654 instructions when the target of the jump is not reached by any
7655 other path. For example, when CSE encounters an "if" statement
7656 with an "else" clause, CSE follows the jump when the condition
7657 tested is false.
7658
7659 Enabled at levels -O2, -O3, -Os.
7660
7661 -fcse-skip-blocks
7662 This is similar to -fcse-follow-jumps, but causes CSE to follow
7663 jumps that conditionally skip over blocks. When CSE encounters a
7664 simple "if" statement with no else clause, -fcse-skip-blocks causes
7665 CSE to follow the jump around the body of the "if".
7666
7667 Enabled at levels -O2, -O3, -Os.
7668
7669 -frerun-cse-after-loop
7670 Re-run common subexpression elimination after loop optimizations
7671 are performed.
7672
7673 Enabled at levels -O2, -O3, -Os.
7674
7675 -fgcse
7676 Perform a global common subexpression elimination pass. This pass
7677 also performs global constant and copy propagation.
7678
7679 Note: When compiling a program using computed gotos, a GCC
7680 extension, you may get better run-time performance if you disable
7681 the global common subexpression elimination pass by adding
7682 -fno-gcse to the command line.
7683
7684 Enabled at levels -O2, -O3, -Os.
7685
7686 -fgcse-lm
7687 When -fgcse-lm is enabled, global common subexpression elimination
7688 attempts to move loads that are only killed by stores into
7689 themselves. This allows a loop containing a load/store sequence to
7690 be changed to a load outside the loop, and a copy/store within the
7691 loop.
7692
7693 Enabled by default when -fgcse is enabled.
7694
7695 -fgcse-sm
7696 When -fgcse-sm is enabled, a store motion pass is run after global
7697 common subexpression elimination. This pass attempts to move
7698 stores out of loops. When used in conjunction with -fgcse-lm,
7699 loops containing a load/store sequence can be changed to a load
7700 before the loop and a store after the loop.
7701
7702 Not enabled at any optimization level.
7703
7704 -fgcse-las
7705 When -fgcse-las is enabled, the global common subexpression
7706 elimination pass eliminates redundant loads that come after stores
7707 to the same memory location (both partial and full redundancies).
7708
7709 Not enabled at any optimization level.
7710
7711 -fgcse-after-reload
7712 When -fgcse-after-reload is enabled, a redundant load elimination
7713 pass is performed after reload. The purpose of this pass is to
7714 clean up redundant spilling.
7715
7716 Enabled by -fprofile-use and -fauto-profile.
7717
7718 -faggressive-loop-optimizations
7719 This option tells the loop optimizer to use language constraints to
7720 derive bounds for the number of iterations of a loop. This assumes
7721 that loop code does not invoke undefined behavior by for example
7722 causing signed integer overflows or out-of-bound array accesses.
7723 The bounds for the number of iterations of a loop are used to guide
7724 loop unrolling and peeling and loop exit test optimizations. This
7725 option is enabled by default.
7726
7727 -funconstrained-commons
7728 This option tells the compiler that variables declared in common
7729 blocks (e.g. Fortran) may later be overridden with longer trailing
7730 arrays. This prevents certain optimizations that depend on knowing
7731 the array bounds.
7732
7733 -fcrossjumping
7734 Perform cross-jumping transformation. This transformation unifies
7735 equivalent code and saves code size. The resulting code may or may
7736 not perform better than without cross-jumping.
7737
7738 Enabled at levels -O2, -O3, -Os.
7739
7740 -fauto-inc-dec
7741 Combine increments or decrements of addresses with memory accesses.
7742 This pass is always skipped on architectures that do not have
7743 instructions to support this. Enabled by default at -O and higher
7744 on architectures that support this.
7745
7746 -fdce
7747 Perform dead code elimination (DCE) on RTL. Enabled by default at
7748 -O and higher.
7749
7750 -fdse
7751 Perform dead store elimination (DSE) on RTL. Enabled by default at
7752 -O and higher.
7753
7754 -fif-conversion
7755 Attempt to transform conditional jumps into branch-less
7756 equivalents. This includes use of conditional moves, min, max, set
7757 flags and abs instructions, and some tricks doable by standard
7758 arithmetics. The use of conditional execution on chips where it is
7759 available is controlled by -fif-conversion2.
7760
7761 Enabled at levels -O, -O2, -O3, -Os, but not with -Og.
7762
7763 -fif-conversion2
7764 Use conditional execution (where available) to transform
7765 conditional jumps into branch-less equivalents.
7766
7767 Enabled at levels -O, -O2, -O3, -Os, but not with -Og.
7768
7769 -fdeclone-ctor-dtor
7770 The C++ ABI requires multiple entry points for constructors and
7771 destructors: one for a base subobject, one for a complete object,
7772 and one for a virtual destructor that calls operator delete
7773 afterwards. For a hierarchy with virtual bases, the base and
7774 complete variants are clones, which means two copies of the
7775 function. With this option, the base and complete variants are
7776 changed to be thunks that call a common implementation.
7777
7778 Enabled by -Os.
7779
7780 -fdelete-null-pointer-checks
7781 Assume that programs cannot safely dereference null pointers, and
7782 that no code or data element resides at address zero. This option
7783 enables simple constant folding optimizations at all optimization
7784 levels. In addition, other optimization passes in GCC use this
7785 flag to control global dataflow analyses that eliminate useless
7786 checks for null pointers; these assume that a memory access to
7787 address zero always results in a trap, so that if a pointer is
7788 checked after it has already been dereferenced, it cannot be null.
7789
7790 Note however that in some environments this assumption is not true.
7791 Use -fno-delete-null-pointer-checks to disable this optimization
7792 for programs that depend on that behavior.
7793
7794 This option is enabled by default on most targets. On Nios II ELF,
7795 it defaults to off. On AVR, CR16, and MSP430, this option is
7796 completely disabled.
7797
7798 Passes that use the dataflow information are enabled independently
7799 at different optimization levels.
7800
7801 -fdevirtualize
7802 Attempt to convert calls to virtual functions to direct calls.
7803 This is done both within a procedure and interprocedurally as part
7804 of indirect inlining (-findirect-inlining) and interprocedural
7805 constant propagation (-fipa-cp). Enabled at levels -O2, -O3, -Os.
7806
7807 -fdevirtualize-speculatively
7808 Attempt to convert calls to virtual functions to speculative direct
7809 calls. Based on the analysis of the type inheritance graph,
7810 determine for a given call the set of likely targets. If the set is
7811 small, preferably of size 1, change the call into a conditional
7812 deciding between direct and indirect calls. The speculative calls
7813 enable more optimizations, such as inlining. When they seem
7814 useless after further optimization, they are converted back into
7815 original form.
7816
7817 -fdevirtualize-at-ltrans
7818 Stream extra information needed for aggressive devirtualization
7819 when running the link-time optimizer in local transformation mode.
7820 This option enables more devirtualization but significantly
7821 increases the size of streamed data. For this reason it is disabled
7822 by default.
7823
7824 -fexpensive-optimizations
7825 Perform a number of minor optimizations that are relatively
7826 expensive.
7827
7828 Enabled at levels -O2, -O3, -Os.
7829
7830 -free
7831 Attempt to remove redundant extension instructions. This is
7832 especially helpful for the x86-64 architecture, which implicitly
7833 zero-extends in 64-bit registers after writing to their lower
7834 32-bit half.
7835
7836 Enabled for Alpha, AArch64 and x86 at levels -O2, -O3, -Os.
7837
7838 -fno-lifetime-dse
7839 In C++ the value of an object is only affected by changes within
7840 its lifetime: when the constructor begins, the object has an
7841 indeterminate value, and any changes during the lifetime of the
7842 object are dead when the object is destroyed. Normally dead store
7843 elimination will take advantage of this; if your code relies on the
7844 value of the object storage persisting beyond the lifetime of the
7845 object, you can use this flag to disable this optimization. To
7846 preserve stores before the constructor starts (e.g. because your
7847 operator new clears the object storage) but still treat the object
7848 as dead after the destructor, you can use -flifetime-dse=1. The
7849 default behavior can be explicitly selected with -flifetime-dse=2.
7850 -flifetime-dse=0 is equivalent to -fno-lifetime-dse.
7851
7852 -flive-range-shrinkage
7853 Attempt to decrease register pressure through register live range
7854 shrinkage. This is helpful for fast processors with small or
7855 moderate size register sets.
7856
7857 -fira-algorithm=algorithm
7858 Use the specified coloring algorithm for the integrated register
7859 allocator. The algorithm argument can be priority, which specifies
7860 Chow's priority coloring, or CB, which specifies Chaitin-Briggs
7861 coloring. Chaitin-Briggs coloring is not implemented for all
7862 architectures, but for those targets that do support it, it is the
7863 default because it generates better code.
7864
7865 -fira-region=region
7866 Use specified regions for the integrated register allocator. The
7867 region argument should be one of the following:
7868
7869 all Use all loops as register allocation regions. This can give
7870 the best results for machines with a small and/or irregular
7871 register set.
7872
7873 mixed
7874 Use all loops except for loops with small register pressure as
7875 the regions. This value usually gives the best results in most
7876 cases and for most architectures, and is enabled by default
7877 when compiling with optimization for speed (-O, -O2, ...).
7878
7879 one Use all functions as a single region. This typically results
7880 in the smallest code size, and is enabled by default for -Os or
7881 -O0.
7882
7883 -fira-hoist-pressure
7884 Use IRA to evaluate register pressure in the code hoisting pass for
7885 decisions to hoist expressions. This option usually results in
7886 smaller code, but it can slow the compiler down.
7887
7888 This option is enabled at level -Os for all targets.
7889
7890 -fira-loop-pressure
7891 Use IRA to evaluate register pressure in loops for decisions to
7892 move loop invariants. This option usually results in generation of
7893 faster and smaller code on machines with large register files (>=
7894 32 registers), but it can slow the compiler down.
7895
7896 This option is enabled at level -O3 for some targets.
7897
7898 -fno-ira-share-save-slots
7899 Disable sharing of stack slots used for saving call-used hard
7900 registers living through a call. Each hard register gets a
7901 separate stack slot, and as a result function stack frames are
7902 larger.
7903
7904 -fno-ira-share-spill-slots
7905 Disable sharing of stack slots allocated for pseudo-registers.
7906 Each pseudo-register that does not get a hard register gets a
7907 separate stack slot, and as a result function stack frames are
7908 larger.
7909
7910 -flra-remat
7911 Enable CFG-sensitive rematerialization in LRA. Instead of loading
7912 values of spilled pseudos, LRA tries to rematerialize (recalculate)
7913 values if it is profitable.
7914
7915 Enabled at levels -O2, -O3, -Os.
7916
7917 -fdelayed-branch
7918 If supported for the target machine, attempt to reorder
7919 instructions to exploit instruction slots available after delayed
7920 branch instructions.
7921
7922 Enabled at levels -O, -O2, -O3, -Os, but not at -Og.
7923
7924 -fschedule-insns
7925 If supported for the target machine, attempt to reorder
7926 instructions to eliminate execution stalls due to required data
7927 being unavailable. This helps machines that have slow floating
7928 point or memory load instructions by allowing other instructions to
7929 be issued until the result of the load or floating-point
7930 instruction is required.
7931
7932 Enabled at levels -O2, -O3.
7933
7934 -fschedule-insns2
7935 Similar to -fschedule-insns, but requests an additional pass of
7936 instruction scheduling after register allocation has been done.
7937 This is especially useful on machines with a relatively small
7938 number of registers and where memory load instructions take more
7939 than one cycle.
7940
7941 Enabled at levels -O2, -O3, -Os.
7942
7943 -fno-sched-interblock
7944 Disable instruction scheduling across basic blocks, which is
7945 normally enabled when scheduling before register allocation, i.e.
7946 with -fschedule-insns or at -O2 or higher.
7947
7948 -fno-sched-spec
7949 Disable speculative motion of non-load instructions, which is
7950 normally enabled when scheduling before register allocation, i.e.
7951 with -fschedule-insns or at -O2 or higher.
7952
7953 -fsched-pressure
7954 Enable register pressure sensitive insn scheduling before register
7955 allocation. This only makes sense when scheduling before register
7956 allocation is enabled, i.e. with -fschedule-insns or at -O2 or
7957 higher. Usage of this option can improve the generated code and
7958 decrease its size by preventing register pressure increase above
7959 the number of available hard registers and subsequent spills in
7960 register allocation.
7961
7962 -fsched-spec-load
7963 Allow speculative motion of some load instructions. This only
7964 makes sense when scheduling before register allocation, i.e. with
7965 -fschedule-insns or at -O2 or higher.
7966
7967 -fsched-spec-load-dangerous
7968 Allow speculative motion of more load instructions. This only
7969 makes sense when scheduling before register allocation, i.e. with
7970 -fschedule-insns or at -O2 or higher.
7971
7972 -fsched-stalled-insns
7973 -fsched-stalled-insns=n
7974 Define how many insns (if any) can be moved prematurely from the
7975 queue of stalled insns into the ready list during the second
7976 scheduling pass. -fno-sched-stalled-insns means that no insns are
7977 moved prematurely, -fsched-stalled-insns=0 means there is no limit
7978 on how many queued insns can be moved prematurely.
7979 -fsched-stalled-insns without a value is equivalent to
7980 -fsched-stalled-insns=1.
7981
7982 -fsched-stalled-insns-dep
7983 -fsched-stalled-insns-dep=n
7984 Define how many insn groups (cycles) are examined for a dependency
7985 on a stalled insn that is a candidate for premature removal from
7986 the queue of stalled insns. This has an effect only during the
7987 second scheduling pass, and only if -fsched-stalled-insns is used.
7988 -fno-sched-stalled-insns-dep is equivalent to
7989 -fsched-stalled-insns-dep=0. -fsched-stalled-insns-dep without a
7990 value is equivalent to -fsched-stalled-insns-dep=1.
7991
7992 -fsched2-use-superblocks
7993 When scheduling after register allocation, use superblock
7994 scheduling. This allows motion across basic block boundaries,
7995 resulting in faster schedules. This option is experimental, as not
7996 all machine descriptions used by GCC model the CPU closely enough
7997 to avoid unreliable results from the algorithm.
7998
7999 This only makes sense when scheduling after register allocation,
8000 i.e. with -fschedule-insns2 or at -O2 or higher.
8001
8002 -fsched-group-heuristic
8003 Enable the group heuristic in the scheduler. This heuristic favors
8004 the instruction that belongs to a schedule group. This is enabled
8005 by default when scheduling is enabled, i.e. with -fschedule-insns
8006 or -fschedule-insns2 or at -O2 or higher.
8007
8008 -fsched-critical-path-heuristic
8009 Enable the critical-path heuristic in the scheduler. This
8010 heuristic favors instructions on the critical path. This is
8011 enabled by default when scheduling is enabled, i.e. with
8012 -fschedule-insns or -fschedule-insns2 or at -O2 or higher.
8013
8014 -fsched-spec-insn-heuristic
8015 Enable the speculative instruction heuristic in the scheduler.
8016 This heuristic favors speculative instructions with greater
8017 dependency weakness. This is enabled by default when scheduling is
8018 enabled, i.e. with -fschedule-insns or -fschedule-insns2 or at -O2
8019 or higher.
8020
8021 -fsched-rank-heuristic
8022 Enable the rank heuristic in the scheduler. This heuristic favors
8023 the instruction belonging to a basic block with greater size or
8024 frequency. This is enabled by default when scheduling is enabled,
8025 i.e. with -fschedule-insns or -fschedule-insns2 or at -O2 or
8026 higher.
8027
8028 -fsched-last-insn-heuristic
8029 Enable the last-instruction heuristic in the scheduler. This
8030 heuristic favors the instruction that is less dependent on the last
8031 instruction scheduled. This is enabled by default when scheduling
8032 is enabled, i.e. with -fschedule-insns or -fschedule-insns2 or at
8033 -O2 or higher.
8034
8035 -fsched-dep-count-heuristic
8036 Enable the dependent-count heuristic in the scheduler. This
8037 heuristic favors the instruction that has more instructions
8038 depending on it. This is enabled by default when scheduling is
8039 enabled, i.e. with -fschedule-insns or -fschedule-insns2 or at -O2
8040 or higher.
8041
8042 -freschedule-modulo-scheduled-loops
8043 Modulo scheduling is performed before traditional scheduling. If a
8044 loop is modulo scheduled, later scheduling passes may change its
8045 schedule. Use this option to control that behavior.
8046
8047 -fselective-scheduling
8048 Schedule instructions using selective scheduling algorithm.
8049 Selective scheduling runs instead of the first scheduler pass.
8050
8051 -fselective-scheduling2
8052 Schedule instructions using selective scheduling algorithm.
8053 Selective scheduling runs instead of the second scheduler pass.
8054
8055 -fsel-sched-pipelining
8056 Enable software pipelining of innermost loops during selective
8057 scheduling. This option has no effect unless one of
8058 -fselective-scheduling or -fselective-scheduling2 is turned on.
8059
8060 -fsel-sched-pipelining-outer-loops
8061 When pipelining loops during selective scheduling, also pipeline
8062 outer loops. This option has no effect unless
8063 -fsel-sched-pipelining is turned on.
8064
8065 -fsemantic-interposition
8066 Some object formats, like ELF, allow interposing of symbols by the
8067 dynamic linker. This means that for symbols exported from the DSO,
8068 the compiler cannot perform interprocedural propagation, inlining
8069 and other optimizations in anticipation that the function or
8070 variable in question may change. While this feature is useful, for
8071 example, to rewrite memory allocation functions by a debugging
8072 implementation, it is expensive in the terms of code quality. With
8073 -fno-semantic-interposition the compiler assumes that if
8074 interposition happens for functions the overwriting function will
8075 have precisely the same semantics (and side effects). Similarly if
8076 interposition happens for variables, the constructor of the
8077 variable will be the same. The flag has no effect for functions
8078 explicitly declared inline (where it is never allowed for
8079 interposition to change semantics) and for symbols explicitly
8080 declared weak.
8081
8082 -fshrink-wrap
8083 Emit function prologues only before parts of the function that need
8084 it, rather than at the top of the function. This flag is enabled
8085 by default at -O and higher.
8086
8087 -fshrink-wrap-separate
8088 Shrink-wrap separate parts of the prologue and epilogue separately,
8089 so that those parts are only executed when needed. This option is
8090 on by default, but has no effect unless -fshrink-wrap is also
8091 turned on and the target supports this.
8092
8093 -fcaller-saves
8094 Enable allocation of values to registers that are clobbered by
8095 function calls, by emitting extra instructions to save and restore
8096 the registers around such calls. Such allocation is done only when
8097 it seems to result in better code.
8098
8099 This option is always enabled by default on certain machines,
8100 usually those which have no call-preserved registers to use
8101 instead.
8102
8103 Enabled at levels -O2, -O3, -Os.
8104
8105 -fcombine-stack-adjustments
8106 Tracks stack adjustments (pushes and pops) and stack memory
8107 references and then tries to find ways to combine them.
8108
8109 Enabled by default at -O1 and higher.
8110
8111 -fipa-ra
8112 Use caller save registers for allocation if those registers are not
8113 used by any called function. In that case it is not necessary to
8114 save and restore them around calls. This is only possible if
8115 called functions are part of same compilation unit as current
8116 function and they are compiled before it.
8117
8118 Enabled at levels -O2, -O3, -Os, however the option is disabled if
8119 generated code will be instrumented for profiling (-p, or -pg) or
8120 if callee's register usage cannot be known exactly (this happens on
8121 targets that do not expose prologues and epilogues in RTL).
8122
8123 -fconserve-stack
8124 Attempt to minimize stack usage. The compiler attempts to use less
8125 stack space, even if that makes the program slower. This option
8126 implies setting the large-stack-frame parameter to 100 and the
8127 large-stack-frame-growth parameter to 400.
8128
8129 -ftree-reassoc
8130 Perform reassociation on trees. This flag is enabled by default at
8131 -O and higher.
8132
8133 -fcode-hoisting
8134 Perform code hoisting. Code hoisting tries to move the evaluation
8135 of expressions executed on all paths to the function exit as early
8136 as possible. This is especially useful as a code size
8137 optimization, but it often helps for code speed as well. This flag
8138 is enabled by default at -O2 and higher.
8139
8140 -ftree-pre
8141 Perform partial redundancy elimination (PRE) on trees. This flag
8142 is enabled by default at -O2 and -O3.
8143
8144 -ftree-partial-pre
8145 Make partial redundancy elimination (PRE) more aggressive. This
8146 flag is enabled by default at -O3.
8147
8148 -ftree-forwprop
8149 Perform forward propagation on trees. This flag is enabled by
8150 default at -O and higher.
8151
8152 -ftree-fre
8153 Perform full redundancy elimination (FRE) on trees. The difference
8154 between FRE and PRE is that FRE only considers expressions that are
8155 computed on all paths leading to the redundant computation. This
8156 analysis is faster than PRE, though it exposes fewer redundancies.
8157 This flag is enabled by default at -O and higher.
8158
8159 -ftree-phiprop
8160 Perform hoisting of loads from conditional pointers on trees. This
8161 pass is enabled by default at -O and higher.
8162
8163 -fhoist-adjacent-loads
8164 Speculatively hoist loads from both branches of an if-then-else if
8165 the loads are from adjacent locations in the same structure and the
8166 target architecture has a conditional move instruction. This flag
8167 is enabled by default at -O2 and higher.
8168
8169 -ftree-copy-prop
8170 Perform copy propagation on trees. This pass eliminates
8171 unnecessary copy operations. This flag is enabled by default at -O
8172 and higher.
8173
8174 -fipa-pure-const
8175 Discover which functions are pure or constant. Enabled by default
8176 at -O and higher.
8177
8178 -fipa-reference
8179 Discover which static variables do not escape the compilation unit.
8180 Enabled by default at -O and higher.
8181
8182 -fipa-reference-addressable
8183 Discover read-only, write-only and non-addressable static
8184 variables. Enabled by default at -O and higher.
8185
8186 -fipa-stack-alignment
8187 Reduce stack alignment on call sites if possible. Enabled by
8188 default.
8189
8190 -fipa-pta
8191 Perform interprocedural pointer analysis and interprocedural
8192 modification and reference analysis. This option can cause
8193 excessive memory and compile-time usage on large compilation units.
8194 It is not enabled by default at any optimization level.
8195
8196 -fipa-profile
8197 Perform interprocedural profile propagation. The functions called
8198 only from cold functions are marked as cold. Also functions
8199 executed once (such as "cold", "noreturn", static constructors or
8200 destructors) are identified. Cold functions and loop less parts of
8201 functions executed once are then optimized for size. Enabled by
8202 default at -O and higher.
8203
8204 -fipa-cp
8205 Perform interprocedural constant propagation. This optimization
8206 analyzes the program to determine when values passed to functions
8207 are constants and then optimizes accordingly. This optimization
8208 can substantially increase performance if the application has
8209 constants passed to functions. This flag is enabled by default at
8210 -O2, -Os and -O3. It is also enabled by -fprofile-use and
8211 -fauto-profile.
8212
8213 -fipa-cp-clone
8214 Perform function cloning to make interprocedural constant
8215 propagation stronger. When enabled, interprocedural constant
8216 propagation performs function cloning when externally visible
8217 function can be called with constant arguments. Because this
8218 optimization can create multiple copies of functions, it may
8219 significantly increase code size (see --param
8220 ipcp-unit-growth=value). This flag is enabled by default at -O3.
8221 It is also enabled by -fprofile-use and -fauto-profile.
8222
8223 -fipa-bit-cp
8224 When enabled, perform interprocedural bitwise constant propagation.
8225 This flag is enabled by default at -O2 and by -fprofile-use and
8226 -fauto-profile. It requires that -fipa-cp is enabled.
8227
8228 -fipa-vrp
8229 When enabled, perform interprocedural propagation of value ranges.
8230 This flag is enabled by default at -O2. It requires that -fipa-cp
8231 is enabled.
8232
8233 -fipa-icf
8234 Perform Identical Code Folding for functions and read-only
8235 variables. The optimization reduces code size and may disturb
8236 unwind stacks by replacing a function by equivalent one with a
8237 different name. The optimization works more effectively with link-
8238 time optimization enabled.
8239
8240 Although the behavior is similar to the Gold Linker's ICF
8241 optimization, GCC ICF works on different levels and thus the
8242 optimizations are not same - there are equivalences that are found
8243 only by GCC and equivalences found only by Gold.
8244
8245 This flag is enabled by default at -O2 and -Os.
8246
8247 -flive-patching=level
8248 Control GCC's optimizations to produce output suitable for live-
8249 patching.
8250
8251 If the compiler's optimization uses a function's body or
8252 information extracted from its body to optimize/change another
8253 function, the latter is called an impacted function of the former.
8254 If a function is patched, its impacted functions should be patched
8255 too.
8256
8257 The impacted functions are determined by the compiler's
8258 interprocedural optimizations. For example, a caller is impacted
8259 when inlining a function into its caller, cloning a function and
8260 changing its caller to call this new clone, or extracting a
8261 function's pureness/constness information to optimize its direct or
8262 indirect callers, etc.
8263
8264 Usually, the more IPA optimizations enabled, the larger the number
8265 of impacted functions for each function. In order to control the
8266 number of impacted functions and more easily compute the list of
8267 impacted function, IPA optimizations can be partially enabled at
8268 two different levels.
8269
8270 The level argument should be one of the following:
8271
8272 inline-clone
8273 Only enable inlining and cloning optimizations, which includes
8274 inlining, cloning, interprocedural scalar replacement of
8275 aggregates and partial inlining. As a result, when patching a
8276 function, all its callers and its clones' callers are impacted,
8277 therefore need to be patched as well.
8278
8279 -flive-patching=inline-clone disables the following
8280 optimization flags: -fwhole-program -fipa-pta -fipa-reference
8281 -fipa-ra -fipa-icf -fipa-icf-functions -fipa-icf-variables
8282 -fipa-bit-cp -fipa-vrp -fipa-pure-const
8283 -fipa-reference-addressable -fipa-stack-alignment
8284
8285 inline-only-static
8286 Only enable inlining of static functions. As a result, when
8287 patching a static function, all its callers are impacted and so
8288 need to be patched as well.
8289
8290 In addition to all the flags that -flive-patching=inline-clone
8291 disables, -flive-patching=inline-only-static disables the
8292 following additional optimization flags: -fipa-cp-clone
8293 -fipa-sra -fpartial-inlining -fipa-cp
8294
8295 When -flive-patching is specified without any value, the default
8296 value is inline-clone.
8297
8298 This flag is disabled by default.
8299
8300 Note that -flive-patching is not supported with link-time
8301 optimization (-flto).
8302
8303 -fisolate-erroneous-paths-dereference
8304 Detect paths that trigger erroneous or undefined behavior due to
8305 dereferencing a null pointer. Isolate those paths from the main
8306 control flow and turn the statement with erroneous or undefined
8307 behavior into a trap. This flag is enabled by default at -O2 and
8308 higher and depends on -fdelete-null-pointer-checks also being
8309 enabled.
8310
8311 -fisolate-erroneous-paths-attribute
8312 Detect paths that trigger erroneous or undefined behavior due to a
8313 null value being used in a way forbidden by a "returns_nonnull" or
8314 "nonnull" attribute. Isolate those paths from the main control
8315 flow and turn the statement with erroneous or undefined behavior
8316 into a trap. This is not currently enabled, but may be enabled by
8317 -O2 in the future.
8318
8319 -ftree-sink
8320 Perform forward store motion on trees. This flag is enabled by
8321 default at -O and higher.
8322
8323 -ftree-bit-ccp
8324 Perform sparse conditional bit constant propagation on trees and
8325 propagate pointer alignment information. This pass only operates
8326 on local scalar variables and is enabled by default at -O1 and
8327 higher, except for -Og. It requires that -ftree-ccp is enabled.
8328
8329 -ftree-ccp
8330 Perform sparse conditional constant propagation (CCP) on trees.
8331 This pass only operates on local scalar variables and is enabled by
8332 default at -O and higher.
8333
8334 -fssa-backprop
8335 Propagate information about uses of a value up the definition chain
8336 in order to simplify the definitions. For example, this pass
8337 strips sign operations if the sign of a value never matters. The
8338 flag is enabled by default at -O and higher.
8339
8340 -fssa-phiopt
8341 Perform pattern matching on SSA PHI nodes to optimize conditional
8342 code. This pass is enabled by default at -O1 and higher, except
8343 for -Og.
8344
8345 -ftree-switch-conversion
8346 Perform conversion of simple initializations in a switch to
8347 initializations from a scalar array. This flag is enabled by
8348 default at -O2 and higher.
8349
8350 -ftree-tail-merge
8351 Look for identical code sequences. When found, replace one with a
8352 jump to the other. This optimization is known as tail merging or
8353 cross jumping. This flag is enabled by default at -O2 and higher.
8354 The compilation time in this pass can be limited using max-tail-
8355 merge-comparisons parameter and max-tail-merge-iterations
8356 parameter.
8357
8358 -ftree-dce
8359 Perform dead code elimination (DCE) on trees. This flag is enabled
8360 by default at -O and higher.
8361
8362 -ftree-builtin-call-dce
8363 Perform conditional dead code elimination (DCE) for calls to built-
8364 in functions that may set "errno" but are otherwise free of side
8365 effects. This flag is enabled by default at -O2 and higher if -Os
8366 is not also specified.
8367
8368 -ffinite-loops
8369 Assume that a loop with an exit will eventually take the exit and
8370 not loop indefinitely. This allows the compiler to remove loops
8371 that otherwise have no side-effects, not considering eventual
8372 endless looping as such.
8373
8374 This option is enabled by default at -O2 for C++ with -std=c++11 or
8375 higher.
8376
8377 -ftree-dominator-opts
8378 Perform a variety of simple scalar cleanups (constant/copy
8379 propagation, redundancy elimination, range propagation and
8380 expression simplification) based on a dominator tree traversal.
8381 This also performs jump threading (to reduce jumps to jumps). This
8382 flag is enabled by default at -O and higher.
8383
8384 -ftree-dse
8385 Perform dead store elimination (DSE) on trees. A dead store is a
8386 store into a memory location that is later overwritten by another
8387 store without any intervening loads. In this case the earlier
8388 store can be deleted. This flag is enabled by default at -O and
8389 higher.
8390
8391 -ftree-ch
8392 Perform loop header copying on trees. This is beneficial since it
8393 increases effectiveness of code motion optimizations. It also
8394 saves one jump. This flag is enabled by default at -O and higher.
8395 It is not enabled for -Os, since it usually increases code size.
8396
8397 -ftree-loop-optimize
8398 Perform loop optimizations on trees. This flag is enabled by
8399 default at -O and higher.
8400
8401 -ftree-loop-linear
8402 -floop-strip-mine
8403 -floop-block
8404 Perform loop nest optimizations. Same as -floop-nest-optimize. To
8405 use this code transformation, GCC has to be configured with
8406 --with-isl to enable the Graphite loop transformation
8407 infrastructure.
8408
8409 -fgraphite-identity
8410 Enable the identity transformation for graphite. For every SCoP we
8411 generate the polyhedral representation and transform it back to
8412 gimple. Using -fgraphite-identity we can check the costs or
8413 benefits of the GIMPLE -> GRAPHITE -> GIMPLE transformation. Some
8414 minimal optimizations are also performed by the code generator isl,
8415 like index splitting and dead code elimination in loops.
8416
8417 -floop-nest-optimize
8418 Enable the isl based loop nest optimizer. This is a generic loop
8419 nest optimizer based on the Pluto optimization algorithms. It
8420 calculates a loop structure optimized for data-locality and
8421 parallelism. This option is experimental.
8422
8423 -floop-parallelize-all
8424 Use the Graphite data dependence analysis to identify loops that
8425 can be parallelized. Parallelize all the loops that can be
8426 analyzed to not contain loop carried dependences without checking
8427 that it is profitable to parallelize the loops.
8428
8429 -ftree-coalesce-vars
8430 While transforming the program out of the SSA representation,
8431 attempt to reduce copying by coalescing versions of different user-
8432 defined variables, instead of just compiler temporaries. This may
8433 severely limit the ability to debug an optimized program compiled
8434 with -fno-var-tracking-assignments. In the negated form, this flag
8435 prevents SSA coalescing of user variables. This option is enabled
8436 by default if optimization is enabled, and it does very little
8437 otherwise.
8438
8439 -ftree-loop-if-convert
8440 Attempt to transform conditional jumps in the innermost loops to
8441 branch-less equivalents. The intent is to remove control-flow from
8442 the innermost loops in order to improve the ability of the
8443 vectorization pass to handle these loops. This is enabled by
8444 default if vectorization is enabled.
8445
8446 -ftree-loop-distribution
8447 Perform loop distribution. This flag can improve cache performance
8448 on big loop bodies and allow further loop optimizations, like
8449 parallelization or vectorization, to take place. For example, the
8450 loop
8451
8452 DO I = 1, N
8453 A(I) = B(I) + C
8454 D(I) = E(I) * F
8455 ENDDO
8456
8457 is transformed to
8458
8459 DO I = 1, N
8460 A(I) = B(I) + C
8461 ENDDO
8462 DO I = 1, N
8463 D(I) = E(I) * F
8464 ENDDO
8465
8466 This flag is enabled by default at -O3. It is also enabled by
8467 -fprofile-use and -fauto-profile.
8468
8469 -ftree-loop-distribute-patterns
8470 Perform loop distribution of patterns that can be code generated
8471 with calls to a library. This flag is enabled by default at -O2
8472 and higher, and by -fprofile-use and -fauto-profile.
8473
8474 This pass distributes the initialization loops and generates a call
8475 to memset zero. For example, the loop
8476
8477 DO I = 1, N
8478 A(I) = 0
8479 B(I) = A(I) + I
8480 ENDDO
8481
8482 is transformed to
8483
8484 DO I = 1, N
8485 A(I) = 0
8486 ENDDO
8487 DO I = 1, N
8488 B(I) = A(I) + I
8489 ENDDO
8490
8491 and the initialization loop is transformed into a call to memset
8492 zero. This flag is enabled by default at -O3. It is also enabled
8493 by -fprofile-use and -fauto-profile.
8494
8495 -floop-interchange
8496 Perform loop interchange outside of graphite. This flag can
8497 improve cache performance on loop nest and allow further loop
8498 optimizations, like vectorization, to take place. For example, the
8499 loop
8500
8501 for (int i = 0; i < N; i++)
8502 for (int j = 0; j < N; j++)
8503 for (int k = 0; k < N; k++)
8504 c[i][j] = c[i][j] + a[i][k]*b[k][j];
8505
8506 is transformed to
8507
8508 for (int i = 0; i < N; i++)
8509 for (int k = 0; k < N; k++)
8510 for (int j = 0; j < N; j++)
8511 c[i][j] = c[i][j] + a[i][k]*b[k][j];
8512
8513 This flag is enabled by default at -O3. It is also enabled by
8514 -fprofile-use and -fauto-profile.
8515
8516 -floop-unroll-and-jam
8517 Apply unroll and jam transformations on feasible loops. In a loop
8518 nest this unrolls the outer loop by some factor and fuses the
8519 resulting multiple inner loops. This flag is enabled by default at
8520 -O3. It is also enabled by -fprofile-use and -fauto-profile.
8521
8522 -ftree-loop-im
8523 Perform loop invariant motion on trees. This pass moves only
8524 invariants that are hard to handle at RTL level (function calls,
8525 operations that expand to nontrivial sequences of insns). With
8526 -funswitch-loops it also moves operands of conditions that are
8527 invariant out of the loop, so that we can use just trivial
8528 invariantness analysis in loop unswitching. The pass also includes
8529 store motion.
8530
8531 -ftree-loop-ivcanon
8532 Create a canonical counter for number of iterations in loops for
8533 which determining number of iterations requires complicated
8534 analysis. Later optimizations then may determine the number
8535 easily. Useful especially in connection with unrolling.
8536
8537 -ftree-scev-cprop
8538 Perform final value replacement. If a variable is modified in a
8539 loop in such a way that its value when exiting the loop can be
8540 determined using only its initial value and the number of loop
8541 iterations, replace uses of the final value by such a computation,
8542 provided it is sufficiently cheap. This reduces data dependencies
8543 and may allow further simplifications. Enabled by default at -O
8544 and higher.
8545
8546 -fivopts
8547 Perform induction variable optimizations (strength reduction,
8548 induction variable merging and induction variable elimination) on
8549 trees.
8550
8551 -ftree-parallelize-loops=n
8552 Parallelize loops, i.e., split their iteration space to run in n
8553 threads. This is only possible for loops whose iterations are
8554 independent and can be arbitrarily reordered. The optimization is
8555 only profitable on multiprocessor machines, for loops that are CPU-
8556 intensive, rather than constrained e.g. by memory bandwidth. This
8557 option implies -pthread, and thus is only supported on targets that
8558 have support for -pthread.
8559
8560 -ftree-pta
8561 Perform function-local points-to analysis on trees. This flag is
8562 enabled by default at -O1 and higher, except for -Og.
8563
8564 -ftree-sra
8565 Perform scalar replacement of aggregates. This pass replaces
8566 structure references with scalars to prevent committing structures
8567 to memory too early. This flag is enabled by default at -O1 and
8568 higher, except for -Og.
8569
8570 -fstore-merging
8571 Perform merging of narrow stores to consecutive memory addresses.
8572 This pass merges contiguous stores of immediate values narrower
8573 than a word into fewer wider stores to reduce the number of
8574 instructions. This is enabled by default at -O2 and higher as well
8575 as -Os.
8576
8577 -ftree-ter
8578 Perform temporary expression replacement during the SSA->normal
8579 phase. Single use/single def temporaries are replaced at their use
8580 location with their defining expression. This results in non-
8581 GIMPLE code, but gives the expanders much more complex trees to
8582 work on resulting in better RTL generation. This is enabled by
8583 default at -O and higher.
8584
8585 -ftree-slsr
8586 Perform straight-line strength reduction on trees. This recognizes
8587 related expressions involving multiplications and replaces them by
8588 less expensive calculations when possible. This is enabled by
8589 default at -O and higher.
8590
8591 -ftree-vectorize
8592 Perform vectorization on trees. This flag enables
8593 -ftree-loop-vectorize and -ftree-slp-vectorize if not explicitly
8594 specified.
8595
8596 -ftree-loop-vectorize
8597 Perform loop vectorization on trees. This flag is enabled by
8598 default at -O3 and by -ftree-vectorize, -fprofile-use, and
8599 -fauto-profile.
8600
8601 -ftree-slp-vectorize
8602 Perform basic block vectorization on trees. This flag is enabled by
8603 default at -O3 and by -ftree-vectorize, -fprofile-use, and
8604 -fauto-profile.
8605
8606 -fvect-cost-model=model
8607 Alter the cost model used for vectorization. The model argument
8608 should be one of unlimited, dynamic or cheap. With the unlimited
8609 model the vectorized code-path is assumed to be profitable while
8610 with the dynamic model a runtime check guards the vectorized code-
8611 path to enable it only for iteration counts that will likely
8612 execute faster than when executing the original scalar loop. The
8613 cheap model disables vectorization of loops where doing so would be
8614 cost prohibitive for example due to required runtime checks for
8615 data dependence or alignment but otherwise is equal to the dynamic
8616 model. The default cost model depends on other optimization flags
8617 and is either dynamic or cheap.
8618
8619 -fsimd-cost-model=model
8620 Alter the cost model used for vectorization of loops marked with
8621 the OpenMP simd directive. The model argument should be one of
8622 unlimited, dynamic, cheap. All values of model have the same
8623 meaning as described in -fvect-cost-model and by default a cost
8624 model defined with -fvect-cost-model is used.
8625
8626 -ftree-vrp
8627 Perform Value Range Propagation on trees. This is similar to the
8628 constant propagation pass, but instead of values, ranges of values
8629 are propagated. This allows the optimizers to remove unnecessary
8630 range checks like array bound checks and null pointer checks. This
8631 is enabled by default at -O2 and higher. Null pointer check
8632 elimination is only done if -fdelete-null-pointer-checks is
8633 enabled.
8634
8635 -fsplit-paths
8636 Split paths leading to loop backedges. This can improve dead code
8637 elimination and common subexpression elimination. This is enabled
8638 by default at -O3 and above.
8639
8640 -fsplit-ivs-in-unroller
8641 Enables expression of values of induction variables in later
8642 iterations of the unrolled loop using the value in the first
8643 iteration. This breaks long dependency chains, thus improving
8644 efficiency of the scheduling passes.
8645
8646 A combination of -fweb and CSE is often sufficient to obtain the
8647 same effect. However, that is not reliable in cases where the loop
8648 body is more complicated than a single basic block. It also does
8649 not work at all on some architectures due to restrictions in the
8650 CSE pass.
8651
8652 This optimization is enabled by default.
8653
8654 -fvariable-expansion-in-unroller
8655 With this option, the compiler creates multiple copies of some
8656 local variables when unrolling a loop, which can result in superior
8657 code.
8658
8659 This optimization is enabled by default for PowerPC targets, but
8660 disabled by default otherwise.
8661
8662 -fpartial-inlining
8663 Inline parts of functions. This option has any effect only when
8664 inlining itself is turned on by the -finline-functions or
8665 -finline-small-functions options.
8666
8667 Enabled at levels -O2, -O3, -Os.
8668
8669 -fpredictive-commoning
8670 Perform predictive commoning optimization, i.e., reusing
8671 computations (especially memory loads and stores) performed in
8672 previous iterations of loops.
8673
8674 This option is enabled at level -O3. It is also enabled by
8675 -fprofile-use and -fauto-profile.
8676
8677 -fprefetch-loop-arrays
8678 If supported by the target machine, generate instructions to
8679 prefetch memory to improve the performance of loops that access
8680 large arrays.
8681
8682 This option may generate better or worse code; results are highly
8683 dependent on the structure of loops within the source code.
8684
8685 Disabled at level -Os.
8686
8687 -fno-printf-return-value
8688 Do not substitute constants for known return value of formatted
8689 output functions such as "sprintf", "snprintf", "vsprintf", and
8690 "vsnprintf" (but not "printf" of "fprintf"). This transformation
8691 allows GCC to optimize or even eliminate branches based on the
8692 known return value of these functions called with arguments that
8693 are either constant, or whose values are known to be in a range
8694 that makes determining the exact return value possible. For
8695 example, when -fprintf-return-value is in effect, both the branch
8696 and the body of the "if" statement (but not the call to "snprint")
8697 can be optimized away when "i" is a 32-bit or smaller integer
8698 because the return value is guaranteed to be at most 8.
8699
8700 char buf[9];
8701 if (snprintf (buf, "%08x", i) >= sizeof buf)
8702 ...
8703
8704 The -fprintf-return-value option relies on other optimizations and
8705 yields best results with -O2 and above. It works in tandem with
8706 the -Wformat-overflow and -Wformat-truncation options. The
8707 -fprintf-return-value option is enabled by default.
8708
8709 -fno-peephole
8710 -fno-peephole2
8711 Disable any machine-specific peephole optimizations. The
8712 difference between -fno-peephole and -fno-peephole2 is in how they
8713 are implemented in the compiler; some targets use one, some use the
8714 other, a few use both.
8715
8716 -fpeephole is enabled by default. -fpeephole2 enabled at levels
8717 -O2, -O3, -Os.
8718
8719 -fno-guess-branch-probability
8720 Do not guess branch probabilities using heuristics.
8721
8722 GCC uses heuristics to guess branch probabilities if they are not
8723 provided by profiling feedback (-fprofile-arcs). These heuristics
8724 are based on the control flow graph. If some branch probabilities
8725 are specified by "__builtin_expect", then the heuristics are used
8726 to guess branch probabilities for the rest of the control flow
8727 graph, taking the "__builtin_expect" info into account. The
8728 interactions between the heuristics and "__builtin_expect" can be
8729 complex, and in some cases, it may be useful to disable the
8730 heuristics so that the effects of "__builtin_expect" are easier to
8731 understand.
8732
8733 It is also possible to specify expected probability of the
8734 expression with "__builtin_expect_with_probability" built-in
8735 function.
8736
8737 The default is -fguess-branch-probability at levels -O, -O2, -O3,
8738 -Os.
8739
8740 -freorder-blocks
8741 Reorder basic blocks in the compiled function in order to reduce
8742 number of taken branches and improve code locality.
8743
8744 Enabled at levels -O, -O2, -O3, -Os.
8745
8746 -freorder-blocks-algorithm=algorithm
8747 Use the specified algorithm for basic block reordering. The
8748 algorithm argument can be simple, which does not increase code size
8749 (except sometimes due to secondary effects like alignment), or stc,
8750 the "software trace cache" algorithm, which tries to put all often
8751 executed code together, minimizing the number of branches executed
8752 by making extra copies of code.
8753
8754 The default is simple at levels -O, -Os, and stc at levels -O2,
8755 -O3.
8756
8757 -freorder-blocks-and-partition
8758 In addition to reordering basic blocks in the compiled function, in
8759 order to reduce number of taken branches, partitions hot and cold
8760 basic blocks into separate sections of the assembly and .o files,
8761 to improve paging and cache locality performance.
8762
8763 This optimization is automatically turned off in the presence of
8764 exception handling or unwind tables (on targets using
8765 setjump/longjump or target specific scheme), for linkonce sections,
8766 for functions with a user-defined section attribute and on any
8767 architecture that does not support named sections. When
8768 -fsplit-stack is used this option is not enabled by default (to
8769 avoid linker errors), but may be enabled explicitly (if using a
8770 working linker).
8771
8772 Enabled for x86 at levels -O2, -O3, -Os.
8773
8774 -freorder-functions
8775 Reorder functions in the object file in order to improve code
8776 locality. This is implemented by using special subsections
8777 ".text.hot" for most frequently executed functions and
8778 ".text.unlikely" for unlikely executed functions. Reordering is
8779 done by the linker so object file format must support named
8780 sections and linker must place them in a reasonable way.
8781
8782 This option isn't effective unless you either provide profile
8783 feedback (see -fprofile-arcs for details) or manually annotate
8784 functions with "hot" or "cold" attributes.
8785
8786 Enabled at levels -O2, -O3, -Os.
8787
8788 -fstrict-aliasing
8789 Allow the compiler to assume the strictest aliasing rules
8790 applicable to the language being compiled. For C (and C++), this
8791 activates optimizations based on the type of expressions. In
8792 particular, an object of one type is assumed never to reside at the
8793 same address as an object of a different type, unless the types are
8794 almost the same. For example, an "unsigned int" can alias an
8795 "int", but not a "void*" or a "double". A character type may alias
8796 any other type.
8797
8798 Pay special attention to code like this:
8799
8800 union a_union {
8801 int i;
8802 double d;
8803 };
8804
8805 int f() {
8806 union a_union t;
8807 t.d = 3.0;
8808 return t.i;
8809 }
8810
8811 The practice of reading from a different union member than the one
8812 most recently written to (called "type-punning") is common. Even
8813 with -fstrict-aliasing, type-punning is allowed, provided the
8814 memory is accessed through the union type. So, the code above
8815 works as expected. However, this code might not:
8816
8817 int f() {
8818 union a_union t;
8819 int* ip;
8820 t.d = 3.0;
8821 ip = &t.i;
8822 return *ip;
8823 }
8824
8825 Similarly, access by taking the address, casting the resulting
8826 pointer and dereferencing the result has undefined behavior, even
8827 if the cast uses a union type, e.g.:
8828
8829 int f() {
8830 double d = 3.0;
8831 return ((union a_union *) &d)->i;
8832 }
8833
8834 The -fstrict-aliasing option is enabled at levels -O2, -O3, -Os.
8835
8836 -falign-functions
8837 -falign-functions=n
8838 -falign-functions=n:m
8839 -falign-functions=n:m:n2
8840 -falign-functions=n:m:n2:m2
8841 Align the start of functions to the next power-of-two greater than
8842 or equal to n, skipping up to m-1 bytes. This ensures that at
8843 least the first m bytes of the function can be fetched by the CPU
8844 without crossing an n-byte alignment boundary.
8845
8846 If m is not specified, it defaults to n.
8847
8848 Examples: -falign-functions=32 aligns functions to the next 32-byte
8849 boundary, -falign-functions=24 aligns to the next 32-byte boundary
8850 only if this can be done by skipping 23 bytes or less,
8851 -falign-functions=32:7 aligns to the next 32-byte boundary only if
8852 this can be done by skipping 6 bytes or less.
8853
8854 The second pair of n2:m2 values allows you to specify a secondary
8855 alignment: -falign-functions=64:7:32:3 aligns to the next 64-byte
8856 boundary if this can be done by skipping 6 bytes or less, otherwise
8857 aligns to the next 32-byte boundary if this can be done by skipping
8858 2 bytes or less. If m2 is not specified, it defaults to n2.
8859
8860 Some assemblers only support this flag when n is a power of two; in
8861 that case, it is rounded up.
8862
8863 -fno-align-functions and -falign-functions=1 are equivalent and
8864 mean that functions are not aligned.
8865
8866 If n is not specified or is zero, use a machine-dependent default.
8867 The maximum allowed n option value is 65536.
8868
8869 Enabled at levels -O2, -O3.
8870
8871 -flimit-function-alignment
8872 If this option is enabled, the compiler tries to avoid
8873 unnecessarily overaligning functions. It attempts to instruct the
8874 assembler to align by the amount specified by -falign-functions,
8875 but not to skip more bytes than the size of the function.
8876
8877 -falign-labels
8878 -falign-labels=n
8879 -falign-labels=n:m
8880 -falign-labels=n:m:n2
8881 -falign-labels=n:m:n2:m2
8882 Align all branch targets to a power-of-two boundary.
8883
8884 Parameters of this option are analogous to the -falign-functions
8885 option. -fno-align-labels and -falign-labels=1 are equivalent and
8886 mean that labels are not aligned.
8887
8888 If -falign-loops or -falign-jumps are applicable and are greater
8889 than this value, then their values are used instead.
8890
8891 If n is not specified or is zero, use a machine-dependent default
8892 which is very likely to be 1, meaning no alignment. The maximum
8893 allowed n option value is 65536.
8894
8895 Enabled at levels -O2, -O3.
8896
8897 -falign-loops
8898 -falign-loops=n
8899 -falign-loops=n:m
8900 -falign-loops=n:m:n2
8901 -falign-loops=n:m:n2:m2
8902 Align loops to a power-of-two boundary. If the loops are executed
8903 many times, this makes up for any execution of the dummy padding
8904 instructions.
8905
8906 If -falign-labels is greater than this value, then its value is
8907 used instead.
8908
8909 Parameters of this option are analogous to the -falign-functions
8910 option. -fno-align-loops and -falign-loops=1 are equivalent and
8911 mean that loops are not aligned. The maximum allowed n option
8912 value is 65536.
8913
8914 If n is not specified or is zero, use a machine-dependent default.
8915
8916 Enabled at levels -O2, -O3.
8917
8918 -falign-jumps
8919 -falign-jumps=n
8920 -falign-jumps=n:m
8921 -falign-jumps=n:m:n2
8922 -falign-jumps=n:m:n2:m2
8923 Align branch targets to a power-of-two boundary, for branch targets
8924 where the targets can only be reached by jumping. In this case, no
8925 dummy operations need be executed.
8926
8927 If -falign-labels is greater than this value, then its value is
8928 used instead.
8929
8930 Parameters of this option are analogous to the -falign-functions
8931 option. -fno-align-jumps and -falign-jumps=1 are equivalent and
8932 mean that loops are not aligned.
8933
8934 If n is not specified or is zero, use a machine-dependent default.
8935 The maximum allowed n option value is 65536.
8936
8937 Enabled at levels -O2, -O3.
8938
8939 -fno-allocation-dce
8940 Do not remove unused C++ allocations in dead code elimination.
8941
8942 -fallow-store-data-races
8943 Allow the compiler to introduce new data races on stores.
8944
8945 Enabled at level -Ofast.
8946
8947 -funit-at-a-time
8948 This option is left for compatibility reasons. -funit-at-a-time has
8949 no effect, while -fno-unit-at-a-time implies -fno-toplevel-reorder
8950 and -fno-section-anchors.
8951
8952 Enabled by default.
8953
8954 -fno-toplevel-reorder
8955 Do not reorder top-level functions, variables, and "asm"
8956 statements. Output them in the same order that they appear in the
8957 input file. When this option is used, unreferenced static
8958 variables are not removed. This option is intended to support
8959 existing code that relies on a particular ordering. For new code,
8960 it is better to use attributes when possible.
8961
8962 -ftoplevel-reorder is the default at -O1 and higher, and also at
8963 -O0 if -fsection-anchors is explicitly requested. Additionally
8964 -fno-toplevel-reorder implies -fno-section-anchors.
8965
8966 -fweb
8967 Constructs webs as commonly used for register allocation purposes
8968 and assign each web individual pseudo register. This allows the
8969 register allocation pass to operate on pseudos directly, but also
8970 strengthens several other optimization passes, such as CSE, loop
8971 optimizer and trivial dead code remover. It can, however, make
8972 debugging impossible, since variables no longer stay in a "home
8973 register".
8974
8975 Enabled by default with -funroll-loops.
8976
8977 -fwhole-program
8978 Assume that the current compilation unit represents the whole
8979 program being compiled. All public functions and variables with
8980 the exception of "main" and those merged by attribute
8981 "externally_visible" become static functions and in effect are
8982 optimized more aggressively by interprocedural optimizers.
8983
8984 This option should not be used in combination with -flto. Instead
8985 relying on a linker plugin should provide safer and more precise
8986 information.
8987
8988 -flto[=n]
8989 This option runs the standard link-time optimizer. When invoked
8990 with source code, it generates GIMPLE (one of GCC's internal
8991 representations) and writes it to special ELF sections in the
8992 object file. When the object files are linked together, all the
8993 function bodies are read from these ELF sections and instantiated
8994 as if they had been part of the same translation unit.
8995
8996 To use the link-time optimizer, -flto and optimization options
8997 should be specified at compile time and during the final link. It
8998 is recommended that you compile all the files participating in the
8999 same link with the same options and also specify those options at
9000 link time. For example:
9001
9002 gcc -c -O2 -flto foo.c
9003 gcc -c -O2 -flto bar.c
9004 gcc -o myprog -flto -O2 foo.o bar.o
9005
9006 The first two invocations to GCC save a bytecode representation of
9007 GIMPLE into special ELF sections inside foo.o and bar.o. The final
9008 invocation reads the GIMPLE bytecode from foo.o and bar.o, merges
9009 the two files into a single internal image, and compiles the result
9010 as usual. Since both foo.o and bar.o are merged into a single
9011 image, this causes all the interprocedural analyses and
9012 optimizations in GCC to work across the two files as if they were a
9013 single one. This means, for example, that the inliner is able to
9014 inline functions in bar.o into functions in foo.o and vice-versa.
9015
9016 Another (simpler) way to enable link-time optimization is:
9017
9018 gcc -o myprog -flto -O2 foo.c bar.c
9019
9020 The above generates bytecode for foo.c and bar.c, merges them
9021 together into a single GIMPLE representation and optimizes them as
9022 usual to produce myprog.
9023
9024 The important thing to keep in mind is that to enable link-time
9025 optimizations you need to use the GCC driver to perform the link
9026 step. GCC automatically performs link-time optimization if any of
9027 the objects involved were compiled with the -flto command-line
9028 option. You can always override the automatic decision to do link-
9029 time optimization by passing -fno-lto to the link command.
9030
9031 To make whole program optimization effective, it is necessary to
9032 make certain whole program assumptions. The compiler needs to know
9033 what functions and variables can be accessed by libraries and
9034 runtime outside of the link-time optimized unit. When supported by
9035 the linker, the linker plugin (see -fuse-linker-plugin) passes
9036 information to the compiler about used and externally visible
9037 symbols. When the linker plugin is not available, -fwhole-program
9038 should be used to allow the compiler to make these assumptions,
9039 which leads to more aggressive optimization decisions.
9040
9041 When a file is compiled with -flto without -fuse-linker-plugin, the
9042 generated object file is larger than a regular object file because
9043 it contains GIMPLE bytecodes and the usual final code (see
9044 -ffat-lto-objects. This means that object files with LTO
9045 information can be linked as normal object files; if -fno-lto is
9046 passed to the linker, no interprocedural optimizations are applied.
9047 Note that when -fno-fat-lto-objects is enabled the compile stage is
9048 faster but you cannot perform a regular, non-LTO link on them.
9049
9050 When producing the final binary, GCC only applies link-time
9051 optimizations to those files that contain bytecode. Therefore, you
9052 can mix and match object files and libraries with GIMPLE bytecodes
9053 and final object code. GCC automatically selects which files to
9054 optimize in LTO mode and which files to link without further
9055 processing.
9056
9057 Generally, options specified at link time override those specified
9058 at compile time, although in some cases GCC attempts to infer link-
9059 time options from the settings used to compile the input files.
9060
9061 If you do not specify an optimization level option -O at link time,
9062 then GCC uses the highest optimization level used when compiling
9063 the object files. Note that it is generally ineffective to specify
9064 an optimization level option only at link time and not at compile
9065 time, for two reasons. First, compiling without optimization
9066 suppresses compiler passes that gather information needed for
9067 effective optimization at link time. Second, some early
9068 optimization passes can be performed only at compile time and not
9069 at link time.
9070
9071 There are some code generation flags preserved by GCC when
9072 generating bytecodes, as they need to be used during the final
9073 link. Currently, the following options and their settings are
9074 taken from the first object file that explicitly specifies them:
9075 -fPIC, -fpic, -fpie, -fcommon, -fexceptions, -fnon-call-exceptions,
9076 -fgnu-tm and all the -m target flags.
9077
9078 Certain ABI-changing flags are required to match in all compilation
9079 units, and trying to override this at link time with a conflicting
9080 value is ignored. This includes options such as
9081 -freg-struct-return and -fpcc-struct-return.
9082
9083 Other options such as -ffp-contract, -fno-strict-overflow, -fwrapv,
9084 -fno-trapv or -fno-strict-aliasing are passed through to the link
9085 stage and merged conservatively for conflicting translation units.
9086 Specifically -fno-strict-overflow, -fwrapv and -fno-trapv take
9087 precedence; and for example -ffp-contract=off takes precedence over
9088 -ffp-contract=fast. You can override them at link time.
9089
9090 When you need to pass options to the assembler via -Wa or
9091 -Xassembler make sure to either compile such translation units with
9092 -fno-lto or consistently use the same assembler options on all
9093 translation units. You can alternatively also specify assembler
9094 options at LTO link time.
9095
9096 To enable debug info generation you need to supply -g at compile
9097 time. If any of the input files at link time were built with debug
9098 info generation enabled the link will enable debug info generation
9099 as well. Any elaborate debug info settings like the dwarf level
9100 -gdwarf-5 need to be explicitly repeated at the linker command line
9101 and mixing different settings in different translation units is
9102 discouraged.
9103
9104 If LTO encounters objects with C linkage declared with incompatible
9105 types in separate translation units to be linked together
9106 (undefined behavior according to ISO C99 6.2.7), a non-fatal
9107 diagnostic may be issued. The behavior is still undefined at run
9108 time. Similar diagnostics may be raised for other languages.
9109
9110 Another feature of LTO is that it is possible to apply
9111 interprocedural optimizations on files written in different
9112 languages:
9113
9114 gcc -c -flto foo.c
9115 g++ -c -flto bar.cc
9116 gfortran -c -flto baz.f90
9117 g++ -o myprog -flto -O3 foo.o bar.o baz.o -lgfortran
9118
9119 Notice that the final link is done with g++ to get the C++ runtime
9120 libraries and -lgfortran is added to get the Fortran runtime
9121 libraries. In general, when mixing languages in LTO mode, you
9122 should use the same link command options as when mixing languages
9123 in a regular (non-LTO) compilation.
9124
9125 If object files containing GIMPLE bytecode are stored in a library
9126 archive, say libfoo.a, it is possible to extract and use them in an
9127 LTO link if you are using a linker with plugin support. To create
9128 static libraries suitable for LTO, use gcc-ar and gcc-ranlib
9129 instead of ar and ranlib; to show the symbols of object files with
9130 GIMPLE bytecode, use gcc-nm. Those commands require that ar,
9131 ranlib and nm have been compiled with plugin support. At link
9132 time, use the flag -fuse-linker-plugin to ensure that the library
9133 participates in the LTO optimization process:
9134
9135 gcc -o myprog -O2 -flto -fuse-linker-plugin a.o b.o -lfoo
9136
9137 With the linker plugin enabled, the linker extracts the needed
9138 GIMPLE files from libfoo.a and passes them on to the running GCC to
9139 make them part of the aggregated GIMPLE image to be optimized.
9140
9141 If you are not using a linker with plugin support and/or do not
9142 enable the linker plugin, then the objects inside libfoo.a are
9143 extracted and linked as usual, but they do not participate in the
9144 LTO optimization process. In order to make a static library
9145 suitable for both LTO optimization and usual linkage, compile its
9146 object files with -flto -ffat-lto-objects.
9147
9148 Link-time optimizations do not require the presence of the whole
9149 program to operate. If the program does not require any symbols to
9150 be exported, it is possible to combine -flto and -fwhole-program to
9151 allow the interprocedural optimizers to use more aggressive
9152 assumptions which may lead to improved optimization opportunities.
9153 Use of -fwhole-program is not needed when linker plugin is active
9154 (see -fuse-linker-plugin).
9155
9156 The current implementation of LTO makes no attempt to generate
9157 bytecode that is portable between different types of hosts. The
9158 bytecode files are versioned and there is a strict version check,
9159 so bytecode files generated in one version of GCC do not work with
9160 an older or newer version of GCC.
9161
9162 Link-time optimization does not work well with generation of
9163 debugging information on systems other than those using a
9164 combination of ELF and DWARF.
9165
9166 If you specify the optional n, the optimization and code generation
9167 done at link time is executed in parallel using n parallel jobs by
9168 utilizing an installed make program. The environment variable MAKE
9169 may be used to override the program used.
9170
9171 You can also specify -flto=jobserver to use GNU make's job server
9172 mode to determine the number of parallel jobs. This is useful when
9173 the Makefile calling GCC is already executing in parallel. You
9174 must prepend a + to the command recipe in the parent Makefile for
9175 this to work. This option likely only works if MAKE is GNU make.
9176 Even without the option value, GCC tries to automatically detect a
9177 running GNU make's job server.
9178
9179 Use -flto=auto to use GNU make's job server, if available, or
9180 otherwise fall back to autodetection of the number of CPU threads
9181 present in your system.
9182
9183 -flto-partition=alg
9184 Specify the partitioning algorithm used by the link-time optimizer.
9185 The value is either 1to1 to specify a partitioning mirroring the
9186 original source files or balanced to specify partitioning into
9187 equally sized chunks (whenever possible) or max to create new
9188 partition for every symbol where possible. Specifying none as an
9189 algorithm disables partitioning and streaming completely. The
9190 default value is balanced. While 1to1 can be used as an workaround
9191 for various code ordering issues, the max partitioning is intended
9192 for internal testing only. The value one specifies that exactly
9193 one partition should be used while the value none bypasses
9194 partitioning and executes the link-time optimization step directly
9195 from the WPA phase.
9196
9197 -flto-compression-level=n
9198 This option specifies the level of compression used for
9199 intermediate language written to LTO object files, and is only
9200 meaningful in conjunction with LTO mode (-flto). Valid values are
9201 0 (no compression) to 9 (maximum compression). Values outside this
9202 range are clamped to either 0 or 9. If the option is not given, a
9203 default balanced compression setting is used.
9204
9205 -fuse-linker-plugin
9206 Enables the use of a linker plugin during link-time optimization.
9207 This option relies on plugin support in the linker, which is
9208 available in gold or in GNU ld 2.21 or newer.
9209
9210 This option enables the extraction of object files with GIMPLE
9211 bytecode out of library archives. This improves the quality of
9212 optimization by exposing more code to the link-time optimizer.
9213 This information specifies what symbols can be accessed externally
9214 (by non-LTO object or during dynamic linking). Resulting code
9215 quality improvements on binaries (and shared libraries that use
9216 hidden visibility) are similar to -fwhole-program. See -flto for a
9217 description of the effect of this flag and how to use it.
9218
9219 This option is enabled by default when LTO support in GCC is
9220 enabled and GCC was configured for use with a linker supporting
9221 plugins (GNU ld 2.21 or newer or gold).
9222
9223 -ffat-lto-objects
9224 Fat LTO objects are object files that contain both the intermediate
9225 language and the object code. This makes them usable for both LTO
9226 linking and normal linking. This option is effective only when
9227 compiling with -flto and is ignored at link time.
9228
9229 -fno-fat-lto-objects improves compilation time over plain LTO, but
9230 requires the complete toolchain to be aware of LTO. It requires a
9231 linker with linker plugin support for basic functionality.
9232 Additionally, nm, ar and ranlib need to support linker plugins to
9233 allow a full-featured build environment (capable of building static
9234 libraries etc). GCC provides the gcc-ar, gcc-nm, gcc-ranlib
9235 wrappers to pass the right options to these tools. With non fat LTO
9236 makefiles need to be modified to use them.
9237
9238 Note that modern binutils provide plugin auto-load mechanism.
9239 Installing the linker plugin into $libdir/bfd-plugins has the same
9240 effect as usage of the command wrappers (gcc-ar, gcc-nm and gcc-
9241 ranlib).
9242
9243 The default is -fno-fat-lto-objects on targets with linker plugin
9244 support.
9245
9246 -fcompare-elim
9247 After register allocation and post-register allocation instruction
9248 splitting, identify arithmetic instructions that compute processor
9249 flags similar to a comparison operation based on that arithmetic.
9250 If possible, eliminate the explicit comparison operation.
9251
9252 This pass only applies to certain targets that cannot explicitly
9253 represent the comparison operation before register allocation is
9254 complete.
9255
9256 Enabled at levels -O, -O2, -O3, -Os.
9257
9258 -fcprop-registers
9259 After register allocation and post-register allocation instruction
9260 splitting, perform a copy-propagation pass to try to reduce
9261 scheduling dependencies and occasionally eliminate the copy.
9262
9263 Enabled at levels -O, -O2, -O3, -Os.
9264
9265 -fprofile-correction
9266 Profiles collected using an instrumented binary for multi-threaded
9267 programs may be inconsistent due to missed counter updates. When
9268 this option is specified, GCC uses heuristics to correct or smooth
9269 out such inconsistencies. By default, GCC emits an error message
9270 when an inconsistent profile is detected.
9271
9272 This option is enabled by -fauto-profile.
9273
9274 -fprofile-partial-training
9275 With "-fprofile-use" all portions of programs not executed during
9276 train run are optimized agressively for size rather than speed. In
9277 some cases it is not practical to train all possible hot paths in
9278 the program. (For example, program may contain functions specific
9279 for a given hardware and trianing may not cover all hardware
9280 configurations program is run on.) With
9281 "-fprofile-partial-training" profile feedback will be ignored for
9282 all functions not executed during the train run leading them to be
9283 optimized as if they were compiled without profile feedback. This
9284 leads to better performance when train run is not representative
9285 but also leads to significantly bigger code.
9286
9287 -fprofile-use
9288 -fprofile-use=path
9289 Enable profile feedback-directed optimizations, and the following
9290 optimizations, many of which are generally profitable only with
9291 profile feedback available:
9292
9293 -fbranch-probabilities -fprofile-values -funroll-loops
9294 -fpeel-loops -ftracer -fvpt -finline-functions -fipa-cp
9295 -fipa-cp-clone -fipa-bit-cp -fpredictive-commoning -fsplit-loops
9296 -funswitch-loops -fgcse-after-reload -ftree-loop-vectorize
9297 -ftree-slp-vectorize -fvect-cost-model=dynamic
9298 -ftree-loop-distribute-patterns -fprofile-reorder-functions
9299
9300 Before you can use this option, you must first generate profiling
9301 information.
9302
9303 By default, GCC emits an error message if the feedback profiles do
9304 not match the source code. This error can be turned into a warning
9305 by using -Wno-error=coverage-mismatch. Note this may result in
9306 poorly optimized code. Additionally, by default, GCC also emits a
9307 warning message if the feedback profiles do not exist (see
9308 -Wmissing-profile).
9309
9310 If path is specified, GCC looks at the path to find the profile
9311 feedback data files. See -fprofile-dir.
9312
9313 -fauto-profile
9314 -fauto-profile=path
9315 Enable sampling-based feedback-directed optimizations, and the
9316 following optimizations, many of which are generally profitable
9317 only with profile feedback available:
9318
9319 -fbranch-probabilities -fprofile-values -funroll-loops
9320 -fpeel-loops -ftracer -fvpt -finline-functions -fipa-cp
9321 -fipa-cp-clone -fipa-bit-cp -fpredictive-commoning -fsplit-loops
9322 -funswitch-loops -fgcse-after-reload -ftree-loop-vectorize
9323 -ftree-slp-vectorize -fvect-cost-model=dynamic
9324 -ftree-loop-distribute-patterns -fprofile-correction
9325
9326 path is the name of a file containing AutoFDO profile information.
9327 If omitted, it defaults to fbdata.afdo in the current directory.
9328
9329 Producing an AutoFDO profile data file requires running your
9330 program with the perf utility on a supported GNU/Linux target
9331 system. For more information, see <https://perf.wiki.kernel.org/>.
9332
9333 E.g.
9334
9335 perf record -e br_inst_retired:near_taken -b -o perf.data \
9336 -- your_program
9337
9338 Then use the create_gcov tool to convert the raw profile data to a
9339 format that can be used by GCC. You must also supply the
9340 unstripped binary for your program to this tool. See
9341 <https://github.com/google/autofdo>.
9342
9343 E.g.
9344
9345 create_gcov --binary=your_program.unstripped --profile=perf.data \
9346 --gcov=profile.afdo
9347
9348 The following options control compiler behavior regarding floating-
9349 point arithmetic. These options trade off between speed and
9350 correctness. All must be specifically enabled.
9351
9352 -ffloat-store
9353 Do not store floating-point variables in registers, and inhibit
9354 other options that might change whether a floating-point value is
9355 taken from a register or memory.
9356
9357 This option prevents undesirable excess precision on machines such
9358 as the 68000 where the floating registers (of the 68881) keep more
9359 precision than a "double" is supposed to have. Similarly for the
9360 x86 architecture. For most programs, the excess precision does
9361 only good, but a few programs rely on the precise definition of
9362 IEEE floating point. Use -ffloat-store for such programs, after
9363 modifying them to store all pertinent intermediate computations
9364 into variables.
9365
9366 -fexcess-precision=style
9367 This option allows further control over excess precision on
9368 machines where floating-point operations occur in a format with
9369 more precision or range than the IEEE standard and interchange
9370 floating-point types. By default, -fexcess-precision=fast is in
9371 effect; this means that operations may be carried out in a wider
9372 precision than the types specified in the source if that would
9373 result in faster code, and it is unpredictable when rounding to the
9374 types specified in the source code takes place. When compiling C,
9375 if -fexcess-precision=standard is specified then excess precision
9376 follows the rules specified in ISO C99; in particular, both casts
9377 and assignments cause values to be rounded to their semantic types
9378 (whereas -ffloat-store only affects assignments). This option is
9379 enabled by default for C if a strict conformance option such as
9380 -std=c99 is used. -ffast-math enables -fexcess-precision=fast by
9381 default regardless of whether a strict conformance option is used.
9382
9383 -fexcess-precision=standard is not implemented for languages other
9384 than C. On the x86, it has no effect if -mfpmath=sse or
9385 -mfpmath=sse+387 is specified; in the former case, IEEE semantics
9386 apply without excess precision, and in the latter, rounding is
9387 unpredictable.
9388
9389 -ffast-math
9390 Sets the options -fno-math-errno, -funsafe-math-optimizations,
9391 -ffinite-math-only, -fno-rounding-math, -fno-signaling-nans,
9392 -fcx-limited-range and -fexcess-precision=fast.
9393
9394 This option causes the preprocessor macro "__FAST_MATH__" to be
9395 defined.
9396
9397 This option is not turned on by any -O option besides -Ofast since
9398 it can result in incorrect output for programs that depend on an
9399 exact implementation of IEEE or ISO rules/specifications for math
9400 functions. It may, however, yield faster code for programs that do
9401 not require the guarantees of these specifications.
9402
9403 -fno-math-errno
9404 Do not set "errno" after calling math functions that are executed
9405 with a single instruction, e.g., "sqrt". A program that relies on
9406 IEEE exceptions for math error handling may want to use this flag
9407 for speed while maintaining IEEE arithmetic compatibility.
9408
9409 This option is not turned on by any -O option since it can result
9410 in incorrect output for programs that depend on an exact
9411 implementation of IEEE or ISO rules/specifications for math
9412 functions. It may, however, yield faster code for programs that do
9413 not require the guarantees of these specifications.
9414
9415 The default is -fmath-errno.
9416
9417 On Darwin systems, the math library never sets "errno". There is
9418 therefore no reason for the compiler to consider the possibility
9419 that it might, and -fno-math-errno is the default.
9420
9421 -funsafe-math-optimizations
9422 Allow optimizations for floating-point arithmetic that (a) assume
9423 that arguments and results are valid and (b) may violate IEEE or
9424 ANSI standards. When used at link time, it may include libraries
9425 or startup files that change the default FPU control word or other
9426 similar optimizations.
9427
9428 This option is not turned on by any -O option since it can result
9429 in incorrect output for programs that depend on an exact
9430 implementation of IEEE or ISO rules/specifications for math
9431 functions. It may, however, yield faster code for programs that do
9432 not require the guarantees of these specifications. Enables
9433 -fno-signed-zeros, -fno-trapping-math, -fassociative-math and
9434 -freciprocal-math.
9435
9436 The default is -fno-unsafe-math-optimizations.
9437
9438 -fassociative-math
9439 Allow re-association of operands in series of floating-point
9440 operations. This violates the ISO C and C++ language standard by
9441 possibly changing computation result. NOTE: re-ordering may change
9442 the sign of zero as well as ignore NaNs and inhibit or create
9443 underflow or overflow (and thus cannot be used on code that relies
9444 on rounding behavior like "(x + 2**52) - 2**52". May also reorder
9445 floating-point comparisons and thus may not be used when ordered
9446 comparisons are required. This option requires that both
9447 -fno-signed-zeros and -fno-trapping-math be in effect. Moreover,
9448 it doesn't make much sense with -frounding-math. For Fortran the
9449 option is automatically enabled when both -fno-signed-zeros and
9450 -fno-trapping-math are in effect.
9451
9452 The default is -fno-associative-math.
9453
9454 -freciprocal-math
9455 Allow the reciprocal of a value to be used instead of dividing by
9456 the value if this enables optimizations. For example "x / y" can
9457 be replaced with "x * (1/y)", which is useful if "(1/y)" is subject
9458 to common subexpression elimination. Note that this loses
9459 precision and increases the number of flops operating on the value.
9460
9461 The default is -fno-reciprocal-math.
9462
9463 -ffinite-math-only
9464 Allow optimizations for floating-point arithmetic that assume that
9465 arguments and results are not NaNs or +-Infs.
9466
9467 This option is not turned on by any -O option since it can result
9468 in incorrect output for programs that depend on an exact
9469 implementation of IEEE or ISO rules/specifications for math
9470 functions. It may, however, yield faster code for programs that do
9471 not require the guarantees of these specifications.
9472
9473 The default is -fno-finite-math-only.
9474
9475 -fno-signed-zeros
9476 Allow optimizations for floating-point arithmetic that ignore the
9477 signedness of zero. IEEE arithmetic specifies the behavior of
9478 distinct +0.0 and -0.0 values, which then prohibits simplification
9479 of expressions such as x+0.0 or 0.0*x (even with
9480 -ffinite-math-only). This option implies that the sign of a zero
9481 result isn't significant.
9482
9483 The default is -fsigned-zeros.
9484
9485 -fno-trapping-math
9486 Compile code assuming that floating-point operations cannot
9487 generate user-visible traps. These traps include division by zero,
9488 overflow, underflow, inexact result and invalid operation. This
9489 option requires that -fno-signaling-nans be in effect. Setting
9490 this option may allow faster code if one relies on "non-stop" IEEE
9491 arithmetic, for example.
9492
9493 This option should never be turned on by any -O option since it can
9494 result in incorrect output for programs that depend on an exact
9495 implementation of IEEE or ISO rules/specifications for math
9496 functions.
9497
9498 The default is -ftrapping-math.
9499
9500 -frounding-math
9501 Disable transformations and optimizations that assume default
9502 floating-point rounding behavior. This is round-to-zero for all
9503 floating point to integer conversions, and round-to-nearest for all
9504 other arithmetic truncations. This option should be specified for
9505 programs that change the FP rounding mode dynamically, or that may
9506 be executed with a non-default rounding mode. This option disables
9507 constant folding of floating-point expressions at compile time
9508 (which may be affected by rounding mode) and arithmetic
9509 transformations that are unsafe in the presence of sign-dependent
9510 rounding modes.
9511
9512 The default is -fno-rounding-math.
9513
9514 This option is experimental and does not currently guarantee to
9515 disable all GCC optimizations that are affected by rounding mode.
9516 Future versions of GCC may provide finer control of this setting
9517 using C99's "FENV_ACCESS" pragma. This command-line option will be
9518 used to specify the default state for "FENV_ACCESS".
9519
9520 -fsignaling-nans
9521 Compile code assuming that IEEE signaling NaNs may generate user-
9522 visible traps during floating-point operations. Setting this
9523 option disables optimizations that may change the number of
9524 exceptions visible with signaling NaNs. This option implies
9525 -ftrapping-math.
9526
9527 This option causes the preprocessor macro "__SUPPORT_SNAN__" to be
9528 defined.
9529
9530 The default is -fno-signaling-nans.
9531
9532 This option is experimental and does not currently guarantee to
9533 disable all GCC optimizations that affect signaling NaN behavior.
9534
9535 -fno-fp-int-builtin-inexact
9536 Do not allow the built-in functions "ceil", "floor", "round" and
9537 "trunc", and their "float" and "long double" variants, to generate
9538 code that raises the "inexact" floating-point exception for
9539 noninteger arguments. ISO C99 and C11 allow these functions to
9540 raise the "inexact" exception, but ISO/IEC TS 18661-1:2014, the C
9541 bindings to IEEE 754-2008, as integrated into ISO C2X, does not
9542 allow these functions to do so.
9543
9544 The default is -ffp-int-builtin-inexact, allowing the exception to
9545 be raised, unless C2X or a later C standard is selected. This
9546 option does nothing unless -ftrapping-math is in effect.
9547
9548 Even if -fno-fp-int-builtin-inexact is used, if the functions
9549 generate a call to a library function then the "inexact" exception
9550 may be raised if the library implementation does not follow TS
9551 18661.
9552
9553 -fsingle-precision-constant
9554 Treat floating-point constants as single precision instead of
9555 implicitly converting them to double-precision constants.
9556
9557 -fcx-limited-range
9558 When enabled, this option states that a range reduction step is not
9559 needed when performing complex division. Also, there is no
9560 checking whether the result of a complex multiplication or division
9561 is "NaN + I*NaN", with an attempt to rescue the situation in that
9562 case. The default is -fno-cx-limited-range, but is enabled by
9563 -ffast-math.
9564
9565 This option controls the default setting of the ISO C99
9566 "CX_LIMITED_RANGE" pragma. Nevertheless, the option applies to all
9567 languages.
9568
9569 -fcx-fortran-rules
9570 Complex multiplication and division follow Fortran rules. Range
9571 reduction is done as part of complex division, but there is no
9572 checking whether the result of a complex multiplication or division
9573 is "NaN + I*NaN", with an attempt to rescue the situation in that
9574 case.
9575
9576 The default is -fno-cx-fortran-rules.
9577
9578 The following options control optimizations that may improve
9579 performance, but are not enabled by any -O options. This section
9580 includes experimental options that may produce broken code.
9581
9582 -fbranch-probabilities
9583 After running a program compiled with -fprofile-arcs, you can
9584 compile it a second time using -fbranch-probabilities, to improve
9585 optimizations based on the number of times each branch was taken.
9586 When a program compiled with -fprofile-arcs exits, it saves arc
9587 execution counts to a file called sourcename.gcda for each source
9588 file. The information in this data file is very dependent on the
9589 structure of the generated code, so you must use the same source
9590 code and the same optimization options for both compilations.
9591
9592 With -fbranch-probabilities, GCC puts a REG_BR_PROB note on each
9593 JUMP_INSN and CALL_INSN. These can be used to improve
9594 optimization. Currently, they are only used in one place: in
9595 reorg.c, instead of guessing which path a branch is most likely to
9596 take, the REG_BR_PROB values are used to exactly determine which
9597 path is taken more often.
9598
9599 Enabled by -fprofile-use and -fauto-profile.
9600
9601 -fprofile-values
9602 If combined with -fprofile-arcs, it adds code so that some data
9603 about values of expressions in the program is gathered.
9604
9605 With -fbranch-probabilities, it reads back the data gathered from
9606 profiling values of expressions for usage in optimizations.
9607
9608 Enabled by -fprofile-generate, -fprofile-use, and -fauto-profile.
9609
9610 -fprofile-reorder-functions
9611 Function reordering based on profile instrumentation collects first
9612 time of execution of a function and orders these functions in
9613 ascending order.
9614
9615 Enabled with -fprofile-use.
9616
9617 -fvpt
9618 If combined with -fprofile-arcs, this option instructs the compiler
9619 to add code to gather information about values of expressions.
9620
9621 With -fbranch-probabilities, it reads back the data gathered and
9622 actually performs the optimizations based on them. Currently the
9623 optimizations include specialization of division operations using
9624 the knowledge about the value of the denominator.
9625
9626 Enabled with -fprofile-use and -fauto-profile.
9627
9628 -frename-registers
9629 Attempt to avoid false dependencies in scheduled code by making use
9630 of registers left over after register allocation. This
9631 optimization most benefits processors with lots of registers.
9632 Depending on the debug information format adopted by the target,
9633 however, it can make debugging impossible, since variables no
9634 longer stay in a "home register".
9635
9636 Enabled by default with -funroll-loops.
9637
9638 -fschedule-fusion
9639 Performs a target dependent pass over the instruction stream to
9640 schedule instructions of same type together because target machine
9641 can execute them more efficiently if they are adjacent to each
9642 other in the instruction flow.
9643
9644 Enabled at levels -O2, -O3, -Os.
9645
9646 -ftracer
9647 Perform tail duplication to enlarge superblock size. This
9648 transformation simplifies the control flow of the function allowing
9649 other optimizations to do a better job.
9650
9651 Enabled by -fprofile-use and -fauto-profile.
9652
9653 -funroll-loops
9654 Unroll loops whose number of iterations can be determined at
9655 compile time or upon entry to the loop. -funroll-loops implies
9656 -frerun-cse-after-loop, -fweb and -frename-registers. It also
9657 turns on complete loop peeling (i.e. complete removal of loops with
9658 a small constant number of iterations). This option makes code
9659 larger, and may or may not make it run faster.
9660
9661 Enabled by -fprofile-use and -fauto-profile.
9662
9663 -funroll-all-loops
9664 Unroll all loops, even if their number of iterations is uncertain
9665 when the loop is entered. This usually makes programs run more
9666 slowly. -funroll-all-loops implies the same options as
9667 -funroll-loops.
9668
9669 -fpeel-loops
9670 Peels loops for which there is enough information that they do not
9671 roll much (from profile feedback or static analysis). It also
9672 turns on complete loop peeling (i.e. complete removal of loops with
9673 small constant number of iterations).
9674
9675 Enabled by -O3, -fprofile-use, and -fauto-profile.
9676
9677 -fmove-loop-invariants
9678 Enables the loop invariant motion pass in the RTL loop optimizer.
9679 Enabled at level -O1 and higher, except for -Og.
9680
9681 -fsplit-loops
9682 Split a loop into two if it contains a condition that's always true
9683 for one side of the iteration space and false for the other.
9684
9685 Enabled by -fprofile-use and -fauto-profile.
9686
9687 -funswitch-loops
9688 Move branches with loop invariant conditions out of the loop, with
9689 duplicates of the loop on both branches (modified according to
9690 result of the condition).
9691
9692 Enabled by -fprofile-use and -fauto-profile.
9693
9694 -fversion-loops-for-strides
9695 If a loop iterates over an array with a variable stride, create
9696 another version of the loop that assumes the stride is always one.
9697 For example:
9698
9699 for (int i = 0; i < n; ++i)
9700 x[i * stride] = ...;
9701
9702 becomes:
9703
9704 if (stride == 1)
9705 for (int i = 0; i < n; ++i)
9706 x[i] = ...;
9707 else
9708 for (int i = 0; i < n; ++i)
9709 x[i * stride] = ...;
9710
9711 This is particularly useful for assumed-shape arrays in Fortran
9712 where (for example) it allows better vectorization assuming
9713 contiguous accesses. This flag is enabled by default at -O3. It
9714 is also enabled by -fprofile-use and -fauto-profile.
9715
9716 -ffunction-sections
9717 -fdata-sections
9718 Place each function or data item into its own section in the output
9719 file if the target supports arbitrary sections. The name of the
9720 function or the name of the data item determines the section's name
9721 in the output file.
9722
9723 Use these options on systems where the linker can perform
9724 optimizations to improve locality of reference in the instruction
9725 space. Most systems using the ELF object format have linkers with
9726 such optimizations. On AIX, the linker rearranges sections
9727 (CSECTs) based on the call graph. The performance impact varies.
9728
9729 Together with a linker garbage collection (linker --gc-sections
9730 option) these options may lead to smaller statically-linked
9731 executables (after stripping).
9732
9733 On ELF/DWARF systems these options do not degenerate the quality of
9734 the debug information. There could be issues with other object
9735 files/debug info formats.
9736
9737 Only use these options when there are significant benefits from
9738 doing so. When you specify these options, the assembler and linker
9739 create larger object and executable files and are also slower.
9740 These options affect code generation. They prevent optimizations
9741 by the compiler and assembler using relative locations inside a
9742 translation unit since the locations are unknown until link time.
9743 An example of such an optimization is relaxing calls to short call
9744 instructions.
9745
9746 -fstdarg-opt
9747 Optimize the prologue of variadic argument functions with respect
9748 to usage of those arguments.
9749
9750 -fsection-anchors
9751 Try to reduce the number of symbolic address calculations by using
9752 shared "anchor" symbols to address nearby objects. This
9753 transformation can help to reduce the number of GOT entries and GOT
9754 accesses on some targets.
9755
9756 For example, the implementation of the following function "foo":
9757
9758 static int a, b, c;
9759 int foo (void) { return a + b + c; }
9760
9761 usually calculates the addresses of all three variables, but if you
9762 compile it with -fsection-anchors, it accesses the variables from a
9763 common anchor point instead. The effect is similar to the
9764 following pseudocode (which isn't valid C):
9765
9766 int foo (void)
9767 {
9768 register int *xr = &x;
9769 return xr[&a - &x] + xr[&b - &x] + xr[&c - &x];
9770 }
9771
9772 Not all targets support this option.
9773
9774 --param name=value
9775 In some places, GCC uses various constants to control the amount of
9776 optimization that is done. For example, GCC does not inline
9777 functions that contain more than a certain number of instructions.
9778 You can control some of these constants on the command line using
9779 the --param option.
9780
9781 The names of specific parameters, and the meaning of the values,
9782 are tied to the internals of the compiler, and are subject to
9783 change without notice in future releases.
9784
9785 In order to get minimal, maximal and default value of a parameter,
9786 one can use --help=param -Q options.
9787
9788 In each case, the value is an integer. The following choices of
9789 name are recognized for all targets:
9790
9791 predictable-branch-outcome
9792 When branch is predicted to be taken with probability lower
9793 than this threshold (in percent), then it is considered well
9794 predictable.
9795
9796 max-rtl-if-conversion-insns
9797 RTL if-conversion tries to remove conditional branches around a
9798 block and replace them with conditionally executed
9799 instructions. This parameter gives the maximum number of
9800 instructions in a block which should be considered for if-
9801 conversion. The compiler will also use other heuristics to
9802 decide whether if-conversion is likely to be profitable.
9803
9804 max-rtl-if-conversion-predictable-cost
9805 max-rtl-if-conversion-unpredictable-cost
9806 RTL if-conversion will try to remove conditional branches
9807 around a block and replace them with conditionally executed
9808 instructions. These parameters give the maximum permissible
9809 cost for the sequence that would be generated by if-conversion
9810 depending on whether the branch is statically determined to be
9811 predictable or not. The units for this parameter are the same
9812 as those for the GCC internal seq_cost metric. The compiler
9813 will try to provide a reasonable default for this parameter
9814 using the BRANCH_COST target macro.
9815
9816 max-crossjump-edges
9817 The maximum number of incoming edges to consider for cross-
9818 jumping. The algorithm used by -fcrossjumping is O(N^2) in the
9819 number of edges incoming to each block. Increasing values mean
9820 more aggressive optimization, making the compilation time
9821 increase with probably small improvement in executable size.
9822
9823 min-crossjump-insns
9824 The minimum number of instructions that must be matched at the
9825 end of two blocks before cross-jumping is performed on them.
9826 This value is ignored in the case where all instructions in the
9827 block being cross-jumped from are matched.
9828
9829 max-grow-copy-bb-insns
9830 The maximum code size expansion factor when copying basic
9831 blocks instead of jumping. The expansion is relative to a jump
9832 instruction.
9833
9834 max-goto-duplication-insns
9835 The maximum number of instructions to duplicate to a block that
9836 jumps to a computed goto. To avoid O(N^2) behavior in a number
9837 of passes, GCC factors computed gotos early in the compilation
9838 process, and unfactors them as late as possible. Only computed
9839 jumps at the end of a basic blocks with no more than max-goto-
9840 duplication-insns are unfactored.
9841
9842 max-delay-slot-insn-search
9843 The maximum number of instructions to consider when looking for
9844 an instruction to fill a delay slot. If more than this
9845 arbitrary number of instructions are searched, the time savings
9846 from filling the delay slot are minimal, so stop searching.
9847 Increasing values mean more aggressive optimization, making the
9848 compilation time increase with probably small improvement in
9849 execution time.
9850
9851 max-delay-slot-live-search
9852 When trying to fill delay slots, the maximum number of
9853 instructions to consider when searching for a block with valid
9854 live register information. Increasing this arbitrarily chosen
9855 value means more aggressive optimization, increasing the
9856 compilation time. This parameter should be removed when the
9857 delay slot code is rewritten to maintain the control-flow
9858 graph.
9859
9860 max-gcse-memory
9861 The approximate maximum amount of memory that can be allocated
9862 in order to perform the global common subexpression elimination
9863 optimization. If more memory than specified is required, the
9864 optimization is not done.
9865
9866 max-gcse-insertion-ratio
9867 If the ratio of expression insertions to deletions is larger
9868 than this value for any expression, then RTL PRE inserts or
9869 removes the expression and thus leaves partially redundant
9870 computations in the instruction stream.
9871
9872 max-pending-list-length
9873 The maximum number of pending dependencies scheduling allows
9874 before flushing the current state and starting over. Large
9875 functions with few branches or calls can create excessively
9876 large lists which needlessly consume memory and resources.
9877
9878 max-modulo-backtrack-attempts
9879 The maximum number of backtrack attempts the scheduler should
9880 make when modulo scheduling a loop. Larger values can
9881 exponentially increase compilation time.
9882
9883 max-inline-insns-single
9884 Several parameters control the tree inliner used in GCC. This
9885 number sets the maximum number of instructions (counted in
9886 GCC's internal representation) in a single function that the
9887 tree inliner considers for inlining. This only affects
9888 functions declared inline and methods implemented in a class
9889 declaration (C++).
9890
9891 max-inline-insns-auto
9892 When you use -finline-functions (included in -O3), a lot of
9893 functions that would otherwise not be considered for inlining
9894 by the compiler are investigated. To those functions, a
9895 different (more restrictive) limit compared to functions
9896 declared inline can be applied (--param max-inline-insns-auto).
9897
9898 max-inline-insns-small
9899 This is bound applied to calls which are considered relevant
9900 with -finline-small-functions.
9901
9902 max-inline-insns-size
9903 This is bound applied to calls which are optimized for size.
9904 Small growth may be desirable to anticipate optimization
9905 oppurtunities exposed by inlining.
9906
9907 uninlined-function-insns
9908 Number of instructions accounted by inliner for function
9909 overhead such as function prologue and epilogue.
9910
9911 uninlined-function-time
9912 Extra time accounted by inliner for function overhead such as
9913 time needed to execute function prologue and epilogue
9914
9915 inline-heuristics-hint-percent
9916 The scale (in percents) applied to inline-insns-single,
9917 inline-insns-single-O2, inline-insns-auto when inline
9918 heuristics hints that inlining is very profitable (will enable
9919 later optimizations).
9920
9921 uninlined-thunk-insns
9922 uninlined-thunk-time
9923 Same as --param uninlined-function-insns and --param uninlined-
9924 function-time but applied to function thunks
9925
9926 inline-min-speedup
9927 When estimated performance improvement of caller + callee
9928 runtime exceeds this threshold (in percent), the function can
9929 be inlined regardless of the limit on --param max-inline-insns-
9930 single and --param max-inline-insns-auto.
9931
9932 large-function-insns
9933 The limit specifying really large functions. For functions
9934 larger than this limit after inlining, inlining is constrained
9935 by --param large-function-growth. This parameter is useful
9936 primarily to avoid extreme compilation time caused by non-
9937 linear algorithms used by the back end.
9938
9939 large-function-growth
9940 Specifies maximal growth of large function caused by inlining
9941 in percents. For example, parameter value 100 limits large
9942 function growth to 2.0 times the original size.
9943
9944 large-unit-insns
9945 The limit specifying large translation unit. Growth caused by
9946 inlining of units larger than this limit is limited by --param
9947 inline-unit-growth. For small units this might be too tight.
9948 For example, consider a unit consisting of function A that is
9949 inline and B that just calls A three times. If B is small
9950 relative to A, the growth of unit is 300\% and yet such
9951 inlining is very sane. For very large units consisting of
9952 small inlineable functions, however, the overall unit growth
9953 limit is needed to avoid exponential explosion of code size.
9954 Thus for smaller units, the size is increased to --param large-
9955 unit-insns before applying --param inline-unit-growth.
9956
9957 inline-unit-growth
9958 Specifies maximal overall growth of the compilation unit caused
9959 by inlining. For example, parameter value 20 limits unit
9960 growth to 1.2 times the original size. Cold functions (either
9961 marked cold via an attribute or by profile feedback) are not
9962 accounted into the unit size.
9963
9964 ipcp-unit-growth
9965 Specifies maximal overall growth of the compilation unit caused
9966 by interprocedural constant propagation. For example,
9967 parameter value 10 limits unit growth to 1.1 times the original
9968 size.
9969
9970 large-stack-frame
9971 The limit specifying large stack frames. While inlining the
9972 algorithm is trying to not grow past this limit too much.
9973
9974 large-stack-frame-growth
9975 Specifies maximal growth of large stack frames caused by
9976 inlining in percents. For example, parameter value 1000 limits
9977 large stack frame growth to 11 times the original size.
9978
9979 max-inline-insns-recursive
9980 max-inline-insns-recursive-auto
9981 Specifies the maximum number of instructions an out-of-line
9982 copy of a self-recursive inline function can grow into by
9983 performing recursive inlining.
9984
9985 --param max-inline-insns-recursive applies to functions
9986 declared inline. For functions not declared inline, recursive
9987 inlining happens only when -finline-functions (included in -O3)
9988 is enabled; --param max-inline-insns-recursive-auto applies
9989 instead.
9990
9991 max-inline-recursive-depth
9992 max-inline-recursive-depth-auto
9993 Specifies the maximum recursion depth used for recursive
9994 inlining.
9995
9996 --param max-inline-recursive-depth applies to functions
9997 declared inline. For functions not declared inline, recursive
9998 inlining happens only when -finline-functions (included in -O3)
9999 is enabled; --param max-inline-recursive-depth-auto applies
10000 instead.
10001
10002 min-inline-recursive-probability
10003 Recursive inlining is profitable only for function having deep
10004 recursion in average and can hurt for function having little
10005 recursion depth by increasing the prologue size or complexity
10006 of function body to other optimizers.
10007
10008 When profile feedback is available (see -fprofile-generate) the
10009 actual recursion depth can be guessed from the probability that
10010 function recurses via a given call expression. This parameter
10011 limits inlining only to call expressions whose probability
10012 exceeds the given threshold (in percents).
10013
10014 early-inlining-insns
10015 Specify growth that the early inliner can make. In effect it
10016 increases the amount of inlining for code having a large
10017 abstraction penalty.
10018
10019 max-early-inliner-iterations
10020 Limit of iterations of the early inliner. This basically
10021 bounds the number of nested indirect calls the early inliner
10022 can resolve. Deeper chains are still handled by late inlining.
10023
10024 comdat-sharing-probability
10025 Probability (in percent) that C++ inline function with comdat
10026 visibility are shared across multiple compilation units.
10027
10028 profile-func-internal-id
10029 A parameter to control whether to use function internal id in
10030 profile database lookup. If the value is 0, the compiler uses
10031 an id that is based on function assembler name and filename,
10032 which makes old profile data more tolerant to source changes
10033 such as function reordering etc.
10034
10035 min-vect-loop-bound
10036 The minimum number of iterations under which loops are not
10037 vectorized when -ftree-vectorize is used. The number of
10038 iterations after vectorization needs to be greater than the
10039 value specified by this option to allow vectorization.
10040
10041 gcse-cost-distance-ratio
10042 Scaling factor in calculation of maximum distance an expression
10043 can be moved by GCSE optimizations. This is currently
10044 supported only in the code hoisting pass. The bigger the
10045 ratio, the more aggressive code hoisting is with simple
10046 expressions, i.e., the expressions that have cost less than
10047 gcse-unrestricted-cost. Specifying 0 disables hoisting of
10048 simple expressions.
10049
10050 gcse-unrestricted-cost
10051 Cost, roughly measured as the cost of a single typical machine
10052 instruction, at which GCSE optimizations do not constrain the
10053 distance an expression can travel. This is currently supported
10054 only in the code hoisting pass. The lesser the cost, the more
10055 aggressive code hoisting is. Specifying 0 allows all
10056 expressions to travel unrestricted distances.
10057
10058 max-hoist-depth
10059 The depth of search in the dominator tree for expressions to
10060 hoist. This is used to avoid quadratic behavior in hoisting
10061 algorithm. The value of 0 does not limit on the search, but
10062 may slow down compilation of huge functions.
10063
10064 max-tail-merge-comparisons
10065 The maximum amount of similar bbs to compare a bb with. This
10066 is used to avoid quadratic behavior in tree tail merging.
10067
10068 max-tail-merge-iterations
10069 The maximum amount of iterations of the pass over the function.
10070 This is used to limit compilation time in tree tail merging.
10071
10072 store-merging-allow-unaligned
10073 Allow the store merging pass to introduce unaligned stores if
10074 it is legal to do so.
10075
10076 max-stores-to-merge
10077 The maximum number of stores to attempt to merge into wider
10078 stores in the store merging pass.
10079
10080 max-unrolled-insns
10081 The maximum number of instructions that a loop may have to be
10082 unrolled. If a loop is unrolled, this parameter also
10083 determines how many times the loop code is unrolled.
10084
10085 max-average-unrolled-insns
10086 The maximum number of instructions biased by probabilities of
10087 their execution that a loop may have to be unrolled. If a loop
10088 is unrolled, this parameter also determines how many times the
10089 loop code is unrolled.
10090
10091 max-unroll-times
10092 The maximum number of unrollings of a single loop.
10093
10094 max-peeled-insns
10095 The maximum number of instructions that a loop may have to be
10096 peeled. If a loop is peeled, this parameter also determines
10097 how many times the loop code is peeled.
10098
10099 max-peel-times
10100 The maximum number of peelings of a single loop.
10101
10102 max-peel-branches
10103 The maximum number of branches on the hot path through the
10104 peeled sequence.
10105
10106 max-completely-peeled-insns
10107 The maximum number of insns of a completely peeled loop.
10108
10109 max-completely-peel-times
10110 The maximum number of iterations of a loop to be suitable for
10111 complete peeling.
10112
10113 max-completely-peel-loop-nest-depth
10114 The maximum depth of a loop nest suitable for complete peeling.
10115
10116 max-unswitch-insns
10117 The maximum number of insns of an unswitched loop.
10118
10119 max-unswitch-level
10120 The maximum number of branches unswitched in a single loop.
10121
10122 lim-expensive
10123 The minimum cost of an expensive expression in the loop
10124 invariant motion.
10125
10126 min-loop-cond-split-prob
10127 When FDO profile information is available, min-loop-cond-split-
10128 prob specifies minimum threshold for probability of semi-
10129 invariant condition statement to trigger loop split.
10130
10131 iv-consider-all-candidates-bound
10132 Bound on number of candidates for induction variables, below
10133 which all candidates are considered for each use in induction
10134 variable optimizations. If there are more candidates than
10135 this, only the most relevant ones are considered to avoid
10136 quadratic time complexity.
10137
10138 iv-max-considered-uses
10139 The induction variable optimizations give up on loops that
10140 contain more induction variable uses.
10141
10142 iv-always-prune-cand-set-bound
10143 If the number of candidates in the set is smaller than this
10144 value, always try to remove unnecessary ivs from the set when
10145 adding a new one.
10146
10147 avg-loop-niter
10148 Average number of iterations of a loop.
10149
10150 dse-max-object-size
10151 Maximum size (in bytes) of objects tracked bytewise by dead
10152 store elimination. Larger values may result in larger
10153 compilation times.
10154
10155 dse-max-alias-queries-per-store
10156 Maximum number of queries into the alias oracle per store.
10157 Larger values result in larger compilation times and may result
10158 in more removed dead stores.
10159
10160 scev-max-expr-size
10161 Bound on size of expressions used in the scalar evolutions
10162 analyzer. Large expressions slow the analyzer.
10163
10164 scev-max-expr-complexity
10165 Bound on the complexity of the expressions in the scalar
10166 evolutions analyzer. Complex expressions slow the analyzer.
10167
10168 max-tree-if-conversion-phi-args
10169 Maximum number of arguments in a PHI supported by TREE if
10170 conversion unless the loop is marked with simd pragma.
10171
10172 vect-max-version-for-alignment-checks
10173 The maximum number of run-time checks that can be performed
10174 when doing loop versioning for alignment in the vectorizer.
10175
10176 vect-max-version-for-alias-checks
10177 The maximum number of run-time checks that can be performed
10178 when doing loop versioning for alias in the vectorizer.
10179
10180 vect-max-peeling-for-alignment
10181 The maximum number of loop peels to enhance access alignment
10182 for vectorizer. Value -1 means no limit.
10183
10184 max-iterations-to-track
10185 The maximum number of iterations of a loop the brute-force
10186 algorithm for analysis of the number of iterations of the loop
10187 tries to evaluate.
10188
10189 hot-bb-count-fraction
10190 The denominator n of fraction 1/n of the maximal execution
10191 count of a basic block in the entire program that a basic block
10192 needs to at least have in order to be considered hot. The
10193 default is 10000, which means that a basic block is considered
10194 hot if its execution count is greater than 1/10000 of the
10195 maximal execution count. 0 means that it is never considered
10196 hot. Used in non-LTO mode.
10197
10198 hot-bb-count-ws-permille
10199 The number of most executed permilles, ranging from 0 to 1000,
10200 of the profiled execution of the entire program to which the
10201 execution count of a basic block must be part of in order to be
10202 considered hot. The default is 990, which means that a basic
10203 block is considered hot if its execution count contributes to
10204 the upper 990 permilles, or 99.0%, of the profiled execution of
10205 the entire program. 0 means that it is never considered hot.
10206 Used in LTO mode.
10207
10208 hot-bb-frequency-fraction
10209 The denominator n of fraction 1/n of the execution frequency of
10210 the entry block of a function that a basic block of this
10211 function needs to at least have in order to be considered hot.
10212 The default is 1000, which means that a basic block is
10213 considered hot in a function if it is executed more frequently
10214 than 1/1000 of the frequency of the entry block of the
10215 function. 0 means that it is never considered hot.
10216
10217 unlikely-bb-count-fraction
10218 The denominator n of fraction 1/n of the number of profiled
10219 runs of the entire program below which the execution count of a
10220 basic block must be in order for the basic block to be
10221 considered unlikely executed. The default is 20, which means
10222 that a basic block is considered unlikely executed if it is
10223 executed in fewer than 1/20, or 5%, of the runs of the program.
10224 0 means that it is always considered unlikely executed.
10225
10226 max-predicted-iterations
10227 The maximum number of loop iterations we predict statically.
10228 This is useful in cases where a function contains a single loop
10229 with known bound and another loop with unknown bound. The
10230 known number of iterations is predicted correctly, while the
10231 unknown number of iterations average to roughly 10. This means
10232 that the loop without bounds appears artificially cold relative
10233 to the other one.
10234
10235 builtin-expect-probability
10236 Control the probability of the expression having the specified
10237 value. This parameter takes a percentage (i.e. 0 ... 100) as
10238 input.
10239
10240 builtin-string-cmp-inline-length
10241 The maximum length of a constant string for a builtin string
10242 cmp call eligible for inlining.
10243
10244 align-threshold
10245 Select fraction of the maximal frequency of executions of a
10246 basic block in a function to align the basic block.
10247
10248 align-loop-iterations
10249 A loop expected to iterate at least the selected number of
10250 iterations is aligned.
10251
10252 tracer-dynamic-coverage
10253 tracer-dynamic-coverage-feedback
10254 This value is used to limit superblock formation once the given
10255 percentage of executed instructions is covered. This limits
10256 unnecessary code size expansion.
10257
10258 The tracer-dynamic-coverage-feedback parameter is used only
10259 when profile feedback is available. The real profiles (as
10260 opposed to statically estimated ones) are much less balanced
10261 allowing the threshold to be larger value.
10262
10263 tracer-max-code-growth
10264 Stop tail duplication once code growth has reached given
10265 percentage. This is a rather artificial limit, as most of the
10266 duplicates are eliminated later in cross jumping, so it may be
10267 set to much higher values than is the desired code growth.
10268
10269 tracer-min-branch-ratio
10270 Stop reverse growth when the reverse probability of best edge
10271 is less than this threshold (in percent).
10272
10273 tracer-min-branch-probability
10274 tracer-min-branch-probability-feedback
10275 Stop forward growth if the best edge has probability lower than
10276 this threshold.
10277
10278 Similarly to tracer-dynamic-coverage two parameters are
10279 provided. tracer-min-branch-probability-feedback is used for
10280 compilation with profile feedback and tracer-min-branch-
10281 probability compilation without. The value for compilation
10282 with profile feedback needs to be more conservative (higher) in
10283 order to make tracer effective.
10284
10285 stack-clash-protection-guard-size
10286 Specify the size of the operating system provided stack guard
10287 as 2 raised to num bytes. Higher values may reduce the number
10288 of explicit probes, but a value larger than the operating
10289 system provided guard will leave code vulnerable to stack clash
10290 style attacks.
10291
10292 stack-clash-protection-probe-interval
10293 Stack clash protection involves probing stack space as it is
10294 allocated. This param controls the maximum distance between
10295 probes into the stack as 2 raised to num bytes. Higher values
10296 may reduce the number of explicit probes, but a value larger
10297 than the operating system provided guard will leave code
10298 vulnerable to stack clash style attacks.
10299
10300 max-cse-path-length
10301 The maximum number of basic blocks on path that CSE considers.
10302
10303 max-cse-insns
10304 The maximum number of instructions CSE processes before
10305 flushing.
10306
10307 ggc-min-expand
10308 GCC uses a garbage collector to manage its own memory
10309 allocation. This parameter specifies the minimum percentage by
10310 which the garbage collector's heap should be allowed to expand
10311 between collections. Tuning this may improve compilation
10312 speed; it has no effect on code generation.
10313
10314 The default is 30% + 70% * (RAM/1GB) with an upper bound of
10315 100% when RAM >= 1GB. If "getrlimit" is available, the notion
10316 of "RAM" is the smallest of actual RAM and "RLIMIT_DATA" or
10317 "RLIMIT_AS". If GCC is not able to calculate RAM on a
10318 particular platform, the lower bound of 30% is used. Setting
10319 this parameter and ggc-min-heapsize to zero causes a full
10320 collection to occur at every opportunity. This is extremely
10321 slow, but can be useful for debugging.
10322
10323 ggc-min-heapsize
10324 Minimum size of the garbage collector's heap before it begins
10325 bothering to collect garbage. The first collection occurs
10326 after the heap expands by ggc-min-expand% beyond ggc-min-
10327 heapsize. Again, tuning this may improve compilation speed,
10328 and has no effect on code generation.
10329
10330 The default is the smaller of RAM/8, RLIMIT_RSS, or a limit
10331 that tries to ensure that RLIMIT_DATA or RLIMIT_AS are not
10332 exceeded, but with a lower bound of 4096 (four megabytes) and
10333 an upper bound of 131072 (128 megabytes). If GCC is not able
10334 to calculate RAM on a particular platform, the lower bound is
10335 used. Setting this parameter very large effectively disables
10336 garbage collection. Setting this parameter and ggc-min-expand
10337 to zero causes a full collection to occur at every opportunity.
10338
10339 max-reload-search-insns
10340 The maximum number of instruction reload should look backward
10341 for equivalent register. Increasing values mean more
10342 aggressive optimization, making the compilation time increase
10343 with probably slightly better performance.
10344
10345 max-cselib-memory-locations
10346 The maximum number of memory locations cselib should take into
10347 account. Increasing values mean more aggressive optimization,
10348 making the compilation time increase with probably slightly
10349 better performance.
10350
10351 max-sched-ready-insns
10352 The maximum number of instructions ready to be issued the
10353 scheduler should consider at any given time during the first
10354 scheduling pass. Increasing values mean more thorough
10355 searches, making the compilation time increase with probably
10356 little benefit.
10357
10358 max-sched-region-blocks
10359 The maximum number of blocks in a region to be considered for
10360 interblock scheduling.
10361
10362 max-pipeline-region-blocks
10363 The maximum number of blocks in a region to be considered for
10364 pipelining in the selective scheduler.
10365
10366 max-sched-region-insns
10367 The maximum number of insns in a region to be considered for
10368 interblock scheduling.
10369
10370 max-pipeline-region-insns
10371 The maximum number of insns in a region to be considered for
10372 pipelining in the selective scheduler.
10373
10374 min-spec-prob
10375 The minimum probability (in percents) of reaching a source
10376 block for interblock speculative scheduling.
10377
10378 max-sched-extend-regions-iters
10379 The maximum number of iterations through CFG to extend regions.
10380 A value of 0 disables region extensions.
10381
10382 max-sched-insn-conflict-delay
10383 The maximum conflict delay for an insn to be considered for
10384 speculative motion.
10385
10386 sched-spec-prob-cutoff
10387 The minimal probability of speculation success (in percents),
10388 so that speculative insns are scheduled.
10389
10390 sched-state-edge-prob-cutoff
10391 The minimum probability an edge must have for the scheduler to
10392 save its state across it.
10393
10394 sched-mem-true-dep-cost
10395 Minimal distance (in CPU cycles) between store and load
10396 targeting same memory locations.
10397
10398 selsched-max-lookahead
10399 The maximum size of the lookahead window of selective
10400 scheduling. It is a depth of search for available
10401 instructions.
10402
10403 selsched-max-sched-times
10404 The maximum number of times that an instruction is scheduled
10405 during selective scheduling. This is the limit on the number
10406 of iterations through which the instruction may be pipelined.
10407
10408 selsched-insns-to-rename
10409 The maximum number of best instructions in the ready list that
10410 are considered for renaming in the selective scheduler.
10411
10412 sms-min-sc
10413 The minimum value of stage count that swing modulo scheduler
10414 generates.
10415
10416 max-last-value-rtl
10417 The maximum size measured as number of RTLs that can be
10418 recorded in an expression in combiner for a pseudo register as
10419 last known value of that register.
10420
10421 max-combine-insns
10422 The maximum number of instructions the RTL combiner tries to
10423 combine.
10424
10425 integer-share-limit
10426 Small integer constants can use a shared data structure,
10427 reducing the compiler's memory usage and increasing its speed.
10428 This sets the maximum value of a shared integer constant.
10429
10430 ssp-buffer-size
10431 The minimum size of buffers (i.e. arrays) that receive stack
10432 smashing protection when -fstack-protection is used.
10433
10434 min-size-for-stack-sharing
10435 The minimum size of variables taking part in stack slot sharing
10436 when not optimizing.
10437
10438 max-jump-thread-duplication-stmts
10439 Maximum number of statements allowed in a block that needs to
10440 be duplicated when threading jumps.
10441
10442 max-fields-for-field-sensitive
10443 Maximum number of fields in a structure treated in a field
10444 sensitive manner during pointer analysis.
10445
10446 prefetch-latency
10447 Estimate on average number of instructions that are executed
10448 before prefetch finishes. The distance prefetched ahead is
10449 proportional to this constant. Increasing this number may also
10450 lead to less streams being prefetched (see simultaneous-
10451 prefetches).
10452
10453 simultaneous-prefetches
10454 Maximum number of prefetches that can run at the same time.
10455
10456 l1-cache-line-size
10457 The size of cache line in L1 data cache, in bytes.
10458
10459 l1-cache-size
10460 The size of L1 data cache, in kilobytes.
10461
10462 l2-cache-size
10463 The size of L2 data cache, in kilobytes.
10464
10465 prefetch-dynamic-strides
10466 Whether the loop array prefetch pass should issue software
10467 prefetch hints for strides that are non-constant. In some
10468 cases this may be beneficial, though the fact the stride is
10469 non-constant may make it hard to predict when there is clear
10470 benefit to issuing these hints.
10471
10472 Set to 1 if the prefetch hints should be issued for non-
10473 constant strides. Set to 0 if prefetch hints should be issued
10474 only for strides that are known to be constant and below
10475 prefetch-minimum-stride.
10476
10477 prefetch-minimum-stride
10478 Minimum constant stride, in bytes, to start using prefetch
10479 hints for. If the stride is less than this threshold, prefetch
10480 hints will not be issued.
10481
10482 This setting is useful for processors that have hardware
10483 prefetchers, in which case there may be conflicts between the
10484 hardware prefetchers and the software prefetchers. If the
10485 hardware prefetchers have a maximum stride they can handle, it
10486 should be used here to improve the use of software prefetchers.
10487
10488 A value of -1 means we don't have a threshold and therefore
10489 prefetch hints can be issued for any constant stride.
10490
10491 This setting is only useful for strides that are known and
10492 constant.
10493
10494 loop-interchange-max-num-stmts
10495 The maximum number of stmts in a loop to be interchanged.
10496
10497 loop-interchange-stride-ratio
10498 The minimum ratio between stride of two loops for interchange
10499 to be profitable.
10500
10501 min-insn-to-prefetch-ratio
10502 The minimum ratio between the number of instructions and the
10503 number of prefetches to enable prefetching in a loop.
10504
10505 prefetch-min-insn-to-mem-ratio
10506 The minimum ratio between the number of instructions and the
10507 number of memory references to enable prefetching in a loop.
10508
10509 use-canonical-types
10510 Whether the compiler should use the "canonical" type system.
10511 Should always be 1, which uses a more efficient internal
10512 mechanism for comparing types in C++ and Objective-C++.
10513 However, if bugs in the canonical type system are causing
10514 compilation failures, set this value to 0 to disable canonical
10515 types.
10516
10517 switch-conversion-max-branch-ratio
10518 Switch initialization conversion refuses to create arrays that
10519 are bigger than switch-conversion-max-branch-ratio times the
10520 number of branches in the switch.
10521
10522 max-partial-antic-length
10523 Maximum length of the partial antic set computed during the
10524 tree partial redundancy elimination optimization (-ftree-pre)
10525 when optimizing at -O3 and above. For some sorts of source
10526 code the enhanced partial redundancy elimination optimization
10527 can run away, consuming all of the memory available on the host
10528 machine. This parameter sets a limit on the length of the sets
10529 that are computed, which prevents the runaway behavior.
10530 Setting a value of 0 for this parameter allows an unlimited set
10531 length.
10532
10533 rpo-vn-max-loop-depth
10534 Maximum loop depth that is value-numbered optimistically. When
10535 the limit hits the innermost rpo-vn-max-loop-depth loops and
10536 the outermost loop in the loop nest are value-numbered
10537 optimistically and the remaining ones not.
10538
10539 sccvn-max-alias-queries-per-access
10540 Maximum number of alias-oracle queries we perform when looking
10541 for redundancies for loads and stores. If this limit is hit
10542 the search is aborted and the load or store is not considered
10543 redundant. The number of queries is algorithmically limited to
10544 the number of stores on all paths from the load to the function
10545 entry.
10546
10547 ira-max-loops-num
10548 IRA uses regional register allocation by default. If a
10549 function contains more loops than the number given by this
10550 parameter, only at most the given number of the most
10551 frequently-executed loops form regions for regional register
10552 allocation.
10553
10554 ira-max-conflict-table-size
10555 Although IRA uses a sophisticated algorithm to compress the
10556 conflict table, the table can still require excessive amounts
10557 of memory for huge functions. If the conflict table for a
10558 function could be more than the size in MB given by this
10559 parameter, the register allocator instead uses a faster,
10560 simpler, and lower-quality algorithm that does not require
10561 building a pseudo-register conflict table.
10562
10563 ira-loop-reserved-regs
10564 IRA can be used to evaluate more accurate register pressure in
10565 loops for decisions to move loop invariants (see -O3). The
10566 number of available registers reserved for some other purposes
10567 is given by this parameter. Default of the parameter is the
10568 best found from numerous experiments.
10569
10570 lra-inheritance-ebb-probability-cutoff
10571 LRA tries to reuse values reloaded in registers in subsequent
10572 insns. This optimization is called inheritance. EBB is used
10573 as a region to do this optimization. The parameter defines a
10574 minimal fall-through edge probability in percentage used to add
10575 BB to inheritance EBB in LRA. The default value was chosen
10576 from numerous runs of SPEC2000 on x86-64.
10577
10578 loop-invariant-max-bbs-in-loop
10579 Loop invariant motion can be very expensive, both in
10580 compilation time and in amount of needed compile-time memory,
10581 with very large loops. Loops with more basic blocks than this
10582 parameter won't have loop invariant motion optimization
10583 performed on them.
10584
10585 loop-max-datarefs-for-datadeps
10586 Building data dependencies is expensive for very large loops.
10587 This parameter limits the number of data references in loops
10588 that are considered for data dependence analysis. These large
10589 loops are no handled by the optimizations using loop data
10590 dependencies.
10591
10592 max-vartrack-size
10593 Sets a maximum number of hash table slots to use during
10594 variable tracking dataflow analysis of any function. If this
10595 limit is exceeded with variable tracking at assignments
10596 enabled, analysis for that function is retried without it,
10597 after removing all debug insns from the function. If the limit
10598 is exceeded even without debug insns, var tracking analysis is
10599 completely disabled for the function. Setting the parameter to
10600 zero makes it unlimited.
10601
10602 max-vartrack-expr-depth
10603 Sets a maximum number of recursion levels when attempting to
10604 map variable names or debug temporaries to value expressions.
10605 This trades compilation time for more complete debug
10606 information. If this is set too low, value expressions that
10607 are available and could be represented in debug information may
10608 end up not being used; setting this higher may enable the
10609 compiler to find more complex debug expressions, but compile
10610 time and memory use may grow.
10611
10612 max-debug-marker-count
10613 Sets a threshold on the number of debug markers (e.g. begin
10614 stmt markers) to avoid complexity explosion at inlining or
10615 expanding to RTL. If a function has more such gimple stmts
10616 than the set limit, such stmts will be dropped from the inlined
10617 copy of a function, and from its RTL expansion.
10618
10619 min-nondebug-insn-uid
10620 Use uids starting at this parameter for nondebug insns. The
10621 range below the parameter is reserved exclusively for debug
10622 insns created by -fvar-tracking-assignments, but debug insns
10623 may get (non-overlapping) uids above it if the reserved range
10624 is exhausted.
10625
10626 ipa-sra-ptr-growth-factor
10627 IPA-SRA replaces a pointer to an aggregate with one or more new
10628 parameters only when their cumulative size is less or equal to
10629 ipa-sra-ptr-growth-factor times the size of the original
10630 pointer parameter.
10631
10632 ipa-sra-max-replacements
10633 Maximum pieces of an aggregate that IPA-SRA tracks. As a
10634 consequence, it is also the maximum number of replacements of a
10635 formal parameter.
10636
10637 sra-max-scalarization-size-Ospeed
10638 sra-max-scalarization-size-Osize
10639 The two Scalar Reduction of Aggregates passes (SRA and IPA-SRA)
10640 aim to replace scalar parts of aggregates with uses of
10641 independent scalar variables. These parameters control the
10642 maximum size, in storage units, of aggregate which is
10643 considered for replacement when compiling for speed (sra-max-
10644 scalarization-size-Ospeed) or size (sra-max-scalarization-size-
10645 Osize) respectively.
10646
10647 sra-max-propagations
10648 The maximum number of artificial accesses that Scalar
10649 Replacement of Aggregates (SRA) will track, per one local
10650 variable, in order to facilitate copy propagation.
10651
10652 tm-max-aggregate-size
10653 When making copies of thread-local variables in a transaction,
10654 this parameter specifies the size in bytes after which
10655 variables are saved with the logging functions as opposed to
10656 save/restore code sequence pairs. This option only applies
10657 when using -fgnu-tm.
10658
10659 graphite-max-nb-scop-params
10660 To avoid exponential effects in the Graphite loop transforms,
10661 the number of parameters in a Static Control Part (SCoP) is
10662 bounded. A value of zero can be used to lift the bound. A
10663 variable whose value is unknown at compilation time and defined
10664 outside a SCoP is a parameter of the SCoP.
10665
10666 loop-block-tile-size
10667 Loop blocking or strip mining transforms, enabled with
10668 -floop-block or -floop-strip-mine, strip mine each loop in the
10669 loop nest by a given number of iterations. The strip length
10670 can be changed using the loop-block-tile-size parameter.
10671
10672 ipa-cp-value-list-size
10673 IPA-CP attempts to track all possible values and types passed
10674 to a function's parameter in order to propagate them and
10675 perform devirtualization. ipa-cp-value-list-size is the
10676 maximum number of values and types it stores per one formal
10677 parameter of a function.
10678
10679 ipa-cp-eval-threshold
10680 IPA-CP calculates its own score of cloning profitability
10681 heuristics and performs those cloning opportunities with scores
10682 that exceed ipa-cp-eval-threshold.
10683
10684 ipa-cp-max-recursive-depth
10685 Maximum depth of recursive cloning for self-recursive function.
10686
10687 ipa-cp-min-recursive-probability
10688 Recursive cloning only when the probability of call being
10689 executed exceeds the parameter.
10690
10691 ipa-cp-recursion-penalty
10692 Percentage penalty the recursive functions will receive when
10693 they are evaluated for cloning.
10694
10695 ipa-cp-single-call-penalty
10696 Percentage penalty functions containing a single call to
10697 another function will receive when they are evaluated for
10698 cloning.
10699
10700 ipa-max-agg-items
10701 IPA-CP is also capable to propagate a number of scalar values
10702 passed in an aggregate. ipa-max-agg-items controls the maximum
10703 number of such values per one parameter.
10704
10705 ipa-cp-loop-hint-bonus
10706 When IPA-CP determines that a cloning candidate would make the
10707 number of iterations of a loop known, it adds a bonus of ipa-
10708 cp-loop-hint-bonus to the profitability score of the candidate.
10709
10710 ipa-max-aa-steps
10711 During its analysis of function bodies, IPA-CP employs alias
10712 analysis in order to track values pointed to by function
10713 parameters. In order not spend too much time analyzing huge
10714 functions, it gives up and consider all memory clobbered after
10715 examining ipa-max-aa-steps statements modifying memory.
10716
10717 ipa-max-switch-predicate-bounds
10718 Maximal number of boundary endpoints of case ranges of switch
10719 statement. For switch exceeding this limit, IPA-CP will not
10720 construct cloning cost predicate, which is used to estimate
10721 cloning benefit, for default case of the switch statement.
10722
10723 ipa-max-param-expr-ops
10724 IPA-CP will analyze conditional statement that references some
10725 function parameter to estimate benefit for cloning upon certain
10726 constant value. But if number of operations in a parameter
10727 expression exceeds ipa-max-param-expr-ops, the expression is
10728 treated as complicated one, and is not handled by IPA analysis.
10729
10730 lto-partitions
10731 Specify desired number of partitions produced during WHOPR
10732 compilation. The number of partitions should exceed the number
10733 of CPUs used for compilation.
10734
10735 lto-min-partition
10736 Size of minimal partition for WHOPR (in estimated
10737 instructions). This prevents expenses of splitting very small
10738 programs into too many partitions.
10739
10740 lto-max-partition
10741 Size of max partition for WHOPR (in estimated instructions).
10742 to provide an upper bound for individual size of partition.
10743 Meant to be used only with balanced partitioning.
10744
10745 lto-max-streaming-parallelism
10746 Maximal number of parallel processes used for LTO streaming.
10747
10748 cxx-max-namespaces-for-diagnostic-help
10749 The maximum number of namespaces to consult for suggestions
10750 when C++ name lookup fails for an identifier.
10751
10752 sink-frequency-threshold
10753 The maximum relative execution frequency (in percents) of the
10754 target block relative to a statement's original block to allow
10755 statement sinking of a statement. Larger numbers result in
10756 more aggressive statement sinking. A small positive adjustment
10757 is applied for statements with memory operands as those are
10758 even more profitable so sink.
10759
10760 max-stores-to-sink
10761 The maximum number of conditional store pairs that can be sunk.
10762 Set to 0 if either vectorization (-ftree-vectorize) or if-
10763 conversion (-ftree-loop-if-convert) is disabled.
10764
10765 case-values-threshold
10766 The smallest number of different values for which it is best to
10767 use a jump-table instead of a tree of conditional branches. If
10768 the value is 0, use the default for the machine.
10769
10770 jump-table-max-growth-ratio-for-size
10771 The maximum code size growth ratio when expanding into a jump
10772 table (in percent). The parameter is used when optimizing for
10773 size.
10774
10775 jump-table-max-growth-ratio-for-speed
10776 The maximum code size growth ratio when expanding into a jump
10777 table (in percent). The parameter is used when optimizing for
10778 speed.
10779
10780 tree-reassoc-width
10781 Set the maximum number of instructions executed in parallel in
10782 reassociated tree. This parameter overrides target dependent
10783 heuristics used by default if has non zero value.
10784
10785 sched-pressure-algorithm
10786 Choose between the two available implementations of
10787 -fsched-pressure. Algorithm 1 is the original implementation
10788 and is the more likely to prevent instructions from being
10789 reordered. Algorithm 2 was designed to be a compromise between
10790 the relatively conservative approach taken by algorithm 1 and
10791 the rather aggressive approach taken by the default scheduler.
10792 It relies more heavily on having a regular register file and
10793 accurate register pressure classes. See haifa-sched.c in the
10794 GCC sources for more details.
10795
10796 The default choice depends on the target.
10797
10798 max-slsr-cand-scan
10799 Set the maximum number of existing candidates that are
10800 considered when seeking a basis for a new straight-line
10801 strength reduction candidate.
10802
10803 asan-globals
10804 Enable buffer overflow detection for global objects. This kind
10805 of protection is enabled by default if you are using
10806 -fsanitize=address option. To disable global objects
10807 protection use --param asan-globals=0.
10808
10809 asan-stack
10810 Enable buffer overflow detection for stack objects. This kind
10811 of protection is enabled by default when using
10812 -fsanitize=address. To disable stack protection use --param
10813 asan-stack=0 option.
10814
10815 asan-instrument-reads
10816 Enable buffer overflow detection for memory reads. This kind
10817 of protection is enabled by default when using
10818 -fsanitize=address. To disable memory reads protection use
10819 --param asan-instrument-reads=0.
10820
10821 asan-instrument-writes
10822 Enable buffer overflow detection for memory writes. This kind
10823 of protection is enabled by default when using
10824 -fsanitize=address. To disable memory writes protection use
10825 --param asan-instrument-writes=0 option.
10826
10827 asan-memintrin
10828 Enable detection for built-in functions. This kind of
10829 protection is enabled by default when using -fsanitize=address.
10830 To disable built-in functions protection use --param
10831 asan-memintrin=0.
10832
10833 asan-use-after-return
10834 Enable detection of use-after-return. This kind of protection
10835 is enabled by default when using the -fsanitize=address option.
10836 To disable it use --param asan-use-after-return=0.
10837
10838 Note: By default the check is disabled at run time. To enable
10839 it, add "detect_stack_use_after_return=1" to the environment
10840 variable ASAN_OPTIONS.
10841
10842 asan-instrumentation-with-call-threshold
10843 If number of memory accesses in function being instrumented is
10844 greater or equal to this number, use callbacks instead of
10845 inline checks. E.g. to disable inline code use --param
10846 asan-instrumentation-with-call-threshold=0.
10847
10848 use-after-scope-direct-emission-threshold
10849 If the size of a local variable in bytes is smaller or equal to
10850 this number, directly poison (or unpoison) shadow memory
10851 instead of using run-time callbacks.
10852
10853 max-fsm-thread-path-insns
10854 Maximum number of instructions to copy when duplicating blocks
10855 on a finite state automaton jump thread path.
10856
10857 max-fsm-thread-length
10858 Maximum number of basic blocks on a finite state automaton jump
10859 thread path.
10860
10861 max-fsm-thread-paths
10862 Maximum number of new jump thread paths to create for a finite
10863 state automaton.
10864
10865 parloops-chunk-size
10866 Chunk size of omp schedule for loops parallelized by parloops.
10867
10868 parloops-schedule
10869 Schedule type of omp schedule for loops parallelized by
10870 parloops (static, dynamic, guided, auto, runtime).
10871
10872 parloops-min-per-thread
10873 The minimum number of iterations per thread of an innermost
10874 parallelized loop for which the parallelized variant is
10875 preferred over the single threaded one. Note that for a
10876 parallelized loop nest the minimum number of iterations of the
10877 outermost loop per thread is two.
10878
10879 max-ssa-name-query-depth
10880 Maximum depth of recursion when querying properties of SSA
10881 names in things like fold routines. One level of recursion
10882 corresponds to following a use-def chain.
10883
10884 hsa-gen-debug-stores
10885 Enable emission of special debug stores within HSA kernels
10886 which are then read and reported by libgomp plugin. Generation
10887 of these stores is disabled by default, use --param
10888 hsa-gen-debug-stores=1 to enable it.
10889
10890 max-speculative-devirt-maydefs
10891 The maximum number of may-defs we analyze when looking for a
10892 must-def specifying the dynamic type of an object that invokes
10893 a virtual call we may be able to devirtualize speculatively.
10894
10895 max-vrp-switch-assertions
10896 The maximum number of assertions to add along the default edge
10897 of a switch statement during VRP.
10898
10899 unroll-jam-min-percent
10900 The minimum percentage of memory references that must be
10901 optimized away for the unroll-and-jam transformation to be
10902 considered profitable.
10903
10904 unroll-jam-max-unroll
10905 The maximum number of times the outer loop should be unrolled
10906 by the unroll-and-jam transformation.
10907
10908 max-rtl-if-conversion-unpredictable-cost
10909 Maximum permissible cost for the sequence that would be
10910 generated by the RTL if-conversion pass for a branch that is
10911 considered unpredictable.
10912
10913 max-variable-expansions-in-unroller
10914 If -fvariable-expansion-in-unroller is used, the maximum number
10915 of times that an individual variable will be expanded during
10916 loop unrolling.
10917
10918 tracer-min-branch-probability-feedback
10919 Stop forward growth if the probability of best edge is less
10920 than this threshold (in percent). Used when profile feedback is
10921 available.
10922
10923 partial-inlining-entry-probability
10924 Maximum probability of the entry BB of split region (in percent
10925 relative to entry BB of the function) to make partial inlining
10926 happen.
10927
10928 max-tracked-strlens
10929 Maximum number of strings for which strlen optimization pass
10930 will track string lengths.
10931
10932 gcse-after-reload-partial-fraction
10933 The threshold ratio for performing partial redundancy
10934 elimination after reload.
10935
10936 gcse-after-reload-critical-fraction
10937 The threshold ratio of critical edges execution count that
10938 permit performing redundancy elimination after reload.
10939
10940 max-loop-header-insns
10941 The maximum number of insns in loop header duplicated by the
10942 copy loop headers pass.
10943
10944 vect-epilogues-nomask
10945 Enable loop epilogue vectorization using smaller vector size.
10946
10947 slp-max-insns-in-bb
10948 Maximum number of instructions in basic block to be considered
10949 for SLP vectorization.
10950
10951 avoid-fma-max-bits
10952 Maximum number of bits for which we avoid creating FMAs.
10953
10954 sms-loop-average-count-threshold
10955 A threshold on the average loop count considered by the swing
10956 modulo scheduler.
10957
10958 sms-dfa-history
10959 The number of cycles the swing modulo scheduler considers when
10960 checking conflicts using DFA.
10961
10962 max-inline-insns-recursive-auto
10963 The maximum number of instructions non-inline function can grow
10964 to via recursive inlining.
10965
10966 graphite-allow-codegen-errors
10967 Whether codegen errors should be ICEs when -fchecking.
10968
10969 sms-max-ii-factor
10970 A factor for tuning the upper bound that swing modulo scheduler
10971 uses for scheduling a loop.
10972
10973 lra-max-considered-reload-pseudos
10974 The max number of reload pseudos which are considered during
10975 spilling a non-reload pseudo.
10976
10977 max-pow-sqrt-depth
10978 Maximum depth of sqrt chains to use when synthesizing
10979 exponentiation by a real constant.
10980
10981 max-dse-active-local-stores
10982 Maximum number of active local stores in RTL dead store
10983 elimination.
10984
10985 asan-instrument-allocas
10986 Enable asan allocas/VLAs protection.
10987
10988 max-iterations-computation-cost
10989 Bound on the cost of an expression to compute the number of
10990 iterations.
10991
10992 max-isl-operations
10993 Maximum number of isl operations, 0 means unlimited.
10994
10995 graphite-max-arrays-per-scop
10996 Maximum number of arrays per scop.
10997
10998 max-vartrack-reverse-op-size
10999 Max. size of loc list for which reverse ops should be added.
11000
11001 tracer-dynamic-coverage-feedback
11002 The percentage of function, weighted by execution frequency,
11003 that must be covered by trace formation. Used when profile
11004 feedback is available.
11005
11006 max-inline-recursive-depth-auto
11007 The maximum depth of recursive inlining for non-inline
11008 functions.
11009
11010 fsm-scale-path-stmts
11011 Scale factor to apply to the number of statements in a
11012 threading path when comparing to the number of (scaled) blocks.
11013
11014 fsm-maximum-phi-arguments
11015 Maximum number of arguments a PHI may have before the FSM
11016 threader will not try to thread through its block.
11017
11018 uninit-control-dep-attempts
11019 Maximum number of nested calls to search for control
11020 dependencies during uninitialized variable analysis.
11021
11022 max-once-peeled-insns
11023 The maximum number of insns of a peeled loop that rolls only
11024 once.
11025
11026 sra-max-scalarization-size-Osize
11027 Maximum size, in storage units, of an aggregate which should be
11028 considered for scalarization when compiling for size.
11029
11030 fsm-scale-path-blocks
11031 Scale factor to apply to the number of blocks in a threading
11032 path when comparing to the number of (scaled) statements.
11033
11034 sched-autopref-queue-depth
11035 Hardware autoprefetcher scheduler model control flag. Number
11036 of lookahead cycles the model looks into; at ' ' only enable
11037 instruction sorting heuristic.
11038
11039 loop-versioning-max-inner-insns
11040 The maximum number of instructions that an inner loop can have
11041 before the loop versioning pass considers it too big to copy.
11042
11043 loop-versioning-max-outer-insns
11044 The maximum number of instructions that an outer loop can have
11045 before the loop versioning pass considers it too big to copy,
11046 discounting any instructions in inner loops that directly
11047 benefit from versioning.
11048
11049 ssa-name-def-chain-limit
11050 The maximum number of SSA_NAME assignments to follow in
11051 determining a property of a variable such as its value. This
11052 limits the number of iterations or recursive calls GCC performs
11053 when optimizing certain statements or when determining their
11054 validity prior to issuing diagnostics.
11055
11056 The following choices of name are available on AArch64 targets:
11057
11058 aarch64-sve-compare-costs
11059 When vectorizing for SVE, consider using "unpacked" vectors for
11060 smaller elements and use the cost model to pick the cheapest
11061 approach. Also use the cost model to choose between SVE and
11062 Advanced SIMD vectorization.
11063
11064 Using unpacked vectors includes storing smaller elements in
11065 larger containers and accessing elements with extending loads
11066 and truncating stores.
11067
11068 aarch64-float-recp-precision
11069 The number of Newton iterations for calculating the reciprocal
11070 for float type. The precision of division is proportional to
11071 this param when division approximation is enabled. The default
11072 value is 1.
11073
11074 aarch64-double-recp-precision
11075 The number of Newton iterations for calculating the reciprocal
11076 for double type. The precision of division is propotional to
11077 this param when division approximation is enabled. The default
11078 value is 2.
11079
11080 Program Instrumentation Options
11081 GCC supports a number of command-line options that control adding run-
11082 time instrumentation to the code it normally generates. For example,
11083 one purpose of instrumentation is collect profiling statistics for use
11084 in finding program hot spots, code coverage analysis, or profile-guided
11085 optimizations. Another class of program instrumentation is adding run-
11086 time checking to detect programming errors like invalid pointer
11087 dereferences or out-of-bounds array accesses, as well as deliberately
11088 hostile attacks such as stack smashing or C++ vtable hijacking. There
11089 is also a general hook which can be used to implement other forms of
11090 tracing or function-level instrumentation for debug or program analysis
11091 purposes.
11092
11093 -p
11094 -pg Generate extra code to write profile information suitable for the
11095 analysis program prof (for -p) or gprof (for -pg). You must use
11096 this option when compiling the source files you want data about,
11097 and you must also use it when linking.
11098
11099 You can use the function attribute "no_instrument_function" to
11100 suppress profiling of individual functions when compiling with
11101 these options.
11102
11103 -fprofile-arcs
11104 Add code so that program flow arcs are instrumented. During
11105 execution the program records how many times each branch and call
11106 is executed and how many times it is taken or returns. On targets
11107 that support constructors with priority support, profiling properly
11108 handles constructors, destructors and C++ constructors (and
11109 destructors) of classes which are used as a type of a global
11110 variable.
11111
11112 When the compiled program exits it saves this data to a file called
11113 auxname.gcda for each source file. The data may be used for
11114 profile-directed optimizations (-fbranch-probabilities), or for
11115 test coverage analysis (-ftest-coverage). Each object file's
11116 auxname is generated from the name of the output file, if
11117 explicitly specified and it is not the final executable, otherwise
11118 it is the basename of the source file. In both cases any suffix is
11119 removed (e.g. foo.gcda for input file dir/foo.c, or dir/foo.gcda
11120 for output file specified as -o dir/foo.o).
11121
11122 --coverage
11123 This option is used to compile and link code instrumented for
11124 coverage analysis. The option is a synonym for -fprofile-arcs
11125 -ftest-coverage (when compiling) and -lgcov (when linking). See
11126 the documentation for those options for more details.
11127
11128 * Compile the source files with -fprofile-arcs plus optimization
11129 and code generation options. For test coverage analysis, use
11130 the additional -ftest-coverage option. You do not need to
11131 profile every source file in a program.
11132
11133 * Compile the source files additionally with -fprofile-abs-path
11134 to create absolute path names in the .gcno files. This allows
11135 gcov to find the correct sources in projects where compilations
11136 occur with different working directories.
11137
11138 * Link your object files with -lgcov or -fprofile-arcs (the
11139 latter implies the former).
11140
11141 * Run the program on a representative workload to generate the
11142 arc profile information. This may be repeated any number of
11143 times. You can run concurrent instances of your program, and
11144 provided that the file system supports locking, the data files
11145 will be correctly updated. Unless a strict ISO C dialect
11146 option is in effect, "fork" calls are detected and correctly
11147 handled without double counting.
11148
11149 * For profile-directed optimizations, compile the source files
11150 again with the same optimization and code generation options
11151 plus -fbranch-probabilities.
11152
11153 * For test coverage analysis, use gcov to produce human readable
11154 information from the .gcno and .gcda files. Refer to the gcov
11155 documentation for further information.
11156
11157 With -fprofile-arcs, for each function of your program GCC creates
11158 a program flow graph, then finds a spanning tree for the graph.
11159 Only arcs that are not on the spanning tree have to be
11160 instrumented: the compiler adds code to count the number of times
11161 that these arcs are executed. When an arc is the only exit or only
11162 entrance to a block, the instrumentation code can be added to the
11163 block; otherwise, a new basic block must be created to hold the
11164 instrumentation code.
11165
11166 -ftest-coverage
11167 Produce a notes file that the gcov code-coverage utility can use to
11168 show program coverage. Each source file's note file is called
11169 auxname.gcno. Refer to the -fprofile-arcs option above for a
11170 description of auxname and instructions on how to generate test
11171 coverage data. Coverage data matches the source files more closely
11172 if you do not optimize.
11173
11174 -fprofile-abs-path
11175 Automatically convert relative source file names to absolute path
11176 names in the .gcno files. This allows gcov to find the correct
11177 sources in projects where compilations occur with different working
11178 directories.
11179
11180 -fprofile-dir=path
11181 Set the directory to search for the profile data files in to path.
11182 This option affects only the profile data generated by
11183 -fprofile-generate, -ftest-coverage, -fprofile-arcs and used by
11184 -fprofile-use and -fbranch-probabilities and its related options.
11185 Both absolute and relative paths can be used. By default, GCC uses
11186 the current directory as path, thus the profile data file appears
11187 in the same directory as the object file. In order to prevent the
11188 file name clashing, if the object file name is not an absolute
11189 path, we mangle the absolute path of the sourcename.gcda file and
11190 use it as the file name of a .gcda file. See similar option
11191 -fprofile-note.
11192
11193 When an executable is run in a massive parallel environment, it is
11194 recommended to save profile to different folders. That can be done
11195 with variables in path that are exported during run-time:
11196
11197 %p process ID.
11198
11199 %q{VAR}
11200 value of environment variable VAR
11201
11202 -fprofile-generate
11203 -fprofile-generate=path
11204 Enable options usually used for instrumenting application to
11205 produce profile useful for later recompilation with profile
11206 feedback based optimization. You must use -fprofile-generate both
11207 when compiling and when linking your program.
11208
11209 The following options are enabled: -fprofile-arcs,
11210 -fprofile-values, -finline-functions, and -fipa-bit-cp.
11211
11212 If path is specified, GCC looks at the path to find the profile
11213 feedback data files. See -fprofile-dir.
11214
11215 To optimize the program based on the collected profile information,
11216 use -fprofile-use.
11217
11218 -fprofile-note=path
11219 If path is specified, GCC saves .gcno file into path location. If
11220 you combine the option with multiple source files, the .gcno file
11221 will be overwritten.
11222
11223 -fprofile-prefix-path=path
11224 This option can be used in combination with
11225 profile-generate=profile_dir and profile-use=profile_dir to inform
11226 GCC where is the base directory of built source tree. By default
11227 profile_dir will contain files with mangled absolute paths of all
11228 object files in the built project. This is not desirable when
11229 directory used to build the instrumented binary differs from the
11230 directory used to build the binary optimized with profile feedback
11231 because the profile data will not be found during the optimized
11232 build. In such setups -fprofile-prefix-path=path with path
11233 pointing to the base directory of the build can be used to strip
11234 the irrelevant part of the path and keep all file names relative to
11235 the main build directory.
11236
11237 -fprofile-update=method
11238 Alter the update method for an application instrumented for profile
11239 feedback based optimization. The method argument should be one of
11240 single, atomic or prefer-atomic. The first one is useful for
11241 single-threaded applications, while the second one prevents profile
11242 corruption by emitting thread-safe code.
11243
11244 Warning: When an application does not properly join all threads (or
11245 creates an detached thread), a profile file can be still corrupted.
11246
11247 Using prefer-atomic would be transformed either to atomic, when
11248 supported by a target, or to single otherwise. The GCC driver
11249 automatically selects prefer-atomic when -pthread is present in the
11250 command line.
11251
11252 -fprofile-filter-files=regex
11253 Instrument only functions from files where names match any regular
11254 expression (separated by a semi-colon).
11255
11256 For example, -fprofile-filter-files=main.c;module.*.c will
11257 instrument only main.c and all C files starting with 'module'.
11258
11259 -fprofile-exclude-files=regex
11260 Instrument only functions from files where names do not match all
11261 the regular expressions (separated by a semi-colon).
11262
11263 For example, -fprofile-exclude-files=/usr/* will prevent
11264 instrumentation of all files that are located in /usr/ folder.
11265
11266 -fprofile-reproducible
11267 Control level of reproducibility of profile gathered by
11268 "-fprofile-generate". This makes it possible to rebuild program
11269 with same outcome which is useful, for example, for distribution
11270 packages.
11271
11272 With -fprofile-reproducibility=serial the profile gathered by
11273 -fprofile-generate is reproducible provided the trained program
11274 behaves the same at each invocation of the train run, it is not
11275 multi-threaded and profile data streaming is always done in the
11276 same order. Note that profile streaming happens at the end of
11277 program run but also before "fork" function is invoked.
11278
11279 Note that it is quite common that execution counts of some part of
11280 programs depends, for example, on length of temporary file names or
11281 memory space randomization (that may affect hash-table collision
11282 rate). Such non-reproducible part of programs may be annotated by
11283 "no_instrument_function" function attribute. "gcov-dump" with -l
11284 can be used to dump gathered data and verify that they are indeed
11285 reproducible.
11286
11287 With -fprofile-reproducibility=parallel-runs collected profile
11288 stays reproducible regardless the order of streaming of the data
11289 into gcda files. This setting makes it possible to run multiple
11290 instances of instrumented program in parallel (such as with "make
11291 -j"). This reduces quality of gathered data, in particular of
11292 indirect call profiling.
11293
11294 -fsanitize=address
11295 Enable AddressSanitizer, a fast memory error detector. Memory
11296 access instructions are instrumented to detect out-of-bounds and
11297 use-after-free bugs. The option enables
11298 -fsanitize-address-use-after-scope. See
11299 <https://github.com/google/sanitizers/wiki/AddressSanitizer> for
11300 more details. The run-time behavior can be influenced using the
11301 ASAN_OPTIONS environment variable. When set to "help=1", the
11302 available options are shown at startup of the instrumented program.
11303 See
11304 <https://github.com/google/sanitizers/wiki/AddressSanitizerFlags#run-time-flags>
11305 for a list of supported options. The option cannot be combined
11306 with -fsanitize=thread.
11307
11308 -fsanitize=kernel-address
11309 Enable AddressSanitizer for Linux kernel. See
11310 <https://github.com/google/kasan/wiki> for more details.
11311
11312 -fsanitize=pointer-compare
11313 Instrument comparison operation (<, <=, >, >=) with pointer
11314 operands. The option must be combined with either
11315 -fsanitize=kernel-address or -fsanitize=address The option cannot
11316 be combined with -fsanitize=thread. Note: By default the check is
11317 disabled at run time. To enable it, add
11318 "detect_invalid_pointer_pairs=2" to the environment variable
11319 ASAN_OPTIONS. Using "detect_invalid_pointer_pairs=1" detects
11320 invalid operation only when both pointers are non-null.
11321
11322 -fsanitize=pointer-subtract
11323 Instrument subtraction with pointer operands. The option must be
11324 combined with either -fsanitize=kernel-address or
11325 -fsanitize=address The option cannot be combined with
11326 -fsanitize=thread. Note: By default the check is disabled at run
11327 time. To enable it, add "detect_invalid_pointer_pairs=2" to the
11328 environment variable ASAN_OPTIONS. Using
11329 "detect_invalid_pointer_pairs=1" detects invalid operation only
11330 when both pointers are non-null.
11331
11332 -fsanitize=thread
11333 Enable ThreadSanitizer, a fast data race detector. Memory access
11334 instructions are instrumented to detect data race bugs. See
11335 <https://github.com/google/sanitizers/wiki#threadsanitizer> for
11336 more details. The run-time behavior can be influenced using the
11337 TSAN_OPTIONS environment variable; see
11338 <https://github.com/google/sanitizers/wiki/ThreadSanitizerFlags>
11339 for a list of supported options. The option cannot be combined
11340 with -fsanitize=address, -fsanitize=leak.
11341
11342 Note that sanitized atomic builtins cannot throw exceptions when
11343 operating on invalid memory addresses with non-call exceptions
11344 (-fnon-call-exceptions).
11345
11346 -fsanitize=leak
11347 Enable LeakSanitizer, a memory leak detector. This option only
11348 matters for linking of executables and the executable is linked
11349 against a library that overrides "malloc" and other allocator
11350 functions. See
11351 <https://github.com/google/sanitizers/wiki/AddressSanitizerLeakSanitizer>
11352 for more details. The run-time behavior can be influenced using
11353 the LSAN_OPTIONS environment variable. The option cannot be
11354 combined with -fsanitize=thread.
11355
11356 -fsanitize=undefined
11357 Enable UndefinedBehaviorSanitizer, a fast undefined behavior
11358 detector. Various computations are instrumented to detect
11359 undefined behavior at runtime. Current suboptions are:
11360
11361 -fsanitize=shift
11362 This option enables checking that the result of a shift
11363 operation is not undefined. Note that what exactly is
11364 considered undefined differs slightly between C and C++, as
11365 well as between ISO C90 and C99, etc. This option has two
11366 suboptions, -fsanitize=shift-base and
11367 -fsanitize=shift-exponent.
11368
11369 -fsanitize=shift-exponent
11370 This option enables checking that the second argument of a
11371 shift operation is not negative and is smaller than the
11372 precision of the promoted first argument.
11373
11374 -fsanitize=shift-base
11375 If the second argument of a shift operation is within range,
11376 check that the result of a shift operation is not undefined.
11377 Note that what exactly is considered undefined differs slightly
11378 between C and C++, as well as between ISO C90 and C99, etc.
11379
11380 -fsanitize=integer-divide-by-zero
11381 Detect integer division by zero as well as "INT_MIN / -1"
11382 division.
11383
11384 -fsanitize=unreachable
11385 With this option, the compiler turns the
11386 "__builtin_unreachable" call into a diagnostics message call
11387 instead. When reaching the "__builtin_unreachable" call, the
11388 behavior is undefined.
11389
11390 -fsanitize=vla-bound
11391 This option instructs the compiler to check that the size of a
11392 variable length array is positive.
11393
11394 -fsanitize=null
11395 This option enables pointer checking. Particularly, the
11396 application built with this option turned on will issue an
11397 error message when it tries to dereference a NULL pointer, or
11398 if a reference (possibly an rvalue reference) is bound to a
11399 NULL pointer, or if a method is invoked on an object pointed by
11400 a NULL pointer.
11401
11402 -fsanitize=return
11403 This option enables return statement checking. Programs built
11404 with this option turned on will issue an error message when the
11405 end of a non-void function is reached without actually
11406 returning a value. This option works in C++ only.
11407
11408 -fsanitize=signed-integer-overflow
11409 This option enables signed integer overflow checking. We check
11410 that the result of "+", "*", and both unary and binary "-" does
11411 not overflow in the signed arithmetics. Note, integer
11412 promotion rules must be taken into account. That is, the
11413 following is not an overflow:
11414
11415 signed char a = SCHAR_MAX;
11416 a++;
11417
11418 -fsanitize=bounds
11419 This option enables instrumentation of array bounds. Various
11420 out of bounds accesses are detected. Flexible array members,
11421 flexible array member-like arrays, and initializers of
11422 variables with static storage are not instrumented.
11423
11424 -fsanitize=bounds-strict
11425 This option enables strict instrumentation of array bounds.
11426 Most out of bounds accesses are detected, including flexible
11427 array members and flexible array member-like arrays.
11428 Initializers of variables with static storage are not
11429 instrumented.
11430
11431 -fsanitize=alignment
11432 This option enables checking of alignment of pointers when they
11433 are dereferenced, or when a reference is bound to
11434 insufficiently aligned target, or when a method or constructor
11435 is invoked on insufficiently aligned object.
11436
11437 -fsanitize=object-size
11438 This option enables instrumentation of memory references using
11439 the "__builtin_object_size" function. Various out of bounds
11440 pointer accesses are detected.
11441
11442 -fsanitize=float-divide-by-zero
11443 Detect floating-point division by zero. Unlike other similar
11444 options, -fsanitize=float-divide-by-zero is not enabled by
11445 -fsanitize=undefined, since floating-point division by zero can
11446 be a legitimate way of obtaining infinities and NaNs.
11447
11448 -fsanitize=float-cast-overflow
11449 This option enables floating-point type to integer conversion
11450 checking. We check that the result of the conversion does not
11451 overflow. Unlike other similar options,
11452 -fsanitize=float-cast-overflow is not enabled by
11453 -fsanitize=undefined. This option does not work well with
11454 "FE_INVALID" exceptions enabled.
11455
11456 -fsanitize=nonnull-attribute
11457 This option enables instrumentation of calls, checking whether
11458 null values are not passed to arguments marked as requiring a
11459 non-null value by the "nonnull" function attribute.
11460
11461 -fsanitize=returns-nonnull-attribute
11462 This option enables instrumentation of return statements in
11463 functions marked with "returns_nonnull" function attribute, to
11464 detect returning of null values from such functions.
11465
11466 -fsanitize=bool
11467 This option enables instrumentation of loads from bool. If a
11468 value other than 0/1 is loaded, a run-time error is issued.
11469
11470 -fsanitize=enum
11471 This option enables instrumentation of loads from an enum type.
11472 If a value outside the range of values for the enum type is
11473 loaded, a run-time error is issued.
11474
11475 -fsanitize=vptr
11476 This option enables instrumentation of C++ member function
11477 calls, member accesses and some conversions between pointers to
11478 base and derived classes, to verify the referenced object has
11479 the correct dynamic type.
11480
11481 -fsanitize=pointer-overflow
11482 This option enables instrumentation of pointer arithmetics. If
11483 the pointer arithmetics overflows, a run-time error is issued.
11484
11485 -fsanitize=builtin
11486 This option enables instrumentation of arguments to selected
11487 builtin functions. If an invalid value is passed to such
11488 arguments, a run-time error is issued. E.g. passing 0 as the
11489 argument to "__builtin_ctz" or "__builtin_clz" invokes
11490 undefined behavior and is diagnosed by this option.
11491
11492 While -ftrapv causes traps for signed overflows to be emitted,
11493 -fsanitize=undefined gives a diagnostic message. This currently
11494 works only for the C family of languages.
11495
11496 -fno-sanitize=all
11497 This option disables all previously enabled sanitizers.
11498 -fsanitize=all is not allowed, as some sanitizers cannot be used
11499 together.
11500
11501 -fasan-shadow-offset=number
11502 This option forces GCC to use custom shadow offset in
11503 AddressSanitizer checks. It is useful for experimenting with
11504 different shadow memory layouts in Kernel AddressSanitizer.
11505
11506 -fsanitize-sections=s1,s2,...
11507 Sanitize global variables in selected user-defined sections. si
11508 may contain wildcards.
11509
11510 -fsanitize-recover[=opts]
11511 -fsanitize-recover= controls error recovery mode for sanitizers
11512 mentioned in comma-separated list of opts. Enabling this option
11513 for a sanitizer component causes it to attempt to continue running
11514 the program as if no error happened. This means multiple runtime
11515 errors can be reported in a single program run, and the exit code
11516 of the program may indicate success even when errors have been
11517 reported. The -fno-sanitize-recover= option can be used to alter
11518 this behavior: only the first detected error is reported and
11519 program then exits with a non-zero exit code.
11520
11521 Currently this feature only works for -fsanitize=undefined (and its
11522 suboptions except for -fsanitize=unreachable and
11523 -fsanitize=return), -fsanitize=float-cast-overflow,
11524 -fsanitize=float-divide-by-zero, -fsanitize=bounds-strict,
11525 -fsanitize=kernel-address and -fsanitize=address. For these
11526 sanitizers error recovery is turned on by default, except
11527 -fsanitize=address, for which this feature is experimental.
11528 -fsanitize-recover=all and -fno-sanitize-recover=all is also
11529 accepted, the former enables recovery for all sanitizers that
11530 support it, the latter disables recovery for all sanitizers that
11531 support it.
11532
11533 Even if a recovery mode is turned on the compiler side, it needs to
11534 be also enabled on the runtime library side, otherwise the failures
11535 are still fatal. The runtime library defaults to "halt_on_error=0"
11536 for ThreadSanitizer and UndefinedBehaviorSanitizer, while default
11537 value for AddressSanitizer is "halt_on_error=1". This can be
11538 overridden through setting the "halt_on_error" flag in the
11539 corresponding environment variable.
11540
11541 Syntax without an explicit opts parameter is deprecated. It is
11542 equivalent to specifying an opts list of:
11543
11544 undefined,float-cast-overflow,float-divide-by-zero,bounds-strict
11545
11546 -fsanitize-address-use-after-scope
11547 Enable sanitization of local variables to detect use-after-scope
11548 bugs. The option sets -fstack-reuse to none.
11549
11550 -fsanitize-undefined-trap-on-error
11551 The -fsanitize-undefined-trap-on-error option instructs the
11552 compiler to report undefined behavior using "__builtin_trap" rather
11553 than a "libubsan" library routine. The advantage of this is that
11554 the "libubsan" library is not needed and is not linked in, so this
11555 is usable even in freestanding environments.
11556
11557 -fsanitize-coverage=trace-pc
11558 Enable coverage-guided fuzzing code instrumentation. Inserts a
11559 call to "__sanitizer_cov_trace_pc" into every basic block.
11560
11561 -fsanitize-coverage=trace-cmp
11562 Enable dataflow guided fuzzing code instrumentation. Inserts a
11563 call to "__sanitizer_cov_trace_cmp1", "__sanitizer_cov_trace_cmp2",
11564 "__sanitizer_cov_trace_cmp4" or "__sanitizer_cov_trace_cmp8" for
11565 integral comparison with both operands variable or
11566 "__sanitizer_cov_trace_const_cmp1",
11567 "__sanitizer_cov_trace_const_cmp2",
11568 "__sanitizer_cov_trace_const_cmp4" or
11569 "__sanitizer_cov_trace_const_cmp8" for integral comparison with one
11570 operand constant, "__sanitizer_cov_trace_cmpf" or
11571 "__sanitizer_cov_trace_cmpd" for float or double comparisons and
11572 "__sanitizer_cov_trace_switch" for switch statements.
11573
11574 -fcf-protection=[full|branch|return|none]
11575 Enable code instrumentation of control-flow transfers to increase
11576 program security by checking that target addresses of control-flow
11577 transfer instructions (such as indirect function call, function
11578 return, indirect jump) are valid. This prevents diverting the flow
11579 of control to an unexpected target. This is intended to protect
11580 against such threats as Return-oriented Programming (ROP), and
11581 similarly call/jmp-oriented programming (COP/JOP).
11582
11583 The value "branch" tells the compiler to implement checking of
11584 validity of control-flow transfer at the point of indirect branch
11585 instructions, i.e. call/jmp instructions. The value "return"
11586 implements checking of validity at the point of returning from a
11587 function. The value "full" is an alias for specifying both
11588 "branch" and "return". The value "none" turns off instrumentation.
11589
11590 The macro "__CET__" is defined when -fcf-protection is used. The
11591 first bit of "__CET__" is set to 1 for the value "branch" and the
11592 second bit of "__CET__" is set to 1 for the "return".
11593
11594 You can also use the "nocf_check" attribute to identify which
11595 functions and calls should be skipped from instrumentation.
11596
11597 Currently the x86 GNU/Linux target provides an implementation based
11598 on Intel Control-flow Enforcement Technology (CET).
11599
11600 -fstack-protector
11601 Emit extra code to check for buffer overflows, such as stack
11602 smashing attacks. This is done by adding a guard variable to
11603 functions with vulnerable objects. This includes functions that
11604 call "alloca", and functions with buffers larger than or equal to 8
11605 bytes. The guards are initialized when a function is entered and
11606 then checked when the function exits. If a guard check fails, an
11607 error message is printed and the program exits. Only variables
11608 that are actually allocated on the stack are considered, optimized
11609 away variables or variables allocated in registers don't count.
11610
11611 -fstack-protector-all
11612 Like -fstack-protector except that all functions are protected.
11613
11614 -fstack-protector-strong
11615 Like -fstack-protector but includes additional functions to be
11616 protected --- those that have local array definitions, or have
11617 references to local frame addresses. Only variables that are
11618 actually allocated on the stack are considered, optimized away
11619 variables or variables allocated in registers don't count.
11620
11621 -fstack-protector-explicit
11622 Like -fstack-protector but only protects those functions which have
11623 the "stack_protect" attribute.
11624
11625 -fstack-check
11626 Generate code to verify that you do not go beyond the boundary of
11627 the stack. You should specify this flag if you are running in an
11628 environment with multiple threads, but you only rarely need to
11629 specify it in a single-threaded environment since stack overflow is
11630 automatically detected on nearly all systems if there is only one
11631 stack.
11632
11633 Note that this switch does not actually cause checking to be done;
11634 the operating system or the language runtime must do that. The
11635 switch causes generation of code to ensure that they see the stack
11636 being extended.
11637
11638 You can additionally specify a string parameter: no means no
11639 checking, generic means force the use of old-style checking,
11640 specific means use the best checking method and is equivalent to
11641 bare -fstack-check.
11642
11643 Old-style checking is a generic mechanism that requires no specific
11644 target support in the compiler but comes with the following
11645 drawbacks:
11646
11647 1. Modified allocation strategy for large objects: they are always
11648 allocated dynamically if their size exceeds a fixed threshold.
11649 Note this may change the semantics of some code.
11650
11651 2. Fixed limit on the size of the static frame of functions: when
11652 it is topped by a particular function, stack checking is not
11653 reliable and a warning is issued by the compiler.
11654
11655 3. Inefficiency: because of both the modified allocation strategy
11656 and the generic implementation, code performance is hampered.
11657
11658 Note that old-style stack checking is also the fallback method for
11659 specific if no target support has been added in the compiler.
11660
11661 -fstack-check= is designed for Ada's needs to detect infinite
11662 recursion and stack overflows. specific is an excellent choice
11663 when compiling Ada code. It is not generally sufficient to protect
11664 against stack-clash attacks. To protect against those you want
11665 -fstack-clash-protection.
11666
11667 -fstack-clash-protection
11668 Generate code to prevent stack clash style attacks. When this
11669 option is enabled, the compiler will only allocate one page of
11670 stack space at a time and each page is accessed immediately after
11671 allocation. Thus, it prevents allocations from jumping over any
11672 stack guard page provided by the operating system.
11673
11674 Most targets do not fully support stack clash protection. However,
11675 on those targets -fstack-clash-protection will protect dynamic
11676 stack allocations. -fstack-clash-protection may also provide
11677 limited protection for static stack allocations if the target
11678 supports -fstack-check=specific.
11679
11680 -fstack-limit-register=reg
11681 -fstack-limit-symbol=sym
11682 -fno-stack-limit
11683 Generate code to ensure that the stack does not grow beyond a
11684 certain value, either the value of a register or the address of a
11685 symbol. If a larger stack is required, a signal is raised at run
11686 time. For most targets, the signal is raised before the stack
11687 overruns the boundary, so it is possible to catch the signal
11688 without taking special precautions.
11689
11690 For instance, if the stack starts at absolute address 0x80000000
11691 and grows downwards, you can use the flags
11692 -fstack-limit-symbol=__stack_limit and
11693 -Wl,--defsym,__stack_limit=0x7ffe0000 to enforce a stack limit of
11694 128KB. Note that this may only work with the GNU linker.
11695
11696 You can locally override stack limit checking by using the
11697 "no_stack_limit" function attribute.
11698
11699 -fsplit-stack
11700 Generate code to automatically split the stack before it overflows.
11701 The resulting program has a discontiguous stack which can only
11702 overflow if the program is unable to allocate any more memory.
11703 This is most useful when running threaded programs, as it is no
11704 longer necessary to calculate a good stack size to use for each
11705 thread. This is currently only implemented for the x86 targets
11706 running GNU/Linux.
11707
11708 When code compiled with -fsplit-stack calls code compiled without
11709 -fsplit-stack, there may not be much stack space available for the
11710 latter code to run. If compiling all code, including library code,
11711 with -fsplit-stack is not an option, then the linker can fix up
11712 these calls so that the code compiled without -fsplit-stack always
11713 has a large stack. Support for this is implemented in the gold
11714 linker in GNU binutils release 2.21 and later.
11715
11716 -fvtable-verify=[std|preinit|none]
11717 This option is only available when compiling C++ code. It turns on
11718 (or off, if using -fvtable-verify=none) the security feature that
11719 verifies at run time, for every virtual call, that the vtable
11720 pointer through which the call is made is valid for the type of the
11721 object, and has not been corrupted or overwritten. If an invalid
11722 vtable pointer is detected at run time, an error is reported and
11723 execution of the program is immediately halted.
11724
11725 This option causes run-time data structures to be built at program
11726 startup, which are used for verifying the vtable pointers. The
11727 options std and preinit control the timing of when these data
11728 structures are built. In both cases the data structures are built
11729 before execution reaches "main". Using -fvtable-verify=std causes
11730 the data structures to be built after shared libraries have been
11731 loaded and initialized. -fvtable-verify=preinit causes them to be
11732 built before shared libraries have been loaded and initialized.
11733
11734 If this option appears multiple times in the command line with
11735 different values specified, none takes highest priority over both
11736 std and preinit; preinit takes priority over std.
11737
11738 -fvtv-debug
11739 When used in conjunction with -fvtable-verify=std or
11740 -fvtable-verify=preinit, causes debug versions of the runtime
11741 functions for the vtable verification feature to be called. This
11742 flag also causes the compiler to log information about which vtable
11743 pointers it finds for each class. This information is written to a
11744 file named vtv_set_ptr_data.log in the directory named by the
11745 environment variable VTV_LOGS_DIR if that is defined or the current
11746 working directory otherwise.
11747
11748 Note: This feature appends data to the log file. If you want a
11749 fresh log file, be sure to delete any existing one.
11750
11751 -fvtv-counts
11752 This is a debugging flag. When used in conjunction with
11753 -fvtable-verify=std or -fvtable-verify=preinit, this causes the
11754 compiler to keep track of the total number of virtual calls it
11755 encounters and the number of verifications it inserts. It also
11756 counts the number of calls to certain run-time library functions
11757 that it inserts and logs this information for each compilation
11758 unit. The compiler writes this information to a file named
11759 vtv_count_data.log in the directory named by the environment
11760 variable VTV_LOGS_DIR if that is defined or the current working
11761 directory otherwise. It also counts the size of the vtable pointer
11762 sets for each class, and writes this information to
11763 vtv_class_set_sizes.log in the same directory.
11764
11765 Note: This feature appends data to the log files. To get fresh
11766 log files, be sure to delete any existing ones.
11767
11768 -finstrument-functions
11769 Generate instrumentation calls for entry and exit to functions.
11770 Just after function entry and just before function exit, the
11771 following profiling functions are called with the address of the
11772 current function and its call site. (On some platforms,
11773 "__builtin_return_address" does not work beyond the current
11774 function, so the call site information may not be available to the
11775 profiling functions otherwise.)
11776
11777 void __cyg_profile_func_enter (void *this_fn,
11778 void *call_site);
11779 void __cyg_profile_func_exit (void *this_fn,
11780 void *call_site);
11781
11782 The first argument is the address of the start of the current
11783 function, which may be looked up exactly in the symbol table.
11784
11785 This instrumentation is also done for functions expanded inline in
11786 other functions. The profiling calls indicate where, conceptually,
11787 the inline function is entered and exited. This means that
11788 addressable versions of such functions must be available. If all
11789 your uses of a function are expanded inline, this may mean an
11790 additional expansion of code size. If you use "extern inline" in
11791 your C code, an addressable version of such functions must be
11792 provided. (This is normally the case anyway, but if you get lucky
11793 and the optimizer always expands the functions inline, you might
11794 have gotten away without providing static copies.)
11795
11796 A function may be given the attribute "no_instrument_function", in
11797 which case this instrumentation is not done. This can be used, for
11798 example, for the profiling functions listed above, high-priority
11799 interrupt routines, and any functions from which the profiling
11800 functions cannot safely be called (perhaps signal handlers, if the
11801 profiling routines generate output or allocate memory).
11802
11803 -finstrument-functions-exclude-file-list=file,file,...
11804 Set the list of functions that are excluded from instrumentation
11805 (see the description of -finstrument-functions). If the file that
11806 contains a function definition matches with one of file, then that
11807 function is not instrumented. The match is done on substrings: if
11808 the file parameter is a substring of the file name, it is
11809 considered to be a match.
11810
11811 For example:
11812
11813 -finstrument-functions-exclude-file-list=/bits/stl,include/sys
11814
11815 excludes any inline function defined in files whose pathnames
11816 contain /bits/stl or include/sys.
11817
11818 If, for some reason, you want to include letter , in one of sym,
11819 write ,. For example,
11820 -finstrument-functions-exclude-file-list=',,tmp' (note the single
11821 quote surrounding the option).
11822
11823 -finstrument-functions-exclude-function-list=sym,sym,...
11824 This is similar to -finstrument-functions-exclude-file-list, but
11825 this option sets the list of function names to be excluded from
11826 instrumentation. The function name to be matched is its user-
11827 visible name, such as "vector<int> blah(const vector<int> &)", not
11828 the internal mangled name (e.g., "_Z4blahRSt6vectorIiSaIiEE"). The
11829 match is done on substrings: if the sym parameter is a substring of
11830 the function name, it is considered to be a match. For C99 and C++
11831 extended identifiers, the function name must be given in UTF-8, not
11832 using universal character names.
11833
11834 -fpatchable-function-entry=N[,M]
11835 Generate N NOPs right at the beginning of each function, with the
11836 function entry point before the Mth NOP. If M is omitted, it
11837 defaults to 0 so the function entry points to the address just at
11838 the first NOP. The NOP instructions reserve extra space which can
11839 be used to patch in any desired instrumentation at run time,
11840 provided that the code segment is writable. The amount of space is
11841 controllable indirectly via the number of NOPs; the NOP instruction
11842 used corresponds to the instruction emitted by the internal GCC
11843 back-end interface "gen_nop". This behavior is target-specific and
11844 may also depend on the architecture variant and/or other
11845 compilation options.
11846
11847 For run-time identification, the starting addresses of these areas,
11848 which correspond to their respective function entries minus M, are
11849 additionally collected in the "__patchable_function_entries"
11850 section of the resulting binary.
11851
11852 Note that the value of "__attribute__ ((patchable_function_entry
11853 (N,M)))" takes precedence over command-line option
11854 -fpatchable-function-entry=N,M. This can be used to increase the
11855 area size or to remove it completely on a single function. If
11856 "N=0", no pad location is recorded.
11857
11858 The NOP instructions are inserted at---and maybe before, depending
11859 on M---the function entry address, even before the prologue.
11860
11861 Options Controlling the Preprocessor
11862 These options control the C preprocessor, which is run on each C source
11863 file before actual compilation.
11864
11865 If you use the -E option, nothing is done except preprocessing. Some
11866 of these options make sense only together with -E because they cause
11867 the preprocessor output to be unsuitable for actual compilation.
11868
11869 In addition to the options listed here, there are a number of options
11870 to control search paths for include files documented in Directory
11871 Options. Options to control preprocessor diagnostics are listed in
11872 Warning Options.
11873
11874 -D name
11875 Predefine name as a macro, with definition 1.
11876
11877 -D name=definition
11878 The contents of definition are tokenized and processed as if they
11879 appeared during translation phase three in a #define directive. In
11880 particular, the definition is truncated by embedded newline
11881 characters.
11882
11883 If you are invoking the preprocessor from a shell or shell-like
11884 program you may need to use the shell's quoting syntax to protect
11885 characters such as spaces that have a meaning in the shell syntax.
11886
11887 If you wish to define a function-like macro on the command line,
11888 write its argument list with surrounding parentheses before the
11889 equals sign (if any). Parentheses are meaningful to most shells,
11890 so you should quote the option. With sh and csh,
11891 -D'name(args...)=definition' works.
11892
11893 -D and -U options are processed in the order they are given on the
11894 command line. All -imacros file and -include file options are
11895 processed after all -D and -U options.
11896
11897 -U name
11898 Cancel any previous definition of name, either built in or provided
11899 with a -D option.
11900
11901 -include file
11902 Process file as if "#include "file"" appeared as the first line of
11903 the primary source file. However, the first directory searched for
11904 file is the preprocessor's working directory instead of the
11905 directory containing the main source file. If not found there, it
11906 is searched for in the remainder of the "#include "..."" search
11907 chain as normal.
11908
11909 If multiple -include options are given, the files are included in
11910 the order they appear on the command line.
11911
11912 -imacros file
11913 Exactly like -include, except that any output produced by scanning
11914 file is thrown away. Macros it defines remain defined. This
11915 allows you to acquire all the macros from a header without also
11916 processing its declarations.
11917
11918 All files specified by -imacros are processed before all files
11919 specified by -include.
11920
11921 -undef
11922 Do not predefine any system-specific or GCC-specific macros. The
11923 standard predefined macros remain defined.
11924
11925 -pthread
11926 Define additional macros required for using the POSIX threads
11927 library. You should use this option consistently for both
11928 compilation and linking. This option is supported on GNU/Linux
11929 targets, most other Unix derivatives, and also on x86 Cygwin and
11930 MinGW targets.
11931
11932 -M Instead of outputting the result of preprocessing, output a rule
11933 suitable for make describing the dependencies of the main source
11934 file. The preprocessor outputs one make rule containing the object
11935 file name for that source file, a colon, and the names of all the
11936 included files, including those coming from -include or -imacros
11937 command-line options.
11938
11939 Unless specified explicitly (with -MT or -MQ), the object file name
11940 consists of the name of the source file with any suffix replaced
11941 with object file suffix and with any leading directory parts
11942 removed. If there are many included files then the rule is split
11943 into several lines using \-newline. The rule has no commands.
11944
11945 This option does not suppress the preprocessor's debug output, such
11946 as -dM. To avoid mixing such debug output with the dependency
11947 rules you should explicitly specify the dependency output file with
11948 -MF, or use an environment variable like DEPENDENCIES_OUTPUT.
11949 Debug output is still sent to the regular output stream as normal.
11950
11951 Passing -M to the driver implies -E, and suppresses warnings with
11952 an implicit -w.
11953
11954 -MM Like -M but do not mention header files that are found in system
11955 header directories, nor header files that are included, directly or
11956 indirectly, from such a header.
11957
11958 This implies that the choice of angle brackets or double quotes in
11959 an #include directive does not in itself determine whether that
11960 header appears in -MM dependency output.
11961
11962 -MF file
11963 When used with -M or -MM, specifies a file to write the
11964 dependencies to. If no -MF switch is given the preprocessor sends
11965 the rules to the same place it would send preprocessed output.
11966
11967 When used with the driver options -MD or -MMD, -MF overrides the
11968 default dependency output file.
11969
11970 If file is -, then the dependencies are written to stdout.
11971
11972 -MG In conjunction with an option such as -M requesting dependency
11973 generation, -MG assumes missing header files are generated files
11974 and adds them to the dependency list without raising an error. The
11975 dependency filename is taken directly from the "#include" directive
11976 without prepending any path. -MG also suppresses preprocessed
11977 output, as a missing header file renders this useless.
11978
11979 This feature is used in automatic updating of makefiles.
11980
11981 -MP This option instructs CPP to add a phony target for each dependency
11982 other than the main file, causing each to depend on nothing. These
11983 dummy rules work around errors make gives if you remove header
11984 files without updating the Makefile to match.
11985
11986 This is typical output:
11987
11988 test.o: test.c test.h
11989
11990 test.h:
11991
11992 -MT target
11993 Change the target of the rule emitted by dependency generation. By
11994 default CPP takes the name of the main input file, deletes any
11995 directory components and any file suffix such as .c, and appends
11996 the platform's usual object suffix. The result is the target.
11997
11998 An -MT option sets the target to be exactly the string you specify.
11999 If you want multiple targets, you can specify them as a single
12000 argument to -MT, or use multiple -MT options.
12001
12002 For example, -MT '$(objpfx)foo.o' might give
12003
12004 $(objpfx)foo.o: foo.c
12005
12006 -MQ target
12007 Same as -MT, but it quotes any characters which are special to
12008 Make. -MQ '$(objpfx)foo.o' gives
12009
12010 $$(objpfx)foo.o: foo.c
12011
12012 The default target is automatically quoted, as if it were given
12013 with -MQ.
12014
12015 -MD -MD is equivalent to -M -MF file, except that -E is not implied.
12016 The driver determines file based on whether an -o option is given.
12017 If it is, the driver uses its argument but with a suffix of .d,
12018 otherwise it takes the name of the input file, removes any
12019 directory components and suffix, and applies a .d suffix.
12020
12021 If -MD is used in conjunction with -E, any -o switch is understood
12022 to specify the dependency output file, but if used without -E, each
12023 -o is understood to specify a target object file.
12024
12025 Since -E is not implied, -MD can be used to generate a dependency
12026 output file as a side effect of the compilation process.
12027
12028 -MMD
12029 Like -MD except mention only user header files, not system header
12030 files.
12031
12032 -fpreprocessed
12033 Indicate to the preprocessor that the input file has already been
12034 preprocessed. This suppresses things like macro expansion,
12035 trigraph conversion, escaped newline splicing, and processing of
12036 most directives. The preprocessor still recognizes and removes
12037 comments, so that you can pass a file preprocessed with -C to the
12038 compiler without problems. In this mode the integrated
12039 preprocessor is little more than a tokenizer for the front ends.
12040
12041 -fpreprocessed is implicit if the input file has one of the
12042 extensions .i, .ii or .mi. These are the extensions that GCC uses
12043 for preprocessed files created by -save-temps.
12044
12045 -fdirectives-only
12046 When preprocessing, handle directives, but do not expand macros.
12047
12048 The option's behavior depends on the -E and -fpreprocessed options.
12049
12050 With -E, preprocessing is limited to the handling of directives
12051 such as "#define", "#ifdef", and "#error". Other preprocessor
12052 operations, such as macro expansion and trigraph conversion are not
12053 performed. In addition, the -dD option is implicitly enabled.
12054
12055 With -fpreprocessed, predefinition of command line and most builtin
12056 macros is disabled. Macros such as "__LINE__", which are
12057 contextually dependent, are handled normally. This enables
12058 compilation of files previously preprocessed with "-E
12059 -fdirectives-only".
12060
12061 With both -E and -fpreprocessed, the rules for -fpreprocessed take
12062 precedence. This enables full preprocessing of files previously
12063 preprocessed with "-E -fdirectives-only".
12064
12065 -fdollars-in-identifiers
12066 Accept $ in identifiers.
12067
12068 -fextended-identifiers
12069 Accept universal character names and extended characters in
12070 identifiers. This option is enabled by default for C99 (and later
12071 C standard versions) and C++.
12072
12073 -fno-canonical-system-headers
12074 When preprocessing, do not shorten system header paths with
12075 canonicalization.
12076
12077 -fmax-include-depth=depth
12078 Set the maximum depth of the nested #include. The default is 200.
12079
12080 -ftabstop=width
12081 Set the distance between tab stops. This helps the preprocessor
12082 report correct column numbers in warnings or errors, even if tabs
12083 appear on the line. If the value is less than 1 or greater than
12084 100, the option is ignored. The default is 8.
12085
12086 -ftrack-macro-expansion[=level]
12087 Track locations of tokens across macro expansions. This allows the
12088 compiler to emit diagnostic about the current macro expansion stack
12089 when a compilation error occurs in a macro expansion. Using this
12090 option makes the preprocessor and the compiler consume more memory.
12091 The level parameter can be used to choose the level of precision of
12092 token location tracking thus decreasing the memory consumption if
12093 necessary. Value 0 of level de-activates this option. Value 1
12094 tracks tokens locations in a degraded mode for the sake of minimal
12095 memory overhead. In this mode all tokens resulting from the
12096 expansion of an argument of a function-like macro have the same
12097 location. Value 2 tracks tokens locations completely. This value is
12098 the most memory hungry. When this option is given no argument, the
12099 default parameter value is 2.
12100
12101 Note that "-ftrack-macro-expansion=2" is activated by default.
12102
12103 -fmacro-prefix-map=old=new
12104 When preprocessing files residing in directory old, expand the
12105 "__FILE__" and "__BASE_FILE__" macros as if the files resided in
12106 directory new instead. This can be used to change an absolute path
12107 to a relative path by using . for new which can result in more
12108 reproducible builds that are location independent. This option
12109 also affects "__builtin_FILE()" during compilation. See also
12110 -ffile-prefix-map.
12111
12112 -fexec-charset=charset
12113 Set the execution character set, used for string and character
12114 constants. The default is UTF-8. charset can be any encoding
12115 supported by the system's "iconv" library routine.
12116
12117 -fwide-exec-charset=charset
12118 Set the wide execution character set, used for wide string and
12119 character constants. The default is UTF-32 or UTF-16, whichever
12120 corresponds to the width of "wchar_t". As with -fexec-charset,
12121 charset can be any encoding supported by the system's "iconv"
12122 library routine; however, you will have problems with encodings
12123 that do not fit exactly in "wchar_t".
12124
12125 -finput-charset=charset
12126 Set the input character set, used for translation from the
12127 character set of the input file to the source character set used by
12128 GCC. If the locale does not specify, or GCC cannot get this
12129 information from the locale, the default is UTF-8. This can be
12130 overridden by either the locale or this command-line option.
12131 Currently the command-line option takes precedence if there's a
12132 conflict. charset can be any encoding supported by the system's
12133 "iconv" library routine.
12134
12135 -fpch-deps
12136 When using precompiled headers, this flag causes the dependency-
12137 output flags to also list the files from the precompiled header's
12138 dependencies. If not specified, only the precompiled header are
12139 listed and not the files that were used to create it, because those
12140 files are not consulted when a precompiled header is used.
12141
12142 -fpch-preprocess
12143 This option allows use of a precompiled header together with -E.
12144 It inserts a special "#pragma", "#pragma GCC pch_preprocess
12145 "filename"" in the output to mark the place where the precompiled
12146 header was found, and its filename. When -fpreprocessed is in use,
12147 GCC recognizes this "#pragma" and loads the PCH.
12148
12149 This option is off by default, because the resulting preprocessed
12150 output is only really suitable as input to GCC. It is switched on
12151 by -save-temps.
12152
12153 You should not write this "#pragma" in your own code, but it is
12154 safe to edit the filename if the PCH file is available in a
12155 different location. The filename may be absolute or it may be
12156 relative to GCC's current directory.
12157
12158 -fworking-directory
12159 Enable generation of linemarkers in the preprocessor output that
12160 let the compiler know the current working directory at the time of
12161 preprocessing. When this option is enabled, the preprocessor
12162 emits, after the initial linemarker, a second linemarker with the
12163 current working directory followed by two slashes. GCC uses this
12164 directory, when it's present in the preprocessed input, as the
12165 directory emitted as the current working directory in some
12166 debugging information formats. This option is implicitly enabled
12167 if debugging information is enabled, but this can be inhibited with
12168 the negated form -fno-working-directory. If the -P flag is present
12169 in the command line, this option has no effect, since no "#line"
12170 directives are emitted whatsoever.
12171
12172 -A predicate=answer
12173 Make an assertion with the predicate predicate and answer answer.
12174 This form is preferred to the older form -A predicate(answer),
12175 which is still supported, because it does not use shell special
12176 characters.
12177
12178 -A -predicate=answer
12179 Cancel an assertion with the predicate predicate and answer answer.
12180
12181 -C Do not discard comments. All comments are passed through to the
12182 output file, except for comments in processed directives, which are
12183 deleted along with the directive.
12184
12185 You should be prepared for side effects when using -C; it causes
12186 the preprocessor to treat comments as tokens in their own right.
12187 For example, comments appearing at the start of what would be a
12188 directive line have the effect of turning that line into an
12189 ordinary source line, since the first token on the line is no
12190 longer a #.
12191
12192 -CC Do not discard comments, including during macro expansion. This is
12193 like -C, except that comments contained within macros are also
12194 passed through to the output file where the macro is expanded.
12195
12196 In addition to the side effects of the -C option, the -CC option
12197 causes all C++-style comments inside a macro to be converted to
12198 C-style comments. This is to prevent later use of that macro from
12199 inadvertently commenting out the remainder of the source line.
12200
12201 The -CC option is generally used to support lint comments.
12202
12203 -P Inhibit generation of linemarkers in the output from the
12204 preprocessor. This might be useful when running the preprocessor
12205 on something that is not C code, and will be sent to a program
12206 which might be confused by the linemarkers.
12207
12208 -traditional
12209 -traditional-cpp
12210 Try to imitate the behavior of pre-standard C preprocessors, as
12211 opposed to ISO C preprocessors. See the GNU CPP manual for
12212 details.
12213
12214 Note that GCC does not otherwise attempt to emulate a pre-standard
12215 C compiler, and these options are only supported with the -E
12216 switch, or when invoking CPP explicitly.
12217
12218 -trigraphs
12219 Support ISO C trigraphs. These are three-character sequences, all
12220 starting with ??, that are defined by ISO C to stand for single
12221 characters. For example, ??/ stands for \, so '??/n' is a
12222 character constant for a newline.
12223
12224 The nine trigraphs and their replacements are
12225
12226 Trigraph: ??( ??) ??< ??> ??= ??/ ??' ??! ??-
12227 Replacement: [ ] { } # \ ^ | ~
12228
12229 By default, GCC ignores trigraphs, but in standard-conforming modes
12230 it converts them. See the -std and -ansi options.
12231
12232 -remap
12233 Enable special code to work around file systems which only permit
12234 very short file names, such as MS-DOS.
12235
12236 -H Print the name of each header file used, in addition to other
12237 normal activities. Each name is indented to show how deep in the
12238 #include stack it is. Precompiled header files are also printed,
12239 even if they are found to be invalid; an invalid precompiled header
12240 file is printed with ...x and a valid one with ...! .
12241
12242 -dletters
12243 Says to make debugging dumps during compilation as specified by
12244 letters. The flags documented here are those relevant to the
12245 preprocessor. Other letters are interpreted by the compiler
12246 proper, or reserved for future versions of GCC, and so are silently
12247 ignored. If you specify letters whose behavior conflicts, the
12248 result is undefined.
12249
12250 -dM Instead of the normal output, generate a list of #define
12251 directives for all the macros defined during the execution of
12252 the preprocessor, including predefined macros. This gives you
12253 a way of finding out what is predefined in your version of the
12254 preprocessor. Assuming you have no file foo.h, the command
12255
12256 touch foo.h; cpp -dM foo.h
12257
12258 shows all the predefined macros.
12259
12260 If you use -dM without the -E option, -dM is interpreted as a
12261 synonym for -fdump-rtl-mach.
12262
12263 -dD Like -dM except in two respects: it does not include the
12264 predefined macros, and it outputs both the #define directives
12265 and the result of preprocessing. Both kinds of output go to
12266 the standard output file.
12267
12268 -dN Like -dD, but emit only the macro names, not their expansions.
12269
12270 -dI Output #include directives in addition to the result of
12271 preprocessing.
12272
12273 -dU Like -dD except that only macros that are expanded, or whose
12274 definedness is tested in preprocessor directives, are output;
12275 the output is delayed until the use or test of the macro; and
12276 #undef directives are also output for macros tested but
12277 undefined at the time.
12278
12279 -fdebug-cpp
12280 This option is only useful for debugging GCC. When used from CPP
12281 or with -E, it dumps debugging information about location maps.
12282 Every token in the output is preceded by the dump of the map its
12283 location belongs to.
12284
12285 When used from GCC without -E, this option has no effect.
12286
12287 -Wp,option
12288 You can use -Wp,option to bypass the compiler driver and pass
12289 option directly through to the preprocessor. If option contains
12290 commas, it is split into multiple options at the commas. However,
12291 many options are modified, translated or interpreted by the
12292 compiler driver before being passed to the preprocessor, and -Wp
12293 forcibly bypasses this phase. The preprocessor's direct interface
12294 is undocumented and subject to change, so whenever possible you
12295 should avoid using -Wp and let the driver handle the options
12296 instead.
12297
12298 -Xpreprocessor option
12299 Pass option as an option to the preprocessor. You can use this to
12300 supply system-specific preprocessor options that GCC does not
12301 recognize.
12302
12303 If you want to pass an option that takes an argument, you must use
12304 -Xpreprocessor twice, once for the option and once for the
12305 argument.
12306
12307 -no-integrated-cpp
12308 Perform preprocessing as a separate pass before compilation. By
12309 default, GCC performs preprocessing as an integrated part of input
12310 tokenization and parsing. If this option is provided, the
12311 appropriate language front end (cc1, cc1plus, or cc1obj for C, C++,
12312 and Objective-C, respectively) is instead invoked twice, once for
12313 preprocessing only and once for actual compilation of the
12314 preprocessed input. This option may be useful in conjunction with
12315 the -B or -wrapper options to specify an alternate preprocessor or
12316 perform additional processing of the program source between normal
12317 preprocessing and compilation.
12318
12319 Passing Options to the Assembler
12320 You can pass options to the assembler.
12321
12322 -Wa,option
12323 Pass option as an option to the assembler. If option contains
12324 commas, it is split into multiple options at the commas.
12325
12326 -Xassembler option
12327 Pass option as an option to the assembler. You can use this to
12328 supply system-specific assembler options that GCC does not
12329 recognize.
12330
12331 If you want to pass an option that takes an argument, you must use
12332 -Xassembler twice, once for the option and once for the argument.
12333
12334 Options for Linking
12335 These options come into play when the compiler links object files into
12336 an executable output file. They are meaningless if the compiler is not
12337 doing a link step.
12338
12339 object-file-name
12340 A file name that does not end in a special recognized suffix is
12341 considered to name an object file or library. (Object files are
12342 distinguished from libraries by the linker according to the file
12343 contents.) If linking is done, these object files are used as
12344 input to the linker.
12345
12346 -c
12347 -S
12348 -E If any of these options is used, then the linker is not run, and
12349 object file names should not be used as arguments.
12350
12351 -flinker-output=type
12352 This option controls code generation of the link-time optimizer.
12353 By default the linker output is automatically determined by the
12354 linker plugin. For debugging the compiler and if incremental
12355 linking with a non-LTO object file is desired, it may be useful to
12356 control the type manually.
12357
12358 If type is exec, code generation produces a static binary. In this
12359 case -fpic and -fpie are both disabled.
12360
12361 If type is dyn, code generation produces a shared library. In this
12362 case -fpic or -fPIC is preserved, but not enabled automatically.
12363 This allows to build shared libraries without position-independent
12364 code on architectures where this is possible, i.e. on x86.
12365
12366 If type is pie, code generation produces an -fpie executable. This
12367 results in similar optimizations as exec except that -fpie is not
12368 disabled if specified at compilation time.
12369
12370 If type is rel, the compiler assumes that incremental linking is
12371 done. The sections containing intermediate code for link-time
12372 optimization are merged, pre-optimized, and output to the resulting
12373 object file. In addition, if -ffat-lto-objects is specified, binary
12374 code is produced for future non-LTO linking. The object file
12375 produced by incremental linking is smaller than a static library
12376 produced from the same object files. At link time the result of
12377 incremental linking also loads faster than a static library
12378 assuming that the majority of objects in the library are used.
12379
12380 Finally nolto-rel configures the compiler for incremental linking
12381 where code generation is forced, a final binary is produced, and
12382 the intermediate code for later link-time optimization is stripped.
12383 When multiple object files are linked together the resulting code
12384 is better optimized than with link-time optimizations disabled (for
12385 example, cross-module inlining happens), but most of benefits of
12386 whole program optimizations are lost.
12387
12388 During the incremental link (by -r) the linker plugin defaults to
12389 rel. With current interfaces to GNU Binutils it is however not
12390 possible to incrementally link LTO objects and non-LTO objects into
12391 a single mixed object file. If any of object files in incremental
12392 link cannot be used for link-time optimization, the linker plugin
12393 issues a warning and uses nolto-rel. To maintain whole program
12394 optimization, it is recommended to link such objects into static
12395 library instead. Alternatively it is possible to use H.J. Lu's
12396 binutils with support for mixed objects.
12397
12398 -fuse-ld=bfd
12399 Use the bfd linker instead of the default linker.
12400
12401 -fuse-ld=gold
12402 Use the gold linker instead of the default linker.
12403
12404 -fuse-ld=lld
12405 Use the LLVM lld linker instead of the default linker.
12406
12407 -llibrary
12408 -l library
12409 Search the library named library when linking. (The second
12410 alternative with the library as a separate argument is only for
12411 POSIX compliance and is not recommended.)
12412
12413 The -l option is passed directly to the linker by GCC. Refer to
12414 your linker documentation for exact details. The general
12415 description below applies to the GNU linker.
12416
12417 The linker searches a standard list of directories for the library.
12418 The directories searched include several standard system
12419 directories plus any that you specify with -L.
12420
12421 Static libraries are archives of object files, and have file names
12422 like liblibrary.a. Some targets also support shared libraries,
12423 which typically have names like liblibrary.so. If both static and
12424 shared libraries are found, the linker gives preference to linking
12425 with the shared library unless the -static option is used.
12426
12427 It makes a difference where in the command you write this option;
12428 the linker searches and processes libraries and object files in the
12429 order they are specified. Thus, foo.o -lz bar.o searches library z
12430 after file foo.o but before bar.o. If bar.o refers to functions in
12431 z, those functions may not be loaded.
12432
12433 -lobjc
12434 You need this special case of the -l option in order to link an
12435 Objective-C or Objective-C++ program.
12436
12437 -nostartfiles
12438 Do not use the standard system startup files when linking. The
12439 standard system libraries are used normally, unless -nostdlib,
12440 -nolibc, or -nodefaultlibs is used.
12441
12442 -nodefaultlibs
12443 Do not use the standard system libraries when linking. Only the
12444 libraries you specify are passed to the linker, and options
12445 specifying linkage of the system libraries, such as -static-libgcc
12446 or -shared-libgcc, are ignored. The standard startup files are
12447 used normally, unless -nostartfiles is used.
12448
12449 The compiler may generate calls to "memcmp", "memset", "memcpy" and
12450 "memmove". These entries are usually resolved by entries in libc.
12451 These entry points should be supplied through some other mechanism
12452 when this option is specified.
12453
12454 -nolibc
12455 Do not use the C library or system libraries tightly coupled with
12456 it when linking. Still link with the startup files, libgcc or
12457 toolchain provided language support libraries such as libgnat,
12458 libgfortran or libstdc++ unless options preventing their inclusion
12459 are used as well. This typically removes -lc from the link command
12460 line, as well as system libraries that normally go with it and
12461 become meaningless when absence of a C library is assumed, for
12462 example -lpthread or -lm in some configurations. This is intended
12463 for bare-board targets when there is indeed no C library available.
12464
12465 -nostdlib
12466 Do not use the standard system startup files or libraries when
12467 linking. No startup files and only the libraries you specify are
12468 passed to the linker, and options specifying linkage of the system
12469 libraries, such as -static-libgcc or -shared-libgcc, are ignored.
12470
12471 The compiler may generate calls to "memcmp", "memset", "memcpy" and
12472 "memmove". These entries are usually resolved by entries in libc.
12473 These entry points should be supplied through some other mechanism
12474 when this option is specified.
12475
12476 One of the standard libraries bypassed by -nostdlib and
12477 -nodefaultlibs is libgcc.a, a library of internal subroutines which
12478 GCC uses to overcome shortcomings of particular machines, or
12479 special needs for some languages.
12480
12481 In most cases, you need libgcc.a even when you want to avoid other
12482 standard libraries. In other words, when you specify -nostdlib or
12483 -nodefaultlibs you should usually specify -lgcc as well. This
12484 ensures that you have no unresolved references to internal GCC
12485 library subroutines. (An example of such an internal subroutine is
12486 "__main", used to ensure C++ constructors are called.)
12487
12488 -e entry
12489 --entry=entry
12490 Specify that the program entry point is entry. The argument is
12491 interpreted by the linker; the GNU linker accepts either a symbol
12492 name or an address.
12493
12494 -pie
12495 Produce a dynamically linked position independent executable on
12496 targets that support it. For predictable results, you must also
12497 specify the same set of options used for compilation (-fpie, -fPIE,
12498 or model suboptions) when you specify this linker option.
12499
12500 -no-pie
12501 Don't produce a dynamically linked position independent executable.
12502
12503 -static-pie
12504 Produce a static position independent executable on targets that
12505 support it. A static position independent executable is similar to
12506 a static executable, but can be loaded at any address without a
12507 dynamic linker. For predictable results, you must also specify the
12508 same set of options used for compilation (-fpie, -fPIE, or model
12509 suboptions) when you specify this linker option.
12510
12511 -pthread
12512 Link with the POSIX threads library. This option is supported on
12513 GNU/Linux targets, most other Unix derivatives, and also on x86
12514 Cygwin and MinGW targets. On some targets this option also sets
12515 flags for the preprocessor, so it should be used consistently for
12516 both compilation and linking.
12517
12518 -r Produce a relocatable object as output. This is also known as
12519 partial linking.
12520
12521 -rdynamic
12522 Pass the flag -export-dynamic to the ELF linker, on targets that
12523 support it. This instructs the linker to add all symbols, not only
12524 used ones, to the dynamic symbol table. This option is needed for
12525 some uses of "dlopen" or to allow obtaining backtraces from within
12526 a program.
12527
12528 -s Remove all symbol table and relocation information from the
12529 executable.
12530
12531 -static
12532 On systems that support dynamic linking, this overrides -pie and
12533 prevents linking with the shared libraries. On other systems, this
12534 option has no effect.
12535
12536 -shared
12537 Produce a shared object which can then be linked with other objects
12538 to form an executable. Not all systems support this option. For
12539 predictable results, you must also specify the same set of options
12540 used for compilation (-fpic, -fPIC, or model suboptions) when you
12541 specify this linker option.[1]
12542
12543 -shared-libgcc
12544 -static-libgcc
12545 On systems that provide libgcc as a shared library, these options
12546 force the use of either the shared or static version, respectively.
12547 If no shared version of libgcc was built when the compiler was
12548 configured, these options have no effect.
12549
12550 There are several situations in which an application should use the
12551 shared libgcc instead of the static version. The most common of
12552 these is when the application wishes to throw and catch exceptions
12553 across different shared libraries. In that case, each of the
12554 libraries as well as the application itself should use the shared
12555 libgcc.
12556
12557 Therefore, the G++ driver automatically adds -shared-libgcc
12558 whenever you build a shared library or a main executable, because
12559 C++ programs typically use exceptions, so this is the right thing
12560 to do.
12561
12562 If, instead, you use the GCC driver to create shared libraries, you
12563 may find that they are not always linked with the shared libgcc.
12564 If GCC finds, at its configuration time, that you have a non-GNU
12565 linker or a GNU linker that does not support option --eh-frame-hdr,
12566 it links the shared version of libgcc into shared libraries by
12567 default. Otherwise, it takes advantage of the linker and optimizes
12568 away the linking with the shared version of libgcc, linking with
12569 the static version of libgcc by default. This allows exceptions to
12570 propagate through such shared libraries, without incurring
12571 relocation costs at library load time.
12572
12573 However, if a library or main executable is supposed to throw or
12574 catch exceptions, you must link it using the G++ driver, or using
12575 the option -shared-libgcc, such that it is linked with the shared
12576 libgcc.
12577
12578 -static-libasan
12579 When the -fsanitize=address option is used to link a program, the
12580 GCC driver automatically links against libasan. If libasan is
12581 available as a shared library, and the -static option is not used,
12582 then this links against the shared version of libasan. The
12583 -static-libasan option directs the GCC driver to link libasan
12584 statically, without necessarily linking other libraries statically.
12585
12586 -static-libtsan
12587 When the -fsanitize=thread option is used to link a program, the
12588 GCC driver automatically links against libtsan. If libtsan is
12589 available as a shared library, and the -static option is not used,
12590 then this links against the shared version of libtsan. The
12591 -static-libtsan option directs the GCC driver to link libtsan
12592 statically, without necessarily linking other libraries statically.
12593
12594 -static-liblsan
12595 When the -fsanitize=leak option is used to link a program, the GCC
12596 driver automatically links against liblsan. If liblsan is
12597 available as a shared library, and the -static option is not used,
12598 then this links against the shared version of liblsan. The
12599 -static-liblsan option directs the GCC driver to link liblsan
12600 statically, without necessarily linking other libraries statically.
12601
12602 -static-libubsan
12603 When the -fsanitize=undefined option is used to link a program, the
12604 GCC driver automatically links against libubsan. If libubsan is
12605 available as a shared library, and the -static option is not used,
12606 then this links against the shared version of libubsan. The
12607 -static-libubsan option directs the GCC driver to link libubsan
12608 statically, without necessarily linking other libraries statically.
12609
12610 -static-libstdc++
12611 When the g++ program is used to link a C++ program, it normally
12612 automatically links against libstdc++. If libstdc++ is available
12613 as a shared library, and the -static option is not used, then this
12614 links against the shared version of libstdc++. That is normally
12615 fine. However, it is sometimes useful to freeze the version of
12616 libstdc++ used by the program without going all the way to a fully
12617 static link. The -static-libstdc++ option directs the g++ driver
12618 to link libstdc++ statically, without necessarily linking other
12619 libraries statically.
12620
12621 -symbolic
12622 Bind references to global symbols when building a shared object.
12623 Warn about any unresolved references (unless overridden by the link
12624 editor option -Xlinker -z -Xlinker defs). Only a few systems
12625 support this option.
12626
12627 -T script
12628 Use script as the linker script. This option is supported by most
12629 systems using the GNU linker. On some targets, such as bare-board
12630 targets without an operating system, the -T option may be required
12631 when linking to avoid references to undefined symbols.
12632
12633 -Xlinker option
12634 Pass option as an option to the linker. You can use this to supply
12635 system-specific linker options that GCC does not recognize.
12636
12637 If you want to pass an option that takes a separate argument, you
12638 must use -Xlinker twice, once for the option and once for the
12639 argument. For example, to pass -assert definitions, you must write
12640 -Xlinker -assert -Xlinker definitions. It does not work to write
12641 -Xlinker "-assert definitions", because this passes the entire
12642 string as a single argument, which is not what the linker expects.
12643
12644 When using the GNU linker, it is usually more convenient to pass
12645 arguments to linker options using the option=value syntax than as
12646 separate arguments. For example, you can specify -Xlinker
12647 -Map=output.map rather than -Xlinker -Map -Xlinker output.map.
12648 Other linkers may not support this syntax for command-line options.
12649
12650 -Wl,option
12651 Pass option as an option to the linker. If option contains commas,
12652 it is split into multiple options at the commas. You can use this
12653 syntax to pass an argument to the option. For example,
12654 -Wl,-Map,output.map passes -Map output.map to the linker. When
12655 using the GNU linker, you can also get the same effect with
12656 -Wl,-Map=output.map.
12657
12658 -u symbol
12659 Pretend the symbol symbol is undefined, to force linking of library
12660 modules to define it. You can use -u multiple times with different
12661 symbols to force loading of additional library modules.
12662
12663 -z keyword
12664 -z is passed directly on to the linker along with the keyword
12665 keyword. See the section in the documentation of your linker for
12666 permitted values and their meanings.
12667
12668 Options for Directory Search
12669 These options specify directories to search for header files, for
12670 libraries and for parts of the compiler:
12671
12672 -I dir
12673 -iquote dir
12674 -isystem dir
12675 -idirafter dir
12676 Add the directory dir to the list of directories to be searched for
12677 header files during preprocessing. If dir begins with = or
12678 $SYSROOT, then the = or $SYSROOT is replaced by the sysroot prefix;
12679 see --sysroot and -isysroot.
12680
12681 Directories specified with -iquote apply only to the quote form of
12682 the directive, "#include "file"". Directories specified with -I,
12683 -isystem, or -idirafter apply to lookup for both the
12684 "#include "file"" and "#include <file>" directives.
12685
12686 You can specify any number or combination of these options on the
12687 command line to search for header files in several directories.
12688 The lookup order is as follows:
12689
12690 1. For the quote form of the include directive, the directory of
12691 the current file is searched first.
12692
12693 2. For the quote form of the include directive, the directories
12694 specified by -iquote options are searched in left-to-right
12695 order, as they appear on the command line.
12696
12697 3. Directories specified with -I options are scanned in left-to-
12698 right order.
12699
12700 4. Directories specified with -isystem options are scanned in
12701 left-to-right order.
12702
12703 5. Standard system directories are scanned.
12704
12705 6. Directories specified with -idirafter options are scanned in
12706 left-to-right order.
12707
12708 You can use -I to override a system header file, substituting your
12709 own version, since these directories are searched before the
12710 standard system header file directories. However, you should not
12711 use this option to add directories that contain vendor-supplied
12712 system header files; use -isystem for that.
12713
12714 The -isystem and -idirafter options also mark the directory as a
12715 system directory, so that it gets the same special treatment that
12716 is applied to the standard system directories.
12717
12718 If a standard system include directory, or a directory specified
12719 with -isystem, is also specified with -I, the -I option is ignored.
12720 The directory is still searched but as a system directory at its
12721 normal position in the system include chain. This is to ensure
12722 that GCC's procedure to fix buggy system headers and the ordering
12723 for the "#include_next" directive are not inadvertently changed.
12724 If you really need to change the search order for system
12725 directories, use the -nostdinc and/or -isystem options.
12726
12727 -I- Split the include path. This option has been deprecated. Please
12728 use -iquote instead for -I directories before the -I- and remove
12729 the -I- option.
12730
12731 Any directories specified with -I options before -I- are searched
12732 only for headers requested with "#include "file""; they are not
12733 searched for "#include <file>". If additional directories are
12734 specified with -I options after the -I-, those directories are
12735 searched for all #include directives.
12736
12737 In addition, -I- inhibits the use of the directory of the current
12738 file directory as the first search directory for "#include "file"".
12739 There is no way to override this effect of -I-.
12740
12741 -iprefix prefix
12742 Specify prefix as the prefix for subsequent -iwithprefix options.
12743 If the prefix represents a directory, you should include the final
12744 /.
12745
12746 -iwithprefix dir
12747 -iwithprefixbefore dir
12748 Append dir to the prefix specified previously with -iprefix, and
12749 add the resulting directory to the include search path.
12750 -iwithprefixbefore puts it in the same place -I would; -iwithprefix
12751 puts it where -idirafter would.
12752
12753 -isysroot dir
12754 This option is like the --sysroot option, but applies only to
12755 header files (except for Darwin targets, where it applies to both
12756 header files and libraries). See the --sysroot option for more
12757 information.
12758
12759 -imultilib dir
12760 Use dir as a subdirectory of the directory containing target-
12761 specific C++ headers.
12762
12763 -nostdinc
12764 Do not search the standard system directories for header files.
12765 Only the directories explicitly specified with -I, -iquote,
12766 -isystem, and/or -idirafter options (and the directory of the
12767 current file, if appropriate) are searched.
12768
12769 -nostdinc++
12770 Do not search for header files in the C++-specific standard
12771 directories, but do still search the other standard directories.
12772 (This option is used when building the C++ library.)
12773
12774 -iplugindir=dir
12775 Set the directory to search for plugins that are passed by
12776 -fplugin=name instead of -fplugin=path/name.so. This option is not
12777 meant to be used by the user, but only passed by the driver.
12778
12779 -Ldir
12780 Add directory dir to the list of directories to be searched for -l.
12781
12782 -Bprefix
12783 This option specifies where to find the executables, libraries,
12784 include files, and data files of the compiler itself.
12785
12786 The compiler driver program runs one or more of the subprograms
12787 cpp, cc1, as and ld. It tries prefix as a prefix for each program
12788 it tries to run, both with and without machine/version/ for the
12789 corresponding target machine and compiler version.
12790
12791 For each subprogram to be run, the compiler driver first tries the
12792 -B prefix, if any. If that name is not found, or if -B is not
12793 specified, the driver tries two standard prefixes, /usr/lib/gcc/
12794 and /usr/local/lib/gcc/. If neither of those results in a file
12795 name that is found, the unmodified program name is searched for
12796 using the directories specified in your PATH environment variable.
12797
12798 The compiler checks to see if the path provided by -B refers to a
12799 directory, and if necessary it adds a directory separator character
12800 at the end of the path.
12801
12802 -B prefixes that effectively specify directory names also apply to
12803 libraries in the linker, because the compiler translates these
12804 options into -L options for the linker. They also apply to include
12805 files in the preprocessor, because the compiler translates these
12806 options into -isystem options for the preprocessor. In this case,
12807 the compiler appends include to the prefix.
12808
12809 The runtime support file libgcc.a can also be searched for using
12810 the -B prefix, if needed. If it is not found there, the two
12811 standard prefixes above are tried, and that is all. The file is
12812 left out of the link if it is not found by those means.
12813
12814 Another way to specify a prefix much like the -B prefix is to use
12815 the environment variable GCC_EXEC_PREFIX.
12816
12817 As a special kludge, if the path provided by -B is [dir/]stageN/,
12818 where N is a number in the range 0 to 9, then it is replaced by
12819 [dir/]include. This is to help with boot-strapping the compiler.
12820
12821 -no-canonical-prefixes
12822 Do not expand any symbolic links, resolve references to /../ or
12823 /./, or make the path absolute when generating a relative prefix.
12824
12825 --sysroot=dir
12826 Use dir as the logical root directory for headers and libraries.
12827 For example, if the compiler normally searches for headers in
12828 /usr/include and libraries in /usr/lib, it instead searches
12829 dir/usr/include and dir/usr/lib.
12830
12831 If you use both this option and the -isysroot option, then the
12832 --sysroot option applies to libraries, but the -isysroot option
12833 applies to header files.
12834
12835 The GNU linker (beginning with version 2.16) has the necessary
12836 support for this option. If your linker does not support this
12837 option, the header file aspect of --sysroot still works, but the
12838 library aspect does not.
12839
12840 --no-sysroot-suffix
12841 For some targets, a suffix is added to the root directory specified
12842 with --sysroot, depending on the other options used, so that
12843 headers may for example be found in dir/suffix/usr/include instead
12844 of dir/usr/include. This option disables the addition of such a
12845 suffix.
12846
12847 Options for Code Generation Conventions
12848 These machine-independent options control the interface conventions
12849 used in code generation.
12850
12851 Most of them have both positive and negative forms; the negative form
12852 of -ffoo is -fno-foo. In the table below, only one of the forms is
12853 listed---the one that is not the default. You can figure out the other
12854 form by either removing no- or adding it.
12855
12856 -fstack-reuse=reuse-level
12857 This option controls stack space reuse for user declared local/auto
12858 variables and compiler generated temporaries. reuse_level can be
12859 all, named_vars, or none. all enables stack reuse for all local
12860 variables and temporaries, named_vars enables the reuse only for
12861 user defined local variables with names, and none disables stack
12862 reuse completely. The default value is all. The option is needed
12863 when the program extends the lifetime of a scoped local variable or
12864 a compiler generated temporary beyond the end point defined by the
12865 language. When a lifetime of a variable ends, and if the variable
12866 lives in memory, the optimizing compiler has the freedom to reuse
12867 its stack space with other temporaries or scoped local variables
12868 whose live range does not overlap with it. Legacy code extending
12869 local lifetime is likely to break with the stack reuse
12870 optimization.
12871
12872 For example,
12873
12874 int *p;
12875 {
12876 int local1;
12877
12878 p = &local1;
12879 local1 = 10;
12880 ....
12881 }
12882 {
12883 int local2;
12884 local2 = 20;
12885 ...
12886 }
12887
12888 if (*p == 10) // out of scope use of local1
12889 {
12890
12891 }
12892
12893 Another example:
12894
12895 struct A
12896 {
12897 A(int k) : i(k), j(k) { }
12898 int i;
12899 int j;
12900 };
12901
12902 A *ap;
12903
12904 void foo(const A& ar)
12905 {
12906 ap = &ar;
12907 }
12908
12909 void bar()
12910 {
12911 foo(A(10)); // temp object's lifetime ends when foo returns
12912
12913 {
12914 A a(20);
12915 ....
12916 }
12917 ap->i+= 10; // ap references out of scope temp whose space
12918 // is reused with a. What is the value of ap->i?
12919 }
12920
12921 The lifetime of a compiler generated temporary is well defined by
12922 the C++ standard. When a lifetime of a temporary ends, and if the
12923 temporary lives in memory, the optimizing compiler has the freedom
12924 to reuse its stack space with other temporaries or scoped local
12925 variables whose live range does not overlap with it. However some
12926 of the legacy code relies on the behavior of older compilers in
12927 which temporaries' stack space is not reused, the aggressive stack
12928 reuse can lead to runtime errors. This option is used to control
12929 the temporary stack reuse optimization.
12930
12931 -ftrapv
12932 This option generates traps for signed overflow on addition,
12933 subtraction, multiplication operations. The options -ftrapv and
12934 -fwrapv override each other, so using -ftrapv -fwrapv on the
12935 command-line results in -fwrapv being effective. Note that only
12936 active options override, so using -ftrapv -fwrapv -fno-wrapv on the
12937 command-line results in -ftrapv being effective.
12938
12939 -fwrapv
12940 This option instructs the compiler to assume that signed arithmetic
12941 overflow of addition, subtraction and multiplication wraps around
12942 using twos-complement representation. This flag enables some
12943 optimizations and disables others. The options -ftrapv and -fwrapv
12944 override each other, so using -ftrapv -fwrapv on the command-line
12945 results in -fwrapv being effective. Note that only active options
12946 override, so using -ftrapv -fwrapv -fno-wrapv on the command-line
12947 results in -ftrapv being effective.
12948
12949 -fwrapv-pointer
12950 This option instructs the compiler to assume that pointer
12951 arithmetic overflow on addition and subtraction wraps around using
12952 twos-complement representation. This flag disables some
12953 optimizations which assume pointer overflow is invalid.
12954
12955 -fstrict-overflow
12956 This option implies -fno-wrapv -fno-wrapv-pointer and when negated
12957 implies -fwrapv -fwrapv-pointer.
12958
12959 -fexceptions
12960 Enable exception handling. Generates extra code needed to
12961 propagate exceptions. For some targets, this implies GCC generates
12962 frame unwind information for all functions, which can produce
12963 significant data size overhead, although it does not affect
12964 execution. If you do not specify this option, GCC enables it by
12965 default for languages like C++ that normally require exception
12966 handling, and disables it for languages like C that do not normally
12967 require it. However, you may need to enable this option when
12968 compiling C code that needs to interoperate properly with exception
12969 handlers written in C++. You may also wish to disable this option
12970 if you are compiling older C++ programs that don't use exception
12971 handling.
12972
12973 -fnon-call-exceptions
12974 Generate code that allows trapping instructions to throw
12975 exceptions. Note that this requires platform-specific runtime
12976 support that does not exist everywhere. Moreover, it only allows
12977 trapping instructions to throw exceptions, i.e. memory references
12978 or floating-point instructions. It does not allow exceptions to be
12979 thrown from arbitrary signal handlers such as "SIGALRM".
12980
12981 -fdelete-dead-exceptions
12982 Consider that instructions that may throw exceptions but don't
12983 otherwise contribute to the execution of the program can be
12984 optimized away. This option is enabled by default for the Ada
12985 front end, as permitted by the Ada language specification.
12986 Optimization passes that cause dead exceptions to be removed are
12987 enabled independently at different optimization levels.
12988
12989 -funwind-tables
12990 Similar to -fexceptions, except that it just generates any needed
12991 static data, but does not affect the generated code in any other
12992 way. You normally do not need to enable this option; instead, a
12993 language processor that needs this handling enables it on your
12994 behalf.
12995
12996 -fasynchronous-unwind-tables
12997 Generate unwind table in DWARF format, if supported by target
12998 machine. The table is exact at each instruction boundary, so it
12999 can be used for stack unwinding from asynchronous events (such as
13000 debugger or garbage collector).
13001
13002 -fno-gnu-unique
13003 On systems with recent GNU assembler and C library, the C++
13004 compiler uses the "STB_GNU_UNIQUE" binding to make sure that
13005 definitions of template static data members and static local
13006 variables in inline functions are unique even in the presence of
13007 "RTLD_LOCAL"; this is necessary to avoid problems with a library
13008 used by two different "RTLD_LOCAL" plugins depending on a
13009 definition in one of them and therefore disagreeing with the other
13010 one about the binding of the symbol. But this causes "dlclose" to
13011 be ignored for affected DSOs; if your program relies on
13012 reinitialization of a DSO via "dlclose" and "dlopen", you can use
13013 -fno-gnu-unique.
13014
13015 -fpcc-struct-return
13016 Return "short" "struct" and "union" values in memory like longer
13017 ones, rather than in registers. This convention is less efficient,
13018 but it has the advantage of allowing intercallability between GCC-
13019 compiled files and files compiled with other compilers,
13020 particularly the Portable C Compiler (pcc).
13021
13022 The precise convention for returning structures in memory depends
13023 on the target configuration macros.
13024
13025 Short structures and unions are those whose size and alignment
13026 match that of some integer type.
13027
13028 Warning: code compiled with the -fpcc-struct-return switch is not
13029 binary compatible with code compiled with the -freg-struct-return
13030 switch. Use it to conform to a non-default application binary
13031 interface.
13032
13033 -freg-struct-return
13034 Return "struct" and "union" values in registers when possible.
13035 This is more efficient for small structures than
13036 -fpcc-struct-return.
13037
13038 If you specify neither -fpcc-struct-return nor -freg-struct-return,
13039 GCC defaults to whichever convention is standard for the target.
13040 If there is no standard convention, GCC defaults to
13041 -fpcc-struct-return, except on targets where GCC is the principal
13042 compiler. In those cases, we can choose the standard, and we chose
13043 the more efficient register return alternative.
13044
13045 Warning: code compiled with the -freg-struct-return switch is not
13046 binary compatible with code compiled with the -fpcc-struct-return
13047 switch. Use it to conform to a non-default application binary
13048 interface.
13049
13050 -fshort-enums
13051 Allocate to an "enum" type only as many bytes as it needs for the
13052 declared range of possible values. Specifically, the "enum" type
13053 is equivalent to the smallest integer type that has enough room.
13054
13055 Warning: the -fshort-enums switch causes GCC to generate code that
13056 is not binary compatible with code generated without that switch.
13057 Use it to conform to a non-default application binary interface.
13058
13059 -fshort-wchar
13060 Override the underlying type for "wchar_t" to be "short unsigned
13061 int" instead of the default for the target. This option is useful
13062 for building programs to run under WINE.
13063
13064 Warning: the -fshort-wchar switch causes GCC to generate code that
13065 is not binary compatible with code generated without that switch.
13066 Use it to conform to a non-default application binary interface.
13067
13068 -fcommon
13069 In C code, this option controls the placement of global variables
13070 defined without an initializer, known as tentative definitions in
13071 the C standard. Tentative definitions are distinct from
13072 declarations of a variable with the "extern" keyword, which do not
13073 allocate storage.
13074
13075 The default is -fno-common, which specifies that the compiler
13076 places uninitialized global variables in the BSS section of the
13077 object file. This inhibits the merging of tentative definitions by
13078 the linker so you get a multiple-definition error if the same
13079 variable is accidentally defined in more than one compilation unit.
13080
13081 The -fcommon places uninitialized global variables in a common
13082 block. This allows the linker to resolve all tentative definitions
13083 of the same variable in different compilation units to the same
13084 object, or to a non-tentative definition. This behavior is
13085 inconsistent with C++, and on many targets implies a speed and code
13086 size penalty on global variable references. It is mainly useful to
13087 enable legacy code to link without errors.
13088
13089 -fno-ident
13090 Ignore the "#ident" directive.
13091
13092 -finhibit-size-directive
13093 Don't output a ".size" assembler directive, or anything else that
13094 would cause trouble if the function is split in the middle, and the
13095 two halves are placed at locations far apart in memory. This
13096 option is used when compiling crtstuff.c; you should not need to
13097 use it for anything else.
13098
13099 -fverbose-asm
13100 Put extra commentary information in the generated assembly code to
13101 make it more readable. This option is generally only of use to
13102 those who actually need to read the generated assembly code
13103 (perhaps while debugging the compiler itself).
13104
13105 -fno-verbose-asm, the default, causes the extra information to be
13106 omitted and is useful when comparing two assembler files.
13107
13108 The added comments include:
13109
13110 * information on the compiler version and command-line options,
13111
13112 * the source code lines associated with the assembly
13113 instructions, in the form FILENAME:LINENUMBER:CONTENT OF LINE,
13114
13115 * hints on which high-level expressions correspond to the various
13116 assembly instruction operands.
13117
13118 For example, given this C source file:
13119
13120 int test (int n)
13121 {
13122 int i;
13123 int total = 0;
13124
13125 for (i = 0; i < n; i++)
13126 total += i * i;
13127
13128 return total;
13129 }
13130
13131 compiling to (x86_64) assembly via -S and emitting the result
13132 direct to stdout via -o -
13133
13134 gcc -S test.c -fverbose-asm -Os -o -
13135
13136 gives output similar to this:
13137
13138 .file "test.c"
13139 # GNU C11 (GCC) version 7.0.0 20160809 (experimental) (x86_64-pc-linux-gnu)
13140 [...snip...]
13141 # options passed:
13142 [...snip...]
13143
13144 .text
13145 .globl test
13146 .type test, @function
13147 test:
13148 .LFB0:
13149 .cfi_startproc
13150 # test.c:4: int total = 0;
13151 xorl %eax, %eax # <retval>
13152 # test.c:6: for (i = 0; i < n; i++)
13153 xorl %edx, %edx # i
13154 .L2:
13155 # test.c:6: for (i = 0; i < n; i++)
13156 cmpl %edi, %edx # n, i
13157 jge .L5 #,
13158 # test.c:7: total += i * i;
13159 movl %edx, %ecx # i, tmp92
13160 imull %edx, %ecx # i, tmp92
13161 # test.c:6: for (i = 0; i < n; i++)
13162 incl %edx # i
13163 # test.c:7: total += i * i;
13164 addl %ecx, %eax # tmp92, <retval>
13165 jmp .L2 #
13166 .L5:
13167 # test.c:10: }
13168 ret
13169 .cfi_endproc
13170 .LFE0:
13171 .size test, .-test
13172 .ident "GCC: (GNU) 7.0.0 20160809 (experimental)"
13173 .section .note.GNU-stack,"",@progbits
13174
13175 The comments are intended for humans rather than machines and hence
13176 the precise format of the comments is subject to change.
13177
13178 -frecord-gcc-switches
13179 This switch causes the command line used to invoke the compiler to
13180 be recorded into the object file that is being created. This
13181 switch is only implemented on some targets and the exact format of
13182 the recording is target and binary file format dependent, but it
13183 usually takes the form of a section containing ASCII text. This
13184 switch is related to the -fverbose-asm switch, but that switch only
13185 records information in the assembler output file as comments, so it
13186 never reaches the object file. See also -grecord-gcc-switches for
13187 another way of storing compiler options into the object file.
13188
13189 -fpic
13190 Generate position-independent code (PIC) suitable for use in a
13191 shared library, if supported for the target machine. Such code
13192 accesses all constant addresses through a global offset table
13193 (GOT). The dynamic loader resolves the GOT entries when the
13194 program starts (the dynamic loader is not part of GCC; it is part
13195 of the operating system). If the GOT size for the linked
13196 executable exceeds a machine-specific maximum size, you get an
13197 error message from the linker indicating that -fpic does not work;
13198 in that case, recompile with -fPIC instead. (These maximums are 8k
13199 on the SPARC, 28k on AArch64 and 32k on the m68k and RS/6000. The
13200 x86 has no such limit.)
13201
13202 Position-independent code requires special support, and therefore
13203 works only on certain machines. For the x86, GCC supports PIC for
13204 System V but not for the Sun 386i. Code generated for the IBM
13205 RS/6000 is always position-independent.
13206
13207 When this flag is set, the macros "__pic__" and "__PIC__" are
13208 defined to 1.
13209
13210 -fPIC
13211 If supported for the target machine, emit position-independent
13212 code, suitable for dynamic linking and avoiding any limit on the
13213 size of the global offset table. This option makes a difference on
13214 AArch64, m68k, PowerPC and SPARC.
13215
13216 Position-independent code requires special support, and therefore
13217 works only on certain machines.
13218
13219 When this flag is set, the macros "__pic__" and "__PIC__" are
13220 defined to 2.
13221
13222 -fpie
13223 -fPIE
13224 These options are similar to -fpic and -fPIC, but the generated
13225 position-independent code can be only linked into executables.
13226 Usually these options are used to compile code that will be linked
13227 using the -pie GCC option.
13228
13229 -fpie and -fPIE both define the macros "__pie__" and "__PIE__".
13230 The macros have the value 1 for -fpie and 2 for -fPIE.
13231
13232 -fno-plt
13233 Do not use the PLT for external function calls in position-
13234 independent code. Instead, load the callee address at call sites
13235 from the GOT and branch to it. This leads to more efficient code
13236 by eliminating PLT stubs and exposing GOT loads to optimizations.
13237 On architectures such as 32-bit x86 where PLT stubs expect the GOT
13238 pointer in a specific register, this gives more register allocation
13239 freedom to the compiler. Lazy binding requires use of the PLT;
13240 with -fno-plt all external symbols are resolved at load time.
13241
13242 Alternatively, the function attribute "noplt" can be used to avoid
13243 calls through the PLT for specific external functions.
13244
13245 In position-dependent code, a few targets also convert calls to
13246 functions that are marked to not use the PLT to use the GOT
13247 instead.
13248
13249 -fno-jump-tables
13250 Do not use jump tables for switch statements even where it would be
13251 more efficient than other code generation strategies. This option
13252 is of use in conjunction with -fpic or -fPIC for building code that
13253 forms part of a dynamic linker and cannot reference the address of
13254 a jump table. On some targets, jump tables do not require a GOT
13255 and this option is not needed.
13256
13257 -ffixed-reg
13258 Treat the register named reg as a fixed register; generated code
13259 should never refer to it (except perhaps as a stack pointer, frame
13260 pointer or in some other fixed role).
13261
13262 reg must be the name of a register. The register names accepted
13263 are machine-specific and are defined in the "REGISTER_NAMES" macro
13264 in the machine description macro file.
13265
13266 This flag does not have a negative form, because it specifies a
13267 three-way choice.
13268
13269 -fcall-used-reg
13270 Treat the register named reg as an allocable register that is
13271 clobbered by function calls. It may be allocated for temporaries
13272 or variables that do not live across a call. Functions compiled
13273 this way do not save and restore the register reg.
13274
13275 It is an error to use this flag with the frame pointer or stack
13276 pointer. Use of this flag for other registers that have fixed
13277 pervasive roles in the machine's execution model produces
13278 disastrous results.
13279
13280 This flag does not have a negative form, because it specifies a
13281 three-way choice.
13282
13283 -fcall-saved-reg
13284 Treat the register named reg as an allocable register saved by
13285 functions. It may be allocated even for temporaries or variables
13286 that live across a call. Functions compiled this way save and
13287 restore the register reg if they use it.
13288
13289 It is an error to use this flag with the frame pointer or stack
13290 pointer. Use of this flag for other registers that have fixed
13291 pervasive roles in the machine's execution model produces
13292 disastrous results.
13293
13294 A different sort of disaster results from the use of this flag for
13295 a register in which function values may be returned.
13296
13297 This flag does not have a negative form, because it specifies a
13298 three-way choice.
13299
13300 -fpack-struct[=n]
13301 Without a value specified, pack all structure members together
13302 without holes. When a value is specified (which must be a small
13303 power of two), pack structure members according to this value,
13304 representing the maximum alignment (that is, objects with default
13305 alignment requirements larger than this are output potentially
13306 unaligned at the next fitting location.
13307
13308 Warning: the -fpack-struct switch causes GCC to generate code that
13309 is not binary compatible with code generated without that switch.
13310 Additionally, it makes the code suboptimal. Use it to conform to a
13311 non-default application binary interface.
13312
13313 -fleading-underscore
13314 This option and its counterpart, -fno-leading-underscore, forcibly
13315 change the way C symbols are represented in the object file. One
13316 use is to help link with legacy assembly code.
13317
13318 Warning: the -fleading-underscore switch causes GCC to generate
13319 code that is not binary compatible with code generated without that
13320 switch. Use it to conform to a non-default application binary
13321 interface. Not all targets provide complete support for this
13322 switch.
13323
13324 -ftls-model=model
13325 Alter the thread-local storage model to be used. The model
13326 argument should be one of global-dynamic, local-dynamic, initial-
13327 exec or local-exec. Note that the choice is subject to
13328 optimization: the compiler may use a more efficient model for
13329 symbols not visible outside of the translation unit, or if -fpic is
13330 not given on the command line.
13331
13332 The default without -fpic is initial-exec; with -fpic the default
13333 is global-dynamic.
13334
13335 -ftrampolines
13336 For targets that normally need trampolines for nested functions,
13337 always generate them instead of using descriptors. Otherwise, for
13338 targets that do not need them, like for example HP-PA or IA-64, do
13339 nothing.
13340
13341 A trampoline is a small piece of code that is created at run time
13342 on the stack when the address of a nested function is taken, and is
13343 used to call the nested function indirectly. Therefore, it
13344 requires the stack to be made executable in order for the program
13345 to work properly.
13346
13347 -fno-trampolines is enabled by default on a language by language
13348 basis to let the compiler avoid generating them, if it computes
13349 that this is safe, and replace them with descriptors. Descriptors
13350 are made up of data only, but the generated code must be prepared
13351 to deal with them. As of this writing, -fno-trampolines is enabled
13352 by default only for Ada.
13353
13354 Moreover, code compiled with -ftrampolines and code compiled with
13355 -fno-trampolines are not binary compatible if nested functions are
13356 present. This option must therefore be used on a program-wide
13357 basis and be manipulated with extreme care.
13358
13359 -fvisibility=[default|internal|hidden|protected]
13360 Set the default ELF image symbol visibility to the specified
13361 option---all symbols are marked with this unless overridden within
13362 the code. Using this feature can very substantially improve
13363 linking and load times of shared object libraries, produce more
13364 optimized code, provide near-perfect API export and prevent symbol
13365 clashes. It is strongly recommended that you use this in any
13366 shared objects you distribute.
13367
13368 Despite the nomenclature, default always means public; i.e.,
13369 available to be linked against from outside the shared object.
13370 protected and internal are pretty useless in real-world usage so
13371 the only other commonly used option is hidden. The default if
13372 -fvisibility isn't specified is default, i.e., make every symbol
13373 public.
13374
13375 A good explanation of the benefits offered by ensuring ELF symbols
13376 have the correct visibility is given by "How To Write Shared
13377 Libraries" by Ulrich Drepper (which can be found at
13378 <https://www.akkadia.org/drepper/>)---however a superior solution
13379 made possible by this option to marking things hidden when the
13380 default is public is to make the default hidden and mark things
13381 public. This is the norm with DLLs on Windows and with
13382 -fvisibility=hidden and "__attribute__ ((visibility("default")))"
13383 instead of "__declspec(dllexport)" you get almost identical
13384 semantics with identical syntax. This is a great boon to those
13385 working with cross-platform projects.
13386
13387 For those adding visibility support to existing code, you may find
13388 "#pragma GCC visibility" of use. This works by you enclosing the
13389 declarations you wish to set visibility for with (for example)
13390 "#pragma GCC visibility push(hidden)" and "#pragma GCC visibility
13391 pop". Bear in mind that symbol visibility should be viewed as part
13392 of the API interface contract and thus all new code should always
13393 specify visibility when it is not the default; i.e., declarations
13394 only for use within the local DSO should always be marked
13395 explicitly as hidden as so to avoid PLT indirection
13396 overheads---making this abundantly clear also aids readability and
13397 self-documentation of the code. Note that due to ISO C++
13398 specification requirements, "operator new" and "operator delete"
13399 must always be of default visibility.
13400
13401 Be aware that headers from outside your project, in particular
13402 system headers and headers from any other library you use, may not
13403 be expecting to be compiled with visibility other than the default.
13404 You may need to explicitly say "#pragma GCC visibility
13405 push(default)" before including any such headers.
13406
13407 "extern" declarations are not affected by -fvisibility, so a lot of
13408 code can be recompiled with -fvisibility=hidden with no
13409 modifications. However, this means that calls to "extern"
13410 functions with no explicit visibility use the PLT, so it is more
13411 effective to use "__attribute ((visibility))" and/or "#pragma GCC
13412 visibility" to tell the compiler which "extern" declarations should
13413 be treated as hidden.
13414
13415 Note that -fvisibility does affect C++ vague linkage entities. This
13416 means that, for instance, an exception class that is be thrown
13417 between DSOs must be explicitly marked with default visibility so
13418 that the type_info nodes are unified between the DSOs.
13419
13420 An overview of these techniques, their benefits and how to use them
13421 is at <http://gcc.gnu.org/wiki/Visibility>.
13422
13423 -fstrict-volatile-bitfields
13424 This option should be used if accesses to volatile bit-fields (or
13425 other structure fields, although the compiler usually honors those
13426 types anyway) should use a single access of the width of the
13427 field's type, aligned to a natural alignment if possible. For
13428 example, targets with memory-mapped peripheral registers might
13429 require all such accesses to be 16 bits wide; with this flag you
13430 can declare all peripheral bit-fields as "unsigned short" (assuming
13431 short is 16 bits on these targets) to force GCC to use 16-bit
13432 accesses instead of, perhaps, a more efficient 32-bit access.
13433
13434 If this option is disabled, the compiler uses the most efficient
13435 instruction. In the previous example, that might be a 32-bit load
13436 instruction, even though that accesses bytes that do not contain
13437 any portion of the bit-field, or memory-mapped registers unrelated
13438 to the one being updated.
13439
13440 In some cases, such as when the "packed" attribute is applied to a
13441 structure field, it may not be possible to access the field with a
13442 single read or write that is correctly aligned for the target
13443 machine. In this case GCC falls back to generating multiple
13444 accesses rather than code that will fault or truncate the result at
13445 run time.
13446
13447 Note: Due to restrictions of the C/C++11 memory model, write
13448 accesses are not allowed to touch non bit-field members. It is
13449 therefore recommended to define all bits of the field's type as
13450 bit-field members.
13451
13452 The default value of this option is determined by the application
13453 binary interface for the target processor.
13454
13455 -fsync-libcalls
13456 This option controls whether any out-of-line instance of the
13457 "__sync" family of functions may be used to implement the C++11
13458 "__atomic" family of functions.
13459
13460 The default value of this option is enabled, thus the only useful
13461 form of the option is -fno-sync-libcalls. This option is used in
13462 the implementation of the libatomic runtime library.
13463
13464 GCC Developer Options
13465 This section describes command-line options that are primarily of
13466 interest to GCC developers, including options to support compiler
13467 testing and investigation of compiler bugs and compile-time performance
13468 problems. This includes options that produce debug dumps at various
13469 points in the compilation; that print statistics such as memory use and
13470 execution time; and that print information about GCC's configuration,
13471 such as where it searches for libraries. You should rarely need to use
13472 any of these options for ordinary compilation and linking tasks.
13473
13474 Many developer options that cause GCC to dump output to a file take an
13475 optional =filename suffix. You can specify stdout or - to dump to
13476 standard output, and stderr for standard error.
13477
13478 If =filename is omitted, a default dump file name is constructed by
13479 concatenating the base dump file name, a pass number, phase letter, and
13480 pass name. The base dump file name is the name of output file produced
13481 by the compiler if explicitly specified and not an executable;
13482 otherwise it is the source file name. The pass number is determined by
13483 the order passes are registered with the compiler's pass manager. This
13484 is generally the same as the order of execution, but passes registered
13485 by plugins, target-specific passes, or passes that are otherwise
13486 registered late are numbered higher than the pass named final, even if
13487 they are executed earlier. The phase letter is one of i (inter-
13488 procedural analysis), l (language-specific), r (RTL), or t (tree). The
13489 files are created in the directory of the output file.
13490
13491 -fcallgraph-info
13492 -fcallgraph-info=MARKERS
13493 Makes the compiler output callgraph information for the program, on
13494 a per-object-file basis. The information is generated in the
13495 common VCG format. It can be decorated with additional, per-node
13496 and/or per-edge information, if a list of comma-separated markers
13497 is additionally specified. When the "su" marker is specified, the
13498 callgraph is decorated with stack usage information; it is
13499 equivalent to -fstack-usage. When the "da" marker is specified,
13500 the callgraph is decorated with information about dynamically
13501 allocated objects.
13502
13503 When compiling with -flto, no callgraph information is output along
13504 with the object file. At LTO link time, -fcallgraph-info may
13505 generate multiple callgraph information files next to intermediate
13506 LTO output files.
13507
13508 -dletters
13509 -fdump-rtl-pass
13510 -fdump-rtl-pass=filename
13511 Says to make debugging dumps during compilation at times specified
13512 by letters. This is used for debugging the RTL-based passes of the
13513 compiler.
13514
13515 Some -dletters switches have different meaning when -E is used for
13516 preprocessing.
13517
13518 Debug dumps can be enabled with a -fdump-rtl switch or some -d
13519 option letters. Here are the possible letters for use in pass and
13520 letters, and their meanings:
13521
13522 -fdump-rtl-alignments
13523 Dump after branch alignments have been computed.
13524
13525 -fdump-rtl-asmcons
13526 Dump after fixing rtl statements that have unsatisfied in/out
13527 constraints.
13528
13529 -fdump-rtl-auto_inc_dec
13530 Dump after auto-inc-dec discovery. This pass is only run on
13531 architectures that have auto inc or auto dec instructions.
13532
13533 -fdump-rtl-barriers
13534 Dump after cleaning up the barrier instructions.
13535
13536 -fdump-rtl-bbpart
13537 Dump after partitioning hot and cold basic blocks.
13538
13539 -fdump-rtl-bbro
13540 Dump after block reordering.
13541
13542 -fdump-rtl-btl1
13543 -fdump-rtl-btl2
13544 -fdump-rtl-btl1 and -fdump-rtl-btl2 enable dumping after the
13545 two branch target load optimization passes.
13546
13547 -fdump-rtl-bypass
13548 Dump after jump bypassing and control flow optimizations.
13549
13550 -fdump-rtl-combine
13551 Dump after the RTL instruction combination pass.
13552
13553 -fdump-rtl-compgotos
13554 Dump after duplicating the computed gotos.
13555
13556 -fdump-rtl-ce1
13557 -fdump-rtl-ce2
13558 -fdump-rtl-ce3
13559 -fdump-rtl-ce1, -fdump-rtl-ce2, and -fdump-rtl-ce3 enable
13560 dumping after the three if conversion passes.
13561
13562 -fdump-rtl-cprop_hardreg
13563 Dump after hard register copy propagation.
13564
13565 -fdump-rtl-csa
13566 Dump after combining stack adjustments.
13567
13568 -fdump-rtl-cse1
13569 -fdump-rtl-cse2
13570 -fdump-rtl-cse1 and -fdump-rtl-cse2 enable dumping after the
13571 two common subexpression elimination passes.
13572
13573 -fdump-rtl-dce
13574 Dump after the standalone dead code elimination passes.
13575
13576 -fdump-rtl-dbr
13577 Dump after delayed branch scheduling.
13578
13579 -fdump-rtl-dce1
13580 -fdump-rtl-dce2
13581 -fdump-rtl-dce1 and -fdump-rtl-dce2 enable dumping after the
13582 two dead store elimination passes.
13583
13584 -fdump-rtl-eh
13585 Dump after finalization of EH handling code.
13586
13587 -fdump-rtl-eh_ranges
13588 Dump after conversion of EH handling range regions.
13589
13590 -fdump-rtl-expand
13591 Dump after RTL generation.
13592
13593 -fdump-rtl-fwprop1
13594 -fdump-rtl-fwprop2
13595 -fdump-rtl-fwprop1 and -fdump-rtl-fwprop2 enable dumping after
13596 the two forward propagation passes.
13597
13598 -fdump-rtl-gcse1
13599 -fdump-rtl-gcse2
13600 -fdump-rtl-gcse1 and -fdump-rtl-gcse2 enable dumping after
13601 global common subexpression elimination.
13602
13603 -fdump-rtl-init-regs
13604 Dump after the initialization of the registers.
13605
13606 -fdump-rtl-initvals
13607 Dump after the computation of the initial value sets.
13608
13609 -fdump-rtl-into_cfglayout
13610 Dump after converting to cfglayout mode.
13611
13612 -fdump-rtl-ira
13613 Dump after iterated register allocation.
13614
13615 -fdump-rtl-jump
13616 Dump after the second jump optimization.
13617
13618 -fdump-rtl-loop2
13619 -fdump-rtl-loop2 enables dumping after the rtl loop
13620 optimization passes.
13621
13622 -fdump-rtl-mach
13623 Dump after performing the machine dependent reorganization
13624 pass, if that pass exists.
13625
13626 -fdump-rtl-mode_sw
13627 Dump after removing redundant mode switches.
13628
13629 -fdump-rtl-rnreg
13630 Dump after register renumbering.
13631
13632 -fdump-rtl-outof_cfglayout
13633 Dump after converting from cfglayout mode.
13634
13635 -fdump-rtl-peephole2
13636 Dump after the peephole pass.
13637
13638 -fdump-rtl-postreload
13639 Dump after post-reload optimizations.
13640
13641 -fdump-rtl-pro_and_epilogue
13642 Dump after generating the function prologues and epilogues.
13643
13644 -fdump-rtl-sched1
13645 -fdump-rtl-sched2
13646 -fdump-rtl-sched1 and -fdump-rtl-sched2 enable dumping after
13647 the basic block scheduling passes.
13648
13649 -fdump-rtl-ree
13650 Dump after sign/zero extension elimination.
13651
13652 -fdump-rtl-seqabstr
13653 Dump after common sequence discovery.
13654
13655 -fdump-rtl-shorten
13656 Dump after shortening branches.
13657
13658 -fdump-rtl-sibling
13659 Dump after sibling call optimizations.
13660
13661 -fdump-rtl-split1
13662 -fdump-rtl-split2
13663 -fdump-rtl-split3
13664 -fdump-rtl-split4
13665 -fdump-rtl-split5
13666 These options enable dumping after five rounds of instruction
13667 splitting.
13668
13669 -fdump-rtl-sms
13670 Dump after modulo scheduling. This pass is only run on some
13671 architectures.
13672
13673 -fdump-rtl-stack
13674 Dump after conversion from GCC's "flat register file" registers
13675 to the x87's stack-like registers. This pass is only run on
13676 x86 variants.
13677
13678 -fdump-rtl-subreg1
13679 -fdump-rtl-subreg2
13680 -fdump-rtl-subreg1 and -fdump-rtl-subreg2 enable dumping after
13681 the two subreg expansion passes.
13682
13683 -fdump-rtl-unshare
13684 Dump after all rtl has been unshared.
13685
13686 -fdump-rtl-vartrack
13687 Dump after variable tracking.
13688
13689 -fdump-rtl-vregs
13690 Dump after converting virtual registers to hard registers.
13691
13692 -fdump-rtl-web
13693 Dump after live range splitting.
13694
13695 -fdump-rtl-regclass
13696 -fdump-rtl-subregs_of_mode_init
13697 -fdump-rtl-subregs_of_mode_finish
13698 -fdump-rtl-dfinit
13699 -fdump-rtl-dfinish
13700 These dumps are defined but always produce empty files.
13701
13702 -da
13703 -fdump-rtl-all
13704 Produce all the dumps listed above.
13705
13706 -dA Annotate the assembler output with miscellaneous debugging
13707 information.
13708
13709 -dD Dump all macro definitions, at the end of preprocessing, in
13710 addition to normal output.
13711
13712 -dH Produce a core dump whenever an error occurs.
13713
13714 -dp Annotate the assembler output with a comment indicating which
13715 pattern and alternative is used. The length and cost of each
13716 instruction are also printed.
13717
13718 -dP Dump the RTL in the assembler output as a comment before each
13719 instruction. Also turns on -dp annotation.
13720
13721 -dx Just generate RTL for a function instead of compiling it.
13722 Usually used with -fdump-rtl-expand.
13723
13724 -fdump-debug
13725 Dump debugging information generated during the debug generation
13726 phase.
13727
13728 -fdump-earlydebug
13729 Dump debugging information generated during the early debug
13730 generation phase.
13731
13732 -fdump-noaddr
13733 When doing debugging dumps, suppress address output. This makes it
13734 more feasible to use diff on debugging dumps for compiler
13735 invocations with different compiler binaries and/or different text
13736 / bss / data / heap / stack / dso start locations.
13737
13738 -freport-bug
13739 Collect and dump debug information into a temporary file if an
13740 internal compiler error (ICE) occurs.
13741
13742 -fdump-unnumbered
13743 When doing debugging dumps, suppress instruction numbers and
13744 address output. This makes it more feasible to use diff on
13745 debugging dumps for compiler invocations with different options, in
13746 particular with and without -g.
13747
13748 -fdump-unnumbered-links
13749 When doing debugging dumps (see -d option above), suppress
13750 instruction numbers for the links to the previous and next
13751 instructions in a sequence.
13752
13753 -fdump-ipa-switch
13754 -fdump-ipa-switch-options
13755 Control the dumping at various stages of inter-procedural analysis
13756 language tree to a file. The file name is generated by appending a
13757 switch specific suffix to the source file name, and the file is
13758 created in the same directory as the output file. The following
13759 dumps are possible:
13760
13761 all Enables all inter-procedural analysis dumps.
13762
13763 cgraph
13764 Dumps information about call-graph optimization, unused
13765 function removal, and inlining decisions.
13766
13767 inline
13768 Dump after function inlining.
13769
13770 Additionally, the options -optimized, -missed, -note, and -all can
13771 be provided, with the same meaning as for -fopt-info, defaulting to
13772 -optimized.
13773
13774 For example, -fdump-ipa-inline-optimized-missed will emit
13775 information on callsites that were inlined, along with callsites
13776 that were not inlined.
13777
13778 By default, the dump will contain messages about successful
13779 optimizations (equivalent to -optimized) together with low-level
13780 details about the analysis.
13781
13782 -fdump-lang-all
13783 -fdump-lang-switch
13784 -fdump-lang-switch-options
13785 -fdump-lang-switch-options=filename
13786 Control the dumping of language-specific information. The options
13787 and filename portions behave as described in the -fdump-tree
13788 option. The following switch values are accepted:
13789
13790 all Enable all language-specific dumps.
13791
13792 class
13793 Dump class hierarchy information. Virtual table information is
13794 emitted unless 'slim' is specified. This option is applicable
13795 to C++ only.
13796
13797 raw Dump the raw internal tree data. This option is applicable to
13798 C++ only.
13799
13800 -fdump-passes
13801 Print on stderr the list of optimization passes that are turned on
13802 and off by the current command-line options.
13803
13804 -fdump-statistics-option
13805 Enable and control dumping of pass statistics in a separate file.
13806 The file name is generated by appending a suffix ending in
13807 .statistics to the source file name, and the file is created in the
13808 same directory as the output file. If the -option form is used,
13809 -stats causes counters to be summed over the whole compilation unit
13810 while -details dumps every event as the passes generate them. The
13811 default with no option is to sum counters for each function
13812 compiled.
13813
13814 -fdump-tree-all
13815 -fdump-tree-switch
13816 -fdump-tree-switch-options
13817 -fdump-tree-switch-options=filename
13818 Control the dumping at various stages of processing the
13819 intermediate language tree to a file. If the -options form is
13820 used, options is a list of - separated options which control the
13821 details of the dump. Not all options are applicable to all dumps;
13822 those that are not meaningful are ignored. The following options
13823 are available
13824
13825 address
13826 Print the address of each node. Usually this is not meaningful
13827 as it changes according to the environment and source file.
13828 Its primary use is for tying up a dump file with a debug
13829 environment.
13830
13831 asmname
13832 If "DECL_ASSEMBLER_NAME" has been set for a given decl, use
13833 that in the dump instead of "DECL_NAME". Its primary use is
13834 ease of use working backward from mangled names in the assembly
13835 file.
13836
13837 slim
13838 When dumping front-end intermediate representations, inhibit
13839 dumping of members of a scope or body of a function merely
13840 because that scope has been reached. Only dump such items when
13841 they are directly reachable by some other path.
13842
13843 When dumping pretty-printed trees, this option inhibits dumping
13844 the bodies of control structures.
13845
13846 When dumping RTL, print the RTL in slim (condensed) form
13847 instead of the default LISP-like representation.
13848
13849 raw Print a raw representation of the tree. By default, trees are
13850 pretty-printed into a C-like representation.
13851
13852 details
13853 Enable more detailed dumps (not honored by every dump option).
13854 Also include information from the optimization passes.
13855
13856 stats
13857 Enable dumping various statistics about the pass (not honored
13858 by every dump option).
13859
13860 blocks
13861 Enable showing basic block boundaries (disabled in raw dumps).
13862
13863 graph
13864 For each of the other indicated dump files (-fdump-rtl-pass),
13865 dump a representation of the control flow graph suitable for
13866 viewing with GraphViz to file.passid.pass.dot. Each function
13867 in the file is pretty-printed as a subgraph, so that GraphViz
13868 can render them all in a single plot.
13869
13870 This option currently only works for RTL dumps, and the RTL is
13871 always dumped in slim form.
13872
13873 vops
13874 Enable showing virtual operands for every statement.
13875
13876 lineno
13877 Enable showing line numbers for statements.
13878
13879 uid Enable showing the unique ID ("DECL_UID") for each variable.
13880
13881 verbose
13882 Enable showing the tree dump for each statement.
13883
13884 eh Enable showing the EH region number holding each statement.
13885
13886 scev
13887 Enable showing scalar evolution analysis details.
13888
13889 optimized
13890 Enable showing optimization information (only available in
13891 certain passes).
13892
13893 missed
13894 Enable showing missed optimization information (only available
13895 in certain passes).
13896
13897 note
13898 Enable other detailed optimization information (only available
13899 in certain passes).
13900
13901 all Turn on all options, except raw, slim, verbose and lineno.
13902
13903 optall
13904 Turn on all optimization options, i.e., optimized, missed, and
13905 note.
13906
13907 To determine what tree dumps are available or find the dump for a
13908 pass of interest follow the steps below.
13909
13910 1. Invoke GCC with -fdump-passes and in the stderr output look for
13911 a code that corresponds to the pass you are interested in. For
13912 example, the codes "tree-evrp", "tree-vrp1", and "tree-vrp2"
13913 correspond to the three Value Range Propagation passes. The
13914 number at the end distinguishes distinct invocations of the
13915 same pass.
13916
13917 2. To enable the creation of the dump file, append the pass code
13918 to the -fdump- option prefix and invoke GCC with it. For
13919 example, to enable the dump from the Early Value Range
13920 Propagation pass, invoke GCC with the -fdump-tree-evrp option.
13921 Optionally, you may specify the name of the dump file. If you
13922 don't specify one, GCC creates as described below.
13923
13924 3. Find the pass dump in a file whose name is composed of three
13925 components separated by a period: the name of the source file
13926 GCC was invoked to compile, a numeric suffix indicating the
13927 pass number followed by the letter t for tree passes (and the
13928 letter r for RTL passes), and finally the pass code. For
13929 example, the Early VRP pass dump might be in a file named
13930 myfile.c.038t.evrp in the current working directory. Note that
13931 the numeric codes are not stable and may change from one
13932 version of GCC to another.
13933
13934 -fopt-info
13935 -fopt-info-options
13936 -fopt-info-options=filename
13937 Controls optimization dumps from various optimization passes. If
13938 the -options form is used, options is a list of - separated option
13939 keywords to select the dump details and optimizations.
13940
13941 The options can be divided into three groups:
13942
13943 1. options describing what kinds of messages should be emitted,
13944
13945 2. options describing the verbosity of the dump, and
13946
13947 3. options describing which optimizations should be included.
13948
13949 The options from each group can be freely mixed as they are non-
13950 overlapping. However, in case of any conflicts, the later options
13951 override the earlier options on the command line.
13952
13953 The following options control which kinds of messages should be
13954 emitted:
13955
13956 optimized
13957 Print information when an optimization is successfully applied.
13958 It is up to a pass to decide which information is relevant. For
13959 example, the vectorizer passes print the source location of
13960 loops which are successfully vectorized.
13961
13962 missed
13963 Print information about missed optimizations. Individual passes
13964 control which information to include in the output.
13965
13966 note
13967 Print verbose information about optimizations, such as certain
13968 transformations, more detailed messages about decisions etc.
13969
13970 all Print detailed optimization information. This includes
13971 optimized, missed, and note.
13972
13973 The following option controls the dump verbosity:
13974
13975 internals
13976 By default, only "high-level" messages are emitted. This option
13977 enables additional, more detailed, messages, which are likely
13978 to only be of interest to GCC developers.
13979
13980 One or more of the following option keywords can be used to
13981 describe a group of optimizations:
13982
13983 ipa Enable dumps from all interprocedural optimizations.
13984
13985 loop
13986 Enable dumps from all loop optimizations.
13987
13988 inline
13989 Enable dumps from all inlining optimizations.
13990
13991 omp Enable dumps from all OMP (Offloading and Multi Processing)
13992 optimizations.
13993
13994 vec Enable dumps from all vectorization optimizations.
13995
13996 optall
13997 Enable dumps from all optimizations. This is a superset of the
13998 optimization groups listed above.
13999
14000 If options is omitted, it defaults to optimized-optall, which means
14001 to dump messages about successful optimizations from all the
14002 passes, omitting messages that are treated as "internals".
14003
14004 If the filename is provided, then the dumps from all the applicable
14005 optimizations are concatenated into the filename. Otherwise the
14006 dump is output onto stderr. Though multiple -fopt-info options are
14007 accepted, only one of them can include a filename. If other
14008 filenames are provided then all but the first such option are
14009 ignored.
14010
14011 Note that the output filename is overwritten in case of multiple
14012 translation units. If a combined output from multiple translation
14013 units is desired, stderr should be used instead.
14014
14015 In the following example, the optimization info is output to
14016 stderr:
14017
14018 gcc -O3 -fopt-info
14019
14020 This example:
14021
14022 gcc -O3 -fopt-info-missed=missed.all
14023
14024 outputs missed optimization report from all the passes into
14025 missed.all, and this one:
14026
14027 gcc -O2 -ftree-vectorize -fopt-info-vec-missed
14028
14029 prints information about missed optimization opportunities from
14030 vectorization passes on stderr. Note that -fopt-info-vec-missed is
14031 equivalent to -fopt-info-missed-vec. The order of the optimization
14032 group names and message types listed after -fopt-info does not
14033 matter.
14034
14035 As another example,
14036
14037 gcc -O3 -fopt-info-inline-optimized-missed=inline.txt
14038
14039 outputs information about missed optimizations as well as optimized
14040 locations from all the inlining passes into inline.txt.
14041
14042 Finally, consider:
14043
14044 gcc -fopt-info-vec-missed=vec.miss -fopt-info-loop-optimized=loop.opt
14045
14046 Here the two output filenames vec.miss and loop.opt are in conflict
14047 since only one output file is allowed. In this case, only the first
14048 option takes effect and the subsequent options are ignored. Thus
14049 only vec.miss is produced which contains dumps from the vectorizer
14050 about missed opportunities.
14051
14052 -fsave-optimization-record
14053 Write a SRCFILE.opt-record.json.gz file detailing what
14054 optimizations were performed, for those optimizations that support
14055 -fopt-info.
14056
14057 This option is experimental and the format of the data within the
14058 compressed JSON file is subject to change.
14059
14060 It is roughly equivalent to a machine-readable version of
14061 -fopt-info-all, as a collection of messages with source file, line
14062 number and column number, with the following additional data for
14063 each message:
14064
14065 * the execution count of the code being optimized, along with
14066 metadata about whether this was from actual profile data, or
14067 just an estimate, allowing consumers to prioritize messages by
14068 code hotness,
14069
14070 * the function name of the code being optimized, where
14071 applicable,
14072
14073 * the "inlining chain" for the code being optimized, so that when
14074 a function is inlined into several different places (which
14075 might themselves be inlined), the reader can distinguish
14076 between the copies,
14077
14078 * objects identifying those parts of the message that refer to
14079 expressions, statements or symbol-table nodes, which of these
14080 categories they are, and, when available, their source code
14081 location,
14082
14083 * the GCC pass that emitted the message, and
14084
14085 * the location in GCC's own code from which the message was
14086 emitted
14087
14088 Additionally, some messages are logically nested within other
14089 messages, reflecting implementation details of the optimization
14090 passes.
14091
14092 -fsched-verbose=n
14093 On targets that use instruction scheduling, this option controls
14094 the amount of debugging output the scheduler prints to the dump
14095 files.
14096
14097 For n greater than zero, -fsched-verbose outputs the same
14098 information as -fdump-rtl-sched1 and -fdump-rtl-sched2. For n
14099 greater than one, it also output basic block probabilities,
14100 detailed ready list information and unit/insn info. For n greater
14101 than two, it includes RTL at abort point, control-flow and regions
14102 info. And for n over four, -fsched-verbose also includes
14103 dependence info.
14104
14105 -fenable-kind-pass
14106 -fdisable-kind-pass=range-list
14107 This is a set of options that are used to explicitly disable/enable
14108 optimization passes. These options are intended for use for
14109 debugging GCC. Compiler users should use regular options for
14110 enabling/disabling passes instead.
14111
14112 -fdisable-ipa-pass
14113 Disable IPA pass pass. pass is the pass name. If the same pass
14114 is statically invoked in the compiler multiple times, the pass
14115 name should be appended with a sequential number starting from
14116 1.
14117
14118 -fdisable-rtl-pass
14119 -fdisable-rtl-pass=range-list
14120 Disable RTL pass pass. pass is the pass name. If the same
14121 pass is statically invoked in the compiler multiple times, the
14122 pass name should be appended with a sequential number starting
14123 from 1. range-list is a comma-separated list of function
14124 ranges or assembler names. Each range is a number pair
14125 separated by a colon. The range is inclusive in both ends. If
14126 the range is trivial, the number pair can be simplified as a
14127 single number. If the function's call graph node's uid falls
14128 within one of the specified ranges, the pass is disabled for
14129 that function. The uid is shown in the function header of a
14130 dump file, and the pass names can be dumped by using option
14131 -fdump-passes.
14132
14133 -fdisable-tree-pass
14134 -fdisable-tree-pass=range-list
14135 Disable tree pass pass. See -fdisable-rtl for the description
14136 of option arguments.
14137
14138 -fenable-ipa-pass
14139 Enable IPA pass pass. pass is the pass name. If the same pass
14140 is statically invoked in the compiler multiple times, the pass
14141 name should be appended with a sequential number starting from
14142 1.
14143
14144 -fenable-rtl-pass
14145 -fenable-rtl-pass=range-list
14146 Enable RTL pass pass. See -fdisable-rtl for option argument
14147 description and examples.
14148
14149 -fenable-tree-pass
14150 -fenable-tree-pass=range-list
14151 Enable tree pass pass. See -fdisable-rtl for the description
14152 of option arguments.
14153
14154 Here are some examples showing uses of these options.
14155
14156 # disable ccp1 for all functions
14157 -fdisable-tree-ccp1
14158 # disable complete unroll for function whose cgraph node uid is 1
14159 -fenable-tree-cunroll=1
14160 # disable gcse2 for functions at the following ranges [1,1],
14161 # [300,400], and [400,1000]
14162 # disable gcse2 for functions foo and foo2
14163 -fdisable-rtl-gcse2=foo,foo2
14164 # disable early inlining
14165 -fdisable-tree-einline
14166 # disable ipa inlining
14167 -fdisable-ipa-inline
14168 # enable tree full unroll
14169 -fenable-tree-unroll
14170
14171 -fchecking
14172 -fchecking=n
14173 Enable internal consistency checking. The default depends on the
14174 compiler configuration. -fchecking=2 enables further internal
14175 consistency checking that might affect code generation.
14176
14177 -frandom-seed=string
14178 This option provides a seed that GCC uses in place of random
14179 numbers in generating certain symbol names that have to be
14180 different in every compiled file. It is also used to place unique
14181 stamps in coverage data files and the object files that produce
14182 them. You can use the -frandom-seed option to produce reproducibly
14183 identical object files.
14184
14185 The string can either be a number (decimal, octal or hex) or an
14186 arbitrary string (in which case it's converted to a number by
14187 computing CRC32).
14188
14189 The string should be different for every file you compile.
14190
14191 -save-temps
14192 -save-temps=cwd
14193 Store the usual "temporary" intermediate files permanently; place
14194 them in the current directory and name them based on the source
14195 file. Thus, compiling foo.c with -c -save-temps produces files
14196 foo.i and foo.s, as well as foo.o. This creates a preprocessed
14197 foo.i output file even though the compiler now normally uses an
14198 integrated preprocessor.
14199
14200 When used in combination with the -x command-line option,
14201 -save-temps is sensible enough to avoid over writing an input
14202 source file with the same extension as an intermediate file. The
14203 corresponding intermediate file may be obtained by renaming the
14204 source file before using -save-temps.
14205
14206 If you invoke GCC in parallel, compiling several different source
14207 files that share a common base name in different subdirectories or
14208 the same source file compiled for multiple output destinations, it
14209 is likely that the different parallel compilers will interfere with
14210 each other, and overwrite the temporary files. For instance:
14211
14212 gcc -save-temps -o outdir1/foo.o indir1/foo.c&
14213 gcc -save-temps -o outdir2/foo.o indir2/foo.c&
14214
14215 may result in foo.i and foo.o being written to simultaneously by
14216 both compilers.
14217
14218 -save-temps=obj
14219 Store the usual "temporary" intermediate files permanently. If the
14220 -o option is used, the temporary files are based on the object
14221 file. If the -o option is not used, the -save-temps=obj switch
14222 behaves like -save-temps.
14223
14224 For example:
14225
14226 gcc -save-temps=obj -c foo.c
14227 gcc -save-temps=obj -c bar.c -o dir/xbar.o
14228 gcc -save-temps=obj foobar.c -o dir2/yfoobar
14229
14230 creates foo.i, foo.s, dir/xbar.i, dir/xbar.s, dir2/yfoobar.i,
14231 dir2/yfoobar.s, and dir2/yfoobar.o.
14232
14233 -time[=file]
14234 Report the CPU time taken by each subprocess in the compilation
14235 sequence. For C source files, this is the compiler proper and
14236 assembler (plus the linker if linking is done).
14237
14238 Without the specification of an output file, the output looks like
14239 this:
14240
14241 # cc1 0.12 0.01
14242 # as 0.00 0.01
14243
14244 The first number on each line is the "user time", that is time
14245 spent executing the program itself. The second number is "system
14246 time", time spent executing operating system routines on behalf of
14247 the program. Both numbers are in seconds.
14248
14249 With the specification of an output file, the output is appended to
14250 the named file, and it looks like this:
14251
14252 0.12 0.01 cc1 <options>
14253 0.00 0.01 as <options>
14254
14255 The "user time" and the "system time" are moved before the program
14256 name, and the options passed to the program are displayed, so that
14257 one can later tell what file was being compiled, and with which
14258 options.
14259
14260 -fdump-final-insns[=file]
14261 Dump the final internal representation (RTL) to file. If the
14262 optional argument is omitted (or if file is "."), the name of the
14263 dump file is determined by appending ".gkd" to the compilation
14264 output file name.
14265
14266 -fcompare-debug[=opts]
14267 If no error occurs during compilation, run the compiler a second
14268 time, adding opts and -fcompare-debug-second to the arguments
14269 passed to the second compilation. Dump the final internal
14270 representation in both compilations, and print an error if they
14271 differ.
14272
14273 If the equal sign is omitted, the default -gtoggle is used.
14274
14275 The environment variable GCC_COMPARE_DEBUG, if defined, non-empty
14276 and nonzero, implicitly enables -fcompare-debug. If
14277 GCC_COMPARE_DEBUG is defined to a string starting with a dash, then
14278 it is used for opts, otherwise the default -gtoggle is used.
14279
14280 -fcompare-debug=, with the equal sign but without opts, is
14281 equivalent to -fno-compare-debug, which disables the dumping of the
14282 final representation and the second compilation, preventing even
14283 GCC_COMPARE_DEBUG from taking effect.
14284
14285 To verify full coverage during -fcompare-debug testing, set
14286 GCC_COMPARE_DEBUG to say -fcompare-debug-not-overridden, which GCC
14287 rejects as an invalid option in any actual compilation (rather than
14288 preprocessing, assembly or linking). To get just a warning,
14289 setting GCC_COMPARE_DEBUG to -w%n-fcompare-debug not overridden
14290 will do.
14291
14292 -fcompare-debug-second
14293 This option is implicitly passed to the compiler for the second
14294 compilation requested by -fcompare-debug, along with options to
14295 silence warnings, and omitting other options that would cause the
14296 compiler to produce output to files or to standard output as a side
14297 effect. Dump files and preserved temporary files are renamed so as
14298 to contain the ".gk" additional extension during the second
14299 compilation, to avoid overwriting those generated by the first.
14300
14301 When this option is passed to the compiler driver, it causes the
14302 first compilation to be skipped, which makes it useful for little
14303 other than debugging the compiler proper.
14304
14305 -gtoggle
14306 Turn off generation of debug info, if leaving out this option
14307 generates it, or turn it on at level 2 otherwise. The position of
14308 this argument in the command line does not matter; it takes effect
14309 after all other options are processed, and it does so only once, no
14310 matter how many times it is given. This is mainly intended to be
14311 used with -fcompare-debug.
14312
14313 -fvar-tracking-assignments-toggle
14314 Toggle -fvar-tracking-assignments, in the same way that -gtoggle
14315 toggles -g.
14316
14317 -Q Makes the compiler print out each function name as it is compiled,
14318 and print some statistics about each pass when it finishes.
14319
14320 -ftime-report
14321 Makes the compiler print some statistics about the time consumed by
14322 each pass when it finishes.
14323
14324 -ftime-report-details
14325 Record the time consumed by infrastructure parts separately for
14326 each pass.
14327
14328 -fira-verbose=n
14329 Control the verbosity of the dump file for the integrated register
14330 allocator. The default value is 5. If the value n is greater or
14331 equal to 10, the dump output is sent to stderr using the same
14332 format as n minus 10.
14333
14334 -flto-report
14335 Prints a report with internal details on the workings of the link-
14336 time optimizer. The contents of this report vary from version to
14337 version. It is meant to be useful to GCC developers when
14338 processing object files in LTO mode (via -flto).
14339
14340 Disabled by default.
14341
14342 -flto-report-wpa
14343 Like -flto-report, but only print for the WPA phase of link-time
14344 optimization.
14345
14346 -fmem-report
14347 Makes the compiler print some statistics about permanent memory
14348 allocation when it finishes.
14349
14350 -fmem-report-wpa
14351 Makes the compiler print some statistics about permanent memory
14352 allocation for the WPA phase only.
14353
14354 -fpre-ipa-mem-report
14355 -fpost-ipa-mem-report
14356 Makes the compiler print some statistics about permanent memory
14357 allocation before or after interprocedural optimization.
14358
14359 -fprofile-report
14360 Makes the compiler print some statistics about consistency of the
14361 (estimated) profile and effect of individual passes.
14362
14363 -fstack-usage
14364 Makes the compiler output stack usage information for the program,
14365 on a per-function basis. The filename for the dump is made by
14366 appending .su to the auxname. auxname is generated from the name
14367 of the output file, if explicitly specified and it is not an
14368 executable, otherwise it is the basename of the source file. An
14369 entry is made up of three fields:
14370
14371 * The name of the function.
14372
14373 * A number of bytes.
14374
14375 * One or more qualifiers: "static", "dynamic", "bounded".
14376
14377 The qualifier "static" means that the function manipulates the
14378 stack statically: a fixed number of bytes are allocated for the
14379 frame on function entry and released on function exit; no stack
14380 adjustments are otherwise made in the function. The second field
14381 is this fixed number of bytes.
14382
14383 The qualifier "dynamic" means that the function manipulates the
14384 stack dynamically: in addition to the static allocation described
14385 above, stack adjustments are made in the body of the function, for
14386 example to push/pop arguments around function calls. If the
14387 qualifier "bounded" is also present, the amount of these
14388 adjustments is bounded at compile time and the second field is an
14389 upper bound of the total amount of stack used by the function. If
14390 it is not present, the amount of these adjustments is not bounded
14391 at compile time and the second field only represents the bounded
14392 part.
14393
14394 -fstats
14395 Emit statistics about front-end processing at the end of the
14396 compilation. This option is supported only by the C++ front end,
14397 and the information is generally only useful to the G++ development
14398 team.
14399
14400 -fdbg-cnt-list
14401 Print the name and the counter upper bound for all debug counters.
14402
14403 -fdbg-cnt=counter-value-list
14404 Set the internal debug counter lower and upper bound. counter-
14405 value-list is a comma-separated list of
14406 name:lower_bound1-upper_bound1 [:lower_bound2-upper_bound2...]
14407 tuples which sets the name of the counter and list of closed
14408 intervals. The lower_bound is optional and is zero initialized if
14409 not set. For example, with -fdbg-cnt=dce:2-4:10-11,tail_call:10,
14410 "dbg_cnt(dce)" returns true only for second, third, fourth, tenth
14411 and eleventh invocation. For "dbg_cnt(tail_call)" true is returned
14412 for first 10 invocations.
14413
14414 -print-file-name=library
14415 Print the full absolute name of the library file library that would
14416 be used when linking---and don't do anything else. With this
14417 option, GCC does not compile or link anything; it just prints the
14418 file name.
14419
14420 -print-multi-directory
14421 Print the directory name corresponding to the multilib selected by
14422 any other switches present in the command line. This directory is
14423 supposed to exist in GCC_EXEC_PREFIX.
14424
14425 -print-multi-lib
14426 Print the mapping from multilib directory names to compiler
14427 switches that enable them. The directory name is separated from
14428 the switches by ;, and each switch starts with an @ instead of the
14429 -, without spaces between multiple switches. This is supposed to
14430 ease shell processing.
14431
14432 -print-multi-os-directory
14433 Print the path to OS libraries for the selected multilib, relative
14434 to some lib subdirectory. If OS libraries are present in the lib
14435 subdirectory and no multilibs are used, this is usually just ., if
14436 OS libraries are present in libsuffix sibling directories this
14437 prints e.g. ../lib64, ../lib or ../lib32, or if OS libraries are
14438 present in lib/subdir subdirectories it prints e.g. amd64, sparcv9
14439 or ev6.
14440
14441 -print-multiarch
14442 Print the path to OS libraries for the selected multiarch, relative
14443 to some lib subdirectory.
14444
14445 -print-prog-name=program
14446 Like -print-file-name, but searches for a program such as cpp.
14447
14448 -print-libgcc-file-name
14449 Same as -print-file-name=libgcc.a.
14450
14451 This is useful when you use -nostdlib or -nodefaultlibs but you do
14452 want to link with libgcc.a. You can do:
14453
14454 gcc -nostdlib <files>... `gcc -print-libgcc-file-name`
14455
14456 -print-search-dirs
14457 Print the name of the configured installation directory and a list
14458 of program and library directories gcc searches---and don't do
14459 anything else.
14460
14461 This is useful when gcc prints the error message installation
14462 problem, cannot exec cpp0: No such file or directory. To resolve
14463 this you either need to put cpp0 and the other compiler components
14464 where gcc expects to find them, or you can set the environment
14465 variable GCC_EXEC_PREFIX to the directory where you installed them.
14466 Don't forget the trailing /.
14467
14468 -print-sysroot
14469 Print the target sysroot directory that is used during compilation.
14470 This is the target sysroot specified either at configure time or
14471 using the --sysroot option, possibly with an extra suffix that
14472 depends on compilation options. If no target sysroot is specified,
14473 the option prints nothing.
14474
14475 -print-sysroot-headers-suffix
14476 Print the suffix added to the target sysroot when searching for
14477 headers, or give an error if the compiler is not configured with
14478 such a suffix---and don't do anything else.
14479
14480 -dumpmachine
14481 Print the compiler's target machine (for example,
14482 i686-pc-linux-gnu)---and don't do anything else.
14483
14484 -dumpversion
14485 Print the compiler version (for example, 3.0, 6.3.0 or 7)---and
14486 don't do anything else. This is the compiler version used in
14487 filesystem paths and specs. Depending on how the compiler has been
14488 configured it can be just a single number (major version), two
14489 numbers separated by a dot (major and minor version) or three
14490 numbers separated by dots (major, minor and patchlevel version).
14491
14492 -dumpfullversion
14493 Print the full compiler version---and don't do anything else. The
14494 output is always three numbers separated by dots, major, minor and
14495 patchlevel version.
14496
14497 -dumpspecs
14498 Print the compiler's built-in specs---and don't do anything else.
14499 (This is used when GCC itself is being built.)
14500
14501 Machine-Dependent Options
14502 Each target machine supported by GCC can have its own options---for
14503 example, to allow you to compile for a particular processor variant or
14504 ABI, or to control optimizations specific to that machine. By
14505 convention, the names of machine-specific options start with -m.
14506
14507 Some configurations of the compiler also support additional target-
14508 specific options, usually for compatibility with other compilers on the
14509 same platform.
14510
14511 AArch64 Options
14512 These options are defined for AArch64 implementations:
14513
14514 -mabi=name
14515 Generate code for the specified data model. Permissible values are
14516 ilp32 for SysV-like data model where int, long int and pointers are
14517 32 bits, and lp64 for SysV-like data model where int is 32 bits,
14518 but long int and pointers are 64 bits.
14519
14520 The default depends on the specific target configuration. Note
14521 that the LP64 and ILP32 ABIs are not link-compatible; you must
14522 compile your entire program with the same ABI, and link with a
14523 compatible set of libraries.
14524
14525 -mbig-endian
14526 Generate big-endian code. This is the default when GCC is
14527 configured for an aarch64_be-*-* target.
14528
14529 -mgeneral-regs-only
14530 Generate code which uses only the general-purpose registers. This
14531 will prevent the compiler from using floating-point and Advanced
14532 SIMD registers but will not impose any restrictions on the
14533 assembler.
14534
14535 -mlittle-endian
14536 Generate little-endian code. This is the default when GCC is
14537 configured for an aarch64-*-* but not an aarch64_be-*-* target.
14538
14539 -mcmodel=tiny
14540 Generate code for the tiny code model. The program and its
14541 statically defined symbols must be within 1MB of each other.
14542 Programs can be statically or dynamically linked.
14543
14544 -mcmodel=small
14545 Generate code for the small code model. The program and its
14546 statically defined symbols must be within 4GB of each other.
14547 Programs can be statically or dynamically linked. This is the
14548 default code model.
14549
14550 -mcmodel=large
14551 Generate code for the large code model. This makes no assumptions
14552 about addresses and sizes of sections. Programs can be statically
14553 linked only. The -mcmodel=large option is incompatible with
14554 -mabi=ilp32, -fpic and -fPIC.
14555
14556 -mstrict-align
14557 -mno-strict-align
14558 Avoid or allow generating memory accesses that may not be aligned
14559 on a natural object boundary as described in the architecture
14560 specification.
14561
14562 -momit-leaf-frame-pointer
14563 -mno-omit-leaf-frame-pointer
14564 Omit or keep the frame pointer in leaf functions. The former
14565 behavior is the default.
14566
14567 -mstack-protector-guard=guard
14568 -mstack-protector-guard-reg=reg
14569 -mstack-protector-guard-offset=offset
14570 Generate stack protection code using canary at guard. Supported
14571 locations are global for a global canary or sysreg for a canary in
14572 an appropriate system register.
14573
14574 With the latter choice the options -mstack-protector-guard-reg=reg
14575 and -mstack-protector-guard-offset=offset furthermore specify which
14576 system register to use as base register for reading the canary, and
14577 from what offset from that base register. There is no default
14578 register or offset as this is entirely for use within the Linux
14579 kernel.
14580
14581 -mstack-protector-guard=guard
14582 -mstack-protector-guard-reg=reg
14583 -mstack-protector-guard-offset=offset
14584 Generate stack protection code using canary at guard. Supported
14585 locations are global for a global canary or sysreg for a canary in
14586 an appropriate system register.
14587
14588 With the latter choice the options -mstack-protector-guard-reg=reg
14589 and -mstack-protector-guard-offset=offset furthermore specify which
14590 system register to use as base register for reading the canary, and
14591 from what offset from that base register. There is no default
14592 register or offset as this is entirely for use within the Linux
14593 kernel.
14594
14595 -mtls-dialect=desc
14596 Use TLS descriptors as the thread-local storage mechanism for
14597 dynamic accesses of TLS variables. This is the default.
14598
14599 -mtls-dialect=traditional
14600 Use traditional TLS as the thread-local storage mechanism for
14601 dynamic accesses of TLS variables.
14602
14603 -mtls-size=size
14604 Specify bit size of immediate TLS offsets. Valid values are 12,
14605 24, 32, 48. This option requires binutils 2.26 or newer.
14606
14607 -mfix-cortex-a53-835769
14608 -mno-fix-cortex-a53-835769
14609 Enable or disable the workaround for the ARM Cortex-A53 erratum
14610 number 835769. This involves inserting a NOP instruction between
14611 memory instructions and 64-bit integer multiply-accumulate
14612 instructions.
14613
14614 -mfix-cortex-a53-843419
14615 -mno-fix-cortex-a53-843419
14616 Enable or disable the workaround for the ARM Cortex-A53 erratum
14617 number 843419. This erratum workaround is made at link time and
14618 this will only pass the corresponding flag to the linker.
14619
14620 -mlow-precision-recip-sqrt
14621 -mno-low-precision-recip-sqrt
14622 Enable or disable the reciprocal square root approximation. This
14623 option only has an effect if -ffast-math or
14624 -funsafe-math-optimizations is used as well. Enabling this reduces
14625 precision of reciprocal square root results to about 16 bits for
14626 single precision and to 32 bits for double precision.
14627
14628 -mlow-precision-sqrt
14629 -mno-low-precision-sqrt
14630 Enable or disable the square root approximation. This option only
14631 has an effect if -ffast-math or -funsafe-math-optimizations is used
14632 as well. Enabling this reduces precision of square root results to
14633 about 16 bits for single precision and to 32 bits for double
14634 precision. If enabled, it implies -mlow-precision-recip-sqrt.
14635
14636 -mlow-precision-div
14637 -mno-low-precision-div
14638 Enable or disable the division approximation. This option only has
14639 an effect if -ffast-math or -funsafe-math-optimizations is used as
14640 well. Enabling this reduces precision of division results to about
14641 16 bits for single precision and to 32 bits for double precision.
14642
14643 -mtrack-speculation
14644 -mno-track-speculation
14645 Enable or disable generation of additional code to track
14646 speculative execution through conditional branches. The tracking
14647 state can then be used by the compiler when expanding calls to
14648 "__builtin_speculation_safe_copy" to permit a more efficient code
14649 sequence to be generated.
14650
14651 -moutline-atomics
14652 -mno-outline-atomics
14653 Enable or disable calls to out-of-line helpers to implement atomic
14654 operations. These helpers will, at runtime, determine if the LSE
14655 instructions from ARMv8.1-A can be used; if not, they will use the
14656 load/store-exclusive instructions that are present in the base
14657 ARMv8.0 ISA.
14658
14659 This option is only applicable when compiling for the base ARMv8.0
14660 instruction set. If using a later revision, e.g. -march=armv8.1-a
14661 or -march=armv8-a+lse, the ARMv8.1-Atomics instructions will be
14662 used directly. The same applies when using -mcpu= when the
14663 selected cpu supports the lse feature. This option is on by
14664 default.
14665
14666 -march=name
14667 Specify the name of the target architecture and, optionally, one or
14668 more feature modifiers. This option has the form
14669 -march=arch{+[no]feature}*.
14670
14671 The table below summarizes the permissible values for arch and the
14672 features that they enable by default:
14673
14674 arch value : Architecture : Includes by default
14675 armv8-a : Armv8-A : +fp, +simd
14676 armv8.1-a : Armv8.1-A : armv8-a, +crc, +lse, +rdma
14677 armv8.2-a : Armv8.2-A : armv8.1-a
14678 armv8.3-a : Armv8.3-A : armv8.2-a
14679 armv8.4-a : Armv8.4-A : armv8.3-a, +fp16fml, +dotprod
14680 armv8.5-a : Armv8.5-A : armv8.4-a, +sb, +ssbs, +predres
14681 armv8.6-a : Armv8.6-A : armv8.5-a, +bf16, +i8mm
14682
14683 The value native is available on native AArch64 GNU/Linux and
14684 causes the compiler to pick the architecture of the host system.
14685 This option has no effect if the compiler is unable to recognize
14686 the architecture of the host system,
14687
14688 The permissible values for feature are listed in the sub-section on
14689 aarch64-feature-modifiers,,-march and -mcpu Feature Modifiers.
14690 Where conflicting feature modifiers are specified, the right-most
14691 feature is used.
14692
14693 GCC uses name to determine what kind of instructions it can emit
14694 when generating assembly code. If -march is specified without
14695 either of -mtune or -mcpu also being specified, the code is tuned
14696 to perform well across a range of target processors implementing
14697 the target architecture.
14698
14699 -mtune=name
14700 Specify the name of the target processor for which GCC should tune
14701 the performance of the code. Permissible values for this option
14702 are: generic, cortex-a35, cortex-a53, cortex-a55, cortex-a57,
14703 cortex-a72, cortex-a73, cortex-a75, cortex-a76, cortex-a76ae,
14704 cortex-a77, cortex-a65, cortex-a65ae, cortex-a34, ares, exynos-m1,
14705 emag, falkor, neoverse-e1,neoverse-n1,qdf24xx, saphira, phecda,
14706 xgene1, vulcan, octeontx, octeontx81, octeontx83, octeontx2,
14707 octeontx2t98, octeontx2t96 octeontx2t93, octeontx2f95,
14708 octeontx2f95n, octeontx2f95mm thunderx, thunderxt88, thunderxt88p1,
14709 thunderxt81, tsv110, thunderxt83, thunderx2t99, thunderx3t110,
14710 cortex-a57.cortex-a53, cortex-a72.cortex-a53,
14711 cortex-a73.cortex-a35, cortex-a73.cortex-a53,
14712 cortex-a75.cortex-a55, cortex-a76.cortex-a55 native.
14713
14714 The values cortex-a57.cortex-a53, cortex-a72.cortex-a53,
14715 cortex-a73.cortex-a35, cortex-a73.cortex-a53,
14716 cortex-a75.cortex-a55, cortex-a76.cortex-a55 specify that GCC
14717 should tune for a big.LITTLE system.
14718
14719 Additionally on native AArch64 GNU/Linux systems the value native
14720 tunes performance to the host system. This option has no effect if
14721 the compiler is unable to recognize the processor of the host
14722 system.
14723
14724 Where none of -mtune=, -mcpu= or -march= are specified, the code is
14725 tuned to perform well across a range of target processors.
14726
14727 This option cannot be suffixed by feature modifiers.
14728
14729 -mcpu=name
14730 Specify the name of the target processor, optionally suffixed by
14731 one or more feature modifiers. This option has the form
14732 -mcpu=cpu{+[no]feature}*, where the permissible values for cpu are
14733 the same as those available for -mtune. The permissible values for
14734 feature are documented in the sub-section on
14735 aarch64-feature-modifiers,,-march and -mcpu Feature Modifiers.
14736 Where conflicting feature modifiers are specified, the right-most
14737 feature is used.
14738
14739 GCC uses name to determine what kind of instructions it can emit
14740 when generating assembly code (as if by -march) and to determine
14741 the target processor for which to tune for performance (as if by
14742 -mtune). Where this option is used in conjunction with -march or
14743 -mtune, those options take precedence over the appropriate part of
14744 this option.
14745
14746 -moverride=string
14747 Override tuning decisions made by the back-end in response to a
14748 -mtune= switch. The syntax, semantics, and accepted values for
14749 string in this option are not guaranteed to be consistent across
14750 releases.
14751
14752 This option is only intended to be useful when developing GCC.
14753
14754 -mverbose-cost-dump
14755 Enable verbose cost model dumping in the debug dump files. This
14756 option is provided for use in debugging the compiler.
14757
14758 -mpc-relative-literal-loads
14759 -mno-pc-relative-literal-loads
14760 Enable or disable PC-relative literal loads. With this option
14761 literal pools are accessed using a single instruction and emitted
14762 after each function. This limits the maximum size of functions to
14763 1MB. This is enabled by default for -mcmodel=tiny.
14764
14765 -msign-return-address=scope
14766 Select the function scope on which return address signing will be
14767 applied. Permissible values are none, which disables return
14768 address signing, non-leaf, which enables pointer signing for
14769 functions which are not leaf functions, and all, which enables
14770 pointer signing for all functions. The default value is none. This
14771 option has been deprecated by -mbranch-protection.
14772
14773 -mbranch-protection=none|standard|pac-ret[+leaf+b-key]|bti
14774 Select the branch protection features to use. none is the default
14775 and turns off all types of branch protection. standard turns on
14776 all types of branch protection features. If a feature has
14777 additional tuning options, then standard sets it to its standard
14778 level. pac-ret[+leaf] turns on return address signing to its
14779 standard level: signing functions that save the return address to
14780 memory (non-leaf functions will practically always do this) using
14781 the a-key. The optional argument leaf can be used to extend the
14782 signing to include leaf functions. The optional argument b-key can
14783 be used to sign the functions with the B-key instead of the A-key.
14784 bti turns on branch target identification mechanism.
14785
14786 -msve-vector-bits=bits
14787 Specify the number of bits in an SVE vector register. This option
14788 only has an effect when SVE is enabled.
14789
14790 GCC supports two forms of SVE code generation: "vector-length
14791 agnostic" output that works with any size of vector register and
14792 "vector-length specific" output that allows GCC to make assumptions
14793 about the vector length when it is useful for optimization reasons.
14794 The possible values of bits are: scalable, 128, 256, 512, 1024 and
14795 2048. Specifying scalable selects vector-length agnostic output.
14796 At present -msve-vector-bits=128 also generates vector-length
14797 agnostic output for big-endian targets. All other values generate
14798 vector-length specific code. The behavior of these values may
14799 change in future releases and no value except scalable should be
14800 relied on for producing code that is portable across different
14801 hardware SVE vector lengths.
14802
14803 The default is -msve-vector-bits=scalable, which produces vector-
14804 length agnostic code.
14805
14806 -march and -mcpu Feature Modifiers
14807
14808 Feature modifiers used with -march and -mcpu can be any of the
14809 following and their inverses nofeature:
14810
14811 crc Enable CRC extension. This is on by default for -march=armv8.1-a.
14812
14813 crypto
14814 Enable Crypto extension. This also enables Advanced SIMD and
14815 floating-point instructions.
14816
14817 fp Enable floating-point instructions. This is on by default for all
14818 possible values for options -march and -mcpu.
14819
14820 simd
14821 Enable Advanced SIMD instructions. This also enables floating-
14822 point instructions. This is on by default for all possible values
14823 for options -march and -mcpu.
14824
14825 sve Enable Scalable Vector Extension instructions. This also enables
14826 Advanced SIMD and floating-point instructions.
14827
14828 lse Enable Large System Extension instructions. This is on by default
14829 for -march=armv8.1-a.
14830
14831 rdma
14832 Enable Round Double Multiply Accumulate instructions. This is on
14833 by default for -march=armv8.1-a.
14834
14835 fp16
14836 Enable FP16 extension. This also enables floating-point
14837 instructions.
14838
14839 fp16fml
14840 Enable FP16 fmla extension. This also enables FP16 extensions and
14841 floating-point instructions. This option is enabled by default for
14842 -march=armv8.4-a. Use of this option with architectures prior to
14843 Armv8.2-A is not supported.
14844
14845 rcpc
14846 Enable the RcPc extension. This does not change code generation
14847 from GCC, but is passed on to the assembler, enabling inline asm
14848 statements to use instructions from the RcPc extension.
14849
14850 dotprod
14851 Enable the Dot Product extension. This also enables Advanced SIMD
14852 instructions.
14853
14854 aes Enable the Armv8-a aes and pmull crypto extension. This also
14855 enables Advanced SIMD instructions.
14856
14857 sha2
14858 Enable the Armv8-a sha2 crypto extension. This also enables
14859 Advanced SIMD instructions.
14860
14861 sha3
14862 Enable the sha512 and sha3 crypto extension. This also enables
14863 Advanced SIMD instructions. Use of this option with architectures
14864 prior to Armv8.2-A is not supported.
14865
14866 sm4 Enable the sm3 and sm4 crypto extension. This also enables
14867 Advanced SIMD instructions. Use of this option with architectures
14868 prior to Armv8.2-A is not supported.
14869
14870 profile
14871 Enable the Statistical Profiling extension. This option is only to
14872 enable the extension at the assembler level and does not affect
14873 code generation.
14874
14875 rng Enable the Armv8.5-a Random Number instructions. This option is
14876 only to enable the extension at the assembler level and does not
14877 affect code generation.
14878
14879 memtag
14880 Enable the Armv8.5-a Memory Tagging Extensions. Use of this option
14881 with architectures prior to Armv8.5-A is not supported.
14882
14883 sb Enable the Armv8-a Speculation Barrier instruction. This option is
14884 only to enable the extension at the assembler level and does not
14885 affect code generation. This option is enabled by default for
14886 -march=armv8.5-a.
14887
14888 ssbs
14889 Enable the Armv8-a Speculative Store Bypass Safe instruction. This
14890 option is only to enable the extension at the assembler level and
14891 does not affect code generation. This option is enabled by default
14892 for -march=armv8.5-a.
14893
14894 predres
14895 Enable the Armv8-a Execution and Data Prediction Restriction
14896 instructions. This option is only to enable the extension at the
14897 assembler level and does not affect code generation. This option
14898 is enabled by default for -march=armv8.5-a.
14899
14900 sve2
14901 Enable the Armv8-a Scalable Vector Extension 2. This also enables
14902 SVE instructions.
14903
14904 sve2-bitperm
14905 Enable SVE2 bitperm instructions. This also enables SVE2
14906 instructions.
14907
14908 sve2-sm4
14909 Enable SVE2 sm4 instructions. This also enables SVE2 instructions.
14910
14911 sve2-aes
14912 Enable SVE2 aes instructions. This also enables SVE2 instructions.
14913
14914 sve2-sha3
14915 Enable SVE2 sha3 instructions. This also enables SVE2
14916 instructions.
14917
14918 tme Enable the Transactional Memory Extension.
14919
14920 i8mm
14921 Enable 8-bit Integer Matrix Multiply instructions. This also
14922 enables Advanced SIMD and floating-point instructions. This option
14923 is enabled by default for -march=armv8.6-a. Use of this option
14924 with architectures prior to Armv8.2-A is not supported.
14925
14926 f32mm
14927 Enable 32-bit Floating point Matrix Multiply instructions. This
14928 also enables SVE instructions. Use of this option with
14929 architectures prior to Armv8.2-A is not supported.
14930
14931 f64mm
14932 Enable 64-bit Floating point Matrix Multiply instructions. This
14933 also enables SVE instructions. Use of this option with
14934 architectures prior to Armv8.2-A is not supported.
14935
14936 bf16
14937 Enable brain half-precision floating-point instructions. This also
14938 enables Advanced SIMD and floating-point instructions. This option
14939 is enabled by default for -march=armv8.6-a. Use of this option
14940 with architectures prior to Armv8.2-A is not supported.
14941
14942 Feature crypto implies aes, sha2, and simd, which implies fp.
14943 Conversely, nofp implies nosimd, which implies nocrypto, noaes and
14944 nosha2.
14945
14946 Adapteva Epiphany Options
14947 These -m options are defined for Adapteva Epiphany:
14948
14949 -mhalf-reg-file
14950 Don't allocate any register in the range "r32"..."r63". That
14951 allows code to run on hardware variants that lack these registers.
14952
14953 -mprefer-short-insn-regs
14954 Preferentially allocate registers that allow short instruction
14955 generation. This can result in increased instruction count, so
14956 this may either reduce or increase overall code size.
14957
14958 -mbranch-cost=num
14959 Set the cost of branches to roughly num "simple" instructions.
14960 This cost is only a heuristic and is not guaranteed to produce
14961 consistent results across releases.
14962
14963 -mcmove
14964 Enable the generation of conditional moves.
14965
14966 -mnops=num
14967 Emit num NOPs before every other generated instruction.
14968
14969 -mno-soft-cmpsf
14970 For single-precision floating-point comparisons, emit an "fsub"
14971 instruction and test the flags. This is faster than a software
14972 comparison, but can get incorrect results in the presence of NaNs,
14973 or when two different small numbers are compared such that their
14974 difference is calculated as zero. The default is -msoft-cmpsf,
14975 which uses slower, but IEEE-compliant, software comparisons.
14976
14977 -mstack-offset=num
14978 Set the offset between the top of the stack and the stack pointer.
14979 E.g., a value of 8 means that the eight bytes in the range
14980 "sp+0...sp+7" can be used by leaf functions without stack
14981 allocation. Values other than 8 or 16 are untested and unlikely to
14982 work. Note also that this option changes the ABI; compiling a
14983 program with a different stack offset than the libraries have been
14984 compiled with generally does not work. This option can be useful
14985 if you want to evaluate if a different stack offset would give you
14986 better code, but to actually use a different stack offset to build
14987 working programs, it is recommended to configure the toolchain with
14988 the appropriate --with-stack-offset=num option.
14989
14990 -mno-round-nearest
14991 Make the scheduler assume that the rounding mode has been set to
14992 truncating. The default is -mround-nearest.
14993
14994 -mlong-calls
14995 If not otherwise specified by an attribute, assume all calls might
14996 be beyond the offset range of the "b" / "bl" instructions, and
14997 therefore load the function address into a register before
14998 performing a (otherwise direct) call. This is the default.
14999
15000 -mshort-calls
15001 If not otherwise specified by an attribute, assume all direct calls
15002 are in the range of the "b" / "bl" instructions, so use these
15003 instructions for direct calls. The default is -mlong-calls.
15004
15005 -msmall16
15006 Assume addresses can be loaded as 16-bit unsigned values. This
15007 does not apply to function addresses for which -mlong-calls
15008 semantics are in effect.
15009
15010 -mfp-mode=mode
15011 Set the prevailing mode of the floating-point unit. This
15012 determines the floating-point mode that is provided and expected at
15013 function call and return time. Making this mode match the mode you
15014 predominantly need at function start can make your programs smaller
15015 and faster by avoiding unnecessary mode switches.
15016
15017 mode can be set to one the following values:
15018
15019 caller
15020 Any mode at function entry is valid, and retained or restored
15021 when the function returns, and when it calls other functions.
15022 This mode is useful for compiling libraries or other
15023 compilation units you might want to incorporate into different
15024 programs with different prevailing FPU modes, and the
15025 convenience of being able to use a single object file outweighs
15026 the size and speed overhead for any extra mode switching that
15027 might be needed, compared with what would be needed with a more
15028 specific choice of prevailing FPU mode.
15029
15030 truncate
15031 This is the mode used for floating-point calculations with
15032 truncating (i.e. round towards zero) rounding mode. That
15033 includes conversion from floating point to integer.
15034
15035 round-nearest
15036 This is the mode used for floating-point calculations with
15037 round-to-nearest-or-even rounding mode.
15038
15039 int This is the mode used to perform integer calculations in the
15040 FPU, e.g. integer multiply, or integer multiply-and-
15041 accumulate.
15042
15043 The default is -mfp-mode=caller
15044
15045 -mno-split-lohi
15046 -mno-postinc
15047 -mno-postmodify
15048 Code generation tweaks that disable, respectively, splitting of
15049 32-bit loads, generation of post-increment addresses, and
15050 generation of post-modify addresses. The defaults are msplit-lohi,
15051 -mpost-inc, and -mpost-modify.
15052
15053 -mnovect-double
15054 Change the preferred SIMD mode to SImode. The default is
15055 -mvect-double, which uses DImode as preferred SIMD mode.
15056
15057 -max-vect-align=num
15058 The maximum alignment for SIMD vector mode types. num may be 4 or
15059 8. The default is 8. Note that this is an ABI change, even though
15060 many library function interfaces are unaffected if they don't use
15061 SIMD vector modes in places that affect size and/or alignment of
15062 relevant types.
15063
15064 -msplit-vecmove-early
15065 Split vector moves into single word moves before reload. In theory
15066 this can give better register allocation, but so far the reverse
15067 seems to be generally the case.
15068
15069 -m1reg-reg
15070 Specify a register to hold the constant -1, which makes loading
15071 small negative constants and certain bitmasks faster. Allowable
15072 values for reg are r43 and r63, which specify use of that register
15073 as a fixed register, and none, which means that no register is used
15074 for this purpose. The default is -m1reg-none.
15075
15076 AMD GCN Options
15077 These options are defined specifically for the AMD GCN port.
15078
15079 -march=gpu
15080 -mtune=gpu
15081 Set architecture type or tuning for gpu. Supported values for gpu
15082 are
15083
15084 fiji
15085 Compile for GCN3 Fiji devices (gfx803).
15086
15087 gfx900
15088 Compile for GCN5 Vega 10 devices (gfx900).
15089
15090 gfx906
15091 Compile for GCN5 Vega 20 devices (gfx906).
15092
15093 -mstack-size=bytes
15094 Specify how many bytes of stack space will be requested for each
15095 GPU thread (wave-front). Beware that there may be many threads and
15096 limited memory available. The size of the stack allocation may
15097 also have an impact on run-time performance. The default is 32KB
15098 when using OpenACC or OpenMP, and 1MB otherwise.
15099
15100 ARC Options
15101 The following options control the architecture variant for which code
15102 is being compiled:
15103
15104 -mbarrel-shifter
15105 Generate instructions supported by barrel shifter. This is the
15106 default unless -mcpu=ARC601 or -mcpu=ARCEM is in effect.
15107
15108 -mjli-always
15109 Force to call a function using jli_s instruction. This option is
15110 valid only for ARCv2 architecture.
15111
15112 -mcpu=cpu
15113 Set architecture type, register usage, and instruction scheduling
15114 parameters for cpu. There are also shortcut alias options
15115 available for backward compatibility and convenience. Supported
15116 values for cpu are
15117
15118 arc600
15119 Compile for ARC600. Aliases: -mA6, -mARC600.
15120
15121 arc601
15122 Compile for ARC601. Alias: -mARC601.
15123
15124 arc700
15125 Compile for ARC700. Aliases: -mA7, -mARC700. This is the
15126 default when configured with --with-cpu=arc700.
15127
15128 arcem
15129 Compile for ARC EM.
15130
15131 archs
15132 Compile for ARC HS.
15133
15134 em Compile for ARC EM CPU with no hardware extensions.
15135
15136 em4 Compile for ARC EM4 CPU.
15137
15138 em4_dmips
15139 Compile for ARC EM4 DMIPS CPU.
15140
15141 em4_fpus
15142 Compile for ARC EM4 DMIPS CPU with the single-precision
15143 floating-point extension.
15144
15145 em4_fpuda
15146 Compile for ARC EM4 DMIPS CPU with single-precision floating-
15147 point and double assist instructions.
15148
15149 hs Compile for ARC HS CPU with no hardware extensions except the
15150 atomic instructions.
15151
15152 hs34
15153 Compile for ARC HS34 CPU.
15154
15155 hs38
15156 Compile for ARC HS38 CPU.
15157
15158 hs38_linux
15159 Compile for ARC HS38 CPU with all hardware extensions on.
15160
15161 arc600_norm
15162 Compile for ARC 600 CPU with "norm" instructions enabled.
15163
15164 arc600_mul32x16
15165 Compile for ARC 600 CPU with "norm" and 32x16-bit multiply
15166 instructions enabled.
15167
15168 arc600_mul64
15169 Compile for ARC 600 CPU with "norm" and "mul64"-family
15170 instructions enabled.
15171
15172 arc601_norm
15173 Compile for ARC 601 CPU with "norm" instructions enabled.
15174
15175 arc601_mul32x16
15176 Compile for ARC 601 CPU with "norm" and 32x16-bit multiply
15177 instructions enabled.
15178
15179 arc601_mul64
15180 Compile for ARC 601 CPU with "norm" and "mul64"-family
15181 instructions enabled.
15182
15183 nps400
15184 Compile for ARC 700 on NPS400 chip.
15185
15186 em_mini
15187 Compile for ARC EM minimalist configuration featuring reduced
15188 register set.
15189
15190 -mdpfp
15191 -mdpfp-compact
15192 Generate double-precision FPX instructions, tuned for the compact
15193 implementation.
15194
15195 -mdpfp-fast
15196 Generate double-precision FPX instructions, tuned for the fast
15197 implementation.
15198
15199 -mno-dpfp-lrsr
15200 Disable "lr" and "sr" instructions from using FPX extension aux
15201 registers.
15202
15203 -mea
15204 Generate extended arithmetic instructions. Currently only "divaw",
15205 "adds", "subs", and "sat16" are supported. Only valid for
15206 -mcpu=ARC700.
15207
15208 -mno-mpy
15209 Do not generate "mpy"-family instructions for ARC700. This option
15210 is deprecated.
15211
15212 -mmul32x16
15213 Generate 32x16-bit multiply and multiply-accumulate instructions.
15214
15215 -mmul64
15216 Generate "mul64" and "mulu64" instructions. Only valid for
15217 -mcpu=ARC600.
15218
15219 -mnorm
15220 Generate "norm" instructions. This is the default if -mcpu=ARC700
15221 is in effect.
15222
15223 -mspfp
15224 -mspfp-compact
15225 Generate single-precision FPX instructions, tuned for the compact
15226 implementation.
15227
15228 -mspfp-fast
15229 Generate single-precision FPX instructions, tuned for the fast
15230 implementation.
15231
15232 -msimd
15233 Enable generation of ARC SIMD instructions via target-specific
15234 builtins. Only valid for -mcpu=ARC700.
15235
15236 -msoft-float
15237 This option ignored; it is provided for compatibility purposes
15238 only. Software floating-point code is emitted by default, and this
15239 default can overridden by FPX options; -mspfp, -mspfp-compact, or
15240 -mspfp-fast for single precision, and -mdpfp, -mdpfp-compact, or
15241 -mdpfp-fast for double precision.
15242
15243 -mswap
15244 Generate "swap" instructions.
15245
15246 -matomic
15247 This enables use of the locked load/store conditional extension to
15248 implement atomic memory built-in functions. Not available for ARC
15249 6xx or ARC EM cores.
15250
15251 -mdiv-rem
15252 Enable "div" and "rem" instructions for ARCv2 cores.
15253
15254 -mcode-density
15255 Enable code density instructions for ARC EM. This option is on by
15256 default for ARC HS.
15257
15258 -mll64
15259 Enable double load/store operations for ARC HS cores.
15260
15261 -mtp-regno=regno
15262 Specify thread pointer register number.
15263
15264 -mmpy-option=multo
15265 Compile ARCv2 code with a multiplier design option. You can
15266 specify the option using either a string or numeric value for
15267 multo. wlh1 is the default value. The recognized values are:
15268
15269 0
15270 none
15271 No multiplier available.
15272
15273 1
15274 w 16x16 multiplier, fully pipelined. The following instructions
15275 are enabled: "mpyw" and "mpyuw".
15276
15277 2
15278 wlh1
15279 32x32 multiplier, fully pipelined (1 stage). The following
15280 instructions are additionally enabled: "mpy", "mpyu", "mpym",
15281 "mpymu", and "mpy_s".
15282
15283 3
15284 wlh2
15285 32x32 multiplier, fully pipelined (2 stages). The following
15286 instructions are additionally enabled: "mpy", "mpyu", "mpym",
15287 "mpymu", and "mpy_s".
15288
15289 4
15290 wlh3
15291 Two 16x16 multipliers, blocking, sequential. The following
15292 instructions are additionally enabled: "mpy", "mpyu", "mpym",
15293 "mpymu", and "mpy_s".
15294
15295 5
15296 wlh4
15297 One 16x16 multiplier, blocking, sequential. The following
15298 instructions are additionally enabled: "mpy", "mpyu", "mpym",
15299 "mpymu", and "mpy_s".
15300
15301 6
15302 wlh5
15303 One 32x4 multiplier, blocking, sequential. The following
15304 instructions are additionally enabled: "mpy", "mpyu", "mpym",
15305 "mpymu", and "mpy_s".
15306
15307 7
15308 plus_dmpy
15309 ARC HS SIMD support.
15310
15311 8
15312 plus_macd
15313 ARC HS SIMD support.
15314
15315 9
15316 plus_qmacw
15317 ARC HS SIMD support.
15318
15319 This option is only available for ARCv2 cores.
15320
15321 -mfpu=fpu
15322 Enables support for specific floating-point hardware extensions for
15323 ARCv2 cores. Supported values for fpu are:
15324
15325 fpus
15326 Enables support for single-precision floating-point hardware
15327 extensions.
15328
15329 fpud
15330 Enables support for double-precision floating-point hardware
15331 extensions. The single-precision floating-point extension is
15332 also enabled. Not available for ARC EM.
15333
15334 fpuda
15335 Enables support for double-precision floating-point hardware
15336 extensions using double-precision assist instructions. The
15337 single-precision floating-point extension is also enabled.
15338 This option is only available for ARC EM.
15339
15340 fpuda_div
15341 Enables support for double-precision floating-point hardware
15342 extensions using double-precision assist instructions. The
15343 single-precision floating-point, square-root, and divide
15344 extensions are also enabled. This option is only available for
15345 ARC EM.
15346
15347 fpuda_fma
15348 Enables support for double-precision floating-point hardware
15349 extensions using double-precision assist instructions. The
15350 single-precision floating-point and fused multiply and add
15351 hardware extensions are also enabled. This option is only
15352 available for ARC EM.
15353
15354 fpuda_all
15355 Enables support for double-precision floating-point hardware
15356 extensions using double-precision assist instructions. All
15357 single-precision floating-point hardware extensions are also
15358 enabled. This option is only available for ARC EM.
15359
15360 fpus_div
15361 Enables support for single-precision floating-point, square-
15362 root and divide hardware extensions.
15363
15364 fpud_div
15365 Enables support for double-precision floating-point, square-
15366 root and divide hardware extensions. This option includes
15367 option fpus_div. Not available for ARC EM.
15368
15369 fpus_fma
15370 Enables support for single-precision floating-point and fused
15371 multiply and add hardware extensions.
15372
15373 fpud_fma
15374 Enables support for double-precision floating-point and fused
15375 multiply and add hardware extensions. This option includes
15376 option fpus_fma. Not available for ARC EM.
15377
15378 fpus_all
15379 Enables support for all single-precision floating-point
15380 hardware extensions.
15381
15382 fpud_all
15383 Enables support for all single- and double-precision floating-
15384 point hardware extensions. Not available for ARC EM.
15385
15386 -mirq-ctrl-saved=register-range, blink, lp_count
15387 Specifies general-purposes registers that the processor
15388 automatically saves/restores on interrupt entry and exit.
15389 register-range is specified as two registers separated by a dash.
15390 The register range always starts with "r0", the upper limit is "fp"
15391 register. blink and lp_count are optional. This option is only
15392 valid for ARC EM and ARC HS cores.
15393
15394 -mrgf-banked-regs=number
15395 Specifies the number of registers replicated in second register
15396 bank on entry to fast interrupt. Fast interrupts are interrupts
15397 with the highest priority level P0. These interrupts save only PC
15398 and STATUS32 registers to avoid memory transactions during
15399 interrupt entry and exit sequences. Use this option when you are
15400 using fast interrupts in an ARC V2 family processor. Permitted
15401 values are 4, 8, 16, and 32.
15402
15403 -mlpc-width=width
15404 Specify the width of the "lp_count" register. Valid values for
15405 width are 8, 16, 20, 24, 28 and 32 bits. The default width is
15406 fixed to 32 bits. If the width is less than 32, the compiler does
15407 not attempt to transform loops in your program to use the zero-
15408 delay loop mechanism unless it is known that the "lp_count"
15409 register can hold the required loop-counter value. Depending on
15410 the width specified, the compiler and run-time library might
15411 continue to use the loop mechanism for various needs. This option
15412 defines macro "__ARC_LPC_WIDTH__" with the value of width.
15413
15414 -mrf16
15415 This option instructs the compiler to generate code for a 16-entry
15416 register file. This option defines the "__ARC_RF16__" preprocessor
15417 macro.
15418
15419 -mbranch-index
15420 Enable use of "bi" or "bih" instructions to implement jump tables.
15421
15422 The following options are passed through to the assembler, and also
15423 define preprocessor macro symbols.
15424
15425 -mdsp-packa
15426 Passed down to the assembler to enable the DSP Pack A extensions.
15427 Also sets the preprocessor symbol "__Xdsp_packa". This option is
15428 deprecated.
15429
15430 -mdvbf
15431 Passed down to the assembler to enable the dual Viterbi butterfly
15432 extension. Also sets the preprocessor symbol "__Xdvbf". This
15433 option is deprecated.
15434
15435 -mlock
15436 Passed down to the assembler to enable the locked load/store
15437 conditional extension. Also sets the preprocessor symbol
15438 "__Xlock".
15439
15440 -mmac-d16
15441 Passed down to the assembler. Also sets the preprocessor symbol
15442 "__Xxmac_d16". This option is deprecated.
15443
15444 -mmac-24
15445 Passed down to the assembler. Also sets the preprocessor symbol
15446 "__Xxmac_24". This option is deprecated.
15447
15448 -mrtsc
15449 Passed down to the assembler to enable the 64-bit time-stamp
15450 counter extension instruction. Also sets the preprocessor symbol
15451 "__Xrtsc". This option is deprecated.
15452
15453 -mswape
15454 Passed down to the assembler to enable the swap byte ordering
15455 extension instruction. Also sets the preprocessor symbol
15456 "__Xswape".
15457
15458 -mtelephony
15459 Passed down to the assembler to enable dual- and single-operand
15460 instructions for telephony. Also sets the preprocessor symbol
15461 "__Xtelephony". This option is deprecated.
15462
15463 -mxy
15464 Passed down to the assembler to enable the XY memory extension.
15465 Also sets the preprocessor symbol "__Xxy".
15466
15467 The following options control how the assembly code is annotated:
15468
15469 -misize
15470 Annotate assembler instructions with estimated addresses.
15471
15472 -mannotate-align
15473 Explain what alignment considerations lead to the decision to make
15474 an instruction short or long.
15475
15476 The following options are passed through to the linker:
15477
15478 -marclinux
15479 Passed through to the linker, to specify use of the "arclinux"
15480 emulation. This option is enabled by default in tool chains built
15481 for "arc-linux-uclibc" and "arceb-linux-uclibc" targets when
15482 profiling is not requested.
15483
15484 -marclinux_prof
15485 Passed through to the linker, to specify use of the "arclinux_prof"
15486 emulation. This option is enabled by default in tool chains built
15487 for "arc-linux-uclibc" and "arceb-linux-uclibc" targets when
15488 profiling is requested.
15489
15490 The following options control the semantics of generated code:
15491
15492 -mlong-calls
15493 Generate calls as register indirect calls, thus providing access to
15494 the full 32-bit address range.
15495
15496 -mmedium-calls
15497 Don't use less than 25-bit addressing range for calls, which is the
15498 offset available for an unconditional branch-and-link instruction.
15499 Conditional execution of function calls is suppressed, to allow use
15500 of the 25-bit range, rather than the 21-bit range with conditional
15501 branch-and-link. This is the default for tool chains built for
15502 "arc-linux-uclibc" and "arceb-linux-uclibc" targets.
15503
15504 -G num
15505 Put definitions of externally-visible data in a small data section
15506 if that data is no bigger than num bytes. The default value of num
15507 is 4 for any ARC configuration, or 8 when we have double load/store
15508 operations.
15509
15510 -mno-sdata
15511 Do not generate sdata references. This is the default for tool
15512 chains built for "arc-linux-uclibc" and "arceb-linux-uclibc"
15513 targets.
15514
15515 -mvolatile-cache
15516 Use ordinarily cached memory accesses for volatile references.
15517 This is the default.
15518
15519 -mno-volatile-cache
15520 Enable cache bypass for volatile references.
15521
15522 The following options fine tune code generation:
15523
15524 -malign-call
15525 Do alignment optimizations for call instructions.
15526
15527 -mauto-modify-reg
15528 Enable the use of pre/post modify with register displacement.
15529
15530 -mbbit-peephole
15531 Enable bbit peephole2.
15532
15533 -mno-brcc
15534 This option disables a target-specific pass in arc_reorg to
15535 generate compare-and-branch ("brcc") instructions. It has no
15536 effect on generation of these instructions driven by the combiner
15537 pass.
15538
15539 -mcase-vector-pcrel
15540 Use PC-relative switch case tables to enable case table shortening.
15541 This is the default for -Os.
15542
15543 -mcompact-casesi
15544 Enable compact "casesi" pattern. This is the default for -Os, and
15545 only available for ARCv1 cores. This option is deprecated.
15546
15547 -mno-cond-exec
15548 Disable the ARCompact-specific pass to generate conditional
15549 execution instructions.
15550
15551 Due to delay slot scheduling and interactions between operand
15552 numbers, literal sizes, instruction lengths, and the support for
15553 conditional execution, the target-independent pass to generate
15554 conditional execution is often lacking, so the ARC port has kept a
15555 special pass around that tries to find more conditional execution
15556 generation opportunities after register allocation, branch
15557 shortening, and delay slot scheduling have been done. This pass
15558 generally, but not always, improves performance and code size, at
15559 the cost of extra compilation time, which is why there is an option
15560 to switch it off. If you have a problem with call instructions
15561 exceeding their allowable offset range because they are
15562 conditionalized, you should consider using -mmedium-calls instead.
15563
15564 -mearly-cbranchsi
15565 Enable pre-reload use of the "cbranchsi" pattern.
15566
15567 -mexpand-adddi
15568 Expand "adddi3" and "subdi3" at RTL generation time into "add.f",
15569 "adc" etc. This option is deprecated.
15570
15571 -mindexed-loads
15572 Enable the use of indexed loads. This can be problematic because
15573 some optimizers then assume that indexed stores exist, which is not
15574 the case.
15575
15576 -mlra
15577 Enable Local Register Allocation. This is still experimental for
15578 ARC, so by default the compiler uses standard reload (i.e.
15579 -mno-lra).
15580
15581 -mlra-priority-none
15582 Don't indicate any priority for target registers.
15583
15584 -mlra-priority-compact
15585 Indicate target register priority for r0..r3 / r12..r15.
15586
15587 -mlra-priority-noncompact
15588 Reduce target register priority for r0..r3 / r12..r15.
15589
15590 -mmillicode
15591 When optimizing for size (using -Os), prologues and epilogues that
15592 have to save or restore a large number of registers are often
15593 shortened by using call to a special function in libgcc; this is
15594 referred to as a millicode call. As these calls can pose
15595 performance issues, and/or cause linking issues when linking in a
15596 nonstandard way, this option is provided to turn on or off
15597 millicode call generation.
15598
15599 -mcode-density-frame
15600 This option enable the compiler to emit "enter" and "leave"
15601 instructions. These instructions are only valid for CPUs with
15602 code-density feature.
15603
15604 -mmixed-code
15605 Tweak register allocation to help 16-bit instruction generation.
15606 This generally has the effect of decreasing the average instruction
15607 size while increasing the instruction count.
15608
15609 -mq-class
15610 Ths option is deprecated. Enable q instruction alternatives. This
15611 is the default for -Os.
15612
15613 -mRcq
15614 Enable Rcq constraint handling. Most short code generation depends
15615 on this. This is the default.
15616
15617 -mRcw
15618 Enable Rcw constraint handling. Most ccfsm condexec mostly depends
15619 on this. This is the default.
15620
15621 -msize-level=level
15622 Fine-tune size optimization with regards to instruction lengths and
15623 alignment. The recognized values for level are:
15624
15625 0 No size optimization. This level is deprecated and treated
15626 like 1.
15627
15628 1 Short instructions are used opportunistically.
15629
15630 2 In addition, alignment of loops and of code after barriers are
15631 dropped.
15632
15633 3 In addition, optional data alignment is dropped, and the option
15634 Os is enabled.
15635
15636 This defaults to 3 when -Os is in effect. Otherwise, the behavior
15637 when this is not set is equivalent to level 1.
15638
15639 -mtune=cpu
15640 Set instruction scheduling parameters for cpu, overriding any
15641 implied by -mcpu=.
15642
15643 Supported values for cpu are
15644
15645 ARC600
15646 Tune for ARC600 CPU.
15647
15648 ARC601
15649 Tune for ARC601 CPU.
15650
15651 ARC700
15652 Tune for ARC700 CPU with standard multiplier block.
15653
15654 ARC700-xmac
15655 Tune for ARC700 CPU with XMAC block.
15656
15657 ARC725D
15658 Tune for ARC725D CPU.
15659
15660 ARC750D
15661 Tune for ARC750D CPU.
15662
15663 -mmultcost=num
15664 Cost to assume for a multiply instruction, with 4 being equal to a
15665 normal instruction.
15666
15667 -munalign-prob-threshold=probability
15668 Set probability threshold for unaligning branches. When tuning for
15669 ARC700 and optimizing for speed, branches without filled delay slot
15670 are preferably emitted unaligned and long, unless profiling
15671 indicates that the probability for the branch to be taken is below
15672 probability. The default is (REG_BR_PROB_BASE/2), i.e. 5000.
15673
15674 The following options are maintained for backward compatibility, but
15675 are now deprecated and will be removed in a future release:
15676
15677 -margonaut
15678 Obsolete FPX.
15679
15680 -mbig-endian
15681 -EB Compile code for big-endian targets. Use of these options is now
15682 deprecated. Big-endian code is supported by configuring GCC to
15683 build "arceb-elf32" and "arceb-linux-uclibc" targets, for which big
15684 endian is the default.
15685
15686 -mlittle-endian
15687 -EL Compile code for little-endian targets. Use of these options is
15688 now deprecated. Little-endian code is supported by configuring GCC
15689 to build "arc-elf32" and "arc-linux-uclibc" targets, for which
15690 little endian is the default.
15691
15692 -mbarrel_shifter
15693 Replaced by -mbarrel-shifter.
15694
15695 -mdpfp_compact
15696 Replaced by -mdpfp-compact.
15697
15698 -mdpfp_fast
15699 Replaced by -mdpfp-fast.
15700
15701 -mdsp_packa
15702 Replaced by -mdsp-packa.
15703
15704 -mEA
15705 Replaced by -mea.
15706
15707 -mmac_24
15708 Replaced by -mmac-24.
15709
15710 -mmac_d16
15711 Replaced by -mmac-d16.
15712
15713 -mspfp_compact
15714 Replaced by -mspfp-compact.
15715
15716 -mspfp_fast
15717 Replaced by -mspfp-fast.
15718
15719 -mtune=cpu
15720 Values arc600, arc601, arc700 and arc700-xmac for cpu are replaced
15721 by ARC600, ARC601, ARC700 and ARC700-xmac respectively.
15722
15723 -multcost=num
15724 Replaced by -mmultcost.
15725
15726 ARM Options
15727 These -m options are defined for the ARM port:
15728
15729 -mabi=name
15730 Generate code for the specified ABI. Permissible values are: apcs-
15731 gnu, atpcs, aapcs, aapcs-linux and iwmmxt.
15732
15733 -mapcs-frame
15734 Generate a stack frame that is compliant with the ARM Procedure
15735 Call Standard for all functions, even if this is not strictly
15736 necessary for correct execution of the code. Specifying
15737 -fomit-frame-pointer with this option causes the stack frames not
15738 to be generated for leaf functions. The default is
15739 -mno-apcs-frame. This option is deprecated.
15740
15741 -mapcs
15742 This is a synonym for -mapcs-frame and is deprecated.
15743
15744 -mthumb-interwork
15745 Generate code that supports calling between the ARM and Thumb
15746 instruction sets. Without this option, on pre-v5 architectures,
15747 the two instruction sets cannot be reliably used inside one
15748 program. The default is -mno-thumb-interwork, since slightly
15749 larger code is generated when -mthumb-interwork is specified. In
15750 AAPCS configurations this option is meaningless.
15751
15752 -mno-sched-prolog
15753 Prevent the reordering of instructions in the function prologue, or
15754 the merging of those instruction with the instructions in the
15755 function's body. This means that all functions start with a
15756 recognizable set of instructions (or in fact one of a choice from a
15757 small set of different function prologues), and this information
15758 can be used to locate the start of functions inside an executable
15759 piece of code. The default is -msched-prolog.
15760
15761 -mfloat-abi=name
15762 Specifies which floating-point ABI to use. Permissible values are:
15763 soft, softfp and hard.
15764
15765 Specifying soft causes GCC to generate output containing library
15766 calls for floating-point operations. softfp allows the generation
15767 of code using hardware floating-point instructions, but still uses
15768 the soft-float calling conventions. hard allows generation of
15769 floating-point instructions and uses FPU-specific calling
15770 conventions.
15771
15772 The default depends on the specific target configuration. Note
15773 that the hard-float and soft-float ABIs are not link-compatible;
15774 you must compile your entire program with the same ABI, and link
15775 with a compatible set of libraries.
15776
15777 -mgeneral-regs-only
15778 Generate code which uses only the general-purpose registers. This
15779 will prevent the compiler from using floating-point and Advanced
15780 SIMD registers but will not impose any restrictions on the
15781 assembler.
15782
15783 -mlittle-endian
15784 Generate code for a processor running in little-endian mode. This
15785 is the default for all standard configurations.
15786
15787 -mbig-endian
15788 Generate code for a processor running in big-endian mode; the
15789 default is to compile code for a little-endian processor.
15790
15791 -mbe8
15792 -mbe32
15793 When linking a big-endian image select between BE8 and BE32
15794 formats. The option has no effect for little-endian images and is
15795 ignored. The default is dependent on the selected target
15796 architecture. For ARMv6 and later architectures the default is
15797 BE8, for older architectures the default is BE32. BE32 format has
15798 been deprecated by ARM.
15799
15800 -march=name[+extension...]
15801 This specifies the name of the target ARM architecture. GCC uses
15802 this name to determine what kind of instructions it can emit when
15803 generating assembly code. This option can be used in conjunction
15804 with or instead of the -mcpu= option.
15805
15806 Permissible names are: armv4t, armv5t, armv5te, armv6, armv6j,
15807 armv6k, armv6kz, armv6t2, armv6z, armv6zk, armv7, armv7-a, armv7ve,
15808 armv8-a, armv8.1-a, armv8.2-a, armv8.3-a, armv8.4-a, armv8.5-a,
15809 armv8.6-a, armv7-r, armv8-r, armv6-m, armv6s-m, armv7-m, armv7e-m,
15810 armv8-m.base, armv8-m.main, armv8.1-m.main, iwmmxt and iwmmxt2.
15811
15812 Additionally, the following architectures, which lack support for
15813 the Thumb execution state, are recognized but support is
15814 deprecated: armv4.
15815
15816 Many of the architectures support extensions. These can be added
15817 by appending +extension to the architecture name. Extension
15818 options are processed in order and capabilities accumulate. An
15819 extension will also enable any necessary base extensions upon which
15820 it depends. For example, the +crypto extension will always enable
15821 the +simd extension. The exception to the additive construction is
15822 for extensions that are prefixed with +no...: these extensions
15823 disable the specified option and any other extensions that may
15824 depend on the presence of that extension.
15825
15826 For example, -march=armv7-a+simd+nofp+vfpv4 is equivalent to
15827 writing -march=armv7-a+vfpv4 since the +simd option is entirely
15828 disabled by the +nofp option that follows it.
15829
15830 Most extension names are generically named, but have an effect that
15831 is dependent upon the architecture to which it is applied. For
15832 example, the +simd option can be applied to both armv7-a and
15833 armv8-a architectures, but will enable the original ARMv7-A
15834 Advanced SIMD (Neon) extensions for armv7-a and the ARMv8-A variant
15835 for armv8-a.
15836
15837 The table below lists the supported extensions for each
15838 architecture. Architectures not mentioned do not support any
15839 extensions.
15840
15841 armv5te
15842 armv6
15843 armv6j
15844 armv6k
15845 armv6kz
15846 armv6t2
15847 armv6z
15848 armv6zk
15849 +fp The VFPv2 floating-point instructions. The extension
15850 +vfpv2 can be used as an alias for this extension.
15851
15852 +nofp
15853 Disable the floating-point instructions.
15854
15855 armv7
15856 The common subset of the ARMv7-A, ARMv7-R and ARMv7-M
15857 architectures.
15858
15859 +fp The VFPv3 floating-point instructions, with 16 double-
15860 precision registers. The extension +vfpv3-d16 can be used
15861 as an alias for this extension. Note that floating-point
15862 is not supported by the base ARMv7-M architecture, but is
15863 compatible with both the ARMv7-A and ARMv7-R architectures.
15864
15865 +nofp
15866 Disable the floating-point instructions.
15867
15868 armv7-a
15869 +mp The multiprocessing extension.
15870
15871 +sec
15872 The security extension.
15873
15874 +fp The VFPv3 floating-point instructions, with 16 double-
15875 precision registers. The extension +vfpv3-d16 can be used
15876 as an alias for this extension.
15877
15878 +simd
15879 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point
15880 instructions. The extensions +neon and +neon-vfpv3 can be
15881 used as aliases for this extension.
15882
15883 +vfpv3
15884 The VFPv3 floating-point instructions, with 32 double-
15885 precision registers.
15886
15887 +vfpv3-d16-fp16
15888 The VFPv3 floating-point instructions, with 16 double-
15889 precision registers and the half-precision floating-point
15890 conversion operations.
15891
15892 +vfpv3-fp16
15893 The VFPv3 floating-point instructions, with 32 double-
15894 precision registers and the half-precision floating-point
15895 conversion operations.
15896
15897 +vfpv4-d16
15898 The VFPv4 floating-point instructions, with 16 double-
15899 precision registers.
15900
15901 +vfpv4
15902 The VFPv4 floating-point instructions, with 32 double-
15903 precision registers.
15904
15905 +neon-fp16
15906 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point
15907 instructions, with the half-precision floating-point
15908 conversion operations.
15909
15910 +neon-vfpv4
15911 The Advanced SIMD (Neon) v2 and the VFPv4 floating-point
15912 instructions.
15913
15914 +nosimd
15915 Disable the Advanced SIMD instructions (does not disable
15916 floating point).
15917
15918 +nofp
15919 Disable the floating-point and Advanced SIMD instructions.
15920
15921 armv7ve
15922 The extended version of the ARMv7-A architecture with support
15923 for virtualization.
15924
15925 +fp The VFPv4 floating-point instructions, with 16 double-
15926 precision registers. The extension +vfpv4-d16 can be used
15927 as an alias for this extension.
15928
15929 +simd
15930 The Advanced SIMD (Neon) v2 and the VFPv4 floating-point
15931 instructions. The extension +neon-vfpv4 can be used as an
15932 alias for this extension.
15933
15934 +vfpv3-d16
15935 The VFPv3 floating-point instructions, with 16 double-
15936 precision registers.
15937
15938 +vfpv3
15939 The VFPv3 floating-point instructions, with 32 double-
15940 precision registers.
15941
15942 +vfpv3-d16-fp16
15943 The VFPv3 floating-point instructions, with 16 double-
15944 precision registers and the half-precision floating-point
15945 conversion operations.
15946
15947 +vfpv3-fp16
15948 The VFPv3 floating-point instructions, with 32 double-
15949 precision registers and the half-precision floating-point
15950 conversion operations.
15951
15952 +vfpv4-d16
15953 The VFPv4 floating-point instructions, with 16 double-
15954 precision registers.
15955
15956 +vfpv4
15957 The VFPv4 floating-point instructions, with 32 double-
15958 precision registers.
15959
15960 +neon
15961 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point
15962 instructions. The extension +neon-vfpv3 can be used as an
15963 alias for this extension.
15964
15965 +neon-fp16
15966 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point
15967 instructions, with the half-precision floating-point
15968 conversion operations.
15969
15970 +nosimd
15971 Disable the Advanced SIMD instructions (does not disable
15972 floating point).
15973
15974 +nofp
15975 Disable the floating-point and Advanced SIMD instructions.
15976
15977 armv8-a
15978 +crc
15979 The Cyclic Redundancy Check (CRC) instructions.
15980
15981 +simd
15982 The ARMv8-A Advanced SIMD and floating-point instructions.
15983
15984 +crypto
15985 The cryptographic instructions.
15986
15987 +nocrypto
15988 Disable the cryptographic instructions.
15989
15990 +nofp
15991 Disable the floating-point, Advanced SIMD and cryptographic
15992 instructions.
15993
15994 +sb Speculation Barrier Instruction.
15995
15996 +predres
15997 Execution and Data Prediction Restriction Instructions.
15998
15999 armv8.1-a
16000 +simd
16001 The ARMv8.1-A Advanced SIMD and floating-point
16002 instructions.
16003
16004 +crypto
16005 The cryptographic instructions. This also enables the
16006 Advanced SIMD and floating-point instructions.
16007
16008 +nocrypto
16009 Disable the cryptographic instructions.
16010
16011 +nofp
16012 Disable the floating-point, Advanced SIMD and cryptographic
16013 instructions.
16014
16015 +sb Speculation Barrier Instruction.
16016
16017 +predres
16018 Execution and Data Prediction Restriction Instructions.
16019
16020 armv8.2-a
16021 armv8.3-a
16022 +fp16
16023 The half-precision floating-point data processing
16024 instructions. This also enables the Advanced SIMD and
16025 floating-point instructions.
16026
16027 +fp16fml
16028 The half-precision floating-point fmla extension. This
16029 also enables the half-precision floating-point extension
16030 and Advanced SIMD and floating-point instructions.
16031
16032 +simd
16033 The ARMv8.1-A Advanced SIMD and floating-point
16034 instructions.
16035
16036 +crypto
16037 The cryptographic instructions. This also enables the
16038 Advanced SIMD and floating-point instructions.
16039
16040 +dotprod
16041 Enable the Dot Product extension. This also enables
16042 Advanced SIMD instructions.
16043
16044 +nocrypto
16045 Disable the cryptographic extension.
16046
16047 +nofp
16048 Disable the floating-point, Advanced SIMD and cryptographic
16049 instructions.
16050
16051 +sb Speculation Barrier Instruction.
16052
16053 +predres
16054 Execution and Data Prediction Restriction Instructions.
16055
16056 +i8mm
16057 8-bit Integer Matrix Multiply instructions. This also
16058 enables Advanced SIMD and floating-point instructions.
16059
16060 +bf16
16061 Brain half-precision floating-point instructions. This
16062 also enables Advanced SIMD and floating-point instructions.
16063
16064 armv8.4-a
16065 +fp16
16066 The half-precision floating-point data processing
16067 instructions. This also enables the Advanced SIMD and
16068 floating-point instructions as well as the Dot Product
16069 extension and the half-precision floating-point fmla
16070 extension.
16071
16072 +simd
16073 The ARMv8.3-A Advanced SIMD and floating-point instructions
16074 as well as the Dot Product extension.
16075
16076 +crypto
16077 The cryptographic instructions. This also enables the
16078 Advanced SIMD and floating-point instructions as well as
16079 the Dot Product extension.
16080
16081 +nocrypto
16082 Disable the cryptographic extension.
16083
16084 +nofp
16085 Disable the floating-point, Advanced SIMD and cryptographic
16086 instructions.
16087
16088 +sb Speculation Barrier Instruction.
16089
16090 +predres
16091 Execution and Data Prediction Restriction Instructions.
16092
16093 +i8mm
16094 8-bit Integer Matrix Multiply instructions. This also
16095 enables Advanced SIMD and floating-point instructions.
16096
16097 +bf16
16098 Brain half-precision floating-point instructions. This
16099 also enables Advanced SIMD and floating-point instructions.
16100
16101 armv8.5-a
16102 +fp16
16103 The half-precision floating-point data processing
16104 instructions. This also enables the Advanced SIMD and
16105 floating-point instructions as well as the Dot Product
16106 extension and the half-precision floating-point fmla
16107 extension.
16108
16109 +simd
16110 The ARMv8.3-A Advanced SIMD and floating-point instructions
16111 as well as the Dot Product extension.
16112
16113 +crypto
16114 The cryptographic instructions. This also enables the
16115 Advanced SIMD and floating-point instructions as well as
16116 the Dot Product extension.
16117
16118 +nocrypto
16119 Disable the cryptographic extension.
16120
16121 +nofp
16122 Disable the floating-point, Advanced SIMD and cryptographic
16123 instructions.
16124
16125 +i8mm
16126 8-bit Integer Matrix Multiply instructions. This also
16127 enables Advanced SIMD and floating-point instructions.
16128
16129 +bf16
16130 Brain half-precision floating-point instructions. This
16131 also enables Advanced SIMD and floating-point instructions.
16132
16133 armv8.6-a
16134 +fp16
16135 The half-precision floating-point data processing
16136 instructions. This also enables the Advanced SIMD and
16137 floating-point instructions as well as the Dot Product
16138 extension and the half-precision floating-point fmla
16139 extension.
16140
16141 +simd
16142 The ARMv8.3-A Advanced SIMD and floating-point instructions
16143 as well as the Dot Product extension.
16144
16145 +crypto
16146 The cryptographic instructions. This also enables the
16147 Advanced SIMD and floating-point instructions as well as
16148 the Dot Product extension.
16149
16150 +nocrypto
16151 Disable the cryptographic extension.
16152
16153 +nofp
16154 Disable the floating-point, Advanced SIMD and cryptographic
16155 instructions.
16156
16157 +i8mm
16158 8-bit Integer Matrix Multiply instructions. This also
16159 enables Advanced SIMD and floating-point instructions.
16160
16161 +bf16
16162 Brain half-precision floating-point instructions. This
16163 also enables Advanced SIMD and floating-point instructions.
16164
16165 armv7-r
16166 +fp.sp
16167 The single-precision VFPv3 floating-point instructions.
16168 The extension +vfpv3xd can be used as an alias for this
16169 extension.
16170
16171 +fp The VFPv3 floating-point instructions with 16 double-
16172 precision registers. The extension +vfpv3-d16 can be used
16173 as an alias for this extension.
16174
16175 +vfpv3xd-d16-fp16
16176 The single-precision VFPv3 floating-point instructions with
16177 16 double-precision registers and the half-precision
16178 floating-point conversion operations.
16179
16180 +vfpv3-d16-fp16
16181 The VFPv3 floating-point instructions with 16 double-
16182 precision registers and the half-precision floating-point
16183 conversion operations.
16184
16185 +nofp
16186 Disable the floating-point extension.
16187
16188 +idiv
16189 The ARM-state integer division instructions.
16190
16191 +noidiv
16192 Disable the ARM-state integer division extension.
16193
16194 armv7e-m
16195 +fp The single-precision VFPv4 floating-point instructions.
16196
16197 +fpv5
16198 The single-precision FPv5 floating-point instructions.
16199
16200 +fp.dp
16201 The single- and double-precision FPv5 floating-point
16202 instructions.
16203
16204 +nofp
16205 Disable the floating-point extensions.
16206
16207 armv8.1-m.main
16208 +dsp
16209 The DSP instructions.
16210
16211 +mve
16212 The M-Profile Vector Extension (MVE) integer instructions.
16213
16214 +mve.fp
16215 The M-Profile Vector Extension (MVE) integer and single
16216 precision floating-point instructions.
16217
16218 +fp The single-precision floating-point instructions.
16219
16220 +fp.dp
16221 The single- and double-precision floating-point
16222 instructions.
16223
16224 +nofp
16225 Disable the floating-point extension.
16226
16227 +cdecp0, +cdecp1, ... , +cdecp7
16228 Enable the Custom Datapath Extension (CDE) on selected
16229 coprocessors according to the numbers given in the options
16230 in the range 0 to 7.
16231
16232 armv8-m.main
16233 +dsp
16234 The DSP instructions.
16235
16236 +nodsp
16237 Disable the DSP extension.
16238
16239 +fp The single-precision floating-point instructions.
16240
16241 +fp.dp
16242 The single- and double-precision floating-point
16243 instructions.
16244
16245 +nofp
16246 Disable the floating-point extension.
16247
16248 +cdecp0, +cdecp1, ... , +cdecp7
16249 Enable the Custom Datapath Extension (CDE) on selected
16250 coprocessors according to the numbers given in the options
16251 in the range 0 to 7.
16252
16253 armv8-r
16254 +crc
16255 The Cyclic Redundancy Check (CRC) instructions.
16256
16257 +fp.sp
16258 The single-precision FPv5 floating-point instructions.
16259
16260 +simd
16261 The ARMv8-A Advanced SIMD and floating-point instructions.
16262
16263 +crypto
16264 The cryptographic instructions.
16265
16266 +nocrypto
16267 Disable the cryptographic instructions.
16268
16269 +nofp
16270 Disable the floating-point, Advanced SIMD and cryptographic
16271 instructions.
16272
16273 -march=native causes the compiler to auto-detect the architecture
16274 of the build computer. At present, this feature is only supported
16275 on GNU/Linux, and not all architectures are recognized. If the
16276 auto-detect is unsuccessful the option has no effect.
16277
16278 -mtune=name
16279 This option specifies the name of the target ARM processor for
16280 which GCC should tune the performance of the code. For some ARM
16281 implementations better performance can be obtained by using this
16282 option. Permissible names are: arm7tdmi, arm7tdmi-s, arm710t,
16283 arm720t, arm740t, strongarm, strongarm110, strongarm1100,
16284 0strongarm1110, arm8, arm810, arm9, arm9e, arm920, arm920t,
16285 arm922t, arm946e-s, arm966e-s, arm968e-s, arm926ej-s, arm940t,
16286 arm9tdmi, arm10tdmi, arm1020t, arm1026ej-s, arm10e, arm1020e,
16287 arm1022e, arm1136j-s, arm1136jf-s, mpcore, mpcorenovfp,
16288 arm1156t2-s, arm1156t2f-s, arm1176jz-s, arm1176jzf-s,
16289 generic-armv7-a, cortex-a5, cortex-a7, cortex-a8, cortex-a9,
16290 cortex-a12, cortex-a15, cortex-a17, cortex-a32, cortex-a35,
16291 cortex-a53, cortex-a55, cortex-a57, cortex-a72, cortex-a73,
16292 cortex-a75, cortex-a76, cortex-a76ae, cortex-a77, ares, cortex-r4,
16293 cortex-r4f, cortex-r5, cortex-r7, cortex-r8, cortex-r52, cortex-m0,
16294 cortex-m0plus, cortex-m1, cortex-m3, cortex-m4, cortex-m7,
16295 cortex-m23, cortex-m33, cortex-m35p, cortex-m55,
16296 cortex-m1.small-multiply, cortex-m0.small-multiply,
16297 cortex-m0plus.small-multiply, exynos-m1, marvell-pj4, neoverse-n1,
16298 xscale, iwmmxt, iwmmxt2, ep9312, fa526, fa626, fa606te, fa626te,
16299 fmp626, fa726te, xgene1.
16300
16301 Additionally, this option can specify that GCC should tune the
16302 performance of the code for a big.LITTLE system. Permissible names
16303 are: cortex-a15.cortex-a7, cortex-a17.cortex-a7,
16304 cortex-a57.cortex-a53, cortex-a72.cortex-a53,
16305 cortex-a72.cortex-a35, cortex-a73.cortex-a53,
16306 cortex-a75.cortex-a55, cortex-a76.cortex-a55.
16307
16308 -mtune=generic-arch specifies that GCC should tune the performance
16309 for a blend of processors within architecture arch. The aim is to
16310 generate code that run well on the current most popular processors,
16311 balancing between optimizations that benefit some CPUs in the
16312 range, and avoiding performance pitfalls of other CPUs. The
16313 effects of this option may change in future GCC versions as CPU
16314 models come and go.
16315
16316 -mtune permits the same extension options as -mcpu, but the
16317 extension options do not affect the tuning of the generated code.
16318
16319 -mtune=native causes the compiler to auto-detect the CPU of the
16320 build computer. At present, this feature is only supported on
16321 GNU/Linux, and not all architectures are recognized. If the auto-
16322 detect is unsuccessful the option has no effect.
16323
16324 -mcpu=name[+extension...]
16325 This specifies the name of the target ARM processor. GCC uses this
16326 name to derive the name of the target ARM architecture (as if
16327 specified by -march) and the ARM processor type for which to tune
16328 for performance (as if specified by -mtune). Where this option is
16329 used in conjunction with -march or -mtune, those options take
16330 precedence over the appropriate part of this option.
16331
16332 Many of the supported CPUs implement optional architectural
16333 extensions. Where this is so the architectural extensions are
16334 normally enabled by default. If implementations that lack the
16335 extension exist, then the extension syntax can be used to disable
16336 those extensions that have been omitted. For floating-point and
16337 Advanced SIMD (Neon) instructions, the settings of the options
16338 -mfloat-abi and -mfpu must also be considered: floating-point and
16339 Advanced SIMD instructions will only be used if -mfloat-abi is not
16340 set to soft; and any setting of -mfpu other than auto will override
16341 the available floating-point and SIMD extension instructions.
16342
16343 For example, cortex-a9 can be found in three major configurations:
16344 integer only, with just a floating-point unit or with floating-
16345 point and Advanced SIMD. The default is to enable all the
16346 instructions, but the extensions +nosimd and +nofp can be used to
16347 disable just the SIMD or both the SIMD and floating-point
16348 instructions respectively.
16349
16350 Permissible names for this option are the same as those for -mtune.
16351
16352 The following extension options are common to the listed CPUs:
16353
16354 +nodsp
16355 Disable the DSP instructions on cortex-m33, cortex-m35p.
16356
16357 +nofp
16358 Disables the floating-point instructions on arm9e, arm946e-s,
16359 arm966e-s, arm968e-s, arm10e, arm1020e, arm1022e, arm926ej-s,
16360 arm1026ej-s, cortex-r5, cortex-r7, cortex-r8, cortex-m4,
16361 cortex-m7, cortex-m33 and cortex-m35p. Disables the floating-
16362 point and SIMD instructions on generic-armv7-a, cortex-a5,
16363 cortex-a7, cortex-a8, cortex-a9, cortex-a12, cortex-a15,
16364 cortex-a17, cortex-a15.cortex-a7, cortex-a17.cortex-a7,
16365 cortex-a32, cortex-a35, cortex-a53 and cortex-a55.
16366
16367 +nofp.dp
16368 Disables the double-precision component of the floating-point
16369 instructions on cortex-r5, cortex-r7, cortex-r8, cortex-r52 and
16370 cortex-m7.
16371
16372 +nosimd
16373 Disables the SIMD (but not floating-point) instructions on
16374 generic-armv7-a, cortex-a5, cortex-a7 and cortex-a9.
16375
16376 +crypto
16377 Enables the cryptographic instructions on cortex-a32,
16378 cortex-a35, cortex-a53, cortex-a55, cortex-a57, cortex-a72,
16379 cortex-a73, cortex-a75, exynos-m1, xgene1,
16380 cortex-a57.cortex-a53, cortex-a72.cortex-a53,
16381 cortex-a73.cortex-a35, cortex-a73.cortex-a53 and
16382 cortex-a75.cortex-a55.
16383
16384 Additionally the generic-armv7-a pseudo target defaults to VFPv3
16385 with 16 double-precision registers. It supports the following
16386 extension options: mp, sec, vfpv3-d16, vfpv3, vfpv3-d16-fp16,
16387 vfpv3-fp16, vfpv4-d16, vfpv4, neon, neon-vfpv3, neon-fp16,
16388 neon-vfpv4. The meanings are the same as for the extensions to
16389 -march=armv7-a.
16390
16391 -mcpu=generic-arch is also permissible, and is equivalent to
16392 -march=arch -mtune=generic-arch. See -mtune for more information.
16393
16394 -mcpu=native causes the compiler to auto-detect the CPU of the
16395 build computer. At present, this feature is only supported on
16396 GNU/Linux, and not all architectures are recognized. If the auto-
16397 detect is unsuccessful the option has no effect.
16398
16399 -mfpu=name
16400 This specifies what floating-point hardware (or hardware emulation)
16401 is available on the target. Permissible names are: auto, vfpv2,
16402 vfpv3, vfpv3-fp16, vfpv3-d16, vfpv3-d16-fp16, vfpv3xd,
16403 vfpv3xd-fp16, neon-vfpv3, neon-fp16, vfpv4, vfpv4-d16, fpv4-sp-d16,
16404 neon-vfpv4, fpv5-d16, fpv5-sp-d16, fp-armv8, neon-fp-armv8 and
16405 crypto-neon-fp-armv8. Note that neon is an alias for neon-vfpv3
16406 and vfp is an alias for vfpv2.
16407
16408 The setting auto is the default and is special. It causes the
16409 compiler to select the floating-point and Advanced SIMD
16410 instructions based on the settings of -mcpu and -march.
16411
16412 If the selected floating-point hardware includes the NEON extension
16413 (e.g. -mfpu=neon), note that floating-point operations are not
16414 generated by GCC's auto-vectorization pass unless
16415 -funsafe-math-optimizations is also specified. This is because
16416 NEON hardware does not fully implement the IEEE 754 standard for
16417 floating-point arithmetic (in particular denormal values are
16418 treated as zero), so the use of NEON instructions may lead to a
16419 loss of precision.
16420
16421 You can also set the fpu name at function level by using the
16422 "target("fpu=")" function attributes or pragmas.
16423
16424 -mfp16-format=name
16425 Specify the format of the "__fp16" half-precision floating-point
16426 type. Permissible names are none, ieee, and alternative; the
16427 default is none, in which case the "__fp16" type is not defined.
16428
16429 -mstructure-size-boundary=n
16430 The sizes of all structures and unions are rounded up to a multiple
16431 of the number of bits set by this option. Permissible values are
16432 8, 32 and 64. The default value varies for different toolchains.
16433 For the COFF targeted toolchain the default value is 8. A value of
16434 64 is only allowed if the underlying ABI supports it.
16435
16436 Specifying a larger number can produce faster, more efficient code,
16437 but can also increase the size of the program. Different values
16438 are potentially incompatible. Code compiled with one value cannot
16439 necessarily expect to work with code or libraries compiled with
16440 another value, if they exchange information using structures or
16441 unions.
16442
16443 This option is deprecated.
16444
16445 -mabort-on-noreturn
16446 Generate a call to the function "abort" at the end of a "noreturn"
16447 function. It is executed if the function tries to return.
16448
16449 -mlong-calls
16450 -mno-long-calls
16451 Tells the compiler to perform function calls by first loading the
16452 address of the function into a register and then performing a
16453 subroutine call on this register. This switch is needed if the
16454 target function lies outside of the 64-megabyte addressing range of
16455 the offset-based version of subroutine call instruction.
16456
16457 Even if this switch is enabled, not all function calls are turned
16458 into long calls. The heuristic is that static functions, functions
16459 that have the "short_call" attribute, functions that are inside the
16460 scope of a "#pragma no_long_calls" directive, and functions whose
16461 definitions have already been compiled within the current
16462 compilation unit are not turned into long calls. The exceptions to
16463 this rule are that weak function definitions, functions with the
16464 "long_call" attribute or the "section" attribute, and functions
16465 that are within the scope of a "#pragma long_calls" directive are
16466 always turned into long calls.
16467
16468 This feature is not enabled by default. Specifying -mno-long-calls
16469 restores the default behavior, as does placing the function calls
16470 within the scope of a "#pragma long_calls_off" directive. Note
16471 these switches have no effect on how the compiler generates code to
16472 handle function calls via function pointers.
16473
16474 -msingle-pic-base
16475 Treat the register used for PIC addressing as read-only, rather
16476 than loading it in the prologue for each function. The runtime
16477 system is responsible for initializing this register with an
16478 appropriate value before execution begins.
16479
16480 -mpic-register=reg
16481 Specify the register to be used for PIC addressing. For standard
16482 PIC base case, the default is any suitable register determined by
16483 compiler. For single PIC base case, the default is R9 if target is
16484 EABI based or stack-checking is enabled, otherwise the default is
16485 R10.
16486
16487 -mpic-data-is-text-relative
16488 Assume that the displacement between the text and data segments is
16489 fixed at static link time. This permits using PC-relative
16490 addressing operations to access data known to be in the data
16491 segment. For non-VxWorks RTP targets, this option is enabled by
16492 default. When disabled on such targets, it will enable
16493 -msingle-pic-base by default.
16494
16495 -mpoke-function-name
16496 Write the name of each function into the text section, directly
16497 preceding the function prologue. The generated code is similar to
16498 this:
16499
16500 t0
16501 .ascii "arm_poke_function_name", 0
16502 .align
16503 t1
16504 .word 0xff000000 + (t1 - t0)
16505 arm_poke_function_name
16506 mov ip, sp
16507 stmfd sp!, {fp, ip, lr, pc}
16508 sub fp, ip, #4
16509
16510 When performing a stack backtrace, code can inspect the value of
16511 "pc" stored at "fp + 0". If the trace function then looks at
16512 location "pc - 12" and the top 8 bits are set, then we know that
16513 there is a function name embedded immediately preceding this
16514 location and has length "((pc[-3]) & 0xff000000)".
16515
16516 -mthumb
16517 -marm
16518 Select between generating code that executes in ARM and Thumb
16519 states. The default for most configurations is to generate code
16520 that executes in ARM state, but the default can be changed by
16521 configuring GCC with the --with-mode=state configure option.
16522
16523 You can also override the ARM and Thumb mode for each function by
16524 using the "target("thumb")" and "target("arm")" function attributes
16525 or pragmas.
16526
16527 -mflip-thumb
16528 Switch ARM/Thumb modes on alternating functions. This option is
16529 provided for regression testing of mixed Thumb/ARM code generation,
16530 and is not intended for ordinary use in compiling code.
16531
16532 -mtpcs-frame
16533 Generate a stack frame that is compliant with the Thumb Procedure
16534 Call Standard for all non-leaf functions. (A leaf function is one
16535 that does not call any other functions.) The default is
16536 -mno-tpcs-frame.
16537
16538 -mtpcs-leaf-frame
16539 Generate a stack frame that is compliant with the Thumb Procedure
16540 Call Standard for all leaf functions. (A leaf function is one that
16541 does not call any other functions.) The default is
16542 -mno-apcs-leaf-frame.
16543
16544 -mcallee-super-interworking
16545 Gives all externally visible functions in the file being compiled
16546 an ARM instruction set header which switches to Thumb mode before
16547 executing the rest of the function. This allows these functions to
16548 be called from non-interworking code. This option is not valid in
16549 AAPCS configurations because interworking is enabled by default.
16550
16551 -mcaller-super-interworking
16552 Allows calls via function pointers (including virtual functions) to
16553 execute correctly regardless of whether the target code has been
16554 compiled for interworking or not. There is a small overhead in the
16555 cost of executing a function pointer if this option is enabled.
16556 This option is not valid in AAPCS configurations because
16557 interworking is enabled by default.
16558
16559 -mtp=name
16560 Specify the access model for the thread local storage pointer. The
16561 valid models are soft, which generates calls to "__aeabi_read_tp",
16562 cp15, which fetches the thread pointer from "cp15" directly
16563 (supported in the arm6k architecture), and auto, which uses the
16564 best available method for the selected processor. The default
16565 setting is auto.
16566
16567 -mtls-dialect=dialect
16568 Specify the dialect to use for accessing thread local storage. Two
16569 dialects are supported---gnu and gnu2. The gnu dialect selects the
16570 original GNU scheme for supporting local and global dynamic TLS
16571 models. The gnu2 dialect selects the GNU descriptor scheme, which
16572 provides better performance for shared libraries. The GNU
16573 descriptor scheme is compatible with the original scheme, but does
16574 require new assembler, linker and library support. Initial and
16575 local exec TLS models are unaffected by this option and always use
16576 the original scheme.
16577
16578 -mword-relocations
16579 Only generate absolute relocations on word-sized values (i.e.
16580 R_ARM_ABS32). This is enabled by default on targets (uClinux,
16581 SymbianOS) where the runtime loader imposes this restriction, and
16582 when -fpic or -fPIC is specified. This option conflicts with
16583 -mslow-flash-data.
16584
16585 -mfix-cortex-m3-ldrd
16586 Some Cortex-M3 cores can cause data corruption when "ldrd"
16587 instructions with overlapping destination and base registers are
16588 used. This option avoids generating these instructions. This
16589 option is enabled by default when -mcpu=cortex-m3 is specified.
16590
16591 -munaligned-access
16592 -mno-unaligned-access
16593 Enables (or disables) reading and writing of 16- and 32- bit values
16594 from addresses that are not 16- or 32- bit aligned. By default
16595 unaligned access is disabled for all pre-ARMv6, all ARMv6-M and for
16596 ARMv8-M Baseline architectures, and enabled for all other
16597 architectures. If unaligned access is not enabled then words in
16598 packed data structures are accessed a byte at a time.
16599
16600 The ARM attribute "Tag_CPU_unaligned_access" is set in the
16601 generated object file to either true or false, depending upon the
16602 setting of this option. If unaligned access is enabled then the
16603 preprocessor symbol "__ARM_FEATURE_UNALIGNED" is also defined.
16604
16605 -mneon-for-64bits
16606 This option is deprecated and has no effect.
16607
16608 -mslow-flash-data
16609 Assume loading data from flash is slower than fetching instruction.
16610 Therefore literal load is minimized for better performance. This
16611 option is only supported when compiling for ARMv7 M-profile and off
16612 by default. It conflicts with -mword-relocations.
16613
16614 -masm-syntax-unified
16615 Assume inline assembler is using unified asm syntax. The default
16616 is currently off which implies divided syntax. This option has no
16617 impact on Thumb2. However, this may change in future releases of
16618 GCC. Divided syntax should be considered deprecated.
16619
16620 -mrestrict-it
16621 Restricts generation of IT blocks to conform to the rules of
16622 ARMv8-A. IT blocks can only contain a single 16-bit instruction
16623 from a select set of instructions. This option is on by default for
16624 ARMv8-A Thumb mode.
16625
16626 -mprint-tune-info
16627 Print CPU tuning information as comment in assembler file. This is
16628 an option used only for regression testing of the compiler and not
16629 intended for ordinary use in compiling code. This option is
16630 disabled by default.
16631
16632 -mverbose-cost-dump
16633 Enable verbose cost model dumping in the debug dump files. This
16634 option is provided for use in debugging the compiler.
16635
16636 -mpure-code
16637 Do not allow constant data to be placed in code sections.
16638 Additionally, when compiling for ELF object format give all text
16639 sections the ELF processor-specific section attribute
16640 "SHF_ARM_PURECODE". This option is only available when generating
16641 non-pic code for M-profile targets.
16642
16643 -mcmse
16644 Generate secure code as per the "ARMv8-M Security Extensions:
16645 Requirements on Development Tools Engineering Specification", which
16646 can be found on
16647 <http://infocenter.arm.com/help/topic/com.arm.doc.ecm0359818/ECM0359818_armv8m_security_extensions_reqs_on_dev_tools_1_0.pdf>.
16648
16649 -mfdpic
16650 -mno-fdpic
16651 Select the FDPIC ABI, which uses 64-bit function descriptors to
16652 represent pointers to functions. When the compiler is configured
16653 for "arm-*-uclinuxfdpiceabi" targets, this option is on by default
16654 and implies -fPIE if none of the PIC/PIE-related options is
16655 provided. On other targets, it only enables the FDPIC-specific
16656 code generation features, and the user should explicitly provide
16657 the PIC/PIE-related options as needed.
16658
16659 Note that static linking is not supported because it would still
16660 involve the dynamic linker when the program self-relocates. If
16661 such behavior is acceptable, use -static and -Wl,-dynamic-linker
16662 options.
16663
16664 The opposite -mno-fdpic option is useful (and required) to build
16665 the Linux kernel using the same ("arm-*-uclinuxfdpiceabi")
16666 toolchain as the one used to build the userland programs.
16667
16668 AVR Options
16669 These options are defined for AVR implementations:
16670
16671 -mmcu=mcu
16672 Specify Atmel AVR instruction set architectures (ISA) or MCU type.
16673
16674 The default for this option is@tie{}avr2.
16675
16676 GCC supports the following AVR devices and ISAs:
16677
16678 "avr2"
16679 "Classic" devices with up to 8@tie{}KiB of program memory.
16680 mcu@tie{}= "attiny22", "attiny26", "at90s2313", "at90s2323",
16681 "at90s2333", "at90s2343", "at90s4414", "at90s4433",
16682 "at90s4434", "at90c8534", "at90s8515", "at90s8535".
16683
16684 "avr25"
16685 "Classic" devices with up to 8@tie{}KiB of program memory and
16686 with the "MOVW" instruction. mcu@tie{}= "attiny13",
16687 "attiny13a", "attiny24", "attiny24a", "attiny25", "attiny261",
16688 "attiny261a", "attiny2313", "attiny2313a", "attiny43u",
16689 "attiny44", "attiny44a", "attiny45", "attiny48", "attiny441",
16690 "attiny461", "attiny461a", "attiny4313", "attiny84",
16691 "attiny84a", "attiny85", "attiny87", "attiny88", "attiny828",
16692 "attiny841", "attiny861", "attiny861a", "ata5272", "ata6616c",
16693 "at86rf401".
16694
16695 "avr3"
16696 "Classic" devices with 16@tie{}KiB up to 64@tie{}KiB of program
16697 memory. mcu@tie{}= "at76c711", "at43usb355".
16698
16699 "avr31"
16700 "Classic" devices with 128@tie{}KiB of program memory.
16701 mcu@tie{}= "atmega103", "at43usb320".
16702
16703 "avr35"
16704 "Classic" devices with 16@tie{}KiB up to 64@tie{}KiB of program
16705 memory and with the "MOVW" instruction. mcu@tie{}=
16706 "attiny167", "attiny1634", "atmega8u2", "atmega16u2",
16707 "atmega32u2", "ata5505", "ata6617c", "ata664251", "at90usb82",
16708 "at90usb162".
16709
16710 "avr4"
16711 "Enhanced" devices with up to 8@tie{}KiB of program memory.
16712 mcu@tie{}= "atmega48", "atmega48a", "atmega48p", "atmega48pa",
16713 "atmega48pb", "atmega8", "atmega8a", "atmega8hva", "atmega88",
16714 "atmega88a", "atmega88p", "atmega88pa", "atmega88pb",
16715 "atmega8515", "atmega8535", "ata6285", "ata6286", "ata6289",
16716 "ata6612c", "at90pwm1", "at90pwm2", "at90pwm2b", "at90pwm3",
16717 "at90pwm3b", "at90pwm81".
16718
16719 "avr5"
16720 "Enhanced" devices with 16@tie{}KiB up to 64@tie{}KiB of
16721 program memory. mcu@tie{}= "atmega16", "atmega16a",
16722 "atmega16hva", "atmega16hva2", "atmega16hvb",
16723 "atmega16hvbrevb", "atmega16m1", "atmega16u4", "atmega161",
16724 "atmega162", "atmega163", "atmega164a", "atmega164p",
16725 "atmega164pa", "atmega165", "atmega165a", "atmega165p",
16726 "atmega165pa", "atmega168", "atmega168a", "atmega168p",
16727 "atmega168pa", "atmega168pb", "atmega169", "atmega169a",
16728 "atmega169p", "atmega169pa", "atmega32", "atmega32a",
16729 "atmega32c1", "atmega32hvb", "atmega32hvbrevb", "atmega32m1",
16730 "atmega32u4", "atmega32u6", "atmega323", "atmega324a",
16731 "atmega324p", "atmega324pa", "atmega325", "atmega325a",
16732 "atmega325p", "atmega325pa", "atmega328", "atmega328p",
16733 "atmega328pb", "atmega329", "atmega329a", "atmega329p",
16734 "atmega329pa", "atmega3250", "atmega3250a", "atmega3250p",
16735 "atmega3250pa", "atmega3290", "atmega3290a", "atmega3290p",
16736 "atmega3290pa", "atmega406", "atmega64", "atmega64a",
16737 "atmega64c1", "atmega64hve", "atmega64hve2", "atmega64m1",
16738 "atmega64rfr2", "atmega640", "atmega644", "atmega644a",
16739 "atmega644p", "atmega644pa", "atmega644rfr2", "atmega645",
16740 "atmega645a", "atmega645p", "atmega649", "atmega649a",
16741 "atmega649p", "atmega6450", "atmega6450a", "atmega6450p",
16742 "atmega6490", "atmega6490a", "atmega6490p", "ata5795",
16743 "ata5790", "ata5790n", "ata5791", "ata6613c", "ata6614q",
16744 "ata5782", "ata5831", "ata8210", "ata8510", "ata5702m322",
16745 "at90pwm161", "at90pwm216", "at90pwm316", "at90can32",
16746 "at90can64", "at90scr100", "at90usb646", "at90usb647", "at94k",
16747 "m3000".
16748
16749 "avr51"
16750 "Enhanced" devices with 128@tie{}KiB of program memory.
16751 mcu@tie{}= "atmega128", "atmega128a", "atmega128rfa1",
16752 "atmega128rfr2", "atmega1280", "atmega1281", "atmega1284",
16753 "atmega1284p", "atmega1284rfr2", "at90can128", "at90usb1286",
16754 "at90usb1287".
16755
16756 "avr6"
16757 "Enhanced" devices with 3-byte PC, i.e. with more than
16758 128@tie{}KiB of program memory. mcu@tie{}= "atmega256rfr2",
16759 "atmega2560", "atmega2561", "atmega2564rfr2".
16760
16761 "avrxmega2"
16762 "XMEGA" devices with more than 8@tie{}KiB and up to 64@tie{}KiB
16763 of program memory. mcu@tie{}= "atxmega8e5", "atxmega16a4",
16764 "atxmega16a4u", "atxmega16c4", "atxmega16d4", "atxmega16e5",
16765 "atxmega32a4", "atxmega32a4u", "atxmega32c3", "atxmega32c4",
16766 "atxmega32d3", "atxmega32d4", "atxmega32e5".
16767
16768 "avrxmega3"
16769 "XMEGA" devices with up to 64@tie{}KiB of combined program
16770 memory and RAM, and with program memory visible in the RAM
16771 address space. mcu@tie{}= "attiny202", "attiny204",
16772 "attiny212", "attiny214", "attiny402", "attiny404",
16773 "attiny406", "attiny412", "attiny414", "attiny416",
16774 "attiny417", "attiny804", "attiny806", "attiny807",
16775 "attiny814", "attiny816", "attiny817", "attiny1604",
16776 "attiny1606", "attiny1607", "attiny1614", "attiny1616",
16777 "attiny1617", "attiny3214", "attiny3216", "attiny3217",
16778 "atmega808", "atmega809", "atmega1608", "atmega1609",
16779 "atmega3208", "atmega3209", "atmega4808", "atmega4809".
16780
16781 "avrxmega4"
16782 "XMEGA" devices with more than 64@tie{}KiB and up to
16783 128@tie{}KiB of program memory. mcu@tie{}= "atxmega64a3",
16784 "atxmega64a3u", "atxmega64a4u", "atxmega64b1", "atxmega64b3",
16785 "atxmega64c3", "atxmega64d3", "atxmega64d4".
16786
16787 "avrxmega5"
16788 "XMEGA" devices with more than 64@tie{}KiB and up to
16789 128@tie{}KiB of program memory and more than 64@tie{}KiB of
16790 RAM. mcu@tie{}= "atxmega64a1", "atxmega64a1u".
16791
16792 "avrxmega6"
16793 "XMEGA" devices with more than 128@tie{}KiB of program memory.
16794 mcu@tie{}= "atxmega128a3", "atxmega128a3u", "atxmega128b1",
16795 "atxmega128b3", "atxmega128c3", "atxmega128d3", "atxmega128d4",
16796 "atxmega192a3", "atxmega192a3u", "atxmega192c3",
16797 "atxmega192d3", "atxmega256a3", "atxmega256a3b",
16798 "atxmega256a3bu", "atxmega256a3u", "atxmega256c3",
16799 "atxmega256d3", "atxmega384c3", "atxmega384d3".
16800
16801 "avrxmega7"
16802 "XMEGA" devices with more than 128@tie{}KiB of program memory
16803 and more than 64@tie{}KiB of RAM. mcu@tie{}= "atxmega128a1",
16804 "atxmega128a1u", "atxmega128a4u".
16805
16806 "avrtiny"
16807 "TINY" Tiny core devices with 512@tie{}B up to 4@tie{}KiB of
16808 program memory. mcu@tie{}= "attiny4", "attiny5", "attiny9",
16809 "attiny10", "attiny20", "attiny40".
16810
16811 "avr1"
16812 This ISA is implemented by the minimal AVR core and supported
16813 for assembler only. mcu@tie{}= "attiny11", "attiny12",
16814 "attiny15", "attiny28", "at90s1200".
16815
16816 -mabsdata
16817 Assume that all data in static storage can be accessed by LDS / STS
16818 instructions. This option has only an effect on reduced Tiny
16819 devices like ATtiny40. See also the "absdata" AVR Variable
16820 Attributes,variable attribute.
16821
16822 -maccumulate-args
16823 Accumulate outgoing function arguments and acquire/release the
16824 needed stack space for outgoing function arguments once in function
16825 prologue/epilogue. Without this option, outgoing arguments are
16826 pushed before calling a function and popped afterwards.
16827
16828 Popping the arguments after the function call can be expensive on
16829 AVR so that accumulating the stack space might lead to smaller
16830 executables because arguments need not be removed from the stack
16831 after such a function call.
16832
16833 This option can lead to reduced code size for functions that
16834 perform several calls to functions that get their arguments on the
16835 stack like calls to printf-like functions.
16836
16837 -mbranch-cost=cost
16838 Set the branch costs for conditional branch instructions to cost.
16839 Reasonable values for cost are small, non-negative integers. The
16840 default branch cost is 0.
16841
16842 -mcall-prologues
16843 Functions prologues/epilogues are expanded as calls to appropriate
16844 subroutines. Code size is smaller.
16845
16846 -mdouble=bits
16847 -mlong-double=bits
16848 Set the size (in bits) of the "double" or "long double" type,
16849 respectively. Possible values for bits are 32 and 64. Whether or
16850 not a specific value for bits is allowed depends on the
16851 "--with-double=" and "--with-long-double=" configure options
16852 ("https://gcc.gnu.org/install/configure.html#avr"), and the same
16853 applies for the default values of the options.
16854
16855 -mgas-isr-prologues
16856 Interrupt service routines (ISRs) may use the "__gcc_isr" pseudo
16857 instruction supported by GNU Binutils. If this option is on, the
16858 feature can still be disabled for individual ISRs by means of the
16859 AVR Function Attributes,,"no_gccisr" function attribute. This
16860 feature is activated per default if optimization is on (but not
16861 with -Og, @pxref{Optimize Options}), and if GNU Binutils support
16862 PR21683 ("https://sourceware.org/PR21683").
16863
16864 -mint8
16865 Assume "int" to be 8-bit integer. This affects the sizes of all
16866 types: a "char" is 1 byte, an "int" is 1 byte, a "long" is 2 bytes,
16867 and "long long" is 4 bytes. Please note that this option does not
16868 conform to the C standards, but it results in smaller code size.
16869
16870 -mmain-is-OS_task
16871 Do not save registers in "main". The effect is the same like
16872 attaching attribute AVR Function Attributes,,"OS_task" to "main".
16873 It is activated per default if optimization is on.
16874
16875 -mn-flash=num
16876 Assume that the flash memory has a size of num times 64@tie{}KiB.
16877
16878 -mno-interrupts
16879 Generated code is not compatible with hardware interrupts. Code
16880 size is smaller.
16881
16882 -mrelax
16883 Try to replace "CALL" resp. "JMP" instruction by the shorter
16884 "RCALL" resp. "RJMP" instruction if applicable. Setting -mrelax
16885 just adds the --mlink-relax option to the assembler's command line
16886 and the --relax option to the linker's command line.
16887
16888 Jump relaxing is performed by the linker because jump offsets are
16889 not known before code is located. Therefore, the assembler code
16890 generated by the compiler is the same, but the instructions in the
16891 executable may differ from instructions in the assembler code.
16892
16893 Relaxing must be turned on if linker stubs are needed, see the
16894 section on "EIND" and linker stubs below.
16895
16896 -mrmw
16897 Assume that the device supports the Read-Modify-Write instructions
16898 "XCH", "LAC", "LAS" and "LAT".
16899
16900 -mshort-calls
16901 Assume that "RJMP" and "RCALL" can target the whole program memory.
16902
16903 This option is used internally for multilib selection. It is not
16904 an optimization option, and you don't need to set it by hand.
16905
16906 -msp8
16907 Treat the stack pointer register as an 8-bit register, i.e. assume
16908 the high byte of the stack pointer is zero. In general, you don't
16909 need to set this option by hand.
16910
16911 This option is used internally by the compiler to select and build
16912 multilibs for architectures "avr2" and "avr25". These
16913 architectures mix devices with and without "SPH". For any setting
16914 other than -mmcu=avr2 or -mmcu=avr25 the compiler driver adds or
16915 removes this option from the compiler proper's command line,
16916 because the compiler then knows if the device or architecture has
16917 an 8-bit stack pointer and thus no "SPH" register or not.
16918
16919 -mstrict-X
16920 Use address register "X" in a way proposed by the hardware. This
16921 means that "X" is only used in indirect, post-increment or pre-
16922 decrement addressing.
16923
16924 Without this option, the "X" register may be used in the same way
16925 as "Y" or "Z" which then is emulated by additional instructions.
16926 For example, loading a value with "X+const" addressing with a small
16927 non-negative "const < 64" to a register Rn is performed as
16928
16929 adiw r26, const ; X += const
16930 ld <Rn>, X ; <Rn> = *X
16931 sbiw r26, const ; X -= const
16932
16933 -mtiny-stack
16934 Only change the lower 8@tie{}bits of the stack pointer.
16935
16936 -mfract-convert-truncate
16937 Allow to use truncation instead of rounding towards zero for
16938 fractional fixed-point types.
16939
16940 -nodevicelib
16941 Don't link against AVR-LibC's device specific library "lib<mcu>.a".
16942
16943 -nodevicespecs
16944 Don't add -specs=device-specs/specs-mcu to the compiler driver's
16945 command line. The user takes responsibility for supplying the sub-
16946 processes like compiler proper, assembler and linker with
16947 appropriate command line options. This means that the user has to
16948 supply her private device specs file by means of -specs=path-to-
16949 specs-file. There is no more need for option -mmcu=mcu.
16950
16951 This option can also serve as a replacement for the older way of
16952 specifying custom device-specs files that needed -B some-path to
16953 point to a directory which contains a folder named "device-specs"
16954 which contains a specs file named "specs-mcu", where mcu was
16955 specified by -mmcu=mcu.
16956
16957 -Waddr-space-convert
16958 Warn about conversions between address spaces in the case where the
16959 resulting address space is not contained in the incoming address
16960 space.
16961
16962 -Wmisspelled-isr
16963 Warn if the ISR is misspelled, i.e. without __vector prefix.
16964 Enabled by default.
16965
16966 "EIND" and Devices with More Than 128 Ki Bytes of Flash
16967
16968 Pointers in the implementation are 16@tie{}bits wide. The address of a
16969 function or label is represented as word address so that indirect jumps
16970 and calls can target any code address in the range of 64@tie{}Ki words.
16971
16972 In order to facilitate indirect jump on devices with more than
16973 128@tie{}Ki bytes of program memory space, there is a special function
16974 register called "EIND" that serves as most significant part of the
16975 target address when "EICALL" or "EIJMP" instructions are used.
16976
16977 Indirect jumps and calls on these devices are handled as follows by the
16978 compiler and are subject to some limitations:
16979
16980 * The compiler never sets "EIND".
16981
16982 * The compiler uses "EIND" implicitly in "EICALL"/"EIJMP"
16983 instructions or might read "EIND" directly in order to emulate an
16984 indirect call/jump by means of a "RET" instruction.
16985
16986 * The compiler assumes that "EIND" never changes during the startup
16987 code or during the application. In particular, "EIND" is not
16988 saved/restored in function or interrupt service routine
16989 prologue/epilogue.
16990
16991 * For indirect calls to functions and computed goto, the linker
16992 generates stubs. Stubs are jump pads sometimes also called
16993 trampolines. Thus, the indirect call/jump jumps to such a stub.
16994 The stub contains a direct jump to the desired address.
16995
16996 * Linker relaxation must be turned on so that the linker generates
16997 the stubs correctly in all situations. See the compiler option
16998 -mrelax and the linker option --relax. There are corner cases
16999 where the linker is supposed to generate stubs but aborts without
17000 relaxation and without a helpful error message.
17001
17002 * The default linker script is arranged for code with "EIND = 0". If
17003 code is supposed to work for a setup with "EIND != 0", a custom
17004 linker script has to be used in order to place the sections whose
17005 name start with ".trampolines" into the segment where "EIND" points
17006 to.
17007
17008 * The startup code from libgcc never sets "EIND". Notice that
17009 startup code is a blend of code from libgcc and AVR-LibC. For the
17010 impact of AVR-LibC on "EIND", see the AVR-LibC user manual
17011 ("http://nongnu.org/avr-libc/user-manual/").
17012
17013 * It is legitimate for user-specific startup code to set up "EIND"
17014 early, for example by means of initialization code located in
17015 section ".init3". Such code runs prior to general startup code that
17016 initializes RAM and calls constructors, but after the bit of
17017 startup code from AVR-LibC that sets "EIND" to the segment where
17018 the vector table is located.
17019
17020 #include <avr/io.h>
17021
17022 static void
17023 __attribute__((section(".init3"),naked,used,no_instrument_function))
17024 init3_set_eind (void)
17025 {
17026 __asm volatile ("ldi r24,pm_hh8(__trampolines_start)\n\t"
17027 "out %i0,r24" :: "n" (&EIND) : "r24","memory");
17028 }
17029
17030 The "__trampolines_start" symbol is defined in the linker script.
17031
17032 * Stubs are generated automatically by the linker if the following
17033 two conditions are met:
17034
17035 -<The address of a label is taken by means of the "gs" modifier>
17036 (short for generate stubs) like so:
17037
17038 LDI r24, lo8(gs(<func>))
17039 LDI r25, hi8(gs(<func>))
17040
17041 -<The final location of that label is in a code segment>
17042 outside the segment where the stubs are located.
17043
17044 * The compiler emits such "gs" modifiers for code labels in the
17045 following situations:
17046
17047 -<Taking address of a function or code label.>
17048 -<Computed goto.>
17049 -<If prologue-save function is used, see -mcall-prologues>
17050 command-line option.
17051
17052 -<Switch/case dispatch tables. If you do not want such dispatch>
17053 tables you can specify the -fno-jump-tables command-line
17054 option.
17055
17056 -<C and C++ constructors/destructors called during
17057 startup/shutdown.>
17058 -<If the tools hit a "gs()" modifier explained above.>
17059 * Jumping to non-symbolic addresses like so is not supported:
17060
17061 int main (void)
17062 {
17063 /* Call function at word address 0x2 */
17064 return ((int(*)(void)) 0x2)();
17065 }
17066
17067 Instead, a stub has to be set up, i.e. the function has to be
17068 called through a symbol ("func_4" in the example):
17069
17070 int main (void)
17071 {
17072 extern int func_4 (void);
17073
17074 /* Call function at byte address 0x4 */
17075 return func_4();
17076 }
17077
17078 and the application be linked with -Wl,--defsym,func_4=0x4.
17079 Alternatively, "func_4" can be defined in the linker script.
17080
17081 Handling of the "RAMPD", "RAMPX", "RAMPY" and "RAMPZ" Special Function
17082 Registers
17083
17084 Some AVR devices support memories larger than the 64@tie{}KiB range
17085 that can be accessed with 16-bit pointers. To access memory locations
17086 outside this 64@tie{}KiB range, the content of a "RAMP" register is
17087 used as high part of the address: The "X", "Y", "Z" address register is
17088 concatenated with the "RAMPX", "RAMPY", "RAMPZ" special function
17089 register, respectively, to get a wide address. Similarly, "RAMPD" is
17090 used together with direct addressing.
17091
17092 * The startup code initializes the "RAMP" special function registers
17093 with zero.
17094
17095 * If a AVR Named Address Spaces,named address space other than
17096 generic or "__flash" is used, then "RAMPZ" is set as needed before
17097 the operation.
17098
17099 * If the device supports RAM larger than 64@tie{}KiB and the compiler
17100 needs to change "RAMPZ" to accomplish an operation, "RAMPZ" is
17101 reset to zero after the operation.
17102
17103 * If the device comes with a specific "RAMP" register, the ISR
17104 prologue/epilogue saves/restores that SFR and initializes it with
17105 zero in case the ISR code might (implicitly) use it.
17106
17107 * RAM larger than 64@tie{}KiB is not supported by GCC for AVR
17108 targets. If you use inline assembler to read from locations
17109 outside the 16-bit address range and change one of the "RAMP"
17110 registers, you must reset it to zero after the access.
17111
17112 AVR Built-in Macros
17113
17114 GCC defines several built-in macros so that the user code can test for
17115 the presence or absence of features. Almost any of the following
17116 built-in macros are deduced from device capabilities and thus triggered
17117 by the -mmcu= command-line option.
17118
17119 For even more AVR-specific built-in macros see AVR Named Address Spaces
17120 and AVR Built-in Functions.
17121
17122 "__AVR_ARCH__"
17123 Build-in macro that resolves to a decimal number that identifies
17124 the architecture and depends on the -mmcu=mcu option. Possible
17125 values are:
17126
17127 2, 25, 3, 31, 35, 4, 5, 51, 6
17128
17129 for mcu="avr2", "avr25", "avr3", "avr31", "avr35", "avr4", "avr5",
17130 "avr51", "avr6",
17131
17132 respectively and
17133
17134 100, 102, 103, 104, 105, 106, 107
17135
17136 for mcu="avrtiny", "avrxmega2", "avrxmega3", "avrxmega4",
17137 "avrxmega5", "avrxmega6", "avrxmega7", respectively. If mcu
17138 specifies a device, this built-in macro is set accordingly. For
17139 example, with -mmcu=atmega8 the macro is defined to 4.
17140
17141 "__AVR_Device__"
17142 Setting -mmcu=device defines this built-in macro which reflects the
17143 device's name. For example, -mmcu=atmega8 defines the built-in
17144 macro "__AVR_ATmega8__", -mmcu=attiny261a defines
17145 "__AVR_ATtiny261A__", etc.
17146
17147 The built-in macros' names follow the scheme "__AVR_Device__" where
17148 Device is the device name as from the AVR user manual. The
17149 difference between Device in the built-in macro and device in
17150 -mmcu=device is that the latter is always lowercase.
17151
17152 If device is not a device but only a core architecture like avr51,
17153 this macro is not defined.
17154
17155 "__AVR_DEVICE_NAME__"
17156 Setting -mmcu=device defines this built-in macro to the device's
17157 name. For example, with -mmcu=atmega8 the macro is defined to
17158 "atmega8".
17159
17160 If device is not a device but only a core architecture like avr51,
17161 this macro is not defined.
17162
17163 "__AVR_XMEGA__"
17164 The device / architecture belongs to the XMEGA family of devices.
17165
17166 "__AVR_HAVE_ELPM__"
17167 The device has the "ELPM" instruction.
17168
17169 "__AVR_HAVE_ELPMX__"
17170 The device has the "ELPM Rn,Z" and "ELPM Rn,Z+" instructions.
17171
17172 "__AVR_HAVE_MOVW__"
17173 The device has the "MOVW" instruction to perform 16-bit register-
17174 register moves.
17175
17176 "__AVR_HAVE_LPMX__"
17177 The device has the "LPM Rn,Z" and "LPM Rn,Z+" instructions.
17178
17179 "__AVR_HAVE_MUL__"
17180 The device has a hardware multiplier.
17181
17182 "__AVR_HAVE_JMP_CALL__"
17183 The device has the "JMP" and "CALL" instructions. This is the case
17184 for devices with more than 8@tie{}KiB of program memory.
17185
17186 "__AVR_HAVE_EIJMP_EICALL__"
17187 "__AVR_3_BYTE_PC__"
17188 The device has the "EIJMP" and "EICALL" instructions. This is the
17189 case for devices with more than 128@tie{}KiB of program memory.
17190 This also means that the program counter (PC) is 3@tie{}bytes wide.
17191
17192 "__AVR_2_BYTE_PC__"
17193 The program counter (PC) is 2@tie{}bytes wide. This is the case for
17194 devices with up to 128@tie{}KiB of program memory.
17195
17196 "__AVR_HAVE_8BIT_SP__"
17197 "__AVR_HAVE_16BIT_SP__"
17198 The stack pointer (SP) register is treated as 8-bit respectively
17199 16-bit register by the compiler. The definition of these macros is
17200 affected by -mtiny-stack.
17201
17202 "__AVR_HAVE_SPH__"
17203 "__AVR_SP8__"
17204 The device has the SPH (high part of stack pointer) special
17205 function register or has an 8-bit stack pointer, respectively. The
17206 definition of these macros is affected by -mmcu= and in the cases
17207 of -mmcu=avr2 and -mmcu=avr25 also by -msp8.
17208
17209 "__AVR_HAVE_RAMPD__"
17210 "__AVR_HAVE_RAMPX__"
17211 "__AVR_HAVE_RAMPY__"
17212 "__AVR_HAVE_RAMPZ__"
17213 The device has the "RAMPD", "RAMPX", "RAMPY", "RAMPZ" special
17214 function register, respectively.
17215
17216 "__NO_INTERRUPTS__"
17217 This macro reflects the -mno-interrupts command-line option.
17218
17219 "__AVR_ERRATA_SKIP__"
17220 "__AVR_ERRATA_SKIP_JMP_CALL__"
17221 Some AVR devices (AT90S8515, ATmega103) must not skip 32-bit
17222 instructions because of a hardware erratum. Skip instructions are
17223 "SBRS", "SBRC", "SBIS", "SBIC" and "CPSE". The second macro is
17224 only defined if "__AVR_HAVE_JMP_CALL__" is also set.
17225
17226 "__AVR_ISA_RMW__"
17227 The device has Read-Modify-Write instructions (XCH, LAC, LAS and
17228 LAT).
17229
17230 "__AVR_SFR_OFFSET__=offset"
17231 Instructions that can address I/O special function registers
17232 directly like "IN", "OUT", "SBI", etc. may use a different address
17233 as if addressed by an instruction to access RAM like "LD" or "STS".
17234 This offset depends on the device architecture and has to be
17235 subtracted from the RAM address in order to get the respective
17236 I/O@tie{}address.
17237
17238 "__AVR_SHORT_CALLS__"
17239 The -mshort-calls command line option is set.
17240
17241 "__AVR_PM_BASE_ADDRESS__=addr"
17242 Some devices support reading from flash memory by means of "LD*"
17243 instructions. The flash memory is seen in the data address space
17244 at an offset of "__AVR_PM_BASE_ADDRESS__". If this macro is not
17245 defined, this feature is not available. If defined, the address
17246 space is linear and there is no need to put ".rodata" into RAM.
17247 This is handled by the default linker description file, and is
17248 currently available for "avrtiny" and "avrxmega3". Even more
17249 convenient, there is no need to use address spaces like "__flash"
17250 or features like attribute "progmem" and "pgm_read_*".
17251
17252 "__WITH_AVRLIBC__"
17253 The compiler is configured to be used together with AVR-Libc. See
17254 the --with-avrlibc configure option.
17255
17256 "__HAVE_DOUBLE_MULTILIB__"
17257 Defined if -mdouble= acts as a multilib option.
17258
17259 "__HAVE_DOUBLE32__"
17260 "__HAVE_DOUBLE64__"
17261 Defined if the compiler supports 32-bit double resp. 64-bit double.
17262 The actual layout is specified by option -mdouble=.
17263
17264 "__DEFAULT_DOUBLE__"
17265 The size in bits of "double" if -mdouble= is not set. To test the
17266 layout of "double" in a program, use the built-in macro
17267 "__SIZEOF_DOUBLE__".
17268
17269 "__HAVE_LONG_DOUBLE32__"
17270 "__HAVE_LONG_DOUBLE64__"
17271 "__HAVE_LONG_DOUBLE_MULTILIB__"
17272 "__DEFAULT_LONG_DOUBLE__"
17273 Same as above, but for "long double" instead of "double".
17274
17275 "__WITH_DOUBLE_COMPARISON__"
17276 Reflects the "--with-double-comparison={tristate|bool|libf7}"
17277 configure option ("https://gcc.gnu.org/install/configure.html#avr")
17278 and is defined to 2 or 3.
17279
17280 "__WITH_LIBF7_LIBGCC__"
17281 "__WITH_LIBF7_MATH__"
17282 "__WITH_LIBF7_MATH_SYMBOLS__"
17283 Reflects the "--with-libf7={libgcc|math|math-symbols}"
17284 configure option
17285 ("https://gcc.gnu.org/install/configure.html#avr").
17286
17287 Blackfin Options
17288 -mcpu=cpu[-sirevision]
17289 Specifies the name of the target Blackfin processor. Currently,
17290 cpu can be one of bf512, bf514, bf516, bf518, bf522, bf523, bf524,
17291 bf525, bf526, bf527, bf531, bf532, bf533, bf534, bf536, bf537,
17292 bf538, bf539, bf542, bf544, bf547, bf548, bf549, bf542m, bf544m,
17293 bf547m, bf548m, bf549m, bf561, bf592.
17294
17295 The optional sirevision specifies the silicon revision of the
17296 target Blackfin processor. Any workarounds available for the
17297 targeted silicon revision are enabled. If sirevision is none, no
17298 workarounds are enabled. If sirevision is any, all workarounds for
17299 the targeted processor are enabled. The "__SILICON_REVISION__"
17300 macro is defined to two hexadecimal digits representing the major
17301 and minor numbers in the silicon revision. If sirevision is none,
17302 the "__SILICON_REVISION__" is not defined. If sirevision is any,
17303 the "__SILICON_REVISION__" is defined to be 0xffff. If this
17304 optional sirevision is not used, GCC assumes the latest known
17305 silicon revision of the targeted Blackfin processor.
17306
17307 GCC defines a preprocessor macro for the specified cpu. For the
17308 bfin-elf toolchain, this option causes the hardware BSP provided by
17309 libgloss to be linked in if -msim is not given.
17310
17311 Without this option, bf532 is used as the processor by default.
17312
17313 Note that support for bf561 is incomplete. For bf561, only the
17314 preprocessor macro is defined.
17315
17316 -msim
17317 Specifies that the program will be run on the simulator. This
17318 causes the simulator BSP provided by libgloss to be linked in.
17319 This option has effect only for bfin-elf toolchain. Certain other
17320 options, such as -mid-shared-library and -mfdpic, imply -msim.
17321
17322 -momit-leaf-frame-pointer
17323 Don't keep the frame pointer in a register for leaf functions.
17324 This avoids the instructions to save, set up and restore frame
17325 pointers and makes an extra register available in leaf functions.
17326
17327 -mspecld-anomaly
17328 When enabled, the compiler ensures that the generated code does not
17329 contain speculative loads after jump instructions. If this option
17330 is used, "__WORKAROUND_SPECULATIVE_LOADS" is defined.
17331
17332 -mno-specld-anomaly
17333 Don't generate extra code to prevent speculative loads from
17334 occurring.
17335
17336 -mcsync-anomaly
17337 When enabled, the compiler ensures that the generated code does not
17338 contain CSYNC or SSYNC instructions too soon after conditional
17339 branches. If this option is used, "__WORKAROUND_SPECULATIVE_SYNCS"
17340 is defined.
17341
17342 -mno-csync-anomaly
17343 Don't generate extra code to prevent CSYNC or SSYNC instructions
17344 from occurring too soon after a conditional branch.
17345
17346 -mlow64k
17347 When enabled, the compiler is free to take advantage of the
17348 knowledge that the entire program fits into the low 64k of memory.
17349
17350 -mno-low64k
17351 Assume that the program is arbitrarily large. This is the default.
17352
17353 -mstack-check-l1
17354 Do stack checking using information placed into L1 scratchpad
17355 memory by the uClinux kernel.
17356
17357 -mid-shared-library
17358 Generate code that supports shared libraries via the library ID
17359 method. This allows for execute in place and shared libraries in
17360 an environment without virtual memory management. This option
17361 implies -fPIC. With a bfin-elf target, this option implies -msim.
17362
17363 -mno-id-shared-library
17364 Generate code that doesn't assume ID-based shared libraries are
17365 being used. This is the default.
17366
17367 -mleaf-id-shared-library
17368 Generate code that supports shared libraries via the library ID
17369 method, but assumes that this library or executable won't link
17370 against any other ID shared libraries. That allows the compiler to
17371 use faster code for jumps and calls.
17372
17373 -mno-leaf-id-shared-library
17374 Do not assume that the code being compiled won't link against any
17375 ID shared libraries. Slower code is generated for jump and call
17376 insns.
17377
17378 -mshared-library-id=n
17379 Specifies the identification number of the ID-based shared library
17380 being compiled. Specifying a value of 0 generates more compact
17381 code; specifying other values forces the allocation of that number
17382 to the current library but is no more space- or time-efficient than
17383 omitting this option.
17384
17385 -msep-data
17386 Generate code that allows the data segment to be located in a
17387 different area of memory from the text segment. This allows for
17388 execute in place in an environment without virtual memory
17389 management by eliminating relocations against the text section.
17390
17391 -mno-sep-data
17392 Generate code that assumes that the data segment follows the text
17393 segment. This is the default.
17394
17395 -mlong-calls
17396 -mno-long-calls
17397 Tells the compiler to perform function calls by first loading the
17398 address of the function into a register and then performing a
17399 subroutine call on this register. This switch is needed if the
17400 target function lies outside of the 24-bit addressing range of the
17401 offset-based version of subroutine call instruction.
17402
17403 This feature is not enabled by default. Specifying -mno-long-calls
17404 restores the default behavior. Note these switches have no effect
17405 on how the compiler generates code to handle function calls via
17406 function pointers.
17407
17408 -mfast-fp
17409 Link with the fast floating-point library. This library relaxes
17410 some of the IEEE floating-point standard's rules for checking
17411 inputs against Not-a-Number (NAN), in the interest of performance.
17412
17413 -minline-plt
17414 Enable inlining of PLT entries in function calls to functions that
17415 are not known to bind locally. It has no effect without -mfdpic.
17416
17417 -mmulticore
17418 Build a standalone application for multicore Blackfin processors.
17419 This option causes proper start files and link scripts supporting
17420 multicore to be used, and defines the macro "__BFIN_MULTICORE". It
17421 can only be used with -mcpu=bf561[-sirevision].
17422
17423 This option can be used with -mcorea or -mcoreb, which selects the
17424 one-application-per-core programming model. Without -mcorea or
17425 -mcoreb, the single-application/dual-core programming model is
17426 used. In this model, the main function of Core B should be named as
17427 "coreb_main".
17428
17429 If this option is not used, the single-core application programming
17430 model is used.
17431
17432 -mcorea
17433 Build a standalone application for Core A of BF561 when using the
17434 one-application-per-core programming model. Proper start files and
17435 link scripts are used to support Core A, and the macro
17436 "__BFIN_COREA" is defined. This option can only be used in
17437 conjunction with -mmulticore.
17438
17439 -mcoreb
17440 Build a standalone application for Core B of BF561 when using the
17441 one-application-per-core programming model. Proper start files and
17442 link scripts are used to support Core B, and the macro
17443 "__BFIN_COREB" is defined. When this option is used, "coreb_main"
17444 should be used instead of "main". This option can only be used in
17445 conjunction with -mmulticore.
17446
17447 -msdram
17448 Build a standalone application for SDRAM. Proper start files and
17449 link scripts are used to put the application into SDRAM, and the
17450 macro "__BFIN_SDRAM" is defined. The loader should initialize
17451 SDRAM before loading the application.
17452
17453 -micplb
17454 Assume that ICPLBs are enabled at run time. This has an effect on
17455 certain anomaly workarounds. For Linux targets, the default is to
17456 assume ICPLBs are enabled; for standalone applications the default
17457 is off.
17458
17459 C6X Options
17460 -march=name
17461 This specifies the name of the target architecture. GCC uses this
17462 name to determine what kind of instructions it can emit when
17463 generating assembly code. Permissible names are: c62x, c64x,
17464 c64x+, c67x, c67x+, c674x.
17465
17466 -mbig-endian
17467 Generate code for a big-endian target.
17468
17469 -mlittle-endian
17470 Generate code for a little-endian target. This is the default.
17471
17472 -msim
17473 Choose startup files and linker script suitable for the simulator.
17474
17475 -msdata=default
17476 Put small global and static data in the ".neardata" section, which
17477 is pointed to by register "B14". Put small uninitialized global
17478 and static data in the ".bss" section, which is adjacent to the
17479 ".neardata" section. Put small read-only data into the ".rodata"
17480 section. The corresponding sections used for large pieces of data
17481 are ".fardata", ".far" and ".const".
17482
17483 -msdata=all
17484 Put all data, not just small objects, into the sections reserved
17485 for small data, and use addressing relative to the "B14" register
17486 to access them.
17487
17488 -msdata=none
17489 Make no use of the sections reserved for small data, and use
17490 absolute addresses to access all data. Put all initialized global
17491 and static data in the ".fardata" section, and all uninitialized
17492 data in the ".far" section. Put all constant data into the
17493 ".const" section.
17494
17495 CRIS Options
17496 These options are defined specifically for the CRIS ports.
17497
17498 -march=architecture-type
17499 -mcpu=architecture-type
17500 Generate code for the specified architecture. The choices for
17501 architecture-type are v3, v8 and v10 for respectively ETRAX 4,
17502 ETRAX 100, and ETRAX 100 LX. Default is v0 except for cris-axis-
17503 linux-gnu, where the default is v10.
17504
17505 -mtune=architecture-type
17506 Tune to architecture-type everything applicable about the generated
17507 code, except for the ABI and the set of available instructions.
17508 The choices for architecture-type are the same as for
17509 -march=architecture-type.
17510
17511 -mmax-stack-frame=n
17512 Warn when the stack frame of a function exceeds n bytes.
17513
17514 -metrax4
17515 -metrax100
17516 The options -metrax4 and -metrax100 are synonyms for -march=v3 and
17517 -march=v8 respectively.
17518
17519 -mmul-bug-workaround
17520 -mno-mul-bug-workaround
17521 Work around a bug in the "muls" and "mulu" instructions for CPU
17522 models where it applies. This option is active by default.
17523
17524 -mpdebug
17525 Enable CRIS-specific verbose debug-related information in the
17526 assembly code. This option also has the effect of turning off the
17527 #NO_APP formatted-code indicator to the assembler at the beginning
17528 of the assembly file.
17529
17530 -mcc-init
17531 Do not use condition-code results from previous instruction; always
17532 emit compare and test instructions before use of condition codes.
17533
17534 -mno-side-effects
17535 Do not emit instructions with side effects in addressing modes
17536 other than post-increment.
17537
17538 -mstack-align
17539 -mno-stack-align
17540 -mdata-align
17541 -mno-data-align
17542 -mconst-align
17543 -mno-const-align
17544 These options (no- options) arrange (eliminate arrangements) for
17545 the stack frame, individual data and constants to be aligned for
17546 the maximum single data access size for the chosen CPU model. The
17547 default is to arrange for 32-bit alignment. ABI details such as
17548 structure layout are not affected by these options.
17549
17550 -m32-bit
17551 -m16-bit
17552 -m8-bit
17553 Similar to the stack- data- and const-align options above, these
17554 options arrange for stack frame, writable data and constants to all
17555 be 32-bit, 16-bit or 8-bit aligned. The default is 32-bit
17556 alignment.
17557
17558 -mno-prologue-epilogue
17559 -mprologue-epilogue
17560 With -mno-prologue-epilogue, the normal function prologue and
17561 epilogue which set up the stack frame are omitted and no return
17562 instructions or return sequences are generated in the code. Use
17563 this option only together with visual inspection of the compiled
17564 code: no warnings or errors are generated when call-saved registers
17565 must be saved, or storage for local variables needs to be
17566 allocated.
17567
17568 -mno-gotplt
17569 -mgotplt
17570 With -fpic and -fPIC, don't generate (do generate) instruction
17571 sequences that load addresses for functions from the PLT part of
17572 the GOT rather than (traditional on other architectures) calls to
17573 the PLT. The default is -mgotplt.
17574
17575 -melf
17576 Legacy no-op option only recognized with the cris-axis-elf and
17577 cris-axis-linux-gnu targets.
17578
17579 -mlinux
17580 Legacy no-op option only recognized with the cris-axis-linux-gnu
17581 target.
17582
17583 -sim
17584 This option, recognized for the cris-axis-elf, arranges to link
17585 with input-output functions from a simulator library. Code,
17586 initialized data and zero-initialized data are allocated
17587 consecutively.
17588
17589 -sim2
17590 Like -sim, but pass linker options to locate initialized data at
17591 0x40000000 and zero-initialized data at 0x80000000.
17592
17593 CR16 Options
17594 These options are defined specifically for the CR16 ports.
17595
17596 -mmac
17597 Enable the use of multiply-accumulate instructions. Disabled by
17598 default.
17599
17600 -mcr16cplus
17601 -mcr16c
17602 Generate code for CR16C or CR16C+ architecture. CR16C+ architecture
17603 is default.
17604
17605 -msim
17606 Links the library libsim.a which is in compatible with simulator.
17607 Applicable to ELF compiler only.
17608
17609 -mint32
17610 Choose integer type as 32-bit wide.
17611
17612 -mbit-ops
17613 Generates "sbit"/"cbit" instructions for bit manipulations.
17614
17615 -mdata-model=model
17616 Choose a data model. The choices for model are near, far or medium.
17617 medium is default. However, far is not valid with -mcr16c, as the
17618 CR16C architecture does not support the far data model.
17619
17620 C-SKY Options
17621 GCC supports these options when compiling for C-SKY V2 processors.
17622
17623 -march=arch
17624 Specify the C-SKY target architecture. Valid values for arch are:
17625 ck801, ck802, ck803, ck807, and ck810. The default is ck810.
17626
17627 -mcpu=cpu
17628 Specify the C-SKY target processor. Valid values for cpu are:
17629 ck801, ck801t, ck802, ck802t, ck802j, ck803, ck803h, ck803t,
17630 ck803ht, ck803f, ck803fh, ck803e, ck803eh, ck803et, ck803eht,
17631 ck803ef, ck803efh, ck803ft, ck803eft, ck803efht, ck803r1, ck803hr1,
17632 ck803tr1, ck803htr1, ck803fr1, ck803fhr1, ck803er1, ck803ehr1,
17633 ck803etr1, ck803ehtr1, ck803efr1, ck803efhr1, ck803ftr1,
17634 ck803eftr1, ck803efhtr1, ck803s, ck803st, ck803se, ck803sf,
17635 ck803sef, ck803seft, ck807e, ck807ef, ck807, ck807f, ck810e,
17636 ck810et, ck810ef, ck810eft, ck810, ck810v, ck810f, ck810t, ck810fv,
17637 ck810tv, ck810ft, and ck810ftv.
17638
17639 -mbig-endian
17640 -EB
17641 -mlittle-endian
17642 -EL Select big- or little-endian code. The default is little-endian.
17643
17644 -mhard-float
17645 -msoft-float
17646 Select hardware or software floating-point implementations. The
17647 default is soft float.
17648
17649 -mdouble-float
17650 -mno-double-float
17651 When -mhard-float is in effect, enable generation of double-
17652 precision float instructions. This is the default except when
17653 compiling for CK803.
17654
17655 -mfdivdu
17656 -mno-fdivdu
17657 When -mhard-float is in effect, enable generation of "frecipd",
17658 "fsqrtd", and "fdivd" instructions. This is the default except
17659 when compiling for CK803.
17660
17661 -mfpu=fpu
17662 Select the floating-point processor. This option can only be used
17663 with -mhard-float. Values for fpu are fpv2_sf (equivalent to
17664 -mno-double-float -mno-fdivdu), fpv2 (-mdouble-float -mno-divdu),
17665 and fpv2_divd (-mdouble-float -mdivdu).
17666
17667 -melrw
17668 -mno-elrw
17669 Enable the extended "lrw" instruction. This option defaults to on
17670 for CK801 and off otherwise.
17671
17672 -mistack
17673 -mno-istack
17674 Enable interrupt stack instructions; the default is off.
17675
17676 The -mistack option is required to handle the "interrupt" and "isr"
17677 function attributes.
17678
17679 -mmp
17680 Enable multiprocessor instructions; the default is off.
17681
17682 -mcp
17683 Enable coprocessor instructions; the default is off.
17684
17685 -mcache
17686 Enable coprocessor instructions; the default is off.
17687
17688 -msecurity
17689 Enable C-SKY security instructions; the default is off.
17690
17691 -mtrust
17692 Enable C-SKY trust instructions; the default is off.
17693
17694 -mdsp
17695 -medsp
17696 -mvdsp
17697 Enable C-SKY DSP, Enhanced DSP, or Vector DSP instructions,
17698 respectively. All of these options default to off.
17699
17700 -mdiv
17701 -mno-div
17702 Generate divide instructions. Default is off.
17703
17704 -msmart
17705 -mno-smart
17706 Generate code for Smart Mode, using only registers numbered 0-7 to
17707 allow use of 16-bit instructions. This option is ignored for CK801
17708 where this is the required behavior, and it defaults to on for
17709 CK802. For other targets, the default is off.
17710
17711 -mhigh-registers
17712 -mno-high-registers
17713 Generate code using the high registers numbered 16-31. This option
17714 is not supported on CK801, CK802, or CK803, and is enabled by
17715 default for other processors.
17716
17717 -manchor
17718 -mno-anchor
17719 Generate code using global anchor symbol addresses.
17720
17721 -mpushpop
17722 -mno-pushpop
17723 Generate code using "push" and "pop" instructions. This option
17724 defaults to on.
17725
17726 -mmultiple-stld
17727 -mstm
17728 -mno-multiple-stld
17729 -mno-stm
17730 Generate code using "stm" and "ldm" instructions. This option
17731 isn't supported on CK801 but is enabled by default on other
17732 processors.
17733
17734 -mconstpool
17735 -mno-constpool
17736 Create constant pools in the compiler instead of deferring it to
17737 the assembler. This option is the default and required for correct
17738 code generation on CK801 and CK802, and is optional on other
17739 processors.
17740
17741 -mstack-size
17742 -mno-stack-size
17743 Emit ".stack_size" directives for each function in the assembly
17744 output. This option defaults to off.
17745
17746 -mccrt
17747 -mno-ccrt
17748 Generate code for the C-SKY compiler runtime instead of libgcc.
17749 This option defaults to off.
17750
17751 -mbranch-cost=n
17752 Set the branch costs to roughly "n" instructions. The default is
17753 1.
17754
17755 -msched-prolog
17756 -mno-sched-prolog
17757 Permit scheduling of function prologue and epilogue sequences.
17758 Using this option can result in code that is not compliant with the
17759 C-SKY V2 ABI prologue requirements and that cannot be debugged or
17760 backtraced. It is disabled by default.
17761
17762 Darwin Options
17763 These options are defined for all architectures running the Darwin
17764 operating system.
17765
17766 FSF GCC on Darwin does not create "fat" object files; it creates an
17767 object file for the single architecture that GCC was built to target.
17768 Apple's GCC on Darwin does create "fat" files if multiple -arch options
17769 are used; it does so by running the compiler or linker multiple times
17770 and joining the results together with lipo.
17771
17772 The subtype of the file created (like ppc7400 or ppc970 or i686) is
17773 determined by the flags that specify the ISA that GCC is targeting,
17774 like -mcpu or -march. The -force_cpusubtype_ALL option can be used to
17775 override this.
17776
17777 The Darwin tools vary in their behavior when presented with an ISA
17778 mismatch. The assembler, as, only permits instructions to be used that
17779 are valid for the subtype of the file it is generating, so you cannot
17780 put 64-bit instructions in a ppc750 object file. The linker for shared
17781 libraries, /usr/bin/libtool, fails and prints an error if asked to
17782 create a shared library with a less restrictive subtype than its input
17783 files (for instance, trying to put a ppc970 object file in a ppc7400
17784 library). The linker for executables, ld, quietly gives the executable
17785 the most restrictive subtype of any of its input files.
17786
17787 -Fdir
17788 Add the framework directory dir to the head of the list of
17789 directories to be searched for header files. These directories are
17790 interleaved with those specified by -I options and are scanned in a
17791 left-to-right order.
17792
17793 A framework directory is a directory with frameworks in it. A
17794 framework is a directory with a Headers and/or PrivateHeaders
17795 directory contained directly in it that ends in .framework. The
17796 name of a framework is the name of this directory excluding the
17797 .framework. Headers associated with the framework are found in one
17798 of those two directories, with Headers being searched first. A
17799 subframework is a framework directory that is in a framework's
17800 Frameworks directory. Includes of subframework headers can only
17801 appear in a header of a framework that contains the subframework,
17802 or in a sibling subframework header. Two subframeworks are
17803 siblings if they occur in the same framework. A subframework
17804 should not have the same name as a framework; a warning is issued
17805 if this is violated. Currently a subframework cannot have
17806 subframeworks; in the future, the mechanism may be extended to
17807 support this. The standard frameworks can be found in
17808 /System/Library/Frameworks and /Library/Frameworks. An example
17809 include looks like "#include <Framework/header.h>", where Framework
17810 denotes the name of the framework and header.h is found in the
17811 PrivateHeaders or Headers directory.
17812
17813 -iframeworkdir
17814 Like -F except the directory is a treated as a system directory.
17815 The main difference between this -iframework and -F is that with
17816 -iframework the compiler does not warn about constructs contained
17817 within header files found via dir. This option is valid only for
17818 the C family of languages.
17819
17820 -gused
17821 Emit debugging information for symbols that are used. For stabs
17822 debugging format, this enables -feliminate-unused-debug-symbols.
17823 This is by default ON.
17824
17825 -gfull
17826 Emit debugging information for all symbols and types.
17827
17828 -mmacosx-version-min=version
17829 The earliest version of MacOS X that this executable will run on is
17830 version. Typical values of version include 10.1, 10.2, and 10.3.9.
17831
17832 If the compiler was built to use the system's headers by default,
17833 then the default for this option is the system version on which the
17834 compiler is running, otherwise the default is to make choices that
17835 are compatible with as many systems and code bases as possible.
17836
17837 -mkernel
17838 Enable kernel development mode. The -mkernel option sets -static,
17839 -fno-common, -fno-use-cxa-atexit, -fno-exceptions,
17840 -fno-non-call-exceptions, -fapple-kext, -fno-weak and -fno-rtti
17841 where applicable. This mode also sets -mno-altivec, -msoft-float,
17842 -fno-builtin and -mlong-branch for PowerPC targets.
17843
17844 -mone-byte-bool
17845 Override the defaults for "bool" so that "sizeof(bool)==1". By
17846 default "sizeof(bool)" is 4 when compiling for Darwin/PowerPC and 1
17847 when compiling for Darwin/x86, so this option has no effect on x86.
17848
17849 Warning: The -mone-byte-bool switch causes GCC to generate code
17850 that is not binary compatible with code generated without that
17851 switch. Using this switch may require recompiling all other
17852 modules in a program, including system libraries. Use this switch
17853 to conform to a non-default data model.
17854
17855 -mfix-and-continue
17856 -ffix-and-continue
17857 -findirect-data
17858 Generate code suitable for fast turnaround development, such as to
17859 allow GDB to dynamically load .o files into already-running
17860 programs. -findirect-data and -ffix-and-continue are provided for
17861 backwards compatibility.
17862
17863 -all_load
17864 Loads all members of static archive libraries. See man ld(1) for
17865 more information.
17866
17867 -arch_errors_fatal
17868 Cause the errors having to do with files that have the wrong
17869 architecture to be fatal.
17870
17871 -bind_at_load
17872 Causes the output file to be marked such that the dynamic linker
17873 will bind all undefined references when the file is loaded or
17874 launched.
17875
17876 -bundle
17877 Produce a Mach-o bundle format file. See man ld(1) for more
17878 information.
17879
17880 -bundle_loader executable
17881 This option specifies the executable that will load the build
17882 output file being linked. See man ld(1) for more information.
17883
17884 -dynamiclib
17885 When passed this option, GCC produces a dynamic library instead of
17886 an executable when linking, using the Darwin libtool command.
17887
17888 -force_cpusubtype_ALL
17889 This causes GCC's output file to have the ALL subtype, instead of
17890 one controlled by the -mcpu or -march option.
17891
17892 -allowable_client client_name
17893 -client_name
17894 -compatibility_version
17895 -current_version
17896 -dead_strip
17897 -dependency-file
17898 -dylib_file
17899 -dylinker_install_name
17900 -dynamic
17901 -exported_symbols_list
17902 -filelist
17903 -flat_namespace
17904 -force_flat_namespace
17905 -headerpad_max_install_names
17906 -image_base
17907 -init
17908 -install_name
17909 -keep_private_externs
17910 -multi_module
17911 -multiply_defined
17912 -multiply_defined_unused
17913 -noall_load
17914 -no_dead_strip_inits_and_terms
17915 -nofixprebinding
17916 -nomultidefs
17917 -noprebind
17918 -noseglinkedit
17919 -pagezero_size
17920 -prebind
17921 -prebind_all_twolevel_modules
17922 -private_bundle
17923 -read_only_relocs
17924 -sectalign
17925 -sectobjectsymbols
17926 -whyload
17927 -seg1addr
17928 -sectcreate
17929 -sectobjectsymbols
17930 -sectorder
17931 -segaddr
17932 -segs_read_only_addr
17933 -segs_read_write_addr
17934 -seg_addr_table
17935 -seg_addr_table_filename
17936 -seglinkedit
17937 -segprot
17938 -segs_read_only_addr
17939 -segs_read_write_addr
17940 -single_module
17941 -static
17942 -sub_library
17943 -sub_umbrella
17944 -twolevel_namespace
17945 -umbrella
17946 -undefined
17947 -unexported_symbols_list
17948 -weak_reference_mismatches
17949 -whatsloaded
17950 These options are passed to the Darwin linker. The Darwin linker
17951 man page describes them in detail.
17952
17953 DEC Alpha Options
17954 These -m options are defined for the DEC Alpha implementations:
17955
17956 -mno-soft-float
17957 -msoft-float
17958 Use (do not use) the hardware floating-point instructions for
17959 floating-point operations. When -msoft-float is specified,
17960 functions in libgcc.a are used to perform floating-point
17961 operations. Unless they are replaced by routines that emulate the
17962 floating-point operations, or compiled in such a way as to call
17963 such emulations routines, these routines issue floating-point
17964 operations. If you are compiling for an Alpha without floating-
17965 point operations, you must ensure that the library is built so as
17966 not to call them.
17967
17968 Note that Alpha implementations without floating-point operations
17969 are required to have floating-point registers.
17970
17971 -mfp-reg
17972 -mno-fp-regs
17973 Generate code that uses (does not use) the floating-point register
17974 set. -mno-fp-regs implies -msoft-float. If the floating-point
17975 register set is not used, floating-point operands are passed in
17976 integer registers as if they were integers and floating-point
17977 results are passed in $0 instead of $f0. This is a non-standard
17978 calling sequence, so any function with a floating-point argument or
17979 return value called by code compiled with -mno-fp-regs must also be
17980 compiled with that option.
17981
17982 A typical use of this option is building a kernel that does not
17983 use, and hence need not save and restore, any floating-point
17984 registers.
17985
17986 -mieee
17987 The Alpha architecture implements floating-point hardware optimized
17988 for maximum performance. It is mostly compliant with the IEEE
17989 floating-point standard. However, for full compliance, software
17990 assistance is required. This option generates code fully IEEE-
17991 compliant code except that the inexact-flag is not maintained (see
17992 below). If this option is turned on, the preprocessor macro
17993 "_IEEE_FP" is defined during compilation. The resulting code is
17994 less efficient but is able to correctly support denormalized
17995 numbers and exceptional IEEE values such as not-a-number and
17996 plus/minus infinity. Other Alpha compilers call this option
17997 -ieee_with_no_inexact.
17998
17999 -mieee-with-inexact
18000 This is like -mieee except the generated code also maintains the
18001 IEEE inexact-flag. Turning on this option causes the generated
18002 code to implement fully-compliant IEEE math. In addition to
18003 "_IEEE_FP", "_IEEE_FP_EXACT" is defined as a preprocessor macro.
18004 On some Alpha implementations the resulting code may execute
18005 significantly slower than the code generated by default. Since
18006 there is very little code that depends on the inexact-flag, you
18007 should normally not specify this option. Other Alpha compilers
18008 call this option -ieee_with_inexact.
18009
18010 -mfp-trap-mode=trap-mode
18011 This option controls what floating-point related traps are enabled.
18012 Other Alpha compilers call this option -fptm trap-mode. The trap
18013 mode can be set to one of four values:
18014
18015 n This is the default (normal) setting. The only traps that are
18016 enabled are the ones that cannot be disabled in software (e.g.,
18017 division by zero trap).
18018
18019 u In addition to the traps enabled by n, underflow traps are
18020 enabled as well.
18021
18022 su Like u, but the instructions are marked to be safe for software
18023 completion (see Alpha architecture manual for details).
18024
18025 sui Like su, but inexact traps are enabled as well.
18026
18027 -mfp-rounding-mode=rounding-mode
18028 Selects the IEEE rounding mode. Other Alpha compilers call this
18029 option -fprm rounding-mode. The rounding-mode can be one of:
18030
18031 n Normal IEEE rounding mode. Floating-point numbers are rounded
18032 towards the nearest machine number or towards the even machine
18033 number in case of a tie.
18034
18035 m Round towards minus infinity.
18036
18037 c Chopped rounding mode. Floating-point numbers are rounded
18038 towards zero.
18039
18040 d Dynamic rounding mode. A field in the floating-point control
18041 register (fpcr, see Alpha architecture reference manual)
18042 controls the rounding mode in effect. The C library
18043 initializes this register for rounding towards plus infinity.
18044 Thus, unless your program modifies the fpcr, d corresponds to
18045 round towards plus infinity.
18046
18047 -mtrap-precision=trap-precision
18048 In the Alpha architecture, floating-point traps are imprecise.
18049 This means without software assistance it is impossible to recover
18050 from a floating trap and program execution normally needs to be
18051 terminated. GCC can generate code that can assist operating system
18052 trap handlers in determining the exact location that caused a
18053 floating-point trap. Depending on the requirements of an
18054 application, different levels of precisions can be selected:
18055
18056 p Program precision. This option is the default and means a trap
18057 handler can only identify which program caused a floating-point
18058 exception.
18059
18060 f Function precision. The trap handler can determine the
18061 function that caused a floating-point exception.
18062
18063 i Instruction precision. The trap handler can determine the
18064 exact instruction that caused a floating-point exception.
18065
18066 Other Alpha compilers provide the equivalent options called
18067 -scope_safe and -resumption_safe.
18068
18069 -mieee-conformant
18070 This option marks the generated code as IEEE conformant. You must
18071 not use this option unless you also specify -mtrap-precision=i and
18072 either -mfp-trap-mode=su or -mfp-trap-mode=sui. Its only effect is
18073 to emit the line .eflag 48 in the function prologue of the
18074 generated assembly file.
18075
18076 -mbuild-constants
18077 Normally GCC examines a 32- or 64-bit integer constant to see if it
18078 can construct it from smaller constants in two or three
18079 instructions. If it cannot, it outputs the constant as a literal
18080 and generates code to load it from the data segment at run time.
18081
18082 Use this option to require GCC to construct all integer constants
18083 using code, even if it takes more instructions (the maximum is
18084 six).
18085
18086 You typically use this option to build a shared library dynamic
18087 loader. Itself a shared library, it must relocate itself in memory
18088 before it can find the variables and constants in its own data
18089 segment.
18090
18091 -mbwx
18092 -mno-bwx
18093 -mcix
18094 -mno-cix
18095 -mfix
18096 -mno-fix
18097 -mmax
18098 -mno-max
18099 Indicate whether GCC should generate code to use the optional BWX,
18100 CIX, FIX and MAX instruction sets. The default is to use the
18101 instruction sets supported by the CPU type specified via -mcpu=
18102 option or that of the CPU on which GCC was built if none is
18103 specified.
18104
18105 -mfloat-vax
18106 -mfloat-ieee
18107 Generate code that uses (does not use) VAX F and G floating-point
18108 arithmetic instead of IEEE single and double precision.
18109
18110 -mexplicit-relocs
18111 -mno-explicit-relocs
18112 Older Alpha assemblers provided no way to generate symbol
18113 relocations except via assembler macros. Use of these macros does
18114 not allow optimal instruction scheduling. GNU binutils as of
18115 version 2.12 supports a new syntax that allows the compiler to
18116 explicitly mark which relocations should apply to which
18117 instructions. This option is mostly useful for debugging, as GCC
18118 detects the capabilities of the assembler when it is built and sets
18119 the default accordingly.
18120
18121 -msmall-data
18122 -mlarge-data
18123 When -mexplicit-relocs is in effect, static data is accessed via
18124 gp-relative relocations. When -msmall-data is used, objects 8
18125 bytes long or smaller are placed in a small data area (the ".sdata"
18126 and ".sbss" sections) and are accessed via 16-bit relocations off
18127 of the $gp register. This limits the size of the small data area
18128 to 64KB, but allows the variables to be directly accessed via a
18129 single instruction.
18130
18131 The default is -mlarge-data. With this option the data area is
18132 limited to just below 2GB. Programs that require more than 2GB of
18133 data must use "malloc" or "mmap" to allocate the data in the heap
18134 instead of in the program's data segment.
18135
18136 When generating code for shared libraries, -fpic implies
18137 -msmall-data and -fPIC implies -mlarge-data.
18138
18139 -msmall-text
18140 -mlarge-text
18141 When -msmall-text is used, the compiler assumes that the code of
18142 the entire program (or shared library) fits in 4MB, and is thus
18143 reachable with a branch instruction. When -msmall-data is used,
18144 the compiler can assume that all local symbols share the same $gp
18145 value, and thus reduce the number of instructions required for a
18146 function call from 4 to 1.
18147
18148 The default is -mlarge-text.
18149
18150 -mcpu=cpu_type
18151 Set the instruction set and instruction scheduling parameters for
18152 machine type cpu_type. You can specify either the EV style name or
18153 the corresponding chip number. GCC supports scheduling parameters
18154 for the EV4, EV5 and EV6 family of processors and chooses the
18155 default values for the instruction set from the processor you
18156 specify. If you do not specify a processor type, GCC defaults to
18157 the processor on which the compiler was built.
18158
18159 Supported values for cpu_type are
18160
18161 ev4
18162 ev45
18163 21064
18164 Schedules as an EV4 and has no instruction set extensions.
18165
18166 ev5
18167 21164
18168 Schedules as an EV5 and has no instruction set extensions.
18169
18170 ev56
18171 21164a
18172 Schedules as an EV5 and supports the BWX extension.
18173
18174 pca56
18175 21164pc
18176 21164PC
18177 Schedules as an EV5 and supports the BWX and MAX extensions.
18178
18179 ev6
18180 21264
18181 Schedules as an EV6 and supports the BWX, FIX, and MAX
18182 extensions.
18183
18184 ev67
18185 21264a
18186 Schedules as an EV6 and supports the BWX, CIX, FIX, and MAX
18187 extensions.
18188
18189 Native toolchains also support the value native, which selects the
18190 best architecture option for the host processor. -mcpu=native has
18191 no effect if GCC does not recognize the processor.
18192
18193 -mtune=cpu_type
18194 Set only the instruction scheduling parameters for machine type
18195 cpu_type. The instruction set is not changed.
18196
18197 Native toolchains also support the value native, which selects the
18198 best architecture option for the host processor. -mtune=native has
18199 no effect if GCC does not recognize the processor.
18200
18201 -mmemory-latency=time
18202 Sets the latency the scheduler should assume for typical memory
18203 references as seen by the application. This number is highly
18204 dependent on the memory access patterns used by the application and
18205 the size of the external cache on the machine.
18206
18207 Valid options for time are
18208
18209 number
18210 A decimal number representing clock cycles.
18211
18212 L1
18213 L2
18214 L3
18215 main
18216 The compiler contains estimates of the number of clock cycles
18217 for "typical" EV4 & EV5 hardware for the Level 1, 2 & 3 caches
18218 (also called Dcache, Scache, and Bcache), as well as to main
18219 memory. Note that L3 is only valid for EV5.
18220
18221 eBPF Options
18222 -mframe-limit=bytes
18223 This specifies the hard limit for frame sizes, in bytes.
18224 Currently, the value that can be specified should be less than or
18225 equal to 32767. Defaults to whatever limit is imposed by the
18226 version of the Linux kernel targeted.
18227
18228 -mkernel=version
18229 This specifies the minimum version of the kernel that will run the
18230 compiled program. GCC uses this version to determine which
18231 instructions to use, what kernel helpers to allow, etc. Currently,
18232 version can be one of 4.0, 4.1, 4.2, 4.3, 4.4, 4.5, 4.6, 4.7, 4.8,
18233 4.9, 4.10, 4.11, 4.12, 4.13, 4.14, 4.15, 4.16, 4.17, 4.18, 4.19,
18234 4.20, 5.0, 5.1, 5.2, latest and native.
18235
18236 -mbig-endian
18237 Generate code for a big-endian target.
18238
18239 -mlittle-endian
18240 Generate code for a little-endian target. This is the default.
18241
18242 FR30 Options
18243 These options are defined specifically for the FR30 port.
18244
18245 -msmall-model
18246 Use the small address space model. This can produce smaller code,
18247 but it does assume that all symbolic values and addresses fit into
18248 a 20-bit range.
18249
18250 -mno-lsim
18251 Assume that runtime support has been provided and so there is no
18252 need to include the simulator library (libsim.a) on the linker
18253 command line.
18254
18255 FT32 Options
18256 These options are defined specifically for the FT32 port.
18257
18258 -msim
18259 Specifies that the program will be run on the simulator. This
18260 causes an alternate runtime startup and library to be linked. You
18261 must not use this option when generating programs that will run on
18262 real hardware; you must provide your own runtime library for
18263 whatever I/O functions are needed.
18264
18265 -mlra
18266 Enable Local Register Allocation. This is still experimental for
18267 FT32, so by default the compiler uses standard reload.
18268
18269 -mnodiv
18270 Do not use div and mod instructions.
18271
18272 -mft32b
18273 Enable use of the extended instructions of the FT32B processor.
18274
18275 -mcompress
18276 Compress all code using the Ft32B code compression scheme.
18277
18278 -mnopm
18279 Do not generate code that reads program memory.
18280
18281 FRV Options
18282 -mgpr-32
18283 Only use the first 32 general-purpose registers.
18284
18285 -mgpr-64
18286 Use all 64 general-purpose registers.
18287
18288 -mfpr-32
18289 Use only the first 32 floating-point registers.
18290
18291 -mfpr-64
18292 Use all 64 floating-point registers.
18293
18294 -mhard-float
18295 Use hardware instructions for floating-point operations.
18296
18297 -msoft-float
18298 Use library routines for floating-point operations.
18299
18300 -malloc-cc
18301 Dynamically allocate condition code registers.
18302
18303 -mfixed-cc
18304 Do not try to dynamically allocate condition code registers, only
18305 use "icc0" and "fcc0".
18306
18307 -mdword
18308 Change ABI to use double word insns.
18309
18310 -mno-dword
18311 Do not use double word instructions.
18312
18313 -mdouble
18314 Use floating-point double instructions.
18315
18316 -mno-double
18317 Do not use floating-point double instructions.
18318
18319 -mmedia
18320 Use media instructions.
18321
18322 -mno-media
18323 Do not use media instructions.
18324
18325 -mmuladd
18326 Use multiply and add/subtract instructions.
18327
18328 -mno-muladd
18329 Do not use multiply and add/subtract instructions.
18330
18331 -mfdpic
18332 Select the FDPIC ABI, which uses function descriptors to represent
18333 pointers to functions. Without any PIC/PIE-related options, it
18334 implies -fPIE. With -fpic or -fpie, it assumes GOT entries and
18335 small data are within a 12-bit range from the GOT base address;
18336 with -fPIC or -fPIE, GOT offsets are computed with 32 bits. With a
18337 bfin-elf target, this option implies -msim.
18338
18339 -minline-plt
18340 Enable inlining of PLT entries in function calls to functions that
18341 are not known to bind locally. It has no effect without -mfdpic.
18342 It's enabled by default if optimizing for speed and compiling for
18343 shared libraries (i.e., -fPIC or -fpic), or when an optimization
18344 option such as -O3 or above is present in the command line.
18345
18346 -mTLS
18347 Assume a large TLS segment when generating thread-local code.
18348
18349 -mtls
18350 Do not assume a large TLS segment when generating thread-local
18351 code.
18352
18353 -mgprel-ro
18354 Enable the use of "GPREL" relocations in the FDPIC ABI for data
18355 that is known to be in read-only sections. It's enabled by
18356 default, except for -fpic or -fpie: even though it may help make
18357 the global offset table smaller, it trades 1 instruction for 4.
18358 With -fPIC or -fPIE, it trades 3 instructions for 4, one of which
18359 may be shared by multiple symbols, and it avoids the need for a GOT
18360 entry for the referenced symbol, so it's more likely to be a win.
18361 If it is not, -mno-gprel-ro can be used to disable it.
18362
18363 -multilib-library-pic
18364 Link with the (library, not FD) pic libraries. It's implied by
18365 -mlibrary-pic, as well as by -fPIC and -fpic without -mfdpic. You
18366 should never have to use it explicitly.
18367
18368 -mlinked-fp
18369 Follow the EABI requirement of always creating a frame pointer
18370 whenever a stack frame is allocated. This option is enabled by
18371 default and can be disabled with -mno-linked-fp.
18372
18373 -mlong-calls
18374 Use indirect addressing to call functions outside the current
18375 compilation unit. This allows the functions to be placed anywhere
18376 within the 32-bit address space.
18377
18378 -malign-labels
18379 Try to align labels to an 8-byte boundary by inserting NOPs into
18380 the previous packet. This option only has an effect when VLIW
18381 packing is enabled. It doesn't create new packets; it merely adds
18382 NOPs to existing ones.
18383
18384 -mlibrary-pic
18385 Generate position-independent EABI code.
18386
18387 -macc-4
18388 Use only the first four media accumulator registers.
18389
18390 -macc-8
18391 Use all eight media accumulator registers.
18392
18393 -mpack
18394 Pack VLIW instructions.
18395
18396 -mno-pack
18397 Do not pack VLIW instructions.
18398
18399 -mno-eflags
18400 Do not mark ABI switches in e_flags.
18401
18402 -mcond-move
18403 Enable the use of conditional-move instructions (default).
18404
18405 This switch is mainly for debugging the compiler and will likely be
18406 removed in a future version.
18407
18408 -mno-cond-move
18409 Disable the use of conditional-move instructions.
18410
18411 This switch is mainly for debugging the compiler and will likely be
18412 removed in a future version.
18413
18414 -mscc
18415 Enable the use of conditional set instructions (default).
18416
18417 This switch is mainly for debugging the compiler and will likely be
18418 removed in a future version.
18419
18420 -mno-scc
18421 Disable the use of conditional set instructions.
18422
18423 This switch is mainly for debugging the compiler and will likely be
18424 removed in a future version.
18425
18426 -mcond-exec
18427 Enable the use of conditional execution (default).
18428
18429 This switch is mainly for debugging the compiler and will likely be
18430 removed in a future version.
18431
18432 -mno-cond-exec
18433 Disable the use of conditional execution.
18434
18435 This switch is mainly for debugging the compiler and will likely be
18436 removed in a future version.
18437
18438 -mvliw-branch
18439 Run a pass to pack branches into VLIW instructions (default).
18440
18441 This switch is mainly for debugging the compiler and will likely be
18442 removed in a future version.
18443
18444 -mno-vliw-branch
18445 Do not run a pass to pack branches into VLIW instructions.
18446
18447 This switch is mainly for debugging the compiler and will likely be
18448 removed in a future version.
18449
18450 -mmulti-cond-exec
18451 Enable optimization of "&&" and "||" in conditional execution
18452 (default).
18453
18454 This switch is mainly for debugging the compiler and will likely be
18455 removed in a future version.
18456
18457 -mno-multi-cond-exec
18458 Disable optimization of "&&" and "||" in conditional execution.
18459
18460 This switch is mainly for debugging the compiler and will likely be
18461 removed in a future version.
18462
18463 -mnested-cond-exec
18464 Enable nested conditional execution optimizations (default).
18465
18466 This switch is mainly for debugging the compiler and will likely be
18467 removed in a future version.
18468
18469 -mno-nested-cond-exec
18470 Disable nested conditional execution optimizations.
18471
18472 This switch is mainly for debugging the compiler and will likely be
18473 removed in a future version.
18474
18475 -moptimize-membar
18476 This switch removes redundant "membar" instructions from the
18477 compiler-generated code. It is enabled by default.
18478
18479 -mno-optimize-membar
18480 This switch disables the automatic removal of redundant "membar"
18481 instructions from the generated code.
18482
18483 -mtomcat-stats
18484 Cause gas to print out tomcat statistics.
18485
18486 -mcpu=cpu
18487 Select the processor type for which to generate code. Possible
18488 values are frv, fr550, tomcat, fr500, fr450, fr405, fr400, fr300
18489 and simple.
18490
18491 GNU/Linux Options
18492 These -m options are defined for GNU/Linux targets:
18493
18494 -mglibc
18495 Use the GNU C library. This is the default except on
18496 *-*-linux-*uclibc*, *-*-linux-*musl* and *-*-linux-*android*
18497 targets.
18498
18499 -muclibc
18500 Use uClibc C library. This is the default on *-*-linux-*uclibc*
18501 targets.
18502
18503 -mmusl
18504 Use the musl C library. This is the default on *-*-linux-*musl*
18505 targets.
18506
18507 -mbionic
18508 Use Bionic C library. This is the default on *-*-linux-*android*
18509 targets.
18510
18511 -mandroid
18512 Compile code compatible with Android platform. This is the default
18513 on *-*-linux-*android* targets.
18514
18515 When compiling, this option enables -mbionic, -fPIC,
18516 -fno-exceptions and -fno-rtti by default. When linking, this
18517 option makes the GCC driver pass Android-specific options to the
18518 linker. Finally, this option causes the preprocessor macro
18519 "__ANDROID__" to be defined.
18520
18521 -tno-android-cc
18522 Disable compilation effects of -mandroid, i.e., do not enable
18523 -mbionic, -fPIC, -fno-exceptions and -fno-rtti by default.
18524
18525 -tno-android-ld
18526 Disable linking effects of -mandroid, i.e., pass standard Linux
18527 linking options to the linker.
18528
18529 H8/300 Options
18530 These -m options are defined for the H8/300 implementations:
18531
18532 -mrelax
18533 Shorten some address references at link time, when possible; uses
18534 the linker option -relax.
18535
18536 -mh Generate code for the H8/300H.
18537
18538 -ms Generate code for the H8S.
18539
18540 -mn Generate code for the H8S and H8/300H in the normal mode. This
18541 switch must be used either with -mh or -ms.
18542
18543 -ms2600
18544 Generate code for the H8S/2600. This switch must be used with -ms.
18545
18546 -mexr
18547 Extended registers are stored on stack before execution of function
18548 with monitor attribute. Default option is -mexr. This option is
18549 valid only for H8S targets.
18550
18551 -mno-exr
18552 Extended registers are not stored on stack before execution of
18553 function with monitor attribute. Default option is -mno-exr. This
18554 option is valid only for H8S targets.
18555
18556 -mint32
18557 Make "int" data 32 bits by default.
18558
18559 -malign-300
18560 On the H8/300H and H8S, use the same alignment rules as for the
18561 H8/300. The default for the H8/300H and H8S is to align longs and
18562 floats on 4-byte boundaries. -malign-300 causes them to be aligned
18563 on 2-byte boundaries. This option has no effect on the H8/300.
18564
18565 HPPA Options
18566 These -m options are defined for the HPPA family of computers:
18567
18568 -march=architecture-type
18569 Generate code for the specified architecture. The choices for
18570 architecture-type are 1.0 for PA 1.0, 1.1 for PA 1.1, and 2.0 for
18571 PA 2.0 processors. Refer to /usr/lib/sched.models on an HP-UX
18572 system to determine the proper architecture option for your
18573 machine. Code compiled for lower numbered architectures runs on
18574 higher numbered architectures, but not the other way around.
18575
18576 -mpa-risc-1-0
18577 -mpa-risc-1-1
18578 -mpa-risc-2-0
18579 Synonyms for -march=1.0, -march=1.1, and -march=2.0 respectively.
18580
18581 -mcaller-copies
18582 The caller copies function arguments passed by hidden reference.
18583 This option should be used with care as it is not compatible with
18584 the default 32-bit runtime. However, only aggregates larger than
18585 eight bytes are passed by hidden reference and the option provides
18586 better compatibility with OpenMP.
18587
18588 -mjump-in-delay
18589 This option is ignored and provided for compatibility purposes
18590 only.
18591
18592 -mdisable-fpregs
18593 Prevent floating-point registers from being used in any manner.
18594 This is necessary for compiling kernels that perform lazy context
18595 switching of floating-point registers. If you use this option and
18596 attempt to perform floating-point operations, the compiler aborts.
18597
18598 -mdisable-indexing
18599 Prevent the compiler from using indexing address modes. This
18600 avoids some rather obscure problems when compiling MIG generated
18601 code under MACH.
18602
18603 -mno-space-regs
18604 Generate code that assumes the target has no space registers. This
18605 allows GCC to generate faster indirect calls and use unscaled index
18606 address modes.
18607
18608 Such code is suitable for level 0 PA systems and kernels.
18609
18610 -mfast-indirect-calls
18611 Generate code that assumes calls never cross space boundaries.
18612 This allows GCC to emit code that performs faster indirect calls.
18613
18614 This option does not work in the presence of shared libraries or
18615 nested functions.
18616
18617 -mfixed-range=register-range
18618 Generate code treating the given register range as fixed registers.
18619 A fixed register is one that the register allocator cannot use.
18620 This is useful when compiling kernel code. A register range is
18621 specified as two registers separated by a dash. Multiple register
18622 ranges can be specified separated by a comma.
18623
18624 -mlong-load-store
18625 Generate 3-instruction load and store sequences as sometimes
18626 required by the HP-UX 10 linker. This is equivalent to the +k
18627 option to the HP compilers.
18628
18629 -mportable-runtime
18630 Use the portable calling conventions proposed by HP for ELF
18631 systems.
18632
18633 -mgas
18634 Enable the use of assembler directives only GAS understands.
18635
18636 -mschedule=cpu-type
18637 Schedule code according to the constraints for the machine type
18638 cpu-type. The choices for cpu-type are 700 7100, 7100LC, 7200,
18639 7300 and 8000. Refer to /usr/lib/sched.models on an HP-UX system
18640 to determine the proper scheduling option for your machine. The
18641 default scheduling is 8000.
18642
18643 -mlinker-opt
18644 Enable the optimization pass in the HP-UX linker. Note this makes
18645 symbolic debugging impossible. It also triggers a bug in the HP-UX
18646 8 and HP-UX 9 linkers in which they give bogus error messages when
18647 linking some programs.
18648
18649 -msoft-float
18650 Generate output containing library calls for floating point.
18651 Warning: the requisite libraries are not available for all HPPA
18652 targets. Normally the facilities of the machine's usual C compiler
18653 are used, but this cannot be done directly in cross-compilation.
18654 You must make your own arrangements to provide suitable library
18655 functions for cross-compilation.
18656
18657 -msoft-float changes the calling convention in the output file;
18658 therefore, it is only useful if you compile all of a program with
18659 this option. In particular, you need to compile libgcc.a, the
18660 library that comes with GCC, with -msoft-float in order for this to
18661 work.
18662
18663 -msio
18664 Generate the predefine, "_SIO", for server IO. The default is
18665 -mwsio. This generates the predefines, "__hp9000s700",
18666 "__hp9000s700__" and "_WSIO", for workstation IO. These options
18667 are available under HP-UX and HI-UX.
18668
18669 -mgnu-ld
18670 Use options specific to GNU ld. This passes -shared to ld when
18671 building a shared library. It is the default when GCC is
18672 configured, explicitly or implicitly, with the GNU linker. This
18673 option does not affect which ld is called; it only changes what
18674 parameters are passed to that ld. The ld that is called is
18675 determined by the --with-ld configure option, GCC's program search
18676 path, and finally by the user's PATH. The linker used by GCC can
18677 be printed using which `gcc -print-prog-name=ld`. This option is
18678 only available on the 64-bit HP-UX GCC, i.e. configured with
18679 hppa*64*-*-hpux*.
18680
18681 -mhp-ld
18682 Use options specific to HP ld. This passes -b to ld when building
18683 a shared library and passes +Accept TypeMismatch to ld on all
18684 links. It is the default when GCC is configured, explicitly or
18685 implicitly, with the HP linker. This option does not affect which
18686 ld is called; it only changes what parameters are passed to that
18687 ld. The ld that is called is determined by the --with-ld configure
18688 option, GCC's program search path, and finally by the user's PATH.
18689 The linker used by GCC can be printed using which `gcc
18690 -print-prog-name=ld`. This option is only available on the 64-bit
18691 HP-UX GCC, i.e. configured with hppa*64*-*-hpux*.
18692
18693 -mlong-calls
18694 Generate code that uses long call sequences. This ensures that a
18695 call is always able to reach linker generated stubs. The default
18696 is to generate long calls only when the distance from the call site
18697 to the beginning of the function or translation unit, as the case
18698 may be, exceeds a predefined limit set by the branch type being
18699 used. The limits for normal calls are 7,600,000 and 240,000 bytes,
18700 respectively for the PA 2.0 and PA 1.X architectures. Sibcalls are
18701 always limited at 240,000 bytes.
18702
18703 Distances are measured from the beginning of functions when using
18704 the -ffunction-sections option, or when using the -mgas and
18705 -mno-portable-runtime options together under HP-UX with the SOM
18706 linker.
18707
18708 It is normally not desirable to use this option as it degrades
18709 performance. However, it may be useful in large applications,
18710 particularly when partial linking is used to build the application.
18711
18712 The types of long calls used depends on the capabilities of the
18713 assembler and linker, and the type of code being generated. The
18714 impact on systems that support long absolute calls, and long pic
18715 symbol-difference or pc-relative calls should be relatively small.
18716 However, an indirect call is used on 32-bit ELF systems in pic code
18717 and it is quite long.
18718
18719 -munix=unix-std
18720 Generate compiler predefines and select a startfile for the
18721 specified UNIX standard. The choices for unix-std are 93, 95 and
18722 98. 93 is supported on all HP-UX versions. 95 is available on HP-
18723 UX 10.10 and later. 98 is available on HP-UX 11.11 and later. The
18724 default values are 93 for HP-UX 10.00, 95 for HP-UX 10.10 though to
18725 11.00, and 98 for HP-UX 11.11 and later.
18726
18727 -munix=93 provides the same predefines as GCC 3.3 and 3.4.
18728 -munix=95 provides additional predefines for "XOPEN_UNIX" and
18729 "_XOPEN_SOURCE_EXTENDED", and the startfile unix95.o. -munix=98
18730 provides additional predefines for "_XOPEN_UNIX",
18731 "_XOPEN_SOURCE_EXTENDED", "_INCLUDE__STDC_A1_SOURCE" and
18732 "_INCLUDE_XOPEN_SOURCE_500", and the startfile unix98.o.
18733
18734 It is important to note that this option changes the interfaces for
18735 various library routines. It also affects the operational behavior
18736 of the C library. Thus, extreme care is needed in using this
18737 option.
18738
18739 Library code that is intended to operate with more than one UNIX
18740 standard must test, set and restore the variable
18741 "__xpg4_extended_mask" as appropriate. Most GNU software doesn't
18742 provide this capability.
18743
18744 -nolibdld
18745 Suppress the generation of link options to search libdld.sl when
18746 the -static option is specified on HP-UX 10 and later.
18747
18748 -static
18749 The HP-UX implementation of setlocale in libc has a dependency on
18750 libdld.sl. There isn't an archive version of libdld.sl. Thus,
18751 when the -static option is specified, special link options are
18752 needed to resolve this dependency.
18753
18754 On HP-UX 10 and later, the GCC driver adds the necessary options to
18755 link with libdld.sl when the -static option is specified. This
18756 causes the resulting binary to be dynamic. On the 64-bit port, the
18757 linkers generate dynamic binaries by default in any case. The
18758 -nolibdld option can be used to prevent the GCC driver from adding
18759 these link options.
18760
18761 -threads
18762 Add support for multithreading with the dce thread library under
18763 HP-UX. This option sets flags for both the preprocessor and
18764 linker.
18765
18766 IA-64 Options
18767 These are the -m options defined for the Intel IA-64 architecture.
18768
18769 -mbig-endian
18770 Generate code for a big-endian target. This is the default for HP-
18771 UX.
18772
18773 -mlittle-endian
18774 Generate code for a little-endian target. This is the default for
18775 AIX5 and GNU/Linux.
18776
18777 -mgnu-as
18778 -mno-gnu-as
18779 Generate (or don't) code for the GNU assembler. This is the
18780 default.
18781
18782 -mgnu-ld
18783 -mno-gnu-ld
18784 Generate (or don't) code for the GNU linker. This is the default.
18785
18786 -mno-pic
18787 Generate code that does not use a global pointer register. The
18788 result is not position independent code, and violates the IA-64
18789 ABI.
18790
18791 -mvolatile-asm-stop
18792 -mno-volatile-asm-stop
18793 Generate (or don't) a stop bit immediately before and after
18794 volatile asm statements.
18795
18796 -mregister-names
18797 -mno-register-names
18798 Generate (or don't) in, loc, and out register names for the stacked
18799 registers. This may make assembler output more readable.
18800
18801 -mno-sdata
18802 -msdata
18803 Disable (or enable) optimizations that use the small data section.
18804 This may be useful for working around optimizer bugs.
18805
18806 -mconstant-gp
18807 Generate code that uses a single constant global pointer value.
18808 This is useful when compiling kernel code.
18809
18810 -mauto-pic
18811 Generate code that is self-relocatable. This implies
18812 -mconstant-gp. This is useful when compiling firmware code.
18813
18814 -minline-float-divide-min-latency
18815 Generate code for inline divides of floating-point values using the
18816 minimum latency algorithm.
18817
18818 -minline-float-divide-max-throughput
18819 Generate code for inline divides of floating-point values using the
18820 maximum throughput algorithm.
18821
18822 -mno-inline-float-divide
18823 Do not generate inline code for divides of floating-point values.
18824
18825 -minline-int-divide-min-latency
18826 Generate code for inline divides of integer values using the
18827 minimum latency algorithm.
18828
18829 -minline-int-divide-max-throughput
18830 Generate code for inline divides of integer values using the
18831 maximum throughput algorithm.
18832
18833 -mno-inline-int-divide
18834 Do not generate inline code for divides of integer values.
18835
18836 -minline-sqrt-min-latency
18837 Generate code for inline square roots using the minimum latency
18838 algorithm.
18839
18840 -minline-sqrt-max-throughput
18841 Generate code for inline square roots using the maximum throughput
18842 algorithm.
18843
18844 -mno-inline-sqrt
18845 Do not generate inline code for "sqrt".
18846
18847 -mfused-madd
18848 -mno-fused-madd
18849 Do (don't) generate code that uses the fused multiply/add or
18850 multiply/subtract instructions. The default is to use these
18851 instructions.
18852
18853 -mno-dwarf2-asm
18854 -mdwarf2-asm
18855 Don't (or do) generate assembler code for the DWARF line number
18856 debugging info. This may be useful when not using the GNU
18857 assembler.
18858
18859 -mearly-stop-bits
18860 -mno-early-stop-bits
18861 Allow stop bits to be placed earlier than immediately preceding the
18862 instruction that triggered the stop bit. This can improve
18863 instruction scheduling, but does not always do so.
18864
18865 -mfixed-range=register-range
18866 Generate code treating the given register range as fixed registers.
18867 A fixed register is one that the register allocator cannot use.
18868 This is useful when compiling kernel code. A register range is
18869 specified as two registers separated by a dash. Multiple register
18870 ranges can be specified separated by a comma.
18871
18872 -mtls-size=tls-size
18873 Specify bit size of immediate TLS offsets. Valid values are 14,
18874 22, and 64.
18875
18876 -mtune=cpu-type
18877 Tune the instruction scheduling for a particular CPU, Valid values
18878 are itanium, itanium1, merced, itanium2, and mckinley.
18879
18880 -milp32
18881 -mlp64
18882 Generate code for a 32-bit or 64-bit environment. The 32-bit
18883 environment sets int, long and pointer to 32 bits. The 64-bit
18884 environment sets int to 32 bits and long and pointer to 64 bits.
18885 These are HP-UX specific flags.
18886
18887 -mno-sched-br-data-spec
18888 -msched-br-data-spec
18889 (Dis/En)able data speculative scheduling before reload. This
18890 results in generation of "ld.a" instructions and the corresponding
18891 check instructions ("ld.c" / "chk.a"). The default setting is
18892 disabled.
18893
18894 -msched-ar-data-spec
18895 -mno-sched-ar-data-spec
18896 (En/Dis)able data speculative scheduling after reload. This
18897 results in generation of "ld.a" instructions and the corresponding
18898 check instructions ("ld.c" / "chk.a"). The default setting is
18899 enabled.
18900
18901 -mno-sched-control-spec
18902 -msched-control-spec
18903 (Dis/En)able control speculative scheduling. This feature is
18904 available only during region scheduling (i.e. before reload). This
18905 results in generation of the "ld.s" instructions and the
18906 corresponding check instructions "chk.s". The default setting is
18907 disabled.
18908
18909 -msched-br-in-data-spec
18910 -mno-sched-br-in-data-spec
18911 (En/Dis)able speculative scheduling of the instructions that are
18912 dependent on the data speculative loads before reload. This is
18913 effective only with -msched-br-data-spec enabled. The default
18914 setting is enabled.
18915
18916 -msched-ar-in-data-spec
18917 -mno-sched-ar-in-data-spec
18918 (En/Dis)able speculative scheduling of the instructions that are
18919 dependent on the data speculative loads after reload. This is
18920 effective only with -msched-ar-data-spec enabled. The default
18921 setting is enabled.
18922
18923 -msched-in-control-spec
18924 -mno-sched-in-control-spec
18925 (En/Dis)able speculative scheduling of the instructions that are
18926 dependent on the control speculative loads. This is effective only
18927 with -msched-control-spec enabled. The default setting is enabled.
18928
18929 -mno-sched-prefer-non-data-spec-insns
18930 -msched-prefer-non-data-spec-insns
18931 If enabled, data-speculative instructions are chosen for schedule
18932 only if there are no other choices at the moment. This makes the
18933 use of the data speculation much more conservative. The default
18934 setting is disabled.
18935
18936 -mno-sched-prefer-non-control-spec-insns
18937 -msched-prefer-non-control-spec-insns
18938 If enabled, control-speculative instructions are chosen for
18939 schedule only if there are no other choices at the moment. This
18940 makes the use of the control speculation much more conservative.
18941 The default setting is disabled.
18942
18943 -mno-sched-count-spec-in-critical-path
18944 -msched-count-spec-in-critical-path
18945 If enabled, speculative dependencies are considered during
18946 computation of the instructions priorities. This makes the use of
18947 the speculation a bit more conservative. The default setting is
18948 disabled.
18949
18950 -msched-spec-ldc
18951 Use a simple data speculation check. This option is on by default.
18952
18953 -msched-control-spec-ldc
18954 Use a simple check for control speculation. This option is on by
18955 default.
18956
18957 -msched-stop-bits-after-every-cycle
18958 Place a stop bit after every cycle when scheduling. This option is
18959 on by default.
18960
18961 -msched-fp-mem-deps-zero-cost
18962 Assume that floating-point stores and loads are not likely to cause
18963 a conflict when placed into the same instruction group. This
18964 option is disabled by default.
18965
18966 -msel-sched-dont-check-control-spec
18967 Generate checks for control speculation in selective scheduling.
18968 This flag is disabled by default.
18969
18970 -msched-max-memory-insns=max-insns
18971 Limit on the number of memory insns per instruction group, giving
18972 lower priority to subsequent memory insns attempting to schedule in
18973 the same instruction group. Frequently useful to prevent cache bank
18974 conflicts. The default value is 1.
18975
18976 -msched-max-memory-insns-hard-limit
18977 Makes the limit specified by msched-max-memory-insns a hard limit,
18978 disallowing more than that number in an instruction group.
18979 Otherwise, the limit is "soft", meaning that non-memory operations
18980 are preferred when the limit is reached, but memory operations may
18981 still be scheduled.
18982
18983 LM32 Options
18984 These -m options are defined for the LatticeMico32 architecture:
18985
18986 -mbarrel-shift-enabled
18987 Enable barrel-shift instructions.
18988
18989 -mdivide-enabled
18990 Enable divide and modulus instructions.
18991
18992 -mmultiply-enabled
18993 Enable multiply instructions.
18994
18995 -msign-extend-enabled
18996 Enable sign extend instructions.
18997
18998 -muser-enabled
18999 Enable user-defined instructions.
19000
19001 M32C Options
19002 -mcpu=name
19003 Select the CPU for which code is generated. name may be one of r8c
19004 for the R8C/Tiny series, m16c for the M16C (up to /60) series,
19005 m32cm for the M16C/80 series, or m32c for the M32C/80 series.
19006
19007 -msim
19008 Specifies that the program will be run on the simulator. This
19009 causes an alternate runtime library to be linked in which supports,
19010 for example, file I/O. You must not use this option when
19011 generating programs that will run on real hardware; you must
19012 provide your own runtime library for whatever I/O functions are
19013 needed.
19014
19015 -memregs=number
19016 Specifies the number of memory-based pseudo-registers GCC uses
19017 during code generation. These pseudo-registers are used like real
19018 registers, so there is a tradeoff between GCC's ability to fit the
19019 code into available registers, and the performance penalty of using
19020 memory instead of registers. Note that all modules in a program
19021 must be compiled with the same value for this option. Because of
19022 that, you must not use this option with GCC's default runtime
19023 libraries.
19024
19025 M32R/D Options
19026 These -m options are defined for Renesas M32R/D architectures:
19027
19028 -m32r2
19029 Generate code for the M32R/2.
19030
19031 -m32rx
19032 Generate code for the M32R/X.
19033
19034 -m32r
19035 Generate code for the M32R. This is the default.
19036
19037 -mmodel=small
19038 Assume all objects live in the lower 16MB of memory (so that their
19039 addresses can be loaded with the "ld24" instruction), and assume
19040 all subroutines are reachable with the "bl" instruction. This is
19041 the default.
19042
19043 The addressability of a particular object can be set with the
19044 "model" attribute.
19045
19046 -mmodel=medium
19047 Assume objects may be anywhere in the 32-bit address space (the
19048 compiler generates "seth/add3" instructions to load their
19049 addresses), and assume all subroutines are reachable with the "bl"
19050 instruction.
19051
19052 -mmodel=large
19053 Assume objects may be anywhere in the 32-bit address space (the
19054 compiler generates "seth/add3" instructions to load their
19055 addresses), and assume subroutines may not be reachable with the
19056 "bl" instruction (the compiler generates the much slower
19057 "seth/add3/jl" instruction sequence).
19058
19059 -msdata=none
19060 Disable use of the small data area. Variables are put into one of
19061 ".data", ".bss", or ".rodata" (unless the "section" attribute has
19062 been specified). This is the default.
19063
19064 The small data area consists of sections ".sdata" and ".sbss".
19065 Objects may be explicitly put in the small data area with the
19066 "section" attribute using one of these sections.
19067
19068 -msdata=sdata
19069 Put small global and static data in the small data area, but do not
19070 generate special code to reference them.
19071
19072 -msdata=use
19073 Put small global and static data in the small data area, and
19074 generate special instructions to reference them.
19075
19076 -G num
19077 Put global and static objects less than or equal to num bytes into
19078 the small data or BSS sections instead of the normal data or BSS
19079 sections. The default value of num is 8. The -msdata option must
19080 be set to one of sdata or use for this option to have any effect.
19081
19082 All modules should be compiled with the same -G num value.
19083 Compiling with different values of num may or may not work; if it
19084 doesn't the linker gives an error message---incorrect code is not
19085 generated.
19086
19087 -mdebug
19088 Makes the M32R-specific code in the compiler display some
19089 statistics that might help in debugging programs.
19090
19091 -malign-loops
19092 Align all loops to a 32-byte boundary.
19093
19094 -mno-align-loops
19095 Do not enforce a 32-byte alignment for loops. This is the default.
19096
19097 -missue-rate=number
19098 Issue number instructions per cycle. number can only be 1 or 2.
19099
19100 -mbranch-cost=number
19101 number can only be 1 or 2. If it is 1 then branches are preferred
19102 over conditional code, if it is 2, then the opposite applies.
19103
19104 -mflush-trap=number
19105 Specifies the trap number to use to flush the cache. The default
19106 is 12. Valid numbers are between 0 and 15 inclusive.
19107
19108 -mno-flush-trap
19109 Specifies that the cache cannot be flushed by using a trap.
19110
19111 -mflush-func=name
19112 Specifies the name of the operating system function to call to
19113 flush the cache. The default is _flush_cache, but a function call
19114 is only used if a trap is not available.
19115
19116 -mno-flush-func
19117 Indicates that there is no OS function for flushing the cache.
19118
19119 M680x0 Options
19120 These are the -m options defined for M680x0 and ColdFire processors.
19121 The default settings depend on which architecture was selected when the
19122 compiler was configured; the defaults for the most common choices are
19123 given below.
19124
19125 -march=arch
19126 Generate code for a specific M680x0 or ColdFire instruction set
19127 architecture. Permissible values of arch for M680x0 architectures
19128 are: 68000, 68010, 68020, 68030, 68040, 68060 and cpu32. ColdFire
19129 architectures are selected according to Freescale's ISA
19130 classification and the permissible values are: isaa, isaaplus, isab
19131 and isac.
19132
19133 GCC defines a macro "__mcfarch__" whenever it is generating code
19134 for a ColdFire target. The arch in this macro is one of the -march
19135 arguments given above.
19136
19137 When used together, -march and -mtune select code that runs on a
19138 family of similar processors but that is optimized for a particular
19139 microarchitecture.
19140
19141 -mcpu=cpu
19142 Generate code for a specific M680x0 or ColdFire processor. The
19143 M680x0 cpus are: 68000, 68010, 68020, 68030, 68040, 68060, 68302,
19144 68332 and cpu32. The ColdFire cpus are given by the table below,
19145 which also classifies the CPUs into families:
19146
19147 Family : -mcpu arguments
19148 51 : 51 51ac 51ag 51cn 51em 51je 51jf 51jg 51jm 51mm 51qe 51qm
19149 5206 : 5202 5204 5206
19150 5206e : 5206e
19151 5208 : 5207 5208
19152 5211a : 5210a 5211a
19153 5213 : 5211 5212 5213
19154 5216 : 5214 5216
19155 52235 : 52230 52231 52232 52233 52234 52235
19156 5225 : 5224 5225
19157 52259 : 52252 52254 52255 52256 52258 52259
19158 5235 : 5232 5233 5234 5235 523x
19159 5249 : 5249
19160 5250 : 5250
19161 5271 : 5270 5271
19162 5272 : 5272
19163 5275 : 5274 5275
19164 5282 : 5280 5281 5282 528x
19165 53017 : 53011 53012 53013 53014 53015 53016 53017
19166 5307 : 5307
19167 5329 : 5327 5328 5329 532x
19168 5373 : 5372 5373 537x
19169 5407 : 5407
19170 5475 : 5470 5471 5472 5473 5474 5475 547x 5480 5481 5482 5483 5484
19171 5485
19172
19173 -mcpu=cpu overrides -march=arch if arch is compatible with cpu.
19174 Other combinations of -mcpu and -march are rejected.
19175
19176 GCC defines the macro "__mcf_cpu_cpu" when ColdFire target cpu is
19177 selected. It also defines "__mcf_family_family", where the value
19178 of family is given by the table above.
19179
19180 -mtune=tune
19181 Tune the code for a particular microarchitecture within the
19182 constraints set by -march and -mcpu. The M680x0 microarchitectures
19183 are: 68000, 68010, 68020, 68030, 68040, 68060 and cpu32. The
19184 ColdFire microarchitectures are: cfv1, cfv2, cfv3, cfv4 and cfv4e.
19185
19186 You can also use -mtune=68020-40 for code that needs to run
19187 relatively well on 68020, 68030 and 68040 targets. -mtune=68020-60
19188 is similar but includes 68060 targets as well. These two options
19189 select the same tuning decisions as -m68020-40 and -m68020-60
19190 respectively.
19191
19192 GCC defines the macros "__mcarch" and "__mcarch__" when tuning for
19193 680x0 architecture arch. It also defines "mcarch" unless either
19194 -ansi or a non-GNU -std option is used. If GCC is tuning for a
19195 range of architectures, as selected by -mtune=68020-40 or
19196 -mtune=68020-60, it defines the macros for every architecture in
19197 the range.
19198
19199 GCC also defines the macro "__muarch__" when tuning for ColdFire
19200 microarchitecture uarch, where uarch is one of the arguments given
19201 above.
19202
19203 -m68000
19204 -mc68000
19205 Generate output for a 68000. This is the default when the compiler
19206 is configured for 68000-based systems. It is equivalent to
19207 -march=68000.
19208
19209 Use this option for microcontrollers with a 68000 or EC000 core,
19210 including the 68008, 68302, 68306, 68307, 68322, 68328 and 68356.
19211
19212 -m68010
19213 Generate output for a 68010. This is the default when the compiler
19214 is configured for 68010-based systems. It is equivalent to
19215 -march=68010.
19216
19217 -m68020
19218 -mc68020
19219 Generate output for a 68020. This is the default when the compiler
19220 is configured for 68020-based systems. It is equivalent to
19221 -march=68020.
19222
19223 -m68030
19224 Generate output for a 68030. This is the default when the compiler
19225 is configured for 68030-based systems. It is equivalent to
19226 -march=68030.
19227
19228 -m68040
19229 Generate output for a 68040. This is the default when the compiler
19230 is configured for 68040-based systems. It is equivalent to
19231 -march=68040.
19232
19233 This option inhibits the use of 68881/68882 instructions that have
19234 to be emulated by software on the 68040. Use this option if your
19235 68040 does not have code to emulate those instructions.
19236
19237 -m68060
19238 Generate output for a 68060. This is the default when the compiler
19239 is configured for 68060-based systems. It is equivalent to
19240 -march=68060.
19241
19242 This option inhibits the use of 68020 and 68881/68882 instructions
19243 that have to be emulated by software on the 68060. Use this option
19244 if your 68060 does not have code to emulate those instructions.
19245
19246 -mcpu32
19247 Generate output for a CPU32. This is the default when the compiler
19248 is configured for CPU32-based systems. It is equivalent to
19249 -march=cpu32.
19250
19251 Use this option for microcontrollers with a CPU32 or CPU32+ core,
19252 including the 68330, 68331, 68332, 68333, 68334, 68336, 68340,
19253 68341, 68349 and 68360.
19254
19255 -m5200
19256 Generate output for a 520X ColdFire CPU. This is the default when
19257 the compiler is configured for 520X-based systems. It is
19258 equivalent to -mcpu=5206, and is now deprecated in favor of that
19259 option.
19260
19261 Use this option for microcontroller with a 5200 core, including the
19262 MCF5202, MCF5203, MCF5204 and MCF5206.
19263
19264 -m5206e
19265 Generate output for a 5206e ColdFire CPU. The option is now
19266 deprecated in favor of the equivalent -mcpu=5206e.
19267
19268 -m528x
19269 Generate output for a member of the ColdFire 528X family. The
19270 option is now deprecated in favor of the equivalent -mcpu=528x.
19271
19272 -m5307
19273 Generate output for a ColdFire 5307 CPU. The option is now
19274 deprecated in favor of the equivalent -mcpu=5307.
19275
19276 -m5407
19277 Generate output for a ColdFire 5407 CPU. The option is now
19278 deprecated in favor of the equivalent -mcpu=5407.
19279
19280 -mcfv4e
19281 Generate output for a ColdFire V4e family CPU (e.g. 547x/548x).
19282 This includes use of hardware floating-point instructions. The
19283 option is equivalent to -mcpu=547x, and is now deprecated in favor
19284 of that option.
19285
19286 -m68020-40
19287 Generate output for a 68040, without using any of the new
19288 instructions. This results in code that can run relatively
19289 efficiently on either a 68020/68881 or a 68030 or a 68040. The
19290 generated code does use the 68881 instructions that are emulated on
19291 the 68040.
19292
19293 The option is equivalent to -march=68020 -mtune=68020-40.
19294
19295 -m68020-60
19296 Generate output for a 68060, without using any of the new
19297 instructions. This results in code that can run relatively
19298 efficiently on either a 68020/68881 or a 68030 or a 68040. The
19299 generated code does use the 68881 instructions that are emulated on
19300 the 68060.
19301
19302 The option is equivalent to -march=68020 -mtune=68020-60.
19303
19304 -mhard-float
19305 -m68881
19306 Generate floating-point instructions. This is the default for
19307 68020 and above, and for ColdFire devices that have an FPU. It
19308 defines the macro "__HAVE_68881__" on M680x0 targets and
19309 "__mcffpu__" on ColdFire targets.
19310
19311 -msoft-float
19312 Do not generate floating-point instructions; use library calls
19313 instead. This is the default for 68000, 68010, and 68832 targets.
19314 It is also the default for ColdFire devices that have no FPU.
19315
19316 -mdiv
19317 -mno-div
19318 Generate (do not generate) ColdFire hardware divide and remainder
19319 instructions. If -march is used without -mcpu, the default is "on"
19320 for ColdFire architectures and "off" for M680x0 architectures.
19321 Otherwise, the default is taken from the target CPU (either the
19322 default CPU, or the one specified by -mcpu). For example, the
19323 default is "off" for -mcpu=5206 and "on" for -mcpu=5206e.
19324
19325 GCC defines the macro "__mcfhwdiv__" when this option is enabled.
19326
19327 -mshort
19328 Consider type "int" to be 16 bits wide, like "short int".
19329 Additionally, parameters passed on the stack are also aligned to a
19330 16-bit boundary even on targets whose API mandates promotion to
19331 32-bit.
19332
19333 -mno-short
19334 Do not consider type "int" to be 16 bits wide. This is the
19335 default.
19336
19337 -mnobitfield
19338 -mno-bitfield
19339 Do not use the bit-field instructions. The -m68000, -mcpu32 and
19340 -m5200 options imply -mnobitfield.
19341
19342 -mbitfield
19343 Do use the bit-field instructions. The -m68020 option implies
19344 -mbitfield. This is the default if you use a configuration
19345 designed for a 68020.
19346
19347 -mrtd
19348 Use a different function-calling convention, in which functions
19349 that take a fixed number of arguments return with the "rtd"
19350 instruction, which pops their arguments while returning. This
19351 saves one instruction in the caller since there is no need to pop
19352 the arguments there.
19353
19354 This calling convention is incompatible with the one normally used
19355 on Unix, so you cannot use it if you need to call libraries
19356 compiled with the Unix compiler.
19357
19358 Also, you must provide function prototypes for all functions that
19359 take variable numbers of arguments (including "printf"); otherwise
19360 incorrect code is generated for calls to those functions.
19361
19362 In addition, seriously incorrect code results if you call a
19363 function with too many arguments. (Normally, extra arguments are
19364 harmlessly ignored.)
19365
19366 The "rtd" instruction is supported by the 68010, 68020, 68030,
19367 68040, 68060 and CPU32 processors, but not by the 68000 or 5200.
19368
19369 The default is -mno-rtd.
19370
19371 -malign-int
19372 -mno-align-int
19373 Control whether GCC aligns "int", "long", "long long", "float",
19374 "double", and "long double" variables on a 32-bit boundary
19375 (-malign-int) or a 16-bit boundary (-mno-align-int). Aligning
19376 variables on 32-bit boundaries produces code that runs somewhat
19377 faster on processors with 32-bit busses at the expense of more
19378 memory.
19379
19380 Warning: if you use the -malign-int switch, GCC aligns structures
19381 containing the above types differently than most published
19382 application binary interface specifications for the m68k.
19383
19384 Use the pc-relative addressing mode of the 68000 directly, instead
19385 of using a global offset table. At present, this option implies
19386 -fpic, allowing at most a 16-bit offset for pc-relative addressing.
19387 -fPIC is not presently supported with -mpcrel, though this could be
19388 supported for 68020 and higher processors.
19389
19390 -mno-strict-align
19391 -mstrict-align
19392 Do not (do) assume that unaligned memory references are handled by
19393 the system.
19394
19395 -msep-data
19396 Generate code that allows the data segment to be located in a
19397 different area of memory from the text segment. This allows for
19398 execute-in-place in an environment without virtual memory
19399 management. This option implies -fPIC.
19400
19401 -mno-sep-data
19402 Generate code that assumes that the data segment follows the text
19403 segment. This is the default.
19404
19405 -mid-shared-library
19406 Generate code that supports shared libraries via the library ID
19407 method. This allows for execute-in-place and shared libraries in
19408 an environment without virtual memory management. This option
19409 implies -fPIC.
19410
19411 -mno-id-shared-library
19412 Generate code that doesn't assume ID-based shared libraries are
19413 being used. This is the default.
19414
19415 -mshared-library-id=n
19416 Specifies the identification number of the ID-based shared library
19417 being compiled. Specifying a value of 0 generates more compact
19418 code; specifying other values forces the allocation of that number
19419 to the current library, but is no more space- or time-efficient
19420 than omitting this option.
19421
19422 -mxgot
19423 -mno-xgot
19424 When generating position-independent code for ColdFire, generate
19425 code that works if the GOT has more than 8192 entries. This code
19426 is larger and slower than code generated without this option. On
19427 M680x0 processors, this option is not needed; -fPIC suffices.
19428
19429 GCC normally uses a single instruction to load values from the GOT.
19430 While this is relatively efficient, it only works if the GOT is
19431 smaller than about 64k. Anything larger causes the linker to
19432 report an error such as:
19433
19434 relocation truncated to fit: R_68K_GOT16O foobar
19435
19436 If this happens, you should recompile your code with -mxgot. It
19437 should then work with very large GOTs. However, code generated
19438 with -mxgot is less efficient, since it takes 4 instructions to
19439 fetch the value of a global symbol.
19440
19441 Note that some linkers, including newer versions of the GNU linker,
19442 can create multiple GOTs and sort GOT entries. If you have such a
19443 linker, you should only need to use -mxgot when compiling a single
19444 object file that accesses more than 8192 GOT entries. Very few do.
19445
19446 These options have no effect unless GCC is generating position-
19447 independent code.
19448
19449 -mlong-jump-table-offsets
19450 Use 32-bit offsets in "switch" tables. The default is to use
19451 16-bit offsets.
19452
19453 MCore Options
19454 These are the -m options defined for the Motorola M*Core processors.
19455
19456 -mhardlit
19457 -mno-hardlit
19458 Inline constants into the code stream if it can be done in two
19459 instructions or less.
19460
19461 -mdiv
19462 -mno-div
19463 Use the divide instruction. (Enabled by default).
19464
19465 -mrelax-immediate
19466 -mno-relax-immediate
19467 Allow arbitrary-sized immediates in bit operations.
19468
19469 -mwide-bitfields
19470 -mno-wide-bitfields
19471 Always treat bit-fields as "int"-sized.
19472
19473 -m4byte-functions
19474 -mno-4byte-functions
19475 Force all functions to be aligned to a 4-byte boundary.
19476
19477 -mcallgraph-data
19478 -mno-callgraph-data
19479 Emit callgraph information.
19480
19481 -mslow-bytes
19482 -mno-slow-bytes
19483 Prefer word access when reading byte quantities.
19484
19485 -mlittle-endian
19486 -mbig-endian
19487 Generate code for a little-endian target.
19488
19489 -m210
19490 -m340
19491 Generate code for the 210 processor.
19492
19493 -mno-lsim
19494 Assume that runtime support has been provided and so omit the
19495 simulator library (libsim.a) from the linker command line.
19496
19497 -mstack-increment=size
19498 Set the maximum amount for a single stack increment operation.
19499 Large values can increase the speed of programs that contain
19500 functions that need a large amount of stack space, but they can
19501 also trigger a segmentation fault if the stack is extended too
19502 much. The default value is 0x1000.
19503
19504 MeP Options
19505 -mabsdiff
19506 Enables the "abs" instruction, which is the absolute difference
19507 between two registers.
19508
19509 -mall-opts
19510 Enables all the optional instructions---average, multiply, divide,
19511 bit operations, leading zero, absolute difference, min/max, clip,
19512 and saturation.
19513
19514 -maverage
19515 Enables the "ave" instruction, which computes the average of two
19516 registers.
19517
19518 -mbased=n
19519 Variables of size n bytes or smaller are placed in the ".based"
19520 section by default. Based variables use the $tp register as a base
19521 register, and there is a 128-byte limit to the ".based" section.
19522
19523 -mbitops
19524 Enables the bit operation instructions---bit test ("btstm"), set
19525 ("bsetm"), clear ("bclrm"), invert ("bnotm"), and test-and-set
19526 ("tas").
19527
19528 -mc=name
19529 Selects which section constant data is placed in. name may be
19530 tiny, near, or far.
19531
19532 -mclip
19533 Enables the "clip" instruction. Note that -mclip is not useful
19534 unless you also provide -mminmax.
19535
19536 -mconfig=name
19537 Selects one of the built-in core configurations. Each MeP chip has
19538 one or more modules in it; each module has a core CPU and a variety
19539 of coprocessors, optional instructions, and peripherals. The
19540 "MeP-Integrator" tool, not part of GCC, provides these
19541 configurations through this option; using this option is the same
19542 as using all the corresponding command-line options. The default
19543 configuration is default.
19544
19545 -mcop
19546 Enables the coprocessor instructions. By default, this is a 32-bit
19547 coprocessor. Note that the coprocessor is normally enabled via the
19548 -mconfig= option.
19549
19550 -mcop32
19551 Enables the 32-bit coprocessor's instructions.
19552
19553 -mcop64
19554 Enables the 64-bit coprocessor's instructions.
19555
19556 -mivc2
19557 Enables IVC2 scheduling. IVC2 is a 64-bit VLIW coprocessor.
19558
19559 -mdc
19560 Causes constant variables to be placed in the ".near" section.
19561
19562 -mdiv
19563 Enables the "div" and "divu" instructions.
19564
19565 -meb
19566 Generate big-endian code.
19567
19568 -mel
19569 Generate little-endian code.
19570
19571 -mio-volatile
19572 Tells the compiler that any variable marked with the "io" attribute
19573 is to be considered volatile.
19574
19575 -ml Causes variables to be assigned to the ".far" section by default.
19576
19577 -mleadz
19578 Enables the "leadz" (leading zero) instruction.
19579
19580 -mm Causes variables to be assigned to the ".near" section by default.
19581
19582 -mminmax
19583 Enables the "min" and "max" instructions.
19584
19585 -mmult
19586 Enables the multiplication and multiply-accumulate instructions.
19587
19588 -mno-opts
19589 Disables all the optional instructions enabled by -mall-opts.
19590
19591 -mrepeat
19592 Enables the "repeat" and "erepeat" instructions, used for low-
19593 overhead looping.
19594
19595 -ms Causes all variables to default to the ".tiny" section. Note that
19596 there is a 65536-byte limit to this section. Accesses to these
19597 variables use the %gp base register.
19598
19599 -msatur
19600 Enables the saturation instructions. Note that the compiler does
19601 not currently generate these itself, but this option is included
19602 for compatibility with other tools, like "as".
19603
19604 -msdram
19605 Link the SDRAM-based runtime instead of the default ROM-based
19606 runtime.
19607
19608 -msim
19609 Link the simulator run-time libraries.
19610
19611 -msimnovec
19612 Link the simulator runtime libraries, excluding built-in support
19613 for reset and exception vectors and tables.
19614
19615 -mtf
19616 Causes all functions to default to the ".far" section. Without
19617 this option, functions default to the ".near" section.
19618
19619 -mtiny=n
19620 Variables that are n bytes or smaller are allocated to the ".tiny"
19621 section. These variables use the $gp base register. The default
19622 for this option is 4, but note that there's a 65536-byte limit to
19623 the ".tiny" section.
19624
19625 MicroBlaze Options
19626 -msoft-float
19627 Use software emulation for floating point (default).
19628
19629 -mhard-float
19630 Use hardware floating-point instructions.
19631
19632 -mmemcpy
19633 Do not optimize block moves, use "memcpy".
19634
19635 -mno-clearbss
19636 This option is deprecated. Use -fno-zero-initialized-in-bss
19637 instead.
19638
19639 -mcpu=cpu-type
19640 Use features of, and schedule code for, the given CPU. Supported
19641 values are in the format vX.YY.Z, where X is a major version, YY is
19642 the minor version, and Z is compatibility code. Example values are
19643 v3.00.a, v4.00.b, v5.00.a, v5.00.b, v6.00.a.
19644
19645 -mxl-soft-mul
19646 Use software multiply emulation (default).
19647
19648 -mxl-soft-div
19649 Use software emulation for divides (default).
19650
19651 -mxl-barrel-shift
19652 Use the hardware barrel shifter.
19653
19654 -mxl-pattern-compare
19655 Use pattern compare instructions.
19656
19657 -msmall-divides
19658 Use table lookup optimization for small signed integer divisions.
19659
19660 -mxl-stack-check
19661 This option is deprecated. Use -fstack-check instead.
19662
19663 -mxl-gp-opt
19664 Use GP-relative ".sdata"/".sbss" sections.
19665
19666 -mxl-multiply-high
19667 Use multiply high instructions for high part of 32x32 multiply.
19668
19669 -mxl-float-convert
19670 Use hardware floating-point conversion instructions.
19671
19672 -mxl-float-sqrt
19673 Use hardware floating-point square root instruction.
19674
19675 -mbig-endian
19676 Generate code for a big-endian target.
19677
19678 -mlittle-endian
19679 Generate code for a little-endian target.
19680
19681 -mxl-reorder
19682 Use reorder instructions (swap and byte reversed load/store).
19683
19684 -mxl-mode-app-model
19685 Select application model app-model. Valid models are
19686
19687 executable
19688 normal executable (default), uses startup code crt0.o.
19689
19690 -mpic-data-is-text-relative
19691 Assume that the displacement between the text and data segments
19692 is fixed at static link time. This allows data to be
19693 referenced by offset from start of text address instead of GOT
19694 since PC-relative addressing is not supported.
19695
19696 xmdstub
19697 for use with Xilinx Microprocessor Debugger (XMD) based
19698 software intrusive debug agent called xmdstub. This uses
19699 startup file crt1.o and sets the start address of the program
19700 to 0x800.
19701
19702 bootstrap
19703 for applications that are loaded using a bootloader. This
19704 model uses startup file crt2.o which does not contain a
19705 processor reset vector handler. This is suitable for
19706 transferring control on a processor reset to the bootloader
19707 rather than the application.
19708
19709 novectors
19710 for applications that do not require any of the MicroBlaze
19711 vectors. This option may be useful for applications running
19712 within a monitoring application. This model uses crt3.o as a
19713 startup file.
19714
19715 Option -xl-mode-app-model is a deprecated alias for -mxl-mode-app-
19716 model.
19717
19718 MIPS Options
19719 -EB Generate big-endian code.
19720
19721 -EL Generate little-endian code. This is the default for mips*el-*-*
19722 configurations.
19723
19724 -march=arch
19725 Generate code that runs on arch, which can be the name of a generic
19726 MIPS ISA, or the name of a particular processor. The ISA names
19727 are: mips1, mips2, mips3, mips4, mips32, mips32r2, mips32r3,
19728 mips32r5, mips32r6, mips64, mips64r2, mips64r3, mips64r5 and
19729 mips64r6. The processor names are: 4kc, 4km, 4kp, 4ksc, 4kec,
19730 4kem, 4kep, 4ksd, 5kc, 5kf, 20kc, 24kc, 24kf2_1, 24kf1_1, 24kec,
19731 24kef2_1, 24kef1_1, 34kc, 34kf2_1, 34kf1_1, 34kn, 74kc, 74kf2_1,
19732 74kf1_1, 74kf3_2, 1004kc, 1004kf2_1, 1004kf1_1, i6400, i6500,
19733 interaptiv, loongson2e, loongson2f, loongson3a, gs464, gs464e,
19734 gs264e, m4k, m14k, m14kc, m14ke, m14kec, m5100, m5101, octeon,
19735 octeon+, octeon2, octeon3, orion, p5600, p6600, r2000, r3000,
19736 r3900, r4000, r4400, r4600, r4650, r4700, r5900, r6000, r8000,
19737 rm7000, rm9000, r10000, r12000, r14000, r16000, sb1, sr71000,
19738 vr4100, vr4111, vr4120, vr4130, vr4300, vr5000, vr5400, vr5500, xlr
19739 and xlp. The special value from-abi selects the most compatible
19740 architecture for the selected ABI (that is, mips1 for 32-bit ABIs
19741 and mips3 for 64-bit ABIs).
19742
19743 The native Linux/GNU toolchain also supports the value native,
19744 which selects the best architecture option for the host processor.
19745 -march=native has no effect if GCC does not recognize the
19746 processor.
19747
19748 In processor names, a final 000 can be abbreviated as k (for
19749 example, -march=r2k). Prefixes are optional, and vr may be written
19750 r.
19751
19752 Names of the form nf2_1 refer to processors with FPUs clocked at
19753 half the rate of the core, names of the form nf1_1 refer to
19754 processors with FPUs clocked at the same rate as the core, and
19755 names of the form nf3_2 refer to processors with FPUs clocked a
19756 ratio of 3:2 with respect to the core. For compatibility reasons,
19757 nf is accepted as a synonym for nf2_1 while nx and bfx are accepted
19758 as synonyms for nf1_1.
19759
19760 GCC defines two macros based on the value of this option. The
19761 first is "_MIPS_ARCH", which gives the name of target architecture,
19762 as a string. The second has the form "_MIPS_ARCH_foo", where foo
19763 is the capitalized value of "_MIPS_ARCH". For example,
19764 -march=r2000 sets "_MIPS_ARCH" to "r2000" and defines the macro
19765 "_MIPS_ARCH_R2000".
19766
19767 Note that the "_MIPS_ARCH" macro uses the processor names given
19768 above. In other words, it has the full prefix and does not
19769 abbreviate 000 as k. In the case of from-abi, the macro names the
19770 resolved architecture (either "mips1" or "mips3"). It names the
19771 default architecture when no -march option is given.
19772
19773 -mtune=arch
19774 Optimize for arch. Among other things, this option controls the
19775 way instructions are scheduled, and the perceived cost of
19776 arithmetic operations. The list of arch values is the same as for
19777 -march.
19778
19779 When this option is not used, GCC optimizes for the processor
19780 specified by -march. By using -march and -mtune together, it is
19781 possible to generate code that runs on a family of processors, but
19782 optimize the code for one particular member of that family.
19783
19784 -mtune defines the macros "_MIPS_TUNE" and "_MIPS_TUNE_foo", which
19785 work in the same way as the -march ones described above.
19786
19787 -mips1
19788 Equivalent to -march=mips1.
19789
19790 -mips2
19791 Equivalent to -march=mips2.
19792
19793 -mips3
19794 Equivalent to -march=mips3.
19795
19796 -mips4
19797 Equivalent to -march=mips4.
19798
19799 -mips32
19800 Equivalent to -march=mips32.
19801
19802 -mips32r3
19803 Equivalent to -march=mips32r3.
19804
19805 -mips32r5
19806 Equivalent to -march=mips32r5.
19807
19808 -mips32r6
19809 Equivalent to -march=mips32r6.
19810
19811 -mips64
19812 Equivalent to -march=mips64.
19813
19814 -mips64r2
19815 Equivalent to -march=mips64r2.
19816
19817 -mips64r3
19818 Equivalent to -march=mips64r3.
19819
19820 -mips64r5
19821 Equivalent to -march=mips64r5.
19822
19823 -mips64r6
19824 Equivalent to -march=mips64r6.
19825
19826 -mips16
19827 -mno-mips16
19828 Generate (do not generate) MIPS16 code. If GCC is targeting a
19829 MIPS32 or MIPS64 architecture, it makes use of the MIPS16e ASE.
19830
19831 MIPS16 code generation can also be controlled on a per-function
19832 basis by means of "mips16" and "nomips16" attributes.
19833
19834 -mflip-mips16
19835 Generate MIPS16 code on alternating functions. This option is
19836 provided for regression testing of mixed MIPS16/non-MIPS16 code
19837 generation, and is not intended for ordinary use in compiling user
19838 code.
19839
19840 -minterlink-compressed
19841 -mno-interlink-compressed
19842 Require (do not require) that code using the standard
19843 (uncompressed) MIPS ISA be link-compatible with MIPS16 and
19844 microMIPS code, and vice versa.
19845
19846 For example, code using the standard ISA encoding cannot jump
19847 directly to MIPS16 or microMIPS code; it must either use a call or
19848 an indirect jump. -minterlink-compressed therefore disables direct
19849 jumps unless GCC knows that the target of the jump is not
19850 compressed.
19851
19852 -minterlink-mips16
19853 -mno-interlink-mips16
19854 Aliases of -minterlink-compressed and -mno-interlink-compressed.
19855 These options predate the microMIPS ASE and are retained for
19856 backwards compatibility.
19857
19858 -mabi=32
19859 -mabi=o64
19860 -mabi=n32
19861 -mabi=64
19862 -mabi=eabi
19863 Generate code for the given ABI.
19864
19865 Note that the EABI has a 32-bit and a 64-bit variant. GCC normally
19866 generates 64-bit code when you select a 64-bit architecture, but
19867 you can use -mgp32 to get 32-bit code instead.
19868
19869 For information about the O64 ABI, see
19870 <http://gcc.gnu.org/projects/mipso64-abi.html>.
19871
19872 GCC supports a variant of the o32 ABI in which floating-point
19873 registers are 64 rather than 32 bits wide. You can select this
19874 combination with -mabi=32 -mfp64. This ABI relies on the "mthc1"
19875 and "mfhc1" instructions and is therefore only supported for
19876 MIPS32R2, MIPS32R3 and MIPS32R5 processors.
19877
19878 The register assignments for arguments and return values remain the
19879 same, but each scalar value is passed in a single 64-bit register
19880 rather than a pair of 32-bit registers. For example, scalar
19881 floating-point values are returned in $f0 only, not a $f0/$f1 pair.
19882 The set of call-saved registers also remains the same in that the
19883 even-numbered double-precision registers are saved.
19884
19885 Two additional variants of the o32 ABI are supported to enable a
19886 transition from 32-bit to 64-bit registers. These are FPXX
19887 (-mfpxx) and FP64A (-mfp64 -mno-odd-spreg). The FPXX extension
19888 mandates that all code must execute correctly when run using 32-bit
19889 or 64-bit registers. The code can be interlinked with either FP32
19890 or FP64, but not both. The FP64A extension is similar to the FP64
19891 extension but forbids the use of odd-numbered single-precision
19892 registers. This can be used in conjunction with the "FRE" mode of
19893 FPUs in MIPS32R5 processors and allows both FP32 and FP64A code to
19894 interlink and run in the same process without changing FPU modes.
19895
19896 -mabicalls
19897 -mno-abicalls
19898 Generate (do not generate) code that is suitable for SVR4-style
19899 dynamic objects. -mabicalls is the default for SVR4-based systems.
19900
19901 -mshared
19902 -mno-shared
19903 Generate (do not generate) code that is fully position-independent,
19904 and that can therefore be linked into shared libraries. This
19905 option only affects -mabicalls.
19906
19907 All -mabicalls code has traditionally been position-independent,
19908 regardless of options like -fPIC and -fpic. However, as an
19909 extension, the GNU toolchain allows executables to use absolute
19910 accesses for locally-binding symbols. It can also use shorter GP
19911 initialization sequences and generate direct calls to locally-
19912 defined functions. This mode is selected by -mno-shared.
19913
19914 -mno-shared depends on binutils 2.16 or higher and generates
19915 objects that can only be linked by the GNU linker. However, the
19916 option does not affect the ABI of the final executable; it only
19917 affects the ABI of relocatable objects. Using -mno-shared
19918 generally makes executables both smaller and quicker.
19919
19920 -mshared is the default.
19921
19922 -mplt
19923 -mno-plt
19924 Assume (do not assume) that the static and dynamic linkers support
19925 PLTs and copy relocations. This option only affects -mno-shared
19926 -mabicalls. For the n64 ABI, this option has no effect without
19927 -msym32.
19928
19929 You can make -mplt the default by configuring GCC with
19930 --with-mips-plt. The default is -mno-plt otherwise.
19931
19932 -mxgot
19933 -mno-xgot
19934 Lift (do not lift) the usual restrictions on the size of the global
19935 offset table.
19936
19937 GCC normally uses a single instruction to load values from the GOT.
19938 While this is relatively efficient, it only works if the GOT is
19939 smaller than about 64k. Anything larger causes the linker to
19940 report an error such as:
19941
19942 relocation truncated to fit: R_MIPS_GOT16 foobar
19943
19944 If this happens, you should recompile your code with -mxgot. This
19945 works with very large GOTs, although the code is also less
19946 efficient, since it takes three instructions to fetch the value of
19947 a global symbol.
19948
19949 Note that some linkers can create multiple GOTs. If you have such
19950 a linker, you should only need to use -mxgot when a single object
19951 file accesses more than 64k's worth of GOT entries. Very few do.
19952
19953 These options have no effect unless GCC is generating position
19954 independent code.
19955
19956 -mgp32
19957 Assume that general-purpose registers are 32 bits wide.
19958
19959 -mgp64
19960 Assume that general-purpose registers are 64 bits wide.
19961
19962 -mfp32
19963 Assume that floating-point registers are 32 bits wide.
19964
19965 -mfp64
19966 Assume that floating-point registers are 64 bits wide.
19967
19968 -mfpxx
19969 Do not assume the width of floating-point registers.
19970
19971 -mhard-float
19972 Use floating-point coprocessor instructions.
19973
19974 -msoft-float
19975 Do not use floating-point coprocessor instructions. Implement
19976 floating-point calculations using library calls instead.
19977
19978 -mno-float
19979 Equivalent to -msoft-float, but additionally asserts that the
19980 program being compiled does not perform any floating-point
19981 operations. This option is presently supported only by some bare-
19982 metal MIPS configurations, where it may select a special set of
19983 libraries that lack all floating-point support (including, for
19984 example, the floating-point "printf" formats). If code compiled
19985 with -mno-float accidentally contains floating-point operations, it
19986 is likely to suffer a link-time or run-time failure.
19987
19988 -msingle-float
19989 Assume that the floating-point coprocessor only supports single-
19990 precision operations.
19991
19992 -mdouble-float
19993 Assume that the floating-point coprocessor supports double-
19994 precision operations. This is the default.
19995
19996 -modd-spreg
19997 -mno-odd-spreg
19998 Enable the use of odd-numbered single-precision floating-point
19999 registers for the o32 ABI. This is the default for processors that
20000 are known to support these registers. When using the o32 FPXX ABI,
20001 -mno-odd-spreg is set by default.
20002
20003 -mabs=2008
20004 -mabs=legacy
20005 These options control the treatment of the special not-a-number
20006 (NaN) IEEE 754 floating-point data with the "abs.fmt" and "neg.fmt"
20007 machine instructions.
20008
20009 By default or when -mabs=legacy is used the legacy treatment is
20010 selected. In this case these instructions are considered
20011 arithmetic and avoided where correct operation is required and the
20012 input operand might be a NaN. A longer sequence of instructions
20013 that manipulate the sign bit of floating-point datum manually is
20014 used instead unless the -ffinite-math-only option has also been
20015 specified.
20016
20017 The -mabs=2008 option selects the IEEE 754-2008 treatment. In this
20018 case these instructions are considered non-arithmetic and therefore
20019 operating correctly in all cases, including in particular where the
20020 input operand is a NaN. These instructions are therefore always
20021 used for the respective operations.
20022
20023 -mnan=2008
20024 -mnan=legacy
20025 These options control the encoding of the special not-a-number
20026 (NaN) IEEE 754 floating-point data.
20027
20028 The -mnan=legacy option selects the legacy encoding. In this case
20029 quiet NaNs (qNaNs) are denoted by the first bit of their trailing
20030 significand field being 0, whereas signaling NaNs (sNaNs) are
20031 denoted by the first bit of their trailing significand field being
20032 1.
20033
20034 The -mnan=2008 option selects the IEEE 754-2008 encoding. In this
20035 case qNaNs are denoted by the first bit of their trailing
20036 significand field being 1, whereas sNaNs are denoted by the first
20037 bit of their trailing significand field being 0.
20038
20039 The default is -mnan=legacy unless GCC has been configured with
20040 --with-nan=2008.
20041
20042 -mllsc
20043 -mno-llsc
20044 Use (do not use) ll, sc, and sync instructions to implement atomic
20045 memory built-in functions. When neither option is specified, GCC
20046 uses the instructions if the target architecture supports them.
20047
20048 -mllsc is useful if the runtime environment can emulate the
20049 instructions and -mno-llsc can be useful when compiling for
20050 nonstandard ISAs. You can make either option the default by
20051 configuring GCC with --with-llsc and --without-llsc respectively.
20052 --with-llsc is the default for some configurations; see the
20053 installation documentation for details.
20054
20055 -mdsp
20056 -mno-dsp
20057 Use (do not use) revision 1 of the MIPS DSP ASE.
20058 This option defines the preprocessor macro "__mips_dsp". It also
20059 defines "__mips_dsp_rev" to 1.
20060
20061 -mdspr2
20062 -mno-dspr2
20063 Use (do not use) revision 2 of the MIPS DSP ASE.
20064 This option defines the preprocessor macros "__mips_dsp" and
20065 "__mips_dspr2". It also defines "__mips_dsp_rev" to 2.
20066
20067 -msmartmips
20068 -mno-smartmips
20069 Use (do not use) the MIPS SmartMIPS ASE.
20070
20071 -mpaired-single
20072 -mno-paired-single
20073 Use (do not use) paired-single floating-point instructions.
20074 This option requires hardware floating-point support to be
20075 enabled.
20076
20077 -mdmx
20078 -mno-mdmx
20079 Use (do not use) MIPS Digital Media Extension instructions. This
20080 option can only be used when generating 64-bit code and requires
20081 hardware floating-point support to be enabled.
20082
20083 -mips3d
20084 -mno-mips3d
20085 Use (do not use) the MIPS-3D ASE. The option -mips3d implies
20086 -mpaired-single.
20087
20088 -mmicromips
20089 -mno-micromips
20090 Generate (do not generate) microMIPS code.
20091
20092 MicroMIPS code generation can also be controlled on a per-function
20093 basis by means of "micromips" and "nomicromips" attributes.
20094
20095 -mmt
20096 -mno-mt
20097 Use (do not use) MT Multithreading instructions.
20098
20099 -mmcu
20100 -mno-mcu
20101 Use (do not use) the MIPS MCU ASE instructions.
20102
20103 -meva
20104 -mno-eva
20105 Use (do not use) the MIPS Enhanced Virtual Addressing instructions.
20106
20107 -mvirt
20108 -mno-virt
20109 Use (do not use) the MIPS Virtualization (VZ) instructions.
20110
20111 -mxpa
20112 -mno-xpa
20113 Use (do not use) the MIPS eXtended Physical Address (XPA)
20114 instructions.
20115
20116 -mcrc
20117 -mno-crc
20118 Use (do not use) the MIPS Cyclic Redundancy Check (CRC)
20119 instructions.
20120
20121 -mginv
20122 -mno-ginv
20123 Use (do not use) the MIPS Global INValidate (GINV) instructions.
20124
20125 -mloongson-mmi
20126 -mno-loongson-mmi
20127 Use (do not use) the MIPS Loongson MultiMedia extensions
20128 Instructions (MMI).
20129
20130 -mloongson-ext
20131 -mno-loongson-ext
20132 Use (do not use) the MIPS Loongson EXTensions (EXT) instructions.
20133
20134 -mloongson-ext2
20135 -mno-loongson-ext2
20136 Use (do not use) the MIPS Loongson EXTensions r2 (EXT2)
20137 instructions.
20138
20139 -mlong64
20140 Force "long" types to be 64 bits wide. See -mlong32 for an
20141 explanation of the default and the way that the pointer size is
20142 determined.
20143
20144 -mlong32
20145 Force "long", "int", and pointer types to be 32 bits wide.
20146
20147 The default size of "int"s, "long"s and pointers depends on the
20148 ABI. All the supported ABIs use 32-bit "int"s. The n64 ABI uses
20149 64-bit "long"s, as does the 64-bit EABI; the others use 32-bit
20150 "long"s. Pointers are the same size as "long"s, or the same size
20151 as integer registers, whichever is smaller.
20152
20153 -msym32
20154 -mno-sym32
20155 Assume (do not assume) that all symbols have 32-bit values,
20156 regardless of the selected ABI. This option is useful in
20157 combination with -mabi=64 and -mno-abicalls because it allows GCC
20158 to generate shorter and faster references to symbolic addresses.
20159
20160 -G num
20161 Put definitions of externally-visible data in a small data section
20162 if that data is no bigger than num bytes. GCC can then generate
20163 more efficient accesses to the data; see -mgpopt for details.
20164
20165 The default -G option depends on the configuration.
20166
20167 -mlocal-sdata
20168 -mno-local-sdata
20169 Extend (do not extend) the -G behavior to local data too, such as
20170 to static variables in C. -mlocal-sdata is the default for all
20171 configurations.
20172
20173 If the linker complains that an application is using too much small
20174 data, you might want to try rebuilding the less performance-
20175 critical parts with -mno-local-sdata. You might also want to build
20176 large libraries with -mno-local-sdata, so that the libraries leave
20177 more room for the main program.
20178
20179 -mextern-sdata
20180 -mno-extern-sdata
20181 Assume (do not assume) that externally-defined data is in a small
20182 data section if the size of that data is within the -G limit.
20183 -mextern-sdata is the default for all configurations.
20184
20185 If you compile a module Mod with -mextern-sdata -G num -mgpopt, and
20186 Mod references a variable Var that is no bigger than num bytes, you
20187 must make sure that Var is placed in a small data section. If Var
20188 is defined by another module, you must either compile that module
20189 with a high-enough -G setting or attach a "section" attribute to
20190 Var's definition. If Var is common, you must link the application
20191 with a high-enough -G setting.
20192
20193 The easiest way of satisfying these restrictions is to compile and
20194 link every module with the same -G option. However, you may wish
20195 to build a library that supports several different small data
20196 limits. You can do this by compiling the library with the highest
20197 supported -G setting and additionally using -mno-extern-sdata to
20198 stop the library from making assumptions about externally-defined
20199 data.
20200
20201 -mgpopt
20202 -mno-gpopt
20203 Use (do not use) GP-relative accesses for symbols that are known to
20204 be in a small data section; see -G, -mlocal-sdata and
20205 -mextern-sdata. -mgpopt is the default for all configurations.
20206
20207 -mno-gpopt is useful for cases where the $gp register might not
20208 hold the value of "_gp". For example, if the code is part of a
20209 library that might be used in a boot monitor, programs that call
20210 boot monitor routines pass an unknown value in $gp. (In such
20211 situations, the boot monitor itself is usually compiled with -G0.)
20212
20213 -mno-gpopt implies -mno-local-sdata and -mno-extern-sdata.
20214
20215 -membedded-data
20216 -mno-embedded-data
20217 Allocate variables to the read-only data section first if possible,
20218 then next in the small data section if possible, otherwise in data.
20219 This gives slightly slower code than the default, but reduces the
20220 amount of RAM required when executing, and thus may be preferred
20221 for some embedded systems.
20222
20223 -muninit-const-in-rodata
20224 -mno-uninit-const-in-rodata
20225 Put uninitialized "const" variables in the read-only data section.
20226 This option is only meaningful in conjunction with -membedded-data.
20227
20228 -mcode-readable=setting
20229 Specify whether GCC may generate code that reads from executable
20230 sections. There are three possible settings:
20231
20232 -mcode-readable=yes
20233 Instructions may freely access executable sections. This is
20234 the default setting.
20235
20236 -mcode-readable=pcrel
20237 MIPS16 PC-relative load instructions can access executable
20238 sections, but other instructions must not do so. This option
20239 is useful on 4KSc and 4KSd processors when the code TLBs have
20240 the Read Inhibit bit set. It is also useful on processors that
20241 can be configured to have a dual instruction/data SRAM
20242 interface and that, like the M4K, automatically redirect PC-
20243 relative loads to the instruction RAM.
20244
20245 -mcode-readable=no
20246 Instructions must not access executable sections. This option
20247 can be useful on targets that are configured to have a dual
20248 instruction/data SRAM interface but that (unlike the M4K) do
20249 not automatically redirect PC-relative loads to the instruction
20250 RAM.
20251
20252 -msplit-addresses
20253 -mno-split-addresses
20254 Enable (disable) use of the "%hi()" and "%lo()" assembler
20255 relocation operators. This option has been superseded by
20256 -mexplicit-relocs but is retained for backwards compatibility.
20257
20258 -mexplicit-relocs
20259 -mno-explicit-relocs
20260 Use (do not use) assembler relocation operators when dealing with
20261 symbolic addresses. The alternative, selected by
20262 -mno-explicit-relocs, is to use assembler macros instead.
20263
20264 -mexplicit-relocs is the default if GCC was configured to use an
20265 assembler that supports relocation operators.
20266
20267 -mcheck-zero-division
20268 -mno-check-zero-division
20269 Trap (do not trap) on integer division by zero.
20270
20271 The default is -mcheck-zero-division.
20272
20273 -mdivide-traps
20274 -mdivide-breaks
20275 MIPS systems check for division by zero by generating either a
20276 conditional trap or a break instruction. Using traps results in
20277 smaller code, but is only supported on MIPS II and later. Also,
20278 some versions of the Linux kernel have a bug that prevents trap
20279 from generating the proper signal ("SIGFPE"). Use -mdivide-traps
20280 to allow conditional traps on architectures that support them and
20281 -mdivide-breaks to force the use of breaks.
20282
20283 The default is usually -mdivide-traps, but this can be overridden
20284 at configure time using --with-divide=breaks. Divide-by-zero
20285 checks can be completely disabled using -mno-check-zero-division.
20286
20287 -mload-store-pairs
20288 -mno-load-store-pairs
20289 Enable (disable) an optimization that pairs consecutive load or
20290 store instructions to enable load/store bonding. This option is
20291 enabled by default but only takes effect when the selected
20292 architecture is known to support bonding.
20293
20294 -mmemcpy
20295 -mno-memcpy
20296 Force (do not force) the use of "memcpy" for non-trivial block
20297 moves. The default is -mno-memcpy, which allows GCC to inline most
20298 constant-sized copies.
20299
20300 -mlong-calls
20301 -mno-long-calls
20302 Disable (do not disable) use of the "jal" instruction. Calling
20303 functions using "jal" is more efficient but requires the caller and
20304 callee to be in the same 256 megabyte segment.
20305
20306 This option has no effect on abicalls code. The default is
20307 -mno-long-calls.
20308
20309 -mmad
20310 -mno-mad
20311 Enable (disable) use of the "mad", "madu" and "mul" instructions,
20312 as provided by the R4650 ISA.
20313
20314 -mimadd
20315 -mno-imadd
20316 Enable (disable) use of the "madd" and "msub" integer instructions.
20317 The default is -mimadd on architectures that support "madd" and
20318 "msub" except for the 74k architecture where it was found to
20319 generate slower code.
20320
20321 -mfused-madd
20322 -mno-fused-madd
20323 Enable (disable) use of the floating-point multiply-accumulate
20324 instructions, when they are available. The default is
20325 -mfused-madd.
20326
20327 On the R8000 CPU when multiply-accumulate instructions are used,
20328 the intermediate product is calculated to infinite precision and is
20329 not subject to the FCSR Flush to Zero bit. This may be undesirable
20330 in some circumstances. On other processors the result is
20331 numerically identical to the equivalent computation using separate
20332 multiply, add, subtract and negate instructions.
20333
20334 -nocpp
20335 Tell the MIPS assembler to not run its preprocessor over user
20336 assembler files (with a .s suffix) when assembling them.
20337
20338 -mfix-24k
20339 -mno-fix-24k
20340 Work around the 24K E48 (lost data on stores during refill) errata.
20341 The workarounds are implemented by the assembler rather than by
20342 GCC.
20343
20344 -mfix-r4000
20345 -mno-fix-r4000
20346 Work around certain R4000 CPU errata:
20347
20348 - A double-word or a variable shift may give an incorrect result
20349 if executed immediately after starting an integer division.
20350
20351 - A double-word or a variable shift may give an incorrect result
20352 if executed while an integer multiplication is in progress.
20353
20354 - An integer division may give an incorrect result if started in
20355 a delay slot of a taken branch or a jump.
20356
20357 -mfix-r4400
20358 -mno-fix-r4400
20359 Work around certain R4400 CPU errata:
20360
20361 - A double-word or a variable shift may give an incorrect result
20362 if executed immediately after starting an integer division.
20363
20364 -mfix-r10000
20365 -mno-fix-r10000
20366 Work around certain R10000 errata:
20367
20368 - "ll"/"sc" sequences may not behave atomically on revisions
20369 prior to 3.0. They may deadlock on revisions 2.6 and earlier.
20370
20371 This option can only be used if the target architecture supports
20372 branch-likely instructions. -mfix-r10000 is the default when
20373 -march=r10000 is used; -mno-fix-r10000 is the default otherwise.
20374
20375 -mfix-r5900
20376 -mno-fix-r5900
20377 Do not attempt to schedule the preceding instruction into the delay
20378 slot of a branch instruction placed at the end of a short loop of
20379 six instructions or fewer and always schedule a "nop" instruction
20380 there instead. The short loop bug under certain conditions causes
20381 loops to execute only once or twice, due to a hardware bug in the
20382 R5900 chip. The workaround is implemented by the assembler rather
20383 than by GCC.
20384
20385 -mfix-rm7000
20386 -mno-fix-rm7000
20387 Work around the RM7000 "dmult"/"dmultu" errata. The workarounds
20388 are implemented by the assembler rather than by GCC.
20389
20390 -mfix-vr4120
20391 -mno-fix-vr4120
20392 Work around certain VR4120 errata:
20393
20394 - "dmultu" does not always produce the correct result.
20395
20396 - "div" and "ddiv" do not always produce the correct result if
20397 one of the operands is negative.
20398
20399 The workarounds for the division errata rely on special functions
20400 in libgcc.a. At present, these functions are only provided by the
20401 "mips64vr*-elf" configurations.
20402
20403 Other VR4120 errata require a NOP to be inserted between certain
20404 pairs of instructions. These errata are handled by the assembler,
20405 not by GCC itself.
20406
20407 -mfix-vr4130
20408 Work around the VR4130 "mflo"/"mfhi" errata. The workarounds are
20409 implemented by the assembler rather than by GCC, although GCC
20410 avoids using "mflo" and "mfhi" if the VR4130 "macc", "macchi",
20411 "dmacc" and "dmacchi" instructions are available instead.
20412
20413 -mfix-sb1
20414 -mno-fix-sb1
20415 Work around certain SB-1 CPU core errata. (This flag currently
20416 works around the SB-1 revision 2 "F1" and "F2" floating-point
20417 errata.)
20418
20419 -mr10k-cache-barrier=setting
20420 Specify whether GCC should insert cache barriers to avoid the side
20421 effects of speculation on R10K processors.
20422
20423 In common with many processors, the R10K tries to predict the
20424 outcome of a conditional branch and speculatively executes
20425 instructions from the "taken" branch. It later aborts these
20426 instructions if the predicted outcome is wrong. However, on the
20427 R10K, even aborted instructions can have side effects.
20428
20429 This problem only affects kernel stores and, depending on the
20430 system, kernel loads. As an example, a speculatively-executed
20431 store may load the target memory into cache and mark the cache line
20432 as dirty, even if the store itself is later aborted. If a DMA
20433 operation writes to the same area of memory before the "dirty" line
20434 is flushed, the cached data overwrites the DMA-ed data. See the
20435 R10K processor manual for a full description, including other
20436 potential problems.
20437
20438 One workaround is to insert cache barrier instructions before every
20439 memory access that might be speculatively executed and that might
20440 have side effects even if aborted. -mr10k-cache-barrier=setting
20441 controls GCC's implementation of this workaround. It assumes that
20442 aborted accesses to any byte in the following regions does not have
20443 side effects:
20444
20445 1. the memory occupied by the current function's stack frame;
20446
20447 2. the memory occupied by an incoming stack argument;
20448
20449 3. the memory occupied by an object with a link-time-constant
20450 address.
20451
20452 It is the kernel's responsibility to ensure that speculative
20453 accesses to these regions are indeed safe.
20454
20455 If the input program contains a function declaration such as:
20456
20457 void foo (void);
20458
20459 then the implementation of "foo" must allow "j foo" and "jal foo"
20460 to be executed speculatively. GCC honors this restriction for
20461 functions it compiles itself. It expects non-GCC functions (such
20462 as hand-written assembly code) to do the same.
20463
20464 The option has three forms:
20465
20466 -mr10k-cache-barrier=load-store
20467 Insert a cache barrier before a load or store that might be
20468 speculatively executed and that might have side effects even if
20469 aborted.
20470
20471 -mr10k-cache-barrier=store
20472 Insert a cache barrier before a store that might be
20473 speculatively executed and that might have side effects even if
20474 aborted.
20475
20476 -mr10k-cache-barrier=none
20477 Disable the insertion of cache barriers. This is the default
20478 setting.
20479
20480 -mflush-func=func
20481 -mno-flush-func
20482 Specifies the function to call to flush the I and D caches, or to
20483 not call any such function. If called, the function must take the
20484 same arguments as the common "_flush_func", that is, the address of
20485 the memory range for which the cache is being flushed, the size of
20486 the memory range, and the number 3 (to flush both caches). The
20487 default depends on the target GCC was configured for, but commonly
20488 is either "_flush_func" or "__cpu_flush".
20489
20490 mbranch-cost=num
20491 Set the cost of branches to roughly num "simple" instructions.
20492 This cost is only a heuristic and is not guaranteed to produce
20493 consistent results across releases. A zero cost redundantly
20494 selects the default, which is based on the -mtune setting.
20495
20496 -mbranch-likely
20497 -mno-branch-likely
20498 Enable or disable use of Branch Likely instructions, regardless of
20499 the default for the selected architecture. By default, Branch
20500 Likely instructions may be generated if they are supported by the
20501 selected architecture. An exception is for the MIPS32 and MIPS64
20502 architectures and processors that implement those architectures;
20503 for those, Branch Likely instructions are not be generated by
20504 default because the MIPS32 and MIPS64 architectures specifically
20505 deprecate their use.
20506
20507 -mcompact-branches=never
20508 -mcompact-branches=optimal
20509 -mcompact-branches=always
20510 These options control which form of branches will be generated.
20511 The default is -mcompact-branches=optimal.
20512
20513 The -mcompact-branches=never option ensures that compact branch
20514 instructions will never be generated.
20515
20516 The -mcompact-branches=always option ensures that a compact branch
20517 instruction will be generated if available. If a compact branch
20518 instruction is not available, a delay slot form of the branch will
20519 be used instead.
20520
20521 This option is supported from MIPS Release 6 onwards.
20522
20523 The -mcompact-branches=optimal option will cause a delay slot
20524 branch to be used if one is available in the current ISA and the
20525 delay slot is successfully filled. If the delay slot is not
20526 filled, a compact branch will be chosen if one is available.
20527
20528 -mfp-exceptions
20529 -mno-fp-exceptions
20530 Specifies whether FP exceptions are enabled. This affects how FP
20531 instructions are scheduled for some processors. The default is
20532 that FP exceptions are enabled.
20533
20534 For instance, on the SB-1, if FP exceptions are disabled, and we
20535 are emitting 64-bit code, then we can use both FP pipes.
20536 Otherwise, we can only use one FP pipe.
20537
20538 -mvr4130-align
20539 -mno-vr4130-align
20540 The VR4130 pipeline is two-way superscalar, but can only issue two
20541 instructions together if the first one is 8-byte aligned. When
20542 this option is enabled, GCC aligns pairs of instructions that it
20543 thinks should execute in parallel.
20544
20545 This option only has an effect when optimizing for the VR4130. It
20546 normally makes code faster, but at the expense of making it bigger.
20547 It is enabled by default at optimization level -O3.
20548
20549 -msynci
20550 -mno-synci
20551 Enable (disable) generation of "synci" instructions on
20552 architectures that support it. The "synci" instructions (if
20553 enabled) are generated when "__builtin___clear_cache" is compiled.
20554
20555 This option defaults to -mno-synci, but the default can be
20556 overridden by configuring GCC with --with-synci.
20557
20558 When compiling code for single processor systems, it is generally
20559 safe to use "synci". However, on many multi-core (SMP) systems, it
20560 does not invalidate the instruction caches on all cores and may
20561 lead to undefined behavior.
20562
20563 -mrelax-pic-calls
20564 -mno-relax-pic-calls
20565 Try to turn PIC calls that are normally dispatched via register $25
20566 into direct calls. This is only possible if the linker can resolve
20567 the destination at link time and if the destination is within range
20568 for a direct call.
20569
20570 -mrelax-pic-calls is the default if GCC was configured to use an
20571 assembler and a linker that support the ".reloc" assembly directive
20572 and -mexplicit-relocs is in effect. With -mno-explicit-relocs,
20573 this optimization can be performed by the assembler and the linker
20574 alone without help from the compiler.
20575
20576 -mmcount-ra-address
20577 -mno-mcount-ra-address
20578 Emit (do not emit) code that allows "_mcount" to modify the calling
20579 function's return address. When enabled, this option extends the
20580 usual "_mcount" interface with a new ra-address parameter, which
20581 has type "intptr_t *" and is passed in register $12. "_mcount" can
20582 then modify the return address by doing both of the following:
20583
20584 * Returning the new address in register $31.
20585
20586 * Storing the new address in "*ra-address", if ra-address is
20587 nonnull.
20588
20589 The default is -mno-mcount-ra-address.
20590
20591 -mframe-header-opt
20592 -mno-frame-header-opt
20593 Enable (disable) frame header optimization in the o32 ABI. When
20594 using the o32 ABI, calling functions will allocate 16 bytes on the
20595 stack for the called function to write out register arguments.
20596 When enabled, this optimization will suppress the allocation of the
20597 frame header if it can be determined that it is unused.
20598
20599 This optimization is off by default at all optimization levels.
20600
20601 -mlxc1-sxc1
20602 -mno-lxc1-sxc1
20603 When applicable, enable (disable) the generation of "lwxc1",
20604 "swxc1", "ldxc1", "sdxc1" instructions. Enabled by default.
20605
20606 -mmadd4
20607 -mno-madd4
20608 When applicable, enable (disable) the generation of 4-operand
20609 "madd.s", "madd.d" and related instructions. Enabled by default.
20610
20611 MMIX Options
20612 These options are defined for the MMIX:
20613
20614 -mlibfuncs
20615 -mno-libfuncs
20616 Specify that intrinsic library functions are being compiled,
20617 passing all values in registers, no matter the size.
20618
20619 -mepsilon
20620 -mno-epsilon
20621 Generate floating-point comparison instructions that compare with
20622 respect to the "rE" epsilon register.
20623
20624 -mabi=mmixware
20625 -mabi=gnu
20626 Generate code that passes function parameters and return values
20627 that (in the called function) are seen as registers $0 and up, as
20628 opposed to the GNU ABI which uses global registers $231 and up.
20629
20630 -mzero-extend
20631 -mno-zero-extend
20632 When reading data from memory in sizes shorter than 64 bits, use
20633 (do not use) zero-extending load instructions by default, rather
20634 than sign-extending ones.
20635
20636 -mknuthdiv
20637 -mno-knuthdiv
20638 Make the result of a division yielding a remainder have the same
20639 sign as the divisor. With the default, -mno-knuthdiv, the sign of
20640 the remainder follows the sign of the dividend. Both methods are
20641 arithmetically valid, the latter being almost exclusively used.
20642
20643 -mtoplevel-symbols
20644 -mno-toplevel-symbols
20645 Prepend (do not prepend) a : to all global symbols, so the assembly
20646 code can be used with the "PREFIX" assembly directive.
20647
20648 -melf
20649 Generate an executable in the ELF format, rather than the default
20650 mmo format used by the mmix simulator.
20651
20652 -mbranch-predict
20653 -mno-branch-predict
20654 Use (do not use) the probable-branch instructions, when static
20655 branch prediction indicates a probable branch.
20656
20657 -mbase-addresses
20658 -mno-base-addresses
20659 Generate (do not generate) code that uses base addresses. Using a
20660 base address automatically generates a request (handled by the
20661 assembler and the linker) for a constant to be set up in a global
20662 register. The register is used for one or more base address
20663 requests within the range 0 to 255 from the value held in the
20664 register. The generally leads to short and fast code, but the
20665 number of different data items that can be addressed is limited.
20666 This means that a program that uses lots of static data may require
20667 -mno-base-addresses.
20668
20669 -msingle-exit
20670 -mno-single-exit
20671 Force (do not force) generated code to have a single exit point in
20672 each function.
20673
20674 MN10300 Options
20675 These -m options are defined for Matsushita MN10300 architectures:
20676
20677 -mmult-bug
20678 Generate code to avoid bugs in the multiply instructions for the
20679 MN10300 processors. This is the default.
20680
20681 -mno-mult-bug
20682 Do not generate code to avoid bugs in the multiply instructions for
20683 the MN10300 processors.
20684
20685 -mam33
20686 Generate code using features specific to the AM33 processor.
20687
20688 -mno-am33
20689 Do not generate code using features specific to the AM33 processor.
20690 This is the default.
20691
20692 -mam33-2
20693 Generate code using features specific to the AM33/2.0 processor.
20694
20695 -mam34
20696 Generate code using features specific to the AM34 processor.
20697
20698 -mtune=cpu-type
20699 Use the timing characteristics of the indicated CPU type when
20700 scheduling instructions. This does not change the targeted
20701 processor type. The CPU type must be one of mn10300, am33, am33-2
20702 or am34.
20703
20704 -mreturn-pointer-on-d0
20705 When generating a function that returns a pointer, return the
20706 pointer in both "a0" and "d0". Otherwise, the pointer is returned
20707 only in "a0", and attempts to call such functions without a
20708 prototype result in errors. Note that this option is on by
20709 default; use -mno-return-pointer-on-d0 to disable it.
20710
20711 -mno-crt0
20712 Do not link in the C run-time initialization object file.
20713
20714 -mrelax
20715 Indicate to the linker that it should perform a relaxation
20716 optimization pass to shorten branches, calls and absolute memory
20717 addresses. This option only has an effect when used on the command
20718 line for the final link step.
20719
20720 This option makes symbolic debugging impossible.
20721
20722 -mliw
20723 Allow the compiler to generate Long Instruction Word instructions
20724 if the target is the AM33 or later. This is the default. This
20725 option defines the preprocessor macro "__LIW__".
20726
20727 -mno-liw
20728 Do not allow the compiler to generate Long Instruction Word
20729 instructions. This option defines the preprocessor macro
20730 "__NO_LIW__".
20731
20732 -msetlb
20733 Allow the compiler to generate the SETLB and Lcc instructions if
20734 the target is the AM33 or later. This is the default. This option
20735 defines the preprocessor macro "__SETLB__".
20736
20737 -mno-setlb
20738 Do not allow the compiler to generate SETLB or Lcc instructions.
20739 This option defines the preprocessor macro "__NO_SETLB__".
20740
20741 Moxie Options
20742 -meb
20743 Generate big-endian code. This is the default for moxie-*-*
20744 configurations.
20745
20746 -mel
20747 Generate little-endian code.
20748
20749 -mmul.x
20750 Generate mul.x and umul.x instructions. This is the default for
20751 moxiebox-*-* configurations.
20752
20753 -mno-crt0
20754 Do not link in the C run-time initialization object file.
20755
20756 MSP430 Options
20757 These options are defined for the MSP430:
20758
20759 -masm-hex
20760 Force assembly output to always use hex constants. Normally such
20761 constants are signed decimals, but this option is available for
20762 testsuite and/or aesthetic purposes.
20763
20764 -mmcu=
20765 Select the MCU to target. This is used to create a C preprocessor
20766 symbol based upon the MCU name, converted to upper case and pre-
20767 and post-fixed with __. This in turn is used by the msp430.h
20768 header file to select an MCU-specific supplementary header file.
20769
20770 The option also sets the ISA to use. If the MCU name is one that
20771 is known to only support the 430 ISA then that is selected,
20772 otherwise the 430X ISA is selected. A generic MCU name of msp430
20773 can also be used to select the 430 ISA. Similarly the generic
20774 msp430x MCU name selects the 430X ISA.
20775
20776 In addition an MCU-specific linker script is added to the linker
20777 command line. The script's name is the name of the MCU with .ld
20778 appended. Thus specifying -mmcu=xxx on the gcc command line
20779 defines the C preprocessor symbol "__XXX__" and cause the linker to
20780 search for a script called xxx.ld.
20781
20782 The ISA and hardware multiply supported for the different MCUs is
20783 hard-coded into GCC. However, an external devices.csv file can be
20784 used to extend device support beyond those that have been hard-
20785 coded.
20786
20787 GCC searches for the devices.csv file using the following methods
20788 in the given precedence order, where the first method takes
20789 precendence over the second which takes precedence over the third.
20790
20791 Include path specified with "-I" and "-L"
20792 devices.csv will be searched for in each of the directories
20793 specified by include paths and linker library search paths.
20794
20795 Path specified by the environment variable MSP430_GCC_INCLUDE_DIR
20796 Define the value of the global environment variable
20797 MSP430_GCC_INCLUDE_DIR to the full path to the directory
20798 containing devices.csv, and GCC will search this directory for
20799 devices.csv. If devices.csv is found, this directory will also
20800 be registered as an include path, and linker library path.
20801 Header files and linker scripts in this directory can therefore
20802 be used without manually specifying "-I" and "-L" on the
20803 command line.
20804
20805 The msp430-elf{,bare}/include/devices directory
20806 Finally, GCC will examine msp430-elf{,bare}/include/devices
20807 from the toolchain root directory. This directory does not
20808 exist in a default installation, but if the user has created it
20809 and copied devices.csv there, then the MCU data will be read.
20810 As above, this directory will also be registered as an include
20811 path, and linker library path.
20812
20813 If none of the above search methods find devices.csv, then the
20814 hard-coded MCU data is used.
20815
20816 -mwarn-mcu
20817 -mno-warn-mcu
20818 This option enables or disables warnings about conflicts between
20819 the MCU name specified by the -mmcu option and the ISA set by the
20820 -mcpu option and/or the hardware multiply support set by the
20821 -mhwmult option. It also toggles warnings about unrecognized MCU
20822 names. This option is on by default.
20823
20824 -mcpu=
20825 Specifies the ISA to use. Accepted values are msp430, msp430x and
20826 msp430xv2. This option is deprecated. The -mmcu= option should be
20827 used to select the ISA.
20828
20829 -msim
20830 Link to the simulator runtime libraries and linker script.
20831 Overrides any scripts that would be selected by the -mmcu= option.
20832
20833 -mlarge
20834 Use large-model addressing (20-bit pointers, 32-bit "size_t").
20835
20836 -msmall
20837 Use small-model addressing (16-bit pointers, 16-bit "size_t").
20838
20839 -mrelax
20840 This option is passed to the assembler and linker, and allows the
20841 linker to perform certain optimizations that cannot be done until
20842 the final link.
20843
20844 mhwmult=
20845 Describes the type of hardware multiply supported by the target.
20846 Accepted values are none for no hardware multiply, 16bit for the
20847 original 16-bit-only multiply supported by early MCUs. 32bit for
20848 the 16/32-bit multiply supported by later MCUs and f5series for the
20849 16/32-bit multiply supported by F5-series MCUs. A value of auto
20850 can also be given. This tells GCC to deduce the hardware multiply
20851 support based upon the MCU name provided by the -mmcu option. If
20852 no -mmcu option is specified or if the MCU name is not recognized
20853 then no hardware multiply support is assumed. "auto" is the
20854 default setting.
20855
20856 Hardware multiplies are normally performed by calling a library
20857 routine. This saves space in the generated code. When compiling
20858 at -O3 or higher however the hardware multiplier is invoked inline.
20859 This makes for bigger, but faster code.
20860
20861 The hardware multiply routines disable interrupts whilst running
20862 and restore the previous interrupt state when they finish. This
20863 makes them safe to use inside interrupt handlers as well as in
20864 normal code.
20865
20866 -minrt
20867 Enable the use of a minimum runtime environment - no static
20868 initializers or constructors. This is intended for memory-
20869 constrained devices. The compiler includes special symbols in some
20870 objects that tell the linker and runtime which code fragments are
20871 required.
20872
20873 -mtiny-printf
20874 Enable reduced code size "printf" and "puts" library functions.
20875 The tiny implementations of these functions are not reentrant, so
20876 must be used with caution in multi-threaded applications.
20877
20878 Support for streams has been removed and the string to be printed
20879 will always be sent to stdout via the "write" syscall. The string
20880 is not buffered before it is sent to write.
20881
20882 This option requires Newlib Nano IO, so GCC must be configured with
20883 --enable-newlib-nano-formatted-io.
20884
20885 -mcode-region=
20886 -mdata-region=
20887 These options tell the compiler where to place functions and data
20888 that do not have one of the "lower", "upper", "either" or "section"
20889 attributes. Possible values are "lower", "upper", "either" or
20890 "any". The first three behave like the corresponding attribute.
20891 The fourth possible value - "any" - is the default. It leaves
20892 placement entirely up to the linker script and how it assigns the
20893 standard sections (".text", ".data", etc) to the memory regions.
20894
20895 -msilicon-errata=
20896 This option passes on a request to assembler to enable the fixes
20897 for the named silicon errata.
20898
20899 -msilicon-errata-warn=
20900 This option passes on a request to the assembler to enable warning
20901 messages when a silicon errata might need to be applied.
20902
20903 -mwarn-devices-csv
20904 -mno-warn-devices-csv
20905 Warn if devices.csv is not found or there are problem parsing it
20906 (default: on).
20907
20908 NDS32 Options
20909 These options are defined for NDS32 implementations:
20910
20911 -mbig-endian
20912 Generate code in big-endian mode.
20913
20914 -mlittle-endian
20915 Generate code in little-endian mode.
20916
20917 -mreduced-regs
20918 Use reduced-set registers for register allocation.
20919
20920 -mfull-regs
20921 Use full-set registers for register allocation.
20922
20923 -mcmov
20924 Generate conditional move instructions.
20925
20926 -mno-cmov
20927 Do not generate conditional move instructions.
20928
20929 -mext-perf
20930 Generate performance extension instructions.
20931
20932 -mno-ext-perf
20933 Do not generate performance extension instructions.
20934
20935 -mext-perf2
20936 Generate performance extension 2 instructions.
20937
20938 -mno-ext-perf2
20939 Do not generate performance extension 2 instructions.
20940
20941 -mext-string
20942 Generate string extension instructions.
20943
20944 -mno-ext-string
20945 Do not generate string extension instructions.
20946
20947 -mv3push
20948 Generate v3 push25/pop25 instructions.
20949
20950 -mno-v3push
20951 Do not generate v3 push25/pop25 instructions.
20952
20953 -m16-bit
20954 Generate 16-bit instructions.
20955
20956 -mno-16-bit
20957 Do not generate 16-bit instructions.
20958
20959 -misr-vector-size=num
20960 Specify the size of each interrupt vector, which must be 4 or 16.
20961
20962 -mcache-block-size=num
20963 Specify the size of each cache block, which must be a power of 2
20964 between 4 and 512.
20965
20966 -march=arch
20967 Specify the name of the target architecture.
20968
20969 -mcmodel=code-model
20970 Set the code model to one of
20971
20972 small
20973 All the data and read-only data segments must be within 512KB
20974 addressing space. The text segment must be within 16MB
20975 addressing space.
20976
20977 medium
20978 The data segment must be within 512KB while the read-only data
20979 segment can be within 4GB addressing space. The text segment
20980 should be still within 16MB addressing space.
20981
20982 large
20983 All the text and data segments can be within 4GB addressing
20984 space.
20985
20986 -mctor-dtor
20987 Enable constructor/destructor feature.
20988
20989 -mrelax
20990 Guide linker to relax instructions.
20991
20992 Nios II Options
20993 These are the options defined for the Altera Nios II processor.
20994
20995 -G num
20996 Put global and static objects less than or equal to num bytes into
20997 the small data or BSS sections instead of the normal data or BSS
20998 sections. The default value of num is 8.
20999
21000 -mgpopt=option
21001 -mgpopt
21002 -mno-gpopt
21003 Generate (do not generate) GP-relative accesses. The following
21004 option names are recognized:
21005
21006 none
21007 Do not generate GP-relative accesses.
21008
21009 local
21010 Generate GP-relative accesses for small data objects that are
21011 not external, weak, or uninitialized common symbols. Also use
21012 GP-relative addressing for objects that have been explicitly
21013 placed in a small data section via a "section" attribute.
21014
21015 global
21016 As for local, but also generate GP-relative accesses for small
21017 data objects that are external, weak, or common. If you use
21018 this option, you must ensure that all parts of your program
21019 (including libraries) are compiled with the same -G setting.
21020
21021 data
21022 Generate GP-relative accesses for all data objects in the
21023 program. If you use this option, the entire data and BSS
21024 segments of your program must fit in 64K of memory and you must
21025 use an appropriate linker script to allocate them within the
21026 addressable range of the global pointer.
21027
21028 all Generate GP-relative addresses for function pointers as well as
21029 data pointers. If you use this option, the entire text, data,
21030 and BSS segments of your program must fit in 64K of memory and
21031 you must use an appropriate linker script to allocate them
21032 within the addressable range of the global pointer.
21033
21034 -mgpopt is equivalent to -mgpopt=local, and -mno-gpopt is
21035 equivalent to -mgpopt=none.
21036
21037 The default is -mgpopt except when -fpic or -fPIC is specified to
21038 generate position-independent code. Note that the Nios II ABI does
21039 not permit GP-relative accesses from shared libraries.
21040
21041 You may need to specify -mno-gpopt explicitly when building
21042 programs that include large amounts of small data, including large
21043 GOT data sections. In this case, the 16-bit offset for GP-relative
21044 addressing may not be large enough to allow access to the entire
21045 small data section.
21046
21047 -mgprel-sec=regexp
21048 This option specifies additional section names that can be accessed
21049 via GP-relative addressing. It is most useful in conjunction with
21050 "section" attributes on variable declarations and a custom linker
21051 script. The regexp is a POSIX Extended Regular Expression.
21052
21053 This option does not affect the behavior of the -G option, and the
21054 specified sections are in addition to the standard ".sdata" and
21055 ".sbss" small-data sections that are recognized by -mgpopt.
21056
21057 -mr0rel-sec=regexp
21058 This option specifies names of sections that can be accessed via a
21059 16-bit offset from "r0"; that is, in the low 32K or high 32K of the
21060 32-bit address space. It is most useful in conjunction with
21061 "section" attributes on variable declarations and a custom linker
21062 script. The regexp is a POSIX Extended Regular Expression.
21063
21064 In contrast to the use of GP-relative addressing for small data,
21065 zero-based addressing is never generated by default and there are
21066 no conventional section names used in standard linker scripts for
21067 sections in the low or high areas of memory.
21068
21069 -mel
21070 -meb
21071 Generate little-endian (default) or big-endian (experimental) code,
21072 respectively.
21073
21074 -march=arch
21075 This specifies the name of the target Nios II architecture. GCC
21076 uses this name to determine what kind of instructions it can emit
21077 when generating assembly code. Permissible names are: r1, r2.
21078
21079 The preprocessor macro "__nios2_arch__" is available to programs,
21080 with value 1 or 2, indicating the targeted ISA level.
21081
21082 -mbypass-cache
21083 -mno-bypass-cache
21084 Force all load and store instructions to always bypass cache by
21085 using I/O variants of the instructions. The default is not to
21086 bypass the cache.
21087
21088 -mno-cache-volatile
21089 -mcache-volatile
21090 Volatile memory access bypass the cache using the I/O variants of
21091 the load and store instructions. The default is not to bypass the
21092 cache.
21093
21094 -mno-fast-sw-div
21095 -mfast-sw-div
21096 Do not use table-based fast divide for small numbers. The default
21097 is to use the fast divide at -O3 and above.
21098
21099 -mno-hw-mul
21100 -mhw-mul
21101 -mno-hw-mulx
21102 -mhw-mulx
21103 -mno-hw-div
21104 -mhw-div
21105 Enable or disable emitting "mul", "mulx" and "div" family of
21106 instructions by the compiler. The default is to emit "mul" and not
21107 emit "div" and "mulx".
21108
21109 -mbmx
21110 -mno-bmx
21111 -mcdx
21112 -mno-cdx
21113 Enable or disable generation of Nios II R2 BMX (bit manipulation)
21114 and CDX (code density) instructions. Enabling these instructions
21115 also requires -march=r2. Since these instructions are optional
21116 extensions to the R2 architecture, the default is not to emit them.
21117
21118 -mcustom-insn=N
21119 -mno-custom-insn
21120 Each -mcustom-insn=N option enables use of a custom instruction
21121 with encoding N when generating code that uses insn. For example,
21122 -mcustom-fadds=253 generates custom instruction 253 for single-
21123 precision floating-point add operations instead of the default
21124 behavior of using a library call.
21125
21126 The following values of insn are supported. Except as otherwise
21127 noted, floating-point operations are expected to be implemented
21128 with normal IEEE 754 semantics and correspond directly to the C
21129 operators or the equivalent GCC built-in functions.
21130
21131 Single-precision floating point:
21132
21133 fadds, fsubs, fdivs, fmuls
21134 Binary arithmetic operations.
21135
21136 fnegs
21137 Unary negation.
21138
21139 fabss
21140 Unary absolute value.
21141
21142 fcmpeqs, fcmpges, fcmpgts, fcmples, fcmplts, fcmpnes
21143 Comparison operations.
21144
21145 fmins, fmaxs
21146 Floating-point minimum and maximum. These instructions are
21147 only generated if -ffinite-math-only is specified.
21148
21149 fsqrts
21150 Unary square root operation.
21151
21152 fcoss, fsins, ftans, fatans, fexps, flogs
21153 Floating-point trigonometric and exponential functions. These
21154 instructions are only generated if -funsafe-math-optimizations
21155 is also specified.
21156
21157 Double-precision floating point:
21158
21159 faddd, fsubd, fdivd, fmuld
21160 Binary arithmetic operations.
21161
21162 fnegd
21163 Unary negation.
21164
21165 fabsd
21166 Unary absolute value.
21167
21168 fcmpeqd, fcmpged, fcmpgtd, fcmpled, fcmpltd, fcmpned
21169 Comparison operations.
21170
21171 fmind, fmaxd
21172 Double-precision minimum and maximum. These instructions are
21173 only generated if -ffinite-math-only is specified.
21174
21175 fsqrtd
21176 Unary square root operation.
21177
21178 fcosd, fsind, ftand, fatand, fexpd, flogd
21179 Double-precision trigonometric and exponential functions.
21180 These instructions are only generated if
21181 -funsafe-math-optimizations is also specified.
21182
21183 Conversions:
21184
21185 fextsd
21186 Conversion from single precision to double precision.
21187
21188 ftruncds
21189 Conversion from double precision to single precision.
21190
21191 fixsi, fixsu, fixdi, fixdu
21192 Conversion from floating point to signed or unsigned integer
21193 types, with truncation towards zero.
21194
21195 round
21196 Conversion from single-precision floating point to signed
21197 integer, rounding to the nearest integer and ties away from
21198 zero. This corresponds to the "__builtin_lroundf" function
21199 when -fno-math-errno is used.
21200
21201 floatis, floatus, floatid, floatud
21202 Conversion from signed or unsigned integer types to floating-
21203 point types.
21204
21205 In addition, all of the following transfer instructions for
21206 internal registers X and Y must be provided to use any of the
21207 double-precision floating-point instructions. Custom instructions
21208 taking two double-precision source operands expect the first
21209 operand in the 64-bit register X. The other operand (or only
21210 operand of a unary operation) is given to the custom arithmetic
21211 instruction with the least significant half in source register src1
21212 and the most significant half in src2. A custom instruction that
21213 returns a double-precision result returns the most significant 32
21214 bits in the destination register and the other half in 32-bit
21215 register Y. GCC automatically generates the necessary code
21216 sequences to write register X and/or read register Y when double-
21217 precision floating-point instructions are used.
21218
21219 fwrx
21220 Write src1 into the least significant half of X and src2 into
21221 the most significant half of X.
21222
21223 fwry
21224 Write src1 into Y.
21225
21226 frdxhi, frdxlo
21227 Read the most or least (respectively) significant half of X and
21228 store it in dest.
21229
21230 frdy
21231 Read the value of Y and store it into dest.
21232
21233 Note that you can gain more local control over generation of Nios
21234 II custom instructions by using the "target("custom-insn=N")" and
21235 "target("no-custom-insn")" function attributes or pragmas.
21236
21237 -mcustom-fpu-cfg=name
21238 This option enables a predefined, named set of custom instruction
21239 encodings (see -mcustom-insn above). Currently, the following sets
21240 are defined:
21241
21242 -mcustom-fpu-cfg=60-1 is equivalent to: -mcustom-fmuls=252
21243 -mcustom-fadds=253 -mcustom-fsubs=254 -fsingle-precision-constant
21244
21245 -mcustom-fpu-cfg=60-2 is equivalent to: -mcustom-fmuls=252
21246 -mcustom-fadds=253 -mcustom-fsubs=254 -mcustom-fdivs=255
21247 -fsingle-precision-constant
21248
21249 -mcustom-fpu-cfg=72-3 is equivalent to: -mcustom-floatus=243
21250 -mcustom-fixsi=244 -mcustom-floatis=245 -mcustom-fcmpgts=246
21251 -mcustom-fcmples=249 -mcustom-fcmpeqs=250 -mcustom-fcmpnes=251
21252 -mcustom-fmuls=252 -mcustom-fadds=253 -mcustom-fsubs=254
21253 -mcustom-fdivs=255 -fsingle-precision-constant
21254
21255 Custom instruction assignments given by individual -mcustom-insn=
21256 options override those given by -mcustom-fpu-cfg=, regardless of
21257 the order of the options on the command line.
21258
21259 Note that you can gain more local control over selection of a FPU
21260 configuration by using the "target("custom-fpu-cfg=name")" function
21261 attribute or pragma.
21262
21263 These additional -m options are available for the Altera Nios II ELF
21264 (bare-metal) target:
21265
21266 -mhal
21267 Link with HAL BSP. This suppresses linking with the GCC-provided C
21268 runtime startup and termination code, and is typically used in
21269 conjunction with -msys-crt0= to specify the location of the
21270 alternate startup code provided by the HAL BSP.
21271
21272 -msmallc
21273 Link with a limited version of the C library, -lsmallc, rather than
21274 Newlib.
21275
21276 -msys-crt0=startfile
21277 startfile is the file name of the startfile (crt0) to use when
21278 linking. This option is only useful in conjunction with -mhal.
21279
21280 -msys-lib=systemlib
21281 systemlib is the library name of the library that provides low-
21282 level system calls required by the C library, e.g. "read" and
21283 "write". This option is typically used to link with a library
21284 provided by a HAL BSP.
21285
21286 Nvidia PTX Options
21287 These options are defined for Nvidia PTX:
21288
21289 -m32
21290 -m64
21291 Generate code for 32-bit or 64-bit ABI.
21292
21293 -misa=ISA-string
21294 Generate code for given the specified PTX ISA (e.g. sm_35). ISA
21295 strings must be lower-case. Valid ISA strings include sm_30 and
21296 sm_35. The default ISA is sm_30.
21297
21298 -mmainkernel
21299 Link in code for a __main kernel. This is for stand-alone instead
21300 of offloading execution.
21301
21302 -moptimize
21303 Apply partitioned execution optimizations. This is the default
21304 when any level of optimization is selected.
21305
21306 -msoft-stack
21307 Generate code that does not use ".local" memory directly for stack
21308 storage. Instead, a per-warp stack pointer is maintained
21309 explicitly. This enables variable-length stack allocation (with
21310 variable-length arrays or "alloca"), and when global memory is used
21311 for underlying storage, makes it possible to access automatic
21312 variables from other threads, or with atomic instructions. This
21313 code generation variant is used for OpenMP offloading, but the
21314 option is exposed on its own for the purpose of testing the
21315 compiler; to generate code suitable for linking into programs using
21316 OpenMP offloading, use option -mgomp.
21317
21318 -muniform-simt
21319 Switch to code generation variant that allows to execute all
21320 threads in each warp, while maintaining memory state and side
21321 effects as if only one thread in each warp was active outside of
21322 OpenMP SIMD regions. All atomic operations and calls to runtime
21323 (malloc, free, vprintf) are conditionally executed (iff current
21324 lane index equals the master lane index), and the register being
21325 assigned is copied via a shuffle instruction from the master lane.
21326 Outside of SIMD regions lane 0 is the master; inside, each thread
21327 sees itself as the master. Shared memory array "int __nvptx_uni[]"
21328 stores all-zeros or all-ones bitmasks for each warp, indicating
21329 current mode (0 outside of SIMD regions). Each thread can bitwise-
21330 and the bitmask at position "tid.y" with current lane index to
21331 compute the master lane index.
21332
21333 -mgomp
21334 Generate code for use in OpenMP offloading: enables -msoft-stack
21335 and -muniform-simt options, and selects corresponding multilib
21336 variant.
21337
21338 OpenRISC Options
21339 These options are defined for OpenRISC:
21340
21341 -mboard=name
21342 Configure a board specific runtime. This will be passed to the
21343 linker for newlib board library linking. The default is "or1ksim".
21344
21345 -mnewlib
21346 This option is ignored; it is for compatibility purposes only.
21347 This used to select linker and preprocessor options for use with
21348 newlib.
21349
21350 -msoft-div
21351 -mhard-div
21352 Select software or hardware divide ("l.div", "l.divu")
21353 instructions. This default is hardware divide.
21354
21355 -msoft-mul
21356 -mhard-mul
21357 Select software or hardware multiply ("l.mul", "l.muli")
21358 instructions. This default is hardware multiply.
21359
21360 -msoft-float
21361 -mhard-float
21362 Select software or hardware for floating point operations. The
21363 default is software.
21364
21365 -mdouble-float
21366 When -mhard-float is selected, enables generation of double-
21367 precision floating point instructions. By default functions from
21368 libgcc are used to perform double-precision floating point
21369 operations.
21370
21371 -munordered-float
21372 When -mhard-float is selected, enables generation of unordered
21373 floating point compare and set flag ("lf.sfun*") instructions. By
21374 default functions from libgcc are used to perform unordered
21375 floating point compare and set flag operations.
21376
21377 -mcmov
21378 Enable generation of conditional move ("l.cmov") instructions. By
21379 default the equivalent will be generated using set and branch.
21380
21381 -mror
21382 Enable generation of rotate right ("l.ror") instructions. By
21383 default functions from libgcc are used to perform rotate right
21384 operations.
21385
21386 -mrori
21387 Enable generation of rotate right with immediate ("l.rori")
21388 instructions. By default functions from libgcc are used to perform
21389 rotate right with immediate operations.
21390
21391 -msext
21392 Enable generation of sign extension ("l.ext*") instructions. By
21393 default memory loads are used to perform sign extension.
21394
21395 -msfimm
21396 Enable generation of compare and set flag with immediate ("l.sf*i")
21397 instructions. By default extra instructions will be generated to
21398 store the immediate to a register first.
21399
21400 -mshftimm
21401 Enable generation of shift with immediate ("l.srai", "l.srli",
21402 "l.slli") instructions. By default extra instructions will be
21403 generated to store the immediate to a register first.
21404
21405 PDP-11 Options
21406 These options are defined for the PDP-11:
21407
21408 -mfpu
21409 Use hardware FPP floating point. This is the default. (FIS
21410 floating point on the PDP-11/40 is not supported.) Implies -m45.
21411
21412 -msoft-float
21413 Do not use hardware floating point.
21414
21415 -mac0
21416 Return floating-point results in ac0 (fr0 in Unix assembler
21417 syntax).
21418
21419 -mno-ac0
21420 Return floating-point results in memory. This is the default.
21421
21422 -m40
21423 Generate code for a PDP-11/40. Implies -msoft-float -mno-split.
21424
21425 -m45
21426 Generate code for a PDP-11/45. This is the default.
21427
21428 -m10
21429 Generate code for a PDP-11/10. Implies -msoft-float -mno-split.
21430
21431 -mint16
21432 -mno-int32
21433 Use 16-bit "int". This is the default.
21434
21435 -mint32
21436 -mno-int16
21437 Use 32-bit "int".
21438
21439 -msplit
21440 Target has split instruction and data space. Implies -m45.
21441
21442 -munix-asm
21443 Use Unix assembler syntax.
21444
21445 -mdec-asm
21446 Use DEC assembler syntax.
21447
21448 -mgnu-asm
21449 Use GNU assembler syntax. This is the default.
21450
21451 -mlra
21452 Use the new LRA register allocator. By default, the old "reload"
21453 allocator is used.
21454
21455 picoChip Options
21456 These -m options are defined for picoChip implementations:
21457
21458 -mae=ae_type
21459 Set the instruction set, register set, and instruction scheduling
21460 parameters for array element type ae_type. Supported values for
21461 ae_type are ANY, MUL, and MAC.
21462
21463 -mae=ANY selects a completely generic AE type. Code generated with
21464 this option runs on any of the other AE types. The code is not as
21465 efficient as it would be if compiled for a specific AE type, and
21466 some types of operation (e.g., multiplication) do not work properly
21467 on all types of AE.
21468
21469 -mae=MUL selects a MUL AE type. This is the most useful AE type
21470 for compiled code, and is the default.
21471
21472 -mae=MAC selects a DSP-style MAC AE. Code compiled with this
21473 option may suffer from poor performance of byte (char)
21474 manipulation, since the DSP AE does not provide hardware support
21475 for byte load/stores.
21476
21477 -msymbol-as-address
21478 Enable the compiler to directly use a symbol name as an address in
21479 a load/store instruction, without first loading it into a register.
21480 Typically, the use of this option generates larger programs, which
21481 run faster than when the option isn't used. However, the results
21482 vary from program to program, so it is left as a user option,
21483 rather than being permanently enabled.
21484
21485 -mno-inefficient-warnings
21486 Disables warnings about the generation of inefficient code. These
21487 warnings can be generated, for example, when compiling code that
21488 performs byte-level memory operations on the MAC AE type. The MAC
21489 AE has no hardware support for byte-level memory operations, so all
21490 byte load/stores must be synthesized from word load/store
21491 operations. This is inefficient and a warning is generated to
21492 indicate that you should rewrite the code to avoid byte operations,
21493 or to target an AE type that has the necessary hardware support.
21494 This option disables these warnings.
21495
21496 PowerPC Options
21497 These are listed under
21498
21499 PRU Options
21500 These command-line options are defined for PRU target:
21501
21502 -minrt
21503 Link with a minimum runtime environment, with no support for static
21504 initializers and constructors. Using this option can significantly
21505 reduce the size of the final ELF binary. Beware that the compiler
21506 could still generate code with static initializers and
21507 constructors. It is up to the programmer to ensure that the source
21508 program will not use those features.
21509
21510 -mmcu=mcu
21511 Specify the PRU MCU variant to use. Check Newlib for the exact
21512 list of supported MCUs.
21513
21514 -mno-relax
21515 Make GCC pass the --no-relax command-line option to the linker
21516 instead of the --relax option.
21517
21518 -mloop
21519 Allow (or do not allow) GCC to use the LOOP instruction.
21520
21521 -mabi=variant
21522 Specify the ABI variant to output code for. -mabi=ti selects the
21523 unmodified TI ABI while -mabi=gnu selects a GNU variant that copes
21524 more naturally with certain GCC assumptions. These are the
21525 differences:
21526
21527 Function Pointer Size
21528 TI ABI specifies that function (code) pointers are 16-bit,
21529 whereas GNU supports only 32-bit data and code pointers.
21530
21531 Optional Return Value Pointer
21532 Function return values larger than 64 bits are passed by using
21533 a hidden pointer as the first argument of the function. TI
21534 ABI, though, mandates that the pointer can be NULL in case the
21535 caller is not using the returned value. GNU always passes and
21536 expects a valid return value pointer.
21537
21538 The current -mabi=ti implementation simply raises a compile error
21539 when any of the above code constructs is detected. As a
21540 consequence the standard C library cannot be built and it is
21541 omitted when linking with -mabi=ti.
21542
21543 Relaxation is a GNU feature and for safety reasons is disabled when
21544 using -mabi=ti. The TI toolchain does not emit relocations for
21545 QBBx instructions, so the GNU linker cannot adjust them when
21546 shortening adjacent LDI32 pseudo instructions.
21547
21548 RISC-V Options
21549 These command-line options are defined for RISC-V targets:
21550
21551 -mbranch-cost=n
21552 Set the cost of branches to roughly n instructions.
21553
21554 -mplt
21555 -mno-plt
21556 When generating PIC code, do or don't allow the use of PLTs.
21557 Ignored for non-PIC. The default is -mplt.
21558
21559 -mabi=ABI-string
21560 Specify integer and floating-point calling convention. ABI-string
21561 contains two parts: the size of integer types and the registers
21562 used for floating-point types. For example -march=rv64ifd
21563 -mabi=lp64d means that long and pointers are 64-bit (implicitly
21564 defining int to be 32-bit), and that floating-point values up to 64
21565 bits wide are passed in F registers. Contrast this with
21566 -march=rv64ifd -mabi=lp64f, which still allows the compiler to
21567 generate code that uses the F and D extensions but only allows
21568 floating-point values up to 32 bits long to be passed in registers;
21569 or -march=rv64ifd -mabi=lp64, in which no floating-point arguments
21570 will be passed in registers.
21571
21572 The default for this argument is system dependent, users who want a
21573 specific calling convention should specify one explicitly. The
21574 valid calling conventions are: ilp32, ilp32f, ilp32d, lp64, lp64f,
21575 and lp64d. Some calling conventions are impossible to implement on
21576 some ISAs: for example, -march=rv32if -mabi=ilp32d is invalid
21577 because the ABI requires 64-bit values be passed in F registers,
21578 but F registers are only 32 bits wide. There is also the ilp32e
21579 ABI that can only be used with the rv32e architecture. This ABI is
21580 not well specified at present, and is subject to change.
21581
21582 -mfdiv
21583 -mno-fdiv
21584 Do or don't use hardware floating-point divide and square root
21585 instructions. This requires the F or D extensions for floating-
21586 point registers. The default is to use them if the specified
21587 architecture has these instructions.
21588
21589 -mdiv
21590 -mno-div
21591 Do or don't use hardware instructions for integer division. This
21592 requires the M extension. The default is to use them if the
21593 specified architecture has these instructions.
21594
21595 -march=ISA-string
21596 Generate code for given RISC-V ISA (e.g. rv64im). ISA strings must
21597 be lower-case. Examples include rv64i, rv32g, rv32e, and rv32imaf.
21598
21599 -mtune=processor-string
21600 Optimize the output for the given processor, specified by
21601 microarchitecture name. Permissible values for this option are:
21602 rocket, sifive-3-series, sifive-5-series, sifive-7-series, and
21603 size.
21604
21605 When -mtune= is not specified, the default is rocket.
21606
21607 The size choice is not intended for use by end-users. This is used
21608 when -Os is specified. It overrides the instruction cost info
21609 provided by -mtune=, but does not override the pipeline info. This
21610 helps reduce code size while still giving good performance.
21611
21612 -mpreferred-stack-boundary=num
21613 Attempt to keep the stack boundary aligned to a 2 raised to num
21614 byte boundary. If -mpreferred-stack-boundary is not specified, the
21615 default is 4 (16 bytes or 128-bits).
21616
21617 Warning: If you use this switch, then you must build all modules
21618 with the same value, including any libraries. This includes the
21619 system libraries and startup modules.
21620
21621 -msmall-data-limit=n
21622 Put global and static data smaller than n bytes into a special
21623 section (on some targets).
21624
21625 -msave-restore
21626 -mno-save-restore
21627 Do or don't use smaller but slower prologue and epilogue code that
21628 uses library function calls. The default is to use fast inline
21629 prologues and epilogues.
21630
21631 -mstrict-align
21632 -mno-strict-align
21633 Do not or do generate unaligned memory accesses. The default is
21634 set depending on whether the processor we are optimizing for
21635 supports fast unaligned access or not.
21636
21637 -mcmodel=medlow
21638 Generate code for the medium-low code model. The program and its
21639 statically defined symbols must lie within a single 2 GiB address
21640 range and must lie between absolute addresses -2 GiB and +2 GiB.
21641 Programs can be statically or dynamically linked. This is the
21642 default code model.
21643
21644 -mcmodel=medany
21645 Generate code for the medium-any code model. The program and its
21646 statically defined symbols must be within any single 2 GiB address
21647 range. Programs can be statically or dynamically linked.
21648
21649 -mexplicit-relocs
21650 -mno-exlicit-relocs
21651 Use or do not use assembler relocation operators when dealing with
21652 symbolic addresses. The alternative is to use assembler macros
21653 instead, which may limit optimization.
21654
21655 -mrelax
21656 -mno-relax
21657 Take advantage of linker relaxations to reduce the number of
21658 instructions required to materialize symbol addresses. The default
21659 is to take advantage of linker relaxations.
21660
21661 -memit-attribute
21662 -mno-emit-attribute
21663 Emit (do not emit) RISC-V attribute to record extra information
21664 into ELF objects. This feature requires at least binutils 2.32.
21665
21666 -malign-data=type
21667 Control how GCC aligns variables and constants of array, structure,
21668 or union types. Supported values for type are xlen which uses x
21669 register width as the alignment value, and natural which uses
21670 natural alignment. xlen is the default.
21671
21672 RL78 Options
21673 -msim
21674 Links in additional target libraries to support operation within a
21675 simulator.
21676
21677 -mmul=none
21678 -mmul=g10
21679 -mmul=g13
21680 -mmul=g14
21681 -mmul=rl78
21682 Specifies the type of hardware multiplication and division support
21683 to be used. The simplest is "none", which uses software for both
21684 multiplication and division. This is the default. The "g13" value
21685 is for the hardware multiply/divide peripheral found on the
21686 RL78/G13 (S2 core) targets. The "g14" value selects the use of the
21687 multiplication and division instructions supported by the RL78/G14
21688 (S3 core) parts. The value "rl78" is an alias for "g14" and the
21689 value "mg10" is an alias for "none".
21690
21691 In addition a C preprocessor macro is defined, based upon the
21692 setting of this option. Possible values are: "__RL78_MUL_NONE__",
21693 "__RL78_MUL_G13__" or "__RL78_MUL_G14__".
21694
21695 -mcpu=g10
21696 -mcpu=g13
21697 -mcpu=g14
21698 -mcpu=rl78
21699 Specifies the RL78 core to target. The default is the G14 core,
21700 also known as an S3 core or just RL78. The G13 or S2 core does not
21701 have multiply or divide instructions, instead it uses a hardware
21702 peripheral for these operations. The G10 or S1 core does not have
21703 register banks, so it uses a different calling convention.
21704
21705 If this option is set it also selects the type of hardware multiply
21706 support to use, unless this is overridden by an explicit -mmul=none
21707 option on the command line. Thus specifying -mcpu=g13 enables the
21708 use of the G13 hardware multiply peripheral and specifying
21709 -mcpu=g10 disables the use of hardware multiplications altogether.
21710
21711 Note, although the RL78/G14 core is the default target, specifying
21712 -mcpu=g14 or -mcpu=rl78 on the command line does change the
21713 behavior of the toolchain since it also enables G14 hardware
21714 multiply support. If these options are not specified on the
21715 command line then software multiplication routines will be used
21716 even though the code targets the RL78 core. This is for backwards
21717 compatibility with older toolchains which did not have hardware
21718 multiply and divide support.
21719
21720 In addition a C preprocessor macro is defined, based upon the
21721 setting of this option. Possible values are: "__RL78_G10__",
21722 "__RL78_G13__" or "__RL78_G14__".
21723
21724 -mg10
21725 -mg13
21726 -mg14
21727 -mrl78
21728 These are aliases for the corresponding -mcpu= option. They are
21729 provided for backwards compatibility.
21730
21731 -mallregs
21732 Allow the compiler to use all of the available registers. By
21733 default registers "r24..r31" are reserved for use in interrupt
21734 handlers. With this option enabled these registers can be used in
21735 ordinary functions as well.
21736
21737 -m64bit-doubles
21738 -m32bit-doubles
21739 Make the "double" data type be 64 bits (-m64bit-doubles) or 32 bits
21740 (-m32bit-doubles) in size. The default is -m32bit-doubles.
21741
21742 -msave-mduc-in-interrupts
21743 -mno-save-mduc-in-interrupts
21744 Specifies that interrupt handler functions should preserve the MDUC
21745 registers. This is only necessary if normal code might use the
21746 MDUC registers, for example because it performs multiplication and
21747 division operations. The default is to ignore the MDUC registers
21748 as this makes the interrupt handlers faster. The target option
21749 -mg13 needs to be passed for this to work as this feature is only
21750 available on the G13 target (S2 core). The MDUC registers will
21751 only be saved if the interrupt handler performs a multiplication or
21752 division operation or it calls another function.
21753
21754 IBM RS/6000 and PowerPC Options
21755 These -m options are defined for the IBM RS/6000 and PowerPC:
21756
21757 -mpowerpc-gpopt
21758 -mno-powerpc-gpopt
21759 -mpowerpc-gfxopt
21760 -mno-powerpc-gfxopt
21761 -mpowerpc64
21762 -mno-powerpc64
21763 -mmfcrf
21764 -mno-mfcrf
21765 -mpopcntb
21766 -mno-popcntb
21767 -mpopcntd
21768 -mno-popcntd
21769 -mfprnd
21770 -mno-fprnd
21771 -mcmpb
21772 -mno-cmpb
21773 -mhard-dfp
21774 -mno-hard-dfp
21775 You use these options to specify which instructions are available
21776 on the processor you are using. The default value of these options
21777 is determined when configuring GCC. Specifying the -mcpu=cpu_type
21778 overrides the specification of these options. We recommend you use
21779 the -mcpu=cpu_type option rather than the options listed above.
21780
21781 Specifying -mpowerpc-gpopt allows GCC to use the optional PowerPC
21782 architecture instructions in the General Purpose group, including
21783 floating-point square root. Specifying -mpowerpc-gfxopt allows GCC
21784 to use the optional PowerPC architecture instructions in the
21785 Graphics group, including floating-point select.
21786
21787 The -mmfcrf option allows GCC to generate the move from condition
21788 register field instruction implemented on the POWER4 processor and
21789 other processors that support the PowerPC V2.01 architecture. The
21790 -mpopcntb option allows GCC to generate the popcount and double-
21791 precision FP reciprocal estimate instruction implemented on the
21792 POWER5 processor and other processors that support the PowerPC
21793 V2.02 architecture. The -mpopcntd option allows GCC to generate
21794 the popcount instruction implemented on the POWER7 processor and
21795 other processors that support the PowerPC V2.06 architecture. The
21796 -mfprnd option allows GCC to generate the FP round to integer
21797 instructions implemented on the POWER5+ processor and other
21798 processors that support the PowerPC V2.03 architecture. The -mcmpb
21799 option allows GCC to generate the compare bytes instruction
21800 implemented on the POWER6 processor and other processors that
21801 support the PowerPC V2.05 architecture. The -mhard-dfp option
21802 allows GCC to generate the decimal floating-point instructions
21803 implemented on some POWER processors.
21804
21805 The -mpowerpc64 option allows GCC to generate the additional 64-bit
21806 instructions that are found in the full PowerPC64 architecture and
21807 to treat GPRs as 64-bit, doubleword quantities. GCC defaults to
21808 -mno-powerpc64.
21809
21810 -mcpu=cpu_type
21811 Set architecture type, register usage, and instruction scheduling
21812 parameters for machine type cpu_type. Supported values for
21813 cpu_type are 401, 403, 405, 405fp, 440, 440fp, 464, 464fp, 476,
21814 476fp, 505, 601, 602, 603, 603e, 604, 604e, 620, 630, 740, 7400,
21815 7450, 750, 801, 821, 823, 860, 970, 8540, a2, e300c2, e300c3,
21816 e500mc, e500mc64, e5500, e6500, ec603e, G3, G4, G5, titan, power3,
21817 power4, power5, power5+, power6, power6x, power7, power8, power9,
21818 future, powerpc, powerpc64, powerpc64le, rs64, and native.
21819
21820 -mcpu=powerpc, -mcpu=powerpc64, and -mcpu=powerpc64le specify pure
21821 32-bit PowerPC (either endian), 64-bit big endian PowerPC and
21822 64-bit little endian PowerPC architecture machine types, with an
21823 appropriate, generic processor model assumed for scheduling
21824 purposes.
21825
21826 Specifying native as cpu type detects and selects the architecture
21827 option that corresponds to the host processor of the system
21828 performing the compilation. -mcpu=native has no effect if GCC does
21829 not recognize the processor.
21830
21831 The other options specify a specific processor. Code generated
21832 under those options runs best on that processor, and may not run at
21833 all on others.
21834
21835 The -mcpu options automatically enable or disable the following
21836 options:
21837
21838 -maltivec -mfprnd -mhard-float -mmfcrf -mmultiple -mpopcntb
21839 -mpopcntd -mpowerpc64 -mpowerpc-gpopt -mpowerpc-gfxopt -mmulhw
21840 -mdlmzb -mmfpgpr -mvsx -mcrypto -mhtm -mpower8-fusion
21841 -mpower8-vector -mquad-memory -mquad-memory-atomic -mfloat128
21842 -mfloat128-hardware
21843
21844 The particular options set for any particular CPU varies between
21845 compiler versions, depending on what setting seems to produce
21846 optimal code for that CPU; it doesn't necessarily reflect the
21847 actual hardware's capabilities. If you wish to set an individual
21848 option to a particular value, you may specify it after the -mcpu
21849 option, like -mcpu=970 -mno-altivec.
21850
21851 On AIX, the -maltivec and -mpowerpc64 options are not enabled or
21852 disabled by the -mcpu option at present because AIX does not have
21853 full support for these options. You may still enable or disable
21854 them individually if you're sure it'll work in your environment.
21855
21856 -mtune=cpu_type
21857 Set the instruction scheduling parameters for machine type
21858 cpu_type, but do not set the architecture type or register usage,
21859 as -mcpu=cpu_type does. The same values for cpu_type are used for
21860 -mtune as for -mcpu. If both are specified, the code generated
21861 uses the architecture and registers set by -mcpu, but the
21862 scheduling parameters set by -mtune.
21863
21864 -mcmodel=small
21865 Generate PowerPC64 code for the small model: The TOC is limited to
21866 64k.
21867
21868 -mcmodel=medium
21869 Generate PowerPC64 code for the medium model: The TOC and other
21870 static data may be up to a total of 4G in size. This is the
21871 default for 64-bit Linux.
21872
21873 -mcmodel=large
21874 Generate PowerPC64 code for the large model: The TOC may be up to
21875 4G in size. Other data and code is only limited by the 64-bit
21876 address space.
21877
21878 -maltivec
21879 -mno-altivec
21880 Generate code that uses (does not use) AltiVec instructions, and
21881 also enable the use of built-in functions that allow more direct
21882 access to the AltiVec instruction set. You may also need to set
21883 -mabi=altivec to adjust the current ABI with AltiVec ABI
21884 enhancements.
21885
21886 When -maltivec is used, the element order for AltiVec intrinsics
21887 such as "vec_splat", "vec_extract", and "vec_insert" match array
21888 element order corresponding to the endianness of the target. That
21889 is, element zero identifies the leftmost element in a vector
21890 register when targeting a big-endian platform, and identifies the
21891 rightmost element in a vector register when targeting a little-
21892 endian platform.
21893
21894 -mvrsave
21895 -mno-vrsave
21896 Generate VRSAVE instructions when generating AltiVec code.
21897
21898 -msecure-plt
21899 Generate code that allows ld and ld.so to build executables and
21900 shared libraries with non-executable ".plt" and ".got" sections.
21901 This is a PowerPC 32-bit SYSV ABI option.
21902
21903 -mbss-plt
21904 Generate code that uses a BSS ".plt" section that ld.so fills in,
21905 and requires ".plt" and ".got" sections that are both writable and
21906 executable. This is a PowerPC 32-bit SYSV ABI option.
21907
21908 -misel
21909 -mno-isel
21910 This switch enables or disables the generation of ISEL
21911 instructions.
21912
21913 -mvsx
21914 -mno-vsx
21915 Generate code that uses (does not use) vector/scalar (VSX)
21916 instructions, and also enable the use of built-in functions that
21917 allow more direct access to the VSX instruction set.
21918
21919 -mcrypto
21920 -mno-crypto
21921 Enable the use (disable) of the built-in functions that allow
21922 direct access to the cryptographic instructions that were added in
21923 version 2.07 of the PowerPC ISA.
21924
21925 -mhtm
21926 -mno-htm
21927 Enable (disable) the use of the built-in functions that allow
21928 direct access to the Hardware Transactional Memory (HTM)
21929 instructions that were added in version 2.07 of the PowerPC ISA.
21930
21931 -mpower8-fusion
21932 -mno-power8-fusion
21933 Generate code that keeps (does not keeps) some integer operations
21934 adjacent so that the instructions can be fused together on power8
21935 and later processors.
21936
21937 -mpower8-vector
21938 -mno-power8-vector
21939 Generate code that uses (does not use) the vector and scalar
21940 instructions that were added in version 2.07 of the PowerPC ISA.
21941 Also enable the use of built-in functions that allow more direct
21942 access to the vector instructions.
21943
21944 -mquad-memory
21945 -mno-quad-memory
21946 Generate code that uses (does not use) the non-atomic quad word
21947 memory instructions. The -mquad-memory option requires use of
21948 64-bit mode.
21949
21950 -mquad-memory-atomic
21951 -mno-quad-memory-atomic
21952 Generate code that uses (does not use) the atomic quad word memory
21953 instructions. The -mquad-memory-atomic option requires use of
21954 64-bit mode.
21955
21956 -mfloat128
21957 -mno-float128
21958 Enable/disable the __float128 keyword for IEEE 128-bit floating
21959 point and use either software emulation for IEEE 128-bit floating
21960 point or hardware instructions.
21961
21962 The VSX instruction set (-mvsx, -mcpu=power7, -mcpu=power8), or
21963 -mcpu=power9 must be enabled to use the IEEE 128-bit floating point
21964 support. The IEEE 128-bit floating point support only works on
21965 PowerPC Linux systems.
21966
21967 The default for -mfloat128 is enabled on PowerPC Linux systems
21968 using the VSX instruction set, and disabled on other systems.
21969
21970 If you use the ISA 3.0 instruction set (-mpower9-vector or
21971 -mcpu=power9) on a 64-bit system, the IEEE 128-bit floating point
21972 support will also enable the generation of ISA 3.0 IEEE 128-bit
21973 floating point instructions. Otherwise, if you do not specify to
21974 generate ISA 3.0 instructions or you are targeting a 32-bit big
21975 endian system, IEEE 128-bit floating point will be done with
21976 software emulation.
21977
21978 -mfloat128-hardware
21979 -mno-float128-hardware
21980 Enable/disable using ISA 3.0 hardware instructions to support the
21981 __float128 data type.
21982
21983 The default for -mfloat128-hardware is enabled on PowerPC Linux
21984 systems using the ISA 3.0 instruction set, and disabled on other
21985 systems.
21986
21987 -m32
21988 -m64
21989 Generate code for 32-bit or 64-bit environments of Darwin and SVR4
21990 targets (including GNU/Linux). The 32-bit environment sets int,
21991 long and pointer to 32 bits and generates code that runs on any
21992 PowerPC variant. The 64-bit environment sets int to 32 bits and
21993 long and pointer to 64 bits, and generates code for PowerPC64, as
21994 for -mpowerpc64.
21995
21996 -mfull-toc
21997 -mno-fp-in-toc
21998 -mno-sum-in-toc
21999 -mminimal-toc
22000 Modify generation of the TOC (Table Of Contents), which is created
22001 for every executable file. The -mfull-toc option is selected by
22002 default. In that case, GCC allocates at least one TOC entry for
22003 each unique non-automatic variable reference in your program. GCC
22004 also places floating-point constants in the TOC. However, only
22005 16,384 entries are available in the TOC.
22006
22007 If you receive a linker error message that saying you have
22008 overflowed the available TOC space, you can reduce the amount of
22009 TOC space used with the -mno-fp-in-toc and -mno-sum-in-toc options.
22010 -mno-fp-in-toc prevents GCC from putting floating-point constants
22011 in the TOC and -mno-sum-in-toc forces GCC to generate code to
22012 calculate the sum of an address and a constant at run time instead
22013 of putting that sum into the TOC. You may specify one or both of
22014 these options. Each causes GCC to produce very slightly slower and
22015 larger code at the expense of conserving TOC space.
22016
22017 If you still run out of space in the TOC even when you specify both
22018 of these options, specify -mminimal-toc instead. This option
22019 causes GCC to make only one TOC entry for every file. When you
22020 specify this option, GCC produces code that is slower and larger
22021 but which uses extremely little TOC space. You may wish to use
22022 this option only on files that contain less frequently-executed
22023 code.
22024
22025 -maix64
22026 -maix32
22027 Enable 64-bit AIX ABI and calling convention: 64-bit pointers,
22028 64-bit "long" type, and the infrastructure needed to support them.
22029 Specifying -maix64 implies -mpowerpc64, while -maix32 disables the
22030 64-bit ABI and implies -mno-powerpc64. GCC defaults to -maix32.
22031
22032 -mxl-compat
22033 -mno-xl-compat
22034 Produce code that conforms more closely to IBM XL compiler
22035 semantics when using AIX-compatible ABI. Pass floating-point
22036 arguments to prototyped functions beyond the register save area
22037 (RSA) on the stack in addition to argument FPRs. Do not assume
22038 that most significant double in 128-bit long double value is
22039 properly rounded when comparing values and converting to double.
22040 Use XL symbol names for long double support routines.
22041
22042 The AIX calling convention was extended but not initially
22043 documented to handle an obscure K&R C case of calling a function
22044 that takes the address of its arguments with fewer arguments than
22045 declared. IBM XL compilers access floating-point arguments that do
22046 not fit in the RSA from the stack when a subroutine is compiled
22047 without optimization. Because always storing floating-point
22048 arguments on the stack is inefficient and rarely needed, this
22049 option is not enabled by default and only is necessary when calling
22050 subroutines compiled by IBM XL compilers without optimization.
22051
22052 -mpe
22053 Support IBM RS/6000 SP Parallel Environment (PE). Link an
22054 application written to use message passing with special startup
22055 code to enable the application to run. The system must have PE
22056 installed in the standard location (/usr/lpp/ppe.poe/), or the
22057 specs file must be overridden with the -specs= option to specify
22058 the appropriate directory location. The Parallel Environment does
22059 not support threads, so the -mpe option and the -pthread option are
22060 incompatible.
22061
22062 -malign-natural
22063 -malign-power
22064 On AIX, 32-bit Darwin, and 64-bit PowerPC GNU/Linux, the option
22065 -malign-natural overrides the ABI-defined alignment of larger
22066 types, such as floating-point doubles, on their natural size-based
22067 boundary. The option -malign-power instructs GCC to follow the
22068 ABI-specified alignment rules. GCC defaults to the standard
22069 alignment defined in the ABI.
22070
22071 On 64-bit Darwin, natural alignment is the default, and
22072 -malign-power is not supported.
22073
22074 -msoft-float
22075 -mhard-float
22076 Generate code that does not use (uses) the floating-point register
22077 set. Software floating-point emulation is provided if you use the
22078 -msoft-float option, and pass the option to GCC when linking.
22079
22080 -mmultiple
22081 -mno-multiple
22082 Generate code that uses (does not use) the load multiple word
22083 instructions and the store multiple word instructions. These
22084 instructions are generated by default on POWER systems, and not
22085 generated on PowerPC systems. Do not use -mmultiple on little-
22086 endian PowerPC systems, since those instructions do not work when
22087 the processor is in little-endian mode. The exceptions are PPC740
22088 and PPC750 which permit these instructions in little-endian mode.
22089
22090 -mupdate
22091 -mno-update
22092 Generate code that uses (does not use) the load or store
22093 instructions that update the base register to the address of the
22094 calculated memory location. These instructions are generated by
22095 default. If you use -mno-update, there is a small window between
22096 the time that the stack pointer is updated and the address of the
22097 previous frame is stored, which means code that walks the stack
22098 frame across interrupts or signals may get corrupted data.
22099
22100 -mavoid-indexed-addresses
22101 -mno-avoid-indexed-addresses
22102 Generate code that tries to avoid (not avoid) the use of indexed
22103 load or store instructions. These instructions can incur a
22104 performance penalty on Power6 processors in certain situations,
22105 such as when stepping through large arrays that cross a 16M
22106 boundary. This option is enabled by default when targeting Power6
22107 and disabled otherwise.
22108
22109 -mfused-madd
22110 -mno-fused-madd
22111 Generate code that uses (does not use) the floating-point multiply
22112 and accumulate instructions. These instructions are generated by
22113 default if hardware floating point is used. The machine-dependent
22114 -mfused-madd option is now mapped to the machine-independent
22115 -ffp-contract=fast option, and -mno-fused-madd is mapped to
22116 -ffp-contract=off.
22117
22118 -mmulhw
22119 -mno-mulhw
22120 Generate code that uses (does not use) the half-word multiply and
22121 multiply-accumulate instructions on the IBM 405, 440, 464 and 476
22122 processors. These instructions are generated by default when
22123 targeting those processors.
22124
22125 -mdlmzb
22126 -mno-dlmzb
22127 Generate code that uses (does not use) the string-search dlmzb
22128 instruction on the IBM 405, 440, 464 and 476 processors. This
22129 instruction is generated by default when targeting those
22130 processors.
22131
22132 -mno-bit-align
22133 -mbit-align
22134 On System V.4 and embedded PowerPC systems do not (do) force
22135 structures and unions that contain bit-fields to be aligned to the
22136 base type of the bit-field.
22137
22138 For example, by default a structure containing nothing but 8
22139 "unsigned" bit-fields of length 1 is aligned to a 4-byte boundary
22140 and has a size of 4 bytes. By using -mno-bit-align, the structure
22141 is aligned to a 1-byte boundary and is 1 byte in size.
22142
22143 -mno-strict-align
22144 -mstrict-align
22145 On System V.4 and embedded PowerPC systems do not (do) assume that
22146 unaligned memory references are handled by the system.
22147
22148 -mrelocatable
22149 -mno-relocatable
22150 Generate code that allows (does not allow) a static executable to
22151 be relocated to a different address at run time. A simple embedded
22152 PowerPC system loader should relocate the entire contents of
22153 ".got2" and 4-byte locations listed in the ".fixup" section, a
22154 table of 32-bit addresses generated by this option. For this to
22155 work, all objects linked together must be compiled with
22156 -mrelocatable or -mrelocatable-lib. -mrelocatable code aligns the
22157 stack to an 8-byte boundary.
22158
22159 -mrelocatable-lib
22160 -mno-relocatable-lib
22161 Like -mrelocatable, -mrelocatable-lib generates a ".fixup" section
22162 to allow static executables to be relocated at run time, but
22163 -mrelocatable-lib does not use the smaller stack alignment of
22164 -mrelocatable. Objects compiled with -mrelocatable-lib may be
22165 linked with objects compiled with any combination of the
22166 -mrelocatable options.
22167
22168 -mno-toc
22169 -mtoc
22170 On System V.4 and embedded PowerPC systems do not (do) assume that
22171 register 2 contains a pointer to a global area pointing to the
22172 addresses used in the program.
22173
22174 -mlittle
22175 -mlittle-endian
22176 On System V.4 and embedded PowerPC systems compile code for the
22177 processor in little-endian mode. The -mlittle-endian option is the
22178 same as -mlittle.
22179
22180 -mbig
22181 -mbig-endian
22182 On System V.4 and embedded PowerPC systems compile code for the
22183 processor in big-endian mode. The -mbig-endian option is the same
22184 as -mbig.
22185
22186 -mdynamic-no-pic
22187 On Darwin and Mac OS X systems, compile code so that it is not
22188 relocatable, but that its external references are relocatable. The
22189 resulting code is suitable for applications, but not shared
22190 libraries.
22191
22192 -msingle-pic-base
22193 Treat the register used for PIC addressing as read-only, rather
22194 than loading it in the prologue for each function. The runtime
22195 system is responsible for initializing this register with an
22196 appropriate value before execution begins.
22197
22198 -mprioritize-restricted-insns=priority
22199 This option controls the priority that is assigned to dispatch-slot
22200 restricted instructions during the second scheduling pass. The
22201 argument priority takes the value 0, 1, or 2 to assign no, highest,
22202 or second-highest (respectively) priority to dispatch-slot
22203 restricted instructions.
22204
22205 -msched-costly-dep=dependence_type
22206 This option controls which dependences are considered costly by the
22207 target during instruction scheduling. The argument dependence_type
22208 takes one of the following values:
22209
22210 no No dependence is costly.
22211
22212 all All dependences are costly.
22213
22214 true_store_to_load
22215 A true dependence from store to load is costly.
22216
22217 store_to_load
22218 Any dependence from store to load is costly.
22219
22220 number
22221 Any dependence for which the latency is greater than or equal
22222 to number is costly.
22223
22224 -minsert-sched-nops=scheme
22225 This option controls which NOP insertion scheme is used during the
22226 second scheduling pass. The argument scheme takes one of the
22227 following values:
22228
22229 no Don't insert NOPs.
22230
22231 pad Pad with NOPs any dispatch group that has vacant issue slots,
22232 according to the scheduler's grouping.
22233
22234 regroup_exact
22235 Insert NOPs to force costly dependent insns into separate
22236 groups. Insert exactly as many NOPs as needed to force an insn
22237 to a new group, according to the estimated processor grouping.
22238
22239 number
22240 Insert NOPs to force costly dependent insns into separate
22241 groups. Insert number NOPs to force an insn to a new group.
22242
22243 -mcall-sysv
22244 On System V.4 and embedded PowerPC systems compile code using
22245 calling conventions that adhere to the March 1995 draft of the
22246 System V Application Binary Interface, PowerPC processor
22247 supplement. This is the default unless you configured GCC using
22248 powerpc-*-eabiaix.
22249
22250 -mcall-sysv-eabi
22251 -mcall-eabi
22252 Specify both -mcall-sysv and -meabi options.
22253
22254 -mcall-sysv-noeabi
22255 Specify both -mcall-sysv and -mno-eabi options.
22256
22257 -mcall-aixdesc
22258 On System V.4 and embedded PowerPC systems compile code for the AIX
22259 operating system.
22260
22261 -mcall-linux
22262 On System V.4 and embedded PowerPC systems compile code for the
22263 Linux-based GNU system.
22264
22265 -mcall-freebsd
22266 On System V.4 and embedded PowerPC systems compile code for the
22267 FreeBSD operating system.
22268
22269 -mcall-netbsd
22270 On System V.4 and embedded PowerPC systems compile code for the
22271 NetBSD operating system.
22272
22273 -mcall-openbsd
22274 On System V.4 and embedded PowerPC systems compile code for the
22275 OpenBSD operating system.
22276
22277 -mtraceback=traceback_type
22278 Select the type of traceback table. Valid values for traceback_type
22279 are full, part, and no.
22280
22281 -maix-struct-return
22282 Return all structures in memory (as specified by the AIX ABI).
22283
22284 -msvr4-struct-return
22285 Return structures smaller than 8 bytes in registers (as specified
22286 by the SVR4 ABI).
22287
22288 -mabi=abi-type
22289 Extend the current ABI with a particular extension, or remove such
22290 extension. Valid values are altivec, no-altivec, ibmlongdouble,
22291 ieeelongdouble, elfv1, elfv2.
22292
22293 -mabi=ibmlongdouble
22294 Change the current ABI to use IBM extended-precision long double.
22295 This is not likely to work if your system defaults to using IEEE
22296 extended-precision long double. If you change the long double type
22297 from IEEE extended-precision, the compiler will issue a warning
22298 unless you use the -Wno-psabi option. Requires -mlong-double-128
22299 to be enabled.
22300
22301 -mabi=ieeelongdouble
22302 Change the current ABI to use IEEE extended-precision long double.
22303 This is not likely to work if your system defaults to using IBM
22304 extended-precision long double. If you change the long double type
22305 from IBM extended-precision, the compiler will issue a warning
22306 unless you use the -Wno-psabi option. Requires -mlong-double-128
22307 to be enabled.
22308
22309 -mabi=elfv1
22310 Change the current ABI to use the ELFv1 ABI. This is the default
22311 ABI for big-endian PowerPC 64-bit Linux. Overriding the default
22312 ABI requires special system support and is likely to fail in
22313 spectacular ways.
22314
22315 -mabi=elfv2
22316 Change the current ABI to use the ELFv2 ABI. This is the default
22317 ABI for little-endian PowerPC 64-bit Linux. Overriding the default
22318 ABI requires special system support and is likely to fail in
22319 spectacular ways.
22320
22321 -mgnu-attribute
22322 -mno-gnu-attribute
22323 Emit .gnu_attribute assembly directives to set tag/value pairs in a
22324 .gnu.attributes section that specify ABI variations in function
22325 parameters or return values.
22326
22327 -mprototype
22328 -mno-prototype
22329 On System V.4 and embedded PowerPC systems assume that all calls to
22330 variable argument functions are properly prototyped. Otherwise,
22331 the compiler must insert an instruction before every non-prototyped
22332 call to set or clear bit 6 of the condition code register ("CR") to
22333 indicate whether floating-point values are passed in the floating-
22334 point registers in case the function takes variable arguments.
22335 With -mprototype, only calls to prototyped variable argument
22336 functions set or clear the bit.
22337
22338 -msim
22339 On embedded PowerPC systems, assume that the startup module is
22340 called sim-crt0.o and that the standard C libraries are libsim.a
22341 and libc.a. This is the default for powerpc-*-eabisim
22342 configurations.
22343
22344 -mmvme
22345 On embedded PowerPC systems, assume that the startup module is
22346 called crt0.o and the standard C libraries are libmvme.a and
22347 libc.a.
22348
22349 -mads
22350 On embedded PowerPC systems, assume that the startup module is
22351 called crt0.o and the standard C libraries are libads.a and libc.a.
22352
22353 -myellowknife
22354 On embedded PowerPC systems, assume that the startup module is
22355 called crt0.o and the standard C libraries are libyk.a and libc.a.
22356
22357 -mvxworks
22358 On System V.4 and embedded PowerPC systems, specify that you are
22359 compiling for a VxWorks system.
22360
22361 -memb
22362 On embedded PowerPC systems, set the "PPC_EMB" bit in the ELF flags
22363 header to indicate that eabi extended relocations are used.
22364
22365 -meabi
22366 -mno-eabi
22367 On System V.4 and embedded PowerPC systems do (do not) adhere to
22368 the Embedded Applications Binary Interface (EABI), which is a set
22369 of modifications to the System V.4 specifications. Selecting
22370 -meabi means that the stack is aligned to an 8-byte boundary, a
22371 function "__eabi" is called from "main" to set up the EABI
22372 environment, and the -msdata option can use both "r2" and "r13" to
22373 point to two separate small data areas. Selecting -mno-eabi means
22374 that the stack is aligned to a 16-byte boundary, no EABI
22375 initialization function is called from "main", and the -msdata
22376 option only uses "r13" to point to a single small data area. The
22377 -meabi option is on by default if you configured GCC using one of
22378 the powerpc*-*-eabi* options.
22379
22380 -msdata=eabi
22381 On System V.4 and embedded PowerPC systems, put small initialized
22382 "const" global and static data in the ".sdata2" section, which is
22383 pointed to by register "r2". Put small initialized non-"const"
22384 global and static data in the ".sdata" section, which is pointed to
22385 by register "r13". Put small uninitialized global and static data
22386 in the ".sbss" section, which is adjacent to the ".sdata" section.
22387 The -msdata=eabi option is incompatible with the -mrelocatable
22388 option. The -msdata=eabi option also sets the -memb option.
22389
22390 -msdata=sysv
22391 On System V.4 and embedded PowerPC systems, put small global and
22392 static data in the ".sdata" section, which is pointed to by
22393 register "r13". Put small uninitialized global and static data in
22394 the ".sbss" section, which is adjacent to the ".sdata" section.
22395 The -msdata=sysv option is incompatible with the -mrelocatable
22396 option.
22397
22398 -msdata=default
22399 -msdata
22400 On System V.4 and embedded PowerPC systems, if -meabi is used,
22401 compile code the same as -msdata=eabi, otherwise compile code the
22402 same as -msdata=sysv.
22403
22404 -msdata=data
22405 On System V.4 and embedded PowerPC systems, put small global data
22406 in the ".sdata" section. Put small uninitialized global data in
22407 the ".sbss" section. Do not use register "r13" to address small
22408 data however. This is the default behavior unless other -msdata
22409 options are used.
22410
22411 -msdata=none
22412 -mno-sdata
22413 On embedded PowerPC systems, put all initialized global and static
22414 data in the ".data" section, and all uninitialized data in the
22415 ".bss" section.
22416
22417 -mreadonly-in-sdata
22418 Put read-only objects in the ".sdata" section as well. This is the
22419 default.
22420
22421 -mblock-move-inline-limit=num
22422 Inline all block moves (such as calls to "memcpy" or structure
22423 copies) less than or equal to num bytes. The minimum value for num
22424 is 32 bytes on 32-bit targets and 64 bytes on 64-bit targets. The
22425 default value is target-specific.
22426
22427 -mblock-compare-inline-limit=num
22428 Generate non-looping inline code for all block compares (such as
22429 calls to "memcmp" or structure compares) less than or equal to num
22430 bytes. If num is 0, all inline expansion (non-loop and loop) of
22431 block compare is disabled. The default value is target-specific.
22432
22433 -mblock-compare-inline-loop-limit=num
22434 Generate an inline expansion using loop code for all block compares
22435 that are less than or equal to num bytes, but greater than the
22436 limit for non-loop inline block compare expansion. If the block
22437 length is not constant, at most num bytes will be compared before
22438 "memcmp" is called to compare the remainder of the block. The
22439 default value is target-specific.
22440
22441 -mstring-compare-inline-limit=num
22442 Compare at most num string bytes with inline code. If the
22443 difference or end of string is not found at the end of the inline
22444 compare a call to "strcmp" or "strncmp" will take care of the rest
22445 of the comparison. The default is 64 bytes.
22446
22447 -G num
22448 On embedded PowerPC systems, put global and static items less than
22449 or equal to num bytes into the small data or BSS sections instead
22450 of the normal data or BSS section. By default, num is 8. The -G
22451 num switch is also passed to the linker. All modules should be
22452 compiled with the same -G num value.
22453
22454 -mregnames
22455 -mno-regnames
22456 On System V.4 and embedded PowerPC systems do (do not) emit
22457 register names in the assembly language output using symbolic
22458 forms.
22459
22460 -mlongcall
22461 -mno-longcall
22462 By default assume that all calls are far away so that a longer and
22463 more expensive calling sequence is required. This is required for
22464 calls farther than 32 megabytes (33,554,432 bytes) from the current
22465 location. A short call is generated if the compiler knows the call
22466 cannot be that far away. This setting can be overridden by the
22467 "shortcall" function attribute, or by "#pragma longcall(0)".
22468
22469 Some linkers are capable of detecting out-of-range calls and
22470 generating glue code on the fly. On these systems, long calls are
22471 unnecessary and generate slower code. As of this writing, the AIX
22472 linker can do this, as can the GNU linker for PowerPC/64. It is
22473 planned to add this feature to the GNU linker for 32-bit PowerPC
22474 systems as well.
22475
22476 On PowerPC64 ELFv2 and 32-bit PowerPC systems with newer GNU
22477 linkers, GCC can generate long calls using an inline PLT call
22478 sequence (see -mpltseq). PowerPC with -mbss-plt and PowerPC64
22479 ELFv1 (big-endian) do not support inline PLT calls.
22480
22481 On Darwin/PPC systems, "#pragma longcall" generates "jbsr callee,
22482 L42", plus a branch island (glue code). The two target addresses
22483 represent the callee and the branch island. The Darwin/PPC linker
22484 prefers the first address and generates a "bl callee" if the PPC
22485 "bl" instruction reaches the callee directly; otherwise, the linker
22486 generates "bl L42" to call the branch island. The branch island is
22487 appended to the body of the calling function; it computes the full
22488 32-bit address of the callee and jumps to it.
22489
22490 On Mach-O (Darwin) systems, this option directs the compiler emit
22491 to the glue for every direct call, and the Darwin linker decides
22492 whether to use or discard it.
22493
22494 In the future, GCC may ignore all longcall specifications when the
22495 linker is known to generate glue.
22496
22497 -mpltseq
22498 -mno-pltseq
22499 Implement (do not implement) -fno-plt and long calls using an
22500 inline PLT call sequence that supports lazy linking and long calls
22501 to functions in dlopen'd shared libraries. Inline PLT calls are
22502 only supported on PowerPC64 ELFv2 and 32-bit PowerPC systems with
22503 newer GNU linkers, and are enabled by default if the support is
22504 detected when configuring GCC, and, in the case of 32-bit PowerPC,
22505 if GCC is configured with --enable-secureplt. -mpltseq code and
22506 -mbss-plt 32-bit PowerPC relocatable objects may not be linked
22507 together.
22508
22509 -mtls-markers
22510 -mno-tls-markers
22511 Mark (do not mark) calls to "__tls_get_addr" with a relocation
22512 specifying the function argument. The relocation allows the linker
22513 to reliably associate function call with argument setup
22514 instructions for TLS optimization, which in turn allows GCC to
22515 better schedule the sequence.
22516
22517 -mrecip
22518 -mno-recip
22519 This option enables use of the reciprocal estimate and reciprocal
22520 square root estimate instructions with additional Newton-Raphson
22521 steps to increase precision instead of doing a divide or square
22522 root and divide for floating-point arguments. You should use the
22523 -ffast-math option when using -mrecip (or at least
22524 -funsafe-math-optimizations, -ffinite-math-only, -freciprocal-math
22525 and -fno-trapping-math). Note that while the throughput of the
22526 sequence is generally higher than the throughput of the non-
22527 reciprocal instruction, the precision of the sequence can be
22528 decreased by up to 2 ulp (i.e. the inverse of 1.0 equals
22529 0.99999994) for reciprocal square roots.
22530
22531 -mrecip=opt
22532 This option controls which reciprocal estimate instructions may be
22533 used. opt is a comma-separated list of options, which may be
22534 preceded by a "!" to invert the option:
22535
22536 all Enable all estimate instructions.
22537
22538 default
22539 Enable the default instructions, equivalent to -mrecip.
22540
22541 none
22542 Disable all estimate instructions, equivalent to -mno-recip.
22543
22544 div Enable the reciprocal approximation instructions for both
22545 single and double precision.
22546
22547 divf
22548 Enable the single-precision reciprocal approximation
22549 instructions.
22550
22551 divd
22552 Enable the double-precision reciprocal approximation
22553 instructions.
22554
22555 rsqrt
22556 Enable the reciprocal square root approximation instructions
22557 for both single and double precision.
22558
22559 rsqrtf
22560 Enable the single-precision reciprocal square root
22561 approximation instructions.
22562
22563 rsqrtd
22564 Enable the double-precision reciprocal square root
22565 approximation instructions.
22566
22567 So, for example, -mrecip=all,!rsqrtd enables all of the reciprocal
22568 estimate instructions, except for the "FRSQRTE", "XSRSQRTEDP", and
22569 "XVRSQRTEDP" instructions which handle the double-precision
22570 reciprocal square root calculations.
22571
22572 -mrecip-precision
22573 -mno-recip-precision
22574 Assume (do not assume) that the reciprocal estimate instructions
22575 provide higher-precision estimates than is mandated by the PowerPC
22576 ABI. Selecting -mcpu=power6, -mcpu=power7 or -mcpu=power8
22577 automatically selects -mrecip-precision. The double-precision
22578 square root estimate instructions are not generated by default on
22579 low-precision machines, since they do not provide an estimate that
22580 converges after three steps.
22581
22582 -mveclibabi=type
22583 Specifies the ABI type to use for vectorizing intrinsics using an
22584 external library. The only type supported at present is mass,
22585 which specifies to use IBM's Mathematical Acceleration Subsystem
22586 (MASS) libraries for vectorizing intrinsics using external
22587 libraries. GCC currently emits calls to "acosd2", "acosf4",
22588 "acoshd2", "acoshf4", "asind2", "asinf4", "asinhd2", "asinhf4",
22589 "atan2d2", "atan2f4", "atand2", "atanf4", "atanhd2", "atanhf4",
22590 "cbrtd2", "cbrtf4", "cosd2", "cosf4", "coshd2", "coshf4", "erfcd2",
22591 "erfcf4", "erfd2", "erff4", "exp2d2", "exp2f4", "expd2", "expf4",
22592 "expm1d2", "expm1f4", "hypotd2", "hypotf4", "lgammad2", "lgammaf4",
22593 "log10d2", "log10f4", "log1pd2", "log1pf4", "log2d2", "log2f4",
22594 "logd2", "logf4", "powd2", "powf4", "sind2", "sinf4", "sinhd2",
22595 "sinhf4", "sqrtd2", "sqrtf4", "tand2", "tanf4", "tanhd2", and
22596 "tanhf4" when generating code for power7. Both -ftree-vectorize
22597 and -funsafe-math-optimizations must also be enabled. The MASS
22598 libraries must be specified at link time.
22599
22600 -mfriz
22601 -mno-friz
22602 Generate (do not generate) the "friz" instruction when the
22603 -funsafe-math-optimizations option is used to optimize rounding of
22604 floating-point values to 64-bit integer and back to floating point.
22605 The "friz" instruction does not return the same value if the
22606 floating-point number is too large to fit in an integer.
22607
22608 -mpointers-to-nested-functions
22609 -mno-pointers-to-nested-functions
22610 Generate (do not generate) code to load up the static chain
22611 register ("r11") when calling through a pointer on AIX and 64-bit
22612 Linux systems where a function pointer points to a 3-word
22613 descriptor giving the function address, TOC value to be loaded in
22614 register "r2", and static chain value to be loaded in register
22615 "r11". The -mpointers-to-nested-functions is on by default. You
22616 cannot call through pointers to nested functions or pointers to
22617 functions compiled in other languages that use the static chain if
22618 you use -mno-pointers-to-nested-functions.
22619
22620 -msave-toc-indirect
22621 -mno-save-toc-indirect
22622 Generate (do not generate) code to save the TOC value in the
22623 reserved stack location in the function prologue if the function
22624 calls through a pointer on AIX and 64-bit Linux systems. If the
22625 TOC value is not saved in the prologue, it is saved just before the
22626 call through the pointer. The -mno-save-toc-indirect option is the
22627 default.
22628
22629 -mcompat-align-parm
22630 -mno-compat-align-parm
22631 Generate (do not generate) code to pass structure parameters with a
22632 maximum alignment of 64 bits, for compatibility with older versions
22633 of GCC.
22634
22635 Older versions of GCC (prior to 4.9.0) incorrectly did not align a
22636 structure parameter on a 128-bit boundary when that structure
22637 contained a member requiring 128-bit alignment. This is corrected
22638 in more recent versions of GCC. This option may be used to
22639 generate code that is compatible with functions compiled with older
22640 versions of GCC.
22641
22642 The -mno-compat-align-parm option is the default.
22643
22644 -mstack-protector-guard=guard
22645 -mstack-protector-guard-reg=reg
22646 -mstack-protector-guard-offset=offset
22647 -mstack-protector-guard-symbol=symbol
22648 Generate stack protection code using canary at guard. Supported
22649 locations are global for global canary or tls for per-thread canary
22650 in the TLS block (the default with GNU libc version 2.4 or later).
22651
22652 With the latter choice the options -mstack-protector-guard-reg=reg
22653 and -mstack-protector-guard-offset=offset furthermore specify which
22654 register to use as base register for reading the canary, and from
22655 what offset from that base register. The default for those is as
22656 specified in the relevant ABI.
22657 -mstack-protector-guard-symbol=symbol overrides the offset with a
22658 symbol reference to a canary in the TLS block.
22659
22660 -mpcrel
22661 -mno-pcrel
22662 Generate (do not generate) pc-relative addressing when the option
22663 -mcpu=future is used. The -mpcrel option requires that the medium
22664 code model (-mcmodel=medium) and prefixed addressing (-mprefixed)
22665 options are enabled.
22666
22667 -mprefixed
22668 -mno-prefixed
22669 Generate (do not generate) addressing modes using prefixed load and
22670 store instructions when the option -mcpu=future is used.
22671
22672 RX Options
22673 These command-line options are defined for RX targets:
22674
22675 -m64bit-doubles
22676 -m32bit-doubles
22677 Make the "double" data type be 64 bits (-m64bit-doubles) or 32 bits
22678 (-m32bit-doubles) in size. The default is -m32bit-doubles. Note
22679 RX floating-point hardware only works on 32-bit values, which is
22680 why the default is -m32bit-doubles.
22681
22682 -fpu
22683 -nofpu
22684 Enables (-fpu) or disables (-nofpu) the use of RX floating-point
22685 hardware. The default is enabled for the RX600 series and disabled
22686 for the RX200 series.
22687
22688 Floating-point instructions are only generated for 32-bit floating-
22689 point values, however, so the FPU hardware is not used for doubles
22690 if the -m64bit-doubles option is used.
22691
22692 Note If the -fpu option is enabled then -funsafe-math-optimizations
22693 is also enabled automatically. This is because the RX FPU
22694 instructions are themselves unsafe.
22695
22696 -mcpu=name
22697 Selects the type of RX CPU to be targeted. Currently three types
22698 are supported, the generic RX600 and RX200 series hardware and the
22699 specific RX610 CPU. The default is RX600.
22700
22701 The only difference between RX600 and RX610 is that the RX610 does
22702 not support the "MVTIPL" instruction.
22703
22704 The RX200 series does not have a hardware floating-point unit and
22705 so -nofpu is enabled by default when this type is selected.
22706
22707 -mbig-endian-data
22708 -mlittle-endian-data
22709 Store data (but not code) in the big-endian format. The default is
22710 -mlittle-endian-data, i.e. to store data in the little-endian
22711 format.
22712
22713 -msmall-data-limit=N
22714 Specifies the maximum size in bytes of global and static variables
22715 which can be placed into the small data area. Using the small data
22716 area can lead to smaller and faster code, but the size of area is
22717 limited and it is up to the programmer to ensure that the area does
22718 not overflow. Also when the small data area is used one of the
22719 RX's registers (usually "r13") is reserved for use pointing to this
22720 area, so it is no longer available for use by the compiler. This
22721 could result in slower and/or larger code if variables are pushed
22722 onto the stack instead of being held in this register.
22723
22724 Note, common variables (variables that have not been initialized)
22725 and constants are not placed into the small data area as they are
22726 assigned to other sections in the output executable.
22727
22728 The default value is zero, which disables this feature. Note, this
22729 feature is not enabled by default with higher optimization levels
22730 (-O2 etc) because of the potentially detrimental effects of
22731 reserving a register. It is up to the programmer to experiment and
22732 discover whether this feature is of benefit to their program. See
22733 the description of the -mpid option for a description of how the
22734 actual register to hold the small data area pointer is chosen.
22735
22736 -msim
22737 -mno-sim
22738 Use the simulator runtime. The default is to use the libgloss
22739 board-specific runtime.
22740
22741 -mas100-syntax
22742 -mno-as100-syntax
22743 When generating assembler output use a syntax that is compatible
22744 with Renesas's AS100 assembler. This syntax can also be handled by
22745 the GAS assembler, but it has some restrictions so it is not
22746 generated by default.
22747
22748 -mmax-constant-size=N
22749 Specifies the maximum size, in bytes, of a constant that can be
22750 used as an operand in a RX instruction. Although the RX
22751 instruction set does allow constants of up to 4 bytes in length to
22752 be used in instructions, a longer value equates to a longer
22753 instruction. Thus in some circumstances it can be beneficial to
22754 restrict the size of constants that are used in instructions.
22755 Constants that are too big are instead placed into a constant pool
22756 and referenced via register indirection.
22757
22758 The value N can be between 0 and 4. A value of 0 (the default) or
22759 4 means that constants of any size are allowed.
22760
22761 -mrelax
22762 Enable linker relaxation. Linker relaxation is a process whereby
22763 the linker attempts to reduce the size of a program by finding
22764 shorter versions of various instructions. Disabled by default.
22765
22766 -mint-register=N
22767 Specify the number of registers to reserve for fast interrupt
22768 handler functions. The value N can be between 0 and 4. A value of
22769 1 means that register "r13" is reserved for the exclusive use of
22770 fast interrupt handlers. A value of 2 reserves "r13" and "r12". A
22771 value of 3 reserves "r13", "r12" and "r11", and a value of 4
22772 reserves "r13" through "r10". A value of 0, the default, does not
22773 reserve any registers.
22774
22775 -msave-acc-in-interrupts
22776 Specifies that interrupt handler functions should preserve the
22777 accumulator register. This is only necessary if normal code might
22778 use the accumulator register, for example because it performs
22779 64-bit multiplications. The default is to ignore the accumulator
22780 as this makes the interrupt handlers faster.
22781
22782 -mpid
22783 -mno-pid
22784 Enables the generation of position independent data. When enabled
22785 any access to constant data is done via an offset from a base
22786 address held in a register. This allows the location of constant
22787 data to be determined at run time without requiring the executable
22788 to be relocated, which is a benefit to embedded applications with
22789 tight memory constraints. Data that can be modified is not
22790 affected by this option.
22791
22792 Note, using this feature reserves a register, usually "r13", for
22793 the constant data base address. This can result in slower and/or
22794 larger code, especially in complicated functions.
22795
22796 The actual register chosen to hold the constant data base address
22797 depends upon whether the -msmall-data-limit and/or the
22798 -mint-register command-line options are enabled. Starting with
22799 register "r13" and proceeding downwards, registers are allocated
22800 first to satisfy the requirements of -mint-register, then -mpid and
22801 finally -msmall-data-limit. Thus it is possible for the small data
22802 area register to be "r8" if both -mint-register=4 and -mpid are
22803 specified on the command line.
22804
22805 By default this feature is not enabled. The default can be
22806 restored via the -mno-pid command-line option.
22807
22808 -mno-warn-multiple-fast-interrupts
22809 -mwarn-multiple-fast-interrupts
22810 Prevents GCC from issuing a warning message if it finds more than
22811 one fast interrupt handler when it is compiling a file. The
22812 default is to issue a warning for each extra fast interrupt handler
22813 found, as the RX only supports one such interrupt.
22814
22815 -mallow-string-insns
22816 -mno-allow-string-insns
22817 Enables or disables the use of the string manipulation instructions
22818 "SMOVF", "SCMPU", "SMOVB", "SMOVU", "SUNTIL" "SWHILE" and also the
22819 "RMPA" instruction. These instructions may prefetch data, which is
22820 not safe to do if accessing an I/O register. (See section 12.2.7
22821 of the RX62N Group User's Manual for more information).
22822
22823 The default is to allow these instructions, but it is not possible
22824 for GCC to reliably detect all circumstances where a string
22825 instruction might be used to access an I/O register, so their use
22826 cannot be disabled automatically. Instead it is reliant upon the
22827 programmer to use the -mno-allow-string-insns option if their
22828 program accesses I/O space.
22829
22830 When the instructions are enabled GCC defines the C preprocessor
22831 symbol "__RX_ALLOW_STRING_INSNS__", otherwise it defines the symbol
22832 "__RX_DISALLOW_STRING_INSNS__".
22833
22834 -mjsr
22835 -mno-jsr
22836 Use only (or not only) "JSR" instructions to access functions.
22837 This option can be used when code size exceeds the range of "BSR"
22838 instructions. Note that -mno-jsr does not mean to not use "JSR"
22839 but instead means that any type of branch may be used.
22840
22841 Note: The generic GCC command-line option -ffixed-reg has special
22842 significance to the RX port when used with the "interrupt" function
22843 attribute. This attribute indicates a function intended to process
22844 fast interrupts. GCC ensures that it only uses the registers "r10",
22845 "r11", "r12" and/or "r13" and only provided that the normal use of the
22846 corresponding registers have been restricted via the -ffixed-reg or
22847 -mint-register command-line options.
22848
22849 S/390 and zSeries Options
22850 These are the -m options defined for the S/390 and zSeries
22851 architecture.
22852
22853 -mhard-float
22854 -msoft-float
22855 Use (do not use) the hardware floating-point instructions and
22856 registers for floating-point operations. When -msoft-float is
22857 specified, functions in libgcc.a are used to perform floating-point
22858 operations. When -mhard-float is specified, the compiler generates
22859 IEEE floating-point instructions. This is the default.
22860
22861 -mhard-dfp
22862 -mno-hard-dfp
22863 Use (do not use) the hardware decimal-floating-point instructions
22864 for decimal-floating-point operations. When -mno-hard-dfp is
22865 specified, functions in libgcc.a are used to perform decimal-
22866 floating-point operations. When -mhard-dfp is specified, the
22867 compiler generates decimal-floating-point hardware instructions.
22868 This is the default for -march=z9-ec or higher.
22869
22870 -mlong-double-64
22871 -mlong-double-128
22872 These switches control the size of "long double" type. A size of 64
22873 bits makes the "long double" type equivalent to the "double" type.
22874 This is the default.
22875
22876 -mbackchain
22877 -mno-backchain
22878 Store (do not store) the address of the caller's frame as backchain
22879 pointer into the callee's stack frame. A backchain may be needed
22880 to allow debugging using tools that do not understand DWARF call
22881 frame information. When -mno-packed-stack is in effect, the
22882 backchain pointer is stored at the bottom of the stack frame; when
22883 -mpacked-stack is in effect, the backchain is placed into the
22884 topmost word of the 96/160 byte register save area.
22885
22886 In general, code compiled with -mbackchain is call-compatible with
22887 code compiled with -mmo-backchain; however, use of the backchain
22888 for debugging purposes usually requires that the whole binary is
22889 built with -mbackchain. Note that the combination of -mbackchain,
22890 -mpacked-stack and -mhard-float is not supported. In order to
22891 build a linux kernel use -msoft-float.
22892
22893 The default is to not maintain the backchain.
22894
22895 -mpacked-stack
22896 -mno-packed-stack
22897 Use (do not use) the packed stack layout. When -mno-packed-stack
22898 is specified, the compiler uses the all fields of the 96/160 byte
22899 register save area only for their default purpose; unused fields
22900 still take up stack space. When -mpacked-stack is specified,
22901 register save slots are densely packed at the top of the register
22902 save area; unused space is reused for other purposes, allowing for
22903 more efficient use of the available stack space. However, when
22904 -mbackchain is also in effect, the topmost word of the save area is
22905 always used to store the backchain, and the return address register
22906 is always saved two words below the backchain.
22907
22908 As long as the stack frame backchain is not used, code generated
22909 with -mpacked-stack is call-compatible with code generated with
22910 -mno-packed-stack. Note that some non-FSF releases of GCC 2.95 for
22911 S/390 or zSeries generated code that uses the stack frame backchain
22912 at run time, not just for debugging purposes. Such code is not
22913 call-compatible with code compiled with -mpacked-stack. Also, note
22914 that the combination of -mbackchain, -mpacked-stack and
22915 -mhard-float is not supported. In order to build a linux kernel
22916 use -msoft-float.
22917
22918 The default is to not use the packed stack layout.
22919
22920 -msmall-exec
22921 -mno-small-exec
22922 Generate (or do not generate) code using the "bras" instruction to
22923 do subroutine calls. This only works reliably if the total
22924 executable size does not exceed 64k. The default is to use the
22925 "basr" instruction instead, which does not have this limitation.
22926
22927 -m64
22928 -m31
22929 When -m31 is specified, generate code compliant to the GNU/Linux
22930 for S/390 ABI. When -m64 is specified, generate code compliant to
22931 the GNU/Linux for zSeries ABI. This allows GCC in particular to
22932 generate 64-bit instructions. For the s390 targets, the default is
22933 -m31, while the s390x targets default to -m64.
22934
22935 -mzarch
22936 -mesa
22937 When -mzarch is specified, generate code using the instructions
22938 available on z/Architecture. When -mesa is specified, generate
22939 code using the instructions available on ESA/390. Note that -mesa
22940 is not possible with -m64. When generating code compliant to the
22941 GNU/Linux for S/390 ABI, the default is -mesa. When generating
22942 code compliant to the GNU/Linux for zSeries ABI, the default is
22943 -mzarch.
22944
22945 -mhtm
22946 -mno-htm
22947 The -mhtm option enables a set of builtins making use of
22948 instructions available with the transactional execution facility
22949 introduced with the IBM zEnterprise EC12 machine generation S/390
22950 System z Built-in Functions. -mhtm is enabled by default when
22951 using -march=zEC12.
22952
22953 -mvx
22954 -mno-vx
22955 When -mvx is specified, generate code using the instructions
22956 available with the vector extension facility introduced with the
22957 IBM z13 machine generation. This option changes the ABI for some
22958 vector type values with regard to alignment and calling
22959 conventions. In case vector type values are being used in an ABI-
22960 relevant context a GAS .gnu_attribute command will be added to mark
22961 the resulting binary with the ABI used. -mvx is enabled by default
22962 when using -march=z13.
22963
22964 -mzvector
22965 -mno-zvector
22966 The -mzvector option enables vector language extensions and
22967 builtins using instructions available with the vector extension
22968 facility introduced with the IBM z13 machine generation. This
22969 option adds support for vector to be used as a keyword to define
22970 vector type variables and arguments. vector is only available when
22971 GNU extensions are enabled. It will not be expanded when
22972 requesting strict standard compliance e.g. with -std=c99. In
22973 addition to the GCC low-level builtins -mzvector enables a set of
22974 builtins added for compatibility with AltiVec-style implementations
22975 like Power and Cell. In order to make use of these builtins the
22976 header file vecintrin.h needs to be included. -mzvector is
22977 disabled by default.
22978
22979 -mmvcle
22980 -mno-mvcle
22981 Generate (or do not generate) code using the "mvcle" instruction to
22982 perform block moves. When -mno-mvcle is specified, use a "mvc"
22983 loop instead. This is the default unless optimizing for size.
22984
22985 -mdebug
22986 -mno-debug
22987 Print (or do not print) additional debug information when
22988 compiling. The default is to not print debug information.
22989
22990 -march=cpu-type
22991 Generate code that runs on cpu-type, which is the name of a system
22992 representing a certain processor type. Possible values for cpu-
22993 type are z900/arch5, z990/arch6, z9-109, z9-ec/arch7, z10/arch8,
22994 z196/arch9, zEC12, z13/arch11, z14/arch12, and native.
22995
22996 The default is -march=z900.
22997
22998 Specifying native as cpu type can be used to select the best
22999 architecture option for the host processor. -march=native has no
23000 effect if GCC does not recognize the processor.
23001
23002 -mtune=cpu-type
23003 Tune to cpu-type everything applicable about the generated code,
23004 except for the ABI and the set of available instructions. The list
23005 of cpu-type values is the same as for -march. The default is the
23006 value used for -march.
23007
23008 -mtpf-trace
23009 -mno-tpf-trace
23010 Generate code that adds (does not add) in TPF OS specific branches
23011 to trace routines in the operating system. This option is off by
23012 default, even when compiling for the TPF OS.
23013
23014 -mtpf-trace-skip
23015 -mno-tpf-trace-skip
23016 Generate code that changes (does not change) the default branch
23017 targets enabled by -mtpf-trace to point to specialized trace
23018 routines providing the ability of selectively skipping function
23019 trace entries for the TPF OS. This option is off by default, even
23020 when compiling for the TPF OS and specifying -mtpf-trace.
23021
23022 -mfused-madd
23023 -mno-fused-madd
23024 Generate code that uses (does not use) the floating-point multiply
23025 and accumulate instructions. These instructions are generated by
23026 default if hardware floating point is used.
23027
23028 -mwarn-framesize=framesize
23029 Emit a warning if the current function exceeds the given frame
23030 size. Because this is a compile-time check it doesn't need to be a
23031 real problem when the program runs. It is intended to identify
23032 functions that most probably cause a stack overflow. It is useful
23033 to be used in an environment with limited stack size e.g. the linux
23034 kernel.
23035
23036 -mwarn-dynamicstack
23037 Emit a warning if the function calls "alloca" or uses dynamically-
23038 sized arrays. This is generally a bad idea with a limited stack
23039 size.
23040
23041 -mstack-guard=stack-guard
23042 -mstack-size=stack-size
23043 If these options are provided the S/390 back end emits additional
23044 instructions in the function prologue that trigger a trap if the
23045 stack size is stack-guard bytes above the stack-size (remember that
23046 the stack on S/390 grows downward). If the stack-guard option is
23047 omitted the smallest power of 2 larger than the frame size of the
23048 compiled function is chosen. These options are intended to be used
23049 to help debugging stack overflow problems. The additionally
23050 emitted code causes only little overhead and hence can also be used
23051 in production-like systems without greater performance degradation.
23052 The given values have to be exact powers of 2 and stack-size has to
23053 be greater than stack-guard without exceeding 64k. In order to be
23054 efficient the extra code makes the assumption that the stack starts
23055 at an address aligned to the value given by stack-size. The stack-
23056 guard option can only be used in conjunction with stack-size.
23057
23058 -mhotpatch=pre-halfwords,post-halfwords
23059 If the hotpatch option is enabled, a "hot-patching" function
23060 prologue is generated for all functions in the compilation unit.
23061 The funtion label is prepended with the given number of two-byte
23062 NOP instructions (pre-halfwords, maximum 1000000). After the
23063 label, 2 * post-halfwords bytes are appended, using the largest NOP
23064 like instructions the architecture allows (maximum 1000000).
23065
23066 If both arguments are zero, hotpatching is disabled.
23067
23068 This option can be overridden for individual functions with the
23069 "hotpatch" attribute.
23070
23071 Score Options
23072 These options are defined for Score implementations:
23073
23074 -meb
23075 Compile code for big-endian mode. This is the default.
23076
23077 -mel
23078 Compile code for little-endian mode.
23079
23080 -mnhwloop
23081 Disable generation of "bcnz" instructions.
23082
23083 -muls
23084 Enable generation of unaligned load and store instructions.
23085
23086 -mmac
23087 Enable the use of multiply-accumulate instructions. Disabled by
23088 default.
23089
23090 -mscore5
23091 Specify the SCORE5 as the target architecture.
23092
23093 -mscore5u
23094 Specify the SCORE5U of the target architecture.
23095
23096 -mscore7
23097 Specify the SCORE7 as the target architecture. This is the default.
23098
23099 -mscore7d
23100 Specify the SCORE7D as the target architecture.
23101
23102 SH Options
23103 These -m options are defined for the SH implementations:
23104
23105 -m1 Generate code for the SH1.
23106
23107 -m2 Generate code for the SH2.
23108
23109 -m2e
23110 Generate code for the SH2e.
23111
23112 -m2a-nofpu
23113 Generate code for the SH2a without FPU, or for a SH2a-FPU in such a
23114 way that the floating-point unit is not used.
23115
23116 -m2a-single-only
23117 Generate code for the SH2a-FPU, in such a way that no double-
23118 precision floating-point operations are used.
23119
23120 -m2a-single
23121 Generate code for the SH2a-FPU assuming the floating-point unit is
23122 in single-precision mode by default.
23123
23124 -m2a
23125 Generate code for the SH2a-FPU assuming the floating-point unit is
23126 in double-precision mode by default.
23127
23128 -m3 Generate code for the SH3.
23129
23130 -m3e
23131 Generate code for the SH3e.
23132
23133 -m4-nofpu
23134 Generate code for the SH4 without a floating-point unit.
23135
23136 -m4-single-only
23137 Generate code for the SH4 with a floating-point unit that only
23138 supports single-precision arithmetic.
23139
23140 -m4-single
23141 Generate code for the SH4 assuming the floating-point unit is in
23142 single-precision mode by default.
23143
23144 -m4 Generate code for the SH4.
23145
23146 -m4-100
23147 Generate code for SH4-100.
23148
23149 -m4-100-nofpu
23150 Generate code for SH4-100 in such a way that the floating-point
23151 unit is not used.
23152
23153 -m4-100-single
23154 Generate code for SH4-100 assuming the floating-point unit is in
23155 single-precision mode by default.
23156
23157 -m4-100-single-only
23158 Generate code for SH4-100 in such a way that no double-precision
23159 floating-point operations are used.
23160
23161 -m4-200
23162 Generate code for SH4-200.
23163
23164 -m4-200-nofpu
23165 Generate code for SH4-200 without in such a way that the floating-
23166 point unit is not used.
23167
23168 -m4-200-single
23169 Generate code for SH4-200 assuming the floating-point unit is in
23170 single-precision mode by default.
23171
23172 -m4-200-single-only
23173 Generate code for SH4-200 in such a way that no double-precision
23174 floating-point operations are used.
23175
23176 -m4-300
23177 Generate code for SH4-300.
23178
23179 -m4-300-nofpu
23180 Generate code for SH4-300 without in such a way that the floating-
23181 point unit is not used.
23182
23183 -m4-300-single
23184 Generate code for SH4-300 in such a way that no double-precision
23185 floating-point operations are used.
23186
23187 -m4-300-single-only
23188 Generate code for SH4-300 in such a way that no double-precision
23189 floating-point operations are used.
23190
23191 -m4-340
23192 Generate code for SH4-340 (no MMU, no FPU).
23193
23194 -m4-500
23195 Generate code for SH4-500 (no FPU). Passes -isa=sh4-nofpu to the
23196 assembler.
23197
23198 -m4a-nofpu
23199 Generate code for the SH4al-dsp, or for a SH4a in such a way that
23200 the floating-point unit is not used.
23201
23202 -m4a-single-only
23203 Generate code for the SH4a, in such a way that no double-precision
23204 floating-point operations are used.
23205
23206 -m4a-single
23207 Generate code for the SH4a assuming the floating-point unit is in
23208 single-precision mode by default.
23209
23210 -m4a
23211 Generate code for the SH4a.
23212
23213 -m4al
23214 Same as -m4a-nofpu, except that it implicitly passes -dsp to the
23215 assembler. GCC doesn't generate any DSP instructions at the
23216 moment.
23217
23218 -mb Compile code for the processor in big-endian mode.
23219
23220 -ml Compile code for the processor in little-endian mode.
23221
23222 -mdalign
23223 Align doubles at 64-bit boundaries. Note that this changes the
23224 calling conventions, and thus some functions from the standard C
23225 library do not work unless you recompile it first with -mdalign.
23226
23227 -mrelax
23228 Shorten some address references at link time, when possible; uses
23229 the linker option -relax.
23230
23231 -mbigtable
23232 Use 32-bit offsets in "switch" tables. The default is to use
23233 16-bit offsets.
23234
23235 -mbitops
23236 Enable the use of bit manipulation instructions on SH2A.
23237
23238 -mfmovd
23239 Enable the use of the instruction "fmovd". Check -mdalign for
23240 alignment constraints.
23241
23242 -mrenesas
23243 Comply with the calling conventions defined by Renesas.
23244
23245 -mno-renesas
23246 Comply with the calling conventions defined for GCC before the
23247 Renesas conventions were available. This option is the default for
23248 all targets of the SH toolchain.
23249
23250 -mnomacsave
23251 Mark the "MAC" register as call-clobbered, even if -mrenesas is
23252 given.
23253
23254 -mieee
23255 -mno-ieee
23256 Control the IEEE compliance of floating-point comparisons, which
23257 affects the handling of cases where the result of a comparison is
23258 unordered. By default -mieee is implicitly enabled. If
23259 -ffinite-math-only is enabled -mno-ieee is implicitly set, which
23260 results in faster floating-point greater-equal and less-equal
23261 comparisons. The implicit settings can be overridden by specifying
23262 either -mieee or -mno-ieee.
23263
23264 -minline-ic_invalidate
23265 Inline code to invalidate instruction cache entries after setting
23266 up nested function trampolines. This option has no effect if
23267 -musermode is in effect and the selected code generation option
23268 (e.g. -m4) does not allow the use of the "icbi" instruction. If
23269 the selected code generation option does not allow the use of the
23270 "icbi" instruction, and -musermode is not in effect, the inlined
23271 code manipulates the instruction cache address array directly with
23272 an associative write. This not only requires privileged mode at
23273 run time, but it also fails if the cache line had been mapped via
23274 the TLB and has become unmapped.
23275
23276 -misize
23277 Dump instruction size and location in the assembly code.
23278
23279 -mpadstruct
23280 This option is deprecated. It pads structures to multiple of 4
23281 bytes, which is incompatible with the SH ABI.
23282
23283 -matomic-model=model
23284 Sets the model of atomic operations and additional parameters as a
23285 comma separated list. For details on the atomic built-in functions
23286 see __atomic Builtins. The following models and parameters are
23287 supported:
23288
23289 none
23290 Disable compiler generated atomic sequences and emit library
23291 calls for atomic operations. This is the default if the target
23292 is not "sh*-*-linux*".
23293
23294 soft-gusa
23295 Generate GNU/Linux compatible gUSA software atomic sequences
23296 for the atomic built-in functions. The generated atomic
23297 sequences require additional support from the
23298 interrupt/exception handling code of the system and are only
23299 suitable for SH3* and SH4* single-core systems. This option is
23300 enabled by default when the target is "sh*-*-linux*" and SH3*
23301 or SH4*. When the target is SH4A, this option also partially
23302 utilizes the hardware atomic instructions "movli.l" and
23303 "movco.l" to create more efficient code, unless strict is
23304 specified.
23305
23306 soft-tcb
23307 Generate software atomic sequences that use a variable in the
23308 thread control block. This is a variation of the gUSA
23309 sequences which can also be used on SH1* and SH2* targets. The
23310 generated atomic sequences require additional support from the
23311 interrupt/exception handling code of the system and are only
23312 suitable for single-core systems. When using this model, the
23313 gbr-offset= parameter has to be specified as well.
23314
23315 soft-imask
23316 Generate software atomic sequences that temporarily disable
23317 interrupts by setting "SR.IMASK = 1111". This model works only
23318 when the program runs in privileged mode and is only suitable
23319 for single-core systems. Additional support from the
23320 interrupt/exception handling code of the system is not
23321 required. This model is enabled by default when the target is
23322 "sh*-*-linux*" and SH1* or SH2*.
23323
23324 hard-llcs
23325 Generate hardware atomic sequences using the "movli.l" and
23326 "movco.l" instructions only. This is only available on SH4A
23327 and is suitable for multi-core systems. Since the hardware
23328 instructions support only 32 bit atomic variables access to 8
23329 or 16 bit variables is emulated with 32 bit accesses. Code
23330 compiled with this option is also compatible with other
23331 software atomic model interrupt/exception handling systems if
23332 executed on an SH4A system. Additional support from the
23333 interrupt/exception handling code of the system is not required
23334 for this model.
23335
23336 gbr-offset=
23337 This parameter specifies the offset in bytes of the variable in
23338 the thread control block structure that should be used by the
23339 generated atomic sequences when the soft-tcb model has been
23340 selected. For other models this parameter is ignored. The
23341 specified value must be an integer multiple of four and in the
23342 range 0-1020.
23343
23344 strict
23345 This parameter prevents mixed usage of multiple atomic models,
23346 even if they are compatible, and makes the compiler generate
23347 atomic sequences of the specified model only.
23348
23349 -mtas
23350 Generate the "tas.b" opcode for "__atomic_test_and_set". Notice
23351 that depending on the particular hardware and software
23352 configuration this can degrade overall performance due to the
23353 operand cache line flushes that are implied by the "tas.b"
23354 instruction. On multi-core SH4A processors the "tas.b" instruction
23355 must be used with caution since it can result in data corruption
23356 for certain cache configurations.
23357
23358 -mprefergot
23359 When generating position-independent code, emit function calls
23360 using the Global Offset Table instead of the Procedure Linkage
23361 Table.
23362
23363 -musermode
23364 -mno-usermode
23365 Don't allow (allow) the compiler generating privileged mode code.
23366 Specifying -musermode also implies -mno-inline-ic_invalidate if the
23367 inlined code would not work in user mode. -musermode is the
23368 default when the target is "sh*-*-linux*". If the target is SH1*
23369 or SH2* -musermode has no effect, since there is no user mode.
23370
23371 -multcost=number
23372 Set the cost to assume for a multiply insn.
23373
23374 -mdiv=strategy
23375 Set the division strategy to be used for integer division
23376 operations. strategy can be one of:
23377
23378 call-div1
23379 Calls a library function that uses the single-step division
23380 instruction "div1" to perform the operation. Division by zero
23381 calculates an unspecified result and does not trap. This is
23382 the default except for SH4, SH2A and SHcompact.
23383
23384 call-fp
23385 Calls a library function that performs the operation in double
23386 precision floating point. Division by zero causes a floating-
23387 point exception. This is the default for SHcompact with FPU.
23388 Specifying this for targets that do not have a double precision
23389 FPU defaults to "call-div1".
23390
23391 call-table
23392 Calls a library function that uses a lookup table for small
23393 divisors and the "div1" instruction with case distinction for
23394 larger divisors. Division by zero calculates an unspecified
23395 result and does not trap. This is the default for SH4.
23396 Specifying this for targets that do not have dynamic shift
23397 instructions defaults to "call-div1".
23398
23399 When a division strategy has not been specified the default
23400 strategy is selected based on the current target. For SH2A the
23401 default strategy is to use the "divs" and "divu" instructions
23402 instead of library function calls.
23403
23404 -maccumulate-outgoing-args
23405 Reserve space once for outgoing arguments in the function prologue
23406 rather than around each call. Generally beneficial for performance
23407 and size. Also needed for unwinding to avoid changing the stack
23408 frame around conditional code.
23409
23410 -mdivsi3_libfunc=name
23411 Set the name of the library function used for 32-bit signed
23412 division to name. This only affects the name used in the call
23413 division strategies, and the compiler still expects the same sets
23414 of input/output/clobbered registers as if this option were not
23415 present.
23416
23417 -mfixed-range=register-range
23418 Generate code treating the given register range as fixed registers.
23419 A fixed register is one that the register allocator cannot use.
23420 This is useful when compiling kernel code. A register range is
23421 specified as two registers separated by a dash. Multiple register
23422 ranges can be specified separated by a comma.
23423
23424 -mbranch-cost=num
23425 Assume num to be the cost for a branch instruction. Higher numbers
23426 make the compiler try to generate more branch-free code if
23427 possible. If not specified the value is selected depending on the
23428 processor type that is being compiled for.
23429
23430 -mzdcbranch
23431 -mno-zdcbranch
23432 Assume (do not assume) that zero displacement conditional branch
23433 instructions "bt" and "bf" are fast. If -mzdcbranch is specified,
23434 the compiler prefers zero displacement branch code sequences. This
23435 is enabled by default when generating code for SH4 and SH4A. It
23436 can be explicitly disabled by specifying -mno-zdcbranch.
23437
23438 -mcbranch-force-delay-slot
23439 Force the usage of delay slots for conditional branches, which
23440 stuffs the delay slot with a "nop" if a suitable instruction cannot
23441 be found. By default this option is disabled. It can be enabled
23442 to work around hardware bugs as found in the original SH7055.
23443
23444 -mfused-madd
23445 -mno-fused-madd
23446 Generate code that uses (does not use) the floating-point multiply
23447 and accumulate instructions. These instructions are generated by
23448 default if hardware floating point is used. The machine-dependent
23449 -mfused-madd option is now mapped to the machine-independent
23450 -ffp-contract=fast option, and -mno-fused-madd is mapped to
23451 -ffp-contract=off.
23452
23453 -mfsca
23454 -mno-fsca
23455 Allow or disallow the compiler to emit the "fsca" instruction for
23456 sine and cosine approximations. The option -mfsca must be used in
23457 combination with -funsafe-math-optimizations. It is enabled by
23458 default when generating code for SH4A. Using -mno-fsca disables
23459 sine and cosine approximations even if -funsafe-math-optimizations
23460 is in effect.
23461
23462 -mfsrra
23463 -mno-fsrra
23464 Allow or disallow the compiler to emit the "fsrra" instruction for
23465 reciprocal square root approximations. The option -mfsrra must be
23466 used in combination with -funsafe-math-optimizations and
23467 -ffinite-math-only. It is enabled by default when generating code
23468 for SH4A. Using -mno-fsrra disables reciprocal square root
23469 approximations even if -funsafe-math-optimizations and
23470 -ffinite-math-only are in effect.
23471
23472 -mpretend-cmove
23473 Prefer zero-displacement conditional branches for conditional move
23474 instruction patterns. This can result in faster code on the SH4
23475 processor.
23476
23477 -mfdpic
23478 Generate code using the FDPIC ABI.
23479
23480 Solaris 2 Options
23481 These -m options are supported on Solaris 2:
23482
23483 -mclear-hwcap
23484 -mclear-hwcap tells the compiler to remove the hardware
23485 capabilities generated by the Solaris assembler. This is only
23486 necessary when object files use ISA extensions not supported by the
23487 current machine, but check at runtime whether or not to use them.
23488
23489 -mimpure-text
23490 -mimpure-text, used in addition to -shared, tells the compiler to
23491 not pass -z text to the linker when linking a shared object. Using
23492 this option, you can link position-dependent code into a shared
23493 object.
23494
23495 -mimpure-text suppresses the "relocations remain against
23496 allocatable but non-writable sections" linker error message.
23497 However, the necessary relocations trigger copy-on-write, and the
23498 shared object is not actually shared across processes. Instead of
23499 using -mimpure-text, you should compile all source code with -fpic
23500 or -fPIC.
23501
23502 These switches are supported in addition to the above on Solaris 2:
23503
23504 -pthreads
23505 This is a synonym for -pthread.
23506
23507 SPARC Options
23508 These -m options are supported on the SPARC:
23509
23510 -mno-app-regs
23511 -mapp-regs
23512 Specify -mapp-regs to generate output using the global registers 2
23513 through 4, which the SPARC SVR4 ABI reserves for applications.
23514 Like the global register 1, each global register 2 through 4 is
23515 then treated as an allocable register that is clobbered by function
23516 calls. This is the default.
23517
23518 To be fully SVR4 ABI-compliant at the cost of some performance
23519 loss, specify -mno-app-regs. You should compile libraries and
23520 system software with this option.
23521
23522 -mflat
23523 -mno-flat
23524 With -mflat, the compiler does not generate save/restore
23525 instructions and uses a "flat" or single register window model.
23526 This model is compatible with the regular register window model.
23527 The local registers and the input registers (0--5) are still
23528 treated as "call-saved" registers and are saved on the stack as
23529 needed.
23530
23531 With -mno-flat (the default), the compiler generates save/restore
23532 instructions (except for leaf functions). This is the normal
23533 operating mode.
23534
23535 -mfpu
23536 -mhard-float
23537 Generate output containing floating-point instructions. This is
23538 the default.
23539
23540 -mno-fpu
23541 -msoft-float
23542 Generate output containing library calls for floating point.
23543 Warning: the requisite libraries are not available for all SPARC
23544 targets. Normally the facilities of the machine's usual C compiler
23545 are used, but this cannot be done directly in cross-compilation.
23546 You must make your own arrangements to provide suitable library
23547 functions for cross-compilation. The embedded targets sparc-*-aout
23548 and sparclite-*-* do provide software floating-point support.
23549
23550 -msoft-float changes the calling convention in the output file;
23551 therefore, it is only useful if you compile all of a program with
23552 this option. In particular, you need to compile libgcc.a, the
23553 library that comes with GCC, with -msoft-float in order for this to
23554 work.
23555
23556 -mhard-quad-float
23557 Generate output containing quad-word (long double) floating-point
23558 instructions.
23559
23560 -msoft-quad-float
23561 Generate output containing library calls for quad-word (long
23562 double) floating-point instructions. The functions called are
23563 those specified in the SPARC ABI. This is the default.
23564
23565 As of this writing, there are no SPARC implementations that have
23566 hardware support for the quad-word floating-point instructions.
23567 They all invoke a trap handler for one of these instructions, and
23568 then the trap handler emulates the effect of the instruction.
23569 Because of the trap handler overhead, this is much slower than
23570 calling the ABI library routines. Thus the -msoft-quad-float
23571 option is the default.
23572
23573 -mno-unaligned-doubles
23574 -munaligned-doubles
23575 Assume that doubles have 8-byte alignment. This is the default.
23576
23577 With -munaligned-doubles, GCC assumes that doubles have 8-byte
23578 alignment only if they are contained in another type, or if they
23579 have an absolute address. Otherwise, it assumes they have 4-byte
23580 alignment. Specifying this option avoids some rare compatibility
23581 problems with code generated by other compilers. It is not the
23582 default because it results in a performance loss, especially for
23583 floating-point code.
23584
23585 -muser-mode
23586 -mno-user-mode
23587 Do not generate code that can only run in supervisor mode. This is
23588 relevant only for the "casa" instruction emitted for the LEON3
23589 processor. This is the default.
23590
23591 -mfaster-structs
23592 -mno-faster-structs
23593 With -mfaster-structs, the compiler assumes that structures should
23594 have 8-byte alignment. This enables the use of pairs of "ldd" and
23595 "std" instructions for copies in structure assignment, in place of
23596 twice as many "ld" and "st" pairs. However, the use of this
23597 changed alignment directly violates the SPARC ABI. Thus, it's
23598 intended only for use on targets where the developer acknowledges
23599 that their resulting code is not directly in line with the rules of
23600 the ABI.
23601
23602 -mstd-struct-return
23603 -mno-std-struct-return
23604 With -mstd-struct-return, the compiler generates checking code in
23605 functions returning structures or unions to detect size mismatches
23606 between the two sides of function calls, as per the 32-bit ABI.
23607
23608 The default is -mno-std-struct-return. This option has no effect
23609 in 64-bit mode.
23610
23611 -mlra
23612 -mno-lra
23613 Enable Local Register Allocation. This is the default for SPARC
23614 since GCC 7 so -mno-lra needs to be passed to get old Reload.
23615
23616 -mcpu=cpu_type
23617 Set the instruction set, register set, and instruction scheduling
23618 parameters for machine type cpu_type. Supported values for
23619 cpu_type are v7, cypress, v8, supersparc, hypersparc, leon, leon3,
23620 leon3v7, sparclite, f930, f934, sparclite86x, sparclet, tsc701, v9,
23621 ultrasparc, ultrasparc3, niagara, niagara2, niagara3, niagara4,
23622 niagara7 and m8.
23623
23624 Native Solaris and GNU/Linux toolchains also support the value
23625 native, which selects the best architecture option for the host
23626 processor. -mcpu=native has no effect if GCC does not recognize
23627 the processor.
23628
23629 Default instruction scheduling parameters are used for values that
23630 select an architecture and not an implementation. These are v7,
23631 v8, sparclite, sparclet, v9.
23632
23633 Here is a list of each supported architecture and their supported
23634 implementations.
23635
23636 v7 cypress, leon3v7
23637
23638 v8 supersparc, hypersparc, leon, leon3
23639
23640 sparclite
23641 f930, f934, sparclite86x
23642
23643 sparclet
23644 tsc701
23645
23646 v9 ultrasparc, ultrasparc3, niagara, niagara2, niagara3, niagara4,
23647 niagara7, m8
23648
23649 By default (unless configured otherwise), GCC generates code for
23650 the V7 variant of the SPARC architecture. With -mcpu=cypress, the
23651 compiler additionally optimizes it for the Cypress CY7C602 chip, as
23652 used in the SPARCStation/SPARCServer 3xx series. This is also
23653 appropriate for the older SPARCStation 1, 2, IPX etc.
23654
23655 With -mcpu=v8, GCC generates code for the V8 variant of the SPARC
23656 architecture. The only difference from V7 code is that the
23657 compiler emits the integer multiply and integer divide instructions
23658 which exist in SPARC-V8 but not in SPARC-V7. With
23659 -mcpu=supersparc, the compiler additionally optimizes it for the
23660 SuperSPARC chip, as used in the SPARCStation 10, 1000 and 2000
23661 series.
23662
23663 With -mcpu=sparclite, GCC generates code for the SPARClite variant
23664 of the SPARC architecture. This adds the integer multiply, integer
23665 divide step and scan ("ffs") instructions which exist in SPARClite
23666 but not in SPARC-V7. With -mcpu=f930, the compiler additionally
23667 optimizes it for the Fujitsu MB86930 chip, which is the original
23668 SPARClite, with no FPU. With -mcpu=f934, the compiler additionally
23669 optimizes it for the Fujitsu MB86934 chip, which is the more recent
23670 SPARClite with FPU.
23671
23672 With -mcpu=sparclet, GCC generates code for the SPARClet variant of
23673 the SPARC architecture. This adds the integer multiply,
23674 multiply/accumulate, integer divide step and scan ("ffs")
23675 instructions which exist in SPARClet but not in SPARC-V7. With
23676 -mcpu=tsc701, the compiler additionally optimizes it for the TEMIC
23677 SPARClet chip.
23678
23679 With -mcpu=v9, GCC generates code for the V9 variant of the SPARC
23680 architecture. This adds 64-bit integer and floating-point move
23681 instructions, 3 additional floating-point condition code registers
23682 and conditional move instructions. With -mcpu=ultrasparc, the
23683 compiler additionally optimizes it for the Sun UltraSPARC I/II/IIi
23684 chips. With -mcpu=ultrasparc3, the compiler additionally optimizes
23685 it for the Sun UltraSPARC III/III+/IIIi/IIIi+/IV/IV+ chips. With
23686 -mcpu=niagara, the compiler additionally optimizes it for Sun
23687 UltraSPARC T1 chips. With -mcpu=niagara2, the compiler
23688 additionally optimizes it for Sun UltraSPARC T2 chips. With
23689 -mcpu=niagara3, the compiler additionally optimizes it for Sun
23690 UltraSPARC T3 chips. With -mcpu=niagara4, the compiler
23691 additionally optimizes it for Sun UltraSPARC T4 chips. With
23692 -mcpu=niagara7, the compiler additionally optimizes it for Oracle
23693 SPARC M7 chips. With -mcpu=m8, the compiler additionally optimizes
23694 it for Oracle M8 chips.
23695
23696 -mtune=cpu_type
23697 Set the instruction scheduling parameters for machine type
23698 cpu_type, but do not set the instruction set or register set that
23699 the option -mcpu=cpu_type does.
23700
23701 The same values for -mcpu=cpu_type can be used for -mtune=cpu_type,
23702 but the only useful values are those that select a particular CPU
23703 implementation. Those are cypress, supersparc, hypersparc, leon,
23704 leon3, leon3v7, f930, f934, sparclite86x, tsc701, ultrasparc,
23705 ultrasparc3, niagara, niagara2, niagara3, niagara4, niagara7 and
23706 m8. With native Solaris and GNU/Linux toolchains, native can also
23707 be used.
23708
23709 -mv8plus
23710 -mno-v8plus
23711 With -mv8plus, GCC generates code for the SPARC-V8+ ABI. The
23712 difference from the V8 ABI is that the global and out registers are
23713 considered 64 bits wide. This is enabled by default on Solaris in
23714 32-bit mode for all SPARC-V9 processors.
23715
23716 -mvis
23717 -mno-vis
23718 With -mvis, GCC generates code that takes advantage of the
23719 UltraSPARC Visual Instruction Set extensions. The default is
23720 -mno-vis.
23721
23722 -mvis2
23723 -mno-vis2
23724 With -mvis2, GCC generates code that takes advantage of version 2.0
23725 of the UltraSPARC Visual Instruction Set extensions. The default
23726 is -mvis2 when targeting a cpu that supports such instructions,
23727 such as UltraSPARC-III and later. Setting -mvis2 also sets -mvis.
23728
23729 -mvis3
23730 -mno-vis3
23731 With -mvis3, GCC generates code that takes advantage of version 3.0
23732 of the UltraSPARC Visual Instruction Set extensions. The default
23733 is -mvis3 when targeting a cpu that supports such instructions,
23734 such as niagara-3 and later. Setting -mvis3 also sets -mvis2 and
23735 -mvis.
23736
23737 -mvis4
23738 -mno-vis4
23739 With -mvis4, GCC generates code that takes advantage of version 4.0
23740 of the UltraSPARC Visual Instruction Set extensions. The default
23741 is -mvis4 when targeting a cpu that supports such instructions,
23742 such as niagara-7 and later. Setting -mvis4 also sets -mvis3,
23743 -mvis2 and -mvis.
23744
23745 -mvis4b
23746 -mno-vis4b
23747 With -mvis4b, GCC generates code that takes advantage of version
23748 4.0 of the UltraSPARC Visual Instruction Set extensions, plus the
23749 additional VIS instructions introduced in the Oracle SPARC
23750 Architecture 2017. The default is -mvis4b when targeting a cpu
23751 that supports such instructions, such as m8 and later. Setting
23752 -mvis4b also sets -mvis4, -mvis3, -mvis2 and -mvis.
23753
23754 -mcbcond
23755 -mno-cbcond
23756 With -mcbcond, GCC generates code that takes advantage of the
23757 UltraSPARC Compare-and-Branch-on-Condition instructions. The
23758 default is -mcbcond when targeting a CPU that supports such
23759 instructions, such as Niagara-4 and later.
23760
23761 -mfmaf
23762 -mno-fmaf
23763 With -mfmaf, GCC generates code that takes advantage of the
23764 UltraSPARC Fused Multiply-Add Floating-point instructions. The
23765 default is -mfmaf when targeting a CPU that supports such
23766 instructions, such as Niagara-3 and later.
23767
23768 -mfsmuld
23769 -mno-fsmuld
23770 With -mfsmuld, GCC generates code that takes advantage of the
23771 Floating-point Multiply Single to Double (FsMULd) instruction. The
23772 default is -mfsmuld when targeting a CPU supporting the
23773 architecture versions V8 or V9 with FPU except -mcpu=leon.
23774
23775 -mpopc
23776 -mno-popc
23777 With -mpopc, GCC generates code that takes advantage of the
23778 UltraSPARC Population Count instruction. The default is -mpopc
23779 when targeting a CPU that supports such an instruction, such as
23780 Niagara-2 and later.
23781
23782 -msubxc
23783 -mno-subxc
23784 With -msubxc, GCC generates code that takes advantage of the
23785 UltraSPARC Subtract-Extended-with-Carry instruction. The default
23786 is -msubxc when targeting a CPU that supports such an instruction,
23787 such as Niagara-7 and later.
23788
23789 -mfix-at697f
23790 Enable the documented workaround for the single erratum of the
23791 Atmel AT697F processor (which corresponds to erratum #13 of the
23792 AT697E processor).
23793
23794 -mfix-ut699
23795 Enable the documented workarounds for the floating-point errata and
23796 the data cache nullify errata of the UT699 processor.
23797
23798 -mfix-ut700
23799 Enable the documented workaround for the back-to-back store errata
23800 of the UT699E/UT700 processor.
23801
23802 -mfix-gr712rc
23803 Enable the documented workaround for the back-to-back store errata
23804 of the GR712RC processor.
23805
23806 These -m options are supported in addition to the above on SPARC-V9
23807 processors in 64-bit environments:
23808
23809 -m32
23810 -m64
23811 Generate code for a 32-bit or 64-bit environment. The 32-bit
23812 environment sets int, long and pointer to 32 bits. The 64-bit
23813 environment sets int to 32 bits and long and pointer to 64 bits.
23814
23815 -mcmodel=which
23816 Set the code model to one of
23817
23818 medlow
23819 The Medium/Low code model: 64-bit addresses, programs must be
23820 linked in the low 32 bits of memory. Programs can be
23821 statically or dynamically linked.
23822
23823 medmid
23824 The Medium/Middle code model: 64-bit addresses, programs must
23825 be linked in the low 44 bits of memory, the text and data
23826 segments must be less than 2GB in size and the data segment
23827 must be located within 2GB of the text segment.
23828
23829 medany
23830 The Medium/Anywhere code model: 64-bit addresses, programs may
23831 be linked anywhere in memory, the text and data segments must
23832 be less than 2GB in size and the data segment must be located
23833 within 2GB of the text segment.
23834
23835 embmedany
23836 The Medium/Anywhere code model for embedded systems: 64-bit
23837 addresses, the text and data segments must be less than 2GB in
23838 size, both starting anywhere in memory (determined at link
23839 time). The global register %g4 points to the base of the data
23840 segment. Programs are statically linked and PIC is not
23841 supported.
23842
23843 -mmemory-model=mem-model
23844 Set the memory model in force on the processor to one of
23845
23846 default
23847 The default memory model for the processor and operating
23848 system.
23849
23850 rmo Relaxed Memory Order
23851
23852 pso Partial Store Order
23853
23854 tso Total Store Order
23855
23856 sc Sequential Consistency
23857
23858 These memory models are formally defined in Appendix D of the
23859 SPARC-V9 architecture manual, as set in the processor's "PSTATE.MM"
23860 field.
23861
23862 -mstack-bias
23863 -mno-stack-bias
23864 With -mstack-bias, GCC assumes that the stack pointer, and frame
23865 pointer if present, are offset by -2047 which must be added back
23866 when making stack frame references. This is the default in 64-bit
23867 mode. Otherwise, assume no such offset is present.
23868
23869 Options for System V
23870 These additional options are available on System V Release 4 for
23871 compatibility with other compilers on those systems:
23872
23873 -G Create a shared object. It is recommended that -symbolic or
23874 -shared be used instead.
23875
23876 -Qy Identify the versions of each tool used by the compiler, in a
23877 ".ident" assembler directive in the output.
23878
23879 -Qn Refrain from adding ".ident" directives to the output file (this is
23880 the default).
23881
23882 -YP,dirs
23883 Search the directories dirs, and no others, for libraries specified
23884 with -l.
23885
23886 -Ym,dir
23887 Look in the directory dir to find the M4 preprocessor. The
23888 assembler uses this option.
23889
23890 TILE-Gx Options
23891 These -m options are supported on the TILE-Gx:
23892
23893 -mcmodel=small
23894 Generate code for the small model. The distance for direct calls
23895 is limited to 500M in either direction. PC-relative addresses are
23896 32 bits. Absolute addresses support the full address range.
23897
23898 -mcmodel=large
23899 Generate code for the large model. There is no limitation on call
23900 distance, pc-relative addresses, or absolute addresses.
23901
23902 -mcpu=name
23903 Selects the type of CPU to be targeted. Currently the only
23904 supported type is tilegx.
23905
23906 -m32
23907 -m64
23908 Generate code for a 32-bit or 64-bit environment. The 32-bit
23909 environment sets int, long, and pointer to 32 bits. The 64-bit
23910 environment sets int to 32 bits and long and pointer to 64 bits.
23911
23912 -mbig-endian
23913 -mlittle-endian
23914 Generate code in big/little endian mode, respectively.
23915
23916 TILEPro Options
23917 These -m options are supported on the TILEPro:
23918
23919 -mcpu=name
23920 Selects the type of CPU to be targeted. Currently the only
23921 supported type is tilepro.
23922
23923 -m32
23924 Generate code for a 32-bit environment, which sets int, long, and
23925 pointer to 32 bits. This is the only supported behavior so the
23926 flag is essentially ignored.
23927
23928 V850 Options
23929 These -m options are defined for V850 implementations:
23930
23931 -mlong-calls
23932 -mno-long-calls
23933 Treat all calls as being far away (near). If calls are assumed to
23934 be far away, the compiler always loads the function's address into
23935 a register, and calls indirect through the pointer.
23936
23937 -mno-ep
23938 -mep
23939 Do not optimize (do optimize) basic blocks that use the same index
23940 pointer 4 or more times to copy pointer into the "ep" register, and
23941 use the shorter "sld" and "sst" instructions. The -mep option is
23942 on by default if you optimize.
23943
23944 -mno-prolog-function
23945 -mprolog-function
23946 Do not use (do use) external functions to save and restore
23947 registers at the prologue and epilogue of a function. The external
23948 functions are slower, but use less code space if more than one
23949 function saves the same number of registers. The -mprolog-function
23950 option is on by default if you optimize.
23951
23952 -mspace
23953 Try to make the code as small as possible. At present, this just
23954 turns on the -mep and -mprolog-function options.
23955
23956 -mtda=n
23957 Put static or global variables whose size is n bytes or less into
23958 the tiny data area that register "ep" points to. The tiny data
23959 area can hold up to 256 bytes in total (128 bytes for byte
23960 references).
23961
23962 -msda=n
23963 Put static or global variables whose size is n bytes or less into
23964 the small data area that register "gp" points to. The small data
23965 area can hold up to 64 kilobytes.
23966
23967 -mzda=n
23968 Put static or global variables whose size is n bytes or less into
23969 the first 32 kilobytes of memory.
23970
23971 -mv850
23972 Specify that the target processor is the V850.
23973
23974 -mv850e3v5
23975 Specify that the target processor is the V850E3V5. The
23976 preprocessor constant "__v850e3v5__" is defined if this option is
23977 used.
23978
23979 -mv850e2v4
23980 Specify that the target processor is the V850E3V5. This is an
23981 alias for the -mv850e3v5 option.
23982
23983 -mv850e2v3
23984 Specify that the target processor is the V850E2V3. The
23985 preprocessor constant "__v850e2v3__" is defined if this option is
23986 used.
23987
23988 -mv850e2
23989 Specify that the target processor is the V850E2. The preprocessor
23990 constant "__v850e2__" is defined if this option is used.
23991
23992 -mv850e1
23993 Specify that the target processor is the V850E1. The preprocessor
23994 constants "__v850e1__" and "__v850e__" are defined if this option
23995 is used.
23996
23997 -mv850es
23998 Specify that the target processor is the V850ES. This is an alias
23999 for the -mv850e1 option.
24000
24001 -mv850e
24002 Specify that the target processor is the V850E. The preprocessor
24003 constant "__v850e__" is defined if this option is used.
24004
24005 If neither -mv850 nor -mv850e nor -mv850e1 nor -mv850e2 nor
24006 -mv850e2v3 nor -mv850e3v5 are defined then a default target
24007 processor is chosen and the relevant __v850*__ preprocessor
24008 constant is defined.
24009
24010 The preprocessor constants "__v850" and "__v851__" are always
24011 defined, regardless of which processor variant is the target.
24012
24013 -mdisable-callt
24014 -mno-disable-callt
24015 This option suppresses generation of the "CALLT" instruction for
24016 the v850e, v850e1, v850e2, v850e2v3 and v850e3v5 flavors of the
24017 v850 architecture.
24018
24019 This option is enabled by default when the RH850 ABI is in use (see
24020 -mrh850-abi), and disabled by default when the GCC ABI is in use.
24021 If "CALLT" instructions are being generated then the C preprocessor
24022 symbol "__V850_CALLT__" is defined.
24023
24024 -mrelax
24025 -mno-relax
24026 Pass on (or do not pass on) the -mrelax command-line option to the
24027 assembler.
24028
24029 -mlong-jumps
24030 -mno-long-jumps
24031 Disable (or re-enable) the generation of PC-relative jump
24032 instructions.
24033
24034 -msoft-float
24035 -mhard-float
24036 Disable (or re-enable) the generation of hardware floating point
24037 instructions. This option is only significant when the target
24038 architecture is V850E2V3 or higher. If hardware floating point
24039 instructions are being generated then the C preprocessor symbol
24040 "__FPU_OK__" is defined, otherwise the symbol "__NO_FPU__" is
24041 defined.
24042
24043 -mloop
24044 Enables the use of the e3v5 LOOP instruction. The use of this
24045 instruction is not enabled by default when the e3v5 architecture is
24046 selected because its use is still experimental.
24047
24048 -mrh850-abi
24049 -mghs
24050 Enables support for the RH850 version of the V850 ABI. This is the
24051 default. With this version of the ABI the following rules apply:
24052
24053 * Integer sized structures and unions are returned via a memory
24054 pointer rather than a register.
24055
24056 * Large structures and unions (more than 8 bytes in size) are
24057 passed by value.
24058
24059 * Functions are aligned to 16-bit boundaries.
24060
24061 * The -m8byte-align command-line option is supported.
24062
24063 * The -mdisable-callt command-line option is enabled by default.
24064 The -mno-disable-callt command-line option is not supported.
24065
24066 When this version of the ABI is enabled the C preprocessor symbol
24067 "__V850_RH850_ABI__" is defined.
24068
24069 -mgcc-abi
24070 Enables support for the old GCC version of the V850 ABI. With this
24071 version of the ABI the following rules apply:
24072
24073 * Integer sized structures and unions are returned in register
24074 "r10".
24075
24076 * Large structures and unions (more than 8 bytes in size) are
24077 passed by reference.
24078
24079 * Functions are aligned to 32-bit boundaries, unless optimizing
24080 for size.
24081
24082 * The -m8byte-align command-line option is not supported.
24083
24084 * The -mdisable-callt command-line option is supported but not
24085 enabled by default.
24086
24087 When this version of the ABI is enabled the C preprocessor symbol
24088 "__V850_GCC_ABI__" is defined.
24089
24090 -m8byte-align
24091 -mno-8byte-align
24092 Enables support for "double" and "long long" types to be aligned on
24093 8-byte boundaries. The default is to restrict the alignment of all
24094 objects to at most 4-bytes. When -m8byte-align is in effect the C
24095 preprocessor symbol "__V850_8BYTE_ALIGN__" is defined.
24096
24097 -mbig-switch
24098 Generate code suitable for big switch tables. Use this option only
24099 if the assembler/linker complain about out of range branches within
24100 a switch table.
24101
24102 -mapp-regs
24103 This option causes r2 and r5 to be used in the code generated by
24104 the compiler. This setting is the default.
24105
24106 -mno-app-regs
24107 This option causes r2 and r5 to be treated as fixed registers.
24108
24109 VAX Options
24110 These -m options are defined for the VAX:
24111
24112 -munix
24113 Do not output certain jump instructions ("aobleq" and so on) that
24114 the Unix assembler for the VAX cannot handle across long ranges.
24115
24116 -mgnu
24117 Do output those jump instructions, on the assumption that the GNU
24118 assembler is being used.
24119
24120 -mg Output code for G-format floating-point numbers instead of
24121 D-format.
24122
24123 Visium Options
24124 -mdebug
24125 A program which performs file I/O and is destined to run on an MCM
24126 target should be linked with this option. It causes the libraries
24127 libc.a and libdebug.a to be linked. The program should be run on
24128 the target under the control of the GDB remote debugging stub.
24129
24130 -msim
24131 A program which performs file I/O and is destined to run on the
24132 simulator should be linked with option. This causes libraries
24133 libc.a and libsim.a to be linked.
24134
24135 -mfpu
24136 -mhard-float
24137 Generate code containing floating-point instructions. This is the
24138 default.
24139
24140 -mno-fpu
24141 -msoft-float
24142 Generate code containing library calls for floating-point.
24143
24144 -msoft-float changes the calling convention in the output file;
24145 therefore, it is only useful if you compile all of a program with
24146 this option. In particular, you need to compile libgcc.a, the
24147 library that comes with GCC, with -msoft-float in order for this to
24148 work.
24149
24150 -mcpu=cpu_type
24151 Set the instruction set, register set, and instruction scheduling
24152 parameters for machine type cpu_type. Supported values for
24153 cpu_type are mcm, gr5 and gr6.
24154
24155 mcm is a synonym of gr5 present for backward compatibility.
24156
24157 By default (unless configured otherwise), GCC generates code for
24158 the GR5 variant of the Visium architecture.
24159
24160 With -mcpu=gr6, GCC generates code for the GR6 variant of the
24161 Visium architecture. The only difference from GR5 code is that the
24162 compiler will generate block move instructions.
24163
24164 -mtune=cpu_type
24165 Set the instruction scheduling parameters for machine type
24166 cpu_type, but do not set the instruction set or register set that
24167 the option -mcpu=cpu_type would.
24168
24169 -msv-mode
24170 Generate code for the supervisor mode, where there are no
24171 restrictions on the access to general registers. This is the
24172 default.
24173
24174 -muser-mode
24175 Generate code for the user mode, where the access to some general
24176 registers is forbidden: on the GR5, registers r24 to r31 cannot be
24177 accessed in this mode; on the GR6, only registers r29 to r31 are
24178 affected.
24179
24180 VMS Options
24181 These -m options are defined for the VMS implementations:
24182
24183 -mvms-return-codes
24184 Return VMS condition codes from "main". The default is to return
24185 POSIX-style condition (e.g. error) codes.
24186
24187 -mdebug-main=prefix
24188 Flag the first routine whose name starts with prefix as the main
24189 routine for the debugger.
24190
24191 -mmalloc64
24192 Default to 64-bit memory allocation routines.
24193
24194 -mpointer-size=size
24195 Set the default size of pointers. Possible options for size are 32
24196 or short for 32 bit pointers, 64 or long for 64 bit pointers, and
24197 no for supporting only 32 bit pointers. The later option disables
24198 "pragma pointer_size".
24199
24200 VxWorks Options
24201 The options in this section are defined for all VxWorks targets.
24202 Options specific to the target hardware are listed with the other
24203 options for that target.
24204
24205 -mrtp
24206 GCC can generate code for both VxWorks kernels and real time
24207 processes (RTPs). This option switches from the former to the
24208 latter. It also defines the preprocessor macro "__RTP__".
24209
24210 -non-static
24211 Link an RTP executable against shared libraries rather than static
24212 libraries. The options -static and -shared can also be used for
24213 RTPs; -static is the default.
24214
24215 -Bstatic
24216 -Bdynamic
24217 These options are passed down to the linker. They are defined for
24218 compatibility with Diab.
24219
24220 -Xbind-lazy
24221 Enable lazy binding of function calls. This option is equivalent
24222 to -Wl,-z,now and is defined for compatibility with Diab.
24223
24224 -Xbind-now
24225 Disable lazy binding of function calls. This option is the default
24226 and is defined for compatibility with Diab.
24227
24228 x86 Options
24229 These -m options are defined for the x86 family of computers.
24230
24231 -march=cpu-type
24232 Generate instructions for the machine type cpu-type. In contrast
24233 to -mtune=cpu-type, which merely tunes the generated code for the
24234 specified cpu-type, -march=cpu-type allows GCC to generate code
24235 that may not run at all on processors other than the one indicated.
24236 Specifying -march=cpu-type implies -mtune=cpu-type.
24237
24238 The choices for cpu-type are:
24239
24240 native
24241 This selects the CPU to generate code for at compilation time
24242 by determining the processor type of the compiling machine.
24243 Using -march=native enables all instruction subsets supported
24244 by the local machine (hence the result might not run on
24245 different machines). Using -mtune=native produces code
24246 optimized for the local machine under the constraints of the
24247 selected instruction set.
24248
24249 x86-64
24250 A generic CPU with 64-bit extensions.
24251
24252 i386
24253 Original Intel i386 CPU.
24254
24255 i486
24256 Intel i486 CPU. (No scheduling is implemented for this chip.)
24257
24258 i586
24259 pentium
24260 Intel Pentium CPU with no MMX support.
24261
24262 lakemont
24263 Intel Lakemont MCU, based on Intel Pentium CPU.
24264
24265 pentium-mmx
24266 Intel Pentium MMX CPU, based on Pentium core with MMX
24267 instruction set support.
24268
24269 pentiumpro
24270 Intel Pentium Pro CPU.
24271
24272 i686
24273 When used with -march, the Pentium Pro instruction set is used,
24274 so the code runs on all i686 family chips. When used with
24275 -mtune, it has the same meaning as generic.
24276
24277 pentium2
24278 Intel Pentium II CPU, based on Pentium Pro core with MMX
24279 instruction set support.
24280
24281 pentium3
24282 pentium3m
24283 Intel Pentium III CPU, based on Pentium Pro core with MMX and
24284 SSE instruction set support.
24285
24286 pentium-m
24287 Intel Pentium M; low-power version of Intel Pentium III CPU
24288 with MMX, SSE and SSE2 instruction set support. Used by
24289 Centrino notebooks.
24290
24291 pentium4
24292 pentium4m
24293 Intel Pentium 4 CPU with MMX, SSE and SSE2 instruction set
24294 support.
24295
24296 prescott
24297 Improved version of Intel Pentium 4 CPU with MMX, SSE, SSE2 and
24298 SSE3 instruction set support.
24299
24300 nocona
24301 Improved version of Intel Pentium 4 CPU with 64-bit extensions,
24302 MMX, SSE, SSE2 and SSE3 instruction set support.
24303
24304 core2
24305 Intel Core 2 CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3
24306 and SSSE3 instruction set support.
24307
24308 nehalem
24309 Intel Nehalem CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3,
24310 SSSE3, SSE4.1, SSE4.2 and POPCNT instruction set support.
24311
24312 westmere
24313 Intel Westmere CPU with 64-bit extensions, MMX, SSE, SSE2,
24314 SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, AES and PCLMUL instruction
24315 set support.
24316
24317 sandybridge
24318 Intel Sandy Bridge CPU with 64-bit extensions, MMX, SSE, SSE2,
24319 SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, AVX, AES and PCLMUL
24320 instruction set support.
24321
24322 ivybridge
24323 Intel Ivy Bridge CPU with 64-bit extensions, MMX, SSE, SSE2,
24324 SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, AVX, AES, PCLMUL,
24325 FSGSBASE, RDRND and F16C instruction set support.
24326
24327 haswell
24328 Intel Haswell CPU with 64-bit extensions, MOVBE, MMX, SSE,
24329 SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES,
24330 PCLMUL, FSGSBASE, RDRND, FMA, BMI, BMI2 and F16C instruction
24331 set support.
24332
24333 broadwell
24334 Intel Broadwell CPU with 64-bit extensions, MOVBE, MMX, SSE,
24335 SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES,
24336 PCLMUL, FSGSBASE, RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX and
24337 PREFETCHW instruction set support.
24338
24339 skylake
24340 Intel Skylake CPU with 64-bit extensions, MOVBE, MMX, SSE,
24341 SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES,
24342 PCLMUL, FSGSBASE, RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX,
24343 PREFETCHW, CLFLUSHOPT, XSAVEC and XSAVES instruction set
24344 support.
24345
24346 bonnell
24347 Intel Bonnell CPU with 64-bit extensions, MOVBE, MMX, SSE,
24348 SSE2, SSE3 and SSSE3 instruction set support.
24349
24350 silvermont
24351 Intel Silvermont CPU with 64-bit extensions, MOVBE, MMX, SSE,
24352 SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, AES, PCLMUL and
24353 RDRND instruction set support.
24354
24355 goldmont
24356 Intel Goldmont CPU with 64-bit extensions, MOVBE, MMX, SSE,
24357 SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, AES, PCLMUL, RDRND,
24358 XSAVE, XSAVEOPT and FSGSBASE instruction set support.
24359
24360 goldmont-plus
24361 Intel Goldmont Plus CPU with 64-bit extensions, MOVBE, MMX,
24362 SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, AES, PCLMUL,
24363 RDRND, XSAVE, XSAVEOPT, FSGSBASE, PTWRITE, RDPID, SGX and UMIP
24364 instruction set support.
24365
24366 tremont
24367 Intel Tremont CPU with 64-bit extensions, MOVBE, MMX, SSE,
24368 SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, AES, PCLMUL, RDRND,
24369 XSAVE, XSAVEOPT, FSGSBASE, PTWRITE, RDPID, SGX, UMIP, GFNI-SSE,
24370 CLWB and ENCLV instruction set support.
24371
24372 knl Intel Knight's Landing CPU with 64-bit extensions, MOVBE, MMX,
24373 SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES,
24374 PCLMUL, FSGSBASE, RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX,
24375 PREFETCHW, AVX512F, AVX512PF, AVX512ER and AVX512CD instruction
24376 set support.
24377
24378 knm Intel Knights Mill CPU with 64-bit extensions, MOVBE, MMX, SSE,
24379 SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES,
24380 PCLMUL, FSGSBASE, RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX,
24381 PREFETCHW, AVX512F, AVX512PF, AVX512ER, AVX512CD, AVX5124VNNIW,
24382 AVX5124FMAPS and AVX512VPOPCNTDQ instruction set support.
24383
24384 skylake-avx512
24385 Intel Skylake Server CPU with 64-bit extensions, MOVBE, MMX,
24386 SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2,
24387 AES, PCLMUL, FSGSBASE, RDRND, FMA, BMI, BMI2, F16C, RDSEED,
24388 ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F, CLWB,
24389 AVX512VL, AVX512BW, AVX512DQ and AVX512CD instruction set
24390 support.
24391
24392 cannonlake
24393 Intel Cannonlake Server CPU with 64-bit extensions, MOVBE, MMX,
24394 SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2,
24395 AES, PCLMUL, FSGSBASE, RDRND, FMA, BMI, BMI2, F16C, RDSEED,
24396 ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F, AVX512VL,
24397 AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI, AVX512IFMA, SHA and
24398 UMIP instruction set support.
24399
24400 icelake-client
24401 Intel Icelake Client CPU with 64-bit extensions, MOVBE, MMX,
24402 SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2,
24403 AES, PCLMUL, FSGSBASE, RDRND, FMA, BMI, BMI2, F16C, RDSEED,
24404 ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F, AVX512VL,
24405 AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI, AVX512IFMA, SHA,
24406 CLWB, UMIP, RDPID, GFNI, AVX512VBMI2, AVX512VPOPCNTDQ,
24407 AVX512BITALG, AVX512VNNI, VPCLMULQDQ, VAES instruction set
24408 support.
24409
24410 icelake-server
24411 Intel Icelake Server CPU with 64-bit extensions, MOVBE, MMX,
24412 SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2,
24413 AES, PCLMUL, FSGSBASE, RDRND, FMA, BMI, BMI2, F16C, RDSEED,
24414 ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F, AVX512VL,
24415 AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI, AVX512IFMA, SHA,
24416 CLWB, UMIP, RDPID, GFNI, AVX512VBMI2, AVX512VPOPCNTDQ,
24417 AVX512BITALG, AVX512VNNI, VPCLMULQDQ, VAES, PCONFIG and
24418 WBNOINVD instruction set support.
24419
24420 cascadelake
24421 Intel Cascadelake CPU with 64-bit extensions, MOVBE, MMX, SSE,
24422 SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES,
24423 PCLMUL, FSGSBASE, RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX,
24424 PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F, CLWB, AVX512VL,
24425 AVX512BW, AVX512DQ, AVX512CD and AVX512VNNI instruction set
24426 support.
24427
24428 cooperlake
24429 Intel cooperlake CPU with 64-bit extensions, MOVBE, MMX, SSE,
24430 SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES,
24431 PCLMUL, FSGSBASE, RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX,
24432 PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F, CLWB, AVX512VL,
24433 AVX512BW, AVX512DQ, AVX512CD, AVX512VNNI and AVX512BF16
24434 instruction set support.
24435
24436 tigerlake
24437 Intel Tigerlake CPU with 64-bit extensions, MOVBE, MMX, SSE,
24438 SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES,
24439 PCLMUL, FSGSBASE, RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX,
24440 PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F, AVX512VL,
24441 AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI, AVX512IFMA, SHA,
24442 CLWB, UMIP, RDPID, GFNI, AVX512VBMI2, AVX512VPOPCNTDQ,
24443 AVX512BITALG, AVX512VNNI, VPCLMULQDQ, VAES, PCONFIG, WBNOINVD,
24444 MOVDIRI, MOVDIR64B and AVX512VP2INTERSECT instruction set
24445 support.
24446
24447 k6 AMD K6 CPU with MMX instruction set support.
24448
24449 k6-2
24450 k6-3
24451 Improved versions of AMD K6 CPU with MMX and 3DNow! instruction
24452 set support.
24453
24454 athlon
24455 athlon-tbird
24456 AMD Athlon CPU with MMX, 3dNOW!, enhanced 3DNow! and SSE
24457 prefetch instructions support.
24458
24459 athlon-4
24460 athlon-xp
24461 athlon-mp
24462 Improved AMD Athlon CPU with MMX, 3DNow!, enhanced 3DNow! and
24463 full SSE instruction set support.
24464
24465 k8
24466 opteron
24467 athlon64
24468 athlon-fx
24469 Processors based on the AMD K8 core with x86-64 instruction set
24470 support, including the AMD Opteron, Athlon 64, and Athlon 64 FX
24471 processors. (This supersets MMX, SSE, SSE2, 3DNow!, enhanced
24472 3DNow! and 64-bit instruction set extensions.)
24473
24474 k8-sse3
24475 opteron-sse3
24476 athlon64-sse3
24477 Improved versions of AMD K8 cores with SSE3 instruction set
24478 support.
24479
24480 amdfam10
24481 barcelona
24482 CPUs based on AMD Family 10h cores with x86-64 instruction set
24483 support. (This supersets MMX, SSE, SSE2, SSE3, SSE4A, 3DNow!,
24484 enhanced 3DNow!, ABM and 64-bit instruction set extensions.)
24485
24486 bdver1
24487 CPUs based on AMD Family 15h cores with x86-64 instruction set
24488 support. (This supersets FMA4, AVX, XOP, LWP, AES, PCLMUL,
24489 CX16, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM
24490 and 64-bit instruction set extensions.)
24491
24492 bdver2
24493 AMD Family 15h core based CPUs with x86-64 instruction set
24494 support. (This supersets BMI, TBM, F16C, FMA, FMA4, AVX, XOP,
24495 LWP, AES, PCLMUL, CX16, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3,
24496 SSE4.1, SSE4.2, ABM and 64-bit instruction set extensions.)
24497
24498 bdver3
24499 AMD Family 15h core based CPUs with x86-64 instruction set
24500 support. (This supersets BMI, TBM, F16C, FMA, FMA4, FSGSBASE,
24501 AVX, XOP, LWP, AES, PCLMUL, CX16, MMX, SSE, SSE2, SSE3, SSE4A,
24502 SSSE3, SSE4.1, SSE4.2, ABM and 64-bit instruction set
24503 extensions.)
24504
24505 bdver4
24506 AMD Family 15h core based CPUs with x86-64 instruction set
24507 support. (This supersets BMI, BMI2, TBM, F16C, FMA, FMA4,
24508 FSGSBASE, AVX, AVX2, XOP, LWP, AES, PCLMUL, CX16, MOVBE, MMX,
24509 SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM and 64-bit
24510 instruction set extensions.)
24511
24512 znver1
24513 AMD Family 17h core based CPUs with x86-64 instruction set
24514 support. (This supersets BMI, BMI2, F16C, FMA, FSGSBASE, AVX,
24515 AVX2, ADCX, RDSEED, MWAITX, SHA, CLZERO, AES, PCLMUL, CX16,
24516 MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM,
24517 XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, and 64-bit instruction set
24518 extensions.)
24519
24520 znver2
24521 AMD Family 17h core based CPUs with x86-64 instruction set
24522 support. (This supersets BMI, BMI2, CLWB, F16C, FMA, FSGSBASE,
24523 AVX, AVX2, ADCX, RDSEED, MWAITX, SHA, CLZERO, AES, PCLMUL,
24524 CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1,
24525 SSE4.2, ABM, XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, RDPID,
24526 WBNOINVD, and 64-bit instruction set extensions.)
24527
24528 btver1
24529 CPUs based on AMD Family 14h cores with x86-64 instruction set
24530 support. (This supersets MMX, SSE, SSE2, SSE3, SSSE3, SSE4A,
24531 CX16, ABM and 64-bit instruction set extensions.)
24532
24533 btver2
24534 CPUs based on AMD Family 16h cores with x86-64 instruction set
24535 support. This includes MOVBE, F16C, BMI, AVX, PCLMUL, AES,
24536 SSE4.2, SSE4.1, CX16, ABM, SSE4A, SSSE3, SSE3, SSE2, SSE, MMX
24537 and 64-bit instruction set extensions.
24538
24539 winchip-c6
24540 IDT WinChip C6 CPU, dealt in same way as i486 with additional
24541 MMX instruction set support.
24542
24543 winchip2
24544 IDT WinChip 2 CPU, dealt in same way as i486 with additional
24545 MMX and 3DNow! instruction set support.
24546
24547 c3 VIA C3 CPU with MMX and 3DNow! instruction set support. (No
24548 scheduling is implemented for this chip.)
24549
24550 c3-2
24551 VIA C3-2 (Nehemiah/C5XL) CPU with MMX and SSE instruction set
24552 support. (No scheduling is implemented for this chip.)
24553
24554 c7 VIA C7 (Esther) CPU with MMX, SSE, SSE2 and SSE3 instruction
24555 set support. (No scheduling is implemented for this chip.)
24556
24557 samuel-2
24558 VIA Eden Samuel 2 CPU with MMX and 3DNow! instruction set
24559 support. (No scheduling is implemented for this chip.)
24560
24561 nehemiah
24562 VIA Eden Nehemiah CPU with MMX and SSE instruction set support.
24563 (No scheduling is implemented for this chip.)
24564
24565 esther
24566 VIA Eden Esther CPU with MMX, SSE, SSE2 and SSE3 instruction
24567 set support. (No scheduling is implemented for this chip.)
24568
24569 eden-x2
24570 VIA Eden X2 CPU with x86-64, MMX, SSE, SSE2 and SSE3
24571 instruction set support. (No scheduling is implemented for
24572 this chip.)
24573
24574 eden-x4
24575 VIA Eden X4 CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3,
24576 SSE4.1, SSE4.2, AVX and AVX2 instruction set support. (No
24577 scheduling is implemented for this chip.)
24578
24579 nano
24580 Generic VIA Nano CPU with x86-64, MMX, SSE, SSE2, SSE3 and
24581 SSSE3 instruction set support. (No scheduling is implemented
24582 for this chip.)
24583
24584 nano-1000
24585 VIA Nano 1xxx CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
24586 instruction set support. (No scheduling is implemented for
24587 this chip.)
24588
24589 nano-2000
24590 VIA Nano 2xxx CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
24591 instruction set support. (No scheduling is implemented for
24592 this chip.)
24593
24594 nano-3000
24595 VIA Nano 3xxx CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and
24596 SSE4.1 instruction set support. (No scheduling is implemented
24597 for this chip.)
24598
24599 nano-x2
24600 VIA Nano Dual Core CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3
24601 and SSE4.1 instruction set support. (No scheduling is
24602 implemented for this chip.)
24603
24604 nano-x4
24605 VIA Nano Quad Core CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3
24606 and SSE4.1 instruction set support. (No scheduling is
24607 implemented for this chip.)
24608
24609 geode
24610 AMD Geode embedded processor with MMX and 3DNow! instruction
24611 set support.
24612
24613 -mtune=cpu-type
24614 Tune to cpu-type everything applicable about the generated code,
24615 except for the ABI and the set of available instructions. While
24616 picking a specific cpu-type schedules things appropriately for that
24617 particular chip, the compiler does not generate any code that
24618 cannot run on the default machine type unless you use a -march=cpu-
24619 type option. For example, if GCC is configured for
24620 i686-pc-linux-gnu then -mtune=pentium4 generates code that is tuned
24621 for Pentium 4 but still runs on i686 machines.
24622
24623 The choices for cpu-type are the same as for -march. In addition,
24624 -mtune supports 2 extra choices for cpu-type:
24625
24626 generic
24627 Produce code optimized for the most common IA32/AMD64/EM64T
24628 processors. If you know the CPU on which your code will run,
24629 then you should use the corresponding -mtune or -march option
24630 instead of -mtune=generic. But, if you do not know exactly
24631 what CPU users of your application will have, then you should
24632 use this option.
24633
24634 As new processors are deployed in the marketplace, the behavior
24635 of this option will change. Therefore, if you upgrade to a
24636 newer version of GCC, code generation controlled by this option
24637 will change to reflect the processors that are most common at
24638 the time that version of GCC is released.
24639
24640 There is no -march=generic option because -march indicates the
24641 instruction set the compiler can use, and there is no generic
24642 instruction set applicable to all processors. In contrast,
24643 -mtune indicates the processor (or, in this case, collection of
24644 processors) for which the code is optimized.
24645
24646 intel
24647 Produce code optimized for the most current Intel processors,
24648 which are Haswell and Silvermont for this version of GCC. If
24649 you know the CPU on which your code will run, then you should
24650 use the corresponding -mtune or -march option instead of
24651 -mtune=intel. But, if you want your application performs
24652 better on both Haswell and Silvermont, then you should use this
24653 option.
24654
24655 As new Intel processors are deployed in the marketplace, the
24656 behavior of this option will change. Therefore, if you upgrade
24657 to a newer version of GCC, code generation controlled by this
24658 option will change to reflect the most current Intel processors
24659 at the time that version of GCC is released.
24660
24661 There is no -march=intel option because -march indicates the
24662 instruction set the compiler can use, and there is no common
24663 instruction set applicable to all processors. In contrast,
24664 -mtune indicates the processor (or, in this case, collection of
24665 processors) for which the code is optimized.
24666
24667 -mcpu=cpu-type
24668 A deprecated synonym for -mtune.
24669
24670 -mfpmath=unit
24671 Generate floating-point arithmetic for selected unit unit. The
24672 choices for unit are:
24673
24674 387 Use the standard 387 floating-point coprocessor present on the
24675 majority of chips and emulated otherwise. Code compiled with
24676 this option runs almost everywhere. The temporary results are
24677 computed in 80-bit precision instead of the precision specified
24678 by the type, resulting in slightly different results compared
24679 to most of other chips. See -ffloat-store for more detailed
24680 description.
24681
24682 This is the default choice for non-Darwin x86-32 targets.
24683
24684 sse Use scalar floating-point instructions present in the SSE
24685 instruction set. This instruction set is supported by Pentium
24686 III and newer chips, and in the AMD line by Athlon-4, Athlon XP
24687 and Athlon MP chips. The earlier version of the SSE
24688 instruction set supports only single-precision arithmetic, thus
24689 the double and extended-precision arithmetic are still done
24690 using 387. A later version, present only in Pentium 4 and AMD
24691 x86-64 chips, supports double-precision arithmetic too.
24692
24693 For the x86-32 compiler, you must use -march=cpu-type, -msse or
24694 -msse2 switches to enable SSE extensions and make this option
24695 effective. For the x86-64 compiler, these extensions are
24696 enabled by default.
24697
24698 The resulting code should be considerably faster in the
24699 majority of cases and avoid the numerical instability problems
24700 of 387 code, but may break some existing code that expects
24701 temporaries to be 80 bits.
24702
24703 This is the default choice for the x86-64 compiler, Darwin
24704 x86-32 targets, and the default choice for x86-32 targets with
24705 the SSE2 instruction set when -ffast-math is enabled.
24706
24707 sse,387
24708 sse+387
24709 both
24710 Attempt to utilize both instruction sets at once. This
24711 effectively doubles the amount of available registers, and on
24712 chips with separate execution units for 387 and SSE the
24713 execution resources too. Use this option with care, as it is
24714 still experimental, because the GCC register allocator does not
24715 model separate functional units well, resulting in unstable
24716 performance.
24717
24718 -masm=dialect
24719 Output assembly instructions using selected dialect. Also affects
24720 which dialect is used for basic "asm" and extended "asm". Supported
24721 choices (in dialect order) are att or intel. The default is att.
24722 Darwin does not support intel.
24723
24724 -mieee-fp
24725 -mno-ieee-fp
24726 Control whether or not the compiler uses IEEE floating-point
24727 comparisons. These correctly handle the case where the result of a
24728 comparison is unordered.
24729
24730 -m80387
24731 -mhard-float
24732 Generate output containing 80387 instructions for floating point.
24733
24734 -mno-80387
24735 -msoft-float
24736 Generate output containing library calls for floating point.
24737
24738 Warning: the requisite libraries are not part of GCC. Normally the
24739 facilities of the machine's usual C compiler are used, but this
24740 cannot be done directly in cross-compilation. You must make your
24741 own arrangements to provide suitable library functions for cross-
24742 compilation.
24743
24744 On machines where a function returns floating-point results in the
24745 80387 register stack, some floating-point opcodes may be emitted
24746 even if -msoft-float is used.
24747
24748 -mno-fp-ret-in-387
24749 Do not use the FPU registers for return values of functions.
24750
24751 The usual calling convention has functions return values of types
24752 "float" and "double" in an FPU register, even if there is no FPU.
24753 The idea is that the operating system should emulate an FPU.
24754
24755 The option -mno-fp-ret-in-387 causes such values to be returned in
24756 ordinary CPU registers instead.
24757
24758 -mno-fancy-math-387
24759 Some 387 emulators do not support the "sin", "cos" and "sqrt"
24760 instructions for the 387. Specify this option to avoid generating
24761 those instructions. This option is overridden when -march
24762 indicates that the target CPU always has an FPU and so the
24763 instruction does not need emulation. These instructions are not
24764 generated unless you also use the -funsafe-math-optimizations
24765 switch.
24766
24767 -malign-double
24768 -mno-align-double
24769 Control whether GCC aligns "double", "long double", and "long long"
24770 variables on a two-word boundary or a one-word boundary. Aligning
24771 "double" variables on a two-word boundary produces code that runs
24772 somewhat faster on a Pentium at the expense of more memory.
24773
24774 On x86-64, -malign-double is enabled by default.
24775
24776 Warning: if you use the -malign-double switch, structures
24777 containing the above types are aligned differently than the
24778 published application binary interface specifications for the
24779 x86-32 and are not binary compatible with structures in code
24780 compiled without that switch.
24781
24782 -m96bit-long-double
24783 -m128bit-long-double
24784 These switches control the size of "long double" type. The x86-32
24785 application binary interface specifies the size to be 96 bits, so
24786 -m96bit-long-double is the default in 32-bit mode.
24787
24788 Modern architectures (Pentium and newer) prefer "long double" to be
24789 aligned to an 8- or 16-byte boundary. In arrays or structures
24790 conforming to the ABI, this is not possible. So specifying
24791 -m128bit-long-double aligns "long double" to a 16-byte boundary by
24792 padding the "long double" with an additional 32-bit zero.
24793
24794 In the x86-64 compiler, -m128bit-long-double is the default choice
24795 as its ABI specifies that "long double" is aligned on 16-byte
24796 boundary.
24797
24798 Notice that neither of these options enable any extra precision
24799 over the x87 standard of 80 bits for a "long double".
24800
24801 Warning: if you override the default value for your target ABI,
24802 this changes the size of structures and arrays containing "long
24803 double" variables, as well as modifying the function calling
24804 convention for functions taking "long double". Hence they are not
24805 binary-compatible with code compiled without that switch.
24806
24807 -mlong-double-64
24808 -mlong-double-80
24809 -mlong-double-128
24810 These switches control the size of "long double" type. A size of 64
24811 bits makes the "long double" type equivalent to the "double" type.
24812 This is the default for 32-bit Bionic C library. A size of 128
24813 bits makes the "long double" type equivalent to the "__float128"
24814 type. This is the default for 64-bit Bionic C library.
24815
24816 Warning: if you override the default value for your target ABI,
24817 this changes the size of structures and arrays containing "long
24818 double" variables, as well as modifying the function calling
24819 convention for functions taking "long double". Hence they are not
24820 binary-compatible with code compiled without that switch.
24821
24822 -malign-data=type
24823 Control how GCC aligns variables. Supported values for type are
24824 compat uses increased alignment value compatible uses GCC 4.8 and
24825 earlier, abi uses alignment value as specified by the psABI, and
24826 cacheline uses increased alignment value to match the cache line
24827 size. compat is the default.
24828
24829 -mlarge-data-threshold=threshold
24830 When -mcmodel=medium is specified, data objects larger than
24831 threshold are placed in the large data section. This value must be
24832 the same across all objects linked into the binary, and defaults to
24833 65535.
24834
24835 -mrtd
24836 Use a different function-calling convention, in which functions
24837 that take a fixed number of arguments return with the "ret num"
24838 instruction, which pops their arguments while returning. This
24839 saves one instruction in the caller since there is no need to pop
24840 the arguments there.
24841
24842 You can specify that an individual function is called with this
24843 calling sequence with the function attribute "stdcall". You can
24844 also override the -mrtd option by using the function attribute
24845 "cdecl".
24846
24847 Warning: this calling convention is incompatible with the one
24848 normally used on Unix, so you cannot use it if you need to call
24849 libraries compiled with the Unix compiler.
24850
24851 Also, you must provide function prototypes for all functions that
24852 take variable numbers of arguments (including "printf"); otherwise
24853 incorrect code is generated for calls to those functions.
24854
24855 In addition, seriously incorrect code results if you call a
24856 function with too many arguments. (Normally, extra arguments are
24857 harmlessly ignored.)
24858
24859 -mregparm=num
24860 Control how many registers are used to pass integer arguments. By
24861 default, no registers are used to pass arguments, and at most 3
24862 registers can be used. You can control this behavior for a
24863 specific function by using the function attribute "regparm".
24864
24865 Warning: if you use this switch, and num is nonzero, then you must
24866 build all modules with the same value, including any libraries.
24867 This includes the system libraries and startup modules.
24868
24869 -msseregparm
24870 Use SSE register passing conventions for float and double arguments
24871 and return values. You can control this behavior for a specific
24872 function by using the function attribute "sseregparm".
24873
24874 Warning: if you use this switch then you must build all modules
24875 with the same value, including any libraries. This includes the
24876 system libraries and startup modules.
24877
24878 -mvect8-ret-in-mem
24879 Return 8-byte vectors in memory instead of MMX registers. This is
24880 the default on VxWorks to match the ABI of the Sun Studio compilers
24881 until version 12. Only use this option if you need to remain
24882 compatible with existing code produced by those previous compiler
24883 versions or older versions of GCC.
24884
24885 -mpc32
24886 -mpc64
24887 -mpc80
24888 Set 80387 floating-point precision to 32, 64 or 80 bits. When
24889 -mpc32 is specified, the significands of results of floating-point
24890 operations are rounded to 24 bits (single precision); -mpc64 rounds
24891 the significands of results of floating-point operations to 53 bits
24892 (double precision) and -mpc80 rounds the significands of results of
24893 floating-point operations to 64 bits (extended double precision),
24894 which is the default. When this option is used, floating-point
24895 operations in higher precisions are not available to the programmer
24896 without setting the FPU control word explicitly.
24897
24898 Setting the rounding of floating-point operations to less than the
24899 default 80 bits can speed some programs by 2% or more. Note that
24900 some mathematical libraries assume that extended-precision (80-bit)
24901 floating-point operations are enabled by default; routines in such
24902 libraries could suffer significant loss of accuracy, typically
24903 through so-called "catastrophic cancellation", when this option is
24904 used to set the precision to less than extended precision.
24905
24906 -mstackrealign
24907 Realign the stack at entry. On the x86, the -mstackrealign option
24908 generates an alternate prologue and epilogue that realigns the run-
24909 time stack if necessary. This supports mixing legacy codes that
24910 keep 4-byte stack alignment with modern codes that keep 16-byte
24911 stack alignment for SSE compatibility. See also the attribute
24912 "force_align_arg_pointer", applicable to individual functions.
24913
24914 -mpreferred-stack-boundary=num
24915 Attempt to keep the stack boundary aligned to a 2 raised to num
24916 byte boundary. If -mpreferred-stack-boundary is not specified, the
24917 default is 4 (16 bytes or 128 bits).
24918
24919 Warning: When generating code for the x86-64 architecture with SSE
24920 extensions disabled, -mpreferred-stack-boundary=3 can be used to
24921 keep the stack boundary aligned to 8 byte boundary. Since x86-64
24922 ABI require 16 byte stack alignment, this is ABI incompatible and
24923 intended to be used in controlled environment where stack space is
24924 important limitation. This option leads to wrong code when
24925 functions compiled with 16 byte stack alignment (such as functions
24926 from a standard library) are called with misaligned stack. In this
24927 case, SSE instructions may lead to misaligned memory access traps.
24928 In addition, variable arguments are handled incorrectly for 16 byte
24929 aligned objects (including x87 long double and __int128), leading
24930 to wrong results. You must build all modules with
24931 -mpreferred-stack-boundary=3, including any libraries. This
24932 includes the system libraries and startup modules.
24933
24934 -mincoming-stack-boundary=num
24935 Assume the incoming stack is aligned to a 2 raised to num byte
24936 boundary. If -mincoming-stack-boundary is not specified, the one
24937 specified by -mpreferred-stack-boundary is used.
24938
24939 On Pentium and Pentium Pro, "double" and "long double" values
24940 should be aligned to an 8-byte boundary (see -malign-double) or
24941 suffer significant run time performance penalties. On Pentium III,
24942 the Streaming SIMD Extension (SSE) data type "__m128" may not work
24943 properly if it is not 16-byte aligned.
24944
24945 To ensure proper alignment of this values on the stack, the stack
24946 boundary must be as aligned as that required by any value stored on
24947 the stack. Further, every function must be generated such that it
24948 keeps the stack aligned. Thus calling a function compiled with a
24949 higher preferred stack boundary from a function compiled with a
24950 lower preferred stack boundary most likely misaligns the stack. It
24951 is recommended that libraries that use callbacks always use the
24952 default setting.
24953
24954 This extra alignment does consume extra stack space, and generally
24955 increases code size. Code that is sensitive to stack space usage,
24956 such as embedded systems and operating system kernels, may want to
24957 reduce the preferred alignment to -mpreferred-stack-boundary=2.
24958
24959 -mmmx
24960 -msse
24961 -msse2
24962 -msse3
24963 -mssse3
24964 -msse4
24965 -msse4a
24966 -msse4.1
24967 -msse4.2
24968 -mavx
24969 -mavx2
24970 -mavx512f
24971 -mavx512pf
24972 -mavx512er
24973 -mavx512cd
24974 -mavx512vl
24975 -mavx512bw
24976 -mavx512dq
24977 -mavx512ifma
24978 -mavx512vbmi
24979 -msha
24980 -maes
24981 -mpclmul
24982 -mclflushopt
24983 -mclwb
24984 -mfsgsbase
24985 -mptwrite
24986 -mrdrnd
24987 -mf16c
24988 -mfma
24989 -mpconfig
24990 -mwbnoinvd
24991 -mfma4
24992 -mprfchw
24993 -mrdpid
24994 -mprefetchwt1
24995 -mrdseed
24996 -msgx
24997 -mxop
24998 -mlwp
24999 -m3dnow
25000 -m3dnowa
25001 -mpopcnt
25002 -mabm
25003 -madx
25004 -mbmi
25005 -mbmi2
25006 -mlzcnt
25007 -mfxsr
25008 -mxsave
25009 -mxsaveopt
25010 -mxsavec
25011 -mxsaves
25012 -mrtm
25013 -mhle
25014 -mtbm
25015 -mmwaitx
25016 -mclzero
25017 -mpku
25018 -mavx512vbmi2
25019 -mavx512bf16
25020 -mgfni
25021 -mvaes
25022 -mwaitpkg
25023 -mvpclmulqdq
25024 -mavx512bitalg
25025 -mmovdiri
25026 -mmovdir64b
25027 -menqcmd
25028 -mavx512vpopcntdq
25029 -mavx512vp2intersect
25030 -mavx5124fmaps
25031 -mavx512vnni
25032 -mavx5124vnniw
25033 -mcldemote
25034 These switches enable the use of instructions in the MMX, SSE,
25035 SSE2, SSE3, SSSE3, SSE4, SSE4A, SSE4.1, SSE4.2, AVX, AVX2, AVX512F,
25036 AVX512PF, AVX512ER, AVX512CD, AVX512VL, AVX512BW, AVX512DQ,
25037 AVX512IFMA, AVX512VBMI, SHA, AES, PCLMUL, CLFLUSHOPT, CLWB,
25038 FSGSBASE, PTWRITE, RDRND, F16C, FMA, PCONFIG, WBNOINVD, FMA4,
25039 PREFETCHW, RDPID, PREFETCHWT1, RDSEED, SGX, XOP, LWP, 3DNow!,
25040 enhanced 3DNow!, POPCNT, ABM, ADX, BMI, BMI2, LZCNT, FXSR, XSAVE,
25041 XSAVEOPT, XSAVEC, XSAVES, RTM, HLE, TBM, MWAITX, CLZERO, PKU,
25042 AVX512VBMI2, GFNI, VAES, WAITPKG, VPCLMULQDQ, AVX512BITALG,
25043 MOVDIRI, MOVDIR64B, AVX512BF16, ENQCMD, AVX512VPOPCNTDQ,
25044 AVX5124FMAPS, AVX512VNNI, AVX5124VNNIW, or CLDEMOTE extended
25045 instruction sets. Each has a corresponding -mno- option to disable
25046 use of these instructions.
25047
25048 These extensions are also available as built-in functions: see x86
25049 Built-in Functions, for details of the functions enabled and
25050 disabled by these switches.
25051
25052 To generate SSE/SSE2 instructions automatically from floating-point
25053 code (as opposed to 387 instructions), see -mfpmath=sse.
25054
25055 GCC depresses SSEx instructions when -mavx is used. Instead, it
25056 generates new AVX instructions or AVX equivalence for all SSEx
25057 instructions when needed.
25058
25059 These options enable GCC to use these extended instructions in
25060 generated code, even without -mfpmath=sse. Applications that
25061 perform run-time CPU detection must compile separate files for each
25062 supported architecture, using the appropriate flags. In
25063 particular, the file containing the CPU detection code should be
25064 compiled without these options.
25065
25066 -mdump-tune-features
25067 This option instructs GCC to dump the names of the x86 performance
25068 tuning features and default settings. The names can be used in
25069 -mtune-ctrl=feature-list.
25070
25071 -mtune-ctrl=feature-list
25072 This option is used to do fine grain control of x86 code generation
25073 features. feature-list is a comma separated list of feature names.
25074 See also -mdump-tune-features. When specified, the feature is
25075 turned on if it is not preceded with ^, otherwise, it is turned
25076 off. -mtune-ctrl=feature-list is intended to be used by GCC
25077 developers. Using it may lead to code paths not covered by testing
25078 and can potentially result in compiler ICEs or runtime errors.
25079
25080 -mno-default
25081 This option instructs GCC to turn off all tunable features. See
25082 also -mtune-ctrl=feature-list and -mdump-tune-features.
25083
25084 -mcld
25085 This option instructs GCC to emit a "cld" instruction in the
25086 prologue of functions that use string instructions. String
25087 instructions depend on the DF flag to select between autoincrement
25088 or autodecrement mode. While the ABI specifies the DF flag to be
25089 cleared on function entry, some operating systems violate this
25090 specification by not clearing the DF flag in their exception
25091 dispatchers. The exception handler can be invoked with the DF flag
25092 set, which leads to wrong direction mode when string instructions
25093 are used. This option can be enabled by default on 32-bit x86
25094 targets by configuring GCC with the --enable-cld configure option.
25095 Generation of "cld" instructions can be suppressed with the
25096 -mno-cld compiler option in this case.
25097
25098 -mvzeroupper
25099 This option instructs GCC to emit a "vzeroupper" instruction before
25100 a transfer of control flow out of the function to minimize the AVX
25101 to SSE transition penalty as well as remove unnecessary "zeroupper"
25102 intrinsics.
25103
25104 -mprefer-avx128
25105 This option instructs GCC to use 128-bit AVX instructions instead
25106 of 256-bit AVX instructions in the auto-vectorizer.
25107
25108 -mprefer-vector-width=opt
25109 This option instructs GCC to use opt-bit vector width in
25110 instructions instead of default on the selected platform.
25111
25112 none
25113 No extra limitations applied to GCC other than defined by the
25114 selected platform.
25115
25116 128 Prefer 128-bit vector width for instructions.
25117
25118 256 Prefer 256-bit vector width for instructions.
25119
25120 512 Prefer 512-bit vector width for instructions.
25121
25122 -mcx16
25123 This option enables GCC to generate "CMPXCHG16B" instructions in
25124 64-bit code to implement compare-and-exchange operations on 16-byte
25125 aligned 128-bit objects. This is useful for atomic updates of data
25126 structures exceeding one machine word in size. The compiler uses
25127 this instruction to implement __sync Builtins. However, for
25128 __atomic Builtins operating on 128-bit integers, a library call is
25129 always used.
25130
25131 -msahf
25132 This option enables generation of "SAHF" instructions in 64-bit
25133 code. Early Intel Pentium 4 CPUs with Intel 64 support, prior to
25134 the introduction of Pentium 4 G1 step in December 2005, lacked the
25135 "LAHF" and "SAHF" instructions which are supported by AMD64. These
25136 are load and store instructions, respectively, for certain status
25137 flags. In 64-bit mode, the "SAHF" instruction is used to optimize
25138 "fmod", "drem", and "remainder" built-in functions; see Other
25139 Builtins for details.
25140
25141 -mmovbe
25142 This option enables use of the "movbe" instruction to implement
25143 "__builtin_bswap32" and "__builtin_bswap64".
25144
25145 -mshstk
25146 The -mshstk option enables shadow stack built-in functions from x86
25147 Control-flow Enforcement Technology (CET).
25148
25149 -mcrc32
25150 This option enables built-in functions "__builtin_ia32_crc32qi",
25151 "__builtin_ia32_crc32hi", "__builtin_ia32_crc32si" and
25152 "__builtin_ia32_crc32di" to generate the "crc32" machine
25153 instruction.
25154
25155 -mrecip
25156 This option enables use of "RCPSS" and "RSQRTSS" instructions (and
25157 their vectorized variants "RCPPS" and "RSQRTPS") with an additional
25158 Newton-Raphson step to increase precision instead of "DIVSS" and
25159 "SQRTSS" (and their vectorized variants) for single-precision
25160 floating-point arguments. These instructions are generated only
25161 when -funsafe-math-optimizations is enabled together with
25162 -ffinite-math-only and -fno-trapping-math. Note that while the
25163 throughput of the sequence is higher than the throughput of the
25164 non-reciprocal instruction, the precision of the sequence can be
25165 decreased by up to 2 ulp (i.e. the inverse of 1.0 equals
25166 0.99999994).
25167
25168 Note that GCC implements "1.0f/sqrtf(x)" in terms of "RSQRTSS" (or
25169 "RSQRTPS") already with -ffast-math (or the above option
25170 combination), and doesn't need -mrecip.
25171
25172 Also note that GCC emits the above sequence with additional Newton-
25173 Raphson step for vectorized single-float division and vectorized
25174 "sqrtf(x)" already with -ffast-math (or the above option
25175 combination), and doesn't need -mrecip.
25176
25177 -mrecip=opt
25178 This option controls which reciprocal estimate instructions may be
25179 used. opt is a comma-separated list of options, which may be
25180 preceded by a ! to invert the option:
25181
25182 all Enable all estimate instructions.
25183
25184 default
25185 Enable the default instructions, equivalent to -mrecip.
25186
25187 none
25188 Disable all estimate instructions, equivalent to -mno-recip.
25189
25190 div Enable the approximation for scalar division.
25191
25192 vec-div
25193 Enable the approximation for vectorized division.
25194
25195 sqrt
25196 Enable the approximation for scalar square root.
25197
25198 vec-sqrt
25199 Enable the approximation for vectorized square root.
25200
25201 So, for example, -mrecip=all,!sqrt enables all of the reciprocal
25202 approximations, except for square root.
25203
25204 -mveclibabi=type
25205 Specifies the ABI type to use for vectorizing intrinsics using an
25206 external library. Supported values for type are svml for the Intel
25207 short vector math library and acml for the AMD math core library.
25208 To use this option, both -ftree-vectorize and
25209 -funsafe-math-optimizations have to be enabled, and an SVML or ACML
25210 ABI-compatible library must be specified at link time.
25211
25212 GCC currently emits calls to "vmldExp2", "vmldLn2", "vmldLog102",
25213 "vmldPow2", "vmldTanh2", "vmldTan2", "vmldAtan2", "vmldAtanh2",
25214 "vmldCbrt2", "vmldSinh2", "vmldSin2", "vmldAsinh2", "vmldAsin2",
25215 "vmldCosh2", "vmldCos2", "vmldAcosh2", "vmldAcos2", "vmlsExp4",
25216 "vmlsLn4", "vmlsLog104", "vmlsPow4", "vmlsTanh4", "vmlsTan4",
25217 "vmlsAtan4", "vmlsAtanh4", "vmlsCbrt4", "vmlsSinh4", "vmlsSin4",
25218 "vmlsAsinh4", "vmlsAsin4", "vmlsCosh4", "vmlsCos4", "vmlsAcosh4"
25219 and "vmlsAcos4" for corresponding function type when
25220 -mveclibabi=svml is used, and "__vrd2_sin", "__vrd2_cos",
25221 "__vrd2_exp", "__vrd2_log", "__vrd2_log2", "__vrd2_log10",
25222 "__vrs4_sinf", "__vrs4_cosf", "__vrs4_expf", "__vrs4_logf",
25223 "__vrs4_log2f", "__vrs4_log10f" and "__vrs4_powf" for the
25224 corresponding function type when -mveclibabi=acml is used.
25225
25226 -mabi=name
25227 Generate code for the specified calling convention. Permissible
25228 values are sysv for the ABI used on GNU/Linux and other systems,
25229 and ms for the Microsoft ABI. The default is to use the Microsoft
25230 ABI when targeting Microsoft Windows and the SysV ABI on all other
25231 systems. You can control this behavior for specific functions by
25232 using the function attributes "ms_abi" and "sysv_abi".
25233
25234 -mforce-indirect-call
25235 Force all calls to functions to be indirect. This is useful when
25236 using Intel Processor Trace where it generates more precise timing
25237 information for function calls.
25238
25239 -mmanual-endbr
25240 Insert ENDBR instruction at function entry only via the "cf_check"
25241 function attribute. This is useful when used with the option
25242 -fcf-protection=branch to control ENDBR insertion at the function
25243 entry.
25244
25245 -mcall-ms2sysv-xlogues
25246 Due to differences in 64-bit ABIs, any Microsoft ABI function that
25247 calls a System V ABI function must consider RSI, RDI and XMM6-15 as
25248 clobbered. By default, the code for saving and restoring these
25249 registers is emitted inline, resulting in fairly lengthy prologues
25250 and epilogues. Using -mcall-ms2sysv-xlogues emits prologues and
25251 epilogues that use stubs in the static portion of libgcc to perform
25252 these saves and restores, thus reducing function size at the cost
25253 of a few extra instructions.
25254
25255 -mtls-dialect=type
25256 Generate code to access thread-local storage using the gnu or gnu2
25257 conventions. gnu is the conservative default; gnu2 is more
25258 efficient, but it may add compile- and run-time requirements that
25259 cannot be satisfied on all systems.
25260
25261 -mpush-args
25262 -mno-push-args
25263 Use PUSH operations to store outgoing parameters. This method is
25264 shorter and usually equally fast as method using SUB/MOV operations
25265 and is enabled by default. In some cases disabling it may improve
25266 performance because of improved scheduling and reduced
25267 dependencies.
25268
25269 -maccumulate-outgoing-args
25270 If enabled, the maximum amount of space required for outgoing
25271 arguments is computed in the function prologue. This is faster on
25272 most modern CPUs because of reduced dependencies, improved
25273 scheduling and reduced stack usage when the preferred stack
25274 boundary is not equal to 2. The drawback is a notable increase in
25275 code size. This switch implies -mno-push-args.
25276
25277 -mthreads
25278 Support thread-safe exception handling on MinGW. Programs that
25279 rely on thread-safe exception handling must compile and link all
25280 code with the -mthreads option. When compiling, -mthreads defines
25281 -D_MT; when linking, it links in a special thread helper library
25282 -lmingwthrd which cleans up per-thread exception-handling data.
25283
25284 -mms-bitfields
25285 -mno-ms-bitfields
25286 Enable/disable bit-field layout compatible with the native
25287 Microsoft Windows compiler.
25288
25289 If "packed" is used on a structure, or if bit-fields are used, it
25290 may be that the Microsoft ABI lays out the structure differently
25291 than the way GCC normally does. Particularly when moving packed
25292 data between functions compiled with GCC and the native Microsoft
25293 compiler (either via function call or as data in a file), it may be
25294 necessary to access either format.
25295
25296 This option is enabled by default for Microsoft Windows targets.
25297 This behavior can also be controlled locally by use of variable or
25298 type attributes. For more information, see x86 Variable Attributes
25299 and x86 Type Attributes.
25300
25301 The Microsoft structure layout algorithm is fairly simple with the
25302 exception of the bit-field packing. The padding and alignment of
25303 members of structures and whether a bit-field can straddle a
25304 storage-unit boundary are determine by these rules:
25305
25306 1. Structure members are stored sequentially in the order in which
25307 they are
25308 declared: the first member has the lowest memory address and
25309 the last member the highest.
25310
25311 2. Every data object has an alignment requirement. The alignment
25312 requirement
25313 for all data except structures, unions, and arrays is either
25314 the size of the object or the current packing size (specified
25315 with either the "aligned" attribute or the "pack" pragma),
25316 whichever is less. For structures, unions, and arrays, the
25317 alignment requirement is the largest alignment requirement of
25318 its members. Every object is allocated an offset so that:
25319
25320 offset % alignment_requirement == 0
25321
25322 3. Adjacent bit-fields are packed into the same 1-, 2-, or 4-byte
25323 allocation
25324 unit if the integral types are the same size and if the next
25325 bit-field fits into the current allocation unit without
25326 crossing the boundary imposed by the common alignment
25327 requirements of the bit-fields.
25328
25329 MSVC interprets zero-length bit-fields in the following ways:
25330
25331 1. If a zero-length bit-field is inserted between two bit-fields
25332 that
25333 are normally coalesced, the bit-fields are not coalesced.
25334
25335 For example:
25336
25337 struct
25338 {
25339 unsigned long bf_1 : 12;
25340 unsigned long : 0;
25341 unsigned long bf_2 : 12;
25342 } t1;
25343
25344 The size of "t1" is 8 bytes with the zero-length bit-field. If
25345 the zero-length bit-field were removed, "t1"'s size would be 4
25346 bytes.
25347
25348 2. If a zero-length bit-field is inserted after a bit-field, "foo",
25349 and the
25350 alignment of the zero-length bit-field is greater than the
25351 member that follows it, "bar", "bar" is aligned as the type of
25352 the zero-length bit-field.
25353
25354 For example:
25355
25356 struct
25357 {
25358 char foo : 4;
25359 short : 0;
25360 char bar;
25361 } t2;
25362
25363 struct
25364 {
25365 char foo : 4;
25366 short : 0;
25367 double bar;
25368 } t3;
25369
25370 For "t2", "bar" is placed at offset 2, rather than offset 1.
25371 Accordingly, the size of "t2" is 4. For "t3", the zero-length
25372 bit-field does not affect the alignment of "bar" or, as a
25373 result, the size of the structure.
25374
25375 Taking this into account, it is important to note the
25376 following:
25377
25378 1. If a zero-length bit-field follows a normal bit-field, the
25379 type of the
25380 zero-length bit-field may affect the alignment of the
25381 structure as whole. For example, "t2" has a size of 4
25382 bytes, since the zero-length bit-field follows a normal
25383 bit-field, and is of type short.
25384
25385 2. Even if a zero-length bit-field is not followed by a normal
25386 bit-field, it may
25387 still affect the alignment of the structure:
25388
25389 struct
25390 {
25391 char foo : 6;
25392 long : 0;
25393 } t4;
25394
25395 Here, "t4" takes up 4 bytes.
25396
25397 3. Zero-length bit-fields following non-bit-field members are
25398 ignored:
25399 struct
25400 {
25401 char foo;
25402 long : 0;
25403 char bar;
25404 } t5;
25405
25406 Here, "t5" takes up 2 bytes.
25407
25408 -mno-align-stringops
25409 Do not align the destination of inlined string operations. This
25410 switch reduces code size and improves performance in case the
25411 destination is already aligned, but GCC doesn't know about it.
25412
25413 -minline-all-stringops
25414 By default GCC inlines string operations only when the destination
25415 is known to be aligned to least a 4-byte boundary. This enables
25416 more inlining and increases code size, but may improve performance
25417 of code that depends on fast "memcpy" and "memset" for short
25418 lengths. The option enables inline expansion of "strlen" for all
25419 pointer alignments.
25420
25421 -minline-stringops-dynamically
25422 For string operations of unknown size, use run-time checks with
25423 inline code for small blocks and a library call for large blocks.
25424
25425 -mstringop-strategy=alg
25426 Override the internal decision heuristic for the particular
25427 algorithm to use for inlining string operations. The allowed
25428 values for alg are:
25429
25430 rep_byte
25431 rep_4byte
25432 rep_8byte
25433 Expand using i386 "rep" prefix of the specified size.
25434
25435 byte_loop
25436 loop
25437 unrolled_loop
25438 Expand into an inline loop.
25439
25440 libcall
25441 Always use a library call.
25442
25443 -mmemcpy-strategy=strategy
25444 Override the internal decision heuristic to decide if
25445 "__builtin_memcpy" should be inlined and what inline algorithm to
25446 use when the expected size of the copy operation is known. strategy
25447 is a comma-separated list of alg:max_size:dest_align triplets. alg
25448 is specified in -mstringop-strategy, max_size specifies the max
25449 byte size with which inline algorithm alg is allowed. For the last
25450 triplet, the max_size must be "-1". The max_size of the triplets in
25451 the list must be specified in increasing order. The minimal byte
25452 size for alg is 0 for the first triplet and "max_size + 1" of the
25453 preceding range.
25454
25455 -mmemset-strategy=strategy
25456 The option is similar to -mmemcpy-strategy= except that it is to
25457 control "__builtin_memset" expansion.
25458
25459 -momit-leaf-frame-pointer
25460 Don't keep the frame pointer in a register for leaf functions.
25461 This avoids the instructions to save, set up, and restore frame
25462 pointers and makes an extra register available in leaf functions.
25463 The option -fomit-leaf-frame-pointer removes the frame pointer for
25464 leaf functions, which might make debugging harder.
25465
25466 -mtls-direct-seg-refs
25467 -mno-tls-direct-seg-refs
25468 Controls whether TLS variables may be accessed with offsets from
25469 the TLS segment register (%gs for 32-bit, %fs for 64-bit), or
25470 whether the thread base pointer must be added. Whether or not this
25471 is valid depends on the operating system, and whether it maps the
25472 segment to cover the entire TLS area.
25473
25474 For systems that use the GNU C Library, the default is on.
25475
25476 -msse2avx
25477 -mno-sse2avx
25478 Specify that the assembler should encode SSE instructions with VEX
25479 prefix. The option -mavx turns this on by default.
25480
25481 -mfentry
25482 -mno-fentry
25483 If profiling is active (-pg), put the profiling counter call before
25484 the prologue. Note: On x86 architectures the attribute
25485 "ms_hook_prologue" isn't possible at the moment for -mfentry and
25486 -pg.
25487
25488 -mrecord-mcount
25489 -mno-record-mcount
25490 If profiling is active (-pg), generate a __mcount_loc section that
25491 contains pointers to each profiling call. This is useful for
25492 automatically patching and out calls.
25493
25494 -mnop-mcount
25495 -mno-nop-mcount
25496 If profiling is active (-pg), generate the calls to the profiling
25497 functions as NOPs. This is useful when they should be patched in
25498 later dynamically. This is likely only useful together with
25499 -mrecord-mcount.
25500
25501 -minstrument-return=type
25502 Instrument function exit in -pg -mfentry instrumented functions
25503 with call to specified function. This only instruments true returns
25504 ending with ret, but not sibling calls ending with jump. Valid
25505 types are none to not instrument, call to generate a call to
25506 __return__, or nop5 to generate a 5 byte nop.
25507
25508 -mrecord-return
25509 -mno-record-return
25510 Generate a __return_loc section pointing to all return
25511 instrumentation code.
25512
25513 -mfentry-name=name
25514 Set name of __fentry__ symbol called at function entry for -pg
25515 -mfentry functions.
25516
25517 -mfentry-section=name
25518 Set name of section to record -mrecord-mcount calls (default
25519 __mcount_loc).
25520
25521 -mskip-rax-setup
25522 -mno-skip-rax-setup
25523 When generating code for the x86-64 architecture with SSE
25524 extensions disabled, -mskip-rax-setup can be used to skip setting
25525 up RAX register when there are no variable arguments passed in
25526 vector registers.
25527
25528 Warning: Since RAX register is used to avoid unnecessarily saving
25529 vector registers on stack when passing variable arguments, the
25530 impacts of this option are callees may waste some stack space,
25531 misbehave or jump to a random location. GCC 4.4 or newer don't
25532 have those issues, regardless the RAX register value.
25533
25534 -m8bit-idiv
25535 -mno-8bit-idiv
25536 On some processors, like Intel Atom, 8-bit unsigned integer divide
25537 is much faster than 32-bit/64-bit integer divide. This option
25538 generates a run-time check. If both dividend and divisor are
25539 within range of 0 to 255, 8-bit unsigned integer divide is used
25540 instead of 32-bit/64-bit integer divide.
25541
25542 -mavx256-split-unaligned-load
25543 -mavx256-split-unaligned-store
25544 Split 32-byte AVX unaligned load and store.
25545
25546 -mstack-protector-guard=guard
25547 -mstack-protector-guard-reg=reg
25548 -mstack-protector-guard-offset=offset
25549 Generate stack protection code using canary at guard. Supported
25550 locations are global for global canary or tls for per-thread canary
25551 in the TLS block (the default). This option has effect only when
25552 -fstack-protector or -fstack-protector-all is specified.
25553
25554 With the latter choice the options -mstack-protector-guard-reg=reg
25555 and -mstack-protector-guard-offset=offset furthermore specify which
25556 segment register (%fs or %gs) to use as base register for reading
25557 the canary, and from what offset from that base register. The
25558 default for those is as specified in the relevant ABI.
25559
25560 -mgeneral-regs-only
25561 Generate code that uses only the general-purpose registers. This
25562 prevents the compiler from using floating-point, vector, mask and
25563 bound registers.
25564
25565 -mindirect-branch=choice
25566 Convert indirect call and jump with choice. The default is keep,
25567 which keeps indirect call and jump unmodified. thunk converts
25568 indirect call and jump to call and return thunk. thunk-inline
25569 converts indirect call and jump to inlined call and return thunk.
25570 thunk-extern converts indirect call and jump to external call and
25571 return thunk provided in a separate object file. You can control
25572 this behavior for a specific function by using the function
25573 attribute "indirect_branch".
25574
25575 Note that -mcmodel=large is incompatible with
25576 -mindirect-branch=thunk and -mindirect-branch=thunk-extern since
25577 the thunk function may not be reachable in the large code model.
25578
25579 Note that -mindirect-branch=thunk-extern is compatible with
25580 -fcf-protection=branch since the external thunk can be made to
25581 enable control-flow check.
25582
25583 -mfunction-return=choice
25584 Convert function return with choice. The default is keep, which
25585 keeps function return unmodified. thunk converts function return
25586 to call and return thunk. thunk-inline converts function return to
25587 inlined call and return thunk. thunk-extern converts function
25588 return to external call and return thunk provided in a separate
25589 object file. You can control this behavior for a specific function
25590 by using the function attribute "function_return".
25591
25592 Note that -mindirect-return=thunk-extern is compatible with
25593 -fcf-protection=branch since the external thunk can be made to
25594 enable control-flow check.
25595
25596 Note that -mcmodel=large is incompatible with
25597 -mfunction-return=thunk and -mfunction-return=thunk-extern since
25598 the thunk function may not be reachable in the large code model.
25599
25600 -mindirect-branch-register
25601 Force indirect call and jump via register.
25602
25603 These -m switches are supported in addition to the above on x86-64
25604 processors in 64-bit environments.
25605
25606 -m32
25607 -m64
25608 -mx32
25609 -m16
25610 -miamcu
25611 Generate code for a 16-bit, 32-bit or 64-bit environment. The -m32
25612 option sets "int", "long", and pointer types to 32 bits, and
25613 generates code that runs on any i386 system.
25614
25615 The -m64 option sets "int" to 32 bits and "long" and pointer types
25616 to 64 bits, and generates code for the x86-64 architecture. For
25617 Darwin only the -m64 option also turns off the -fno-pic and
25618 -mdynamic-no-pic options.
25619
25620 The -mx32 option sets "int", "long", and pointer types to 32 bits,
25621 and generates code for the x86-64 architecture.
25622
25623 The -m16 option is the same as -m32, except for that it outputs the
25624 ".code16gcc" assembly directive at the beginning of the assembly
25625 output so that the binary can run in 16-bit mode.
25626
25627 The -miamcu option generates code which conforms to Intel MCU
25628 psABI. It requires the -m32 option to be turned on.
25629
25630 -mno-red-zone
25631 Do not use a so-called "red zone" for x86-64 code. The red zone is
25632 mandated by the x86-64 ABI; it is a 128-byte area beyond the
25633 location of the stack pointer that is not modified by signal or
25634 interrupt handlers and therefore can be used for temporary data
25635 without adjusting the stack pointer. The flag -mno-red-zone
25636 disables this red zone.
25637
25638 -mcmodel=small
25639 Generate code for the small code model: the program and its symbols
25640 must be linked in the lower 2 GB of the address space. Pointers
25641 are 64 bits. Programs can be statically or dynamically linked.
25642 This is the default code model.
25643
25644 -mcmodel=kernel
25645 Generate code for the kernel code model. The kernel runs in the
25646 negative 2 GB of the address space. This model has to be used for
25647 Linux kernel code.
25648
25649 -mcmodel=medium
25650 Generate code for the medium model: the program is linked in the
25651 lower 2 GB of the address space. Small symbols are also placed
25652 there. Symbols with sizes larger than -mlarge-data-threshold are
25653 put into large data or BSS sections and can be located above 2GB.
25654 Programs can be statically or dynamically linked.
25655
25656 -mcmodel=large
25657 Generate code for the large model. This model makes no assumptions
25658 about addresses and sizes of sections.
25659
25660 -maddress-mode=long
25661 Generate code for long address mode. This is only supported for
25662 64-bit and x32 environments. It is the default address mode for
25663 64-bit environments.
25664
25665 -maddress-mode=short
25666 Generate code for short address mode. This is only supported for
25667 32-bit and x32 environments. It is the default address mode for
25668 32-bit and x32 environments.
25669
25670 x86 Windows Options
25671 These additional options are available for Microsoft Windows targets:
25672
25673 -mconsole
25674 This option specifies that a console application is to be
25675 generated, by instructing the linker to set the PE header subsystem
25676 type required for console applications. This option is available
25677 for Cygwin and MinGW targets and is enabled by default on those
25678 targets.
25679
25680 -mdll
25681 This option is available for Cygwin and MinGW targets. It
25682 specifies that a DLL---a dynamic link library---is to be generated,
25683 enabling the selection of the required runtime startup object and
25684 entry point.
25685
25686 -mnop-fun-dllimport
25687 This option is available for Cygwin and MinGW targets. It
25688 specifies that the "dllimport" attribute should be ignored.
25689
25690 -mthread
25691 This option is available for MinGW targets. It specifies that
25692 MinGW-specific thread support is to be used.
25693
25694 -municode
25695 This option is available for MinGW-w64 targets. It causes the
25696 "UNICODE" preprocessor macro to be predefined, and chooses Unicode-
25697 capable runtime startup code.
25698
25699 -mwin32
25700 This option is available for Cygwin and MinGW targets. It
25701 specifies that the typical Microsoft Windows predefined macros are
25702 to be set in the pre-processor, but does not influence the choice
25703 of runtime library/startup code.
25704
25705 -mwindows
25706 This option is available for Cygwin and MinGW targets. It
25707 specifies that a GUI application is to be generated by instructing
25708 the linker to set the PE header subsystem type appropriately.
25709
25710 -fno-set-stack-executable
25711 This option is available for MinGW targets. It specifies that the
25712 executable flag for the stack used by nested functions isn't set.
25713 This is necessary for binaries running in kernel mode of Microsoft
25714 Windows, as there the User32 API, which is used to set executable
25715 privileges, isn't available.
25716
25717 -fwritable-relocated-rdata
25718 This option is available for MinGW and Cygwin targets. It
25719 specifies that relocated-data in read-only section is put into the
25720 ".data" section. This is a necessary for older runtimes not
25721 supporting modification of ".rdata" sections for pseudo-relocation.
25722
25723 -mpe-aligned-commons
25724 This option is available for Cygwin and MinGW targets. It
25725 specifies that the GNU extension to the PE file format that permits
25726 the correct alignment of COMMON variables should be used when
25727 generating code. It is enabled by default if GCC detects that the
25728 target assembler found during configuration supports the feature.
25729
25730 See also under x86 Options for standard options.
25731
25732 Xstormy16 Options
25733 These options are defined for Xstormy16:
25734
25735 -msim
25736 Choose startup files and linker script suitable for the simulator.
25737
25738 Xtensa Options
25739 These options are supported for Xtensa targets:
25740
25741 -mconst16
25742 -mno-const16
25743 Enable or disable use of "CONST16" instructions for loading
25744 constant values. The "CONST16" instruction is currently not a
25745 standard option from Tensilica. When enabled, "CONST16"
25746 instructions are always used in place of the standard "L32R"
25747 instructions. The use of "CONST16" is enabled by default only if
25748 the "L32R" instruction is not available.
25749
25750 -mfused-madd
25751 -mno-fused-madd
25752 Enable or disable use of fused multiply/add and multiply/subtract
25753 instructions in the floating-point option. This has no effect if
25754 the floating-point option is not also enabled. Disabling fused
25755 multiply/add and multiply/subtract instructions forces the compiler
25756 to use separate instructions for the multiply and add/subtract
25757 operations. This may be desirable in some cases where strict IEEE
25758 754-compliant results are required: the fused multiply add/subtract
25759 instructions do not round the intermediate result, thereby
25760 producing results with more bits of precision than specified by the
25761 IEEE standard. Disabling fused multiply add/subtract instructions
25762 also ensures that the program output is not sensitive to the
25763 compiler's ability to combine multiply and add/subtract operations.
25764
25765 -mserialize-volatile
25766 -mno-serialize-volatile
25767 When this option is enabled, GCC inserts "MEMW" instructions before
25768 "volatile" memory references to guarantee sequential consistency.
25769 The default is -mserialize-volatile. Use -mno-serialize-volatile
25770 to omit the "MEMW" instructions.
25771
25772 -mforce-no-pic
25773 For targets, like GNU/Linux, where all user-mode Xtensa code must
25774 be position-independent code (PIC), this option disables PIC for
25775 compiling kernel code.
25776
25777 -mtext-section-literals
25778 -mno-text-section-literals
25779 These options control the treatment of literal pools. The default
25780 is -mno-text-section-literals, which places literals in a separate
25781 section in the output file. This allows the literal pool to be
25782 placed in a data RAM/ROM, and it also allows the linker to combine
25783 literal pools from separate object files to remove redundant
25784 literals and improve code size. With -mtext-section-literals, the
25785 literals are interspersed in the text section in order to keep them
25786 as close as possible to their references. This may be necessary
25787 for large assembly files. Literals for each function are placed
25788 right before that function.
25789
25790 -mauto-litpools
25791 -mno-auto-litpools
25792 These options control the treatment of literal pools. The default
25793 is -mno-auto-litpools, which places literals in a separate section
25794 in the output file unless -mtext-section-literals is used. With
25795 -mauto-litpools the literals are interspersed in the text section
25796 by the assembler. Compiler does not produce explicit ".literal"
25797 directives and loads literals into registers with "MOVI"
25798 instructions instead of "L32R" to let the assembler do relaxation
25799 and place literals as necessary. This option allows assembler to
25800 create several literal pools per function and assemble very big
25801 functions, which may not be possible with -mtext-section-literals.
25802
25803 -mtarget-align
25804 -mno-target-align
25805 When this option is enabled, GCC instructs the assembler to
25806 automatically align instructions to reduce branch penalties at the
25807 expense of some code density. The assembler attempts to widen
25808 density instructions to align branch targets and the instructions
25809 following call instructions. If there are not enough preceding
25810 safe density instructions to align a target, no widening is
25811 performed. The default is -mtarget-align. These options do not
25812 affect the treatment of auto-aligned instructions like "LOOP",
25813 which the assembler always aligns, either by widening density
25814 instructions or by inserting NOP instructions.
25815
25816 -mlongcalls
25817 -mno-longcalls
25818 When this option is enabled, GCC instructs the assembler to
25819 translate direct calls to indirect calls unless it can determine
25820 that the target of a direct call is in the range allowed by the
25821 call instruction. This translation typically occurs for calls to
25822 functions in other source files. Specifically, the assembler
25823 translates a direct "CALL" instruction into an "L32R" followed by a
25824 "CALLX" instruction. The default is -mno-longcalls. This option
25825 should be used in programs where the call target can potentially be
25826 out of range. This option is implemented in the assembler, not the
25827 compiler, so the assembly code generated by GCC still shows direct
25828 call instructions---look at the disassembled object code to see the
25829 actual instructions. Note that the assembler uses an indirect call
25830 for every cross-file call, not just those that really are out of
25831 range.
25832
25833 zSeries Options
25834 These are listed under
25835
25837 This section describes several environment variables that affect how
25838 GCC operates. Some of them work by specifying directories or prefixes
25839 to use when searching for various kinds of files. Some are used to
25840 specify other aspects of the compilation environment.
25841
25842 Note that you can also specify places to search using options such as
25843 -B, -I and -L. These take precedence over places specified using
25844 environment variables, which in turn take precedence over those
25845 specified by the configuration of GCC.
25846
25847 LANG
25848 LC_CTYPE
25849 LC_MESSAGES
25850 LC_ALL
25851 These environment variables control the way that GCC uses
25852 localization information which allows GCC to work with different
25853 national conventions. GCC inspects the locale categories LC_CTYPE
25854 and LC_MESSAGES if it has been configured to do so. These locale
25855 categories can be set to any value supported by your installation.
25856 A typical value is en_GB.UTF-8 for English in the United Kingdom
25857 encoded in UTF-8.
25858
25859 The LC_CTYPE environment variable specifies character
25860 classification. GCC uses it to determine the character boundaries
25861 in a string; this is needed for some multibyte encodings that
25862 contain quote and escape characters that are otherwise interpreted
25863 as a string end or escape.
25864
25865 The LC_MESSAGES environment variable specifies the language to use
25866 in diagnostic messages.
25867
25868 If the LC_ALL environment variable is set, it overrides the value
25869 of LC_CTYPE and LC_MESSAGES; otherwise, LC_CTYPE and LC_MESSAGES
25870 default to the value of the LANG environment variable. If none of
25871 these variables are set, GCC defaults to traditional C English
25872 behavior.
25873
25874 TMPDIR
25875 If TMPDIR is set, it specifies the directory to use for temporary
25876 files. GCC uses temporary files to hold the output of one stage of
25877 compilation which is to be used as input to the next stage: for
25878 example, the output of the preprocessor, which is the input to the
25879 compiler proper.
25880
25881 GCC_COMPARE_DEBUG
25882 Setting GCC_COMPARE_DEBUG is nearly equivalent to passing
25883 -fcompare-debug to the compiler driver. See the documentation of
25884 this option for more details.
25885
25886 GCC_EXEC_PREFIX
25887 If GCC_EXEC_PREFIX is set, it specifies a prefix to use in the
25888 names of the subprograms executed by the compiler. No slash is
25889 added when this prefix is combined with the name of a subprogram,
25890 but you can specify a prefix that ends with a slash if you wish.
25891
25892 If GCC_EXEC_PREFIX is not set, GCC attempts to figure out an
25893 appropriate prefix to use based on the pathname it is invoked with.
25894
25895 If GCC cannot find the subprogram using the specified prefix, it
25896 tries looking in the usual places for the subprogram.
25897
25898 The default value of GCC_EXEC_PREFIX is prefix/lib/gcc/ where
25899 prefix is the prefix to the installed compiler. In many cases
25900 prefix is the value of "prefix" when you ran the configure script.
25901
25902 Other prefixes specified with -B take precedence over this prefix.
25903
25904 This prefix is also used for finding files such as crt0.o that are
25905 used for linking.
25906
25907 In addition, the prefix is used in an unusual way in finding the
25908 directories to search for header files. For each of the standard
25909 directories whose name normally begins with /usr/local/lib/gcc
25910 (more precisely, with the value of GCC_INCLUDE_DIR), GCC tries
25911 replacing that beginning with the specified prefix to produce an
25912 alternate directory name. Thus, with -Bfoo/, GCC searches foo/bar
25913 just before it searches the standard directory /usr/local/lib/bar.
25914 If a standard directory begins with the configured prefix then the
25915 value of prefix is replaced by GCC_EXEC_PREFIX when looking for
25916 header files.
25917
25918 COMPILER_PATH
25919 The value of COMPILER_PATH is a colon-separated list of
25920 directories, much like PATH. GCC tries the directories thus
25921 specified when searching for subprograms, if it cannot find the
25922 subprograms using GCC_EXEC_PREFIX.
25923
25924 LIBRARY_PATH
25925 The value of LIBRARY_PATH is a colon-separated list of directories,
25926 much like PATH. When configured as a native compiler, GCC tries
25927 the directories thus specified when searching for special linker
25928 files, if it cannot find them using GCC_EXEC_PREFIX. Linking using
25929 GCC also uses these directories when searching for ordinary
25930 libraries for the -l option (but directories specified with -L come
25931 first).
25932
25933 LANG
25934 This variable is used to pass locale information to the compiler.
25935 One way in which this information is used is to determine the
25936 character set to be used when character literals, string literals
25937 and comments are parsed in C and C++. When the compiler is
25938 configured to allow multibyte characters, the following values for
25939 LANG are recognized:
25940
25941 C-JIS
25942 Recognize JIS characters.
25943
25944 C-SJIS
25945 Recognize SJIS characters.
25946
25947 C-EUCJP
25948 Recognize EUCJP characters.
25949
25950 If LANG is not defined, or if it has some other value, then the
25951 compiler uses "mblen" and "mbtowc" as defined by the default locale
25952 to recognize and translate multibyte characters.
25953
25954 Some additional environment variables affect the behavior of the
25955 preprocessor.
25956
25957 CPATH
25958 C_INCLUDE_PATH
25959 CPLUS_INCLUDE_PATH
25960 OBJC_INCLUDE_PATH
25961 Each variable's value is a list of directories separated by a
25962 special character, much like PATH, in which to look for header
25963 files. The special character, "PATH_SEPARATOR", is target-
25964 dependent and determined at GCC build time. For Microsoft Windows-
25965 based targets it is a semicolon, and for almost all other targets
25966 it is a colon.
25967
25968 CPATH specifies a list of directories to be searched as if
25969 specified with -I, but after any paths given with -I options on the
25970 command line. This environment variable is used regardless of
25971 which language is being preprocessed.
25972
25973 The remaining environment variables apply only when preprocessing
25974 the particular language indicated. Each specifies a list of
25975 directories to be searched as if specified with -isystem, but after
25976 any paths given with -isystem options on the command line.
25977
25978 In all these variables, an empty element instructs the compiler to
25979 search its current working directory. Empty elements can appear at
25980 the beginning or end of a path. For instance, if the value of
25981 CPATH is ":/special/include", that has the same effect as
25982 -I. -I/special/include.
25983
25984 DEPENDENCIES_OUTPUT
25985 If this variable is set, its value specifies how to output
25986 dependencies for Make based on the non-system header files
25987 processed by the compiler. System header files are ignored in the
25988 dependency output.
25989
25990 The value of DEPENDENCIES_OUTPUT can be just a file name, in which
25991 case the Make rules are written to that file, guessing the target
25992 name from the source file name. Or the value can have the form
25993 file target, in which case the rules are written to file file using
25994 target as the target name.
25995
25996 In other words, this environment variable is equivalent to
25997 combining the options -MM and -MF, with an optional -MT switch too.
25998
25999 SUNPRO_DEPENDENCIES
26000 This variable is the same as DEPENDENCIES_OUTPUT (see above),
26001 except that system header files are not ignored, so it implies -M
26002 rather than -MM. However, the dependence on the main input file is
26003 omitted.
26004
26005 SOURCE_DATE_EPOCH
26006 If this variable is set, its value specifies a UNIX timestamp to be
26007 used in replacement of the current date and time in the "__DATE__"
26008 and "__TIME__" macros, so that the embedded timestamps become
26009 reproducible.
26010
26011 The value of SOURCE_DATE_EPOCH must be a UNIX timestamp, defined as
26012 the number of seconds (excluding leap seconds) since 01 Jan 1970
26013 00:00:00 represented in ASCII; identical to the output of
26014 @command{date +%s} on GNU/Linux and other systems that support the
26015 %s extension in the "date" command.
26016
26017 The value should be a known timestamp such as the last modification
26018 time of the source or package and it should be set by the build
26019 process.
26020
26022 For instructions on reporting bugs, see
26023 <http://bugzilla.redhat.com/bugzilla>.
26024
26026 1. On some systems, gcc -shared needs to build supplementary stub code
26027 for constructors to work. On multi-libbed systems, gcc -shared
26028 must select the correct support libraries to link against. Failing
26029 to supply the correct flags may lead to subtle defects. Supplying
26030 them in cases where they are not necessary is innocuous.
26031
26033 gpl(7), gfdl(7), fsf-funding(7), cpp(1), gcov(1), as(1), ld(1), gdb(1),
26034 dbx(1) and the Info entries for gcc, cpp, as, ld, binutils and gdb.
26035
26037 See the Info entry for gcc, or
26038 <http://gcc.gnu.org/onlinedocs/gcc/Contributors.html>, for contributors
26039 to GCC.
26040
26042 Copyright (c) 1988-2020 Free Software Foundation, Inc.
26043
26044 Permission is granted to copy, distribute and/or modify this document
26045 under the terms of the GNU Free Documentation License, Version 1.3 or
26046 any later version published by the Free Software Foundation; with the
26047 Invariant Sections being "GNU General Public License" and "Funding Free
26048 Software", the Front-Cover texts being (a) (see below), and with the
26049 Back-Cover Texts being (b) (see below). A copy of the license is
26050 included in the gfdl(7) man page.
26051
26052 (a) The FSF's Front-Cover Text is:
26053
26054 A GNU Manual
26055
26056 (b) The FSF's Back-Cover Text is:
26057
26058 You have freedom to copy and modify this GNU Manual, like GNU
26059 software. Copies published by the Free Software Foundation raise
26060 funds for GNU development.
26061
26062
26063
26064gcc-10 2020-05-07 GCC(1)