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 -mharden-sls=opts -march=name -mcpu=name
453 -mtune=name -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 -mxbpf
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 -mmma -mno-mmma
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 ipa-cp-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 Diagnostic options such as -Wstringop-overflow are passed through
9091 to the link stage and their setting matches that of the compile-
9092 step at function granularity. Note that this matters only for
9093 diagnostics emitted during optimization. Note that code transforms
9094 such as inlining can lead to warnings being enabled or disabled for
9095 regions if code not consistent with the setting at compile time.
9096
9097 When you need to pass options to the assembler via -Wa or
9098 -Xassembler make sure to either compile such translation units with
9099 -fno-lto or consistently use the same assembler options on all
9100 translation units. You can alternatively also specify assembler
9101 options at LTO link time.
9102
9103 To enable debug info generation you need to supply -g at compile
9104 time. If any of the input files at link time were built with debug
9105 info generation enabled the link will enable debug info generation
9106 as well. Any elaborate debug info settings like the dwarf level
9107 -gdwarf-5 need to be explicitly repeated at the linker command line
9108 and mixing different settings in different translation units is
9109 discouraged.
9110
9111 If LTO encounters objects with C linkage declared with incompatible
9112 types in separate translation units to be linked together
9113 (undefined behavior according to ISO C99 6.2.7), a non-fatal
9114 diagnostic may be issued. The behavior is still undefined at run
9115 time. Similar diagnostics may be raised for other languages.
9116
9117 Another feature of LTO is that it is possible to apply
9118 interprocedural optimizations on files written in different
9119 languages:
9120
9121 gcc -c -flto foo.c
9122 g++ -c -flto bar.cc
9123 gfortran -c -flto baz.f90
9124 g++ -o myprog -flto -O3 foo.o bar.o baz.o -lgfortran
9125
9126 Notice that the final link is done with g++ to get the C++ runtime
9127 libraries and -lgfortran is added to get the Fortran runtime
9128 libraries. In general, when mixing languages in LTO mode, you
9129 should use the same link command options as when mixing languages
9130 in a regular (non-LTO) compilation.
9131
9132 If object files containing GIMPLE bytecode are stored in a library
9133 archive, say libfoo.a, it is possible to extract and use them in an
9134 LTO link if you are using a linker with plugin support. To create
9135 static libraries suitable for LTO, use gcc-ar and gcc-ranlib
9136 instead of ar and ranlib; to show the symbols of object files with
9137 GIMPLE bytecode, use gcc-nm. Those commands require that ar,
9138 ranlib and nm have been compiled with plugin support. At link
9139 time, use the flag -fuse-linker-plugin to ensure that the library
9140 participates in the LTO optimization process:
9141
9142 gcc -o myprog -O2 -flto -fuse-linker-plugin a.o b.o -lfoo
9143
9144 With the linker plugin enabled, the linker extracts the needed
9145 GIMPLE files from libfoo.a and passes them on to the running GCC to
9146 make them part of the aggregated GIMPLE image to be optimized.
9147
9148 If you are not using a linker with plugin support and/or do not
9149 enable the linker plugin, then the objects inside libfoo.a are
9150 extracted and linked as usual, but they do not participate in the
9151 LTO optimization process. In order to make a static library
9152 suitable for both LTO optimization and usual linkage, compile its
9153 object files with -flto -ffat-lto-objects.
9154
9155 Link-time optimizations do not require the presence of the whole
9156 program to operate. If the program does not require any symbols to
9157 be exported, it is possible to combine -flto and -fwhole-program to
9158 allow the interprocedural optimizers to use more aggressive
9159 assumptions which may lead to improved optimization opportunities.
9160 Use of -fwhole-program is not needed when linker plugin is active
9161 (see -fuse-linker-plugin).
9162
9163 The current implementation of LTO makes no attempt to generate
9164 bytecode that is portable between different types of hosts. The
9165 bytecode files are versioned and there is a strict version check,
9166 so bytecode files generated in one version of GCC do not work with
9167 an older or newer version of GCC.
9168
9169 Link-time optimization does not work well with generation of
9170 debugging information on systems other than those using a
9171 combination of ELF and DWARF.
9172
9173 If you specify the optional n, the optimization and code generation
9174 done at link time is executed in parallel using n parallel jobs by
9175 utilizing an installed make program. The environment variable MAKE
9176 may be used to override the program used.
9177
9178 You can also specify -flto=jobserver to use GNU make's job server
9179 mode to determine the number of parallel jobs. This is useful when
9180 the Makefile calling GCC is already executing in parallel. You
9181 must prepend a + to the command recipe in the parent Makefile for
9182 this to work. This option likely only works if MAKE is GNU make.
9183 Even without the option value, GCC tries to automatically detect a
9184 running GNU make's job server.
9185
9186 Use -flto=auto to use GNU make's job server, if available, or
9187 otherwise fall back to autodetection of the number of CPU threads
9188 present in your system.
9189
9190 -flto-partition=alg
9191 Specify the partitioning algorithm used by the link-time optimizer.
9192 The value is either 1to1 to specify a partitioning mirroring the
9193 original source files or balanced to specify partitioning into
9194 equally sized chunks (whenever possible) or max to create new
9195 partition for every symbol where possible. Specifying none as an
9196 algorithm disables partitioning and streaming completely. The
9197 default value is balanced. While 1to1 can be used as an workaround
9198 for various code ordering issues, the max partitioning is intended
9199 for internal testing only. The value one specifies that exactly
9200 one partition should be used while the value none bypasses
9201 partitioning and executes the link-time optimization step directly
9202 from the WPA phase.
9203
9204 -flto-compression-level=n
9205 This option specifies the level of compression used for
9206 intermediate language written to LTO object files, and is only
9207 meaningful in conjunction with LTO mode (-flto). Valid values are
9208 0 (no compression) to 9 (maximum compression). Values outside this
9209 range are clamped to either 0 or 9. If the option is not given, a
9210 default balanced compression setting is used.
9211
9212 -fuse-linker-plugin
9213 Enables the use of a linker plugin during link-time optimization.
9214 This option relies on plugin support in the linker, which is
9215 available in gold or in GNU ld 2.21 or newer.
9216
9217 This option enables the extraction of object files with GIMPLE
9218 bytecode out of library archives. This improves the quality of
9219 optimization by exposing more code to the link-time optimizer.
9220 This information specifies what symbols can be accessed externally
9221 (by non-LTO object or during dynamic linking). Resulting code
9222 quality improvements on binaries (and shared libraries that use
9223 hidden visibility) are similar to -fwhole-program. See -flto for a
9224 description of the effect of this flag and how to use it.
9225
9226 This option is enabled by default when LTO support in GCC is
9227 enabled and GCC was configured for use with a linker supporting
9228 plugins (GNU ld 2.21 or newer or gold).
9229
9230 -ffat-lto-objects
9231 Fat LTO objects are object files that contain both the intermediate
9232 language and the object code. This makes them usable for both LTO
9233 linking and normal linking. This option is effective only when
9234 compiling with -flto and is ignored at link time.
9235
9236 -fno-fat-lto-objects improves compilation time over plain LTO, but
9237 requires the complete toolchain to be aware of LTO. It requires a
9238 linker with linker plugin support for basic functionality.
9239 Additionally, nm, ar and ranlib need to support linker plugins to
9240 allow a full-featured build environment (capable of building static
9241 libraries etc). GCC provides the gcc-ar, gcc-nm, gcc-ranlib
9242 wrappers to pass the right options to these tools. With non fat LTO
9243 makefiles need to be modified to use them.
9244
9245 Note that modern binutils provide plugin auto-load mechanism.
9246 Installing the linker plugin into $libdir/bfd-plugins has the same
9247 effect as usage of the command wrappers (gcc-ar, gcc-nm and gcc-
9248 ranlib).
9249
9250 The default is -fno-fat-lto-objects on targets with linker plugin
9251 support.
9252
9253 -fcompare-elim
9254 After register allocation and post-register allocation instruction
9255 splitting, identify arithmetic instructions that compute processor
9256 flags similar to a comparison operation based on that arithmetic.
9257 If possible, eliminate the explicit comparison operation.
9258
9259 This pass only applies to certain targets that cannot explicitly
9260 represent the comparison operation before register allocation is
9261 complete.
9262
9263 Enabled at levels -O, -O2, -O3, -Os.
9264
9265 -fcprop-registers
9266 After register allocation and post-register allocation instruction
9267 splitting, perform a copy-propagation pass to try to reduce
9268 scheduling dependencies and occasionally eliminate the copy.
9269
9270 Enabled at levels -O, -O2, -O3, -Os.
9271
9272 -fprofile-correction
9273 Profiles collected using an instrumented binary for multi-threaded
9274 programs may be inconsistent due to missed counter updates. When
9275 this option is specified, GCC uses heuristics to correct or smooth
9276 out such inconsistencies. By default, GCC emits an error message
9277 when an inconsistent profile is detected.
9278
9279 This option is enabled by -fauto-profile.
9280
9281 -fprofile-partial-training
9282 With "-fprofile-use" all portions of programs not executed during
9283 train run are optimized agressively for size rather than speed. In
9284 some cases it is not practical to train all possible hot paths in
9285 the program. (For example, program may contain functions specific
9286 for a given hardware and trianing may not cover all hardware
9287 configurations program is run on.) With
9288 "-fprofile-partial-training" profile feedback will be ignored for
9289 all functions not executed during the train run leading them to be
9290 optimized as if they were compiled without profile feedback. This
9291 leads to better performance when train run is not representative
9292 but also leads to significantly bigger code.
9293
9294 -fprofile-use
9295 -fprofile-use=path
9296 Enable profile feedback-directed optimizations, and the following
9297 optimizations, many of which are generally profitable only with
9298 profile feedback available:
9299
9300 -fbranch-probabilities -fprofile-values -funroll-loops
9301 -fpeel-loops -ftracer -fvpt -finline-functions -fipa-cp
9302 -fipa-cp-clone -fipa-bit-cp -fpredictive-commoning -fsplit-loops
9303 -funswitch-loops -fgcse-after-reload -ftree-loop-vectorize
9304 -ftree-slp-vectorize -fvect-cost-model=dynamic
9305 -ftree-loop-distribute-patterns -fprofile-reorder-functions
9306
9307 Before you can use this option, you must first generate profiling
9308 information.
9309
9310 By default, GCC emits an error message if the feedback profiles do
9311 not match the source code. This error can be turned into a warning
9312 by using -Wno-error=coverage-mismatch. Note this may result in
9313 poorly optimized code. Additionally, by default, GCC also emits a
9314 warning message if the feedback profiles do not exist (see
9315 -Wmissing-profile).
9316
9317 If path is specified, GCC looks at the path to find the profile
9318 feedback data files. See -fprofile-dir.
9319
9320 -fauto-profile
9321 -fauto-profile=path
9322 Enable sampling-based feedback-directed optimizations, and the
9323 following optimizations, many of which are generally profitable
9324 only with profile feedback available:
9325
9326 -fbranch-probabilities -fprofile-values -funroll-loops
9327 -fpeel-loops -ftracer -fvpt -finline-functions -fipa-cp
9328 -fipa-cp-clone -fipa-bit-cp -fpredictive-commoning -fsplit-loops
9329 -funswitch-loops -fgcse-after-reload -ftree-loop-vectorize
9330 -ftree-slp-vectorize -fvect-cost-model=dynamic
9331 -ftree-loop-distribute-patterns -fprofile-correction
9332
9333 path is the name of a file containing AutoFDO profile information.
9334 If omitted, it defaults to fbdata.afdo in the current directory.
9335
9336 Producing an AutoFDO profile data file requires running your
9337 program with the perf utility on a supported GNU/Linux target
9338 system. For more information, see <https://perf.wiki.kernel.org/>.
9339
9340 E.g.
9341
9342 perf record -e br_inst_retired:near_taken -b -o perf.data \
9343 -- your_program
9344
9345 Then use the create_gcov tool to convert the raw profile data to a
9346 format that can be used by GCC. You must also supply the
9347 unstripped binary for your program to this tool. See
9348 <https://github.com/google/autofdo>.
9349
9350 E.g.
9351
9352 create_gcov --binary=your_program.unstripped --profile=perf.data \
9353 --gcov=profile.afdo
9354
9355 The following options control compiler behavior regarding floating-
9356 point arithmetic. These options trade off between speed and
9357 correctness. All must be specifically enabled.
9358
9359 -ffloat-store
9360 Do not store floating-point variables in registers, and inhibit
9361 other options that might change whether a floating-point value is
9362 taken from a register or memory.
9363
9364 This option prevents undesirable excess precision on machines such
9365 as the 68000 where the floating registers (of the 68881) keep more
9366 precision than a "double" is supposed to have. Similarly for the
9367 x86 architecture. For most programs, the excess precision does
9368 only good, but a few programs rely on the precise definition of
9369 IEEE floating point. Use -ffloat-store for such programs, after
9370 modifying them to store all pertinent intermediate computations
9371 into variables.
9372
9373 -fexcess-precision=style
9374 This option allows further control over excess precision on
9375 machines where floating-point operations occur in a format with
9376 more precision or range than the IEEE standard and interchange
9377 floating-point types. By default, -fexcess-precision=fast is in
9378 effect; this means that operations may be carried out in a wider
9379 precision than the types specified in the source if that would
9380 result in faster code, and it is unpredictable when rounding to the
9381 types specified in the source code takes place. When compiling C,
9382 if -fexcess-precision=standard is specified then excess precision
9383 follows the rules specified in ISO C99; in particular, both casts
9384 and assignments cause values to be rounded to their semantic types
9385 (whereas -ffloat-store only affects assignments). This option is
9386 enabled by default for C if a strict conformance option such as
9387 -std=c99 is used. -ffast-math enables -fexcess-precision=fast by
9388 default regardless of whether a strict conformance option is used.
9389
9390 -fexcess-precision=standard is not implemented for languages other
9391 than C. On the x86, it has no effect if -mfpmath=sse or
9392 -mfpmath=sse+387 is specified; in the former case, IEEE semantics
9393 apply without excess precision, and in the latter, rounding is
9394 unpredictable.
9395
9396 -ffast-math
9397 Sets the options -fno-math-errno, -funsafe-math-optimizations,
9398 -ffinite-math-only, -fno-rounding-math, -fno-signaling-nans,
9399 -fcx-limited-range and -fexcess-precision=fast.
9400
9401 This option causes the preprocessor macro "__FAST_MATH__" to be
9402 defined.
9403
9404 This option is not turned on by any -O option besides -Ofast since
9405 it can result in incorrect output for programs that depend on an
9406 exact implementation of IEEE or ISO rules/specifications for math
9407 functions. It may, however, yield faster code for programs that do
9408 not require the guarantees of these specifications.
9409
9410 -fno-math-errno
9411 Do not set "errno" after calling math functions that are executed
9412 with a single instruction, e.g., "sqrt". A program that relies on
9413 IEEE exceptions for math error handling may want to use this flag
9414 for speed while maintaining IEEE arithmetic compatibility.
9415
9416 This option is not turned on by any -O option since it can result
9417 in incorrect output for programs that depend on an exact
9418 implementation of IEEE or ISO rules/specifications for math
9419 functions. It may, however, yield faster code for programs that do
9420 not require the guarantees of these specifications.
9421
9422 The default is -fmath-errno.
9423
9424 On Darwin systems, the math library never sets "errno". There is
9425 therefore no reason for the compiler to consider the possibility
9426 that it might, and -fno-math-errno is the default.
9427
9428 -funsafe-math-optimizations
9429 Allow optimizations for floating-point arithmetic that (a) assume
9430 that arguments and results are valid and (b) may violate IEEE or
9431 ANSI standards. When used at link time, it may include libraries
9432 or startup files that change the default FPU control word or other
9433 similar optimizations.
9434
9435 This option is not turned on by any -O option since it can result
9436 in incorrect output for programs that depend on an exact
9437 implementation of IEEE or ISO rules/specifications for math
9438 functions. It may, however, yield faster code for programs that do
9439 not require the guarantees of these specifications. Enables
9440 -fno-signed-zeros, -fno-trapping-math, -fassociative-math and
9441 -freciprocal-math.
9442
9443 The default is -fno-unsafe-math-optimizations.
9444
9445 -fassociative-math
9446 Allow re-association of operands in series of floating-point
9447 operations. This violates the ISO C and C++ language standard by
9448 possibly changing computation result. NOTE: re-ordering may change
9449 the sign of zero as well as ignore NaNs and inhibit or create
9450 underflow or overflow (and thus cannot be used on code that relies
9451 on rounding behavior like "(x + 2**52) - 2**52". May also reorder
9452 floating-point comparisons and thus may not be used when ordered
9453 comparisons are required. This option requires that both
9454 -fno-signed-zeros and -fno-trapping-math be in effect. Moreover,
9455 it doesn't make much sense with -frounding-math. For Fortran the
9456 option is automatically enabled when both -fno-signed-zeros and
9457 -fno-trapping-math are in effect.
9458
9459 The default is -fno-associative-math.
9460
9461 -freciprocal-math
9462 Allow the reciprocal of a value to be used instead of dividing by
9463 the value if this enables optimizations. For example "x / y" can
9464 be replaced with "x * (1/y)", which is useful if "(1/y)" is subject
9465 to common subexpression elimination. Note that this loses
9466 precision and increases the number of flops operating on the value.
9467
9468 The default is -fno-reciprocal-math.
9469
9470 -ffinite-math-only
9471 Allow optimizations for floating-point arithmetic that assume that
9472 arguments and results are not NaNs or +-Infs.
9473
9474 This option is not turned on by any -O option since it can result
9475 in incorrect output for programs that depend on an exact
9476 implementation of IEEE or ISO rules/specifications for math
9477 functions. It may, however, yield faster code for programs that do
9478 not require the guarantees of these specifications.
9479
9480 The default is -fno-finite-math-only.
9481
9482 -fno-signed-zeros
9483 Allow optimizations for floating-point arithmetic that ignore the
9484 signedness of zero. IEEE arithmetic specifies the behavior of
9485 distinct +0.0 and -0.0 values, which then prohibits simplification
9486 of expressions such as x+0.0 or 0.0*x (even with
9487 -ffinite-math-only). This option implies that the sign of a zero
9488 result isn't significant.
9489
9490 The default is -fsigned-zeros.
9491
9492 -fno-trapping-math
9493 Compile code assuming that floating-point operations cannot
9494 generate user-visible traps. These traps include division by zero,
9495 overflow, underflow, inexact result and invalid operation. This
9496 option requires that -fno-signaling-nans be in effect. Setting
9497 this option may allow faster code if one relies on "non-stop" IEEE
9498 arithmetic, for example.
9499
9500 This option should never be turned on by any -O option since it can
9501 result in incorrect output for programs that depend on an exact
9502 implementation of IEEE or ISO rules/specifications for math
9503 functions.
9504
9505 The default is -ftrapping-math.
9506
9507 -frounding-math
9508 Disable transformations and optimizations that assume default
9509 floating-point rounding behavior. This is round-to-zero for all
9510 floating point to integer conversions, and round-to-nearest for all
9511 other arithmetic truncations. This option should be specified for
9512 programs that change the FP rounding mode dynamically, or that may
9513 be executed with a non-default rounding mode. This option disables
9514 constant folding of floating-point expressions at compile time
9515 (which may be affected by rounding mode) and arithmetic
9516 transformations that are unsafe in the presence of sign-dependent
9517 rounding modes.
9518
9519 The default is -fno-rounding-math.
9520
9521 This option is experimental and does not currently guarantee to
9522 disable all GCC optimizations that are affected by rounding mode.
9523 Future versions of GCC may provide finer control of this setting
9524 using C99's "FENV_ACCESS" pragma. This command-line option will be
9525 used to specify the default state for "FENV_ACCESS".
9526
9527 -fsignaling-nans
9528 Compile code assuming that IEEE signaling NaNs may generate user-
9529 visible traps during floating-point operations. Setting this
9530 option disables optimizations that may change the number of
9531 exceptions visible with signaling NaNs. This option implies
9532 -ftrapping-math.
9533
9534 This option causes the preprocessor macro "__SUPPORT_SNAN__" to be
9535 defined.
9536
9537 The default is -fno-signaling-nans.
9538
9539 This option is experimental and does not currently guarantee to
9540 disable all GCC optimizations that affect signaling NaN behavior.
9541
9542 -fno-fp-int-builtin-inexact
9543 Do not allow the built-in functions "ceil", "floor", "round" and
9544 "trunc", and their "float" and "long double" variants, to generate
9545 code that raises the "inexact" floating-point exception for
9546 noninteger arguments. ISO C99 and C11 allow these functions to
9547 raise the "inexact" exception, but ISO/IEC TS 18661-1:2014, the C
9548 bindings to IEEE 754-2008, as integrated into ISO C2X, does not
9549 allow these functions to do so.
9550
9551 The default is -ffp-int-builtin-inexact, allowing the exception to
9552 be raised, unless C2X or a later C standard is selected. This
9553 option does nothing unless -ftrapping-math is in effect.
9554
9555 Even if -fno-fp-int-builtin-inexact is used, if the functions
9556 generate a call to a library function then the "inexact" exception
9557 may be raised if the library implementation does not follow TS
9558 18661.
9559
9560 -fsingle-precision-constant
9561 Treat floating-point constants as single precision instead of
9562 implicitly converting them to double-precision constants.
9563
9564 -fcx-limited-range
9565 When enabled, this option states that a range reduction step is not
9566 needed when performing complex division. Also, there is no
9567 checking whether the result of a complex multiplication or division
9568 is "NaN + I*NaN", with an attempt to rescue the situation in that
9569 case. The default is -fno-cx-limited-range, but is enabled by
9570 -ffast-math.
9571
9572 This option controls the default setting of the ISO C99
9573 "CX_LIMITED_RANGE" pragma. Nevertheless, the option applies to all
9574 languages.
9575
9576 -fcx-fortran-rules
9577 Complex multiplication and division follow Fortran rules. Range
9578 reduction is done as part of complex division, but there is no
9579 checking whether the result of a complex multiplication or division
9580 is "NaN + I*NaN", with an attempt to rescue the situation in that
9581 case.
9582
9583 The default is -fno-cx-fortran-rules.
9584
9585 The following options control optimizations that may improve
9586 performance, but are not enabled by any -O options. This section
9587 includes experimental options that may produce broken code.
9588
9589 -fbranch-probabilities
9590 After running a program compiled with -fprofile-arcs, you can
9591 compile it a second time using -fbranch-probabilities, to improve
9592 optimizations based on the number of times each branch was taken.
9593 When a program compiled with -fprofile-arcs exits, it saves arc
9594 execution counts to a file called sourcename.gcda for each source
9595 file. The information in this data file is very dependent on the
9596 structure of the generated code, so you must use the same source
9597 code and the same optimization options for both compilations.
9598
9599 With -fbranch-probabilities, GCC puts a REG_BR_PROB note on each
9600 JUMP_INSN and CALL_INSN. These can be used to improve
9601 optimization. Currently, they are only used in one place: in
9602 reorg.c, instead of guessing which path a branch is most likely to
9603 take, the REG_BR_PROB values are used to exactly determine which
9604 path is taken more often.
9605
9606 Enabled by -fprofile-use and -fauto-profile.
9607
9608 -fprofile-values
9609 If combined with -fprofile-arcs, it adds code so that some data
9610 about values of expressions in the program is gathered.
9611
9612 With -fbranch-probabilities, it reads back the data gathered from
9613 profiling values of expressions for usage in optimizations.
9614
9615 Enabled by -fprofile-generate, -fprofile-use, and -fauto-profile.
9616
9617 -fprofile-reorder-functions
9618 Function reordering based on profile instrumentation collects first
9619 time of execution of a function and orders these functions in
9620 ascending order.
9621
9622 Enabled with -fprofile-use.
9623
9624 -fvpt
9625 If combined with -fprofile-arcs, this option instructs the compiler
9626 to add code to gather information about values of expressions.
9627
9628 With -fbranch-probabilities, it reads back the data gathered and
9629 actually performs the optimizations based on them. Currently the
9630 optimizations include specialization of division operations using
9631 the knowledge about the value of the denominator.
9632
9633 Enabled with -fprofile-use and -fauto-profile.
9634
9635 -frename-registers
9636 Attempt to avoid false dependencies in scheduled code by making use
9637 of registers left over after register allocation. This
9638 optimization most benefits processors with lots of registers.
9639 Depending on the debug information format adopted by the target,
9640 however, it can make debugging impossible, since variables no
9641 longer stay in a "home register".
9642
9643 Enabled by default with -funroll-loops.
9644
9645 -fschedule-fusion
9646 Performs a target dependent pass over the instruction stream to
9647 schedule instructions of same type together because target machine
9648 can execute them more efficiently if they are adjacent to each
9649 other in the instruction flow.
9650
9651 Enabled at levels -O2, -O3, -Os.
9652
9653 -ftracer
9654 Perform tail duplication to enlarge superblock size. This
9655 transformation simplifies the control flow of the function allowing
9656 other optimizations to do a better job.
9657
9658 Enabled by -fprofile-use and -fauto-profile.
9659
9660 -funroll-loops
9661 Unroll loops whose number of iterations can be determined at
9662 compile time or upon entry to the loop. -funroll-loops implies
9663 -frerun-cse-after-loop, -fweb and -frename-registers. It also
9664 turns on complete loop peeling (i.e. complete removal of loops with
9665 a small constant number of iterations). This option makes code
9666 larger, and may or may not make it run faster.
9667
9668 Enabled by -fprofile-use and -fauto-profile.
9669
9670 -funroll-all-loops
9671 Unroll all loops, even if their number of iterations is uncertain
9672 when the loop is entered. This usually makes programs run more
9673 slowly. -funroll-all-loops implies the same options as
9674 -funroll-loops.
9675
9676 -fpeel-loops
9677 Peels loops for which there is enough information that they do not
9678 roll much (from profile feedback or static analysis). It also
9679 turns on complete loop peeling (i.e. complete removal of loops with
9680 small constant number of iterations).
9681
9682 Enabled by -O3, -fprofile-use, and -fauto-profile.
9683
9684 -fmove-loop-invariants
9685 Enables the loop invariant motion pass in the RTL loop optimizer.
9686 Enabled at level -O1 and higher, except for -Og.
9687
9688 -fsplit-loops
9689 Split a loop into two if it contains a condition that's always true
9690 for one side of the iteration space and false for the other.
9691
9692 Enabled by -fprofile-use and -fauto-profile.
9693
9694 -funswitch-loops
9695 Move branches with loop invariant conditions out of the loop, with
9696 duplicates of the loop on both branches (modified according to
9697 result of the condition).
9698
9699 Enabled by -fprofile-use and -fauto-profile.
9700
9701 -fversion-loops-for-strides
9702 If a loop iterates over an array with a variable stride, create
9703 another version of the loop that assumes the stride is always one.
9704 For example:
9705
9706 for (int i = 0; i < n; ++i)
9707 x[i * stride] = ...;
9708
9709 becomes:
9710
9711 if (stride == 1)
9712 for (int i = 0; i < n; ++i)
9713 x[i] = ...;
9714 else
9715 for (int i = 0; i < n; ++i)
9716 x[i * stride] = ...;
9717
9718 This is particularly useful for assumed-shape arrays in Fortran
9719 where (for example) it allows better vectorization assuming
9720 contiguous accesses. This flag is enabled by default at -O3. It
9721 is also enabled by -fprofile-use and -fauto-profile.
9722
9723 -ffunction-sections
9724 -fdata-sections
9725 Place each function or data item into its own section in the output
9726 file if the target supports arbitrary sections. The name of the
9727 function or the name of the data item determines the section's name
9728 in the output file.
9729
9730 Use these options on systems where the linker can perform
9731 optimizations to improve locality of reference in the instruction
9732 space. Most systems using the ELF object format have linkers with
9733 such optimizations. On AIX, the linker rearranges sections
9734 (CSECTs) based on the call graph. The performance impact varies.
9735
9736 Together with a linker garbage collection (linker --gc-sections
9737 option) these options may lead to smaller statically-linked
9738 executables (after stripping).
9739
9740 On ELF/DWARF systems these options do not degenerate the quality of
9741 the debug information. There could be issues with other object
9742 files/debug info formats.
9743
9744 Only use these options when there are significant benefits from
9745 doing so. When you specify these options, the assembler and linker
9746 create larger object and executable files and are also slower.
9747 These options affect code generation. They prevent optimizations
9748 by the compiler and assembler using relative locations inside a
9749 translation unit since the locations are unknown until link time.
9750 An example of such an optimization is relaxing calls to short call
9751 instructions.
9752
9753 -fstdarg-opt
9754 Optimize the prologue of variadic argument functions with respect
9755 to usage of those arguments.
9756
9757 -fsection-anchors
9758 Try to reduce the number of symbolic address calculations by using
9759 shared "anchor" symbols to address nearby objects. This
9760 transformation can help to reduce the number of GOT entries and GOT
9761 accesses on some targets.
9762
9763 For example, the implementation of the following function "foo":
9764
9765 static int a, b, c;
9766 int foo (void) { return a + b + c; }
9767
9768 usually calculates the addresses of all three variables, but if you
9769 compile it with -fsection-anchors, it accesses the variables from a
9770 common anchor point instead. The effect is similar to the
9771 following pseudocode (which isn't valid C):
9772
9773 int foo (void)
9774 {
9775 register int *xr = &x;
9776 return xr[&a - &x] + xr[&b - &x] + xr[&c - &x];
9777 }
9778
9779 Not all targets support this option.
9780
9781 --param name=value
9782 In some places, GCC uses various constants to control the amount of
9783 optimization that is done. For example, GCC does not inline
9784 functions that contain more than a certain number of instructions.
9785 You can control some of these constants on the command line using
9786 the --param option.
9787
9788 The names of specific parameters, and the meaning of the values,
9789 are tied to the internals of the compiler, and are subject to
9790 change without notice in future releases.
9791
9792 In order to get minimal, maximal and default value of a parameter,
9793 one can use --help=param -Q options.
9794
9795 In each case, the value is an integer. The following choices of
9796 name are recognized for all targets:
9797
9798 predictable-branch-outcome
9799 When branch is predicted to be taken with probability lower
9800 than this threshold (in percent), then it is considered well
9801 predictable.
9802
9803 max-rtl-if-conversion-insns
9804 RTL if-conversion tries to remove conditional branches around a
9805 block and replace them with conditionally executed
9806 instructions. This parameter gives the maximum number of
9807 instructions in a block which should be considered for if-
9808 conversion. The compiler will also use other heuristics to
9809 decide whether if-conversion is likely to be profitable.
9810
9811 max-rtl-if-conversion-predictable-cost
9812 max-rtl-if-conversion-unpredictable-cost
9813 RTL if-conversion will try to remove conditional branches
9814 around a block and replace them with conditionally executed
9815 instructions. These parameters give the maximum permissible
9816 cost for the sequence that would be generated by if-conversion
9817 depending on whether the branch is statically determined to be
9818 predictable or not. The units for this parameter are the same
9819 as those for the GCC internal seq_cost metric. The compiler
9820 will try to provide a reasonable default for this parameter
9821 using the BRANCH_COST target macro.
9822
9823 max-crossjump-edges
9824 The maximum number of incoming edges to consider for cross-
9825 jumping. The algorithm used by -fcrossjumping is O(N^2) in the
9826 number of edges incoming to each block. Increasing values mean
9827 more aggressive optimization, making the compilation time
9828 increase with probably small improvement in executable size.
9829
9830 min-crossjump-insns
9831 The minimum number of instructions that must be matched at the
9832 end of two blocks before cross-jumping is performed on them.
9833 This value is ignored in the case where all instructions in the
9834 block being cross-jumped from are matched.
9835
9836 max-grow-copy-bb-insns
9837 The maximum code size expansion factor when copying basic
9838 blocks instead of jumping. The expansion is relative to a jump
9839 instruction.
9840
9841 max-goto-duplication-insns
9842 The maximum number of instructions to duplicate to a block that
9843 jumps to a computed goto. To avoid O(N^2) behavior in a number
9844 of passes, GCC factors computed gotos early in the compilation
9845 process, and unfactors them as late as possible. Only computed
9846 jumps at the end of a basic blocks with no more than max-goto-
9847 duplication-insns are unfactored.
9848
9849 max-delay-slot-insn-search
9850 The maximum number of instructions to consider when looking for
9851 an instruction to fill a delay slot. If more than this
9852 arbitrary number of instructions are searched, the time savings
9853 from filling the delay slot are minimal, so stop searching.
9854 Increasing values mean more aggressive optimization, making the
9855 compilation time increase with probably small improvement in
9856 execution time.
9857
9858 max-delay-slot-live-search
9859 When trying to fill delay slots, the maximum number of
9860 instructions to consider when searching for a block with valid
9861 live register information. Increasing this arbitrarily chosen
9862 value means more aggressive optimization, increasing the
9863 compilation time. This parameter should be removed when the
9864 delay slot code is rewritten to maintain the control-flow
9865 graph.
9866
9867 max-gcse-memory
9868 The approximate maximum amount of memory that can be allocated
9869 in order to perform the global common subexpression elimination
9870 optimization. If more memory than specified is required, the
9871 optimization is not done.
9872
9873 max-gcse-insertion-ratio
9874 If the ratio of expression insertions to deletions is larger
9875 than this value for any expression, then RTL PRE inserts or
9876 removes the expression and thus leaves partially redundant
9877 computations in the instruction stream.
9878
9879 max-pending-list-length
9880 The maximum number of pending dependencies scheduling allows
9881 before flushing the current state and starting over. Large
9882 functions with few branches or calls can create excessively
9883 large lists which needlessly consume memory and resources.
9884
9885 max-modulo-backtrack-attempts
9886 The maximum number of backtrack attempts the scheduler should
9887 make when modulo scheduling a loop. Larger values can
9888 exponentially increase compilation time.
9889
9890 max-inline-insns-single
9891 Several parameters control the tree inliner used in GCC. This
9892 number sets the maximum number of instructions (counted in
9893 GCC's internal representation) in a single function that the
9894 tree inliner considers for inlining. This only affects
9895 functions declared inline and methods implemented in a class
9896 declaration (C++).
9897
9898 max-inline-insns-auto
9899 When you use -finline-functions (included in -O3), a lot of
9900 functions that would otherwise not be considered for inlining
9901 by the compiler are investigated. To those functions, a
9902 different (more restrictive) limit compared to functions
9903 declared inline can be applied (--param max-inline-insns-auto).
9904
9905 max-inline-insns-small
9906 This is bound applied to calls which are considered relevant
9907 with -finline-small-functions.
9908
9909 max-inline-insns-size
9910 This is bound applied to calls which are optimized for size.
9911 Small growth may be desirable to anticipate optimization
9912 oppurtunities exposed by inlining.
9913
9914 uninlined-function-insns
9915 Number of instructions accounted by inliner for function
9916 overhead such as function prologue and epilogue.
9917
9918 uninlined-function-time
9919 Extra time accounted by inliner for function overhead such as
9920 time needed to execute function prologue and epilogue
9921
9922 inline-heuristics-hint-percent
9923 The scale (in percents) applied to inline-insns-single,
9924 inline-insns-single-O2, inline-insns-auto when inline
9925 heuristics hints that inlining is very profitable (will enable
9926 later optimizations).
9927
9928 uninlined-thunk-insns
9929 uninlined-thunk-time
9930 Same as --param uninlined-function-insns and --param uninlined-
9931 function-time but applied to function thunks
9932
9933 inline-min-speedup
9934 When estimated performance improvement of caller + callee
9935 runtime exceeds this threshold (in percent), the function can
9936 be inlined regardless of the limit on --param max-inline-insns-
9937 single and --param max-inline-insns-auto.
9938
9939 large-function-insns
9940 The limit specifying really large functions. For functions
9941 larger than this limit after inlining, inlining is constrained
9942 by --param large-function-growth. This parameter is useful
9943 primarily to avoid extreme compilation time caused by non-
9944 linear algorithms used by the back end.
9945
9946 large-function-growth
9947 Specifies maximal growth of large function caused by inlining
9948 in percents. For example, parameter value 100 limits large
9949 function growth to 2.0 times the original size.
9950
9951 large-unit-insns
9952 The limit specifying large translation unit. Growth caused by
9953 inlining of units larger than this limit is limited by --param
9954 inline-unit-growth. For small units this might be too tight.
9955 For example, consider a unit consisting of function A that is
9956 inline and B that just calls A three times. If B is small
9957 relative to A, the growth of unit is 300\% and yet such
9958 inlining is very sane. For very large units consisting of
9959 small inlineable functions, however, the overall unit growth
9960 limit is needed to avoid exponential explosion of code size.
9961 Thus for smaller units, the size is increased to --param large-
9962 unit-insns before applying --param inline-unit-growth.
9963
9964 inline-unit-growth
9965 Specifies maximal overall growth of the compilation unit caused
9966 by inlining. For example, parameter value 20 limits unit
9967 growth to 1.2 times the original size. Cold functions (either
9968 marked cold via an attribute or by profile feedback) are not
9969 accounted into the unit size.
9970
9971 ipa-cp-unit-growth
9972 Specifies maximal overall growth of the compilation unit caused
9973 by interprocedural constant propagation. For example,
9974 parameter value 10 limits unit growth to 1.1 times the original
9975 size.
9976
9977 large-stack-frame
9978 The limit specifying large stack frames. While inlining the
9979 algorithm is trying to not grow past this limit too much.
9980
9981 large-stack-frame-growth
9982 Specifies maximal growth of large stack frames caused by
9983 inlining in percents. For example, parameter value 1000 limits
9984 large stack frame growth to 11 times the original size.
9985
9986 max-inline-insns-recursive
9987 max-inline-insns-recursive-auto
9988 Specifies the maximum number of instructions an out-of-line
9989 copy of a self-recursive inline function can grow into by
9990 performing recursive inlining.
9991
9992 --param max-inline-insns-recursive applies to functions
9993 declared inline. For functions not declared inline, recursive
9994 inlining happens only when -finline-functions (included in -O3)
9995 is enabled; --param max-inline-insns-recursive-auto applies
9996 instead.
9997
9998 max-inline-recursive-depth
9999 max-inline-recursive-depth-auto
10000 Specifies the maximum recursion depth used for recursive
10001 inlining.
10002
10003 --param max-inline-recursive-depth applies to functions
10004 declared inline. For functions not declared inline, recursive
10005 inlining happens only when -finline-functions (included in -O3)
10006 is enabled; --param max-inline-recursive-depth-auto applies
10007 instead.
10008
10009 min-inline-recursive-probability
10010 Recursive inlining is profitable only for function having deep
10011 recursion in average and can hurt for function having little
10012 recursion depth by increasing the prologue size or complexity
10013 of function body to other optimizers.
10014
10015 When profile feedback is available (see -fprofile-generate) the
10016 actual recursion depth can be guessed from the probability that
10017 function recurses via a given call expression. This parameter
10018 limits inlining only to call expressions whose probability
10019 exceeds the given threshold (in percents).
10020
10021 early-inlining-insns
10022 Specify growth that the early inliner can make. In effect it
10023 increases the amount of inlining for code having a large
10024 abstraction penalty.
10025
10026 max-early-inliner-iterations
10027 Limit of iterations of the early inliner. This basically
10028 bounds the number of nested indirect calls the early inliner
10029 can resolve. Deeper chains are still handled by late inlining.
10030
10031 comdat-sharing-probability
10032 Probability (in percent) that C++ inline function with comdat
10033 visibility are shared across multiple compilation units.
10034
10035 profile-func-internal-id
10036 A parameter to control whether to use function internal id in
10037 profile database lookup. If the value is 0, the compiler uses
10038 an id that is based on function assembler name and filename,
10039 which makes old profile data more tolerant to source changes
10040 such as function reordering etc.
10041
10042 min-vect-loop-bound
10043 The minimum number of iterations under which loops are not
10044 vectorized when -ftree-vectorize is used. The number of
10045 iterations after vectorization needs to be greater than the
10046 value specified by this option to allow vectorization.
10047
10048 gcse-cost-distance-ratio
10049 Scaling factor in calculation of maximum distance an expression
10050 can be moved by GCSE optimizations. This is currently
10051 supported only in the code hoisting pass. The bigger the
10052 ratio, the more aggressive code hoisting is with simple
10053 expressions, i.e., the expressions that have cost less than
10054 gcse-unrestricted-cost. Specifying 0 disables hoisting of
10055 simple expressions.
10056
10057 gcse-unrestricted-cost
10058 Cost, roughly measured as the cost of a single typical machine
10059 instruction, at which GCSE optimizations do not constrain the
10060 distance an expression can travel. This is currently supported
10061 only in the code hoisting pass. The lesser the cost, the more
10062 aggressive code hoisting is. Specifying 0 allows all
10063 expressions to travel unrestricted distances.
10064
10065 max-hoist-depth
10066 The depth of search in the dominator tree for expressions to
10067 hoist. This is used to avoid quadratic behavior in hoisting
10068 algorithm. The value of 0 does not limit on the search, but
10069 may slow down compilation of huge functions.
10070
10071 max-tail-merge-comparisons
10072 The maximum amount of similar bbs to compare a bb with. This
10073 is used to avoid quadratic behavior in tree tail merging.
10074
10075 max-tail-merge-iterations
10076 The maximum amount of iterations of the pass over the function.
10077 This is used to limit compilation time in tree tail merging.
10078
10079 store-merging-allow-unaligned
10080 Allow the store merging pass to introduce unaligned stores if
10081 it is legal to do so.
10082
10083 max-stores-to-merge
10084 The maximum number of stores to attempt to merge into wider
10085 stores in the store merging pass.
10086
10087 max-unrolled-insns
10088 The maximum number of instructions that a loop may have to be
10089 unrolled. If a loop is unrolled, this parameter also
10090 determines how many times the loop code is unrolled.
10091
10092 max-average-unrolled-insns
10093 The maximum number of instructions biased by probabilities of
10094 their execution that a loop may have to be unrolled. If a loop
10095 is unrolled, this parameter also determines how many times the
10096 loop code is unrolled.
10097
10098 max-unroll-times
10099 The maximum number of unrollings of a single loop.
10100
10101 max-peeled-insns
10102 The maximum number of instructions that a loop may have to be
10103 peeled. If a loop is peeled, this parameter also determines
10104 how many times the loop code is peeled.
10105
10106 max-peel-times
10107 The maximum number of peelings of a single loop.
10108
10109 max-peel-branches
10110 The maximum number of branches on the hot path through the
10111 peeled sequence.
10112
10113 max-completely-peeled-insns
10114 The maximum number of insns of a completely peeled loop.
10115
10116 max-completely-peel-times
10117 The maximum number of iterations of a loop to be suitable for
10118 complete peeling.
10119
10120 max-completely-peel-loop-nest-depth
10121 The maximum depth of a loop nest suitable for complete peeling.
10122
10123 max-unswitch-insns
10124 The maximum number of insns of an unswitched loop.
10125
10126 max-unswitch-level
10127 The maximum number of branches unswitched in a single loop.
10128
10129 lim-expensive
10130 The minimum cost of an expensive expression in the loop
10131 invariant motion.
10132
10133 min-loop-cond-split-prob
10134 When FDO profile information is available, min-loop-cond-split-
10135 prob specifies minimum threshold for probability of semi-
10136 invariant condition statement to trigger loop split.
10137
10138 iv-consider-all-candidates-bound
10139 Bound on number of candidates for induction variables, below
10140 which all candidates are considered for each use in induction
10141 variable optimizations. If there are more candidates than
10142 this, only the most relevant ones are considered to avoid
10143 quadratic time complexity.
10144
10145 iv-max-considered-uses
10146 The induction variable optimizations give up on loops that
10147 contain more induction variable uses.
10148
10149 iv-always-prune-cand-set-bound
10150 If the number of candidates in the set is smaller than this
10151 value, always try to remove unnecessary ivs from the set when
10152 adding a new one.
10153
10154 avg-loop-niter
10155 Average number of iterations of a loop.
10156
10157 dse-max-object-size
10158 Maximum size (in bytes) of objects tracked bytewise by dead
10159 store elimination. Larger values may result in larger
10160 compilation times.
10161
10162 dse-max-alias-queries-per-store
10163 Maximum number of queries into the alias oracle per store.
10164 Larger values result in larger compilation times and may result
10165 in more removed dead stores.
10166
10167 scev-max-expr-size
10168 Bound on size of expressions used in the scalar evolutions
10169 analyzer. Large expressions slow the analyzer.
10170
10171 scev-max-expr-complexity
10172 Bound on the complexity of the expressions in the scalar
10173 evolutions analyzer. Complex expressions slow the analyzer.
10174
10175 max-tree-if-conversion-phi-args
10176 Maximum number of arguments in a PHI supported by TREE if
10177 conversion unless the loop is marked with simd pragma.
10178
10179 vect-max-version-for-alignment-checks
10180 The maximum number of run-time checks that can be performed
10181 when doing loop versioning for alignment in the vectorizer.
10182
10183 vect-max-version-for-alias-checks
10184 The maximum number of run-time checks that can be performed
10185 when doing loop versioning for alias in the vectorizer.
10186
10187 vect-max-peeling-for-alignment
10188 The maximum number of loop peels to enhance access alignment
10189 for vectorizer. Value -1 means no limit.
10190
10191 max-iterations-to-track
10192 The maximum number of iterations of a loop the brute-force
10193 algorithm for analysis of the number of iterations of the loop
10194 tries to evaluate.
10195
10196 hot-bb-count-fraction
10197 The denominator n of fraction 1/n of the maximal execution
10198 count of a basic block in the entire program that a basic block
10199 needs to at least have in order to be considered hot. The
10200 default is 10000, which means that a basic block is considered
10201 hot if its execution count is greater than 1/10000 of the
10202 maximal execution count. 0 means that it is never considered
10203 hot. Used in non-LTO mode.
10204
10205 hot-bb-count-ws-permille
10206 The number of most executed permilles, ranging from 0 to 1000,
10207 of the profiled execution of the entire program to which the
10208 execution count of a basic block must be part of in order to be
10209 considered hot. The default is 990, which means that a basic
10210 block is considered hot if its execution count contributes to
10211 the upper 990 permilles, or 99.0%, of the profiled execution of
10212 the entire program. 0 means that it is never considered hot.
10213 Used in LTO mode.
10214
10215 hot-bb-frequency-fraction
10216 The denominator n of fraction 1/n of the execution frequency of
10217 the entry block of a function that a basic block of this
10218 function needs to at least have in order to be considered hot.
10219 The default is 1000, which means that a basic block is
10220 considered hot in a function if it is executed more frequently
10221 than 1/1000 of the frequency of the entry block of the
10222 function. 0 means that it is never considered hot.
10223
10224 unlikely-bb-count-fraction
10225 The denominator n of fraction 1/n of the number of profiled
10226 runs of the entire program below which the execution count of a
10227 basic block must be in order for the basic block to be
10228 considered unlikely executed. The default is 20, which means
10229 that a basic block is considered unlikely executed if it is
10230 executed in fewer than 1/20, or 5%, of the runs of the program.
10231 0 means that it is always considered unlikely executed.
10232
10233 max-predicted-iterations
10234 The maximum number of loop iterations we predict statically.
10235 This is useful in cases where a function contains a single loop
10236 with known bound and another loop with unknown bound. The
10237 known number of iterations is predicted correctly, while the
10238 unknown number of iterations average to roughly 10. This means
10239 that the loop without bounds appears artificially cold relative
10240 to the other one.
10241
10242 builtin-expect-probability
10243 Control the probability of the expression having the specified
10244 value. This parameter takes a percentage (i.e. 0 ... 100) as
10245 input.
10246
10247 builtin-string-cmp-inline-length
10248 The maximum length of a constant string for a builtin string
10249 cmp call eligible for inlining.
10250
10251 align-threshold
10252 Select fraction of the maximal frequency of executions of a
10253 basic block in a function to align the basic block.
10254
10255 align-loop-iterations
10256 A loop expected to iterate at least the selected number of
10257 iterations is aligned.
10258
10259 tracer-dynamic-coverage
10260 tracer-dynamic-coverage-feedback
10261 This value is used to limit superblock formation once the given
10262 percentage of executed instructions is covered. This limits
10263 unnecessary code size expansion.
10264
10265 The tracer-dynamic-coverage-feedback parameter is used only
10266 when profile feedback is available. The real profiles (as
10267 opposed to statically estimated ones) are much less balanced
10268 allowing the threshold to be larger value.
10269
10270 tracer-max-code-growth
10271 Stop tail duplication once code growth has reached given
10272 percentage. This is a rather artificial limit, as most of the
10273 duplicates are eliminated later in cross jumping, so it may be
10274 set to much higher values than is the desired code growth.
10275
10276 tracer-min-branch-ratio
10277 Stop reverse growth when the reverse probability of best edge
10278 is less than this threshold (in percent).
10279
10280 tracer-min-branch-probability
10281 tracer-min-branch-probability-feedback
10282 Stop forward growth if the best edge has probability lower than
10283 this threshold.
10284
10285 Similarly to tracer-dynamic-coverage two parameters are
10286 provided. tracer-min-branch-probability-feedback is used for
10287 compilation with profile feedback and tracer-min-branch-
10288 probability compilation without. The value for compilation
10289 with profile feedback needs to be more conservative (higher) in
10290 order to make tracer effective.
10291
10292 stack-clash-protection-guard-size
10293 Specify the size of the operating system provided stack guard
10294 as 2 raised to num bytes. Higher values may reduce the number
10295 of explicit probes, but a value larger than the operating
10296 system provided guard will leave code vulnerable to stack clash
10297 style attacks.
10298
10299 stack-clash-protection-probe-interval
10300 Stack clash protection involves probing stack space as it is
10301 allocated. This param controls the maximum distance between
10302 probes into the stack as 2 raised to num bytes. Higher values
10303 may reduce the number of explicit probes, but a value larger
10304 than the operating system provided guard will leave code
10305 vulnerable to stack clash style attacks.
10306
10307 max-cse-path-length
10308 The maximum number of basic blocks on path that CSE considers.
10309
10310 max-cse-insns
10311 The maximum number of instructions CSE processes before
10312 flushing.
10313
10314 ggc-min-expand
10315 GCC uses a garbage collector to manage its own memory
10316 allocation. This parameter specifies the minimum percentage by
10317 which the garbage collector's heap should be allowed to expand
10318 between collections. Tuning this may improve compilation
10319 speed; it has no effect on code generation.
10320
10321 The default is 30% + 70% * (RAM/1GB) with an upper bound of
10322 100% when RAM >= 1GB. If "getrlimit" is available, the notion
10323 of "RAM" is the smallest of actual RAM and "RLIMIT_DATA" or
10324 "RLIMIT_AS". If GCC is not able to calculate RAM on a
10325 particular platform, the lower bound of 30% is used. Setting
10326 this parameter and ggc-min-heapsize to zero causes a full
10327 collection to occur at every opportunity. This is extremely
10328 slow, but can be useful for debugging.
10329
10330 ggc-min-heapsize
10331 Minimum size of the garbage collector's heap before it begins
10332 bothering to collect garbage. The first collection occurs
10333 after the heap expands by ggc-min-expand% beyond ggc-min-
10334 heapsize. Again, tuning this may improve compilation speed,
10335 and has no effect on code generation.
10336
10337 The default is the smaller of RAM/8, RLIMIT_RSS, or a limit
10338 that tries to ensure that RLIMIT_DATA or RLIMIT_AS are not
10339 exceeded, but with a lower bound of 4096 (four megabytes) and
10340 an upper bound of 131072 (128 megabytes). If GCC is not able
10341 to calculate RAM on a particular platform, the lower bound is
10342 used. Setting this parameter very large effectively disables
10343 garbage collection. Setting this parameter and ggc-min-expand
10344 to zero causes a full collection to occur at every opportunity.
10345
10346 max-reload-search-insns
10347 The maximum number of instruction reload should look backward
10348 for equivalent register. Increasing values mean more
10349 aggressive optimization, making the compilation time increase
10350 with probably slightly better performance.
10351
10352 max-cselib-memory-locations
10353 The maximum number of memory locations cselib should take into
10354 account. Increasing values mean more aggressive optimization,
10355 making the compilation time increase with probably slightly
10356 better performance.
10357
10358 max-sched-ready-insns
10359 The maximum number of instructions ready to be issued the
10360 scheduler should consider at any given time during the first
10361 scheduling pass. Increasing values mean more thorough
10362 searches, making the compilation time increase with probably
10363 little benefit.
10364
10365 max-sched-region-blocks
10366 The maximum number of blocks in a region to be considered for
10367 interblock scheduling.
10368
10369 max-pipeline-region-blocks
10370 The maximum number of blocks in a region to be considered for
10371 pipelining in the selective scheduler.
10372
10373 max-sched-region-insns
10374 The maximum number of insns in a region to be considered for
10375 interblock scheduling.
10376
10377 max-pipeline-region-insns
10378 The maximum number of insns in a region to be considered for
10379 pipelining in the selective scheduler.
10380
10381 min-spec-prob
10382 The minimum probability (in percents) of reaching a source
10383 block for interblock speculative scheduling.
10384
10385 max-sched-extend-regions-iters
10386 The maximum number of iterations through CFG to extend regions.
10387 A value of 0 disables region extensions.
10388
10389 max-sched-insn-conflict-delay
10390 The maximum conflict delay for an insn to be considered for
10391 speculative motion.
10392
10393 sched-spec-prob-cutoff
10394 The minimal probability of speculation success (in percents),
10395 so that speculative insns are scheduled.
10396
10397 sched-state-edge-prob-cutoff
10398 The minimum probability an edge must have for the scheduler to
10399 save its state across it.
10400
10401 sched-mem-true-dep-cost
10402 Minimal distance (in CPU cycles) between store and load
10403 targeting same memory locations.
10404
10405 selsched-max-lookahead
10406 The maximum size of the lookahead window of selective
10407 scheduling. It is a depth of search for available
10408 instructions.
10409
10410 selsched-max-sched-times
10411 The maximum number of times that an instruction is scheduled
10412 during selective scheduling. This is the limit on the number
10413 of iterations through which the instruction may be pipelined.
10414
10415 selsched-insns-to-rename
10416 The maximum number of best instructions in the ready list that
10417 are considered for renaming in the selective scheduler.
10418
10419 sms-min-sc
10420 The minimum value of stage count that swing modulo scheduler
10421 generates.
10422
10423 max-last-value-rtl
10424 The maximum size measured as number of RTLs that can be
10425 recorded in an expression in combiner for a pseudo register as
10426 last known value of that register.
10427
10428 max-combine-insns
10429 The maximum number of instructions the RTL combiner tries to
10430 combine.
10431
10432 integer-share-limit
10433 Small integer constants can use a shared data structure,
10434 reducing the compiler's memory usage and increasing its speed.
10435 This sets the maximum value of a shared integer constant.
10436
10437 ssp-buffer-size
10438 The minimum size of buffers (i.e. arrays) that receive stack
10439 smashing protection when -fstack-protection is used.
10440
10441 min-size-for-stack-sharing
10442 The minimum size of variables taking part in stack slot sharing
10443 when not optimizing.
10444
10445 max-jump-thread-duplication-stmts
10446 Maximum number of statements allowed in a block that needs to
10447 be duplicated when threading jumps.
10448
10449 max-fields-for-field-sensitive
10450 Maximum number of fields in a structure treated in a field
10451 sensitive manner during pointer analysis.
10452
10453 prefetch-latency
10454 Estimate on average number of instructions that are executed
10455 before prefetch finishes. The distance prefetched ahead is
10456 proportional to this constant. Increasing this number may also
10457 lead to less streams being prefetched (see simultaneous-
10458 prefetches).
10459
10460 simultaneous-prefetches
10461 Maximum number of prefetches that can run at the same time.
10462
10463 l1-cache-line-size
10464 The size of cache line in L1 data cache, in bytes.
10465
10466 l1-cache-size
10467 The size of L1 data cache, in kilobytes.
10468
10469 l2-cache-size
10470 The size of L2 data cache, in kilobytes.
10471
10472 prefetch-dynamic-strides
10473 Whether the loop array prefetch pass should issue software
10474 prefetch hints for strides that are non-constant. In some
10475 cases this may be beneficial, though the fact the stride is
10476 non-constant may make it hard to predict when there is clear
10477 benefit to issuing these hints.
10478
10479 Set to 1 if the prefetch hints should be issued for non-
10480 constant strides. Set to 0 if prefetch hints should be issued
10481 only for strides that are known to be constant and below
10482 prefetch-minimum-stride.
10483
10484 prefetch-minimum-stride
10485 Minimum constant stride, in bytes, to start using prefetch
10486 hints for. If the stride is less than this threshold, prefetch
10487 hints will not be issued.
10488
10489 This setting is useful for processors that have hardware
10490 prefetchers, in which case there may be conflicts between the
10491 hardware prefetchers and the software prefetchers. If the
10492 hardware prefetchers have a maximum stride they can handle, it
10493 should be used here to improve the use of software prefetchers.
10494
10495 A value of -1 means we don't have a threshold and therefore
10496 prefetch hints can be issued for any constant stride.
10497
10498 This setting is only useful for strides that are known and
10499 constant.
10500
10501 loop-interchange-max-num-stmts
10502 The maximum number of stmts in a loop to be interchanged.
10503
10504 loop-interchange-stride-ratio
10505 The minimum ratio between stride of two loops for interchange
10506 to be profitable.
10507
10508 min-insn-to-prefetch-ratio
10509 The minimum ratio between the number of instructions and the
10510 number of prefetches to enable prefetching in a loop.
10511
10512 prefetch-min-insn-to-mem-ratio
10513 The minimum ratio between the number of instructions and the
10514 number of memory references to enable prefetching in a loop.
10515
10516 use-canonical-types
10517 Whether the compiler should use the "canonical" type system.
10518 Should always be 1, which uses a more efficient internal
10519 mechanism for comparing types in C++ and Objective-C++.
10520 However, if bugs in the canonical type system are causing
10521 compilation failures, set this value to 0 to disable canonical
10522 types.
10523
10524 switch-conversion-max-branch-ratio
10525 Switch initialization conversion refuses to create arrays that
10526 are bigger than switch-conversion-max-branch-ratio times the
10527 number of branches in the switch.
10528
10529 max-partial-antic-length
10530 Maximum length of the partial antic set computed during the
10531 tree partial redundancy elimination optimization (-ftree-pre)
10532 when optimizing at -O3 and above. For some sorts of source
10533 code the enhanced partial redundancy elimination optimization
10534 can run away, consuming all of the memory available on the host
10535 machine. This parameter sets a limit on the length of the sets
10536 that are computed, which prevents the runaway behavior.
10537 Setting a value of 0 for this parameter allows an unlimited set
10538 length.
10539
10540 rpo-vn-max-loop-depth
10541 Maximum loop depth that is value-numbered optimistically. When
10542 the limit hits the innermost rpo-vn-max-loop-depth loops and
10543 the outermost loop in the loop nest are value-numbered
10544 optimistically and the remaining ones not.
10545
10546 sccvn-max-alias-queries-per-access
10547 Maximum number of alias-oracle queries we perform when looking
10548 for redundancies for loads and stores. If this limit is hit
10549 the search is aborted and the load or store is not considered
10550 redundant. The number of queries is algorithmically limited to
10551 the number of stores on all paths from the load to the function
10552 entry.
10553
10554 ira-max-loops-num
10555 IRA uses regional register allocation by default. If a
10556 function contains more loops than the number given by this
10557 parameter, only at most the given number of the most
10558 frequently-executed loops form regions for regional register
10559 allocation.
10560
10561 ira-max-conflict-table-size
10562 Although IRA uses a sophisticated algorithm to compress the
10563 conflict table, the table can still require excessive amounts
10564 of memory for huge functions. If the conflict table for a
10565 function could be more than the size in MB given by this
10566 parameter, the register allocator instead uses a faster,
10567 simpler, and lower-quality algorithm that does not require
10568 building a pseudo-register conflict table.
10569
10570 ira-loop-reserved-regs
10571 IRA can be used to evaluate more accurate register pressure in
10572 loops for decisions to move loop invariants (see -O3). The
10573 number of available registers reserved for some other purposes
10574 is given by this parameter. Default of the parameter is the
10575 best found from numerous experiments.
10576
10577 lra-inheritance-ebb-probability-cutoff
10578 LRA tries to reuse values reloaded in registers in subsequent
10579 insns. This optimization is called inheritance. EBB is used
10580 as a region to do this optimization. The parameter defines a
10581 minimal fall-through edge probability in percentage used to add
10582 BB to inheritance EBB in LRA. The default value was chosen
10583 from numerous runs of SPEC2000 on x86-64.
10584
10585 loop-invariant-max-bbs-in-loop
10586 Loop invariant motion can be very expensive, both in
10587 compilation time and in amount of needed compile-time memory,
10588 with very large loops. Loops with more basic blocks than this
10589 parameter won't have loop invariant motion optimization
10590 performed on them.
10591
10592 loop-max-datarefs-for-datadeps
10593 Building data dependencies is expensive for very large loops.
10594 This parameter limits the number of data references in loops
10595 that are considered for data dependence analysis. These large
10596 loops are no handled by the optimizations using loop data
10597 dependencies.
10598
10599 max-vartrack-size
10600 Sets a maximum number of hash table slots to use during
10601 variable tracking dataflow analysis of any function. If this
10602 limit is exceeded with variable tracking at assignments
10603 enabled, analysis for that function is retried without it,
10604 after removing all debug insns from the function. If the limit
10605 is exceeded even without debug insns, var tracking analysis is
10606 completely disabled for the function. Setting the parameter to
10607 zero makes it unlimited.
10608
10609 max-vartrack-expr-depth
10610 Sets a maximum number of recursion levels when attempting to
10611 map variable names or debug temporaries to value expressions.
10612 This trades compilation time for more complete debug
10613 information. If this is set too low, value expressions that
10614 are available and could be represented in debug information may
10615 end up not being used; setting this higher may enable the
10616 compiler to find more complex debug expressions, but compile
10617 time and memory use may grow.
10618
10619 max-debug-marker-count
10620 Sets a threshold on the number of debug markers (e.g. begin
10621 stmt markers) to avoid complexity explosion at inlining or
10622 expanding to RTL. If a function has more such gimple stmts
10623 than the set limit, such stmts will be dropped from the inlined
10624 copy of a function, and from its RTL expansion.
10625
10626 min-nondebug-insn-uid
10627 Use uids starting at this parameter for nondebug insns. The
10628 range below the parameter is reserved exclusively for debug
10629 insns created by -fvar-tracking-assignments, but debug insns
10630 may get (non-overlapping) uids above it if the reserved range
10631 is exhausted.
10632
10633 ipa-sra-ptr-growth-factor
10634 IPA-SRA replaces a pointer to an aggregate with one or more new
10635 parameters only when their cumulative size is less or equal to
10636 ipa-sra-ptr-growth-factor times the size of the original
10637 pointer parameter.
10638
10639 ipa-sra-max-replacements
10640 Maximum pieces of an aggregate that IPA-SRA tracks. As a
10641 consequence, it is also the maximum number of replacements of a
10642 formal parameter.
10643
10644 sra-max-scalarization-size-Ospeed
10645 sra-max-scalarization-size-Osize
10646 The two Scalar Reduction of Aggregates passes (SRA and IPA-SRA)
10647 aim to replace scalar parts of aggregates with uses of
10648 independent scalar variables. These parameters control the
10649 maximum size, in storage units, of aggregate which is
10650 considered for replacement when compiling for speed (sra-max-
10651 scalarization-size-Ospeed) or size (sra-max-scalarization-size-
10652 Osize) respectively.
10653
10654 sra-max-propagations
10655 The maximum number of artificial accesses that Scalar
10656 Replacement of Aggregates (SRA) will track, per one local
10657 variable, in order to facilitate copy propagation.
10658
10659 tm-max-aggregate-size
10660 When making copies of thread-local variables in a transaction,
10661 this parameter specifies the size in bytes after which
10662 variables are saved with the logging functions as opposed to
10663 save/restore code sequence pairs. This option only applies
10664 when using -fgnu-tm.
10665
10666 graphite-max-nb-scop-params
10667 To avoid exponential effects in the Graphite loop transforms,
10668 the number of parameters in a Static Control Part (SCoP) is
10669 bounded. A value of zero can be used to lift the bound. A
10670 variable whose value is unknown at compilation time and defined
10671 outside a SCoP is a parameter of the SCoP.
10672
10673 loop-block-tile-size
10674 Loop blocking or strip mining transforms, enabled with
10675 -floop-block or -floop-strip-mine, strip mine each loop in the
10676 loop nest by a given number of iterations. The strip length
10677 can be changed using the loop-block-tile-size parameter.
10678
10679 ipa-cp-value-list-size
10680 IPA-CP attempts to track all possible values and types passed
10681 to a function's parameter in order to propagate them and
10682 perform devirtualization. ipa-cp-value-list-size is the
10683 maximum number of values and types it stores per one formal
10684 parameter of a function.
10685
10686 ipa-cp-eval-threshold
10687 IPA-CP calculates its own score of cloning profitability
10688 heuristics and performs those cloning opportunities with scores
10689 that exceed ipa-cp-eval-threshold.
10690
10691 ipa-cp-max-recursive-depth
10692 Maximum depth of recursive cloning for self-recursive function.
10693
10694 ipa-cp-min-recursive-probability
10695 Recursive cloning only when the probability of call being
10696 executed exceeds the parameter.
10697
10698 ipa-cp-recursion-penalty
10699 Percentage penalty the recursive functions will receive when
10700 they are evaluated for cloning.
10701
10702 ipa-cp-single-call-penalty
10703 Percentage penalty functions containing a single call to
10704 another function will receive when they are evaluated for
10705 cloning.
10706
10707 ipa-max-agg-items
10708 IPA-CP is also capable to propagate a number of scalar values
10709 passed in an aggregate. ipa-max-agg-items controls the maximum
10710 number of such values per one parameter.
10711
10712 ipa-cp-loop-hint-bonus
10713 When IPA-CP determines that a cloning candidate would make the
10714 number of iterations of a loop known, it adds a bonus of ipa-
10715 cp-loop-hint-bonus to the profitability score of the candidate.
10716
10717 ipa-max-aa-steps
10718 During its analysis of function bodies, IPA-CP employs alias
10719 analysis in order to track values pointed to by function
10720 parameters. In order not spend too much time analyzing huge
10721 functions, it gives up and consider all memory clobbered after
10722 examining ipa-max-aa-steps statements modifying memory.
10723
10724 ipa-max-switch-predicate-bounds
10725 Maximal number of boundary endpoints of case ranges of switch
10726 statement. For switch exceeding this limit, IPA-CP will not
10727 construct cloning cost predicate, which is used to estimate
10728 cloning benefit, for default case of the switch statement.
10729
10730 ipa-max-param-expr-ops
10731 IPA-CP will analyze conditional statement that references some
10732 function parameter to estimate benefit for cloning upon certain
10733 constant value. But if number of operations in a parameter
10734 expression exceeds ipa-max-param-expr-ops, the expression is
10735 treated as complicated one, and is not handled by IPA analysis.
10736
10737 lto-partitions
10738 Specify desired number of partitions produced during WHOPR
10739 compilation. The number of partitions should exceed the number
10740 of CPUs used for compilation.
10741
10742 lto-min-partition
10743 Size of minimal partition for WHOPR (in estimated
10744 instructions). This prevents expenses of splitting very small
10745 programs into too many partitions.
10746
10747 lto-max-partition
10748 Size of max partition for WHOPR (in estimated instructions).
10749 to provide an upper bound for individual size of partition.
10750 Meant to be used only with balanced partitioning.
10751
10752 lto-max-streaming-parallelism
10753 Maximal number of parallel processes used for LTO streaming.
10754
10755 cxx-max-namespaces-for-diagnostic-help
10756 The maximum number of namespaces to consult for suggestions
10757 when C++ name lookup fails for an identifier.
10758
10759 sink-frequency-threshold
10760 The maximum relative execution frequency (in percents) of the
10761 target block relative to a statement's original block to allow
10762 statement sinking of a statement. Larger numbers result in
10763 more aggressive statement sinking. A small positive adjustment
10764 is applied for statements with memory operands as those are
10765 even more profitable so sink.
10766
10767 max-stores-to-sink
10768 The maximum number of conditional store pairs that can be sunk.
10769 Set to 0 if either vectorization (-ftree-vectorize) or if-
10770 conversion (-ftree-loop-if-convert) is disabled.
10771
10772 case-values-threshold
10773 The smallest number of different values for which it is best to
10774 use a jump-table instead of a tree of conditional branches. If
10775 the value is 0, use the default for the machine.
10776
10777 jump-table-max-growth-ratio-for-size
10778 The maximum code size growth ratio when expanding into a jump
10779 table (in percent). The parameter is used when optimizing for
10780 size.
10781
10782 jump-table-max-growth-ratio-for-speed
10783 The maximum code size growth ratio when expanding into a jump
10784 table (in percent). The parameter is used when optimizing for
10785 speed.
10786
10787 tree-reassoc-width
10788 Set the maximum number of instructions executed in parallel in
10789 reassociated tree. This parameter overrides target dependent
10790 heuristics used by default if has non zero value.
10791
10792 sched-pressure-algorithm
10793 Choose between the two available implementations of
10794 -fsched-pressure. Algorithm 1 is the original implementation
10795 and is the more likely to prevent instructions from being
10796 reordered. Algorithm 2 was designed to be a compromise between
10797 the relatively conservative approach taken by algorithm 1 and
10798 the rather aggressive approach taken by the default scheduler.
10799 It relies more heavily on having a regular register file and
10800 accurate register pressure classes. See haifa-sched.c in the
10801 GCC sources for more details.
10802
10803 The default choice depends on the target.
10804
10805 max-slsr-cand-scan
10806 Set the maximum number of existing candidates that are
10807 considered when seeking a basis for a new straight-line
10808 strength reduction candidate.
10809
10810 asan-globals
10811 Enable buffer overflow detection for global objects. This kind
10812 of protection is enabled by default if you are using
10813 -fsanitize=address option. To disable global objects
10814 protection use --param asan-globals=0.
10815
10816 asan-stack
10817 Enable buffer overflow detection for stack objects. This kind
10818 of protection is enabled by default when using
10819 -fsanitize=address. To disable stack protection use --param
10820 asan-stack=0 option.
10821
10822 asan-instrument-reads
10823 Enable buffer overflow detection for memory reads. This kind
10824 of protection is enabled by default when using
10825 -fsanitize=address. To disable memory reads protection use
10826 --param asan-instrument-reads=0.
10827
10828 asan-instrument-writes
10829 Enable buffer overflow detection for memory writes. This kind
10830 of protection is enabled by default when using
10831 -fsanitize=address. To disable memory writes protection use
10832 --param asan-instrument-writes=0 option.
10833
10834 asan-memintrin
10835 Enable detection for built-in functions. This kind of
10836 protection is enabled by default when using -fsanitize=address.
10837 To disable built-in functions protection use --param
10838 asan-memintrin=0.
10839
10840 asan-use-after-return
10841 Enable detection of use-after-return. This kind of protection
10842 is enabled by default when using the -fsanitize=address option.
10843 To disable it use --param asan-use-after-return=0.
10844
10845 Note: By default the check is disabled at run time. To enable
10846 it, add "detect_stack_use_after_return=1" to the environment
10847 variable ASAN_OPTIONS.
10848
10849 asan-instrumentation-with-call-threshold
10850 If number of memory accesses in function being instrumented is
10851 greater or equal to this number, use callbacks instead of
10852 inline checks. E.g. to disable inline code use --param
10853 asan-instrumentation-with-call-threshold=0.
10854
10855 use-after-scope-direct-emission-threshold
10856 If the size of a local variable in bytes is smaller or equal to
10857 this number, directly poison (or unpoison) shadow memory
10858 instead of using run-time callbacks.
10859
10860 max-fsm-thread-path-insns
10861 Maximum number of instructions to copy when duplicating blocks
10862 on a finite state automaton jump thread path.
10863
10864 max-fsm-thread-length
10865 Maximum number of basic blocks on a finite state automaton jump
10866 thread path.
10867
10868 max-fsm-thread-paths
10869 Maximum number of new jump thread paths to create for a finite
10870 state automaton.
10871
10872 parloops-chunk-size
10873 Chunk size of omp schedule for loops parallelized by parloops.
10874
10875 parloops-schedule
10876 Schedule type of omp schedule for loops parallelized by
10877 parloops (static, dynamic, guided, auto, runtime).
10878
10879 parloops-min-per-thread
10880 The minimum number of iterations per thread of an innermost
10881 parallelized loop for which the parallelized variant is
10882 preferred over the single threaded one. Note that for a
10883 parallelized loop nest the minimum number of iterations of the
10884 outermost loop per thread is two.
10885
10886 max-ssa-name-query-depth
10887 Maximum depth of recursion when querying properties of SSA
10888 names in things like fold routines. One level of recursion
10889 corresponds to following a use-def chain.
10890
10891 hsa-gen-debug-stores
10892 Enable emission of special debug stores within HSA kernels
10893 which are then read and reported by libgomp plugin. Generation
10894 of these stores is disabled by default, use --param
10895 hsa-gen-debug-stores=1 to enable it.
10896
10897 max-speculative-devirt-maydefs
10898 The maximum number of may-defs we analyze when looking for a
10899 must-def specifying the dynamic type of an object that invokes
10900 a virtual call we may be able to devirtualize speculatively.
10901
10902 max-vrp-switch-assertions
10903 The maximum number of assertions to add along the default edge
10904 of a switch statement during VRP.
10905
10906 unroll-jam-min-percent
10907 The minimum percentage of memory references that must be
10908 optimized away for the unroll-and-jam transformation to be
10909 considered profitable.
10910
10911 unroll-jam-max-unroll
10912 The maximum number of times the outer loop should be unrolled
10913 by the unroll-and-jam transformation.
10914
10915 max-rtl-if-conversion-unpredictable-cost
10916 Maximum permissible cost for the sequence that would be
10917 generated by the RTL if-conversion pass for a branch that is
10918 considered unpredictable.
10919
10920 max-variable-expansions-in-unroller
10921 If -fvariable-expansion-in-unroller is used, the maximum number
10922 of times that an individual variable will be expanded during
10923 loop unrolling.
10924
10925 tracer-min-branch-probability-feedback
10926 Stop forward growth if the probability of best edge is less
10927 than this threshold (in percent). Used when profile feedback is
10928 available.
10929
10930 partial-inlining-entry-probability
10931 Maximum probability of the entry BB of split region (in percent
10932 relative to entry BB of the function) to make partial inlining
10933 happen.
10934
10935 max-tracked-strlens
10936 Maximum number of strings for which strlen optimization pass
10937 will track string lengths.
10938
10939 gcse-after-reload-partial-fraction
10940 The threshold ratio for performing partial redundancy
10941 elimination after reload.
10942
10943 gcse-after-reload-critical-fraction
10944 The threshold ratio of critical edges execution count that
10945 permit performing redundancy elimination after reload.
10946
10947 max-loop-header-insns
10948 The maximum number of insns in loop header duplicated by the
10949 copy loop headers pass.
10950
10951 vect-epilogues-nomask
10952 Enable loop epilogue vectorization using smaller vector size.
10953
10954 slp-max-insns-in-bb
10955 Maximum number of instructions in basic block to be considered
10956 for SLP vectorization.
10957
10958 avoid-fma-max-bits
10959 Maximum number of bits for which we avoid creating FMAs.
10960
10961 sms-loop-average-count-threshold
10962 A threshold on the average loop count considered by the swing
10963 modulo scheduler.
10964
10965 sms-dfa-history
10966 The number of cycles the swing modulo scheduler considers when
10967 checking conflicts using DFA.
10968
10969 max-inline-insns-recursive-auto
10970 The maximum number of instructions non-inline function can grow
10971 to via recursive inlining.
10972
10973 graphite-allow-codegen-errors
10974 Whether codegen errors should be ICEs when -fchecking.
10975
10976 sms-max-ii-factor
10977 A factor for tuning the upper bound that swing modulo scheduler
10978 uses for scheduling a loop.
10979
10980 lra-max-considered-reload-pseudos
10981 The max number of reload pseudos which are considered during
10982 spilling a non-reload pseudo.
10983
10984 max-pow-sqrt-depth
10985 Maximum depth of sqrt chains to use when synthesizing
10986 exponentiation by a real constant.
10987
10988 max-dse-active-local-stores
10989 Maximum number of active local stores in RTL dead store
10990 elimination.
10991
10992 asan-instrument-allocas
10993 Enable asan allocas/VLAs protection.
10994
10995 max-iterations-computation-cost
10996 Bound on the cost of an expression to compute the number of
10997 iterations.
10998
10999 max-isl-operations
11000 Maximum number of isl operations, 0 means unlimited.
11001
11002 graphite-max-arrays-per-scop
11003 Maximum number of arrays per scop.
11004
11005 max-vartrack-reverse-op-size
11006 Max. size of loc list for which reverse ops should be added.
11007
11008 tracer-dynamic-coverage-feedback
11009 The percentage of function, weighted by execution frequency,
11010 that must be covered by trace formation. Used when profile
11011 feedback is available.
11012
11013 max-inline-recursive-depth-auto
11014 The maximum depth of recursive inlining for non-inline
11015 functions.
11016
11017 fsm-scale-path-stmts
11018 Scale factor to apply to the number of statements in a
11019 threading path when comparing to the number of (scaled) blocks.
11020
11021 fsm-maximum-phi-arguments
11022 Maximum number of arguments a PHI may have before the FSM
11023 threader will not try to thread through its block.
11024
11025 uninit-control-dep-attempts
11026 Maximum number of nested calls to search for control
11027 dependencies during uninitialized variable analysis.
11028
11029 sra-max-scalarization-size-Osize
11030 Maximum size, in storage units, of an aggregate which should be
11031 considered for scalarization when compiling for size.
11032
11033 fsm-scale-path-blocks
11034 Scale factor to apply to the number of blocks in a threading
11035 path when comparing to the number of (scaled) statements.
11036
11037 sched-autopref-queue-depth
11038 Hardware autoprefetcher scheduler model control flag. Number
11039 of lookahead cycles the model looks into; at ' ' only enable
11040 instruction sorting heuristic.
11041
11042 loop-versioning-max-inner-insns
11043 The maximum number of instructions that an inner loop can have
11044 before the loop versioning pass considers it too big to copy.
11045
11046 loop-versioning-max-outer-insns
11047 The maximum number of instructions that an outer loop can have
11048 before the loop versioning pass considers it too big to copy,
11049 discounting any instructions in inner loops that directly
11050 benefit from versioning.
11051
11052 ssa-name-def-chain-limit
11053 The maximum number of SSA_NAME assignments to follow in
11054 determining a property of a variable such as its value. This
11055 limits the number of iterations or recursive calls GCC performs
11056 when optimizing certain statements or when determining their
11057 validity prior to issuing diagnostics.
11058
11059 store-merging-max-size
11060 Maximum size of a single store merging region in bytes.
11061
11062 hash-table-verification-limit
11063 The number of elements for which hash table verification is
11064 done for each searched element.
11065
11066 max-find-base-term-values
11067 Maximum number of VALUEs handled during a single find_base_term
11068 call.
11069
11070 analyzer-max-enodes-per-program-point
11071 The maximum number of exploded nodes per program point within
11072 the analyzer, before terminating analysis of that point.
11073
11074 analyzer-min-snodes-for-call-summary
11075 The minimum number of supernodes within a function for the
11076 analyzer to consider summarizing its effects at call sites.
11077
11078 analyzer-max-recursion-depth
11079 The maximum number of times a callsite can appear in a call
11080 stack within the analyzer, before terminating analysis of a
11081 call that would recurse deeper.
11082
11083 gimple-fe-computed-hot-bb-threshold
11084 The number of executions of a basic block which is considered
11085 hot. The parameter is used only in GIMPLE FE.
11086
11087 analyzer-bb-explosion-factor
11088 The maximum number of 'after supernode' exploded nodes within
11089 the analyzer per supernode, before terminating analysis.
11090
11091 The following choices of name are available on AArch64 targets:
11092
11093 aarch64-sve-compare-costs
11094 When vectorizing for SVE, consider using "unpacked" vectors for
11095 smaller elements and use the cost model to pick the cheapest
11096 approach. Also use the cost model to choose between SVE and
11097 Advanced SIMD vectorization.
11098
11099 Using unpacked vectors includes storing smaller elements in
11100 larger containers and accessing elements with extending loads
11101 and truncating stores.
11102
11103 aarch64-float-recp-precision
11104 The number of Newton iterations for calculating the reciprocal
11105 for float type. The precision of division is proportional to
11106 this param when division approximation is enabled. The default
11107 value is 1.
11108
11109 aarch64-double-recp-precision
11110 The number of Newton iterations for calculating the reciprocal
11111 for double type. The precision of division is propotional to
11112 this param when division approximation is enabled. The default
11113 value is 2.
11114
11115 Program Instrumentation Options
11116 GCC supports a number of command-line options that control adding run-
11117 time instrumentation to the code it normally generates. For example,
11118 one purpose of instrumentation is collect profiling statistics for use
11119 in finding program hot spots, code coverage analysis, or profile-guided
11120 optimizations. Another class of program instrumentation is adding run-
11121 time checking to detect programming errors like invalid pointer
11122 dereferences or out-of-bounds array accesses, as well as deliberately
11123 hostile attacks such as stack smashing or C++ vtable hijacking. There
11124 is also a general hook which can be used to implement other forms of
11125 tracing or function-level instrumentation for debug or program analysis
11126 purposes.
11127
11128 -p
11129 -pg Generate extra code to write profile information suitable for the
11130 analysis program prof (for -p) or gprof (for -pg). You must use
11131 this option when compiling the source files you want data about,
11132 and you must also use it when linking.
11133
11134 You can use the function attribute "no_instrument_function" to
11135 suppress profiling of individual functions when compiling with
11136 these options.
11137
11138 -fprofile-arcs
11139 Add code so that program flow arcs are instrumented. During
11140 execution the program records how many times each branch and call
11141 is executed and how many times it is taken or returns. On targets
11142 that support constructors with priority support, profiling properly
11143 handles constructors, destructors and C++ constructors (and
11144 destructors) of classes which are used as a type of a global
11145 variable.
11146
11147 When the compiled program exits it saves this data to a file called
11148 auxname.gcda for each source file. The data may be used for
11149 profile-directed optimizations (-fbranch-probabilities), or for
11150 test coverage analysis (-ftest-coverage). Each object file's
11151 auxname is generated from the name of the output file, if
11152 explicitly specified and it is not the final executable, otherwise
11153 it is the basename of the source file. In both cases any suffix is
11154 removed (e.g. foo.gcda for input file dir/foo.c, or dir/foo.gcda
11155 for output file specified as -o dir/foo.o).
11156
11157 --coverage
11158 This option is used to compile and link code instrumented for
11159 coverage analysis. The option is a synonym for -fprofile-arcs
11160 -ftest-coverage (when compiling) and -lgcov (when linking). See
11161 the documentation for those options for more details.
11162
11163 * Compile the source files with -fprofile-arcs plus optimization
11164 and code generation options. For test coverage analysis, use
11165 the additional -ftest-coverage option. You do not need to
11166 profile every source file in a program.
11167
11168 * Compile the source files additionally with -fprofile-abs-path
11169 to create absolute path names in the .gcno files. This allows
11170 gcov to find the correct sources in projects where compilations
11171 occur with different working directories.
11172
11173 * Link your object files with -lgcov or -fprofile-arcs (the
11174 latter implies the former).
11175
11176 * Run the program on a representative workload to generate the
11177 arc profile information. This may be repeated any number of
11178 times. You can run concurrent instances of your program, and
11179 provided that the file system supports locking, the data files
11180 will be correctly updated. Unless a strict ISO C dialect
11181 option is in effect, "fork" calls are detected and correctly
11182 handled without double counting.
11183
11184 * For profile-directed optimizations, compile the source files
11185 again with the same optimization and code generation options
11186 plus -fbranch-probabilities.
11187
11188 * For test coverage analysis, use gcov to produce human readable
11189 information from the .gcno and .gcda files. Refer to the gcov
11190 documentation for further information.
11191
11192 With -fprofile-arcs, for each function of your program GCC creates
11193 a program flow graph, then finds a spanning tree for the graph.
11194 Only arcs that are not on the spanning tree have to be
11195 instrumented: the compiler adds code to count the number of times
11196 that these arcs are executed. When an arc is the only exit or only
11197 entrance to a block, the instrumentation code can be added to the
11198 block; otherwise, a new basic block must be created to hold the
11199 instrumentation code.
11200
11201 -ftest-coverage
11202 Produce a notes file that the gcov code-coverage utility can use to
11203 show program coverage. Each source file's note file is called
11204 auxname.gcno. Refer to the -fprofile-arcs option above for a
11205 description of auxname and instructions on how to generate test
11206 coverage data. Coverage data matches the source files more closely
11207 if you do not optimize.
11208
11209 -fprofile-abs-path
11210 Automatically convert relative source file names to absolute path
11211 names in the .gcno files. This allows gcov to find the correct
11212 sources in projects where compilations occur with different working
11213 directories.
11214
11215 -fprofile-dir=path
11216 Set the directory to search for the profile data files in to path.
11217 This option affects only the profile data generated by
11218 -fprofile-generate, -ftest-coverage, -fprofile-arcs and used by
11219 -fprofile-use and -fbranch-probabilities and its related options.
11220 Both absolute and relative paths can be used. By default, GCC uses
11221 the current directory as path, thus the profile data file appears
11222 in the same directory as the object file. In order to prevent the
11223 file name clashing, if the object file name is not an absolute
11224 path, we mangle the absolute path of the sourcename.gcda file and
11225 use it as the file name of a .gcda file. See similar option
11226 -fprofile-note.
11227
11228 When an executable is run in a massive parallel environment, it is
11229 recommended to save profile to different folders. That can be done
11230 with variables in path that are exported during run-time:
11231
11232 %p process ID.
11233
11234 %q{VAR}
11235 value of environment variable VAR
11236
11237 -fprofile-generate
11238 -fprofile-generate=path
11239 Enable options usually used for instrumenting application to
11240 produce profile useful for later recompilation with profile
11241 feedback based optimization. You must use -fprofile-generate both
11242 when compiling and when linking your program.
11243
11244 The following options are enabled: -fprofile-arcs,
11245 -fprofile-values, -finline-functions, and -fipa-bit-cp.
11246
11247 If path is specified, GCC looks at the path to find the profile
11248 feedback data files. See -fprofile-dir.
11249
11250 To optimize the program based on the collected profile information,
11251 use -fprofile-use.
11252
11253 -fprofile-note=path
11254 If path is specified, GCC saves .gcno file into path location. If
11255 you combine the option with multiple source files, the .gcno file
11256 will be overwritten.
11257
11258 -fprofile-prefix-path=path
11259 This option can be used in combination with
11260 profile-generate=profile_dir and profile-use=profile_dir to inform
11261 GCC where is the base directory of built source tree. By default
11262 profile_dir will contain files with mangled absolute paths of all
11263 object files in the built project. This is not desirable when
11264 directory used to build the instrumented binary differs from the
11265 directory used to build the binary optimized with profile feedback
11266 because the profile data will not be found during the optimized
11267 build. In such setups -fprofile-prefix-path=path with path
11268 pointing to the base directory of the build can be used to strip
11269 the irrelevant part of the path and keep all file names relative to
11270 the main build directory.
11271
11272 -fprofile-update=method
11273 Alter the update method for an application instrumented for profile
11274 feedback based optimization. The method argument should be one of
11275 single, atomic or prefer-atomic. The first one is useful for
11276 single-threaded applications, while the second one prevents profile
11277 corruption by emitting thread-safe code.
11278
11279 Warning: When an application does not properly join all threads (or
11280 creates an detached thread), a profile file can be still corrupted.
11281
11282 Using prefer-atomic would be transformed either to atomic, when
11283 supported by a target, or to single otherwise. The GCC driver
11284 automatically selects prefer-atomic when -pthread is present in the
11285 command line.
11286
11287 -fprofile-filter-files=regex
11288 Instrument only functions from files where names match any regular
11289 expression (separated by a semi-colon).
11290
11291 For example, -fprofile-filter-files=main.c;module.*.c will
11292 instrument only main.c and all C files starting with 'module'.
11293
11294 -fprofile-exclude-files=regex
11295 Instrument only functions from files where names do not match all
11296 the regular expressions (separated by a semi-colon).
11297
11298 For example, -fprofile-exclude-files=/usr/* will prevent
11299 instrumentation of all files that are located in /usr/ folder.
11300
11301 -fprofile-reproducible
11302 Control level of reproducibility of profile gathered by
11303 "-fprofile-generate". This makes it possible to rebuild program
11304 with same outcome which is useful, for example, for distribution
11305 packages.
11306
11307 With -fprofile-reproducibility=serial the profile gathered by
11308 -fprofile-generate is reproducible provided the trained program
11309 behaves the same at each invocation of the train run, it is not
11310 multi-threaded and profile data streaming is always done in the
11311 same order. Note that profile streaming happens at the end of
11312 program run but also before "fork" function is invoked.
11313
11314 Note that it is quite common that execution counts of some part of
11315 programs depends, for example, on length of temporary file names or
11316 memory space randomization (that may affect hash-table collision
11317 rate). Such non-reproducible part of programs may be annotated by
11318 "no_instrument_function" function attribute. "gcov-dump" with -l
11319 can be used to dump gathered data and verify that they are indeed
11320 reproducible.
11321
11322 With -fprofile-reproducibility=parallel-runs collected profile
11323 stays reproducible regardless the order of streaming of the data
11324 into gcda files. This setting makes it possible to run multiple
11325 instances of instrumented program in parallel (such as with "make
11326 -j"). This reduces quality of gathered data, in particular of
11327 indirect call profiling.
11328
11329 -fsanitize=address
11330 Enable AddressSanitizer, a fast memory error detector. Memory
11331 access instructions are instrumented to detect out-of-bounds and
11332 use-after-free bugs. The option enables
11333 -fsanitize-address-use-after-scope. See
11334 <https://github.com/google/sanitizers/wiki/AddressSanitizer> for
11335 more details. The run-time behavior can be influenced using the
11336 ASAN_OPTIONS environment variable. When set to "help=1", the
11337 available options are shown at startup of the instrumented program.
11338 See
11339 <https://github.com/google/sanitizers/wiki/AddressSanitizerFlags#run-time-flags>
11340 for a list of supported options. The option cannot be combined
11341 with -fsanitize=thread.
11342
11343 -fsanitize=kernel-address
11344 Enable AddressSanitizer for Linux kernel. See
11345 <https://github.com/google/kasan/wiki> for more details.
11346
11347 -fsanitize=pointer-compare
11348 Instrument comparison operation (<, <=, >, >=) with pointer
11349 operands. The option must be combined with either
11350 -fsanitize=kernel-address or -fsanitize=address The option cannot
11351 be combined with -fsanitize=thread. Note: By default the check is
11352 disabled at run time. To enable it, add
11353 "detect_invalid_pointer_pairs=2" to the environment variable
11354 ASAN_OPTIONS. Using "detect_invalid_pointer_pairs=1" detects
11355 invalid operation only when both pointers are non-null.
11356
11357 -fsanitize=pointer-subtract
11358 Instrument subtraction with pointer operands. The option must be
11359 combined with either -fsanitize=kernel-address or
11360 -fsanitize=address The option cannot be combined with
11361 -fsanitize=thread. Note: By default the check is disabled at run
11362 time. To enable it, add "detect_invalid_pointer_pairs=2" to the
11363 environment variable ASAN_OPTIONS. Using
11364 "detect_invalid_pointer_pairs=1" detects invalid operation only
11365 when both pointers are non-null.
11366
11367 -fsanitize=thread
11368 Enable ThreadSanitizer, a fast data race detector. Memory access
11369 instructions are instrumented to detect data race bugs. See
11370 <https://github.com/google/sanitizers/wiki#threadsanitizer> for
11371 more details. The run-time behavior can be influenced using the
11372 TSAN_OPTIONS environment variable; see
11373 <https://github.com/google/sanitizers/wiki/ThreadSanitizerFlags>
11374 for a list of supported options. The option cannot be combined
11375 with -fsanitize=address, -fsanitize=leak.
11376
11377 Note that sanitized atomic builtins cannot throw exceptions when
11378 operating on invalid memory addresses with non-call exceptions
11379 (-fnon-call-exceptions).
11380
11381 -fsanitize=leak
11382 Enable LeakSanitizer, a memory leak detector. This option only
11383 matters for linking of executables and the executable is linked
11384 against a library that overrides "malloc" and other allocator
11385 functions. See
11386 <https://github.com/google/sanitizers/wiki/AddressSanitizerLeakSanitizer>
11387 for more details. The run-time behavior can be influenced using
11388 the LSAN_OPTIONS environment variable. The option cannot be
11389 combined with -fsanitize=thread.
11390
11391 -fsanitize=undefined
11392 Enable UndefinedBehaviorSanitizer, a fast undefined behavior
11393 detector. Various computations are instrumented to detect
11394 undefined behavior at runtime. Current suboptions are:
11395
11396 -fsanitize=shift
11397 This option enables checking that the result of a shift
11398 operation is not undefined. Note that what exactly is
11399 considered undefined differs slightly between C and C++, as
11400 well as between ISO C90 and C99, etc. This option has two
11401 suboptions, -fsanitize=shift-base and
11402 -fsanitize=shift-exponent.
11403
11404 -fsanitize=shift-exponent
11405 This option enables checking that the second argument of a
11406 shift operation is not negative and is smaller than the
11407 precision of the promoted first argument.
11408
11409 -fsanitize=shift-base
11410 If the second argument of a shift operation is within range,
11411 check that the result of a shift operation is not undefined.
11412 Note that what exactly is considered undefined differs slightly
11413 between C and C++, as well as between ISO C90 and C99, etc.
11414
11415 -fsanitize=integer-divide-by-zero
11416 Detect integer division by zero as well as "INT_MIN / -1"
11417 division.
11418
11419 -fsanitize=unreachable
11420 With this option, the compiler turns the
11421 "__builtin_unreachable" call into a diagnostics message call
11422 instead. When reaching the "__builtin_unreachable" call, the
11423 behavior is undefined.
11424
11425 -fsanitize=vla-bound
11426 This option instructs the compiler to check that the size of a
11427 variable length array is positive.
11428
11429 -fsanitize=null
11430 This option enables pointer checking. Particularly, the
11431 application built with this option turned on will issue an
11432 error message when it tries to dereference a NULL pointer, or
11433 if a reference (possibly an rvalue reference) is bound to a
11434 NULL pointer, or if a method is invoked on an object pointed by
11435 a NULL pointer.
11436
11437 -fsanitize=return
11438 This option enables return statement checking. Programs built
11439 with this option turned on will issue an error message when the
11440 end of a non-void function is reached without actually
11441 returning a value. This option works in C++ only.
11442
11443 -fsanitize=signed-integer-overflow
11444 This option enables signed integer overflow checking. We check
11445 that the result of "+", "*", and both unary and binary "-" does
11446 not overflow in the signed arithmetics. Note, integer
11447 promotion rules must be taken into account. That is, the
11448 following is not an overflow:
11449
11450 signed char a = SCHAR_MAX;
11451 a++;
11452
11453 -fsanitize=bounds
11454 This option enables instrumentation of array bounds. Various
11455 out of bounds accesses are detected. Flexible array members,
11456 flexible array member-like arrays, and initializers of
11457 variables with static storage are not instrumented.
11458
11459 -fsanitize=bounds-strict
11460 This option enables strict instrumentation of array bounds.
11461 Most out of bounds accesses are detected, including flexible
11462 array members and flexible array member-like arrays.
11463 Initializers of variables with static storage are not
11464 instrumented.
11465
11466 -fsanitize=alignment
11467 This option enables checking of alignment of pointers when they
11468 are dereferenced, or when a reference is bound to
11469 insufficiently aligned target, or when a method or constructor
11470 is invoked on insufficiently aligned object.
11471
11472 -fsanitize=object-size
11473 This option enables instrumentation of memory references using
11474 the "__builtin_object_size" function. Various out of bounds
11475 pointer accesses are detected.
11476
11477 -fsanitize=float-divide-by-zero
11478 Detect floating-point division by zero. Unlike other similar
11479 options, -fsanitize=float-divide-by-zero is not enabled by
11480 -fsanitize=undefined, since floating-point division by zero can
11481 be a legitimate way of obtaining infinities and NaNs.
11482
11483 -fsanitize=float-cast-overflow
11484 This option enables floating-point type to integer conversion
11485 checking. We check that the result of the conversion does not
11486 overflow. Unlike other similar options,
11487 -fsanitize=float-cast-overflow is not enabled by
11488 -fsanitize=undefined. This option does not work well with
11489 "FE_INVALID" exceptions enabled.
11490
11491 -fsanitize=nonnull-attribute
11492 This option enables instrumentation of calls, checking whether
11493 null values are not passed to arguments marked as requiring a
11494 non-null value by the "nonnull" function attribute.
11495
11496 -fsanitize=returns-nonnull-attribute
11497 This option enables instrumentation of return statements in
11498 functions marked with "returns_nonnull" function attribute, to
11499 detect returning of null values from such functions.
11500
11501 -fsanitize=bool
11502 This option enables instrumentation of loads from bool. If a
11503 value other than 0/1 is loaded, a run-time error is issued.
11504
11505 -fsanitize=enum
11506 This option enables instrumentation of loads from an enum type.
11507 If a value outside the range of values for the enum type is
11508 loaded, a run-time error is issued.
11509
11510 -fsanitize=vptr
11511 This option enables instrumentation of C++ member function
11512 calls, member accesses and some conversions between pointers to
11513 base and derived classes, to verify the referenced object has
11514 the correct dynamic type.
11515
11516 -fsanitize=pointer-overflow
11517 This option enables instrumentation of pointer arithmetics. If
11518 the pointer arithmetics overflows, a run-time error is issued.
11519
11520 -fsanitize=builtin
11521 This option enables instrumentation of arguments to selected
11522 builtin functions. If an invalid value is passed to such
11523 arguments, a run-time error is issued. E.g. passing 0 as the
11524 argument to "__builtin_ctz" or "__builtin_clz" invokes
11525 undefined behavior and is diagnosed by this option.
11526
11527 While -ftrapv causes traps for signed overflows to be emitted,
11528 -fsanitize=undefined gives a diagnostic message. This currently
11529 works only for the C family of languages.
11530
11531 -fno-sanitize=all
11532 This option disables all previously enabled sanitizers.
11533 -fsanitize=all is not allowed, as some sanitizers cannot be used
11534 together.
11535
11536 -fasan-shadow-offset=number
11537 This option forces GCC to use custom shadow offset in
11538 AddressSanitizer checks. It is useful for experimenting with
11539 different shadow memory layouts in Kernel AddressSanitizer.
11540
11541 -fsanitize-sections=s1,s2,...
11542 Sanitize global variables in selected user-defined sections. si
11543 may contain wildcards.
11544
11545 -fsanitize-recover[=opts]
11546 -fsanitize-recover= controls error recovery mode for sanitizers
11547 mentioned in comma-separated list of opts. Enabling this option
11548 for a sanitizer component causes it to attempt to continue running
11549 the program as if no error happened. This means multiple runtime
11550 errors can be reported in a single program run, and the exit code
11551 of the program may indicate success even when errors have been
11552 reported. The -fno-sanitize-recover= option can be used to alter
11553 this behavior: only the first detected error is reported and
11554 program then exits with a non-zero exit code.
11555
11556 Currently this feature only works for -fsanitize=undefined (and its
11557 suboptions except for -fsanitize=unreachable and
11558 -fsanitize=return), -fsanitize=float-cast-overflow,
11559 -fsanitize=float-divide-by-zero, -fsanitize=bounds-strict,
11560 -fsanitize=kernel-address and -fsanitize=address. For these
11561 sanitizers error recovery is turned on by default, except
11562 -fsanitize=address, for which this feature is experimental.
11563 -fsanitize-recover=all and -fno-sanitize-recover=all is also
11564 accepted, the former enables recovery for all sanitizers that
11565 support it, the latter disables recovery for all sanitizers that
11566 support it.
11567
11568 Even if a recovery mode is turned on the compiler side, it needs to
11569 be also enabled on the runtime library side, otherwise the failures
11570 are still fatal. The runtime library defaults to "halt_on_error=0"
11571 for ThreadSanitizer and UndefinedBehaviorSanitizer, while default
11572 value for AddressSanitizer is "halt_on_error=1". This can be
11573 overridden through setting the "halt_on_error" flag in the
11574 corresponding environment variable.
11575
11576 Syntax without an explicit opts parameter is deprecated. It is
11577 equivalent to specifying an opts list of:
11578
11579 undefined,float-cast-overflow,float-divide-by-zero,bounds-strict
11580
11581 -fsanitize-address-use-after-scope
11582 Enable sanitization of local variables to detect use-after-scope
11583 bugs. The option sets -fstack-reuse to none.
11584
11585 -fsanitize-undefined-trap-on-error
11586 The -fsanitize-undefined-trap-on-error option instructs the
11587 compiler to report undefined behavior using "__builtin_trap" rather
11588 than a "libubsan" library routine. The advantage of this is that
11589 the "libubsan" library is not needed and is not linked in, so this
11590 is usable even in freestanding environments.
11591
11592 -fsanitize-coverage=trace-pc
11593 Enable coverage-guided fuzzing code instrumentation. Inserts a
11594 call to "__sanitizer_cov_trace_pc" into every basic block.
11595
11596 -fsanitize-coverage=trace-cmp
11597 Enable dataflow guided fuzzing code instrumentation. Inserts a
11598 call to "__sanitizer_cov_trace_cmp1", "__sanitizer_cov_trace_cmp2",
11599 "__sanitizer_cov_trace_cmp4" or "__sanitizer_cov_trace_cmp8" for
11600 integral comparison with both operands variable or
11601 "__sanitizer_cov_trace_const_cmp1",
11602 "__sanitizer_cov_trace_const_cmp2",
11603 "__sanitizer_cov_trace_const_cmp4" or
11604 "__sanitizer_cov_trace_const_cmp8" for integral comparison with one
11605 operand constant, "__sanitizer_cov_trace_cmpf" or
11606 "__sanitizer_cov_trace_cmpd" for float or double comparisons and
11607 "__sanitizer_cov_trace_switch" for switch statements.
11608
11609 -fcf-protection=[full|branch|return|none]
11610 Enable code instrumentation of control-flow transfers to increase
11611 program security by checking that target addresses of control-flow
11612 transfer instructions (such as indirect function call, function
11613 return, indirect jump) are valid. This prevents diverting the flow
11614 of control to an unexpected target. This is intended to protect
11615 against such threats as Return-oriented Programming (ROP), and
11616 similarly call/jmp-oriented programming (COP/JOP).
11617
11618 The value "branch" tells the compiler to implement checking of
11619 validity of control-flow transfer at the point of indirect branch
11620 instructions, i.e. call/jmp instructions. The value "return"
11621 implements checking of validity at the point of returning from a
11622 function. The value "full" is an alias for specifying both
11623 "branch" and "return". The value "none" turns off instrumentation.
11624
11625 The macro "__CET__" is defined when -fcf-protection is used. The
11626 first bit of "__CET__" is set to 1 for the value "branch" and the
11627 second bit of "__CET__" is set to 1 for the "return".
11628
11629 You can also use the "nocf_check" attribute to identify which
11630 functions and calls should be skipped from instrumentation.
11631
11632 Currently the x86 GNU/Linux target provides an implementation based
11633 on Intel Control-flow Enforcement Technology (CET).
11634
11635 -fstack-protector
11636 Emit extra code to check for buffer overflows, such as stack
11637 smashing attacks. This is done by adding a guard variable to
11638 functions with vulnerable objects. This includes functions that
11639 call "alloca", and functions with buffers larger than or equal to 8
11640 bytes. The guards are initialized when a function is entered and
11641 then checked when the function exits. If a guard check fails, an
11642 error message is printed and the program exits. Only variables
11643 that are actually allocated on the stack are considered, optimized
11644 away variables or variables allocated in registers don't count.
11645
11646 -fstack-protector-all
11647 Like -fstack-protector except that all functions are protected.
11648
11649 -fstack-protector-strong
11650 Like -fstack-protector but includes additional functions to be
11651 protected --- those that have local array definitions, or have
11652 references to local frame addresses. Only variables that are
11653 actually allocated on the stack are considered, optimized away
11654 variables or variables allocated in registers don't count.
11655
11656 -fstack-protector-explicit
11657 Like -fstack-protector but only protects those functions which have
11658 the "stack_protect" attribute.
11659
11660 -fstack-check
11661 Generate code to verify that you do not go beyond the boundary of
11662 the stack. You should specify this flag if you are running in an
11663 environment with multiple threads, but you only rarely need to
11664 specify it in a single-threaded environment since stack overflow is
11665 automatically detected on nearly all systems if there is only one
11666 stack.
11667
11668 Note that this switch does not actually cause checking to be done;
11669 the operating system or the language runtime must do that. The
11670 switch causes generation of code to ensure that they see the stack
11671 being extended.
11672
11673 You can additionally specify a string parameter: no means no
11674 checking, generic means force the use of old-style checking,
11675 specific means use the best checking method and is equivalent to
11676 bare -fstack-check.
11677
11678 Old-style checking is a generic mechanism that requires no specific
11679 target support in the compiler but comes with the following
11680 drawbacks:
11681
11682 1. Modified allocation strategy for large objects: they are always
11683 allocated dynamically if their size exceeds a fixed threshold.
11684 Note this may change the semantics of some code.
11685
11686 2. Fixed limit on the size of the static frame of functions: when
11687 it is topped by a particular function, stack checking is not
11688 reliable and a warning is issued by the compiler.
11689
11690 3. Inefficiency: because of both the modified allocation strategy
11691 and the generic implementation, code performance is hampered.
11692
11693 Note that old-style stack checking is also the fallback method for
11694 specific if no target support has been added in the compiler.
11695
11696 -fstack-check= is designed for Ada's needs to detect infinite
11697 recursion and stack overflows. specific is an excellent choice
11698 when compiling Ada code. It is not generally sufficient to protect
11699 against stack-clash attacks. To protect against those you want
11700 -fstack-clash-protection.
11701
11702 -fstack-clash-protection
11703 Generate code to prevent stack clash style attacks. When this
11704 option is enabled, the compiler will only allocate one page of
11705 stack space at a time and each page is accessed immediately after
11706 allocation. Thus, it prevents allocations from jumping over any
11707 stack guard page provided by the operating system.
11708
11709 Most targets do not fully support stack clash protection. However,
11710 on those targets -fstack-clash-protection will protect dynamic
11711 stack allocations. -fstack-clash-protection may also provide
11712 limited protection for static stack allocations if the target
11713 supports -fstack-check=specific.
11714
11715 -fstack-limit-register=reg
11716 -fstack-limit-symbol=sym
11717 -fno-stack-limit
11718 Generate code to ensure that the stack does not grow beyond a
11719 certain value, either the value of a register or the address of a
11720 symbol. If a larger stack is required, a signal is raised at run
11721 time. For most targets, the signal is raised before the stack
11722 overruns the boundary, so it is possible to catch the signal
11723 without taking special precautions.
11724
11725 For instance, if the stack starts at absolute address 0x80000000
11726 and grows downwards, you can use the flags
11727 -fstack-limit-symbol=__stack_limit and
11728 -Wl,--defsym,__stack_limit=0x7ffe0000 to enforce a stack limit of
11729 128KB. Note that this may only work with the GNU linker.
11730
11731 You can locally override stack limit checking by using the
11732 "no_stack_limit" function attribute.
11733
11734 -fsplit-stack
11735 Generate code to automatically split the stack before it overflows.
11736 The resulting program has a discontiguous stack which can only
11737 overflow if the program is unable to allocate any more memory.
11738 This is most useful when running threaded programs, as it is no
11739 longer necessary to calculate a good stack size to use for each
11740 thread. This is currently only implemented for the x86 targets
11741 running GNU/Linux.
11742
11743 When code compiled with -fsplit-stack calls code compiled without
11744 -fsplit-stack, there may not be much stack space available for the
11745 latter code to run. If compiling all code, including library code,
11746 with -fsplit-stack is not an option, then the linker can fix up
11747 these calls so that the code compiled without -fsplit-stack always
11748 has a large stack. Support for this is implemented in the gold
11749 linker in GNU binutils release 2.21 and later.
11750
11751 -fvtable-verify=[std|preinit|none]
11752 This option is only available when compiling C++ code. It turns on
11753 (or off, if using -fvtable-verify=none) the security feature that
11754 verifies at run time, for every virtual call, that the vtable
11755 pointer through which the call is made is valid for the type of the
11756 object, and has not been corrupted or overwritten. If an invalid
11757 vtable pointer is detected at run time, an error is reported and
11758 execution of the program is immediately halted.
11759
11760 This option causes run-time data structures to be built at program
11761 startup, which are used for verifying the vtable pointers. The
11762 options std and preinit control the timing of when these data
11763 structures are built. In both cases the data structures are built
11764 before execution reaches "main". Using -fvtable-verify=std causes
11765 the data structures to be built after shared libraries have been
11766 loaded and initialized. -fvtable-verify=preinit causes them to be
11767 built before shared libraries have been loaded and initialized.
11768
11769 If this option appears multiple times in the command line with
11770 different values specified, none takes highest priority over both
11771 std and preinit; preinit takes priority over std.
11772
11773 -fvtv-debug
11774 When used in conjunction with -fvtable-verify=std or
11775 -fvtable-verify=preinit, causes debug versions of the runtime
11776 functions for the vtable verification feature to be called. This
11777 flag also causes the compiler to log information about which vtable
11778 pointers it finds for each class. This information is written to a
11779 file named vtv_set_ptr_data.log in the directory named by the
11780 environment variable VTV_LOGS_DIR if that is defined or the current
11781 working directory otherwise.
11782
11783 Note: This feature appends data to the log file. If you want a
11784 fresh log file, be sure to delete any existing one.
11785
11786 -fvtv-counts
11787 This is a debugging flag. When used in conjunction with
11788 -fvtable-verify=std or -fvtable-verify=preinit, this causes the
11789 compiler to keep track of the total number of virtual calls it
11790 encounters and the number of verifications it inserts. It also
11791 counts the number of calls to certain run-time library functions
11792 that it inserts and logs this information for each compilation
11793 unit. The compiler writes this information to a file named
11794 vtv_count_data.log in the directory named by the environment
11795 variable VTV_LOGS_DIR if that is defined or the current working
11796 directory otherwise. It also counts the size of the vtable pointer
11797 sets for each class, and writes this information to
11798 vtv_class_set_sizes.log in the same directory.
11799
11800 Note: This feature appends data to the log files. To get fresh
11801 log files, be sure to delete any existing ones.
11802
11803 -finstrument-functions
11804 Generate instrumentation calls for entry and exit to functions.
11805 Just after function entry and just before function exit, the
11806 following profiling functions are called with the address of the
11807 current function and its call site. (On some platforms,
11808 "__builtin_return_address" does not work beyond the current
11809 function, so the call site information may not be available to the
11810 profiling functions otherwise.)
11811
11812 void __cyg_profile_func_enter (void *this_fn,
11813 void *call_site);
11814 void __cyg_profile_func_exit (void *this_fn,
11815 void *call_site);
11816
11817 The first argument is the address of the start of the current
11818 function, which may be looked up exactly in the symbol table.
11819
11820 This instrumentation is also done for functions expanded inline in
11821 other functions. The profiling calls indicate where, conceptually,
11822 the inline function is entered and exited. This means that
11823 addressable versions of such functions must be available. If all
11824 your uses of a function are expanded inline, this may mean an
11825 additional expansion of code size. If you use "extern inline" in
11826 your C code, an addressable version of such functions must be
11827 provided. (This is normally the case anyway, but if you get lucky
11828 and the optimizer always expands the functions inline, you might
11829 have gotten away without providing static copies.)
11830
11831 A function may be given the attribute "no_instrument_function", in
11832 which case this instrumentation is not done. This can be used, for
11833 example, for the profiling functions listed above, high-priority
11834 interrupt routines, and any functions from which the profiling
11835 functions cannot safely be called (perhaps signal handlers, if the
11836 profiling routines generate output or allocate memory).
11837
11838 -finstrument-functions-exclude-file-list=file,file,...
11839 Set the list of functions that are excluded from instrumentation
11840 (see the description of -finstrument-functions). If the file that
11841 contains a function definition matches with one of file, then that
11842 function is not instrumented. The match is done on substrings: if
11843 the file parameter is a substring of the file name, it is
11844 considered to be a match.
11845
11846 For example:
11847
11848 -finstrument-functions-exclude-file-list=/bits/stl,include/sys
11849
11850 excludes any inline function defined in files whose pathnames
11851 contain /bits/stl or include/sys.
11852
11853 If, for some reason, you want to include letter , in one of sym,
11854 write ,. For example,
11855 -finstrument-functions-exclude-file-list=',,tmp' (note the single
11856 quote surrounding the option).
11857
11858 -finstrument-functions-exclude-function-list=sym,sym,...
11859 This is similar to -finstrument-functions-exclude-file-list, but
11860 this option sets the list of function names to be excluded from
11861 instrumentation. The function name to be matched is its user-
11862 visible name, such as "vector<int> blah(const vector<int> &)", not
11863 the internal mangled name (e.g., "_Z4blahRSt6vectorIiSaIiEE"). The
11864 match is done on substrings: if the sym parameter is a substring of
11865 the function name, it is considered to be a match. For C99 and C++
11866 extended identifiers, the function name must be given in UTF-8, not
11867 using universal character names.
11868
11869 -fpatchable-function-entry=N[,M]
11870 Generate N NOPs right at the beginning of each function, with the
11871 function entry point before the Mth NOP. If M is omitted, it
11872 defaults to 0 so the function entry points to the address just at
11873 the first NOP. The NOP instructions reserve extra space which can
11874 be used to patch in any desired instrumentation at run time,
11875 provided that the code segment is writable. The amount of space is
11876 controllable indirectly via the number of NOPs; the NOP instruction
11877 used corresponds to the instruction emitted by the internal GCC
11878 back-end interface "gen_nop". This behavior is target-specific and
11879 may also depend on the architecture variant and/or other
11880 compilation options.
11881
11882 For run-time identification, the starting addresses of these areas,
11883 which correspond to their respective function entries minus M, are
11884 additionally collected in the "__patchable_function_entries"
11885 section of the resulting binary.
11886
11887 Note that the value of "__attribute__ ((patchable_function_entry
11888 (N,M)))" takes precedence over command-line option
11889 -fpatchable-function-entry=N,M. This can be used to increase the
11890 area size or to remove it completely on a single function. If
11891 "N=0", no pad location is recorded.
11892
11893 The NOP instructions are inserted at---and maybe before, depending
11894 on M---the function entry address, even before the prologue.
11895
11896 Options Controlling the Preprocessor
11897 These options control the C preprocessor, which is run on each C source
11898 file before actual compilation.
11899
11900 If you use the -E option, nothing is done except preprocessing. Some
11901 of these options make sense only together with -E because they cause
11902 the preprocessor output to be unsuitable for actual compilation.
11903
11904 In addition to the options listed here, there are a number of options
11905 to control search paths for include files documented in Directory
11906 Options. Options to control preprocessor diagnostics are listed in
11907 Warning Options.
11908
11909 -D name
11910 Predefine name as a macro, with definition 1.
11911
11912 -D name=definition
11913 The contents of definition are tokenized and processed as if they
11914 appeared during translation phase three in a #define directive. In
11915 particular, the definition is truncated by embedded newline
11916 characters.
11917
11918 If you are invoking the preprocessor from a shell or shell-like
11919 program you may need to use the shell's quoting syntax to protect
11920 characters such as spaces that have a meaning in the shell syntax.
11921
11922 If you wish to define a function-like macro on the command line,
11923 write its argument list with surrounding parentheses before the
11924 equals sign (if any). Parentheses are meaningful to most shells,
11925 so you should quote the option. With sh and csh,
11926 -D'name(args...)=definition' works.
11927
11928 -D and -U options are processed in the order they are given on the
11929 command line. All -imacros file and -include file options are
11930 processed after all -D and -U options.
11931
11932 -U name
11933 Cancel any previous definition of name, either built in or provided
11934 with a -D option.
11935
11936 -include file
11937 Process file as if "#include "file"" appeared as the first line of
11938 the primary source file. However, the first directory searched for
11939 file is the preprocessor's working directory instead of the
11940 directory containing the main source file. If not found there, it
11941 is searched for in the remainder of the "#include "..."" search
11942 chain as normal.
11943
11944 If multiple -include options are given, the files are included in
11945 the order they appear on the command line.
11946
11947 -imacros file
11948 Exactly like -include, except that any output produced by scanning
11949 file is thrown away. Macros it defines remain defined. This
11950 allows you to acquire all the macros from a header without also
11951 processing its declarations.
11952
11953 All files specified by -imacros are processed before all files
11954 specified by -include.
11955
11956 -undef
11957 Do not predefine any system-specific or GCC-specific macros. The
11958 standard predefined macros remain defined.
11959
11960 -pthread
11961 Define additional macros required for using the POSIX threads
11962 library. You should use this option consistently for both
11963 compilation and linking. This option is supported on GNU/Linux
11964 targets, most other Unix derivatives, and also on x86 Cygwin and
11965 MinGW targets.
11966
11967 -M Instead of outputting the result of preprocessing, output a rule
11968 suitable for make describing the dependencies of the main source
11969 file. The preprocessor outputs one make rule containing the object
11970 file name for that source file, a colon, and the names of all the
11971 included files, including those coming from -include or -imacros
11972 command-line options.
11973
11974 Unless specified explicitly (with -MT or -MQ), the object file name
11975 consists of the name of the source file with any suffix replaced
11976 with object file suffix and with any leading directory parts
11977 removed. If there are many included files then the rule is split
11978 into several lines using \-newline. The rule has no commands.
11979
11980 This option does not suppress the preprocessor's debug output, such
11981 as -dM. To avoid mixing such debug output with the dependency
11982 rules you should explicitly specify the dependency output file with
11983 -MF, or use an environment variable like DEPENDENCIES_OUTPUT.
11984 Debug output is still sent to the regular output stream as normal.
11985
11986 Passing -M to the driver implies -E, and suppresses warnings with
11987 an implicit -w.
11988
11989 -MM Like -M but do not mention header files that are found in system
11990 header directories, nor header files that are included, directly or
11991 indirectly, from such a header.
11992
11993 This implies that the choice of angle brackets or double quotes in
11994 an #include directive does not in itself determine whether that
11995 header appears in -MM dependency output.
11996
11997 -MF file
11998 When used with -M or -MM, specifies a file to write the
11999 dependencies to. If no -MF switch is given the preprocessor sends
12000 the rules to the same place it would send preprocessed output.
12001
12002 When used with the driver options -MD or -MMD, -MF overrides the
12003 default dependency output file.
12004
12005 If file is -, then the dependencies are written to stdout.
12006
12007 -MG In conjunction with an option such as -M requesting dependency
12008 generation, -MG assumes missing header files are generated files
12009 and adds them to the dependency list without raising an error. The
12010 dependency filename is taken directly from the "#include" directive
12011 without prepending any path. -MG also suppresses preprocessed
12012 output, as a missing header file renders this useless.
12013
12014 This feature is used in automatic updating of makefiles.
12015
12016 -MP This option instructs CPP to add a phony target for each dependency
12017 other than the main file, causing each to depend on nothing. These
12018 dummy rules work around errors make gives if you remove header
12019 files without updating the Makefile to match.
12020
12021 This is typical output:
12022
12023 test.o: test.c test.h
12024
12025 test.h:
12026
12027 -MT target
12028 Change the target of the rule emitted by dependency generation. By
12029 default CPP takes the name of the main input file, deletes any
12030 directory components and any file suffix such as .c, and appends
12031 the platform's usual object suffix. The result is the target.
12032
12033 An -MT option sets the target to be exactly the string you specify.
12034 If you want multiple targets, you can specify them as a single
12035 argument to -MT, or use multiple -MT options.
12036
12037 For example, -MT '$(objpfx)foo.o' might give
12038
12039 $(objpfx)foo.o: foo.c
12040
12041 -MQ target
12042 Same as -MT, but it quotes any characters which are special to
12043 Make. -MQ '$(objpfx)foo.o' gives
12044
12045 $$(objpfx)foo.o: foo.c
12046
12047 The default target is automatically quoted, as if it were given
12048 with -MQ.
12049
12050 -MD -MD is equivalent to -M -MF file, except that -E is not implied.
12051 The driver determines file based on whether an -o option is given.
12052 If it is, the driver uses its argument but with a suffix of .d,
12053 otherwise it takes the name of the input file, removes any
12054 directory components and suffix, and applies a .d suffix.
12055
12056 If -MD is used in conjunction with -E, any -o switch is understood
12057 to specify the dependency output file, but if used without -E, each
12058 -o is understood to specify a target object file.
12059
12060 Since -E is not implied, -MD can be used to generate a dependency
12061 output file as a side effect of the compilation process.
12062
12063 -MMD
12064 Like -MD except mention only user header files, not system header
12065 files.
12066
12067 -fpreprocessed
12068 Indicate to the preprocessor that the input file has already been
12069 preprocessed. This suppresses things like macro expansion,
12070 trigraph conversion, escaped newline splicing, and processing of
12071 most directives. The preprocessor still recognizes and removes
12072 comments, so that you can pass a file preprocessed with -C to the
12073 compiler without problems. In this mode the integrated
12074 preprocessor is little more than a tokenizer for the front ends.
12075
12076 -fpreprocessed is implicit if the input file has one of the
12077 extensions .i, .ii or .mi. These are the extensions that GCC uses
12078 for preprocessed files created by -save-temps.
12079
12080 -fdirectives-only
12081 When preprocessing, handle directives, but do not expand macros.
12082
12083 The option's behavior depends on the -E and -fpreprocessed options.
12084
12085 With -E, preprocessing is limited to the handling of directives
12086 such as "#define", "#ifdef", and "#error". Other preprocessor
12087 operations, such as macro expansion and trigraph conversion are not
12088 performed. In addition, the -dD option is implicitly enabled.
12089
12090 With -fpreprocessed, predefinition of command line and most builtin
12091 macros is disabled. Macros such as "__LINE__", which are
12092 contextually dependent, are handled normally. This enables
12093 compilation of files previously preprocessed with "-E
12094 -fdirectives-only".
12095
12096 With both -E and -fpreprocessed, the rules for -fpreprocessed take
12097 precedence. This enables full preprocessing of files previously
12098 preprocessed with "-E -fdirectives-only".
12099
12100 -fdollars-in-identifiers
12101 Accept $ in identifiers.
12102
12103 -fextended-identifiers
12104 Accept universal character names and extended characters in
12105 identifiers. This option is enabled by default for C99 (and later
12106 C standard versions) and C++.
12107
12108 -fno-canonical-system-headers
12109 When preprocessing, do not shorten system header paths with
12110 canonicalization.
12111
12112 -fmax-include-depth=depth
12113 Set the maximum depth of the nested #include. The default is 200.
12114
12115 -ftabstop=width
12116 Set the distance between tab stops. This helps the preprocessor
12117 report correct column numbers in warnings or errors, even if tabs
12118 appear on the line. If the value is less than 1 or greater than
12119 100, the option is ignored. The default is 8.
12120
12121 -ftrack-macro-expansion[=level]
12122 Track locations of tokens across macro expansions. This allows the
12123 compiler to emit diagnostic about the current macro expansion stack
12124 when a compilation error occurs in a macro expansion. Using this
12125 option makes the preprocessor and the compiler consume more memory.
12126 The level parameter can be used to choose the level of precision of
12127 token location tracking thus decreasing the memory consumption if
12128 necessary. Value 0 of level de-activates this option. Value 1
12129 tracks tokens locations in a degraded mode for the sake of minimal
12130 memory overhead. In this mode all tokens resulting from the
12131 expansion of an argument of a function-like macro have the same
12132 location. Value 2 tracks tokens locations completely. This value is
12133 the most memory hungry. When this option is given no argument, the
12134 default parameter value is 2.
12135
12136 Note that "-ftrack-macro-expansion=2" is activated by default.
12137
12138 -fmacro-prefix-map=old=new
12139 When preprocessing files residing in directory old, expand the
12140 "__FILE__" and "__BASE_FILE__" macros as if the files resided in
12141 directory new instead. This can be used to change an absolute path
12142 to a relative path by using . for new which can result in more
12143 reproducible builds that are location independent. This option
12144 also affects "__builtin_FILE()" during compilation. See also
12145 -ffile-prefix-map.
12146
12147 -fexec-charset=charset
12148 Set the execution character set, used for string and character
12149 constants. The default is UTF-8. charset can be any encoding
12150 supported by the system's "iconv" library routine.
12151
12152 -fwide-exec-charset=charset
12153 Set the wide execution character set, used for wide string and
12154 character constants. The default is UTF-32 or UTF-16, whichever
12155 corresponds to the width of "wchar_t". As with -fexec-charset,
12156 charset can be any encoding supported by the system's "iconv"
12157 library routine; however, you will have problems with encodings
12158 that do not fit exactly in "wchar_t".
12159
12160 -finput-charset=charset
12161 Set the input character set, used for translation from the
12162 character set of the input file to the source character set used by
12163 GCC. If the locale does not specify, or GCC cannot get this
12164 information from the locale, the default is UTF-8. This can be
12165 overridden by either the locale or this command-line option.
12166 Currently the command-line option takes precedence if there's a
12167 conflict. charset can be any encoding supported by the system's
12168 "iconv" library routine.
12169
12170 -fpch-deps
12171 When using precompiled headers, this flag causes the dependency-
12172 output flags to also list the files from the precompiled header's
12173 dependencies. If not specified, only the precompiled header are
12174 listed and not the files that were used to create it, because those
12175 files are not consulted when a precompiled header is used.
12176
12177 -fpch-preprocess
12178 This option allows use of a precompiled header together with -E.
12179 It inserts a special "#pragma", "#pragma GCC pch_preprocess
12180 "filename"" in the output to mark the place where the precompiled
12181 header was found, and its filename. When -fpreprocessed is in use,
12182 GCC recognizes this "#pragma" and loads the PCH.
12183
12184 This option is off by default, because the resulting preprocessed
12185 output is only really suitable as input to GCC. It is switched on
12186 by -save-temps.
12187
12188 You should not write this "#pragma" in your own code, but it is
12189 safe to edit the filename if the PCH file is available in a
12190 different location. The filename may be absolute or it may be
12191 relative to GCC's current directory.
12192
12193 -fworking-directory
12194 Enable generation of linemarkers in the preprocessor output that
12195 let the compiler know the current working directory at the time of
12196 preprocessing. When this option is enabled, the preprocessor
12197 emits, after the initial linemarker, a second linemarker with the
12198 current working directory followed by two slashes. GCC uses this
12199 directory, when it's present in the preprocessed input, as the
12200 directory emitted as the current working directory in some
12201 debugging information formats. This option is implicitly enabled
12202 if debugging information is enabled, but this can be inhibited with
12203 the negated form -fno-working-directory. If the -P flag is present
12204 in the command line, this option has no effect, since no "#line"
12205 directives are emitted whatsoever.
12206
12207 -A predicate=answer
12208 Make an assertion with the predicate predicate and answer answer.
12209 This form is preferred to the older form -A predicate(answer),
12210 which is still supported, because it does not use shell special
12211 characters.
12212
12213 -A -predicate=answer
12214 Cancel an assertion with the predicate predicate and answer answer.
12215
12216 -C Do not discard comments. All comments are passed through to the
12217 output file, except for comments in processed directives, which are
12218 deleted along with the directive.
12219
12220 You should be prepared for side effects when using -C; it causes
12221 the preprocessor to treat comments as tokens in their own right.
12222 For example, comments appearing at the start of what would be a
12223 directive line have the effect of turning that line into an
12224 ordinary source line, since the first token on the line is no
12225 longer a #.
12226
12227 -CC Do not discard comments, including during macro expansion. This is
12228 like -C, except that comments contained within macros are also
12229 passed through to the output file where the macro is expanded.
12230
12231 In addition to the side effects of the -C option, the -CC option
12232 causes all C++-style comments inside a macro to be converted to
12233 C-style comments. This is to prevent later use of that macro from
12234 inadvertently commenting out the remainder of the source line.
12235
12236 The -CC option is generally used to support lint comments.
12237
12238 -P Inhibit generation of linemarkers in the output from the
12239 preprocessor. This might be useful when running the preprocessor
12240 on something that is not C code, and will be sent to a program
12241 which might be confused by the linemarkers.
12242
12243 -traditional
12244 -traditional-cpp
12245 Try to imitate the behavior of pre-standard C preprocessors, as
12246 opposed to ISO C preprocessors. See the GNU CPP manual for
12247 details.
12248
12249 Note that GCC does not otherwise attempt to emulate a pre-standard
12250 C compiler, and these options are only supported with the -E
12251 switch, or when invoking CPP explicitly.
12252
12253 -trigraphs
12254 Support ISO C trigraphs. These are three-character sequences, all
12255 starting with ??, that are defined by ISO C to stand for single
12256 characters. For example, ??/ stands for \, so '??/n' is a
12257 character constant for a newline.
12258
12259 The nine trigraphs and their replacements are
12260
12261 Trigraph: ??( ??) ??< ??> ??= ??/ ??' ??! ??-
12262 Replacement: [ ] { } # \ ^ | ~
12263
12264 By default, GCC ignores trigraphs, but in standard-conforming modes
12265 it converts them. See the -std and -ansi options.
12266
12267 -remap
12268 Enable special code to work around file systems which only permit
12269 very short file names, such as MS-DOS.
12270
12271 -H Print the name of each header file used, in addition to other
12272 normal activities. Each name is indented to show how deep in the
12273 #include stack it is. Precompiled header files are also printed,
12274 even if they are found to be invalid; an invalid precompiled header
12275 file is printed with ...x and a valid one with ...! .
12276
12277 -dletters
12278 Says to make debugging dumps during compilation as specified by
12279 letters. The flags documented here are those relevant to the
12280 preprocessor. Other letters are interpreted by the compiler
12281 proper, or reserved for future versions of GCC, and so are silently
12282 ignored. If you specify letters whose behavior conflicts, the
12283 result is undefined.
12284
12285 -dM Instead of the normal output, generate a list of #define
12286 directives for all the macros defined during the execution of
12287 the preprocessor, including predefined macros. This gives you
12288 a way of finding out what is predefined in your version of the
12289 preprocessor. Assuming you have no file foo.h, the command
12290
12291 touch foo.h; cpp -dM foo.h
12292
12293 shows all the predefined macros.
12294
12295 If you use -dM without the -E option, -dM is interpreted as a
12296 synonym for -fdump-rtl-mach.
12297
12298 -dD Like -dM except in two respects: it does not include the
12299 predefined macros, and it outputs both the #define directives
12300 and the result of preprocessing. Both kinds of output go to
12301 the standard output file.
12302
12303 -dN Like -dD, but emit only the macro names, not their expansions.
12304
12305 -dI Output #include directives in addition to the result of
12306 preprocessing.
12307
12308 -dU Like -dD except that only macros that are expanded, or whose
12309 definedness is tested in preprocessor directives, are output;
12310 the output is delayed until the use or test of the macro; and
12311 #undef directives are also output for macros tested but
12312 undefined at the time.
12313
12314 -fdebug-cpp
12315 This option is only useful for debugging GCC. When used from CPP
12316 or with -E, it dumps debugging information about location maps.
12317 Every token in the output is preceded by the dump of the map its
12318 location belongs to.
12319
12320 When used from GCC without -E, this option has no effect.
12321
12322 -Wp,option
12323 You can use -Wp,option to bypass the compiler driver and pass
12324 option directly through to the preprocessor. If option contains
12325 commas, it is split into multiple options at the commas. However,
12326 many options are modified, translated or interpreted by the
12327 compiler driver before being passed to the preprocessor, and -Wp
12328 forcibly bypasses this phase. The preprocessor's direct interface
12329 is undocumented and subject to change, so whenever possible you
12330 should avoid using -Wp and let the driver handle the options
12331 instead.
12332
12333 -Xpreprocessor option
12334 Pass option as an option to the preprocessor. You can use this to
12335 supply system-specific preprocessor options that GCC does not
12336 recognize.
12337
12338 If you want to pass an option that takes an argument, you must use
12339 -Xpreprocessor twice, once for the option and once for the
12340 argument.
12341
12342 -no-integrated-cpp
12343 Perform preprocessing as a separate pass before compilation. By
12344 default, GCC performs preprocessing as an integrated part of input
12345 tokenization and parsing. If this option is provided, the
12346 appropriate language front end (cc1, cc1plus, or cc1obj for C, C++,
12347 and Objective-C, respectively) is instead invoked twice, once for
12348 preprocessing only and once for actual compilation of the
12349 preprocessed input. This option may be useful in conjunction with
12350 the -B or -wrapper options to specify an alternate preprocessor or
12351 perform additional processing of the program source between normal
12352 preprocessing and compilation.
12353
12354 Passing Options to the Assembler
12355 You can pass options to the assembler.
12356
12357 -Wa,option
12358 Pass option as an option to the assembler. If option contains
12359 commas, it is split into multiple options at the commas.
12360
12361 -Xassembler option
12362 Pass option as an option to the assembler. You can use this to
12363 supply system-specific assembler options that GCC does not
12364 recognize.
12365
12366 If you want to pass an option that takes an argument, you must use
12367 -Xassembler twice, once for the option and once for the argument.
12368
12369 Options for Linking
12370 These options come into play when the compiler links object files into
12371 an executable output file. They are meaningless if the compiler is not
12372 doing a link step.
12373
12374 object-file-name
12375 A file name that does not end in a special recognized suffix is
12376 considered to name an object file or library. (Object files are
12377 distinguished from libraries by the linker according to the file
12378 contents.) If linking is done, these object files are used as
12379 input to the linker.
12380
12381 -c
12382 -S
12383 -E If any of these options is used, then the linker is not run, and
12384 object file names should not be used as arguments.
12385
12386 -flinker-output=type
12387 This option controls code generation of the link-time optimizer.
12388 By default the linker output is automatically determined by the
12389 linker plugin. For debugging the compiler and if incremental
12390 linking with a non-LTO object file is desired, it may be useful to
12391 control the type manually.
12392
12393 If type is exec, code generation produces a static binary. In this
12394 case -fpic and -fpie are both disabled.
12395
12396 If type is dyn, code generation produces a shared library. In this
12397 case -fpic or -fPIC is preserved, but not enabled automatically.
12398 This allows to build shared libraries without position-independent
12399 code on architectures where this is possible, i.e. on x86.
12400
12401 If type is pie, code generation produces an -fpie executable. This
12402 results in similar optimizations as exec except that -fpie is not
12403 disabled if specified at compilation time.
12404
12405 If type is rel, the compiler assumes that incremental linking is
12406 done. The sections containing intermediate code for link-time
12407 optimization are merged, pre-optimized, and output to the resulting
12408 object file. In addition, if -ffat-lto-objects is specified, binary
12409 code is produced for future non-LTO linking. The object file
12410 produced by incremental linking is smaller than a static library
12411 produced from the same object files. At link time the result of
12412 incremental linking also loads faster than a static library
12413 assuming that the majority of objects in the library are used.
12414
12415 Finally nolto-rel configures the compiler for incremental linking
12416 where code generation is forced, a final binary is produced, and
12417 the intermediate code for later link-time optimization is stripped.
12418 When multiple object files are linked together the resulting code
12419 is better optimized than with link-time optimizations disabled (for
12420 example, cross-module inlining happens), but most of benefits of
12421 whole program optimizations are lost.
12422
12423 During the incremental link (by -r) the linker plugin defaults to
12424 rel. With current interfaces to GNU Binutils it is however not
12425 possible to incrementally link LTO objects and non-LTO objects into
12426 a single mixed object file. If any of object files in incremental
12427 link cannot be used for link-time optimization, the linker plugin
12428 issues a warning and uses nolto-rel. To maintain whole program
12429 optimization, it is recommended to link such objects into static
12430 library instead. Alternatively it is possible to use H.J. Lu's
12431 binutils with support for mixed objects.
12432
12433 -fuse-ld=bfd
12434 Use the bfd linker instead of the default linker.
12435
12436 -fuse-ld=gold
12437 Use the gold linker instead of the default linker.
12438
12439 -fuse-ld=lld
12440 Use the LLVM lld linker instead of the default linker.
12441
12442 -llibrary
12443 -l library
12444 Search the library named library when linking. (The second
12445 alternative with the library as a separate argument is only for
12446 POSIX compliance and is not recommended.)
12447
12448 The -l option is passed directly to the linker by GCC. Refer to
12449 your linker documentation for exact details. The general
12450 description below applies to the GNU linker.
12451
12452 The linker searches a standard list of directories for the library.
12453 The directories searched include several standard system
12454 directories plus any that you specify with -L.
12455
12456 Static libraries are archives of object files, and have file names
12457 like liblibrary.a. Some targets also support shared libraries,
12458 which typically have names like liblibrary.so. If both static and
12459 shared libraries are found, the linker gives preference to linking
12460 with the shared library unless the -static option is used.
12461
12462 It makes a difference where in the command you write this option;
12463 the linker searches and processes libraries and object files in the
12464 order they are specified. Thus, foo.o -lz bar.o searches library z
12465 after file foo.o but before bar.o. If bar.o refers to functions in
12466 z, those functions may not be loaded.
12467
12468 -lobjc
12469 You need this special case of the -l option in order to link an
12470 Objective-C or Objective-C++ program.
12471
12472 -nostartfiles
12473 Do not use the standard system startup files when linking. The
12474 standard system libraries are used normally, unless -nostdlib,
12475 -nolibc, or -nodefaultlibs is used.
12476
12477 -nodefaultlibs
12478 Do not use the standard system libraries when linking. Only the
12479 libraries you specify are passed to the linker, and options
12480 specifying linkage of the system libraries, such as -static-libgcc
12481 or -shared-libgcc, are ignored. The standard startup files are
12482 used normally, unless -nostartfiles is used.
12483
12484 The compiler may generate calls to "memcmp", "memset", "memcpy" and
12485 "memmove". These entries are usually resolved by entries in libc.
12486 These entry points should be supplied through some other mechanism
12487 when this option is specified.
12488
12489 -nolibc
12490 Do not use the C library or system libraries tightly coupled with
12491 it when linking. Still link with the startup files, libgcc or
12492 toolchain provided language support libraries such as libgnat,
12493 libgfortran or libstdc++ unless options preventing their inclusion
12494 are used as well. This typically removes -lc from the link command
12495 line, as well as system libraries that normally go with it and
12496 become meaningless when absence of a C library is assumed, for
12497 example -lpthread or -lm in some configurations. This is intended
12498 for bare-board targets when there is indeed no C library available.
12499
12500 -nostdlib
12501 Do not use the standard system startup files or libraries when
12502 linking. No startup files and only the libraries you specify are
12503 passed to the linker, and options specifying linkage of the system
12504 libraries, such as -static-libgcc or -shared-libgcc, are ignored.
12505
12506 The compiler may generate calls to "memcmp", "memset", "memcpy" and
12507 "memmove". These entries are usually resolved by entries in libc.
12508 These entry points should be supplied through some other mechanism
12509 when this option is specified.
12510
12511 One of the standard libraries bypassed by -nostdlib and
12512 -nodefaultlibs is libgcc.a, a library of internal subroutines which
12513 GCC uses to overcome shortcomings of particular machines, or
12514 special needs for some languages.
12515
12516 In most cases, you need libgcc.a even when you want to avoid other
12517 standard libraries. In other words, when you specify -nostdlib or
12518 -nodefaultlibs you should usually specify -lgcc as well. This
12519 ensures that you have no unresolved references to internal GCC
12520 library subroutines. (An example of such an internal subroutine is
12521 "__main", used to ensure C++ constructors are called.)
12522
12523 -e entry
12524 --entry=entry
12525 Specify that the program entry point is entry. The argument is
12526 interpreted by the linker; the GNU linker accepts either a symbol
12527 name or an address.
12528
12529 -pie
12530 Produce a dynamically linked position independent executable on
12531 targets that support it. For predictable results, you must also
12532 specify the same set of options used for compilation (-fpie, -fPIE,
12533 or model suboptions) when you specify this linker option.
12534
12535 -no-pie
12536 Don't produce a dynamically linked position independent executable.
12537
12538 -static-pie
12539 Produce a static position independent executable on targets that
12540 support it. A static position independent executable is similar to
12541 a static executable, but can be loaded at any address without a
12542 dynamic linker. For predictable results, you must also specify the
12543 same set of options used for compilation (-fpie, -fPIE, or model
12544 suboptions) when you specify this linker option.
12545
12546 -pthread
12547 Link with the POSIX threads library. This option is supported on
12548 GNU/Linux targets, most other Unix derivatives, and also on x86
12549 Cygwin and MinGW targets. On some targets this option also sets
12550 flags for the preprocessor, so it should be used consistently for
12551 both compilation and linking.
12552
12553 -r Produce a relocatable object as output. This is also known as
12554 partial linking.
12555
12556 -rdynamic
12557 Pass the flag -export-dynamic to the ELF linker, on targets that
12558 support it. This instructs the linker to add all symbols, not only
12559 used ones, to the dynamic symbol table. This option is needed for
12560 some uses of "dlopen" or to allow obtaining backtraces from within
12561 a program.
12562
12563 -s Remove all symbol table and relocation information from the
12564 executable.
12565
12566 -static
12567 On systems that support dynamic linking, this overrides -pie and
12568 prevents linking with the shared libraries. On other systems, this
12569 option has no effect.
12570
12571 -shared
12572 Produce a shared object which can then be linked with other objects
12573 to form an executable. Not all systems support this option. For
12574 predictable results, you must also specify the same set of options
12575 used for compilation (-fpic, -fPIC, or model suboptions) when you
12576 specify this linker option.[1]
12577
12578 -shared-libgcc
12579 -static-libgcc
12580 On systems that provide libgcc as a shared library, these options
12581 force the use of either the shared or static version, respectively.
12582 If no shared version of libgcc was built when the compiler was
12583 configured, these options have no effect.
12584
12585 There are several situations in which an application should use the
12586 shared libgcc instead of the static version. The most common of
12587 these is when the application wishes to throw and catch exceptions
12588 across different shared libraries. In that case, each of the
12589 libraries as well as the application itself should use the shared
12590 libgcc.
12591
12592 Therefore, the G++ driver automatically adds -shared-libgcc
12593 whenever you build a shared library or a main executable, because
12594 C++ programs typically use exceptions, so this is the right thing
12595 to do.
12596
12597 If, instead, you use the GCC driver to create shared libraries, you
12598 may find that they are not always linked with the shared libgcc.
12599 If GCC finds, at its configuration time, that you have a non-GNU
12600 linker or a GNU linker that does not support option --eh-frame-hdr,
12601 it links the shared version of libgcc into shared libraries by
12602 default. Otherwise, it takes advantage of the linker and optimizes
12603 away the linking with the shared version of libgcc, linking with
12604 the static version of libgcc by default. This allows exceptions to
12605 propagate through such shared libraries, without incurring
12606 relocation costs at library load time.
12607
12608 However, if a library or main executable is supposed to throw or
12609 catch exceptions, you must link it using the G++ driver, or using
12610 the option -shared-libgcc, such that it is linked with the shared
12611 libgcc.
12612
12613 -static-libasan
12614 When the -fsanitize=address option is used to link a program, the
12615 GCC driver automatically links against libasan. If libasan is
12616 available as a shared library, and the -static option is not used,
12617 then this links against the shared version of libasan. The
12618 -static-libasan option directs the GCC driver to link libasan
12619 statically, without necessarily linking other libraries statically.
12620
12621 -static-libtsan
12622 When the -fsanitize=thread option is used to link a program, the
12623 GCC driver automatically links against libtsan. If libtsan is
12624 available as a shared library, and the -static option is not used,
12625 then this links against the shared version of libtsan. The
12626 -static-libtsan option directs the GCC driver to link libtsan
12627 statically, without necessarily linking other libraries statically.
12628
12629 -static-liblsan
12630 When the -fsanitize=leak option is used to link a program, the GCC
12631 driver automatically links against liblsan. If liblsan is
12632 available as a shared library, and the -static option is not used,
12633 then this links against the shared version of liblsan. The
12634 -static-liblsan option directs the GCC driver to link liblsan
12635 statically, without necessarily linking other libraries statically.
12636
12637 -static-libubsan
12638 When the -fsanitize=undefined option is used to link a program, the
12639 GCC driver automatically links against libubsan. If libubsan is
12640 available as a shared library, and the -static option is not used,
12641 then this links against the shared version of libubsan. The
12642 -static-libubsan option directs the GCC driver to link libubsan
12643 statically, without necessarily linking other libraries statically.
12644
12645 -static-libstdc++
12646 When the g++ program is used to link a C++ program, it normally
12647 automatically links against libstdc++. If libstdc++ is available
12648 as a shared library, and the -static option is not used, then this
12649 links against the shared version of libstdc++. That is normally
12650 fine. However, it is sometimes useful to freeze the version of
12651 libstdc++ used by the program without going all the way to a fully
12652 static link. The -static-libstdc++ option directs the g++ driver
12653 to link libstdc++ statically, without necessarily linking other
12654 libraries statically.
12655
12656 -symbolic
12657 Bind references to global symbols when building a shared object.
12658 Warn about any unresolved references (unless overridden by the link
12659 editor option -Xlinker -z -Xlinker defs). Only a few systems
12660 support this option.
12661
12662 -T script
12663 Use script as the linker script. This option is supported by most
12664 systems using the GNU linker. On some targets, such as bare-board
12665 targets without an operating system, the -T option may be required
12666 when linking to avoid references to undefined symbols.
12667
12668 -Xlinker option
12669 Pass option as an option to the linker. You can use this to supply
12670 system-specific linker options that GCC does not recognize.
12671
12672 If you want to pass an option that takes a separate argument, you
12673 must use -Xlinker twice, once for the option and once for the
12674 argument. For example, to pass -assert definitions, you must write
12675 -Xlinker -assert -Xlinker definitions. It does not work to write
12676 -Xlinker "-assert definitions", because this passes the entire
12677 string as a single argument, which is not what the linker expects.
12678
12679 When using the GNU linker, it is usually more convenient to pass
12680 arguments to linker options using the option=value syntax than as
12681 separate arguments. For example, you can specify -Xlinker
12682 -Map=output.map rather than -Xlinker -Map -Xlinker output.map.
12683 Other linkers may not support this syntax for command-line options.
12684
12685 -Wl,option
12686 Pass option as an option to the linker. If option contains commas,
12687 it is split into multiple options at the commas. You can use this
12688 syntax to pass an argument to the option. For example,
12689 -Wl,-Map,output.map passes -Map output.map to the linker. When
12690 using the GNU linker, you can also get the same effect with
12691 -Wl,-Map=output.map.
12692
12693 -u symbol
12694 Pretend the symbol symbol is undefined, to force linking of library
12695 modules to define it. You can use -u multiple times with different
12696 symbols to force loading of additional library modules.
12697
12698 -z keyword
12699 -z is passed directly on to the linker along with the keyword
12700 keyword. See the section in the documentation of your linker for
12701 permitted values and their meanings.
12702
12703 Options for Directory Search
12704 These options specify directories to search for header files, for
12705 libraries and for parts of the compiler:
12706
12707 -I dir
12708 -iquote dir
12709 -isystem dir
12710 -idirafter dir
12711 Add the directory dir to the list of directories to be searched for
12712 header files during preprocessing. If dir begins with = or
12713 $SYSROOT, then the = or $SYSROOT is replaced by the sysroot prefix;
12714 see --sysroot and -isysroot.
12715
12716 Directories specified with -iquote apply only to the quote form of
12717 the directive, "#include "file"". Directories specified with -I,
12718 -isystem, or -idirafter apply to lookup for both the
12719 "#include "file"" and "#include <file>" directives.
12720
12721 You can specify any number or combination of these options on the
12722 command line to search for header files in several directories.
12723 The lookup order is as follows:
12724
12725 1. For the quote form of the include directive, the directory of
12726 the current file is searched first.
12727
12728 2. For the quote form of the include directive, the directories
12729 specified by -iquote options are searched in left-to-right
12730 order, as they appear on the command line.
12731
12732 3. Directories specified with -I options are scanned in left-to-
12733 right order.
12734
12735 4. Directories specified with -isystem options are scanned in
12736 left-to-right order.
12737
12738 5. Standard system directories are scanned.
12739
12740 6. Directories specified with -idirafter options are scanned in
12741 left-to-right order.
12742
12743 You can use -I to override a system header file, substituting your
12744 own version, since these directories are searched before the
12745 standard system header file directories. However, you should not
12746 use this option to add directories that contain vendor-supplied
12747 system header files; use -isystem for that.
12748
12749 The -isystem and -idirafter options also mark the directory as a
12750 system directory, so that it gets the same special treatment that
12751 is applied to the standard system directories.
12752
12753 If a standard system include directory, or a directory specified
12754 with -isystem, is also specified with -I, the -I option is ignored.
12755 The directory is still searched but as a system directory at its
12756 normal position in the system include chain. This is to ensure
12757 that GCC's procedure to fix buggy system headers and the ordering
12758 for the "#include_next" directive are not inadvertently changed.
12759 If you really need to change the search order for system
12760 directories, use the -nostdinc and/or -isystem options.
12761
12762 -I- Split the include path. This option has been deprecated. Please
12763 use -iquote instead for -I directories before the -I- and remove
12764 the -I- option.
12765
12766 Any directories specified with -I options before -I- are searched
12767 only for headers requested with "#include "file""; they are not
12768 searched for "#include <file>". If additional directories are
12769 specified with -I options after the -I-, those directories are
12770 searched for all #include directives.
12771
12772 In addition, -I- inhibits the use of the directory of the current
12773 file directory as the first search directory for "#include "file"".
12774 There is no way to override this effect of -I-.
12775
12776 -iprefix prefix
12777 Specify prefix as the prefix for subsequent -iwithprefix options.
12778 If the prefix represents a directory, you should include the final
12779 /.
12780
12781 -iwithprefix dir
12782 -iwithprefixbefore dir
12783 Append dir to the prefix specified previously with -iprefix, and
12784 add the resulting directory to the include search path.
12785 -iwithprefixbefore puts it in the same place -I would; -iwithprefix
12786 puts it where -idirafter would.
12787
12788 -isysroot dir
12789 This option is like the --sysroot option, but applies only to
12790 header files (except for Darwin targets, where it applies to both
12791 header files and libraries). See the --sysroot option for more
12792 information.
12793
12794 -imultilib dir
12795 Use dir as a subdirectory of the directory containing target-
12796 specific C++ headers.
12797
12798 -nostdinc
12799 Do not search the standard system directories for header files.
12800 Only the directories explicitly specified with -I, -iquote,
12801 -isystem, and/or -idirafter options (and the directory of the
12802 current file, if appropriate) are searched.
12803
12804 -nostdinc++
12805 Do not search for header files in the C++-specific standard
12806 directories, but do still search the other standard directories.
12807 (This option is used when building the C++ library.)
12808
12809 -iplugindir=dir
12810 Set the directory to search for plugins that are passed by
12811 -fplugin=name instead of -fplugin=path/name.so. This option is not
12812 meant to be used by the user, but only passed by the driver.
12813
12814 -Ldir
12815 Add directory dir to the list of directories to be searched for -l.
12816
12817 -Bprefix
12818 This option specifies where to find the executables, libraries,
12819 include files, and data files of the compiler itself.
12820
12821 The compiler driver program runs one or more of the subprograms
12822 cpp, cc1, as and ld. It tries prefix as a prefix for each program
12823 it tries to run, both with and without machine/version/ for the
12824 corresponding target machine and compiler version.
12825
12826 For each subprogram to be run, the compiler driver first tries the
12827 -B prefix, if any. If that name is not found, or if -B is not
12828 specified, the driver tries two standard prefixes, /usr/lib/gcc/
12829 and /usr/local/lib/gcc/. If neither of those results in a file
12830 name that is found, the unmodified program name is searched for
12831 using the directories specified in your PATH environment variable.
12832
12833 The compiler checks to see if the path provided by -B refers to a
12834 directory, and if necessary it adds a directory separator character
12835 at the end of the path.
12836
12837 -B prefixes that effectively specify directory names also apply to
12838 libraries in the linker, because the compiler translates these
12839 options into -L options for the linker. They also apply to include
12840 files in the preprocessor, because the compiler translates these
12841 options into -isystem options for the preprocessor. In this case,
12842 the compiler appends include to the prefix.
12843
12844 The runtime support file libgcc.a can also be searched for using
12845 the -B prefix, if needed. If it is not found there, the two
12846 standard prefixes above are tried, and that is all. The file is
12847 left out of the link if it is not found by those means.
12848
12849 Another way to specify a prefix much like the -B prefix is to use
12850 the environment variable GCC_EXEC_PREFIX.
12851
12852 As a special kludge, if the path provided by -B is [dir/]stageN/,
12853 where N is a number in the range 0 to 9, then it is replaced by
12854 [dir/]include. This is to help with boot-strapping the compiler.
12855
12856 -no-canonical-prefixes
12857 Do not expand any symbolic links, resolve references to /../ or
12858 /./, or make the path absolute when generating a relative prefix.
12859
12860 --sysroot=dir
12861 Use dir as the logical root directory for headers and libraries.
12862 For example, if the compiler normally searches for headers in
12863 /usr/include and libraries in /usr/lib, it instead searches
12864 dir/usr/include and dir/usr/lib.
12865
12866 If you use both this option and the -isysroot option, then the
12867 --sysroot option applies to libraries, but the -isysroot option
12868 applies to header files.
12869
12870 The GNU linker (beginning with version 2.16) has the necessary
12871 support for this option. If your linker does not support this
12872 option, the header file aspect of --sysroot still works, but the
12873 library aspect does not.
12874
12875 --no-sysroot-suffix
12876 For some targets, a suffix is added to the root directory specified
12877 with --sysroot, depending on the other options used, so that
12878 headers may for example be found in dir/suffix/usr/include instead
12879 of dir/usr/include. This option disables the addition of such a
12880 suffix.
12881
12882 Options for Code Generation Conventions
12883 These machine-independent options control the interface conventions
12884 used in code generation.
12885
12886 Most of them have both positive and negative forms; the negative form
12887 of -ffoo is -fno-foo. In the table below, only one of the forms is
12888 listed---the one that is not the default. You can figure out the other
12889 form by either removing no- or adding it.
12890
12891 -fstack-reuse=reuse-level
12892 This option controls stack space reuse for user declared local/auto
12893 variables and compiler generated temporaries. reuse_level can be
12894 all, named_vars, or none. all enables stack reuse for all local
12895 variables and temporaries, named_vars enables the reuse only for
12896 user defined local variables with names, and none disables stack
12897 reuse completely. The default value is all. The option is needed
12898 when the program extends the lifetime of a scoped local variable or
12899 a compiler generated temporary beyond the end point defined by the
12900 language. When a lifetime of a variable ends, and if the variable
12901 lives in memory, the optimizing compiler has the freedom to reuse
12902 its stack space with other temporaries or scoped local variables
12903 whose live range does not overlap with it. Legacy code extending
12904 local lifetime is likely to break with the stack reuse
12905 optimization.
12906
12907 For example,
12908
12909 int *p;
12910 {
12911 int local1;
12912
12913 p = &local1;
12914 local1 = 10;
12915 ....
12916 }
12917 {
12918 int local2;
12919 local2 = 20;
12920 ...
12921 }
12922
12923 if (*p == 10) // out of scope use of local1
12924 {
12925
12926 }
12927
12928 Another example:
12929
12930 struct A
12931 {
12932 A(int k) : i(k), j(k) { }
12933 int i;
12934 int j;
12935 };
12936
12937 A *ap;
12938
12939 void foo(const A& ar)
12940 {
12941 ap = &ar;
12942 }
12943
12944 void bar()
12945 {
12946 foo(A(10)); // temp object's lifetime ends when foo returns
12947
12948 {
12949 A a(20);
12950 ....
12951 }
12952 ap->i+= 10; // ap references out of scope temp whose space
12953 // is reused with a. What is the value of ap->i?
12954 }
12955
12956 The lifetime of a compiler generated temporary is well defined by
12957 the C++ standard. When a lifetime of a temporary ends, and if the
12958 temporary lives in memory, the optimizing compiler has the freedom
12959 to reuse its stack space with other temporaries or scoped local
12960 variables whose live range does not overlap with it. However some
12961 of the legacy code relies on the behavior of older compilers in
12962 which temporaries' stack space is not reused, the aggressive stack
12963 reuse can lead to runtime errors. This option is used to control
12964 the temporary stack reuse optimization.
12965
12966 -ftrapv
12967 This option generates traps for signed overflow on addition,
12968 subtraction, multiplication operations. The options -ftrapv and
12969 -fwrapv override each other, so using -ftrapv -fwrapv on the
12970 command-line results in -fwrapv being effective. Note that only
12971 active options override, so using -ftrapv -fwrapv -fno-wrapv on the
12972 command-line results in -ftrapv being effective.
12973
12974 -fwrapv
12975 This option instructs the compiler to assume that signed arithmetic
12976 overflow of addition, subtraction and multiplication wraps around
12977 using twos-complement representation. This flag enables some
12978 optimizations and disables others. The options -ftrapv and -fwrapv
12979 override each other, so using -ftrapv -fwrapv on the command-line
12980 results in -fwrapv being effective. Note that only active options
12981 override, so using -ftrapv -fwrapv -fno-wrapv on the command-line
12982 results in -ftrapv being effective.
12983
12984 -fwrapv-pointer
12985 This option instructs the compiler to assume that pointer
12986 arithmetic overflow on addition and subtraction wraps around using
12987 twos-complement representation. This flag disables some
12988 optimizations which assume pointer overflow is invalid.
12989
12990 -fstrict-overflow
12991 This option implies -fno-wrapv -fno-wrapv-pointer and when negated
12992 implies -fwrapv -fwrapv-pointer.
12993
12994 -fexceptions
12995 Enable exception handling. Generates extra code needed to
12996 propagate exceptions. For some targets, this implies GCC generates
12997 frame unwind information for all functions, which can produce
12998 significant data size overhead, although it does not affect
12999 execution. If you do not specify this option, GCC enables it by
13000 default for languages like C++ that normally require exception
13001 handling, and disables it for languages like C that do not normally
13002 require it. However, you may need to enable this option when
13003 compiling C code that needs to interoperate properly with exception
13004 handlers written in C++. You may also wish to disable this option
13005 if you are compiling older C++ programs that don't use exception
13006 handling.
13007
13008 -fnon-call-exceptions
13009 Generate code that allows trapping instructions to throw
13010 exceptions. Note that this requires platform-specific runtime
13011 support that does not exist everywhere. Moreover, it only allows
13012 trapping instructions to throw exceptions, i.e. memory references
13013 or floating-point instructions. It does not allow exceptions to be
13014 thrown from arbitrary signal handlers such as "SIGALRM".
13015
13016 -fdelete-dead-exceptions
13017 Consider that instructions that may throw exceptions but don't
13018 otherwise contribute to the execution of the program can be
13019 optimized away. This option is enabled by default for the Ada
13020 front end, as permitted by the Ada language specification.
13021 Optimization passes that cause dead exceptions to be removed are
13022 enabled independently at different optimization levels.
13023
13024 -funwind-tables
13025 Similar to -fexceptions, except that it just generates any needed
13026 static data, but does not affect the generated code in any other
13027 way. You normally do not need to enable this option; instead, a
13028 language processor that needs this handling enables it on your
13029 behalf.
13030
13031 -fasynchronous-unwind-tables
13032 Generate unwind table in DWARF format, if supported by target
13033 machine. The table is exact at each instruction boundary, so it
13034 can be used for stack unwinding from asynchronous events (such as
13035 debugger or garbage collector).
13036
13037 -fno-gnu-unique
13038 On systems with recent GNU assembler and C library, the C++
13039 compiler uses the "STB_GNU_UNIQUE" binding to make sure that
13040 definitions of template static data members and static local
13041 variables in inline functions are unique even in the presence of
13042 "RTLD_LOCAL"; this is necessary to avoid problems with a library
13043 used by two different "RTLD_LOCAL" plugins depending on a
13044 definition in one of them and therefore disagreeing with the other
13045 one about the binding of the symbol. But this causes "dlclose" to
13046 be ignored for affected DSOs; if your program relies on
13047 reinitialization of a DSO via "dlclose" and "dlopen", you can use
13048 -fno-gnu-unique.
13049
13050 -fpcc-struct-return
13051 Return "short" "struct" and "union" values in memory like longer
13052 ones, rather than in registers. This convention is less efficient,
13053 but it has the advantage of allowing intercallability between GCC-
13054 compiled files and files compiled with other compilers,
13055 particularly the Portable C Compiler (pcc).
13056
13057 The precise convention for returning structures in memory depends
13058 on the target configuration macros.
13059
13060 Short structures and unions are those whose size and alignment
13061 match that of some integer type.
13062
13063 Warning: code compiled with the -fpcc-struct-return switch is not
13064 binary compatible with code compiled with the -freg-struct-return
13065 switch. Use it to conform to a non-default application binary
13066 interface.
13067
13068 -freg-struct-return
13069 Return "struct" and "union" values in registers when possible.
13070 This is more efficient for small structures than
13071 -fpcc-struct-return.
13072
13073 If you specify neither -fpcc-struct-return nor -freg-struct-return,
13074 GCC defaults to whichever convention is standard for the target.
13075 If there is no standard convention, GCC defaults to
13076 -fpcc-struct-return, except on targets where GCC is the principal
13077 compiler. In those cases, we can choose the standard, and we chose
13078 the more efficient register return alternative.
13079
13080 Warning: code compiled with the -freg-struct-return switch is not
13081 binary compatible with code compiled with the -fpcc-struct-return
13082 switch. Use it to conform to a non-default application binary
13083 interface.
13084
13085 -fshort-enums
13086 Allocate to an "enum" type only as many bytes as it needs for the
13087 declared range of possible values. Specifically, the "enum" type
13088 is equivalent to the smallest integer type that has enough room.
13089
13090 Warning: the -fshort-enums switch causes GCC to generate code that
13091 is not binary compatible with code generated without that switch.
13092 Use it to conform to a non-default application binary interface.
13093
13094 -fshort-wchar
13095 Override the underlying type for "wchar_t" to be "short unsigned
13096 int" instead of the default for the target. This option is useful
13097 for building programs to run under WINE.
13098
13099 Warning: the -fshort-wchar switch causes GCC to generate code that
13100 is not binary compatible with code generated without that switch.
13101 Use it to conform to a non-default application binary interface.
13102
13103 -fcommon
13104 In C code, this option controls the placement of global variables
13105 defined without an initializer, known as tentative definitions in
13106 the C standard. Tentative definitions are distinct from
13107 declarations of a variable with the "extern" keyword, which do not
13108 allocate storage.
13109
13110 The default is -fno-common, which specifies that the compiler
13111 places uninitialized global variables in the BSS section of the
13112 object file. This inhibits the merging of tentative definitions by
13113 the linker so you get a multiple-definition error if the same
13114 variable is accidentally defined in more than one compilation unit.
13115
13116 The -fcommon places uninitialized global variables in a common
13117 block. This allows the linker to resolve all tentative definitions
13118 of the same variable in different compilation units to the same
13119 object, or to a non-tentative definition. This behavior is
13120 inconsistent with C++, and on many targets implies a speed and code
13121 size penalty on global variable references. It is mainly useful to
13122 enable legacy code to link without errors.
13123
13124 -fno-ident
13125 Ignore the "#ident" directive.
13126
13127 -finhibit-size-directive
13128 Don't output a ".size" assembler directive, or anything else that
13129 would cause trouble if the function is split in the middle, and the
13130 two halves are placed at locations far apart in memory. This
13131 option is used when compiling crtstuff.c; you should not need to
13132 use it for anything else.
13133
13134 -fverbose-asm
13135 Put extra commentary information in the generated assembly code to
13136 make it more readable. This option is generally only of use to
13137 those who actually need to read the generated assembly code
13138 (perhaps while debugging the compiler itself).
13139
13140 -fno-verbose-asm, the default, causes the extra information to be
13141 omitted and is useful when comparing two assembler files.
13142
13143 The added comments include:
13144
13145 * information on the compiler version and command-line options,
13146
13147 * the source code lines associated with the assembly
13148 instructions, in the form FILENAME:LINENUMBER:CONTENT OF LINE,
13149
13150 * hints on which high-level expressions correspond to the various
13151 assembly instruction operands.
13152
13153 For example, given this C source file:
13154
13155 int test (int n)
13156 {
13157 int i;
13158 int total = 0;
13159
13160 for (i = 0; i < n; i++)
13161 total += i * i;
13162
13163 return total;
13164 }
13165
13166 compiling to (x86_64) assembly via -S and emitting the result
13167 direct to stdout via -o -
13168
13169 gcc -S test.c -fverbose-asm -Os -o -
13170
13171 gives output similar to this:
13172
13173 .file "test.c"
13174 # GNU C11 (GCC) version 7.0.0 20160809 (experimental) (x86_64-pc-linux-gnu)
13175 [...snip...]
13176 # options passed:
13177 [...snip...]
13178
13179 .text
13180 .globl test
13181 .type test, @function
13182 test:
13183 .LFB0:
13184 .cfi_startproc
13185 # test.c:4: int total = 0;
13186 xorl %eax, %eax # <retval>
13187 # test.c:6: for (i = 0; i < n; i++)
13188 xorl %edx, %edx # i
13189 .L2:
13190 # test.c:6: for (i = 0; i < n; i++)
13191 cmpl %edi, %edx # n, i
13192 jge .L5 #,
13193 # test.c:7: total += i * i;
13194 movl %edx, %ecx # i, tmp92
13195 imull %edx, %ecx # i, tmp92
13196 # test.c:6: for (i = 0; i < n; i++)
13197 incl %edx # i
13198 # test.c:7: total += i * i;
13199 addl %ecx, %eax # tmp92, <retval>
13200 jmp .L2 #
13201 .L5:
13202 # test.c:10: }
13203 ret
13204 .cfi_endproc
13205 .LFE0:
13206 .size test, .-test
13207 .ident "GCC: (GNU) 7.0.0 20160809 (experimental)"
13208 .section .note.GNU-stack,"",@progbits
13209
13210 The comments are intended for humans rather than machines and hence
13211 the precise format of the comments is subject to change.
13212
13213 -frecord-gcc-switches
13214 This switch causes the command line used to invoke the compiler to
13215 be recorded into the object file that is being created. This
13216 switch is only implemented on some targets and the exact format of
13217 the recording is target and binary file format dependent, but it
13218 usually takes the form of a section containing ASCII text. This
13219 switch is related to the -fverbose-asm switch, but that switch only
13220 records information in the assembler output file as comments, so it
13221 never reaches the object file. See also -grecord-gcc-switches for
13222 another way of storing compiler options into the object file.
13223
13224 -fpic
13225 Generate position-independent code (PIC) suitable for use in a
13226 shared library, if supported for the target machine. Such code
13227 accesses all constant addresses through a global offset table
13228 (GOT). The dynamic loader resolves the GOT entries when the
13229 program starts (the dynamic loader is not part of GCC; it is part
13230 of the operating system). If the GOT size for the linked
13231 executable exceeds a machine-specific maximum size, you get an
13232 error message from the linker indicating that -fpic does not work;
13233 in that case, recompile with -fPIC instead. (These maximums are 8k
13234 on the SPARC, 28k on AArch64 and 32k on the m68k and RS/6000. The
13235 x86 has no such limit.)
13236
13237 Position-independent code requires special support, and therefore
13238 works only on certain machines. For the x86, GCC supports PIC for
13239 System V but not for the Sun 386i. Code generated for the IBM
13240 RS/6000 is always position-independent.
13241
13242 When this flag is set, the macros "__pic__" and "__PIC__" are
13243 defined to 1.
13244
13245 -fPIC
13246 If supported for the target machine, emit position-independent
13247 code, suitable for dynamic linking and avoiding any limit on the
13248 size of the global offset table. This option makes a difference on
13249 AArch64, m68k, PowerPC and SPARC.
13250
13251 Position-independent code requires special support, and therefore
13252 works only on certain machines.
13253
13254 When this flag is set, the macros "__pic__" and "__PIC__" are
13255 defined to 2.
13256
13257 -fpie
13258 -fPIE
13259 These options are similar to -fpic and -fPIC, but the generated
13260 position-independent code can be only linked into executables.
13261 Usually these options are used to compile code that will be linked
13262 using the -pie GCC option.
13263
13264 -fpie and -fPIE both define the macros "__pie__" and "__PIE__".
13265 The macros have the value 1 for -fpie and 2 for -fPIE.
13266
13267 -fno-plt
13268 Do not use the PLT for external function calls in position-
13269 independent code. Instead, load the callee address at call sites
13270 from the GOT and branch to it. This leads to more efficient code
13271 by eliminating PLT stubs and exposing GOT loads to optimizations.
13272 On architectures such as 32-bit x86 where PLT stubs expect the GOT
13273 pointer in a specific register, this gives more register allocation
13274 freedom to the compiler. Lazy binding requires use of the PLT;
13275 with -fno-plt all external symbols are resolved at load time.
13276
13277 Alternatively, the function attribute "noplt" can be used to avoid
13278 calls through the PLT for specific external functions.
13279
13280 In position-dependent code, a few targets also convert calls to
13281 functions that are marked to not use the PLT to use the GOT
13282 instead.
13283
13284 -fno-jump-tables
13285 Do not use jump tables for switch statements even where it would be
13286 more efficient than other code generation strategies. This option
13287 is of use in conjunction with -fpic or -fPIC for building code that
13288 forms part of a dynamic linker and cannot reference the address of
13289 a jump table. On some targets, jump tables do not require a GOT
13290 and this option is not needed.
13291
13292 -ffixed-reg
13293 Treat the register named reg as a fixed register; generated code
13294 should never refer to it (except perhaps as a stack pointer, frame
13295 pointer or in some other fixed role).
13296
13297 reg must be the name of a register. The register names accepted
13298 are machine-specific and are defined in the "REGISTER_NAMES" macro
13299 in the machine description macro file.
13300
13301 This flag does not have a negative form, because it specifies a
13302 three-way choice.
13303
13304 -fcall-used-reg
13305 Treat the register named reg as an allocable register that is
13306 clobbered by function calls. It may be allocated for temporaries
13307 or variables that do not live across a call. Functions compiled
13308 this way do not save and restore the register reg.
13309
13310 It is an error to use this flag with the frame pointer or stack
13311 pointer. Use of this flag for other registers that have fixed
13312 pervasive roles in the machine's execution model produces
13313 disastrous results.
13314
13315 This flag does not have a negative form, because it specifies a
13316 three-way choice.
13317
13318 -fcall-saved-reg
13319 Treat the register named reg as an allocable register saved by
13320 functions. It may be allocated even for temporaries or variables
13321 that live across a call. Functions compiled this way save and
13322 restore the register reg if they use it.
13323
13324 It is an error to use this flag with the frame pointer or stack
13325 pointer. Use of this flag for other registers that have fixed
13326 pervasive roles in the machine's execution model produces
13327 disastrous results.
13328
13329 A different sort of disaster results from the use of this flag for
13330 a register in which function values may be returned.
13331
13332 This flag does not have a negative form, because it specifies a
13333 three-way choice.
13334
13335 -fpack-struct[=n]
13336 Without a value specified, pack all structure members together
13337 without holes. When a value is specified (which must be a small
13338 power of two), pack structure members according to this value,
13339 representing the maximum alignment (that is, objects with default
13340 alignment requirements larger than this are output potentially
13341 unaligned at the next fitting location.
13342
13343 Warning: the -fpack-struct switch causes GCC to generate code that
13344 is not binary compatible with code generated without that switch.
13345 Additionally, it makes the code suboptimal. Use it to conform to a
13346 non-default application binary interface.
13347
13348 -fleading-underscore
13349 This option and its counterpart, -fno-leading-underscore, forcibly
13350 change the way C symbols are represented in the object file. One
13351 use is to help link with legacy assembly code.
13352
13353 Warning: the -fleading-underscore switch causes GCC to generate
13354 code that is not binary compatible with code generated without that
13355 switch. Use it to conform to a non-default application binary
13356 interface. Not all targets provide complete support for this
13357 switch.
13358
13359 -ftls-model=model
13360 Alter the thread-local storage model to be used. The model
13361 argument should be one of global-dynamic, local-dynamic, initial-
13362 exec or local-exec. Note that the choice is subject to
13363 optimization: the compiler may use a more efficient model for
13364 symbols not visible outside of the translation unit, or if -fpic is
13365 not given on the command line.
13366
13367 The default without -fpic is initial-exec; with -fpic the default
13368 is global-dynamic.
13369
13370 -ftrampolines
13371 For targets that normally need trampolines for nested functions,
13372 always generate them instead of using descriptors. Otherwise, for
13373 targets that do not need them, like for example HP-PA or IA-64, do
13374 nothing.
13375
13376 A trampoline is a small piece of code that is created at run time
13377 on the stack when the address of a nested function is taken, and is
13378 used to call the nested function indirectly. Therefore, it
13379 requires the stack to be made executable in order for the program
13380 to work properly.
13381
13382 -fno-trampolines is enabled by default on a language by language
13383 basis to let the compiler avoid generating them, if it computes
13384 that this is safe, and replace them with descriptors. Descriptors
13385 are made up of data only, but the generated code must be prepared
13386 to deal with them. As of this writing, -fno-trampolines is enabled
13387 by default only for Ada.
13388
13389 Moreover, code compiled with -ftrampolines and code compiled with
13390 -fno-trampolines are not binary compatible if nested functions are
13391 present. This option must therefore be used on a program-wide
13392 basis and be manipulated with extreme care.
13393
13394 -fvisibility=[default|internal|hidden|protected]
13395 Set the default ELF image symbol visibility to the specified
13396 option---all symbols are marked with this unless overridden within
13397 the code. Using this feature can very substantially improve
13398 linking and load times of shared object libraries, produce more
13399 optimized code, provide near-perfect API export and prevent symbol
13400 clashes. It is strongly recommended that you use this in any
13401 shared objects you distribute.
13402
13403 Despite the nomenclature, default always means public; i.e.,
13404 available to be linked against from outside the shared object.
13405 protected and internal are pretty useless in real-world usage so
13406 the only other commonly used option is hidden. The default if
13407 -fvisibility isn't specified is default, i.e., make every symbol
13408 public.
13409
13410 A good explanation of the benefits offered by ensuring ELF symbols
13411 have the correct visibility is given by "How To Write Shared
13412 Libraries" by Ulrich Drepper (which can be found at
13413 <https://www.akkadia.org/drepper/>)---however a superior solution
13414 made possible by this option to marking things hidden when the
13415 default is public is to make the default hidden and mark things
13416 public. This is the norm with DLLs on Windows and with
13417 -fvisibility=hidden and "__attribute__ ((visibility("default")))"
13418 instead of "__declspec(dllexport)" you get almost identical
13419 semantics with identical syntax. This is a great boon to those
13420 working with cross-platform projects.
13421
13422 For those adding visibility support to existing code, you may find
13423 "#pragma GCC visibility" of use. This works by you enclosing the
13424 declarations you wish to set visibility for with (for example)
13425 "#pragma GCC visibility push(hidden)" and "#pragma GCC visibility
13426 pop". Bear in mind that symbol visibility should be viewed as part
13427 of the API interface contract and thus all new code should always
13428 specify visibility when it is not the default; i.e., declarations
13429 only for use within the local DSO should always be marked
13430 explicitly as hidden as so to avoid PLT indirection
13431 overheads---making this abundantly clear also aids readability and
13432 self-documentation of the code. Note that due to ISO C++
13433 specification requirements, "operator new" and "operator delete"
13434 must always be of default visibility.
13435
13436 Be aware that headers from outside your project, in particular
13437 system headers and headers from any other library you use, may not
13438 be expecting to be compiled with visibility other than the default.
13439 You may need to explicitly say "#pragma GCC visibility
13440 push(default)" before including any such headers.
13441
13442 "extern" declarations are not affected by -fvisibility, so a lot of
13443 code can be recompiled with -fvisibility=hidden with no
13444 modifications. However, this means that calls to "extern"
13445 functions with no explicit visibility use the PLT, so it is more
13446 effective to use "__attribute ((visibility))" and/or "#pragma GCC
13447 visibility" to tell the compiler which "extern" declarations should
13448 be treated as hidden.
13449
13450 Note that -fvisibility does affect C++ vague linkage entities. This
13451 means that, for instance, an exception class that is be thrown
13452 between DSOs must be explicitly marked with default visibility so
13453 that the type_info nodes are unified between the DSOs.
13454
13455 An overview of these techniques, their benefits and how to use them
13456 is at <http://gcc.gnu.org/wiki/Visibility>.
13457
13458 -fstrict-volatile-bitfields
13459 This option should be used if accesses to volatile bit-fields (or
13460 other structure fields, although the compiler usually honors those
13461 types anyway) should use a single access of the width of the
13462 field's type, aligned to a natural alignment if possible. For
13463 example, targets with memory-mapped peripheral registers might
13464 require all such accesses to be 16 bits wide; with this flag you
13465 can declare all peripheral bit-fields as "unsigned short" (assuming
13466 short is 16 bits on these targets) to force GCC to use 16-bit
13467 accesses instead of, perhaps, a more efficient 32-bit access.
13468
13469 If this option is disabled, the compiler uses the most efficient
13470 instruction. In the previous example, that might be a 32-bit load
13471 instruction, even though that accesses bytes that do not contain
13472 any portion of the bit-field, or memory-mapped registers unrelated
13473 to the one being updated.
13474
13475 In some cases, such as when the "packed" attribute is applied to a
13476 structure field, it may not be possible to access the field with a
13477 single read or write that is correctly aligned for the target
13478 machine. In this case GCC falls back to generating multiple
13479 accesses rather than code that will fault or truncate the result at
13480 run time.
13481
13482 Note: Due to restrictions of the C/C++11 memory model, write
13483 accesses are not allowed to touch non bit-field members. It is
13484 therefore recommended to define all bits of the field's type as
13485 bit-field members.
13486
13487 The default value of this option is determined by the application
13488 binary interface for the target processor.
13489
13490 -fsync-libcalls
13491 This option controls whether any out-of-line instance of the
13492 "__sync" family of functions may be used to implement the C++11
13493 "__atomic" family of functions.
13494
13495 The default value of this option is enabled, thus the only useful
13496 form of the option is -fno-sync-libcalls. This option is used in
13497 the implementation of the libatomic runtime library.
13498
13499 GCC Developer Options
13500 This section describes command-line options that are primarily of
13501 interest to GCC developers, including options to support compiler
13502 testing and investigation of compiler bugs and compile-time performance
13503 problems. This includes options that produce debug dumps at various
13504 points in the compilation; that print statistics such as memory use and
13505 execution time; and that print information about GCC's configuration,
13506 such as where it searches for libraries. You should rarely need to use
13507 any of these options for ordinary compilation and linking tasks.
13508
13509 Many developer options that cause GCC to dump output to a file take an
13510 optional =filename suffix. You can specify stdout or - to dump to
13511 standard output, and stderr for standard error.
13512
13513 If =filename is omitted, a default dump file name is constructed by
13514 concatenating the base dump file name, a pass number, phase letter, and
13515 pass name. The base dump file name is the name of output file produced
13516 by the compiler if explicitly specified and not an executable;
13517 otherwise it is the source file name. The pass number is determined by
13518 the order passes are registered with the compiler's pass manager. This
13519 is generally the same as the order of execution, but passes registered
13520 by plugins, target-specific passes, or passes that are otherwise
13521 registered late are numbered higher than the pass named final, even if
13522 they are executed earlier. The phase letter is one of i (inter-
13523 procedural analysis), l (language-specific), r (RTL), or t (tree). The
13524 files are created in the directory of the output file.
13525
13526 -fcallgraph-info
13527 -fcallgraph-info=MARKERS
13528 Makes the compiler output callgraph information for the program, on
13529 a per-object-file basis. The information is generated in the
13530 common VCG format. It can be decorated with additional, per-node
13531 and/or per-edge information, if a list of comma-separated markers
13532 is additionally specified. When the "su" marker is specified, the
13533 callgraph is decorated with stack usage information; it is
13534 equivalent to -fstack-usage. When the "da" marker is specified,
13535 the callgraph is decorated with information about dynamically
13536 allocated objects.
13537
13538 When compiling with -flto, no callgraph information is output along
13539 with the object file. At LTO link time, -fcallgraph-info may
13540 generate multiple callgraph information files next to intermediate
13541 LTO output files.
13542
13543 -dletters
13544 -fdump-rtl-pass
13545 -fdump-rtl-pass=filename
13546 Says to make debugging dumps during compilation at times specified
13547 by letters. This is used for debugging the RTL-based passes of the
13548 compiler.
13549
13550 Some -dletters switches have different meaning when -E is used for
13551 preprocessing.
13552
13553 Debug dumps can be enabled with a -fdump-rtl switch or some -d
13554 option letters. Here are the possible letters for use in pass and
13555 letters, and their meanings:
13556
13557 -fdump-rtl-alignments
13558 Dump after branch alignments have been computed.
13559
13560 -fdump-rtl-asmcons
13561 Dump after fixing rtl statements that have unsatisfied in/out
13562 constraints.
13563
13564 -fdump-rtl-auto_inc_dec
13565 Dump after auto-inc-dec discovery. This pass is only run on
13566 architectures that have auto inc or auto dec instructions.
13567
13568 -fdump-rtl-barriers
13569 Dump after cleaning up the barrier instructions.
13570
13571 -fdump-rtl-bbpart
13572 Dump after partitioning hot and cold basic blocks.
13573
13574 -fdump-rtl-bbro
13575 Dump after block reordering.
13576
13577 -fdump-rtl-btl1
13578 -fdump-rtl-btl2
13579 -fdump-rtl-btl1 and -fdump-rtl-btl2 enable dumping after the
13580 two branch target load optimization passes.
13581
13582 -fdump-rtl-bypass
13583 Dump after jump bypassing and control flow optimizations.
13584
13585 -fdump-rtl-combine
13586 Dump after the RTL instruction combination pass.
13587
13588 -fdump-rtl-compgotos
13589 Dump after duplicating the computed gotos.
13590
13591 -fdump-rtl-ce1
13592 -fdump-rtl-ce2
13593 -fdump-rtl-ce3
13594 -fdump-rtl-ce1, -fdump-rtl-ce2, and -fdump-rtl-ce3 enable
13595 dumping after the three if conversion passes.
13596
13597 -fdump-rtl-cprop_hardreg
13598 Dump after hard register copy propagation.
13599
13600 -fdump-rtl-csa
13601 Dump after combining stack adjustments.
13602
13603 -fdump-rtl-cse1
13604 -fdump-rtl-cse2
13605 -fdump-rtl-cse1 and -fdump-rtl-cse2 enable dumping after the
13606 two common subexpression elimination passes.
13607
13608 -fdump-rtl-dce
13609 Dump after the standalone dead code elimination passes.
13610
13611 -fdump-rtl-dbr
13612 Dump after delayed branch scheduling.
13613
13614 -fdump-rtl-dce1
13615 -fdump-rtl-dce2
13616 -fdump-rtl-dce1 and -fdump-rtl-dce2 enable dumping after the
13617 two dead store elimination passes.
13618
13619 -fdump-rtl-eh
13620 Dump after finalization of EH handling code.
13621
13622 -fdump-rtl-eh_ranges
13623 Dump after conversion of EH handling range regions.
13624
13625 -fdump-rtl-expand
13626 Dump after RTL generation.
13627
13628 -fdump-rtl-fwprop1
13629 -fdump-rtl-fwprop2
13630 -fdump-rtl-fwprop1 and -fdump-rtl-fwprop2 enable dumping after
13631 the two forward propagation passes.
13632
13633 -fdump-rtl-gcse1
13634 -fdump-rtl-gcse2
13635 -fdump-rtl-gcse1 and -fdump-rtl-gcse2 enable dumping after
13636 global common subexpression elimination.
13637
13638 -fdump-rtl-init-regs
13639 Dump after the initialization of the registers.
13640
13641 -fdump-rtl-initvals
13642 Dump after the computation of the initial value sets.
13643
13644 -fdump-rtl-into_cfglayout
13645 Dump after converting to cfglayout mode.
13646
13647 -fdump-rtl-ira
13648 Dump after iterated register allocation.
13649
13650 -fdump-rtl-jump
13651 Dump after the second jump optimization.
13652
13653 -fdump-rtl-loop2
13654 -fdump-rtl-loop2 enables dumping after the rtl loop
13655 optimization passes.
13656
13657 -fdump-rtl-mach
13658 Dump after performing the machine dependent reorganization
13659 pass, if that pass exists.
13660
13661 -fdump-rtl-mode_sw
13662 Dump after removing redundant mode switches.
13663
13664 -fdump-rtl-rnreg
13665 Dump after register renumbering.
13666
13667 -fdump-rtl-outof_cfglayout
13668 Dump after converting from cfglayout mode.
13669
13670 -fdump-rtl-peephole2
13671 Dump after the peephole pass.
13672
13673 -fdump-rtl-postreload
13674 Dump after post-reload optimizations.
13675
13676 -fdump-rtl-pro_and_epilogue
13677 Dump after generating the function prologues and epilogues.
13678
13679 -fdump-rtl-sched1
13680 -fdump-rtl-sched2
13681 -fdump-rtl-sched1 and -fdump-rtl-sched2 enable dumping after
13682 the basic block scheduling passes.
13683
13684 -fdump-rtl-ree
13685 Dump after sign/zero extension elimination.
13686
13687 -fdump-rtl-seqabstr
13688 Dump after common sequence discovery.
13689
13690 -fdump-rtl-shorten
13691 Dump after shortening branches.
13692
13693 -fdump-rtl-sibling
13694 Dump after sibling call optimizations.
13695
13696 -fdump-rtl-split1
13697 -fdump-rtl-split2
13698 -fdump-rtl-split3
13699 -fdump-rtl-split4
13700 -fdump-rtl-split5
13701 These options enable dumping after five rounds of instruction
13702 splitting.
13703
13704 -fdump-rtl-sms
13705 Dump after modulo scheduling. This pass is only run on some
13706 architectures.
13707
13708 -fdump-rtl-stack
13709 Dump after conversion from GCC's "flat register file" registers
13710 to the x87's stack-like registers. This pass is only run on
13711 x86 variants.
13712
13713 -fdump-rtl-subreg1
13714 -fdump-rtl-subreg2
13715 -fdump-rtl-subreg1 and -fdump-rtl-subreg2 enable dumping after
13716 the two subreg expansion passes.
13717
13718 -fdump-rtl-unshare
13719 Dump after all rtl has been unshared.
13720
13721 -fdump-rtl-vartrack
13722 Dump after variable tracking.
13723
13724 -fdump-rtl-vregs
13725 Dump after converting virtual registers to hard registers.
13726
13727 -fdump-rtl-web
13728 Dump after live range splitting.
13729
13730 -fdump-rtl-regclass
13731 -fdump-rtl-subregs_of_mode_init
13732 -fdump-rtl-subregs_of_mode_finish
13733 -fdump-rtl-dfinit
13734 -fdump-rtl-dfinish
13735 These dumps are defined but always produce empty files.
13736
13737 -da
13738 -fdump-rtl-all
13739 Produce all the dumps listed above.
13740
13741 -dA Annotate the assembler output with miscellaneous debugging
13742 information.
13743
13744 -dD Dump all macro definitions, at the end of preprocessing, in
13745 addition to normal output.
13746
13747 -dH Produce a core dump whenever an error occurs.
13748
13749 -dp Annotate the assembler output with a comment indicating which
13750 pattern and alternative is used. The length and cost of each
13751 instruction are also printed.
13752
13753 -dP Dump the RTL in the assembler output as a comment before each
13754 instruction. Also turns on -dp annotation.
13755
13756 -dx Just generate RTL for a function instead of compiling it.
13757 Usually used with -fdump-rtl-expand.
13758
13759 -fdump-debug
13760 Dump debugging information generated during the debug generation
13761 phase.
13762
13763 -fdump-earlydebug
13764 Dump debugging information generated during the early debug
13765 generation phase.
13766
13767 -fdump-noaddr
13768 When doing debugging dumps, suppress address output. This makes it
13769 more feasible to use diff on debugging dumps for compiler
13770 invocations with different compiler binaries and/or different text
13771 / bss / data / heap / stack / dso start locations.
13772
13773 -freport-bug
13774 Collect and dump debug information into a temporary file if an
13775 internal compiler error (ICE) occurs.
13776
13777 -fdump-unnumbered
13778 When doing debugging dumps, suppress instruction numbers and
13779 address output. This makes it more feasible to use diff on
13780 debugging dumps for compiler invocations with different options, in
13781 particular with and without -g.
13782
13783 -fdump-unnumbered-links
13784 When doing debugging dumps (see -d option above), suppress
13785 instruction numbers for the links to the previous and next
13786 instructions in a sequence.
13787
13788 -fdump-ipa-switch
13789 -fdump-ipa-switch-options
13790 Control the dumping at various stages of inter-procedural analysis
13791 language tree to a file. The file name is generated by appending a
13792 switch specific suffix to the source file name, and the file is
13793 created in the same directory as the output file. The following
13794 dumps are possible:
13795
13796 all Enables all inter-procedural analysis dumps.
13797
13798 cgraph
13799 Dumps information about call-graph optimization, unused
13800 function removal, and inlining decisions.
13801
13802 inline
13803 Dump after function inlining.
13804
13805 Additionally, the options -optimized, -missed, -note, and -all can
13806 be provided, with the same meaning as for -fopt-info, defaulting to
13807 -optimized.
13808
13809 For example, -fdump-ipa-inline-optimized-missed will emit
13810 information on callsites that were inlined, along with callsites
13811 that were not inlined.
13812
13813 By default, the dump will contain messages about successful
13814 optimizations (equivalent to -optimized) together with low-level
13815 details about the analysis.
13816
13817 -fdump-lang-all
13818 -fdump-lang-switch
13819 -fdump-lang-switch-options
13820 -fdump-lang-switch-options=filename
13821 Control the dumping of language-specific information. The options
13822 and filename portions behave as described in the -fdump-tree
13823 option. The following switch values are accepted:
13824
13825 all Enable all language-specific dumps.
13826
13827 class
13828 Dump class hierarchy information. Virtual table information is
13829 emitted unless 'slim' is specified. This option is applicable
13830 to C++ only.
13831
13832 raw Dump the raw internal tree data. This option is applicable to
13833 C++ only.
13834
13835 -fdump-passes
13836 Print on stderr the list of optimization passes that are turned on
13837 and off by the current command-line options.
13838
13839 -fdump-statistics-option
13840 Enable and control dumping of pass statistics in a separate file.
13841 The file name is generated by appending a suffix ending in
13842 .statistics to the source file name, and the file is created in the
13843 same directory as the output file. If the -option form is used,
13844 -stats causes counters to be summed over the whole compilation unit
13845 while -details dumps every event as the passes generate them. The
13846 default with no option is to sum counters for each function
13847 compiled.
13848
13849 -fdump-tree-all
13850 -fdump-tree-switch
13851 -fdump-tree-switch-options
13852 -fdump-tree-switch-options=filename
13853 Control the dumping at various stages of processing the
13854 intermediate language tree to a file. If the -options form is
13855 used, options is a list of - separated options which control the
13856 details of the dump. Not all options are applicable to all dumps;
13857 those that are not meaningful are ignored. The following options
13858 are available
13859
13860 address
13861 Print the address of each node. Usually this is not meaningful
13862 as it changes according to the environment and source file.
13863 Its primary use is for tying up a dump file with a debug
13864 environment.
13865
13866 asmname
13867 If "DECL_ASSEMBLER_NAME" has been set for a given decl, use
13868 that in the dump instead of "DECL_NAME". Its primary use is
13869 ease of use working backward from mangled names in the assembly
13870 file.
13871
13872 slim
13873 When dumping front-end intermediate representations, inhibit
13874 dumping of members of a scope or body of a function merely
13875 because that scope has been reached. Only dump such items when
13876 they are directly reachable by some other path.
13877
13878 When dumping pretty-printed trees, this option inhibits dumping
13879 the bodies of control structures.
13880
13881 When dumping RTL, print the RTL in slim (condensed) form
13882 instead of the default LISP-like representation.
13883
13884 raw Print a raw representation of the tree. By default, trees are
13885 pretty-printed into a C-like representation.
13886
13887 details
13888 Enable more detailed dumps (not honored by every dump option).
13889 Also include information from the optimization passes.
13890
13891 stats
13892 Enable dumping various statistics about the pass (not honored
13893 by every dump option).
13894
13895 blocks
13896 Enable showing basic block boundaries (disabled in raw dumps).
13897
13898 graph
13899 For each of the other indicated dump files (-fdump-rtl-pass),
13900 dump a representation of the control flow graph suitable for
13901 viewing with GraphViz to file.passid.pass.dot. Each function
13902 in the file is pretty-printed as a subgraph, so that GraphViz
13903 can render them all in a single plot.
13904
13905 This option currently only works for RTL dumps, and the RTL is
13906 always dumped in slim form.
13907
13908 vops
13909 Enable showing virtual operands for every statement.
13910
13911 lineno
13912 Enable showing line numbers for statements.
13913
13914 uid Enable showing the unique ID ("DECL_UID") for each variable.
13915
13916 verbose
13917 Enable showing the tree dump for each statement.
13918
13919 eh Enable showing the EH region number holding each statement.
13920
13921 scev
13922 Enable showing scalar evolution analysis details.
13923
13924 optimized
13925 Enable showing optimization information (only available in
13926 certain passes).
13927
13928 missed
13929 Enable showing missed optimization information (only available
13930 in certain passes).
13931
13932 note
13933 Enable other detailed optimization information (only available
13934 in certain passes).
13935
13936 all Turn on all options, except raw, slim, verbose and lineno.
13937
13938 optall
13939 Turn on all optimization options, i.e., optimized, missed, and
13940 note.
13941
13942 To determine what tree dumps are available or find the dump for a
13943 pass of interest follow the steps below.
13944
13945 1. Invoke GCC with -fdump-passes and in the stderr output look for
13946 a code that corresponds to the pass you are interested in. For
13947 example, the codes "tree-evrp", "tree-vrp1", and "tree-vrp2"
13948 correspond to the three Value Range Propagation passes. The
13949 number at the end distinguishes distinct invocations of the
13950 same pass.
13951
13952 2. To enable the creation of the dump file, append the pass code
13953 to the -fdump- option prefix and invoke GCC with it. For
13954 example, to enable the dump from the Early Value Range
13955 Propagation pass, invoke GCC with the -fdump-tree-evrp option.
13956 Optionally, you may specify the name of the dump file. If you
13957 don't specify one, GCC creates as described below.
13958
13959 3. Find the pass dump in a file whose name is composed of three
13960 components separated by a period: the name of the source file
13961 GCC was invoked to compile, a numeric suffix indicating the
13962 pass number followed by the letter t for tree passes (and the
13963 letter r for RTL passes), and finally the pass code. For
13964 example, the Early VRP pass dump might be in a file named
13965 myfile.c.038t.evrp in the current working directory. Note that
13966 the numeric codes are not stable and may change from one
13967 version of GCC to another.
13968
13969 -fopt-info
13970 -fopt-info-options
13971 -fopt-info-options=filename
13972 Controls optimization dumps from various optimization passes. If
13973 the -options form is used, options is a list of - separated option
13974 keywords to select the dump details and optimizations.
13975
13976 The options can be divided into three groups:
13977
13978 1. options describing what kinds of messages should be emitted,
13979
13980 2. options describing the verbosity of the dump, and
13981
13982 3. options describing which optimizations should be included.
13983
13984 The options from each group can be freely mixed as they are non-
13985 overlapping. However, in case of any conflicts, the later options
13986 override the earlier options on the command line.
13987
13988 The following options control which kinds of messages should be
13989 emitted:
13990
13991 optimized
13992 Print information when an optimization is successfully applied.
13993 It is up to a pass to decide which information is relevant. For
13994 example, the vectorizer passes print the source location of
13995 loops which are successfully vectorized.
13996
13997 missed
13998 Print information about missed optimizations. Individual passes
13999 control which information to include in the output.
14000
14001 note
14002 Print verbose information about optimizations, such as certain
14003 transformations, more detailed messages about decisions etc.
14004
14005 all Print detailed optimization information. This includes
14006 optimized, missed, and note.
14007
14008 The following option controls the dump verbosity:
14009
14010 internals
14011 By default, only "high-level" messages are emitted. This option
14012 enables additional, more detailed, messages, which are likely
14013 to only be of interest to GCC developers.
14014
14015 One or more of the following option keywords can be used to
14016 describe a group of optimizations:
14017
14018 ipa Enable dumps from all interprocedural optimizations.
14019
14020 loop
14021 Enable dumps from all loop optimizations.
14022
14023 inline
14024 Enable dumps from all inlining optimizations.
14025
14026 omp Enable dumps from all OMP (Offloading and Multi Processing)
14027 optimizations.
14028
14029 vec Enable dumps from all vectorization optimizations.
14030
14031 optall
14032 Enable dumps from all optimizations. This is a superset of the
14033 optimization groups listed above.
14034
14035 If options is omitted, it defaults to optimized-optall, which means
14036 to dump messages about successful optimizations from all the
14037 passes, omitting messages that are treated as "internals".
14038
14039 If the filename is provided, then the dumps from all the applicable
14040 optimizations are concatenated into the filename. Otherwise the
14041 dump is output onto stderr. Though multiple -fopt-info options are
14042 accepted, only one of them can include a filename. If other
14043 filenames are provided then all but the first such option are
14044 ignored.
14045
14046 Note that the output filename is overwritten in case of multiple
14047 translation units. If a combined output from multiple translation
14048 units is desired, stderr should be used instead.
14049
14050 In the following example, the optimization info is output to
14051 stderr:
14052
14053 gcc -O3 -fopt-info
14054
14055 This example:
14056
14057 gcc -O3 -fopt-info-missed=missed.all
14058
14059 outputs missed optimization report from all the passes into
14060 missed.all, and this one:
14061
14062 gcc -O2 -ftree-vectorize -fopt-info-vec-missed
14063
14064 prints information about missed optimization opportunities from
14065 vectorization passes on stderr. Note that -fopt-info-vec-missed is
14066 equivalent to -fopt-info-missed-vec. The order of the optimization
14067 group names and message types listed after -fopt-info does not
14068 matter.
14069
14070 As another example,
14071
14072 gcc -O3 -fopt-info-inline-optimized-missed=inline.txt
14073
14074 outputs information about missed optimizations as well as optimized
14075 locations from all the inlining passes into inline.txt.
14076
14077 Finally, consider:
14078
14079 gcc -fopt-info-vec-missed=vec.miss -fopt-info-loop-optimized=loop.opt
14080
14081 Here the two output filenames vec.miss and loop.opt are in conflict
14082 since only one output file is allowed. In this case, only the first
14083 option takes effect and the subsequent options are ignored. Thus
14084 only vec.miss is produced which contains dumps from the vectorizer
14085 about missed opportunities.
14086
14087 -fsave-optimization-record
14088 Write a SRCFILE.opt-record.json.gz file detailing what
14089 optimizations were performed, for those optimizations that support
14090 -fopt-info.
14091
14092 This option is experimental and the format of the data within the
14093 compressed JSON file is subject to change.
14094
14095 It is roughly equivalent to a machine-readable version of
14096 -fopt-info-all, as a collection of messages with source file, line
14097 number and column number, with the following additional data for
14098 each message:
14099
14100 * the execution count of the code being optimized, along with
14101 metadata about whether this was from actual profile data, or
14102 just an estimate, allowing consumers to prioritize messages by
14103 code hotness,
14104
14105 * the function name of the code being optimized, where
14106 applicable,
14107
14108 * the "inlining chain" for the code being optimized, so that when
14109 a function is inlined into several different places (which
14110 might themselves be inlined), the reader can distinguish
14111 between the copies,
14112
14113 * objects identifying those parts of the message that refer to
14114 expressions, statements or symbol-table nodes, which of these
14115 categories they are, and, when available, their source code
14116 location,
14117
14118 * the GCC pass that emitted the message, and
14119
14120 * the location in GCC's own code from which the message was
14121 emitted
14122
14123 Additionally, some messages are logically nested within other
14124 messages, reflecting implementation details of the optimization
14125 passes.
14126
14127 -fsched-verbose=n
14128 On targets that use instruction scheduling, this option controls
14129 the amount of debugging output the scheduler prints to the dump
14130 files.
14131
14132 For n greater than zero, -fsched-verbose outputs the same
14133 information as -fdump-rtl-sched1 and -fdump-rtl-sched2. For n
14134 greater than one, it also output basic block probabilities,
14135 detailed ready list information and unit/insn info. For n greater
14136 than two, it includes RTL at abort point, control-flow and regions
14137 info. And for n over four, -fsched-verbose also includes
14138 dependence info.
14139
14140 -fenable-kind-pass
14141 -fdisable-kind-pass=range-list
14142 This is a set of options that are used to explicitly disable/enable
14143 optimization passes. These options are intended for use for
14144 debugging GCC. Compiler users should use regular options for
14145 enabling/disabling passes instead.
14146
14147 -fdisable-ipa-pass
14148 Disable IPA pass pass. pass is the pass name. If the same pass
14149 is statically invoked in the compiler multiple times, the pass
14150 name should be appended with a sequential number starting from
14151 1.
14152
14153 -fdisable-rtl-pass
14154 -fdisable-rtl-pass=range-list
14155 Disable RTL pass pass. pass is the pass name. If the same
14156 pass is statically invoked in the compiler multiple times, the
14157 pass name should be appended with a sequential number starting
14158 from 1. range-list is a comma-separated list of function
14159 ranges or assembler names. Each range is a number pair
14160 separated by a colon. The range is inclusive in both ends. If
14161 the range is trivial, the number pair can be simplified as a
14162 single number. If the function's call graph node's uid falls
14163 within one of the specified ranges, the pass is disabled for
14164 that function. The uid is shown in the function header of a
14165 dump file, and the pass names can be dumped by using option
14166 -fdump-passes.
14167
14168 -fdisable-tree-pass
14169 -fdisable-tree-pass=range-list
14170 Disable tree pass pass. See -fdisable-rtl for the description
14171 of option arguments.
14172
14173 -fenable-ipa-pass
14174 Enable IPA pass pass. pass is the pass name. If the same pass
14175 is statically invoked in the compiler multiple times, the pass
14176 name should be appended with a sequential number starting from
14177 1.
14178
14179 -fenable-rtl-pass
14180 -fenable-rtl-pass=range-list
14181 Enable RTL pass pass. See -fdisable-rtl for option argument
14182 description and examples.
14183
14184 -fenable-tree-pass
14185 -fenable-tree-pass=range-list
14186 Enable tree pass pass. See -fdisable-rtl for the description
14187 of option arguments.
14188
14189 Here are some examples showing uses of these options.
14190
14191 # disable ccp1 for all functions
14192 -fdisable-tree-ccp1
14193 # disable complete unroll for function whose cgraph node uid is 1
14194 -fenable-tree-cunroll=1
14195 # disable gcse2 for functions at the following ranges [1,1],
14196 # [300,400], and [400,1000]
14197 # disable gcse2 for functions foo and foo2
14198 -fdisable-rtl-gcse2=foo,foo2
14199 # disable early inlining
14200 -fdisable-tree-einline
14201 # disable ipa inlining
14202 -fdisable-ipa-inline
14203 # enable tree full unroll
14204 -fenable-tree-unroll
14205
14206 -fchecking
14207 -fchecking=n
14208 Enable internal consistency checking. The default depends on the
14209 compiler configuration. -fchecking=2 enables further internal
14210 consistency checking that might affect code generation.
14211
14212 -frandom-seed=string
14213 This option provides a seed that GCC uses in place of random
14214 numbers in generating certain symbol names that have to be
14215 different in every compiled file. It is also used to place unique
14216 stamps in coverage data files and the object files that produce
14217 them. You can use the -frandom-seed option to produce reproducibly
14218 identical object files.
14219
14220 The string can either be a number (decimal, octal or hex) or an
14221 arbitrary string (in which case it's converted to a number by
14222 computing CRC32).
14223
14224 The string should be different for every file you compile.
14225
14226 -save-temps
14227 -save-temps=cwd
14228 Store the usual "temporary" intermediate files permanently; place
14229 them in the current directory and name them based on the source
14230 file. Thus, compiling foo.c with -c -save-temps produces files
14231 foo.i and foo.s, as well as foo.o. This creates a preprocessed
14232 foo.i output file even though the compiler now normally uses an
14233 integrated preprocessor.
14234
14235 When used in combination with the -x command-line option,
14236 -save-temps is sensible enough to avoid over writing an input
14237 source file with the same extension as an intermediate file. The
14238 corresponding intermediate file may be obtained by renaming the
14239 source file before using -save-temps.
14240
14241 If you invoke GCC in parallel, compiling several different source
14242 files that share a common base name in different subdirectories or
14243 the same source file compiled for multiple output destinations, it
14244 is likely that the different parallel compilers will interfere with
14245 each other, and overwrite the temporary files. For instance:
14246
14247 gcc -save-temps -o outdir1/foo.o indir1/foo.c&
14248 gcc -save-temps -o outdir2/foo.o indir2/foo.c&
14249
14250 may result in foo.i and foo.o being written to simultaneously by
14251 both compilers.
14252
14253 -save-temps=obj
14254 Store the usual "temporary" intermediate files permanently. If the
14255 -o option is used, the temporary files are based on the object
14256 file. If the -o option is not used, the -save-temps=obj switch
14257 behaves like -save-temps.
14258
14259 For example:
14260
14261 gcc -save-temps=obj -c foo.c
14262 gcc -save-temps=obj -c bar.c -o dir/xbar.o
14263 gcc -save-temps=obj foobar.c -o dir2/yfoobar
14264
14265 creates foo.i, foo.s, dir/xbar.i, dir/xbar.s, dir2/yfoobar.i,
14266 dir2/yfoobar.s, and dir2/yfoobar.o.
14267
14268 -time[=file]
14269 Report the CPU time taken by each subprocess in the compilation
14270 sequence. For C source files, this is the compiler proper and
14271 assembler (plus the linker if linking is done).
14272
14273 Without the specification of an output file, the output looks like
14274 this:
14275
14276 # cc1 0.12 0.01
14277 # as 0.00 0.01
14278
14279 The first number on each line is the "user time", that is time
14280 spent executing the program itself. The second number is "system
14281 time", time spent executing operating system routines on behalf of
14282 the program. Both numbers are in seconds.
14283
14284 With the specification of an output file, the output is appended to
14285 the named file, and it looks like this:
14286
14287 0.12 0.01 cc1 <options>
14288 0.00 0.01 as <options>
14289
14290 The "user time" and the "system time" are moved before the program
14291 name, and the options passed to the program are displayed, so that
14292 one can later tell what file was being compiled, and with which
14293 options.
14294
14295 -fdump-final-insns[=file]
14296 Dump the final internal representation (RTL) to file. If the
14297 optional argument is omitted (or if file is "."), the name of the
14298 dump file is determined by appending ".gkd" to the compilation
14299 output file name.
14300
14301 -fcompare-debug[=opts]
14302 If no error occurs during compilation, run the compiler a second
14303 time, adding opts and -fcompare-debug-second to the arguments
14304 passed to the second compilation. Dump the final internal
14305 representation in both compilations, and print an error if they
14306 differ.
14307
14308 If the equal sign is omitted, the default -gtoggle is used.
14309
14310 The environment variable GCC_COMPARE_DEBUG, if defined, non-empty
14311 and nonzero, implicitly enables -fcompare-debug. If
14312 GCC_COMPARE_DEBUG is defined to a string starting with a dash, then
14313 it is used for opts, otherwise the default -gtoggle is used.
14314
14315 -fcompare-debug=, with the equal sign but without opts, is
14316 equivalent to -fno-compare-debug, which disables the dumping of the
14317 final representation and the second compilation, preventing even
14318 GCC_COMPARE_DEBUG from taking effect.
14319
14320 To verify full coverage during -fcompare-debug testing, set
14321 GCC_COMPARE_DEBUG to say -fcompare-debug-not-overridden, which GCC
14322 rejects as an invalid option in any actual compilation (rather than
14323 preprocessing, assembly or linking). To get just a warning,
14324 setting GCC_COMPARE_DEBUG to -w%n-fcompare-debug not overridden
14325 will do.
14326
14327 -fcompare-debug-second
14328 This option is implicitly passed to the compiler for the second
14329 compilation requested by -fcompare-debug, along with options to
14330 silence warnings, and omitting other options that would cause the
14331 compiler to produce output to files or to standard output as a side
14332 effect. Dump files and preserved temporary files are renamed so as
14333 to contain the ".gk" additional extension during the second
14334 compilation, to avoid overwriting those generated by the first.
14335
14336 When this option is passed to the compiler driver, it causes the
14337 first compilation to be skipped, which makes it useful for little
14338 other than debugging the compiler proper.
14339
14340 -gtoggle
14341 Turn off generation of debug info, if leaving out this option
14342 generates it, or turn it on at level 2 otherwise. The position of
14343 this argument in the command line does not matter; it takes effect
14344 after all other options are processed, and it does so only once, no
14345 matter how many times it is given. This is mainly intended to be
14346 used with -fcompare-debug.
14347
14348 -fvar-tracking-assignments-toggle
14349 Toggle -fvar-tracking-assignments, in the same way that -gtoggle
14350 toggles -g.
14351
14352 -Q Makes the compiler print out each function name as it is compiled,
14353 and print some statistics about each pass when it finishes.
14354
14355 -ftime-report
14356 Makes the compiler print some statistics about the time consumed by
14357 each pass when it finishes.
14358
14359 -ftime-report-details
14360 Record the time consumed by infrastructure parts separately for
14361 each pass.
14362
14363 -fira-verbose=n
14364 Control the verbosity of the dump file for the integrated register
14365 allocator. The default value is 5. If the value n is greater or
14366 equal to 10, the dump output is sent to stderr using the same
14367 format as n minus 10.
14368
14369 -flto-report
14370 Prints a report with internal details on the workings of the link-
14371 time optimizer. The contents of this report vary from version to
14372 version. It is meant to be useful to GCC developers when
14373 processing object files in LTO mode (via -flto).
14374
14375 Disabled by default.
14376
14377 -flto-report-wpa
14378 Like -flto-report, but only print for the WPA phase of link-time
14379 optimization.
14380
14381 -fmem-report
14382 Makes the compiler print some statistics about permanent memory
14383 allocation when it finishes.
14384
14385 -fmem-report-wpa
14386 Makes the compiler print some statistics about permanent memory
14387 allocation for the WPA phase only.
14388
14389 -fpre-ipa-mem-report
14390 -fpost-ipa-mem-report
14391 Makes the compiler print some statistics about permanent memory
14392 allocation before or after interprocedural optimization.
14393
14394 -fprofile-report
14395 Makes the compiler print some statistics about consistency of the
14396 (estimated) profile and effect of individual passes.
14397
14398 -fstack-usage
14399 Makes the compiler output stack usage information for the program,
14400 on a per-function basis. The filename for the dump is made by
14401 appending .su to the auxname. auxname is generated from the name
14402 of the output file, if explicitly specified and it is not an
14403 executable, otherwise it is the basename of the source file. An
14404 entry is made up of three fields:
14405
14406 * The name of the function.
14407
14408 * A number of bytes.
14409
14410 * One or more qualifiers: "static", "dynamic", "bounded".
14411
14412 The qualifier "static" means that the function manipulates the
14413 stack statically: a fixed number of bytes are allocated for the
14414 frame on function entry and released on function exit; no stack
14415 adjustments are otherwise made in the function. The second field
14416 is this fixed number of bytes.
14417
14418 The qualifier "dynamic" means that the function manipulates the
14419 stack dynamically: in addition to the static allocation described
14420 above, stack adjustments are made in the body of the function, for
14421 example to push/pop arguments around function calls. If the
14422 qualifier "bounded" is also present, the amount of these
14423 adjustments is bounded at compile time and the second field is an
14424 upper bound of the total amount of stack used by the function. If
14425 it is not present, the amount of these adjustments is not bounded
14426 at compile time and the second field only represents the bounded
14427 part.
14428
14429 -fstats
14430 Emit statistics about front-end processing at the end of the
14431 compilation. This option is supported only by the C++ front end,
14432 and the information is generally only useful to the G++ development
14433 team.
14434
14435 -fdbg-cnt-list
14436 Print the name and the counter upper bound for all debug counters.
14437
14438 -fdbg-cnt=counter-value-list
14439 Set the internal debug counter lower and upper bound. counter-
14440 value-list is a comma-separated list of
14441 name:lower_bound1-upper_bound1 [:lower_bound2-upper_bound2...]
14442 tuples which sets the name of the counter and list of closed
14443 intervals. The lower_bound is optional and is zero initialized if
14444 not set. For example, with -fdbg-cnt=dce:2-4:10-11,tail_call:10,
14445 "dbg_cnt(dce)" returns true only for second, third, fourth, tenth
14446 and eleventh invocation. For "dbg_cnt(tail_call)" true is returned
14447 for first 10 invocations.
14448
14449 -print-file-name=library
14450 Print the full absolute name of the library file library that would
14451 be used when linking---and don't do anything else. With this
14452 option, GCC does not compile or link anything; it just prints the
14453 file name.
14454
14455 -print-multi-directory
14456 Print the directory name corresponding to the multilib selected by
14457 any other switches present in the command line. This directory is
14458 supposed to exist in GCC_EXEC_PREFIX.
14459
14460 -print-multi-lib
14461 Print the mapping from multilib directory names to compiler
14462 switches that enable them. The directory name is separated from
14463 the switches by ;, and each switch starts with an @ instead of the
14464 -, without spaces between multiple switches. This is supposed to
14465 ease shell processing.
14466
14467 -print-multi-os-directory
14468 Print the path to OS libraries for the selected multilib, relative
14469 to some lib subdirectory. If OS libraries are present in the lib
14470 subdirectory and no multilibs are used, this is usually just ., if
14471 OS libraries are present in libsuffix sibling directories this
14472 prints e.g. ../lib64, ../lib or ../lib32, or if OS libraries are
14473 present in lib/subdir subdirectories it prints e.g. amd64, sparcv9
14474 or ev6.
14475
14476 -print-multiarch
14477 Print the path to OS libraries for the selected multiarch, relative
14478 to some lib subdirectory.
14479
14480 -print-prog-name=program
14481 Like -print-file-name, but searches for a program such as cpp.
14482
14483 -print-libgcc-file-name
14484 Same as -print-file-name=libgcc.a.
14485
14486 This is useful when you use -nostdlib or -nodefaultlibs but you do
14487 want to link with libgcc.a. You can do:
14488
14489 gcc -nostdlib <files>... `gcc -print-libgcc-file-name`
14490
14491 -print-search-dirs
14492 Print the name of the configured installation directory and a list
14493 of program and library directories gcc searches---and don't do
14494 anything else.
14495
14496 This is useful when gcc prints the error message installation
14497 problem, cannot exec cpp0: No such file or directory. To resolve
14498 this you either need to put cpp0 and the other compiler components
14499 where gcc expects to find them, or you can set the environment
14500 variable GCC_EXEC_PREFIX to the directory where you installed them.
14501 Don't forget the trailing /.
14502
14503 -print-sysroot
14504 Print the target sysroot directory that is used during compilation.
14505 This is the target sysroot specified either at configure time or
14506 using the --sysroot option, possibly with an extra suffix that
14507 depends on compilation options. If no target sysroot is specified,
14508 the option prints nothing.
14509
14510 -print-sysroot-headers-suffix
14511 Print the suffix added to the target sysroot when searching for
14512 headers, or give an error if the compiler is not configured with
14513 such a suffix---and don't do anything else.
14514
14515 -dumpmachine
14516 Print the compiler's target machine (for example,
14517 i686-pc-linux-gnu)---and don't do anything else.
14518
14519 -dumpversion
14520 Print the compiler version (for example, 3.0, 6.3.0 or 7)---and
14521 don't do anything else. This is the compiler version used in
14522 filesystem paths and specs. Depending on how the compiler has been
14523 configured it can be just a single number (major version), two
14524 numbers separated by a dot (major and minor version) or three
14525 numbers separated by dots (major, minor and patchlevel version).
14526
14527 -dumpfullversion
14528 Print the full compiler version---and don't do anything else. The
14529 output is always three numbers separated by dots, major, minor and
14530 patchlevel version.
14531
14532 -dumpspecs
14533 Print the compiler's built-in specs---and don't do anything else.
14534 (This is used when GCC itself is being built.)
14535
14536 Machine-Dependent Options
14537 Each target machine supported by GCC can have its own options---for
14538 example, to allow you to compile for a particular processor variant or
14539 ABI, or to control optimizations specific to that machine. By
14540 convention, the names of machine-specific options start with -m.
14541
14542 Some configurations of the compiler also support additional target-
14543 specific options, usually for compatibility with other compilers on the
14544 same platform.
14545
14546 AArch64 Options
14547
14548 These options are defined for AArch64 implementations:
14549
14550 -mabi=name
14551 Generate code for the specified data model. Permissible values are
14552 ilp32 for SysV-like data model where int, long int and pointers are
14553 32 bits, and lp64 for SysV-like data model where int is 32 bits,
14554 but long int and pointers are 64 bits.
14555
14556 The default depends on the specific target configuration. Note
14557 that the LP64 and ILP32 ABIs are not link-compatible; you must
14558 compile your entire program with the same ABI, and link with a
14559 compatible set of libraries.
14560
14561 -mbig-endian
14562 Generate big-endian code. This is the default when GCC is
14563 configured for an aarch64_be-*-* target.
14564
14565 -mgeneral-regs-only
14566 Generate code which uses only the general-purpose registers. This
14567 will prevent the compiler from using floating-point and Advanced
14568 SIMD registers but will not impose any restrictions on the
14569 assembler.
14570
14571 -mlittle-endian
14572 Generate little-endian code. This is the default when GCC is
14573 configured for an aarch64-*-* but not an aarch64_be-*-* target.
14574
14575 -mcmodel=tiny
14576 Generate code for the tiny code model. The program and its
14577 statically defined symbols must be within 1MB of each other.
14578 Programs can be statically or dynamically linked.
14579
14580 -mcmodel=small
14581 Generate code for the small code model. The program and its
14582 statically defined symbols must be within 4GB of each other.
14583 Programs can be statically or dynamically linked. This is the
14584 default code model.
14585
14586 -mcmodel=large
14587 Generate code for the large code model. This makes no assumptions
14588 about addresses and sizes of sections. Programs can be statically
14589 linked only. The -mcmodel=large option is incompatible with
14590 -mabi=ilp32, -fpic and -fPIC.
14591
14592 -mstrict-align
14593 -mno-strict-align
14594 Avoid or allow generating memory accesses that may not be aligned
14595 on a natural object boundary as described in the architecture
14596 specification.
14597
14598 -momit-leaf-frame-pointer
14599 -mno-omit-leaf-frame-pointer
14600 Omit or keep the frame pointer in leaf functions. The former
14601 behavior is the default.
14602
14603 -mstack-protector-guard=guard
14604 -mstack-protector-guard-reg=reg
14605 -mstack-protector-guard-offset=offset
14606 Generate stack protection code using canary at guard. Supported
14607 locations are global for a global canary or sysreg for a canary in
14608 an appropriate system register.
14609
14610 With the latter choice the options -mstack-protector-guard-reg=reg
14611 and -mstack-protector-guard-offset=offset furthermore specify which
14612 system register to use as base register for reading the canary, and
14613 from what offset from that base register. There is no default
14614 register or offset as this is entirely for use within the Linux
14615 kernel.
14616
14617 -mstack-protector-guard=guard
14618 -mstack-protector-guard-reg=reg
14619 -mstack-protector-guard-offset=offset
14620 Generate stack protection code using canary at guard. Supported
14621 locations are global for a global canary or sysreg for a canary in
14622 an appropriate system register.
14623
14624 With the latter choice the options -mstack-protector-guard-reg=reg
14625 and -mstack-protector-guard-offset=offset furthermore specify which
14626 system register to use as base register for reading the canary, and
14627 from what offset from that base register. There is no default
14628 register or offset as this is entirely for use within the Linux
14629 kernel.
14630
14631 -mtls-dialect=desc
14632 Use TLS descriptors as the thread-local storage mechanism for
14633 dynamic accesses of TLS variables. This is the default.
14634
14635 -mtls-dialect=traditional
14636 Use traditional TLS as the thread-local storage mechanism for
14637 dynamic accesses of TLS variables.
14638
14639 -mtls-size=size
14640 Specify bit size of immediate TLS offsets. Valid values are 12,
14641 24, 32, 48. This option requires binutils 2.26 or newer.
14642
14643 -mfix-cortex-a53-835769
14644 -mno-fix-cortex-a53-835769
14645 Enable or disable the workaround for the ARM Cortex-A53 erratum
14646 number 835769. This involves inserting a NOP instruction between
14647 memory instructions and 64-bit integer multiply-accumulate
14648 instructions.
14649
14650 -mfix-cortex-a53-843419
14651 -mno-fix-cortex-a53-843419
14652 Enable or disable the workaround for the ARM Cortex-A53 erratum
14653 number 843419. This erratum workaround is made at link time and
14654 this will only pass the corresponding flag to the linker.
14655
14656 -mlow-precision-recip-sqrt
14657 -mno-low-precision-recip-sqrt
14658 Enable or disable the reciprocal square root approximation. This
14659 option only has an effect if -ffast-math or
14660 -funsafe-math-optimizations is used as well. Enabling this reduces
14661 precision of reciprocal square root results to about 16 bits for
14662 single precision and to 32 bits for double precision.
14663
14664 -mlow-precision-sqrt
14665 -mno-low-precision-sqrt
14666 Enable or disable the square root approximation. This option only
14667 has an effect if -ffast-math or -funsafe-math-optimizations is used
14668 as well. Enabling this reduces precision of square root results to
14669 about 16 bits for single precision and to 32 bits for double
14670 precision. If enabled, it implies -mlow-precision-recip-sqrt.
14671
14672 -mlow-precision-div
14673 -mno-low-precision-div
14674 Enable or disable the division approximation. This option only has
14675 an effect if -ffast-math or -funsafe-math-optimizations is used as
14676 well. Enabling this reduces precision of division results to about
14677 16 bits for single precision and to 32 bits for double precision.
14678
14679 -mtrack-speculation
14680 -mno-track-speculation
14681 Enable or disable generation of additional code to track
14682 speculative execution through conditional branches. The tracking
14683 state can then be used by the compiler when expanding calls to
14684 "__builtin_speculation_safe_copy" to permit a more efficient code
14685 sequence to be generated.
14686
14687 -moutline-atomics
14688 -mno-outline-atomics
14689 Enable or disable calls to out-of-line helpers to implement atomic
14690 operations. These helpers will, at runtime, determine if the LSE
14691 instructions from ARMv8.1-A can be used; if not, they will use the
14692 load/store-exclusive instructions that are present in the base
14693 ARMv8.0 ISA.
14694
14695 This option is only applicable when compiling for the base ARMv8.0
14696 instruction set. If using a later revision, e.g. -march=armv8.1-a
14697 or -march=armv8-a+lse, the ARMv8.1-Atomics instructions will be
14698 used directly. The same applies when using -mcpu= when the
14699 selected cpu supports the lse feature. This option is on by
14700 default.
14701
14702 -march=name
14703 Specify the name of the target architecture and, optionally, one or
14704 more feature modifiers. This option has the form
14705 -march=arch{+[no]feature}*.
14706
14707 The table below summarizes the permissible values for arch and the
14708 features that they enable by default:
14709
14710 arch value : Architecture : Includes by default
14711 armv8-a : Armv8-A : +fp, +simd
14712 armv8.1-a : Armv8.1-A : armv8-a, +crc, +lse, +rdma
14713 armv8.2-a : Armv8.2-A : armv8.1-a
14714 armv8.3-a : Armv8.3-A : armv8.2-a
14715 armv8.4-a : Armv8.4-A : armv8.3-a, +fp16fml, +dotprod
14716 armv8.5-a : Armv8.5-A : armv8.4-a, +sb, +ssbs, +predres
14717 armv8.6-a : Armv8.6-A : armv8.5-a, +bf16, +i8mm
14718
14719 The value native is available on native AArch64 GNU/Linux and
14720 causes the compiler to pick the architecture of the host system.
14721 This option has no effect if the compiler is unable to recognize
14722 the architecture of the host system,
14723
14724 The permissible values for feature are listed in the sub-section on
14725 aarch64-feature-modifiers,,-march and -mcpu Feature Modifiers.
14726 Where conflicting feature modifiers are specified, the right-most
14727 feature is used.
14728
14729 GCC uses name to determine what kind of instructions it can emit
14730 when generating assembly code. If -march is specified without
14731 either of -mtune or -mcpu also being specified, the code is tuned
14732 to perform well across a range of target processors implementing
14733 the target architecture.
14734
14735 -mtune=name
14736 Specify the name of the target processor for which GCC should tune
14737 the performance of the code. Permissible values for this option
14738 are: generic, cortex-a35, cortex-a53, cortex-a55, cortex-a57,
14739 cortex-a72, cortex-a73, cortex-a75, cortex-a76, cortex-a76ae,
14740 cortex-a77, cortex-a65, cortex-a65ae, cortex-a34, ares, exynos-m1,
14741 emag, falkor, neoverse-e1,neoverse-n1,qdf24xx, saphira, phecda,
14742 xgene1, vulcan, octeontx, octeontx81, octeontx83, octeontx2,
14743 octeontx2t98, octeontx2t96 octeontx2t93, octeontx2f95,
14744 octeontx2f95n, octeontx2f95mm, a64fx, thunderx, thunderxt88,
14745 thunderxt88p1, thunderxt81, tsv110, thunderxt83, thunderx2t99,
14746 thunderx3t110, zeus, cortex-a57.cortex-a53, cortex-a72.cortex-a53,
14747 cortex-a73.cortex-a35, cortex-a73.cortex-a53,
14748 cortex-a75.cortex-a55, cortex-a76.cortex-a55 native.
14749
14750 The values cortex-a57.cortex-a53, cortex-a72.cortex-a53,
14751 cortex-a73.cortex-a35, cortex-a73.cortex-a53,
14752 cortex-a75.cortex-a55, cortex-a76.cortex-a55 specify that GCC
14753 should tune for a big.LITTLE system.
14754
14755 Additionally on native AArch64 GNU/Linux systems the value native
14756 tunes performance to the host system. This option has no effect if
14757 the compiler is unable to recognize the processor of the host
14758 system.
14759
14760 Where none of -mtune=, -mcpu= or -march= are specified, the code is
14761 tuned to perform well across a range of target processors.
14762
14763 This option cannot be suffixed by feature modifiers.
14764
14765 -mcpu=name
14766 Specify the name of the target processor, optionally suffixed by
14767 one or more feature modifiers. This option has the form
14768 -mcpu=cpu{+[no]feature}*, where the permissible values for cpu are
14769 the same as those available for -mtune. The permissible values for
14770 feature are documented in the sub-section on
14771 aarch64-feature-modifiers,,-march and -mcpu Feature Modifiers.
14772 Where conflicting feature modifiers are specified, the right-most
14773 feature is used.
14774
14775 GCC uses name to determine what kind of instructions it can emit
14776 when generating assembly code (as if by -march) and to determine
14777 the target processor for which to tune for performance (as if by
14778 -mtune). Where this option is used in conjunction with -march or
14779 -mtune, those options take precedence over the appropriate part of
14780 this option.
14781
14782 -moverride=string
14783 Override tuning decisions made by the back-end in response to a
14784 -mtune= switch. The syntax, semantics, and accepted values for
14785 string in this option are not guaranteed to be consistent across
14786 releases.
14787
14788 This option is only intended to be useful when developing GCC.
14789
14790 -mverbose-cost-dump
14791 Enable verbose cost model dumping in the debug dump files. This
14792 option is provided for use in debugging the compiler.
14793
14794 -mpc-relative-literal-loads
14795 -mno-pc-relative-literal-loads
14796 Enable or disable PC-relative literal loads. With this option
14797 literal pools are accessed using a single instruction and emitted
14798 after each function. This limits the maximum size of functions to
14799 1MB. This is enabled by default for -mcmodel=tiny.
14800
14801 -msign-return-address=scope
14802 Select the function scope on which return address signing will be
14803 applied. Permissible values are none, which disables return
14804 address signing, non-leaf, which enables pointer signing for
14805 functions which are not leaf functions, and all, which enables
14806 pointer signing for all functions. The default value is none. This
14807 option has been deprecated by -mbranch-protection.
14808
14809 -mbranch-protection=none|standard|pac-ret[+leaf+b-key]|bti
14810 Select the branch protection features to use. none is the default
14811 and turns off all types of branch protection. standard turns on
14812 all types of branch protection features. If a feature has
14813 additional tuning options, then standard sets it to its standard
14814 level. pac-ret[+leaf] turns on return address signing to its
14815 standard level: signing functions that save the return address to
14816 memory (non-leaf functions will practically always do this) using
14817 the a-key. The optional argument leaf can be used to extend the
14818 signing to include leaf functions. The optional argument b-key can
14819 be used to sign the functions with the B-key instead of the A-key.
14820 bti turns on branch target identification mechanism.
14821
14822 -mharden-sls=opts
14823 Enable compiler hardening against straight line speculation (SLS).
14824 opts is a comma-separated list of the following options:
14825
14826 retbr
14827 blr
14828
14829 In addition, -mharden-sls=all enables all SLS hardening while
14830 -mharden-sls=none disables all SLS hardening.
14831
14832 -msve-vector-bits=bits
14833 Specify the number of bits in an SVE vector register. This option
14834 only has an effect when SVE is enabled.
14835
14836 GCC supports two forms of SVE code generation: "vector-length
14837 agnostic" output that works with any size of vector register and
14838 "vector-length specific" output that allows GCC to make assumptions
14839 about the vector length when it is useful for optimization reasons.
14840 The possible values of bits are: scalable, 128, 256, 512, 1024 and
14841 2048. Specifying scalable selects vector-length agnostic output.
14842 At present -msve-vector-bits=128 also generates vector-length
14843 agnostic output for big-endian targets. All other values generate
14844 vector-length specific code. The behavior of these values may
14845 change in future releases and no value except scalable should be
14846 relied on for producing code that is portable across different
14847 hardware SVE vector lengths.
14848
14849 The default is -msve-vector-bits=scalable, which produces vector-
14850 length agnostic code.
14851
14852 -march and -mcpu Feature Modifiers
14853
14854 Feature modifiers used with -march and -mcpu can be any of the
14855 following and their inverses nofeature:
14856
14857 crc Enable CRC extension. This is on by default for -march=armv8.1-a.
14858
14859 crypto
14860 Enable Crypto extension. This also enables Advanced SIMD and
14861 floating-point instructions.
14862
14863 fp Enable floating-point instructions. This is on by default for all
14864 possible values for options -march and -mcpu.
14865
14866 simd
14867 Enable Advanced SIMD instructions. This also enables floating-
14868 point instructions. This is on by default for all possible values
14869 for options -march and -mcpu.
14870
14871 sve Enable Scalable Vector Extension instructions. This also enables
14872 Advanced SIMD and floating-point instructions.
14873
14874 lse Enable Large System Extension instructions. This is on by default
14875 for -march=armv8.1-a.
14876
14877 rdma
14878 Enable Round Double Multiply Accumulate instructions. This is on
14879 by default for -march=armv8.1-a.
14880
14881 fp16
14882 Enable FP16 extension. This also enables floating-point
14883 instructions.
14884
14885 fp16fml
14886 Enable FP16 fmla extension. This also enables FP16 extensions and
14887 floating-point instructions. This option is enabled by default for
14888 -march=armv8.4-a. Use of this option with architectures prior to
14889 Armv8.2-A is not supported.
14890
14891 rcpc
14892 Enable the RcPc extension. This does not change code generation
14893 from GCC, but is passed on to the assembler, enabling inline asm
14894 statements to use instructions from the RcPc extension.
14895
14896 dotprod
14897 Enable the Dot Product extension. This also enables Advanced SIMD
14898 instructions.
14899
14900 aes Enable the Armv8-a aes and pmull crypto extension. This also
14901 enables Advanced SIMD instructions.
14902
14903 sha2
14904 Enable the Armv8-a sha2 crypto extension. This also enables
14905 Advanced SIMD instructions.
14906
14907 sha3
14908 Enable the sha512 and sha3 crypto extension. This also enables
14909 Advanced SIMD instructions. Use of this option with architectures
14910 prior to Armv8.2-A is not supported.
14911
14912 sm4 Enable the sm3 and sm4 crypto extension. This also enables
14913 Advanced SIMD instructions. Use of this option with architectures
14914 prior to Armv8.2-A is not supported.
14915
14916 profile
14917 Enable the Statistical Profiling extension. This option is only to
14918 enable the extension at the assembler level and does not affect
14919 code generation.
14920
14921 rng Enable the Armv8.5-a Random Number instructions. This option is
14922 only to enable the extension at the assembler level and does not
14923 affect code generation.
14924
14925 memtag
14926 Enable the Armv8.5-a Memory Tagging Extensions. Use of this option
14927 with architectures prior to Armv8.5-A is not supported.
14928
14929 sb Enable the Armv8-a Speculation Barrier instruction. This option is
14930 only to enable the extension at the assembler level and does not
14931 affect code generation. This option is enabled by default for
14932 -march=armv8.5-a.
14933
14934 ssbs
14935 Enable the Armv8-a Speculative Store Bypass Safe instruction. This
14936 option is only to enable the extension at the assembler level and
14937 does not affect code generation. This option is enabled by default
14938 for -march=armv8.5-a.
14939
14940 predres
14941 Enable the Armv8-a Execution and Data Prediction Restriction
14942 instructions. This option is only to enable the extension at the
14943 assembler level and does not affect code generation. This option
14944 is enabled by default for -march=armv8.5-a.
14945
14946 sve2
14947 Enable the Armv8-a Scalable Vector Extension 2. This also enables
14948 SVE instructions.
14949
14950 sve2-bitperm
14951 Enable SVE2 bitperm instructions. This also enables SVE2
14952 instructions.
14953
14954 sve2-sm4
14955 Enable SVE2 sm4 instructions. This also enables SVE2 instructions.
14956
14957 sve2-aes
14958 Enable SVE2 aes instructions. This also enables SVE2 instructions.
14959
14960 sve2-sha3
14961 Enable SVE2 sha3 instructions. This also enables SVE2
14962 instructions.
14963
14964 tme Enable the Transactional Memory Extension.
14965
14966 i8mm
14967 Enable 8-bit Integer Matrix Multiply instructions. This also
14968 enables Advanced SIMD and floating-point instructions. This option
14969 is enabled by default for -march=armv8.6-a. Use of this option
14970 with architectures prior to Armv8.2-A is not supported.
14971
14972 f32mm
14973 Enable 32-bit Floating point Matrix Multiply instructions. This
14974 also enables SVE instructions. Use of this option with
14975 architectures prior to Armv8.2-A is not supported.
14976
14977 f64mm
14978 Enable 64-bit Floating point Matrix Multiply instructions. This
14979 also enables SVE instructions. Use of this option with
14980 architectures prior to Armv8.2-A is not supported.
14981
14982 bf16
14983 Enable brain half-precision floating-point instructions. This also
14984 enables Advanced SIMD and floating-point instructions. This option
14985 is enabled by default for -march=armv8.6-a. Use of this option
14986 with architectures prior to Armv8.2-A is not supported.
14987
14988 Feature crypto implies aes, sha2, and simd, which implies fp.
14989 Conversely, nofp implies nosimd, which implies nocrypto, noaes and
14990 nosha2.
14991
14992 Adapteva Epiphany Options
14993
14994 These -m options are defined for Adapteva Epiphany:
14995
14996 -mhalf-reg-file
14997 Don't allocate any register in the range "r32"..."r63". That
14998 allows code to run on hardware variants that lack these registers.
14999
15000 -mprefer-short-insn-regs
15001 Preferentially allocate registers that allow short instruction
15002 generation. This can result in increased instruction count, so
15003 this may either reduce or increase overall code size.
15004
15005 -mbranch-cost=num
15006 Set the cost of branches to roughly num "simple" instructions.
15007 This cost is only a heuristic and is not guaranteed to produce
15008 consistent results across releases.
15009
15010 -mcmove
15011 Enable the generation of conditional moves.
15012
15013 -mnops=num
15014 Emit num NOPs before every other generated instruction.
15015
15016 -mno-soft-cmpsf
15017 For single-precision floating-point comparisons, emit an "fsub"
15018 instruction and test the flags. This is faster than a software
15019 comparison, but can get incorrect results in the presence of NaNs,
15020 or when two different small numbers are compared such that their
15021 difference is calculated as zero. The default is -msoft-cmpsf,
15022 which uses slower, but IEEE-compliant, software comparisons.
15023
15024 -mstack-offset=num
15025 Set the offset between the top of the stack and the stack pointer.
15026 E.g., a value of 8 means that the eight bytes in the range
15027 "sp+0...sp+7" can be used by leaf functions without stack
15028 allocation. Values other than 8 or 16 are untested and unlikely to
15029 work. Note also that this option changes the ABI; compiling a
15030 program with a different stack offset than the libraries have been
15031 compiled with generally does not work. This option can be useful
15032 if you want to evaluate if a different stack offset would give you
15033 better code, but to actually use a different stack offset to build
15034 working programs, it is recommended to configure the toolchain with
15035 the appropriate --with-stack-offset=num option.
15036
15037 -mno-round-nearest
15038 Make the scheduler assume that the rounding mode has been set to
15039 truncating. The default is -mround-nearest.
15040
15041 -mlong-calls
15042 If not otherwise specified by an attribute, assume all calls might
15043 be beyond the offset range of the "b" / "bl" instructions, and
15044 therefore load the function address into a register before
15045 performing a (otherwise direct) call. This is the default.
15046
15047 -mshort-calls
15048 If not otherwise specified by an attribute, assume all direct calls
15049 are in the range of the "b" / "bl" instructions, so use these
15050 instructions for direct calls. The default is -mlong-calls.
15051
15052 -msmall16
15053 Assume addresses can be loaded as 16-bit unsigned values. This
15054 does not apply to function addresses for which -mlong-calls
15055 semantics are in effect.
15056
15057 -mfp-mode=mode
15058 Set the prevailing mode of the floating-point unit. This
15059 determines the floating-point mode that is provided and expected at
15060 function call and return time. Making this mode match the mode you
15061 predominantly need at function start can make your programs smaller
15062 and faster by avoiding unnecessary mode switches.
15063
15064 mode can be set to one the following values:
15065
15066 caller
15067 Any mode at function entry is valid, and retained or restored
15068 when the function returns, and when it calls other functions.
15069 This mode is useful for compiling libraries or other
15070 compilation units you might want to incorporate into different
15071 programs with different prevailing FPU modes, and the
15072 convenience of being able to use a single object file outweighs
15073 the size and speed overhead for any extra mode switching that
15074 might be needed, compared with what would be needed with a more
15075 specific choice of prevailing FPU mode.
15076
15077 truncate
15078 This is the mode used for floating-point calculations with
15079 truncating (i.e. round towards zero) rounding mode. That
15080 includes conversion from floating point to integer.
15081
15082 round-nearest
15083 This is the mode used for floating-point calculations with
15084 round-to-nearest-or-even rounding mode.
15085
15086 int This is the mode used to perform integer calculations in the
15087 FPU, e.g. integer multiply, or integer multiply-and-
15088 accumulate.
15089
15090 The default is -mfp-mode=caller
15091
15092 -mno-split-lohi
15093 -mno-postinc
15094 -mno-postmodify
15095 Code generation tweaks that disable, respectively, splitting of
15096 32-bit loads, generation of post-increment addresses, and
15097 generation of post-modify addresses. The defaults are msplit-lohi,
15098 -mpost-inc, and -mpost-modify.
15099
15100 -mnovect-double
15101 Change the preferred SIMD mode to SImode. The default is
15102 -mvect-double, which uses DImode as preferred SIMD mode.
15103
15104 -max-vect-align=num
15105 The maximum alignment for SIMD vector mode types. num may be 4 or
15106 8. The default is 8. Note that this is an ABI change, even though
15107 many library function interfaces are unaffected if they don't use
15108 SIMD vector modes in places that affect size and/or alignment of
15109 relevant types.
15110
15111 -msplit-vecmove-early
15112 Split vector moves into single word moves before reload. In theory
15113 this can give better register allocation, but so far the reverse
15114 seems to be generally the case.
15115
15116 -m1reg-reg
15117 Specify a register to hold the constant -1, which makes loading
15118 small negative constants and certain bitmasks faster. Allowable
15119 values for reg are r43 and r63, which specify use of that register
15120 as a fixed register, and none, which means that no register is used
15121 for this purpose. The default is -m1reg-none.
15122
15123 AMD GCN Options
15124
15125 These options are defined specifically for the AMD GCN port.
15126
15127 -march=gpu
15128 -mtune=gpu
15129 Set architecture type or tuning for gpu. Supported values for gpu
15130 are
15131
15132 fiji
15133 Compile for GCN3 Fiji devices (gfx803).
15134
15135 gfx900
15136 Compile for GCN5 Vega 10 devices (gfx900).
15137
15138 gfx906
15139 Compile for GCN5 Vega 20 devices (gfx906).
15140
15141 -mstack-size=bytes
15142 Specify how many bytes of stack space will be requested for each
15143 GPU thread (wave-front). Beware that there may be many threads and
15144 limited memory available. The size of the stack allocation may
15145 also have an impact on run-time performance. The default is 32KB
15146 when using OpenACC or OpenMP, and 1MB otherwise.
15147
15148 ARC Options
15149
15150 The following options control the architecture variant for which code
15151 is being compiled:
15152
15153 -mbarrel-shifter
15154 Generate instructions supported by barrel shifter. This is the
15155 default unless -mcpu=ARC601 or -mcpu=ARCEM is in effect.
15156
15157 -mjli-always
15158 Force to call a function using jli_s instruction. This option is
15159 valid only for ARCv2 architecture.
15160
15161 -mcpu=cpu
15162 Set architecture type, register usage, and instruction scheduling
15163 parameters for cpu. There are also shortcut alias options
15164 available for backward compatibility and convenience. Supported
15165 values for cpu are
15166
15167 arc600
15168 Compile for ARC600. Aliases: -mA6, -mARC600.
15169
15170 arc601
15171 Compile for ARC601. Alias: -mARC601.
15172
15173 arc700
15174 Compile for ARC700. Aliases: -mA7, -mARC700. This is the
15175 default when configured with --with-cpu=arc700.
15176
15177 arcem
15178 Compile for ARC EM.
15179
15180 archs
15181 Compile for ARC HS.
15182
15183 em Compile for ARC EM CPU with no hardware extensions.
15184
15185 em4 Compile for ARC EM4 CPU.
15186
15187 em4_dmips
15188 Compile for ARC EM4 DMIPS CPU.
15189
15190 em4_fpus
15191 Compile for ARC EM4 DMIPS CPU with the single-precision
15192 floating-point extension.
15193
15194 em4_fpuda
15195 Compile for ARC EM4 DMIPS CPU with single-precision floating-
15196 point and double assist instructions.
15197
15198 hs Compile for ARC HS CPU with no hardware extensions except the
15199 atomic instructions.
15200
15201 hs34
15202 Compile for ARC HS34 CPU.
15203
15204 hs38
15205 Compile for ARC HS38 CPU.
15206
15207 hs38_linux
15208 Compile for ARC HS38 CPU with all hardware extensions on.
15209
15210 arc600_norm
15211 Compile for ARC 600 CPU with "norm" instructions enabled.
15212
15213 arc600_mul32x16
15214 Compile for ARC 600 CPU with "norm" and 32x16-bit multiply
15215 instructions enabled.
15216
15217 arc600_mul64
15218 Compile for ARC 600 CPU with "norm" and "mul64"-family
15219 instructions enabled.
15220
15221 arc601_norm
15222 Compile for ARC 601 CPU with "norm" instructions enabled.
15223
15224 arc601_mul32x16
15225 Compile for ARC 601 CPU with "norm" and 32x16-bit multiply
15226 instructions enabled.
15227
15228 arc601_mul64
15229 Compile for ARC 601 CPU with "norm" and "mul64"-family
15230 instructions enabled.
15231
15232 nps400
15233 Compile for ARC 700 on NPS400 chip.
15234
15235 em_mini
15236 Compile for ARC EM minimalist configuration featuring reduced
15237 register set.
15238
15239 -mdpfp
15240 -mdpfp-compact
15241 Generate double-precision FPX instructions, tuned for the compact
15242 implementation.
15243
15244 -mdpfp-fast
15245 Generate double-precision FPX instructions, tuned for the fast
15246 implementation.
15247
15248 -mno-dpfp-lrsr
15249 Disable "lr" and "sr" instructions from using FPX extension aux
15250 registers.
15251
15252 -mea
15253 Generate extended arithmetic instructions. Currently only "divaw",
15254 "adds", "subs", and "sat16" are supported. Only valid for
15255 -mcpu=ARC700.
15256
15257 -mno-mpy
15258 Do not generate "mpy"-family instructions for ARC700. This option
15259 is deprecated.
15260
15261 -mmul32x16
15262 Generate 32x16-bit multiply and multiply-accumulate instructions.
15263
15264 -mmul64
15265 Generate "mul64" and "mulu64" instructions. Only valid for
15266 -mcpu=ARC600.
15267
15268 -mnorm
15269 Generate "norm" instructions. This is the default if -mcpu=ARC700
15270 is in effect.
15271
15272 -mspfp
15273 -mspfp-compact
15274 Generate single-precision FPX instructions, tuned for the compact
15275 implementation.
15276
15277 -mspfp-fast
15278 Generate single-precision FPX instructions, tuned for the fast
15279 implementation.
15280
15281 -msimd
15282 Enable generation of ARC SIMD instructions via target-specific
15283 builtins. Only valid for -mcpu=ARC700.
15284
15285 -msoft-float
15286 This option ignored; it is provided for compatibility purposes
15287 only. Software floating-point code is emitted by default, and this
15288 default can overridden by FPX options; -mspfp, -mspfp-compact, or
15289 -mspfp-fast for single precision, and -mdpfp, -mdpfp-compact, or
15290 -mdpfp-fast for double precision.
15291
15292 -mswap
15293 Generate "swap" instructions.
15294
15295 -matomic
15296 This enables use of the locked load/store conditional extension to
15297 implement atomic memory built-in functions. Not available for ARC
15298 6xx or ARC EM cores.
15299
15300 -mdiv-rem
15301 Enable "div" and "rem" instructions for ARCv2 cores.
15302
15303 -mcode-density
15304 Enable code density instructions for ARC EM. This option is on by
15305 default for ARC HS.
15306
15307 -mll64
15308 Enable double load/store operations for ARC HS cores.
15309
15310 -mtp-regno=regno
15311 Specify thread pointer register number.
15312
15313 -mmpy-option=multo
15314 Compile ARCv2 code with a multiplier design option. You can
15315 specify the option using either a string or numeric value for
15316 multo. wlh1 is the default value. The recognized values are:
15317
15318 0
15319 none
15320 No multiplier available.
15321
15322 1
15323 w 16x16 multiplier, fully pipelined. The following instructions
15324 are enabled: "mpyw" and "mpyuw".
15325
15326 2
15327 wlh1
15328 32x32 multiplier, fully pipelined (1 stage). The following
15329 instructions are additionally enabled: "mpy", "mpyu", "mpym",
15330 "mpymu", and "mpy_s".
15331
15332 3
15333 wlh2
15334 32x32 multiplier, fully pipelined (2 stages). The following
15335 instructions are additionally enabled: "mpy", "mpyu", "mpym",
15336 "mpymu", and "mpy_s".
15337
15338 4
15339 wlh3
15340 Two 16x16 multipliers, blocking, sequential. The following
15341 instructions are additionally enabled: "mpy", "mpyu", "mpym",
15342 "mpymu", and "mpy_s".
15343
15344 5
15345 wlh4
15346 One 16x16 multiplier, blocking, sequential. The following
15347 instructions are additionally enabled: "mpy", "mpyu", "mpym",
15348 "mpymu", and "mpy_s".
15349
15350 6
15351 wlh5
15352 One 32x4 multiplier, blocking, sequential. The following
15353 instructions are additionally enabled: "mpy", "mpyu", "mpym",
15354 "mpymu", and "mpy_s".
15355
15356 7
15357 plus_dmpy
15358 ARC HS SIMD support.
15359
15360 8
15361 plus_macd
15362 ARC HS SIMD support.
15363
15364 9
15365 plus_qmacw
15366 ARC HS SIMD support.
15367
15368 This option is only available for ARCv2 cores.
15369
15370 -mfpu=fpu
15371 Enables support for specific floating-point hardware extensions for
15372 ARCv2 cores. Supported values for fpu are:
15373
15374 fpus
15375 Enables support for single-precision floating-point hardware
15376 extensions.
15377
15378 fpud
15379 Enables support for double-precision floating-point hardware
15380 extensions. The single-precision floating-point extension is
15381 also enabled. Not available for ARC EM.
15382
15383 fpuda
15384 Enables support for double-precision floating-point hardware
15385 extensions using double-precision assist instructions. The
15386 single-precision floating-point extension is also enabled.
15387 This option is only available for ARC EM.
15388
15389 fpuda_div
15390 Enables support for double-precision floating-point hardware
15391 extensions using double-precision assist instructions. The
15392 single-precision floating-point, square-root, and divide
15393 extensions are also enabled. This option is only available for
15394 ARC EM.
15395
15396 fpuda_fma
15397 Enables support for double-precision floating-point hardware
15398 extensions using double-precision assist instructions. The
15399 single-precision floating-point and fused multiply and add
15400 hardware extensions are also enabled. This option is only
15401 available for ARC EM.
15402
15403 fpuda_all
15404 Enables support for double-precision floating-point hardware
15405 extensions using double-precision assist instructions. All
15406 single-precision floating-point hardware extensions are also
15407 enabled. This option is only available for ARC EM.
15408
15409 fpus_div
15410 Enables support for single-precision floating-point, square-
15411 root and divide hardware extensions.
15412
15413 fpud_div
15414 Enables support for double-precision floating-point, square-
15415 root and divide hardware extensions. This option includes
15416 option fpus_div. Not available for ARC EM.
15417
15418 fpus_fma
15419 Enables support for single-precision floating-point and fused
15420 multiply and add hardware extensions.
15421
15422 fpud_fma
15423 Enables support for double-precision floating-point and fused
15424 multiply and add hardware extensions. This option includes
15425 option fpus_fma. Not available for ARC EM.
15426
15427 fpus_all
15428 Enables support for all single-precision floating-point
15429 hardware extensions.
15430
15431 fpud_all
15432 Enables support for all single- and double-precision floating-
15433 point hardware extensions. Not available for ARC EM.
15434
15435 -mirq-ctrl-saved=register-range, blink, lp_count
15436 Specifies general-purposes registers that the processor
15437 automatically saves/restores on interrupt entry and exit.
15438 register-range is specified as two registers separated by a dash.
15439 The register range always starts with "r0", the upper limit is "fp"
15440 register. blink and lp_count are optional. This option is only
15441 valid for ARC EM and ARC HS cores.
15442
15443 -mrgf-banked-regs=number
15444 Specifies the number of registers replicated in second register
15445 bank on entry to fast interrupt. Fast interrupts are interrupts
15446 with the highest priority level P0. These interrupts save only PC
15447 and STATUS32 registers to avoid memory transactions during
15448 interrupt entry and exit sequences. Use this option when you are
15449 using fast interrupts in an ARC V2 family processor. Permitted
15450 values are 4, 8, 16, and 32.
15451
15452 -mlpc-width=width
15453 Specify the width of the "lp_count" register. Valid values for
15454 width are 8, 16, 20, 24, 28 and 32 bits. The default width is
15455 fixed to 32 bits. If the width is less than 32, the compiler does
15456 not attempt to transform loops in your program to use the zero-
15457 delay loop mechanism unless it is known that the "lp_count"
15458 register can hold the required loop-counter value. Depending on
15459 the width specified, the compiler and run-time library might
15460 continue to use the loop mechanism for various needs. This option
15461 defines macro "__ARC_LPC_WIDTH__" with the value of width.
15462
15463 -mrf16
15464 This option instructs the compiler to generate code for a 16-entry
15465 register file. This option defines the "__ARC_RF16__" preprocessor
15466 macro.
15467
15468 -mbranch-index
15469 Enable use of "bi" or "bih" instructions to implement jump tables.
15470
15471 The following options are passed through to the assembler, and also
15472 define preprocessor macro symbols.
15473
15474 -mdsp-packa
15475 Passed down to the assembler to enable the DSP Pack A extensions.
15476 Also sets the preprocessor symbol "__Xdsp_packa". This option is
15477 deprecated.
15478
15479 -mdvbf
15480 Passed down to the assembler to enable the dual Viterbi butterfly
15481 extension. Also sets the preprocessor symbol "__Xdvbf". This
15482 option is deprecated.
15483
15484 -mlock
15485 Passed down to the assembler to enable the locked load/store
15486 conditional extension. Also sets the preprocessor symbol
15487 "__Xlock".
15488
15489 -mmac-d16
15490 Passed down to the assembler. Also sets the preprocessor symbol
15491 "__Xxmac_d16". This option is deprecated.
15492
15493 -mmac-24
15494 Passed down to the assembler. Also sets the preprocessor symbol
15495 "__Xxmac_24". This option is deprecated.
15496
15497 -mrtsc
15498 Passed down to the assembler to enable the 64-bit time-stamp
15499 counter extension instruction. Also sets the preprocessor symbol
15500 "__Xrtsc". This option is deprecated.
15501
15502 -mswape
15503 Passed down to the assembler to enable the swap byte ordering
15504 extension instruction. Also sets the preprocessor symbol
15505 "__Xswape".
15506
15507 -mtelephony
15508 Passed down to the assembler to enable dual- and single-operand
15509 instructions for telephony. Also sets the preprocessor symbol
15510 "__Xtelephony". This option is deprecated.
15511
15512 -mxy
15513 Passed down to the assembler to enable the XY memory extension.
15514 Also sets the preprocessor symbol "__Xxy".
15515
15516 The following options control how the assembly code is annotated:
15517
15518 -misize
15519 Annotate assembler instructions with estimated addresses.
15520
15521 -mannotate-align
15522 Explain what alignment considerations lead to the decision to make
15523 an instruction short or long.
15524
15525 The following options are passed through to the linker:
15526
15527 -marclinux
15528 Passed through to the linker, to specify use of the "arclinux"
15529 emulation. This option is enabled by default in tool chains built
15530 for "arc-linux-uclibc" and "arceb-linux-uclibc" targets when
15531 profiling is not requested.
15532
15533 -marclinux_prof
15534 Passed through to the linker, to specify use of the "arclinux_prof"
15535 emulation. This option is enabled by default in tool chains built
15536 for "arc-linux-uclibc" and "arceb-linux-uclibc" targets when
15537 profiling is requested.
15538
15539 The following options control the semantics of generated code:
15540
15541 -mlong-calls
15542 Generate calls as register indirect calls, thus providing access to
15543 the full 32-bit address range.
15544
15545 -mmedium-calls
15546 Don't use less than 25-bit addressing range for calls, which is the
15547 offset available for an unconditional branch-and-link instruction.
15548 Conditional execution of function calls is suppressed, to allow use
15549 of the 25-bit range, rather than the 21-bit range with conditional
15550 branch-and-link. This is the default for tool chains built for
15551 "arc-linux-uclibc" and "arceb-linux-uclibc" targets.
15552
15553 -G num
15554 Put definitions of externally-visible data in a small data section
15555 if that data is no bigger than num bytes. The default value of num
15556 is 4 for any ARC configuration, or 8 when we have double load/store
15557 operations.
15558
15559 -mno-sdata
15560 Do not generate sdata references. This is the default for tool
15561 chains built for "arc-linux-uclibc" and "arceb-linux-uclibc"
15562 targets.
15563
15564 -mvolatile-cache
15565 Use ordinarily cached memory accesses for volatile references.
15566 This is the default.
15567
15568 -mno-volatile-cache
15569 Enable cache bypass for volatile references.
15570
15571 The following options fine tune code generation:
15572
15573 -malign-call
15574 Do alignment optimizations for call instructions.
15575
15576 -mauto-modify-reg
15577 Enable the use of pre/post modify with register displacement.
15578
15579 -mbbit-peephole
15580 Enable bbit peephole2.
15581
15582 -mno-brcc
15583 This option disables a target-specific pass in arc_reorg to
15584 generate compare-and-branch ("brcc") instructions. It has no
15585 effect on generation of these instructions driven by the combiner
15586 pass.
15587
15588 -mcase-vector-pcrel
15589 Use PC-relative switch case tables to enable case table shortening.
15590 This is the default for -Os.
15591
15592 -mcompact-casesi
15593 Enable compact "casesi" pattern. This is the default for -Os, and
15594 only available for ARCv1 cores. This option is deprecated.
15595
15596 -mno-cond-exec
15597 Disable the ARCompact-specific pass to generate conditional
15598 execution instructions.
15599
15600 Due to delay slot scheduling and interactions between operand
15601 numbers, literal sizes, instruction lengths, and the support for
15602 conditional execution, the target-independent pass to generate
15603 conditional execution is often lacking, so the ARC port has kept a
15604 special pass around that tries to find more conditional execution
15605 generation opportunities after register allocation, branch
15606 shortening, and delay slot scheduling have been done. This pass
15607 generally, but not always, improves performance and code size, at
15608 the cost of extra compilation time, which is why there is an option
15609 to switch it off. If you have a problem with call instructions
15610 exceeding their allowable offset range because they are
15611 conditionalized, you should consider using -mmedium-calls instead.
15612
15613 -mearly-cbranchsi
15614 Enable pre-reload use of the "cbranchsi" pattern.
15615
15616 -mexpand-adddi
15617 Expand "adddi3" and "subdi3" at RTL generation time into "add.f",
15618 "adc" etc. This option is deprecated.
15619
15620 -mindexed-loads
15621 Enable the use of indexed loads. This can be problematic because
15622 some optimizers then assume that indexed stores exist, which is not
15623 the case.
15624
15625 -mlra
15626 Enable Local Register Allocation. This is still experimental for
15627 ARC, so by default the compiler uses standard reload (i.e.
15628 -mno-lra).
15629
15630 -mlra-priority-none
15631 Don't indicate any priority for target registers.
15632
15633 -mlra-priority-compact
15634 Indicate target register priority for r0..r3 / r12..r15.
15635
15636 -mlra-priority-noncompact
15637 Reduce target register priority for r0..r3 / r12..r15.
15638
15639 -mmillicode
15640 When optimizing for size (using -Os), prologues and epilogues that
15641 have to save or restore a large number of registers are often
15642 shortened by using call to a special function in libgcc; this is
15643 referred to as a millicode call. As these calls can pose
15644 performance issues, and/or cause linking issues when linking in a
15645 nonstandard way, this option is provided to turn on or off
15646 millicode call generation.
15647
15648 -mcode-density-frame
15649 This option enable the compiler to emit "enter" and "leave"
15650 instructions. These instructions are only valid for CPUs with
15651 code-density feature.
15652
15653 -mmixed-code
15654 Tweak register allocation to help 16-bit instruction generation.
15655 This generally has the effect of decreasing the average instruction
15656 size while increasing the instruction count.
15657
15658 -mq-class
15659 Ths option is deprecated. Enable q instruction alternatives. This
15660 is the default for -Os.
15661
15662 -mRcq
15663 Enable Rcq constraint handling. Most short code generation depends
15664 on this. This is the default.
15665
15666 -mRcw
15667 Enable Rcw constraint handling. Most ccfsm condexec mostly depends
15668 on this. This is the default.
15669
15670 -msize-level=level
15671 Fine-tune size optimization with regards to instruction lengths and
15672 alignment. The recognized values for level are:
15673
15674 0 No size optimization. This level is deprecated and treated
15675 like 1.
15676
15677 1 Short instructions are used opportunistically.
15678
15679 2 In addition, alignment of loops and of code after barriers are
15680 dropped.
15681
15682 3 In addition, optional data alignment is dropped, and the option
15683 Os is enabled.
15684
15685 This defaults to 3 when -Os is in effect. Otherwise, the behavior
15686 when this is not set is equivalent to level 1.
15687
15688 -mtune=cpu
15689 Set instruction scheduling parameters for cpu, overriding any
15690 implied by -mcpu=.
15691
15692 Supported values for cpu are
15693
15694 ARC600
15695 Tune for ARC600 CPU.
15696
15697 ARC601
15698 Tune for ARC601 CPU.
15699
15700 ARC700
15701 Tune for ARC700 CPU with standard multiplier block.
15702
15703 ARC700-xmac
15704 Tune for ARC700 CPU with XMAC block.
15705
15706 ARC725D
15707 Tune for ARC725D CPU.
15708
15709 ARC750D
15710 Tune for ARC750D CPU.
15711
15712 -mmultcost=num
15713 Cost to assume for a multiply instruction, with 4 being equal to a
15714 normal instruction.
15715
15716 -munalign-prob-threshold=probability
15717 Set probability threshold for unaligning branches. When tuning for
15718 ARC700 and optimizing for speed, branches without filled delay slot
15719 are preferably emitted unaligned and long, unless profiling
15720 indicates that the probability for the branch to be taken is below
15721 probability. The default is (REG_BR_PROB_BASE/2), i.e. 5000.
15722
15723 The following options are maintained for backward compatibility, but
15724 are now deprecated and will be removed in a future release:
15725
15726 -margonaut
15727 Obsolete FPX.
15728
15729 -mbig-endian
15730 -EB Compile code for big-endian targets. Use of these options is now
15731 deprecated. Big-endian code is supported by configuring GCC to
15732 build "arceb-elf32" and "arceb-linux-uclibc" targets, for which big
15733 endian is the default.
15734
15735 -mlittle-endian
15736 -EL Compile code for little-endian targets. Use of these options is
15737 now deprecated. Little-endian code is supported by configuring GCC
15738 to build "arc-elf32" and "arc-linux-uclibc" targets, for which
15739 little endian is the default.
15740
15741 -mbarrel_shifter
15742 Replaced by -mbarrel-shifter.
15743
15744 -mdpfp_compact
15745 Replaced by -mdpfp-compact.
15746
15747 -mdpfp_fast
15748 Replaced by -mdpfp-fast.
15749
15750 -mdsp_packa
15751 Replaced by -mdsp-packa.
15752
15753 -mEA
15754 Replaced by -mea.
15755
15756 -mmac_24
15757 Replaced by -mmac-24.
15758
15759 -mmac_d16
15760 Replaced by -mmac-d16.
15761
15762 -mspfp_compact
15763 Replaced by -mspfp-compact.
15764
15765 -mspfp_fast
15766 Replaced by -mspfp-fast.
15767
15768 -mtune=cpu
15769 Values arc600, arc601, arc700 and arc700-xmac for cpu are replaced
15770 by ARC600, ARC601, ARC700 and ARC700-xmac respectively.
15771
15772 -multcost=num
15773 Replaced by -mmultcost.
15774
15775 ARM Options
15776
15777 These -m options are defined for the ARM port:
15778
15779 -mabi=name
15780 Generate code for the specified ABI. Permissible values are: apcs-
15781 gnu, atpcs, aapcs, aapcs-linux and iwmmxt.
15782
15783 -mapcs-frame
15784 Generate a stack frame that is compliant with the ARM Procedure
15785 Call Standard for all functions, even if this is not strictly
15786 necessary for correct execution of the code. Specifying
15787 -fomit-frame-pointer with this option causes the stack frames not
15788 to be generated for leaf functions. The default is
15789 -mno-apcs-frame. This option is deprecated.
15790
15791 -mapcs
15792 This is a synonym for -mapcs-frame and is deprecated.
15793
15794 -mthumb-interwork
15795 Generate code that supports calling between the ARM and Thumb
15796 instruction sets. Without this option, on pre-v5 architectures,
15797 the two instruction sets cannot be reliably used inside one
15798 program. The default is -mno-thumb-interwork, since slightly
15799 larger code is generated when -mthumb-interwork is specified. In
15800 AAPCS configurations this option is meaningless.
15801
15802 -mno-sched-prolog
15803 Prevent the reordering of instructions in the function prologue, or
15804 the merging of those instruction with the instructions in the
15805 function's body. This means that all functions start with a
15806 recognizable set of instructions (or in fact one of a choice from a
15807 small set of different function prologues), and this information
15808 can be used to locate the start of functions inside an executable
15809 piece of code. The default is -msched-prolog.
15810
15811 -mfloat-abi=name
15812 Specifies which floating-point ABI to use. Permissible values are:
15813 soft, softfp and hard.
15814
15815 Specifying soft causes GCC to generate output containing library
15816 calls for floating-point operations. softfp allows the generation
15817 of code using hardware floating-point instructions, but still uses
15818 the soft-float calling conventions. hard allows generation of
15819 floating-point instructions and uses FPU-specific calling
15820 conventions.
15821
15822 The default depends on the specific target configuration. Note
15823 that the hard-float and soft-float ABIs are not link-compatible;
15824 you must compile your entire program with the same ABI, and link
15825 with a compatible set of libraries.
15826
15827 -mgeneral-regs-only
15828 Generate code which uses only the general-purpose registers. This
15829 will prevent the compiler from using floating-point and Advanced
15830 SIMD registers but will not impose any restrictions on the
15831 assembler.
15832
15833 -mlittle-endian
15834 Generate code for a processor running in little-endian mode. This
15835 is the default for all standard configurations.
15836
15837 -mbig-endian
15838 Generate code for a processor running in big-endian mode; the
15839 default is to compile code for a little-endian processor.
15840
15841 -mbe8
15842 -mbe32
15843 When linking a big-endian image select between BE8 and BE32
15844 formats. The option has no effect for little-endian images and is
15845 ignored. The default is dependent on the selected target
15846 architecture. For ARMv6 and later architectures the default is
15847 BE8, for older architectures the default is BE32. BE32 format has
15848 been deprecated by ARM.
15849
15850 -march=name[+extension...]
15851 This specifies the name of the target ARM architecture. GCC uses
15852 this name to determine what kind of instructions it can emit when
15853 generating assembly code. This option can be used in conjunction
15854 with or instead of the -mcpu= option.
15855
15856 Permissible names are: armv4t, armv5t, armv5te, armv6, armv6j,
15857 armv6k, armv6kz, armv6t2, armv6z, armv6zk, armv7, armv7-a, armv7ve,
15858 armv8-a, armv8.1-a, armv8.2-a, armv8.3-a, armv8.4-a, armv8.5-a,
15859 armv8.6-a, armv7-r, armv8-r, armv6-m, armv6s-m, armv7-m, armv7e-m,
15860 armv8-m.base, armv8-m.main, armv8.1-m.main, iwmmxt and iwmmxt2.
15861
15862 Additionally, the following architectures, which lack support for
15863 the Thumb execution state, are recognized but support is
15864 deprecated: armv4.
15865
15866 Many of the architectures support extensions. These can be added
15867 by appending +extension to the architecture name. Extension
15868 options are processed in order and capabilities accumulate. An
15869 extension will also enable any necessary base extensions upon which
15870 it depends. For example, the +crypto extension will always enable
15871 the +simd extension. The exception to the additive construction is
15872 for extensions that are prefixed with +no...: these extensions
15873 disable the specified option and any other extensions that may
15874 depend on the presence of that extension.
15875
15876 For example, -march=armv7-a+simd+nofp+vfpv4 is equivalent to
15877 writing -march=armv7-a+vfpv4 since the +simd option is entirely
15878 disabled by the +nofp option that follows it.
15879
15880 Most extension names are generically named, but have an effect that
15881 is dependent upon the architecture to which it is applied. For
15882 example, the +simd option can be applied to both armv7-a and
15883 armv8-a architectures, but will enable the original ARMv7-A
15884 Advanced SIMD (Neon) extensions for armv7-a and the ARMv8-A variant
15885 for armv8-a.
15886
15887 The table below lists the supported extensions for each
15888 architecture. Architectures not mentioned do not support any
15889 extensions.
15890
15891 armv5te
15892 armv6
15893 armv6j
15894 armv6k
15895 armv6kz
15896 armv6t2
15897 armv6z
15898 armv6zk
15899 +fp The VFPv2 floating-point instructions. The extension
15900 +vfpv2 can be used as an alias for this extension.
15901
15902 +nofp
15903 Disable the floating-point instructions.
15904
15905 armv7
15906 The common subset of the ARMv7-A, ARMv7-R and ARMv7-M
15907 architectures.
15908
15909 +fp The VFPv3 floating-point instructions, with 16 double-
15910 precision registers. The extension +vfpv3-d16 can be used
15911 as an alias for this extension. Note that floating-point
15912 is not supported by the base ARMv7-M architecture, but is
15913 compatible with both the ARMv7-A and ARMv7-R architectures.
15914
15915 +nofp
15916 Disable the floating-point instructions.
15917
15918 armv7-a
15919 +mp The multiprocessing extension.
15920
15921 +sec
15922 The security extension.
15923
15924 +fp The VFPv3 floating-point instructions, with 16 double-
15925 precision registers. The extension +vfpv3-d16 can be used
15926 as an alias for this extension.
15927
15928 +simd
15929 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point
15930 instructions. The extensions +neon and +neon-vfpv3 can be
15931 used as aliases for this extension.
15932
15933 +vfpv3
15934 The VFPv3 floating-point instructions, with 32 double-
15935 precision registers.
15936
15937 +vfpv3-d16-fp16
15938 The VFPv3 floating-point instructions, with 16 double-
15939 precision registers and the half-precision floating-point
15940 conversion operations.
15941
15942 +vfpv3-fp16
15943 The VFPv3 floating-point instructions, with 32 double-
15944 precision registers and the half-precision floating-point
15945 conversion operations.
15946
15947 +vfpv4-d16
15948 The VFPv4 floating-point instructions, with 16 double-
15949 precision registers.
15950
15951 +vfpv4
15952 The VFPv4 floating-point instructions, with 32 double-
15953 precision registers.
15954
15955 +neon-fp16
15956 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point
15957 instructions, with the half-precision floating-point
15958 conversion operations.
15959
15960 +neon-vfpv4
15961 The Advanced SIMD (Neon) v2 and the VFPv4 floating-point
15962 instructions.
15963
15964 +nosimd
15965 Disable the Advanced SIMD instructions (does not disable
15966 floating point).
15967
15968 +nofp
15969 Disable the floating-point and Advanced SIMD instructions.
15970
15971 armv7ve
15972 The extended version of the ARMv7-A architecture with support
15973 for virtualization.
15974
15975 +fp The VFPv4 floating-point instructions, with 16 double-
15976 precision registers. The extension +vfpv4-d16 can be used
15977 as an alias for this extension.
15978
15979 +simd
15980 The Advanced SIMD (Neon) v2 and the VFPv4 floating-point
15981 instructions. The extension +neon-vfpv4 can be used as an
15982 alias for this extension.
15983
15984 +vfpv3-d16
15985 The VFPv3 floating-point instructions, with 16 double-
15986 precision registers.
15987
15988 +vfpv3
15989 The VFPv3 floating-point instructions, with 32 double-
15990 precision registers.
15991
15992 +vfpv3-d16-fp16
15993 The VFPv3 floating-point instructions, with 16 double-
15994 precision registers and the half-precision floating-point
15995 conversion operations.
15996
15997 +vfpv3-fp16
15998 The VFPv3 floating-point instructions, with 32 double-
15999 precision registers and the half-precision floating-point
16000 conversion operations.
16001
16002 +vfpv4-d16
16003 The VFPv4 floating-point instructions, with 16 double-
16004 precision registers.
16005
16006 +vfpv4
16007 The VFPv4 floating-point instructions, with 32 double-
16008 precision registers.
16009
16010 +neon
16011 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point
16012 instructions. The extension +neon-vfpv3 can be used as an
16013 alias for this extension.
16014
16015 +neon-fp16
16016 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point
16017 instructions, with the half-precision floating-point
16018 conversion operations.
16019
16020 +nosimd
16021 Disable the Advanced SIMD instructions (does not disable
16022 floating point).
16023
16024 +nofp
16025 Disable the floating-point and Advanced SIMD instructions.
16026
16027 armv8-a
16028 +crc
16029 The Cyclic Redundancy Check (CRC) instructions.
16030
16031 +simd
16032 The ARMv8-A Advanced SIMD and floating-point instructions.
16033
16034 +crypto
16035 The cryptographic instructions.
16036
16037 +nocrypto
16038 Disable the cryptographic instructions.
16039
16040 +nofp
16041 Disable the floating-point, Advanced SIMD and cryptographic
16042 instructions.
16043
16044 +sb Speculation Barrier Instruction.
16045
16046 +predres
16047 Execution and Data Prediction Restriction Instructions.
16048
16049 armv8.1-a
16050 +simd
16051 The ARMv8.1-A Advanced SIMD and floating-point
16052 instructions.
16053
16054 +crypto
16055 The cryptographic instructions. This also enables the
16056 Advanced SIMD and floating-point instructions.
16057
16058 +nocrypto
16059 Disable the cryptographic instructions.
16060
16061 +nofp
16062 Disable the floating-point, Advanced SIMD and cryptographic
16063 instructions.
16064
16065 +sb Speculation Barrier Instruction.
16066
16067 +predres
16068 Execution and Data Prediction Restriction Instructions.
16069
16070 armv8.2-a
16071 armv8.3-a
16072 +fp16
16073 The half-precision floating-point data processing
16074 instructions. This also enables the Advanced SIMD and
16075 floating-point instructions.
16076
16077 +fp16fml
16078 The half-precision floating-point fmla extension. This
16079 also enables the half-precision floating-point extension
16080 and Advanced SIMD and floating-point instructions.
16081
16082 +simd
16083 The ARMv8.1-A Advanced SIMD and floating-point
16084 instructions.
16085
16086 +crypto
16087 The cryptographic instructions. This also enables the
16088 Advanced SIMD and floating-point instructions.
16089
16090 +dotprod
16091 Enable the Dot Product extension. This also enables
16092 Advanced SIMD instructions.
16093
16094 +nocrypto
16095 Disable the cryptographic extension.
16096
16097 +nofp
16098 Disable the floating-point, Advanced SIMD and cryptographic
16099 instructions.
16100
16101 +sb Speculation Barrier Instruction.
16102
16103 +predres
16104 Execution and Data Prediction Restriction Instructions.
16105
16106 +i8mm
16107 8-bit Integer Matrix Multiply instructions. This also
16108 enables Advanced SIMD and floating-point instructions.
16109
16110 +bf16
16111 Brain half-precision floating-point instructions. This
16112 also enables Advanced SIMD and floating-point instructions.
16113
16114 armv8.4-a
16115 +fp16
16116 The half-precision floating-point data processing
16117 instructions. This also enables the Advanced SIMD and
16118 floating-point instructions as well as the Dot Product
16119 extension and the half-precision floating-point fmla
16120 extension.
16121
16122 +simd
16123 The ARMv8.3-A Advanced SIMD and floating-point instructions
16124 as well as the Dot Product extension.
16125
16126 +crypto
16127 The cryptographic instructions. This also enables the
16128 Advanced SIMD and floating-point instructions as well as
16129 the Dot Product extension.
16130
16131 +nocrypto
16132 Disable the cryptographic extension.
16133
16134 +nofp
16135 Disable the floating-point, Advanced SIMD and cryptographic
16136 instructions.
16137
16138 +sb Speculation Barrier Instruction.
16139
16140 +predres
16141 Execution and Data Prediction Restriction Instructions.
16142
16143 +i8mm
16144 8-bit Integer Matrix Multiply instructions. This also
16145 enables Advanced SIMD and floating-point instructions.
16146
16147 +bf16
16148 Brain half-precision floating-point instructions. This
16149 also enables Advanced SIMD and floating-point instructions.
16150
16151 armv8.5-a
16152 +fp16
16153 The half-precision floating-point data processing
16154 instructions. This also enables the Advanced SIMD and
16155 floating-point instructions as well as the Dot Product
16156 extension and the half-precision floating-point fmla
16157 extension.
16158
16159 +simd
16160 The ARMv8.3-A Advanced SIMD and floating-point instructions
16161 as well as the Dot Product extension.
16162
16163 +crypto
16164 The cryptographic instructions. This also enables the
16165 Advanced SIMD and floating-point instructions as well as
16166 the Dot Product extension.
16167
16168 +nocrypto
16169 Disable the cryptographic extension.
16170
16171 +nofp
16172 Disable the floating-point, Advanced SIMD and cryptographic
16173 instructions.
16174
16175 +i8mm
16176 8-bit Integer Matrix Multiply instructions. This also
16177 enables Advanced SIMD and floating-point instructions.
16178
16179 +bf16
16180 Brain half-precision floating-point instructions. This
16181 also enables Advanced SIMD and floating-point instructions.
16182
16183 armv8.6-a
16184 +fp16
16185 The half-precision floating-point data processing
16186 instructions. This also enables the Advanced SIMD and
16187 floating-point instructions as well as the Dot Product
16188 extension and the half-precision floating-point fmla
16189 extension.
16190
16191 +simd
16192 The ARMv8.3-A Advanced SIMD and floating-point instructions
16193 as well as the Dot Product extension.
16194
16195 +crypto
16196 The cryptographic instructions. This also enables the
16197 Advanced SIMD and floating-point instructions as well as
16198 the Dot Product extension.
16199
16200 +nocrypto
16201 Disable the cryptographic extension.
16202
16203 +nofp
16204 Disable the floating-point, Advanced SIMD and cryptographic
16205 instructions.
16206
16207 +i8mm
16208 8-bit Integer Matrix Multiply instructions. This also
16209 enables Advanced SIMD and floating-point instructions.
16210
16211 +bf16
16212 Brain half-precision floating-point instructions. This
16213 also enables Advanced SIMD and floating-point instructions.
16214
16215 armv7-r
16216 +fp.sp
16217 The single-precision VFPv3 floating-point instructions.
16218 The extension +vfpv3xd can be used as an alias for this
16219 extension.
16220
16221 +fp The VFPv3 floating-point instructions with 16 double-
16222 precision registers. The extension +vfpv3-d16 can be used
16223 as an alias for this extension.
16224
16225 +vfpv3xd-d16-fp16
16226 The single-precision VFPv3 floating-point instructions with
16227 16 double-precision registers and the half-precision
16228 floating-point conversion operations.
16229
16230 +vfpv3-d16-fp16
16231 The VFPv3 floating-point instructions with 16 double-
16232 precision registers and the half-precision floating-point
16233 conversion operations.
16234
16235 +nofp
16236 Disable the floating-point extension.
16237
16238 +idiv
16239 The ARM-state integer division instructions.
16240
16241 +noidiv
16242 Disable the ARM-state integer division extension.
16243
16244 armv7e-m
16245 +fp The single-precision VFPv4 floating-point instructions.
16246
16247 +fpv5
16248 The single-precision FPv5 floating-point instructions.
16249
16250 +fp.dp
16251 The single- and double-precision FPv5 floating-point
16252 instructions.
16253
16254 +nofp
16255 Disable the floating-point extensions.
16256
16257 armv8.1-m.main
16258 +dsp
16259 The DSP instructions.
16260
16261 +mve
16262 The M-Profile Vector Extension (MVE) integer instructions.
16263
16264 +mve.fp
16265 The M-Profile Vector Extension (MVE) integer and single
16266 precision floating-point instructions.
16267
16268 +fp The single-precision floating-point instructions.
16269
16270 +fp.dp
16271 The single- and double-precision floating-point
16272 instructions.
16273
16274 +nofp
16275 Disable the floating-point extension.
16276
16277 +cdecp0, +cdecp1, ... , +cdecp7
16278 Enable the Custom Datapath Extension (CDE) on selected
16279 coprocessors according to the numbers given in the options
16280 in the range 0 to 7.
16281
16282 armv8-m.main
16283 +dsp
16284 The DSP instructions.
16285
16286 +nodsp
16287 Disable the DSP extension.
16288
16289 +fp The single-precision floating-point instructions.
16290
16291 +fp.dp
16292 The single- and double-precision floating-point
16293 instructions.
16294
16295 +nofp
16296 Disable the floating-point extension.
16297
16298 +cdecp0, +cdecp1, ... , +cdecp7
16299 Enable the Custom Datapath Extension (CDE) on selected
16300 coprocessors according to the numbers given in the options
16301 in the range 0 to 7.
16302
16303 armv8-r
16304 +crc
16305 The Cyclic Redundancy Check (CRC) instructions.
16306
16307 +fp.sp
16308 The single-precision FPv5 floating-point instructions.
16309
16310 +simd
16311 The ARMv8-A Advanced SIMD and floating-point instructions.
16312
16313 +crypto
16314 The cryptographic instructions.
16315
16316 +nocrypto
16317 Disable the cryptographic instructions.
16318
16319 +nofp
16320 Disable the floating-point, Advanced SIMD and cryptographic
16321 instructions.
16322
16323 -march=native causes the compiler to auto-detect the architecture
16324 of the build computer. At present, this feature is only supported
16325 on GNU/Linux, and not all architectures are recognized. If the
16326 auto-detect is unsuccessful the option has no effect.
16327
16328 -mtune=name
16329 This option specifies the name of the target ARM processor for
16330 which GCC should tune the performance of the code. For some ARM
16331 implementations better performance can be obtained by using this
16332 option. Permissible names are: arm7tdmi, arm7tdmi-s, arm710t,
16333 arm720t, arm740t, strongarm, strongarm110, strongarm1100,
16334 0strongarm1110, arm8, arm810, arm9, arm9e, arm920, arm920t,
16335 arm922t, arm946e-s, arm966e-s, arm968e-s, arm926ej-s, arm940t,
16336 arm9tdmi, arm10tdmi, arm1020t, arm1026ej-s, arm10e, arm1020e,
16337 arm1022e, arm1136j-s, arm1136jf-s, mpcore, mpcorenovfp,
16338 arm1156t2-s, arm1156t2f-s, arm1176jz-s, arm1176jzf-s,
16339 generic-armv7-a, cortex-a5, cortex-a7, cortex-a8, cortex-a9,
16340 cortex-a12, cortex-a15, cortex-a17, cortex-a32, cortex-a35,
16341 cortex-a53, cortex-a55, cortex-a57, cortex-a72, cortex-a73,
16342 cortex-a75, cortex-a76, cortex-a76ae, cortex-a77, ares, cortex-r4,
16343 cortex-r4f, cortex-r5, cortex-r7, cortex-r8, cortex-r52, cortex-m0,
16344 cortex-m0plus, cortex-m1, cortex-m3, cortex-m4, cortex-m7,
16345 cortex-m23, cortex-m33, cortex-m35p, cortex-m55,
16346 cortex-m1.small-multiply, cortex-m0.small-multiply,
16347 cortex-m0plus.small-multiply, exynos-m1, marvell-pj4, neoverse-n1,
16348 xscale, iwmmxt, iwmmxt2, ep9312, fa526, fa626, fa606te, fa626te,
16349 fmp626, fa726te, xgene1.
16350
16351 Additionally, this option can specify that GCC should tune the
16352 performance of the code for a big.LITTLE system. Permissible names
16353 are: cortex-a15.cortex-a7, cortex-a17.cortex-a7,
16354 cortex-a57.cortex-a53, cortex-a72.cortex-a53,
16355 cortex-a72.cortex-a35, cortex-a73.cortex-a53,
16356 cortex-a75.cortex-a55, cortex-a76.cortex-a55.
16357
16358 -mtune=generic-arch specifies that GCC should tune the performance
16359 for a blend of processors within architecture arch. The aim is to
16360 generate code that run well on the current most popular processors,
16361 balancing between optimizations that benefit some CPUs in the
16362 range, and avoiding performance pitfalls of other CPUs. The
16363 effects of this option may change in future GCC versions as CPU
16364 models come and go.
16365
16366 -mtune permits the same extension options as -mcpu, but the
16367 extension options do not affect the tuning of the generated code.
16368
16369 -mtune=native causes the compiler to auto-detect the CPU of the
16370 build computer. At present, this feature is only supported on
16371 GNU/Linux, and not all architectures are recognized. If the auto-
16372 detect is unsuccessful the option has no effect.
16373
16374 -mcpu=name[+extension...]
16375 This specifies the name of the target ARM processor. GCC uses this
16376 name to derive the name of the target ARM architecture (as if
16377 specified by -march) and the ARM processor type for which to tune
16378 for performance (as if specified by -mtune). Where this option is
16379 used in conjunction with -march or -mtune, those options take
16380 precedence over the appropriate part of this option.
16381
16382 Many of the supported CPUs implement optional architectural
16383 extensions. Where this is so the architectural extensions are
16384 normally enabled by default. If implementations that lack the
16385 extension exist, then the extension syntax can be used to disable
16386 those extensions that have been omitted. For floating-point and
16387 Advanced SIMD (Neon) instructions, the settings of the options
16388 -mfloat-abi and -mfpu must also be considered: floating-point and
16389 Advanced SIMD instructions will only be used if -mfloat-abi is not
16390 set to soft; and any setting of -mfpu other than auto will override
16391 the available floating-point and SIMD extension instructions.
16392
16393 For example, cortex-a9 can be found in three major configurations:
16394 integer only, with just a floating-point unit or with floating-
16395 point and Advanced SIMD. The default is to enable all the
16396 instructions, but the extensions +nosimd and +nofp can be used to
16397 disable just the SIMD or both the SIMD and floating-point
16398 instructions respectively.
16399
16400 Permissible names for this option are the same as those for -mtune.
16401
16402 The following extension options are common to the listed CPUs:
16403
16404 +nodsp
16405 Disable the DSP instructions on cortex-m33, cortex-m35p.
16406
16407 +nofp
16408 Disables the floating-point instructions on arm9e, arm946e-s,
16409 arm966e-s, arm968e-s, arm10e, arm1020e, arm1022e, arm926ej-s,
16410 arm1026ej-s, cortex-r5, cortex-r7, cortex-r8, cortex-m4,
16411 cortex-m7, cortex-m33 and cortex-m35p. Disables the floating-
16412 point and SIMD instructions on generic-armv7-a, cortex-a5,
16413 cortex-a7, cortex-a8, cortex-a9, cortex-a12, cortex-a15,
16414 cortex-a17, cortex-a15.cortex-a7, cortex-a17.cortex-a7,
16415 cortex-a32, cortex-a35, cortex-a53 and cortex-a55.
16416
16417 +nofp.dp
16418 Disables the double-precision component of the floating-point
16419 instructions on cortex-r5, cortex-r7, cortex-r8, cortex-r52 and
16420 cortex-m7.
16421
16422 +nosimd
16423 Disables the SIMD (but not floating-point) instructions on
16424 generic-armv7-a, cortex-a5, cortex-a7 and cortex-a9.
16425
16426 +crypto
16427 Enables the cryptographic instructions on cortex-a32,
16428 cortex-a35, cortex-a53, cortex-a55, cortex-a57, cortex-a72,
16429 cortex-a73, cortex-a75, exynos-m1, xgene1,
16430 cortex-a57.cortex-a53, cortex-a72.cortex-a53,
16431 cortex-a73.cortex-a35, cortex-a73.cortex-a53 and
16432 cortex-a75.cortex-a55.
16433
16434 Additionally the generic-armv7-a pseudo target defaults to VFPv3
16435 with 16 double-precision registers. It supports the following
16436 extension options: mp, sec, vfpv3-d16, vfpv3, vfpv3-d16-fp16,
16437 vfpv3-fp16, vfpv4-d16, vfpv4, neon, neon-vfpv3, neon-fp16,
16438 neon-vfpv4. The meanings are the same as for the extensions to
16439 -march=armv7-a.
16440
16441 -mcpu=generic-arch is also permissible, and is equivalent to
16442 -march=arch -mtune=generic-arch. See -mtune for more information.
16443
16444 -mcpu=native causes the compiler to auto-detect the CPU of the
16445 build computer. At present, this feature is only supported on
16446 GNU/Linux, and not all architectures are recognized. If the auto-
16447 detect is unsuccessful the option has no effect.
16448
16449 -mfpu=name
16450 This specifies what floating-point hardware (or hardware emulation)
16451 is available on the target. Permissible names are: auto, vfpv2,
16452 vfpv3, vfpv3-fp16, vfpv3-d16, vfpv3-d16-fp16, vfpv3xd,
16453 vfpv3xd-fp16, neon-vfpv3, neon-fp16, vfpv4, vfpv4-d16, fpv4-sp-d16,
16454 neon-vfpv4, fpv5-d16, fpv5-sp-d16, fp-armv8, neon-fp-armv8 and
16455 crypto-neon-fp-armv8. Note that neon is an alias for neon-vfpv3
16456 and vfp is an alias for vfpv2.
16457
16458 The setting auto is the default and is special. It causes the
16459 compiler to select the floating-point and Advanced SIMD
16460 instructions based on the settings of -mcpu and -march.
16461
16462 If the selected floating-point hardware includes the NEON extension
16463 (e.g. -mfpu=neon), note that floating-point operations are not
16464 generated by GCC's auto-vectorization pass unless
16465 -funsafe-math-optimizations is also specified. This is because
16466 NEON hardware does not fully implement the IEEE 754 standard for
16467 floating-point arithmetic (in particular denormal values are
16468 treated as zero), so the use of NEON instructions may lead to a
16469 loss of precision.
16470
16471 You can also set the fpu name at function level by using the
16472 "target("fpu=")" function attributes or pragmas.
16473
16474 -mfp16-format=name
16475 Specify the format of the "__fp16" half-precision floating-point
16476 type. Permissible names are none, ieee, and alternative; the
16477 default is none, in which case the "__fp16" type is not defined.
16478
16479 -mstructure-size-boundary=n
16480 The sizes of all structures and unions are rounded up to a multiple
16481 of the number of bits set by this option. Permissible values are
16482 8, 32 and 64. The default value varies for different toolchains.
16483 For the COFF targeted toolchain the default value is 8. A value of
16484 64 is only allowed if the underlying ABI supports it.
16485
16486 Specifying a larger number can produce faster, more efficient code,
16487 but can also increase the size of the program. Different values
16488 are potentially incompatible. Code compiled with one value cannot
16489 necessarily expect to work with code or libraries compiled with
16490 another value, if they exchange information using structures or
16491 unions.
16492
16493 This option is deprecated.
16494
16495 -mabort-on-noreturn
16496 Generate a call to the function "abort" at the end of a "noreturn"
16497 function. It is executed if the function tries to return.
16498
16499 -mlong-calls
16500 -mno-long-calls
16501 Tells the compiler to perform function calls by first loading the
16502 address of the function into a register and then performing a
16503 subroutine call on this register. This switch is needed if the
16504 target function lies outside of the 64-megabyte addressing range of
16505 the offset-based version of subroutine call instruction.
16506
16507 Even if this switch is enabled, not all function calls are turned
16508 into long calls. The heuristic is that static functions, functions
16509 that have the "short_call" attribute, functions that are inside the
16510 scope of a "#pragma no_long_calls" directive, and functions whose
16511 definitions have already been compiled within the current
16512 compilation unit are not turned into long calls. The exceptions to
16513 this rule are that weak function definitions, functions with the
16514 "long_call" attribute or the "section" attribute, and functions
16515 that are within the scope of a "#pragma long_calls" directive are
16516 always turned into long calls.
16517
16518 This feature is not enabled by default. Specifying -mno-long-calls
16519 restores the default behavior, as does placing the function calls
16520 within the scope of a "#pragma long_calls_off" directive. Note
16521 these switches have no effect on how the compiler generates code to
16522 handle function calls via function pointers.
16523
16524 -msingle-pic-base
16525 Treat the register used for PIC addressing as read-only, rather
16526 than loading it in the prologue for each function. The runtime
16527 system is responsible for initializing this register with an
16528 appropriate value before execution begins.
16529
16530 -mpic-register=reg
16531 Specify the register to be used for PIC addressing. For standard
16532 PIC base case, the default is any suitable register determined by
16533 compiler. For single PIC base case, the default is R9 if target is
16534 EABI based or stack-checking is enabled, otherwise the default is
16535 R10.
16536
16537 -mpic-data-is-text-relative
16538 Assume that the displacement between the text and data segments is
16539 fixed at static link time. This permits using PC-relative
16540 addressing operations to access data known to be in the data
16541 segment. For non-VxWorks RTP targets, this option is enabled by
16542 default. When disabled on such targets, it will enable
16543 -msingle-pic-base by default.
16544
16545 -mpoke-function-name
16546 Write the name of each function into the text section, directly
16547 preceding the function prologue. The generated code is similar to
16548 this:
16549
16550 t0
16551 .ascii "arm_poke_function_name", 0
16552 .align
16553 t1
16554 .word 0xff000000 + (t1 - t0)
16555 arm_poke_function_name
16556 mov ip, sp
16557 stmfd sp!, {fp, ip, lr, pc}
16558 sub fp, ip, #4
16559
16560 When performing a stack backtrace, code can inspect the value of
16561 "pc" stored at "fp + 0". If the trace function then looks at
16562 location "pc - 12" and the top 8 bits are set, then we know that
16563 there is a function name embedded immediately preceding this
16564 location and has length "((pc[-3]) & 0xff000000)".
16565
16566 -mthumb
16567 -marm
16568 Select between generating code that executes in ARM and Thumb
16569 states. The default for most configurations is to generate code
16570 that executes in ARM state, but the default can be changed by
16571 configuring GCC with the --with-mode=state configure option.
16572
16573 You can also override the ARM and Thumb mode for each function by
16574 using the "target("thumb")" and "target("arm")" function attributes
16575 or pragmas.
16576
16577 -mflip-thumb
16578 Switch ARM/Thumb modes on alternating functions. This option is
16579 provided for regression testing of mixed Thumb/ARM code generation,
16580 and is not intended for ordinary use in compiling code.
16581
16582 -mtpcs-frame
16583 Generate a stack frame that is compliant with the Thumb Procedure
16584 Call Standard for all non-leaf functions. (A leaf function is one
16585 that does not call any other functions.) The default is
16586 -mno-tpcs-frame.
16587
16588 -mtpcs-leaf-frame
16589 Generate a stack frame that is compliant with the Thumb Procedure
16590 Call Standard for all leaf functions. (A leaf function is one that
16591 does not call any other functions.) The default is
16592 -mno-apcs-leaf-frame.
16593
16594 -mcallee-super-interworking
16595 Gives all externally visible functions in the file being compiled
16596 an ARM instruction set header which switches to Thumb mode before
16597 executing the rest of the function. This allows these functions to
16598 be called from non-interworking code. This option is not valid in
16599 AAPCS configurations because interworking is enabled by default.
16600
16601 -mcaller-super-interworking
16602 Allows calls via function pointers (including virtual functions) to
16603 execute correctly regardless of whether the target code has been
16604 compiled for interworking or not. There is a small overhead in the
16605 cost of executing a function pointer if this option is enabled.
16606 This option is not valid in AAPCS configurations because
16607 interworking is enabled by default.
16608
16609 -mtp=name
16610 Specify the access model for the thread local storage pointer. The
16611 valid models are soft, which generates calls to "__aeabi_read_tp",
16612 cp15, which fetches the thread pointer from "cp15" directly
16613 (supported in the arm6k architecture), and auto, which uses the
16614 best available method for the selected processor. The default
16615 setting is auto.
16616
16617 -mtls-dialect=dialect
16618 Specify the dialect to use for accessing thread local storage. Two
16619 dialects are supported---gnu and gnu2. The gnu dialect selects the
16620 original GNU scheme for supporting local and global dynamic TLS
16621 models. The gnu2 dialect selects the GNU descriptor scheme, which
16622 provides better performance for shared libraries. The GNU
16623 descriptor scheme is compatible with the original scheme, but does
16624 require new assembler, linker and library support. Initial and
16625 local exec TLS models are unaffected by this option and always use
16626 the original scheme.
16627
16628 -mword-relocations
16629 Only generate absolute relocations on word-sized values (i.e.
16630 R_ARM_ABS32). This is enabled by default on targets (uClinux,
16631 SymbianOS) where the runtime loader imposes this restriction, and
16632 when -fpic or -fPIC is specified. This option conflicts with
16633 -mslow-flash-data.
16634
16635 -mfix-cortex-m3-ldrd
16636 Some Cortex-M3 cores can cause data corruption when "ldrd"
16637 instructions with overlapping destination and base registers are
16638 used. This option avoids generating these instructions. This
16639 option is enabled by default when -mcpu=cortex-m3 is specified.
16640
16641 -munaligned-access
16642 -mno-unaligned-access
16643 Enables (or disables) reading and writing of 16- and 32- bit values
16644 from addresses that are not 16- or 32- bit aligned. By default
16645 unaligned access is disabled for all pre-ARMv6, all ARMv6-M and for
16646 ARMv8-M Baseline architectures, and enabled for all other
16647 architectures. If unaligned access is not enabled then words in
16648 packed data structures are accessed a byte at a time.
16649
16650 The ARM attribute "Tag_CPU_unaligned_access" is set in the
16651 generated object file to either true or false, depending upon the
16652 setting of this option. If unaligned access is enabled then the
16653 preprocessor symbol "__ARM_FEATURE_UNALIGNED" is also defined.
16654
16655 -mneon-for-64bits
16656 This option is deprecated and has no effect.
16657
16658 -mslow-flash-data
16659 Assume loading data from flash is slower than fetching instruction.
16660 Therefore literal load is minimized for better performance. This
16661 option is only supported when compiling for ARMv7 M-profile and off
16662 by default. It conflicts with -mword-relocations.
16663
16664 -masm-syntax-unified
16665 Assume inline assembler is using unified asm syntax. The default
16666 is currently off which implies divided syntax. This option has no
16667 impact on Thumb2. However, this may change in future releases of
16668 GCC. Divided syntax should be considered deprecated.
16669
16670 -mrestrict-it
16671 Restricts generation of IT blocks to conform to the rules of
16672 ARMv8-A. IT blocks can only contain a single 16-bit instruction
16673 from a select set of instructions. This option is on by default for
16674 ARMv8-A Thumb mode.
16675
16676 -mprint-tune-info
16677 Print CPU tuning information as comment in assembler file. This is
16678 an option used only for regression testing of the compiler and not
16679 intended for ordinary use in compiling code. This option is
16680 disabled by default.
16681
16682 -mverbose-cost-dump
16683 Enable verbose cost model dumping in the debug dump files. This
16684 option is provided for use in debugging the compiler.
16685
16686 -mpure-code
16687 Do not allow constant data to be placed in code sections.
16688 Additionally, when compiling for ELF object format give all text
16689 sections the ELF processor-specific section attribute
16690 "SHF_ARM_PURECODE". This option is only available when generating
16691 non-pic code for M-profile targets.
16692
16693 -mcmse
16694 Generate secure code as per the "ARMv8-M Security Extensions:
16695 Requirements on Development Tools Engineering Specification", which
16696 can be found on
16697 <https://developer.arm.com/documentation/ecm0359818/latest/>.
16698
16699 -mfdpic
16700 -mno-fdpic
16701 Select the FDPIC ABI, which uses 64-bit function descriptors to
16702 represent pointers to functions. When the compiler is configured
16703 for "arm-*-uclinuxfdpiceabi" targets, this option is on by default
16704 and implies -fPIE if none of the PIC/PIE-related options is
16705 provided. On other targets, it only enables the FDPIC-specific
16706 code generation features, and the user should explicitly provide
16707 the PIC/PIE-related options as needed.
16708
16709 Note that static linking is not supported because it would still
16710 involve the dynamic linker when the program self-relocates. If
16711 such behavior is acceptable, use -static and -Wl,-dynamic-linker
16712 options.
16713
16714 The opposite -mno-fdpic option is useful (and required) to build
16715 the Linux kernel using the same ("arm-*-uclinuxfdpiceabi")
16716 toolchain as the one used to build the userland programs.
16717
16718 AVR Options
16719
16720 These options are defined for AVR implementations:
16721
16722 -mmcu=mcu
16723 Specify Atmel AVR instruction set architectures (ISA) or MCU type.
16724
16725 The default for this option is@tie{}avr2.
16726
16727 GCC supports the following AVR devices and ISAs:
16728
16729 "avr2"
16730 "Classic" devices with up to 8@tie{}KiB of program memory.
16731 mcu@tie{}= "attiny22", "attiny26", "at90s2313", "at90s2323",
16732 "at90s2333", "at90s2343", "at90s4414", "at90s4433",
16733 "at90s4434", "at90c8534", "at90s8515", "at90s8535".
16734
16735 "avr25"
16736 "Classic" devices with up to 8@tie{}KiB of program memory and
16737 with the "MOVW" instruction. mcu@tie{}= "attiny13",
16738 "attiny13a", "attiny24", "attiny24a", "attiny25", "attiny261",
16739 "attiny261a", "attiny2313", "attiny2313a", "attiny43u",
16740 "attiny44", "attiny44a", "attiny45", "attiny48", "attiny441",
16741 "attiny461", "attiny461a", "attiny4313", "attiny84",
16742 "attiny84a", "attiny85", "attiny87", "attiny88", "attiny828",
16743 "attiny841", "attiny861", "attiny861a", "ata5272", "ata6616c",
16744 "at86rf401".
16745
16746 "avr3"
16747 "Classic" devices with 16@tie{}KiB up to 64@tie{}KiB of program
16748 memory. mcu@tie{}= "at76c711", "at43usb355".
16749
16750 "avr31"
16751 "Classic" devices with 128@tie{}KiB of program memory.
16752 mcu@tie{}= "atmega103", "at43usb320".
16753
16754 "avr35"
16755 "Classic" devices with 16@tie{}KiB up to 64@tie{}KiB of program
16756 memory and with the "MOVW" instruction. mcu@tie{}=
16757 "attiny167", "attiny1634", "atmega8u2", "atmega16u2",
16758 "atmega32u2", "ata5505", "ata6617c", "ata664251", "at90usb82",
16759 "at90usb162".
16760
16761 "avr4"
16762 "Enhanced" devices with up to 8@tie{}KiB of program memory.
16763 mcu@tie{}= "atmega48", "atmega48a", "atmega48p", "atmega48pa",
16764 "atmega48pb", "atmega8", "atmega8a", "atmega8hva", "atmega88",
16765 "atmega88a", "atmega88p", "atmega88pa", "atmega88pb",
16766 "atmega8515", "atmega8535", "ata6285", "ata6286", "ata6289",
16767 "ata6612c", "at90pwm1", "at90pwm2", "at90pwm2b", "at90pwm3",
16768 "at90pwm3b", "at90pwm81".
16769
16770 "avr5"
16771 "Enhanced" devices with 16@tie{}KiB up to 64@tie{}KiB of
16772 program memory. mcu@tie{}= "atmega16", "atmega16a",
16773 "atmega16hva", "atmega16hva2", "atmega16hvb",
16774 "atmega16hvbrevb", "atmega16m1", "atmega16u4", "atmega161",
16775 "atmega162", "atmega163", "atmega164a", "atmega164p",
16776 "atmega164pa", "atmega165", "atmega165a", "atmega165p",
16777 "atmega165pa", "atmega168", "atmega168a", "atmega168p",
16778 "atmega168pa", "atmega168pb", "atmega169", "atmega169a",
16779 "atmega169p", "atmega169pa", "atmega32", "atmega32a",
16780 "atmega32c1", "atmega32hvb", "atmega32hvbrevb", "atmega32m1",
16781 "atmega32u4", "atmega32u6", "atmega323", "atmega324a",
16782 "atmega324p", "atmega324pa", "atmega325", "atmega325a",
16783 "atmega325p", "atmega325pa", "atmega328", "atmega328p",
16784 "atmega328pb", "atmega329", "atmega329a", "atmega329p",
16785 "atmega329pa", "atmega3250", "atmega3250a", "atmega3250p",
16786 "atmega3250pa", "atmega3290", "atmega3290a", "atmega3290p",
16787 "atmega3290pa", "atmega406", "atmega64", "atmega64a",
16788 "atmega64c1", "atmega64hve", "atmega64hve2", "atmega64m1",
16789 "atmega64rfr2", "atmega640", "atmega644", "atmega644a",
16790 "atmega644p", "atmega644pa", "atmega644rfr2", "atmega645",
16791 "atmega645a", "atmega645p", "atmega649", "atmega649a",
16792 "atmega649p", "atmega6450", "atmega6450a", "atmega6450p",
16793 "atmega6490", "atmega6490a", "atmega6490p", "ata5795",
16794 "ata5790", "ata5790n", "ata5791", "ata6613c", "ata6614q",
16795 "ata5782", "ata5831", "ata8210", "ata8510", "ata5702m322",
16796 "at90pwm161", "at90pwm216", "at90pwm316", "at90can32",
16797 "at90can64", "at90scr100", "at90usb646", "at90usb647", "at94k",
16798 "m3000".
16799
16800 "avr51"
16801 "Enhanced" devices with 128@tie{}KiB of program memory.
16802 mcu@tie{}= "atmega128", "atmega128a", "atmega128rfa1",
16803 "atmega128rfr2", "atmega1280", "atmega1281", "atmega1284",
16804 "atmega1284p", "atmega1284rfr2", "at90can128", "at90usb1286",
16805 "at90usb1287".
16806
16807 "avr6"
16808 "Enhanced" devices with 3-byte PC, i.e. with more than
16809 128@tie{}KiB of program memory. mcu@tie{}= "atmega256rfr2",
16810 "atmega2560", "atmega2561", "atmega2564rfr2".
16811
16812 "avrxmega2"
16813 "XMEGA" devices with more than 8@tie{}KiB and up to 64@tie{}KiB
16814 of program memory. mcu@tie{}= "atxmega8e5", "atxmega16a4",
16815 "atxmega16a4u", "atxmega16c4", "atxmega16d4", "atxmega16e5",
16816 "atxmega32a4", "atxmega32a4u", "atxmega32c3", "atxmega32c4",
16817 "atxmega32d3", "atxmega32d4", "atxmega32e5".
16818
16819 "avrxmega3"
16820 "XMEGA" devices with up to 64@tie{}KiB of combined program
16821 memory and RAM, and with program memory visible in the RAM
16822 address space. mcu@tie{}= "attiny202", "attiny204",
16823 "attiny212", "attiny214", "attiny402", "attiny404",
16824 "attiny406", "attiny412", "attiny414", "attiny416",
16825 "attiny417", "attiny804", "attiny806", "attiny807",
16826 "attiny814", "attiny816", "attiny817", "attiny1604",
16827 "attiny1606", "attiny1607", "attiny1614", "attiny1616",
16828 "attiny1617", "attiny3214", "attiny3216", "attiny3217",
16829 "atmega808", "atmega809", "atmega1608", "atmega1609",
16830 "atmega3208", "atmega3209", "atmega4808", "atmega4809".
16831
16832 "avrxmega4"
16833 "XMEGA" devices with more than 64@tie{}KiB and up to
16834 128@tie{}KiB of program memory. mcu@tie{}= "atxmega64a3",
16835 "atxmega64a3u", "atxmega64a4u", "atxmega64b1", "atxmega64b3",
16836 "atxmega64c3", "atxmega64d3", "atxmega64d4".
16837
16838 "avrxmega5"
16839 "XMEGA" devices with more than 64@tie{}KiB and up to
16840 128@tie{}KiB of program memory and more than 64@tie{}KiB of
16841 RAM. mcu@tie{}= "atxmega64a1", "atxmega64a1u".
16842
16843 "avrxmega6"
16844 "XMEGA" devices with more than 128@tie{}KiB of program memory.
16845 mcu@tie{}= "atxmega128a3", "atxmega128a3u", "atxmega128b1",
16846 "atxmega128b3", "atxmega128c3", "atxmega128d3", "atxmega128d4",
16847 "atxmega192a3", "atxmega192a3u", "atxmega192c3",
16848 "atxmega192d3", "atxmega256a3", "atxmega256a3b",
16849 "atxmega256a3bu", "atxmega256a3u", "atxmega256c3",
16850 "atxmega256d3", "atxmega384c3", "atxmega384d3".
16851
16852 "avrxmega7"
16853 "XMEGA" devices with more than 128@tie{}KiB of program memory
16854 and more than 64@tie{}KiB of RAM. mcu@tie{}= "atxmega128a1",
16855 "atxmega128a1u", "atxmega128a4u".
16856
16857 "avrtiny"
16858 "TINY" Tiny core devices with 512@tie{}B up to 4@tie{}KiB of
16859 program memory. mcu@tie{}= "attiny4", "attiny5", "attiny9",
16860 "attiny10", "attiny20", "attiny40".
16861
16862 "avr1"
16863 This ISA is implemented by the minimal AVR core and supported
16864 for assembler only. mcu@tie{}= "attiny11", "attiny12",
16865 "attiny15", "attiny28", "at90s1200".
16866
16867 -mabsdata
16868 Assume that all data in static storage can be accessed by LDS / STS
16869 instructions. This option has only an effect on reduced Tiny
16870 devices like ATtiny40. See also the "absdata" AVR Variable
16871 Attributes,variable attribute.
16872
16873 -maccumulate-args
16874 Accumulate outgoing function arguments and acquire/release the
16875 needed stack space for outgoing function arguments once in function
16876 prologue/epilogue. Without this option, outgoing arguments are
16877 pushed before calling a function and popped afterwards.
16878
16879 Popping the arguments after the function call can be expensive on
16880 AVR so that accumulating the stack space might lead to smaller
16881 executables because arguments need not be removed from the stack
16882 after such a function call.
16883
16884 This option can lead to reduced code size for functions that
16885 perform several calls to functions that get their arguments on the
16886 stack like calls to printf-like functions.
16887
16888 -mbranch-cost=cost
16889 Set the branch costs for conditional branch instructions to cost.
16890 Reasonable values for cost are small, non-negative integers. The
16891 default branch cost is 0.
16892
16893 -mcall-prologues
16894 Functions prologues/epilogues are expanded as calls to appropriate
16895 subroutines. Code size is smaller.
16896
16897 -mdouble=bits
16898 -mlong-double=bits
16899 Set the size (in bits) of the "double" or "long double" type,
16900 respectively. Possible values for bits are 32 and 64. Whether or
16901 not a specific value for bits is allowed depends on the
16902 "--with-double=" and "--with-long-double=" configure options
16903 ("https://gcc.gnu.org/install/configure.html#avr"), and the same
16904 applies for the default values of the options.
16905
16906 -mgas-isr-prologues
16907 Interrupt service routines (ISRs) may use the "__gcc_isr" pseudo
16908 instruction supported by GNU Binutils. If this option is on, the
16909 feature can still be disabled for individual ISRs by means of the
16910 AVR Function Attributes,,"no_gccisr" function attribute. This
16911 feature is activated per default if optimization is on (but not
16912 with -Og, @pxref{Optimize Options}), and if GNU Binutils support
16913 PR21683 ("https://sourceware.org/PR21683").
16914
16915 -mint8
16916 Assume "int" to be 8-bit integer. This affects the sizes of all
16917 types: a "char" is 1 byte, an "int" is 1 byte, a "long" is 2 bytes,
16918 and "long long" is 4 bytes. Please note that this option does not
16919 conform to the C standards, but it results in smaller code size.
16920
16921 -mmain-is-OS_task
16922 Do not save registers in "main". The effect is the same like
16923 attaching attribute AVR Function Attributes,,"OS_task" to "main".
16924 It is activated per default if optimization is on.
16925
16926 -mn-flash=num
16927 Assume that the flash memory has a size of num times 64@tie{}KiB.
16928
16929 -mno-interrupts
16930 Generated code is not compatible with hardware interrupts. Code
16931 size is smaller.
16932
16933 -mrelax
16934 Try to replace "CALL" resp. "JMP" instruction by the shorter
16935 "RCALL" resp. "RJMP" instruction if applicable. Setting -mrelax
16936 just adds the --mlink-relax option to the assembler's command line
16937 and the --relax option to the linker's command line.
16938
16939 Jump relaxing is performed by the linker because jump offsets are
16940 not known before code is located. Therefore, the assembler code
16941 generated by the compiler is the same, but the instructions in the
16942 executable may differ from instructions in the assembler code.
16943
16944 Relaxing must be turned on if linker stubs are needed, see the
16945 section on "EIND" and linker stubs below.
16946
16947 -mrmw
16948 Assume that the device supports the Read-Modify-Write instructions
16949 "XCH", "LAC", "LAS" and "LAT".
16950
16951 -mshort-calls
16952 Assume that "RJMP" and "RCALL" can target the whole program memory.
16953
16954 This option is used internally for multilib selection. It is not
16955 an optimization option, and you don't need to set it by hand.
16956
16957 -msp8
16958 Treat the stack pointer register as an 8-bit register, i.e. assume
16959 the high byte of the stack pointer is zero. In general, you don't
16960 need to set this option by hand.
16961
16962 This option is used internally by the compiler to select and build
16963 multilibs for architectures "avr2" and "avr25". These
16964 architectures mix devices with and without "SPH". For any setting
16965 other than -mmcu=avr2 or -mmcu=avr25 the compiler driver adds or
16966 removes this option from the compiler proper's command line,
16967 because the compiler then knows if the device or architecture has
16968 an 8-bit stack pointer and thus no "SPH" register or not.
16969
16970 -mstrict-X
16971 Use address register "X" in a way proposed by the hardware. This
16972 means that "X" is only used in indirect, post-increment or pre-
16973 decrement addressing.
16974
16975 Without this option, the "X" register may be used in the same way
16976 as "Y" or "Z" which then is emulated by additional instructions.
16977 For example, loading a value with "X+const" addressing with a small
16978 non-negative "const < 64" to a register Rn is performed as
16979
16980 adiw r26, const ; X += const
16981 ld <Rn>, X ; <Rn> = *X
16982 sbiw r26, const ; X -= const
16983
16984 -mtiny-stack
16985 Only change the lower 8@tie{}bits of the stack pointer.
16986
16987 -mfract-convert-truncate
16988 Allow to use truncation instead of rounding towards zero for
16989 fractional fixed-point types.
16990
16991 -nodevicelib
16992 Don't link against AVR-LibC's device specific library "lib<mcu>.a".
16993
16994 -nodevicespecs
16995 Don't add -specs=device-specs/specs-mcu to the compiler driver's
16996 command line. The user takes responsibility for supplying the sub-
16997 processes like compiler proper, assembler and linker with
16998 appropriate command line options. This means that the user has to
16999 supply her private device specs file by means of -specs=path-to-
17000 specs-file. There is no more need for option -mmcu=mcu.
17001
17002 This option can also serve as a replacement for the older way of
17003 specifying custom device-specs files that needed -B some-path to
17004 point to a directory which contains a folder named "device-specs"
17005 which contains a specs file named "specs-mcu", where mcu was
17006 specified by -mmcu=mcu.
17007
17008 -Waddr-space-convert
17009 Warn about conversions between address spaces in the case where the
17010 resulting address space is not contained in the incoming address
17011 space.
17012
17013 -Wmisspelled-isr
17014 Warn if the ISR is misspelled, i.e. without __vector prefix.
17015 Enabled by default.
17016
17017 "EIND" and Devices with More Than 128 Ki Bytes of Flash
17018
17019 Pointers in the implementation are 16@tie{}bits wide. The address of a
17020 function or label is represented as word address so that indirect jumps
17021 and calls can target any code address in the range of 64@tie{}Ki words.
17022
17023 In order to facilitate indirect jump on devices with more than
17024 128@tie{}Ki bytes of program memory space, there is a special function
17025 register called "EIND" that serves as most significant part of the
17026 target address when "EICALL" or "EIJMP" instructions are used.
17027
17028 Indirect jumps and calls on these devices are handled as follows by the
17029 compiler and are subject to some limitations:
17030
17031 * The compiler never sets "EIND".
17032
17033 * The compiler uses "EIND" implicitly in "EICALL"/"EIJMP"
17034 instructions or might read "EIND" directly in order to emulate an
17035 indirect call/jump by means of a "RET" instruction.
17036
17037 * The compiler assumes that "EIND" never changes during the startup
17038 code or during the application. In particular, "EIND" is not
17039 saved/restored in function or interrupt service routine
17040 prologue/epilogue.
17041
17042 * For indirect calls to functions and computed goto, the linker
17043 generates stubs. Stubs are jump pads sometimes also called
17044 trampolines. Thus, the indirect call/jump jumps to such a stub.
17045 The stub contains a direct jump to the desired address.
17046
17047 * Linker relaxation must be turned on so that the linker generates
17048 the stubs correctly in all situations. See the compiler option
17049 -mrelax and the linker option --relax. There are corner cases
17050 where the linker is supposed to generate stubs but aborts without
17051 relaxation and without a helpful error message.
17052
17053 * The default linker script is arranged for code with "EIND = 0". If
17054 code is supposed to work for a setup with "EIND != 0", a custom
17055 linker script has to be used in order to place the sections whose
17056 name start with ".trampolines" into the segment where "EIND" points
17057 to.
17058
17059 * The startup code from libgcc never sets "EIND". Notice that
17060 startup code is a blend of code from libgcc and AVR-LibC. For the
17061 impact of AVR-LibC on "EIND", see the AVR-LibC user manual
17062 ("http://nongnu.org/avr-libc/user-manual/").
17063
17064 * It is legitimate for user-specific startup code to set up "EIND"
17065 early, for example by means of initialization code located in
17066 section ".init3". Such code runs prior to general startup code that
17067 initializes RAM and calls constructors, but after the bit of
17068 startup code from AVR-LibC that sets "EIND" to the segment where
17069 the vector table is located.
17070
17071 #include <avr/io.h>
17072
17073 static void
17074 __attribute__((section(".init3"),naked,used,no_instrument_function))
17075 init3_set_eind (void)
17076 {
17077 __asm volatile ("ldi r24,pm_hh8(__trampolines_start)\n\t"
17078 "out %i0,r24" :: "n" (&EIND) : "r24","memory");
17079 }
17080
17081 The "__trampolines_start" symbol is defined in the linker script.
17082
17083 * Stubs are generated automatically by the linker if the following
17084 two conditions are met:
17085
17086 -<The address of a label is taken by means of the "gs" modifier>
17087 (short for generate stubs) like so:
17088
17089 LDI r24, lo8(gs(<func>))
17090 LDI r25, hi8(gs(<func>))
17091
17092 -<The final location of that label is in a code segment>
17093 outside the segment where the stubs are located.
17094
17095 * The compiler emits such "gs" modifiers for code labels in the
17096 following situations:
17097
17098 -<Taking address of a function or code label.>
17099 -<Computed goto.>
17100 -<If prologue-save function is used, see -mcall-prologues>
17101 command-line option.
17102
17103 -<Switch/case dispatch tables. If you do not want such dispatch>
17104 tables you can specify the -fno-jump-tables command-line
17105 option.
17106
17107 -<C and C++ constructors/destructors called during
17108 startup/shutdown.>
17109 -<If the tools hit a "gs()" modifier explained above.>
17110 * Jumping to non-symbolic addresses like so is not supported:
17111
17112 int main (void)
17113 {
17114 /* Call function at word address 0x2 */
17115 return ((int(*)(void)) 0x2)();
17116 }
17117
17118 Instead, a stub has to be set up, i.e. the function has to be
17119 called through a symbol ("func_4" in the example):
17120
17121 int main (void)
17122 {
17123 extern int func_4 (void);
17124
17125 /* Call function at byte address 0x4 */
17126 return func_4();
17127 }
17128
17129 and the application be linked with -Wl,--defsym,func_4=0x4.
17130 Alternatively, "func_4" can be defined in the linker script.
17131
17132 Handling of the "RAMPD", "RAMPX", "RAMPY" and "RAMPZ" Special Function
17133 Registers
17134
17135 Some AVR devices support memories larger than the 64@tie{}KiB range
17136 that can be accessed with 16-bit pointers. To access memory locations
17137 outside this 64@tie{}KiB range, the content of a "RAMP" register is
17138 used as high part of the address: The "X", "Y", "Z" address register is
17139 concatenated with the "RAMPX", "RAMPY", "RAMPZ" special function
17140 register, respectively, to get a wide address. Similarly, "RAMPD" is
17141 used together with direct addressing.
17142
17143 * The startup code initializes the "RAMP" special function registers
17144 with zero.
17145
17146 * If a AVR Named Address Spaces,named address space other than
17147 generic or "__flash" is used, then "RAMPZ" is set as needed before
17148 the operation.
17149
17150 * If the device supports RAM larger than 64@tie{}KiB and the compiler
17151 needs to change "RAMPZ" to accomplish an operation, "RAMPZ" is
17152 reset to zero after the operation.
17153
17154 * If the device comes with a specific "RAMP" register, the ISR
17155 prologue/epilogue saves/restores that SFR and initializes it with
17156 zero in case the ISR code might (implicitly) use it.
17157
17158 * RAM larger than 64@tie{}KiB is not supported by GCC for AVR
17159 targets. If you use inline assembler to read from locations
17160 outside the 16-bit address range and change one of the "RAMP"
17161 registers, you must reset it to zero after the access.
17162
17163 AVR Built-in Macros
17164
17165 GCC defines several built-in macros so that the user code can test for
17166 the presence or absence of features. Almost any of the following
17167 built-in macros are deduced from device capabilities and thus triggered
17168 by the -mmcu= command-line option.
17169
17170 For even more AVR-specific built-in macros see AVR Named Address Spaces
17171 and AVR Built-in Functions.
17172
17173 "__AVR_ARCH__"
17174 Build-in macro that resolves to a decimal number that identifies
17175 the architecture and depends on the -mmcu=mcu option. Possible
17176 values are:
17177
17178 2, 25, 3, 31, 35, 4, 5, 51, 6
17179
17180 for mcu="avr2", "avr25", "avr3", "avr31", "avr35", "avr4", "avr5",
17181 "avr51", "avr6",
17182
17183 respectively and
17184
17185 100, 102, 103, 104, 105, 106, 107
17186
17187 for mcu="avrtiny", "avrxmega2", "avrxmega3", "avrxmega4",
17188 "avrxmega5", "avrxmega6", "avrxmega7", respectively. If mcu
17189 specifies a device, this built-in macro is set accordingly. For
17190 example, with -mmcu=atmega8 the macro is defined to 4.
17191
17192 "__AVR_Device__"
17193 Setting -mmcu=device defines this built-in macro which reflects the
17194 device's name. For example, -mmcu=atmega8 defines the built-in
17195 macro "__AVR_ATmega8__", -mmcu=attiny261a defines
17196 "__AVR_ATtiny261A__", etc.
17197
17198 The built-in macros' names follow the scheme "__AVR_Device__" where
17199 Device is the device name as from the AVR user manual. The
17200 difference between Device in the built-in macro and device in
17201 -mmcu=device is that the latter is always lowercase.
17202
17203 If device is not a device but only a core architecture like avr51,
17204 this macro is not defined.
17205
17206 "__AVR_DEVICE_NAME__"
17207 Setting -mmcu=device defines this built-in macro to the device's
17208 name. For example, with -mmcu=atmega8 the macro is defined to
17209 "atmega8".
17210
17211 If device is not a device but only a core architecture like avr51,
17212 this macro is not defined.
17213
17214 "__AVR_XMEGA__"
17215 The device / architecture belongs to the XMEGA family of devices.
17216
17217 "__AVR_HAVE_ELPM__"
17218 The device has the "ELPM" instruction.
17219
17220 "__AVR_HAVE_ELPMX__"
17221 The device has the "ELPM Rn,Z" and "ELPM Rn,Z+" instructions.
17222
17223 "__AVR_HAVE_MOVW__"
17224 The device has the "MOVW" instruction to perform 16-bit register-
17225 register moves.
17226
17227 "__AVR_HAVE_LPMX__"
17228 The device has the "LPM Rn,Z" and "LPM Rn,Z+" instructions.
17229
17230 "__AVR_HAVE_MUL__"
17231 The device has a hardware multiplier.
17232
17233 "__AVR_HAVE_JMP_CALL__"
17234 The device has the "JMP" and "CALL" instructions. This is the case
17235 for devices with more than 8@tie{}KiB of program memory.
17236
17237 "__AVR_HAVE_EIJMP_EICALL__"
17238 "__AVR_3_BYTE_PC__"
17239 The device has the "EIJMP" and "EICALL" instructions. This is the
17240 case for devices with more than 128@tie{}KiB of program memory.
17241 This also means that the program counter (PC) is 3@tie{}bytes wide.
17242
17243 "__AVR_2_BYTE_PC__"
17244 The program counter (PC) is 2@tie{}bytes wide. This is the case for
17245 devices with up to 128@tie{}KiB of program memory.
17246
17247 "__AVR_HAVE_8BIT_SP__"
17248 "__AVR_HAVE_16BIT_SP__"
17249 The stack pointer (SP) register is treated as 8-bit respectively
17250 16-bit register by the compiler. The definition of these macros is
17251 affected by -mtiny-stack.
17252
17253 "__AVR_HAVE_SPH__"
17254 "__AVR_SP8__"
17255 The device has the SPH (high part of stack pointer) special
17256 function register or has an 8-bit stack pointer, respectively. The
17257 definition of these macros is affected by -mmcu= and in the cases
17258 of -mmcu=avr2 and -mmcu=avr25 also by -msp8.
17259
17260 "__AVR_HAVE_RAMPD__"
17261 "__AVR_HAVE_RAMPX__"
17262 "__AVR_HAVE_RAMPY__"
17263 "__AVR_HAVE_RAMPZ__"
17264 The device has the "RAMPD", "RAMPX", "RAMPY", "RAMPZ" special
17265 function register, respectively.
17266
17267 "__NO_INTERRUPTS__"
17268 This macro reflects the -mno-interrupts command-line option.
17269
17270 "__AVR_ERRATA_SKIP__"
17271 "__AVR_ERRATA_SKIP_JMP_CALL__"
17272 Some AVR devices (AT90S8515, ATmega103) must not skip 32-bit
17273 instructions because of a hardware erratum. Skip instructions are
17274 "SBRS", "SBRC", "SBIS", "SBIC" and "CPSE". The second macro is
17275 only defined if "__AVR_HAVE_JMP_CALL__" is also set.
17276
17277 "__AVR_ISA_RMW__"
17278 The device has Read-Modify-Write instructions (XCH, LAC, LAS and
17279 LAT).
17280
17281 "__AVR_SFR_OFFSET__=offset"
17282 Instructions that can address I/O special function registers
17283 directly like "IN", "OUT", "SBI", etc. may use a different address
17284 as if addressed by an instruction to access RAM like "LD" or "STS".
17285 This offset depends on the device architecture and has to be
17286 subtracted from the RAM address in order to get the respective
17287 I/O@tie{}address.
17288
17289 "__AVR_SHORT_CALLS__"
17290 The -mshort-calls command line option is set.
17291
17292 "__AVR_PM_BASE_ADDRESS__=addr"
17293 Some devices support reading from flash memory by means of "LD*"
17294 instructions. The flash memory is seen in the data address space
17295 at an offset of "__AVR_PM_BASE_ADDRESS__". If this macro is not
17296 defined, this feature is not available. If defined, the address
17297 space is linear and there is no need to put ".rodata" into RAM.
17298 This is handled by the default linker description file, and is
17299 currently available for "avrtiny" and "avrxmega3". Even more
17300 convenient, there is no need to use address spaces like "__flash"
17301 or features like attribute "progmem" and "pgm_read_*".
17302
17303 "__WITH_AVRLIBC__"
17304 The compiler is configured to be used together with AVR-Libc. See
17305 the --with-avrlibc configure option.
17306
17307 "__HAVE_DOUBLE_MULTILIB__"
17308 Defined if -mdouble= acts as a multilib option.
17309
17310 "__HAVE_DOUBLE32__"
17311 "__HAVE_DOUBLE64__"
17312 Defined if the compiler supports 32-bit double resp. 64-bit double.
17313 The actual layout is specified by option -mdouble=.
17314
17315 "__DEFAULT_DOUBLE__"
17316 The size in bits of "double" if -mdouble= is not set. To test the
17317 layout of "double" in a program, use the built-in macro
17318 "__SIZEOF_DOUBLE__".
17319
17320 "__HAVE_LONG_DOUBLE32__"
17321 "__HAVE_LONG_DOUBLE64__"
17322 "__HAVE_LONG_DOUBLE_MULTILIB__"
17323 "__DEFAULT_LONG_DOUBLE__"
17324 Same as above, but for "long double" instead of "double".
17325
17326 "__WITH_DOUBLE_COMPARISON__"
17327 Reflects the "--with-double-comparison={tristate|bool|libf7}"
17328 configure option ("https://gcc.gnu.org/install/configure.html#avr")
17329 and is defined to 2 or 3.
17330
17331 "__WITH_LIBF7_LIBGCC__"
17332 "__WITH_LIBF7_MATH__"
17333 "__WITH_LIBF7_MATH_SYMBOLS__"
17334 Reflects the "--with-libf7={libgcc|math|math-symbols}"
17335 configure option
17336 ("https://gcc.gnu.org/install/configure.html#avr").
17337
17338 Blackfin Options
17339
17340 -mcpu=cpu[-sirevision]
17341 Specifies the name of the target Blackfin processor. Currently,
17342 cpu can be one of bf512, bf514, bf516, bf518, bf522, bf523, bf524,
17343 bf525, bf526, bf527, bf531, bf532, bf533, bf534, bf536, bf537,
17344 bf538, bf539, bf542, bf544, bf547, bf548, bf549, bf542m, bf544m,
17345 bf547m, bf548m, bf549m, bf561, bf592.
17346
17347 The optional sirevision specifies the silicon revision of the
17348 target Blackfin processor. Any workarounds available for the
17349 targeted silicon revision are enabled. If sirevision is none, no
17350 workarounds are enabled. If sirevision is any, all workarounds for
17351 the targeted processor are enabled. The "__SILICON_REVISION__"
17352 macro is defined to two hexadecimal digits representing the major
17353 and minor numbers in the silicon revision. If sirevision is none,
17354 the "__SILICON_REVISION__" is not defined. If sirevision is any,
17355 the "__SILICON_REVISION__" is defined to be 0xffff. If this
17356 optional sirevision is not used, GCC assumes the latest known
17357 silicon revision of the targeted Blackfin processor.
17358
17359 GCC defines a preprocessor macro for the specified cpu. For the
17360 bfin-elf toolchain, this option causes the hardware BSP provided by
17361 libgloss to be linked in if -msim is not given.
17362
17363 Without this option, bf532 is used as the processor by default.
17364
17365 Note that support for bf561 is incomplete. For bf561, only the
17366 preprocessor macro is defined.
17367
17368 -msim
17369 Specifies that the program will be run on the simulator. This
17370 causes the simulator BSP provided by libgloss to be linked in.
17371 This option has effect only for bfin-elf toolchain. Certain other
17372 options, such as -mid-shared-library and -mfdpic, imply -msim.
17373
17374 -momit-leaf-frame-pointer
17375 Don't keep the frame pointer in a register for leaf functions.
17376 This avoids the instructions to save, set up and restore frame
17377 pointers and makes an extra register available in leaf functions.
17378
17379 -mspecld-anomaly
17380 When enabled, the compiler ensures that the generated code does not
17381 contain speculative loads after jump instructions. If this option
17382 is used, "__WORKAROUND_SPECULATIVE_LOADS" is defined.
17383
17384 -mno-specld-anomaly
17385 Don't generate extra code to prevent speculative loads from
17386 occurring.
17387
17388 -mcsync-anomaly
17389 When enabled, the compiler ensures that the generated code does not
17390 contain CSYNC or SSYNC instructions too soon after conditional
17391 branches. If this option is used, "__WORKAROUND_SPECULATIVE_SYNCS"
17392 is defined.
17393
17394 -mno-csync-anomaly
17395 Don't generate extra code to prevent CSYNC or SSYNC instructions
17396 from occurring too soon after a conditional branch.
17397
17398 -mlow64k
17399 When enabled, the compiler is free to take advantage of the
17400 knowledge that the entire program fits into the low 64k of memory.
17401
17402 -mno-low64k
17403 Assume that the program is arbitrarily large. This is the default.
17404
17405 -mstack-check-l1
17406 Do stack checking using information placed into L1 scratchpad
17407 memory by the uClinux kernel.
17408
17409 -mid-shared-library
17410 Generate code that supports shared libraries via the library ID
17411 method. This allows for execute in place and shared libraries in
17412 an environment without virtual memory management. This option
17413 implies -fPIC. With a bfin-elf target, this option implies -msim.
17414
17415 -mno-id-shared-library
17416 Generate code that doesn't assume ID-based shared libraries are
17417 being used. This is the default.
17418
17419 -mleaf-id-shared-library
17420 Generate code that supports shared libraries via the library ID
17421 method, but assumes that this library or executable won't link
17422 against any other ID shared libraries. That allows the compiler to
17423 use faster code for jumps and calls.
17424
17425 -mno-leaf-id-shared-library
17426 Do not assume that the code being compiled won't link against any
17427 ID shared libraries. Slower code is generated for jump and call
17428 insns.
17429
17430 -mshared-library-id=n
17431 Specifies the identification number of the ID-based shared library
17432 being compiled. Specifying a value of 0 generates more compact
17433 code; specifying other values forces the allocation of that number
17434 to the current library but is no more space- or time-efficient than
17435 omitting this option.
17436
17437 -msep-data
17438 Generate code that allows the data segment to be located in a
17439 different area of memory from the text segment. This allows for
17440 execute in place in an environment without virtual memory
17441 management by eliminating relocations against the text section.
17442
17443 -mno-sep-data
17444 Generate code that assumes that the data segment follows the text
17445 segment. This is the default.
17446
17447 -mlong-calls
17448 -mno-long-calls
17449 Tells the compiler to perform function calls by first loading the
17450 address of the function into a register and then performing a
17451 subroutine call on this register. This switch is needed if the
17452 target function lies outside of the 24-bit addressing range of the
17453 offset-based version of subroutine call instruction.
17454
17455 This feature is not enabled by default. Specifying -mno-long-calls
17456 restores the default behavior. Note these switches have no effect
17457 on how the compiler generates code to handle function calls via
17458 function pointers.
17459
17460 -mfast-fp
17461 Link with the fast floating-point library. This library relaxes
17462 some of the IEEE floating-point standard's rules for checking
17463 inputs against Not-a-Number (NAN), in the interest of performance.
17464
17465 -minline-plt
17466 Enable inlining of PLT entries in function calls to functions that
17467 are not known to bind locally. It has no effect without -mfdpic.
17468
17469 -mmulticore
17470 Build a standalone application for multicore Blackfin processors.
17471 This option causes proper start files and link scripts supporting
17472 multicore to be used, and defines the macro "__BFIN_MULTICORE". It
17473 can only be used with -mcpu=bf561[-sirevision].
17474
17475 This option can be used with -mcorea or -mcoreb, which selects the
17476 one-application-per-core programming model. Without -mcorea or
17477 -mcoreb, the single-application/dual-core programming model is
17478 used. In this model, the main function of Core B should be named as
17479 "coreb_main".
17480
17481 If this option is not used, the single-core application programming
17482 model is used.
17483
17484 -mcorea
17485 Build a standalone application for Core A of BF561 when using the
17486 one-application-per-core programming model. Proper start files and
17487 link scripts are used to support Core A, and the macro
17488 "__BFIN_COREA" is defined. This option can only be used in
17489 conjunction with -mmulticore.
17490
17491 -mcoreb
17492 Build a standalone application for Core B of BF561 when using the
17493 one-application-per-core programming model. Proper start files and
17494 link scripts are used to support Core B, and the macro
17495 "__BFIN_COREB" is defined. When this option is used, "coreb_main"
17496 should be used instead of "main". This option can only be used in
17497 conjunction with -mmulticore.
17498
17499 -msdram
17500 Build a standalone application for SDRAM. Proper start files and
17501 link scripts are used to put the application into SDRAM, and the
17502 macro "__BFIN_SDRAM" is defined. The loader should initialize
17503 SDRAM before loading the application.
17504
17505 -micplb
17506 Assume that ICPLBs are enabled at run time. This has an effect on
17507 certain anomaly workarounds. For Linux targets, the default is to
17508 assume ICPLBs are enabled; for standalone applications the default
17509 is off.
17510
17511 C6X Options
17512
17513 -march=name
17514 This specifies the name of the target architecture. GCC uses this
17515 name to determine what kind of instructions it can emit when
17516 generating assembly code. Permissible names are: c62x, c64x,
17517 c64x+, c67x, c67x+, c674x.
17518
17519 -mbig-endian
17520 Generate code for a big-endian target.
17521
17522 -mlittle-endian
17523 Generate code for a little-endian target. This is the default.
17524
17525 -msim
17526 Choose startup files and linker script suitable for the simulator.
17527
17528 -msdata=default
17529 Put small global and static data in the ".neardata" section, which
17530 is pointed to by register "B14". Put small uninitialized global
17531 and static data in the ".bss" section, which is adjacent to the
17532 ".neardata" section. Put small read-only data into the ".rodata"
17533 section. The corresponding sections used for large pieces of data
17534 are ".fardata", ".far" and ".const".
17535
17536 -msdata=all
17537 Put all data, not just small objects, into the sections reserved
17538 for small data, and use addressing relative to the "B14" register
17539 to access them.
17540
17541 -msdata=none
17542 Make no use of the sections reserved for small data, and use
17543 absolute addresses to access all data. Put all initialized global
17544 and static data in the ".fardata" section, and all uninitialized
17545 data in the ".far" section. Put all constant data into the
17546 ".const" section.
17547
17548 CRIS Options
17549
17550 These options are defined specifically for the CRIS ports.
17551
17552 -march=architecture-type
17553 -mcpu=architecture-type
17554 Generate code for the specified architecture. The choices for
17555 architecture-type are v3, v8 and v10 for respectively ETRAX 4,
17556 ETRAX 100, and ETRAX 100 LX. Default is v0 except for cris-axis-
17557 linux-gnu, where the default is v10.
17558
17559 -mtune=architecture-type
17560 Tune to architecture-type everything applicable about the generated
17561 code, except for the ABI and the set of available instructions.
17562 The choices for architecture-type are the same as for
17563 -march=architecture-type.
17564
17565 -mmax-stack-frame=n
17566 Warn when the stack frame of a function exceeds n bytes.
17567
17568 -metrax4
17569 -metrax100
17570 The options -metrax4 and -metrax100 are synonyms for -march=v3 and
17571 -march=v8 respectively.
17572
17573 -mmul-bug-workaround
17574 -mno-mul-bug-workaround
17575 Work around a bug in the "muls" and "mulu" instructions for CPU
17576 models where it applies. This option is active by default.
17577
17578 -mpdebug
17579 Enable CRIS-specific verbose debug-related information in the
17580 assembly code. This option also has the effect of turning off the
17581 #NO_APP formatted-code indicator to the assembler at the beginning
17582 of the assembly file.
17583
17584 -mcc-init
17585 Do not use condition-code results from previous instruction; always
17586 emit compare and test instructions before use of condition codes.
17587
17588 -mno-side-effects
17589 Do not emit instructions with side effects in addressing modes
17590 other than post-increment.
17591
17592 -mstack-align
17593 -mno-stack-align
17594 -mdata-align
17595 -mno-data-align
17596 -mconst-align
17597 -mno-const-align
17598 These options (no- options) arrange (eliminate arrangements) for
17599 the stack frame, individual data and constants to be aligned for
17600 the maximum single data access size for the chosen CPU model. The
17601 default is to arrange for 32-bit alignment. ABI details such as
17602 structure layout are not affected by these options.
17603
17604 -m32-bit
17605 -m16-bit
17606 -m8-bit
17607 Similar to the stack- data- and const-align options above, these
17608 options arrange for stack frame, writable data and constants to all
17609 be 32-bit, 16-bit or 8-bit aligned. The default is 32-bit
17610 alignment.
17611
17612 -mno-prologue-epilogue
17613 -mprologue-epilogue
17614 With -mno-prologue-epilogue, the normal function prologue and
17615 epilogue which set up the stack frame are omitted and no return
17616 instructions or return sequences are generated in the code. Use
17617 this option only together with visual inspection of the compiled
17618 code: no warnings or errors are generated when call-saved registers
17619 must be saved, or storage for local variables needs to be
17620 allocated.
17621
17622 -mno-gotplt
17623 -mgotplt
17624 With -fpic and -fPIC, don't generate (do generate) instruction
17625 sequences that load addresses for functions from the PLT part of
17626 the GOT rather than (traditional on other architectures) calls to
17627 the PLT. The default is -mgotplt.
17628
17629 -melf
17630 Legacy no-op option only recognized with the cris-axis-elf and
17631 cris-axis-linux-gnu targets.
17632
17633 -mlinux
17634 Legacy no-op option only recognized with the cris-axis-linux-gnu
17635 target.
17636
17637 -sim
17638 This option, recognized for the cris-axis-elf, arranges to link
17639 with input-output functions from a simulator library. Code,
17640 initialized data and zero-initialized data are allocated
17641 consecutively.
17642
17643 -sim2
17644 Like -sim, but pass linker options to locate initialized data at
17645 0x40000000 and zero-initialized data at 0x80000000.
17646
17647 CR16 Options
17648
17649 These options are defined specifically for the CR16 ports.
17650
17651 -mmac
17652 Enable the use of multiply-accumulate instructions. Disabled by
17653 default.
17654
17655 -mcr16cplus
17656 -mcr16c
17657 Generate code for CR16C or CR16C+ architecture. CR16C+ architecture
17658 is default.
17659
17660 -msim
17661 Links the library libsim.a which is in compatible with simulator.
17662 Applicable to ELF compiler only.
17663
17664 -mint32
17665 Choose integer type as 32-bit wide.
17666
17667 -mbit-ops
17668 Generates "sbit"/"cbit" instructions for bit manipulations.
17669
17670 -mdata-model=model
17671 Choose a data model. The choices for model are near, far or medium.
17672 medium is default. However, far is not valid with -mcr16c, as the
17673 CR16C architecture does not support the far data model.
17674
17675 C-SKY Options
17676
17677 GCC supports these options when compiling for C-SKY V2 processors.
17678
17679 -march=arch
17680 Specify the C-SKY target architecture. Valid values for arch are:
17681 ck801, ck802, ck803, ck807, and ck810. The default is ck810.
17682
17683 -mcpu=cpu
17684 Specify the C-SKY target processor. Valid values for cpu are:
17685 ck801, ck801t, ck802, ck802t, ck802j, ck803, ck803h, ck803t,
17686 ck803ht, ck803f, ck803fh, ck803e, ck803eh, ck803et, ck803eht,
17687 ck803ef, ck803efh, ck803ft, ck803eft, ck803efht, ck803r1, ck803hr1,
17688 ck803tr1, ck803htr1, ck803fr1, ck803fhr1, ck803er1, ck803ehr1,
17689 ck803etr1, ck803ehtr1, ck803efr1, ck803efhr1, ck803ftr1,
17690 ck803eftr1, ck803efhtr1, ck803s, ck803st, ck803se, ck803sf,
17691 ck803sef, ck803seft, ck807e, ck807ef, ck807, ck807f, ck810e,
17692 ck810et, ck810ef, ck810eft, ck810, ck810v, ck810f, ck810t, ck810fv,
17693 ck810tv, ck810ft, and ck810ftv.
17694
17695 -mbig-endian
17696 -EB
17697 -mlittle-endian
17698 -EL Select big- or little-endian code. The default is little-endian.
17699
17700 -mhard-float
17701 -msoft-float
17702 Select hardware or software floating-point implementations. The
17703 default is soft float.
17704
17705 -mdouble-float
17706 -mno-double-float
17707 When -mhard-float is in effect, enable generation of double-
17708 precision float instructions. This is the default except when
17709 compiling for CK803.
17710
17711 -mfdivdu
17712 -mno-fdivdu
17713 When -mhard-float is in effect, enable generation of "frecipd",
17714 "fsqrtd", and "fdivd" instructions. This is the default except
17715 when compiling for CK803.
17716
17717 -mfpu=fpu
17718 Select the floating-point processor. This option can only be used
17719 with -mhard-float. Values for fpu are fpv2_sf (equivalent to
17720 -mno-double-float -mno-fdivdu), fpv2 (-mdouble-float -mno-divdu),
17721 and fpv2_divd (-mdouble-float -mdivdu).
17722
17723 -melrw
17724 -mno-elrw
17725 Enable the extended "lrw" instruction. This option defaults to on
17726 for CK801 and off otherwise.
17727
17728 -mistack
17729 -mno-istack
17730 Enable interrupt stack instructions; the default is off.
17731
17732 The -mistack option is required to handle the "interrupt" and "isr"
17733 function attributes.
17734
17735 -mmp
17736 Enable multiprocessor instructions; the default is off.
17737
17738 -mcp
17739 Enable coprocessor instructions; the default is off.
17740
17741 -mcache
17742 Enable coprocessor instructions; the default is off.
17743
17744 -msecurity
17745 Enable C-SKY security instructions; the default is off.
17746
17747 -mtrust
17748 Enable C-SKY trust instructions; the default is off.
17749
17750 -mdsp
17751 -medsp
17752 -mvdsp
17753 Enable C-SKY DSP, Enhanced DSP, or Vector DSP instructions,
17754 respectively. All of these options default to off.
17755
17756 -mdiv
17757 -mno-div
17758 Generate divide instructions. Default is off.
17759
17760 -msmart
17761 -mno-smart
17762 Generate code for Smart Mode, using only registers numbered 0-7 to
17763 allow use of 16-bit instructions. This option is ignored for CK801
17764 where this is the required behavior, and it defaults to on for
17765 CK802. For other targets, the default is off.
17766
17767 -mhigh-registers
17768 -mno-high-registers
17769 Generate code using the high registers numbered 16-31. This option
17770 is not supported on CK801, CK802, or CK803, and is enabled by
17771 default for other processors.
17772
17773 -manchor
17774 -mno-anchor
17775 Generate code using global anchor symbol addresses.
17776
17777 -mpushpop
17778 -mno-pushpop
17779 Generate code using "push" and "pop" instructions. This option
17780 defaults to on.
17781
17782 -mmultiple-stld
17783 -mstm
17784 -mno-multiple-stld
17785 -mno-stm
17786 Generate code using "stm" and "ldm" instructions. This option
17787 isn't supported on CK801 but is enabled by default on other
17788 processors.
17789
17790 -mconstpool
17791 -mno-constpool
17792 Create constant pools in the compiler instead of deferring it to
17793 the assembler. This option is the default and required for correct
17794 code generation on CK801 and CK802, and is optional on other
17795 processors.
17796
17797 -mstack-size
17798 -mno-stack-size
17799 Emit ".stack_size" directives for each function in the assembly
17800 output. This option defaults to off.
17801
17802 -mccrt
17803 -mno-ccrt
17804 Generate code for the C-SKY compiler runtime instead of libgcc.
17805 This option defaults to off.
17806
17807 -mbranch-cost=n
17808 Set the branch costs to roughly "n" instructions. The default is
17809 1.
17810
17811 -msched-prolog
17812 -mno-sched-prolog
17813 Permit scheduling of function prologue and epilogue sequences.
17814 Using this option can result in code that is not compliant with the
17815 C-SKY V2 ABI prologue requirements and that cannot be debugged or
17816 backtraced. It is disabled by default.
17817
17818 Darwin Options
17819
17820 These options are defined for all architectures running the Darwin
17821 operating system.
17822
17823 FSF GCC on Darwin does not create "fat" object files; it creates an
17824 object file for the single architecture that GCC was built to target.
17825 Apple's GCC on Darwin does create "fat" files if multiple -arch options
17826 are used; it does so by running the compiler or linker multiple times
17827 and joining the results together with lipo.
17828
17829 The subtype of the file created (like ppc7400 or ppc970 or i686) is
17830 determined by the flags that specify the ISA that GCC is targeting,
17831 like -mcpu or -march. The -force_cpusubtype_ALL option can be used to
17832 override this.
17833
17834 The Darwin tools vary in their behavior when presented with an ISA
17835 mismatch. The assembler, as, only permits instructions to be used that
17836 are valid for the subtype of the file it is generating, so you cannot
17837 put 64-bit instructions in a ppc750 object file. The linker for shared
17838 libraries, /usr/bin/libtool, fails and prints an error if asked to
17839 create a shared library with a less restrictive subtype than its input
17840 files (for instance, trying to put a ppc970 object file in a ppc7400
17841 library). The linker for executables, ld, quietly gives the executable
17842 the most restrictive subtype of any of its input files.
17843
17844 -Fdir
17845 Add the framework directory dir to the head of the list of
17846 directories to be searched for header files. These directories are
17847 interleaved with those specified by -I options and are scanned in a
17848 left-to-right order.
17849
17850 A framework directory is a directory with frameworks in it. A
17851 framework is a directory with a Headers and/or PrivateHeaders
17852 directory contained directly in it that ends in .framework. The
17853 name of a framework is the name of this directory excluding the
17854 .framework. Headers associated with the framework are found in one
17855 of those two directories, with Headers being searched first. A
17856 subframework is a framework directory that is in a framework's
17857 Frameworks directory. Includes of subframework headers can only
17858 appear in a header of a framework that contains the subframework,
17859 or in a sibling subframework header. Two subframeworks are
17860 siblings if they occur in the same framework. A subframework
17861 should not have the same name as a framework; a warning is issued
17862 if this is violated. Currently a subframework cannot have
17863 subframeworks; in the future, the mechanism may be extended to
17864 support this. The standard frameworks can be found in
17865 /System/Library/Frameworks and /Library/Frameworks. An example
17866 include looks like "#include <Framework/header.h>", where Framework
17867 denotes the name of the framework and header.h is found in the
17868 PrivateHeaders or Headers directory.
17869
17870 -iframeworkdir
17871 Like -F except the directory is a treated as a system directory.
17872 The main difference between this -iframework and -F is that with
17873 -iframework the compiler does not warn about constructs contained
17874 within header files found via dir. This option is valid only for
17875 the C family of languages.
17876
17877 -gused
17878 Emit debugging information for symbols that are used. For stabs
17879 debugging format, this enables -feliminate-unused-debug-symbols.
17880 This is by default ON.
17881
17882 -gfull
17883 Emit debugging information for all symbols and types.
17884
17885 -mmacosx-version-min=version
17886 The earliest version of MacOS X that this executable will run on is
17887 version. Typical values of version include 10.1, 10.2, and 10.3.9.
17888
17889 If the compiler was built to use the system's headers by default,
17890 then the default for this option is the system version on which the
17891 compiler is running, otherwise the default is to make choices that
17892 are compatible with as many systems and code bases as possible.
17893
17894 -mkernel
17895 Enable kernel development mode. The -mkernel option sets -static,
17896 -fno-common, -fno-use-cxa-atexit, -fno-exceptions,
17897 -fno-non-call-exceptions, -fapple-kext, -fno-weak and -fno-rtti
17898 where applicable. This mode also sets -mno-altivec, -msoft-float,
17899 -fno-builtin and -mlong-branch for PowerPC targets.
17900
17901 -mone-byte-bool
17902 Override the defaults for "bool" so that "sizeof(bool)==1". By
17903 default "sizeof(bool)" is 4 when compiling for Darwin/PowerPC and 1
17904 when compiling for Darwin/x86, so this option has no effect on x86.
17905
17906 Warning: The -mone-byte-bool switch causes GCC to generate code
17907 that is not binary compatible with code generated without that
17908 switch. Using this switch may require recompiling all other
17909 modules in a program, including system libraries. Use this switch
17910 to conform to a non-default data model.
17911
17912 -mfix-and-continue
17913 -ffix-and-continue
17914 -findirect-data
17915 Generate code suitable for fast turnaround development, such as to
17916 allow GDB to dynamically load .o files into already-running
17917 programs. -findirect-data and -ffix-and-continue are provided for
17918 backwards compatibility.
17919
17920 -all_load
17921 Loads all members of static archive libraries. See man ld(1) for
17922 more information.
17923
17924 -arch_errors_fatal
17925 Cause the errors having to do with files that have the wrong
17926 architecture to be fatal.
17927
17928 -bind_at_load
17929 Causes the output file to be marked such that the dynamic linker
17930 will bind all undefined references when the file is loaded or
17931 launched.
17932
17933 -bundle
17934 Produce a Mach-o bundle format file. See man ld(1) for more
17935 information.
17936
17937 -bundle_loader executable
17938 This option specifies the executable that will load the build
17939 output file being linked. See man ld(1) for more information.
17940
17941 -dynamiclib
17942 When passed this option, GCC produces a dynamic library instead of
17943 an executable when linking, using the Darwin libtool command.
17944
17945 -force_cpusubtype_ALL
17946 This causes GCC's output file to have the ALL subtype, instead of
17947 one controlled by the -mcpu or -march option.
17948
17949 -allowable_client client_name
17950 -client_name
17951 -compatibility_version
17952 -current_version
17953 -dead_strip
17954 -dependency-file
17955 -dylib_file
17956 -dylinker_install_name
17957 -dynamic
17958 -exported_symbols_list
17959 -filelist
17960 -flat_namespace
17961 -force_flat_namespace
17962 -headerpad_max_install_names
17963 -image_base
17964 -init
17965 -install_name
17966 -keep_private_externs
17967 -multi_module
17968 -multiply_defined
17969 -multiply_defined_unused
17970 -noall_load
17971 -no_dead_strip_inits_and_terms
17972 -nofixprebinding
17973 -nomultidefs
17974 -noprebind
17975 -noseglinkedit
17976 -pagezero_size
17977 -prebind
17978 -prebind_all_twolevel_modules
17979 -private_bundle
17980 -read_only_relocs
17981 -sectalign
17982 -sectobjectsymbols
17983 -whyload
17984 -seg1addr
17985 -sectcreate
17986 -sectobjectsymbols
17987 -sectorder
17988 -segaddr
17989 -segs_read_only_addr
17990 -segs_read_write_addr
17991 -seg_addr_table
17992 -seg_addr_table_filename
17993 -seglinkedit
17994 -segprot
17995 -segs_read_only_addr
17996 -segs_read_write_addr
17997 -single_module
17998 -static
17999 -sub_library
18000 -sub_umbrella
18001 -twolevel_namespace
18002 -umbrella
18003 -undefined
18004 -unexported_symbols_list
18005 -weak_reference_mismatches
18006 -whatsloaded
18007 These options are passed to the Darwin linker. The Darwin linker
18008 man page describes them in detail.
18009
18010 DEC Alpha Options
18011
18012 These -m options are defined for the DEC Alpha implementations:
18013
18014 -mno-soft-float
18015 -msoft-float
18016 Use (do not use) the hardware floating-point instructions for
18017 floating-point operations. When -msoft-float is specified,
18018 functions in libgcc.a are used to perform floating-point
18019 operations. Unless they are replaced by routines that emulate the
18020 floating-point operations, or compiled in such a way as to call
18021 such emulations routines, these routines issue floating-point
18022 operations. If you are compiling for an Alpha without floating-
18023 point operations, you must ensure that the library is built so as
18024 not to call them.
18025
18026 Note that Alpha implementations without floating-point operations
18027 are required to have floating-point registers.
18028
18029 -mfp-reg
18030 -mno-fp-regs
18031 Generate code that uses (does not use) the floating-point register
18032 set. -mno-fp-regs implies -msoft-float. If the floating-point
18033 register set is not used, floating-point operands are passed in
18034 integer registers as if they were integers and floating-point
18035 results are passed in $0 instead of $f0. This is a non-standard
18036 calling sequence, so any function with a floating-point argument or
18037 return value called by code compiled with -mno-fp-regs must also be
18038 compiled with that option.
18039
18040 A typical use of this option is building a kernel that does not
18041 use, and hence need not save and restore, any floating-point
18042 registers.
18043
18044 -mieee
18045 The Alpha architecture implements floating-point hardware optimized
18046 for maximum performance. It is mostly compliant with the IEEE
18047 floating-point standard. However, for full compliance, software
18048 assistance is required. This option generates code fully IEEE-
18049 compliant code except that the inexact-flag is not maintained (see
18050 below). If this option is turned on, the preprocessor macro
18051 "_IEEE_FP" is defined during compilation. The resulting code is
18052 less efficient but is able to correctly support denormalized
18053 numbers and exceptional IEEE values such as not-a-number and
18054 plus/minus infinity. Other Alpha compilers call this option
18055 -ieee_with_no_inexact.
18056
18057 -mieee-with-inexact
18058 This is like -mieee except the generated code also maintains the
18059 IEEE inexact-flag. Turning on this option causes the generated
18060 code to implement fully-compliant IEEE math. In addition to
18061 "_IEEE_FP", "_IEEE_FP_EXACT" is defined as a preprocessor macro.
18062 On some Alpha implementations the resulting code may execute
18063 significantly slower than the code generated by default. Since
18064 there is very little code that depends on the inexact-flag, you
18065 should normally not specify this option. Other Alpha compilers
18066 call this option -ieee_with_inexact.
18067
18068 -mfp-trap-mode=trap-mode
18069 This option controls what floating-point related traps are enabled.
18070 Other Alpha compilers call this option -fptm trap-mode. The trap
18071 mode can be set to one of four values:
18072
18073 n This is the default (normal) setting. The only traps that are
18074 enabled are the ones that cannot be disabled in software (e.g.,
18075 division by zero trap).
18076
18077 u In addition to the traps enabled by n, underflow traps are
18078 enabled as well.
18079
18080 su Like u, but the instructions are marked to be safe for software
18081 completion (see Alpha architecture manual for details).
18082
18083 sui Like su, but inexact traps are enabled as well.
18084
18085 -mfp-rounding-mode=rounding-mode
18086 Selects the IEEE rounding mode. Other Alpha compilers call this
18087 option -fprm rounding-mode. The rounding-mode can be one of:
18088
18089 n Normal IEEE rounding mode. Floating-point numbers are rounded
18090 towards the nearest machine number or towards the even machine
18091 number in case of a tie.
18092
18093 m Round towards minus infinity.
18094
18095 c Chopped rounding mode. Floating-point numbers are rounded
18096 towards zero.
18097
18098 d Dynamic rounding mode. A field in the floating-point control
18099 register (fpcr, see Alpha architecture reference manual)
18100 controls the rounding mode in effect. The C library
18101 initializes this register for rounding towards plus infinity.
18102 Thus, unless your program modifies the fpcr, d corresponds to
18103 round towards plus infinity.
18104
18105 -mtrap-precision=trap-precision
18106 In the Alpha architecture, floating-point traps are imprecise.
18107 This means without software assistance it is impossible to recover
18108 from a floating trap and program execution normally needs to be
18109 terminated. GCC can generate code that can assist operating system
18110 trap handlers in determining the exact location that caused a
18111 floating-point trap. Depending on the requirements of an
18112 application, different levels of precisions can be selected:
18113
18114 p Program precision. This option is the default and means a trap
18115 handler can only identify which program caused a floating-point
18116 exception.
18117
18118 f Function precision. The trap handler can determine the
18119 function that caused a floating-point exception.
18120
18121 i Instruction precision. The trap handler can determine the
18122 exact instruction that caused a floating-point exception.
18123
18124 Other Alpha compilers provide the equivalent options called
18125 -scope_safe and -resumption_safe.
18126
18127 -mieee-conformant
18128 This option marks the generated code as IEEE conformant. You must
18129 not use this option unless you also specify -mtrap-precision=i and
18130 either -mfp-trap-mode=su or -mfp-trap-mode=sui. Its only effect is
18131 to emit the line .eflag 48 in the function prologue of the
18132 generated assembly file.
18133
18134 -mbuild-constants
18135 Normally GCC examines a 32- or 64-bit integer constant to see if it
18136 can construct it from smaller constants in two or three
18137 instructions. If it cannot, it outputs the constant as a literal
18138 and generates code to load it from the data segment at run time.
18139
18140 Use this option to require GCC to construct all integer constants
18141 using code, even if it takes more instructions (the maximum is
18142 six).
18143
18144 You typically use this option to build a shared library dynamic
18145 loader. Itself a shared library, it must relocate itself in memory
18146 before it can find the variables and constants in its own data
18147 segment.
18148
18149 -mbwx
18150 -mno-bwx
18151 -mcix
18152 -mno-cix
18153 -mfix
18154 -mno-fix
18155 -mmax
18156 -mno-max
18157 Indicate whether GCC should generate code to use the optional BWX,
18158 CIX, FIX and MAX instruction sets. The default is to use the
18159 instruction sets supported by the CPU type specified via -mcpu=
18160 option or that of the CPU on which GCC was built if none is
18161 specified.
18162
18163 -mfloat-vax
18164 -mfloat-ieee
18165 Generate code that uses (does not use) VAX F and G floating-point
18166 arithmetic instead of IEEE single and double precision.
18167
18168 -mexplicit-relocs
18169 -mno-explicit-relocs
18170 Older Alpha assemblers provided no way to generate symbol
18171 relocations except via assembler macros. Use of these macros does
18172 not allow optimal instruction scheduling. GNU binutils as of
18173 version 2.12 supports a new syntax that allows the compiler to
18174 explicitly mark which relocations should apply to which
18175 instructions. This option is mostly useful for debugging, as GCC
18176 detects the capabilities of the assembler when it is built and sets
18177 the default accordingly.
18178
18179 -msmall-data
18180 -mlarge-data
18181 When -mexplicit-relocs is in effect, static data is accessed via
18182 gp-relative relocations. When -msmall-data is used, objects 8
18183 bytes long or smaller are placed in a small data area (the ".sdata"
18184 and ".sbss" sections) and are accessed via 16-bit relocations off
18185 of the $gp register. This limits the size of the small data area
18186 to 64KB, but allows the variables to be directly accessed via a
18187 single instruction.
18188
18189 The default is -mlarge-data. With this option the data area is
18190 limited to just below 2GB. Programs that require more than 2GB of
18191 data must use "malloc" or "mmap" to allocate the data in the heap
18192 instead of in the program's data segment.
18193
18194 When generating code for shared libraries, -fpic implies
18195 -msmall-data and -fPIC implies -mlarge-data.
18196
18197 -msmall-text
18198 -mlarge-text
18199 When -msmall-text is used, the compiler assumes that the code of
18200 the entire program (or shared library) fits in 4MB, and is thus
18201 reachable with a branch instruction. When -msmall-data is used,
18202 the compiler can assume that all local symbols share the same $gp
18203 value, and thus reduce the number of instructions required for a
18204 function call from 4 to 1.
18205
18206 The default is -mlarge-text.
18207
18208 -mcpu=cpu_type
18209 Set the instruction set and instruction scheduling parameters for
18210 machine type cpu_type. You can specify either the EV style name or
18211 the corresponding chip number. GCC supports scheduling parameters
18212 for the EV4, EV5 and EV6 family of processors and chooses the
18213 default values for the instruction set from the processor you
18214 specify. If you do not specify a processor type, GCC defaults to
18215 the processor on which the compiler was built.
18216
18217 Supported values for cpu_type are
18218
18219 ev4
18220 ev45
18221 21064
18222 Schedules as an EV4 and has no instruction set extensions.
18223
18224 ev5
18225 21164
18226 Schedules as an EV5 and has no instruction set extensions.
18227
18228 ev56
18229 21164a
18230 Schedules as an EV5 and supports the BWX extension.
18231
18232 pca56
18233 21164pc
18234 21164PC
18235 Schedules as an EV5 and supports the BWX and MAX extensions.
18236
18237 ev6
18238 21264
18239 Schedules as an EV6 and supports the BWX, FIX, and MAX
18240 extensions.
18241
18242 ev67
18243 21264a
18244 Schedules as an EV6 and supports the BWX, CIX, FIX, and MAX
18245 extensions.
18246
18247 Native toolchains also support the value native, which selects the
18248 best architecture option for the host processor. -mcpu=native has
18249 no effect if GCC does not recognize the processor.
18250
18251 -mtune=cpu_type
18252 Set only the instruction scheduling parameters for machine type
18253 cpu_type. The instruction set is not changed.
18254
18255 Native toolchains also support the value native, which selects the
18256 best architecture option for the host processor. -mtune=native has
18257 no effect if GCC does not recognize the processor.
18258
18259 -mmemory-latency=time
18260 Sets the latency the scheduler should assume for typical memory
18261 references as seen by the application. This number is highly
18262 dependent on the memory access patterns used by the application and
18263 the size of the external cache on the machine.
18264
18265 Valid options for time are
18266
18267 number
18268 A decimal number representing clock cycles.
18269
18270 L1
18271 L2
18272 L3
18273 main
18274 The compiler contains estimates of the number of clock cycles
18275 for "typical" EV4 & EV5 hardware for the Level 1, 2 & 3 caches
18276 (also called Dcache, Scache, and Bcache), as well as to main
18277 memory. Note that L3 is only valid for EV5.
18278
18279 eBPF Options
18280
18281 -mframe-limit=bytes
18282 This specifies the hard limit for frame sizes, in bytes.
18283 Currently, the value that can be specified should be less than or
18284 equal to 32767. Defaults to whatever limit is imposed by the
18285 version of the Linux kernel targeted.
18286
18287 -mkernel=version
18288 This specifies the minimum version of the kernel that will run the
18289 compiled program. GCC uses this version to determine which
18290 instructions to use, what kernel helpers to allow, etc. Currently,
18291 version can be one of 4.0, 4.1, 4.2, 4.3, 4.4, 4.5, 4.6, 4.7, 4.8,
18292 4.9, 4.10, 4.11, 4.12, 4.13, 4.14, 4.15, 4.16, 4.17, 4.18, 4.19,
18293 4.20, 5.0, 5.1, 5.2, latest and native.
18294
18295 -mbig-endian
18296 Generate code for a big-endian target.
18297
18298 -mlittle-endian
18299 Generate code for a little-endian target. This is the default.
18300
18301 -mxbpf
18302 Generate code for an expanded version of BPF, which relaxes some of
18303 the restrictions imposed by the BPF architecture:
18304
18305 -<Save and restore callee-saved registers at function entry and>
18306 exit, respectively.
18307
18308 FR30 Options
18309
18310 These options are defined specifically for the FR30 port.
18311
18312 -msmall-model
18313 Use the small address space model. This can produce smaller code,
18314 but it does assume that all symbolic values and addresses fit into
18315 a 20-bit range.
18316
18317 -mno-lsim
18318 Assume that runtime support has been provided and so there is no
18319 need to include the simulator library (libsim.a) on the linker
18320 command line.
18321
18322 FT32 Options
18323
18324 These options are defined specifically for the FT32 port.
18325
18326 -msim
18327 Specifies that the program will be run on the simulator. This
18328 causes an alternate runtime startup and library to be linked. You
18329 must not use this option when generating programs that will run on
18330 real hardware; you must provide your own runtime library for
18331 whatever I/O functions are needed.
18332
18333 -mlra
18334 Enable Local Register Allocation. This is still experimental for
18335 FT32, so by default the compiler uses standard reload.
18336
18337 -mnodiv
18338 Do not use div and mod instructions.
18339
18340 -mft32b
18341 Enable use of the extended instructions of the FT32B processor.
18342
18343 -mcompress
18344 Compress all code using the Ft32B code compression scheme.
18345
18346 -mnopm
18347 Do not generate code that reads program memory.
18348
18349 FRV Options
18350
18351 -mgpr-32
18352 Only use the first 32 general-purpose registers.
18353
18354 -mgpr-64
18355 Use all 64 general-purpose registers.
18356
18357 -mfpr-32
18358 Use only the first 32 floating-point registers.
18359
18360 -mfpr-64
18361 Use all 64 floating-point registers.
18362
18363 -mhard-float
18364 Use hardware instructions for floating-point operations.
18365
18366 -msoft-float
18367 Use library routines for floating-point operations.
18368
18369 -malloc-cc
18370 Dynamically allocate condition code registers.
18371
18372 -mfixed-cc
18373 Do not try to dynamically allocate condition code registers, only
18374 use "icc0" and "fcc0".
18375
18376 -mdword
18377 Change ABI to use double word insns.
18378
18379 -mno-dword
18380 Do not use double word instructions.
18381
18382 -mdouble
18383 Use floating-point double instructions.
18384
18385 -mno-double
18386 Do not use floating-point double instructions.
18387
18388 -mmedia
18389 Use media instructions.
18390
18391 -mno-media
18392 Do not use media instructions.
18393
18394 -mmuladd
18395 Use multiply and add/subtract instructions.
18396
18397 -mno-muladd
18398 Do not use multiply and add/subtract instructions.
18399
18400 -mfdpic
18401 Select the FDPIC ABI, which uses function descriptors to represent
18402 pointers to functions. Without any PIC/PIE-related options, it
18403 implies -fPIE. With -fpic or -fpie, it assumes GOT entries and
18404 small data are within a 12-bit range from the GOT base address;
18405 with -fPIC or -fPIE, GOT offsets are computed with 32 bits. With a
18406 bfin-elf target, this option implies -msim.
18407
18408 -minline-plt
18409 Enable inlining of PLT entries in function calls to functions that
18410 are not known to bind locally. It has no effect without -mfdpic.
18411 It's enabled by default if optimizing for speed and compiling for
18412 shared libraries (i.e., -fPIC or -fpic), or when an optimization
18413 option such as -O3 or above is present in the command line.
18414
18415 -mTLS
18416 Assume a large TLS segment when generating thread-local code.
18417
18418 -mtls
18419 Do not assume a large TLS segment when generating thread-local
18420 code.
18421
18422 -mgprel-ro
18423 Enable the use of "GPREL" relocations in the FDPIC ABI for data
18424 that is known to be in read-only sections. It's enabled by
18425 default, except for -fpic or -fpie: even though it may help make
18426 the global offset table smaller, it trades 1 instruction for 4.
18427 With -fPIC or -fPIE, it trades 3 instructions for 4, one of which
18428 may be shared by multiple symbols, and it avoids the need for a GOT
18429 entry for the referenced symbol, so it's more likely to be a win.
18430 If it is not, -mno-gprel-ro can be used to disable it.
18431
18432 -multilib-library-pic
18433 Link with the (library, not FD) pic libraries. It's implied by
18434 -mlibrary-pic, as well as by -fPIC and -fpic without -mfdpic. You
18435 should never have to use it explicitly.
18436
18437 -mlinked-fp
18438 Follow the EABI requirement of always creating a frame pointer
18439 whenever a stack frame is allocated. This option is enabled by
18440 default and can be disabled with -mno-linked-fp.
18441
18442 -mlong-calls
18443 Use indirect addressing to call functions outside the current
18444 compilation unit. This allows the functions to be placed anywhere
18445 within the 32-bit address space.
18446
18447 -malign-labels
18448 Try to align labels to an 8-byte boundary by inserting NOPs into
18449 the previous packet. This option only has an effect when VLIW
18450 packing is enabled. It doesn't create new packets; it merely adds
18451 NOPs to existing ones.
18452
18453 -mlibrary-pic
18454 Generate position-independent EABI code.
18455
18456 -macc-4
18457 Use only the first four media accumulator registers.
18458
18459 -macc-8
18460 Use all eight media accumulator registers.
18461
18462 -mpack
18463 Pack VLIW instructions.
18464
18465 -mno-pack
18466 Do not pack VLIW instructions.
18467
18468 -mno-eflags
18469 Do not mark ABI switches in e_flags.
18470
18471 -mcond-move
18472 Enable the use of conditional-move instructions (default).
18473
18474 This switch is mainly for debugging the compiler and will likely be
18475 removed in a future version.
18476
18477 -mno-cond-move
18478 Disable the use of conditional-move instructions.
18479
18480 This switch is mainly for debugging the compiler and will likely be
18481 removed in a future version.
18482
18483 -mscc
18484 Enable the use of conditional set instructions (default).
18485
18486 This switch is mainly for debugging the compiler and will likely be
18487 removed in a future version.
18488
18489 -mno-scc
18490 Disable the use of conditional set instructions.
18491
18492 This switch is mainly for debugging the compiler and will likely be
18493 removed in a future version.
18494
18495 -mcond-exec
18496 Enable the use of conditional execution (default).
18497
18498 This switch is mainly for debugging the compiler and will likely be
18499 removed in a future version.
18500
18501 -mno-cond-exec
18502 Disable the use of conditional execution.
18503
18504 This switch is mainly for debugging the compiler and will likely be
18505 removed in a future version.
18506
18507 -mvliw-branch
18508 Run a pass to pack branches into VLIW instructions (default).
18509
18510 This switch is mainly for debugging the compiler and will likely be
18511 removed in a future version.
18512
18513 -mno-vliw-branch
18514 Do not run a pass to pack branches into VLIW instructions.
18515
18516 This switch is mainly for debugging the compiler and will likely be
18517 removed in a future version.
18518
18519 -mmulti-cond-exec
18520 Enable optimization of "&&" and "||" in conditional execution
18521 (default).
18522
18523 This switch is mainly for debugging the compiler and will likely be
18524 removed in a future version.
18525
18526 -mno-multi-cond-exec
18527 Disable optimization of "&&" and "||" in conditional execution.
18528
18529 This switch is mainly for debugging the compiler and will likely be
18530 removed in a future version.
18531
18532 -mnested-cond-exec
18533 Enable nested conditional execution optimizations (default).
18534
18535 This switch is mainly for debugging the compiler and will likely be
18536 removed in a future version.
18537
18538 -mno-nested-cond-exec
18539 Disable nested conditional execution optimizations.
18540
18541 This switch is mainly for debugging the compiler and will likely be
18542 removed in a future version.
18543
18544 -moptimize-membar
18545 This switch removes redundant "membar" instructions from the
18546 compiler-generated code. It is enabled by default.
18547
18548 -mno-optimize-membar
18549 This switch disables the automatic removal of redundant "membar"
18550 instructions from the generated code.
18551
18552 -mtomcat-stats
18553 Cause gas to print out tomcat statistics.
18554
18555 -mcpu=cpu
18556 Select the processor type for which to generate code. Possible
18557 values are frv, fr550, tomcat, fr500, fr450, fr405, fr400, fr300
18558 and simple.
18559
18560 GNU/Linux Options
18561
18562 These -m options are defined for GNU/Linux targets:
18563
18564 -mglibc
18565 Use the GNU C library. This is the default except on
18566 *-*-linux-*uclibc*, *-*-linux-*musl* and *-*-linux-*android*
18567 targets.
18568
18569 -muclibc
18570 Use uClibc C library. This is the default on *-*-linux-*uclibc*
18571 targets.
18572
18573 -mmusl
18574 Use the musl C library. This is the default on *-*-linux-*musl*
18575 targets.
18576
18577 -mbionic
18578 Use Bionic C library. This is the default on *-*-linux-*android*
18579 targets.
18580
18581 -mandroid
18582 Compile code compatible with Android platform. This is the default
18583 on *-*-linux-*android* targets.
18584
18585 When compiling, this option enables -mbionic, -fPIC,
18586 -fno-exceptions and -fno-rtti by default. When linking, this
18587 option makes the GCC driver pass Android-specific options to the
18588 linker. Finally, this option causes the preprocessor macro
18589 "__ANDROID__" to be defined.
18590
18591 -tno-android-cc
18592 Disable compilation effects of -mandroid, i.e., do not enable
18593 -mbionic, -fPIC, -fno-exceptions and -fno-rtti by default.
18594
18595 -tno-android-ld
18596 Disable linking effects of -mandroid, i.e., pass standard Linux
18597 linking options to the linker.
18598
18599 H8/300 Options
18600
18601 These -m options are defined for the H8/300 implementations:
18602
18603 -mrelax
18604 Shorten some address references at link time, when possible; uses
18605 the linker option -relax.
18606
18607 -mh Generate code for the H8/300H.
18608
18609 -ms Generate code for the H8S.
18610
18611 -mn Generate code for the H8S and H8/300H in the normal mode. This
18612 switch must be used either with -mh or -ms.
18613
18614 -ms2600
18615 Generate code for the H8S/2600. This switch must be used with -ms.
18616
18617 -mexr
18618 Extended registers are stored on stack before execution of function
18619 with monitor attribute. Default option is -mexr. This option is
18620 valid only for H8S targets.
18621
18622 -mno-exr
18623 Extended registers are not stored on stack before execution of
18624 function with monitor attribute. Default option is -mno-exr. This
18625 option is valid only for H8S targets.
18626
18627 -mint32
18628 Make "int" data 32 bits by default.
18629
18630 -malign-300
18631 On the H8/300H and H8S, use the same alignment rules as for the
18632 H8/300. The default for the H8/300H and H8S is to align longs and
18633 floats on 4-byte boundaries. -malign-300 causes them to be aligned
18634 on 2-byte boundaries. This option has no effect on the H8/300.
18635
18636 HPPA Options
18637
18638 These -m options are defined for the HPPA family of computers:
18639
18640 -march=architecture-type
18641 Generate code for the specified architecture. The choices for
18642 architecture-type are 1.0 for PA 1.0, 1.1 for PA 1.1, and 2.0 for
18643 PA 2.0 processors. Refer to /usr/lib/sched.models on an HP-UX
18644 system to determine the proper architecture option for your
18645 machine. Code compiled for lower numbered architectures runs on
18646 higher numbered architectures, but not the other way around.
18647
18648 -mpa-risc-1-0
18649 -mpa-risc-1-1
18650 -mpa-risc-2-0
18651 Synonyms for -march=1.0, -march=1.1, and -march=2.0 respectively.
18652
18653 -mcaller-copies
18654 The caller copies function arguments passed by hidden reference.
18655 This option should be used with care as it is not compatible with
18656 the default 32-bit runtime. However, only aggregates larger than
18657 eight bytes are passed by hidden reference and the option provides
18658 better compatibility with OpenMP.
18659
18660 -mjump-in-delay
18661 This option is ignored and provided for compatibility purposes
18662 only.
18663
18664 -mdisable-fpregs
18665 Prevent floating-point registers from being used in any manner.
18666 This is necessary for compiling kernels that perform lazy context
18667 switching of floating-point registers. If you use this option and
18668 attempt to perform floating-point operations, the compiler aborts.
18669
18670 -mdisable-indexing
18671 Prevent the compiler from using indexing address modes. This
18672 avoids some rather obscure problems when compiling MIG generated
18673 code under MACH.
18674
18675 -mno-space-regs
18676 Generate code that assumes the target has no space registers. This
18677 allows GCC to generate faster indirect calls and use unscaled index
18678 address modes.
18679
18680 Such code is suitable for level 0 PA systems and kernels.
18681
18682 -mfast-indirect-calls
18683 Generate code that assumes calls never cross space boundaries.
18684 This allows GCC to emit code that performs faster indirect calls.
18685
18686 This option does not work in the presence of shared libraries or
18687 nested functions.
18688
18689 -mfixed-range=register-range
18690 Generate code treating the given register range as fixed registers.
18691 A fixed register is one that the register allocator cannot use.
18692 This is useful when compiling kernel code. A register range is
18693 specified as two registers separated by a dash. Multiple register
18694 ranges can be specified separated by a comma.
18695
18696 -mlong-load-store
18697 Generate 3-instruction load and store sequences as sometimes
18698 required by the HP-UX 10 linker. This is equivalent to the +k
18699 option to the HP compilers.
18700
18701 -mportable-runtime
18702 Use the portable calling conventions proposed by HP for ELF
18703 systems.
18704
18705 -mgas
18706 Enable the use of assembler directives only GAS understands.
18707
18708 -mschedule=cpu-type
18709 Schedule code according to the constraints for the machine type
18710 cpu-type. The choices for cpu-type are 700 7100, 7100LC, 7200,
18711 7300 and 8000. Refer to /usr/lib/sched.models on an HP-UX system
18712 to determine the proper scheduling option for your machine. The
18713 default scheduling is 8000.
18714
18715 -mlinker-opt
18716 Enable the optimization pass in the HP-UX linker. Note this makes
18717 symbolic debugging impossible. It also triggers a bug in the HP-UX
18718 8 and HP-UX 9 linkers in which they give bogus error messages when
18719 linking some programs.
18720
18721 -msoft-float
18722 Generate output containing library calls for floating point.
18723 Warning: the requisite libraries are not available for all HPPA
18724 targets. Normally the facilities of the machine's usual C compiler
18725 are used, but this cannot be done directly in cross-compilation.
18726 You must make your own arrangements to provide suitable library
18727 functions for cross-compilation.
18728
18729 -msoft-float changes the calling convention in the output file;
18730 therefore, it is only useful if you compile all of a program with
18731 this option. In particular, you need to compile libgcc.a, the
18732 library that comes with GCC, with -msoft-float in order for this to
18733 work.
18734
18735 -msio
18736 Generate the predefine, "_SIO", for server IO. The default is
18737 -mwsio. This generates the predefines, "__hp9000s700",
18738 "__hp9000s700__" and "_WSIO", for workstation IO. These options
18739 are available under HP-UX and HI-UX.
18740
18741 -mgnu-ld
18742 Use options specific to GNU ld. This passes -shared to ld when
18743 building a shared library. It is the default when GCC is
18744 configured, explicitly or implicitly, with the GNU linker. This
18745 option does not affect which ld is called; it only changes what
18746 parameters are passed to that ld. The ld that is called is
18747 determined by the --with-ld configure option, GCC's program search
18748 path, and finally by the user's PATH. The linker used by GCC can
18749 be printed using which `gcc -print-prog-name=ld`. This option is
18750 only available on the 64-bit HP-UX GCC, i.e. configured with
18751 hppa*64*-*-hpux*.
18752
18753 -mhp-ld
18754 Use options specific to HP ld. This passes -b to ld when building
18755 a shared library and passes +Accept TypeMismatch to ld on all
18756 links. It is the default when GCC is configured, explicitly or
18757 implicitly, with the HP linker. This option does not affect which
18758 ld is called; it only changes what parameters are passed to that
18759 ld. The ld that is called is determined by the --with-ld configure
18760 option, GCC's program search path, and finally by the user's PATH.
18761 The linker used by GCC can be printed using which `gcc
18762 -print-prog-name=ld`. This option is only available on the 64-bit
18763 HP-UX GCC, i.e. configured with hppa*64*-*-hpux*.
18764
18765 -mlong-calls
18766 Generate code that uses long call sequences. This ensures that a
18767 call is always able to reach linker generated stubs. The default
18768 is to generate long calls only when the distance from the call site
18769 to the beginning of the function or translation unit, as the case
18770 may be, exceeds a predefined limit set by the branch type being
18771 used. The limits for normal calls are 7,600,000 and 240,000 bytes,
18772 respectively for the PA 2.0 and PA 1.X architectures. Sibcalls are
18773 always limited at 240,000 bytes.
18774
18775 Distances are measured from the beginning of functions when using
18776 the -ffunction-sections option, or when using the -mgas and
18777 -mno-portable-runtime options together under HP-UX with the SOM
18778 linker.
18779
18780 It is normally not desirable to use this option as it degrades
18781 performance. However, it may be useful in large applications,
18782 particularly when partial linking is used to build the application.
18783
18784 The types of long calls used depends on the capabilities of the
18785 assembler and linker, and the type of code being generated. The
18786 impact on systems that support long absolute calls, and long pic
18787 symbol-difference or pc-relative calls should be relatively small.
18788 However, an indirect call is used on 32-bit ELF systems in pic code
18789 and it is quite long.
18790
18791 -munix=unix-std
18792 Generate compiler predefines and select a startfile for the
18793 specified UNIX standard. The choices for unix-std are 93, 95 and
18794 98. 93 is supported on all HP-UX versions. 95 is available on HP-
18795 UX 10.10 and later. 98 is available on HP-UX 11.11 and later. The
18796 default values are 93 for HP-UX 10.00, 95 for HP-UX 10.10 though to
18797 11.00, and 98 for HP-UX 11.11 and later.
18798
18799 -munix=93 provides the same predefines as GCC 3.3 and 3.4.
18800 -munix=95 provides additional predefines for "XOPEN_UNIX" and
18801 "_XOPEN_SOURCE_EXTENDED", and the startfile unix95.o. -munix=98
18802 provides additional predefines for "_XOPEN_UNIX",
18803 "_XOPEN_SOURCE_EXTENDED", "_INCLUDE__STDC_A1_SOURCE" and
18804 "_INCLUDE_XOPEN_SOURCE_500", and the startfile unix98.o.
18805
18806 It is important to note that this option changes the interfaces for
18807 various library routines. It also affects the operational behavior
18808 of the C library. Thus, extreme care is needed in using this
18809 option.
18810
18811 Library code that is intended to operate with more than one UNIX
18812 standard must test, set and restore the variable
18813 "__xpg4_extended_mask" as appropriate. Most GNU software doesn't
18814 provide this capability.
18815
18816 -nolibdld
18817 Suppress the generation of link options to search libdld.sl when
18818 the -static option is specified on HP-UX 10 and later.
18819
18820 -static
18821 The HP-UX implementation of setlocale in libc has a dependency on
18822 libdld.sl. There isn't an archive version of libdld.sl. Thus,
18823 when the -static option is specified, special link options are
18824 needed to resolve this dependency.
18825
18826 On HP-UX 10 and later, the GCC driver adds the necessary options to
18827 link with libdld.sl when the -static option is specified. This
18828 causes the resulting binary to be dynamic. On the 64-bit port, the
18829 linkers generate dynamic binaries by default in any case. The
18830 -nolibdld option can be used to prevent the GCC driver from adding
18831 these link options.
18832
18833 -threads
18834 Add support for multithreading with the dce thread library under
18835 HP-UX. This option sets flags for both the preprocessor and
18836 linker.
18837
18838 IA-64 Options
18839
18840 These are the -m options defined for the Intel IA-64 architecture.
18841
18842 -mbig-endian
18843 Generate code for a big-endian target. This is the default for HP-
18844 UX.
18845
18846 -mlittle-endian
18847 Generate code for a little-endian target. This is the default for
18848 AIX5 and GNU/Linux.
18849
18850 -mgnu-as
18851 -mno-gnu-as
18852 Generate (or don't) code for the GNU assembler. This is the
18853 default.
18854
18855 -mgnu-ld
18856 -mno-gnu-ld
18857 Generate (or don't) code for the GNU linker. This is the default.
18858
18859 -mno-pic
18860 Generate code that does not use a global pointer register. The
18861 result is not position independent code, and violates the IA-64
18862 ABI.
18863
18864 -mvolatile-asm-stop
18865 -mno-volatile-asm-stop
18866 Generate (or don't) a stop bit immediately before and after
18867 volatile asm statements.
18868
18869 -mregister-names
18870 -mno-register-names
18871 Generate (or don't) in, loc, and out register names for the stacked
18872 registers. This may make assembler output more readable.
18873
18874 -mno-sdata
18875 -msdata
18876 Disable (or enable) optimizations that use the small data section.
18877 This may be useful for working around optimizer bugs.
18878
18879 -mconstant-gp
18880 Generate code that uses a single constant global pointer value.
18881 This is useful when compiling kernel code.
18882
18883 -mauto-pic
18884 Generate code that is self-relocatable. This implies
18885 -mconstant-gp. This is useful when compiling firmware code.
18886
18887 -minline-float-divide-min-latency
18888 Generate code for inline divides of floating-point values using the
18889 minimum latency algorithm.
18890
18891 -minline-float-divide-max-throughput
18892 Generate code for inline divides of floating-point values using the
18893 maximum throughput algorithm.
18894
18895 -mno-inline-float-divide
18896 Do not generate inline code for divides of floating-point values.
18897
18898 -minline-int-divide-min-latency
18899 Generate code for inline divides of integer values using the
18900 minimum latency algorithm.
18901
18902 -minline-int-divide-max-throughput
18903 Generate code for inline divides of integer values using the
18904 maximum throughput algorithm.
18905
18906 -mno-inline-int-divide
18907 Do not generate inline code for divides of integer values.
18908
18909 -minline-sqrt-min-latency
18910 Generate code for inline square roots using the minimum latency
18911 algorithm.
18912
18913 -minline-sqrt-max-throughput
18914 Generate code for inline square roots using the maximum throughput
18915 algorithm.
18916
18917 -mno-inline-sqrt
18918 Do not generate inline code for "sqrt".
18919
18920 -mfused-madd
18921 -mno-fused-madd
18922 Do (don't) generate code that uses the fused multiply/add or
18923 multiply/subtract instructions. The default is to use these
18924 instructions.
18925
18926 -mno-dwarf2-asm
18927 -mdwarf2-asm
18928 Don't (or do) generate assembler code for the DWARF line number
18929 debugging info. This may be useful when not using the GNU
18930 assembler.
18931
18932 -mearly-stop-bits
18933 -mno-early-stop-bits
18934 Allow stop bits to be placed earlier than immediately preceding the
18935 instruction that triggered the stop bit. This can improve
18936 instruction scheduling, but does not always do so.
18937
18938 -mfixed-range=register-range
18939 Generate code treating the given register range as fixed registers.
18940 A fixed register is one that the register allocator cannot use.
18941 This is useful when compiling kernel code. A register range is
18942 specified as two registers separated by a dash. Multiple register
18943 ranges can be specified separated by a comma.
18944
18945 -mtls-size=tls-size
18946 Specify bit size of immediate TLS offsets. Valid values are 14,
18947 22, and 64.
18948
18949 -mtune=cpu-type
18950 Tune the instruction scheduling for a particular CPU, Valid values
18951 are itanium, itanium1, merced, itanium2, and mckinley.
18952
18953 -milp32
18954 -mlp64
18955 Generate code for a 32-bit or 64-bit environment. The 32-bit
18956 environment sets int, long and pointer to 32 bits. The 64-bit
18957 environment sets int to 32 bits and long and pointer to 64 bits.
18958 These are HP-UX specific flags.
18959
18960 -mno-sched-br-data-spec
18961 -msched-br-data-spec
18962 (Dis/En)able data speculative scheduling before reload. This
18963 results in generation of "ld.a" instructions and the corresponding
18964 check instructions ("ld.c" / "chk.a"). The default setting is
18965 disabled.
18966
18967 -msched-ar-data-spec
18968 -mno-sched-ar-data-spec
18969 (En/Dis)able data speculative scheduling after reload. This
18970 results in generation of "ld.a" instructions and the corresponding
18971 check instructions ("ld.c" / "chk.a"). The default setting is
18972 enabled.
18973
18974 -mno-sched-control-spec
18975 -msched-control-spec
18976 (Dis/En)able control speculative scheduling. This feature is
18977 available only during region scheduling (i.e. before reload). This
18978 results in generation of the "ld.s" instructions and the
18979 corresponding check instructions "chk.s". The default setting is
18980 disabled.
18981
18982 -msched-br-in-data-spec
18983 -mno-sched-br-in-data-spec
18984 (En/Dis)able speculative scheduling of the instructions that are
18985 dependent on the data speculative loads before reload. This is
18986 effective only with -msched-br-data-spec enabled. The default
18987 setting is enabled.
18988
18989 -msched-ar-in-data-spec
18990 -mno-sched-ar-in-data-spec
18991 (En/Dis)able speculative scheduling of the instructions that are
18992 dependent on the data speculative loads after reload. This is
18993 effective only with -msched-ar-data-spec enabled. The default
18994 setting is enabled.
18995
18996 -msched-in-control-spec
18997 -mno-sched-in-control-spec
18998 (En/Dis)able speculative scheduling of the instructions that are
18999 dependent on the control speculative loads. This is effective only
19000 with -msched-control-spec enabled. The default setting is enabled.
19001
19002 -mno-sched-prefer-non-data-spec-insns
19003 -msched-prefer-non-data-spec-insns
19004 If enabled, data-speculative instructions are chosen for schedule
19005 only if there are no other choices at the moment. This makes the
19006 use of the data speculation much more conservative. The default
19007 setting is disabled.
19008
19009 -mno-sched-prefer-non-control-spec-insns
19010 -msched-prefer-non-control-spec-insns
19011 If enabled, control-speculative instructions are chosen for
19012 schedule only if there are no other choices at the moment. This
19013 makes the use of the control speculation much more conservative.
19014 The default setting is disabled.
19015
19016 -mno-sched-count-spec-in-critical-path
19017 -msched-count-spec-in-critical-path
19018 If enabled, speculative dependencies are considered during
19019 computation of the instructions priorities. This makes the use of
19020 the speculation a bit more conservative. The default setting is
19021 disabled.
19022
19023 -msched-spec-ldc
19024 Use a simple data speculation check. This option is on by default.
19025
19026 -msched-control-spec-ldc
19027 Use a simple check for control speculation. This option is on by
19028 default.
19029
19030 -msched-stop-bits-after-every-cycle
19031 Place a stop bit after every cycle when scheduling. This option is
19032 on by default.
19033
19034 -msched-fp-mem-deps-zero-cost
19035 Assume that floating-point stores and loads are not likely to cause
19036 a conflict when placed into the same instruction group. This
19037 option is disabled by default.
19038
19039 -msel-sched-dont-check-control-spec
19040 Generate checks for control speculation in selective scheduling.
19041 This flag is disabled by default.
19042
19043 -msched-max-memory-insns=max-insns
19044 Limit on the number of memory insns per instruction group, giving
19045 lower priority to subsequent memory insns attempting to schedule in
19046 the same instruction group. Frequently useful to prevent cache bank
19047 conflicts. The default value is 1.
19048
19049 -msched-max-memory-insns-hard-limit
19050 Makes the limit specified by msched-max-memory-insns a hard limit,
19051 disallowing more than that number in an instruction group.
19052 Otherwise, the limit is "soft", meaning that non-memory operations
19053 are preferred when the limit is reached, but memory operations may
19054 still be scheduled.
19055
19056 LM32 Options
19057
19058 These -m options are defined for the LatticeMico32 architecture:
19059
19060 -mbarrel-shift-enabled
19061 Enable barrel-shift instructions.
19062
19063 -mdivide-enabled
19064 Enable divide and modulus instructions.
19065
19066 -mmultiply-enabled
19067 Enable multiply instructions.
19068
19069 -msign-extend-enabled
19070 Enable sign extend instructions.
19071
19072 -muser-enabled
19073 Enable user-defined instructions.
19074
19075 M32C Options
19076
19077 -mcpu=name
19078 Select the CPU for which code is generated. name may be one of r8c
19079 for the R8C/Tiny series, m16c for the M16C (up to /60) series,
19080 m32cm for the M16C/80 series, or m32c for the M32C/80 series.
19081
19082 -msim
19083 Specifies that the program will be run on the simulator. This
19084 causes an alternate runtime library to be linked in which supports,
19085 for example, file I/O. You must not use this option when
19086 generating programs that will run on real hardware; you must
19087 provide your own runtime library for whatever I/O functions are
19088 needed.
19089
19090 -memregs=number
19091 Specifies the number of memory-based pseudo-registers GCC uses
19092 during code generation. These pseudo-registers are used like real
19093 registers, so there is a tradeoff between GCC's ability to fit the
19094 code into available registers, and the performance penalty of using
19095 memory instead of registers. Note that all modules in a program
19096 must be compiled with the same value for this option. Because of
19097 that, you must not use this option with GCC's default runtime
19098 libraries.
19099
19100 M32R/D Options
19101
19102 These -m options are defined for Renesas M32R/D architectures:
19103
19104 -m32r2
19105 Generate code for the M32R/2.
19106
19107 -m32rx
19108 Generate code for the M32R/X.
19109
19110 -m32r
19111 Generate code for the M32R. This is the default.
19112
19113 -mmodel=small
19114 Assume all objects live in the lower 16MB of memory (so that their
19115 addresses can be loaded with the "ld24" instruction), and assume
19116 all subroutines are reachable with the "bl" instruction. This is
19117 the default.
19118
19119 The addressability of a particular object can be set with the
19120 "model" attribute.
19121
19122 -mmodel=medium
19123 Assume objects may be anywhere in the 32-bit address space (the
19124 compiler generates "seth/add3" instructions to load their
19125 addresses), and assume all subroutines are reachable with the "bl"
19126 instruction.
19127
19128 -mmodel=large
19129 Assume objects may be anywhere in the 32-bit address space (the
19130 compiler generates "seth/add3" instructions to load their
19131 addresses), and assume subroutines may not be reachable with the
19132 "bl" instruction (the compiler generates the much slower
19133 "seth/add3/jl" instruction sequence).
19134
19135 -msdata=none
19136 Disable use of the small data area. Variables are put into one of
19137 ".data", ".bss", or ".rodata" (unless the "section" attribute has
19138 been specified). This is the default.
19139
19140 The small data area consists of sections ".sdata" and ".sbss".
19141 Objects may be explicitly put in the small data area with the
19142 "section" attribute using one of these sections.
19143
19144 -msdata=sdata
19145 Put small global and static data in the small data area, but do not
19146 generate special code to reference them.
19147
19148 -msdata=use
19149 Put small global and static data in the small data area, and
19150 generate special instructions to reference them.
19151
19152 -G num
19153 Put global and static objects less than or equal to num bytes into
19154 the small data or BSS sections instead of the normal data or BSS
19155 sections. The default value of num is 8. The -msdata option must
19156 be set to one of sdata or use for this option to have any effect.
19157
19158 All modules should be compiled with the same -G num value.
19159 Compiling with different values of num may or may not work; if it
19160 doesn't the linker gives an error message---incorrect code is not
19161 generated.
19162
19163 -mdebug
19164 Makes the M32R-specific code in the compiler display some
19165 statistics that might help in debugging programs.
19166
19167 -malign-loops
19168 Align all loops to a 32-byte boundary.
19169
19170 -mno-align-loops
19171 Do not enforce a 32-byte alignment for loops. This is the default.
19172
19173 -missue-rate=number
19174 Issue number instructions per cycle. number can only be 1 or 2.
19175
19176 -mbranch-cost=number
19177 number can only be 1 or 2. If it is 1 then branches are preferred
19178 over conditional code, if it is 2, then the opposite applies.
19179
19180 -mflush-trap=number
19181 Specifies the trap number to use to flush the cache. The default
19182 is 12. Valid numbers are between 0 and 15 inclusive.
19183
19184 -mno-flush-trap
19185 Specifies that the cache cannot be flushed by using a trap.
19186
19187 -mflush-func=name
19188 Specifies the name of the operating system function to call to
19189 flush the cache. The default is _flush_cache, but a function call
19190 is only used if a trap is not available.
19191
19192 -mno-flush-func
19193 Indicates that there is no OS function for flushing the cache.
19194
19195 M680x0 Options
19196
19197 These are the -m options defined for M680x0 and ColdFire processors.
19198 The default settings depend on which architecture was selected when the
19199 compiler was configured; the defaults for the most common choices are
19200 given below.
19201
19202 -march=arch
19203 Generate code for a specific M680x0 or ColdFire instruction set
19204 architecture. Permissible values of arch for M680x0 architectures
19205 are: 68000, 68010, 68020, 68030, 68040, 68060 and cpu32. ColdFire
19206 architectures are selected according to Freescale's ISA
19207 classification and the permissible values are: isaa, isaaplus, isab
19208 and isac.
19209
19210 GCC defines a macro "__mcfarch__" whenever it is generating code
19211 for a ColdFire target. The arch in this macro is one of the -march
19212 arguments given above.
19213
19214 When used together, -march and -mtune select code that runs on a
19215 family of similar processors but that is optimized for a particular
19216 microarchitecture.
19217
19218 -mcpu=cpu
19219 Generate code for a specific M680x0 or ColdFire processor. The
19220 M680x0 cpus are: 68000, 68010, 68020, 68030, 68040, 68060, 68302,
19221 68332 and cpu32. The ColdFire cpus are given by the table below,
19222 which also classifies the CPUs into families:
19223
19224 Family : -mcpu arguments
19225 51 : 51 51ac 51ag 51cn 51em 51je 51jf 51jg 51jm 51mm 51qe 51qm
19226 5206 : 5202 5204 5206
19227 5206e : 5206e
19228 5208 : 5207 5208
19229 5211a : 5210a 5211a
19230 5213 : 5211 5212 5213
19231 5216 : 5214 5216
19232 52235 : 52230 52231 52232 52233 52234 52235
19233 5225 : 5224 5225
19234 52259 : 52252 52254 52255 52256 52258 52259
19235 5235 : 5232 5233 5234 5235 523x
19236 5249 : 5249
19237 5250 : 5250
19238 5271 : 5270 5271
19239 5272 : 5272
19240 5275 : 5274 5275
19241 5282 : 5280 5281 5282 528x
19242 53017 : 53011 53012 53013 53014 53015 53016 53017
19243 5307 : 5307
19244 5329 : 5327 5328 5329 532x
19245 5373 : 5372 5373 537x
19246 5407 : 5407
19247 5475 : 5470 5471 5472 5473 5474 5475 547x 5480 5481 5482 5483 5484
19248 5485
19249
19250 -mcpu=cpu overrides -march=arch if arch is compatible with cpu.
19251 Other combinations of -mcpu and -march are rejected.
19252
19253 GCC defines the macro "__mcf_cpu_cpu" when ColdFire target cpu is
19254 selected. It also defines "__mcf_family_family", where the value
19255 of family is given by the table above.
19256
19257 -mtune=tune
19258 Tune the code for a particular microarchitecture within the
19259 constraints set by -march and -mcpu. The M680x0 microarchitectures
19260 are: 68000, 68010, 68020, 68030, 68040, 68060 and cpu32. The
19261 ColdFire microarchitectures are: cfv1, cfv2, cfv3, cfv4 and cfv4e.
19262
19263 You can also use -mtune=68020-40 for code that needs to run
19264 relatively well on 68020, 68030 and 68040 targets. -mtune=68020-60
19265 is similar but includes 68060 targets as well. These two options
19266 select the same tuning decisions as -m68020-40 and -m68020-60
19267 respectively.
19268
19269 GCC defines the macros "__mcarch" and "__mcarch__" when tuning for
19270 680x0 architecture arch. It also defines "mcarch" unless either
19271 -ansi or a non-GNU -std option is used. If GCC is tuning for a
19272 range of architectures, as selected by -mtune=68020-40 or
19273 -mtune=68020-60, it defines the macros for every architecture in
19274 the range.
19275
19276 GCC also defines the macro "__muarch__" when tuning for ColdFire
19277 microarchitecture uarch, where uarch is one of the arguments given
19278 above.
19279
19280 -m68000
19281 -mc68000
19282 Generate output for a 68000. This is the default when the compiler
19283 is configured for 68000-based systems. It is equivalent to
19284 -march=68000.
19285
19286 Use this option for microcontrollers with a 68000 or EC000 core,
19287 including the 68008, 68302, 68306, 68307, 68322, 68328 and 68356.
19288
19289 -m68010
19290 Generate output for a 68010. This is the default when the compiler
19291 is configured for 68010-based systems. It is equivalent to
19292 -march=68010.
19293
19294 -m68020
19295 -mc68020
19296 Generate output for a 68020. This is the default when the compiler
19297 is configured for 68020-based systems. It is equivalent to
19298 -march=68020.
19299
19300 -m68030
19301 Generate output for a 68030. This is the default when the compiler
19302 is configured for 68030-based systems. It is equivalent to
19303 -march=68030.
19304
19305 -m68040
19306 Generate output for a 68040. This is the default when the compiler
19307 is configured for 68040-based systems. It is equivalent to
19308 -march=68040.
19309
19310 This option inhibits the use of 68881/68882 instructions that have
19311 to be emulated by software on the 68040. Use this option if your
19312 68040 does not have code to emulate those instructions.
19313
19314 -m68060
19315 Generate output for a 68060. This is the default when the compiler
19316 is configured for 68060-based systems. It is equivalent to
19317 -march=68060.
19318
19319 This option inhibits the use of 68020 and 68881/68882 instructions
19320 that have to be emulated by software on the 68060. Use this option
19321 if your 68060 does not have code to emulate those instructions.
19322
19323 -mcpu32
19324 Generate output for a CPU32. This is the default when the compiler
19325 is configured for CPU32-based systems. It is equivalent to
19326 -march=cpu32.
19327
19328 Use this option for microcontrollers with a CPU32 or CPU32+ core,
19329 including the 68330, 68331, 68332, 68333, 68334, 68336, 68340,
19330 68341, 68349 and 68360.
19331
19332 -m5200
19333 Generate output for a 520X ColdFire CPU. This is the default when
19334 the compiler is configured for 520X-based systems. It is
19335 equivalent to -mcpu=5206, and is now deprecated in favor of that
19336 option.
19337
19338 Use this option for microcontroller with a 5200 core, including the
19339 MCF5202, MCF5203, MCF5204 and MCF5206.
19340
19341 -m5206e
19342 Generate output for a 5206e ColdFire CPU. The option is now
19343 deprecated in favor of the equivalent -mcpu=5206e.
19344
19345 -m528x
19346 Generate output for a member of the ColdFire 528X family. The
19347 option is now deprecated in favor of the equivalent -mcpu=528x.
19348
19349 -m5307
19350 Generate output for a ColdFire 5307 CPU. The option is now
19351 deprecated in favor of the equivalent -mcpu=5307.
19352
19353 -m5407
19354 Generate output for a ColdFire 5407 CPU. The option is now
19355 deprecated in favor of the equivalent -mcpu=5407.
19356
19357 -mcfv4e
19358 Generate output for a ColdFire V4e family CPU (e.g. 547x/548x).
19359 This includes use of hardware floating-point instructions. The
19360 option is equivalent to -mcpu=547x, and is now deprecated in favor
19361 of that option.
19362
19363 -m68020-40
19364 Generate output for a 68040, without using any of the new
19365 instructions. This results in code that can run relatively
19366 efficiently on either a 68020/68881 or a 68030 or a 68040. The
19367 generated code does use the 68881 instructions that are emulated on
19368 the 68040.
19369
19370 The option is equivalent to -march=68020 -mtune=68020-40.
19371
19372 -m68020-60
19373 Generate output for a 68060, without using any of the new
19374 instructions. This results in code that can run relatively
19375 efficiently on either a 68020/68881 or a 68030 or a 68040. The
19376 generated code does use the 68881 instructions that are emulated on
19377 the 68060.
19378
19379 The option is equivalent to -march=68020 -mtune=68020-60.
19380
19381 -mhard-float
19382 -m68881
19383 Generate floating-point instructions. This is the default for
19384 68020 and above, and for ColdFire devices that have an FPU. It
19385 defines the macro "__HAVE_68881__" on M680x0 targets and
19386 "__mcffpu__" on ColdFire targets.
19387
19388 -msoft-float
19389 Do not generate floating-point instructions; use library calls
19390 instead. This is the default for 68000, 68010, and 68832 targets.
19391 It is also the default for ColdFire devices that have no FPU.
19392
19393 -mdiv
19394 -mno-div
19395 Generate (do not generate) ColdFire hardware divide and remainder
19396 instructions. If -march is used without -mcpu, the default is "on"
19397 for ColdFire architectures and "off" for M680x0 architectures.
19398 Otherwise, the default is taken from the target CPU (either the
19399 default CPU, or the one specified by -mcpu). For example, the
19400 default is "off" for -mcpu=5206 and "on" for -mcpu=5206e.
19401
19402 GCC defines the macro "__mcfhwdiv__" when this option is enabled.
19403
19404 -mshort
19405 Consider type "int" to be 16 bits wide, like "short int".
19406 Additionally, parameters passed on the stack are also aligned to a
19407 16-bit boundary even on targets whose API mandates promotion to
19408 32-bit.
19409
19410 -mno-short
19411 Do not consider type "int" to be 16 bits wide. This is the
19412 default.
19413
19414 -mnobitfield
19415 -mno-bitfield
19416 Do not use the bit-field instructions. The -m68000, -mcpu32 and
19417 -m5200 options imply -mnobitfield.
19418
19419 -mbitfield
19420 Do use the bit-field instructions. The -m68020 option implies
19421 -mbitfield. This is the default if you use a configuration
19422 designed for a 68020.
19423
19424 -mrtd
19425 Use a different function-calling convention, in which functions
19426 that take a fixed number of arguments return with the "rtd"
19427 instruction, which pops their arguments while returning. This
19428 saves one instruction in the caller since there is no need to pop
19429 the arguments there.
19430
19431 This calling convention is incompatible with the one normally used
19432 on Unix, so you cannot use it if you need to call libraries
19433 compiled with the Unix compiler.
19434
19435 Also, you must provide function prototypes for all functions that
19436 take variable numbers of arguments (including "printf"); otherwise
19437 incorrect code is generated for calls to those functions.
19438
19439 In addition, seriously incorrect code results if you call a
19440 function with too many arguments. (Normally, extra arguments are
19441 harmlessly ignored.)
19442
19443 The "rtd" instruction is supported by the 68010, 68020, 68030,
19444 68040, 68060 and CPU32 processors, but not by the 68000 or 5200.
19445
19446 The default is -mno-rtd.
19447
19448 -malign-int
19449 -mno-align-int
19450 Control whether GCC aligns "int", "long", "long long", "float",
19451 "double", and "long double" variables on a 32-bit boundary
19452 (-malign-int) or a 16-bit boundary (-mno-align-int). Aligning
19453 variables on 32-bit boundaries produces code that runs somewhat
19454 faster on processors with 32-bit busses at the expense of more
19455 memory.
19456
19457 Warning: if you use the -malign-int switch, GCC aligns structures
19458 containing the above types differently than most published
19459 application binary interface specifications for the m68k.
19460
19461 Use the pc-relative addressing mode of the 68000 directly, instead
19462 of using a global offset table. At present, this option implies
19463 -fpic, allowing at most a 16-bit offset for pc-relative addressing.
19464 -fPIC is not presently supported with -mpcrel, though this could be
19465 supported for 68020 and higher processors.
19466
19467 -mno-strict-align
19468 -mstrict-align
19469 Do not (do) assume that unaligned memory references are handled by
19470 the system.
19471
19472 -msep-data
19473 Generate code that allows the data segment to be located in a
19474 different area of memory from the text segment. This allows for
19475 execute-in-place in an environment without virtual memory
19476 management. This option implies -fPIC.
19477
19478 -mno-sep-data
19479 Generate code that assumes that the data segment follows the text
19480 segment. This is the default.
19481
19482 -mid-shared-library
19483 Generate code that supports shared libraries via the library ID
19484 method. This allows for execute-in-place and shared libraries in
19485 an environment without virtual memory management. This option
19486 implies -fPIC.
19487
19488 -mno-id-shared-library
19489 Generate code that doesn't assume ID-based shared libraries are
19490 being used. This is the default.
19491
19492 -mshared-library-id=n
19493 Specifies the identification number of the ID-based shared library
19494 being compiled. Specifying a value of 0 generates more compact
19495 code; specifying other values forces the allocation of that number
19496 to the current library, but is no more space- or time-efficient
19497 than omitting this option.
19498
19499 -mxgot
19500 -mno-xgot
19501 When generating position-independent code for ColdFire, generate
19502 code that works if the GOT has more than 8192 entries. This code
19503 is larger and slower than code generated without this option. On
19504 M680x0 processors, this option is not needed; -fPIC suffices.
19505
19506 GCC normally uses a single instruction to load values from the GOT.
19507 While this is relatively efficient, it only works if the GOT is
19508 smaller than about 64k. Anything larger causes the linker to
19509 report an error such as:
19510
19511 relocation truncated to fit: R_68K_GOT16O foobar
19512
19513 If this happens, you should recompile your code with -mxgot. It
19514 should then work with very large GOTs. However, code generated
19515 with -mxgot is less efficient, since it takes 4 instructions to
19516 fetch the value of a global symbol.
19517
19518 Note that some linkers, including newer versions of the GNU linker,
19519 can create multiple GOTs and sort GOT entries. If you have such a
19520 linker, you should only need to use -mxgot when compiling a single
19521 object file that accesses more than 8192 GOT entries. Very few do.
19522
19523 These options have no effect unless GCC is generating position-
19524 independent code.
19525
19526 -mlong-jump-table-offsets
19527 Use 32-bit offsets in "switch" tables. The default is to use
19528 16-bit offsets.
19529
19530 MCore Options
19531
19532 These are the -m options defined for the Motorola M*Core processors.
19533
19534 -mhardlit
19535 -mno-hardlit
19536 Inline constants into the code stream if it can be done in two
19537 instructions or less.
19538
19539 -mdiv
19540 -mno-div
19541 Use the divide instruction. (Enabled by default).
19542
19543 -mrelax-immediate
19544 -mno-relax-immediate
19545 Allow arbitrary-sized immediates in bit operations.
19546
19547 -mwide-bitfields
19548 -mno-wide-bitfields
19549 Always treat bit-fields as "int"-sized.
19550
19551 -m4byte-functions
19552 -mno-4byte-functions
19553 Force all functions to be aligned to a 4-byte boundary.
19554
19555 -mcallgraph-data
19556 -mno-callgraph-data
19557 Emit callgraph information.
19558
19559 -mslow-bytes
19560 -mno-slow-bytes
19561 Prefer word access when reading byte quantities.
19562
19563 -mlittle-endian
19564 -mbig-endian
19565 Generate code for a little-endian target.
19566
19567 -m210
19568 -m340
19569 Generate code for the 210 processor.
19570
19571 -mno-lsim
19572 Assume that runtime support has been provided and so omit the
19573 simulator library (libsim.a) from the linker command line.
19574
19575 -mstack-increment=size
19576 Set the maximum amount for a single stack increment operation.
19577 Large values can increase the speed of programs that contain
19578 functions that need a large amount of stack space, but they can
19579 also trigger a segmentation fault if the stack is extended too
19580 much. The default value is 0x1000.
19581
19582 MeP Options
19583
19584 -mabsdiff
19585 Enables the "abs" instruction, which is the absolute difference
19586 between two registers.
19587
19588 -mall-opts
19589 Enables all the optional instructions---average, multiply, divide,
19590 bit operations, leading zero, absolute difference, min/max, clip,
19591 and saturation.
19592
19593 -maverage
19594 Enables the "ave" instruction, which computes the average of two
19595 registers.
19596
19597 -mbased=n
19598 Variables of size n bytes or smaller are placed in the ".based"
19599 section by default. Based variables use the $tp register as a base
19600 register, and there is a 128-byte limit to the ".based" section.
19601
19602 -mbitops
19603 Enables the bit operation instructions---bit test ("btstm"), set
19604 ("bsetm"), clear ("bclrm"), invert ("bnotm"), and test-and-set
19605 ("tas").
19606
19607 -mc=name
19608 Selects which section constant data is placed in. name may be
19609 tiny, near, or far.
19610
19611 -mclip
19612 Enables the "clip" instruction. Note that -mclip is not useful
19613 unless you also provide -mminmax.
19614
19615 -mconfig=name
19616 Selects one of the built-in core configurations. Each MeP chip has
19617 one or more modules in it; each module has a core CPU and a variety
19618 of coprocessors, optional instructions, and peripherals. The
19619 "MeP-Integrator" tool, not part of GCC, provides these
19620 configurations through this option; using this option is the same
19621 as using all the corresponding command-line options. The default
19622 configuration is default.
19623
19624 -mcop
19625 Enables the coprocessor instructions. By default, this is a 32-bit
19626 coprocessor. Note that the coprocessor is normally enabled via the
19627 -mconfig= option.
19628
19629 -mcop32
19630 Enables the 32-bit coprocessor's instructions.
19631
19632 -mcop64
19633 Enables the 64-bit coprocessor's instructions.
19634
19635 -mivc2
19636 Enables IVC2 scheduling. IVC2 is a 64-bit VLIW coprocessor.
19637
19638 -mdc
19639 Causes constant variables to be placed in the ".near" section.
19640
19641 -mdiv
19642 Enables the "div" and "divu" instructions.
19643
19644 -meb
19645 Generate big-endian code.
19646
19647 -mel
19648 Generate little-endian code.
19649
19650 -mio-volatile
19651 Tells the compiler that any variable marked with the "io" attribute
19652 is to be considered volatile.
19653
19654 -ml Causes variables to be assigned to the ".far" section by default.
19655
19656 -mleadz
19657 Enables the "leadz" (leading zero) instruction.
19658
19659 -mm Causes variables to be assigned to the ".near" section by default.
19660
19661 -mminmax
19662 Enables the "min" and "max" instructions.
19663
19664 -mmult
19665 Enables the multiplication and multiply-accumulate instructions.
19666
19667 -mno-opts
19668 Disables all the optional instructions enabled by -mall-opts.
19669
19670 -mrepeat
19671 Enables the "repeat" and "erepeat" instructions, used for low-
19672 overhead looping.
19673
19674 -ms Causes all variables to default to the ".tiny" section. Note that
19675 there is a 65536-byte limit to this section. Accesses to these
19676 variables use the %gp base register.
19677
19678 -msatur
19679 Enables the saturation instructions. Note that the compiler does
19680 not currently generate these itself, but this option is included
19681 for compatibility with other tools, like "as".
19682
19683 -msdram
19684 Link the SDRAM-based runtime instead of the default ROM-based
19685 runtime.
19686
19687 -msim
19688 Link the simulator run-time libraries.
19689
19690 -msimnovec
19691 Link the simulator runtime libraries, excluding built-in support
19692 for reset and exception vectors and tables.
19693
19694 -mtf
19695 Causes all functions to default to the ".far" section. Without
19696 this option, functions default to the ".near" section.
19697
19698 -mtiny=n
19699 Variables that are n bytes or smaller are allocated to the ".tiny"
19700 section. These variables use the $gp base register. The default
19701 for this option is 4, but note that there's a 65536-byte limit to
19702 the ".tiny" section.
19703
19704 MicroBlaze Options
19705
19706 -msoft-float
19707 Use software emulation for floating point (default).
19708
19709 -mhard-float
19710 Use hardware floating-point instructions.
19711
19712 -mmemcpy
19713 Do not optimize block moves, use "memcpy".
19714
19715 -mno-clearbss
19716 This option is deprecated. Use -fno-zero-initialized-in-bss
19717 instead.
19718
19719 -mcpu=cpu-type
19720 Use features of, and schedule code for, the given CPU. Supported
19721 values are in the format vX.YY.Z, where X is a major version, YY is
19722 the minor version, and Z is compatibility code. Example values are
19723 v3.00.a, v4.00.b, v5.00.a, v5.00.b, v6.00.a.
19724
19725 -mxl-soft-mul
19726 Use software multiply emulation (default).
19727
19728 -mxl-soft-div
19729 Use software emulation for divides (default).
19730
19731 -mxl-barrel-shift
19732 Use the hardware barrel shifter.
19733
19734 -mxl-pattern-compare
19735 Use pattern compare instructions.
19736
19737 -msmall-divides
19738 Use table lookup optimization for small signed integer divisions.
19739
19740 -mxl-stack-check
19741 This option is deprecated. Use -fstack-check instead.
19742
19743 -mxl-gp-opt
19744 Use GP-relative ".sdata"/".sbss" sections.
19745
19746 -mxl-multiply-high
19747 Use multiply high instructions for high part of 32x32 multiply.
19748
19749 -mxl-float-convert
19750 Use hardware floating-point conversion instructions.
19751
19752 -mxl-float-sqrt
19753 Use hardware floating-point square root instruction.
19754
19755 -mbig-endian
19756 Generate code for a big-endian target.
19757
19758 -mlittle-endian
19759 Generate code for a little-endian target.
19760
19761 -mxl-reorder
19762 Use reorder instructions (swap and byte reversed load/store).
19763
19764 -mxl-mode-app-model
19765 Select application model app-model. Valid models are
19766
19767 executable
19768 normal executable (default), uses startup code crt0.o.
19769
19770 -mpic-data-is-text-relative
19771 Assume that the displacement between the text and data segments
19772 is fixed at static link time. This allows data to be
19773 referenced by offset from start of text address instead of GOT
19774 since PC-relative addressing is not supported.
19775
19776 xmdstub
19777 for use with Xilinx Microprocessor Debugger (XMD) based
19778 software intrusive debug agent called xmdstub. This uses
19779 startup file crt1.o and sets the start address of the program
19780 to 0x800.
19781
19782 bootstrap
19783 for applications that are loaded using a bootloader. This
19784 model uses startup file crt2.o which does not contain a
19785 processor reset vector handler. This is suitable for
19786 transferring control on a processor reset to the bootloader
19787 rather than the application.
19788
19789 novectors
19790 for applications that do not require any of the MicroBlaze
19791 vectors. This option may be useful for applications running
19792 within a monitoring application. This model uses crt3.o as a
19793 startup file.
19794
19795 Option -xl-mode-app-model is a deprecated alias for -mxl-mode-app-
19796 model.
19797
19798 MIPS Options
19799
19800 -EB Generate big-endian code.
19801
19802 -EL Generate little-endian code. This is the default for mips*el-*-*
19803 configurations.
19804
19805 -march=arch
19806 Generate code that runs on arch, which can be the name of a generic
19807 MIPS ISA, or the name of a particular processor. The ISA names
19808 are: mips1, mips2, mips3, mips4, mips32, mips32r2, mips32r3,
19809 mips32r5, mips32r6, mips64, mips64r2, mips64r3, mips64r5 and
19810 mips64r6. The processor names are: 4kc, 4km, 4kp, 4ksc, 4kec,
19811 4kem, 4kep, 4ksd, 5kc, 5kf, 20kc, 24kc, 24kf2_1, 24kf1_1, 24kec,
19812 24kef2_1, 24kef1_1, 34kc, 34kf2_1, 34kf1_1, 34kn, 74kc, 74kf2_1,
19813 74kf1_1, 74kf3_2, 1004kc, 1004kf2_1, 1004kf1_1, i6400, i6500,
19814 interaptiv, loongson2e, loongson2f, loongson3a, gs464, gs464e,
19815 gs264e, m4k, m14k, m14kc, m14ke, m14kec, m5100, m5101, octeon,
19816 octeon+, octeon2, octeon3, orion, p5600, p6600, r2000, r3000,
19817 r3900, r4000, r4400, r4600, r4650, r4700, r5900, r6000, r8000,
19818 rm7000, rm9000, r10000, r12000, r14000, r16000, sb1, sr71000,
19819 vr4100, vr4111, vr4120, vr4130, vr4300, vr5000, vr5400, vr5500, xlr
19820 and xlp. The special value from-abi selects the most compatible
19821 architecture for the selected ABI (that is, mips1 for 32-bit ABIs
19822 and mips3 for 64-bit ABIs).
19823
19824 The native Linux/GNU toolchain also supports the value native,
19825 which selects the best architecture option for the host processor.
19826 -march=native has no effect if GCC does not recognize the
19827 processor.
19828
19829 In processor names, a final 000 can be abbreviated as k (for
19830 example, -march=r2k). Prefixes are optional, and vr may be written
19831 r.
19832
19833 Names of the form nf2_1 refer to processors with FPUs clocked at
19834 half the rate of the core, names of the form nf1_1 refer to
19835 processors with FPUs clocked at the same rate as the core, and
19836 names of the form nf3_2 refer to processors with FPUs clocked a
19837 ratio of 3:2 with respect to the core. For compatibility reasons,
19838 nf is accepted as a synonym for nf2_1 while nx and bfx are accepted
19839 as synonyms for nf1_1.
19840
19841 GCC defines two macros based on the value of this option. The
19842 first is "_MIPS_ARCH", which gives the name of target architecture,
19843 as a string. The second has the form "_MIPS_ARCH_foo", where foo
19844 is the capitalized value of "_MIPS_ARCH". For example,
19845 -march=r2000 sets "_MIPS_ARCH" to "r2000" and defines the macro
19846 "_MIPS_ARCH_R2000".
19847
19848 Note that the "_MIPS_ARCH" macro uses the processor names given
19849 above. In other words, it has the full prefix and does not
19850 abbreviate 000 as k. In the case of from-abi, the macro names the
19851 resolved architecture (either "mips1" or "mips3"). It names the
19852 default architecture when no -march option is given.
19853
19854 -mtune=arch
19855 Optimize for arch. Among other things, this option controls the
19856 way instructions are scheduled, and the perceived cost of
19857 arithmetic operations. The list of arch values is the same as for
19858 -march.
19859
19860 When this option is not used, GCC optimizes for the processor
19861 specified by -march. By using -march and -mtune together, it is
19862 possible to generate code that runs on a family of processors, but
19863 optimize the code for one particular member of that family.
19864
19865 -mtune defines the macros "_MIPS_TUNE" and "_MIPS_TUNE_foo", which
19866 work in the same way as the -march ones described above.
19867
19868 -mips1
19869 Equivalent to -march=mips1.
19870
19871 -mips2
19872 Equivalent to -march=mips2.
19873
19874 -mips3
19875 Equivalent to -march=mips3.
19876
19877 -mips4
19878 Equivalent to -march=mips4.
19879
19880 -mips32
19881 Equivalent to -march=mips32.
19882
19883 -mips32r3
19884 Equivalent to -march=mips32r3.
19885
19886 -mips32r5
19887 Equivalent to -march=mips32r5.
19888
19889 -mips32r6
19890 Equivalent to -march=mips32r6.
19891
19892 -mips64
19893 Equivalent to -march=mips64.
19894
19895 -mips64r2
19896 Equivalent to -march=mips64r2.
19897
19898 -mips64r3
19899 Equivalent to -march=mips64r3.
19900
19901 -mips64r5
19902 Equivalent to -march=mips64r5.
19903
19904 -mips64r6
19905 Equivalent to -march=mips64r6.
19906
19907 -mips16
19908 -mno-mips16
19909 Generate (do not generate) MIPS16 code. If GCC is targeting a
19910 MIPS32 or MIPS64 architecture, it makes use of the MIPS16e ASE.
19911
19912 MIPS16 code generation can also be controlled on a per-function
19913 basis by means of "mips16" and "nomips16" attributes.
19914
19915 -mflip-mips16
19916 Generate MIPS16 code on alternating functions. This option is
19917 provided for regression testing of mixed MIPS16/non-MIPS16 code
19918 generation, and is not intended for ordinary use in compiling user
19919 code.
19920
19921 -minterlink-compressed
19922 -mno-interlink-compressed
19923 Require (do not require) that code using the standard
19924 (uncompressed) MIPS ISA be link-compatible with MIPS16 and
19925 microMIPS code, and vice versa.
19926
19927 For example, code using the standard ISA encoding cannot jump
19928 directly to MIPS16 or microMIPS code; it must either use a call or
19929 an indirect jump. -minterlink-compressed therefore disables direct
19930 jumps unless GCC knows that the target of the jump is not
19931 compressed.
19932
19933 -minterlink-mips16
19934 -mno-interlink-mips16
19935 Aliases of -minterlink-compressed and -mno-interlink-compressed.
19936 These options predate the microMIPS ASE and are retained for
19937 backwards compatibility.
19938
19939 -mabi=32
19940 -mabi=o64
19941 -mabi=n32
19942 -mabi=64
19943 -mabi=eabi
19944 Generate code for the given ABI.
19945
19946 Note that the EABI has a 32-bit and a 64-bit variant. GCC normally
19947 generates 64-bit code when you select a 64-bit architecture, but
19948 you can use -mgp32 to get 32-bit code instead.
19949
19950 For information about the O64 ABI, see
19951 <http://gcc.gnu.org/projects/mipso64-abi.html>.
19952
19953 GCC supports a variant of the o32 ABI in which floating-point
19954 registers are 64 rather than 32 bits wide. You can select this
19955 combination with -mabi=32 -mfp64. This ABI relies on the "mthc1"
19956 and "mfhc1" instructions and is therefore only supported for
19957 MIPS32R2, MIPS32R3 and MIPS32R5 processors.
19958
19959 The register assignments for arguments and return values remain the
19960 same, but each scalar value is passed in a single 64-bit register
19961 rather than a pair of 32-bit registers. For example, scalar
19962 floating-point values are returned in $f0 only, not a $f0/$f1 pair.
19963 The set of call-saved registers also remains the same in that the
19964 even-numbered double-precision registers are saved.
19965
19966 Two additional variants of the o32 ABI are supported to enable a
19967 transition from 32-bit to 64-bit registers. These are FPXX
19968 (-mfpxx) and FP64A (-mfp64 -mno-odd-spreg). The FPXX extension
19969 mandates that all code must execute correctly when run using 32-bit
19970 or 64-bit registers. The code can be interlinked with either FP32
19971 or FP64, but not both. The FP64A extension is similar to the FP64
19972 extension but forbids the use of odd-numbered single-precision
19973 registers. This can be used in conjunction with the "FRE" mode of
19974 FPUs in MIPS32R5 processors and allows both FP32 and FP64A code to
19975 interlink and run in the same process without changing FPU modes.
19976
19977 -mabicalls
19978 -mno-abicalls
19979 Generate (do not generate) code that is suitable for SVR4-style
19980 dynamic objects. -mabicalls is the default for SVR4-based systems.
19981
19982 -mshared
19983 -mno-shared
19984 Generate (do not generate) code that is fully position-independent,
19985 and that can therefore be linked into shared libraries. This
19986 option only affects -mabicalls.
19987
19988 All -mabicalls code has traditionally been position-independent,
19989 regardless of options like -fPIC and -fpic. However, as an
19990 extension, the GNU toolchain allows executables to use absolute
19991 accesses for locally-binding symbols. It can also use shorter GP
19992 initialization sequences and generate direct calls to locally-
19993 defined functions. This mode is selected by -mno-shared.
19994
19995 -mno-shared depends on binutils 2.16 or higher and generates
19996 objects that can only be linked by the GNU linker. However, the
19997 option does not affect the ABI of the final executable; it only
19998 affects the ABI of relocatable objects. Using -mno-shared
19999 generally makes executables both smaller and quicker.
20000
20001 -mshared is the default.
20002
20003 -mplt
20004 -mno-plt
20005 Assume (do not assume) that the static and dynamic linkers support
20006 PLTs and copy relocations. This option only affects -mno-shared
20007 -mabicalls. For the n64 ABI, this option has no effect without
20008 -msym32.
20009
20010 You can make -mplt the default by configuring GCC with
20011 --with-mips-plt. The default is -mno-plt otherwise.
20012
20013 -mxgot
20014 -mno-xgot
20015 Lift (do not lift) the usual restrictions on the size of the global
20016 offset table.
20017
20018 GCC normally uses a single instruction to load values from the GOT.
20019 While this is relatively efficient, it only works if the GOT is
20020 smaller than about 64k. Anything larger causes the linker to
20021 report an error such as:
20022
20023 relocation truncated to fit: R_MIPS_GOT16 foobar
20024
20025 If this happens, you should recompile your code with -mxgot. This
20026 works with very large GOTs, although the code is also less
20027 efficient, since it takes three instructions to fetch the value of
20028 a global symbol.
20029
20030 Note that some linkers can create multiple GOTs. If you have such
20031 a linker, you should only need to use -mxgot when a single object
20032 file accesses more than 64k's worth of GOT entries. Very few do.
20033
20034 These options have no effect unless GCC is generating position
20035 independent code.
20036
20037 -mgp32
20038 Assume that general-purpose registers are 32 bits wide.
20039
20040 -mgp64
20041 Assume that general-purpose registers are 64 bits wide.
20042
20043 -mfp32
20044 Assume that floating-point registers are 32 bits wide.
20045
20046 -mfp64
20047 Assume that floating-point registers are 64 bits wide.
20048
20049 -mfpxx
20050 Do not assume the width of floating-point registers.
20051
20052 -mhard-float
20053 Use floating-point coprocessor instructions.
20054
20055 -msoft-float
20056 Do not use floating-point coprocessor instructions. Implement
20057 floating-point calculations using library calls instead.
20058
20059 -mno-float
20060 Equivalent to -msoft-float, but additionally asserts that the
20061 program being compiled does not perform any floating-point
20062 operations. This option is presently supported only by some bare-
20063 metal MIPS configurations, where it may select a special set of
20064 libraries that lack all floating-point support (including, for
20065 example, the floating-point "printf" formats). If code compiled
20066 with -mno-float accidentally contains floating-point operations, it
20067 is likely to suffer a link-time or run-time failure.
20068
20069 -msingle-float
20070 Assume that the floating-point coprocessor only supports single-
20071 precision operations.
20072
20073 -mdouble-float
20074 Assume that the floating-point coprocessor supports double-
20075 precision operations. This is the default.
20076
20077 -modd-spreg
20078 -mno-odd-spreg
20079 Enable the use of odd-numbered single-precision floating-point
20080 registers for the o32 ABI. This is the default for processors that
20081 are known to support these registers. When using the o32 FPXX ABI,
20082 -mno-odd-spreg is set by default.
20083
20084 -mabs=2008
20085 -mabs=legacy
20086 These options control the treatment of the special not-a-number
20087 (NaN) IEEE 754 floating-point data with the "abs.fmt" and "neg.fmt"
20088 machine instructions.
20089
20090 By default or when -mabs=legacy is used the legacy treatment is
20091 selected. In this case these instructions are considered
20092 arithmetic and avoided where correct operation is required and the
20093 input operand might be a NaN. A longer sequence of instructions
20094 that manipulate the sign bit of floating-point datum manually is
20095 used instead unless the -ffinite-math-only option has also been
20096 specified.
20097
20098 The -mabs=2008 option selects the IEEE 754-2008 treatment. In this
20099 case these instructions are considered non-arithmetic and therefore
20100 operating correctly in all cases, including in particular where the
20101 input operand is a NaN. These instructions are therefore always
20102 used for the respective operations.
20103
20104 -mnan=2008
20105 -mnan=legacy
20106 These options control the encoding of the special not-a-number
20107 (NaN) IEEE 754 floating-point data.
20108
20109 The -mnan=legacy option selects the legacy encoding. In this case
20110 quiet NaNs (qNaNs) are denoted by the first bit of their trailing
20111 significand field being 0, whereas signaling NaNs (sNaNs) are
20112 denoted by the first bit of their trailing significand field being
20113 1.
20114
20115 The -mnan=2008 option selects the IEEE 754-2008 encoding. In this
20116 case qNaNs are denoted by the first bit of their trailing
20117 significand field being 1, whereas sNaNs are denoted by the first
20118 bit of their trailing significand field being 0.
20119
20120 The default is -mnan=legacy unless GCC has been configured with
20121 --with-nan=2008.
20122
20123 -mllsc
20124 -mno-llsc
20125 Use (do not use) ll, sc, and sync instructions to implement atomic
20126 memory built-in functions. When neither option is specified, GCC
20127 uses the instructions if the target architecture supports them.
20128
20129 -mllsc is useful if the runtime environment can emulate the
20130 instructions and -mno-llsc can be useful when compiling for
20131 nonstandard ISAs. You can make either option the default by
20132 configuring GCC with --with-llsc and --without-llsc respectively.
20133 --with-llsc is the default for some configurations; see the
20134 installation documentation for details.
20135
20136 -mdsp
20137 -mno-dsp
20138 Use (do not use) revision 1 of the MIPS DSP ASE.
20139 This option defines the preprocessor macro "__mips_dsp". It also
20140 defines "__mips_dsp_rev" to 1.
20141
20142 -mdspr2
20143 -mno-dspr2
20144 Use (do not use) revision 2 of the MIPS DSP ASE.
20145 This option defines the preprocessor macros "__mips_dsp" and
20146 "__mips_dspr2". It also defines "__mips_dsp_rev" to 2.
20147
20148 -msmartmips
20149 -mno-smartmips
20150 Use (do not use) the MIPS SmartMIPS ASE.
20151
20152 -mpaired-single
20153 -mno-paired-single
20154 Use (do not use) paired-single floating-point instructions.
20155 This option requires hardware floating-point support to be
20156 enabled.
20157
20158 -mdmx
20159 -mno-mdmx
20160 Use (do not use) MIPS Digital Media Extension instructions. This
20161 option can only be used when generating 64-bit code and requires
20162 hardware floating-point support to be enabled.
20163
20164 -mips3d
20165 -mno-mips3d
20166 Use (do not use) the MIPS-3D ASE. The option -mips3d implies
20167 -mpaired-single.
20168
20169 -mmicromips
20170 -mno-micromips
20171 Generate (do not generate) microMIPS code.
20172
20173 MicroMIPS code generation can also be controlled on a per-function
20174 basis by means of "micromips" and "nomicromips" attributes.
20175
20176 -mmt
20177 -mno-mt
20178 Use (do not use) MT Multithreading instructions.
20179
20180 -mmcu
20181 -mno-mcu
20182 Use (do not use) the MIPS MCU ASE instructions.
20183
20184 -meva
20185 -mno-eva
20186 Use (do not use) the MIPS Enhanced Virtual Addressing instructions.
20187
20188 -mvirt
20189 -mno-virt
20190 Use (do not use) the MIPS Virtualization (VZ) instructions.
20191
20192 -mxpa
20193 -mno-xpa
20194 Use (do not use) the MIPS eXtended Physical Address (XPA)
20195 instructions.
20196
20197 -mcrc
20198 -mno-crc
20199 Use (do not use) the MIPS Cyclic Redundancy Check (CRC)
20200 instructions.
20201
20202 -mginv
20203 -mno-ginv
20204 Use (do not use) the MIPS Global INValidate (GINV) instructions.
20205
20206 -mloongson-mmi
20207 -mno-loongson-mmi
20208 Use (do not use) the MIPS Loongson MultiMedia extensions
20209 Instructions (MMI).
20210
20211 -mloongson-ext
20212 -mno-loongson-ext
20213 Use (do not use) the MIPS Loongson EXTensions (EXT) instructions.
20214
20215 -mloongson-ext2
20216 -mno-loongson-ext2
20217 Use (do not use) the MIPS Loongson EXTensions r2 (EXT2)
20218 instructions.
20219
20220 -mlong64
20221 Force "long" types to be 64 bits wide. See -mlong32 for an
20222 explanation of the default and the way that the pointer size is
20223 determined.
20224
20225 -mlong32
20226 Force "long", "int", and pointer types to be 32 bits wide.
20227
20228 The default size of "int"s, "long"s and pointers depends on the
20229 ABI. All the supported ABIs use 32-bit "int"s. The n64 ABI uses
20230 64-bit "long"s, as does the 64-bit EABI; the others use 32-bit
20231 "long"s. Pointers are the same size as "long"s, or the same size
20232 as integer registers, whichever is smaller.
20233
20234 -msym32
20235 -mno-sym32
20236 Assume (do not assume) that all symbols have 32-bit values,
20237 regardless of the selected ABI. This option is useful in
20238 combination with -mabi=64 and -mno-abicalls because it allows GCC
20239 to generate shorter and faster references to symbolic addresses.
20240
20241 -G num
20242 Put definitions of externally-visible data in a small data section
20243 if that data is no bigger than num bytes. GCC can then generate
20244 more efficient accesses to the data; see -mgpopt for details.
20245
20246 The default -G option depends on the configuration.
20247
20248 -mlocal-sdata
20249 -mno-local-sdata
20250 Extend (do not extend) the -G behavior to local data too, such as
20251 to static variables in C. -mlocal-sdata is the default for all
20252 configurations.
20253
20254 If the linker complains that an application is using too much small
20255 data, you might want to try rebuilding the less performance-
20256 critical parts with -mno-local-sdata. You might also want to build
20257 large libraries with -mno-local-sdata, so that the libraries leave
20258 more room for the main program.
20259
20260 -mextern-sdata
20261 -mno-extern-sdata
20262 Assume (do not assume) that externally-defined data is in a small
20263 data section if the size of that data is within the -G limit.
20264 -mextern-sdata is the default for all configurations.
20265
20266 If you compile a module Mod with -mextern-sdata -G num -mgpopt, and
20267 Mod references a variable Var that is no bigger than num bytes, you
20268 must make sure that Var is placed in a small data section. If Var
20269 is defined by another module, you must either compile that module
20270 with a high-enough -G setting or attach a "section" attribute to
20271 Var's definition. If Var is common, you must link the application
20272 with a high-enough -G setting.
20273
20274 The easiest way of satisfying these restrictions is to compile and
20275 link every module with the same -G option. However, you may wish
20276 to build a library that supports several different small data
20277 limits. You can do this by compiling the library with the highest
20278 supported -G setting and additionally using -mno-extern-sdata to
20279 stop the library from making assumptions about externally-defined
20280 data.
20281
20282 -mgpopt
20283 -mno-gpopt
20284 Use (do not use) GP-relative accesses for symbols that are known to
20285 be in a small data section; see -G, -mlocal-sdata and
20286 -mextern-sdata. -mgpopt is the default for all configurations.
20287
20288 -mno-gpopt is useful for cases where the $gp register might not
20289 hold the value of "_gp". For example, if the code is part of a
20290 library that might be used in a boot monitor, programs that call
20291 boot monitor routines pass an unknown value in $gp. (In such
20292 situations, the boot monitor itself is usually compiled with -G0.)
20293
20294 -mno-gpopt implies -mno-local-sdata and -mno-extern-sdata.
20295
20296 -membedded-data
20297 -mno-embedded-data
20298 Allocate variables to the read-only data section first if possible,
20299 then next in the small data section if possible, otherwise in data.
20300 This gives slightly slower code than the default, but reduces the
20301 amount of RAM required when executing, and thus may be preferred
20302 for some embedded systems.
20303
20304 -muninit-const-in-rodata
20305 -mno-uninit-const-in-rodata
20306 Put uninitialized "const" variables in the read-only data section.
20307 This option is only meaningful in conjunction with -membedded-data.
20308
20309 -mcode-readable=setting
20310 Specify whether GCC may generate code that reads from executable
20311 sections. There are three possible settings:
20312
20313 -mcode-readable=yes
20314 Instructions may freely access executable sections. This is
20315 the default setting.
20316
20317 -mcode-readable=pcrel
20318 MIPS16 PC-relative load instructions can access executable
20319 sections, but other instructions must not do so. This option
20320 is useful on 4KSc and 4KSd processors when the code TLBs have
20321 the Read Inhibit bit set. It is also useful on processors that
20322 can be configured to have a dual instruction/data SRAM
20323 interface and that, like the M4K, automatically redirect PC-
20324 relative loads to the instruction RAM.
20325
20326 -mcode-readable=no
20327 Instructions must not access executable sections. This option
20328 can be useful on targets that are configured to have a dual
20329 instruction/data SRAM interface but that (unlike the M4K) do
20330 not automatically redirect PC-relative loads to the instruction
20331 RAM.
20332
20333 -msplit-addresses
20334 -mno-split-addresses
20335 Enable (disable) use of the "%hi()" and "%lo()" assembler
20336 relocation operators. This option has been superseded by
20337 -mexplicit-relocs but is retained for backwards compatibility.
20338
20339 -mexplicit-relocs
20340 -mno-explicit-relocs
20341 Use (do not use) assembler relocation operators when dealing with
20342 symbolic addresses. The alternative, selected by
20343 -mno-explicit-relocs, is to use assembler macros instead.
20344
20345 -mexplicit-relocs is the default if GCC was configured to use an
20346 assembler that supports relocation operators.
20347
20348 -mcheck-zero-division
20349 -mno-check-zero-division
20350 Trap (do not trap) on integer division by zero.
20351
20352 The default is -mcheck-zero-division.
20353
20354 -mdivide-traps
20355 -mdivide-breaks
20356 MIPS systems check for division by zero by generating either a
20357 conditional trap or a break instruction. Using traps results in
20358 smaller code, but is only supported on MIPS II and later. Also,
20359 some versions of the Linux kernel have a bug that prevents trap
20360 from generating the proper signal ("SIGFPE"). Use -mdivide-traps
20361 to allow conditional traps on architectures that support them and
20362 -mdivide-breaks to force the use of breaks.
20363
20364 The default is usually -mdivide-traps, but this can be overridden
20365 at configure time using --with-divide=breaks. Divide-by-zero
20366 checks can be completely disabled using -mno-check-zero-division.
20367
20368 -mload-store-pairs
20369 -mno-load-store-pairs
20370 Enable (disable) an optimization that pairs consecutive load or
20371 store instructions to enable load/store bonding. This option is
20372 enabled by default but only takes effect when the selected
20373 architecture is known to support bonding.
20374
20375 -mmemcpy
20376 -mno-memcpy
20377 Force (do not force) the use of "memcpy" for non-trivial block
20378 moves. The default is -mno-memcpy, which allows GCC to inline most
20379 constant-sized copies.
20380
20381 -mlong-calls
20382 -mno-long-calls
20383 Disable (do not disable) use of the "jal" instruction. Calling
20384 functions using "jal" is more efficient but requires the caller and
20385 callee to be in the same 256 megabyte segment.
20386
20387 This option has no effect on abicalls code. The default is
20388 -mno-long-calls.
20389
20390 -mmad
20391 -mno-mad
20392 Enable (disable) use of the "mad", "madu" and "mul" instructions,
20393 as provided by the R4650 ISA.
20394
20395 -mimadd
20396 -mno-imadd
20397 Enable (disable) use of the "madd" and "msub" integer instructions.
20398 The default is -mimadd on architectures that support "madd" and
20399 "msub" except for the 74k architecture where it was found to
20400 generate slower code.
20401
20402 -mfused-madd
20403 -mno-fused-madd
20404 Enable (disable) use of the floating-point multiply-accumulate
20405 instructions, when they are available. The default is
20406 -mfused-madd.
20407
20408 On the R8000 CPU when multiply-accumulate instructions are used,
20409 the intermediate product is calculated to infinite precision and is
20410 not subject to the FCSR Flush to Zero bit. This may be undesirable
20411 in some circumstances. On other processors the result is
20412 numerically identical to the equivalent computation using separate
20413 multiply, add, subtract and negate instructions.
20414
20415 -nocpp
20416 Tell the MIPS assembler to not run its preprocessor over user
20417 assembler files (with a .s suffix) when assembling them.
20418
20419 -mfix-24k
20420 -mno-fix-24k
20421 Work around the 24K E48 (lost data on stores during refill) errata.
20422 The workarounds are implemented by the assembler rather than by
20423 GCC.
20424
20425 -mfix-r4000
20426 -mno-fix-r4000
20427 Work around certain R4000 CPU errata:
20428
20429 - A double-word or a variable shift may give an incorrect result
20430 if executed immediately after starting an integer division.
20431
20432 - A double-word or a variable shift may give an incorrect result
20433 if executed while an integer multiplication is in progress.
20434
20435 - An integer division may give an incorrect result if started in
20436 a delay slot of a taken branch or a jump.
20437
20438 -mfix-r4400
20439 -mno-fix-r4400
20440 Work around certain R4400 CPU errata:
20441
20442 - A double-word or a variable shift may give an incorrect result
20443 if executed immediately after starting an integer division.
20444
20445 -mfix-r10000
20446 -mno-fix-r10000
20447 Work around certain R10000 errata:
20448
20449 - "ll"/"sc" sequences may not behave atomically on revisions
20450 prior to 3.0. They may deadlock on revisions 2.6 and earlier.
20451
20452 This option can only be used if the target architecture supports
20453 branch-likely instructions. -mfix-r10000 is the default when
20454 -march=r10000 is used; -mno-fix-r10000 is the default otherwise.
20455
20456 -mfix-r5900
20457 -mno-fix-r5900
20458 Do not attempt to schedule the preceding instruction into the delay
20459 slot of a branch instruction placed at the end of a short loop of
20460 six instructions or fewer and always schedule a "nop" instruction
20461 there instead. The short loop bug under certain conditions causes
20462 loops to execute only once or twice, due to a hardware bug in the
20463 R5900 chip. The workaround is implemented by the assembler rather
20464 than by GCC.
20465
20466 -mfix-rm7000
20467 -mno-fix-rm7000
20468 Work around the RM7000 "dmult"/"dmultu" errata. The workarounds
20469 are implemented by the assembler rather than by GCC.
20470
20471 -mfix-vr4120
20472 -mno-fix-vr4120
20473 Work around certain VR4120 errata:
20474
20475 - "dmultu" does not always produce the correct result.
20476
20477 - "div" and "ddiv" do not always produce the correct result if
20478 one of the operands is negative.
20479
20480 The workarounds for the division errata rely on special functions
20481 in libgcc.a. At present, these functions are only provided by the
20482 "mips64vr*-elf" configurations.
20483
20484 Other VR4120 errata require a NOP to be inserted between certain
20485 pairs of instructions. These errata are handled by the assembler,
20486 not by GCC itself.
20487
20488 -mfix-vr4130
20489 Work around the VR4130 "mflo"/"mfhi" errata. The workarounds are
20490 implemented by the assembler rather than by GCC, although GCC
20491 avoids using "mflo" and "mfhi" if the VR4130 "macc", "macchi",
20492 "dmacc" and "dmacchi" instructions are available instead.
20493
20494 -mfix-sb1
20495 -mno-fix-sb1
20496 Work around certain SB-1 CPU core errata. (This flag currently
20497 works around the SB-1 revision 2 "F1" and "F2" floating-point
20498 errata.)
20499
20500 -mr10k-cache-barrier=setting
20501 Specify whether GCC should insert cache barriers to avoid the side
20502 effects of speculation on R10K processors.
20503
20504 In common with many processors, the R10K tries to predict the
20505 outcome of a conditional branch and speculatively executes
20506 instructions from the "taken" branch. It later aborts these
20507 instructions if the predicted outcome is wrong. However, on the
20508 R10K, even aborted instructions can have side effects.
20509
20510 This problem only affects kernel stores and, depending on the
20511 system, kernel loads. As an example, a speculatively-executed
20512 store may load the target memory into cache and mark the cache line
20513 as dirty, even if the store itself is later aborted. If a DMA
20514 operation writes to the same area of memory before the "dirty" line
20515 is flushed, the cached data overwrites the DMA-ed data. See the
20516 R10K processor manual for a full description, including other
20517 potential problems.
20518
20519 One workaround is to insert cache barrier instructions before every
20520 memory access that might be speculatively executed and that might
20521 have side effects even if aborted. -mr10k-cache-barrier=setting
20522 controls GCC's implementation of this workaround. It assumes that
20523 aborted accesses to any byte in the following regions does not have
20524 side effects:
20525
20526 1. the memory occupied by the current function's stack frame;
20527
20528 2. the memory occupied by an incoming stack argument;
20529
20530 3. the memory occupied by an object with a link-time-constant
20531 address.
20532
20533 It is the kernel's responsibility to ensure that speculative
20534 accesses to these regions are indeed safe.
20535
20536 If the input program contains a function declaration such as:
20537
20538 void foo (void);
20539
20540 then the implementation of "foo" must allow "j foo" and "jal foo"
20541 to be executed speculatively. GCC honors this restriction for
20542 functions it compiles itself. It expects non-GCC functions (such
20543 as hand-written assembly code) to do the same.
20544
20545 The option has three forms:
20546
20547 -mr10k-cache-barrier=load-store
20548 Insert a cache barrier before a load or store that might be
20549 speculatively executed and that might have side effects even if
20550 aborted.
20551
20552 -mr10k-cache-barrier=store
20553 Insert a cache barrier before a store that might be
20554 speculatively executed and that might have side effects even if
20555 aborted.
20556
20557 -mr10k-cache-barrier=none
20558 Disable the insertion of cache barriers. This is the default
20559 setting.
20560
20561 -mflush-func=func
20562 -mno-flush-func
20563 Specifies the function to call to flush the I and D caches, or to
20564 not call any such function. If called, the function must take the
20565 same arguments as the common "_flush_func", that is, the address of
20566 the memory range for which the cache is being flushed, the size of
20567 the memory range, and the number 3 (to flush both caches). The
20568 default depends on the target GCC was configured for, but commonly
20569 is either "_flush_func" or "__cpu_flush".
20570
20571 mbranch-cost=num
20572 Set the cost of branches to roughly num "simple" instructions.
20573 This cost is only a heuristic and is not guaranteed to produce
20574 consistent results across releases. A zero cost redundantly
20575 selects the default, which is based on the -mtune setting.
20576
20577 -mbranch-likely
20578 -mno-branch-likely
20579 Enable or disable use of Branch Likely instructions, regardless of
20580 the default for the selected architecture. By default, Branch
20581 Likely instructions may be generated if they are supported by the
20582 selected architecture. An exception is for the MIPS32 and MIPS64
20583 architectures and processors that implement those architectures;
20584 for those, Branch Likely instructions are not be generated by
20585 default because the MIPS32 and MIPS64 architectures specifically
20586 deprecate their use.
20587
20588 -mcompact-branches=never
20589 -mcompact-branches=optimal
20590 -mcompact-branches=always
20591 These options control which form of branches will be generated.
20592 The default is -mcompact-branches=optimal.
20593
20594 The -mcompact-branches=never option ensures that compact branch
20595 instructions will never be generated.
20596
20597 The -mcompact-branches=always option ensures that a compact branch
20598 instruction will be generated if available. If a compact branch
20599 instruction is not available, a delay slot form of the branch will
20600 be used instead.
20601
20602 This option is supported from MIPS Release 6 onwards.
20603
20604 The -mcompact-branches=optimal option will cause a delay slot
20605 branch to be used if one is available in the current ISA and the
20606 delay slot is successfully filled. If the delay slot is not
20607 filled, a compact branch will be chosen if one is available.
20608
20609 -mfp-exceptions
20610 -mno-fp-exceptions
20611 Specifies whether FP exceptions are enabled. This affects how FP
20612 instructions are scheduled for some processors. The default is
20613 that FP exceptions are enabled.
20614
20615 For instance, on the SB-1, if FP exceptions are disabled, and we
20616 are emitting 64-bit code, then we can use both FP pipes.
20617 Otherwise, we can only use one FP pipe.
20618
20619 -mvr4130-align
20620 -mno-vr4130-align
20621 The VR4130 pipeline is two-way superscalar, but can only issue two
20622 instructions together if the first one is 8-byte aligned. When
20623 this option is enabled, GCC aligns pairs of instructions that it
20624 thinks should execute in parallel.
20625
20626 This option only has an effect when optimizing for the VR4130. It
20627 normally makes code faster, but at the expense of making it bigger.
20628 It is enabled by default at optimization level -O3.
20629
20630 -msynci
20631 -mno-synci
20632 Enable (disable) generation of "synci" instructions on
20633 architectures that support it. The "synci" instructions (if
20634 enabled) are generated when "__builtin___clear_cache" is compiled.
20635
20636 This option defaults to -mno-synci, but the default can be
20637 overridden by configuring GCC with --with-synci.
20638
20639 When compiling code for single processor systems, it is generally
20640 safe to use "synci". However, on many multi-core (SMP) systems, it
20641 does not invalidate the instruction caches on all cores and may
20642 lead to undefined behavior.
20643
20644 -mrelax-pic-calls
20645 -mno-relax-pic-calls
20646 Try to turn PIC calls that are normally dispatched via register $25
20647 into direct calls. This is only possible if the linker can resolve
20648 the destination at link time and if the destination is within range
20649 for a direct call.
20650
20651 -mrelax-pic-calls is the default if GCC was configured to use an
20652 assembler and a linker that support the ".reloc" assembly directive
20653 and -mexplicit-relocs is in effect. With -mno-explicit-relocs,
20654 this optimization can be performed by the assembler and the linker
20655 alone without help from the compiler.
20656
20657 -mmcount-ra-address
20658 -mno-mcount-ra-address
20659 Emit (do not emit) code that allows "_mcount" to modify the calling
20660 function's return address. When enabled, this option extends the
20661 usual "_mcount" interface with a new ra-address parameter, which
20662 has type "intptr_t *" and is passed in register $12. "_mcount" can
20663 then modify the return address by doing both of the following:
20664
20665 * Returning the new address in register $31.
20666
20667 * Storing the new address in "*ra-address", if ra-address is
20668 nonnull.
20669
20670 The default is -mno-mcount-ra-address.
20671
20672 -mframe-header-opt
20673 -mno-frame-header-opt
20674 Enable (disable) frame header optimization in the o32 ABI. When
20675 using the o32 ABI, calling functions will allocate 16 bytes on the
20676 stack for the called function to write out register arguments.
20677 When enabled, this optimization will suppress the allocation of the
20678 frame header if it can be determined that it is unused.
20679
20680 This optimization is off by default at all optimization levels.
20681
20682 -mlxc1-sxc1
20683 -mno-lxc1-sxc1
20684 When applicable, enable (disable) the generation of "lwxc1",
20685 "swxc1", "ldxc1", "sdxc1" instructions. Enabled by default.
20686
20687 -mmadd4
20688 -mno-madd4
20689 When applicable, enable (disable) the generation of 4-operand
20690 "madd.s", "madd.d" and related instructions. Enabled by default.
20691
20692 MMIX Options
20693
20694 These options are defined for the MMIX:
20695
20696 -mlibfuncs
20697 -mno-libfuncs
20698 Specify that intrinsic library functions are being compiled,
20699 passing all values in registers, no matter the size.
20700
20701 -mepsilon
20702 -mno-epsilon
20703 Generate floating-point comparison instructions that compare with
20704 respect to the "rE" epsilon register.
20705
20706 -mabi=mmixware
20707 -mabi=gnu
20708 Generate code that passes function parameters and return values
20709 that (in the called function) are seen as registers $0 and up, as
20710 opposed to the GNU ABI which uses global registers $231 and up.
20711
20712 -mzero-extend
20713 -mno-zero-extend
20714 When reading data from memory in sizes shorter than 64 bits, use
20715 (do not use) zero-extending load instructions by default, rather
20716 than sign-extending ones.
20717
20718 -mknuthdiv
20719 -mno-knuthdiv
20720 Make the result of a division yielding a remainder have the same
20721 sign as the divisor. With the default, -mno-knuthdiv, the sign of
20722 the remainder follows the sign of the dividend. Both methods are
20723 arithmetically valid, the latter being almost exclusively used.
20724
20725 -mtoplevel-symbols
20726 -mno-toplevel-symbols
20727 Prepend (do not prepend) a : to all global symbols, so the assembly
20728 code can be used with the "PREFIX" assembly directive.
20729
20730 -melf
20731 Generate an executable in the ELF format, rather than the default
20732 mmo format used by the mmix simulator.
20733
20734 -mbranch-predict
20735 -mno-branch-predict
20736 Use (do not use) the probable-branch instructions, when static
20737 branch prediction indicates a probable branch.
20738
20739 -mbase-addresses
20740 -mno-base-addresses
20741 Generate (do not generate) code that uses base addresses. Using a
20742 base address automatically generates a request (handled by the
20743 assembler and the linker) for a constant to be set up in a global
20744 register. The register is used for one or more base address
20745 requests within the range 0 to 255 from the value held in the
20746 register. The generally leads to short and fast code, but the
20747 number of different data items that can be addressed is limited.
20748 This means that a program that uses lots of static data may require
20749 -mno-base-addresses.
20750
20751 -msingle-exit
20752 -mno-single-exit
20753 Force (do not force) generated code to have a single exit point in
20754 each function.
20755
20756 MN10300 Options
20757
20758 These -m options are defined for Matsushita MN10300 architectures:
20759
20760 -mmult-bug
20761 Generate code to avoid bugs in the multiply instructions for the
20762 MN10300 processors. This is the default.
20763
20764 -mno-mult-bug
20765 Do not generate code to avoid bugs in the multiply instructions for
20766 the MN10300 processors.
20767
20768 -mam33
20769 Generate code using features specific to the AM33 processor.
20770
20771 -mno-am33
20772 Do not generate code using features specific to the AM33 processor.
20773 This is the default.
20774
20775 -mam33-2
20776 Generate code using features specific to the AM33/2.0 processor.
20777
20778 -mam34
20779 Generate code using features specific to the AM34 processor.
20780
20781 -mtune=cpu-type
20782 Use the timing characteristics of the indicated CPU type when
20783 scheduling instructions. This does not change the targeted
20784 processor type. The CPU type must be one of mn10300, am33, am33-2
20785 or am34.
20786
20787 -mreturn-pointer-on-d0
20788 When generating a function that returns a pointer, return the
20789 pointer in both "a0" and "d0". Otherwise, the pointer is returned
20790 only in "a0", and attempts to call such functions without a
20791 prototype result in errors. Note that this option is on by
20792 default; use -mno-return-pointer-on-d0 to disable it.
20793
20794 -mno-crt0
20795 Do not link in the C run-time initialization object file.
20796
20797 -mrelax
20798 Indicate to the linker that it should perform a relaxation
20799 optimization pass to shorten branches, calls and absolute memory
20800 addresses. This option only has an effect when used on the command
20801 line for the final link step.
20802
20803 This option makes symbolic debugging impossible.
20804
20805 -mliw
20806 Allow the compiler to generate Long Instruction Word instructions
20807 if the target is the AM33 or later. This is the default. This
20808 option defines the preprocessor macro "__LIW__".
20809
20810 -mno-liw
20811 Do not allow the compiler to generate Long Instruction Word
20812 instructions. This option defines the preprocessor macro
20813 "__NO_LIW__".
20814
20815 -msetlb
20816 Allow the compiler to generate the SETLB and Lcc instructions if
20817 the target is the AM33 or later. This is the default. This option
20818 defines the preprocessor macro "__SETLB__".
20819
20820 -mno-setlb
20821 Do not allow the compiler to generate SETLB or Lcc instructions.
20822 This option defines the preprocessor macro "__NO_SETLB__".
20823
20824 Moxie Options
20825
20826 -meb
20827 Generate big-endian code. This is the default for moxie-*-*
20828 configurations.
20829
20830 -mel
20831 Generate little-endian code.
20832
20833 -mmul.x
20834 Generate mul.x and umul.x instructions. This is the default for
20835 moxiebox-*-* configurations.
20836
20837 -mno-crt0
20838 Do not link in the C run-time initialization object file.
20839
20840 MSP430 Options
20841
20842 These options are defined for the MSP430:
20843
20844 -masm-hex
20845 Force assembly output to always use hex constants. Normally such
20846 constants are signed decimals, but this option is available for
20847 testsuite and/or aesthetic purposes.
20848
20849 -mmcu=
20850 Select the MCU to target. This is used to create a C preprocessor
20851 symbol based upon the MCU name, converted to upper case and pre-
20852 and post-fixed with __. This in turn is used by the msp430.h
20853 header file to select an MCU-specific supplementary header file.
20854
20855 The option also sets the ISA to use. If the MCU name is one that
20856 is known to only support the 430 ISA then that is selected,
20857 otherwise the 430X ISA is selected. A generic MCU name of msp430
20858 can also be used to select the 430 ISA. Similarly the generic
20859 msp430x MCU name selects the 430X ISA.
20860
20861 In addition an MCU-specific linker script is added to the linker
20862 command line. The script's name is the name of the MCU with .ld
20863 appended. Thus specifying -mmcu=xxx on the gcc command line
20864 defines the C preprocessor symbol "__XXX__" and cause the linker to
20865 search for a script called xxx.ld.
20866
20867 The ISA and hardware multiply supported for the different MCUs is
20868 hard-coded into GCC. However, an external devices.csv file can be
20869 used to extend device support beyond those that have been hard-
20870 coded.
20871
20872 GCC searches for the devices.csv file using the following methods
20873 in the given precedence order, where the first method takes
20874 precendence over the second which takes precedence over the third.
20875
20876 Include path specified with "-I" and "-L"
20877 devices.csv will be searched for in each of the directories
20878 specified by include paths and linker library search paths.
20879
20880 Path specified by the environment variable MSP430_GCC_INCLUDE_DIR
20881 Define the value of the global environment variable
20882 MSP430_GCC_INCLUDE_DIR to the full path to the directory
20883 containing devices.csv, and GCC will search this directory for
20884 devices.csv. If devices.csv is found, this directory will also
20885 be registered as an include path, and linker library path.
20886 Header files and linker scripts in this directory can therefore
20887 be used without manually specifying "-I" and "-L" on the
20888 command line.
20889
20890 The msp430-elf{,bare}/include/devices directory
20891 Finally, GCC will examine msp430-elf{,bare}/include/devices
20892 from the toolchain root directory. This directory does not
20893 exist in a default installation, but if the user has created it
20894 and copied devices.csv there, then the MCU data will be read.
20895 As above, this directory will also be registered as an include
20896 path, and linker library path.
20897
20898 If none of the above search methods find devices.csv, then the
20899 hard-coded MCU data is used.
20900
20901 -mwarn-mcu
20902 -mno-warn-mcu
20903 This option enables or disables warnings about conflicts between
20904 the MCU name specified by the -mmcu option and the ISA set by the
20905 -mcpu option and/or the hardware multiply support set by the
20906 -mhwmult option. It also toggles warnings about unrecognized MCU
20907 names. This option is on by default.
20908
20909 -mcpu=
20910 Specifies the ISA to use. Accepted values are msp430, msp430x and
20911 msp430xv2. This option is deprecated. The -mmcu= option should be
20912 used to select the ISA.
20913
20914 -msim
20915 Link to the simulator runtime libraries and linker script.
20916 Overrides any scripts that would be selected by the -mmcu= option.
20917
20918 -mlarge
20919 Use large-model addressing (20-bit pointers, 32-bit "size_t").
20920
20921 -msmall
20922 Use small-model addressing (16-bit pointers, 16-bit "size_t").
20923
20924 -mrelax
20925 This option is passed to the assembler and linker, and allows the
20926 linker to perform certain optimizations that cannot be done until
20927 the final link.
20928
20929 mhwmult=
20930 Describes the type of hardware multiply supported by the target.
20931 Accepted values are none for no hardware multiply, 16bit for the
20932 original 16-bit-only multiply supported by early MCUs. 32bit for
20933 the 16/32-bit multiply supported by later MCUs and f5series for the
20934 16/32-bit multiply supported by F5-series MCUs. A value of auto
20935 can also be given. This tells GCC to deduce the hardware multiply
20936 support based upon the MCU name provided by the -mmcu option. If
20937 no -mmcu option is specified or if the MCU name is not recognized
20938 then no hardware multiply support is assumed. "auto" is the
20939 default setting.
20940
20941 Hardware multiplies are normally performed by calling a library
20942 routine. This saves space in the generated code. When compiling
20943 at -O3 or higher however the hardware multiplier is invoked inline.
20944 This makes for bigger, but faster code.
20945
20946 The hardware multiply routines disable interrupts whilst running
20947 and restore the previous interrupt state when they finish. This
20948 makes them safe to use inside interrupt handlers as well as in
20949 normal code.
20950
20951 -minrt
20952 Enable the use of a minimum runtime environment - no static
20953 initializers or constructors. This is intended for memory-
20954 constrained devices. The compiler includes special symbols in some
20955 objects that tell the linker and runtime which code fragments are
20956 required.
20957
20958 -mtiny-printf
20959 Enable reduced code size "printf" and "puts" library functions.
20960 The tiny implementations of these functions are not reentrant, so
20961 must be used with caution in multi-threaded applications.
20962
20963 Support for streams has been removed and the string to be printed
20964 will always be sent to stdout via the "write" syscall. The string
20965 is not buffered before it is sent to write.
20966
20967 This option requires Newlib Nano IO, so GCC must be configured with
20968 --enable-newlib-nano-formatted-io.
20969
20970 -mcode-region=
20971 -mdata-region=
20972 These options tell the compiler where to place functions and data
20973 that do not have one of the "lower", "upper", "either" or "section"
20974 attributes. Possible values are "lower", "upper", "either" or
20975 "any". The first three behave like the corresponding attribute.
20976 The fourth possible value - "any" - is the default. It leaves
20977 placement entirely up to the linker script and how it assigns the
20978 standard sections (".text", ".data", etc) to the memory regions.
20979
20980 -msilicon-errata=
20981 This option passes on a request to assembler to enable the fixes
20982 for the named silicon errata.
20983
20984 -msilicon-errata-warn=
20985 This option passes on a request to the assembler to enable warning
20986 messages when a silicon errata might need to be applied.
20987
20988 -mwarn-devices-csv
20989 -mno-warn-devices-csv
20990 Warn if devices.csv is not found or there are problem parsing it
20991 (default: on).
20992
20993 NDS32 Options
20994
20995 These options are defined for NDS32 implementations:
20996
20997 -mbig-endian
20998 Generate code in big-endian mode.
20999
21000 -mlittle-endian
21001 Generate code in little-endian mode.
21002
21003 -mreduced-regs
21004 Use reduced-set registers for register allocation.
21005
21006 -mfull-regs
21007 Use full-set registers for register allocation.
21008
21009 -mcmov
21010 Generate conditional move instructions.
21011
21012 -mno-cmov
21013 Do not generate conditional move instructions.
21014
21015 -mext-perf
21016 Generate performance extension instructions.
21017
21018 -mno-ext-perf
21019 Do not generate performance extension instructions.
21020
21021 -mext-perf2
21022 Generate performance extension 2 instructions.
21023
21024 -mno-ext-perf2
21025 Do not generate performance extension 2 instructions.
21026
21027 -mext-string
21028 Generate string extension instructions.
21029
21030 -mno-ext-string
21031 Do not generate string extension instructions.
21032
21033 -mv3push
21034 Generate v3 push25/pop25 instructions.
21035
21036 -mno-v3push
21037 Do not generate v3 push25/pop25 instructions.
21038
21039 -m16-bit
21040 Generate 16-bit instructions.
21041
21042 -mno-16-bit
21043 Do not generate 16-bit instructions.
21044
21045 -misr-vector-size=num
21046 Specify the size of each interrupt vector, which must be 4 or 16.
21047
21048 -mcache-block-size=num
21049 Specify the size of each cache block, which must be a power of 2
21050 between 4 and 512.
21051
21052 -march=arch
21053 Specify the name of the target architecture.
21054
21055 -mcmodel=code-model
21056 Set the code model to one of
21057
21058 small
21059 All the data and read-only data segments must be within 512KB
21060 addressing space. The text segment must be within 16MB
21061 addressing space.
21062
21063 medium
21064 The data segment must be within 512KB while the read-only data
21065 segment can be within 4GB addressing space. The text segment
21066 should be still within 16MB addressing space.
21067
21068 large
21069 All the text and data segments can be within 4GB addressing
21070 space.
21071
21072 -mctor-dtor
21073 Enable constructor/destructor feature.
21074
21075 -mrelax
21076 Guide linker to relax instructions.
21077
21078 Nios II Options
21079
21080 These are the options defined for the Altera Nios II processor.
21081
21082 -G num
21083 Put global and static objects less than or equal to num bytes into
21084 the small data or BSS sections instead of the normal data or BSS
21085 sections. The default value of num is 8.
21086
21087 -mgpopt=option
21088 -mgpopt
21089 -mno-gpopt
21090 Generate (do not generate) GP-relative accesses. The following
21091 option names are recognized:
21092
21093 none
21094 Do not generate GP-relative accesses.
21095
21096 local
21097 Generate GP-relative accesses for small data objects that are
21098 not external, weak, or uninitialized common symbols. Also use
21099 GP-relative addressing for objects that have been explicitly
21100 placed in a small data section via a "section" attribute.
21101
21102 global
21103 As for local, but also generate GP-relative accesses for small
21104 data objects that are external, weak, or common. If you use
21105 this option, you must ensure that all parts of your program
21106 (including libraries) are compiled with the same -G setting.
21107
21108 data
21109 Generate GP-relative accesses for all data objects in the
21110 program. If you use this option, the entire data and BSS
21111 segments of your program must fit in 64K of memory and you must
21112 use an appropriate linker script to allocate them within the
21113 addressable range of the global pointer.
21114
21115 all Generate GP-relative addresses for function pointers as well as
21116 data pointers. If you use this option, the entire text, data,
21117 and BSS segments of your program must fit in 64K of memory and
21118 you must use an appropriate linker script to allocate them
21119 within the addressable range of the global pointer.
21120
21121 -mgpopt is equivalent to -mgpopt=local, and -mno-gpopt is
21122 equivalent to -mgpopt=none.
21123
21124 The default is -mgpopt except when -fpic or -fPIC is specified to
21125 generate position-independent code. Note that the Nios II ABI does
21126 not permit GP-relative accesses from shared libraries.
21127
21128 You may need to specify -mno-gpopt explicitly when building
21129 programs that include large amounts of small data, including large
21130 GOT data sections. In this case, the 16-bit offset for GP-relative
21131 addressing may not be large enough to allow access to the entire
21132 small data section.
21133
21134 -mgprel-sec=regexp
21135 This option specifies additional section names that can be accessed
21136 via GP-relative addressing. It is most useful in conjunction with
21137 "section" attributes on variable declarations and a custom linker
21138 script. The regexp is a POSIX Extended Regular Expression.
21139
21140 This option does not affect the behavior of the -G option, and the
21141 specified sections are in addition to the standard ".sdata" and
21142 ".sbss" small-data sections that are recognized by -mgpopt.
21143
21144 -mr0rel-sec=regexp
21145 This option specifies names of sections that can be accessed via a
21146 16-bit offset from "r0"; that is, in the low 32K or high 32K of the
21147 32-bit address space. It is most useful in conjunction with
21148 "section" attributes on variable declarations and a custom linker
21149 script. The regexp is a POSIX Extended Regular Expression.
21150
21151 In contrast to the use of GP-relative addressing for small data,
21152 zero-based addressing is never generated by default and there are
21153 no conventional section names used in standard linker scripts for
21154 sections in the low or high areas of memory.
21155
21156 -mel
21157 -meb
21158 Generate little-endian (default) or big-endian (experimental) code,
21159 respectively.
21160
21161 -march=arch
21162 This specifies the name of the target Nios II architecture. GCC
21163 uses this name to determine what kind of instructions it can emit
21164 when generating assembly code. Permissible names are: r1, r2.
21165
21166 The preprocessor macro "__nios2_arch__" is available to programs,
21167 with value 1 or 2, indicating the targeted ISA level.
21168
21169 -mbypass-cache
21170 -mno-bypass-cache
21171 Force all load and store instructions to always bypass cache by
21172 using I/O variants of the instructions. The default is not to
21173 bypass the cache.
21174
21175 -mno-cache-volatile
21176 -mcache-volatile
21177 Volatile memory access bypass the cache using the I/O variants of
21178 the load and store instructions. The default is not to bypass the
21179 cache.
21180
21181 -mno-fast-sw-div
21182 -mfast-sw-div
21183 Do not use table-based fast divide for small numbers. The default
21184 is to use the fast divide at -O3 and above.
21185
21186 -mno-hw-mul
21187 -mhw-mul
21188 -mno-hw-mulx
21189 -mhw-mulx
21190 -mno-hw-div
21191 -mhw-div
21192 Enable or disable emitting "mul", "mulx" and "div" family of
21193 instructions by the compiler. The default is to emit "mul" and not
21194 emit "div" and "mulx".
21195
21196 -mbmx
21197 -mno-bmx
21198 -mcdx
21199 -mno-cdx
21200 Enable or disable generation of Nios II R2 BMX (bit manipulation)
21201 and CDX (code density) instructions. Enabling these instructions
21202 also requires -march=r2. Since these instructions are optional
21203 extensions to the R2 architecture, the default is not to emit them.
21204
21205 -mcustom-insn=N
21206 -mno-custom-insn
21207 Each -mcustom-insn=N option enables use of a custom instruction
21208 with encoding N when generating code that uses insn. For example,
21209 -mcustom-fadds=253 generates custom instruction 253 for single-
21210 precision floating-point add operations instead of the default
21211 behavior of using a library call.
21212
21213 The following values of insn are supported. Except as otherwise
21214 noted, floating-point operations are expected to be implemented
21215 with normal IEEE 754 semantics and correspond directly to the C
21216 operators or the equivalent GCC built-in functions.
21217
21218 Single-precision floating point:
21219
21220 fadds, fsubs, fdivs, fmuls
21221 Binary arithmetic operations.
21222
21223 fnegs
21224 Unary negation.
21225
21226 fabss
21227 Unary absolute value.
21228
21229 fcmpeqs, fcmpges, fcmpgts, fcmples, fcmplts, fcmpnes
21230 Comparison operations.
21231
21232 fmins, fmaxs
21233 Floating-point minimum and maximum. These instructions are
21234 only generated if -ffinite-math-only is specified.
21235
21236 fsqrts
21237 Unary square root operation.
21238
21239 fcoss, fsins, ftans, fatans, fexps, flogs
21240 Floating-point trigonometric and exponential functions. These
21241 instructions are only generated if -funsafe-math-optimizations
21242 is also specified.
21243
21244 Double-precision floating point:
21245
21246 faddd, fsubd, fdivd, fmuld
21247 Binary arithmetic operations.
21248
21249 fnegd
21250 Unary negation.
21251
21252 fabsd
21253 Unary absolute value.
21254
21255 fcmpeqd, fcmpged, fcmpgtd, fcmpled, fcmpltd, fcmpned
21256 Comparison operations.
21257
21258 fmind, fmaxd
21259 Double-precision minimum and maximum. These instructions are
21260 only generated if -ffinite-math-only is specified.
21261
21262 fsqrtd
21263 Unary square root operation.
21264
21265 fcosd, fsind, ftand, fatand, fexpd, flogd
21266 Double-precision trigonometric and exponential functions.
21267 These instructions are only generated if
21268 -funsafe-math-optimizations is also specified.
21269
21270 Conversions:
21271
21272 fextsd
21273 Conversion from single precision to double precision.
21274
21275 ftruncds
21276 Conversion from double precision to single precision.
21277
21278 fixsi, fixsu, fixdi, fixdu
21279 Conversion from floating point to signed or unsigned integer
21280 types, with truncation towards zero.
21281
21282 round
21283 Conversion from single-precision floating point to signed
21284 integer, rounding to the nearest integer and ties away from
21285 zero. This corresponds to the "__builtin_lroundf" function
21286 when -fno-math-errno is used.
21287
21288 floatis, floatus, floatid, floatud
21289 Conversion from signed or unsigned integer types to floating-
21290 point types.
21291
21292 In addition, all of the following transfer instructions for
21293 internal registers X and Y must be provided to use any of the
21294 double-precision floating-point instructions. Custom instructions
21295 taking two double-precision source operands expect the first
21296 operand in the 64-bit register X. The other operand (or only
21297 operand of a unary operation) is given to the custom arithmetic
21298 instruction with the least significant half in source register src1
21299 and the most significant half in src2. A custom instruction that
21300 returns a double-precision result returns the most significant 32
21301 bits in the destination register and the other half in 32-bit
21302 register Y. GCC automatically generates the necessary code
21303 sequences to write register X and/or read register Y when double-
21304 precision floating-point instructions are used.
21305
21306 fwrx
21307 Write src1 into the least significant half of X and src2 into
21308 the most significant half of X.
21309
21310 fwry
21311 Write src1 into Y.
21312
21313 frdxhi, frdxlo
21314 Read the most or least (respectively) significant half of X and
21315 store it in dest.
21316
21317 frdy
21318 Read the value of Y and store it into dest.
21319
21320 Note that you can gain more local control over generation of Nios
21321 II custom instructions by using the "target("custom-insn=N")" and
21322 "target("no-custom-insn")" function attributes or pragmas.
21323
21324 -mcustom-fpu-cfg=name
21325 This option enables a predefined, named set of custom instruction
21326 encodings (see -mcustom-insn above). Currently, the following sets
21327 are defined:
21328
21329 -mcustom-fpu-cfg=60-1 is equivalent to: -mcustom-fmuls=252
21330 -mcustom-fadds=253 -mcustom-fsubs=254 -fsingle-precision-constant
21331
21332 -mcustom-fpu-cfg=60-2 is equivalent to: -mcustom-fmuls=252
21333 -mcustom-fadds=253 -mcustom-fsubs=254 -mcustom-fdivs=255
21334 -fsingle-precision-constant
21335
21336 -mcustom-fpu-cfg=72-3 is equivalent to: -mcustom-floatus=243
21337 -mcustom-fixsi=244 -mcustom-floatis=245 -mcustom-fcmpgts=246
21338 -mcustom-fcmples=249 -mcustom-fcmpeqs=250 -mcustom-fcmpnes=251
21339 -mcustom-fmuls=252 -mcustom-fadds=253 -mcustom-fsubs=254
21340 -mcustom-fdivs=255 -fsingle-precision-constant
21341
21342 Custom instruction assignments given by individual -mcustom-insn=
21343 options override those given by -mcustom-fpu-cfg=, regardless of
21344 the order of the options on the command line.
21345
21346 Note that you can gain more local control over selection of a FPU
21347 configuration by using the "target("custom-fpu-cfg=name")" function
21348 attribute or pragma.
21349
21350 These additional -m options are available for the Altera Nios II ELF
21351 (bare-metal) target:
21352
21353 -mhal
21354 Link with HAL BSP. This suppresses linking with the GCC-provided C
21355 runtime startup and termination code, and is typically used in
21356 conjunction with -msys-crt0= to specify the location of the
21357 alternate startup code provided by the HAL BSP.
21358
21359 -msmallc
21360 Link with a limited version of the C library, -lsmallc, rather than
21361 Newlib.
21362
21363 -msys-crt0=startfile
21364 startfile is the file name of the startfile (crt0) to use when
21365 linking. This option is only useful in conjunction with -mhal.
21366
21367 -msys-lib=systemlib
21368 systemlib is the library name of the library that provides low-
21369 level system calls required by the C library, e.g. "read" and
21370 "write". This option is typically used to link with a library
21371 provided by a HAL BSP.
21372
21373 Nvidia PTX Options
21374
21375 These options are defined for Nvidia PTX:
21376
21377 -m32
21378 -m64
21379 Generate code for 32-bit or 64-bit ABI.
21380
21381 -misa=ISA-string
21382 Generate code for given the specified PTX ISA (e.g. sm_35). ISA
21383 strings must be lower-case. Valid ISA strings include sm_30 and
21384 sm_35. The default ISA is sm_30.
21385
21386 -mmainkernel
21387 Link in code for a __main kernel. This is for stand-alone instead
21388 of offloading execution.
21389
21390 -moptimize
21391 Apply partitioned execution optimizations. This is the default
21392 when any level of optimization is selected.
21393
21394 -msoft-stack
21395 Generate code that does not use ".local" memory directly for stack
21396 storage. Instead, a per-warp stack pointer is maintained
21397 explicitly. This enables variable-length stack allocation (with
21398 variable-length arrays or "alloca"), and when global memory is used
21399 for underlying storage, makes it possible to access automatic
21400 variables from other threads, or with atomic instructions. This
21401 code generation variant is used for OpenMP offloading, but the
21402 option is exposed on its own for the purpose of testing the
21403 compiler; to generate code suitable for linking into programs using
21404 OpenMP offloading, use option -mgomp.
21405
21406 -muniform-simt
21407 Switch to code generation variant that allows to execute all
21408 threads in each warp, while maintaining memory state and side
21409 effects as if only one thread in each warp was active outside of
21410 OpenMP SIMD regions. All atomic operations and calls to runtime
21411 (malloc, free, vprintf) are conditionally executed (iff current
21412 lane index equals the master lane index), and the register being
21413 assigned is copied via a shuffle instruction from the master lane.
21414 Outside of SIMD regions lane 0 is the master; inside, each thread
21415 sees itself as the master. Shared memory array "int __nvptx_uni[]"
21416 stores all-zeros or all-ones bitmasks for each warp, indicating
21417 current mode (0 outside of SIMD regions). Each thread can bitwise-
21418 and the bitmask at position "tid.y" with current lane index to
21419 compute the master lane index.
21420
21421 -mgomp
21422 Generate code for use in OpenMP offloading: enables -msoft-stack
21423 and -muniform-simt options, and selects corresponding multilib
21424 variant.
21425
21426 OpenRISC Options
21427
21428 These options are defined for OpenRISC:
21429
21430 -mboard=name
21431 Configure a board specific runtime. This will be passed to the
21432 linker for newlib board library linking. The default is "or1ksim".
21433
21434 -mnewlib
21435 This option is ignored; it is for compatibility purposes only.
21436 This used to select linker and preprocessor options for use with
21437 newlib.
21438
21439 -msoft-div
21440 -mhard-div
21441 Select software or hardware divide ("l.div", "l.divu")
21442 instructions. This default is hardware divide.
21443
21444 -msoft-mul
21445 -mhard-mul
21446 Select software or hardware multiply ("l.mul", "l.muli")
21447 instructions. This default is hardware multiply.
21448
21449 -msoft-float
21450 -mhard-float
21451 Select software or hardware for floating point operations. The
21452 default is software.
21453
21454 -mdouble-float
21455 When -mhard-float is selected, enables generation of double-
21456 precision floating point instructions. By default functions from
21457 libgcc are used to perform double-precision floating point
21458 operations.
21459
21460 -munordered-float
21461 When -mhard-float is selected, enables generation of unordered
21462 floating point compare and set flag ("lf.sfun*") instructions. By
21463 default functions from libgcc are used to perform unordered
21464 floating point compare and set flag operations.
21465
21466 -mcmov
21467 Enable generation of conditional move ("l.cmov") instructions. By
21468 default the equivalent will be generated using set and branch.
21469
21470 -mror
21471 Enable generation of rotate right ("l.ror") instructions. By
21472 default functions from libgcc are used to perform rotate right
21473 operations.
21474
21475 -mrori
21476 Enable generation of rotate right with immediate ("l.rori")
21477 instructions. By default functions from libgcc are used to perform
21478 rotate right with immediate operations.
21479
21480 -msext
21481 Enable generation of sign extension ("l.ext*") instructions. By
21482 default memory loads are used to perform sign extension.
21483
21484 -msfimm
21485 Enable generation of compare and set flag with immediate ("l.sf*i")
21486 instructions. By default extra instructions will be generated to
21487 store the immediate to a register first.
21488
21489 -mshftimm
21490 Enable generation of shift with immediate ("l.srai", "l.srli",
21491 "l.slli") instructions. By default extra instructions will be
21492 generated to store the immediate to a register first.
21493
21494 PDP-11 Options
21495
21496 These options are defined for the PDP-11:
21497
21498 -mfpu
21499 Use hardware FPP floating point. This is the default. (FIS
21500 floating point on the PDP-11/40 is not supported.) Implies -m45.
21501
21502 -msoft-float
21503 Do not use hardware floating point.
21504
21505 -mac0
21506 Return floating-point results in ac0 (fr0 in Unix assembler
21507 syntax).
21508
21509 -mno-ac0
21510 Return floating-point results in memory. This is the default.
21511
21512 -m40
21513 Generate code for a PDP-11/40. Implies -msoft-float -mno-split.
21514
21515 -m45
21516 Generate code for a PDP-11/45. This is the default.
21517
21518 -m10
21519 Generate code for a PDP-11/10. Implies -msoft-float -mno-split.
21520
21521 -mint16
21522 -mno-int32
21523 Use 16-bit "int". This is the default.
21524
21525 -mint32
21526 -mno-int16
21527 Use 32-bit "int".
21528
21529 -msplit
21530 Target has split instruction and data space. Implies -m45.
21531
21532 -munix-asm
21533 Use Unix assembler syntax.
21534
21535 -mdec-asm
21536 Use DEC assembler syntax.
21537
21538 -mgnu-asm
21539 Use GNU assembler syntax. This is the default.
21540
21541 -mlra
21542 Use the new LRA register allocator. By default, the old "reload"
21543 allocator is used.
21544
21545 picoChip Options
21546
21547 These -m options are defined for picoChip implementations:
21548
21549 -mae=ae_type
21550 Set the instruction set, register set, and instruction scheduling
21551 parameters for array element type ae_type. Supported values for
21552 ae_type are ANY, MUL, and MAC.
21553
21554 -mae=ANY selects a completely generic AE type. Code generated with
21555 this option runs on any of the other AE types. The code is not as
21556 efficient as it would be if compiled for a specific AE type, and
21557 some types of operation (e.g., multiplication) do not work properly
21558 on all types of AE.
21559
21560 -mae=MUL selects a MUL AE type. This is the most useful AE type
21561 for compiled code, and is the default.
21562
21563 -mae=MAC selects a DSP-style MAC AE. Code compiled with this
21564 option may suffer from poor performance of byte (char)
21565 manipulation, since the DSP AE does not provide hardware support
21566 for byte load/stores.
21567
21568 -msymbol-as-address
21569 Enable the compiler to directly use a symbol name as an address in
21570 a load/store instruction, without first loading it into a register.
21571 Typically, the use of this option generates larger programs, which
21572 run faster than when the option isn't used. However, the results
21573 vary from program to program, so it is left as a user option,
21574 rather than being permanently enabled.
21575
21576 -mno-inefficient-warnings
21577 Disables warnings about the generation of inefficient code. These
21578 warnings can be generated, for example, when compiling code that
21579 performs byte-level memory operations on the MAC AE type. The MAC
21580 AE has no hardware support for byte-level memory operations, so all
21581 byte load/stores must be synthesized from word load/store
21582 operations. This is inefficient and a warning is generated to
21583 indicate that you should rewrite the code to avoid byte operations,
21584 or to target an AE type that has the necessary hardware support.
21585 This option disables these warnings.
21586
21587 PowerPC Options
21588
21589 These are listed under
21590
21591 PRU Options
21592
21593 These command-line options are defined for PRU target:
21594
21595 -minrt
21596 Link with a minimum runtime environment, with no support for static
21597 initializers and constructors. Using this option can significantly
21598 reduce the size of the final ELF binary. Beware that the compiler
21599 could still generate code with static initializers and
21600 constructors. It is up to the programmer to ensure that the source
21601 program will not use those features.
21602
21603 -mmcu=mcu
21604 Specify the PRU MCU variant to use. Check Newlib for the exact
21605 list of supported MCUs.
21606
21607 -mno-relax
21608 Make GCC pass the --no-relax command-line option to the linker
21609 instead of the --relax option.
21610
21611 -mloop
21612 Allow (or do not allow) GCC to use the LOOP instruction.
21613
21614 -mabi=variant
21615 Specify the ABI variant to output code for. -mabi=ti selects the
21616 unmodified TI ABI while -mabi=gnu selects a GNU variant that copes
21617 more naturally with certain GCC assumptions. These are the
21618 differences:
21619
21620 Function Pointer Size
21621 TI ABI specifies that function (code) pointers are 16-bit,
21622 whereas GNU supports only 32-bit data and code pointers.
21623
21624 Optional Return Value Pointer
21625 Function return values larger than 64 bits are passed by using
21626 a hidden pointer as the first argument of the function. TI
21627 ABI, though, mandates that the pointer can be NULL in case the
21628 caller is not using the returned value. GNU always passes and
21629 expects a valid return value pointer.
21630
21631 The current -mabi=ti implementation simply raises a compile error
21632 when any of the above code constructs is detected. As a
21633 consequence the standard C library cannot be built and it is
21634 omitted when linking with -mabi=ti.
21635
21636 Relaxation is a GNU feature and for safety reasons is disabled when
21637 using -mabi=ti. The TI toolchain does not emit relocations for
21638 QBBx instructions, so the GNU linker cannot adjust them when
21639 shortening adjacent LDI32 pseudo instructions.
21640
21641 RISC-V Options
21642
21643 These command-line options are defined for RISC-V targets:
21644
21645 -mbranch-cost=n
21646 Set the cost of branches to roughly n instructions.
21647
21648 -mplt
21649 -mno-plt
21650 When generating PIC code, do or don't allow the use of PLTs.
21651 Ignored for non-PIC. The default is -mplt.
21652
21653 -mabi=ABI-string
21654 Specify integer and floating-point calling convention. ABI-string
21655 contains two parts: the size of integer types and the registers
21656 used for floating-point types. For example -march=rv64ifd
21657 -mabi=lp64d means that long and pointers are 64-bit (implicitly
21658 defining int to be 32-bit), and that floating-point values up to 64
21659 bits wide are passed in F registers. Contrast this with
21660 -march=rv64ifd -mabi=lp64f, which still allows the compiler to
21661 generate code that uses the F and D extensions but only allows
21662 floating-point values up to 32 bits long to be passed in registers;
21663 or -march=rv64ifd -mabi=lp64, in which no floating-point arguments
21664 will be passed in registers.
21665
21666 The default for this argument is system dependent, users who want a
21667 specific calling convention should specify one explicitly. The
21668 valid calling conventions are: ilp32, ilp32f, ilp32d, lp64, lp64f,
21669 and lp64d. Some calling conventions are impossible to implement on
21670 some ISAs: for example, -march=rv32if -mabi=ilp32d is invalid
21671 because the ABI requires 64-bit values be passed in F registers,
21672 but F registers are only 32 bits wide. There is also the ilp32e
21673 ABI that can only be used with the rv32e architecture. This ABI is
21674 not well specified at present, and is subject to change.
21675
21676 -mfdiv
21677 -mno-fdiv
21678 Do or don't use hardware floating-point divide and square root
21679 instructions. This requires the F or D extensions for floating-
21680 point registers. The default is to use them if the specified
21681 architecture has these instructions.
21682
21683 -mdiv
21684 -mno-div
21685 Do or don't use hardware instructions for integer division. This
21686 requires the M extension. The default is to use them if the
21687 specified architecture has these instructions.
21688
21689 -march=ISA-string
21690 Generate code for given RISC-V ISA (e.g. rv64im). ISA strings must
21691 be lower-case. Examples include rv64i, rv32g, rv32e, and rv32imaf.
21692
21693 -mtune=processor-string
21694 Optimize the output for the given processor, specified by
21695 microarchitecture name. Permissible values for this option are:
21696 rocket, sifive-3-series, sifive-5-series, sifive-7-series, and
21697 size.
21698
21699 When -mtune= is not specified, the default is rocket.
21700
21701 The size choice is not intended for use by end-users. This is used
21702 when -Os is specified. It overrides the instruction cost info
21703 provided by -mtune=, but does not override the pipeline info. This
21704 helps reduce code size while still giving good performance.
21705
21706 -mpreferred-stack-boundary=num
21707 Attempt to keep the stack boundary aligned to a 2 raised to num
21708 byte boundary. If -mpreferred-stack-boundary is not specified, the
21709 default is 4 (16 bytes or 128-bits).
21710
21711 Warning: If you use this switch, then you must build all modules
21712 with the same value, including any libraries. This includes the
21713 system libraries and startup modules.
21714
21715 -msmall-data-limit=n
21716 Put global and static data smaller than n bytes into a special
21717 section (on some targets).
21718
21719 -msave-restore
21720 -mno-save-restore
21721 Do or don't use smaller but slower prologue and epilogue code that
21722 uses library function calls. The default is to use fast inline
21723 prologues and epilogues.
21724
21725 -mstrict-align
21726 -mno-strict-align
21727 Do not or do generate unaligned memory accesses. The default is
21728 set depending on whether the processor we are optimizing for
21729 supports fast unaligned access or not.
21730
21731 -mcmodel=medlow
21732 Generate code for the medium-low code model. The program and its
21733 statically defined symbols must lie within a single 2 GiB address
21734 range and must lie between absolute addresses -2 GiB and +2 GiB.
21735 Programs can be statically or dynamically linked. This is the
21736 default code model.
21737
21738 -mcmodel=medany
21739 Generate code for the medium-any code model. The program and its
21740 statically defined symbols must be within any single 2 GiB address
21741 range. Programs can be statically or dynamically linked.
21742
21743 -mexplicit-relocs
21744 -mno-exlicit-relocs
21745 Use or do not use assembler relocation operators when dealing with
21746 symbolic addresses. The alternative is to use assembler macros
21747 instead, which may limit optimization.
21748
21749 -mrelax
21750 -mno-relax
21751 Take advantage of linker relaxations to reduce the number of
21752 instructions required to materialize symbol addresses. The default
21753 is to take advantage of linker relaxations.
21754
21755 -memit-attribute
21756 -mno-emit-attribute
21757 Emit (do not emit) RISC-V attribute to record extra information
21758 into ELF objects. This feature requires at least binutils 2.32.
21759
21760 -malign-data=type
21761 Control how GCC aligns variables and constants of array, structure,
21762 or union types. Supported values for type are xlen which uses x
21763 register width as the alignment value, and natural which uses
21764 natural alignment. xlen is the default.
21765
21766 RL78 Options
21767
21768 -msim
21769 Links in additional target libraries to support operation within a
21770 simulator.
21771
21772 -mmul=none
21773 -mmul=g10
21774 -mmul=g13
21775 -mmul=g14
21776 -mmul=rl78
21777 Specifies the type of hardware multiplication and division support
21778 to be used. The simplest is "none", which uses software for both
21779 multiplication and division. This is the default. The "g13" value
21780 is for the hardware multiply/divide peripheral found on the
21781 RL78/G13 (S2 core) targets. The "g14" value selects the use of the
21782 multiplication and division instructions supported by the RL78/G14
21783 (S3 core) parts. The value "rl78" is an alias for "g14" and the
21784 value "mg10" is an alias for "none".
21785
21786 In addition a C preprocessor macro is defined, based upon the
21787 setting of this option. Possible values are: "__RL78_MUL_NONE__",
21788 "__RL78_MUL_G13__" or "__RL78_MUL_G14__".
21789
21790 -mcpu=g10
21791 -mcpu=g13
21792 -mcpu=g14
21793 -mcpu=rl78
21794 Specifies the RL78 core to target. The default is the G14 core,
21795 also known as an S3 core or just RL78. The G13 or S2 core does not
21796 have multiply or divide instructions, instead it uses a hardware
21797 peripheral for these operations. The G10 or S1 core does not have
21798 register banks, so it uses a different calling convention.
21799
21800 If this option is set it also selects the type of hardware multiply
21801 support to use, unless this is overridden by an explicit -mmul=none
21802 option on the command line. Thus specifying -mcpu=g13 enables the
21803 use of the G13 hardware multiply peripheral and specifying
21804 -mcpu=g10 disables the use of hardware multiplications altogether.
21805
21806 Note, although the RL78/G14 core is the default target, specifying
21807 -mcpu=g14 or -mcpu=rl78 on the command line does change the
21808 behavior of the toolchain since it also enables G14 hardware
21809 multiply support. If these options are not specified on the
21810 command line then software multiplication routines will be used
21811 even though the code targets the RL78 core. This is for backwards
21812 compatibility with older toolchains which did not have hardware
21813 multiply and divide support.
21814
21815 In addition a C preprocessor macro is defined, based upon the
21816 setting of this option. Possible values are: "__RL78_G10__",
21817 "__RL78_G13__" or "__RL78_G14__".
21818
21819 -mg10
21820 -mg13
21821 -mg14
21822 -mrl78
21823 These are aliases for the corresponding -mcpu= option. They are
21824 provided for backwards compatibility.
21825
21826 -mallregs
21827 Allow the compiler to use all of the available registers. By
21828 default registers "r24..r31" are reserved for use in interrupt
21829 handlers. With this option enabled these registers can be used in
21830 ordinary functions as well.
21831
21832 -m64bit-doubles
21833 -m32bit-doubles
21834 Make the "double" data type be 64 bits (-m64bit-doubles) or 32 bits
21835 (-m32bit-doubles) in size. The default is -m32bit-doubles.
21836
21837 -msave-mduc-in-interrupts
21838 -mno-save-mduc-in-interrupts
21839 Specifies that interrupt handler functions should preserve the MDUC
21840 registers. This is only necessary if normal code might use the
21841 MDUC registers, for example because it performs multiplication and
21842 division operations. The default is to ignore the MDUC registers
21843 as this makes the interrupt handlers faster. The target option
21844 -mg13 needs to be passed for this to work as this feature is only
21845 available on the G13 target (S2 core). The MDUC registers will
21846 only be saved if the interrupt handler performs a multiplication or
21847 division operation or it calls another function.
21848
21849 IBM RS/6000 and PowerPC Options
21850
21851 These -m options are defined for the IBM RS/6000 and PowerPC:
21852
21853 -mpowerpc-gpopt
21854 -mno-powerpc-gpopt
21855 -mpowerpc-gfxopt
21856 -mno-powerpc-gfxopt
21857 -mpowerpc64
21858 -mno-powerpc64
21859 -mmfcrf
21860 -mno-mfcrf
21861 -mpopcntb
21862 -mno-popcntb
21863 -mpopcntd
21864 -mno-popcntd
21865 -mfprnd
21866 -mno-fprnd
21867 -mcmpb
21868 -mno-cmpb
21869 -mhard-dfp
21870 -mno-hard-dfp
21871 You use these options to specify which instructions are available
21872 on the processor you are using. The default value of these options
21873 is determined when configuring GCC. Specifying the -mcpu=cpu_type
21874 overrides the specification of these options. We recommend you use
21875 the -mcpu=cpu_type option rather than the options listed above.
21876
21877 Specifying -mpowerpc-gpopt allows GCC to use the optional PowerPC
21878 architecture instructions in the General Purpose group, including
21879 floating-point square root. Specifying -mpowerpc-gfxopt allows GCC
21880 to use the optional PowerPC architecture instructions in the
21881 Graphics group, including floating-point select.
21882
21883 The -mmfcrf option allows GCC to generate the move from condition
21884 register field instruction implemented on the POWER4 processor and
21885 other processors that support the PowerPC V2.01 architecture. The
21886 -mpopcntb option allows GCC to generate the popcount and double-
21887 precision FP reciprocal estimate instruction implemented on the
21888 POWER5 processor and other processors that support the PowerPC
21889 V2.02 architecture. The -mpopcntd option allows GCC to generate
21890 the popcount instruction implemented on the POWER7 processor and
21891 other processors that support the PowerPC V2.06 architecture. The
21892 -mfprnd option allows GCC to generate the FP round to integer
21893 instructions implemented on the POWER5+ processor and other
21894 processors that support the PowerPC V2.03 architecture. The -mcmpb
21895 option allows GCC to generate the compare bytes instruction
21896 implemented on the POWER6 processor and other processors that
21897 support the PowerPC V2.05 architecture. The -mhard-dfp option
21898 allows GCC to generate the decimal floating-point instructions
21899 implemented on some POWER processors.
21900
21901 The -mpowerpc64 option allows GCC to generate the additional 64-bit
21902 instructions that are found in the full PowerPC64 architecture and
21903 to treat GPRs as 64-bit, doubleword quantities. GCC defaults to
21904 -mno-powerpc64.
21905
21906 -mcpu=cpu_type
21907 Set architecture type, register usage, and instruction scheduling
21908 parameters for machine type cpu_type. Supported values for
21909 cpu_type are 401, 403, 405, 405fp, 440, 440fp, 464, 464fp, 476,
21910 476fp, 505, 601, 602, 603, 603e, 604, 604e, 620, 630, 740, 7400,
21911 7450, 750, 801, 821, 823, 860, 970, 8540, a2, e300c2, e300c3,
21912 e500mc, e500mc64, e5500, e6500, ec603e, G3, G4, G5, titan, power3,
21913 power4, power5, power5+, power6, power6x, power7, power8, power9,
21914 future, powerpc, powerpc64, powerpc64le, rs64, and native.
21915
21916 -mcpu=powerpc, -mcpu=powerpc64, and -mcpu=powerpc64le specify pure
21917 32-bit PowerPC (either endian), 64-bit big endian PowerPC and
21918 64-bit little endian PowerPC architecture machine types, with an
21919 appropriate, generic processor model assumed for scheduling
21920 purposes.
21921
21922 Specifying native as cpu type detects and selects the architecture
21923 option that corresponds to the host processor of the system
21924 performing the compilation. -mcpu=native has no effect if GCC does
21925 not recognize the processor.
21926
21927 The other options specify a specific processor. Code generated
21928 under those options runs best on that processor, and may not run at
21929 all on others.
21930
21931 The -mcpu options automatically enable or disable the following
21932 options:
21933
21934 -maltivec -mfprnd -mhard-float -mmfcrf -mmultiple -mpopcntb
21935 -mpopcntd -mpowerpc64 -mpowerpc-gpopt -mpowerpc-gfxopt -mmulhw
21936 -mdlmzb -mmfpgpr -mvsx -mcrypto -mhtm -mpower8-fusion
21937 -mpower8-vector -mquad-memory -mquad-memory-atomic -mfloat128
21938 -mfloat128-hardware -mprefixed -mpcrel -mmma
21939
21940 The particular options set for any particular CPU varies between
21941 compiler versions, depending on what setting seems to produce
21942 optimal code for that CPU; it doesn't necessarily reflect the
21943 actual hardware's capabilities. If you wish to set an individual
21944 option to a particular value, you may specify it after the -mcpu
21945 option, like -mcpu=970 -mno-altivec.
21946
21947 On AIX, the -maltivec and -mpowerpc64 options are not enabled or
21948 disabled by the -mcpu option at present because AIX does not have
21949 full support for these options. You may still enable or disable
21950 them individually if you're sure it'll work in your environment.
21951
21952 -mtune=cpu_type
21953 Set the instruction scheduling parameters for machine type
21954 cpu_type, but do not set the architecture type or register usage,
21955 as -mcpu=cpu_type does. The same values for cpu_type are used for
21956 -mtune as for -mcpu. If both are specified, the code generated
21957 uses the architecture and registers set by -mcpu, but the
21958 scheduling parameters set by -mtune.
21959
21960 -mcmodel=small
21961 Generate PowerPC64 code for the small model: The TOC is limited to
21962 64k.
21963
21964 -mcmodel=medium
21965 Generate PowerPC64 code for the medium model: The TOC and other
21966 static data may be up to a total of 4G in size. This is the
21967 default for 64-bit Linux.
21968
21969 -mcmodel=large
21970 Generate PowerPC64 code for the large model: The TOC may be up to
21971 4G in size. Other data and code is only limited by the 64-bit
21972 address space.
21973
21974 -maltivec
21975 -mno-altivec
21976 Generate code that uses (does not use) AltiVec instructions, and
21977 also enable the use of built-in functions that allow more direct
21978 access to the AltiVec instruction set. You may also need to set
21979 -mabi=altivec to adjust the current ABI with AltiVec ABI
21980 enhancements.
21981
21982 When -maltivec is used, the element order for AltiVec intrinsics
21983 such as "vec_splat", "vec_extract", and "vec_insert" match array
21984 element order corresponding to the endianness of the target. That
21985 is, element zero identifies the leftmost element in a vector
21986 register when targeting a big-endian platform, and identifies the
21987 rightmost element in a vector register when targeting a little-
21988 endian platform.
21989
21990 -mvrsave
21991 -mno-vrsave
21992 Generate VRSAVE instructions when generating AltiVec code.
21993
21994 -msecure-plt
21995 Generate code that allows ld and ld.so to build executables and
21996 shared libraries with non-executable ".plt" and ".got" sections.
21997 This is a PowerPC 32-bit SYSV ABI option.
21998
21999 -mbss-plt
22000 Generate code that uses a BSS ".plt" section that ld.so fills in,
22001 and requires ".plt" and ".got" sections that are both writable and
22002 executable. This is a PowerPC 32-bit SYSV ABI option.
22003
22004 -misel
22005 -mno-isel
22006 This switch enables or disables the generation of ISEL
22007 instructions.
22008
22009 -mvsx
22010 -mno-vsx
22011 Generate code that uses (does not use) vector/scalar (VSX)
22012 instructions, and also enable the use of built-in functions that
22013 allow more direct access to the VSX instruction set.
22014
22015 -mcrypto
22016 -mno-crypto
22017 Enable the use (disable) of the built-in functions that allow
22018 direct access to the cryptographic instructions that were added in
22019 version 2.07 of the PowerPC ISA.
22020
22021 -mhtm
22022 -mno-htm
22023 Enable (disable) the use of the built-in functions that allow
22024 direct access to the Hardware Transactional Memory (HTM)
22025 instructions that were added in version 2.07 of the PowerPC ISA.
22026
22027 -mpower8-fusion
22028 -mno-power8-fusion
22029 Generate code that keeps (does not keeps) some integer operations
22030 adjacent so that the instructions can be fused together on power8
22031 and later processors.
22032
22033 -mpower8-vector
22034 -mno-power8-vector
22035 Generate code that uses (does not use) the vector and scalar
22036 instructions that were added in version 2.07 of the PowerPC ISA.
22037 Also enable the use of built-in functions that allow more direct
22038 access to the vector instructions.
22039
22040 -mquad-memory
22041 -mno-quad-memory
22042 Generate code that uses (does not use) the non-atomic quad word
22043 memory instructions. The -mquad-memory option requires use of
22044 64-bit mode.
22045
22046 -mquad-memory-atomic
22047 -mno-quad-memory-atomic
22048 Generate code that uses (does not use) the atomic quad word memory
22049 instructions. The -mquad-memory-atomic option requires use of
22050 64-bit mode.
22051
22052 -mfloat128
22053 -mno-float128
22054 Enable/disable the __float128 keyword for IEEE 128-bit floating
22055 point and use either software emulation for IEEE 128-bit floating
22056 point or hardware instructions.
22057
22058 The VSX instruction set (-mvsx, -mcpu=power7, -mcpu=power8), or
22059 -mcpu=power9 must be enabled to use the IEEE 128-bit floating point
22060 support. The IEEE 128-bit floating point support only works on
22061 PowerPC Linux systems.
22062
22063 The default for -mfloat128 is enabled on PowerPC Linux systems
22064 using the VSX instruction set, and disabled on other systems.
22065
22066 If you use the ISA 3.0 instruction set (-mpower9-vector or
22067 -mcpu=power9) on a 64-bit system, the IEEE 128-bit floating point
22068 support will also enable the generation of ISA 3.0 IEEE 128-bit
22069 floating point instructions. Otherwise, if you do not specify to
22070 generate ISA 3.0 instructions or you are targeting a 32-bit big
22071 endian system, IEEE 128-bit floating point will be done with
22072 software emulation.
22073
22074 -mfloat128-hardware
22075 -mno-float128-hardware
22076 Enable/disable using ISA 3.0 hardware instructions to support the
22077 __float128 data type.
22078
22079 The default for -mfloat128-hardware is enabled on PowerPC Linux
22080 systems using the ISA 3.0 instruction set, and disabled on other
22081 systems.
22082
22083 -m32
22084 -m64
22085 Generate code for 32-bit or 64-bit environments of Darwin and SVR4
22086 targets (including GNU/Linux). The 32-bit environment sets int,
22087 long and pointer to 32 bits and generates code that runs on any
22088 PowerPC variant. The 64-bit environment sets int to 32 bits and
22089 long and pointer to 64 bits, and generates code for PowerPC64, as
22090 for -mpowerpc64.
22091
22092 -mfull-toc
22093 -mno-fp-in-toc
22094 -mno-sum-in-toc
22095 -mminimal-toc
22096 Modify generation of the TOC (Table Of Contents), which is created
22097 for every executable file. The -mfull-toc option is selected by
22098 default. In that case, GCC allocates at least one TOC entry for
22099 each unique non-automatic variable reference in your program. GCC
22100 also places floating-point constants in the TOC. However, only
22101 16,384 entries are available in the TOC.
22102
22103 If you receive a linker error message that saying you have
22104 overflowed the available TOC space, you can reduce the amount of
22105 TOC space used with the -mno-fp-in-toc and -mno-sum-in-toc options.
22106 -mno-fp-in-toc prevents GCC from putting floating-point constants
22107 in the TOC and -mno-sum-in-toc forces GCC to generate code to
22108 calculate the sum of an address and a constant at run time instead
22109 of putting that sum into the TOC. You may specify one or both of
22110 these options. Each causes GCC to produce very slightly slower and
22111 larger code at the expense of conserving TOC space.
22112
22113 If you still run out of space in the TOC even when you specify both
22114 of these options, specify -mminimal-toc instead. This option
22115 causes GCC to make only one TOC entry for every file. When you
22116 specify this option, GCC produces code that is slower and larger
22117 but which uses extremely little TOC space. You may wish to use
22118 this option only on files that contain less frequently-executed
22119 code.
22120
22121 -maix64
22122 -maix32
22123 Enable 64-bit AIX ABI and calling convention: 64-bit pointers,
22124 64-bit "long" type, and the infrastructure needed to support them.
22125 Specifying -maix64 implies -mpowerpc64, while -maix32 disables the
22126 64-bit ABI and implies -mno-powerpc64. GCC defaults to -maix32.
22127
22128 -mxl-compat
22129 -mno-xl-compat
22130 Produce code that conforms more closely to IBM XL compiler
22131 semantics when using AIX-compatible ABI. Pass floating-point
22132 arguments to prototyped functions beyond the register save area
22133 (RSA) on the stack in addition to argument FPRs. Do not assume
22134 that most significant double in 128-bit long double value is
22135 properly rounded when comparing values and converting to double.
22136 Use XL symbol names for long double support routines.
22137
22138 The AIX calling convention was extended but not initially
22139 documented to handle an obscure K&R C case of calling a function
22140 that takes the address of its arguments with fewer arguments than
22141 declared. IBM XL compilers access floating-point arguments that do
22142 not fit in the RSA from the stack when a subroutine is compiled
22143 without optimization. Because always storing floating-point
22144 arguments on the stack is inefficient and rarely needed, this
22145 option is not enabled by default and only is necessary when calling
22146 subroutines compiled by IBM XL compilers without optimization.
22147
22148 -mpe
22149 Support IBM RS/6000 SP Parallel Environment (PE). Link an
22150 application written to use message passing with special startup
22151 code to enable the application to run. The system must have PE
22152 installed in the standard location (/usr/lpp/ppe.poe/), or the
22153 specs file must be overridden with the -specs= option to specify
22154 the appropriate directory location. The Parallel Environment does
22155 not support threads, so the -mpe option and the -pthread option are
22156 incompatible.
22157
22158 -malign-natural
22159 -malign-power
22160 On AIX, 32-bit Darwin, and 64-bit PowerPC GNU/Linux, the option
22161 -malign-natural overrides the ABI-defined alignment of larger
22162 types, such as floating-point doubles, on their natural size-based
22163 boundary. The option -malign-power instructs GCC to follow the
22164 ABI-specified alignment rules. GCC defaults to the standard
22165 alignment defined in the ABI.
22166
22167 On 64-bit Darwin, natural alignment is the default, and
22168 -malign-power is not supported.
22169
22170 -msoft-float
22171 -mhard-float
22172 Generate code that does not use (uses) the floating-point register
22173 set. Software floating-point emulation is provided if you use the
22174 -msoft-float option, and pass the option to GCC when linking.
22175
22176 -mmultiple
22177 -mno-multiple
22178 Generate code that uses (does not use) the load multiple word
22179 instructions and the store multiple word instructions. These
22180 instructions are generated by default on POWER systems, and not
22181 generated on PowerPC systems. Do not use -mmultiple on little-
22182 endian PowerPC systems, since those instructions do not work when
22183 the processor is in little-endian mode. The exceptions are PPC740
22184 and PPC750 which permit these instructions in little-endian mode.
22185
22186 -mupdate
22187 -mno-update
22188 Generate code that uses (does not use) the load or store
22189 instructions that update the base register to the address of the
22190 calculated memory location. These instructions are generated by
22191 default. If you use -mno-update, there is a small window between
22192 the time that the stack pointer is updated and the address of the
22193 previous frame is stored, which means code that walks the stack
22194 frame across interrupts or signals may get corrupted data.
22195
22196 -mavoid-indexed-addresses
22197 -mno-avoid-indexed-addresses
22198 Generate code that tries to avoid (not avoid) the use of indexed
22199 load or store instructions. These instructions can incur a
22200 performance penalty on Power6 processors in certain situations,
22201 such as when stepping through large arrays that cross a 16M
22202 boundary. This option is enabled by default when targeting Power6
22203 and disabled otherwise.
22204
22205 -mfused-madd
22206 -mno-fused-madd
22207 Generate code that uses (does not use) the floating-point multiply
22208 and accumulate instructions. These instructions are generated by
22209 default if hardware floating point is used. The machine-dependent
22210 -mfused-madd option is now mapped to the machine-independent
22211 -ffp-contract=fast option, and -mno-fused-madd is mapped to
22212 -ffp-contract=off.
22213
22214 -mmulhw
22215 -mno-mulhw
22216 Generate code that uses (does not use) the half-word multiply and
22217 multiply-accumulate instructions on the IBM 405, 440, 464 and 476
22218 processors. These instructions are generated by default when
22219 targeting those processors.
22220
22221 -mdlmzb
22222 -mno-dlmzb
22223 Generate code that uses (does not use) the string-search dlmzb
22224 instruction on the IBM 405, 440, 464 and 476 processors. This
22225 instruction is generated by default when targeting those
22226 processors.
22227
22228 -mno-bit-align
22229 -mbit-align
22230 On System V.4 and embedded PowerPC systems do not (do) force
22231 structures and unions that contain bit-fields to be aligned to the
22232 base type of the bit-field.
22233
22234 For example, by default a structure containing nothing but 8
22235 "unsigned" bit-fields of length 1 is aligned to a 4-byte boundary
22236 and has a size of 4 bytes. By using -mno-bit-align, the structure
22237 is aligned to a 1-byte boundary and is 1 byte in size.
22238
22239 -mno-strict-align
22240 -mstrict-align
22241 On System V.4 and embedded PowerPC systems do not (do) assume that
22242 unaligned memory references are handled by the system.
22243
22244 -mrelocatable
22245 -mno-relocatable
22246 Generate code that allows (does not allow) a static executable to
22247 be relocated to a different address at run time. A simple embedded
22248 PowerPC system loader should relocate the entire contents of
22249 ".got2" and 4-byte locations listed in the ".fixup" section, a
22250 table of 32-bit addresses generated by this option. For this to
22251 work, all objects linked together must be compiled with
22252 -mrelocatable or -mrelocatable-lib. -mrelocatable code aligns the
22253 stack to an 8-byte boundary.
22254
22255 -mrelocatable-lib
22256 -mno-relocatable-lib
22257 Like -mrelocatable, -mrelocatable-lib generates a ".fixup" section
22258 to allow static executables to be relocated at run time, but
22259 -mrelocatable-lib does not use the smaller stack alignment of
22260 -mrelocatable. Objects compiled with -mrelocatable-lib may be
22261 linked with objects compiled with any combination of the
22262 -mrelocatable options.
22263
22264 -mno-toc
22265 -mtoc
22266 On System V.4 and embedded PowerPC systems do not (do) assume that
22267 register 2 contains a pointer to a global area pointing to the
22268 addresses used in the program.
22269
22270 -mlittle
22271 -mlittle-endian
22272 On System V.4 and embedded PowerPC systems compile code for the
22273 processor in little-endian mode. The -mlittle-endian option is the
22274 same as -mlittle.
22275
22276 -mbig
22277 -mbig-endian
22278 On System V.4 and embedded PowerPC systems compile code for the
22279 processor in big-endian mode. The -mbig-endian option is the same
22280 as -mbig.
22281
22282 -mdynamic-no-pic
22283 On Darwin and Mac OS X systems, compile code so that it is not
22284 relocatable, but that its external references are relocatable. The
22285 resulting code is suitable for applications, but not shared
22286 libraries.
22287
22288 -msingle-pic-base
22289 Treat the register used for PIC addressing as read-only, rather
22290 than loading it in the prologue for each function. The runtime
22291 system is responsible for initializing this register with an
22292 appropriate value before execution begins.
22293
22294 -mprioritize-restricted-insns=priority
22295 This option controls the priority that is assigned to dispatch-slot
22296 restricted instructions during the second scheduling pass. The
22297 argument priority takes the value 0, 1, or 2 to assign no, highest,
22298 or second-highest (respectively) priority to dispatch-slot
22299 restricted instructions.
22300
22301 -msched-costly-dep=dependence_type
22302 This option controls which dependences are considered costly by the
22303 target during instruction scheduling. The argument dependence_type
22304 takes one of the following values:
22305
22306 no No dependence is costly.
22307
22308 all All dependences are costly.
22309
22310 true_store_to_load
22311 A true dependence from store to load is costly.
22312
22313 store_to_load
22314 Any dependence from store to load is costly.
22315
22316 number
22317 Any dependence for which the latency is greater than or equal
22318 to number is costly.
22319
22320 -minsert-sched-nops=scheme
22321 This option controls which NOP insertion scheme is used during the
22322 second scheduling pass. The argument scheme takes one of the
22323 following values:
22324
22325 no Don't insert NOPs.
22326
22327 pad Pad with NOPs any dispatch group that has vacant issue slots,
22328 according to the scheduler's grouping.
22329
22330 regroup_exact
22331 Insert NOPs to force costly dependent insns into separate
22332 groups. Insert exactly as many NOPs as needed to force an insn
22333 to a new group, according to the estimated processor grouping.
22334
22335 number
22336 Insert NOPs to force costly dependent insns into separate
22337 groups. Insert number NOPs to force an insn to a new group.
22338
22339 -mcall-sysv
22340 On System V.4 and embedded PowerPC systems compile code using
22341 calling conventions that adhere to the March 1995 draft of the
22342 System V Application Binary Interface, PowerPC processor
22343 supplement. This is the default unless you configured GCC using
22344 powerpc-*-eabiaix.
22345
22346 -mcall-sysv-eabi
22347 -mcall-eabi
22348 Specify both -mcall-sysv and -meabi options.
22349
22350 -mcall-sysv-noeabi
22351 Specify both -mcall-sysv and -mno-eabi options.
22352
22353 -mcall-aixdesc
22354 On System V.4 and embedded PowerPC systems compile code for the AIX
22355 operating system.
22356
22357 -mcall-linux
22358 On System V.4 and embedded PowerPC systems compile code for the
22359 Linux-based GNU system.
22360
22361 -mcall-freebsd
22362 On System V.4 and embedded PowerPC systems compile code for the
22363 FreeBSD operating system.
22364
22365 -mcall-netbsd
22366 On System V.4 and embedded PowerPC systems compile code for the
22367 NetBSD operating system.
22368
22369 -mcall-openbsd
22370 On System V.4 and embedded PowerPC systems compile code for the
22371 OpenBSD operating system.
22372
22373 -mtraceback=traceback_type
22374 Select the type of traceback table. Valid values for traceback_type
22375 are full, part, and no.
22376
22377 -maix-struct-return
22378 Return all structures in memory (as specified by the AIX ABI).
22379
22380 -msvr4-struct-return
22381 Return structures smaller than 8 bytes in registers (as specified
22382 by the SVR4 ABI).
22383
22384 -mabi=abi-type
22385 Extend the current ABI with a particular extension, or remove such
22386 extension. Valid values are altivec, no-altivec, ibmlongdouble,
22387 ieeelongdouble, elfv1, elfv2.
22388
22389 -mabi=ibmlongdouble
22390 Change the current ABI to use IBM extended-precision long double.
22391 This is not likely to work if your system defaults to using IEEE
22392 extended-precision long double. If you change the long double type
22393 from IEEE extended-precision, the compiler will issue a warning
22394 unless you use the -Wno-psabi option. Requires -mlong-double-128
22395 to be enabled.
22396
22397 -mabi=ieeelongdouble
22398 Change the current ABI to use IEEE extended-precision long double.
22399 This is not likely to work if your system defaults to using IBM
22400 extended-precision long double. If you change the long double type
22401 from IBM extended-precision, the compiler will issue a warning
22402 unless you use the -Wno-psabi option. Requires -mlong-double-128
22403 to be enabled.
22404
22405 -mabi=elfv1
22406 Change the current ABI to use the ELFv1 ABI. This is the default
22407 ABI for big-endian PowerPC 64-bit Linux. Overriding the default
22408 ABI requires special system support and is likely to fail in
22409 spectacular ways.
22410
22411 -mabi=elfv2
22412 Change the current ABI to use the ELFv2 ABI. This is the default
22413 ABI for little-endian PowerPC 64-bit Linux. Overriding the default
22414 ABI requires special system support and is likely to fail in
22415 spectacular ways.
22416
22417 -mgnu-attribute
22418 -mno-gnu-attribute
22419 Emit .gnu_attribute assembly directives to set tag/value pairs in a
22420 .gnu.attributes section that specify ABI variations in function
22421 parameters or return values.
22422
22423 -mprototype
22424 -mno-prototype
22425 On System V.4 and embedded PowerPC systems assume that all calls to
22426 variable argument functions are properly prototyped. Otherwise,
22427 the compiler must insert an instruction before every non-prototyped
22428 call to set or clear bit 6 of the condition code register ("CR") to
22429 indicate whether floating-point values are passed in the floating-
22430 point registers in case the function takes variable arguments.
22431 With -mprototype, only calls to prototyped variable argument
22432 functions set or clear the bit.
22433
22434 -msim
22435 On embedded PowerPC systems, assume that the startup module is
22436 called sim-crt0.o and that the standard C libraries are libsim.a
22437 and libc.a. This is the default for powerpc-*-eabisim
22438 configurations.
22439
22440 -mmvme
22441 On embedded PowerPC systems, assume that the startup module is
22442 called crt0.o and the standard C libraries are libmvme.a and
22443 libc.a.
22444
22445 -mads
22446 On embedded PowerPC systems, assume that the startup module is
22447 called crt0.o and the standard C libraries are libads.a and libc.a.
22448
22449 -myellowknife
22450 On embedded PowerPC systems, assume that the startup module is
22451 called crt0.o and the standard C libraries are libyk.a and libc.a.
22452
22453 -mvxworks
22454 On System V.4 and embedded PowerPC systems, specify that you are
22455 compiling for a VxWorks system.
22456
22457 -memb
22458 On embedded PowerPC systems, set the "PPC_EMB" bit in the ELF flags
22459 header to indicate that eabi extended relocations are used.
22460
22461 -meabi
22462 -mno-eabi
22463 On System V.4 and embedded PowerPC systems do (do not) adhere to
22464 the Embedded Applications Binary Interface (EABI), which is a set
22465 of modifications to the System V.4 specifications. Selecting
22466 -meabi means that the stack is aligned to an 8-byte boundary, a
22467 function "__eabi" is called from "main" to set up the EABI
22468 environment, and the -msdata option can use both "r2" and "r13" to
22469 point to two separate small data areas. Selecting -mno-eabi means
22470 that the stack is aligned to a 16-byte boundary, no EABI
22471 initialization function is called from "main", and the -msdata
22472 option only uses "r13" to point to a single small data area. The
22473 -meabi option is on by default if you configured GCC using one of
22474 the powerpc*-*-eabi* options.
22475
22476 -msdata=eabi
22477 On System V.4 and embedded PowerPC systems, put small initialized
22478 "const" global and static data in the ".sdata2" section, which is
22479 pointed to by register "r2". Put small initialized non-"const"
22480 global and static data in the ".sdata" section, which is pointed to
22481 by register "r13". Put small uninitialized global and static data
22482 in the ".sbss" section, which is adjacent to the ".sdata" section.
22483 The -msdata=eabi option is incompatible with the -mrelocatable
22484 option. The -msdata=eabi option also sets the -memb option.
22485
22486 -msdata=sysv
22487 On System V.4 and embedded PowerPC systems, put small global and
22488 static data in the ".sdata" section, which is pointed to by
22489 register "r13". Put small uninitialized global and static data in
22490 the ".sbss" section, which is adjacent to the ".sdata" section.
22491 The -msdata=sysv option is incompatible with the -mrelocatable
22492 option.
22493
22494 -msdata=default
22495 -msdata
22496 On System V.4 and embedded PowerPC systems, if -meabi is used,
22497 compile code the same as -msdata=eabi, otherwise compile code the
22498 same as -msdata=sysv.
22499
22500 -msdata=data
22501 On System V.4 and embedded PowerPC systems, put small global data
22502 in the ".sdata" section. Put small uninitialized global data in
22503 the ".sbss" section. Do not use register "r13" to address small
22504 data however. This is the default behavior unless other -msdata
22505 options are used.
22506
22507 -msdata=none
22508 -mno-sdata
22509 On embedded PowerPC systems, put all initialized global and static
22510 data in the ".data" section, and all uninitialized data in the
22511 ".bss" section.
22512
22513 -mreadonly-in-sdata
22514 Put read-only objects in the ".sdata" section as well. This is the
22515 default.
22516
22517 -mblock-move-inline-limit=num
22518 Inline all block moves (such as calls to "memcpy" or structure
22519 copies) less than or equal to num bytes. The minimum value for num
22520 is 32 bytes on 32-bit targets and 64 bytes on 64-bit targets. The
22521 default value is target-specific.
22522
22523 -mblock-compare-inline-limit=num
22524 Generate non-looping inline code for all block compares (such as
22525 calls to "memcmp" or structure compares) less than or equal to num
22526 bytes. If num is 0, all inline expansion (non-loop and loop) of
22527 block compare is disabled. The default value is target-specific.
22528
22529 -mblock-compare-inline-loop-limit=num
22530 Generate an inline expansion using loop code for all block compares
22531 that are less than or equal to num bytes, but greater than the
22532 limit for non-loop inline block compare expansion. If the block
22533 length is not constant, at most num bytes will be compared before
22534 "memcmp" is called to compare the remainder of the block. The
22535 default value is target-specific.
22536
22537 -mstring-compare-inline-limit=num
22538 Compare at most num string bytes with inline code. If the
22539 difference or end of string is not found at the end of the inline
22540 compare a call to "strcmp" or "strncmp" will take care of the rest
22541 of the comparison. The default is 64 bytes.
22542
22543 -G num
22544 On embedded PowerPC systems, put global and static items less than
22545 or equal to num bytes into the small data or BSS sections instead
22546 of the normal data or BSS section. By default, num is 8. The -G
22547 num switch is also passed to the linker. All modules should be
22548 compiled with the same -G num value.
22549
22550 -mregnames
22551 -mno-regnames
22552 On System V.4 and embedded PowerPC systems do (do not) emit
22553 register names in the assembly language output using symbolic
22554 forms.
22555
22556 -mlongcall
22557 -mno-longcall
22558 By default assume that all calls are far away so that a longer and
22559 more expensive calling sequence is required. This is required for
22560 calls farther than 32 megabytes (33,554,432 bytes) from the current
22561 location. A short call is generated if the compiler knows the call
22562 cannot be that far away. This setting can be overridden by the
22563 "shortcall" function attribute, or by "#pragma longcall(0)".
22564
22565 Some linkers are capable of detecting out-of-range calls and
22566 generating glue code on the fly. On these systems, long calls are
22567 unnecessary and generate slower code. As of this writing, the AIX
22568 linker can do this, as can the GNU linker for PowerPC/64. It is
22569 planned to add this feature to the GNU linker for 32-bit PowerPC
22570 systems as well.
22571
22572 On PowerPC64 ELFv2 and 32-bit PowerPC systems with newer GNU
22573 linkers, GCC can generate long calls using an inline PLT call
22574 sequence (see -mpltseq). PowerPC with -mbss-plt and PowerPC64
22575 ELFv1 (big-endian) do not support inline PLT calls.
22576
22577 On Darwin/PPC systems, "#pragma longcall" generates "jbsr callee,
22578 L42", plus a branch island (glue code). The two target addresses
22579 represent the callee and the branch island. The Darwin/PPC linker
22580 prefers the first address and generates a "bl callee" if the PPC
22581 "bl" instruction reaches the callee directly; otherwise, the linker
22582 generates "bl L42" to call the branch island. The branch island is
22583 appended to the body of the calling function; it computes the full
22584 32-bit address of the callee and jumps to it.
22585
22586 On Mach-O (Darwin) systems, this option directs the compiler emit
22587 to the glue for every direct call, and the Darwin linker decides
22588 whether to use or discard it.
22589
22590 In the future, GCC may ignore all longcall specifications when the
22591 linker is known to generate glue.
22592
22593 -mpltseq
22594 -mno-pltseq
22595 Implement (do not implement) -fno-plt and long calls using an
22596 inline PLT call sequence that supports lazy linking and long calls
22597 to functions in dlopen'd shared libraries. Inline PLT calls are
22598 only supported on PowerPC64 ELFv2 and 32-bit PowerPC systems with
22599 newer GNU linkers, and are enabled by default if the support is
22600 detected when configuring GCC, and, in the case of 32-bit PowerPC,
22601 if GCC is configured with --enable-secureplt. -mpltseq code and
22602 -mbss-plt 32-bit PowerPC relocatable objects may not be linked
22603 together.
22604
22605 -mtls-markers
22606 -mno-tls-markers
22607 Mark (do not mark) calls to "__tls_get_addr" with a relocation
22608 specifying the function argument. The relocation allows the linker
22609 to reliably associate function call with argument setup
22610 instructions for TLS optimization, which in turn allows GCC to
22611 better schedule the sequence.
22612
22613 -mrecip
22614 -mno-recip
22615 This option enables use of the reciprocal estimate and reciprocal
22616 square root estimate instructions with additional Newton-Raphson
22617 steps to increase precision instead of doing a divide or square
22618 root and divide for floating-point arguments. You should use the
22619 -ffast-math option when using -mrecip (or at least
22620 -funsafe-math-optimizations, -ffinite-math-only, -freciprocal-math
22621 and -fno-trapping-math). Note that while the throughput of the
22622 sequence is generally higher than the throughput of the non-
22623 reciprocal instruction, the precision of the sequence can be
22624 decreased by up to 2 ulp (i.e. the inverse of 1.0 equals
22625 0.99999994) for reciprocal square roots.
22626
22627 -mrecip=opt
22628 This option controls which reciprocal estimate instructions may be
22629 used. opt is a comma-separated list of options, which may be
22630 preceded by a "!" to invert the option:
22631
22632 all Enable all estimate instructions.
22633
22634 default
22635 Enable the default instructions, equivalent to -mrecip.
22636
22637 none
22638 Disable all estimate instructions, equivalent to -mno-recip.
22639
22640 div Enable the reciprocal approximation instructions for both
22641 single and double precision.
22642
22643 divf
22644 Enable the single-precision reciprocal approximation
22645 instructions.
22646
22647 divd
22648 Enable the double-precision reciprocal approximation
22649 instructions.
22650
22651 rsqrt
22652 Enable the reciprocal square root approximation instructions
22653 for both single and double precision.
22654
22655 rsqrtf
22656 Enable the single-precision reciprocal square root
22657 approximation instructions.
22658
22659 rsqrtd
22660 Enable the double-precision reciprocal square root
22661 approximation instructions.
22662
22663 So, for example, -mrecip=all,!rsqrtd enables all of the reciprocal
22664 estimate instructions, except for the "FRSQRTE", "XSRSQRTEDP", and
22665 "XVRSQRTEDP" instructions which handle the double-precision
22666 reciprocal square root calculations.
22667
22668 -mrecip-precision
22669 -mno-recip-precision
22670 Assume (do not assume) that the reciprocal estimate instructions
22671 provide higher-precision estimates than is mandated by the PowerPC
22672 ABI. Selecting -mcpu=power6, -mcpu=power7 or -mcpu=power8
22673 automatically selects -mrecip-precision. The double-precision
22674 square root estimate instructions are not generated by default on
22675 low-precision machines, since they do not provide an estimate that
22676 converges after three steps.
22677
22678 -mveclibabi=type
22679 Specifies the ABI type to use for vectorizing intrinsics using an
22680 external library. The only type supported at present is mass,
22681 which specifies to use IBM's Mathematical Acceleration Subsystem
22682 (MASS) libraries for vectorizing intrinsics using external
22683 libraries. GCC currently emits calls to "acosd2", "acosf4",
22684 "acoshd2", "acoshf4", "asind2", "asinf4", "asinhd2", "asinhf4",
22685 "atan2d2", "atan2f4", "atand2", "atanf4", "atanhd2", "atanhf4",
22686 "cbrtd2", "cbrtf4", "cosd2", "cosf4", "coshd2", "coshf4", "erfcd2",
22687 "erfcf4", "erfd2", "erff4", "exp2d2", "exp2f4", "expd2", "expf4",
22688 "expm1d2", "expm1f4", "hypotd2", "hypotf4", "lgammad2", "lgammaf4",
22689 "log10d2", "log10f4", "log1pd2", "log1pf4", "log2d2", "log2f4",
22690 "logd2", "logf4", "powd2", "powf4", "sind2", "sinf4", "sinhd2",
22691 "sinhf4", "sqrtd2", "sqrtf4", "tand2", "tanf4", "tanhd2", and
22692 "tanhf4" when generating code for power7. Both -ftree-vectorize
22693 and -funsafe-math-optimizations must also be enabled. The MASS
22694 libraries must be specified at link time.
22695
22696 -mfriz
22697 -mno-friz
22698 Generate (do not generate) the "friz" instruction when the
22699 -funsafe-math-optimizations option is used to optimize rounding of
22700 floating-point values to 64-bit integer and back to floating point.
22701 The "friz" instruction does not return the same value if the
22702 floating-point number is too large to fit in an integer.
22703
22704 -mpointers-to-nested-functions
22705 -mno-pointers-to-nested-functions
22706 Generate (do not generate) code to load up the static chain
22707 register ("r11") when calling through a pointer on AIX and 64-bit
22708 Linux systems where a function pointer points to a 3-word
22709 descriptor giving the function address, TOC value to be loaded in
22710 register "r2", and static chain value to be loaded in register
22711 "r11". The -mpointers-to-nested-functions is on by default. You
22712 cannot call through pointers to nested functions or pointers to
22713 functions compiled in other languages that use the static chain if
22714 you use -mno-pointers-to-nested-functions.
22715
22716 -msave-toc-indirect
22717 -mno-save-toc-indirect
22718 Generate (do not generate) code to save the TOC value in the
22719 reserved stack location in the function prologue if the function
22720 calls through a pointer on AIX and 64-bit Linux systems. If the
22721 TOC value is not saved in the prologue, it is saved just before the
22722 call through the pointer. The -mno-save-toc-indirect option is the
22723 default.
22724
22725 -mcompat-align-parm
22726 -mno-compat-align-parm
22727 Generate (do not generate) code to pass structure parameters with a
22728 maximum alignment of 64 bits, for compatibility with older versions
22729 of GCC.
22730
22731 Older versions of GCC (prior to 4.9.0) incorrectly did not align a
22732 structure parameter on a 128-bit boundary when that structure
22733 contained a member requiring 128-bit alignment. This is corrected
22734 in more recent versions of GCC. This option may be used to
22735 generate code that is compatible with functions compiled with older
22736 versions of GCC.
22737
22738 The -mno-compat-align-parm option is the default.
22739
22740 -mstack-protector-guard=guard
22741 -mstack-protector-guard-reg=reg
22742 -mstack-protector-guard-offset=offset
22743 -mstack-protector-guard-symbol=symbol
22744 Generate stack protection code using canary at guard. Supported
22745 locations are global for global canary or tls for per-thread canary
22746 in the TLS block (the default with GNU libc version 2.4 or later).
22747
22748 With the latter choice the options -mstack-protector-guard-reg=reg
22749 and -mstack-protector-guard-offset=offset furthermore specify which
22750 register to use as base register for reading the canary, and from
22751 what offset from that base register. The default for those is as
22752 specified in the relevant ABI.
22753 -mstack-protector-guard-symbol=symbol overrides the offset with a
22754 symbol reference to a canary in the TLS block.
22755
22756 -mpcrel
22757 -mno-pcrel
22758 Generate (do not generate) pc-relative addressing when the option
22759 -mcpu=future is used. The -mpcrel option requires that the medium
22760 code model (-mcmodel=medium) and prefixed addressing (-mprefixed)
22761 options are enabled.
22762
22763 -mprefixed
22764 -mno-prefixed
22765 Generate (do not generate) addressing modes using prefixed load and
22766 store instructions when the option -mcpu=future is used.
22767
22768 -mmma
22769 -mno-mma
22770 Generate (do not generate) the MMA instructions when the option
22771 -mcpu=future is used.
22772
22773 RX Options
22774
22775 These command-line options are defined for RX targets:
22776
22777 -m64bit-doubles
22778 -m32bit-doubles
22779 Make the "double" data type be 64 bits (-m64bit-doubles) or 32 bits
22780 (-m32bit-doubles) in size. The default is -m32bit-doubles. Note
22781 RX floating-point hardware only works on 32-bit values, which is
22782 why the default is -m32bit-doubles.
22783
22784 -fpu
22785 -nofpu
22786 Enables (-fpu) or disables (-nofpu) the use of RX floating-point
22787 hardware. The default is enabled for the RX600 series and disabled
22788 for the RX200 series.
22789
22790 Floating-point instructions are only generated for 32-bit floating-
22791 point values, however, so the FPU hardware is not used for doubles
22792 if the -m64bit-doubles option is used.
22793
22794 Note If the -fpu option is enabled then -funsafe-math-optimizations
22795 is also enabled automatically. This is because the RX FPU
22796 instructions are themselves unsafe.
22797
22798 -mcpu=name
22799 Selects the type of RX CPU to be targeted. Currently three types
22800 are supported, the generic RX600 and RX200 series hardware and the
22801 specific RX610 CPU. The default is RX600.
22802
22803 The only difference between RX600 and RX610 is that the RX610 does
22804 not support the "MVTIPL" instruction.
22805
22806 The RX200 series does not have a hardware floating-point unit and
22807 so -nofpu is enabled by default when this type is selected.
22808
22809 -mbig-endian-data
22810 -mlittle-endian-data
22811 Store data (but not code) in the big-endian format. The default is
22812 -mlittle-endian-data, i.e. to store data in the little-endian
22813 format.
22814
22815 -msmall-data-limit=N
22816 Specifies the maximum size in bytes of global and static variables
22817 which can be placed into the small data area. Using the small data
22818 area can lead to smaller and faster code, but the size of area is
22819 limited and it is up to the programmer to ensure that the area does
22820 not overflow. Also when the small data area is used one of the
22821 RX's registers (usually "r13") is reserved for use pointing to this
22822 area, so it is no longer available for use by the compiler. This
22823 could result in slower and/or larger code if variables are pushed
22824 onto the stack instead of being held in this register.
22825
22826 Note, common variables (variables that have not been initialized)
22827 and constants are not placed into the small data area as they are
22828 assigned to other sections in the output executable.
22829
22830 The default value is zero, which disables this feature. Note, this
22831 feature is not enabled by default with higher optimization levels
22832 (-O2 etc) because of the potentially detrimental effects of
22833 reserving a register. It is up to the programmer to experiment and
22834 discover whether this feature is of benefit to their program. See
22835 the description of the -mpid option for a description of how the
22836 actual register to hold the small data area pointer is chosen.
22837
22838 -msim
22839 -mno-sim
22840 Use the simulator runtime. The default is to use the libgloss
22841 board-specific runtime.
22842
22843 -mas100-syntax
22844 -mno-as100-syntax
22845 When generating assembler output use a syntax that is compatible
22846 with Renesas's AS100 assembler. This syntax can also be handled by
22847 the GAS assembler, but it has some restrictions so it is not
22848 generated by default.
22849
22850 -mmax-constant-size=N
22851 Specifies the maximum size, in bytes, of a constant that can be
22852 used as an operand in a RX instruction. Although the RX
22853 instruction set does allow constants of up to 4 bytes in length to
22854 be used in instructions, a longer value equates to a longer
22855 instruction. Thus in some circumstances it can be beneficial to
22856 restrict the size of constants that are used in instructions.
22857 Constants that are too big are instead placed into a constant pool
22858 and referenced via register indirection.
22859
22860 The value N can be between 0 and 4. A value of 0 (the default) or
22861 4 means that constants of any size are allowed.
22862
22863 -mrelax
22864 Enable linker relaxation. Linker relaxation is a process whereby
22865 the linker attempts to reduce the size of a program by finding
22866 shorter versions of various instructions. Disabled by default.
22867
22868 -mint-register=N
22869 Specify the number of registers to reserve for fast interrupt
22870 handler functions. The value N can be between 0 and 4. A value of
22871 1 means that register "r13" is reserved for the exclusive use of
22872 fast interrupt handlers. A value of 2 reserves "r13" and "r12". A
22873 value of 3 reserves "r13", "r12" and "r11", and a value of 4
22874 reserves "r13" through "r10". A value of 0, the default, does not
22875 reserve any registers.
22876
22877 -msave-acc-in-interrupts
22878 Specifies that interrupt handler functions should preserve the
22879 accumulator register. This is only necessary if normal code might
22880 use the accumulator register, for example because it performs
22881 64-bit multiplications. The default is to ignore the accumulator
22882 as this makes the interrupt handlers faster.
22883
22884 -mpid
22885 -mno-pid
22886 Enables the generation of position independent data. When enabled
22887 any access to constant data is done via an offset from a base
22888 address held in a register. This allows the location of constant
22889 data to be determined at run time without requiring the executable
22890 to be relocated, which is a benefit to embedded applications with
22891 tight memory constraints. Data that can be modified is not
22892 affected by this option.
22893
22894 Note, using this feature reserves a register, usually "r13", for
22895 the constant data base address. This can result in slower and/or
22896 larger code, especially in complicated functions.
22897
22898 The actual register chosen to hold the constant data base address
22899 depends upon whether the -msmall-data-limit and/or the
22900 -mint-register command-line options are enabled. Starting with
22901 register "r13" and proceeding downwards, registers are allocated
22902 first to satisfy the requirements of -mint-register, then -mpid and
22903 finally -msmall-data-limit. Thus it is possible for the small data
22904 area register to be "r8" if both -mint-register=4 and -mpid are
22905 specified on the command line.
22906
22907 By default this feature is not enabled. The default can be
22908 restored via the -mno-pid command-line option.
22909
22910 -mno-warn-multiple-fast-interrupts
22911 -mwarn-multiple-fast-interrupts
22912 Prevents GCC from issuing a warning message if it finds more than
22913 one fast interrupt handler when it is compiling a file. The
22914 default is to issue a warning for each extra fast interrupt handler
22915 found, as the RX only supports one such interrupt.
22916
22917 -mallow-string-insns
22918 -mno-allow-string-insns
22919 Enables or disables the use of the string manipulation instructions
22920 "SMOVF", "SCMPU", "SMOVB", "SMOVU", "SUNTIL" "SWHILE" and also the
22921 "RMPA" instruction. These instructions may prefetch data, which is
22922 not safe to do if accessing an I/O register. (See section 12.2.7
22923 of the RX62N Group User's Manual for more information).
22924
22925 The default is to allow these instructions, but it is not possible
22926 for GCC to reliably detect all circumstances where a string
22927 instruction might be used to access an I/O register, so their use
22928 cannot be disabled automatically. Instead it is reliant upon the
22929 programmer to use the -mno-allow-string-insns option if their
22930 program accesses I/O space.
22931
22932 When the instructions are enabled GCC defines the C preprocessor
22933 symbol "__RX_ALLOW_STRING_INSNS__", otherwise it defines the symbol
22934 "__RX_DISALLOW_STRING_INSNS__".
22935
22936 -mjsr
22937 -mno-jsr
22938 Use only (or not only) "JSR" instructions to access functions.
22939 This option can be used when code size exceeds the range of "BSR"
22940 instructions. Note that -mno-jsr does not mean to not use "JSR"
22941 but instead means that any type of branch may be used.
22942
22943 Note: The generic GCC command-line option -ffixed-reg has special
22944 significance to the RX port when used with the "interrupt" function
22945 attribute. This attribute indicates a function intended to process
22946 fast interrupts. GCC ensures that it only uses the registers "r10",
22947 "r11", "r12" and/or "r13" and only provided that the normal use of the
22948 corresponding registers have been restricted via the -ffixed-reg or
22949 -mint-register command-line options.
22950
22951 S/390 and zSeries Options
22952
22953 These are the -m options defined for the S/390 and zSeries
22954 architecture.
22955
22956 -mhard-float
22957 -msoft-float
22958 Use (do not use) the hardware floating-point instructions and
22959 registers for floating-point operations. When -msoft-float is
22960 specified, functions in libgcc.a are used to perform floating-point
22961 operations. When -mhard-float is specified, the compiler generates
22962 IEEE floating-point instructions. This is the default.
22963
22964 -mhard-dfp
22965 -mno-hard-dfp
22966 Use (do not use) the hardware decimal-floating-point instructions
22967 for decimal-floating-point operations. When -mno-hard-dfp is
22968 specified, functions in libgcc.a are used to perform decimal-
22969 floating-point operations. When -mhard-dfp is specified, the
22970 compiler generates decimal-floating-point hardware instructions.
22971 This is the default for -march=z9-ec or higher.
22972
22973 -mlong-double-64
22974 -mlong-double-128
22975 These switches control the size of "long double" type. A size of 64
22976 bits makes the "long double" type equivalent to the "double" type.
22977 This is the default.
22978
22979 -mbackchain
22980 -mno-backchain
22981 Store (do not store) the address of the caller's frame as backchain
22982 pointer into the callee's stack frame. A backchain may be needed
22983 to allow debugging using tools that do not understand DWARF call
22984 frame information. When -mno-packed-stack is in effect, the
22985 backchain pointer is stored at the bottom of the stack frame; when
22986 -mpacked-stack is in effect, the backchain is placed into the
22987 topmost word of the 96/160 byte register save area.
22988
22989 In general, code compiled with -mbackchain is call-compatible with
22990 code compiled with -mmo-backchain; however, use of the backchain
22991 for debugging purposes usually requires that the whole binary is
22992 built with -mbackchain. Note that the combination of -mbackchain,
22993 -mpacked-stack and -mhard-float is not supported. In order to
22994 build a linux kernel use -msoft-float.
22995
22996 The default is to not maintain the backchain.
22997
22998 -mpacked-stack
22999 -mno-packed-stack
23000 Use (do not use) the packed stack layout. When -mno-packed-stack
23001 is specified, the compiler uses the all fields of the 96/160 byte
23002 register save area only for their default purpose; unused fields
23003 still take up stack space. When -mpacked-stack is specified,
23004 register save slots are densely packed at the top of the register
23005 save area; unused space is reused for other purposes, allowing for
23006 more efficient use of the available stack space. However, when
23007 -mbackchain is also in effect, the topmost word of the save area is
23008 always used to store the backchain, and the return address register
23009 is always saved two words below the backchain.
23010
23011 As long as the stack frame backchain is not used, code generated
23012 with -mpacked-stack is call-compatible with code generated with
23013 -mno-packed-stack. Note that some non-FSF releases of GCC 2.95 for
23014 S/390 or zSeries generated code that uses the stack frame backchain
23015 at run time, not just for debugging purposes. Such code is not
23016 call-compatible with code compiled with -mpacked-stack. Also, note
23017 that the combination of -mbackchain, -mpacked-stack and
23018 -mhard-float is not supported. In order to build a linux kernel
23019 use -msoft-float.
23020
23021 The default is to not use the packed stack layout.
23022
23023 -msmall-exec
23024 -mno-small-exec
23025 Generate (or do not generate) code using the "bras" instruction to
23026 do subroutine calls. This only works reliably if the total
23027 executable size does not exceed 64k. The default is to use the
23028 "basr" instruction instead, which does not have this limitation.
23029
23030 -m64
23031 -m31
23032 When -m31 is specified, generate code compliant to the GNU/Linux
23033 for S/390 ABI. When -m64 is specified, generate code compliant to
23034 the GNU/Linux for zSeries ABI. This allows GCC in particular to
23035 generate 64-bit instructions. For the s390 targets, the default is
23036 -m31, while the s390x targets default to -m64.
23037
23038 -mzarch
23039 -mesa
23040 When -mzarch is specified, generate code using the instructions
23041 available on z/Architecture. When -mesa is specified, generate
23042 code using the instructions available on ESA/390. Note that -mesa
23043 is not possible with -m64. When generating code compliant to the
23044 GNU/Linux for S/390 ABI, the default is -mesa. When generating
23045 code compliant to the GNU/Linux for zSeries ABI, the default is
23046 -mzarch.
23047
23048 -mhtm
23049 -mno-htm
23050 The -mhtm option enables a set of builtins making use of
23051 instructions available with the transactional execution facility
23052 introduced with the IBM zEnterprise EC12 machine generation S/390
23053 System z Built-in Functions. -mhtm is enabled by default when
23054 using -march=zEC12.
23055
23056 -mvx
23057 -mno-vx
23058 When -mvx is specified, generate code using the instructions
23059 available with the vector extension facility introduced with the
23060 IBM z13 machine generation. This option changes the ABI for some
23061 vector type values with regard to alignment and calling
23062 conventions. In case vector type values are being used in an ABI-
23063 relevant context a GAS .gnu_attribute command will be added to mark
23064 the resulting binary with the ABI used. -mvx is enabled by default
23065 when using -march=z13.
23066
23067 -mzvector
23068 -mno-zvector
23069 The -mzvector option enables vector language extensions and
23070 builtins using instructions available with the vector extension
23071 facility introduced with the IBM z13 machine generation. This
23072 option adds support for vector to be used as a keyword to define
23073 vector type variables and arguments. vector is only available when
23074 GNU extensions are enabled. It will not be expanded when
23075 requesting strict standard compliance e.g. with -std=c99. In
23076 addition to the GCC low-level builtins -mzvector enables a set of
23077 builtins added for compatibility with AltiVec-style implementations
23078 like Power and Cell. In order to make use of these builtins the
23079 header file vecintrin.h needs to be included. -mzvector is
23080 disabled by default.
23081
23082 -mmvcle
23083 -mno-mvcle
23084 Generate (or do not generate) code using the "mvcle" instruction to
23085 perform block moves. When -mno-mvcle is specified, use a "mvc"
23086 loop instead. This is the default unless optimizing for size.
23087
23088 -mdebug
23089 -mno-debug
23090 Print (or do not print) additional debug information when
23091 compiling. The default is to not print debug information.
23092
23093 -march=cpu-type
23094 Generate code that runs on cpu-type, which is the name of a system
23095 representing a certain processor type. Possible values for cpu-
23096 type are z900/arch5, z990/arch6, z9-109, z9-ec/arch7, z10/arch8,
23097 z196/arch9, zEC12, z13/arch11, z14/arch12, and native.
23098
23099 The default is -march=z900.
23100
23101 Specifying native as cpu type can be used to select the best
23102 architecture option for the host processor. -march=native has no
23103 effect if GCC does not recognize the processor.
23104
23105 -mtune=cpu-type
23106 Tune to cpu-type everything applicable about the generated code,
23107 except for the ABI and the set of available instructions. The list
23108 of cpu-type values is the same as for -march. The default is the
23109 value used for -march.
23110
23111 -mtpf-trace
23112 -mno-tpf-trace
23113 Generate code that adds (does not add) in TPF OS specific branches
23114 to trace routines in the operating system. This option is off by
23115 default, even when compiling for the TPF OS.
23116
23117 -mtpf-trace-skip
23118 -mno-tpf-trace-skip
23119 Generate code that changes (does not change) the default branch
23120 targets enabled by -mtpf-trace to point to specialized trace
23121 routines providing the ability of selectively skipping function
23122 trace entries for the TPF OS. This option is off by default, even
23123 when compiling for the TPF OS and specifying -mtpf-trace.
23124
23125 -mfused-madd
23126 -mno-fused-madd
23127 Generate code that uses (does not use) the floating-point multiply
23128 and accumulate instructions. These instructions are generated by
23129 default if hardware floating point is used.
23130
23131 -mwarn-framesize=framesize
23132 Emit a warning if the current function exceeds the given frame
23133 size. Because this is a compile-time check it doesn't need to be a
23134 real problem when the program runs. It is intended to identify
23135 functions that most probably cause a stack overflow. It is useful
23136 to be used in an environment with limited stack size e.g. the linux
23137 kernel.
23138
23139 -mwarn-dynamicstack
23140 Emit a warning if the function calls "alloca" or uses dynamically-
23141 sized arrays. This is generally a bad idea with a limited stack
23142 size.
23143
23144 -mstack-guard=stack-guard
23145 -mstack-size=stack-size
23146 If these options are provided the S/390 back end emits additional
23147 instructions in the function prologue that trigger a trap if the
23148 stack size is stack-guard bytes above the stack-size (remember that
23149 the stack on S/390 grows downward). If the stack-guard option is
23150 omitted the smallest power of 2 larger than the frame size of the
23151 compiled function is chosen. These options are intended to be used
23152 to help debugging stack overflow problems. The additionally
23153 emitted code causes only little overhead and hence can also be used
23154 in production-like systems without greater performance degradation.
23155 The given values have to be exact powers of 2 and stack-size has to
23156 be greater than stack-guard without exceeding 64k. In order to be
23157 efficient the extra code makes the assumption that the stack starts
23158 at an address aligned to the value given by stack-size. The stack-
23159 guard option can only be used in conjunction with stack-size.
23160
23161 -mhotpatch=pre-halfwords,post-halfwords
23162 If the hotpatch option is enabled, a "hot-patching" function
23163 prologue is generated for all functions in the compilation unit.
23164 The funtion label is prepended with the given number of two-byte
23165 NOP instructions (pre-halfwords, maximum 1000000). After the
23166 label, 2 * post-halfwords bytes are appended, using the largest NOP
23167 like instructions the architecture allows (maximum 1000000).
23168
23169 If both arguments are zero, hotpatching is disabled.
23170
23171 This option can be overridden for individual functions with the
23172 "hotpatch" attribute.
23173
23174 Score Options
23175
23176 These options are defined for Score implementations:
23177
23178 -meb
23179 Compile code for big-endian mode. This is the default.
23180
23181 -mel
23182 Compile code for little-endian mode.
23183
23184 -mnhwloop
23185 Disable generation of "bcnz" instructions.
23186
23187 -muls
23188 Enable generation of unaligned load and store instructions.
23189
23190 -mmac
23191 Enable the use of multiply-accumulate instructions. Disabled by
23192 default.
23193
23194 -mscore5
23195 Specify the SCORE5 as the target architecture.
23196
23197 -mscore5u
23198 Specify the SCORE5U of the target architecture.
23199
23200 -mscore7
23201 Specify the SCORE7 as the target architecture. This is the default.
23202
23203 -mscore7d
23204 Specify the SCORE7D as the target architecture.
23205
23206 SH Options
23207
23208 These -m options are defined for the SH implementations:
23209
23210 -m1 Generate code for the SH1.
23211
23212 -m2 Generate code for the SH2.
23213
23214 -m2e
23215 Generate code for the SH2e.
23216
23217 -m2a-nofpu
23218 Generate code for the SH2a without FPU, or for a SH2a-FPU in such a
23219 way that the floating-point unit is not used.
23220
23221 -m2a-single-only
23222 Generate code for the SH2a-FPU, in such a way that no double-
23223 precision floating-point operations are used.
23224
23225 -m2a-single
23226 Generate code for the SH2a-FPU assuming the floating-point unit is
23227 in single-precision mode by default.
23228
23229 -m2a
23230 Generate code for the SH2a-FPU assuming the floating-point unit is
23231 in double-precision mode by default.
23232
23233 -m3 Generate code for the SH3.
23234
23235 -m3e
23236 Generate code for the SH3e.
23237
23238 -m4-nofpu
23239 Generate code for the SH4 without a floating-point unit.
23240
23241 -m4-single-only
23242 Generate code for the SH4 with a floating-point unit that only
23243 supports single-precision arithmetic.
23244
23245 -m4-single
23246 Generate code for the SH4 assuming the floating-point unit is in
23247 single-precision mode by default.
23248
23249 -m4 Generate code for the SH4.
23250
23251 -m4-100
23252 Generate code for SH4-100.
23253
23254 -m4-100-nofpu
23255 Generate code for SH4-100 in such a way that the floating-point
23256 unit is not used.
23257
23258 -m4-100-single
23259 Generate code for SH4-100 assuming the floating-point unit is in
23260 single-precision mode by default.
23261
23262 -m4-100-single-only
23263 Generate code for SH4-100 in such a way that no double-precision
23264 floating-point operations are used.
23265
23266 -m4-200
23267 Generate code for SH4-200.
23268
23269 -m4-200-nofpu
23270 Generate code for SH4-200 without in such a way that the floating-
23271 point unit is not used.
23272
23273 -m4-200-single
23274 Generate code for SH4-200 assuming the floating-point unit is in
23275 single-precision mode by default.
23276
23277 -m4-200-single-only
23278 Generate code for SH4-200 in such a way that no double-precision
23279 floating-point operations are used.
23280
23281 -m4-300
23282 Generate code for SH4-300.
23283
23284 -m4-300-nofpu
23285 Generate code for SH4-300 without in such a way that the floating-
23286 point unit is not used.
23287
23288 -m4-300-single
23289 Generate code for SH4-300 in such a way that no double-precision
23290 floating-point operations are used.
23291
23292 -m4-300-single-only
23293 Generate code for SH4-300 in such a way that no double-precision
23294 floating-point operations are used.
23295
23296 -m4-340
23297 Generate code for SH4-340 (no MMU, no FPU).
23298
23299 -m4-500
23300 Generate code for SH4-500 (no FPU). Passes -isa=sh4-nofpu to the
23301 assembler.
23302
23303 -m4a-nofpu
23304 Generate code for the SH4al-dsp, or for a SH4a in such a way that
23305 the floating-point unit is not used.
23306
23307 -m4a-single-only
23308 Generate code for the SH4a, in such a way that no double-precision
23309 floating-point operations are used.
23310
23311 -m4a-single
23312 Generate code for the SH4a assuming the floating-point unit is in
23313 single-precision mode by default.
23314
23315 -m4a
23316 Generate code for the SH4a.
23317
23318 -m4al
23319 Same as -m4a-nofpu, except that it implicitly passes -dsp to the
23320 assembler. GCC doesn't generate any DSP instructions at the
23321 moment.
23322
23323 -mb Compile code for the processor in big-endian mode.
23324
23325 -ml Compile code for the processor in little-endian mode.
23326
23327 -mdalign
23328 Align doubles at 64-bit boundaries. Note that this changes the
23329 calling conventions, and thus some functions from the standard C
23330 library do not work unless you recompile it first with -mdalign.
23331
23332 -mrelax
23333 Shorten some address references at link time, when possible; uses
23334 the linker option -relax.
23335
23336 -mbigtable
23337 Use 32-bit offsets in "switch" tables. The default is to use
23338 16-bit offsets.
23339
23340 -mbitops
23341 Enable the use of bit manipulation instructions on SH2A.
23342
23343 -mfmovd
23344 Enable the use of the instruction "fmovd". Check -mdalign for
23345 alignment constraints.
23346
23347 -mrenesas
23348 Comply with the calling conventions defined by Renesas.
23349
23350 -mno-renesas
23351 Comply with the calling conventions defined for GCC before the
23352 Renesas conventions were available. This option is the default for
23353 all targets of the SH toolchain.
23354
23355 -mnomacsave
23356 Mark the "MAC" register as call-clobbered, even if -mrenesas is
23357 given.
23358
23359 -mieee
23360 -mno-ieee
23361 Control the IEEE compliance of floating-point comparisons, which
23362 affects the handling of cases where the result of a comparison is
23363 unordered. By default -mieee is implicitly enabled. If
23364 -ffinite-math-only is enabled -mno-ieee is implicitly set, which
23365 results in faster floating-point greater-equal and less-equal
23366 comparisons. The implicit settings can be overridden by specifying
23367 either -mieee or -mno-ieee.
23368
23369 -minline-ic_invalidate
23370 Inline code to invalidate instruction cache entries after setting
23371 up nested function trampolines. This option has no effect if
23372 -musermode is in effect and the selected code generation option
23373 (e.g. -m4) does not allow the use of the "icbi" instruction. If
23374 the selected code generation option does not allow the use of the
23375 "icbi" instruction, and -musermode is not in effect, the inlined
23376 code manipulates the instruction cache address array directly with
23377 an associative write. This not only requires privileged mode at
23378 run time, but it also fails if the cache line had been mapped via
23379 the TLB and has become unmapped.
23380
23381 -misize
23382 Dump instruction size and location in the assembly code.
23383
23384 -mpadstruct
23385 This option is deprecated. It pads structures to multiple of 4
23386 bytes, which is incompatible with the SH ABI.
23387
23388 -matomic-model=model
23389 Sets the model of atomic operations and additional parameters as a
23390 comma separated list. For details on the atomic built-in functions
23391 see __atomic Builtins. The following models and parameters are
23392 supported:
23393
23394 none
23395 Disable compiler generated atomic sequences and emit library
23396 calls for atomic operations. This is the default if the target
23397 is not "sh*-*-linux*".
23398
23399 soft-gusa
23400 Generate GNU/Linux compatible gUSA software atomic sequences
23401 for the atomic built-in functions. The generated atomic
23402 sequences require additional support from the
23403 interrupt/exception handling code of the system and are only
23404 suitable for SH3* and SH4* single-core systems. This option is
23405 enabled by default when the target is "sh*-*-linux*" and SH3*
23406 or SH4*. When the target is SH4A, this option also partially
23407 utilizes the hardware atomic instructions "movli.l" and
23408 "movco.l" to create more efficient code, unless strict is
23409 specified.
23410
23411 soft-tcb
23412 Generate software atomic sequences that use a variable in the
23413 thread control block. This is a variation of the gUSA
23414 sequences which can also be used on SH1* and SH2* targets. The
23415 generated atomic sequences require additional support from the
23416 interrupt/exception handling code of the system and are only
23417 suitable for single-core systems. When using this model, the
23418 gbr-offset= parameter has to be specified as well.
23419
23420 soft-imask
23421 Generate software atomic sequences that temporarily disable
23422 interrupts by setting "SR.IMASK = 1111". This model works only
23423 when the program runs in privileged mode and is only suitable
23424 for single-core systems. Additional support from the
23425 interrupt/exception handling code of the system is not
23426 required. This model is enabled by default when the target is
23427 "sh*-*-linux*" and SH1* or SH2*.
23428
23429 hard-llcs
23430 Generate hardware atomic sequences using the "movli.l" and
23431 "movco.l" instructions only. This is only available on SH4A
23432 and is suitable for multi-core systems. Since the hardware
23433 instructions support only 32 bit atomic variables access to 8
23434 or 16 bit variables is emulated with 32 bit accesses. Code
23435 compiled with this option is also compatible with other
23436 software atomic model interrupt/exception handling systems if
23437 executed on an SH4A system. Additional support from the
23438 interrupt/exception handling code of the system is not required
23439 for this model.
23440
23441 gbr-offset=
23442 This parameter specifies the offset in bytes of the variable in
23443 the thread control block structure that should be used by the
23444 generated atomic sequences when the soft-tcb model has been
23445 selected. For other models this parameter is ignored. The
23446 specified value must be an integer multiple of four and in the
23447 range 0-1020.
23448
23449 strict
23450 This parameter prevents mixed usage of multiple atomic models,
23451 even if they are compatible, and makes the compiler generate
23452 atomic sequences of the specified model only.
23453
23454 -mtas
23455 Generate the "tas.b" opcode for "__atomic_test_and_set". Notice
23456 that depending on the particular hardware and software
23457 configuration this can degrade overall performance due to the
23458 operand cache line flushes that are implied by the "tas.b"
23459 instruction. On multi-core SH4A processors the "tas.b" instruction
23460 must be used with caution since it can result in data corruption
23461 for certain cache configurations.
23462
23463 -mprefergot
23464 When generating position-independent code, emit function calls
23465 using the Global Offset Table instead of the Procedure Linkage
23466 Table.
23467
23468 -musermode
23469 -mno-usermode
23470 Don't allow (allow) the compiler generating privileged mode code.
23471 Specifying -musermode also implies -mno-inline-ic_invalidate if the
23472 inlined code would not work in user mode. -musermode is the
23473 default when the target is "sh*-*-linux*". If the target is SH1*
23474 or SH2* -musermode has no effect, since there is no user mode.
23475
23476 -multcost=number
23477 Set the cost to assume for a multiply insn.
23478
23479 -mdiv=strategy
23480 Set the division strategy to be used for integer division
23481 operations. strategy can be one of:
23482
23483 call-div1
23484 Calls a library function that uses the single-step division
23485 instruction "div1" to perform the operation. Division by zero
23486 calculates an unspecified result and does not trap. This is
23487 the default except for SH4, SH2A and SHcompact.
23488
23489 call-fp
23490 Calls a library function that performs the operation in double
23491 precision floating point. Division by zero causes a floating-
23492 point exception. This is the default for SHcompact with FPU.
23493 Specifying this for targets that do not have a double precision
23494 FPU defaults to "call-div1".
23495
23496 call-table
23497 Calls a library function that uses a lookup table for small
23498 divisors and the "div1" instruction with case distinction for
23499 larger divisors. Division by zero calculates an unspecified
23500 result and does not trap. This is the default for SH4.
23501 Specifying this for targets that do not have dynamic shift
23502 instructions defaults to "call-div1".
23503
23504 When a division strategy has not been specified the default
23505 strategy is selected based on the current target. For SH2A the
23506 default strategy is to use the "divs" and "divu" instructions
23507 instead of library function calls.
23508
23509 -maccumulate-outgoing-args
23510 Reserve space once for outgoing arguments in the function prologue
23511 rather than around each call. Generally beneficial for performance
23512 and size. Also needed for unwinding to avoid changing the stack
23513 frame around conditional code.
23514
23515 -mdivsi3_libfunc=name
23516 Set the name of the library function used for 32-bit signed
23517 division to name. This only affects the name used in the call
23518 division strategies, and the compiler still expects the same sets
23519 of input/output/clobbered registers as if this option were not
23520 present.
23521
23522 -mfixed-range=register-range
23523 Generate code treating the given register range as fixed registers.
23524 A fixed register is one that the register allocator cannot use.
23525 This is useful when compiling kernel code. A register range is
23526 specified as two registers separated by a dash. Multiple register
23527 ranges can be specified separated by a comma.
23528
23529 -mbranch-cost=num
23530 Assume num to be the cost for a branch instruction. Higher numbers
23531 make the compiler try to generate more branch-free code if
23532 possible. If not specified the value is selected depending on the
23533 processor type that is being compiled for.
23534
23535 -mzdcbranch
23536 -mno-zdcbranch
23537 Assume (do not assume) that zero displacement conditional branch
23538 instructions "bt" and "bf" are fast. If -mzdcbranch is specified,
23539 the compiler prefers zero displacement branch code sequences. This
23540 is enabled by default when generating code for SH4 and SH4A. It
23541 can be explicitly disabled by specifying -mno-zdcbranch.
23542
23543 -mcbranch-force-delay-slot
23544 Force the usage of delay slots for conditional branches, which
23545 stuffs the delay slot with a "nop" if a suitable instruction cannot
23546 be found. By default this option is disabled. It can be enabled
23547 to work around hardware bugs as found in the original SH7055.
23548
23549 -mfused-madd
23550 -mno-fused-madd
23551 Generate code that uses (does not use) the floating-point multiply
23552 and accumulate instructions. These instructions are generated by
23553 default if hardware floating point is used. The machine-dependent
23554 -mfused-madd option is now mapped to the machine-independent
23555 -ffp-contract=fast option, and -mno-fused-madd is mapped to
23556 -ffp-contract=off.
23557
23558 -mfsca
23559 -mno-fsca
23560 Allow or disallow the compiler to emit the "fsca" instruction for
23561 sine and cosine approximations. The option -mfsca must be used in
23562 combination with -funsafe-math-optimizations. It is enabled by
23563 default when generating code for SH4A. Using -mno-fsca disables
23564 sine and cosine approximations even if -funsafe-math-optimizations
23565 is in effect.
23566
23567 -mfsrra
23568 -mno-fsrra
23569 Allow or disallow the compiler to emit the "fsrra" instruction for
23570 reciprocal square root approximations. The option -mfsrra must be
23571 used in combination with -funsafe-math-optimizations and
23572 -ffinite-math-only. It is enabled by default when generating code
23573 for SH4A. Using -mno-fsrra disables reciprocal square root
23574 approximations even if -funsafe-math-optimizations and
23575 -ffinite-math-only are in effect.
23576
23577 -mpretend-cmove
23578 Prefer zero-displacement conditional branches for conditional move
23579 instruction patterns. This can result in faster code on the SH4
23580 processor.
23581
23582 -mfdpic
23583 Generate code using the FDPIC ABI.
23584
23585 Solaris 2 Options
23586
23587 These -m options are supported on Solaris 2:
23588
23589 -mclear-hwcap
23590 -mclear-hwcap tells the compiler to remove the hardware
23591 capabilities generated by the Solaris assembler. This is only
23592 necessary when object files use ISA extensions not supported by the
23593 current machine, but check at runtime whether or not to use them.
23594
23595 -mimpure-text
23596 -mimpure-text, used in addition to -shared, tells the compiler to
23597 not pass -z text to the linker when linking a shared object. Using
23598 this option, you can link position-dependent code into a shared
23599 object.
23600
23601 -mimpure-text suppresses the "relocations remain against
23602 allocatable but non-writable sections" linker error message.
23603 However, the necessary relocations trigger copy-on-write, and the
23604 shared object is not actually shared across processes. Instead of
23605 using -mimpure-text, you should compile all source code with -fpic
23606 or -fPIC.
23607
23608 These switches are supported in addition to the above on Solaris 2:
23609
23610 -pthreads
23611 This is a synonym for -pthread.
23612
23613 SPARC Options
23614
23615 These -m options are supported on the SPARC:
23616
23617 -mno-app-regs
23618 -mapp-regs
23619 Specify -mapp-regs to generate output using the global registers 2
23620 through 4, which the SPARC SVR4 ABI reserves for applications.
23621 Like the global register 1, each global register 2 through 4 is
23622 then treated as an allocable register that is clobbered by function
23623 calls. This is the default.
23624
23625 To be fully SVR4 ABI-compliant at the cost of some performance
23626 loss, specify -mno-app-regs. You should compile libraries and
23627 system software with this option.
23628
23629 -mflat
23630 -mno-flat
23631 With -mflat, the compiler does not generate save/restore
23632 instructions and uses a "flat" or single register window model.
23633 This model is compatible with the regular register window model.
23634 The local registers and the input registers (0--5) are still
23635 treated as "call-saved" registers and are saved on the stack as
23636 needed.
23637
23638 With -mno-flat (the default), the compiler generates save/restore
23639 instructions (except for leaf functions). This is the normal
23640 operating mode.
23641
23642 -mfpu
23643 -mhard-float
23644 Generate output containing floating-point instructions. This is
23645 the default.
23646
23647 -mno-fpu
23648 -msoft-float
23649 Generate output containing library calls for floating point.
23650 Warning: the requisite libraries are not available for all SPARC
23651 targets. Normally the facilities of the machine's usual C compiler
23652 are used, but this cannot be done directly in cross-compilation.
23653 You must make your own arrangements to provide suitable library
23654 functions for cross-compilation. The embedded targets sparc-*-aout
23655 and sparclite-*-* do provide software floating-point support.
23656
23657 -msoft-float changes the calling convention in the output file;
23658 therefore, it is only useful if you compile all of a program with
23659 this option. In particular, you need to compile libgcc.a, the
23660 library that comes with GCC, with -msoft-float in order for this to
23661 work.
23662
23663 -mhard-quad-float
23664 Generate output containing quad-word (long double) floating-point
23665 instructions.
23666
23667 -msoft-quad-float
23668 Generate output containing library calls for quad-word (long
23669 double) floating-point instructions. The functions called are
23670 those specified in the SPARC ABI. This is the default.
23671
23672 As of this writing, there are no SPARC implementations that have
23673 hardware support for the quad-word floating-point instructions.
23674 They all invoke a trap handler for one of these instructions, and
23675 then the trap handler emulates the effect of the instruction.
23676 Because of the trap handler overhead, this is much slower than
23677 calling the ABI library routines. Thus the -msoft-quad-float
23678 option is the default.
23679
23680 -mno-unaligned-doubles
23681 -munaligned-doubles
23682 Assume that doubles have 8-byte alignment. This is the default.
23683
23684 With -munaligned-doubles, GCC assumes that doubles have 8-byte
23685 alignment only if they are contained in another type, or if they
23686 have an absolute address. Otherwise, it assumes they have 4-byte
23687 alignment. Specifying this option avoids some rare compatibility
23688 problems with code generated by other compilers. It is not the
23689 default because it results in a performance loss, especially for
23690 floating-point code.
23691
23692 -muser-mode
23693 -mno-user-mode
23694 Do not generate code that can only run in supervisor mode. This is
23695 relevant only for the "casa" instruction emitted for the LEON3
23696 processor. This is the default.
23697
23698 -mfaster-structs
23699 -mno-faster-structs
23700 With -mfaster-structs, the compiler assumes that structures should
23701 have 8-byte alignment. This enables the use of pairs of "ldd" and
23702 "std" instructions for copies in structure assignment, in place of
23703 twice as many "ld" and "st" pairs. However, the use of this
23704 changed alignment directly violates the SPARC ABI. Thus, it's
23705 intended only for use on targets where the developer acknowledges
23706 that their resulting code is not directly in line with the rules of
23707 the ABI.
23708
23709 -mstd-struct-return
23710 -mno-std-struct-return
23711 With -mstd-struct-return, the compiler generates checking code in
23712 functions returning structures or unions to detect size mismatches
23713 between the two sides of function calls, as per the 32-bit ABI.
23714
23715 The default is -mno-std-struct-return. This option has no effect
23716 in 64-bit mode.
23717
23718 -mlra
23719 -mno-lra
23720 Enable Local Register Allocation. This is the default for SPARC
23721 since GCC 7 so -mno-lra needs to be passed to get old Reload.
23722
23723 -mcpu=cpu_type
23724 Set the instruction set, register set, and instruction scheduling
23725 parameters for machine type cpu_type. Supported values for
23726 cpu_type are v7, cypress, v8, supersparc, hypersparc, leon, leon3,
23727 leon3v7, sparclite, f930, f934, sparclite86x, sparclet, tsc701, v9,
23728 ultrasparc, ultrasparc3, niagara, niagara2, niagara3, niagara4,
23729 niagara7 and m8.
23730
23731 Native Solaris and GNU/Linux toolchains also support the value
23732 native, which selects the best architecture option for the host
23733 processor. -mcpu=native has no effect if GCC does not recognize
23734 the processor.
23735
23736 Default instruction scheduling parameters are used for values that
23737 select an architecture and not an implementation. These are v7,
23738 v8, sparclite, sparclet, v9.
23739
23740 Here is a list of each supported architecture and their supported
23741 implementations.
23742
23743 v7 cypress, leon3v7
23744
23745 v8 supersparc, hypersparc, leon, leon3
23746
23747 sparclite
23748 f930, f934, sparclite86x
23749
23750 sparclet
23751 tsc701
23752
23753 v9 ultrasparc, ultrasparc3, niagara, niagara2, niagara3, niagara4,
23754 niagara7, m8
23755
23756 By default (unless configured otherwise), GCC generates code for
23757 the V7 variant of the SPARC architecture. With -mcpu=cypress, the
23758 compiler additionally optimizes it for the Cypress CY7C602 chip, as
23759 used in the SPARCStation/SPARCServer 3xx series. This is also
23760 appropriate for the older SPARCStation 1, 2, IPX etc.
23761
23762 With -mcpu=v8, GCC generates code for the V8 variant of the SPARC
23763 architecture. The only difference from V7 code is that the
23764 compiler emits the integer multiply and integer divide instructions
23765 which exist in SPARC-V8 but not in SPARC-V7. With
23766 -mcpu=supersparc, the compiler additionally optimizes it for the
23767 SuperSPARC chip, as used in the SPARCStation 10, 1000 and 2000
23768 series.
23769
23770 With -mcpu=sparclite, GCC generates code for the SPARClite variant
23771 of the SPARC architecture. This adds the integer multiply, integer
23772 divide step and scan ("ffs") instructions which exist in SPARClite
23773 but not in SPARC-V7. With -mcpu=f930, the compiler additionally
23774 optimizes it for the Fujitsu MB86930 chip, which is the original
23775 SPARClite, with no FPU. With -mcpu=f934, the compiler additionally
23776 optimizes it for the Fujitsu MB86934 chip, which is the more recent
23777 SPARClite with FPU.
23778
23779 With -mcpu=sparclet, GCC generates code for the SPARClet variant of
23780 the SPARC architecture. This adds the integer multiply,
23781 multiply/accumulate, integer divide step and scan ("ffs")
23782 instructions which exist in SPARClet but not in SPARC-V7. With
23783 -mcpu=tsc701, the compiler additionally optimizes it for the TEMIC
23784 SPARClet chip.
23785
23786 With -mcpu=v9, GCC generates code for the V9 variant of the SPARC
23787 architecture. This adds 64-bit integer and floating-point move
23788 instructions, 3 additional floating-point condition code registers
23789 and conditional move instructions. With -mcpu=ultrasparc, the
23790 compiler additionally optimizes it for the Sun UltraSPARC I/II/IIi
23791 chips. With -mcpu=ultrasparc3, the compiler additionally optimizes
23792 it for the Sun UltraSPARC III/III+/IIIi/IIIi+/IV/IV+ chips. With
23793 -mcpu=niagara, the compiler additionally optimizes it for Sun
23794 UltraSPARC T1 chips. With -mcpu=niagara2, the compiler
23795 additionally optimizes it for Sun UltraSPARC T2 chips. With
23796 -mcpu=niagara3, the compiler additionally optimizes it for Sun
23797 UltraSPARC T3 chips. With -mcpu=niagara4, the compiler
23798 additionally optimizes it for Sun UltraSPARC T4 chips. With
23799 -mcpu=niagara7, the compiler additionally optimizes it for Oracle
23800 SPARC M7 chips. With -mcpu=m8, the compiler additionally optimizes
23801 it for Oracle M8 chips.
23802
23803 -mtune=cpu_type
23804 Set the instruction scheduling parameters for machine type
23805 cpu_type, but do not set the instruction set or register set that
23806 the option -mcpu=cpu_type does.
23807
23808 The same values for -mcpu=cpu_type can be used for -mtune=cpu_type,
23809 but the only useful values are those that select a particular CPU
23810 implementation. Those are cypress, supersparc, hypersparc, leon,
23811 leon3, leon3v7, f930, f934, sparclite86x, tsc701, ultrasparc,
23812 ultrasparc3, niagara, niagara2, niagara3, niagara4, niagara7 and
23813 m8. With native Solaris and GNU/Linux toolchains, native can also
23814 be used.
23815
23816 -mv8plus
23817 -mno-v8plus
23818 With -mv8plus, GCC generates code for the SPARC-V8+ ABI. The
23819 difference from the V8 ABI is that the global and out registers are
23820 considered 64 bits wide. This is enabled by default on Solaris in
23821 32-bit mode for all SPARC-V9 processors.
23822
23823 -mvis
23824 -mno-vis
23825 With -mvis, GCC generates code that takes advantage of the
23826 UltraSPARC Visual Instruction Set extensions. The default is
23827 -mno-vis.
23828
23829 -mvis2
23830 -mno-vis2
23831 With -mvis2, GCC generates code that takes advantage of version 2.0
23832 of the UltraSPARC Visual Instruction Set extensions. The default
23833 is -mvis2 when targeting a cpu that supports such instructions,
23834 such as UltraSPARC-III and later. Setting -mvis2 also sets -mvis.
23835
23836 -mvis3
23837 -mno-vis3
23838 With -mvis3, GCC generates code that takes advantage of version 3.0
23839 of the UltraSPARC Visual Instruction Set extensions. The default
23840 is -mvis3 when targeting a cpu that supports such instructions,
23841 such as niagara-3 and later. Setting -mvis3 also sets -mvis2 and
23842 -mvis.
23843
23844 -mvis4
23845 -mno-vis4
23846 With -mvis4, GCC generates code that takes advantage of version 4.0
23847 of the UltraSPARC Visual Instruction Set extensions. The default
23848 is -mvis4 when targeting a cpu that supports such instructions,
23849 such as niagara-7 and later. Setting -mvis4 also sets -mvis3,
23850 -mvis2 and -mvis.
23851
23852 -mvis4b
23853 -mno-vis4b
23854 With -mvis4b, GCC generates code that takes advantage of version
23855 4.0 of the UltraSPARC Visual Instruction Set extensions, plus the
23856 additional VIS instructions introduced in the Oracle SPARC
23857 Architecture 2017. The default is -mvis4b when targeting a cpu
23858 that supports such instructions, such as m8 and later. Setting
23859 -mvis4b also sets -mvis4, -mvis3, -mvis2 and -mvis.
23860
23861 -mcbcond
23862 -mno-cbcond
23863 With -mcbcond, GCC generates code that takes advantage of the
23864 UltraSPARC Compare-and-Branch-on-Condition instructions. The
23865 default is -mcbcond when targeting a CPU that supports such
23866 instructions, such as Niagara-4 and later.
23867
23868 -mfmaf
23869 -mno-fmaf
23870 With -mfmaf, GCC generates code that takes advantage of the
23871 UltraSPARC Fused Multiply-Add Floating-point instructions. The
23872 default is -mfmaf when targeting a CPU that supports such
23873 instructions, such as Niagara-3 and later.
23874
23875 -mfsmuld
23876 -mno-fsmuld
23877 With -mfsmuld, GCC generates code that takes advantage of the
23878 Floating-point Multiply Single to Double (FsMULd) instruction. The
23879 default is -mfsmuld when targeting a CPU supporting the
23880 architecture versions V8 or V9 with FPU except -mcpu=leon.
23881
23882 -mpopc
23883 -mno-popc
23884 With -mpopc, GCC generates code that takes advantage of the
23885 UltraSPARC Population Count instruction. The default is -mpopc
23886 when targeting a CPU that supports such an instruction, such as
23887 Niagara-2 and later.
23888
23889 -msubxc
23890 -mno-subxc
23891 With -msubxc, GCC generates code that takes advantage of the
23892 UltraSPARC Subtract-Extended-with-Carry instruction. The default
23893 is -msubxc when targeting a CPU that supports such an instruction,
23894 such as Niagara-7 and later.
23895
23896 -mfix-at697f
23897 Enable the documented workaround for the single erratum of the
23898 Atmel AT697F processor (which corresponds to erratum #13 of the
23899 AT697E processor).
23900
23901 -mfix-ut699
23902 Enable the documented workarounds for the floating-point errata and
23903 the data cache nullify errata of the UT699 processor.
23904
23905 -mfix-ut700
23906 Enable the documented workaround for the back-to-back store errata
23907 of the UT699E/UT700 processor.
23908
23909 -mfix-gr712rc
23910 Enable the documented workaround for the back-to-back store errata
23911 of the GR712RC processor.
23912
23913 These -m options are supported in addition to the above on SPARC-V9
23914 processors in 64-bit environments:
23915
23916 -m32
23917 -m64
23918 Generate code for a 32-bit or 64-bit environment. The 32-bit
23919 environment sets int, long and pointer to 32 bits. The 64-bit
23920 environment sets int to 32 bits and long and pointer to 64 bits.
23921
23922 -mcmodel=which
23923 Set the code model to one of
23924
23925 medlow
23926 The Medium/Low code model: 64-bit addresses, programs must be
23927 linked in the low 32 bits of memory. Programs can be
23928 statically or dynamically linked.
23929
23930 medmid
23931 The Medium/Middle code model: 64-bit addresses, programs must
23932 be linked in the low 44 bits of memory, the text and data
23933 segments must be less than 2GB in size and the data segment
23934 must be located within 2GB of the text segment.
23935
23936 medany
23937 The Medium/Anywhere code model: 64-bit addresses, programs may
23938 be linked anywhere in memory, the text and data segments must
23939 be less than 2GB in size and the data segment must be located
23940 within 2GB of the text segment.
23941
23942 embmedany
23943 The Medium/Anywhere code model for embedded systems: 64-bit
23944 addresses, the text and data segments must be less than 2GB in
23945 size, both starting anywhere in memory (determined at link
23946 time). The global register %g4 points to the base of the data
23947 segment. Programs are statically linked and PIC is not
23948 supported.
23949
23950 -mmemory-model=mem-model
23951 Set the memory model in force on the processor to one of
23952
23953 default
23954 The default memory model for the processor and operating
23955 system.
23956
23957 rmo Relaxed Memory Order
23958
23959 pso Partial Store Order
23960
23961 tso Total Store Order
23962
23963 sc Sequential Consistency
23964
23965 These memory models are formally defined in Appendix D of the
23966 SPARC-V9 architecture manual, as set in the processor's "PSTATE.MM"
23967 field.
23968
23969 -mstack-bias
23970 -mno-stack-bias
23971 With -mstack-bias, GCC assumes that the stack pointer, and frame
23972 pointer if present, are offset by -2047 which must be added back
23973 when making stack frame references. This is the default in 64-bit
23974 mode. Otherwise, assume no such offset is present.
23975
23976 Options for System V
23977
23978 These additional options are available on System V Release 4 for
23979 compatibility with other compilers on those systems:
23980
23981 -G Create a shared object. It is recommended that -symbolic or
23982 -shared be used instead.
23983
23984 -Qy Identify the versions of each tool used by the compiler, in a
23985 ".ident" assembler directive in the output.
23986
23987 -Qn Refrain from adding ".ident" directives to the output file (this is
23988 the default).
23989
23990 -YP,dirs
23991 Search the directories dirs, and no others, for libraries specified
23992 with -l.
23993
23994 -Ym,dir
23995 Look in the directory dir to find the M4 preprocessor. The
23996 assembler uses this option.
23997
23998 TILE-Gx Options
23999
24000 These -m options are supported on the TILE-Gx:
24001
24002 -mcmodel=small
24003 Generate code for the small model. The distance for direct calls
24004 is limited to 500M in either direction. PC-relative addresses are
24005 32 bits. Absolute addresses support the full address range.
24006
24007 -mcmodel=large
24008 Generate code for the large model. There is no limitation on call
24009 distance, pc-relative addresses, or absolute addresses.
24010
24011 -mcpu=name
24012 Selects the type of CPU to be targeted. Currently the only
24013 supported type is tilegx.
24014
24015 -m32
24016 -m64
24017 Generate code for a 32-bit or 64-bit environment. The 32-bit
24018 environment sets int, long, and pointer to 32 bits. The 64-bit
24019 environment sets int to 32 bits and long and pointer to 64 bits.
24020
24021 -mbig-endian
24022 -mlittle-endian
24023 Generate code in big/little endian mode, respectively.
24024
24025 TILEPro Options
24026
24027 These -m options are supported on the TILEPro:
24028
24029 -mcpu=name
24030 Selects the type of CPU to be targeted. Currently the only
24031 supported type is tilepro.
24032
24033 -m32
24034 Generate code for a 32-bit environment, which sets int, long, and
24035 pointer to 32 bits. This is the only supported behavior so the
24036 flag is essentially ignored.
24037
24038 V850 Options
24039
24040 These -m options are defined for V850 implementations:
24041
24042 -mlong-calls
24043 -mno-long-calls
24044 Treat all calls as being far away (near). If calls are assumed to
24045 be far away, the compiler always loads the function's address into
24046 a register, and calls indirect through the pointer.
24047
24048 -mno-ep
24049 -mep
24050 Do not optimize (do optimize) basic blocks that use the same index
24051 pointer 4 or more times to copy pointer into the "ep" register, and
24052 use the shorter "sld" and "sst" instructions. The -mep option is
24053 on by default if you optimize.
24054
24055 -mno-prolog-function
24056 -mprolog-function
24057 Do not use (do use) external functions to save and restore
24058 registers at the prologue and epilogue of a function. The external
24059 functions are slower, but use less code space if more than one
24060 function saves the same number of registers. The -mprolog-function
24061 option is on by default if you optimize.
24062
24063 -mspace
24064 Try to make the code as small as possible. At present, this just
24065 turns on the -mep and -mprolog-function options.
24066
24067 -mtda=n
24068 Put static or global variables whose size is n bytes or less into
24069 the tiny data area that register "ep" points to. The tiny data
24070 area can hold up to 256 bytes in total (128 bytes for byte
24071 references).
24072
24073 -msda=n
24074 Put static or global variables whose size is n bytes or less into
24075 the small data area that register "gp" points to. The small data
24076 area can hold up to 64 kilobytes.
24077
24078 -mzda=n
24079 Put static or global variables whose size is n bytes or less into
24080 the first 32 kilobytes of memory.
24081
24082 -mv850
24083 Specify that the target processor is the V850.
24084
24085 -mv850e3v5
24086 Specify that the target processor is the V850E3V5. The
24087 preprocessor constant "__v850e3v5__" is defined if this option is
24088 used.
24089
24090 -mv850e2v4
24091 Specify that the target processor is the V850E3V5. This is an
24092 alias for the -mv850e3v5 option.
24093
24094 -mv850e2v3
24095 Specify that the target processor is the V850E2V3. The
24096 preprocessor constant "__v850e2v3__" is defined if this option is
24097 used.
24098
24099 -mv850e2
24100 Specify that the target processor is the V850E2. The preprocessor
24101 constant "__v850e2__" is defined if this option is used.
24102
24103 -mv850e1
24104 Specify that the target processor is the V850E1. The preprocessor
24105 constants "__v850e1__" and "__v850e__" are defined if this option
24106 is used.
24107
24108 -mv850es
24109 Specify that the target processor is the V850ES. This is an alias
24110 for the -mv850e1 option.
24111
24112 -mv850e
24113 Specify that the target processor is the V850E. The preprocessor
24114 constant "__v850e__" is defined if this option is used.
24115
24116 If neither -mv850 nor -mv850e nor -mv850e1 nor -mv850e2 nor
24117 -mv850e2v3 nor -mv850e3v5 are defined then a default target
24118 processor is chosen and the relevant __v850*__ preprocessor
24119 constant is defined.
24120
24121 The preprocessor constants "__v850" and "__v851__" are always
24122 defined, regardless of which processor variant is the target.
24123
24124 -mdisable-callt
24125 -mno-disable-callt
24126 This option suppresses generation of the "CALLT" instruction for
24127 the v850e, v850e1, v850e2, v850e2v3 and v850e3v5 flavors of the
24128 v850 architecture.
24129
24130 This option is enabled by default when the RH850 ABI is in use (see
24131 -mrh850-abi), and disabled by default when the GCC ABI is in use.
24132 If "CALLT" instructions are being generated then the C preprocessor
24133 symbol "__V850_CALLT__" is defined.
24134
24135 -mrelax
24136 -mno-relax
24137 Pass on (or do not pass on) the -mrelax command-line option to the
24138 assembler.
24139
24140 -mlong-jumps
24141 -mno-long-jumps
24142 Disable (or re-enable) the generation of PC-relative jump
24143 instructions.
24144
24145 -msoft-float
24146 -mhard-float
24147 Disable (or re-enable) the generation of hardware floating point
24148 instructions. This option is only significant when the target
24149 architecture is V850E2V3 or higher. If hardware floating point
24150 instructions are being generated then the C preprocessor symbol
24151 "__FPU_OK__" is defined, otherwise the symbol "__NO_FPU__" is
24152 defined.
24153
24154 -mloop
24155 Enables the use of the e3v5 LOOP instruction. The use of this
24156 instruction is not enabled by default when the e3v5 architecture is
24157 selected because its use is still experimental.
24158
24159 -mrh850-abi
24160 -mghs
24161 Enables support for the RH850 version of the V850 ABI. This is the
24162 default. With this version of the ABI the following rules apply:
24163
24164 * Integer sized structures and unions are returned via a memory
24165 pointer rather than a register.
24166
24167 * Large structures and unions (more than 8 bytes in size) are
24168 passed by value.
24169
24170 * Functions are aligned to 16-bit boundaries.
24171
24172 * The -m8byte-align command-line option is supported.
24173
24174 * The -mdisable-callt command-line option is enabled by default.
24175 The -mno-disable-callt command-line option is not supported.
24176
24177 When this version of the ABI is enabled the C preprocessor symbol
24178 "__V850_RH850_ABI__" is defined.
24179
24180 -mgcc-abi
24181 Enables support for the old GCC version of the V850 ABI. With this
24182 version of the ABI the following rules apply:
24183
24184 * Integer sized structures and unions are returned in register
24185 "r10".
24186
24187 * Large structures and unions (more than 8 bytes in size) are
24188 passed by reference.
24189
24190 * Functions are aligned to 32-bit boundaries, unless optimizing
24191 for size.
24192
24193 * The -m8byte-align command-line option is not supported.
24194
24195 * The -mdisable-callt command-line option is supported but not
24196 enabled by default.
24197
24198 When this version of the ABI is enabled the C preprocessor symbol
24199 "__V850_GCC_ABI__" is defined.
24200
24201 -m8byte-align
24202 -mno-8byte-align
24203 Enables support for "double" and "long long" types to be aligned on
24204 8-byte boundaries. The default is to restrict the alignment of all
24205 objects to at most 4-bytes. When -m8byte-align is in effect the C
24206 preprocessor symbol "__V850_8BYTE_ALIGN__" is defined.
24207
24208 -mbig-switch
24209 Generate code suitable for big switch tables. Use this option only
24210 if the assembler/linker complain about out of range branches within
24211 a switch table.
24212
24213 -mapp-regs
24214 This option causes r2 and r5 to be used in the code generated by
24215 the compiler. This setting is the default.
24216
24217 -mno-app-regs
24218 This option causes r2 and r5 to be treated as fixed registers.
24219
24220 VAX Options
24221
24222 These -m options are defined for the VAX:
24223
24224 -munix
24225 Do not output certain jump instructions ("aobleq" and so on) that
24226 the Unix assembler for the VAX cannot handle across long ranges.
24227
24228 -mgnu
24229 Do output those jump instructions, on the assumption that the GNU
24230 assembler is being used.
24231
24232 -mg Output code for G-format floating-point numbers instead of
24233 D-format.
24234
24235 Visium Options
24236
24237 -mdebug
24238 A program which performs file I/O and is destined to run on an MCM
24239 target should be linked with this option. It causes the libraries
24240 libc.a and libdebug.a to be linked. The program should be run on
24241 the target under the control of the GDB remote debugging stub.
24242
24243 -msim
24244 A program which performs file I/O and is destined to run on the
24245 simulator should be linked with option. This causes libraries
24246 libc.a and libsim.a to be linked.
24247
24248 -mfpu
24249 -mhard-float
24250 Generate code containing floating-point instructions. This is the
24251 default.
24252
24253 -mno-fpu
24254 -msoft-float
24255 Generate code containing library calls for floating-point.
24256
24257 -msoft-float changes the calling convention in the output file;
24258 therefore, it is only useful if you compile all of a program with
24259 this option. In particular, you need to compile libgcc.a, the
24260 library that comes with GCC, with -msoft-float in order for this to
24261 work.
24262
24263 -mcpu=cpu_type
24264 Set the instruction set, register set, and instruction scheduling
24265 parameters for machine type cpu_type. Supported values for
24266 cpu_type are mcm, gr5 and gr6.
24267
24268 mcm is a synonym of gr5 present for backward compatibility.
24269
24270 By default (unless configured otherwise), GCC generates code for
24271 the GR5 variant of the Visium architecture.
24272
24273 With -mcpu=gr6, GCC generates code for the GR6 variant of the
24274 Visium architecture. The only difference from GR5 code is that the
24275 compiler will generate block move instructions.
24276
24277 -mtune=cpu_type
24278 Set the instruction scheduling parameters for machine type
24279 cpu_type, but do not set the instruction set or register set that
24280 the option -mcpu=cpu_type would.
24281
24282 -msv-mode
24283 Generate code for the supervisor mode, where there are no
24284 restrictions on the access to general registers. This is the
24285 default.
24286
24287 -muser-mode
24288 Generate code for the user mode, where the access to some general
24289 registers is forbidden: on the GR5, registers r24 to r31 cannot be
24290 accessed in this mode; on the GR6, only registers r29 to r31 are
24291 affected.
24292
24293 VMS Options
24294
24295 These -m options are defined for the VMS implementations:
24296
24297 -mvms-return-codes
24298 Return VMS condition codes from "main". The default is to return
24299 POSIX-style condition (e.g. error) codes.
24300
24301 -mdebug-main=prefix
24302 Flag the first routine whose name starts with prefix as the main
24303 routine for the debugger.
24304
24305 -mmalloc64
24306 Default to 64-bit memory allocation routines.
24307
24308 -mpointer-size=size
24309 Set the default size of pointers. Possible options for size are 32
24310 or short for 32 bit pointers, 64 or long for 64 bit pointers, and
24311 no for supporting only 32 bit pointers. The later option disables
24312 "pragma pointer_size".
24313
24314 VxWorks Options
24315
24316 The options in this section are defined for all VxWorks targets.
24317 Options specific to the target hardware are listed with the other
24318 options for that target.
24319
24320 -mrtp
24321 GCC can generate code for both VxWorks kernels and real time
24322 processes (RTPs). This option switches from the former to the
24323 latter. It also defines the preprocessor macro "__RTP__".
24324
24325 -non-static
24326 Link an RTP executable against shared libraries rather than static
24327 libraries. The options -static and -shared can also be used for
24328 RTPs; -static is the default.
24329
24330 -Bstatic
24331 -Bdynamic
24332 These options are passed down to the linker. They are defined for
24333 compatibility with Diab.
24334
24335 -Xbind-lazy
24336 Enable lazy binding of function calls. This option is equivalent
24337 to -Wl,-z,now and is defined for compatibility with Diab.
24338
24339 -Xbind-now
24340 Disable lazy binding of function calls. This option is the default
24341 and is defined for compatibility with Diab.
24342
24343 x86 Options
24344
24345 These -m options are defined for the x86 family of computers.
24346
24347 -march=cpu-type
24348 Generate instructions for the machine type cpu-type. In contrast
24349 to -mtune=cpu-type, which merely tunes the generated code for the
24350 specified cpu-type, -march=cpu-type allows GCC to generate code
24351 that may not run at all on processors other than the one indicated.
24352 Specifying -march=cpu-type implies -mtune=cpu-type.
24353
24354 The choices for cpu-type are:
24355
24356 native
24357 This selects the CPU to generate code for at compilation time
24358 by determining the processor type of the compiling machine.
24359 Using -march=native enables all instruction subsets supported
24360 by the local machine (hence the result might not run on
24361 different machines). Using -mtune=native produces code
24362 optimized for the local machine under the constraints of the
24363 selected instruction set.
24364
24365 x86-64
24366 A generic CPU with 64-bit extensions.
24367
24368 i386
24369 Original Intel i386 CPU.
24370
24371 i486
24372 Intel i486 CPU. (No scheduling is implemented for this chip.)
24373
24374 i586
24375 pentium
24376 Intel Pentium CPU with no MMX support.
24377
24378 lakemont
24379 Intel Lakemont MCU, based on Intel Pentium CPU.
24380
24381 pentium-mmx
24382 Intel Pentium MMX CPU, based on Pentium core with MMX
24383 instruction set support.
24384
24385 pentiumpro
24386 Intel Pentium Pro CPU.
24387
24388 i686
24389 When used with -march, the Pentium Pro instruction set is used,
24390 so the code runs on all i686 family chips. When used with
24391 -mtune, it has the same meaning as generic.
24392
24393 pentium2
24394 Intel Pentium II CPU, based on Pentium Pro core with MMX
24395 instruction set support.
24396
24397 pentium3
24398 pentium3m
24399 Intel Pentium III CPU, based on Pentium Pro core with MMX and
24400 SSE instruction set support.
24401
24402 pentium-m
24403 Intel Pentium M; low-power version of Intel Pentium III CPU
24404 with MMX, SSE and SSE2 instruction set support. Used by
24405 Centrino notebooks.
24406
24407 pentium4
24408 pentium4m
24409 Intel Pentium 4 CPU with MMX, SSE and SSE2 instruction set
24410 support.
24411
24412 prescott
24413 Improved version of Intel Pentium 4 CPU with MMX, SSE, SSE2 and
24414 SSE3 instruction set support.
24415
24416 nocona
24417 Improved version of Intel Pentium 4 CPU with 64-bit extensions,
24418 MMX, SSE, SSE2 and SSE3 instruction set support.
24419
24420 core2
24421 Intel Core 2 CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3
24422 and SSSE3 instruction set support.
24423
24424 nehalem
24425 Intel Nehalem CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3,
24426 SSSE3, SSE4.1, SSE4.2 and POPCNT instruction set support.
24427
24428 westmere
24429 Intel Westmere CPU with 64-bit extensions, MMX, SSE, SSE2,
24430 SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, AES and PCLMUL instruction
24431 set support.
24432
24433 sandybridge
24434 Intel Sandy Bridge CPU with 64-bit extensions, MMX, SSE, SSE2,
24435 SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, AVX, AES and PCLMUL
24436 instruction set support.
24437
24438 ivybridge
24439 Intel Ivy Bridge CPU with 64-bit extensions, MMX, SSE, SSE2,
24440 SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, AVX, AES, PCLMUL,
24441 FSGSBASE, RDRND and F16C instruction set support.
24442
24443 haswell
24444 Intel Haswell CPU with 64-bit extensions, MOVBE, MMX, SSE,
24445 SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES,
24446 PCLMUL, FSGSBASE, RDRND, FMA, BMI, BMI2 and F16C instruction
24447 set support.
24448
24449 broadwell
24450 Intel Broadwell CPU with 64-bit extensions, MOVBE, MMX, SSE,
24451 SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES,
24452 PCLMUL, FSGSBASE, RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX and
24453 PREFETCHW instruction set support.
24454
24455 skylake
24456 Intel Skylake CPU with 64-bit extensions, MOVBE, MMX, SSE,
24457 SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES,
24458 PCLMUL, FSGSBASE, RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX,
24459 PREFETCHW, CLFLUSHOPT, XSAVEC and XSAVES instruction set
24460 support.
24461
24462 bonnell
24463 Intel Bonnell CPU with 64-bit extensions, MOVBE, MMX, SSE,
24464 SSE2, SSE3 and SSSE3 instruction set support.
24465
24466 silvermont
24467 Intel Silvermont CPU with 64-bit extensions, MOVBE, MMX, SSE,
24468 SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, AES, PCLMUL and
24469 RDRND instruction set support.
24470
24471 goldmont
24472 Intel Goldmont CPU with 64-bit extensions, MOVBE, MMX, SSE,
24473 SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, AES, PCLMUL, RDRND,
24474 XSAVE, XSAVEOPT and FSGSBASE instruction set support.
24475
24476 goldmont-plus
24477 Intel Goldmont Plus CPU with 64-bit extensions, MOVBE, MMX,
24478 SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, AES, PCLMUL,
24479 RDRND, XSAVE, XSAVEOPT, FSGSBASE, PTWRITE, RDPID, SGX and UMIP
24480 instruction set support.
24481
24482 tremont
24483 Intel Tremont CPU with 64-bit extensions, MOVBE, MMX, SSE,
24484 SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, AES, PCLMUL, RDRND,
24485 XSAVE, XSAVEOPT, FSGSBASE, PTWRITE, RDPID, SGX, UMIP, GFNI-SSE,
24486 CLWB and ENCLV instruction set support.
24487
24488 knl Intel Knight's Landing CPU with 64-bit extensions, MOVBE, MMX,
24489 SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES,
24490 PCLMUL, FSGSBASE, RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX,
24491 PREFETCHW, AVX512F, AVX512PF, AVX512ER and AVX512CD instruction
24492 set support.
24493
24494 knm Intel Knights Mill CPU with 64-bit extensions, MOVBE, MMX, SSE,
24495 SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES,
24496 PCLMUL, FSGSBASE, RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX,
24497 PREFETCHW, AVX512F, AVX512PF, AVX512ER, AVX512CD, AVX5124VNNIW,
24498 AVX5124FMAPS and AVX512VPOPCNTDQ instruction set support.
24499
24500 skylake-avx512
24501 Intel Skylake Server CPU with 64-bit extensions, MOVBE, MMX,
24502 SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2,
24503 AES, PCLMUL, FSGSBASE, RDRND, FMA, BMI, BMI2, F16C, RDSEED,
24504 ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F, CLWB,
24505 AVX512VL, AVX512BW, AVX512DQ and AVX512CD instruction set
24506 support.
24507
24508 cannonlake
24509 Intel Cannonlake Server CPU with 64-bit extensions, MOVBE, MMX,
24510 SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2,
24511 AES, PCLMUL, FSGSBASE, RDRND, FMA, BMI, BMI2, F16C, RDSEED,
24512 ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F, AVX512VL,
24513 AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI, AVX512IFMA, SHA and
24514 UMIP instruction set support.
24515
24516 icelake-client
24517 Intel Icelake Client CPU with 64-bit extensions, MOVBE, MMX,
24518 SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2,
24519 AES, PCLMUL, FSGSBASE, RDRND, FMA, BMI, BMI2, F16C, RDSEED,
24520 ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F, AVX512VL,
24521 AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI, AVX512IFMA, SHA,
24522 CLWB, UMIP, RDPID, GFNI, AVX512VBMI2, AVX512VPOPCNTDQ,
24523 AVX512BITALG, AVX512VNNI, VPCLMULQDQ, VAES instruction set
24524 support.
24525
24526 icelake-server
24527 Intel Icelake Server CPU with 64-bit extensions, MOVBE, MMX,
24528 SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2,
24529 AES, PCLMUL, FSGSBASE, RDRND, FMA, BMI, BMI2, F16C, RDSEED,
24530 ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F, AVX512VL,
24531 AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI, AVX512IFMA, SHA,
24532 CLWB, UMIP, RDPID, GFNI, AVX512VBMI2, AVX512VPOPCNTDQ,
24533 AVX512BITALG, AVX512VNNI, VPCLMULQDQ, VAES, PCONFIG and
24534 WBNOINVD instruction set support.
24535
24536 cascadelake
24537 Intel Cascadelake CPU with 64-bit extensions, MOVBE, MMX, SSE,
24538 SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES,
24539 PCLMUL, FSGSBASE, RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX,
24540 PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F, CLWB, AVX512VL,
24541 AVX512BW, AVX512DQ, AVX512CD and AVX512VNNI instruction set
24542 support.
24543
24544 cooperlake
24545 Intel cooperlake CPU with 64-bit extensions, MOVBE, MMX, SSE,
24546 SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES,
24547 PCLMUL, FSGSBASE, RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX,
24548 PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F, CLWB, AVX512VL,
24549 AVX512BW, AVX512DQ, AVX512CD, AVX512VNNI and AVX512BF16
24550 instruction set support.
24551
24552 tigerlake
24553 Intel Tigerlake CPU with 64-bit extensions, MOVBE, MMX, SSE,
24554 SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES,
24555 PCLMUL, FSGSBASE, RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX,
24556 PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F, AVX512VL,
24557 AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI, AVX512IFMA, SHA,
24558 CLWB, UMIP, RDPID, GFNI, AVX512VBMI2, AVX512VPOPCNTDQ,
24559 AVX512BITALG, AVX512VNNI, VPCLMULQDQ, VAES, PCONFIG, WBNOINVD,
24560 MOVDIRI, MOVDIR64B and AVX512VP2INTERSECT instruction set
24561 support.
24562
24563 k6 AMD K6 CPU with MMX instruction set support.
24564
24565 k6-2
24566 k6-3
24567 Improved versions of AMD K6 CPU with MMX and 3DNow! instruction
24568 set support.
24569
24570 athlon
24571 athlon-tbird
24572 AMD Athlon CPU with MMX, 3dNOW!, enhanced 3DNow! and SSE
24573 prefetch instructions support.
24574
24575 athlon-4
24576 athlon-xp
24577 athlon-mp
24578 Improved AMD Athlon CPU with MMX, 3DNow!, enhanced 3DNow! and
24579 full SSE instruction set support.
24580
24581 k8
24582 opteron
24583 athlon64
24584 athlon-fx
24585 Processors based on the AMD K8 core with x86-64 instruction set
24586 support, including the AMD Opteron, Athlon 64, and Athlon 64 FX
24587 processors. (This supersets MMX, SSE, SSE2, 3DNow!, enhanced
24588 3DNow! and 64-bit instruction set extensions.)
24589
24590 k8-sse3
24591 opteron-sse3
24592 athlon64-sse3
24593 Improved versions of AMD K8 cores with SSE3 instruction set
24594 support.
24595
24596 amdfam10
24597 barcelona
24598 CPUs based on AMD Family 10h cores with x86-64 instruction set
24599 support. (This supersets MMX, SSE, SSE2, SSE3, SSE4A, 3DNow!,
24600 enhanced 3DNow!, ABM and 64-bit instruction set extensions.)
24601
24602 bdver1
24603 CPUs based on AMD Family 15h cores with x86-64 instruction set
24604 support. (This supersets FMA4, AVX, XOP, LWP, AES, PCLMUL,
24605 CX16, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM
24606 and 64-bit instruction set extensions.)
24607
24608 bdver2
24609 AMD Family 15h core based CPUs with x86-64 instruction set
24610 support. (This supersets BMI, TBM, F16C, FMA, FMA4, AVX, XOP,
24611 LWP, AES, PCLMUL, CX16, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3,
24612 SSE4.1, SSE4.2, ABM and 64-bit instruction set extensions.)
24613
24614 bdver3
24615 AMD Family 15h core based CPUs with x86-64 instruction set
24616 support. (This supersets BMI, TBM, F16C, FMA, FMA4, FSGSBASE,
24617 AVX, XOP, LWP, AES, PCLMUL, CX16, MMX, SSE, SSE2, SSE3, SSE4A,
24618 SSSE3, SSE4.1, SSE4.2, ABM and 64-bit instruction set
24619 extensions.)
24620
24621 bdver4
24622 AMD Family 15h core based CPUs with x86-64 instruction set
24623 support. (This supersets BMI, BMI2, TBM, F16C, FMA, FMA4,
24624 FSGSBASE, AVX, AVX2, XOP, LWP, AES, PCLMUL, CX16, MOVBE, MMX,
24625 SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM and 64-bit
24626 instruction set extensions.)
24627
24628 znver1
24629 AMD Family 17h core based CPUs with x86-64 instruction set
24630 support. (This supersets BMI, BMI2, F16C, FMA, FSGSBASE, AVX,
24631 AVX2, ADCX, RDSEED, MWAITX, SHA, CLZERO, AES, PCLMUL, CX16,
24632 MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM,
24633 XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, and 64-bit instruction set
24634 extensions.)
24635
24636 znver2
24637 AMD Family 17h core based CPUs with x86-64 instruction set
24638 support. (This supersets BMI, BMI2, CLWB, F16C, FMA, FSGSBASE,
24639 AVX, AVX2, ADCX, RDSEED, MWAITX, SHA, CLZERO, AES, PCLMUL,
24640 CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1,
24641 SSE4.2, ABM, XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, RDPID,
24642 WBNOINVD, and 64-bit instruction set extensions.)
24643
24644 btver1
24645 CPUs based on AMD Family 14h cores with x86-64 instruction set
24646 support. (This supersets MMX, SSE, SSE2, SSE3, SSSE3, SSE4A,
24647 CX16, ABM and 64-bit instruction set extensions.)
24648
24649 btver2
24650 CPUs based on AMD Family 16h cores with x86-64 instruction set
24651 support. This includes MOVBE, F16C, BMI, AVX, PCLMUL, AES,
24652 SSE4.2, SSE4.1, CX16, ABM, SSE4A, SSSE3, SSE3, SSE2, SSE, MMX
24653 and 64-bit instruction set extensions.
24654
24655 winchip-c6
24656 IDT WinChip C6 CPU, dealt in same way as i486 with additional
24657 MMX instruction set support.
24658
24659 winchip2
24660 IDT WinChip 2 CPU, dealt in same way as i486 with additional
24661 MMX and 3DNow! instruction set support.
24662
24663 c3 VIA C3 CPU with MMX and 3DNow! instruction set support. (No
24664 scheduling is implemented for this chip.)
24665
24666 c3-2
24667 VIA C3-2 (Nehemiah/C5XL) CPU with MMX and SSE instruction set
24668 support. (No scheduling is implemented for this chip.)
24669
24670 c7 VIA C7 (Esther) CPU with MMX, SSE, SSE2 and SSE3 instruction
24671 set support. (No scheduling is implemented for this chip.)
24672
24673 samuel-2
24674 VIA Eden Samuel 2 CPU with MMX and 3DNow! instruction set
24675 support. (No scheduling is implemented for this chip.)
24676
24677 nehemiah
24678 VIA Eden Nehemiah CPU with MMX and SSE instruction set support.
24679 (No scheduling is implemented for this chip.)
24680
24681 esther
24682 VIA Eden Esther CPU with MMX, SSE, SSE2 and SSE3 instruction
24683 set support. (No scheduling is implemented for this chip.)
24684
24685 eden-x2
24686 VIA Eden X2 CPU with x86-64, MMX, SSE, SSE2 and SSE3
24687 instruction set support. (No scheduling is implemented for
24688 this chip.)
24689
24690 eden-x4
24691 VIA Eden X4 CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3,
24692 SSE4.1, SSE4.2, AVX and AVX2 instruction set support. (No
24693 scheduling is implemented for this chip.)
24694
24695 nano
24696 Generic VIA Nano CPU with x86-64, MMX, SSE, SSE2, SSE3 and
24697 SSSE3 instruction set support. (No scheduling is implemented
24698 for this chip.)
24699
24700 nano-1000
24701 VIA Nano 1xxx CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
24702 instruction set support. (No scheduling is implemented for
24703 this chip.)
24704
24705 nano-2000
24706 VIA Nano 2xxx CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
24707 instruction set support. (No scheduling is implemented for
24708 this chip.)
24709
24710 nano-3000
24711 VIA Nano 3xxx CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and
24712 SSE4.1 instruction set support. (No scheduling is implemented
24713 for this chip.)
24714
24715 nano-x2
24716 VIA Nano Dual Core CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3
24717 and SSE4.1 instruction set support. (No scheduling is
24718 implemented for this chip.)
24719
24720 nano-x4
24721 VIA Nano Quad Core CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3
24722 and SSE4.1 instruction set support. (No scheduling is
24723 implemented for this chip.)
24724
24725 geode
24726 AMD Geode embedded processor with MMX and 3DNow! instruction
24727 set support.
24728
24729 -mtune=cpu-type
24730 Tune to cpu-type everything applicable about the generated code,
24731 except for the ABI and the set of available instructions. While
24732 picking a specific cpu-type schedules things appropriately for that
24733 particular chip, the compiler does not generate any code that
24734 cannot run on the default machine type unless you use a -march=cpu-
24735 type option. For example, if GCC is configured for
24736 i686-pc-linux-gnu then -mtune=pentium4 generates code that is tuned
24737 for Pentium 4 but still runs on i686 machines.
24738
24739 The choices for cpu-type are the same as for -march. In addition,
24740 -mtune supports 2 extra choices for cpu-type:
24741
24742 generic
24743 Produce code optimized for the most common IA32/AMD64/EM64T
24744 processors. If you know the CPU on which your code will run,
24745 then you should use the corresponding -mtune or -march option
24746 instead of -mtune=generic. But, if you do not know exactly
24747 what CPU users of your application will have, then you should
24748 use this option.
24749
24750 As new processors are deployed in the marketplace, the behavior
24751 of this option will change. Therefore, if you upgrade to a
24752 newer version of GCC, code generation controlled by this option
24753 will change to reflect the processors that are most common at
24754 the time that version of GCC is released.
24755
24756 There is no -march=generic option because -march indicates the
24757 instruction set the compiler can use, and there is no generic
24758 instruction set applicable to all processors. In contrast,
24759 -mtune indicates the processor (or, in this case, collection of
24760 processors) for which the code is optimized.
24761
24762 intel
24763 Produce code optimized for the most current Intel processors,
24764 which are Haswell and Silvermont for this version of GCC. If
24765 you know the CPU on which your code will run, then you should
24766 use the corresponding -mtune or -march option instead of
24767 -mtune=intel. But, if you want your application performs
24768 better on both Haswell and Silvermont, then you should use this
24769 option.
24770
24771 As new Intel processors are deployed in the marketplace, the
24772 behavior of this option will change. Therefore, if you upgrade
24773 to a newer version of GCC, code generation controlled by this
24774 option will change to reflect the most current Intel processors
24775 at the time that version of GCC is released.
24776
24777 There is no -march=intel option because -march indicates the
24778 instruction set the compiler can use, and there is no common
24779 instruction set applicable to all processors. In contrast,
24780 -mtune indicates the processor (or, in this case, collection of
24781 processors) for which the code is optimized.
24782
24783 -mcpu=cpu-type
24784 A deprecated synonym for -mtune.
24785
24786 -mfpmath=unit
24787 Generate floating-point arithmetic for selected unit unit. The
24788 choices for unit are:
24789
24790 387 Use the standard 387 floating-point coprocessor present on the
24791 majority of chips and emulated otherwise. Code compiled with
24792 this option runs almost everywhere. The temporary results are
24793 computed in 80-bit precision instead of the precision specified
24794 by the type, resulting in slightly different results compared
24795 to most of other chips. See -ffloat-store for more detailed
24796 description.
24797
24798 This is the default choice for non-Darwin x86-32 targets.
24799
24800 sse Use scalar floating-point instructions present in the SSE
24801 instruction set. This instruction set is supported by Pentium
24802 III and newer chips, and in the AMD line by Athlon-4, Athlon XP
24803 and Athlon MP chips. The earlier version of the SSE
24804 instruction set supports only single-precision arithmetic, thus
24805 the double and extended-precision arithmetic are still done
24806 using 387. A later version, present only in Pentium 4 and AMD
24807 x86-64 chips, supports double-precision arithmetic too.
24808
24809 For the x86-32 compiler, you must use -march=cpu-type, -msse or
24810 -msse2 switches to enable SSE extensions and make this option
24811 effective. For the x86-64 compiler, these extensions are
24812 enabled by default.
24813
24814 The resulting code should be considerably faster in the
24815 majority of cases and avoid the numerical instability problems
24816 of 387 code, but may break some existing code that expects
24817 temporaries to be 80 bits.
24818
24819 This is the default choice for the x86-64 compiler, Darwin
24820 x86-32 targets, and the default choice for x86-32 targets with
24821 the SSE2 instruction set when -ffast-math is enabled.
24822
24823 sse,387
24824 sse+387
24825 both
24826 Attempt to utilize both instruction sets at once. This
24827 effectively doubles the amount of available registers, and on
24828 chips with separate execution units for 387 and SSE the
24829 execution resources too. Use this option with care, as it is
24830 still experimental, because the GCC register allocator does not
24831 model separate functional units well, resulting in unstable
24832 performance.
24833
24834 -masm=dialect
24835 Output assembly instructions using selected dialect. Also affects
24836 which dialect is used for basic "asm" and extended "asm". Supported
24837 choices (in dialect order) are att or intel. The default is att.
24838 Darwin does not support intel.
24839
24840 -mieee-fp
24841 -mno-ieee-fp
24842 Control whether or not the compiler uses IEEE floating-point
24843 comparisons. These correctly handle the case where the result of a
24844 comparison is unordered.
24845
24846 -m80387
24847 -mhard-float
24848 Generate output containing 80387 instructions for floating point.
24849
24850 -mno-80387
24851 -msoft-float
24852 Generate output containing library calls for floating point.
24853
24854 Warning: the requisite libraries are not part of GCC. Normally the
24855 facilities of the machine's usual C compiler are used, but this
24856 cannot be done directly in cross-compilation. You must make your
24857 own arrangements to provide suitable library functions for cross-
24858 compilation.
24859
24860 On machines where a function returns floating-point results in the
24861 80387 register stack, some floating-point opcodes may be emitted
24862 even if -msoft-float is used.
24863
24864 -mno-fp-ret-in-387
24865 Do not use the FPU registers for return values of functions.
24866
24867 The usual calling convention has functions return values of types
24868 "float" and "double" in an FPU register, even if there is no FPU.
24869 The idea is that the operating system should emulate an FPU.
24870
24871 The option -mno-fp-ret-in-387 causes such values to be returned in
24872 ordinary CPU registers instead.
24873
24874 -mno-fancy-math-387
24875 Some 387 emulators do not support the "sin", "cos" and "sqrt"
24876 instructions for the 387. Specify this option to avoid generating
24877 those instructions. This option is overridden when -march
24878 indicates that the target CPU always has an FPU and so the
24879 instruction does not need emulation. These instructions are not
24880 generated unless you also use the -funsafe-math-optimizations
24881 switch.
24882
24883 -malign-double
24884 -mno-align-double
24885 Control whether GCC aligns "double", "long double", and "long long"
24886 variables on a two-word boundary or a one-word boundary. Aligning
24887 "double" variables on a two-word boundary produces code that runs
24888 somewhat faster on a Pentium at the expense of more memory.
24889
24890 On x86-64, -malign-double is enabled by default.
24891
24892 Warning: if you use the -malign-double switch, structures
24893 containing the above types are aligned differently than the
24894 published application binary interface specifications for the
24895 x86-32 and are not binary compatible with structures in code
24896 compiled without that switch.
24897
24898 -m96bit-long-double
24899 -m128bit-long-double
24900 These switches control the size of "long double" type. The x86-32
24901 application binary interface specifies the size to be 96 bits, so
24902 -m96bit-long-double is the default in 32-bit mode.
24903
24904 Modern architectures (Pentium and newer) prefer "long double" to be
24905 aligned to an 8- or 16-byte boundary. In arrays or structures
24906 conforming to the ABI, this is not possible. So specifying
24907 -m128bit-long-double aligns "long double" to a 16-byte boundary by
24908 padding the "long double" with an additional 32-bit zero.
24909
24910 In the x86-64 compiler, -m128bit-long-double is the default choice
24911 as its ABI specifies that "long double" is aligned on 16-byte
24912 boundary.
24913
24914 Notice that neither of these options enable any extra precision
24915 over the x87 standard of 80 bits for a "long double".
24916
24917 Warning: if you override the default value for your target ABI,
24918 this changes the size of structures and arrays containing "long
24919 double" variables, as well as modifying the function calling
24920 convention for functions taking "long double". Hence they are not
24921 binary-compatible with code compiled without that switch.
24922
24923 -mlong-double-64
24924 -mlong-double-80
24925 -mlong-double-128
24926 These switches control the size of "long double" type. A size of 64
24927 bits makes the "long double" type equivalent to the "double" type.
24928 This is the default for 32-bit Bionic C library. A size of 128
24929 bits makes the "long double" type equivalent to the "__float128"
24930 type. This is the default for 64-bit Bionic C library.
24931
24932 Warning: if you override the default value for your target ABI,
24933 this changes the size of structures and arrays containing "long
24934 double" variables, as well as modifying the function calling
24935 convention for functions taking "long double". Hence they are not
24936 binary-compatible with code compiled without that switch.
24937
24938 -malign-data=type
24939 Control how GCC aligns variables. Supported values for type are
24940 compat uses increased alignment value compatible uses GCC 4.8 and
24941 earlier, abi uses alignment value as specified by the psABI, and
24942 cacheline uses increased alignment value to match the cache line
24943 size. compat is the default.
24944
24945 -mlarge-data-threshold=threshold
24946 When -mcmodel=medium is specified, data objects larger than
24947 threshold are placed in the large data section. This value must be
24948 the same across all objects linked into the binary, and defaults to
24949 65535.
24950
24951 -mrtd
24952 Use a different function-calling convention, in which functions
24953 that take a fixed number of arguments return with the "ret num"
24954 instruction, which pops their arguments while returning. This
24955 saves one instruction in the caller since there is no need to pop
24956 the arguments there.
24957
24958 You can specify that an individual function is called with this
24959 calling sequence with the function attribute "stdcall". You can
24960 also override the -mrtd option by using the function attribute
24961 "cdecl".
24962
24963 Warning: this calling convention is incompatible with the one
24964 normally used on Unix, so you cannot use it if you need to call
24965 libraries compiled with the Unix compiler.
24966
24967 Also, you must provide function prototypes for all functions that
24968 take variable numbers of arguments (including "printf"); otherwise
24969 incorrect code is generated for calls to those functions.
24970
24971 In addition, seriously incorrect code results if you call a
24972 function with too many arguments. (Normally, extra arguments are
24973 harmlessly ignored.)
24974
24975 -mregparm=num
24976 Control how many registers are used to pass integer arguments. By
24977 default, no registers are used to pass arguments, and at most 3
24978 registers can be used. You can control this behavior for a
24979 specific function by using the function attribute "regparm".
24980
24981 Warning: if you use this switch, and num is nonzero, then you must
24982 build all modules with the same value, including any libraries.
24983 This includes the system libraries and startup modules.
24984
24985 -msseregparm
24986 Use SSE register passing conventions for float and double arguments
24987 and return values. You can control this behavior for a specific
24988 function by using the function attribute "sseregparm".
24989
24990 Warning: if you use this switch then you must build all modules
24991 with the same value, including any libraries. This includes the
24992 system libraries and startup modules.
24993
24994 -mvect8-ret-in-mem
24995 Return 8-byte vectors in memory instead of MMX registers. This is
24996 the default on VxWorks to match the ABI of the Sun Studio compilers
24997 until version 12. Only use this option if you need to remain
24998 compatible with existing code produced by those previous compiler
24999 versions or older versions of GCC.
25000
25001 -mpc32
25002 -mpc64
25003 -mpc80
25004 Set 80387 floating-point precision to 32, 64 or 80 bits. When
25005 -mpc32 is specified, the significands of results of floating-point
25006 operations are rounded to 24 bits (single precision); -mpc64 rounds
25007 the significands of results of floating-point operations to 53 bits
25008 (double precision) and -mpc80 rounds the significands of results of
25009 floating-point operations to 64 bits (extended double precision),
25010 which is the default. When this option is used, floating-point
25011 operations in higher precisions are not available to the programmer
25012 without setting the FPU control word explicitly.
25013
25014 Setting the rounding of floating-point operations to less than the
25015 default 80 bits can speed some programs by 2% or more. Note that
25016 some mathematical libraries assume that extended-precision (80-bit)
25017 floating-point operations are enabled by default; routines in such
25018 libraries could suffer significant loss of accuracy, typically
25019 through so-called "catastrophic cancellation", when this option is
25020 used to set the precision to less than extended precision.
25021
25022 -mstackrealign
25023 Realign the stack at entry. On the x86, the -mstackrealign option
25024 generates an alternate prologue and epilogue that realigns the run-
25025 time stack if necessary. This supports mixing legacy codes that
25026 keep 4-byte stack alignment with modern codes that keep 16-byte
25027 stack alignment for SSE compatibility. See also the attribute
25028 "force_align_arg_pointer", applicable to individual functions.
25029
25030 -mpreferred-stack-boundary=num
25031 Attempt to keep the stack boundary aligned to a 2 raised to num
25032 byte boundary. If -mpreferred-stack-boundary is not specified, the
25033 default is 4 (16 bytes or 128 bits).
25034
25035 Warning: When generating code for the x86-64 architecture with SSE
25036 extensions disabled, -mpreferred-stack-boundary=3 can be used to
25037 keep the stack boundary aligned to 8 byte boundary. Since x86-64
25038 ABI require 16 byte stack alignment, this is ABI incompatible and
25039 intended to be used in controlled environment where stack space is
25040 important limitation. This option leads to wrong code when
25041 functions compiled with 16 byte stack alignment (such as functions
25042 from a standard library) are called with misaligned stack. In this
25043 case, SSE instructions may lead to misaligned memory access traps.
25044 In addition, variable arguments are handled incorrectly for 16 byte
25045 aligned objects (including x87 long double and __int128), leading
25046 to wrong results. You must build all modules with
25047 -mpreferred-stack-boundary=3, including any libraries. This
25048 includes the system libraries and startup modules.
25049
25050 -mincoming-stack-boundary=num
25051 Assume the incoming stack is aligned to a 2 raised to num byte
25052 boundary. If -mincoming-stack-boundary is not specified, the one
25053 specified by -mpreferred-stack-boundary is used.
25054
25055 On Pentium and Pentium Pro, "double" and "long double" values
25056 should be aligned to an 8-byte boundary (see -malign-double) or
25057 suffer significant run time performance penalties. On Pentium III,
25058 the Streaming SIMD Extension (SSE) data type "__m128" may not work
25059 properly if it is not 16-byte aligned.
25060
25061 To ensure proper alignment of this values on the stack, the stack
25062 boundary must be as aligned as that required by any value stored on
25063 the stack. Further, every function must be generated such that it
25064 keeps the stack aligned. Thus calling a function compiled with a
25065 higher preferred stack boundary from a function compiled with a
25066 lower preferred stack boundary most likely misaligns the stack. It
25067 is recommended that libraries that use callbacks always use the
25068 default setting.
25069
25070 This extra alignment does consume extra stack space, and generally
25071 increases code size. Code that is sensitive to stack space usage,
25072 such as embedded systems and operating system kernels, may want to
25073 reduce the preferred alignment to -mpreferred-stack-boundary=2.
25074
25075 -mmmx
25076 -msse
25077 -msse2
25078 -msse3
25079 -mssse3
25080 -msse4
25081 -msse4a
25082 -msse4.1
25083 -msse4.2
25084 -mavx
25085 -mavx2
25086 -mavx512f
25087 -mavx512pf
25088 -mavx512er
25089 -mavx512cd
25090 -mavx512vl
25091 -mavx512bw
25092 -mavx512dq
25093 -mavx512ifma
25094 -mavx512vbmi
25095 -msha
25096 -maes
25097 -mpclmul
25098 -mclflushopt
25099 -mclwb
25100 -mfsgsbase
25101 -mptwrite
25102 -mrdrnd
25103 -mf16c
25104 -mfma
25105 -mpconfig
25106 -mwbnoinvd
25107 -mfma4
25108 -mprfchw
25109 -mrdpid
25110 -mprefetchwt1
25111 -mrdseed
25112 -msgx
25113 -mxop
25114 -mlwp
25115 -m3dnow
25116 -m3dnowa
25117 -mpopcnt
25118 -mabm
25119 -madx
25120 -mbmi
25121 -mbmi2
25122 -mlzcnt
25123 -mfxsr
25124 -mxsave
25125 -mxsaveopt
25126 -mxsavec
25127 -mxsaves
25128 -mrtm
25129 -mhle
25130 -mtbm
25131 -mmwaitx
25132 -mclzero
25133 -mpku
25134 -mavx512vbmi2
25135 -mavx512bf16
25136 -mgfni
25137 -mvaes
25138 -mwaitpkg
25139 -mvpclmulqdq
25140 -mavx512bitalg
25141 -mmovdiri
25142 -mmovdir64b
25143 -menqcmd
25144 -mavx512vpopcntdq
25145 -mavx512vp2intersect
25146 -mavx5124fmaps
25147 -mavx512vnni
25148 -mavx5124vnniw
25149 -mcldemote
25150 These switches enable the use of instructions in the MMX, SSE,
25151 SSE2, SSE3, SSSE3, SSE4, SSE4A, SSE4.1, SSE4.2, AVX, AVX2, AVX512F,
25152 AVX512PF, AVX512ER, AVX512CD, AVX512VL, AVX512BW, AVX512DQ,
25153 AVX512IFMA, AVX512VBMI, SHA, AES, PCLMUL, CLFLUSHOPT, CLWB,
25154 FSGSBASE, PTWRITE, RDRND, F16C, FMA, PCONFIG, WBNOINVD, FMA4,
25155 PREFETCHW, RDPID, PREFETCHWT1, RDSEED, SGX, XOP, LWP, 3DNow!,
25156 enhanced 3DNow!, POPCNT, ABM, ADX, BMI, BMI2, LZCNT, FXSR, XSAVE,
25157 XSAVEOPT, XSAVEC, XSAVES, RTM, HLE, TBM, MWAITX, CLZERO, PKU,
25158 AVX512VBMI2, GFNI, VAES, WAITPKG, VPCLMULQDQ, AVX512BITALG,
25159 MOVDIRI, MOVDIR64B, AVX512BF16, ENQCMD, AVX512VPOPCNTDQ,
25160 AVX5124FMAPS, AVX512VNNI, AVX5124VNNIW, or CLDEMOTE extended
25161 instruction sets. Each has a corresponding -mno- option to disable
25162 use of these instructions.
25163
25164 These extensions are also available as built-in functions: see x86
25165 Built-in Functions, for details of the functions enabled and
25166 disabled by these switches.
25167
25168 To generate SSE/SSE2 instructions automatically from floating-point
25169 code (as opposed to 387 instructions), see -mfpmath=sse.
25170
25171 GCC depresses SSEx instructions when -mavx is used. Instead, it
25172 generates new AVX instructions or AVX equivalence for all SSEx
25173 instructions when needed.
25174
25175 These options enable GCC to use these extended instructions in
25176 generated code, even without -mfpmath=sse. Applications that
25177 perform run-time CPU detection must compile separate files for each
25178 supported architecture, using the appropriate flags. In
25179 particular, the file containing the CPU detection code should be
25180 compiled without these options.
25181
25182 -mdump-tune-features
25183 This option instructs GCC to dump the names of the x86 performance
25184 tuning features and default settings. The names can be used in
25185 -mtune-ctrl=feature-list.
25186
25187 -mtune-ctrl=feature-list
25188 This option is used to do fine grain control of x86 code generation
25189 features. feature-list is a comma separated list of feature names.
25190 See also -mdump-tune-features. When specified, the feature is
25191 turned on if it is not preceded with ^, otherwise, it is turned
25192 off. -mtune-ctrl=feature-list is intended to be used by GCC
25193 developers. Using it may lead to code paths not covered by testing
25194 and can potentially result in compiler ICEs or runtime errors.
25195
25196 -mno-default
25197 This option instructs GCC to turn off all tunable features. See
25198 also -mtune-ctrl=feature-list and -mdump-tune-features.
25199
25200 -mcld
25201 This option instructs GCC to emit a "cld" instruction in the
25202 prologue of functions that use string instructions. String
25203 instructions depend on the DF flag to select between autoincrement
25204 or autodecrement mode. While the ABI specifies the DF flag to be
25205 cleared on function entry, some operating systems violate this
25206 specification by not clearing the DF flag in their exception
25207 dispatchers. The exception handler can be invoked with the DF flag
25208 set, which leads to wrong direction mode when string instructions
25209 are used. This option can be enabled by default on 32-bit x86
25210 targets by configuring GCC with the --enable-cld configure option.
25211 Generation of "cld" instructions can be suppressed with the
25212 -mno-cld compiler option in this case.
25213
25214 -mvzeroupper
25215 This option instructs GCC to emit a "vzeroupper" instruction before
25216 a transfer of control flow out of the function to minimize the AVX
25217 to SSE transition penalty as well as remove unnecessary "zeroupper"
25218 intrinsics.
25219
25220 -mprefer-avx128
25221 This option instructs GCC to use 128-bit AVX instructions instead
25222 of 256-bit AVX instructions in the auto-vectorizer.
25223
25224 -mprefer-vector-width=opt
25225 This option instructs GCC to use opt-bit vector width in
25226 instructions instead of default on the selected platform.
25227
25228 none
25229 No extra limitations applied to GCC other than defined by the
25230 selected platform.
25231
25232 128 Prefer 128-bit vector width for instructions.
25233
25234 256 Prefer 256-bit vector width for instructions.
25235
25236 512 Prefer 512-bit vector width for instructions.
25237
25238 -mcx16
25239 This option enables GCC to generate "CMPXCHG16B" instructions in
25240 64-bit code to implement compare-and-exchange operations on 16-byte
25241 aligned 128-bit objects. This is useful for atomic updates of data
25242 structures exceeding one machine word in size. The compiler uses
25243 this instruction to implement __sync Builtins. However, for
25244 __atomic Builtins operating on 128-bit integers, a library call is
25245 always used.
25246
25247 -msahf
25248 This option enables generation of "SAHF" instructions in 64-bit
25249 code. Early Intel Pentium 4 CPUs with Intel 64 support, prior to
25250 the introduction of Pentium 4 G1 step in December 2005, lacked the
25251 "LAHF" and "SAHF" instructions which are supported by AMD64. These
25252 are load and store instructions, respectively, for certain status
25253 flags. In 64-bit mode, the "SAHF" instruction is used to optimize
25254 "fmod", "drem", and "remainder" built-in functions; see Other
25255 Builtins for details.
25256
25257 -mmovbe
25258 This option enables use of the "movbe" instruction to implement
25259 "__builtin_bswap32" and "__builtin_bswap64".
25260
25261 -mshstk
25262 The -mshstk option enables shadow stack built-in functions from x86
25263 Control-flow Enforcement Technology (CET).
25264
25265 -mcrc32
25266 This option enables built-in functions "__builtin_ia32_crc32qi",
25267 "__builtin_ia32_crc32hi", "__builtin_ia32_crc32si" and
25268 "__builtin_ia32_crc32di" to generate the "crc32" machine
25269 instruction.
25270
25271 -mrecip
25272 This option enables use of "RCPSS" and "RSQRTSS" instructions (and
25273 their vectorized variants "RCPPS" and "RSQRTPS") with an additional
25274 Newton-Raphson step to increase precision instead of "DIVSS" and
25275 "SQRTSS" (and their vectorized variants) for single-precision
25276 floating-point arguments. These instructions are generated only
25277 when -funsafe-math-optimizations is enabled together with
25278 -ffinite-math-only and -fno-trapping-math. Note that while the
25279 throughput of the sequence is higher than the throughput of the
25280 non-reciprocal instruction, the precision of the sequence can be
25281 decreased by up to 2 ulp (i.e. the inverse of 1.0 equals
25282 0.99999994).
25283
25284 Note that GCC implements "1.0f/sqrtf(x)" in terms of "RSQRTSS" (or
25285 "RSQRTPS") already with -ffast-math (or the above option
25286 combination), and doesn't need -mrecip.
25287
25288 Also note that GCC emits the above sequence with additional Newton-
25289 Raphson step for vectorized single-float division and vectorized
25290 "sqrtf(x)" already with -ffast-math (or the above option
25291 combination), and doesn't need -mrecip.
25292
25293 -mrecip=opt
25294 This option controls which reciprocal estimate instructions may be
25295 used. opt is a comma-separated list of options, which may be
25296 preceded by a ! to invert the option:
25297
25298 all Enable all estimate instructions.
25299
25300 default
25301 Enable the default instructions, equivalent to -mrecip.
25302
25303 none
25304 Disable all estimate instructions, equivalent to -mno-recip.
25305
25306 div Enable the approximation for scalar division.
25307
25308 vec-div
25309 Enable the approximation for vectorized division.
25310
25311 sqrt
25312 Enable the approximation for scalar square root.
25313
25314 vec-sqrt
25315 Enable the approximation for vectorized square root.
25316
25317 So, for example, -mrecip=all,!sqrt enables all of the reciprocal
25318 approximations, except for square root.
25319
25320 -mveclibabi=type
25321 Specifies the ABI type to use for vectorizing intrinsics using an
25322 external library. Supported values for type are svml for the Intel
25323 short vector math library and acml for the AMD math core library.
25324 To use this option, both -ftree-vectorize and
25325 -funsafe-math-optimizations have to be enabled, and an SVML or ACML
25326 ABI-compatible library must be specified at link time.
25327
25328 GCC currently emits calls to "vmldExp2", "vmldLn2", "vmldLog102",
25329 "vmldPow2", "vmldTanh2", "vmldTan2", "vmldAtan2", "vmldAtanh2",
25330 "vmldCbrt2", "vmldSinh2", "vmldSin2", "vmldAsinh2", "vmldAsin2",
25331 "vmldCosh2", "vmldCos2", "vmldAcosh2", "vmldAcos2", "vmlsExp4",
25332 "vmlsLn4", "vmlsLog104", "vmlsPow4", "vmlsTanh4", "vmlsTan4",
25333 "vmlsAtan4", "vmlsAtanh4", "vmlsCbrt4", "vmlsSinh4", "vmlsSin4",
25334 "vmlsAsinh4", "vmlsAsin4", "vmlsCosh4", "vmlsCos4", "vmlsAcosh4"
25335 and "vmlsAcos4" for corresponding function type when
25336 -mveclibabi=svml is used, and "__vrd2_sin", "__vrd2_cos",
25337 "__vrd2_exp", "__vrd2_log", "__vrd2_log2", "__vrd2_log10",
25338 "__vrs4_sinf", "__vrs4_cosf", "__vrs4_expf", "__vrs4_logf",
25339 "__vrs4_log2f", "__vrs4_log10f" and "__vrs4_powf" for the
25340 corresponding function type when -mveclibabi=acml is used.
25341
25342 -mabi=name
25343 Generate code for the specified calling convention. Permissible
25344 values are sysv for the ABI used on GNU/Linux and other systems,
25345 and ms for the Microsoft ABI. The default is to use the Microsoft
25346 ABI when targeting Microsoft Windows and the SysV ABI on all other
25347 systems. You can control this behavior for specific functions by
25348 using the function attributes "ms_abi" and "sysv_abi".
25349
25350 -mforce-indirect-call
25351 Force all calls to functions to be indirect. This is useful when
25352 using Intel Processor Trace where it generates more precise timing
25353 information for function calls.
25354
25355 -mmanual-endbr
25356 Insert ENDBR instruction at function entry only via the "cf_check"
25357 function attribute. This is useful when used with the option
25358 -fcf-protection=branch to control ENDBR insertion at the function
25359 entry.
25360
25361 -mcall-ms2sysv-xlogues
25362 Due to differences in 64-bit ABIs, any Microsoft ABI function that
25363 calls a System V ABI function must consider RSI, RDI and XMM6-15 as
25364 clobbered. By default, the code for saving and restoring these
25365 registers is emitted inline, resulting in fairly lengthy prologues
25366 and epilogues. Using -mcall-ms2sysv-xlogues emits prologues and
25367 epilogues that use stubs in the static portion of libgcc to perform
25368 these saves and restores, thus reducing function size at the cost
25369 of a few extra instructions.
25370
25371 -mtls-dialect=type
25372 Generate code to access thread-local storage using the gnu or gnu2
25373 conventions. gnu is the conservative default; gnu2 is more
25374 efficient, but it may add compile- and run-time requirements that
25375 cannot be satisfied on all systems.
25376
25377 -mpush-args
25378 -mno-push-args
25379 Use PUSH operations to store outgoing parameters. This method is
25380 shorter and usually equally fast as method using SUB/MOV operations
25381 and is enabled by default. In some cases disabling it may improve
25382 performance because of improved scheduling and reduced
25383 dependencies.
25384
25385 -maccumulate-outgoing-args
25386 If enabled, the maximum amount of space required for outgoing
25387 arguments is computed in the function prologue. This is faster on
25388 most modern CPUs because of reduced dependencies, improved
25389 scheduling and reduced stack usage when the preferred stack
25390 boundary is not equal to 2. The drawback is a notable increase in
25391 code size. This switch implies -mno-push-args.
25392
25393 -mthreads
25394 Support thread-safe exception handling on MinGW. Programs that
25395 rely on thread-safe exception handling must compile and link all
25396 code with the -mthreads option. When compiling, -mthreads defines
25397 -D_MT; when linking, it links in a special thread helper library
25398 -lmingwthrd which cleans up per-thread exception-handling data.
25399
25400 -mms-bitfields
25401 -mno-ms-bitfields
25402 Enable/disable bit-field layout compatible with the native
25403 Microsoft Windows compiler.
25404
25405 If "packed" is used on a structure, or if bit-fields are used, it
25406 may be that the Microsoft ABI lays out the structure differently
25407 than the way GCC normally does. Particularly when moving packed
25408 data between functions compiled with GCC and the native Microsoft
25409 compiler (either via function call or as data in a file), it may be
25410 necessary to access either format.
25411
25412 This option is enabled by default for Microsoft Windows targets.
25413 This behavior can also be controlled locally by use of variable or
25414 type attributes. For more information, see x86 Variable Attributes
25415 and x86 Type Attributes.
25416
25417 The Microsoft structure layout algorithm is fairly simple with the
25418 exception of the bit-field packing. The padding and alignment of
25419 members of structures and whether a bit-field can straddle a
25420 storage-unit boundary are determine by these rules:
25421
25422 1. Structure members are stored sequentially in the order in which
25423 they are
25424 declared: the first member has the lowest memory address and
25425 the last member the highest.
25426
25427 2. Every data object has an alignment requirement. The alignment
25428 requirement
25429 for all data except structures, unions, and arrays is either
25430 the size of the object or the current packing size (specified
25431 with either the "aligned" attribute or the "pack" pragma),
25432 whichever is less. For structures, unions, and arrays, the
25433 alignment requirement is the largest alignment requirement of
25434 its members. Every object is allocated an offset so that:
25435
25436 offset % alignment_requirement == 0
25437
25438 3. Adjacent bit-fields are packed into the same 1-, 2-, or 4-byte
25439 allocation
25440 unit if the integral types are the same size and if the next
25441 bit-field fits into the current allocation unit without
25442 crossing the boundary imposed by the common alignment
25443 requirements of the bit-fields.
25444
25445 MSVC interprets zero-length bit-fields in the following ways:
25446
25447 1. If a zero-length bit-field is inserted between two bit-fields
25448 that
25449 are normally coalesced, the bit-fields are not coalesced.
25450
25451 For example:
25452
25453 struct
25454 {
25455 unsigned long bf_1 : 12;
25456 unsigned long : 0;
25457 unsigned long bf_2 : 12;
25458 } t1;
25459
25460 The size of "t1" is 8 bytes with the zero-length bit-field. If
25461 the zero-length bit-field were removed, "t1"'s size would be 4
25462 bytes.
25463
25464 2. If a zero-length bit-field is inserted after a bit-field, "foo",
25465 and the
25466 alignment of the zero-length bit-field is greater than the
25467 member that follows it, "bar", "bar" is aligned as the type of
25468 the zero-length bit-field.
25469
25470 For example:
25471
25472 struct
25473 {
25474 char foo : 4;
25475 short : 0;
25476 char bar;
25477 } t2;
25478
25479 struct
25480 {
25481 char foo : 4;
25482 short : 0;
25483 double bar;
25484 } t3;
25485
25486 For "t2", "bar" is placed at offset 2, rather than offset 1.
25487 Accordingly, the size of "t2" is 4. For "t3", the zero-length
25488 bit-field does not affect the alignment of "bar" or, as a
25489 result, the size of the structure.
25490
25491 Taking this into account, it is important to note the
25492 following:
25493
25494 1. If a zero-length bit-field follows a normal bit-field, the
25495 type of the
25496 zero-length bit-field may affect the alignment of the
25497 structure as whole. For example, "t2" has a size of 4
25498 bytes, since the zero-length bit-field follows a normal
25499 bit-field, and is of type short.
25500
25501 2. Even if a zero-length bit-field is not followed by a normal
25502 bit-field, it may
25503 still affect the alignment of the structure:
25504
25505 struct
25506 {
25507 char foo : 6;
25508 long : 0;
25509 } t4;
25510
25511 Here, "t4" takes up 4 bytes.
25512
25513 3. Zero-length bit-fields following non-bit-field members are
25514 ignored:
25515 struct
25516 {
25517 char foo;
25518 long : 0;
25519 char bar;
25520 } t5;
25521
25522 Here, "t5" takes up 2 bytes.
25523
25524 -mno-align-stringops
25525 Do not align the destination of inlined string operations. This
25526 switch reduces code size and improves performance in case the
25527 destination is already aligned, but GCC doesn't know about it.
25528
25529 -minline-all-stringops
25530 By default GCC inlines string operations only when the destination
25531 is known to be aligned to least a 4-byte boundary. This enables
25532 more inlining and increases code size, but may improve performance
25533 of code that depends on fast "memcpy" and "memset" for short
25534 lengths. The option enables inline expansion of "strlen" for all
25535 pointer alignments.
25536
25537 -minline-stringops-dynamically
25538 For string operations of unknown size, use run-time checks with
25539 inline code for small blocks and a library call for large blocks.
25540
25541 -mstringop-strategy=alg
25542 Override the internal decision heuristic for the particular
25543 algorithm to use for inlining string operations. The allowed
25544 values for alg are:
25545
25546 rep_byte
25547 rep_4byte
25548 rep_8byte
25549 Expand using i386 "rep" prefix of the specified size.
25550
25551 byte_loop
25552 loop
25553 unrolled_loop
25554 Expand into an inline loop.
25555
25556 libcall
25557 Always use a library call.
25558
25559 -mmemcpy-strategy=strategy
25560 Override the internal decision heuristic to decide if
25561 "__builtin_memcpy" should be inlined and what inline algorithm to
25562 use when the expected size of the copy operation is known. strategy
25563 is a comma-separated list of alg:max_size:dest_align triplets. alg
25564 is specified in -mstringop-strategy, max_size specifies the max
25565 byte size with which inline algorithm alg is allowed. For the last
25566 triplet, the max_size must be "-1". The max_size of the triplets in
25567 the list must be specified in increasing order. The minimal byte
25568 size for alg is 0 for the first triplet and "max_size + 1" of the
25569 preceding range.
25570
25571 -mmemset-strategy=strategy
25572 The option is similar to -mmemcpy-strategy= except that it is to
25573 control "__builtin_memset" expansion.
25574
25575 -momit-leaf-frame-pointer
25576 Don't keep the frame pointer in a register for leaf functions.
25577 This avoids the instructions to save, set up, and restore frame
25578 pointers and makes an extra register available in leaf functions.
25579 The option -fomit-leaf-frame-pointer removes the frame pointer for
25580 leaf functions, which might make debugging harder.
25581
25582 -mtls-direct-seg-refs
25583 -mno-tls-direct-seg-refs
25584 Controls whether TLS variables may be accessed with offsets from
25585 the TLS segment register (%gs for 32-bit, %fs for 64-bit), or
25586 whether the thread base pointer must be added. Whether or not this
25587 is valid depends on the operating system, and whether it maps the
25588 segment to cover the entire TLS area.
25589
25590 For systems that use the GNU C Library, the default is on.
25591
25592 -msse2avx
25593 -mno-sse2avx
25594 Specify that the assembler should encode SSE instructions with VEX
25595 prefix. The option -mavx turns this on by default.
25596
25597 -mfentry
25598 -mno-fentry
25599 If profiling is active (-pg), put the profiling counter call before
25600 the prologue. Note: On x86 architectures the attribute
25601 "ms_hook_prologue" isn't possible at the moment for -mfentry and
25602 -pg.
25603
25604 -mrecord-mcount
25605 -mno-record-mcount
25606 If profiling is active (-pg), generate a __mcount_loc section that
25607 contains pointers to each profiling call. This is useful for
25608 automatically patching and out calls.
25609
25610 -mnop-mcount
25611 -mno-nop-mcount
25612 If profiling is active (-pg), generate the calls to the profiling
25613 functions as NOPs. This is useful when they should be patched in
25614 later dynamically. This is likely only useful together with
25615 -mrecord-mcount.
25616
25617 -minstrument-return=type
25618 Instrument function exit in -pg -mfentry instrumented functions
25619 with call to specified function. This only instruments true returns
25620 ending with ret, but not sibling calls ending with jump. Valid
25621 types are none to not instrument, call to generate a call to
25622 __return__, or nop5 to generate a 5 byte nop.
25623
25624 -mrecord-return
25625 -mno-record-return
25626 Generate a __return_loc section pointing to all return
25627 instrumentation code.
25628
25629 -mfentry-name=name
25630 Set name of __fentry__ symbol called at function entry for -pg
25631 -mfentry functions.
25632
25633 -mfentry-section=name
25634 Set name of section to record -mrecord-mcount calls (default
25635 __mcount_loc).
25636
25637 -mskip-rax-setup
25638 -mno-skip-rax-setup
25639 When generating code for the x86-64 architecture with SSE
25640 extensions disabled, -mskip-rax-setup can be used to skip setting
25641 up RAX register when there are no variable arguments passed in
25642 vector registers.
25643
25644 Warning: Since RAX register is used to avoid unnecessarily saving
25645 vector registers on stack when passing variable arguments, the
25646 impacts of this option are callees may waste some stack space,
25647 misbehave or jump to a random location. GCC 4.4 or newer don't
25648 have those issues, regardless the RAX register value.
25649
25650 -m8bit-idiv
25651 -mno-8bit-idiv
25652 On some processors, like Intel Atom, 8-bit unsigned integer divide
25653 is much faster than 32-bit/64-bit integer divide. This option
25654 generates a run-time check. If both dividend and divisor are
25655 within range of 0 to 255, 8-bit unsigned integer divide is used
25656 instead of 32-bit/64-bit integer divide.
25657
25658 -mavx256-split-unaligned-load
25659 -mavx256-split-unaligned-store
25660 Split 32-byte AVX unaligned load and store.
25661
25662 -mstack-protector-guard=guard
25663 -mstack-protector-guard-reg=reg
25664 -mstack-protector-guard-offset=offset
25665 Generate stack protection code using canary at guard. Supported
25666 locations are global for global canary or tls for per-thread canary
25667 in the TLS block (the default). This option has effect only when
25668 -fstack-protector or -fstack-protector-all is specified.
25669
25670 With the latter choice the options -mstack-protector-guard-reg=reg
25671 and -mstack-protector-guard-offset=offset furthermore specify which
25672 segment register (%fs or %gs) to use as base register for reading
25673 the canary, and from what offset from that base register. The
25674 default for those is as specified in the relevant ABI.
25675
25676 -mgeneral-regs-only
25677 Generate code that uses only the general-purpose registers. This
25678 prevents the compiler from using floating-point, vector, mask and
25679 bound registers.
25680
25681 -mindirect-branch=choice
25682 Convert indirect call and jump with choice. The default is keep,
25683 which keeps indirect call and jump unmodified. thunk converts
25684 indirect call and jump to call and return thunk. thunk-inline
25685 converts indirect call and jump to inlined call and return thunk.
25686 thunk-extern converts indirect call and jump to external call and
25687 return thunk provided in a separate object file. You can control
25688 this behavior for a specific function by using the function
25689 attribute "indirect_branch".
25690
25691 Note that -mcmodel=large is incompatible with
25692 -mindirect-branch=thunk and -mindirect-branch=thunk-extern since
25693 the thunk function may not be reachable in the large code model.
25694
25695 Note that -mindirect-branch=thunk-extern is compatible with
25696 -fcf-protection=branch since the external thunk can be made to
25697 enable control-flow check.
25698
25699 -mfunction-return=choice
25700 Convert function return with choice. The default is keep, which
25701 keeps function return unmodified. thunk converts function return
25702 to call and return thunk. thunk-inline converts function return to
25703 inlined call and return thunk. thunk-extern converts function
25704 return to external call and return thunk provided in a separate
25705 object file. You can control this behavior for a specific function
25706 by using the function attribute "function_return".
25707
25708 Note that -mindirect-return=thunk-extern is compatible with
25709 -fcf-protection=branch since the external thunk can be made to
25710 enable control-flow check.
25711
25712 Note that -mcmodel=large is incompatible with
25713 -mfunction-return=thunk and -mfunction-return=thunk-extern since
25714 the thunk function may not be reachable in the large code model.
25715
25716 -mindirect-branch-register
25717 Force indirect call and jump via register.
25718
25719 These -m switches are supported in addition to the above on x86-64
25720 processors in 64-bit environments.
25721
25722 -m32
25723 -m64
25724 -mx32
25725 -m16
25726 -miamcu
25727 Generate code for a 16-bit, 32-bit or 64-bit environment. The -m32
25728 option sets "int", "long", and pointer types to 32 bits, and
25729 generates code that runs on any i386 system.
25730
25731 The -m64 option sets "int" to 32 bits and "long" and pointer types
25732 to 64 bits, and generates code for the x86-64 architecture. For
25733 Darwin only the -m64 option also turns off the -fno-pic and
25734 -mdynamic-no-pic options.
25735
25736 The -mx32 option sets "int", "long", and pointer types to 32 bits,
25737 and generates code for the x86-64 architecture.
25738
25739 The -m16 option is the same as -m32, except for that it outputs the
25740 ".code16gcc" assembly directive at the beginning of the assembly
25741 output so that the binary can run in 16-bit mode.
25742
25743 The -miamcu option generates code which conforms to Intel MCU
25744 psABI. It requires the -m32 option to be turned on.
25745
25746 -mno-red-zone
25747 Do not use a so-called "red zone" for x86-64 code. The red zone is
25748 mandated by the x86-64 ABI; it is a 128-byte area beyond the
25749 location of the stack pointer that is not modified by signal or
25750 interrupt handlers and therefore can be used for temporary data
25751 without adjusting the stack pointer. The flag -mno-red-zone
25752 disables this red zone.
25753
25754 -mcmodel=small
25755 Generate code for the small code model: the program and its symbols
25756 must be linked in the lower 2 GB of the address space. Pointers
25757 are 64 bits. Programs can be statically or dynamically linked.
25758 This is the default code model.
25759
25760 -mcmodel=kernel
25761 Generate code for the kernel code model. The kernel runs in the
25762 negative 2 GB of the address space. This model has to be used for
25763 Linux kernel code.
25764
25765 -mcmodel=medium
25766 Generate code for the medium model: the program is linked in the
25767 lower 2 GB of the address space. Small symbols are also placed
25768 there. Symbols with sizes larger than -mlarge-data-threshold are
25769 put into large data or BSS sections and can be located above 2GB.
25770 Programs can be statically or dynamically linked.
25771
25772 -mcmodel=large
25773 Generate code for the large model. This model makes no assumptions
25774 about addresses and sizes of sections.
25775
25776 -maddress-mode=long
25777 Generate code for long address mode. This is only supported for
25778 64-bit and x32 environments. It is the default address mode for
25779 64-bit environments.
25780
25781 -maddress-mode=short
25782 Generate code for short address mode. This is only supported for
25783 32-bit and x32 environments. It is the default address mode for
25784 32-bit and x32 environments.
25785
25786 x86 Windows Options
25787
25788 These additional options are available for Microsoft Windows targets:
25789
25790 -mconsole
25791 This option specifies that a console application is to be
25792 generated, by instructing the linker to set the PE header subsystem
25793 type required for console applications. This option is available
25794 for Cygwin and MinGW targets and is enabled by default on those
25795 targets.
25796
25797 -mdll
25798 This option is available for Cygwin and MinGW targets. It
25799 specifies that a DLL---a dynamic link library---is to be generated,
25800 enabling the selection of the required runtime startup object and
25801 entry point.
25802
25803 -mnop-fun-dllimport
25804 This option is available for Cygwin and MinGW targets. It
25805 specifies that the "dllimport" attribute should be ignored.
25806
25807 -mthread
25808 This option is available for MinGW targets. It specifies that
25809 MinGW-specific thread support is to be used.
25810
25811 -municode
25812 This option is available for MinGW-w64 targets. It causes the
25813 "UNICODE" preprocessor macro to be predefined, and chooses Unicode-
25814 capable runtime startup code.
25815
25816 -mwin32
25817 This option is available for Cygwin and MinGW targets. It
25818 specifies that the typical Microsoft Windows predefined macros are
25819 to be set in the pre-processor, but does not influence the choice
25820 of runtime library/startup code.
25821
25822 -mwindows
25823 This option is available for Cygwin and MinGW targets. It
25824 specifies that a GUI application is to be generated by instructing
25825 the linker to set the PE header subsystem type appropriately.
25826
25827 -fno-set-stack-executable
25828 This option is available for MinGW targets. It specifies that the
25829 executable flag for the stack used by nested functions isn't set.
25830 This is necessary for binaries running in kernel mode of Microsoft
25831 Windows, as there the User32 API, which is used to set executable
25832 privileges, isn't available.
25833
25834 -fwritable-relocated-rdata
25835 This option is available for MinGW and Cygwin targets. It
25836 specifies that relocated-data in read-only section is put into the
25837 ".data" section. This is a necessary for older runtimes not
25838 supporting modification of ".rdata" sections for pseudo-relocation.
25839
25840 -mpe-aligned-commons
25841 This option is available for Cygwin and MinGW targets. It
25842 specifies that the GNU extension to the PE file format that permits
25843 the correct alignment of COMMON variables should be used when
25844 generating code. It is enabled by default if GCC detects that the
25845 target assembler found during configuration supports the feature.
25846
25847 See also under x86 Options for standard options.
25848
25849 Xstormy16 Options
25850
25851 These options are defined for Xstormy16:
25852
25853 -msim
25854 Choose startup files and linker script suitable for the simulator.
25855
25856 Xtensa Options
25857
25858 These options are supported for Xtensa targets:
25859
25860 -mconst16
25861 -mno-const16
25862 Enable or disable use of "CONST16" instructions for loading
25863 constant values. The "CONST16" instruction is currently not a
25864 standard option from Tensilica. When enabled, "CONST16"
25865 instructions are always used in place of the standard "L32R"
25866 instructions. The use of "CONST16" is enabled by default only if
25867 the "L32R" instruction is not available.
25868
25869 -mfused-madd
25870 -mno-fused-madd
25871 Enable or disable use of fused multiply/add and multiply/subtract
25872 instructions in the floating-point option. This has no effect if
25873 the floating-point option is not also enabled. Disabling fused
25874 multiply/add and multiply/subtract instructions forces the compiler
25875 to use separate instructions for the multiply and add/subtract
25876 operations. This may be desirable in some cases where strict IEEE
25877 754-compliant results are required: the fused multiply add/subtract
25878 instructions do not round the intermediate result, thereby
25879 producing results with more bits of precision than specified by the
25880 IEEE standard. Disabling fused multiply add/subtract instructions
25881 also ensures that the program output is not sensitive to the
25882 compiler's ability to combine multiply and add/subtract operations.
25883
25884 -mserialize-volatile
25885 -mno-serialize-volatile
25886 When this option is enabled, GCC inserts "MEMW" instructions before
25887 "volatile" memory references to guarantee sequential consistency.
25888 The default is -mserialize-volatile. Use -mno-serialize-volatile
25889 to omit the "MEMW" instructions.
25890
25891 -mforce-no-pic
25892 For targets, like GNU/Linux, where all user-mode Xtensa code must
25893 be position-independent code (PIC), this option disables PIC for
25894 compiling kernel code.
25895
25896 -mtext-section-literals
25897 -mno-text-section-literals
25898 These options control the treatment of literal pools. The default
25899 is -mno-text-section-literals, which places literals in a separate
25900 section in the output file. This allows the literal pool to be
25901 placed in a data RAM/ROM, and it also allows the linker to combine
25902 literal pools from separate object files to remove redundant
25903 literals and improve code size. With -mtext-section-literals, the
25904 literals are interspersed in the text section in order to keep them
25905 as close as possible to their references. This may be necessary
25906 for large assembly files. Literals for each function are placed
25907 right before that function.
25908
25909 -mauto-litpools
25910 -mno-auto-litpools
25911 These options control the treatment of literal pools. The default
25912 is -mno-auto-litpools, which places literals in a separate section
25913 in the output file unless -mtext-section-literals is used. With
25914 -mauto-litpools the literals are interspersed in the text section
25915 by the assembler. Compiler does not produce explicit ".literal"
25916 directives and loads literals into registers with "MOVI"
25917 instructions instead of "L32R" to let the assembler do relaxation
25918 and place literals as necessary. This option allows assembler to
25919 create several literal pools per function and assemble very big
25920 functions, which may not be possible with -mtext-section-literals.
25921
25922 -mtarget-align
25923 -mno-target-align
25924 When this option is enabled, GCC instructs the assembler to
25925 automatically align instructions to reduce branch penalties at the
25926 expense of some code density. The assembler attempts to widen
25927 density instructions to align branch targets and the instructions
25928 following call instructions. If there are not enough preceding
25929 safe density instructions to align a target, no widening is
25930 performed. The default is -mtarget-align. These options do not
25931 affect the treatment of auto-aligned instructions like "LOOP",
25932 which the assembler always aligns, either by widening density
25933 instructions or by inserting NOP instructions.
25934
25935 -mlongcalls
25936 -mno-longcalls
25937 When this option is enabled, GCC instructs the assembler to
25938 translate direct calls to indirect calls unless it can determine
25939 that the target of a direct call is in the range allowed by the
25940 call instruction. This translation typically occurs for calls to
25941 functions in other source files. Specifically, the assembler
25942 translates a direct "CALL" instruction into an "L32R" followed by a
25943 "CALLX" instruction. The default is -mno-longcalls. This option
25944 should be used in programs where the call target can potentially be
25945 out of range. This option is implemented in the assembler, not the
25946 compiler, so the assembly code generated by GCC still shows direct
25947 call instructions---look at the disassembled object code to see the
25948 actual instructions. Note that the assembler uses an indirect call
25949 for every cross-file call, not just those that really are out of
25950 range.
25951
25952 zSeries Options
25953
25954 These are listed under
25955
25957 This section describes several environment variables that affect how
25958 GCC operates. Some of them work by specifying directories or prefixes
25959 to use when searching for various kinds of files. Some are used to
25960 specify other aspects of the compilation environment.
25961
25962 Note that you can also specify places to search using options such as
25963 -B, -I and -L. These take precedence over places specified using
25964 environment variables, which in turn take precedence over those
25965 specified by the configuration of GCC.
25966
25967 LANG
25968 LC_CTYPE
25969 LC_MESSAGES
25970 LC_ALL
25971 These environment variables control the way that GCC uses
25972 localization information which allows GCC to work with different
25973 national conventions. GCC inspects the locale categories LC_CTYPE
25974 and LC_MESSAGES if it has been configured to do so. These locale
25975 categories can be set to any value supported by your installation.
25976 A typical value is en_GB.UTF-8 for English in the United Kingdom
25977 encoded in UTF-8.
25978
25979 The LC_CTYPE environment variable specifies character
25980 classification. GCC uses it to determine the character boundaries
25981 in a string; this is needed for some multibyte encodings that
25982 contain quote and escape characters that are otherwise interpreted
25983 as a string end or escape.
25984
25985 The LC_MESSAGES environment variable specifies the language to use
25986 in diagnostic messages.
25987
25988 If the LC_ALL environment variable is set, it overrides the value
25989 of LC_CTYPE and LC_MESSAGES; otherwise, LC_CTYPE and LC_MESSAGES
25990 default to the value of the LANG environment variable. If none of
25991 these variables are set, GCC defaults to traditional C English
25992 behavior.
25993
25994 TMPDIR
25995 If TMPDIR is set, it specifies the directory to use for temporary
25996 files. GCC uses temporary files to hold the output of one stage of
25997 compilation which is to be used as input to the next stage: for
25998 example, the output of the preprocessor, which is the input to the
25999 compiler proper.
26000
26001 GCC_COMPARE_DEBUG
26002 Setting GCC_COMPARE_DEBUG is nearly equivalent to passing
26003 -fcompare-debug to the compiler driver. See the documentation of
26004 this option for more details.
26005
26006 GCC_EXEC_PREFIX
26007 If GCC_EXEC_PREFIX is set, it specifies a prefix to use in the
26008 names of the subprograms executed by the compiler. No slash is
26009 added when this prefix is combined with the name of a subprogram,
26010 but you can specify a prefix that ends with a slash if you wish.
26011
26012 If GCC_EXEC_PREFIX is not set, GCC attempts to figure out an
26013 appropriate prefix to use based on the pathname it is invoked with.
26014
26015 If GCC cannot find the subprogram using the specified prefix, it
26016 tries looking in the usual places for the subprogram.
26017
26018 The default value of GCC_EXEC_PREFIX is prefix/lib/gcc/ where
26019 prefix is the prefix to the installed compiler. In many cases
26020 prefix is the value of "prefix" when you ran the configure script.
26021
26022 Other prefixes specified with -B take precedence over this prefix.
26023
26024 This prefix is also used for finding files such as crt0.o that are
26025 used for linking.
26026
26027 In addition, the prefix is used in an unusual way in finding the
26028 directories to search for header files. For each of the standard
26029 directories whose name normally begins with /usr/local/lib/gcc
26030 (more precisely, with the value of GCC_INCLUDE_DIR), GCC tries
26031 replacing that beginning with the specified prefix to produce an
26032 alternate directory name. Thus, with -Bfoo/, GCC searches foo/bar
26033 just before it searches the standard directory /usr/local/lib/bar.
26034 If a standard directory begins with the configured prefix then the
26035 value of prefix is replaced by GCC_EXEC_PREFIX when looking for
26036 header files.
26037
26038 COMPILER_PATH
26039 The value of COMPILER_PATH is a colon-separated list of
26040 directories, much like PATH. GCC tries the directories thus
26041 specified when searching for subprograms, if it cannot find the
26042 subprograms using GCC_EXEC_PREFIX.
26043
26044 LIBRARY_PATH
26045 The value of LIBRARY_PATH is a colon-separated list of directories,
26046 much like PATH. When configured as a native compiler, GCC tries
26047 the directories thus specified when searching for special linker
26048 files, if it cannot find them using GCC_EXEC_PREFIX. Linking using
26049 GCC also uses these directories when searching for ordinary
26050 libraries for the -l option (but directories specified with -L come
26051 first).
26052
26053 LANG
26054 This variable is used to pass locale information to the compiler.
26055 One way in which this information is used is to determine the
26056 character set to be used when character literals, string literals
26057 and comments are parsed in C and C++. When the compiler is
26058 configured to allow multibyte characters, the following values for
26059 LANG are recognized:
26060
26061 C-JIS
26062 Recognize JIS characters.
26063
26064 C-SJIS
26065 Recognize SJIS characters.
26066
26067 C-EUCJP
26068 Recognize EUCJP characters.
26069
26070 If LANG is not defined, or if it has some other value, then the
26071 compiler uses "mblen" and "mbtowc" as defined by the default locale
26072 to recognize and translate multibyte characters.
26073
26074 Some additional environment variables affect the behavior of the
26075 preprocessor.
26076
26077 CPATH
26078 C_INCLUDE_PATH
26079 CPLUS_INCLUDE_PATH
26080 OBJC_INCLUDE_PATH
26081 Each variable's value is a list of directories separated by a
26082 special character, much like PATH, in which to look for header
26083 files. The special character, "PATH_SEPARATOR", is target-
26084 dependent and determined at GCC build time. For Microsoft Windows-
26085 based targets it is a semicolon, and for almost all other targets
26086 it is a colon.
26087
26088 CPATH specifies a list of directories to be searched as if
26089 specified with -I, but after any paths given with -I options on the
26090 command line. This environment variable is used regardless of
26091 which language is being preprocessed.
26092
26093 The remaining environment variables apply only when preprocessing
26094 the particular language indicated. Each specifies a list of
26095 directories to be searched as if specified with -isystem, but after
26096 any paths given with -isystem options on the command line.
26097
26098 In all these variables, an empty element instructs the compiler to
26099 search its current working directory. Empty elements can appear at
26100 the beginning or end of a path. For instance, if the value of
26101 CPATH is ":/special/include", that has the same effect as
26102 -I. -I/special/include.
26103
26104 DEPENDENCIES_OUTPUT
26105 If this variable is set, its value specifies how to output
26106 dependencies for Make based on the non-system header files
26107 processed by the compiler. System header files are ignored in the
26108 dependency output.
26109
26110 The value of DEPENDENCIES_OUTPUT can be just a file name, in which
26111 case the Make rules are written to that file, guessing the target
26112 name from the source file name. Or the value can have the form
26113 file target, in which case the rules are written to file file using
26114 target as the target name.
26115
26116 In other words, this environment variable is equivalent to
26117 combining the options -MM and -MF, with an optional -MT switch too.
26118
26119 SUNPRO_DEPENDENCIES
26120 This variable is the same as DEPENDENCIES_OUTPUT (see above),
26121 except that system header files are not ignored, so it implies -M
26122 rather than -MM. However, the dependence on the main input file is
26123 omitted.
26124
26125 SOURCE_DATE_EPOCH
26126 If this variable is set, its value specifies a UNIX timestamp to be
26127 used in replacement of the current date and time in the "__DATE__"
26128 and "__TIME__" macros, so that the embedded timestamps become
26129 reproducible.
26130
26131 The value of SOURCE_DATE_EPOCH must be a UNIX timestamp, defined as
26132 the number of seconds (excluding leap seconds) since 01 Jan 1970
26133 00:00:00 represented in ASCII; identical to the output of
26134 @command{date +%s} on GNU/Linux and other systems that support the
26135 %s extension in the "date" command.
26136
26137 The value should be a known timestamp such as the last modification
26138 time of the source or package and it should be set by the build
26139 process.
26140
26142 For instructions on reporting bugs, see
26143 <http://bugzilla.redhat.com/bugzilla/>.
26144
26146 1. On some systems, gcc -shared needs to build supplementary stub code
26147 for constructors to work. On multi-libbed systems, gcc -shared
26148 must select the correct support libraries to link against. Failing
26149 to supply the correct flags may lead to subtle defects. Supplying
26150 them in cases where they are not necessary is innocuous.
26151
26153 gpl(7), gfdl(7), fsf-funding(7), cpp(1), gcov(1), as(1), ld(1), gdb(1),
26154 dbx(1) and the Info entries for gcc, cpp, as, ld, binutils and gdb.
26155
26157 See the Info entry for gcc, or
26158 <http://gcc.gnu.org/onlinedocs/gcc/Contributors.html>, for contributors
26159 to GCC.
26160
26162 Copyright (c) 1988-2020 Free Software Foundation, Inc.
26163
26164 Permission is granted to copy, distribute and/or modify this document
26165 under the terms of the GNU Free Documentation License, Version 1.3 or
26166 any later version published by the Free Software Foundation; with the
26167 Invariant Sections being "GNU General Public License" and "Funding Free
26168 Software", the Front-Cover texts being (a) (see below), and with the
26169 Back-Cover Texts being (b) (see below). A copy of the license is
26170 included in the gfdl(7) man page.
26171
26172 (a) The FSF's Front-Cover Text is:
26173
26174 A GNU Manual
26175
26176 (b) The FSF's Back-Cover Text is:
26177
26178 You have freedom to copy and modify this GNU Manual, like GNU
26179 software. Copies published by the Free Software Foundation raise
26180 funds for GNU development.
26181
26182
26183
26184gcc-10 2020-08-26 GCC(1)