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-reproducible=[multithreaded|parallel-runs|serial]
359 -fsanitize=style -fsanitize-recover -fsanitize-recover=style
360 -fasan-shadow-offset=number -fsanitize-sections=s1,s2,...
361 -fsanitize-undefined-trap-on-error -fbounds-check
362 -fcf-protection=[full|branch|return|none|check] -fstack-protector
363 -fstack-protector-all -fstack-protector-strong
364 -fstack-protector-explicit -fstack-check
365 -fstack-limit-register=reg -fstack-limit-symbol=sym
366 -fno-stack-limit -fsplit-stack -fvtable-verify=[std|preinit|none]
367 -fvtv-counts -fvtv-debug -finstrument-functions
368 -finstrument-functions-exclude-function-list=sym,sym,...
369 -finstrument-functions-exclude-file-list=file,file,...
370
371 Preprocessor Options
372 -Aquestion=answer -A-question[=answer] -C -CC -Dmacro[=defn] -dD
373 -dI -dM -dN -dU -fdebug-cpp -fdirectives-only
374 -fdollars-in-identifiers -fexec-charset=charset
375 -fextended-identifiers -finput-charset=charset
376 -fmacro-prefix-map=old=new -fmax-include-depth=depth
377 -fno-canonical-system-headers -fpch-deps -fpch-preprocess
378 -fpreprocessed -ftabstop=width -ftrack-macro-expansion
379 -fwide-exec-charset=charset -fworking-directory -H -imacros file
380 -include file -M -MD -MF -MG -MM -MMD -MP -MQ -MT
381 -no-integrated-cpp -P -pthread -remap -traditional
382 -traditional-cpp -trigraphs -Umacro -undef -Wp,option
383 -Xpreprocessor option
384
385 Assembler Options
386 -Wa,option -Xassembler option
387
388 Linker Options
389 object-file-name -fuse-ld=linker -llibrary -nostartfiles
390 -nodefaultlibs -nolibc -nostdlib -e entry --entry=entry -pie
391 -pthread -r -rdynamic -s -static -static-pie -static-libgcc
392 -static-libstdc++ -static-libasan -static-libtsan -static-liblsan
393 -static-libubsan -shared -shared-libgcc -symbolic -T script
394 -Wl,option -Xlinker option -u symbol -z keyword
395
396 Directory Options
397 -Bprefix -Idir -I- -idirafter dir -imacros file -imultilib dir
398 -iplugindir=dir -iprefix file -iquote dir -isysroot dir -isystem
399 dir -iwithprefix dir -iwithprefixbefore dir -Ldir
400 -no-canonical-prefixes --no-sysroot-suffix -nostdinc -nostdinc++
401 --sysroot=dir
402
403 Code Generation Options
404 -fcall-saved-reg -fcall-used-reg -ffixed-reg -fexceptions
405 -fnon-call-exceptions -fdelete-dead-exceptions -funwind-tables
406 -fasynchronous-unwind-tables -fno-gnu-unique
407 -finhibit-size-directive -fcommon -fno-ident -fpcc-struct-return
408 -fpic -fPIC -fpie -fPIE -fno-plt -fno-jump-tables
409 -frecord-gcc-switches -freg-struct-return -fshort-enums
410 -fshort-wchar -fverbose-asm -fpack-struct[=n] -fleading-underscore
411 -ftls-model=model -fstack-reuse=reuse_level -ftrampolines -ftrapv
412 -fwrapv -fvisibility=[default|internal|hidden|protected]
413 -fstrict-volatile-bitfields -fsync-libcalls
414
415 Developer Options
416 -dletters -dumpspecs -dumpmachine -dumpversion -dumpfullversion
417 -fcallgraph-info[=su,da] -fchecking -fchecking=n -fdbg-cnt-list
418 -fdbg-cnt=counter-value-list -fdisable-ipa-pass_name
419 -fdisable-rtl-pass_name -fdisable-rtl-pass-name=range-list
420 -fdisable-tree-pass_name -fdisable-tree-pass-name=range-list
421 -fdump-debug -fdump-earlydebug -fdump-noaddr -fdump-unnumbered
422 -fdump-unnumbered-links -fdump-final-insns[=file] -fdump-ipa-all
423 -fdump-ipa-cgraph -fdump-ipa-inline -fdump-lang-all
424 -fdump-lang-switch -fdump-lang-switch-options
425 -fdump-lang-switch-options=filename -fdump-passes -fdump-rtl-pass
426 -fdump-rtl-pass=filename -fdump-statistics -fdump-tree-all
427 -fdump-tree-switch -fdump-tree-switch-options
428 -fdump-tree-switch-options=filename -fcompare-debug[=opts]
429 -fcompare-debug-second -fenable-kind-pass -fenable-kind-pass=range-
430 list -fira-verbose=n -flto-report -flto-report-wpa
431 -fmem-report-wpa -fmem-report -fpre-ipa-mem-report
432 -fpost-ipa-mem-report -fopt-info -fopt-info-options[=file]
433 -fprofile-report -frandom-seed=string -fsched-verbose=n
434 -fsel-sched-verbose -fsel-sched-dump-cfg
435 -fsel-sched-pipelining-verbose -fstats -fstack-usage
436 -ftime-report -ftime-report-details
437 -fvar-tracking-assignments-toggle -gtoggle
438 -print-file-name=library -print-libgcc-file-name
439 -print-multi-directory -print-multi-lib -print-multi-os-directory
440 -print-prog-name=program -print-search-dirs -Q -print-sysroot
441 -print-sysroot-headers-suffix -save-temps -save-temps=cwd
442 -save-temps=obj -time[=file]
443
444 Machine-Dependent Options
445 AArch64 Options -mabi=name -mbig-endian -mlittle-endian
446 -mgeneral-regs-only -mcmodel=tiny -mcmodel=small -mcmodel=large
447 -mstrict-align -mno-strict-align -momit-leaf-frame-pointer
448 -mtls-dialect=desc -mtls-dialect=traditional -mtls-size=size
449 -mfix-cortex-a53-835769 -mfix-cortex-a53-843419
450 -mlow-precision-recip-sqrt -mlow-precision-sqrt
451 -mlow-precision-div -mpc-relative-literal-loads
452 -msign-return-address=scope -mbranch-protection=none|standard|pac-
453 ret[+leaf +b-key]|bti -mharden-sls=opts -march=name -mcpu=name
454 -mtune=name -moverride=string -mverbose-cost-dump
455 -mstack-protector-guard=guard -mstack-protector-guard-reg=sysreg
456 -mstack-protector-guard-offset=offset -mtrack-speculation
457 -moutline-atomics
458
459 Adapteva Epiphany Options -mhalf-reg-file -mprefer-short-insn-regs
460 -mbranch-cost=num -mcmove -mnops=num -msoft-cmpsf -msplit-lohi
461 -mpost-inc -mpost-modify -mstack-offset=num -mround-nearest
462 -mlong-calls -mshort-calls -msmall16 -mfp-mode=mode
463 -mvect-double -max-vect-align=num -msplit-vecmove-early
464 -m1reg-reg
465
466 AMD GCN Options -march=gpu -mtune=gpu -mstack-size=bytes
467
468 ARC Options -mbarrel-shifter -mjli-always -mcpu=cpu -mA6
469 -mARC600 -mA7 -mARC700 -mdpfp -mdpfp-compact -mdpfp-fast
470 -mno-dpfp-lrsr -mea -mno-mpy -mmul32x16 -mmul64 -matomic -mnorm
471 -mspfp -mspfp-compact -mspfp-fast -msimd -msoft-float -mswap
472 -mcrc -mdsp-packa -mdvbf -mlock -mmac-d16 -mmac-24 -mrtsc
473 -mswape -mtelephony -mxy -misize -mannotate-align -marclinux
474 -marclinux_prof -mlong-calls -mmedium-calls -msdata
475 -mirq-ctrl-saved -mrgf-banked-regs -mlpc-width=width -G num
476 -mvolatile-cache -mtp-regno=regno -malign-call -mauto-modify-reg
477 -mbbit-peephole -mno-brcc -mcase-vector-pcrel -mcompact-casesi
478 -mno-cond-exec -mearly-cbranchsi -mexpand-adddi -mindexed-loads
479 -mlra -mlra-priority-none -mlra-priority-compact mlra-priority-
480 noncompact -mmillicode -mmixed-code -mq-class -mRcq -mRcw
481 -msize-level=level -mtune=cpu -mmultcost=num -mcode-density-frame
482 -munalign-prob-threshold=probability -mmpy-option=multo -mdiv-rem
483 -mcode-density -mll64 -mfpu=fpu -mrf16 -mbranch-index
484
485 ARM Options -mapcs-frame -mno-apcs-frame -mabi=name
486 -mapcs-stack-check -mno-apcs-stack-check -mapcs-reentrant
487 -mno-apcs-reentrant -mgeneral-regs-only -msched-prolog
488 -mno-sched-prolog -mlittle-endian -mbig-endian -mbe8 -mbe32
489 -mfloat-abi=name -mfp16-format=name -mthumb-interwork
490 -mno-thumb-interwork -mcpu=name -march=name -mfpu=name
491 -mtune=name -mprint-tune-info -mstructure-size-boundary=n
492 -mabort-on-noreturn -mlong-calls -mno-long-calls -msingle-pic-base
493 -mno-single-pic-base -mpic-register=reg -mnop-fun-dllimport
494 -mpoke-function-name -mthumb -marm -mflip-thumb -mtpcs-frame
495 -mtpcs-leaf-frame -mcaller-super-interworking
496 -mcallee-super-interworking -mtp=name -mtls-dialect=dialect
497 -mword-relocations -mfix-cortex-m3-ldrd -munaligned-access
498 -mneon-for-64bits -mslow-flash-data -masm-syntax-unified
499 -mrestrict-it -mverbose-cost-dump -mpure-code -mcmse -mfdpic
500
501 AVR Options -mmcu=mcu -mabsdata -maccumulate-args
502 -mbranch-cost=cost -mcall-prologues -mgas-isr-prologues -mint8
503 -mdouble=bits -mlong-double=bits -mn_flash=size -mno-interrupts
504 -mmain-is-OS_task -mrelax -mrmw -mstrict-X -mtiny-stack
505 -mfract-convert-truncate -mshort-calls -nodevicelib
506 -nodevicespecs -Waddr-space-convert -Wmisspelled-isr
507
508 Blackfin Options -mcpu=cpu[-sirevision] -msim
509 -momit-leaf-frame-pointer -mno-omit-leaf-frame-pointer
510 -mspecld-anomaly -mno-specld-anomaly -mcsync-anomaly
511 -mno-csync-anomaly -mlow-64k -mno-low64k -mstack-check-l1
512 -mid-shared-library -mno-id-shared-library -mshared-library-id=n
513 -mleaf-id-shared-library -mno-leaf-id-shared-library -msep-data
514 -mno-sep-data -mlong-calls -mno-long-calls -mfast-fp
515 -minline-plt -mmulticore -mcorea -mcoreb -msdram -micplb
516
517 C6X Options -mbig-endian -mlittle-endian -march=cpu -msim
518 -msdata=sdata-type
519
520 CRIS Options -mcpu=cpu -march=cpu -mtune=cpu -mmax-stack-frame=n
521 -melinux-stacksize=n -metrax4 -metrax100 -mpdebug -mcc-init
522 -mno-side-effects -mstack-align -mdata-align -mconst-align
523 -m32-bit -m16-bit -m8-bit -mno-prologue-epilogue -mno-gotplt
524 -melf -maout -melinux -mlinux -sim -sim2 -mmul-bug-workaround
525 -mno-mul-bug-workaround
526
527 CR16 Options -mmac -mcr16cplus -mcr16c -msim -mint32 -mbit-ops
528 -mdata-model=model
529
530 C-SKY Options -march=arch -mcpu=cpu -mbig-endian -EB
531 -mlittle-endian -EL -mhard-float -msoft-float -mfpu=fpu
532 -mdouble-float -mfdivdu -melrw -mistack -mmp -mcp -mcache
533 -msecurity -mtrust -mdsp -medsp -mvdsp -mdiv -msmart
534 -mhigh-registers -manchor -mpushpop -mmultiple-stld -mconstpool
535 -mstack-size -mccrt -mbranch-cost=n -mcse-cc -msched-prolog
536
537 Darwin Options -all_load -allowable_client -arch
538 -arch_errors_fatal -arch_only -bind_at_load -bundle
539 -bundle_loader -client_name -compatibility_version
540 -current_version -dead_strip -dependency-file -dylib_file
541 -dylinker_install_name -dynamic -dynamiclib
542 -exported_symbols_list -filelist -flat_namespace
543 -force_cpusubtype_ALL -force_flat_namespace
544 -headerpad_max_install_names -iframework -image_base -init
545 -install_name -keep_private_externs -multi_module
546 -multiply_defined -multiply_defined_unused -noall_load
547 -no_dead_strip_inits_and_terms -nofixprebinding -nomultidefs
548 -noprebind -noseglinkedit -pagezero_size -prebind
549 -prebind_all_twolevel_modules -private_bundle -read_only_relocs
550 -sectalign -sectobjectsymbols -whyload -seg1addr -sectcreate
551 -sectobjectsymbols -sectorder -segaddr -segs_read_only_addr
552 -segs_read_write_addr -seg_addr_table -seg_addr_table_filename
553 -seglinkedit -segprot -segs_read_only_addr -segs_read_write_addr
554 -single_module -static -sub_library -sub_umbrella
555 -twolevel_namespace -umbrella -undefined -unexported_symbols_list
556 -weak_reference_mismatches -whatsloaded -F -gused -gfull
557 -mmacosx-version-min=version -mkernel -mone-byte-bool
558
559 DEC Alpha Options -mno-fp-regs -msoft-float -mieee
560 -mieee-with-inexact -mieee-conformant -mfp-trap-mode=mode
561 -mfp-rounding-mode=mode -mtrap-precision=mode -mbuild-constants
562 -mcpu=cpu-type -mtune=cpu-type -mbwx -mmax -mfix -mcix
563 -mfloat-vax -mfloat-ieee -mexplicit-relocs -msmall-data
564 -mlarge-data -msmall-text -mlarge-text -mmemory-latency=time
565
566 eBPF Options -mbig-endian -mlittle-endian -mkernel=version
567 -mframe-limit=bytes -mxbpf
568
569 FR30 Options -msmall-model -mno-lsim
570
571 FT32 Options -msim -mlra -mnodiv -mft32b -mcompress -mnopm
572
573 FRV Options -mgpr-32 -mgpr-64 -mfpr-32 -mfpr-64 -mhard-float
574 -msoft-float -malloc-cc -mfixed-cc -mdword -mno-dword -mdouble
575 -mno-double -mmedia -mno-media -mmuladd -mno-muladd -mfdpic
576 -minline-plt -mgprel-ro -multilib-library-pic -mlinked-fp
577 -mlong-calls -malign-labels -mlibrary-pic -macc-4 -macc-8 -mpack
578 -mno-pack -mno-eflags -mcond-move -mno-cond-move
579 -moptimize-membar -mno-optimize-membar -mscc -mno-scc
580 -mcond-exec -mno-cond-exec -mvliw-branch -mno-vliw-branch
581 -mmulti-cond-exec -mno-multi-cond-exec -mnested-cond-exec
582 -mno-nested-cond-exec -mtomcat-stats -mTLS -mtls -mcpu=cpu
583
584 GNU/Linux Options -mglibc -muclibc -mmusl -mbionic -mandroid
585 -tno-android-cc -tno-android-ld
586
587 H8/300 Options -mrelax -mh -ms -mn -mexr -mno-exr -mint32
588 -malign-300
589
590 HPPA Options -march=architecture-type -mcaller-copies
591 -mdisable-fpregs -mdisable-indexing -mfast-indirect-calls -mgas
592 -mgnu-ld -mhp-ld -mfixed-range=register-range -mjump-in-delay
593 -mlinker-opt -mlong-calls -mlong-load-store -mno-disable-fpregs
594 -mno-disable-indexing -mno-fast-indirect-calls -mno-gas
595 -mno-jump-in-delay -mno-long-load-store -mno-portable-runtime
596 -mno-soft-float -mno-space-regs -msoft-float -mpa-risc-1-0
597 -mpa-risc-1-1 -mpa-risc-2-0 -mportable-runtime -mschedule=cpu-
598 type -mspace-regs -msio -mwsio -munix=unix-std -nolibdld
599 -static -threads
600
601 IA-64 Options -mbig-endian -mlittle-endian -mgnu-as -mgnu-ld
602 -mno-pic -mvolatile-asm-stop -mregister-names -msdata -mno-sdata
603 -mconstant-gp -mauto-pic -mfused-madd
604 -minline-float-divide-min-latency
605 -minline-float-divide-max-throughput -mno-inline-float-divide
606 -minline-int-divide-min-latency -minline-int-divide-max-throughput
607 -mno-inline-int-divide -minline-sqrt-min-latency
608 -minline-sqrt-max-throughput -mno-inline-sqrt -mdwarf2-asm
609 -mearly-stop-bits -mfixed-range=register-range -mtls-size=tls-size
610 -mtune=cpu-type -milp32 -mlp64 -msched-br-data-spec
611 -msched-ar-data-spec -msched-control-spec -msched-br-in-data-spec
612 -msched-ar-in-data-spec -msched-in-control-spec -msched-spec-ldc
613 -msched-spec-control-ldc -msched-prefer-non-data-spec-insns
614 -msched-prefer-non-control-spec-insns
615 -msched-stop-bits-after-every-cycle
616 -msched-count-spec-in-critical-path
617 -msel-sched-dont-check-control-spec -msched-fp-mem-deps-zero-cost
618 -msched-max-memory-insns-hard-limit -msched-max-memory-insns=max-
619 insns
620
621 LM32 Options -mbarrel-shift-enabled -mdivide-enabled
622 -mmultiply-enabled -msign-extend-enabled -muser-enabled
623
624 M32R/D Options -m32r2 -m32rx -m32r -mdebug -malign-loops
625 -mno-align-loops -missue-rate=number -mbranch-cost=number
626 -mmodel=code-size-model-type -msdata=sdata-type -mno-flush-func
627 -mflush-func=name -mno-flush-trap -mflush-trap=number -G num
628
629 M32C Options -mcpu=cpu -msim -memregs=number
630
631 M680x0 Options -march=arch -mcpu=cpu -mtune=tune -m68000 -m68020
632 -m68020-40 -m68020-60 -m68030 -m68040 -m68060 -mcpu32 -m5200
633 -m5206e -m528x -m5307 -m5407 -mcfv4e -mbitfield -mno-bitfield
634 -mc68000 -mc68020 -mnobitfield -mrtd -mno-rtd -mdiv -mno-div
635 -mshort -mno-short -mhard-float -m68881 -msoft-float -mpcrel
636 -malign-int -mstrict-align -msep-data -mno-sep-data
637 -mshared-library-id=n -mid-shared-library -mno-id-shared-library
638 -mxgot -mno-xgot -mlong-jump-table-offsets
639
640 MCore Options -mhardlit -mno-hardlit -mdiv -mno-div
641 -mrelax-immediates -mno-relax-immediates -mwide-bitfields
642 -mno-wide-bitfields -m4byte-functions -mno-4byte-functions
643 -mcallgraph-data -mno-callgraph-data -mslow-bytes -mno-slow-bytes
644 -mno-lsim -mlittle-endian -mbig-endian -m210 -m340
645 -mstack-increment
646
647 MeP Options -mabsdiff -mall-opts -maverage -mbased=n -mbitops
648 -mc=n -mclip -mconfig=name -mcop -mcop32 -mcop64 -mivc2 -mdc
649 -mdiv -meb -mel -mio-volatile -ml -mleadz -mm -mminmax
650 -mmult -mno-opts -mrepeat -ms -msatur -msdram -msim
651 -msimnovec -mtf -mtiny=n
652
653 MicroBlaze Options -msoft-float -mhard-float -msmall-divides
654 -mcpu=cpu -mmemcpy -mxl-soft-mul -mxl-soft-div -mxl-barrel-shift
655 -mxl-pattern-compare -mxl-stack-check -mxl-gp-opt -mno-clearbss
656 -mxl-multiply-high -mxl-float-convert -mxl-float-sqrt
657 -mbig-endian -mlittle-endian -mxl-reorder -mxl-mode-app-model
658 -mpic-data-is-text-relative
659
660 MIPS Options -EL -EB -march=arch -mtune=arch -mips1 -mips2
661 -mips3 -mips4 -mips32 -mips32r2 -mips32r3 -mips32r5 -mips32r6
662 -mips64 -mips64r2 -mips64r3 -mips64r5 -mips64r6 -mips16
663 -mno-mips16 -mflip-mips16 -minterlink-compressed
664 -mno-interlink-compressed -minterlink-mips16 -mno-interlink-mips16
665 -mabi=abi -mabicalls -mno-abicalls -mshared -mno-shared -mplt
666 -mno-plt -mxgot -mno-xgot -mgp32 -mgp64 -mfp32 -mfpxx -mfp64
667 -mhard-float -msoft-float -mno-float -msingle-float
668 -mdouble-float -modd-spreg -mno-odd-spreg -mabs=mode
669 -mnan=encoding -mdsp -mno-dsp -mdspr2 -mno-dspr2 -mmcu
670 -mmno-mcu -meva -mno-eva -mvirt -mno-virt -mxpa -mno-xpa -mcrc
671 -mno-crc -mginv -mno-ginv -mmicromips -mno-micromips -mmsa
672 -mno-msa -mloongson-mmi -mno-loongson-mmi -mloongson-ext
673 -mno-loongson-ext -mloongson-ext2 -mno-loongson-ext2 -mfpu=fpu-
674 type -msmartmips -mno-smartmips -mpaired-single
675 -mno-paired-single -mdmx -mno-mdmx -mips3d -mno-mips3d -mmt
676 -mno-mt -mllsc -mno-llsc -mlong64 -mlong32 -msym32 -mno-sym32
677 -Gnum -mlocal-sdata -mno-local-sdata -mextern-sdata
678 -mno-extern-sdata -mgpopt -mno-gopt -membedded-data
679 -mno-embedded-data -muninit-const-in-rodata
680 -mno-uninit-const-in-rodata -mcode-readable=setting
681 -msplit-addresses -mno-split-addresses -mexplicit-relocs
682 -mno-explicit-relocs -mcheck-zero-division
683 -mno-check-zero-division -mdivide-traps -mdivide-breaks
684 -mload-store-pairs -mno-load-store-pairs -mmemcpy -mno-memcpy
685 -mlong-calls -mno-long-calls -mmad -mno-mad -mimadd -mno-imadd
686 -mfused-madd -mno-fused-madd -nocpp -mfix-24k -mno-fix-24k
687 -mfix-r4000 -mno-fix-r4000 -mfix-r4400 -mno-fix-r4400
688 -mfix-r5900 -mno-fix-r5900 -mfix-r10000 -mno-fix-r10000
689 -mfix-rm7000 -mno-fix-rm7000 -mfix-vr4120 -mno-fix-vr4120
690 -mfix-vr4130 -mno-fix-vr4130 -mfix-sb1 -mno-fix-sb1
691 -mflush-func=func -mno-flush-func -mbranch-cost=num
692 -mbranch-likely -mno-branch-likely -mcompact-branches=policy
693 -mfp-exceptions -mno-fp-exceptions -mvr4130-align
694 -mno-vr4130-align -msynci -mno-synci -mlxc1-sxc1 -mno-lxc1-sxc1
695 -mmadd4 -mno-madd4 -mrelax-pic-calls -mno-relax-pic-calls
696 -mmcount-ra-address -mframe-header-opt -mno-frame-header-opt
697
698 MMIX Options -mlibfuncs -mno-libfuncs -mepsilon -mno-epsilon
699 -mabi=gnu -mabi=mmixware -mzero-extend -mknuthdiv
700 -mtoplevel-symbols -melf -mbranch-predict -mno-branch-predict
701 -mbase-addresses -mno-base-addresses -msingle-exit
702 -mno-single-exit
703
704 MN10300 Options -mmult-bug -mno-mult-bug -mno-am33 -mam33
705 -mam33-2 -mam34 -mtune=cpu-type -mreturn-pointer-on-d0 -mno-crt0
706 -mrelax -mliw -msetlb
707
708 Moxie Options -meb -mel -mmul.x -mno-crt0
709
710 MSP430 Options -msim -masm-hex -mmcu= -mcpu= -mlarge -msmall
711 -mrelax -mwarn-mcu -mcode-region= -mdata-region= -msilicon-errata=
712 -msilicon-errata-warn= -mhwmult= -minrt -mtiny-printf
713
714 NDS32 Options -mbig-endian -mlittle-endian -mreduced-regs
715 -mfull-regs -mcmov -mno-cmov -mext-perf -mno-ext-perf -mext-perf2
716 -mno-ext-perf2 -mext-string -mno-ext-string -mv3push -mno-v3push
717 -m16bit -mno-16bit -misr-vector-size=num -mcache-block-size=num
718 -march=arch -mcmodel=code-model -mctor-dtor -mrelax
719
720 Nios II Options -G num -mgpopt=option -mgpopt -mno-gpopt
721 -mgprel-sec=regexp -mr0rel-sec=regexp -mel -meb -mno-bypass-cache
722 -mbypass-cache -mno-cache-volatile -mcache-volatile
723 -mno-fast-sw-div -mfast-sw-div -mhw-mul -mno-hw-mul -mhw-mulx
724 -mno-hw-mulx -mno-hw-div -mhw-div -mcustom-insn=N
725 -mno-custom-insn -mcustom-fpu-cfg=name -mhal -msmallc
726 -msys-crt0=name -msys-lib=name -march=arch -mbmx -mno-bmx -mcdx
727 -mno-cdx
728
729 Nvidia PTX Options -m32 -m64 -mmainkernel -moptimize
730
731 OpenRISC Options -mboard=name -mnewlib -mhard-mul -mhard-div
732 -msoft-mul -msoft-div -msoft-float -mhard-float -mdouble-float
733 -munordered-float -mcmov -mror -mrori -msext -msfimm -mshftimm
734
735 PDP-11 Options -mfpu -msoft-float -mac0 -mno-ac0 -m40 -m45
736 -m10 -mint32 -mno-int16 -mint16 -mno-int32 -msplit -munix-asm
737 -mdec-asm -mgnu-asm -mlra
738
739 picoChip Options -mae=ae_type -mvliw-lookahead=N
740 -msymbol-as-address -mno-inefficient-warnings
741
742 PowerPC Options See RS/6000 and PowerPC Options.
743
744 PRU Options -mmcu=mcu -minrt -mno-relax -mloop -mabi=variant
745
746 RISC-V Options -mbranch-cost=N-instruction -mplt -mno-plt
747 -mabi=ABI-string -mfdiv -mno-fdiv -mdiv -mno-div -march=ISA-
748 string -mtune=processor-string -mpreferred-stack-boundary=num
749 -msmall-data-limit=N-bytes -msave-restore -mno-save-restore
750 -mstrict-align -mno-strict-align -mcmodel=medlow -mcmodel=medany
751 -mexplicit-relocs -mno-explicit-relocs -mrelax -mno-relax
752 -mriscv-attribute -mmo-riscv-attribute -malign-data=type
753
754 RL78 Options -msim -mmul=none -mmul=g13 -mmul=g14 -mallregs
755 -mcpu=g10 -mcpu=g13 -mcpu=g14 -mg10 -mg13 -mg14
756 -m64bit-doubles -m32bit-doubles -msave-mduc-in-interrupts
757
758 RS/6000 and PowerPC Options -mcpu=cpu-type -mtune=cpu-type
759 -mcmodel=code-model -mpowerpc64 -maltivec -mno-altivec
760 -mpowerpc-gpopt -mno-powerpc-gpopt -mpowerpc-gfxopt
761 -mno-powerpc-gfxopt -mmfcrf -mno-mfcrf -mpopcntb -mno-popcntb
762 -mpopcntd -mno-popcntd -mfprnd -mno-fprnd -mcmpb -mno-cmpb
763 -mhard-dfp -mno-hard-dfp -mfull-toc -mminimal-toc
764 -mno-fp-in-toc -mno-sum-in-toc -m64 -m32 -mxl-compat
765 -mno-xl-compat -mpe -malign-power -malign-natural -msoft-float
766 -mhard-float -mmultiple -mno-multiple -mupdate -mno-update
767 -mavoid-indexed-addresses -mno-avoid-indexed-addresses
768 -mfused-madd -mno-fused-madd -mbit-align -mno-bit-align
769 -mstrict-align -mno-strict-align -mrelocatable -mno-relocatable
770 -mrelocatable-lib -mno-relocatable-lib -mtoc -mno-toc -mlittle
771 -mlittle-endian -mbig -mbig-endian -mdynamic-no-pic -mswdiv
772 -msingle-pic-base -mprioritize-restricted-insns=priority
773 -msched-costly-dep=dependence_type -minsert-sched-nops=scheme
774 -mcall-aixdesc -mcall-eabi -mcall-freebsd -mcall-linux
775 -mcall-netbsd -mcall-openbsd -mcall-sysv -mcall-sysv-eabi
776 -mcall-sysv-noeabi -mtraceback=traceback_type -maix-struct-return
777 -msvr4-struct-return -mabi=abi-type -msecure-plt -mbss-plt
778 -mlongcall -mno-longcall -mpltseq -mno-pltseq
779 -mblock-move-inline-limit=num -mblock-compare-inline-limit=num
780 -mblock-compare-inline-loop-limit=num
781 -mstring-compare-inline-limit=num -misel -mno-isel -mvrsave
782 -mno-vrsave -mmulhw -mno-mulhw -mdlmzb -mno-dlmzb -mprototype
783 -mno-prototype -msim -mmvme -mads -myellowknife -memb -msdata
784 -msdata=opt -mreadonly-in-sdata -mvxworks -G num -mrecip
785 -mrecip=opt -mno-recip -mrecip-precision -mno-recip-precision
786 -mveclibabi=type -mfriz -mno-friz -mpointers-to-nested-functions
787 -mno-pointers-to-nested-functions -msave-toc-indirect
788 -mno-save-toc-indirect -mpower8-fusion -mno-mpower8-fusion
789 -mpower8-vector -mno-power8-vector -mcrypto -mno-crypto -mhtm
790 -mno-htm -mquad-memory -mno-quad-memory -mquad-memory-atomic
791 -mno-quad-memory-atomic -mcompat-align-parm -mno-compat-align-parm
792 -mfloat128 -mno-float128 -mfloat128-hardware
793 -mno-float128-hardware -mgnu-attribute -mno-gnu-attribute
794 -mstack-protector-guard=guard -mstack-protector-guard-reg=reg
795 -mstack-protector-guard-offset=offset -mprefixed -mno-prefixed
796 -mpcrel -mno-pcrel -mmma -mno-mmma
797
798 RX Options -m64bit-doubles -m32bit-doubles -fpu -nofpu -mcpu=
799 -mbig-endian-data -mlittle-endian-data -msmall-data -msim
800 -mno-sim -mas100-syntax -mno-as100-syntax -mrelax
801 -mmax-constant-size= -mint-register= -mpid -mallow-string-insns
802 -mno-allow-string-insns -mjsr -mno-warn-multiple-fast-interrupts
803 -msave-acc-in-interrupts
804
805 S/390 and zSeries Options -mtune=cpu-type -march=cpu-type
806 -mhard-float -msoft-float -mhard-dfp -mno-hard-dfp
807 -mlong-double-64 -mlong-double-128 -mbackchain -mno-backchain
808 -mpacked-stack -mno-packed-stack -msmall-exec -mno-small-exec
809 -mmvcle -mno-mvcle -m64 -m31 -mdebug -mno-debug -mesa -mzarch
810 -mhtm -mvx -mzvector -mtpf-trace -mno-tpf-trace
811 -mtpf-trace-skip -mno-tpf-trace-skip -mfused-madd -mno-fused-madd
812 -mwarn-framesize -mwarn-dynamicstack -mstack-size -mstack-guard
813 -mhotpatch=halfwords,halfwords
814
815 Score Options -meb -mel -mnhwloop -muls -mmac -mscore5 -mscore5u
816 -mscore7 -mscore7d
817
818 SH Options -m1 -m2 -m2e -m2a-nofpu -m2a-single-only -m2a-single
819 -m2a -m3 -m3e -m4-nofpu -m4-single-only -m4-single -m4
820 -m4a-nofpu -m4a-single-only -m4a-single -m4a -m4al -mb -ml
821 -mdalign -mrelax -mbigtable -mfmovd -mrenesas -mno-renesas
822 -mnomacsave -mieee -mno-ieee -mbitops -misize
823 -minline-ic_invalidate -mpadstruct -mprefergot -musermode
824 -multcost=number -mdiv=strategy -mdivsi3_libfunc=name
825 -mfixed-range=register-range -maccumulate-outgoing-args
826 -matomic-model=atomic-model -mbranch-cost=num -mzdcbranch
827 -mno-zdcbranch -mcbranch-force-delay-slot -mfused-madd
828 -mno-fused-madd -mfsca -mno-fsca -mfsrra -mno-fsrra
829 -mpretend-cmove -mtas
830
831 Solaris 2 Options -mclear-hwcap -mno-clear-hwcap -mimpure-text
832 -mno-impure-text -pthreads
833
834 SPARC Options -mcpu=cpu-type -mtune=cpu-type -mcmodel=code-model
835 -mmemory-model=mem-model -m32 -m64 -mapp-regs -mno-app-regs
836 -mfaster-structs -mno-faster-structs -mflat -mno-flat -mfpu
837 -mno-fpu -mhard-float -msoft-float -mhard-quad-float
838 -msoft-quad-float -mstack-bias -mno-stack-bias -mstd-struct-return
839 -mno-std-struct-return -munaligned-doubles -mno-unaligned-doubles
840 -muser-mode -mno-user-mode -mv8plus -mno-v8plus -mvis -mno-vis
841 -mvis2 -mno-vis2 -mvis3 -mno-vis3 -mvis4 -mno-vis4 -mvis4b
842 -mno-vis4b -mcbcond -mno-cbcond -mfmaf -mno-fmaf -mfsmuld
843 -mno-fsmuld -mpopc -mno-popc -msubxc -mno-subxc -mfix-at697f
844 -mfix-ut699 -mfix-ut700 -mfix-gr712rc -mlra -mno-lra
845
846 System V Options -Qy -Qn -YP,paths -Ym,dir
847
848 TILE-Gx Options -mcpu=CPU -m32 -m64 -mbig-endian
849 -mlittle-endian -mcmodel=code-model
850
851 TILEPro Options -mcpu=cpu -m32
852
853 V850 Options -mlong-calls -mno-long-calls -mep -mno-ep
854 -mprolog-function -mno-prolog-function -mspace -mtda=n -msda=n
855 -mzda=n -mapp-regs -mno-app-regs -mdisable-callt
856 -mno-disable-callt -mv850e2v3 -mv850e2 -mv850e1 -mv850es -mv850e
857 -mv850 -mv850e3v5 -mloop -mrelax -mlong-jumps -msoft-float
858 -mhard-float -mgcc-abi -mrh850-abi -mbig-switch
859
860 VAX Options -mg -mgnu -munix
861
862 Visium Options -mdebug -msim -mfpu -mno-fpu -mhard-float
863 -msoft-float -mcpu=cpu-type -mtune=cpu-type -msv-mode
864 -muser-mode
865
866 VMS Options -mvms-return-codes -mdebug-main=prefix -mmalloc64
867 -mpointer-size=size
868
869 VxWorks Options -mrtp -non-static -Bstatic -Bdynamic -Xbind-lazy
870 -Xbind-now
871
872 x86 Options -mtune=cpu-type -march=cpu-type -mtune-ctrl=feature-
873 list -mdump-tune-features -mno-default -mfpmath=unit
874 -masm=dialect -mno-fancy-math-387 -mno-fp-ret-in-387 -m80387
875 -mhard-float -msoft-float -mno-wide-multiply -mrtd
876 -malign-double -mpreferred-stack-boundary=num
877 -mincoming-stack-boundary=num -mcld -mcx16 -msahf -mmovbe
878 -mcrc32 -mrecip -mrecip=opt -mvzeroupper -mprefer-avx128
879 -mprefer-vector-width=opt -mmmx -msse -msse2 -msse3 -mssse3
880 -msse4.1 -msse4.2 -msse4 -mavx -mavx2 -mavx512f -mavx512pf
881 -mavx512er -mavx512cd -mavx512vl -mavx512bw -mavx512dq
882 -mavx512ifma -mavx512vbmi -msha -maes -mpclmul -mfsgsbase
883 -mrdrnd -mf16c -mfma -mpconfig -mwbnoinvd -mptwrite
884 -mprefetchwt1 -mclflushopt -mclwb -mxsavec -mxsaves -msse4a
885 -m3dnow -m3dnowa -mpopcnt -mabm -mbmi -mtbm -mfma4 -mxop
886 -madx -mlzcnt -mbmi2 -mfxsr -mxsave -mxsaveopt -mrtm -mhle
887 -mlwp -mmwaitx -mclzero -mpku -mthreads -mgfni -mvaes
888 -mwaitpkg -mshstk -mmanual-endbr -mforce-indirect-call
889 -mavx512vbmi2 -mavx512bf16 -menqcmd -mvpclmulqdq -mavx512bitalg
890 -mmovdiri -mmovdir64b -mavx512vpopcntdq -mavx5124fmaps
891 -mavx512vnni -mavx5124vnniw -mprfchw -mrdpid -mrdseed -msgx
892 -mavx512vp2intersect -mcldemote -mms-bitfields
893 -mno-align-stringops -minline-all-stringops
894 -minline-stringops-dynamically -mstringop-strategy=alg
895 -mmemcpy-strategy=strategy -mmemset-strategy=strategy -mpush-args
896 -maccumulate-outgoing-args -m128bit-long-double
897 -m96bit-long-double -mlong-double-64 -mlong-double-80
898 -mlong-double-128 -mregparm=num -msseregparm -mveclibabi=type
899 -mvect8-ret-in-mem -mpc32 -mpc64 -mpc80 -mstackrealign
900 -momit-leaf-frame-pointer -mno-red-zone -mno-tls-direct-seg-refs
901 -mcmodel=code-model -mabi=name -maddress-mode=mode -m32 -m64
902 -mx32 -m16 -miamcu -mlarge-data-threshold=num -msse2avx
903 -mfentry -mrecord-mcount -mnop-mcount -m8bit-idiv
904 -minstrument-return=type -mfentry-name=name -mfentry-section=name
905 -mavx256-split-unaligned-load -mavx256-split-unaligned-store
906 -malign-data=type -mstack-protector-guard=guard
907 -mstack-protector-guard-reg=reg
908 -mstack-protector-guard-offset=offset
909 -mstack-protector-guard-symbol=symbol -mgeneral-regs-only
910 -mcall-ms2sysv-xlogues -mindirect-branch=choice
911 -mfunction-return=choice -mindirect-branch-register
912
913 x86 Windows Options -mconsole -mcygwin -mno-cygwin -mdll
914 -mnop-fun-dllimport -mthread -municode -mwin32 -mwindows
915 -fno-set-stack-executable
916
917 Xstormy16 Options -msim
918
919 Xtensa Options -mconst16 -mno-const16 -mfused-madd
920 -mno-fused-madd -mforce-no-pic -mserialize-volatile
921 -mno-serialize-volatile -mtext-section-literals
922 -mno-text-section-literals -mauto-litpools -mno-auto-litpools
923 -mtarget-align -mno-target-align -mlongcalls -mno-longcalls
924
925 zSeries Options See S/390 and zSeries Options.
926
927 Options Controlling the Kind of Output
928 Compilation can involve up to four stages: preprocessing, compilation
929 proper, assembly and linking, always in that order. GCC is capable of
930 preprocessing and compiling several files either into several assembler
931 input files, or into one assembler input file; then each assembler
932 input file produces an object file, and linking combines all the object
933 files (those newly compiled, and those specified as input) into an
934 executable file.
935
936 For any given input file, the file name suffix determines what kind of
937 compilation is done:
938
939 file.c
940 C source code that must be preprocessed.
941
942 file.i
943 C source code that should not be preprocessed.
944
945 file.ii
946 C++ source code that should not be preprocessed.
947
948 file.m
949 Objective-C source code. Note that you must link with the libobjc
950 library to make an Objective-C program work.
951
952 file.mi
953 Objective-C source code that should not be preprocessed.
954
955 file.mm
956 file.M
957 Objective-C++ source code. Note that you must link with the
958 libobjc library to make an Objective-C++ program work. Note that
959 .M refers to a literal capital M.
960
961 file.mii
962 Objective-C++ source code that should not be preprocessed.
963
964 file.h
965 C, C++, Objective-C or Objective-C++ header file to be turned into
966 a precompiled header (default), or C, C++ header file to be turned
967 into an Ada spec (via the -fdump-ada-spec switch).
968
969 file.cc
970 file.cp
971 file.cxx
972 file.cpp
973 file.CPP
974 file.c++
975 file.C
976 C++ source code that must be preprocessed. Note that in .cxx, the
977 last two letters must both be literally x. Likewise, .C refers to
978 a literal capital C.
979
980 file.mm
981 file.M
982 Objective-C++ source code that must be preprocessed.
983
984 file.mii
985 Objective-C++ source code that should not be preprocessed.
986
987 file.hh
988 file.H
989 file.hp
990 file.hxx
991 file.hpp
992 file.HPP
993 file.h++
994 file.tcc
995 C++ header file to be turned into a precompiled header or Ada spec.
996
997 file.f
998 file.for
999 file.ftn
1000 Fixed form Fortran source code that should not be preprocessed.
1001
1002 file.F
1003 file.FOR
1004 file.fpp
1005 file.FPP
1006 file.FTN
1007 Fixed form Fortran source code that must be preprocessed (with the
1008 traditional preprocessor).
1009
1010 file.f90
1011 file.f95
1012 file.f03
1013 file.f08
1014 Free form Fortran source code that should not be preprocessed.
1015
1016 file.F90
1017 file.F95
1018 file.F03
1019 file.F08
1020 Free form Fortran source code that must be preprocessed (with the
1021 traditional preprocessor).
1022
1023 file.go
1024 Go source code.
1025
1026 file.brig
1027 BRIG files (binary representation of HSAIL).
1028
1029 file.d
1030 D source code.
1031
1032 file.di
1033 D interface file.
1034
1035 file.dd
1036 D documentation code (Ddoc).
1037
1038 file.ads
1039 Ada source code file that contains a library unit declaration (a
1040 declaration of a package, subprogram, or generic, or a generic
1041 instantiation), or a library unit renaming declaration (a package,
1042 generic, or subprogram renaming declaration). Such files are also
1043 called specs.
1044
1045 file.adb
1046 Ada source code file containing a library unit body (a subprogram
1047 or package body). Such files are also called bodies.
1048
1049 file.s
1050 Assembler code.
1051
1052 file.S
1053 file.sx
1054 Assembler code that must be preprocessed.
1055
1056 other
1057 An object file to be fed straight into linking. Any file name with
1058 no recognized suffix is treated this way.
1059
1060 You can specify the input language explicitly with the -x option:
1061
1062 -x language
1063 Specify explicitly the language for the following input files
1064 (rather than letting the compiler choose a default based on the
1065 file name suffix). This option applies to all following input
1066 files until the next -x option. Possible values for language are:
1067
1068 c c-header cpp-output
1069 c++ c++-header c++-cpp-output
1070 objective-c objective-c-header objective-c-cpp-output
1071 objective-c++ objective-c++-header objective-c++-cpp-output
1072 assembler assembler-with-cpp
1073 ada
1074 d
1075 f77 f77-cpp-input f95 f95-cpp-input
1076 go
1077 brig
1078
1079 -x none
1080 Turn off any specification of a language, so that subsequent files
1081 are handled according to their file name suffixes (as they are if
1082 -x has not been used at all).
1083
1084 If you only want some of the stages of compilation, you can use -x (or
1085 filename suffixes) to tell gcc where to start, and one of the options
1086 -c, -S, or -E to say where gcc is to stop. Note that some combinations
1087 (for example, -x cpp-output -E) instruct gcc to do nothing at all.
1088
1089 -c Compile or assemble the source files, but do not link. The linking
1090 stage simply is not done. The ultimate output is in the form of an
1091 object file for each source file.
1092
1093 By default, the object file name for a source file is made by
1094 replacing the suffix .c, .i, .s, etc., with .o.
1095
1096 Unrecognized input files, not requiring compilation or assembly,
1097 are ignored.
1098
1099 -S Stop after the stage of compilation proper; do not assemble. The
1100 output is in the form of an assembler code file for each non-
1101 assembler input file specified.
1102
1103 By default, the assembler file name for a source file is made by
1104 replacing the suffix .c, .i, etc., with .s.
1105
1106 Input files that don't require compilation are ignored.
1107
1108 -E Stop after the preprocessing stage; do not run the compiler proper.
1109 The output is in the form of preprocessed source code, which is
1110 sent to the standard output.
1111
1112 Input files that don't require preprocessing are ignored.
1113
1114 -o file
1115 Place output in file file. This applies to whatever sort of output
1116 is being produced, whether it be an executable file, an object
1117 file, an assembler file or preprocessed C code.
1118
1119 If -o is not specified, the default is to put an executable file in
1120 a.out, the object file for source.suffix in source.o, its assembler
1121 file in source.s, a precompiled header file in source.suffix.gch,
1122 and all preprocessed C source on standard output.
1123
1124 -v Print (on standard error output) the commands executed to run the
1125 stages of compilation. Also print the version number of the
1126 compiler driver program and of the preprocessor and the compiler
1127 proper.
1128
1129 -###
1130 Like -v except the commands are not executed and arguments are
1131 quoted unless they contain only alphanumeric characters or "./-_".
1132 This is useful for shell scripts to capture the driver-generated
1133 command lines.
1134
1135 --help
1136 Print (on the standard output) a description of the command-line
1137 options understood by gcc. If the -v option is also specified then
1138 --help is also passed on to the various processes invoked by gcc,
1139 so that they can display the command-line options they accept. If
1140 the -Wextra option has also been specified (prior to the --help
1141 option), then command-line options that have no documentation
1142 associated with them are also displayed.
1143
1144 --target-help
1145 Print (on the standard output) a description of target-specific
1146 command-line options for each tool. For some targets extra target-
1147 specific information may also be printed.
1148
1149 --help={class|[^]qualifier}[,...]
1150 Print (on the standard output) a description of the command-line
1151 options understood by the compiler that fit into all specified
1152 classes and qualifiers. These are the supported classes:
1153
1154 optimizers
1155 Display all of the optimization options supported by the
1156 compiler.
1157
1158 warnings
1159 Display all of the options controlling warning messages
1160 produced by the compiler.
1161
1162 target
1163 Display target-specific options. Unlike the --target-help
1164 option however, target-specific options of the linker and
1165 assembler are not displayed. This is because those tools do
1166 not currently support the extended --help= syntax.
1167
1168 params
1169 Display the values recognized by the --param option.
1170
1171 language
1172 Display the options supported for language, where language is
1173 the name of one of the languages supported in this version of
1174 GCC. If an option is supported by all languages, one needs to
1175 select common class.
1176
1177 common
1178 Display the options that are common to all languages.
1179
1180 These are the supported qualifiers:
1181
1182 undocumented
1183 Display only those options that are undocumented.
1184
1185 joined
1186 Display options taking an argument that appears after an equal
1187 sign in the same continuous piece of text, such as:
1188 --help=target.
1189
1190 separate
1191 Display options taking an argument that appears as a separate
1192 word following the original option, such as: -o output-file.
1193
1194 Thus for example to display all the undocumented target-specific
1195 switches supported by the compiler, use:
1196
1197 --help=target,undocumented
1198
1199 The sense of a qualifier can be inverted by prefixing it with the ^
1200 character, so for example to display all binary warning options
1201 (i.e., ones that are either on or off and that do not take an
1202 argument) that have a description, use:
1203
1204 --help=warnings,^joined,^undocumented
1205
1206 The argument to --help= should not consist solely of inverted
1207 qualifiers.
1208
1209 Combining several classes is possible, although this usually
1210 restricts the output so much that there is nothing to display. One
1211 case where it does work, however, is when one of the classes is
1212 target. For example, to display all the target-specific
1213 optimization options, use:
1214
1215 --help=target,optimizers
1216
1217 The --help= option can be repeated on the command line. Each
1218 successive use displays its requested class of options, skipping
1219 those that have already been displayed. If --help is also
1220 specified anywhere on the command line then this takes precedence
1221 over any --help= option.
1222
1223 If the -Q option appears on the command line before the --help=
1224 option, then the descriptive text displayed by --help= is changed.
1225 Instead of describing the displayed options, an indication is given
1226 as to whether the option is enabled, disabled or set to a specific
1227 value (assuming that the compiler knows this at the point where the
1228 --help= option is used).
1229
1230 Here is a truncated example from the ARM port of gcc:
1231
1232 % gcc -Q -mabi=2 --help=target -c
1233 The following options are target specific:
1234 -mabi= 2
1235 -mabort-on-noreturn [disabled]
1236 -mapcs [disabled]
1237
1238 The output is sensitive to the effects of previous command-line
1239 options, so for example it is possible to find out which
1240 optimizations are enabled at -O2 by using:
1241
1242 -Q -O2 --help=optimizers
1243
1244 Alternatively you can discover which binary optimizations are
1245 enabled by -O3 by using:
1246
1247 gcc -c -Q -O3 --help=optimizers > /tmp/O3-opts
1248 gcc -c -Q -O2 --help=optimizers > /tmp/O2-opts
1249 diff /tmp/O2-opts /tmp/O3-opts | grep enabled
1250
1251 --version
1252 Display the version number and copyrights of the invoked GCC.
1253
1254 -pass-exit-codes
1255 Normally the gcc program exits with the code of 1 if any phase of
1256 the compiler returns a non-success return code. If you specify
1257 -pass-exit-codes, the gcc program instead returns with the
1258 numerically highest error produced by any phase returning an error
1259 indication. The C, C++, and Fortran front ends return 4 if an
1260 internal compiler error is encountered.
1261
1262 -pipe
1263 Use pipes rather than temporary files for communication between the
1264 various stages of compilation. This fails to work on some systems
1265 where the assembler is unable to read from a pipe; but the GNU
1266 assembler has no trouble.
1267
1268 -specs=file
1269 Process file after the compiler reads in the standard specs file,
1270 in order to override the defaults which the gcc driver program uses
1271 when determining what switches to pass to cc1, cc1plus, as, ld,
1272 etc. More than one -specs=file can be specified on the command
1273 line, and they are processed in order, from left to right.
1274
1275 -wrapper
1276 Invoke all subcommands under a wrapper program. The name of the
1277 wrapper program and its parameters are passed as a comma separated
1278 list.
1279
1280 gcc -c t.c -wrapper gdb,--args
1281
1282 This invokes all subprograms of gcc under gdb --args, thus the
1283 invocation of cc1 is gdb --args cc1 ....
1284
1285 -ffile-prefix-map=old=new
1286 When compiling files residing in directory old, record any
1287 references to them in the result of the compilation as if the files
1288 resided in directory new instead. Specifying this option is
1289 equivalent to specifying all the individual -f*-prefix-map options.
1290 This can be used to make reproducible builds that are location
1291 independent. See also -fmacro-prefix-map and -fdebug-prefix-map.
1292
1293 -fplugin=name.so
1294 Load the plugin code in file name.so, assumed to be a shared object
1295 to be dlopen'd by the compiler. The base name of the shared object
1296 file is used to identify the plugin for the purposes of argument
1297 parsing (See -fplugin-arg-name-key=value below). Each plugin
1298 should define the callback functions specified in the Plugins API.
1299
1300 -fplugin-arg-name-key=value
1301 Define an argument called key with a value of value for the plugin
1302 called name.
1303
1304 -fdump-ada-spec[-slim]
1305 For C and C++ source and include files, generate corresponding Ada
1306 specs.
1307
1308 -fada-spec-parent=unit
1309 In conjunction with -fdump-ada-spec[-slim] above, generate Ada
1310 specs as child units of parent unit.
1311
1312 -fdump-go-spec=file
1313 For input files in any language, generate corresponding Go
1314 declarations in file. This generates Go "const", "type", "var",
1315 and "func" declarations which may be a useful way to start writing
1316 a Go interface to code written in some other language.
1317
1318 @file
1319 Read command-line options from file. The options read are inserted
1320 in place of the original @file option. If file does not exist, or
1321 cannot be read, then the option will be treated literally, and not
1322 removed.
1323
1324 Options in file are separated by whitespace. A whitespace
1325 character may be included in an option by surrounding the entire
1326 option in either single or double quotes. Any character (including
1327 a backslash) may be included by prefixing the character to be
1328 included with a backslash. The file may itself contain additional
1329 @file options; any such options will be processed recursively.
1330
1331 Compiling C++ Programs
1332 C++ source files conventionally use one of the suffixes .C, .cc, .cpp,
1333 .CPP, .c++, .cp, or .cxx; C++ header files often use .hh, .hpp, .H, or
1334 (for shared template code) .tcc; and preprocessed C++ files use the
1335 suffix .ii. GCC recognizes files with these names and compiles them as
1336 C++ programs even if you call the compiler the same way as for
1337 compiling C programs (usually with the name gcc).
1338
1339 However, the use of gcc does not add the C++ library. g++ is a program
1340 that calls GCC and automatically specifies linking against the C++
1341 library. It treats .c, .h and .i files as C++ source files instead of
1342 C source files unless -x is used. This program is also useful when
1343 precompiling a C header file with a .h extension for use in C++
1344 compilations. On many systems, g++ is also installed with the name
1345 c++.
1346
1347 When you compile C++ programs, you may specify many of the same
1348 command-line options that you use for compiling programs in any
1349 language; or command-line options meaningful for C and related
1350 languages; or options that are meaningful only for C++ programs.
1351
1352 Options Controlling C Dialect
1353 The following options control the dialect of C (or languages derived
1354 from C, such as C++, Objective-C and Objective-C++) that the compiler
1355 accepts:
1356
1357 -ansi
1358 In C mode, this is equivalent to -std=c90. In C++ mode, it is
1359 equivalent to -std=c++98.
1360
1361 This turns off certain features of GCC that are incompatible with
1362 ISO C90 (when compiling C code), or of standard C++ (when compiling
1363 C++ code), such as the "asm" and "typeof" keywords, and predefined
1364 macros such as "unix" and "vax" that identify the type of system
1365 you are using. It also enables the undesirable and rarely used ISO
1366 trigraph feature. For the C compiler, it disables recognition of
1367 C++ style // comments as well as the "inline" keyword.
1368
1369 The alternate keywords "__asm__", "__extension__", "__inline__" and
1370 "__typeof__" continue to work despite -ansi. You would not want to
1371 use them in an ISO C program, of course, but it is useful to put
1372 them in header files that might be included in compilations done
1373 with -ansi. Alternate predefined macros such as "__unix__" and
1374 "__vax__" are also available, with or without -ansi.
1375
1376 The -ansi option does not cause non-ISO programs to be rejected
1377 gratuitously. For that, -Wpedantic is required in addition to
1378 -ansi.
1379
1380 The macro "__STRICT_ANSI__" is predefined when the -ansi option is
1381 used. Some header files may notice this macro and refrain from
1382 declaring certain functions or defining certain macros that the ISO
1383 standard doesn't call for; this is to avoid interfering with any
1384 programs that might use these names for other things.
1385
1386 Functions that are normally built in but do not have semantics
1387 defined by ISO C (such as "alloca" and "ffs") are not built-in
1388 functions when -ansi is used.
1389
1390 -std=
1391 Determine the language standard. This option is currently only
1392 supported when compiling C or C++.
1393
1394 The compiler can accept several base standards, such as c90 or
1395 c++98, and GNU dialects of those standards, such as gnu90 or
1396 gnu++98. When a base standard is specified, the compiler accepts
1397 all programs following that standard plus those using GNU
1398 extensions that do not contradict it. For example, -std=c90 turns
1399 off certain features of GCC that are incompatible with ISO C90,
1400 such as the "asm" and "typeof" keywords, but not other GNU
1401 extensions that do not have a meaning in ISO C90, such as omitting
1402 the middle term of a "?:" expression. On the other hand, when a GNU
1403 dialect of a standard is specified, all features supported by the
1404 compiler are enabled, even when those features change the meaning
1405 of the base standard. As a result, some strict-conforming programs
1406 may be rejected. The particular standard is used by -Wpedantic to
1407 identify which features are GNU extensions given that version of
1408 the standard. For example -std=gnu90 -Wpedantic warns about C++
1409 style // comments, while -std=gnu99 -Wpedantic does not.
1410
1411 A value for this option must be provided; possible values are
1412
1413 c90
1414 c89
1415 iso9899:1990
1416 Support all ISO C90 programs (certain GNU extensions that
1417 conflict with ISO C90 are disabled). Same as -ansi for C code.
1418
1419 iso9899:199409
1420 ISO C90 as modified in amendment 1.
1421
1422 c99
1423 c9x
1424 iso9899:1999
1425 iso9899:199x
1426 ISO C99. This standard is substantially completely supported,
1427 modulo bugs and floating-point issues (mainly but not entirely
1428 relating to optional C99 features from Annexes F and G). See
1429 <http://gcc.gnu.org/c99status.html> for more information. The
1430 names c9x and iso9899:199x are deprecated.
1431
1432 c11
1433 c1x
1434 iso9899:2011
1435 ISO C11, the 2011 revision of the ISO C standard. This
1436 standard is substantially completely supported, modulo bugs,
1437 floating-point issues (mainly but not entirely relating to
1438 optional C11 features from Annexes F and G) and the optional
1439 Annexes K (Bounds-checking interfaces) and L (Analyzability).
1440 The name c1x is deprecated.
1441
1442 c17
1443 c18
1444 iso9899:2017
1445 iso9899:2018
1446 ISO C17, the 2017 revision of the ISO C standard (published in
1447 2018). This standard is same as C11 except for corrections of
1448 defects (all of which are also applied with -std=c11) and a new
1449 value of "__STDC_VERSION__", and so is supported to the same
1450 extent as C11.
1451
1452 c2x The next version of the ISO C standard, still under
1453 development. The support for this version is experimental and
1454 incomplete.
1455
1456 gnu90
1457 gnu89
1458 GNU dialect of ISO C90 (including some C99 features).
1459
1460 gnu99
1461 gnu9x
1462 GNU dialect of ISO C99. The name gnu9x is deprecated.
1463
1464 gnu11
1465 gnu1x
1466 GNU dialect of ISO C11. The name gnu1x is deprecated.
1467
1468 gnu17
1469 gnu18
1470 GNU dialect of ISO C17. This is the default for C code.
1471
1472 gnu2x
1473 The next version of the ISO C standard, still under
1474 development, plus GNU extensions. The support for this version
1475 is experimental and incomplete.
1476
1477 c++98
1478 c++03
1479 The 1998 ISO C++ standard plus the 2003 technical corrigendum
1480 and some additional defect reports. Same as -ansi for C++ code.
1481
1482 gnu++98
1483 gnu++03
1484 GNU dialect of -std=c++98.
1485
1486 c++11
1487 c++0x
1488 The 2011 ISO C++ standard plus amendments. The name c++0x is
1489 deprecated.
1490
1491 gnu++11
1492 gnu++0x
1493 GNU dialect of -std=c++11. The name gnu++0x is deprecated.
1494
1495 c++14
1496 c++1y
1497 The 2014 ISO C++ standard plus amendments. The name c++1y is
1498 deprecated.
1499
1500 gnu++14
1501 gnu++1y
1502 GNU dialect of -std=c++14. This is the default for C++ code.
1503 The name gnu++1y is deprecated.
1504
1505 c++17
1506 c++1z
1507 The 2017 ISO C++ standard plus amendments. The name c++1z is
1508 deprecated.
1509
1510 gnu++17
1511 gnu++1z
1512 GNU dialect of -std=c++17. The name gnu++1z is deprecated.
1513
1514 c++20
1515 c++2a
1516 The next revision of the ISO C++ standard, planned for 2020.
1517 Support is highly experimental, and will almost certainly
1518 change in incompatible ways in future releases.
1519
1520 gnu++20
1521 gnu++2a
1522 GNU dialect of -std=c++20. Support is highly experimental, and
1523 will almost certainly change in incompatible ways in future
1524 releases.
1525
1526 -fgnu89-inline
1527 The option -fgnu89-inline tells GCC to use the traditional GNU
1528 semantics for "inline" functions when in C99 mode.
1529
1530 Using this option is roughly equivalent to adding the "gnu_inline"
1531 function attribute to all inline functions.
1532
1533 The option -fno-gnu89-inline explicitly tells GCC to use the C99
1534 semantics for "inline" when in C99 or gnu99 mode (i.e., it
1535 specifies the default behavior). This option is not supported in
1536 -std=c90 or -std=gnu90 mode.
1537
1538 The preprocessor macros "__GNUC_GNU_INLINE__" and
1539 "__GNUC_STDC_INLINE__" may be used to check which semantics are in
1540 effect for "inline" functions.
1541
1542 -fpermitted-flt-eval-methods=style
1543 ISO/IEC TS 18661-3 defines new permissible values for
1544 "FLT_EVAL_METHOD" that indicate that operations and constants with
1545 a semantic type that is an interchange or extended format should be
1546 evaluated to the precision and range of that type. These new
1547 values are a superset of those permitted under C99/C11, which does
1548 not specify the meaning of other positive values of
1549 "FLT_EVAL_METHOD". As such, code conforming to C11 may not have
1550 been written expecting the possibility of the new values.
1551
1552 -fpermitted-flt-eval-methods specifies whether the compiler should
1553 allow only the values of "FLT_EVAL_METHOD" specified in C99/C11, or
1554 the extended set of values specified in ISO/IEC TS 18661-3.
1555
1556 style is either "c11" or "ts-18661-3" as appropriate.
1557
1558 The default when in a standards compliant mode (-std=c11 or
1559 similar) is -fpermitted-flt-eval-methods=c11. The default when in
1560 a GNU dialect (-std=gnu11 or similar) is
1561 -fpermitted-flt-eval-methods=ts-18661-3.
1562
1563 -aux-info filename
1564 Output to the given filename prototyped declarations for all
1565 functions declared and/or defined in a translation unit, including
1566 those in header files. This option is silently ignored in any
1567 language other than C.
1568
1569 Besides declarations, the file indicates, in comments, the origin
1570 of each declaration (source file and line), whether the declaration
1571 was implicit, prototyped or unprototyped (I, N for new or O for
1572 old, respectively, in the first character after the line number and
1573 the colon), and whether it came from a declaration or a definition
1574 (C or F, respectively, in the following character). In the case of
1575 function definitions, a K&R-style list of arguments followed by
1576 their declarations is also provided, inside comments, after the
1577 declaration.
1578
1579 -fallow-parameterless-variadic-functions
1580 Accept variadic functions without named parameters.
1581
1582 Although it is possible to define such a function, this is not very
1583 useful as it is not possible to read the arguments. This is only
1584 supported for C as this construct is allowed by C++.
1585
1586 -fno-asm
1587 Do not recognize "asm", "inline" or "typeof" as a keyword, so that
1588 code can use these words as identifiers. You can use the keywords
1589 "__asm__", "__inline__" and "__typeof__" instead. -ansi implies
1590 -fno-asm.
1591
1592 In C++, this switch only affects the "typeof" keyword, since "asm"
1593 and "inline" are standard keywords. You may want to use the
1594 -fno-gnu-keywords flag instead, which has the same effect. In C99
1595 mode (-std=c99 or -std=gnu99), this switch only affects the "asm"
1596 and "typeof" keywords, since "inline" is a standard keyword in ISO
1597 C99.
1598
1599 -fno-builtin
1600 -fno-builtin-function
1601 Don't recognize built-in functions that do not begin with
1602 __builtin_ as prefix.
1603
1604 GCC normally generates special code to handle certain built-in
1605 functions more efficiently; for instance, calls to "alloca" may
1606 become single instructions which adjust the stack directly, and
1607 calls to "memcpy" may become inline copy loops. The resulting code
1608 is often both smaller and faster, but since the function calls no
1609 longer appear as such, you cannot set a breakpoint on those calls,
1610 nor can you change the behavior of the functions by linking with a
1611 different library. In addition, when a function is recognized as a
1612 built-in function, GCC may use information about that function to
1613 warn about problems with calls to that function, or to generate
1614 more efficient code, even if the resulting code still contains
1615 calls to that function. For example, warnings are given with
1616 -Wformat for bad calls to "printf" when "printf" is built in and
1617 "strlen" is known not to modify global memory.
1618
1619 With the -fno-builtin-function option only the built-in function
1620 function is disabled. function must not begin with __builtin_. If
1621 a function is named that is not built-in in this version of GCC,
1622 this option is ignored. There is no corresponding
1623 -fbuiltin-function option; if you wish to enable built-in functions
1624 selectively when using -fno-builtin or -ffreestanding, you may
1625 define macros such as:
1626
1627 #define abs(n) __builtin_abs ((n))
1628 #define strcpy(d, s) __builtin_strcpy ((d), (s))
1629
1630 -fgimple
1631 Enable parsing of function definitions marked with "__GIMPLE".
1632 This is an experimental feature that allows unit testing of GIMPLE
1633 passes.
1634
1635 -fhosted
1636 Assert that compilation targets a hosted environment. This implies
1637 -fbuiltin. A hosted environment is one in which the entire
1638 standard library is available, and in which "main" has a return
1639 type of "int". Examples are nearly everything except a kernel.
1640 This is equivalent to -fno-freestanding.
1641
1642 -ffreestanding
1643 Assert that compilation targets a freestanding environment. This
1644 implies -fno-builtin. A freestanding environment is one in which
1645 the standard library may not exist, and program startup may not
1646 necessarily be at "main". The most obvious example is an OS
1647 kernel. This is equivalent to -fno-hosted.
1648
1649 -fopenacc
1650 Enable handling of OpenACC directives "#pragma acc" in C/C++ and
1651 "!$acc" in Fortran. When -fopenacc is specified, the compiler
1652 generates accelerated code according to the OpenACC Application
1653 Programming Interface v2.6 <https://www.openacc.org>. This option
1654 implies -pthread, and thus is only supported on targets that have
1655 support for -pthread.
1656
1657 -fopenacc-dim=geom
1658 Specify default compute dimensions for parallel offload regions
1659 that do not explicitly specify. The geom value is a triple of
1660 ':'-separated sizes, in order 'gang', 'worker' and, 'vector'. A
1661 size can be omitted, to use a target-specific default value.
1662
1663 -fopenmp
1664 Enable handling of OpenMP directives "#pragma omp" in C/C++ and
1665 "!$omp" in Fortran. When -fopenmp is specified, the compiler
1666 generates parallel code according to the OpenMP Application Program
1667 Interface v4.5 <https://www.openmp.org>. This option implies
1668 -pthread, and thus is only supported on targets that have support
1669 for -pthread. -fopenmp implies -fopenmp-simd.
1670
1671 -fopenmp-simd
1672 Enable handling of OpenMP's SIMD directives with "#pragma omp" in
1673 C/C++ and "!$omp" in Fortran. Other OpenMP directives are ignored.
1674
1675 -fgnu-tm
1676 When the option -fgnu-tm is specified, the compiler generates code
1677 for the Linux variant of Intel's current Transactional Memory ABI
1678 specification document (Revision 1.1, May 6 2009). This is an
1679 experimental feature whose interface may change in future versions
1680 of GCC, as the official specification changes. Please note that
1681 not all architectures are supported for this feature.
1682
1683 For more information on GCC's support for transactional memory,
1684
1685 Note that the transactional memory feature is not supported with
1686 non-call exceptions (-fnon-call-exceptions).
1687
1688 -fms-extensions
1689 Accept some non-standard constructs used in Microsoft header files.
1690
1691 In C++ code, this allows member names in structures to be similar
1692 to previous types declarations.
1693
1694 typedef int UOW;
1695 struct ABC {
1696 UOW UOW;
1697 };
1698
1699 Some cases of unnamed fields in structures and unions are only
1700 accepted with this option.
1701
1702 Note that this option is off for all targets except for x86 targets
1703 using ms-abi.
1704
1705 -fplan9-extensions
1706 Accept some non-standard constructs used in Plan 9 code.
1707
1708 This enables -fms-extensions, permits passing pointers to
1709 structures with anonymous fields to functions that expect pointers
1710 to elements of the type of the field, and permits referring to
1711 anonymous fields declared using a typedef. This is only
1712 supported for C, not C++.
1713
1714 -fcond-mismatch
1715 Allow conditional expressions with mismatched types in the second
1716 and third arguments. The value of such an expression is void.
1717 This option is not supported for C++.
1718
1719 -flax-vector-conversions
1720 Allow implicit conversions between vectors with differing numbers
1721 of elements and/or incompatible element types. This option should
1722 not be used for new code.
1723
1724 -funsigned-char
1725 Let the type "char" be unsigned, like "unsigned char".
1726
1727 Each kind of machine has a default for what "char" should be. It
1728 is either like "unsigned char" by default or like "signed char" by
1729 default.
1730
1731 Ideally, a portable program should always use "signed char" or
1732 "unsigned char" when it depends on the signedness of an object.
1733 But many programs have been written to use plain "char" and expect
1734 it to be signed, or expect it to be unsigned, depending on the
1735 machines they were written for. This option, and its inverse, let
1736 you make such a program work with the opposite default.
1737
1738 The type "char" is always a distinct type from each of "signed
1739 char" or "unsigned char", even though its behavior is always just
1740 like one of those two.
1741
1742 -fsigned-char
1743 Let the type "char" be signed, like "signed char".
1744
1745 Note that this is equivalent to -fno-unsigned-char, which is the
1746 negative form of -funsigned-char. Likewise, the option
1747 -fno-signed-char is equivalent to -funsigned-char.
1748
1749 -fsigned-bitfields
1750 -funsigned-bitfields
1751 -fno-signed-bitfields
1752 -fno-unsigned-bitfields
1753 These options control whether a bit-field is signed or unsigned,
1754 when the declaration does not use either "signed" or "unsigned".
1755 By default, such a bit-field is signed, because this is consistent:
1756 the basic integer types such as "int" are signed types.
1757
1758 -fsso-struct=endianness
1759 Set the default scalar storage order of structures and unions to
1760 the specified endianness. The accepted values are big-endian,
1761 little-endian and native for the native endianness of the target
1762 (the default). This option is not supported for C++.
1763
1764 Warning: the -fsso-struct switch causes GCC to generate code that
1765 is not binary compatible with code generated without it if the
1766 specified endianness is not the native endianness of the target.
1767
1768 Options Controlling C++ Dialect
1769 This section describes the command-line options that are only
1770 meaningful for C++ programs. You can also use most of the GNU compiler
1771 options regardless of what language your program is in. For example,
1772 you might compile a file firstClass.C like this:
1773
1774 g++ -g -fstrict-enums -O -c firstClass.C
1775
1776 In this example, only -fstrict-enums is an option meant only for C++
1777 programs; you can use the other options with any language supported by
1778 GCC.
1779
1780 Some options for compiling C programs, such as -std, are also relevant
1781 for C++ programs.
1782
1783 Here is a list of options that are only for compiling C++ programs:
1784
1785 -fabi-version=n
1786 Use version n of the C++ ABI. The default is version 0.
1787
1788 Version 0 refers to the version conforming most closely to the C++
1789 ABI specification. Therefore, the ABI obtained using version 0
1790 will change in different versions of G++ as ABI bugs are fixed.
1791
1792 Version 1 is the version of the C++ ABI that first appeared in G++
1793 3.2.
1794
1795 Version 2 is the version of the C++ ABI that first appeared in G++
1796 3.4, and was the default through G++ 4.9.
1797
1798 Version 3 corrects an error in mangling a constant address as a
1799 template argument.
1800
1801 Version 4, which first appeared in G++ 4.5, implements a standard
1802 mangling for vector types.
1803
1804 Version 5, which first appeared in G++ 4.6, corrects the mangling
1805 of attribute const/volatile on function pointer types, decltype of
1806 a plain decl, and use of a function parameter in the declaration of
1807 another parameter.
1808
1809 Version 6, which first appeared in G++ 4.7, corrects the promotion
1810 behavior of C++11 scoped enums and the mangling of template
1811 argument packs, const/static_cast, prefix ++ and --, and a class
1812 scope function used as a template argument.
1813
1814 Version 7, which first appeared in G++ 4.8, that treats nullptr_t
1815 as a builtin type and corrects the mangling of lambdas in default
1816 argument scope.
1817
1818 Version 8, which first appeared in G++ 4.9, corrects the
1819 substitution behavior of function types with function-cv-
1820 qualifiers.
1821
1822 Version 9, which first appeared in G++ 5.2, corrects the alignment
1823 of "nullptr_t".
1824
1825 Version 10, which first appeared in G++ 6.1, adds mangling of
1826 attributes that affect type identity, such as ia32 calling
1827 convention attributes (e.g. stdcall).
1828
1829 Version 11, which first appeared in G++ 7, corrects the mangling of
1830 sizeof... expressions and operator names. For multiple entities
1831 with the same name within a function, that are declared in
1832 different scopes, the mangling now changes starting with the
1833 twelfth occurrence. It also implies -fnew-inheriting-ctors.
1834
1835 Version 12, which first appeared in G++ 8, corrects the calling
1836 conventions for empty classes on the x86_64 target and for classes
1837 with only deleted copy/move constructors. It accidentally changes
1838 the calling convention for classes with a deleted copy constructor
1839 and a trivial move constructor.
1840
1841 Version 13, which first appeared in G++ 8.2, fixes the accidental
1842 change in version 12.
1843
1844 Version 14, which first appeared in G++ 10, corrects the mangling
1845 of the nullptr expression.
1846
1847 See also -Wabi.
1848
1849 -fabi-compat-version=n
1850 On targets that support strong aliases, G++ works around mangling
1851 changes by creating an alias with the correct mangled name when
1852 defining a symbol with an incorrect mangled name. This switch
1853 specifies which ABI version to use for the alias.
1854
1855 With -fabi-version=0 (the default), this defaults to 11 (GCC 7
1856 compatibility). If another ABI version is explicitly selected,
1857 this defaults to 0. For compatibility with GCC versions 3.2
1858 through 4.9, use -fabi-compat-version=2.
1859
1860 If this option is not provided but -Wabi=n is, that version is used
1861 for compatibility aliases. If this option is provided along with
1862 -Wabi (without the version), the version from this option is used
1863 for the warning.
1864
1865 -fno-access-control
1866 Turn off all access checking. This switch is mainly useful for
1867 working around bugs in the access control code.
1868
1869 -faligned-new
1870 Enable support for C++17 "new" of types that require more alignment
1871 than "void* ::operator new(std::size_t)" provides. A numeric
1872 argument such as "-faligned-new=32" can be used to specify how much
1873 alignment (in bytes) is provided by that function, but few users
1874 will need to override the default of "alignof(std::max_align_t)".
1875
1876 This flag is enabled by default for -std=c++17.
1877
1878 -fchar8_t
1879 -fno-char8_t
1880 Enable support for "char8_t" as adopted for C++2a. This includes
1881 the addition of a new "char8_t" fundamental type, changes to the
1882 types of UTF-8 string and character literals, new signatures for
1883 user-defined literals, associated standard library updates, and new
1884 "__cpp_char8_t" and "__cpp_lib_char8_t" feature test macros.
1885
1886 This option enables functions to be overloaded for ordinary and
1887 UTF-8 strings:
1888
1889 int f(const char *); // #1
1890 int f(const char8_t *); // #2
1891 int v1 = f("text"); // Calls #1
1892 int v2 = f(u8"text"); // Calls #2
1893
1894 and introduces new signatures for user-defined literals:
1895
1896 int operator""_udl1(char8_t);
1897 int v3 = u8'x'_udl1;
1898 int operator""_udl2(const char8_t*, std::size_t);
1899 int v4 = u8"text"_udl2;
1900 template<typename T, T...> int operator""_udl3();
1901 int v5 = u8"text"_udl3;
1902
1903 The change to the types of UTF-8 string and character literals
1904 introduces incompatibilities with ISO C++11 and later standards.
1905 For example, the following code is well-formed under ISO C++11, but
1906 is ill-formed when -fchar8_t is specified.
1907
1908 char ca[] = u8"xx"; // error: char-array initialized from wide
1909 // string
1910 const char *cp = u8"xx";// error: invalid conversion from
1911 // `const char8_t*' to `const char*'
1912 int f(const char*);
1913 auto v = f(u8"xx"); // error: invalid conversion from
1914 // `const char8_t*' to `const char*'
1915 std::string s{u8"xx"}; // error: no matching function for call to
1916 // `std::basic_string<char>::basic_string()'
1917 using namespace std::literals;
1918 s = u8"xx"s; // error: conversion from
1919 // `basic_string<char8_t>' to non-scalar
1920 // type `basic_string<char>' requested
1921
1922 -fcheck-new
1923 Check that the pointer returned by "operator new" is non-null
1924 before attempting to modify the storage allocated. This check is
1925 normally unnecessary because the C++ standard specifies that
1926 "operator new" only returns 0 if it is declared "throw()", in which
1927 case the compiler always checks the return value even without this
1928 option. In all other cases, when "operator new" has a non-empty
1929 exception specification, memory exhaustion is signalled by throwing
1930 "std::bad_alloc". See also new (nothrow).
1931
1932 -fconcepts
1933 -fconcepts-ts
1934 Below -std=c++2a, -fconcepts enables support for the C++ Extensions
1935 for Concepts Technical Specification, ISO 19217 (2015).
1936
1937 With -std=c++2a and above, Concepts are part of the language
1938 standard, so -fconcepts defaults to on. But the standard
1939 specification of Concepts differs significantly from the TS, so
1940 some constructs that were allowed in the TS but didn't make it into
1941 the standard can still be enabled by -fconcepts-ts.
1942
1943 -fconstexpr-depth=n
1944 Set the maximum nested evaluation depth for C++11 constexpr
1945 functions to n. A limit is needed to detect endless recursion
1946 during constant expression evaluation. The minimum specified by
1947 the standard is 512.
1948
1949 -fconstexpr-cache-depth=n
1950 Set the maximum level of nested evaluation depth for C++11
1951 constexpr functions that will be cached to n. This is a heuristic
1952 that trades off compilation speed (when the cache avoids repeated
1953 calculations) against memory consumption (when the cache grows very
1954 large from highly recursive evaluations). The default is 8. Very
1955 few users are likely to want to adjust it, but if your code does
1956 heavy constexpr calculations you might want to experiment to find
1957 which value works best for you.
1958
1959 -fconstexpr-loop-limit=n
1960 Set the maximum number of iterations for a loop in C++14 constexpr
1961 functions to n. A limit is needed to detect infinite loops during
1962 constant expression evaluation. The default is 262144 (1<<18).
1963
1964 -fconstexpr-ops-limit=n
1965 Set the maximum number of operations during a single constexpr
1966 evaluation. Even when number of iterations of a single loop is
1967 limited with the above limit, if there are several nested loops and
1968 each of them has many iterations but still smaller than the above
1969 limit, or if in a body of some loop or even outside of a loop too
1970 many expressions need to be evaluated, the resulting constexpr
1971 evaluation might take too long. The default is 33554432 (1<<25).
1972
1973 -fcoroutines
1974 Enable support for the C++ coroutines extension (experimental).
1975
1976 -fno-elide-constructors
1977 The C++ standard allows an implementation to omit creating a
1978 temporary that is only used to initialize another object of the
1979 same type. Specifying this option disables that optimization, and
1980 forces G++ to call the copy constructor in all cases. This option
1981 also causes G++ to call trivial member functions which otherwise
1982 would be expanded inline.
1983
1984 In C++17, the compiler is required to omit these temporaries, but
1985 this option still affects trivial member functions.
1986
1987 -fno-enforce-eh-specs
1988 Don't generate code to check for violation of exception
1989 specifications at run time. This option violates the C++ standard,
1990 but may be useful for reducing code size in production builds, much
1991 like defining "NDEBUG". This does not give user code permission to
1992 throw exceptions in violation of the exception specifications; the
1993 compiler still optimizes based on the specifications, so throwing
1994 an unexpected exception results in undefined behavior at run time.
1995
1996 -fextern-tls-init
1997 -fno-extern-tls-init
1998 The C++11 and OpenMP standards allow "thread_local" and
1999 "threadprivate" variables to have dynamic (runtime) initialization.
2000 To support this, any use of such a variable goes through a wrapper
2001 function that performs any necessary initialization. When the use
2002 and definition of the variable are in the same translation unit,
2003 this overhead can be optimized away, but when the use is in a
2004 different translation unit there is significant overhead even if
2005 the variable doesn't actually need dynamic initialization. If the
2006 programmer can be sure that no use of the variable in a non-
2007 defining TU needs to trigger dynamic initialization (either because
2008 the variable is statically initialized, or a use of the variable in
2009 the defining TU will be executed before any uses in another TU),
2010 they can avoid this overhead with the -fno-extern-tls-init option.
2011
2012 On targets that support symbol aliases, the default is
2013 -fextern-tls-init. On targets that do not support symbol aliases,
2014 the default is -fno-extern-tls-init.
2015
2016 -fno-gnu-keywords
2017 Do not recognize "typeof" as a keyword, so that code can use this
2018 word as an identifier. You can use the keyword "__typeof__"
2019 instead. This option is implied by the strict ISO C++ dialects:
2020 -ansi, -std=c++98, -std=c++11, etc.
2021
2022 -fno-implicit-templates
2023 Never emit code for non-inline templates that are instantiated
2024 implicitly (i.e. by use); only emit code for explicit
2025 instantiations. If you use this option, you must take care to
2026 structure your code to include all the necessary explicit
2027 instantiations to avoid getting undefined symbols at link time.
2028
2029 -fno-implicit-inline-templates
2030 Don't emit code for implicit instantiations of inline templates,
2031 either. The default is to handle inlines differently so that
2032 compiles with and without optimization need the same set of
2033 explicit instantiations.
2034
2035 -fno-implement-inlines
2036 To save space, do not emit out-of-line copies of inline functions
2037 controlled by "#pragma implementation". This causes linker errors
2038 if these functions are not inlined everywhere they are called.
2039
2040 -fms-extensions
2041 Disable Wpedantic warnings about constructs used in MFC, such as
2042 implicit int and getting a pointer to member function via non-
2043 standard syntax.
2044
2045 -fnew-inheriting-ctors
2046 Enable the P0136 adjustment to the semantics of C++11 constructor
2047 inheritance. This is part of C++17 but also considered to be a
2048 Defect Report against C++11 and C++14. This flag is enabled by
2049 default unless -fabi-version=10 or lower is specified.
2050
2051 -fnew-ttp-matching
2052 Enable the P0522 resolution to Core issue 150, template template
2053 parameters and default arguments: this allows a template with
2054 default template arguments as an argument for a template template
2055 parameter with fewer template parameters. This flag is enabled by
2056 default for -std=c++17.
2057
2058 -fno-nonansi-builtins
2059 Disable built-in declarations of functions that are not mandated by
2060 ANSI/ISO C. These include "ffs", "alloca", "_exit", "index",
2061 "bzero", "conjf", and other related functions.
2062
2063 -fnothrow-opt
2064 Treat a "throw()" exception specification as if it were a
2065 "noexcept" specification to reduce or eliminate the text size
2066 overhead relative to a function with no exception specification.
2067 If the function has local variables of types with non-trivial
2068 destructors, the exception specification actually makes the
2069 function smaller because the EH cleanups for those variables can be
2070 optimized away. The semantic effect is that an exception thrown
2071 out of a function with such an exception specification results in a
2072 call to "terminate" rather than "unexpected".
2073
2074 -fno-operator-names
2075 Do not treat the operator name keywords "and", "bitand", "bitor",
2076 "compl", "not", "or" and "xor" as synonyms as keywords.
2077
2078 -fno-optional-diags
2079 Disable diagnostics that the standard says a compiler does not need
2080 to issue. Currently, the only such diagnostic issued by G++ is the
2081 one for a name having multiple meanings within a class.
2082
2083 -fpermissive
2084 Downgrade some diagnostics about nonconformant code from errors to
2085 warnings. Thus, using -fpermissive allows some nonconforming code
2086 to compile.
2087
2088 -fno-pretty-templates
2089 When an error message refers to a specialization of a function
2090 template, the compiler normally prints the signature of the
2091 template followed by the template arguments and any typedefs or
2092 typenames in the signature (e.g. "void f(T) [with T = int]" rather
2093 than "void f(int)") so that it's clear which template is involved.
2094 When an error message refers to a specialization of a class
2095 template, the compiler omits any template arguments that match the
2096 default template arguments for that template. If either of these
2097 behaviors make it harder to understand the error message rather
2098 than easier, you can use -fno-pretty-templates to disable them.
2099
2100 -fno-rtti
2101 Disable generation of information about every class with virtual
2102 functions for use by the C++ run-time type identification features
2103 ("dynamic_cast" and "typeid"). If you don't use those parts of the
2104 language, you can save some space by using this flag. Note that
2105 exception handling uses the same information, but G++ generates it
2106 as needed. The "dynamic_cast" operator can still be used for casts
2107 that do not require run-time type information, i.e. casts to "void
2108 *" or to unambiguous base classes.
2109
2110 Mixing code compiled with -frtti with that compiled with -fno-rtti
2111 may not work. For example, programs may fail to link if a class
2112 compiled with -fno-rtti is used as a base for a class compiled with
2113 -frtti.
2114
2115 -fsized-deallocation
2116 Enable the built-in global declarations
2117
2118 void operator delete (void *, std::size_t) noexcept;
2119 void operator delete[] (void *, std::size_t) noexcept;
2120
2121 as introduced in C++14. This is useful for user-defined
2122 replacement deallocation functions that, for example, use the size
2123 of the object to make deallocation faster. Enabled by default
2124 under -std=c++14 and above. The flag -Wsized-deallocation warns
2125 about places that might want to add a definition.
2126
2127 -fstrict-enums
2128 Allow the compiler to optimize using the assumption that a value of
2129 enumerated type can only be one of the values of the enumeration
2130 (as defined in the C++ standard; basically, a value that can be
2131 represented in the minimum number of bits needed to represent all
2132 the enumerators). This assumption may not be valid if the program
2133 uses a cast to convert an arbitrary integer value to the enumerated
2134 type.
2135
2136 -fstrong-eval-order
2137 Evaluate member access, array subscripting, and shift expressions
2138 in left-to-right order, and evaluate assignment in right-to-left
2139 order, as adopted for C++17. Enabled by default with -std=c++17.
2140 -fstrong-eval-order=some enables just the ordering of member access
2141 and shift expressions, and is the default without -std=c++17.
2142
2143 -ftemplate-backtrace-limit=n
2144 Set the maximum number of template instantiation notes for a single
2145 warning or error to n. The default value is 10.
2146
2147 -ftemplate-depth=n
2148 Set the maximum instantiation depth for template classes to n. A
2149 limit on the template instantiation depth is needed to detect
2150 endless recursions during template class instantiation. ANSI/ISO
2151 C++ conforming programs must not rely on a maximum depth greater
2152 than 17 (changed to 1024 in C++11). The default value is 900, as
2153 the compiler can run out of stack space before hitting 1024 in some
2154 situations.
2155
2156 -fno-threadsafe-statics
2157 Do not emit the extra code to use the routines specified in the C++
2158 ABI for thread-safe initialization of local statics. You can use
2159 this option to reduce code size slightly in code that doesn't need
2160 to be thread-safe.
2161
2162 -fuse-cxa-atexit
2163 Register destructors for objects with static storage duration with
2164 the "__cxa_atexit" function rather than the "atexit" function.
2165 This option is required for fully standards-compliant handling of
2166 static destructors, but only works if your C library supports
2167 "__cxa_atexit".
2168
2169 -fno-use-cxa-get-exception-ptr
2170 Don't use the "__cxa_get_exception_ptr" runtime routine. This
2171 causes "std::uncaught_exception" to be incorrect, but is necessary
2172 if the runtime routine is not available.
2173
2174 -fvisibility-inlines-hidden
2175 This switch declares that the user does not attempt to compare
2176 pointers to inline functions or methods where the addresses of the
2177 two functions are taken in different shared objects.
2178
2179 The effect of this is that GCC may, effectively, mark inline
2180 methods with "__attribute__ ((visibility ("hidden")))" so that they
2181 do not appear in the export table of a DSO and do not require a PLT
2182 indirection when used within the DSO. Enabling this option can
2183 have a dramatic effect on load and link times of a DSO as it
2184 massively reduces the size of the dynamic export table when the
2185 library makes heavy use of templates.
2186
2187 The behavior of this switch is not quite the same as marking the
2188 methods as hidden directly, because it does not affect static
2189 variables local to the function or cause the compiler to deduce
2190 that the function is defined in only one shared object.
2191
2192 You may mark a method as having a visibility explicitly to negate
2193 the effect of the switch for that method. For example, if you do
2194 want to compare pointers to a particular inline method, you might
2195 mark it as having default visibility. Marking the enclosing class
2196 with explicit visibility has no effect.
2197
2198 Explicitly instantiated inline methods are unaffected by this
2199 option as their linkage might otherwise cross a shared library
2200 boundary.
2201
2202 -fvisibility-ms-compat
2203 This flag attempts to use visibility settings to make GCC's C++
2204 linkage model compatible with that of Microsoft Visual Studio.
2205
2206 The flag makes these changes to GCC's linkage model:
2207
2208 1. It sets the default visibility to "hidden", like
2209 -fvisibility=hidden.
2210
2211 2. Types, but not their members, are not hidden by default.
2212
2213 3. The One Definition Rule is relaxed for types without explicit
2214 visibility specifications that are defined in more than one
2215 shared object: those declarations are permitted if they are
2216 permitted when this option is not used.
2217
2218 In new code it is better to use -fvisibility=hidden and export
2219 those classes that are intended to be externally visible.
2220 Unfortunately it is possible for code to rely, perhaps
2221 accidentally, on the Visual Studio behavior.
2222
2223 Among the consequences of these changes are that static data
2224 members of the same type with the same name but defined in
2225 different shared objects are different, so changing one does not
2226 change the other; and that pointers to function members defined in
2227 different shared objects may not compare equal. When this flag is
2228 given, it is a violation of the ODR to define types with the same
2229 name differently.
2230
2231 -fno-weak
2232 Do not use weak symbol support, even if it is provided by the
2233 linker. By default, G++ uses weak symbols if they are available.
2234 This option exists only for testing, and should not be used by end-
2235 users; it results in inferior code and has no benefits. This
2236 option may be removed in a future release of G++.
2237
2238 -fext-numeric-literals (C++ and Objective-C++ only)
2239 Accept imaginary, fixed-point, or machine-defined literal number
2240 suffixes as GNU extensions. When this option is turned off these
2241 suffixes are treated as C++11 user-defined literal numeric
2242 suffixes. This is on by default for all pre-C++11 dialects and all
2243 GNU dialects: -std=c++98, -std=gnu++98, -std=gnu++11, -std=gnu++14.
2244 This option is off by default for ISO C++11 onwards (-std=c++11,
2245 ...).
2246
2247 -nostdinc++
2248 Do not search for header files in the standard directories specific
2249 to C++, but do still search the other standard directories. (This
2250 option is used when building the C++ library.)
2251
2252 In addition, these warning options have meanings only for C++ programs:
2253
2254 -Wabi-tag (C++ and Objective-C++ only)
2255 Warn when a type with an ABI tag is used in a context that does not
2256 have that ABI tag. See C++ Attributes for more information about
2257 ABI tags.
2258
2259 -Wcomma-subscript (C++ and Objective-C++ only)
2260 Warn about uses of a comma expression within a subscripting
2261 expression. This usage was deprecated in C++2a. However, a comma
2262 expression wrapped in "( )" is not deprecated. Example:
2263
2264 void f(int *a, int b, int c) {
2265 a[b,c]; // deprecated
2266 a[(b,c)]; // OK
2267 }
2268
2269 Enabled by default with -std=c++2a.
2270
2271 -Wctor-dtor-privacy (C++ and Objective-C++ only)
2272 Warn when a class seems unusable because all the constructors or
2273 destructors in that class are private, and it has neither friends
2274 nor public static member functions. Also warn if there are no non-
2275 private methods, and there's at least one private member function
2276 that isn't a constructor or destructor.
2277
2278 -Wdelete-non-virtual-dtor (C++ and Objective-C++ only)
2279 Warn when "delete" is used to destroy an instance of a class that
2280 has virtual functions and non-virtual destructor. It is unsafe to
2281 delete an instance of a derived class through a pointer to a base
2282 class if the base class does not have a virtual destructor. This
2283 warning is enabled by -Wall.
2284
2285 -Wdeprecated-copy (C++ and Objective-C++ only)
2286 Warn that the implicit declaration of a copy constructor or copy
2287 assignment operator is deprecated if the class has a user-provided
2288 copy constructor or copy assignment operator, in C++11 and up.
2289 This warning is enabled by -Wextra. With -Wdeprecated-copy-dtor,
2290 also deprecate if the class has a user-provided destructor.
2291
2292 -Wno-init-list-lifetime (C++ and Objective-C++ only)
2293 Do not warn about uses of "std::initializer_list" that are likely
2294 to result in dangling pointers. Since the underlying array for an
2295 "initializer_list" is handled like a normal C++ temporary object,
2296 it is easy to inadvertently keep a pointer to the array past the
2297 end of the array's lifetime. For example:
2298
2299 * If a function returns a temporary "initializer_list", or a
2300 local "initializer_list" variable, the array's lifetime ends at
2301 the end of the return statement, so the value returned has a
2302 dangling pointer.
2303
2304 * If a new-expression creates an "initializer_list", the array
2305 only lives until the end of the enclosing full-expression, so
2306 the "initializer_list" in the heap has a dangling pointer.
2307
2308 * When an "initializer_list" variable is assigned from a brace-
2309 enclosed initializer list, the temporary array created for the
2310 right side of the assignment only lives until the end of the
2311 full-expression, so at the next statement the
2312 "initializer_list" variable has a dangling pointer.
2313
2314 // li's initial underlying array lives as long as li
2315 std::initializer_list<int> li = { 1,2,3 };
2316 // assignment changes li to point to a temporary array
2317 li = { 4, 5 };
2318 // now the temporary is gone and li has a dangling pointer
2319 int i = li.begin()[0] // undefined behavior
2320
2321 * When a list constructor stores the "begin" pointer from the
2322 "initializer_list" argument, this doesn't extend the lifetime
2323 of the array, so if a class variable is constructed from a
2324 temporary "initializer_list", the pointer is left dangling by
2325 the end of the variable declaration statement.
2326
2327 -Wno-literal-suffix (C++ and Objective-C++ only)
2328 Do not warn when a string or character literal is followed by a ud-
2329 suffix which does not begin with an underscore. As a conforming
2330 extension, GCC treats such suffixes as separate preprocessing
2331 tokens in order to maintain backwards compatibility with code that
2332 uses formatting macros from "<inttypes.h>". For example:
2333
2334 #define __STDC_FORMAT_MACROS
2335 #include <inttypes.h>
2336 #include <stdio.h>
2337
2338 int main() {
2339 int64_t i64 = 123;
2340 printf("My int64: %" PRId64"\n", i64);
2341 }
2342
2343 In this case, "PRId64" is treated as a separate preprocessing
2344 token.
2345
2346 This option also controls warnings when a user-defined literal
2347 operator is declared with a literal suffix identifier that doesn't
2348 begin with an underscore. Literal suffix identifiers that don't
2349 begin with an underscore are reserved for future standardization.
2350
2351 These warnings are enabled by default.
2352
2353 -Wno-narrowing (C++ and Objective-C++ only)
2354 For C++11 and later standards, narrowing conversions are diagnosed
2355 by default, as required by the standard. A narrowing conversion
2356 from a constant produces an error, and a narrowing conversion from
2357 a non-constant produces a warning, but -Wno-narrowing suppresses
2358 the diagnostic. Note that this does not affect the meaning of
2359 well-formed code; narrowing conversions are still considered ill-
2360 formed in SFINAE contexts.
2361
2362 With -Wnarrowing in C++98, warn when a narrowing conversion
2363 prohibited by C++11 occurs within { }, e.g.
2364
2365 int i = { 2.2 }; // error: narrowing from double to int
2366
2367 This flag is included in -Wall and -Wc++11-compat.
2368
2369 -Wnoexcept (C++ and Objective-C++ only)
2370 Warn when a noexcept-expression evaluates to false because of a
2371 call to a function that does not have a non-throwing exception
2372 specification (i.e. "throw()" or "noexcept") but is known by the
2373 compiler to never throw an exception.
2374
2375 -Wnoexcept-type (C++ and Objective-C++ only)
2376 Warn if the C++17 feature making "noexcept" part of a function type
2377 changes the mangled name of a symbol relative to C++14. Enabled by
2378 -Wabi and -Wc++17-compat.
2379
2380 As an example:
2381
2382 template <class T> void f(T t) { t(); };
2383 void g() noexcept;
2384 void h() { f(g); }
2385
2386 In C++14, "f" calls "f<void(*)()>", but in C++17 it calls
2387 "f<void(*)()noexcept>".
2388
2389 -Wclass-memaccess (C++ and Objective-C++ only)
2390 Warn when the destination of a call to a raw memory function such
2391 as "memset" or "memcpy" is an object of class type, and when
2392 writing into such an object might bypass the class non-trivial or
2393 deleted constructor or copy assignment, violate const-correctness
2394 or encapsulation, or corrupt virtual table pointers. Modifying the
2395 representation of such objects may violate invariants maintained by
2396 member functions of the class. For example, the call to "memset"
2397 below is undefined because it modifies a non-trivial class object
2398 and is, therefore, diagnosed. The safe way to either initialize or
2399 clear the storage of objects of such types is by using the
2400 appropriate constructor or assignment operator, if one is
2401 available.
2402
2403 std::string str = "abc";
2404 memset (&str, 0, sizeof str);
2405
2406 The -Wclass-memaccess option is enabled by -Wall. Explicitly
2407 casting the pointer to the class object to "void *" or to a type
2408 that can be safely accessed by the raw memory function suppresses
2409 the warning.
2410
2411 -Wnon-virtual-dtor (C++ and Objective-C++ only)
2412 Warn when a class has virtual functions and an accessible non-
2413 virtual destructor itself or in an accessible polymorphic base
2414 class, in which case it is possible but unsafe to delete an
2415 instance of a derived class through a pointer to the class itself
2416 or base class. This warning is automatically enabled if -Weffc++
2417 is specified.
2418
2419 -Wregister (C++ and Objective-C++ only)
2420 Warn on uses of the "register" storage class specifier, except when
2421 it is part of the GNU Explicit Register Variables extension. The
2422 use of the "register" keyword as storage class specifier has been
2423 deprecated in C++11 and removed in C++17. Enabled by default with
2424 -std=c++17.
2425
2426 -Wreorder (C++ and Objective-C++ only)
2427 Warn when the order of member initializers given in the code does
2428 not match the order in which they must be executed. For instance:
2429
2430 struct A {
2431 int i;
2432 int j;
2433 A(): j (0), i (1) { }
2434 };
2435
2436 The compiler rearranges the member initializers for "i" and "j" to
2437 match the declaration order of the members, emitting a warning to
2438 that effect. This warning is enabled by -Wall.
2439
2440 -Wno-pessimizing-move (C++ and Objective-C++ only)
2441 This warning warns when a call to "std::move" prevents copy
2442 elision. A typical scenario when copy elision can occur is when
2443 returning in a function with a class return type, when the
2444 expression being returned is the name of a non-volatile automatic
2445 object, and is not a function parameter, and has the same type as
2446 the function return type.
2447
2448 struct T {
2449 ...
2450 };
2451 T fn()
2452 {
2453 T t;
2454 ...
2455 return std::move (t);
2456 }
2457
2458 But in this example, the "std::move" call prevents copy elision.
2459
2460 This warning is enabled by -Wall.
2461
2462 -Wno-redundant-move (C++ and Objective-C++ only)
2463 This warning warns about redundant calls to "std::move"; that is,
2464 when a move operation would have been performed even without the
2465 "std::move" call. This happens because the compiler is forced to
2466 treat the object as if it were an rvalue in certain situations such
2467 as returning a local variable, where copy elision isn't applicable.
2468 Consider:
2469
2470 struct T {
2471 ...
2472 };
2473 T fn(T t)
2474 {
2475 ...
2476 return std::move (t);
2477 }
2478
2479 Here, the "std::move" call is redundant. Because G++ implements
2480 Core Issue 1579, another example is:
2481
2482 struct T { // convertible to U
2483 ...
2484 };
2485 struct U {
2486 ...
2487 };
2488 U fn()
2489 {
2490 T t;
2491 ...
2492 return std::move (t);
2493 }
2494
2495 In this example, copy elision isn't applicable because the type of
2496 the expression being returned and the function return type differ,
2497 yet G++ treats the return value as if it were designated by an
2498 rvalue.
2499
2500 This warning is enabled by -Wextra.
2501
2502 -Wredundant-tags (C++ and Objective-C++ only)
2503 Warn about redundant class-key and enum-key in references to class
2504 types and enumerated types in contexts where the key can be
2505 eliminated without causing an ambiguity. For example:
2506
2507 struct foo;
2508 struct foo *p; // warn that keyword struct can be eliminated
2509
2510 On the other hand, in this example there is no warning:
2511
2512 struct foo;
2513 void foo (); // "hides" struct foo
2514 void bar (struct foo&); // no warning, keyword struct is necessary
2515
2516 -Wno-subobject-linkage (C++ and Objective-C++ only)
2517 Do not warn if a class type has a base or a field whose type uses
2518 the anonymous namespace or depends on a type with no linkage. If a
2519 type A depends on a type B with no or internal linkage, defining it
2520 in multiple translation units would be an ODR violation because the
2521 meaning of B is different in each translation unit. If A only
2522 appears in a single translation unit, the best way to silence the
2523 warning is to give it internal linkage by putting it in an
2524 anonymous namespace as well. The compiler doesn't give this
2525 warning for types defined in the main .C file, as those are
2526 unlikely to have multiple definitions. -Wsubobject-linkage is
2527 enabled by default.
2528
2529 -Weffc++ (C++ and Objective-C++ only)
2530 Warn about violations of the following style guidelines from Scott
2531 Meyers' Effective C++ series of books:
2532
2533 * Define a copy constructor and an assignment operator for
2534 classes with dynamically-allocated memory.
2535
2536 * Prefer initialization to assignment in constructors.
2537
2538 * Have "operator=" return a reference to *this.
2539
2540 * Don't try to return a reference when you must return an object.
2541
2542 * Distinguish between prefix and postfix forms of increment and
2543 decrement operators.
2544
2545 * Never overload "&&", "||", or ",".
2546
2547 This option also enables -Wnon-virtual-dtor, which is also one of
2548 the effective C++ recommendations. However, the check is extended
2549 to warn about the lack of virtual destructor in accessible non-
2550 polymorphic bases classes too.
2551
2552 When selecting this option, be aware that the standard library
2553 headers do not obey all of these guidelines; use grep -v to filter
2554 out those warnings.
2555
2556 -Wstrict-null-sentinel (C++ and Objective-C++ only)
2557 Warn about the use of an uncasted "NULL" as sentinel. When
2558 compiling only with GCC this is a valid sentinel, as "NULL" is
2559 defined to "__null". Although it is a null pointer constant rather
2560 than a null pointer, it is guaranteed to be of the same size as a
2561 pointer. But this use is not portable across different compilers.
2562
2563 -Wno-non-template-friend (C++ and Objective-C++ only)
2564 Disable warnings when non-template friend functions are declared
2565 within a template. In very old versions of GCC that predate
2566 implementation of the ISO standard, declarations such as friend int
2567 foo(int), where the name of the friend is an unqualified-id, could
2568 be interpreted as a particular specialization of a template
2569 function; the warning exists to diagnose compatibility problems,
2570 and is enabled by default.
2571
2572 -Wold-style-cast (C++ and Objective-C++ only)
2573 Warn if an old-style (C-style) cast to a non-void type is used
2574 within a C++ program. The new-style casts ("dynamic_cast",
2575 "static_cast", "reinterpret_cast", and "const_cast") are less
2576 vulnerable to unintended effects and much easier to search for.
2577
2578 -Woverloaded-virtual (C++ and Objective-C++ only)
2579 Warn when a function declaration hides virtual functions from a
2580 base class. For example, in:
2581
2582 struct A {
2583 virtual void f();
2584 };
2585
2586 struct B: public A {
2587 void f(int);
2588 };
2589
2590 the "A" class version of "f" is hidden in "B", and code like:
2591
2592 B* b;
2593 b->f();
2594
2595 fails to compile.
2596
2597 -Wno-pmf-conversions (C++ and Objective-C++ only)
2598 Disable the diagnostic for converting a bound pointer to member
2599 function to a plain pointer.
2600
2601 -Wsign-promo (C++ and Objective-C++ only)
2602 Warn when overload resolution chooses a promotion from unsigned or
2603 enumerated type to a signed type, over a conversion to an unsigned
2604 type of the same size. Previous versions of G++ tried to preserve
2605 unsignedness, but the standard mandates the current behavior.
2606
2607 -Wtemplates (C++ and Objective-C++ only)
2608 Warn when a primary template declaration is encountered. Some
2609 coding rules disallow templates, and this may be used to enforce
2610 that rule. The warning is inactive inside a system header file,
2611 such as the STL, so one can still use the STL. One may also
2612 instantiate or specialize templates.
2613
2614 -Wmismatched-tags (C++ and Objective-C++ only)
2615 Warn for declarations of structs, classes, and class templates and
2616 their specializations with a class-key that does not match either
2617 the definition or the first declaration if no definition is
2618 provided.
2619
2620 For example, the declaration of "struct Object" in the argument
2621 list of "draw" triggers the warning. To avoid it, either remove
2622 the redundant class-key "struct" or replace it with "class" to
2623 match its definition.
2624
2625 class Object {
2626 public:
2627 virtual ~Object () = 0;
2628 };
2629 void draw (struct Object*);
2630
2631 It is not wrong to declare a class with the class-key "struct" as
2632 the example above shows. The -Wmismatched-tags option is intended
2633 to help achieve a consistent style of class declarations. In code
2634 that is intended to be portable to Windows-based compilers the
2635 warning helps prevent unresolved references due to the difference
2636 in the mangling of symbols declared with different class-keys. The
2637 option can be used either on its own or in conjunction with
2638 -Wredundant-tags.
2639
2640 -Wmultiple-inheritance (C++ and Objective-C++ only)
2641 Warn when a class is defined with multiple direct base classes.
2642 Some coding rules disallow multiple inheritance, and this may be
2643 used to enforce that rule. The warning is inactive inside a system
2644 header file, such as the STL, so one can still use the STL. One
2645 may also define classes that indirectly use multiple inheritance.
2646
2647 -Wvirtual-inheritance
2648 Warn when a class is defined with a virtual direct base class.
2649 Some coding rules disallow multiple inheritance, and this may be
2650 used to enforce that rule. The warning is inactive inside a system
2651 header file, such as the STL, so one can still use the STL. One
2652 may also define classes that indirectly use virtual inheritance.
2653
2654 -Wno-virtual-move-assign
2655 Suppress warnings about inheriting from a virtual base with a non-
2656 trivial C++11 move assignment operator. This is dangerous because
2657 if the virtual base is reachable along more than one path, it is
2658 moved multiple times, which can mean both objects end up in the
2659 moved-from state. If the move assignment operator is written to
2660 avoid moving from a moved-from object, this warning can be
2661 disabled.
2662
2663 -Wnamespaces
2664 Warn when a namespace definition is opened. Some coding rules
2665 disallow namespaces, and this may be used to enforce that rule.
2666 The warning is inactive inside a system header file, such as the
2667 STL, so one can still use the STL. One may also use using
2668 directives and qualified names.
2669
2670 -Wno-terminate (C++ and Objective-C++ only)
2671 Disable the warning about a throw-expression that will immediately
2672 result in a call to "terminate".
2673
2674 -Wno-class-conversion (C++ and Objective-C++ only)
2675 Do not warn when a conversion function converts an object to the
2676 same type, to a base class of that type, or to void; such a
2677 conversion function will never be called.
2678
2679 -Wvolatile (C++ and Objective-C++ only)
2680 Warn about deprecated uses of the "volatile" qualifier. This
2681 includes postfix and prefix "++" and "--" expressions of
2682 "volatile"-qualified types, using simple assignments where the left
2683 operand is a "volatile"-qualified non-class type for their value,
2684 compound assignments where the left operand is a
2685 "volatile"-qualified non-class type, "volatile"-qualified function
2686 return type, "volatile"-qualified parameter type, and structured
2687 bindings of a "volatile"-qualified type. This usage was deprecated
2688 in C++20.
2689
2690 Enabled by default with -std=c++2a.
2691
2692 -Wzero-as-null-pointer-constant (C++ and Objective-C++ only)
2693 Warn when a literal 0 is used as null pointer constant. This can
2694 be useful to facilitate the conversion to "nullptr" in C++11.
2695
2696 -Waligned-new
2697 Warn about a new-expression of a type that requires greater
2698 alignment than the "alignof(std::max_align_t)" but uses an
2699 allocation function without an explicit alignment parameter. This
2700 option is enabled by -Wall.
2701
2702 Normally this only warns about global allocation functions, but
2703 -Waligned-new=all also warns about class member allocation
2704 functions.
2705
2706 -Wno-placement-new
2707 -Wplacement-new=n
2708 Warn about placement new expressions with undefined behavior, such
2709 as constructing an object in a buffer that is smaller than the type
2710 of the object. For example, the placement new expression below is
2711 diagnosed because it attempts to construct an array of 64 integers
2712 in a buffer only 64 bytes large.
2713
2714 char buf [64];
2715 new (buf) int[64];
2716
2717 This warning is enabled by default.
2718
2719 -Wplacement-new=1
2720 This is the default warning level of -Wplacement-new. At this
2721 level the warning is not issued for some strictly undefined
2722 constructs that GCC allows as extensions for compatibility with
2723 legacy code. For example, the following "new" expression is
2724 not diagnosed at this level even though it has undefined
2725 behavior according to the C++ standard because it writes past
2726 the end of the one-element array.
2727
2728 struct S { int n, a[1]; };
2729 S *s = (S *)malloc (sizeof *s + 31 * sizeof s->a[0]);
2730 new (s->a)int [32]();
2731
2732 -Wplacement-new=2
2733 At this level, in addition to diagnosing all the same
2734 constructs as at level 1, a diagnostic is also issued for
2735 placement new expressions that construct an object in the last
2736 member of structure whose type is an array of a single element
2737 and whose size is less than the size of the object being
2738 constructed. While the previous example would be diagnosed,
2739 the following construct makes use of the flexible member array
2740 extension to avoid the warning at level 2.
2741
2742 struct S { int n, a[]; };
2743 S *s = (S *)malloc (sizeof *s + 32 * sizeof s->a[0]);
2744 new (s->a)int [32]();
2745
2746 -Wcatch-value
2747 -Wcatch-value=n (C++ and Objective-C++ only)
2748 Warn about catch handlers that do not catch via reference. With
2749 -Wcatch-value=1 (or -Wcatch-value for short) warn about polymorphic
2750 class types that are caught by value. With -Wcatch-value=2 warn
2751 about all class types that are caught by value. With
2752 -Wcatch-value=3 warn about all types that are not caught by
2753 reference. -Wcatch-value is enabled by -Wall.
2754
2755 -Wconditionally-supported (C++ and Objective-C++ only)
2756 Warn for conditionally-supported (C++11 [intro.defs]) constructs.
2757
2758 -Wno-delete-incomplete (C++ and Objective-C++ only)
2759 Do not warn when deleting a pointer to incomplete type, which may
2760 cause undefined behavior at runtime. This warning is enabled by
2761 default.
2762
2763 -Wextra-semi (C++, Objective-C++ only)
2764 Warn about redundant semicolons after in-class function
2765 definitions.
2766
2767 -Wno-inaccessible-base (C++, Objective-C++ only)
2768 This option controls warnings when a base class is inaccessible in
2769 a class derived from it due to ambiguity. The warning is enabled
2770 by default. Note that the warning for ambiguous virtual bases is
2771 enabled by the -Wextra option.
2772
2773 struct A { int a; };
2774
2775 struct B : A { };
2776
2777 struct C : B, A { };
2778
2779 -Wno-inherited-variadic-ctor
2780 Suppress warnings about use of C++11 inheriting constructors when
2781 the base class inherited from has a C variadic constructor; the
2782 warning is on by default because the ellipsis is not inherited.
2783
2784 -Wno-invalid-offsetof (C++ and Objective-C++ only)
2785 Suppress warnings from applying the "offsetof" macro to a non-POD
2786 type. According to the 2014 ISO C++ standard, applying "offsetof"
2787 to a non-standard-layout type is undefined. In existing C++
2788 implementations, however, "offsetof" typically gives meaningful
2789 results. This flag is for users who are aware that they are
2790 writing nonportable code and who have deliberately chosen to ignore
2791 the warning about it.
2792
2793 The restrictions on "offsetof" may be relaxed in a future version
2794 of the C++ standard.
2795
2796 -Wsized-deallocation (C++ and Objective-C++ only)
2797 Warn about a definition of an unsized deallocation function
2798
2799 void operator delete (void *) noexcept;
2800 void operator delete[] (void *) noexcept;
2801
2802 without a definition of the corresponding sized deallocation
2803 function
2804
2805 void operator delete (void *, std::size_t) noexcept;
2806 void operator delete[] (void *, std::size_t) noexcept;
2807
2808 or vice versa. Enabled by -Wextra along with -fsized-deallocation.
2809
2810 -Wsuggest-final-types
2811 Warn about types with virtual methods where code quality would be
2812 improved if the type were declared with the C++11 "final"
2813 specifier, or, if possible, declared in an anonymous namespace.
2814 This allows GCC to more aggressively devirtualize the polymorphic
2815 calls. This warning is more effective with link-time optimization,
2816 where the information about the class hierarchy graph is more
2817 complete.
2818
2819 -Wsuggest-final-methods
2820 Warn about virtual methods where code quality would be improved if
2821 the method were declared with the C++11 "final" specifier, or, if
2822 possible, its type were declared in an anonymous namespace or with
2823 the "final" specifier. This warning is more effective with link-
2824 time optimization, where the information about the class hierarchy
2825 graph is more complete. It is recommended to first consider
2826 suggestions of -Wsuggest-final-types and then rebuild with new
2827 annotations.
2828
2829 -Wsuggest-override
2830 Warn about overriding virtual functions that are not marked with
2831 the "override" keyword.
2832
2833 -Wuseless-cast (C++ and Objective-C++ only)
2834 Warn when an expression is casted to its own type.
2835
2836 -Wno-conversion-null (C++ and Objective-C++ only)
2837 Do not warn for conversions between "NULL" and non-pointer types.
2838 -Wconversion-null is enabled by default.
2839
2840 Options Controlling Objective-C and Objective-C++ Dialects
2841 (NOTE: This manual does not describe the Objective-C and Objective-C++
2842 languages themselves.
2843
2844 This section describes the command-line options that are only
2845 meaningful for Objective-C and Objective-C++ programs. You can also
2846 use most of the language-independent GNU compiler options. For
2847 example, you might compile a file some_class.m like this:
2848
2849 gcc -g -fgnu-runtime -O -c some_class.m
2850
2851 In this example, -fgnu-runtime is an option meant only for Objective-C
2852 and Objective-C++ programs; you can use the other options with any
2853 language supported by GCC.
2854
2855 Note that since Objective-C is an extension of the C language,
2856 Objective-C compilations may also use options specific to the C front-
2857 end (e.g., -Wtraditional). Similarly, Objective-C++ compilations may
2858 use C++-specific options (e.g., -Wabi).
2859
2860 Here is a list of options that are only for compiling Objective-C and
2861 Objective-C++ programs:
2862
2863 -fconstant-string-class=class-name
2864 Use class-name as the name of the class to instantiate for each
2865 literal string specified with the syntax "@"..."". The default
2866 class name is "NXConstantString" if the GNU runtime is being used,
2867 and "NSConstantString" if the NeXT runtime is being used (see
2868 below). The -fconstant-cfstrings option, if also present,
2869 overrides the -fconstant-string-class setting and cause "@"...""
2870 literals to be laid out as constant CoreFoundation strings.
2871
2872 -fgnu-runtime
2873 Generate object code compatible with the standard GNU Objective-C
2874 runtime. This is the default for most types of systems.
2875
2876 -fnext-runtime
2877 Generate output compatible with the NeXT runtime. This is the
2878 default for NeXT-based systems, including Darwin and Mac OS X. The
2879 macro "__NEXT_RUNTIME__" is predefined if (and only if) this option
2880 is used.
2881
2882 -fno-nil-receivers
2883 Assume that all Objective-C message dispatches ("[receiver
2884 message:arg]") in this translation unit ensure that the receiver is
2885 not "nil". This allows for more efficient entry points in the
2886 runtime to be used. This option is only available in conjunction
2887 with the NeXT runtime and ABI version 0 or 1.
2888
2889 -fobjc-abi-version=n
2890 Use version n of the Objective-C ABI for the selected runtime.
2891 This option is currently supported only for the NeXT runtime. In
2892 that case, Version 0 is the traditional (32-bit) ABI without
2893 support for properties and other Objective-C 2.0 additions.
2894 Version 1 is the traditional (32-bit) ABI with support for
2895 properties and other Objective-C 2.0 additions. Version 2 is the
2896 modern (64-bit) ABI. If nothing is specified, the default is
2897 Version 0 on 32-bit target machines, and Version 2 on 64-bit target
2898 machines.
2899
2900 -fobjc-call-cxx-cdtors
2901 For each Objective-C class, check if any of its instance variables
2902 is a C++ object with a non-trivial default constructor. If so,
2903 synthesize a special "- (id) .cxx_construct" instance method which
2904 runs non-trivial default constructors on any such instance
2905 variables, in order, and then return "self". Similarly, check if
2906 any instance variable is a C++ object with a non-trivial
2907 destructor, and if so, synthesize a special "- (void)
2908 .cxx_destruct" method which runs all such default destructors, in
2909 reverse order.
2910
2911 The "- (id) .cxx_construct" and "- (void) .cxx_destruct" methods
2912 thusly generated only operate on instance variables declared in the
2913 current Objective-C class, and not those inherited from
2914 superclasses. It is the responsibility of the Objective-C runtime
2915 to invoke all such methods in an object's inheritance hierarchy.
2916 The "- (id) .cxx_construct" methods are invoked by the runtime
2917 immediately after a new object instance is allocated; the "- (void)
2918 .cxx_destruct" methods are invoked immediately before the runtime
2919 deallocates an object instance.
2920
2921 As of this writing, only the NeXT runtime on Mac OS X 10.4 and
2922 later has support for invoking the "- (id) .cxx_construct" and "-
2923 (void) .cxx_destruct" methods.
2924
2925 -fobjc-direct-dispatch
2926 Allow fast jumps to the message dispatcher. On Darwin this is
2927 accomplished via the comm page.
2928
2929 -fobjc-exceptions
2930 Enable syntactic support for structured exception handling in
2931 Objective-C, similar to what is offered by C++. This option is
2932 required to use the Objective-C keywords @try, @throw, @catch,
2933 @finally and @synchronized. This option is available with both the
2934 GNU runtime and the NeXT runtime (but not available in conjunction
2935 with the NeXT runtime on Mac OS X 10.2 and earlier).
2936
2937 -fobjc-gc
2938 Enable garbage collection (GC) in Objective-C and Objective-C++
2939 programs. This option is only available with the NeXT runtime; the
2940 GNU runtime has a different garbage collection implementation that
2941 does not require special compiler flags.
2942
2943 -fobjc-nilcheck
2944 For the NeXT runtime with version 2 of the ABI, check for a nil
2945 receiver in method invocations before doing the actual method call.
2946 This is the default and can be disabled using -fno-objc-nilcheck.
2947 Class methods and super calls are never checked for nil in this way
2948 no matter what this flag is set to. Currently this flag does
2949 nothing when the GNU runtime, or an older version of the NeXT
2950 runtime ABI, is used.
2951
2952 -fobjc-std=objc1
2953 Conform to the language syntax of Objective-C 1.0, the language
2954 recognized by GCC 4.0. This only affects the Objective-C additions
2955 to the C/C++ language; it does not affect conformance to C/C++
2956 standards, which is controlled by the separate C/C++ dialect option
2957 flags. When this option is used with the Objective-C or
2958 Objective-C++ compiler, any Objective-C syntax that is not
2959 recognized by GCC 4.0 is rejected. This is useful if you need to
2960 make sure that your Objective-C code can be compiled with older
2961 versions of GCC.
2962
2963 -freplace-objc-classes
2964 Emit a special marker instructing ld(1) not to statically link in
2965 the resulting object file, and allow dyld(1) to load it in at run
2966 time instead. This is used in conjunction with the Fix-and-
2967 Continue debugging mode, where the object file in question may be
2968 recompiled and dynamically reloaded in the course of program
2969 execution, without the need to restart the program itself.
2970 Currently, Fix-and-Continue functionality is only available in
2971 conjunction with the NeXT runtime on Mac OS X 10.3 and later.
2972
2973 -fzero-link
2974 When compiling for the NeXT runtime, the compiler ordinarily
2975 replaces calls to "objc_getClass("...")" (when the name of the
2976 class is known at compile time) with static class references that
2977 get initialized at load time, which improves run-time performance.
2978 Specifying the -fzero-link flag suppresses this behavior and causes
2979 calls to "objc_getClass("...")" to be retained. This is useful in
2980 Zero-Link debugging mode, since it allows for individual class
2981 implementations to be modified during program execution. The GNU
2982 runtime currently always retains calls to "objc_get_class("...")"
2983 regardless of command-line options.
2984
2985 -fno-local-ivars
2986 By default instance variables in Objective-C can be accessed as if
2987 they were local variables from within the methods of the class
2988 they're declared in. This can lead to shadowing between instance
2989 variables and other variables declared either locally inside a
2990 class method or globally with the same name. Specifying the
2991 -fno-local-ivars flag disables this behavior thus avoiding variable
2992 shadowing issues.
2993
2994 -fivar-visibility=[public|protected|private|package]
2995 Set the default instance variable visibility to the specified
2996 option so that instance variables declared outside the scope of any
2997 access modifier directives default to the specified visibility.
2998
2999 -gen-decls
3000 Dump interface declarations for all classes seen in the source file
3001 to a file named sourcename.decl.
3002
3003 -Wassign-intercept (Objective-C and Objective-C++ only)
3004 Warn whenever an Objective-C assignment is being intercepted by the
3005 garbage collector.
3006
3007 -Wno-property-assign-default (Objective-C and Objective-C++ only)
3008 Do not warn if a property for an Objective-C object has no assign
3009 semantics specified.
3010
3011 -Wno-protocol (Objective-C and Objective-C++ only)
3012 If a class is declared to implement a protocol, a warning is issued
3013 for every method in the protocol that is not implemented by the
3014 class. The default behavior is to issue a warning for every method
3015 not explicitly implemented in the class, even if a method
3016 implementation is inherited from the superclass. If you use the
3017 -Wno-protocol option, then methods inherited from the superclass
3018 are considered to be implemented, and no warning is issued for
3019 them.
3020
3021 -Wselector (Objective-C and Objective-C++ only)
3022 Warn if multiple methods of different types for the same selector
3023 are found during compilation. The check is performed on the list
3024 of methods in the final stage of compilation. Additionally, a
3025 check is performed for each selector appearing in a
3026 "@selector(...)" expression, and a corresponding method for that
3027 selector has been found during compilation. Because these checks
3028 scan the method table only at the end of compilation, these
3029 warnings are not produced if the final stage of compilation is not
3030 reached, for example because an error is found during compilation,
3031 or because the -fsyntax-only option is being used.
3032
3033 -Wstrict-selector-match (Objective-C and Objective-C++ only)
3034 Warn if multiple methods with differing argument and/or return
3035 types are found for a given selector when attempting to send a
3036 message using this selector to a receiver of type "id" or "Class".
3037 When this flag is off (which is the default behavior), the compiler
3038 omits such warnings if any differences found are confined to types
3039 that share the same size and alignment.
3040
3041 -Wundeclared-selector (Objective-C and Objective-C++ only)
3042 Warn if a "@selector(...)" expression referring to an undeclared
3043 selector is found. A selector is considered undeclared if no
3044 method with that name has been declared before the "@selector(...)"
3045 expression, either explicitly in an @interface or @protocol
3046 declaration, or implicitly in an @implementation section. This
3047 option always performs its checks as soon as a "@selector(...)"
3048 expression is found, while -Wselector only performs its checks in
3049 the final stage of compilation. This also enforces the coding
3050 style convention that methods and selectors must be declared before
3051 being used.
3052
3053 -print-objc-runtime-info
3054 Generate C header describing the largest structure that is passed
3055 by value, if any.
3056
3057 Options to Control Diagnostic Messages Formatting
3058 Traditionally, diagnostic messages have been formatted irrespective of
3059 the output device's aspect (e.g. its width, ...). You can use the
3060 options described below to control the formatting algorithm for
3061 diagnostic messages, e.g. how many characters per line, how often
3062 source location information should be reported. Note that some
3063 language front ends may not honor these options.
3064
3065 -fmessage-length=n
3066 Try to format error messages so that they fit on lines of about n
3067 characters. If n is zero, then no line-wrapping is done; each
3068 error message appears on a single line. This is the default for
3069 all front ends.
3070
3071 Note - this option also affects the display of the #error and
3072 #warning pre-processor directives, and the deprecated
3073 function/type/variable attribute. It does not however affect the
3074 pragma GCC warning and pragma GCC error pragmas.
3075
3076 -fdiagnostics-show-location=once
3077 Only meaningful in line-wrapping mode. Instructs the diagnostic
3078 messages reporter to emit source location information once; that
3079 is, in case the message is too long to fit on a single physical
3080 line and has to be wrapped, the source location won't be emitted
3081 (as prefix) again, over and over, in subsequent continuation lines.
3082 This is the default behavior.
3083
3084 -fdiagnostics-show-location=every-line
3085 Only meaningful in line-wrapping mode. Instructs the diagnostic
3086 messages reporter to emit the same source location information (as
3087 prefix) for physical lines that result from the process of breaking
3088 a message which is too long to fit on a single line.
3089
3090 -fdiagnostics-color[=WHEN]
3091 -fno-diagnostics-color
3092 Use color in diagnostics. WHEN is never, always, or auto. The
3093 default depends on how the compiler has been configured, it can be
3094 any of the above WHEN options or also never if GCC_COLORS
3095 environment variable isn't present in the environment, and auto
3096 otherwise. auto makes GCC use color only when the standard error
3097 is a terminal, and when not executing in an emacs shell. The forms
3098 -fdiagnostics-color and -fno-diagnostics-color are aliases for
3099 -fdiagnostics-color=always and -fdiagnostics-color=never,
3100 respectively.
3101
3102 The colors are defined by the environment variable GCC_COLORS. Its
3103 value is a colon-separated list of capabilities and Select Graphic
3104 Rendition (SGR) substrings. SGR commands are interpreted by the
3105 terminal or terminal emulator. (See the section in the
3106 documentation of your text terminal for permitted values and their
3107 meanings as character attributes.) These substring values are
3108 integers in decimal representation and can be concatenated with
3109 semicolons. Common values to concatenate include 1 for bold, 4 for
3110 underline, 5 for blink, 7 for inverse, 39 for default foreground
3111 color, 30 to 37 for foreground colors, 90 to 97 for 16-color mode
3112 foreground colors, 38;5;0 to 38;5;255 for 88-color and 256-color
3113 modes foreground colors, 49 for default background color, 40 to 47
3114 for background colors, 100 to 107 for 16-color mode background
3115 colors, and 48;5;0 to 48;5;255 for 88-color and 256-color modes
3116 background colors.
3117
3118 The default GCC_COLORS is
3119
3120 error=01;31:warning=01;35:note=01;36:range1=32:range2=34:locus=01:\
3121 quote=01:path=01;36:fixit-insert=32:fixit-delete=31:\
3122 diff-filename=01:diff-hunk=32:diff-delete=31:diff-insert=32:\
3123 type-diff=01;32
3124
3125 where 01;31 is bold red, 01;35 is bold magenta, 01;36 is bold cyan,
3126 32 is green, 34 is blue, 01 is bold, and 31 is red. Setting
3127 GCC_COLORS to the empty string disables colors. Supported
3128 capabilities are as follows.
3129
3130 "error="
3131 SGR substring for error: markers.
3132
3133 "warning="
3134 SGR substring for warning: markers.
3135
3136 "note="
3137 SGR substring for note: markers.
3138
3139 "path="
3140 SGR substring for colorizing paths of control-flow events as
3141 printed via -fdiagnostics-path-format=, such as the identifiers
3142 of individual events and lines indicating interprocedural calls
3143 and returns.
3144
3145 "range1="
3146 SGR substring for first additional range.
3147
3148 "range2="
3149 SGR substring for second additional range.
3150
3151 "locus="
3152 SGR substring for location information, file:line or
3153 file:line:column etc.
3154
3155 "quote="
3156 SGR substring for information printed within quotes.
3157
3158 "fixit-insert="
3159 SGR substring for fix-it hints suggesting text to be inserted
3160 or replaced.
3161
3162 "fixit-delete="
3163 SGR substring for fix-it hints suggesting text to be deleted.
3164
3165 "diff-filename="
3166 SGR substring for filename headers within generated patches.
3167
3168 "diff-hunk="
3169 SGR substring for the starts of hunks within generated patches.
3170
3171 "diff-delete="
3172 SGR substring for deleted lines within generated patches.
3173
3174 "diff-insert="
3175 SGR substring for inserted lines within generated patches.
3176
3177 "type-diff="
3178 SGR substring for highlighting mismatching types within
3179 template arguments in the C++ frontend.
3180
3181 -fdiagnostics-urls[=WHEN]
3182 Use escape sequences to embed URLs in diagnostics. For example,
3183 when -fdiagnostics-show-option emits text showing the command-line
3184 option controlling a diagnostic, embed a URL for documentation of
3185 that option.
3186
3187 WHEN is never, always, or auto. auto makes GCC use URL escape
3188 sequences only when the standard error is a terminal, and when not
3189 executing in an emacs shell or any graphical terminal which is
3190 known to be incompatible with this feature, see below.
3191
3192 The default depends on how the compiler has been configured. It
3193 can be any of the above WHEN options.
3194
3195 GCC can also be configured (via the
3196 --with-diagnostics-urls=auto-if-env configure-time option) so that
3197 the default is affected by environment variables. Under such a
3198 configuration, GCC defaults to using auto if either GCC_URLS or
3199 TERM_URLS environment variables are present and non-empty in the
3200 environment of the compiler, or never if neither are.
3201
3202 However, even with -fdiagnostics-urls=always the behavior is
3203 dependent on those environment variables: If GCC_URLS is set to
3204 empty or no, do not embed URLs in diagnostics. If set to st, URLs
3205 use ST escape sequences. If set to bel, the default, URLs use BEL
3206 escape sequences. Any other non-empty value enables the feature.
3207 If GCC_URLS is not set, use TERM_URLS as a fallback. Note: ST is
3208 an ANSI escape sequence, string terminator ESC \, BEL is an ASCII
3209 character, CTRL-G that usually sounds like a beep.
3210
3211 At this time GCC tries to detect also a few terminals that are
3212 known to not implement the URL feature, and have bugs or at least
3213 had bugs in some versions that are still in use, where the URL
3214 escapes are likely to misbehave, i.e. print garbage on the screen.
3215 That list is currently xfce4-terminal, certain known to be buggy
3216 gnome-terminal versions, the linux console, and mingw. This check
3217 can be skipped with the -fdiagnostics-urls=always.
3218
3219 -fno-diagnostics-show-option
3220 By default, each diagnostic emitted includes text indicating the
3221 command-line option that directly controls the diagnostic (if such
3222 an option is known to the diagnostic machinery). Specifying the
3223 -fno-diagnostics-show-option flag suppresses that behavior.
3224
3225 -fno-diagnostics-show-caret
3226 By default, each diagnostic emitted includes the original source
3227 line and a caret ^ indicating the column. This option suppresses
3228 this information. The source line is truncated to n characters, if
3229 the -fmessage-length=n option is given. When the output is done to
3230 the terminal, the width is limited to the width given by the
3231 COLUMNS environment variable or, if not set, to the terminal width.
3232
3233 -fno-diagnostics-show-labels
3234 By default, when printing source code (via
3235 -fdiagnostics-show-caret), diagnostics can label ranges of source
3236 code with pertinent information, such as the types of expressions:
3237
3238 printf ("foo %s bar", long_i + long_j);
3239 ~^ ~~~~~~~~~~~~~~~
3240 | |
3241 char * long int
3242
3243 This option suppresses the printing of these labels (in the example
3244 above, the vertical bars and the "char *" and "long int" text).
3245
3246 -fno-diagnostics-show-cwe
3247 Diagnostic messages can optionally have an associated
3248 @url{https://cwe.mitre.org/index.html, CWE} identifier. GCC itself
3249 only provides such metadata for some of the -fanalyzer diagnostics.
3250 GCC plugins may also provide diagnostics with such metadata. By
3251 default, if this information is present, it will be printed with
3252 the diagnostic. This option suppresses the printing of this
3253 metadata.
3254
3255 -fno-diagnostics-show-line-numbers
3256 By default, when printing source code (via
3257 -fdiagnostics-show-caret), a left margin is printed, showing line
3258 numbers. This option suppresses this left margin.
3259
3260 -fdiagnostics-minimum-margin-width=width
3261 This option controls the minimum width of the left margin printed
3262 by -fdiagnostics-show-line-numbers. It defaults to 6.
3263
3264 -fdiagnostics-parseable-fixits
3265 Emit fix-it hints in a machine-parseable format, suitable for
3266 consumption by IDEs. For each fix-it, a line will be printed after
3267 the relevant diagnostic, starting with the string "fix-it:". For
3268 example:
3269
3270 fix-it:"test.c":{45:3-45:21}:"gtk_widget_show_all"
3271
3272 The location is expressed as a half-open range, expressed as a
3273 count of bytes, starting at byte 1 for the initial column. In the
3274 above example, bytes 3 through 20 of line 45 of "test.c" are to be
3275 replaced with the given string:
3276
3277 00000000011111111112222222222
3278 12345678901234567890123456789
3279 gtk_widget_showall (dlg);
3280 ^^^^^^^^^^^^^^^^^^
3281 gtk_widget_show_all
3282
3283 The filename and replacement string escape backslash as "\\", tab
3284 as "\t", newline as "\n", double quotes as "\"", non-printable
3285 characters as octal (e.g. vertical tab as "\013").
3286
3287 An empty replacement string indicates that the given range is to be
3288 removed. An empty range (e.g. "45:3-45:3") indicates that the
3289 string is to be inserted at the given position.
3290
3291 -fdiagnostics-generate-patch
3292 Print fix-it hints to stderr in unified diff format, after any
3293 diagnostics are printed. For example:
3294
3295 --- test.c
3296 +++ test.c
3297 @ -42,5 +42,5 @
3298
3299 void show_cb(GtkDialog *dlg)
3300 {
3301 - gtk_widget_showall(dlg);
3302 + gtk_widget_show_all(dlg);
3303 }
3304
3305 The diff may or may not be colorized, following the same rules as
3306 for diagnostics (see -fdiagnostics-color).
3307
3308 -fdiagnostics-show-template-tree
3309 In the C++ frontend, when printing diagnostics showing mismatching
3310 template types, such as:
3311
3312 could not convert 'std::map<int, std::vector<double> >()'
3313 from 'map<[...],vector<double>>' to 'map<[...],vector<float>>
3314
3315 the -fdiagnostics-show-template-tree flag enables printing a tree-
3316 like structure showing the common and differing parts of the types,
3317 such as:
3318
3319 map<
3320 [...],
3321 vector<
3322 [double != float]>>
3323
3324 The parts that differ are highlighted with color ("double" and
3325 "float" in this case).
3326
3327 -fno-elide-type
3328 By default when the C++ frontend prints diagnostics showing
3329 mismatching template types, common parts of the types are printed
3330 as "[...]" to simplify the error message. For example:
3331
3332 could not convert 'std::map<int, std::vector<double> >()'
3333 from 'map<[...],vector<double>>' to 'map<[...],vector<float>>
3334
3335 Specifying the -fno-elide-type flag suppresses that behavior. This
3336 flag also affects the output of the
3337 -fdiagnostics-show-template-tree flag.
3338
3339 -fdiagnostics-path-format=KIND
3340 Specify how to print paths of control-flow events for diagnostics
3341 that have such a path associated with them.
3342
3343 KIND is none, separate-events, or inline-events, the default.
3344
3345 none means to not print diagnostic paths.
3346
3347 separate-events means to print a separate "note" diagnostic for
3348 each event within the diagnostic. For example:
3349
3350 test.c:29:5: error: passing NULL as argument 1 to 'PyList_Append' which requires a non-NULL parameter
3351 test.c:25:10: note: (1) when 'PyList_New' fails, returning NULL
3352 test.c:27:3: note: (2) when 'i < count'
3353 test.c:29:5: note: (3) when calling 'PyList_Append', passing NULL from (1) as argument 1
3354
3355 inline-events means to print the events "inline" within the source
3356 code. This view attempts to consolidate the events into runs of
3357 sufficiently-close events, printing them as labelled ranges within
3358 the source.
3359
3360 For example, the same events as above might be printed as:
3361
3362 'test': events 1-3
3363 |
3364 | 25 | list = PyList_New(0);
3365 | | ^~~~~~~~~~~~~
3366 | | |
3367 | | (1) when 'PyList_New' fails, returning NULL
3368 | 26 |
3369 | 27 | for (i = 0; i < count; i++) {
3370 | | ~~~
3371 | | |
3372 | | (2) when 'i < count'
3373 | 28 | item = PyLong_FromLong(random());
3374 | 29 | PyList_Append(list, item);
3375 | | ~~~~~~~~~~~~~~~~~~~~~~~~~
3376 | | |
3377 | | (3) when calling 'PyList_Append', passing NULL from (1) as argument 1
3378 |
3379
3380 Interprocedural control flow is shown by grouping the events by
3381 stack frame, and using indentation to show how stack frames are
3382 nested, pushed, and popped.
3383
3384 For example:
3385
3386 'test': events 1-2
3387 |
3388 | 133 | {
3389 | | ^
3390 | | |
3391 | | (1) entering 'test'
3392 | 134 | boxed_int *obj = make_boxed_int (i);
3393 | | ~~~~~~~~~~~~~~~~~~
3394 | | |
3395 | | (2) calling 'make_boxed_int'
3396 |
3397 +--> 'make_boxed_int': events 3-4
3398 |
3399 | 120 | {
3400 | | ^
3401 | | |
3402 | | (3) entering 'make_boxed_int'
3403 | 121 | boxed_int *result = (boxed_int *)wrapped_malloc (sizeof (boxed_int));
3404 | | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3405 | | |
3406 | | (4) calling 'wrapped_malloc'
3407 |
3408 +--> 'wrapped_malloc': events 5-6
3409 |
3410 | 7 | {
3411 | | ^
3412 | | |
3413 | | (5) entering 'wrapped_malloc'
3414 | 8 | return malloc (size);
3415 | | ~~~~~~~~~~~~~
3416 | | |
3417 | | (6) calling 'malloc'
3418 |
3419 <-------------+
3420 |
3421 'test': event 7
3422 |
3423 | 138 | free_boxed_int (obj);
3424 | | ^~~~~~~~~~~~~~~~~~~~
3425 | | |
3426 | | (7) calling 'free_boxed_int'
3427 |
3428 (etc)
3429
3430 -fdiagnostics-show-path-depths
3431 This option provides additional information when printing control-
3432 flow paths associated with a diagnostic.
3433
3434 If this is option is provided then the stack depth will be printed
3435 for each run of events within
3436 -fdiagnostics-path-format=separate-events.
3437
3438 This is intended for use by GCC developers and plugin developers
3439 when debugging diagnostics that report interprocedural control
3440 flow.
3441
3442 -fno-show-column
3443 Do not print column numbers in diagnostics. This may be necessary
3444 if diagnostics are being scanned by a program that does not
3445 understand the column numbers, such as dejagnu.
3446
3447 -fdiagnostics-format=FORMAT
3448 Select a different format for printing diagnostics. FORMAT is text
3449 or json. The default is text.
3450
3451 The json format consists of a top-level JSON array containing JSON
3452 objects representing the diagnostics.
3453
3454 The JSON is emitted as one line, without formatting; the examples
3455 below have been formatted for clarity.
3456
3457 Diagnostics can have child diagnostics. For example, this error
3458 and note:
3459
3460 misleading-indentation.c:15:3: warning: this 'if' clause does not
3461 guard... [-Wmisleading-indentation]
3462 15 | if (flag)
3463 | ^~
3464 misleading-indentation.c:17:5: note: ...this statement, but the latter
3465 is misleadingly indented as if it were guarded by the 'if'
3466 17 | y = 2;
3467 | ^
3468
3469 might be printed in JSON form (after formatting) like this:
3470
3471 [
3472 {
3473 "kind": "warning",
3474 "locations": [
3475 {
3476 "caret": {
3477 "column": 3,
3478 "file": "misleading-indentation.c",
3479 "line": 15
3480 },
3481 "finish": {
3482 "column": 4,
3483 "file": "misleading-indentation.c",
3484 "line": 15
3485 }
3486 }
3487 ],
3488 "message": "this \u2018if\u2019 clause does not guard...",
3489 "option": "-Wmisleading-indentation",
3490 "option_url": "https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wmisleading-indentation",
3491 "children": [
3492 {
3493 "kind": "note",
3494 "locations": [
3495 {
3496 "caret": {
3497 "column": 5,
3498 "file": "misleading-indentation.c",
3499 "line": 17
3500 }
3501 }
3502 ],
3503 "message": "...this statement, but the latter is ..."
3504 }
3505 ]
3506 },
3507 ...
3508 ]
3509
3510 where the "note" is a child of the "warning".
3511
3512 A diagnostic has a "kind". If this is "warning", then there is an
3513 "option" key describing the command-line option controlling the
3514 warning.
3515
3516 A diagnostic can contain zero or more locations. Each location has
3517 up to three positions within it: a "caret" position and optional
3518 "start" and "finish" positions. A location can also have an
3519 optional "label" string. For example, this error:
3520
3521 bad-binary-ops.c:64:23: error: invalid operands to binary + (have 'S' {aka
3522 'struct s'} and 'T' {aka 'struct t'})
3523 64 | return callee_4a () + callee_4b ();
3524 | ~~~~~~~~~~~~ ^ ~~~~~~~~~~~~
3525 | | |
3526 | | T {aka struct t}
3527 | S {aka struct s}
3528
3529 has three locations. Its primary location is at the "+" token at
3530 column 23. It has two secondary locations, describing the left and
3531 right-hand sides of the expression, which have labels. It might be
3532 printed in JSON form as:
3533
3534 {
3535 "children": [],
3536 "kind": "error",
3537 "locations": [
3538 {
3539 "caret": {
3540 "column": 23, "file": "bad-binary-ops.c", "line": 64
3541 }
3542 },
3543 {
3544 "caret": {
3545 "column": 10, "file": "bad-binary-ops.c", "line": 64
3546 },
3547 "finish": {
3548 "column": 21, "file": "bad-binary-ops.c", "line": 64
3549 },
3550 "label": "S {aka struct s}"
3551 },
3552 {
3553 "caret": {
3554 "column": 25, "file": "bad-binary-ops.c", "line": 64
3555 },
3556 "finish": {
3557 "column": 36, "file": "bad-binary-ops.c", "line": 64
3558 },
3559 "label": "T {aka struct t}"
3560 }
3561 ],
3562 "message": "invalid operands to binary + ..."
3563 }
3564
3565 If a diagnostic contains fix-it hints, it has a "fixits" array,
3566 consisting of half-open intervals, similar to the output of
3567 -fdiagnostics-parseable-fixits. For example, this diagnostic with
3568 a replacement fix-it hint:
3569
3570 demo.c:8:15: error: 'struct s' has no member named 'colour'; did you
3571 mean 'color'?
3572 8 | return ptr->colour;
3573 | ^~~~~~
3574 | color
3575
3576 might be printed in JSON form as:
3577
3578 {
3579 "children": [],
3580 "fixits": [
3581 {
3582 "next": {
3583 "column": 21,
3584 "file": "demo.c",
3585 "line": 8
3586 },
3587 "start": {
3588 "column": 15,
3589 "file": "demo.c",
3590 "line": 8
3591 },
3592 "string": "color"
3593 }
3594 ],
3595 "kind": "error",
3596 "locations": [
3597 {
3598 "caret": {
3599 "column": 15,
3600 "file": "demo.c",
3601 "line": 8
3602 },
3603 "finish": {
3604 "column": 20,
3605 "file": "demo.c",
3606 "line": 8
3607 }
3608 }
3609 ],
3610 "message": "\u2018struct s\u2019 has no member named ..."
3611 }
3612
3613 where the fix-it hint suggests replacing the text from "start" up
3614 to but not including "next" with "string"'s value. Deletions are
3615 expressed via an empty value for "string", insertions by having
3616 "start" equal "next".
3617
3618 If the diagnostic has a path of control-flow events associated with
3619 it, it has a "path" array of objects representing the events. Each
3620 event object has a "description" string, a "location" object, along
3621 with a "function" string and a "depth" number for representing
3622 interprocedural paths. The "function" represents the current
3623 function at that event, and the "depth" represents the stack depth
3624 relative to some baseline: the higher, the more frames are within
3625 the stack.
3626
3627 For example, the intraprocedural example shown for
3628 -fdiagnostics-path-format= might have this JSON for its path:
3629
3630 "path": [
3631 {
3632 "depth": 0,
3633 "description": "when 'PyList_New' fails, returning NULL",
3634 "function": "test",
3635 "location": {
3636 "column": 10,
3637 "file": "test.c",
3638 "line": 25
3639 }
3640 },
3641 {
3642 "depth": 0,
3643 "description": "when 'i < count'",
3644 "function": "test",
3645 "location": {
3646 "column": 3,
3647 "file": "test.c",
3648 "line": 27
3649 }
3650 },
3651 {
3652 "depth": 0,
3653 "description": "when calling 'PyList_Append', passing NULL from (1) as argument 1",
3654 "function": "test",
3655 "location": {
3656 "column": 5,
3657 "file": "test.c",
3658 "line": 29
3659 }
3660 }
3661 ]
3662
3663 Options to Request or Suppress Warnings
3664 Warnings are diagnostic messages that report constructions that are not
3665 inherently erroneous but that are risky or suggest there may have been
3666 an error.
3667
3668 The following language-independent options do not enable specific
3669 warnings but control the kinds of diagnostics produced by GCC.
3670
3671 -fsyntax-only
3672 Check the code for syntax errors, but don't do anything beyond
3673 that.
3674
3675 -fmax-errors=n
3676 Limits the maximum number of error messages to n, at which point
3677 GCC bails out rather than attempting to continue processing the
3678 source code. If n is 0 (the default), there is no limit on the
3679 number of error messages produced. If -Wfatal-errors is also
3680 specified, then -Wfatal-errors takes precedence over this option.
3681
3682 -w Inhibit all warning messages.
3683
3684 -Werror
3685 Make all warnings into errors.
3686
3687 -Werror=
3688 Make the specified warning into an error. The specifier for a
3689 warning is appended; for example -Werror=switch turns the warnings
3690 controlled by -Wswitch into errors. This switch takes a negative
3691 form, to be used to negate -Werror for specific warnings; for
3692 example -Wno-error=switch makes -Wswitch warnings not be errors,
3693 even when -Werror is in effect.
3694
3695 The warning message for each controllable warning includes the
3696 option that controls the warning. That option can then be used
3697 with -Werror= and -Wno-error= as described above. (Printing of the
3698 option in the warning message can be disabled using the
3699 -fno-diagnostics-show-option flag.)
3700
3701 Note that specifying -Werror=foo automatically implies -Wfoo.
3702 However, -Wno-error=foo does not imply anything.
3703
3704 -Wfatal-errors
3705 This option causes the compiler to abort compilation on the first
3706 error occurred rather than trying to keep going and printing
3707 further error messages.
3708
3709 You can request many specific warnings with options beginning with -W,
3710 for example -Wimplicit to request warnings on implicit declarations.
3711 Each of these specific warning options also has a negative form
3712 beginning -Wno- to turn off warnings; for example, -Wno-implicit. This
3713 manual lists only one of the two forms, whichever is not the default.
3714 For further language-specific options also refer to C++ Dialect Options
3715 and Objective-C and Objective-C++ Dialect Options. Additional warnings
3716 can be produced by enabling the static analyzer;
3717
3718 Some options, such as -Wall and -Wextra, turn on other options, such as
3719 -Wunused, which may turn on further options, such as -Wunused-value.
3720 The combined effect of positive and negative forms is that more
3721 specific options have priority over less specific ones, independently
3722 of their position in the command-line. For options of the same
3723 specificity, the last one takes effect. Options enabled or disabled via
3724 pragmas take effect as if they appeared at the end of the command-line.
3725
3726 When an unrecognized warning option is requested (e.g.,
3727 -Wunknown-warning), GCC emits a diagnostic stating that the option is
3728 not recognized. However, if the -Wno- form is used, the behavior is
3729 slightly different: no diagnostic is produced for -Wno-unknown-warning
3730 unless other diagnostics are being produced. This allows the use of
3731 new -Wno- options with old compilers, but if something goes wrong, the
3732 compiler warns that an unrecognized option is present.
3733
3734 The effectiveness of some warnings depends on optimizations also being
3735 enabled. For example -Wsuggest-final-types is more effective with link-
3736 time optimization and -Wmaybe-uninitialized does not warn at all unless
3737 optimization is enabled.
3738
3739 -Wpedantic
3740 -pedantic
3741 Issue all the warnings demanded by strict ISO C and ISO C++; reject
3742 all programs that use forbidden extensions, and some other programs
3743 that do not follow ISO C and ISO C++. For ISO C, follows the
3744 version of the ISO C standard specified by any -std option used.
3745
3746 Valid ISO C and ISO C++ programs should compile properly with or
3747 without this option (though a rare few require -ansi or a -std
3748 option specifying the required version of ISO C). However, without
3749 this option, certain GNU extensions and traditional C and C++
3750 features are supported as well. With this option, they are
3751 rejected.
3752
3753 -Wpedantic does not cause warning messages for use of the alternate
3754 keywords whose names begin and end with __. This alternate format
3755 can also be used to disable warnings for non-ISO __intN types, i.e.
3756 __intN__. Pedantic warnings are also disabled in the expression
3757 that follows "__extension__". However, only system header files
3758 should use these escape routes; application programs should avoid
3759 them.
3760
3761 Some users try to use -Wpedantic to check programs for strict ISO C
3762 conformance. They soon find that it does not do quite what they
3763 want: it finds some non-ISO practices, but not all---only those for
3764 which ISO C requires a diagnostic, and some others for which
3765 diagnostics have been added.
3766
3767 A feature to report any failure to conform to ISO C might be useful
3768 in some instances, but would require considerable additional work
3769 and would be quite different from -Wpedantic. We don't have plans
3770 to support such a feature in the near future.
3771
3772 Where the standard specified with -std represents a GNU extended
3773 dialect of C, such as gnu90 or gnu99, there is a corresponding base
3774 standard, the version of ISO C on which the GNU extended dialect is
3775 based. Warnings from -Wpedantic are given where they are required
3776 by the base standard. (It does not make sense for such warnings to
3777 be given only for features not in the specified GNU C dialect,
3778 since by definition the GNU dialects of C include all features the
3779 compiler supports with the given option, and there would be nothing
3780 to warn about.)
3781
3782 -pedantic-errors
3783 Give an error whenever the base standard (see -Wpedantic) requires
3784 a diagnostic, in some cases where there is undefined behavior at
3785 compile-time and in some other cases that do not prevent
3786 compilation of programs that are valid according to the standard.
3787 This is not equivalent to -Werror=pedantic, since there are errors
3788 enabled by this option and not enabled by the latter and vice
3789 versa.
3790
3791 -Wall
3792 This enables all the warnings about constructions that some users
3793 consider questionable, and that are easy to avoid (or modify to
3794 prevent the warning), even in conjunction with macros. This also
3795 enables some language-specific warnings described in C++ Dialect
3796 Options and Objective-C and Objective-C++ Dialect Options.
3797
3798 -Wall turns on the following warning flags:
3799
3800 -Waddress -Warray-bounds=1 (only with -O2) -Wbool-compare
3801 -Wbool-operation -Wc++11-compat -Wc++14-compat -Wcatch-value (C++
3802 and Objective-C++ only) -Wchar-subscripts -Wcomment
3803 -Wduplicate-decl-specifier (C and Objective-C only) -Wenum-compare
3804 (in C/ObjC; this is on by default in C++) -Wenum-conversion in
3805 C/ObjC; -Wformat -Wformat-overflow -Wformat-truncation
3806 -Wint-in-bool-context -Wimplicit (C and Objective-C only)
3807 -Wimplicit-int (C and Objective-C only)
3808 -Wimplicit-function-declaration (C and Objective-C only)
3809 -Winit-self (only for C++) -Wlogical-not-parentheses -Wmain (only
3810 for C/ObjC and unless -ffreestanding) -Wmaybe-uninitialized
3811 -Wmemset-elt-size -Wmemset-transposed-args -Wmisleading-indentation
3812 (only for C/C++) -Wmissing-attributes -Wmissing-braces (only for
3813 C/ObjC) -Wmultistatement-macros -Wnarrowing (only for C++)
3814 -Wnonnull -Wnonnull-compare -Wopenmp-simd -Wparentheses
3815 -Wpessimizing-move (only for C++) -Wpointer-sign -Wreorder
3816 -Wrestrict -Wreturn-type -Wsequence-point -Wsign-compare (only in
3817 C++) -Wsizeof-pointer-div -Wsizeof-pointer-memaccess
3818 -Wstrict-aliasing -Wstrict-overflow=1 -Wswitch
3819 -Wtautological-compare -Wtrigraphs -Wuninitialized
3820 -Wunknown-pragmas -Wunused-function -Wunused-label -Wunused-value
3821 -Wunused-variable -Wvolatile-register-var -Wzero-length-bounds
3822
3823 Note that some warning flags are not implied by -Wall. Some of
3824 them warn about constructions that users generally do not consider
3825 questionable, but which occasionally you might wish to check for;
3826 others warn about constructions that are necessary or hard to avoid
3827 in some cases, and there is no simple way to modify the code to
3828 suppress the warning. Some of them are enabled by -Wextra but many
3829 of them must be enabled individually.
3830
3831 -Wextra
3832 This enables some extra warning flags that are not enabled by
3833 -Wall. (This option used to be called -W. The older name is still
3834 supported, but the newer name is more descriptive.)
3835
3836 -Wclobbered -Wcast-function-type -Wdeprecated-copy (C++ only)
3837 -Wempty-body -Wignored-qualifiers -Wimplicit-fallthrough=3
3838 -Wmissing-field-initializers -Wmissing-parameter-type (C only)
3839 -Wold-style-declaration (C only) -Woverride-init -Wsign-compare (C
3840 only) -Wstring-compare -Wredundant-move (only for C++)
3841 -Wtype-limits -Wuninitialized -Wshift-negative-value (in C++03 and
3842 in C99 and newer) -Wunused-parameter (only with -Wunused or -Wall)
3843 -Wunused-but-set-parameter (only with -Wunused or -Wall)
3844
3845 The option -Wextra also prints warning messages for the following
3846 cases:
3847
3848 * A pointer is compared against integer zero with "<", "<=", ">",
3849 or ">=".
3850
3851 * (C++ only) An enumerator and a non-enumerator both appear in a
3852 conditional expression.
3853
3854 * (C++ only) Ambiguous virtual bases.
3855
3856 * (C++ only) Subscripting an array that has been declared
3857 "register".
3858
3859 * (C++ only) Taking the address of a variable that has been
3860 declared "register".
3861
3862 * (C++ only) A base class is not initialized in the copy
3863 constructor of a derived class.
3864
3865 -Wabi (C, Objective-C, C++ and Objective-C++ only)
3866 Warn about code affected by ABI changes. This includes code that
3867 may not be compatible with the vendor-neutral C++ ABI as well as
3868 the psABI for the particular target.
3869
3870 Since G++ now defaults to updating the ABI with each major release,
3871 normally -Wabi warns only about C++ ABI compatibility problems if
3872 there is a check added later in a release series for an ABI issue
3873 discovered since the initial release. -Wabi warns about more
3874 things if an older ABI version is selected (with -fabi-version=n).
3875
3876 -Wabi can also be used with an explicit version number to warn
3877 about C++ ABI compatibility with a particular -fabi-version level,
3878 e.g. -Wabi=2 to warn about changes relative to -fabi-version=2.
3879
3880 If an explicit version number is provided and -fabi-compat-version
3881 is not specified, the version number from this option is used for
3882 compatibility aliases. If no explicit version number is provided
3883 with this option, but -fabi-compat-version is specified, that
3884 version number is used for C++ ABI warnings.
3885
3886 Although an effort has been made to warn about all such cases,
3887 there are probably some cases that are not warned about, even
3888 though G++ is generating incompatible code. There may also be
3889 cases where warnings are emitted even though the code that is
3890 generated is compatible.
3891
3892 You should rewrite your code to avoid these warnings if you are
3893 concerned about the fact that code generated by G++ may not be
3894 binary compatible with code generated by other compilers.
3895
3896 Known incompatibilities in -fabi-version=2 (which was the default
3897 from GCC 3.4 to 4.9) include:
3898
3899 * A template with a non-type template parameter of reference type
3900 was mangled incorrectly:
3901
3902 extern int N;
3903 template <int &> struct S {};
3904 void n (S<N>) {2}
3905
3906 This was fixed in -fabi-version=3.
3907
3908 * SIMD vector types declared using "__attribute ((vector_size))"
3909 were mangled in a non-standard way that does not allow for
3910 overloading of functions taking vectors of different sizes.
3911
3912 The mangling was changed in -fabi-version=4.
3913
3914 * "__attribute ((const))" and "noreturn" were mangled as type
3915 qualifiers, and "decltype" of a plain declaration was folded
3916 away.
3917
3918 These mangling issues were fixed in -fabi-version=5.
3919
3920 * Scoped enumerators passed as arguments to a variadic function
3921 are promoted like unscoped enumerators, causing "va_arg" to
3922 complain. On most targets this does not actually affect the
3923 parameter passing ABI, as there is no way to pass an argument
3924 smaller than "int".
3925
3926 Also, the ABI changed the mangling of template argument packs,
3927 "const_cast", "static_cast", prefix increment/decrement, and a
3928 class scope function used as a template argument.
3929
3930 These issues were corrected in -fabi-version=6.
3931
3932 * Lambdas in default argument scope were mangled incorrectly, and
3933 the ABI changed the mangling of "nullptr_t".
3934
3935 These issues were corrected in -fabi-version=7.
3936
3937 * When mangling a function type with function-cv-qualifiers, the
3938 un-qualified function type was incorrectly treated as a
3939 substitution candidate.
3940
3941 This was fixed in -fabi-version=8, the default for GCC 5.1.
3942
3943 * "decltype(nullptr)" incorrectly had an alignment of 1, leading
3944 to unaligned accesses. Note that this did not affect the ABI
3945 of a function with a "nullptr_t" parameter, as parameters have
3946 a minimum alignment.
3947
3948 This was fixed in -fabi-version=9, the default for GCC 5.2.
3949
3950 * Target-specific attributes that affect the identity of a type,
3951 such as ia32 calling conventions on a function type (stdcall,
3952 regparm, etc.), did not affect the mangled name, leading to
3953 name collisions when function pointers were used as template
3954 arguments.
3955
3956 This was fixed in -fabi-version=10, the default for GCC 6.1.
3957
3958 This option also enables warnings about psABI-related changes. The
3959 known psABI changes at this point include:
3960
3961 * For SysV/x86-64, unions with "long double" members are passed
3962 in memory as specified in psABI. Prior to GCC 4.4, this was
3963 not the case. For example:
3964
3965 union U {
3966 long double ld;
3967 int i;
3968 };
3969
3970 "union U" is now always passed in memory.
3971
3972 -Wchar-subscripts
3973 Warn if an array subscript has type "char". This is a common cause
3974 of error, as programmers often forget that this type is signed on
3975 some machines. This warning is enabled by -Wall.
3976
3977 -Wno-coverage-mismatch
3978 Warn if feedback profiles do not match when using the -fprofile-use
3979 option. If a source file is changed between compiling with
3980 -fprofile-generate and with -fprofile-use, the files with the
3981 profile feedback can fail to match the source file and GCC cannot
3982 use the profile feedback information. By default, this warning is
3983 enabled and is treated as an error. -Wno-coverage-mismatch can be
3984 used to disable the warning or -Wno-error=coverage-mismatch can be
3985 used to disable the error. Disabling the error for this warning
3986 can result in poorly optimized code and is useful only in the case
3987 of very minor changes such as bug fixes to an existing code-base.
3988 Completely disabling the warning is not recommended.
3989
3990 -Wno-cpp
3991 (C, Objective-C, C++, Objective-C++ and Fortran only) Suppress
3992 warning messages emitted by "#warning" directives.
3993
3994 -Wdouble-promotion (C, C++, Objective-C and Objective-C++ only)
3995 Give a warning when a value of type "float" is implicitly promoted
3996 to "double". CPUs with a 32-bit "single-precision" floating-point
3997 unit implement "float" in hardware, but emulate "double" in
3998 software. On such a machine, doing computations using "double"
3999 values is much more expensive because of the overhead required for
4000 software emulation.
4001
4002 It is easy to accidentally do computations with "double" because
4003 floating-point literals are implicitly of type "double". For
4004 example, in:
4005
4006 float area(float radius)
4007 {
4008 return 3.14159 * radius * radius;
4009 }
4010
4011 the compiler performs the entire computation with "double" because
4012 the floating-point literal is a "double".
4013
4014 -Wduplicate-decl-specifier (C and Objective-C only)
4015 Warn if a declaration has duplicate "const", "volatile", "restrict"
4016 or "_Atomic" specifier. This warning is enabled by -Wall.
4017
4018 -Wformat
4019 -Wformat=n
4020 Check calls to "printf" and "scanf", etc., to make sure that the
4021 arguments supplied have types appropriate to the format string
4022 specified, and that the conversions specified in the format string
4023 make sense. This includes standard functions, and others specified
4024 by format attributes, in the "printf", "scanf", "strftime" and
4025 "strfmon" (an X/Open extension, not in the C standard) families (or
4026 other target-specific families). Which functions are checked
4027 without format attributes having been specified depends on the
4028 standard version selected, and such checks of functions without the
4029 attribute specified are disabled by -ffreestanding or -fno-builtin.
4030
4031 The formats are checked against the format features supported by
4032 GNU libc version 2.2. These include all ISO C90 and C99 features,
4033 as well as features from the Single Unix Specification and some BSD
4034 and GNU extensions. Other library implementations may not support
4035 all these features; GCC does not support warning about features
4036 that go beyond a particular library's limitations. However, if
4037 -Wpedantic is used with -Wformat, warnings are given about format
4038 features not in the selected standard version (but not for
4039 "strfmon" formats, since those are not in any version of the C
4040 standard).
4041
4042 -Wformat=1
4043 -Wformat
4044 Option -Wformat is equivalent to -Wformat=1, and -Wno-format is
4045 equivalent to -Wformat=0. Since -Wformat also checks for null
4046 format arguments for several functions, -Wformat also implies
4047 -Wnonnull. Some aspects of this level of format checking can
4048 be disabled by the options: -Wno-format-contains-nul,
4049 -Wno-format-extra-args, and -Wno-format-zero-length. -Wformat
4050 is enabled by -Wall.
4051
4052 -Wformat=2
4053 Enable -Wformat plus additional format checks. Currently
4054 equivalent to -Wformat -Wformat-nonliteral -Wformat-security
4055 -Wformat-y2k.
4056
4057 -Wno-format-contains-nul
4058 If -Wformat is specified, do not warn about format strings that
4059 contain NUL bytes.
4060
4061 -Wno-format-extra-args
4062 If -Wformat is specified, do not warn about excess arguments to a
4063 "printf" or "scanf" format function. The C standard specifies that
4064 such arguments are ignored.
4065
4066 Where the unused arguments lie between used arguments that are
4067 specified with $ operand number specifications, normally warnings
4068 are still given, since the implementation could not know what type
4069 to pass to "va_arg" to skip the unused arguments. However, in the
4070 case of "scanf" formats, this option suppresses the warning if the
4071 unused arguments are all pointers, since the Single Unix
4072 Specification says that such unused arguments are allowed.
4073
4074 -Wformat-overflow
4075 -Wformat-overflow=level
4076 Warn about calls to formatted input/output functions such as
4077 "sprintf" and "vsprintf" that might overflow the destination
4078 buffer. When the exact number of bytes written by a format
4079 directive cannot be determined at compile-time it is estimated
4080 based on heuristics that depend on the level argument and on
4081 optimization. While enabling optimization will in most cases
4082 improve the accuracy of the warning, it may also result in false
4083 positives.
4084
4085 -Wformat-overflow
4086 -Wformat-overflow=1
4087 Level 1 of -Wformat-overflow enabled by -Wformat employs a
4088 conservative approach that warns only about calls that most
4089 likely overflow the buffer. At this level, numeric arguments
4090 to format directives with unknown values are assumed to have
4091 the value of one, and strings of unknown length to be empty.
4092 Numeric arguments that are known to be bounded to a subrange of
4093 their type, or string arguments whose output is bounded either
4094 by their directive's precision or by a finite set of string
4095 literals, are assumed to take on the value within the range
4096 that results in the most bytes on output. For example, the
4097 call to "sprintf" below is diagnosed because even with both a
4098 and b equal to zero, the terminating NUL character ('\0')
4099 appended by the function to the destination buffer will be
4100 written past its end. Increasing the size of the buffer by a
4101 single byte is sufficient to avoid the warning, though it may
4102 not be sufficient to avoid the overflow.
4103
4104 void f (int a, int b)
4105 {
4106 char buf [13];
4107 sprintf (buf, "a = %i, b = %i\n", a, b);
4108 }
4109
4110 -Wformat-overflow=2
4111 Level 2 warns also about calls that might overflow the
4112 destination buffer given an argument of sufficient length or
4113 magnitude. At level 2, unknown numeric arguments are assumed
4114 to have the minimum representable value for signed types with a
4115 precision greater than 1, and the maximum representable value
4116 otherwise. Unknown string arguments whose length cannot be
4117 assumed to be bounded either by the directive's precision, or
4118 by a finite set of string literals they may evaluate to, or the
4119 character array they may point to, are assumed to be 1
4120 character long.
4121
4122 At level 2, the call in the example above is again diagnosed,
4123 but this time because with a equal to a 32-bit "INT_MIN" the
4124 first %i directive will write some of its digits beyond the end
4125 of the destination buffer. To make the call safe regardless of
4126 the values of the two variables, the size of the destination
4127 buffer must be increased to at least 34 bytes. GCC includes
4128 the minimum size of the buffer in an informational note
4129 following the warning.
4130
4131 An alternative to increasing the size of the destination buffer
4132 is to constrain the range of formatted values. The maximum
4133 length of string arguments can be bounded by specifying the
4134 precision in the format directive. When numeric arguments of
4135 format directives can be assumed to be bounded by less than the
4136 precision of their type, choosing an appropriate length
4137 modifier to the format specifier will reduce the required
4138 buffer size. For example, if a and b in the example above can
4139 be assumed to be within the precision of the "short int" type
4140 then using either the %hi format directive or casting the
4141 argument to "short" reduces the maximum required size of the
4142 buffer to 24 bytes.
4143
4144 void f (int a, int b)
4145 {
4146 char buf [23];
4147 sprintf (buf, "a = %hi, b = %i\n", a, (short)b);
4148 }
4149
4150 -Wno-format-zero-length
4151 If -Wformat is specified, do not warn about zero-length formats.
4152 The C standard specifies that zero-length formats are allowed.
4153
4154 -Wformat-nonliteral
4155 If -Wformat is specified, also warn if the format string is not a
4156 string literal and so cannot be checked, unless the format function
4157 takes its format arguments as a "va_list".
4158
4159 -Wformat-security
4160 If -Wformat is specified, also warn about uses of format functions
4161 that represent possible security problems. At present, this warns
4162 about calls to "printf" and "scanf" functions where the format
4163 string is not a string literal and there are no format arguments,
4164 as in "printf (foo);". This may be a security hole if the format
4165 string came from untrusted input and contains %n. (This is
4166 currently a subset of what -Wformat-nonliteral warns about, but in
4167 future warnings may be added to -Wformat-security that are not
4168 included in -Wformat-nonliteral.)
4169
4170 -Wformat-signedness
4171 If -Wformat is specified, also warn if the format string requires
4172 an unsigned argument and the argument is signed and vice versa.
4173
4174 -Wformat-truncation
4175 -Wformat-truncation=level
4176 Warn about calls to formatted input/output functions such as
4177 "snprintf" and "vsnprintf" that might result in output truncation.
4178 When the exact number of bytes written by a format directive cannot
4179 be determined at compile-time it is estimated based on heuristics
4180 that depend on the level argument and on optimization. While
4181 enabling optimization will in most cases improve the accuracy of
4182 the warning, it may also result in false positives. Except as
4183 noted otherwise, the option uses the same logic -Wformat-overflow.
4184
4185 -Wformat-truncation
4186 -Wformat-truncation=1
4187 Level 1 of -Wformat-truncation enabled by -Wformat employs a
4188 conservative approach that warns only about calls to bounded
4189 functions whose return value is unused and that will most
4190 likely result in output truncation.
4191
4192 -Wformat-truncation=2
4193 Level 2 warns also about calls to bounded functions whose
4194 return value is used and that might result in truncation given
4195 an argument of sufficient length or magnitude.
4196
4197 -Wformat-y2k
4198 If -Wformat is specified, also warn about "strftime" formats that
4199 may yield only a two-digit year.
4200
4201 -Wnonnull
4202 Warn about passing a null pointer for arguments marked as requiring
4203 a non-null value by the "nonnull" function attribute.
4204
4205 -Wnonnull is included in -Wall and -Wformat. It can be disabled
4206 with the -Wno-nonnull option.
4207
4208 -Wnonnull-compare
4209 Warn when comparing an argument marked with the "nonnull" function
4210 attribute against null inside the function.
4211
4212 -Wnonnull-compare is included in -Wall. It can be disabled with
4213 the -Wno-nonnull-compare option.
4214
4215 -Wnull-dereference
4216 Warn if the compiler detects paths that trigger erroneous or
4217 undefined behavior due to dereferencing a null pointer. This
4218 option is only active when -fdelete-null-pointer-checks is active,
4219 which is enabled by optimizations in most targets. The precision
4220 of the warnings depends on the optimization options used.
4221
4222 -Winit-self (C, C++, Objective-C and Objective-C++ only)
4223 Warn about uninitialized variables that are initialized with
4224 themselves. Note this option can only be used with the
4225 -Wuninitialized option.
4226
4227 For example, GCC warns about "i" being uninitialized in the
4228 following snippet only when -Winit-self has been specified:
4229
4230 int f()
4231 {
4232 int i = i;
4233 return i;
4234 }
4235
4236 This warning is enabled by -Wall in C++.
4237
4238 -Wno-implicit-int (C and Objective-C only)
4239 This option controls warnings when a declaration does not specify a
4240 type. This warning is enabled by default in C99 and later dialects
4241 of C, and also by -Wall.
4242
4243 -Wno-implicit-function-declaration (C and Objective-C only)
4244 This option controls warnings when a function is used before being
4245 declared. This warning is enabled by default in C99 and later
4246 dialects of C, and also by -Wall. The warning is made into an
4247 error by -pedantic-errors.
4248
4249 -Wimplicit (C and Objective-C only)
4250 Same as -Wimplicit-int and -Wimplicit-function-declaration. This
4251 warning is enabled by -Wall.
4252
4253 -Wimplicit-fallthrough
4254 -Wimplicit-fallthrough is the same as -Wimplicit-fallthrough=3 and
4255 -Wno-implicit-fallthrough is the same as -Wimplicit-fallthrough=0.
4256
4257 -Wimplicit-fallthrough=n
4258 Warn when a switch case falls through. For example:
4259
4260 switch (cond)
4261 {
4262 case 1:
4263 a = 1;
4264 break;
4265 case 2:
4266 a = 2;
4267 case 3:
4268 a = 3;
4269 break;
4270 }
4271
4272 This warning does not warn when the last statement of a case cannot
4273 fall through, e.g. when there is a return statement or a call to
4274 function declared with the noreturn attribute.
4275 -Wimplicit-fallthrough= also takes into account control flow
4276 statements, such as ifs, and only warns when appropriate. E.g.
4277
4278 switch (cond)
4279 {
4280 case 1:
4281 if (i > 3) {
4282 bar (5);
4283 break;
4284 } else if (i < 1) {
4285 bar (0);
4286 } else
4287 return;
4288 default:
4289 ...
4290 }
4291
4292 Since there are occasions where a switch case fall through is
4293 desirable, GCC provides an attribute, "__attribute__
4294 ((fallthrough))", that is to be used along with a null statement to
4295 suppress this warning that would normally occur:
4296
4297 switch (cond)
4298 {
4299 case 1:
4300 bar (0);
4301 __attribute__ ((fallthrough));
4302 default:
4303 ...
4304 }
4305
4306 C++17 provides a standard way to suppress the
4307 -Wimplicit-fallthrough warning using "[[fallthrough]];" instead of
4308 the GNU attribute. In C++11 or C++14 users can use
4309 "[[gnu::fallthrough]];", which is a GNU extension. Instead of
4310 these attributes, it is also possible to add a fallthrough comment
4311 to silence the warning. The whole body of the C or C++ style
4312 comment should match the given regular expressions listed below.
4313 The option argument n specifies what kind of comments are accepted:
4314
4315 *<-Wimplicit-fallthrough=0 disables the warning altogether.>
4316 *<-Wimplicit-fallthrough=1 matches ".*" regular>
4317 expression, any comment is used as fallthrough comment.
4318
4319 *<-Wimplicit-fallthrough=2 case insensitively matches>
4320 ".*falls?[ \t-]*thr(ough|u).*" regular expression.
4321
4322 *<-Wimplicit-fallthrough=3 case sensitively matches one of the>
4323 following regular expressions:
4324
4325 *<"-fallthrough">
4326 *<"@fallthrough@">
4327 *<"lint -fallthrough[ \t]*">
4328 *<"[ \t.!]*(ELSE,? |INTENTIONAL(LY)? )?FALL(S |
4329 |-)?THR(OUGH|U)[ \t.!]*(-[^\n\r]*)?">
4330 *<"[ \t.!]*(Else,? |Intentional(ly)? )?Fall((s |
4331 |-)[Tt]|t)hr(ough|u)[ \t.!]*(-[^\n\r]*)?">
4332 *<"[ \t.!]*([Ee]lse,? |[Ii]ntentional(ly)? )?fall(s |
4333 |-)?thr(ough|u)[ \t.!]*(-[^\n\r]*)?">
4334 *<-Wimplicit-fallthrough=4 case sensitively matches one of the>
4335 following regular expressions:
4336
4337 *<"-fallthrough">
4338 *<"@fallthrough@">
4339 *<"lint -fallthrough[ \t]*">
4340 *<"[ \t]*FALLTHR(OUGH|U)[ \t]*">
4341 *<-Wimplicit-fallthrough=5 doesn't recognize any comments as>
4342 fallthrough comments, only attributes disable the warning.
4343
4344 The comment needs to be followed after optional whitespace and
4345 other comments by "case" or "default" keywords or by a user label
4346 that precedes some "case" or "default" label.
4347
4348 switch (cond)
4349 {
4350 case 1:
4351 bar (0);
4352 /* FALLTHRU */
4353 default:
4354 ...
4355 }
4356
4357 The -Wimplicit-fallthrough=3 warning is enabled by -Wextra.
4358
4359 -Wno-if-not-aligned (C, C++, Objective-C and Objective-C++ only)
4360 Control if warnings triggered by the "warn_if_not_aligned"
4361 attribute should be issued. These warnings are enabled by default.
4362
4363 -Wignored-qualifiers (C and C++ only)
4364 Warn if the return type of a function has a type qualifier such as
4365 "const". For ISO C such a type qualifier has no effect, since the
4366 value returned by a function is not an lvalue. For C++, the
4367 warning is only emitted for scalar types or "void". ISO C
4368 prohibits qualified "void" return types on function definitions, so
4369 such return types always receive a warning even without this
4370 option.
4371
4372 This warning is also enabled by -Wextra.
4373
4374 -Wno-ignored-attributes (C and C++ only)
4375 This option controls warnings when an attribute is ignored. This
4376 is different from the -Wattributes option in that it warns whenever
4377 the compiler decides to drop an attribute, not that the attribute
4378 is either unknown, used in a wrong place, etc. This warning is
4379 enabled by default.
4380
4381 -Wmain
4382 Warn if the type of "main" is suspicious. "main" should be a
4383 function with external linkage, returning int, taking either zero
4384 arguments, two, or three arguments of appropriate types. This
4385 warning is enabled by default in C++ and is enabled by either -Wall
4386 or -Wpedantic.
4387
4388 -Wmisleading-indentation (C and C++ only)
4389 Warn when the indentation of the code does not reflect the block
4390 structure. Specifically, a warning is issued for "if", "else",
4391 "while", and "for" clauses with a guarded statement that does not
4392 use braces, followed by an unguarded statement with the same
4393 indentation.
4394
4395 In the following example, the call to "bar" is misleadingly
4396 indented as if it were guarded by the "if" conditional.
4397
4398 if (some_condition ())
4399 foo ();
4400 bar (); /* Gotcha: this is not guarded by the "if". */
4401
4402 In the case of mixed tabs and spaces, the warning uses the
4403 -ftabstop= option to determine if the statements line up
4404 (defaulting to 8).
4405
4406 The warning is not issued for code involving multiline preprocessor
4407 logic such as the following example.
4408
4409 if (flagA)
4410 foo (0);
4411 #if SOME_CONDITION_THAT_DOES_NOT_HOLD
4412 if (flagB)
4413 #endif
4414 foo (1);
4415
4416 The warning is not issued after a "#line" directive, since this
4417 typically indicates autogenerated code, and no assumptions can be
4418 made about the layout of the file that the directive references.
4419
4420 This warning is enabled by -Wall in C and C++.
4421
4422 -Wmissing-attributes
4423 Warn when a declaration of a function is missing one or more
4424 attributes that a related function is declared with and whose
4425 absence may adversely affect the correctness or efficiency of
4426 generated code. For example, the warning is issued for
4427 declarations of aliases that use attributes to specify less
4428 restrictive requirements than those of their targets. This
4429 typically represents a potential optimization opportunity. By
4430 contrast, the -Wattribute-alias=2 option controls warnings issued
4431 when the alias is more restrictive than the target, which could
4432 lead to incorrect code generation. Attributes considered include
4433 "alloc_align", "alloc_size", "cold", "const", "hot", "leaf",
4434 "malloc", "nonnull", "noreturn", "nothrow", "pure",
4435 "returns_nonnull", and "returns_twice".
4436
4437 In C++, the warning is issued when an explicit specialization of a
4438 primary template declared with attribute "alloc_align",
4439 "alloc_size", "assume_aligned", "format", "format_arg", "malloc",
4440 or "nonnull" is declared without it. Attributes "deprecated",
4441 "error", and "warning" suppress the warning..
4442
4443 You can use the "copy" attribute to apply the same set of
4444 attributes to a declaration as that on another declaration without
4445 explicitly enumerating the attributes. This attribute can be
4446 applied to declarations of functions, variables, or types.
4447
4448 -Wmissing-attributes is enabled by -Wall.
4449
4450 For example, since the declaration of the primary function template
4451 below makes use of both attribute "malloc" and "alloc_size" the
4452 declaration of the explicit specialization of the template is
4453 diagnosed because it is missing one of the attributes.
4454
4455 template <class T>
4456 T* __attribute__ ((malloc, alloc_size (1)))
4457 allocate (size_t);
4458
4459 template <>
4460 void* __attribute__ ((malloc)) // missing alloc_size
4461 allocate<void> (size_t);
4462
4463 -Wmissing-braces
4464 Warn if an aggregate or union initializer is not fully bracketed.
4465 In the following example, the initializer for "a" is not fully
4466 bracketed, but that for "b" is fully bracketed.
4467
4468 int a[2][2] = { 0, 1, 2, 3 };
4469 int b[2][2] = { { 0, 1 }, { 2, 3 } };
4470
4471 This warning is enabled by -Wall.
4472
4473 -Wmissing-include-dirs (C, C++, Objective-C and Objective-C++ only)
4474 Warn if a user-supplied include directory does not exist.
4475
4476 -Wno-missing-profile
4477 This option controls warnings if feedback profiles are missing when
4478 using the -fprofile-use option. This option diagnoses those cases
4479 where a new function or a new file is added between compiling with
4480 -fprofile-generate and with -fprofile-use, without regenerating the
4481 profiles. In these cases, the profile feedback data files do not
4482 contain any profile feedback information for the newly added
4483 function or file respectively. Also, in the case when profile
4484 count data (.gcda) files are removed, GCC cannot use any profile
4485 feedback information. In all these cases, warnings are issued to
4486 inform you that a profile generation step is due. Ignoring the
4487 warning can result in poorly optimized code. -Wno-missing-profile
4488 can be used to disable the warning, but this is not recommended and
4489 should be done only when non-existent profile data is justified.
4490
4491 -Wmultistatement-macros
4492 Warn about unsafe multiple statement macros that appear to be
4493 guarded by a clause such as "if", "else", "for", "switch", or
4494 "while", in which only the first statement is actually guarded
4495 after the macro is expanded.
4496
4497 For example:
4498
4499 #define DOIT x++; y++
4500 if (c)
4501 DOIT;
4502
4503 will increment "y" unconditionally, not just when "c" holds. The
4504 can usually be fixed by wrapping the macro in a do-while loop:
4505
4506 #define DOIT do { x++; y++; } while (0)
4507 if (c)
4508 DOIT;
4509
4510 This warning is enabled by -Wall in C and C++.
4511
4512 -Wparentheses
4513 Warn if parentheses are omitted in certain contexts, such as when
4514 there is an assignment in a context where a truth value is
4515 expected, or when operators are nested whose precedence people
4516 often get confused about.
4517
4518 Also warn if a comparison like "x<=y<=z" appears; this is
4519 equivalent to "(x<=y ? 1 : 0) <= z", which is a different
4520 interpretation from that of ordinary mathematical notation.
4521
4522 Also warn for dangerous uses of the GNU extension to "?:" with
4523 omitted middle operand. When the condition in the "?": operator is
4524 a boolean expression, the omitted value is always 1. Often
4525 programmers expect it to be a value computed inside the conditional
4526 expression instead.
4527
4528 For C++ this also warns for some cases of unnecessary parentheses
4529 in declarations, which can indicate an attempt at a function call
4530 instead of a declaration:
4531
4532 {
4533 // Declares a local variable called mymutex.
4534 std::unique_lock<std::mutex> (mymutex);
4535 // User meant std::unique_lock<std::mutex> lock (mymutex);
4536 }
4537
4538 This warning is enabled by -Wall.
4539
4540 -Wsequence-point
4541 Warn about code that may have undefined semantics because of
4542 violations of sequence point rules in the C and C++ standards.
4543
4544 The C and C++ standards define the order in which expressions in a
4545 C/C++ program are evaluated in terms of sequence points, which
4546 represent a partial ordering between the execution of parts of the
4547 program: those executed before the sequence point, and those
4548 executed after it. These occur after the evaluation of a full
4549 expression (one which is not part of a larger expression), after
4550 the evaluation of the first operand of a "&&", "||", "? :" or ","
4551 (comma) operator, before a function is called (but after the
4552 evaluation of its arguments and the expression denoting the called
4553 function), and in certain other places. Other than as expressed by
4554 the sequence point rules, the order of evaluation of subexpressions
4555 of an expression is not specified. All these rules describe only a
4556 partial order rather than a total order, since, for example, if two
4557 functions are called within one expression with no sequence point
4558 between them, the order in which the functions are called is not
4559 specified. However, the standards committee have ruled that
4560 function calls do not overlap.
4561
4562 It is not specified when between sequence points modifications to
4563 the values of objects take effect. Programs whose behavior depends
4564 on this have undefined behavior; the C and C++ standards specify
4565 that "Between the previous and next sequence point an object shall
4566 have its stored value modified at most once by the evaluation of an
4567 expression. Furthermore, the prior value shall be read only to
4568 determine the value to be stored.". If a program breaks these
4569 rules, the results on any particular implementation are entirely
4570 unpredictable.
4571
4572 Examples of code with undefined behavior are "a = a++;", "a[n] =
4573 b[n++]" and "a[i++] = i;". Some more complicated cases are not
4574 diagnosed by this option, and it may give an occasional false
4575 positive result, but in general it has been found fairly effective
4576 at detecting this sort of problem in programs.
4577
4578 The C++17 standard will define the order of evaluation of operands
4579 in more cases: in particular it requires that the right-hand side
4580 of an assignment be evaluated before the left-hand side, so the
4581 above examples are no longer undefined. But this option will still
4582 warn about them, to help people avoid writing code that is
4583 undefined in C and earlier revisions of C++.
4584
4585 The standard is worded confusingly, therefore there is some debate
4586 over the precise meaning of the sequence point rules in subtle
4587 cases. Links to discussions of the problem, including proposed
4588 formal definitions, may be found on the GCC readings page, at
4589 <http://gcc.gnu.org/readings.html>.
4590
4591 This warning is enabled by -Wall for C and C++.
4592
4593 -Wno-return-local-addr
4594 Do not warn about returning a pointer (or in C++, a reference) to a
4595 variable that goes out of scope after the function returns.
4596
4597 -Wreturn-type
4598 Warn whenever a function is defined with a return type that
4599 defaults to "int". Also warn about any "return" statement with no
4600 return value in a function whose return type is not "void" (falling
4601 off the end of the function body is considered returning without a
4602 value).
4603
4604 For C only, warn about a "return" statement with an expression in a
4605 function whose return type is "void", unless the expression type is
4606 also "void". As a GNU extension, the latter case is accepted
4607 without a warning unless -Wpedantic is used. Attempting to use the
4608 return value of a non-"void" function other than "main" that flows
4609 off the end by reaching the closing curly brace that terminates the
4610 function is undefined.
4611
4612 Unlike in C, in C++, flowing off the end of a non-"void" function
4613 other than "main" results in undefined behavior even when the value
4614 of the function is not used.
4615
4616 This warning is enabled by default in C++ and by -Wall otherwise.
4617
4618 -Wno-shift-count-negative
4619 Controls warnings if a shift count is negative. This warning is
4620 enabled by default.
4621
4622 -Wno-shift-count-overflow
4623 Controls warnings if a shift count is greater than or equal to the
4624 bit width of the type. This warning is enabled by default.
4625
4626 -Wshift-negative-value
4627 Warn if left shifting a negative value. This warning is enabled by
4628 -Wextra in C99 and C++11 modes (and newer).
4629
4630 -Wno-shift-overflow
4631 -Wshift-overflow=n
4632 These options control warnings about left shift overflows.
4633
4634 -Wshift-overflow=1
4635 This is the warning level of -Wshift-overflow and is enabled by
4636 default in C99 and C++11 modes (and newer). This warning level
4637 does not warn about left-shifting 1 into the sign bit.
4638 (However, in C, such an overflow is still rejected in contexts
4639 where an integer constant expression is required.) No warning
4640 is emitted in C++2A mode (and newer), as signed left shifts
4641 always wrap.
4642
4643 -Wshift-overflow=2
4644 This warning level also warns about left-shifting 1 into the
4645 sign bit, unless C++14 mode (or newer) is active.
4646
4647 -Wswitch
4648 Warn whenever a "switch" statement has an index of enumerated type
4649 and lacks a "case" for one or more of the named codes of that
4650 enumeration. (The presence of a "default" label prevents this
4651 warning.) "case" labels outside the enumeration range also provoke
4652 warnings when this option is used (even if there is a "default"
4653 label). This warning is enabled by -Wall.
4654
4655 -Wswitch-default
4656 Warn whenever a "switch" statement does not have a "default" case.
4657
4658 -Wswitch-enum
4659 Warn whenever a "switch" statement has an index of enumerated type
4660 and lacks a "case" for one or more of the named codes of that
4661 enumeration. "case" labels outside the enumeration range also
4662 provoke warnings when this option is used. The only difference
4663 between -Wswitch and this option is that this option gives a
4664 warning about an omitted enumeration code even if there is a
4665 "default" label.
4666
4667 -Wno-switch-bool
4668 Do not warn when a "switch" statement has an index of boolean type
4669 and the case values are outside the range of a boolean type. It is
4670 possible to suppress this warning by casting the controlling
4671 expression to a type other than "bool". For example:
4672
4673 switch ((int) (a == 4))
4674 {
4675 ...
4676 }
4677
4678 This warning is enabled by default for C and C++ programs.
4679
4680 -Wno-switch-outside-range
4681 This option controls warnings when a "switch" case has a value that
4682 is outside of its respective type range. This warning is enabled
4683 by default for C and C++ programs.
4684
4685 -Wno-switch-unreachable
4686 Do not warn when a "switch" statement contains statements between
4687 the controlling expression and the first case label, which will
4688 never be executed. For example:
4689
4690 switch (cond)
4691 {
4692 i = 15;
4693 ...
4694 case 5:
4695 ...
4696 }
4697
4698 -Wswitch-unreachable does not warn if the statement between the
4699 controlling expression and the first case label is just a
4700 declaration:
4701
4702 switch (cond)
4703 {
4704 int i;
4705 ...
4706 case 5:
4707 i = 5;
4708 ...
4709 }
4710
4711 This warning is enabled by default for C and C++ programs.
4712
4713 -Wsync-nand (C and C++ only)
4714 Warn when "__sync_fetch_and_nand" and "__sync_nand_and_fetch"
4715 built-in functions are used. These functions changed semantics in
4716 GCC 4.4.
4717
4718 -Wunused-but-set-parameter
4719 Warn whenever a function parameter is assigned to, but otherwise
4720 unused (aside from its declaration).
4721
4722 To suppress this warning use the "unused" attribute.
4723
4724 This warning is also enabled by -Wunused together with -Wextra.
4725
4726 -Wunused-but-set-variable
4727 Warn whenever a local variable is assigned to, but otherwise unused
4728 (aside from its declaration). This warning is enabled by -Wall.
4729
4730 To suppress this warning use the "unused" attribute.
4731
4732 This warning is also enabled by -Wunused, which is enabled by
4733 -Wall.
4734
4735 -Wunused-function
4736 Warn whenever a static function is declared but not defined or a
4737 non-inline static function is unused. This warning is enabled by
4738 -Wall.
4739
4740 -Wunused-label
4741 Warn whenever a label is declared but not used. This warning is
4742 enabled by -Wall.
4743
4744 To suppress this warning use the "unused" attribute.
4745
4746 -Wunused-local-typedefs (C, Objective-C, C++ and Objective-C++ only)
4747 Warn when a typedef locally defined in a function is not used.
4748 This warning is enabled by -Wall.
4749
4750 -Wunused-parameter
4751 Warn whenever a function parameter is unused aside from its
4752 declaration.
4753
4754 To suppress this warning use the "unused" attribute.
4755
4756 -Wno-unused-result
4757 Do not warn if a caller of a function marked with attribute
4758 "warn_unused_result" does not use its return value. The default is
4759 -Wunused-result.
4760
4761 -Wunused-variable
4762 Warn whenever a local or static variable is unused aside from its
4763 declaration. This option implies -Wunused-const-variable=1 for C,
4764 but not for C++. This warning is enabled by -Wall.
4765
4766 To suppress this warning use the "unused" attribute.
4767
4768 -Wunused-const-variable
4769 -Wunused-const-variable=n
4770 Warn whenever a constant static variable is unused aside from its
4771 declaration. -Wunused-const-variable=1 is enabled by
4772 -Wunused-variable for C, but not for C++. In C this declares
4773 variable storage, but in C++ this is not an error since const
4774 variables take the place of "#define"s.
4775
4776 To suppress this warning use the "unused" attribute.
4777
4778 -Wunused-const-variable=1
4779 This is the warning level that is enabled by -Wunused-variable
4780 for C. It warns only about unused static const variables
4781 defined in the main compilation unit, but not about static
4782 const variables declared in any header included.
4783
4784 -Wunused-const-variable=2
4785 This warning level also warns for unused constant static
4786 variables in headers (excluding system headers). This is the
4787 warning level of -Wunused-const-variable and must be explicitly
4788 requested since in C++ this isn't an error and in C it might be
4789 harder to clean up all headers included.
4790
4791 -Wunused-value
4792 Warn whenever a statement computes a result that is explicitly not
4793 used. To suppress this warning cast the unused expression to
4794 "void". This includes an expression-statement or the left-hand side
4795 of a comma expression that contains no side effects. For example,
4796 an expression such as "x[i,j]" causes a warning, while
4797 "x[(void)i,j]" does not.
4798
4799 This warning is enabled by -Wall.
4800
4801 -Wunused
4802 All the above -Wunused options combined.
4803
4804 In order to get a warning about an unused function parameter, you
4805 must either specify -Wextra -Wunused (note that -Wall implies
4806 -Wunused), or separately specify -Wunused-parameter.
4807
4808 -Wuninitialized
4809 Warn if an automatic variable is used without first being
4810 initialized. In C++, warn if a non-static reference or non-static
4811 "const" member appears in a class without constructors.
4812
4813 If you want to warn about code that uses the uninitialized value of
4814 the variable in its own initializer, use the -Winit-self option.
4815
4816 These warnings occur for individual uninitialized elements of
4817 structure, union or array variables as well as for variables that
4818 are uninitialized as a whole. They do not occur for variables or
4819 elements declared "volatile". Because these warnings depend on
4820 optimization, the exact variables or elements for which there are
4821 warnings depend on the precise optimization options and version of
4822 GCC used.
4823
4824 Note that there may be no warning about a variable that is used
4825 only to compute a value that itself is never used, because such
4826 computations may be deleted by data flow analysis before the
4827 warnings are printed.
4828
4829 -Wno-invalid-memory-model
4830 This option controls warnings for invocations of __atomic Builtins,
4831 __sync Builtins, and the C11 atomic generic functions with a memory
4832 consistency argument that is either invalid for the operation or
4833 outside the range of values of the "memory_order" enumeration. For
4834 example, since the "__atomic_store" and "__atomic_store_n" built-
4835 ins are only defined for the relaxed, release, and sequentially
4836 consistent memory orders the following code is diagnosed:
4837
4838 void store (int *i)
4839 {
4840 __atomic_store_n (i, 0, memory_order_consume);
4841 }
4842
4843 -Winvalid-memory-model is enabled by default.
4844
4845 -Wmaybe-uninitialized
4846 For an automatic (i.e. local) variable, if there exists a path from
4847 the function entry to a use of the variable that is initialized,
4848 but there exist some other paths for which the variable is not
4849 initialized, the compiler emits a warning if it cannot prove the
4850 uninitialized paths are not executed at run time.
4851
4852 These warnings are only possible in optimizing compilation, because
4853 otherwise GCC does not keep track of the state of variables.
4854
4855 These warnings are made optional because GCC may not be able to
4856 determine when the code is correct in spite of appearing to have an
4857 error. Here is one example of how this can happen:
4858
4859 {
4860 int x;
4861 switch (y)
4862 {
4863 case 1: x = 1;
4864 break;
4865 case 2: x = 4;
4866 break;
4867 case 3: x = 5;
4868 }
4869 foo (x);
4870 }
4871
4872 If the value of "y" is always 1, 2 or 3, then "x" is always
4873 initialized, but GCC doesn't know this. To suppress the warning,
4874 you need to provide a default case with assert(0) or similar code.
4875
4876 This option also warns when a non-volatile automatic variable might
4877 be changed by a call to "longjmp". The compiler sees only the
4878 calls to "setjmp". It cannot know where "longjmp" will be called;
4879 in fact, a signal handler could call it at any point in the code.
4880 As a result, you may get a warning even when there is in fact no
4881 problem because "longjmp" cannot in fact be called at the place
4882 that would cause a problem.
4883
4884 Some spurious warnings can be avoided if you declare all the
4885 functions you use that never return as "noreturn".
4886
4887 This warning is enabled by -Wall or -Wextra.
4888
4889 -Wunknown-pragmas
4890 Warn when a "#pragma" directive is encountered that is not
4891 understood by GCC. If this command-line option is used, warnings
4892 are even issued for unknown pragmas in system header files. This
4893 is not the case if the warnings are only enabled by the -Wall
4894 command-line option.
4895
4896 -Wno-pragmas
4897 Do not warn about misuses of pragmas, such as incorrect parameters,
4898 invalid syntax, or conflicts between pragmas. See also
4899 -Wunknown-pragmas.
4900
4901 -Wno-prio-ctor-dtor
4902 Do not warn if a priority from 0 to 100 is used for constructor or
4903 destructor. The use of constructor and destructor attributes allow
4904 you to assign a priority to the constructor/destructor to control
4905 its order of execution before "main" is called or after it returns.
4906 The priority values must be greater than 100 as the compiler
4907 reserves priority values between 0--100 for the implementation.
4908
4909 -Wstrict-aliasing
4910 This option is only active when -fstrict-aliasing is active. It
4911 warns about code that might break the strict aliasing rules that
4912 the compiler is using for optimization. The warning does not catch
4913 all cases, but does attempt to catch the more common pitfalls. It
4914 is included in -Wall. It is equivalent to -Wstrict-aliasing=3
4915
4916 -Wstrict-aliasing=n
4917 This option is only active when -fstrict-aliasing is active. It
4918 warns about code that might break the strict aliasing rules that
4919 the compiler is using for optimization. Higher levels correspond
4920 to higher accuracy (fewer false positives). Higher levels also
4921 correspond to more effort, similar to the way -O works.
4922 -Wstrict-aliasing is equivalent to -Wstrict-aliasing=3.
4923
4924 Level 1: Most aggressive, quick, least accurate. Possibly useful
4925 when higher levels do not warn but -fstrict-aliasing still breaks
4926 the code, as it has very few false negatives. However, it has many
4927 false positives. Warns for all pointer conversions between
4928 possibly incompatible types, even if never dereferenced. Runs in
4929 the front end only.
4930
4931 Level 2: Aggressive, quick, not too precise. May still have many
4932 false positives (not as many as level 1 though), and few false
4933 negatives (but possibly more than level 1). Unlike level 1, it
4934 only warns when an address is taken. Warns about incomplete types.
4935 Runs in the front end only.
4936
4937 Level 3 (default for -Wstrict-aliasing): Should have very few false
4938 positives and few false negatives. Slightly slower than levels 1
4939 or 2 when optimization is enabled. Takes care of the common
4940 pun+dereference pattern in the front end: "*(int*)&some_float". If
4941 optimization is enabled, it also runs in the back end, where it
4942 deals with multiple statement cases using flow-sensitive points-to
4943 information. Only warns when the converted pointer is
4944 dereferenced. Does not warn about incomplete types.
4945
4946 -Wstrict-overflow
4947 -Wstrict-overflow=n
4948 This option is only active when signed overflow is undefined. It
4949 warns about cases where the compiler optimizes based on the
4950 assumption that signed overflow does not occur. Note that it does
4951 not warn about all cases where the code might overflow: it only
4952 warns about cases where the compiler implements some optimization.
4953 Thus this warning depends on the optimization level.
4954
4955 An optimization that assumes that signed overflow does not occur is
4956 perfectly safe if the values of the variables involved are such
4957 that overflow never does, in fact, occur. Therefore this warning
4958 can easily give a false positive: a warning about code that is not
4959 actually a problem. To help focus on important issues, several
4960 warning levels are defined. No warnings are issued for the use of
4961 undefined signed overflow when estimating how many iterations a
4962 loop requires, in particular when determining whether a loop will
4963 be executed at all.
4964
4965 -Wstrict-overflow=1
4966 Warn about cases that are both questionable and easy to avoid.
4967 For example the compiler simplifies "x + 1 > x" to 1. This
4968 level of -Wstrict-overflow is enabled by -Wall; higher levels
4969 are not, and must be explicitly requested.
4970
4971 -Wstrict-overflow=2
4972 Also warn about other cases where a comparison is simplified to
4973 a constant. For example: "abs (x) >= 0". This can only be
4974 simplified when signed integer overflow is undefined, because
4975 "abs (INT_MIN)" overflows to "INT_MIN", which is less than
4976 zero. -Wstrict-overflow (with no level) is the same as
4977 -Wstrict-overflow=2.
4978
4979 -Wstrict-overflow=3
4980 Also warn about other cases where a comparison is simplified.
4981 For example: "x + 1 > 1" is simplified to "x > 0".
4982
4983 -Wstrict-overflow=4
4984 Also warn about other simplifications not covered by the above
4985 cases. For example: "(x * 10) / 5" is simplified to "x * 2".
4986
4987 -Wstrict-overflow=5
4988 Also warn about cases where the compiler reduces the magnitude
4989 of a constant involved in a comparison. For example: "x + 2 >
4990 y" is simplified to "x + 1 >= y". This is reported only at the
4991 highest warning level because this simplification applies to
4992 many comparisons, so this warning level gives a very large
4993 number of false positives.
4994
4995 -Wstring-compare
4996 Warn for calls to "strcmp" and "strncmp" whose result is determined
4997 to be either zero or non-zero in tests for such equality owing to
4998 the length of one argument being greater than the size of the array
4999 the other argument is stored in (or the bound in the case of
5000 "strncmp"). Such calls could be mistakes. For example, the call
5001 to "strcmp" below is diagnosed because its result is necessarily
5002 non-zero irrespective of the contents of the array "a".
5003
5004 extern char a[4];
5005 void f (char *d)
5006 {
5007 strcpy (d, "string");
5008 ...
5009 if (0 == strcmp (a, d)) // cannot be true
5010 puts ("a and d are the same");
5011 }
5012
5013 -Wstring-compare is enabled by -Wextra.
5014
5015 -Wstringop-overflow
5016 -Wstringop-overflow=type
5017 Warn for calls to string manipulation functions such as "memcpy"
5018 and "strcpy" that are determined to overflow the destination
5019 buffer. The optional argument is one greater than the type of
5020 Object Size Checking to perform to determine the size of the
5021 destination. The argument is meaningful only for functions that
5022 operate on character arrays but not for raw memory functions like
5023 "memcpy" which always make use of Object Size type-0. The option
5024 also warns for calls that specify a size in excess of the largest
5025 possible object or at most "SIZE_MAX / 2" bytes. The option
5026 produces the best results with optimization enabled but can detect
5027 a small subset of simple buffer overflows even without optimization
5028 in calls to the GCC built-in functions like "__builtin_memcpy" that
5029 correspond to the standard functions. In any case, the option
5030 warns about just a subset of buffer overflows detected by the
5031 corresponding overflow checking built-ins. For example, the option
5032 issues a warning for the "strcpy" call below because it copies at
5033 least 5 characters (the string "blue" including the terminating
5034 NUL) into the buffer of size 4.
5035
5036 enum Color { blue, purple, yellow };
5037 const char* f (enum Color clr)
5038 {
5039 static char buf [4];
5040 const char *str;
5041 switch (clr)
5042 {
5043 case blue: str = "blue"; break;
5044 case purple: str = "purple"; break;
5045 case yellow: str = "yellow"; break;
5046 }
5047
5048 return strcpy (buf, str); // warning here
5049 }
5050
5051 Option -Wstringop-overflow=2 is enabled by default.
5052
5053 -Wstringop-overflow
5054 -Wstringop-overflow=1
5055 The -Wstringop-overflow=1 option uses type-zero Object Size
5056 Checking to determine the sizes of destination objects. This
5057 is the default setting of the option. At this setting the
5058 option does not warn for writes past the end of subobjects of
5059 larger objects accessed by pointers unless the size of the
5060 largest surrounding object is known. When the destination may
5061 be one of several objects it is assumed to be the largest one
5062 of them. On Linux systems, when optimization is enabled at
5063 this setting the option warns for the same code as when the
5064 "_FORTIFY_SOURCE" macro is defined to a non-zero value.
5065
5066 -Wstringop-overflow=2
5067 The -Wstringop-overflow=2 option uses type-one Object Size
5068 Checking to determine the sizes of destination objects. At
5069 this setting the option warna about overflows when writing to
5070 members of the largest complete objects whose exact size is
5071 known. However, it does not warn for excessive writes to the
5072 same members of unknown objects referenced by pointers since
5073 they may point to arrays containing unknown numbers of
5074 elements.
5075
5076 -Wstringop-overflow=3
5077 The -Wstringop-overflow=3 option uses type-two Object Size
5078 Checking to determine the sizes of destination objects. At
5079 this setting the option warns about overflowing the smallest
5080 object or data member. This is the most restrictive setting of
5081 the option that may result in warnings for safe code.
5082
5083 -Wstringop-overflow=4
5084 The -Wstringop-overflow=4 option uses type-three Object Size
5085 Checking to determine the sizes of destination objects. At
5086 this setting the option warns about overflowing any data
5087 members, and when the destination is one of several objects it
5088 uses the size of the largest of them to decide whether to issue
5089 a warning. Similarly to -Wstringop-overflow=3 this setting of
5090 the option may result in warnings for benign code.
5091
5092 -Wno-stringop-truncation
5093 Do not warn for calls to bounded string manipulation functions such
5094 as "strncat", "strncpy", and "stpncpy" that may either truncate the
5095 copied string or leave the destination unchanged.
5096
5097 In the following example, the call to "strncat" specifies a bound
5098 that is less than the length of the source string. As a result,
5099 the copy of the source will be truncated and so the call is
5100 diagnosed. To avoid the warning use "bufsize - strlen (buf) - 1)"
5101 as the bound.
5102
5103 void append (char *buf, size_t bufsize)
5104 {
5105 strncat (buf, ".txt", 3);
5106 }
5107
5108 As another example, the following call to "strncpy" results in
5109 copying to "d" just the characters preceding the terminating NUL,
5110 without appending the NUL to the end. Assuming the result of
5111 "strncpy" is necessarily a NUL-terminated string is a common
5112 mistake, and so the call is diagnosed. To avoid the warning when
5113 the result is not expected to be NUL-terminated, call "memcpy"
5114 instead.
5115
5116 void copy (char *d, const char *s)
5117 {
5118 strncpy (d, s, strlen (s));
5119 }
5120
5121 In the following example, the call to "strncpy" specifies the size
5122 of the destination buffer as the bound. If the length of the
5123 source string is equal to or greater than this size the result of
5124 the copy will not be NUL-terminated. Therefore, the call is also
5125 diagnosed. To avoid the warning, specify "sizeof buf - 1" as the
5126 bound and set the last element of the buffer to "NUL".
5127
5128 void copy (const char *s)
5129 {
5130 char buf[80];
5131 strncpy (buf, s, sizeof buf);
5132 ...
5133 }
5134
5135 In situations where a character array is intended to store a
5136 sequence of bytes with no terminating "NUL" such an array may be
5137 annotated with attribute "nonstring" to avoid this warning. Such
5138 arrays, however, are not suitable arguments to functions that
5139 expect "NUL"-terminated strings. To help detect accidental misuses
5140 of such arrays GCC issues warnings unless it can prove that the use
5141 is safe.
5142
5143 -Wsuggest-attribute=[pure|const|noreturn|format|cold|malloc]
5144 Warn for cases where adding an attribute may be beneficial. The
5145 attributes currently supported are listed below.
5146
5147 -Wsuggest-attribute=pure
5148 -Wsuggest-attribute=const
5149 -Wsuggest-attribute=noreturn
5150 -Wmissing-noreturn
5151 -Wsuggest-attribute=malloc
5152 Warn about functions that might be candidates for attributes
5153 "pure", "const" or "noreturn" or "malloc". The compiler only
5154 warns for functions visible in other compilation units or (in
5155 the case of "pure" and "const") if it cannot prove that the
5156 function returns normally. A function returns normally if it
5157 doesn't contain an infinite loop or return abnormally by
5158 throwing, calling "abort" or trapping. This analysis requires
5159 option -fipa-pure-const, which is enabled by default at -O and
5160 higher. Higher optimization levels improve the accuracy of the
5161 analysis.
5162
5163 -Wsuggest-attribute=format
5164 -Wmissing-format-attribute
5165 Warn about function pointers that might be candidates for
5166 "format" attributes. Note these are only possible candidates,
5167 not absolute ones. GCC guesses that function pointers with
5168 "format" attributes that are used in assignment,
5169 initialization, parameter passing or return statements should
5170 have a corresponding "format" attribute in the resulting type.
5171 I.e. the left-hand side of the assignment or initialization,
5172 the type of the parameter variable, or the return type of the
5173 containing function respectively should also have a "format"
5174 attribute to avoid the warning.
5175
5176 GCC also warns about function definitions that might be
5177 candidates for "format" attributes. Again, these are only
5178 possible candidates. GCC guesses that "format" attributes
5179 might be appropriate for any function that calls a function
5180 like "vprintf" or "vscanf", but this might not always be the
5181 case, and some functions for which "format" attributes are
5182 appropriate may not be detected.
5183
5184 -Wsuggest-attribute=cold
5185 Warn about functions that might be candidates for "cold"
5186 attribute. This is based on static detection and generally
5187 only warns about functions which always leads to a call to
5188 another "cold" function such as wrappers of C++ "throw" or
5189 fatal error reporting functions leading to "abort".
5190
5191 -Walloc-zero
5192 Warn about calls to allocation functions decorated with attribute
5193 "alloc_size" that specify zero bytes, including those to the built-
5194 in forms of the functions "aligned_alloc", "alloca", "calloc",
5195 "malloc", and "realloc". Because the behavior of these functions
5196 when called with a zero size differs among implementations (and in
5197 the case of "realloc" has been deprecated) relying on it may result
5198 in subtle portability bugs and should be avoided.
5199
5200 -Walloc-size-larger-than=byte-size
5201 Warn about calls to functions decorated with attribute "alloc_size"
5202 that attempt to allocate objects larger than the specified number
5203 of bytes, or where the result of the size computation in an integer
5204 type with infinite precision would exceed the value of PTRDIFF_MAX
5205 on the target. -Walloc-size-larger-than=PTRDIFF_MAX is enabled by
5206 default. Warnings controlled by the option can be disabled either
5207 by specifying byte-size of SIZE_MAX or more or by
5208 -Wno-alloc-size-larger-than.
5209
5210 -Wno-alloc-size-larger-than
5211 Disable -Walloc-size-larger-than= warnings. The option is
5212 equivalent to -Walloc-size-larger-than=SIZE_MAX or larger.
5213
5214 -Walloca
5215 This option warns on all uses of "alloca" in the source.
5216
5217 -Walloca-larger-than=byte-size
5218 This option warns on calls to "alloca" with an integer argument
5219 whose value is either zero, or that is not bounded by a controlling
5220 predicate that limits its value to at most byte-size. It also
5221 warns for calls to "alloca" where the bound value is unknown.
5222 Arguments of non-integer types are considered unbounded even if
5223 they appear to be constrained to the expected range.
5224
5225 For example, a bounded case of "alloca" could be:
5226
5227 void func (size_t n)
5228 {
5229 void *p;
5230 if (n <= 1000)
5231 p = alloca (n);
5232 else
5233 p = malloc (n);
5234 f (p);
5235 }
5236
5237 In the above example, passing "-Walloca-larger-than=1000" would not
5238 issue a warning because the call to "alloca" is known to be at most
5239 1000 bytes. However, if "-Walloca-larger-than=500" were passed,
5240 the compiler would emit a warning.
5241
5242 Unbounded uses, on the other hand, are uses of "alloca" with no
5243 controlling predicate constraining its integer argument. For
5244 example:
5245
5246 void func ()
5247 {
5248 void *p = alloca (n);
5249 f (p);
5250 }
5251
5252 If "-Walloca-larger-than=500" were passed, the above would trigger
5253 a warning, but this time because of the lack of bounds checking.
5254
5255 Note, that even seemingly correct code involving signed integers
5256 could cause a warning:
5257
5258 void func (signed int n)
5259 {
5260 if (n < 500)
5261 {
5262 p = alloca (n);
5263 f (p);
5264 }
5265 }
5266
5267 In the above example, n could be negative, causing a larger than
5268 expected argument to be implicitly cast into the "alloca" call.
5269
5270 This option also warns when "alloca" is used in a loop.
5271
5272 -Walloca-larger-than=PTRDIFF_MAX is enabled by default but is
5273 usually only effective when -ftree-vrp is active (default for -O2
5274 and above).
5275
5276 See also -Wvla-larger-than=byte-size.
5277
5278 -Wno-alloca-larger-than
5279 Disable -Walloca-larger-than= warnings. The option is equivalent
5280 to -Walloca-larger-than=SIZE_MAX or larger.
5281
5282 -Warith-conversion
5283 Do warn about implicit conversions from arithmetic operations even
5284 when conversion of the operands to the same type cannot change
5285 their values. This affects warnings from -Wconversion,
5286 -Wfloat-conversion, and -Wsign-conversion.
5287
5288 void f (char c, int i)
5289 {
5290 c = c + i; // warns with B<-Wconversion>
5291 c = c + 1; // only warns with B<-Warith-conversion>
5292 }
5293
5294 -Warray-bounds
5295 -Warray-bounds=n
5296 This option is only active when -ftree-vrp is active (default for
5297 -O2 and above). It warns about subscripts to arrays that are always
5298 out of bounds. This warning is enabled by -Wall.
5299
5300 -Warray-bounds=1
5301 This is the warning level of -Warray-bounds and is enabled by
5302 -Wall; higher levels are not, and must be explicitly requested.
5303
5304 -Warray-bounds=2
5305 This warning level also warns about out of bounds access for
5306 arrays at the end of a struct and for arrays accessed through
5307 pointers. This warning level may give a larger number of false
5308 positives and is deactivated by default.
5309
5310 -Wattribute-alias=n
5311 -Wno-attribute-alias
5312 Warn about declarations using the "alias" and similar attributes
5313 whose target is incompatible with the type of the alias.
5314
5315 -Wattribute-alias=1
5316 The default warning level of the -Wattribute-alias option
5317 diagnoses incompatibilities between the type of the alias
5318 declaration and that of its target. Such incompatibilities are
5319 typically indicative of bugs.
5320
5321 -Wattribute-alias=2
5322 At this level -Wattribute-alias also diagnoses cases where the
5323 attributes of the alias declaration are more restrictive than
5324 the attributes applied to its target. These mismatches can
5325 potentially result in incorrect code generation. In other
5326 cases they may be benign and could be resolved simply by adding
5327 the missing attribute to the target. For comparison, see the
5328 -Wmissing-attributes option, which controls diagnostics when
5329 the alias declaration is less restrictive than the target,
5330 rather than more restrictive.
5331
5332 Attributes considered include "alloc_align", "alloc_size",
5333 "cold", "const", "hot", "leaf", "malloc", "nonnull",
5334 "noreturn", "nothrow", "pure", "returns_nonnull", and
5335 "returns_twice".
5336
5337 -Wattribute-alias is equivalent to -Wattribute-alias=1. This is
5338 the default. You can disable these warnings with either
5339 -Wno-attribute-alias or -Wattribute-alias=0.
5340
5341 -Wbool-compare
5342 Warn about boolean expression compared with an integer value
5343 different from "true"/"false". For instance, the following
5344 comparison is always false:
5345
5346 int n = 5;
5347 ...
5348 if ((n > 1) == 2) { ... }
5349
5350 This warning is enabled by -Wall.
5351
5352 -Wbool-operation
5353 Warn about suspicious operations on expressions of a boolean type.
5354 For instance, bitwise negation of a boolean is very likely a bug in
5355 the program. For C, this warning also warns about incrementing or
5356 decrementing a boolean, which rarely makes sense. (In C++,
5357 decrementing a boolean is always invalid. Incrementing a boolean
5358 is invalid in C++17, and deprecated otherwise.)
5359
5360 This warning is enabled by -Wall.
5361
5362 -Wduplicated-branches
5363 Warn when an if-else has identical branches. This warning detects
5364 cases like
5365
5366 if (p != NULL)
5367 return 0;
5368 else
5369 return 0;
5370
5371 It doesn't warn when both branches contain just a null statement.
5372 This warning also warn for conditional operators:
5373
5374 int i = x ? *p : *p;
5375
5376 -Wduplicated-cond
5377 Warn about duplicated conditions in an if-else-if chain. For
5378 instance, warn for the following code:
5379
5380 if (p->q != NULL) { ... }
5381 else if (p->q != NULL) { ... }
5382
5383 -Wframe-address
5384 Warn when the __builtin_frame_address or __builtin_return_address
5385 is called with an argument greater than 0. Such calls may return
5386 indeterminate values or crash the program. The warning is included
5387 in -Wall.
5388
5389 -Wno-discarded-qualifiers (C and Objective-C only)
5390 Do not warn if type qualifiers on pointers are being discarded.
5391 Typically, the compiler warns if a "const char *" variable is
5392 passed to a function that takes a "char *" parameter. This option
5393 can be used to suppress such a warning.
5394
5395 -Wno-discarded-array-qualifiers (C and Objective-C only)
5396 Do not warn if type qualifiers on arrays which are pointer targets
5397 are being discarded. Typically, the compiler warns if a "const int
5398 (*)[]" variable is passed to a function that takes a "int (*)[]"
5399 parameter. This option can be used to suppress such a warning.
5400
5401 -Wno-incompatible-pointer-types (C and Objective-C only)
5402 Do not warn when there is a conversion between pointers that have
5403 incompatible types. This warning is for cases not covered by
5404 -Wno-pointer-sign, which warns for pointer argument passing or
5405 assignment with different signedness.
5406
5407 -Wno-int-conversion (C and Objective-C only)
5408 Do not warn about incompatible integer to pointer and pointer to
5409 integer conversions. This warning is about implicit conversions;
5410 for explicit conversions the warnings -Wno-int-to-pointer-cast and
5411 -Wno-pointer-to-int-cast may be used.
5412
5413 -Wzero-length-bounds
5414 Warn about accesses to elements of zero-length array members that
5415 might overlap other members of the same object. Declaring interior
5416 zero-length arrays is discouraged because accesses to them are
5417 undefined. See
5418
5419 For example, the first two stores in function "bad" are diagnosed
5420 because the array elements overlap the subsequent members "b" and
5421 "c". The third store is diagnosed by -Warray-bounds because it is
5422 beyond the bounds of the enclosing object.
5423
5424 struct X { int a[0]; int b, c; };
5425 struct X x;
5426
5427 void bad (void)
5428 {
5429 x.a[0] = 0; // -Wzero-length-bounds
5430 x.a[1] = 1; // -Wzero-length-bounds
5431 x.a[2] = 2; // -Warray-bounds
5432 }
5433
5434 Option -Wzero-length-bounds is enabled by -Warray-bounds.
5435
5436 -Wno-div-by-zero
5437 Do not warn about compile-time integer division by zero. Floating-
5438 point division by zero is not warned about, as it can be a
5439 legitimate way of obtaining infinities and NaNs.
5440
5441 -Wsystem-headers
5442 Print warning messages for constructs found in system header files.
5443 Warnings from system headers are normally suppressed, on the
5444 assumption that they usually do not indicate real problems and
5445 would only make the compiler output harder to read. Using this
5446 command-line option tells GCC to emit warnings from system headers
5447 as if they occurred in user code. However, note that using -Wall
5448 in conjunction with this option does not warn about unknown pragmas
5449 in system headers---for that, -Wunknown-pragmas must also be used.
5450
5451 -Wtautological-compare
5452 Warn if a self-comparison always evaluates to true or false. This
5453 warning detects various mistakes such as:
5454
5455 int i = 1;
5456 ...
5457 if (i > i) { ... }
5458
5459 This warning also warns about bitwise comparisons that always
5460 evaluate to true or false, for instance:
5461
5462 if ((a & 16) == 10) { ... }
5463
5464 will always be false.
5465
5466 This warning is enabled by -Wall.
5467
5468 -Wtrampolines
5469 Warn about trampolines generated for pointers to nested functions.
5470 A trampoline is a small piece of data or code that is created at
5471 run time on the stack when the address of a nested function is
5472 taken, and is used to call the nested function indirectly. For
5473 some targets, it is made up of data only and thus requires no
5474 special treatment. But, for most targets, it is made up of code
5475 and thus requires the stack to be made executable in order for the
5476 program to work properly.
5477
5478 -Wfloat-equal
5479 Warn if floating-point values are used in equality comparisons.
5480
5481 The idea behind this is that sometimes it is convenient (for the
5482 programmer) to consider floating-point values as approximations to
5483 infinitely precise real numbers. If you are doing this, then you
5484 need to compute (by analyzing the code, or in some other way) the
5485 maximum or likely maximum error that the computation introduces,
5486 and allow for it when performing comparisons (and when producing
5487 output, but that's a different problem). In particular, instead of
5488 testing for equality, you should check to see whether the two
5489 values have ranges that overlap; and this is done with the
5490 relational operators, so equality comparisons are probably
5491 mistaken.
5492
5493 -Wtraditional (C and Objective-C only)
5494 Warn about certain constructs that behave differently in
5495 traditional and ISO C. Also warn about ISO C constructs that have
5496 no traditional C equivalent, and/or problematic constructs that
5497 should be avoided.
5498
5499 * Macro parameters that appear within string literals in the
5500 macro body. In traditional C macro replacement takes place
5501 within string literals, but in ISO C it does not.
5502
5503 * In traditional C, some preprocessor directives did not exist.
5504 Traditional preprocessors only considered a line to be a
5505 directive if the # appeared in column 1 on the line. Therefore
5506 -Wtraditional warns about directives that traditional C
5507 understands but ignores because the # does not appear as the
5508 first character on the line. It also suggests you hide
5509 directives like "#pragma" not understood by traditional C by
5510 indenting them. Some traditional implementations do not
5511 recognize "#elif", so this option suggests avoiding it
5512 altogether.
5513
5514 * A function-like macro that appears without arguments.
5515
5516 * The unary plus operator.
5517
5518 * The U integer constant suffix, or the F or L floating-point
5519 constant suffixes. (Traditional C does support the L suffix on
5520 integer constants.) Note, these suffixes appear in macros
5521 defined in the system headers of most modern systems, e.g. the
5522 _MIN/_MAX macros in "<limits.h>". Use of these macros in user
5523 code might normally lead to spurious warnings, however GCC's
5524 integrated preprocessor has enough context to avoid warning in
5525 these cases.
5526
5527 * A function declared external in one block and then used after
5528 the end of the block.
5529
5530 * A "switch" statement has an operand of type "long".
5531
5532 * A non-"static" function declaration follows a "static" one.
5533 This construct is not accepted by some traditional C compilers.
5534
5535 * The ISO type of an integer constant has a different width or
5536 signedness from its traditional type. This warning is only
5537 issued if the base of the constant is ten. I.e. hexadecimal or
5538 octal values, which typically represent bit patterns, are not
5539 warned about.
5540
5541 * Usage of ISO string concatenation is detected.
5542
5543 * Initialization of automatic aggregates.
5544
5545 * Identifier conflicts with labels. Traditional C lacks a
5546 separate namespace for labels.
5547
5548 * Initialization of unions. If the initializer is zero, the
5549 warning is omitted. This is done under the assumption that the
5550 zero initializer in user code appears conditioned on e.g.
5551 "__STDC__" to avoid missing initializer warnings and relies on
5552 default initialization to zero in the traditional C case.
5553
5554 * Conversions by prototypes between fixed/floating-point values
5555 and vice versa. The absence of these prototypes when compiling
5556 with traditional C causes serious problems. This is a subset
5557 of the possible conversion warnings; for the full set use
5558 -Wtraditional-conversion.
5559
5560 * Use of ISO C style function definitions. This warning
5561 intentionally is not issued for prototype declarations or
5562 variadic functions because these ISO C features appear in your
5563 code when using libiberty's traditional C compatibility macros,
5564 "PARAMS" and "VPARAMS". This warning is also bypassed for
5565 nested functions because that feature is already a GCC
5566 extension and thus not relevant to traditional C compatibility.
5567
5568 -Wtraditional-conversion (C and Objective-C only)
5569 Warn if a prototype causes a type conversion that is different from
5570 what would happen to the same argument in the absence of a
5571 prototype. This includes conversions of fixed point to floating
5572 and vice versa, and conversions changing the width or signedness of
5573 a fixed-point argument except when the same as the default
5574 promotion.
5575
5576 -Wdeclaration-after-statement (C and Objective-C only)
5577 Warn when a declaration is found after a statement in a block.
5578 This construct, known from C++, was introduced with ISO C99 and is
5579 by default allowed in GCC. It is not supported by ISO C90.
5580
5581 -Wshadow
5582 Warn whenever a local variable or type declaration shadows another
5583 variable, parameter, type, class member (in C++), or instance
5584 variable (in Objective-C) or whenever a built-in function is
5585 shadowed. Note that in C++, the compiler warns if a local variable
5586 shadows an explicit typedef, but not if it shadows a
5587 struct/class/enum. If this warning is enabled, it includes also
5588 all instances of local shadowing. This means that
5589 -Wno-shadow=local and -Wno-shadow=compatible-local are ignored when
5590 -Wshadow is used. Same as -Wshadow=global.
5591
5592 -Wno-shadow-ivar (Objective-C only)
5593 Do not warn whenever a local variable shadows an instance variable
5594 in an Objective-C method.
5595
5596 -Wshadow=global
5597 Warn for any shadowing. Same as -Wshadow.
5598
5599 -Wshadow=local
5600 Warn when a local variable shadows another local variable or
5601 parameter.
5602
5603 -Wshadow=compatible-local
5604 Warn when a local variable shadows another local variable or
5605 parameter whose type is compatible with that of the shadowing
5606 variable. In C++, type compatibility here means the type of the
5607 shadowing variable can be converted to that of the shadowed
5608 variable. The creation of this flag (in addition to
5609 -Wshadow=local) is based on the idea that when a local variable
5610 shadows another one of incompatible type, it is most likely
5611 intentional, not a bug or typo, as shown in the following example:
5612
5613 for (SomeIterator i = SomeObj.begin(); i != SomeObj.end(); ++i)
5614 {
5615 for (int i = 0; i < N; ++i)
5616 {
5617 ...
5618 }
5619 ...
5620 }
5621
5622 Since the two variable "i" in the example above have incompatible
5623 types, enabling only -Wshadow=compatible-local does not emit a
5624 warning. Because their types are incompatible, if a programmer
5625 accidentally uses one in place of the other, type checking is
5626 expected to catch that and emit an error or warning. Use of this
5627 flag instead of -Wshadow=local can possibly reduce the number of
5628 warnings triggered by intentional shadowing. Note that this also
5629 means that shadowing "const char *i" by "char *i" does not emit a
5630 warning.
5631
5632 This warning is also enabled by -Wshadow=local.
5633
5634 -Wlarger-than=byte-size
5635 Warn whenever an object is defined whose size exceeds byte-size.
5636 -Wlarger-than=PTRDIFF_MAX is enabled by default. Warnings
5637 controlled by the option can be disabled either by specifying byte-
5638 size of SIZE_MAX or more or by -Wno-larger-than.
5639
5640 -Wno-larger-than
5641 Disable -Wlarger-than= warnings. The option is equivalent to
5642 -Wlarger-than=SIZE_MAX or larger.
5643
5644 -Wframe-larger-than=byte-size
5645 Warn if the size of a function frame exceeds byte-size. The
5646 computation done to determine the stack frame size is approximate
5647 and not conservative. The actual requirements may be somewhat
5648 greater than byte-size even if you do not get a warning. In
5649 addition, any space allocated via "alloca", variable-length arrays,
5650 or related constructs is not included by the compiler when
5651 determining whether or not to issue a warning.
5652 -Wframe-larger-than=PTRDIFF_MAX is enabled by default. Warnings
5653 controlled by the option can be disabled either by specifying byte-
5654 size of SIZE_MAX or more or by -Wno-frame-larger-than.
5655
5656 -Wno-frame-larger-than
5657 Disable -Wframe-larger-than= warnings. The option is equivalent to
5658 -Wframe-larger-than=SIZE_MAX or larger.
5659
5660 -Wno-free-nonheap-object
5661 Do not warn when attempting to free an object that was not
5662 allocated on the heap.
5663
5664 -Wstack-usage=byte-size
5665 Warn if the stack usage of a function might exceed byte-size. The
5666 computation done to determine the stack usage is conservative. Any
5667 space allocated via "alloca", variable-length arrays, or related
5668 constructs is included by the compiler when determining whether or
5669 not to issue a warning.
5670
5671 The message is in keeping with the output of -fstack-usage.
5672
5673 * If the stack usage is fully static but exceeds the specified
5674 amount, it's:
5675
5676 warning: stack usage is 1120 bytes
5677
5678 * If the stack usage is (partly) dynamic but bounded, it's:
5679
5680 warning: stack usage might be 1648 bytes
5681
5682 * If the stack usage is (partly) dynamic and not bounded, it's:
5683
5684 warning: stack usage might be unbounded
5685
5686 -Wstack-usage=PTRDIFF_MAX is enabled by default. Warnings
5687 controlled by the option can be disabled either by specifying byte-
5688 size of SIZE_MAX or more or by -Wno-stack-usage.
5689
5690 -Wno-stack-usage
5691 Disable -Wstack-usage= warnings. The option is equivalent to
5692 -Wstack-usage=SIZE_MAX or larger.
5693
5694 -Wunsafe-loop-optimizations
5695 Warn if the loop cannot be optimized because the compiler cannot
5696 assume anything on the bounds of the loop indices. With
5697 -funsafe-loop-optimizations warn if the compiler makes such
5698 assumptions.
5699
5700 -Wno-pedantic-ms-format (MinGW targets only)
5701 When used in combination with -Wformat and -pedantic without GNU
5702 extensions, this option disables the warnings about non-ISO
5703 "printf" / "scanf" format width specifiers "I32", "I64", and "I"
5704 used on Windows targets, which depend on the MS runtime.
5705
5706 -Wpointer-arith
5707 Warn about anything that depends on the "size of" a function type
5708 or of "void". GNU C assigns these types a size of 1, for
5709 convenience in calculations with "void *" pointers and pointers to
5710 functions. In C++, warn also when an arithmetic operation involves
5711 "NULL". This warning is also enabled by -Wpedantic.
5712
5713 -Wno-pointer-compare
5714 Do not warn if a pointer is compared with a zero character
5715 constant. This usually means that the pointer was meant to be
5716 dereferenced. For example:
5717
5718 const char *p = foo ();
5719 if (p == '\0')
5720 return 42;
5721
5722 Note that the code above is invalid in C++11.
5723
5724 This warning is enabled by default.
5725
5726 -Wtype-limits
5727 Warn if a comparison is always true or always false due to the
5728 limited range of the data type, but do not warn for constant
5729 expressions. For example, warn if an unsigned variable is compared
5730 against zero with "<" or ">=". This warning is also enabled by
5731 -Wextra.
5732
5733 -Wabsolute-value (C and Objective-C only)
5734 Warn for calls to standard functions that compute the absolute
5735 value of an argument when a more appropriate standard function is
5736 available. For example, calling "abs(3.14)" triggers the warning
5737 because the appropriate function to call to compute the absolute
5738 value of a double argument is "fabs". The option also triggers
5739 warnings when the argument in a call to such a function has an
5740 unsigned type. This warning can be suppressed with an explicit
5741 type cast and it is also enabled by -Wextra.
5742
5743 -Wcomment
5744 -Wcomments
5745 Warn whenever a comment-start sequence /* appears in a /* comment,
5746 or whenever a backslash-newline appears in a // comment. This
5747 warning is enabled by -Wall.
5748
5749 -Wtrigraphs
5750 Warn if any trigraphs are encountered that might change the meaning
5751 of the program. Trigraphs within comments are not warned about,
5752 except those that would form escaped newlines.
5753
5754 This option is implied by -Wall. If -Wall is not given, this
5755 option is still enabled unless trigraphs are enabled. To get
5756 trigraph conversion without warnings, but get the other -Wall
5757 warnings, use -trigraphs -Wall -Wno-trigraphs.
5758
5759 -Wundef
5760 Warn if an undefined identifier is evaluated in an "#if" directive.
5761 Such identifiers are replaced with zero.
5762
5763 -Wexpansion-to-defined
5764 Warn whenever defined is encountered in the expansion of a macro
5765 (including the case where the macro is expanded by an #if
5766 directive). Such usage is not portable. This warning is also
5767 enabled by -Wpedantic and -Wextra.
5768
5769 -Wunused-macros
5770 Warn about macros defined in the main file that are unused. A
5771 macro is used if it is expanded or tested for existence at least
5772 once. The preprocessor also warns if the macro has not been used
5773 at the time it is redefined or undefined.
5774
5775 Built-in macros, macros defined on the command line, and macros
5776 defined in include files are not warned about.
5777
5778 Note: If a macro is actually used, but only used in skipped
5779 conditional blocks, then the preprocessor reports it as unused. To
5780 avoid the warning in such a case, you might improve the scope of
5781 the macro's definition by, for example, moving it into the first
5782 skipped block. Alternatively, you could provide a dummy use with
5783 something like:
5784
5785 #if defined the_macro_causing_the_warning
5786 #endif
5787
5788 -Wno-endif-labels
5789 Do not warn whenever an "#else" or an "#endif" are followed by
5790 text. This sometimes happens in older programs with code of the
5791 form
5792
5793 #if FOO
5794 ...
5795 #else FOO
5796 ...
5797 #endif FOO
5798
5799 The second and third "FOO" should be in comments. This warning is
5800 on by default.
5801
5802 -Wbad-function-cast (C and Objective-C only)
5803 Warn when a function call is cast to a non-matching type. For
5804 example, warn if a call to a function returning an integer type is
5805 cast to a pointer type.
5806
5807 -Wc90-c99-compat (C and Objective-C only)
5808 Warn about features not present in ISO C90, but present in ISO C99.
5809 For instance, warn about use of variable length arrays, "long long"
5810 type, "bool" type, compound literals, designated initializers, and
5811 so on. This option is independent of the standards mode. Warnings
5812 are disabled in the expression that follows "__extension__".
5813
5814 -Wc99-c11-compat (C and Objective-C only)
5815 Warn about features not present in ISO C99, but present in ISO C11.
5816 For instance, warn about use of anonymous structures and unions,
5817 "_Atomic" type qualifier, "_Thread_local" storage-class specifier,
5818 "_Alignas" specifier, "Alignof" operator, "_Generic" keyword, and
5819 so on. This option is independent of the standards mode. Warnings
5820 are disabled in the expression that follows "__extension__".
5821
5822 -Wc11-c2x-compat (C and Objective-C only)
5823 Warn about features not present in ISO C11, but present in ISO C2X.
5824 For instance, warn about omitting the string in "_Static_assert",
5825 use of [[]] syntax for attributes, use of decimal floating-point
5826 types, and so on. This option is independent of the standards
5827 mode. Warnings are disabled in the expression that follows
5828 "__extension__".
5829
5830 -Wc++-compat (C and Objective-C only)
5831 Warn about ISO C constructs that are outside of the common subset
5832 of ISO C and ISO C++, e.g. request for implicit conversion from
5833 "void *" to a pointer to non-"void" type.
5834
5835 -Wc++11-compat (C++ and Objective-C++ only)
5836 Warn about C++ constructs whose meaning differs between ISO C++
5837 1998 and ISO C++ 2011, e.g., identifiers in ISO C++ 1998 that are
5838 keywords in ISO C++ 2011. This warning turns on -Wnarrowing and is
5839 enabled by -Wall.
5840
5841 -Wc++14-compat (C++ and Objective-C++ only)
5842 Warn about C++ constructs whose meaning differs between ISO C++
5843 2011 and ISO C++ 2014. This warning is enabled by -Wall.
5844
5845 -Wc++17-compat (C++ and Objective-C++ only)
5846 Warn about C++ constructs whose meaning differs between ISO C++
5847 2014 and ISO C++ 2017. This warning is enabled by -Wall.
5848
5849 -Wc++20-compat (C++ and Objective-C++ only)
5850 Warn about C++ constructs whose meaning differs between ISO C++
5851 2017 and ISO C++ 2020. This warning is enabled by -Wall.
5852
5853 -Wcast-qual
5854 Warn whenever a pointer is cast so as to remove a type qualifier
5855 from the target type. For example, warn if a "const char *" is
5856 cast to an ordinary "char *".
5857
5858 Also warn when making a cast that introduces a type qualifier in an
5859 unsafe way. For example, casting "char **" to "const char **" is
5860 unsafe, as in this example:
5861
5862 /* p is char ** value. */
5863 const char **q = (const char **) p;
5864 /* Assignment of readonly string to const char * is OK. */
5865 *q = "string";
5866 /* Now char** pointer points to read-only memory. */
5867 **p = 'b';
5868
5869 -Wcast-align
5870 Warn whenever a pointer is cast such that the required alignment of
5871 the target is increased. For example, warn if a "char *" is cast
5872 to an "int *" on machines where integers can only be accessed at
5873 two- or four-byte boundaries.
5874
5875 -Wcast-align=strict
5876 Warn whenever a pointer is cast such that the required alignment of
5877 the target is increased. For example, warn if a "char *" is cast
5878 to an "int *" regardless of the target machine.
5879
5880 -Wcast-function-type
5881 Warn when a function pointer is cast to an incompatible function
5882 pointer. In a cast involving function types with a variable
5883 argument list only the types of initial arguments that are provided
5884 are considered. Any parameter of pointer-type matches any other
5885 pointer-type. Any benign differences in integral types are
5886 ignored, like "int" vs. "long" on ILP32 targets. Likewise type
5887 qualifiers are ignored. The function type "void (*) (void)" is
5888 special and matches everything, which can be used to suppress this
5889 warning. In a cast involving pointer to member types this warning
5890 warns whenever the type cast is changing the pointer to member
5891 type. This warning is enabled by -Wextra.
5892
5893 -Wwrite-strings
5894 When compiling C, give string constants the type "const
5895 char[length]" so that copying the address of one into a non-"const"
5896 "char *" pointer produces a warning. These warnings help you find
5897 at compile time code that can try to write into a string constant,
5898 but only if you have been very careful about using "const" in
5899 declarations and prototypes. Otherwise, it is just a nuisance.
5900 This is why we did not make -Wall request these warnings.
5901
5902 When compiling C++, warn about the deprecated conversion from
5903 string literals to "char *". This warning is enabled by default
5904 for C++ programs.
5905
5906 -Wclobbered
5907 Warn for variables that might be changed by "longjmp" or "vfork".
5908 This warning is also enabled by -Wextra.
5909
5910 -Wconversion
5911 Warn for implicit conversions that may alter a value. This includes
5912 conversions between real and integer, like "abs (x)" when "x" is
5913 "double"; conversions between signed and unsigned, like "unsigned
5914 ui = -1"; and conversions to smaller types, like "sqrtf (M_PI)". Do
5915 not warn for explicit casts like "abs ((int) x)" and "ui =
5916 (unsigned) -1", or if the value is not changed by the conversion
5917 like in "abs (2.0)". Warnings about conversions between signed and
5918 unsigned integers can be disabled by using -Wno-sign-conversion.
5919
5920 For C++, also warn for confusing overload resolution for user-
5921 defined conversions; and conversions that never use a type
5922 conversion operator: conversions to "void", the same type, a base
5923 class or a reference to them. Warnings about conversions between
5924 signed and unsigned integers are disabled by default in C++ unless
5925 -Wsign-conversion is explicitly enabled.
5926
5927 Warnings about conversion from arithmetic on a small type back to
5928 that type are only given with -Warith-conversion.
5929
5930 -Wdangling-else
5931 Warn about constructions where there may be confusion to which "if"
5932 statement an "else" branch belongs. Here is an example of such a
5933 case:
5934
5935 {
5936 if (a)
5937 if (b)
5938 foo ();
5939 else
5940 bar ();
5941 }
5942
5943 In C/C++, every "else" branch belongs to the innermost possible
5944 "if" statement, which in this example is "if (b)". This is often
5945 not what the programmer expected, as illustrated in the above
5946 example by indentation the programmer chose. When there is the
5947 potential for this confusion, GCC issues a warning when this flag
5948 is specified. To eliminate the warning, add explicit braces around
5949 the innermost "if" statement so there is no way the "else" can
5950 belong to the enclosing "if". The resulting code looks like this:
5951
5952 {
5953 if (a)
5954 {
5955 if (b)
5956 foo ();
5957 else
5958 bar ();
5959 }
5960 }
5961
5962 This warning is enabled by -Wparentheses.
5963
5964 -Wdate-time
5965 Warn when macros "__TIME__", "__DATE__" or "__TIMESTAMP__" are
5966 encountered as they might prevent bit-wise-identical reproducible
5967 compilations.
5968
5969 -Wempty-body
5970 Warn if an empty body occurs in an "if", "else" or "do while"
5971 statement. This warning is also enabled by -Wextra.
5972
5973 -Wno-endif-labels
5974 Do not warn about stray tokens after "#else" and "#endif".
5975
5976 -Wenum-compare
5977 Warn about a comparison between values of different enumerated
5978 types. In C++ enumerated type mismatches in conditional
5979 expressions are also diagnosed and the warning is enabled by
5980 default. In C this warning is enabled by -Wall.
5981
5982 -Wenum-conversion (C, Objective-C only)
5983 Warn when a value of enumerated type is implicitly converted to a
5984 different enumerated type. This warning is enabled by -Wextra.
5985
5986 -Wjump-misses-init (C, Objective-C only)
5987 Warn if a "goto" statement or a "switch" statement jumps forward
5988 across the initialization of a variable, or jumps backward to a
5989 label after the variable has been initialized. This only warns
5990 about variables that are initialized when they are declared. This
5991 warning is only supported for C and Objective-C; in C++ this sort
5992 of branch is an error in any case.
5993
5994 -Wjump-misses-init is included in -Wc++-compat. It can be disabled
5995 with the -Wno-jump-misses-init option.
5996
5997 -Wsign-compare
5998 Warn when a comparison between signed and unsigned values could
5999 produce an incorrect result when the signed value is converted to
6000 unsigned. In C++, this warning is also enabled by -Wall. In C, it
6001 is also enabled by -Wextra.
6002
6003 -Wsign-conversion
6004 Warn for implicit conversions that may change the sign of an
6005 integer value, like assigning a signed integer expression to an
6006 unsigned integer variable. An explicit cast silences the warning.
6007 In C, this option is enabled also by -Wconversion.
6008
6009 -Wfloat-conversion
6010 Warn for implicit conversions that reduce the precision of a real
6011 value. This includes conversions from real to integer, and from
6012 higher precision real to lower precision real values. This option
6013 is also enabled by -Wconversion.
6014
6015 -Wno-scalar-storage-order
6016 Do not warn on suspicious constructs involving reverse scalar
6017 storage order.
6018
6019 -Wsizeof-pointer-div
6020 Warn for suspicious divisions of two sizeof expressions that divide
6021 the pointer size by the element size, which is the usual way to
6022 compute the array size but won't work out correctly with pointers.
6023 This warning warns e.g. about "sizeof (ptr) / sizeof (ptr[0])" if
6024 "ptr" is not an array, but a pointer. This warning is enabled by
6025 -Wall.
6026
6027 -Wsizeof-pointer-memaccess
6028 Warn for suspicious length parameters to certain string and memory
6029 built-in functions if the argument uses "sizeof". This warning
6030 triggers for example for "memset (ptr, 0, sizeof (ptr));" if "ptr"
6031 is not an array, but a pointer, and suggests a possible fix, or
6032 about "memcpy (&foo, ptr, sizeof (&foo));".
6033 -Wsizeof-pointer-memaccess also warns about calls to bounded string
6034 copy functions like "strncat" or "strncpy" that specify as the
6035 bound a "sizeof" expression of the source array. For example, in
6036 the following function the call to "strncat" specifies the size of
6037 the source string as the bound. That is almost certainly a mistake
6038 and so the call is diagnosed.
6039
6040 void make_file (const char *name)
6041 {
6042 char path[PATH_MAX];
6043 strncpy (path, name, sizeof path - 1);
6044 strncat (path, ".text", sizeof ".text");
6045 ...
6046 }
6047
6048 The -Wsizeof-pointer-memaccess option is enabled by -Wall.
6049
6050 -Wno-sizeof-array-argument
6051 Do not warn when the "sizeof" operator is applied to a parameter
6052 that is declared as an array in a function definition. This
6053 warning is enabled by default for C and C++ programs.
6054
6055 -Wmemset-elt-size
6056 Warn for suspicious calls to the "memset" built-in function, if the
6057 first argument references an array, and the third argument is a
6058 number equal to the number of elements, but not equal to the size
6059 of the array in memory. This indicates that the user has omitted a
6060 multiplication by the element size. This warning is enabled by
6061 -Wall.
6062
6063 -Wmemset-transposed-args
6064 Warn for suspicious calls to the "memset" built-in function where
6065 the second argument is not zero and the third argument is zero.
6066 For example, the call "memset (buf, sizeof buf, 0)" is diagnosed
6067 because "memset (buf, 0, sizeof buf)" was meant instead. The
6068 diagnostic is only emitted if the third argument is a literal zero.
6069 Otherwise, if it is an expression that is folded to zero, or a cast
6070 of zero to some type, it is far less likely that the arguments have
6071 been mistakenly transposed and no warning is emitted. This warning
6072 is enabled by -Wall.
6073
6074 -Waddress
6075 Warn about suspicious uses of memory addresses. These include using
6076 the address of a function in a conditional expression, such as
6077 "void func(void); if (func)", and comparisons against the memory
6078 address of a string literal, such as "if (x == "abc")". Such uses
6079 typically indicate a programmer error: the address of a function
6080 always evaluates to true, so their use in a conditional usually
6081 indicate that the programmer forgot the parentheses in a function
6082 call; and comparisons against string literals result in unspecified
6083 behavior and are not portable in C, so they usually indicate that
6084 the programmer intended to use "strcmp". This warning is enabled
6085 by -Wall.
6086
6087 -Wno-address-of-packed-member
6088 Do not warn when the address of packed member of struct or union is
6089 taken, which usually results in an unaligned pointer value. This
6090 is enabled by default.
6091
6092 -Wlogical-op
6093 Warn about suspicious uses of logical operators in expressions.
6094 This includes using logical operators in contexts where a bit-wise
6095 operator is likely to be expected. Also warns when the operands of
6096 a logical operator are the same:
6097
6098 extern int a;
6099 if (a < 0 && a < 0) { ... }
6100
6101 -Wlogical-not-parentheses
6102 Warn about logical not used on the left hand side operand of a
6103 comparison. This option does not warn if the right operand is
6104 considered to be a boolean expression. Its purpose is to detect
6105 suspicious code like the following:
6106
6107 int a;
6108 ...
6109 if (!a > 1) { ... }
6110
6111 It is possible to suppress the warning by wrapping the LHS into
6112 parentheses:
6113
6114 if ((!a) > 1) { ... }
6115
6116 This warning is enabled by -Wall.
6117
6118 -Waggregate-return
6119 Warn if any functions that return structures or unions are defined
6120 or called. (In languages where you can return an array, this also
6121 elicits a warning.)
6122
6123 -Wno-aggressive-loop-optimizations
6124 Warn if in a loop with constant number of iterations the compiler
6125 detects undefined behavior in some statement during one or more of
6126 the iterations.
6127
6128 -Wno-attributes
6129 Do not warn if an unexpected "__attribute__" is used, such as
6130 unrecognized attributes, function attributes applied to variables,
6131 etc. This does not stop errors for incorrect use of supported
6132 attributes.
6133
6134 -Wno-builtin-declaration-mismatch
6135 Warn if a built-in function is declared with an incompatible
6136 signature or as a non-function, or when a built-in function
6137 declared with a type that does not include a prototype is called
6138 with arguments whose promoted types do not match those expected by
6139 the function. When -Wextra is specified, also warn when a built-in
6140 function that takes arguments is declared without a prototype. The
6141 -Wbuiltin-declaration-mismatch warning is enabled by default. To
6142 avoid the warning include the appropriate header to bring the
6143 prototypes of built-in functions into scope.
6144
6145 For example, the call to "memset" below is diagnosed by the warning
6146 because the function expects a value of type "size_t" as its
6147 argument but the type of 32 is "int". With -Wextra, the
6148 declaration of the function is diagnosed as well.
6149
6150 extern void* memset ();
6151 void f (void *d)
6152 {
6153 memset (d, '\0', 32);
6154 }
6155
6156 -Wno-builtin-macro-redefined
6157 Do not warn if certain built-in macros are redefined. This
6158 suppresses warnings for redefinition of "__TIMESTAMP__",
6159 "__TIME__", "__DATE__", "__FILE__", and "__BASE_FILE__".
6160
6161 -Wstrict-prototypes (C and Objective-C only)
6162 Warn if a function is declared or defined without specifying the
6163 argument types. (An old-style function definition is permitted
6164 without a warning if preceded by a declaration that specifies the
6165 argument types.)
6166
6167 -Wold-style-declaration (C and Objective-C only)
6168 Warn for obsolescent usages, according to the C Standard, in a
6169 declaration. For example, warn if storage-class specifiers like
6170 "static" are not the first things in a declaration. This warning
6171 is also enabled by -Wextra.
6172
6173 -Wold-style-definition (C and Objective-C only)
6174 Warn if an old-style function definition is used. A warning is
6175 given even if there is a previous prototype. A definition using ()
6176 is not considered an old-style definition in C2X mode, because it
6177 is equivalent to (void) in that case, but is considered an old-
6178 style definition for older standards.
6179
6180 -Wmissing-parameter-type (C and Objective-C only)
6181 A function parameter is declared without a type specifier in
6182 K&R-style functions:
6183
6184 void foo(bar) { }
6185
6186 This warning is also enabled by -Wextra.
6187
6188 -Wmissing-prototypes (C and Objective-C only)
6189 Warn if a global function is defined without a previous prototype
6190 declaration. This warning is issued even if the definition itself
6191 provides a prototype. Use this option to detect global functions
6192 that do not have a matching prototype declaration in a header file.
6193 This option is not valid for C++ because all function declarations
6194 provide prototypes and a non-matching declaration declares an
6195 overload rather than conflict with an earlier declaration. Use
6196 -Wmissing-declarations to detect missing declarations in C++.
6197
6198 -Wmissing-declarations
6199 Warn if a global function is defined without a previous
6200 declaration. Do so even if the definition itself provides a
6201 prototype. Use this option to detect global functions that are not
6202 declared in header files. In C, no warnings are issued for
6203 functions with previous non-prototype declarations; use
6204 -Wmissing-prototypes to detect missing prototypes. In C++, no
6205 warnings are issued for function templates, or for inline
6206 functions, or for functions in anonymous namespaces.
6207
6208 -Wmissing-field-initializers
6209 Warn if a structure's initializer has some fields missing. For
6210 example, the following code causes such a warning, because "x.h" is
6211 implicitly zero:
6212
6213 struct s { int f, g, h; };
6214 struct s x = { 3, 4 };
6215
6216 This option does not warn about designated initializers, so the
6217 following modification does not trigger a warning:
6218
6219 struct s { int f, g, h; };
6220 struct s x = { .f = 3, .g = 4 };
6221
6222 In C this option does not warn about the universal zero initializer
6223 { 0 }:
6224
6225 struct s { int f, g, h; };
6226 struct s x = { 0 };
6227
6228 Likewise, in C++ this option does not warn about the empty { }
6229 initializer, for example:
6230
6231 struct s { int f, g, h; };
6232 s x = { };
6233
6234 This warning is included in -Wextra. To get other -Wextra warnings
6235 without this one, use -Wextra -Wno-missing-field-initializers.
6236
6237 -Wno-multichar
6238 Do not warn if a multicharacter constant ('FOOF') is used. Usually
6239 they indicate a typo in the user's code, as they have
6240 implementation-defined values, and should not be used in portable
6241 code.
6242
6243 -Wnormalized=[none|id|nfc|nfkc]
6244 In ISO C and ISO C++, two identifiers are different if they are
6245 different sequences of characters. However, sometimes when
6246 characters outside the basic ASCII character set are used, you can
6247 have two different character sequences that look the same. To
6248 avoid confusion, the ISO 10646 standard sets out some normalization
6249 rules which when applied ensure that two sequences that look the
6250 same are turned into the same sequence. GCC can warn you if you
6251 are using identifiers that have not been normalized; this option
6252 controls that warning.
6253
6254 There are four levels of warning supported by GCC. The default is
6255 -Wnormalized=nfc, which warns about any identifier that is not in
6256 the ISO 10646 "C" normalized form, NFC. NFC is the recommended
6257 form for most uses. It is equivalent to -Wnormalized.
6258
6259 Unfortunately, there are some characters allowed in identifiers by
6260 ISO C and ISO C++ that, when turned into NFC, are not allowed in
6261 identifiers. That is, there's no way to use these symbols in
6262 portable ISO C or C++ and have all your identifiers in NFC.
6263 -Wnormalized=id suppresses the warning for these characters. It is
6264 hoped that future versions of the standards involved will correct
6265 this, which is why this option is not the default.
6266
6267 You can switch the warning off for all characters by writing
6268 -Wnormalized=none or -Wno-normalized. You should only do this if
6269 you are using some other normalization scheme (like "D"), because
6270 otherwise you can easily create bugs that are literally impossible
6271 to see.
6272
6273 Some characters in ISO 10646 have distinct meanings but look
6274 identical in some fonts or display methodologies, especially once
6275 formatting has been applied. For instance "\u207F", "SUPERSCRIPT
6276 LATIN SMALL LETTER N", displays just like a regular "n" that has
6277 been placed in a superscript. ISO 10646 defines the NFKC
6278 normalization scheme to convert all these into a standard form as
6279 well, and GCC warns if your code is not in NFKC if you use
6280 -Wnormalized=nfkc. This warning is comparable to warning about
6281 every identifier that contains the letter O because it might be
6282 confused with the digit 0, and so is not the default, but may be
6283 useful as a local coding convention if the programming environment
6284 cannot be fixed to display these characters distinctly.
6285
6286 -Wno-attribute-warning
6287 Do not warn about usage of functions declared with "warning"
6288 attribute. By default, this warning is enabled.
6289 -Wno-attribute-warning can be used to disable the warning or
6290 -Wno-error=attribute-warning can be used to disable the error when
6291 compiled with -Werror flag.
6292
6293 -Wno-deprecated
6294 Do not warn about usage of deprecated features.
6295
6296 -Wno-deprecated-declarations
6297 Do not warn about uses of functions, variables, and types marked as
6298 deprecated by using the "deprecated" attribute.
6299
6300 -Wno-overflow
6301 Do not warn about compile-time overflow in constant expressions.
6302
6303 -Wno-odr
6304 Warn about One Definition Rule violations during link-time
6305 optimization. Enabled by default.
6306
6307 -Wopenmp-simd
6308 Warn if the vectorizer cost model overrides the OpenMP simd
6309 directive set by user. The -fsimd-cost-model=unlimited option can
6310 be used to relax the cost model.
6311
6312 -Woverride-init (C and Objective-C only)
6313 Warn if an initialized field without side effects is overridden
6314 when using designated initializers.
6315
6316 This warning is included in -Wextra. To get other -Wextra warnings
6317 without this one, use -Wextra -Wno-override-init.
6318
6319 -Wno-override-init-side-effects (C and Objective-C only)
6320 Do not warn if an initialized field with side effects is overridden
6321 when using designated initializers. This warning is enabled by
6322 default.
6323
6324 -Wpacked
6325 Warn if a structure is given the packed attribute, but the packed
6326 attribute has no effect on the layout or size of the structure.
6327 Such structures may be mis-aligned for little benefit. For
6328 instance, in this code, the variable "f.x" in "struct bar" is
6329 misaligned even though "struct bar" does not itself have the packed
6330 attribute:
6331
6332 struct foo {
6333 int x;
6334 char a, b, c, d;
6335 } __attribute__((packed));
6336 struct bar {
6337 char z;
6338 struct foo f;
6339 };
6340
6341 -Wnopacked-bitfield-compat
6342 The 4.1, 4.2 and 4.3 series of GCC ignore the "packed" attribute on
6343 bit-fields of type "char". This was fixed in GCC 4.4 but the
6344 change can lead to differences in the structure layout. GCC
6345 informs you when the offset of such a field has changed in GCC 4.4.
6346 For example there is no longer a 4-bit padding between field "a"
6347 and "b" in this structure:
6348
6349 struct foo
6350 {
6351 char a:4;
6352 char b:8;
6353 } __attribute__ ((packed));
6354
6355 This warning is enabled by default. Use
6356 -Wno-packed-bitfield-compat to disable this warning.
6357
6358 -Wpacked-not-aligned (C, C++, Objective-C and Objective-C++ only)
6359 Warn if a structure field with explicitly specified alignment in a
6360 packed struct or union is misaligned. For example, a warning will
6361 be issued on "struct S", like, "warning: alignment 1 of 'struct S'
6362 is less than 8", in this code:
6363
6364 struct __attribute__ ((aligned (8))) S8 { char a[8]; };
6365 struct __attribute__ ((packed)) S {
6366 struct S8 s8;
6367 };
6368
6369 This warning is enabled by -Wall.
6370
6371 -Wpadded
6372 Warn if padding is included in a structure, either to align an
6373 element of the structure or to align the whole structure.
6374 Sometimes when this happens it is possible to rearrange the fields
6375 of the structure to reduce the padding and so make the structure
6376 smaller.
6377
6378 -Wredundant-decls
6379 Warn if anything is declared more than once in the same scope, even
6380 in cases where multiple declaration is valid and changes nothing.
6381
6382 -Wrestrict
6383 Warn when an object referenced by a "restrict"-qualified parameter
6384 (or, in C++, a "__restrict"-qualified parameter) is aliased by
6385 another argument, or when copies between such objects overlap. For
6386 example, the call to the "strcpy" function below attempts to
6387 truncate the string by replacing its initial characters with the
6388 last four. However, because the call writes the terminating NUL
6389 into "a[4]", the copies overlap and the call is diagnosed.
6390
6391 void foo (void)
6392 {
6393 char a[] = "abcd1234";
6394 strcpy (a, a + 4);
6395 ...
6396 }
6397
6398 The -Wrestrict option detects some instances of simple overlap even
6399 without optimization but works best at -O2 and above. It is
6400 included in -Wall.
6401
6402 -Wnested-externs (C and Objective-C only)
6403 Warn if an "extern" declaration is encountered within a function.
6404
6405 -Winline
6406 Warn if a function that is declared as inline cannot be inlined.
6407 Even with this option, the compiler does not warn about failures to
6408 inline functions declared in system headers.
6409
6410 The compiler uses a variety of heuristics to determine whether or
6411 not to inline a function. For example, the compiler takes into
6412 account the size of the function being inlined and the amount of
6413 inlining that has already been done in the current function.
6414 Therefore, seemingly insignificant changes in the source program
6415 can cause the warnings produced by -Winline to appear or disappear.
6416
6417 -Wint-in-bool-context
6418 Warn for suspicious use of integer values where boolean values are
6419 expected, such as conditional expressions (?:) using non-boolean
6420 integer constants in boolean context, like "if (a <= b ? 2 : 3)".
6421 Or left shifting of signed integers in boolean context, like "for
6422 (a = 0; 1 << a; a++);". Likewise for all kinds of multiplications
6423 regardless of the data type. This warning is enabled by -Wall.
6424
6425 -Wno-int-to-pointer-cast
6426 Suppress warnings from casts to pointer type of an integer of a
6427 different size. In C++, casting to a pointer type of smaller size
6428 is an error. Wint-to-pointer-cast is enabled by default.
6429
6430 -Wno-pointer-to-int-cast (C and Objective-C only)
6431 Suppress warnings from casts from a pointer to an integer type of a
6432 different size.
6433
6434 -Winvalid-pch
6435 Warn if a precompiled header is found in the search path but cannot
6436 be used.
6437
6438 -Wlong-long
6439 Warn if "long long" type is used. This is enabled by either
6440 -Wpedantic or -Wtraditional in ISO C90 and C++98 modes. To inhibit
6441 the warning messages, use -Wno-long-long.
6442
6443 -Wvariadic-macros
6444 Warn if variadic macros are used in ISO C90 mode, or if the GNU
6445 alternate syntax is used in ISO C99 mode. This is enabled by
6446 either -Wpedantic or -Wtraditional. To inhibit the warning
6447 messages, use -Wno-variadic-macros.
6448
6449 -Wno-varargs
6450 Do not warn upon questionable usage of the macros used to handle
6451 variable arguments like "va_start". These warnings are enabled by
6452 default.
6453
6454 -Wvector-operation-performance
6455 Warn if vector operation is not implemented via SIMD capabilities
6456 of the architecture. Mainly useful for the performance tuning.
6457 Vector operation can be implemented "piecewise", which means that
6458 the scalar operation is performed on every vector element; "in
6459 parallel", which means that the vector operation is implemented
6460 using scalars of wider type, which normally is more performance
6461 efficient; and "as a single scalar", which means that vector fits
6462 into a scalar type.
6463
6464 -Wvla
6465 Warn if a variable-length array is used in the code. -Wno-vla
6466 prevents the -Wpedantic warning of the variable-length array.
6467
6468 -Wvla-larger-than=byte-size
6469 If this option is used, the compiler warns for declarations of
6470 variable-length arrays whose size is either unbounded, or bounded
6471 by an argument that allows the array size to exceed byte-size
6472 bytes. This is similar to how -Walloca-larger-than=byte-size
6473 works, but with variable-length arrays.
6474
6475 Note that GCC may optimize small variable-length arrays of a known
6476 value into plain arrays, so this warning may not get triggered for
6477 such arrays.
6478
6479 -Wvla-larger-than=PTRDIFF_MAX is enabled by default but is
6480 typically only effective when -ftree-vrp is active (default for -O2
6481 and above).
6482
6483 See also -Walloca-larger-than=byte-size.
6484
6485 -Wno-vla-larger-than
6486 Disable -Wvla-larger-than= warnings. The option is equivalent to
6487 -Wvla-larger-than=SIZE_MAX or larger.
6488
6489 -Wvolatile-register-var
6490 Warn if a register variable is declared volatile. The volatile
6491 modifier does not inhibit all optimizations that may eliminate
6492 reads and/or writes to register variables. This warning is enabled
6493 by -Wall.
6494
6495 -Wdisabled-optimization
6496 Warn if a requested optimization pass is disabled. This warning
6497 does not generally indicate that there is anything wrong with your
6498 code; it merely indicates that GCC's optimizers are unable to
6499 handle the code effectively. Often, the problem is that your code
6500 is too big or too complex; GCC refuses to optimize programs when
6501 the optimization itself is likely to take inordinate amounts of
6502 time.
6503
6504 -Wpointer-sign (C and Objective-C only)
6505 Warn for pointer argument passing or assignment with different
6506 signedness. This option is only supported for C and Objective-C.
6507 It is implied by -Wall and by -Wpedantic, which can be disabled
6508 with -Wno-pointer-sign.
6509
6510 -Wstack-protector
6511 This option is only active when -fstack-protector is active. It
6512 warns about functions that are not protected against stack
6513 smashing.
6514
6515 -Woverlength-strings
6516 Warn about string constants that are longer than the "minimum
6517 maximum" length specified in the C standard. Modern compilers
6518 generally allow string constants that are much longer than the
6519 standard's minimum limit, but very portable programs should avoid
6520 using longer strings.
6521
6522 The limit applies after string constant concatenation, and does not
6523 count the trailing NUL. In C90, the limit was 509 characters; in
6524 C99, it was raised to 4095. C++98 does not specify a normative
6525 minimum maximum, so we do not diagnose overlength strings in C++.
6526
6527 This option is implied by -Wpedantic, and can be disabled with
6528 -Wno-overlength-strings.
6529
6530 -Wunsuffixed-float-constants (C and Objective-C only)
6531 Issue a warning for any floating constant that does not have a
6532 suffix. When used together with -Wsystem-headers it warns about
6533 such constants in system header files. This can be useful when
6534 preparing code to use with the "FLOAT_CONST_DECIMAL64" pragma from
6535 the decimal floating-point extension to C99.
6536
6537 -Wno-lto-type-mismatch
6538 During the link-time optimization, do not warn about type
6539 mismatches in global declarations from different compilation units.
6540 Requires -flto to be enabled. Enabled by default.
6541
6542 -Wno-designated-init (C and Objective-C only)
6543 Suppress warnings when a positional initializer is used to
6544 initialize a structure that has been marked with the
6545 "designated_init" attribute.
6546
6547 -Wno-hsa
6548 Do not warn when HSAIL cannot be emitted for the compiled function
6549 or OpenMP construct. These warnings are enabled by default.
6550
6551 Options That Control Static Analysis
6552 -fanalyzer
6553 This option enables an static analysis of program flow which looks
6554 for "interesting" interprocedural paths through the code, and
6555 issues warnings for problems found on them.
6556
6557 This analysis is much more expensive than other GCC warnings.
6558
6559 Enabling this option effectively enables the following warnings:
6560
6561 -Wanalyzer-double-fclose -Wanalyzer-double-free
6562 -Wanalyzer-exposure-through-output-file -Wanalyzer-file-leak
6563 -Wanalyzer-free-of-non-heap -Wanalyzer-malloc-leak
6564 -Wanalyzer-possible-null-argument
6565 -Wanalyzer-possible-null-dereference -Wanalyzer-null-argument
6566 -Wanalyzer-null-dereference -Wanalyzer-stale-setjmp-buffer
6567 -Wanalyzer-tainted-array-index
6568 -Wanalyzer-unsafe-call-within-signal-handler
6569 -Wanalyzer-use-after-free
6570 -Wanalyzer-use-of-pointer-in-stale-stack-frame
6571
6572 This option is only available if GCC was configured with analyzer
6573 support enabled.
6574
6575 -Wanalyzer-too-complex
6576 If -fanalyzer is enabled, the analyzer uses various heuristics to
6577 attempt to explore the control flow and data flow in the program,
6578 but these can be defeated by sufficiently complicated code.
6579
6580 By default, the analysis silently stops if the code is too
6581 complicated for the analyzer to fully explore and it reaches an
6582 internal limit. The -Wanalyzer-too-complex option warns if this
6583 occurs.
6584
6585 -Wno-analyzer-double-fclose
6586 This warning requires -fanalyzer, which enables it; use
6587 -Wno-analyzer-double-fclose to disable it.
6588
6589 This diagnostic warns for paths through the code in which a "FILE
6590 *" can have "fclose" called on it more than once.
6591
6592 -Wno-analyzer-double-free
6593 This warning requires -fanalyzer, which enables it; use
6594 -Wno-analyzer-double-free to disable it.
6595
6596 This diagnostic warns for paths through the code in which a pointer
6597 can have "free" called on it more than once.
6598
6599 -Wno-analyzer-exposure-through-output-file
6600 This warning requires -fanalyzer, which enables it; use
6601 -Wno-analyzer-exposure-through-output-file to disable it.
6602
6603 This diagnostic warns for paths through the code in which a
6604 security-sensitive value is written to an output file (such as
6605 writing a password to a log file).
6606
6607 -Wno-analyzer-file-leak
6608 This warning requires -fanalyzer, which enables it; use
6609 -Wno-analyzer-file-leak to disable it.
6610
6611 This diagnostic warns for paths through the code in which a
6612 "<stdio.h>" "FILE *" stream object is leaked.
6613
6614 -Wno-analyzer-free-of-non-heap
6615 This warning requires -fanalyzer, which enables it; use
6616 -Wno-analyzer-free-of-non-heap to disable it.
6617
6618 This diagnostic warns for paths through the code in which "free" is
6619 called on a non-heap pointer (e.g. an on-stack buffer, or a
6620 global).
6621
6622 -Wno-analyzer-malloc-leak
6623 This warning requires -fanalyzer, which enables it; use
6624 -Wno-analyzer-malloc-leak to disable it.
6625
6626 This diagnostic warns for paths through the code in which a pointer
6627 allocated via "malloc" is leaked.
6628
6629 -Wno-analyzer-possible-null-argument
6630 This warning requires -fanalyzer, which enables it; use
6631 -Wno-analyzer-possible-null-argument to disable it.
6632
6633 This diagnostic warns for paths through the code in which a
6634 possibly-NULL value is passed to a function argument marked with
6635 "__attribute__((nonnull))" as requiring a non-NULL value.
6636
6637 -Wno-analyzer-possible-null-dereference
6638 This warning requires -fanalyzer, which enables it; use
6639 -Wno-analyzer-possible-null-dereference to disable it.
6640
6641 This diagnostic warns for paths through the code in which a
6642 possibly-NULL value is dereferenced.
6643
6644 -Wno-analyzer-null-argument
6645 This warning requires -fanalyzer, which enables it; use
6646 -Wno-analyzer-null-argument to disable it.
6647
6648 This diagnostic warns for paths through the code in which a value
6649 known to be NULL is passed to a function argument marked with
6650 "__attribute__((nonnull))" as requiring a non-NULL value.
6651
6652 -Wno-analyzer-null-dereference
6653 This warning requires -fanalyzer, which enables it; use
6654 -Wno-analyzer-null-dereference to disable it.
6655
6656 This diagnostic warns for paths through the code in which a value
6657 known to be NULL is dereferenced.
6658
6659 -Wno-analyzer-stale-setjmp-buffer
6660 This warning requires -fanalyzer, which enables it; use
6661 -Wno-analyzer-stale-setjmp-buffer to disable it.
6662
6663 This diagnostic warns for paths through the code in which "longjmp"
6664 is called to rewind to a "jmp_buf" relating to a "setjmp" call in a
6665 function that has returned.
6666
6667 When "setjmp" is called on a "jmp_buf" to record a rewind location,
6668 it records the stack frame. The stack frame becomes invalid when
6669 the function containing the "setjmp" call returns. Attempting to
6670 rewind to it via "longjmp" would reference a stack frame that no
6671 longer exists, and likely lead to a crash (or worse).
6672
6673 -Wno-analyzer-tainted-array-index
6674 This warning requires both -fanalyzer and -fanalyzer-checker=taint
6675 to enable it; use -Wno-analyzer-tainted-array-index to disable it.
6676
6677 This diagnostic warns for paths through the code in which a value
6678 that could be under an attacker's control is used as the index of
6679 an array access without being sanitized.
6680
6681 -Wno-analyzer-unsafe-call-within-signal-handler
6682 This warning requires -fanalyzer, which enables it; use
6683 -Wno-analyzer-unsafe-call-within-signal-handler to disable it.
6684
6685 This diagnostic warns for paths through the code in which a
6686 function known to be async-signal-unsafe (such as "fprintf") is
6687 called from a signal handler.
6688
6689 -Wno-analyzer-use-after-free
6690 This warning requires -fanalyzer, which enables it; use
6691 -Wno-analyzer-use-after-free to disable it.
6692
6693 This diagnostic warns for paths through the code in which a pointer
6694 is used after "free" is called on it.
6695
6696 -Wno-analyzer-use-of-pointer-in-stale-stack-frame
6697 This warning requires -fanalyzer, which enables it; use
6698 -Wno-analyzer-use-of-pointer-in-stale-stack-frame to disable it.
6699
6700 This diagnostic warns for paths through the code in which a pointer
6701 is dereferenced that points to a variable in a stale stack frame.
6702
6703 Pertinent parameters for controlling the exploration are: --param
6704 analyzer-bb-explosion-factor=value, --param
6705 analyzer-max-enodes-per-program-point=value, --param
6706 analyzer-max-recursion-depth=value, and --param
6707 analyzer-min-snodes-for-call-summary=value.
6708
6709 The following options control the analyzer.
6710
6711 -fanalyzer-call-summaries
6712 Simplify interprocedural analysis by computing the effect of
6713 certain calls, rather than exploring all paths through the function
6714 from callsite to each possible return.
6715
6716 If enabled, call summaries are only used for functions with more
6717 than one call site, and that are sufficiently complicated (as per
6718 --param analyzer-min-snodes-for-call-summary=value).
6719
6720 -fanalyzer-checker=name
6721 Restrict the analyzer to run just the named checker, and enable it.
6722
6723 Some checkers are disabled by default (even with -fanalyzer), such
6724 as the "taint" checker that implements
6725 -Wanalyzer-tainted-array-index, and this option is required to
6726 enable them.
6727
6728 -fanalyzer-fine-grained
6729 This option is intended for analyzer developers.
6730
6731 Internally the analyzer builds an "exploded graph" that combines
6732 control flow graphs with data flow information.
6733
6734 By default, an edge in this graph can contain the effects of a run
6735 of multiple statements within a basic block. With
6736 -fanalyzer-fine-grained, each statement gets its own edge.
6737
6738 -fanalyzer-show-duplicate-count
6739 This option is intended for analyzer developers: if multiple
6740 diagnostics have been detected as being duplicates of each other,
6741 it emits a note when reporting the best diagnostic, giving the
6742 number of additional diagnostics that were suppressed by the
6743 deduplication logic.
6744
6745 -fno-analyzer-state-merge
6746 This option is intended for analyzer developers.
6747
6748 By default the analyzer attempts to simplify analysis by merging
6749 sufficiently similar states at each program point as it builds its
6750 "exploded graph". With -fno-analyzer-state-merge this merging can
6751 be suppressed, for debugging state-handling issues.
6752
6753 -fno-analyzer-state-purge
6754 This option is intended for analyzer developers.
6755
6756 By default the analyzer attempts to simplify analysis by purging
6757 aspects of state at a program point that appear to no longer be
6758 relevant e.g. the values of locals that aren't accessed later in
6759 the function and which aren't relevant to leak analysis.
6760
6761 With -fno-analyzer-state-purge this purging of state can be
6762 suppressed, for debugging state-handling issues.
6763
6764 -fanalyzer-transitivity
6765 This option enables transitivity of constraints within the
6766 analyzer.
6767
6768 -fanalyzer-verbose-edges
6769 This option is intended for analyzer developers. It enables more
6770 verbose, lower-level detail in the descriptions of control flow
6771 within diagnostic paths.
6772
6773 -fanalyzer-verbose-state-changes
6774 This option is intended for analyzer developers. It enables more
6775 verbose, lower-level detail in the descriptions of events relating
6776 to state machines within diagnostic paths.
6777
6778 -fanalyzer-verbosity=level
6779 This option controls the complexity of the control flow paths that
6780 are emitted for analyzer diagnostics.
6781
6782 The level can be one of:
6783
6784 0 At this level, interprocedural call and return events are
6785 displayed, along with the most pertinent state-change events
6786 relating to a diagnostic. For example, for a double-"free"
6787 diagnostic, both calls to "free" will be shown.
6788
6789 1 As per the previous level, but also show events for the entry
6790 to each function.
6791
6792 2 As per the previous level, but also show events relating to
6793 control flow that are significant to triggering the issue (e.g.
6794 "true path taken" at a conditional).
6795
6796 This level is the default.
6797
6798 3 As per the previous level, but show all control flow events,
6799 not just significant ones.
6800
6801 4 This level is intended for analyzer developers; it adds various
6802 other events intended for debugging the analyzer.
6803
6804 -fdump-analyzer
6805 Dump internal details about what the analyzer is doing to
6806 file.analyzer.txt. This option is overridden by
6807 -fdump-analyzer-stderr.
6808
6809 -fdump-analyzer-stderr
6810 Dump internal details about what the analyzer is doing to stderr.
6811 This option overrides -fdump-analyzer.
6812
6813 -fdump-analyzer-callgraph
6814 Dump a representation of the call graph suitable for viewing with
6815 GraphViz to file.callgraph.dot.
6816
6817 -fdump-analyzer-exploded-graph
6818 Dump a representation of the "exploded graph" suitable for viewing
6819 with GraphViz to file.eg.dot. Nodes are color-coded based on
6820 state-machine states to emphasize state changes.
6821
6822 -fdump-analyzer-exploded-nodes
6823 Emit diagnostics showing where nodes in the "exploded graph" are in
6824 relation to the program source.
6825
6826 -fdump-analyzer-exploded-nodes-2
6827 Dump a textual representation of the "exploded graph" to
6828 file.eg.txt.
6829
6830 -fdump-analyzer-exploded-nodes-3
6831 Dump a textual representation of the "exploded graph" to one dump
6832 file per node, to file.eg-id.txt. This is typically a large number
6833 of dump files.
6834
6835 -fdump-analyzer-state-purge
6836 As per -fdump-analyzer-supergraph, dump a representation of the
6837 "supergraph" suitable for viewing with GraphViz, but annotate the
6838 graph with information on what state will be purged at each node.
6839 The graph is written to file.state-purge.dot.
6840
6841 -fdump-analyzer-supergraph
6842 Dump representations of the "supergraph" suitable for viewing with
6843 GraphViz to file.supergraph.dot and to file.supergraph-eg.dot.
6844 These show all of the control flow graphs in the program, with
6845 interprocedural edges for calls and returns. The second dump
6846 contains annotations showing nodes in the "exploded graph" and
6847 diagnostics associated with them.
6848
6849 Options for Debugging Your Program
6850 To tell GCC to emit extra information for use by a debugger, in almost
6851 all cases you need only to add -g to your other options.
6852
6853 GCC allows you to use -g with -O. The shortcuts taken by optimized
6854 code may occasionally be surprising: some variables you declared may
6855 not exist at all; flow of control may briefly move where you did not
6856 expect it; some statements may not be executed because they compute
6857 constant results or their values are already at hand; some statements
6858 may execute in different places because they have been moved out of
6859 loops. Nevertheless it is possible to debug optimized output. This
6860 makes it reasonable to use the optimizer for programs that might have
6861 bugs.
6862
6863 If you are not using some other optimization option, consider using -Og
6864 with -g. With no -O option at all, some compiler passes that collect
6865 information useful for debugging do not run at all, so that -Og may
6866 result in a better debugging experience.
6867
6868 -g Produce debugging information in the operating system's native
6869 format (stabs, COFF, XCOFF, or DWARF). GDB can work with this
6870 debugging information.
6871
6872 On most systems that use stabs format, -g enables use of extra
6873 debugging information that only GDB can use; this extra information
6874 makes debugging work better in GDB but probably makes other
6875 debuggers crash or refuse to read the program. If you want to
6876 control for certain whether to generate the extra information, use
6877 -gstabs+, -gstabs, -gxcoff+, -gxcoff, or -gvms (see below).
6878
6879 -ggdb
6880 Produce debugging information for use by GDB. This means to use
6881 the most expressive format available (DWARF, stabs, or the native
6882 format if neither of those are supported), including GDB extensions
6883 if at all possible.
6884
6885 -gdwarf
6886 -gdwarf-version
6887 Produce debugging information in DWARF format (if that is
6888 supported). The value of version may be either 2, 3, 4 or 5; the
6889 default version for most targets is 4. DWARF Version 5 is only
6890 experimental.
6891
6892 Note that with DWARF Version 2, some ports require and always use
6893 some non-conflicting DWARF 3 extensions in the unwind tables.
6894
6895 Version 4 may require GDB 7.0 and -fvar-tracking-assignments for
6896 maximum benefit.
6897
6898 GCC no longer supports DWARF Version 1, which is substantially
6899 different than Version 2 and later. For historical reasons, some
6900 other DWARF-related options such as -fno-dwarf2-cfi-asm) retain a
6901 reference to DWARF Version 2 in their names, but apply to all
6902 currently-supported versions of DWARF.
6903
6904 -gstabs
6905 Produce debugging information in stabs format (if that is
6906 supported), without GDB extensions. This is the format used by DBX
6907 on most BSD systems. On MIPS, Alpha and System V Release 4 systems
6908 this option produces stabs debugging output that is not understood
6909 by DBX. On System V Release 4 systems this option requires the GNU
6910 assembler.
6911
6912 -gstabs+
6913 Produce debugging information in stabs format (if that is
6914 supported), using GNU extensions understood only by the GNU
6915 debugger (GDB). The use of these extensions is likely to make
6916 other debuggers crash or refuse to read the program.
6917
6918 -gxcoff
6919 Produce debugging information in XCOFF format (if that is
6920 supported). This is the format used by the DBX debugger on IBM
6921 RS/6000 systems.
6922
6923 -gxcoff+
6924 Produce debugging information in XCOFF format (if that is
6925 supported), using GNU extensions understood only by the GNU
6926 debugger (GDB). The use of these extensions is likely to make
6927 other debuggers crash or refuse to read the program, and may cause
6928 assemblers other than the GNU assembler (GAS) to fail with an
6929 error.
6930
6931 -gvms
6932 Produce debugging information in Alpha/VMS debug format (if that is
6933 supported). This is the format used by DEBUG on Alpha/VMS systems.
6934
6935 -glevel
6936 -ggdblevel
6937 -gstabslevel
6938 -gxcofflevel
6939 -gvmslevel
6940 Request debugging information and also use level to specify how
6941 much information. The default level is 2.
6942
6943 Level 0 produces no debug information at all. Thus, -g0 negates
6944 -g.
6945
6946 Level 1 produces minimal information, enough for making backtraces
6947 in parts of the program that you don't plan to debug. This
6948 includes descriptions of functions and external variables, and line
6949 number tables, but no information about local variables.
6950
6951 Level 3 includes extra information, such as all the macro
6952 definitions present in the program. Some debuggers support macro
6953 expansion when you use -g3.
6954
6955 If you use multiple -g options, with or without level numbers, the
6956 last such option is the one that is effective.
6957
6958 -gdwarf does not accept a concatenated debug level, to avoid
6959 confusion with -gdwarf-level. Instead use an additional -glevel
6960 option to change the debug level for DWARF.
6961
6962 -fno-eliminate-unused-debug-symbols
6963 By default, no debug information is produced for symbols that are
6964 not actually used. Use this option if you want debug information
6965 for all symbols.
6966
6967 -femit-class-debug-always
6968 Instead of emitting debugging information for a C++ class in only
6969 one object file, emit it in all object files using the class. This
6970 option should be used only with debuggers that are unable to handle
6971 the way GCC normally emits debugging information for classes
6972 because using this option increases the size of debugging
6973 information by as much as a factor of two.
6974
6975 -fno-merge-debug-strings
6976 Direct the linker to not merge together strings in the debugging
6977 information that are identical in different object files. Merging
6978 is not supported by all assemblers or linkers. Merging decreases
6979 the size of the debug information in the output file at the cost of
6980 increasing link processing time. Merging is enabled by default.
6981
6982 -fdebug-prefix-map=old=new
6983 When compiling files residing in directory old, record debugging
6984 information describing them as if the files resided in directory
6985 new instead. This can be used to replace a build-time path with an
6986 install-time path in the debug info. It can also be used to change
6987 an absolute path to a relative path by using . for new. This can
6988 give more reproducible builds, which are location independent, but
6989 may require an extra command to tell GDB where to find the source
6990 files. See also -ffile-prefix-map.
6991
6992 -fvar-tracking
6993 Run variable tracking pass. It computes where variables are stored
6994 at each position in code. Better debugging information is then
6995 generated (if the debugging information format supports this
6996 information).
6997
6998 It is enabled by default when compiling with optimization (-Os, -O,
6999 -O2, ...), debugging information (-g) and the debug info format
7000 supports it.
7001
7002 -fvar-tracking-assignments
7003 Annotate assignments to user variables early in the compilation and
7004 attempt to carry the annotations over throughout the compilation
7005 all the way to the end, in an attempt to improve debug information
7006 while optimizing. Use of -gdwarf-4 is recommended along with it.
7007
7008 It can be enabled even if var-tracking is disabled, in which case
7009 annotations are created and maintained, but discarded at the end.
7010 By default, this flag is enabled together with -fvar-tracking,
7011 except when selective scheduling is enabled.
7012
7013 -gsplit-dwarf
7014 Separate as much DWARF debugging information as possible into a
7015 separate output file with the extension .dwo. This option allows
7016 the build system to avoid linking files with debug information. To
7017 be useful, this option requires a debugger capable of reading .dwo
7018 files.
7019
7020 -gdescribe-dies
7021 Add description attributes to some DWARF DIEs that have no name
7022 attribute, such as artificial variables, external references and
7023 call site parameter DIEs.
7024
7025 -gpubnames
7026 Generate DWARF ".debug_pubnames" and ".debug_pubtypes" sections.
7027
7028 -ggnu-pubnames
7029 Generate ".debug_pubnames" and ".debug_pubtypes" sections in a
7030 format suitable for conversion into a GDB index. This option is
7031 only useful with a linker that can produce GDB index version 7.
7032
7033 -fdebug-types-section
7034 When using DWARF Version 4 or higher, type DIEs can be put into
7035 their own ".debug_types" section instead of making them part of the
7036 ".debug_info" section. It is more efficient to put them in a
7037 separate comdat section since the linker can then remove
7038 duplicates. But not all DWARF consumers support ".debug_types"
7039 sections yet and on some objects ".debug_types" produces larger
7040 instead of smaller debugging information.
7041
7042 -grecord-gcc-switches
7043 -gno-record-gcc-switches
7044 This switch causes the command-line options used to invoke the
7045 compiler that may affect code generation to be appended to the
7046 DW_AT_producer attribute in DWARF debugging information. The
7047 options are concatenated with spaces separating them from each
7048 other and from the compiler version. It is enabled by default.
7049 See also -frecord-gcc-switches for another way of storing compiler
7050 options into the object file.
7051
7052 -gstrict-dwarf
7053 Disallow using extensions of later DWARF standard version than
7054 selected with -gdwarf-version. On most targets using non-
7055 conflicting DWARF extensions from later standard versions is
7056 allowed.
7057
7058 -gno-strict-dwarf
7059 Allow using extensions of later DWARF standard version than
7060 selected with -gdwarf-version.
7061
7062 -gas-loc-support
7063 Inform the compiler that the assembler supports ".loc" directives.
7064 It may then use them for the assembler to generate DWARF2+ line
7065 number tables.
7066
7067 This is generally desirable, because assembler-generated line-
7068 number tables are a lot more compact than those the compiler can
7069 generate itself.
7070
7071 This option will be enabled by default if, at GCC configure time,
7072 the assembler was found to support such directives.
7073
7074 -gno-as-loc-support
7075 Force GCC to generate DWARF2+ line number tables internally, if
7076 DWARF2+ line number tables are to be generated.
7077
7078 -gas-locview-support
7079 Inform the compiler that the assembler supports "view" assignment
7080 and reset assertion checking in ".loc" directives.
7081
7082 This option will be enabled by default if, at GCC configure time,
7083 the assembler was found to support them.
7084
7085 -gno-as-locview-support
7086 Force GCC to assign view numbers internally, if
7087 -gvariable-location-views are explicitly requested.
7088
7089 -gcolumn-info
7090 -gno-column-info
7091 Emit location column information into DWARF debugging information,
7092 rather than just file and line. This option is enabled by default.
7093
7094 -gstatement-frontiers
7095 -gno-statement-frontiers
7096 This option causes GCC to create markers in the internal
7097 representation at the beginning of statements, and to keep them
7098 roughly in place throughout compilation, using them to guide the
7099 output of "is_stmt" markers in the line number table. This is
7100 enabled by default when compiling with optimization (-Os, -O, -O2,
7101 ...), and outputting DWARF 2 debug information at the normal level.
7102
7103 -gvariable-location-views
7104 -gvariable-location-views=incompat5
7105 -gno-variable-location-views
7106 Augment variable location lists with progressive view numbers
7107 implied from the line number table. This enables debug information
7108 consumers to inspect state at certain points of the program, even
7109 if no instructions associated with the corresponding source
7110 locations are present at that point. If the assembler lacks
7111 support for view numbers in line number tables, this will cause the
7112 compiler to emit the line number table, which generally makes them
7113 somewhat less compact. The augmented line number tables and
7114 location lists are fully backward-compatible, so they can be
7115 consumed by debug information consumers that are not aware of these
7116 augmentations, but they won't derive any benefit from them either.
7117
7118 This is enabled by default when outputting DWARF 2 debug
7119 information at the normal level, as long as there is assembler
7120 support, -fvar-tracking-assignments is enabled and -gstrict-dwarf
7121 is not. When assembler support is not available, this may still be
7122 enabled, but it will force GCC to output internal line number
7123 tables, and if -ginternal-reset-location-views is not enabled, that
7124 will most certainly lead to silently mismatching location views.
7125
7126 There is a proposed representation for view numbers that is not
7127 backward compatible with the location list format introduced in
7128 DWARF 5, that can be enabled with
7129 -gvariable-location-views=incompat5. This option may be removed in
7130 the future, is only provided as a reference implementation of the
7131 proposed representation. Debug information consumers are not
7132 expected to support this extended format, and they would be
7133 rendered unable to decode location lists using it.
7134
7135 -ginternal-reset-location-views
7136 -gno-internal-reset-location-views
7137 Attempt to determine location views that can be omitted from
7138 location view lists. This requires the compiler to have very
7139 accurate insn length estimates, which isn't always the case, and it
7140 may cause incorrect view lists to be generated silently when using
7141 an assembler that does not support location view lists. The GNU
7142 assembler will flag any such error as a "view number mismatch".
7143 This is only enabled on ports that define a reliable estimation
7144 function.
7145
7146 -ginline-points
7147 -gno-inline-points
7148 Generate extended debug information for inlined functions.
7149 Location view tracking markers are inserted at inlined entry
7150 points, so that address and view numbers can be computed and output
7151 in debug information. This can be enabled independently of
7152 location views, in which case the view numbers won't be output, but
7153 it can only be enabled along with statement frontiers, and it is
7154 only enabled by default if location views are enabled.
7155
7156 -gz[=type]
7157 Produce compressed debug sections in DWARF format, if that is
7158 supported. If type is not given, the default type depends on the
7159 capabilities of the assembler and linker used. type may be one of
7160 none (don't compress debug sections), zlib (use zlib compression in
7161 ELF gABI format), or zlib-gnu (use zlib compression in traditional
7162 GNU format). If the linker doesn't support writing compressed
7163 debug sections, the option is rejected. Otherwise, if the
7164 assembler does not support them, -gz is silently ignored when
7165 producing object files.
7166
7167 -femit-struct-debug-baseonly
7168 Emit debug information for struct-like types only when the base
7169 name of the compilation source file matches the base name of file
7170 in which the struct is defined.
7171
7172 This option substantially reduces the size of debugging
7173 information, but at significant potential loss in type information
7174 to the debugger. See -femit-struct-debug-reduced for a less
7175 aggressive option. See -femit-struct-debug-detailed for more
7176 detailed control.
7177
7178 This option works only with DWARF debug output.
7179
7180 -femit-struct-debug-reduced
7181 Emit debug information for struct-like types only when the base
7182 name of the compilation source file matches the base name of file
7183 in which the type is defined, unless the struct is a template or
7184 defined in a system header.
7185
7186 This option significantly reduces the size of debugging
7187 information, with some potential loss in type information to the
7188 debugger. See -femit-struct-debug-baseonly for a more aggressive
7189 option. See -femit-struct-debug-detailed for more detailed
7190 control.
7191
7192 This option works only with DWARF debug output.
7193
7194 -femit-struct-debug-detailed[=spec-list]
7195 Specify the struct-like types for which the compiler generates
7196 debug information. The intent is to reduce duplicate struct debug
7197 information between different object files within the same program.
7198
7199 This option is a detailed version of -femit-struct-debug-reduced
7200 and -femit-struct-debug-baseonly, which serves for most needs.
7201
7202 A specification has the
7203 syntax[dir:|ind:][ord:|gen:](any|sys|base|none)
7204
7205 The optional first word limits the specification to structs that
7206 are used directly (dir:) or used indirectly (ind:). A struct type
7207 is used directly when it is the type of a variable, member.
7208 Indirect uses arise through pointers to structs. That is, when use
7209 of an incomplete struct is valid, the use is indirect. An example
7210 is struct one direct; struct two * indirect;.
7211
7212 The optional second word limits the specification to ordinary
7213 structs (ord:) or generic structs (gen:). Generic structs are a
7214 bit complicated to explain. For C++, these are non-explicit
7215 specializations of template classes, or non-template classes within
7216 the above. Other programming languages have generics, but
7217 -femit-struct-debug-detailed does not yet implement them.
7218
7219 The third word specifies the source files for those structs for
7220 which the compiler should emit debug information. The values none
7221 and any have the normal meaning. The value base means that the
7222 base of name of the file in which the type declaration appears must
7223 match the base of the name of the main compilation file. In
7224 practice, this means that when compiling foo.c, debug information
7225 is generated for types declared in that file and foo.h, but not
7226 other header files. The value sys means those types satisfying
7227 base or declared in system or compiler headers.
7228
7229 You may need to experiment to determine the best settings for your
7230 application.
7231
7232 The default is -femit-struct-debug-detailed=all.
7233
7234 This option works only with DWARF debug output.
7235
7236 -fno-dwarf2-cfi-asm
7237 Emit DWARF unwind info as compiler generated ".eh_frame" section
7238 instead of using GAS ".cfi_*" directives.
7239
7240 -fno-eliminate-unused-debug-types
7241 Normally, when producing DWARF output, GCC avoids producing debug
7242 symbol output for types that are nowhere used in the source file
7243 being compiled. Sometimes it is useful to have GCC emit debugging
7244 information for all types declared in a compilation unit,
7245 regardless of whether or not they are actually used in that
7246 compilation unit, for example if, in the debugger, you want to cast
7247 a value to a type that is not actually used in your program (but is
7248 declared). More often, however, this results in a significant
7249 amount of wasted space.
7250
7251 Options That Control Optimization
7252 These options control various sorts of optimizations.
7253
7254 Without any optimization option, the compiler's goal is to reduce the
7255 cost of compilation and to make debugging produce the expected results.
7256 Statements are independent: if you stop the program with a breakpoint
7257 between statements, you can then assign a new value to any variable or
7258 change the program counter to any other statement in the function and
7259 get exactly the results you expect from the source code.
7260
7261 Turning on optimization flags makes the compiler attempt to improve the
7262 performance and/or code size at the expense of compilation time and
7263 possibly the ability to debug the program.
7264
7265 The compiler performs optimization based on the knowledge it has of the
7266 program. Compiling multiple files at once to a single output file mode
7267 allows the compiler to use information gained from all of the files
7268 when compiling each of them.
7269
7270 Not all optimizations are controlled directly by a flag. Only
7271 optimizations that have a flag are listed in this section.
7272
7273 Most optimizations are completely disabled at -O0 or if an -O level is
7274 not set on the command line, even if individual optimization flags are
7275 specified. Similarly, -Og suppresses many optimization passes.
7276
7277 Depending on the target and how GCC was configured, a slightly
7278 different set of optimizations may be enabled at each -O level than
7279 those listed here. You can invoke GCC with -Q --help=optimizers to
7280 find out the exact set of optimizations that are enabled at each level.
7281
7282 -O
7283 -O1 Optimize. Optimizing compilation takes somewhat more time, and a
7284 lot more memory for a large function.
7285
7286 With -O, the compiler tries to reduce code size and execution time,
7287 without performing any optimizations that take a great deal of
7288 compilation time.
7289
7290 -O turns on the following optimization flags:
7291
7292 -fauto-inc-dec -fbranch-count-reg -fcombine-stack-adjustments
7293 -fcompare-elim -fcprop-registers -fdce -fdefer-pop -fdelayed-branch
7294 -fdse -fforward-propagate -fguess-branch-probability
7295 -fif-conversion -fif-conversion2 -finline-functions-called-once
7296 -fipa-profile -fipa-pure-const -fipa-reference
7297 -fipa-reference-addressable -fmerge-constants
7298 -fmove-loop-invariants -fomit-frame-pointer -freorder-blocks
7299 -fshrink-wrap -fshrink-wrap-separate -fsplit-wide-types
7300 -fssa-backprop -fssa-phiopt -ftree-bit-ccp -ftree-ccp -ftree-ch
7301 -ftree-coalesce-vars -ftree-copy-prop -ftree-dce
7302 -ftree-dominator-opts -ftree-dse -ftree-forwprop -ftree-fre
7303 -ftree-phiprop -ftree-pta -ftree-scev-cprop -ftree-sink -ftree-slsr
7304 -ftree-sra -ftree-ter -funit-at-a-time
7305
7306 -O2 Optimize even more. GCC performs nearly all supported
7307 optimizations that do not involve a space-speed tradeoff. As
7308 compared to -O, this option increases both compilation time and the
7309 performance of the generated code.
7310
7311 -O2 turns on all optimization flags specified by -O. It also turns
7312 on the following optimization flags:
7313
7314 -falign-functions -falign-jumps -falign-labels -falign-loops
7315 -fcaller-saves -fcode-hoisting -fcrossjumping -fcse-follow-jumps
7316 -fcse-skip-blocks -fdelete-null-pointer-checks -fdevirtualize
7317 -fdevirtualize-speculatively -fexpensive-optimizations
7318 -ffinite-loops -fgcse -fgcse-lm -fhoist-adjacent-loads
7319 -finline-functions -finline-small-functions -findirect-inlining
7320 -fipa-bit-cp -fipa-cp -fipa-icf -fipa-ra -fipa-sra -fipa-vrp
7321 -fisolate-erroneous-paths-dereference -flra-remat
7322 -foptimize-sibling-calls -foptimize-strlen -fpartial-inlining
7323 -fpeephole2 -freorder-blocks-algorithm=stc
7324 -freorder-blocks-and-partition -freorder-functions
7325 -frerun-cse-after-loop -fschedule-insns -fschedule-insns2
7326 -fsched-interblock -fsched-spec -fstore-merging -fstrict-aliasing
7327 -fthread-jumps -ftree-builtin-call-dce -ftree-pre
7328 -ftree-switch-conversion -ftree-tail-merge -ftree-vrp
7329
7330 Please note the warning under -fgcse about invoking -O2 on programs
7331 that use computed gotos.
7332
7333 -O3 Optimize yet more. -O3 turns on all optimizations specified by -O2
7334 and also turns on the following optimization flags:
7335
7336 -fgcse-after-reload -fipa-cp-clone -floop-interchange
7337 -floop-unroll-and-jam -fpeel-loops -fpredictive-commoning
7338 -fsplit-loops -fsplit-paths -ftree-loop-distribution
7339 -ftree-loop-vectorize -ftree-partial-pre -ftree-slp-vectorize
7340 -funswitch-loops -fvect-cost-model -fvect-cost-model=dynamic
7341 -fversion-loops-for-strides
7342
7343 -O0 Reduce compilation time and make debugging produce the expected
7344 results. This is the default.
7345
7346 -Os Optimize for size. -Os enables all -O2 optimizations except those
7347 that often increase code size:
7348
7349 -falign-functions -falign-jumps -falign-labels -falign-loops
7350 -fprefetch-loop-arrays -freorder-blocks-algorithm=stc
7351
7352 It also enables -finline-functions, causes the compiler to tune for
7353 code size rather than execution speed, and performs further
7354 optimizations designed to reduce code size.
7355
7356 -Ofast
7357 Disregard strict standards compliance. -Ofast enables all -O3
7358 optimizations. It also enables optimizations that are not valid
7359 for all standard-compliant programs. It turns on -ffast-math,
7360 -fallow-store-data-races and the Fortran-specific -fstack-arrays,
7361 unless -fmax-stack-var-size is specified, and -fno-protect-parens.
7362
7363 -Og Optimize debugging experience. -Og should be the optimization
7364 level of choice for the standard edit-compile-debug cycle, offering
7365 a reasonable level of optimization while maintaining fast
7366 compilation and a good debugging experience. It is a better choice
7367 than -O0 for producing debuggable code because some compiler passes
7368 that collect debug information are disabled at -O0.
7369
7370 Like -O0, -Og completely disables a number of optimization passes
7371 so that individual options controlling them have no effect.
7372 Otherwise -Og enables all -O1 optimization flags except for those
7373 that may interfere with debugging:
7374
7375 -fbranch-count-reg -fdelayed-branch -fdse -fif-conversion
7376 -fif-conversion2 -finline-functions-called-once
7377 -fmove-loop-invariants -fssa-phiopt -ftree-bit-ccp -ftree-dse
7378 -ftree-pta -ftree-sra
7379
7380 If you use multiple -O options, with or without level numbers, the last
7381 such option is the one that is effective.
7382
7383 Options of the form -fflag specify machine-independent flags. Most
7384 flags have both positive and negative forms; the negative form of -ffoo
7385 is -fno-foo. In the table below, only one of the forms is listed---the
7386 one you typically use. You can figure out the other form by either
7387 removing no- or adding it.
7388
7389 The following options control specific optimizations. They are either
7390 activated by -O options or are related to ones that are. You can use
7391 the following flags in the rare cases when "fine-tuning" of
7392 optimizations to be performed is desired.
7393
7394 -fno-defer-pop
7395 For machines that must pop arguments after a function call, always
7396 pop the arguments as soon as each function returns. At levels -O1
7397 and higher, -fdefer-pop is the default; this allows the compiler to
7398 let arguments accumulate on the stack for several function calls
7399 and pop them all at once.
7400
7401 -fforward-propagate
7402 Perform a forward propagation pass on RTL. The pass tries to
7403 combine two instructions and checks if the result can be
7404 simplified. If loop unrolling is active, two passes are performed
7405 and the second is scheduled after loop unrolling.
7406
7407 This option is enabled by default at optimization levels -O, -O2,
7408 -O3, -Os.
7409
7410 -ffp-contract=style
7411 -ffp-contract=off disables floating-point expression contraction.
7412 -ffp-contract=fast enables floating-point expression contraction
7413 such as forming of fused multiply-add operations if the target has
7414 native support for them. -ffp-contract=on enables floating-point
7415 expression contraction if allowed by the language standard. This
7416 is currently not implemented and treated equal to
7417 -ffp-contract=off.
7418
7419 The default is -ffp-contract=fast.
7420
7421 -fomit-frame-pointer
7422 Omit the frame pointer in functions that don't need one. This
7423 avoids the instructions to save, set up and restore the frame
7424 pointer; on many targets it also makes an extra register available.
7425
7426 On some targets this flag has no effect because the standard
7427 calling sequence always uses a frame pointer, so it cannot be
7428 omitted.
7429
7430 Note that -fno-omit-frame-pointer doesn't guarantee the frame
7431 pointer is used in all functions. Several targets always omit the
7432 frame pointer in leaf functions.
7433
7434 Enabled by default at -O and higher.
7435
7436 -foptimize-sibling-calls
7437 Optimize sibling and tail recursive calls.
7438
7439 Enabled at levels -O2, -O3, -Os.
7440
7441 -foptimize-strlen
7442 Optimize various standard C string functions (e.g. "strlen",
7443 "strchr" or "strcpy") and their "_FORTIFY_SOURCE" counterparts into
7444 faster alternatives.
7445
7446 Enabled at levels -O2, -O3.
7447
7448 -fno-inline
7449 Do not expand any functions inline apart from those marked with the
7450 "always_inline" attribute. This is the default when not
7451 optimizing.
7452
7453 Single functions can be exempted from inlining by marking them with
7454 the "noinline" attribute.
7455
7456 -finline-small-functions
7457 Integrate functions into their callers when their body is smaller
7458 than expected function call code (so overall size of program gets
7459 smaller). The compiler heuristically decides which functions are
7460 simple enough to be worth integrating in this way. This inlining
7461 applies to all functions, even those not declared inline.
7462
7463 Enabled at levels -O2, -O3, -Os.
7464
7465 -findirect-inlining
7466 Inline also indirect calls that are discovered to be known at
7467 compile time thanks to previous inlining. This option has any
7468 effect only when inlining itself is turned on by the
7469 -finline-functions or -finline-small-functions options.
7470
7471 Enabled at levels -O2, -O3, -Os.
7472
7473 -finline-functions
7474 Consider all functions for inlining, even if they are not declared
7475 inline. The compiler heuristically decides which functions are
7476 worth integrating in this way.
7477
7478 If all calls to a given function are integrated, and the function
7479 is declared "static", then the function is normally not output as
7480 assembler code in its own right.
7481
7482 Enabled at levels -O2, -O3, -Os. Also enabled by -fprofile-use and
7483 -fauto-profile.
7484
7485 -finline-functions-called-once
7486 Consider all "static" functions called once for inlining into their
7487 caller even if they are not marked "inline". If a call to a given
7488 function is integrated, then the function is not output as
7489 assembler code in its own right.
7490
7491 Enabled at levels -O1, -O2, -O3 and -Os, but not -Og.
7492
7493 -fearly-inlining
7494 Inline functions marked by "always_inline" and functions whose body
7495 seems smaller than the function call overhead early before doing
7496 -fprofile-generate instrumentation and real inlining pass. Doing
7497 so makes profiling significantly cheaper and usually inlining
7498 faster on programs having large chains of nested wrapper functions.
7499
7500 Enabled by default.
7501
7502 -fipa-sra
7503 Perform interprocedural scalar replacement of aggregates, removal
7504 of unused parameters and replacement of parameters passed by
7505 reference by parameters passed by value.
7506
7507 Enabled at levels -O2, -O3 and -Os.
7508
7509 -finline-limit=n
7510 By default, GCC limits the size of functions that can be inlined.
7511 This flag allows coarse control of this limit. n is the size of
7512 functions that can be inlined in number of pseudo instructions.
7513
7514 Inlining is actually controlled by a number of parameters, which
7515 may be specified individually by using --param name=value. The
7516 -finline-limit=n option sets some of these parameters as follows:
7517
7518 max-inline-insns-single
7519 is set to n/2.
7520
7521 max-inline-insns-auto
7522 is set to n/2.
7523
7524 See below for a documentation of the individual parameters
7525 controlling inlining and for the defaults of these parameters.
7526
7527 Note: there may be no value to -finline-limit that results in
7528 default behavior.
7529
7530 Note: pseudo instruction represents, in this particular context, an
7531 abstract measurement of function's size. In no way does it
7532 represent a count of assembly instructions and as such its exact
7533 meaning might change from one release to an another.
7534
7535 -fno-keep-inline-dllexport
7536 This is a more fine-grained version of -fkeep-inline-functions,
7537 which applies only to functions that are declared using the
7538 "dllexport" attribute or declspec.
7539
7540 -fkeep-inline-functions
7541 In C, emit "static" functions that are declared "inline" into the
7542 object file, even if the function has been inlined into all of its
7543 callers. This switch does not affect functions using the "extern
7544 inline" extension in GNU C90. In C++, emit any and all inline
7545 functions into the object file.
7546
7547 -fkeep-static-functions
7548 Emit "static" functions into the object file, even if the function
7549 is never used.
7550
7551 -fkeep-static-consts
7552 Emit variables declared "static const" when optimization isn't
7553 turned on, even if the variables aren't referenced.
7554
7555 GCC enables this option by default. If you want to force the
7556 compiler to check if a variable is referenced, regardless of
7557 whether or not optimization is turned on, use the
7558 -fno-keep-static-consts option.
7559
7560 -fmerge-constants
7561 Attempt to merge identical constants (string constants and
7562 floating-point constants) across compilation units.
7563
7564 This option is the default for optimized compilation if the
7565 assembler and linker support it. Use -fno-merge-constants to
7566 inhibit this behavior.
7567
7568 Enabled at levels -O, -O2, -O3, -Os.
7569
7570 -fmerge-all-constants
7571 Attempt to merge identical constants and identical variables.
7572
7573 This option implies -fmerge-constants. In addition to
7574 -fmerge-constants this considers e.g. even constant initialized
7575 arrays or initialized constant variables with integral or floating-
7576 point types. Languages like C or C++ require each variable,
7577 including multiple instances of the same variable in recursive
7578 calls, to have distinct locations, so using this option results in
7579 non-conforming behavior.
7580
7581 -fmodulo-sched
7582 Perform swing modulo scheduling immediately before the first
7583 scheduling pass. This pass looks at innermost loops and reorders
7584 their instructions by overlapping different iterations.
7585
7586 -fmodulo-sched-allow-regmoves
7587 Perform more aggressive SMS-based modulo scheduling with register
7588 moves allowed. By setting this flag certain anti-dependences edges
7589 are deleted, which triggers the generation of reg-moves based on
7590 the life-range analysis. This option is effective only with
7591 -fmodulo-sched enabled.
7592
7593 -fno-branch-count-reg
7594 Disable the optimization pass that scans for opportunities to use
7595 "decrement and branch" instructions on a count register instead of
7596 instruction sequences that decrement a register, compare it against
7597 zero, and then branch based upon the result. This option is only
7598 meaningful on architectures that support such instructions, which
7599 include x86, PowerPC, IA-64 and S/390. Note that the
7600 -fno-branch-count-reg option doesn't remove the decrement and
7601 branch instructions from the generated instruction stream
7602 introduced by other optimization passes.
7603
7604 The default is -fbranch-count-reg at -O1 and higher, except for
7605 -Og.
7606
7607 -fno-function-cse
7608 Do not put function addresses in registers; make each instruction
7609 that calls a constant function contain the function's address
7610 explicitly.
7611
7612 This option results in less efficient code, but some strange hacks
7613 that alter the assembler output may be confused by the
7614 optimizations performed when this option is not used.
7615
7616 The default is -ffunction-cse
7617
7618 -fno-zero-initialized-in-bss
7619 If the target supports a BSS section, GCC by default puts variables
7620 that are initialized to zero into BSS. This can save space in the
7621 resulting code.
7622
7623 This option turns off this behavior because some programs
7624 explicitly rely on variables going to the data section---e.g., so
7625 that the resulting executable can find the beginning of that
7626 section and/or make assumptions based on that.
7627
7628 The default is -fzero-initialized-in-bss.
7629
7630 -fthread-jumps
7631 Perform optimizations that check to see if a jump branches to a
7632 location where another comparison subsumed by the first is found.
7633 If so, the first branch is redirected to either the destination of
7634 the second branch or a point immediately following it, depending on
7635 whether the condition is known to be true or false.
7636
7637 Enabled at levels -O2, -O3, -Os.
7638
7639 -fsplit-wide-types
7640 When using a type that occupies multiple registers, such as "long
7641 long" on a 32-bit system, split the registers apart and allocate
7642 them independently. This normally generates better code for those
7643 types, but may make debugging more difficult.
7644
7645 Enabled at levels -O, -O2, -O3, -Os.
7646
7647 -fsplit-wide-types-early
7648 Fully split wide types early, instead of very late. This option
7649 has no effect unless -fsplit-wide-types is turned on.
7650
7651 This is the default on some targets.
7652
7653 -fcse-follow-jumps
7654 In common subexpression elimination (CSE), scan through jump
7655 instructions when the target of the jump is not reached by any
7656 other path. For example, when CSE encounters an "if" statement
7657 with an "else" clause, CSE follows the jump when the condition
7658 tested is false.
7659
7660 Enabled at levels -O2, -O3, -Os.
7661
7662 -fcse-skip-blocks
7663 This is similar to -fcse-follow-jumps, but causes CSE to follow
7664 jumps that conditionally skip over blocks. When CSE encounters a
7665 simple "if" statement with no else clause, -fcse-skip-blocks causes
7666 CSE to follow the jump around the body of the "if".
7667
7668 Enabled at levels -O2, -O3, -Os.
7669
7670 -frerun-cse-after-loop
7671 Re-run common subexpression elimination after loop optimizations
7672 are performed.
7673
7674 Enabled at levels -O2, -O3, -Os.
7675
7676 -fgcse
7677 Perform a global common subexpression elimination pass. This pass
7678 also performs global constant and copy propagation.
7679
7680 Note: When compiling a program using computed gotos, a GCC
7681 extension, you may get better run-time performance if you disable
7682 the global common subexpression elimination pass by adding
7683 -fno-gcse to the command line.
7684
7685 Enabled at levels -O2, -O3, -Os.
7686
7687 -fgcse-lm
7688 When -fgcse-lm is enabled, global common subexpression elimination
7689 attempts to move loads that are only killed by stores into
7690 themselves. This allows a loop containing a load/store sequence to
7691 be changed to a load outside the loop, and a copy/store within the
7692 loop.
7693
7694 Enabled by default when -fgcse is enabled.
7695
7696 -fgcse-sm
7697 When -fgcse-sm is enabled, a store motion pass is run after global
7698 common subexpression elimination. This pass attempts to move
7699 stores out of loops. When used in conjunction with -fgcse-lm,
7700 loops containing a load/store sequence can be changed to a load
7701 before the loop and a store after the loop.
7702
7703 Not enabled at any optimization level.
7704
7705 -fgcse-las
7706 When -fgcse-las is enabled, the global common subexpression
7707 elimination pass eliminates redundant loads that come after stores
7708 to the same memory location (both partial and full redundancies).
7709
7710 Not enabled at any optimization level.
7711
7712 -fgcse-after-reload
7713 When -fgcse-after-reload is enabled, a redundant load elimination
7714 pass is performed after reload. The purpose of this pass is to
7715 clean up redundant spilling.
7716
7717 Enabled by -fprofile-use and -fauto-profile.
7718
7719 -faggressive-loop-optimizations
7720 This option tells the loop optimizer to use language constraints to
7721 derive bounds for the number of iterations of a loop. This assumes
7722 that loop code does not invoke undefined behavior by for example
7723 causing signed integer overflows or out-of-bound array accesses.
7724 The bounds for the number of iterations of a loop are used to guide
7725 loop unrolling and peeling and loop exit test optimizations. This
7726 option is enabled by default.
7727
7728 -funconstrained-commons
7729 This option tells the compiler that variables declared in common
7730 blocks (e.g. Fortran) may later be overridden with longer trailing
7731 arrays. This prevents certain optimizations that depend on knowing
7732 the array bounds.
7733
7734 -fcrossjumping
7735 Perform cross-jumping transformation. This transformation unifies
7736 equivalent code and saves code size. The resulting code may or may
7737 not perform better than without cross-jumping.
7738
7739 Enabled at levels -O2, -O3, -Os.
7740
7741 -fauto-inc-dec
7742 Combine increments or decrements of addresses with memory accesses.
7743 This pass is always skipped on architectures that do not have
7744 instructions to support this. Enabled by default at -O and higher
7745 on architectures that support this.
7746
7747 -fdce
7748 Perform dead code elimination (DCE) on RTL. Enabled by default at
7749 -O and higher.
7750
7751 -fdse
7752 Perform dead store elimination (DSE) on RTL. Enabled by default at
7753 -O and higher.
7754
7755 -fif-conversion
7756 Attempt to transform conditional jumps into branch-less
7757 equivalents. This includes use of conditional moves, min, max, set
7758 flags and abs instructions, and some tricks doable by standard
7759 arithmetics. The use of conditional execution on chips where it is
7760 available is controlled by -fif-conversion2.
7761
7762 Enabled at levels -O, -O2, -O3, -Os, but not with -Og.
7763
7764 -fif-conversion2
7765 Use conditional execution (where available) to transform
7766 conditional jumps into branch-less equivalents.
7767
7768 Enabled at levels -O, -O2, -O3, -Os, but not with -Og.
7769
7770 -fdeclone-ctor-dtor
7771 The C++ ABI requires multiple entry points for constructors and
7772 destructors: one for a base subobject, one for a complete object,
7773 and one for a virtual destructor that calls operator delete
7774 afterwards. For a hierarchy with virtual bases, the base and
7775 complete variants are clones, which means two copies of the
7776 function. With this option, the base and complete variants are
7777 changed to be thunks that call a common implementation.
7778
7779 Enabled by -Os.
7780
7781 -fdelete-null-pointer-checks
7782 Assume that programs cannot safely dereference null pointers, and
7783 that no code or data element resides at address zero. This option
7784 enables simple constant folding optimizations at all optimization
7785 levels. In addition, other optimization passes in GCC use this
7786 flag to control global dataflow analyses that eliminate useless
7787 checks for null pointers; these assume that a memory access to
7788 address zero always results in a trap, so that if a pointer is
7789 checked after it has already been dereferenced, it cannot be null.
7790
7791 Note however that in some environments this assumption is not true.
7792 Use -fno-delete-null-pointer-checks to disable this optimization
7793 for programs that depend on that behavior.
7794
7795 This option is enabled by default on most targets. On Nios II ELF,
7796 it defaults to off. On AVR, CR16, and MSP430, this option is
7797 completely disabled.
7798
7799 Passes that use the dataflow information are enabled independently
7800 at different optimization levels.
7801
7802 -fdevirtualize
7803 Attempt to convert calls to virtual functions to direct calls.
7804 This is done both within a procedure and interprocedurally as part
7805 of indirect inlining (-findirect-inlining) and interprocedural
7806 constant propagation (-fipa-cp). Enabled at levels -O2, -O3, -Os.
7807
7808 -fdevirtualize-speculatively
7809 Attempt to convert calls to virtual functions to speculative direct
7810 calls. Based on the analysis of the type inheritance graph,
7811 determine for a given call the set of likely targets. If the set is
7812 small, preferably of size 1, change the call into a conditional
7813 deciding between direct and indirect calls. The speculative calls
7814 enable more optimizations, such as inlining. When they seem
7815 useless after further optimization, they are converted back into
7816 original form.
7817
7818 -fdevirtualize-at-ltrans
7819 Stream extra information needed for aggressive devirtualization
7820 when running the link-time optimizer in local transformation mode.
7821 This option enables more devirtualization but significantly
7822 increases the size of streamed data. For this reason it is disabled
7823 by default.
7824
7825 -fexpensive-optimizations
7826 Perform a number of minor optimizations that are relatively
7827 expensive.
7828
7829 Enabled at levels -O2, -O3, -Os.
7830
7831 -free
7832 Attempt to remove redundant extension instructions. This is
7833 especially helpful for the x86-64 architecture, which implicitly
7834 zero-extends in 64-bit registers after writing to their lower
7835 32-bit half.
7836
7837 Enabled for Alpha, AArch64 and x86 at levels -O2, -O3, -Os.
7838
7839 -fno-lifetime-dse
7840 In C++ the value of an object is only affected by changes within
7841 its lifetime: when the constructor begins, the object has an
7842 indeterminate value, and any changes during the lifetime of the
7843 object are dead when the object is destroyed. Normally dead store
7844 elimination will take advantage of this; if your code relies on the
7845 value of the object storage persisting beyond the lifetime of the
7846 object, you can use this flag to disable this optimization. To
7847 preserve stores before the constructor starts (e.g. because your
7848 operator new clears the object storage) but still treat the object
7849 as dead after the destructor, you can use -flifetime-dse=1. The
7850 default behavior can be explicitly selected with -flifetime-dse=2.
7851 -flifetime-dse=0 is equivalent to -fno-lifetime-dse.
7852
7853 -flive-range-shrinkage
7854 Attempt to decrease register pressure through register live range
7855 shrinkage. This is helpful for fast processors with small or
7856 moderate size register sets.
7857
7858 -fira-algorithm=algorithm
7859 Use the specified coloring algorithm for the integrated register
7860 allocator. The algorithm argument can be priority, which specifies
7861 Chow's priority coloring, or CB, which specifies Chaitin-Briggs
7862 coloring. Chaitin-Briggs coloring is not implemented for all
7863 architectures, but for those targets that do support it, it is the
7864 default because it generates better code.
7865
7866 -fira-region=region
7867 Use specified regions for the integrated register allocator. The
7868 region argument should be one of the following:
7869
7870 all Use all loops as register allocation regions. This can give
7871 the best results for machines with a small and/or irregular
7872 register set.
7873
7874 mixed
7875 Use all loops except for loops with small register pressure as
7876 the regions. This value usually gives the best results in most
7877 cases and for most architectures, and is enabled by default
7878 when compiling with optimization for speed (-O, -O2, ...).
7879
7880 one Use all functions as a single region. This typically results
7881 in the smallest code size, and is enabled by default for -Os or
7882 -O0.
7883
7884 -fira-hoist-pressure
7885 Use IRA to evaluate register pressure in the code hoisting pass for
7886 decisions to hoist expressions. This option usually results in
7887 smaller code, but it can slow the compiler down.
7888
7889 This option is enabled at level -Os for all targets.
7890
7891 -fira-loop-pressure
7892 Use IRA to evaluate register pressure in loops for decisions to
7893 move loop invariants. This option usually results in generation of
7894 faster and smaller code on machines with large register files (>=
7895 32 registers), but it can slow the compiler down.
7896
7897 This option is enabled at level -O3 for some targets.
7898
7899 -fno-ira-share-save-slots
7900 Disable sharing of stack slots used for saving call-used hard
7901 registers living through a call. Each hard register gets a
7902 separate stack slot, and as a result function stack frames are
7903 larger.
7904
7905 -fno-ira-share-spill-slots
7906 Disable sharing of stack slots allocated for pseudo-registers.
7907 Each pseudo-register that does not get a hard register gets a
7908 separate stack slot, and as a result function stack frames are
7909 larger.
7910
7911 -flra-remat
7912 Enable CFG-sensitive rematerialization in LRA. Instead of loading
7913 values of spilled pseudos, LRA tries to rematerialize (recalculate)
7914 values if it is profitable.
7915
7916 Enabled at levels -O2, -O3, -Os.
7917
7918 -fdelayed-branch
7919 If supported for the target machine, attempt to reorder
7920 instructions to exploit instruction slots available after delayed
7921 branch instructions.
7922
7923 Enabled at levels -O, -O2, -O3, -Os, but not at -Og.
7924
7925 -fschedule-insns
7926 If supported for the target machine, attempt to reorder
7927 instructions to eliminate execution stalls due to required data
7928 being unavailable. This helps machines that have slow floating
7929 point or memory load instructions by allowing other instructions to
7930 be issued until the result of the load or floating-point
7931 instruction is required.
7932
7933 Enabled at levels -O2, -O3.
7934
7935 -fschedule-insns2
7936 Similar to -fschedule-insns, but requests an additional pass of
7937 instruction scheduling after register allocation has been done.
7938 This is especially useful on machines with a relatively small
7939 number of registers and where memory load instructions take more
7940 than one cycle.
7941
7942 Enabled at levels -O2, -O3, -Os.
7943
7944 -fno-sched-interblock
7945 Disable instruction scheduling across basic blocks, which is
7946 normally enabled when scheduling before register allocation, i.e.
7947 with -fschedule-insns or at -O2 or higher.
7948
7949 -fno-sched-spec
7950 Disable speculative motion of non-load instructions, which is
7951 normally enabled when scheduling before register allocation, i.e.
7952 with -fschedule-insns or at -O2 or higher.
7953
7954 -fsched-pressure
7955 Enable register pressure sensitive insn scheduling before register
7956 allocation. This only makes sense when scheduling before register
7957 allocation is enabled, i.e. with -fschedule-insns or at -O2 or
7958 higher. Usage of this option can improve the generated code and
7959 decrease its size by preventing register pressure increase above
7960 the number of available hard registers and subsequent spills in
7961 register allocation.
7962
7963 -fsched-spec-load
7964 Allow speculative motion of some load instructions. This only
7965 makes sense when scheduling before register allocation, i.e. with
7966 -fschedule-insns or at -O2 or higher.
7967
7968 -fsched-spec-load-dangerous
7969 Allow speculative motion of more load instructions. This only
7970 makes sense when scheduling before register allocation, i.e. with
7971 -fschedule-insns or at -O2 or higher.
7972
7973 -fsched-stalled-insns
7974 -fsched-stalled-insns=n
7975 Define how many insns (if any) can be moved prematurely from the
7976 queue of stalled insns into the ready list during the second
7977 scheduling pass. -fno-sched-stalled-insns means that no insns are
7978 moved prematurely, -fsched-stalled-insns=0 means there is no limit
7979 on how many queued insns can be moved prematurely.
7980 -fsched-stalled-insns without a value is equivalent to
7981 -fsched-stalled-insns=1.
7982
7983 -fsched-stalled-insns-dep
7984 -fsched-stalled-insns-dep=n
7985 Define how many insn groups (cycles) are examined for a dependency
7986 on a stalled insn that is a candidate for premature removal from
7987 the queue of stalled insns. This has an effect only during the
7988 second scheduling pass, and only if -fsched-stalled-insns is used.
7989 -fno-sched-stalled-insns-dep is equivalent to
7990 -fsched-stalled-insns-dep=0. -fsched-stalled-insns-dep without a
7991 value is equivalent to -fsched-stalled-insns-dep=1.
7992
7993 -fsched2-use-superblocks
7994 When scheduling after register allocation, use superblock
7995 scheduling. This allows motion across basic block boundaries,
7996 resulting in faster schedules. This option is experimental, as not
7997 all machine descriptions used by GCC model the CPU closely enough
7998 to avoid unreliable results from the algorithm.
7999
8000 This only makes sense when scheduling after register allocation,
8001 i.e. with -fschedule-insns2 or at -O2 or higher.
8002
8003 -fsched-group-heuristic
8004 Enable the group heuristic in the scheduler. This heuristic favors
8005 the instruction that belongs to a schedule group. This is enabled
8006 by default when scheduling is enabled, i.e. with -fschedule-insns
8007 or -fschedule-insns2 or at -O2 or higher.
8008
8009 -fsched-critical-path-heuristic
8010 Enable the critical-path heuristic in the scheduler. This
8011 heuristic favors instructions on the critical path. This is
8012 enabled by default when scheduling is enabled, i.e. with
8013 -fschedule-insns or -fschedule-insns2 or at -O2 or higher.
8014
8015 -fsched-spec-insn-heuristic
8016 Enable the speculative instruction heuristic in the scheduler.
8017 This heuristic favors speculative instructions with greater
8018 dependency weakness. This is enabled by default when scheduling is
8019 enabled, i.e. with -fschedule-insns or -fschedule-insns2 or at -O2
8020 or higher.
8021
8022 -fsched-rank-heuristic
8023 Enable the rank heuristic in the scheduler. This heuristic favors
8024 the instruction belonging to a basic block with greater size or
8025 frequency. This is enabled by default when scheduling is enabled,
8026 i.e. with -fschedule-insns or -fschedule-insns2 or at -O2 or
8027 higher.
8028
8029 -fsched-last-insn-heuristic
8030 Enable the last-instruction heuristic in the scheduler. This
8031 heuristic favors the instruction that is less dependent on the last
8032 instruction scheduled. This is enabled by default when scheduling
8033 is enabled, i.e. with -fschedule-insns or -fschedule-insns2 or at
8034 -O2 or higher.
8035
8036 -fsched-dep-count-heuristic
8037 Enable the dependent-count heuristic in the scheduler. This
8038 heuristic favors the instruction that has more instructions
8039 depending on it. This is enabled by default when scheduling is
8040 enabled, i.e. with -fschedule-insns or -fschedule-insns2 or at -O2
8041 or higher.
8042
8043 -freschedule-modulo-scheduled-loops
8044 Modulo scheduling is performed before traditional scheduling. If a
8045 loop is modulo scheduled, later scheduling passes may change its
8046 schedule. Use this option to control that behavior.
8047
8048 -fselective-scheduling
8049 Schedule instructions using selective scheduling algorithm.
8050 Selective scheduling runs instead of the first scheduler pass.
8051
8052 -fselective-scheduling2
8053 Schedule instructions using selective scheduling algorithm.
8054 Selective scheduling runs instead of the second scheduler pass.
8055
8056 -fsel-sched-pipelining
8057 Enable software pipelining of innermost loops during selective
8058 scheduling. This option has no effect unless one of
8059 -fselective-scheduling or -fselective-scheduling2 is turned on.
8060
8061 -fsel-sched-pipelining-outer-loops
8062 When pipelining loops during selective scheduling, also pipeline
8063 outer loops. This option has no effect unless
8064 -fsel-sched-pipelining is turned on.
8065
8066 -fsemantic-interposition
8067 Some object formats, like ELF, allow interposing of symbols by the
8068 dynamic linker. This means that for symbols exported from the DSO,
8069 the compiler cannot perform interprocedural propagation, inlining
8070 and other optimizations in anticipation that the function or
8071 variable in question may change. While this feature is useful, for
8072 example, to rewrite memory allocation functions by a debugging
8073 implementation, it is expensive in the terms of code quality. With
8074 -fno-semantic-interposition the compiler assumes that if
8075 interposition happens for functions the overwriting function will
8076 have precisely the same semantics (and side effects). Similarly if
8077 interposition happens for variables, the constructor of the
8078 variable will be the same. The flag has no effect for functions
8079 explicitly declared inline (where it is never allowed for
8080 interposition to change semantics) and for symbols explicitly
8081 declared weak.
8082
8083 -fshrink-wrap
8084 Emit function prologues only before parts of the function that need
8085 it, rather than at the top of the function. This flag is enabled
8086 by default at -O and higher.
8087
8088 -fshrink-wrap-separate
8089 Shrink-wrap separate parts of the prologue and epilogue separately,
8090 so that those parts are only executed when needed. This option is
8091 on by default, but has no effect unless -fshrink-wrap is also
8092 turned on and the target supports this.
8093
8094 -fcaller-saves
8095 Enable allocation of values to registers that are clobbered by
8096 function calls, by emitting extra instructions to save and restore
8097 the registers around such calls. Such allocation is done only when
8098 it seems to result in better code.
8099
8100 This option is always enabled by default on certain machines,
8101 usually those which have no call-preserved registers to use
8102 instead.
8103
8104 Enabled at levels -O2, -O3, -Os.
8105
8106 -fcombine-stack-adjustments
8107 Tracks stack adjustments (pushes and pops) and stack memory
8108 references and then tries to find ways to combine them.
8109
8110 Enabled by default at -O1 and higher.
8111
8112 -fipa-ra
8113 Use caller save registers for allocation if those registers are not
8114 used by any called function. In that case it is not necessary to
8115 save and restore them around calls. This is only possible if
8116 called functions are part of same compilation unit as current
8117 function and they are compiled before it.
8118
8119 Enabled at levels -O2, -O3, -Os, however the option is disabled if
8120 generated code will be instrumented for profiling (-p, or -pg) or
8121 if callee's register usage cannot be known exactly (this happens on
8122 targets that do not expose prologues and epilogues in RTL).
8123
8124 -fconserve-stack
8125 Attempt to minimize stack usage. The compiler attempts to use less
8126 stack space, even if that makes the program slower. This option
8127 implies setting the large-stack-frame parameter to 100 and the
8128 large-stack-frame-growth parameter to 400.
8129
8130 -ftree-reassoc
8131 Perform reassociation on trees. This flag is enabled by default at
8132 -O and higher.
8133
8134 -fcode-hoisting
8135 Perform code hoisting. Code hoisting tries to move the evaluation
8136 of expressions executed on all paths to the function exit as early
8137 as possible. This is especially useful as a code size
8138 optimization, but it often helps for code speed as well. This flag
8139 is enabled by default at -O2 and higher.
8140
8141 -ftree-pre
8142 Perform partial redundancy elimination (PRE) on trees. This flag
8143 is enabled by default at -O2 and -O3.
8144
8145 -ftree-partial-pre
8146 Make partial redundancy elimination (PRE) more aggressive. This
8147 flag is enabled by default at -O3.
8148
8149 -ftree-forwprop
8150 Perform forward propagation on trees. This flag is enabled by
8151 default at -O and higher.
8152
8153 -ftree-fre
8154 Perform full redundancy elimination (FRE) on trees. The difference
8155 between FRE and PRE is that FRE only considers expressions that are
8156 computed on all paths leading to the redundant computation. This
8157 analysis is faster than PRE, though it exposes fewer redundancies.
8158 This flag is enabled by default at -O and higher.
8159
8160 -ftree-phiprop
8161 Perform hoisting of loads from conditional pointers on trees. This
8162 pass is enabled by default at -O and higher.
8163
8164 -fhoist-adjacent-loads
8165 Speculatively hoist loads from both branches of an if-then-else if
8166 the loads are from adjacent locations in the same structure and the
8167 target architecture has a conditional move instruction. This flag
8168 is enabled by default at -O2 and higher.
8169
8170 -ftree-copy-prop
8171 Perform copy propagation on trees. This pass eliminates
8172 unnecessary copy operations. This flag is enabled by default at -O
8173 and higher.
8174
8175 -fipa-pure-const
8176 Discover which functions are pure or constant. Enabled by default
8177 at -O and higher.
8178
8179 -fipa-reference
8180 Discover which static variables do not escape the compilation unit.
8181 Enabled by default at -O and higher.
8182
8183 -fipa-reference-addressable
8184 Discover read-only, write-only and non-addressable static
8185 variables. Enabled by default at -O and higher.
8186
8187 -fipa-stack-alignment
8188 Reduce stack alignment on call sites if possible. Enabled by
8189 default.
8190
8191 -fipa-pta
8192 Perform interprocedural pointer analysis and interprocedural
8193 modification and reference analysis. This option can cause
8194 excessive memory and compile-time usage on large compilation units.
8195 It is not enabled by default at any optimization level.
8196
8197 -fipa-profile
8198 Perform interprocedural profile propagation. The functions called
8199 only from cold functions are marked as cold. Also functions
8200 executed once (such as "cold", "noreturn", static constructors or
8201 destructors) are identified. Cold functions and loop less parts of
8202 functions executed once are then optimized for size. Enabled by
8203 default at -O and higher.
8204
8205 -fipa-cp
8206 Perform interprocedural constant propagation. This optimization
8207 analyzes the program to determine when values passed to functions
8208 are constants and then optimizes accordingly. This optimization
8209 can substantially increase performance if the application has
8210 constants passed to functions. This flag is enabled by default at
8211 -O2, -Os and -O3. It is also enabled by -fprofile-use and
8212 -fauto-profile.
8213
8214 -fipa-cp-clone
8215 Perform function cloning to make interprocedural constant
8216 propagation stronger. When enabled, interprocedural constant
8217 propagation performs function cloning when externally visible
8218 function can be called with constant arguments. Because this
8219 optimization can create multiple copies of functions, it may
8220 significantly increase code size (see --param
8221 ipa-cp-unit-growth=value). This flag is enabled by default at -O3.
8222 It is also enabled by -fprofile-use and -fauto-profile.
8223
8224 -fipa-bit-cp
8225 When enabled, perform interprocedural bitwise constant propagation.
8226 This flag is enabled by default at -O2 and by -fprofile-use and
8227 -fauto-profile. It requires that -fipa-cp is enabled.
8228
8229 -fipa-vrp
8230 When enabled, perform interprocedural propagation of value ranges.
8231 This flag is enabled by default at -O2. It requires that -fipa-cp
8232 is enabled.
8233
8234 -fipa-icf
8235 Perform Identical Code Folding for functions and read-only
8236 variables. The optimization reduces code size and may disturb
8237 unwind stacks by replacing a function by equivalent one with a
8238 different name. The optimization works more effectively with link-
8239 time optimization enabled.
8240
8241 Although the behavior is similar to the Gold Linker's ICF
8242 optimization, GCC ICF works on different levels and thus the
8243 optimizations are not same - there are equivalences that are found
8244 only by GCC and equivalences found only by Gold.
8245
8246 This flag is enabled by default at -O2 and -Os.
8247
8248 -flive-patching=level
8249 Control GCC's optimizations to produce output suitable for live-
8250 patching.
8251
8252 If the compiler's optimization uses a function's body or
8253 information extracted from its body to optimize/change another
8254 function, the latter is called an impacted function of the former.
8255 If a function is patched, its impacted functions should be patched
8256 too.
8257
8258 The impacted functions are determined by the compiler's
8259 interprocedural optimizations. For example, a caller is impacted
8260 when inlining a function into its caller, cloning a function and
8261 changing its caller to call this new clone, or extracting a
8262 function's pureness/constness information to optimize its direct or
8263 indirect callers, etc.
8264
8265 Usually, the more IPA optimizations enabled, the larger the number
8266 of impacted functions for each function. In order to control the
8267 number of impacted functions and more easily compute the list of
8268 impacted function, IPA optimizations can be partially enabled at
8269 two different levels.
8270
8271 The level argument should be one of the following:
8272
8273 inline-clone
8274 Only enable inlining and cloning optimizations, which includes
8275 inlining, cloning, interprocedural scalar replacement of
8276 aggregates and partial inlining. As a result, when patching a
8277 function, all its callers and its clones' callers are impacted,
8278 therefore need to be patched as well.
8279
8280 -flive-patching=inline-clone disables the following
8281 optimization flags: -fwhole-program -fipa-pta -fipa-reference
8282 -fipa-ra -fipa-icf -fipa-icf-functions -fipa-icf-variables
8283 -fipa-bit-cp -fipa-vrp -fipa-pure-const
8284 -fipa-reference-addressable -fipa-stack-alignment
8285
8286 inline-only-static
8287 Only enable inlining of static functions. As a result, when
8288 patching a static function, all its callers are impacted and so
8289 need to be patched as well.
8290
8291 In addition to all the flags that -flive-patching=inline-clone
8292 disables, -flive-patching=inline-only-static disables the
8293 following additional optimization flags: -fipa-cp-clone
8294 -fipa-sra -fpartial-inlining -fipa-cp
8295
8296 When -flive-patching is specified without any value, the default
8297 value is inline-clone.
8298
8299 This flag is disabled by default.
8300
8301 Note that -flive-patching is not supported with link-time
8302 optimization (-flto).
8303
8304 -fisolate-erroneous-paths-dereference
8305 Detect paths that trigger erroneous or undefined behavior due to
8306 dereferencing a null pointer. Isolate those paths from the main
8307 control flow and turn the statement with erroneous or undefined
8308 behavior into a trap. This flag is enabled by default at -O2 and
8309 higher and depends on -fdelete-null-pointer-checks also being
8310 enabled.
8311
8312 -fisolate-erroneous-paths-attribute
8313 Detect paths that trigger erroneous or undefined behavior due to a
8314 null value being used in a way forbidden by a "returns_nonnull" or
8315 "nonnull" attribute. Isolate those paths from the main control
8316 flow and turn the statement with erroneous or undefined behavior
8317 into a trap. This is not currently enabled, but may be enabled by
8318 -O2 in the future.
8319
8320 -ftree-sink
8321 Perform forward store motion on trees. This flag is enabled by
8322 default at -O and higher.
8323
8324 -ftree-bit-ccp
8325 Perform sparse conditional bit constant propagation on trees and
8326 propagate pointer alignment information. This pass only operates
8327 on local scalar variables and is enabled by default at -O1 and
8328 higher, except for -Og. It requires that -ftree-ccp is enabled.
8329
8330 -ftree-ccp
8331 Perform sparse conditional constant propagation (CCP) on trees.
8332 This pass only operates on local scalar variables and is enabled by
8333 default at -O and higher.
8334
8335 -fssa-backprop
8336 Propagate information about uses of a value up the definition chain
8337 in order to simplify the definitions. For example, this pass
8338 strips sign operations if the sign of a value never matters. The
8339 flag is enabled by default at -O and higher.
8340
8341 -fssa-phiopt
8342 Perform pattern matching on SSA PHI nodes to optimize conditional
8343 code. This pass is enabled by default at -O1 and higher, except
8344 for -Og.
8345
8346 -ftree-switch-conversion
8347 Perform conversion of simple initializations in a switch to
8348 initializations from a scalar array. This flag is enabled by
8349 default at -O2 and higher.
8350
8351 -ftree-tail-merge
8352 Look for identical code sequences. When found, replace one with a
8353 jump to the other. This optimization is known as tail merging or
8354 cross jumping. This flag is enabled by default at -O2 and higher.
8355 The compilation time in this pass can be limited using max-tail-
8356 merge-comparisons parameter and max-tail-merge-iterations
8357 parameter.
8358
8359 -ftree-dce
8360 Perform dead code elimination (DCE) on trees. This flag is enabled
8361 by default at -O and higher.
8362
8363 -ftree-builtin-call-dce
8364 Perform conditional dead code elimination (DCE) for calls to built-
8365 in functions that may set "errno" but are otherwise free of side
8366 effects. This flag is enabled by default at -O2 and higher if -Os
8367 is not also specified.
8368
8369 -ffinite-loops
8370 Assume that a loop with an exit will eventually take the exit and
8371 not loop indefinitely. This allows the compiler to remove loops
8372 that otherwise have no side-effects, not considering eventual
8373 endless looping as such.
8374
8375 This option is enabled by default at -O2 for C++ with -std=c++11 or
8376 higher.
8377
8378 -ftree-dominator-opts
8379 Perform a variety of simple scalar cleanups (constant/copy
8380 propagation, redundancy elimination, range propagation and
8381 expression simplification) based on a dominator tree traversal.
8382 This also performs jump threading (to reduce jumps to jumps). This
8383 flag is enabled by default at -O and higher.
8384
8385 -ftree-dse
8386 Perform dead store elimination (DSE) on trees. A dead store is a
8387 store into a memory location that is later overwritten by another
8388 store without any intervening loads. In this case the earlier
8389 store can be deleted. This flag is enabled by default at -O and
8390 higher.
8391
8392 -ftree-ch
8393 Perform loop header copying on trees. This is beneficial since it
8394 increases effectiveness of code motion optimizations. It also
8395 saves one jump. This flag is enabled by default at -O and higher.
8396 It is not enabled for -Os, since it usually increases code size.
8397
8398 -ftree-loop-optimize
8399 Perform loop optimizations on trees. This flag is enabled by
8400 default at -O and higher.
8401
8402 -ftree-loop-linear
8403 -floop-strip-mine
8404 -floop-block
8405 Perform loop nest optimizations. Same as -floop-nest-optimize. To
8406 use this code transformation, GCC has to be configured with
8407 --with-isl to enable the Graphite loop transformation
8408 infrastructure.
8409
8410 -fgraphite-identity
8411 Enable the identity transformation for graphite. For every SCoP we
8412 generate the polyhedral representation and transform it back to
8413 gimple. Using -fgraphite-identity we can check the costs or
8414 benefits of the GIMPLE -> GRAPHITE -> GIMPLE transformation. Some
8415 minimal optimizations are also performed by the code generator isl,
8416 like index splitting and dead code elimination in loops.
8417
8418 -floop-nest-optimize
8419 Enable the isl based loop nest optimizer. This is a generic loop
8420 nest optimizer based on the Pluto optimization algorithms. It
8421 calculates a loop structure optimized for data-locality and
8422 parallelism. This option is experimental.
8423
8424 -floop-parallelize-all
8425 Use the Graphite data dependence analysis to identify loops that
8426 can be parallelized. Parallelize all the loops that can be
8427 analyzed to not contain loop carried dependences without checking
8428 that it is profitable to parallelize the loops.
8429
8430 -ftree-coalesce-vars
8431 While transforming the program out of the SSA representation,
8432 attempt to reduce copying by coalescing versions of different user-
8433 defined variables, instead of just compiler temporaries. This may
8434 severely limit the ability to debug an optimized program compiled
8435 with -fno-var-tracking-assignments. In the negated form, this flag
8436 prevents SSA coalescing of user variables. This option is enabled
8437 by default if optimization is enabled, and it does very little
8438 otherwise.
8439
8440 -ftree-loop-if-convert
8441 Attempt to transform conditional jumps in the innermost loops to
8442 branch-less equivalents. The intent is to remove control-flow from
8443 the innermost loops in order to improve the ability of the
8444 vectorization pass to handle these loops. This is enabled by
8445 default if vectorization is enabled.
8446
8447 -ftree-loop-distribution
8448 Perform loop distribution. This flag can improve cache performance
8449 on big loop bodies and allow further loop optimizations, like
8450 parallelization or vectorization, to take place. For example, the
8451 loop
8452
8453 DO I = 1, N
8454 A(I) = B(I) + C
8455 D(I) = E(I) * F
8456 ENDDO
8457
8458 is transformed to
8459
8460 DO I = 1, N
8461 A(I) = B(I) + C
8462 ENDDO
8463 DO I = 1, N
8464 D(I) = E(I) * F
8465 ENDDO
8466
8467 This flag is enabled by default at -O3. It is also enabled by
8468 -fprofile-use and -fauto-profile.
8469
8470 -ftree-loop-distribute-patterns
8471 Perform loop distribution of patterns that can be code generated
8472 with calls to a library. This flag is enabled by default at -O2
8473 and higher, and by -fprofile-use and -fauto-profile.
8474
8475 This pass distributes the initialization loops and generates a call
8476 to memset zero. For example, the loop
8477
8478 DO I = 1, N
8479 A(I) = 0
8480 B(I) = A(I) + I
8481 ENDDO
8482
8483 is transformed to
8484
8485 DO I = 1, N
8486 A(I) = 0
8487 ENDDO
8488 DO I = 1, N
8489 B(I) = A(I) + I
8490 ENDDO
8491
8492 and the initialization loop is transformed into a call to memset
8493 zero. This flag is enabled by default at -O3. It is also enabled
8494 by -fprofile-use and -fauto-profile.
8495
8496 -floop-interchange
8497 Perform loop interchange outside of graphite. This flag can
8498 improve cache performance on loop nest and allow further loop
8499 optimizations, like vectorization, to take place. For example, the
8500 loop
8501
8502 for (int i = 0; i < N; i++)
8503 for (int j = 0; j < N; j++)
8504 for (int k = 0; k < N; k++)
8505 c[i][j] = c[i][j] + a[i][k]*b[k][j];
8506
8507 is transformed to
8508
8509 for (int i = 0; i < N; i++)
8510 for (int k = 0; k < N; k++)
8511 for (int j = 0; j < N; j++)
8512 c[i][j] = c[i][j] + a[i][k]*b[k][j];
8513
8514 This flag is enabled by default at -O3. It is also enabled by
8515 -fprofile-use and -fauto-profile.
8516
8517 -floop-unroll-and-jam
8518 Apply unroll and jam transformations on feasible loops. In a loop
8519 nest this unrolls the outer loop by some factor and fuses the
8520 resulting multiple inner loops. This flag is enabled by default at
8521 -O3. It is also enabled by -fprofile-use and -fauto-profile.
8522
8523 -ftree-loop-im
8524 Perform loop invariant motion on trees. This pass moves only
8525 invariants that are hard to handle at RTL level (function calls,
8526 operations that expand to nontrivial sequences of insns). With
8527 -funswitch-loops it also moves operands of conditions that are
8528 invariant out of the loop, so that we can use just trivial
8529 invariantness analysis in loop unswitching. The pass also includes
8530 store motion.
8531
8532 -ftree-loop-ivcanon
8533 Create a canonical counter for number of iterations in loops for
8534 which determining number of iterations requires complicated
8535 analysis. Later optimizations then may determine the number
8536 easily. Useful especially in connection with unrolling.
8537
8538 -ftree-scev-cprop
8539 Perform final value replacement. If a variable is modified in a
8540 loop in such a way that its value when exiting the loop can be
8541 determined using only its initial value and the number of loop
8542 iterations, replace uses of the final value by such a computation,
8543 provided it is sufficiently cheap. This reduces data dependencies
8544 and may allow further simplifications. Enabled by default at -O
8545 and higher.
8546
8547 -fivopts
8548 Perform induction variable optimizations (strength reduction,
8549 induction variable merging and induction variable elimination) on
8550 trees.
8551
8552 -ftree-parallelize-loops=n
8553 Parallelize loops, i.e., split their iteration space to run in n
8554 threads. This is only possible for loops whose iterations are
8555 independent and can be arbitrarily reordered. The optimization is
8556 only profitable on multiprocessor machines, for loops that are CPU-
8557 intensive, rather than constrained e.g. by memory bandwidth. This
8558 option implies -pthread, and thus is only supported on targets that
8559 have support for -pthread.
8560
8561 -ftree-pta
8562 Perform function-local points-to analysis on trees. This flag is
8563 enabled by default at -O1 and higher, except for -Og.
8564
8565 -ftree-sra
8566 Perform scalar replacement of aggregates. This pass replaces
8567 structure references with scalars to prevent committing structures
8568 to memory too early. This flag is enabled by default at -O1 and
8569 higher, except for -Og.
8570
8571 -fstore-merging
8572 Perform merging of narrow stores to consecutive memory addresses.
8573 This pass merges contiguous stores of immediate values narrower
8574 than a word into fewer wider stores to reduce the number of
8575 instructions. This is enabled by default at -O2 and higher as well
8576 as -Os.
8577
8578 -ftree-ter
8579 Perform temporary expression replacement during the SSA->normal
8580 phase. Single use/single def temporaries are replaced at their use
8581 location with their defining expression. This results in non-
8582 GIMPLE code, but gives the expanders much more complex trees to
8583 work on resulting in better RTL generation. This is enabled by
8584 default at -O and higher.
8585
8586 -ftree-slsr
8587 Perform straight-line strength reduction on trees. This recognizes
8588 related expressions involving multiplications and replaces them by
8589 less expensive calculations when possible. This is enabled by
8590 default at -O and higher.
8591
8592 -ftree-vectorize
8593 Perform vectorization on trees. This flag enables
8594 -ftree-loop-vectorize and -ftree-slp-vectorize if not explicitly
8595 specified.
8596
8597 -ftree-loop-vectorize
8598 Perform loop vectorization on trees. This flag is enabled by
8599 default at -O3 and by -ftree-vectorize, -fprofile-use, and
8600 -fauto-profile.
8601
8602 -ftree-slp-vectorize
8603 Perform basic block vectorization on trees. This flag is enabled by
8604 default at -O3 and by -ftree-vectorize, -fprofile-use, and
8605 -fauto-profile.
8606
8607 -fvect-cost-model=model
8608 Alter the cost model used for vectorization. The model argument
8609 should be one of unlimited, dynamic or cheap. With the unlimited
8610 model the vectorized code-path is assumed to be profitable while
8611 with the dynamic model a runtime check guards the vectorized code-
8612 path to enable it only for iteration counts that will likely
8613 execute faster than when executing the original scalar loop. The
8614 cheap model disables vectorization of loops where doing so would be
8615 cost prohibitive for example due to required runtime checks for
8616 data dependence or alignment but otherwise is equal to the dynamic
8617 model. The default cost model depends on other optimization flags
8618 and is either dynamic or cheap.
8619
8620 -fsimd-cost-model=model
8621 Alter the cost model used for vectorization of loops marked with
8622 the OpenMP simd directive. The model argument should be one of
8623 unlimited, dynamic, cheap. All values of model have the same
8624 meaning as described in -fvect-cost-model and by default a cost
8625 model defined with -fvect-cost-model is used.
8626
8627 -ftree-vrp
8628 Perform Value Range Propagation on trees. This is similar to the
8629 constant propagation pass, but instead of values, ranges of values
8630 are propagated. This allows the optimizers to remove unnecessary
8631 range checks like array bound checks and null pointer checks. This
8632 is enabled by default at -O2 and higher. Null pointer check
8633 elimination is only done if -fdelete-null-pointer-checks is
8634 enabled.
8635
8636 -fsplit-paths
8637 Split paths leading to loop backedges. This can improve dead code
8638 elimination and common subexpression elimination. This is enabled
8639 by default at -O3 and above.
8640
8641 -fsplit-ivs-in-unroller
8642 Enables expression of values of induction variables in later
8643 iterations of the unrolled loop using the value in the first
8644 iteration. This breaks long dependency chains, thus improving
8645 efficiency of the scheduling passes.
8646
8647 A combination of -fweb and CSE is often sufficient to obtain the
8648 same effect. However, that is not reliable in cases where the loop
8649 body is more complicated than a single basic block. It also does
8650 not work at all on some architectures due to restrictions in the
8651 CSE pass.
8652
8653 This optimization is enabled by default.
8654
8655 -fvariable-expansion-in-unroller
8656 With this option, the compiler creates multiple copies of some
8657 local variables when unrolling a loop, which can result in superior
8658 code.
8659
8660 This optimization is enabled by default for PowerPC targets, but
8661 disabled by default otherwise.
8662
8663 -fpartial-inlining
8664 Inline parts of functions. This option has any effect only when
8665 inlining itself is turned on by the -finline-functions or
8666 -finline-small-functions options.
8667
8668 Enabled at levels -O2, -O3, -Os.
8669
8670 -fpredictive-commoning
8671 Perform predictive commoning optimization, i.e., reusing
8672 computations (especially memory loads and stores) performed in
8673 previous iterations of loops.
8674
8675 This option is enabled at level -O3. It is also enabled by
8676 -fprofile-use and -fauto-profile.
8677
8678 -fprefetch-loop-arrays
8679 If supported by the target machine, generate instructions to
8680 prefetch memory to improve the performance of loops that access
8681 large arrays.
8682
8683 This option may generate better or worse code; results are highly
8684 dependent on the structure of loops within the source code.
8685
8686 Disabled at level -Os.
8687
8688 -fno-printf-return-value
8689 Do not substitute constants for known return value of formatted
8690 output functions such as "sprintf", "snprintf", "vsprintf", and
8691 "vsnprintf" (but not "printf" of "fprintf"). This transformation
8692 allows GCC to optimize or even eliminate branches based on the
8693 known return value of these functions called with arguments that
8694 are either constant, or whose values are known to be in a range
8695 that makes determining the exact return value possible. For
8696 example, when -fprintf-return-value is in effect, both the branch
8697 and the body of the "if" statement (but not the call to "snprint")
8698 can be optimized away when "i" is a 32-bit or smaller integer
8699 because the return value is guaranteed to be at most 8.
8700
8701 char buf[9];
8702 if (snprintf (buf, "%08x", i) >= sizeof buf)
8703 ...
8704
8705 The -fprintf-return-value option relies on other optimizations and
8706 yields best results with -O2 and above. It works in tandem with
8707 the -Wformat-overflow and -Wformat-truncation options. The
8708 -fprintf-return-value option is enabled by default.
8709
8710 -fno-peephole
8711 -fno-peephole2
8712 Disable any machine-specific peephole optimizations. The
8713 difference between -fno-peephole and -fno-peephole2 is in how they
8714 are implemented in the compiler; some targets use one, some use the
8715 other, a few use both.
8716
8717 -fpeephole is enabled by default. -fpeephole2 enabled at levels
8718 -O2, -O3, -Os.
8719
8720 -fno-guess-branch-probability
8721 Do not guess branch probabilities using heuristics.
8722
8723 GCC uses heuristics to guess branch probabilities if they are not
8724 provided by profiling feedback (-fprofile-arcs). These heuristics
8725 are based on the control flow graph. If some branch probabilities
8726 are specified by "__builtin_expect", then the heuristics are used
8727 to guess branch probabilities for the rest of the control flow
8728 graph, taking the "__builtin_expect" info into account. The
8729 interactions between the heuristics and "__builtin_expect" can be
8730 complex, and in some cases, it may be useful to disable the
8731 heuristics so that the effects of "__builtin_expect" are easier to
8732 understand.
8733
8734 It is also possible to specify expected probability of the
8735 expression with "__builtin_expect_with_probability" built-in
8736 function.
8737
8738 The default is -fguess-branch-probability at levels -O, -O2, -O3,
8739 -Os.
8740
8741 -freorder-blocks
8742 Reorder basic blocks in the compiled function in order to reduce
8743 number of taken branches and improve code locality.
8744
8745 Enabled at levels -O, -O2, -O3, -Os.
8746
8747 -freorder-blocks-algorithm=algorithm
8748 Use the specified algorithm for basic block reordering. The
8749 algorithm argument can be simple, which does not increase code size
8750 (except sometimes due to secondary effects like alignment), or stc,
8751 the "software trace cache" algorithm, which tries to put all often
8752 executed code together, minimizing the number of branches executed
8753 by making extra copies of code.
8754
8755 The default is simple at levels -O, -Os, and stc at levels -O2,
8756 -O3.
8757
8758 -freorder-blocks-and-partition
8759 In addition to reordering basic blocks in the compiled function, in
8760 order to reduce number of taken branches, partitions hot and cold
8761 basic blocks into separate sections of the assembly and .o files,
8762 to improve paging and cache locality performance.
8763
8764 This optimization is automatically turned off in the presence of
8765 exception handling or unwind tables (on targets using
8766 setjump/longjump or target specific scheme), for linkonce sections,
8767 for functions with a user-defined section attribute and on any
8768 architecture that does not support named sections. When
8769 -fsplit-stack is used this option is not enabled by default (to
8770 avoid linker errors), but may be enabled explicitly (if using a
8771 working linker).
8772
8773 Enabled for x86 at levels -O2, -O3, -Os.
8774
8775 -freorder-functions
8776 Reorder functions in the object file in order to improve code
8777 locality. This is implemented by using special subsections
8778 ".text.hot" for most frequently executed functions and
8779 ".text.unlikely" for unlikely executed functions. Reordering is
8780 done by the linker so object file format must support named
8781 sections and linker must place them in a reasonable way.
8782
8783 This option isn't effective unless you either provide profile
8784 feedback (see -fprofile-arcs for details) or manually annotate
8785 functions with "hot" or "cold" attributes.
8786
8787 Enabled at levels -O2, -O3, -Os.
8788
8789 -fstrict-aliasing
8790 Allow the compiler to assume the strictest aliasing rules
8791 applicable to the language being compiled. For C (and C++), this
8792 activates optimizations based on the type of expressions. In
8793 particular, an object of one type is assumed never to reside at the
8794 same address as an object of a different type, unless the types are
8795 almost the same. For example, an "unsigned int" can alias an
8796 "int", but not a "void*" or a "double". A character type may alias
8797 any other type.
8798
8799 Pay special attention to code like this:
8800
8801 union a_union {
8802 int i;
8803 double d;
8804 };
8805
8806 int f() {
8807 union a_union t;
8808 t.d = 3.0;
8809 return t.i;
8810 }
8811
8812 The practice of reading from a different union member than the one
8813 most recently written to (called "type-punning") is common. Even
8814 with -fstrict-aliasing, type-punning is allowed, provided the
8815 memory is accessed through the union type. So, the code above
8816 works as expected. However, this code might not:
8817
8818 int f() {
8819 union a_union t;
8820 int* ip;
8821 t.d = 3.0;
8822 ip = &t.i;
8823 return *ip;
8824 }
8825
8826 Similarly, access by taking the address, casting the resulting
8827 pointer and dereferencing the result has undefined behavior, even
8828 if the cast uses a union type, e.g.:
8829
8830 int f() {
8831 double d = 3.0;
8832 return ((union a_union *) &d)->i;
8833 }
8834
8835 The -fstrict-aliasing option is enabled at levels -O2, -O3, -Os.
8836
8837 -falign-functions
8838 -falign-functions=n
8839 -falign-functions=n:m
8840 -falign-functions=n:m:n2
8841 -falign-functions=n:m:n2:m2
8842 Align the start of functions to the next power-of-two greater than
8843 or equal to n, skipping up to m-1 bytes. This ensures that at
8844 least the first m bytes of the function can be fetched by the CPU
8845 without crossing an n-byte alignment boundary.
8846
8847 If m is not specified, it defaults to n.
8848
8849 Examples: -falign-functions=32 aligns functions to the next 32-byte
8850 boundary, -falign-functions=24 aligns to the next 32-byte boundary
8851 only if this can be done by skipping 23 bytes or less,
8852 -falign-functions=32:7 aligns to the next 32-byte boundary only if
8853 this can be done by skipping 6 bytes or less.
8854
8855 The second pair of n2:m2 values allows you to specify a secondary
8856 alignment: -falign-functions=64:7:32:3 aligns to the next 64-byte
8857 boundary if this can be done by skipping 6 bytes or less, otherwise
8858 aligns to the next 32-byte boundary if this can be done by skipping
8859 2 bytes or less. If m2 is not specified, it defaults to n2.
8860
8861 Some assemblers only support this flag when n is a power of two; in
8862 that case, it is rounded up.
8863
8864 -fno-align-functions and -falign-functions=1 are equivalent and
8865 mean that functions are not aligned.
8866
8867 If n is not specified or is zero, use a machine-dependent default.
8868 The maximum allowed n option value is 65536.
8869
8870 Enabled at levels -O2, -O3.
8871
8872 -flimit-function-alignment
8873 If this option is enabled, the compiler tries to avoid
8874 unnecessarily overaligning functions. It attempts to instruct the
8875 assembler to align by the amount specified by -falign-functions,
8876 but not to skip more bytes than the size of the function.
8877
8878 -falign-labels
8879 -falign-labels=n
8880 -falign-labels=n:m
8881 -falign-labels=n:m:n2
8882 -falign-labels=n:m:n2:m2
8883 Align all branch targets to a power-of-two boundary.
8884
8885 Parameters of this option are analogous to the -falign-functions
8886 option. -fno-align-labels and -falign-labels=1 are equivalent and
8887 mean that labels are not aligned.
8888
8889 If -falign-loops or -falign-jumps are applicable and are greater
8890 than this value, then their values are used instead.
8891
8892 If n is not specified or is zero, use a machine-dependent default
8893 which is very likely to be 1, meaning no alignment. The maximum
8894 allowed n option value is 65536.
8895
8896 Enabled at levels -O2, -O3.
8897
8898 -falign-loops
8899 -falign-loops=n
8900 -falign-loops=n:m
8901 -falign-loops=n:m:n2
8902 -falign-loops=n:m:n2:m2
8903 Align loops to a power-of-two boundary. If the loops are executed
8904 many times, this makes up for any execution of the dummy padding
8905 instructions.
8906
8907 If -falign-labels is greater than this value, then its value is
8908 used instead.
8909
8910 Parameters of this option are analogous to the -falign-functions
8911 option. -fno-align-loops and -falign-loops=1 are equivalent and
8912 mean that loops are not aligned. The maximum allowed n option
8913 value is 65536.
8914
8915 If n is not specified or is zero, use a machine-dependent default.
8916
8917 Enabled at levels -O2, -O3.
8918
8919 -falign-jumps
8920 -falign-jumps=n
8921 -falign-jumps=n:m
8922 -falign-jumps=n:m:n2
8923 -falign-jumps=n:m:n2:m2
8924 Align branch targets to a power-of-two boundary, for branch targets
8925 where the targets can only be reached by jumping. In this case, no
8926 dummy operations need be executed.
8927
8928 If -falign-labels is greater than this value, then its value is
8929 used instead.
8930
8931 Parameters of this option are analogous to the -falign-functions
8932 option. -fno-align-jumps and -falign-jumps=1 are equivalent and
8933 mean that loops are not aligned.
8934
8935 If n is not specified or is zero, use a machine-dependent default.
8936 The maximum allowed n option value is 65536.
8937
8938 Enabled at levels -O2, -O3.
8939
8940 -fno-allocation-dce
8941 Do not remove unused C++ allocations in dead code elimination.
8942
8943 -fallow-store-data-races
8944 Allow the compiler to introduce new data races on stores.
8945
8946 Enabled at level -Ofast.
8947
8948 -funit-at-a-time
8949 This option is left for compatibility reasons. -funit-at-a-time has
8950 no effect, while -fno-unit-at-a-time implies -fno-toplevel-reorder
8951 and -fno-section-anchors.
8952
8953 Enabled by default.
8954
8955 -fno-toplevel-reorder
8956 Do not reorder top-level functions, variables, and "asm"
8957 statements. Output them in the same order that they appear in the
8958 input file. When this option is used, unreferenced static
8959 variables are not removed. This option is intended to support
8960 existing code that relies on a particular ordering. For new code,
8961 it is better to use attributes when possible.
8962
8963 -ftoplevel-reorder is the default at -O1 and higher, and also at
8964 -O0 if -fsection-anchors is explicitly requested. Additionally
8965 -fno-toplevel-reorder implies -fno-section-anchors.
8966
8967 -fweb
8968 Constructs webs as commonly used for register allocation purposes
8969 and assign each web individual pseudo register. This allows the
8970 register allocation pass to operate on pseudos directly, but also
8971 strengthens several other optimization passes, such as CSE, loop
8972 optimizer and trivial dead code remover. It can, however, make
8973 debugging impossible, since variables no longer stay in a "home
8974 register".
8975
8976 Enabled by default with -funroll-loops.
8977
8978 -fwhole-program
8979 Assume that the current compilation unit represents the whole
8980 program being compiled. All public functions and variables with
8981 the exception of "main" and those merged by attribute
8982 "externally_visible" become static functions and in effect are
8983 optimized more aggressively by interprocedural optimizers.
8984
8985 This option should not be used in combination with -flto. Instead
8986 relying on a linker plugin should provide safer and more precise
8987 information.
8988
8989 -flto[=n]
8990 This option runs the standard link-time optimizer. When invoked
8991 with source code, it generates GIMPLE (one of GCC's internal
8992 representations) and writes it to special ELF sections in the
8993 object file. When the object files are linked together, all the
8994 function bodies are read from these ELF sections and instantiated
8995 as if they had been part of the same translation unit.
8996
8997 To use the link-time optimizer, -flto and optimization options
8998 should be specified at compile time and during the final link. It
8999 is recommended that you compile all the files participating in the
9000 same link with the same options and also specify those options at
9001 link time. For example:
9002
9003 gcc -c -O2 -flto foo.c
9004 gcc -c -O2 -flto bar.c
9005 gcc -o myprog -flto -O2 foo.o bar.o
9006
9007 The first two invocations to GCC save a bytecode representation of
9008 GIMPLE into special ELF sections inside foo.o and bar.o. The final
9009 invocation reads the GIMPLE bytecode from foo.o and bar.o, merges
9010 the two files into a single internal image, and compiles the result
9011 as usual. Since both foo.o and bar.o are merged into a single
9012 image, this causes all the interprocedural analyses and
9013 optimizations in GCC to work across the two files as if they were a
9014 single one. This means, for example, that the inliner is able to
9015 inline functions in bar.o into functions in foo.o and vice-versa.
9016
9017 Another (simpler) way to enable link-time optimization is:
9018
9019 gcc -o myprog -flto -O2 foo.c bar.c
9020
9021 The above generates bytecode for foo.c and bar.c, merges them
9022 together into a single GIMPLE representation and optimizes them as
9023 usual to produce myprog.
9024
9025 The important thing to keep in mind is that to enable link-time
9026 optimizations you need to use the GCC driver to perform the link
9027 step. GCC automatically performs link-time optimization if any of
9028 the objects involved were compiled with the -flto command-line
9029 option. You can always override the automatic decision to do link-
9030 time optimization by passing -fno-lto to the link command.
9031
9032 To make whole program optimization effective, it is necessary to
9033 make certain whole program assumptions. The compiler needs to know
9034 what functions and variables can be accessed by libraries and
9035 runtime outside of the link-time optimized unit. When supported by
9036 the linker, the linker plugin (see -fuse-linker-plugin) passes
9037 information to the compiler about used and externally visible
9038 symbols. When the linker plugin is not available, -fwhole-program
9039 should be used to allow the compiler to make these assumptions,
9040 which leads to more aggressive optimization decisions.
9041
9042 When a file is compiled with -flto without -fuse-linker-plugin, the
9043 generated object file is larger than a regular object file because
9044 it contains GIMPLE bytecodes and the usual final code (see
9045 -ffat-lto-objects. This means that object files with LTO
9046 information can be linked as normal object files; if -fno-lto is
9047 passed to the linker, no interprocedural optimizations are applied.
9048 Note that when -fno-fat-lto-objects is enabled the compile stage is
9049 faster but you cannot perform a regular, non-LTO link on them.
9050
9051 When producing the final binary, GCC only applies link-time
9052 optimizations to those files that contain bytecode. Therefore, you
9053 can mix and match object files and libraries with GIMPLE bytecodes
9054 and final object code. GCC automatically selects which files to
9055 optimize in LTO mode and which files to link without further
9056 processing.
9057
9058 Generally, options specified at link time override those specified
9059 at compile time, although in some cases GCC attempts to infer link-
9060 time options from the settings used to compile the input files.
9061
9062 If you do not specify an optimization level option -O at link time,
9063 then GCC uses the highest optimization level used when compiling
9064 the object files. Note that it is generally ineffective to specify
9065 an optimization level option only at link time and not at compile
9066 time, for two reasons. First, compiling without optimization
9067 suppresses compiler passes that gather information needed for
9068 effective optimization at link time. Second, some early
9069 optimization passes can be performed only at compile time and not
9070 at link time.
9071
9072 There are some code generation flags preserved by GCC when
9073 generating bytecodes, as they need to be used during the final
9074 link. Currently, the following options and their settings are
9075 taken from the first object file that explicitly specifies them:
9076 -fPIC, -fpic, -fpie, -fcommon, -fexceptions, -fnon-call-exceptions,
9077 -fgnu-tm and all the -m target flags.
9078
9079 Certain ABI-changing flags are required to match in all compilation
9080 units, and trying to override this at link time with a conflicting
9081 value is ignored. This includes options such as
9082 -freg-struct-return and -fpcc-struct-return.
9083
9084 Other options such as -ffp-contract, -fno-strict-overflow, -fwrapv,
9085 -fno-trapv or -fno-strict-aliasing are passed through to the link
9086 stage and merged conservatively for conflicting translation units.
9087 Specifically -fno-strict-overflow, -fwrapv and -fno-trapv take
9088 precedence; and for example -ffp-contract=off takes precedence over
9089 -ffp-contract=fast. You can override them at link time.
9090
9091 Diagnostic options such as -Wstringop-overflow are passed through
9092 to the link stage and their setting matches that of the compile-
9093 step at function granularity. Note that this matters only for
9094 diagnostics emitted during optimization. Note that code transforms
9095 such as inlining can lead to warnings being enabled or disabled for
9096 regions if code not consistent with the setting at compile time.
9097
9098 When you need to pass options to the assembler via -Wa or
9099 -Xassembler make sure to either compile such translation units with
9100 -fno-lto or consistently use the same assembler options on all
9101 translation units. You can alternatively also specify assembler
9102 options at LTO link time.
9103
9104 To enable debug info generation you need to supply -g at compile
9105 time. If any of the input files at link time were built with debug
9106 info generation enabled the link will enable debug info generation
9107 as well. Any elaborate debug info settings like the dwarf level
9108 -gdwarf-5 need to be explicitly repeated at the linker command line
9109 and mixing different settings in different translation units is
9110 discouraged.
9111
9112 If LTO encounters objects with C linkage declared with incompatible
9113 types in separate translation units to be linked together
9114 (undefined behavior according to ISO C99 6.2.7), a non-fatal
9115 diagnostic may be issued. The behavior is still undefined at run
9116 time. Similar diagnostics may be raised for other languages.
9117
9118 Another feature of LTO is that it is possible to apply
9119 interprocedural optimizations on files written in different
9120 languages:
9121
9122 gcc -c -flto foo.c
9123 g++ -c -flto bar.cc
9124 gfortran -c -flto baz.f90
9125 g++ -o myprog -flto -O3 foo.o bar.o baz.o -lgfortran
9126
9127 Notice that the final link is done with g++ to get the C++ runtime
9128 libraries and -lgfortran is added to get the Fortran runtime
9129 libraries. In general, when mixing languages in LTO mode, you
9130 should use the same link command options as when mixing languages
9131 in a regular (non-LTO) compilation.
9132
9133 If object files containing GIMPLE bytecode are stored in a library
9134 archive, say libfoo.a, it is possible to extract and use them in an
9135 LTO link if you are using a linker with plugin support. To create
9136 static libraries suitable for LTO, use gcc-ar and gcc-ranlib
9137 instead of ar and ranlib; to show the symbols of object files with
9138 GIMPLE bytecode, use gcc-nm. Those commands require that ar,
9139 ranlib and nm have been compiled with plugin support. At link
9140 time, use the flag -fuse-linker-plugin to ensure that the library
9141 participates in the LTO optimization process:
9142
9143 gcc -o myprog -O2 -flto -fuse-linker-plugin a.o b.o -lfoo
9144
9145 With the linker plugin enabled, the linker extracts the needed
9146 GIMPLE files from libfoo.a and passes them on to the running GCC to
9147 make them part of the aggregated GIMPLE image to be optimized.
9148
9149 If you are not using a linker with plugin support and/or do not
9150 enable the linker plugin, then the objects inside libfoo.a are
9151 extracted and linked as usual, but they do not participate in the
9152 LTO optimization process. In order to make a static library
9153 suitable for both LTO optimization and usual linkage, compile its
9154 object files with -flto -ffat-lto-objects.
9155
9156 Link-time optimizations do not require the presence of the whole
9157 program to operate. If the program does not require any symbols to
9158 be exported, it is possible to combine -flto and -fwhole-program to
9159 allow the interprocedural optimizers to use more aggressive
9160 assumptions which may lead to improved optimization opportunities.
9161 Use of -fwhole-program is not needed when linker plugin is active
9162 (see -fuse-linker-plugin).
9163
9164 The current implementation of LTO makes no attempt to generate
9165 bytecode that is portable between different types of hosts. The
9166 bytecode files are versioned and there is a strict version check,
9167 so bytecode files generated in one version of GCC do not work with
9168 an older or newer version of GCC.
9169
9170 Link-time optimization does not work well with generation of
9171 debugging information on systems other than those using a
9172 combination of ELF and DWARF.
9173
9174 If you specify the optional n, the optimization and code generation
9175 done at link time is executed in parallel using n parallel jobs by
9176 utilizing an installed make program. The environment variable MAKE
9177 may be used to override the program used.
9178
9179 You can also specify -flto=jobserver to use GNU make's job server
9180 mode to determine the number of parallel jobs. This is useful when
9181 the Makefile calling GCC is already executing in parallel. You
9182 must prepend a + to the command recipe in the parent Makefile for
9183 this to work. This option likely only works if MAKE is GNU make.
9184 Even without the option value, GCC tries to automatically detect a
9185 running GNU make's job server.
9186
9187 Use -flto=auto to use GNU make's job server, if available, or
9188 otherwise fall back to autodetection of the number of CPU threads
9189 present in your system.
9190
9191 -flto-partition=alg
9192 Specify the partitioning algorithm used by the link-time optimizer.
9193 The value is either 1to1 to specify a partitioning mirroring the
9194 original source files or balanced to specify partitioning into
9195 equally sized chunks (whenever possible) or max to create new
9196 partition for every symbol where possible. Specifying none as an
9197 algorithm disables partitioning and streaming completely. The
9198 default value is balanced. While 1to1 can be used as an workaround
9199 for various code ordering issues, the max partitioning is intended
9200 for internal testing only. The value one specifies that exactly
9201 one partition should be used while the value none bypasses
9202 partitioning and executes the link-time optimization step directly
9203 from the WPA phase.
9204
9205 -flto-compression-level=n
9206 This option specifies the level of compression used for
9207 intermediate language written to LTO object files, and is only
9208 meaningful in conjunction with LTO mode (-flto). Valid values are
9209 0 (no compression) to 9 (maximum compression). Values outside this
9210 range are clamped to either 0 or 9. If the option is not given, a
9211 default balanced compression setting is used.
9212
9213 -fuse-linker-plugin
9214 Enables the use of a linker plugin during link-time optimization.
9215 This option relies on plugin support in the linker, which is
9216 available in gold or in GNU ld 2.21 or newer.
9217
9218 This option enables the extraction of object files with GIMPLE
9219 bytecode out of library archives. This improves the quality of
9220 optimization by exposing more code to the link-time optimizer.
9221 This information specifies what symbols can be accessed externally
9222 (by non-LTO object or during dynamic linking). Resulting code
9223 quality improvements on binaries (and shared libraries that use
9224 hidden visibility) are similar to -fwhole-program. See -flto for a
9225 description of the effect of this flag and how to use it.
9226
9227 This option is enabled by default when LTO support in GCC is
9228 enabled and GCC was configured for use with a linker supporting
9229 plugins (GNU ld 2.21 or newer or gold).
9230
9231 -ffat-lto-objects
9232 Fat LTO objects are object files that contain both the intermediate
9233 language and the object code. This makes them usable for both LTO
9234 linking and normal linking. This option is effective only when
9235 compiling with -flto and is ignored at link time.
9236
9237 -fno-fat-lto-objects improves compilation time over plain LTO, but
9238 requires the complete toolchain to be aware of LTO. It requires a
9239 linker with linker plugin support for basic functionality.
9240 Additionally, nm, ar and ranlib need to support linker plugins to
9241 allow a full-featured build environment (capable of building static
9242 libraries etc). GCC provides the gcc-ar, gcc-nm, gcc-ranlib
9243 wrappers to pass the right options to these tools. With non fat LTO
9244 makefiles need to be modified to use them.
9245
9246 Note that modern binutils provide plugin auto-load mechanism.
9247 Installing the linker plugin into $libdir/bfd-plugins has the same
9248 effect as usage of the command wrappers (gcc-ar, gcc-nm and gcc-
9249 ranlib).
9250
9251 The default is -fno-fat-lto-objects on targets with linker plugin
9252 support.
9253
9254 -fcompare-elim
9255 After register allocation and post-register allocation instruction
9256 splitting, identify arithmetic instructions that compute processor
9257 flags similar to a comparison operation based on that arithmetic.
9258 If possible, eliminate the explicit comparison operation.
9259
9260 This pass only applies to certain targets that cannot explicitly
9261 represent the comparison operation before register allocation is
9262 complete.
9263
9264 Enabled at levels -O, -O2, -O3, -Os.
9265
9266 -fcprop-registers
9267 After register allocation and post-register allocation instruction
9268 splitting, perform a copy-propagation pass to try to reduce
9269 scheduling dependencies and occasionally eliminate the copy.
9270
9271 Enabled at levels -O, -O2, -O3, -Os.
9272
9273 -fprofile-correction
9274 Profiles collected using an instrumented binary for multi-threaded
9275 programs may be inconsistent due to missed counter updates. When
9276 this option is specified, GCC uses heuristics to correct or smooth
9277 out such inconsistencies. By default, GCC emits an error message
9278 when an inconsistent profile is detected.
9279
9280 This option is enabled by -fauto-profile.
9281
9282 -fprofile-partial-training
9283 With "-fprofile-use" all portions of programs not executed during
9284 train run are optimized agressively for size rather than speed. In
9285 some cases it is not practical to train all possible hot paths in
9286 the program. (For example, program may contain functions specific
9287 for a given hardware and trianing may not cover all hardware
9288 configurations program is run on.) With
9289 "-fprofile-partial-training" profile feedback will be ignored for
9290 all functions not executed during the train run leading them to be
9291 optimized as if they were compiled without profile feedback. This
9292 leads to better performance when train run is not representative
9293 but also leads to significantly bigger code.
9294
9295 -fprofile-use
9296 -fprofile-use=path
9297 Enable profile feedback-directed optimizations, and the following
9298 optimizations, many of which are generally profitable only with
9299 profile feedback available:
9300
9301 -fbranch-probabilities -fprofile-values -funroll-loops
9302 -fpeel-loops -ftracer -fvpt -finline-functions -fipa-cp
9303 -fipa-cp-clone -fipa-bit-cp -fpredictive-commoning -fsplit-loops
9304 -funswitch-loops -fgcse-after-reload -ftree-loop-vectorize
9305 -ftree-slp-vectorize -fvect-cost-model=dynamic
9306 -ftree-loop-distribute-patterns -fprofile-reorder-functions
9307
9308 Before you can use this option, you must first generate profiling
9309 information.
9310
9311 By default, GCC emits an error message if the feedback profiles do
9312 not match the source code. This error can be turned into a warning
9313 by using -Wno-error=coverage-mismatch. Note this may result in
9314 poorly optimized code. Additionally, by default, GCC also emits a
9315 warning message if the feedback profiles do not exist (see
9316 -Wmissing-profile).
9317
9318 If path is specified, GCC looks at the path to find the profile
9319 feedback data files. See -fprofile-dir.
9320
9321 -fauto-profile
9322 -fauto-profile=path
9323 Enable sampling-based feedback-directed optimizations, and the
9324 following optimizations, many of which are generally profitable
9325 only with profile feedback available:
9326
9327 -fbranch-probabilities -fprofile-values -funroll-loops
9328 -fpeel-loops -ftracer -fvpt -finline-functions -fipa-cp
9329 -fipa-cp-clone -fipa-bit-cp -fpredictive-commoning -fsplit-loops
9330 -funswitch-loops -fgcse-after-reload -ftree-loop-vectorize
9331 -ftree-slp-vectorize -fvect-cost-model=dynamic
9332 -ftree-loop-distribute-patterns -fprofile-correction
9333
9334 path is the name of a file containing AutoFDO profile information.
9335 If omitted, it defaults to fbdata.afdo in the current directory.
9336
9337 Producing an AutoFDO profile data file requires running your
9338 program with the perf utility on a supported GNU/Linux target
9339 system. For more information, see <https://perf.wiki.kernel.org/>.
9340
9341 E.g.
9342
9343 perf record -e br_inst_retired:near_taken -b -o perf.data \
9344 -- your_program
9345
9346 Then use the create_gcov tool to convert the raw profile data to a
9347 format that can be used by GCC. You must also supply the
9348 unstripped binary for your program to this tool. See
9349 <https://github.com/google/autofdo>.
9350
9351 E.g.
9352
9353 create_gcov --binary=your_program.unstripped --profile=perf.data \
9354 --gcov=profile.afdo
9355
9356 The following options control compiler behavior regarding floating-
9357 point arithmetic. These options trade off between speed and
9358 correctness. All must be specifically enabled.
9359
9360 -ffloat-store
9361 Do not store floating-point variables in registers, and inhibit
9362 other options that might change whether a floating-point value is
9363 taken from a register or memory.
9364
9365 This option prevents undesirable excess precision on machines such
9366 as the 68000 where the floating registers (of the 68881) keep more
9367 precision than a "double" is supposed to have. Similarly for the
9368 x86 architecture. For most programs, the excess precision does
9369 only good, but a few programs rely on the precise definition of
9370 IEEE floating point. Use -ffloat-store for such programs, after
9371 modifying them to store all pertinent intermediate computations
9372 into variables.
9373
9374 -fexcess-precision=style
9375 This option allows further control over excess precision on
9376 machines where floating-point operations occur in a format with
9377 more precision or range than the IEEE standard and interchange
9378 floating-point types. By default, -fexcess-precision=fast is in
9379 effect; this means that operations may be carried out in a wider
9380 precision than the types specified in the source if that would
9381 result in faster code, and it is unpredictable when rounding to the
9382 types specified in the source code takes place. When compiling C,
9383 if -fexcess-precision=standard is specified then excess precision
9384 follows the rules specified in ISO C99; in particular, both casts
9385 and assignments cause values to be rounded to their semantic types
9386 (whereas -ffloat-store only affects assignments). This option is
9387 enabled by default for C if a strict conformance option such as
9388 -std=c99 is used. -ffast-math enables -fexcess-precision=fast by
9389 default regardless of whether a strict conformance option is used.
9390
9391 -fexcess-precision=standard is not implemented for languages other
9392 than C. On the x86, it has no effect if -mfpmath=sse or
9393 -mfpmath=sse+387 is specified; in the former case, IEEE semantics
9394 apply without excess precision, and in the latter, rounding is
9395 unpredictable.
9396
9397 -ffast-math
9398 Sets the options -fno-math-errno, -funsafe-math-optimizations,
9399 -ffinite-math-only, -fno-rounding-math, -fno-signaling-nans,
9400 -fcx-limited-range and -fexcess-precision=fast.
9401
9402 This option causes the preprocessor macro "__FAST_MATH__" to be
9403 defined.
9404
9405 This option is not turned on by any -O option besides -Ofast since
9406 it can result in incorrect output for programs that depend on an
9407 exact implementation of IEEE or ISO rules/specifications for math
9408 functions. It may, however, yield faster code for programs that do
9409 not require the guarantees of these specifications.
9410
9411 -fno-math-errno
9412 Do not set "errno" after calling math functions that are executed
9413 with a single instruction, e.g., "sqrt". A program that relies on
9414 IEEE exceptions for math error handling may want to use this flag
9415 for speed while maintaining IEEE arithmetic compatibility.
9416
9417 This option is not turned on by any -O option since it can result
9418 in incorrect output for programs that depend on an exact
9419 implementation of IEEE or ISO rules/specifications for math
9420 functions. It may, however, yield faster code for programs that do
9421 not require the guarantees of these specifications.
9422
9423 The default is -fmath-errno.
9424
9425 On Darwin systems, the math library never sets "errno". There is
9426 therefore no reason for the compiler to consider the possibility
9427 that it might, and -fno-math-errno is the default.
9428
9429 -funsafe-math-optimizations
9430 Allow optimizations for floating-point arithmetic that (a) assume
9431 that arguments and results are valid and (b) may violate IEEE or
9432 ANSI standards. When used at link time, it may include libraries
9433 or startup files that change the default FPU control word or other
9434 similar optimizations.
9435
9436 This option is not turned on by any -O option since it can result
9437 in incorrect output for programs that depend on an exact
9438 implementation of IEEE or ISO rules/specifications for math
9439 functions. It may, however, yield faster code for programs that do
9440 not require the guarantees of these specifications. Enables
9441 -fno-signed-zeros, -fno-trapping-math, -fassociative-math and
9442 -freciprocal-math.
9443
9444 The default is -fno-unsafe-math-optimizations.
9445
9446 -fassociative-math
9447 Allow re-association of operands in series of floating-point
9448 operations. This violates the ISO C and C++ language standard by
9449 possibly changing computation result. NOTE: re-ordering may change
9450 the sign of zero as well as ignore NaNs and inhibit or create
9451 underflow or overflow (and thus cannot be used on code that relies
9452 on rounding behavior like "(x + 2**52) - 2**52". May also reorder
9453 floating-point comparisons and thus may not be used when ordered
9454 comparisons are required. This option requires that both
9455 -fno-signed-zeros and -fno-trapping-math be in effect. Moreover,
9456 it doesn't make much sense with -frounding-math. For Fortran the
9457 option is automatically enabled when both -fno-signed-zeros and
9458 -fno-trapping-math are in effect.
9459
9460 The default is -fno-associative-math.
9461
9462 -freciprocal-math
9463 Allow the reciprocal of a value to be used instead of dividing by
9464 the value if this enables optimizations. For example "x / y" can
9465 be replaced with "x * (1/y)", which is useful if "(1/y)" is subject
9466 to common subexpression elimination. Note that this loses
9467 precision and increases the number of flops operating on the value.
9468
9469 The default is -fno-reciprocal-math.
9470
9471 -ffinite-math-only
9472 Allow optimizations for floating-point arithmetic that assume that
9473 arguments and results are not NaNs or +-Infs.
9474
9475 This option is not turned on by any -O option since it can result
9476 in incorrect output for programs that depend on an exact
9477 implementation of IEEE or ISO rules/specifications for math
9478 functions. It may, however, yield faster code for programs that do
9479 not require the guarantees of these specifications.
9480
9481 The default is -fno-finite-math-only.
9482
9483 -fno-signed-zeros
9484 Allow optimizations for floating-point arithmetic that ignore the
9485 signedness of zero. IEEE arithmetic specifies the behavior of
9486 distinct +0.0 and -0.0 values, which then prohibits simplification
9487 of expressions such as x+0.0 or 0.0*x (even with
9488 -ffinite-math-only). This option implies that the sign of a zero
9489 result isn't significant.
9490
9491 The default is -fsigned-zeros.
9492
9493 -fno-trapping-math
9494 Compile code assuming that floating-point operations cannot
9495 generate user-visible traps. These traps include division by zero,
9496 overflow, underflow, inexact result and invalid operation. This
9497 option requires that -fno-signaling-nans be in effect. Setting
9498 this option may allow faster code if one relies on "non-stop" IEEE
9499 arithmetic, for example.
9500
9501 This option should never be turned on by any -O option since it can
9502 result in incorrect output for programs that depend on an exact
9503 implementation of IEEE or ISO rules/specifications for math
9504 functions.
9505
9506 The default is -ftrapping-math.
9507
9508 -frounding-math
9509 Disable transformations and optimizations that assume default
9510 floating-point rounding behavior. This is round-to-zero for all
9511 floating point to integer conversions, and round-to-nearest for all
9512 other arithmetic truncations. This option should be specified for
9513 programs that change the FP rounding mode dynamically, or that may
9514 be executed with a non-default rounding mode. This option disables
9515 constant folding of floating-point expressions at compile time
9516 (which may be affected by rounding mode) and arithmetic
9517 transformations that are unsafe in the presence of sign-dependent
9518 rounding modes.
9519
9520 The default is -fno-rounding-math.
9521
9522 This option is experimental and does not currently guarantee to
9523 disable all GCC optimizations that are affected by rounding mode.
9524 Future versions of GCC may provide finer control of this setting
9525 using C99's "FENV_ACCESS" pragma. This command-line option will be
9526 used to specify the default state for "FENV_ACCESS".
9527
9528 -fsignaling-nans
9529 Compile code assuming that IEEE signaling NaNs may generate user-
9530 visible traps during floating-point operations. Setting this
9531 option disables optimizations that may change the number of
9532 exceptions visible with signaling NaNs. This option implies
9533 -ftrapping-math.
9534
9535 This option causes the preprocessor macro "__SUPPORT_SNAN__" to be
9536 defined.
9537
9538 The default is -fno-signaling-nans.
9539
9540 This option is experimental and does not currently guarantee to
9541 disable all GCC optimizations that affect signaling NaN behavior.
9542
9543 -fno-fp-int-builtin-inexact
9544 Do not allow the built-in functions "ceil", "floor", "round" and
9545 "trunc", and their "float" and "long double" variants, to generate
9546 code that raises the "inexact" floating-point exception for
9547 noninteger arguments. ISO C99 and C11 allow these functions to
9548 raise the "inexact" exception, but ISO/IEC TS 18661-1:2014, the C
9549 bindings to IEEE 754-2008, as integrated into ISO C2X, does not
9550 allow these functions to do so.
9551
9552 The default is -ffp-int-builtin-inexact, allowing the exception to
9553 be raised, unless C2X or a later C standard is selected. This
9554 option does nothing unless -ftrapping-math is in effect.
9555
9556 Even if -fno-fp-int-builtin-inexact is used, if the functions
9557 generate a call to a library function then the "inexact" exception
9558 may be raised if the library implementation does not follow TS
9559 18661.
9560
9561 -fsingle-precision-constant
9562 Treat floating-point constants as single precision instead of
9563 implicitly converting them to double-precision constants.
9564
9565 -fcx-limited-range
9566 When enabled, this option states that a range reduction step is not
9567 needed when performing complex division. Also, there is no
9568 checking whether the result of a complex multiplication or division
9569 is "NaN + I*NaN", with an attempt to rescue the situation in that
9570 case. The default is -fno-cx-limited-range, but is enabled by
9571 -ffast-math.
9572
9573 This option controls the default setting of the ISO C99
9574 "CX_LIMITED_RANGE" pragma. Nevertheless, the option applies to all
9575 languages.
9576
9577 -fcx-fortran-rules
9578 Complex multiplication and division follow Fortran rules. Range
9579 reduction is done as part of complex division, but there is no
9580 checking whether the result of a complex multiplication or division
9581 is "NaN + I*NaN", with an attempt to rescue the situation in that
9582 case.
9583
9584 The default is -fno-cx-fortran-rules.
9585
9586 The following options control optimizations that may improve
9587 performance, but are not enabled by any -O options. This section
9588 includes experimental options that may produce broken code.
9589
9590 -fbranch-probabilities
9591 After running a program compiled with -fprofile-arcs, you can
9592 compile it a second time using -fbranch-probabilities, to improve
9593 optimizations based on the number of times each branch was taken.
9594 When a program compiled with -fprofile-arcs exits, it saves arc
9595 execution counts to a file called sourcename.gcda for each source
9596 file. The information in this data file is very dependent on the
9597 structure of the generated code, so you must use the same source
9598 code and the same optimization options for both compilations.
9599
9600 With -fbranch-probabilities, GCC puts a REG_BR_PROB note on each
9601 JUMP_INSN and CALL_INSN. These can be used to improve
9602 optimization. Currently, they are only used in one place: in
9603 reorg.c, instead of guessing which path a branch is most likely to
9604 take, the REG_BR_PROB values are used to exactly determine which
9605 path is taken more often.
9606
9607 Enabled by -fprofile-use and -fauto-profile.
9608
9609 -fprofile-values
9610 If combined with -fprofile-arcs, it adds code so that some data
9611 about values of expressions in the program is gathered.
9612
9613 With -fbranch-probabilities, it reads back the data gathered from
9614 profiling values of expressions for usage in optimizations.
9615
9616 Enabled by -fprofile-generate, -fprofile-use, and -fauto-profile.
9617
9618 -fprofile-reorder-functions
9619 Function reordering based on profile instrumentation collects first
9620 time of execution of a function and orders these functions in
9621 ascending order.
9622
9623 Enabled with -fprofile-use.
9624
9625 -fvpt
9626 If combined with -fprofile-arcs, this option instructs the compiler
9627 to add code to gather information about values of expressions.
9628
9629 With -fbranch-probabilities, it reads back the data gathered and
9630 actually performs the optimizations based on them. Currently the
9631 optimizations include specialization of division operations using
9632 the knowledge about the value of the denominator.
9633
9634 Enabled with -fprofile-use and -fauto-profile.
9635
9636 -frename-registers
9637 Attempt to avoid false dependencies in scheduled code by making use
9638 of registers left over after register allocation. This
9639 optimization most benefits processors with lots of registers.
9640 Depending on the debug information format adopted by the target,
9641 however, it can make debugging impossible, since variables no
9642 longer stay in a "home register".
9643
9644 Enabled by default with -funroll-loops.
9645
9646 -fschedule-fusion
9647 Performs a target dependent pass over the instruction stream to
9648 schedule instructions of same type together because target machine
9649 can execute them more efficiently if they are adjacent to each
9650 other in the instruction flow.
9651
9652 Enabled at levels -O2, -O3, -Os.
9653
9654 -ftracer
9655 Perform tail duplication to enlarge superblock size. This
9656 transformation simplifies the control flow of the function allowing
9657 other optimizations to do a better job.
9658
9659 Enabled by -fprofile-use and -fauto-profile.
9660
9661 -funroll-loops
9662 Unroll loops whose number of iterations can be determined at
9663 compile time or upon entry to the loop. -funroll-loops implies
9664 -frerun-cse-after-loop, -fweb and -frename-registers. It also
9665 turns on complete loop peeling (i.e. complete removal of loops with
9666 a small constant number of iterations). This option makes code
9667 larger, and may or may not make it run faster.
9668
9669 Enabled by -fprofile-use and -fauto-profile.
9670
9671 -funroll-all-loops
9672 Unroll all loops, even if their number of iterations is uncertain
9673 when the loop is entered. This usually makes programs run more
9674 slowly. -funroll-all-loops implies the same options as
9675 -funroll-loops.
9676
9677 -fpeel-loops
9678 Peels loops for which there is enough information that they do not
9679 roll much (from profile feedback or static analysis). It also
9680 turns on complete loop peeling (i.e. complete removal of loops with
9681 small constant number of iterations).
9682
9683 Enabled by -O3, -fprofile-use, and -fauto-profile.
9684
9685 -fmove-loop-invariants
9686 Enables the loop invariant motion pass in the RTL loop optimizer.
9687 Enabled at level -O1 and higher, except for -Og.
9688
9689 -fsplit-loops
9690 Split a loop into two if it contains a condition that's always true
9691 for one side of the iteration space and false for the other.
9692
9693 Enabled by -fprofile-use and -fauto-profile.
9694
9695 -funswitch-loops
9696 Move branches with loop invariant conditions out of the loop, with
9697 duplicates of the loop on both branches (modified according to
9698 result of the condition).
9699
9700 Enabled by -fprofile-use and -fauto-profile.
9701
9702 -fversion-loops-for-strides
9703 If a loop iterates over an array with a variable stride, create
9704 another version of the loop that assumes the stride is always one.
9705 For example:
9706
9707 for (int i = 0; i < n; ++i)
9708 x[i * stride] = ...;
9709
9710 becomes:
9711
9712 if (stride == 1)
9713 for (int i = 0; i < n; ++i)
9714 x[i] = ...;
9715 else
9716 for (int i = 0; i < n; ++i)
9717 x[i * stride] = ...;
9718
9719 This is particularly useful for assumed-shape arrays in Fortran
9720 where (for example) it allows better vectorization assuming
9721 contiguous accesses. This flag is enabled by default at -O3. It
9722 is also enabled by -fprofile-use and -fauto-profile.
9723
9724 -ffunction-sections
9725 -fdata-sections
9726 Place each function or data item into its own section in the output
9727 file if the target supports arbitrary sections. The name of the
9728 function or the name of the data item determines the section's name
9729 in the output file.
9730
9731 Use these options on systems where the linker can perform
9732 optimizations to improve locality of reference in the instruction
9733 space. Most systems using the ELF object format have linkers with
9734 such optimizations. On AIX, the linker rearranges sections
9735 (CSECTs) based on the call graph. The performance impact varies.
9736
9737 Together with a linker garbage collection (linker --gc-sections
9738 option) these options may lead to smaller statically-linked
9739 executables (after stripping).
9740
9741 On ELF/DWARF systems these options do not degenerate the quality of
9742 the debug information. There could be issues with other object
9743 files/debug info formats.
9744
9745 Only use these options when there are significant benefits from
9746 doing so. When you specify these options, the assembler and linker
9747 create larger object and executable files and are also slower.
9748 These options affect code generation. They prevent optimizations
9749 by the compiler and assembler using relative locations inside a
9750 translation unit since the locations are unknown until link time.
9751 An example of such an optimization is relaxing calls to short call
9752 instructions.
9753
9754 -fstdarg-opt
9755 Optimize the prologue of variadic argument functions with respect
9756 to usage of those arguments.
9757
9758 -fsection-anchors
9759 Try to reduce the number of symbolic address calculations by using
9760 shared "anchor" symbols to address nearby objects. This
9761 transformation can help to reduce the number of GOT entries and GOT
9762 accesses on some targets.
9763
9764 For example, the implementation of the following function "foo":
9765
9766 static int a, b, c;
9767 int foo (void) { return a + b + c; }
9768
9769 usually calculates the addresses of all three variables, but if you
9770 compile it with -fsection-anchors, it accesses the variables from a
9771 common anchor point instead. The effect is similar to the
9772 following pseudocode (which isn't valid C):
9773
9774 int foo (void)
9775 {
9776 register int *xr = &x;
9777 return xr[&a - &x] + xr[&b - &x] + xr[&c - &x];
9778 }
9779
9780 Not all targets support this option.
9781
9782 --param name=value
9783 In some places, GCC uses various constants to control the amount of
9784 optimization that is done. For example, GCC does not inline
9785 functions that contain more than a certain number of instructions.
9786 You can control some of these constants on the command line using
9787 the --param option.
9788
9789 The names of specific parameters, and the meaning of the values,
9790 are tied to the internals of the compiler, and are subject to
9791 change without notice in future releases.
9792
9793 In order to get minimal, maximal and default value of a parameter,
9794 one can use --help=param -Q options.
9795
9796 In each case, the value is an integer. The following choices of
9797 name are recognized for all targets:
9798
9799 predictable-branch-outcome
9800 When branch is predicted to be taken with probability lower
9801 than this threshold (in percent), then it is considered well
9802 predictable.
9803
9804 max-rtl-if-conversion-insns
9805 RTL if-conversion tries to remove conditional branches around a
9806 block and replace them with conditionally executed
9807 instructions. This parameter gives the maximum number of
9808 instructions in a block which should be considered for if-
9809 conversion. The compiler will also use other heuristics to
9810 decide whether if-conversion is likely to be profitable.
9811
9812 max-rtl-if-conversion-predictable-cost
9813 max-rtl-if-conversion-unpredictable-cost
9814 RTL if-conversion will try to remove conditional branches
9815 around a block and replace them with conditionally executed
9816 instructions. These parameters give the maximum permissible
9817 cost for the sequence that would be generated by if-conversion
9818 depending on whether the branch is statically determined to be
9819 predictable or not. The units for this parameter are the same
9820 as those for the GCC internal seq_cost metric. The compiler
9821 will try to provide a reasonable default for this parameter
9822 using the BRANCH_COST target macro.
9823
9824 max-crossjump-edges
9825 The maximum number of incoming edges to consider for cross-
9826 jumping. The algorithm used by -fcrossjumping is O(N^2) in the
9827 number of edges incoming to each block. Increasing values mean
9828 more aggressive optimization, making the compilation time
9829 increase with probably small improvement in executable size.
9830
9831 min-crossjump-insns
9832 The minimum number of instructions that must be matched at the
9833 end of two blocks before cross-jumping is performed on them.
9834 This value is ignored in the case where all instructions in the
9835 block being cross-jumped from are matched.
9836
9837 max-grow-copy-bb-insns
9838 The maximum code size expansion factor when copying basic
9839 blocks instead of jumping. The expansion is relative to a jump
9840 instruction.
9841
9842 max-goto-duplication-insns
9843 The maximum number of instructions to duplicate to a block that
9844 jumps to a computed goto. To avoid O(N^2) behavior in a number
9845 of passes, GCC factors computed gotos early in the compilation
9846 process, and unfactors them as late as possible. Only computed
9847 jumps at the end of a basic blocks with no more than max-goto-
9848 duplication-insns are unfactored.
9849
9850 max-delay-slot-insn-search
9851 The maximum number of instructions to consider when looking for
9852 an instruction to fill a delay slot. If more than this
9853 arbitrary number of instructions are searched, the time savings
9854 from filling the delay slot are minimal, so stop searching.
9855 Increasing values mean more aggressive optimization, making the
9856 compilation time increase with probably small improvement in
9857 execution time.
9858
9859 max-delay-slot-live-search
9860 When trying to fill delay slots, the maximum number of
9861 instructions to consider when searching for a block with valid
9862 live register information. Increasing this arbitrarily chosen
9863 value means more aggressive optimization, increasing the
9864 compilation time. This parameter should be removed when the
9865 delay slot code is rewritten to maintain the control-flow
9866 graph.
9867
9868 max-gcse-memory
9869 The approximate maximum amount of memory that can be allocated
9870 in order to perform the global common subexpression elimination
9871 optimization. If more memory than specified is required, the
9872 optimization is not done.
9873
9874 max-gcse-insertion-ratio
9875 If the ratio of expression insertions to deletions is larger
9876 than this value for any expression, then RTL PRE inserts or
9877 removes the expression and thus leaves partially redundant
9878 computations in the instruction stream.
9879
9880 max-pending-list-length
9881 The maximum number of pending dependencies scheduling allows
9882 before flushing the current state and starting over. Large
9883 functions with few branches or calls can create excessively
9884 large lists which needlessly consume memory and resources.
9885
9886 max-modulo-backtrack-attempts
9887 The maximum number of backtrack attempts the scheduler should
9888 make when modulo scheduling a loop. Larger values can
9889 exponentially increase compilation time.
9890
9891 max-inline-insns-single
9892 Several parameters control the tree inliner used in GCC. This
9893 number sets the maximum number of instructions (counted in
9894 GCC's internal representation) in a single function that the
9895 tree inliner considers for inlining. This only affects
9896 functions declared inline and methods implemented in a class
9897 declaration (C++).
9898
9899 max-inline-insns-auto
9900 When you use -finline-functions (included in -O3), a lot of
9901 functions that would otherwise not be considered for inlining
9902 by the compiler are investigated. To those functions, a
9903 different (more restrictive) limit compared to functions
9904 declared inline can be applied (--param max-inline-insns-auto).
9905
9906 max-inline-insns-small
9907 This is bound applied to calls which are considered relevant
9908 with -finline-small-functions.
9909
9910 max-inline-insns-size
9911 This is bound applied to calls which are optimized for size.
9912 Small growth may be desirable to anticipate optimization
9913 oppurtunities exposed by inlining.
9914
9915 uninlined-function-insns
9916 Number of instructions accounted by inliner for function
9917 overhead such as function prologue and epilogue.
9918
9919 uninlined-function-time
9920 Extra time accounted by inliner for function overhead such as
9921 time needed to execute function prologue and epilogue
9922
9923 inline-heuristics-hint-percent
9924 The scale (in percents) applied to inline-insns-single,
9925 inline-insns-single-O2, inline-insns-auto when inline
9926 heuristics hints that inlining is very profitable (will enable
9927 later optimizations).
9928
9929 uninlined-thunk-insns
9930 uninlined-thunk-time
9931 Same as --param uninlined-function-insns and --param uninlined-
9932 function-time but applied to function thunks
9933
9934 inline-min-speedup
9935 When estimated performance improvement of caller + callee
9936 runtime exceeds this threshold (in percent), the function can
9937 be inlined regardless of the limit on --param max-inline-insns-
9938 single and --param max-inline-insns-auto.
9939
9940 large-function-insns
9941 The limit specifying really large functions. For functions
9942 larger than this limit after inlining, inlining is constrained
9943 by --param large-function-growth. This parameter is useful
9944 primarily to avoid extreme compilation time caused by non-
9945 linear algorithms used by the back end.
9946
9947 large-function-growth
9948 Specifies maximal growth of large function caused by inlining
9949 in percents. For example, parameter value 100 limits large
9950 function growth to 2.0 times the original size.
9951
9952 large-unit-insns
9953 The limit specifying large translation unit. Growth caused by
9954 inlining of units larger than this limit is limited by --param
9955 inline-unit-growth. For small units this might be too tight.
9956 For example, consider a unit consisting of function A that is
9957 inline and B that just calls A three times. If B is small
9958 relative to A, the growth of unit is 300\% and yet such
9959 inlining is very sane. For very large units consisting of
9960 small inlineable functions, however, the overall unit growth
9961 limit is needed to avoid exponential explosion of code size.
9962 Thus for smaller units, the size is increased to --param large-
9963 unit-insns before applying --param inline-unit-growth.
9964
9965 inline-unit-growth
9966 Specifies maximal overall growth of the compilation unit caused
9967 by inlining. For example, parameter value 20 limits unit
9968 growth to 1.2 times the original size. Cold functions (either
9969 marked cold via an attribute or by profile feedback) are not
9970 accounted into the unit size.
9971
9972 ipa-cp-unit-growth
9973 Specifies maximal overall growth of the compilation unit caused
9974 by interprocedural constant propagation. For example,
9975 parameter value 10 limits unit growth to 1.1 times the original
9976 size.
9977
9978 large-stack-frame
9979 The limit specifying large stack frames. While inlining the
9980 algorithm is trying to not grow past this limit too much.
9981
9982 large-stack-frame-growth
9983 Specifies maximal growth of large stack frames caused by
9984 inlining in percents. For example, parameter value 1000 limits
9985 large stack frame growth to 11 times the original size.
9986
9987 max-inline-insns-recursive
9988 max-inline-insns-recursive-auto
9989 Specifies the maximum number of instructions an out-of-line
9990 copy of a self-recursive inline function can grow into by
9991 performing recursive inlining.
9992
9993 --param max-inline-insns-recursive applies to functions
9994 declared inline. For functions not declared inline, recursive
9995 inlining happens only when -finline-functions (included in -O3)
9996 is enabled; --param max-inline-insns-recursive-auto applies
9997 instead.
9998
9999 max-inline-recursive-depth
10000 max-inline-recursive-depth-auto
10001 Specifies the maximum recursion depth used for recursive
10002 inlining.
10003
10004 --param max-inline-recursive-depth applies to functions
10005 declared inline. For functions not declared inline, recursive
10006 inlining happens only when -finline-functions (included in -O3)
10007 is enabled; --param max-inline-recursive-depth-auto applies
10008 instead.
10009
10010 min-inline-recursive-probability
10011 Recursive inlining is profitable only for function having deep
10012 recursion in average and can hurt for function having little
10013 recursion depth by increasing the prologue size or complexity
10014 of function body to other optimizers.
10015
10016 When profile feedback is available (see -fprofile-generate) the
10017 actual recursion depth can be guessed from the probability that
10018 function recurses via a given call expression. This parameter
10019 limits inlining only to call expressions whose probability
10020 exceeds the given threshold (in percents).
10021
10022 early-inlining-insns
10023 Specify growth that the early inliner can make. In effect it
10024 increases the amount of inlining for code having a large
10025 abstraction penalty.
10026
10027 max-early-inliner-iterations
10028 Limit of iterations of the early inliner. This basically
10029 bounds the number of nested indirect calls the early inliner
10030 can resolve. Deeper chains are still handled by late inlining.
10031
10032 comdat-sharing-probability
10033 Probability (in percent) that C++ inline function with comdat
10034 visibility are shared across multiple compilation units.
10035
10036 profile-func-internal-id
10037 A parameter to control whether to use function internal id in
10038 profile database lookup. If the value is 0, the compiler uses
10039 an id that is based on function assembler name and filename,
10040 which makes old profile data more tolerant to source changes
10041 such as function reordering etc.
10042
10043 min-vect-loop-bound
10044 The minimum number of iterations under which loops are not
10045 vectorized when -ftree-vectorize is used. The number of
10046 iterations after vectorization needs to be greater than the
10047 value specified by this option to allow vectorization.
10048
10049 gcse-cost-distance-ratio
10050 Scaling factor in calculation of maximum distance an expression
10051 can be moved by GCSE optimizations. This is currently
10052 supported only in the code hoisting pass. The bigger the
10053 ratio, the more aggressive code hoisting is with simple
10054 expressions, i.e., the expressions that have cost less than
10055 gcse-unrestricted-cost. Specifying 0 disables hoisting of
10056 simple expressions.
10057
10058 gcse-unrestricted-cost
10059 Cost, roughly measured as the cost of a single typical machine
10060 instruction, at which GCSE optimizations do not constrain the
10061 distance an expression can travel. This is currently supported
10062 only in the code hoisting pass. The lesser the cost, the more
10063 aggressive code hoisting is. Specifying 0 allows all
10064 expressions to travel unrestricted distances.
10065
10066 max-hoist-depth
10067 The depth of search in the dominator tree for expressions to
10068 hoist. This is used to avoid quadratic behavior in hoisting
10069 algorithm. The value of 0 does not limit on the search, but
10070 may slow down compilation of huge functions.
10071
10072 max-tail-merge-comparisons
10073 The maximum amount of similar bbs to compare a bb with. This
10074 is used to avoid quadratic behavior in tree tail merging.
10075
10076 max-tail-merge-iterations
10077 The maximum amount of iterations of the pass over the function.
10078 This is used to limit compilation time in tree tail merging.
10079
10080 store-merging-allow-unaligned
10081 Allow the store merging pass to introduce unaligned stores if
10082 it is legal to do so.
10083
10084 max-stores-to-merge
10085 The maximum number of stores to attempt to merge into wider
10086 stores in the store merging pass.
10087
10088 max-unrolled-insns
10089 The maximum number of instructions that a loop may have to be
10090 unrolled. If a loop is unrolled, this parameter also
10091 determines how many times the loop code is unrolled.
10092
10093 max-average-unrolled-insns
10094 The maximum number of instructions biased by probabilities of
10095 their execution that a loop may have to be unrolled. If a loop
10096 is unrolled, this parameter also determines how many times the
10097 loop code is unrolled.
10098
10099 max-unroll-times
10100 The maximum number of unrollings of a single loop.
10101
10102 max-peeled-insns
10103 The maximum number of instructions that a loop may have to be
10104 peeled. If a loop is peeled, this parameter also determines
10105 how many times the loop code is peeled.
10106
10107 max-peel-times
10108 The maximum number of peelings of a single loop.
10109
10110 max-peel-branches
10111 The maximum number of branches on the hot path through the
10112 peeled sequence.
10113
10114 max-completely-peeled-insns
10115 The maximum number of insns of a completely peeled loop.
10116
10117 max-completely-peel-times
10118 The maximum number of iterations of a loop to be suitable for
10119 complete peeling.
10120
10121 max-completely-peel-loop-nest-depth
10122 The maximum depth of a loop nest suitable for complete peeling.
10123
10124 max-unswitch-insns
10125 The maximum number of insns of an unswitched loop.
10126
10127 max-unswitch-level
10128 The maximum number of branches unswitched in a single loop.
10129
10130 lim-expensive
10131 The minimum cost of an expensive expression in the loop
10132 invariant motion.
10133
10134 min-loop-cond-split-prob
10135 When FDO profile information is available, min-loop-cond-split-
10136 prob specifies minimum threshold for probability of semi-
10137 invariant condition statement to trigger loop split.
10138
10139 iv-consider-all-candidates-bound
10140 Bound on number of candidates for induction variables, below
10141 which all candidates are considered for each use in induction
10142 variable optimizations. If there are more candidates than
10143 this, only the most relevant ones are considered to avoid
10144 quadratic time complexity.
10145
10146 iv-max-considered-uses
10147 The induction variable optimizations give up on loops that
10148 contain more induction variable uses.
10149
10150 iv-always-prune-cand-set-bound
10151 If the number of candidates in the set is smaller than this
10152 value, always try to remove unnecessary ivs from the set when
10153 adding a new one.
10154
10155 avg-loop-niter
10156 Average number of iterations of a loop.
10157
10158 dse-max-object-size
10159 Maximum size (in bytes) of objects tracked bytewise by dead
10160 store elimination. Larger values may result in larger
10161 compilation times.
10162
10163 dse-max-alias-queries-per-store
10164 Maximum number of queries into the alias oracle per store.
10165 Larger values result in larger compilation times and may result
10166 in more removed dead stores.
10167
10168 scev-max-expr-size
10169 Bound on size of expressions used in the scalar evolutions
10170 analyzer. Large expressions slow the analyzer.
10171
10172 scev-max-expr-complexity
10173 Bound on the complexity of the expressions in the scalar
10174 evolutions analyzer. Complex expressions slow the analyzer.
10175
10176 max-tree-if-conversion-phi-args
10177 Maximum number of arguments in a PHI supported by TREE if
10178 conversion unless the loop is marked with simd pragma.
10179
10180 vect-max-version-for-alignment-checks
10181 The maximum number of run-time checks that can be performed
10182 when doing loop versioning for alignment in the vectorizer.
10183
10184 vect-max-version-for-alias-checks
10185 The maximum number of run-time checks that can be performed
10186 when doing loop versioning for alias in the vectorizer.
10187
10188 vect-max-peeling-for-alignment
10189 The maximum number of loop peels to enhance access alignment
10190 for vectorizer. Value -1 means no limit.
10191
10192 max-iterations-to-track
10193 The maximum number of iterations of a loop the brute-force
10194 algorithm for analysis of the number of iterations of the loop
10195 tries to evaluate.
10196
10197 hot-bb-count-fraction
10198 The denominator n of fraction 1/n of the maximal execution
10199 count of a basic block in the entire program that a basic block
10200 needs to at least have in order to be considered hot. The
10201 default is 10000, which means that a basic block is considered
10202 hot if its execution count is greater than 1/10000 of the
10203 maximal execution count. 0 means that it is never considered
10204 hot. Used in non-LTO mode.
10205
10206 hot-bb-count-ws-permille
10207 The number of most executed permilles, ranging from 0 to 1000,
10208 of the profiled execution of the entire program to which the
10209 execution count of a basic block must be part of in order to be
10210 considered hot. The default is 990, which means that a basic
10211 block is considered hot if its execution count contributes to
10212 the upper 990 permilles, or 99.0%, of the profiled execution of
10213 the entire program. 0 means that it is never considered hot.
10214 Used in LTO mode.
10215
10216 hot-bb-frequency-fraction
10217 The denominator n of fraction 1/n of the execution frequency of
10218 the entry block of a function that a basic block of this
10219 function needs to at least have in order to be considered hot.
10220 The default is 1000, which means that a basic block is
10221 considered hot in a function if it is executed more frequently
10222 than 1/1000 of the frequency of the entry block of the
10223 function. 0 means that it is never considered hot.
10224
10225 unlikely-bb-count-fraction
10226 The denominator n of fraction 1/n of the number of profiled
10227 runs of the entire program below which the execution count of a
10228 basic block must be in order for the basic block to be
10229 considered unlikely executed. The default is 20, which means
10230 that a basic block is considered unlikely executed if it is
10231 executed in fewer than 1/20, or 5%, of the runs of the program.
10232 0 means that it is always considered unlikely executed.
10233
10234 max-predicted-iterations
10235 The maximum number of loop iterations we predict statically.
10236 This is useful in cases where a function contains a single loop
10237 with known bound and another loop with unknown bound. The
10238 known number of iterations is predicted correctly, while the
10239 unknown number of iterations average to roughly 10. This means
10240 that the loop without bounds appears artificially cold relative
10241 to the other one.
10242
10243 builtin-expect-probability
10244 Control the probability of the expression having the specified
10245 value. This parameter takes a percentage (i.e. 0 ... 100) as
10246 input.
10247
10248 builtin-string-cmp-inline-length
10249 The maximum length of a constant string for a builtin string
10250 cmp call eligible for inlining.
10251
10252 align-threshold
10253 Select fraction of the maximal frequency of executions of a
10254 basic block in a function to align the basic block.
10255
10256 align-loop-iterations
10257 A loop expected to iterate at least the selected number of
10258 iterations is aligned.
10259
10260 tracer-dynamic-coverage
10261 tracer-dynamic-coverage-feedback
10262 This value is used to limit superblock formation once the given
10263 percentage of executed instructions is covered. This limits
10264 unnecessary code size expansion.
10265
10266 The tracer-dynamic-coverage-feedback parameter is used only
10267 when profile feedback is available. The real profiles (as
10268 opposed to statically estimated ones) are much less balanced
10269 allowing the threshold to be larger value.
10270
10271 tracer-max-code-growth
10272 Stop tail duplication once code growth has reached given
10273 percentage. This is a rather artificial limit, as most of the
10274 duplicates are eliminated later in cross jumping, so it may be
10275 set to much higher values than is the desired code growth.
10276
10277 tracer-min-branch-ratio
10278 Stop reverse growth when the reverse probability of best edge
10279 is less than this threshold (in percent).
10280
10281 tracer-min-branch-probability
10282 tracer-min-branch-probability-feedback
10283 Stop forward growth if the best edge has probability lower than
10284 this threshold.
10285
10286 Similarly to tracer-dynamic-coverage two parameters are
10287 provided. tracer-min-branch-probability-feedback is used for
10288 compilation with profile feedback and tracer-min-branch-
10289 probability compilation without. The value for compilation
10290 with profile feedback needs to be more conservative (higher) in
10291 order to make tracer effective.
10292
10293 stack-clash-protection-guard-size
10294 Specify the size of the operating system provided stack guard
10295 as 2 raised to num bytes. Higher values may reduce the number
10296 of explicit probes, but a value larger than the operating
10297 system provided guard will leave code vulnerable to stack clash
10298 style attacks.
10299
10300 stack-clash-protection-probe-interval
10301 Stack clash protection involves probing stack space as it is
10302 allocated. This param controls the maximum distance between
10303 probes into the stack as 2 raised to num bytes. Higher values
10304 may reduce the number of explicit probes, but a value larger
10305 than the operating system provided guard will leave code
10306 vulnerable to stack clash style attacks.
10307
10308 max-cse-path-length
10309 The maximum number of basic blocks on path that CSE considers.
10310
10311 max-cse-insns
10312 The maximum number of instructions CSE processes before
10313 flushing.
10314
10315 ggc-min-expand
10316 GCC uses a garbage collector to manage its own memory
10317 allocation. This parameter specifies the minimum percentage by
10318 which the garbage collector's heap should be allowed to expand
10319 between collections. Tuning this may improve compilation
10320 speed; it has no effect on code generation.
10321
10322 The default is 30% + 70% * (RAM/1GB) with an upper bound of
10323 100% when RAM >= 1GB. If "getrlimit" is available, the notion
10324 of "RAM" is the smallest of actual RAM and "RLIMIT_DATA" or
10325 "RLIMIT_AS". If GCC is not able to calculate RAM on a
10326 particular platform, the lower bound of 30% is used. Setting
10327 this parameter and ggc-min-heapsize to zero causes a full
10328 collection to occur at every opportunity. This is extremely
10329 slow, but can be useful for debugging.
10330
10331 ggc-min-heapsize
10332 Minimum size of the garbage collector's heap before it begins
10333 bothering to collect garbage. The first collection occurs
10334 after the heap expands by ggc-min-expand% beyond ggc-min-
10335 heapsize. Again, tuning this may improve compilation speed,
10336 and has no effect on code generation.
10337
10338 The default is the smaller of RAM/8, RLIMIT_RSS, or a limit
10339 that tries to ensure that RLIMIT_DATA or RLIMIT_AS are not
10340 exceeded, but with a lower bound of 4096 (four megabytes) and
10341 an upper bound of 131072 (128 megabytes). If GCC is not able
10342 to calculate RAM on a particular platform, the lower bound is
10343 used. Setting this parameter very large effectively disables
10344 garbage collection. Setting this parameter and ggc-min-expand
10345 to zero causes a full collection to occur at every opportunity.
10346
10347 max-reload-search-insns
10348 The maximum number of instruction reload should look backward
10349 for equivalent register. Increasing values mean more
10350 aggressive optimization, making the compilation time increase
10351 with probably slightly better performance.
10352
10353 max-cselib-memory-locations
10354 The maximum number of memory locations cselib should take into
10355 account. Increasing values mean more aggressive optimization,
10356 making the compilation time increase with probably slightly
10357 better performance.
10358
10359 max-sched-ready-insns
10360 The maximum number of instructions ready to be issued the
10361 scheduler should consider at any given time during the first
10362 scheduling pass. Increasing values mean more thorough
10363 searches, making the compilation time increase with probably
10364 little benefit.
10365
10366 max-sched-region-blocks
10367 The maximum number of blocks in a region to be considered for
10368 interblock scheduling.
10369
10370 max-pipeline-region-blocks
10371 The maximum number of blocks in a region to be considered for
10372 pipelining in the selective scheduler.
10373
10374 max-sched-region-insns
10375 The maximum number of insns in a region to be considered for
10376 interblock scheduling.
10377
10378 max-pipeline-region-insns
10379 The maximum number of insns in a region to be considered for
10380 pipelining in the selective scheduler.
10381
10382 min-spec-prob
10383 The minimum probability (in percents) of reaching a source
10384 block for interblock speculative scheduling.
10385
10386 max-sched-extend-regions-iters
10387 The maximum number of iterations through CFG to extend regions.
10388 A value of 0 disables region extensions.
10389
10390 max-sched-insn-conflict-delay
10391 The maximum conflict delay for an insn to be considered for
10392 speculative motion.
10393
10394 sched-spec-prob-cutoff
10395 The minimal probability of speculation success (in percents),
10396 so that speculative insns are scheduled.
10397
10398 sched-state-edge-prob-cutoff
10399 The minimum probability an edge must have for the scheduler to
10400 save its state across it.
10401
10402 sched-mem-true-dep-cost
10403 Minimal distance (in CPU cycles) between store and load
10404 targeting same memory locations.
10405
10406 selsched-max-lookahead
10407 The maximum size of the lookahead window of selective
10408 scheduling. It is a depth of search for available
10409 instructions.
10410
10411 selsched-max-sched-times
10412 The maximum number of times that an instruction is scheduled
10413 during selective scheduling. This is the limit on the number
10414 of iterations through which the instruction may be pipelined.
10415
10416 selsched-insns-to-rename
10417 The maximum number of best instructions in the ready list that
10418 are considered for renaming in the selective scheduler.
10419
10420 sms-min-sc
10421 The minimum value of stage count that swing modulo scheduler
10422 generates.
10423
10424 max-last-value-rtl
10425 The maximum size measured as number of RTLs that can be
10426 recorded in an expression in combiner for a pseudo register as
10427 last known value of that register.
10428
10429 max-combine-insns
10430 The maximum number of instructions the RTL combiner tries to
10431 combine.
10432
10433 integer-share-limit
10434 Small integer constants can use a shared data structure,
10435 reducing the compiler's memory usage and increasing its speed.
10436 This sets the maximum value of a shared integer constant.
10437
10438 ssp-buffer-size
10439 The minimum size of buffers (i.e. arrays) that receive stack
10440 smashing protection when -fstack-protection is used.
10441
10442 min-size-for-stack-sharing
10443 The minimum size of variables taking part in stack slot sharing
10444 when not optimizing.
10445
10446 max-jump-thread-duplication-stmts
10447 Maximum number of statements allowed in a block that needs to
10448 be duplicated when threading jumps.
10449
10450 max-fields-for-field-sensitive
10451 Maximum number of fields in a structure treated in a field
10452 sensitive manner during pointer analysis.
10453
10454 prefetch-latency
10455 Estimate on average number of instructions that are executed
10456 before prefetch finishes. The distance prefetched ahead is
10457 proportional to this constant. Increasing this number may also
10458 lead to less streams being prefetched (see simultaneous-
10459 prefetches).
10460
10461 simultaneous-prefetches
10462 Maximum number of prefetches that can run at the same time.
10463
10464 l1-cache-line-size
10465 The size of cache line in L1 data cache, in bytes.
10466
10467 l1-cache-size
10468 The size of L1 data cache, in kilobytes.
10469
10470 l2-cache-size
10471 The size of L2 data cache, in kilobytes.
10472
10473 prefetch-dynamic-strides
10474 Whether the loop array prefetch pass should issue software
10475 prefetch hints for strides that are non-constant. In some
10476 cases this may be beneficial, though the fact the stride is
10477 non-constant may make it hard to predict when there is clear
10478 benefit to issuing these hints.
10479
10480 Set to 1 if the prefetch hints should be issued for non-
10481 constant strides. Set to 0 if prefetch hints should be issued
10482 only for strides that are known to be constant and below
10483 prefetch-minimum-stride.
10484
10485 prefetch-minimum-stride
10486 Minimum constant stride, in bytes, to start using prefetch
10487 hints for. If the stride is less than this threshold, prefetch
10488 hints will not be issued.
10489
10490 This setting is useful for processors that have hardware
10491 prefetchers, in which case there may be conflicts between the
10492 hardware prefetchers and the software prefetchers. If the
10493 hardware prefetchers have a maximum stride they can handle, it
10494 should be used here to improve the use of software prefetchers.
10495
10496 A value of -1 means we don't have a threshold and therefore
10497 prefetch hints can be issued for any constant stride.
10498
10499 This setting is only useful for strides that are known and
10500 constant.
10501
10502 loop-interchange-max-num-stmts
10503 The maximum number of stmts in a loop to be interchanged.
10504
10505 loop-interchange-stride-ratio
10506 The minimum ratio between stride of two loops for interchange
10507 to be profitable.
10508
10509 min-insn-to-prefetch-ratio
10510 The minimum ratio between the number of instructions and the
10511 number of prefetches to enable prefetching in a loop.
10512
10513 prefetch-min-insn-to-mem-ratio
10514 The minimum ratio between the number of instructions and the
10515 number of memory references to enable prefetching in a loop.
10516
10517 use-canonical-types
10518 Whether the compiler should use the "canonical" type system.
10519 Should always be 1, which uses a more efficient internal
10520 mechanism for comparing types in C++ and Objective-C++.
10521 However, if bugs in the canonical type system are causing
10522 compilation failures, set this value to 0 to disable canonical
10523 types.
10524
10525 switch-conversion-max-branch-ratio
10526 Switch initialization conversion refuses to create arrays that
10527 are bigger than switch-conversion-max-branch-ratio times the
10528 number of branches in the switch.
10529
10530 max-partial-antic-length
10531 Maximum length of the partial antic set computed during the
10532 tree partial redundancy elimination optimization (-ftree-pre)
10533 when optimizing at -O3 and above. For some sorts of source
10534 code the enhanced partial redundancy elimination optimization
10535 can run away, consuming all of the memory available on the host
10536 machine. This parameter sets a limit on the length of the sets
10537 that are computed, which prevents the runaway behavior.
10538 Setting a value of 0 for this parameter allows an unlimited set
10539 length.
10540
10541 rpo-vn-max-loop-depth
10542 Maximum loop depth that is value-numbered optimistically. When
10543 the limit hits the innermost rpo-vn-max-loop-depth loops and
10544 the outermost loop in the loop nest are value-numbered
10545 optimistically and the remaining ones not.
10546
10547 sccvn-max-alias-queries-per-access
10548 Maximum number of alias-oracle queries we perform when looking
10549 for redundancies for loads and stores. If this limit is hit
10550 the search is aborted and the load or store is not considered
10551 redundant. The number of queries is algorithmically limited to
10552 the number of stores on all paths from the load to the function
10553 entry.
10554
10555 ira-max-loops-num
10556 IRA uses regional register allocation by default. If a
10557 function contains more loops than the number given by this
10558 parameter, only at most the given number of the most
10559 frequently-executed loops form regions for regional register
10560 allocation.
10561
10562 ira-max-conflict-table-size
10563 Although IRA uses a sophisticated algorithm to compress the
10564 conflict table, the table can still require excessive amounts
10565 of memory for huge functions. If the conflict table for a
10566 function could be more than the size in MB given by this
10567 parameter, the register allocator instead uses a faster,
10568 simpler, and lower-quality algorithm that does not require
10569 building a pseudo-register conflict table.
10570
10571 ira-loop-reserved-regs
10572 IRA can be used to evaluate more accurate register pressure in
10573 loops for decisions to move loop invariants (see -O3). The
10574 number of available registers reserved for some other purposes
10575 is given by this parameter. Default of the parameter is the
10576 best found from numerous experiments.
10577
10578 lra-inheritance-ebb-probability-cutoff
10579 LRA tries to reuse values reloaded in registers in subsequent
10580 insns. This optimization is called inheritance. EBB is used
10581 as a region to do this optimization. The parameter defines a
10582 minimal fall-through edge probability in percentage used to add
10583 BB to inheritance EBB in LRA. The default value was chosen
10584 from numerous runs of SPEC2000 on x86-64.
10585
10586 loop-invariant-max-bbs-in-loop
10587 Loop invariant motion can be very expensive, both in
10588 compilation time and in amount of needed compile-time memory,
10589 with very large loops. Loops with more basic blocks than this
10590 parameter won't have loop invariant motion optimization
10591 performed on them.
10592
10593 loop-max-datarefs-for-datadeps
10594 Building data dependencies is expensive for very large loops.
10595 This parameter limits the number of data references in loops
10596 that are considered for data dependence analysis. These large
10597 loops are no handled by the optimizations using loop data
10598 dependencies.
10599
10600 max-vartrack-size
10601 Sets a maximum number of hash table slots to use during
10602 variable tracking dataflow analysis of any function. If this
10603 limit is exceeded with variable tracking at assignments
10604 enabled, analysis for that function is retried without it,
10605 after removing all debug insns from the function. If the limit
10606 is exceeded even without debug insns, var tracking analysis is
10607 completely disabled for the function. Setting the parameter to
10608 zero makes it unlimited.
10609
10610 max-vartrack-expr-depth
10611 Sets a maximum number of recursion levels when attempting to
10612 map variable names or debug temporaries to value expressions.
10613 This trades compilation time for more complete debug
10614 information. If this is set too low, value expressions that
10615 are available and could be represented in debug information may
10616 end up not being used; setting this higher may enable the
10617 compiler to find more complex debug expressions, but compile
10618 time and memory use may grow.
10619
10620 max-debug-marker-count
10621 Sets a threshold on the number of debug markers (e.g. begin
10622 stmt markers) to avoid complexity explosion at inlining or
10623 expanding to RTL. If a function has more such gimple stmts
10624 than the set limit, such stmts will be dropped from the inlined
10625 copy of a function, and from its RTL expansion.
10626
10627 min-nondebug-insn-uid
10628 Use uids starting at this parameter for nondebug insns. The
10629 range below the parameter is reserved exclusively for debug
10630 insns created by -fvar-tracking-assignments, but debug insns
10631 may get (non-overlapping) uids above it if the reserved range
10632 is exhausted.
10633
10634 ipa-sra-ptr-growth-factor
10635 IPA-SRA replaces a pointer to an aggregate with one or more new
10636 parameters only when their cumulative size is less or equal to
10637 ipa-sra-ptr-growth-factor times the size of the original
10638 pointer parameter.
10639
10640 ipa-sra-max-replacements
10641 Maximum pieces of an aggregate that IPA-SRA tracks. As a
10642 consequence, it is also the maximum number of replacements of a
10643 formal parameter.
10644
10645 sra-max-scalarization-size-Ospeed
10646 sra-max-scalarization-size-Osize
10647 The two Scalar Reduction of Aggregates passes (SRA and IPA-SRA)
10648 aim to replace scalar parts of aggregates with uses of
10649 independent scalar variables. These parameters control the
10650 maximum size, in storage units, of aggregate which is
10651 considered for replacement when compiling for speed (sra-max-
10652 scalarization-size-Ospeed) or size (sra-max-scalarization-size-
10653 Osize) respectively.
10654
10655 sra-max-propagations
10656 The maximum number of artificial accesses that Scalar
10657 Replacement of Aggregates (SRA) will track, per one local
10658 variable, in order to facilitate copy propagation.
10659
10660 tm-max-aggregate-size
10661 When making copies of thread-local variables in a transaction,
10662 this parameter specifies the size in bytes after which
10663 variables are saved with the logging functions as opposed to
10664 save/restore code sequence pairs. This option only applies
10665 when using -fgnu-tm.
10666
10667 graphite-max-nb-scop-params
10668 To avoid exponential effects in the Graphite loop transforms,
10669 the number of parameters in a Static Control Part (SCoP) is
10670 bounded. A value of zero can be used to lift the bound. A
10671 variable whose value is unknown at compilation time and defined
10672 outside a SCoP is a parameter of the SCoP.
10673
10674 loop-block-tile-size
10675 Loop blocking or strip mining transforms, enabled with
10676 -floop-block or -floop-strip-mine, strip mine each loop in the
10677 loop nest by a given number of iterations. The strip length
10678 can be changed using the loop-block-tile-size parameter.
10679
10680 ipa-cp-value-list-size
10681 IPA-CP attempts to track all possible values and types passed
10682 to a function's parameter in order to propagate them and
10683 perform devirtualization. ipa-cp-value-list-size is the
10684 maximum number of values and types it stores per one formal
10685 parameter of a function.
10686
10687 ipa-cp-eval-threshold
10688 IPA-CP calculates its own score of cloning profitability
10689 heuristics and performs those cloning opportunities with scores
10690 that exceed ipa-cp-eval-threshold.
10691
10692 ipa-cp-max-recursive-depth
10693 Maximum depth of recursive cloning for self-recursive function.
10694
10695 ipa-cp-min-recursive-probability
10696 Recursive cloning only when the probability of call being
10697 executed exceeds the parameter.
10698
10699 ipa-cp-recursion-penalty
10700 Percentage penalty the recursive functions will receive when
10701 they are evaluated for cloning.
10702
10703 ipa-cp-single-call-penalty
10704 Percentage penalty functions containing a single call to
10705 another function will receive when they are evaluated for
10706 cloning.
10707
10708 ipa-max-agg-items
10709 IPA-CP is also capable to propagate a number of scalar values
10710 passed in an aggregate. ipa-max-agg-items controls the maximum
10711 number of such values per one parameter.
10712
10713 ipa-cp-loop-hint-bonus
10714 When IPA-CP determines that a cloning candidate would make the
10715 number of iterations of a loop known, it adds a bonus of ipa-
10716 cp-loop-hint-bonus to the profitability score of the candidate.
10717
10718 ipa-max-aa-steps
10719 During its analysis of function bodies, IPA-CP employs alias
10720 analysis in order to track values pointed to by function
10721 parameters. In order not spend too much time analyzing huge
10722 functions, it gives up and consider all memory clobbered after
10723 examining ipa-max-aa-steps statements modifying memory.
10724
10725 ipa-max-switch-predicate-bounds
10726 Maximal number of boundary endpoints of case ranges of switch
10727 statement. For switch exceeding this limit, IPA-CP will not
10728 construct cloning cost predicate, which is used to estimate
10729 cloning benefit, for default case of the switch statement.
10730
10731 ipa-max-param-expr-ops
10732 IPA-CP will analyze conditional statement that references some
10733 function parameter to estimate benefit for cloning upon certain
10734 constant value. But if number of operations in a parameter
10735 expression exceeds ipa-max-param-expr-ops, the expression is
10736 treated as complicated one, and is not handled by IPA analysis.
10737
10738 lto-partitions
10739 Specify desired number of partitions produced during WHOPR
10740 compilation. The number of partitions should exceed the number
10741 of CPUs used for compilation.
10742
10743 lto-min-partition
10744 Size of minimal partition for WHOPR (in estimated
10745 instructions). This prevents expenses of splitting very small
10746 programs into too many partitions.
10747
10748 lto-max-partition
10749 Size of max partition for WHOPR (in estimated instructions).
10750 to provide an upper bound for individual size of partition.
10751 Meant to be used only with balanced partitioning.
10752
10753 lto-max-streaming-parallelism
10754 Maximal number of parallel processes used for LTO streaming.
10755
10756 cxx-max-namespaces-for-diagnostic-help
10757 The maximum number of namespaces to consult for suggestions
10758 when C++ name lookup fails for an identifier.
10759
10760 sink-frequency-threshold
10761 The maximum relative execution frequency (in percents) of the
10762 target block relative to a statement's original block to allow
10763 statement sinking of a statement. Larger numbers result in
10764 more aggressive statement sinking. A small positive adjustment
10765 is applied for statements with memory operands as those are
10766 even more profitable so sink.
10767
10768 max-stores-to-sink
10769 The maximum number of conditional store pairs that can be sunk.
10770 Set to 0 if either vectorization (-ftree-vectorize) or if-
10771 conversion (-ftree-loop-if-convert) is disabled.
10772
10773 case-values-threshold
10774 The smallest number of different values for which it is best to
10775 use a jump-table instead of a tree of conditional branches. If
10776 the value is 0, use the default for the machine.
10777
10778 jump-table-max-growth-ratio-for-size
10779 The maximum code size growth ratio when expanding into a jump
10780 table (in percent). The parameter is used when optimizing for
10781 size.
10782
10783 jump-table-max-growth-ratio-for-speed
10784 The maximum code size growth ratio when expanding into a jump
10785 table (in percent). The parameter is used when optimizing for
10786 speed.
10787
10788 tree-reassoc-width
10789 Set the maximum number of instructions executed in parallel in
10790 reassociated tree. This parameter overrides target dependent
10791 heuristics used by default if has non zero value.
10792
10793 sched-pressure-algorithm
10794 Choose between the two available implementations of
10795 -fsched-pressure. Algorithm 1 is the original implementation
10796 and is the more likely to prevent instructions from being
10797 reordered. Algorithm 2 was designed to be a compromise between
10798 the relatively conservative approach taken by algorithm 1 and
10799 the rather aggressive approach taken by the default scheduler.
10800 It relies more heavily on having a regular register file and
10801 accurate register pressure classes. See haifa-sched.c in the
10802 GCC sources for more details.
10803
10804 The default choice depends on the target.
10805
10806 max-slsr-cand-scan
10807 Set the maximum number of existing candidates that are
10808 considered when seeking a basis for a new straight-line
10809 strength reduction candidate.
10810
10811 asan-globals
10812 Enable buffer overflow detection for global objects. This kind
10813 of protection is enabled by default if you are using
10814 -fsanitize=address option. To disable global objects
10815 protection use --param asan-globals=0.
10816
10817 asan-stack
10818 Enable buffer overflow detection for stack objects. This kind
10819 of protection is enabled by default when using
10820 -fsanitize=address. To disable stack protection use --param
10821 asan-stack=0 option.
10822
10823 asan-instrument-reads
10824 Enable buffer overflow detection for memory reads. This kind
10825 of protection is enabled by default when using
10826 -fsanitize=address. To disable memory reads protection use
10827 --param asan-instrument-reads=0.
10828
10829 asan-instrument-writes
10830 Enable buffer overflow detection for memory writes. This kind
10831 of protection is enabled by default when using
10832 -fsanitize=address. To disable memory writes protection use
10833 --param asan-instrument-writes=0 option.
10834
10835 asan-memintrin
10836 Enable detection for built-in functions. This kind of
10837 protection is enabled by default when using -fsanitize=address.
10838 To disable built-in functions protection use --param
10839 asan-memintrin=0.
10840
10841 asan-use-after-return
10842 Enable detection of use-after-return. This kind of protection
10843 is enabled by default when using the -fsanitize=address option.
10844 To disable it use --param asan-use-after-return=0.
10845
10846 Note: By default the check is disabled at run time. To enable
10847 it, add "detect_stack_use_after_return=1" to the environment
10848 variable ASAN_OPTIONS.
10849
10850 asan-instrumentation-with-call-threshold
10851 If number of memory accesses in function being instrumented is
10852 greater or equal to this number, use callbacks instead of
10853 inline checks. E.g. to disable inline code use --param
10854 asan-instrumentation-with-call-threshold=0.
10855
10856 use-after-scope-direct-emission-threshold
10857 If the size of a local variable in bytes is smaller or equal to
10858 this number, directly poison (or unpoison) shadow memory
10859 instead of using run-time callbacks.
10860
10861 max-fsm-thread-path-insns
10862 Maximum number of instructions to copy when duplicating blocks
10863 on a finite state automaton jump thread path.
10864
10865 max-fsm-thread-length
10866 Maximum number of basic blocks on a finite state automaton jump
10867 thread path.
10868
10869 max-fsm-thread-paths
10870 Maximum number of new jump thread paths to create for a finite
10871 state automaton.
10872
10873 parloops-chunk-size
10874 Chunk size of omp schedule for loops parallelized by parloops.
10875
10876 parloops-schedule
10877 Schedule type of omp schedule for loops parallelized by
10878 parloops (static, dynamic, guided, auto, runtime).
10879
10880 parloops-min-per-thread
10881 The minimum number of iterations per thread of an innermost
10882 parallelized loop for which the parallelized variant is
10883 preferred over the single threaded one. Note that for a
10884 parallelized loop nest the minimum number of iterations of the
10885 outermost loop per thread is two.
10886
10887 max-ssa-name-query-depth
10888 Maximum depth of recursion when querying properties of SSA
10889 names in things like fold routines. One level of recursion
10890 corresponds to following a use-def chain.
10891
10892 hsa-gen-debug-stores
10893 Enable emission of special debug stores within HSA kernels
10894 which are then read and reported by libgomp plugin. Generation
10895 of these stores is disabled by default, use --param
10896 hsa-gen-debug-stores=1 to enable it.
10897
10898 max-speculative-devirt-maydefs
10899 The maximum number of may-defs we analyze when looking for a
10900 must-def specifying the dynamic type of an object that invokes
10901 a virtual call we may be able to devirtualize speculatively.
10902
10903 max-vrp-switch-assertions
10904 The maximum number of assertions to add along the default edge
10905 of a switch statement during VRP.
10906
10907 unroll-jam-min-percent
10908 The minimum percentage of memory references that must be
10909 optimized away for the unroll-and-jam transformation to be
10910 considered profitable.
10911
10912 unroll-jam-max-unroll
10913 The maximum number of times the outer loop should be unrolled
10914 by the unroll-and-jam transformation.
10915
10916 max-rtl-if-conversion-unpredictable-cost
10917 Maximum permissible cost for the sequence that would be
10918 generated by the RTL if-conversion pass for a branch that is
10919 considered unpredictable.
10920
10921 max-variable-expansions-in-unroller
10922 If -fvariable-expansion-in-unroller is used, the maximum number
10923 of times that an individual variable will be expanded during
10924 loop unrolling.
10925
10926 tracer-min-branch-probability-feedback
10927 Stop forward growth if the probability of best edge is less
10928 than this threshold (in percent). Used when profile feedback is
10929 available.
10930
10931 partial-inlining-entry-probability
10932 Maximum probability of the entry BB of split region (in percent
10933 relative to entry BB of the function) to make partial inlining
10934 happen.
10935
10936 max-tracked-strlens
10937 Maximum number of strings for which strlen optimization pass
10938 will track string lengths.
10939
10940 gcse-after-reload-partial-fraction
10941 The threshold ratio for performing partial redundancy
10942 elimination after reload.
10943
10944 gcse-after-reload-critical-fraction
10945 The threshold ratio of critical edges execution count that
10946 permit performing redundancy elimination after reload.
10947
10948 max-loop-header-insns
10949 The maximum number of insns in loop header duplicated by the
10950 copy loop headers pass.
10951
10952 vect-epilogues-nomask
10953 Enable loop epilogue vectorization using smaller vector size.
10954
10955 slp-max-insns-in-bb
10956 Maximum number of instructions in basic block to be considered
10957 for SLP vectorization.
10958
10959 avoid-fma-max-bits
10960 Maximum number of bits for which we avoid creating FMAs.
10961
10962 sms-loop-average-count-threshold
10963 A threshold on the average loop count considered by the swing
10964 modulo scheduler.
10965
10966 sms-dfa-history
10967 The number of cycles the swing modulo scheduler considers when
10968 checking conflicts using DFA.
10969
10970 max-inline-insns-recursive-auto
10971 The maximum number of instructions non-inline function can grow
10972 to via recursive inlining.
10973
10974 graphite-allow-codegen-errors
10975 Whether codegen errors should be ICEs when -fchecking.
10976
10977 sms-max-ii-factor
10978 A factor for tuning the upper bound that swing modulo scheduler
10979 uses for scheduling a loop.
10980
10981 lra-max-considered-reload-pseudos
10982 The max number of reload pseudos which are considered during
10983 spilling a non-reload pseudo.
10984
10985 max-pow-sqrt-depth
10986 Maximum depth of sqrt chains to use when synthesizing
10987 exponentiation by a real constant.
10988
10989 max-dse-active-local-stores
10990 Maximum number of active local stores in RTL dead store
10991 elimination.
10992
10993 asan-instrument-allocas
10994 Enable asan allocas/VLAs protection.
10995
10996 max-iterations-computation-cost
10997 Bound on the cost of an expression to compute the number of
10998 iterations.
10999
11000 max-isl-operations
11001 Maximum number of isl operations, 0 means unlimited.
11002
11003 graphite-max-arrays-per-scop
11004 Maximum number of arrays per scop.
11005
11006 max-vartrack-reverse-op-size
11007 Max. size of loc list for which reverse ops should be added.
11008
11009 tracer-dynamic-coverage-feedback
11010 The percentage of function, weighted by execution frequency,
11011 that must be covered by trace formation. Used when profile
11012 feedback is available.
11013
11014 max-inline-recursive-depth-auto
11015 The maximum depth of recursive inlining for non-inline
11016 functions.
11017
11018 fsm-scale-path-stmts
11019 Scale factor to apply to the number of statements in a
11020 threading path when comparing to the number of (scaled) blocks.
11021
11022 fsm-maximum-phi-arguments
11023 Maximum number of arguments a PHI may have before the FSM
11024 threader will not try to thread through its block.
11025
11026 uninit-control-dep-attempts
11027 Maximum number of nested calls to search for control
11028 dependencies during uninitialized variable analysis.
11029
11030 sra-max-scalarization-size-Osize
11031 Maximum size, in storage units, of an aggregate which should be
11032 considered for scalarization when compiling for size.
11033
11034 fsm-scale-path-blocks
11035 Scale factor to apply to the number of blocks in a threading
11036 path when comparing to the number of (scaled) statements.
11037
11038 sched-autopref-queue-depth
11039 Hardware autoprefetcher scheduler model control flag. Number
11040 of lookahead cycles the model looks into; at ' ' only enable
11041 instruction sorting heuristic.
11042
11043 loop-versioning-max-inner-insns
11044 The maximum number of instructions that an inner loop can have
11045 before the loop versioning pass considers it too big to copy.
11046
11047 loop-versioning-max-outer-insns
11048 The maximum number of instructions that an outer loop can have
11049 before the loop versioning pass considers it too big to copy,
11050 discounting any instructions in inner loops that directly
11051 benefit from versioning.
11052
11053 ssa-name-def-chain-limit
11054 The maximum number of SSA_NAME assignments to follow in
11055 determining a property of a variable such as its value. This
11056 limits the number of iterations or recursive calls GCC performs
11057 when optimizing certain statements or when determining their
11058 validity prior to issuing diagnostics.
11059
11060 store-merging-max-size
11061 Maximum size of a single store merging region in bytes.
11062
11063 hash-table-verification-limit
11064 The number of elements for which hash table verification is
11065 done for each searched element.
11066
11067 max-find-base-term-values
11068 Maximum number of VALUEs handled during a single find_base_term
11069 call.
11070
11071 analyzer-max-enodes-per-program-point
11072 The maximum number of exploded nodes per program point within
11073 the analyzer, before terminating analysis of that point.
11074
11075 analyzer-min-snodes-for-call-summary
11076 The minimum number of supernodes within a function for the
11077 analyzer to consider summarizing its effects at call sites.
11078
11079 analyzer-max-recursion-depth
11080 The maximum number of times a callsite can appear in a call
11081 stack within the analyzer, before terminating analysis of a
11082 call that would recurse deeper.
11083
11084 gimple-fe-computed-hot-bb-threshold
11085 The number of executions of a basic block which is considered
11086 hot. The parameter is used only in GIMPLE FE.
11087
11088 analyzer-bb-explosion-factor
11089 The maximum number of 'after supernode' exploded nodes within
11090 the analyzer per supernode, before terminating analysis.
11091
11092 The following choices of name are available on AArch64 targets:
11093
11094 aarch64-sve-compare-costs
11095 When vectorizing for SVE, consider using "unpacked" vectors for
11096 smaller elements and use the cost model to pick the cheapest
11097 approach. Also use the cost model to choose between SVE and
11098 Advanced SIMD vectorization.
11099
11100 Using unpacked vectors includes storing smaller elements in
11101 larger containers and accessing elements with extending loads
11102 and truncating stores.
11103
11104 aarch64-float-recp-precision
11105 The number of Newton iterations for calculating the reciprocal
11106 for float type. The precision of division is proportional to
11107 this param when division approximation is enabled. The default
11108 value is 1.
11109
11110 aarch64-double-recp-precision
11111 The number of Newton iterations for calculating the reciprocal
11112 for double type. The precision of division is propotional to
11113 this param when division approximation is enabled. The default
11114 value is 2.
11115
11116 aarch64-autovec-preference
11117 Force an ISA selection strategy for auto-vectorization.
11118 Accepts values from 0 to 4, inclusive.
11119
11120 0 Use the default heuristics.
11121
11122 1 Use only Advanced SIMD for auto-vectorization.
11123
11124 2 Use only SVE for auto-vectorization.
11125
11126 3 Use both Advanced SIMD and SVE. Prefer Advanced SIMD when
11127 the costs are deemed equal.
11128
11129 4 Use both Advanced SIMD and SVE. Prefer SVE when the costs
11130 are deemed equal.
11131
11132 The default value is 0.
11133
11134 Program Instrumentation Options
11135 GCC supports a number of command-line options that control adding run-
11136 time instrumentation to the code it normally generates. For example,
11137 one purpose of instrumentation is collect profiling statistics for use
11138 in finding program hot spots, code coverage analysis, or profile-guided
11139 optimizations. Another class of program instrumentation is adding run-
11140 time checking to detect programming errors like invalid pointer
11141 dereferences or out-of-bounds array accesses, as well as deliberately
11142 hostile attacks such as stack smashing or C++ vtable hijacking. There
11143 is also a general hook which can be used to implement other forms of
11144 tracing or function-level instrumentation for debug or program analysis
11145 purposes.
11146
11147 -p
11148 -pg Generate extra code to write profile information suitable for the
11149 analysis program prof (for -p) or gprof (for -pg). You must use
11150 this option when compiling the source files you want data about,
11151 and you must also use it when linking.
11152
11153 You can use the function attribute "no_instrument_function" to
11154 suppress profiling of individual functions when compiling with
11155 these options.
11156
11157 -fprofile-arcs
11158 Add code so that program flow arcs are instrumented. During
11159 execution the program records how many times each branch and call
11160 is executed and how many times it is taken or returns. On targets
11161 that support constructors with priority support, profiling properly
11162 handles constructors, destructors and C++ constructors (and
11163 destructors) of classes which are used as a type of a global
11164 variable.
11165
11166 When the compiled program exits it saves this data to a file called
11167 auxname.gcda for each source file. The data may be used for
11168 profile-directed optimizations (-fbranch-probabilities), or for
11169 test coverage analysis (-ftest-coverage). Each object file's
11170 auxname is generated from the name of the output file, if
11171 explicitly specified and it is not the final executable, otherwise
11172 it is the basename of the source file. In both cases any suffix is
11173 removed (e.g. foo.gcda for input file dir/foo.c, or dir/foo.gcda
11174 for output file specified as -o dir/foo.o).
11175
11176 --coverage
11177 This option is used to compile and link code instrumented for
11178 coverage analysis. The option is a synonym for -fprofile-arcs
11179 -ftest-coverage (when compiling) and -lgcov (when linking). See
11180 the documentation for those options for more details.
11181
11182 * Compile the source files with -fprofile-arcs plus optimization
11183 and code generation options. For test coverage analysis, use
11184 the additional -ftest-coverage option. You do not need to
11185 profile every source file in a program.
11186
11187 * Compile the source files additionally with -fprofile-abs-path
11188 to create absolute path names in the .gcno files. This allows
11189 gcov to find the correct sources in projects where compilations
11190 occur with different working directories.
11191
11192 * Link your object files with -lgcov or -fprofile-arcs (the
11193 latter implies the former).
11194
11195 * Run the program on a representative workload to generate the
11196 arc profile information. This may be repeated any number of
11197 times. You can run concurrent instances of your program, and
11198 provided that the file system supports locking, the data files
11199 will be correctly updated. Unless a strict ISO C dialect
11200 option is in effect, "fork" calls are detected and correctly
11201 handled without double counting.
11202
11203 * For profile-directed optimizations, compile the source files
11204 again with the same optimization and code generation options
11205 plus -fbranch-probabilities.
11206
11207 * For test coverage analysis, use gcov to produce human readable
11208 information from the .gcno and .gcda files. Refer to the gcov
11209 documentation for further information.
11210
11211 With -fprofile-arcs, for each function of your program GCC creates
11212 a program flow graph, then finds a spanning tree for the graph.
11213 Only arcs that are not on the spanning tree have to be
11214 instrumented: the compiler adds code to count the number of times
11215 that these arcs are executed. When an arc is the only exit or only
11216 entrance to a block, the instrumentation code can be added to the
11217 block; otherwise, a new basic block must be created to hold the
11218 instrumentation code.
11219
11220 -ftest-coverage
11221 Produce a notes file that the gcov code-coverage utility can use to
11222 show program coverage. Each source file's note file is called
11223 auxname.gcno. Refer to the -fprofile-arcs option above for a
11224 description of auxname and instructions on how to generate test
11225 coverage data. Coverage data matches the source files more closely
11226 if you do not optimize.
11227
11228 -fprofile-abs-path
11229 Automatically convert relative source file names to absolute path
11230 names in the .gcno files. This allows gcov to find the correct
11231 sources in projects where compilations occur with different working
11232 directories.
11233
11234 -fprofile-dir=path
11235 Set the directory to search for the profile data files in to path.
11236 This option affects only the profile data generated by
11237 -fprofile-generate, -ftest-coverage, -fprofile-arcs and used by
11238 -fprofile-use and -fbranch-probabilities and its related options.
11239 Both absolute and relative paths can be used. By default, GCC uses
11240 the current directory as path, thus the profile data file appears
11241 in the same directory as the object file. In order to prevent the
11242 file name clashing, if the object file name is not an absolute
11243 path, we mangle the absolute path of the sourcename.gcda file and
11244 use it as the file name of a .gcda file. See similar option
11245 -fprofile-note.
11246
11247 When an executable is run in a massive parallel environment, it is
11248 recommended to save profile to different folders. That can be done
11249 with variables in path that are exported during run-time:
11250
11251 %p process ID.
11252
11253 %q{VAR}
11254 value of environment variable VAR
11255
11256 -fprofile-generate
11257 -fprofile-generate=path
11258 Enable options usually used for instrumenting application to
11259 produce profile useful for later recompilation with profile
11260 feedback based optimization. You must use -fprofile-generate both
11261 when compiling and when linking your program.
11262
11263 The following options are enabled: -fprofile-arcs,
11264 -fprofile-values, -finline-functions, and -fipa-bit-cp.
11265
11266 If path is specified, GCC looks at the path to find the profile
11267 feedback data files. See -fprofile-dir.
11268
11269 To optimize the program based on the collected profile information,
11270 use -fprofile-use.
11271
11272 -fprofile-note=path
11273 If path is specified, GCC saves .gcno file into path location. If
11274 you combine the option with multiple source files, the .gcno file
11275 will be overwritten.
11276
11277 -fprofile-prefix-path=path
11278 This option can be used in combination with
11279 profile-generate=profile_dir and profile-use=profile_dir to inform
11280 GCC where is the base directory of built source tree. By default
11281 profile_dir will contain files with mangled absolute paths of all
11282 object files in the built project. This is not desirable when
11283 directory used to build the instrumented binary differs from the
11284 directory used to build the binary optimized with profile feedback
11285 because the profile data will not be found during the optimized
11286 build. In such setups -fprofile-prefix-path=path with path
11287 pointing to the base directory of the build can be used to strip
11288 the irrelevant part of the path and keep all file names relative to
11289 the main build directory.
11290
11291 -fprofile-update=method
11292 Alter the update method for an application instrumented for profile
11293 feedback based optimization. The method argument should be one of
11294 single, atomic or prefer-atomic. The first one is useful for
11295 single-threaded applications, while the second one prevents profile
11296 corruption by emitting thread-safe code.
11297
11298 Warning: When an application does not properly join all threads (or
11299 creates an detached thread), a profile file can be still corrupted.
11300
11301 Using prefer-atomic would be transformed either to atomic, when
11302 supported by a target, or to single otherwise. The GCC driver
11303 automatically selects prefer-atomic when -pthread is present in the
11304 command line.
11305
11306 -fprofile-filter-files=regex
11307 Instrument only functions from files where names match any regular
11308 expression (separated by a semi-colon).
11309
11310 For example, -fprofile-filter-files=main.c;module.*.c will
11311 instrument only main.c and all C files starting with 'module'.
11312
11313 -fprofile-exclude-files=regex
11314 Instrument only functions from files where names do not match all
11315 the regular expressions (separated by a semi-colon).
11316
11317 For example, -fprofile-exclude-files=/usr/* will prevent
11318 instrumentation of all files that are located in /usr/ folder.
11319
11320 -fprofile-reproducible=[multithreaded|parallel-runs|serial]
11321 Control level of reproducibility of profile gathered by
11322 "-fprofile-generate". This makes it possible to rebuild program
11323 with same outcome which is useful, for example, for distribution
11324 packages.
11325
11326 With -fprofile-reproducible=serial the profile gathered by
11327 -fprofile-generate is reproducible provided the trained program
11328 behaves the same at each invocation of the train run, it is not
11329 multi-threaded and profile data streaming is always done in the
11330 same order. Note that profile streaming happens at the end of
11331 program run but also before "fork" function is invoked.
11332
11333 Note that it is quite common that execution counts of some part of
11334 programs depends, for example, on length of temporary file names or
11335 memory space randomization (that may affect hash-table collision
11336 rate). Such non-reproducible part of programs may be annotated by
11337 "no_instrument_function" function attribute. "gcov-dump" with -l
11338 can be used to dump gathered data and verify that they are indeed
11339 reproducible.
11340
11341 With -fprofile-reproducible=parallel-runs collected profile stays
11342 reproducible regardless the order of streaming of the data into
11343 gcda files. This setting makes it possible to run multiple
11344 instances of instrumented program in parallel (such as with "make
11345 -j"). This reduces quality of gathered data, in particular of
11346 indirect call profiling.
11347
11348 -fsanitize=address
11349 Enable AddressSanitizer, a fast memory error detector. Memory
11350 access instructions are instrumented to detect out-of-bounds and
11351 use-after-free bugs. The option enables
11352 -fsanitize-address-use-after-scope. See
11353 <https://github.com/google/sanitizers/wiki/AddressSanitizer> for
11354 more details. The run-time behavior can be influenced using the
11355 ASAN_OPTIONS environment variable. When set to "help=1", the
11356 available options are shown at startup of the instrumented program.
11357 See
11358 <https://github.com/google/sanitizers/wiki/AddressSanitizerFlags#run-time-flags>
11359 for a list of supported options. The option cannot be combined
11360 with -fsanitize=thread.
11361
11362 -fsanitize=kernel-address
11363 Enable AddressSanitizer for Linux kernel. See
11364 <https://github.com/google/kasan/wiki> for more details.
11365
11366 -fsanitize=pointer-compare
11367 Instrument comparison operation (<, <=, >, >=) with pointer
11368 operands. The option must be combined with either
11369 -fsanitize=kernel-address or -fsanitize=address The option cannot
11370 be combined with -fsanitize=thread. Note: By default the check is
11371 disabled at run time. To enable it, add
11372 "detect_invalid_pointer_pairs=2" to the environment variable
11373 ASAN_OPTIONS. Using "detect_invalid_pointer_pairs=1" detects
11374 invalid operation only when both pointers are non-null.
11375
11376 -fsanitize=pointer-subtract
11377 Instrument subtraction with pointer operands. The option must be
11378 combined with either -fsanitize=kernel-address or
11379 -fsanitize=address The option cannot be combined with
11380 -fsanitize=thread. Note: By default the check is disabled at run
11381 time. To enable it, add "detect_invalid_pointer_pairs=2" to the
11382 environment variable ASAN_OPTIONS. Using
11383 "detect_invalid_pointer_pairs=1" detects invalid operation only
11384 when both pointers are non-null.
11385
11386 -fsanitize=thread
11387 Enable ThreadSanitizer, a fast data race detector. Memory access
11388 instructions are instrumented to detect data race bugs. See
11389 <https://github.com/google/sanitizers/wiki#threadsanitizer> for
11390 more details. The run-time behavior can be influenced using the
11391 TSAN_OPTIONS environment variable; see
11392 <https://github.com/google/sanitizers/wiki/ThreadSanitizerFlags>
11393 for a list of supported options. The option cannot be combined
11394 with -fsanitize=address, -fsanitize=leak.
11395
11396 Note that sanitized atomic builtins cannot throw exceptions when
11397 operating on invalid memory addresses with non-call exceptions
11398 (-fnon-call-exceptions).
11399
11400 -fsanitize=leak
11401 Enable LeakSanitizer, a memory leak detector. This option only
11402 matters for linking of executables and the executable is linked
11403 against a library that overrides "malloc" and other allocator
11404 functions. See
11405 <https://github.com/google/sanitizers/wiki/AddressSanitizerLeakSanitizer>
11406 for more details. The run-time behavior can be influenced using
11407 the LSAN_OPTIONS environment variable. The option cannot be
11408 combined with -fsanitize=thread.
11409
11410 -fsanitize=undefined
11411 Enable UndefinedBehaviorSanitizer, a fast undefined behavior
11412 detector. Various computations are instrumented to detect
11413 undefined behavior at runtime. Current suboptions are:
11414
11415 -fsanitize=shift
11416 This option enables checking that the result of a shift
11417 operation is not undefined. Note that what exactly is
11418 considered undefined differs slightly between C and C++, as
11419 well as between ISO C90 and C99, etc. This option has two
11420 suboptions, -fsanitize=shift-base and
11421 -fsanitize=shift-exponent.
11422
11423 -fsanitize=shift-exponent
11424 This option enables checking that the second argument of a
11425 shift operation is not negative and is smaller than the
11426 precision of the promoted first argument.
11427
11428 -fsanitize=shift-base
11429 If the second argument of a shift operation is within range,
11430 check that the result of a shift operation is not undefined.
11431 Note that what exactly is considered undefined differs slightly
11432 between C and C++, as well as between ISO C90 and C99, etc.
11433
11434 -fsanitize=integer-divide-by-zero
11435 Detect integer division by zero as well as "INT_MIN / -1"
11436 division.
11437
11438 -fsanitize=unreachable
11439 With this option, the compiler turns the
11440 "__builtin_unreachable" call into a diagnostics message call
11441 instead. When reaching the "__builtin_unreachable" call, the
11442 behavior is undefined.
11443
11444 -fsanitize=vla-bound
11445 This option instructs the compiler to check that the size of a
11446 variable length array is positive.
11447
11448 -fsanitize=null
11449 This option enables pointer checking. Particularly, the
11450 application built with this option turned on will issue an
11451 error message when it tries to dereference a NULL pointer, or
11452 if a reference (possibly an rvalue reference) is bound to a
11453 NULL pointer, or if a method is invoked on an object pointed by
11454 a NULL pointer.
11455
11456 -fsanitize=return
11457 This option enables return statement checking. Programs built
11458 with this option turned on will issue an error message when the
11459 end of a non-void function is reached without actually
11460 returning a value. This option works in C++ only.
11461
11462 -fsanitize=signed-integer-overflow
11463 This option enables signed integer overflow checking. We check
11464 that the result of "+", "*", and both unary and binary "-" does
11465 not overflow in the signed arithmetics. Note, integer
11466 promotion rules must be taken into account. That is, the
11467 following is not an overflow:
11468
11469 signed char a = SCHAR_MAX;
11470 a++;
11471
11472 -fsanitize=bounds
11473 This option enables instrumentation of array bounds. Various
11474 out of bounds accesses are detected. Flexible array members,
11475 flexible array member-like arrays, and initializers of
11476 variables with static storage are not instrumented.
11477
11478 -fsanitize=bounds-strict
11479 This option enables strict instrumentation of array bounds.
11480 Most out of bounds accesses are detected, including flexible
11481 array members and flexible array member-like arrays.
11482 Initializers of variables with static storage are not
11483 instrumented.
11484
11485 -fsanitize=alignment
11486 This option enables checking of alignment of pointers when they
11487 are dereferenced, or when a reference is bound to
11488 insufficiently aligned target, or when a method or constructor
11489 is invoked on insufficiently aligned object.
11490
11491 -fsanitize=object-size
11492 This option enables instrumentation of memory references using
11493 the "__builtin_object_size" function. Various out of bounds
11494 pointer accesses are detected.
11495
11496 -fsanitize=float-divide-by-zero
11497 Detect floating-point division by zero. Unlike other similar
11498 options, -fsanitize=float-divide-by-zero is not enabled by
11499 -fsanitize=undefined, since floating-point division by zero can
11500 be a legitimate way of obtaining infinities and NaNs.
11501
11502 -fsanitize=float-cast-overflow
11503 This option enables floating-point type to integer conversion
11504 checking. We check that the result of the conversion does not
11505 overflow. Unlike other similar options,
11506 -fsanitize=float-cast-overflow is not enabled by
11507 -fsanitize=undefined. This option does not work well with
11508 "FE_INVALID" exceptions enabled.
11509
11510 -fsanitize=nonnull-attribute
11511 This option enables instrumentation of calls, checking whether
11512 null values are not passed to arguments marked as requiring a
11513 non-null value by the "nonnull" function attribute.
11514
11515 -fsanitize=returns-nonnull-attribute
11516 This option enables instrumentation of return statements in
11517 functions marked with "returns_nonnull" function attribute, to
11518 detect returning of null values from such functions.
11519
11520 -fsanitize=bool
11521 This option enables instrumentation of loads from bool. If a
11522 value other than 0/1 is loaded, a run-time error is issued.
11523
11524 -fsanitize=enum
11525 This option enables instrumentation of loads from an enum type.
11526 If a value outside the range of values for the enum type is
11527 loaded, a run-time error is issued.
11528
11529 -fsanitize=vptr
11530 This option enables instrumentation of C++ member function
11531 calls, member accesses and some conversions between pointers to
11532 base and derived classes, to verify the referenced object has
11533 the correct dynamic type.
11534
11535 -fsanitize=pointer-overflow
11536 This option enables instrumentation of pointer arithmetics. If
11537 the pointer arithmetics overflows, a run-time error is issued.
11538
11539 -fsanitize=builtin
11540 This option enables instrumentation of arguments to selected
11541 builtin functions. If an invalid value is passed to such
11542 arguments, a run-time error is issued. E.g. passing 0 as the
11543 argument to "__builtin_ctz" or "__builtin_clz" invokes
11544 undefined behavior and is diagnosed by this option.
11545
11546 While -ftrapv causes traps for signed overflows to be emitted,
11547 -fsanitize=undefined gives a diagnostic message. This currently
11548 works only for the C family of languages.
11549
11550 -fno-sanitize=all
11551 This option disables all previously enabled sanitizers.
11552 -fsanitize=all is not allowed, as some sanitizers cannot be used
11553 together.
11554
11555 -fasan-shadow-offset=number
11556 This option forces GCC to use custom shadow offset in
11557 AddressSanitizer checks. It is useful for experimenting with
11558 different shadow memory layouts in Kernel AddressSanitizer.
11559
11560 -fsanitize-sections=s1,s2,...
11561 Sanitize global variables in selected user-defined sections. si
11562 may contain wildcards.
11563
11564 -fsanitize-recover[=opts]
11565 -fsanitize-recover= controls error recovery mode for sanitizers
11566 mentioned in comma-separated list of opts. Enabling this option
11567 for a sanitizer component causes it to attempt to continue running
11568 the program as if no error happened. This means multiple runtime
11569 errors can be reported in a single program run, and the exit code
11570 of the program may indicate success even when errors have been
11571 reported. The -fno-sanitize-recover= option can be used to alter
11572 this behavior: only the first detected error is reported and
11573 program then exits with a non-zero exit code.
11574
11575 Currently this feature only works for -fsanitize=undefined (and its
11576 suboptions except for -fsanitize=unreachable and
11577 -fsanitize=return), -fsanitize=float-cast-overflow,
11578 -fsanitize=float-divide-by-zero, -fsanitize=bounds-strict,
11579 -fsanitize=kernel-address and -fsanitize=address. For these
11580 sanitizers error recovery is turned on by default, except
11581 -fsanitize=address, for which this feature is experimental.
11582 -fsanitize-recover=all and -fno-sanitize-recover=all is also
11583 accepted, the former enables recovery for all sanitizers that
11584 support it, the latter disables recovery for all sanitizers that
11585 support it.
11586
11587 Even if a recovery mode is turned on the compiler side, it needs to
11588 be also enabled on the runtime library side, otherwise the failures
11589 are still fatal. The runtime library defaults to "halt_on_error=0"
11590 for ThreadSanitizer and UndefinedBehaviorSanitizer, while default
11591 value for AddressSanitizer is "halt_on_error=1". This can be
11592 overridden through setting the "halt_on_error" flag in the
11593 corresponding environment variable.
11594
11595 Syntax without an explicit opts parameter is deprecated. It is
11596 equivalent to specifying an opts list of:
11597
11598 undefined,float-cast-overflow,float-divide-by-zero,bounds-strict
11599
11600 -fsanitize-address-use-after-scope
11601 Enable sanitization of local variables to detect use-after-scope
11602 bugs. The option sets -fstack-reuse to none.
11603
11604 -fsanitize-undefined-trap-on-error
11605 The -fsanitize-undefined-trap-on-error option instructs the
11606 compiler to report undefined behavior using "__builtin_trap" rather
11607 than a "libubsan" library routine. The advantage of this is that
11608 the "libubsan" library is not needed and is not linked in, so this
11609 is usable even in freestanding environments.
11610
11611 -fsanitize-coverage=trace-pc
11612 Enable coverage-guided fuzzing code instrumentation. Inserts a
11613 call to "__sanitizer_cov_trace_pc" into every basic block.
11614
11615 -fsanitize-coverage=trace-cmp
11616 Enable dataflow guided fuzzing code instrumentation. Inserts a
11617 call to "__sanitizer_cov_trace_cmp1", "__sanitizer_cov_trace_cmp2",
11618 "__sanitizer_cov_trace_cmp4" or "__sanitizer_cov_trace_cmp8" for
11619 integral comparison with both operands variable or
11620 "__sanitizer_cov_trace_const_cmp1",
11621 "__sanitizer_cov_trace_const_cmp2",
11622 "__sanitizer_cov_trace_const_cmp4" or
11623 "__sanitizer_cov_trace_const_cmp8" for integral comparison with one
11624 operand constant, "__sanitizer_cov_trace_cmpf" or
11625 "__sanitizer_cov_trace_cmpd" for float or double comparisons and
11626 "__sanitizer_cov_trace_switch" for switch statements.
11627
11628 -fcf-protection=[full|branch|return|none|check]
11629 Enable code instrumentation of control-flow transfers to increase
11630 program security by checking that target addresses of control-flow
11631 transfer instructions (such as indirect function call, function
11632 return, indirect jump) are valid. This prevents diverting the flow
11633 of control to an unexpected target. This is intended to protect
11634 against such threats as Return-oriented Programming (ROP), and
11635 similarly call/jmp-oriented programming (COP/JOP).
11636
11637 The value "branch" tells the compiler to implement checking of
11638 validity of control-flow transfer at the point of indirect branch
11639 instructions, i.e. call/jmp instructions. The value "return"
11640 implements checking of validity at the point of returning from a
11641 function. The value "full" is an alias for specifying both
11642 "branch" and "return". The value "none" turns off instrumentation.
11643
11644 The value "check" is used for the final link with link-time
11645 optimization (LTO). An error is issued if LTO object files are
11646 compiled with different -fcf-protection values. The value "check"
11647 is ignored at the compile time.
11648
11649 The macro "__CET__" is defined when -fcf-protection is used. The
11650 first bit of "__CET__" is set to 1 for the value "branch" and the
11651 second bit of "__CET__" is set to 1 for the "return".
11652
11653 You can also use the "nocf_check" attribute to identify which
11654 functions and calls should be skipped from instrumentation.
11655
11656 Currently the x86 GNU/Linux target provides an implementation based
11657 on Intel Control-flow Enforcement Technology (CET).
11658
11659 -fstack-protector
11660 Emit extra code to check for buffer overflows, such as stack
11661 smashing attacks. This is done by adding a guard variable to
11662 functions with vulnerable objects. This includes functions that
11663 call "alloca", and functions with buffers larger than or equal to 8
11664 bytes. The guards are initialized when a function is entered and
11665 then checked when the function exits. If a guard check fails, an
11666 error message is printed and the program exits. Only variables
11667 that are actually allocated on the stack are considered, optimized
11668 away variables or variables allocated in registers don't count.
11669
11670 -fstack-protector-all
11671 Like -fstack-protector except that all functions are protected.
11672
11673 -fstack-protector-strong
11674 Like -fstack-protector but includes additional functions to be
11675 protected --- those that have local array definitions, or have
11676 references to local frame addresses. Only variables that are
11677 actually allocated on the stack are considered, optimized away
11678 variables or variables allocated in registers don't count.
11679
11680 -fstack-protector-explicit
11681 Like -fstack-protector but only protects those functions which have
11682 the "stack_protect" attribute.
11683
11684 -fstack-check
11685 Generate code to verify that you do not go beyond the boundary of
11686 the stack. You should specify this flag if you are running in an
11687 environment with multiple threads, but you only rarely need to
11688 specify it in a single-threaded environment since stack overflow is
11689 automatically detected on nearly all systems if there is only one
11690 stack.
11691
11692 Note that this switch does not actually cause checking to be done;
11693 the operating system or the language runtime must do that. The
11694 switch causes generation of code to ensure that they see the stack
11695 being extended.
11696
11697 You can additionally specify a string parameter: no means no
11698 checking, generic means force the use of old-style checking,
11699 specific means use the best checking method and is equivalent to
11700 bare -fstack-check.
11701
11702 Old-style checking is a generic mechanism that requires no specific
11703 target support in the compiler but comes with the following
11704 drawbacks:
11705
11706 1. Modified allocation strategy for large objects: they are always
11707 allocated dynamically if their size exceeds a fixed threshold.
11708 Note this may change the semantics of some code.
11709
11710 2. Fixed limit on the size of the static frame of functions: when
11711 it is topped by a particular function, stack checking is not
11712 reliable and a warning is issued by the compiler.
11713
11714 3. Inefficiency: because of both the modified allocation strategy
11715 and the generic implementation, code performance is hampered.
11716
11717 Note that old-style stack checking is also the fallback method for
11718 specific if no target support has been added in the compiler.
11719
11720 -fstack-check= is designed for Ada's needs to detect infinite
11721 recursion and stack overflows. specific is an excellent choice
11722 when compiling Ada code. It is not generally sufficient to protect
11723 against stack-clash attacks. To protect against those you want
11724 -fstack-clash-protection.
11725
11726 -fstack-clash-protection
11727 Generate code to prevent stack clash style attacks. When this
11728 option is enabled, the compiler will only allocate one page of
11729 stack space at a time and each page is accessed immediately after
11730 allocation. Thus, it prevents allocations from jumping over any
11731 stack guard page provided by the operating system.
11732
11733 Most targets do not fully support stack clash protection. However,
11734 on those targets -fstack-clash-protection will protect dynamic
11735 stack allocations. -fstack-clash-protection may also provide
11736 limited protection for static stack allocations if the target
11737 supports -fstack-check=specific.
11738
11739 -fstack-limit-register=reg
11740 -fstack-limit-symbol=sym
11741 -fno-stack-limit
11742 Generate code to ensure that the stack does not grow beyond a
11743 certain value, either the value of a register or the address of a
11744 symbol. If a larger stack is required, a signal is raised at run
11745 time. For most targets, the signal is raised before the stack
11746 overruns the boundary, so it is possible to catch the signal
11747 without taking special precautions.
11748
11749 For instance, if the stack starts at absolute address 0x80000000
11750 and grows downwards, you can use the flags
11751 -fstack-limit-symbol=__stack_limit and
11752 -Wl,--defsym,__stack_limit=0x7ffe0000 to enforce a stack limit of
11753 128KB. Note that this may only work with the GNU linker.
11754
11755 You can locally override stack limit checking by using the
11756 "no_stack_limit" function attribute.
11757
11758 -fsplit-stack
11759 Generate code to automatically split the stack before it overflows.
11760 The resulting program has a discontiguous stack which can only
11761 overflow if the program is unable to allocate any more memory.
11762 This is most useful when running threaded programs, as it is no
11763 longer necessary to calculate a good stack size to use for each
11764 thread. This is currently only implemented for the x86 targets
11765 running GNU/Linux.
11766
11767 When code compiled with -fsplit-stack calls code compiled without
11768 -fsplit-stack, there may not be much stack space available for the
11769 latter code to run. If compiling all code, including library code,
11770 with -fsplit-stack is not an option, then the linker can fix up
11771 these calls so that the code compiled without -fsplit-stack always
11772 has a large stack. Support for this is implemented in the gold
11773 linker in GNU binutils release 2.21 and later.
11774
11775 -fvtable-verify=[std|preinit|none]
11776 This option is only available when compiling C++ code. It turns on
11777 (or off, if using -fvtable-verify=none) the security feature that
11778 verifies at run time, for every virtual call, that the vtable
11779 pointer through which the call is made is valid for the type of the
11780 object, and has not been corrupted or overwritten. If an invalid
11781 vtable pointer is detected at run time, an error is reported and
11782 execution of the program is immediately halted.
11783
11784 This option causes run-time data structures to be built at program
11785 startup, which are used for verifying the vtable pointers. The
11786 options std and preinit control the timing of when these data
11787 structures are built. In both cases the data structures are built
11788 before execution reaches "main". Using -fvtable-verify=std causes
11789 the data structures to be built after shared libraries have been
11790 loaded and initialized. -fvtable-verify=preinit causes them to be
11791 built before shared libraries have been loaded and initialized.
11792
11793 If this option appears multiple times in the command line with
11794 different values specified, none takes highest priority over both
11795 std and preinit; preinit takes priority over std.
11796
11797 -fvtv-debug
11798 When used in conjunction with -fvtable-verify=std or
11799 -fvtable-verify=preinit, causes debug versions of the runtime
11800 functions for the vtable verification feature to be called. This
11801 flag also causes the compiler to log information about which vtable
11802 pointers it finds for each class. This information is written to a
11803 file named vtv_set_ptr_data.log in the directory named by the
11804 environment variable VTV_LOGS_DIR if that is defined or the current
11805 working directory otherwise.
11806
11807 Note: This feature appends data to the log file. If you want a
11808 fresh log file, be sure to delete any existing one.
11809
11810 -fvtv-counts
11811 This is a debugging flag. When used in conjunction with
11812 -fvtable-verify=std or -fvtable-verify=preinit, this causes the
11813 compiler to keep track of the total number of virtual calls it
11814 encounters and the number of verifications it inserts. It also
11815 counts the number of calls to certain run-time library functions
11816 that it inserts and logs this information for each compilation
11817 unit. The compiler writes this information to a file named
11818 vtv_count_data.log in the directory named by the environment
11819 variable VTV_LOGS_DIR if that is defined or the current working
11820 directory otherwise. It also counts the size of the vtable pointer
11821 sets for each class, and writes this information to
11822 vtv_class_set_sizes.log in the same directory.
11823
11824 Note: This feature appends data to the log files. To get fresh
11825 log files, be sure to delete any existing ones.
11826
11827 -finstrument-functions
11828 Generate instrumentation calls for entry and exit to functions.
11829 Just after function entry and just before function exit, the
11830 following profiling functions are called with the address of the
11831 current function and its call site. (On some platforms,
11832 "__builtin_return_address" does not work beyond the current
11833 function, so the call site information may not be available to the
11834 profiling functions otherwise.)
11835
11836 void __cyg_profile_func_enter (void *this_fn,
11837 void *call_site);
11838 void __cyg_profile_func_exit (void *this_fn,
11839 void *call_site);
11840
11841 The first argument is the address of the start of the current
11842 function, which may be looked up exactly in the symbol table.
11843
11844 This instrumentation is also done for functions expanded inline in
11845 other functions. The profiling calls indicate where, conceptually,
11846 the inline function is entered and exited. This means that
11847 addressable versions of such functions must be available. If all
11848 your uses of a function are expanded inline, this may mean an
11849 additional expansion of code size. If you use "extern inline" in
11850 your C code, an addressable version of such functions must be
11851 provided. (This is normally the case anyway, but if you get lucky
11852 and the optimizer always expands the functions inline, you might
11853 have gotten away without providing static copies.)
11854
11855 A function may be given the attribute "no_instrument_function", in
11856 which case this instrumentation is not done. This can be used, for
11857 example, for the profiling functions listed above, high-priority
11858 interrupt routines, and any functions from which the profiling
11859 functions cannot safely be called (perhaps signal handlers, if the
11860 profiling routines generate output or allocate memory).
11861
11862 -finstrument-functions-exclude-file-list=file,file,...
11863 Set the list of functions that are excluded from instrumentation
11864 (see the description of -finstrument-functions). If the file that
11865 contains a function definition matches with one of file, then that
11866 function is not instrumented. The match is done on substrings: if
11867 the file parameter is a substring of the file name, it is
11868 considered to be a match.
11869
11870 For example:
11871
11872 -finstrument-functions-exclude-file-list=/bits/stl,include/sys
11873
11874 excludes any inline function defined in files whose pathnames
11875 contain /bits/stl or include/sys.
11876
11877 If, for some reason, you want to include letter , in one of sym,
11878 write ,. For example,
11879 -finstrument-functions-exclude-file-list=',,tmp' (note the single
11880 quote surrounding the option).
11881
11882 -finstrument-functions-exclude-function-list=sym,sym,...
11883 This is similar to -finstrument-functions-exclude-file-list, but
11884 this option sets the list of function names to be excluded from
11885 instrumentation. The function name to be matched is its user-
11886 visible name, such as "vector<int> blah(const vector<int> &)", not
11887 the internal mangled name (e.g., "_Z4blahRSt6vectorIiSaIiEE"). The
11888 match is done on substrings: if the sym parameter is a substring of
11889 the function name, it is considered to be a match. For C99 and C++
11890 extended identifiers, the function name must be given in UTF-8, not
11891 using universal character names.
11892
11893 -fpatchable-function-entry=N[,M]
11894 Generate N NOPs right at the beginning of each function, with the
11895 function entry point before the Mth NOP. If M is omitted, it
11896 defaults to 0 so the function entry points to the address just at
11897 the first NOP. The NOP instructions reserve extra space which can
11898 be used to patch in any desired instrumentation at run time,
11899 provided that the code segment is writable. The amount of space is
11900 controllable indirectly via the number of NOPs; the NOP instruction
11901 used corresponds to the instruction emitted by the internal GCC
11902 back-end interface "gen_nop". This behavior is target-specific and
11903 may also depend on the architecture variant and/or other
11904 compilation options.
11905
11906 For run-time identification, the starting addresses of these areas,
11907 which correspond to their respective function entries minus M, are
11908 additionally collected in the "__patchable_function_entries"
11909 section of the resulting binary.
11910
11911 Note that the value of "__attribute__ ((patchable_function_entry
11912 (N,M)))" takes precedence over command-line option
11913 -fpatchable-function-entry=N,M. This can be used to increase the
11914 area size or to remove it completely on a single function. If
11915 "N=0", no pad location is recorded.
11916
11917 The NOP instructions are inserted at---and maybe before, depending
11918 on M---the function entry address, even before the prologue.
11919
11920 Options Controlling the Preprocessor
11921 These options control the C preprocessor, which is run on each C source
11922 file before actual compilation.
11923
11924 If you use the -E option, nothing is done except preprocessing. Some
11925 of these options make sense only together with -E because they cause
11926 the preprocessor output to be unsuitable for actual compilation.
11927
11928 In addition to the options listed here, there are a number of options
11929 to control search paths for include files documented in Directory
11930 Options. Options to control preprocessor diagnostics are listed in
11931 Warning Options.
11932
11933 -D name
11934 Predefine name as a macro, with definition 1.
11935
11936 -D name=definition
11937 The contents of definition are tokenized and processed as if they
11938 appeared during translation phase three in a #define directive. In
11939 particular, the definition is truncated by embedded newline
11940 characters.
11941
11942 If you are invoking the preprocessor from a shell or shell-like
11943 program you may need to use the shell's quoting syntax to protect
11944 characters such as spaces that have a meaning in the shell syntax.
11945
11946 If you wish to define a function-like macro on the command line,
11947 write its argument list with surrounding parentheses before the
11948 equals sign (if any). Parentheses are meaningful to most shells,
11949 so you should quote the option. With sh and csh,
11950 -D'name(args...)=definition' works.
11951
11952 -D and -U options are processed in the order they are given on the
11953 command line. All -imacros file and -include file options are
11954 processed after all -D and -U options.
11955
11956 -U name
11957 Cancel any previous definition of name, either built in or provided
11958 with a -D option.
11959
11960 -include file
11961 Process file as if "#include "file"" appeared as the first line of
11962 the primary source file. However, the first directory searched for
11963 file is the preprocessor's working directory instead of the
11964 directory containing the main source file. If not found there, it
11965 is searched for in the remainder of the "#include "..."" search
11966 chain as normal.
11967
11968 If multiple -include options are given, the files are included in
11969 the order they appear on the command line.
11970
11971 -imacros file
11972 Exactly like -include, except that any output produced by scanning
11973 file is thrown away. Macros it defines remain defined. This
11974 allows you to acquire all the macros from a header without also
11975 processing its declarations.
11976
11977 All files specified by -imacros are processed before all files
11978 specified by -include.
11979
11980 -undef
11981 Do not predefine any system-specific or GCC-specific macros. The
11982 standard predefined macros remain defined.
11983
11984 -pthread
11985 Define additional macros required for using the POSIX threads
11986 library. You should use this option consistently for both
11987 compilation and linking. This option is supported on GNU/Linux
11988 targets, most other Unix derivatives, and also on x86 Cygwin and
11989 MinGW targets.
11990
11991 -M Instead of outputting the result of preprocessing, output a rule
11992 suitable for make describing the dependencies of the main source
11993 file. The preprocessor outputs one make rule containing the object
11994 file name for that source file, a colon, and the names of all the
11995 included files, including those coming from -include or -imacros
11996 command-line options.
11997
11998 Unless specified explicitly (with -MT or -MQ), the object file name
11999 consists of the name of the source file with any suffix replaced
12000 with object file suffix and with any leading directory parts
12001 removed. If there are many included files then the rule is split
12002 into several lines using \-newline. The rule has no commands.
12003
12004 This option does not suppress the preprocessor's debug output, such
12005 as -dM. To avoid mixing such debug output with the dependency
12006 rules you should explicitly specify the dependency output file with
12007 -MF, or use an environment variable like DEPENDENCIES_OUTPUT.
12008 Debug output is still sent to the regular output stream as normal.
12009
12010 Passing -M to the driver implies -E, and suppresses warnings with
12011 an implicit -w.
12012
12013 -MM Like -M but do not mention header files that are found in system
12014 header directories, nor header files that are included, directly or
12015 indirectly, from such a header.
12016
12017 This implies that the choice of angle brackets or double quotes in
12018 an #include directive does not in itself determine whether that
12019 header appears in -MM dependency output.
12020
12021 -MF file
12022 When used with -M or -MM, specifies a file to write the
12023 dependencies to. If no -MF switch is given the preprocessor sends
12024 the rules to the same place it would send preprocessed output.
12025
12026 When used with the driver options -MD or -MMD, -MF overrides the
12027 default dependency output file.
12028
12029 If file is -, then the dependencies are written to stdout.
12030
12031 -MG In conjunction with an option such as -M requesting dependency
12032 generation, -MG assumes missing header files are generated files
12033 and adds them to the dependency list without raising an error. The
12034 dependency filename is taken directly from the "#include" directive
12035 without prepending any path. -MG also suppresses preprocessed
12036 output, as a missing header file renders this useless.
12037
12038 This feature is used in automatic updating of makefiles.
12039
12040 -MP This option instructs CPP to add a phony target for each dependency
12041 other than the main file, causing each to depend on nothing. These
12042 dummy rules work around errors make gives if you remove header
12043 files without updating the Makefile to match.
12044
12045 This is typical output:
12046
12047 test.o: test.c test.h
12048
12049 test.h:
12050
12051 -MT target
12052 Change the target of the rule emitted by dependency generation. By
12053 default CPP takes the name of the main input file, deletes any
12054 directory components and any file suffix such as .c, and appends
12055 the platform's usual object suffix. The result is the target.
12056
12057 An -MT option sets the target to be exactly the string you specify.
12058 If you want multiple targets, you can specify them as a single
12059 argument to -MT, or use multiple -MT options.
12060
12061 For example, -MT '$(objpfx)foo.o' might give
12062
12063 $(objpfx)foo.o: foo.c
12064
12065 -MQ target
12066 Same as -MT, but it quotes any characters which are special to
12067 Make. -MQ '$(objpfx)foo.o' gives
12068
12069 $$(objpfx)foo.o: foo.c
12070
12071 The default target is automatically quoted, as if it were given
12072 with -MQ.
12073
12074 -MD -MD is equivalent to -M -MF file, except that -E is not implied.
12075 The driver determines file based on whether an -o option is given.
12076 If it is, the driver uses its argument but with a suffix of .d,
12077 otherwise it takes the name of the input file, removes any
12078 directory components and suffix, and applies a .d suffix.
12079
12080 If -MD is used in conjunction with -E, any -o switch is understood
12081 to specify the dependency output file, but if used without -E, each
12082 -o is understood to specify a target object file.
12083
12084 Since -E is not implied, -MD can be used to generate a dependency
12085 output file as a side effect of the compilation process.
12086
12087 -MMD
12088 Like -MD except mention only user header files, not system header
12089 files.
12090
12091 -fpreprocessed
12092 Indicate to the preprocessor that the input file has already been
12093 preprocessed. This suppresses things like macro expansion,
12094 trigraph conversion, escaped newline splicing, and processing of
12095 most directives. The preprocessor still recognizes and removes
12096 comments, so that you can pass a file preprocessed with -C to the
12097 compiler without problems. In this mode the integrated
12098 preprocessor is little more than a tokenizer for the front ends.
12099
12100 -fpreprocessed is implicit if the input file has one of the
12101 extensions .i, .ii or .mi. These are the extensions that GCC uses
12102 for preprocessed files created by -save-temps.
12103
12104 -fdirectives-only
12105 When preprocessing, handle directives, but do not expand macros.
12106
12107 The option's behavior depends on the -E and -fpreprocessed options.
12108
12109 With -E, preprocessing is limited to the handling of directives
12110 such as "#define", "#ifdef", and "#error". Other preprocessor
12111 operations, such as macro expansion and trigraph conversion are not
12112 performed. In addition, the -dD option is implicitly enabled.
12113
12114 With -fpreprocessed, predefinition of command line and most builtin
12115 macros is disabled. Macros such as "__LINE__", which are
12116 contextually dependent, are handled normally. This enables
12117 compilation of files previously preprocessed with "-E
12118 -fdirectives-only".
12119
12120 With both -E and -fpreprocessed, the rules for -fpreprocessed take
12121 precedence. This enables full preprocessing of files previously
12122 preprocessed with "-E -fdirectives-only".
12123
12124 -fdollars-in-identifiers
12125 Accept $ in identifiers.
12126
12127 -fextended-identifiers
12128 Accept universal character names and extended characters in
12129 identifiers. This option is enabled by default for C99 (and later
12130 C standard versions) and C++.
12131
12132 -fno-canonical-system-headers
12133 When preprocessing, do not shorten system header paths with
12134 canonicalization.
12135
12136 -fmax-include-depth=depth
12137 Set the maximum depth of the nested #include. The default is 200.
12138
12139 -ftabstop=width
12140 Set the distance between tab stops. This helps the preprocessor
12141 report correct column numbers in warnings or errors, even if tabs
12142 appear on the line. If the value is less than 1 or greater than
12143 100, the option is ignored. The default is 8.
12144
12145 -ftrack-macro-expansion[=level]
12146 Track locations of tokens across macro expansions. This allows the
12147 compiler to emit diagnostic about the current macro expansion stack
12148 when a compilation error occurs in a macro expansion. Using this
12149 option makes the preprocessor and the compiler consume more memory.
12150 The level parameter can be used to choose the level of precision of
12151 token location tracking thus decreasing the memory consumption if
12152 necessary. Value 0 of level de-activates this option. Value 1
12153 tracks tokens locations in a degraded mode for the sake of minimal
12154 memory overhead. In this mode all tokens resulting from the
12155 expansion of an argument of a function-like macro have the same
12156 location. Value 2 tracks tokens locations completely. This value is
12157 the most memory hungry. When this option is given no argument, the
12158 default parameter value is 2.
12159
12160 Note that "-ftrack-macro-expansion=2" is activated by default.
12161
12162 -fmacro-prefix-map=old=new
12163 When preprocessing files residing in directory old, expand the
12164 "__FILE__" and "__BASE_FILE__" macros as if the files resided in
12165 directory new instead. This can be used to change an absolute path
12166 to a relative path by using . for new which can result in more
12167 reproducible builds that are location independent. This option
12168 also affects "__builtin_FILE()" during compilation. See also
12169 -ffile-prefix-map.
12170
12171 -fexec-charset=charset
12172 Set the execution character set, used for string and character
12173 constants. The default is UTF-8. charset can be any encoding
12174 supported by the system's "iconv" library routine.
12175
12176 -fwide-exec-charset=charset
12177 Set the wide execution character set, used for wide string and
12178 character constants. The default is UTF-32 or UTF-16, whichever
12179 corresponds to the width of "wchar_t". As with -fexec-charset,
12180 charset can be any encoding supported by the system's "iconv"
12181 library routine; however, you will have problems with encodings
12182 that do not fit exactly in "wchar_t".
12183
12184 -finput-charset=charset
12185 Set the input character set, used for translation from the
12186 character set of the input file to the source character set used by
12187 GCC. If the locale does not specify, or GCC cannot get this
12188 information from the locale, the default is UTF-8. This can be
12189 overridden by either the locale or this command-line option.
12190 Currently the command-line option takes precedence if there's a
12191 conflict. charset can be any encoding supported by the system's
12192 "iconv" library routine.
12193
12194 -fpch-deps
12195 When using precompiled headers, this flag causes the dependency-
12196 output flags to also list the files from the precompiled header's
12197 dependencies. If not specified, only the precompiled header are
12198 listed and not the files that were used to create it, because those
12199 files are not consulted when a precompiled header is used.
12200
12201 -fpch-preprocess
12202 This option allows use of a precompiled header together with -E.
12203 It inserts a special "#pragma", "#pragma GCC pch_preprocess
12204 "filename"" in the output to mark the place where the precompiled
12205 header was found, and its filename. When -fpreprocessed is in use,
12206 GCC recognizes this "#pragma" and loads the PCH.
12207
12208 This option is off by default, because the resulting preprocessed
12209 output is only really suitable as input to GCC. It is switched on
12210 by -save-temps.
12211
12212 You should not write this "#pragma" in your own code, but it is
12213 safe to edit the filename if the PCH file is available in a
12214 different location. The filename may be absolute or it may be
12215 relative to GCC's current directory.
12216
12217 -fworking-directory
12218 Enable generation of linemarkers in the preprocessor output that
12219 let the compiler know the current working directory at the time of
12220 preprocessing. When this option is enabled, the preprocessor
12221 emits, after the initial linemarker, a second linemarker with the
12222 current working directory followed by two slashes. GCC uses this
12223 directory, when it's present in the preprocessed input, as the
12224 directory emitted as the current working directory in some
12225 debugging information formats. This option is implicitly enabled
12226 if debugging information is enabled, but this can be inhibited with
12227 the negated form -fno-working-directory. If the -P flag is present
12228 in the command line, this option has no effect, since no "#line"
12229 directives are emitted whatsoever.
12230
12231 -A predicate=answer
12232 Make an assertion with the predicate predicate and answer answer.
12233 This form is preferred to the older form -A predicate(answer),
12234 which is still supported, because it does not use shell special
12235 characters.
12236
12237 -A -predicate=answer
12238 Cancel an assertion with the predicate predicate and answer answer.
12239
12240 -C Do not discard comments. All comments are passed through to the
12241 output file, except for comments in processed directives, which are
12242 deleted along with the directive.
12243
12244 You should be prepared for side effects when using -C; it causes
12245 the preprocessor to treat comments as tokens in their own right.
12246 For example, comments appearing at the start of what would be a
12247 directive line have the effect of turning that line into an
12248 ordinary source line, since the first token on the line is no
12249 longer a #.
12250
12251 -CC Do not discard comments, including during macro expansion. This is
12252 like -C, except that comments contained within macros are also
12253 passed through to the output file where the macro is expanded.
12254
12255 In addition to the side effects of the -C option, the -CC option
12256 causes all C++-style comments inside a macro to be converted to
12257 C-style comments. This is to prevent later use of that macro from
12258 inadvertently commenting out the remainder of the source line.
12259
12260 The -CC option is generally used to support lint comments.
12261
12262 -P Inhibit generation of linemarkers in the output from the
12263 preprocessor. This might be useful when running the preprocessor
12264 on something that is not C code, and will be sent to a program
12265 which might be confused by the linemarkers.
12266
12267 -traditional
12268 -traditional-cpp
12269 Try to imitate the behavior of pre-standard C preprocessors, as
12270 opposed to ISO C preprocessors. See the GNU CPP manual for
12271 details.
12272
12273 Note that GCC does not otherwise attempt to emulate a pre-standard
12274 C compiler, and these options are only supported with the -E
12275 switch, or when invoking CPP explicitly.
12276
12277 -trigraphs
12278 Support ISO C trigraphs. These are three-character sequences, all
12279 starting with ??, that are defined by ISO C to stand for single
12280 characters. For example, ??/ stands for \, so '??/n' is a
12281 character constant for a newline.
12282
12283 The nine trigraphs and their replacements are
12284
12285 Trigraph: ??( ??) ??< ??> ??= ??/ ??' ??! ??-
12286 Replacement: [ ] { } # \ ^ | ~
12287
12288 By default, GCC ignores trigraphs, but in standard-conforming modes
12289 it converts them. See the -std and -ansi options.
12290
12291 -remap
12292 Enable special code to work around file systems which only permit
12293 very short file names, such as MS-DOS.
12294
12295 -H Print the name of each header file used, in addition to other
12296 normal activities. Each name is indented to show how deep in the
12297 #include stack it is. Precompiled header files are also printed,
12298 even if they are found to be invalid; an invalid precompiled header
12299 file is printed with ...x and a valid one with ...! .
12300
12301 -dletters
12302 Says to make debugging dumps during compilation as specified by
12303 letters. The flags documented here are those relevant to the
12304 preprocessor. Other letters are interpreted by the compiler
12305 proper, or reserved for future versions of GCC, and so are silently
12306 ignored. If you specify letters whose behavior conflicts, the
12307 result is undefined.
12308
12309 -dM Instead of the normal output, generate a list of #define
12310 directives for all the macros defined during the execution of
12311 the preprocessor, including predefined macros. This gives you
12312 a way of finding out what is predefined in your version of the
12313 preprocessor. Assuming you have no file foo.h, the command
12314
12315 touch foo.h; cpp -dM foo.h
12316
12317 shows all the predefined macros.
12318
12319 If you use -dM without the -E option, -dM is interpreted as a
12320 synonym for -fdump-rtl-mach.
12321
12322 -dD Like -dM except in two respects: it does not include the
12323 predefined macros, and it outputs both the #define directives
12324 and the result of preprocessing. Both kinds of output go to
12325 the standard output file.
12326
12327 -dN Like -dD, but emit only the macro names, not their expansions.
12328
12329 -dI Output #include directives in addition to the result of
12330 preprocessing.
12331
12332 -dU Like -dD except that only macros that are expanded, or whose
12333 definedness is tested in preprocessor directives, are output;
12334 the output is delayed until the use or test of the macro; and
12335 #undef directives are also output for macros tested but
12336 undefined at the time.
12337
12338 -fdebug-cpp
12339 This option is only useful for debugging GCC. When used from CPP
12340 or with -E, it dumps debugging information about location maps.
12341 Every token in the output is preceded by the dump of the map its
12342 location belongs to.
12343
12344 When used from GCC without -E, this option has no effect.
12345
12346 -Wp,option
12347 You can use -Wp,option to bypass the compiler driver and pass
12348 option directly through to the preprocessor. If option contains
12349 commas, it is split into multiple options at the commas. However,
12350 many options are modified, translated or interpreted by the
12351 compiler driver before being passed to the preprocessor, and -Wp
12352 forcibly bypasses this phase. The preprocessor's direct interface
12353 is undocumented and subject to change, so whenever possible you
12354 should avoid using -Wp and let the driver handle the options
12355 instead.
12356
12357 -Xpreprocessor option
12358 Pass option as an option to the preprocessor. You can use this to
12359 supply system-specific preprocessor options that GCC does not
12360 recognize.
12361
12362 If you want to pass an option that takes an argument, you must use
12363 -Xpreprocessor twice, once for the option and once for the
12364 argument.
12365
12366 -no-integrated-cpp
12367 Perform preprocessing as a separate pass before compilation. By
12368 default, GCC performs preprocessing as an integrated part of input
12369 tokenization and parsing. If this option is provided, the
12370 appropriate language front end (cc1, cc1plus, or cc1obj for C, C++,
12371 and Objective-C, respectively) is instead invoked twice, once for
12372 preprocessing only and once for actual compilation of the
12373 preprocessed input. This option may be useful in conjunction with
12374 the -B or -wrapper options to specify an alternate preprocessor or
12375 perform additional processing of the program source between normal
12376 preprocessing and compilation.
12377
12378 Passing Options to the Assembler
12379 You can pass options to the assembler.
12380
12381 -Wa,option
12382 Pass option as an option to the assembler. If option contains
12383 commas, it is split into multiple options at the commas.
12384
12385 -Xassembler option
12386 Pass option as an option to the assembler. You can use this to
12387 supply system-specific assembler options that GCC does not
12388 recognize.
12389
12390 If you want to pass an option that takes an argument, you must use
12391 -Xassembler twice, once for the option and once for the argument.
12392
12393 Options for Linking
12394 These options come into play when the compiler links object files into
12395 an executable output file. They are meaningless if the compiler is not
12396 doing a link step.
12397
12398 object-file-name
12399 A file name that does not end in a special recognized suffix is
12400 considered to name an object file or library. (Object files are
12401 distinguished from libraries by the linker according to the file
12402 contents.) If linking is done, these object files are used as
12403 input to the linker.
12404
12405 -c
12406 -S
12407 -E If any of these options is used, then the linker is not run, and
12408 object file names should not be used as arguments.
12409
12410 -flinker-output=type
12411 This option controls code generation of the link-time optimizer.
12412 By default the linker output is automatically determined by the
12413 linker plugin. For debugging the compiler and if incremental
12414 linking with a non-LTO object file is desired, it may be useful to
12415 control the type manually.
12416
12417 If type is exec, code generation produces a static binary. In this
12418 case -fpic and -fpie are both disabled.
12419
12420 If type is dyn, code generation produces a shared library. In this
12421 case -fpic or -fPIC is preserved, but not enabled automatically.
12422 This allows to build shared libraries without position-independent
12423 code on architectures where this is possible, i.e. on x86.
12424
12425 If type is pie, code generation produces an -fpie executable. This
12426 results in similar optimizations as exec except that -fpie is not
12427 disabled if specified at compilation time.
12428
12429 If type is rel, the compiler assumes that incremental linking is
12430 done. The sections containing intermediate code for link-time
12431 optimization are merged, pre-optimized, and output to the resulting
12432 object file. In addition, if -ffat-lto-objects is specified, binary
12433 code is produced for future non-LTO linking. The object file
12434 produced by incremental linking is smaller than a static library
12435 produced from the same object files. At link time the result of
12436 incremental linking also loads faster than a static library
12437 assuming that the majority of objects in the library are used.
12438
12439 Finally nolto-rel configures the compiler for incremental linking
12440 where code generation is forced, a final binary is produced, and
12441 the intermediate code for later link-time optimization is stripped.
12442 When multiple object files are linked together the resulting code
12443 is better optimized than with link-time optimizations disabled (for
12444 example, cross-module inlining happens), but most of benefits of
12445 whole program optimizations are lost.
12446
12447 During the incremental link (by -r) the linker plugin defaults to
12448 rel. With current interfaces to GNU Binutils it is however not
12449 possible to incrementally link LTO objects and non-LTO objects into
12450 a single mixed object file. If any of object files in incremental
12451 link cannot be used for link-time optimization, the linker plugin
12452 issues a warning and uses nolto-rel. To maintain whole program
12453 optimization, it is recommended to link such objects into static
12454 library instead. Alternatively it is possible to use H.J. Lu's
12455 binutils with support for mixed objects.
12456
12457 -fuse-ld=bfd
12458 Use the bfd linker instead of the default linker.
12459
12460 -fuse-ld=gold
12461 Use the gold linker instead of the default linker.
12462
12463 -fuse-ld=lld
12464 Use the LLVM lld linker instead of the default linker.
12465
12466 -llibrary
12467 -l library
12468 Search the library named library when linking. (The second
12469 alternative with the library as a separate argument is only for
12470 POSIX compliance and is not recommended.)
12471
12472 The -l option is passed directly to the linker by GCC. Refer to
12473 your linker documentation for exact details. The general
12474 description below applies to the GNU linker.
12475
12476 The linker searches a standard list of directories for the library.
12477 The directories searched include several standard system
12478 directories plus any that you specify with -L.
12479
12480 Static libraries are archives of object files, and have file names
12481 like liblibrary.a. Some targets also support shared libraries,
12482 which typically have names like liblibrary.so. If both static and
12483 shared libraries are found, the linker gives preference to linking
12484 with the shared library unless the -static option is used.
12485
12486 It makes a difference where in the command you write this option;
12487 the linker searches and processes libraries and object files in the
12488 order they are specified. Thus, foo.o -lz bar.o searches library z
12489 after file foo.o but before bar.o. If bar.o refers to functions in
12490 z, those functions may not be loaded.
12491
12492 -lobjc
12493 You need this special case of the -l option in order to link an
12494 Objective-C or Objective-C++ program.
12495
12496 -nostartfiles
12497 Do not use the standard system startup files when linking. The
12498 standard system libraries are used normally, unless -nostdlib,
12499 -nolibc, or -nodefaultlibs is used.
12500
12501 -nodefaultlibs
12502 Do not use the standard system libraries when linking. Only the
12503 libraries you specify are passed to the linker, and options
12504 specifying linkage of the system libraries, such as -static-libgcc
12505 or -shared-libgcc, are ignored. The standard startup files are
12506 used normally, unless -nostartfiles is used.
12507
12508 The compiler may generate calls to "memcmp", "memset", "memcpy" and
12509 "memmove". These entries are usually resolved by entries in libc.
12510 These entry points should be supplied through some other mechanism
12511 when this option is specified.
12512
12513 -nolibc
12514 Do not use the C library or system libraries tightly coupled with
12515 it when linking. Still link with the startup files, libgcc or
12516 toolchain provided language support libraries such as libgnat,
12517 libgfortran or libstdc++ unless options preventing their inclusion
12518 are used as well. This typically removes -lc from the link command
12519 line, as well as system libraries that normally go with it and
12520 become meaningless when absence of a C library is assumed, for
12521 example -lpthread or -lm in some configurations. This is intended
12522 for bare-board targets when there is indeed no C library available.
12523
12524 -nostdlib
12525 Do not use the standard system startup files or libraries when
12526 linking. No startup files and only the libraries you specify are
12527 passed to the linker, and options specifying linkage of the system
12528 libraries, such as -static-libgcc or -shared-libgcc, are ignored.
12529
12530 The compiler may generate calls to "memcmp", "memset", "memcpy" and
12531 "memmove". These entries are usually resolved by entries in libc.
12532 These entry points should be supplied through some other mechanism
12533 when this option is specified.
12534
12535 One of the standard libraries bypassed by -nostdlib and
12536 -nodefaultlibs is libgcc.a, a library of internal subroutines which
12537 GCC uses to overcome shortcomings of particular machines, or
12538 special needs for some languages.
12539
12540 In most cases, you need libgcc.a even when you want to avoid other
12541 standard libraries. In other words, when you specify -nostdlib or
12542 -nodefaultlibs you should usually specify -lgcc as well. This
12543 ensures that you have no unresolved references to internal GCC
12544 library subroutines. (An example of such an internal subroutine is
12545 "__main", used to ensure C++ constructors are called.)
12546
12547 -e entry
12548 --entry=entry
12549 Specify that the program entry point is entry. The argument is
12550 interpreted by the linker; the GNU linker accepts either a symbol
12551 name or an address.
12552
12553 -pie
12554 Produce a dynamically linked position independent executable on
12555 targets that support it. For predictable results, you must also
12556 specify the same set of options used for compilation (-fpie, -fPIE,
12557 or model suboptions) when you specify this linker option.
12558
12559 -no-pie
12560 Don't produce a dynamically linked position independent executable.
12561
12562 -static-pie
12563 Produce a static position independent executable on targets that
12564 support it. A static position independent executable is similar to
12565 a static executable, but can be loaded at any address without a
12566 dynamic linker. For predictable results, you must also specify the
12567 same set of options used for compilation (-fpie, -fPIE, or model
12568 suboptions) when you specify this linker option.
12569
12570 -pthread
12571 Link with the POSIX threads library. This option is supported on
12572 GNU/Linux targets, most other Unix derivatives, and also on x86
12573 Cygwin and MinGW targets. On some targets this option also sets
12574 flags for the preprocessor, so it should be used consistently for
12575 both compilation and linking.
12576
12577 -r Produce a relocatable object as output. This is also known as
12578 partial linking.
12579
12580 -rdynamic
12581 Pass the flag -export-dynamic to the ELF linker, on targets that
12582 support it. This instructs the linker to add all symbols, not only
12583 used ones, to the dynamic symbol table. This option is needed for
12584 some uses of "dlopen" or to allow obtaining backtraces from within
12585 a program.
12586
12587 -s Remove all symbol table and relocation information from the
12588 executable.
12589
12590 -static
12591 On systems that support dynamic linking, this overrides -pie and
12592 prevents linking with the shared libraries. On other systems, this
12593 option has no effect.
12594
12595 -shared
12596 Produce a shared object which can then be linked with other objects
12597 to form an executable. Not all systems support this option. For
12598 predictable results, you must also specify the same set of options
12599 used for compilation (-fpic, -fPIC, or model suboptions) when you
12600 specify this linker option.[1]
12601
12602 -shared-libgcc
12603 -static-libgcc
12604 On systems that provide libgcc as a shared library, these options
12605 force the use of either the shared or static version, respectively.
12606 If no shared version of libgcc was built when the compiler was
12607 configured, these options have no effect.
12608
12609 There are several situations in which an application should use the
12610 shared libgcc instead of the static version. The most common of
12611 these is when the application wishes to throw and catch exceptions
12612 across different shared libraries. In that case, each of the
12613 libraries as well as the application itself should use the shared
12614 libgcc.
12615
12616 Therefore, the G++ driver automatically adds -shared-libgcc
12617 whenever you build a shared library or a main executable, because
12618 C++ programs typically use exceptions, so this is the right thing
12619 to do.
12620
12621 If, instead, you use the GCC driver to create shared libraries, you
12622 may find that they are not always linked with the shared libgcc.
12623 If GCC finds, at its configuration time, that you have a non-GNU
12624 linker or a GNU linker that does not support option --eh-frame-hdr,
12625 it links the shared version of libgcc into shared libraries by
12626 default. Otherwise, it takes advantage of the linker and optimizes
12627 away the linking with the shared version of libgcc, linking with
12628 the static version of libgcc by default. This allows exceptions to
12629 propagate through such shared libraries, without incurring
12630 relocation costs at library load time.
12631
12632 However, if a library or main executable is supposed to throw or
12633 catch exceptions, you must link it using the G++ driver, or using
12634 the option -shared-libgcc, such that it is linked with the shared
12635 libgcc.
12636
12637 -static-libasan
12638 When the -fsanitize=address option is used to link a program, the
12639 GCC driver automatically links against libasan. If libasan is
12640 available as a shared library, and the -static option is not used,
12641 then this links against the shared version of libasan. The
12642 -static-libasan option directs the GCC driver to link libasan
12643 statically, without necessarily linking other libraries statically.
12644
12645 -static-libtsan
12646 When the -fsanitize=thread option is used to link a program, the
12647 GCC driver automatically links against libtsan. If libtsan is
12648 available as a shared library, and the -static option is not used,
12649 then this links against the shared version of libtsan. The
12650 -static-libtsan option directs the GCC driver to link libtsan
12651 statically, without necessarily linking other libraries statically.
12652
12653 -static-liblsan
12654 When the -fsanitize=leak option is used to link a program, the GCC
12655 driver automatically links against liblsan. If liblsan is
12656 available as a shared library, and the -static option is not used,
12657 then this links against the shared version of liblsan. The
12658 -static-liblsan option directs the GCC driver to link liblsan
12659 statically, without necessarily linking other libraries statically.
12660
12661 -static-libubsan
12662 When the -fsanitize=undefined option is used to link a program, the
12663 GCC driver automatically links against libubsan. If libubsan is
12664 available as a shared library, and the -static option is not used,
12665 then this links against the shared version of libubsan. The
12666 -static-libubsan option directs the GCC driver to link libubsan
12667 statically, without necessarily linking other libraries statically.
12668
12669 -static-libstdc++
12670 When the g++ program is used to link a C++ program, it normally
12671 automatically links against libstdc++. If libstdc++ is available
12672 as a shared library, and the -static option is not used, then this
12673 links against the shared version of libstdc++. That is normally
12674 fine. However, it is sometimes useful to freeze the version of
12675 libstdc++ used by the program without going all the way to a fully
12676 static link. The -static-libstdc++ option directs the g++ driver
12677 to link libstdc++ statically, without necessarily linking other
12678 libraries statically.
12679
12680 -symbolic
12681 Bind references to global symbols when building a shared object.
12682 Warn about any unresolved references (unless overridden by the link
12683 editor option -Xlinker -z -Xlinker defs). Only a few systems
12684 support this option.
12685
12686 -T script
12687 Use script as the linker script. This option is supported by most
12688 systems using the GNU linker. On some targets, such as bare-board
12689 targets without an operating system, the -T option may be required
12690 when linking to avoid references to undefined symbols.
12691
12692 -Xlinker option
12693 Pass option as an option to the linker. You can use this to supply
12694 system-specific linker options that GCC does not recognize.
12695
12696 If you want to pass an option that takes a separate argument, you
12697 must use -Xlinker twice, once for the option and once for the
12698 argument. For example, to pass -assert definitions, you must write
12699 -Xlinker -assert -Xlinker definitions. It does not work to write
12700 -Xlinker "-assert definitions", because this passes the entire
12701 string as a single argument, which is not what the linker expects.
12702
12703 When using the GNU linker, it is usually more convenient to pass
12704 arguments to linker options using the option=value syntax than as
12705 separate arguments. For example, you can specify -Xlinker
12706 -Map=output.map rather than -Xlinker -Map -Xlinker output.map.
12707 Other linkers may not support this syntax for command-line options.
12708
12709 -Wl,option
12710 Pass option as an option to the linker. If option contains commas,
12711 it is split into multiple options at the commas. You can use this
12712 syntax to pass an argument to the option. For example,
12713 -Wl,-Map,output.map passes -Map output.map to the linker. When
12714 using the GNU linker, you can also get the same effect with
12715 -Wl,-Map=output.map.
12716
12717 -u symbol
12718 Pretend the symbol symbol is undefined, to force linking of library
12719 modules to define it. You can use -u multiple times with different
12720 symbols to force loading of additional library modules.
12721
12722 -z keyword
12723 -z is passed directly on to the linker along with the keyword
12724 keyword. See the section in the documentation of your linker for
12725 permitted values and their meanings.
12726
12727 Options for Directory Search
12728 These options specify directories to search for header files, for
12729 libraries and for parts of the compiler:
12730
12731 -I dir
12732 -iquote dir
12733 -isystem dir
12734 -idirafter dir
12735 Add the directory dir to the list of directories to be searched for
12736 header files during preprocessing. If dir begins with = or
12737 $SYSROOT, then the = or $SYSROOT is replaced by the sysroot prefix;
12738 see --sysroot and -isysroot.
12739
12740 Directories specified with -iquote apply only to the quote form of
12741 the directive, "#include "file"". Directories specified with -I,
12742 -isystem, or -idirafter apply to lookup for both the
12743 "#include "file"" and "#include <file>" directives.
12744
12745 You can specify any number or combination of these options on the
12746 command line to search for header files in several directories.
12747 The lookup order is as follows:
12748
12749 1. For the quote form of the include directive, the directory of
12750 the current file is searched first.
12751
12752 2. For the quote form of the include directive, the directories
12753 specified by -iquote options are searched in left-to-right
12754 order, as they appear on the command line.
12755
12756 3. Directories specified with -I options are scanned in left-to-
12757 right order.
12758
12759 4. Directories specified with -isystem options are scanned in
12760 left-to-right order.
12761
12762 5. Standard system directories are scanned.
12763
12764 6. Directories specified with -idirafter options are scanned in
12765 left-to-right order.
12766
12767 You can use -I to override a system header file, substituting your
12768 own version, since these directories are searched before the
12769 standard system header file directories. However, you should not
12770 use this option to add directories that contain vendor-supplied
12771 system header files; use -isystem for that.
12772
12773 The -isystem and -idirafter options also mark the directory as a
12774 system directory, so that it gets the same special treatment that
12775 is applied to the standard system directories.
12776
12777 If a standard system include directory, or a directory specified
12778 with -isystem, is also specified with -I, the -I option is ignored.
12779 The directory is still searched but as a system directory at its
12780 normal position in the system include chain. This is to ensure
12781 that GCC's procedure to fix buggy system headers and the ordering
12782 for the "#include_next" directive are not inadvertently changed.
12783 If you really need to change the search order for system
12784 directories, use the -nostdinc and/or -isystem options.
12785
12786 -I- Split the include path. This option has been deprecated. Please
12787 use -iquote instead for -I directories before the -I- and remove
12788 the -I- option.
12789
12790 Any directories specified with -I options before -I- are searched
12791 only for headers requested with "#include "file""; they are not
12792 searched for "#include <file>". If additional directories are
12793 specified with -I options after the -I-, those directories are
12794 searched for all #include directives.
12795
12796 In addition, -I- inhibits the use of the directory of the current
12797 file directory as the first search directory for "#include "file"".
12798 There is no way to override this effect of -I-.
12799
12800 -iprefix prefix
12801 Specify prefix as the prefix for subsequent -iwithprefix options.
12802 If the prefix represents a directory, you should include the final
12803 /.
12804
12805 -iwithprefix dir
12806 -iwithprefixbefore dir
12807 Append dir to the prefix specified previously with -iprefix, and
12808 add the resulting directory to the include search path.
12809 -iwithprefixbefore puts it in the same place -I would; -iwithprefix
12810 puts it where -idirafter would.
12811
12812 -isysroot dir
12813 This option is like the --sysroot option, but applies only to
12814 header files (except for Darwin targets, where it applies to both
12815 header files and libraries). See the --sysroot option for more
12816 information.
12817
12818 -imultilib dir
12819 Use dir as a subdirectory of the directory containing target-
12820 specific C++ headers.
12821
12822 -nostdinc
12823 Do not search the standard system directories for header files.
12824 Only the directories explicitly specified with -I, -iquote,
12825 -isystem, and/or -idirafter options (and the directory of the
12826 current file, if appropriate) are searched.
12827
12828 -nostdinc++
12829 Do not search for header files in the C++-specific standard
12830 directories, but do still search the other standard directories.
12831 (This option is used when building the C++ library.)
12832
12833 -iplugindir=dir
12834 Set the directory to search for plugins that are passed by
12835 -fplugin=name instead of -fplugin=path/name.so. This option is not
12836 meant to be used by the user, but only passed by the driver.
12837
12838 -Ldir
12839 Add directory dir to the list of directories to be searched for -l.
12840
12841 -Bprefix
12842 This option specifies where to find the executables, libraries,
12843 include files, and data files of the compiler itself.
12844
12845 The compiler driver program runs one or more of the subprograms
12846 cpp, cc1, as and ld. It tries prefix as a prefix for each program
12847 it tries to run, both with and without machine/version/ for the
12848 corresponding target machine and compiler version.
12849
12850 For each subprogram to be run, the compiler driver first tries the
12851 -B prefix, if any. If that name is not found, or if -B is not
12852 specified, the driver tries two standard prefixes, /usr/lib/gcc/
12853 and /usr/local/lib/gcc/. If neither of those results in a file
12854 name that is found, the unmodified program name is searched for
12855 using the directories specified in your PATH environment variable.
12856
12857 The compiler checks to see if the path provided by -B refers to a
12858 directory, and if necessary it adds a directory separator character
12859 at the end of the path.
12860
12861 -B prefixes that effectively specify directory names also apply to
12862 libraries in the linker, because the compiler translates these
12863 options into -L options for the linker. They also apply to include
12864 files in the preprocessor, because the compiler translates these
12865 options into -isystem options for the preprocessor. In this case,
12866 the compiler appends include to the prefix.
12867
12868 The runtime support file libgcc.a can also be searched for using
12869 the -B prefix, if needed. If it is not found there, the two
12870 standard prefixes above are tried, and that is all. The file is
12871 left out of the link if it is not found by those means.
12872
12873 Another way to specify a prefix much like the -B prefix is to use
12874 the environment variable GCC_EXEC_PREFIX.
12875
12876 As a special kludge, if the path provided by -B is [dir/]stageN/,
12877 where N is a number in the range 0 to 9, then it is replaced by
12878 [dir/]include. This is to help with boot-strapping the compiler.
12879
12880 -no-canonical-prefixes
12881 Do not expand any symbolic links, resolve references to /../ or
12882 /./, or make the path absolute when generating a relative prefix.
12883
12884 --sysroot=dir
12885 Use dir as the logical root directory for headers and libraries.
12886 For example, if the compiler normally searches for headers in
12887 /usr/include and libraries in /usr/lib, it instead searches
12888 dir/usr/include and dir/usr/lib.
12889
12890 If you use both this option and the -isysroot option, then the
12891 --sysroot option applies to libraries, but the -isysroot option
12892 applies to header files.
12893
12894 The GNU linker (beginning with version 2.16) has the necessary
12895 support for this option. If your linker does not support this
12896 option, the header file aspect of --sysroot still works, but the
12897 library aspect does not.
12898
12899 --no-sysroot-suffix
12900 For some targets, a suffix is added to the root directory specified
12901 with --sysroot, depending on the other options used, so that
12902 headers may for example be found in dir/suffix/usr/include instead
12903 of dir/usr/include. This option disables the addition of such a
12904 suffix.
12905
12906 Options for Code Generation Conventions
12907 These machine-independent options control the interface conventions
12908 used in code generation.
12909
12910 Most of them have both positive and negative forms; the negative form
12911 of -ffoo is -fno-foo. In the table below, only one of the forms is
12912 listed---the one that is not the default. You can figure out the other
12913 form by either removing no- or adding it.
12914
12915 -fstack-reuse=reuse-level
12916 This option controls stack space reuse for user declared local/auto
12917 variables and compiler generated temporaries. reuse_level can be
12918 all, named_vars, or none. all enables stack reuse for all local
12919 variables and temporaries, named_vars enables the reuse only for
12920 user defined local variables with names, and none disables stack
12921 reuse completely. The default value is all. The option is needed
12922 when the program extends the lifetime of a scoped local variable or
12923 a compiler generated temporary beyond the end point defined by the
12924 language. When a lifetime of a variable ends, and if the variable
12925 lives in memory, the optimizing compiler has the freedom to reuse
12926 its stack space with other temporaries or scoped local variables
12927 whose live range does not overlap with it. Legacy code extending
12928 local lifetime is likely to break with the stack reuse
12929 optimization.
12930
12931 For example,
12932
12933 int *p;
12934 {
12935 int local1;
12936
12937 p = &local1;
12938 local1 = 10;
12939 ....
12940 }
12941 {
12942 int local2;
12943 local2 = 20;
12944 ...
12945 }
12946
12947 if (*p == 10) // out of scope use of local1
12948 {
12949
12950 }
12951
12952 Another example:
12953
12954 struct A
12955 {
12956 A(int k) : i(k), j(k) { }
12957 int i;
12958 int j;
12959 };
12960
12961 A *ap;
12962
12963 void foo(const A& ar)
12964 {
12965 ap = &ar;
12966 }
12967
12968 void bar()
12969 {
12970 foo(A(10)); // temp object's lifetime ends when foo returns
12971
12972 {
12973 A a(20);
12974 ....
12975 }
12976 ap->i+= 10; // ap references out of scope temp whose space
12977 // is reused with a. What is the value of ap->i?
12978 }
12979
12980 The lifetime of a compiler generated temporary is well defined by
12981 the C++ standard. When a lifetime of a temporary ends, and if the
12982 temporary lives in memory, the optimizing compiler has the freedom
12983 to reuse its stack space with other temporaries or scoped local
12984 variables whose live range does not overlap with it. However some
12985 of the legacy code relies on the behavior of older compilers in
12986 which temporaries' stack space is not reused, the aggressive stack
12987 reuse can lead to runtime errors. This option is used to control
12988 the temporary stack reuse optimization.
12989
12990 -ftrapv
12991 This option generates traps for signed overflow on addition,
12992 subtraction, multiplication operations. The options -ftrapv and
12993 -fwrapv override each other, so using -ftrapv -fwrapv on the
12994 command-line results in -fwrapv being effective. Note that only
12995 active options override, so using -ftrapv -fwrapv -fno-wrapv on the
12996 command-line results in -ftrapv being effective.
12997
12998 -fwrapv
12999 This option instructs the compiler to assume that signed arithmetic
13000 overflow of addition, subtraction and multiplication wraps around
13001 using twos-complement representation. This flag enables some
13002 optimizations and disables others. The options -ftrapv and -fwrapv
13003 override each other, so using -ftrapv -fwrapv on the command-line
13004 results in -fwrapv being effective. Note that only active options
13005 override, so using -ftrapv -fwrapv -fno-wrapv on the command-line
13006 results in -ftrapv being effective.
13007
13008 -fwrapv-pointer
13009 This option instructs the compiler to assume that pointer
13010 arithmetic overflow on addition and subtraction wraps around using
13011 twos-complement representation. This flag disables some
13012 optimizations which assume pointer overflow is invalid.
13013
13014 -fstrict-overflow
13015 This option implies -fno-wrapv -fno-wrapv-pointer and when negated
13016 implies -fwrapv -fwrapv-pointer.
13017
13018 -fexceptions
13019 Enable exception handling. Generates extra code needed to
13020 propagate exceptions. For some targets, this implies GCC generates
13021 frame unwind information for all functions, which can produce
13022 significant data size overhead, although it does not affect
13023 execution. If you do not specify this option, GCC enables it by
13024 default for languages like C++ that normally require exception
13025 handling, and disables it for languages like C that do not normally
13026 require it. However, you may need to enable this option when
13027 compiling C code that needs to interoperate properly with exception
13028 handlers written in C++. You may also wish to disable this option
13029 if you are compiling older C++ programs that don't use exception
13030 handling.
13031
13032 -fnon-call-exceptions
13033 Generate code that allows trapping instructions to throw
13034 exceptions. Note that this requires platform-specific runtime
13035 support that does not exist everywhere. Moreover, it only allows
13036 trapping instructions to throw exceptions, i.e. memory references
13037 or floating-point instructions. It does not allow exceptions to be
13038 thrown from arbitrary signal handlers such as "SIGALRM".
13039
13040 -fdelete-dead-exceptions
13041 Consider that instructions that may throw exceptions but don't
13042 otherwise contribute to the execution of the program can be
13043 optimized away. This option is enabled by default for the Ada
13044 front end, as permitted by the Ada language specification.
13045 Optimization passes that cause dead exceptions to be removed are
13046 enabled independently at different optimization levels.
13047
13048 -funwind-tables
13049 Similar to -fexceptions, except that it just generates any needed
13050 static data, but does not affect the generated code in any other
13051 way. You normally do not need to enable this option; instead, a
13052 language processor that needs this handling enables it on your
13053 behalf.
13054
13055 -fasynchronous-unwind-tables
13056 Generate unwind table in DWARF format, if supported by target
13057 machine. The table is exact at each instruction boundary, so it
13058 can be used for stack unwinding from asynchronous events (such as
13059 debugger or garbage collector).
13060
13061 -fno-gnu-unique
13062 On systems with recent GNU assembler and C library, the C++
13063 compiler uses the "STB_GNU_UNIQUE" binding to make sure that
13064 definitions of template static data members and static local
13065 variables in inline functions are unique even in the presence of
13066 "RTLD_LOCAL"; this is necessary to avoid problems with a library
13067 used by two different "RTLD_LOCAL" plugins depending on a
13068 definition in one of them and therefore disagreeing with the other
13069 one about the binding of the symbol. But this causes "dlclose" to
13070 be ignored for affected DSOs; if your program relies on
13071 reinitialization of a DSO via "dlclose" and "dlopen", you can use
13072 -fno-gnu-unique.
13073
13074 -fpcc-struct-return
13075 Return "short" "struct" and "union" values in memory like longer
13076 ones, rather than in registers. This convention is less efficient,
13077 but it has the advantage of allowing intercallability between GCC-
13078 compiled files and files compiled with other compilers,
13079 particularly the Portable C Compiler (pcc).
13080
13081 The precise convention for returning structures in memory depends
13082 on the target configuration macros.
13083
13084 Short structures and unions are those whose size and alignment
13085 match that of some integer type.
13086
13087 Warning: code compiled with the -fpcc-struct-return switch is not
13088 binary compatible with code compiled with the -freg-struct-return
13089 switch. Use it to conform to a non-default application binary
13090 interface.
13091
13092 -freg-struct-return
13093 Return "struct" and "union" values in registers when possible.
13094 This is more efficient for small structures than
13095 -fpcc-struct-return.
13096
13097 If you specify neither -fpcc-struct-return nor -freg-struct-return,
13098 GCC defaults to whichever convention is standard for the target.
13099 If there is no standard convention, GCC defaults to
13100 -fpcc-struct-return, except on targets where GCC is the principal
13101 compiler. In those cases, we can choose the standard, and we chose
13102 the more efficient register return alternative.
13103
13104 Warning: code compiled with the -freg-struct-return switch is not
13105 binary compatible with code compiled with the -fpcc-struct-return
13106 switch. Use it to conform to a non-default application binary
13107 interface.
13108
13109 -fshort-enums
13110 Allocate to an "enum" type only as many bytes as it needs for the
13111 declared range of possible values. Specifically, the "enum" type
13112 is equivalent to the smallest integer type that has enough room.
13113
13114 Warning: the -fshort-enums switch causes GCC to generate code that
13115 is not binary compatible with code generated without that switch.
13116 Use it to conform to a non-default application binary interface.
13117
13118 -fshort-wchar
13119 Override the underlying type for "wchar_t" to be "short unsigned
13120 int" instead of the default for the target. This option is useful
13121 for building programs to run under WINE.
13122
13123 Warning: the -fshort-wchar switch causes GCC to generate code that
13124 is not binary compatible with code generated without that switch.
13125 Use it to conform to a non-default application binary interface.
13126
13127 -fcommon
13128 In C code, this option controls the placement of global variables
13129 defined without an initializer, known as tentative definitions in
13130 the C standard. Tentative definitions are distinct from
13131 declarations of a variable with the "extern" keyword, which do not
13132 allocate storage.
13133
13134 The default is -fno-common, which specifies that the compiler
13135 places uninitialized global variables in the BSS section of the
13136 object file. This inhibits the merging of tentative definitions by
13137 the linker so you get a multiple-definition error if the same
13138 variable is accidentally defined in more than one compilation unit.
13139
13140 The -fcommon places uninitialized global variables in a common
13141 block. This allows the linker to resolve all tentative definitions
13142 of the same variable in different compilation units to the same
13143 object, or to a non-tentative definition. This behavior is
13144 inconsistent with C++, and on many targets implies a speed and code
13145 size penalty on global variable references. It is mainly useful to
13146 enable legacy code to link without errors.
13147
13148 -fno-ident
13149 Ignore the "#ident" directive.
13150
13151 -finhibit-size-directive
13152 Don't output a ".size" assembler directive, or anything else that
13153 would cause trouble if the function is split in the middle, and the
13154 two halves are placed at locations far apart in memory. This
13155 option is used when compiling crtstuff.c; you should not need to
13156 use it for anything else.
13157
13158 -fverbose-asm
13159 Put extra commentary information in the generated assembly code to
13160 make it more readable. This option is generally only of use to
13161 those who actually need to read the generated assembly code
13162 (perhaps while debugging the compiler itself).
13163
13164 -fno-verbose-asm, the default, causes the extra information to be
13165 omitted and is useful when comparing two assembler files.
13166
13167 The added comments include:
13168
13169 * information on the compiler version and command-line options,
13170
13171 * the source code lines associated with the assembly
13172 instructions, in the form FILENAME:LINENUMBER:CONTENT OF LINE,
13173
13174 * hints on which high-level expressions correspond to the various
13175 assembly instruction operands.
13176
13177 For example, given this C source file:
13178
13179 int test (int n)
13180 {
13181 int i;
13182 int total = 0;
13183
13184 for (i = 0; i < n; i++)
13185 total += i * i;
13186
13187 return total;
13188 }
13189
13190 compiling to (x86_64) assembly via -S and emitting the result
13191 direct to stdout via -o -
13192
13193 gcc -S test.c -fverbose-asm -Os -o -
13194
13195 gives output similar to this:
13196
13197 .file "test.c"
13198 # GNU C11 (GCC) version 7.0.0 20160809 (experimental) (x86_64-pc-linux-gnu)
13199 [...snip...]
13200 # options passed:
13201 [...snip...]
13202
13203 .text
13204 .globl test
13205 .type test, @function
13206 test:
13207 .LFB0:
13208 .cfi_startproc
13209 # test.c:4: int total = 0;
13210 xorl %eax, %eax # <retval>
13211 # test.c:6: for (i = 0; i < n; i++)
13212 xorl %edx, %edx # i
13213 .L2:
13214 # test.c:6: for (i = 0; i < n; i++)
13215 cmpl %edi, %edx # n, i
13216 jge .L5 #,
13217 # test.c:7: total += i * i;
13218 movl %edx, %ecx # i, tmp92
13219 imull %edx, %ecx # i, tmp92
13220 # test.c:6: for (i = 0; i < n; i++)
13221 incl %edx # i
13222 # test.c:7: total += i * i;
13223 addl %ecx, %eax # tmp92, <retval>
13224 jmp .L2 #
13225 .L5:
13226 # test.c:10: }
13227 ret
13228 .cfi_endproc
13229 .LFE0:
13230 .size test, .-test
13231 .ident "GCC: (GNU) 7.0.0 20160809 (experimental)"
13232 .section .note.GNU-stack,"",@progbits
13233
13234 The comments are intended for humans rather than machines and hence
13235 the precise format of the comments is subject to change.
13236
13237 -frecord-gcc-switches
13238 This switch causes the command line used to invoke the compiler to
13239 be recorded into the object file that is being created. This
13240 switch is only implemented on some targets and the exact format of
13241 the recording is target and binary file format dependent, but it
13242 usually takes the form of a section containing ASCII text. This
13243 switch is related to the -fverbose-asm switch, but that switch only
13244 records information in the assembler output file as comments, so it
13245 never reaches the object file. See also -grecord-gcc-switches for
13246 another way of storing compiler options into the object file.
13247
13248 -fpic
13249 Generate position-independent code (PIC) suitable for use in a
13250 shared library, if supported for the target machine. Such code
13251 accesses all constant addresses through a global offset table
13252 (GOT). The dynamic loader resolves the GOT entries when the
13253 program starts (the dynamic loader is not part of GCC; it is part
13254 of the operating system). If the GOT size for the linked
13255 executable exceeds a machine-specific maximum size, you get an
13256 error message from the linker indicating that -fpic does not work;
13257 in that case, recompile with -fPIC instead. (These maximums are 8k
13258 on the SPARC, 28k on AArch64 and 32k on the m68k and RS/6000. The
13259 x86 has no such limit.)
13260
13261 Position-independent code requires special support, and therefore
13262 works only on certain machines. For the x86, GCC supports PIC for
13263 System V but not for the Sun 386i. Code generated for the IBM
13264 RS/6000 is always position-independent.
13265
13266 When this flag is set, the macros "__pic__" and "__PIC__" are
13267 defined to 1.
13268
13269 -fPIC
13270 If supported for the target machine, emit position-independent
13271 code, suitable for dynamic linking and avoiding any limit on the
13272 size of the global offset table. This option makes a difference on
13273 AArch64, m68k, PowerPC and SPARC.
13274
13275 Position-independent code requires special support, and therefore
13276 works only on certain machines.
13277
13278 When this flag is set, the macros "__pic__" and "__PIC__" are
13279 defined to 2.
13280
13281 -fpie
13282 -fPIE
13283 These options are similar to -fpic and -fPIC, but the generated
13284 position-independent code can be only linked into executables.
13285 Usually these options are used to compile code that will be linked
13286 using the -pie GCC option.
13287
13288 -fpie and -fPIE both define the macros "__pie__" and "__PIE__".
13289 The macros have the value 1 for -fpie and 2 for -fPIE.
13290
13291 -fno-plt
13292 Do not use the PLT for external function calls in position-
13293 independent code. Instead, load the callee address at call sites
13294 from the GOT and branch to it. This leads to more efficient code
13295 by eliminating PLT stubs and exposing GOT loads to optimizations.
13296 On architectures such as 32-bit x86 where PLT stubs expect the GOT
13297 pointer in a specific register, this gives more register allocation
13298 freedom to the compiler. Lazy binding requires use of the PLT;
13299 with -fno-plt all external symbols are resolved at load time.
13300
13301 Alternatively, the function attribute "noplt" can be used to avoid
13302 calls through the PLT for specific external functions.
13303
13304 In position-dependent code, a few targets also convert calls to
13305 functions that are marked to not use the PLT to use the GOT
13306 instead.
13307
13308 -fno-jump-tables
13309 Do not use jump tables for switch statements even where it would be
13310 more efficient than other code generation strategies. This option
13311 is of use in conjunction with -fpic or -fPIC for building code that
13312 forms part of a dynamic linker and cannot reference the address of
13313 a jump table. On some targets, jump tables do not require a GOT
13314 and this option is not needed.
13315
13316 -ffixed-reg
13317 Treat the register named reg as a fixed register; generated code
13318 should never refer to it (except perhaps as a stack pointer, frame
13319 pointer or in some other fixed role).
13320
13321 reg must be the name of a register. The register names accepted
13322 are machine-specific and are defined in the "REGISTER_NAMES" macro
13323 in the machine description macro file.
13324
13325 This flag does not have a negative form, because it specifies a
13326 three-way choice.
13327
13328 -fcall-used-reg
13329 Treat the register named reg as an allocable register that is
13330 clobbered by function calls. It may be allocated for temporaries
13331 or variables that do not live across a call. Functions compiled
13332 this way do not save and restore the register reg.
13333
13334 It is an error to use this flag with the frame pointer or stack
13335 pointer. Use of this flag for other registers that have fixed
13336 pervasive roles in the machine's execution model produces
13337 disastrous results.
13338
13339 This flag does not have a negative form, because it specifies a
13340 three-way choice.
13341
13342 -fcall-saved-reg
13343 Treat the register named reg as an allocable register saved by
13344 functions. It may be allocated even for temporaries or variables
13345 that live across a call. Functions compiled this way save and
13346 restore the register reg if they use it.
13347
13348 It is an error to use this flag with the frame pointer or stack
13349 pointer. Use of this flag for other registers that have fixed
13350 pervasive roles in the machine's execution model produces
13351 disastrous results.
13352
13353 A different sort of disaster results from the use of this flag for
13354 a register in which function values may be returned.
13355
13356 This flag does not have a negative form, because it specifies a
13357 three-way choice.
13358
13359 -fpack-struct[=n]
13360 Without a value specified, pack all structure members together
13361 without holes. When a value is specified (which must be a small
13362 power of two), pack structure members according to this value,
13363 representing the maximum alignment (that is, objects with default
13364 alignment requirements larger than this are output potentially
13365 unaligned at the next fitting location.
13366
13367 Warning: the -fpack-struct switch causes GCC to generate code that
13368 is not binary compatible with code generated without that switch.
13369 Additionally, it makes the code suboptimal. Use it to conform to a
13370 non-default application binary interface.
13371
13372 -fleading-underscore
13373 This option and its counterpart, -fno-leading-underscore, forcibly
13374 change the way C symbols are represented in the object file. One
13375 use is to help link with legacy assembly code.
13376
13377 Warning: the -fleading-underscore switch causes GCC to generate
13378 code that is not binary compatible with code generated without that
13379 switch. Use it to conform to a non-default application binary
13380 interface. Not all targets provide complete support for this
13381 switch.
13382
13383 -ftls-model=model
13384 Alter the thread-local storage model to be used. The model
13385 argument should be one of global-dynamic, local-dynamic, initial-
13386 exec or local-exec. Note that the choice is subject to
13387 optimization: the compiler may use a more efficient model for
13388 symbols not visible outside of the translation unit, or if -fpic is
13389 not given on the command line.
13390
13391 The default without -fpic is initial-exec; with -fpic the default
13392 is global-dynamic.
13393
13394 -ftrampolines
13395 For targets that normally need trampolines for nested functions,
13396 always generate them instead of using descriptors. Otherwise, for
13397 targets that do not need them, like for example HP-PA or IA-64, do
13398 nothing.
13399
13400 A trampoline is a small piece of code that is created at run time
13401 on the stack when the address of a nested function is taken, and is
13402 used to call the nested function indirectly. Therefore, it
13403 requires the stack to be made executable in order for the program
13404 to work properly.
13405
13406 -fno-trampolines is enabled by default on a language by language
13407 basis to let the compiler avoid generating them, if it computes
13408 that this is safe, and replace them with descriptors. Descriptors
13409 are made up of data only, but the generated code must be prepared
13410 to deal with them. As of this writing, -fno-trampolines is enabled
13411 by default only for Ada.
13412
13413 Moreover, code compiled with -ftrampolines and code compiled with
13414 -fno-trampolines are not binary compatible if nested functions are
13415 present. This option must therefore be used on a program-wide
13416 basis and be manipulated with extreme care.
13417
13418 -fvisibility=[default|internal|hidden|protected]
13419 Set the default ELF image symbol visibility to the specified
13420 option---all symbols are marked with this unless overridden within
13421 the code. Using this feature can very substantially improve
13422 linking and load times of shared object libraries, produce more
13423 optimized code, provide near-perfect API export and prevent symbol
13424 clashes. It is strongly recommended that you use this in any
13425 shared objects you distribute.
13426
13427 Despite the nomenclature, default always means public; i.e.,
13428 available to be linked against from outside the shared object.
13429 protected and internal are pretty useless in real-world usage so
13430 the only other commonly used option is hidden. The default if
13431 -fvisibility isn't specified is default, i.e., make every symbol
13432 public.
13433
13434 A good explanation of the benefits offered by ensuring ELF symbols
13435 have the correct visibility is given by "How To Write Shared
13436 Libraries" by Ulrich Drepper (which can be found at
13437 <https://www.akkadia.org/drepper/>)---however a superior solution
13438 made possible by this option to marking things hidden when the
13439 default is public is to make the default hidden and mark things
13440 public. This is the norm with DLLs on Windows and with
13441 -fvisibility=hidden and "__attribute__ ((visibility("default")))"
13442 instead of "__declspec(dllexport)" you get almost identical
13443 semantics with identical syntax. This is a great boon to those
13444 working with cross-platform projects.
13445
13446 For those adding visibility support to existing code, you may find
13447 "#pragma GCC visibility" of use. This works by you enclosing the
13448 declarations you wish to set visibility for with (for example)
13449 "#pragma GCC visibility push(hidden)" and "#pragma GCC visibility
13450 pop". Bear in mind that symbol visibility should be viewed as part
13451 of the API interface contract and thus all new code should always
13452 specify visibility when it is not the default; i.e., declarations
13453 only for use within the local DSO should always be marked
13454 explicitly as hidden as so to avoid PLT indirection
13455 overheads---making this abundantly clear also aids readability and
13456 self-documentation of the code. Note that due to ISO C++
13457 specification requirements, "operator new" and "operator delete"
13458 must always be of default visibility.
13459
13460 Be aware that headers from outside your project, in particular
13461 system headers and headers from any other library you use, may not
13462 be expecting to be compiled with visibility other than the default.
13463 You may need to explicitly say "#pragma GCC visibility
13464 push(default)" before including any such headers.
13465
13466 "extern" declarations are not affected by -fvisibility, so a lot of
13467 code can be recompiled with -fvisibility=hidden with no
13468 modifications. However, this means that calls to "extern"
13469 functions with no explicit visibility use the PLT, so it is more
13470 effective to use "__attribute ((visibility))" and/or "#pragma GCC
13471 visibility" to tell the compiler which "extern" declarations should
13472 be treated as hidden.
13473
13474 Note that -fvisibility does affect C++ vague linkage entities. This
13475 means that, for instance, an exception class that is be thrown
13476 between DSOs must be explicitly marked with default visibility so
13477 that the type_info nodes are unified between the DSOs.
13478
13479 An overview of these techniques, their benefits and how to use them
13480 is at <http://gcc.gnu.org/wiki/Visibility>.
13481
13482 -fstrict-volatile-bitfields
13483 This option should be used if accesses to volatile bit-fields (or
13484 other structure fields, although the compiler usually honors those
13485 types anyway) should use a single access of the width of the
13486 field's type, aligned to a natural alignment if possible. For
13487 example, targets with memory-mapped peripheral registers might
13488 require all such accesses to be 16 bits wide; with this flag you
13489 can declare all peripheral bit-fields as "unsigned short" (assuming
13490 short is 16 bits on these targets) to force GCC to use 16-bit
13491 accesses instead of, perhaps, a more efficient 32-bit access.
13492
13493 If this option is disabled, the compiler uses the most efficient
13494 instruction. In the previous example, that might be a 32-bit load
13495 instruction, even though that accesses bytes that do not contain
13496 any portion of the bit-field, or memory-mapped registers unrelated
13497 to the one being updated.
13498
13499 In some cases, such as when the "packed" attribute is applied to a
13500 structure field, it may not be possible to access the field with a
13501 single read or write that is correctly aligned for the target
13502 machine. In this case GCC falls back to generating multiple
13503 accesses rather than code that will fault or truncate the result at
13504 run time.
13505
13506 Note: Due to restrictions of the C/C++11 memory model, write
13507 accesses are not allowed to touch non bit-field members. It is
13508 therefore recommended to define all bits of the field's type as
13509 bit-field members.
13510
13511 The default value of this option is determined by the application
13512 binary interface for the target processor.
13513
13514 -fsync-libcalls
13515 This option controls whether any out-of-line instance of the
13516 "__sync" family of functions may be used to implement the C++11
13517 "__atomic" family of functions.
13518
13519 The default value of this option is enabled, thus the only useful
13520 form of the option is -fno-sync-libcalls. This option is used in
13521 the implementation of the libatomic runtime library.
13522
13523 GCC Developer Options
13524 This section describes command-line options that are primarily of
13525 interest to GCC developers, including options to support compiler
13526 testing and investigation of compiler bugs and compile-time performance
13527 problems. This includes options that produce debug dumps at various
13528 points in the compilation; that print statistics such as memory use and
13529 execution time; and that print information about GCC's configuration,
13530 such as where it searches for libraries. You should rarely need to use
13531 any of these options for ordinary compilation and linking tasks.
13532
13533 Many developer options that cause GCC to dump output to a file take an
13534 optional =filename suffix. You can specify stdout or - to dump to
13535 standard output, and stderr for standard error.
13536
13537 If =filename is omitted, a default dump file name is constructed by
13538 concatenating the base dump file name, a pass number, phase letter, and
13539 pass name. The base dump file name is the name of output file produced
13540 by the compiler if explicitly specified and not an executable;
13541 otherwise it is the source file name. The pass number is determined by
13542 the order passes are registered with the compiler's pass manager. This
13543 is generally the same as the order of execution, but passes registered
13544 by plugins, target-specific passes, or passes that are otherwise
13545 registered late are numbered higher than the pass named final, even if
13546 they are executed earlier. The phase letter is one of i (inter-
13547 procedural analysis), l (language-specific), r (RTL), or t (tree). The
13548 files are created in the directory of the output file.
13549
13550 -fcallgraph-info
13551 -fcallgraph-info=MARKERS
13552 Makes the compiler output callgraph information for the program, on
13553 a per-object-file basis. The information is generated in the
13554 common VCG format. It can be decorated with additional, per-node
13555 and/or per-edge information, if a list of comma-separated markers
13556 is additionally specified. When the "su" marker is specified, the
13557 callgraph is decorated with stack usage information; it is
13558 equivalent to -fstack-usage. When the "da" marker is specified,
13559 the callgraph is decorated with information about dynamically
13560 allocated objects.
13561
13562 When compiling with -flto, no callgraph information is output along
13563 with the object file. At LTO link time, -fcallgraph-info may
13564 generate multiple callgraph information files next to intermediate
13565 LTO output files.
13566
13567 -dletters
13568 -fdump-rtl-pass
13569 -fdump-rtl-pass=filename
13570 Says to make debugging dumps during compilation at times specified
13571 by letters. This is used for debugging the RTL-based passes of the
13572 compiler.
13573
13574 Some -dletters switches have different meaning when -E is used for
13575 preprocessing.
13576
13577 Debug dumps can be enabled with a -fdump-rtl switch or some -d
13578 option letters. Here are the possible letters for use in pass and
13579 letters, and their meanings:
13580
13581 -fdump-rtl-alignments
13582 Dump after branch alignments have been computed.
13583
13584 -fdump-rtl-asmcons
13585 Dump after fixing rtl statements that have unsatisfied in/out
13586 constraints.
13587
13588 -fdump-rtl-auto_inc_dec
13589 Dump after auto-inc-dec discovery. This pass is only run on
13590 architectures that have auto inc or auto dec instructions.
13591
13592 -fdump-rtl-barriers
13593 Dump after cleaning up the barrier instructions.
13594
13595 -fdump-rtl-bbpart
13596 Dump after partitioning hot and cold basic blocks.
13597
13598 -fdump-rtl-bbro
13599 Dump after block reordering.
13600
13601 -fdump-rtl-btl1
13602 -fdump-rtl-btl2
13603 -fdump-rtl-btl1 and -fdump-rtl-btl2 enable dumping after the
13604 two branch target load optimization passes.
13605
13606 -fdump-rtl-bypass
13607 Dump after jump bypassing and control flow optimizations.
13608
13609 -fdump-rtl-combine
13610 Dump after the RTL instruction combination pass.
13611
13612 -fdump-rtl-compgotos
13613 Dump after duplicating the computed gotos.
13614
13615 -fdump-rtl-ce1
13616 -fdump-rtl-ce2
13617 -fdump-rtl-ce3
13618 -fdump-rtl-ce1, -fdump-rtl-ce2, and -fdump-rtl-ce3 enable
13619 dumping after the three if conversion passes.
13620
13621 -fdump-rtl-cprop_hardreg
13622 Dump after hard register copy propagation.
13623
13624 -fdump-rtl-csa
13625 Dump after combining stack adjustments.
13626
13627 -fdump-rtl-cse1
13628 -fdump-rtl-cse2
13629 -fdump-rtl-cse1 and -fdump-rtl-cse2 enable dumping after the
13630 two common subexpression elimination passes.
13631
13632 -fdump-rtl-dce
13633 Dump after the standalone dead code elimination passes.
13634
13635 -fdump-rtl-dbr
13636 Dump after delayed branch scheduling.
13637
13638 -fdump-rtl-dce1
13639 -fdump-rtl-dce2
13640 -fdump-rtl-dce1 and -fdump-rtl-dce2 enable dumping after the
13641 two dead store elimination passes.
13642
13643 -fdump-rtl-eh
13644 Dump after finalization of EH handling code.
13645
13646 -fdump-rtl-eh_ranges
13647 Dump after conversion of EH handling range regions.
13648
13649 -fdump-rtl-expand
13650 Dump after RTL generation.
13651
13652 -fdump-rtl-fwprop1
13653 -fdump-rtl-fwprop2
13654 -fdump-rtl-fwprop1 and -fdump-rtl-fwprop2 enable dumping after
13655 the two forward propagation passes.
13656
13657 -fdump-rtl-gcse1
13658 -fdump-rtl-gcse2
13659 -fdump-rtl-gcse1 and -fdump-rtl-gcse2 enable dumping after
13660 global common subexpression elimination.
13661
13662 -fdump-rtl-init-regs
13663 Dump after the initialization of the registers.
13664
13665 -fdump-rtl-initvals
13666 Dump after the computation of the initial value sets.
13667
13668 -fdump-rtl-into_cfglayout
13669 Dump after converting to cfglayout mode.
13670
13671 -fdump-rtl-ira
13672 Dump after iterated register allocation.
13673
13674 -fdump-rtl-jump
13675 Dump after the second jump optimization.
13676
13677 -fdump-rtl-loop2
13678 -fdump-rtl-loop2 enables dumping after the rtl loop
13679 optimization passes.
13680
13681 -fdump-rtl-mach
13682 Dump after performing the machine dependent reorganization
13683 pass, if that pass exists.
13684
13685 -fdump-rtl-mode_sw
13686 Dump after removing redundant mode switches.
13687
13688 -fdump-rtl-rnreg
13689 Dump after register renumbering.
13690
13691 -fdump-rtl-outof_cfglayout
13692 Dump after converting from cfglayout mode.
13693
13694 -fdump-rtl-peephole2
13695 Dump after the peephole pass.
13696
13697 -fdump-rtl-postreload
13698 Dump after post-reload optimizations.
13699
13700 -fdump-rtl-pro_and_epilogue
13701 Dump after generating the function prologues and epilogues.
13702
13703 -fdump-rtl-sched1
13704 -fdump-rtl-sched2
13705 -fdump-rtl-sched1 and -fdump-rtl-sched2 enable dumping after
13706 the basic block scheduling passes.
13707
13708 -fdump-rtl-ree
13709 Dump after sign/zero extension elimination.
13710
13711 -fdump-rtl-seqabstr
13712 Dump after common sequence discovery.
13713
13714 -fdump-rtl-shorten
13715 Dump after shortening branches.
13716
13717 -fdump-rtl-sibling
13718 Dump after sibling call optimizations.
13719
13720 -fdump-rtl-split1
13721 -fdump-rtl-split2
13722 -fdump-rtl-split3
13723 -fdump-rtl-split4
13724 -fdump-rtl-split5
13725 These options enable dumping after five rounds of instruction
13726 splitting.
13727
13728 -fdump-rtl-sms
13729 Dump after modulo scheduling. This pass is only run on some
13730 architectures.
13731
13732 -fdump-rtl-stack
13733 Dump after conversion from GCC's "flat register file" registers
13734 to the x87's stack-like registers. This pass is only run on
13735 x86 variants.
13736
13737 -fdump-rtl-subreg1
13738 -fdump-rtl-subreg2
13739 -fdump-rtl-subreg1 and -fdump-rtl-subreg2 enable dumping after
13740 the two subreg expansion passes.
13741
13742 -fdump-rtl-unshare
13743 Dump after all rtl has been unshared.
13744
13745 -fdump-rtl-vartrack
13746 Dump after variable tracking.
13747
13748 -fdump-rtl-vregs
13749 Dump after converting virtual registers to hard registers.
13750
13751 -fdump-rtl-web
13752 Dump after live range splitting.
13753
13754 -fdump-rtl-regclass
13755 -fdump-rtl-subregs_of_mode_init
13756 -fdump-rtl-subregs_of_mode_finish
13757 -fdump-rtl-dfinit
13758 -fdump-rtl-dfinish
13759 These dumps are defined but always produce empty files.
13760
13761 -da
13762 -fdump-rtl-all
13763 Produce all the dumps listed above.
13764
13765 -dA Annotate the assembler output with miscellaneous debugging
13766 information.
13767
13768 -dD Dump all macro definitions, at the end of preprocessing, in
13769 addition to normal output.
13770
13771 -dH Produce a core dump whenever an error occurs.
13772
13773 -dp Annotate the assembler output with a comment indicating which
13774 pattern and alternative is used. The length and cost of each
13775 instruction are also printed.
13776
13777 -dP Dump the RTL in the assembler output as a comment before each
13778 instruction. Also turns on -dp annotation.
13779
13780 -dx Just generate RTL for a function instead of compiling it.
13781 Usually used with -fdump-rtl-expand.
13782
13783 -fdump-debug
13784 Dump debugging information generated during the debug generation
13785 phase.
13786
13787 -fdump-earlydebug
13788 Dump debugging information generated during the early debug
13789 generation phase.
13790
13791 -fdump-noaddr
13792 When doing debugging dumps, suppress address output. This makes it
13793 more feasible to use diff on debugging dumps for compiler
13794 invocations with different compiler binaries and/or different text
13795 / bss / data / heap / stack / dso start locations.
13796
13797 -freport-bug
13798 Collect and dump debug information into a temporary file if an
13799 internal compiler error (ICE) occurs.
13800
13801 -fdump-unnumbered
13802 When doing debugging dumps, suppress instruction numbers and
13803 address output. This makes it more feasible to use diff on
13804 debugging dumps for compiler invocations with different options, in
13805 particular with and without -g.
13806
13807 -fdump-unnumbered-links
13808 When doing debugging dumps (see -d option above), suppress
13809 instruction numbers for the links to the previous and next
13810 instructions in a sequence.
13811
13812 -fdump-ipa-switch
13813 -fdump-ipa-switch-options
13814 Control the dumping at various stages of inter-procedural analysis
13815 language tree to a file. The file name is generated by appending a
13816 switch specific suffix to the source file name, and the file is
13817 created in the same directory as the output file. The following
13818 dumps are possible:
13819
13820 all Enables all inter-procedural analysis dumps.
13821
13822 cgraph
13823 Dumps information about call-graph optimization, unused
13824 function removal, and inlining decisions.
13825
13826 inline
13827 Dump after function inlining.
13828
13829 Additionally, the options -optimized, -missed, -note, and -all can
13830 be provided, with the same meaning as for -fopt-info, defaulting to
13831 -optimized.
13832
13833 For example, -fdump-ipa-inline-optimized-missed will emit
13834 information on callsites that were inlined, along with callsites
13835 that were not inlined.
13836
13837 By default, the dump will contain messages about successful
13838 optimizations (equivalent to -optimized) together with low-level
13839 details about the analysis.
13840
13841 -fdump-lang-all
13842 -fdump-lang-switch
13843 -fdump-lang-switch-options
13844 -fdump-lang-switch-options=filename
13845 Control the dumping of language-specific information. The options
13846 and filename portions behave as described in the -fdump-tree
13847 option. The following switch values are accepted:
13848
13849 all Enable all language-specific dumps.
13850
13851 class
13852 Dump class hierarchy information. Virtual table information is
13853 emitted unless 'slim' is specified. This option is applicable
13854 to C++ only.
13855
13856 raw Dump the raw internal tree data. This option is applicable to
13857 C++ only.
13858
13859 -fdump-passes
13860 Print on stderr the list of optimization passes that are turned on
13861 and off by the current command-line options.
13862
13863 -fdump-statistics-option
13864 Enable and control dumping of pass statistics in a separate file.
13865 The file name is generated by appending a suffix ending in
13866 .statistics to the source file name, and the file is created in the
13867 same directory as the output file. If the -option form is used,
13868 -stats causes counters to be summed over the whole compilation unit
13869 while -details dumps every event as the passes generate them. The
13870 default with no option is to sum counters for each function
13871 compiled.
13872
13873 -fdump-tree-all
13874 -fdump-tree-switch
13875 -fdump-tree-switch-options
13876 -fdump-tree-switch-options=filename
13877 Control the dumping at various stages of processing the
13878 intermediate language tree to a file. If the -options form is
13879 used, options is a list of - separated options which control the
13880 details of the dump. Not all options are applicable to all dumps;
13881 those that are not meaningful are ignored. The following options
13882 are available
13883
13884 address
13885 Print the address of each node. Usually this is not meaningful
13886 as it changes according to the environment and source file.
13887 Its primary use is for tying up a dump file with a debug
13888 environment.
13889
13890 asmname
13891 If "DECL_ASSEMBLER_NAME" has been set for a given decl, use
13892 that in the dump instead of "DECL_NAME". Its primary use is
13893 ease of use working backward from mangled names in the assembly
13894 file.
13895
13896 slim
13897 When dumping front-end intermediate representations, inhibit
13898 dumping of members of a scope or body of a function merely
13899 because that scope has been reached. Only dump such items when
13900 they are directly reachable by some other path.
13901
13902 When dumping pretty-printed trees, this option inhibits dumping
13903 the bodies of control structures.
13904
13905 When dumping RTL, print the RTL in slim (condensed) form
13906 instead of the default LISP-like representation.
13907
13908 raw Print a raw representation of the tree. By default, trees are
13909 pretty-printed into a C-like representation.
13910
13911 details
13912 Enable more detailed dumps (not honored by every dump option).
13913 Also include information from the optimization passes.
13914
13915 stats
13916 Enable dumping various statistics about the pass (not honored
13917 by every dump option).
13918
13919 blocks
13920 Enable showing basic block boundaries (disabled in raw dumps).
13921
13922 graph
13923 For each of the other indicated dump files (-fdump-rtl-pass),
13924 dump a representation of the control flow graph suitable for
13925 viewing with GraphViz to file.passid.pass.dot. Each function
13926 in the file is pretty-printed as a subgraph, so that GraphViz
13927 can render them all in a single plot.
13928
13929 This option currently only works for RTL dumps, and the RTL is
13930 always dumped in slim form.
13931
13932 vops
13933 Enable showing virtual operands for every statement.
13934
13935 lineno
13936 Enable showing line numbers for statements.
13937
13938 uid Enable showing the unique ID ("DECL_UID") for each variable.
13939
13940 verbose
13941 Enable showing the tree dump for each statement.
13942
13943 eh Enable showing the EH region number holding each statement.
13944
13945 scev
13946 Enable showing scalar evolution analysis details.
13947
13948 optimized
13949 Enable showing optimization information (only available in
13950 certain passes).
13951
13952 missed
13953 Enable showing missed optimization information (only available
13954 in certain passes).
13955
13956 note
13957 Enable other detailed optimization information (only available
13958 in certain passes).
13959
13960 all Turn on all options, except raw, slim, verbose and lineno.
13961
13962 optall
13963 Turn on all optimization options, i.e., optimized, missed, and
13964 note.
13965
13966 To determine what tree dumps are available or find the dump for a
13967 pass of interest follow the steps below.
13968
13969 1. Invoke GCC with -fdump-passes and in the stderr output look for
13970 a code that corresponds to the pass you are interested in. For
13971 example, the codes "tree-evrp", "tree-vrp1", and "tree-vrp2"
13972 correspond to the three Value Range Propagation passes. The
13973 number at the end distinguishes distinct invocations of the
13974 same pass.
13975
13976 2. To enable the creation of the dump file, append the pass code
13977 to the -fdump- option prefix and invoke GCC with it. For
13978 example, to enable the dump from the Early Value Range
13979 Propagation pass, invoke GCC with the -fdump-tree-evrp option.
13980 Optionally, you may specify the name of the dump file. If you
13981 don't specify one, GCC creates as described below.
13982
13983 3. Find the pass dump in a file whose name is composed of three
13984 components separated by a period: the name of the source file
13985 GCC was invoked to compile, a numeric suffix indicating the
13986 pass number followed by the letter t for tree passes (and the
13987 letter r for RTL passes), and finally the pass code. For
13988 example, the Early VRP pass dump might be in a file named
13989 myfile.c.038t.evrp in the current working directory. Note that
13990 the numeric codes are not stable and may change from one
13991 version of GCC to another.
13992
13993 -fopt-info
13994 -fopt-info-options
13995 -fopt-info-options=filename
13996 Controls optimization dumps from various optimization passes. If
13997 the -options form is used, options is a list of - separated option
13998 keywords to select the dump details and optimizations.
13999
14000 The options can be divided into three groups:
14001
14002 1. options describing what kinds of messages should be emitted,
14003
14004 2. options describing the verbosity of the dump, and
14005
14006 3. options describing which optimizations should be included.
14007
14008 The options from each group can be freely mixed as they are non-
14009 overlapping. However, in case of any conflicts, the later options
14010 override the earlier options on the command line.
14011
14012 The following options control which kinds of messages should be
14013 emitted:
14014
14015 optimized
14016 Print information when an optimization is successfully applied.
14017 It is up to a pass to decide which information is relevant. For
14018 example, the vectorizer passes print the source location of
14019 loops which are successfully vectorized.
14020
14021 missed
14022 Print information about missed optimizations. Individual passes
14023 control which information to include in the output.
14024
14025 note
14026 Print verbose information about optimizations, such as certain
14027 transformations, more detailed messages about decisions etc.
14028
14029 all Print detailed optimization information. This includes
14030 optimized, missed, and note.
14031
14032 The following option controls the dump verbosity:
14033
14034 internals
14035 By default, only "high-level" messages are emitted. This option
14036 enables additional, more detailed, messages, which are likely
14037 to only be of interest to GCC developers.
14038
14039 One or more of the following option keywords can be used to
14040 describe a group of optimizations:
14041
14042 ipa Enable dumps from all interprocedural optimizations.
14043
14044 loop
14045 Enable dumps from all loop optimizations.
14046
14047 inline
14048 Enable dumps from all inlining optimizations.
14049
14050 omp Enable dumps from all OMP (Offloading and Multi Processing)
14051 optimizations.
14052
14053 vec Enable dumps from all vectorization optimizations.
14054
14055 optall
14056 Enable dumps from all optimizations. This is a superset of the
14057 optimization groups listed above.
14058
14059 If options is omitted, it defaults to optimized-optall, which means
14060 to dump messages about successful optimizations from all the
14061 passes, omitting messages that are treated as "internals".
14062
14063 If the filename is provided, then the dumps from all the applicable
14064 optimizations are concatenated into the filename. Otherwise the
14065 dump is output onto stderr. Though multiple -fopt-info options are
14066 accepted, only one of them can include a filename. If other
14067 filenames are provided then all but the first such option are
14068 ignored.
14069
14070 Note that the output filename is overwritten in case of multiple
14071 translation units. If a combined output from multiple translation
14072 units is desired, stderr should be used instead.
14073
14074 In the following example, the optimization info is output to
14075 stderr:
14076
14077 gcc -O3 -fopt-info
14078
14079 This example:
14080
14081 gcc -O3 -fopt-info-missed=missed.all
14082
14083 outputs missed optimization report from all the passes into
14084 missed.all, and this one:
14085
14086 gcc -O2 -ftree-vectorize -fopt-info-vec-missed
14087
14088 prints information about missed optimization opportunities from
14089 vectorization passes on stderr. Note that -fopt-info-vec-missed is
14090 equivalent to -fopt-info-missed-vec. The order of the optimization
14091 group names and message types listed after -fopt-info does not
14092 matter.
14093
14094 As another example,
14095
14096 gcc -O3 -fopt-info-inline-optimized-missed=inline.txt
14097
14098 outputs information about missed optimizations as well as optimized
14099 locations from all the inlining passes into inline.txt.
14100
14101 Finally, consider:
14102
14103 gcc -fopt-info-vec-missed=vec.miss -fopt-info-loop-optimized=loop.opt
14104
14105 Here the two output filenames vec.miss and loop.opt are in conflict
14106 since only one output file is allowed. In this case, only the first
14107 option takes effect and the subsequent options are ignored. Thus
14108 only vec.miss is produced which contains dumps from the vectorizer
14109 about missed opportunities.
14110
14111 -fsave-optimization-record
14112 Write a SRCFILE.opt-record.json.gz file detailing what
14113 optimizations were performed, for those optimizations that support
14114 -fopt-info.
14115
14116 This option is experimental and the format of the data within the
14117 compressed JSON file is subject to change.
14118
14119 It is roughly equivalent to a machine-readable version of
14120 -fopt-info-all, as a collection of messages with source file, line
14121 number and column number, with the following additional data for
14122 each message:
14123
14124 * the execution count of the code being optimized, along with
14125 metadata about whether this was from actual profile data, or
14126 just an estimate, allowing consumers to prioritize messages by
14127 code hotness,
14128
14129 * the function name of the code being optimized, where
14130 applicable,
14131
14132 * the "inlining chain" for the code being optimized, so that when
14133 a function is inlined into several different places (which
14134 might themselves be inlined), the reader can distinguish
14135 between the copies,
14136
14137 * objects identifying those parts of the message that refer to
14138 expressions, statements or symbol-table nodes, which of these
14139 categories they are, and, when available, their source code
14140 location,
14141
14142 * the GCC pass that emitted the message, and
14143
14144 * the location in GCC's own code from which the message was
14145 emitted
14146
14147 Additionally, some messages are logically nested within other
14148 messages, reflecting implementation details of the optimization
14149 passes.
14150
14151 -fsched-verbose=n
14152 On targets that use instruction scheduling, this option controls
14153 the amount of debugging output the scheduler prints to the dump
14154 files.
14155
14156 For n greater than zero, -fsched-verbose outputs the same
14157 information as -fdump-rtl-sched1 and -fdump-rtl-sched2. For n
14158 greater than one, it also output basic block probabilities,
14159 detailed ready list information and unit/insn info. For n greater
14160 than two, it includes RTL at abort point, control-flow and regions
14161 info. And for n over four, -fsched-verbose also includes
14162 dependence info.
14163
14164 -fenable-kind-pass
14165 -fdisable-kind-pass=range-list
14166 This is a set of options that are used to explicitly disable/enable
14167 optimization passes. These options are intended for use for
14168 debugging GCC. Compiler users should use regular options for
14169 enabling/disabling passes instead.
14170
14171 -fdisable-ipa-pass
14172 Disable IPA pass pass. pass is the pass name. If the same pass
14173 is statically invoked in the compiler multiple times, the pass
14174 name should be appended with a sequential number starting from
14175 1.
14176
14177 -fdisable-rtl-pass
14178 -fdisable-rtl-pass=range-list
14179 Disable RTL pass pass. pass is the pass name. If the same
14180 pass is statically invoked in the compiler multiple times, the
14181 pass name should be appended with a sequential number starting
14182 from 1. range-list is a comma-separated list of function
14183 ranges or assembler names. Each range is a number pair
14184 separated by a colon. The range is inclusive in both ends. If
14185 the range is trivial, the number pair can be simplified as a
14186 single number. If the function's call graph node's uid falls
14187 within one of the specified ranges, the pass is disabled for
14188 that function. The uid is shown in the function header of a
14189 dump file, and the pass names can be dumped by using option
14190 -fdump-passes.
14191
14192 -fdisable-tree-pass
14193 -fdisable-tree-pass=range-list
14194 Disable tree pass pass. See -fdisable-rtl for the description
14195 of option arguments.
14196
14197 -fenable-ipa-pass
14198 Enable IPA pass pass. pass is the pass name. If the same pass
14199 is statically invoked in the compiler multiple times, the pass
14200 name should be appended with a sequential number starting from
14201 1.
14202
14203 -fenable-rtl-pass
14204 -fenable-rtl-pass=range-list
14205 Enable RTL pass pass. See -fdisable-rtl for option argument
14206 description and examples.
14207
14208 -fenable-tree-pass
14209 -fenable-tree-pass=range-list
14210 Enable tree pass pass. See -fdisable-rtl for the description
14211 of option arguments.
14212
14213 Here are some examples showing uses of these options.
14214
14215 # disable ccp1 for all functions
14216 -fdisable-tree-ccp1
14217 # disable complete unroll for function whose cgraph node uid is 1
14218 -fenable-tree-cunroll=1
14219 # disable gcse2 for functions at the following ranges [1,1],
14220 # [300,400], and [400,1000]
14221 # disable gcse2 for functions foo and foo2
14222 -fdisable-rtl-gcse2=foo,foo2
14223 # disable early inlining
14224 -fdisable-tree-einline
14225 # disable ipa inlining
14226 -fdisable-ipa-inline
14227 # enable tree full unroll
14228 -fenable-tree-unroll
14229
14230 -fchecking
14231 -fchecking=n
14232 Enable internal consistency checking. The default depends on the
14233 compiler configuration. -fchecking=2 enables further internal
14234 consistency checking that might affect code generation.
14235
14236 -frandom-seed=string
14237 This option provides a seed that GCC uses in place of random
14238 numbers in generating certain symbol names that have to be
14239 different in every compiled file. It is also used to place unique
14240 stamps in coverage data files and the object files that produce
14241 them. You can use the -frandom-seed option to produce reproducibly
14242 identical object files.
14243
14244 The string can either be a number (decimal, octal or hex) or an
14245 arbitrary string (in which case it's converted to a number by
14246 computing CRC32).
14247
14248 The string should be different for every file you compile.
14249
14250 -save-temps
14251 -save-temps=cwd
14252 Store the usual "temporary" intermediate files permanently; place
14253 them in the current directory and name them based on the source
14254 file. Thus, compiling foo.c with -c -save-temps produces files
14255 foo.i and foo.s, as well as foo.o. This creates a preprocessed
14256 foo.i output file even though the compiler now normally uses an
14257 integrated preprocessor.
14258
14259 When used in combination with the -x command-line option,
14260 -save-temps is sensible enough to avoid over writing an input
14261 source file with the same extension as an intermediate file. The
14262 corresponding intermediate file may be obtained by renaming the
14263 source file before using -save-temps.
14264
14265 If you invoke GCC in parallel, compiling several different source
14266 files that share a common base name in different subdirectories or
14267 the same source file compiled for multiple output destinations, it
14268 is likely that the different parallel compilers will interfere with
14269 each other, and overwrite the temporary files. For instance:
14270
14271 gcc -save-temps -o outdir1/foo.o indir1/foo.c&
14272 gcc -save-temps -o outdir2/foo.o indir2/foo.c&
14273
14274 may result in foo.i and foo.o being written to simultaneously by
14275 both compilers.
14276
14277 -save-temps=obj
14278 Store the usual "temporary" intermediate files permanently. If the
14279 -o option is used, the temporary files are based on the object
14280 file. If the -o option is not used, the -save-temps=obj switch
14281 behaves like -save-temps.
14282
14283 For example:
14284
14285 gcc -save-temps=obj -c foo.c
14286 gcc -save-temps=obj -c bar.c -o dir/xbar.o
14287 gcc -save-temps=obj foobar.c -o dir2/yfoobar
14288
14289 creates foo.i, foo.s, dir/xbar.i, dir/xbar.s, dir2/yfoobar.i,
14290 dir2/yfoobar.s, and dir2/yfoobar.o.
14291
14292 -time[=file]
14293 Report the CPU time taken by each subprocess in the compilation
14294 sequence. For C source files, this is the compiler proper and
14295 assembler (plus the linker if linking is done).
14296
14297 Without the specification of an output file, the output looks like
14298 this:
14299
14300 # cc1 0.12 0.01
14301 # as 0.00 0.01
14302
14303 The first number on each line is the "user time", that is time
14304 spent executing the program itself. The second number is "system
14305 time", time spent executing operating system routines on behalf of
14306 the program. Both numbers are in seconds.
14307
14308 With the specification of an output file, the output is appended to
14309 the named file, and it looks like this:
14310
14311 0.12 0.01 cc1 <options>
14312 0.00 0.01 as <options>
14313
14314 The "user time" and the "system time" are moved before the program
14315 name, and the options passed to the program are displayed, so that
14316 one can later tell what file was being compiled, and with which
14317 options.
14318
14319 -fdump-final-insns[=file]
14320 Dump the final internal representation (RTL) to file. If the
14321 optional argument is omitted (or if file is "."), the name of the
14322 dump file is determined by appending ".gkd" to the compilation
14323 output file name.
14324
14325 -fcompare-debug[=opts]
14326 If no error occurs during compilation, run the compiler a second
14327 time, adding opts and -fcompare-debug-second to the arguments
14328 passed to the second compilation. Dump the final internal
14329 representation in both compilations, and print an error if they
14330 differ.
14331
14332 If the equal sign is omitted, the default -gtoggle is used.
14333
14334 The environment variable GCC_COMPARE_DEBUG, if defined, non-empty
14335 and nonzero, implicitly enables -fcompare-debug. If
14336 GCC_COMPARE_DEBUG is defined to a string starting with a dash, then
14337 it is used for opts, otherwise the default -gtoggle is used.
14338
14339 -fcompare-debug=, with the equal sign but without opts, is
14340 equivalent to -fno-compare-debug, which disables the dumping of the
14341 final representation and the second compilation, preventing even
14342 GCC_COMPARE_DEBUG from taking effect.
14343
14344 To verify full coverage during -fcompare-debug testing, set
14345 GCC_COMPARE_DEBUG to say -fcompare-debug-not-overridden, which GCC
14346 rejects as an invalid option in any actual compilation (rather than
14347 preprocessing, assembly or linking). To get just a warning,
14348 setting GCC_COMPARE_DEBUG to -w%n-fcompare-debug not overridden
14349 will do.
14350
14351 -fcompare-debug-second
14352 This option is implicitly passed to the compiler for the second
14353 compilation requested by -fcompare-debug, along with options to
14354 silence warnings, and omitting other options that would cause the
14355 compiler to produce output to files or to standard output as a side
14356 effect. Dump files and preserved temporary files are renamed so as
14357 to contain the ".gk" additional extension during the second
14358 compilation, to avoid overwriting those generated by the first.
14359
14360 When this option is passed to the compiler driver, it causes the
14361 first compilation to be skipped, which makes it useful for little
14362 other than debugging the compiler proper.
14363
14364 -gtoggle
14365 Turn off generation of debug info, if leaving out this option
14366 generates it, or turn it on at level 2 otherwise. The position of
14367 this argument in the command line does not matter; it takes effect
14368 after all other options are processed, and it does so only once, no
14369 matter how many times it is given. This is mainly intended to be
14370 used with -fcompare-debug.
14371
14372 -fvar-tracking-assignments-toggle
14373 Toggle -fvar-tracking-assignments, in the same way that -gtoggle
14374 toggles -g.
14375
14376 -Q Makes the compiler print out each function name as it is compiled,
14377 and print some statistics about each pass when it finishes.
14378
14379 -ftime-report
14380 Makes the compiler print some statistics about the time consumed by
14381 each pass when it finishes.
14382
14383 -ftime-report-details
14384 Record the time consumed by infrastructure parts separately for
14385 each pass.
14386
14387 -fira-verbose=n
14388 Control the verbosity of the dump file for the integrated register
14389 allocator. The default value is 5. If the value n is greater or
14390 equal to 10, the dump output is sent to stderr using the same
14391 format as n minus 10.
14392
14393 -flto-report
14394 Prints a report with internal details on the workings of the link-
14395 time optimizer. The contents of this report vary from version to
14396 version. It is meant to be useful to GCC developers when
14397 processing object files in LTO mode (via -flto).
14398
14399 Disabled by default.
14400
14401 -flto-report-wpa
14402 Like -flto-report, but only print for the WPA phase of link-time
14403 optimization.
14404
14405 -fmem-report
14406 Makes the compiler print some statistics about permanent memory
14407 allocation when it finishes.
14408
14409 -fmem-report-wpa
14410 Makes the compiler print some statistics about permanent memory
14411 allocation for the WPA phase only.
14412
14413 -fpre-ipa-mem-report
14414 -fpost-ipa-mem-report
14415 Makes the compiler print some statistics about permanent memory
14416 allocation before or after interprocedural optimization.
14417
14418 -fprofile-report
14419 Makes the compiler print some statistics about consistency of the
14420 (estimated) profile and effect of individual passes.
14421
14422 -fstack-usage
14423 Makes the compiler output stack usage information for the program,
14424 on a per-function basis. The filename for the dump is made by
14425 appending .su to the auxname. auxname is generated from the name
14426 of the output file, if explicitly specified and it is not an
14427 executable, otherwise it is the basename of the source file. An
14428 entry is made up of three fields:
14429
14430 * The name of the function.
14431
14432 * A number of bytes.
14433
14434 * One or more qualifiers: "static", "dynamic", "bounded".
14435
14436 The qualifier "static" means that the function manipulates the
14437 stack statically: a fixed number of bytes are allocated for the
14438 frame on function entry and released on function exit; no stack
14439 adjustments are otherwise made in the function. The second field
14440 is this fixed number of bytes.
14441
14442 The qualifier "dynamic" means that the function manipulates the
14443 stack dynamically: in addition to the static allocation described
14444 above, stack adjustments are made in the body of the function, for
14445 example to push/pop arguments around function calls. If the
14446 qualifier "bounded" is also present, the amount of these
14447 adjustments is bounded at compile time and the second field is an
14448 upper bound of the total amount of stack used by the function. If
14449 it is not present, the amount of these adjustments is not bounded
14450 at compile time and the second field only represents the bounded
14451 part.
14452
14453 -fstats
14454 Emit statistics about front-end processing at the end of the
14455 compilation. This option is supported only by the C++ front end,
14456 and the information is generally only useful to the G++ development
14457 team.
14458
14459 -fdbg-cnt-list
14460 Print the name and the counter upper bound for all debug counters.
14461
14462 -fdbg-cnt=counter-value-list
14463 Set the internal debug counter lower and upper bound. counter-
14464 value-list is a comma-separated list of
14465 name:lower_bound1-upper_bound1 [:lower_bound2-upper_bound2...]
14466 tuples which sets the name of the counter and list of closed
14467 intervals. The lower_bound is optional and is zero initialized if
14468 not set. For example, with -fdbg-cnt=dce:2-4:10-11,tail_call:10,
14469 "dbg_cnt(dce)" returns true only for second, third, fourth, tenth
14470 and eleventh invocation. For "dbg_cnt(tail_call)" true is returned
14471 for first 10 invocations.
14472
14473 -print-file-name=library
14474 Print the full absolute name of the library file library that would
14475 be used when linking---and don't do anything else. With this
14476 option, GCC does not compile or link anything; it just prints the
14477 file name.
14478
14479 -print-multi-directory
14480 Print the directory name corresponding to the multilib selected by
14481 any other switches present in the command line. This directory is
14482 supposed to exist in GCC_EXEC_PREFIX.
14483
14484 -print-multi-lib
14485 Print the mapping from multilib directory names to compiler
14486 switches that enable them. The directory name is separated from
14487 the switches by ;, and each switch starts with an @ instead of the
14488 -, without spaces between multiple switches. This is supposed to
14489 ease shell processing.
14490
14491 -print-multi-os-directory
14492 Print the path to OS libraries for the selected multilib, relative
14493 to some lib subdirectory. If OS libraries are present in the lib
14494 subdirectory and no multilibs are used, this is usually just ., if
14495 OS libraries are present in libsuffix sibling directories this
14496 prints e.g. ../lib64, ../lib or ../lib32, or if OS libraries are
14497 present in lib/subdir subdirectories it prints e.g. amd64, sparcv9
14498 or ev6.
14499
14500 -print-multiarch
14501 Print the path to OS libraries for the selected multiarch, relative
14502 to some lib subdirectory.
14503
14504 -print-prog-name=program
14505 Like -print-file-name, but searches for a program such as cpp.
14506
14507 -print-libgcc-file-name
14508 Same as -print-file-name=libgcc.a.
14509
14510 This is useful when you use -nostdlib or -nodefaultlibs but you do
14511 want to link with libgcc.a. You can do:
14512
14513 gcc -nostdlib <files>... `gcc -print-libgcc-file-name`
14514
14515 -print-search-dirs
14516 Print the name of the configured installation directory and a list
14517 of program and library directories gcc searches---and don't do
14518 anything else.
14519
14520 This is useful when gcc prints the error message installation
14521 problem, cannot exec cpp0: No such file or directory. To resolve
14522 this you either need to put cpp0 and the other compiler components
14523 where gcc expects to find them, or you can set the environment
14524 variable GCC_EXEC_PREFIX to the directory where you installed them.
14525 Don't forget the trailing /.
14526
14527 -print-sysroot
14528 Print the target sysroot directory that is used during compilation.
14529 This is the target sysroot specified either at configure time or
14530 using the --sysroot option, possibly with an extra suffix that
14531 depends on compilation options. If no target sysroot is specified,
14532 the option prints nothing.
14533
14534 -print-sysroot-headers-suffix
14535 Print the suffix added to the target sysroot when searching for
14536 headers, or give an error if the compiler is not configured with
14537 such a suffix---and don't do anything else.
14538
14539 -dumpmachine
14540 Print the compiler's target machine (for example,
14541 i686-pc-linux-gnu)---and don't do anything else.
14542
14543 -dumpversion
14544 Print the compiler version (for example, 3.0, 6.3.0 or 7)---and
14545 don't do anything else. This is the compiler version used in
14546 filesystem paths and specs. Depending on how the compiler has been
14547 configured it can be just a single number (major version), two
14548 numbers separated by a dot (major and minor version) or three
14549 numbers separated by dots (major, minor and patchlevel version).
14550
14551 -dumpfullversion
14552 Print the full compiler version---and don't do anything else. The
14553 output is always three numbers separated by dots, major, minor and
14554 patchlevel version.
14555
14556 -dumpspecs
14557 Print the compiler's built-in specs---and don't do anything else.
14558 (This is used when GCC itself is being built.)
14559
14560 Machine-Dependent Options
14561 Each target machine supported by GCC can have its own options---for
14562 example, to allow you to compile for a particular processor variant or
14563 ABI, or to control optimizations specific to that machine. By
14564 convention, the names of machine-specific options start with -m.
14565
14566 Some configurations of the compiler also support additional target-
14567 specific options, usually for compatibility with other compilers on the
14568 same platform.
14569
14570 AArch64 Options
14571
14572 These options are defined for AArch64 implementations:
14573
14574 -mabi=name
14575 Generate code for the specified data model. Permissible values are
14576 ilp32 for SysV-like data model where int, long int and pointers are
14577 32 bits, and lp64 for SysV-like data model where int is 32 bits,
14578 but long int and pointers are 64 bits.
14579
14580 The default depends on the specific target configuration. Note
14581 that the LP64 and ILP32 ABIs are not link-compatible; you must
14582 compile your entire program with the same ABI, and link with a
14583 compatible set of libraries.
14584
14585 -mbig-endian
14586 Generate big-endian code. This is the default when GCC is
14587 configured for an aarch64_be-*-* target.
14588
14589 -mgeneral-regs-only
14590 Generate code which uses only the general-purpose registers. This
14591 will prevent the compiler from using floating-point and Advanced
14592 SIMD registers but will not impose any restrictions on the
14593 assembler.
14594
14595 -mlittle-endian
14596 Generate little-endian code. This is the default when GCC is
14597 configured for an aarch64-*-* but not an aarch64_be-*-* target.
14598
14599 -mcmodel=tiny
14600 Generate code for the tiny code model. The program and its
14601 statically defined symbols must be within 1MB of each other.
14602 Programs can be statically or dynamically linked.
14603
14604 -mcmodel=small
14605 Generate code for the small code model. The program and its
14606 statically defined symbols must be within 4GB of each other.
14607 Programs can be statically or dynamically linked. This is the
14608 default code model.
14609
14610 -mcmodel=large
14611 Generate code for the large code model. This makes no assumptions
14612 about addresses and sizes of sections. Programs can be statically
14613 linked only. The -mcmodel=large option is incompatible with
14614 -mabi=ilp32, -fpic and -fPIC.
14615
14616 -mstrict-align
14617 -mno-strict-align
14618 Avoid or allow generating memory accesses that may not be aligned
14619 on a natural object boundary as described in the architecture
14620 specification.
14621
14622 -momit-leaf-frame-pointer
14623 -mno-omit-leaf-frame-pointer
14624 Omit or keep the frame pointer in leaf functions. The former
14625 behavior is the default.
14626
14627 -mstack-protector-guard=guard
14628 -mstack-protector-guard-reg=reg
14629 -mstack-protector-guard-offset=offset
14630 Generate stack protection code using canary at guard. Supported
14631 locations are global for a global canary or sysreg for a canary in
14632 an appropriate system register.
14633
14634 With the latter choice the options -mstack-protector-guard-reg=reg
14635 and -mstack-protector-guard-offset=offset furthermore specify which
14636 system register to use as base register for reading the canary, and
14637 from what offset from that base register. There is no default
14638 register or offset as this is entirely for use within the Linux
14639 kernel.
14640
14641 -mstack-protector-guard=guard
14642 -mstack-protector-guard-reg=reg
14643 -mstack-protector-guard-offset=offset
14644 Generate stack protection code using canary at guard. Supported
14645 locations are global for a global canary or sysreg for a canary in
14646 an appropriate system register.
14647
14648 With the latter choice the options -mstack-protector-guard-reg=reg
14649 and -mstack-protector-guard-offset=offset furthermore specify which
14650 system register to use as base register for reading the canary, and
14651 from what offset from that base register. There is no default
14652 register or offset as this is entirely for use within the Linux
14653 kernel.
14654
14655 -mtls-dialect=desc
14656 Use TLS descriptors as the thread-local storage mechanism for
14657 dynamic accesses of TLS variables. This is the default.
14658
14659 -mtls-dialect=traditional
14660 Use traditional TLS as the thread-local storage mechanism for
14661 dynamic accesses of TLS variables.
14662
14663 -mtls-size=size
14664 Specify bit size of immediate TLS offsets. Valid values are 12,
14665 24, 32, 48. This option requires binutils 2.26 or newer.
14666
14667 -mfix-cortex-a53-835769
14668 -mno-fix-cortex-a53-835769
14669 Enable or disable the workaround for the ARM Cortex-A53 erratum
14670 number 835769. This involves inserting a NOP instruction between
14671 memory instructions and 64-bit integer multiply-accumulate
14672 instructions.
14673
14674 -mfix-cortex-a53-843419
14675 -mno-fix-cortex-a53-843419
14676 Enable or disable the workaround for the ARM Cortex-A53 erratum
14677 number 843419. This erratum workaround is made at link time and
14678 this will only pass the corresponding flag to the linker.
14679
14680 -mlow-precision-recip-sqrt
14681 -mno-low-precision-recip-sqrt
14682 Enable or disable the reciprocal square root approximation. This
14683 option only has an effect if -ffast-math or
14684 -funsafe-math-optimizations is used as well. Enabling this reduces
14685 precision of reciprocal square root results to about 16 bits for
14686 single precision and to 32 bits for double precision.
14687
14688 -mlow-precision-sqrt
14689 -mno-low-precision-sqrt
14690 Enable or disable the square root approximation. This option only
14691 has an effect if -ffast-math or -funsafe-math-optimizations is used
14692 as well. Enabling this reduces precision of square root results to
14693 about 16 bits for single precision and to 32 bits for double
14694 precision. If enabled, it implies -mlow-precision-recip-sqrt.
14695
14696 -mlow-precision-div
14697 -mno-low-precision-div
14698 Enable or disable the division approximation. This option only has
14699 an effect if -ffast-math or -funsafe-math-optimizations is used as
14700 well. Enabling this reduces precision of division results to about
14701 16 bits for single precision and to 32 bits for double precision.
14702
14703 -mtrack-speculation
14704 -mno-track-speculation
14705 Enable or disable generation of additional code to track
14706 speculative execution through conditional branches. The tracking
14707 state can then be used by the compiler when expanding calls to
14708 "__builtin_speculation_safe_copy" to permit a more efficient code
14709 sequence to be generated.
14710
14711 -moutline-atomics
14712 -mno-outline-atomics
14713 Enable or disable calls to out-of-line helpers to implement atomic
14714 operations. These helpers will, at runtime, determine if the LSE
14715 instructions from ARMv8.1-A can be used; if not, they will use the
14716 load/store-exclusive instructions that are present in the base
14717 ARMv8.0 ISA.
14718
14719 This option is only applicable when compiling for the base ARMv8.0
14720 instruction set. If using a later revision, e.g. -march=armv8.1-a
14721 or -march=armv8-a+lse, the ARMv8.1-Atomics instructions will be
14722 used directly. The same applies when using -mcpu= when the
14723 selected cpu supports the lse feature. This option is on by
14724 default.
14725
14726 -march=name
14727 Specify the name of the target architecture and, optionally, one or
14728 more feature modifiers. This option has the form
14729 -march=arch{+[no]feature}*.
14730
14731 The table below summarizes the permissible values for arch and the
14732 features that they enable by default:
14733
14734 arch value : Architecture : Includes by default
14735 armv8-a : Armv8-A : +fp, +simd
14736 armv8.1-a : Armv8.1-A : armv8-a, +crc, +lse, +rdma
14737 armv8.2-a : Armv8.2-A : armv8.1-a
14738 armv8.3-a : Armv8.3-A : armv8.2-a
14739 armv8.4-a : Armv8.4-A : armv8.3-a, +fp16fml, +dotprod
14740 armv8.5-a : Armv8.5-A : armv8.4-a, +sb, +ssbs, +predres
14741 armv8.6-a : Armv8.6-A : armv8.5-a, +bf16, +i8mm
14742
14743 The value native is available on native AArch64 GNU/Linux and
14744 causes the compiler to pick the architecture of the host system.
14745 This option has no effect if the compiler is unable to recognize
14746 the architecture of the host system,
14747
14748 The permissible values for feature are listed in the sub-section on
14749 aarch64-feature-modifiers,,-march and -mcpu Feature Modifiers.
14750 Where conflicting feature modifiers are specified, the right-most
14751 feature is used.
14752
14753 GCC uses name to determine what kind of instructions it can emit
14754 when generating assembly code. If -march is specified without
14755 either of -mtune or -mcpu also being specified, the code is tuned
14756 to perform well across a range of target processors implementing
14757 the target architecture.
14758
14759 -mtune=name
14760 Specify the name of the target processor for which GCC should tune
14761 the performance of the code. Permissible values for this option
14762 are: generic, cortex-a35, cortex-a53, cortex-a55, cortex-a57,
14763 cortex-a72, cortex-a73, cortex-a75, cortex-a76, cortex-a76ae,
14764 cortex-a77, cortex-a65, cortex-a65ae, cortex-a34, ares, exynos-m1,
14765 emag, falkor, neoverse-e1, neoverse-n1, neoverse-n2, neoverse-v1,
14766 qdf24xx, saphira, phecda, xgene1, vulcan, octeontx, octeontx81,
14767 octeontx83, octeontx2, octeontx2t98, octeontx2t96 octeontx2t93,
14768 octeontx2f95, octeontx2f95n, octeontx2f95mm, a64fx, thunderx,
14769 thunderxt88, thunderxt88p1, thunderxt81, tsv110, thunderxt83,
14770 thunderx2t99, thunderx3t110, zeus, cortex-a57.cortex-a53,
14771 cortex-a72.cortex-a53, cortex-a73.cortex-a35,
14772 cortex-a73.cortex-a53, cortex-a75.cortex-a55, cortex-a76.cortex-a55
14773 native.
14774
14775 The values cortex-a57.cortex-a53, cortex-a72.cortex-a53,
14776 cortex-a73.cortex-a35, cortex-a73.cortex-a53,
14777 cortex-a75.cortex-a55, cortex-a76.cortex-a55 specify that GCC
14778 should tune for a big.LITTLE system.
14779
14780 Additionally on native AArch64 GNU/Linux systems the value native
14781 tunes performance to the host system. This option has no effect if
14782 the compiler is unable to recognize the processor of the host
14783 system.
14784
14785 Where none of -mtune=, -mcpu= or -march= are specified, the code is
14786 tuned to perform well across a range of target processors.
14787
14788 This option cannot be suffixed by feature modifiers.
14789
14790 -mcpu=name
14791 Specify the name of the target processor, optionally suffixed by
14792 one or more feature modifiers. This option has the form
14793 -mcpu=cpu{+[no]feature}*, where the permissible values for cpu are
14794 the same as those available for -mtune. The permissible values for
14795 feature are documented in the sub-section on
14796 aarch64-feature-modifiers,,-march and -mcpu Feature Modifiers.
14797 Where conflicting feature modifiers are specified, the right-most
14798 feature is used.
14799
14800 GCC uses name to determine what kind of instructions it can emit
14801 when generating assembly code (as if by -march) and to determine
14802 the target processor for which to tune for performance (as if by
14803 -mtune). Where this option is used in conjunction with -march or
14804 -mtune, those options take precedence over the appropriate part of
14805 this option.
14806
14807 -moverride=string
14808 Override tuning decisions made by the back-end in response to a
14809 -mtune= switch. The syntax, semantics, and accepted values for
14810 string in this option are not guaranteed to be consistent across
14811 releases.
14812
14813 This option is only intended to be useful when developing GCC.
14814
14815 -mverbose-cost-dump
14816 Enable verbose cost model dumping in the debug dump files. This
14817 option is provided for use in debugging the compiler.
14818
14819 -mpc-relative-literal-loads
14820 -mno-pc-relative-literal-loads
14821 Enable or disable PC-relative literal loads. With this option
14822 literal pools are accessed using a single instruction and emitted
14823 after each function. This limits the maximum size of functions to
14824 1MB. This is enabled by default for -mcmodel=tiny.
14825
14826 -msign-return-address=scope
14827 Select the function scope on which return address signing will be
14828 applied. Permissible values are none, which disables return
14829 address signing, non-leaf, which enables pointer signing for
14830 functions which are not leaf functions, and all, which enables
14831 pointer signing for all functions. The default value is none. This
14832 option has been deprecated by -mbranch-protection.
14833
14834 -mbranch-protection=none|standard|pac-ret[+leaf+b-key]|bti
14835 Select the branch protection features to use. none is the default
14836 and turns off all types of branch protection. standard turns on
14837 all types of branch protection features. If a feature has
14838 additional tuning options, then standard sets it to its standard
14839 level. pac-ret[+leaf] turns on return address signing to its
14840 standard level: signing functions that save the return address to
14841 memory (non-leaf functions will practically always do this) using
14842 the a-key. The optional argument leaf can be used to extend the
14843 signing to include leaf functions. The optional argument b-key can
14844 be used to sign the functions with the B-key instead of the A-key.
14845 bti turns on branch target identification mechanism.
14846
14847 -mharden-sls=opts
14848 Enable compiler hardening against straight line speculation (SLS).
14849 opts is a comma-separated list of the following options:
14850
14851 retbr
14852 blr
14853
14854 In addition, -mharden-sls=all enables all SLS hardening while
14855 -mharden-sls=none disables all SLS hardening.
14856
14857 -msve-vector-bits=bits
14858 Specify the number of bits in an SVE vector register. This option
14859 only has an effect when SVE is enabled.
14860
14861 GCC supports two forms of SVE code generation: "vector-length
14862 agnostic" output that works with any size of vector register and
14863 "vector-length specific" output that allows GCC to make assumptions
14864 about the vector length when it is useful for optimization reasons.
14865 The possible values of bits are: scalable, 128, 256, 512, 1024 and
14866 2048. Specifying scalable selects vector-length agnostic output.
14867 At present -msve-vector-bits=128 also generates vector-length
14868 agnostic output for big-endian targets. All other values generate
14869 vector-length specific code. The behavior of these values may
14870 change in future releases and no value except scalable should be
14871 relied on for producing code that is portable across different
14872 hardware SVE vector lengths.
14873
14874 The default is -msve-vector-bits=scalable, which produces vector-
14875 length agnostic code.
14876
14877 -march and -mcpu Feature Modifiers
14878
14879 Feature modifiers used with -march and -mcpu can be any of the
14880 following and their inverses nofeature:
14881
14882 crc Enable CRC extension. This is on by default for -march=armv8.1-a.
14883
14884 crypto
14885 Enable Crypto extension. This also enables Advanced SIMD and
14886 floating-point instructions.
14887
14888 fp Enable floating-point instructions. This is on by default for all
14889 possible values for options -march and -mcpu.
14890
14891 simd
14892 Enable Advanced SIMD instructions. This also enables floating-
14893 point instructions. This is on by default for all possible values
14894 for options -march and -mcpu.
14895
14896 sve Enable Scalable Vector Extension instructions. This also enables
14897 Advanced SIMD and floating-point instructions.
14898
14899 lse Enable Large System Extension instructions. This is on by default
14900 for -march=armv8.1-a.
14901
14902 rdma
14903 Enable Round Double Multiply Accumulate instructions. This is on
14904 by default for -march=armv8.1-a.
14905
14906 fp16
14907 Enable FP16 extension. This also enables floating-point
14908 instructions.
14909
14910 fp16fml
14911 Enable FP16 fmla extension. This also enables FP16 extensions and
14912 floating-point instructions. This option is enabled by default for
14913 -march=armv8.4-a. Use of this option with architectures prior to
14914 Armv8.2-A is not supported.
14915
14916 rcpc
14917 Enable the RcPc extension. This does not change code generation
14918 from GCC, but is passed on to the assembler, enabling inline asm
14919 statements to use instructions from the RcPc extension.
14920
14921 dotprod
14922 Enable the Dot Product extension. This also enables Advanced SIMD
14923 instructions.
14924
14925 aes Enable the Armv8-a aes and pmull crypto extension. This also
14926 enables Advanced SIMD instructions.
14927
14928 sha2
14929 Enable the Armv8-a sha2 crypto extension. This also enables
14930 Advanced SIMD instructions.
14931
14932 sha3
14933 Enable the sha512 and sha3 crypto extension. This also enables
14934 Advanced SIMD instructions. Use of this option with architectures
14935 prior to Armv8.2-A is not supported.
14936
14937 sm4 Enable the sm3 and sm4 crypto extension. This also enables
14938 Advanced SIMD instructions. Use of this option with architectures
14939 prior to Armv8.2-A is not supported.
14940
14941 profile
14942 Enable the Statistical Profiling extension. This option is only to
14943 enable the extension at the assembler level and does not affect
14944 code generation.
14945
14946 rng Enable the Armv8.5-a Random Number instructions. This option is
14947 only to enable the extension at the assembler level and does not
14948 affect code generation.
14949
14950 memtag
14951 Enable the Armv8.5-a Memory Tagging Extensions. Use of this option
14952 with architectures prior to Armv8.5-A is not supported.
14953
14954 sb Enable the Armv8-a Speculation Barrier instruction. This option is
14955 only to enable the extension at the assembler level and does not
14956 affect code generation. This option is enabled by default for
14957 -march=armv8.5-a.
14958
14959 ssbs
14960 Enable the Armv8-a Speculative Store Bypass Safe instruction. This
14961 option is only to enable the extension at the assembler level and
14962 does not affect code generation. This option is enabled by default
14963 for -march=armv8.5-a.
14964
14965 predres
14966 Enable the Armv8-a Execution and Data Prediction Restriction
14967 instructions. This option is only to enable the extension at the
14968 assembler level and does not affect code generation. This option
14969 is enabled by default for -march=armv8.5-a.
14970
14971 sve2
14972 Enable the Armv8-a Scalable Vector Extension 2. This also enables
14973 SVE instructions.
14974
14975 sve2-bitperm
14976 Enable SVE2 bitperm instructions. This also enables SVE2
14977 instructions.
14978
14979 sve2-sm4
14980 Enable SVE2 sm4 instructions. This also enables SVE2 instructions.
14981
14982 sve2-aes
14983 Enable SVE2 aes instructions. This also enables SVE2 instructions.
14984
14985 sve2-sha3
14986 Enable SVE2 sha3 instructions. This also enables SVE2
14987 instructions.
14988
14989 tme Enable the Transactional Memory Extension.
14990
14991 i8mm
14992 Enable 8-bit Integer Matrix Multiply instructions. This also
14993 enables Advanced SIMD and floating-point instructions. This option
14994 is enabled by default for -march=armv8.6-a. Use of this option
14995 with architectures prior to Armv8.2-A is not supported.
14996
14997 f32mm
14998 Enable 32-bit Floating point Matrix Multiply instructions. This
14999 also enables SVE instructions. Use of this option with
15000 architectures prior to Armv8.2-A is not supported.
15001
15002 f64mm
15003 Enable 64-bit Floating point Matrix Multiply instructions. This
15004 also enables SVE instructions. Use of this option with
15005 architectures prior to Armv8.2-A is not supported.
15006
15007 bf16
15008 Enable brain half-precision floating-point instructions. This also
15009 enables Advanced SIMD and floating-point instructions. This option
15010 is enabled by default for -march=armv8.6-a. Use of this option
15011 with architectures prior to Armv8.2-A is not supported.
15012
15013 Feature crypto implies aes, sha2, and simd, which implies fp.
15014 Conversely, nofp implies nosimd, which implies nocrypto, noaes and
15015 nosha2.
15016
15017 Adapteva Epiphany Options
15018
15019 These -m options are defined for Adapteva Epiphany:
15020
15021 -mhalf-reg-file
15022 Don't allocate any register in the range "r32"..."r63". That
15023 allows code to run on hardware variants that lack these registers.
15024
15025 -mprefer-short-insn-regs
15026 Preferentially allocate registers that allow short instruction
15027 generation. This can result in increased instruction count, so
15028 this may either reduce or increase overall code size.
15029
15030 -mbranch-cost=num
15031 Set the cost of branches to roughly num "simple" instructions.
15032 This cost is only a heuristic and is not guaranteed to produce
15033 consistent results across releases.
15034
15035 -mcmove
15036 Enable the generation of conditional moves.
15037
15038 -mnops=num
15039 Emit num NOPs before every other generated instruction.
15040
15041 -mno-soft-cmpsf
15042 For single-precision floating-point comparisons, emit an "fsub"
15043 instruction and test the flags. This is faster than a software
15044 comparison, but can get incorrect results in the presence of NaNs,
15045 or when two different small numbers are compared such that their
15046 difference is calculated as zero. The default is -msoft-cmpsf,
15047 which uses slower, but IEEE-compliant, software comparisons.
15048
15049 -mstack-offset=num
15050 Set the offset between the top of the stack and the stack pointer.
15051 E.g., a value of 8 means that the eight bytes in the range
15052 "sp+0...sp+7" can be used by leaf functions without stack
15053 allocation. Values other than 8 or 16 are untested and unlikely to
15054 work. Note also that this option changes the ABI; compiling a
15055 program with a different stack offset than the libraries have been
15056 compiled with generally does not work. This option can be useful
15057 if you want to evaluate if a different stack offset would give you
15058 better code, but to actually use a different stack offset to build
15059 working programs, it is recommended to configure the toolchain with
15060 the appropriate --with-stack-offset=num option.
15061
15062 -mno-round-nearest
15063 Make the scheduler assume that the rounding mode has been set to
15064 truncating. The default is -mround-nearest.
15065
15066 -mlong-calls
15067 If not otherwise specified by an attribute, assume all calls might
15068 be beyond the offset range of the "b" / "bl" instructions, and
15069 therefore load the function address into a register before
15070 performing a (otherwise direct) call. This is the default.
15071
15072 -mshort-calls
15073 If not otherwise specified by an attribute, assume all direct calls
15074 are in the range of the "b" / "bl" instructions, so use these
15075 instructions for direct calls. The default is -mlong-calls.
15076
15077 -msmall16
15078 Assume addresses can be loaded as 16-bit unsigned values. This
15079 does not apply to function addresses for which -mlong-calls
15080 semantics are in effect.
15081
15082 -mfp-mode=mode
15083 Set the prevailing mode of the floating-point unit. This
15084 determines the floating-point mode that is provided and expected at
15085 function call and return time. Making this mode match the mode you
15086 predominantly need at function start can make your programs smaller
15087 and faster by avoiding unnecessary mode switches.
15088
15089 mode can be set to one the following values:
15090
15091 caller
15092 Any mode at function entry is valid, and retained or restored
15093 when the function returns, and when it calls other functions.
15094 This mode is useful for compiling libraries or other
15095 compilation units you might want to incorporate into different
15096 programs with different prevailing FPU modes, and the
15097 convenience of being able to use a single object file outweighs
15098 the size and speed overhead for any extra mode switching that
15099 might be needed, compared with what would be needed with a more
15100 specific choice of prevailing FPU mode.
15101
15102 truncate
15103 This is the mode used for floating-point calculations with
15104 truncating (i.e. round towards zero) rounding mode. That
15105 includes conversion from floating point to integer.
15106
15107 round-nearest
15108 This is the mode used for floating-point calculations with
15109 round-to-nearest-or-even rounding mode.
15110
15111 int This is the mode used to perform integer calculations in the
15112 FPU, e.g. integer multiply, or integer multiply-and-
15113 accumulate.
15114
15115 The default is -mfp-mode=caller
15116
15117 -mno-split-lohi
15118 -mno-postinc
15119 -mno-postmodify
15120 Code generation tweaks that disable, respectively, splitting of
15121 32-bit loads, generation of post-increment addresses, and
15122 generation of post-modify addresses. The defaults are msplit-lohi,
15123 -mpost-inc, and -mpost-modify.
15124
15125 -mnovect-double
15126 Change the preferred SIMD mode to SImode. The default is
15127 -mvect-double, which uses DImode as preferred SIMD mode.
15128
15129 -max-vect-align=num
15130 The maximum alignment for SIMD vector mode types. num may be 4 or
15131 8. The default is 8. Note that this is an ABI change, even though
15132 many library function interfaces are unaffected if they don't use
15133 SIMD vector modes in places that affect size and/or alignment of
15134 relevant types.
15135
15136 -msplit-vecmove-early
15137 Split vector moves into single word moves before reload. In theory
15138 this can give better register allocation, but so far the reverse
15139 seems to be generally the case.
15140
15141 -m1reg-reg
15142 Specify a register to hold the constant -1, which makes loading
15143 small negative constants and certain bitmasks faster. Allowable
15144 values for reg are r43 and r63, which specify use of that register
15145 as a fixed register, and none, which means that no register is used
15146 for this purpose. The default is -m1reg-none.
15147
15148 AMD GCN Options
15149
15150 These options are defined specifically for the AMD GCN port.
15151
15152 -march=gpu
15153 -mtune=gpu
15154 Set architecture type or tuning for gpu. Supported values for gpu
15155 are
15156
15157 fiji
15158 Compile for GCN3 Fiji devices (gfx803).
15159
15160 gfx900
15161 Compile for GCN5 Vega 10 devices (gfx900).
15162
15163 gfx906
15164 Compile for GCN5 Vega 20 devices (gfx906).
15165
15166 -mstack-size=bytes
15167 Specify how many bytes of stack space will be requested for each
15168 GPU thread (wave-front). Beware that there may be many threads and
15169 limited memory available. The size of the stack allocation may
15170 also have an impact on run-time performance. The default is 32KB
15171 when using OpenACC or OpenMP, and 1MB otherwise.
15172
15173 ARC Options
15174
15175 The following options control the architecture variant for which code
15176 is being compiled:
15177
15178 -mbarrel-shifter
15179 Generate instructions supported by barrel shifter. This is the
15180 default unless -mcpu=ARC601 or -mcpu=ARCEM is in effect.
15181
15182 -mjli-always
15183 Force to call a function using jli_s instruction. This option is
15184 valid only for ARCv2 architecture.
15185
15186 -mcpu=cpu
15187 Set architecture type, register usage, and instruction scheduling
15188 parameters for cpu. There are also shortcut alias options
15189 available for backward compatibility and convenience. Supported
15190 values for cpu are
15191
15192 arc600
15193 Compile for ARC600. Aliases: -mA6, -mARC600.
15194
15195 arc601
15196 Compile for ARC601. Alias: -mARC601.
15197
15198 arc700
15199 Compile for ARC700. Aliases: -mA7, -mARC700. This is the
15200 default when configured with --with-cpu=arc700.
15201
15202 arcem
15203 Compile for ARC EM.
15204
15205 archs
15206 Compile for ARC HS.
15207
15208 em Compile for ARC EM CPU with no hardware extensions.
15209
15210 em4 Compile for ARC EM4 CPU.
15211
15212 em4_dmips
15213 Compile for ARC EM4 DMIPS CPU.
15214
15215 em4_fpus
15216 Compile for ARC EM4 DMIPS CPU with the single-precision
15217 floating-point extension.
15218
15219 em4_fpuda
15220 Compile for ARC EM4 DMIPS CPU with single-precision floating-
15221 point and double assist instructions.
15222
15223 hs Compile for ARC HS CPU with no hardware extensions except the
15224 atomic instructions.
15225
15226 hs34
15227 Compile for ARC HS34 CPU.
15228
15229 hs38
15230 Compile for ARC HS38 CPU.
15231
15232 hs38_linux
15233 Compile for ARC HS38 CPU with all hardware extensions on.
15234
15235 arc600_norm
15236 Compile for ARC 600 CPU with "norm" instructions enabled.
15237
15238 arc600_mul32x16
15239 Compile for ARC 600 CPU with "norm" and 32x16-bit multiply
15240 instructions enabled.
15241
15242 arc600_mul64
15243 Compile for ARC 600 CPU with "norm" and "mul64"-family
15244 instructions enabled.
15245
15246 arc601_norm
15247 Compile for ARC 601 CPU with "norm" instructions enabled.
15248
15249 arc601_mul32x16
15250 Compile for ARC 601 CPU with "norm" and 32x16-bit multiply
15251 instructions enabled.
15252
15253 arc601_mul64
15254 Compile for ARC 601 CPU with "norm" and "mul64"-family
15255 instructions enabled.
15256
15257 nps400
15258 Compile for ARC 700 on NPS400 chip.
15259
15260 em_mini
15261 Compile for ARC EM minimalist configuration featuring reduced
15262 register set.
15263
15264 -mdpfp
15265 -mdpfp-compact
15266 Generate double-precision FPX instructions, tuned for the compact
15267 implementation.
15268
15269 -mdpfp-fast
15270 Generate double-precision FPX instructions, tuned for the fast
15271 implementation.
15272
15273 -mno-dpfp-lrsr
15274 Disable "lr" and "sr" instructions from using FPX extension aux
15275 registers.
15276
15277 -mea
15278 Generate extended arithmetic instructions. Currently only "divaw",
15279 "adds", "subs", and "sat16" are supported. Only valid for
15280 -mcpu=ARC700.
15281
15282 -mno-mpy
15283 Do not generate "mpy"-family instructions for ARC700. This option
15284 is deprecated.
15285
15286 -mmul32x16
15287 Generate 32x16-bit multiply and multiply-accumulate instructions.
15288
15289 -mmul64
15290 Generate "mul64" and "mulu64" instructions. Only valid for
15291 -mcpu=ARC600.
15292
15293 -mnorm
15294 Generate "norm" instructions. This is the default if -mcpu=ARC700
15295 is in effect.
15296
15297 -mspfp
15298 -mspfp-compact
15299 Generate single-precision FPX instructions, tuned for the compact
15300 implementation.
15301
15302 -mspfp-fast
15303 Generate single-precision FPX instructions, tuned for the fast
15304 implementation.
15305
15306 -msimd
15307 Enable generation of ARC SIMD instructions via target-specific
15308 builtins. Only valid for -mcpu=ARC700.
15309
15310 -msoft-float
15311 This option ignored; it is provided for compatibility purposes
15312 only. Software floating-point code is emitted by default, and this
15313 default can overridden by FPX options; -mspfp, -mspfp-compact, or
15314 -mspfp-fast for single precision, and -mdpfp, -mdpfp-compact, or
15315 -mdpfp-fast for double precision.
15316
15317 -mswap
15318 Generate "swap" instructions.
15319
15320 -matomic
15321 This enables use of the locked load/store conditional extension to
15322 implement atomic memory built-in functions. Not available for ARC
15323 6xx or ARC EM cores.
15324
15325 -mdiv-rem
15326 Enable "div" and "rem" instructions for ARCv2 cores.
15327
15328 -mcode-density
15329 Enable code density instructions for ARC EM. This option is on by
15330 default for ARC HS.
15331
15332 -mll64
15333 Enable double load/store operations for ARC HS cores.
15334
15335 -mtp-regno=regno
15336 Specify thread pointer register number.
15337
15338 -mmpy-option=multo
15339 Compile ARCv2 code with a multiplier design option. You can
15340 specify the option using either a string or numeric value for
15341 multo. wlh1 is the default value. The recognized values are:
15342
15343 0
15344 none
15345 No multiplier available.
15346
15347 1
15348 w 16x16 multiplier, fully pipelined. The following instructions
15349 are enabled: "mpyw" and "mpyuw".
15350
15351 2
15352 wlh1
15353 32x32 multiplier, fully pipelined (1 stage). The following
15354 instructions are additionally enabled: "mpy", "mpyu", "mpym",
15355 "mpymu", and "mpy_s".
15356
15357 3
15358 wlh2
15359 32x32 multiplier, fully pipelined (2 stages). The following
15360 instructions are additionally enabled: "mpy", "mpyu", "mpym",
15361 "mpymu", and "mpy_s".
15362
15363 4
15364 wlh3
15365 Two 16x16 multipliers, blocking, sequential. The following
15366 instructions are additionally enabled: "mpy", "mpyu", "mpym",
15367 "mpymu", and "mpy_s".
15368
15369 5
15370 wlh4
15371 One 16x16 multiplier, blocking, sequential. The following
15372 instructions are additionally enabled: "mpy", "mpyu", "mpym",
15373 "mpymu", and "mpy_s".
15374
15375 6
15376 wlh5
15377 One 32x4 multiplier, blocking, sequential. The following
15378 instructions are additionally enabled: "mpy", "mpyu", "mpym",
15379 "mpymu", and "mpy_s".
15380
15381 7
15382 plus_dmpy
15383 ARC HS SIMD support.
15384
15385 8
15386 plus_macd
15387 ARC HS SIMD support.
15388
15389 9
15390 plus_qmacw
15391 ARC HS SIMD support.
15392
15393 This option is only available for ARCv2 cores.
15394
15395 -mfpu=fpu
15396 Enables support for specific floating-point hardware extensions for
15397 ARCv2 cores. Supported values for fpu are:
15398
15399 fpus
15400 Enables support for single-precision floating-point hardware
15401 extensions.
15402
15403 fpud
15404 Enables support for double-precision floating-point hardware
15405 extensions. The single-precision floating-point extension is
15406 also enabled. Not available for ARC EM.
15407
15408 fpuda
15409 Enables support for double-precision floating-point hardware
15410 extensions using double-precision assist instructions. The
15411 single-precision floating-point extension is also enabled.
15412 This option is only available for ARC EM.
15413
15414 fpuda_div
15415 Enables support for double-precision floating-point hardware
15416 extensions using double-precision assist instructions. The
15417 single-precision floating-point, square-root, and divide
15418 extensions are also enabled. This option is only available for
15419 ARC EM.
15420
15421 fpuda_fma
15422 Enables support for double-precision floating-point hardware
15423 extensions using double-precision assist instructions. The
15424 single-precision floating-point and fused multiply and add
15425 hardware extensions are also enabled. This option is only
15426 available for ARC EM.
15427
15428 fpuda_all
15429 Enables support for double-precision floating-point hardware
15430 extensions using double-precision assist instructions. All
15431 single-precision floating-point hardware extensions are also
15432 enabled. This option is only available for ARC EM.
15433
15434 fpus_div
15435 Enables support for single-precision floating-point, square-
15436 root and divide hardware extensions.
15437
15438 fpud_div
15439 Enables support for double-precision floating-point, square-
15440 root and divide hardware extensions. This option includes
15441 option fpus_div. Not available for ARC EM.
15442
15443 fpus_fma
15444 Enables support for single-precision floating-point and fused
15445 multiply and add hardware extensions.
15446
15447 fpud_fma
15448 Enables support for double-precision floating-point and fused
15449 multiply and add hardware extensions. This option includes
15450 option fpus_fma. Not available for ARC EM.
15451
15452 fpus_all
15453 Enables support for all single-precision floating-point
15454 hardware extensions.
15455
15456 fpud_all
15457 Enables support for all single- and double-precision floating-
15458 point hardware extensions. Not available for ARC EM.
15459
15460 -mirq-ctrl-saved=register-range, blink, lp_count
15461 Specifies general-purposes registers that the processor
15462 automatically saves/restores on interrupt entry and exit.
15463 register-range is specified as two registers separated by a dash.
15464 The register range always starts with "r0", the upper limit is "fp"
15465 register. blink and lp_count are optional. This option is only
15466 valid for ARC EM and ARC HS cores.
15467
15468 -mrgf-banked-regs=number
15469 Specifies the number of registers replicated in second register
15470 bank on entry to fast interrupt. Fast interrupts are interrupts
15471 with the highest priority level P0. These interrupts save only PC
15472 and STATUS32 registers to avoid memory transactions during
15473 interrupt entry and exit sequences. Use this option when you are
15474 using fast interrupts in an ARC V2 family processor. Permitted
15475 values are 4, 8, 16, and 32.
15476
15477 -mlpc-width=width
15478 Specify the width of the "lp_count" register. Valid values for
15479 width are 8, 16, 20, 24, 28 and 32 bits. The default width is
15480 fixed to 32 bits. If the width is less than 32, the compiler does
15481 not attempt to transform loops in your program to use the zero-
15482 delay loop mechanism unless it is known that the "lp_count"
15483 register can hold the required loop-counter value. Depending on
15484 the width specified, the compiler and run-time library might
15485 continue to use the loop mechanism for various needs. This option
15486 defines macro "__ARC_LPC_WIDTH__" with the value of width.
15487
15488 -mrf16
15489 This option instructs the compiler to generate code for a 16-entry
15490 register file. This option defines the "__ARC_RF16__" preprocessor
15491 macro.
15492
15493 -mbranch-index
15494 Enable use of "bi" or "bih" instructions to implement jump tables.
15495
15496 The following options are passed through to the assembler, and also
15497 define preprocessor macro symbols.
15498
15499 -mdsp-packa
15500 Passed down to the assembler to enable the DSP Pack A extensions.
15501 Also sets the preprocessor symbol "__Xdsp_packa". This option is
15502 deprecated.
15503
15504 -mdvbf
15505 Passed down to the assembler to enable the dual Viterbi butterfly
15506 extension. Also sets the preprocessor symbol "__Xdvbf". This
15507 option is deprecated.
15508
15509 -mlock
15510 Passed down to the assembler to enable the locked load/store
15511 conditional extension. Also sets the preprocessor symbol
15512 "__Xlock".
15513
15514 -mmac-d16
15515 Passed down to the assembler. Also sets the preprocessor symbol
15516 "__Xxmac_d16". This option is deprecated.
15517
15518 -mmac-24
15519 Passed down to the assembler. Also sets the preprocessor symbol
15520 "__Xxmac_24". This option is deprecated.
15521
15522 -mrtsc
15523 Passed down to the assembler to enable the 64-bit time-stamp
15524 counter extension instruction. Also sets the preprocessor symbol
15525 "__Xrtsc". This option is deprecated.
15526
15527 -mswape
15528 Passed down to the assembler to enable the swap byte ordering
15529 extension instruction. Also sets the preprocessor symbol
15530 "__Xswape".
15531
15532 -mtelephony
15533 Passed down to the assembler to enable dual- and single-operand
15534 instructions for telephony. Also sets the preprocessor symbol
15535 "__Xtelephony". This option is deprecated.
15536
15537 -mxy
15538 Passed down to the assembler to enable the XY memory extension.
15539 Also sets the preprocessor symbol "__Xxy".
15540
15541 The following options control how the assembly code is annotated:
15542
15543 -misize
15544 Annotate assembler instructions with estimated addresses.
15545
15546 -mannotate-align
15547 Explain what alignment considerations lead to the decision to make
15548 an instruction short or long.
15549
15550 The following options are passed through to the linker:
15551
15552 -marclinux
15553 Passed through to the linker, to specify use of the "arclinux"
15554 emulation. This option is enabled by default in tool chains built
15555 for "arc-linux-uclibc" and "arceb-linux-uclibc" targets when
15556 profiling is not requested.
15557
15558 -marclinux_prof
15559 Passed through to the linker, to specify use of the "arclinux_prof"
15560 emulation. This option is enabled by default in tool chains built
15561 for "arc-linux-uclibc" and "arceb-linux-uclibc" targets when
15562 profiling is requested.
15563
15564 The following options control the semantics of generated code:
15565
15566 -mlong-calls
15567 Generate calls as register indirect calls, thus providing access to
15568 the full 32-bit address range.
15569
15570 -mmedium-calls
15571 Don't use less than 25-bit addressing range for calls, which is the
15572 offset available for an unconditional branch-and-link instruction.
15573 Conditional execution of function calls is suppressed, to allow use
15574 of the 25-bit range, rather than the 21-bit range with conditional
15575 branch-and-link. This is the default for tool chains built for
15576 "arc-linux-uclibc" and "arceb-linux-uclibc" targets.
15577
15578 -G num
15579 Put definitions of externally-visible data in a small data section
15580 if that data is no bigger than num bytes. The default value of num
15581 is 4 for any ARC configuration, or 8 when we have double load/store
15582 operations.
15583
15584 -mno-sdata
15585 Do not generate sdata references. This is the default for tool
15586 chains built for "arc-linux-uclibc" and "arceb-linux-uclibc"
15587 targets.
15588
15589 -mvolatile-cache
15590 Use ordinarily cached memory accesses for volatile references.
15591 This is the default.
15592
15593 -mno-volatile-cache
15594 Enable cache bypass for volatile references.
15595
15596 The following options fine tune code generation:
15597
15598 -malign-call
15599 Do alignment optimizations for call instructions.
15600
15601 -mauto-modify-reg
15602 Enable the use of pre/post modify with register displacement.
15603
15604 -mbbit-peephole
15605 Enable bbit peephole2.
15606
15607 -mno-brcc
15608 This option disables a target-specific pass in arc_reorg to
15609 generate compare-and-branch ("brcc") instructions. It has no
15610 effect on generation of these instructions driven by the combiner
15611 pass.
15612
15613 -mcase-vector-pcrel
15614 Use PC-relative switch case tables to enable case table shortening.
15615 This is the default for -Os.
15616
15617 -mcompact-casesi
15618 Enable compact "casesi" pattern. This is the default for -Os, and
15619 only available for ARCv1 cores. This option is deprecated.
15620
15621 -mno-cond-exec
15622 Disable the ARCompact-specific pass to generate conditional
15623 execution instructions.
15624
15625 Due to delay slot scheduling and interactions between operand
15626 numbers, literal sizes, instruction lengths, and the support for
15627 conditional execution, the target-independent pass to generate
15628 conditional execution is often lacking, so the ARC port has kept a
15629 special pass around that tries to find more conditional execution
15630 generation opportunities after register allocation, branch
15631 shortening, and delay slot scheduling have been done. This pass
15632 generally, but not always, improves performance and code size, at
15633 the cost of extra compilation time, which is why there is an option
15634 to switch it off. If you have a problem with call instructions
15635 exceeding their allowable offset range because they are
15636 conditionalized, you should consider using -mmedium-calls instead.
15637
15638 -mearly-cbranchsi
15639 Enable pre-reload use of the "cbranchsi" pattern.
15640
15641 -mexpand-adddi
15642 Expand "adddi3" and "subdi3" at RTL generation time into "add.f",
15643 "adc" etc. This option is deprecated.
15644
15645 -mindexed-loads
15646 Enable the use of indexed loads. This can be problematic because
15647 some optimizers then assume that indexed stores exist, which is not
15648 the case.
15649
15650 -mlra
15651 Enable Local Register Allocation. This is still experimental for
15652 ARC, so by default the compiler uses standard reload (i.e.
15653 -mno-lra).
15654
15655 -mlra-priority-none
15656 Don't indicate any priority for target registers.
15657
15658 -mlra-priority-compact
15659 Indicate target register priority for r0..r3 / r12..r15.
15660
15661 -mlra-priority-noncompact
15662 Reduce target register priority for r0..r3 / r12..r15.
15663
15664 -mmillicode
15665 When optimizing for size (using -Os), prologues and epilogues that
15666 have to save or restore a large number of registers are often
15667 shortened by using call to a special function in libgcc; this is
15668 referred to as a millicode call. As these calls can pose
15669 performance issues, and/or cause linking issues when linking in a
15670 nonstandard way, this option is provided to turn on or off
15671 millicode call generation.
15672
15673 -mcode-density-frame
15674 This option enable the compiler to emit "enter" and "leave"
15675 instructions. These instructions are only valid for CPUs with
15676 code-density feature.
15677
15678 -mmixed-code
15679 Tweak register allocation to help 16-bit instruction generation.
15680 This generally has the effect of decreasing the average instruction
15681 size while increasing the instruction count.
15682
15683 -mq-class
15684 Ths option is deprecated. Enable q instruction alternatives. This
15685 is the default for -Os.
15686
15687 -mRcq
15688 Enable Rcq constraint handling. Most short code generation depends
15689 on this. This is the default.
15690
15691 -mRcw
15692 Enable Rcw constraint handling. Most ccfsm condexec mostly depends
15693 on this. This is the default.
15694
15695 -msize-level=level
15696 Fine-tune size optimization with regards to instruction lengths and
15697 alignment. The recognized values for level are:
15698
15699 0 No size optimization. This level is deprecated and treated
15700 like 1.
15701
15702 1 Short instructions are used opportunistically.
15703
15704 2 In addition, alignment of loops and of code after barriers are
15705 dropped.
15706
15707 3 In addition, optional data alignment is dropped, and the option
15708 Os is enabled.
15709
15710 This defaults to 3 when -Os is in effect. Otherwise, the behavior
15711 when this is not set is equivalent to level 1.
15712
15713 -mtune=cpu
15714 Set instruction scheduling parameters for cpu, overriding any
15715 implied by -mcpu=.
15716
15717 Supported values for cpu are
15718
15719 ARC600
15720 Tune for ARC600 CPU.
15721
15722 ARC601
15723 Tune for ARC601 CPU.
15724
15725 ARC700
15726 Tune for ARC700 CPU with standard multiplier block.
15727
15728 ARC700-xmac
15729 Tune for ARC700 CPU with XMAC block.
15730
15731 ARC725D
15732 Tune for ARC725D CPU.
15733
15734 ARC750D
15735 Tune for ARC750D CPU.
15736
15737 -mmultcost=num
15738 Cost to assume for a multiply instruction, with 4 being equal to a
15739 normal instruction.
15740
15741 -munalign-prob-threshold=probability
15742 Set probability threshold for unaligning branches. When tuning for
15743 ARC700 and optimizing for speed, branches without filled delay slot
15744 are preferably emitted unaligned and long, unless profiling
15745 indicates that the probability for the branch to be taken is below
15746 probability. The default is (REG_BR_PROB_BASE/2), i.e. 5000.
15747
15748 The following options are maintained for backward compatibility, but
15749 are now deprecated and will be removed in a future release:
15750
15751 -margonaut
15752 Obsolete FPX.
15753
15754 -mbig-endian
15755 -EB Compile code for big-endian targets. Use of these options is now
15756 deprecated. Big-endian code is supported by configuring GCC to
15757 build "arceb-elf32" and "arceb-linux-uclibc" targets, for which big
15758 endian is the default.
15759
15760 -mlittle-endian
15761 -EL Compile code for little-endian targets. Use of these options is
15762 now deprecated. Little-endian code is supported by configuring GCC
15763 to build "arc-elf32" and "arc-linux-uclibc" targets, for which
15764 little endian is the default.
15765
15766 -mbarrel_shifter
15767 Replaced by -mbarrel-shifter.
15768
15769 -mdpfp_compact
15770 Replaced by -mdpfp-compact.
15771
15772 -mdpfp_fast
15773 Replaced by -mdpfp-fast.
15774
15775 -mdsp_packa
15776 Replaced by -mdsp-packa.
15777
15778 -mEA
15779 Replaced by -mea.
15780
15781 -mmac_24
15782 Replaced by -mmac-24.
15783
15784 -mmac_d16
15785 Replaced by -mmac-d16.
15786
15787 -mspfp_compact
15788 Replaced by -mspfp-compact.
15789
15790 -mspfp_fast
15791 Replaced by -mspfp-fast.
15792
15793 -mtune=cpu
15794 Values arc600, arc601, arc700 and arc700-xmac for cpu are replaced
15795 by ARC600, ARC601, ARC700 and ARC700-xmac respectively.
15796
15797 -multcost=num
15798 Replaced by -mmultcost.
15799
15800 ARM Options
15801
15802 These -m options are defined for the ARM port:
15803
15804 -mabi=name
15805 Generate code for the specified ABI. Permissible values are: apcs-
15806 gnu, atpcs, aapcs, aapcs-linux and iwmmxt.
15807
15808 -mapcs-frame
15809 Generate a stack frame that is compliant with the ARM Procedure
15810 Call Standard for all functions, even if this is not strictly
15811 necessary for correct execution of the code. Specifying
15812 -fomit-frame-pointer with this option causes the stack frames not
15813 to be generated for leaf functions. The default is
15814 -mno-apcs-frame. This option is deprecated.
15815
15816 -mapcs
15817 This is a synonym for -mapcs-frame and is deprecated.
15818
15819 -mthumb-interwork
15820 Generate code that supports calling between the ARM and Thumb
15821 instruction sets. Without this option, on pre-v5 architectures,
15822 the two instruction sets cannot be reliably used inside one
15823 program. The default is -mno-thumb-interwork, since slightly
15824 larger code is generated when -mthumb-interwork is specified. In
15825 AAPCS configurations this option is meaningless.
15826
15827 -mno-sched-prolog
15828 Prevent the reordering of instructions in the function prologue, or
15829 the merging of those instruction with the instructions in the
15830 function's body. This means that all functions start with a
15831 recognizable set of instructions (or in fact one of a choice from a
15832 small set of different function prologues), and this information
15833 can be used to locate the start of functions inside an executable
15834 piece of code. The default is -msched-prolog.
15835
15836 -mfloat-abi=name
15837 Specifies which floating-point ABI to use. Permissible values are:
15838 soft, softfp and hard.
15839
15840 Specifying soft causes GCC to generate output containing library
15841 calls for floating-point operations. softfp allows the generation
15842 of code using hardware floating-point instructions, but still uses
15843 the soft-float calling conventions. hard allows generation of
15844 floating-point instructions and uses FPU-specific calling
15845 conventions.
15846
15847 The default depends on the specific target configuration. Note
15848 that the hard-float and soft-float ABIs are not link-compatible;
15849 you must compile your entire program with the same ABI, and link
15850 with a compatible set of libraries.
15851
15852 -mgeneral-regs-only
15853 Generate code which uses only the general-purpose registers. This
15854 will prevent the compiler from using floating-point and Advanced
15855 SIMD registers but will not impose any restrictions on the
15856 assembler.
15857
15858 -mlittle-endian
15859 Generate code for a processor running in little-endian mode. This
15860 is the default for all standard configurations.
15861
15862 -mbig-endian
15863 Generate code for a processor running in big-endian mode; the
15864 default is to compile code for a little-endian processor.
15865
15866 -mbe8
15867 -mbe32
15868 When linking a big-endian image select between BE8 and BE32
15869 formats. The option has no effect for little-endian images and is
15870 ignored. The default is dependent on the selected target
15871 architecture. For ARMv6 and later architectures the default is
15872 BE8, for older architectures the default is BE32. BE32 format has
15873 been deprecated by ARM.
15874
15875 -march=name[+extension...]
15876 This specifies the name of the target ARM architecture. GCC uses
15877 this name to determine what kind of instructions it can emit when
15878 generating assembly code. This option can be used in conjunction
15879 with or instead of the -mcpu= option.
15880
15881 Permissible names are: armv4t, armv5t, armv5te, armv6, armv6j,
15882 armv6k, armv6kz, armv6t2, armv6z, armv6zk, armv7, armv7-a, armv7ve,
15883 armv8-a, armv8.1-a, armv8.2-a, armv8.3-a, armv8.4-a, armv8.5-a,
15884 armv8.6-a, armv7-r, armv8-r, armv6-m, armv6s-m, armv7-m, armv7e-m,
15885 armv8-m.base, armv8-m.main, armv8.1-m.main, iwmmxt and iwmmxt2.
15886
15887 Additionally, the following architectures, which lack support for
15888 the Thumb execution state, are recognized but support is
15889 deprecated: armv4.
15890
15891 Many of the architectures support extensions. These can be added
15892 by appending +extension to the architecture name. Extension
15893 options are processed in order and capabilities accumulate. An
15894 extension will also enable any necessary base extensions upon which
15895 it depends. For example, the +crypto extension will always enable
15896 the +simd extension. The exception to the additive construction is
15897 for extensions that are prefixed with +no...: these extensions
15898 disable the specified option and any other extensions that may
15899 depend on the presence of that extension.
15900
15901 For example, -march=armv7-a+simd+nofp+vfpv4 is equivalent to
15902 writing -march=armv7-a+vfpv4 since the +simd option is entirely
15903 disabled by the +nofp option that follows it.
15904
15905 Most extension names are generically named, but have an effect that
15906 is dependent upon the architecture to which it is applied. For
15907 example, the +simd option can be applied to both armv7-a and
15908 armv8-a architectures, but will enable the original ARMv7-A
15909 Advanced SIMD (Neon) extensions for armv7-a and the ARMv8-A variant
15910 for armv8-a.
15911
15912 The table below lists the supported extensions for each
15913 architecture. Architectures not mentioned do not support any
15914 extensions.
15915
15916 armv5te
15917 armv6
15918 armv6j
15919 armv6k
15920 armv6kz
15921 armv6t2
15922 armv6z
15923 armv6zk
15924 +fp The VFPv2 floating-point instructions. The extension
15925 +vfpv2 can be used as an alias for this extension.
15926
15927 +nofp
15928 Disable the floating-point instructions.
15929
15930 armv7
15931 The common subset of the ARMv7-A, ARMv7-R and ARMv7-M
15932 architectures.
15933
15934 +fp The VFPv3 floating-point instructions, with 16 double-
15935 precision registers. The extension +vfpv3-d16 can be used
15936 as an alias for this extension. Note that floating-point
15937 is not supported by the base ARMv7-M architecture, but is
15938 compatible with both the ARMv7-A and ARMv7-R architectures.
15939
15940 +nofp
15941 Disable the floating-point instructions.
15942
15943 armv7-a
15944 +mp The multiprocessing extension.
15945
15946 +sec
15947 The security extension.
15948
15949 +fp The VFPv3 floating-point instructions, with 16 double-
15950 precision registers. The extension +vfpv3-d16 can be used
15951 as an alias for this extension.
15952
15953 +simd
15954 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point
15955 instructions. The extensions +neon and +neon-vfpv3 can be
15956 used as aliases for this extension.
15957
15958 +vfpv3
15959 The VFPv3 floating-point instructions, with 32 double-
15960 precision registers.
15961
15962 +vfpv3-d16-fp16
15963 The VFPv3 floating-point instructions, with 16 double-
15964 precision registers and the half-precision floating-point
15965 conversion operations.
15966
15967 +vfpv3-fp16
15968 The VFPv3 floating-point instructions, with 32 double-
15969 precision registers and the half-precision floating-point
15970 conversion operations.
15971
15972 +vfpv4-d16
15973 The VFPv4 floating-point instructions, with 16 double-
15974 precision registers.
15975
15976 +vfpv4
15977 The VFPv4 floating-point instructions, with 32 double-
15978 precision registers.
15979
15980 +neon-fp16
15981 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point
15982 instructions, with the half-precision floating-point
15983 conversion operations.
15984
15985 +neon-vfpv4
15986 The Advanced SIMD (Neon) v2 and the VFPv4 floating-point
15987 instructions.
15988
15989 +nosimd
15990 Disable the Advanced SIMD instructions (does not disable
15991 floating point).
15992
15993 +nofp
15994 Disable the floating-point and Advanced SIMD instructions.
15995
15996 armv7ve
15997 The extended version of the ARMv7-A architecture with support
15998 for virtualization.
15999
16000 +fp The VFPv4 floating-point instructions, with 16 double-
16001 precision registers. The extension +vfpv4-d16 can be used
16002 as an alias for this extension.
16003
16004 +simd
16005 The Advanced SIMD (Neon) v2 and the VFPv4 floating-point
16006 instructions. The extension +neon-vfpv4 can be used as an
16007 alias for this extension.
16008
16009 +vfpv3-d16
16010 The VFPv3 floating-point instructions, with 16 double-
16011 precision registers.
16012
16013 +vfpv3
16014 The VFPv3 floating-point instructions, with 32 double-
16015 precision registers.
16016
16017 +vfpv3-d16-fp16
16018 The VFPv3 floating-point instructions, with 16 double-
16019 precision registers and the half-precision floating-point
16020 conversion operations.
16021
16022 +vfpv3-fp16
16023 The VFPv3 floating-point instructions, with 32 double-
16024 precision registers and the half-precision floating-point
16025 conversion operations.
16026
16027 +vfpv4-d16
16028 The VFPv4 floating-point instructions, with 16 double-
16029 precision registers.
16030
16031 +vfpv4
16032 The VFPv4 floating-point instructions, with 32 double-
16033 precision registers.
16034
16035 +neon
16036 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point
16037 instructions. The extension +neon-vfpv3 can be used as an
16038 alias for this extension.
16039
16040 +neon-fp16
16041 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point
16042 instructions, with the half-precision floating-point
16043 conversion operations.
16044
16045 +nosimd
16046 Disable the Advanced SIMD instructions (does not disable
16047 floating point).
16048
16049 +nofp
16050 Disable the floating-point and Advanced SIMD instructions.
16051
16052 armv8-a
16053 +crc
16054 The Cyclic Redundancy Check (CRC) instructions.
16055
16056 +simd
16057 The ARMv8-A Advanced SIMD and floating-point instructions.
16058
16059 +crypto
16060 The cryptographic instructions.
16061
16062 +nocrypto
16063 Disable the cryptographic instructions.
16064
16065 +nofp
16066 Disable the floating-point, Advanced SIMD and cryptographic
16067 instructions.
16068
16069 +sb Speculation Barrier Instruction.
16070
16071 +predres
16072 Execution and Data Prediction Restriction Instructions.
16073
16074 armv8.1-a
16075 +simd
16076 The ARMv8.1-A Advanced SIMD and floating-point
16077 instructions.
16078
16079 +crypto
16080 The cryptographic instructions. This also enables the
16081 Advanced SIMD and floating-point instructions.
16082
16083 +nocrypto
16084 Disable the cryptographic instructions.
16085
16086 +nofp
16087 Disable the floating-point, Advanced SIMD and cryptographic
16088 instructions.
16089
16090 +sb Speculation Barrier Instruction.
16091
16092 +predres
16093 Execution and Data Prediction Restriction Instructions.
16094
16095 armv8.2-a
16096 armv8.3-a
16097 +fp16
16098 The half-precision floating-point data processing
16099 instructions. This also enables the Advanced SIMD and
16100 floating-point instructions.
16101
16102 +fp16fml
16103 The half-precision floating-point fmla extension. This
16104 also enables the half-precision floating-point extension
16105 and Advanced SIMD and floating-point instructions.
16106
16107 +simd
16108 The ARMv8.1-A Advanced SIMD and floating-point
16109 instructions.
16110
16111 +crypto
16112 The cryptographic instructions. This also enables the
16113 Advanced SIMD and floating-point instructions.
16114
16115 +dotprod
16116 Enable the Dot Product extension. This also enables
16117 Advanced SIMD instructions.
16118
16119 +nocrypto
16120 Disable the cryptographic extension.
16121
16122 +nofp
16123 Disable the floating-point, Advanced SIMD and cryptographic
16124 instructions.
16125
16126 +sb Speculation Barrier Instruction.
16127
16128 +predres
16129 Execution and Data Prediction Restriction Instructions.
16130
16131 +i8mm
16132 8-bit Integer Matrix Multiply instructions. This also
16133 enables Advanced SIMD and floating-point instructions.
16134
16135 +bf16
16136 Brain half-precision floating-point instructions. This
16137 also enables Advanced SIMD and floating-point instructions.
16138
16139 armv8.4-a
16140 +fp16
16141 The half-precision floating-point data processing
16142 instructions. This also enables the Advanced SIMD and
16143 floating-point instructions as well as the Dot Product
16144 extension and the half-precision floating-point fmla
16145 extension.
16146
16147 +simd
16148 The ARMv8.3-A Advanced SIMD and floating-point instructions
16149 as well as the Dot Product extension.
16150
16151 +crypto
16152 The cryptographic instructions. This also enables the
16153 Advanced SIMD and floating-point instructions as well as
16154 the Dot Product extension.
16155
16156 +nocrypto
16157 Disable the cryptographic extension.
16158
16159 +nofp
16160 Disable the floating-point, Advanced SIMD and cryptographic
16161 instructions.
16162
16163 +sb Speculation Barrier Instruction.
16164
16165 +predres
16166 Execution and Data Prediction Restriction Instructions.
16167
16168 +i8mm
16169 8-bit Integer Matrix Multiply instructions. This also
16170 enables Advanced SIMD and floating-point instructions.
16171
16172 +bf16
16173 Brain half-precision floating-point instructions. This
16174 also enables Advanced SIMD and floating-point instructions.
16175
16176 armv8.5-a
16177 +fp16
16178 The half-precision floating-point data processing
16179 instructions. This also enables the Advanced SIMD and
16180 floating-point instructions as well as the Dot Product
16181 extension and the half-precision floating-point fmla
16182 extension.
16183
16184 +simd
16185 The ARMv8.3-A Advanced SIMD and floating-point instructions
16186 as well as the Dot Product extension.
16187
16188 +crypto
16189 The cryptographic instructions. This also enables the
16190 Advanced SIMD and floating-point instructions as well as
16191 the Dot Product extension.
16192
16193 +nocrypto
16194 Disable the cryptographic extension.
16195
16196 +nofp
16197 Disable the floating-point, Advanced SIMD and cryptographic
16198 instructions.
16199
16200 +i8mm
16201 8-bit Integer Matrix Multiply instructions. This also
16202 enables Advanced SIMD and floating-point instructions.
16203
16204 +bf16
16205 Brain half-precision floating-point instructions. This
16206 also enables Advanced SIMD and floating-point instructions.
16207
16208 armv8.6-a
16209 +fp16
16210 The half-precision floating-point data processing
16211 instructions. This also enables the Advanced SIMD and
16212 floating-point instructions as well as the Dot Product
16213 extension and the half-precision floating-point fmla
16214 extension.
16215
16216 +simd
16217 The ARMv8.3-A Advanced SIMD and floating-point instructions
16218 as well as the Dot Product extension.
16219
16220 +crypto
16221 The cryptographic instructions. This also enables the
16222 Advanced SIMD and floating-point instructions as well as
16223 the Dot Product extension.
16224
16225 +nocrypto
16226 Disable the cryptographic extension.
16227
16228 +nofp
16229 Disable the floating-point, Advanced SIMD and cryptographic
16230 instructions.
16231
16232 +i8mm
16233 8-bit Integer Matrix Multiply instructions. This also
16234 enables Advanced SIMD and floating-point instructions.
16235
16236 +bf16
16237 Brain half-precision floating-point instructions. This
16238 also enables Advanced SIMD and floating-point instructions.
16239
16240 armv7-r
16241 +fp.sp
16242 The single-precision VFPv3 floating-point instructions.
16243 The extension +vfpv3xd can be used as an alias for this
16244 extension.
16245
16246 +fp The VFPv3 floating-point instructions with 16 double-
16247 precision registers. The extension +vfpv3-d16 can be used
16248 as an alias for this extension.
16249
16250 +vfpv3xd-d16-fp16
16251 The single-precision VFPv3 floating-point instructions with
16252 16 double-precision registers and the half-precision
16253 floating-point conversion operations.
16254
16255 +vfpv3-d16-fp16
16256 The VFPv3 floating-point instructions with 16 double-
16257 precision registers and the half-precision floating-point
16258 conversion operations.
16259
16260 +nofp
16261 Disable the floating-point extension.
16262
16263 +idiv
16264 The ARM-state integer division instructions.
16265
16266 +noidiv
16267 Disable the ARM-state integer division extension.
16268
16269 armv7e-m
16270 +fp The single-precision VFPv4 floating-point instructions.
16271
16272 +fpv5
16273 The single-precision FPv5 floating-point instructions.
16274
16275 +fp.dp
16276 The single- and double-precision FPv5 floating-point
16277 instructions.
16278
16279 +nofp
16280 Disable the floating-point extensions.
16281
16282 armv8.1-m.main
16283 +dsp
16284 The DSP instructions.
16285
16286 +mve
16287 The M-Profile Vector Extension (MVE) integer instructions.
16288
16289 +mve.fp
16290 The M-Profile Vector Extension (MVE) integer and single
16291 precision floating-point instructions.
16292
16293 +fp The single-precision floating-point instructions.
16294
16295 +fp.dp
16296 The single- and double-precision floating-point
16297 instructions.
16298
16299 +nofp
16300 Disable the floating-point extension.
16301
16302 +cdecp0, +cdecp1, ... , +cdecp7
16303 Enable the Custom Datapath Extension (CDE) on selected
16304 coprocessors according to the numbers given in the options
16305 in the range 0 to 7.
16306
16307 armv8-m.main
16308 +dsp
16309 The DSP instructions.
16310
16311 +nodsp
16312 Disable the DSP extension.
16313
16314 +fp The single-precision floating-point instructions.
16315
16316 +fp.dp
16317 The single- and double-precision floating-point
16318 instructions.
16319
16320 +nofp
16321 Disable the floating-point extension.
16322
16323 +cdecp0, +cdecp1, ... , +cdecp7
16324 Enable the Custom Datapath Extension (CDE) on selected
16325 coprocessors according to the numbers given in the options
16326 in the range 0 to 7.
16327
16328 armv8-r
16329 +crc
16330 The Cyclic Redundancy Check (CRC) instructions.
16331
16332 +fp.sp
16333 The single-precision FPv5 floating-point instructions.
16334
16335 +simd
16336 The ARMv8-A Advanced SIMD and floating-point instructions.
16337
16338 +crypto
16339 The cryptographic instructions.
16340
16341 +nocrypto
16342 Disable the cryptographic instructions.
16343
16344 +nofp
16345 Disable the floating-point, Advanced SIMD and cryptographic
16346 instructions.
16347
16348 -march=native causes the compiler to auto-detect the architecture
16349 of the build computer. At present, this feature is only supported
16350 on GNU/Linux, and not all architectures are recognized. If the
16351 auto-detect is unsuccessful the option has no effect.
16352
16353 -mtune=name
16354 This option specifies the name of the target ARM processor for
16355 which GCC should tune the performance of the code. For some ARM
16356 implementations better performance can be obtained by using this
16357 option. Permissible names are: arm7tdmi, arm7tdmi-s, arm710t,
16358 arm720t, arm740t, strongarm, strongarm110, strongarm1100,
16359 0strongarm1110, arm8, arm810, arm9, arm9e, arm920, arm920t,
16360 arm922t, arm946e-s, arm966e-s, arm968e-s, arm926ej-s, arm940t,
16361 arm9tdmi, arm10tdmi, arm1020t, arm1026ej-s, arm10e, arm1020e,
16362 arm1022e, arm1136j-s, arm1136jf-s, mpcore, mpcorenovfp,
16363 arm1156t2-s, arm1156t2f-s, arm1176jz-s, arm1176jzf-s,
16364 generic-armv7-a, cortex-a5, cortex-a7, cortex-a8, cortex-a9,
16365 cortex-a12, cortex-a15, cortex-a17, cortex-a32, cortex-a35,
16366 cortex-a53, cortex-a55, cortex-a57, cortex-a72, cortex-a73,
16367 cortex-a75, cortex-a76, cortex-a76ae, cortex-a77, ares, cortex-r4,
16368 cortex-r4f, cortex-r5, cortex-r7, cortex-r8, cortex-r52, cortex-m0,
16369 cortex-m0plus, cortex-m1, cortex-m3, cortex-m4, cortex-m7,
16370 cortex-m23, cortex-m33, cortex-m35p, cortex-m55,
16371 cortex-m1.small-multiply, cortex-m0.small-multiply,
16372 cortex-m0plus.small-multiply, exynos-m1, marvell-pj4, neoverse-n1,
16373 neoverse-n2, neoverse-v1, xscale, iwmmxt, iwmmxt2, ep9312, fa526,
16374 fa626, fa606te, fa626te, fmp626, fa726te, xgene1.
16375
16376 Additionally, this option can specify that GCC should tune the
16377 performance of the code for a big.LITTLE system. Permissible names
16378 are: cortex-a15.cortex-a7, cortex-a17.cortex-a7,
16379 cortex-a57.cortex-a53, cortex-a72.cortex-a53,
16380 cortex-a72.cortex-a35, cortex-a73.cortex-a53,
16381 cortex-a75.cortex-a55, cortex-a76.cortex-a55.
16382
16383 -mtune=generic-arch specifies that GCC should tune the performance
16384 for a blend of processors within architecture arch. The aim is to
16385 generate code that run well on the current most popular processors,
16386 balancing between optimizations that benefit some CPUs in the
16387 range, and avoiding performance pitfalls of other CPUs. The
16388 effects of this option may change in future GCC versions as CPU
16389 models come and go.
16390
16391 -mtune permits the same extension options as -mcpu, but the
16392 extension options do not affect the tuning of the generated code.
16393
16394 -mtune=native causes the compiler to auto-detect the CPU of the
16395 build computer. At present, this feature is only supported on
16396 GNU/Linux, and not all architectures are recognized. If the auto-
16397 detect is unsuccessful the option has no effect.
16398
16399 -mcpu=name[+extension...]
16400 This specifies the name of the target ARM processor. GCC uses this
16401 name to derive the name of the target ARM architecture (as if
16402 specified by -march) and the ARM processor type for which to tune
16403 for performance (as if specified by -mtune). Where this option is
16404 used in conjunction with -march or -mtune, those options take
16405 precedence over the appropriate part of this option.
16406
16407 Many of the supported CPUs implement optional architectural
16408 extensions. Where this is so the architectural extensions are
16409 normally enabled by default. If implementations that lack the
16410 extension exist, then the extension syntax can be used to disable
16411 those extensions that have been omitted. For floating-point and
16412 Advanced SIMD (Neon) instructions, the settings of the options
16413 -mfloat-abi and -mfpu must also be considered: floating-point and
16414 Advanced SIMD instructions will only be used if -mfloat-abi is not
16415 set to soft; and any setting of -mfpu other than auto will override
16416 the available floating-point and SIMD extension instructions.
16417
16418 For example, cortex-a9 can be found in three major configurations:
16419 integer only, with just a floating-point unit or with floating-
16420 point and Advanced SIMD. The default is to enable all the
16421 instructions, but the extensions +nosimd and +nofp can be used to
16422 disable just the SIMD or both the SIMD and floating-point
16423 instructions respectively.
16424
16425 Permissible names for this option are the same as those for -mtune.
16426
16427 The following extension options are common to the listed CPUs:
16428
16429 +nodsp
16430 Disable the DSP instructions on cortex-m33, cortex-m35p.
16431
16432 +nofp
16433 Disables the floating-point instructions on arm9e, arm946e-s,
16434 arm966e-s, arm968e-s, arm10e, arm1020e, arm1022e, arm926ej-s,
16435 arm1026ej-s, cortex-r5, cortex-r7, cortex-r8, cortex-m4,
16436 cortex-m7, cortex-m33 and cortex-m35p. Disables the floating-
16437 point and SIMD instructions on generic-armv7-a, cortex-a5,
16438 cortex-a7, cortex-a8, cortex-a9, cortex-a12, cortex-a15,
16439 cortex-a17, cortex-a15.cortex-a7, cortex-a17.cortex-a7,
16440 cortex-a32, cortex-a35, cortex-a53 and cortex-a55.
16441
16442 +nofp.dp
16443 Disables the double-precision component of the floating-point
16444 instructions on cortex-r5, cortex-r7, cortex-r8, cortex-r52 and
16445 cortex-m7.
16446
16447 +nosimd
16448 Disables the SIMD (but not floating-point) instructions on
16449 generic-armv7-a, cortex-a5, cortex-a7 and cortex-a9.
16450
16451 +crypto
16452 Enables the cryptographic instructions on cortex-a32,
16453 cortex-a35, cortex-a53, cortex-a55, cortex-a57, cortex-a72,
16454 cortex-a73, cortex-a75, exynos-m1, xgene1,
16455 cortex-a57.cortex-a53, cortex-a72.cortex-a53,
16456 cortex-a73.cortex-a35, cortex-a73.cortex-a53 and
16457 cortex-a75.cortex-a55.
16458
16459 Additionally the generic-armv7-a pseudo target defaults to VFPv3
16460 with 16 double-precision registers. It supports the following
16461 extension options: mp, sec, vfpv3-d16, vfpv3, vfpv3-d16-fp16,
16462 vfpv3-fp16, vfpv4-d16, vfpv4, neon, neon-vfpv3, neon-fp16,
16463 neon-vfpv4. The meanings are the same as for the extensions to
16464 -march=armv7-a.
16465
16466 -mcpu=generic-arch is also permissible, and is equivalent to
16467 -march=arch -mtune=generic-arch. See -mtune for more information.
16468
16469 -mcpu=native causes the compiler to auto-detect the CPU of the
16470 build computer. At present, this feature is only supported on
16471 GNU/Linux, and not all architectures are recognized. If the auto-
16472 detect is unsuccessful the option has no effect.
16473
16474 -mfpu=name
16475 This specifies what floating-point hardware (or hardware emulation)
16476 is available on the target. Permissible names are: auto, vfpv2,
16477 vfpv3, vfpv3-fp16, vfpv3-d16, vfpv3-d16-fp16, vfpv3xd,
16478 vfpv3xd-fp16, neon-vfpv3, neon-fp16, vfpv4, vfpv4-d16, fpv4-sp-d16,
16479 neon-vfpv4, fpv5-d16, fpv5-sp-d16, fp-armv8, neon-fp-armv8 and
16480 crypto-neon-fp-armv8. Note that neon is an alias for neon-vfpv3
16481 and vfp is an alias for vfpv2.
16482
16483 The setting auto is the default and is special. It causes the
16484 compiler to select the floating-point and Advanced SIMD
16485 instructions based on the settings of -mcpu and -march.
16486
16487 If the selected floating-point hardware includes the NEON extension
16488 (e.g. -mfpu=neon), note that floating-point operations are not
16489 generated by GCC's auto-vectorization pass unless
16490 -funsafe-math-optimizations is also specified. This is because
16491 NEON hardware does not fully implement the IEEE 754 standard for
16492 floating-point arithmetic (in particular denormal values are
16493 treated as zero), so the use of NEON instructions may lead to a
16494 loss of precision.
16495
16496 You can also set the fpu name at function level by using the
16497 "target("fpu=")" function attributes or pragmas.
16498
16499 -mfp16-format=name
16500 Specify the format of the "__fp16" half-precision floating-point
16501 type. Permissible names are none, ieee, and alternative; the
16502 default is none, in which case the "__fp16" type is not defined.
16503
16504 -mstructure-size-boundary=n
16505 The sizes of all structures and unions are rounded up to a multiple
16506 of the number of bits set by this option. Permissible values are
16507 8, 32 and 64. The default value varies for different toolchains.
16508 For the COFF targeted toolchain the default value is 8. A value of
16509 64 is only allowed if the underlying ABI supports it.
16510
16511 Specifying a larger number can produce faster, more efficient code,
16512 but can also increase the size of the program. Different values
16513 are potentially incompatible. Code compiled with one value cannot
16514 necessarily expect to work with code or libraries compiled with
16515 another value, if they exchange information using structures or
16516 unions.
16517
16518 This option is deprecated.
16519
16520 -mabort-on-noreturn
16521 Generate a call to the function "abort" at the end of a "noreturn"
16522 function. It is executed if the function tries to return.
16523
16524 -mlong-calls
16525 -mno-long-calls
16526 Tells the compiler to perform function calls by first loading the
16527 address of the function into a register and then performing a
16528 subroutine call on this register. This switch is needed if the
16529 target function lies outside of the 64-megabyte addressing range of
16530 the offset-based version of subroutine call instruction.
16531
16532 Even if this switch is enabled, not all function calls are turned
16533 into long calls. The heuristic is that static functions, functions
16534 that have the "short_call" attribute, functions that are inside the
16535 scope of a "#pragma no_long_calls" directive, and functions whose
16536 definitions have already been compiled within the current
16537 compilation unit are not turned into long calls. The exceptions to
16538 this rule are that weak function definitions, functions with the
16539 "long_call" attribute or the "section" attribute, and functions
16540 that are within the scope of a "#pragma long_calls" directive are
16541 always turned into long calls.
16542
16543 This feature is not enabled by default. Specifying -mno-long-calls
16544 restores the default behavior, as does placing the function calls
16545 within the scope of a "#pragma long_calls_off" directive. Note
16546 these switches have no effect on how the compiler generates code to
16547 handle function calls via function pointers.
16548
16549 -msingle-pic-base
16550 Treat the register used for PIC addressing as read-only, rather
16551 than loading it in the prologue for each function. The runtime
16552 system is responsible for initializing this register with an
16553 appropriate value before execution begins.
16554
16555 -mpic-register=reg
16556 Specify the register to be used for PIC addressing. For standard
16557 PIC base case, the default is any suitable register determined by
16558 compiler. For single PIC base case, the default is R9 if target is
16559 EABI based or stack-checking is enabled, otherwise the default is
16560 R10.
16561
16562 -mpic-data-is-text-relative
16563 Assume that the displacement between the text and data segments is
16564 fixed at static link time. This permits using PC-relative
16565 addressing operations to access data known to be in the data
16566 segment. For non-VxWorks RTP targets, this option is enabled by
16567 default. When disabled on such targets, it will enable
16568 -msingle-pic-base by default.
16569
16570 -mpoke-function-name
16571 Write the name of each function into the text section, directly
16572 preceding the function prologue. The generated code is similar to
16573 this:
16574
16575 t0
16576 .ascii "arm_poke_function_name", 0
16577 .align
16578 t1
16579 .word 0xff000000 + (t1 - t0)
16580 arm_poke_function_name
16581 mov ip, sp
16582 stmfd sp!, {fp, ip, lr, pc}
16583 sub fp, ip, #4
16584
16585 When performing a stack backtrace, code can inspect the value of
16586 "pc" stored at "fp + 0". If the trace function then looks at
16587 location "pc - 12" and the top 8 bits are set, then we know that
16588 there is a function name embedded immediately preceding this
16589 location and has length "((pc[-3]) & 0xff000000)".
16590
16591 -mthumb
16592 -marm
16593 Select between generating code that executes in ARM and Thumb
16594 states. The default for most configurations is to generate code
16595 that executes in ARM state, but the default can be changed by
16596 configuring GCC with the --with-mode=state configure option.
16597
16598 You can also override the ARM and Thumb mode for each function by
16599 using the "target("thumb")" and "target("arm")" function attributes
16600 or pragmas.
16601
16602 -mflip-thumb
16603 Switch ARM/Thumb modes on alternating functions. This option is
16604 provided for regression testing of mixed Thumb/ARM code generation,
16605 and is not intended for ordinary use in compiling code.
16606
16607 -mtpcs-frame
16608 Generate a stack frame that is compliant with the Thumb Procedure
16609 Call Standard for all non-leaf functions. (A leaf function is one
16610 that does not call any other functions.) The default is
16611 -mno-tpcs-frame.
16612
16613 -mtpcs-leaf-frame
16614 Generate a stack frame that is compliant with the Thumb Procedure
16615 Call Standard for all leaf functions. (A leaf function is one that
16616 does not call any other functions.) The default is
16617 -mno-apcs-leaf-frame.
16618
16619 -mcallee-super-interworking
16620 Gives all externally visible functions in the file being compiled
16621 an ARM instruction set header which switches to Thumb mode before
16622 executing the rest of the function. This allows these functions to
16623 be called from non-interworking code. This option is not valid in
16624 AAPCS configurations because interworking is enabled by default.
16625
16626 -mcaller-super-interworking
16627 Allows calls via function pointers (including virtual functions) to
16628 execute correctly regardless of whether the target code has been
16629 compiled for interworking or not. There is a small overhead in the
16630 cost of executing a function pointer if this option is enabled.
16631 This option is not valid in AAPCS configurations because
16632 interworking is enabled by default.
16633
16634 -mtp=name
16635 Specify the access model for the thread local storage pointer. The
16636 valid models are soft, which generates calls to "__aeabi_read_tp",
16637 cp15, which fetches the thread pointer from "cp15" directly
16638 (supported in the arm6k architecture), and auto, which uses the
16639 best available method for the selected processor. The default
16640 setting is auto.
16641
16642 -mtls-dialect=dialect
16643 Specify the dialect to use for accessing thread local storage. Two
16644 dialects are supported---gnu and gnu2. The gnu dialect selects the
16645 original GNU scheme for supporting local and global dynamic TLS
16646 models. The gnu2 dialect selects the GNU descriptor scheme, which
16647 provides better performance for shared libraries. The GNU
16648 descriptor scheme is compatible with the original scheme, but does
16649 require new assembler, linker and library support. Initial and
16650 local exec TLS models are unaffected by this option and always use
16651 the original scheme.
16652
16653 -mword-relocations
16654 Only generate absolute relocations on word-sized values (i.e.
16655 R_ARM_ABS32). This is enabled by default on targets (uClinux,
16656 SymbianOS) where the runtime loader imposes this restriction, and
16657 when -fpic or -fPIC is specified. This option conflicts with
16658 -mslow-flash-data.
16659
16660 -mfix-cortex-m3-ldrd
16661 Some Cortex-M3 cores can cause data corruption when "ldrd"
16662 instructions with overlapping destination and base registers are
16663 used. This option avoids generating these instructions. This
16664 option is enabled by default when -mcpu=cortex-m3 is specified.
16665
16666 -munaligned-access
16667 -mno-unaligned-access
16668 Enables (or disables) reading and writing of 16- and 32- bit values
16669 from addresses that are not 16- or 32- bit aligned. By default
16670 unaligned access is disabled for all pre-ARMv6, all ARMv6-M and for
16671 ARMv8-M Baseline architectures, and enabled for all other
16672 architectures. If unaligned access is not enabled then words in
16673 packed data structures are accessed a byte at a time.
16674
16675 The ARM attribute "Tag_CPU_unaligned_access" is set in the
16676 generated object file to either true or false, depending upon the
16677 setting of this option. If unaligned access is enabled then the
16678 preprocessor symbol "__ARM_FEATURE_UNALIGNED" is also defined.
16679
16680 -mneon-for-64bits
16681 This option is deprecated and has no effect.
16682
16683 -mslow-flash-data
16684 Assume loading data from flash is slower than fetching instruction.
16685 Therefore literal load is minimized for better performance. This
16686 option is only supported when compiling for ARMv7 M-profile and off
16687 by default. It conflicts with -mword-relocations.
16688
16689 -masm-syntax-unified
16690 Assume inline assembler is using unified asm syntax. The default
16691 is currently off which implies divided syntax. This option has no
16692 impact on Thumb2. However, this may change in future releases of
16693 GCC. Divided syntax should be considered deprecated.
16694
16695 -mrestrict-it
16696 Restricts generation of IT blocks to conform to the rules of
16697 ARMv8-A. IT blocks can only contain a single 16-bit instruction
16698 from a select set of instructions. This option is on by default for
16699 ARMv8-A Thumb mode.
16700
16701 -mprint-tune-info
16702 Print CPU tuning information as comment in assembler file. This is
16703 an option used only for regression testing of the compiler and not
16704 intended for ordinary use in compiling code. This option is
16705 disabled by default.
16706
16707 -mverbose-cost-dump
16708 Enable verbose cost model dumping in the debug dump files. This
16709 option is provided for use in debugging the compiler.
16710
16711 -mpure-code
16712 Do not allow constant data to be placed in code sections.
16713 Additionally, when compiling for ELF object format give all text
16714 sections the ELF processor-specific section attribute
16715 "SHF_ARM_PURECODE". This option is only available when generating
16716 non-pic code for M-profile targets.
16717
16718 -mcmse
16719 Generate secure code as per the "ARMv8-M Security Extensions:
16720 Requirements on Development Tools Engineering Specification", which
16721 can be found on
16722 <https://developer.arm.com/documentation/ecm0359818/latest/>.
16723
16724 -mfdpic
16725 -mno-fdpic
16726 Select the FDPIC ABI, which uses 64-bit function descriptors to
16727 represent pointers to functions. When the compiler is configured
16728 for "arm-*-uclinuxfdpiceabi" targets, this option is on by default
16729 and implies -fPIE if none of the PIC/PIE-related options is
16730 provided. On other targets, it only enables the FDPIC-specific
16731 code generation features, and the user should explicitly provide
16732 the PIC/PIE-related options as needed.
16733
16734 Note that static linking is not supported because it would still
16735 involve the dynamic linker when the program self-relocates. If
16736 such behavior is acceptable, use -static and -Wl,-dynamic-linker
16737 options.
16738
16739 The opposite -mno-fdpic option is useful (and required) to build
16740 the Linux kernel using the same ("arm-*-uclinuxfdpiceabi")
16741 toolchain as the one used to build the userland programs.
16742
16743 AVR Options
16744
16745 These options are defined for AVR implementations:
16746
16747 -mmcu=mcu
16748 Specify Atmel AVR instruction set architectures (ISA) or MCU type.
16749
16750 The default for this option is avr2.
16751
16752 GCC supports the following AVR devices and ISAs:
16753
16754 "avr2"
16755 "Classic" devices with up to 8 KiB of program memory. mcu =
16756 "attiny22", "attiny26", "at90s2313", "at90s2323", "at90s2333",
16757 "at90s2343", "at90s4414", "at90s4433", "at90s4434",
16758 "at90c8534", "at90s8515", "at90s8535".
16759
16760 "avr25"
16761 "Classic" devices with up to 8 KiB of program memory and with
16762 the "MOVW" instruction. mcu = "attiny13", "attiny13a",
16763 "attiny24", "attiny24a", "attiny25", "attiny261", "attiny261a",
16764 "attiny2313", "attiny2313a", "attiny43u", "attiny44",
16765 "attiny44a", "attiny45", "attiny48", "attiny441", "attiny461",
16766 "attiny461a", "attiny4313", "attiny84", "attiny84a",
16767 "attiny85", "attiny87", "attiny88", "attiny828", "attiny841",
16768 "attiny861", "attiny861a", "ata5272", "ata6616c", "at86rf401".
16769
16770 "avr3"
16771 "Classic" devices with 16 KiB up to 64 KiB of program memory.
16772 mcu = "at76c711", "at43usb355".
16773
16774 "avr31"
16775 "Classic" devices with 128 KiB of program memory. mcu =
16776 "atmega103", "at43usb320".
16777
16778 "avr35"
16779 "Classic" devices with 16 KiB up to 64 KiB of program memory
16780 and with the "MOVW" instruction. mcu = "attiny167",
16781 "attiny1634", "atmega8u2", "atmega16u2", "atmega32u2",
16782 "ata5505", "ata6617c", "ata664251", "at90usb82", "at90usb162".
16783
16784 "avr4"
16785 "Enhanced" devices with up to 8 KiB of program memory. mcu =
16786 "atmega48", "atmega48a", "atmega48p", "atmega48pa",
16787 "atmega48pb", "atmega8", "atmega8a", "atmega8hva", "atmega88",
16788 "atmega88a", "atmega88p", "atmega88pa", "atmega88pb",
16789 "atmega8515", "atmega8535", "ata6285", "ata6286", "ata6289",
16790 "ata6612c", "at90pwm1", "at90pwm2", "at90pwm2b", "at90pwm3",
16791 "at90pwm3b", "at90pwm81".
16792
16793 "avr5"
16794 "Enhanced" devices with 16 KiB up to 64 KiB of program memory.
16795 mcu = "atmega16", "atmega16a", "atmega16hva", "atmega16hva2",
16796 "atmega16hvb", "atmega16hvbrevb", "atmega16m1", "atmega16u4",
16797 "atmega161", "atmega162", "atmega163", "atmega164a",
16798 "atmega164p", "atmega164pa", "atmega165", "atmega165a",
16799 "atmega165p", "atmega165pa", "atmega168", "atmega168a",
16800 "atmega168p", "atmega168pa", "atmega168pb", "atmega169",
16801 "atmega169a", "atmega169p", "atmega169pa", "atmega32",
16802 "atmega32a", "atmega32c1", "atmega32hvb", "atmega32hvbrevb",
16803 "atmega32m1", "atmega32u4", "atmega32u6", "atmega323",
16804 "atmega324a", "atmega324p", "atmega324pa", "atmega325",
16805 "atmega325a", "atmega325p", "atmega325pa", "atmega328",
16806 "atmega328p", "atmega328pb", "atmega329", "atmega329a",
16807 "atmega329p", "atmega329pa", "atmega3250", "atmega3250a",
16808 "atmega3250p", "atmega3250pa", "atmega3290", "atmega3290a",
16809 "atmega3290p", "atmega3290pa", "atmega406", "atmega64",
16810 "atmega64a", "atmega64c1", "atmega64hve", "atmega64hve2",
16811 "atmega64m1", "atmega64rfr2", "atmega640", "atmega644",
16812 "atmega644a", "atmega644p", "atmega644pa", "atmega644rfr2",
16813 "atmega645", "atmega645a", "atmega645p", "atmega649",
16814 "atmega649a", "atmega649p", "atmega6450", "atmega6450a",
16815 "atmega6450p", "atmega6490", "atmega6490a", "atmega6490p",
16816 "ata5795", "ata5790", "ata5790n", "ata5791", "ata6613c",
16817 "ata6614q", "ata5782", "ata5831", "ata8210", "ata8510",
16818 "ata5702m322", "at90pwm161", "at90pwm216", "at90pwm316",
16819 "at90can32", "at90can64", "at90scr100", "at90usb646",
16820 "at90usb647", "at94k", "m3000".
16821
16822 "avr51"
16823 "Enhanced" devices with 128 KiB of program memory. mcu =
16824 "atmega128", "atmega128a", "atmega128rfa1", "atmega128rfr2",
16825 "atmega1280", "atmega1281", "atmega1284", "atmega1284p",
16826 "atmega1284rfr2", "at90can128", "at90usb1286", "at90usb1287".
16827
16828 "avr6"
16829 "Enhanced" devices with 3-byte PC, i.e. with more than 128 KiB
16830 of program memory. mcu = "atmega256rfr2", "atmega2560",
16831 "atmega2561", "atmega2564rfr2".
16832
16833 "avrxmega2"
16834 "XMEGA" devices with more than 8 KiB and up to 64 KiB of
16835 program memory. mcu = "atxmega8e5", "atxmega16a4",
16836 "atxmega16a4u", "atxmega16c4", "atxmega16d4", "atxmega16e5",
16837 "atxmega32a4", "atxmega32a4u", "atxmega32c3", "atxmega32c4",
16838 "atxmega32d3", "atxmega32d4", "atxmega32e5".
16839
16840 "avrxmega3"
16841 "XMEGA" devices with up to 64 KiB of combined program memory
16842 and RAM, and with program memory visible in the RAM address
16843 space. mcu = "attiny202", "attiny204", "attiny212",
16844 "attiny214", "attiny402", "attiny404", "attiny406",
16845 "attiny412", "attiny414", "attiny416", "attiny417",
16846 "attiny804", "attiny806", "attiny807", "attiny814",
16847 "attiny816", "attiny817", "attiny1604", "attiny1606",
16848 "attiny1607", "attiny1614", "attiny1616", "attiny1617",
16849 "attiny3214", "attiny3216", "attiny3217", "atmega808",
16850 "atmega809", "atmega1608", "atmega1609", "atmega3208",
16851 "atmega3209", "atmega4808", "atmega4809".
16852
16853 "avrxmega4"
16854 "XMEGA" devices with more than 64 KiB and up to 128 KiB of
16855 program memory. mcu = "atxmega64a3", "atxmega64a3u",
16856 "atxmega64a4u", "atxmega64b1", "atxmega64b3", "atxmega64c3",
16857 "atxmega64d3", "atxmega64d4".
16858
16859 "avrxmega5"
16860 "XMEGA" devices with more than 64 KiB and up to 128 KiB of
16861 program memory and more than 64 KiB of RAM. mcu =
16862 "atxmega64a1", "atxmega64a1u".
16863
16864 "avrxmega6"
16865 "XMEGA" devices with more than 128 KiB of program memory. mcu
16866 = "atxmega128a3", "atxmega128a3u", "atxmega128b1",
16867 "atxmega128b3", "atxmega128c3", "atxmega128d3", "atxmega128d4",
16868 "atxmega192a3", "atxmega192a3u", "atxmega192c3",
16869 "atxmega192d3", "atxmega256a3", "atxmega256a3b",
16870 "atxmega256a3bu", "atxmega256a3u", "atxmega256c3",
16871 "atxmega256d3", "atxmega384c3", "atxmega384d3".
16872
16873 "avrxmega7"
16874 "XMEGA" devices with more than 128 KiB of program memory and
16875 more than 64 KiB of RAM. mcu = "atxmega128a1",
16876 "atxmega128a1u", "atxmega128a4u".
16877
16878 "avrtiny"
16879 "TINY" Tiny core devices with 512 B up to 4 KiB of program
16880 memory. mcu = "attiny4", "attiny5", "attiny9", "attiny10",
16881 "attiny20", "attiny40".
16882
16883 "avr1"
16884 This ISA is implemented by the minimal AVR core and supported
16885 for assembler only. mcu = "attiny11", "attiny12", "attiny15",
16886 "attiny28", "at90s1200".
16887
16888 -mabsdata
16889 Assume that all data in static storage can be accessed by LDS / STS
16890 instructions. This option has only an effect on reduced Tiny
16891 devices like ATtiny40. See also the "absdata" AVR Variable
16892 Attributes,variable attribute.
16893
16894 -maccumulate-args
16895 Accumulate outgoing function arguments and acquire/release the
16896 needed stack space for outgoing function arguments once in function
16897 prologue/epilogue. Without this option, outgoing arguments are
16898 pushed before calling a function and popped afterwards.
16899
16900 Popping the arguments after the function call can be expensive on
16901 AVR so that accumulating the stack space might lead to smaller
16902 executables because arguments need not be removed from the stack
16903 after such a function call.
16904
16905 This option can lead to reduced code size for functions that
16906 perform several calls to functions that get their arguments on the
16907 stack like calls to printf-like functions.
16908
16909 -mbranch-cost=cost
16910 Set the branch costs for conditional branch instructions to cost.
16911 Reasonable values for cost are small, non-negative integers. The
16912 default branch cost is 0.
16913
16914 -mcall-prologues
16915 Functions prologues/epilogues are expanded as calls to appropriate
16916 subroutines. Code size is smaller.
16917
16918 -mdouble=bits
16919 -mlong-double=bits
16920 Set the size (in bits) of the "double" or "long double" type,
16921 respectively. Possible values for bits are 32 and 64. Whether or
16922 not a specific value for bits is allowed depends on the
16923 "--with-double=" and "--with-long-double=" configure options
16924 ("https://gcc.gnu.org/install/configure.html#avr"), and the same
16925 applies for the default values of the options.
16926
16927 -mgas-isr-prologues
16928 Interrupt service routines (ISRs) may use the "__gcc_isr" pseudo
16929 instruction supported by GNU Binutils. If this option is on, the
16930 feature can still be disabled for individual ISRs by means of the
16931 AVR Function Attributes,,"no_gccisr" function attribute. This
16932 feature is activated per default if optimization is on (but not
16933 with -Og, @pxref{Optimize Options}), and if GNU Binutils support
16934 PR21683 ("https://sourceware.org/PR21683").
16935
16936 -mint8
16937 Assume "int" to be 8-bit integer. This affects the sizes of all
16938 types: a "char" is 1 byte, an "int" is 1 byte, a "long" is 2 bytes,
16939 and "long long" is 4 bytes. Please note that this option does not
16940 conform to the C standards, but it results in smaller code size.
16941
16942 -mmain-is-OS_task
16943 Do not save registers in "main". The effect is the same like
16944 attaching attribute AVR Function Attributes,,"OS_task" to "main".
16945 It is activated per default if optimization is on.
16946
16947 -mn-flash=num
16948 Assume that the flash memory has a size of num times 64 KiB.
16949
16950 -mno-interrupts
16951 Generated code is not compatible with hardware interrupts. Code
16952 size is smaller.
16953
16954 -mrelax
16955 Try to replace "CALL" resp. "JMP" instruction by the shorter
16956 "RCALL" resp. "RJMP" instruction if applicable. Setting -mrelax
16957 just adds the --mlink-relax option to the assembler's command line
16958 and the --relax option to the linker's command line.
16959
16960 Jump relaxing is performed by the linker because jump offsets are
16961 not known before code is located. Therefore, the assembler code
16962 generated by the compiler is the same, but the instructions in the
16963 executable may differ from instructions in the assembler code.
16964
16965 Relaxing must be turned on if linker stubs are needed, see the
16966 section on "EIND" and linker stubs below.
16967
16968 -mrmw
16969 Assume that the device supports the Read-Modify-Write instructions
16970 "XCH", "LAC", "LAS" and "LAT".
16971
16972 -mshort-calls
16973 Assume that "RJMP" and "RCALL" can target the whole program memory.
16974
16975 This option is used internally for multilib selection. It is not
16976 an optimization option, and you don't need to set it by hand.
16977
16978 -msp8
16979 Treat the stack pointer register as an 8-bit register, i.e. assume
16980 the high byte of the stack pointer is zero. In general, you don't
16981 need to set this option by hand.
16982
16983 This option is used internally by the compiler to select and build
16984 multilibs for architectures "avr2" and "avr25". These
16985 architectures mix devices with and without "SPH". For any setting
16986 other than -mmcu=avr2 or -mmcu=avr25 the compiler driver adds or
16987 removes this option from the compiler proper's command line,
16988 because the compiler then knows if the device or architecture has
16989 an 8-bit stack pointer and thus no "SPH" register or not.
16990
16991 -mstrict-X
16992 Use address register "X" in a way proposed by the hardware. This
16993 means that "X" is only used in indirect, post-increment or pre-
16994 decrement addressing.
16995
16996 Without this option, the "X" register may be used in the same way
16997 as "Y" or "Z" which then is emulated by additional instructions.
16998 For example, loading a value with "X+const" addressing with a small
16999 non-negative "const < 64" to a register Rn is performed as
17000
17001 adiw r26, const ; X += const
17002 ld <Rn>, X ; <Rn> = *X
17003 sbiw r26, const ; X -= const
17004
17005 -mtiny-stack
17006 Only change the lower 8 bits of the stack pointer.
17007
17008 -mfract-convert-truncate
17009 Allow to use truncation instead of rounding towards zero for
17010 fractional fixed-point types.
17011
17012 -nodevicelib
17013 Don't link against AVR-LibC's device specific library "lib<mcu>.a".
17014
17015 -nodevicespecs
17016 Don't add -specs=device-specs/specs-mcu to the compiler driver's
17017 command line. The user takes responsibility for supplying the sub-
17018 processes like compiler proper, assembler and linker with
17019 appropriate command line options. This means that the user has to
17020 supply her private device specs file by means of -specs=path-to-
17021 specs-file. There is no more need for option -mmcu=mcu.
17022
17023 This option can also serve as a replacement for the older way of
17024 specifying custom device-specs files that needed -B some-path to
17025 point to a directory which contains a folder named "device-specs"
17026 which contains a specs file named "specs-mcu", where mcu was
17027 specified by -mmcu=mcu.
17028
17029 -Waddr-space-convert
17030 Warn about conversions between address spaces in the case where the
17031 resulting address space is not contained in the incoming address
17032 space.
17033
17034 -Wmisspelled-isr
17035 Warn if the ISR is misspelled, i.e. without __vector prefix.
17036 Enabled by default.
17037
17038 "EIND" and Devices with More Than 128 Ki Bytes of Flash
17039
17040 Pointers in the implementation are 16 bits wide. The address of a
17041 function or label is represented as word address so that indirect jumps
17042 and calls can target any code address in the range of 64 Ki words.
17043
17044 In order to facilitate indirect jump on devices with more than 128 Ki
17045 bytes of program memory space, there is a special function register
17046 called "EIND" that serves as most significant part of the target
17047 address when "EICALL" or "EIJMP" instructions are used.
17048
17049 Indirect jumps and calls on these devices are handled as follows by the
17050 compiler and are subject to some limitations:
17051
17052 * The compiler never sets "EIND".
17053
17054 * The compiler uses "EIND" implicitly in "EICALL"/"EIJMP"
17055 instructions or might read "EIND" directly in order to emulate an
17056 indirect call/jump by means of a "RET" instruction.
17057
17058 * The compiler assumes that "EIND" never changes during the startup
17059 code or during the application. In particular, "EIND" is not
17060 saved/restored in function or interrupt service routine
17061 prologue/epilogue.
17062
17063 * For indirect calls to functions and computed goto, the linker
17064 generates stubs. Stubs are jump pads sometimes also called
17065 trampolines. Thus, the indirect call/jump jumps to such a stub.
17066 The stub contains a direct jump to the desired address.
17067
17068 * Linker relaxation must be turned on so that the linker generates
17069 the stubs correctly in all situations. See the compiler option
17070 -mrelax and the linker option --relax. There are corner cases
17071 where the linker is supposed to generate stubs but aborts without
17072 relaxation and without a helpful error message.
17073
17074 * The default linker script is arranged for code with "EIND = 0". If
17075 code is supposed to work for a setup with "EIND != 0", a custom
17076 linker script has to be used in order to place the sections whose
17077 name start with ".trampolines" into the segment where "EIND" points
17078 to.
17079
17080 * The startup code from libgcc never sets "EIND". Notice that
17081 startup code is a blend of code from libgcc and AVR-LibC. For the
17082 impact of AVR-LibC on "EIND", see the AVR-LibC user manual
17083 ("http://nongnu.org/avr-libc/user-manual/").
17084
17085 * It is legitimate for user-specific startup code to set up "EIND"
17086 early, for example by means of initialization code located in
17087 section ".init3". Such code runs prior to general startup code that
17088 initializes RAM and calls constructors, but after the bit of
17089 startup code from AVR-LibC that sets "EIND" to the segment where
17090 the vector table is located.
17091
17092 #include <avr/io.h>
17093
17094 static void
17095 __attribute__((section(".init3"),naked,used,no_instrument_function))
17096 init3_set_eind (void)
17097 {
17098 __asm volatile ("ldi r24,pm_hh8(__trampolines_start)\n\t"
17099 "out %i0,r24" :: "n" (&EIND) : "r24","memory");
17100 }
17101
17102 The "__trampolines_start" symbol is defined in the linker script.
17103
17104 * Stubs are generated automatically by the linker if the following
17105 two conditions are met:
17106
17107 -<The address of a label is taken by means of the "gs" modifier>
17108 (short for generate stubs) like so:
17109
17110 LDI r24, lo8(gs(<func>))
17111 LDI r25, hi8(gs(<func>))
17112
17113 -<The final location of that label is in a code segment>
17114 outside the segment where the stubs are located.
17115
17116 * The compiler emits such "gs" modifiers for code labels in the
17117 following situations:
17118
17119 -<Taking address of a function or code label.>
17120 -<Computed goto.>
17121 -<If prologue-save function is used, see -mcall-prologues>
17122 command-line option.
17123
17124 -<Switch/case dispatch tables. If you do not want such dispatch>
17125 tables you can specify the -fno-jump-tables command-line
17126 option.
17127
17128 -<C and C++ constructors/destructors called during
17129 startup/shutdown.>
17130 -<If the tools hit a "gs()" modifier explained above.>
17131 * Jumping to non-symbolic addresses like so is not supported:
17132
17133 int main (void)
17134 {
17135 /* Call function at word address 0x2 */
17136 return ((int(*)(void)) 0x2)();
17137 }
17138
17139 Instead, a stub has to be set up, i.e. the function has to be
17140 called through a symbol ("func_4" in the example):
17141
17142 int main (void)
17143 {
17144 extern int func_4 (void);
17145
17146 /* Call function at byte address 0x4 */
17147 return func_4();
17148 }
17149
17150 and the application be linked with -Wl,--defsym,func_4=0x4.
17151 Alternatively, "func_4" can be defined in the linker script.
17152
17153 Handling of the "RAMPD", "RAMPX", "RAMPY" and "RAMPZ" Special Function
17154 Registers
17155
17156 Some AVR devices support memories larger than the 64 KiB range that can
17157 be accessed with 16-bit pointers. To access memory locations outside
17158 this 64 KiB range, the content of a "RAMP" register is used as high
17159 part of the address: The "X", "Y", "Z" address register is concatenated
17160 with the "RAMPX", "RAMPY", "RAMPZ" special function register,
17161 respectively, to get a wide address. Similarly, "RAMPD" is used
17162 together with direct addressing.
17163
17164 * The startup code initializes the "RAMP" special function registers
17165 with zero.
17166
17167 * If a AVR Named Address Spaces,named address space other than
17168 generic or "__flash" is used, then "RAMPZ" is set as needed before
17169 the operation.
17170
17171 * If the device supports RAM larger than 64 KiB and the compiler
17172 needs to change "RAMPZ" to accomplish an operation, "RAMPZ" is
17173 reset to zero after the operation.
17174
17175 * If the device comes with a specific "RAMP" register, the ISR
17176 prologue/epilogue saves/restores that SFR and initializes it with
17177 zero in case the ISR code might (implicitly) use it.
17178
17179 * RAM larger than 64 KiB is not supported by GCC for AVR targets. If
17180 you use inline assembler to read from locations outside the 16-bit
17181 address range and change one of the "RAMP" registers, you must
17182 reset it to zero after the access.
17183
17184 AVR Built-in Macros
17185
17186 GCC defines several built-in macros so that the user code can test for
17187 the presence or absence of features. Almost any of the following
17188 built-in macros are deduced from device capabilities and thus triggered
17189 by the -mmcu= command-line option.
17190
17191 For even more AVR-specific built-in macros see AVR Named Address Spaces
17192 and AVR Built-in Functions.
17193
17194 "__AVR_ARCH__"
17195 Build-in macro that resolves to a decimal number that identifies
17196 the architecture and depends on the -mmcu=mcu option. Possible
17197 values are:
17198
17199 2, 25, 3, 31, 35, 4, 5, 51, 6
17200
17201 for mcu="avr2", "avr25", "avr3", "avr31", "avr35", "avr4", "avr5",
17202 "avr51", "avr6",
17203
17204 respectively and
17205
17206 100, 102, 103, 104, 105, 106, 107
17207
17208 for mcu="avrtiny", "avrxmega2", "avrxmega3", "avrxmega4",
17209 "avrxmega5", "avrxmega6", "avrxmega7", respectively. If mcu
17210 specifies a device, this built-in macro is set accordingly. For
17211 example, with -mmcu=atmega8 the macro is defined to 4.
17212
17213 "__AVR_Device__"
17214 Setting -mmcu=device defines this built-in macro which reflects the
17215 device's name. For example, -mmcu=atmega8 defines the built-in
17216 macro "__AVR_ATmega8__", -mmcu=attiny261a defines
17217 "__AVR_ATtiny261A__", etc.
17218
17219 The built-in macros' names follow the scheme "__AVR_Device__" where
17220 Device is the device name as from the AVR user manual. The
17221 difference between Device in the built-in macro and device in
17222 -mmcu=device is that the latter is always lowercase.
17223
17224 If device is not a device but only a core architecture like avr51,
17225 this macro is not defined.
17226
17227 "__AVR_DEVICE_NAME__"
17228 Setting -mmcu=device defines this built-in macro to the device's
17229 name. For example, with -mmcu=atmega8 the macro is defined to
17230 "atmega8".
17231
17232 If device is not a device but only a core architecture like avr51,
17233 this macro is not defined.
17234
17235 "__AVR_XMEGA__"
17236 The device / architecture belongs to the XMEGA family of devices.
17237
17238 "__AVR_HAVE_ELPM__"
17239 The device has the "ELPM" instruction.
17240
17241 "__AVR_HAVE_ELPMX__"
17242 The device has the "ELPM Rn,Z" and "ELPM Rn,Z+" instructions.
17243
17244 "__AVR_HAVE_MOVW__"
17245 The device has the "MOVW" instruction to perform 16-bit register-
17246 register moves.
17247
17248 "__AVR_HAVE_LPMX__"
17249 The device has the "LPM Rn,Z" and "LPM Rn,Z+" instructions.
17250
17251 "__AVR_HAVE_MUL__"
17252 The device has a hardware multiplier.
17253
17254 "__AVR_HAVE_JMP_CALL__"
17255 The device has the "JMP" and "CALL" instructions. This is the case
17256 for devices with more than 8 KiB of program memory.
17257
17258 "__AVR_HAVE_EIJMP_EICALL__"
17259 "__AVR_3_BYTE_PC__"
17260 The device has the "EIJMP" and "EICALL" instructions. This is the
17261 case for devices with more than 128 KiB of program memory. This
17262 also means that the program counter (PC) is 3 bytes wide.
17263
17264 "__AVR_2_BYTE_PC__"
17265 The program counter (PC) is 2 bytes wide. This is the case for
17266 devices with up to 128 KiB of program memory.
17267
17268 "__AVR_HAVE_8BIT_SP__"
17269 "__AVR_HAVE_16BIT_SP__"
17270 The stack pointer (SP) register is treated as 8-bit respectively
17271 16-bit register by the compiler. The definition of these macros is
17272 affected by -mtiny-stack.
17273
17274 "__AVR_HAVE_SPH__"
17275 "__AVR_SP8__"
17276 The device has the SPH (high part of stack pointer) special
17277 function register or has an 8-bit stack pointer, respectively. The
17278 definition of these macros is affected by -mmcu= and in the cases
17279 of -mmcu=avr2 and -mmcu=avr25 also by -msp8.
17280
17281 "__AVR_HAVE_RAMPD__"
17282 "__AVR_HAVE_RAMPX__"
17283 "__AVR_HAVE_RAMPY__"
17284 "__AVR_HAVE_RAMPZ__"
17285 The device has the "RAMPD", "RAMPX", "RAMPY", "RAMPZ" special
17286 function register, respectively.
17287
17288 "__NO_INTERRUPTS__"
17289 This macro reflects the -mno-interrupts command-line option.
17290
17291 "__AVR_ERRATA_SKIP__"
17292 "__AVR_ERRATA_SKIP_JMP_CALL__"
17293 Some AVR devices (AT90S8515, ATmega103) must not skip 32-bit
17294 instructions because of a hardware erratum. Skip instructions are
17295 "SBRS", "SBRC", "SBIS", "SBIC" and "CPSE". The second macro is
17296 only defined if "__AVR_HAVE_JMP_CALL__" is also set.
17297
17298 "__AVR_ISA_RMW__"
17299 The device has Read-Modify-Write instructions (XCH, LAC, LAS and
17300 LAT).
17301
17302 "__AVR_SFR_OFFSET__=offset"
17303 Instructions that can address I/O special function registers
17304 directly like "IN", "OUT", "SBI", etc. may use a different address
17305 as if addressed by an instruction to access RAM like "LD" or "STS".
17306 This offset depends on the device architecture and has to be
17307 subtracted from the RAM address in order to get the respective I/O
17308 address.
17309
17310 "__AVR_SHORT_CALLS__"
17311 The -mshort-calls command line option is set.
17312
17313 "__AVR_PM_BASE_ADDRESS__=addr"
17314 Some devices support reading from flash memory by means of "LD*"
17315 instructions. The flash memory is seen in the data address space
17316 at an offset of "__AVR_PM_BASE_ADDRESS__". If this macro is not
17317 defined, this feature is not available. If defined, the address
17318 space is linear and there is no need to put ".rodata" into RAM.
17319 This is handled by the default linker description file, and is
17320 currently available for "avrtiny" and "avrxmega3". Even more
17321 convenient, there is no need to use address spaces like "__flash"
17322 or features like attribute "progmem" and "pgm_read_*".
17323
17324 "__WITH_AVRLIBC__"
17325 The compiler is configured to be used together with AVR-Libc. See
17326 the --with-avrlibc configure option.
17327
17328 "__HAVE_DOUBLE_MULTILIB__"
17329 Defined if -mdouble= acts as a multilib option.
17330
17331 "__HAVE_DOUBLE32__"
17332 "__HAVE_DOUBLE64__"
17333 Defined if the compiler supports 32-bit double resp. 64-bit double.
17334 The actual layout is specified by option -mdouble=.
17335
17336 "__DEFAULT_DOUBLE__"
17337 The size in bits of "double" if -mdouble= is not set. To test the
17338 layout of "double" in a program, use the built-in macro
17339 "__SIZEOF_DOUBLE__".
17340
17341 "__HAVE_LONG_DOUBLE32__"
17342 "__HAVE_LONG_DOUBLE64__"
17343 "__HAVE_LONG_DOUBLE_MULTILIB__"
17344 "__DEFAULT_LONG_DOUBLE__"
17345 Same as above, but for "long double" instead of "double".
17346
17347 "__WITH_DOUBLE_COMPARISON__"
17348 Reflects the "--with-double-comparison={tristate|bool|libf7}"
17349 configure option ("https://gcc.gnu.org/install/configure.html#avr")
17350 and is defined to 2 or 3.
17351
17352 "__WITH_LIBF7_LIBGCC__"
17353 "__WITH_LIBF7_MATH__"
17354 "__WITH_LIBF7_MATH_SYMBOLS__"
17355 Reflects the "--with-libf7={libgcc|math|math-symbols}"
17356 configure option
17357 ("https://gcc.gnu.org/install/configure.html#avr").
17358
17359 Blackfin Options
17360
17361 -mcpu=cpu[-sirevision]
17362 Specifies the name of the target Blackfin processor. Currently,
17363 cpu can be one of bf512, bf514, bf516, bf518, bf522, bf523, bf524,
17364 bf525, bf526, bf527, bf531, bf532, bf533, bf534, bf536, bf537,
17365 bf538, bf539, bf542, bf544, bf547, bf548, bf549, bf542m, bf544m,
17366 bf547m, bf548m, bf549m, bf561, bf592.
17367
17368 The optional sirevision specifies the silicon revision of the
17369 target Blackfin processor. Any workarounds available for the
17370 targeted silicon revision are enabled. If sirevision is none, no
17371 workarounds are enabled. If sirevision is any, all workarounds for
17372 the targeted processor are enabled. The "__SILICON_REVISION__"
17373 macro is defined to two hexadecimal digits representing the major
17374 and minor numbers in the silicon revision. If sirevision is none,
17375 the "__SILICON_REVISION__" is not defined. If sirevision is any,
17376 the "__SILICON_REVISION__" is defined to be 0xffff. If this
17377 optional sirevision is not used, GCC assumes the latest known
17378 silicon revision of the targeted Blackfin processor.
17379
17380 GCC defines a preprocessor macro for the specified cpu. For the
17381 bfin-elf toolchain, this option causes the hardware BSP provided by
17382 libgloss to be linked in if -msim is not given.
17383
17384 Without this option, bf532 is used as the processor by default.
17385
17386 Note that support for bf561 is incomplete. For bf561, only the
17387 preprocessor macro is defined.
17388
17389 -msim
17390 Specifies that the program will be run on the simulator. This
17391 causes the simulator BSP provided by libgloss to be linked in.
17392 This option has effect only for bfin-elf toolchain. Certain other
17393 options, such as -mid-shared-library and -mfdpic, imply -msim.
17394
17395 -momit-leaf-frame-pointer
17396 Don't keep the frame pointer in a register for leaf functions.
17397 This avoids the instructions to save, set up and restore frame
17398 pointers and makes an extra register available in leaf functions.
17399
17400 -mspecld-anomaly
17401 When enabled, the compiler ensures that the generated code does not
17402 contain speculative loads after jump instructions. If this option
17403 is used, "__WORKAROUND_SPECULATIVE_LOADS" is defined.
17404
17405 -mno-specld-anomaly
17406 Don't generate extra code to prevent speculative loads from
17407 occurring.
17408
17409 -mcsync-anomaly
17410 When enabled, the compiler ensures that the generated code does not
17411 contain CSYNC or SSYNC instructions too soon after conditional
17412 branches. If this option is used, "__WORKAROUND_SPECULATIVE_SYNCS"
17413 is defined.
17414
17415 -mno-csync-anomaly
17416 Don't generate extra code to prevent CSYNC or SSYNC instructions
17417 from occurring too soon after a conditional branch.
17418
17419 -mlow64k
17420 When enabled, the compiler is free to take advantage of the
17421 knowledge that the entire program fits into the low 64k of memory.
17422
17423 -mno-low64k
17424 Assume that the program is arbitrarily large. This is the default.
17425
17426 -mstack-check-l1
17427 Do stack checking using information placed into L1 scratchpad
17428 memory by the uClinux kernel.
17429
17430 -mid-shared-library
17431 Generate code that supports shared libraries via the library ID
17432 method. This allows for execute in place and shared libraries in
17433 an environment without virtual memory management. This option
17434 implies -fPIC. With a bfin-elf target, this option implies -msim.
17435
17436 -mno-id-shared-library
17437 Generate code that doesn't assume ID-based shared libraries are
17438 being used. This is the default.
17439
17440 -mleaf-id-shared-library
17441 Generate code that supports shared libraries via the library ID
17442 method, but assumes that this library or executable won't link
17443 against any other ID shared libraries. That allows the compiler to
17444 use faster code for jumps and calls.
17445
17446 -mno-leaf-id-shared-library
17447 Do not assume that the code being compiled won't link against any
17448 ID shared libraries. Slower code is generated for jump and call
17449 insns.
17450
17451 -mshared-library-id=n
17452 Specifies the identification number of the ID-based shared library
17453 being compiled. Specifying a value of 0 generates more compact
17454 code; specifying other values forces the allocation of that number
17455 to the current library but is no more space- or time-efficient than
17456 omitting this option.
17457
17458 -msep-data
17459 Generate code that allows the data segment to be located in a
17460 different area of memory from the text segment. This allows for
17461 execute in place in an environment without virtual memory
17462 management by eliminating relocations against the text section.
17463
17464 -mno-sep-data
17465 Generate code that assumes that the data segment follows the text
17466 segment. This is the default.
17467
17468 -mlong-calls
17469 -mno-long-calls
17470 Tells the compiler to perform function calls by first loading the
17471 address of the function into a register and then performing a
17472 subroutine call on this register. This switch is needed if the
17473 target function lies outside of the 24-bit addressing range of the
17474 offset-based version of subroutine call instruction.
17475
17476 This feature is not enabled by default. Specifying -mno-long-calls
17477 restores the default behavior. Note these switches have no effect
17478 on how the compiler generates code to handle function calls via
17479 function pointers.
17480
17481 -mfast-fp
17482 Link with the fast floating-point library. This library relaxes
17483 some of the IEEE floating-point standard's rules for checking
17484 inputs against Not-a-Number (NAN), in the interest of performance.
17485
17486 -minline-plt
17487 Enable inlining of PLT entries in function calls to functions that
17488 are not known to bind locally. It has no effect without -mfdpic.
17489
17490 -mmulticore
17491 Build a standalone application for multicore Blackfin processors.
17492 This option causes proper start files and link scripts supporting
17493 multicore to be used, and defines the macro "__BFIN_MULTICORE". It
17494 can only be used with -mcpu=bf561[-sirevision].
17495
17496 This option can be used with -mcorea or -mcoreb, which selects the
17497 one-application-per-core programming model. Without -mcorea or
17498 -mcoreb, the single-application/dual-core programming model is
17499 used. In this model, the main function of Core B should be named as
17500 "coreb_main".
17501
17502 If this option is not used, the single-core application programming
17503 model is used.
17504
17505 -mcorea
17506 Build a standalone application for Core A of BF561 when using the
17507 one-application-per-core programming model. Proper start files and
17508 link scripts are used to support Core A, and the macro
17509 "__BFIN_COREA" is defined. This option can only be used in
17510 conjunction with -mmulticore.
17511
17512 -mcoreb
17513 Build a standalone application for Core B of BF561 when using the
17514 one-application-per-core programming model. Proper start files and
17515 link scripts are used to support Core B, and the macro
17516 "__BFIN_COREB" is defined. When this option is used, "coreb_main"
17517 should be used instead of "main". This option can only be used in
17518 conjunction with -mmulticore.
17519
17520 -msdram
17521 Build a standalone application for SDRAM. Proper start files and
17522 link scripts are used to put the application into SDRAM, and the
17523 macro "__BFIN_SDRAM" is defined. The loader should initialize
17524 SDRAM before loading the application.
17525
17526 -micplb
17527 Assume that ICPLBs are enabled at run time. This has an effect on
17528 certain anomaly workarounds. For Linux targets, the default is to
17529 assume ICPLBs are enabled; for standalone applications the default
17530 is off.
17531
17532 C6X Options
17533
17534 -march=name
17535 This specifies the name of the target architecture. GCC uses this
17536 name to determine what kind of instructions it can emit when
17537 generating assembly code. Permissible names are: c62x, c64x,
17538 c64x+, c67x, c67x+, c674x.
17539
17540 -mbig-endian
17541 Generate code for a big-endian target.
17542
17543 -mlittle-endian
17544 Generate code for a little-endian target. This is the default.
17545
17546 -msim
17547 Choose startup files and linker script suitable for the simulator.
17548
17549 -msdata=default
17550 Put small global and static data in the ".neardata" section, which
17551 is pointed to by register "B14". Put small uninitialized global
17552 and static data in the ".bss" section, which is adjacent to the
17553 ".neardata" section. Put small read-only data into the ".rodata"
17554 section. The corresponding sections used for large pieces of data
17555 are ".fardata", ".far" and ".const".
17556
17557 -msdata=all
17558 Put all data, not just small objects, into the sections reserved
17559 for small data, and use addressing relative to the "B14" register
17560 to access them.
17561
17562 -msdata=none
17563 Make no use of the sections reserved for small data, and use
17564 absolute addresses to access all data. Put all initialized global
17565 and static data in the ".fardata" section, and all uninitialized
17566 data in the ".far" section. Put all constant data into the
17567 ".const" section.
17568
17569 CRIS Options
17570
17571 These options are defined specifically for the CRIS ports.
17572
17573 -march=architecture-type
17574 -mcpu=architecture-type
17575 Generate code for the specified architecture. The choices for
17576 architecture-type are v3, v8 and v10 for respectively ETRAX 4,
17577 ETRAX 100, and ETRAX 100 LX. Default is v0 except for cris-axis-
17578 linux-gnu, where the default is v10.
17579
17580 -mtune=architecture-type
17581 Tune to architecture-type everything applicable about the generated
17582 code, except for the ABI and the set of available instructions.
17583 The choices for architecture-type are the same as for
17584 -march=architecture-type.
17585
17586 -mmax-stack-frame=n
17587 Warn when the stack frame of a function exceeds n bytes.
17588
17589 -metrax4
17590 -metrax100
17591 The options -metrax4 and -metrax100 are synonyms for -march=v3 and
17592 -march=v8 respectively.
17593
17594 -mmul-bug-workaround
17595 -mno-mul-bug-workaround
17596 Work around a bug in the "muls" and "mulu" instructions for CPU
17597 models where it applies. This option is active by default.
17598
17599 -mpdebug
17600 Enable CRIS-specific verbose debug-related information in the
17601 assembly code. This option also has the effect of turning off the
17602 #NO_APP formatted-code indicator to the assembler at the beginning
17603 of the assembly file.
17604
17605 -mcc-init
17606 Do not use condition-code results from previous instruction; always
17607 emit compare and test instructions before use of condition codes.
17608
17609 -mno-side-effects
17610 Do not emit instructions with side effects in addressing modes
17611 other than post-increment.
17612
17613 -mstack-align
17614 -mno-stack-align
17615 -mdata-align
17616 -mno-data-align
17617 -mconst-align
17618 -mno-const-align
17619 These options (no- options) arrange (eliminate arrangements) for
17620 the stack frame, individual data and constants to be aligned for
17621 the maximum single data access size for the chosen CPU model. The
17622 default is to arrange for 32-bit alignment. ABI details such as
17623 structure layout are not affected by these options.
17624
17625 -m32-bit
17626 -m16-bit
17627 -m8-bit
17628 Similar to the stack- data- and const-align options above, these
17629 options arrange for stack frame, writable data and constants to all
17630 be 32-bit, 16-bit or 8-bit aligned. The default is 32-bit
17631 alignment.
17632
17633 -mno-prologue-epilogue
17634 -mprologue-epilogue
17635 With -mno-prologue-epilogue, the normal function prologue and
17636 epilogue which set up the stack frame are omitted and no return
17637 instructions or return sequences are generated in the code. Use
17638 this option only together with visual inspection of the compiled
17639 code: no warnings or errors are generated when call-saved registers
17640 must be saved, or storage for local variables needs to be
17641 allocated.
17642
17643 -mno-gotplt
17644 -mgotplt
17645 With -fpic and -fPIC, don't generate (do generate) instruction
17646 sequences that load addresses for functions from the PLT part of
17647 the GOT rather than (traditional on other architectures) calls to
17648 the PLT. The default is -mgotplt.
17649
17650 -melf
17651 Legacy no-op option only recognized with the cris-axis-elf and
17652 cris-axis-linux-gnu targets.
17653
17654 -mlinux
17655 Legacy no-op option only recognized with the cris-axis-linux-gnu
17656 target.
17657
17658 -sim
17659 This option, recognized for the cris-axis-elf, arranges to link
17660 with input-output functions from a simulator library. Code,
17661 initialized data and zero-initialized data are allocated
17662 consecutively.
17663
17664 -sim2
17665 Like -sim, but pass linker options to locate initialized data at
17666 0x40000000 and zero-initialized data at 0x80000000.
17667
17668 CR16 Options
17669
17670 These options are defined specifically for the CR16 ports.
17671
17672 -mmac
17673 Enable the use of multiply-accumulate instructions. Disabled by
17674 default.
17675
17676 -mcr16cplus
17677 -mcr16c
17678 Generate code for CR16C or CR16C+ architecture. CR16C+ architecture
17679 is default.
17680
17681 -msim
17682 Links the library libsim.a which is in compatible with simulator.
17683 Applicable to ELF compiler only.
17684
17685 -mint32
17686 Choose integer type as 32-bit wide.
17687
17688 -mbit-ops
17689 Generates "sbit"/"cbit" instructions for bit manipulations.
17690
17691 -mdata-model=model
17692 Choose a data model. The choices for model are near, far or medium.
17693 medium is default. However, far is not valid with -mcr16c, as the
17694 CR16C architecture does not support the far data model.
17695
17696 C-SKY Options
17697
17698 GCC supports these options when compiling for C-SKY V2 processors.
17699
17700 -march=arch
17701 Specify the C-SKY target architecture. Valid values for arch are:
17702 ck801, ck802, ck803, ck807, and ck810. The default is ck810.
17703
17704 -mcpu=cpu
17705 Specify the C-SKY target processor. Valid values for cpu are:
17706 ck801, ck801t, ck802, ck802t, ck802j, ck803, ck803h, ck803t,
17707 ck803ht, ck803f, ck803fh, ck803e, ck803eh, ck803et, ck803eht,
17708 ck803ef, ck803efh, ck803ft, ck803eft, ck803efht, ck803r1, ck803hr1,
17709 ck803tr1, ck803htr1, ck803fr1, ck803fhr1, ck803er1, ck803ehr1,
17710 ck803etr1, ck803ehtr1, ck803efr1, ck803efhr1, ck803ftr1,
17711 ck803eftr1, ck803efhtr1, ck803s, ck803st, ck803se, ck803sf,
17712 ck803sef, ck803seft, ck807e, ck807ef, ck807, ck807f, ck810e,
17713 ck810et, ck810ef, ck810eft, ck810, ck810v, ck810f, ck810t, ck810fv,
17714 ck810tv, ck810ft, and ck810ftv.
17715
17716 -mbig-endian
17717 -EB
17718 -mlittle-endian
17719 -EL Select big- or little-endian code. The default is little-endian.
17720
17721 -mhard-float
17722 -msoft-float
17723 Select hardware or software floating-point implementations. The
17724 default is soft float.
17725
17726 -mdouble-float
17727 -mno-double-float
17728 When -mhard-float is in effect, enable generation of double-
17729 precision float instructions. This is the default except when
17730 compiling for CK803.
17731
17732 -mfdivdu
17733 -mno-fdivdu
17734 When -mhard-float is in effect, enable generation of "frecipd",
17735 "fsqrtd", and "fdivd" instructions. This is the default except
17736 when compiling for CK803.
17737
17738 -mfpu=fpu
17739 Select the floating-point processor. This option can only be used
17740 with -mhard-float. Values for fpu are fpv2_sf (equivalent to
17741 -mno-double-float -mno-fdivdu), fpv2 (-mdouble-float -mno-divdu),
17742 and fpv2_divd (-mdouble-float -mdivdu).
17743
17744 -melrw
17745 -mno-elrw
17746 Enable the extended "lrw" instruction. This option defaults to on
17747 for CK801 and off otherwise.
17748
17749 -mistack
17750 -mno-istack
17751 Enable interrupt stack instructions; the default is off.
17752
17753 The -mistack option is required to handle the "interrupt" and "isr"
17754 function attributes.
17755
17756 -mmp
17757 Enable multiprocessor instructions; the default is off.
17758
17759 -mcp
17760 Enable coprocessor instructions; the default is off.
17761
17762 -mcache
17763 Enable coprocessor instructions; the default is off.
17764
17765 -msecurity
17766 Enable C-SKY security instructions; the default is off.
17767
17768 -mtrust
17769 Enable C-SKY trust instructions; the default is off.
17770
17771 -mdsp
17772 -medsp
17773 -mvdsp
17774 Enable C-SKY DSP, Enhanced DSP, or Vector DSP instructions,
17775 respectively. All of these options default to off.
17776
17777 -mdiv
17778 -mno-div
17779 Generate divide instructions. Default is off.
17780
17781 -msmart
17782 -mno-smart
17783 Generate code for Smart Mode, using only registers numbered 0-7 to
17784 allow use of 16-bit instructions. This option is ignored for CK801
17785 where this is the required behavior, and it defaults to on for
17786 CK802. For other targets, the default is off.
17787
17788 -mhigh-registers
17789 -mno-high-registers
17790 Generate code using the high registers numbered 16-31. This option
17791 is not supported on CK801, CK802, or CK803, and is enabled by
17792 default for other processors.
17793
17794 -manchor
17795 -mno-anchor
17796 Generate code using global anchor symbol addresses.
17797
17798 -mpushpop
17799 -mno-pushpop
17800 Generate code using "push" and "pop" instructions. This option
17801 defaults to on.
17802
17803 -mmultiple-stld
17804 -mstm
17805 -mno-multiple-stld
17806 -mno-stm
17807 Generate code using "stm" and "ldm" instructions. This option
17808 isn't supported on CK801 but is enabled by default on other
17809 processors.
17810
17811 -mconstpool
17812 -mno-constpool
17813 Create constant pools in the compiler instead of deferring it to
17814 the assembler. This option is the default and required for correct
17815 code generation on CK801 and CK802, and is optional on other
17816 processors.
17817
17818 -mstack-size
17819 -mno-stack-size
17820 Emit ".stack_size" directives for each function in the assembly
17821 output. This option defaults to off.
17822
17823 -mccrt
17824 -mno-ccrt
17825 Generate code for the C-SKY compiler runtime instead of libgcc.
17826 This option defaults to off.
17827
17828 -mbranch-cost=n
17829 Set the branch costs to roughly "n" instructions. The default is
17830 1.
17831
17832 -msched-prolog
17833 -mno-sched-prolog
17834 Permit scheduling of function prologue and epilogue sequences.
17835 Using this option can result in code that is not compliant with the
17836 C-SKY V2 ABI prologue requirements and that cannot be debugged or
17837 backtraced. It is disabled by default.
17838
17839 Darwin Options
17840
17841 These options are defined for all architectures running the Darwin
17842 operating system.
17843
17844 FSF GCC on Darwin does not create "fat" object files; it creates an
17845 object file for the single architecture that GCC was built to target.
17846 Apple's GCC on Darwin does create "fat" files if multiple -arch options
17847 are used; it does so by running the compiler or linker multiple times
17848 and joining the results together with lipo.
17849
17850 The subtype of the file created (like ppc7400 or ppc970 or i686) is
17851 determined by the flags that specify the ISA that GCC is targeting,
17852 like -mcpu or -march. The -force_cpusubtype_ALL option can be used to
17853 override this.
17854
17855 The Darwin tools vary in their behavior when presented with an ISA
17856 mismatch. The assembler, as, only permits instructions to be used that
17857 are valid for the subtype of the file it is generating, so you cannot
17858 put 64-bit instructions in a ppc750 object file. The linker for shared
17859 libraries, /usr/bin/libtool, fails and prints an error if asked to
17860 create a shared library with a less restrictive subtype than its input
17861 files (for instance, trying to put a ppc970 object file in a ppc7400
17862 library). The linker for executables, ld, quietly gives the executable
17863 the most restrictive subtype of any of its input files.
17864
17865 -Fdir
17866 Add the framework directory dir to the head of the list of
17867 directories to be searched for header files. These directories are
17868 interleaved with those specified by -I options and are scanned in a
17869 left-to-right order.
17870
17871 A framework directory is a directory with frameworks in it. A
17872 framework is a directory with a Headers and/or PrivateHeaders
17873 directory contained directly in it that ends in .framework. The
17874 name of a framework is the name of this directory excluding the
17875 .framework. Headers associated with the framework are found in one
17876 of those two directories, with Headers being searched first. A
17877 subframework is a framework directory that is in a framework's
17878 Frameworks directory. Includes of subframework headers can only
17879 appear in a header of a framework that contains the subframework,
17880 or in a sibling subframework header. Two subframeworks are
17881 siblings if they occur in the same framework. A subframework
17882 should not have the same name as a framework; a warning is issued
17883 if this is violated. Currently a subframework cannot have
17884 subframeworks; in the future, the mechanism may be extended to
17885 support this. The standard frameworks can be found in
17886 /System/Library/Frameworks and /Library/Frameworks. An example
17887 include looks like "#include <Framework/header.h>", where Framework
17888 denotes the name of the framework and header.h is found in the
17889 PrivateHeaders or Headers directory.
17890
17891 -iframeworkdir
17892 Like -F except the directory is a treated as a system directory.
17893 The main difference between this -iframework and -F is that with
17894 -iframework the compiler does not warn about constructs contained
17895 within header files found via dir. This option is valid only for
17896 the C family of languages.
17897
17898 -gused
17899 Emit debugging information for symbols that are used. For stabs
17900 debugging format, this enables -feliminate-unused-debug-symbols.
17901 This is by default ON.
17902
17903 -gfull
17904 Emit debugging information for all symbols and types.
17905
17906 -mmacosx-version-min=version
17907 The earliest version of MacOS X that this executable will run on is
17908 version. Typical values of version include 10.1, 10.2, and 10.3.9.
17909
17910 If the compiler was built to use the system's headers by default,
17911 then the default for this option is the system version on which the
17912 compiler is running, otherwise the default is to make choices that
17913 are compatible with as many systems and code bases as possible.
17914
17915 -mkernel
17916 Enable kernel development mode. The -mkernel option sets -static,
17917 -fno-common, -fno-use-cxa-atexit, -fno-exceptions,
17918 -fno-non-call-exceptions, -fapple-kext, -fno-weak and -fno-rtti
17919 where applicable. This mode also sets -mno-altivec, -msoft-float,
17920 -fno-builtin and -mlong-branch for PowerPC targets.
17921
17922 -mone-byte-bool
17923 Override the defaults for "bool" so that "sizeof(bool)==1". By
17924 default "sizeof(bool)" is 4 when compiling for Darwin/PowerPC and 1
17925 when compiling for Darwin/x86, so this option has no effect on x86.
17926
17927 Warning: The -mone-byte-bool switch causes GCC to generate code
17928 that is not binary compatible with code generated without that
17929 switch. Using this switch may require recompiling all other
17930 modules in a program, including system libraries. Use this switch
17931 to conform to a non-default data model.
17932
17933 -mfix-and-continue
17934 -ffix-and-continue
17935 -findirect-data
17936 Generate code suitable for fast turnaround development, such as to
17937 allow GDB to dynamically load .o files into already-running
17938 programs. -findirect-data and -ffix-and-continue are provided for
17939 backwards compatibility.
17940
17941 -all_load
17942 Loads all members of static archive libraries. See man ld(1) for
17943 more information.
17944
17945 -arch_errors_fatal
17946 Cause the errors having to do with files that have the wrong
17947 architecture to be fatal.
17948
17949 -bind_at_load
17950 Causes the output file to be marked such that the dynamic linker
17951 will bind all undefined references when the file is loaded or
17952 launched.
17953
17954 -bundle
17955 Produce a Mach-o bundle format file. See man ld(1) for more
17956 information.
17957
17958 -bundle_loader executable
17959 This option specifies the executable that will load the build
17960 output file being linked. See man ld(1) for more information.
17961
17962 -dynamiclib
17963 When passed this option, GCC produces a dynamic library instead of
17964 an executable when linking, using the Darwin libtool command.
17965
17966 -force_cpusubtype_ALL
17967 This causes GCC's output file to have the ALL subtype, instead of
17968 one controlled by the -mcpu or -march option.
17969
17970 -allowable_client client_name
17971 -client_name
17972 -compatibility_version
17973 -current_version
17974 -dead_strip
17975 -dependency-file
17976 -dylib_file
17977 -dylinker_install_name
17978 -dynamic
17979 -exported_symbols_list
17980 -filelist
17981 -flat_namespace
17982 -force_flat_namespace
17983 -headerpad_max_install_names
17984 -image_base
17985 -init
17986 -install_name
17987 -keep_private_externs
17988 -multi_module
17989 -multiply_defined
17990 -multiply_defined_unused
17991 -noall_load
17992 -no_dead_strip_inits_and_terms
17993 -nofixprebinding
17994 -nomultidefs
17995 -noprebind
17996 -noseglinkedit
17997 -pagezero_size
17998 -prebind
17999 -prebind_all_twolevel_modules
18000 -private_bundle
18001 -read_only_relocs
18002 -sectalign
18003 -sectobjectsymbols
18004 -whyload
18005 -seg1addr
18006 -sectcreate
18007 -sectobjectsymbols
18008 -sectorder
18009 -segaddr
18010 -segs_read_only_addr
18011 -segs_read_write_addr
18012 -seg_addr_table
18013 -seg_addr_table_filename
18014 -seglinkedit
18015 -segprot
18016 -segs_read_only_addr
18017 -segs_read_write_addr
18018 -single_module
18019 -static
18020 -sub_library
18021 -sub_umbrella
18022 -twolevel_namespace
18023 -umbrella
18024 -undefined
18025 -unexported_symbols_list
18026 -weak_reference_mismatches
18027 -whatsloaded
18028 These options are passed to the Darwin linker. The Darwin linker
18029 man page describes them in detail.
18030
18031 DEC Alpha Options
18032
18033 These -m options are defined for the DEC Alpha implementations:
18034
18035 -mno-soft-float
18036 -msoft-float
18037 Use (do not use) the hardware floating-point instructions for
18038 floating-point operations. When -msoft-float is specified,
18039 functions in libgcc.a are used to perform floating-point
18040 operations. Unless they are replaced by routines that emulate the
18041 floating-point operations, or compiled in such a way as to call
18042 such emulations routines, these routines issue floating-point
18043 operations. If you are compiling for an Alpha without floating-
18044 point operations, you must ensure that the library is built so as
18045 not to call them.
18046
18047 Note that Alpha implementations without floating-point operations
18048 are required to have floating-point registers.
18049
18050 -mfp-reg
18051 -mno-fp-regs
18052 Generate code that uses (does not use) the floating-point register
18053 set. -mno-fp-regs implies -msoft-float. If the floating-point
18054 register set is not used, floating-point operands are passed in
18055 integer registers as if they were integers and floating-point
18056 results are passed in $0 instead of $f0. This is a non-standard
18057 calling sequence, so any function with a floating-point argument or
18058 return value called by code compiled with -mno-fp-regs must also be
18059 compiled with that option.
18060
18061 A typical use of this option is building a kernel that does not
18062 use, and hence need not save and restore, any floating-point
18063 registers.
18064
18065 -mieee
18066 The Alpha architecture implements floating-point hardware optimized
18067 for maximum performance. It is mostly compliant with the IEEE
18068 floating-point standard. However, for full compliance, software
18069 assistance is required. This option generates code fully IEEE-
18070 compliant code except that the inexact-flag is not maintained (see
18071 below). If this option is turned on, the preprocessor macro
18072 "_IEEE_FP" is defined during compilation. The resulting code is
18073 less efficient but is able to correctly support denormalized
18074 numbers and exceptional IEEE values such as not-a-number and
18075 plus/minus infinity. Other Alpha compilers call this option
18076 -ieee_with_no_inexact.
18077
18078 -mieee-with-inexact
18079 This is like -mieee except the generated code also maintains the
18080 IEEE inexact-flag. Turning on this option causes the generated
18081 code to implement fully-compliant IEEE math. In addition to
18082 "_IEEE_FP", "_IEEE_FP_EXACT" is defined as a preprocessor macro.
18083 On some Alpha implementations the resulting code may execute
18084 significantly slower than the code generated by default. Since
18085 there is very little code that depends on the inexact-flag, you
18086 should normally not specify this option. Other Alpha compilers
18087 call this option -ieee_with_inexact.
18088
18089 -mfp-trap-mode=trap-mode
18090 This option controls what floating-point related traps are enabled.
18091 Other Alpha compilers call this option -fptm trap-mode. The trap
18092 mode can be set to one of four values:
18093
18094 n This is the default (normal) setting. The only traps that are
18095 enabled are the ones that cannot be disabled in software (e.g.,
18096 division by zero trap).
18097
18098 u In addition to the traps enabled by n, underflow traps are
18099 enabled as well.
18100
18101 su Like u, but the instructions are marked to be safe for software
18102 completion (see Alpha architecture manual for details).
18103
18104 sui Like su, but inexact traps are enabled as well.
18105
18106 -mfp-rounding-mode=rounding-mode
18107 Selects the IEEE rounding mode. Other Alpha compilers call this
18108 option -fprm rounding-mode. The rounding-mode can be one of:
18109
18110 n Normal IEEE rounding mode. Floating-point numbers are rounded
18111 towards the nearest machine number or towards the even machine
18112 number in case of a tie.
18113
18114 m Round towards minus infinity.
18115
18116 c Chopped rounding mode. Floating-point numbers are rounded
18117 towards zero.
18118
18119 d Dynamic rounding mode. A field in the floating-point control
18120 register (fpcr, see Alpha architecture reference manual)
18121 controls the rounding mode in effect. The C library
18122 initializes this register for rounding towards plus infinity.
18123 Thus, unless your program modifies the fpcr, d corresponds to
18124 round towards plus infinity.
18125
18126 -mtrap-precision=trap-precision
18127 In the Alpha architecture, floating-point traps are imprecise.
18128 This means without software assistance it is impossible to recover
18129 from a floating trap and program execution normally needs to be
18130 terminated. GCC can generate code that can assist operating system
18131 trap handlers in determining the exact location that caused a
18132 floating-point trap. Depending on the requirements of an
18133 application, different levels of precisions can be selected:
18134
18135 p Program precision. This option is the default and means a trap
18136 handler can only identify which program caused a floating-point
18137 exception.
18138
18139 f Function precision. The trap handler can determine the
18140 function that caused a floating-point exception.
18141
18142 i Instruction precision. The trap handler can determine the
18143 exact instruction that caused a floating-point exception.
18144
18145 Other Alpha compilers provide the equivalent options called
18146 -scope_safe and -resumption_safe.
18147
18148 -mieee-conformant
18149 This option marks the generated code as IEEE conformant. You must
18150 not use this option unless you also specify -mtrap-precision=i and
18151 either -mfp-trap-mode=su or -mfp-trap-mode=sui. Its only effect is
18152 to emit the line .eflag 48 in the function prologue of the
18153 generated assembly file.
18154
18155 -mbuild-constants
18156 Normally GCC examines a 32- or 64-bit integer constant to see if it
18157 can construct it from smaller constants in two or three
18158 instructions. If it cannot, it outputs the constant as a literal
18159 and generates code to load it from the data segment at run time.
18160
18161 Use this option to require GCC to construct all integer constants
18162 using code, even if it takes more instructions (the maximum is
18163 six).
18164
18165 You typically use this option to build a shared library dynamic
18166 loader. Itself a shared library, it must relocate itself in memory
18167 before it can find the variables and constants in its own data
18168 segment.
18169
18170 -mbwx
18171 -mno-bwx
18172 -mcix
18173 -mno-cix
18174 -mfix
18175 -mno-fix
18176 -mmax
18177 -mno-max
18178 Indicate whether GCC should generate code to use the optional BWX,
18179 CIX, FIX and MAX instruction sets. The default is to use the
18180 instruction sets supported by the CPU type specified via -mcpu=
18181 option or that of the CPU on which GCC was built if none is
18182 specified.
18183
18184 -mfloat-vax
18185 -mfloat-ieee
18186 Generate code that uses (does not use) VAX F and G floating-point
18187 arithmetic instead of IEEE single and double precision.
18188
18189 -mexplicit-relocs
18190 -mno-explicit-relocs
18191 Older Alpha assemblers provided no way to generate symbol
18192 relocations except via assembler macros. Use of these macros does
18193 not allow optimal instruction scheduling. GNU binutils as of
18194 version 2.12 supports a new syntax that allows the compiler to
18195 explicitly mark which relocations should apply to which
18196 instructions. This option is mostly useful for debugging, as GCC
18197 detects the capabilities of the assembler when it is built and sets
18198 the default accordingly.
18199
18200 -msmall-data
18201 -mlarge-data
18202 When -mexplicit-relocs is in effect, static data is accessed via
18203 gp-relative relocations. When -msmall-data is used, objects 8
18204 bytes long or smaller are placed in a small data area (the ".sdata"
18205 and ".sbss" sections) and are accessed via 16-bit relocations off
18206 of the $gp register. This limits the size of the small data area
18207 to 64KB, but allows the variables to be directly accessed via a
18208 single instruction.
18209
18210 The default is -mlarge-data. With this option the data area is
18211 limited to just below 2GB. Programs that require more than 2GB of
18212 data must use "malloc" or "mmap" to allocate the data in the heap
18213 instead of in the program's data segment.
18214
18215 When generating code for shared libraries, -fpic implies
18216 -msmall-data and -fPIC implies -mlarge-data.
18217
18218 -msmall-text
18219 -mlarge-text
18220 When -msmall-text is used, the compiler assumes that the code of
18221 the entire program (or shared library) fits in 4MB, and is thus
18222 reachable with a branch instruction. When -msmall-data is used,
18223 the compiler can assume that all local symbols share the same $gp
18224 value, and thus reduce the number of instructions required for a
18225 function call from 4 to 1.
18226
18227 The default is -mlarge-text.
18228
18229 -mcpu=cpu_type
18230 Set the instruction set and instruction scheduling parameters for
18231 machine type cpu_type. You can specify either the EV style name or
18232 the corresponding chip number. GCC supports scheduling parameters
18233 for the EV4, EV5 and EV6 family of processors and chooses the
18234 default values for the instruction set from the processor you
18235 specify. If you do not specify a processor type, GCC defaults to
18236 the processor on which the compiler was built.
18237
18238 Supported values for cpu_type are
18239
18240 ev4
18241 ev45
18242 21064
18243 Schedules as an EV4 and has no instruction set extensions.
18244
18245 ev5
18246 21164
18247 Schedules as an EV5 and has no instruction set extensions.
18248
18249 ev56
18250 21164a
18251 Schedules as an EV5 and supports the BWX extension.
18252
18253 pca56
18254 21164pc
18255 21164PC
18256 Schedules as an EV5 and supports the BWX and MAX extensions.
18257
18258 ev6
18259 21264
18260 Schedules as an EV6 and supports the BWX, FIX, and MAX
18261 extensions.
18262
18263 ev67
18264 21264a
18265 Schedules as an EV6 and supports the BWX, CIX, FIX, and MAX
18266 extensions.
18267
18268 Native toolchains also support the value native, which selects the
18269 best architecture option for the host processor. -mcpu=native has
18270 no effect if GCC does not recognize the processor.
18271
18272 -mtune=cpu_type
18273 Set only the instruction scheduling parameters for machine type
18274 cpu_type. The instruction set is not changed.
18275
18276 Native toolchains also support the value native, which selects the
18277 best architecture option for the host processor. -mtune=native has
18278 no effect if GCC does not recognize the processor.
18279
18280 -mmemory-latency=time
18281 Sets the latency the scheduler should assume for typical memory
18282 references as seen by the application. This number is highly
18283 dependent on the memory access patterns used by the application and
18284 the size of the external cache on the machine.
18285
18286 Valid options for time are
18287
18288 number
18289 A decimal number representing clock cycles.
18290
18291 L1
18292 L2
18293 L3
18294 main
18295 The compiler contains estimates of the number of clock cycles
18296 for "typical" EV4 & EV5 hardware for the Level 1, 2 & 3 caches
18297 (also called Dcache, Scache, and Bcache), as well as to main
18298 memory. Note that L3 is only valid for EV5.
18299
18300 eBPF Options
18301
18302 -mframe-limit=bytes
18303 This specifies the hard limit for frame sizes, in bytes.
18304 Currently, the value that can be specified should be less than or
18305 equal to 32767. Defaults to whatever limit is imposed by the
18306 version of the Linux kernel targeted.
18307
18308 -mkernel=version
18309 This specifies the minimum version of the kernel that will run the
18310 compiled program. GCC uses this version to determine which
18311 instructions to use, what kernel helpers to allow, etc. Currently,
18312 version can be one of 4.0, 4.1, 4.2, 4.3, 4.4, 4.5, 4.6, 4.7, 4.8,
18313 4.9, 4.10, 4.11, 4.12, 4.13, 4.14, 4.15, 4.16, 4.17, 4.18, 4.19,
18314 4.20, 5.0, 5.1, 5.2, latest and native.
18315
18316 -mbig-endian
18317 Generate code for a big-endian target.
18318
18319 -mlittle-endian
18320 Generate code for a little-endian target. This is the default.
18321
18322 -mxbpf
18323 Generate code for an expanded version of BPF, which relaxes some of
18324 the restrictions imposed by the BPF architecture:
18325
18326 -<Save and restore callee-saved registers at function entry and>
18327 exit, respectively.
18328
18329 FR30 Options
18330
18331 These options are defined specifically for the FR30 port.
18332
18333 -msmall-model
18334 Use the small address space model. This can produce smaller code,
18335 but it does assume that all symbolic values and addresses fit into
18336 a 20-bit range.
18337
18338 -mno-lsim
18339 Assume that runtime support has been provided and so there is no
18340 need to include the simulator library (libsim.a) on the linker
18341 command line.
18342
18343 FT32 Options
18344
18345 These options are defined specifically for the FT32 port.
18346
18347 -msim
18348 Specifies that the program will be run on the simulator. This
18349 causes an alternate runtime startup and library to be linked. You
18350 must not use this option when generating programs that will run on
18351 real hardware; you must provide your own runtime library for
18352 whatever I/O functions are needed.
18353
18354 -mlra
18355 Enable Local Register Allocation. This is still experimental for
18356 FT32, so by default the compiler uses standard reload.
18357
18358 -mnodiv
18359 Do not use div and mod instructions.
18360
18361 -mft32b
18362 Enable use of the extended instructions of the FT32B processor.
18363
18364 -mcompress
18365 Compress all code using the Ft32B code compression scheme.
18366
18367 -mnopm
18368 Do not generate code that reads program memory.
18369
18370 FRV Options
18371
18372 -mgpr-32
18373 Only use the first 32 general-purpose registers.
18374
18375 -mgpr-64
18376 Use all 64 general-purpose registers.
18377
18378 -mfpr-32
18379 Use only the first 32 floating-point registers.
18380
18381 -mfpr-64
18382 Use all 64 floating-point registers.
18383
18384 -mhard-float
18385 Use hardware instructions for floating-point operations.
18386
18387 -msoft-float
18388 Use library routines for floating-point operations.
18389
18390 -malloc-cc
18391 Dynamically allocate condition code registers.
18392
18393 -mfixed-cc
18394 Do not try to dynamically allocate condition code registers, only
18395 use "icc0" and "fcc0".
18396
18397 -mdword
18398 Change ABI to use double word insns.
18399
18400 -mno-dword
18401 Do not use double word instructions.
18402
18403 -mdouble
18404 Use floating-point double instructions.
18405
18406 -mno-double
18407 Do not use floating-point double instructions.
18408
18409 -mmedia
18410 Use media instructions.
18411
18412 -mno-media
18413 Do not use media instructions.
18414
18415 -mmuladd
18416 Use multiply and add/subtract instructions.
18417
18418 -mno-muladd
18419 Do not use multiply and add/subtract instructions.
18420
18421 -mfdpic
18422 Select the FDPIC ABI, which uses function descriptors to represent
18423 pointers to functions. Without any PIC/PIE-related options, it
18424 implies -fPIE. With -fpic or -fpie, it assumes GOT entries and
18425 small data are within a 12-bit range from the GOT base address;
18426 with -fPIC or -fPIE, GOT offsets are computed with 32 bits. With a
18427 bfin-elf target, this option implies -msim.
18428
18429 -minline-plt
18430 Enable inlining of PLT entries in function calls to functions that
18431 are not known to bind locally. It has no effect without -mfdpic.
18432 It's enabled by default if optimizing for speed and compiling for
18433 shared libraries (i.e., -fPIC or -fpic), or when an optimization
18434 option such as -O3 or above is present in the command line.
18435
18436 -mTLS
18437 Assume a large TLS segment when generating thread-local code.
18438
18439 -mtls
18440 Do not assume a large TLS segment when generating thread-local
18441 code.
18442
18443 -mgprel-ro
18444 Enable the use of "GPREL" relocations in the FDPIC ABI for data
18445 that is known to be in read-only sections. It's enabled by
18446 default, except for -fpic or -fpie: even though it may help make
18447 the global offset table smaller, it trades 1 instruction for 4.
18448 With -fPIC or -fPIE, it trades 3 instructions for 4, one of which
18449 may be shared by multiple symbols, and it avoids the need for a GOT
18450 entry for the referenced symbol, so it's more likely to be a win.
18451 If it is not, -mno-gprel-ro can be used to disable it.
18452
18453 -multilib-library-pic
18454 Link with the (library, not FD) pic libraries. It's implied by
18455 -mlibrary-pic, as well as by -fPIC and -fpic without -mfdpic. You
18456 should never have to use it explicitly.
18457
18458 -mlinked-fp
18459 Follow the EABI requirement of always creating a frame pointer
18460 whenever a stack frame is allocated. This option is enabled by
18461 default and can be disabled with -mno-linked-fp.
18462
18463 -mlong-calls
18464 Use indirect addressing to call functions outside the current
18465 compilation unit. This allows the functions to be placed anywhere
18466 within the 32-bit address space.
18467
18468 -malign-labels
18469 Try to align labels to an 8-byte boundary by inserting NOPs into
18470 the previous packet. This option only has an effect when VLIW
18471 packing is enabled. It doesn't create new packets; it merely adds
18472 NOPs to existing ones.
18473
18474 -mlibrary-pic
18475 Generate position-independent EABI code.
18476
18477 -macc-4
18478 Use only the first four media accumulator registers.
18479
18480 -macc-8
18481 Use all eight media accumulator registers.
18482
18483 -mpack
18484 Pack VLIW instructions.
18485
18486 -mno-pack
18487 Do not pack VLIW instructions.
18488
18489 -mno-eflags
18490 Do not mark ABI switches in e_flags.
18491
18492 -mcond-move
18493 Enable the use of conditional-move instructions (default).
18494
18495 This switch is mainly for debugging the compiler and will likely be
18496 removed in a future version.
18497
18498 -mno-cond-move
18499 Disable the use of conditional-move instructions.
18500
18501 This switch is mainly for debugging the compiler and will likely be
18502 removed in a future version.
18503
18504 -mscc
18505 Enable the use of conditional set instructions (default).
18506
18507 This switch is mainly for debugging the compiler and will likely be
18508 removed in a future version.
18509
18510 -mno-scc
18511 Disable the use of conditional set instructions.
18512
18513 This switch is mainly for debugging the compiler and will likely be
18514 removed in a future version.
18515
18516 -mcond-exec
18517 Enable the use of conditional execution (default).
18518
18519 This switch is mainly for debugging the compiler and will likely be
18520 removed in a future version.
18521
18522 -mno-cond-exec
18523 Disable the use of conditional execution.
18524
18525 This switch is mainly for debugging the compiler and will likely be
18526 removed in a future version.
18527
18528 -mvliw-branch
18529 Run a pass to pack branches into VLIW instructions (default).
18530
18531 This switch is mainly for debugging the compiler and will likely be
18532 removed in a future version.
18533
18534 -mno-vliw-branch
18535 Do not run a pass to pack branches into VLIW instructions.
18536
18537 This switch is mainly for debugging the compiler and will likely be
18538 removed in a future version.
18539
18540 -mmulti-cond-exec
18541 Enable optimization of "&&" and "||" in conditional execution
18542 (default).
18543
18544 This switch is mainly for debugging the compiler and will likely be
18545 removed in a future version.
18546
18547 -mno-multi-cond-exec
18548 Disable optimization of "&&" and "||" in conditional execution.
18549
18550 This switch is mainly for debugging the compiler and will likely be
18551 removed in a future version.
18552
18553 -mnested-cond-exec
18554 Enable nested conditional execution optimizations (default).
18555
18556 This switch is mainly for debugging the compiler and will likely be
18557 removed in a future version.
18558
18559 -mno-nested-cond-exec
18560 Disable nested conditional execution optimizations.
18561
18562 This switch is mainly for debugging the compiler and will likely be
18563 removed in a future version.
18564
18565 -moptimize-membar
18566 This switch removes redundant "membar" instructions from the
18567 compiler-generated code. It is enabled by default.
18568
18569 -mno-optimize-membar
18570 This switch disables the automatic removal of redundant "membar"
18571 instructions from the generated code.
18572
18573 -mtomcat-stats
18574 Cause gas to print out tomcat statistics.
18575
18576 -mcpu=cpu
18577 Select the processor type for which to generate code. Possible
18578 values are frv, fr550, tomcat, fr500, fr450, fr405, fr400, fr300
18579 and simple.
18580
18581 GNU/Linux Options
18582
18583 These -m options are defined for GNU/Linux targets:
18584
18585 -mglibc
18586 Use the GNU C library. This is the default except on
18587 *-*-linux-*uclibc*, *-*-linux-*musl* and *-*-linux-*android*
18588 targets.
18589
18590 -muclibc
18591 Use uClibc C library. This is the default on *-*-linux-*uclibc*
18592 targets.
18593
18594 -mmusl
18595 Use the musl C library. This is the default on *-*-linux-*musl*
18596 targets.
18597
18598 -mbionic
18599 Use Bionic C library. This is the default on *-*-linux-*android*
18600 targets.
18601
18602 -mandroid
18603 Compile code compatible with Android platform. This is the default
18604 on *-*-linux-*android* targets.
18605
18606 When compiling, this option enables -mbionic, -fPIC,
18607 -fno-exceptions and -fno-rtti by default. When linking, this
18608 option makes the GCC driver pass Android-specific options to the
18609 linker. Finally, this option causes the preprocessor macro
18610 "__ANDROID__" to be defined.
18611
18612 -tno-android-cc
18613 Disable compilation effects of -mandroid, i.e., do not enable
18614 -mbionic, -fPIC, -fno-exceptions and -fno-rtti by default.
18615
18616 -tno-android-ld
18617 Disable linking effects of -mandroid, i.e., pass standard Linux
18618 linking options to the linker.
18619
18620 H8/300 Options
18621
18622 These -m options are defined for the H8/300 implementations:
18623
18624 -mrelax
18625 Shorten some address references at link time, when possible; uses
18626 the linker option -relax.
18627
18628 -mh Generate code for the H8/300H.
18629
18630 -ms Generate code for the H8S.
18631
18632 -mn Generate code for the H8S and H8/300H in the normal mode. This
18633 switch must be used either with -mh or -ms.
18634
18635 -ms2600
18636 Generate code for the H8S/2600. This switch must be used with -ms.
18637
18638 -mexr
18639 Extended registers are stored on stack before execution of function
18640 with monitor attribute. Default option is -mexr. This option is
18641 valid only for H8S targets.
18642
18643 -mno-exr
18644 Extended registers are not stored on stack before execution of
18645 function with monitor attribute. Default option is -mno-exr. This
18646 option is valid only for H8S targets.
18647
18648 -mint32
18649 Make "int" data 32 bits by default.
18650
18651 -malign-300
18652 On the H8/300H and H8S, use the same alignment rules as for the
18653 H8/300. The default for the H8/300H and H8S is to align longs and
18654 floats on 4-byte boundaries. -malign-300 causes them to be aligned
18655 on 2-byte boundaries. This option has no effect on the H8/300.
18656
18657 HPPA Options
18658
18659 These -m options are defined for the HPPA family of computers:
18660
18661 -march=architecture-type
18662 Generate code for the specified architecture. The choices for
18663 architecture-type are 1.0 for PA 1.0, 1.1 for PA 1.1, and 2.0 for
18664 PA 2.0 processors. Refer to /usr/lib/sched.models on an HP-UX
18665 system to determine the proper architecture option for your
18666 machine. Code compiled for lower numbered architectures runs on
18667 higher numbered architectures, but not the other way around.
18668
18669 -mpa-risc-1-0
18670 -mpa-risc-1-1
18671 -mpa-risc-2-0
18672 Synonyms for -march=1.0, -march=1.1, and -march=2.0 respectively.
18673
18674 -mcaller-copies
18675 The caller copies function arguments passed by hidden reference.
18676 This option should be used with care as it is not compatible with
18677 the default 32-bit runtime. However, only aggregates larger than
18678 eight bytes are passed by hidden reference and the option provides
18679 better compatibility with OpenMP.
18680
18681 -mjump-in-delay
18682 This option is ignored and provided for compatibility purposes
18683 only.
18684
18685 -mdisable-fpregs
18686 Prevent floating-point registers from being used in any manner.
18687 This is necessary for compiling kernels that perform lazy context
18688 switching of floating-point registers. If you use this option and
18689 attempt to perform floating-point operations, the compiler aborts.
18690
18691 -mdisable-indexing
18692 Prevent the compiler from using indexing address modes. This
18693 avoids some rather obscure problems when compiling MIG generated
18694 code under MACH.
18695
18696 -mno-space-regs
18697 Generate code that assumes the target has no space registers. This
18698 allows GCC to generate faster indirect calls and use unscaled index
18699 address modes.
18700
18701 Such code is suitable for level 0 PA systems and kernels.
18702
18703 -mfast-indirect-calls
18704 Generate code that assumes calls never cross space boundaries.
18705 This allows GCC to emit code that performs faster indirect calls.
18706
18707 This option does not work in the presence of shared libraries or
18708 nested functions.
18709
18710 -mfixed-range=register-range
18711 Generate code treating the given register range as fixed registers.
18712 A fixed register is one that the register allocator cannot use.
18713 This is useful when compiling kernel code. A register range is
18714 specified as two registers separated by a dash. Multiple register
18715 ranges can be specified separated by a comma.
18716
18717 -mlong-load-store
18718 Generate 3-instruction load and store sequences as sometimes
18719 required by the HP-UX 10 linker. This is equivalent to the +k
18720 option to the HP compilers.
18721
18722 -mportable-runtime
18723 Use the portable calling conventions proposed by HP for ELF
18724 systems.
18725
18726 -mgas
18727 Enable the use of assembler directives only GAS understands.
18728
18729 -mschedule=cpu-type
18730 Schedule code according to the constraints for the machine type
18731 cpu-type. The choices for cpu-type are 700 7100, 7100LC, 7200,
18732 7300 and 8000. Refer to /usr/lib/sched.models on an HP-UX system
18733 to determine the proper scheduling option for your machine. The
18734 default scheduling is 8000.
18735
18736 -mlinker-opt
18737 Enable the optimization pass in the HP-UX linker. Note this makes
18738 symbolic debugging impossible. It also triggers a bug in the HP-UX
18739 8 and HP-UX 9 linkers in which they give bogus error messages when
18740 linking some programs.
18741
18742 -msoft-float
18743 Generate output containing library calls for floating point.
18744 Warning: the requisite libraries are not available for all HPPA
18745 targets. Normally the facilities of the machine's usual C compiler
18746 are used, but this cannot be done directly in cross-compilation.
18747 You must make your own arrangements to provide suitable library
18748 functions for cross-compilation.
18749
18750 -msoft-float changes the calling convention in the output file;
18751 therefore, it is only useful if you compile all of a program with
18752 this option. In particular, you need to compile libgcc.a, the
18753 library that comes with GCC, with -msoft-float in order for this to
18754 work.
18755
18756 -msio
18757 Generate the predefine, "_SIO", for server IO. The default is
18758 -mwsio. This generates the predefines, "__hp9000s700",
18759 "__hp9000s700__" and "_WSIO", for workstation IO. These options
18760 are available under HP-UX and HI-UX.
18761
18762 -mgnu-ld
18763 Use options specific to GNU ld. This passes -shared to ld when
18764 building a shared library. It is the default when GCC is
18765 configured, explicitly or implicitly, with the GNU linker. This
18766 option does not affect which ld is called; it only changes what
18767 parameters are passed to that ld. The ld that is called is
18768 determined by the --with-ld configure option, GCC's program search
18769 path, and finally by the user's PATH. The linker used by GCC can
18770 be printed using which `gcc -print-prog-name=ld`. This option is
18771 only available on the 64-bit HP-UX GCC, i.e. configured with
18772 hppa*64*-*-hpux*.
18773
18774 -mhp-ld
18775 Use options specific to HP ld. This passes -b to ld when building
18776 a shared library and passes +Accept TypeMismatch to ld on all
18777 links. It is the default when GCC is configured, explicitly or
18778 implicitly, with the HP linker. This option does not affect which
18779 ld is called; it only changes what parameters are passed to that
18780 ld. The ld that is called is determined by the --with-ld configure
18781 option, GCC's program search path, and finally by the user's PATH.
18782 The linker used by GCC can be printed using which `gcc
18783 -print-prog-name=ld`. This option is only available on the 64-bit
18784 HP-UX GCC, i.e. configured with hppa*64*-*-hpux*.
18785
18786 -mlong-calls
18787 Generate code that uses long call sequences. This ensures that a
18788 call is always able to reach linker generated stubs. The default
18789 is to generate long calls only when the distance from the call site
18790 to the beginning of the function or translation unit, as the case
18791 may be, exceeds a predefined limit set by the branch type being
18792 used. The limits for normal calls are 7,600,000 and 240,000 bytes,
18793 respectively for the PA 2.0 and PA 1.X architectures. Sibcalls are
18794 always limited at 240,000 bytes.
18795
18796 Distances are measured from the beginning of functions when using
18797 the -ffunction-sections option, or when using the -mgas and
18798 -mno-portable-runtime options together under HP-UX with the SOM
18799 linker.
18800
18801 It is normally not desirable to use this option as it degrades
18802 performance. However, it may be useful in large applications,
18803 particularly when partial linking is used to build the application.
18804
18805 The types of long calls used depends on the capabilities of the
18806 assembler and linker, and the type of code being generated. The
18807 impact on systems that support long absolute calls, and long pic
18808 symbol-difference or pc-relative calls should be relatively small.
18809 However, an indirect call is used on 32-bit ELF systems in pic code
18810 and it is quite long.
18811
18812 -munix=unix-std
18813 Generate compiler predefines and select a startfile for the
18814 specified UNIX standard. The choices for unix-std are 93, 95 and
18815 98. 93 is supported on all HP-UX versions. 95 is available on HP-
18816 UX 10.10 and later. 98 is available on HP-UX 11.11 and later. The
18817 default values are 93 for HP-UX 10.00, 95 for HP-UX 10.10 though to
18818 11.00, and 98 for HP-UX 11.11 and later.
18819
18820 -munix=93 provides the same predefines as GCC 3.3 and 3.4.
18821 -munix=95 provides additional predefines for "XOPEN_UNIX" and
18822 "_XOPEN_SOURCE_EXTENDED", and the startfile unix95.o. -munix=98
18823 provides additional predefines for "_XOPEN_UNIX",
18824 "_XOPEN_SOURCE_EXTENDED", "_INCLUDE__STDC_A1_SOURCE" and
18825 "_INCLUDE_XOPEN_SOURCE_500", and the startfile unix98.o.
18826
18827 It is important to note that this option changes the interfaces for
18828 various library routines. It also affects the operational behavior
18829 of the C library. Thus, extreme care is needed in using this
18830 option.
18831
18832 Library code that is intended to operate with more than one UNIX
18833 standard must test, set and restore the variable
18834 "__xpg4_extended_mask" as appropriate. Most GNU software doesn't
18835 provide this capability.
18836
18837 -nolibdld
18838 Suppress the generation of link options to search libdld.sl when
18839 the -static option is specified on HP-UX 10 and later.
18840
18841 -static
18842 The HP-UX implementation of setlocale in libc has a dependency on
18843 libdld.sl. There isn't an archive version of libdld.sl. Thus,
18844 when the -static option is specified, special link options are
18845 needed to resolve this dependency.
18846
18847 On HP-UX 10 and later, the GCC driver adds the necessary options to
18848 link with libdld.sl when the -static option is specified. This
18849 causes the resulting binary to be dynamic. On the 64-bit port, the
18850 linkers generate dynamic binaries by default in any case. The
18851 -nolibdld option can be used to prevent the GCC driver from adding
18852 these link options.
18853
18854 -threads
18855 Add support for multithreading with the dce thread library under
18856 HP-UX. This option sets flags for both the preprocessor and
18857 linker.
18858
18859 IA-64 Options
18860
18861 These are the -m options defined for the Intel IA-64 architecture.
18862
18863 -mbig-endian
18864 Generate code for a big-endian target. This is the default for HP-
18865 UX.
18866
18867 -mlittle-endian
18868 Generate code for a little-endian target. This is the default for
18869 AIX5 and GNU/Linux.
18870
18871 -mgnu-as
18872 -mno-gnu-as
18873 Generate (or don't) code for the GNU assembler. This is the
18874 default.
18875
18876 -mgnu-ld
18877 -mno-gnu-ld
18878 Generate (or don't) code for the GNU linker. This is the default.
18879
18880 -mno-pic
18881 Generate code that does not use a global pointer register. The
18882 result is not position independent code, and violates the IA-64
18883 ABI.
18884
18885 -mvolatile-asm-stop
18886 -mno-volatile-asm-stop
18887 Generate (or don't) a stop bit immediately before and after
18888 volatile asm statements.
18889
18890 -mregister-names
18891 -mno-register-names
18892 Generate (or don't) in, loc, and out register names for the stacked
18893 registers. This may make assembler output more readable.
18894
18895 -mno-sdata
18896 -msdata
18897 Disable (or enable) optimizations that use the small data section.
18898 This may be useful for working around optimizer bugs.
18899
18900 -mconstant-gp
18901 Generate code that uses a single constant global pointer value.
18902 This is useful when compiling kernel code.
18903
18904 -mauto-pic
18905 Generate code that is self-relocatable. This implies
18906 -mconstant-gp. This is useful when compiling firmware code.
18907
18908 -minline-float-divide-min-latency
18909 Generate code for inline divides of floating-point values using the
18910 minimum latency algorithm.
18911
18912 -minline-float-divide-max-throughput
18913 Generate code for inline divides of floating-point values using the
18914 maximum throughput algorithm.
18915
18916 -mno-inline-float-divide
18917 Do not generate inline code for divides of floating-point values.
18918
18919 -minline-int-divide-min-latency
18920 Generate code for inline divides of integer values using the
18921 minimum latency algorithm.
18922
18923 -minline-int-divide-max-throughput
18924 Generate code for inline divides of integer values using the
18925 maximum throughput algorithm.
18926
18927 -mno-inline-int-divide
18928 Do not generate inline code for divides of integer values.
18929
18930 -minline-sqrt-min-latency
18931 Generate code for inline square roots using the minimum latency
18932 algorithm.
18933
18934 -minline-sqrt-max-throughput
18935 Generate code for inline square roots using the maximum throughput
18936 algorithm.
18937
18938 -mno-inline-sqrt
18939 Do not generate inline code for "sqrt".
18940
18941 -mfused-madd
18942 -mno-fused-madd
18943 Do (don't) generate code that uses the fused multiply/add or
18944 multiply/subtract instructions. The default is to use these
18945 instructions.
18946
18947 -mno-dwarf2-asm
18948 -mdwarf2-asm
18949 Don't (or do) generate assembler code for the DWARF line number
18950 debugging info. This may be useful when not using the GNU
18951 assembler.
18952
18953 -mearly-stop-bits
18954 -mno-early-stop-bits
18955 Allow stop bits to be placed earlier than immediately preceding the
18956 instruction that triggered the stop bit. This can improve
18957 instruction scheduling, but does not always do so.
18958
18959 -mfixed-range=register-range
18960 Generate code treating the given register range as fixed registers.
18961 A fixed register is one that the register allocator cannot use.
18962 This is useful when compiling kernel code. A register range is
18963 specified as two registers separated by a dash. Multiple register
18964 ranges can be specified separated by a comma.
18965
18966 -mtls-size=tls-size
18967 Specify bit size of immediate TLS offsets. Valid values are 14,
18968 22, and 64.
18969
18970 -mtune=cpu-type
18971 Tune the instruction scheduling for a particular CPU, Valid values
18972 are itanium, itanium1, merced, itanium2, and mckinley.
18973
18974 -milp32
18975 -mlp64
18976 Generate code for a 32-bit or 64-bit environment. The 32-bit
18977 environment sets int, long and pointer to 32 bits. The 64-bit
18978 environment sets int to 32 bits and long and pointer to 64 bits.
18979 These are HP-UX specific flags.
18980
18981 -mno-sched-br-data-spec
18982 -msched-br-data-spec
18983 (Dis/En)able data speculative scheduling before reload. This
18984 results in generation of "ld.a" instructions and the corresponding
18985 check instructions ("ld.c" / "chk.a"). The default setting is
18986 disabled.
18987
18988 -msched-ar-data-spec
18989 -mno-sched-ar-data-spec
18990 (En/Dis)able data speculative scheduling after reload. This
18991 results in generation of "ld.a" instructions and the corresponding
18992 check instructions ("ld.c" / "chk.a"). The default setting is
18993 enabled.
18994
18995 -mno-sched-control-spec
18996 -msched-control-spec
18997 (Dis/En)able control speculative scheduling. This feature is
18998 available only during region scheduling (i.e. before reload). This
18999 results in generation of the "ld.s" instructions and the
19000 corresponding check instructions "chk.s". The default setting is
19001 disabled.
19002
19003 -msched-br-in-data-spec
19004 -mno-sched-br-in-data-spec
19005 (En/Dis)able speculative scheduling of the instructions that are
19006 dependent on the data speculative loads before reload. This is
19007 effective only with -msched-br-data-spec enabled. The default
19008 setting is enabled.
19009
19010 -msched-ar-in-data-spec
19011 -mno-sched-ar-in-data-spec
19012 (En/Dis)able speculative scheduling of the instructions that are
19013 dependent on the data speculative loads after reload. This is
19014 effective only with -msched-ar-data-spec enabled. The default
19015 setting is enabled.
19016
19017 -msched-in-control-spec
19018 -mno-sched-in-control-spec
19019 (En/Dis)able speculative scheduling of the instructions that are
19020 dependent on the control speculative loads. This is effective only
19021 with -msched-control-spec enabled. The default setting is enabled.
19022
19023 -mno-sched-prefer-non-data-spec-insns
19024 -msched-prefer-non-data-spec-insns
19025 If enabled, data-speculative instructions are chosen for schedule
19026 only if there are no other choices at the moment. This makes the
19027 use of the data speculation much more conservative. The default
19028 setting is disabled.
19029
19030 -mno-sched-prefer-non-control-spec-insns
19031 -msched-prefer-non-control-spec-insns
19032 If enabled, control-speculative instructions are chosen for
19033 schedule only if there are no other choices at the moment. This
19034 makes the use of the control speculation much more conservative.
19035 The default setting is disabled.
19036
19037 -mno-sched-count-spec-in-critical-path
19038 -msched-count-spec-in-critical-path
19039 If enabled, speculative dependencies are considered during
19040 computation of the instructions priorities. This makes the use of
19041 the speculation a bit more conservative. The default setting is
19042 disabled.
19043
19044 -msched-spec-ldc
19045 Use a simple data speculation check. This option is on by default.
19046
19047 -msched-control-spec-ldc
19048 Use a simple check for control speculation. This option is on by
19049 default.
19050
19051 -msched-stop-bits-after-every-cycle
19052 Place a stop bit after every cycle when scheduling. This option is
19053 on by default.
19054
19055 -msched-fp-mem-deps-zero-cost
19056 Assume that floating-point stores and loads are not likely to cause
19057 a conflict when placed into the same instruction group. This
19058 option is disabled by default.
19059
19060 -msel-sched-dont-check-control-spec
19061 Generate checks for control speculation in selective scheduling.
19062 This flag is disabled by default.
19063
19064 -msched-max-memory-insns=max-insns
19065 Limit on the number of memory insns per instruction group, giving
19066 lower priority to subsequent memory insns attempting to schedule in
19067 the same instruction group. Frequently useful to prevent cache bank
19068 conflicts. The default value is 1.
19069
19070 -msched-max-memory-insns-hard-limit
19071 Makes the limit specified by msched-max-memory-insns a hard limit,
19072 disallowing more than that number in an instruction group.
19073 Otherwise, the limit is "soft", meaning that non-memory operations
19074 are preferred when the limit is reached, but memory operations may
19075 still be scheduled.
19076
19077 LM32 Options
19078
19079 These -m options are defined for the LatticeMico32 architecture:
19080
19081 -mbarrel-shift-enabled
19082 Enable barrel-shift instructions.
19083
19084 -mdivide-enabled
19085 Enable divide and modulus instructions.
19086
19087 -mmultiply-enabled
19088 Enable multiply instructions.
19089
19090 -msign-extend-enabled
19091 Enable sign extend instructions.
19092
19093 -muser-enabled
19094 Enable user-defined instructions.
19095
19096 M32C Options
19097
19098 -mcpu=name
19099 Select the CPU for which code is generated. name may be one of r8c
19100 for the R8C/Tiny series, m16c for the M16C (up to /60) series,
19101 m32cm for the M16C/80 series, or m32c for the M32C/80 series.
19102
19103 -msim
19104 Specifies that the program will be run on the simulator. This
19105 causes an alternate runtime library to be linked in which supports,
19106 for example, file I/O. You must not use this option when
19107 generating programs that will run on real hardware; you must
19108 provide your own runtime library for whatever I/O functions are
19109 needed.
19110
19111 -memregs=number
19112 Specifies the number of memory-based pseudo-registers GCC uses
19113 during code generation. These pseudo-registers are used like real
19114 registers, so there is a tradeoff between GCC's ability to fit the
19115 code into available registers, and the performance penalty of using
19116 memory instead of registers. Note that all modules in a program
19117 must be compiled with the same value for this option. Because of
19118 that, you must not use this option with GCC's default runtime
19119 libraries.
19120
19121 M32R/D Options
19122
19123 These -m options are defined for Renesas M32R/D architectures:
19124
19125 -m32r2
19126 Generate code for the M32R/2.
19127
19128 -m32rx
19129 Generate code for the M32R/X.
19130
19131 -m32r
19132 Generate code for the M32R. This is the default.
19133
19134 -mmodel=small
19135 Assume all objects live in the lower 16MB of memory (so that their
19136 addresses can be loaded with the "ld24" instruction), and assume
19137 all subroutines are reachable with the "bl" instruction. This is
19138 the default.
19139
19140 The addressability of a particular object can be set with the
19141 "model" attribute.
19142
19143 -mmodel=medium
19144 Assume objects may be anywhere in the 32-bit address space (the
19145 compiler generates "seth/add3" instructions to load their
19146 addresses), and assume all subroutines are reachable with the "bl"
19147 instruction.
19148
19149 -mmodel=large
19150 Assume objects may be anywhere in the 32-bit address space (the
19151 compiler generates "seth/add3" instructions to load their
19152 addresses), and assume subroutines may not be reachable with the
19153 "bl" instruction (the compiler generates the much slower
19154 "seth/add3/jl" instruction sequence).
19155
19156 -msdata=none
19157 Disable use of the small data area. Variables are put into one of
19158 ".data", ".bss", or ".rodata" (unless the "section" attribute has
19159 been specified). This is the default.
19160
19161 The small data area consists of sections ".sdata" and ".sbss".
19162 Objects may be explicitly put in the small data area with the
19163 "section" attribute using one of these sections.
19164
19165 -msdata=sdata
19166 Put small global and static data in the small data area, but do not
19167 generate special code to reference them.
19168
19169 -msdata=use
19170 Put small global and static data in the small data area, and
19171 generate special instructions to reference them.
19172
19173 -G num
19174 Put global and static objects less than or equal to num bytes into
19175 the small data or BSS sections instead of the normal data or BSS
19176 sections. The default value of num is 8. The -msdata option must
19177 be set to one of sdata or use for this option to have any effect.
19178
19179 All modules should be compiled with the same -G num value.
19180 Compiling with different values of num may or may not work; if it
19181 doesn't the linker gives an error message---incorrect code is not
19182 generated.
19183
19184 -mdebug
19185 Makes the M32R-specific code in the compiler display some
19186 statistics that might help in debugging programs.
19187
19188 -malign-loops
19189 Align all loops to a 32-byte boundary.
19190
19191 -mno-align-loops
19192 Do not enforce a 32-byte alignment for loops. This is the default.
19193
19194 -missue-rate=number
19195 Issue number instructions per cycle. number can only be 1 or 2.
19196
19197 -mbranch-cost=number
19198 number can only be 1 or 2. If it is 1 then branches are preferred
19199 over conditional code, if it is 2, then the opposite applies.
19200
19201 -mflush-trap=number
19202 Specifies the trap number to use to flush the cache. The default
19203 is 12. Valid numbers are between 0 and 15 inclusive.
19204
19205 -mno-flush-trap
19206 Specifies that the cache cannot be flushed by using a trap.
19207
19208 -mflush-func=name
19209 Specifies the name of the operating system function to call to
19210 flush the cache. The default is _flush_cache, but a function call
19211 is only used if a trap is not available.
19212
19213 -mno-flush-func
19214 Indicates that there is no OS function for flushing the cache.
19215
19216 M680x0 Options
19217
19218 These are the -m options defined for M680x0 and ColdFire processors.
19219 The default settings depend on which architecture was selected when the
19220 compiler was configured; the defaults for the most common choices are
19221 given below.
19222
19223 -march=arch
19224 Generate code for a specific M680x0 or ColdFire instruction set
19225 architecture. Permissible values of arch for M680x0 architectures
19226 are: 68000, 68010, 68020, 68030, 68040, 68060 and cpu32. ColdFire
19227 architectures are selected according to Freescale's ISA
19228 classification and the permissible values are: isaa, isaaplus, isab
19229 and isac.
19230
19231 GCC defines a macro "__mcfarch__" whenever it is generating code
19232 for a ColdFire target. The arch in this macro is one of the -march
19233 arguments given above.
19234
19235 When used together, -march and -mtune select code that runs on a
19236 family of similar processors but that is optimized for a particular
19237 microarchitecture.
19238
19239 -mcpu=cpu
19240 Generate code for a specific M680x0 or ColdFire processor. The
19241 M680x0 cpus are: 68000, 68010, 68020, 68030, 68040, 68060, 68302,
19242 68332 and cpu32. The ColdFire cpus are given by the table below,
19243 which also classifies the CPUs into families:
19244
19245 Family : -mcpu arguments
19246 51 : 51 51ac 51ag 51cn 51em 51je 51jf 51jg 51jm 51mm 51qe 51qm
19247 5206 : 5202 5204 5206
19248 5206e : 5206e
19249 5208 : 5207 5208
19250 5211a : 5210a 5211a
19251 5213 : 5211 5212 5213
19252 5216 : 5214 5216
19253 52235 : 52230 52231 52232 52233 52234 52235
19254 5225 : 5224 5225
19255 52259 : 52252 52254 52255 52256 52258 52259
19256 5235 : 5232 5233 5234 5235 523x
19257 5249 : 5249
19258 5250 : 5250
19259 5271 : 5270 5271
19260 5272 : 5272
19261 5275 : 5274 5275
19262 5282 : 5280 5281 5282 528x
19263 53017 : 53011 53012 53013 53014 53015 53016 53017
19264 5307 : 5307
19265 5329 : 5327 5328 5329 532x
19266 5373 : 5372 5373 537x
19267 5407 : 5407
19268 5475 : 5470 5471 5472 5473 5474 5475 547x 5480 5481 5482 5483 5484
19269 5485
19270
19271 -mcpu=cpu overrides -march=arch if arch is compatible with cpu.
19272 Other combinations of -mcpu and -march are rejected.
19273
19274 GCC defines the macro "__mcf_cpu_cpu" when ColdFire target cpu is
19275 selected. It also defines "__mcf_family_family", where the value
19276 of family is given by the table above.
19277
19278 -mtune=tune
19279 Tune the code for a particular microarchitecture within the
19280 constraints set by -march and -mcpu. The M680x0 microarchitectures
19281 are: 68000, 68010, 68020, 68030, 68040, 68060 and cpu32. The
19282 ColdFire microarchitectures are: cfv1, cfv2, cfv3, cfv4 and cfv4e.
19283
19284 You can also use -mtune=68020-40 for code that needs to run
19285 relatively well on 68020, 68030 and 68040 targets. -mtune=68020-60
19286 is similar but includes 68060 targets as well. These two options
19287 select the same tuning decisions as -m68020-40 and -m68020-60
19288 respectively.
19289
19290 GCC defines the macros "__mcarch" and "__mcarch__" when tuning for
19291 680x0 architecture arch. It also defines "mcarch" unless either
19292 -ansi or a non-GNU -std option is used. If GCC is tuning for a
19293 range of architectures, as selected by -mtune=68020-40 or
19294 -mtune=68020-60, it defines the macros for every architecture in
19295 the range.
19296
19297 GCC also defines the macro "__muarch__" when tuning for ColdFire
19298 microarchitecture uarch, where uarch is one of the arguments given
19299 above.
19300
19301 -m68000
19302 -mc68000
19303 Generate output for a 68000. This is the default when the compiler
19304 is configured for 68000-based systems. It is equivalent to
19305 -march=68000.
19306
19307 Use this option for microcontrollers with a 68000 or EC000 core,
19308 including the 68008, 68302, 68306, 68307, 68322, 68328 and 68356.
19309
19310 -m68010
19311 Generate output for a 68010. This is the default when the compiler
19312 is configured for 68010-based systems. It is equivalent to
19313 -march=68010.
19314
19315 -m68020
19316 -mc68020
19317 Generate output for a 68020. This is the default when the compiler
19318 is configured for 68020-based systems. It is equivalent to
19319 -march=68020.
19320
19321 -m68030
19322 Generate output for a 68030. This is the default when the compiler
19323 is configured for 68030-based systems. It is equivalent to
19324 -march=68030.
19325
19326 -m68040
19327 Generate output for a 68040. This is the default when the compiler
19328 is configured for 68040-based systems. It is equivalent to
19329 -march=68040.
19330
19331 This option inhibits the use of 68881/68882 instructions that have
19332 to be emulated by software on the 68040. Use this option if your
19333 68040 does not have code to emulate those instructions.
19334
19335 -m68060
19336 Generate output for a 68060. This is the default when the compiler
19337 is configured for 68060-based systems. It is equivalent to
19338 -march=68060.
19339
19340 This option inhibits the use of 68020 and 68881/68882 instructions
19341 that have to be emulated by software on the 68060. Use this option
19342 if your 68060 does not have code to emulate those instructions.
19343
19344 -mcpu32
19345 Generate output for a CPU32. This is the default when the compiler
19346 is configured for CPU32-based systems. It is equivalent to
19347 -march=cpu32.
19348
19349 Use this option for microcontrollers with a CPU32 or CPU32+ core,
19350 including the 68330, 68331, 68332, 68333, 68334, 68336, 68340,
19351 68341, 68349 and 68360.
19352
19353 -m5200
19354 Generate output for a 520X ColdFire CPU. This is the default when
19355 the compiler is configured for 520X-based systems. It is
19356 equivalent to -mcpu=5206, and is now deprecated in favor of that
19357 option.
19358
19359 Use this option for microcontroller with a 5200 core, including the
19360 MCF5202, MCF5203, MCF5204 and MCF5206.
19361
19362 -m5206e
19363 Generate output for a 5206e ColdFire CPU. The option is now
19364 deprecated in favor of the equivalent -mcpu=5206e.
19365
19366 -m528x
19367 Generate output for a member of the ColdFire 528X family. The
19368 option is now deprecated in favor of the equivalent -mcpu=528x.
19369
19370 -m5307
19371 Generate output for a ColdFire 5307 CPU. The option is now
19372 deprecated in favor of the equivalent -mcpu=5307.
19373
19374 -m5407
19375 Generate output for a ColdFire 5407 CPU. The option is now
19376 deprecated in favor of the equivalent -mcpu=5407.
19377
19378 -mcfv4e
19379 Generate output for a ColdFire V4e family CPU (e.g. 547x/548x).
19380 This includes use of hardware floating-point instructions. The
19381 option is equivalent to -mcpu=547x, and is now deprecated in favor
19382 of that option.
19383
19384 -m68020-40
19385 Generate output for a 68040, without using any of the new
19386 instructions. This results in code that can run relatively
19387 efficiently on either a 68020/68881 or a 68030 or a 68040. The
19388 generated code does use the 68881 instructions that are emulated on
19389 the 68040.
19390
19391 The option is equivalent to -march=68020 -mtune=68020-40.
19392
19393 -m68020-60
19394 Generate output for a 68060, without using any of the new
19395 instructions. This results in code that can run relatively
19396 efficiently on either a 68020/68881 or a 68030 or a 68040. The
19397 generated code does use the 68881 instructions that are emulated on
19398 the 68060.
19399
19400 The option is equivalent to -march=68020 -mtune=68020-60.
19401
19402 -mhard-float
19403 -m68881
19404 Generate floating-point instructions. This is the default for
19405 68020 and above, and for ColdFire devices that have an FPU. It
19406 defines the macro "__HAVE_68881__" on M680x0 targets and
19407 "__mcffpu__" on ColdFire targets.
19408
19409 -msoft-float
19410 Do not generate floating-point instructions; use library calls
19411 instead. This is the default for 68000, 68010, and 68832 targets.
19412 It is also the default for ColdFire devices that have no FPU.
19413
19414 -mdiv
19415 -mno-div
19416 Generate (do not generate) ColdFire hardware divide and remainder
19417 instructions. If -march is used without -mcpu, the default is "on"
19418 for ColdFire architectures and "off" for M680x0 architectures.
19419 Otherwise, the default is taken from the target CPU (either the
19420 default CPU, or the one specified by -mcpu). For example, the
19421 default is "off" for -mcpu=5206 and "on" for -mcpu=5206e.
19422
19423 GCC defines the macro "__mcfhwdiv__" when this option is enabled.
19424
19425 -mshort
19426 Consider type "int" to be 16 bits wide, like "short int".
19427 Additionally, parameters passed on the stack are also aligned to a
19428 16-bit boundary even on targets whose API mandates promotion to
19429 32-bit.
19430
19431 -mno-short
19432 Do not consider type "int" to be 16 bits wide. This is the
19433 default.
19434
19435 -mnobitfield
19436 -mno-bitfield
19437 Do not use the bit-field instructions. The -m68000, -mcpu32 and
19438 -m5200 options imply -mnobitfield.
19439
19440 -mbitfield
19441 Do use the bit-field instructions. The -m68020 option implies
19442 -mbitfield. This is the default if you use a configuration
19443 designed for a 68020.
19444
19445 -mrtd
19446 Use a different function-calling convention, in which functions
19447 that take a fixed number of arguments return with the "rtd"
19448 instruction, which pops their arguments while returning. This
19449 saves one instruction in the caller since there is no need to pop
19450 the arguments there.
19451
19452 This calling convention is incompatible with the one normally used
19453 on Unix, so you cannot use it if you need to call libraries
19454 compiled with the Unix compiler.
19455
19456 Also, you must provide function prototypes for all functions that
19457 take variable numbers of arguments (including "printf"); otherwise
19458 incorrect code is generated for calls to those functions.
19459
19460 In addition, seriously incorrect code results if you call a
19461 function with too many arguments. (Normally, extra arguments are
19462 harmlessly ignored.)
19463
19464 The "rtd" instruction is supported by the 68010, 68020, 68030,
19465 68040, 68060 and CPU32 processors, but not by the 68000 or 5200.
19466
19467 The default is -mno-rtd.
19468
19469 -malign-int
19470 -mno-align-int
19471 Control whether GCC aligns "int", "long", "long long", "float",
19472 "double", and "long double" variables on a 32-bit boundary
19473 (-malign-int) or a 16-bit boundary (-mno-align-int). Aligning
19474 variables on 32-bit boundaries produces code that runs somewhat
19475 faster on processors with 32-bit busses at the expense of more
19476 memory.
19477
19478 Warning: if you use the -malign-int switch, GCC aligns structures
19479 containing the above types differently than most published
19480 application binary interface specifications for the m68k.
19481
19482 Use the pc-relative addressing mode of the 68000 directly, instead
19483 of using a global offset table. At present, this option implies
19484 -fpic, allowing at most a 16-bit offset for pc-relative addressing.
19485 -fPIC is not presently supported with -mpcrel, though this could be
19486 supported for 68020 and higher processors.
19487
19488 -mno-strict-align
19489 -mstrict-align
19490 Do not (do) assume that unaligned memory references are handled by
19491 the system.
19492
19493 -msep-data
19494 Generate code that allows the data segment to be located in a
19495 different area of memory from the text segment. This allows for
19496 execute-in-place in an environment without virtual memory
19497 management. This option implies -fPIC.
19498
19499 -mno-sep-data
19500 Generate code that assumes that the data segment follows the text
19501 segment. This is the default.
19502
19503 -mid-shared-library
19504 Generate code that supports shared libraries via the library ID
19505 method. This allows for execute-in-place and shared libraries in
19506 an environment without virtual memory management. This option
19507 implies -fPIC.
19508
19509 -mno-id-shared-library
19510 Generate code that doesn't assume ID-based shared libraries are
19511 being used. This is the default.
19512
19513 -mshared-library-id=n
19514 Specifies the identification number of the ID-based shared library
19515 being compiled. Specifying a value of 0 generates more compact
19516 code; specifying other values forces the allocation of that number
19517 to the current library, but is no more space- or time-efficient
19518 than omitting this option.
19519
19520 -mxgot
19521 -mno-xgot
19522 When generating position-independent code for ColdFire, generate
19523 code that works if the GOT has more than 8192 entries. This code
19524 is larger and slower than code generated without this option. On
19525 M680x0 processors, this option is not needed; -fPIC suffices.
19526
19527 GCC normally uses a single instruction to load values from the GOT.
19528 While this is relatively efficient, it only works if the GOT is
19529 smaller than about 64k. Anything larger causes the linker to
19530 report an error such as:
19531
19532 relocation truncated to fit: R_68K_GOT16O foobar
19533
19534 If this happens, you should recompile your code with -mxgot. It
19535 should then work with very large GOTs. However, code generated
19536 with -mxgot is less efficient, since it takes 4 instructions to
19537 fetch the value of a global symbol.
19538
19539 Note that some linkers, including newer versions of the GNU linker,
19540 can create multiple GOTs and sort GOT entries. If you have such a
19541 linker, you should only need to use -mxgot when compiling a single
19542 object file that accesses more than 8192 GOT entries. Very few do.
19543
19544 These options have no effect unless GCC is generating position-
19545 independent code.
19546
19547 -mlong-jump-table-offsets
19548 Use 32-bit offsets in "switch" tables. The default is to use
19549 16-bit offsets.
19550
19551 MCore Options
19552
19553 These are the -m options defined for the Motorola M*Core processors.
19554
19555 -mhardlit
19556 -mno-hardlit
19557 Inline constants into the code stream if it can be done in two
19558 instructions or less.
19559
19560 -mdiv
19561 -mno-div
19562 Use the divide instruction. (Enabled by default).
19563
19564 -mrelax-immediate
19565 -mno-relax-immediate
19566 Allow arbitrary-sized immediates in bit operations.
19567
19568 -mwide-bitfields
19569 -mno-wide-bitfields
19570 Always treat bit-fields as "int"-sized.
19571
19572 -m4byte-functions
19573 -mno-4byte-functions
19574 Force all functions to be aligned to a 4-byte boundary.
19575
19576 -mcallgraph-data
19577 -mno-callgraph-data
19578 Emit callgraph information.
19579
19580 -mslow-bytes
19581 -mno-slow-bytes
19582 Prefer word access when reading byte quantities.
19583
19584 -mlittle-endian
19585 -mbig-endian
19586 Generate code for a little-endian target.
19587
19588 -m210
19589 -m340
19590 Generate code for the 210 processor.
19591
19592 -mno-lsim
19593 Assume that runtime support has been provided and so omit the
19594 simulator library (libsim.a) from the linker command line.
19595
19596 -mstack-increment=size
19597 Set the maximum amount for a single stack increment operation.
19598 Large values can increase the speed of programs that contain
19599 functions that need a large amount of stack space, but they can
19600 also trigger a segmentation fault if the stack is extended too
19601 much. The default value is 0x1000.
19602
19603 MeP Options
19604
19605 -mabsdiff
19606 Enables the "abs" instruction, which is the absolute difference
19607 between two registers.
19608
19609 -mall-opts
19610 Enables all the optional instructions---average, multiply, divide,
19611 bit operations, leading zero, absolute difference, min/max, clip,
19612 and saturation.
19613
19614 -maverage
19615 Enables the "ave" instruction, which computes the average of two
19616 registers.
19617
19618 -mbased=n
19619 Variables of size n bytes or smaller are placed in the ".based"
19620 section by default. Based variables use the $tp register as a base
19621 register, and there is a 128-byte limit to the ".based" section.
19622
19623 -mbitops
19624 Enables the bit operation instructions---bit test ("btstm"), set
19625 ("bsetm"), clear ("bclrm"), invert ("bnotm"), and test-and-set
19626 ("tas").
19627
19628 -mc=name
19629 Selects which section constant data is placed in. name may be
19630 tiny, near, or far.
19631
19632 -mclip
19633 Enables the "clip" instruction. Note that -mclip is not useful
19634 unless you also provide -mminmax.
19635
19636 -mconfig=name
19637 Selects one of the built-in core configurations. Each MeP chip has
19638 one or more modules in it; each module has a core CPU and a variety
19639 of coprocessors, optional instructions, and peripherals. The
19640 "MeP-Integrator" tool, not part of GCC, provides these
19641 configurations through this option; using this option is the same
19642 as using all the corresponding command-line options. The default
19643 configuration is default.
19644
19645 -mcop
19646 Enables the coprocessor instructions. By default, this is a 32-bit
19647 coprocessor. Note that the coprocessor is normally enabled via the
19648 -mconfig= option.
19649
19650 -mcop32
19651 Enables the 32-bit coprocessor's instructions.
19652
19653 -mcop64
19654 Enables the 64-bit coprocessor's instructions.
19655
19656 -mivc2
19657 Enables IVC2 scheduling. IVC2 is a 64-bit VLIW coprocessor.
19658
19659 -mdc
19660 Causes constant variables to be placed in the ".near" section.
19661
19662 -mdiv
19663 Enables the "div" and "divu" instructions.
19664
19665 -meb
19666 Generate big-endian code.
19667
19668 -mel
19669 Generate little-endian code.
19670
19671 -mio-volatile
19672 Tells the compiler that any variable marked with the "io" attribute
19673 is to be considered volatile.
19674
19675 -ml Causes variables to be assigned to the ".far" section by default.
19676
19677 -mleadz
19678 Enables the "leadz" (leading zero) instruction.
19679
19680 -mm Causes variables to be assigned to the ".near" section by default.
19681
19682 -mminmax
19683 Enables the "min" and "max" instructions.
19684
19685 -mmult
19686 Enables the multiplication and multiply-accumulate instructions.
19687
19688 -mno-opts
19689 Disables all the optional instructions enabled by -mall-opts.
19690
19691 -mrepeat
19692 Enables the "repeat" and "erepeat" instructions, used for low-
19693 overhead looping.
19694
19695 -ms Causes all variables to default to the ".tiny" section. Note that
19696 there is a 65536-byte limit to this section. Accesses to these
19697 variables use the %gp base register.
19698
19699 -msatur
19700 Enables the saturation instructions. Note that the compiler does
19701 not currently generate these itself, but this option is included
19702 for compatibility with other tools, like "as".
19703
19704 -msdram
19705 Link the SDRAM-based runtime instead of the default ROM-based
19706 runtime.
19707
19708 -msim
19709 Link the simulator run-time libraries.
19710
19711 -msimnovec
19712 Link the simulator runtime libraries, excluding built-in support
19713 for reset and exception vectors and tables.
19714
19715 -mtf
19716 Causes all functions to default to the ".far" section. Without
19717 this option, functions default to the ".near" section.
19718
19719 -mtiny=n
19720 Variables that are n bytes or smaller are allocated to the ".tiny"
19721 section. These variables use the $gp base register. The default
19722 for this option is 4, but note that there's a 65536-byte limit to
19723 the ".tiny" section.
19724
19725 MicroBlaze Options
19726
19727 -msoft-float
19728 Use software emulation for floating point (default).
19729
19730 -mhard-float
19731 Use hardware floating-point instructions.
19732
19733 -mmemcpy
19734 Do not optimize block moves, use "memcpy".
19735
19736 -mno-clearbss
19737 This option is deprecated. Use -fno-zero-initialized-in-bss
19738 instead.
19739
19740 -mcpu=cpu-type
19741 Use features of, and schedule code for, the given CPU. Supported
19742 values are in the format vX.YY.Z, where X is a major version, YY is
19743 the minor version, and Z is compatibility code. Example values are
19744 v3.00.a, v4.00.b, v5.00.a, v5.00.b, v6.00.a.
19745
19746 -mxl-soft-mul
19747 Use software multiply emulation (default).
19748
19749 -mxl-soft-div
19750 Use software emulation for divides (default).
19751
19752 -mxl-barrel-shift
19753 Use the hardware barrel shifter.
19754
19755 -mxl-pattern-compare
19756 Use pattern compare instructions.
19757
19758 -msmall-divides
19759 Use table lookup optimization for small signed integer divisions.
19760
19761 -mxl-stack-check
19762 This option is deprecated. Use -fstack-check instead.
19763
19764 -mxl-gp-opt
19765 Use GP-relative ".sdata"/".sbss" sections.
19766
19767 -mxl-multiply-high
19768 Use multiply high instructions for high part of 32x32 multiply.
19769
19770 -mxl-float-convert
19771 Use hardware floating-point conversion instructions.
19772
19773 -mxl-float-sqrt
19774 Use hardware floating-point square root instruction.
19775
19776 -mbig-endian
19777 Generate code for a big-endian target.
19778
19779 -mlittle-endian
19780 Generate code for a little-endian target.
19781
19782 -mxl-reorder
19783 Use reorder instructions (swap and byte reversed load/store).
19784
19785 -mxl-mode-app-model
19786 Select application model app-model. Valid models are
19787
19788 executable
19789 normal executable (default), uses startup code crt0.o.
19790
19791 -mpic-data-is-text-relative
19792 Assume that the displacement between the text and data segments
19793 is fixed at static link time. This allows data to be
19794 referenced by offset from start of text address instead of GOT
19795 since PC-relative addressing is not supported.
19796
19797 xmdstub
19798 for use with Xilinx Microprocessor Debugger (XMD) based
19799 software intrusive debug agent called xmdstub. This uses
19800 startup file crt1.o and sets the start address of the program
19801 to 0x800.
19802
19803 bootstrap
19804 for applications that are loaded using a bootloader. This
19805 model uses startup file crt2.o which does not contain a
19806 processor reset vector handler. This is suitable for
19807 transferring control on a processor reset to the bootloader
19808 rather than the application.
19809
19810 novectors
19811 for applications that do not require any of the MicroBlaze
19812 vectors. This option may be useful for applications running
19813 within a monitoring application. This model uses crt3.o as a
19814 startup file.
19815
19816 Option -xl-mode-app-model is a deprecated alias for -mxl-mode-app-
19817 model.
19818
19819 MIPS Options
19820
19821 -EB Generate big-endian code.
19822
19823 -EL Generate little-endian code. This is the default for mips*el-*-*
19824 configurations.
19825
19826 -march=arch
19827 Generate code that runs on arch, which can be the name of a generic
19828 MIPS ISA, or the name of a particular processor. The ISA names
19829 are: mips1, mips2, mips3, mips4, mips32, mips32r2, mips32r3,
19830 mips32r5, mips32r6, mips64, mips64r2, mips64r3, mips64r5 and
19831 mips64r6. The processor names are: 4kc, 4km, 4kp, 4ksc, 4kec,
19832 4kem, 4kep, 4ksd, 5kc, 5kf, 20kc, 24kc, 24kf2_1, 24kf1_1, 24kec,
19833 24kef2_1, 24kef1_1, 34kc, 34kf2_1, 34kf1_1, 34kn, 74kc, 74kf2_1,
19834 74kf1_1, 74kf3_2, 1004kc, 1004kf2_1, 1004kf1_1, i6400, i6500,
19835 interaptiv, loongson2e, loongson2f, loongson3a, gs464, gs464e,
19836 gs264e, m4k, m14k, m14kc, m14ke, m14kec, m5100, m5101, octeon,
19837 octeon+, octeon2, octeon3, orion, p5600, p6600, r2000, r3000,
19838 r3900, r4000, r4400, r4600, r4650, r4700, r5900, r6000, r8000,
19839 rm7000, rm9000, r10000, r12000, r14000, r16000, sb1, sr71000,
19840 vr4100, vr4111, vr4120, vr4130, vr4300, vr5000, vr5400, vr5500, xlr
19841 and xlp. The special value from-abi selects the most compatible
19842 architecture for the selected ABI (that is, mips1 for 32-bit ABIs
19843 and mips3 for 64-bit ABIs).
19844
19845 The native Linux/GNU toolchain also supports the value native,
19846 which selects the best architecture option for the host processor.
19847 -march=native has no effect if GCC does not recognize the
19848 processor.
19849
19850 In processor names, a final 000 can be abbreviated as k (for
19851 example, -march=r2k). Prefixes are optional, and vr may be written
19852 r.
19853
19854 Names of the form nf2_1 refer to processors with FPUs clocked at
19855 half the rate of the core, names of the form nf1_1 refer to
19856 processors with FPUs clocked at the same rate as the core, and
19857 names of the form nf3_2 refer to processors with FPUs clocked a
19858 ratio of 3:2 with respect to the core. For compatibility reasons,
19859 nf is accepted as a synonym for nf2_1 while nx and bfx are accepted
19860 as synonyms for nf1_1.
19861
19862 GCC defines two macros based on the value of this option. The
19863 first is "_MIPS_ARCH", which gives the name of target architecture,
19864 as a string. The second has the form "_MIPS_ARCH_foo", where foo
19865 is the capitalized value of "_MIPS_ARCH". For example,
19866 -march=r2000 sets "_MIPS_ARCH" to "r2000" and defines the macro
19867 "_MIPS_ARCH_R2000".
19868
19869 Note that the "_MIPS_ARCH" macro uses the processor names given
19870 above. In other words, it has the full prefix and does not
19871 abbreviate 000 as k. In the case of from-abi, the macro names the
19872 resolved architecture (either "mips1" or "mips3"). It names the
19873 default architecture when no -march option is given.
19874
19875 -mtune=arch
19876 Optimize for arch. Among other things, this option controls the
19877 way instructions are scheduled, and the perceived cost of
19878 arithmetic operations. The list of arch values is the same as for
19879 -march.
19880
19881 When this option is not used, GCC optimizes for the processor
19882 specified by -march. By using -march and -mtune together, it is
19883 possible to generate code that runs on a family of processors, but
19884 optimize the code for one particular member of that family.
19885
19886 -mtune defines the macros "_MIPS_TUNE" and "_MIPS_TUNE_foo", which
19887 work in the same way as the -march ones described above.
19888
19889 -mips1
19890 Equivalent to -march=mips1.
19891
19892 -mips2
19893 Equivalent to -march=mips2.
19894
19895 -mips3
19896 Equivalent to -march=mips3.
19897
19898 -mips4
19899 Equivalent to -march=mips4.
19900
19901 -mips32
19902 Equivalent to -march=mips32.
19903
19904 -mips32r3
19905 Equivalent to -march=mips32r3.
19906
19907 -mips32r5
19908 Equivalent to -march=mips32r5.
19909
19910 -mips32r6
19911 Equivalent to -march=mips32r6.
19912
19913 -mips64
19914 Equivalent to -march=mips64.
19915
19916 -mips64r2
19917 Equivalent to -march=mips64r2.
19918
19919 -mips64r3
19920 Equivalent to -march=mips64r3.
19921
19922 -mips64r5
19923 Equivalent to -march=mips64r5.
19924
19925 -mips64r6
19926 Equivalent to -march=mips64r6.
19927
19928 -mips16
19929 -mno-mips16
19930 Generate (do not generate) MIPS16 code. If GCC is targeting a
19931 MIPS32 or MIPS64 architecture, it makes use of the MIPS16e ASE.
19932
19933 MIPS16 code generation can also be controlled on a per-function
19934 basis by means of "mips16" and "nomips16" attributes.
19935
19936 -mflip-mips16
19937 Generate MIPS16 code on alternating functions. This option is
19938 provided for regression testing of mixed MIPS16/non-MIPS16 code
19939 generation, and is not intended for ordinary use in compiling user
19940 code.
19941
19942 -minterlink-compressed
19943 -mno-interlink-compressed
19944 Require (do not require) that code using the standard
19945 (uncompressed) MIPS ISA be link-compatible with MIPS16 and
19946 microMIPS code, and vice versa.
19947
19948 For example, code using the standard ISA encoding cannot jump
19949 directly to MIPS16 or microMIPS code; it must either use a call or
19950 an indirect jump. -minterlink-compressed therefore disables direct
19951 jumps unless GCC knows that the target of the jump is not
19952 compressed.
19953
19954 -minterlink-mips16
19955 -mno-interlink-mips16
19956 Aliases of -minterlink-compressed and -mno-interlink-compressed.
19957 These options predate the microMIPS ASE and are retained for
19958 backwards compatibility.
19959
19960 -mabi=32
19961 -mabi=o64
19962 -mabi=n32
19963 -mabi=64
19964 -mabi=eabi
19965 Generate code for the given ABI.
19966
19967 Note that the EABI has a 32-bit and a 64-bit variant. GCC normally
19968 generates 64-bit code when you select a 64-bit architecture, but
19969 you can use -mgp32 to get 32-bit code instead.
19970
19971 For information about the O64 ABI, see
19972 <http://gcc.gnu.org/projects/mipso64-abi.html>.
19973
19974 GCC supports a variant of the o32 ABI in which floating-point
19975 registers are 64 rather than 32 bits wide. You can select this
19976 combination with -mabi=32 -mfp64. This ABI relies on the "mthc1"
19977 and "mfhc1" instructions and is therefore only supported for
19978 MIPS32R2, MIPS32R3 and MIPS32R5 processors.
19979
19980 The register assignments for arguments and return values remain the
19981 same, but each scalar value is passed in a single 64-bit register
19982 rather than a pair of 32-bit registers. For example, scalar
19983 floating-point values are returned in $f0 only, not a $f0/$f1 pair.
19984 The set of call-saved registers also remains the same in that the
19985 even-numbered double-precision registers are saved.
19986
19987 Two additional variants of the o32 ABI are supported to enable a
19988 transition from 32-bit to 64-bit registers. These are FPXX
19989 (-mfpxx) and FP64A (-mfp64 -mno-odd-spreg). The FPXX extension
19990 mandates that all code must execute correctly when run using 32-bit
19991 or 64-bit registers. The code can be interlinked with either FP32
19992 or FP64, but not both. The FP64A extension is similar to the FP64
19993 extension but forbids the use of odd-numbered single-precision
19994 registers. This can be used in conjunction with the "FRE" mode of
19995 FPUs in MIPS32R5 processors and allows both FP32 and FP64A code to
19996 interlink and run in the same process without changing FPU modes.
19997
19998 -mabicalls
19999 -mno-abicalls
20000 Generate (do not generate) code that is suitable for SVR4-style
20001 dynamic objects. -mabicalls is the default for SVR4-based systems.
20002
20003 -mshared
20004 -mno-shared
20005 Generate (do not generate) code that is fully position-independent,
20006 and that can therefore be linked into shared libraries. This
20007 option only affects -mabicalls.
20008
20009 All -mabicalls code has traditionally been position-independent,
20010 regardless of options like -fPIC and -fpic. However, as an
20011 extension, the GNU toolchain allows executables to use absolute
20012 accesses for locally-binding symbols. It can also use shorter GP
20013 initialization sequences and generate direct calls to locally-
20014 defined functions. This mode is selected by -mno-shared.
20015
20016 -mno-shared depends on binutils 2.16 or higher and generates
20017 objects that can only be linked by the GNU linker. However, the
20018 option does not affect the ABI of the final executable; it only
20019 affects the ABI of relocatable objects. Using -mno-shared
20020 generally makes executables both smaller and quicker.
20021
20022 -mshared is the default.
20023
20024 -mplt
20025 -mno-plt
20026 Assume (do not assume) that the static and dynamic linkers support
20027 PLTs and copy relocations. This option only affects -mno-shared
20028 -mabicalls. For the n64 ABI, this option has no effect without
20029 -msym32.
20030
20031 You can make -mplt the default by configuring GCC with
20032 --with-mips-plt. The default is -mno-plt otherwise.
20033
20034 -mxgot
20035 -mno-xgot
20036 Lift (do not lift) the usual restrictions on the size of the global
20037 offset table.
20038
20039 GCC normally uses a single instruction to load values from the GOT.
20040 While this is relatively efficient, it only works if the GOT is
20041 smaller than about 64k. Anything larger causes the linker to
20042 report an error such as:
20043
20044 relocation truncated to fit: R_MIPS_GOT16 foobar
20045
20046 If this happens, you should recompile your code with -mxgot. This
20047 works with very large GOTs, although the code is also less
20048 efficient, since it takes three instructions to fetch the value of
20049 a global symbol.
20050
20051 Note that some linkers can create multiple GOTs. If you have such
20052 a linker, you should only need to use -mxgot when a single object
20053 file accesses more than 64k's worth of GOT entries. Very few do.
20054
20055 These options have no effect unless GCC is generating position
20056 independent code.
20057
20058 -mgp32
20059 Assume that general-purpose registers are 32 bits wide.
20060
20061 -mgp64
20062 Assume that general-purpose registers are 64 bits wide.
20063
20064 -mfp32
20065 Assume that floating-point registers are 32 bits wide.
20066
20067 -mfp64
20068 Assume that floating-point registers are 64 bits wide.
20069
20070 -mfpxx
20071 Do not assume the width of floating-point registers.
20072
20073 -mhard-float
20074 Use floating-point coprocessor instructions.
20075
20076 -msoft-float
20077 Do not use floating-point coprocessor instructions. Implement
20078 floating-point calculations using library calls instead.
20079
20080 -mno-float
20081 Equivalent to -msoft-float, but additionally asserts that the
20082 program being compiled does not perform any floating-point
20083 operations. This option is presently supported only by some bare-
20084 metal MIPS configurations, where it may select a special set of
20085 libraries that lack all floating-point support (including, for
20086 example, the floating-point "printf" formats). If code compiled
20087 with -mno-float accidentally contains floating-point operations, it
20088 is likely to suffer a link-time or run-time failure.
20089
20090 -msingle-float
20091 Assume that the floating-point coprocessor only supports single-
20092 precision operations.
20093
20094 -mdouble-float
20095 Assume that the floating-point coprocessor supports double-
20096 precision operations. This is the default.
20097
20098 -modd-spreg
20099 -mno-odd-spreg
20100 Enable the use of odd-numbered single-precision floating-point
20101 registers for the o32 ABI. This is the default for processors that
20102 are known to support these registers. When using the o32 FPXX ABI,
20103 -mno-odd-spreg is set by default.
20104
20105 -mabs=2008
20106 -mabs=legacy
20107 These options control the treatment of the special not-a-number
20108 (NaN) IEEE 754 floating-point data with the "abs.fmt" and "neg.fmt"
20109 machine instructions.
20110
20111 By default or when -mabs=legacy is used the legacy treatment is
20112 selected. In this case these instructions are considered
20113 arithmetic and avoided where correct operation is required and the
20114 input operand might be a NaN. A longer sequence of instructions
20115 that manipulate the sign bit of floating-point datum manually is
20116 used instead unless the -ffinite-math-only option has also been
20117 specified.
20118
20119 The -mabs=2008 option selects the IEEE 754-2008 treatment. In this
20120 case these instructions are considered non-arithmetic and therefore
20121 operating correctly in all cases, including in particular where the
20122 input operand is a NaN. These instructions are therefore always
20123 used for the respective operations.
20124
20125 -mnan=2008
20126 -mnan=legacy
20127 These options control the encoding of the special not-a-number
20128 (NaN) IEEE 754 floating-point data.
20129
20130 The -mnan=legacy option selects the legacy encoding. In this case
20131 quiet NaNs (qNaNs) are denoted by the first bit of their trailing
20132 significand field being 0, whereas signaling NaNs (sNaNs) are
20133 denoted by the first bit of their trailing significand field being
20134 1.
20135
20136 The -mnan=2008 option selects the IEEE 754-2008 encoding. In this
20137 case qNaNs are denoted by the first bit of their trailing
20138 significand field being 1, whereas sNaNs are denoted by the first
20139 bit of their trailing significand field being 0.
20140
20141 The default is -mnan=legacy unless GCC has been configured with
20142 --with-nan=2008.
20143
20144 -mllsc
20145 -mno-llsc
20146 Use (do not use) ll, sc, and sync instructions to implement atomic
20147 memory built-in functions. When neither option is specified, GCC
20148 uses the instructions if the target architecture supports them.
20149
20150 -mllsc is useful if the runtime environment can emulate the
20151 instructions and -mno-llsc can be useful when compiling for
20152 nonstandard ISAs. You can make either option the default by
20153 configuring GCC with --with-llsc and --without-llsc respectively.
20154 --with-llsc is the default for some configurations; see the
20155 installation documentation for details.
20156
20157 -mdsp
20158 -mno-dsp
20159 Use (do not use) revision 1 of the MIPS DSP ASE.
20160 This option defines the preprocessor macro "__mips_dsp". It also
20161 defines "__mips_dsp_rev" to 1.
20162
20163 -mdspr2
20164 -mno-dspr2
20165 Use (do not use) revision 2 of the MIPS DSP ASE.
20166 This option defines the preprocessor macros "__mips_dsp" and
20167 "__mips_dspr2". It also defines "__mips_dsp_rev" to 2.
20168
20169 -msmartmips
20170 -mno-smartmips
20171 Use (do not use) the MIPS SmartMIPS ASE.
20172
20173 -mpaired-single
20174 -mno-paired-single
20175 Use (do not use) paired-single floating-point instructions.
20176 This option requires hardware floating-point support to be
20177 enabled.
20178
20179 -mdmx
20180 -mno-mdmx
20181 Use (do not use) MIPS Digital Media Extension instructions. This
20182 option can only be used when generating 64-bit code and requires
20183 hardware floating-point support to be enabled.
20184
20185 -mips3d
20186 -mno-mips3d
20187 Use (do not use) the MIPS-3D ASE. The option -mips3d implies
20188 -mpaired-single.
20189
20190 -mmicromips
20191 -mno-micromips
20192 Generate (do not generate) microMIPS code.
20193
20194 MicroMIPS code generation can also be controlled on a per-function
20195 basis by means of "micromips" and "nomicromips" attributes.
20196
20197 -mmt
20198 -mno-mt
20199 Use (do not use) MT Multithreading instructions.
20200
20201 -mmcu
20202 -mno-mcu
20203 Use (do not use) the MIPS MCU ASE instructions.
20204
20205 -meva
20206 -mno-eva
20207 Use (do not use) the MIPS Enhanced Virtual Addressing instructions.
20208
20209 -mvirt
20210 -mno-virt
20211 Use (do not use) the MIPS Virtualization (VZ) instructions.
20212
20213 -mxpa
20214 -mno-xpa
20215 Use (do not use) the MIPS eXtended Physical Address (XPA)
20216 instructions.
20217
20218 -mcrc
20219 -mno-crc
20220 Use (do not use) the MIPS Cyclic Redundancy Check (CRC)
20221 instructions.
20222
20223 -mginv
20224 -mno-ginv
20225 Use (do not use) the MIPS Global INValidate (GINV) instructions.
20226
20227 -mloongson-mmi
20228 -mno-loongson-mmi
20229 Use (do not use) the MIPS Loongson MultiMedia extensions
20230 Instructions (MMI).
20231
20232 -mloongson-ext
20233 -mno-loongson-ext
20234 Use (do not use) the MIPS Loongson EXTensions (EXT) instructions.
20235
20236 -mloongson-ext2
20237 -mno-loongson-ext2
20238 Use (do not use) the MIPS Loongson EXTensions r2 (EXT2)
20239 instructions.
20240
20241 -mlong64
20242 Force "long" types to be 64 bits wide. See -mlong32 for an
20243 explanation of the default and the way that the pointer size is
20244 determined.
20245
20246 -mlong32
20247 Force "long", "int", and pointer types to be 32 bits wide.
20248
20249 The default size of "int"s, "long"s and pointers depends on the
20250 ABI. All the supported ABIs use 32-bit "int"s. The n64 ABI uses
20251 64-bit "long"s, as does the 64-bit EABI; the others use 32-bit
20252 "long"s. Pointers are the same size as "long"s, or the same size
20253 as integer registers, whichever is smaller.
20254
20255 -msym32
20256 -mno-sym32
20257 Assume (do not assume) that all symbols have 32-bit values,
20258 regardless of the selected ABI. This option is useful in
20259 combination with -mabi=64 and -mno-abicalls because it allows GCC
20260 to generate shorter and faster references to symbolic addresses.
20261
20262 -G num
20263 Put definitions of externally-visible data in a small data section
20264 if that data is no bigger than num bytes. GCC can then generate
20265 more efficient accesses to the data; see -mgpopt for details.
20266
20267 The default -G option depends on the configuration.
20268
20269 -mlocal-sdata
20270 -mno-local-sdata
20271 Extend (do not extend) the -G behavior to local data too, such as
20272 to static variables in C. -mlocal-sdata is the default for all
20273 configurations.
20274
20275 If the linker complains that an application is using too much small
20276 data, you might want to try rebuilding the less performance-
20277 critical parts with -mno-local-sdata. You might also want to build
20278 large libraries with -mno-local-sdata, so that the libraries leave
20279 more room for the main program.
20280
20281 -mextern-sdata
20282 -mno-extern-sdata
20283 Assume (do not assume) that externally-defined data is in a small
20284 data section if the size of that data is within the -G limit.
20285 -mextern-sdata is the default for all configurations.
20286
20287 If you compile a module Mod with -mextern-sdata -G num -mgpopt, and
20288 Mod references a variable Var that is no bigger than num bytes, you
20289 must make sure that Var is placed in a small data section. If Var
20290 is defined by another module, you must either compile that module
20291 with a high-enough -G setting or attach a "section" attribute to
20292 Var's definition. If Var is common, you must link the application
20293 with a high-enough -G setting.
20294
20295 The easiest way of satisfying these restrictions is to compile and
20296 link every module with the same -G option. However, you may wish
20297 to build a library that supports several different small data
20298 limits. You can do this by compiling the library with the highest
20299 supported -G setting and additionally using -mno-extern-sdata to
20300 stop the library from making assumptions about externally-defined
20301 data.
20302
20303 -mgpopt
20304 -mno-gpopt
20305 Use (do not use) GP-relative accesses for symbols that are known to
20306 be in a small data section; see -G, -mlocal-sdata and
20307 -mextern-sdata. -mgpopt is the default for all configurations.
20308
20309 -mno-gpopt is useful for cases where the $gp register might not
20310 hold the value of "_gp". For example, if the code is part of a
20311 library that might be used in a boot monitor, programs that call
20312 boot monitor routines pass an unknown value in $gp. (In such
20313 situations, the boot monitor itself is usually compiled with -G0.)
20314
20315 -mno-gpopt implies -mno-local-sdata and -mno-extern-sdata.
20316
20317 -membedded-data
20318 -mno-embedded-data
20319 Allocate variables to the read-only data section first if possible,
20320 then next in the small data section if possible, otherwise in data.
20321 This gives slightly slower code than the default, but reduces the
20322 amount of RAM required when executing, and thus may be preferred
20323 for some embedded systems.
20324
20325 -muninit-const-in-rodata
20326 -mno-uninit-const-in-rodata
20327 Put uninitialized "const" variables in the read-only data section.
20328 This option is only meaningful in conjunction with -membedded-data.
20329
20330 -mcode-readable=setting
20331 Specify whether GCC may generate code that reads from executable
20332 sections. There are three possible settings:
20333
20334 -mcode-readable=yes
20335 Instructions may freely access executable sections. This is
20336 the default setting.
20337
20338 -mcode-readable=pcrel
20339 MIPS16 PC-relative load instructions can access executable
20340 sections, but other instructions must not do so. This option
20341 is useful on 4KSc and 4KSd processors when the code TLBs have
20342 the Read Inhibit bit set. It is also useful on processors that
20343 can be configured to have a dual instruction/data SRAM
20344 interface and that, like the M4K, automatically redirect PC-
20345 relative loads to the instruction RAM.
20346
20347 -mcode-readable=no
20348 Instructions must not access executable sections. This option
20349 can be useful on targets that are configured to have a dual
20350 instruction/data SRAM interface but that (unlike the M4K) do
20351 not automatically redirect PC-relative loads to the instruction
20352 RAM.
20353
20354 -msplit-addresses
20355 -mno-split-addresses
20356 Enable (disable) use of the "%hi()" and "%lo()" assembler
20357 relocation operators. This option has been superseded by
20358 -mexplicit-relocs but is retained for backwards compatibility.
20359
20360 -mexplicit-relocs
20361 -mno-explicit-relocs
20362 Use (do not use) assembler relocation operators when dealing with
20363 symbolic addresses. The alternative, selected by
20364 -mno-explicit-relocs, is to use assembler macros instead.
20365
20366 -mexplicit-relocs is the default if GCC was configured to use an
20367 assembler that supports relocation operators.
20368
20369 -mcheck-zero-division
20370 -mno-check-zero-division
20371 Trap (do not trap) on integer division by zero.
20372
20373 The default is -mcheck-zero-division.
20374
20375 -mdivide-traps
20376 -mdivide-breaks
20377 MIPS systems check for division by zero by generating either a
20378 conditional trap or a break instruction. Using traps results in
20379 smaller code, but is only supported on MIPS II and later. Also,
20380 some versions of the Linux kernel have a bug that prevents trap
20381 from generating the proper signal ("SIGFPE"). Use -mdivide-traps
20382 to allow conditional traps on architectures that support them and
20383 -mdivide-breaks to force the use of breaks.
20384
20385 The default is usually -mdivide-traps, but this can be overridden
20386 at configure time using --with-divide=breaks. Divide-by-zero
20387 checks can be completely disabled using -mno-check-zero-division.
20388
20389 -mload-store-pairs
20390 -mno-load-store-pairs
20391 Enable (disable) an optimization that pairs consecutive load or
20392 store instructions to enable load/store bonding. This option is
20393 enabled by default but only takes effect when the selected
20394 architecture is known to support bonding.
20395
20396 -mmemcpy
20397 -mno-memcpy
20398 Force (do not force) the use of "memcpy" for non-trivial block
20399 moves. The default is -mno-memcpy, which allows GCC to inline most
20400 constant-sized copies.
20401
20402 -mlong-calls
20403 -mno-long-calls
20404 Disable (do not disable) use of the "jal" instruction. Calling
20405 functions using "jal" is more efficient but requires the caller and
20406 callee to be in the same 256 megabyte segment.
20407
20408 This option has no effect on abicalls code. The default is
20409 -mno-long-calls.
20410
20411 -mmad
20412 -mno-mad
20413 Enable (disable) use of the "mad", "madu" and "mul" instructions,
20414 as provided by the R4650 ISA.
20415
20416 -mimadd
20417 -mno-imadd
20418 Enable (disable) use of the "madd" and "msub" integer instructions.
20419 The default is -mimadd on architectures that support "madd" and
20420 "msub" except for the 74k architecture where it was found to
20421 generate slower code.
20422
20423 -mfused-madd
20424 -mno-fused-madd
20425 Enable (disable) use of the floating-point multiply-accumulate
20426 instructions, when they are available. The default is
20427 -mfused-madd.
20428
20429 On the R8000 CPU when multiply-accumulate instructions are used,
20430 the intermediate product is calculated to infinite precision and is
20431 not subject to the FCSR Flush to Zero bit. This may be undesirable
20432 in some circumstances. On other processors the result is
20433 numerically identical to the equivalent computation using separate
20434 multiply, add, subtract and negate instructions.
20435
20436 -nocpp
20437 Tell the MIPS assembler to not run its preprocessor over user
20438 assembler files (with a .s suffix) when assembling them.
20439
20440 -mfix-24k
20441 -mno-fix-24k
20442 Work around the 24K E48 (lost data on stores during refill) errata.
20443 The workarounds are implemented by the assembler rather than by
20444 GCC.
20445
20446 -mfix-r4000
20447 -mno-fix-r4000
20448 Work around certain R4000 CPU errata:
20449
20450 - A double-word or a variable shift may give an incorrect result
20451 if executed immediately after starting an integer division.
20452
20453 - A double-word or a variable shift may give an incorrect result
20454 if executed while an integer multiplication is in progress.
20455
20456 - An integer division may give an incorrect result if started in
20457 a delay slot of a taken branch or a jump.
20458
20459 -mfix-r4400
20460 -mno-fix-r4400
20461 Work around certain R4400 CPU errata:
20462
20463 - A double-word or a variable shift may give an incorrect result
20464 if executed immediately after starting an integer division.
20465
20466 -mfix-r10000
20467 -mno-fix-r10000
20468 Work around certain R10000 errata:
20469
20470 - "ll"/"sc" sequences may not behave atomically on revisions
20471 prior to 3.0. They may deadlock on revisions 2.6 and earlier.
20472
20473 This option can only be used if the target architecture supports
20474 branch-likely instructions. -mfix-r10000 is the default when
20475 -march=r10000 is used; -mno-fix-r10000 is the default otherwise.
20476
20477 -mfix-r5900
20478 -mno-fix-r5900
20479 Do not attempt to schedule the preceding instruction into the delay
20480 slot of a branch instruction placed at the end of a short loop of
20481 six instructions or fewer and always schedule a "nop" instruction
20482 there instead. The short loop bug under certain conditions causes
20483 loops to execute only once or twice, due to a hardware bug in the
20484 R5900 chip. The workaround is implemented by the assembler rather
20485 than by GCC.
20486
20487 -mfix-rm7000
20488 -mno-fix-rm7000
20489 Work around the RM7000 "dmult"/"dmultu" errata. The workarounds
20490 are implemented by the assembler rather than by GCC.
20491
20492 -mfix-vr4120
20493 -mno-fix-vr4120
20494 Work around certain VR4120 errata:
20495
20496 - "dmultu" does not always produce the correct result.
20497
20498 - "div" and "ddiv" do not always produce the correct result if
20499 one of the operands is negative.
20500
20501 The workarounds for the division errata rely on special functions
20502 in libgcc.a. At present, these functions are only provided by the
20503 "mips64vr*-elf" configurations.
20504
20505 Other VR4120 errata require a NOP to be inserted between certain
20506 pairs of instructions. These errata are handled by the assembler,
20507 not by GCC itself.
20508
20509 -mfix-vr4130
20510 Work around the VR4130 "mflo"/"mfhi" errata. The workarounds are
20511 implemented by the assembler rather than by GCC, although GCC
20512 avoids using "mflo" and "mfhi" if the VR4130 "macc", "macchi",
20513 "dmacc" and "dmacchi" instructions are available instead.
20514
20515 -mfix-sb1
20516 -mno-fix-sb1
20517 Work around certain SB-1 CPU core errata. (This flag currently
20518 works around the SB-1 revision 2 "F1" and "F2" floating-point
20519 errata.)
20520
20521 -mr10k-cache-barrier=setting
20522 Specify whether GCC should insert cache barriers to avoid the side
20523 effects of speculation on R10K processors.
20524
20525 In common with many processors, the R10K tries to predict the
20526 outcome of a conditional branch and speculatively executes
20527 instructions from the "taken" branch. It later aborts these
20528 instructions if the predicted outcome is wrong. However, on the
20529 R10K, even aborted instructions can have side effects.
20530
20531 This problem only affects kernel stores and, depending on the
20532 system, kernel loads. As an example, a speculatively-executed
20533 store may load the target memory into cache and mark the cache line
20534 as dirty, even if the store itself is later aborted. If a DMA
20535 operation writes to the same area of memory before the "dirty" line
20536 is flushed, the cached data overwrites the DMA-ed data. See the
20537 R10K processor manual for a full description, including other
20538 potential problems.
20539
20540 One workaround is to insert cache barrier instructions before every
20541 memory access that might be speculatively executed and that might
20542 have side effects even if aborted. -mr10k-cache-barrier=setting
20543 controls GCC's implementation of this workaround. It assumes that
20544 aborted accesses to any byte in the following regions does not have
20545 side effects:
20546
20547 1. the memory occupied by the current function's stack frame;
20548
20549 2. the memory occupied by an incoming stack argument;
20550
20551 3. the memory occupied by an object with a link-time-constant
20552 address.
20553
20554 It is the kernel's responsibility to ensure that speculative
20555 accesses to these regions are indeed safe.
20556
20557 If the input program contains a function declaration such as:
20558
20559 void foo (void);
20560
20561 then the implementation of "foo" must allow "j foo" and "jal foo"
20562 to be executed speculatively. GCC honors this restriction for
20563 functions it compiles itself. It expects non-GCC functions (such
20564 as hand-written assembly code) to do the same.
20565
20566 The option has three forms:
20567
20568 -mr10k-cache-barrier=load-store
20569 Insert a cache barrier before a load or store that might be
20570 speculatively executed and that might have side effects even if
20571 aborted.
20572
20573 -mr10k-cache-barrier=store
20574 Insert a cache barrier before a store that might be
20575 speculatively executed and that might have side effects even if
20576 aborted.
20577
20578 -mr10k-cache-barrier=none
20579 Disable the insertion of cache barriers. This is the default
20580 setting.
20581
20582 -mflush-func=func
20583 -mno-flush-func
20584 Specifies the function to call to flush the I and D caches, or to
20585 not call any such function. If called, the function must take the
20586 same arguments as the common "_flush_func", that is, the address of
20587 the memory range for which the cache is being flushed, the size of
20588 the memory range, and the number 3 (to flush both caches). The
20589 default depends on the target GCC was configured for, but commonly
20590 is either "_flush_func" or "__cpu_flush".
20591
20592 mbranch-cost=num
20593 Set the cost of branches to roughly num "simple" instructions.
20594 This cost is only a heuristic and is not guaranteed to produce
20595 consistent results across releases. A zero cost redundantly
20596 selects the default, which is based on the -mtune setting.
20597
20598 -mbranch-likely
20599 -mno-branch-likely
20600 Enable or disable use of Branch Likely instructions, regardless of
20601 the default for the selected architecture. By default, Branch
20602 Likely instructions may be generated if they are supported by the
20603 selected architecture. An exception is for the MIPS32 and MIPS64
20604 architectures and processors that implement those architectures;
20605 for those, Branch Likely instructions are not be generated by
20606 default because the MIPS32 and MIPS64 architectures specifically
20607 deprecate their use.
20608
20609 -mcompact-branches=never
20610 -mcompact-branches=optimal
20611 -mcompact-branches=always
20612 These options control which form of branches will be generated.
20613 The default is -mcompact-branches=optimal.
20614
20615 The -mcompact-branches=never option ensures that compact branch
20616 instructions will never be generated.
20617
20618 The -mcompact-branches=always option ensures that a compact branch
20619 instruction will be generated if available. If a compact branch
20620 instruction is not available, a delay slot form of the branch will
20621 be used instead.
20622
20623 This option is supported from MIPS Release 6 onwards.
20624
20625 The -mcompact-branches=optimal option will cause a delay slot
20626 branch to be used if one is available in the current ISA and the
20627 delay slot is successfully filled. If the delay slot is not
20628 filled, a compact branch will be chosen if one is available.
20629
20630 -mfp-exceptions
20631 -mno-fp-exceptions
20632 Specifies whether FP exceptions are enabled. This affects how FP
20633 instructions are scheduled for some processors. The default is
20634 that FP exceptions are enabled.
20635
20636 For instance, on the SB-1, if FP exceptions are disabled, and we
20637 are emitting 64-bit code, then we can use both FP pipes.
20638 Otherwise, we can only use one FP pipe.
20639
20640 -mvr4130-align
20641 -mno-vr4130-align
20642 The VR4130 pipeline is two-way superscalar, but can only issue two
20643 instructions together if the first one is 8-byte aligned. When
20644 this option is enabled, GCC aligns pairs of instructions that it
20645 thinks should execute in parallel.
20646
20647 This option only has an effect when optimizing for the VR4130. It
20648 normally makes code faster, but at the expense of making it bigger.
20649 It is enabled by default at optimization level -O3.
20650
20651 -msynci
20652 -mno-synci
20653 Enable (disable) generation of "synci" instructions on
20654 architectures that support it. The "synci" instructions (if
20655 enabled) are generated when "__builtin___clear_cache" is compiled.
20656
20657 This option defaults to -mno-synci, but the default can be
20658 overridden by configuring GCC with --with-synci.
20659
20660 When compiling code for single processor systems, it is generally
20661 safe to use "synci". However, on many multi-core (SMP) systems, it
20662 does not invalidate the instruction caches on all cores and may
20663 lead to undefined behavior.
20664
20665 -mrelax-pic-calls
20666 -mno-relax-pic-calls
20667 Try to turn PIC calls that are normally dispatched via register $25
20668 into direct calls. This is only possible if the linker can resolve
20669 the destination at link time and if the destination is within range
20670 for a direct call.
20671
20672 -mrelax-pic-calls is the default if GCC was configured to use an
20673 assembler and a linker that support the ".reloc" assembly directive
20674 and -mexplicit-relocs is in effect. With -mno-explicit-relocs,
20675 this optimization can be performed by the assembler and the linker
20676 alone without help from the compiler.
20677
20678 -mmcount-ra-address
20679 -mno-mcount-ra-address
20680 Emit (do not emit) code that allows "_mcount" to modify the calling
20681 function's return address. When enabled, this option extends the
20682 usual "_mcount" interface with a new ra-address parameter, which
20683 has type "intptr_t *" and is passed in register $12. "_mcount" can
20684 then modify the return address by doing both of the following:
20685
20686 * Returning the new address in register $31.
20687
20688 * Storing the new address in "*ra-address", if ra-address is
20689 nonnull.
20690
20691 The default is -mno-mcount-ra-address.
20692
20693 -mframe-header-opt
20694 -mno-frame-header-opt
20695 Enable (disable) frame header optimization in the o32 ABI. When
20696 using the o32 ABI, calling functions will allocate 16 bytes on the
20697 stack for the called function to write out register arguments.
20698 When enabled, this optimization will suppress the allocation of the
20699 frame header if it can be determined that it is unused.
20700
20701 This optimization is off by default at all optimization levels.
20702
20703 -mlxc1-sxc1
20704 -mno-lxc1-sxc1
20705 When applicable, enable (disable) the generation of "lwxc1",
20706 "swxc1", "ldxc1", "sdxc1" instructions. Enabled by default.
20707
20708 -mmadd4
20709 -mno-madd4
20710 When applicable, enable (disable) the generation of 4-operand
20711 "madd.s", "madd.d" and related instructions. Enabled by default.
20712
20713 MMIX Options
20714
20715 These options are defined for the MMIX:
20716
20717 -mlibfuncs
20718 -mno-libfuncs
20719 Specify that intrinsic library functions are being compiled,
20720 passing all values in registers, no matter the size.
20721
20722 -mepsilon
20723 -mno-epsilon
20724 Generate floating-point comparison instructions that compare with
20725 respect to the "rE" epsilon register.
20726
20727 -mabi=mmixware
20728 -mabi=gnu
20729 Generate code that passes function parameters and return values
20730 that (in the called function) are seen as registers $0 and up, as
20731 opposed to the GNU ABI which uses global registers $231 and up.
20732
20733 -mzero-extend
20734 -mno-zero-extend
20735 When reading data from memory in sizes shorter than 64 bits, use
20736 (do not use) zero-extending load instructions by default, rather
20737 than sign-extending ones.
20738
20739 -mknuthdiv
20740 -mno-knuthdiv
20741 Make the result of a division yielding a remainder have the same
20742 sign as the divisor. With the default, -mno-knuthdiv, the sign of
20743 the remainder follows the sign of the dividend. Both methods are
20744 arithmetically valid, the latter being almost exclusively used.
20745
20746 -mtoplevel-symbols
20747 -mno-toplevel-symbols
20748 Prepend (do not prepend) a : to all global symbols, so the assembly
20749 code can be used with the "PREFIX" assembly directive.
20750
20751 -melf
20752 Generate an executable in the ELF format, rather than the default
20753 mmo format used by the mmix simulator.
20754
20755 -mbranch-predict
20756 -mno-branch-predict
20757 Use (do not use) the probable-branch instructions, when static
20758 branch prediction indicates a probable branch.
20759
20760 -mbase-addresses
20761 -mno-base-addresses
20762 Generate (do not generate) code that uses base addresses. Using a
20763 base address automatically generates a request (handled by the
20764 assembler and the linker) for a constant to be set up in a global
20765 register. The register is used for one or more base address
20766 requests within the range 0 to 255 from the value held in the
20767 register. The generally leads to short and fast code, but the
20768 number of different data items that can be addressed is limited.
20769 This means that a program that uses lots of static data may require
20770 -mno-base-addresses.
20771
20772 -msingle-exit
20773 -mno-single-exit
20774 Force (do not force) generated code to have a single exit point in
20775 each function.
20776
20777 MN10300 Options
20778
20779 These -m options are defined for Matsushita MN10300 architectures:
20780
20781 -mmult-bug
20782 Generate code to avoid bugs in the multiply instructions for the
20783 MN10300 processors. This is the default.
20784
20785 -mno-mult-bug
20786 Do not generate code to avoid bugs in the multiply instructions for
20787 the MN10300 processors.
20788
20789 -mam33
20790 Generate code using features specific to the AM33 processor.
20791
20792 -mno-am33
20793 Do not generate code using features specific to the AM33 processor.
20794 This is the default.
20795
20796 -mam33-2
20797 Generate code using features specific to the AM33/2.0 processor.
20798
20799 -mam34
20800 Generate code using features specific to the AM34 processor.
20801
20802 -mtune=cpu-type
20803 Use the timing characteristics of the indicated CPU type when
20804 scheduling instructions. This does not change the targeted
20805 processor type. The CPU type must be one of mn10300, am33, am33-2
20806 or am34.
20807
20808 -mreturn-pointer-on-d0
20809 When generating a function that returns a pointer, return the
20810 pointer in both "a0" and "d0". Otherwise, the pointer is returned
20811 only in "a0", and attempts to call such functions without a
20812 prototype result in errors. Note that this option is on by
20813 default; use -mno-return-pointer-on-d0 to disable it.
20814
20815 -mno-crt0
20816 Do not link in the C run-time initialization object file.
20817
20818 -mrelax
20819 Indicate to the linker that it should perform a relaxation
20820 optimization pass to shorten branches, calls and absolute memory
20821 addresses. This option only has an effect when used on the command
20822 line for the final link step.
20823
20824 This option makes symbolic debugging impossible.
20825
20826 -mliw
20827 Allow the compiler to generate Long Instruction Word instructions
20828 if the target is the AM33 or later. This is the default. This
20829 option defines the preprocessor macro "__LIW__".
20830
20831 -mno-liw
20832 Do not allow the compiler to generate Long Instruction Word
20833 instructions. This option defines the preprocessor macro
20834 "__NO_LIW__".
20835
20836 -msetlb
20837 Allow the compiler to generate the SETLB and Lcc instructions if
20838 the target is the AM33 or later. This is the default. This option
20839 defines the preprocessor macro "__SETLB__".
20840
20841 -mno-setlb
20842 Do not allow the compiler to generate SETLB or Lcc instructions.
20843 This option defines the preprocessor macro "__NO_SETLB__".
20844
20845 Moxie Options
20846
20847 -meb
20848 Generate big-endian code. This is the default for moxie-*-*
20849 configurations.
20850
20851 -mel
20852 Generate little-endian code.
20853
20854 -mmul.x
20855 Generate mul.x and umul.x instructions. This is the default for
20856 moxiebox-*-* configurations.
20857
20858 -mno-crt0
20859 Do not link in the C run-time initialization object file.
20860
20861 MSP430 Options
20862
20863 These options are defined for the MSP430:
20864
20865 -masm-hex
20866 Force assembly output to always use hex constants. Normally such
20867 constants are signed decimals, but this option is available for
20868 testsuite and/or aesthetic purposes.
20869
20870 -mmcu=
20871 Select the MCU to target. This is used to create a C preprocessor
20872 symbol based upon the MCU name, converted to upper case and pre-
20873 and post-fixed with __. This in turn is used by the msp430.h
20874 header file to select an MCU-specific supplementary header file.
20875
20876 The option also sets the ISA to use. If the MCU name is one that
20877 is known to only support the 430 ISA then that is selected,
20878 otherwise the 430X ISA is selected. A generic MCU name of msp430
20879 can also be used to select the 430 ISA. Similarly the generic
20880 msp430x MCU name selects the 430X ISA.
20881
20882 In addition an MCU-specific linker script is added to the linker
20883 command line. The script's name is the name of the MCU with .ld
20884 appended. Thus specifying -mmcu=xxx on the gcc command line
20885 defines the C preprocessor symbol "__XXX__" and cause the linker to
20886 search for a script called xxx.ld.
20887
20888 The ISA and hardware multiply supported for the different MCUs is
20889 hard-coded into GCC. However, an external devices.csv file can be
20890 used to extend device support beyond those that have been hard-
20891 coded.
20892
20893 GCC searches for the devices.csv file using the following methods
20894 in the given precedence order, where the first method takes
20895 precendence over the second which takes precedence over the third.
20896
20897 Include path specified with "-I" and "-L"
20898 devices.csv will be searched for in each of the directories
20899 specified by include paths and linker library search paths.
20900
20901 Path specified by the environment variable MSP430_GCC_INCLUDE_DIR
20902 Define the value of the global environment variable
20903 MSP430_GCC_INCLUDE_DIR to the full path to the directory
20904 containing devices.csv, and GCC will search this directory for
20905 devices.csv. If devices.csv is found, this directory will also
20906 be registered as an include path, and linker library path.
20907 Header files and linker scripts in this directory can therefore
20908 be used without manually specifying "-I" and "-L" on the
20909 command line.
20910
20911 The msp430-elf{,bare}/include/devices directory
20912 Finally, GCC will examine msp430-elf{,bare}/include/devices
20913 from the toolchain root directory. This directory does not
20914 exist in a default installation, but if the user has created it
20915 and copied devices.csv there, then the MCU data will be read.
20916 As above, this directory will also be registered as an include
20917 path, and linker library path.
20918
20919 If none of the above search methods find devices.csv, then the
20920 hard-coded MCU data is used.
20921
20922 -mwarn-mcu
20923 -mno-warn-mcu
20924 This option enables or disables warnings about conflicts between
20925 the MCU name specified by the -mmcu option and the ISA set by the
20926 -mcpu option and/or the hardware multiply support set by the
20927 -mhwmult option. It also toggles warnings about unrecognized MCU
20928 names. This option is on by default.
20929
20930 -mcpu=
20931 Specifies the ISA to use. Accepted values are msp430, msp430x and
20932 msp430xv2. This option is deprecated. The -mmcu= option should be
20933 used to select the ISA.
20934
20935 -msim
20936 Link to the simulator runtime libraries and linker script.
20937 Overrides any scripts that would be selected by the -mmcu= option.
20938
20939 -mlarge
20940 Use large-model addressing (20-bit pointers, 32-bit "size_t").
20941
20942 -msmall
20943 Use small-model addressing (16-bit pointers, 16-bit "size_t").
20944
20945 -mrelax
20946 This option is passed to the assembler and linker, and allows the
20947 linker to perform certain optimizations that cannot be done until
20948 the final link.
20949
20950 mhwmult=
20951 Describes the type of hardware multiply supported by the target.
20952 Accepted values are none for no hardware multiply, 16bit for the
20953 original 16-bit-only multiply supported by early MCUs. 32bit for
20954 the 16/32-bit multiply supported by later MCUs and f5series for the
20955 16/32-bit multiply supported by F5-series MCUs. A value of auto
20956 can also be given. This tells GCC to deduce the hardware multiply
20957 support based upon the MCU name provided by the -mmcu option. If
20958 no -mmcu option is specified or if the MCU name is not recognized
20959 then no hardware multiply support is assumed. "auto" is the
20960 default setting.
20961
20962 Hardware multiplies are normally performed by calling a library
20963 routine. This saves space in the generated code. When compiling
20964 at -O3 or higher however the hardware multiplier is invoked inline.
20965 This makes for bigger, but faster code.
20966
20967 The hardware multiply routines disable interrupts whilst running
20968 and restore the previous interrupt state when they finish. This
20969 makes them safe to use inside interrupt handlers as well as in
20970 normal code.
20971
20972 -minrt
20973 Enable the use of a minimum runtime environment - no static
20974 initializers or constructors. This is intended for memory-
20975 constrained devices. The compiler includes special symbols in some
20976 objects that tell the linker and runtime which code fragments are
20977 required.
20978
20979 -mtiny-printf
20980 Enable reduced code size "printf" and "puts" library functions.
20981 The tiny implementations of these functions are not reentrant, so
20982 must be used with caution in multi-threaded applications.
20983
20984 Support for streams has been removed and the string to be printed
20985 will always be sent to stdout via the "write" syscall. The string
20986 is not buffered before it is sent to write.
20987
20988 This option requires Newlib Nano IO, so GCC must be configured with
20989 --enable-newlib-nano-formatted-io.
20990
20991 -mcode-region=
20992 -mdata-region=
20993 These options tell the compiler where to place functions and data
20994 that do not have one of the "lower", "upper", "either" or "section"
20995 attributes. Possible values are "lower", "upper", "either" or
20996 "any". The first three behave like the corresponding attribute.
20997 The fourth possible value - "any" - is the default. It leaves
20998 placement entirely up to the linker script and how it assigns the
20999 standard sections (".text", ".data", etc) to the memory regions.
21000
21001 -msilicon-errata=
21002 This option passes on a request to assembler to enable the fixes
21003 for the named silicon errata.
21004
21005 -msilicon-errata-warn=
21006 This option passes on a request to the assembler to enable warning
21007 messages when a silicon errata might need to be applied.
21008
21009 -mwarn-devices-csv
21010 -mno-warn-devices-csv
21011 Warn if devices.csv is not found or there are problem parsing it
21012 (default: on).
21013
21014 NDS32 Options
21015
21016 These options are defined for NDS32 implementations:
21017
21018 -mbig-endian
21019 Generate code in big-endian mode.
21020
21021 -mlittle-endian
21022 Generate code in little-endian mode.
21023
21024 -mreduced-regs
21025 Use reduced-set registers for register allocation.
21026
21027 -mfull-regs
21028 Use full-set registers for register allocation.
21029
21030 -mcmov
21031 Generate conditional move instructions.
21032
21033 -mno-cmov
21034 Do not generate conditional move instructions.
21035
21036 -mext-perf
21037 Generate performance extension instructions.
21038
21039 -mno-ext-perf
21040 Do not generate performance extension instructions.
21041
21042 -mext-perf2
21043 Generate performance extension 2 instructions.
21044
21045 -mno-ext-perf2
21046 Do not generate performance extension 2 instructions.
21047
21048 -mext-string
21049 Generate string extension instructions.
21050
21051 -mno-ext-string
21052 Do not generate string extension instructions.
21053
21054 -mv3push
21055 Generate v3 push25/pop25 instructions.
21056
21057 -mno-v3push
21058 Do not generate v3 push25/pop25 instructions.
21059
21060 -m16-bit
21061 Generate 16-bit instructions.
21062
21063 -mno-16-bit
21064 Do not generate 16-bit instructions.
21065
21066 -misr-vector-size=num
21067 Specify the size of each interrupt vector, which must be 4 or 16.
21068
21069 -mcache-block-size=num
21070 Specify the size of each cache block, which must be a power of 2
21071 between 4 and 512.
21072
21073 -march=arch
21074 Specify the name of the target architecture.
21075
21076 -mcmodel=code-model
21077 Set the code model to one of
21078
21079 small
21080 All the data and read-only data segments must be within 512KB
21081 addressing space. The text segment must be within 16MB
21082 addressing space.
21083
21084 medium
21085 The data segment must be within 512KB while the read-only data
21086 segment can be within 4GB addressing space. The text segment
21087 should be still within 16MB addressing space.
21088
21089 large
21090 All the text and data segments can be within 4GB addressing
21091 space.
21092
21093 -mctor-dtor
21094 Enable constructor/destructor feature.
21095
21096 -mrelax
21097 Guide linker to relax instructions.
21098
21099 Nios II Options
21100
21101 These are the options defined for the Altera Nios II processor.
21102
21103 -G num
21104 Put global and static objects less than or equal to num bytes into
21105 the small data or BSS sections instead of the normal data or BSS
21106 sections. The default value of num is 8.
21107
21108 -mgpopt=option
21109 -mgpopt
21110 -mno-gpopt
21111 Generate (do not generate) GP-relative accesses. The following
21112 option names are recognized:
21113
21114 none
21115 Do not generate GP-relative accesses.
21116
21117 local
21118 Generate GP-relative accesses for small data objects that are
21119 not external, weak, or uninitialized common symbols. Also use
21120 GP-relative addressing for objects that have been explicitly
21121 placed in a small data section via a "section" attribute.
21122
21123 global
21124 As for local, but also generate GP-relative accesses for small
21125 data objects that are external, weak, or common. If you use
21126 this option, you must ensure that all parts of your program
21127 (including libraries) are compiled with the same -G setting.
21128
21129 data
21130 Generate GP-relative accesses for all data objects in the
21131 program. If you use this option, the entire data and BSS
21132 segments of your program must fit in 64K of memory and you must
21133 use an appropriate linker script to allocate them within the
21134 addressable range of the global pointer.
21135
21136 all Generate GP-relative addresses for function pointers as well as
21137 data pointers. If you use this option, the entire text, data,
21138 and BSS segments of your program must fit in 64K of memory and
21139 you must use an appropriate linker script to allocate them
21140 within the addressable range of the global pointer.
21141
21142 -mgpopt is equivalent to -mgpopt=local, and -mno-gpopt is
21143 equivalent to -mgpopt=none.
21144
21145 The default is -mgpopt except when -fpic or -fPIC is specified to
21146 generate position-independent code. Note that the Nios II ABI does
21147 not permit GP-relative accesses from shared libraries.
21148
21149 You may need to specify -mno-gpopt explicitly when building
21150 programs that include large amounts of small data, including large
21151 GOT data sections. In this case, the 16-bit offset for GP-relative
21152 addressing may not be large enough to allow access to the entire
21153 small data section.
21154
21155 -mgprel-sec=regexp
21156 This option specifies additional section names that can be accessed
21157 via GP-relative addressing. It is most useful in conjunction with
21158 "section" attributes on variable declarations and a custom linker
21159 script. The regexp is a POSIX Extended Regular Expression.
21160
21161 This option does not affect the behavior of the -G option, and the
21162 specified sections are in addition to the standard ".sdata" and
21163 ".sbss" small-data sections that are recognized by -mgpopt.
21164
21165 -mr0rel-sec=regexp
21166 This option specifies names of sections that can be accessed via a
21167 16-bit offset from "r0"; that is, in the low 32K or high 32K of the
21168 32-bit address space. It is most useful in conjunction with
21169 "section" attributes on variable declarations and a custom linker
21170 script. The regexp is a POSIX Extended Regular Expression.
21171
21172 In contrast to the use of GP-relative addressing for small data,
21173 zero-based addressing is never generated by default and there are
21174 no conventional section names used in standard linker scripts for
21175 sections in the low or high areas of memory.
21176
21177 -mel
21178 -meb
21179 Generate little-endian (default) or big-endian (experimental) code,
21180 respectively.
21181
21182 -march=arch
21183 This specifies the name of the target Nios II architecture. GCC
21184 uses this name to determine what kind of instructions it can emit
21185 when generating assembly code. Permissible names are: r1, r2.
21186
21187 The preprocessor macro "__nios2_arch__" is available to programs,
21188 with value 1 or 2, indicating the targeted ISA level.
21189
21190 -mbypass-cache
21191 -mno-bypass-cache
21192 Force all load and store instructions to always bypass cache by
21193 using I/O variants of the instructions. The default is not to
21194 bypass the cache.
21195
21196 -mno-cache-volatile
21197 -mcache-volatile
21198 Volatile memory access bypass the cache using the I/O variants of
21199 the load and store instructions. The default is not to bypass the
21200 cache.
21201
21202 -mno-fast-sw-div
21203 -mfast-sw-div
21204 Do not use table-based fast divide for small numbers. The default
21205 is to use the fast divide at -O3 and above.
21206
21207 -mno-hw-mul
21208 -mhw-mul
21209 -mno-hw-mulx
21210 -mhw-mulx
21211 -mno-hw-div
21212 -mhw-div
21213 Enable or disable emitting "mul", "mulx" and "div" family of
21214 instructions by the compiler. The default is to emit "mul" and not
21215 emit "div" and "mulx".
21216
21217 -mbmx
21218 -mno-bmx
21219 -mcdx
21220 -mno-cdx
21221 Enable or disable generation of Nios II R2 BMX (bit manipulation)
21222 and CDX (code density) instructions. Enabling these instructions
21223 also requires -march=r2. Since these instructions are optional
21224 extensions to the R2 architecture, the default is not to emit them.
21225
21226 -mcustom-insn=N
21227 -mno-custom-insn
21228 Each -mcustom-insn=N option enables use of a custom instruction
21229 with encoding N when generating code that uses insn. For example,
21230 -mcustom-fadds=253 generates custom instruction 253 for single-
21231 precision floating-point add operations instead of the default
21232 behavior of using a library call.
21233
21234 The following values of insn are supported. Except as otherwise
21235 noted, floating-point operations are expected to be implemented
21236 with normal IEEE 754 semantics and correspond directly to the C
21237 operators or the equivalent GCC built-in functions.
21238
21239 Single-precision floating point:
21240
21241 fadds, fsubs, fdivs, fmuls
21242 Binary arithmetic operations.
21243
21244 fnegs
21245 Unary negation.
21246
21247 fabss
21248 Unary absolute value.
21249
21250 fcmpeqs, fcmpges, fcmpgts, fcmples, fcmplts, fcmpnes
21251 Comparison operations.
21252
21253 fmins, fmaxs
21254 Floating-point minimum and maximum. These instructions are
21255 only generated if -ffinite-math-only is specified.
21256
21257 fsqrts
21258 Unary square root operation.
21259
21260 fcoss, fsins, ftans, fatans, fexps, flogs
21261 Floating-point trigonometric and exponential functions. These
21262 instructions are only generated if -funsafe-math-optimizations
21263 is also specified.
21264
21265 Double-precision floating point:
21266
21267 faddd, fsubd, fdivd, fmuld
21268 Binary arithmetic operations.
21269
21270 fnegd
21271 Unary negation.
21272
21273 fabsd
21274 Unary absolute value.
21275
21276 fcmpeqd, fcmpged, fcmpgtd, fcmpled, fcmpltd, fcmpned
21277 Comparison operations.
21278
21279 fmind, fmaxd
21280 Double-precision minimum and maximum. These instructions are
21281 only generated if -ffinite-math-only is specified.
21282
21283 fsqrtd
21284 Unary square root operation.
21285
21286 fcosd, fsind, ftand, fatand, fexpd, flogd
21287 Double-precision trigonometric and exponential functions.
21288 These instructions are only generated if
21289 -funsafe-math-optimizations is also specified.
21290
21291 Conversions:
21292
21293 fextsd
21294 Conversion from single precision to double precision.
21295
21296 ftruncds
21297 Conversion from double precision to single precision.
21298
21299 fixsi, fixsu, fixdi, fixdu
21300 Conversion from floating point to signed or unsigned integer
21301 types, with truncation towards zero.
21302
21303 round
21304 Conversion from single-precision floating point to signed
21305 integer, rounding to the nearest integer and ties away from
21306 zero. This corresponds to the "__builtin_lroundf" function
21307 when -fno-math-errno is used.
21308
21309 floatis, floatus, floatid, floatud
21310 Conversion from signed or unsigned integer types to floating-
21311 point types.
21312
21313 In addition, all of the following transfer instructions for
21314 internal registers X and Y must be provided to use any of the
21315 double-precision floating-point instructions. Custom instructions
21316 taking two double-precision source operands expect the first
21317 operand in the 64-bit register X. The other operand (or only
21318 operand of a unary operation) is given to the custom arithmetic
21319 instruction with the least significant half in source register src1
21320 and the most significant half in src2. A custom instruction that
21321 returns a double-precision result returns the most significant 32
21322 bits in the destination register and the other half in 32-bit
21323 register Y. GCC automatically generates the necessary code
21324 sequences to write register X and/or read register Y when double-
21325 precision floating-point instructions are used.
21326
21327 fwrx
21328 Write src1 into the least significant half of X and src2 into
21329 the most significant half of X.
21330
21331 fwry
21332 Write src1 into Y.
21333
21334 frdxhi, frdxlo
21335 Read the most or least (respectively) significant half of X and
21336 store it in dest.
21337
21338 frdy
21339 Read the value of Y and store it into dest.
21340
21341 Note that you can gain more local control over generation of Nios
21342 II custom instructions by using the "target("custom-insn=N")" and
21343 "target("no-custom-insn")" function attributes or pragmas.
21344
21345 -mcustom-fpu-cfg=name
21346 This option enables a predefined, named set of custom instruction
21347 encodings (see -mcustom-insn above). Currently, the following sets
21348 are defined:
21349
21350 -mcustom-fpu-cfg=60-1 is equivalent to: -mcustom-fmuls=252
21351 -mcustom-fadds=253 -mcustom-fsubs=254 -fsingle-precision-constant
21352
21353 -mcustom-fpu-cfg=60-2 is equivalent to: -mcustom-fmuls=252
21354 -mcustom-fadds=253 -mcustom-fsubs=254 -mcustom-fdivs=255
21355 -fsingle-precision-constant
21356
21357 -mcustom-fpu-cfg=72-3 is equivalent to: -mcustom-floatus=243
21358 -mcustom-fixsi=244 -mcustom-floatis=245 -mcustom-fcmpgts=246
21359 -mcustom-fcmples=249 -mcustom-fcmpeqs=250 -mcustom-fcmpnes=251
21360 -mcustom-fmuls=252 -mcustom-fadds=253 -mcustom-fsubs=254
21361 -mcustom-fdivs=255 -fsingle-precision-constant
21362
21363 Custom instruction assignments given by individual -mcustom-insn=
21364 options override those given by -mcustom-fpu-cfg=, regardless of
21365 the order of the options on the command line.
21366
21367 Note that you can gain more local control over selection of a FPU
21368 configuration by using the "target("custom-fpu-cfg=name")" function
21369 attribute or pragma.
21370
21371 These additional -m options are available for the Altera Nios II ELF
21372 (bare-metal) target:
21373
21374 -mhal
21375 Link with HAL BSP. This suppresses linking with the GCC-provided C
21376 runtime startup and termination code, and is typically used in
21377 conjunction with -msys-crt0= to specify the location of the
21378 alternate startup code provided by the HAL BSP.
21379
21380 -msmallc
21381 Link with a limited version of the C library, -lsmallc, rather than
21382 Newlib.
21383
21384 -msys-crt0=startfile
21385 startfile is the file name of the startfile (crt0) to use when
21386 linking. This option is only useful in conjunction with -mhal.
21387
21388 -msys-lib=systemlib
21389 systemlib is the library name of the library that provides low-
21390 level system calls required by the C library, e.g. "read" and
21391 "write". This option is typically used to link with a library
21392 provided by a HAL BSP.
21393
21394 Nvidia PTX Options
21395
21396 These options are defined for Nvidia PTX:
21397
21398 -m32
21399 -m64
21400 Generate code for 32-bit or 64-bit ABI.
21401
21402 -misa=ISA-string
21403 Generate code for given the specified PTX ISA (e.g. sm_35). ISA
21404 strings must be lower-case. Valid ISA strings include sm_30 and
21405 sm_35. The default ISA is sm_30.
21406
21407 -mmainkernel
21408 Link in code for a __main kernel. This is for stand-alone instead
21409 of offloading execution.
21410
21411 -moptimize
21412 Apply partitioned execution optimizations. This is the default
21413 when any level of optimization is selected.
21414
21415 -msoft-stack
21416 Generate code that does not use ".local" memory directly for stack
21417 storage. Instead, a per-warp stack pointer is maintained
21418 explicitly. This enables variable-length stack allocation (with
21419 variable-length arrays or "alloca"), and when global memory is used
21420 for underlying storage, makes it possible to access automatic
21421 variables from other threads, or with atomic instructions. This
21422 code generation variant is used for OpenMP offloading, but the
21423 option is exposed on its own for the purpose of testing the
21424 compiler; to generate code suitable for linking into programs using
21425 OpenMP offloading, use option -mgomp.
21426
21427 -muniform-simt
21428 Switch to code generation variant that allows to execute all
21429 threads in each warp, while maintaining memory state and side
21430 effects as if only one thread in each warp was active outside of
21431 OpenMP SIMD regions. All atomic operations and calls to runtime
21432 (malloc, free, vprintf) are conditionally executed (iff current
21433 lane index equals the master lane index), and the register being
21434 assigned is copied via a shuffle instruction from the master lane.
21435 Outside of SIMD regions lane 0 is the master; inside, each thread
21436 sees itself as the master. Shared memory array "int __nvptx_uni[]"
21437 stores all-zeros or all-ones bitmasks for each warp, indicating
21438 current mode (0 outside of SIMD regions). Each thread can bitwise-
21439 and the bitmask at position "tid.y" with current lane index to
21440 compute the master lane index.
21441
21442 -mgomp
21443 Generate code for use in OpenMP offloading: enables -msoft-stack
21444 and -muniform-simt options, and selects corresponding multilib
21445 variant.
21446
21447 OpenRISC Options
21448
21449 These options are defined for OpenRISC:
21450
21451 -mboard=name
21452 Configure a board specific runtime. This will be passed to the
21453 linker for newlib board library linking. The default is "or1ksim".
21454
21455 -mnewlib
21456 This option is ignored; it is for compatibility purposes only.
21457 This used to select linker and preprocessor options for use with
21458 newlib.
21459
21460 -msoft-div
21461 -mhard-div
21462 Select software or hardware divide ("l.div", "l.divu")
21463 instructions. This default is hardware divide.
21464
21465 -msoft-mul
21466 -mhard-mul
21467 Select software or hardware multiply ("l.mul", "l.muli")
21468 instructions. This default is hardware multiply.
21469
21470 -msoft-float
21471 -mhard-float
21472 Select software or hardware for floating point operations. The
21473 default is software.
21474
21475 -mdouble-float
21476 When -mhard-float is selected, enables generation of double-
21477 precision floating point instructions. By default functions from
21478 libgcc are used to perform double-precision floating point
21479 operations.
21480
21481 -munordered-float
21482 When -mhard-float is selected, enables generation of unordered
21483 floating point compare and set flag ("lf.sfun*") instructions. By
21484 default functions from libgcc are used to perform unordered
21485 floating point compare and set flag operations.
21486
21487 -mcmov
21488 Enable generation of conditional move ("l.cmov") instructions. By
21489 default the equivalent will be generated using set and branch.
21490
21491 -mror
21492 Enable generation of rotate right ("l.ror") instructions. By
21493 default functions from libgcc are used to perform rotate right
21494 operations.
21495
21496 -mrori
21497 Enable generation of rotate right with immediate ("l.rori")
21498 instructions. By default functions from libgcc are used to perform
21499 rotate right with immediate operations.
21500
21501 -msext
21502 Enable generation of sign extension ("l.ext*") instructions. By
21503 default memory loads are used to perform sign extension.
21504
21505 -msfimm
21506 Enable generation of compare and set flag with immediate ("l.sf*i")
21507 instructions. By default extra instructions will be generated to
21508 store the immediate to a register first.
21509
21510 -mshftimm
21511 Enable generation of shift with immediate ("l.srai", "l.srli",
21512 "l.slli") instructions. By default extra instructions will be
21513 generated to store the immediate to a register first.
21514
21515 PDP-11 Options
21516
21517 These options are defined for the PDP-11:
21518
21519 -mfpu
21520 Use hardware FPP floating point. This is the default. (FIS
21521 floating point on the PDP-11/40 is not supported.) Implies -m45.
21522
21523 -msoft-float
21524 Do not use hardware floating point.
21525
21526 -mac0
21527 Return floating-point results in ac0 (fr0 in Unix assembler
21528 syntax).
21529
21530 -mno-ac0
21531 Return floating-point results in memory. This is the default.
21532
21533 -m40
21534 Generate code for a PDP-11/40. Implies -msoft-float -mno-split.
21535
21536 -m45
21537 Generate code for a PDP-11/45. This is the default.
21538
21539 -m10
21540 Generate code for a PDP-11/10. Implies -msoft-float -mno-split.
21541
21542 -mint16
21543 -mno-int32
21544 Use 16-bit "int". This is the default.
21545
21546 -mint32
21547 -mno-int16
21548 Use 32-bit "int".
21549
21550 -msplit
21551 Target has split instruction and data space. Implies -m45.
21552
21553 -munix-asm
21554 Use Unix assembler syntax.
21555
21556 -mdec-asm
21557 Use DEC assembler syntax.
21558
21559 -mgnu-asm
21560 Use GNU assembler syntax. This is the default.
21561
21562 -mlra
21563 Use the new LRA register allocator. By default, the old "reload"
21564 allocator is used.
21565
21566 picoChip Options
21567
21568 These -m options are defined for picoChip implementations:
21569
21570 -mae=ae_type
21571 Set the instruction set, register set, and instruction scheduling
21572 parameters for array element type ae_type. Supported values for
21573 ae_type are ANY, MUL, and MAC.
21574
21575 -mae=ANY selects a completely generic AE type. Code generated with
21576 this option runs on any of the other AE types. The code is not as
21577 efficient as it would be if compiled for a specific AE type, and
21578 some types of operation (e.g., multiplication) do not work properly
21579 on all types of AE.
21580
21581 -mae=MUL selects a MUL AE type. This is the most useful AE type
21582 for compiled code, and is the default.
21583
21584 -mae=MAC selects a DSP-style MAC AE. Code compiled with this
21585 option may suffer from poor performance of byte (char)
21586 manipulation, since the DSP AE does not provide hardware support
21587 for byte load/stores.
21588
21589 -msymbol-as-address
21590 Enable the compiler to directly use a symbol name as an address in
21591 a load/store instruction, without first loading it into a register.
21592 Typically, the use of this option generates larger programs, which
21593 run faster than when the option isn't used. However, the results
21594 vary from program to program, so it is left as a user option,
21595 rather than being permanently enabled.
21596
21597 -mno-inefficient-warnings
21598 Disables warnings about the generation of inefficient code. These
21599 warnings can be generated, for example, when compiling code that
21600 performs byte-level memory operations on the MAC AE type. The MAC
21601 AE has no hardware support for byte-level memory operations, so all
21602 byte load/stores must be synthesized from word load/store
21603 operations. This is inefficient and a warning is generated to
21604 indicate that you should rewrite the code to avoid byte operations,
21605 or to target an AE type that has the necessary hardware support.
21606 This option disables these warnings.
21607
21608 PowerPC Options
21609
21610 These are listed under
21611
21612 PRU Options
21613
21614 These command-line options are defined for PRU target:
21615
21616 -minrt
21617 Link with a minimum runtime environment, with no support for static
21618 initializers and constructors. Using this option can significantly
21619 reduce the size of the final ELF binary. Beware that the compiler
21620 could still generate code with static initializers and
21621 constructors. It is up to the programmer to ensure that the source
21622 program will not use those features.
21623
21624 -mmcu=mcu
21625 Specify the PRU MCU variant to use. Check Newlib for the exact
21626 list of supported MCUs.
21627
21628 -mno-relax
21629 Make GCC pass the --no-relax command-line option to the linker
21630 instead of the --relax option.
21631
21632 -mloop
21633 Allow (or do not allow) GCC to use the LOOP instruction.
21634
21635 -mabi=variant
21636 Specify the ABI variant to output code for. -mabi=ti selects the
21637 unmodified TI ABI while -mabi=gnu selects a GNU variant that copes
21638 more naturally with certain GCC assumptions. These are the
21639 differences:
21640
21641 Function Pointer Size
21642 TI ABI specifies that function (code) pointers are 16-bit,
21643 whereas GNU supports only 32-bit data and code pointers.
21644
21645 Optional Return Value Pointer
21646 Function return values larger than 64 bits are passed by using
21647 a hidden pointer as the first argument of the function. TI
21648 ABI, though, mandates that the pointer can be NULL in case the
21649 caller is not using the returned value. GNU always passes and
21650 expects a valid return value pointer.
21651
21652 The current -mabi=ti implementation simply raises a compile error
21653 when any of the above code constructs is detected. As a
21654 consequence the standard C library cannot be built and it is
21655 omitted when linking with -mabi=ti.
21656
21657 Relaxation is a GNU feature and for safety reasons is disabled when
21658 using -mabi=ti. The TI toolchain does not emit relocations for
21659 QBBx instructions, so the GNU linker cannot adjust them when
21660 shortening adjacent LDI32 pseudo instructions.
21661
21662 RISC-V Options
21663
21664 These command-line options are defined for RISC-V targets:
21665
21666 -mbranch-cost=n
21667 Set the cost of branches to roughly n instructions.
21668
21669 -mplt
21670 -mno-plt
21671 When generating PIC code, do or don't allow the use of PLTs.
21672 Ignored for non-PIC. The default is -mplt.
21673
21674 -mabi=ABI-string
21675 Specify integer and floating-point calling convention. ABI-string
21676 contains two parts: the size of integer types and the registers
21677 used for floating-point types. For example -march=rv64ifd
21678 -mabi=lp64d means that long and pointers are 64-bit (implicitly
21679 defining int to be 32-bit), and that floating-point values up to 64
21680 bits wide are passed in F registers. Contrast this with
21681 -march=rv64ifd -mabi=lp64f, which still allows the compiler to
21682 generate code that uses the F and D extensions but only allows
21683 floating-point values up to 32 bits long to be passed in registers;
21684 or -march=rv64ifd -mabi=lp64, in which no floating-point arguments
21685 will be passed in registers.
21686
21687 The default for this argument is system dependent, users who want a
21688 specific calling convention should specify one explicitly. The
21689 valid calling conventions are: ilp32, ilp32f, ilp32d, lp64, lp64f,
21690 and lp64d. Some calling conventions are impossible to implement on
21691 some ISAs: for example, -march=rv32if -mabi=ilp32d is invalid
21692 because the ABI requires 64-bit values be passed in F registers,
21693 but F registers are only 32 bits wide. There is also the ilp32e
21694 ABI that can only be used with the rv32e architecture. This ABI is
21695 not well specified at present, and is subject to change.
21696
21697 -mfdiv
21698 -mno-fdiv
21699 Do or don't use hardware floating-point divide and square root
21700 instructions. This requires the F or D extensions for floating-
21701 point registers. The default is to use them if the specified
21702 architecture has these instructions.
21703
21704 -mdiv
21705 -mno-div
21706 Do or don't use hardware instructions for integer division. This
21707 requires the M extension. The default is to use them if the
21708 specified architecture has these instructions.
21709
21710 -march=ISA-string
21711 Generate code for given RISC-V ISA (e.g. rv64im). ISA strings must
21712 be lower-case. Examples include rv64i, rv32g, rv32e, and rv32imaf.
21713
21714 -mtune=processor-string
21715 Optimize the output for the given processor, specified by
21716 microarchitecture name. Permissible values for this option are:
21717 rocket, sifive-3-series, sifive-5-series, sifive-7-series, and
21718 size.
21719
21720 When -mtune= is not specified, the default is rocket.
21721
21722 The size choice is not intended for use by end-users. This is used
21723 when -Os is specified. It overrides the instruction cost info
21724 provided by -mtune=, but does not override the pipeline info. This
21725 helps reduce code size while still giving good performance.
21726
21727 -mpreferred-stack-boundary=num
21728 Attempt to keep the stack boundary aligned to a 2 raised to num
21729 byte boundary. If -mpreferred-stack-boundary is not specified, the
21730 default is 4 (16 bytes or 128-bits).
21731
21732 Warning: If you use this switch, then you must build all modules
21733 with the same value, including any libraries. This includes the
21734 system libraries and startup modules.
21735
21736 -msmall-data-limit=n
21737 Put global and static data smaller than n bytes into a special
21738 section (on some targets).
21739
21740 -msave-restore
21741 -mno-save-restore
21742 Do or don't use smaller but slower prologue and epilogue code that
21743 uses library function calls. The default is to use fast inline
21744 prologues and epilogues.
21745
21746 -mstrict-align
21747 -mno-strict-align
21748 Do not or do generate unaligned memory accesses. The default is
21749 set depending on whether the processor we are optimizing for
21750 supports fast unaligned access or not.
21751
21752 -mcmodel=medlow
21753 Generate code for the medium-low code model. The program and its
21754 statically defined symbols must lie within a single 2 GiB address
21755 range and must lie between absolute addresses -2 GiB and +2 GiB.
21756 Programs can be statically or dynamically linked. This is the
21757 default code model.
21758
21759 -mcmodel=medany
21760 Generate code for the medium-any code model. The program and its
21761 statically defined symbols must be within any single 2 GiB address
21762 range. Programs can be statically or dynamically linked.
21763
21764 -mexplicit-relocs
21765 -mno-exlicit-relocs
21766 Use or do not use assembler relocation operators when dealing with
21767 symbolic addresses. The alternative is to use assembler macros
21768 instead, which may limit optimization.
21769
21770 -mrelax
21771 -mno-relax
21772 Take advantage of linker relaxations to reduce the number of
21773 instructions required to materialize symbol addresses. The default
21774 is to take advantage of linker relaxations.
21775
21776 -memit-attribute
21777 -mno-emit-attribute
21778 Emit (do not emit) RISC-V attribute to record extra information
21779 into ELF objects. This feature requires at least binutils 2.32.
21780
21781 -malign-data=type
21782 Control how GCC aligns variables and constants of array, structure,
21783 or union types. Supported values for type are xlen which uses x
21784 register width as the alignment value, and natural which uses
21785 natural alignment. xlen is the default.
21786
21787 RL78 Options
21788
21789 -msim
21790 Links in additional target libraries to support operation within a
21791 simulator.
21792
21793 -mmul=none
21794 -mmul=g10
21795 -mmul=g13
21796 -mmul=g14
21797 -mmul=rl78
21798 Specifies the type of hardware multiplication and division support
21799 to be used. The simplest is "none", which uses software for both
21800 multiplication and division. This is the default. The "g13" value
21801 is for the hardware multiply/divide peripheral found on the
21802 RL78/G13 (S2 core) targets. The "g14" value selects the use of the
21803 multiplication and division instructions supported by the RL78/G14
21804 (S3 core) parts. The value "rl78" is an alias for "g14" and the
21805 value "mg10" is an alias for "none".
21806
21807 In addition a C preprocessor macro is defined, based upon the
21808 setting of this option. Possible values are: "__RL78_MUL_NONE__",
21809 "__RL78_MUL_G13__" or "__RL78_MUL_G14__".
21810
21811 -mcpu=g10
21812 -mcpu=g13
21813 -mcpu=g14
21814 -mcpu=rl78
21815 Specifies the RL78 core to target. The default is the G14 core,
21816 also known as an S3 core or just RL78. The G13 or S2 core does not
21817 have multiply or divide instructions, instead it uses a hardware
21818 peripheral for these operations. The G10 or S1 core does not have
21819 register banks, so it uses a different calling convention.
21820
21821 If this option is set it also selects the type of hardware multiply
21822 support to use, unless this is overridden by an explicit -mmul=none
21823 option on the command line. Thus specifying -mcpu=g13 enables the
21824 use of the G13 hardware multiply peripheral and specifying
21825 -mcpu=g10 disables the use of hardware multiplications altogether.
21826
21827 Note, although the RL78/G14 core is the default target, specifying
21828 -mcpu=g14 or -mcpu=rl78 on the command line does change the
21829 behavior of the toolchain since it also enables G14 hardware
21830 multiply support. If these options are not specified on the
21831 command line then software multiplication routines will be used
21832 even though the code targets the RL78 core. This is for backwards
21833 compatibility with older toolchains which did not have hardware
21834 multiply and divide support.
21835
21836 In addition a C preprocessor macro is defined, based upon the
21837 setting of this option. Possible values are: "__RL78_G10__",
21838 "__RL78_G13__" or "__RL78_G14__".
21839
21840 -mg10
21841 -mg13
21842 -mg14
21843 -mrl78
21844 These are aliases for the corresponding -mcpu= option. They are
21845 provided for backwards compatibility.
21846
21847 -mallregs
21848 Allow the compiler to use all of the available registers. By
21849 default registers "r24..r31" are reserved for use in interrupt
21850 handlers. With this option enabled these registers can be used in
21851 ordinary functions as well.
21852
21853 -m64bit-doubles
21854 -m32bit-doubles
21855 Make the "double" data type be 64 bits (-m64bit-doubles) or 32 bits
21856 (-m32bit-doubles) in size. The default is -m32bit-doubles.
21857
21858 -msave-mduc-in-interrupts
21859 -mno-save-mduc-in-interrupts
21860 Specifies that interrupt handler functions should preserve the MDUC
21861 registers. This is only necessary if normal code might use the
21862 MDUC registers, for example because it performs multiplication and
21863 division operations. The default is to ignore the MDUC registers
21864 as this makes the interrupt handlers faster. The target option
21865 -mg13 needs to be passed for this to work as this feature is only
21866 available on the G13 target (S2 core). The MDUC registers will
21867 only be saved if the interrupt handler performs a multiplication or
21868 division operation or it calls another function.
21869
21870 IBM RS/6000 and PowerPC Options
21871
21872 These -m options are defined for the IBM RS/6000 and PowerPC:
21873
21874 -mpowerpc-gpopt
21875 -mno-powerpc-gpopt
21876 -mpowerpc-gfxopt
21877 -mno-powerpc-gfxopt
21878 -mpowerpc64
21879 -mno-powerpc64
21880 -mmfcrf
21881 -mno-mfcrf
21882 -mpopcntb
21883 -mno-popcntb
21884 -mpopcntd
21885 -mno-popcntd
21886 -mfprnd
21887 -mno-fprnd
21888 -mcmpb
21889 -mno-cmpb
21890 -mhard-dfp
21891 -mno-hard-dfp
21892 You use these options to specify which instructions are available
21893 on the processor you are using. The default value of these options
21894 is determined when configuring GCC. Specifying the -mcpu=cpu_type
21895 overrides the specification of these options. We recommend you use
21896 the -mcpu=cpu_type option rather than the options listed above.
21897
21898 Specifying -mpowerpc-gpopt allows GCC to use the optional PowerPC
21899 architecture instructions in the General Purpose group, including
21900 floating-point square root. Specifying -mpowerpc-gfxopt allows GCC
21901 to use the optional PowerPC architecture instructions in the
21902 Graphics group, including floating-point select.
21903
21904 The -mmfcrf option allows GCC to generate the move from condition
21905 register field instruction implemented on the POWER4 processor and
21906 other processors that support the PowerPC V2.01 architecture. The
21907 -mpopcntb option allows GCC to generate the popcount and double-
21908 precision FP reciprocal estimate instruction implemented on the
21909 POWER5 processor and other processors that support the PowerPC
21910 V2.02 architecture. The -mpopcntd option allows GCC to generate
21911 the popcount instruction implemented on the POWER7 processor and
21912 other processors that support the PowerPC V2.06 architecture. The
21913 -mfprnd option allows GCC to generate the FP round to integer
21914 instructions implemented on the POWER5+ processor and other
21915 processors that support the PowerPC V2.03 architecture. The -mcmpb
21916 option allows GCC to generate the compare bytes instruction
21917 implemented on the POWER6 processor and other processors that
21918 support the PowerPC V2.05 architecture. The -mhard-dfp option
21919 allows GCC to generate the decimal floating-point instructions
21920 implemented on some POWER processors.
21921
21922 The -mpowerpc64 option allows GCC to generate the additional 64-bit
21923 instructions that are found in the full PowerPC64 architecture and
21924 to treat GPRs as 64-bit, doubleword quantities. GCC defaults to
21925 -mno-powerpc64.
21926
21927 -mcpu=cpu_type
21928 Set architecture type, register usage, and instruction scheduling
21929 parameters for machine type cpu_type. Supported values for
21930 cpu_type are 401, 403, 405, 405fp, 440, 440fp, 464, 464fp, 476,
21931 476fp, 505, 601, 602, 603, 603e, 604, 604e, 620, 630, 740, 7400,
21932 7450, 750, 801, 821, 823, 860, 970, 8540, a2, e300c2, e300c3,
21933 e500mc, e500mc64, e5500, e6500, ec603e, G3, G4, G5, titan, power3,
21934 power4, power5, power5+, power6, power6x, power7, power8, power9,
21935 future, powerpc, powerpc64, powerpc64le, rs64, and native.
21936
21937 -mcpu=powerpc, -mcpu=powerpc64, and -mcpu=powerpc64le specify pure
21938 32-bit PowerPC (either endian), 64-bit big endian PowerPC and
21939 64-bit little endian PowerPC architecture machine types, with an
21940 appropriate, generic processor model assumed for scheduling
21941 purposes.
21942
21943 Specifying native as cpu type detects and selects the architecture
21944 option that corresponds to the host processor of the system
21945 performing the compilation. -mcpu=native has no effect if GCC does
21946 not recognize the processor.
21947
21948 The other options specify a specific processor. Code generated
21949 under those options runs best on that processor, and may not run at
21950 all on others.
21951
21952 The -mcpu options automatically enable or disable the following
21953 options:
21954
21955 -maltivec -mfprnd -mhard-float -mmfcrf -mmultiple -mpopcntb
21956 -mpopcntd -mpowerpc64 -mpowerpc-gpopt -mpowerpc-gfxopt -mmulhw
21957 -mdlmzb -mmfpgpr -mvsx -mcrypto -mhtm -mpower8-fusion
21958 -mpower8-vector -mquad-memory -mquad-memory-atomic -mfloat128
21959 -mfloat128-hardware -mprefixed -mpcrel -mmma
21960
21961 The particular options set for any particular CPU varies between
21962 compiler versions, depending on what setting seems to produce
21963 optimal code for that CPU; it doesn't necessarily reflect the
21964 actual hardware's capabilities. If you wish to set an individual
21965 option to a particular value, you may specify it after the -mcpu
21966 option, like -mcpu=970 -mno-altivec.
21967
21968 On AIX, the -maltivec and -mpowerpc64 options are not enabled or
21969 disabled by the -mcpu option at present because AIX does not have
21970 full support for these options. You may still enable or disable
21971 them individually if you're sure it'll work in your environment.
21972
21973 -mtune=cpu_type
21974 Set the instruction scheduling parameters for machine type
21975 cpu_type, but do not set the architecture type or register usage,
21976 as -mcpu=cpu_type does. The same values for cpu_type are used for
21977 -mtune as for -mcpu. If both are specified, the code generated
21978 uses the architecture and registers set by -mcpu, but the
21979 scheduling parameters set by -mtune.
21980
21981 -mcmodel=small
21982 Generate PowerPC64 code for the small model: The TOC is limited to
21983 64k.
21984
21985 -mcmodel=medium
21986 Generate PowerPC64 code for the medium model: The TOC and other
21987 static data may be up to a total of 4G in size. This is the
21988 default for 64-bit Linux.
21989
21990 -mcmodel=large
21991 Generate PowerPC64 code for the large model: The TOC may be up to
21992 4G in size. Other data and code is only limited by the 64-bit
21993 address space.
21994
21995 -maltivec
21996 -mno-altivec
21997 Generate code that uses (does not use) AltiVec instructions, and
21998 also enable the use of built-in functions that allow more direct
21999 access to the AltiVec instruction set. You may also need to set
22000 -mabi=altivec to adjust the current ABI with AltiVec ABI
22001 enhancements.
22002
22003 When -maltivec is used, the element order for AltiVec intrinsics
22004 such as "vec_splat", "vec_extract", and "vec_insert" match array
22005 element order corresponding to the endianness of the target. That
22006 is, element zero identifies the leftmost element in a vector
22007 register when targeting a big-endian platform, and identifies the
22008 rightmost element in a vector register when targeting a little-
22009 endian platform.
22010
22011 -mvrsave
22012 -mno-vrsave
22013 Generate VRSAVE instructions when generating AltiVec code.
22014
22015 -msecure-plt
22016 Generate code that allows ld and ld.so to build executables and
22017 shared libraries with non-executable ".plt" and ".got" sections.
22018 This is a PowerPC 32-bit SYSV ABI option.
22019
22020 -mbss-plt
22021 Generate code that uses a BSS ".plt" section that ld.so fills in,
22022 and requires ".plt" and ".got" sections that are both writable and
22023 executable. This is a PowerPC 32-bit SYSV ABI option.
22024
22025 -misel
22026 -mno-isel
22027 This switch enables or disables the generation of ISEL
22028 instructions.
22029
22030 -mvsx
22031 -mno-vsx
22032 Generate code that uses (does not use) vector/scalar (VSX)
22033 instructions, and also enable the use of built-in functions that
22034 allow more direct access to the VSX instruction set.
22035
22036 -mcrypto
22037 -mno-crypto
22038 Enable the use (disable) of the built-in functions that allow
22039 direct access to the cryptographic instructions that were added in
22040 version 2.07 of the PowerPC ISA.
22041
22042 -mhtm
22043 -mno-htm
22044 Enable (disable) the use of the built-in functions that allow
22045 direct access to the Hardware Transactional Memory (HTM)
22046 instructions that were added in version 2.07 of the PowerPC ISA.
22047
22048 -mpower8-fusion
22049 -mno-power8-fusion
22050 Generate code that keeps (does not keeps) some integer operations
22051 adjacent so that the instructions can be fused together on power8
22052 and later processors.
22053
22054 -mpower8-vector
22055 -mno-power8-vector
22056 Generate code that uses (does not use) the vector and scalar
22057 instructions that were added in version 2.07 of the PowerPC ISA.
22058 Also enable the use of built-in functions that allow more direct
22059 access to the vector instructions.
22060
22061 -mquad-memory
22062 -mno-quad-memory
22063 Generate code that uses (does not use) the non-atomic quad word
22064 memory instructions. The -mquad-memory option requires use of
22065 64-bit mode.
22066
22067 -mquad-memory-atomic
22068 -mno-quad-memory-atomic
22069 Generate code that uses (does not use) the atomic quad word memory
22070 instructions. The -mquad-memory-atomic option requires use of
22071 64-bit mode.
22072
22073 -mfloat128
22074 -mno-float128
22075 Enable/disable the __float128 keyword for IEEE 128-bit floating
22076 point and use either software emulation for IEEE 128-bit floating
22077 point or hardware instructions.
22078
22079 The VSX instruction set (-mvsx, -mcpu=power7, -mcpu=power8), or
22080 -mcpu=power9 must be enabled to use the IEEE 128-bit floating point
22081 support. The IEEE 128-bit floating point support only works on
22082 PowerPC Linux systems.
22083
22084 The default for -mfloat128 is enabled on PowerPC Linux systems
22085 using the VSX instruction set, and disabled on other systems.
22086
22087 If you use the ISA 3.0 instruction set (-mpower9-vector or
22088 -mcpu=power9) on a 64-bit system, the IEEE 128-bit floating point
22089 support will also enable the generation of ISA 3.0 IEEE 128-bit
22090 floating point instructions. Otherwise, if you do not specify to
22091 generate ISA 3.0 instructions or you are targeting a 32-bit big
22092 endian system, IEEE 128-bit floating point will be done with
22093 software emulation.
22094
22095 -mfloat128-hardware
22096 -mno-float128-hardware
22097 Enable/disable using ISA 3.0 hardware instructions to support the
22098 __float128 data type.
22099
22100 The default for -mfloat128-hardware is enabled on PowerPC Linux
22101 systems using the ISA 3.0 instruction set, and disabled on other
22102 systems.
22103
22104 -m32
22105 -m64
22106 Generate code for 32-bit or 64-bit environments of Darwin and SVR4
22107 targets (including GNU/Linux). The 32-bit environment sets int,
22108 long and pointer to 32 bits and generates code that runs on any
22109 PowerPC variant. The 64-bit environment sets int to 32 bits and
22110 long and pointer to 64 bits, and generates code for PowerPC64, as
22111 for -mpowerpc64.
22112
22113 -mfull-toc
22114 -mno-fp-in-toc
22115 -mno-sum-in-toc
22116 -mminimal-toc
22117 Modify generation of the TOC (Table Of Contents), which is created
22118 for every executable file. The -mfull-toc option is selected by
22119 default. In that case, GCC allocates at least one TOC entry for
22120 each unique non-automatic variable reference in your program. GCC
22121 also places floating-point constants in the TOC. However, only
22122 16,384 entries are available in the TOC.
22123
22124 If you receive a linker error message that saying you have
22125 overflowed the available TOC space, you can reduce the amount of
22126 TOC space used with the -mno-fp-in-toc and -mno-sum-in-toc options.
22127 -mno-fp-in-toc prevents GCC from putting floating-point constants
22128 in the TOC and -mno-sum-in-toc forces GCC to generate code to
22129 calculate the sum of an address and a constant at run time instead
22130 of putting that sum into the TOC. You may specify one or both of
22131 these options. Each causes GCC to produce very slightly slower and
22132 larger code at the expense of conserving TOC space.
22133
22134 If you still run out of space in the TOC even when you specify both
22135 of these options, specify -mminimal-toc instead. This option
22136 causes GCC to make only one TOC entry for every file. When you
22137 specify this option, GCC produces code that is slower and larger
22138 but which uses extremely little TOC space. You may wish to use
22139 this option only on files that contain less frequently-executed
22140 code.
22141
22142 -maix64
22143 -maix32
22144 Enable 64-bit AIX ABI and calling convention: 64-bit pointers,
22145 64-bit "long" type, and the infrastructure needed to support them.
22146 Specifying -maix64 implies -mpowerpc64, while -maix32 disables the
22147 64-bit ABI and implies -mno-powerpc64. GCC defaults to -maix32.
22148
22149 -mxl-compat
22150 -mno-xl-compat
22151 Produce code that conforms more closely to IBM XL compiler
22152 semantics when using AIX-compatible ABI. Pass floating-point
22153 arguments to prototyped functions beyond the register save area
22154 (RSA) on the stack in addition to argument FPRs. Do not assume
22155 that most significant double in 128-bit long double value is
22156 properly rounded when comparing values and converting to double.
22157 Use XL symbol names for long double support routines.
22158
22159 The AIX calling convention was extended but not initially
22160 documented to handle an obscure K&R C case of calling a function
22161 that takes the address of its arguments with fewer arguments than
22162 declared. IBM XL compilers access floating-point arguments that do
22163 not fit in the RSA from the stack when a subroutine is compiled
22164 without optimization. Because always storing floating-point
22165 arguments on the stack is inefficient and rarely needed, this
22166 option is not enabled by default and only is necessary when calling
22167 subroutines compiled by IBM XL compilers without optimization.
22168
22169 -mpe
22170 Support IBM RS/6000 SP Parallel Environment (PE). Link an
22171 application written to use message passing with special startup
22172 code to enable the application to run. The system must have PE
22173 installed in the standard location (/usr/lpp/ppe.poe/), or the
22174 specs file must be overridden with the -specs= option to specify
22175 the appropriate directory location. The Parallel Environment does
22176 not support threads, so the -mpe option and the -pthread option are
22177 incompatible.
22178
22179 -malign-natural
22180 -malign-power
22181 On AIX, 32-bit Darwin, and 64-bit PowerPC GNU/Linux, the option
22182 -malign-natural overrides the ABI-defined alignment of larger
22183 types, such as floating-point doubles, on their natural size-based
22184 boundary. The option -malign-power instructs GCC to follow the
22185 ABI-specified alignment rules. GCC defaults to the standard
22186 alignment defined in the ABI.
22187
22188 On 64-bit Darwin, natural alignment is the default, and
22189 -malign-power is not supported.
22190
22191 -msoft-float
22192 -mhard-float
22193 Generate code that does not use (uses) the floating-point register
22194 set. Software floating-point emulation is provided if you use the
22195 -msoft-float option, and pass the option to GCC when linking.
22196
22197 -mmultiple
22198 -mno-multiple
22199 Generate code that uses (does not use) the load multiple word
22200 instructions and the store multiple word instructions. These
22201 instructions are generated by default on POWER systems, and not
22202 generated on PowerPC systems. Do not use -mmultiple on little-
22203 endian PowerPC systems, since those instructions do not work when
22204 the processor is in little-endian mode. The exceptions are PPC740
22205 and PPC750 which permit these instructions in little-endian mode.
22206
22207 -mupdate
22208 -mno-update
22209 Generate code that uses (does not use) the load or store
22210 instructions that update the base register to the address of the
22211 calculated memory location. These instructions are generated by
22212 default. If you use -mno-update, there is a small window between
22213 the time that the stack pointer is updated and the address of the
22214 previous frame is stored, which means code that walks the stack
22215 frame across interrupts or signals may get corrupted data.
22216
22217 -mavoid-indexed-addresses
22218 -mno-avoid-indexed-addresses
22219 Generate code that tries to avoid (not avoid) the use of indexed
22220 load or store instructions. These instructions can incur a
22221 performance penalty on Power6 processors in certain situations,
22222 such as when stepping through large arrays that cross a 16M
22223 boundary. This option is enabled by default when targeting Power6
22224 and disabled otherwise.
22225
22226 -mfused-madd
22227 -mno-fused-madd
22228 Generate code that uses (does not use) the floating-point multiply
22229 and accumulate instructions. These instructions are generated by
22230 default if hardware floating point is used. The machine-dependent
22231 -mfused-madd option is now mapped to the machine-independent
22232 -ffp-contract=fast option, and -mno-fused-madd is mapped to
22233 -ffp-contract=off.
22234
22235 -mmulhw
22236 -mno-mulhw
22237 Generate code that uses (does not use) the half-word multiply and
22238 multiply-accumulate instructions on the IBM 405, 440, 464 and 476
22239 processors. These instructions are generated by default when
22240 targeting those processors.
22241
22242 -mdlmzb
22243 -mno-dlmzb
22244 Generate code that uses (does not use) the string-search dlmzb
22245 instruction on the IBM 405, 440, 464 and 476 processors. This
22246 instruction is generated by default when targeting those
22247 processors.
22248
22249 -mno-bit-align
22250 -mbit-align
22251 On System V.4 and embedded PowerPC systems do not (do) force
22252 structures and unions that contain bit-fields to be aligned to the
22253 base type of the bit-field.
22254
22255 For example, by default a structure containing nothing but 8
22256 "unsigned" bit-fields of length 1 is aligned to a 4-byte boundary
22257 and has a size of 4 bytes. By using -mno-bit-align, the structure
22258 is aligned to a 1-byte boundary and is 1 byte in size.
22259
22260 -mno-strict-align
22261 -mstrict-align
22262 On System V.4 and embedded PowerPC systems do not (do) assume that
22263 unaligned memory references are handled by the system.
22264
22265 -mrelocatable
22266 -mno-relocatable
22267 Generate code that allows (does not allow) a static executable to
22268 be relocated to a different address at run time. A simple embedded
22269 PowerPC system loader should relocate the entire contents of
22270 ".got2" and 4-byte locations listed in the ".fixup" section, a
22271 table of 32-bit addresses generated by this option. For this to
22272 work, all objects linked together must be compiled with
22273 -mrelocatable or -mrelocatable-lib. -mrelocatable code aligns the
22274 stack to an 8-byte boundary.
22275
22276 -mrelocatable-lib
22277 -mno-relocatable-lib
22278 Like -mrelocatable, -mrelocatable-lib generates a ".fixup" section
22279 to allow static executables to be relocated at run time, but
22280 -mrelocatable-lib does not use the smaller stack alignment of
22281 -mrelocatable. Objects compiled with -mrelocatable-lib may be
22282 linked with objects compiled with any combination of the
22283 -mrelocatable options.
22284
22285 -mno-toc
22286 -mtoc
22287 On System V.4 and embedded PowerPC systems do not (do) assume that
22288 register 2 contains a pointer to a global area pointing to the
22289 addresses used in the program.
22290
22291 -mlittle
22292 -mlittle-endian
22293 On System V.4 and embedded PowerPC systems compile code for the
22294 processor in little-endian mode. The -mlittle-endian option is the
22295 same as -mlittle.
22296
22297 -mbig
22298 -mbig-endian
22299 On System V.4 and embedded PowerPC systems compile code for the
22300 processor in big-endian mode. The -mbig-endian option is the same
22301 as -mbig.
22302
22303 -mdynamic-no-pic
22304 On Darwin and Mac OS X systems, compile code so that it is not
22305 relocatable, but that its external references are relocatable. The
22306 resulting code is suitable for applications, but not shared
22307 libraries.
22308
22309 -msingle-pic-base
22310 Treat the register used for PIC addressing as read-only, rather
22311 than loading it in the prologue for each function. The runtime
22312 system is responsible for initializing this register with an
22313 appropriate value before execution begins.
22314
22315 -mprioritize-restricted-insns=priority
22316 This option controls the priority that is assigned to dispatch-slot
22317 restricted instructions during the second scheduling pass. The
22318 argument priority takes the value 0, 1, or 2 to assign no, highest,
22319 or second-highest (respectively) priority to dispatch-slot
22320 restricted instructions.
22321
22322 -msched-costly-dep=dependence_type
22323 This option controls which dependences are considered costly by the
22324 target during instruction scheduling. The argument dependence_type
22325 takes one of the following values:
22326
22327 no No dependence is costly.
22328
22329 all All dependences are costly.
22330
22331 true_store_to_load
22332 A true dependence from store to load is costly.
22333
22334 store_to_load
22335 Any dependence from store to load is costly.
22336
22337 number
22338 Any dependence for which the latency is greater than or equal
22339 to number is costly.
22340
22341 -minsert-sched-nops=scheme
22342 This option controls which NOP insertion scheme is used during the
22343 second scheduling pass. The argument scheme takes one of the
22344 following values:
22345
22346 no Don't insert NOPs.
22347
22348 pad Pad with NOPs any dispatch group that has vacant issue slots,
22349 according to the scheduler's grouping.
22350
22351 regroup_exact
22352 Insert NOPs to force costly dependent insns into separate
22353 groups. Insert exactly as many NOPs as needed to force an insn
22354 to a new group, according to the estimated processor grouping.
22355
22356 number
22357 Insert NOPs to force costly dependent insns into separate
22358 groups. Insert number NOPs to force an insn to a new group.
22359
22360 -mcall-sysv
22361 On System V.4 and embedded PowerPC systems compile code using
22362 calling conventions that adhere to the March 1995 draft of the
22363 System V Application Binary Interface, PowerPC processor
22364 supplement. This is the default unless you configured GCC using
22365 powerpc-*-eabiaix.
22366
22367 -mcall-sysv-eabi
22368 -mcall-eabi
22369 Specify both -mcall-sysv and -meabi options.
22370
22371 -mcall-sysv-noeabi
22372 Specify both -mcall-sysv and -mno-eabi options.
22373
22374 -mcall-aixdesc
22375 On System V.4 and embedded PowerPC systems compile code for the AIX
22376 operating system.
22377
22378 -mcall-linux
22379 On System V.4 and embedded PowerPC systems compile code for the
22380 Linux-based GNU system.
22381
22382 -mcall-freebsd
22383 On System V.4 and embedded PowerPC systems compile code for the
22384 FreeBSD operating system.
22385
22386 -mcall-netbsd
22387 On System V.4 and embedded PowerPC systems compile code for the
22388 NetBSD operating system.
22389
22390 -mcall-openbsd
22391 On System V.4 and embedded PowerPC systems compile code for the
22392 OpenBSD operating system.
22393
22394 -mtraceback=traceback_type
22395 Select the type of traceback table. Valid values for traceback_type
22396 are full, part, and no.
22397
22398 -maix-struct-return
22399 Return all structures in memory (as specified by the AIX ABI).
22400
22401 -msvr4-struct-return
22402 Return structures smaller than 8 bytes in registers (as specified
22403 by the SVR4 ABI).
22404
22405 -mabi=abi-type
22406 Extend the current ABI with a particular extension, or remove such
22407 extension. Valid values are: altivec, no-altivec, ibmlongdouble,
22408 ieeelongdouble, elfv1, elfv2, and for AIX: vec-extabi, vec-default.
22409
22410 -mabi=ibmlongdouble
22411 Change the current ABI to use IBM extended-precision long double.
22412 This is not likely to work if your system defaults to using IEEE
22413 extended-precision long double. If you change the long double type
22414 from IEEE extended-precision, the compiler will issue a warning
22415 unless you use the -Wno-psabi option. Requires -mlong-double-128
22416 to be enabled.
22417
22418 -mabi=ieeelongdouble
22419 Change the current ABI to use IEEE extended-precision long double.
22420 This is not likely to work if your system defaults to using IBM
22421 extended-precision long double. If you change the long double type
22422 from IBM extended-precision, the compiler will issue a warning
22423 unless you use the -Wno-psabi option. Requires -mlong-double-128
22424 to be enabled.
22425
22426 -mabi=elfv1
22427 Change the current ABI to use the ELFv1 ABI. This is the default
22428 ABI for big-endian PowerPC 64-bit Linux. Overriding the default
22429 ABI requires special system support and is likely to fail in
22430 spectacular ways.
22431
22432 -mabi=elfv2
22433 Change the current ABI to use the ELFv2 ABI. This is the default
22434 ABI for little-endian PowerPC 64-bit Linux. Overriding the default
22435 ABI requires special system support and is likely to fail in
22436 spectacular ways.
22437
22438 -mgnu-attribute
22439 -mno-gnu-attribute
22440 Emit .gnu_attribute assembly directives to set tag/value pairs in a
22441 .gnu.attributes section that specify ABI variations in function
22442 parameters or return values.
22443
22444 -mprototype
22445 -mno-prototype
22446 On System V.4 and embedded PowerPC systems assume that all calls to
22447 variable argument functions are properly prototyped. Otherwise,
22448 the compiler must insert an instruction before every non-prototyped
22449 call to set or clear bit 6 of the condition code register ("CR") to
22450 indicate whether floating-point values are passed in the floating-
22451 point registers in case the function takes variable arguments.
22452 With -mprototype, only calls to prototyped variable argument
22453 functions set or clear the bit.
22454
22455 -msim
22456 On embedded PowerPC systems, assume that the startup module is
22457 called sim-crt0.o and that the standard C libraries are libsim.a
22458 and libc.a. This is the default for powerpc-*-eabisim
22459 configurations.
22460
22461 -mmvme
22462 On embedded PowerPC systems, assume that the startup module is
22463 called crt0.o and the standard C libraries are libmvme.a and
22464 libc.a.
22465
22466 -mads
22467 On embedded PowerPC systems, assume that the startup module is
22468 called crt0.o and the standard C libraries are libads.a and libc.a.
22469
22470 -myellowknife
22471 On embedded PowerPC systems, assume that the startup module is
22472 called crt0.o and the standard C libraries are libyk.a and libc.a.
22473
22474 -mvxworks
22475 On System V.4 and embedded PowerPC systems, specify that you are
22476 compiling for a VxWorks system.
22477
22478 -memb
22479 On embedded PowerPC systems, set the "PPC_EMB" bit in the ELF flags
22480 header to indicate that eabi extended relocations are used.
22481
22482 -meabi
22483 -mno-eabi
22484 On System V.4 and embedded PowerPC systems do (do not) adhere to
22485 the Embedded Applications Binary Interface (EABI), which is a set
22486 of modifications to the System V.4 specifications. Selecting
22487 -meabi means that the stack is aligned to an 8-byte boundary, a
22488 function "__eabi" is called from "main" to set up the EABI
22489 environment, and the -msdata option can use both "r2" and "r13" to
22490 point to two separate small data areas. Selecting -mno-eabi means
22491 that the stack is aligned to a 16-byte boundary, no EABI
22492 initialization function is called from "main", and the -msdata
22493 option only uses "r13" to point to a single small data area. The
22494 -meabi option is on by default if you configured GCC using one of
22495 the powerpc*-*-eabi* options.
22496
22497 -msdata=eabi
22498 On System V.4 and embedded PowerPC systems, put small initialized
22499 "const" global and static data in the ".sdata2" section, which is
22500 pointed to by register "r2". Put small initialized non-"const"
22501 global and static data in the ".sdata" section, which is pointed to
22502 by register "r13". Put small uninitialized global and static data
22503 in the ".sbss" section, which is adjacent to the ".sdata" section.
22504 The -msdata=eabi option is incompatible with the -mrelocatable
22505 option. The -msdata=eabi option also sets the -memb option.
22506
22507 -msdata=sysv
22508 On System V.4 and embedded PowerPC systems, put small global and
22509 static data in the ".sdata" section, which is pointed to by
22510 register "r13". Put small uninitialized global and static data in
22511 the ".sbss" section, which is adjacent to the ".sdata" section.
22512 The -msdata=sysv option is incompatible with the -mrelocatable
22513 option.
22514
22515 -msdata=default
22516 -msdata
22517 On System V.4 and embedded PowerPC systems, if -meabi is used,
22518 compile code the same as -msdata=eabi, otherwise compile code the
22519 same as -msdata=sysv.
22520
22521 -msdata=data
22522 On System V.4 and embedded PowerPC systems, put small global data
22523 in the ".sdata" section. Put small uninitialized global data in
22524 the ".sbss" section. Do not use register "r13" to address small
22525 data however. This is the default behavior unless other -msdata
22526 options are used.
22527
22528 -msdata=none
22529 -mno-sdata
22530 On embedded PowerPC systems, put all initialized global and static
22531 data in the ".data" section, and all uninitialized data in the
22532 ".bss" section.
22533
22534 -mreadonly-in-sdata
22535 Put read-only objects in the ".sdata" section as well. This is the
22536 default.
22537
22538 -mblock-move-inline-limit=num
22539 Inline all block moves (such as calls to "memcpy" or structure
22540 copies) less than or equal to num bytes. The minimum value for num
22541 is 32 bytes on 32-bit targets and 64 bytes on 64-bit targets. The
22542 default value is target-specific.
22543
22544 -mblock-compare-inline-limit=num
22545 Generate non-looping inline code for all block compares (such as
22546 calls to "memcmp" or structure compares) less than or equal to num
22547 bytes. If num is 0, all inline expansion (non-loop and loop) of
22548 block compare is disabled. The default value is target-specific.
22549
22550 -mblock-compare-inline-loop-limit=num
22551 Generate an inline expansion using loop code for all block compares
22552 that are less than or equal to num bytes, but greater than the
22553 limit for non-loop inline block compare expansion. If the block
22554 length is not constant, at most num bytes will be compared before
22555 "memcmp" is called to compare the remainder of the block. The
22556 default value is target-specific.
22557
22558 -mstring-compare-inline-limit=num
22559 Compare at most num string bytes with inline code. If the
22560 difference or end of string is not found at the end of the inline
22561 compare a call to "strcmp" or "strncmp" will take care of the rest
22562 of the comparison. The default is 64 bytes.
22563
22564 -G num
22565 On embedded PowerPC systems, put global and static items less than
22566 or equal to num bytes into the small data or BSS sections instead
22567 of the normal data or BSS section. By default, num is 8. The -G
22568 num switch is also passed to the linker. All modules should be
22569 compiled with the same -G num value.
22570
22571 -mregnames
22572 -mno-regnames
22573 On System V.4 and embedded PowerPC systems do (do not) emit
22574 register names in the assembly language output using symbolic
22575 forms.
22576
22577 -mlongcall
22578 -mno-longcall
22579 By default assume that all calls are far away so that a longer and
22580 more expensive calling sequence is required. This is required for
22581 calls farther than 32 megabytes (33,554,432 bytes) from the current
22582 location. A short call is generated if the compiler knows the call
22583 cannot be that far away. This setting can be overridden by the
22584 "shortcall" function attribute, or by "#pragma longcall(0)".
22585
22586 Some linkers are capable of detecting out-of-range calls and
22587 generating glue code on the fly. On these systems, long calls are
22588 unnecessary and generate slower code. As of this writing, the AIX
22589 linker can do this, as can the GNU linker for PowerPC/64. It is
22590 planned to add this feature to the GNU linker for 32-bit PowerPC
22591 systems as well.
22592
22593 On PowerPC64 ELFv2 and 32-bit PowerPC systems with newer GNU
22594 linkers, GCC can generate long calls using an inline PLT call
22595 sequence (see -mpltseq). PowerPC with -mbss-plt and PowerPC64
22596 ELFv1 (big-endian) do not support inline PLT calls.
22597
22598 On Darwin/PPC systems, "#pragma longcall" generates "jbsr callee,
22599 L42", plus a branch island (glue code). The two target addresses
22600 represent the callee and the branch island. The Darwin/PPC linker
22601 prefers the first address and generates a "bl callee" if the PPC
22602 "bl" instruction reaches the callee directly; otherwise, the linker
22603 generates "bl L42" to call the branch island. The branch island is
22604 appended to the body of the calling function; it computes the full
22605 32-bit address of the callee and jumps to it.
22606
22607 On Mach-O (Darwin) systems, this option directs the compiler emit
22608 to the glue for every direct call, and the Darwin linker decides
22609 whether to use or discard it.
22610
22611 In the future, GCC may ignore all longcall specifications when the
22612 linker is known to generate glue.
22613
22614 -mpltseq
22615 -mno-pltseq
22616 Implement (do not implement) -fno-plt and long calls using an
22617 inline PLT call sequence that supports lazy linking and long calls
22618 to functions in dlopen'd shared libraries. Inline PLT calls are
22619 only supported on PowerPC64 ELFv2 and 32-bit PowerPC systems with
22620 newer GNU linkers, and are enabled by default if the support is
22621 detected when configuring GCC, and, in the case of 32-bit PowerPC,
22622 if GCC is configured with --enable-secureplt. -mpltseq code and
22623 -mbss-plt 32-bit PowerPC relocatable objects may not be linked
22624 together.
22625
22626 -mtls-markers
22627 -mno-tls-markers
22628 Mark (do not mark) calls to "__tls_get_addr" with a relocation
22629 specifying the function argument. The relocation allows the linker
22630 to reliably associate function call with argument setup
22631 instructions for TLS optimization, which in turn allows GCC to
22632 better schedule the sequence.
22633
22634 -mrecip
22635 -mno-recip
22636 This option enables use of the reciprocal estimate and reciprocal
22637 square root estimate instructions with additional Newton-Raphson
22638 steps to increase precision instead of doing a divide or square
22639 root and divide for floating-point arguments. You should use the
22640 -ffast-math option when using -mrecip (or at least
22641 -funsafe-math-optimizations, -ffinite-math-only, -freciprocal-math
22642 and -fno-trapping-math). Note that while the throughput of the
22643 sequence is generally higher than the throughput of the non-
22644 reciprocal instruction, the precision of the sequence can be
22645 decreased by up to 2 ulp (i.e. the inverse of 1.0 equals
22646 0.99999994) for reciprocal square roots.
22647
22648 -mrecip=opt
22649 This option controls which reciprocal estimate instructions may be
22650 used. opt is a comma-separated list of options, which may be
22651 preceded by a "!" to invert the option:
22652
22653 all Enable all estimate instructions.
22654
22655 default
22656 Enable the default instructions, equivalent to -mrecip.
22657
22658 none
22659 Disable all estimate instructions, equivalent to -mno-recip.
22660
22661 div Enable the reciprocal approximation instructions for both
22662 single and double precision.
22663
22664 divf
22665 Enable the single-precision reciprocal approximation
22666 instructions.
22667
22668 divd
22669 Enable the double-precision reciprocal approximation
22670 instructions.
22671
22672 rsqrt
22673 Enable the reciprocal square root approximation instructions
22674 for both single and double precision.
22675
22676 rsqrtf
22677 Enable the single-precision reciprocal square root
22678 approximation instructions.
22679
22680 rsqrtd
22681 Enable the double-precision reciprocal square root
22682 approximation instructions.
22683
22684 So, for example, -mrecip=all,!rsqrtd enables all of the reciprocal
22685 estimate instructions, except for the "FRSQRTE", "XSRSQRTEDP", and
22686 "XVRSQRTEDP" instructions which handle the double-precision
22687 reciprocal square root calculations.
22688
22689 -mrecip-precision
22690 -mno-recip-precision
22691 Assume (do not assume) that the reciprocal estimate instructions
22692 provide higher-precision estimates than is mandated by the PowerPC
22693 ABI. Selecting -mcpu=power6, -mcpu=power7 or -mcpu=power8
22694 automatically selects -mrecip-precision. The double-precision
22695 square root estimate instructions are not generated by default on
22696 low-precision machines, since they do not provide an estimate that
22697 converges after three steps.
22698
22699 -mveclibabi=type
22700 Specifies the ABI type to use for vectorizing intrinsics using an
22701 external library. The only type supported at present is mass,
22702 which specifies to use IBM's Mathematical Acceleration Subsystem
22703 (MASS) libraries for vectorizing intrinsics using external
22704 libraries. GCC currently emits calls to "acosd2", "acosf4",
22705 "acoshd2", "acoshf4", "asind2", "asinf4", "asinhd2", "asinhf4",
22706 "atan2d2", "atan2f4", "atand2", "atanf4", "atanhd2", "atanhf4",
22707 "cbrtd2", "cbrtf4", "cosd2", "cosf4", "coshd2", "coshf4", "erfcd2",
22708 "erfcf4", "erfd2", "erff4", "exp2d2", "exp2f4", "expd2", "expf4",
22709 "expm1d2", "expm1f4", "hypotd2", "hypotf4", "lgammad2", "lgammaf4",
22710 "log10d2", "log10f4", "log1pd2", "log1pf4", "log2d2", "log2f4",
22711 "logd2", "logf4", "powd2", "powf4", "sind2", "sinf4", "sinhd2",
22712 "sinhf4", "sqrtd2", "sqrtf4", "tand2", "tanf4", "tanhd2", and
22713 "tanhf4" when generating code for power7. Both -ftree-vectorize
22714 and -funsafe-math-optimizations must also be enabled. The MASS
22715 libraries must be specified at link time.
22716
22717 -mfriz
22718 -mno-friz
22719 Generate (do not generate) the "friz" instruction when the
22720 -funsafe-math-optimizations option is used to optimize rounding of
22721 floating-point values to 64-bit integer and back to floating point.
22722 The "friz" instruction does not return the same value if the
22723 floating-point number is too large to fit in an integer.
22724
22725 -mpointers-to-nested-functions
22726 -mno-pointers-to-nested-functions
22727 Generate (do not generate) code to load up the static chain
22728 register ("r11") when calling through a pointer on AIX and 64-bit
22729 Linux systems where a function pointer points to a 3-word
22730 descriptor giving the function address, TOC value to be loaded in
22731 register "r2", and static chain value to be loaded in register
22732 "r11". The -mpointers-to-nested-functions is on by default. You
22733 cannot call through pointers to nested functions or pointers to
22734 functions compiled in other languages that use the static chain if
22735 you use -mno-pointers-to-nested-functions.
22736
22737 -msave-toc-indirect
22738 -mno-save-toc-indirect
22739 Generate (do not generate) code to save the TOC value in the
22740 reserved stack location in the function prologue if the function
22741 calls through a pointer on AIX and 64-bit Linux systems. If the
22742 TOC value is not saved in the prologue, it is saved just before the
22743 call through the pointer. The -mno-save-toc-indirect option is the
22744 default.
22745
22746 -mcompat-align-parm
22747 -mno-compat-align-parm
22748 Generate (do not generate) code to pass structure parameters with a
22749 maximum alignment of 64 bits, for compatibility with older versions
22750 of GCC.
22751
22752 Older versions of GCC (prior to 4.9.0) incorrectly did not align a
22753 structure parameter on a 128-bit boundary when that structure
22754 contained a member requiring 128-bit alignment. This is corrected
22755 in more recent versions of GCC. This option may be used to
22756 generate code that is compatible with functions compiled with older
22757 versions of GCC.
22758
22759 The -mno-compat-align-parm option is the default.
22760
22761 -mstack-protector-guard=guard
22762 -mstack-protector-guard-reg=reg
22763 -mstack-protector-guard-offset=offset
22764 -mstack-protector-guard-symbol=symbol
22765 Generate stack protection code using canary at guard. Supported
22766 locations are global for global canary or tls for per-thread canary
22767 in the TLS block (the default with GNU libc version 2.4 or later).
22768
22769 With the latter choice the options -mstack-protector-guard-reg=reg
22770 and -mstack-protector-guard-offset=offset furthermore specify which
22771 register to use as base register for reading the canary, and from
22772 what offset from that base register. The default for those is as
22773 specified in the relevant ABI.
22774 -mstack-protector-guard-symbol=symbol overrides the offset with a
22775 symbol reference to a canary in the TLS block.
22776
22777 -mpcrel
22778 -mno-pcrel
22779 Generate (do not generate) pc-relative addressing when the option
22780 -mcpu=future is used. The -mpcrel option requires that the medium
22781 code model (-mcmodel=medium) and prefixed addressing (-mprefixed)
22782 options are enabled.
22783
22784 -mprefixed
22785 -mno-prefixed
22786 Generate (do not generate) addressing modes using prefixed load and
22787 store instructions when the option -mcpu=future is used.
22788
22789 -mmma
22790 -mno-mma
22791 Generate (do not generate) the MMA instructions when the option
22792 -mcpu=future is used.
22793
22794 RX Options
22795
22796 These command-line options are defined for RX targets:
22797
22798 -m64bit-doubles
22799 -m32bit-doubles
22800 Make the "double" data type be 64 bits (-m64bit-doubles) or 32 bits
22801 (-m32bit-doubles) in size. The default is -m32bit-doubles. Note
22802 RX floating-point hardware only works on 32-bit values, which is
22803 why the default is -m32bit-doubles.
22804
22805 -fpu
22806 -nofpu
22807 Enables (-fpu) or disables (-nofpu) the use of RX floating-point
22808 hardware. The default is enabled for the RX600 series and disabled
22809 for the RX200 series.
22810
22811 Floating-point instructions are only generated for 32-bit floating-
22812 point values, however, so the FPU hardware is not used for doubles
22813 if the -m64bit-doubles option is used.
22814
22815 Note If the -fpu option is enabled then -funsafe-math-optimizations
22816 is also enabled automatically. This is because the RX FPU
22817 instructions are themselves unsafe.
22818
22819 -mcpu=name
22820 Selects the type of RX CPU to be targeted. Currently three types
22821 are supported, the generic RX600 and RX200 series hardware and the
22822 specific RX610 CPU. The default is RX600.
22823
22824 The only difference between RX600 and RX610 is that the RX610 does
22825 not support the "MVTIPL" instruction.
22826
22827 The RX200 series does not have a hardware floating-point unit and
22828 so -nofpu is enabled by default when this type is selected.
22829
22830 -mbig-endian-data
22831 -mlittle-endian-data
22832 Store data (but not code) in the big-endian format. The default is
22833 -mlittle-endian-data, i.e. to store data in the little-endian
22834 format.
22835
22836 -msmall-data-limit=N
22837 Specifies the maximum size in bytes of global and static variables
22838 which can be placed into the small data area. Using the small data
22839 area can lead to smaller and faster code, but the size of area is
22840 limited and it is up to the programmer to ensure that the area does
22841 not overflow. Also when the small data area is used one of the
22842 RX's registers (usually "r13") is reserved for use pointing to this
22843 area, so it is no longer available for use by the compiler. This
22844 could result in slower and/or larger code if variables are pushed
22845 onto the stack instead of being held in this register.
22846
22847 Note, common variables (variables that have not been initialized)
22848 and constants are not placed into the small data area as they are
22849 assigned to other sections in the output executable.
22850
22851 The default value is zero, which disables this feature. Note, this
22852 feature is not enabled by default with higher optimization levels
22853 (-O2 etc) because of the potentially detrimental effects of
22854 reserving a register. It is up to the programmer to experiment and
22855 discover whether this feature is of benefit to their program. See
22856 the description of the -mpid option for a description of how the
22857 actual register to hold the small data area pointer is chosen.
22858
22859 -msim
22860 -mno-sim
22861 Use the simulator runtime. The default is to use the libgloss
22862 board-specific runtime.
22863
22864 -mas100-syntax
22865 -mno-as100-syntax
22866 When generating assembler output use a syntax that is compatible
22867 with Renesas's AS100 assembler. This syntax can also be handled by
22868 the GAS assembler, but it has some restrictions so it is not
22869 generated by default.
22870
22871 -mmax-constant-size=N
22872 Specifies the maximum size, in bytes, of a constant that can be
22873 used as an operand in a RX instruction. Although the RX
22874 instruction set does allow constants of up to 4 bytes in length to
22875 be used in instructions, a longer value equates to a longer
22876 instruction. Thus in some circumstances it can be beneficial to
22877 restrict the size of constants that are used in instructions.
22878 Constants that are too big are instead placed into a constant pool
22879 and referenced via register indirection.
22880
22881 The value N can be between 0 and 4. A value of 0 (the default) or
22882 4 means that constants of any size are allowed.
22883
22884 -mrelax
22885 Enable linker relaxation. Linker relaxation is a process whereby
22886 the linker attempts to reduce the size of a program by finding
22887 shorter versions of various instructions. Disabled by default.
22888
22889 -mint-register=N
22890 Specify the number of registers to reserve for fast interrupt
22891 handler functions. The value N can be between 0 and 4. A value of
22892 1 means that register "r13" is reserved for the exclusive use of
22893 fast interrupt handlers. A value of 2 reserves "r13" and "r12". A
22894 value of 3 reserves "r13", "r12" and "r11", and a value of 4
22895 reserves "r13" through "r10". A value of 0, the default, does not
22896 reserve any registers.
22897
22898 -msave-acc-in-interrupts
22899 Specifies that interrupt handler functions should preserve the
22900 accumulator register. This is only necessary if normal code might
22901 use the accumulator register, for example because it performs
22902 64-bit multiplications. The default is to ignore the accumulator
22903 as this makes the interrupt handlers faster.
22904
22905 -mpid
22906 -mno-pid
22907 Enables the generation of position independent data. When enabled
22908 any access to constant data is done via an offset from a base
22909 address held in a register. This allows the location of constant
22910 data to be determined at run time without requiring the executable
22911 to be relocated, which is a benefit to embedded applications with
22912 tight memory constraints. Data that can be modified is not
22913 affected by this option.
22914
22915 Note, using this feature reserves a register, usually "r13", for
22916 the constant data base address. This can result in slower and/or
22917 larger code, especially in complicated functions.
22918
22919 The actual register chosen to hold the constant data base address
22920 depends upon whether the -msmall-data-limit and/or the
22921 -mint-register command-line options are enabled. Starting with
22922 register "r13" and proceeding downwards, registers are allocated
22923 first to satisfy the requirements of -mint-register, then -mpid and
22924 finally -msmall-data-limit. Thus it is possible for the small data
22925 area register to be "r8" if both -mint-register=4 and -mpid are
22926 specified on the command line.
22927
22928 By default this feature is not enabled. The default can be
22929 restored via the -mno-pid command-line option.
22930
22931 -mno-warn-multiple-fast-interrupts
22932 -mwarn-multiple-fast-interrupts
22933 Prevents GCC from issuing a warning message if it finds more than
22934 one fast interrupt handler when it is compiling a file. The
22935 default is to issue a warning for each extra fast interrupt handler
22936 found, as the RX only supports one such interrupt.
22937
22938 -mallow-string-insns
22939 -mno-allow-string-insns
22940 Enables or disables the use of the string manipulation instructions
22941 "SMOVF", "SCMPU", "SMOVB", "SMOVU", "SUNTIL" "SWHILE" and also the
22942 "RMPA" instruction. These instructions may prefetch data, which is
22943 not safe to do if accessing an I/O register. (See section 12.2.7
22944 of the RX62N Group User's Manual for more information).
22945
22946 The default is to allow these instructions, but it is not possible
22947 for GCC to reliably detect all circumstances where a string
22948 instruction might be used to access an I/O register, so their use
22949 cannot be disabled automatically. Instead it is reliant upon the
22950 programmer to use the -mno-allow-string-insns option if their
22951 program accesses I/O space.
22952
22953 When the instructions are enabled GCC defines the C preprocessor
22954 symbol "__RX_ALLOW_STRING_INSNS__", otherwise it defines the symbol
22955 "__RX_DISALLOW_STRING_INSNS__".
22956
22957 -mjsr
22958 -mno-jsr
22959 Use only (or not only) "JSR" instructions to access functions.
22960 This option can be used when code size exceeds the range of "BSR"
22961 instructions. Note that -mno-jsr does not mean to not use "JSR"
22962 but instead means that any type of branch may be used.
22963
22964 Note: The generic GCC command-line option -ffixed-reg has special
22965 significance to the RX port when used with the "interrupt" function
22966 attribute. This attribute indicates a function intended to process
22967 fast interrupts. GCC ensures that it only uses the registers "r10",
22968 "r11", "r12" and/or "r13" and only provided that the normal use of the
22969 corresponding registers have been restricted via the -ffixed-reg or
22970 -mint-register command-line options.
22971
22972 S/390 and zSeries Options
22973
22974 These are the -m options defined for the S/390 and zSeries
22975 architecture.
22976
22977 -mhard-float
22978 -msoft-float
22979 Use (do not use) the hardware floating-point instructions and
22980 registers for floating-point operations. When -msoft-float is
22981 specified, functions in libgcc.a are used to perform floating-point
22982 operations. When -mhard-float is specified, the compiler generates
22983 IEEE floating-point instructions. This is the default.
22984
22985 -mhard-dfp
22986 -mno-hard-dfp
22987 Use (do not use) the hardware decimal-floating-point instructions
22988 for decimal-floating-point operations. When -mno-hard-dfp is
22989 specified, functions in libgcc.a are used to perform decimal-
22990 floating-point operations. When -mhard-dfp is specified, the
22991 compiler generates decimal-floating-point hardware instructions.
22992 This is the default for -march=z9-ec or higher.
22993
22994 -mlong-double-64
22995 -mlong-double-128
22996 These switches control the size of "long double" type. A size of 64
22997 bits makes the "long double" type equivalent to the "double" type.
22998 This is the default.
22999
23000 -mbackchain
23001 -mno-backchain
23002 Store (do not store) the address of the caller's frame as backchain
23003 pointer into the callee's stack frame. A backchain may be needed
23004 to allow debugging using tools that do not understand DWARF call
23005 frame information. When -mno-packed-stack is in effect, the
23006 backchain pointer is stored at the bottom of the stack frame; when
23007 -mpacked-stack is in effect, the backchain is placed into the
23008 topmost word of the 96/160 byte register save area.
23009
23010 In general, code compiled with -mbackchain is call-compatible with
23011 code compiled with -mmo-backchain; however, use of the backchain
23012 for debugging purposes usually requires that the whole binary is
23013 built with -mbackchain. Note that the combination of -mbackchain,
23014 -mpacked-stack and -mhard-float is not supported. In order to
23015 build a linux kernel use -msoft-float.
23016
23017 The default is to not maintain the backchain.
23018
23019 -mpacked-stack
23020 -mno-packed-stack
23021 Use (do not use) the packed stack layout. When -mno-packed-stack
23022 is specified, the compiler uses the all fields of the 96/160 byte
23023 register save area only for their default purpose; unused fields
23024 still take up stack space. When -mpacked-stack is specified,
23025 register save slots are densely packed at the top of the register
23026 save area; unused space is reused for other purposes, allowing for
23027 more efficient use of the available stack space. However, when
23028 -mbackchain is also in effect, the topmost word of the save area is
23029 always used to store the backchain, and the return address register
23030 is always saved two words below the backchain.
23031
23032 As long as the stack frame backchain is not used, code generated
23033 with -mpacked-stack is call-compatible with code generated with
23034 -mno-packed-stack. Note that some non-FSF releases of GCC 2.95 for
23035 S/390 or zSeries generated code that uses the stack frame backchain
23036 at run time, not just for debugging purposes. Such code is not
23037 call-compatible with code compiled with -mpacked-stack. Also, note
23038 that the combination of -mbackchain, -mpacked-stack and
23039 -mhard-float is not supported. In order to build a linux kernel
23040 use -msoft-float.
23041
23042 The default is to not use the packed stack layout.
23043
23044 -msmall-exec
23045 -mno-small-exec
23046 Generate (or do not generate) code using the "bras" instruction to
23047 do subroutine calls. This only works reliably if the total
23048 executable size does not exceed 64k. The default is to use the
23049 "basr" instruction instead, which does not have this limitation.
23050
23051 -m64
23052 -m31
23053 When -m31 is specified, generate code compliant to the GNU/Linux
23054 for S/390 ABI. When -m64 is specified, generate code compliant to
23055 the GNU/Linux for zSeries ABI. This allows GCC in particular to
23056 generate 64-bit instructions. For the s390 targets, the default is
23057 -m31, while the s390x targets default to -m64.
23058
23059 -mzarch
23060 -mesa
23061 When -mzarch is specified, generate code using the instructions
23062 available on z/Architecture. When -mesa is specified, generate
23063 code using the instructions available on ESA/390. Note that -mesa
23064 is not possible with -m64. When generating code compliant to the
23065 GNU/Linux for S/390 ABI, the default is -mesa. When generating
23066 code compliant to the GNU/Linux for zSeries ABI, the default is
23067 -mzarch.
23068
23069 -mhtm
23070 -mno-htm
23071 The -mhtm option enables a set of builtins making use of
23072 instructions available with the transactional execution facility
23073 introduced with the IBM zEnterprise EC12 machine generation S/390
23074 System z Built-in Functions. -mhtm is enabled by default when
23075 using -march=zEC12.
23076
23077 -mvx
23078 -mno-vx
23079 When -mvx is specified, generate code using the instructions
23080 available with the vector extension facility introduced with the
23081 IBM z13 machine generation. This option changes the ABI for some
23082 vector type values with regard to alignment and calling
23083 conventions. In case vector type values are being used in an ABI-
23084 relevant context a GAS .gnu_attribute command will be added to mark
23085 the resulting binary with the ABI used. -mvx is enabled by default
23086 when using -march=z13.
23087
23088 -mzvector
23089 -mno-zvector
23090 The -mzvector option enables vector language extensions and
23091 builtins using instructions available with the vector extension
23092 facility introduced with the IBM z13 machine generation. This
23093 option adds support for vector to be used as a keyword to define
23094 vector type variables and arguments. vector is only available when
23095 GNU extensions are enabled. It will not be expanded when
23096 requesting strict standard compliance e.g. with -std=c99. In
23097 addition to the GCC low-level builtins -mzvector enables a set of
23098 builtins added for compatibility with AltiVec-style implementations
23099 like Power and Cell. In order to make use of these builtins the
23100 header file vecintrin.h needs to be included. -mzvector is
23101 disabled by default.
23102
23103 -mmvcle
23104 -mno-mvcle
23105 Generate (or do not generate) code using the "mvcle" instruction to
23106 perform block moves. When -mno-mvcle is specified, use a "mvc"
23107 loop instead. This is the default unless optimizing for size.
23108
23109 -mdebug
23110 -mno-debug
23111 Print (or do not print) additional debug information when
23112 compiling. The default is to not print debug information.
23113
23114 -march=cpu-type
23115 Generate code that runs on cpu-type, which is the name of a system
23116 representing a certain processor type. Possible values for cpu-
23117 type are z900/arch5, z990/arch6, z9-109, z9-ec/arch7, z10/arch8,
23118 z196/arch9, zEC12, z13/arch11, z14/arch12, z15/arch13, and native.
23119
23120 The default is -march=z900.
23121
23122 Specifying native as cpu type can be used to select the best
23123 architecture option for the host processor. -march=native has no
23124 effect if GCC does not recognize the processor.
23125
23126 -mtune=cpu-type
23127 Tune to cpu-type everything applicable about the generated code,
23128 except for the ABI and the set of available instructions. The list
23129 of cpu-type values is the same as for -march. The default is the
23130 value used for -march.
23131
23132 -mtpf-trace
23133 -mno-tpf-trace
23134 Generate code that adds (does not add) in TPF OS specific branches
23135 to trace routines in the operating system. This option is off by
23136 default, even when compiling for the TPF OS.
23137
23138 -mtpf-trace-skip
23139 -mno-tpf-trace-skip
23140 Generate code that changes (does not change) the default branch
23141 targets enabled by -mtpf-trace to point to specialized trace
23142 routines providing the ability of selectively skipping function
23143 trace entries for the TPF OS. This option is off by default, even
23144 when compiling for the TPF OS and specifying -mtpf-trace.
23145
23146 -mfused-madd
23147 -mno-fused-madd
23148 Generate code that uses (does not use) the floating-point multiply
23149 and accumulate instructions. These instructions are generated by
23150 default if hardware floating point is used.
23151
23152 -mwarn-framesize=framesize
23153 Emit a warning if the current function exceeds the given frame
23154 size. Because this is a compile-time check it doesn't need to be a
23155 real problem when the program runs. It is intended to identify
23156 functions that most probably cause a stack overflow. It is useful
23157 to be used in an environment with limited stack size e.g. the linux
23158 kernel.
23159
23160 -mwarn-dynamicstack
23161 Emit a warning if the function calls "alloca" or uses dynamically-
23162 sized arrays. This is generally a bad idea with a limited stack
23163 size.
23164
23165 -mstack-guard=stack-guard
23166 -mstack-size=stack-size
23167 If these options are provided the S/390 back end emits additional
23168 instructions in the function prologue that trigger a trap if the
23169 stack size is stack-guard bytes above the stack-size (remember that
23170 the stack on S/390 grows downward). If the stack-guard option is
23171 omitted the smallest power of 2 larger than the frame size of the
23172 compiled function is chosen. These options are intended to be used
23173 to help debugging stack overflow problems. The additionally
23174 emitted code causes only little overhead and hence can also be used
23175 in production-like systems without greater performance degradation.
23176 The given values have to be exact powers of 2 and stack-size has to
23177 be greater than stack-guard without exceeding 64k. In order to be
23178 efficient the extra code makes the assumption that the stack starts
23179 at an address aligned to the value given by stack-size. The stack-
23180 guard option can only be used in conjunction with stack-size.
23181
23182 -mhotpatch=pre-halfwords,post-halfwords
23183 If the hotpatch option is enabled, a "hot-patching" function
23184 prologue is generated for all functions in the compilation unit.
23185 The funtion label is prepended with the given number of two-byte
23186 NOP instructions (pre-halfwords, maximum 1000000). After the
23187 label, 2 * post-halfwords bytes are appended, using the largest NOP
23188 like instructions the architecture allows (maximum 1000000).
23189
23190 If both arguments are zero, hotpatching is disabled.
23191
23192 This option can be overridden for individual functions with the
23193 "hotpatch" attribute.
23194
23195 Score Options
23196
23197 These options are defined for Score implementations:
23198
23199 -meb
23200 Compile code for big-endian mode. This is the default.
23201
23202 -mel
23203 Compile code for little-endian mode.
23204
23205 -mnhwloop
23206 Disable generation of "bcnz" instructions.
23207
23208 -muls
23209 Enable generation of unaligned load and store instructions.
23210
23211 -mmac
23212 Enable the use of multiply-accumulate instructions. Disabled by
23213 default.
23214
23215 -mscore5
23216 Specify the SCORE5 as the target architecture.
23217
23218 -mscore5u
23219 Specify the SCORE5U of the target architecture.
23220
23221 -mscore7
23222 Specify the SCORE7 as the target architecture. This is the default.
23223
23224 -mscore7d
23225 Specify the SCORE7D as the target architecture.
23226
23227 SH Options
23228
23229 These -m options are defined for the SH implementations:
23230
23231 -m1 Generate code for the SH1.
23232
23233 -m2 Generate code for the SH2.
23234
23235 -m2e
23236 Generate code for the SH2e.
23237
23238 -m2a-nofpu
23239 Generate code for the SH2a without FPU, or for a SH2a-FPU in such a
23240 way that the floating-point unit is not used.
23241
23242 -m2a-single-only
23243 Generate code for the SH2a-FPU, in such a way that no double-
23244 precision floating-point operations are used.
23245
23246 -m2a-single
23247 Generate code for the SH2a-FPU assuming the floating-point unit is
23248 in single-precision mode by default.
23249
23250 -m2a
23251 Generate code for the SH2a-FPU assuming the floating-point unit is
23252 in double-precision mode by default.
23253
23254 -m3 Generate code for the SH3.
23255
23256 -m3e
23257 Generate code for the SH3e.
23258
23259 -m4-nofpu
23260 Generate code for the SH4 without a floating-point unit.
23261
23262 -m4-single-only
23263 Generate code for the SH4 with a floating-point unit that only
23264 supports single-precision arithmetic.
23265
23266 -m4-single
23267 Generate code for the SH4 assuming the floating-point unit is in
23268 single-precision mode by default.
23269
23270 -m4 Generate code for the SH4.
23271
23272 -m4-100
23273 Generate code for SH4-100.
23274
23275 -m4-100-nofpu
23276 Generate code for SH4-100 in such a way that the floating-point
23277 unit is not used.
23278
23279 -m4-100-single
23280 Generate code for SH4-100 assuming the floating-point unit is in
23281 single-precision mode by default.
23282
23283 -m4-100-single-only
23284 Generate code for SH4-100 in such a way that no double-precision
23285 floating-point operations are used.
23286
23287 -m4-200
23288 Generate code for SH4-200.
23289
23290 -m4-200-nofpu
23291 Generate code for SH4-200 without in such a way that the floating-
23292 point unit is not used.
23293
23294 -m4-200-single
23295 Generate code for SH4-200 assuming the floating-point unit is in
23296 single-precision mode by default.
23297
23298 -m4-200-single-only
23299 Generate code for SH4-200 in such a way that no double-precision
23300 floating-point operations are used.
23301
23302 -m4-300
23303 Generate code for SH4-300.
23304
23305 -m4-300-nofpu
23306 Generate code for SH4-300 without in such a way that the floating-
23307 point unit is not used.
23308
23309 -m4-300-single
23310 Generate code for SH4-300 in such a way that no double-precision
23311 floating-point operations are used.
23312
23313 -m4-300-single-only
23314 Generate code for SH4-300 in such a way that no double-precision
23315 floating-point operations are used.
23316
23317 -m4-340
23318 Generate code for SH4-340 (no MMU, no FPU).
23319
23320 -m4-500
23321 Generate code for SH4-500 (no FPU). Passes -isa=sh4-nofpu to the
23322 assembler.
23323
23324 -m4a-nofpu
23325 Generate code for the SH4al-dsp, or for a SH4a in such a way that
23326 the floating-point unit is not used.
23327
23328 -m4a-single-only
23329 Generate code for the SH4a, in such a way that no double-precision
23330 floating-point operations are used.
23331
23332 -m4a-single
23333 Generate code for the SH4a assuming the floating-point unit is in
23334 single-precision mode by default.
23335
23336 -m4a
23337 Generate code for the SH4a.
23338
23339 -m4al
23340 Same as -m4a-nofpu, except that it implicitly passes -dsp to the
23341 assembler. GCC doesn't generate any DSP instructions at the
23342 moment.
23343
23344 -mb Compile code for the processor in big-endian mode.
23345
23346 -ml Compile code for the processor in little-endian mode.
23347
23348 -mdalign
23349 Align doubles at 64-bit boundaries. Note that this changes the
23350 calling conventions, and thus some functions from the standard C
23351 library do not work unless you recompile it first with -mdalign.
23352
23353 -mrelax
23354 Shorten some address references at link time, when possible; uses
23355 the linker option -relax.
23356
23357 -mbigtable
23358 Use 32-bit offsets in "switch" tables. The default is to use
23359 16-bit offsets.
23360
23361 -mbitops
23362 Enable the use of bit manipulation instructions on SH2A.
23363
23364 -mfmovd
23365 Enable the use of the instruction "fmovd". Check -mdalign for
23366 alignment constraints.
23367
23368 -mrenesas
23369 Comply with the calling conventions defined by Renesas.
23370
23371 -mno-renesas
23372 Comply with the calling conventions defined for GCC before the
23373 Renesas conventions were available. This option is the default for
23374 all targets of the SH toolchain.
23375
23376 -mnomacsave
23377 Mark the "MAC" register as call-clobbered, even if -mrenesas is
23378 given.
23379
23380 -mieee
23381 -mno-ieee
23382 Control the IEEE compliance of floating-point comparisons, which
23383 affects the handling of cases where the result of a comparison is
23384 unordered. By default -mieee is implicitly enabled. If
23385 -ffinite-math-only is enabled -mno-ieee is implicitly set, which
23386 results in faster floating-point greater-equal and less-equal
23387 comparisons. The implicit settings can be overridden by specifying
23388 either -mieee or -mno-ieee.
23389
23390 -minline-ic_invalidate
23391 Inline code to invalidate instruction cache entries after setting
23392 up nested function trampolines. This option has no effect if
23393 -musermode is in effect and the selected code generation option
23394 (e.g. -m4) does not allow the use of the "icbi" instruction. If
23395 the selected code generation option does not allow the use of the
23396 "icbi" instruction, and -musermode is not in effect, the inlined
23397 code manipulates the instruction cache address array directly with
23398 an associative write. This not only requires privileged mode at
23399 run time, but it also fails if the cache line had been mapped via
23400 the TLB and has become unmapped.
23401
23402 -misize
23403 Dump instruction size and location in the assembly code.
23404
23405 -mpadstruct
23406 This option is deprecated. It pads structures to multiple of 4
23407 bytes, which is incompatible with the SH ABI.
23408
23409 -matomic-model=model
23410 Sets the model of atomic operations and additional parameters as a
23411 comma separated list. For details on the atomic built-in functions
23412 see __atomic Builtins. The following models and parameters are
23413 supported:
23414
23415 none
23416 Disable compiler generated atomic sequences and emit library
23417 calls for atomic operations. This is the default if the target
23418 is not "sh*-*-linux*".
23419
23420 soft-gusa
23421 Generate GNU/Linux compatible gUSA software atomic sequences
23422 for the atomic built-in functions. The generated atomic
23423 sequences require additional support from the
23424 interrupt/exception handling code of the system and are only
23425 suitable for SH3* and SH4* single-core systems. This option is
23426 enabled by default when the target is "sh*-*-linux*" and SH3*
23427 or SH4*. When the target is SH4A, this option also partially
23428 utilizes the hardware atomic instructions "movli.l" and
23429 "movco.l" to create more efficient code, unless strict is
23430 specified.
23431
23432 soft-tcb
23433 Generate software atomic sequences that use a variable in the
23434 thread control block. This is a variation of the gUSA
23435 sequences which can also be used on SH1* and SH2* targets. The
23436 generated atomic sequences require additional support from the
23437 interrupt/exception handling code of the system and are only
23438 suitable for single-core systems. When using this model, the
23439 gbr-offset= parameter has to be specified as well.
23440
23441 soft-imask
23442 Generate software atomic sequences that temporarily disable
23443 interrupts by setting "SR.IMASK = 1111". This model works only
23444 when the program runs in privileged mode and is only suitable
23445 for single-core systems. Additional support from the
23446 interrupt/exception handling code of the system is not
23447 required. This model is enabled by default when the target is
23448 "sh*-*-linux*" and SH1* or SH2*.
23449
23450 hard-llcs
23451 Generate hardware atomic sequences using the "movli.l" and
23452 "movco.l" instructions only. This is only available on SH4A
23453 and is suitable for multi-core systems. Since the hardware
23454 instructions support only 32 bit atomic variables access to 8
23455 or 16 bit variables is emulated with 32 bit accesses. Code
23456 compiled with this option is also compatible with other
23457 software atomic model interrupt/exception handling systems if
23458 executed on an SH4A system. Additional support from the
23459 interrupt/exception handling code of the system is not required
23460 for this model.
23461
23462 gbr-offset=
23463 This parameter specifies the offset in bytes of the variable in
23464 the thread control block structure that should be used by the
23465 generated atomic sequences when the soft-tcb model has been
23466 selected. For other models this parameter is ignored. The
23467 specified value must be an integer multiple of four and in the
23468 range 0-1020.
23469
23470 strict
23471 This parameter prevents mixed usage of multiple atomic models,
23472 even if they are compatible, and makes the compiler generate
23473 atomic sequences of the specified model only.
23474
23475 -mtas
23476 Generate the "tas.b" opcode for "__atomic_test_and_set". Notice
23477 that depending on the particular hardware and software
23478 configuration this can degrade overall performance due to the
23479 operand cache line flushes that are implied by the "tas.b"
23480 instruction. On multi-core SH4A processors the "tas.b" instruction
23481 must be used with caution since it can result in data corruption
23482 for certain cache configurations.
23483
23484 -mprefergot
23485 When generating position-independent code, emit function calls
23486 using the Global Offset Table instead of the Procedure Linkage
23487 Table.
23488
23489 -musermode
23490 -mno-usermode
23491 Don't allow (allow) the compiler generating privileged mode code.
23492 Specifying -musermode also implies -mno-inline-ic_invalidate if the
23493 inlined code would not work in user mode. -musermode is the
23494 default when the target is "sh*-*-linux*". If the target is SH1*
23495 or SH2* -musermode has no effect, since there is no user mode.
23496
23497 -multcost=number
23498 Set the cost to assume for a multiply insn.
23499
23500 -mdiv=strategy
23501 Set the division strategy to be used for integer division
23502 operations. strategy can be one of:
23503
23504 call-div1
23505 Calls a library function that uses the single-step division
23506 instruction "div1" to perform the operation. Division by zero
23507 calculates an unspecified result and does not trap. This is
23508 the default except for SH4, SH2A and SHcompact.
23509
23510 call-fp
23511 Calls a library function that performs the operation in double
23512 precision floating point. Division by zero causes a floating-
23513 point exception. This is the default for SHcompact with FPU.
23514 Specifying this for targets that do not have a double precision
23515 FPU defaults to "call-div1".
23516
23517 call-table
23518 Calls a library function that uses a lookup table for small
23519 divisors and the "div1" instruction with case distinction for
23520 larger divisors. Division by zero calculates an unspecified
23521 result and does not trap. This is the default for SH4.
23522 Specifying this for targets that do not have dynamic shift
23523 instructions defaults to "call-div1".
23524
23525 When a division strategy has not been specified the default
23526 strategy is selected based on the current target. For SH2A the
23527 default strategy is to use the "divs" and "divu" instructions
23528 instead of library function calls.
23529
23530 -maccumulate-outgoing-args
23531 Reserve space once for outgoing arguments in the function prologue
23532 rather than around each call. Generally beneficial for performance
23533 and size. Also needed for unwinding to avoid changing the stack
23534 frame around conditional code.
23535
23536 -mdivsi3_libfunc=name
23537 Set the name of the library function used for 32-bit signed
23538 division to name. This only affects the name used in the call
23539 division strategies, and the compiler still expects the same sets
23540 of input/output/clobbered registers as if this option were not
23541 present.
23542
23543 -mfixed-range=register-range
23544 Generate code treating the given register range as fixed registers.
23545 A fixed register is one that the register allocator cannot use.
23546 This is useful when compiling kernel code. A register range is
23547 specified as two registers separated by a dash. Multiple register
23548 ranges can be specified separated by a comma.
23549
23550 -mbranch-cost=num
23551 Assume num to be the cost for a branch instruction. Higher numbers
23552 make the compiler try to generate more branch-free code if
23553 possible. If not specified the value is selected depending on the
23554 processor type that is being compiled for.
23555
23556 -mzdcbranch
23557 -mno-zdcbranch
23558 Assume (do not assume) that zero displacement conditional branch
23559 instructions "bt" and "bf" are fast. If -mzdcbranch is specified,
23560 the compiler prefers zero displacement branch code sequences. This
23561 is enabled by default when generating code for SH4 and SH4A. It
23562 can be explicitly disabled by specifying -mno-zdcbranch.
23563
23564 -mcbranch-force-delay-slot
23565 Force the usage of delay slots for conditional branches, which
23566 stuffs the delay slot with a "nop" if a suitable instruction cannot
23567 be found. By default this option is disabled. It can be enabled
23568 to work around hardware bugs as found in the original SH7055.
23569
23570 -mfused-madd
23571 -mno-fused-madd
23572 Generate code that uses (does not use) the floating-point multiply
23573 and accumulate instructions. These instructions are generated by
23574 default if hardware floating point is used. The machine-dependent
23575 -mfused-madd option is now mapped to the machine-independent
23576 -ffp-contract=fast option, and -mno-fused-madd is mapped to
23577 -ffp-contract=off.
23578
23579 -mfsca
23580 -mno-fsca
23581 Allow or disallow the compiler to emit the "fsca" instruction for
23582 sine and cosine approximations. The option -mfsca must be used in
23583 combination with -funsafe-math-optimizations. It is enabled by
23584 default when generating code for SH4A. Using -mno-fsca disables
23585 sine and cosine approximations even if -funsafe-math-optimizations
23586 is in effect.
23587
23588 -mfsrra
23589 -mno-fsrra
23590 Allow or disallow the compiler to emit the "fsrra" instruction for
23591 reciprocal square root approximations. The option -mfsrra must be
23592 used in combination with -funsafe-math-optimizations and
23593 -ffinite-math-only. It is enabled by default when generating code
23594 for SH4A. Using -mno-fsrra disables reciprocal square root
23595 approximations even if -funsafe-math-optimizations and
23596 -ffinite-math-only are in effect.
23597
23598 -mpretend-cmove
23599 Prefer zero-displacement conditional branches for conditional move
23600 instruction patterns. This can result in faster code on the SH4
23601 processor.
23602
23603 -mfdpic
23604 Generate code using the FDPIC ABI.
23605
23606 Solaris 2 Options
23607
23608 These -m options are supported on Solaris 2:
23609
23610 -mclear-hwcap
23611 -mclear-hwcap tells the compiler to remove the hardware
23612 capabilities generated by the Solaris assembler. This is only
23613 necessary when object files use ISA extensions not supported by the
23614 current machine, but check at runtime whether or not to use them.
23615
23616 -mimpure-text
23617 -mimpure-text, used in addition to -shared, tells the compiler to
23618 not pass -z text to the linker when linking a shared object. Using
23619 this option, you can link position-dependent code into a shared
23620 object.
23621
23622 -mimpure-text suppresses the "relocations remain against
23623 allocatable but non-writable sections" linker error message.
23624 However, the necessary relocations trigger copy-on-write, and the
23625 shared object is not actually shared across processes. Instead of
23626 using -mimpure-text, you should compile all source code with -fpic
23627 or -fPIC.
23628
23629 These switches are supported in addition to the above on Solaris 2:
23630
23631 -pthreads
23632 This is a synonym for -pthread.
23633
23634 SPARC Options
23635
23636 These -m options are supported on the SPARC:
23637
23638 -mno-app-regs
23639 -mapp-regs
23640 Specify -mapp-regs to generate output using the global registers 2
23641 through 4, which the SPARC SVR4 ABI reserves for applications.
23642 Like the global register 1, each global register 2 through 4 is
23643 then treated as an allocable register that is clobbered by function
23644 calls. This is the default.
23645
23646 To be fully SVR4 ABI-compliant at the cost of some performance
23647 loss, specify -mno-app-regs. You should compile libraries and
23648 system software with this option.
23649
23650 -mflat
23651 -mno-flat
23652 With -mflat, the compiler does not generate save/restore
23653 instructions and uses a "flat" or single register window model.
23654 This model is compatible with the regular register window model.
23655 The local registers and the input registers (0--5) are still
23656 treated as "call-saved" registers and are saved on the stack as
23657 needed.
23658
23659 With -mno-flat (the default), the compiler generates save/restore
23660 instructions (except for leaf functions). This is the normal
23661 operating mode.
23662
23663 -mfpu
23664 -mhard-float
23665 Generate output containing floating-point instructions. This is
23666 the default.
23667
23668 -mno-fpu
23669 -msoft-float
23670 Generate output containing library calls for floating point.
23671 Warning: the requisite libraries are not available for all SPARC
23672 targets. Normally the facilities of the machine's usual C compiler
23673 are used, but this cannot be done directly in cross-compilation.
23674 You must make your own arrangements to provide suitable library
23675 functions for cross-compilation. The embedded targets sparc-*-aout
23676 and sparclite-*-* do provide software floating-point support.
23677
23678 -msoft-float changes the calling convention in the output file;
23679 therefore, it is only useful if you compile all of a program with
23680 this option. In particular, you need to compile libgcc.a, the
23681 library that comes with GCC, with -msoft-float in order for this to
23682 work.
23683
23684 -mhard-quad-float
23685 Generate output containing quad-word (long double) floating-point
23686 instructions.
23687
23688 -msoft-quad-float
23689 Generate output containing library calls for quad-word (long
23690 double) floating-point instructions. The functions called are
23691 those specified in the SPARC ABI. This is the default.
23692
23693 As of this writing, there are no SPARC implementations that have
23694 hardware support for the quad-word floating-point instructions.
23695 They all invoke a trap handler for one of these instructions, and
23696 then the trap handler emulates the effect of the instruction.
23697 Because of the trap handler overhead, this is much slower than
23698 calling the ABI library routines. Thus the -msoft-quad-float
23699 option is the default.
23700
23701 -mno-unaligned-doubles
23702 -munaligned-doubles
23703 Assume that doubles have 8-byte alignment. This is the default.
23704
23705 With -munaligned-doubles, GCC assumes that doubles have 8-byte
23706 alignment only if they are contained in another type, or if they
23707 have an absolute address. Otherwise, it assumes they have 4-byte
23708 alignment. Specifying this option avoids some rare compatibility
23709 problems with code generated by other compilers. It is not the
23710 default because it results in a performance loss, especially for
23711 floating-point code.
23712
23713 -muser-mode
23714 -mno-user-mode
23715 Do not generate code that can only run in supervisor mode. This is
23716 relevant only for the "casa" instruction emitted for the LEON3
23717 processor. This is the default.
23718
23719 -mfaster-structs
23720 -mno-faster-structs
23721 With -mfaster-structs, the compiler assumes that structures should
23722 have 8-byte alignment. This enables the use of pairs of "ldd" and
23723 "std" instructions for copies in structure assignment, in place of
23724 twice as many "ld" and "st" pairs. However, the use of this
23725 changed alignment directly violates the SPARC ABI. Thus, it's
23726 intended only for use on targets where the developer acknowledges
23727 that their resulting code is not directly in line with the rules of
23728 the ABI.
23729
23730 -mstd-struct-return
23731 -mno-std-struct-return
23732 With -mstd-struct-return, the compiler generates checking code in
23733 functions returning structures or unions to detect size mismatches
23734 between the two sides of function calls, as per the 32-bit ABI.
23735
23736 The default is -mno-std-struct-return. This option has no effect
23737 in 64-bit mode.
23738
23739 -mlra
23740 -mno-lra
23741 Enable Local Register Allocation. This is the default for SPARC
23742 since GCC 7 so -mno-lra needs to be passed to get old Reload.
23743
23744 -mcpu=cpu_type
23745 Set the instruction set, register set, and instruction scheduling
23746 parameters for machine type cpu_type. Supported values for
23747 cpu_type are v7, cypress, v8, supersparc, hypersparc, leon, leon3,
23748 leon3v7, sparclite, f930, f934, sparclite86x, sparclet, tsc701, v9,
23749 ultrasparc, ultrasparc3, niagara, niagara2, niagara3, niagara4,
23750 niagara7 and m8.
23751
23752 Native Solaris and GNU/Linux toolchains also support the value
23753 native, which selects the best architecture option for the host
23754 processor. -mcpu=native has no effect if GCC does not recognize
23755 the processor.
23756
23757 Default instruction scheduling parameters are used for values that
23758 select an architecture and not an implementation. These are v7,
23759 v8, sparclite, sparclet, v9.
23760
23761 Here is a list of each supported architecture and their supported
23762 implementations.
23763
23764 v7 cypress, leon3v7
23765
23766 v8 supersparc, hypersparc, leon, leon3
23767
23768 sparclite
23769 f930, f934, sparclite86x
23770
23771 sparclet
23772 tsc701
23773
23774 v9 ultrasparc, ultrasparc3, niagara, niagara2, niagara3, niagara4,
23775 niagara7, m8
23776
23777 By default (unless configured otherwise), GCC generates code for
23778 the V7 variant of the SPARC architecture. With -mcpu=cypress, the
23779 compiler additionally optimizes it for the Cypress CY7C602 chip, as
23780 used in the SPARCStation/SPARCServer 3xx series. This is also
23781 appropriate for the older SPARCStation 1, 2, IPX etc.
23782
23783 With -mcpu=v8, GCC generates code for the V8 variant of the SPARC
23784 architecture. The only difference from V7 code is that the
23785 compiler emits the integer multiply and integer divide instructions
23786 which exist in SPARC-V8 but not in SPARC-V7. With
23787 -mcpu=supersparc, the compiler additionally optimizes it for the
23788 SuperSPARC chip, as used in the SPARCStation 10, 1000 and 2000
23789 series.
23790
23791 With -mcpu=sparclite, GCC generates code for the SPARClite variant
23792 of the SPARC architecture. This adds the integer multiply, integer
23793 divide step and scan ("ffs") instructions which exist in SPARClite
23794 but not in SPARC-V7. With -mcpu=f930, the compiler additionally
23795 optimizes it for the Fujitsu MB86930 chip, which is the original
23796 SPARClite, with no FPU. With -mcpu=f934, the compiler additionally
23797 optimizes it for the Fujitsu MB86934 chip, which is the more recent
23798 SPARClite with FPU.
23799
23800 With -mcpu=sparclet, GCC generates code for the SPARClet variant of
23801 the SPARC architecture. This adds the integer multiply,
23802 multiply/accumulate, integer divide step and scan ("ffs")
23803 instructions which exist in SPARClet but not in SPARC-V7. With
23804 -mcpu=tsc701, the compiler additionally optimizes it for the TEMIC
23805 SPARClet chip.
23806
23807 With -mcpu=v9, GCC generates code for the V9 variant of the SPARC
23808 architecture. This adds 64-bit integer and floating-point move
23809 instructions, 3 additional floating-point condition code registers
23810 and conditional move instructions. With -mcpu=ultrasparc, the
23811 compiler additionally optimizes it for the Sun UltraSPARC I/II/IIi
23812 chips. With -mcpu=ultrasparc3, the compiler additionally optimizes
23813 it for the Sun UltraSPARC III/III+/IIIi/IIIi+/IV/IV+ chips. With
23814 -mcpu=niagara, the compiler additionally optimizes it for Sun
23815 UltraSPARC T1 chips. With -mcpu=niagara2, the compiler
23816 additionally optimizes it for Sun UltraSPARC T2 chips. With
23817 -mcpu=niagara3, the compiler additionally optimizes it for Sun
23818 UltraSPARC T3 chips. With -mcpu=niagara4, the compiler
23819 additionally optimizes it for Sun UltraSPARC T4 chips. With
23820 -mcpu=niagara7, the compiler additionally optimizes it for Oracle
23821 SPARC M7 chips. With -mcpu=m8, the compiler additionally optimizes
23822 it for Oracle M8 chips.
23823
23824 -mtune=cpu_type
23825 Set the instruction scheduling parameters for machine type
23826 cpu_type, but do not set the instruction set or register set that
23827 the option -mcpu=cpu_type does.
23828
23829 The same values for -mcpu=cpu_type can be used for -mtune=cpu_type,
23830 but the only useful values are those that select a particular CPU
23831 implementation. Those are cypress, supersparc, hypersparc, leon,
23832 leon3, leon3v7, f930, f934, sparclite86x, tsc701, ultrasparc,
23833 ultrasparc3, niagara, niagara2, niagara3, niagara4, niagara7 and
23834 m8. With native Solaris and GNU/Linux toolchains, native can also
23835 be used.
23836
23837 -mv8plus
23838 -mno-v8plus
23839 With -mv8plus, GCC generates code for the SPARC-V8+ ABI. The
23840 difference from the V8 ABI is that the global and out registers are
23841 considered 64 bits wide. This is enabled by default on Solaris in
23842 32-bit mode for all SPARC-V9 processors.
23843
23844 -mvis
23845 -mno-vis
23846 With -mvis, GCC generates code that takes advantage of the
23847 UltraSPARC Visual Instruction Set extensions. The default is
23848 -mno-vis.
23849
23850 -mvis2
23851 -mno-vis2
23852 With -mvis2, GCC generates code that takes advantage of version 2.0
23853 of the UltraSPARC Visual Instruction Set extensions. The default
23854 is -mvis2 when targeting a cpu that supports such instructions,
23855 such as UltraSPARC-III and later. Setting -mvis2 also sets -mvis.
23856
23857 -mvis3
23858 -mno-vis3
23859 With -mvis3, GCC generates code that takes advantage of version 3.0
23860 of the UltraSPARC Visual Instruction Set extensions. The default
23861 is -mvis3 when targeting a cpu that supports such instructions,
23862 such as niagara-3 and later. Setting -mvis3 also sets -mvis2 and
23863 -mvis.
23864
23865 -mvis4
23866 -mno-vis4
23867 With -mvis4, GCC generates code that takes advantage of version 4.0
23868 of the UltraSPARC Visual Instruction Set extensions. The default
23869 is -mvis4 when targeting a cpu that supports such instructions,
23870 such as niagara-7 and later. Setting -mvis4 also sets -mvis3,
23871 -mvis2 and -mvis.
23872
23873 -mvis4b
23874 -mno-vis4b
23875 With -mvis4b, GCC generates code that takes advantage of version
23876 4.0 of the UltraSPARC Visual Instruction Set extensions, plus the
23877 additional VIS instructions introduced in the Oracle SPARC
23878 Architecture 2017. The default is -mvis4b when targeting a cpu
23879 that supports such instructions, such as m8 and later. Setting
23880 -mvis4b also sets -mvis4, -mvis3, -mvis2 and -mvis.
23881
23882 -mcbcond
23883 -mno-cbcond
23884 With -mcbcond, GCC generates code that takes advantage of the
23885 UltraSPARC Compare-and-Branch-on-Condition instructions. The
23886 default is -mcbcond when targeting a CPU that supports such
23887 instructions, such as Niagara-4 and later.
23888
23889 -mfmaf
23890 -mno-fmaf
23891 With -mfmaf, GCC generates code that takes advantage of the
23892 UltraSPARC Fused Multiply-Add Floating-point instructions. The
23893 default is -mfmaf when targeting a CPU that supports such
23894 instructions, such as Niagara-3 and later.
23895
23896 -mfsmuld
23897 -mno-fsmuld
23898 With -mfsmuld, GCC generates code that takes advantage of the
23899 Floating-point Multiply Single to Double (FsMULd) instruction. The
23900 default is -mfsmuld when targeting a CPU supporting the
23901 architecture versions V8 or V9 with FPU except -mcpu=leon.
23902
23903 -mpopc
23904 -mno-popc
23905 With -mpopc, GCC generates code that takes advantage of the
23906 UltraSPARC Population Count instruction. The default is -mpopc
23907 when targeting a CPU that supports such an instruction, such as
23908 Niagara-2 and later.
23909
23910 -msubxc
23911 -mno-subxc
23912 With -msubxc, GCC generates code that takes advantage of the
23913 UltraSPARC Subtract-Extended-with-Carry instruction. The default
23914 is -msubxc when targeting a CPU that supports such an instruction,
23915 such as Niagara-7 and later.
23916
23917 -mfix-at697f
23918 Enable the documented workaround for the single erratum of the
23919 Atmel AT697F processor (which corresponds to erratum #13 of the
23920 AT697E processor).
23921
23922 -mfix-ut699
23923 Enable the documented workarounds for the floating-point errata and
23924 the data cache nullify errata of the UT699 processor.
23925
23926 -mfix-ut700
23927 Enable the documented workaround for the back-to-back store errata
23928 of the UT699E/UT700 processor.
23929
23930 -mfix-gr712rc
23931 Enable the documented workaround for the back-to-back store errata
23932 of the GR712RC processor.
23933
23934 These -m options are supported in addition to the above on SPARC-V9
23935 processors in 64-bit environments:
23936
23937 -m32
23938 -m64
23939 Generate code for a 32-bit or 64-bit environment. The 32-bit
23940 environment sets int, long and pointer to 32 bits. The 64-bit
23941 environment sets int to 32 bits and long and pointer to 64 bits.
23942
23943 -mcmodel=which
23944 Set the code model to one of
23945
23946 medlow
23947 The Medium/Low code model: 64-bit addresses, programs must be
23948 linked in the low 32 bits of memory. Programs can be
23949 statically or dynamically linked.
23950
23951 medmid
23952 The Medium/Middle code model: 64-bit addresses, programs must
23953 be linked in the low 44 bits of memory, the text and data
23954 segments must be less than 2GB in size and the data segment
23955 must be located within 2GB of the text segment.
23956
23957 medany
23958 The Medium/Anywhere code model: 64-bit addresses, programs may
23959 be linked anywhere in memory, the text and data segments must
23960 be less than 2GB in size and the data segment must be located
23961 within 2GB of the text segment.
23962
23963 embmedany
23964 The Medium/Anywhere code model for embedded systems: 64-bit
23965 addresses, the text and data segments must be less than 2GB in
23966 size, both starting anywhere in memory (determined at link
23967 time). The global register %g4 points to the base of the data
23968 segment. Programs are statically linked and PIC is not
23969 supported.
23970
23971 -mmemory-model=mem-model
23972 Set the memory model in force on the processor to one of
23973
23974 default
23975 The default memory model for the processor and operating
23976 system.
23977
23978 rmo Relaxed Memory Order
23979
23980 pso Partial Store Order
23981
23982 tso Total Store Order
23983
23984 sc Sequential Consistency
23985
23986 These memory models are formally defined in Appendix D of the
23987 SPARC-V9 architecture manual, as set in the processor's "PSTATE.MM"
23988 field.
23989
23990 -mstack-bias
23991 -mno-stack-bias
23992 With -mstack-bias, GCC assumes that the stack pointer, and frame
23993 pointer if present, are offset by -2047 which must be added back
23994 when making stack frame references. This is the default in 64-bit
23995 mode. Otherwise, assume no such offset is present.
23996
23997 Options for System V
23998
23999 These additional options are available on System V Release 4 for
24000 compatibility with other compilers on those systems:
24001
24002 -G Create a shared object. It is recommended that -symbolic or
24003 -shared be used instead.
24004
24005 -Qy Identify the versions of each tool used by the compiler, in a
24006 ".ident" assembler directive in the output.
24007
24008 -Qn Refrain from adding ".ident" directives to the output file (this is
24009 the default).
24010
24011 -YP,dirs
24012 Search the directories dirs, and no others, for libraries specified
24013 with -l.
24014
24015 -Ym,dir
24016 Look in the directory dir to find the M4 preprocessor. The
24017 assembler uses this option.
24018
24019 TILE-Gx Options
24020
24021 These -m options are supported on the TILE-Gx:
24022
24023 -mcmodel=small
24024 Generate code for the small model. The distance for direct calls
24025 is limited to 500M in either direction. PC-relative addresses are
24026 32 bits. Absolute addresses support the full address range.
24027
24028 -mcmodel=large
24029 Generate code for the large model. There is no limitation on call
24030 distance, pc-relative addresses, or absolute addresses.
24031
24032 -mcpu=name
24033 Selects the type of CPU to be targeted. Currently the only
24034 supported type is tilegx.
24035
24036 -m32
24037 -m64
24038 Generate code for a 32-bit or 64-bit environment. The 32-bit
24039 environment sets int, long, and pointer to 32 bits. The 64-bit
24040 environment sets int to 32 bits and long and pointer to 64 bits.
24041
24042 -mbig-endian
24043 -mlittle-endian
24044 Generate code in big/little endian mode, respectively.
24045
24046 TILEPro Options
24047
24048 These -m options are supported on the TILEPro:
24049
24050 -mcpu=name
24051 Selects the type of CPU to be targeted. Currently the only
24052 supported type is tilepro.
24053
24054 -m32
24055 Generate code for a 32-bit environment, which sets int, long, and
24056 pointer to 32 bits. This is the only supported behavior so the
24057 flag is essentially ignored.
24058
24059 V850 Options
24060
24061 These -m options are defined for V850 implementations:
24062
24063 -mlong-calls
24064 -mno-long-calls
24065 Treat all calls as being far away (near). If calls are assumed to
24066 be far away, the compiler always loads the function's address into
24067 a register, and calls indirect through the pointer.
24068
24069 -mno-ep
24070 -mep
24071 Do not optimize (do optimize) basic blocks that use the same index
24072 pointer 4 or more times to copy pointer into the "ep" register, and
24073 use the shorter "sld" and "sst" instructions. The -mep option is
24074 on by default if you optimize.
24075
24076 -mno-prolog-function
24077 -mprolog-function
24078 Do not use (do use) external functions to save and restore
24079 registers at the prologue and epilogue of a function. The external
24080 functions are slower, but use less code space if more than one
24081 function saves the same number of registers. The -mprolog-function
24082 option is on by default if you optimize.
24083
24084 -mspace
24085 Try to make the code as small as possible. At present, this just
24086 turns on the -mep and -mprolog-function options.
24087
24088 -mtda=n
24089 Put static or global variables whose size is n bytes or less into
24090 the tiny data area that register "ep" points to. The tiny data
24091 area can hold up to 256 bytes in total (128 bytes for byte
24092 references).
24093
24094 -msda=n
24095 Put static or global variables whose size is n bytes or less into
24096 the small data area that register "gp" points to. The small data
24097 area can hold up to 64 kilobytes.
24098
24099 -mzda=n
24100 Put static or global variables whose size is n bytes or less into
24101 the first 32 kilobytes of memory.
24102
24103 -mv850
24104 Specify that the target processor is the V850.
24105
24106 -mv850e3v5
24107 Specify that the target processor is the V850E3V5. The
24108 preprocessor constant "__v850e3v5__" is defined if this option is
24109 used.
24110
24111 -mv850e2v4
24112 Specify that the target processor is the V850E3V5. This is an
24113 alias for the -mv850e3v5 option.
24114
24115 -mv850e2v3
24116 Specify that the target processor is the V850E2V3. The
24117 preprocessor constant "__v850e2v3__" is defined if this option is
24118 used.
24119
24120 -mv850e2
24121 Specify that the target processor is the V850E2. The preprocessor
24122 constant "__v850e2__" is defined if this option is used.
24123
24124 -mv850e1
24125 Specify that the target processor is the V850E1. The preprocessor
24126 constants "__v850e1__" and "__v850e__" are defined if this option
24127 is used.
24128
24129 -mv850es
24130 Specify that the target processor is the V850ES. This is an alias
24131 for the -mv850e1 option.
24132
24133 -mv850e
24134 Specify that the target processor is the V850E. The preprocessor
24135 constant "__v850e__" is defined if this option is used.
24136
24137 If neither -mv850 nor -mv850e nor -mv850e1 nor -mv850e2 nor
24138 -mv850e2v3 nor -mv850e3v5 are defined then a default target
24139 processor is chosen and the relevant __v850*__ preprocessor
24140 constant is defined.
24141
24142 The preprocessor constants "__v850" and "__v851__" are always
24143 defined, regardless of which processor variant is the target.
24144
24145 -mdisable-callt
24146 -mno-disable-callt
24147 This option suppresses generation of the "CALLT" instruction for
24148 the v850e, v850e1, v850e2, v850e2v3 and v850e3v5 flavors of the
24149 v850 architecture.
24150
24151 This option is enabled by default when the RH850 ABI is in use (see
24152 -mrh850-abi), and disabled by default when the GCC ABI is in use.
24153 If "CALLT" instructions are being generated then the C preprocessor
24154 symbol "__V850_CALLT__" is defined.
24155
24156 -mrelax
24157 -mno-relax
24158 Pass on (or do not pass on) the -mrelax command-line option to the
24159 assembler.
24160
24161 -mlong-jumps
24162 -mno-long-jumps
24163 Disable (or re-enable) the generation of PC-relative jump
24164 instructions.
24165
24166 -msoft-float
24167 -mhard-float
24168 Disable (or re-enable) the generation of hardware floating point
24169 instructions. This option is only significant when the target
24170 architecture is V850E2V3 or higher. If hardware floating point
24171 instructions are being generated then the C preprocessor symbol
24172 "__FPU_OK__" is defined, otherwise the symbol "__NO_FPU__" is
24173 defined.
24174
24175 -mloop
24176 Enables the use of the e3v5 LOOP instruction. The use of this
24177 instruction is not enabled by default when the e3v5 architecture is
24178 selected because its use is still experimental.
24179
24180 -mrh850-abi
24181 -mghs
24182 Enables support for the RH850 version of the V850 ABI. This is the
24183 default. With this version of the ABI the following rules apply:
24184
24185 * Integer sized structures and unions are returned via a memory
24186 pointer rather than a register.
24187
24188 * Large structures and unions (more than 8 bytes in size) are
24189 passed by value.
24190
24191 * Functions are aligned to 16-bit boundaries.
24192
24193 * The -m8byte-align command-line option is supported.
24194
24195 * The -mdisable-callt command-line option is enabled by default.
24196 The -mno-disable-callt command-line option is not supported.
24197
24198 When this version of the ABI is enabled the C preprocessor symbol
24199 "__V850_RH850_ABI__" is defined.
24200
24201 -mgcc-abi
24202 Enables support for the old GCC version of the V850 ABI. With this
24203 version of the ABI the following rules apply:
24204
24205 * Integer sized structures and unions are returned in register
24206 "r10".
24207
24208 * Large structures and unions (more than 8 bytes in size) are
24209 passed by reference.
24210
24211 * Functions are aligned to 32-bit boundaries, unless optimizing
24212 for size.
24213
24214 * The -m8byte-align command-line option is not supported.
24215
24216 * The -mdisable-callt command-line option is supported but not
24217 enabled by default.
24218
24219 When this version of the ABI is enabled the C preprocessor symbol
24220 "__V850_GCC_ABI__" is defined.
24221
24222 -m8byte-align
24223 -mno-8byte-align
24224 Enables support for "double" and "long long" types to be aligned on
24225 8-byte boundaries. The default is to restrict the alignment of all
24226 objects to at most 4-bytes. When -m8byte-align is in effect the C
24227 preprocessor symbol "__V850_8BYTE_ALIGN__" is defined.
24228
24229 -mbig-switch
24230 Generate code suitable for big switch tables. Use this option only
24231 if the assembler/linker complain about out of range branches within
24232 a switch table.
24233
24234 -mapp-regs
24235 This option causes r2 and r5 to be used in the code generated by
24236 the compiler. This setting is the default.
24237
24238 -mno-app-regs
24239 This option causes r2 and r5 to be treated as fixed registers.
24240
24241 VAX Options
24242
24243 These -m options are defined for the VAX:
24244
24245 -munix
24246 Do not output certain jump instructions ("aobleq" and so on) that
24247 the Unix assembler for the VAX cannot handle across long ranges.
24248
24249 -mgnu
24250 Do output those jump instructions, on the assumption that the GNU
24251 assembler is being used.
24252
24253 -mg Output code for G-format floating-point numbers instead of
24254 D-format.
24255
24256 Visium Options
24257
24258 -mdebug
24259 A program which performs file I/O and is destined to run on an MCM
24260 target should be linked with this option. It causes the libraries
24261 libc.a and libdebug.a to be linked. The program should be run on
24262 the target under the control of the GDB remote debugging stub.
24263
24264 -msim
24265 A program which performs file I/O and is destined to run on the
24266 simulator should be linked with option. This causes libraries
24267 libc.a and libsim.a to be linked.
24268
24269 -mfpu
24270 -mhard-float
24271 Generate code containing floating-point instructions. This is the
24272 default.
24273
24274 -mno-fpu
24275 -msoft-float
24276 Generate code containing library calls for floating-point.
24277
24278 -msoft-float changes the calling convention in the output file;
24279 therefore, it is only useful if you compile all of a program with
24280 this option. In particular, you need to compile libgcc.a, the
24281 library that comes with GCC, with -msoft-float in order for this to
24282 work.
24283
24284 -mcpu=cpu_type
24285 Set the instruction set, register set, and instruction scheduling
24286 parameters for machine type cpu_type. Supported values for
24287 cpu_type are mcm, gr5 and gr6.
24288
24289 mcm is a synonym of gr5 present for backward compatibility.
24290
24291 By default (unless configured otherwise), GCC generates code for
24292 the GR5 variant of the Visium architecture.
24293
24294 With -mcpu=gr6, GCC generates code for the GR6 variant of the
24295 Visium architecture. The only difference from GR5 code is that the
24296 compiler will generate block move instructions.
24297
24298 -mtune=cpu_type
24299 Set the instruction scheduling parameters for machine type
24300 cpu_type, but do not set the instruction set or register set that
24301 the option -mcpu=cpu_type would.
24302
24303 -msv-mode
24304 Generate code for the supervisor mode, where there are no
24305 restrictions on the access to general registers. This is the
24306 default.
24307
24308 -muser-mode
24309 Generate code for the user mode, where the access to some general
24310 registers is forbidden: on the GR5, registers r24 to r31 cannot be
24311 accessed in this mode; on the GR6, only registers r29 to r31 are
24312 affected.
24313
24314 VMS Options
24315
24316 These -m options are defined for the VMS implementations:
24317
24318 -mvms-return-codes
24319 Return VMS condition codes from "main". The default is to return
24320 POSIX-style condition (e.g. error) codes.
24321
24322 -mdebug-main=prefix
24323 Flag the first routine whose name starts with prefix as the main
24324 routine for the debugger.
24325
24326 -mmalloc64
24327 Default to 64-bit memory allocation routines.
24328
24329 -mpointer-size=size
24330 Set the default size of pointers. Possible options for size are 32
24331 or short for 32 bit pointers, 64 or long for 64 bit pointers, and
24332 no for supporting only 32 bit pointers. The later option disables
24333 "pragma pointer_size".
24334
24335 VxWorks Options
24336
24337 The options in this section are defined for all VxWorks targets.
24338 Options specific to the target hardware are listed with the other
24339 options for that target.
24340
24341 -mrtp
24342 GCC can generate code for both VxWorks kernels and real time
24343 processes (RTPs). This option switches from the former to the
24344 latter. It also defines the preprocessor macro "__RTP__".
24345
24346 -non-static
24347 Link an RTP executable against shared libraries rather than static
24348 libraries. The options -static and -shared can also be used for
24349 RTPs; -static is the default.
24350
24351 -Bstatic
24352 -Bdynamic
24353 These options are passed down to the linker. They are defined for
24354 compatibility with Diab.
24355
24356 -Xbind-lazy
24357 Enable lazy binding of function calls. This option is equivalent
24358 to -Wl,-z,now and is defined for compatibility with Diab.
24359
24360 -Xbind-now
24361 Disable lazy binding of function calls. This option is the default
24362 and is defined for compatibility with Diab.
24363
24364 x86 Options
24365
24366 These -m options are defined for the x86 family of computers.
24367
24368 -march=cpu-type
24369 Generate instructions for the machine type cpu-type. In contrast
24370 to -mtune=cpu-type, which merely tunes the generated code for the
24371 specified cpu-type, -march=cpu-type allows GCC to generate code
24372 that may not run at all on processors other than the one indicated.
24373 Specifying -march=cpu-type implies -mtune=cpu-type.
24374
24375 The choices for cpu-type are:
24376
24377 native
24378 This selects the CPU to generate code for at compilation time
24379 by determining the processor type of the compiling machine.
24380 Using -march=native enables all instruction subsets supported
24381 by the local machine (hence the result might not run on
24382 different machines). Using -mtune=native produces code
24383 optimized for the local machine under the constraints of the
24384 selected instruction set.
24385
24386 x86-64
24387 A generic CPU with 64-bit extensions.
24388
24389 i386
24390 Original Intel i386 CPU.
24391
24392 i486
24393 Intel i486 CPU. (No scheduling is implemented for this chip.)
24394
24395 i586
24396 pentium
24397 Intel Pentium CPU with no MMX support.
24398
24399 lakemont
24400 Intel Lakemont MCU, based on Intel Pentium CPU.
24401
24402 pentium-mmx
24403 Intel Pentium MMX CPU, based on Pentium core with MMX
24404 instruction set support.
24405
24406 pentiumpro
24407 Intel Pentium Pro CPU.
24408
24409 i686
24410 When used with -march, the Pentium Pro instruction set is used,
24411 so the code runs on all i686 family chips. When used with
24412 -mtune, it has the same meaning as generic.
24413
24414 pentium2
24415 Intel Pentium II CPU, based on Pentium Pro core with MMX
24416 instruction set support.
24417
24418 pentium3
24419 pentium3m
24420 Intel Pentium III CPU, based on Pentium Pro core with MMX and
24421 SSE instruction set support.
24422
24423 pentium-m
24424 Intel Pentium M; low-power version of Intel Pentium III CPU
24425 with MMX, SSE and SSE2 instruction set support. Used by
24426 Centrino notebooks.
24427
24428 pentium4
24429 pentium4m
24430 Intel Pentium 4 CPU with MMX, SSE and SSE2 instruction set
24431 support.
24432
24433 prescott
24434 Improved version of Intel Pentium 4 CPU with MMX, SSE, SSE2 and
24435 SSE3 instruction set support.
24436
24437 nocona
24438 Improved version of Intel Pentium 4 CPU with 64-bit extensions,
24439 MMX, SSE, SSE2 and SSE3 instruction set support.
24440
24441 core2
24442 Intel Core 2 CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3
24443 and SSSE3 instruction set support.
24444
24445 nehalem
24446 Intel Nehalem CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3,
24447 SSSE3, SSE4.1, SSE4.2 and POPCNT instruction set support.
24448
24449 westmere
24450 Intel Westmere CPU with 64-bit extensions, MMX, SSE, SSE2,
24451 SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, AES and PCLMUL instruction
24452 set support.
24453
24454 sandybridge
24455 Intel Sandy Bridge CPU with 64-bit extensions, MMX, SSE, SSE2,
24456 SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, AVX, AES and PCLMUL
24457 instruction set support.
24458
24459 ivybridge
24460 Intel Ivy Bridge CPU with 64-bit extensions, MMX, SSE, SSE2,
24461 SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, AVX, AES, PCLMUL,
24462 FSGSBASE, RDRND and F16C instruction set support.
24463
24464 haswell
24465 Intel Haswell CPU with 64-bit extensions, MOVBE, MMX, SSE,
24466 SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES,
24467 PCLMUL, FSGSBASE, RDRND, FMA, BMI, BMI2 and F16C instruction
24468 set support.
24469
24470 broadwell
24471 Intel Broadwell CPU with 64-bit extensions, MOVBE, MMX, SSE,
24472 SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES,
24473 PCLMUL, FSGSBASE, RDRND, FMA, BMI, BMI2, F16C, RDSEED ADCX and
24474 PREFETCHW instruction set support.
24475
24476 skylake
24477 Intel Skylake CPU with 64-bit extensions, MOVBE, MMX, SSE,
24478 SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES,
24479 PCLMUL, FSGSBASE, RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX,
24480 PREFETCHW, CLFLUSHOPT, XSAVEC and XSAVES instruction set
24481 support.
24482
24483 bonnell
24484 Intel Bonnell CPU with 64-bit extensions, MOVBE, MMX, SSE,
24485 SSE2, SSE3 and SSSE3 instruction set support.
24486
24487 silvermont
24488 Intel Silvermont CPU with 64-bit extensions, MOVBE, MMX, SSE,
24489 SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, AES, PREFETCHW,
24490 PCLMUL and RDRND instruction set support.
24491
24492 goldmont
24493 Intel Goldmont CPU with 64-bit extensions, MOVBE, MMX, SSE,
24494 SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, AES, PREFETCHW,
24495 PCLMUL, RDRND, XSAVE, XSAVEC, XSAVES, XSAVEOPT and FSGSBASE
24496 instruction set support.
24497
24498 goldmont-plus
24499 Intel Goldmont Plus CPU with 64-bit extensions, MOVBE, MMX,
24500 SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, AES, PREFETCHW,
24501 PCLMUL, RDRND, XSAVE, XSAVEC, XSAVES, XSAVEOPT, FSGSBASE,
24502 PTWRITE, RDPID, SGX and UMIP instruction set support.
24503
24504 tremont
24505 Intel Tremont CPU with 64-bit extensions, MOVBE, MMX, SSE,
24506 SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, AES, PREFETCHW,
24507 PCLMUL, RDRND, XSAVE, XSAVEC, XSAVES, XSAVEOPT, FSGSBASE,
24508 PTWRITE, RDPID, SGX, UMIP, GFNI-SSE, CLWB, MOVDIRI, MOVDIR64B,
24509 CLDEMOTE and WAITPKG instruction set support.
24510
24511 knl Intel Knight's Landing CPU with 64-bit extensions, MOVBE, MMX,
24512 SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES,
24513 PCLMUL, FSGSBASE, RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX,
24514 PREFETCHW, PREFETCHWT1, AVX512F, AVX512PF, AVX512ER and
24515 AVX512CD instruction set support.
24516
24517 knm Intel Knights Mill CPU with 64-bit extensions, MOVBE, MMX, SSE,
24518 SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES,
24519 PCLMUL, FSGSBASE, RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX,
24520 PREFETCHW, PREFETCHWT1, AVX512F, AVX512PF, AVX512ER, AVX512CD,
24521 AVX5124VNNIW, AVX5124FMAPS and AVX512VPOPCNTDQ instruction set
24522 support.
24523
24524 skylake-avx512
24525 Intel Skylake Server CPU with 64-bit extensions, MOVBE, MMX,
24526 SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2,
24527 AES, PCLMUL, FSGSBASE, RDRND, FMA, BMI, BMI2, F16C, RDSEED,
24528 ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F, CLWB,
24529 AVX512VL, AVX512BW, AVX512DQ and AVX512CD instruction set
24530 support.
24531
24532 cannonlake
24533 Intel Cannonlake Server CPU with 64-bit extensions, MOVBE, MMX,
24534 SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2,
24535 AES, PCLMUL, FSGSBASE, RDRND, FMA, BMI, BMI2, F16C, RDSEED,
24536 ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F, AVX512VL,
24537 AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI, AVX512IFMA, SHA and
24538 UMIP instruction set support.
24539
24540 icelake-client
24541 Intel Icelake Client CPU with 64-bit extensions, MOVBE, MMX,
24542 SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2,
24543 AES, PCLMUL, FSGSBASE, RDRND, FMA, BMI, BMI2, F16C, RDSEED,
24544 ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F, AVX512VL,
24545 AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI, AVX512IFMA, SHA,
24546 CLWB, UMIP, RDPID, GFNI, AVX512VBMI2, AVX512VPOPCNTDQ,
24547 AVX512BITALG, AVX512VNNI, VPCLMULQDQ, VAES instruction set
24548 support.
24549
24550 icelake-server
24551 Intel Icelake Server CPU with 64-bit extensions, MOVBE, MMX,
24552 SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2,
24553 AES, PCLMUL, FSGSBASE, RDRND, FMA, BMI, BMI2, F16C, RDSEED,
24554 ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F, AVX512VL,
24555 AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI, AVX512IFMA, SHA,
24556 CLWB, UMIP, RDPID, GFNI, AVX512VBMI2, AVX512VPOPCNTDQ,
24557 AVX512BITALG, AVX512VNNI, VPCLMULQDQ, VAES, PCONFIG and
24558 WBNOINVD instruction set support.
24559
24560 cascadelake
24561 Intel Cascadelake CPU with 64-bit extensions, MOVBE, MMX, SSE,
24562 SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES,
24563 PCLMUL, FSGSBASE, RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX,
24564 PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F, CLWB, AVX512VL,
24565 AVX512BW, AVX512DQ, AVX512CD and AVX512VNNI instruction set
24566 support.
24567
24568 cooperlake
24569 Intel cooperlake CPU with 64-bit extensions, MOVBE, MMX, SSE,
24570 SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES,
24571 PCLMUL, FSGSBASE, RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX,
24572 PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F, CLWB, AVX512VL,
24573 AVX512BW, AVX512DQ, AVX512CD, AVX512VNNI and AVX512BF16
24574 instruction set support.
24575
24576 tigerlake
24577 Intel Tigerlake CPU with 64-bit extensions, MOVBE, MMX, SSE,
24578 SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES,
24579 PCLMUL, FSGSBASE, RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX,
24580 PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F, AVX512VL,
24581 AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI, AVX512IFMA, SHA,
24582 CLWB, UMIP, RDPID, GFNI, AVX512VBMI2, AVX512VPOPCNTDQ,
24583 AVX512BITALG, AVX512VNNI, VPCLMULQDQ, VAES, PCONFIG, WBNOINVD,
24584 MOVDIRI, MOVDIR64B, AVX512VP2INTERSECT and KEYLOCKER
24585 instruction set support.
24586
24587 k6 AMD K6 CPU with MMX instruction set support.
24588
24589 k6-2
24590 k6-3
24591 Improved versions of AMD K6 CPU with MMX and 3DNow! instruction
24592 set support.
24593
24594 athlon
24595 athlon-tbird
24596 AMD Athlon CPU with MMX, 3dNOW!, enhanced 3DNow! and SSE
24597 prefetch instructions support.
24598
24599 athlon-4
24600 athlon-xp
24601 athlon-mp
24602 Improved AMD Athlon CPU with MMX, 3DNow!, enhanced 3DNow! and
24603 full SSE instruction set support.
24604
24605 k8
24606 opteron
24607 athlon64
24608 athlon-fx
24609 Processors based on the AMD K8 core with x86-64 instruction set
24610 support, including the AMD Opteron, Athlon 64, and Athlon 64 FX
24611 processors. (This supersets MMX, SSE, SSE2, 3DNow!, enhanced
24612 3DNow! and 64-bit instruction set extensions.)
24613
24614 k8-sse3
24615 opteron-sse3
24616 athlon64-sse3
24617 Improved versions of AMD K8 cores with SSE3 instruction set
24618 support.
24619
24620 amdfam10
24621 barcelona
24622 CPUs based on AMD Family 10h cores with x86-64 instruction set
24623 support. (This supersets MMX, SSE, SSE2, SSE3, SSE4A, 3DNow!,
24624 enhanced 3DNow!, ABM and 64-bit instruction set extensions.)
24625
24626 bdver1
24627 CPUs based on AMD Family 15h cores with x86-64 instruction set
24628 support. (This supersets FMA4, AVX, XOP, LWP, AES, PCLMUL,
24629 CX16, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM
24630 and 64-bit instruction set extensions.)
24631
24632 bdver2
24633 AMD Family 15h core based CPUs with x86-64 instruction set
24634 support. (This supersets BMI, TBM, F16C, FMA, FMA4, AVX, XOP,
24635 LWP, AES, PCLMUL, CX16, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3,
24636 SSE4.1, SSE4.2, ABM and 64-bit instruction set extensions.)
24637
24638 bdver3
24639 AMD Family 15h core based CPUs with x86-64 instruction set
24640 support. (This supersets BMI, TBM, F16C, FMA, FMA4, FSGSBASE,
24641 AVX, XOP, LWP, AES, PCLMUL, CX16, MMX, SSE, SSE2, SSE3, SSE4A,
24642 SSSE3, SSE4.1, SSE4.2, ABM and 64-bit instruction set
24643 extensions.)
24644
24645 bdver4
24646 AMD Family 15h core based CPUs with x86-64 instruction set
24647 support. (This supersets BMI, BMI2, TBM, F16C, FMA, FMA4,
24648 FSGSBASE, AVX, AVX2, XOP, LWP, AES, PCLMUL, CX16, MOVBE, MMX,
24649 SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM and 64-bit
24650 instruction set extensions.)
24651
24652 znver1
24653 AMD Family 17h core based CPUs with x86-64 instruction set
24654 support. (This supersets BMI, BMI2, F16C, FMA, FSGSBASE, AVX,
24655 AVX2, ADCX, RDSEED, MWAITX, SHA, CLZERO, AES, PCLMUL, CX16,
24656 MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM,
24657 XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, and 64-bit instruction set
24658 extensions.)
24659
24660 znver2
24661 AMD Family 17h core based CPUs with x86-64 instruction set
24662 support. (This supersets BMI, BMI2, CLWB, F16C, FMA, FSGSBASE,
24663 AVX, AVX2, ADCX, RDSEED, MWAITX, SHA, CLZERO, AES, PCLMUL,
24664 CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1,
24665 SSE4.2, ABM, XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, RDPID,
24666 WBNOINVD, and 64-bit instruction set extensions.)
24667
24668 znver3
24669 AMD Family 19h core based CPUs with x86-64 instruction set
24670 support. (This supersets BMI, BMI2, CLWB, F16C, FMA, FSGSBASE,
24671 AVX, AVX2, ADCX, RDSEED, MWAITX, SHA, CLZERO, AES, PCLMUL,
24672 CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1,
24673 SSE4.2, ABM, XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, RDPID,
24674 WBNOINVD, PKU, VPCLMULQDQ, VAES, and 64-bit instruction set
24675 extensions.)
24676
24677 btver1
24678 CPUs based on AMD Family 14h cores with x86-64 instruction set
24679 support. (This supersets MMX, SSE, SSE2, SSE3, SSSE3, SSE4A,
24680 CX16, ABM and 64-bit instruction set extensions.)
24681
24682 btver2
24683 CPUs based on AMD Family 16h cores with x86-64 instruction set
24684 support. This includes MOVBE, F16C, BMI, AVX, PCLMUL, AES,
24685 SSE4.2, SSE4.1, CX16, ABM, SSE4A, SSSE3, SSE3, SSE2, SSE, MMX
24686 and 64-bit instruction set extensions.
24687
24688 winchip-c6
24689 IDT WinChip C6 CPU, dealt in same way as i486 with additional
24690 MMX instruction set support.
24691
24692 winchip2
24693 IDT WinChip 2 CPU, dealt in same way as i486 with additional
24694 MMX and 3DNow! instruction set support.
24695
24696 c3 VIA C3 CPU with MMX and 3DNow! instruction set support. (No
24697 scheduling is implemented for this chip.)
24698
24699 c3-2
24700 VIA C3-2 (Nehemiah/C5XL) CPU with MMX and SSE instruction set
24701 support. (No scheduling is implemented for this chip.)
24702
24703 c7 VIA C7 (Esther) CPU with MMX, SSE, SSE2 and SSE3 instruction
24704 set support. (No scheduling is implemented for this chip.)
24705
24706 samuel-2
24707 VIA Eden Samuel 2 CPU with MMX and 3DNow! instruction set
24708 support. (No scheduling is implemented for this chip.)
24709
24710 nehemiah
24711 VIA Eden Nehemiah CPU with MMX and SSE instruction set support.
24712 (No scheduling is implemented for this chip.)
24713
24714 esther
24715 VIA Eden Esther CPU with MMX, SSE, SSE2 and SSE3 instruction
24716 set support. (No scheduling is implemented for this chip.)
24717
24718 eden-x2
24719 VIA Eden X2 CPU with x86-64, MMX, SSE, SSE2 and SSE3
24720 instruction set support. (No scheduling is implemented for
24721 this chip.)
24722
24723 eden-x4
24724 VIA Eden X4 CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3,
24725 SSE4.1, SSE4.2, AVX and AVX2 instruction set support. (No
24726 scheduling is implemented for this chip.)
24727
24728 nano
24729 Generic VIA Nano CPU with x86-64, MMX, SSE, SSE2, SSE3 and
24730 SSSE3 instruction set support. (No scheduling is implemented
24731 for this chip.)
24732
24733 nano-1000
24734 VIA Nano 1xxx CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
24735 instruction set support. (No scheduling is implemented for
24736 this chip.)
24737
24738 nano-2000
24739 VIA Nano 2xxx CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
24740 instruction set support. (No scheduling is implemented for
24741 this chip.)
24742
24743 nano-3000
24744 VIA Nano 3xxx CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and
24745 SSE4.1 instruction set support. (No scheduling is implemented
24746 for this chip.)
24747
24748 nano-x2
24749 VIA Nano Dual Core CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3
24750 and SSE4.1 instruction set support. (No scheduling is
24751 implemented for this chip.)
24752
24753 nano-x4
24754 VIA Nano Quad Core CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3
24755 and SSE4.1 instruction set support. (No scheduling is
24756 implemented for this chip.)
24757
24758 geode
24759 AMD Geode embedded processor with MMX and 3DNow! instruction
24760 set support.
24761
24762 -mtune=cpu-type
24763 Tune to cpu-type everything applicable about the generated code,
24764 except for the ABI and the set of available instructions. While
24765 picking a specific cpu-type schedules things appropriately for that
24766 particular chip, the compiler does not generate any code that
24767 cannot run on the default machine type unless you use a -march=cpu-
24768 type option. For example, if GCC is configured for
24769 i686-pc-linux-gnu then -mtune=pentium4 generates code that is tuned
24770 for Pentium 4 but still runs on i686 machines.
24771
24772 The choices for cpu-type are the same as for -march. In addition,
24773 -mtune supports 2 extra choices for cpu-type:
24774
24775 generic
24776 Produce code optimized for the most common IA32/AMD64/EM64T
24777 processors. If you know the CPU on which your code will run,
24778 then you should use the corresponding -mtune or -march option
24779 instead of -mtune=generic. But, if you do not know exactly
24780 what CPU users of your application will have, then you should
24781 use this option.
24782
24783 As new processors are deployed in the marketplace, the behavior
24784 of this option will change. Therefore, if you upgrade to a
24785 newer version of GCC, code generation controlled by this option
24786 will change to reflect the processors that are most common at
24787 the time that version of GCC is released.
24788
24789 There is no -march=generic option because -march indicates the
24790 instruction set the compiler can use, and there is no generic
24791 instruction set applicable to all processors. In contrast,
24792 -mtune indicates the processor (or, in this case, collection of
24793 processors) for which the code is optimized.
24794
24795 intel
24796 Produce code optimized for the most current Intel processors,
24797 which are Haswell and Silvermont for this version of GCC. If
24798 you know the CPU on which your code will run, then you should
24799 use the corresponding -mtune or -march option instead of
24800 -mtune=intel. But, if you want your application performs
24801 better on both Haswell and Silvermont, then you should use this
24802 option.
24803
24804 As new Intel processors are deployed in the marketplace, the
24805 behavior of this option will change. Therefore, if you upgrade
24806 to a newer version of GCC, code generation controlled by this
24807 option will change to reflect the most current Intel processors
24808 at the time that version of GCC is released.
24809
24810 There is no -march=intel option because -march indicates the
24811 instruction set the compiler can use, and there is no common
24812 instruction set applicable to all processors. In contrast,
24813 -mtune indicates the processor (or, in this case, collection of
24814 processors) for which the code is optimized.
24815
24816 -mcpu=cpu-type
24817 A deprecated synonym for -mtune.
24818
24819 -mfpmath=unit
24820 Generate floating-point arithmetic for selected unit unit. The
24821 choices for unit are:
24822
24823 387 Use the standard 387 floating-point coprocessor present on the
24824 majority of chips and emulated otherwise. Code compiled with
24825 this option runs almost everywhere. The temporary results are
24826 computed in 80-bit precision instead of the precision specified
24827 by the type, resulting in slightly different results compared
24828 to most of other chips. See -ffloat-store for more detailed
24829 description.
24830
24831 This is the default choice for non-Darwin x86-32 targets.
24832
24833 sse Use scalar floating-point instructions present in the SSE
24834 instruction set. This instruction set is supported by Pentium
24835 III and newer chips, and in the AMD line by Athlon-4, Athlon XP
24836 and Athlon MP chips. The earlier version of the SSE
24837 instruction set supports only single-precision arithmetic, thus
24838 the double and extended-precision arithmetic are still done
24839 using 387. A later version, present only in Pentium 4 and AMD
24840 x86-64 chips, supports double-precision arithmetic too.
24841
24842 For the x86-32 compiler, you must use -march=cpu-type, -msse or
24843 -msse2 switches to enable SSE extensions and make this option
24844 effective. For the x86-64 compiler, these extensions are
24845 enabled by default.
24846
24847 The resulting code should be considerably faster in the
24848 majority of cases and avoid the numerical instability problems
24849 of 387 code, but may break some existing code that expects
24850 temporaries to be 80 bits.
24851
24852 This is the default choice for the x86-64 compiler, Darwin
24853 x86-32 targets, and the default choice for x86-32 targets with
24854 the SSE2 instruction set when -ffast-math is enabled.
24855
24856 sse,387
24857 sse+387
24858 both
24859 Attempt to utilize both instruction sets at once. This
24860 effectively doubles the amount of available registers, and on
24861 chips with separate execution units for 387 and SSE the
24862 execution resources too. Use this option with care, as it is
24863 still experimental, because the GCC register allocator does not
24864 model separate functional units well, resulting in unstable
24865 performance.
24866
24867 -masm=dialect
24868 Output assembly instructions using selected dialect. Also affects
24869 which dialect is used for basic "asm" and extended "asm". Supported
24870 choices (in dialect order) are att or intel. The default is att.
24871 Darwin does not support intel.
24872
24873 -mieee-fp
24874 -mno-ieee-fp
24875 Control whether or not the compiler uses IEEE floating-point
24876 comparisons. These correctly handle the case where the result of a
24877 comparison is unordered.
24878
24879 -m80387
24880 -mhard-float
24881 Generate output containing 80387 instructions for floating point.
24882
24883 -mno-80387
24884 -msoft-float
24885 Generate output containing library calls for floating point.
24886
24887 Warning: the requisite libraries are not part of GCC. Normally the
24888 facilities of the machine's usual C compiler are used, but this
24889 cannot be done directly in cross-compilation. You must make your
24890 own arrangements to provide suitable library functions for cross-
24891 compilation.
24892
24893 On machines where a function returns floating-point results in the
24894 80387 register stack, some floating-point opcodes may be emitted
24895 even if -msoft-float is used.
24896
24897 -mno-fp-ret-in-387
24898 Do not use the FPU registers for return values of functions.
24899
24900 The usual calling convention has functions return values of types
24901 "float" and "double" in an FPU register, even if there is no FPU.
24902 The idea is that the operating system should emulate an FPU.
24903
24904 The option -mno-fp-ret-in-387 causes such values to be returned in
24905 ordinary CPU registers instead.
24906
24907 -mno-fancy-math-387
24908 Some 387 emulators do not support the "sin", "cos" and "sqrt"
24909 instructions for the 387. Specify this option to avoid generating
24910 those instructions. This option is overridden when -march
24911 indicates that the target CPU always has an FPU and so the
24912 instruction does not need emulation. These instructions are not
24913 generated unless you also use the -funsafe-math-optimizations
24914 switch.
24915
24916 -malign-double
24917 -mno-align-double
24918 Control whether GCC aligns "double", "long double", and "long long"
24919 variables on a two-word boundary or a one-word boundary. Aligning
24920 "double" variables on a two-word boundary produces code that runs
24921 somewhat faster on a Pentium at the expense of more memory.
24922
24923 On x86-64, -malign-double is enabled by default.
24924
24925 Warning: if you use the -malign-double switch, structures
24926 containing the above types are aligned differently than the
24927 published application binary interface specifications for the
24928 x86-32 and are not binary compatible with structures in code
24929 compiled without that switch.
24930
24931 -m96bit-long-double
24932 -m128bit-long-double
24933 These switches control the size of "long double" type. The x86-32
24934 application binary interface specifies the size to be 96 bits, so
24935 -m96bit-long-double is the default in 32-bit mode.
24936
24937 Modern architectures (Pentium and newer) prefer "long double" to be
24938 aligned to an 8- or 16-byte boundary. In arrays or structures
24939 conforming to the ABI, this is not possible. So specifying
24940 -m128bit-long-double aligns "long double" to a 16-byte boundary by
24941 padding the "long double" with an additional 32-bit zero.
24942
24943 In the x86-64 compiler, -m128bit-long-double is the default choice
24944 as its ABI specifies that "long double" is aligned on 16-byte
24945 boundary.
24946
24947 Notice that neither of these options enable any extra precision
24948 over the x87 standard of 80 bits for a "long double".
24949
24950 Warning: if you override the default value for your target ABI,
24951 this changes the size of structures and arrays containing "long
24952 double" variables, as well as modifying the function calling
24953 convention for functions taking "long double". Hence they are not
24954 binary-compatible with code compiled without that switch.
24955
24956 -mlong-double-64
24957 -mlong-double-80
24958 -mlong-double-128
24959 These switches control the size of "long double" type. A size of 64
24960 bits makes the "long double" type equivalent to the "double" type.
24961 This is the default for 32-bit Bionic C library. A size of 128
24962 bits makes the "long double" type equivalent to the "__float128"
24963 type. This is the default for 64-bit Bionic C library.
24964
24965 Warning: if you override the default value for your target ABI,
24966 this changes the size of structures and arrays containing "long
24967 double" variables, as well as modifying the function calling
24968 convention for functions taking "long double". Hence they are not
24969 binary-compatible with code compiled without that switch.
24970
24971 -malign-data=type
24972 Control how GCC aligns variables. Supported values for type are
24973 compat uses increased alignment value compatible uses GCC 4.8 and
24974 earlier, abi uses alignment value as specified by the psABI, and
24975 cacheline uses increased alignment value to match the cache line
24976 size. compat is the default.
24977
24978 -mlarge-data-threshold=threshold
24979 When -mcmodel=medium is specified, data objects larger than
24980 threshold are placed in the large data section. This value must be
24981 the same across all objects linked into the binary, and defaults to
24982 65535.
24983
24984 -mrtd
24985 Use a different function-calling convention, in which functions
24986 that take a fixed number of arguments return with the "ret num"
24987 instruction, which pops their arguments while returning. This
24988 saves one instruction in the caller since there is no need to pop
24989 the arguments there.
24990
24991 You can specify that an individual function is called with this
24992 calling sequence with the function attribute "stdcall". You can
24993 also override the -mrtd option by using the function attribute
24994 "cdecl".
24995
24996 Warning: this calling convention is incompatible with the one
24997 normally used on Unix, so you cannot use it if you need to call
24998 libraries compiled with the Unix compiler.
24999
25000 Also, you must provide function prototypes for all functions that
25001 take variable numbers of arguments (including "printf"); otherwise
25002 incorrect code is generated for calls to those functions.
25003
25004 In addition, seriously incorrect code results if you call a
25005 function with too many arguments. (Normally, extra arguments are
25006 harmlessly ignored.)
25007
25008 -mregparm=num
25009 Control how many registers are used to pass integer arguments. By
25010 default, no registers are used to pass arguments, and at most 3
25011 registers can be used. You can control this behavior for a
25012 specific function by using the function attribute "regparm".
25013
25014 Warning: if you use this switch, and num is nonzero, then you must
25015 build all modules with the same value, including any libraries.
25016 This includes the system libraries and startup modules.
25017
25018 -msseregparm
25019 Use SSE register passing conventions for float and double arguments
25020 and return values. You can control this behavior for a specific
25021 function by using the function attribute "sseregparm".
25022
25023 Warning: if you use this switch then you must build all modules
25024 with the same value, including any libraries. This includes the
25025 system libraries and startup modules.
25026
25027 -mvect8-ret-in-mem
25028 Return 8-byte vectors in memory instead of MMX registers. This is
25029 the default on VxWorks to match the ABI of the Sun Studio compilers
25030 until version 12. Only use this option if you need to remain
25031 compatible with existing code produced by those previous compiler
25032 versions or older versions of GCC.
25033
25034 -mpc32
25035 -mpc64
25036 -mpc80
25037 Set 80387 floating-point precision to 32, 64 or 80 bits. When
25038 -mpc32 is specified, the significands of results of floating-point
25039 operations are rounded to 24 bits (single precision); -mpc64 rounds
25040 the significands of results of floating-point operations to 53 bits
25041 (double precision) and -mpc80 rounds the significands of results of
25042 floating-point operations to 64 bits (extended double precision),
25043 which is the default. When this option is used, floating-point
25044 operations in higher precisions are not available to the programmer
25045 without setting the FPU control word explicitly.
25046
25047 Setting the rounding of floating-point operations to less than the
25048 default 80 bits can speed some programs by 2% or more. Note that
25049 some mathematical libraries assume that extended-precision (80-bit)
25050 floating-point operations are enabled by default; routines in such
25051 libraries could suffer significant loss of accuracy, typically
25052 through so-called "catastrophic cancellation", when this option is
25053 used to set the precision to less than extended precision.
25054
25055 -mstackrealign
25056 Realign the stack at entry. On the x86, the -mstackrealign option
25057 generates an alternate prologue and epilogue that realigns the run-
25058 time stack if necessary. This supports mixing legacy codes that
25059 keep 4-byte stack alignment with modern codes that keep 16-byte
25060 stack alignment for SSE compatibility. See also the attribute
25061 "force_align_arg_pointer", applicable to individual functions.
25062
25063 -mpreferred-stack-boundary=num
25064 Attempt to keep the stack boundary aligned to a 2 raised to num
25065 byte boundary. If -mpreferred-stack-boundary is not specified, the
25066 default is 4 (16 bytes or 128 bits).
25067
25068 Warning: When generating code for the x86-64 architecture with SSE
25069 extensions disabled, -mpreferred-stack-boundary=3 can be used to
25070 keep the stack boundary aligned to 8 byte boundary. Since x86-64
25071 ABI require 16 byte stack alignment, this is ABI incompatible and
25072 intended to be used in controlled environment where stack space is
25073 important limitation. This option leads to wrong code when
25074 functions compiled with 16 byte stack alignment (such as functions
25075 from a standard library) are called with misaligned stack. In this
25076 case, SSE instructions may lead to misaligned memory access traps.
25077 In addition, variable arguments are handled incorrectly for 16 byte
25078 aligned objects (including x87 long double and __int128), leading
25079 to wrong results. You must build all modules with
25080 -mpreferred-stack-boundary=3, including any libraries. This
25081 includes the system libraries and startup modules.
25082
25083 -mincoming-stack-boundary=num
25084 Assume the incoming stack is aligned to a 2 raised to num byte
25085 boundary. If -mincoming-stack-boundary is not specified, the one
25086 specified by -mpreferred-stack-boundary is used.
25087
25088 On Pentium and Pentium Pro, "double" and "long double" values
25089 should be aligned to an 8-byte boundary (see -malign-double) or
25090 suffer significant run time performance penalties. On Pentium III,
25091 the Streaming SIMD Extension (SSE) data type "__m128" may not work
25092 properly if it is not 16-byte aligned.
25093
25094 To ensure proper alignment of this values on the stack, the stack
25095 boundary must be as aligned as that required by any value stored on
25096 the stack. Further, every function must be generated such that it
25097 keeps the stack aligned. Thus calling a function compiled with a
25098 higher preferred stack boundary from a function compiled with a
25099 lower preferred stack boundary most likely misaligns the stack. It
25100 is recommended that libraries that use callbacks always use the
25101 default setting.
25102
25103 This extra alignment does consume extra stack space, and generally
25104 increases code size. Code that is sensitive to stack space usage,
25105 such as embedded systems and operating system kernels, may want to
25106 reduce the preferred alignment to -mpreferred-stack-boundary=2.
25107
25108 -mmmx
25109 -msse
25110 -msse2
25111 -msse3
25112 -mssse3
25113 -msse4
25114 -msse4a
25115 -msse4.1
25116 -msse4.2
25117 -mavx
25118 -mavx2
25119 -mavx512f
25120 -mavx512pf
25121 -mavx512er
25122 -mavx512cd
25123 -mavx512vl
25124 -mavx512bw
25125 -mavx512dq
25126 -mavx512ifma
25127 -mavx512vbmi
25128 -msha
25129 -maes
25130 -mpclmul
25131 -mclflushopt
25132 -mclwb
25133 -mfsgsbase
25134 -mptwrite
25135 -mrdrnd
25136 -mf16c
25137 -mfma
25138 -mpconfig
25139 -mwbnoinvd
25140 -mfma4
25141 -mprfchw
25142 -mrdpid
25143 -mprefetchwt1
25144 -mrdseed
25145 -msgx
25146 -mxop
25147 -mlwp
25148 -m3dnow
25149 -m3dnowa
25150 -mpopcnt
25151 -mabm
25152 -madx
25153 -mbmi
25154 -mbmi2
25155 -mlzcnt
25156 -mfxsr
25157 -mxsave
25158 -mxsaveopt
25159 -mxsavec
25160 -mxsaves
25161 -mrtm
25162 -mhle
25163 -mtbm
25164 -mmwaitx
25165 -mclzero
25166 -mpku
25167 -mavx512vbmi2
25168 -mavx512bf16
25169 -mgfni
25170 -mvaes
25171 -mwaitpkg
25172 -mvpclmulqdq
25173 -mavx512bitalg
25174 -mmovdiri
25175 -mmovdir64b
25176 -menqcmd
25177 -mavx512vpopcntdq
25178 -mavx512vp2intersect
25179 -mavx5124fmaps
25180 -mavx512vnni
25181 -mavx5124vnniw
25182 -mcldemote
25183 These switches enable the use of instructions in the MMX, SSE,
25184 SSE2, SSE3, SSSE3, SSE4, SSE4A, SSE4.1, SSE4.2, AVX, AVX2, AVX512F,
25185 AVX512PF, AVX512ER, AVX512CD, AVX512VL, AVX512BW, AVX512DQ,
25186 AVX512IFMA, AVX512VBMI, SHA, AES, PCLMUL, CLFLUSHOPT, CLWB,
25187 FSGSBASE, PTWRITE, RDRND, F16C, FMA, PCONFIG, WBNOINVD, FMA4,
25188 PREFETCHW, RDPID, PREFETCHWT1, RDSEED, SGX, XOP, LWP, 3DNow!,
25189 enhanced 3DNow!, POPCNT, ABM, ADX, BMI, BMI2, LZCNT, FXSR, XSAVE,
25190 XSAVEOPT, XSAVEC, XSAVES, RTM, HLE, TBM, MWAITX, CLZERO, PKU,
25191 AVX512VBMI2, GFNI, VAES, WAITPKG, VPCLMULQDQ, AVX512BITALG,
25192 MOVDIRI, MOVDIR64B, AVX512BF16, ENQCMD, AVX512VPOPCNTDQ,
25193 AVX5124FMAPS, AVX512VNNI, AVX5124VNNIW, or CLDEMOTE extended
25194 instruction sets. Each has a corresponding -mno- option to disable
25195 use of these instructions.
25196
25197 These extensions are also available as built-in functions: see x86
25198 Built-in Functions, for details of the functions enabled and
25199 disabled by these switches.
25200
25201 To generate SSE/SSE2 instructions automatically from floating-point
25202 code (as opposed to 387 instructions), see -mfpmath=sse.
25203
25204 GCC depresses SSEx instructions when -mavx is used. Instead, it
25205 generates new AVX instructions or AVX equivalence for all SSEx
25206 instructions when needed.
25207
25208 These options enable GCC to use these extended instructions in
25209 generated code, even without -mfpmath=sse. Applications that
25210 perform run-time CPU detection must compile separate files for each
25211 supported architecture, using the appropriate flags. In
25212 particular, the file containing the CPU detection code should be
25213 compiled without these options.
25214
25215 -mdump-tune-features
25216 This option instructs GCC to dump the names of the x86 performance
25217 tuning features and default settings. The names can be used in
25218 -mtune-ctrl=feature-list.
25219
25220 -mtune-ctrl=feature-list
25221 This option is used to do fine grain control of x86 code generation
25222 features. feature-list is a comma separated list of feature names.
25223 See also -mdump-tune-features. When specified, the feature is
25224 turned on if it is not preceded with ^, otherwise, it is turned
25225 off. -mtune-ctrl=feature-list is intended to be used by GCC
25226 developers. Using it may lead to code paths not covered by testing
25227 and can potentially result in compiler ICEs or runtime errors.
25228
25229 -mno-default
25230 This option instructs GCC to turn off all tunable features. See
25231 also -mtune-ctrl=feature-list and -mdump-tune-features.
25232
25233 -mcld
25234 This option instructs GCC to emit a "cld" instruction in the
25235 prologue of functions that use string instructions. String
25236 instructions depend on the DF flag to select between autoincrement
25237 or autodecrement mode. While the ABI specifies the DF flag to be
25238 cleared on function entry, some operating systems violate this
25239 specification by not clearing the DF flag in their exception
25240 dispatchers. The exception handler can be invoked with the DF flag
25241 set, which leads to wrong direction mode when string instructions
25242 are used. This option can be enabled by default on 32-bit x86
25243 targets by configuring GCC with the --enable-cld configure option.
25244 Generation of "cld" instructions can be suppressed with the
25245 -mno-cld compiler option in this case.
25246
25247 -mvzeroupper
25248 This option instructs GCC to emit a "vzeroupper" instruction before
25249 a transfer of control flow out of the function to minimize the AVX
25250 to SSE transition penalty as well as remove unnecessary "zeroupper"
25251 intrinsics.
25252
25253 -mprefer-avx128
25254 This option instructs GCC to use 128-bit AVX instructions instead
25255 of 256-bit AVX instructions in the auto-vectorizer.
25256
25257 -mprefer-vector-width=opt
25258 This option instructs GCC to use opt-bit vector width in
25259 instructions instead of default on the selected platform.
25260
25261 none
25262 No extra limitations applied to GCC other than defined by the
25263 selected platform.
25264
25265 128 Prefer 128-bit vector width for instructions.
25266
25267 256 Prefer 256-bit vector width for instructions.
25268
25269 512 Prefer 512-bit vector width for instructions.
25270
25271 -mcx16
25272 This option enables GCC to generate "CMPXCHG16B" instructions in
25273 64-bit code to implement compare-and-exchange operations on 16-byte
25274 aligned 128-bit objects. This is useful for atomic updates of data
25275 structures exceeding one machine word in size. The compiler uses
25276 this instruction to implement __sync Builtins. However, for
25277 __atomic Builtins operating on 128-bit integers, a library call is
25278 always used.
25279
25280 -msahf
25281 This option enables generation of "SAHF" instructions in 64-bit
25282 code. Early Intel Pentium 4 CPUs with Intel 64 support, prior to
25283 the introduction of Pentium 4 G1 step in December 2005, lacked the
25284 "LAHF" and "SAHF" instructions which are supported by AMD64. These
25285 are load and store instructions, respectively, for certain status
25286 flags. In 64-bit mode, the "SAHF" instruction is used to optimize
25287 "fmod", "drem", and "remainder" built-in functions; see Other
25288 Builtins for details.
25289
25290 -mmovbe
25291 This option enables use of the "movbe" instruction to implement
25292 "__builtin_bswap32" and "__builtin_bswap64".
25293
25294 -mshstk
25295 The -mshstk option enables shadow stack built-in functions from x86
25296 Control-flow Enforcement Technology (CET).
25297
25298 -mcrc32
25299 This option enables built-in functions "__builtin_ia32_crc32qi",
25300 "__builtin_ia32_crc32hi", "__builtin_ia32_crc32si" and
25301 "__builtin_ia32_crc32di" to generate the "crc32" machine
25302 instruction.
25303
25304 -mrecip
25305 This option enables use of "RCPSS" and "RSQRTSS" instructions (and
25306 their vectorized variants "RCPPS" and "RSQRTPS") with an additional
25307 Newton-Raphson step to increase precision instead of "DIVSS" and
25308 "SQRTSS" (and their vectorized variants) for single-precision
25309 floating-point arguments. These instructions are generated only
25310 when -funsafe-math-optimizations is enabled together with
25311 -ffinite-math-only and -fno-trapping-math. Note that while the
25312 throughput of the sequence is higher than the throughput of the
25313 non-reciprocal instruction, the precision of the sequence can be
25314 decreased by up to 2 ulp (i.e. the inverse of 1.0 equals
25315 0.99999994).
25316
25317 Note that GCC implements "1.0f/sqrtf(x)" in terms of "RSQRTSS" (or
25318 "RSQRTPS") already with -ffast-math (or the above option
25319 combination), and doesn't need -mrecip.
25320
25321 Also note that GCC emits the above sequence with additional Newton-
25322 Raphson step for vectorized single-float division and vectorized
25323 "sqrtf(x)" already with -ffast-math (or the above option
25324 combination), and doesn't need -mrecip.
25325
25326 -mrecip=opt
25327 This option controls which reciprocal estimate instructions may be
25328 used. opt is a comma-separated list of options, which may be
25329 preceded by a ! to invert the option:
25330
25331 all Enable all estimate instructions.
25332
25333 default
25334 Enable the default instructions, equivalent to -mrecip.
25335
25336 none
25337 Disable all estimate instructions, equivalent to -mno-recip.
25338
25339 div Enable the approximation for scalar division.
25340
25341 vec-div
25342 Enable the approximation for vectorized division.
25343
25344 sqrt
25345 Enable the approximation for scalar square root.
25346
25347 vec-sqrt
25348 Enable the approximation for vectorized square root.
25349
25350 So, for example, -mrecip=all,!sqrt enables all of the reciprocal
25351 approximations, except for square root.
25352
25353 -mveclibabi=type
25354 Specifies the ABI type to use for vectorizing intrinsics using an
25355 external library. Supported values for type are svml for the Intel
25356 short vector math library and acml for the AMD math core library.
25357 To use this option, both -ftree-vectorize and
25358 -funsafe-math-optimizations have to be enabled, and an SVML or ACML
25359 ABI-compatible library must be specified at link time.
25360
25361 GCC currently emits calls to "vmldExp2", "vmldLn2", "vmldLog102",
25362 "vmldPow2", "vmldTanh2", "vmldTan2", "vmldAtan2", "vmldAtanh2",
25363 "vmldCbrt2", "vmldSinh2", "vmldSin2", "vmldAsinh2", "vmldAsin2",
25364 "vmldCosh2", "vmldCos2", "vmldAcosh2", "vmldAcos2", "vmlsExp4",
25365 "vmlsLn4", "vmlsLog104", "vmlsPow4", "vmlsTanh4", "vmlsTan4",
25366 "vmlsAtan4", "vmlsAtanh4", "vmlsCbrt4", "vmlsSinh4", "vmlsSin4",
25367 "vmlsAsinh4", "vmlsAsin4", "vmlsCosh4", "vmlsCos4", "vmlsAcosh4"
25368 and "vmlsAcos4" for corresponding function type when
25369 -mveclibabi=svml is used, and "__vrd2_sin", "__vrd2_cos",
25370 "__vrd2_exp", "__vrd2_log", "__vrd2_log2", "__vrd2_log10",
25371 "__vrs4_sinf", "__vrs4_cosf", "__vrs4_expf", "__vrs4_logf",
25372 "__vrs4_log2f", "__vrs4_log10f" and "__vrs4_powf" for the
25373 corresponding function type when -mveclibabi=acml is used.
25374
25375 -mabi=name
25376 Generate code for the specified calling convention. Permissible
25377 values are sysv for the ABI used on GNU/Linux and other systems,
25378 and ms for the Microsoft ABI. The default is to use the Microsoft
25379 ABI when targeting Microsoft Windows and the SysV ABI on all other
25380 systems. You can control this behavior for specific functions by
25381 using the function attributes "ms_abi" and "sysv_abi".
25382
25383 -mforce-indirect-call
25384 Force all calls to functions to be indirect. This is useful when
25385 using Intel Processor Trace where it generates more precise timing
25386 information for function calls.
25387
25388 -mmanual-endbr
25389 Insert ENDBR instruction at function entry only via the "cf_check"
25390 function attribute. This is useful when used with the option
25391 -fcf-protection=branch to control ENDBR insertion at the function
25392 entry.
25393
25394 -mcall-ms2sysv-xlogues
25395 Due to differences in 64-bit ABIs, any Microsoft ABI function that
25396 calls a System V ABI function must consider RSI, RDI and XMM6-15 as
25397 clobbered. By default, the code for saving and restoring these
25398 registers is emitted inline, resulting in fairly lengthy prologues
25399 and epilogues. Using -mcall-ms2sysv-xlogues emits prologues and
25400 epilogues that use stubs in the static portion of libgcc to perform
25401 these saves and restores, thus reducing function size at the cost
25402 of a few extra instructions.
25403
25404 -mtls-dialect=type
25405 Generate code to access thread-local storage using the gnu or gnu2
25406 conventions. gnu is the conservative default; gnu2 is more
25407 efficient, but it may add compile- and run-time requirements that
25408 cannot be satisfied on all systems.
25409
25410 -mpush-args
25411 -mno-push-args
25412 Use PUSH operations to store outgoing parameters. This method is
25413 shorter and usually equally fast as method using SUB/MOV operations
25414 and is enabled by default. In some cases disabling it may improve
25415 performance because of improved scheduling and reduced
25416 dependencies.
25417
25418 -maccumulate-outgoing-args
25419 If enabled, the maximum amount of space required for outgoing
25420 arguments is computed in the function prologue. This is faster on
25421 most modern CPUs because of reduced dependencies, improved
25422 scheduling and reduced stack usage when the preferred stack
25423 boundary is not equal to 2. The drawback is a notable increase in
25424 code size. This switch implies -mno-push-args.
25425
25426 -mthreads
25427 Support thread-safe exception handling on MinGW. Programs that
25428 rely on thread-safe exception handling must compile and link all
25429 code with the -mthreads option. When compiling, -mthreads defines
25430 -D_MT; when linking, it links in a special thread helper library
25431 -lmingwthrd which cleans up per-thread exception-handling data.
25432
25433 -mms-bitfields
25434 -mno-ms-bitfields
25435 Enable/disable bit-field layout compatible with the native
25436 Microsoft Windows compiler.
25437
25438 If "packed" is used on a structure, or if bit-fields are used, it
25439 may be that the Microsoft ABI lays out the structure differently
25440 than the way GCC normally does. Particularly when moving packed
25441 data between functions compiled with GCC and the native Microsoft
25442 compiler (either via function call or as data in a file), it may be
25443 necessary to access either format.
25444
25445 This option is enabled by default for Microsoft Windows targets.
25446 This behavior can also be controlled locally by use of variable or
25447 type attributes. For more information, see x86 Variable Attributes
25448 and x86 Type Attributes.
25449
25450 The Microsoft structure layout algorithm is fairly simple with the
25451 exception of the bit-field packing. The padding and alignment of
25452 members of structures and whether a bit-field can straddle a
25453 storage-unit boundary are determine by these rules:
25454
25455 1. Structure members are stored sequentially in the order in which
25456 they are
25457 declared: the first member has the lowest memory address and
25458 the last member the highest.
25459
25460 2. Every data object has an alignment requirement. The alignment
25461 requirement
25462 for all data except structures, unions, and arrays is either
25463 the size of the object or the current packing size (specified
25464 with either the "aligned" attribute or the "pack" pragma),
25465 whichever is less. For structures, unions, and arrays, the
25466 alignment requirement is the largest alignment requirement of
25467 its members. Every object is allocated an offset so that:
25468
25469 offset % alignment_requirement == 0
25470
25471 3. Adjacent bit-fields are packed into the same 1-, 2-, or 4-byte
25472 allocation
25473 unit if the integral types are the same size and if the next
25474 bit-field fits into the current allocation unit without
25475 crossing the boundary imposed by the common alignment
25476 requirements of the bit-fields.
25477
25478 MSVC interprets zero-length bit-fields in the following ways:
25479
25480 1. If a zero-length bit-field is inserted between two bit-fields
25481 that
25482 are normally coalesced, the bit-fields are not coalesced.
25483
25484 For example:
25485
25486 struct
25487 {
25488 unsigned long bf_1 : 12;
25489 unsigned long : 0;
25490 unsigned long bf_2 : 12;
25491 } t1;
25492
25493 The size of "t1" is 8 bytes with the zero-length bit-field. If
25494 the zero-length bit-field were removed, "t1"'s size would be 4
25495 bytes.
25496
25497 2. If a zero-length bit-field is inserted after a bit-field, "foo",
25498 and the
25499 alignment of the zero-length bit-field is greater than the
25500 member that follows it, "bar", "bar" is aligned as the type of
25501 the zero-length bit-field.
25502
25503 For example:
25504
25505 struct
25506 {
25507 char foo : 4;
25508 short : 0;
25509 char bar;
25510 } t2;
25511
25512 struct
25513 {
25514 char foo : 4;
25515 short : 0;
25516 double bar;
25517 } t3;
25518
25519 For "t2", "bar" is placed at offset 2, rather than offset 1.
25520 Accordingly, the size of "t2" is 4. For "t3", the zero-length
25521 bit-field does not affect the alignment of "bar" or, as a
25522 result, the size of the structure.
25523
25524 Taking this into account, it is important to note the
25525 following:
25526
25527 1. If a zero-length bit-field follows a normal bit-field, the
25528 type of the
25529 zero-length bit-field may affect the alignment of the
25530 structure as whole. For example, "t2" has a size of 4
25531 bytes, since the zero-length bit-field follows a normal
25532 bit-field, and is of type short.
25533
25534 2. Even if a zero-length bit-field is not followed by a normal
25535 bit-field, it may
25536 still affect the alignment of the structure:
25537
25538 struct
25539 {
25540 char foo : 6;
25541 long : 0;
25542 } t4;
25543
25544 Here, "t4" takes up 4 bytes.
25545
25546 3. Zero-length bit-fields following non-bit-field members are
25547 ignored:
25548 struct
25549 {
25550 char foo;
25551 long : 0;
25552 char bar;
25553 } t5;
25554
25555 Here, "t5" takes up 2 bytes.
25556
25557 -mno-align-stringops
25558 Do not align the destination of inlined string operations. This
25559 switch reduces code size and improves performance in case the
25560 destination is already aligned, but GCC doesn't know about it.
25561
25562 -minline-all-stringops
25563 By default GCC inlines string operations only when the destination
25564 is known to be aligned to least a 4-byte boundary. This enables
25565 more inlining and increases code size, but may improve performance
25566 of code that depends on fast "memcpy" and "memset" for short
25567 lengths. The option enables inline expansion of "strlen" for all
25568 pointer alignments.
25569
25570 -minline-stringops-dynamically
25571 For string operations of unknown size, use run-time checks with
25572 inline code for small blocks and a library call for large blocks.
25573
25574 -mstringop-strategy=alg
25575 Override the internal decision heuristic for the particular
25576 algorithm to use for inlining string operations. The allowed
25577 values for alg are:
25578
25579 rep_byte
25580 rep_4byte
25581 rep_8byte
25582 Expand using i386 "rep" prefix of the specified size.
25583
25584 byte_loop
25585 loop
25586 unrolled_loop
25587 Expand into an inline loop.
25588
25589 libcall
25590 Always use a library call.
25591
25592 -mmemcpy-strategy=strategy
25593 Override the internal decision heuristic to decide if
25594 "__builtin_memcpy" should be inlined and what inline algorithm to
25595 use when the expected size of the copy operation is known. strategy
25596 is a comma-separated list of alg:max_size:dest_align triplets. alg
25597 is specified in -mstringop-strategy, max_size specifies the max
25598 byte size with which inline algorithm alg is allowed. For the last
25599 triplet, the max_size must be "-1". The max_size of the triplets in
25600 the list must be specified in increasing order. The minimal byte
25601 size for alg is 0 for the first triplet and "max_size + 1" of the
25602 preceding range.
25603
25604 -mmemset-strategy=strategy
25605 The option is similar to -mmemcpy-strategy= except that it is to
25606 control "__builtin_memset" expansion.
25607
25608 -momit-leaf-frame-pointer
25609 Don't keep the frame pointer in a register for leaf functions.
25610 This avoids the instructions to save, set up, and restore frame
25611 pointers and makes an extra register available in leaf functions.
25612 The option -fomit-leaf-frame-pointer removes the frame pointer for
25613 leaf functions, which might make debugging harder.
25614
25615 -mtls-direct-seg-refs
25616 -mno-tls-direct-seg-refs
25617 Controls whether TLS variables may be accessed with offsets from
25618 the TLS segment register (%gs for 32-bit, %fs for 64-bit), or
25619 whether the thread base pointer must be added. Whether or not this
25620 is valid depends on the operating system, and whether it maps the
25621 segment to cover the entire TLS area.
25622
25623 For systems that use the GNU C Library, the default is on.
25624
25625 -msse2avx
25626 -mno-sse2avx
25627 Specify that the assembler should encode SSE instructions with VEX
25628 prefix. The option -mavx turns this on by default.
25629
25630 -mfentry
25631 -mno-fentry
25632 If profiling is active (-pg), put the profiling counter call before
25633 the prologue. Note: On x86 architectures the attribute
25634 "ms_hook_prologue" isn't possible at the moment for -mfentry and
25635 -pg.
25636
25637 -mrecord-mcount
25638 -mno-record-mcount
25639 If profiling is active (-pg), generate a __mcount_loc section that
25640 contains pointers to each profiling call. This is useful for
25641 automatically patching and out calls.
25642
25643 -mnop-mcount
25644 -mno-nop-mcount
25645 If profiling is active (-pg), generate the calls to the profiling
25646 functions as NOPs. This is useful when they should be patched in
25647 later dynamically. This is likely only useful together with
25648 -mrecord-mcount.
25649
25650 -minstrument-return=type
25651 Instrument function exit in -pg -mfentry instrumented functions
25652 with call to specified function. This only instruments true returns
25653 ending with ret, but not sibling calls ending with jump. Valid
25654 types are none to not instrument, call to generate a call to
25655 __return__, or nop5 to generate a 5 byte nop.
25656
25657 -mrecord-return
25658 -mno-record-return
25659 Generate a __return_loc section pointing to all return
25660 instrumentation code.
25661
25662 -mfentry-name=name
25663 Set name of __fentry__ symbol called at function entry for -pg
25664 -mfentry functions.
25665
25666 -mfentry-section=name
25667 Set name of section to record -mrecord-mcount calls (default
25668 __mcount_loc).
25669
25670 -mskip-rax-setup
25671 -mno-skip-rax-setup
25672 When generating code for the x86-64 architecture with SSE
25673 extensions disabled, -mskip-rax-setup can be used to skip setting
25674 up RAX register when there are no variable arguments passed in
25675 vector registers.
25676
25677 Warning: Since RAX register is used to avoid unnecessarily saving
25678 vector registers on stack when passing variable arguments, the
25679 impacts of this option are callees may waste some stack space,
25680 misbehave or jump to a random location. GCC 4.4 or newer don't
25681 have those issues, regardless the RAX register value.
25682
25683 -m8bit-idiv
25684 -mno-8bit-idiv
25685 On some processors, like Intel Atom, 8-bit unsigned integer divide
25686 is much faster than 32-bit/64-bit integer divide. This option
25687 generates a run-time check. If both dividend and divisor are
25688 within range of 0 to 255, 8-bit unsigned integer divide is used
25689 instead of 32-bit/64-bit integer divide.
25690
25691 -mavx256-split-unaligned-load
25692 -mavx256-split-unaligned-store
25693 Split 32-byte AVX unaligned load and store.
25694
25695 -mstack-protector-guard=guard
25696 -mstack-protector-guard-reg=reg
25697 -mstack-protector-guard-offset=offset
25698 Generate stack protection code using canary at guard. Supported
25699 locations are global for global canary or tls for per-thread canary
25700 in the TLS block (the default). This option has effect only when
25701 -fstack-protector or -fstack-protector-all is specified.
25702
25703 With the latter choice the options -mstack-protector-guard-reg=reg
25704 and -mstack-protector-guard-offset=offset furthermore specify which
25705 segment register (%fs or %gs) to use as base register for reading
25706 the canary, and from what offset from that base register. The
25707 default for those is as specified in the relevant ABI.
25708
25709 -mgeneral-regs-only
25710 Generate code that uses only the general-purpose registers. This
25711 prevents the compiler from using floating-point, vector, mask and
25712 bound registers.
25713
25714 -mindirect-branch=choice
25715 Convert indirect call and jump with choice. The default is keep,
25716 which keeps indirect call and jump unmodified. thunk converts
25717 indirect call and jump to call and return thunk. thunk-inline
25718 converts indirect call and jump to inlined call and return thunk.
25719 thunk-extern converts indirect call and jump to external call and
25720 return thunk provided in a separate object file. You can control
25721 this behavior for a specific function by using the function
25722 attribute "indirect_branch".
25723
25724 Note that -mcmodel=large is incompatible with
25725 -mindirect-branch=thunk and -mindirect-branch=thunk-extern since
25726 the thunk function may not be reachable in the large code model.
25727
25728 Note that -mindirect-branch=thunk-extern is compatible with
25729 -fcf-protection=branch since the external thunk can be made to
25730 enable control-flow check.
25731
25732 -mfunction-return=choice
25733 Convert function return with choice. The default is keep, which
25734 keeps function return unmodified. thunk converts function return
25735 to call and return thunk. thunk-inline converts function return to
25736 inlined call and return thunk. thunk-extern converts function
25737 return to external call and return thunk provided in a separate
25738 object file. You can control this behavior for a specific function
25739 by using the function attribute "function_return".
25740
25741 Note that -mindirect-return=thunk-extern is compatible with
25742 -fcf-protection=branch since the external thunk can be made to
25743 enable control-flow check.
25744
25745 Note that -mcmodel=large is incompatible with
25746 -mfunction-return=thunk and -mfunction-return=thunk-extern since
25747 the thunk function may not be reachable in the large code model.
25748
25749 -mindirect-branch-register
25750 Force indirect call and jump via register.
25751
25752 These -m switches are supported in addition to the above on x86-64
25753 processors in 64-bit environments.
25754
25755 -m32
25756 -m64
25757 -mx32
25758 -m16
25759 -miamcu
25760 Generate code for a 16-bit, 32-bit or 64-bit environment. The -m32
25761 option sets "int", "long", and pointer types to 32 bits, and
25762 generates code that runs on any i386 system.
25763
25764 The -m64 option sets "int" to 32 bits and "long" and pointer types
25765 to 64 bits, and generates code for the x86-64 architecture. For
25766 Darwin only the -m64 option also turns off the -fno-pic and
25767 -mdynamic-no-pic options.
25768
25769 The -mx32 option sets "int", "long", and pointer types to 32 bits,
25770 and generates code for the x86-64 architecture.
25771
25772 The -m16 option is the same as -m32, except for that it outputs the
25773 ".code16gcc" assembly directive at the beginning of the assembly
25774 output so that the binary can run in 16-bit mode.
25775
25776 The -miamcu option generates code which conforms to Intel MCU
25777 psABI. It requires the -m32 option to be turned on.
25778
25779 -mno-red-zone
25780 Do not use a so-called "red zone" for x86-64 code. The red zone is
25781 mandated by the x86-64 ABI; it is a 128-byte area beyond the
25782 location of the stack pointer that is not modified by signal or
25783 interrupt handlers and therefore can be used for temporary data
25784 without adjusting the stack pointer. The flag -mno-red-zone
25785 disables this red zone.
25786
25787 -mcmodel=small
25788 Generate code for the small code model: the program and its symbols
25789 must be linked in the lower 2 GB of the address space. Pointers
25790 are 64 bits. Programs can be statically or dynamically linked.
25791 This is the default code model.
25792
25793 -mcmodel=kernel
25794 Generate code for the kernel code model. The kernel runs in the
25795 negative 2 GB of the address space. This model has to be used for
25796 Linux kernel code.
25797
25798 -mcmodel=medium
25799 Generate code for the medium model: the program is linked in the
25800 lower 2 GB of the address space. Small symbols are also placed
25801 there. Symbols with sizes larger than -mlarge-data-threshold are
25802 put into large data or BSS sections and can be located above 2GB.
25803 Programs can be statically or dynamically linked.
25804
25805 -mcmodel=large
25806 Generate code for the large model. This model makes no assumptions
25807 about addresses and sizes of sections.
25808
25809 -maddress-mode=long
25810 Generate code for long address mode. This is only supported for
25811 64-bit and x32 environments. It is the default address mode for
25812 64-bit environments.
25813
25814 -maddress-mode=short
25815 Generate code for short address mode. This is only supported for
25816 32-bit and x32 environments. It is the default address mode for
25817 32-bit and x32 environments.
25818
25819 x86 Windows Options
25820
25821 These additional options are available for Microsoft Windows targets:
25822
25823 -mconsole
25824 This option specifies that a console application is to be
25825 generated, by instructing the linker to set the PE header subsystem
25826 type required for console applications. This option is available
25827 for Cygwin and MinGW targets and is enabled by default on those
25828 targets.
25829
25830 -mdll
25831 This option is available for Cygwin and MinGW targets. It
25832 specifies that a DLL---a dynamic link library---is to be generated,
25833 enabling the selection of the required runtime startup object and
25834 entry point.
25835
25836 -mnop-fun-dllimport
25837 This option is available for Cygwin and MinGW targets. It
25838 specifies that the "dllimport" attribute should be ignored.
25839
25840 -mthread
25841 This option is available for MinGW targets. It specifies that
25842 MinGW-specific thread support is to be used.
25843
25844 -municode
25845 This option is available for MinGW-w64 targets. It causes the
25846 "UNICODE" preprocessor macro to be predefined, and chooses Unicode-
25847 capable runtime startup code.
25848
25849 -mwin32
25850 This option is available for Cygwin and MinGW targets. It
25851 specifies that the typical Microsoft Windows predefined macros are
25852 to be set in the pre-processor, but does not influence the choice
25853 of runtime library/startup code.
25854
25855 -mwindows
25856 This option is available for Cygwin and MinGW targets. It
25857 specifies that a GUI application is to be generated by instructing
25858 the linker to set the PE header subsystem type appropriately.
25859
25860 -fno-set-stack-executable
25861 This option is available for MinGW targets. It specifies that the
25862 executable flag for the stack used by nested functions isn't set.
25863 This is necessary for binaries running in kernel mode of Microsoft
25864 Windows, as there the User32 API, which is used to set executable
25865 privileges, isn't available.
25866
25867 -fwritable-relocated-rdata
25868 This option is available for MinGW and Cygwin targets. It
25869 specifies that relocated-data in read-only section is put into the
25870 ".data" section. This is a necessary for older runtimes not
25871 supporting modification of ".rdata" sections for pseudo-relocation.
25872
25873 -mpe-aligned-commons
25874 This option is available for Cygwin and MinGW targets. It
25875 specifies that the GNU extension to the PE file format that permits
25876 the correct alignment of COMMON variables should be used when
25877 generating code. It is enabled by default if GCC detects that the
25878 target assembler found during configuration supports the feature.
25879
25880 See also under x86 Options for standard options.
25881
25882 Xstormy16 Options
25883
25884 These options are defined for Xstormy16:
25885
25886 -msim
25887 Choose startup files and linker script suitable for the simulator.
25888
25889 Xtensa Options
25890
25891 These options are supported for Xtensa targets:
25892
25893 -mconst16
25894 -mno-const16
25895 Enable or disable use of "CONST16" instructions for loading
25896 constant values. The "CONST16" instruction is currently not a
25897 standard option from Tensilica. When enabled, "CONST16"
25898 instructions are always used in place of the standard "L32R"
25899 instructions. The use of "CONST16" is enabled by default only if
25900 the "L32R" instruction is not available.
25901
25902 -mfused-madd
25903 -mno-fused-madd
25904 Enable or disable use of fused multiply/add and multiply/subtract
25905 instructions in the floating-point option. This has no effect if
25906 the floating-point option is not also enabled. Disabling fused
25907 multiply/add and multiply/subtract instructions forces the compiler
25908 to use separate instructions for the multiply and add/subtract
25909 operations. This may be desirable in some cases where strict IEEE
25910 754-compliant results are required: the fused multiply add/subtract
25911 instructions do not round the intermediate result, thereby
25912 producing results with more bits of precision than specified by the
25913 IEEE standard. Disabling fused multiply add/subtract instructions
25914 also ensures that the program output is not sensitive to the
25915 compiler's ability to combine multiply and add/subtract operations.
25916
25917 -mserialize-volatile
25918 -mno-serialize-volatile
25919 When this option is enabled, GCC inserts "MEMW" instructions before
25920 "volatile" memory references to guarantee sequential consistency.
25921 The default is -mserialize-volatile. Use -mno-serialize-volatile
25922 to omit the "MEMW" instructions.
25923
25924 -mforce-no-pic
25925 For targets, like GNU/Linux, where all user-mode Xtensa code must
25926 be position-independent code (PIC), this option disables PIC for
25927 compiling kernel code.
25928
25929 -mtext-section-literals
25930 -mno-text-section-literals
25931 These options control the treatment of literal pools. The default
25932 is -mno-text-section-literals, which places literals in a separate
25933 section in the output file. This allows the literal pool to be
25934 placed in a data RAM/ROM, and it also allows the linker to combine
25935 literal pools from separate object files to remove redundant
25936 literals and improve code size. With -mtext-section-literals, the
25937 literals are interspersed in the text section in order to keep them
25938 as close as possible to their references. This may be necessary
25939 for large assembly files. Literals for each function are placed
25940 right before that function.
25941
25942 -mauto-litpools
25943 -mno-auto-litpools
25944 These options control the treatment of literal pools. The default
25945 is -mno-auto-litpools, which places literals in a separate section
25946 in the output file unless -mtext-section-literals is used. With
25947 -mauto-litpools the literals are interspersed in the text section
25948 by the assembler. Compiler does not produce explicit ".literal"
25949 directives and loads literals into registers with "MOVI"
25950 instructions instead of "L32R" to let the assembler do relaxation
25951 and place literals as necessary. This option allows assembler to
25952 create several literal pools per function and assemble very big
25953 functions, which may not be possible with -mtext-section-literals.
25954
25955 -mtarget-align
25956 -mno-target-align
25957 When this option is enabled, GCC instructs the assembler to
25958 automatically align instructions to reduce branch penalties at the
25959 expense of some code density. The assembler attempts to widen
25960 density instructions to align branch targets and the instructions
25961 following call instructions. If there are not enough preceding
25962 safe density instructions to align a target, no widening is
25963 performed. The default is -mtarget-align. These options do not
25964 affect the treatment of auto-aligned instructions like "LOOP",
25965 which the assembler always aligns, either by widening density
25966 instructions or by inserting NOP instructions.
25967
25968 -mlongcalls
25969 -mno-longcalls
25970 When this option is enabled, GCC instructs the assembler to
25971 translate direct calls to indirect calls unless it can determine
25972 that the target of a direct call is in the range allowed by the
25973 call instruction. This translation typically occurs for calls to
25974 functions in other source files. Specifically, the assembler
25975 translates a direct "CALL" instruction into an "L32R" followed by a
25976 "CALLX" instruction. The default is -mno-longcalls. This option
25977 should be used in programs where the call target can potentially be
25978 out of range. This option is implemented in the assembler, not the
25979 compiler, so the assembly code generated by GCC still shows direct
25980 call instructions---look at the disassembled object code to see the
25981 actual instructions. Note that the assembler uses an indirect call
25982 for every cross-file call, not just those that really are out of
25983 range.
25984
25985 zSeries Options
25986
25987 These are listed under
25988
25990 This section describes several environment variables that affect how
25991 GCC operates. Some of them work by specifying directories or prefixes
25992 to use when searching for various kinds of files. Some are used to
25993 specify other aspects of the compilation environment.
25994
25995 Note that you can also specify places to search using options such as
25996 -B, -I and -L. These take precedence over places specified using
25997 environment variables, which in turn take precedence over those
25998 specified by the configuration of GCC.
25999
26000 LANG
26001 LC_CTYPE
26002 LC_MESSAGES
26003 LC_ALL
26004 These environment variables control the way that GCC uses
26005 localization information which allows GCC to work with different
26006 national conventions. GCC inspects the locale categories LC_CTYPE
26007 and LC_MESSAGES if it has been configured to do so. These locale
26008 categories can be set to any value supported by your installation.
26009 A typical value is en_GB.UTF-8 for English in the United Kingdom
26010 encoded in UTF-8.
26011
26012 The LC_CTYPE environment variable specifies character
26013 classification. GCC uses it to determine the character boundaries
26014 in a string; this is needed for some multibyte encodings that
26015 contain quote and escape characters that are otherwise interpreted
26016 as a string end or escape.
26017
26018 The LC_MESSAGES environment variable specifies the language to use
26019 in diagnostic messages.
26020
26021 If the LC_ALL environment variable is set, it overrides the value
26022 of LC_CTYPE and LC_MESSAGES; otherwise, LC_CTYPE and LC_MESSAGES
26023 default to the value of the LANG environment variable. If none of
26024 these variables are set, GCC defaults to traditional C English
26025 behavior.
26026
26027 TMPDIR
26028 If TMPDIR is set, it specifies the directory to use for temporary
26029 files. GCC uses temporary files to hold the output of one stage of
26030 compilation which is to be used as input to the next stage: for
26031 example, the output of the preprocessor, which is the input to the
26032 compiler proper.
26033
26034 GCC_COMPARE_DEBUG
26035 Setting GCC_COMPARE_DEBUG is nearly equivalent to passing
26036 -fcompare-debug to the compiler driver. See the documentation of
26037 this option for more details.
26038
26039 GCC_EXEC_PREFIX
26040 If GCC_EXEC_PREFIX is set, it specifies a prefix to use in the
26041 names of the subprograms executed by the compiler. No slash is
26042 added when this prefix is combined with the name of a subprogram,
26043 but you can specify a prefix that ends with a slash if you wish.
26044
26045 If GCC_EXEC_PREFIX is not set, GCC attempts to figure out an
26046 appropriate prefix to use based on the pathname it is invoked with.
26047
26048 If GCC cannot find the subprogram using the specified prefix, it
26049 tries looking in the usual places for the subprogram.
26050
26051 The default value of GCC_EXEC_PREFIX is prefix/lib/gcc/ where
26052 prefix is the prefix to the installed compiler. In many cases
26053 prefix is the value of "prefix" when you ran the configure script.
26054
26055 Other prefixes specified with -B take precedence over this prefix.
26056
26057 This prefix is also used for finding files such as crt0.o that are
26058 used for linking.
26059
26060 In addition, the prefix is used in an unusual way in finding the
26061 directories to search for header files. For each of the standard
26062 directories whose name normally begins with /usr/local/lib/gcc
26063 (more precisely, with the value of GCC_INCLUDE_DIR), GCC tries
26064 replacing that beginning with the specified prefix to produce an
26065 alternate directory name. Thus, with -Bfoo/, GCC searches foo/bar
26066 just before it searches the standard directory /usr/local/lib/bar.
26067 If a standard directory begins with the configured prefix then the
26068 value of prefix is replaced by GCC_EXEC_PREFIX when looking for
26069 header files.
26070
26071 COMPILER_PATH
26072 The value of COMPILER_PATH is a colon-separated list of
26073 directories, much like PATH. GCC tries the directories thus
26074 specified when searching for subprograms, if it cannot find the
26075 subprograms using GCC_EXEC_PREFIX.
26076
26077 LIBRARY_PATH
26078 The value of LIBRARY_PATH is a colon-separated list of directories,
26079 much like PATH. When configured as a native compiler, GCC tries
26080 the directories thus specified when searching for special linker
26081 files, if it cannot find them using GCC_EXEC_PREFIX. Linking using
26082 GCC also uses these directories when searching for ordinary
26083 libraries for the -l option (but directories specified with -L come
26084 first).
26085
26086 LANG
26087 This variable is used to pass locale information to the compiler.
26088 One way in which this information is used is to determine the
26089 character set to be used when character literals, string literals
26090 and comments are parsed in C and C++. When the compiler is
26091 configured to allow multibyte characters, the following values for
26092 LANG are recognized:
26093
26094 C-JIS
26095 Recognize JIS characters.
26096
26097 C-SJIS
26098 Recognize SJIS characters.
26099
26100 C-EUCJP
26101 Recognize EUCJP characters.
26102
26103 If LANG is not defined, or if it has some other value, then the
26104 compiler uses "mblen" and "mbtowc" as defined by the default locale
26105 to recognize and translate multibyte characters.
26106
26107 Some additional environment variables affect the behavior of the
26108 preprocessor.
26109
26110 CPATH
26111 C_INCLUDE_PATH
26112 CPLUS_INCLUDE_PATH
26113 OBJC_INCLUDE_PATH
26114 Each variable's value is a list of directories separated by a
26115 special character, much like PATH, in which to look for header
26116 files. The special character, "PATH_SEPARATOR", is target-
26117 dependent and determined at GCC build time. For Microsoft Windows-
26118 based targets it is a semicolon, and for almost all other targets
26119 it is a colon.
26120
26121 CPATH specifies a list of directories to be searched as if
26122 specified with -I, but after any paths given with -I options on the
26123 command line. This environment variable is used regardless of
26124 which language is being preprocessed.
26125
26126 The remaining environment variables apply only when preprocessing
26127 the particular language indicated. Each specifies a list of
26128 directories to be searched as if specified with -isystem, but after
26129 any paths given with -isystem options on the command line.
26130
26131 In all these variables, an empty element instructs the compiler to
26132 search its current working directory. Empty elements can appear at
26133 the beginning or end of a path. For instance, if the value of
26134 CPATH is ":/special/include", that has the same effect as
26135 -I. -I/special/include.
26136
26137 DEPENDENCIES_OUTPUT
26138 If this variable is set, its value specifies how to output
26139 dependencies for Make based on the non-system header files
26140 processed by the compiler. System header files are ignored in the
26141 dependency output.
26142
26143 The value of DEPENDENCIES_OUTPUT can be just a file name, in which
26144 case the Make rules are written to that file, guessing the target
26145 name from the source file name. Or the value can have the form
26146 file target, in which case the rules are written to file file using
26147 target as the target name.
26148
26149 In other words, this environment variable is equivalent to
26150 combining the options -MM and -MF, with an optional -MT switch too.
26151
26152 SUNPRO_DEPENDENCIES
26153 This variable is the same as DEPENDENCIES_OUTPUT (see above),
26154 except that system header files are not ignored, so it implies -M
26155 rather than -MM. However, the dependence on the main input file is
26156 omitted.
26157
26158 SOURCE_DATE_EPOCH
26159 If this variable is set, its value specifies a UNIX timestamp to be
26160 used in replacement of the current date and time in the "__DATE__"
26161 and "__TIME__" macros, so that the embedded timestamps become
26162 reproducible.
26163
26164 The value of SOURCE_DATE_EPOCH must be a UNIX timestamp, defined as
26165 the number of seconds (excluding leap seconds) since 01 Jan 1970
26166 00:00:00 represented in ASCII; identical to the output of
26167 @command{date +%s} on GNU/Linux and other systems that support the
26168 %s extension in the "date" command.
26169
26170 The value should be a known timestamp such as the last modification
26171 time of the source or package and it should be set by the build
26172 process.
26173
26175 For instructions on reporting bugs, see
26176 <http://bugzilla.redhat.com/bugzilla>.
26177
26179 1. On some systems, gcc -shared needs to build supplementary stub code
26180 for constructors to work. On multi-libbed systems, gcc -shared
26181 must select the correct support libraries to link against. Failing
26182 to supply the correct flags may lead to subtle defects. Supplying
26183 them in cases where they are not necessary is innocuous.
26184
26186 gpl(7), gfdl(7), fsf-funding(7), cpp(1), gcov(1), as(1), ld(1), gdb(1),
26187 dbx(1) and the Info entries for gcc, cpp, as, ld, binutils and gdb.
26188
26190 See the Info entry for gcc, or
26191 <http://gcc.gnu.org/onlinedocs/gcc/Contributors.html>, for contributors
26192 to GCC.
26193
26195 Copyright (c) 1988-2020 Free Software Foundation, Inc.
26196
26197 Permission is granted to copy, distribute and/or modify this document
26198 under the terms of the GNU Free Documentation License, Version 1.3 or
26199 any later version published by the Free Software Foundation; with the
26200 Invariant Sections being "GNU General Public License" and "Funding Free
26201 Software", the Front-Cover texts being (a) (see below), and with the
26202 Back-Cover Texts being (b) (see below). A copy of the license is
26203 included in the gfdl(7) man page.
26204
26205 (a) The FSF's Front-Cover Text is:
26206
26207 A GNU Manual
26208
26209 (b) The FSF's Back-Cover Text is:
26210
26211 You have freedom to copy and modify this GNU Manual, like GNU
26212 software. Copies published by the Free Software Foundation raise
26213 funds for GNU development.
26214
26215
26216
26217gcc-10.3.1 2021-04-22 GCC(1)