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-loop-limit=n -fconstexpr-ops-limit=n
101 -fno-elide-constructors -fno-enforce-eh-specs -fno-gnu-keywords
102 -fno-implicit-templates -fno-implicit-inline-templates
103 -fno-implement-inlines -fms-extensions -fnew-inheriting-ctors
104 -fnew-ttp-matching -fno-nonansi-builtins -fnothrow-opt
105 -fno-operator-names -fno-optional-diags -fpermissive
106 -fno-pretty-templates -frepo -fno-rtti -fsized-deallocation
107 -ftemplate-backtrace-limit=n -ftemplate-depth=n
108 -fno-threadsafe-statics -fuse-cxa-atexit -fno-weak -nostdinc++
109 -fvisibility-inlines-hidden -fvisibility-ms-compat
110 -fext-numeric-literals -Wabi=n -Wabi-tag -Wconversion-null
111 -Wctor-dtor-privacy -Wdelete-non-virtual-dtor -Wdeprecated-copy
112 -Wdeprecated-copy-dtor -Wliteral-suffix -Wmultiple-inheritance
113 -Wno-init-list-lifetime -Wnamespaces -Wnarrowing
114 -Wpessimizing-move -Wredundant-move -Wnoexcept -Wnoexcept-type
115 -Wclass-memaccess -Wnon-virtual-dtor -Wreorder -Wregister
116 -Weffc++ -Wstrict-null-sentinel -Wtemplates
117 -Wno-non-template-friend -Wold-style-cast -Woverloaded-virtual
118 -Wno-pmf-conversions -Wno-class-conversion -Wno-terminate
119 -Wsign-promo -Wvirtual-inheritance
120
121 Objective-C and Objective-C++ Language Options
122 -fconstant-string-class=class-name -fgnu-runtime -fnext-runtime
123 -fno-nil-receivers -fobjc-abi-version=n -fobjc-call-cxx-cdtors
124 -fobjc-direct-dispatch -fobjc-exceptions -fobjc-gc -fobjc-nilcheck
125 -fobjc-std=objc1 -fno-local-ivars
126 -fivar-visibility=[public|protected|private|package]
127 -freplace-objc-classes -fzero-link -gen-decls -Wassign-intercept
128 -Wno-protocol -Wselector -Wstrict-selector-match
129 -Wundeclared-selector
130
131 Diagnostic Message Formatting Options
132 -fmessage-length=n -fdiagnostics-show-location=[once|every-line]
133 -fdiagnostics-color=[auto|never|always]
134 -fdiagnostics-format=[text|json] -fno-diagnostics-show-option
135 -fno-diagnostics-show-caret -fno-diagnostics-show-labels
136 -fno-diagnostics-show-line-numbers
137 -fdiagnostics-minimum-margin-width=width
138 -fdiagnostics-parseable-fixits -fdiagnostics-generate-patch
139 -fdiagnostics-show-template-tree -fno-elide-type -fno-show-column
140
141 Warning Options
142 -fsyntax-only -fmax-errors=n -Wpedantic -pedantic-errors -w
143 -Wextra -Wall -Waddress -Waddress-of-packed-member
144 -Waggregate-return -Waligned-new -Walloc-zero
145 -Walloc-size-larger-than=byte-size -Walloca
146 -Walloca-larger-than=byte-size -Wno-aggressive-loop-optimizations
147 -Warray-bounds -Warray-bounds=n -Wno-attributes
148 -Wattribute-alias=n -Wbool-compare -Wbool-operation
149 -Wno-builtin-declaration-mismatch -Wno-builtin-macro-redefined
150 -Wc90-c99-compat -Wc99-c11-compat -Wc++-compat -Wc++11-compat
151 -Wc++14-compat -Wc++17-compat -Wcast-align -Wcast-align=strict
152 -Wcast-function-type -Wcast-qual -Wchar-subscripts -Wcatch-value
153 -Wcatch-value=n -Wclobbered -Wcomment -Wconditionally-supported
154 -Wconversion -Wcoverage-mismatch -Wno-cpp -Wdangling-else
155 -Wdate-time -Wdelete-incomplete -Wno-attribute-warning
156 -Wno-deprecated -Wno-deprecated-declarations -Wno-designated-init
157 -Wdisabled-optimization -Wno-discarded-qualifiers
158 -Wno-discarded-array-qualifiers -Wno-div-by-zero
159 -Wdouble-promotion -Wduplicated-branches -Wduplicated-cond
160 -Wempty-body -Wenum-compare -Wno-endif-labels
161 -Wexpansion-to-defined -Werror -Werror=* -Wextra-semi
162 -Wfatal-errors -Wfloat-equal -Wformat -Wformat=2
163 -Wno-format-contains-nul -Wno-format-extra-args
164 -Wformat-nonliteral -Wformat-overflow=n -Wformat-security
165 -Wformat-signedness -Wformat-truncation=n -Wformat-y2k
166 -Wframe-address -Wframe-larger-than=byte-size
167 -Wno-free-nonheap-object -Wjump-misses-init -Whsa -Wif-not-aligned
168 -Wignored-qualifiers -Wignored-attributes
169 -Wincompatible-pointer-types -Wimplicit -Wimplicit-fallthrough
170 -Wimplicit-fallthrough=n -Wimplicit-function-declaration
171 -Wimplicit-int -Winit-self -Winline -Wno-int-conversion
172 -Wint-in-bool-context -Wno-int-to-pointer-cast
173 -Winvalid-memory-model -Wno-invalid-offsetof -Winvalid-pch
174 -Wlarger-than=byte-size -Wlogical-op -Wlogical-not-parentheses
175 -Wlong-long -Wmain -Wmaybe-uninitialized -Wmemset-elt-size
176 -Wmemset-transposed-args -Wmisleading-indentation
177 -Wmissing-attributes -Wmissing-braces -Wmissing-field-initializers
178 -Wmissing-format-attribute -Wmissing-include-dirs
179 -Wmissing-noreturn -Wmissing-profile -Wno-multichar
180 -Wmultistatement-macros -Wnonnull -Wnonnull-compare
181 -Wnormalized=[none|id|nfc|nfkc] -Wnull-dereference -Wodr
182 -Wno-overflow -Wopenmp-simd -Woverride-init-side-effects
183 -Woverlength-strings -Wpacked -Wpacked-bitfield-compat
184 -Wpacked-not-aligned -Wpadded -Wparentheses
185 -Wno-pedantic-ms-format -Wplacement-new -Wplacement-new=n
186 -Wpointer-arith -Wpointer-compare -Wno-pointer-to-int-cast
187 -Wno-pragmas -Wno-prio-ctor-dtor -Wredundant-decls -Wrestrict
188 -Wno-return-local-addr -Wreturn-type -Wsequence-point -Wshadow
189 -Wno-shadow-ivar -Wshadow=global, -Wshadow=local,
190 -Wshadow=compatible-local -Wshift-overflow -Wshift-overflow=n
191 -Wshift-count-negative -Wshift-count-overflow
192 -Wshift-negative-value -Wsign-compare -Wsign-conversion
193 -Wfloat-conversion -Wno-scalar-storage-order -Wsizeof-pointer-div
194 -Wsizeof-pointer-memaccess -Wsizeof-array-argument
195 -Wstack-protector -Wstack-usage=byte-size -Wstrict-aliasing
196 -Wstrict-aliasing=n -Wstrict-overflow -Wstrict-overflow=n
197 -Wstringop-overflow=n -Wstringop-truncation -Wsubobject-linkage
198 -Wsuggest-attribute=[pure|const|noreturn|format|malloc]
199 -Wsuggest-final-types -Wsuggest-final-methods -Wsuggest-override
200 -Wswitch -Wswitch-bool -Wswitch-default -Wswitch-enum
201 -Wswitch-unreachable -Wsync-nand -Wsystem-headers
202 -Wtautological-compare -Wtrampolines -Wtrigraphs -Wtype-limits
203 -Wundef -Wuninitialized -Wunknown-pragmas
204 -Wunsuffixed-float-constants -Wunused -Wunused-function
205 -Wunused-label -Wunused-local-typedefs -Wunused-macros
206 -Wunused-parameter -Wno-unused-result -Wunused-value
207 -Wunused-variable -Wunused-const-variable
208 -Wunused-const-variable=n -Wunused-but-set-parameter
209 -Wunused-but-set-variable -Wuseless-cast -Wvariadic-macros
210 -Wvector-operation-performance -Wvla -Wvla-larger-than=byte-size
211 -Wvolatile-register-var -Wwrite-strings
212 -Wzero-as-null-pointer-constant
213
214 C and Objective-C-only Warning Options
215 -Wbad-function-cast -Wmissing-declarations
216 -Wmissing-parameter-type -Wmissing-prototypes -Wnested-externs
217 -Wold-style-declaration -Wold-style-definition -Wstrict-prototypes
218 -Wtraditional -Wtraditional-conversion
219 -Wdeclaration-after-statement -Wpointer-sign
220
221 Debugging Options
222 -g -glevel -gdwarf -gdwarf-version -ggdb -grecord-gcc-switches
223 -gno-record-gcc-switches -gstabs -gstabs+ -gstrict-dwarf
224 -gno-strict-dwarf -gas-loc-support -gno-as-loc-support
225 -gas-locview-support -gno-as-locview-support -gcolumn-info
226 -gno-column-info -gstatement-frontiers -gno-statement-frontiers
227 -gvariable-location-views -gno-variable-location-views
228 -ginternal-reset-location-views -gno-internal-reset-location-views
229 -ginline-points -gno-inline-points -gvms -gxcoff -gxcoff+
230 -gz[=type] -gsplit-dwarf -gdescribe-dies -gno-describe-dies
231 -fdebug-prefix-map=old=new -fdebug-types-section
232 -fno-eliminate-unused-debug-types -femit-struct-debug-baseonly
233 -femit-struct-debug-reduced -femit-struct-debug-detailed[=spec-
234 list] -feliminate-unused-debug-symbols -femit-class-debug-always
235 -fno-merge-debug-strings -fno-dwarf2-cfi-asm -fvar-tracking
236 -fvar-tracking-assignments
237
238 Optimization Options
239 -faggressive-loop-optimizations -falign-functions[=n[:m:[n2[:m2]]]]
240 -falign-jumps[=n[:m:[n2[:m2]]]] -falign-labels[=n[:m:[n2[:m2]]]]
241 -falign-loops[=n[:m:[n2[:m2]]]] -fassociative-math -fauto-profile
242 -fauto-profile[=path] -fauto-inc-dec -fbranch-probabilities
243 -fbranch-target-load-optimize -fbranch-target-load-optimize2
244 -fbtr-bb-exclusive -fcaller-saves -fcombine-stack-adjustments
245 -fconserve-stack -fcompare-elim -fcprop-registers -fcrossjumping
246 -fcse-follow-jumps -fcse-skip-blocks -fcx-fortran-rules
247 -fcx-limited-range -fdata-sections -fdce -fdelayed-branch
248 -fdelete-null-pointer-checks -fdevirtualize
249 -fdevirtualize-speculatively -fdevirtualize-at-ltrans -fdse
250 -fearly-inlining -fipa-sra -fexpensive-optimizations
251 -ffat-lto-objects -ffast-math -ffinite-math-only -ffloat-store
252 -fexcess-precision=style -fforward-propagate -ffp-contract=style
253 -ffunction-sections -fgcse -fgcse-after-reload -fgcse-las
254 -fgcse-lm -fgraphite-identity -fgcse-sm -fhoist-adjacent-loads
255 -fif-conversion -fif-conversion2 -findirect-inlining
256 -finline-functions -finline-functions-called-once
257 -finline-limit=n -finline-small-functions -fipa-cp -fipa-cp-clone
258 -fipa-bit-cp -fipa-vrp -fipa-pta -fipa-profile -fipa-pure-const
259 -fipa-reference -fipa-reference-addressable -fipa-stack-alignment
260 -fipa-icf -fira-algorithm=algorithm -flive-patching=level
261 -fira-region=region -fira-hoist-pressure -fira-loop-pressure
262 -fno-ira-share-save-slots -fno-ira-share-spill-slots
263 -fisolate-erroneous-paths-dereference
264 -fisolate-erroneous-paths-attribute -fivopts
265 -fkeep-inline-functions -fkeep-static-functions
266 -fkeep-static-consts -flimit-function-alignment
267 -flive-range-shrinkage -floop-block -floop-interchange
268 -floop-strip-mine -floop-unroll-and-jam -floop-nest-optimize
269 -floop-parallelize-all -flra-remat -flto -flto-compression-level
270 -flto-partition=alg -fmerge-all-constants -fmerge-constants
271 -fmodulo-sched -fmodulo-sched-allow-regmoves
272 -fmove-loop-invariants -fno-branch-count-reg -fno-defer-pop
273 -fno-fp-int-builtin-inexact -fno-function-cse
274 -fno-guess-branch-probability -fno-inline -fno-math-errno
275 -fno-peephole -fno-peephole2 -fno-printf-return-value
276 -fno-sched-interblock -fno-sched-spec -fno-signed-zeros
277 -fno-toplevel-reorder -fno-trapping-math
278 -fno-zero-initialized-in-bss -fomit-frame-pointer
279 -foptimize-sibling-calls -fpartial-inlining -fpeel-loops
280 -fpredictive-commoning -fprefetch-loop-arrays -fprofile-correction
281 -fprofile-use -fprofile-use=path -fprofile-values
282 -fprofile-reorder-functions -freciprocal-math -free
283 -frename-registers -freorder-blocks
284 -freorder-blocks-algorithm=algorithm -freorder-blocks-and-partition
285 -freorder-functions -frerun-cse-after-loop
286 -freschedule-modulo-scheduled-loops -frounding-math
287 -fsave-optimization-record -fsched2-use-superblocks
288 -fsched-pressure -fsched-spec-load -fsched-spec-load-dangerous
289 -fsched-stalled-insns-dep[=n] -fsched-stalled-insns[=n]
290 -fsched-group-heuristic -fsched-critical-path-heuristic
291 -fsched-spec-insn-heuristic -fsched-rank-heuristic
292 -fsched-last-insn-heuristic -fsched-dep-count-heuristic
293 -fschedule-fusion -fschedule-insns -fschedule-insns2
294 -fsection-anchors -fselective-scheduling -fselective-scheduling2
295 -fsel-sched-pipelining -fsel-sched-pipelining-outer-loops
296 -fsemantic-interposition -fshrink-wrap -fshrink-wrap-separate
297 -fsignaling-nans -fsingle-precision-constant
298 -fsplit-ivs-in-unroller -fsplit-loops -fsplit-paths
299 -fsplit-wide-types -fssa-backprop -fssa-phiopt -fstdarg-opt
300 -fstore-merging -fstrict-aliasing -fthread-jumps -ftracer
301 -ftree-bit-ccp -ftree-builtin-call-dce -ftree-ccp -ftree-ch
302 -ftree-coalesce-vars -ftree-copy-prop -ftree-dce
303 -ftree-dominator-opts -ftree-dse -ftree-forwprop -ftree-fre
304 -fcode-hoisting -ftree-loop-if-convert -ftree-loop-im
305 -ftree-phiprop -ftree-loop-distribution
306 -ftree-loop-distribute-patterns -ftree-loop-ivcanon
307 -ftree-loop-linear -ftree-loop-optimize -ftree-loop-vectorize
308 -ftree-parallelize-loops=n -ftree-pre -ftree-partial-pre
309 -ftree-pta -ftree-reassoc -ftree-scev-cprop -ftree-sink
310 -ftree-slsr -ftree-sra -ftree-switch-conversion -ftree-tail-merge
311 -ftree-ter -ftree-vectorize -ftree-vrp -funconstrained-commons
312 -funit-at-a-time -funroll-all-loops -funroll-loops
313 -funsafe-math-optimizations -funswitch-loops -fipa-ra
314 -fvariable-expansion-in-unroller -fvect-cost-model -fvpt -fweb
315 -fwhole-program -fwpa -fuse-linker-plugin --param name=value -O
316 -O0 -O1 -O2 -O3 -Os -Ofast -Og
317
318 Program Instrumentation Options
319 -p -pg -fprofile-arcs --coverage -ftest-coverage
320 -fprofile-abs-path -fprofile-dir=path -fprofile-generate
321 -fprofile-generate=path -fprofile-update=method
322 -fprofile-filter-files=regex -fprofile-exclude-files=regex
323 -fsanitize=style -fsanitize-recover -fsanitize-recover=style
324 -fasan-shadow-offset=number -fsanitize-sections=s1,s2,...
325 -fsanitize-undefined-trap-on-error -fbounds-check
326 -fcf-protection=[full|branch|return|none] -fstack-protector
327 -fstack-protector-all -fstack-protector-strong
328 -fstack-protector-explicit -fstack-check
329 -fstack-limit-register=reg -fstack-limit-symbol=sym
330 -fno-stack-limit -fsplit-stack -fvtable-verify=[std|preinit|none]
331 -fvtv-counts -fvtv-debug -finstrument-functions
332 -finstrument-functions-exclude-function-list=sym,sym,...
333 -finstrument-functions-exclude-file-list=file,file,...
334
335 Preprocessor Options
336 -Aquestion=answer -A-question[=answer] -C -CC -Dmacro[=defn] -dD
337 -dI -dM -dN -dU -fdebug-cpp -fdirectives-only
338 -fdollars-in-identifiers -fexec-charset=charset
339 -fextended-identifiers -finput-charset=charset
340 -fmacro-prefix-map=old=new -fno-canonical-system-headers
341 -fpch-deps -fpch-preprocess -fpreprocessed -ftabstop=width
342 -ftrack-macro-expansion -fwide-exec-charset=charset
343 -fworking-directory -H -imacros file -include file -M -MD -MF
344 -MG -MM -MMD -MP -MQ -MT -no-integrated-cpp -P -pthread
345 -remap -traditional -traditional-cpp -trigraphs -Umacro -undef
346 -Wp,option -Xpreprocessor option
347
348 Assembler Options
349 -Wa,option -Xassembler option
350
351 Linker Options
352 object-file-name -fuse-ld=linker -llibrary -nostartfiles
353 -nodefaultlibs -nolibc -nostdlib -e entry --entry=entry -pie
354 -pthread -r -rdynamic -s -static -static-pie -static-libgcc
355 -static-libstdc++ -static-libasan -static-libtsan -static-liblsan
356 -static-libubsan -shared -shared-libgcc -symbolic -T script
357 -Wl,option -Xlinker option -u symbol -z keyword
358
359 Directory Options
360 -Bprefix -Idir -I- -idirafter dir -imacros file -imultilib dir
361 -iplugindir=dir -iprefix file -iquote dir -isysroot dir -isystem
362 dir -iwithprefix dir -iwithprefixbefore dir -Ldir
363 -no-canonical-prefixes --no-sysroot-suffix -nostdinc -nostdinc++
364 --sysroot=dir
365
366 Code Generation Options
367 -fcall-saved-reg -fcall-used-reg -ffixed-reg -fexceptions
368 -fnon-call-exceptions -fdelete-dead-exceptions -funwind-tables
369 -fasynchronous-unwind-tables -fno-gnu-unique
370 -finhibit-size-directive -fno-common -fno-ident
371 -fpcc-struct-return -fpic -fPIC -fpie -fPIE -fno-plt
372 -fno-jump-tables -frecord-gcc-switches -freg-struct-return
373 -fshort-enums -fshort-wchar -fverbose-asm -fpack-struct[=n]
374 -fleading-underscore -ftls-model=model -fstack-reuse=reuse_level
375 -ftrampolines -ftrapv -fwrapv
376 -fvisibility=[default|internal|hidden|protected]
377 -fstrict-volatile-bitfields -fsync-libcalls
378
379 Developer Options
380 -dletters -dumpspecs -dumpmachine -dumpversion -dumpfullversion
381 -fchecking -fchecking=n -fdbg-cnt-list -fdbg-cnt=counter-value-
382 list -fdisable-ipa-pass_name -fdisable-rtl-pass_name
383 -fdisable-rtl-pass-name=range-list -fdisable-tree-pass_name
384 -fdisable-tree-pass-name=range-list -fdump-debug -fdump-earlydebug
385 -fdump-noaddr -fdump-unnumbered -fdump-unnumbered-links
386 -fdump-final-insns[=file] -fdump-ipa-all -fdump-ipa-cgraph
387 -fdump-ipa-inline -fdump-lang-all -fdump-lang-switch
388 -fdump-lang-switch-options -fdump-lang-switch-options=filename
389 -fdump-passes -fdump-rtl-pass -fdump-rtl-pass=filename
390 -fdump-statistics -fdump-tree-all -fdump-tree-switch
391 -fdump-tree-switch-options -fdump-tree-switch-options=filename
392 -fcompare-debug[=opts] -fcompare-debug-second -fenable-kind-pass
393 -fenable-kind-pass=range-list -fira-verbose=n -flto-report
394 -flto-report-wpa -fmem-report-wpa -fmem-report
395 -fpre-ipa-mem-report -fpost-ipa-mem-report -fopt-info
396 -fopt-info-options[=file] -fprofile-report -frandom-seed=string
397 -fsched-verbose=n -fsel-sched-verbose -fsel-sched-dump-cfg
398 -fsel-sched-pipelining-verbose -fstats -fstack-usage
399 -ftime-report -ftime-report-details
400 -fvar-tracking-assignments-toggle -gtoggle
401 -print-file-name=library -print-libgcc-file-name
402 -print-multi-directory -print-multi-lib -print-multi-os-directory
403 -print-prog-name=program -print-search-dirs -Q -print-sysroot
404 -print-sysroot-headers-suffix -save-temps -save-temps=cwd
405 -save-temps=obj -time[=file]
406
407 Machine-Dependent Options
408 AArch64 Options -mabi=name -mbig-endian -mlittle-endian
409 -mgeneral-regs-only -mcmodel=tiny -mcmodel=small -mcmodel=large
410 -mstrict-align -mno-strict-align -momit-leaf-frame-pointer
411 -mtls-dialect=desc -mtls-dialect=traditional -mtls-size=size
412 -mfix-cortex-a53-835769 -mfix-cortex-a53-843419
413 -mlow-precision-recip-sqrt -mlow-precision-sqrt
414 -mlow-precision-div -mpc-relative-literal-loads
415 -msign-return-address=scope -mbranch-protection=none|standard|pac-
416 ret[+leaf]|bti -march=name -mcpu=name -mtune=name
417 -moverride=string -mverbose-cost-dump
418 -mstack-protector-guard=guard -mstack-protector-guard-reg=sysreg
419 -mstack-protector-guard-offset=offset -mtrack-speculation
420
421 Adapteva Epiphany Options -mhalf-reg-file -mprefer-short-insn-regs
422 -mbranch-cost=num -mcmove -mnops=num -msoft-cmpsf -msplit-lohi
423 -mpost-inc -mpost-modify -mstack-offset=num -mround-nearest
424 -mlong-calls -mshort-calls -msmall16 -mfp-mode=mode
425 -mvect-double -max-vect-align=num -msplit-vecmove-early
426 -m1reg-reg
427
428 AMD GCN Options -march=gpu -mtune=gpu -mstack-size=bytes
429
430 ARC Options -mbarrel-shifter -mjli-always -mcpu=cpu -mA6
431 -mARC600 -mA7 -mARC700 -mdpfp -mdpfp-compact -mdpfp-fast
432 -mno-dpfp-lrsr -mea -mno-mpy -mmul32x16 -mmul64 -matomic -mnorm
433 -mspfp -mspfp-compact -mspfp-fast -msimd -msoft-float -mswap
434 -mcrc -mdsp-packa -mdvbf -mlock -mmac-d16 -mmac-24 -mrtsc
435 -mswape -mtelephony -mxy -misize -mannotate-align -marclinux
436 -marclinux_prof -mlong-calls -mmedium-calls -msdata
437 -mirq-ctrl-saved -mrgf-banked-regs -mlpc-width=width -G num
438 -mvolatile-cache -mtp-regno=regno -malign-call -mauto-modify-reg
439 -mbbit-peephole -mno-brcc -mcase-vector-pcrel -mcompact-casesi
440 -mno-cond-exec -mearly-cbranchsi -mexpand-adddi -mindexed-loads
441 -mlra -mlra-priority-none -mlra-priority-compact mlra-priority-
442 noncompact -mmillicode -mmixed-code -mq-class -mRcq -mRcw
443 -msize-level=level -mtune=cpu -mmultcost=num -mcode-density-frame
444 -munalign-prob-threshold=probability -mmpy-option=multo -mdiv-rem
445 -mcode-density -mll64 -mfpu=fpu -mrf16 -mbranch-index
446
447 ARM Options -mapcs-frame -mno-apcs-frame -mabi=name
448 -mapcs-stack-check -mno-apcs-stack-check -mapcs-reentrant
449 -mno-apcs-reentrant -mgeneral-regs-only -msched-prolog
450 -mno-sched-prolog -mlittle-endian -mbig-endian -mbe8 -mbe32
451 -mfloat-abi=name -mfp16-format=name -mthumb-interwork
452 -mno-thumb-interwork -mcpu=name -march=name -mfpu=name
453 -mtune=name -mprint-tune-info -mstructure-size-boundary=n
454 -mabort-on-noreturn -mlong-calls -mno-long-calls -msingle-pic-base
455 -mno-single-pic-base -mpic-register=reg -mnop-fun-dllimport
456 -mpoke-function-name -mthumb -marm -mflip-thumb -mtpcs-frame
457 -mtpcs-leaf-frame -mcaller-super-interworking
458 -mcallee-super-interworking -mtp=name -mtls-dialect=dialect
459 -mword-relocations -mfix-cortex-m3-ldrd -munaligned-access
460 -mneon-for-64bits -mslow-flash-data -masm-syntax-unified
461 -mrestrict-it -mverbose-cost-dump -mpure-code -mcmse
462
463 AVR Options -mmcu=mcu -mabsdata -maccumulate-args
464 -mbranch-cost=cost -mcall-prologues -mgas-isr-prologues -mint8
465 -mn_flash=size -mno-interrupts -mmain-is-OS_task -mrelax -mrmw
466 -mstrict-X -mtiny-stack -mfract-convert-truncate -mshort-calls
467 -nodevicelib -Waddr-space-convert -Wmisspelled-isr
468
469 Blackfin Options -mcpu=cpu[-sirevision] -msim
470 -momit-leaf-frame-pointer -mno-omit-leaf-frame-pointer
471 -mspecld-anomaly -mno-specld-anomaly -mcsync-anomaly
472 -mno-csync-anomaly -mlow-64k -mno-low64k -mstack-check-l1
473 -mid-shared-library -mno-id-shared-library -mshared-library-id=n
474 -mleaf-id-shared-library -mno-leaf-id-shared-library -msep-data
475 -mno-sep-data -mlong-calls -mno-long-calls -mfast-fp
476 -minline-plt -mmulticore -mcorea -mcoreb -msdram -micplb
477
478 C6X Options -mbig-endian -mlittle-endian -march=cpu -msim
479 -msdata=sdata-type
480
481 CRIS Options -mcpu=cpu -march=cpu -mtune=cpu -mmax-stack-frame=n
482 -melinux-stacksize=n -metrax4 -metrax100 -mpdebug -mcc-init
483 -mno-side-effects -mstack-align -mdata-align -mconst-align
484 -m32-bit -m16-bit -m8-bit -mno-prologue-epilogue -mno-gotplt
485 -melf -maout -melinux -mlinux -sim -sim2 -mmul-bug-workaround
486 -mno-mul-bug-workaround
487
488 CR16 Options -mmac -mcr16cplus -mcr16c -msim -mint32 -mbit-ops
489 -mdata-model=model
490
491 C-SKY Options -march=arch -mcpu=cpu -mbig-endian -EB
492 -mlittle-endian -EL -mhard-float -msoft-float -mfpu=fpu
493 -mdouble-float -mfdivdu -melrw -mistack -mmp -mcp -mcache
494 -msecurity -mtrust -mdsp -medsp -mvdsp -mdiv -msmart
495 -mhigh-registers -manchor -mpushpop -mmultiple-stld -mconstpool
496 -mstack-size -mccrt -mbranch-cost=n -mcse-cc -msched-prolog
497
498 Darwin Options -all_load -allowable_client -arch
499 -arch_errors_fatal -arch_only -bind_at_load -bundle
500 -bundle_loader -client_name -compatibility_version
501 -current_version -dead_strip -dependency-file -dylib_file
502 -dylinker_install_name -dynamic -dynamiclib
503 -exported_symbols_list -filelist -flat_namespace
504 -force_cpusubtype_ALL -force_flat_namespace
505 -headerpad_max_install_names -iframework -image_base -init
506 -install_name -keep_private_externs -multi_module
507 -multiply_defined -multiply_defined_unused -noall_load
508 -no_dead_strip_inits_and_terms -nofixprebinding -nomultidefs
509 -noprebind -noseglinkedit -pagezero_size -prebind
510 -prebind_all_twolevel_modules -private_bundle -read_only_relocs
511 -sectalign -sectobjectsymbols -whyload -seg1addr -sectcreate
512 -sectobjectsymbols -sectorder -segaddr -segs_read_only_addr
513 -segs_read_write_addr -seg_addr_table -seg_addr_table_filename
514 -seglinkedit -segprot -segs_read_only_addr -segs_read_write_addr
515 -single_module -static -sub_library -sub_umbrella
516 -twolevel_namespace -umbrella -undefined -unexported_symbols_list
517 -weak_reference_mismatches -whatsloaded -F -gused -gfull
518 -mmacosx-version-min=version -mkernel -mone-byte-bool
519
520 DEC Alpha Options -mno-fp-regs -msoft-float -mieee
521 -mieee-with-inexact -mieee-conformant -mfp-trap-mode=mode
522 -mfp-rounding-mode=mode -mtrap-precision=mode -mbuild-constants
523 -mcpu=cpu-type -mtune=cpu-type -mbwx -mmax -mfix -mcix
524 -mfloat-vax -mfloat-ieee -mexplicit-relocs -msmall-data
525 -mlarge-data -msmall-text -mlarge-text -mmemory-latency=time
526
527 FR30 Options -msmall-model -mno-lsim
528
529 FT32 Options -msim -mlra -mnodiv -mft32b -mcompress -mnopm
530
531 FRV Options -mgpr-32 -mgpr-64 -mfpr-32 -mfpr-64 -mhard-float
532 -msoft-float -malloc-cc -mfixed-cc -mdword -mno-dword -mdouble
533 -mno-double -mmedia -mno-media -mmuladd -mno-muladd -mfdpic
534 -minline-plt -mgprel-ro -multilib-library-pic -mlinked-fp
535 -mlong-calls -malign-labels -mlibrary-pic -macc-4 -macc-8 -mpack
536 -mno-pack -mno-eflags -mcond-move -mno-cond-move
537 -moptimize-membar -mno-optimize-membar -mscc -mno-scc
538 -mcond-exec -mno-cond-exec -mvliw-branch -mno-vliw-branch
539 -mmulti-cond-exec -mno-multi-cond-exec -mnested-cond-exec
540 -mno-nested-cond-exec -mtomcat-stats -mTLS -mtls -mcpu=cpu
541
542 GNU/Linux Options -mglibc -muclibc -mmusl -mbionic -mandroid
543 -tno-android-cc -tno-android-ld
544
545 H8/300 Options -mrelax -mh -ms -mn -mexr -mno-exr -mint32
546 -malign-300
547
548 HPPA Options -march=architecture-type -mcaller-copies
549 -mdisable-fpregs -mdisable-indexing -mfast-indirect-calls -mgas
550 -mgnu-ld -mhp-ld -mfixed-range=register-range -mjump-in-delay
551 -mlinker-opt -mlong-calls -mlong-load-store -mno-disable-fpregs
552 -mno-disable-indexing -mno-fast-indirect-calls -mno-gas
553 -mno-jump-in-delay -mno-long-load-store -mno-portable-runtime
554 -mno-soft-float -mno-space-regs -msoft-float -mpa-risc-1-0
555 -mpa-risc-1-1 -mpa-risc-2-0 -mportable-runtime -mschedule=cpu-
556 type -mspace-regs -msio -mwsio -munix=unix-std -nolibdld
557 -static -threads
558
559 IA-64 Options -mbig-endian -mlittle-endian -mgnu-as -mgnu-ld
560 -mno-pic -mvolatile-asm-stop -mregister-names -msdata -mno-sdata
561 -mconstant-gp -mauto-pic -mfused-madd
562 -minline-float-divide-min-latency
563 -minline-float-divide-max-throughput -mno-inline-float-divide
564 -minline-int-divide-min-latency -minline-int-divide-max-throughput
565 -mno-inline-int-divide -minline-sqrt-min-latency
566 -minline-sqrt-max-throughput -mno-inline-sqrt -mdwarf2-asm
567 -mearly-stop-bits -mfixed-range=register-range -mtls-size=tls-size
568 -mtune=cpu-type -milp32 -mlp64 -msched-br-data-spec
569 -msched-ar-data-spec -msched-control-spec -msched-br-in-data-spec
570 -msched-ar-in-data-spec -msched-in-control-spec -msched-spec-ldc
571 -msched-spec-control-ldc -msched-prefer-non-data-spec-insns
572 -msched-prefer-non-control-spec-insns
573 -msched-stop-bits-after-every-cycle
574 -msched-count-spec-in-critical-path
575 -msel-sched-dont-check-control-spec -msched-fp-mem-deps-zero-cost
576 -msched-max-memory-insns-hard-limit -msched-max-memory-insns=max-
577 insns
578
579 LM32 Options -mbarrel-shift-enabled -mdivide-enabled
580 -mmultiply-enabled -msign-extend-enabled -muser-enabled
581
582 M32R/D Options -m32r2 -m32rx -m32r -mdebug -malign-loops
583 -mno-align-loops -missue-rate=number -mbranch-cost=number
584 -mmodel=code-size-model-type -msdata=sdata-type -mno-flush-func
585 -mflush-func=name -mno-flush-trap -mflush-trap=number -G num
586
587 M32C Options -mcpu=cpu -msim -memregs=number
588
589 M680x0 Options -march=arch -mcpu=cpu -mtune=tune -m68000 -m68020
590 -m68020-40 -m68020-60 -m68030 -m68040 -m68060 -mcpu32 -m5200
591 -m5206e -m528x -m5307 -m5407 -mcfv4e -mbitfield -mno-bitfield
592 -mc68000 -mc68020 -mnobitfield -mrtd -mno-rtd -mdiv -mno-div
593 -mshort -mno-short -mhard-float -m68881 -msoft-float -mpcrel
594 -malign-int -mstrict-align -msep-data -mno-sep-data
595 -mshared-library-id=n -mid-shared-library -mno-id-shared-library
596 -mxgot -mno-xgot -mlong-jump-table-offsets
597
598 MCore Options -mhardlit -mno-hardlit -mdiv -mno-div
599 -mrelax-immediates -mno-relax-immediates -mwide-bitfields
600 -mno-wide-bitfields -m4byte-functions -mno-4byte-functions
601 -mcallgraph-data -mno-callgraph-data -mslow-bytes -mno-slow-bytes
602 -mno-lsim -mlittle-endian -mbig-endian -m210 -m340
603 -mstack-increment
604
605 MeP Options -mabsdiff -mall-opts -maverage -mbased=n -mbitops
606 -mc=n -mclip -mconfig=name -mcop -mcop32 -mcop64 -mivc2 -mdc
607 -mdiv -meb -mel -mio-volatile -ml -mleadz -mm -mminmax
608 -mmult -mno-opts -mrepeat -ms -msatur -msdram -msim
609 -msimnovec -mtf -mtiny=n
610
611 MicroBlaze Options -msoft-float -mhard-float -msmall-divides
612 -mcpu=cpu -mmemcpy -mxl-soft-mul -mxl-soft-div -mxl-barrel-shift
613 -mxl-pattern-compare -mxl-stack-check -mxl-gp-opt -mno-clearbss
614 -mxl-multiply-high -mxl-float-convert -mxl-float-sqrt
615 -mbig-endian -mlittle-endian -mxl-reorder -mxl-mode-app-model
616 -mpic-data-is-text-relative
617
618 MIPS Options -EL -EB -march=arch -mtune=arch -mips1 -mips2
619 -mips3 -mips4 -mips32 -mips32r2 -mips32r3 -mips32r5 -mips32r6
620 -mips64 -mips64r2 -mips64r3 -mips64r5 -mips64r6 -mips16
621 -mno-mips16 -mflip-mips16 -minterlink-compressed
622 -mno-interlink-compressed -minterlink-mips16 -mno-interlink-mips16
623 -mabi=abi -mabicalls -mno-abicalls -mshared -mno-shared -mplt
624 -mno-plt -mxgot -mno-xgot -mgp32 -mgp64 -mfp32 -mfpxx -mfp64
625 -mhard-float -msoft-float -mno-float -msingle-float
626 -mdouble-float -modd-spreg -mno-odd-spreg -mabs=mode
627 -mnan=encoding -mdsp -mno-dsp -mdspr2 -mno-dspr2 -mmcu
628 -mmno-mcu -meva -mno-eva -mvirt -mno-virt -mxpa -mno-xpa -mcrc
629 -mno-crc -mginv -mno-ginv -mmicromips -mno-micromips -mmsa
630 -mno-msa -mloongson-mmi -mno-loongson-mmi -mloongson-ext
631 -mno-loongson-ext -mloongson-ext2 -mno-loongson-ext2 -mfpu=fpu-
632 type -msmartmips -mno-smartmips -mpaired-single
633 -mno-paired-single -mdmx -mno-mdmx -mips3d -mno-mips3d -mmt
634 -mno-mt -mllsc -mno-llsc -mlong64 -mlong32 -msym32 -mno-sym32
635 -Gnum -mlocal-sdata -mno-local-sdata -mextern-sdata
636 -mno-extern-sdata -mgpopt -mno-gopt -membedded-data
637 -mno-embedded-data -muninit-const-in-rodata
638 -mno-uninit-const-in-rodata -mcode-readable=setting
639 -msplit-addresses -mno-split-addresses -mexplicit-relocs
640 -mno-explicit-relocs -mcheck-zero-division
641 -mno-check-zero-division -mdivide-traps -mdivide-breaks
642 -mload-store-pairs -mno-load-store-pairs -mmemcpy -mno-memcpy
643 -mlong-calls -mno-long-calls -mmad -mno-mad -mimadd -mno-imadd
644 -mfused-madd -mno-fused-madd -nocpp -mfix-24k -mno-fix-24k
645 -mfix-r4000 -mno-fix-r4000 -mfix-r4400 -mno-fix-r4400
646 -mfix-r5900 -mno-fix-r5900 -mfix-r10000 -mno-fix-r10000
647 -mfix-rm7000 -mno-fix-rm7000 -mfix-vr4120 -mno-fix-vr4120
648 -mfix-vr4130 -mno-fix-vr4130 -mfix-sb1 -mno-fix-sb1
649 -mflush-func=func -mno-flush-func -mbranch-cost=num
650 -mbranch-likely -mno-branch-likely -mcompact-branches=policy
651 -mfp-exceptions -mno-fp-exceptions -mvr4130-align
652 -mno-vr4130-align -msynci -mno-synci -mlxc1-sxc1 -mno-lxc1-sxc1
653 -mmadd4 -mno-madd4 -mrelax-pic-calls -mno-relax-pic-calls
654 -mmcount-ra-address -mframe-header-opt -mno-frame-header-opt
655
656 MMIX Options -mlibfuncs -mno-libfuncs -mepsilon -mno-epsilon
657 -mabi=gnu -mabi=mmixware -mzero-extend -mknuthdiv
658 -mtoplevel-symbols -melf -mbranch-predict -mno-branch-predict
659 -mbase-addresses -mno-base-addresses -msingle-exit
660 -mno-single-exit
661
662 MN10300 Options -mmult-bug -mno-mult-bug -mno-am33 -mam33
663 -mam33-2 -mam34 -mtune=cpu-type -mreturn-pointer-on-d0 -mno-crt0
664 -mrelax -mliw -msetlb
665
666 Moxie Options -meb -mel -mmul.x -mno-crt0
667
668 MSP430 Options -msim -masm-hex -mmcu= -mcpu= -mlarge -msmall
669 -mrelax -mwarn-mcu -mcode-region= -mdata-region= -msilicon-errata=
670 -msilicon-errata-warn= -mhwmult= -minrt
671
672 NDS32 Options -mbig-endian -mlittle-endian -mreduced-regs
673 -mfull-regs -mcmov -mno-cmov -mext-perf -mno-ext-perf -mext-perf2
674 -mno-ext-perf2 -mext-string -mno-ext-string -mv3push -mno-v3push
675 -m16bit -mno-16bit -misr-vector-size=num -mcache-block-size=num
676 -march=arch -mcmodel=code-model -mctor-dtor -mrelax
677
678 Nios II Options -G num -mgpopt=option -mgpopt -mno-gpopt
679 -mgprel-sec=regexp -mr0rel-sec=regexp -mel -meb -mno-bypass-cache
680 -mbypass-cache -mno-cache-volatile -mcache-volatile
681 -mno-fast-sw-div -mfast-sw-div -mhw-mul -mno-hw-mul -mhw-mulx
682 -mno-hw-mulx -mno-hw-div -mhw-div -mcustom-insn=N
683 -mno-custom-insn -mcustom-fpu-cfg=name -mhal -msmallc
684 -msys-crt0=name -msys-lib=name -march=arch -mbmx -mno-bmx -mcdx
685 -mno-cdx
686
687 Nvidia PTX Options -m32 -m64 -mmainkernel -moptimize
688
689 OpenRISC Options -mboard=name -mnewlib -mhard-mul -mhard-div
690 -msoft-mul -msoft-div -mcmov -mror -msext -msfimm -mshftimm
691
692 PDP-11 Options -mfpu -msoft-float -mac0 -mno-ac0 -m40 -m45
693 -m10 -mint32 -mno-int16 -mint16 -mno-int32 -msplit -munix-asm
694 -mdec-asm -mgnu-asm -mlra
695
696 picoChip Options -mae=ae_type -mvliw-lookahead=N
697 -msymbol-as-address -mno-inefficient-warnings
698
699 PowerPC Options See RS/6000 and PowerPC Options.
700
701 RISC-V Options -mbranch-cost=N-instruction -mplt -mno-plt
702 -mabi=ABI-string -mfdiv -mno-fdiv -mdiv -mno-div -march=ISA-
703 string -mtune=processor-string -mpreferred-stack-boundary=num
704 -msmall-data-limit=N-bytes -msave-restore -mno-save-restore
705 -mstrict-align -mno-strict-align -mcmodel=medlow -mcmodel=medany
706 -mexplicit-relocs -mno-explicit-relocs -mrelax -mno-relax
707 -mriscv-attribute -mmo-riscv-attribute
708
709 RL78 Options -msim -mmul=none -mmul=g13 -mmul=g14 -mallregs
710 -mcpu=g10 -mcpu=g13 -mcpu=g14 -mg10 -mg13 -mg14
711 -m64bit-doubles -m32bit-doubles -msave-mduc-in-interrupts
712
713 RS/6000 and PowerPC Options -mcpu=cpu-type -mtune=cpu-type
714 -mcmodel=code-model -mpowerpc64 -maltivec -mno-altivec
715 -mpowerpc-gpopt -mno-powerpc-gpopt -mpowerpc-gfxopt
716 -mno-powerpc-gfxopt -mmfcrf -mno-mfcrf -mpopcntb -mno-popcntb
717 -mpopcntd -mno-popcntd -mfprnd -mno-fprnd -mcmpb -mno-cmpb
718 -mmfpgpr -mno-mfpgpr -mhard-dfp -mno-hard-dfp -mfull-toc
719 -mminimal-toc -mno-fp-in-toc -mno-sum-in-toc -m64 -m32
720 -mxl-compat -mno-xl-compat -mpe -malign-power -malign-natural
721 -msoft-float -mhard-float -mmultiple -mno-multiple -mupdate
722 -mno-update -mavoid-indexed-addresses -mno-avoid-indexed-addresses
723 -mfused-madd -mno-fused-madd -mbit-align -mno-bit-align
724 -mstrict-align -mno-strict-align -mrelocatable -mno-relocatable
725 -mrelocatable-lib -mno-relocatable-lib -mtoc -mno-toc -mlittle
726 -mlittle-endian -mbig -mbig-endian -mdynamic-no-pic -mswdiv
727 -msingle-pic-base -mprioritize-restricted-insns=priority
728 -msched-costly-dep=dependence_type -minsert-sched-nops=scheme
729 -mcall-aixdesc -mcall-eabi -mcall-freebsd -mcall-linux
730 -mcall-netbsd -mcall-openbsd -mcall-sysv -mcall-sysv-eabi
731 -mcall-sysv-noeabi -mtraceback=traceback_type -maix-struct-return
732 -msvr4-struct-return -mabi=abi-type -msecure-plt -mbss-plt
733 -mlongcall -mno-longcall -mpltseq -mno-pltseq
734 -mblock-move-inline-limit=num -mblock-compare-inline-limit=num
735 -mblock-compare-inline-loop-limit=num
736 -mstring-compare-inline-limit=num -misel -mno-isel -mvrsave
737 -mno-vrsave -mmulhw -mno-mulhw -mdlmzb -mno-dlmzb -mprototype
738 -mno-prototype -msim -mmvme -mads -myellowknife -memb -msdata
739 -msdata=opt -mreadonly-in-sdata -mvxworks -G num -mrecip
740 -mrecip=opt -mno-recip -mrecip-precision -mno-recip-precision
741 -mveclibabi=type -mfriz -mno-friz -mpointers-to-nested-functions
742 -mno-pointers-to-nested-functions -msave-toc-indirect
743 -mno-save-toc-indirect -mpower8-fusion -mno-mpower8-fusion
744 -mpower8-vector -mno-power8-vector -mcrypto -mno-crypto -mhtm
745 -mno-htm -mquad-memory -mno-quad-memory -mquad-memory-atomic
746 -mno-quad-memory-atomic -mcompat-align-parm -mno-compat-align-parm
747 -mfloat128 -mno-float128 -mfloat128-hardware
748 -mno-float128-hardware -mgnu-attribute -mno-gnu-attribute
749 -mstack-protector-guard=guard -mstack-protector-guard-reg=reg
750 -mstack-protector-guard-offset=offset
751
752 RX Options -m64bit-doubles -m32bit-doubles -fpu -nofpu -mcpu=
753 -mbig-endian-data -mlittle-endian-data -msmall-data -msim
754 -mno-sim -mas100-syntax -mno-as100-syntax -mrelax
755 -mmax-constant-size= -mint-register= -mpid -mallow-string-insns
756 -mno-allow-string-insns -mjsr -mno-warn-multiple-fast-interrupts
757 -msave-acc-in-interrupts
758
759 S/390 and zSeries Options -mtune=cpu-type -march=cpu-type
760 -mhard-float -msoft-float -mhard-dfp -mno-hard-dfp
761 -mlong-double-64 -mlong-double-128 -mbackchain -mno-backchain
762 -mpacked-stack -mno-packed-stack -msmall-exec -mno-small-exec
763 -mmvcle -mno-mvcle -m64 -m31 -mdebug -mno-debug -mesa -mzarch
764 -mhtm -mvx -mzvector -mtpf-trace -mno-tpf-trace -mfused-madd
765 -mno-fused-madd -mwarn-framesize -mwarn-dynamicstack -mstack-size
766 -mstack-guard -mhotpatch=halfwords,halfwords
767
768 Score Options -meb -mel -mnhwloop -muls -mmac -mscore5 -mscore5u
769 -mscore7 -mscore7d
770
771 SH Options -m1 -m2 -m2e -m2a-nofpu -m2a-single-only -m2a-single
772 -m2a -m3 -m3e -m4-nofpu -m4-single-only -m4-single -m4
773 -m4a-nofpu -m4a-single-only -m4a-single -m4a -m4al -mb -ml
774 -mdalign -mrelax -mbigtable -mfmovd -mrenesas -mno-renesas
775 -mnomacsave -mieee -mno-ieee -mbitops -misize
776 -minline-ic_invalidate -mpadstruct -mprefergot -musermode
777 -multcost=number -mdiv=strategy -mdivsi3_libfunc=name
778 -mfixed-range=register-range -maccumulate-outgoing-args
779 -matomic-model=atomic-model -mbranch-cost=num -mzdcbranch
780 -mno-zdcbranch -mcbranch-force-delay-slot -mfused-madd
781 -mno-fused-madd -mfsca -mno-fsca -mfsrra -mno-fsrra
782 -mpretend-cmove -mtas
783
784 Solaris 2 Options -mclear-hwcap -mno-clear-hwcap -mimpure-text
785 -mno-impure-text -pthreads
786
787 SPARC Options -mcpu=cpu-type -mtune=cpu-type -mcmodel=code-model
788 -mmemory-model=mem-model -m32 -m64 -mapp-regs -mno-app-regs
789 -mfaster-structs -mno-faster-structs -mflat -mno-flat -mfpu
790 -mno-fpu -mhard-float -msoft-float -mhard-quad-float
791 -msoft-quad-float -mstack-bias -mno-stack-bias -mstd-struct-return
792 -mno-std-struct-return -munaligned-doubles -mno-unaligned-doubles
793 -muser-mode -mno-user-mode -mv8plus -mno-v8plus -mvis -mno-vis
794 -mvis2 -mno-vis2 -mvis3 -mno-vis3 -mvis4 -mno-vis4 -mvis4b
795 -mno-vis4b -mcbcond -mno-cbcond -mfmaf -mno-fmaf -mfsmuld
796 -mno-fsmuld -mpopc -mno-popc -msubxc -mno-subxc -mfix-at697f
797 -mfix-ut699 -mfix-ut700 -mfix-gr712rc -mlra -mno-lra
798
799 SPU Options -mwarn-reloc -merror-reloc -msafe-dma -munsafe-dma
800 -mbranch-hints -msmall-mem -mlarge-mem -mstdmain
801 -mfixed-range=register-range -mea32 -mea64
802 -maddress-space-conversion -mno-address-space-conversion
803 -mcache-size=cache-size -matomic-updates -mno-atomic-updates
804
805 System V Options -Qy -Qn -YP,paths -Ym,dir
806
807 TILE-Gx Options -mcpu=CPU -m32 -m64 -mbig-endian
808 -mlittle-endian -mcmodel=code-model
809
810 TILEPro Options -mcpu=cpu -m32
811
812 V850 Options -mlong-calls -mno-long-calls -mep -mno-ep
813 -mprolog-function -mno-prolog-function -mspace -mtda=n -msda=n
814 -mzda=n -mapp-regs -mno-app-regs -mdisable-callt
815 -mno-disable-callt -mv850e2v3 -mv850e2 -mv850e1 -mv850es -mv850e
816 -mv850 -mv850e3v5 -mloop -mrelax -mlong-jumps -msoft-float
817 -mhard-float -mgcc-abi -mrh850-abi -mbig-switch
818
819 VAX Options -mg -mgnu -munix
820
821 Visium Options -mdebug -msim -mfpu -mno-fpu -mhard-float
822 -msoft-float -mcpu=cpu-type -mtune=cpu-type -msv-mode
823 -muser-mode
824
825 VMS Options -mvms-return-codes -mdebug-main=prefix -mmalloc64
826 -mpointer-size=size
827
828 VxWorks Options -mrtp -non-static -Bstatic -Bdynamic -Xbind-lazy
829 -Xbind-now
830
831 x86 Options -mtune=cpu-type -march=cpu-type -mtune-ctrl=feature-
832 list -mdump-tune-features -mno-default -mfpmath=unit
833 -masm=dialect -mno-fancy-math-387 -mno-fp-ret-in-387 -m80387
834 -mhard-float -msoft-float -mno-wide-multiply -mrtd
835 -malign-double -mpreferred-stack-boundary=num
836 -mincoming-stack-boundary=num -mcld -mcx16 -msahf -mmovbe
837 -mcrc32 -mrecip -mrecip=opt -mvzeroupper -mprefer-avx128
838 -mprefer-vector-width=opt -mmmx -msse -msse2 -msse3 -mssse3
839 -msse4.1 -msse4.2 -msse4 -mavx -mavx2 -mavx512f -mavx512pf
840 -mavx512er -mavx512cd -mavx512vl -mavx512bw -mavx512dq
841 -mavx512ifma -mavx512vbmi -msha -maes -mpclmul -mfsgsbase
842 -mrdrnd -mf16c -mfma -mpconfig -mwbnoinvd -mptwrite
843 -mprefetchwt1 -mclflushopt -mclwb -mxsavec -mxsaves -msse4a
844 -m3dnow -m3dnowa -mpopcnt -mabm -mbmi -mtbm -mfma4 -mxop
845 -madx -mlzcnt -mbmi2 -mfxsr -mxsave -mxsaveopt -mrtm -mhle
846 -mlwp -mmwaitx -mclzero -mpku -mthreads -mgfni -mvaes
847 -mwaitpkg -mshstk -mmanual-endbr -mforce-indirect-call
848 -mavx512vbmi2 -mvpclmulqdq -mavx512bitalg -mmovdiri -mmovdir64b
849 -mavx512vpopcntdq -mavx5124fmaps -mavx512vnni -mavx5124vnniw
850 -mprfchw -mrdpid -mrdseed -msgx -mcldemote -mms-bitfields
851 -mno-align-stringops -minline-all-stringops
852 -minline-stringops-dynamically -mstringop-strategy=alg
853 -mmemcpy-strategy=strategy -mmemset-strategy=strategy -mpush-args
854 -maccumulate-outgoing-args -m128bit-long-double
855 -m96bit-long-double -mlong-double-64 -mlong-double-80
856 -mlong-double-128 -mregparm=num -msseregparm -mveclibabi=type
857 -mvect8-ret-in-mem -mpc32 -mpc64 -mpc80 -mstackrealign
858 -momit-leaf-frame-pointer -mno-red-zone -mno-tls-direct-seg-refs
859 -mcmodel=code-model -mabi=name -maddress-mode=mode -m32 -m64
860 -mx32 -m16 -miamcu -mlarge-data-threshold=num -msse2avx
861 -mfentry -mrecord-mcount -mnop-mcount -m8bit-idiv
862 -minstrument-return=type -mfentry-name=name -mfentry-section=name
863 -mavx256-split-unaligned-load -mavx256-split-unaligned-store
864 -malign-data=type -mstack-protector-guard=guard
865 -mstack-protector-guard-reg=reg
866 -mstack-protector-guard-offset=offset
867 -mstack-protector-guard-symbol=symbol -mgeneral-regs-only
868 -mcall-ms2sysv-xlogues -mindirect-branch=choice
869 -mfunction-return=choice -mindirect-branch-register
870
871 x86 Windows Options -mconsole -mcygwin -mno-cygwin -mdll
872 -mnop-fun-dllimport -mthread -municode -mwin32 -mwindows
873 -fno-set-stack-executable
874
875 Xstormy16 Options -msim
876
877 Xtensa Options -mconst16 -mno-const16 -mfused-madd
878 -mno-fused-madd -mforce-no-pic -mserialize-volatile
879 -mno-serialize-volatile -mtext-section-literals
880 -mno-text-section-literals -mauto-litpools -mno-auto-litpools
881 -mtarget-align -mno-target-align -mlongcalls -mno-longcalls
882
883 zSeries Options See S/390 and zSeries Options.
884
885 Options Controlling the Kind of Output
886 Compilation can involve up to four stages: preprocessing, compilation
887 proper, assembly and linking, always in that order. GCC is capable of
888 preprocessing and compiling several files either into several assembler
889 input files, or into one assembler input file; then each assembler
890 input file produces an object file, and linking combines all the object
891 files (those newly compiled, and those specified as input) into an
892 executable file.
893
894 For any given input file, the file name suffix determines what kind of
895 compilation is done:
896
897 file.c
898 C source code that must be preprocessed.
899
900 file.i
901 C source code that should not be preprocessed.
902
903 file.ii
904 C++ source code that should not be preprocessed.
905
906 file.m
907 Objective-C source code. Note that you must link with the libobjc
908 library to make an Objective-C program work.
909
910 file.mi
911 Objective-C source code that should not be preprocessed.
912
913 file.mm
914 file.M
915 Objective-C++ source code. Note that you must link with the
916 libobjc library to make an Objective-C++ program work. Note that
917 .M refers to a literal capital M.
918
919 file.mii
920 Objective-C++ source code that should not be preprocessed.
921
922 file.h
923 C, C++, Objective-C or Objective-C++ header file to be turned into
924 a precompiled header (default), or C, C++ header file to be turned
925 into an Ada spec (via the -fdump-ada-spec switch).
926
927 file.cc
928 file.cp
929 file.cxx
930 file.cpp
931 file.CPP
932 file.c++
933 file.C
934 C++ source code that must be preprocessed. Note that in .cxx, the
935 last two letters must both be literally x. Likewise, .C refers to
936 a literal capital C.
937
938 file.mm
939 file.M
940 Objective-C++ source code that must be preprocessed.
941
942 file.mii
943 Objective-C++ source code that should not be preprocessed.
944
945 file.hh
946 file.H
947 file.hp
948 file.hxx
949 file.hpp
950 file.HPP
951 file.h++
952 file.tcc
953 C++ header file to be turned into a precompiled header or Ada spec.
954
955 file.f
956 file.for
957 file.ftn
958 Fixed form Fortran source code that should not be preprocessed.
959
960 file.F
961 file.FOR
962 file.fpp
963 file.FPP
964 file.FTN
965 Fixed form Fortran source code that must be preprocessed (with the
966 traditional preprocessor).
967
968 file.f90
969 file.f95
970 file.f03
971 file.f08
972 Free form Fortran source code that should not be preprocessed.
973
974 file.F90
975 file.F95
976 file.F03
977 file.F08
978 Free form Fortran source code that must be preprocessed (with the
979 traditional preprocessor).
980
981 file.go
982 Go source code.
983
984 file.brig
985 BRIG files (binary representation of HSAIL).
986
987 file.d
988 D source code.
989
990 file.di
991 D interface file.
992
993 file.dd
994 D documentation code (Ddoc).
995
996 file.ads
997 Ada source code file that contains a library unit declaration (a
998 declaration of a package, subprogram, or generic, or a generic
999 instantiation), or a library unit renaming declaration (a package,
1000 generic, or subprogram renaming declaration). Such files are also
1001 called specs.
1002
1003 file.adb
1004 Ada source code file containing a library unit body (a subprogram
1005 or package body). Such files are also called bodies.
1006
1007 file.s
1008 Assembler code.
1009
1010 file.S
1011 file.sx
1012 Assembler code that must be preprocessed.
1013
1014 other
1015 An object file to be fed straight into linking. Any file name with
1016 no recognized suffix is treated this way.
1017
1018 You can specify the input language explicitly with the -x option:
1019
1020 -x language
1021 Specify explicitly the language for the following input files
1022 (rather than letting the compiler choose a default based on the
1023 file name suffix). This option applies to all following input
1024 files until the next -x option. Possible values for language are:
1025
1026 c c-header cpp-output
1027 c++ c++-header c++-cpp-output
1028 objective-c objective-c-header objective-c-cpp-output
1029 objective-c++ objective-c++-header objective-c++-cpp-output
1030 assembler assembler-with-cpp
1031 ada
1032 d
1033 f77 f77-cpp-input f95 f95-cpp-input
1034 go
1035 brig
1036
1037 -x none
1038 Turn off any specification of a language, so that subsequent files
1039 are handled according to their file name suffixes (as they are if
1040 -x has not been used at all).
1041
1042 If you only want some of the stages of compilation, you can use -x (or
1043 filename suffixes) to tell gcc where to start, and one of the options
1044 -c, -S, or -E to say where gcc is to stop. Note that some combinations
1045 (for example, -x cpp-output -E) instruct gcc to do nothing at all.
1046
1047 -c Compile or assemble the source files, but do not link. The linking
1048 stage simply is not done. The ultimate output is in the form of an
1049 object file for each source file.
1050
1051 By default, the object file name for a source file is made by
1052 replacing the suffix .c, .i, .s, etc., with .o.
1053
1054 Unrecognized input files, not requiring compilation or assembly,
1055 are ignored.
1056
1057 -S Stop after the stage of compilation proper; do not assemble. The
1058 output is in the form of an assembler code file for each non-
1059 assembler input file specified.
1060
1061 By default, the assembler file name for a source file is made by
1062 replacing the suffix .c, .i, etc., with .s.
1063
1064 Input files that don't require compilation are ignored.
1065
1066 -E Stop after the preprocessing stage; do not run the compiler proper.
1067 The output is in the form of preprocessed source code, which is
1068 sent to the standard output.
1069
1070 Input files that don't require preprocessing are ignored.
1071
1072 -o file
1073 Place output in file file. This applies to whatever sort of output
1074 is being produced, whether it be an executable file, an object
1075 file, an assembler file or preprocessed C code.
1076
1077 If -o is not specified, the default is to put an executable file in
1078 a.out, the object file for source.suffix in source.o, its assembler
1079 file in source.s, a precompiled header file in source.suffix.gch,
1080 and all preprocessed C source on standard output.
1081
1082 -v Print (on standard error output) the commands executed to run the
1083 stages of compilation. Also print the version number of the
1084 compiler driver program and of the preprocessor and the compiler
1085 proper.
1086
1087 -###
1088 Like -v except the commands are not executed and arguments are
1089 quoted unless they contain only alphanumeric characters or "./-_".
1090 This is useful for shell scripts to capture the driver-generated
1091 command lines.
1092
1093 --help
1094 Print (on the standard output) a description of the command-line
1095 options understood by gcc. If the -v option is also specified then
1096 --help is also passed on to the various processes invoked by gcc,
1097 so that they can display the command-line options they accept. If
1098 the -Wextra option has also been specified (prior to the --help
1099 option), then command-line options that have no documentation
1100 associated with them are also displayed.
1101
1102 --target-help
1103 Print (on the standard output) a description of target-specific
1104 command-line options for each tool. For some targets extra target-
1105 specific information may also be printed.
1106
1107 --help={class|[^]qualifier}[,...]
1108 Print (on the standard output) a description of the command-line
1109 options understood by the compiler that fit into all specified
1110 classes and qualifiers. These are the supported classes:
1111
1112 optimizers
1113 Display all of the optimization options supported by the
1114 compiler.
1115
1116 warnings
1117 Display all of the options controlling warning messages
1118 produced by the compiler.
1119
1120 target
1121 Display target-specific options. Unlike the --target-help
1122 option however, target-specific options of the linker and
1123 assembler are not displayed. This is because those tools do
1124 not currently support the extended --help= syntax.
1125
1126 params
1127 Display the values recognized by the --param option.
1128
1129 language
1130 Display the options supported for language, where language is
1131 the name of one of the languages supported in this version of
1132 GCC.
1133
1134 common
1135 Display the options that are common to all languages.
1136
1137 These are the supported qualifiers:
1138
1139 undocumented
1140 Display only those options that are undocumented.
1141
1142 joined
1143 Display options taking an argument that appears after an equal
1144 sign in the same continuous piece of text, such as:
1145 --help=target.
1146
1147 separate
1148 Display options taking an argument that appears as a separate
1149 word following the original option, such as: -o output-file.
1150
1151 Thus for example to display all the undocumented target-specific
1152 switches supported by the compiler, use:
1153
1154 --help=target,undocumented
1155
1156 The sense of a qualifier can be inverted by prefixing it with the ^
1157 character, so for example to display all binary warning options
1158 (i.e., ones that are either on or off and that do not take an
1159 argument) that have a description, use:
1160
1161 --help=warnings,^joined,^undocumented
1162
1163 The argument to --help= should not consist solely of inverted
1164 qualifiers.
1165
1166 Combining several classes is possible, although this usually
1167 restricts the output so much that there is nothing to display. One
1168 case where it does work, however, is when one of the classes is
1169 target. For example, to display all the target-specific
1170 optimization options, use:
1171
1172 --help=target,optimizers
1173
1174 The --help= option can be repeated on the command line. Each
1175 successive use displays its requested class of options, skipping
1176 those that have already been displayed. If --help is also
1177 specified anywhere on the command line then this takes precedence
1178 over any --help= option.
1179
1180 If the -Q option appears on the command line before the --help=
1181 option, then the descriptive text displayed by --help= is changed.
1182 Instead of describing the displayed options, an indication is given
1183 as to whether the option is enabled, disabled or set to a specific
1184 value (assuming that the compiler knows this at the point where the
1185 --help= option is used).
1186
1187 Here is a truncated example from the ARM port of gcc:
1188
1189 % gcc -Q -mabi=2 --help=target -c
1190 The following options are target specific:
1191 -mabi= 2
1192 -mabort-on-noreturn [disabled]
1193 -mapcs [disabled]
1194
1195 The output is sensitive to the effects of previous command-line
1196 options, so for example it is possible to find out which
1197 optimizations are enabled at -O2 by using:
1198
1199 -Q -O2 --help=optimizers
1200
1201 Alternatively you can discover which binary optimizations are
1202 enabled by -O3 by using:
1203
1204 gcc -c -Q -O3 --help=optimizers > /tmp/O3-opts
1205 gcc -c -Q -O2 --help=optimizers > /tmp/O2-opts
1206 diff /tmp/O2-opts /tmp/O3-opts | grep enabled
1207
1208 --version
1209 Display the version number and copyrights of the invoked GCC.
1210
1211 -pass-exit-codes
1212 Normally the gcc program exits with the code of 1 if any phase of
1213 the compiler returns a non-success return code. If you specify
1214 -pass-exit-codes, the gcc program instead returns with the
1215 numerically highest error produced by any phase returning an error
1216 indication. The C, C++, and Fortran front ends return 4 if an
1217 internal compiler error is encountered.
1218
1219 -pipe
1220 Use pipes rather than temporary files for communication between the
1221 various stages of compilation. This fails to work on some systems
1222 where the assembler is unable to read from a pipe; but the GNU
1223 assembler has no trouble.
1224
1225 -specs=file
1226 Process file after the compiler reads in the standard specs file,
1227 in order to override the defaults which the gcc driver program uses
1228 when determining what switches to pass to cc1, cc1plus, as, ld,
1229 etc. More than one -specs=file can be specified on the command
1230 line, and they are processed in order, from left to right.
1231
1232 -wrapper
1233 Invoke all subcommands under a wrapper program. The name of the
1234 wrapper program and its parameters are passed as a comma separated
1235 list.
1236
1237 gcc -c t.c -wrapper gdb,--args
1238
1239 This invokes all subprograms of gcc under gdb --args, thus the
1240 invocation of cc1 is gdb --args cc1 ....
1241
1242 -ffile-prefix-map=old=new
1243 When compiling files residing in directory old, record any
1244 references to them in the result of the compilation as if the files
1245 resided in directory new instead. Specifying this option is
1246 equivalent to specifying all the individual -f*-prefix-map options.
1247 This can be used to make reproducible builds that are location
1248 independent. See also -fmacro-prefix-map and -fdebug-prefix-map.
1249
1250 -fplugin=name.so
1251 Load the plugin code in file name.so, assumed to be a shared object
1252 to be dlopen'd by the compiler. The base name of the shared object
1253 file is used to identify the plugin for the purposes of argument
1254 parsing (See -fplugin-arg-name-key=value below). Each plugin
1255 should define the callback functions specified in the Plugins API.
1256
1257 -fplugin-arg-name-key=value
1258 Define an argument called key with a value of value for the plugin
1259 called name.
1260
1261 -fdump-ada-spec[-slim]
1262 For C and C++ source and include files, generate corresponding Ada
1263 specs.
1264
1265 -fada-spec-parent=unit
1266 In conjunction with -fdump-ada-spec[-slim] above, generate Ada
1267 specs as child units of parent unit.
1268
1269 -fdump-go-spec=file
1270 For input files in any language, generate corresponding Go
1271 declarations in file. This generates Go "const", "type", "var",
1272 and "func" declarations which may be a useful way to start writing
1273 a Go interface to code written in some other language.
1274
1275 @file
1276 Read command-line options from file. The options read are inserted
1277 in place of the original @file option. If file does not exist, or
1278 cannot be read, then the option will be treated literally, and not
1279 removed.
1280
1281 Options in file are separated by whitespace. A whitespace
1282 character may be included in an option by surrounding the entire
1283 option in either single or double quotes. Any character (including
1284 a backslash) may be included by prefixing the character to be
1285 included with a backslash. The file may itself contain additional
1286 @file options; any such options will be processed recursively.
1287
1288 Compiling C++ Programs
1289 C++ source files conventionally use one of the suffixes .C, .cc, .cpp,
1290 .CPP, .c++, .cp, or .cxx; C++ header files often use .hh, .hpp, .H, or
1291 (for shared template code) .tcc; and preprocessed C++ files use the
1292 suffix .ii. GCC recognizes files with these names and compiles them as
1293 C++ programs even if you call the compiler the same way as for
1294 compiling C programs (usually with the name gcc).
1295
1296 However, the use of gcc does not add the C++ library. g++ is a program
1297 that calls GCC and automatically specifies linking against the C++
1298 library. It treats .c, .h and .i files as C++ source files instead of
1299 C source files unless -x is used. This program is also useful when
1300 precompiling a C header file with a .h extension for use in C++
1301 compilations. On many systems, g++ is also installed with the name
1302 c++.
1303
1304 When you compile C++ programs, you may specify many of the same
1305 command-line options that you use for compiling programs in any
1306 language; or command-line options meaningful for C and related
1307 languages; or options that are meaningful only for C++ programs.
1308
1309 Options Controlling C Dialect
1310 The following options control the dialect of C (or languages derived
1311 from C, such as C++, Objective-C and Objective-C++) that the compiler
1312 accepts:
1313
1314 -ansi
1315 In C mode, this is equivalent to -std=c90. In C++ mode, it is
1316 equivalent to -std=c++98.
1317
1318 This turns off certain features of GCC that are incompatible with
1319 ISO C90 (when compiling C code), or of standard C++ (when compiling
1320 C++ code), such as the "asm" and "typeof" keywords, and predefined
1321 macros such as "unix" and "vax" that identify the type of system
1322 you are using. It also enables the undesirable and rarely used ISO
1323 trigraph feature. For the C compiler, it disables recognition of
1324 C++ style // comments as well as the "inline" keyword.
1325
1326 The alternate keywords "__asm__", "__extension__", "__inline__" and
1327 "__typeof__" continue to work despite -ansi. You would not want to
1328 use them in an ISO C program, of course, but it is useful to put
1329 them in header files that might be included in compilations done
1330 with -ansi. Alternate predefined macros such as "__unix__" and
1331 "__vax__" are also available, with or without -ansi.
1332
1333 The -ansi option does not cause non-ISO programs to be rejected
1334 gratuitously. For that, -Wpedantic is required in addition to
1335 -ansi.
1336
1337 The macro "__STRICT_ANSI__" is predefined when the -ansi option is
1338 used. Some header files may notice this macro and refrain from
1339 declaring certain functions or defining certain macros that the ISO
1340 standard doesn't call for; this is to avoid interfering with any
1341 programs that might use these names for other things.
1342
1343 Functions that are normally built in but do not have semantics
1344 defined by ISO C (such as "alloca" and "ffs") are not built-in
1345 functions when -ansi is used.
1346
1347 -std=
1348 Determine the language standard. This option is currently only
1349 supported when compiling C or C++.
1350
1351 The compiler can accept several base standards, such as c90 or
1352 c++98, and GNU dialects of those standards, such as gnu90 or
1353 gnu++98. When a base standard is specified, the compiler accepts
1354 all programs following that standard plus those using GNU
1355 extensions that do not contradict it. For example, -std=c90 turns
1356 off certain features of GCC that are incompatible with ISO C90,
1357 such as the "asm" and "typeof" keywords, but not other GNU
1358 extensions that do not have a meaning in ISO C90, such as omitting
1359 the middle term of a "?:" expression. On the other hand, when a GNU
1360 dialect of a standard is specified, all features supported by the
1361 compiler are enabled, even when those features change the meaning
1362 of the base standard. As a result, some strict-conforming programs
1363 may be rejected. The particular standard is used by -Wpedantic to
1364 identify which features are GNU extensions given that version of
1365 the standard. For example -std=gnu90 -Wpedantic warns about C++
1366 style // comments, while -std=gnu99 -Wpedantic does not.
1367
1368 A value for this option must be provided; possible values are
1369
1370 c90
1371 c89
1372 iso9899:1990
1373 Support all ISO C90 programs (certain GNU extensions that
1374 conflict with ISO C90 are disabled). Same as -ansi for C code.
1375
1376 iso9899:199409
1377 ISO C90 as modified in amendment 1.
1378
1379 c99
1380 c9x
1381 iso9899:1999
1382 iso9899:199x
1383 ISO C99. This standard is substantially completely supported,
1384 modulo bugs and floating-point issues (mainly but not entirely
1385 relating to optional C99 features from Annexes F and G). See
1386 <http://gcc.gnu.org/c99status.html> for more information. The
1387 names c9x and iso9899:199x are deprecated.
1388
1389 c11
1390 c1x
1391 iso9899:2011
1392 ISO C11, the 2011 revision of the ISO C standard. This
1393 standard is substantially completely supported, modulo bugs,
1394 floating-point issues (mainly but not entirely relating to
1395 optional C11 features from Annexes F and G) and the optional
1396 Annexes K (Bounds-checking interfaces) and L (Analyzability).
1397 The name c1x is deprecated.
1398
1399 c17
1400 c18
1401 iso9899:2017
1402 iso9899:2018
1403 ISO C17, the 2017 revision of the ISO C standard (published in
1404 2018). This standard is same as C11 except for corrections of
1405 defects (all of which are also applied with -std=c11) and a new
1406 value of "__STDC_VERSION__", and so is supported to the same
1407 extent as C11.
1408
1409 c2x The next version of the ISO C standard, still under
1410 development. The support for this version is experimental and
1411 incomplete.
1412
1413 gnu90
1414 gnu89
1415 GNU dialect of ISO C90 (including some C99 features).
1416
1417 gnu99
1418 gnu9x
1419 GNU dialect of ISO C99. The name gnu9x is deprecated.
1420
1421 gnu11
1422 gnu1x
1423 GNU dialect of ISO C11. The name gnu1x is deprecated.
1424
1425 gnu17
1426 gnu18
1427 GNU dialect of ISO C17. This is the default for C code.
1428
1429 gnu2x
1430 The next version of the ISO C standard, still under
1431 development, plus GNU extensions. The support for this version
1432 is experimental and incomplete.
1433
1434 c++98
1435 c++03
1436 The 1998 ISO C++ standard plus the 2003 technical corrigendum
1437 and some additional defect reports. Same as -ansi for C++ code.
1438
1439 gnu++98
1440 gnu++03
1441 GNU dialect of -std=c++98.
1442
1443 c++11
1444 c++0x
1445 The 2011 ISO C++ standard plus amendments. The name c++0x is
1446 deprecated.
1447
1448 gnu++11
1449 gnu++0x
1450 GNU dialect of -std=c++11. The name gnu++0x is deprecated.
1451
1452 c++14
1453 c++1y
1454 The 2014 ISO C++ standard plus amendments. The name c++1y is
1455 deprecated.
1456
1457 gnu++14
1458 gnu++1y
1459 GNU dialect of -std=c++14. This is the default for C++ code.
1460 The name gnu++1y is deprecated.
1461
1462 c++17
1463 c++1z
1464 The 2017 ISO C++ standard plus amendments. The name c++1z is
1465 deprecated.
1466
1467 gnu++17
1468 gnu++1z
1469 GNU dialect of -std=c++17. The name gnu++1z is deprecated.
1470
1471 c++2a
1472 The next revision of the ISO C++ standard, tentatively planned
1473 for 2020. Support is highly experimental, and will almost
1474 certainly change in incompatible ways in future releases.
1475
1476 gnu++2a
1477 GNU dialect of -std=c++2a. Support is highly experimental, and
1478 will almost certainly change in incompatible ways in future
1479 releases.
1480
1481 -fgnu89-inline
1482 The option -fgnu89-inline tells GCC to use the traditional GNU
1483 semantics for "inline" functions when in C99 mode.
1484
1485 Using this option is roughly equivalent to adding the "gnu_inline"
1486 function attribute to all inline functions.
1487
1488 The option -fno-gnu89-inline explicitly tells GCC to use the C99
1489 semantics for "inline" when in C99 or gnu99 mode (i.e., it
1490 specifies the default behavior). This option is not supported in
1491 -std=c90 or -std=gnu90 mode.
1492
1493 The preprocessor macros "__GNUC_GNU_INLINE__" and
1494 "__GNUC_STDC_INLINE__" may be used to check which semantics are in
1495 effect for "inline" functions.
1496
1497 -fpermitted-flt-eval-methods=style
1498 ISO/IEC TS 18661-3 defines new permissible values for
1499 "FLT_EVAL_METHOD" that indicate that operations and constants with
1500 a semantic type that is an interchange or extended format should be
1501 evaluated to the precision and range of that type. These new
1502 values are a superset of those permitted under C99/C11, which does
1503 not specify the meaning of other positive values of
1504 "FLT_EVAL_METHOD". As such, code conforming to C11 may not have
1505 been written expecting the possibility of the new values.
1506
1507 -fpermitted-flt-eval-methods specifies whether the compiler should
1508 allow only the values of "FLT_EVAL_METHOD" specified in C99/C11, or
1509 the extended set of values specified in ISO/IEC TS 18661-3.
1510
1511 style is either "c11" or "ts-18661-3" as appropriate.
1512
1513 The default when in a standards compliant mode (-std=c11 or
1514 similar) is -fpermitted-flt-eval-methods=c11. The default when in
1515 a GNU dialect (-std=gnu11 or similar) is
1516 -fpermitted-flt-eval-methods=ts-18661-3.
1517
1518 -aux-info filename
1519 Output to the given filename prototyped declarations for all
1520 functions declared and/or defined in a translation unit, including
1521 those in header files. This option is silently ignored in any
1522 language other than C.
1523
1524 Besides declarations, the file indicates, in comments, the origin
1525 of each declaration (source file and line), whether the declaration
1526 was implicit, prototyped or unprototyped (I, N for new or O for
1527 old, respectively, in the first character after the line number and
1528 the colon), and whether it came from a declaration or a definition
1529 (C or F, respectively, in the following character). In the case of
1530 function definitions, a K&R-style list of arguments followed by
1531 their declarations is also provided, inside comments, after the
1532 declaration.
1533
1534 -fallow-parameterless-variadic-functions
1535 Accept variadic functions without named parameters.
1536
1537 Although it is possible to define such a function, this is not very
1538 useful as it is not possible to read the arguments. This is only
1539 supported for C as this construct is allowed by C++.
1540
1541 -fno-asm
1542 Do not recognize "asm", "inline" or "typeof" as a keyword, so that
1543 code can use these words as identifiers. You can use the keywords
1544 "__asm__", "__inline__" and "__typeof__" instead. -ansi implies
1545 -fno-asm.
1546
1547 In C++, this switch only affects the "typeof" keyword, since "asm"
1548 and "inline" are standard keywords. You may want to use the
1549 -fno-gnu-keywords flag instead, which has the same effect. In C99
1550 mode (-std=c99 or -std=gnu99), this switch only affects the "asm"
1551 and "typeof" keywords, since "inline" is a standard keyword in ISO
1552 C99.
1553
1554 -fno-builtin
1555 -fno-builtin-function
1556 Don't recognize built-in functions that do not begin with
1557 __builtin_ as prefix.
1558
1559 GCC normally generates special code to handle certain built-in
1560 functions more efficiently; for instance, calls to "alloca" may
1561 become single instructions which adjust the stack directly, and
1562 calls to "memcpy" may become inline copy loops. The resulting code
1563 is often both smaller and faster, but since the function calls no
1564 longer appear as such, you cannot set a breakpoint on those calls,
1565 nor can you change the behavior of the functions by linking with a
1566 different library. In addition, when a function is recognized as a
1567 built-in function, GCC may use information about that function to
1568 warn about problems with calls to that function, or to generate
1569 more efficient code, even if the resulting code still contains
1570 calls to that function. For example, warnings are given with
1571 -Wformat for bad calls to "printf" when "printf" is built in and
1572 "strlen" is known not to modify global memory.
1573
1574 With the -fno-builtin-function option only the built-in function
1575 function is disabled. function must not begin with __builtin_. If
1576 a function is named that is not built-in in this version of GCC,
1577 this option is ignored. There is no corresponding
1578 -fbuiltin-function option; if you wish to enable built-in functions
1579 selectively when using -fno-builtin or -ffreestanding, you may
1580 define macros such as:
1581
1582 #define abs(n) __builtin_abs ((n))
1583 #define strcpy(d, s) __builtin_strcpy ((d), (s))
1584
1585 -fgimple
1586 Enable parsing of function definitions marked with "__GIMPLE".
1587 This is an experimental feature that allows unit testing of GIMPLE
1588 passes.
1589
1590 -fhosted
1591 Assert that compilation targets a hosted environment. This implies
1592 -fbuiltin. A hosted environment is one in which the entire
1593 standard library is available, and in which "main" has a return
1594 type of "int". Examples are nearly everything except a kernel.
1595 This is equivalent to -fno-freestanding.
1596
1597 -ffreestanding
1598 Assert that compilation targets a freestanding environment. This
1599 implies -fno-builtin. A freestanding environment is one in which
1600 the standard library may not exist, and program startup may not
1601 necessarily be at "main". The most obvious example is an OS
1602 kernel. This is equivalent to -fno-hosted.
1603
1604 -fopenacc
1605 Enable handling of OpenACC directives "#pragma acc" in C/C++ and
1606 "!$acc" in Fortran. When -fopenacc is specified, the compiler
1607 generates accelerated code according to the OpenACC Application
1608 Programming Interface v2.0 <https://www.openacc.org>. This option
1609 implies -pthread, and thus is only supported on targets that have
1610 support for -pthread.
1611
1612 -fopenacc-dim=geom
1613 Specify default compute dimensions for parallel offload regions
1614 that do not explicitly specify. The geom value is a triple of
1615 ':'-separated sizes, in order 'gang', 'worker' and, 'vector'. A
1616 size can be omitted, to use a target-specific default value.
1617
1618 -fopenmp
1619 Enable handling of OpenMP directives "#pragma omp" in C/C++ and
1620 "!$omp" in Fortran. When -fopenmp is specified, the compiler
1621 generates parallel code according to the OpenMP Application Program
1622 Interface v4.5 <https://www.openmp.org>. This option implies
1623 -pthread, and thus is only supported on targets that have support
1624 for -pthread. -fopenmp implies -fopenmp-simd.
1625
1626 -fopenmp-simd
1627 Enable handling of OpenMP's SIMD directives with "#pragma omp" in
1628 C/C++ and "!$omp" in Fortran. Other OpenMP directives are ignored.
1629
1630 -fgnu-tm
1631 When the option -fgnu-tm is specified, the compiler generates code
1632 for the Linux variant of Intel's current Transactional Memory ABI
1633 specification document (Revision 1.1, May 6 2009). This is an
1634 experimental feature whose interface may change in future versions
1635 of GCC, as the official specification changes. Please note that
1636 not all architectures are supported for this feature.
1637
1638 For more information on GCC's support for transactional memory,
1639
1640 Note that the transactional memory feature is not supported with
1641 non-call exceptions (-fnon-call-exceptions).
1642
1643 -fms-extensions
1644 Accept some non-standard constructs used in Microsoft header files.
1645
1646 In C++ code, this allows member names in structures to be similar
1647 to previous types declarations.
1648
1649 typedef int UOW;
1650 struct ABC {
1651 UOW UOW;
1652 };
1653
1654 Some cases of unnamed fields in structures and unions are only
1655 accepted with this option.
1656
1657 Note that this option is off for all targets but x86 targets using
1658 ms-abi.
1659
1660 -fplan9-extensions
1661 Accept some non-standard constructs used in Plan 9 code.
1662
1663 This enables -fms-extensions, permits passing pointers to
1664 structures with anonymous fields to functions that expect pointers
1665 to elements of the type of the field, and permits referring to
1666 anonymous fields declared using a typedef. This is only
1667 supported for C, not C++.
1668
1669 -fcond-mismatch
1670 Allow conditional expressions with mismatched types in the second
1671 and third arguments. The value of such an expression is void.
1672 This option is not supported for C++.
1673
1674 -flax-vector-conversions
1675 Allow implicit conversions between vectors with differing numbers
1676 of elements and/or incompatible element types. This option should
1677 not be used for new code.
1678
1679 -funsigned-char
1680 Let the type "char" be unsigned, like "unsigned char".
1681
1682 Each kind of machine has a default for what "char" should be. It
1683 is either like "unsigned char" by default or like "signed char" by
1684 default.
1685
1686 Ideally, a portable program should always use "signed char" or
1687 "unsigned char" when it depends on the signedness of an object.
1688 But many programs have been written to use plain "char" and expect
1689 it to be signed, or expect it to be unsigned, depending on the
1690 machines they were written for. This option, and its inverse, let
1691 you make such a program work with the opposite default.
1692
1693 The type "char" is always a distinct type from each of "signed
1694 char" or "unsigned char", even though its behavior is always just
1695 like one of those two.
1696
1697 -fsigned-char
1698 Let the type "char" be signed, like "signed char".
1699
1700 Note that this is equivalent to -fno-unsigned-char, which is the
1701 negative form of -funsigned-char. Likewise, the option
1702 -fno-signed-char is equivalent to -funsigned-char.
1703
1704 -fsigned-bitfields
1705 -funsigned-bitfields
1706 -fno-signed-bitfields
1707 -fno-unsigned-bitfields
1708 These options control whether a bit-field is signed or unsigned,
1709 when the declaration does not use either "signed" or "unsigned".
1710 By default, such a bit-field is signed, because this is consistent:
1711 the basic integer types such as "int" are signed types.
1712
1713 -fsso-struct=endianness
1714 Set the default scalar storage order of structures and unions to
1715 the specified endianness. The accepted values are big-endian,
1716 little-endian and native for the native endianness of the target
1717 (the default). This option is not supported for C++.
1718
1719 Warning: the -fsso-struct switch causes GCC to generate code that
1720 is not binary compatible with code generated without it if the
1721 specified endianness is not the native endianness of the target.
1722
1723 Options Controlling C++ Dialect
1724 This section describes the command-line options that are only
1725 meaningful for C++ programs. You can also use most of the GNU compiler
1726 options regardless of what language your program is in. For example,
1727 you might compile a file firstClass.C like this:
1728
1729 g++ -g -fstrict-enums -O -c firstClass.C
1730
1731 In this example, only -fstrict-enums is an option meant only for C++
1732 programs; you can use the other options with any language supported by
1733 GCC.
1734
1735 Some options for compiling C programs, such as -std, are also relevant
1736 for C++ programs.
1737
1738 Here is a list of options that are only for compiling C++ programs:
1739
1740 -fabi-version=n
1741 Use version n of the C++ ABI. The default is version 0.
1742
1743 Version 0 refers to the version conforming most closely to the C++
1744 ABI specification. Therefore, the ABI obtained using version 0
1745 will change in different versions of G++ as ABI bugs are fixed.
1746
1747 Version 1 is the version of the C++ ABI that first appeared in G++
1748 3.2.
1749
1750 Version 2 is the version of the C++ ABI that first appeared in G++
1751 3.4, and was the default through G++ 4.9.
1752
1753 Version 3 corrects an error in mangling a constant address as a
1754 template argument.
1755
1756 Version 4, which first appeared in G++ 4.5, implements a standard
1757 mangling for vector types.
1758
1759 Version 5, which first appeared in G++ 4.6, corrects the mangling
1760 of attribute const/volatile on function pointer types, decltype of
1761 a plain decl, and use of a function parameter in the declaration of
1762 another parameter.
1763
1764 Version 6, which first appeared in G++ 4.7, corrects the promotion
1765 behavior of C++11 scoped enums and the mangling of template
1766 argument packs, const/static_cast, prefix ++ and --, and a class
1767 scope function used as a template argument.
1768
1769 Version 7, which first appeared in G++ 4.8, that treats nullptr_t
1770 as a builtin type and corrects the mangling of lambdas in default
1771 argument scope.
1772
1773 Version 8, which first appeared in G++ 4.9, corrects the
1774 substitution behavior of function types with function-cv-
1775 qualifiers.
1776
1777 Version 9, which first appeared in G++ 5.2, corrects the alignment
1778 of "nullptr_t".
1779
1780 Version 10, which first appeared in G++ 6.1, adds mangling of
1781 attributes that affect type identity, such as ia32 calling
1782 convention attributes (e.g. stdcall).
1783
1784 Version 11, which first appeared in G++ 7, corrects the mangling of
1785 sizeof... expressions and operator names. For multiple entities
1786 with the same name within a function, that are declared in
1787 different scopes, the mangling now changes starting with the
1788 twelfth occurrence. It also implies -fnew-inheriting-ctors.
1789
1790 Version 12, which first appeared in G++ 8, corrects the calling
1791 conventions for empty classes on the x86_64 target and for classes
1792 with only deleted copy/move constructors. It accidentally changes
1793 the calling convention for classes with a deleted copy constructor
1794 and a trivial move constructor.
1795
1796 Version 13, which first appeared in G++ 8.2, fixes the accidental
1797 change in version 12.
1798
1799 See also -Wabi.
1800
1801 -fabi-compat-version=n
1802 On targets that support strong aliases, G++ works around mangling
1803 changes by creating an alias with the correct mangled name when
1804 defining a symbol with an incorrect mangled name. This switch
1805 specifies which ABI version to use for the alias.
1806
1807 With -fabi-version=0 (the default), this defaults to 11 (GCC 7
1808 compatibility). If another ABI version is explicitly selected,
1809 this defaults to 0. For compatibility with GCC versions 3.2
1810 through 4.9, use -fabi-compat-version=2.
1811
1812 If this option is not provided but -Wabi=n is, that version is used
1813 for compatibility aliases. If this option is provided along with
1814 -Wabi (without the version), the version from this option is used
1815 for the warning.
1816
1817 -fno-access-control
1818 Turn off all access checking. This switch is mainly useful for
1819 working around bugs in the access control code.
1820
1821 -faligned-new
1822 Enable support for C++17 "new" of types that require more alignment
1823 than "void* ::operator new(std::size_t)" provides. A numeric
1824 argument such as "-faligned-new=32" can be used to specify how much
1825 alignment (in bytes) is provided by that function, but few users
1826 will need to override the default of "alignof(std::max_align_t)".
1827
1828 This flag is enabled by default for -std=c++17.
1829
1830 -fchar8_t
1831 -fno-char8_t
1832 Enable support for "char8_t" as adopted for C++2a. This includes
1833 the addition of a new "char8_t" fundamental type, changes to the
1834 types of UTF-8 string and character literals, new signatures for
1835 user-defined literals, associated standard library updates, and new
1836 "__cpp_char8_t" and "__cpp_lib_char8_t" feature test macros.
1837
1838 This option enables functions to be overloaded for ordinary and
1839 UTF-8 strings:
1840
1841 int f(const char *); // #1
1842 int f(const char8_t *); // #2
1843 int v1 = f("text"); // Calls #1
1844 int v2 = f(u8"text"); // Calls #2
1845
1846 and introduces new signatures for user-defined literals:
1847
1848 int operator""_udl1(char8_t);
1849 int v3 = u8'x'_udl1;
1850 int operator""_udl2(const char8_t*, std::size_t);
1851 int v4 = u8"text"_udl2;
1852 template<typename T, T...> int operator""_udl3();
1853 int v5 = u8"text"_udl3;
1854
1855 The change to the types of UTF-8 string and character literals
1856 introduces incompatibilities with ISO C++11 and later standards.
1857 For example, the following code is well-formed under ISO C++11, but
1858 is ill-formed when -fchar8_t is specified.
1859
1860 char ca[] = u8"xx"; // error: char-array initialized from wide
1861 // string
1862 const char *cp = u8"xx";// error: invalid conversion from
1863 // `const char8_t*' to `const char*'
1864 int f(const char*);
1865 auto v = f(u8"xx"); // error: invalid conversion from
1866 // `const char8_t*' to `const char*'
1867 std::string s{u8"xx"}; // error: no matching function for call to
1868 // `std::basic_string<char>::basic_string()'
1869 using namespace std::literals;
1870 s = u8"xx"s; // error: conversion from
1871 // `basic_string<char8_t>' to non-scalar
1872 // type `basic_string<char>' requested
1873
1874 -fcheck-new
1875 Check that the pointer returned by "operator new" is non-null
1876 before attempting to modify the storage allocated. This check is
1877 normally unnecessary because the C++ standard specifies that
1878 "operator new" only returns 0 if it is declared "throw()", in which
1879 case the compiler always checks the return value even without this
1880 option. In all other cases, when "operator new" has a non-empty
1881 exception specification, memory exhaustion is signalled by throwing
1882 "std::bad_alloc". See also new (nothrow).
1883
1884 -fconcepts
1885 Enable support for the C++ Extensions for Concepts Technical
1886 Specification, ISO 19217 (2015), which allows code like
1887
1888 template <class T> concept bool Addable = requires (T t) { t + t; };
1889 template <Addable T> T add (T a, T b) { return a + b; }
1890
1891 -fconstexpr-depth=n
1892 Set the maximum nested evaluation depth for C++11 constexpr
1893 functions to n. A limit is needed to detect endless recursion
1894 during constant expression evaluation. The minimum specified by
1895 the standard is 512.
1896
1897 -fconstexpr-loop-limit=n
1898 Set the maximum number of iterations for a loop in C++14 constexpr
1899 functions to n. A limit is needed to detect infinite loops during
1900 constant expression evaluation. The default is 262144 (1<<18).
1901
1902 -fconstexpr-ops-limit=n
1903 Set the maximum number of operations during a single constexpr
1904 evaluation. Even when number of iterations of a single loop is
1905 limited with the above limit, if there are several nested loops and
1906 each of them has many iterations but still smaller than the above
1907 limit, or if in a body of some loop or even outside of a loop too
1908 many expressions need to be evaluated, the resulting constexpr
1909 evaluation might take too long. The default is 33554432 (1<<25).
1910
1911 -fdeduce-init-list
1912 Enable deduction of a template type parameter as
1913 "std::initializer_list" from a brace-enclosed initializer list,
1914 i.e.
1915
1916 template <class T> auto forward(T t) -> decltype (realfn (t))
1917 {
1918 return realfn (t);
1919 }
1920
1921 void f()
1922 {
1923 forward({1,2}); // call forward<std::initializer_list<int>>
1924 }
1925
1926 This deduction was implemented as a possible extension to the
1927 originally proposed semantics for the C++11 standard, but was not
1928 part of the final standard, so it is disabled by default. This
1929 option is deprecated, and may be removed in a future version of
1930 G++.
1931
1932 -fno-elide-constructors
1933 The C++ standard allows an implementation to omit creating a
1934 temporary that is only used to initialize another object of the
1935 same type. Specifying this option disables that optimization, and
1936 forces G++ to call the copy constructor in all cases. This option
1937 also causes G++ to call trivial member functions which otherwise
1938 would be expanded inline.
1939
1940 In C++17, the compiler is required to omit these temporaries, but
1941 this option still affects trivial member functions.
1942
1943 -fno-enforce-eh-specs
1944 Don't generate code to check for violation of exception
1945 specifications at run time. This option violates the C++ standard,
1946 but may be useful for reducing code size in production builds, much
1947 like defining "NDEBUG". This does not give user code permission to
1948 throw exceptions in violation of the exception specifications; the
1949 compiler still optimizes based on the specifications, so throwing
1950 an unexpected exception results in undefined behavior at run time.
1951
1952 -fextern-tls-init
1953 -fno-extern-tls-init
1954 The C++11 and OpenMP standards allow "thread_local" and
1955 "threadprivate" variables to have dynamic (runtime) initialization.
1956 To support this, any use of such a variable goes through a wrapper
1957 function that performs any necessary initialization. When the use
1958 and definition of the variable are in the same translation unit,
1959 this overhead can be optimized away, but when the use is in a
1960 different translation unit there is significant overhead even if
1961 the variable doesn't actually need dynamic initialization. If the
1962 programmer can be sure that no use of the variable in a non-
1963 defining TU needs to trigger dynamic initialization (either because
1964 the variable is statically initialized, or a use of the variable in
1965 the defining TU will be executed before any uses in another TU),
1966 they can avoid this overhead with the -fno-extern-tls-init option.
1967
1968 On targets that support symbol aliases, the default is
1969 -fextern-tls-init. On targets that do not support symbol aliases,
1970 the default is -fno-extern-tls-init.
1971
1972 -fno-gnu-keywords
1973 Do not recognize "typeof" as a keyword, so that code can use this
1974 word as an identifier. You can use the keyword "__typeof__"
1975 instead. This option is implied by the strict ISO C++ dialects:
1976 -ansi, -std=c++98, -std=c++11, etc.
1977
1978 -fno-implicit-templates
1979 Never emit code for non-inline templates that are instantiated
1980 implicitly (i.e. by use); only emit code for explicit
1981 instantiations. If you use this option, you must take care to
1982 structure your code to include all the necessary explicit
1983 instantiations to avoid getting undefined symbols at link time.
1984
1985 -fno-implicit-inline-templates
1986 Don't emit code for implicit instantiations of inline templates,
1987 either. The default is to handle inlines differently so that
1988 compiles with and without optimization need the same set of
1989 explicit instantiations.
1990
1991 -fno-implement-inlines
1992 To save space, do not emit out-of-line copies of inline functions
1993 controlled by "#pragma implementation". This causes linker errors
1994 if these functions are not inlined everywhere they are called.
1995
1996 -fms-extensions
1997 Disable Wpedantic warnings about constructs used in MFC, such as
1998 implicit int and getting a pointer to member function via non-
1999 standard syntax.
2000
2001 -fnew-inheriting-ctors
2002 Enable the P0136 adjustment to the semantics of C++11 constructor
2003 inheritance. This is part of C++17 but also considered to be a
2004 Defect Report against C++11 and C++14. This flag is enabled by
2005 default unless -fabi-version=10 or lower is specified.
2006
2007 -fnew-ttp-matching
2008 Enable the P0522 resolution to Core issue 150, template template
2009 parameters and default arguments: this allows a template with
2010 default template arguments as an argument for a template template
2011 parameter with fewer template parameters. This flag is enabled by
2012 default for -std=c++17.
2013
2014 -fno-nonansi-builtins
2015 Disable built-in declarations of functions that are not mandated by
2016 ANSI/ISO C. These include "ffs", "alloca", "_exit", "index",
2017 "bzero", "conjf", and other related functions.
2018
2019 -fnothrow-opt
2020 Treat a "throw()" exception specification as if it were a
2021 "noexcept" specification to reduce or eliminate the text size
2022 overhead relative to a function with no exception specification.
2023 If the function has local variables of types with non-trivial
2024 destructors, the exception specification actually makes the
2025 function smaller because the EH cleanups for those variables can be
2026 optimized away. The semantic effect is that an exception thrown
2027 out of a function with such an exception specification results in a
2028 call to "terminate" rather than "unexpected".
2029
2030 -fno-operator-names
2031 Do not treat the operator name keywords "and", "bitand", "bitor",
2032 "compl", "not", "or" and "xor" as synonyms as keywords.
2033
2034 -fno-optional-diags
2035 Disable diagnostics that the standard says a compiler does not need
2036 to issue. Currently, the only such diagnostic issued by G++ is the
2037 one for a name having multiple meanings within a class.
2038
2039 -fpermissive
2040 Downgrade some diagnostics about nonconformant code from errors to
2041 warnings. Thus, using -fpermissive allows some nonconforming code
2042 to compile.
2043
2044 -fno-pretty-templates
2045 When an error message refers to a specialization of a function
2046 template, the compiler normally prints the signature of the
2047 template followed by the template arguments and any typedefs or
2048 typenames in the signature (e.g. "void f(T) [with T = int]" rather
2049 than "void f(int)") so that it's clear which template is involved.
2050 When an error message refers to a specialization of a class
2051 template, the compiler omits any template arguments that match the
2052 default template arguments for that template. If either of these
2053 behaviors make it harder to understand the error message rather
2054 than easier, you can use -fno-pretty-templates to disable them.
2055
2056 -frepo
2057 Enable automatic template instantiation at link time. This option
2058 also implies -fno-implicit-templates.
2059
2060 -fno-rtti
2061 Disable generation of information about every class with virtual
2062 functions for use by the C++ run-time type identification features
2063 ("dynamic_cast" and "typeid"). If you don't use those parts of the
2064 language, you can save some space by using this flag. Note that
2065 exception handling uses the same information, but G++ generates it
2066 as needed. The "dynamic_cast" operator can still be used for casts
2067 that do not require run-time type information, i.e. casts to "void
2068 *" or to unambiguous base classes.
2069
2070 Mixing code compiled with -frtti with that compiled with -fno-rtti
2071 may not work. For example, programs may fail to link if a class
2072 compiled with -fno-rtti is used as a base for a class compiled with
2073 -frtti.
2074
2075 -fsized-deallocation
2076 Enable the built-in global declarations
2077
2078 void operator delete (void *, std::size_t) noexcept;
2079 void operator delete[] (void *, std::size_t) noexcept;
2080
2081 as introduced in C++14. This is useful for user-defined
2082 replacement deallocation functions that, for example, use the size
2083 of the object to make deallocation faster. Enabled by default
2084 under -std=c++14 and above. The flag -Wsized-deallocation warns
2085 about places that might want to add a definition.
2086
2087 -fstrict-enums
2088 Allow the compiler to optimize using the assumption that a value of
2089 enumerated type can only be one of the values of the enumeration
2090 (as defined in the C++ standard; basically, a value that can be
2091 represented in the minimum number of bits needed to represent all
2092 the enumerators). This assumption may not be valid if the program
2093 uses a cast to convert an arbitrary integer value to the enumerated
2094 type.
2095
2096 -fstrong-eval-order
2097 Evaluate member access, array subscripting, and shift expressions
2098 in left-to-right order, and evaluate assignment in right-to-left
2099 order, as adopted for C++17. Enabled by default with -std=c++17.
2100 -fstrong-eval-order=some enables just the ordering of member access
2101 and shift expressions, and is the default without -std=c++17.
2102
2103 -ftemplate-backtrace-limit=n
2104 Set the maximum number of template instantiation notes for a single
2105 warning or error to n. The default value is 10.
2106
2107 -ftemplate-depth=n
2108 Set the maximum instantiation depth for template classes to n. A
2109 limit on the template instantiation depth is needed to detect
2110 endless recursions during template class instantiation. ANSI/ISO
2111 C++ conforming programs must not rely on a maximum depth greater
2112 than 17 (changed to 1024 in C++11). The default value is 900, as
2113 the compiler can run out of stack space before hitting 1024 in some
2114 situations.
2115
2116 -fno-threadsafe-statics
2117 Do not emit the extra code to use the routines specified in the C++
2118 ABI for thread-safe initialization of local statics. You can use
2119 this option to reduce code size slightly in code that doesn't need
2120 to be thread-safe.
2121
2122 -fuse-cxa-atexit
2123 Register destructors for objects with static storage duration with
2124 the "__cxa_atexit" function rather than the "atexit" function.
2125 This option is required for fully standards-compliant handling of
2126 static destructors, but only works if your C library supports
2127 "__cxa_atexit".
2128
2129 -fno-use-cxa-get-exception-ptr
2130 Don't use the "__cxa_get_exception_ptr" runtime routine. This
2131 causes "std::uncaught_exception" to be incorrect, but is necessary
2132 if the runtime routine is not available.
2133
2134 -fvisibility-inlines-hidden
2135 This switch declares that the user does not attempt to compare
2136 pointers to inline functions or methods where the addresses of the
2137 two functions are taken in different shared objects.
2138
2139 The effect of this is that GCC may, effectively, mark inline
2140 methods with "__attribute__ ((visibility ("hidden")))" so that they
2141 do not appear in the export table of a DSO and do not require a PLT
2142 indirection when used within the DSO. Enabling this option can
2143 have a dramatic effect on load and link times of a DSO as it
2144 massively reduces the size of the dynamic export table when the
2145 library makes heavy use of templates.
2146
2147 The behavior of this switch is not quite the same as marking the
2148 methods as hidden directly, because it does not affect static
2149 variables local to the function or cause the compiler to deduce
2150 that the function is defined in only one shared object.
2151
2152 You may mark a method as having a visibility explicitly to negate
2153 the effect of the switch for that method. For example, if you do
2154 want to compare pointers to a particular inline method, you might
2155 mark it as having default visibility. Marking the enclosing class
2156 with explicit visibility has no effect.
2157
2158 Explicitly instantiated inline methods are unaffected by this
2159 option as their linkage might otherwise cross a shared library
2160 boundary.
2161
2162 -fvisibility-ms-compat
2163 This flag attempts to use visibility settings to make GCC's C++
2164 linkage model compatible with that of Microsoft Visual Studio.
2165
2166 The flag makes these changes to GCC's linkage model:
2167
2168 1. It sets the default visibility to "hidden", like
2169 -fvisibility=hidden.
2170
2171 2. Types, but not their members, are not hidden by default.
2172
2173 3. The One Definition Rule is relaxed for types without explicit
2174 visibility specifications that are defined in more than one
2175 shared object: those declarations are permitted if they are
2176 permitted when this option is not used.
2177
2178 In new code it is better to use -fvisibility=hidden and export
2179 those classes that are intended to be externally visible.
2180 Unfortunately it is possible for code to rely, perhaps
2181 accidentally, on the Visual Studio behavior.
2182
2183 Among the consequences of these changes are that static data
2184 members of the same type with the same name but defined in
2185 different shared objects are different, so changing one does not
2186 change the other; and that pointers to function members defined in
2187 different shared objects may not compare equal. When this flag is
2188 given, it is a violation of the ODR to define types with the same
2189 name differently.
2190
2191 -fno-weak
2192 Do not use weak symbol support, even if it is provided by the
2193 linker. By default, G++ uses weak symbols if they are available.
2194 This option exists only for testing, and should not be used by end-
2195 users; it results in inferior code and has no benefits. This
2196 option may be removed in a future release of G++.
2197
2198 -nostdinc++
2199 Do not search for header files in the standard directories specific
2200 to C++, but do still search the other standard directories. (This
2201 option is used when building the C++ library.)
2202
2203 In addition, these optimization, warning, and code generation options
2204 have meanings only for C++ programs:
2205
2206 -Wabi (C, Objective-C, C++ and Objective-C++ only)
2207 Warn when G++ it generates code that is probably not compatible
2208 with the vendor-neutral C++ ABI. Since G++ now defaults to
2209 updating the ABI with each major release, normally -Wabi will warn
2210 only if there is a check added later in a release series for an ABI
2211 issue discovered since the initial release. -Wabi will warn about
2212 more things if an older ABI version is selected (with
2213 -fabi-version=n).
2214
2215 -Wabi can also be used with an explicit version number to warn
2216 about compatibility with a particular -fabi-version level, e.g.
2217 -Wabi=2 to warn about changes relative to -fabi-version=2.
2218
2219 If an explicit version number is provided and -fabi-compat-version
2220 is not specified, the version number from this option is used for
2221 compatibility aliases. If no explicit version number is provided
2222 with this option, but -fabi-compat-version is specified, that
2223 version number is used for ABI warnings.
2224
2225 Although an effort has been made to warn about all such cases,
2226 there are probably some cases that are not warned about, even
2227 though G++ is generating incompatible code. There may also be
2228 cases where warnings are emitted even though the code that is
2229 generated is compatible.
2230
2231 You should rewrite your code to avoid these warnings if you are
2232 concerned about the fact that code generated by G++ may not be
2233 binary compatible with code generated by other compilers.
2234
2235 Known incompatibilities in -fabi-version=2 (which was the default
2236 from GCC 3.4 to 4.9) include:
2237
2238 * A template with a non-type template parameter of reference type
2239 was mangled incorrectly:
2240
2241 extern int N;
2242 template <int &> struct S {};
2243 void n (S<N>) {2}
2244
2245 This was fixed in -fabi-version=3.
2246
2247 * SIMD vector types declared using "__attribute ((vector_size))"
2248 were mangled in a non-standard way that does not allow for
2249 overloading of functions taking vectors of different sizes.
2250
2251 The mangling was changed in -fabi-version=4.
2252
2253 * "__attribute ((const))" and "noreturn" were mangled as type
2254 qualifiers, and "decltype" of a plain declaration was folded
2255 away.
2256
2257 These mangling issues were fixed in -fabi-version=5.
2258
2259 * Scoped enumerators passed as arguments to a variadic function
2260 are promoted like unscoped enumerators, causing "va_arg" to
2261 complain. On most targets this does not actually affect the
2262 parameter passing ABI, as there is no way to pass an argument
2263 smaller than "int".
2264
2265 Also, the ABI changed the mangling of template argument packs,
2266 "const_cast", "static_cast", prefix increment/decrement, and a
2267 class scope function used as a template argument.
2268
2269 These issues were corrected in -fabi-version=6.
2270
2271 * Lambdas in default argument scope were mangled incorrectly, and
2272 the ABI changed the mangling of "nullptr_t".
2273
2274 These issues were corrected in -fabi-version=7.
2275
2276 * When mangling a function type with function-cv-qualifiers, the
2277 un-qualified function type was incorrectly treated as a
2278 substitution candidate.
2279
2280 This was fixed in -fabi-version=8, the default for GCC 5.1.
2281
2282 * "decltype(nullptr)" incorrectly had an alignment of 1, leading
2283 to unaligned accesses. Note that this did not affect the ABI
2284 of a function with a "nullptr_t" parameter, as parameters have
2285 a minimum alignment.
2286
2287 This was fixed in -fabi-version=9, the default for GCC 5.2.
2288
2289 * Target-specific attributes that affect the identity of a type,
2290 such as ia32 calling conventions on a function type (stdcall,
2291 regparm, etc.), did not affect the mangled name, leading to
2292 name collisions when function pointers were used as template
2293 arguments.
2294
2295 This was fixed in -fabi-version=10, the default for GCC 6.1.
2296
2297 It also warns about psABI-related changes. The known psABI changes
2298 at this point include:
2299
2300 * For SysV/x86-64, unions with "long double" members are passed
2301 in memory as specified in psABI. For example:
2302
2303 union U {
2304 long double ld;
2305 int i;
2306 };
2307
2308 "union U" is always passed in memory.
2309
2310 -Wabi-tag (C++ and Objective-C++ only)
2311 Warn when a type with an ABI tag is used in a context that does not
2312 have that ABI tag. See C++ Attributes for more information about
2313 ABI tags.
2314
2315 -Wctor-dtor-privacy (C++ and Objective-C++ only)
2316 Warn when a class seems unusable because all the constructors or
2317 destructors in that class are private, and it has neither friends
2318 nor public static member functions. Also warn if there are no non-
2319 private methods, and there's at least one private member function
2320 that isn't a constructor or destructor.
2321
2322 -Wdelete-non-virtual-dtor (C++ and Objective-C++ only)
2323 Warn when "delete" is used to destroy an instance of a class that
2324 has virtual functions and non-virtual destructor. It is unsafe to
2325 delete an instance of a derived class through a pointer to a base
2326 class if the base class does not have a virtual destructor. This
2327 warning is enabled by -Wall.
2328
2329 -Wdeprecated-copy (C++ and Objective-C++ only)
2330 Warn that the implicit declaration of a copy constructor or copy
2331 assignment operator is deprecated if the class has a user-provided
2332 copy constructor or copy assignment operator, in C++11 and up.
2333 This warning is enabled by -Wextra. With -Wdeprecated-copy-dtor,
2334 also deprecate if the class has a user-provided destructor.
2335
2336 -Wno-init-list-lifetime (C++ and Objective-C++ only)
2337 Do not warn about uses of "std::initializer_list" that are likely
2338 to result in dangling pointers. Since the underlying array for an
2339 "initializer_list" is handled like a normal C++ temporary object,
2340 it is easy to inadvertently keep a pointer to the array past the
2341 end of the array's lifetime. For example:
2342
2343 * If a function returns a temporary "initializer_list", or a
2344 local "initializer_list" variable, the array's lifetime ends at
2345 the end of the return statement, so the value returned has a
2346 dangling pointer.
2347
2348 * If a new-expression creates an "initializer_list", the array
2349 only lives until the end of the enclosing full-expression, so
2350 the "initializer_list" in the heap has a dangling pointer.
2351
2352 * When an "initializer_list" variable is assigned from a brace-
2353 enclosed initializer list, the temporary array created for the
2354 right side of the assignment only lives until the end of the
2355 full-expression, so at the next statement the
2356 "initializer_list" variable has a dangling pointer.
2357
2358 // li's initial underlying array lives as long as li
2359 std::initializer_list<int> li = { 1,2,3 };
2360 // assignment changes li to point to a temporary array
2361 li = { 4, 5 };
2362 // now the temporary is gone and li has a dangling pointer
2363 int i = li.begin()[0] // undefined behavior
2364
2365 * When a list constructor stores the "begin" pointer from the
2366 "initializer_list" argument, this doesn't extend the lifetime
2367 of the array, so if a class variable is constructed from a
2368 temporary "initializer_list", the pointer is left dangling by
2369 the end of the variable declaration statement.
2370
2371 -Wliteral-suffix (C++ and Objective-C++ only)
2372 Warn when a string or character literal is followed by a ud-suffix
2373 which does not begin with an underscore. As a conforming
2374 extension, GCC treats such suffixes as separate preprocessing
2375 tokens in order to maintain backwards compatibility with code that
2376 uses formatting macros from "<inttypes.h>". For example:
2377
2378 #define __STDC_FORMAT_MACROS
2379 #include <inttypes.h>
2380 #include <stdio.h>
2381
2382 int main() {
2383 int64_t i64 = 123;
2384 printf("My int64: %" PRId64"\n", i64);
2385 }
2386
2387 In this case, "PRId64" is treated as a separate preprocessing
2388 token.
2389
2390 Additionally, warn when a user-defined literal operator is declared
2391 with a literal suffix identifier that doesn't begin with an
2392 underscore. Literal suffix identifiers that don't begin with an
2393 underscore are reserved for future standardization.
2394
2395 This warning is enabled by default.
2396
2397 -Wlto-type-mismatch
2398 During the link-time optimization warn about type mismatches in
2399 global declarations from different compilation units. Requires
2400 -flto to be enabled. Enabled by default.
2401
2402 -Wno-narrowing (C++ and Objective-C++ only)
2403 For C++11 and later standards, narrowing conversions are diagnosed
2404 by default, as required by the standard. A narrowing conversion
2405 from a constant produces an error, and a narrowing conversion from
2406 a non-constant produces a warning, but -Wno-narrowing suppresses
2407 the diagnostic. Note that this does not affect the meaning of
2408 well-formed code; narrowing conversions are still considered ill-
2409 formed in SFINAE contexts.
2410
2411 With -Wnarrowing in C++98, warn when a narrowing conversion
2412 prohibited by C++11 occurs within { }, e.g.
2413
2414 int i = { 2.2 }; // error: narrowing from double to int
2415
2416 This flag is included in -Wall and -Wc++11-compat.
2417
2418 -Wnoexcept (C++ and Objective-C++ only)
2419 Warn when a noexcept-expression evaluates to false because of a
2420 call to a function that does not have a non-throwing exception
2421 specification (i.e. "throw()" or "noexcept") but is known by the
2422 compiler to never throw an exception.
2423
2424 -Wnoexcept-type (C++ and Objective-C++ only)
2425 Warn if the C++17 feature making "noexcept" part of a function type
2426 changes the mangled name of a symbol relative to C++14. Enabled by
2427 -Wabi and -Wc++17-compat.
2428
2429 As an example:
2430
2431 template <class T> void f(T t) { t(); };
2432 void g() noexcept;
2433 void h() { f(g); }
2434
2435 In C++14, "f" calls "f<void(*)()>", but in C++17 it calls
2436 "f<void(*)()noexcept>".
2437
2438 -Wclass-memaccess (C++ and Objective-C++ only)
2439 Warn when the destination of a call to a raw memory function such
2440 as "memset" or "memcpy" is an object of class type, and when
2441 writing into such an object might bypass the class non-trivial or
2442 deleted constructor or copy assignment, violate const-correctness
2443 or encapsulation, or corrupt virtual table pointers. Modifying the
2444 representation of such objects may violate invariants maintained by
2445 member functions of the class. For example, the call to "memset"
2446 below is undefined because it modifies a non-trivial class object
2447 and is, therefore, diagnosed. The safe way to either initialize or
2448 clear the storage of objects of such types is by using the
2449 appropriate constructor or assignment operator, if one is
2450 available.
2451
2452 std::string str = "abc";
2453 memset (&str, 0, sizeof str);
2454
2455 The -Wclass-memaccess option is enabled by -Wall. Explicitly
2456 casting the pointer to the class object to "void *" or to a type
2457 that can be safely accessed by the raw memory function suppresses
2458 the warning.
2459
2460 -Wnon-virtual-dtor (C++ and Objective-C++ only)
2461 Warn when a class has virtual functions and an accessible non-
2462 virtual destructor itself or in an accessible polymorphic base
2463 class, in which case it is possible but unsafe to delete an
2464 instance of a derived class through a pointer to the class itself
2465 or base class. This warning is automatically enabled if -Weffc++
2466 is specified.
2467
2468 -Wregister (C++ and Objective-C++ only)
2469 Warn on uses of the "register" storage class specifier, except when
2470 it is part of the GNU Explicit Register Variables extension. The
2471 use of the "register" keyword as storage class specifier has been
2472 deprecated in C++11 and removed in C++17. Enabled by default with
2473 -std=c++17.
2474
2475 -Wreorder (C++ and Objective-C++ only)
2476 Warn when the order of member initializers given in the code does
2477 not match the order in which they must be executed. For instance:
2478
2479 struct A {
2480 int i;
2481 int j;
2482 A(): j (0), i (1) { }
2483 };
2484
2485 The compiler rearranges the member initializers for "i" and "j" to
2486 match the declaration order of the members, emitting a warning to
2487 that effect. This warning is enabled by -Wall.
2488
2489 -Wno-pessimizing-move (C++ and Objective-C++ only)
2490 This warning warns when a call to "std::move" prevents copy
2491 elision. A typical scenario when copy elision can occur is when
2492 returning in a function with a class return type, when the
2493 expression being returned is the name of a non-volatile automatic
2494 object, and is not a function parameter, and has the same type as
2495 the function return type.
2496
2497 struct T {
2498 ...
2499 };
2500 T fn()
2501 {
2502 T t;
2503 ...
2504 return std::move (t);
2505 }
2506
2507 But in this example, the "std::move" call prevents copy elision.
2508
2509 This warning is enabled by -Wall.
2510
2511 -Wno-redundant-move (C++ and Objective-C++ only)
2512 This warning warns about redundant calls to "std::move"; that is,
2513 when a move operation would have been performed even without the
2514 "std::move" call. This happens because the compiler is forced to
2515 treat the object as if it were an rvalue in certain situations such
2516 as returning a local variable, where copy elision isn't applicable.
2517 Consider:
2518
2519 struct T {
2520 ...
2521 };
2522 T fn(T t)
2523 {
2524 ...
2525 return std::move (t);
2526 }
2527
2528 Here, the "std::move" call is redundant. Because G++ implements
2529 Core Issue 1579, another example is:
2530
2531 struct T { // convertible to U
2532 ...
2533 };
2534 struct U {
2535 ...
2536 };
2537 U fn()
2538 {
2539 T t;
2540 ...
2541 return std::move (t);
2542 }
2543
2544 In this example, copy elision isn't applicable because the type of
2545 the expression being returned and the function return type differ,
2546 yet G++ treats the return value as if it were designated by an
2547 rvalue.
2548
2549 This warning is enabled by -Wextra.
2550
2551 -fext-numeric-literals (C++ and Objective-C++ only)
2552 Accept imaginary, fixed-point, or machine-defined literal number
2553 suffixes as GNU extensions. When this option is turned off these
2554 suffixes are treated as C++11 user-defined literal numeric
2555 suffixes. This is on by default for all pre-C++11 dialects and all
2556 GNU dialects: -std=c++98, -std=gnu++98, -std=gnu++11, -std=gnu++14.
2557 This option is off by default for ISO C++11 onwards (-std=c++11,
2558 ...).
2559
2560 The following -W... options are not affected by -Wall.
2561
2562 -Weffc++ (C++ and Objective-C++ only)
2563 Warn about violations of the following style guidelines from Scott
2564 Meyers' Effective C++ series of books:
2565
2566 * Define a copy constructor and an assignment operator for
2567 classes with dynamically-allocated memory.
2568
2569 * Prefer initialization to assignment in constructors.
2570
2571 * Have "operator=" return a reference to *this.
2572
2573 * Don't try to return a reference when you must return an object.
2574
2575 * Distinguish between prefix and postfix forms of increment and
2576 decrement operators.
2577
2578 * Never overload "&&", "||", or ",".
2579
2580 This option also enables -Wnon-virtual-dtor, which is also one of
2581 the effective C++ recommendations. However, the check is extended
2582 to warn about the lack of virtual destructor in accessible non-
2583 polymorphic bases classes too.
2584
2585 When selecting this option, be aware that the standard library
2586 headers do not obey all of these guidelines; use grep -v to filter
2587 out those warnings.
2588
2589 -Wstrict-null-sentinel (C++ and Objective-C++ only)
2590 Warn about the use of an uncasted "NULL" as sentinel. When
2591 compiling only with GCC this is a valid sentinel, as "NULL" is
2592 defined to "__null". Although it is a null pointer constant rather
2593 than a null pointer, it is guaranteed to be of the same size as a
2594 pointer. But this use is not portable across different compilers.
2595
2596 -Wno-non-template-friend (C++ and Objective-C++ only)
2597 Disable warnings when non-template friend functions are declared
2598 within a template. In very old versions of GCC that predate
2599 implementation of the ISO standard, declarations such as friend int
2600 foo(int), where the name of the friend is an unqualified-id, could
2601 be interpreted as a particular specialization of a template
2602 function; the warning exists to diagnose compatibility problems,
2603 and is enabled by default.
2604
2605 -Wold-style-cast (C++ and Objective-C++ only)
2606 Warn if an old-style (C-style) cast to a non-void type is used
2607 within a C++ program. The new-style casts ("dynamic_cast",
2608 "static_cast", "reinterpret_cast", and "const_cast") are less
2609 vulnerable to unintended effects and much easier to search for.
2610
2611 -Woverloaded-virtual (C++ and Objective-C++ only)
2612 Warn when a function declaration hides virtual functions from a
2613 base class. For example, in:
2614
2615 struct A {
2616 virtual void f();
2617 };
2618
2619 struct B: public A {
2620 void f(int);
2621 };
2622
2623 the "A" class version of "f" is hidden in "B", and code like:
2624
2625 B* b;
2626 b->f();
2627
2628 fails to compile.
2629
2630 -Wno-pmf-conversions (C++ and Objective-C++ only)
2631 Disable the diagnostic for converting a bound pointer to member
2632 function to a plain pointer.
2633
2634 -Wsign-promo (C++ and Objective-C++ only)
2635 Warn when overload resolution chooses a promotion from unsigned or
2636 enumerated type to a signed type, over a conversion to an unsigned
2637 type of the same size. Previous versions of G++ tried to preserve
2638 unsignedness, but the standard mandates the current behavior.
2639
2640 -Wtemplates (C++ and Objective-C++ only)
2641 Warn when a primary template declaration is encountered. Some
2642 coding rules disallow templates, and this may be used to enforce
2643 that rule. The warning is inactive inside a system header file,
2644 such as the STL, so one can still use the STL. One may also
2645 instantiate or specialize templates.
2646
2647 -Wmultiple-inheritance (C++ and Objective-C++ only)
2648 Warn when a class is defined with multiple direct base classes.
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 multiple inheritance.
2653
2654 -Wvirtual-inheritance
2655 Warn when a class is defined with a virtual direct base class.
2656 Some coding rules disallow multiple inheritance, and this may be
2657 used to enforce that rule. The warning is inactive inside a system
2658 header file, such as the STL, so one can still use the STL. One
2659 may also define classes that indirectly use virtual inheritance.
2660
2661 -Wnamespaces
2662 Warn when a namespace definition is opened. Some coding rules
2663 disallow namespaces, and this may be used to enforce that rule.
2664 The warning is inactive inside a system header file, such as the
2665 STL, so one can still use the STL. One may also use using
2666 directives and qualified names.
2667
2668 -Wno-terminate (C++ and Objective-C++ only)
2669 Disable the warning about a throw-expression that will immediately
2670 result in a call to "terminate".
2671
2672 -Wno-class-conversion (C++ and Objective-C++ only)
2673 Disable the warning about the case when a conversion function
2674 converts an object to the same type, to a base class of that type,
2675 or to void; such a conversion function will never be called.
2676
2677 Options Controlling Objective-C and Objective-C++ Dialects
2678 (NOTE: This manual does not describe the Objective-C and Objective-C++
2679 languages themselves.
2680
2681 This section describes the command-line options that are only
2682 meaningful for Objective-C and Objective-C++ programs. You can also
2683 use most of the language-independent GNU compiler options. For
2684 example, you might compile a file some_class.m like this:
2685
2686 gcc -g -fgnu-runtime -O -c some_class.m
2687
2688 In this example, -fgnu-runtime is an option meant only for Objective-C
2689 and Objective-C++ programs; you can use the other options with any
2690 language supported by GCC.
2691
2692 Note that since Objective-C is an extension of the C language,
2693 Objective-C compilations may also use options specific to the C front-
2694 end (e.g., -Wtraditional). Similarly, Objective-C++ compilations may
2695 use C++-specific options (e.g., -Wabi).
2696
2697 Here is a list of options that are only for compiling Objective-C and
2698 Objective-C++ programs:
2699
2700 -fconstant-string-class=class-name
2701 Use class-name as the name of the class to instantiate for each
2702 literal string specified with the syntax "@"..."". The default
2703 class name is "NXConstantString" if the GNU runtime is being used,
2704 and "NSConstantString" if the NeXT runtime is being used (see
2705 below). The -fconstant-cfstrings option, if also present,
2706 overrides the -fconstant-string-class setting and cause "@"...""
2707 literals to be laid out as constant CoreFoundation strings.
2708
2709 -fgnu-runtime
2710 Generate object code compatible with the standard GNU Objective-C
2711 runtime. This is the default for most types of systems.
2712
2713 -fnext-runtime
2714 Generate output compatible with the NeXT runtime. This is the
2715 default for NeXT-based systems, including Darwin and Mac OS X. The
2716 macro "__NEXT_RUNTIME__" is predefined if (and only if) this option
2717 is used.
2718
2719 -fno-nil-receivers
2720 Assume that all Objective-C message dispatches ("[receiver
2721 message:arg]") in this translation unit ensure that the receiver is
2722 not "nil". This allows for more efficient entry points in the
2723 runtime to be used. This option is only available in conjunction
2724 with the NeXT runtime and ABI version 0 or 1.
2725
2726 -fobjc-abi-version=n
2727 Use version n of the Objective-C ABI for the selected runtime.
2728 This option is currently supported only for the NeXT runtime. In
2729 that case, Version 0 is the traditional (32-bit) ABI without
2730 support for properties and other Objective-C 2.0 additions.
2731 Version 1 is the traditional (32-bit) ABI with support for
2732 properties and other Objective-C 2.0 additions. Version 2 is the
2733 modern (64-bit) ABI. If nothing is specified, the default is
2734 Version 0 on 32-bit target machines, and Version 2 on 64-bit target
2735 machines.
2736
2737 -fobjc-call-cxx-cdtors
2738 For each Objective-C class, check if any of its instance variables
2739 is a C++ object with a non-trivial default constructor. If so,
2740 synthesize a special "- (id) .cxx_construct" instance method which
2741 runs non-trivial default constructors on any such instance
2742 variables, in order, and then return "self". Similarly, check if
2743 any instance variable is a C++ object with a non-trivial
2744 destructor, and if so, synthesize a special "- (void)
2745 .cxx_destruct" method which runs all such default destructors, in
2746 reverse order.
2747
2748 The "- (id) .cxx_construct" and "- (void) .cxx_destruct" methods
2749 thusly generated only operate on instance variables declared in the
2750 current Objective-C class, and not those inherited from
2751 superclasses. It is the responsibility of the Objective-C runtime
2752 to invoke all such methods in an object's inheritance hierarchy.
2753 The "- (id) .cxx_construct" methods are invoked by the runtime
2754 immediately after a new object instance is allocated; the "- (void)
2755 .cxx_destruct" methods are invoked immediately before the runtime
2756 deallocates an object instance.
2757
2758 As of this writing, only the NeXT runtime on Mac OS X 10.4 and
2759 later has support for invoking the "- (id) .cxx_construct" and "-
2760 (void) .cxx_destruct" methods.
2761
2762 -fobjc-direct-dispatch
2763 Allow fast jumps to the message dispatcher. On Darwin this is
2764 accomplished via the comm page.
2765
2766 -fobjc-exceptions
2767 Enable syntactic support for structured exception handling in
2768 Objective-C, similar to what is offered by C++. This option is
2769 required to use the Objective-C keywords @try, @throw, @catch,
2770 @finally and @synchronized. This option is available with both the
2771 GNU runtime and the NeXT runtime (but not available in conjunction
2772 with the NeXT runtime on Mac OS X 10.2 and earlier).
2773
2774 -fobjc-gc
2775 Enable garbage collection (GC) in Objective-C and Objective-C++
2776 programs. This option is only available with the NeXT runtime; the
2777 GNU runtime has a different garbage collection implementation that
2778 does not require special compiler flags.
2779
2780 -fobjc-nilcheck
2781 For the NeXT runtime with version 2 of the ABI, check for a nil
2782 receiver in method invocations before doing the actual method call.
2783 This is the default and can be disabled using -fno-objc-nilcheck.
2784 Class methods and super calls are never checked for nil in this way
2785 no matter what this flag is set to. Currently this flag does
2786 nothing when the GNU runtime, or an older version of the NeXT
2787 runtime ABI, is used.
2788
2789 -fobjc-std=objc1
2790 Conform to the language syntax of Objective-C 1.0, the language
2791 recognized by GCC 4.0. This only affects the Objective-C additions
2792 to the C/C++ language; it does not affect conformance to C/C++
2793 standards, which is controlled by the separate C/C++ dialect option
2794 flags. When this option is used with the Objective-C or
2795 Objective-C++ compiler, any Objective-C syntax that is not
2796 recognized by GCC 4.0 is rejected. This is useful if you need to
2797 make sure that your Objective-C code can be compiled with older
2798 versions of GCC.
2799
2800 -freplace-objc-classes
2801 Emit a special marker instructing ld(1) not to statically link in
2802 the resulting object file, and allow dyld(1) to load it in at run
2803 time instead. This is used in conjunction with the Fix-and-
2804 Continue debugging mode, where the object file in question may be
2805 recompiled and dynamically reloaded in the course of program
2806 execution, without the need to restart the program itself.
2807 Currently, Fix-and-Continue functionality is only available in
2808 conjunction with the NeXT runtime on Mac OS X 10.3 and later.
2809
2810 -fzero-link
2811 When compiling for the NeXT runtime, the compiler ordinarily
2812 replaces calls to "objc_getClass("...")" (when the name of the
2813 class is known at compile time) with static class references that
2814 get initialized at load time, which improves run-time performance.
2815 Specifying the -fzero-link flag suppresses this behavior and causes
2816 calls to "objc_getClass("...")" to be retained. This is useful in
2817 Zero-Link debugging mode, since it allows for individual class
2818 implementations to be modified during program execution. The GNU
2819 runtime currently always retains calls to "objc_get_class("...")"
2820 regardless of command-line options.
2821
2822 -fno-local-ivars
2823 By default instance variables in Objective-C can be accessed as if
2824 they were local variables from within the methods of the class
2825 they're declared in. This can lead to shadowing between instance
2826 variables and other variables declared either locally inside a
2827 class method or globally with the same name. Specifying the
2828 -fno-local-ivars flag disables this behavior thus avoiding variable
2829 shadowing issues.
2830
2831 -fivar-visibility=[public|protected|private|package]
2832 Set the default instance variable visibility to the specified
2833 option so that instance variables declared outside the scope of any
2834 access modifier directives default to the specified visibility.
2835
2836 -gen-decls
2837 Dump interface declarations for all classes seen in the source file
2838 to a file named sourcename.decl.
2839
2840 -Wassign-intercept (Objective-C and Objective-C++ only)
2841 Warn whenever an Objective-C assignment is being intercepted by the
2842 garbage collector.
2843
2844 -Wno-protocol (Objective-C and Objective-C++ only)
2845 If a class is declared to implement a protocol, a warning is issued
2846 for every method in the protocol that is not implemented by the
2847 class. The default behavior is to issue a warning for every method
2848 not explicitly implemented in the class, even if a method
2849 implementation is inherited from the superclass. If you use the
2850 -Wno-protocol option, then methods inherited from the superclass
2851 are considered to be implemented, and no warning is issued for
2852 them.
2853
2854 -Wselector (Objective-C and Objective-C++ only)
2855 Warn if multiple methods of different types for the same selector
2856 are found during compilation. The check is performed on the list
2857 of methods in the final stage of compilation. Additionally, a
2858 check is performed for each selector appearing in a
2859 "@selector(...)" expression, and a corresponding method for that
2860 selector has been found during compilation. Because these checks
2861 scan the method table only at the end of compilation, these
2862 warnings are not produced if the final stage of compilation is not
2863 reached, for example because an error is found during compilation,
2864 or because the -fsyntax-only option is being used.
2865
2866 -Wstrict-selector-match (Objective-C and Objective-C++ only)
2867 Warn if multiple methods with differing argument and/or return
2868 types are found for a given selector when attempting to send a
2869 message using this selector to a receiver of type "id" or "Class".
2870 When this flag is off (which is the default behavior), the compiler
2871 omits such warnings if any differences found are confined to types
2872 that share the same size and alignment.
2873
2874 -Wundeclared-selector (Objective-C and Objective-C++ only)
2875 Warn if a "@selector(...)" expression referring to an undeclared
2876 selector is found. A selector is considered undeclared if no
2877 method with that name has been declared before the "@selector(...)"
2878 expression, either explicitly in an @interface or @protocol
2879 declaration, or implicitly in an @implementation section. This
2880 option always performs its checks as soon as a "@selector(...)"
2881 expression is found, while -Wselector only performs its checks in
2882 the final stage of compilation. This also enforces the coding
2883 style convention that methods and selectors must be declared before
2884 being used.
2885
2886 -print-objc-runtime-info
2887 Generate C header describing the largest structure that is passed
2888 by value, if any.
2889
2890 Options to Control Diagnostic Messages Formatting
2891 Traditionally, diagnostic messages have been formatted irrespective of
2892 the output device's aspect (e.g. its width, ...). You can use the
2893 options described below to control the formatting algorithm for
2894 diagnostic messages, e.g. how many characters per line, how often
2895 source location information should be reported. Note that some
2896 language front ends may not honor these options.
2897
2898 -fmessage-length=n
2899 Try to format error messages so that they fit on lines of about n
2900 characters. If n is zero, then no line-wrapping is done; each
2901 error message appears on a single line. This is the default for
2902 all front ends.
2903
2904 Note - this option also affects the display of the #error and
2905 #warning pre-processor directives, and the deprecated
2906 function/type/variable attribute. It does not however affect the
2907 pragma GCC warning and pragma GCC error pragmas.
2908
2909 -fdiagnostics-show-location=once
2910 Only meaningful in line-wrapping mode. Instructs the diagnostic
2911 messages reporter to emit source location information once; that
2912 is, in case the message is too long to fit on a single physical
2913 line and has to be wrapped, the source location won't be emitted
2914 (as prefix) again, over and over, in subsequent continuation lines.
2915 This is the default behavior.
2916
2917 -fdiagnostics-show-location=every-line
2918 Only meaningful in line-wrapping mode. Instructs the diagnostic
2919 messages reporter to emit the same source location information (as
2920 prefix) for physical lines that result from the process of breaking
2921 a message which is too long to fit on a single line.
2922
2923 -fdiagnostics-color[=WHEN]
2924 -fno-diagnostics-color
2925 Use color in diagnostics. WHEN is never, always, or auto. The
2926 default depends on how the compiler has been configured, it can be
2927 any of the above WHEN options or also never if GCC_COLORS
2928 environment variable isn't present in the environment, and auto
2929 otherwise. auto means to use color only when the standard error is
2930 a terminal. The forms -fdiagnostics-color and
2931 -fno-diagnostics-color are aliases for -fdiagnostics-color=always
2932 and -fdiagnostics-color=never, respectively.
2933
2934 The colors are defined by the environment variable GCC_COLORS. Its
2935 value is a colon-separated list of capabilities and Select Graphic
2936 Rendition (SGR) substrings. SGR commands are interpreted by the
2937 terminal or terminal emulator. (See the section in the
2938 documentation of your text terminal for permitted values and their
2939 meanings as character attributes.) These substring values are
2940 integers in decimal representation and can be concatenated with
2941 semicolons. Common values to concatenate include 1 for bold, 4 for
2942 underline, 5 for blink, 7 for inverse, 39 for default foreground
2943 color, 30 to 37 for foreground colors, 90 to 97 for 16-color mode
2944 foreground colors, 38;5;0 to 38;5;255 for 88-color and 256-color
2945 modes foreground colors, 49 for default background color, 40 to 47
2946 for background colors, 100 to 107 for 16-color mode background
2947 colors, and 48;5;0 to 48;5;255 for 88-color and 256-color modes
2948 background colors.
2949
2950 The default GCC_COLORS is
2951
2952 error=01;31:warning=01;35:note=01;36:range1=32:range2=34:locus=01:\
2953 quote=01:fixit-insert=32:fixit-delete=31:\
2954 diff-filename=01:diff-hunk=32:diff-delete=31:diff-insert=32:\
2955 type-diff=01;32
2956
2957 where 01;31 is bold red, 01;35 is bold magenta, 01;36 is bold cyan,
2958 32 is green, 34 is blue, 01 is bold, and 31 is red. Setting
2959 GCC_COLORS to the empty string disables colors. Supported
2960 capabilities are as follows.
2961
2962 "error="
2963 SGR substring for error: markers.
2964
2965 "warning="
2966 SGR substring for warning: markers.
2967
2968 "note="
2969 SGR substring for note: markers.
2970
2971 "range1="
2972 SGR substring for first additional range.
2973
2974 "range2="
2975 SGR substring for second additional range.
2976
2977 "locus="
2978 SGR substring for location information, file:line or
2979 file:line:column etc.
2980
2981 "quote="
2982 SGR substring for information printed within quotes.
2983
2984 "fixit-insert="
2985 SGR substring for fix-it hints suggesting text to be inserted
2986 or replaced.
2987
2988 "fixit-delete="
2989 SGR substring for fix-it hints suggesting text to be deleted.
2990
2991 "diff-filename="
2992 SGR substring for filename headers within generated patches.
2993
2994 "diff-hunk="
2995 SGR substring for the starts of hunks within generated patches.
2996
2997 "diff-delete="
2998 SGR substring for deleted lines within generated patches.
2999
3000 "diff-insert="
3001 SGR substring for inserted lines within generated patches.
3002
3003 "type-diff="
3004 SGR substring for highlighting mismatching types within
3005 template arguments in the C++ frontend.
3006
3007 -fno-diagnostics-show-option
3008 By default, each diagnostic emitted includes text indicating the
3009 command-line option that directly controls the diagnostic (if such
3010 an option is known to the diagnostic machinery). Specifying the
3011 -fno-diagnostics-show-option flag suppresses that behavior.
3012
3013 -fno-diagnostics-show-caret
3014 By default, each diagnostic emitted includes the original source
3015 line and a caret ^ indicating the column. This option suppresses
3016 this information. The source line is truncated to n characters, if
3017 the -fmessage-length=n option is given. When the output is done to
3018 the terminal, the width is limited to the width given by the
3019 COLUMNS environment variable or, if not set, to the terminal width.
3020
3021 -fno-diagnostics-show-labels
3022 By default, when printing source code (via
3023 -fdiagnostics-show-caret), diagnostics can label ranges of source
3024 code with pertinent information, such as the types of expressions:
3025
3026 printf ("foo %s bar", long_i + long_j);
3027 ~^ ~~~~~~~~~~~~~~~
3028 | |
3029 char * long int
3030
3031 This option suppresses the printing of these labels (in the example
3032 above, the vertical bars and the "char *" and "long int" text).
3033
3034 -fno-diagnostics-show-line-numbers
3035 By default, when printing source code (via
3036 -fdiagnostics-show-caret), a left margin is printed, showing line
3037 numbers. This option suppresses this left margin.
3038
3039 -fdiagnostics-minimum-margin-width=width
3040 This option controls the minimum width of the left margin printed
3041 by -fdiagnostics-show-line-numbers. It defaults to 6.
3042
3043 -fdiagnostics-parseable-fixits
3044 Emit fix-it hints in a machine-parseable format, suitable for
3045 consumption by IDEs. For each fix-it, a line will be printed after
3046 the relevant diagnostic, starting with the string "fix-it:". For
3047 example:
3048
3049 fix-it:"test.c":{45:3-45:21}:"gtk_widget_show_all"
3050
3051 The location is expressed as a half-open range, expressed as a
3052 count of bytes, starting at byte 1 for the initial column. In the
3053 above example, bytes 3 through 20 of line 45 of "test.c" are to be
3054 replaced with the given string:
3055
3056 00000000011111111112222222222
3057 12345678901234567890123456789
3058 gtk_widget_showall (dlg);
3059 ^^^^^^^^^^^^^^^^^^
3060 gtk_widget_show_all
3061
3062 The filename and replacement string escape backslash as "\\", tab
3063 as "\t", newline as "\n", double quotes as "\"", non-printable
3064 characters as octal (e.g. vertical tab as "\013").
3065
3066 An empty replacement string indicates that the given range is to be
3067 removed. An empty range (e.g. "45:3-45:3") indicates that the
3068 string is to be inserted at the given position.
3069
3070 -fdiagnostics-generate-patch
3071 Print fix-it hints to stderr in unified diff format, after any
3072 diagnostics are printed. For example:
3073
3074 --- test.c
3075 +++ test.c
3076 @ -42,5 +42,5 @
3077
3078 void show_cb(GtkDialog *dlg)
3079 {
3080 - gtk_widget_showall(dlg);
3081 + gtk_widget_show_all(dlg);
3082 }
3083
3084 The diff may or may not be colorized, following the same rules as
3085 for diagnostics (see -fdiagnostics-color).
3086
3087 -fdiagnostics-show-template-tree
3088 In the C++ frontend, when printing diagnostics showing mismatching
3089 template types, such as:
3090
3091 could not convert 'std::map<int, std::vector<double> >()'
3092 from 'map<[...],vector<double>>' to 'map<[...],vector<float>>
3093
3094 the -fdiagnostics-show-template-tree flag enables printing a tree-
3095 like structure showing the common and differing parts of the types,
3096 such as:
3097
3098 map<
3099 [...],
3100 vector<
3101 [double != float]>>
3102
3103 The parts that differ are highlighted with color ("double" and
3104 "float" in this case).
3105
3106 -fno-elide-type
3107 By default when the C++ frontend prints diagnostics showing
3108 mismatching template types, common parts of the types are printed
3109 as "[...]" to simplify the error message. For example:
3110
3111 could not convert 'std::map<int, std::vector<double> >()'
3112 from 'map<[...],vector<double>>' to 'map<[...],vector<float>>
3113
3114 Specifying the -fno-elide-type flag suppresses that behavior. This
3115 flag also affects the output of the
3116 -fdiagnostics-show-template-tree flag.
3117
3118 -fno-show-column
3119 Do not print column numbers in diagnostics. This may be necessary
3120 if diagnostics are being scanned by a program that does not
3121 understand the column numbers, such as dejagnu.
3122
3123 -fdiagnostics-format=FORMAT
3124 Select a different format for printing diagnostics. FORMAT is text
3125 or json. The default is text.
3126
3127 The json format consists of a top-level JSON array containing JSON
3128 objects representing the diagnostics.
3129
3130 The JSON is emitted as one line, without formatting; the examples
3131 below have been formatted for clarity.
3132
3133 Diagnostics can have child diagnostics. For example, this error
3134 and note:
3135
3136 misleading-indentation.c:15:3: warning: this 'if' clause does not
3137 guard... [-Wmisleading-indentation]
3138 15 | if (flag)
3139 | ^~
3140 misleading-indentation.c:17:5: note: ...this statement, but the latter
3141 is misleadingly indented as if it were guarded by the 'if'
3142 17 | y = 2;
3143 | ^
3144
3145 might be printed in JSON form (after formatting) like this:
3146
3147 [
3148 {
3149 "kind": "warning",
3150 "locations": [
3151 {
3152 "caret": {
3153 "column": 3,
3154 "file": "misleading-indentation.c",
3155 "line": 15
3156 },
3157 "finish": {
3158 "column": 4,
3159 "file": "misleading-indentation.c",
3160 "line": 15
3161 }
3162 }
3163 ],
3164 "message": "this \u2018if\u2019 clause does not guard...",
3165 "option": "-Wmisleading-indentation",
3166 "children": [
3167 {
3168 "kind": "note",
3169 "locations": [
3170 {
3171 "caret": {
3172 "column": 5,
3173 "file": "misleading-indentation.c",
3174 "line": 17
3175 }
3176 }
3177 ],
3178 "message": "...this statement, but the latter is ..."
3179 }
3180 ]
3181 },
3182 ...
3183 ]
3184
3185 where the "note" is a child of the "warning".
3186
3187 A diagnostic has a "kind". If this is "warning", then there is an
3188 "option" key describing the command-line option controlling the
3189 warning.
3190
3191 A diagnostic can contain zero or more locations. Each location has
3192 up to three positions within it: a "caret" position and optional
3193 "start" and "finish" positions. A location can also have an
3194 optional "label" string. For example, this error:
3195
3196 bad-binary-ops.c:64:23: error: invalid operands to binary + (have 'S' {aka
3197 'struct s'} and 'T' {aka 'struct t'})
3198 64 | return callee_4a () + callee_4b ();
3199 | ~~~~~~~~~~~~ ^ ~~~~~~~~~~~~
3200 | | |
3201 | | T {aka struct t}
3202 | S {aka struct s}
3203
3204 has three locations. Its primary location is at the "+" token at
3205 column 23. It has two secondary locations, describing the left and
3206 right-hand sides of the expression, which have labels. It might be
3207 printed in JSON form as:
3208
3209 {
3210 "children": [],
3211 "kind": "error",
3212 "locations": [
3213 {
3214 "caret": {
3215 "column": 23, "file": "bad-binary-ops.c", "line": 64
3216 }
3217 },
3218 {
3219 "caret": {
3220 "column": 10, "file": "bad-binary-ops.c", "line": 64
3221 },
3222 "finish": {
3223 "column": 21, "file": "bad-binary-ops.c", "line": 64
3224 },
3225 "label": "S {aka struct s}"
3226 },
3227 {
3228 "caret": {
3229 "column": 25, "file": "bad-binary-ops.c", "line": 64
3230 },
3231 "finish": {
3232 "column": 36, "file": "bad-binary-ops.c", "line": 64
3233 },
3234 "label": "T {aka struct t}"
3235 }
3236 ],
3237 "message": "invalid operands to binary + ..."
3238 }
3239
3240 If a diagnostic contains fix-it hints, it has a "fixits" array,
3241 consisting of half-open intervals, similar to the output of
3242 -fdiagnostics-parseable-fixits. For example, this diagnostic with
3243 a replacement fix-it hint:
3244
3245 demo.c:8:15: error: 'struct s' has no member named 'colour'; did you
3246 mean 'color'?
3247 8 | return ptr->colour;
3248 | ^~~~~~
3249 | color
3250
3251 might be printed in JSON form as:
3252
3253 {
3254 "children": [],
3255 "fixits": [
3256 {
3257 "next": {
3258 "column": 21,
3259 "file": "demo.c",
3260 "line": 8
3261 },
3262 "start": {
3263 "column": 15,
3264 "file": "demo.c",
3265 "line": 8
3266 },
3267 "string": "color"
3268 }
3269 ],
3270 "kind": "error",
3271 "locations": [
3272 {
3273 "caret": {
3274 "column": 15,
3275 "file": "demo.c",
3276 "line": 8
3277 },
3278 "finish": {
3279 "column": 20,
3280 "file": "demo.c",
3281 "line": 8
3282 }
3283 }
3284 ],
3285 "message": "\u2018struct s\u2019 has no member named ..."
3286 }
3287
3288 where the fix-it hint suggests replacing the text from "start" up
3289 to but not including "next" with "string"'s value. Deletions are
3290 expressed via an empty value for "string", insertions by having
3291 "start" equal "next".
3292
3293 Options to Request or Suppress Warnings
3294 Warnings are diagnostic messages that report constructions that are not
3295 inherently erroneous but that are risky or suggest there may have been
3296 an error.
3297
3298 The following language-independent options do not enable specific
3299 warnings but control the kinds of diagnostics produced by GCC.
3300
3301 -fsyntax-only
3302 Check the code for syntax errors, but don't do anything beyond
3303 that.
3304
3305 -fmax-errors=n
3306 Limits the maximum number of error messages to n, at which point
3307 GCC bails out rather than attempting to continue processing the
3308 source code. If n is 0 (the default), there is no limit on the
3309 number of error messages produced. If -Wfatal-errors is also
3310 specified, then -Wfatal-errors takes precedence over this option.
3311
3312 -w Inhibit all warning messages.
3313
3314 -Werror
3315 Make all warnings into errors.
3316
3317 -Werror=
3318 Make the specified warning into an error. The specifier for a
3319 warning is appended; for example -Werror=switch turns the warnings
3320 controlled by -Wswitch into errors. This switch takes a negative
3321 form, to be used to negate -Werror for specific warnings; for
3322 example -Wno-error=switch makes -Wswitch warnings not be errors,
3323 even when -Werror is in effect.
3324
3325 The warning message for each controllable warning includes the
3326 option that controls the warning. That option can then be used
3327 with -Werror= and -Wno-error= as described above. (Printing of the
3328 option in the warning message can be disabled using the
3329 -fno-diagnostics-show-option flag.)
3330
3331 Note that specifying -Werror=foo automatically implies -Wfoo.
3332 However, -Wno-error=foo does not imply anything.
3333
3334 -Wfatal-errors
3335 This option causes the compiler to abort compilation on the first
3336 error occurred rather than trying to keep going and printing
3337 further error messages.
3338
3339 You can request many specific warnings with options beginning with -W,
3340 for example -Wimplicit to request warnings on implicit declarations.
3341 Each of these specific warning options also has a negative form
3342 beginning -Wno- to turn off warnings; for example, -Wno-implicit. This
3343 manual lists only one of the two forms, whichever is not the default.
3344 For further language-specific options also refer to C++ Dialect Options
3345 and Objective-C and Objective-C++ Dialect Options.
3346
3347 Some options, such as -Wall and -Wextra, turn on other options, such as
3348 -Wunused, which may turn on further options, such as -Wunused-value.
3349 The combined effect of positive and negative forms is that more
3350 specific options have priority over less specific ones, independently
3351 of their position in the command-line. For options of the same
3352 specificity, the last one takes effect. Options enabled or disabled via
3353 pragmas take effect as if they appeared at the end of the command-line.
3354
3355 When an unrecognized warning option is requested (e.g.,
3356 -Wunknown-warning), GCC emits a diagnostic stating that the option is
3357 not recognized. However, if the -Wno- form is used, the behavior is
3358 slightly different: no diagnostic is produced for -Wno-unknown-warning
3359 unless other diagnostics are being produced. This allows the use of
3360 new -Wno- options with old compilers, but if something goes wrong, the
3361 compiler warns that an unrecognized option is present.
3362
3363 -Wpedantic
3364 -pedantic
3365 Issue all the warnings demanded by strict ISO C and ISO C++; reject
3366 all programs that use forbidden extensions, and some other programs
3367 that do not follow ISO C and ISO C++. For ISO C, follows the
3368 version of the ISO C standard specified by any -std option used.
3369
3370 Valid ISO C and ISO C++ programs should compile properly with or
3371 without this option (though a rare few require -ansi or a -std
3372 option specifying the required version of ISO C). However, without
3373 this option, certain GNU extensions and traditional C and C++
3374 features are supported as well. With this option, they are
3375 rejected.
3376
3377 -Wpedantic does not cause warning messages for use of the alternate
3378 keywords whose names begin and end with __. Pedantic warnings are
3379 also disabled in the expression that follows "__extension__".
3380 However, only system header files should use these escape routes;
3381 application programs should avoid them.
3382
3383 Some users try to use -Wpedantic to check programs for strict ISO C
3384 conformance. They soon find that it does not do quite what they
3385 want: it finds some non-ISO practices, but not all---only those for
3386 which ISO C requires a diagnostic, and some others for which
3387 diagnostics have been added.
3388
3389 A feature to report any failure to conform to ISO C might be useful
3390 in some instances, but would require considerable additional work
3391 and would be quite different from -Wpedantic. We don't have plans
3392 to support such a feature in the near future.
3393
3394 Where the standard specified with -std represents a GNU extended
3395 dialect of C, such as gnu90 or gnu99, there is a corresponding base
3396 standard, the version of ISO C on which the GNU extended dialect is
3397 based. Warnings from -Wpedantic are given where they are required
3398 by the base standard. (It does not make sense for such warnings to
3399 be given only for features not in the specified GNU C dialect,
3400 since by definition the GNU dialects of C include all features the
3401 compiler supports with the given option, and there would be nothing
3402 to warn about.)
3403
3404 -pedantic-errors
3405 Give an error whenever the base standard (see -Wpedantic) requires
3406 a diagnostic, in some cases where there is undefined behavior at
3407 compile-time and in some other cases that do not prevent
3408 compilation of programs that are valid according to the standard.
3409 This is not equivalent to -Werror=pedantic, since there are errors
3410 enabled by this option and not enabled by the latter and vice
3411 versa.
3412
3413 -Wall
3414 This enables all the warnings about constructions that some users
3415 consider questionable, and that are easy to avoid (or modify to
3416 prevent the warning), even in conjunction with macros. This also
3417 enables some language-specific warnings described in C++ Dialect
3418 Options and Objective-C and Objective-C++ Dialect Options.
3419
3420 -Wall turns on the following warning flags:
3421
3422 -Waddress -Warray-bounds=1 (only with -O2) -Wbool-compare
3423 -Wbool-operation -Wc++11-compat -Wc++14-compat -Wcatch-value (C++
3424 and Objective-C++ only) -Wchar-subscripts -Wcomment
3425 -Wduplicate-decl-specifier (C and Objective-C only) -Wenum-compare
3426 (in C/ObjC; this is on by default in C++) -Wformat
3427 -Wint-in-bool-context -Wimplicit (C and Objective-C only)
3428 -Wimplicit-int (C and Objective-C only)
3429 -Wimplicit-function-declaration (C and Objective-C only)
3430 -Winit-self (only for C++) -Wlogical-not-parentheses -Wmain (only
3431 for C/ObjC and unless -ffreestanding) -Wmaybe-uninitialized
3432 -Wmemset-elt-size -Wmemset-transposed-args -Wmisleading-indentation
3433 (only for C/C++) -Wmissing-attributes -Wmissing-braces (only for
3434 C/ObjC) -Wmultistatement-macros -Wnarrowing (only for C++)
3435 -Wnonnull -Wnonnull-compare -Wopenmp-simd -Wparentheses
3436 -Wpessimizing-move (only for C++) -Wpointer-sign -Wreorder
3437 -Wrestrict -Wreturn-type -Wsequence-point -Wsign-compare (only in
3438 C++) -Wsizeof-pointer-div -Wsizeof-pointer-memaccess
3439 -Wstrict-aliasing -Wstrict-overflow=1 -Wswitch
3440 -Wtautological-compare -Wtrigraphs -Wuninitialized
3441 -Wunknown-pragmas -Wunused-function -Wunused-label -Wunused-value
3442 -Wunused-variable -Wvolatile-register-var
3443
3444 Note that some warning flags are not implied by -Wall. Some of
3445 them warn about constructions that users generally do not consider
3446 questionable, but which occasionally you might wish to check for;
3447 others warn about constructions that are necessary or hard to avoid
3448 in some cases, and there is no simple way to modify the code to
3449 suppress the warning. Some of them are enabled by -Wextra but many
3450 of them must be enabled individually.
3451
3452 -Wextra
3453 This enables some extra warning flags that are not enabled by
3454 -Wall. (This option used to be called -W. The older name is still
3455 supported, but the newer name is more descriptive.)
3456
3457 -Wclobbered -Wcast-function-type -Wdeprecated-copy (C++ only)
3458 -Wempty-body -Wignored-qualifiers -Wimplicit-fallthrough=3
3459 -Wmissing-field-initializers -Wmissing-parameter-type (C only)
3460 -Wold-style-declaration (C only) -Woverride-init -Wsign-compare (C
3461 only) -Wredundant-move (only for C++) -Wtype-limits -Wuninitialized
3462 -Wshift-negative-value (in C++03 and in C99 and newer)
3463 -Wunused-parameter (only with -Wunused or -Wall)
3464 -Wunused-but-set-parameter (only with -Wunused or -Wall)
3465
3466 The option -Wextra also prints warning messages for the following
3467 cases:
3468
3469 * A pointer is compared against integer zero with "<", "<=", ">",
3470 or ">=".
3471
3472 * (C++ only) An enumerator and a non-enumerator both appear in a
3473 conditional expression.
3474
3475 * (C++ only) Ambiguous virtual bases.
3476
3477 * (C++ only) Subscripting an array that has been declared
3478 "register".
3479
3480 * (C++ only) Taking the address of a variable that has been
3481 declared "register".
3482
3483 * (C++ only) A base class is not initialized in the copy
3484 constructor of a derived class.
3485
3486 -Wchar-subscripts
3487 Warn if an array subscript has type "char". This is a common cause
3488 of error, as programmers often forget that this type is signed on
3489 some machines. This warning is enabled by -Wall.
3490
3491 -Wno-coverage-mismatch
3492 Warn if feedback profiles do not match when using the -fprofile-use
3493 option. If a source file is changed between compiling with
3494 -fprofile-generate and with -fprofile-use, the files with the
3495 profile feedback can fail to match the source file and GCC cannot
3496 use the profile feedback information. By default, this warning is
3497 enabled and is treated as an error. -Wno-coverage-mismatch can be
3498 used to disable the warning or -Wno-error=coverage-mismatch can be
3499 used to disable the error. Disabling the error for this warning
3500 can result in poorly optimized code and is useful only in the case
3501 of very minor changes such as bug fixes to an existing code-base.
3502 Completely disabling the warning is not recommended.
3503
3504 -Wno-cpp
3505 (C, Objective-C, C++, Objective-C++ and Fortran only)
3506
3507 Suppress warning messages emitted by "#warning" directives.
3508
3509 -Wdouble-promotion (C, C++, Objective-C and Objective-C++ only)
3510 Give a warning when a value of type "float" is implicitly promoted
3511 to "double". CPUs with a 32-bit "single-precision" floating-point
3512 unit implement "float" in hardware, but emulate "double" in
3513 software. On such a machine, doing computations using "double"
3514 values is much more expensive because of the overhead required for
3515 software emulation.
3516
3517 It is easy to accidentally do computations with "double" because
3518 floating-point literals are implicitly of type "double". For
3519 example, in:
3520
3521 float area(float radius)
3522 {
3523 return 3.14159 * radius * radius;
3524 }
3525
3526 the compiler performs the entire computation with "double" because
3527 the floating-point literal is a "double".
3528
3529 -Wduplicate-decl-specifier (C and Objective-C only)
3530 Warn if a declaration has duplicate "const", "volatile", "restrict"
3531 or "_Atomic" specifier. This warning is enabled by -Wall.
3532
3533 -Wformat
3534 -Wformat=n
3535 Check calls to "printf" and "scanf", etc., to make sure that the
3536 arguments supplied have types appropriate to the format string
3537 specified, and that the conversions specified in the format string
3538 make sense. This includes standard functions, and others specified
3539 by format attributes, in the "printf", "scanf", "strftime" and
3540 "strfmon" (an X/Open extension, not in the C standard) families (or
3541 other target-specific families). Which functions are checked
3542 without format attributes having been specified depends on the
3543 standard version selected, and such checks of functions without the
3544 attribute specified are disabled by -ffreestanding or -fno-builtin.
3545
3546 The formats are checked against the format features supported by
3547 GNU libc version 2.2. These include all ISO C90 and C99 features,
3548 as well as features from the Single Unix Specification and some BSD
3549 and GNU extensions. Other library implementations may not support
3550 all these features; GCC does not support warning about features
3551 that go beyond a particular library's limitations. However, if
3552 -Wpedantic is used with -Wformat, warnings are given about format
3553 features not in the selected standard version (but not for
3554 "strfmon" formats, since those are not in any version of the C
3555 standard).
3556
3557 -Wformat=1
3558 -Wformat
3559 Option -Wformat is equivalent to -Wformat=1, and -Wno-format is
3560 equivalent to -Wformat=0. Since -Wformat also checks for null
3561 format arguments for several functions, -Wformat also implies
3562 -Wnonnull. Some aspects of this level of format checking can
3563 be disabled by the options: -Wno-format-contains-nul,
3564 -Wno-format-extra-args, and -Wno-format-zero-length. -Wformat
3565 is enabled by -Wall.
3566
3567 -Wno-format-contains-nul
3568 If -Wformat is specified, do not warn about format strings that
3569 contain NUL bytes.
3570
3571 -Wno-format-extra-args
3572 If -Wformat is specified, do not warn about excess arguments to
3573 a "printf" or "scanf" format function. The C standard
3574 specifies that such arguments are ignored.
3575
3576 Where the unused arguments lie between used arguments that are
3577 specified with $ operand number specifications, normally
3578 warnings are still given, since the implementation could not
3579 know what type to pass to "va_arg" to skip the unused
3580 arguments. However, in the case of "scanf" formats, this
3581 option suppresses the warning if the unused arguments are all
3582 pointers, since the Single Unix Specification says that such
3583 unused arguments are allowed.
3584
3585 -Wformat-overflow
3586 -Wformat-overflow=level
3587 Warn about calls to formatted input/output functions such as
3588 "sprintf" and "vsprintf" that might overflow the destination
3589 buffer. When the exact number of bytes written by a format
3590 directive cannot be determined at compile-time it is estimated
3591 based on heuristics that depend on the level argument and on
3592 optimization. While enabling optimization will in most cases
3593 improve the accuracy of the warning, it may also result in
3594 false positives.
3595
3596 -Wformat-overflow
3597 -Wformat-overflow=1
3598 Level 1 of -Wformat-overflow enabled by -Wformat employs a
3599 conservative approach that warns only about calls that most
3600 likely overflow the buffer. At this level, numeric
3601 arguments to format directives with unknown values are
3602 assumed to have the value of one, and strings of unknown
3603 length to be empty. Numeric arguments that are known to be
3604 bounded to a subrange of their type, or string arguments
3605 whose output is bounded either by their directive's
3606 precision or by a finite set of string literals, are
3607 assumed to take on the value within the range that results
3608 in the most bytes on output. For example, the call to
3609 "sprintf" below is diagnosed because even with both a and b
3610 equal to zero, the terminating NUL character ('\0')
3611 appended by the function to the destination buffer will be
3612 written past its end. Increasing the size of the buffer by
3613 a single byte is sufficient to avoid the warning, though it
3614 may not be sufficient to avoid the overflow.
3615
3616 void f (int a, int b)
3617 {
3618 char buf [13];
3619 sprintf (buf, "a = %i, b = %i\n", a, b);
3620 }
3621
3622 -Wformat-overflow=2
3623 Level 2 warns also about calls that might overflow the
3624 destination buffer given an argument of sufficient length
3625 or magnitude. At level 2, unknown numeric arguments are
3626 assumed to have the minimum representable value for signed
3627 types with a precision greater than 1, and the maximum
3628 representable value otherwise. Unknown string arguments
3629 whose length cannot be assumed to be bounded either by the
3630 directive's precision, or by a finite set of string
3631 literals they may evaluate to, or the character array they
3632 may point to, are assumed to be 1 character long.
3633
3634 At level 2, the call in the example above is again
3635 diagnosed, but this time because with a equal to a 32-bit
3636 "INT_MIN" the first %i directive will write some of its
3637 digits beyond the end of the destination buffer. To make
3638 the call safe regardless of the values of the two
3639 variables, the size of the destination buffer must be
3640 increased to at least 34 bytes. GCC includes the minimum
3641 size of the buffer in an informational note following the
3642 warning.
3643
3644 An alternative to increasing the size of the destination
3645 buffer is to constrain the range of formatted values. The
3646 maximum length of string arguments can be bounded by
3647 specifying the precision in the format directive. When
3648 numeric arguments of format directives can be assumed to be
3649 bounded by less than the precision of their type, choosing
3650 an appropriate length modifier to the format specifier will
3651 reduce the required buffer size. For example, if a and b
3652 in the example above can be assumed to be within the
3653 precision of the "short int" type then using either the %hi
3654 format directive or casting the argument to "short" reduces
3655 the maximum required size of the buffer to 24 bytes.
3656
3657 void f (int a, int b)
3658 {
3659 char buf [23];
3660 sprintf (buf, "a = %hi, b = %i\n", a, (short)b);
3661 }
3662
3663 -Wno-format-zero-length
3664 If -Wformat is specified, do not warn about zero-length
3665 formats. The C standard specifies that zero-length formats are
3666 allowed.
3667
3668 -Wformat=2
3669 Enable -Wformat plus additional format checks. Currently
3670 equivalent to -Wformat -Wformat-nonliteral -Wformat-security
3671 -Wformat-y2k.
3672
3673 -Wformat-nonliteral
3674 If -Wformat is specified, also warn if the format string is not
3675 a string literal and so cannot be checked, unless the format
3676 function takes its format arguments as a "va_list".
3677
3678 -Wformat-security
3679 If -Wformat is specified, also warn about uses of format
3680 functions that represent possible security problems. At
3681 present, this warns about calls to "printf" and "scanf"
3682 functions where the format string is not a string literal and
3683 there are no format arguments, as in "printf (foo);". This may
3684 be a security hole if the format string came from untrusted
3685 input and contains %n. (This is currently a subset of what
3686 -Wformat-nonliteral warns about, but in future warnings may be
3687 added to -Wformat-security that are not included in
3688 -Wformat-nonliteral.)
3689
3690 -Wformat-signedness
3691 If -Wformat is specified, also warn if the format string
3692 requires an unsigned argument and the argument is signed and
3693 vice versa.
3694
3695 -Wformat-truncation
3696 -Wformat-truncation=level
3697 Warn about calls to formatted input/output functions such as
3698 "snprintf" and "vsnprintf" that might result in output
3699 truncation. When the exact number of bytes written by a format
3700 directive cannot be determined at compile-time it is estimated
3701 based on heuristics that depend on the level argument and on
3702 optimization. While enabling optimization will in most cases
3703 improve the accuracy of the warning, it may also result in
3704 false positives. Except as noted otherwise, the option uses
3705 the same logic -Wformat-overflow.
3706
3707 -Wformat-truncation
3708 -Wformat-truncation=1
3709 Level 1 of -Wformat-truncation enabled by -Wformat employs
3710 a conservative approach that warns only about calls to
3711 bounded functions whose return value is unused and that
3712 will most likely result in output truncation.
3713
3714 -Wformat-truncation=2
3715 Level 2 warns also about calls to bounded functions whose
3716 return value is used and that might result in truncation
3717 given an argument of sufficient length or magnitude.
3718
3719 -Wformat-y2k
3720 If -Wformat is specified, also warn about "strftime" formats
3721 that may yield only a two-digit year.
3722
3723 -Wnonnull
3724 Warn about passing a null pointer for arguments marked as requiring
3725 a non-null value by the "nonnull" function attribute.
3726
3727 -Wnonnull is included in -Wall and -Wformat. It can be disabled
3728 with the -Wno-nonnull option.
3729
3730 -Wnonnull-compare
3731 Warn when comparing an argument marked with the "nonnull" function
3732 attribute against null inside the function.
3733
3734 -Wnonnull-compare is included in -Wall. It can be disabled with
3735 the -Wno-nonnull-compare option.
3736
3737 -Wnull-dereference
3738 Warn if the compiler detects paths that trigger erroneous or
3739 undefined behavior due to dereferencing a null pointer. This
3740 option is only active when -fdelete-null-pointer-checks is active,
3741 which is enabled by optimizations in most targets. The precision
3742 of the warnings depends on the optimization options used.
3743
3744 -Winit-self (C, C++, Objective-C and Objective-C++ only)
3745 Warn about uninitialized variables that are initialized with
3746 themselves. Note this option can only be used with the
3747 -Wuninitialized option.
3748
3749 For example, GCC warns about "i" being uninitialized in the
3750 following snippet only when -Winit-self has been specified:
3751
3752 int f()
3753 {
3754 int i = i;
3755 return i;
3756 }
3757
3758 This warning is enabled by -Wall in C++.
3759
3760 -Wimplicit-int (C and Objective-C only)
3761 Warn when a declaration does not specify a type. This warning is
3762 enabled by -Wall.
3763
3764 -Wimplicit-function-declaration (C and Objective-C only)
3765 Give a warning whenever a function is used before being declared.
3766 In C99 mode (-std=c99 or -std=gnu99), this warning is enabled by
3767 default and it is made into an error by -pedantic-errors. This
3768 warning is also enabled by -Wall.
3769
3770 -Wimplicit (C and Objective-C only)
3771 Same as -Wimplicit-int and -Wimplicit-function-declaration. This
3772 warning is enabled by -Wall.
3773
3774 -Wimplicit-fallthrough
3775 -Wimplicit-fallthrough is the same as -Wimplicit-fallthrough=3 and
3776 -Wno-implicit-fallthrough is the same as -Wimplicit-fallthrough=0.
3777
3778 -Wimplicit-fallthrough=n
3779 Warn when a switch case falls through. For example:
3780
3781 switch (cond)
3782 {
3783 case 1:
3784 a = 1;
3785 break;
3786 case 2:
3787 a = 2;
3788 case 3:
3789 a = 3;
3790 break;
3791 }
3792
3793 This warning does not warn when the last statement of a case cannot
3794 fall through, e.g. when there is a return statement or a call to
3795 function declared with the noreturn attribute.
3796 -Wimplicit-fallthrough= also takes into account control flow
3797 statements, such as ifs, and only warns when appropriate. E.g.
3798
3799 switch (cond)
3800 {
3801 case 1:
3802 if (i > 3) {
3803 bar (5);
3804 break;
3805 } else if (i < 1) {
3806 bar (0);
3807 } else
3808 return;
3809 default:
3810 ...
3811 }
3812
3813 Since there are occasions where a switch case fall through is
3814 desirable, GCC provides an attribute, "__attribute__
3815 ((fallthrough))", that is to be used along with a null statement to
3816 suppress this warning that would normally occur:
3817
3818 switch (cond)
3819 {
3820 case 1:
3821 bar (0);
3822 __attribute__ ((fallthrough));
3823 default:
3824 ...
3825 }
3826
3827 C++17 provides a standard way to suppress the
3828 -Wimplicit-fallthrough warning using "[[fallthrough]];" instead of
3829 the GNU attribute. In C++11 or C++14 users can use
3830 "[[gnu::fallthrough]];", which is a GNU extension. Instead of
3831 these attributes, it is also possible to add a fallthrough comment
3832 to silence the warning. The whole body of the C or C++ style
3833 comment should match the given regular expressions listed below.
3834 The option argument n specifies what kind of comments are accepted:
3835
3836 *<-Wimplicit-fallthrough=0 disables the warning altogether.>
3837 *<-Wimplicit-fallthrough=1 matches ".*" regular>
3838 expression, any comment is used as fallthrough comment.
3839
3840 *<-Wimplicit-fallthrough=2 case insensitively matches>
3841 ".*falls?[ \t-]*thr(ough|u).*" regular expression.
3842
3843 *<-Wimplicit-fallthrough=3 case sensitively matches one of the>
3844 following regular expressions:
3845
3846 *<"-fallthrough">
3847 *<"@fallthrough@">
3848 *<"lint -fallthrough[ \t]*">
3849 *<"[ \t.!]*(ELSE,? |INTENTIONAL(LY)? )?FALL(S |
3850 |-)?THR(OUGH|U)[ \t.!]*(-[^\n\r]*)?">
3851 *<"[ \t.!]*(Else,? |Intentional(ly)? )?Fall((s |
3852 |-)[Tt]|t)hr(ough|u)[ \t.!]*(-[^\n\r]*)?">
3853 *<"[ \t.!]*([Ee]lse,? |[Ii]ntentional(ly)? )?fall(s |
3854 |-)?thr(ough|u)[ \t.!]*(-[^\n\r]*)?">
3855 *<-Wimplicit-fallthrough=4 case sensitively matches one of the>
3856 following regular expressions:
3857
3858 *<"-fallthrough">
3859 *<"@fallthrough@">
3860 *<"lint -fallthrough[ \t]*">
3861 *<"[ \t]*FALLTHR(OUGH|U)[ \t]*">
3862 *<-Wimplicit-fallthrough=5 doesn't recognize any comments as>
3863 fallthrough comments, only attributes disable the warning.
3864
3865 The comment needs to be followed after optional whitespace and
3866 other comments by "case" or "default" keywords or by a user label
3867 that precedes some "case" or "default" label.
3868
3869 switch (cond)
3870 {
3871 case 1:
3872 bar (0);
3873 /* FALLTHRU */
3874 default:
3875 ...
3876 }
3877
3878 The -Wimplicit-fallthrough=3 warning is enabled by -Wextra.
3879
3880 -Wif-not-aligned (C, C++, Objective-C and Objective-C++ only)
3881 Control if warning triggered by the "warn_if_not_aligned" attribute
3882 should be issued. This is enabled by default. Use
3883 -Wno-if-not-aligned to disable it.
3884
3885 -Wignored-qualifiers (C and C++ only)
3886 Warn if the return type of a function has a type qualifier such as
3887 "const". For ISO C such a type qualifier has no effect, since the
3888 value returned by a function is not an lvalue. For C++, the
3889 warning is only emitted for scalar types or "void". ISO C
3890 prohibits qualified "void" return types on function definitions, so
3891 such return types always receive a warning even without this
3892 option.
3893
3894 This warning is also enabled by -Wextra.
3895
3896 -Wignored-attributes (C and C++ only)
3897 Warn when an attribute is ignored. This is different from the
3898 -Wattributes option in that it warns whenever the compiler decides
3899 to drop an attribute, not that the attribute is either unknown,
3900 used in a wrong place, etc. This warning is enabled by default.
3901
3902 -Wmain
3903 Warn if the type of "main" is suspicious. "main" should be a
3904 function with external linkage, returning int, taking either zero
3905 arguments, two, or three arguments of appropriate types. This
3906 warning is enabled by default in C++ and is enabled by either -Wall
3907 or -Wpedantic.
3908
3909 -Wmisleading-indentation (C and C++ only)
3910 Warn when the indentation of the code does not reflect the block
3911 structure. Specifically, a warning is issued for "if", "else",
3912 "while", and "for" clauses with a guarded statement that does not
3913 use braces, followed by an unguarded statement with the same
3914 indentation.
3915
3916 In the following example, the call to "bar" is misleadingly
3917 indented as if it were guarded by the "if" conditional.
3918
3919 if (some_condition ())
3920 foo ();
3921 bar (); /* Gotcha: this is not guarded by the "if". */
3922
3923 In the case of mixed tabs and spaces, the warning uses the
3924 -ftabstop= option to determine if the statements line up
3925 (defaulting to 8).
3926
3927 The warning is not issued for code involving multiline preprocessor
3928 logic such as the following example.
3929
3930 if (flagA)
3931 foo (0);
3932 #if SOME_CONDITION_THAT_DOES_NOT_HOLD
3933 if (flagB)
3934 #endif
3935 foo (1);
3936
3937 The warning is not issued after a "#line" directive, since this
3938 typically indicates autogenerated code, and no assumptions can be
3939 made about the layout of the file that the directive references.
3940
3941 This warning is enabled by -Wall in C and C++.
3942
3943 -Wmissing-attributes
3944 Warn when a declaration of a function is missing one or more
3945 attributes that a related function is declared with and whose
3946 absence may adversely affect the correctness or efficiency of
3947 generated code. For example, the warning is issued for
3948 declarations of aliases that use attributes to specify less
3949 restrictive requirements than those of their targets. This
3950 typically represents a potential optimization opportunity. By
3951 contrast, the -Wattribute-alias=2 option controls warnings issued
3952 when the alias is more restrictive than the target, which could
3953 lead to incorrect code generation. Attributes considered include
3954 "alloc_align", "alloc_size", "cold", "const", "hot", "leaf",
3955 "malloc", "nonnull", "noreturn", "nothrow", "pure",
3956 "returns_nonnull", and "returns_twice".
3957
3958 In C++, the warning is issued when an explicit specialization of a
3959 primary template declared with attribute "alloc_align",
3960 "alloc_size", "assume_aligned", "format", "format_arg", "malloc",
3961 or "nonnull" is declared without it. Attributes "deprecated",
3962 "error", and "warning" suppress the warning..
3963
3964 You can use the "copy" attribute to apply the same set of
3965 attributes to a declaration as that on another declaration without
3966 explicitly enumerating the attributes. This attribute can be
3967 applied to declarations of functions, variables, or types.
3968
3969 -Wmissing-attributes is enabled by -Wall.
3970
3971 For example, since the declaration of the primary function template
3972 below makes use of both attribute "malloc" and "alloc_size" the
3973 declaration of the explicit specialization of the template is
3974 diagnosed because it is missing one of the attributes.
3975
3976 template <class T>
3977 T* __attribute__ ((malloc, alloc_size (1)))
3978 allocate (size_t);
3979
3980 template <>
3981 void* __attribute__ ((malloc)) // missing alloc_size
3982 allocate<void> (size_t);
3983
3984 -Wmissing-braces
3985 Warn if an aggregate or union initializer is not fully bracketed.
3986 In the following example, the initializer for "a" is not fully
3987 bracketed, but that for "b" is fully bracketed. This warning is
3988 enabled by -Wall in C.
3989
3990 int a[2][2] = { 0, 1, 2, 3 };
3991 int b[2][2] = { { 0, 1 }, { 2, 3 } };
3992
3993 This warning is enabled by -Wall.
3994
3995 -Wmissing-include-dirs (C, C++, Objective-C and Objective-C++ only)
3996 Warn if a user-supplied include directory does not exist.
3997
3998 -Wmissing-profile
3999 Warn if feedback profiles are missing when using the -fprofile-use
4000 option. This option diagnoses those cases where a new function or
4001 a new file is added to the user code between compiling with
4002 -fprofile-generate and with -fprofile-use, without regenerating the
4003 profiles. In these cases, the profile feedback data files do not
4004 contain any profile feedback information for the newly added
4005 function or file respectively. Also, in the case when profile
4006 count data (.gcda) files are removed, GCC cannot use any profile
4007 feedback information. In all these cases, warnings are issued to
4008 inform the user that a profile generation step is due.
4009 -Wno-missing-profile can be used to disable the warning. Ignoring
4010 the warning can result in poorly optimized code. Completely
4011 disabling the warning is not recommended and should be done only
4012 when non-existent profile data is justified.
4013
4014 -Wmultistatement-macros
4015 Warn about unsafe multiple statement macros that appear to be
4016 guarded by a clause such as "if", "else", "for", "switch", or
4017 "while", in which only the first statement is actually guarded
4018 after the macro is expanded.
4019
4020 For example:
4021
4022 #define DOIT x++; y++
4023 if (c)
4024 DOIT;
4025
4026 will increment "y" unconditionally, not just when "c" holds. The
4027 can usually be fixed by wrapping the macro in a do-while loop:
4028
4029 #define DOIT do { x++; y++; } while (0)
4030 if (c)
4031 DOIT;
4032
4033 This warning is enabled by -Wall in C and C++.
4034
4035 -Wparentheses
4036 Warn if parentheses are omitted in certain contexts, such as when
4037 there is an assignment in a context where a truth value is
4038 expected, or when operators are nested whose precedence people
4039 often get confused about.
4040
4041 Also warn if a comparison like "x<=y<=z" appears; this is
4042 equivalent to "(x<=y ? 1 : 0) <= z", which is a different
4043 interpretation from that of ordinary mathematical notation.
4044
4045 Also warn for dangerous uses of the GNU extension to "?:" with
4046 omitted middle operand. When the condition in the "?": operator is
4047 a boolean expression, the omitted value is always 1. Often
4048 programmers expect it to be a value computed inside the conditional
4049 expression instead.
4050
4051 For C++ this also warns for some cases of unnecessary parentheses
4052 in declarations, which can indicate an attempt at a function call
4053 instead of a declaration:
4054
4055 {
4056 // Declares a local variable called mymutex.
4057 std::unique_lock<std::mutex> (mymutex);
4058 // User meant std::unique_lock<std::mutex> lock (mymutex);
4059 }
4060
4061 This warning is enabled by -Wall.
4062
4063 -Wsequence-point
4064 Warn about code that may have undefined semantics because of
4065 violations of sequence point rules in the C and C++ standards.
4066
4067 The C and C++ standards define the order in which expressions in a
4068 C/C++ program are evaluated in terms of sequence points, which
4069 represent a partial ordering between the execution of parts of the
4070 program: those executed before the sequence point, and those
4071 executed after it. These occur after the evaluation of a full
4072 expression (one which is not part of a larger expression), after
4073 the evaluation of the first operand of a "&&", "||", "? :" or ","
4074 (comma) operator, before a function is called (but after the
4075 evaluation of its arguments and the expression denoting the called
4076 function), and in certain other places. Other than as expressed by
4077 the sequence point rules, the order of evaluation of subexpressions
4078 of an expression is not specified. All these rules describe only a
4079 partial order rather than a total order, since, for example, if two
4080 functions are called within one expression with no sequence point
4081 between them, the order in which the functions are called is not
4082 specified. However, the standards committee have ruled that
4083 function calls do not overlap.
4084
4085 It is not specified when between sequence points modifications to
4086 the values of objects take effect. Programs whose behavior depends
4087 on this have undefined behavior; the C and C++ standards specify
4088 that "Between the previous and next sequence point an object shall
4089 have its stored value modified at most once by the evaluation of an
4090 expression. Furthermore, the prior value shall be read only to
4091 determine the value to be stored.". If a program breaks these
4092 rules, the results on any particular implementation are entirely
4093 unpredictable.
4094
4095 Examples of code with undefined behavior are "a = a++;", "a[n] =
4096 b[n++]" and "a[i++] = i;". Some more complicated cases are not
4097 diagnosed by this option, and it may give an occasional false
4098 positive result, but in general it has been found fairly effective
4099 at detecting this sort of problem in programs.
4100
4101 The C++17 standard will define the order of evaluation of operands
4102 in more cases: in particular it requires that the right-hand side
4103 of an assignment be evaluated before the left-hand side, so the
4104 above examples are no longer undefined. But this warning will
4105 still warn about them, to help people avoid writing code that is
4106 undefined in C and earlier revisions of C++.
4107
4108 The standard is worded confusingly, therefore there is some debate
4109 over the precise meaning of the sequence point rules in subtle
4110 cases. Links to discussions of the problem, including proposed
4111 formal definitions, may be found on the GCC readings page, at
4112 <http://gcc.gnu.org/readings.html>.
4113
4114 This warning is enabled by -Wall for C and C++.
4115
4116 -Wno-return-local-addr
4117 Do not warn about returning a pointer (or in C++, a reference) to a
4118 variable that goes out of scope after the function returns.
4119
4120 -Wreturn-type
4121 Warn whenever a function is defined with a return type that
4122 defaults to "int". Also warn about any "return" statement with no
4123 return value in a function whose return type is not "void" (falling
4124 off the end of the function body is considered returning without a
4125 value).
4126
4127 For C only, warn about a "return" statement with an expression in a
4128 function whose return type is "void", unless the expression type is
4129 also "void". As a GNU extension, the latter case is accepted
4130 without a warning unless -Wpedantic is used. Attempting to use the
4131 return value of a non-"void" function other than "main" that flows
4132 off the end by reaching the closing curly brace that terminates the
4133 function is undefined.
4134
4135 Unlike in C, in C++, flowing off the end of a non-"void" function
4136 other than "main" results in undefined behavior even when the value
4137 of the function is not used.
4138
4139 This warning is enabled by default in C++ and by -Wall otherwise.
4140
4141 -Wshift-count-negative
4142 Warn if shift count is negative. This warning is enabled by
4143 default.
4144
4145 -Wshift-count-overflow
4146 Warn if shift count >= width of type. This warning is enabled by
4147 default.
4148
4149 -Wshift-negative-value
4150 Warn if left shifting a negative value. This warning is enabled by
4151 -Wextra in C99 and C++11 modes (and newer).
4152
4153 -Wshift-overflow
4154 -Wshift-overflow=n
4155 Warn about left shift overflows. This warning is enabled by
4156 default in C99 and C++11 modes (and newer).
4157
4158 -Wshift-overflow=1
4159 This is the warning level of -Wshift-overflow and is enabled by
4160 default in C99 and C++11 modes (and newer). This warning level
4161 does not warn about left-shifting 1 into the sign bit.
4162 (However, in C, such an overflow is still rejected in contexts
4163 where an integer constant expression is required.) No warning
4164 is emitted in C++2A mode (and newer), as signed left shifts
4165 always wrap.
4166
4167 -Wshift-overflow=2
4168 This warning level also warns about left-shifting 1 into the
4169 sign bit, unless C++14 mode (or newer) is active.
4170
4171 -Wswitch
4172 Warn whenever a "switch" statement has an index of enumerated type
4173 and lacks a "case" for one or more of the named codes of that
4174 enumeration. (The presence of a "default" label prevents this
4175 warning.) "case" labels outside the enumeration range also provoke
4176 warnings when this option is used (even if there is a "default"
4177 label). This warning is enabled by -Wall.
4178
4179 -Wswitch-default
4180 Warn whenever a "switch" statement does not have a "default" case.
4181
4182 -Wswitch-enum
4183 Warn whenever a "switch" statement has an index of enumerated type
4184 and lacks a "case" for one or more of the named codes of that
4185 enumeration. "case" labels outside the enumeration range also
4186 provoke warnings when this option is used. The only difference
4187 between -Wswitch and this option is that this option gives a
4188 warning about an omitted enumeration code even if there is a
4189 "default" label.
4190
4191 -Wswitch-bool
4192 Warn whenever a "switch" statement has an index of boolean type and
4193 the case values are outside the range of a boolean type. It is
4194 possible to suppress this warning by casting the controlling
4195 expression to a type other than "bool". For example:
4196
4197 switch ((int) (a == 4))
4198 {
4199 ...
4200 }
4201
4202 This warning is enabled by default for C and C++ programs.
4203
4204 -Wswitch-unreachable
4205 Warn whenever a "switch" statement contains statements between the
4206 controlling expression and the first case label, which will never
4207 be executed. For example:
4208
4209 switch (cond)
4210 {
4211 i = 15;
4212 ...
4213 case 5:
4214 ...
4215 }
4216
4217 -Wswitch-unreachable does not warn if the statement between the
4218 controlling expression and the first case label is just a
4219 declaration:
4220
4221 switch (cond)
4222 {
4223 int i;
4224 ...
4225 case 5:
4226 i = 5;
4227 ...
4228 }
4229
4230 This warning is enabled by default for C and C++ programs.
4231
4232 -Wsync-nand (C and C++ only)
4233 Warn when "__sync_fetch_and_nand" and "__sync_nand_and_fetch"
4234 built-in functions are used. These functions changed semantics in
4235 GCC 4.4.
4236
4237 -Wunused-but-set-parameter
4238 Warn whenever a function parameter is assigned to, but otherwise
4239 unused (aside from its declaration).
4240
4241 To suppress this warning use the "unused" attribute.
4242
4243 This warning is also enabled by -Wunused together with -Wextra.
4244
4245 -Wunused-but-set-variable
4246 Warn whenever a local variable is assigned to, but otherwise unused
4247 (aside from its declaration). This warning is enabled by -Wall.
4248
4249 To suppress this warning use the "unused" attribute.
4250
4251 This warning is also enabled by -Wunused, which is enabled by
4252 -Wall.
4253
4254 -Wunused-function
4255 Warn whenever a static function is declared but not defined or a
4256 non-inline static function is unused. This warning is enabled by
4257 -Wall.
4258
4259 -Wunused-label
4260 Warn whenever a label is declared but not used. This warning is
4261 enabled by -Wall.
4262
4263 To suppress this warning use the "unused" attribute.
4264
4265 -Wunused-local-typedefs (C, Objective-C, C++ and Objective-C++ only)
4266 Warn when a typedef locally defined in a function is not used.
4267 This warning is enabled by -Wall.
4268
4269 -Wunused-parameter
4270 Warn whenever a function parameter is unused aside from its
4271 declaration.
4272
4273 To suppress this warning use the "unused" attribute.
4274
4275 -Wno-unused-result
4276 Do not warn if a caller of a function marked with attribute
4277 "warn_unused_result" does not use its return value. The default is
4278 -Wunused-result.
4279
4280 -Wunused-variable
4281 Warn whenever a local or static variable is unused aside from its
4282 declaration. This option implies -Wunused-const-variable=1 for C,
4283 but not for C++. This warning is enabled by -Wall.
4284
4285 To suppress this warning use the "unused" attribute.
4286
4287 -Wunused-const-variable
4288 -Wunused-const-variable=n
4289 Warn whenever a constant static variable is unused aside from its
4290 declaration. -Wunused-const-variable=1 is enabled by
4291 -Wunused-variable for C, but not for C++. In C this declares
4292 variable storage, but in C++ this is not an error since const
4293 variables take the place of "#define"s.
4294
4295 To suppress this warning use the "unused" attribute.
4296
4297 -Wunused-const-variable=1
4298 This is the warning level that is enabled by -Wunused-variable
4299 for C. It warns only about unused static const variables
4300 defined in the main compilation unit, but not about static
4301 const variables declared in any header included.
4302
4303 -Wunused-const-variable=2
4304 This warning level also warns for unused constant static
4305 variables in headers (excluding system headers). This is the
4306 warning level of -Wunused-const-variable and must be explicitly
4307 requested since in C++ this isn't an error and in C it might be
4308 harder to clean up all headers included.
4309
4310 -Wunused-value
4311 Warn whenever a statement computes a result that is explicitly not
4312 used. To suppress this warning cast the unused expression to
4313 "void". This includes an expression-statement or the left-hand side
4314 of a comma expression that contains no side effects. For example,
4315 an expression such as "x[i,j]" causes a warning, while
4316 "x[(void)i,j]" does not.
4317
4318 This warning is enabled by -Wall.
4319
4320 -Wunused
4321 All the above -Wunused options combined.
4322
4323 In order to get a warning about an unused function parameter, you
4324 must either specify -Wextra -Wunused (note that -Wall implies
4325 -Wunused), or separately specify -Wunused-parameter.
4326
4327 -Wuninitialized
4328 Warn if an automatic variable is used without first being
4329 initialized or if a variable may be clobbered by a "setjmp" call.
4330 In C++, warn if a non-static reference or non-static "const" member
4331 appears in a class without constructors.
4332
4333 If you want to warn about code that uses the uninitialized value of
4334 the variable in its own initializer, use the -Winit-self option.
4335
4336 These warnings occur for individual uninitialized or clobbered
4337 elements of structure, union or array variables as well as for
4338 variables that are uninitialized or clobbered as a whole. They do
4339 not occur for variables or elements declared "volatile". Because
4340 these warnings depend on optimization, the exact variables or
4341 elements for which there are warnings depends on the precise
4342 optimization options and version of GCC used.
4343
4344 Note that there may be no warning about a variable that is used
4345 only to compute a value that itself is never used, because such
4346 computations may be deleted by data flow analysis before the
4347 warnings are printed.
4348
4349 -Winvalid-memory-model
4350 Warn for invocations of __atomic Builtins, __sync Builtins, and the
4351 C11 atomic generic functions with a memory consistency argument
4352 that is either invalid for the operation or outside the range of
4353 values of the "memory_order" enumeration. For example, since the
4354 "__atomic_store" and "__atomic_store_n" built-ins are only defined
4355 for the relaxed, release, and sequentially consistent memory orders
4356 the following code is diagnosed:
4357
4358 void store (int *i)
4359 {
4360 __atomic_store_n (i, 0, memory_order_consume);
4361 }
4362
4363 -Winvalid-memory-model is enabled by default.
4364
4365 -Wmaybe-uninitialized
4366 For an automatic (i.e. local) variable, if there exists a path from
4367 the function entry to a use of the variable that is initialized,
4368 but there exist some other paths for which the variable is not
4369 initialized, the compiler emits a warning if it cannot prove the
4370 uninitialized paths are not executed at run time.
4371
4372 These warnings are only possible in optimizing compilation, because
4373 otherwise GCC does not keep track of the state of variables.
4374
4375 These warnings are made optional because GCC may not be able to
4376 determine when the code is correct in spite of appearing to have an
4377 error. Here is one example of how this can happen:
4378
4379 {
4380 int x;
4381 switch (y)
4382 {
4383 case 1: x = 1;
4384 break;
4385 case 2: x = 4;
4386 break;
4387 case 3: x = 5;
4388 }
4389 foo (x);
4390 }
4391
4392 If the value of "y" is always 1, 2 or 3, then "x" is always
4393 initialized, but GCC doesn't know this. To suppress the warning,
4394 you need to provide a default case with assert(0) or similar code.
4395
4396 This option also warns when a non-volatile automatic variable might
4397 be changed by a call to "longjmp". The compiler sees only the
4398 calls to "setjmp". It cannot know where "longjmp" will be called;
4399 in fact, a signal handler could call it at any point in the code.
4400 As a result, you may get a warning even when there is in fact no
4401 problem because "longjmp" cannot in fact be called at the place
4402 that would cause a problem.
4403
4404 Some spurious warnings can be avoided if you declare all the
4405 functions you use that never return as "noreturn".
4406
4407 This warning is enabled by -Wall or -Wextra.
4408
4409 -Wunknown-pragmas
4410 Warn when a "#pragma" directive is encountered that is not
4411 understood by GCC. If this command-line option is used, warnings
4412 are even issued for unknown pragmas in system header files. This
4413 is not the case if the warnings are only enabled by the -Wall
4414 command-line option.
4415
4416 -Wno-pragmas
4417 Do not warn about misuses of pragmas, such as incorrect parameters,
4418 invalid syntax, or conflicts between pragmas. See also
4419 -Wunknown-pragmas.
4420
4421 -Wno-prio-ctor-dtor
4422 Do not warn if a priority from 0 to 100 is used for constructor or
4423 destructor. The use of constructor and destructor attributes allow
4424 you to assign a priority to the constructor/destructor to control
4425 its order of execution before "main" is called or after it returns.
4426 The priority values must be greater than 100 as the compiler
4427 reserves priority values between 0--100 for the implementation.
4428
4429 -Wstrict-aliasing
4430 This option is only active when -fstrict-aliasing is active. It
4431 warns about code that might break the strict aliasing rules that
4432 the compiler is using for optimization. The warning does not catch
4433 all cases, but does attempt to catch the more common pitfalls. It
4434 is included in -Wall. It is equivalent to -Wstrict-aliasing=3
4435
4436 -Wstrict-aliasing=n
4437 This option is only active when -fstrict-aliasing is active. It
4438 warns about code that might break the strict aliasing rules that
4439 the compiler is using for optimization. Higher levels correspond
4440 to higher accuracy (fewer false positives). Higher levels also
4441 correspond to more effort, similar to the way -O works.
4442 -Wstrict-aliasing is equivalent to -Wstrict-aliasing=3.
4443
4444 Level 1: Most aggressive, quick, least accurate. Possibly useful
4445 when higher levels do not warn but -fstrict-aliasing still breaks
4446 the code, as it has very few false negatives. However, it has many
4447 false positives. Warns for all pointer conversions between
4448 possibly incompatible types, even if never dereferenced. Runs in
4449 the front end only.
4450
4451 Level 2: Aggressive, quick, not too precise. May still have many
4452 false positives (not as many as level 1 though), and few false
4453 negatives (but possibly more than level 1). Unlike level 1, it
4454 only warns when an address is taken. Warns about incomplete types.
4455 Runs in the front end only.
4456
4457 Level 3 (default for -Wstrict-aliasing): Should have very few false
4458 positives and few false negatives. Slightly slower than levels 1
4459 or 2 when optimization is enabled. Takes care of the common
4460 pun+dereference pattern in the front end: "*(int*)&some_float". If
4461 optimization is enabled, it also runs in the back end, where it
4462 deals with multiple statement cases using flow-sensitive points-to
4463 information. Only warns when the converted pointer is
4464 dereferenced. Does not warn about incomplete types.
4465
4466 -Wstrict-overflow
4467 -Wstrict-overflow=n
4468 This option is only active when signed overflow is undefined. It
4469 warns about cases where the compiler optimizes based on the
4470 assumption that signed overflow does not occur. Note that it does
4471 not warn about all cases where the code might overflow: it only
4472 warns about cases where the compiler implements some optimization.
4473 Thus this warning depends on the optimization level.
4474
4475 An optimization that assumes that signed overflow does not occur is
4476 perfectly safe if the values of the variables involved are such
4477 that overflow never does, in fact, occur. Therefore this warning
4478 can easily give a false positive: a warning about code that is not
4479 actually a problem. To help focus on important issues, several
4480 warning levels are defined. No warnings are issued for the use of
4481 undefined signed overflow when estimating how many iterations a
4482 loop requires, in particular when determining whether a loop will
4483 be executed at all.
4484
4485 -Wstrict-overflow=1
4486 Warn about cases that are both questionable and easy to avoid.
4487 For example the compiler simplifies "x + 1 > x" to 1. This
4488 level of -Wstrict-overflow is enabled by -Wall; higher levels
4489 are not, and must be explicitly requested.
4490
4491 -Wstrict-overflow=2
4492 Also warn about other cases where a comparison is simplified to
4493 a constant. For example: "abs (x) >= 0". This can only be
4494 simplified when signed integer overflow is undefined, because
4495 "abs (INT_MIN)" overflows to "INT_MIN", which is less than
4496 zero. -Wstrict-overflow (with no level) is the same as
4497 -Wstrict-overflow=2.
4498
4499 -Wstrict-overflow=3
4500 Also warn about other cases where a comparison is simplified.
4501 For example: "x + 1 > 1" is simplified to "x > 0".
4502
4503 -Wstrict-overflow=4
4504 Also warn about other simplifications not covered by the above
4505 cases. For example: "(x * 10) / 5" is simplified to "x * 2".
4506
4507 -Wstrict-overflow=5
4508 Also warn about cases where the compiler reduces the magnitude
4509 of a constant involved in a comparison. For example: "x + 2 >
4510 y" is simplified to "x + 1 >= y". This is reported only at the
4511 highest warning level because this simplification applies to
4512 many comparisons, so this warning level gives a very large
4513 number of false positives.
4514
4515 -Wstringop-overflow
4516 -Wstringop-overflow=type
4517 Warn for calls to string manipulation functions such as "memcpy"
4518 and "strcpy" that are determined to overflow the destination
4519 buffer. The optional argument is one greater than the type of
4520 Object Size Checking to perform to determine the size of the
4521 destination. The argument is meaningful only for functions that
4522 operate on character arrays but not for raw memory functions like
4523 "memcpy" which always make use of Object Size type-0. The option
4524 also warns for calls that specify a size in excess of the largest
4525 possible object or at most "SIZE_MAX / 2" bytes. The option
4526 produces the best results with optimization enabled but can detect
4527 a small subset of simple buffer overflows even without optimization
4528 in calls to the GCC built-in functions like "__builtin_memcpy" that
4529 correspond to the standard functions. In any case, the option
4530 warns about just a subset of buffer overflows detected by the
4531 corresponding overflow checking built-ins. For example, the option
4532 will issue a warning for the "strcpy" call below because it copies
4533 at least 5 characters (the string "blue" including the terminating
4534 NUL) into the buffer of size 4.
4535
4536 enum Color { blue, purple, yellow };
4537 const char* f (enum Color clr)
4538 {
4539 static char buf [4];
4540 const char *str;
4541 switch (clr)
4542 {
4543 case blue: str = "blue"; break;
4544 case purple: str = "purple"; break;
4545 case yellow: str = "yellow"; break;
4546 }
4547
4548 return strcpy (buf, str); // warning here
4549 }
4550
4551 Option -Wstringop-overflow=2 is enabled by default.
4552
4553 -Wstringop-overflow
4554 -Wstringop-overflow=1
4555 The -Wstringop-overflow=1 option uses type-zero Object Size
4556 Checking to determine the sizes of destination objects. This
4557 is the default setting of the option. At this setting the
4558 option will not warn for writes past the end of subobjects of
4559 larger objects accessed by pointers unless the size of the
4560 largest surrounding object is known. When the destination may
4561 be one of several objects it is assumed to be the largest one
4562 of them. On Linux systems, when optimization is enabled at
4563 this setting the option warns for the same code as when the
4564 "_FORTIFY_SOURCE" macro is defined to a non-zero value.
4565
4566 -Wstringop-overflow=2
4567 The -Wstringop-overflow=2 option uses type-one Object Size
4568 Checking to determine the sizes of destination objects. At
4569 this setting the option will warn about overflows when writing
4570 to members of the largest complete objects whose exact size is
4571 known. It will, however, not warn for excessive writes to the
4572 same members of unknown objects referenced by pointers since
4573 they may point to arrays containing unknown numbers of
4574 elements.
4575
4576 -Wstringop-overflow=3
4577 The -Wstringop-overflow=3 option uses type-two Object Size
4578 Checking to determine the sizes of destination objects. At
4579 this setting the option warns about overflowing the smallest
4580 object or data member. This is the most restrictive setting of
4581 the option that may result in warnings for safe code.
4582
4583 -Wstringop-overflow=4
4584 The -Wstringop-overflow=4 option uses type-three Object Size
4585 Checking to determine the sizes of destination objects. At
4586 this setting the option will warn about overflowing any data
4587 members, and when the destination is one of several objects it
4588 uses the size of the largest of them to decide whether to issue
4589 a warning. Similarly to -Wstringop-overflow=3 this setting of
4590 the option may result in warnings for benign code.
4591
4592 -Wstringop-truncation
4593 Warn for calls to bounded string manipulation functions such as
4594 "strncat", "strncpy", and "stpncpy" that may either truncate the
4595 copied string or leave the destination unchanged.
4596
4597 In the following example, the call to "strncat" specifies a bound
4598 that is less than the length of the source string. As a result,
4599 the copy of the source will be truncated and so the call is
4600 diagnosed. To avoid the warning use "bufsize - strlen (buf) - 1)"
4601 as the bound.
4602
4603 void append (char *buf, size_t bufsize)
4604 {
4605 strncat (buf, ".txt", 3);
4606 }
4607
4608 As another example, the following call to "strncpy" results in
4609 copying to "d" just the characters preceding the terminating NUL,
4610 without appending the NUL to the end. Assuming the result of
4611 "strncpy" is necessarily a NUL-terminated string is a common
4612 mistake, and so the call is diagnosed. To avoid the warning when
4613 the result is not expected to be NUL-terminated, call "memcpy"
4614 instead.
4615
4616 void copy (char *d, const char *s)
4617 {
4618 strncpy (d, s, strlen (s));
4619 }
4620
4621 In the following example, the call to "strncpy" specifies the size
4622 of the destination buffer as the bound. If the length of the
4623 source string is equal to or greater than this size the result of
4624 the copy will not be NUL-terminated. Therefore, the call is also
4625 diagnosed. To avoid the warning, specify "sizeof buf - 1" as the
4626 bound and set the last element of the buffer to "NUL".
4627
4628 void copy (const char *s)
4629 {
4630 char buf[80];
4631 strncpy (buf, s, sizeof buf);
4632 ...
4633 }
4634
4635 In situations where a character array is intended to store a
4636 sequence of bytes with no terminating "NUL" such an array may be
4637 annotated with attribute "nonstring" to avoid this warning. Such
4638 arrays, however, are not suitable arguments to functions that
4639 expect "NUL"-terminated strings. To help detect accidental misuses
4640 of such arrays GCC issues warnings unless it can prove that the use
4641 is safe.
4642
4643 -Wsuggest-attribute=[pure|const|noreturn|format|cold|malloc]
4644 Warn for cases where adding an attribute may be beneficial. The
4645 attributes currently supported are listed below.
4646
4647 -Wsuggest-attribute=pure
4648 -Wsuggest-attribute=const
4649 -Wsuggest-attribute=noreturn
4650 -Wmissing-noreturn
4651 -Wsuggest-attribute=malloc
4652 Warn about functions that might be candidates for attributes
4653 "pure", "const" or "noreturn" or "malloc". The compiler only
4654 warns for functions visible in other compilation units or (in
4655 the case of "pure" and "const") if it cannot prove that the
4656 function returns normally. A function returns normally if it
4657 doesn't contain an infinite loop or return abnormally by
4658 throwing, calling "abort" or trapping. This analysis requires
4659 option -fipa-pure-const, which is enabled by default at -O and
4660 higher. Higher optimization levels improve the accuracy of the
4661 analysis.
4662
4663 -Wsuggest-attribute=format
4664 -Wmissing-format-attribute
4665 Warn about function pointers that might be candidates for
4666 "format" attributes. Note these are only possible candidates,
4667 not absolute ones. GCC guesses that function pointers with
4668 "format" attributes that are used in assignment,
4669 initialization, parameter passing or return statements should
4670 have a corresponding "format" attribute in the resulting type.
4671 I.e. the left-hand side of the assignment or initialization,
4672 the type of the parameter variable, or the return type of the
4673 containing function respectively should also have a "format"
4674 attribute to avoid the warning.
4675
4676 GCC also warns about function definitions that might be
4677 candidates for "format" attributes. Again, these are only
4678 possible candidates. GCC guesses that "format" attributes
4679 might be appropriate for any function that calls a function
4680 like "vprintf" or "vscanf", but this might not always be the
4681 case, and some functions for which "format" attributes are
4682 appropriate may not be detected.
4683
4684 -Wsuggest-attribute=cold
4685 Warn about functions that might be candidates for "cold"
4686 attribute. This is based on static detection and generally
4687 will only warn about functions which always leads to a call to
4688 another "cold" function such as wrappers of C++ "throw" or
4689 fatal error reporting functions leading to "abort".
4690
4691 -Wsuggest-final-types
4692 Warn about types with virtual methods where code quality would be
4693 improved if the type were declared with the C++11 "final"
4694 specifier, or, if possible, declared in an anonymous namespace.
4695 This allows GCC to more aggressively devirtualize the polymorphic
4696 calls. This warning is more effective with link time optimization,
4697 where the information about the class hierarchy graph is more
4698 complete.
4699
4700 -Wsuggest-final-methods
4701 Warn about virtual methods where code quality would be improved if
4702 the method were declared with the C++11 "final" specifier, or, if
4703 possible, its type were declared in an anonymous namespace or with
4704 the "final" specifier. This warning is more effective with link-
4705 time optimization, where the information about the class hierarchy
4706 graph is more complete. It is recommended to first consider
4707 suggestions of -Wsuggest-final-types and then rebuild with new
4708 annotations.
4709
4710 -Wsuggest-override
4711 Warn about overriding virtual functions that are not marked with
4712 the override keyword.
4713
4714 -Walloc-zero
4715 Warn about calls to allocation functions decorated with attribute
4716 "alloc_size" that specify zero bytes, including those to the built-
4717 in forms of the functions "aligned_alloc", "alloca", "calloc",
4718 "malloc", and "realloc". Because the behavior of these functions
4719 when called with a zero size differs among implementations (and in
4720 the case of "realloc" has been deprecated) relying on it may result
4721 in subtle portability bugs and should be avoided.
4722
4723 -Walloc-size-larger-than=byte-size
4724 Warn about calls to functions decorated with attribute "alloc_size"
4725 that attempt to allocate objects larger than the specified number
4726 of bytes, or where the result of the size computation in an integer
4727 type with infinite precision would exceed the value of PTRDIFF_MAX
4728 on the target. -Walloc-size-larger-than=PTRDIFF_MAX is enabled by
4729 default. Warnings controlled by the option can be disabled either
4730 by specifying byte-size of SIZE_MAX or more or by
4731 -Wno-alloc-size-larger-than.
4732
4733 -Wno-alloc-size-larger-than
4734 Disable -Walloc-size-larger-than= warnings. The option is
4735 equivalent to -Walloc-size-larger-than=SIZE_MAX or larger.
4736
4737 -Walloca
4738 This option warns on all uses of "alloca" in the source.
4739
4740 -Walloca-larger-than=byte-size
4741 This option warns on calls to "alloca" with an integer argument
4742 whose value is either zero, or that is not bounded by a controlling
4743 predicate that limits its value to at most byte-size. It also
4744 warns for calls to "alloca" where the bound value is unknown.
4745 Arguments of non-integer types are considered unbounded even if
4746 they appear to be constrained to the expected range.
4747
4748 For example, a bounded case of "alloca" could be:
4749
4750 void func (size_t n)
4751 {
4752 void *p;
4753 if (n <= 1000)
4754 p = alloca (n);
4755 else
4756 p = malloc (n);
4757 f (p);
4758 }
4759
4760 In the above example, passing "-Walloca-larger-than=1000" would not
4761 issue a warning because the call to "alloca" is known to be at most
4762 1000 bytes. However, if "-Walloca-larger-than=500" were passed,
4763 the compiler would emit a warning.
4764
4765 Unbounded uses, on the other hand, are uses of "alloca" with no
4766 controlling predicate constraining its integer argument. For
4767 example:
4768
4769 void func ()
4770 {
4771 void *p = alloca (n);
4772 f (p);
4773 }
4774
4775 If "-Walloca-larger-than=500" were passed, the above would trigger
4776 a warning, but this time because of the lack of bounds checking.
4777
4778 Note, that even seemingly correct code involving signed integers
4779 could cause a warning:
4780
4781 void func (signed int n)
4782 {
4783 if (n < 500)
4784 {
4785 p = alloca (n);
4786 f (p);
4787 }
4788 }
4789
4790 In the above example, n could be negative, causing a larger than
4791 expected argument to be implicitly cast into the "alloca" call.
4792
4793 This option also warns when "alloca" is used in a loop.
4794
4795 -Walloca-larger-than=PTRDIFF_MAX is enabled by default but is
4796 usually only effective when -ftree-vrp is active (default for -O2
4797 and above).
4798
4799 See also -Wvla-larger-than=byte-size.
4800
4801 -Wno-alloca-larger-than
4802 Disable -Walloca-larger-than= warnings. The option is equivalent
4803 to -Walloca-larger-than=SIZE_MAX or larger.
4804
4805 -Warray-bounds
4806 -Warray-bounds=n
4807 This option is only active when -ftree-vrp is active (default for
4808 -O2 and above). It warns about subscripts to arrays that are always
4809 out of bounds. This warning is enabled by -Wall.
4810
4811 -Warray-bounds=1
4812 This is the warning level of -Warray-bounds and is enabled by
4813 -Wall; higher levels are not, and must be explicitly requested.
4814
4815 -Warray-bounds=2
4816 This warning level also warns about out of bounds access for
4817 arrays at the end of a struct and for arrays accessed through
4818 pointers. This warning level may give a larger number of false
4819 positives and is deactivated by default.
4820
4821 -Wattribute-alias=n
4822 -Wno-attribute-alias
4823 Warn about declarations using the "alias" and similar attributes
4824 whose target is incompatible with the type of the alias.
4825
4826 -Wattribute-alias=1
4827 The default warning level of the -Wattribute-alias option
4828 diagnoses incompatibilities between the type of the alias
4829 declaration and that of its target. Such incompatibilities are
4830 typically indicative of bugs.
4831
4832 -Wattribute-alias=2
4833 At this level -Wattribute-alias also diagnoses cases where the
4834 attributes of the alias declaration are more restrictive than
4835 the attributes applied to its target. These mismatches can
4836 potentially result in incorrect code generation. In other
4837 cases they may be benign and could be resolved simply by adding
4838 the missing attribute to the target. For comparison, see the
4839 -Wmissing-attributes option, which controls diagnostics when
4840 the alias declaration is less restrictive than the target,
4841 rather than more restrictive.
4842
4843 Attributes considered include "alloc_align", "alloc_size",
4844 "cold", "const", "hot", "leaf", "malloc", "nonnull",
4845 "noreturn", "nothrow", "pure", "returns_nonnull", and
4846 "returns_twice".
4847
4848 -Wattribute-alias is equivalent to -Wattribute-alias=1. This is
4849 the default. You can disable these warnings with either
4850 -Wno-attribute-alias or -Wattribute-alias=0.
4851
4852 -Wbool-compare
4853 Warn about boolean expression compared with an integer value
4854 different from "true"/"false". For instance, the following
4855 comparison is always false:
4856
4857 int n = 5;
4858 ...
4859 if ((n > 1) == 2) { ... }
4860
4861 This warning is enabled by -Wall.
4862
4863 -Wbool-operation
4864 Warn about suspicious operations on expressions of a boolean type.
4865 For instance, bitwise negation of a boolean is very likely a bug in
4866 the program. For C, this warning also warns about incrementing or
4867 decrementing a boolean, which rarely makes sense. (In C++,
4868 decrementing a boolean is always invalid. Incrementing a boolean
4869 is invalid in C++17, and deprecated otherwise.)
4870
4871 This warning is enabled by -Wall.
4872
4873 -Wduplicated-branches
4874 Warn when an if-else has identical branches. This warning detects
4875 cases like
4876
4877 if (p != NULL)
4878 return 0;
4879 else
4880 return 0;
4881
4882 It doesn't warn when both branches contain just a null statement.
4883 This warning also warn for conditional operators:
4884
4885 int i = x ? *p : *p;
4886
4887 -Wduplicated-cond
4888 Warn about duplicated conditions in an if-else-if chain. For
4889 instance, warn for the following code:
4890
4891 if (p->q != NULL) { ... }
4892 else if (p->q != NULL) { ... }
4893
4894 -Wframe-address
4895 Warn when the __builtin_frame_address or __builtin_return_address
4896 is called with an argument greater than 0. Such calls may return
4897 indeterminate values or crash the program. The warning is included
4898 in -Wall.
4899
4900 -Wno-discarded-qualifiers (C and Objective-C only)
4901 Do not warn if type qualifiers on pointers are being discarded.
4902 Typically, the compiler warns if a "const char *" variable is
4903 passed to a function that takes a "char *" parameter. This option
4904 can be used to suppress such a warning.
4905
4906 -Wno-discarded-array-qualifiers (C and Objective-C only)
4907 Do not warn if type qualifiers on arrays which are pointer targets
4908 are being discarded. Typically, the compiler warns if a "const int
4909 (*)[]" variable is passed to a function that takes a "int (*)[]"
4910 parameter. This option can be used to suppress such a warning.
4911
4912 -Wno-incompatible-pointer-types (C and Objective-C only)
4913 Do not warn when there is a conversion between pointers that have
4914 incompatible types. This warning is for cases not covered by
4915 -Wno-pointer-sign, which warns for pointer argument passing or
4916 assignment with different signedness.
4917
4918 -Wno-int-conversion (C and Objective-C only)
4919 Do not warn about incompatible integer to pointer and pointer to
4920 integer conversions. This warning is about implicit conversions;
4921 for explicit conversions the warnings -Wno-int-to-pointer-cast and
4922 -Wno-pointer-to-int-cast may be used.
4923
4924 -Wno-div-by-zero
4925 Do not warn about compile-time integer division by zero. Floating-
4926 point division by zero is not warned about, as it can be a
4927 legitimate way of obtaining infinities and NaNs.
4928
4929 -Wsystem-headers
4930 Print warning messages for constructs found in system header files.
4931 Warnings from system headers are normally suppressed, on the
4932 assumption that they usually do not indicate real problems and
4933 would only make the compiler output harder to read. Using this
4934 command-line option tells GCC to emit warnings from system headers
4935 as if they occurred in user code. However, note that using -Wall
4936 in conjunction with this option does not warn about unknown pragmas
4937 in system headers---for that, -Wunknown-pragmas must also be used.
4938
4939 -Wtautological-compare
4940 Warn if a self-comparison always evaluates to true or false. This
4941 warning detects various mistakes such as:
4942
4943 int i = 1;
4944 ...
4945 if (i > i) { ... }
4946
4947 This warning also warns about bitwise comparisons that always
4948 evaluate to true or false, for instance:
4949
4950 if ((a & 16) == 10) { ... }
4951
4952 will always be false.
4953
4954 This warning is enabled by -Wall.
4955
4956 -Wtrampolines
4957 Warn about trampolines generated for pointers to nested functions.
4958 A trampoline is a small piece of data or code that is created at
4959 run time on the stack when the address of a nested function is
4960 taken, and is used to call the nested function indirectly. For
4961 some targets, it is made up of data only and thus requires no
4962 special treatment. But, for most targets, it is made up of code
4963 and thus requires the stack to be made executable in order for the
4964 program to work properly.
4965
4966 -Wfloat-equal
4967 Warn if floating-point values are used in equality comparisons.
4968
4969 The idea behind this is that sometimes it is convenient (for the
4970 programmer) to consider floating-point values as approximations to
4971 infinitely precise real numbers. If you are doing this, then you
4972 need to compute (by analyzing the code, or in some other way) the
4973 maximum or likely maximum error that the computation introduces,
4974 and allow for it when performing comparisons (and when producing
4975 output, but that's a different problem). In particular, instead of
4976 testing for equality, you should check to see whether the two
4977 values have ranges that overlap; and this is done with the
4978 relational operators, so equality comparisons are probably
4979 mistaken.
4980
4981 -Wtraditional (C and Objective-C only)
4982 Warn about certain constructs that behave differently in
4983 traditional and ISO C. Also warn about ISO C constructs that have
4984 no traditional C equivalent, and/or problematic constructs that
4985 should be avoided.
4986
4987 * Macro parameters that appear within string literals in the
4988 macro body. In traditional C macro replacement takes place
4989 within string literals, but in ISO C it does not.
4990
4991 * In traditional C, some preprocessor directives did not exist.
4992 Traditional preprocessors only considered a line to be a
4993 directive if the # appeared in column 1 on the line. Therefore
4994 -Wtraditional warns about directives that traditional C
4995 understands but ignores because the # does not appear as the
4996 first character on the line. It also suggests you hide
4997 directives like "#pragma" not understood by traditional C by
4998 indenting them. Some traditional implementations do not
4999 recognize "#elif", so this option suggests avoiding it
5000 altogether.
5001
5002 * A function-like macro that appears without arguments.
5003
5004 * The unary plus operator.
5005
5006 * The U integer constant suffix, or the F or L floating-point
5007 constant suffixes. (Traditional C does support the L suffix on
5008 integer constants.) Note, these suffixes appear in macros
5009 defined in the system headers of most modern systems, e.g. the
5010 _MIN/_MAX macros in "<limits.h>". Use of these macros in user
5011 code might normally lead to spurious warnings, however GCC's
5012 integrated preprocessor has enough context to avoid warning in
5013 these cases.
5014
5015 * A function declared external in one block and then used after
5016 the end of the block.
5017
5018 * A "switch" statement has an operand of type "long".
5019
5020 * A non-"static" function declaration follows a "static" one.
5021 This construct is not accepted by some traditional C compilers.
5022
5023 * The ISO type of an integer constant has a different width or
5024 signedness from its traditional type. This warning is only
5025 issued if the base of the constant is ten. I.e. hexadecimal or
5026 octal values, which typically represent bit patterns, are not
5027 warned about.
5028
5029 * Usage of ISO string concatenation is detected.
5030
5031 * Initialization of automatic aggregates.
5032
5033 * Identifier conflicts with labels. Traditional C lacks a
5034 separate namespace for labels.
5035
5036 * Initialization of unions. If the initializer is zero, the
5037 warning is omitted. This is done under the assumption that the
5038 zero initializer in user code appears conditioned on e.g.
5039 "__STDC__" to avoid missing initializer warnings and relies on
5040 default initialization to zero in the traditional C case.
5041
5042 * Conversions by prototypes between fixed/floating-point values
5043 and vice versa. The absence of these prototypes when compiling
5044 with traditional C causes serious problems. This is a subset
5045 of the possible conversion warnings; for the full set use
5046 -Wtraditional-conversion.
5047
5048 * Use of ISO C style function definitions. This warning
5049 intentionally is not issued for prototype declarations or
5050 variadic functions because these ISO C features appear in your
5051 code when using libiberty's traditional C compatibility macros,
5052 "PARAMS" and "VPARAMS". This warning is also bypassed for
5053 nested functions because that feature is already a GCC
5054 extension and thus not relevant to traditional C compatibility.
5055
5056 -Wtraditional-conversion (C and Objective-C only)
5057 Warn if a prototype causes a type conversion that is different from
5058 what would happen to the same argument in the absence of a
5059 prototype. This includes conversions of fixed point to floating
5060 and vice versa, and conversions changing the width or signedness of
5061 a fixed-point argument except when the same as the default
5062 promotion.
5063
5064 -Wdeclaration-after-statement (C and Objective-C only)
5065 Warn when a declaration is found after a statement in a block.
5066 This construct, known from C++, was introduced with ISO C99 and is
5067 by default allowed in GCC. It is not supported by ISO C90.
5068
5069 -Wshadow
5070 Warn whenever a local variable or type declaration shadows another
5071 variable, parameter, type, class member (in C++), or instance
5072 variable (in Objective-C) or whenever a built-in function is
5073 shadowed. Note that in C++, the compiler warns if a local variable
5074 shadows an explicit typedef, but not if it shadows a
5075 struct/class/enum. Same as -Wshadow=global.
5076
5077 -Wno-shadow-ivar (Objective-C only)
5078 Do not warn whenever a local variable shadows an instance variable
5079 in an Objective-C method.
5080
5081 -Wshadow=global
5082 The default for -Wshadow. Warns for any (global) shadowing.
5083
5084 -Wshadow=local
5085 Warn when a local variable shadows another local variable or
5086 parameter. This warning is enabled by -Wshadow=global.
5087
5088 -Wshadow=compatible-local
5089 Warn when a local variable shadows another local variable or
5090 parameter whose type is compatible with that of the shadowing
5091 variable. In C++, type compatibility here means the type of the
5092 shadowing variable can be converted to that of the shadowed
5093 variable. The creation of this flag (in addition to -Wshadow=local)
5094 is based on the idea that when a local variable shadows another one
5095 of incompatible type, it is most likely intentional, not a bug or
5096 typo, as shown in the following example:
5097
5098 for (SomeIterator i = SomeObj.begin(); i != SomeObj.end(); ++i)
5099 {
5100 for (int i = 0; i < N; ++i)
5101 {
5102 ...
5103 }
5104 ...
5105 }
5106
5107 Since the two variable "i" in the example above have incompatible
5108 types, enabling only -Wshadow=compatible-local will not emit a
5109 warning. Because their types are incompatible, if a programmer
5110 accidentally uses one in place of the other, type checking will
5111 catch that and emit an error or warning. So not warning (about
5112 shadowing) in this case will not lead to undetected bugs. Use of
5113 this flag instead of -Wshadow=local can possibly reduce the number
5114 of warnings triggered by intentional shadowing.
5115
5116 This warning is enabled by -Wshadow=local.
5117
5118 -Wlarger-than=byte-size
5119 Warn whenever an object is defined whose size exceeds byte-size.
5120 -Wlarger-than=PTRDIFF_MAX is enabled by default. Warnings
5121 controlled by the option can be disabled either by specifying byte-
5122 size of SIZE_MAX or more or by -Wno-larger-than.
5123
5124 -Wno-larger-than
5125 Disable -Wlarger-than= warnings. The option is equivalent to
5126 -Wlarger-than=SIZE_MAX or larger.
5127
5128 -Wframe-larger-than=byte-size
5129 Warn if the size of a function frame exceeds byte-size. The
5130 computation done to determine the stack frame size is approximate
5131 and not conservative. The actual requirements may be somewhat
5132 greater than byte-size even if you do not get a warning. In
5133 addition, any space allocated via "alloca", variable-length arrays,
5134 or related constructs is not included by the compiler when
5135 determining whether or not to issue a warning.
5136 -Wframe-larger-than=PTRDIFF_MAX is enabled by default. Warnings
5137 controlled by the option can be disabled either by specifying byte-
5138 size of SIZE_MAX or more or by -Wno-frame-larger-than.
5139
5140 -Wno-frame-larger-than
5141 Disable -Wframe-larger-than= warnings. The option is equivalent to
5142 -Wframe-larger-than=SIZE_MAX or larger.
5143
5144 -Wno-free-nonheap-object
5145 Do not warn when attempting to free an object that was not
5146 allocated on the heap.
5147
5148 -Wstack-usage=byte-size
5149 Warn if the stack usage of a function might exceed byte-size. The
5150 computation done to determine the stack usage is conservative. Any
5151 space allocated via "alloca", variable-length arrays, or related
5152 constructs is included by the compiler when determining whether or
5153 not to issue a warning.
5154
5155 The message is in keeping with the output of -fstack-usage.
5156
5157 * If the stack usage is fully static but exceeds the specified
5158 amount, it's:
5159
5160 warning: stack usage is 1120 bytes
5161
5162 * If the stack usage is (partly) dynamic but bounded, it's:
5163
5164 warning: stack usage might be 1648 bytes
5165
5166 * If the stack usage is (partly) dynamic and not bounded, it's:
5167
5168 warning: stack usage might be unbounded
5169
5170 -Wstack-usage=PTRDIFF_MAX is enabled by default. Warnings
5171 controlled by the option can be disabled either by specifying byte-
5172 size of SIZE_MAX or more or by -Wno-stack-usage.
5173
5174 -Wno-stack-usage
5175 Disable -Wstack-usage= warnings. The option is equivalent to
5176 -Wstack-usage=SIZE_MAX or larger.
5177
5178 -Wunsafe-loop-optimizations
5179 Warn if the loop cannot be optimized because the compiler cannot
5180 assume anything on the bounds of the loop indices. With
5181 -funsafe-loop-optimizations warn if the compiler makes such
5182 assumptions.
5183
5184 -Wno-pedantic-ms-format (MinGW targets only)
5185 When used in combination with -Wformat and -pedantic without GNU
5186 extensions, this option disables the warnings about non-ISO
5187 "printf" / "scanf" format width specifiers "I32", "I64", and "I"
5188 used on Windows targets, which depend on the MS runtime.
5189
5190 -Waligned-new
5191 Warn about a new-expression of a type that requires greater
5192 alignment than the "alignof(std::max_align_t)" but uses an
5193 allocation function without an explicit alignment parameter. This
5194 option is enabled by -Wall.
5195
5196 Normally this only warns about global allocation functions, but
5197 -Waligned-new=all also warns about class member allocation
5198 functions.
5199
5200 -Wplacement-new
5201 -Wplacement-new=n
5202 Warn about placement new expressions with undefined behavior, such
5203 as constructing an object in a buffer that is smaller than the type
5204 of the object. For example, the placement new expression below is
5205 diagnosed because it attempts to construct an array of 64 integers
5206 in a buffer only 64 bytes large.
5207
5208 char buf [64];
5209 new (buf) int[64];
5210
5211 This warning is enabled by default.
5212
5213 -Wplacement-new=1
5214 This is the default warning level of -Wplacement-new. At this
5215 level the warning is not issued for some strictly undefined
5216 constructs that GCC allows as extensions for compatibility with
5217 legacy code. For example, the following "new" expression is
5218 not diagnosed at this level even though it has undefined
5219 behavior according to the C++ standard because it writes past
5220 the end of the one-element array.
5221
5222 struct S { int n, a[1]; };
5223 S *s = (S *)malloc (sizeof *s + 31 * sizeof s->a[0]);
5224 new (s->a)int [32]();
5225
5226 -Wplacement-new=2
5227 At this level, in addition to diagnosing all the same
5228 constructs as at level 1, a diagnostic is also issued for
5229 placement new expressions that construct an object in the last
5230 member of structure whose type is an array of a single element
5231 and whose size is less than the size of the object being
5232 constructed. While the previous example would be diagnosed,
5233 the following construct makes use of the flexible member array
5234 extension to avoid the warning at level 2.
5235
5236 struct S { int n, a[]; };
5237 S *s = (S *)malloc (sizeof *s + 32 * sizeof s->a[0]);
5238 new (s->a)int [32]();
5239
5240 -Wpointer-arith
5241 Warn about anything that depends on the "size of" a function type
5242 or of "void". GNU C assigns these types a size of 1, for
5243 convenience in calculations with "void *" pointers and pointers to
5244 functions. In C++, warn also when an arithmetic operation involves
5245 "NULL". This warning is also enabled by -Wpedantic.
5246
5247 -Wpointer-compare
5248 Warn if a pointer is compared with a zero character constant. This
5249 usually means that the pointer was meant to be dereferenced. For
5250 example:
5251
5252 const char *p = foo ();
5253 if (p == '\0')
5254 return 42;
5255
5256 Note that the code above is invalid in C++11.
5257
5258 This warning is enabled by default.
5259
5260 -Wtype-limits
5261 Warn if a comparison is always true or always false due to the
5262 limited range of the data type, but do not warn for constant
5263 expressions. For example, warn if an unsigned variable is compared
5264 against zero with "<" or ">=". This warning is also enabled by
5265 -Wextra.
5266
5267 -Wabsolute-value (C and Objective-C only)
5268 Warn for calls to standard functions that compute the absolute
5269 value of an argument when a more appropriate standard function is
5270 available. For example, calling "abs(3.14)" triggers the warning
5271 because the appropriate function to call to compute the absolute
5272 value of a double argument is "fabs". The option also triggers
5273 warnings when the argument in a call to such a function has an
5274 unsigned type. This warning can be suppressed with an explicit
5275 type cast and it is also enabled by -Wextra.
5276
5277 -Wcomment
5278 -Wcomments
5279 Warn whenever a comment-start sequence /* appears in a /* comment,
5280 or whenever a backslash-newline appears in a // comment. This
5281 warning is enabled by -Wall.
5282
5283 -Wtrigraphs
5284 Warn if any trigraphs are encountered that might change the meaning
5285 of the program. Trigraphs within comments are not warned about,
5286 except those that would form escaped newlines.
5287
5288 This option is implied by -Wall. If -Wall is not given, this
5289 option is still enabled unless trigraphs are enabled. To get
5290 trigraph conversion without warnings, but get the other -Wall
5291 warnings, use -trigraphs -Wall -Wno-trigraphs.
5292
5293 -Wundef
5294 Warn if an undefined identifier is evaluated in an "#if" directive.
5295 Such identifiers are replaced with zero.
5296
5297 -Wexpansion-to-defined
5298 Warn whenever defined is encountered in the expansion of a macro
5299 (including the case where the macro is expanded by an #if
5300 directive). Such usage is not portable. This warning is also
5301 enabled by -Wpedantic and -Wextra.
5302
5303 -Wunused-macros
5304 Warn about macros defined in the main file that are unused. A
5305 macro is used if it is expanded or tested for existence at least
5306 once. The preprocessor also warns if the macro has not been used
5307 at the time it is redefined or undefined.
5308
5309 Built-in macros, macros defined on the command line, and macros
5310 defined in include files are not warned about.
5311
5312 Note: If a macro is actually used, but only used in skipped
5313 conditional blocks, then the preprocessor reports it as unused. To
5314 avoid the warning in such a case, you might improve the scope of
5315 the macro's definition by, for example, moving it into the first
5316 skipped block. Alternatively, you could provide a dummy use with
5317 something like:
5318
5319 #if defined the_macro_causing_the_warning
5320 #endif
5321
5322 -Wno-endif-labels
5323 Do not warn whenever an "#else" or an "#endif" are followed by
5324 text. This sometimes happens in older programs with code of the
5325 form
5326
5327 #if FOO
5328 ...
5329 #else FOO
5330 ...
5331 #endif FOO
5332
5333 The second and third "FOO" should be in comments. This warning is
5334 on by default.
5335
5336 -Wbad-function-cast (C and Objective-C only)
5337 Warn when a function call is cast to a non-matching type. For
5338 example, warn if a call to a function returning an integer type is
5339 cast to a pointer type.
5340
5341 -Wc90-c99-compat (C and Objective-C only)
5342 Warn about features not present in ISO C90, but present in ISO C99.
5343 For instance, warn about use of variable length arrays, "long long"
5344 type, "bool" type, compound literals, designated initializers, and
5345 so on. This option is independent of the standards mode. Warnings
5346 are disabled in the expression that follows "__extension__".
5347
5348 -Wc99-c11-compat (C and Objective-C only)
5349 Warn about features not present in ISO C99, but present in ISO C11.
5350 For instance, warn about use of anonymous structures and unions,
5351 "_Atomic" type qualifier, "_Thread_local" storage-class specifier,
5352 "_Alignas" specifier, "Alignof" operator, "_Generic" keyword, and
5353 so on. This option is independent of the standards mode. Warnings
5354 are disabled in the expression that follows "__extension__".
5355
5356 -Wc++-compat (C and Objective-C only)
5357 Warn about ISO C constructs that are outside of the common subset
5358 of ISO C and ISO C++, e.g. request for implicit conversion from
5359 "void *" to a pointer to non-"void" type.
5360
5361 -Wc++11-compat (C++ and Objective-C++ only)
5362 Warn about C++ constructs whose meaning differs between ISO C++
5363 1998 and ISO C++ 2011, e.g., identifiers in ISO C++ 1998 that are
5364 keywords in ISO C++ 2011. This warning turns on -Wnarrowing and is
5365 enabled by -Wall.
5366
5367 -Wc++14-compat (C++ and Objective-C++ only)
5368 Warn about C++ constructs whose meaning differs between ISO C++
5369 2011 and ISO C++ 2014. This warning is enabled by -Wall.
5370
5371 -Wc++17-compat (C++ and Objective-C++ only)
5372 Warn about C++ constructs whose meaning differs between ISO C++
5373 2014 and ISO C++ 2017. This warning is enabled by -Wall.
5374
5375 -Wcast-qual
5376 Warn whenever a pointer is cast so as to remove a type qualifier
5377 from the target type. For example, warn if a "const char *" is
5378 cast to an ordinary "char *".
5379
5380 Also warn when making a cast that introduces a type qualifier in an
5381 unsafe way. For example, casting "char **" to "const char **" is
5382 unsafe, as in this example:
5383
5384 /* p is char ** value. */
5385 const char **q = (const char **) p;
5386 /* Assignment of readonly string to const char * is OK. */
5387 *q = "string";
5388 /* Now char** pointer points to read-only memory. */
5389 **p = 'b';
5390
5391 -Wcast-align
5392 Warn whenever a pointer is cast such that the required alignment of
5393 the target is increased. For example, warn if a "char *" is cast
5394 to an "int *" on machines where integers can only be accessed at
5395 two- or four-byte boundaries.
5396
5397 -Wcast-align=strict
5398 Warn whenever a pointer is cast such that the required alignment of
5399 the target is increased. For example, warn if a "char *" is cast
5400 to an "int *" regardless of the target machine.
5401
5402 -Wcast-function-type
5403 Warn when a function pointer is cast to an incompatible function
5404 pointer. In a cast involving function types with a variable
5405 argument list only the types of initial arguments that are provided
5406 are considered. Any parameter of pointer-type matches any other
5407 pointer-type. Any benign differences in integral types are
5408 ignored, like "int" vs. "long" on ILP32 targets. Likewise type
5409 qualifiers are ignored. The function type "void (*) (void)" is
5410 special and matches everything, which can be used to suppress this
5411 warning. In a cast involving pointer to member types this warning
5412 warns whenever the type cast is changing the pointer to member
5413 type. This warning is enabled by -Wextra.
5414
5415 -Wwrite-strings
5416 When compiling C, give string constants the type "const
5417 char[length]" so that copying the address of one into a non-"const"
5418 "char *" pointer produces a warning. These warnings help you find
5419 at compile time code that can try to write into a string constant,
5420 but only if you have been very careful about using "const" in
5421 declarations and prototypes. Otherwise, it is just a nuisance.
5422 This is why we did not make -Wall request these warnings.
5423
5424 When compiling C++, warn about the deprecated conversion from
5425 string literals to "char *". This warning is enabled by default
5426 for C++ programs.
5427
5428 -Wcatch-value
5429 -Wcatch-value=n (C++ and Objective-C++ only)
5430 Warn about catch handlers that do not catch via reference. With
5431 -Wcatch-value=1 (or -Wcatch-value for short) warn about polymorphic
5432 class types that are caught by value. With -Wcatch-value=2 warn
5433 about all class types that are caught by value. With
5434 -Wcatch-value=3 warn about all types that are not caught by
5435 reference. -Wcatch-value is enabled by -Wall.
5436
5437 -Wclobbered
5438 Warn for variables that might be changed by "longjmp" or "vfork".
5439 This warning is also enabled by -Wextra.
5440
5441 -Wconditionally-supported (C++ and Objective-C++ only)
5442 Warn for conditionally-supported (C++11 [intro.defs]) constructs.
5443
5444 -Wconversion
5445 Warn for implicit conversions that may alter a value. This includes
5446 conversions between real and integer, like "abs (x)" when "x" is
5447 "double"; conversions between signed and unsigned, like "unsigned
5448 ui = -1"; and conversions to smaller types, like "sqrtf (M_PI)". Do
5449 not warn for explicit casts like "abs ((int) x)" and "ui =
5450 (unsigned) -1", or if the value is not changed by the conversion
5451 like in "abs (2.0)". Warnings about conversions between signed and
5452 unsigned integers can be disabled by using -Wno-sign-conversion.
5453
5454 For C++, also warn for confusing overload resolution for user-
5455 defined conversions; and conversions that never use a type
5456 conversion operator: conversions to "void", the same type, a base
5457 class or a reference to them. Warnings about conversions between
5458 signed and unsigned integers are disabled by default in C++ unless
5459 -Wsign-conversion is explicitly enabled.
5460
5461 -Wno-conversion-null (C++ and Objective-C++ only)
5462 Do not warn for conversions between "NULL" and non-pointer types.
5463 -Wconversion-null is enabled by default.
5464
5465 -Wzero-as-null-pointer-constant (C++ and Objective-C++ only)
5466 Warn when a literal 0 is used as null pointer constant. This can
5467 be useful to facilitate the conversion to "nullptr" in C++11.
5468
5469 -Wsubobject-linkage (C++ and Objective-C++ only)
5470 Warn if a class type has a base or a field whose type uses the
5471 anonymous namespace or depends on a type with no linkage. If a
5472 type A depends on a type B with no or internal linkage, defining it
5473 in multiple translation units would be an ODR violation because the
5474 meaning of B is different in each translation unit. If A only
5475 appears in a single translation unit, the best way to silence the
5476 warning is to give it internal linkage by putting it in an
5477 anonymous namespace as well. The compiler doesn't give this
5478 warning for types defined in the main .C file, as those are
5479 unlikely to have multiple definitions. -Wsubobject-linkage is
5480 enabled by default.
5481
5482 -Wdangling-else
5483 Warn about constructions where there may be confusion to which "if"
5484 statement an "else" branch belongs. Here is an example of such a
5485 case:
5486
5487 {
5488 if (a)
5489 if (b)
5490 foo ();
5491 else
5492 bar ();
5493 }
5494
5495 In C/C++, every "else" branch belongs to the innermost possible
5496 "if" statement, which in this example is "if (b)". This is often
5497 not what the programmer expected, as illustrated in the above
5498 example by indentation the programmer chose. When there is the
5499 potential for this confusion, GCC issues a warning when this flag
5500 is specified. To eliminate the warning, add explicit braces around
5501 the innermost "if" statement so there is no way the "else" can
5502 belong to the enclosing "if". The resulting code looks like this:
5503
5504 {
5505 if (a)
5506 {
5507 if (b)
5508 foo ();
5509 else
5510 bar ();
5511 }
5512 }
5513
5514 This warning is enabled by -Wparentheses.
5515
5516 -Wdate-time
5517 Warn when macros "__TIME__", "__DATE__" or "__TIMESTAMP__" are
5518 encountered as they might prevent bit-wise-identical reproducible
5519 compilations.
5520
5521 -Wdelete-incomplete (C++ and Objective-C++ only)
5522 Warn when deleting a pointer to incomplete type, which may cause
5523 undefined behavior at runtime. This warning is enabled by default.
5524
5525 -Wuseless-cast (C++ and Objective-C++ only)
5526 Warn when an expression is casted to its own type.
5527
5528 -Wempty-body
5529 Warn if an empty body occurs in an "if", "else" or "do while"
5530 statement. This warning is also enabled by -Wextra.
5531
5532 -Wenum-compare
5533 Warn about a comparison between values of different enumerated
5534 types. In C++ enumerated type mismatches in conditional
5535 expressions are also diagnosed and the warning is enabled by
5536 default. In C this warning is enabled by -Wall.
5537
5538 -Wextra-semi (C++, Objective-C++ only)
5539 Warn about redundant semicolon after in-class function definition.
5540
5541 -Wjump-misses-init (C, Objective-C only)
5542 Warn if a "goto" statement or a "switch" statement jumps forward
5543 across the initialization of a variable, or jumps backward to a
5544 label after the variable has been initialized. This only warns
5545 about variables that are initialized when they are declared. This
5546 warning is only supported for C and Objective-C; in C++ this sort
5547 of branch is an error in any case.
5548
5549 -Wjump-misses-init is included in -Wc++-compat. It can be disabled
5550 with the -Wno-jump-misses-init option.
5551
5552 -Wsign-compare
5553 Warn when a comparison between signed and unsigned values could
5554 produce an incorrect result when the signed value is converted to
5555 unsigned. In C++, this warning is also enabled by -Wall. In C, it
5556 is also enabled by -Wextra.
5557
5558 -Wsign-conversion
5559 Warn for implicit conversions that may change the sign of an
5560 integer value, like assigning a signed integer expression to an
5561 unsigned integer variable. An explicit cast silences the warning.
5562 In C, this option is enabled also by -Wconversion.
5563
5564 -Wfloat-conversion
5565 Warn for implicit conversions that reduce the precision of a real
5566 value. This includes conversions from real to integer, and from
5567 higher precision real to lower precision real values. This option
5568 is also enabled by -Wconversion.
5569
5570 -Wno-scalar-storage-order
5571 Do not warn on suspicious constructs involving reverse scalar
5572 storage order.
5573
5574 -Wsized-deallocation (C++ and Objective-C++ only)
5575 Warn about a definition of an unsized deallocation function
5576
5577 void operator delete (void *) noexcept;
5578 void operator delete[] (void *) noexcept;
5579
5580 without a definition of the corresponding sized deallocation
5581 function
5582
5583 void operator delete (void *, std::size_t) noexcept;
5584 void operator delete[] (void *, std::size_t) noexcept;
5585
5586 or vice versa. Enabled by -Wextra along with -fsized-deallocation.
5587
5588 -Wsizeof-pointer-div
5589 Warn for suspicious divisions of two sizeof expressions that divide
5590 the pointer size by the element size, which is the usual way to
5591 compute the array size but won't work out correctly with pointers.
5592 This warning warns e.g. about "sizeof (ptr) / sizeof (ptr[0])" if
5593 "ptr" is not an array, but a pointer. This warning is enabled by
5594 -Wall.
5595
5596 -Wsizeof-pointer-memaccess
5597 Warn for suspicious length parameters to certain string and memory
5598 built-in functions if the argument uses "sizeof". This warning
5599 triggers for example for "memset (ptr, 0, sizeof (ptr));" if "ptr"
5600 is not an array, but a pointer, and suggests a possible fix, or
5601 about "memcpy (&foo, ptr, sizeof (&foo));".
5602 -Wsizeof-pointer-memaccess also warns about calls to bounded string
5603 copy functions like "strncat" or "strncpy" that specify as the
5604 bound a "sizeof" expression of the source array. For example, in
5605 the following function the call to "strncat" specifies the size of
5606 the source string as the bound. That is almost certainly a mistake
5607 and so the call is diagnosed.
5608
5609 void make_file (const char *name)
5610 {
5611 char path[PATH_MAX];
5612 strncpy (path, name, sizeof path - 1);
5613 strncat (path, ".text", sizeof ".text");
5614 ...
5615 }
5616
5617 The -Wsizeof-pointer-memaccess option is enabled by -Wall.
5618
5619 -Wsizeof-array-argument
5620 Warn when the "sizeof" operator is applied to a parameter that is
5621 declared as an array in a function definition. This warning is
5622 enabled by default for C and C++ programs.
5623
5624 -Wmemset-elt-size
5625 Warn for suspicious calls to the "memset" built-in function, if the
5626 first argument references an array, and the third argument is a
5627 number equal to the number of elements, but not equal to the size
5628 of the array in memory. This indicates that the user has omitted a
5629 multiplication by the element size. This warning is enabled by
5630 -Wall.
5631
5632 -Wmemset-transposed-args
5633 Warn for suspicious calls to the "memset" built-in function where
5634 the second argument is not zero and the third argument is zero.
5635 For example, the call "memset (buf, sizeof buf, 0)" is diagnosed
5636 because "memset (buf, 0, sizeof buf)" was meant instead. The
5637 diagnostic is only emitted if the third argument is a literal zero.
5638 Otherwise, if it is an expression that is folded to zero, or a cast
5639 of zero to some type, it is far less likely that the arguments have
5640 been mistakenly transposed and no warning is emitted. This warning
5641 is enabled by -Wall.
5642
5643 -Waddress
5644 Warn about suspicious uses of memory addresses. These include using
5645 the address of a function in a conditional expression, such as
5646 "void func(void); if (func)", and comparisons against the memory
5647 address of a string literal, such as "if (x == "abc")". Such uses
5648 typically indicate a programmer error: the address of a function
5649 always evaluates to true, so their use in a conditional usually
5650 indicate that the programmer forgot the parentheses in a function
5651 call; and comparisons against string literals result in unspecified
5652 behavior and are not portable in C, so they usually indicate that
5653 the programmer intended to use "strcmp". This warning is enabled
5654 by -Wall.
5655
5656 -Waddress-of-packed-member
5657 Warn when the address of packed member of struct or union is taken,
5658 which usually results in an unaligned pointer value. This is
5659 enabled by default.
5660
5661 -Wlogical-op
5662 Warn about suspicious uses of logical operators in expressions.
5663 This includes using logical operators in contexts where a bit-wise
5664 operator is likely to be expected. Also warns when the operands of
5665 a logical operator are the same:
5666
5667 extern int a;
5668 if (a < 0 && a < 0) { ... }
5669
5670 -Wlogical-not-parentheses
5671 Warn about logical not used on the left hand side operand of a
5672 comparison. This option does not warn if the right operand is
5673 considered to be a boolean expression. Its purpose is to detect
5674 suspicious code like the following:
5675
5676 int a;
5677 ...
5678 if (!a > 1) { ... }
5679
5680 It is possible to suppress the warning by wrapping the LHS into
5681 parentheses:
5682
5683 if ((!a) > 1) { ... }
5684
5685 This warning is enabled by -Wall.
5686
5687 -Waggregate-return
5688 Warn if any functions that return structures or unions are defined
5689 or called. (In languages where you can return an array, this also
5690 elicits a warning.)
5691
5692 -Wno-aggressive-loop-optimizations
5693 Warn if in a loop with constant number of iterations the compiler
5694 detects undefined behavior in some statement during one or more of
5695 the iterations.
5696
5697 -Wno-attributes
5698 Do not warn if an unexpected "__attribute__" is used, such as
5699 unrecognized attributes, function attributes applied to variables,
5700 etc. This does not stop errors for incorrect use of supported
5701 attributes.
5702
5703 -Wno-builtin-declaration-mismatch
5704 Warn if a built-in function is declared with an incompatible
5705 signature or as a non-function, or when a built-in function
5706 declared with a type that does not include a prototype is called
5707 with arguments whose promoted types do not match those expected by
5708 the function. When -Wextra is specified, also warn when a built-in
5709 function that takes arguments is declared without a prototype. The
5710 -Wno-builtin-declaration-mismatch warning is enabled by default.
5711 To avoid the warning include the appropriate header to bring the
5712 prototypes of built-in functions into scope.
5713
5714 For example, the call to "memset" below is diagnosed by the warning
5715 because the function expects a value of type "size_t" as its
5716 argument but the type of 32 is "int". With -Wextra, the
5717 declaration of the function is diagnosed as well.
5718
5719 extern void* memset ();
5720 void f (void *d)
5721 {
5722 memset (d, '\0', 32);
5723 }
5724
5725 -Wno-builtin-macro-redefined
5726 Do not warn if certain built-in macros are redefined. This
5727 suppresses warnings for redefinition of "__TIMESTAMP__",
5728 "__TIME__", "__DATE__", "__FILE__", and "__BASE_FILE__".
5729
5730 -Wstrict-prototypes (C and Objective-C only)
5731 Warn if a function is declared or defined without specifying the
5732 argument types. (An old-style function definition is permitted
5733 without a warning if preceded by a declaration that specifies the
5734 argument types.)
5735
5736 -Wold-style-declaration (C and Objective-C only)
5737 Warn for obsolescent usages, according to the C Standard, in a
5738 declaration. For example, warn if storage-class specifiers like
5739 "static" are not the first things in a declaration. This warning
5740 is also enabled by -Wextra.
5741
5742 -Wold-style-definition (C and Objective-C only)
5743 Warn if an old-style function definition is used. A warning is
5744 given even if there is a previous prototype.
5745
5746 -Wmissing-parameter-type (C and Objective-C only)
5747 A function parameter is declared without a type specifier in
5748 K&R-style functions:
5749
5750 void foo(bar) { }
5751
5752 This warning is also enabled by -Wextra.
5753
5754 -Wmissing-prototypes (C and Objective-C only)
5755 Warn if a global function is defined without a previous prototype
5756 declaration. This warning is issued even if the definition itself
5757 provides a prototype. Use this option to detect global functions
5758 that do not have a matching prototype declaration in a header file.
5759 This option is not valid for C++ because all function declarations
5760 provide prototypes and a non-matching declaration declares an
5761 overload rather than conflict with an earlier declaration. Use
5762 -Wmissing-declarations to detect missing declarations in C++.
5763
5764 -Wmissing-declarations
5765 Warn if a global function is defined without a previous
5766 declaration. Do so even if the definition itself provides a
5767 prototype. Use this option to detect global functions that are not
5768 declared in header files. In C, no warnings are issued for
5769 functions with previous non-prototype declarations; use
5770 -Wmissing-prototypes to detect missing prototypes. In C++, no
5771 warnings are issued for function templates, or for inline
5772 functions, or for functions in anonymous namespaces.
5773
5774 -Wmissing-field-initializers
5775 Warn if a structure's initializer has some fields missing. For
5776 example, the following code causes such a warning, because "x.h" is
5777 implicitly zero:
5778
5779 struct s { int f, g, h; };
5780 struct s x = { 3, 4 };
5781
5782 This option does not warn about designated initializers, so the
5783 following modification does not trigger a warning:
5784
5785 struct s { int f, g, h; };
5786 struct s x = { .f = 3, .g = 4 };
5787
5788 In C this option does not warn about the universal zero initializer
5789 { 0 }:
5790
5791 struct s { int f, g, h; };
5792 struct s x = { 0 };
5793
5794 Likewise, in C++ this option does not warn about the empty { }
5795 initializer, for example:
5796
5797 struct s { int f, g, h; };
5798 s x = { };
5799
5800 This warning is included in -Wextra. To get other -Wextra warnings
5801 without this one, use -Wextra -Wno-missing-field-initializers.
5802
5803 -Wno-multichar
5804 Do not warn if a multicharacter constant ('FOOF') is used. Usually
5805 they indicate a typo in the user's code, as they have
5806 implementation-defined values, and should not be used in portable
5807 code.
5808
5809 -Wnormalized=[none|id|nfc|nfkc]
5810 In ISO C and ISO C++, two identifiers are different if they are
5811 different sequences of characters. However, sometimes when
5812 characters outside the basic ASCII character set are used, you can
5813 have two different character sequences that look the same. To
5814 avoid confusion, the ISO 10646 standard sets out some normalization
5815 rules which when applied ensure that two sequences that look the
5816 same are turned into the same sequence. GCC can warn you if you
5817 are using identifiers that have not been normalized; this option
5818 controls that warning.
5819
5820 There are four levels of warning supported by GCC. The default is
5821 -Wnormalized=nfc, which warns about any identifier that is not in
5822 the ISO 10646 "C" normalized form, NFC. NFC is the recommended
5823 form for most uses. It is equivalent to -Wnormalized.
5824
5825 Unfortunately, there are some characters allowed in identifiers by
5826 ISO C and ISO C++ that, when turned into NFC, are not allowed in
5827 identifiers. That is, there's no way to use these symbols in
5828 portable ISO C or C++ and have all your identifiers in NFC.
5829 -Wnormalized=id suppresses the warning for these characters. It is
5830 hoped that future versions of the standards involved will correct
5831 this, which is why this option is not the default.
5832
5833 You can switch the warning off for all characters by writing
5834 -Wnormalized=none or -Wno-normalized. You should only do this if
5835 you are using some other normalization scheme (like "D"), because
5836 otherwise you can easily create bugs that are literally impossible
5837 to see.
5838
5839 Some characters in ISO 10646 have distinct meanings but look
5840 identical in some fonts or display methodologies, especially once
5841 formatting has been applied. For instance "\u207F", "SUPERSCRIPT
5842 LATIN SMALL LETTER N", displays just like a regular "n" that has
5843 been placed in a superscript. ISO 10646 defines the NFKC
5844 normalization scheme to convert all these into a standard form as
5845 well, and GCC warns if your code is not in NFKC if you use
5846 -Wnormalized=nfkc. This warning is comparable to warning about
5847 every identifier that contains the letter O because it might be
5848 confused with the digit 0, and so is not the default, but may be
5849 useful as a local coding convention if the programming environment
5850 cannot be fixed to display these characters distinctly.
5851
5852 -Wno-attribute-warning
5853 Do not warn about usage of functions declared with "warning"
5854 attribute. By default, this warning is enabled.
5855 -Wno-attribute-warning can be used to disable the warning or
5856 -Wno-error=attribute-warning can be used to disable the error when
5857 compiled with -Werror flag.
5858
5859 -Wno-deprecated
5860 Do not warn about usage of deprecated features.
5861
5862 -Wno-deprecated-declarations
5863 Do not warn about uses of functions, variables, and types marked as
5864 deprecated by using the "deprecated" attribute.
5865
5866 -Wno-overflow
5867 Do not warn about compile-time overflow in constant expressions.
5868
5869 -Wno-odr
5870 Warn about One Definition Rule violations during link-time
5871 optimization. Requires -flto-odr-type-merging to be enabled.
5872 Enabled by default.
5873
5874 -Wopenmp-simd
5875 Warn if the vectorizer cost model overrides the OpenMP simd
5876 directive set by user. The -fsimd-cost-model=unlimited option can
5877 be used to relax the cost model.
5878
5879 -Woverride-init (C and Objective-C only)
5880 Warn if an initialized field without side effects is overridden
5881 when using designated initializers.
5882
5883 This warning is included in -Wextra. To get other -Wextra warnings
5884 without this one, use -Wextra -Wno-override-init.
5885
5886 -Woverride-init-side-effects (C and Objective-C only)
5887 Warn if an initialized field with side effects is overridden when
5888 using designated initializers. This warning is enabled by default.
5889
5890 -Wpacked
5891 Warn if a structure is given the packed attribute, but the packed
5892 attribute has no effect on the layout or size of the structure.
5893 Such structures may be mis-aligned for little benefit. For
5894 instance, in this code, the variable "f.x" in "struct bar" is
5895 misaligned even though "struct bar" does not itself have the packed
5896 attribute:
5897
5898 struct foo {
5899 int x;
5900 char a, b, c, d;
5901 } __attribute__((packed));
5902 struct bar {
5903 char z;
5904 struct foo f;
5905 };
5906
5907 -Wpacked-bitfield-compat
5908 The 4.1, 4.2 and 4.3 series of GCC ignore the "packed" attribute on
5909 bit-fields of type "char". This has been fixed in GCC 4.4 but the
5910 change can lead to differences in the structure layout. GCC
5911 informs you when the offset of such a field has changed in GCC 4.4.
5912 For example there is no longer a 4-bit padding between field "a"
5913 and "b" in this structure:
5914
5915 struct foo
5916 {
5917 char a:4;
5918 char b:8;
5919 } __attribute__ ((packed));
5920
5921 This warning is enabled by default. Use
5922 -Wno-packed-bitfield-compat to disable this warning.
5923
5924 -Wpacked-not-aligned (C, C++, Objective-C and Objective-C++ only)
5925 Warn if a structure field with explicitly specified alignment in a
5926 packed struct or union is misaligned. For example, a warning will
5927 be issued on "struct S", like, "warning: alignment 1 of 'struct S'
5928 is less than 8", in this code:
5929
5930 struct __attribute__ ((aligned (8))) S8 { char a[8]; };
5931 struct __attribute__ ((packed)) S {
5932 struct S8 s8;
5933 };
5934
5935 This warning is enabled by -Wall.
5936
5937 -Wpadded
5938 Warn if padding is included in a structure, either to align an
5939 element of the structure or to align the whole structure.
5940 Sometimes when this happens it is possible to rearrange the fields
5941 of the structure to reduce the padding and so make the structure
5942 smaller.
5943
5944 -Wredundant-decls
5945 Warn if anything is declared more than once in the same scope, even
5946 in cases where multiple declaration is valid and changes nothing.
5947
5948 -Wno-restrict
5949 Warn when an object referenced by a "restrict"-qualified parameter
5950 (or, in C++, a "__restrict"-qualified parameter) is aliased by
5951 another argument, or when copies between such objects overlap. For
5952 example, the call to the "strcpy" function below attempts to
5953 truncate the string by replacing its initial characters with the
5954 last four. However, because the call writes the terminating NUL
5955 into "a[4]", the copies overlap and the call is diagnosed.
5956
5957 void foo (void)
5958 {
5959 char a[] = "abcd1234";
5960 strcpy (a, a + 4);
5961 ...
5962 }
5963
5964 The -Wrestrict option detects some instances of simple overlap even
5965 without optimization but works best at -O2 and above. It is
5966 included in -Wall.
5967
5968 -Wnested-externs (C and Objective-C only)
5969 Warn if an "extern" declaration is encountered within a function.
5970
5971 -Wno-inherited-variadic-ctor
5972 Suppress warnings about use of C++11 inheriting constructors when
5973 the base class inherited from has a C variadic constructor; the
5974 warning is on by default because the ellipsis is not inherited.
5975
5976 -Winline
5977 Warn if a function that is declared as inline cannot be inlined.
5978 Even with this option, the compiler does not warn about failures to
5979 inline functions declared in system headers.
5980
5981 The compiler uses a variety of heuristics to determine whether or
5982 not to inline a function. For example, the compiler takes into
5983 account the size of the function being inlined and the amount of
5984 inlining that has already been done in the current function.
5985 Therefore, seemingly insignificant changes in the source program
5986 can cause the warnings produced by -Winline to appear or disappear.
5987
5988 -Wno-invalid-offsetof (C++ and Objective-C++ only)
5989 Suppress warnings from applying the "offsetof" macro to a non-POD
5990 type. According to the 2014 ISO C++ standard, applying "offsetof"
5991 to a non-standard-layout type is undefined. In existing C++
5992 implementations, however, "offsetof" typically gives meaningful
5993 results. This flag is for users who are aware that they are
5994 writing nonportable code and who have deliberately chosen to ignore
5995 the warning about it.
5996
5997 The restrictions on "offsetof" may be relaxed in a future version
5998 of the C++ standard.
5999
6000 -Wint-in-bool-context
6001 Warn for suspicious use of integer values where boolean values are
6002 expected, such as conditional expressions (?:) using non-boolean
6003 integer constants in boolean context, like "if (a <= b ? 2 : 3)".
6004 Or left shifting of signed integers in boolean context, like "for
6005 (a = 0; 1 << a; a++);". Likewise for all kinds of multiplications
6006 regardless of the data type. This warning is enabled by -Wall.
6007
6008 -Wno-int-to-pointer-cast
6009 Suppress warnings from casts to pointer type of an integer of a
6010 different size. In C++, casting to a pointer type of smaller size
6011 is an error. Wint-to-pointer-cast is enabled by default.
6012
6013 -Wno-pointer-to-int-cast (C and Objective-C only)
6014 Suppress warnings from casts from a pointer to an integer type of a
6015 different size.
6016
6017 -Winvalid-pch
6018 Warn if a precompiled header is found in the search path but cannot
6019 be used.
6020
6021 -Wlong-long
6022 Warn if "long long" type is used. This is enabled by either
6023 -Wpedantic or -Wtraditional in ISO C90 and C++98 modes. To inhibit
6024 the warning messages, use -Wno-long-long.
6025
6026 -Wvariadic-macros
6027 Warn if variadic macros are used in ISO C90 mode, or if the GNU
6028 alternate syntax is used in ISO C99 mode. This is enabled by
6029 either -Wpedantic or -Wtraditional. To inhibit the warning
6030 messages, use -Wno-variadic-macros.
6031
6032 -Wvarargs
6033 Warn upon questionable usage of the macros used to handle variable
6034 arguments like "va_start". This is default. To inhibit the
6035 warning messages, use -Wno-varargs.
6036
6037 -Wvector-operation-performance
6038 Warn if vector operation is not implemented via SIMD capabilities
6039 of the architecture. Mainly useful for the performance tuning.
6040 Vector operation can be implemented "piecewise", which means that
6041 the scalar operation is performed on every vector element; "in
6042 parallel", which means that the vector operation is implemented
6043 using scalars of wider type, which normally is more performance
6044 efficient; and "as a single scalar", which means that vector fits
6045 into a scalar type.
6046
6047 -Wno-virtual-move-assign
6048 Suppress warnings about inheriting from a virtual base with a non-
6049 trivial C++11 move assignment operator. This is dangerous because
6050 if the virtual base is reachable along more than one path, it is
6051 moved multiple times, which can mean both objects end up in the
6052 moved-from state. If the move assignment operator is written to
6053 avoid moving from a moved-from object, this warning can be
6054 disabled.
6055
6056 -Wvla
6057 Warn if a variable-length array is used in the code. -Wno-vla
6058 prevents the -Wpedantic warning of the variable-length array.
6059
6060 -Wvla-larger-than=byte-size
6061 If this option is used, the compiler will warn for declarations of
6062 variable-length arrays whose size is either unbounded, or bounded
6063 by an argument that allows the array size to exceed byte-size
6064 bytes. This is similar to how -Walloca-larger-than=byte-size
6065 works, but with variable-length arrays.
6066
6067 Note that GCC may optimize small variable-length arrays of a known
6068 value into plain arrays, so this warning may not get triggered for
6069 such arrays.
6070
6071 -Wvla-larger-than=PTRDIFF_MAX is enabled by default but is
6072 typically only effective when -ftree-vrp is active (default for -O2
6073 and above).
6074
6075 See also -Walloca-larger-than=byte-size.
6076
6077 -Wno-vla-larger-than
6078 Disable -Wvla-larger-than= warnings. The option is equivalent to
6079 -Wvla-larger-than=SIZE_MAX or larger.
6080
6081 -Wvolatile-register-var
6082 Warn if a register variable is declared volatile. The volatile
6083 modifier does not inhibit all optimizations that may eliminate
6084 reads and/or writes to register variables. This warning is enabled
6085 by -Wall.
6086
6087 -Wdisabled-optimization
6088 Warn if a requested optimization pass is disabled. This warning
6089 does not generally indicate that there is anything wrong with your
6090 code; it merely indicates that GCC's optimizers are unable to
6091 handle the code effectively. Often, the problem is that your code
6092 is too big or too complex; GCC refuses to optimize programs when
6093 the optimization itself is likely to take inordinate amounts of
6094 time.
6095
6096 -Wpointer-sign (C and Objective-C only)
6097 Warn for pointer argument passing or assignment with different
6098 signedness. This option is only supported for C and Objective-C.
6099 It is implied by -Wall and by -Wpedantic, which can be disabled
6100 with -Wno-pointer-sign.
6101
6102 -Wstack-protector
6103 This option is only active when -fstack-protector is active. It
6104 warns about functions that are not protected against stack
6105 smashing.
6106
6107 -Woverlength-strings
6108 Warn about string constants that are longer than the "minimum
6109 maximum" length specified in the C standard. Modern compilers
6110 generally allow string constants that are much longer than the
6111 standard's minimum limit, but very portable programs should avoid
6112 using longer strings.
6113
6114 The limit applies after string constant concatenation, and does not
6115 count the trailing NUL. In C90, the limit was 509 characters; in
6116 C99, it was raised to 4095. C++98 does not specify a normative
6117 minimum maximum, so we do not diagnose overlength strings in C++.
6118
6119 This option is implied by -Wpedantic, and can be disabled with
6120 -Wno-overlength-strings.
6121
6122 -Wunsuffixed-float-constants (C and Objective-C only)
6123 Issue a warning for any floating constant that does not have a
6124 suffix. When used together with -Wsystem-headers it warns about
6125 such constants in system header files. This can be useful when
6126 preparing code to use with the "FLOAT_CONST_DECIMAL64" pragma from
6127 the decimal floating-point extension to C99.
6128
6129 -Wno-designated-init (C and Objective-C only)
6130 Suppress warnings when a positional initializer is used to
6131 initialize a structure that has been marked with the
6132 "designated_init" attribute.
6133
6134 -Whsa
6135 Issue a warning when HSAIL cannot be emitted for the compiled
6136 function or OpenMP construct.
6137
6138 Options for Debugging Your Program
6139 To tell GCC to emit extra information for use by a debugger, in almost
6140 all cases you need only to add -g to your other options.
6141
6142 GCC allows you to use -g with -O. The shortcuts taken by optimized
6143 code may occasionally be surprising: some variables you declared may
6144 not exist at all; flow of control may briefly move where you did not
6145 expect it; some statements may not be executed because they compute
6146 constant results or their values are already at hand; some statements
6147 may execute in different places because they have been moved out of
6148 loops. Nevertheless it is possible to debug optimized output. This
6149 makes it reasonable to use the optimizer for programs that might have
6150 bugs.
6151
6152 If you are not using some other optimization option, consider using -Og
6153 with -g. With no -O option at all, some compiler passes that collect
6154 information useful for debugging do not run at all, so that -Og may
6155 result in a better debugging experience.
6156
6157 -g Produce debugging information in the operating system's native
6158 format (stabs, COFF, XCOFF, or DWARF). GDB can work with this
6159 debugging information.
6160
6161 On most systems that use stabs format, -g enables use of extra
6162 debugging information that only GDB can use; this extra information
6163 makes debugging work better in GDB but probably makes other
6164 debuggers crash or refuse to read the program. If you want to
6165 control for certain whether to generate the extra information, use
6166 -gstabs+, -gstabs, -gxcoff+, -gxcoff, or -gvms (see below).
6167
6168 -ggdb
6169 Produce debugging information for use by GDB. This means to use
6170 the most expressive format available (DWARF, stabs, or the native
6171 format if neither of those are supported), including GDB extensions
6172 if at all possible.
6173
6174 -gdwarf
6175 -gdwarf-version
6176 Produce debugging information in DWARF format (if that is
6177 supported). The value of version may be either 2, 3, 4 or 5; the
6178 default version for most targets is 4. DWARF Version 5 is only
6179 experimental.
6180
6181 Note that with DWARF Version 2, some ports require and always use
6182 some non-conflicting DWARF 3 extensions in the unwind tables.
6183
6184 Version 4 may require GDB 7.0 and -fvar-tracking-assignments for
6185 maximum benefit.
6186
6187 GCC no longer supports DWARF Version 1, which is substantially
6188 different than Version 2 and later. For historical reasons, some
6189 other DWARF-related options such as -fno-dwarf2-cfi-asm) retain a
6190 reference to DWARF Version 2 in their names, but apply to all
6191 currently-supported versions of DWARF.
6192
6193 -gstabs
6194 Produce debugging information in stabs format (if that is
6195 supported), without GDB extensions. This is the format used by DBX
6196 on most BSD systems. On MIPS, Alpha and System V Release 4 systems
6197 this option produces stabs debugging output that is not understood
6198 by DBX. On System V Release 4 systems this option requires the GNU
6199 assembler.
6200
6201 -gstabs+
6202 Produce debugging information in stabs format (if that is
6203 supported), using GNU extensions understood only by the GNU
6204 debugger (GDB). The use of these extensions is likely to make
6205 other debuggers crash or refuse to read the program.
6206
6207 -gxcoff
6208 Produce debugging information in XCOFF format (if that is
6209 supported). This is the format used by the DBX debugger on IBM
6210 RS/6000 systems.
6211
6212 -gxcoff+
6213 Produce debugging information in XCOFF format (if that is
6214 supported), using GNU extensions understood only by the GNU
6215 debugger (GDB). The use of these extensions is likely to make
6216 other debuggers crash or refuse to read the program, and may cause
6217 assemblers other than the GNU assembler (GAS) to fail with an
6218 error.
6219
6220 -gvms
6221 Produce debugging information in Alpha/VMS debug format (if that is
6222 supported). This is the format used by DEBUG on Alpha/VMS systems.
6223
6224 -glevel
6225 -ggdblevel
6226 -gstabslevel
6227 -gxcofflevel
6228 -gvmslevel
6229 Request debugging information and also use level to specify how
6230 much information. The default level is 2.
6231
6232 Level 0 produces no debug information at all. Thus, -g0 negates
6233 -g.
6234
6235 Level 1 produces minimal information, enough for making backtraces
6236 in parts of the program that you don't plan to debug. This
6237 includes descriptions of functions and external variables, and line
6238 number tables, but no information about local variables.
6239
6240 Level 3 includes extra information, such as all the macro
6241 definitions present in the program. Some debuggers support macro
6242 expansion when you use -g3.
6243
6244 If you use multiple -g options, with or without level numbers, the
6245 last such option is the one that is effective.
6246
6247 -gdwarf does not accept a concatenated debug level, to avoid
6248 confusion with -gdwarf-level. Instead use an additional -glevel
6249 option to change the debug level for DWARF.
6250
6251 -feliminate-unused-debug-symbols
6252 Produce debugging information in stabs format (if that is
6253 supported), for only symbols that are actually used.
6254
6255 -femit-class-debug-always
6256 Instead of emitting debugging information for a C++ class in only
6257 one object file, emit it in all object files using the class. This
6258 option should be used only with debuggers that are unable to handle
6259 the way GCC normally emits debugging information for classes
6260 because using this option increases the size of debugging
6261 information by as much as a factor of two.
6262
6263 -fno-merge-debug-strings
6264 Direct the linker to not merge together strings in the debugging
6265 information that are identical in different object files. Merging
6266 is not supported by all assemblers or linkers. Merging decreases
6267 the size of the debug information in the output file at the cost of
6268 increasing link processing time. Merging is enabled by default.
6269
6270 -fdebug-prefix-map=old=new
6271 When compiling files residing in directory old, record debugging
6272 information describing them as if the files resided in directory
6273 new instead. This can be used to replace a build-time path with an
6274 install-time path in the debug info. It can also be used to change
6275 an absolute path to a relative path by using . for new. This can
6276 give more reproducible builds, which are location independent, but
6277 may require an extra command to tell GDB where to find the source
6278 files. See also -ffile-prefix-map.
6279
6280 -fvar-tracking
6281 Run variable tracking pass. It computes where variables are stored
6282 at each position in code. Better debugging information is then
6283 generated (if the debugging information format supports this
6284 information).
6285
6286 It is enabled by default when compiling with optimization (-Os, -O,
6287 -O2, ...), debugging information (-g) and the debug info format
6288 supports it.
6289
6290 -fvar-tracking-assignments
6291 Annotate assignments to user variables early in the compilation and
6292 attempt to carry the annotations over throughout the compilation
6293 all the way to the end, in an attempt to improve debug information
6294 while optimizing. Use of -gdwarf-4 is recommended along with it.
6295
6296 It can be enabled even if var-tracking is disabled, in which case
6297 annotations are created and maintained, but discarded at the end.
6298 By default, this flag is enabled together with -fvar-tracking,
6299 except when selective scheduling is enabled.
6300
6301 -gsplit-dwarf
6302 Separate as much DWARF debugging information as possible into a
6303 separate output file with the extension .dwo. This option allows
6304 the build system to avoid linking files with debug information. To
6305 be useful, this option requires a debugger capable of reading .dwo
6306 files.
6307
6308 -gdescribe-dies
6309 Add description attributes to some DWARF DIEs that have no name
6310 attribute, such as artificial variables, external references and
6311 call site parameter DIEs.
6312
6313 -gpubnames
6314 Generate DWARF ".debug_pubnames" and ".debug_pubtypes" sections.
6315
6316 -ggnu-pubnames
6317 Generate ".debug_pubnames" and ".debug_pubtypes" sections in a
6318 format suitable for conversion into a GDB index. This option is
6319 only useful with a linker that can produce GDB index version 7.
6320
6321 -fdebug-types-section
6322 When using DWARF Version 4 or higher, type DIEs can be put into
6323 their own ".debug_types" section instead of making them part of the
6324 ".debug_info" section. It is more efficient to put them in a
6325 separate comdat section since the linker can then remove
6326 duplicates. But not all DWARF consumers support ".debug_types"
6327 sections yet and on some objects ".debug_types" produces larger
6328 instead of smaller debugging information.
6329
6330 -grecord-gcc-switches
6331 -gno-record-gcc-switches
6332 This switch causes the command-line options used to invoke the
6333 compiler that may affect code generation to be appended to the
6334 DW_AT_producer attribute in DWARF debugging information. The
6335 options are concatenated with spaces separating them from each
6336 other and from the compiler version. It is enabled by default.
6337 See also -frecord-gcc-switches for another way of storing compiler
6338 options into the object file.
6339
6340 -gstrict-dwarf
6341 Disallow using extensions of later DWARF standard version than
6342 selected with -gdwarf-version. On most targets using non-
6343 conflicting DWARF extensions from later standard versions is
6344 allowed.
6345
6346 -gno-strict-dwarf
6347 Allow using extensions of later DWARF standard version than
6348 selected with -gdwarf-version.
6349
6350 -gas-loc-support
6351 Inform the compiler that the assembler supports ".loc" directives.
6352 It may then use them for the assembler to generate DWARF2+ line
6353 number tables.
6354
6355 This is generally desirable, because assembler-generated line-
6356 number tables are a lot more compact than those the compiler can
6357 generate itself.
6358
6359 This option will be enabled by default if, at GCC configure time,
6360 the assembler was found to support such directives.
6361
6362 -gno-as-loc-support
6363 Force GCC to generate DWARF2+ line number tables internally, if
6364 DWARF2+ line number tables are to be generated.
6365
6366 gas-locview-support
6367 Inform the compiler that the assembler supports "view" assignment
6368 and reset assertion checking in ".loc" directives.
6369
6370 This option will be enabled by default if, at GCC configure time,
6371 the assembler was found to support them.
6372
6373 gno-as-locview-support
6374 Force GCC to assign view numbers internally, if
6375 -gvariable-location-views are explicitly requested.
6376
6377 -gcolumn-info
6378 -gno-column-info
6379 Emit location column information into DWARF debugging information,
6380 rather than just file and line. This option is enabled by default.
6381
6382 -gstatement-frontiers
6383 -gno-statement-frontiers
6384 This option causes GCC to create markers in the internal
6385 representation at the beginning of statements, and to keep them
6386 roughly in place throughout compilation, using them to guide the
6387 output of "is_stmt" markers in the line number table. This is
6388 enabled by default when compiling with optimization (-Os, -O, -O2,
6389 ...), and outputting DWARF 2 debug information at the normal level.
6390
6391 -gvariable-location-views
6392 -gvariable-location-views=incompat5
6393 -gno-variable-location-views
6394 Augment variable location lists with progressive view numbers
6395 implied from the line number table. This enables debug information
6396 consumers to inspect state at certain points of the program, even
6397 if no instructions associated with the corresponding source
6398 locations are present at that point. If the assembler lacks
6399 support for view numbers in line number tables, this will cause the
6400 compiler to emit the line number table, which generally makes them
6401 somewhat less compact. The augmented line number tables and
6402 location lists are fully backward-compatible, so they can be
6403 consumed by debug information consumers that are not aware of these
6404 augmentations, but they won't derive any benefit from them either.
6405
6406 This is enabled by default when outputting DWARF 2 debug
6407 information at the normal level, as long as there is assembler
6408 support, -fvar-tracking-assignments is enabled and -gstrict-dwarf
6409 is not. When assembler support is not available, this may still be
6410 enabled, but it will force GCC to output internal line number
6411 tables, and if -ginternal-reset-location-views is not enabled, that
6412 will most certainly lead to silently mismatching location views.
6413
6414 There is a proposed representation for view numbers that is not
6415 backward compatible with the location list format introduced in
6416 DWARF 5, that can be enabled with
6417 -gvariable-location-views=incompat5. This option may be removed in
6418 the future, is only provided as a reference implementation of the
6419 proposed representation. Debug information consumers are not
6420 expected to support this extended format, and they would be
6421 rendered unable to decode location lists using it.
6422
6423 -ginternal-reset-location-views
6424 -gnointernal-reset-location-views
6425 Attempt to determine location views that can be omitted from
6426 location view lists. This requires the compiler to have very
6427 accurate insn length estimates, which isn't always the case, and it
6428 may cause incorrect view lists to be generated silently when using
6429 an assembler that does not support location view lists. The GNU
6430 assembler will flag any such error as a "view number mismatch".
6431 This is only enabled on ports that define a reliable estimation
6432 function.
6433
6434 -ginline-points
6435 -gno-inline-points
6436 Generate extended debug information for inlined functions.
6437 Location view tracking markers are inserted at inlined entry
6438 points, so that address and view numbers can be computed and output
6439 in debug information. This can be enabled independently of
6440 location views, in which case the view numbers won't be output, but
6441 it can only be enabled along with statement frontiers, and it is
6442 only enabled by default if location views are enabled.
6443
6444 -gz[=type]
6445 Produce compressed debug sections in DWARF format, if that is
6446 supported. If type is not given, the default type depends on the
6447 capabilities of the assembler and linker used. type may be one of
6448 none (don't compress debug sections), zlib (use zlib compression in
6449 ELF gABI format), or zlib-gnu (use zlib compression in traditional
6450 GNU format). If the linker doesn't support writing compressed
6451 debug sections, the option is rejected. Otherwise, if the
6452 assembler does not support them, -gz is silently ignored when
6453 producing object files.
6454
6455 -femit-struct-debug-baseonly
6456 Emit debug information for struct-like types only when the base
6457 name of the compilation source file matches the base name of file
6458 in which the struct is defined.
6459
6460 This option substantially reduces the size of debugging
6461 information, but at significant potential loss in type information
6462 to the debugger. See -femit-struct-debug-reduced for a less
6463 aggressive option. See -femit-struct-debug-detailed for more
6464 detailed control.
6465
6466 This option works only with DWARF debug output.
6467
6468 -femit-struct-debug-reduced
6469 Emit debug information for struct-like types only when the base
6470 name of the compilation source file matches the base name of file
6471 in which the type is defined, unless the struct is a template or
6472 defined in a system header.
6473
6474 This option significantly reduces the size of debugging
6475 information, with some potential loss in type information to the
6476 debugger. See -femit-struct-debug-baseonly for a more aggressive
6477 option. See -femit-struct-debug-detailed for more detailed
6478 control.
6479
6480 This option works only with DWARF debug output.
6481
6482 -femit-struct-debug-detailed[=spec-list]
6483 Specify the struct-like types for which the compiler generates
6484 debug information. The intent is to reduce duplicate struct debug
6485 information between different object files within the same program.
6486
6487 This option is a detailed version of -femit-struct-debug-reduced
6488 and -femit-struct-debug-baseonly, which serves for most needs.
6489
6490 A specification has the
6491 syntax[dir:|ind:][ord:|gen:](any|sys|base|none)
6492
6493 The optional first word limits the specification to structs that
6494 are used directly (dir:) or used indirectly (ind:). A struct type
6495 is used directly when it is the type of a variable, member.
6496 Indirect uses arise through pointers to structs. That is, when use
6497 of an incomplete struct is valid, the use is indirect. An example
6498 is struct one direct; struct two * indirect;.
6499
6500 The optional second word limits the specification to ordinary
6501 structs (ord:) or generic structs (gen:). Generic structs are a
6502 bit complicated to explain. For C++, these are non-explicit
6503 specializations of template classes, or non-template classes within
6504 the above. Other programming languages have generics, but
6505 -femit-struct-debug-detailed does not yet implement them.
6506
6507 The third word specifies the source files for those structs for
6508 which the compiler should emit debug information. The values none
6509 and any have the normal meaning. The value base means that the
6510 base of name of the file in which the type declaration appears must
6511 match the base of the name of the main compilation file. In
6512 practice, this means that when compiling foo.c, debug information
6513 is generated for types declared in that file and foo.h, but not
6514 other header files. The value sys means those types satisfying
6515 base or declared in system or compiler headers.
6516
6517 You may need to experiment to determine the best settings for your
6518 application.
6519
6520 The default is -femit-struct-debug-detailed=all.
6521
6522 This option works only with DWARF debug output.
6523
6524 -fno-dwarf2-cfi-asm
6525 Emit DWARF unwind info as compiler generated ".eh_frame" section
6526 instead of using GAS ".cfi_*" directives.
6527
6528 -fno-eliminate-unused-debug-types
6529 Normally, when producing DWARF output, GCC avoids producing debug
6530 symbol output for types that are nowhere used in the source file
6531 being compiled. Sometimes it is useful to have GCC emit debugging
6532 information for all types declared in a compilation unit,
6533 regardless of whether or not they are actually used in that
6534 compilation unit, for example if, in the debugger, you want to cast
6535 a value to a type that is not actually used in your program (but is
6536 declared). More often, however, this results in a significant
6537 amount of wasted space.
6538
6539 Options That Control Optimization
6540 These options control various sorts of optimizations.
6541
6542 Without any optimization option, the compiler's goal is to reduce the
6543 cost of compilation and to make debugging produce the expected results.
6544 Statements are independent: if you stop the program with a breakpoint
6545 between statements, you can then assign a new value to any variable or
6546 change the program counter to any other statement in the function and
6547 get exactly the results you expect from the source code.
6548
6549 Turning on optimization flags makes the compiler attempt to improve the
6550 performance and/or code size at the expense of compilation time and
6551 possibly the ability to debug the program.
6552
6553 The compiler performs optimization based on the knowledge it has of the
6554 program. Compiling multiple files at once to a single output file mode
6555 allows the compiler to use information gained from all of the files
6556 when compiling each of them.
6557
6558 Not all optimizations are controlled directly by a flag. Only
6559 optimizations that have a flag are listed in this section.
6560
6561 Most optimizations are completely disabled at -O0 or if an -O level is
6562 not set on the command line, even if individual optimization flags are
6563 specified. Similarly, -Og suppresses many optimization passes.
6564
6565 Depending on the target and how GCC was configured, a slightly
6566 different set of optimizations may be enabled at each -O level than
6567 those listed here. You can invoke GCC with -Q --help=optimizers to
6568 find out the exact set of optimizations that are enabled at each level.
6569
6570 -O
6571 -O1 Optimize. Optimizing compilation takes somewhat more time, and a
6572 lot more memory for a large function.
6573
6574 With -O, the compiler tries to reduce code size and execution time,
6575 without performing any optimizations that take a great deal of
6576 compilation time.
6577
6578 -O turns on the following optimization flags:
6579
6580 -fauto-inc-dec -fbranch-count-reg -fcombine-stack-adjustments
6581 -fcompare-elim -fcprop-registers -fdce -fdefer-pop -fdelayed-branch
6582 -fdse -fforward-propagate -fguess-branch-probability
6583 -fif-conversion -fif-conversion2 -finline-functions-called-once
6584 -fipa-profile -fipa-pure-const -fipa-reference
6585 -fipa-reference-addressable -fmerge-constants
6586 -fmove-loop-invariants -fomit-frame-pointer -freorder-blocks
6587 -fshrink-wrap -fshrink-wrap-separate -fsplit-wide-types
6588 -fssa-backprop -fssa-phiopt -ftree-bit-ccp -ftree-ccp -ftree-ch
6589 -ftree-coalesce-vars -ftree-copy-prop -ftree-dce
6590 -ftree-dominator-opts -ftree-dse -ftree-forwprop -ftree-fre
6591 -ftree-phiprop -ftree-pta -ftree-scev-cprop -ftree-sink -ftree-slsr
6592 -ftree-sra -ftree-ter -funit-at-a-time
6593
6594 -O2 Optimize even more. GCC performs nearly all supported
6595 optimizations that do not involve a space-speed tradeoff. As
6596 compared to -O, this option increases both compilation time and the
6597 performance of the generated code.
6598
6599 -O2 turns on all optimization flags specified by -O. It also turns
6600 on the following optimization flags:
6601
6602 -falign-functions -falign-jumps -falign-labels -falign-loops
6603 -fcaller-saves -fcode-hoisting -fcrossjumping -fcse-follow-jumps
6604 -fcse-skip-blocks -fdelete-null-pointer-checks -fdevirtualize
6605 -fdevirtualize-speculatively -fexpensive-optimizations -fgcse
6606 -fgcse-lm -fhoist-adjacent-loads -finline-small-functions
6607 -findirect-inlining -fipa-bit-cp -fipa-cp -fipa-icf -fipa-ra
6608 -fipa-sra -fipa-vrp -fisolate-erroneous-paths-dereference
6609 -flra-remat -foptimize-sibling-calls -foptimize-strlen
6610 -fpartial-inlining -fpeephole2 -freorder-blocks-algorithm=stc
6611 -freorder-blocks-and-partition -freorder-functions
6612 -frerun-cse-after-loop -fschedule-insns -fschedule-insns2
6613 -fsched-interblock -fsched-spec -fstore-merging -fstrict-aliasing
6614 -fthread-jumps -ftree-builtin-call-dce -ftree-pre
6615 -ftree-switch-conversion -ftree-tail-merge -ftree-vrp
6616
6617 Please note the warning under -fgcse about invoking -O2 on programs
6618 that use computed gotos.
6619
6620 -O3 Optimize yet more. -O3 turns on all optimizations specified by -O2
6621 and also turns on the following optimization flags:
6622
6623 -fgcse-after-reload -finline-functions -fipa-cp-clone
6624 -floop-interchange -floop-unroll-and-jam -fpeel-loops
6625 -fpredictive-commoning -fsplit-paths
6626 -ftree-loop-distribute-patterns -ftree-loop-distribution
6627 -ftree-loop-vectorize -ftree-partial-pre -ftree-slp-vectorize
6628 -funswitch-loops -fvect-cost-model -fversion-loops-for-strides
6629
6630 -O0 Reduce compilation time and make debugging produce the expected
6631 results. This is the default.
6632
6633 -Os Optimize for size. -Os enables all -O2 optimizations except those
6634 that often increase code size:
6635
6636 -falign-functions -falign-jumps -falign-labels -falign-loops
6637 -fprefetch-loop-arrays -freorder-blocks-algorithm=stc
6638
6639 It also enables -finline-functions, causes the compiler to tune for
6640 code size rather than execution speed, and performs further
6641 optimizations designed to reduce code size.
6642
6643 -Ofast
6644 Disregard strict standards compliance. -Ofast enables all -O3
6645 optimizations. It also enables optimizations that are not valid
6646 for all standard-compliant programs. It turns on -ffast-math and
6647 the Fortran-specific -fstack-arrays, unless -fmax-stack-var-size is
6648 specified, and -fno-protect-parens.
6649
6650 -Og Optimize debugging experience. -Og should be the optimization
6651 level of choice for the standard edit-compile-debug cycle, offering
6652 a reasonable level of optimization while maintaining fast
6653 compilation and a good debugging experience. It is a better choice
6654 than -O0 for producing debuggable code because some compiler passes
6655 that collect debug information are disabled at -O0.
6656
6657 Like -O0, -Og completely disables a number of optimization passes
6658 so that individual options controlling them have no effect.
6659 Otherwise -Og enables all -O1 optimization flags except for those
6660 that may interfere with debugging:
6661
6662 -fbranch-count-reg -fdelayed-branch -fif-conversion
6663 -fif-conversion2 -finline-functions-called-once
6664 -fmove-loop-invariants -fssa-phiopt -ftree-bit-ccp -ftree-pta
6665 -ftree-sra
6666
6667 If you use multiple -O options, with or without level numbers, the last
6668 such option is the one that is effective.
6669
6670 Options of the form -fflag specify machine-independent flags. Most
6671 flags have both positive and negative forms; the negative form of -ffoo
6672 is -fno-foo. In the table below, only one of the forms is listed---the
6673 one you typically use. You can figure out the other form by either
6674 removing no- or adding it.
6675
6676 The following options control specific optimizations. They are either
6677 activated by -O options or are related to ones that are. You can use
6678 the following flags in the rare cases when "fine-tuning" of
6679 optimizations to be performed is desired.
6680
6681 -fno-defer-pop
6682 For machines that must pop arguments after a function call, always
6683 pop the arguments as soon as each function returns. At levels -O1
6684 and higher, -fdefer-pop is the default; this allows the compiler to
6685 let arguments accumulate on the stack for several function calls
6686 and pop them all at once.
6687
6688 -fforward-propagate
6689 Perform a forward propagation pass on RTL. The pass tries to
6690 combine two instructions and checks if the result can be
6691 simplified. If loop unrolling is active, two passes are performed
6692 and the second is scheduled after loop unrolling.
6693
6694 This option is enabled by default at optimization levels -O, -O2,
6695 -O3, -Os.
6696
6697 -ffp-contract=style
6698 -ffp-contract=off disables floating-point expression contraction.
6699 -ffp-contract=fast enables floating-point expression contraction
6700 such as forming of fused multiply-add operations if the target has
6701 native support for them. -ffp-contract=on enables floating-point
6702 expression contraction if allowed by the language standard. This
6703 is currently not implemented and treated equal to
6704 -ffp-contract=off.
6705
6706 The default is -ffp-contract=fast.
6707
6708 -fomit-frame-pointer
6709 Omit the frame pointer in functions that don't need one. This
6710 avoids the instructions to save, set up and restore the frame
6711 pointer; on many targets it also makes an extra register available.
6712
6713 On some targets this flag has no effect because the standard
6714 calling sequence always uses a frame pointer, so it cannot be
6715 omitted.
6716
6717 Note that -fno-omit-frame-pointer doesn't guarantee the frame
6718 pointer is used in all functions. Several targets always omit the
6719 frame pointer in leaf functions.
6720
6721 Enabled by default at -O and higher.
6722
6723 -foptimize-sibling-calls
6724 Optimize sibling and tail recursive calls.
6725
6726 Enabled at levels -O2, -O3, -Os.
6727
6728 -foptimize-strlen
6729 Optimize various standard C string functions (e.g. "strlen",
6730 "strchr" or "strcpy") and their "_FORTIFY_SOURCE" counterparts into
6731 faster alternatives.
6732
6733 Enabled at levels -O2, -O3.
6734
6735 -fno-inline
6736 Do not expand any functions inline apart from those marked with the
6737 "always_inline" attribute. This is the default when not
6738 optimizing.
6739
6740 Single functions can be exempted from inlining by marking them with
6741 the "noinline" attribute.
6742
6743 -finline-small-functions
6744 Integrate functions into their callers when their body is smaller
6745 than expected function call code (so overall size of program gets
6746 smaller). The compiler heuristically decides which functions are
6747 simple enough to be worth integrating in this way. This inlining
6748 applies to all functions, even those not declared inline.
6749
6750 Enabled at levels -O2, -O3, -Os.
6751
6752 -findirect-inlining
6753 Inline also indirect calls that are discovered to be known at
6754 compile time thanks to previous inlining. This option has any
6755 effect only when inlining itself is turned on by the
6756 -finline-functions or -finline-small-functions options.
6757
6758 Enabled at levels -O2, -O3, -Os.
6759
6760 -finline-functions
6761 Consider all functions for inlining, even if they are not declared
6762 inline. The compiler heuristically decides which functions are
6763 worth integrating in this way.
6764
6765 If all calls to a given function are integrated, and the function
6766 is declared "static", then the function is normally not output as
6767 assembler code in its own right.
6768
6769 Enabled at levels -O3, -Os. Also enabled by -fprofile-use and
6770 -fauto-profile.
6771
6772 -finline-functions-called-once
6773 Consider all "static" functions called once for inlining into their
6774 caller even if they are not marked "inline". If a call to a given
6775 function is integrated, then the function is not output as
6776 assembler code in its own right.
6777
6778 Enabled at levels -O1, -O2, -O3 and -Os, but not -Og.
6779
6780 -fearly-inlining
6781 Inline functions marked by "always_inline" and functions whose body
6782 seems smaller than the function call overhead early before doing
6783 -fprofile-generate instrumentation and real inlining pass. Doing
6784 so makes profiling significantly cheaper and usually inlining
6785 faster on programs having large chains of nested wrapper functions.
6786
6787 Enabled by default.
6788
6789 -fipa-sra
6790 Perform interprocedural scalar replacement of aggregates, removal
6791 of unused parameters and replacement of parameters passed by
6792 reference by parameters passed by value.
6793
6794 Enabled at levels -O2, -O3 and -Os.
6795
6796 -finline-limit=n
6797 By default, GCC limits the size of functions that can be inlined.
6798 This flag allows coarse control of this limit. n is the size of
6799 functions that can be inlined in number of pseudo instructions.
6800
6801 Inlining is actually controlled by a number of parameters, which
6802 may be specified individually by using --param name=value. The
6803 -finline-limit=n option sets some of these parameters as follows:
6804
6805 max-inline-insns-single
6806 is set to n/2.
6807
6808 max-inline-insns-auto
6809 is set to n/2.
6810
6811 See below for a documentation of the individual parameters
6812 controlling inlining and for the defaults of these parameters.
6813
6814 Note: there may be no value to -finline-limit that results in
6815 default behavior.
6816
6817 Note: pseudo instruction represents, in this particular context, an
6818 abstract measurement of function's size. In no way does it
6819 represent a count of assembly instructions and as such its exact
6820 meaning might change from one release to an another.
6821
6822 -fno-keep-inline-dllexport
6823 This is a more fine-grained version of -fkeep-inline-functions,
6824 which applies only to functions that are declared using the
6825 "dllexport" attribute or declspec.
6826
6827 -fkeep-inline-functions
6828 In C, emit "static" functions that are declared "inline" into the
6829 object file, even if the function has been inlined into all of its
6830 callers. This switch does not affect functions using the "extern
6831 inline" extension in GNU C90. In C++, emit any and all inline
6832 functions into the object file.
6833
6834 -fkeep-static-functions
6835 Emit "static" functions into the object file, even if the function
6836 is never used.
6837
6838 -fkeep-static-consts
6839 Emit variables declared "static const" when optimization isn't
6840 turned on, even if the variables aren't referenced.
6841
6842 GCC enables this option by default. If you want to force the
6843 compiler to check if a variable is referenced, regardless of
6844 whether or not optimization is turned on, use the
6845 -fno-keep-static-consts option.
6846
6847 -fmerge-constants
6848 Attempt to merge identical constants (string constants and
6849 floating-point constants) across compilation units.
6850
6851 This option is the default for optimized compilation if the
6852 assembler and linker support it. Use -fno-merge-constants to
6853 inhibit this behavior.
6854
6855 Enabled at levels -O, -O2, -O3, -Os.
6856
6857 -fmerge-all-constants
6858 Attempt to merge identical constants and identical variables.
6859
6860 This option implies -fmerge-constants. In addition to
6861 -fmerge-constants this considers e.g. even constant initialized
6862 arrays or initialized constant variables with integral or floating-
6863 point types. Languages like C or C++ require each variable,
6864 including multiple instances of the same variable in recursive
6865 calls, to have distinct locations, so using this option results in
6866 non-conforming behavior.
6867
6868 -fmodulo-sched
6869 Perform swing modulo scheduling immediately before the first
6870 scheduling pass. This pass looks at innermost loops and reorders
6871 their instructions by overlapping different iterations.
6872
6873 -fmodulo-sched-allow-regmoves
6874 Perform more aggressive SMS-based modulo scheduling with register
6875 moves allowed. By setting this flag certain anti-dependences edges
6876 are deleted, which triggers the generation of reg-moves based on
6877 the life-range analysis. This option is effective only with
6878 -fmodulo-sched enabled.
6879
6880 -fno-branch-count-reg
6881 Disable the optimization pass that scans for opportunities to use
6882 "decrement and branch" instructions on a count register instead of
6883 instruction sequences that decrement a register, compare it against
6884 zero, and then branch based upon the result. This option is only
6885 meaningful on architectures that support such instructions, which
6886 include x86, PowerPC, IA-64 and S/390. Note that the
6887 -fno-branch-count-reg option doesn't remove the decrement and
6888 branch instructions from the generated instruction stream
6889 introduced by other optimization passes.
6890
6891 The default is -fbranch-count-reg at -O1 and higher, except for
6892 -Og.
6893
6894 -fno-function-cse
6895 Do not put function addresses in registers; make each instruction
6896 that calls a constant function contain the function's address
6897 explicitly.
6898
6899 This option results in less efficient code, but some strange hacks
6900 that alter the assembler output may be confused by the
6901 optimizations performed when this option is not used.
6902
6903 The default is -ffunction-cse
6904
6905 -fno-zero-initialized-in-bss
6906 If the target supports a BSS section, GCC by default puts variables
6907 that are initialized to zero into BSS. This can save space in the
6908 resulting code.
6909
6910 This option turns off this behavior because some programs
6911 explicitly rely on variables going to the data section---e.g., so
6912 that the resulting executable can find the beginning of that
6913 section and/or make assumptions based on that.
6914
6915 The default is -fzero-initialized-in-bss.
6916
6917 -fthread-jumps
6918 Perform optimizations that check to see if a jump branches to a
6919 location where another comparison subsumed by the first is found.
6920 If so, the first branch is redirected to either the destination of
6921 the second branch or a point immediately following it, depending on
6922 whether the condition is known to be true or false.
6923
6924 Enabled at levels -O2, -O3, -Os.
6925
6926 -fsplit-wide-types
6927 When using a type that occupies multiple registers, such as "long
6928 long" on a 32-bit system, split the registers apart and allocate
6929 them independently. This normally generates better code for those
6930 types, but may make debugging more difficult.
6931
6932 Enabled at levels -O, -O2, -O3, -Os.
6933
6934 -fcse-follow-jumps
6935 In common subexpression elimination (CSE), scan through jump
6936 instructions when the target of the jump is not reached by any
6937 other path. For example, when CSE encounters an "if" statement
6938 with an "else" clause, CSE follows the jump when the condition
6939 tested is false.
6940
6941 Enabled at levels -O2, -O3, -Os.
6942
6943 -fcse-skip-blocks
6944 This is similar to -fcse-follow-jumps, but causes CSE to follow
6945 jumps that conditionally skip over blocks. When CSE encounters a
6946 simple "if" statement with no else clause, -fcse-skip-blocks causes
6947 CSE to follow the jump around the body of the "if".
6948
6949 Enabled at levels -O2, -O3, -Os.
6950
6951 -frerun-cse-after-loop
6952 Re-run common subexpression elimination after loop optimizations
6953 are performed.
6954
6955 Enabled at levels -O2, -O3, -Os.
6956
6957 -fgcse
6958 Perform a global common subexpression elimination pass. This pass
6959 also performs global constant and copy propagation.
6960
6961 Note: When compiling a program using computed gotos, a GCC
6962 extension, you may get better run-time performance if you disable
6963 the global common subexpression elimination pass by adding
6964 -fno-gcse to the command line.
6965
6966 Enabled at levels -O2, -O3, -Os.
6967
6968 -fgcse-lm
6969 When -fgcse-lm is enabled, global common subexpression elimination
6970 attempts to move loads that are only killed by stores into
6971 themselves. This allows a loop containing a load/store sequence to
6972 be changed to a load outside the loop, and a copy/store within the
6973 loop.
6974
6975 Enabled by default when -fgcse is enabled.
6976
6977 -fgcse-sm
6978 When -fgcse-sm is enabled, a store motion pass is run after global
6979 common subexpression elimination. This pass attempts to move
6980 stores out of loops. When used in conjunction with -fgcse-lm,
6981 loops containing a load/store sequence can be changed to a load
6982 before the loop and a store after the loop.
6983
6984 Not enabled at any optimization level.
6985
6986 -fgcse-las
6987 When -fgcse-las is enabled, the global common subexpression
6988 elimination pass eliminates redundant loads that come after stores
6989 to the same memory location (both partial and full redundancies).
6990
6991 Not enabled at any optimization level.
6992
6993 -fgcse-after-reload
6994 When -fgcse-after-reload is enabled, a redundant load elimination
6995 pass is performed after reload. The purpose of this pass is to
6996 clean up redundant spilling.
6997
6998 Enabled by -fprofile-use and -fauto-profile.
6999
7000 -faggressive-loop-optimizations
7001 This option tells the loop optimizer to use language constraints to
7002 derive bounds for the number of iterations of a loop. This assumes
7003 that loop code does not invoke undefined behavior by for example
7004 causing signed integer overflows or out-of-bound array accesses.
7005 The bounds for the number of iterations of a loop are used to guide
7006 loop unrolling and peeling and loop exit test optimizations. This
7007 option is enabled by default.
7008
7009 -funconstrained-commons
7010 This option tells the compiler that variables declared in common
7011 blocks (e.g. Fortran) may later be overridden with longer trailing
7012 arrays. This prevents certain optimizations that depend on knowing
7013 the array bounds.
7014
7015 -fcrossjumping
7016 Perform cross-jumping transformation. This transformation unifies
7017 equivalent code and saves code size. The resulting code may or may
7018 not perform better than without cross-jumping.
7019
7020 Enabled at levels -O2, -O3, -Os.
7021
7022 -fauto-inc-dec
7023 Combine increments or decrements of addresses with memory accesses.
7024 This pass is always skipped on architectures that do not have
7025 instructions to support this. Enabled by default at -O and higher
7026 on architectures that support this.
7027
7028 -fdce
7029 Perform dead code elimination (DCE) on RTL. Enabled by default at
7030 -O and higher.
7031
7032 -fdse
7033 Perform dead store elimination (DSE) on RTL. Enabled by default at
7034 -O and higher.
7035
7036 -fif-conversion
7037 Attempt to transform conditional jumps into branch-less
7038 equivalents. This includes use of conditional moves, min, max, set
7039 flags and abs instructions, and some tricks doable by standard
7040 arithmetics. The use of conditional execution on chips where it is
7041 available is controlled by -fif-conversion2.
7042
7043 Enabled at levels -O, -O2, -O3, -Os, but not with -Og.
7044
7045 -fif-conversion2
7046 Use conditional execution (where available) to transform
7047 conditional jumps into branch-less equivalents.
7048
7049 Enabled at levels -O, -O2, -O3, -Os, but not with -Og.
7050
7051 -fdeclone-ctor-dtor
7052 The C++ ABI requires multiple entry points for constructors and
7053 destructors: one for a base subobject, one for a complete object,
7054 and one for a virtual destructor that calls operator delete
7055 afterwards. For a hierarchy with virtual bases, the base and
7056 complete variants are clones, which means two copies of the
7057 function. With this option, the base and complete variants are
7058 changed to be thunks that call a common implementation.
7059
7060 Enabled by -Os.
7061
7062 -fdelete-null-pointer-checks
7063 Assume that programs cannot safely dereference null pointers, and
7064 that no code or data element resides at address zero. This option
7065 enables simple constant folding optimizations at all optimization
7066 levels. In addition, other optimization passes in GCC use this
7067 flag to control global dataflow analyses that eliminate useless
7068 checks for null pointers; these assume that a memory access to
7069 address zero always results in a trap, so that if a pointer is
7070 checked after it has already been dereferenced, it cannot be null.
7071
7072 Note however that in some environments this assumption is not true.
7073 Use -fno-delete-null-pointer-checks to disable this optimization
7074 for programs that depend on that behavior.
7075
7076 This option is enabled by default on most targets. On Nios II ELF,
7077 it defaults to off. On AVR, CR16, and MSP430, this option is
7078 completely disabled.
7079
7080 Passes that use the dataflow information are enabled independently
7081 at different optimization levels.
7082
7083 -fdevirtualize
7084 Attempt to convert calls to virtual functions to direct calls.
7085 This is done both within a procedure and interprocedurally as part
7086 of indirect inlining (-findirect-inlining) and interprocedural
7087 constant propagation (-fipa-cp). Enabled at levels -O2, -O3, -Os.
7088
7089 -fdevirtualize-speculatively
7090 Attempt to convert calls to virtual functions to speculative direct
7091 calls. Based on the analysis of the type inheritance graph,
7092 determine for a given call the set of likely targets. If the set is
7093 small, preferably of size 1, change the call into a conditional
7094 deciding between direct and indirect calls. The speculative calls
7095 enable more optimizations, such as inlining. When they seem
7096 useless after further optimization, they are converted back into
7097 original form.
7098
7099 -fdevirtualize-at-ltrans
7100 Stream extra information needed for aggressive devirtualization
7101 when running the link-time optimizer in local transformation mode.
7102 This option enables more devirtualization but significantly
7103 increases the size of streamed data. For this reason it is disabled
7104 by default.
7105
7106 -fexpensive-optimizations
7107 Perform a number of minor optimizations that are relatively
7108 expensive.
7109
7110 Enabled at levels -O2, -O3, -Os.
7111
7112 -free
7113 Attempt to remove redundant extension instructions. This is
7114 especially helpful for the x86-64 architecture, which implicitly
7115 zero-extends in 64-bit registers after writing to their lower
7116 32-bit half.
7117
7118 Enabled for Alpha, AArch64 and x86 at levels -O2, -O3, -Os.
7119
7120 -fno-lifetime-dse
7121 In C++ the value of an object is only affected by changes within
7122 its lifetime: when the constructor begins, the object has an
7123 indeterminate value, and any changes during the lifetime of the
7124 object are dead when the object is destroyed. Normally dead store
7125 elimination will take advantage of this; if your code relies on the
7126 value of the object storage persisting beyond the lifetime of the
7127 object, you can use this flag to disable this optimization. To
7128 preserve stores before the constructor starts (e.g. because your
7129 operator new clears the object storage) but still treat the object
7130 as dead after the destructor you, can use -flifetime-dse=1. The
7131 default behavior can be explicitly selected with -flifetime-dse=2.
7132 -flifetime-dse=0 is equivalent to -fno-lifetime-dse.
7133
7134 -flive-range-shrinkage
7135 Attempt to decrease register pressure through register live range
7136 shrinkage. This is helpful for fast processors with small or
7137 moderate size register sets.
7138
7139 -fira-algorithm=algorithm
7140 Use the specified coloring algorithm for the integrated register
7141 allocator. The algorithm argument can be priority, which specifies
7142 Chow's priority coloring, or CB, which specifies Chaitin-Briggs
7143 coloring. Chaitin-Briggs coloring is not implemented for all
7144 architectures, but for those targets that do support it, it is the
7145 default because it generates better code.
7146
7147 -fira-region=region
7148 Use specified regions for the integrated register allocator. The
7149 region argument should be one of the following:
7150
7151 all Use all loops as register allocation regions. This can give
7152 the best results for machines with a small and/or irregular
7153 register set.
7154
7155 mixed
7156 Use all loops except for loops with small register pressure as
7157 the regions. This value usually gives the best results in most
7158 cases and for most architectures, and is enabled by default
7159 when compiling with optimization for speed (-O, -O2, ...).
7160
7161 one Use all functions as a single region. This typically results
7162 in the smallest code size, and is enabled by default for -Os or
7163 -O0.
7164
7165 -fira-hoist-pressure
7166 Use IRA to evaluate register pressure in the code hoisting pass for
7167 decisions to hoist expressions. This option usually results in
7168 smaller code, but it can slow the compiler down.
7169
7170 This option is enabled at level -Os for all targets.
7171
7172 -fira-loop-pressure
7173 Use IRA to evaluate register pressure in loops for decisions to
7174 move loop invariants. This option usually results in generation of
7175 faster and smaller code on machines with large register files (>=
7176 32 registers), but it can slow the compiler down.
7177
7178 This option is enabled at level -O3 for some targets.
7179
7180 -fno-ira-share-save-slots
7181 Disable sharing of stack slots used for saving call-used hard
7182 registers living through a call. Each hard register gets a
7183 separate stack slot, and as a result function stack frames are
7184 larger.
7185
7186 -fno-ira-share-spill-slots
7187 Disable sharing of stack slots allocated for pseudo-registers.
7188 Each pseudo-register that does not get a hard register gets a
7189 separate stack slot, and as a result function stack frames are
7190 larger.
7191
7192 -flra-remat
7193 Enable CFG-sensitive rematerialization in LRA. Instead of loading
7194 values of spilled pseudos, LRA tries to rematerialize (recalculate)
7195 values if it is profitable.
7196
7197 Enabled at levels -O2, -O3, -Os.
7198
7199 -fdelayed-branch
7200 If supported for the target machine, attempt to reorder
7201 instructions to exploit instruction slots available after delayed
7202 branch instructions.
7203
7204 Enabled at levels -O, -O2, -O3, -Os, but not at -Og.
7205
7206 -fschedule-insns
7207 If supported for the target machine, attempt to reorder
7208 instructions to eliminate execution stalls due to required data
7209 being unavailable. This helps machines that have slow floating
7210 point or memory load instructions by allowing other instructions to
7211 be issued until the result of the load or floating-point
7212 instruction is required.
7213
7214 Enabled at levels -O2, -O3.
7215
7216 -fschedule-insns2
7217 Similar to -fschedule-insns, but requests an additional pass of
7218 instruction scheduling after register allocation has been done.
7219 This is especially useful on machines with a relatively small
7220 number of registers and where memory load instructions take more
7221 than one cycle.
7222
7223 Enabled at levels -O2, -O3, -Os.
7224
7225 -fno-sched-interblock
7226 Disable instruction scheduling across basic blocks, which is
7227 normally enabled when scheduling before register allocation, i.e.
7228 with -fschedule-insns or at -O2 or higher.
7229
7230 -fno-sched-spec
7231 Disable speculative motion of non-load instructions, which is
7232 normally enabled when scheduling before register allocation, i.e.
7233 with -fschedule-insns or at -O2 or higher.
7234
7235 -fsched-pressure
7236 Enable register pressure sensitive insn scheduling before register
7237 allocation. This only makes sense when scheduling before register
7238 allocation is enabled, i.e. with -fschedule-insns or at -O2 or
7239 higher. Usage of this option can improve the generated code and
7240 decrease its size by preventing register pressure increase above
7241 the number of available hard registers and subsequent spills in
7242 register allocation.
7243
7244 -fsched-spec-load
7245 Allow speculative motion of some load instructions. This only
7246 makes sense when scheduling before register allocation, i.e. with
7247 -fschedule-insns or at -O2 or higher.
7248
7249 -fsched-spec-load-dangerous
7250 Allow speculative motion of more load instructions. This only
7251 makes sense when scheduling before register allocation, i.e. with
7252 -fschedule-insns or at -O2 or higher.
7253
7254 -fsched-stalled-insns
7255 -fsched-stalled-insns=n
7256 Define how many insns (if any) can be moved prematurely from the
7257 queue of stalled insns into the ready list during the second
7258 scheduling pass. -fno-sched-stalled-insns means that no insns are
7259 moved prematurely, -fsched-stalled-insns=0 means there is no limit
7260 on how many queued insns can be moved prematurely.
7261 -fsched-stalled-insns without a value is equivalent to
7262 -fsched-stalled-insns=1.
7263
7264 -fsched-stalled-insns-dep
7265 -fsched-stalled-insns-dep=n
7266 Define how many insn groups (cycles) are examined for a dependency
7267 on a stalled insn that is a candidate for premature removal from
7268 the queue of stalled insns. This has an effect only during the
7269 second scheduling pass, and only if -fsched-stalled-insns is used.
7270 -fno-sched-stalled-insns-dep is equivalent to
7271 -fsched-stalled-insns-dep=0. -fsched-stalled-insns-dep without a
7272 value is equivalent to -fsched-stalled-insns-dep=1.
7273
7274 -fsched2-use-superblocks
7275 When scheduling after register allocation, use superblock
7276 scheduling. This allows motion across basic block boundaries,
7277 resulting in faster schedules. This option is experimental, as not
7278 all machine descriptions used by GCC model the CPU closely enough
7279 to avoid unreliable results from the algorithm.
7280
7281 This only makes sense when scheduling after register allocation,
7282 i.e. with -fschedule-insns2 or at -O2 or higher.
7283
7284 -fsched-group-heuristic
7285 Enable the group heuristic in the scheduler. This heuristic favors
7286 the instruction that belongs to a schedule group. This is enabled
7287 by default when scheduling is enabled, i.e. with -fschedule-insns
7288 or -fschedule-insns2 or at -O2 or higher.
7289
7290 -fsched-critical-path-heuristic
7291 Enable the critical-path heuristic in the scheduler. This
7292 heuristic favors instructions on the critical path. This is
7293 enabled by default when scheduling is enabled, i.e. with
7294 -fschedule-insns or -fschedule-insns2 or at -O2 or higher.
7295
7296 -fsched-spec-insn-heuristic
7297 Enable the speculative instruction heuristic in the scheduler.
7298 This heuristic favors speculative instructions with greater
7299 dependency weakness. This is enabled by default when scheduling is
7300 enabled, i.e. with -fschedule-insns or -fschedule-insns2 or at -O2
7301 or higher.
7302
7303 -fsched-rank-heuristic
7304 Enable the rank heuristic in the scheduler. This heuristic favors
7305 the instruction belonging to a basic block with greater size or
7306 frequency. This is enabled by default when scheduling is enabled,
7307 i.e. with -fschedule-insns or -fschedule-insns2 or at -O2 or
7308 higher.
7309
7310 -fsched-last-insn-heuristic
7311 Enable the last-instruction heuristic in the scheduler. This
7312 heuristic favors the instruction that is less dependent on the last
7313 instruction scheduled. This is enabled by default when scheduling
7314 is enabled, i.e. with -fschedule-insns or -fschedule-insns2 or at
7315 -O2 or higher.
7316
7317 -fsched-dep-count-heuristic
7318 Enable the dependent-count heuristic in the scheduler. This
7319 heuristic favors the instruction that has more instructions
7320 depending on it. This is enabled by default when scheduling is
7321 enabled, i.e. with -fschedule-insns or -fschedule-insns2 or at -O2
7322 or higher.
7323
7324 -freschedule-modulo-scheduled-loops
7325 Modulo scheduling is performed before traditional scheduling. If a
7326 loop is modulo scheduled, later scheduling passes may change its
7327 schedule. Use this option to control that behavior.
7328
7329 -fselective-scheduling
7330 Schedule instructions using selective scheduling algorithm.
7331 Selective scheduling runs instead of the first scheduler pass.
7332
7333 -fselective-scheduling2
7334 Schedule instructions using selective scheduling algorithm.
7335 Selective scheduling runs instead of the second scheduler pass.
7336
7337 -fsel-sched-pipelining
7338 Enable software pipelining of innermost loops during selective
7339 scheduling. This option has no effect unless one of
7340 -fselective-scheduling or -fselective-scheduling2 is turned on.
7341
7342 -fsel-sched-pipelining-outer-loops
7343 When pipelining loops during selective scheduling, also pipeline
7344 outer loops. This option has no effect unless
7345 -fsel-sched-pipelining is turned on.
7346
7347 -fsemantic-interposition
7348 Some object formats, like ELF, allow interposing of symbols by the
7349 dynamic linker. This means that for symbols exported from the DSO,
7350 the compiler cannot perform interprocedural propagation, inlining
7351 and other optimizations in anticipation that the function or
7352 variable in question may change. While this feature is useful, for
7353 example, to rewrite memory allocation functions by a debugging
7354 implementation, it is expensive in the terms of code quality. With
7355 -fno-semantic-interposition the compiler assumes that if
7356 interposition happens for functions the overwriting function will
7357 have precisely the same semantics (and side effects). Similarly if
7358 interposition happens for variables, the constructor of the
7359 variable will be the same. The flag has no effect for functions
7360 explicitly declared inline (where it is never allowed for
7361 interposition to change semantics) and for symbols explicitly
7362 declared weak.
7363
7364 -fshrink-wrap
7365 Emit function prologues only before parts of the function that need
7366 it, rather than at the top of the function. This flag is enabled
7367 by default at -O and higher.
7368
7369 -fshrink-wrap-separate
7370 Shrink-wrap separate parts of the prologue and epilogue separately,
7371 so that those parts are only executed when needed. This option is
7372 on by default, but has no effect unless -fshrink-wrap is also
7373 turned on and the target supports this.
7374
7375 -fcaller-saves
7376 Enable allocation of values to registers that are clobbered by
7377 function calls, by emitting extra instructions to save and restore
7378 the registers around such calls. Such allocation is done only when
7379 it seems to result in better code.
7380
7381 This option is always enabled by default on certain machines,
7382 usually those which have no call-preserved registers to use
7383 instead.
7384
7385 Enabled at levels -O2, -O3, -Os.
7386
7387 -fcombine-stack-adjustments
7388 Tracks stack adjustments (pushes and pops) and stack memory
7389 references and then tries to find ways to combine them.
7390
7391 Enabled by default at -O1 and higher.
7392
7393 -fipa-ra
7394 Use caller save registers for allocation if those registers are not
7395 used by any called function. In that case it is not necessary to
7396 save and restore them around calls. This is only possible if
7397 called functions are part of same compilation unit as current
7398 function and they are compiled before it.
7399
7400 Enabled at levels -O2, -O3, -Os, however the option is disabled if
7401 generated code will be instrumented for profiling (-p, or -pg) or
7402 if callee's register usage cannot be known exactly (this happens on
7403 targets that do not expose prologues and epilogues in RTL).
7404
7405 -fconserve-stack
7406 Attempt to minimize stack usage. The compiler attempts to use less
7407 stack space, even if that makes the program slower. This option
7408 implies setting the large-stack-frame parameter to 100 and the
7409 large-stack-frame-growth parameter to 400.
7410
7411 -ftree-reassoc
7412 Perform reassociation on trees. This flag is enabled by default at
7413 -O and higher.
7414
7415 -fcode-hoisting
7416 Perform code hoisting. Code hoisting tries to move the evaluation
7417 of expressions executed on all paths to the function exit as early
7418 as possible. This is especially useful as a code size
7419 optimization, but it often helps for code speed as well. This flag
7420 is enabled by default at -O2 and higher.
7421
7422 -ftree-pre
7423 Perform partial redundancy elimination (PRE) on trees. This flag
7424 is enabled by default at -O2 and -O3.
7425
7426 -ftree-partial-pre
7427 Make partial redundancy elimination (PRE) more aggressive. This
7428 flag is enabled by default at -O3.
7429
7430 -ftree-forwprop
7431 Perform forward propagation on trees. This flag is enabled by
7432 default at -O and higher.
7433
7434 -ftree-fre
7435 Perform full redundancy elimination (FRE) on trees. The difference
7436 between FRE and PRE is that FRE only considers expressions that are
7437 computed on all paths leading to the redundant computation. This
7438 analysis is faster than PRE, though it exposes fewer redundancies.
7439 This flag is enabled by default at -O and higher.
7440
7441 -ftree-phiprop
7442 Perform hoisting of loads from conditional pointers on trees. This
7443 pass is enabled by default at -O and higher.
7444
7445 -fhoist-adjacent-loads
7446 Speculatively hoist loads from both branches of an if-then-else if
7447 the loads are from adjacent locations in the same structure and the
7448 target architecture has a conditional move instruction. This flag
7449 is enabled by default at -O2 and higher.
7450
7451 -ftree-copy-prop
7452 Perform copy propagation on trees. This pass eliminates
7453 unnecessary copy operations. This flag is enabled by default at -O
7454 and higher.
7455
7456 -fipa-pure-const
7457 Discover which functions are pure or constant. Enabled by default
7458 at -O and higher.
7459
7460 -fipa-reference
7461 Discover which static variables do not escape the compilation unit.
7462 Enabled by default at -O and higher.
7463
7464 -fipa-reference-addressable
7465 Discover read-only, write-only and non-addressable static
7466 variables. Enabled by default at -O and higher.
7467
7468 -fipa-stack-alignment
7469 Reduce stack alignment on call sites if possible. Enabled by
7470 default.
7471
7472 -fipa-pta
7473 Perform interprocedural pointer analysis and interprocedural
7474 modification and reference analysis. This option can cause
7475 excessive memory and compile-time usage on large compilation units.
7476 It is not enabled by default at any optimization level.
7477
7478 -fipa-profile
7479 Perform interprocedural profile propagation. The functions called
7480 only from cold functions are marked as cold. Also functions
7481 executed once (such as "cold", "noreturn", static constructors or
7482 destructors) are identified. Cold functions and loop less parts of
7483 functions executed once are then optimized for size. Enabled by
7484 default at -O and higher.
7485
7486 -fipa-cp
7487 Perform interprocedural constant propagation. This optimization
7488 analyzes the program to determine when values passed to functions
7489 are constants and then optimizes accordingly. This optimization
7490 can substantially increase performance if the application has
7491 constants passed to functions. This flag is enabled by default at
7492 -O2, -Os and -O3. It is also enabled by -fprofile-use and
7493 -fauto-profile.
7494
7495 -fipa-cp-clone
7496 Perform function cloning to make interprocedural constant
7497 propagation stronger. When enabled, interprocedural constant
7498 propagation performs function cloning when externally visible
7499 function can be called with constant arguments. Because this
7500 optimization can create multiple copies of functions, it may
7501 significantly increase code size (see --param
7502 ipcp-unit-growth=value). This flag is enabled by default at -O3.
7503 It is also enabled by -fprofile-use and -fauto-profile.
7504
7505 -fipa-bit-cp
7506 When enabled, perform interprocedural bitwise constant propagation.
7507 This flag is enabled by default at -O2 and by -fprofile-use and
7508 -fauto-profile. It requires that -fipa-cp is enabled.
7509
7510 -fipa-vrp
7511 When enabled, perform interprocedural propagation of value ranges.
7512 This flag is enabled by default at -O2. It requires that -fipa-cp
7513 is enabled.
7514
7515 -fipa-icf
7516 Perform Identical Code Folding for functions and read-only
7517 variables. The optimization reduces code size and may disturb
7518 unwind stacks by replacing a function by equivalent one with a
7519 different name. The optimization works more effectively with link-
7520 time optimization enabled.
7521
7522 Although the behavior is similar to the Gold Linker's ICF
7523 optimization, GCC ICF works on different levels and thus the
7524 optimizations are not same - there are equivalences that are found
7525 only by GCC and equivalences found only by Gold.
7526
7527 This flag is enabled by default at -O2 and -Os.
7528
7529 -flive-patching=level
7530 Control GCC's optimizations to produce output suitable for live-
7531 patching.
7532
7533 If the compiler's optimization uses a function's body or
7534 information extracted from its body to optimize/change another
7535 function, the latter is called an impacted function of the former.
7536 If a function is patched, its impacted functions should be patched
7537 too.
7538
7539 The impacted functions are determined by the compiler's
7540 interprocedural optimizations. For example, a caller is impacted
7541 when inlining a function into its caller, cloning a function and
7542 changing its caller to call this new clone, or extracting a
7543 function's pureness/constness information to optimize its direct or
7544 indirect callers, etc.
7545
7546 Usually, the more IPA optimizations enabled, the larger the number
7547 of impacted functions for each function. In order to control the
7548 number of impacted functions and more easily compute the list of
7549 impacted function, IPA optimizations can be partially enabled at
7550 two different levels.
7551
7552 The level argument should be one of the following:
7553
7554 inline-clone
7555 Only enable inlining and cloning optimizations, which includes
7556 inlining, cloning, interprocedural scalar replacement of
7557 aggregates and partial inlining. As a result, when patching a
7558 function, all its callers and its clones' callers are impacted,
7559 therefore need to be patched as well.
7560
7561 -flive-patching=inline-clone disables the following
7562 optimization flags: -fwhole-program -fipa-pta -fipa-reference
7563 -fipa-ra -fipa-icf -fipa-icf-functions -fipa-icf-variables
7564 -fipa-bit-cp -fipa-vrp -fipa-pure-const
7565 -fipa-reference-addressable -fipa-stack-alignment
7566
7567 inline-only-static
7568 Only enable inlining of static functions. As a result, when
7569 patching a static function, all its callers are impacted and so
7570 need to be patched as well.
7571
7572 In addition to all the flags that -flive-patching=inline-clone
7573 disables, -flive-patching=inline-only-static disables the
7574 following additional optimization flags: -fipa-cp-clone
7575 -fipa-sra -fpartial-inlining -fipa-cp
7576
7577 When -flive-patching is specified without any value, the default
7578 value is inline-clone.
7579
7580 This flag is disabled by default.
7581
7582 Note that -flive-patching is not supported with link-time
7583 optimization (-flto).
7584
7585 -fisolate-erroneous-paths-dereference
7586 Detect paths that trigger erroneous or undefined behavior due to
7587 dereferencing a null pointer. Isolate those paths from the main
7588 control flow and turn the statement with erroneous or undefined
7589 behavior into a trap. This flag is enabled by default at -O2 and
7590 higher and depends on -fdelete-null-pointer-checks also being
7591 enabled.
7592
7593 -fisolate-erroneous-paths-attribute
7594 Detect paths that trigger erroneous or undefined behavior due to a
7595 null value being used in a way forbidden by a "returns_nonnull" or
7596 "nonnull" attribute. Isolate those paths from the main control
7597 flow and turn the statement with erroneous or undefined behavior
7598 into a trap. This is not currently enabled, but may be enabled by
7599 -O2 in the future.
7600
7601 -ftree-sink
7602 Perform forward store motion on trees. This flag is enabled by
7603 default at -O and higher.
7604
7605 -ftree-bit-ccp
7606 Perform sparse conditional bit constant propagation on trees and
7607 propagate pointer alignment information. This pass only operates
7608 on local scalar variables and is enabled by default at -O1 and
7609 higher, except for -Og. It requires that -ftree-ccp is enabled.
7610
7611 -ftree-ccp
7612 Perform sparse conditional constant propagation (CCP) on trees.
7613 This pass only operates on local scalar variables and is enabled by
7614 default at -O and higher.
7615
7616 -fssa-backprop
7617 Propagate information about uses of a value up the definition chain
7618 in order to simplify the definitions. For example, this pass
7619 strips sign operations if the sign of a value never matters. The
7620 flag is enabled by default at -O and higher.
7621
7622 -fssa-phiopt
7623 Perform pattern matching on SSA PHI nodes to optimize conditional
7624 code. This pass is enabled by default at -O1 and higher, except
7625 for -Og.
7626
7627 -ftree-switch-conversion
7628 Perform conversion of simple initializations in a switch to
7629 initializations from a scalar array. This flag is enabled by
7630 default at -O2 and higher.
7631
7632 -ftree-tail-merge
7633 Look for identical code sequences. When found, replace one with a
7634 jump to the other. This optimization is known as tail merging or
7635 cross jumping. This flag is enabled by default at -O2 and higher.
7636 The compilation time in this pass can be limited using max-tail-
7637 merge-comparisons parameter and max-tail-merge-iterations
7638 parameter.
7639
7640 -ftree-dce
7641 Perform dead code elimination (DCE) on trees. This flag is enabled
7642 by default at -O and higher.
7643
7644 -ftree-builtin-call-dce
7645 Perform conditional dead code elimination (DCE) for calls to built-
7646 in functions that may set "errno" but are otherwise free of side
7647 effects. This flag is enabled by default at -O2 and higher if -Os
7648 is not also specified.
7649
7650 -ftree-dominator-opts
7651 Perform a variety of simple scalar cleanups (constant/copy
7652 propagation, redundancy elimination, range propagation and
7653 expression simplification) based on a dominator tree traversal.
7654 This also performs jump threading (to reduce jumps to jumps). This
7655 flag is enabled by default at -O and higher.
7656
7657 -ftree-dse
7658 Perform dead store elimination (DSE) on trees. A dead store is a
7659 store into a memory location that is later overwritten by another
7660 store without any intervening loads. In this case the earlier
7661 store can be deleted. This flag is enabled by default at -O and
7662 higher.
7663
7664 -ftree-ch
7665 Perform loop header copying on trees. This is beneficial since it
7666 increases effectiveness of code motion optimizations. It also
7667 saves one jump. This flag is enabled by default at -O and higher.
7668 It is not enabled for -Os, since it usually increases code size.
7669
7670 -ftree-loop-optimize
7671 Perform loop optimizations on trees. This flag is enabled by
7672 default at -O and higher.
7673
7674 -ftree-loop-linear
7675 -floop-strip-mine
7676 -floop-block
7677 Perform loop nest optimizations. Same as -floop-nest-optimize. To
7678 use this code transformation, GCC has to be configured with
7679 --with-isl to enable the Graphite loop transformation
7680 infrastructure.
7681
7682 -fgraphite-identity
7683 Enable the identity transformation for graphite. For every SCoP we
7684 generate the polyhedral representation and transform it back to
7685 gimple. Using -fgraphite-identity we can check the costs or
7686 benefits of the GIMPLE -> GRAPHITE -> GIMPLE transformation. Some
7687 minimal optimizations are also performed by the code generator isl,
7688 like index splitting and dead code elimination in loops.
7689
7690 -floop-nest-optimize
7691 Enable the isl based loop nest optimizer. This is a generic loop
7692 nest optimizer based on the Pluto optimization algorithms. It
7693 calculates a loop structure optimized for data-locality and
7694 parallelism. This option is experimental.
7695
7696 -floop-parallelize-all
7697 Use the Graphite data dependence analysis to identify loops that
7698 can be parallelized. Parallelize all the loops that can be
7699 analyzed to not contain loop carried dependences without checking
7700 that it is profitable to parallelize the loops.
7701
7702 -ftree-coalesce-vars
7703 While transforming the program out of the SSA representation,
7704 attempt to reduce copying by coalescing versions of different user-
7705 defined variables, instead of just compiler temporaries. This may
7706 severely limit the ability to debug an optimized program compiled
7707 with -fno-var-tracking-assignments. In the negated form, this flag
7708 prevents SSA coalescing of user variables. This option is enabled
7709 by default if optimization is enabled, and it does very little
7710 otherwise.
7711
7712 -ftree-loop-if-convert
7713 Attempt to transform conditional jumps in the innermost loops to
7714 branch-less equivalents. The intent is to remove control-flow from
7715 the innermost loops in order to improve the ability of the
7716 vectorization pass to handle these loops. This is enabled by
7717 default if vectorization is enabled.
7718
7719 -ftree-loop-distribution
7720 Perform loop distribution. This flag can improve cache performance
7721 on big loop bodies and allow further loop optimizations, like
7722 parallelization or vectorization, to take place. For example, the
7723 loop
7724
7725 DO I = 1, N
7726 A(I) = B(I) + C
7727 D(I) = E(I) * F
7728 ENDDO
7729
7730 is transformed to
7731
7732 DO I = 1, N
7733 A(I) = B(I) + C
7734 ENDDO
7735 DO I = 1, N
7736 D(I) = E(I) * F
7737 ENDDO
7738
7739 This flag is enabled by default at -O3. It is also enabled by
7740 -fprofile-use and -fauto-profile.
7741
7742 -ftree-loop-distribute-patterns
7743 Perform loop distribution of patterns that can be code generated
7744 with calls to a library. This flag is enabled by default at -O3,
7745 and by -fprofile-use and -fauto-profile.
7746
7747 This pass distributes the initialization loops and generates a call
7748 to memset zero. For example, the loop
7749
7750 DO I = 1, N
7751 A(I) = 0
7752 B(I) = A(I) + I
7753 ENDDO
7754
7755 is transformed to
7756
7757 DO I = 1, N
7758 A(I) = 0
7759 ENDDO
7760 DO I = 1, N
7761 B(I) = A(I) + I
7762 ENDDO
7763
7764 and the initialization loop is transformed into a call to memset
7765 zero. This flag is enabled by default at -O3. It is also enabled
7766 by -fprofile-use and -fauto-profile.
7767
7768 -floop-interchange
7769 Perform loop interchange outside of graphite. This flag can
7770 improve cache performance on loop nest and allow further loop
7771 optimizations, like vectorization, to take place. For example, the
7772 loop
7773
7774 for (int i = 0; i < N; i++)
7775 for (int j = 0; j < N; j++)
7776 for (int k = 0; k < N; k++)
7777 c[i][j] = c[i][j] + a[i][k]*b[k][j];
7778
7779 is transformed to
7780
7781 for (int i = 0; i < N; i++)
7782 for (int k = 0; k < N; k++)
7783 for (int j = 0; j < N; j++)
7784 c[i][j] = c[i][j] + a[i][k]*b[k][j];
7785
7786 This flag is enabled by default at -O3. It is also enabled by
7787 -fprofile-use and -fauto-profile.
7788
7789 -floop-unroll-and-jam
7790 Apply unroll and jam transformations on feasible loops. In a loop
7791 nest this unrolls the outer loop by some factor and fuses the
7792 resulting multiple inner loops. This flag is enabled by default at
7793 -O3. It is also enabled by -fprofile-use and -fauto-profile.
7794
7795 -ftree-loop-im
7796 Perform loop invariant motion on trees. This pass moves only
7797 invariants that are hard to handle at RTL level (function calls,
7798 operations that expand to nontrivial sequences of insns). With
7799 -funswitch-loops it also moves operands of conditions that are
7800 invariant out of the loop, so that we can use just trivial
7801 invariantness analysis in loop unswitching. The pass also includes
7802 store motion.
7803
7804 -ftree-loop-ivcanon
7805 Create a canonical counter for number of iterations in loops for
7806 which determining number of iterations requires complicated
7807 analysis. Later optimizations then may determine the number
7808 easily. Useful especially in connection with unrolling.
7809
7810 -ftree-scev-cprop
7811 Perform final value replacement. If a variable is modified in a
7812 loop in such a way that its value when exiting the loop can be
7813 determined using only its initial value and the number of loop
7814 iterations, replace uses of the final value by such a computation,
7815 provided it is sufficiently cheap. This reduces data dependencies
7816 and may allow further simplifications. Enabled by default at -O
7817 and higher.
7818
7819 -fivopts
7820 Perform induction variable optimizations (strength reduction,
7821 induction variable merging and induction variable elimination) on
7822 trees.
7823
7824 -ftree-parallelize-loops=n
7825 Parallelize loops, i.e., split their iteration space to run in n
7826 threads. This is only possible for loops whose iterations are
7827 independent and can be arbitrarily reordered. The optimization is
7828 only profitable on multiprocessor machines, for loops that are CPU-
7829 intensive, rather than constrained e.g. by memory bandwidth. This
7830 option implies -pthread, and thus is only supported on targets that
7831 have support for -pthread.
7832
7833 -ftree-pta
7834 Perform function-local points-to analysis on trees. This flag is
7835 enabled by default at -O1 and higher, except for -Og.
7836
7837 -ftree-sra
7838 Perform scalar replacement of aggregates. This pass replaces
7839 structure references with scalars to prevent committing structures
7840 to memory too early. This flag is enabled by default at -O1 and
7841 higher, except for -Og.
7842
7843 -fstore-merging
7844 Perform merging of narrow stores to consecutive memory addresses.
7845 This pass merges contiguous stores of immediate values narrower
7846 than a word into fewer wider stores to reduce the number of
7847 instructions. This is enabled by default at -O2 and higher as well
7848 as -Os.
7849
7850 -ftree-ter
7851 Perform temporary expression replacement during the SSA->normal
7852 phase. Single use/single def temporaries are replaced at their use
7853 location with their defining expression. This results in non-
7854 GIMPLE code, but gives the expanders much more complex trees to
7855 work on resulting in better RTL generation. This is enabled by
7856 default at -O and higher.
7857
7858 -ftree-slsr
7859 Perform straight-line strength reduction on trees. This recognizes
7860 related expressions involving multiplications and replaces them by
7861 less expensive calculations when possible. This is enabled by
7862 default at -O and higher.
7863
7864 -ftree-vectorize
7865 Perform vectorization on trees. This flag enables
7866 -ftree-loop-vectorize and -ftree-slp-vectorize if not explicitly
7867 specified.
7868
7869 -ftree-loop-vectorize
7870 Perform loop vectorization on trees. This flag is enabled by
7871 default at -O3 and by -ftree-vectorize, -fprofile-use, and
7872 -fauto-profile.
7873
7874 -ftree-slp-vectorize
7875 Perform basic block vectorization on trees. This flag is enabled by
7876 default at -O3 and by -ftree-vectorize, -fprofile-use, and
7877 -fauto-profile.
7878
7879 -fvect-cost-model=model
7880 Alter the cost model used for vectorization. The model argument
7881 should be one of unlimited, dynamic or cheap. With the unlimited
7882 model the vectorized code-path is assumed to be profitable while
7883 with the dynamic model a runtime check guards the vectorized code-
7884 path to enable it only for iteration counts that will likely
7885 execute faster than when executing the original scalar loop. The
7886 cheap model disables vectorization of loops where doing so would be
7887 cost prohibitive for example due to required runtime checks for
7888 data dependence or alignment but otherwise is equal to the dynamic
7889 model. The default cost model depends on other optimization flags
7890 and is either dynamic or cheap.
7891
7892 -fsimd-cost-model=model
7893 Alter the cost model used for vectorization of loops marked with
7894 the OpenMP simd directive. The model argument should be one of
7895 unlimited, dynamic, cheap. All values of model have the same
7896 meaning as described in -fvect-cost-model and by default a cost
7897 model defined with -fvect-cost-model is used.
7898
7899 -ftree-vrp
7900 Perform Value Range Propagation on trees. This is similar to the
7901 constant propagation pass, but instead of values, ranges of values
7902 are propagated. This allows the optimizers to remove unnecessary
7903 range checks like array bound checks and null pointer checks. This
7904 is enabled by default at -O2 and higher. Null pointer check
7905 elimination is only done if -fdelete-null-pointer-checks is
7906 enabled.
7907
7908 -fsplit-paths
7909 Split paths leading to loop backedges. This can improve dead code
7910 elimination and common subexpression elimination. This is enabled
7911 by default at -O3 and above.
7912
7913 -fsplit-ivs-in-unroller
7914 Enables expression of values of induction variables in later
7915 iterations of the unrolled loop using the value in the first
7916 iteration. This breaks long dependency chains, thus improving
7917 efficiency of the scheduling passes.
7918
7919 A combination of -fweb and CSE is often sufficient to obtain the
7920 same effect. However, that is not reliable in cases where the loop
7921 body is more complicated than a single basic block. It also does
7922 not work at all on some architectures due to restrictions in the
7923 CSE pass.
7924
7925 This optimization is enabled by default.
7926
7927 -fvariable-expansion-in-unroller
7928 With this option, the compiler creates multiple copies of some
7929 local variables when unrolling a loop, which can result in superior
7930 code.
7931
7932 -fpartial-inlining
7933 Inline parts of functions. This option has any effect only when
7934 inlining itself is turned on by the -finline-functions or
7935 -finline-small-functions options.
7936
7937 Enabled at levels -O2, -O3, -Os.
7938
7939 -fpredictive-commoning
7940 Perform predictive commoning optimization, i.e., reusing
7941 computations (especially memory loads and stores) performed in
7942 previous iterations of loops.
7943
7944 This option is enabled at level -O3. It is also enabled by
7945 -fprofile-use and -fauto-profile.
7946
7947 -fprefetch-loop-arrays
7948 If supported by the target machine, generate instructions to
7949 prefetch memory to improve the performance of loops that access
7950 large arrays.
7951
7952 This option may generate better or worse code; results are highly
7953 dependent on the structure of loops within the source code.
7954
7955 Disabled at level -Os.
7956
7957 -fno-printf-return-value
7958 Do not substitute constants for known return value of formatted
7959 output functions such as "sprintf", "snprintf", "vsprintf", and
7960 "vsnprintf" (but not "printf" of "fprintf"). This transformation
7961 allows GCC to optimize or even eliminate branches based on the
7962 known return value of these functions called with arguments that
7963 are either constant, or whose values are known to be in a range
7964 that makes determining the exact return value possible. For
7965 example, when -fprintf-return-value is in effect, both the branch
7966 and the body of the "if" statement (but not the call to "snprint")
7967 can be optimized away when "i" is a 32-bit or smaller integer
7968 because the return value is guaranteed to be at most 8.
7969
7970 char buf[9];
7971 if (snprintf (buf, "%08x", i) >= sizeof buf)
7972 ...
7973
7974 The -fprintf-return-value option relies on other optimizations and
7975 yields best results with -O2 and above. It works in tandem with
7976 the -Wformat-overflow and -Wformat-truncation options. The
7977 -fprintf-return-value option is enabled by default.
7978
7979 -fno-peephole
7980 -fno-peephole2
7981 Disable any machine-specific peephole optimizations. The
7982 difference between -fno-peephole and -fno-peephole2 is in how they
7983 are implemented in the compiler; some targets use one, some use the
7984 other, a few use both.
7985
7986 -fpeephole is enabled by default. -fpeephole2 enabled at levels
7987 -O2, -O3, -Os.
7988
7989 -fno-guess-branch-probability
7990 Do not guess branch probabilities using heuristics.
7991
7992 GCC uses heuristics to guess branch probabilities if they are not
7993 provided by profiling feedback (-fprofile-arcs). These heuristics
7994 are based on the control flow graph. If some branch probabilities
7995 are specified by "__builtin_expect", then the heuristics are used
7996 to guess branch probabilities for the rest of the control flow
7997 graph, taking the "__builtin_expect" info into account. The
7998 interactions between the heuristics and "__builtin_expect" can be
7999 complex, and in some cases, it may be useful to disable the
8000 heuristics so that the effects of "__builtin_expect" are easier to
8001 understand.
8002
8003 It is also possible to specify expected probability of the
8004 expression with "__builtin_expect_with_probability" built-in
8005 function.
8006
8007 The default is -fguess-branch-probability at levels -O, -O2, -O3,
8008 -Os.
8009
8010 -freorder-blocks
8011 Reorder basic blocks in the compiled function in order to reduce
8012 number of taken branches and improve code locality.
8013
8014 Enabled at levels -O, -O2, -O3, -Os.
8015
8016 -freorder-blocks-algorithm=algorithm
8017 Use the specified algorithm for basic block reordering. The
8018 algorithm argument can be simple, which does not increase code size
8019 (except sometimes due to secondary effects like alignment), or stc,
8020 the "software trace cache" algorithm, which tries to put all often
8021 executed code together, minimizing the number of branches executed
8022 by making extra copies of code.
8023
8024 The default is simple at levels -O, -Os, and stc at levels -O2,
8025 -O3.
8026
8027 -freorder-blocks-and-partition
8028 In addition to reordering basic blocks in the compiled function, in
8029 order to reduce number of taken branches, partitions hot and cold
8030 basic blocks into separate sections of the assembly and .o files,
8031 to improve paging and cache locality performance.
8032
8033 This optimization is automatically turned off in the presence of
8034 exception handling or unwind tables (on targets using
8035 setjump/longjump or target specific scheme), for linkonce sections,
8036 for functions with a user-defined section attribute and on any
8037 architecture that does not support named sections. When
8038 -fsplit-stack is used this option is not enabled by default (to
8039 avoid linker errors), but may be enabled explicitly (if using a
8040 working linker).
8041
8042 Enabled for x86 at levels -O2, -O3, -Os.
8043
8044 -freorder-functions
8045 Reorder functions in the object file in order to improve code
8046 locality. This is implemented by using special subsections
8047 ".text.hot" for most frequently executed functions and
8048 ".text.unlikely" for unlikely executed functions. Reordering is
8049 done by the linker so object file format must support named
8050 sections and linker must place them in a reasonable way.
8051
8052 This option isn't effective unless you either provide profile
8053 feedback (see -fprofile-arcs for details) or manually annotate
8054 functions with "hot" or "cold" attributes.
8055
8056 Enabled at levels -O2, -O3, -Os.
8057
8058 -fstrict-aliasing
8059 Allow the compiler to assume the strictest aliasing rules
8060 applicable to the language being compiled. For C (and C++), this
8061 activates optimizations based on the type of expressions. In
8062 particular, an object of one type is assumed never to reside at the
8063 same address as an object of a different type, unless the types are
8064 almost the same. For example, an "unsigned int" can alias an
8065 "int", but not a "void*" or a "double". A character type may alias
8066 any other type.
8067
8068 Pay special attention to code like this:
8069
8070 union a_union {
8071 int i;
8072 double d;
8073 };
8074
8075 int f() {
8076 union a_union t;
8077 t.d = 3.0;
8078 return t.i;
8079 }
8080
8081 The practice of reading from a different union member than the one
8082 most recently written to (called "type-punning") is common. Even
8083 with -fstrict-aliasing, type-punning is allowed, provided the
8084 memory is accessed through the union type. So, the code above
8085 works as expected. However, this code might not:
8086
8087 int f() {
8088 union a_union t;
8089 int* ip;
8090 t.d = 3.0;
8091 ip = &t.i;
8092 return *ip;
8093 }
8094
8095 Similarly, access by taking the address, casting the resulting
8096 pointer and dereferencing the result has undefined behavior, even
8097 if the cast uses a union type, e.g.:
8098
8099 int f() {
8100 double d = 3.0;
8101 return ((union a_union *) &d)->i;
8102 }
8103
8104 The -fstrict-aliasing option is enabled at levels -O2, -O3, -Os.
8105
8106 -falign-functions
8107 -falign-functions=n
8108 -falign-functions=n:m
8109 -falign-functions=n:m:n2
8110 -falign-functions=n:m:n2:m2
8111 Align the start of functions to the next power-of-two greater than
8112 n, skipping up to m-1 bytes. This ensures that at least the first
8113 m bytes of the function can be fetched by the CPU without crossing
8114 an n-byte alignment boundary.
8115
8116 If m is not specified, it defaults to n.
8117
8118 Examples: -falign-functions=32 aligns functions to the next 32-byte
8119 boundary, -falign-functions=24 aligns to the next 32-byte boundary
8120 only if this can be done by skipping 23 bytes or less,
8121 -falign-functions=32:7 aligns to the next 32-byte boundary only if
8122 this can be done by skipping 6 bytes or less.
8123
8124 The second pair of n2:m2 values allows you to specify a secondary
8125 alignment: -falign-functions=64:7:32:3 aligns to the next 64-byte
8126 boundary if this can be done by skipping 6 bytes or less, otherwise
8127 aligns to the next 32-byte boundary if this can be done by skipping
8128 2 bytes or less. If m2 is not specified, it defaults to n2.
8129
8130 Some assemblers only support this flag when n is a power of two; in
8131 that case, it is rounded up.
8132
8133 -fno-align-functions and -falign-functions=1 are equivalent and
8134 mean that functions are not aligned.
8135
8136 If n is not specified or is zero, use a machine-dependent default.
8137 The maximum allowed n option value is 65536.
8138
8139 Enabled at levels -O2, -O3.
8140
8141 -flimit-function-alignment
8142 If this option is enabled, the compiler tries to avoid
8143 unnecessarily overaligning functions. It attempts to instruct the
8144 assembler to align by the amount specified by -falign-functions,
8145 but not to skip more bytes than the size of the function.
8146
8147 -falign-labels
8148 -falign-labels=n
8149 -falign-labels=n:m
8150 -falign-labels=n:m:n2
8151 -falign-labels=n:m:n2:m2
8152 Align all branch targets to a power-of-two boundary.
8153
8154 Parameters of this option are analogous to the -falign-functions
8155 option. -fno-align-labels and -falign-labels=1 are equivalent and
8156 mean that labels are not aligned.
8157
8158 If -falign-loops or -falign-jumps are applicable and are greater
8159 than this value, then their values are used instead.
8160
8161 If n is not specified or is zero, use a machine-dependent default
8162 which is very likely to be 1, meaning no alignment. The maximum
8163 allowed n option value is 65536.
8164
8165 Enabled at levels -O2, -O3.
8166
8167 -falign-loops
8168 -falign-loops=n
8169 -falign-loops=n:m
8170 -falign-loops=n:m:n2
8171 -falign-loops=n:m:n2:m2
8172 Align loops to a power-of-two boundary. If the loops are executed
8173 many times, this makes up for any execution of the dummy padding
8174 instructions.
8175
8176 Parameters of this option are analogous to the -falign-functions
8177 option. -fno-align-loops and -falign-loops=1 are equivalent and
8178 mean that loops are not aligned. The maximum allowed n option
8179 value is 65536.
8180
8181 If n is not specified or is zero, use a machine-dependent default.
8182
8183 Enabled at levels -O2, -O3.
8184
8185 -falign-jumps
8186 -falign-jumps=n
8187 -falign-jumps=n:m
8188 -falign-jumps=n:m:n2
8189 -falign-jumps=n:m:n2:m2
8190 Align branch targets to a power-of-two boundary, for branch targets
8191 where the targets can only be reached by jumping. In this case, no
8192 dummy operations need be executed.
8193
8194 Parameters of this option are analogous to the -falign-functions
8195 option. -fno-align-jumps and -falign-jumps=1 are equivalent and
8196 mean that loops are not aligned.
8197
8198 If n is not specified or is zero, use a machine-dependent default.
8199 The maximum allowed n option value is 65536.
8200
8201 Enabled at levels -O2, -O3.
8202
8203 -funit-at-a-time
8204 This option is left for compatibility reasons. -funit-at-a-time has
8205 no effect, while -fno-unit-at-a-time implies -fno-toplevel-reorder
8206 and -fno-section-anchors.
8207
8208 Enabled by default.
8209
8210 -fno-toplevel-reorder
8211 Do not reorder top-level functions, variables, and "asm"
8212 statements. Output them in the same order that they appear in the
8213 input file. When this option is used, unreferenced static
8214 variables are not removed. This option is intended to support
8215 existing code that relies on a particular ordering. For new code,
8216 it is better to use attributes when possible.
8217
8218 -ftoplevel-reorder is the default at -O1 and higher, and also at
8219 -O0 if -fsection-anchors is explicitly requested. Additionally
8220 -fno-toplevel-reorder implies -fno-section-anchors.
8221
8222 -fweb
8223 Constructs webs as commonly used for register allocation purposes
8224 and assign each web individual pseudo register. This allows the
8225 register allocation pass to operate on pseudos directly, but also
8226 strengthens several other optimization passes, such as CSE, loop
8227 optimizer and trivial dead code remover. It can, however, make
8228 debugging impossible, since variables no longer stay in a "home
8229 register".
8230
8231 Enabled by default with -funroll-loops.
8232
8233 -fwhole-program
8234 Assume that the current compilation unit represents the whole
8235 program being compiled. All public functions and variables with
8236 the exception of "main" and those merged by attribute
8237 "externally_visible" become static functions and in effect are
8238 optimized more aggressively by interprocedural optimizers.
8239
8240 This option should not be used in combination with -flto. Instead
8241 relying on a linker plugin should provide safer and more precise
8242 information.
8243
8244 -flto[=n]
8245 This option runs the standard link-time optimizer. When invoked
8246 with source code, it generates GIMPLE (one of GCC's internal
8247 representations) and writes it to special ELF sections in the
8248 object file. When the object files are linked together, all the
8249 function bodies are read from these ELF sections and instantiated
8250 as if they had been part of the same translation unit.
8251
8252 To use the link-time optimizer, -flto and optimization options
8253 should be specified at compile time and during the final link. It
8254 is recommended that you compile all the files participating in the
8255 same link with the same options and also specify those options at
8256 link time. For example:
8257
8258 gcc -c -O2 -flto foo.c
8259 gcc -c -O2 -flto bar.c
8260 gcc -o myprog -flto -O2 foo.o bar.o
8261
8262 The first two invocations to GCC save a bytecode representation of
8263 GIMPLE into special ELF sections inside foo.o and bar.o. The final
8264 invocation reads the GIMPLE bytecode from foo.o and bar.o, merges
8265 the two files into a single internal image, and compiles the result
8266 as usual. Since both foo.o and bar.o are merged into a single
8267 image, this causes all the interprocedural analyses and
8268 optimizations in GCC to work across the two files as if they were a
8269 single one. This means, for example, that the inliner is able to
8270 inline functions in bar.o into functions in foo.o and vice-versa.
8271
8272 Another (simpler) way to enable link-time optimization is:
8273
8274 gcc -o myprog -flto -O2 foo.c bar.c
8275
8276 The above generates bytecode for foo.c and bar.c, merges them
8277 together into a single GIMPLE representation and optimizes them as
8278 usual to produce myprog.
8279
8280 The important thing to keep in mind is that to enable link-time
8281 optimizations you need to use the GCC driver to perform the link
8282 step. GCC automatically performs link-time optimization if any of
8283 the objects involved were compiled with the -flto command-line
8284 option. You can always override the automatic decision to do link-
8285 time optimization by passing -fno-lto to the link command.
8286
8287 To make whole program optimization effective, it is necessary to
8288 make certain whole program assumptions. The compiler needs to know
8289 what functions and variables can be accessed by libraries and
8290 runtime outside of the link-time optimized unit. When supported by
8291 the linker, the linker plugin (see -fuse-linker-plugin) passes
8292 information to the compiler about used and externally visible
8293 symbols. When the linker plugin is not available, -fwhole-program
8294 should be used to allow the compiler to make these assumptions,
8295 which leads to more aggressive optimization decisions.
8296
8297 When a file is compiled with -flto without -fuse-linker-plugin, the
8298 generated object file is larger than a regular object file because
8299 it contains GIMPLE bytecodes and the usual final code (see
8300 -ffat-lto-objects. This means that object files with LTO
8301 information can be linked as normal object files; if -fno-lto is
8302 passed to the linker, no interprocedural optimizations are applied.
8303 Note that when -fno-fat-lto-objects is enabled the compile stage is
8304 faster but you cannot perform a regular, non-LTO link on them.
8305
8306 When producing the final binary, GCC only applies link-time
8307 optimizations to those files that contain bytecode. Therefore, you
8308 can mix and match object files and libraries with GIMPLE bytecodes
8309 and final object code. GCC automatically selects which files to
8310 optimize in LTO mode and which files to link without further
8311 processing.
8312
8313 Generally, options specified at link time override those specified
8314 at compile time, although in some cases GCC attempts to infer link-
8315 time options from the settings used to compile the input files.
8316
8317 If you do not specify an optimization level option -O at link time,
8318 then GCC uses the highest optimization level used when compiling
8319 the object files. Note that it is generally ineffective to specify
8320 an optimization level option only at link time and not at compile
8321 time, for two reasons. First, compiling without optimization
8322 suppresses compiler passes that gather information needed for
8323 effective optimization at link time. Second, some early
8324 optimization passes can be performed only at compile time and not
8325 at link time.
8326
8327 There are some code generation flags preserved by GCC when
8328 generating bytecodes, as they need to be used during the final
8329 link. Currently, the following options and their settings are
8330 taken from the first object file that explicitly specifies them:
8331 -fPIC, -fpic, -fpie, -fcommon, -fexceptions, -fnon-call-exceptions,
8332 -fgnu-tm and all the -m target flags.
8333
8334 Certain ABI-changing flags are required to match in all compilation
8335 units, and trying to override this at link time with a conflicting
8336 value is ignored. This includes options such as
8337 -freg-struct-return and -fpcc-struct-return.
8338
8339 Other options such as -ffp-contract, -fno-strict-overflow, -fwrapv,
8340 -fno-trapv or -fno-strict-aliasing are passed through to the link
8341 stage and merged conservatively for conflicting translation units.
8342 Specifically -fno-strict-overflow, -fwrapv and -fno-trapv take
8343 precedence; and for example -ffp-contract=off takes precedence over
8344 -ffp-contract=fast. You can override them at link time.
8345
8346 If LTO encounters objects with C linkage declared with incompatible
8347 types in separate translation units to be linked together
8348 (undefined behavior according to ISO C99 6.2.7), a non-fatal
8349 diagnostic may be issued. The behavior is still undefined at run
8350 time. Similar diagnostics may be raised for other languages.
8351
8352 Another feature of LTO is that it is possible to apply
8353 interprocedural optimizations on files written in different
8354 languages:
8355
8356 gcc -c -flto foo.c
8357 g++ -c -flto bar.cc
8358 gfortran -c -flto baz.f90
8359 g++ -o myprog -flto -O3 foo.o bar.o baz.o -lgfortran
8360
8361 Notice that the final link is done with g++ to get the C++ runtime
8362 libraries and -lgfortran is added to get the Fortran runtime
8363 libraries. In general, when mixing languages in LTO mode, you
8364 should use the same link command options as when mixing languages
8365 in a regular (non-LTO) compilation.
8366
8367 If object files containing GIMPLE bytecode are stored in a library
8368 archive, say libfoo.a, it is possible to extract and use them in an
8369 LTO link if you are using a linker with plugin support. To create
8370 static libraries suitable for LTO, use gcc-ar and gcc-ranlib
8371 instead of ar and ranlib; to show the symbols of object files with
8372 GIMPLE bytecode, use gcc-nm. Those commands require that ar,
8373 ranlib and nm have been compiled with plugin support. At link
8374 time, use the flag -fuse-linker-plugin to ensure that the library
8375 participates in the LTO optimization process:
8376
8377 gcc -o myprog -O2 -flto -fuse-linker-plugin a.o b.o -lfoo
8378
8379 With the linker plugin enabled, the linker extracts the needed
8380 GIMPLE files from libfoo.a and passes them on to the running GCC to
8381 make them part of the aggregated GIMPLE image to be optimized.
8382
8383 If you are not using a linker with plugin support and/or do not
8384 enable the linker plugin, then the objects inside libfoo.a are
8385 extracted and linked as usual, but they do not participate in the
8386 LTO optimization process. In order to make a static library
8387 suitable for both LTO optimization and usual linkage, compile its
8388 object files with -flto -ffat-lto-objects.
8389
8390 Link-time optimizations do not require the presence of the whole
8391 program to operate. If the program does not require any symbols to
8392 be exported, it is possible to combine -flto and -fwhole-program to
8393 allow the interprocedural optimizers to use more aggressive
8394 assumptions which may lead to improved optimization opportunities.
8395 Use of -fwhole-program is not needed when linker plugin is active
8396 (see -fuse-linker-plugin).
8397
8398 The current implementation of LTO makes no attempt to generate
8399 bytecode that is portable between different types of hosts. The
8400 bytecode files are versioned and there is a strict version check,
8401 so bytecode files generated in one version of GCC do not work with
8402 an older or newer version of GCC.
8403
8404 Link-time optimization does not work well with generation of
8405 debugging information on systems other than those using a
8406 combination of ELF and DWARF.
8407
8408 If you specify the optional n, the optimization and code generation
8409 done at link time is executed in parallel using n parallel jobs by
8410 utilizing an installed make program. The environment variable MAKE
8411 may be used to override the program used. The default value for n
8412 is 1.
8413
8414 You can also specify -flto=jobserver to use GNU make's job server
8415 mode to determine the number of parallel jobs. This is useful when
8416 the Makefile calling GCC is already executing in parallel. You
8417 must prepend a + to the command recipe in the parent Makefile for
8418 this to work. This option likely only works if MAKE is GNU make.
8419
8420 -flto-partition=alg
8421 Specify the partitioning algorithm used by the link-time optimizer.
8422 The value is either 1to1 to specify a partitioning mirroring the
8423 original source files or balanced to specify partitioning into
8424 equally sized chunks (whenever possible) or max to create new
8425 partition for every symbol where possible. Specifying none as an
8426 algorithm disables partitioning and streaming completely. The
8427 default value is balanced. While 1to1 can be used as an workaround
8428 for various code ordering issues, the max partitioning is intended
8429 for internal testing only. The value one specifies that exactly
8430 one partition should be used while the value none bypasses
8431 partitioning and executes the link-time optimization step directly
8432 from the WPA phase.
8433
8434 -flto-odr-type-merging
8435 Enable streaming of mangled types names of C++ types and their
8436 unification at link time. This increases size of LTO object files,
8437 but enables diagnostics about One Definition Rule violations.
8438
8439 -flto-compression-level=n
8440 This option specifies the level of compression used for
8441 intermediate language written to LTO object files, and is only
8442 meaningful in conjunction with LTO mode (-flto). Valid values are
8443 0 (no compression) to 9 (maximum compression). Values outside this
8444 range are clamped to either 0 or 9. If the option is not given, a
8445 default balanced compression setting is used.
8446
8447 -fuse-linker-plugin
8448 Enables the use of a linker plugin during link-time optimization.
8449 This option relies on plugin support in the linker, which is
8450 available in gold or in GNU ld 2.21 or newer.
8451
8452 This option enables the extraction of object files with GIMPLE
8453 bytecode out of library archives. This improves the quality of
8454 optimization by exposing more code to the link-time optimizer.
8455 This information specifies what symbols can be accessed externally
8456 (by non-LTO object or during dynamic linking). Resulting code
8457 quality improvements on binaries (and shared libraries that use
8458 hidden visibility) are similar to -fwhole-program. See -flto for a
8459 description of the effect of this flag and how to use it.
8460
8461 This option is enabled by default when LTO support in GCC is
8462 enabled and GCC was configured for use with a linker supporting
8463 plugins (GNU ld 2.21 or newer or gold).
8464
8465 -ffat-lto-objects
8466 Fat LTO objects are object files that contain both the intermediate
8467 language and the object code. This makes them usable for both LTO
8468 linking and normal linking. This option is effective only when
8469 compiling with -flto and is ignored at link time.
8470
8471 -fno-fat-lto-objects improves compilation time over plain LTO, but
8472 requires the complete toolchain to be aware of LTO. It requires a
8473 linker with linker plugin support for basic functionality.
8474 Additionally, nm, ar and ranlib need to support linker plugins to
8475 allow a full-featured build environment (capable of building static
8476 libraries etc). GCC provides the gcc-ar, gcc-nm, gcc-ranlib
8477 wrappers to pass the right options to these tools. With non fat LTO
8478 makefiles need to be modified to use them.
8479
8480 Note that modern binutils provide plugin auto-load mechanism.
8481 Installing the linker plugin into $libdir/bfd-plugins has the same
8482 effect as usage of the command wrappers (gcc-ar, gcc-nm and gcc-
8483 ranlib).
8484
8485 The default is -fno-fat-lto-objects on targets with linker plugin
8486 support.
8487
8488 -fcompare-elim
8489 After register allocation and post-register allocation instruction
8490 splitting, identify arithmetic instructions that compute processor
8491 flags similar to a comparison operation based on that arithmetic.
8492 If possible, eliminate the explicit comparison operation.
8493
8494 This pass only applies to certain targets that cannot explicitly
8495 represent the comparison operation before register allocation is
8496 complete.
8497
8498 Enabled at levels -O, -O2, -O3, -Os.
8499
8500 -fcprop-registers
8501 After register allocation and post-register allocation instruction
8502 splitting, perform a copy-propagation pass to try to reduce
8503 scheduling dependencies and occasionally eliminate the copy.
8504
8505 Enabled at levels -O, -O2, -O3, -Os.
8506
8507 -fprofile-correction
8508 Profiles collected using an instrumented binary for multi-threaded
8509 programs may be inconsistent due to missed counter updates. When
8510 this option is specified, GCC uses heuristics to correct or smooth
8511 out such inconsistencies. By default, GCC emits an error message
8512 when an inconsistent profile is detected.
8513
8514 This option is enabled by -fauto-profile.
8515
8516 -fprofile-use
8517 -fprofile-use=path
8518 Enable profile feedback-directed optimizations, and the following
8519 optimizations, many of which are generally profitable only with
8520 profile feedback available:
8521
8522 -fbranch-probabilities -fprofile-values -funroll-loops
8523 -fpeel-loops -ftracer -fvpt -finline-functions -fipa-cp
8524 -fipa-cp-clone -fipa-bit-cp -fpredictive-commoning -fsplit-loops
8525 -funswitch-loops -fgcse-after-reload -ftree-loop-vectorize
8526 -ftree-slp-vectorize -fvect-cost-model=dynamic
8527 -ftree-loop-distribute-patterns -fprofile-reorder-functions
8528
8529 Before you can use this option, you must first generate profiling
8530 information.
8531
8532 By default, GCC emits an error message if the feedback profiles do
8533 not match the source code. This error can be turned into a warning
8534 by using -Wno-error=coverage-mismatch. Note this may result in
8535 poorly optimized code. Additionally, by default, GCC also emits a
8536 warning message if the feedback profiles do not exist (see
8537 -Wmissing-profile).
8538
8539 If path is specified, GCC looks at the path to find the profile
8540 feedback data files. See -fprofile-dir.
8541
8542 -fauto-profile
8543 -fauto-profile=path
8544 Enable sampling-based feedback-directed optimizations, and the
8545 following optimizations, many of which are generally profitable
8546 only with profile feedback available:
8547
8548 -fbranch-probabilities -fprofile-values -funroll-loops
8549 -fpeel-loops -ftracer -fvpt -finline-functions -fipa-cp
8550 -fipa-cp-clone -fipa-bit-cp -fpredictive-commoning -fsplit-loops
8551 -funswitch-loops -fgcse-after-reload -ftree-loop-vectorize
8552 -ftree-slp-vectorize -fvect-cost-model=dynamic
8553 -ftree-loop-distribute-patterns -fprofile-correction
8554
8555 path is the name of a file containing AutoFDO profile information.
8556 If omitted, it defaults to fbdata.afdo in the current directory.
8557
8558 Producing an AutoFDO profile data file requires running your
8559 program with the perf utility on a supported GNU/Linux target
8560 system. For more information, see <https://perf.wiki.kernel.org/>.
8561
8562 E.g.
8563
8564 perf record -e br_inst_retired:near_taken -b -o perf.data \
8565 -- your_program
8566
8567 Then use the create_gcov tool to convert the raw profile data to a
8568 format that can be used by GCC. You must also supply the
8569 unstripped binary for your program to this tool. See
8570 <https://github.com/google/autofdo>.
8571
8572 E.g.
8573
8574 create_gcov --binary=your_program.unstripped --profile=perf.data \
8575 --gcov=profile.afdo
8576
8577 The following options control compiler behavior regarding floating-
8578 point arithmetic. These options trade off between speed and
8579 correctness. All must be specifically enabled.
8580
8581 -ffloat-store
8582 Do not store floating-point variables in registers, and inhibit
8583 other options that might change whether a floating-point value is
8584 taken from a register or memory.
8585
8586 This option prevents undesirable excess precision on machines such
8587 as the 68000 where the floating registers (of the 68881) keep more
8588 precision than a "double" is supposed to have. Similarly for the
8589 x86 architecture. For most programs, the excess precision does
8590 only good, but a few programs rely on the precise definition of
8591 IEEE floating point. Use -ffloat-store for such programs, after
8592 modifying them to store all pertinent intermediate computations
8593 into variables.
8594
8595 -fexcess-precision=style
8596 This option allows further control over excess precision on
8597 machines where floating-point operations occur in a format with
8598 more precision or range than the IEEE standard and interchange
8599 floating-point types. By default, -fexcess-precision=fast is in
8600 effect; this means that operations may be carried out in a wider
8601 precision than the types specified in the source if that would
8602 result in faster code, and it is unpredictable when rounding to the
8603 types specified in the source code takes place. When compiling C,
8604 if -fexcess-precision=standard is specified then excess precision
8605 follows the rules specified in ISO C99; in particular, both casts
8606 and assignments cause values to be rounded to their semantic types
8607 (whereas -ffloat-store only affects assignments). This option is
8608 enabled by default for C if a strict conformance option such as
8609 -std=c99 is used. -ffast-math enables -fexcess-precision=fast by
8610 default regardless of whether a strict conformance option is used.
8611
8612 -fexcess-precision=standard is not implemented for languages other
8613 than C. On the x86, it has no effect if -mfpmath=sse or
8614 -mfpmath=sse+387 is specified; in the former case, IEEE semantics
8615 apply without excess precision, and in the latter, rounding is
8616 unpredictable.
8617
8618 -ffast-math
8619 Sets the options -fno-math-errno, -funsafe-math-optimizations,
8620 -ffinite-math-only, -fno-rounding-math, -fno-signaling-nans,
8621 -fcx-limited-range and -fexcess-precision=fast.
8622
8623 This option causes the preprocessor macro "__FAST_MATH__" to be
8624 defined.
8625
8626 This option is not turned on by any -O option besides -Ofast since
8627 it can result in incorrect output for programs that depend on an
8628 exact implementation of IEEE or ISO rules/specifications for math
8629 functions. It may, however, yield faster code for programs that do
8630 not require the guarantees of these specifications.
8631
8632 -fno-math-errno
8633 Do not set "errno" after calling math functions that are executed
8634 with a single instruction, e.g., "sqrt". A program that relies on
8635 IEEE exceptions for math error handling may want to use this flag
8636 for speed while maintaining IEEE arithmetic compatibility.
8637
8638 This option is not turned on by any -O option since it can result
8639 in incorrect output for programs that depend on an exact
8640 implementation of IEEE or ISO rules/specifications for math
8641 functions. It may, however, yield faster code for programs that do
8642 not require the guarantees of these specifications.
8643
8644 The default is -fmath-errno.
8645
8646 On Darwin systems, the math library never sets "errno". There is
8647 therefore no reason for the compiler to consider the possibility
8648 that it might, and -fno-math-errno is the default.
8649
8650 -funsafe-math-optimizations
8651 Allow optimizations for floating-point arithmetic that (a) assume
8652 that arguments and results are valid and (b) may violate IEEE or
8653 ANSI standards. When used at link time, it may include libraries
8654 or startup files that change the default FPU control word or other
8655 similar optimizations.
8656
8657 This option is not turned on by any -O option since it can result
8658 in incorrect output for programs that depend on an exact
8659 implementation of IEEE or ISO rules/specifications for math
8660 functions. It may, however, yield faster code for programs that do
8661 not require the guarantees of these specifications. Enables
8662 -fno-signed-zeros, -fno-trapping-math, -fassociative-math and
8663 -freciprocal-math.
8664
8665 The default is -fno-unsafe-math-optimizations.
8666
8667 -fassociative-math
8668 Allow re-association of operands in series of floating-point
8669 operations. This violates the ISO C and C++ language standard by
8670 possibly changing computation result. NOTE: re-ordering may change
8671 the sign of zero as well as ignore NaNs and inhibit or create
8672 underflow or overflow (and thus cannot be used on code that relies
8673 on rounding behavior like "(x + 2**52) - 2**52". May also reorder
8674 floating-point comparisons and thus may not be used when ordered
8675 comparisons are required. This option requires that both
8676 -fno-signed-zeros and -fno-trapping-math be in effect. Moreover,
8677 it doesn't make much sense with -frounding-math. For Fortran the
8678 option is automatically enabled when both -fno-signed-zeros and
8679 -fno-trapping-math are in effect.
8680
8681 The default is -fno-associative-math.
8682
8683 -freciprocal-math
8684 Allow the reciprocal of a value to be used instead of dividing by
8685 the value if this enables optimizations. For example "x / y" can
8686 be replaced with "x * (1/y)", which is useful if "(1/y)" is subject
8687 to common subexpression elimination. Note that this loses
8688 precision and increases the number of flops operating on the value.
8689
8690 The default is -fno-reciprocal-math.
8691
8692 -ffinite-math-only
8693 Allow optimizations for floating-point arithmetic that assume that
8694 arguments and results are not NaNs or +-Infs.
8695
8696 This option is not turned on by any -O option since it can result
8697 in incorrect output for programs that depend on an exact
8698 implementation of IEEE or ISO rules/specifications for math
8699 functions. It may, however, yield faster code for programs that do
8700 not require the guarantees of these specifications.
8701
8702 The default is -fno-finite-math-only.
8703
8704 -fno-signed-zeros
8705 Allow optimizations for floating-point arithmetic that ignore the
8706 signedness of zero. IEEE arithmetic specifies the behavior of
8707 distinct +0.0 and -0.0 values, which then prohibits simplification
8708 of expressions such as x+0.0 or 0.0*x (even with
8709 -ffinite-math-only). This option implies that the sign of a zero
8710 result isn't significant.
8711
8712 The default is -fsigned-zeros.
8713
8714 -fno-trapping-math
8715 Compile code assuming that floating-point operations cannot
8716 generate user-visible traps. These traps include division by zero,
8717 overflow, underflow, inexact result and invalid operation. This
8718 option requires that -fno-signaling-nans be in effect. Setting
8719 this option may allow faster code if one relies on "non-stop" IEEE
8720 arithmetic, for example.
8721
8722 This option should never be turned on by any -O option since it can
8723 result in incorrect output for programs that depend on an exact
8724 implementation of IEEE or ISO rules/specifications for math
8725 functions.
8726
8727 The default is -ftrapping-math.
8728
8729 -frounding-math
8730 Disable transformations and optimizations that assume default
8731 floating-point rounding behavior. This is round-to-zero for all
8732 floating point to integer conversions, and round-to-nearest for all
8733 other arithmetic truncations. This option should be specified for
8734 programs that change the FP rounding mode dynamically, or that may
8735 be executed with a non-default rounding mode. This option disables
8736 constant folding of floating-point expressions at compile time
8737 (which may be affected by rounding mode) and arithmetic
8738 transformations that are unsafe in the presence of sign-dependent
8739 rounding modes.
8740
8741 The default is -fno-rounding-math.
8742
8743 This option is experimental and does not currently guarantee to
8744 disable all GCC optimizations that are affected by rounding mode.
8745 Future versions of GCC may provide finer control of this setting
8746 using C99's "FENV_ACCESS" pragma. This command-line option will be
8747 used to specify the default state for "FENV_ACCESS".
8748
8749 -fsignaling-nans
8750 Compile code assuming that IEEE signaling NaNs may generate user-
8751 visible traps during floating-point operations. Setting this
8752 option disables optimizations that may change the number of
8753 exceptions visible with signaling NaNs. This option implies
8754 -ftrapping-math.
8755
8756 This option causes the preprocessor macro "__SUPPORT_SNAN__" to be
8757 defined.
8758
8759 The default is -fno-signaling-nans.
8760
8761 This option is experimental and does not currently guarantee to
8762 disable all GCC optimizations that affect signaling NaN behavior.
8763
8764 -fno-fp-int-builtin-inexact
8765 Do not allow the built-in functions "ceil", "floor", "round" and
8766 "trunc", and their "float" and "long double" variants, to generate
8767 code that raises the "inexact" floating-point exception for
8768 noninteger arguments. ISO C99 and C11 allow these functions to
8769 raise the "inexact" exception, but ISO/IEC TS 18661-1:2014, the C
8770 bindings to IEEE 754-2008, does not allow these functions to do so.
8771
8772 The default is -ffp-int-builtin-inexact, allowing the exception to
8773 be raised. This option does nothing unless -ftrapping-math is in
8774 effect.
8775
8776 Even if -fno-fp-int-builtin-inexact is used, if the functions
8777 generate a call to a library function then the "inexact" exception
8778 may be raised if the library implementation does not follow TS
8779 18661.
8780
8781 -fsingle-precision-constant
8782 Treat floating-point constants as single precision instead of
8783 implicitly converting them to double-precision constants.
8784
8785 -fcx-limited-range
8786 When enabled, this option states that a range reduction step is not
8787 needed when performing complex division. Also, there is no
8788 checking whether the result of a complex multiplication or division
8789 is "NaN + I*NaN", with an attempt to rescue the situation in that
8790 case. The default is -fno-cx-limited-range, but is enabled by
8791 -ffast-math.
8792
8793 This option controls the default setting of the ISO C99
8794 "CX_LIMITED_RANGE" pragma. Nevertheless, the option applies to all
8795 languages.
8796
8797 -fcx-fortran-rules
8798 Complex multiplication and division follow Fortran rules. Range
8799 reduction is done as part of complex division, but there is no
8800 checking whether the result of a complex multiplication or division
8801 is "NaN + I*NaN", with an attempt to rescue the situation in that
8802 case.
8803
8804 The default is -fno-cx-fortran-rules.
8805
8806 The following options control optimizations that may improve
8807 performance, but are not enabled by any -O options. This section
8808 includes experimental options that may produce broken code.
8809
8810 -fbranch-probabilities
8811 After running a program compiled with -fprofile-arcs, you can
8812 compile it a second time using -fbranch-probabilities, to improve
8813 optimizations based on the number of times each branch was taken.
8814 When a program compiled with -fprofile-arcs exits, it saves arc
8815 execution counts to a file called sourcename.gcda for each source
8816 file. The information in this data file is very dependent on the
8817 structure of the generated code, so you must use the same source
8818 code and the same optimization options for both compilations.
8819
8820 With -fbranch-probabilities, GCC puts a REG_BR_PROB note on each
8821 JUMP_INSN and CALL_INSN. These can be used to improve
8822 optimization. Currently, they are only used in one place: in
8823 reorg.c, instead of guessing which path a branch is most likely to
8824 take, the REG_BR_PROB values are used to exactly determine which
8825 path is taken more often.
8826
8827 Enabled by -fprofile-use and -fauto-profile.
8828
8829 -fprofile-values
8830 If combined with -fprofile-arcs, it adds code so that some data
8831 about values of expressions in the program is gathered.
8832
8833 With -fbranch-probabilities, it reads back the data gathered from
8834 profiling values of expressions for usage in optimizations.
8835
8836 Enabled by -fprofile-generate, -fprofile-use, and -fauto-profile.
8837
8838 -fprofile-reorder-functions
8839 Function reordering based on profile instrumentation collects first
8840 time of execution of a function and orders these functions in
8841 ascending order.
8842
8843 Enabled with -fprofile-use.
8844
8845 -fvpt
8846 If combined with -fprofile-arcs, this option instructs the compiler
8847 to add code to gather information about values of expressions.
8848
8849 With -fbranch-probabilities, it reads back the data gathered and
8850 actually performs the optimizations based on them. Currently the
8851 optimizations include specialization of division operations using
8852 the knowledge about the value of the denominator.
8853
8854 Enabled with -fprofile-use and -fauto-profile.
8855
8856 -frename-registers
8857 Attempt to avoid false dependencies in scheduled code by making use
8858 of registers left over after register allocation. This
8859 optimization most benefits processors with lots of registers.
8860 Depending on the debug information format adopted by the target,
8861 however, it can make debugging impossible, since variables no
8862 longer stay in a "home register".
8863
8864 Enabled by default with -funroll-loops.
8865
8866 -fschedule-fusion
8867 Performs a target dependent pass over the instruction stream to
8868 schedule instructions of same type together because target machine
8869 can execute them more efficiently if they are adjacent to each
8870 other in the instruction flow.
8871
8872 Enabled at levels -O2, -O3, -Os.
8873
8874 -ftracer
8875 Perform tail duplication to enlarge superblock size. This
8876 transformation simplifies the control flow of the function allowing
8877 other optimizations to do a better job.
8878
8879 Enabled by -fprofile-use and -fauto-profile.
8880
8881 -funroll-loops
8882 Unroll loops whose number of iterations can be determined at
8883 compile time or upon entry to the loop. -funroll-loops implies
8884 -frerun-cse-after-loop, -fweb and -frename-registers. It also
8885 turns on complete loop peeling (i.e. complete removal of loops with
8886 a small constant number of iterations). This option makes code
8887 larger, and may or may not make it run faster.
8888
8889 Enabled by -fprofile-use and -fauto-profile.
8890
8891 -funroll-all-loops
8892 Unroll all loops, even if their number of iterations is uncertain
8893 when the loop is entered. This usually makes programs run more
8894 slowly. -funroll-all-loops implies the same options as
8895 -funroll-loops.
8896
8897 -fpeel-loops
8898 Peels loops for which there is enough information that they do not
8899 roll much (from profile feedback or static analysis). It also
8900 turns on complete loop peeling (i.e. complete removal of loops with
8901 small constant number of iterations).
8902
8903 Enabled by -O3, -fprofile-use, and -fauto-profile.
8904
8905 -fmove-loop-invariants
8906 Enables the loop invariant motion pass in the RTL loop optimizer.
8907 Enabled at level -O1 and higher, except for -Og.
8908
8909 -fsplit-loops
8910 Split a loop into two if it contains a condition that's always true
8911 for one side of the iteration space and false for the other.
8912
8913 Enabled by -fprofile-use and -fauto-profile.
8914
8915 -funswitch-loops
8916 Move branches with loop invariant conditions out of the loop, with
8917 duplicates of the loop on both branches (modified according to
8918 result of the condition).
8919
8920 Enabled by -fprofile-use and -fauto-profile.
8921
8922 -fversion-loops-for-strides
8923 If a loop iterates over an array with a variable stride, create
8924 another version of the loop that assumes the stride is always one.
8925 For example:
8926
8927 for (int i = 0; i < n; ++i)
8928 x[i * stride] = ...;
8929
8930 becomes:
8931
8932 if (stride == 1)
8933 for (int i = 0; i < n; ++i)
8934 x[i] = ...;
8935 else
8936 for (int i = 0; i < n; ++i)
8937 x[i * stride] = ...;
8938
8939 This is particularly useful for assumed-shape arrays in Fortran
8940 where (for example) it allows better vectorization assuming
8941 contiguous accesses. This flag is enabled by default at -O3. It
8942 is also enabled by -fprofile-use and -fauto-profile.
8943
8944 -ffunction-sections
8945 -fdata-sections
8946 Place each function or data item into its own section in the output
8947 file if the target supports arbitrary sections. The name of the
8948 function or the name of the data item determines the section's name
8949 in the output file.
8950
8951 Use these options on systems where the linker can perform
8952 optimizations to improve locality of reference in the instruction
8953 space. Most systems using the ELF object format have linkers with
8954 such optimizations. On AIX, the linker rearranges sections
8955 (CSECTs) based on the call graph. The performance impact varies.
8956
8957 Together with a linker garbage collection (linker --gc-sections
8958 option) these options may lead to smaller statically-linked
8959 executables (after stripping).
8960
8961 On ELF/DWARF systems these options do not degenerate the quality of
8962 the debug information. There could be issues with other object
8963 files/debug info formats.
8964
8965 Only use these options when there are significant benefits from
8966 doing so. When you specify these options, the assembler and linker
8967 create larger object and executable files and are also slower.
8968 These options affect code generation. They prevent optimizations
8969 by the compiler and assembler using relative locations inside a
8970 translation unit since the locations are unknown until link time.
8971 An example of such an optimization is relaxing calls to short call
8972 instructions.
8973
8974 -fbranch-target-load-optimize
8975 Perform branch target register load optimization before prologue /
8976 epilogue threading. The use of target registers can typically be
8977 exposed only during reload, thus hoisting loads out of loops and
8978 doing inter-block scheduling needs a separate optimization pass.
8979
8980 -fbranch-target-load-optimize2
8981 Perform branch target register load optimization after prologue /
8982 epilogue threading.
8983
8984 -fbtr-bb-exclusive
8985 When performing branch target register load optimization, don't
8986 reuse branch target registers within any basic block.
8987
8988 -fstdarg-opt
8989 Optimize the prologue of variadic argument functions with respect
8990 to usage of those arguments.
8991
8992 -fsection-anchors
8993 Try to reduce the number of symbolic address calculations by using
8994 shared "anchor" symbols to address nearby objects. This
8995 transformation can help to reduce the number of GOT entries and GOT
8996 accesses on some targets.
8997
8998 For example, the implementation of the following function "foo":
8999
9000 static int a, b, c;
9001 int foo (void) { return a + b + c; }
9002
9003 usually calculates the addresses of all three variables, but if you
9004 compile it with -fsection-anchors, it accesses the variables from a
9005 common anchor point instead. The effect is similar to the
9006 following pseudocode (which isn't valid C):
9007
9008 int foo (void)
9009 {
9010 register int *xr = &x;
9011 return xr[&a - &x] + xr[&b - &x] + xr[&c - &x];
9012 }
9013
9014 Not all targets support this option.
9015
9016 --param name=value
9017 In some places, GCC uses various constants to control the amount of
9018 optimization that is done. For example, GCC does not inline
9019 functions that contain more than a certain number of instructions.
9020 You can control some of these constants on the command line using
9021 the --param option.
9022
9023 The names of specific parameters, and the meaning of the values,
9024 are tied to the internals of the compiler, and are subject to
9025 change without notice in future releases.
9026
9027 In order to get minimal, maximal and default value of a parameter,
9028 one can use --help=param -Q options.
9029
9030 In each case, the value is an integer. The allowable choices for
9031 name are:
9032
9033 predictable-branch-outcome
9034 When branch is predicted to be taken with probability lower
9035 than this threshold (in percent), then it is considered well
9036 predictable.
9037
9038 max-rtl-if-conversion-insns
9039 RTL if-conversion tries to remove conditional branches around a
9040 block and replace them with conditionally executed
9041 instructions. This parameter gives the maximum number of
9042 instructions in a block which should be considered for if-
9043 conversion. The compiler will also use other heuristics to
9044 decide whether if-conversion is likely to be profitable.
9045
9046 max-rtl-if-conversion-predictable-cost
9047 max-rtl-if-conversion-unpredictable-cost
9048 RTL if-conversion will try to remove conditional branches
9049 around a block and replace them with conditionally executed
9050 instructions. These parameters give the maximum permissible
9051 cost for the sequence that would be generated by if-conversion
9052 depending on whether the branch is statically determined to be
9053 predictable or not. The units for this parameter are the same
9054 as those for the GCC internal seq_cost metric. The compiler
9055 will try to provide a reasonable default for this parameter
9056 using the BRANCH_COST target macro.
9057
9058 max-crossjump-edges
9059 The maximum number of incoming edges to consider for cross-
9060 jumping. The algorithm used by -fcrossjumping is O(N^2) in the
9061 number of edges incoming to each block. Increasing values mean
9062 more aggressive optimization, making the compilation time
9063 increase with probably small improvement in executable size.
9064
9065 min-crossjump-insns
9066 The minimum number of instructions that must be matched at the
9067 end of two blocks before cross-jumping is performed on them.
9068 This value is ignored in the case where all instructions in the
9069 block being cross-jumped from are matched.
9070
9071 max-grow-copy-bb-insns
9072 The maximum code size expansion factor when copying basic
9073 blocks instead of jumping. The expansion is relative to a jump
9074 instruction.
9075
9076 max-goto-duplication-insns
9077 The maximum number of instructions to duplicate to a block that
9078 jumps to a computed goto. To avoid O(N^2) behavior in a number
9079 of passes, GCC factors computed gotos early in the compilation
9080 process, and unfactors them as late as possible. Only computed
9081 jumps at the end of a basic blocks with no more than max-goto-
9082 duplication-insns are unfactored.
9083
9084 max-delay-slot-insn-search
9085 The maximum number of instructions to consider when looking for
9086 an instruction to fill a delay slot. If more than this
9087 arbitrary number of instructions are searched, the time savings
9088 from filling the delay slot are minimal, so stop searching.
9089 Increasing values mean more aggressive optimization, making the
9090 compilation time increase with probably small improvement in
9091 execution time.
9092
9093 max-delay-slot-live-search
9094 When trying to fill delay slots, the maximum number of
9095 instructions to consider when searching for a block with valid
9096 live register information. Increasing this arbitrarily chosen
9097 value means more aggressive optimization, increasing the
9098 compilation time. This parameter should be removed when the
9099 delay slot code is rewritten to maintain the control-flow
9100 graph.
9101
9102 max-gcse-memory
9103 The approximate maximum amount of memory that can be allocated
9104 in order to perform the global common subexpression elimination
9105 optimization. If more memory than specified is required, the
9106 optimization is not done.
9107
9108 max-gcse-insertion-ratio
9109 If the ratio of expression insertions to deletions is larger
9110 than this value for any expression, then RTL PRE inserts or
9111 removes the expression and thus leaves partially redundant
9112 computations in the instruction stream.
9113
9114 max-pending-list-length
9115 The maximum number of pending dependencies scheduling allows
9116 before flushing the current state and starting over. Large
9117 functions with few branches or calls can create excessively
9118 large lists which needlessly consume memory and resources.
9119
9120 max-modulo-backtrack-attempts
9121 The maximum number of backtrack attempts the scheduler should
9122 make when modulo scheduling a loop. Larger values can
9123 exponentially increase compilation time.
9124
9125 max-inline-insns-single
9126 Several parameters control the tree inliner used in GCC. This
9127 number sets the maximum number of instructions (counted in
9128 GCC's internal representation) in a single function that the
9129 tree inliner considers for inlining. This only affects
9130 functions declared inline and methods implemented in a class
9131 declaration (C++).
9132
9133 max-inline-insns-auto
9134 When you use -finline-functions (included in -O3), a lot of
9135 functions that would otherwise not be considered for inlining
9136 by the compiler are investigated. To those functions, a
9137 different (more restrictive) limit compared to functions
9138 declared inline can be applied.
9139
9140 max-inline-insns-small
9141 This is bound applied to calls which are considered relevant
9142 with -finline-small-functions.
9143
9144 max-inline-insns-size
9145 This is bound applied to calls which are optimized for size.
9146 Small growth may be desirable to anticipate optimization
9147 oppurtunities exposed by inlining.
9148
9149 uninlined-function-insns
9150 Number of instructions accounted by inliner for function
9151 overhead such as function prologue and epilogue.
9152
9153 uninlined-function-time
9154 Extra time accounted by inliner for function overhead such as
9155 time needed to execute function prologue and epilogue
9156
9157 uninlined-thunk-insns
9158 uninlined-thunk-time
9159 Same as --param uninlined-function-insns and --param uninlined-
9160 function-time but applied to function thunks
9161
9162 inline-min-speedup
9163 When estimated performance improvement of caller + callee
9164 runtime exceeds this threshold (in percent), the function can
9165 be inlined regardless of the limit on --param max-inline-insns-
9166 single and --param max-inline-insns-auto.
9167
9168 large-function-insns
9169 The limit specifying really large functions. For functions
9170 larger than this limit after inlining, inlining is constrained
9171 by --param large-function-growth. This parameter is useful
9172 primarily to avoid extreme compilation time caused by non-
9173 linear algorithms used by the back end.
9174
9175 large-function-growth
9176 Specifies maximal growth of large function caused by inlining
9177 in percents. For example, parameter value 100 limits large
9178 function growth to 2.0 times the original size.
9179
9180 large-unit-insns
9181 The limit specifying large translation unit. Growth caused by
9182 inlining of units larger than this limit is limited by --param
9183 inline-unit-growth. For small units this might be too tight.
9184 For example, consider a unit consisting of function A that is
9185 inline and B that just calls A three times. If B is small
9186 relative to A, the growth of unit is 300\% and yet such
9187 inlining is very sane. For very large units consisting of
9188 small inlineable functions, however, the overall unit growth
9189 limit is needed to avoid exponential explosion of code size.
9190 Thus for smaller units, the size is increased to --param large-
9191 unit-insns before applying --param inline-unit-growth.
9192
9193 inline-unit-growth
9194 Specifies maximal overall growth of the compilation unit caused
9195 by inlining. For example, parameter value 20 limits unit
9196 growth to 1.2 times the original size. Cold functions (either
9197 marked cold via an attribute or by profile feedback) are not
9198 accounted into the unit size.
9199
9200 ipcp-unit-growth
9201 Specifies maximal overall growth of the compilation unit caused
9202 by interprocedural constant propagation. For example,
9203 parameter value 10 limits unit growth to 1.1 times the original
9204 size.
9205
9206 large-stack-frame
9207 The limit specifying large stack frames. While inlining the
9208 algorithm is trying to not grow past this limit too much.
9209
9210 large-stack-frame-growth
9211 Specifies maximal growth of large stack frames caused by
9212 inlining in percents. For example, parameter value 1000 limits
9213 large stack frame growth to 11 times the original size.
9214
9215 max-inline-insns-recursive
9216 max-inline-insns-recursive-auto
9217 Specifies the maximum number of instructions an out-of-line
9218 copy of a self-recursive inline function can grow into by
9219 performing recursive inlining.
9220
9221 --param max-inline-insns-recursive applies to functions
9222 declared inline. For functions not declared inline, recursive
9223 inlining happens only when -finline-functions (included in -O3)
9224 is enabled; --param max-inline-insns-recursive-auto applies
9225 instead.
9226
9227 max-inline-recursive-depth
9228 max-inline-recursive-depth-auto
9229 Specifies the maximum recursion depth used for recursive
9230 inlining.
9231
9232 --param max-inline-recursive-depth applies to functions
9233 declared inline. For functions not declared inline, recursive
9234 inlining happens only when -finline-functions (included in -O3)
9235 is enabled; --param max-inline-recursive-depth-auto applies
9236 instead.
9237
9238 min-inline-recursive-probability
9239 Recursive inlining is profitable only for function having deep
9240 recursion in average and can hurt for function having little
9241 recursion depth by increasing the prologue size or complexity
9242 of function body to other optimizers.
9243
9244 When profile feedback is available (see -fprofile-generate) the
9245 actual recursion depth can be guessed from the probability that
9246 function recurses via a given call expression. This parameter
9247 limits inlining only to call expressions whose probability
9248 exceeds the given threshold (in percents).
9249
9250 early-inlining-insns
9251 Specify growth that the early inliner can make. In effect it
9252 increases the amount of inlining for code having a large
9253 abstraction penalty.
9254
9255 max-early-inliner-iterations
9256 Limit of iterations of the early inliner. This basically
9257 bounds the number of nested indirect calls the early inliner
9258 can resolve. Deeper chains are still handled by late inlining.
9259
9260 comdat-sharing-probability
9261 Probability (in percent) that C++ inline function with comdat
9262 visibility are shared across multiple compilation units.
9263
9264 profile-func-internal-id
9265 A parameter to control whether to use function internal id in
9266 profile database lookup. If the value is 0, the compiler uses
9267 an id that is based on function assembler name and filename,
9268 which makes old profile data more tolerant to source changes
9269 such as function reordering etc.
9270
9271 min-vect-loop-bound
9272 The minimum number of iterations under which loops are not
9273 vectorized when -ftree-vectorize is used. The number of
9274 iterations after vectorization needs to be greater than the
9275 value specified by this option to allow vectorization.
9276
9277 gcse-cost-distance-ratio
9278 Scaling factor in calculation of maximum distance an expression
9279 can be moved by GCSE optimizations. This is currently
9280 supported only in the code hoisting pass. The bigger the
9281 ratio, the more aggressive code hoisting is with simple
9282 expressions, i.e., the expressions that have cost less than
9283 gcse-unrestricted-cost. Specifying 0 disables hoisting of
9284 simple expressions.
9285
9286 gcse-unrestricted-cost
9287 Cost, roughly measured as the cost of a single typical machine
9288 instruction, at which GCSE optimizations do not constrain the
9289 distance an expression can travel. This is currently supported
9290 only in the code hoisting pass. The lesser the cost, the more
9291 aggressive code hoisting is. Specifying 0 allows all
9292 expressions to travel unrestricted distances.
9293
9294 max-hoist-depth
9295 The depth of search in the dominator tree for expressions to
9296 hoist. This is used to avoid quadratic behavior in hoisting
9297 algorithm. The value of 0 does not limit on the search, but
9298 may slow down compilation of huge functions.
9299
9300 max-tail-merge-comparisons
9301 The maximum amount of similar bbs to compare a bb with. This
9302 is used to avoid quadratic behavior in tree tail merging.
9303
9304 max-tail-merge-iterations
9305 The maximum amount of iterations of the pass over the function.
9306 This is used to limit compilation time in tree tail merging.
9307
9308 store-merging-allow-unaligned
9309 Allow the store merging pass to introduce unaligned stores if
9310 it is legal to do so.
9311
9312 max-stores-to-merge
9313 The maximum number of stores to attempt to merge into wider
9314 stores in the store merging pass.
9315
9316 max-unrolled-insns
9317 The maximum number of instructions that a loop may have to be
9318 unrolled. If a loop is unrolled, this parameter also
9319 determines how many times the loop code is unrolled.
9320
9321 max-average-unrolled-insns
9322 The maximum number of instructions biased by probabilities of
9323 their execution that a loop may have to be unrolled. If a loop
9324 is unrolled, this parameter also determines how many times the
9325 loop code is unrolled.
9326
9327 max-unroll-times
9328 The maximum number of unrollings of a single loop.
9329
9330 max-peeled-insns
9331 The maximum number of instructions that a loop may have to be
9332 peeled. If a loop is peeled, this parameter also determines
9333 how many times the loop code is peeled.
9334
9335 max-peel-times
9336 The maximum number of peelings of a single loop.
9337
9338 max-peel-branches
9339 The maximum number of branches on the hot path through the
9340 peeled sequence.
9341
9342 max-completely-peeled-insns
9343 The maximum number of insns of a completely peeled loop.
9344
9345 max-completely-peel-times
9346 The maximum number of iterations of a loop to be suitable for
9347 complete peeling.
9348
9349 max-completely-peel-loop-nest-depth
9350 The maximum depth of a loop nest suitable for complete peeling.
9351
9352 max-unswitch-insns
9353 The maximum number of insns of an unswitched loop.
9354
9355 max-unswitch-level
9356 The maximum number of branches unswitched in a single loop.
9357
9358 lim-expensive
9359 The minimum cost of an expensive expression in the loop
9360 invariant motion.
9361
9362 iv-consider-all-candidates-bound
9363 Bound on number of candidates for induction variables, below
9364 which all candidates are considered for each use in induction
9365 variable optimizations. If there are more candidates than
9366 this, only the most relevant ones are considered to avoid
9367 quadratic time complexity.
9368
9369 iv-max-considered-uses
9370 The induction variable optimizations give up on loops that
9371 contain more induction variable uses.
9372
9373 iv-always-prune-cand-set-bound
9374 If the number of candidates in the set is smaller than this
9375 value, always try to remove unnecessary ivs from the set when
9376 adding a new one.
9377
9378 avg-loop-niter
9379 Average number of iterations of a loop.
9380
9381 dse-max-object-size
9382 Maximum size (in bytes) of objects tracked bytewise by dead
9383 store elimination. Larger values may result in larger
9384 compilation times.
9385
9386 dse-max-alias-queries-per-store
9387 Maximum number of queries into the alias oracle per store.
9388 Larger values result in larger compilation times and may result
9389 in more removed dead stores.
9390
9391 scev-max-expr-size
9392 Bound on size of expressions used in the scalar evolutions
9393 analyzer. Large expressions slow the analyzer.
9394
9395 scev-max-expr-complexity
9396 Bound on the complexity of the expressions in the scalar
9397 evolutions analyzer. Complex expressions slow the analyzer.
9398
9399 max-tree-if-conversion-phi-args
9400 Maximum number of arguments in a PHI supported by TREE if
9401 conversion unless the loop is marked with simd pragma.
9402
9403 vect-max-version-for-alignment-checks
9404 The maximum number of run-time checks that can be performed
9405 when doing loop versioning for alignment in the vectorizer.
9406
9407 vect-max-version-for-alias-checks
9408 The maximum number of run-time checks that can be performed
9409 when doing loop versioning for alias in the vectorizer.
9410
9411 vect-max-peeling-for-alignment
9412 The maximum number of loop peels to enhance access alignment
9413 for vectorizer. Value -1 means no limit.
9414
9415 max-iterations-to-track
9416 The maximum number of iterations of a loop the brute-force
9417 algorithm for analysis of the number of iterations of the loop
9418 tries to evaluate.
9419
9420 hot-bb-count-ws-permille
9421 A basic block profile count is considered hot if it contributes
9422 to the given permillage (i.e. 0...1000) of the entire profiled
9423 execution.
9424
9425 hot-bb-frequency-fraction
9426 Select fraction of the entry block frequency of executions of
9427 basic block in function given basic block needs to have to be
9428 considered hot.
9429
9430 max-predicted-iterations
9431 The maximum number of loop iterations we predict statically.
9432 This is useful in cases where a function contains a single loop
9433 with known bound and another loop with unknown bound. The
9434 known number of iterations is predicted correctly, while the
9435 unknown number of iterations average to roughly 10. This means
9436 that the loop without bounds appears artificially cold relative
9437 to the other one.
9438
9439 builtin-expect-probability
9440 Control the probability of the expression having the specified
9441 value. This parameter takes a percentage (i.e. 0 ... 100) as
9442 input.
9443
9444 builtin-string-cmp-inline-length
9445 The maximum length of a constant string for a builtin string
9446 cmp call eligible for inlining.
9447
9448 align-threshold
9449 Select fraction of the maximal frequency of executions of a
9450 basic block in a function to align the basic block.
9451
9452 align-loop-iterations
9453 A loop expected to iterate at least the selected number of
9454 iterations is aligned.
9455
9456 tracer-dynamic-coverage
9457 tracer-dynamic-coverage-feedback
9458 This value is used to limit superblock formation once the given
9459 percentage of executed instructions is covered. This limits
9460 unnecessary code size expansion.
9461
9462 The tracer-dynamic-coverage-feedback parameter is used only
9463 when profile feedback is available. The real profiles (as
9464 opposed to statically estimated ones) are much less balanced
9465 allowing the threshold to be larger value.
9466
9467 tracer-max-code-growth
9468 Stop tail duplication once code growth has reached given
9469 percentage. This is a rather artificial limit, as most of the
9470 duplicates are eliminated later in cross jumping, so it may be
9471 set to much higher values than is the desired code growth.
9472
9473 tracer-min-branch-ratio
9474 Stop reverse growth when the reverse probability of best edge
9475 is less than this threshold (in percent).
9476
9477 tracer-min-branch-probability
9478 tracer-min-branch-probability-feedback
9479 Stop forward growth if the best edge has probability lower than
9480 this threshold.
9481
9482 Similarly to tracer-dynamic-coverage two parameters are
9483 provided. tracer-min-branch-probability-feedback is used for
9484 compilation with profile feedback and tracer-min-branch-
9485 probability compilation without. The value for compilation
9486 with profile feedback needs to be more conservative (higher) in
9487 order to make tracer effective.
9488
9489 stack-clash-protection-guard-size
9490 Specify the size of the operating system provided stack guard
9491 as 2 raised to num bytes. Higher values may reduce the number
9492 of explicit probes, but a value larger than the operating
9493 system provided guard will leave code vulnerable to stack clash
9494 style attacks.
9495
9496 stack-clash-protection-probe-interval
9497 Stack clash protection involves probing stack space as it is
9498 allocated. This param controls the maximum distance between
9499 probes into the stack as 2 raised to num bytes. Higher values
9500 may reduce the number of explicit probes, but a value larger
9501 than the operating system provided guard will leave code
9502 vulnerable to stack clash style attacks.
9503
9504 max-cse-path-length
9505 The maximum number of basic blocks on path that CSE considers.
9506
9507 max-cse-insns
9508 The maximum number of instructions CSE processes before
9509 flushing.
9510
9511 ggc-min-expand
9512 GCC uses a garbage collector to manage its own memory
9513 allocation. This parameter specifies the minimum percentage by
9514 which the garbage collector's heap should be allowed to expand
9515 between collections. Tuning this may improve compilation
9516 speed; it has no effect on code generation.
9517
9518 The default is 30% + 70% * (RAM/1GB) with an upper bound of
9519 100% when RAM >= 1GB. If "getrlimit" is available, the notion
9520 of "RAM" is the smallest of actual RAM and "RLIMIT_DATA" or
9521 "RLIMIT_AS". If GCC is not able to calculate RAM on a
9522 particular platform, the lower bound of 30% is used. Setting
9523 this parameter and ggc-min-heapsize to zero causes a full
9524 collection to occur at every opportunity. This is extremely
9525 slow, but can be useful for debugging.
9526
9527 ggc-min-heapsize
9528 Minimum size of the garbage collector's heap before it begins
9529 bothering to collect garbage. The first collection occurs
9530 after the heap expands by ggc-min-expand% beyond ggc-min-
9531 heapsize. Again, tuning this may improve compilation speed,
9532 and has no effect on code generation.
9533
9534 The default is the smaller of RAM/8, RLIMIT_RSS, or a limit
9535 that tries to ensure that RLIMIT_DATA or RLIMIT_AS are not
9536 exceeded, but with a lower bound of 4096 (four megabytes) and
9537 an upper bound of 131072 (128 megabytes). If GCC is not able
9538 to calculate RAM on a particular platform, the lower bound is
9539 used. Setting this parameter very large effectively disables
9540 garbage collection. Setting this parameter and ggc-min-expand
9541 to zero causes a full collection to occur at every opportunity.
9542
9543 max-reload-search-insns
9544 The maximum number of instruction reload should look backward
9545 for equivalent register. Increasing values mean more
9546 aggressive optimization, making the compilation time increase
9547 with probably slightly better performance.
9548
9549 max-cselib-memory-locations
9550 The maximum number of memory locations cselib should take into
9551 account. Increasing values mean more aggressive optimization,
9552 making the compilation time increase with probably slightly
9553 better performance.
9554
9555 max-sched-ready-insns
9556 The maximum number of instructions ready to be issued the
9557 scheduler should consider at any given time during the first
9558 scheduling pass. Increasing values mean more thorough
9559 searches, making the compilation time increase with probably
9560 little benefit.
9561
9562 max-sched-region-blocks
9563 The maximum number of blocks in a region to be considered for
9564 interblock scheduling.
9565
9566 max-pipeline-region-blocks
9567 The maximum number of blocks in a region to be considered for
9568 pipelining in the selective scheduler.
9569
9570 max-sched-region-insns
9571 The maximum number of insns in a region to be considered for
9572 interblock scheduling.
9573
9574 max-pipeline-region-insns
9575 The maximum number of insns in a region to be considered for
9576 pipelining in the selective scheduler.
9577
9578 min-spec-prob
9579 The minimum probability (in percents) of reaching a source
9580 block for interblock speculative scheduling.
9581
9582 max-sched-extend-regions-iters
9583 The maximum number of iterations through CFG to extend regions.
9584 A value of 0 disables region extensions.
9585
9586 max-sched-insn-conflict-delay
9587 The maximum conflict delay for an insn to be considered for
9588 speculative motion.
9589
9590 sched-spec-prob-cutoff
9591 The minimal probability of speculation success (in percents),
9592 so that speculative insns are scheduled.
9593
9594 sched-state-edge-prob-cutoff
9595 The minimum probability an edge must have for the scheduler to
9596 save its state across it.
9597
9598 sched-mem-true-dep-cost
9599 Minimal distance (in CPU cycles) between store and load
9600 targeting same memory locations.
9601
9602 selsched-max-lookahead
9603 The maximum size of the lookahead window of selective
9604 scheduling. It is a depth of search for available
9605 instructions.
9606
9607 selsched-max-sched-times
9608 The maximum number of times that an instruction is scheduled
9609 during selective scheduling. This is the limit on the number
9610 of iterations through which the instruction may be pipelined.
9611
9612 selsched-insns-to-rename
9613 The maximum number of best instructions in the ready list that
9614 are considered for renaming in the selective scheduler.
9615
9616 sms-min-sc
9617 The minimum value of stage count that swing modulo scheduler
9618 generates.
9619
9620 max-last-value-rtl
9621 The maximum size measured as number of RTLs that can be
9622 recorded in an expression in combiner for a pseudo register as
9623 last known value of that register.
9624
9625 max-combine-insns
9626 The maximum number of instructions the RTL combiner tries to
9627 combine.
9628
9629 integer-share-limit
9630 Small integer constants can use a shared data structure,
9631 reducing the compiler's memory usage and increasing its speed.
9632 This sets the maximum value of a shared integer constant.
9633
9634 ssp-buffer-size
9635 The minimum size of buffers (i.e. arrays) that receive stack
9636 smashing protection when -fstack-protection is used.
9637
9638 min-size-for-stack-sharing
9639 The minimum size of variables taking part in stack slot sharing
9640 when not optimizing.
9641
9642 max-jump-thread-duplication-stmts
9643 Maximum number of statements allowed in a block that needs to
9644 be duplicated when threading jumps.
9645
9646 max-fields-for-field-sensitive
9647 Maximum number of fields in a structure treated in a field
9648 sensitive manner during pointer analysis.
9649
9650 prefetch-latency
9651 Estimate on average number of instructions that are executed
9652 before prefetch finishes. The distance prefetched ahead is
9653 proportional to this constant. Increasing this number may also
9654 lead to less streams being prefetched (see simultaneous-
9655 prefetches).
9656
9657 simultaneous-prefetches
9658 Maximum number of prefetches that can run at the same time.
9659
9660 l1-cache-line-size
9661 The size of cache line in L1 data cache, in bytes.
9662
9663 l1-cache-size
9664 The size of L1 data cache, in kilobytes.
9665
9666 l2-cache-size
9667 The size of L2 data cache, in kilobytes.
9668
9669 prefetch-dynamic-strides
9670 Whether the loop array prefetch pass should issue software
9671 prefetch hints for strides that are non-constant. In some
9672 cases this may be beneficial, though the fact the stride is
9673 non-constant may make it hard to predict when there is clear
9674 benefit to issuing these hints.
9675
9676 Set to 1 if the prefetch hints should be issued for non-
9677 constant strides. Set to 0 if prefetch hints should be issued
9678 only for strides that are known to be constant and below
9679 prefetch-minimum-stride.
9680
9681 prefetch-minimum-stride
9682 Minimum constant stride, in bytes, to start using prefetch
9683 hints for. If the stride is less than this threshold, prefetch
9684 hints will not be issued.
9685
9686 This setting is useful for processors that have hardware
9687 prefetchers, in which case there may be conflicts between the
9688 hardware prefetchers and the software prefetchers. If the
9689 hardware prefetchers have a maximum stride they can handle, it
9690 should be used here to improve the use of software prefetchers.
9691
9692 A value of -1 means we don't have a threshold and therefore
9693 prefetch hints can be issued for any constant stride.
9694
9695 This setting is only useful for strides that are known and
9696 constant.
9697
9698 loop-interchange-max-num-stmts
9699 The maximum number of stmts in a loop to be interchanged.
9700
9701 loop-interchange-stride-ratio
9702 The minimum ratio between stride of two loops for interchange
9703 to be profitable.
9704
9705 min-insn-to-prefetch-ratio
9706 The minimum ratio between the number of instructions and the
9707 number of prefetches to enable prefetching in a loop.
9708
9709 prefetch-min-insn-to-mem-ratio
9710 The minimum ratio between the number of instructions and the
9711 number of memory references to enable prefetching in a loop.
9712
9713 use-canonical-types
9714 Whether the compiler should use the "canonical" type system.
9715 Should always be 1, which uses a more efficient internal
9716 mechanism for comparing types in C++ and Objective-C++.
9717 However, if bugs in the canonical type system are causing
9718 compilation failures, set this value to 0 to disable canonical
9719 types.
9720
9721 switch-conversion-max-branch-ratio
9722 Switch initialization conversion refuses to create arrays that
9723 are bigger than switch-conversion-max-branch-ratio times the
9724 number of branches in the switch.
9725
9726 max-partial-antic-length
9727 Maximum length of the partial antic set computed during the
9728 tree partial redundancy elimination optimization (-ftree-pre)
9729 when optimizing at -O3 and above. For some sorts of source
9730 code the enhanced partial redundancy elimination optimization
9731 can run away, consuming all of the memory available on the host
9732 machine. This parameter sets a limit on the length of the sets
9733 that are computed, which prevents the runaway behavior.
9734 Setting a value of 0 for this parameter allows an unlimited set
9735 length.
9736
9737 rpo-vn-max-loop-depth
9738 Maximum loop depth that is value-numbered optimistically. When
9739 the limit hits the innermost rpo-vn-max-loop-depth loops and
9740 the outermost loop in the loop nest are value-numbered
9741 optimistically and the remaining ones not.
9742
9743 sccvn-max-alias-queries-per-access
9744 Maximum number of alias-oracle queries we perform when looking
9745 for redundancies for loads and stores. If this limit is hit
9746 the search is aborted and the load or store is not considered
9747 redundant. The number of queries is algorithmically limited to
9748 the number of stores on all paths from the load to the function
9749 entry.
9750
9751 ira-max-loops-num
9752 IRA uses regional register allocation by default. If a
9753 function contains more loops than the number given by this
9754 parameter, only at most the given number of the most
9755 frequently-executed loops form regions for regional register
9756 allocation.
9757
9758 ira-max-conflict-table-size
9759 Although IRA uses a sophisticated algorithm to compress the
9760 conflict table, the table can still require excessive amounts
9761 of memory for huge functions. If the conflict table for a
9762 function could be more than the size in MB given by this
9763 parameter, the register allocator instead uses a faster,
9764 simpler, and lower-quality algorithm that does not require
9765 building a pseudo-register conflict table.
9766
9767 ira-loop-reserved-regs
9768 IRA can be used to evaluate more accurate register pressure in
9769 loops for decisions to move loop invariants (see -O3). The
9770 number of available registers reserved for some other purposes
9771 is given by this parameter. Default of the parameter is the
9772 best found from numerous experiments.
9773
9774 lra-inheritance-ebb-probability-cutoff
9775 LRA tries to reuse values reloaded in registers in subsequent
9776 insns. This optimization is called inheritance. EBB is used
9777 as a region to do this optimization. The parameter defines a
9778 minimal fall-through edge probability in percentage used to add
9779 BB to inheritance EBB in LRA. The default value was chosen
9780 from numerous runs of SPEC2000 on x86-64.
9781
9782 loop-invariant-max-bbs-in-loop
9783 Loop invariant motion can be very expensive, both in
9784 compilation time and in amount of needed compile-time memory,
9785 with very large loops. Loops with more basic blocks than this
9786 parameter won't have loop invariant motion optimization
9787 performed on them.
9788
9789 loop-max-datarefs-for-datadeps
9790 Building data dependencies is expensive for very large loops.
9791 This parameter limits the number of data references in loops
9792 that are considered for data dependence analysis. These large
9793 loops are no handled by the optimizations using loop data
9794 dependencies.
9795
9796 max-vartrack-size
9797 Sets a maximum number of hash table slots to use during
9798 variable tracking dataflow analysis of any function. If this
9799 limit is exceeded with variable tracking at assignments
9800 enabled, analysis for that function is retried without it,
9801 after removing all debug insns from the function. If the limit
9802 is exceeded even without debug insns, var tracking analysis is
9803 completely disabled for the function. Setting the parameter to
9804 zero makes it unlimited.
9805
9806 max-vartrack-expr-depth
9807 Sets a maximum number of recursion levels when attempting to
9808 map variable names or debug temporaries to value expressions.
9809 This trades compilation time for more complete debug
9810 information. If this is set too low, value expressions that
9811 are available and could be represented in debug information may
9812 end up not being used; setting this higher may enable the
9813 compiler to find more complex debug expressions, but compile
9814 time and memory use may grow.
9815
9816 max-debug-marker-count
9817 Sets a threshold on the number of debug markers (e.g. begin
9818 stmt markers) to avoid complexity explosion at inlining or
9819 expanding to RTL. If a function has more such gimple stmts
9820 than the set limit, such stmts will be dropped from the inlined
9821 copy of a function, and from its RTL expansion.
9822
9823 min-nondebug-insn-uid
9824 Use uids starting at this parameter for nondebug insns. The
9825 range below the parameter is reserved exclusively for debug
9826 insns created by -fvar-tracking-assignments, but debug insns
9827 may get (non-overlapping) uids above it if the reserved range
9828 is exhausted.
9829
9830 ipa-sra-ptr-growth-factor
9831 IPA-SRA replaces a pointer to an aggregate with one or more new
9832 parameters only when their cumulative size is less or equal to
9833 ipa-sra-ptr-growth-factor times the size of the original
9834 pointer parameter.
9835
9836 sra-max-scalarization-size-Ospeed
9837 sra-max-scalarization-size-Osize
9838 The two Scalar Reduction of Aggregates passes (SRA and IPA-SRA)
9839 aim to replace scalar parts of aggregates with uses of
9840 independent scalar variables. These parameters control the
9841 maximum size, in storage units, of aggregate which is
9842 considered for replacement when compiling for speed (sra-max-
9843 scalarization-size-Ospeed) or size (sra-max-scalarization-size-
9844 Osize) respectively.
9845
9846 tm-max-aggregate-size
9847 When making copies of thread-local variables in a transaction,
9848 this parameter specifies the size in bytes after which
9849 variables are saved with the logging functions as opposed to
9850 save/restore code sequence pairs. This option only applies
9851 when using -fgnu-tm.
9852
9853 graphite-max-nb-scop-params
9854 To avoid exponential effects in the Graphite loop transforms,
9855 the number of parameters in a Static Control Part (SCoP) is
9856 bounded. A value of zero can be used to lift the bound. A
9857 variable whose value is unknown at compilation time and defined
9858 outside a SCoP is a parameter of the SCoP.
9859
9860 loop-block-tile-size
9861 Loop blocking or strip mining transforms, enabled with
9862 -floop-block or -floop-strip-mine, strip mine each loop in the
9863 loop nest by a given number of iterations. The strip length
9864 can be changed using the loop-block-tile-size parameter.
9865
9866 ipa-cp-value-list-size
9867 IPA-CP attempts to track all possible values and types passed
9868 to a function's parameter in order to propagate them and
9869 perform devirtualization. ipa-cp-value-list-size is the
9870 maximum number of values and types it stores per one formal
9871 parameter of a function.
9872
9873 ipa-cp-eval-threshold
9874 IPA-CP calculates its own score of cloning profitability
9875 heuristics and performs those cloning opportunities with scores
9876 that exceed ipa-cp-eval-threshold.
9877
9878 ipa-cp-recursion-penalty
9879 Percentage penalty the recursive functions will receive when
9880 they are evaluated for cloning.
9881
9882 ipa-cp-single-call-penalty
9883 Percentage penalty functions containing a single call to
9884 another function will receive when they are evaluated for
9885 cloning.
9886
9887 ipa-max-agg-items
9888 IPA-CP is also capable to propagate a number of scalar values
9889 passed in an aggregate. ipa-max-agg-items controls the maximum
9890 number of such values per one parameter.
9891
9892 ipa-cp-loop-hint-bonus
9893 When IPA-CP determines that a cloning candidate would make the
9894 number of iterations of a loop known, it adds a bonus of ipa-
9895 cp-loop-hint-bonus to the profitability score of the candidate.
9896
9897 ipa-cp-array-index-hint-bonus
9898 When IPA-CP determines that a cloning candidate would make the
9899 index of an array access known, it adds a bonus of ipa-cp-
9900 array-index-hint-bonus to the profitability score of the
9901 candidate.
9902
9903 ipa-max-aa-steps
9904 During its analysis of function bodies, IPA-CP employs alias
9905 analysis in order to track values pointed to by function
9906 parameters. In order not spend too much time analyzing huge
9907 functions, it gives up and consider all memory clobbered after
9908 examining ipa-max-aa-steps statements modifying memory.
9909
9910 lto-partitions
9911 Specify desired number of partitions produced during WHOPR
9912 compilation. The number of partitions should exceed the number
9913 of CPUs used for compilation.
9914
9915 lto-min-partition
9916 Size of minimal partition for WHOPR (in estimated
9917 instructions). This prevents expenses of splitting very small
9918 programs into too many partitions.
9919
9920 lto-max-partition
9921 Size of max partition for WHOPR (in estimated instructions).
9922 to provide an upper bound for individual size of partition.
9923 Meant to be used only with balanced partitioning.
9924
9925 lto-max-streaming-parallelism
9926 Maximal number of parallel processes used for LTO streaming.
9927
9928 cxx-max-namespaces-for-diagnostic-help
9929 The maximum number of namespaces to consult for suggestions
9930 when C++ name lookup fails for an identifier.
9931
9932 sink-frequency-threshold
9933 The maximum relative execution frequency (in percents) of the
9934 target block relative to a statement's original block to allow
9935 statement sinking of a statement. Larger numbers result in
9936 more aggressive statement sinking. A small positive adjustment
9937 is applied for statements with memory operands as those are
9938 even more profitable so sink.
9939
9940 max-stores-to-sink
9941 The maximum number of conditional store pairs that can be sunk.
9942 Set to 0 if either vectorization (-ftree-vectorize) or if-
9943 conversion (-ftree-loop-if-convert) is disabled.
9944
9945 allow-store-data-races
9946 Allow optimizers to introduce new data races on stores. Set to
9947 1 to allow, otherwise to 0.
9948
9949 case-values-threshold
9950 The smallest number of different values for which it is best to
9951 use a jump-table instead of a tree of conditional branches. If
9952 the value is 0, use the default for the machine.
9953
9954 tree-reassoc-width
9955 Set the maximum number of instructions executed in parallel in
9956 reassociated tree. This parameter overrides target dependent
9957 heuristics used by default if has non zero value.
9958
9959 sched-pressure-algorithm
9960 Choose between the two available implementations of
9961 -fsched-pressure. Algorithm 1 is the original implementation
9962 and is the more likely to prevent instructions from being
9963 reordered. Algorithm 2 was designed to be a compromise between
9964 the relatively conservative approach taken by algorithm 1 and
9965 the rather aggressive approach taken by the default scheduler.
9966 It relies more heavily on having a regular register file and
9967 accurate register pressure classes. See haifa-sched.c in the
9968 GCC sources for more details.
9969
9970 The default choice depends on the target.
9971
9972 max-slsr-cand-scan
9973 Set the maximum number of existing candidates that are
9974 considered when seeking a basis for a new straight-line
9975 strength reduction candidate.
9976
9977 asan-globals
9978 Enable buffer overflow detection for global objects. This kind
9979 of protection is enabled by default if you are using
9980 -fsanitize=address option. To disable global objects
9981 protection use --param asan-globals=0.
9982
9983 asan-stack
9984 Enable buffer overflow detection for stack objects. This kind
9985 of protection is enabled by default when using
9986 -fsanitize=address. To disable stack protection use --param
9987 asan-stack=0 option.
9988
9989 asan-instrument-reads
9990 Enable buffer overflow detection for memory reads. This kind
9991 of protection is enabled by default when using
9992 -fsanitize=address. To disable memory reads protection use
9993 --param asan-instrument-reads=0.
9994
9995 asan-instrument-writes
9996 Enable buffer overflow detection for memory writes. This kind
9997 of protection is enabled by default when using
9998 -fsanitize=address. To disable memory writes protection use
9999 --param asan-instrument-writes=0 option.
10000
10001 asan-memintrin
10002 Enable detection for built-in functions. This kind of
10003 protection is enabled by default when using -fsanitize=address.
10004 To disable built-in functions protection use --param
10005 asan-memintrin=0.
10006
10007 asan-use-after-return
10008 Enable detection of use-after-return. This kind of protection
10009 is enabled by default when using the -fsanitize=address option.
10010 To disable it use --param asan-use-after-return=0.
10011
10012 Note: By default the check is disabled at run time. To enable
10013 it, add "detect_stack_use_after_return=1" to the environment
10014 variable ASAN_OPTIONS.
10015
10016 asan-instrumentation-with-call-threshold
10017 If number of memory accesses in function being instrumented is
10018 greater or equal to this number, use callbacks instead of
10019 inline checks. E.g. to disable inline code use --param
10020 asan-instrumentation-with-call-threshold=0.
10021
10022 use-after-scope-direct-emission-threshold
10023 If the size of a local variable in bytes is smaller or equal to
10024 this number, directly poison (or unpoison) shadow memory
10025 instead of using run-time callbacks.
10026
10027 max-fsm-thread-path-insns
10028 Maximum number of instructions to copy when duplicating blocks
10029 on a finite state automaton jump thread path.
10030
10031 max-fsm-thread-length
10032 Maximum number of basic blocks on a finite state automaton jump
10033 thread path.
10034
10035 max-fsm-thread-paths
10036 Maximum number of new jump thread paths to create for a finite
10037 state automaton.
10038
10039 parloops-chunk-size
10040 Chunk size of omp schedule for loops parallelized by parloops.
10041
10042 parloops-schedule
10043 Schedule type of omp schedule for loops parallelized by
10044 parloops (static, dynamic, guided, auto, runtime).
10045
10046 parloops-min-per-thread
10047 The minimum number of iterations per thread of an innermost
10048 parallelized loop for which the parallelized variant is
10049 preferred over the single threaded one. Note that for a
10050 parallelized loop nest the minimum number of iterations of the
10051 outermost loop per thread is two.
10052
10053 max-ssa-name-query-depth
10054 Maximum depth of recursion when querying properties of SSA
10055 names in things like fold routines. One level of recursion
10056 corresponds to following a use-def chain.
10057
10058 hsa-gen-debug-stores
10059 Enable emission of special debug stores within HSA kernels
10060 which are then read and reported by libgomp plugin. Generation
10061 of these stores is disabled by default, use --param
10062 hsa-gen-debug-stores=1 to enable it.
10063
10064 max-speculative-devirt-maydefs
10065 The maximum number of may-defs we analyze when looking for a
10066 must-def specifying the dynamic type of an object that invokes
10067 a virtual call we may be able to devirtualize speculatively.
10068
10069 max-vrp-switch-assertions
10070 The maximum number of assertions to add along the default edge
10071 of a switch statement during VRP.
10072
10073 unroll-jam-min-percent
10074 The minimum percentage of memory references that must be
10075 optimized away for the unroll-and-jam transformation to be
10076 considered profitable.
10077
10078 unroll-jam-max-unroll
10079 The maximum number of times the outer loop should be unrolled
10080 by the unroll-and-jam transformation.
10081
10082 max-rtl-if-conversion-unpredictable-cost
10083 Maximum permissible cost for the sequence that would be
10084 generated by the RTL if-conversion pass for a branch that is
10085 considered unpredictable.
10086
10087 max-variable-expansions-in-unroller
10088 If -fvariable-expansion-in-unroller is used, the maximum number
10089 of times that an individual variable will be expanded during
10090 loop unrolling.
10091
10092 tracer-min-branch-probability-feedback
10093 Stop forward growth if the probability of best edge is less
10094 than this threshold (in percent). Used when profile feedback is
10095 available.
10096
10097 partial-inlining-entry-probability
10098 Maximum probability of the entry BB of split region (in percent
10099 relative to entry BB of the function) to make partial inlining
10100 happen.
10101
10102 max-tracked-strlens
10103 Maximum number of strings for which strlen optimization pass
10104 will track string lengths.
10105
10106 gcse-after-reload-partial-fraction
10107 The threshold ratio for performing partial redundancy
10108 elimination after reload.
10109
10110 gcse-after-reload-critical-fraction
10111 The threshold ratio of critical edges execution count that
10112 permit performing redundancy elimination after reload.
10113
10114 max-loop-header-insns
10115 The maximum number of insns in loop header duplicated by the
10116 copy loop headers pass.
10117
10118 vect-epilogues-nomask
10119 Enable loop epilogue vectorization using smaller vector size.
10120
10121 slp-max-insns-in-bb
10122 Maximum number of instructions in basic block to be considered
10123 for SLP vectorization.
10124
10125 avoid-fma-max-bits
10126 Maximum number of bits for which we avoid creating FMAs.
10127
10128 sms-loop-average-count-threshold
10129 A threshold on the average loop count considered by the swing
10130 modulo scheduler.
10131
10132 sms-dfa-history
10133 The number of cycles the swing modulo scheduler considers when
10134 checking conflicts using DFA.
10135
10136 hot-bb-count-fraction
10137 Select fraction of the maximal count of repetitions of basic
10138 block in program given basic block needs to have to be
10139 considered hot (used in non-LTO mode)
10140
10141 max-inline-insns-recursive-auto
10142 The maximum number of instructions non-inline function can grow
10143 to via recursive inlining.
10144
10145 graphite-allow-codegen-errors
10146 Whether codegen errors should be ICEs when -fchecking.
10147
10148 sms-max-ii-factor
10149 A factor for tuning the upper bound that swing modulo scheduler
10150 uses for scheduling a loop.
10151
10152 lra-max-considered-reload-pseudos
10153 The max number of reload pseudos which are considered during
10154 spilling a non-reload pseudo.
10155
10156 max-pow-sqrt-depth
10157 Maximum depth of sqrt chains to use when synthesizing
10158 exponentiation by a real constant.
10159
10160 max-dse-active-local-stores
10161 Maximum number of active local stores in RTL dead store
10162 elimination.
10163
10164 asan-instrument-allocas
10165 Enable asan allocas/VLAs protection.
10166
10167 max-iterations-computation-cost
10168 Bound on the cost of an expression to compute the number of
10169 iterations.
10170
10171 max-isl-operations
10172 Maximum number of isl operations, 0 means unlimited.
10173
10174 graphite-max-arrays-per-scop
10175 Maximum number of arrays per scop.
10176
10177 max-vartrack-reverse-op-size
10178 Max. size of loc list for which reverse ops should be added.
10179
10180 unlikely-bb-count-fraction
10181 The minimum fraction of profile runs a given basic block
10182 execution count must be not to be considered unlikely.
10183
10184 tracer-dynamic-coverage-feedback
10185 The percentage of function, weighted by execution frequency,
10186 that must be covered by trace formation. Used when profile
10187 feedback is available.
10188
10189 max-inline-recursive-depth-auto
10190 The maximum depth of recursive inlining for non-inline
10191 functions.
10192
10193 fsm-scale-path-stmts
10194 Scale factor to apply to the number of statements in a
10195 threading path when comparing to the number of (scaled) blocks.
10196
10197 fsm-maximum-phi-arguments
10198 Maximum number of arguments a PHI may have before the FSM
10199 threader will not try to thread through its block.
10200
10201 uninit-control-dep-attempts
10202 Maximum number of nested calls to search for control
10203 dependencies during uninitialized variable analysis.
10204
10205 indir-call-topn-profile
10206 Track top N target addresses in indirect-call profile.
10207
10208 max-once-peeled-insns
10209 The maximum number of insns of a peeled loop that rolls only
10210 once.
10211
10212 sra-max-scalarization-size-Osize
10213 Maximum size, in storage units, of an aggregate which should be
10214 considered for scalarization when compiling for size.
10215
10216 fsm-scale-path-blocks
10217 Scale factor to apply to the number of blocks in a threading
10218 path when comparing to the number of (scaled) statements.
10219
10220 sched-autopref-queue-depth
10221 Hardware autoprefetcher scheduler model control flag. Number
10222 of lookahead cycles the model looks into; at ' ' only enable
10223 instruction sorting heuristic.
10224
10225 loop-versioning-max-inner-insns
10226 The maximum number of instructions that an inner loop can have
10227 before the loop versioning pass considers it too big to copy.
10228
10229 loop-versioning-max-outer-insns
10230 The maximum number of instructions that an outer loop can have
10231 before the loop versioning pass considers it too big to copy,
10232 discounting any instructions in inner loops that directly
10233 benefit from versioning.
10234
10235 ssa-name-def-chain-limit
10236 The maximum number of SSA_NAME assignments to follow in
10237 determining a property of a variable such as its value. This
10238 limits the number of iterations or recursive calls GCC performs
10239 when optimizing certain statements or when determining their
10240 validity prior to issuing diagnostics.
10241
10242 Program Instrumentation Options
10243 GCC supports a number of command-line options that control adding run-
10244 time instrumentation to the code it normally generates. For example,
10245 one purpose of instrumentation is collect profiling statistics for use
10246 in finding program hot spots, code coverage analysis, or profile-guided
10247 optimizations. Another class of program instrumentation is adding run-
10248 time checking to detect programming errors like invalid pointer
10249 dereferences or out-of-bounds array accesses, as well as deliberately
10250 hostile attacks such as stack smashing or C++ vtable hijacking. There
10251 is also a general hook which can be used to implement other forms of
10252 tracing or function-level instrumentation for debug or program analysis
10253 purposes.
10254
10255 -p
10256 -pg Generate extra code to write profile information suitable for the
10257 analysis program prof (for -p) or gprof (for -pg). You must use
10258 this option when compiling the source files you want data about,
10259 and you must also use it when linking.
10260
10261 You can use the function attribute "no_instrument_function" to
10262 suppress profiling of individual functions when compiling with
10263 these options.
10264
10265 -fprofile-arcs
10266 Add code so that program flow arcs are instrumented. During
10267 execution the program records how many times each branch and call
10268 is executed and how many times it is taken or returns. On targets
10269 that support constructors with priority support, profiling properly
10270 handles constructors, destructors and C++ constructors (and
10271 destructors) of classes which are used as a type of a global
10272 variable.
10273
10274 When the compiled program exits it saves this data to a file called
10275 auxname.gcda for each source file. The data may be used for
10276 profile-directed optimizations (-fbranch-probabilities), or for
10277 test coverage analysis (-ftest-coverage). Each object file's
10278 auxname is generated from the name of the output file, if
10279 explicitly specified and it is not the final executable, otherwise
10280 it is the basename of the source file. In both cases any suffix is
10281 removed (e.g. foo.gcda for input file dir/foo.c, or dir/foo.gcda
10282 for output file specified as -o dir/foo.o).
10283
10284 --coverage
10285 This option is used to compile and link code instrumented for
10286 coverage analysis. The option is a synonym for -fprofile-arcs
10287 -ftest-coverage (when compiling) and -lgcov (when linking). See
10288 the documentation for those options for more details.
10289
10290 * Compile the source files with -fprofile-arcs plus optimization
10291 and code generation options. For test coverage analysis, use
10292 the additional -ftest-coverage option. You do not need to
10293 profile every source file in a program.
10294
10295 * Compile the source files additionally with -fprofile-abs-path
10296 to create absolute path names in the .gcno files. This allows
10297 gcov to find the correct sources in projects where compilations
10298 occur with different working directories.
10299
10300 * Link your object files with -lgcov or -fprofile-arcs (the
10301 latter implies the former).
10302
10303 * Run the program on a representative workload to generate the
10304 arc profile information. This may be repeated any number of
10305 times. You can run concurrent instances of your program, and
10306 provided that the file system supports locking, the data files
10307 will be correctly updated. Unless a strict ISO C dialect
10308 option is in effect, "fork" calls are detected and correctly
10309 handled without double counting.
10310
10311 * For profile-directed optimizations, compile the source files
10312 again with the same optimization and code generation options
10313 plus -fbranch-probabilities.
10314
10315 * For test coverage analysis, use gcov to produce human readable
10316 information from the .gcno and .gcda files. Refer to the gcov
10317 documentation for further information.
10318
10319 With -fprofile-arcs, for each function of your program GCC creates
10320 a program flow graph, then finds a spanning tree for the graph.
10321 Only arcs that are not on the spanning tree have to be
10322 instrumented: the compiler adds code to count the number of times
10323 that these arcs are executed. When an arc is the only exit or only
10324 entrance to a block, the instrumentation code can be added to the
10325 block; otherwise, a new basic block must be created to hold the
10326 instrumentation code.
10327
10328 -ftest-coverage
10329 Produce a notes file that the gcov code-coverage utility can use to
10330 show program coverage. Each source file's note file is called
10331 auxname.gcno. Refer to the -fprofile-arcs option above for a
10332 description of auxname and instructions on how to generate test
10333 coverage data. Coverage data matches the source files more closely
10334 if you do not optimize.
10335
10336 -fprofile-abs-path
10337 Automatically convert relative source file names to absolute path
10338 names in the .gcno files. This allows gcov to find the correct
10339 sources in projects where compilations occur with different working
10340 directories.
10341
10342 -fprofile-dir=path
10343 Set the directory to search for the profile data files in to path.
10344 This option affects only the profile data generated by
10345 -fprofile-generate, -ftest-coverage, -fprofile-arcs and used by
10346 -fprofile-use and -fbranch-probabilities and its related options.
10347 Both absolute and relative paths can be used. By default, GCC uses
10348 the current directory as path, thus the profile data file appears
10349 in the same directory as the object file. In order to prevent the
10350 file name clashing, if the object file name is not an absolute
10351 path, we mangle the absolute path of the sourcename.gcda file and
10352 use it as the file name of a .gcda file.
10353
10354 When an executable is run in a massive parallel environment, it is
10355 recommended to save profile to different folders. That can be done
10356 with variables in path that are exported during run-time:
10357
10358 %p process ID.
10359
10360 %q{VAR}
10361 value of environment variable VAR
10362
10363 -fprofile-generate
10364 -fprofile-generate=path
10365 Enable options usually used for instrumenting application to
10366 produce profile useful for later recompilation with profile
10367 feedback based optimization. You must use -fprofile-generate both
10368 when compiling and when linking your program.
10369
10370 The following options are enabled: -fprofile-arcs,
10371 -fprofile-values, -finline-functions, and -fipa-bit-cp.
10372
10373 If path is specified, GCC looks at the path to find the profile
10374 feedback data files. See -fprofile-dir.
10375
10376 To optimize the program based on the collected profile information,
10377 use -fprofile-use.
10378
10379 -fprofile-update=method
10380 Alter the update method for an application instrumented for profile
10381 feedback based optimization. The method argument should be one of
10382 single, atomic or prefer-atomic. The first one is useful for
10383 single-threaded applications, while the second one prevents profile
10384 corruption by emitting thread-safe code.
10385
10386 Warning: When an application does not properly join all threads (or
10387 creates an detached thread), a profile file can be still corrupted.
10388
10389 Using prefer-atomic would be transformed either to atomic, when
10390 supported by a target, or to single otherwise. The GCC driver
10391 automatically selects prefer-atomic when -pthread is present in the
10392 command line.
10393
10394 -fprofile-filter-files=regex
10395 Instrument only functions from files where names match any regular
10396 expression (separated by a semi-colon).
10397
10398 For example, -fprofile-filter-files=main.c;module.*.c will
10399 instrument only main.c and all C files starting with 'module'.
10400
10401 -fprofile-exclude-files=regex
10402 Instrument only functions from files where names do not match all
10403 the regular expressions (separated by a semi-colon).
10404
10405 For example, -fprofile-exclude-files=/usr/* will prevent
10406 instrumentation of all files that are located in /usr/ folder.
10407
10408 -fsanitize=address
10409 Enable AddressSanitizer, a fast memory error detector. Memory
10410 access instructions are instrumented to detect out-of-bounds and
10411 use-after-free bugs. The option enables
10412 -fsanitize-address-use-after-scope. See
10413 <https://github.com/google/sanitizers/wiki/AddressSanitizer> for
10414 more details. The run-time behavior can be influenced using the
10415 ASAN_OPTIONS environment variable. When set to "help=1", the
10416 available options are shown at startup of the instrumented program.
10417 See
10418 <https://github.com/google/sanitizers/wiki/AddressSanitizerFlags#run-time-flags>
10419 for a list of supported options. The option cannot be combined
10420 with -fsanitize=thread.
10421
10422 -fsanitize=kernel-address
10423 Enable AddressSanitizer for Linux kernel. See
10424 <https://github.com/google/kasan/wiki> for more details.
10425
10426 -fsanitize=pointer-compare
10427 Instrument comparison operation (<, <=, >, >=) with pointer
10428 operands. The option must be combined with either
10429 -fsanitize=kernel-address or -fsanitize=address The option cannot
10430 be combined with -fsanitize=thread. Note: By default the check is
10431 disabled at run time. To enable it, add
10432 "detect_invalid_pointer_pairs=2" to the environment variable
10433 ASAN_OPTIONS. Using "detect_invalid_pointer_pairs=1" detects
10434 invalid operation only when both pointers are non-null.
10435
10436 -fsanitize=pointer-subtract
10437 Instrument subtraction with pointer operands. The option must be
10438 combined with either -fsanitize=kernel-address or
10439 -fsanitize=address The option cannot be combined with
10440 -fsanitize=thread. Note: By default the check is disabled at run
10441 time. To enable it, add "detect_invalid_pointer_pairs=2" to the
10442 environment variable ASAN_OPTIONS. Using
10443 "detect_invalid_pointer_pairs=1" detects invalid operation only
10444 when both pointers are non-null.
10445
10446 -fsanitize=thread
10447 Enable ThreadSanitizer, a fast data race detector. Memory access
10448 instructions are instrumented to detect data race bugs. See
10449 <https://github.com/google/sanitizers/wiki#threadsanitizer> for
10450 more details. The run-time behavior can be influenced using the
10451 TSAN_OPTIONS environment variable; see
10452 <https://github.com/google/sanitizers/wiki/ThreadSanitizerFlags>
10453 for a list of supported options. The option cannot be combined
10454 with -fsanitize=address, -fsanitize=leak.
10455
10456 Note that sanitized atomic builtins cannot throw exceptions when
10457 operating on invalid memory addresses with non-call exceptions
10458 (-fnon-call-exceptions).
10459
10460 -fsanitize=leak
10461 Enable LeakSanitizer, a memory leak detector. This option only
10462 matters for linking of executables and the executable is linked
10463 against a library that overrides "malloc" and other allocator
10464 functions. See
10465 <https://github.com/google/sanitizers/wiki/AddressSanitizerLeakSanitizer>
10466 for more details. The run-time behavior can be influenced using
10467 the LSAN_OPTIONS environment variable. The option cannot be
10468 combined with -fsanitize=thread.
10469
10470 -fsanitize=undefined
10471 Enable UndefinedBehaviorSanitizer, a fast undefined behavior
10472 detector. Various computations are instrumented to detect
10473 undefined behavior at runtime. Current suboptions are:
10474
10475 -fsanitize=shift
10476 This option enables checking that the result of a shift
10477 operation is not undefined. Note that what exactly is
10478 considered undefined differs slightly between C and C++, as
10479 well as between ISO C90 and C99, etc. This option has two
10480 suboptions, -fsanitize=shift-base and
10481 -fsanitize=shift-exponent.
10482
10483 -fsanitize=shift-exponent
10484 This option enables checking that the second argument of a
10485 shift operation is not negative and is smaller than the
10486 precision of the promoted first argument.
10487
10488 -fsanitize=shift-base
10489 If the second argument of a shift operation is within range,
10490 check that the result of a shift operation is not undefined.
10491 Note that what exactly is considered undefined differs slightly
10492 between C and C++, as well as between ISO C90 and C99, etc.
10493
10494 -fsanitize=integer-divide-by-zero
10495 Detect integer division by zero as well as "INT_MIN / -1"
10496 division.
10497
10498 -fsanitize=unreachable
10499 With this option, the compiler turns the
10500 "__builtin_unreachable" call into a diagnostics message call
10501 instead. When reaching the "__builtin_unreachable" call, the
10502 behavior is undefined.
10503
10504 -fsanitize=vla-bound
10505 This option instructs the compiler to check that the size of a
10506 variable length array is positive.
10507
10508 -fsanitize=null
10509 This option enables pointer checking. Particularly, the
10510 application built with this option turned on will issue an
10511 error message when it tries to dereference a NULL pointer, or
10512 if a reference (possibly an rvalue reference) is bound to a
10513 NULL pointer, or if a method is invoked on an object pointed by
10514 a NULL pointer.
10515
10516 -fsanitize=return
10517 This option enables return statement checking. Programs built
10518 with this option turned on will issue an error message when the
10519 end of a non-void function is reached without actually
10520 returning a value. This option works in C++ only.
10521
10522 -fsanitize=signed-integer-overflow
10523 This option enables signed integer overflow checking. We check
10524 that the result of "+", "*", and both unary and binary "-" does
10525 not overflow in the signed arithmetics. Note, integer
10526 promotion rules must be taken into account. That is, the
10527 following is not an overflow:
10528
10529 signed char a = SCHAR_MAX;
10530 a++;
10531
10532 -fsanitize=bounds
10533 This option enables instrumentation of array bounds. Various
10534 out of bounds accesses are detected. Flexible array members,
10535 flexible array member-like arrays, and initializers of
10536 variables with static storage are not instrumented.
10537
10538 -fsanitize=bounds-strict
10539 This option enables strict instrumentation of array bounds.
10540 Most out of bounds accesses are detected, including flexible
10541 array members and flexible array member-like arrays.
10542 Initializers of variables with static storage are not
10543 instrumented.
10544
10545 -fsanitize=alignment
10546 This option enables checking of alignment of pointers when they
10547 are dereferenced, or when a reference is bound to
10548 insufficiently aligned target, or when a method or constructor
10549 is invoked on insufficiently aligned object.
10550
10551 -fsanitize=object-size
10552 This option enables instrumentation of memory references using
10553 the "__builtin_object_size" function. Various out of bounds
10554 pointer accesses are detected.
10555
10556 -fsanitize=float-divide-by-zero
10557 Detect floating-point division by zero. Unlike other similar
10558 options, -fsanitize=float-divide-by-zero is not enabled by
10559 -fsanitize=undefined, since floating-point division by zero can
10560 be a legitimate way of obtaining infinities and NaNs.
10561
10562 -fsanitize=float-cast-overflow
10563 This option enables floating-point type to integer conversion
10564 checking. We check that the result of the conversion does not
10565 overflow. Unlike other similar options,
10566 -fsanitize=float-cast-overflow is not enabled by
10567 -fsanitize=undefined. This option does not work well with
10568 "FE_INVALID" exceptions enabled.
10569
10570 -fsanitize=nonnull-attribute
10571 This option enables instrumentation of calls, checking whether
10572 null values are not passed to arguments marked as requiring a
10573 non-null value by the "nonnull" function attribute.
10574
10575 -fsanitize=returns-nonnull-attribute
10576 This option enables instrumentation of return statements in
10577 functions marked with "returns_nonnull" function attribute, to
10578 detect returning of null values from such functions.
10579
10580 -fsanitize=bool
10581 This option enables instrumentation of loads from bool. If a
10582 value other than 0/1 is loaded, a run-time error is issued.
10583
10584 -fsanitize=enum
10585 This option enables instrumentation of loads from an enum type.
10586 If a value outside the range of values for the enum type is
10587 loaded, a run-time error is issued.
10588
10589 -fsanitize=vptr
10590 This option enables instrumentation of C++ member function
10591 calls, member accesses and some conversions between pointers to
10592 base and derived classes, to verify the referenced object has
10593 the correct dynamic type.
10594
10595 -fsanitize=pointer-overflow
10596 This option enables instrumentation of pointer arithmetics. If
10597 the pointer arithmetics overflows, a run-time error is issued.
10598
10599 -fsanitize=builtin
10600 This option enables instrumentation of arguments to selected
10601 builtin functions. If an invalid value is passed to such
10602 arguments, a run-time error is issued. E.g. passing 0 as the
10603 argument to "__builtin_ctz" or "__builtin_clz" invokes
10604 undefined behavior and is diagnosed by this option.
10605
10606 While -ftrapv causes traps for signed overflows to be emitted,
10607 -fsanitize=undefined gives a diagnostic message. This currently
10608 works only for the C family of languages.
10609
10610 -fno-sanitize=all
10611 This option disables all previously enabled sanitizers.
10612 -fsanitize=all is not allowed, as some sanitizers cannot be used
10613 together.
10614
10615 -fasan-shadow-offset=number
10616 This option forces GCC to use custom shadow offset in
10617 AddressSanitizer checks. It is useful for experimenting with
10618 different shadow memory layouts in Kernel AddressSanitizer.
10619
10620 -fsanitize-sections=s1,s2,...
10621 Sanitize global variables in selected user-defined sections. si
10622 may contain wildcards.
10623
10624 -fsanitize-recover[=opts]
10625 -fsanitize-recover= controls error recovery mode for sanitizers
10626 mentioned in comma-separated list of opts. Enabling this option
10627 for a sanitizer component causes it to attempt to continue running
10628 the program as if no error happened. This means multiple runtime
10629 errors can be reported in a single program run, and the exit code
10630 of the program may indicate success even when errors have been
10631 reported. The -fno-sanitize-recover= option can be used to alter
10632 this behavior: only the first detected error is reported and
10633 program then exits with a non-zero exit code.
10634
10635 Currently this feature only works for -fsanitize=undefined (and its
10636 suboptions except for -fsanitize=unreachable and
10637 -fsanitize=return), -fsanitize=float-cast-overflow,
10638 -fsanitize=float-divide-by-zero, -fsanitize=bounds-strict,
10639 -fsanitize=kernel-address and -fsanitize=address. For these
10640 sanitizers error recovery is turned on by default, except
10641 -fsanitize=address, for which this feature is experimental.
10642 -fsanitize-recover=all and -fno-sanitize-recover=all is also
10643 accepted, the former enables recovery for all sanitizers that
10644 support it, the latter disables recovery for all sanitizers that
10645 support it.
10646
10647 Even if a recovery mode is turned on the compiler side, it needs to
10648 be also enabled on the runtime library side, otherwise the failures
10649 are still fatal. The runtime library defaults to "halt_on_error=0"
10650 for ThreadSanitizer and UndefinedBehaviorSanitizer, while default
10651 value for AddressSanitizer is "halt_on_error=1". This can be
10652 overridden through setting the "halt_on_error" flag in the
10653 corresponding environment variable.
10654
10655 Syntax without an explicit opts parameter is deprecated. It is
10656 equivalent to specifying an opts list of:
10657
10658 undefined,float-cast-overflow,float-divide-by-zero,bounds-strict
10659
10660 -fsanitize-address-use-after-scope
10661 Enable sanitization of local variables to detect use-after-scope
10662 bugs. The option sets -fstack-reuse to none.
10663
10664 -fsanitize-undefined-trap-on-error
10665 The -fsanitize-undefined-trap-on-error option instructs the
10666 compiler to report undefined behavior using "__builtin_trap" rather
10667 than a "libubsan" library routine. The advantage of this is that
10668 the "libubsan" library is not needed and is not linked in, so this
10669 is usable even in freestanding environments.
10670
10671 -fsanitize-coverage=trace-pc
10672 Enable coverage-guided fuzzing code instrumentation. Inserts a
10673 call to "__sanitizer_cov_trace_pc" into every basic block.
10674
10675 -fsanitize-coverage=trace-cmp
10676 Enable dataflow guided fuzzing code instrumentation. Inserts a
10677 call to "__sanitizer_cov_trace_cmp1", "__sanitizer_cov_trace_cmp2",
10678 "__sanitizer_cov_trace_cmp4" or "__sanitizer_cov_trace_cmp8" for
10679 integral comparison with both operands variable or
10680 "__sanitizer_cov_trace_const_cmp1",
10681 "__sanitizer_cov_trace_const_cmp2",
10682 "__sanitizer_cov_trace_const_cmp4" or
10683 "__sanitizer_cov_trace_const_cmp8" for integral comparison with one
10684 operand constant, "__sanitizer_cov_trace_cmpf" or
10685 "__sanitizer_cov_trace_cmpd" for float or double comparisons and
10686 "__sanitizer_cov_trace_switch" for switch statements.
10687
10688 -fcf-protection=[full|branch|return|none]
10689 Enable code instrumentation of control-flow transfers to increase
10690 program security by checking that target addresses of control-flow
10691 transfer instructions (such as indirect function call, function
10692 return, indirect jump) are valid. This prevents diverting the flow
10693 of control to an unexpected target. This is intended to protect
10694 against such threats as Return-oriented Programming (ROP), and
10695 similarly call/jmp-oriented programming (COP/JOP).
10696
10697 The value "branch" tells the compiler to implement checking of
10698 validity of control-flow transfer at the point of indirect branch
10699 instructions, i.e. call/jmp instructions. The value "return"
10700 implements checking of validity at the point of returning from a
10701 function. The value "full" is an alias for specifying both
10702 "branch" and "return". The value "none" turns off instrumentation.
10703
10704 The macro "__CET__" is defined when -fcf-protection is used. The
10705 first bit of "__CET__" is set to 1 for the value "branch" and the
10706 second bit of "__CET__" is set to 1 for the "return".
10707
10708 You can also use the "nocf_check" attribute to identify which
10709 functions and calls should be skipped from instrumentation.
10710
10711 Currently the x86 GNU/Linux target provides an implementation based
10712 on Intel Control-flow Enforcement Technology (CET).
10713
10714 -fstack-protector
10715 Emit extra code to check for buffer overflows, such as stack
10716 smashing attacks. This is done by adding a guard variable to
10717 functions with vulnerable objects. This includes functions that
10718 call "alloca", and functions with buffers larger than 8 bytes. The
10719 guards are initialized when a function is entered and then checked
10720 when the function exits. If a guard check fails, an error message
10721 is printed and the program exits.
10722
10723 -fstack-protector-all
10724 Like -fstack-protector except that all functions are protected.
10725
10726 -fstack-protector-strong
10727 Like -fstack-protector but includes additional functions to be
10728 protected --- those that have local array definitions, or have
10729 references to local frame addresses.
10730
10731 -fstack-protector-explicit
10732 Like -fstack-protector but only protects those functions which have
10733 the "stack_protect" attribute.
10734
10735 -fstack-check
10736 Generate code to verify that you do not go beyond the boundary of
10737 the stack. You should specify this flag if you are running in an
10738 environment with multiple threads, but you only rarely need to
10739 specify it in a single-threaded environment since stack overflow is
10740 automatically detected on nearly all systems if there is only one
10741 stack.
10742
10743 Note that this switch does not actually cause checking to be done;
10744 the operating system or the language runtime must do that. The
10745 switch causes generation of code to ensure that they see the stack
10746 being extended.
10747
10748 You can additionally specify a string parameter: no means no
10749 checking, generic means force the use of old-style checking,
10750 specific means use the best checking method and is equivalent to
10751 bare -fstack-check.
10752
10753 Old-style checking is a generic mechanism that requires no specific
10754 target support in the compiler but comes with the following
10755 drawbacks:
10756
10757 1. Modified allocation strategy for large objects: they are always
10758 allocated dynamically if their size exceeds a fixed threshold.
10759 Note this may change the semantics of some code.
10760
10761 2. Fixed limit on the size of the static frame of functions: when
10762 it is topped by a particular function, stack checking is not
10763 reliable and a warning is issued by the compiler.
10764
10765 3. Inefficiency: because of both the modified allocation strategy
10766 and the generic implementation, code performance is hampered.
10767
10768 Note that old-style stack checking is also the fallback method for
10769 specific if no target support has been added in the compiler.
10770
10771 -fstack-check= is designed for Ada's needs to detect infinite
10772 recursion and stack overflows. specific is an excellent choice
10773 when compiling Ada code. It is not generally sufficient to protect
10774 against stack-clash attacks. To protect against those you want
10775 -fstack-clash-protection.
10776
10777 -fstack-clash-protection
10778 Generate code to prevent stack clash style attacks. When this
10779 option is enabled, the compiler will only allocate one page of
10780 stack space at a time and each page is accessed immediately after
10781 allocation. Thus, it prevents allocations from jumping over any
10782 stack guard page provided by the operating system.
10783
10784 Most targets do not fully support stack clash protection. However,
10785 on those targets -fstack-clash-protection will protect dynamic
10786 stack allocations. -fstack-clash-protection may also provide
10787 limited protection for static stack allocations if the target
10788 supports -fstack-check=specific.
10789
10790 -fstack-limit-register=reg
10791 -fstack-limit-symbol=sym
10792 -fno-stack-limit
10793 Generate code to ensure that the stack does not grow beyond a
10794 certain value, either the value of a register or the address of a
10795 symbol. If a larger stack is required, a signal is raised at run
10796 time. For most targets, the signal is raised before the stack
10797 overruns the boundary, so it is possible to catch the signal
10798 without taking special precautions.
10799
10800 For instance, if the stack starts at absolute address 0x80000000
10801 and grows downwards, you can use the flags
10802 -fstack-limit-symbol=__stack_limit and
10803 -Wl,--defsym,__stack_limit=0x7ffe0000 to enforce a stack limit of
10804 128KB. Note that this may only work with the GNU linker.
10805
10806 You can locally override stack limit checking by using the
10807 "no_stack_limit" function attribute.
10808
10809 -fsplit-stack
10810 Generate code to automatically split the stack before it overflows.
10811 The resulting program has a discontiguous stack which can only
10812 overflow if the program is unable to allocate any more memory.
10813 This is most useful when running threaded programs, as it is no
10814 longer necessary to calculate a good stack size to use for each
10815 thread. This is currently only implemented for the x86 targets
10816 running GNU/Linux.
10817
10818 When code compiled with -fsplit-stack calls code compiled without
10819 -fsplit-stack, there may not be much stack space available for the
10820 latter code to run. If compiling all code, including library code,
10821 with -fsplit-stack is not an option, then the linker can fix up
10822 these calls so that the code compiled without -fsplit-stack always
10823 has a large stack. Support for this is implemented in the gold
10824 linker in GNU binutils release 2.21 and later.
10825
10826 -fvtable-verify=[std|preinit|none]
10827 This option is only available when compiling C++ code. It turns on
10828 (or off, if using -fvtable-verify=none) the security feature that
10829 verifies at run time, for every virtual call, that the vtable
10830 pointer through which the call is made is valid for the type of the
10831 object, and has not been corrupted or overwritten. If an invalid
10832 vtable pointer is detected at run time, an error is reported and
10833 execution of the program is immediately halted.
10834
10835 This option causes run-time data structures to be built at program
10836 startup, which are used for verifying the vtable pointers. The
10837 options std and preinit control the timing of when these data
10838 structures are built. In both cases the data structures are built
10839 before execution reaches "main". Using -fvtable-verify=std causes
10840 the data structures to be built after shared libraries have been
10841 loaded and initialized. -fvtable-verify=preinit causes them to be
10842 built before shared libraries have been loaded and initialized.
10843
10844 If this option appears multiple times in the command line with
10845 different values specified, none takes highest priority over both
10846 std and preinit; preinit takes priority over std.
10847
10848 -fvtv-debug
10849 When used in conjunction with -fvtable-verify=std or
10850 -fvtable-verify=preinit, causes debug versions of the runtime
10851 functions for the vtable verification feature to be called. This
10852 flag also causes the compiler to log information about which vtable
10853 pointers it finds for each class. This information is written to a
10854 file named vtv_set_ptr_data.log in the directory named by the
10855 environment variable VTV_LOGS_DIR if that is defined or the current
10856 working directory otherwise.
10857
10858 Note: This feature appends data to the log file. If you want a
10859 fresh log file, be sure to delete any existing one.
10860
10861 -fvtv-counts
10862 This is a debugging flag. When used in conjunction with
10863 -fvtable-verify=std or -fvtable-verify=preinit, this causes the
10864 compiler to keep track of the total number of virtual calls it
10865 encounters and the number of verifications it inserts. It also
10866 counts the number of calls to certain run-time library functions
10867 that it inserts and logs this information for each compilation
10868 unit. The compiler writes this information to a file named
10869 vtv_count_data.log in the directory named by the environment
10870 variable VTV_LOGS_DIR if that is defined or the current working
10871 directory otherwise. It also counts the size of the vtable pointer
10872 sets for each class, and writes this information to
10873 vtv_class_set_sizes.log in the same directory.
10874
10875 Note: This feature appends data to the log files. To get fresh
10876 log files, be sure to delete any existing ones.
10877
10878 -finstrument-functions
10879 Generate instrumentation calls for entry and exit to functions.
10880 Just after function entry and just before function exit, the
10881 following profiling functions are called with the address of the
10882 current function and its call site. (On some platforms,
10883 "__builtin_return_address" does not work beyond the current
10884 function, so the call site information may not be available to the
10885 profiling functions otherwise.)
10886
10887 void __cyg_profile_func_enter (void *this_fn,
10888 void *call_site);
10889 void __cyg_profile_func_exit (void *this_fn,
10890 void *call_site);
10891
10892 The first argument is the address of the start of the current
10893 function, which may be looked up exactly in the symbol table.
10894
10895 This instrumentation is also done for functions expanded inline in
10896 other functions. The profiling calls indicate where, conceptually,
10897 the inline function is entered and exited. This means that
10898 addressable versions of such functions must be available. If all
10899 your uses of a function are expanded inline, this may mean an
10900 additional expansion of code size. If you use "extern inline" in
10901 your C code, an addressable version of such functions must be
10902 provided. (This is normally the case anyway, but if you get lucky
10903 and the optimizer always expands the functions inline, you might
10904 have gotten away without providing static copies.)
10905
10906 A function may be given the attribute "no_instrument_function", in
10907 which case this instrumentation is not done. This can be used, for
10908 example, for the profiling functions listed above, high-priority
10909 interrupt routines, and any functions from which the profiling
10910 functions cannot safely be called (perhaps signal handlers, if the
10911 profiling routines generate output or allocate memory).
10912
10913 -finstrument-functions-exclude-file-list=file,file,...
10914 Set the list of functions that are excluded from instrumentation
10915 (see the description of -finstrument-functions). If the file that
10916 contains a function definition matches with one of file, then that
10917 function is not instrumented. The match is done on substrings: if
10918 the file parameter is a substring of the file name, it is
10919 considered to be a match.
10920
10921 For example:
10922
10923 -finstrument-functions-exclude-file-list=/bits/stl,include/sys
10924
10925 excludes any inline function defined in files whose pathnames
10926 contain /bits/stl or include/sys.
10927
10928 If, for some reason, you want to include letter , in one of sym,
10929 write ,. For example,
10930 -finstrument-functions-exclude-file-list=',,tmp' (note the single
10931 quote surrounding the option).
10932
10933 -finstrument-functions-exclude-function-list=sym,sym,...
10934 This is similar to -finstrument-functions-exclude-file-list, but
10935 this option sets the list of function names to be excluded from
10936 instrumentation. The function name to be matched is its user-
10937 visible name, such as "vector<int> blah(const vector<int> &)", not
10938 the internal mangled name (e.g., "_Z4blahRSt6vectorIiSaIiEE"). The
10939 match is done on substrings: if the sym parameter is a substring of
10940 the function name, it is considered to be a match. For C99 and C++
10941 extended identifiers, the function name must be given in UTF-8, not
10942 using universal character names.
10943
10944 -fpatchable-function-entry=N[,M]
10945 Generate N NOPs right at the beginning of each function, with the
10946 function entry point before the Mth NOP. If M is omitted, it
10947 defaults to 0 so the function entry points to the address just at
10948 the first NOP. The NOP instructions reserve extra space which can
10949 be used to patch in any desired instrumentation at run time,
10950 provided that the code segment is writable. The amount of space is
10951 controllable indirectly via the number of NOPs; the NOP instruction
10952 used corresponds to the instruction emitted by the internal GCC
10953 back-end interface "gen_nop". This behavior is target-specific and
10954 may also depend on the architecture variant and/or other
10955 compilation options.
10956
10957 For run-time identification, the starting addresses of these areas,
10958 which correspond to their respective function entries minus M, are
10959 additionally collected in the "__patchable_function_entries"
10960 section of the resulting binary.
10961
10962 Note that the value of "__attribute__ ((patchable_function_entry
10963 (N,M)))" takes precedence over command-line option
10964 -fpatchable-function-entry=N,M. This can be used to increase the
10965 area size or to remove it completely on a single function. If
10966 "N=0", no pad location is recorded.
10967
10968 The NOP instructions are inserted at---and maybe before, depending
10969 on M---the function entry address, even before the prologue.
10970
10971 Options Controlling the Preprocessor
10972 These options control the C preprocessor, which is run on each C source
10973 file before actual compilation.
10974
10975 If you use the -E option, nothing is done except preprocessing. Some
10976 of these options make sense only together with -E because they cause
10977 the preprocessor output to be unsuitable for actual compilation.
10978
10979 In addition to the options listed here, there are a number of options
10980 to control search paths for include files documented in Directory
10981 Options. Options to control preprocessor diagnostics are listed in
10982 Warning Options.
10983
10984 -D name
10985 Predefine name as a macro, with definition 1.
10986
10987 -D name=definition
10988 The contents of definition are tokenized and processed as if they
10989 appeared during translation phase three in a #define directive. In
10990 particular, the definition is truncated by embedded newline
10991 characters.
10992
10993 If you are invoking the preprocessor from a shell or shell-like
10994 program you may need to use the shell's quoting syntax to protect
10995 characters such as spaces that have a meaning in the shell syntax.
10996
10997 If you wish to define a function-like macro on the command line,
10998 write its argument list with surrounding parentheses before the
10999 equals sign (if any). Parentheses are meaningful to most shells,
11000 so you should quote the option. With sh and csh,
11001 -D'name(args...)=definition' works.
11002
11003 -D and -U options are processed in the order they are given on the
11004 command line. All -imacros file and -include file options are
11005 processed after all -D and -U options.
11006
11007 -U name
11008 Cancel any previous definition of name, either built in or provided
11009 with a -D option.
11010
11011 -include file
11012 Process file as if "#include "file"" appeared as the first line of
11013 the primary source file. However, the first directory searched for
11014 file is the preprocessor's working directory instead of the
11015 directory containing the main source file. If not found there, it
11016 is searched for in the remainder of the "#include "..."" search
11017 chain as normal.
11018
11019 If multiple -include options are given, the files are included in
11020 the order they appear on the command line.
11021
11022 -imacros file
11023 Exactly like -include, except that any output produced by scanning
11024 file is thrown away. Macros it defines remain defined. This
11025 allows you to acquire all the macros from a header without also
11026 processing its declarations.
11027
11028 All files specified by -imacros are processed before all files
11029 specified by -include.
11030
11031 -undef
11032 Do not predefine any system-specific or GCC-specific macros. The
11033 standard predefined macros remain defined.
11034
11035 -pthread
11036 Define additional macros required for using the POSIX threads
11037 library. You should use this option consistently for both
11038 compilation and linking. This option is supported on GNU/Linux
11039 targets, most other Unix derivatives, and also on x86 Cygwin and
11040 MinGW targets.
11041
11042 -M Instead of outputting the result of preprocessing, output a rule
11043 suitable for make describing the dependencies of the main source
11044 file. The preprocessor outputs one make rule containing the object
11045 file name for that source file, a colon, and the names of all the
11046 included files, including those coming from -include or -imacros
11047 command-line options.
11048
11049 Unless specified explicitly (with -MT or -MQ), the object file name
11050 consists of the name of the source file with any suffix replaced
11051 with object file suffix and with any leading directory parts
11052 removed. If there are many included files then the rule is split
11053 into several lines using \-newline. The rule has no commands.
11054
11055 This option does not suppress the preprocessor's debug output, such
11056 as -dM. To avoid mixing such debug output with the dependency
11057 rules you should explicitly specify the dependency output file with
11058 -MF, or use an environment variable like DEPENDENCIES_OUTPUT.
11059 Debug output is still sent to the regular output stream as normal.
11060
11061 Passing -M to the driver implies -E, and suppresses warnings with
11062 an implicit -w.
11063
11064 -MM Like -M but do not mention header files that are found in system
11065 header directories, nor header files that are included, directly or
11066 indirectly, from such a header.
11067
11068 This implies that the choice of angle brackets or double quotes in
11069 an #include directive does not in itself determine whether that
11070 header appears in -MM dependency output.
11071
11072 -MF file
11073 When used with -M or -MM, specifies a file to write the
11074 dependencies to. If no -MF switch is given the preprocessor sends
11075 the rules to the same place it would send preprocessed output.
11076
11077 When used with the driver options -MD or -MMD, -MF overrides the
11078 default dependency output file.
11079
11080 If file is -, then the dependencies are written to stdout.
11081
11082 -MG In conjunction with an option such as -M requesting dependency
11083 generation, -MG assumes missing header files are generated files
11084 and adds them to the dependency list without raising an error. The
11085 dependency filename is taken directly from the "#include" directive
11086 without prepending any path. -MG also suppresses preprocessed
11087 output, as a missing header file renders this useless.
11088
11089 This feature is used in automatic updating of makefiles.
11090
11091 -MP This option instructs CPP to add a phony target for each dependency
11092 other than the main file, causing each to depend on nothing. These
11093 dummy rules work around errors make gives if you remove header
11094 files without updating the Makefile to match.
11095
11096 This is typical output:
11097
11098 test.o: test.c test.h
11099
11100 test.h:
11101
11102 -MT target
11103 Change the target of the rule emitted by dependency generation. By
11104 default CPP takes the name of the main input file, deletes any
11105 directory components and any file suffix such as .c, and appends
11106 the platform's usual object suffix. The result is the target.
11107
11108 An -MT option sets the target to be exactly the string you specify.
11109 If you want multiple targets, you can specify them as a single
11110 argument to -MT, or use multiple -MT options.
11111
11112 For example, -MT '$(objpfx)foo.o' might give
11113
11114 $(objpfx)foo.o: foo.c
11115
11116 -MQ target
11117 Same as -MT, but it quotes any characters which are special to
11118 Make. -MQ '$(objpfx)foo.o' gives
11119
11120 $$(objpfx)foo.o: foo.c
11121
11122 The default target is automatically quoted, as if it were given
11123 with -MQ.
11124
11125 -MD -MD is equivalent to -M -MF file, except that -E is not implied.
11126 The driver determines file based on whether an -o option is given.
11127 If it is, the driver uses its argument but with a suffix of .d,
11128 otherwise it takes the name of the input file, removes any
11129 directory components and suffix, and applies a .d suffix.
11130
11131 If -MD is used in conjunction with -E, any -o switch is understood
11132 to specify the dependency output file, but if used without -E, each
11133 -o is understood to specify a target object file.
11134
11135 Since -E is not implied, -MD can be used to generate a dependency
11136 output file as a side effect of the compilation process.
11137
11138 -MMD
11139 Like -MD except mention only user header files, not system header
11140 files.
11141
11142 -fpreprocessed
11143 Indicate to the preprocessor that the input file has already been
11144 preprocessed. This suppresses things like macro expansion,
11145 trigraph conversion, escaped newline splicing, and processing of
11146 most directives. The preprocessor still recognizes and removes
11147 comments, so that you can pass a file preprocessed with -C to the
11148 compiler without problems. In this mode the integrated
11149 preprocessor is little more than a tokenizer for the front ends.
11150
11151 -fpreprocessed is implicit if the input file has one of the
11152 extensions .i, .ii or .mi. These are the extensions that GCC uses
11153 for preprocessed files created by -save-temps.
11154
11155 -fdirectives-only
11156 When preprocessing, handle directives, but do not expand macros.
11157
11158 The option's behavior depends on the -E and -fpreprocessed options.
11159
11160 With -E, preprocessing is limited to the handling of directives
11161 such as "#define", "#ifdef", and "#error". Other preprocessor
11162 operations, such as macro expansion and trigraph conversion are not
11163 performed. In addition, the -dD option is implicitly enabled.
11164
11165 With -fpreprocessed, predefinition of command line and most builtin
11166 macros is disabled. Macros such as "__LINE__", which are
11167 contextually dependent, are handled normally. This enables
11168 compilation of files previously preprocessed with "-E
11169 -fdirectives-only".
11170
11171 With both -E and -fpreprocessed, the rules for -fpreprocessed take
11172 precedence. This enables full preprocessing of files previously
11173 preprocessed with "-E -fdirectives-only".
11174
11175 -fdollars-in-identifiers
11176 Accept $ in identifiers.
11177
11178 -fextended-identifiers
11179 Accept universal character names in identifiers. This option is
11180 enabled by default for C99 (and later C standard versions) and C++.
11181
11182 -fno-canonical-system-headers
11183 When preprocessing, do not shorten system header paths with
11184 canonicalization.
11185
11186 -ftabstop=width
11187 Set the distance between tab stops. This helps the preprocessor
11188 report correct column numbers in warnings or errors, even if tabs
11189 appear on the line. If the value is less than 1 or greater than
11190 100, the option is ignored. The default is 8.
11191
11192 -ftrack-macro-expansion[=level]
11193 Track locations of tokens across macro expansions. This allows the
11194 compiler to emit diagnostic about the current macro expansion stack
11195 when a compilation error occurs in a macro expansion. Using this
11196 option makes the preprocessor and the compiler consume more memory.
11197 The level parameter can be used to choose the level of precision of
11198 token location tracking thus decreasing the memory consumption if
11199 necessary. Value 0 of level de-activates this option. Value 1
11200 tracks tokens locations in a degraded mode for the sake of minimal
11201 memory overhead. In this mode all tokens resulting from the
11202 expansion of an argument of a function-like macro have the same
11203 location. Value 2 tracks tokens locations completely. This value is
11204 the most memory hungry. When this option is given no argument, the
11205 default parameter value is 2.
11206
11207 Note that "-ftrack-macro-expansion=2" is activated by default.
11208
11209 -fmacro-prefix-map=old=new
11210 When preprocessing files residing in directory old, expand the
11211 "__FILE__" and "__BASE_FILE__" macros as if the files resided in
11212 directory new instead. This can be used to change an absolute path
11213 to a relative path by using . for new which can result in more
11214 reproducible builds that are location independent. This option
11215 also affects "__builtin_FILE()" during compilation. See also
11216 -ffile-prefix-map.
11217
11218 -fexec-charset=charset
11219 Set the execution character set, used for string and character
11220 constants. The default is UTF-8. charset can be any encoding
11221 supported by the system's "iconv" library routine.
11222
11223 -fwide-exec-charset=charset
11224 Set the wide execution character set, used for wide string and
11225 character constants. The default is UTF-32 or UTF-16, whichever
11226 corresponds to the width of "wchar_t". As with -fexec-charset,
11227 charset can be any encoding supported by the system's "iconv"
11228 library routine; however, you will have problems with encodings
11229 that do not fit exactly in "wchar_t".
11230
11231 -finput-charset=charset
11232 Set the input character set, used for translation from the
11233 character set of the input file to the source character set used by
11234 GCC. If the locale does not specify, or GCC cannot get this
11235 information from the locale, the default is UTF-8. This can be
11236 overridden by either the locale or this command-line option.
11237 Currently the command-line option takes precedence if there's a
11238 conflict. charset can be any encoding supported by the system's
11239 "iconv" library routine.
11240
11241 -fpch-deps
11242 When using precompiled headers, this flag causes the dependency-
11243 output flags to also list the files from the precompiled header's
11244 dependencies. If not specified, only the precompiled header are
11245 listed and not the files that were used to create it, because those
11246 files are not consulted when a precompiled header is used.
11247
11248 -fpch-preprocess
11249 This option allows use of a precompiled header together with -E.
11250 It inserts a special "#pragma", "#pragma GCC pch_preprocess
11251 "filename"" in the output to mark the place where the precompiled
11252 header was found, and its filename. When -fpreprocessed is in use,
11253 GCC recognizes this "#pragma" and loads the PCH.
11254
11255 This option is off by default, because the resulting preprocessed
11256 output is only really suitable as input to GCC. It is switched on
11257 by -save-temps.
11258
11259 You should not write this "#pragma" in your own code, but it is
11260 safe to edit the filename if the PCH file is available in a
11261 different location. The filename may be absolute or it may be
11262 relative to GCC's current directory.
11263
11264 -fworking-directory
11265 Enable generation of linemarkers in the preprocessor output that
11266 let the compiler know the current working directory at the time of
11267 preprocessing. When this option is enabled, the preprocessor
11268 emits, after the initial linemarker, a second linemarker with the
11269 current working directory followed by two slashes. GCC uses this
11270 directory, when it's present in the preprocessed input, as the
11271 directory emitted as the current working directory in some
11272 debugging information formats. This option is implicitly enabled
11273 if debugging information is enabled, but this can be inhibited with
11274 the negated form -fno-working-directory. If the -P flag is present
11275 in the command line, this option has no effect, since no "#line"
11276 directives are emitted whatsoever.
11277
11278 -A predicate=answer
11279 Make an assertion with the predicate predicate and answer answer.
11280 This form is preferred to the older form -A predicate(answer),
11281 which is still supported, because it does not use shell special
11282 characters.
11283
11284 -A -predicate=answer
11285 Cancel an assertion with the predicate predicate and answer answer.
11286
11287 -C Do not discard comments. All comments are passed through to the
11288 output file, except for comments in processed directives, which are
11289 deleted along with the directive.
11290
11291 You should be prepared for side effects when using -C; it causes
11292 the preprocessor to treat comments as tokens in their own right.
11293 For example, comments appearing at the start of what would be a
11294 directive line have the effect of turning that line into an
11295 ordinary source line, since the first token on the line is no
11296 longer a #.
11297
11298 -CC Do not discard comments, including during macro expansion. This is
11299 like -C, except that comments contained within macros are also
11300 passed through to the output file where the macro is expanded.
11301
11302 In addition to the side effects of the -C option, the -CC option
11303 causes all C++-style comments inside a macro to be converted to
11304 C-style comments. This is to prevent later use of that macro from
11305 inadvertently commenting out the remainder of the source line.
11306
11307 The -CC option is generally used to support lint comments.
11308
11309 -P Inhibit generation of linemarkers in the output from the
11310 preprocessor. This might be useful when running the preprocessor
11311 on something that is not C code, and will be sent to a program
11312 which might be confused by the linemarkers.
11313
11314 -traditional
11315 -traditional-cpp
11316 Try to imitate the behavior of pre-standard C preprocessors, as
11317 opposed to ISO C preprocessors. See the GNU CPP manual for
11318 details.
11319
11320 Note that GCC does not otherwise attempt to emulate a pre-standard
11321 C compiler, and these options are only supported with the -E
11322 switch, or when invoking CPP explicitly.
11323
11324 -trigraphs
11325 Support ISO C trigraphs. These are three-character sequences, all
11326 starting with ??, that are defined by ISO C to stand for single
11327 characters. For example, ??/ stands for \, so '??/n' is a
11328 character constant for a newline.
11329
11330 The nine trigraphs and their replacements are
11331
11332 Trigraph: ??( ??) ??< ??> ??= ??/ ??' ??! ??-
11333 Replacement: [ ] { } # \ ^ | ~
11334
11335 By default, GCC ignores trigraphs, but in standard-conforming modes
11336 it converts them. See the -std and -ansi options.
11337
11338 -remap
11339 Enable special code to work around file systems which only permit
11340 very short file names, such as MS-DOS.
11341
11342 -H Print the name of each header file used, in addition to other
11343 normal activities. Each name is indented to show how deep in the
11344 #include stack it is. Precompiled header files are also printed,
11345 even if they are found to be invalid; an invalid precompiled header
11346 file is printed with ...x and a valid one with ...! .
11347
11348 -dletters
11349 Says to make debugging dumps during compilation as specified by
11350 letters. The flags documented here are those relevant to the
11351 preprocessor. Other letters are interpreted by the compiler
11352 proper, or reserved for future versions of GCC, and so are silently
11353 ignored. If you specify letters whose behavior conflicts, the
11354 result is undefined.
11355
11356 -dM Instead of the normal output, generate a list of #define
11357 directives for all the macros defined during the execution of
11358 the preprocessor, including predefined macros. This gives you
11359 a way of finding out what is predefined in your version of the
11360 preprocessor. Assuming you have no file foo.h, the command
11361
11362 touch foo.h; cpp -dM foo.h
11363
11364 shows all the predefined macros.
11365
11366 If you use -dM without the -E option, -dM is interpreted as a
11367 synonym for -fdump-rtl-mach.
11368
11369 -dD Like -dM except in two respects: it does not include the
11370 predefined macros, and it outputs both the #define directives
11371 and the result of preprocessing. Both kinds of output go to
11372 the standard output file.
11373
11374 -dN Like -dD, but emit only the macro names, not their expansions.
11375
11376 -dI Output #include directives in addition to the result of
11377 preprocessing.
11378
11379 -dU Like -dD except that only macros that are expanded, or whose
11380 definedness is tested in preprocessor directives, are output;
11381 the output is delayed until the use or test of the macro; and
11382 #undef directives are also output for macros tested but
11383 undefined at the time.
11384
11385 -fdebug-cpp
11386 This option is only useful for debugging GCC. When used from CPP
11387 or with -E, it dumps debugging information about location maps.
11388 Every token in the output is preceded by the dump of the map its
11389 location belongs to.
11390
11391 When used from GCC without -E, this option has no effect.
11392
11393 -Wp,option
11394 You can use -Wp,option to bypass the compiler driver and pass
11395 option directly through to the preprocessor. If option contains
11396 commas, it is split into multiple options at the commas. However,
11397 many options are modified, translated or interpreted by the
11398 compiler driver before being passed to the preprocessor, and -Wp
11399 forcibly bypasses this phase. The preprocessor's direct interface
11400 is undocumented and subject to change, so whenever possible you
11401 should avoid using -Wp and let the driver handle the options
11402 instead.
11403
11404 -Xpreprocessor option
11405 Pass option as an option to the preprocessor. You can use this to
11406 supply system-specific preprocessor options that GCC does not
11407 recognize.
11408
11409 If you want to pass an option that takes an argument, you must use
11410 -Xpreprocessor twice, once for the option and once for the
11411 argument.
11412
11413 -no-integrated-cpp
11414 Perform preprocessing as a separate pass before compilation. By
11415 default, GCC performs preprocessing as an integrated part of input
11416 tokenization and parsing. If this option is provided, the
11417 appropriate language front end (cc1, cc1plus, or cc1obj for C, C++,
11418 and Objective-C, respectively) is instead invoked twice, once for
11419 preprocessing only and once for actual compilation of the
11420 preprocessed input. This option may be useful in conjunction with
11421 the -B or -wrapper options to specify an alternate preprocessor or
11422 perform additional processing of the program source between normal
11423 preprocessing and compilation.
11424
11425 Passing Options to the Assembler
11426 You can pass options to the assembler.
11427
11428 -Wa,option
11429 Pass option as an option to the assembler. If option contains
11430 commas, it is split into multiple options at the commas.
11431
11432 -Xassembler option
11433 Pass option as an option to the assembler. You can use this to
11434 supply system-specific assembler options that GCC does not
11435 recognize.
11436
11437 If you want to pass an option that takes an argument, you must use
11438 -Xassembler twice, once for the option and once for the argument.
11439
11440 Options for Linking
11441 These options come into play when the compiler links object files into
11442 an executable output file. They are meaningless if the compiler is not
11443 doing a link step.
11444
11445 object-file-name
11446 A file name that does not end in a special recognized suffix is
11447 considered to name an object file or library. (Object files are
11448 distinguished from libraries by the linker according to the file
11449 contents.) If linking is done, these object files are used as
11450 input to the linker.
11451
11452 -c
11453 -S
11454 -E If any of these options is used, then the linker is not run, and
11455 object file names should not be used as arguments.
11456
11457 -flinker-output=type
11458 This option controls the code generation of the link time
11459 optimizer. By default the linker output is determined by the
11460 linker plugin automatically. For debugging the compiler and in the
11461 case of incremental linking to non-lto object file is desired, it
11462 may be useful to control the type manually.
11463
11464 If type is exec the code generation is configured to produce static
11465 binary. In this case -fpic and -fpie are both disabled.
11466
11467 If type is dyn the code generation is configured to produce shared
11468 library. In this case -fpic or -fPIC is preserved, but not enabled
11469 automatically. This makes it possible to build shared libraries
11470 without position independent code on architectures this is
11471 possible, i.e. on x86.
11472
11473 If type is pie the code generation is configured to produce -fpie
11474 executable. This result in similar optimizations as exec except
11475 that -fpie is not disabled if specified at compilation time.
11476
11477 If type is rel the compiler assumes that incremental linking is
11478 done. The sections containing intermediate code for link-time
11479 optimization are merged, pre-optimized, and output to the resulting
11480 object file. In addition, if -ffat-lto-objects is specified the
11481 binary code is produced for future non-lto linking. The object file
11482 produced by incremental linking will be smaller than a static
11483 library produced from the same object files. At link-time the
11484 result of incremental linking will also load faster to compiler
11485 than a static library assuming that majority of objects in the
11486 library are used.
11487
11488 Finally nolto-rel configure compiler to for incremental linking
11489 where code generation is forced, final binary is produced and the
11490 intermediate code for later link-time optimization is stripped.
11491 When multiple object files are linked together the resulting code
11492 will be optimized better than with link time optimizations disabled
11493 (for example, the cross-module inlining will happen), most of
11494 benefits of whole program optimizations are however lost.
11495
11496 During the incremental link (by -r) the linker plugin will default
11497 to rel. With current interfaces to GNU Binutils it is however not
11498 possible to link incrementally LTO objects and non-LTO objects into
11499 a single mixed object file. In the case any of object files in
11500 incremental link cannot be used for link-time optimization the
11501 linker plugin will output warning and use nolto-rel. To maintain
11502 the whole program optimization it is recommended to link such
11503 objects into static library instead. Alternatively it is possible
11504 to use H.J. Lu's binutils with support for mixed objects.
11505
11506 -fuse-ld=bfd
11507 Use the bfd linker instead of the default linker.
11508
11509 -fuse-ld=gold
11510 Use the gold linker instead of the default linker.
11511
11512 -fuse-ld=lld
11513 Use the LLVM lld linker instead of the default linker.
11514
11515 -llibrary
11516 -l library
11517 Search the library named library when linking. (The second
11518 alternative with the library as a separate argument is only for
11519 POSIX compliance and is not recommended.)
11520
11521 The -l option is passed directly to the linker by GCC. Refer to
11522 your linker documentation for exact details. The general
11523 description below applies to the GNU linker.
11524
11525 The linker searches a standard list of directories for the library.
11526 The directories searched include several standard system
11527 directories plus any that you specify with -L.
11528
11529 Static libraries are archives of object files, and have file names
11530 like liblibrary.a. Some targets also support shared libraries,
11531 which typically have names like liblibrary.so. If both static and
11532 shared libraries are found, the linker gives preference to linking
11533 with the shared library unless the -static option is used.
11534
11535 It makes a difference where in the command you write this option;
11536 the linker searches and processes libraries and object files in the
11537 order they are specified. Thus, foo.o -lz bar.o searches library z
11538 after file foo.o but before bar.o. If bar.o refers to functions in
11539 z, those functions may not be loaded.
11540
11541 -lobjc
11542 You need this special case of the -l option in order to link an
11543 Objective-C or Objective-C++ program.
11544
11545 -nostartfiles
11546 Do not use the standard system startup files when linking. The
11547 standard system libraries are used normally, unless -nostdlib,
11548 -nolibc, or -nodefaultlibs is used.
11549
11550 -nodefaultlibs
11551 Do not use the standard system libraries when linking. Only the
11552 libraries you specify are passed to the linker, and options
11553 specifying linkage of the system libraries, such as -static-libgcc
11554 or -shared-libgcc, are ignored. The standard startup files are
11555 used normally, unless -nostartfiles is used.
11556
11557 The compiler may generate calls to "memcmp", "memset", "memcpy" and
11558 "memmove". These entries are usually resolved by entries in libc.
11559 These entry points should be supplied through some other mechanism
11560 when this option is specified.
11561
11562 -nolibc
11563 Do not use the C library or system libraries tightly coupled with
11564 it when linking. Still link with the startup files, libgcc or
11565 toolchain provided language support libraries such as libgnat,
11566 libgfortran or libstdc++ unless options preventing their inclusion
11567 are used as well. This typically removes -lc from the link command
11568 line, as well as system libraries that normally go with it and
11569 become meaningless when absence of a C library is assumed, for
11570 example -lpthread or -lm in some configurations. This is intended
11571 for bare-board targets when there is indeed no C library available.
11572
11573 -nostdlib
11574 Do not use the standard system startup files or libraries when
11575 linking. No startup files and only the libraries you specify are
11576 passed to the linker, and options specifying linkage of the system
11577 libraries, such as -static-libgcc or -shared-libgcc, are ignored.
11578
11579 The compiler may generate calls to "memcmp", "memset", "memcpy" and
11580 "memmove". These entries are usually resolved by entries in libc.
11581 These entry points should be supplied through some other mechanism
11582 when this option is specified.
11583
11584 One of the standard libraries bypassed by -nostdlib and
11585 -nodefaultlibs is libgcc.a, a library of internal subroutines which
11586 GCC uses to overcome shortcomings of particular machines, or
11587 special needs for some languages.
11588
11589 In most cases, you need libgcc.a even when you want to avoid other
11590 standard libraries. In other words, when you specify -nostdlib or
11591 -nodefaultlibs you should usually specify -lgcc as well. This
11592 ensures that you have no unresolved references to internal GCC
11593 library subroutines. (An example of such an internal subroutine is
11594 "__main", used to ensure C++ constructors are called.)
11595
11596 -e entry
11597 --entry=entry
11598 Specify that the program entry point is entry. The argument is
11599 interpreted by the linker; the GNU linker accepts either a symbol
11600 name or an address.
11601
11602 -pie
11603 Produce a dynamically linked position independent executable on
11604 targets that support it. For predictable results, you must also
11605 specify the same set of options used for compilation (-fpie, -fPIE,
11606 or model suboptions) when you specify this linker option.
11607
11608 -no-pie
11609 Don't produce a dynamically linked position independent executable.
11610
11611 -static-pie
11612 Produce a static position independent executable on targets that
11613 support it. A static position independent executable is similar to
11614 a static executable, but can be loaded at any address without a
11615 dynamic linker. For predictable results, you must also specify the
11616 same set of options used for compilation (-fpie, -fPIE, or model
11617 suboptions) when you specify this linker option.
11618
11619 -pthread
11620 Link with the POSIX threads library. This option is supported on
11621 GNU/Linux targets, most other Unix derivatives, and also on x86
11622 Cygwin and MinGW targets. On some targets this option also sets
11623 flags for the preprocessor, so it should be used consistently for
11624 both compilation and linking.
11625
11626 -r Produce a relocatable object as output. This is also known as
11627 partial linking.
11628
11629 -rdynamic
11630 Pass the flag -export-dynamic to the ELF linker, on targets that
11631 support it. This instructs the linker to add all symbols, not only
11632 used ones, to the dynamic symbol table. This option is needed for
11633 some uses of "dlopen" or to allow obtaining backtraces from within
11634 a program.
11635
11636 -s Remove all symbol table and relocation information from the
11637 executable.
11638
11639 -static
11640 On systems that support dynamic linking, this overrides -pie and
11641 prevents linking with the shared libraries. On other systems, this
11642 option has no effect.
11643
11644 -shared
11645 Produce a shared object which can then be linked with other objects
11646 to form an executable. Not all systems support this option. For
11647 predictable results, you must also specify the same set of options
11648 used for compilation (-fpic, -fPIC, or model suboptions) when you
11649 specify this linker option.[1]
11650
11651 -shared-libgcc
11652 -static-libgcc
11653 On systems that provide libgcc as a shared library, these options
11654 force the use of either the shared or static version, respectively.
11655 If no shared version of libgcc was built when the compiler was
11656 configured, these options have no effect.
11657
11658 There are several situations in which an application should use the
11659 shared libgcc instead of the static version. The most common of
11660 these is when the application wishes to throw and catch exceptions
11661 across different shared libraries. In that case, each of the
11662 libraries as well as the application itself should use the shared
11663 libgcc.
11664
11665 Therefore, the G++ driver automatically adds -shared-libgcc
11666 whenever you build a shared library or a main executable, because
11667 C++ programs typically use exceptions, so this is the right thing
11668 to do.
11669
11670 If, instead, you use the GCC driver to create shared libraries, you
11671 may find that they are not always linked with the shared libgcc.
11672 If GCC finds, at its configuration time, that you have a non-GNU
11673 linker or a GNU linker that does not support option --eh-frame-hdr,
11674 it links the shared version of libgcc into shared libraries by
11675 default. Otherwise, it takes advantage of the linker and optimizes
11676 away the linking with the shared version of libgcc, linking with
11677 the static version of libgcc by default. This allows exceptions to
11678 propagate through such shared libraries, without incurring
11679 relocation costs at library load time.
11680
11681 However, if a library or main executable is supposed to throw or
11682 catch exceptions, you must link it using the G++ driver, or using
11683 the option -shared-libgcc, such that it is linked with the shared
11684 libgcc.
11685
11686 -static-libasan
11687 When the -fsanitize=address option is used to link a program, the
11688 GCC driver automatically links against libasan. If libasan is
11689 available as a shared library, and the -static option is not used,
11690 then this links against the shared version of libasan. The
11691 -static-libasan option directs the GCC driver to link libasan
11692 statically, without necessarily linking other libraries statically.
11693
11694 -static-libtsan
11695 When the -fsanitize=thread option is used to link a program, the
11696 GCC driver automatically links against libtsan. If libtsan is
11697 available as a shared library, and the -static option is not used,
11698 then this links against the shared version of libtsan. The
11699 -static-libtsan option directs the GCC driver to link libtsan
11700 statically, without necessarily linking other libraries statically.
11701
11702 -static-liblsan
11703 When the -fsanitize=leak option is used to link a program, the GCC
11704 driver automatically links against liblsan. If liblsan is
11705 available as a shared library, and the -static option is not used,
11706 then this links against the shared version of liblsan. The
11707 -static-liblsan option directs the GCC driver to link liblsan
11708 statically, without necessarily linking other libraries statically.
11709
11710 -static-libubsan
11711 When the -fsanitize=undefined option is used to link a program, the
11712 GCC driver automatically links against libubsan. If libubsan is
11713 available as a shared library, and the -static option is not used,
11714 then this links against the shared version of libubsan. The
11715 -static-libubsan option directs the GCC driver to link libubsan
11716 statically, without necessarily linking other libraries statically.
11717
11718 -static-libstdc++
11719 When the g++ program is used to link a C++ program, it normally
11720 automatically links against libstdc++. If libstdc++ is available
11721 as a shared library, and the -static option is not used, then this
11722 links against the shared version of libstdc++. That is normally
11723 fine. However, it is sometimes useful to freeze the version of
11724 libstdc++ used by the program without going all the way to a fully
11725 static link. The -static-libstdc++ option directs the g++ driver
11726 to link libstdc++ statically, without necessarily linking other
11727 libraries statically.
11728
11729 -symbolic
11730 Bind references to global symbols when building a shared object.
11731 Warn about any unresolved references (unless overridden by the link
11732 editor option -Xlinker -z -Xlinker defs). Only a few systems
11733 support this option.
11734
11735 -T script
11736 Use script as the linker script. This option is supported by most
11737 systems using the GNU linker. On some targets, such as bare-board
11738 targets without an operating system, the -T option may be required
11739 when linking to avoid references to undefined symbols.
11740
11741 -Xlinker option
11742 Pass option as an option to the linker. You can use this to supply
11743 system-specific linker options that GCC does not recognize.
11744
11745 If you want to pass an option that takes a separate argument, you
11746 must use -Xlinker twice, once for the option and once for the
11747 argument. For example, to pass -assert definitions, you must write
11748 -Xlinker -assert -Xlinker definitions. It does not work to write
11749 -Xlinker "-assert definitions", because this passes the entire
11750 string as a single argument, which is not what the linker expects.
11751
11752 When using the GNU linker, it is usually more convenient to pass
11753 arguments to linker options using the option=value syntax than as
11754 separate arguments. For example, you can specify -Xlinker
11755 -Map=output.map rather than -Xlinker -Map -Xlinker output.map.
11756 Other linkers may not support this syntax for command-line options.
11757
11758 -Wl,option
11759 Pass option as an option to the linker. If option contains commas,
11760 it is split into multiple options at the commas. You can use this
11761 syntax to pass an argument to the option. For example,
11762 -Wl,-Map,output.map passes -Map output.map to the linker. When
11763 using the GNU linker, you can also get the same effect with
11764 -Wl,-Map=output.map.
11765
11766 -u symbol
11767 Pretend the symbol symbol is undefined, to force linking of library
11768 modules to define it. You can use -u multiple times with different
11769 symbols to force loading of additional library modules.
11770
11771 -z keyword
11772 -z is passed directly on to the linker along with the keyword
11773 keyword. See the section in the documentation of your linker for
11774 permitted values and their meanings.
11775
11776 Options for Directory Search
11777 These options specify directories to search for header files, for
11778 libraries and for parts of the compiler:
11779
11780 -I dir
11781 -iquote dir
11782 -isystem dir
11783 -idirafter dir
11784 Add the directory dir to the list of directories to be searched for
11785 header files during preprocessing. If dir begins with = or
11786 $SYSROOT, then the = or $SYSROOT is replaced by the sysroot prefix;
11787 see --sysroot and -isysroot.
11788
11789 Directories specified with -iquote apply only to the quote form of
11790 the directive, "#include "file"". Directories specified with -I,
11791 -isystem, or -idirafter apply to lookup for both the
11792 "#include "file"" and "#include <file>" directives.
11793
11794 You can specify any number or combination of these options on the
11795 command line to search for header files in several directories.
11796 The lookup order is as follows:
11797
11798 1. For the quote form of the include directive, the directory of
11799 the current file is searched first.
11800
11801 2. For the quote form of the include directive, the directories
11802 specified by -iquote options are searched in left-to-right
11803 order, as they appear on the command line.
11804
11805 3. Directories specified with -I options are scanned in left-to-
11806 right order.
11807
11808 4. Directories specified with -isystem options are scanned in
11809 left-to-right order.
11810
11811 5. Standard system directories are scanned.
11812
11813 6. Directories specified with -idirafter options are scanned in
11814 left-to-right order.
11815
11816 You can use -I to override a system header file, substituting your
11817 own version, since these directories are searched before the
11818 standard system header file directories. However, you should not
11819 use this option to add directories that contain vendor-supplied
11820 system header files; use -isystem for that.
11821
11822 The -isystem and -idirafter options also mark the directory as a
11823 system directory, so that it gets the same special treatment that
11824 is applied to the standard system directories.
11825
11826 If a standard system include directory, or a directory specified
11827 with -isystem, is also specified with -I, the -I option is ignored.
11828 The directory is still searched but as a system directory at its
11829 normal position in the system include chain. This is to ensure
11830 that GCC's procedure to fix buggy system headers and the ordering
11831 for the "#include_next" directive are not inadvertently changed.
11832 If you really need to change the search order for system
11833 directories, use the -nostdinc and/or -isystem options.
11834
11835 -I- Split the include path. This option has been deprecated. Please
11836 use -iquote instead for -I directories before the -I- and remove
11837 the -I- option.
11838
11839 Any directories specified with -I options before -I- are searched
11840 only for headers requested with "#include "file""; they are not
11841 searched for "#include <file>". If additional directories are
11842 specified with -I options after the -I-, those directories are
11843 searched for all #include directives.
11844
11845 In addition, -I- inhibits the use of the directory of the current
11846 file directory as the first search directory for "#include "file"".
11847 There is no way to override this effect of -I-.
11848
11849 -iprefix prefix
11850 Specify prefix as the prefix for subsequent -iwithprefix options.
11851 If the prefix represents a directory, you should include the final
11852 /.
11853
11854 -iwithprefix dir
11855 -iwithprefixbefore dir
11856 Append dir to the prefix specified previously with -iprefix, and
11857 add the resulting directory to the include search path.
11858 -iwithprefixbefore puts it in the same place -I would; -iwithprefix
11859 puts it where -idirafter would.
11860
11861 -isysroot dir
11862 This option is like the --sysroot option, but applies only to
11863 header files (except for Darwin targets, where it applies to both
11864 header files and libraries). See the --sysroot option for more
11865 information.
11866
11867 -imultilib dir
11868 Use dir as a subdirectory of the directory containing target-
11869 specific C++ headers.
11870
11871 -nostdinc
11872 Do not search the standard system directories for header files.
11873 Only the directories explicitly specified with -I, -iquote,
11874 -isystem, and/or -idirafter options (and the directory of the
11875 current file, if appropriate) are searched.
11876
11877 -nostdinc++
11878 Do not search for header files in the C++-specific standard
11879 directories, but do still search the other standard directories.
11880 (This option is used when building the C++ library.)
11881
11882 -iplugindir=dir
11883 Set the directory to search for plugins that are passed by
11884 -fplugin=name instead of -fplugin=path/name.so. This option is not
11885 meant to be used by the user, but only passed by the driver.
11886
11887 -Ldir
11888 Add directory dir to the list of directories to be searched for -l.
11889
11890 -Bprefix
11891 This option specifies where to find the executables, libraries,
11892 include files, and data files of the compiler itself.
11893
11894 The compiler driver program runs one or more of the subprograms
11895 cpp, cc1, as and ld. It tries prefix as a prefix for each program
11896 it tries to run, both with and without machine/version/ for the
11897 corresponding target machine and compiler version.
11898
11899 For each subprogram to be run, the compiler driver first tries the
11900 -B prefix, if any. If that name is not found, or if -B is not
11901 specified, the driver tries two standard prefixes, /usr/lib/gcc/
11902 and /usr/local/lib/gcc/. If neither of those results in a file
11903 name that is found, the unmodified program name is searched for
11904 using the directories specified in your PATH environment variable.
11905
11906 The compiler checks to see if the path provided by -B refers to a
11907 directory, and if necessary it adds a directory separator character
11908 at the end of the path.
11909
11910 -B prefixes that effectively specify directory names also apply to
11911 libraries in the linker, because the compiler translates these
11912 options into -L options for the linker. They also apply to include
11913 files in the preprocessor, because the compiler translates these
11914 options into -isystem options for the preprocessor. In this case,
11915 the compiler appends include to the prefix.
11916
11917 The runtime support file libgcc.a can also be searched for using
11918 the -B prefix, if needed. If it is not found there, the two
11919 standard prefixes above are tried, and that is all. The file is
11920 left out of the link if it is not found by those means.
11921
11922 Another way to specify a prefix much like the -B prefix is to use
11923 the environment variable GCC_EXEC_PREFIX.
11924
11925 As a special kludge, if the path provided by -B is [dir/]stageN/,
11926 where N is a number in the range 0 to 9, then it is replaced by
11927 [dir/]include. This is to help with boot-strapping the compiler.
11928
11929 -no-canonical-prefixes
11930 Do not expand any symbolic links, resolve references to /../ or
11931 /./, or make the path absolute when generating a relative prefix.
11932
11933 --sysroot=dir
11934 Use dir as the logical root directory for headers and libraries.
11935 For example, if the compiler normally searches for headers in
11936 /usr/include and libraries in /usr/lib, it instead searches
11937 dir/usr/include and dir/usr/lib.
11938
11939 If you use both this option and the -isysroot option, then the
11940 --sysroot option applies to libraries, but the -isysroot option
11941 applies to header files.
11942
11943 The GNU linker (beginning with version 2.16) has the necessary
11944 support for this option. If your linker does not support this
11945 option, the header file aspect of --sysroot still works, but the
11946 library aspect does not.
11947
11948 --no-sysroot-suffix
11949 For some targets, a suffix is added to the root directory specified
11950 with --sysroot, depending on the other options used, so that
11951 headers may for example be found in dir/suffix/usr/include instead
11952 of dir/usr/include. This option disables the addition of such a
11953 suffix.
11954
11955 Options for Code Generation Conventions
11956 These machine-independent options control the interface conventions
11957 used in code generation.
11958
11959 Most of them have both positive and negative forms; the negative form
11960 of -ffoo is -fno-foo. In the table below, only one of the forms is
11961 listed---the one that is not the default. You can figure out the other
11962 form by either removing no- or adding it.
11963
11964 -fstack-reuse=reuse-level
11965 This option controls stack space reuse for user declared local/auto
11966 variables and compiler generated temporaries. reuse_level can be
11967 all, named_vars, or none. all enables stack reuse for all local
11968 variables and temporaries, named_vars enables the reuse only for
11969 user defined local variables with names, and none disables stack
11970 reuse completely. The default value is all. The option is needed
11971 when the program extends the lifetime of a scoped local variable or
11972 a compiler generated temporary beyond the end point defined by the
11973 language. When a lifetime of a variable ends, and if the variable
11974 lives in memory, the optimizing compiler has the freedom to reuse
11975 its stack space with other temporaries or scoped local variables
11976 whose live range does not overlap with it. Legacy code extending
11977 local lifetime is likely to break with the stack reuse
11978 optimization.
11979
11980 For example,
11981
11982 int *p;
11983 {
11984 int local1;
11985
11986 p = &local1;
11987 local1 = 10;
11988 ....
11989 }
11990 {
11991 int local2;
11992 local2 = 20;
11993 ...
11994 }
11995
11996 if (*p == 10) // out of scope use of local1
11997 {
11998
11999 }
12000
12001 Another example:
12002
12003 struct A
12004 {
12005 A(int k) : i(k), j(k) { }
12006 int i;
12007 int j;
12008 };
12009
12010 A *ap;
12011
12012 void foo(const A& ar)
12013 {
12014 ap = &ar;
12015 }
12016
12017 void bar()
12018 {
12019 foo(A(10)); // temp object's lifetime ends when foo returns
12020
12021 {
12022 A a(20);
12023 ....
12024 }
12025 ap->i+= 10; // ap references out of scope temp whose space
12026 // is reused with a. What is the value of ap->i?
12027 }
12028
12029 The lifetime of a compiler generated temporary is well defined by
12030 the C++ standard. When a lifetime of a temporary ends, and if the
12031 temporary lives in memory, the optimizing compiler has the freedom
12032 to reuse its stack space with other temporaries or scoped local
12033 variables whose live range does not overlap with it. However some
12034 of the legacy code relies on the behavior of older compilers in
12035 which temporaries' stack space is not reused, the aggressive stack
12036 reuse can lead to runtime errors. This option is used to control
12037 the temporary stack reuse optimization.
12038
12039 -ftrapv
12040 This option generates traps for signed overflow on addition,
12041 subtraction, multiplication operations. The options -ftrapv and
12042 -fwrapv override each other, so using -ftrapv -fwrapv on the
12043 command-line results in -fwrapv being effective. Note that only
12044 active options override, so using -ftrapv -fwrapv -fno-wrapv on the
12045 command-line results in -ftrapv being effective.
12046
12047 -fwrapv
12048 This option instructs the compiler to assume that signed arithmetic
12049 overflow of addition, subtraction and multiplication wraps around
12050 using twos-complement representation. This flag enables some
12051 optimizations and disables others. The options -ftrapv and -fwrapv
12052 override each other, so using -ftrapv -fwrapv on the command-line
12053 results in -fwrapv being effective. Note that only active options
12054 override, so using -ftrapv -fwrapv -fno-wrapv on the command-line
12055 results in -ftrapv being effective.
12056
12057 -fwrapv-pointer
12058 This option instructs the compiler to assume that pointer
12059 arithmetic overflow on addition and subtraction wraps around using
12060 twos-complement representation. This flag disables some
12061 optimizations which assume pointer overflow is invalid.
12062
12063 -fstrict-overflow
12064 This option implies -fno-wrapv -fno-wrapv-pointer and when negated
12065 implies -fwrapv -fwrapv-pointer.
12066
12067 -fexceptions
12068 Enable exception handling. Generates extra code needed to
12069 propagate exceptions. For some targets, this implies GCC generates
12070 frame unwind information for all functions, which can produce
12071 significant data size overhead, although it does not affect
12072 execution. If you do not specify this option, GCC enables it by
12073 default for languages like C++ that normally require exception
12074 handling, and disables it for languages like C that do not normally
12075 require it. However, you may need to enable this option when
12076 compiling C code that needs to interoperate properly with exception
12077 handlers written in C++. You may also wish to disable this option
12078 if you are compiling older C++ programs that don't use exception
12079 handling.
12080
12081 -fnon-call-exceptions
12082 Generate code that allows trapping instructions to throw
12083 exceptions. Note that this requires platform-specific runtime
12084 support that does not exist everywhere. Moreover, it only allows
12085 trapping instructions to throw exceptions, i.e. memory references
12086 or floating-point instructions. It does not allow exceptions to be
12087 thrown from arbitrary signal handlers such as "SIGALRM".
12088
12089 -fdelete-dead-exceptions
12090 Consider that instructions that may throw exceptions but don't
12091 otherwise contribute to the execution of the program can be
12092 optimized away. This option is enabled by default for the Ada
12093 front end, as permitted by the Ada language specification.
12094 Optimization passes that cause dead exceptions to be removed are
12095 enabled independently at different optimization levels.
12096
12097 -funwind-tables
12098 Similar to -fexceptions, except that it just generates any needed
12099 static data, but does not affect the generated code in any other
12100 way. You normally do not need to enable this option; instead, a
12101 language processor that needs this handling enables it on your
12102 behalf.
12103
12104 -fasynchronous-unwind-tables
12105 Generate unwind table in DWARF format, if supported by target
12106 machine. The table is exact at each instruction boundary, so it
12107 can be used for stack unwinding from asynchronous events (such as
12108 debugger or garbage collector).
12109
12110 -fno-gnu-unique
12111 On systems with recent GNU assembler and C library, the C++
12112 compiler uses the "STB_GNU_UNIQUE" binding to make sure that
12113 definitions of template static data members and static local
12114 variables in inline functions are unique even in the presence of
12115 "RTLD_LOCAL"; this is necessary to avoid problems with a library
12116 used by two different "RTLD_LOCAL" plugins depending on a
12117 definition in one of them and therefore disagreeing with the other
12118 one about the binding of the symbol. But this causes "dlclose" to
12119 be ignored for affected DSOs; if your program relies on
12120 reinitialization of a DSO via "dlclose" and "dlopen", you can use
12121 -fno-gnu-unique.
12122
12123 -fpcc-struct-return
12124 Return "short" "struct" and "union" values in memory like longer
12125 ones, rather than in registers. This convention is less efficient,
12126 but it has the advantage of allowing intercallability between GCC-
12127 compiled files and files compiled with other compilers,
12128 particularly the Portable C Compiler (pcc).
12129
12130 The precise convention for returning structures in memory depends
12131 on the target configuration macros.
12132
12133 Short structures and unions are those whose size and alignment
12134 match that of some integer type.
12135
12136 Warning: code compiled with the -fpcc-struct-return switch is not
12137 binary compatible with code compiled with the -freg-struct-return
12138 switch. Use it to conform to a non-default application binary
12139 interface.
12140
12141 -freg-struct-return
12142 Return "struct" and "union" values in registers when possible.
12143 This is more efficient for small structures than
12144 -fpcc-struct-return.
12145
12146 If you specify neither -fpcc-struct-return nor -freg-struct-return,
12147 GCC defaults to whichever convention is standard for the target.
12148 If there is no standard convention, GCC defaults to
12149 -fpcc-struct-return, except on targets where GCC is the principal
12150 compiler. In those cases, we can choose the standard, and we chose
12151 the more efficient register return alternative.
12152
12153 Warning: code compiled with the -freg-struct-return switch is not
12154 binary compatible with code compiled with the -fpcc-struct-return
12155 switch. Use it to conform to a non-default application binary
12156 interface.
12157
12158 -fshort-enums
12159 Allocate to an "enum" type only as many bytes as it needs for the
12160 declared range of possible values. Specifically, the "enum" type
12161 is equivalent to the smallest integer type that has enough room.
12162
12163 Warning: the -fshort-enums switch causes GCC to generate code that
12164 is not binary compatible with code generated without that switch.
12165 Use it to conform to a non-default application binary interface.
12166
12167 -fshort-wchar
12168 Override the underlying type for "wchar_t" to be "short unsigned
12169 int" instead of the default for the target. This option is useful
12170 for building programs to run under WINE.
12171
12172 Warning: the -fshort-wchar switch causes GCC to generate code that
12173 is not binary compatible with code generated without that switch.
12174 Use it to conform to a non-default application binary interface.
12175
12176 -fno-common
12177 In C code, this option controls the placement of global variables
12178 defined without an initializer, known as tentative definitions in
12179 the C standard. Tentative definitions are distinct from
12180 declarations of a variable with the "extern" keyword, which do not
12181 allocate storage.
12182
12183 Unix C compilers have traditionally allocated storage for
12184 uninitialized global variables in a common block. This allows the
12185 linker to resolve all tentative definitions of the same variable in
12186 different compilation units to the same object, or to a non-
12187 tentative definition. This is the behavior specified by -fcommon,
12188 and is the default for GCC on most targets. On the other hand,
12189 this behavior is not required by ISO C, and on some targets may
12190 carry a speed or code size penalty on variable references.
12191
12192 The -fno-common option specifies that the compiler should instead
12193 place uninitialized global variables in the BSS section of the
12194 object file. This inhibits the merging of tentative definitions by
12195 the linker so you get a multiple-definition error if the same
12196 variable is defined in more than one compilation unit. Compiling
12197 with -fno-common is useful on targets for which it provides better
12198 performance, or if you wish to verify that the program will work on
12199 other systems that always treat uninitialized variable definitions
12200 this way.
12201
12202 -fno-ident
12203 Ignore the "#ident" directive.
12204
12205 -finhibit-size-directive
12206 Don't output a ".size" assembler directive, or anything else that
12207 would cause trouble if the function is split in the middle, and the
12208 two halves are placed at locations far apart in memory. This
12209 option is used when compiling crtstuff.c; you should not need to
12210 use it for anything else.
12211
12212 -fverbose-asm
12213 Put extra commentary information in the generated assembly code to
12214 make it more readable. This option is generally only of use to
12215 those who actually need to read the generated assembly code
12216 (perhaps while debugging the compiler itself).
12217
12218 -fno-verbose-asm, the default, causes the extra information to be
12219 omitted and is useful when comparing two assembler files.
12220
12221 The added comments include:
12222
12223 * information on the compiler version and command-line options,
12224
12225 * the source code lines associated with the assembly
12226 instructions, in the form FILENAME:LINENUMBER:CONTENT OF LINE,
12227
12228 * hints on which high-level expressions correspond to the various
12229 assembly instruction operands.
12230
12231 For example, given this C source file:
12232
12233 int test (int n)
12234 {
12235 int i;
12236 int total = 0;
12237
12238 for (i = 0; i < n; i++)
12239 total += i * i;
12240
12241 return total;
12242 }
12243
12244 compiling to (x86_64) assembly via -S and emitting the result
12245 direct to stdout via -o -
12246
12247 gcc -S test.c -fverbose-asm -Os -o -
12248
12249 gives output similar to this:
12250
12251 .file "test.c"
12252 # GNU C11 (GCC) version 7.0.0 20160809 (experimental) (x86_64-pc-linux-gnu)
12253 [...snip...]
12254 # options passed:
12255 [...snip...]
12256
12257 .text
12258 .globl test
12259 .type test, @function
12260 test:
12261 .LFB0:
12262 .cfi_startproc
12263 # test.c:4: int total = 0;
12264 xorl %eax, %eax # <retval>
12265 # test.c:6: for (i = 0; i < n; i++)
12266 xorl %edx, %edx # i
12267 .L2:
12268 # test.c:6: for (i = 0; i < n; i++)
12269 cmpl %edi, %edx # n, i
12270 jge .L5 #,
12271 # test.c:7: total += i * i;
12272 movl %edx, %ecx # i, tmp92
12273 imull %edx, %ecx # i, tmp92
12274 # test.c:6: for (i = 0; i < n; i++)
12275 incl %edx # i
12276 # test.c:7: total += i * i;
12277 addl %ecx, %eax # tmp92, <retval>
12278 jmp .L2 #
12279 .L5:
12280 # test.c:10: }
12281 ret
12282 .cfi_endproc
12283 .LFE0:
12284 .size test, .-test
12285 .ident "GCC: (GNU) 7.0.0 20160809 (experimental)"
12286 .section .note.GNU-stack,"",@progbits
12287
12288 The comments are intended for humans rather than machines and hence
12289 the precise format of the comments is subject to change.
12290
12291 -frecord-gcc-switches
12292 This switch causes the command line used to invoke the compiler to
12293 be recorded into the object file that is being created. This
12294 switch is only implemented on some targets and the exact format of
12295 the recording is target and binary file format dependent, but it
12296 usually takes the form of a section containing ASCII text. This
12297 switch is related to the -fverbose-asm switch, but that switch only
12298 records information in the assembler output file as comments, so it
12299 never reaches the object file. See also -grecord-gcc-switches for
12300 another way of storing compiler options into the object file.
12301
12302 -fpic
12303 Generate position-independent code (PIC) suitable for use in a
12304 shared library, if supported for the target machine. Such code
12305 accesses all constant addresses through a global offset table
12306 (GOT). The dynamic loader resolves the GOT entries when the
12307 program starts (the dynamic loader is not part of GCC; it is part
12308 of the operating system). If the GOT size for the linked
12309 executable exceeds a machine-specific maximum size, you get an
12310 error message from the linker indicating that -fpic does not work;
12311 in that case, recompile with -fPIC instead. (These maximums are 8k
12312 on the SPARC, 28k on AArch64 and 32k on the m68k and RS/6000. The
12313 x86 has no such limit.)
12314
12315 Position-independent code requires special support, and therefore
12316 works only on certain machines. For the x86, GCC supports PIC for
12317 System V but not for the Sun 386i. Code generated for the IBM
12318 RS/6000 is always position-independent.
12319
12320 When this flag is set, the macros "__pic__" and "__PIC__" are
12321 defined to 1.
12322
12323 -fPIC
12324 If supported for the target machine, emit position-independent
12325 code, suitable for dynamic linking and avoiding any limit on the
12326 size of the global offset table. This option makes a difference on
12327 AArch64, m68k, PowerPC and SPARC.
12328
12329 Position-independent code requires special support, and therefore
12330 works only on certain machines.
12331
12332 When this flag is set, the macros "__pic__" and "__PIC__" are
12333 defined to 2.
12334
12335 -fpie
12336 -fPIE
12337 These options are similar to -fpic and -fPIC, but the generated
12338 position-independent code can be only linked into executables.
12339 Usually these options are used to compile code that will be linked
12340 using the -pie GCC option.
12341
12342 -fpie and -fPIE both define the macros "__pie__" and "__PIE__".
12343 The macros have the value 1 for -fpie and 2 for -fPIE.
12344
12345 -fno-plt
12346 Do not use the PLT for external function calls in position-
12347 independent code. Instead, load the callee address at call sites
12348 from the GOT and branch to it. This leads to more efficient code
12349 by eliminating PLT stubs and exposing GOT loads to optimizations.
12350 On architectures such as 32-bit x86 where PLT stubs expect the GOT
12351 pointer in a specific register, this gives more register allocation
12352 freedom to the compiler. Lazy binding requires use of the PLT;
12353 with -fno-plt all external symbols are resolved at load time.
12354
12355 Alternatively, the function attribute "noplt" can be used to avoid
12356 calls through the PLT for specific external functions.
12357
12358 In position-dependent code, a few targets also convert calls to
12359 functions that are marked to not use the PLT to use the GOT
12360 instead.
12361
12362 -fno-jump-tables
12363 Do not use jump tables for switch statements even where it would be
12364 more efficient than other code generation strategies. This option
12365 is of use in conjunction with -fpic or -fPIC for building code that
12366 forms part of a dynamic linker and cannot reference the address of
12367 a jump table. On some targets, jump tables do not require a GOT
12368 and this option is not needed.
12369
12370 -ffixed-reg
12371 Treat the register named reg as a fixed register; generated code
12372 should never refer to it (except perhaps as a stack pointer, frame
12373 pointer or in some other fixed role).
12374
12375 reg must be the name of a register. The register names accepted
12376 are machine-specific and are defined in the "REGISTER_NAMES" macro
12377 in the machine description macro file.
12378
12379 This flag does not have a negative form, because it specifies a
12380 three-way choice.
12381
12382 -fcall-used-reg
12383 Treat the register named reg as an allocable register that is
12384 clobbered by function calls. It may be allocated for temporaries
12385 or variables that do not live across a call. Functions compiled
12386 this way do not save and restore the register reg.
12387
12388 It is an error to use this flag with the frame pointer or stack
12389 pointer. Use of this flag for other registers that have fixed
12390 pervasive roles in the machine's execution model produces
12391 disastrous results.
12392
12393 This flag does not have a negative form, because it specifies a
12394 three-way choice.
12395
12396 -fcall-saved-reg
12397 Treat the register named reg as an allocable register saved by
12398 functions. It may be allocated even for temporaries or variables
12399 that live across a call. Functions compiled this way save and
12400 restore the register reg if they use it.
12401
12402 It is an error to use this flag with the frame pointer or stack
12403 pointer. Use of this flag for other registers that have fixed
12404 pervasive roles in the machine's execution model produces
12405 disastrous results.
12406
12407 A different sort of disaster results from the use of this flag for
12408 a register in which function values may be returned.
12409
12410 This flag does not have a negative form, because it specifies a
12411 three-way choice.
12412
12413 -fpack-struct[=n]
12414 Without a value specified, pack all structure members together
12415 without holes. When a value is specified (which must be a small
12416 power of two), pack structure members according to this value,
12417 representing the maximum alignment (that is, objects with default
12418 alignment requirements larger than this are output potentially
12419 unaligned at the next fitting location.
12420
12421 Warning: the -fpack-struct switch causes GCC to generate code that
12422 is not binary compatible with code generated without that switch.
12423 Additionally, it makes the code suboptimal. Use it to conform to a
12424 non-default application binary interface.
12425
12426 -fleading-underscore
12427 This option and its counterpart, -fno-leading-underscore, forcibly
12428 change the way C symbols are represented in the object file. One
12429 use is to help link with legacy assembly code.
12430
12431 Warning: the -fleading-underscore switch causes GCC to generate
12432 code that is not binary compatible with code generated without that
12433 switch. Use it to conform to a non-default application binary
12434 interface. Not all targets provide complete support for this
12435 switch.
12436
12437 -ftls-model=model
12438 Alter the thread-local storage model to be used. The model
12439 argument should be one of global-dynamic, local-dynamic, initial-
12440 exec or local-exec. Note that the choice is subject to
12441 optimization: the compiler may use a more efficient model for
12442 symbols not visible outside of the translation unit, or if -fpic is
12443 not given on the command line.
12444
12445 The default without -fpic is initial-exec; with -fpic the default
12446 is global-dynamic.
12447
12448 -ftrampolines
12449 For targets that normally need trampolines for nested functions,
12450 always generate them instead of using descriptors. Otherwise, for
12451 targets that do not need them, like for example HP-PA or IA-64, do
12452 nothing.
12453
12454 A trampoline is a small piece of code that is created at run time
12455 on the stack when the address of a nested function is taken, and is
12456 used to call the nested function indirectly. Therefore, it
12457 requires the stack to be made executable in order for the program
12458 to work properly.
12459
12460 -fno-trampolines is enabled by default on a language by language
12461 basis to let the compiler avoid generating them, if it computes
12462 that this is safe, and replace them with descriptors. Descriptors
12463 are made up of data only, but the generated code must be prepared
12464 to deal with them. As of this writing, -fno-trampolines is enabled
12465 by default only for Ada.
12466
12467 Moreover, code compiled with -ftrampolines and code compiled with
12468 -fno-trampolines are not binary compatible if nested functions are
12469 present. This option must therefore be used on a program-wide
12470 basis and be manipulated with extreme care.
12471
12472 -fvisibility=[default|internal|hidden|protected]
12473 Set the default ELF image symbol visibility to the specified
12474 option---all symbols are marked with this unless overridden within
12475 the code. Using this feature can very substantially improve
12476 linking and load times of shared object libraries, produce more
12477 optimized code, provide near-perfect API export and prevent symbol
12478 clashes. It is strongly recommended that you use this in any
12479 shared objects you distribute.
12480
12481 Despite the nomenclature, default always means public; i.e.,
12482 available to be linked against from outside the shared object.
12483 protected and internal are pretty useless in real-world usage so
12484 the only other commonly used option is hidden. The default if
12485 -fvisibility isn't specified is default, i.e., make every symbol
12486 public.
12487
12488 A good explanation of the benefits offered by ensuring ELF symbols
12489 have the correct visibility is given by "How To Write Shared
12490 Libraries" by Ulrich Drepper (which can be found at
12491 <https://www.akkadia.org/drepper/>)---however a superior solution
12492 made possible by this option to marking things hidden when the
12493 default is public is to make the default hidden and mark things
12494 public. This is the norm with DLLs on Windows and with
12495 -fvisibility=hidden and "__attribute__ ((visibility("default")))"
12496 instead of "__declspec(dllexport)" you get almost identical
12497 semantics with identical syntax. This is a great boon to those
12498 working with cross-platform projects.
12499
12500 For those adding visibility support to existing code, you may find
12501 "#pragma GCC visibility" of use. This works by you enclosing the
12502 declarations you wish to set visibility for with (for example)
12503 "#pragma GCC visibility push(hidden)" and "#pragma GCC visibility
12504 pop". Bear in mind that symbol visibility should be viewed as part
12505 of the API interface contract and thus all new code should always
12506 specify visibility when it is not the default; i.e., declarations
12507 only for use within the local DSO should always be marked
12508 explicitly as hidden as so to avoid PLT indirection
12509 overheads---making this abundantly clear also aids readability and
12510 self-documentation of the code. Note that due to ISO C++
12511 specification requirements, "operator new" and "operator delete"
12512 must always be of default visibility.
12513
12514 Be aware that headers from outside your project, in particular
12515 system headers and headers from any other library you use, may not
12516 be expecting to be compiled with visibility other than the default.
12517 You may need to explicitly say "#pragma GCC visibility
12518 push(default)" before including any such headers.
12519
12520 "extern" declarations are not affected by -fvisibility, so a lot of
12521 code can be recompiled with -fvisibility=hidden with no
12522 modifications. However, this means that calls to "extern"
12523 functions with no explicit visibility use the PLT, so it is more
12524 effective to use "__attribute ((visibility))" and/or "#pragma GCC
12525 visibility" to tell the compiler which "extern" declarations should
12526 be treated as hidden.
12527
12528 Note that -fvisibility does affect C++ vague linkage entities. This
12529 means that, for instance, an exception class that is be thrown
12530 between DSOs must be explicitly marked with default visibility so
12531 that the type_info nodes are unified between the DSOs.
12532
12533 An overview of these techniques, their benefits and how to use them
12534 is at <http://gcc.gnu.org/wiki/Visibility>.
12535
12536 -fstrict-volatile-bitfields
12537 This option should be used if accesses to volatile bit-fields (or
12538 other structure fields, although the compiler usually honors those
12539 types anyway) should use a single access of the width of the
12540 field's type, aligned to a natural alignment if possible. For
12541 example, targets with memory-mapped peripheral registers might
12542 require all such accesses to be 16 bits wide; with this flag you
12543 can declare all peripheral bit-fields as "unsigned short" (assuming
12544 short is 16 bits on these targets) to force GCC to use 16-bit
12545 accesses instead of, perhaps, a more efficient 32-bit access.
12546
12547 If this option is disabled, the compiler uses the most efficient
12548 instruction. In the previous example, that might be a 32-bit load
12549 instruction, even though that accesses bytes that do not contain
12550 any portion of the bit-field, or memory-mapped registers unrelated
12551 to the one being updated.
12552
12553 In some cases, such as when the "packed" attribute is applied to a
12554 structure field, it may not be possible to access the field with a
12555 single read or write that is correctly aligned for the target
12556 machine. In this case GCC falls back to generating multiple
12557 accesses rather than code that will fault or truncate the result at
12558 run time.
12559
12560 Note: Due to restrictions of the C/C++11 memory model, write
12561 accesses are not allowed to touch non bit-field members. It is
12562 therefore recommended to define all bits of the field's type as
12563 bit-field members.
12564
12565 The default value of this option is determined by the application
12566 binary interface for the target processor.
12567
12568 -fsync-libcalls
12569 This option controls whether any out-of-line instance of the
12570 "__sync" family of functions may be used to implement the C++11
12571 "__atomic" family of functions.
12572
12573 The default value of this option is enabled, thus the only useful
12574 form of the option is -fno-sync-libcalls. This option is used in
12575 the implementation of the libatomic runtime library.
12576
12577 GCC Developer Options
12578 This section describes command-line options that are primarily of
12579 interest to GCC developers, including options to support compiler
12580 testing and investigation of compiler bugs and compile-time performance
12581 problems. This includes options that produce debug dumps at various
12582 points in the compilation; that print statistics such as memory use and
12583 execution time; and that print information about GCC's configuration,
12584 such as where it searches for libraries. You should rarely need to use
12585 any of these options for ordinary compilation and linking tasks.
12586
12587 Many developer options that cause GCC to dump output to a file take an
12588 optional =filename suffix. You can specify stdout or - to dump to
12589 standard output, and stderr for standard error.
12590
12591 If =filename is omitted, a default dump file name is constructed by
12592 concatenating the base dump file name, a pass number, phase letter, and
12593 pass name. The base dump file name is the name of output file produced
12594 by the compiler if explicitly specified and not an executable;
12595 otherwise it is the source file name. The pass number is determined by
12596 the order passes are registered with the compiler's pass manager. This
12597 is generally the same as the order of execution, but passes registered
12598 by plugins, target-specific passes, or passes that are otherwise
12599 registered late are numbered higher than the pass named final, even if
12600 they are executed earlier. The phase letter is one of i (inter-
12601 procedural analysis), l (language-specific), r (RTL), or t (tree). The
12602 files are created in the directory of the output file.
12603
12604 -dletters
12605 -fdump-rtl-pass
12606 -fdump-rtl-pass=filename
12607 Says to make debugging dumps during compilation at times specified
12608 by letters. This is used for debugging the RTL-based passes of the
12609 compiler.
12610
12611 Some -dletters switches have different meaning when -E is used for
12612 preprocessing.
12613
12614 Debug dumps can be enabled with a -fdump-rtl switch or some -d
12615 option letters. Here are the possible letters for use in pass and
12616 letters, and their meanings:
12617
12618 -fdump-rtl-alignments
12619 Dump after branch alignments have been computed.
12620
12621 -fdump-rtl-asmcons
12622 Dump after fixing rtl statements that have unsatisfied in/out
12623 constraints.
12624
12625 -fdump-rtl-auto_inc_dec
12626 Dump after auto-inc-dec discovery. This pass is only run on
12627 architectures that have auto inc or auto dec instructions.
12628
12629 -fdump-rtl-barriers
12630 Dump after cleaning up the barrier instructions.
12631
12632 -fdump-rtl-bbpart
12633 Dump after partitioning hot and cold basic blocks.
12634
12635 -fdump-rtl-bbro
12636 Dump after block reordering.
12637
12638 -fdump-rtl-btl1
12639 -fdump-rtl-btl2
12640 -fdump-rtl-btl1 and -fdump-rtl-btl2 enable dumping after the
12641 two branch target load optimization passes.
12642
12643 -fdump-rtl-bypass
12644 Dump after jump bypassing and control flow optimizations.
12645
12646 -fdump-rtl-combine
12647 Dump after the RTL instruction combination pass.
12648
12649 -fdump-rtl-compgotos
12650 Dump after duplicating the computed gotos.
12651
12652 -fdump-rtl-ce1
12653 -fdump-rtl-ce2
12654 -fdump-rtl-ce3
12655 -fdump-rtl-ce1, -fdump-rtl-ce2, and -fdump-rtl-ce3 enable
12656 dumping after the three if conversion passes.
12657
12658 -fdump-rtl-cprop_hardreg
12659 Dump after hard register copy propagation.
12660
12661 -fdump-rtl-csa
12662 Dump after combining stack adjustments.
12663
12664 -fdump-rtl-cse1
12665 -fdump-rtl-cse2
12666 -fdump-rtl-cse1 and -fdump-rtl-cse2 enable dumping after the
12667 two common subexpression elimination passes.
12668
12669 -fdump-rtl-dce
12670 Dump after the standalone dead code elimination passes.
12671
12672 -fdump-rtl-dbr
12673 Dump after delayed branch scheduling.
12674
12675 -fdump-rtl-dce1
12676 -fdump-rtl-dce2
12677 -fdump-rtl-dce1 and -fdump-rtl-dce2 enable dumping after the
12678 two dead store elimination passes.
12679
12680 -fdump-rtl-eh
12681 Dump after finalization of EH handling code.
12682
12683 -fdump-rtl-eh_ranges
12684 Dump after conversion of EH handling range regions.
12685
12686 -fdump-rtl-expand
12687 Dump after RTL generation.
12688
12689 -fdump-rtl-fwprop1
12690 -fdump-rtl-fwprop2
12691 -fdump-rtl-fwprop1 and -fdump-rtl-fwprop2 enable dumping after
12692 the two forward propagation passes.
12693
12694 -fdump-rtl-gcse1
12695 -fdump-rtl-gcse2
12696 -fdump-rtl-gcse1 and -fdump-rtl-gcse2 enable dumping after
12697 global common subexpression elimination.
12698
12699 -fdump-rtl-init-regs
12700 Dump after the initialization of the registers.
12701
12702 -fdump-rtl-initvals
12703 Dump after the computation of the initial value sets.
12704
12705 -fdump-rtl-into_cfglayout
12706 Dump after converting to cfglayout mode.
12707
12708 -fdump-rtl-ira
12709 Dump after iterated register allocation.
12710
12711 -fdump-rtl-jump
12712 Dump after the second jump optimization.
12713
12714 -fdump-rtl-loop2
12715 -fdump-rtl-loop2 enables dumping after the rtl loop
12716 optimization passes.
12717
12718 -fdump-rtl-mach
12719 Dump after performing the machine dependent reorganization
12720 pass, if that pass exists.
12721
12722 -fdump-rtl-mode_sw
12723 Dump after removing redundant mode switches.
12724
12725 -fdump-rtl-rnreg
12726 Dump after register renumbering.
12727
12728 -fdump-rtl-outof_cfglayout
12729 Dump after converting from cfglayout mode.
12730
12731 -fdump-rtl-peephole2
12732 Dump after the peephole pass.
12733
12734 -fdump-rtl-postreload
12735 Dump after post-reload optimizations.
12736
12737 -fdump-rtl-pro_and_epilogue
12738 Dump after generating the function prologues and epilogues.
12739
12740 -fdump-rtl-sched1
12741 -fdump-rtl-sched2
12742 -fdump-rtl-sched1 and -fdump-rtl-sched2 enable dumping after
12743 the basic block scheduling passes.
12744
12745 -fdump-rtl-ree
12746 Dump after sign/zero extension elimination.
12747
12748 -fdump-rtl-seqabstr
12749 Dump after common sequence discovery.
12750
12751 -fdump-rtl-shorten
12752 Dump after shortening branches.
12753
12754 -fdump-rtl-sibling
12755 Dump after sibling call optimizations.
12756
12757 -fdump-rtl-split1
12758 -fdump-rtl-split2
12759 -fdump-rtl-split3
12760 -fdump-rtl-split4
12761 -fdump-rtl-split5
12762 These options enable dumping after five rounds of instruction
12763 splitting.
12764
12765 -fdump-rtl-sms
12766 Dump after modulo scheduling. This pass is only run on some
12767 architectures.
12768
12769 -fdump-rtl-stack
12770 Dump after conversion from GCC's "flat register file" registers
12771 to the x87's stack-like registers. This pass is only run on
12772 x86 variants.
12773
12774 -fdump-rtl-subreg1
12775 -fdump-rtl-subreg2
12776 -fdump-rtl-subreg1 and -fdump-rtl-subreg2 enable dumping after
12777 the two subreg expansion passes.
12778
12779 -fdump-rtl-unshare
12780 Dump after all rtl has been unshared.
12781
12782 -fdump-rtl-vartrack
12783 Dump after variable tracking.
12784
12785 -fdump-rtl-vregs
12786 Dump after converting virtual registers to hard registers.
12787
12788 -fdump-rtl-web
12789 Dump after live range splitting.
12790
12791 -fdump-rtl-regclass
12792 -fdump-rtl-subregs_of_mode_init
12793 -fdump-rtl-subregs_of_mode_finish
12794 -fdump-rtl-dfinit
12795 -fdump-rtl-dfinish
12796 These dumps are defined but always produce empty files.
12797
12798 -da
12799 -fdump-rtl-all
12800 Produce all the dumps listed above.
12801
12802 -dA Annotate the assembler output with miscellaneous debugging
12803 information.
12804
12805 -dD Dump all macro definitions, at the end of preprocessing, in
12806 addition to normal output.
12807
12808 -dH Produce a core dump whenever an error occurs.
12809
12810 -dp Annotate the assembler output with a comment indicating which
12811 pattern and alternative is used. The length and cost of each
12812 instruction are also printed.
12813
12814 -dP Dump the RTL in the assembler output as a comment before each
12815 instruction. Also turns on -dp annotation.
12816
12817 -dx Just generate RTL for a function instead of compiling it.
12818 Usually used with -fdump-rtl-expand.
12819
12820 -fdump-debug
12821 Dump debugging information generated during the debug generation
12822 phase.
12823
12824 -fdump-earlydebug
12825 Dump debugging information generated during the early debug
12826 generation phase.
12827
12828 -fdump-noaddr
12829 When doing debugging dumps, suppress address output. This makes it
12830 more feasible to use diff on debugging dumps for compiler
12831 invocations with different compiler binaries and/or different text
12832 / bss / data / heap / stack / dso start locations.
12833
12834 -freport-bug
12835 Collect and dump debug information into a temporary file if an
12836 internal compiler error (ICE) occurs.
12837
12838 -fdump-unnumbered
12839 When doing debugging dumps, suppress instruction numbers and
12840 address output. This makes it more feasible to use diff on
12841 debugging dumps for compiler invocations with different options, in
12842 particular with and without -g.
12843
12844 -fdump-unnumbered-links
12845 When doing debugging dumps (see -d option above), suppress
12846 instruction numbers for the links to the previous and next
12847 instructions in a sequence.
12848
12849 -fdump-ipa-switch
12850 -fdump-ipa-switch-options
12851 Control the dumping at various stages of inter-procedural analysis
12852 language tree to a file. The file name is generated by appending a
12853 switch specific suffix to the source file name, and the file is
12854 created in the same directory as the output file. The following
12855 dumps are possible:
12856
12857 all Enables all inter-procedural analysis dumps.
12858
12859 cgraph
12860 Dumps information about call-graph optimization, unused
12861 function removal, and inlining decisions.
12862
12863 inline
12864 Dump after function inlining.
12865
12866 Additionally, the options -optimized, -missed, -note, and -all can
12867 be provided, with the same meaning as for -fopt-info, defaulting to
12868 -optimized.
12869
12870 For example, -fdump-ipa-inline-optimized-missed will emit
12871 information on callsites that were inlined, along with callsites
12872 that were not inlined.
12873
12874 By default, the dump will contain messages about successful
12875 optimizations (equivalent to -optimized) together with low-level
12876 details about the analysis.
12877
12878 -fdump-lang-all
12879 -fdump-lang-switch
12880 -fdump-lang-switch-options
12881 -fdump-lang-switch-options=filename
12882 Control the dumping of language-specific information. The options
12883 and filename portions behave as described in the -fdump-tree
12884 option. The following switch values are accepted:
12885
12886 all Enable all language-specific dumps.
12887
12888 class
12889 Dump class hierarchy information. Virtual table information is
12890 emitted unless 'slim' is specified. This option is applicable
12891 to C++ only.
12892
12893 raw Dump the raw internal tree data. This option is applicable to
12894 C++ only.
12895
12896 -fdump-passes
12897 Print on stderr the list of optimization passes that are turned on
12898 and off by the current command-line options.
12899
12900 -fdump-statistics-option
12901 Enable and control dumping of pass statistics in a separate file.
12902 The file name is generated by appending a suffix ending in
12903 .statistics to the source file name, and the file is created in the
12904 same directory as the output file. If the -option form is used,
12905 -stats causes counters to be summed over the whole compilation unit
12906 while -details dumps every event as the passes generate them. The
12907 default with no option is to sum counters for each function
12908 compiled.
12909
12910 -fdump-tree-all
12911 -fdump-tree-switch
12912 -fdump-tree-switch-options
12913 -fdump-tree-switch-options=filename
12914 Control the dumping at various stages of processing the
12915 intermediate language tree to a file. If the -options form is
12916 used, options is a list of - separated options which control the
12917 details of the dump. Not all options are applicable to all dumps;
12918 those that are not meaningful are ignored. The following options
12919 are available
12920
12921 address
12922 Print the address of each node. Usually this is not meaningful
12923 as it changes according to the environment and source file.
12924 Its primary use is for tying up a dump file with a debug
12925 environment.
12926
12927 asmname
12928 If "DECL_ASSEMBLER_NAME" has been set for a given decl, use
12929 that in the dump instead of "DECL_NAME". Its primary use is
12930 ease of use working backward from mangled names in the assembly
12931 file.
12932
12933 slim
12934 When dumping front-end intermediate representations, inhibit
12935 dumping of members of a scope or body of a function merely
12936 because that scope has been reached. Only dump such items when
12937 they are directly reachable by some other path.
12938
12939 When dumping pretty-printed trees, this option inhibits dumping
12940 the bodies of control structures.
12941
12942 When dumping RTL, print the RTL in slim (condensed) form
12943 instead of the default LISP-like representation.
12944
12945 raw Print a raw representation of the tree. By default, trees are
12946 pretty-printed into a C-like representation.
12947
12948 details
12949 Enable more detailed dumps (not honored by every dump option).
12950 Also include information from the optimization passes.
12951
12952 stats
12953 Enable dumping various statistics about the pass (not honored
12954 by every dump option).
12955
12956 blocks
12957 Enable showing basic block boundaries (disabled in raw dumps).
12958
12959 graph
12960 For each of the other indicated dump files (-fdump-rtl-pass),
12961 dump a representation of the control flow graph suitable for
12962 viewing with GraphViz to file.passid.pass.dot. Each function
12963 in the file is pretty-printed as a subgraph, so that GraphViz
12964 can render them all in a single plot.
12965
12966 This option currently only works for RTL dumps, and the RTL is
12967 always dumped in slim form.
12968
12969 vops
12970 Enable showing virtual operands for every statement.
12971
12972 lineno
12973 Enable showing line numbers for statements.
12974
12975 uid Enable showing the unique ID ("DECL_UID") for each variable.
12976
12977 verbose
12978 Enable showing the tree dump for each statement.
12979
12980 eh Enable showing the EH region number holding each statement.
12981
12982 scev
12983 Enable showing scalar evolution analysis details.
12984
12985 optimized
12986 Enable showing optimization information (only available in
12987 certain passes).
12988
12989 missed
12990 Enable showing missed optimization information (only available
12991 in certain passes).
12992
12993 note
12994 Enable other detailed optimization information (only available
12995 in certain passes).
12996
12997 all Turn on all options, except raw, slim, verbose and lineno.
12998
12999 optall
13000 Turn on all optimization options, i.e., optimized, missed, and
13001 note.
13002
13003 To determine what tree dumps are available or find the dump for a
13004 pass of interest follow the steps below.
13005
13006 1. Invoke GCC with -fdump-passes and in the stderr output look for
13007 a code that corresponds to the pass you are interested in. For
13008 example, the codes "tree-evrp", "tree-vrp1", and "tree-vrp2"
13009 correspond to the three Value Range Propagation passes. The
13010 number at the end distinguishes distinct invocations of the
13011 same pass.
13012
13013 2. To enable the creation of the dump file, append the pass code
13014 to the -fdump- option prefix and invoke GCC with it. For
13015 example, to enable the dump from the Early Value Range
13016 Propagation pass, invoke GCC with the -fdump-tree-evrp option.
13017 Optionally, you may specify the name of the dump file. If you
13018 don't specify one, GCC creates as described below.
13019
13020 3. Find the pass dump in a file whose name is composed of three
13021 components separated by a period: the name of the source file
13022 GCC was invoked to compile, a numeric suffix indicating the
13023 pass number followed by the letter t for tree passes (and the
13024 letter r for RTL passes), and finally the pass code. For
13025 example, the Early VRP pass dump might be in a file named
13026 myfile.c.038t.evrp in the current working directory. Note that
13027 the numeric codes are not stable and may change from one
13028 version of GCC to another.
13029
13030 -fopt-info
13031 -fopt-info-options
13032 -fopt-info-options=filename
13033 Controls optimization dumps from various optimization passes. If
13034 the -options form is used, options is a list of - separated option
13035 keywords to select the dump details and optimizations.
13036
13037 The options can be divided into three groups:
13038
13039 1. options describing what kinds of messages should be emitted,
13040
13041 2. options describing the verbosity of the dump, and
13042
13043 3. options describing which optimizations should be included.
13044
13045 The options from each group can be freely mixed as they are non-
13046 overlapping. However, in case of any conflicts, the later options
13047 override the earlier options on the command line.
13048
13049 The following options control which kinds of messages should be
13050 emitted:
13051
13052 optimized
13053 Print information when an optimization is successfully applied.
13054 It is up to a pass to decide which information is relevant. For
13055 example, the vectorizer passes print the source location of
13056 loops which are successfully vectorized.
13057
13058 missed
13059 Print information about missed optimizations. Individual passes
13060 control which information to include in the output.
13061
13062 note
13063 Print verbose information about optimizations, such as certain
13064 transformations, more detailed messages about decisions etc.
13065
13066 all Print detailed optimization information. This includes
13067 optimized, missed, and note.
13068
13069 The following option controls the dump verbosity:
13070
13071 internals
13072 By default, only "high-level" messages are emitted. This option
13073 enables additional, more detailed, messages, which are likely
13074 to only be of interest to GCC developers.
13075
13076 One or more of the following option keywords can be used to
13077 describe a group of optimizations:
13078
13079 ipa Enable dumps from all interprocedural optimizations.
13080
13081 loop
13082 Enable dumps from all loop optimizations.
13083
13084 inline
13085 Enable dumps from all inlining optimizations.
13086
13087 omp Enable dumps from all OMP (Offloading and Multi Processing)
13088 optimizations.
13089
13090 vec Enable dumps from all vectorization optimizations.
13091
13092 optall
13093 Enable dumps from all optimizations. This is a superset of the
13094 optimization groups listed above.
13095
13096 If options is omitted, it defaults to optimized-optall, which means
13097 to dump messages about successful optimizations from all the
13098 passes, omitting messages that are treated as "internals".
13099
13100 If the filename is provided, then the dumps from all the applicable
13101 optimizations are concatenated into the filename. Otherwise the
13102 dump is output onto stderr. Though multiple -fopt-info options are
13103 accepted, only one of them can include a filename. If other
13104 filenames are provided then all but the first such option are
13105 ignored.
13106
13107 Note that the output filename is overwritten in case of multiple
13108 translation units. If a combined output from multiple translation
13109 units is desired, stderr should be used instead.
13110
13111 In the following example, the optimization info is output to
13112 stderr:
13113
13114 gcc -O3 -fopt-info
13115
13116 This example:
13117
13118 gcc -O3 -fopt-info-missed=missed.all
13119
13120 outputs missed optimization report from all the passes into
13121 missed.all, and this one:
13122
13123 gcc -O2 -ftree-vectorize -fopt-info-vec-missed
13124
13125 prints information about missed optimization opportunities from
13126 vectorization passes on stderr. Note that -fopt-info-vec-missed is
13127 equivalent to -fopt-info-missed-vec. The order of the optimization
13128 group names and message types listed after -fopt-info does not
13129 matter.
13130
13131 As another example,
13132
13133 gcc -O3 -fopt-info-inline-optimized-missed=inline.txt
13134
13135 outputs information about missed optimizations as well as optimized
13136 locations from all the inlining passes into inline.txt.
13137
13138 Finally, consider:
13139
13140 gcc -fopt-info-vec-missed=vec.miss -fopt-info-loop-optimized=loop.opt
13141
13142 Here the two output filenames vec.miss and loop.opt are in conflict
13143 since only one output file is allowed. In this case, only the first
13144 option takes effect and the subsequent options are ignored. Thus
13145 only vec.miss is produced which contains dumps from the vectorizer
13146 about missed opportunities.
13147
13148 -fsave-optimization-record
13149 Write a SRCFILE.opt-record.json.gz file detailing what
13150 optimizations were performed, for those optimizations that support
13151 -fopt-info.
13152
13153 This option is experimental and the format of the data within the
13154 compressed JSON file is subject to change.
13155
13156 It is roughly equivalent to a machine-readable version of
13157 -fopt-info-all, as a collection of messages with source file, line
13158 number and column number, with the following additional data for
13159 each message:
13160
13161 * the execution count of the code being optimized, along with
13162 metadata about whether this was from actual profile data, or
13163 just an estimate, allowing consumers to prioritize messages by
13164 code hotness,
13165
13166 * the function name of the code being optimized, where
13167 applicable,
13168
13169 * the "inlining chain" for the code being optimized, so that when
13170 a function is inlined into several different places (which
13171 might themselves be inlined), the reader can distinguish
13172 between the copies,
13173
13174 * objects identifying those parts of the message that refer to
13175 expressions, statements or symbol-table nodes, which of these
13176 categories they are, and, when available, their source code
13177 location,
13178
13179 * the GCC pass that emitted the message, and
13180
13181 * the location in GCC's own code from which the message was
13182 emitted
13183
13184 Additionally, some messages are logically nested within other
13185 messages, reflecting implementation details of the optimization
13186 passes.
13187
13188 -fsched-verbose=n
13189 On targets that use instruction scheduling, this option controls
13190 the amount of debugging output the scheduler prints to the dump
13191 files.
13192
13193 For n greater than zero, -fsched-verbose outputs the same
13194 information as -fdump-rtl-sched1 and -fdump-rtl-sched2. For n
13195 greater than one, it also output basic block probabilities,
13196 detailed ready list information and unit/insn info. For n greater
13197 than two, it includes RTL at abort point, control-flow and regions
13198 info. And for n over four, -fsched-verbose also includes
13199 dependence info.
13200
13201 -fenable-kind-pass
13202 -fdisable-kind-pass=range-list
13203 This is a set of options that are used to explicitly disable/enable
13204 optimization passes. These options are intended for use for
13205 debugging GCC. Compiler users should use regular options for
13206 enabling/disabling passes instead.
13207
13208 -fdisable-ipa-pass
13209 Disable IPA pass pass. pass is the pass name. If the same pass
13210 is statically invoked in the compiler multiple times, the pass
13211 name should be appended with a sequential number starting from
13212 1.
13213
13214 -fdisable-rtl-pass
13215 -fdisable-rtl-pass=range-list
13216 Disable RTL pass pass. pass is the pass name. If the same
13217 pass is statically invoked in the compiler multiple times, the
13218 pass name should be appended with a sequential number starting
13219 from 1. range-list is a comma-separated list of function
13220 ranges or assembler names. Each range is a number pair
13221 separated by a colon. The range is inclusive in both ends. If
13222 the range is trivial, the number pair can be simplified as a
13223 single number. If the function's call graph node's uid falls
13224 within one of the specified ranges, the pass is disabled for
13225 that function. The uid is shown in the function header of a
13226 dump file, and the pass names can be dumped by using option
13227 -fdump-passes.
13228
13229 -fdisable-tree-pass
13230 -fdisable-tree-pass=range-list
13231 Disable tree pass pass. See -fdisable-rtl for the description
13232 of option arguments.
13233
13234 -fenable-ipa-pass
13235 Enable IPA pass pass. pass is the pass name. If the same pass
13236 is statically invoked in the compiler multiple times, the pass
13237 name should be appended with a sequential number starting from
13238 1.
13239
13240 -fenable-rtl-pass
13241 -fenable-rtl-pass=range-list
13242 Enable RTL pass pass. See -fdisable-rtl for option argument
13243 description and examples.
13244
13245 -fenable-tree-pass
13246 -fenable-tree-pass=range-list
13247 Enable tree pass pass. See -fdisable-rtl for the description
13248 of option arguments.
13249
13250 Here are some examples showing uses of these options.
13251
13252 # disable ccp1 for all functions
13253 -fdisable-tree-ccp1
13254 # disable complete unroll for function whose cgraph node uid is 1
13255 -fenable-tree-cunroll=1
13256 # disable gcse2 for functions at the following ranges [1,1],
13257 # [300,400], and [400,1000]
13258 # disable gcse2 for functions foo and foo2
13259 -fdisable-rtl-gcse2=foo,foo2
13260 # disable early inlining
13261 -fdisable-tree-einline
13262 # disable ipa inlining
13263 -fdisable-ipa-inline
13264 # enable tree full unroll
13265 -fenable-tree-unroll
13266
13267 -fchecking
13268 -fchecking=n
13269 Enable internal consistency checking. The default depends on the
13270 compiler configuration. -fchecking=2 enables further internal
13271 consistency checking that might affect code generation.
13272
13273 -frandom-seed=string
13274 This option provides a seed that GCC uses in place of random
13275 numbers in generating certain symbol names that have to be
13276 different in every compiled file. It is also used to place unique
13277 stamps in coverage data files and the object files that produce
13278 them. You can use the -frandom-seed option to produce reproducibly
13279 identical object files.
13280
13281 The string can either be a number (decimal, octal or hex) or an
13282 arbitrary string (in which case it's converted to a number by
13283 computing CRC32).
13284
13285 The string should be different for every file you compile.
13286
13287 -save-temps
13288 -save-temps=cwd
13289 Store the usual "temporary" intermediate files permanently; place
13290 them in the current directory and name them based on the source
13291 file. Thus, compiling foo.c with -c -save-temps produces files
13292 foo.i and foo.s, as well as foo.o. This creates a preprocessed
13293 foo.i output file even though the compiler now normally uses an
13294 integrated preprocessor.
13295
13296 When used in combination with the -x command-line option,
13297 -save-temps is sensible enough to avoid over writing an input
13298 source file with the same extension as an intermediate file. The
13299 corresponding intermediate file may be obtained by renaming the
13300 source file before using -save-temps.
13301
13302 If you invoke GCC in parallel, compiling several different source
13303 files that share a common base name in different subdirectories or
13304 the same source file compiled for multiple output destinations, it
13305 is likely that the different parallel compilers will interfere with
13306 each other, and overwrite the temporary files. For instance:
13307
13308 gcc -save-temps -o outdir1/foo.o indir1/foo.c&
13309 gcc -save-temps -o outdir2/foo.o indir2/foo.c&
13310
13311 may result in foo.i and foo.o being written to simultaneously by
13312 both compilers.
13313
13314 -save-temps=obj
13315 Store the usual "temporary" intermediate files permanently. If the
13316 -o option is used, the temporary files are based on the object
13317 file. If the -o option is not used, the -save-temps=obj switch
13318 behaves like -save-temps.
13319
13320 For example:
13321
13322 gcc -save-temps=obj -c foo.c
13323 gcc -save-temps=obj -c bar.c -o dir/xbar.o
13324 gcc -save-temps=obj foobar.c -o dir2/yfoobar
13325
13326 creates foo.i, foo.s, dir/xbar.i, dir/xbar.s, dir2/yfoobar.i,
13327 dir2/yfoobar.s, and dir2/yfoobar.o.
13328
13329 -time[=file]
13330 Report the CPU time taken by each subprocess in the compilation
13331 sequence. For C source files, this is the compiler proper and
13332 assembler (plus the linker if linking is done).
13333
13334 Without the specification of an output file, the output looks like
13335 this:
13336
13337 # cc1 0.12 0.01
13338 # as 0.00 0.01
13339
13340 The first number on each line is the "user time", that is time
13341 spent executing the program itself. The second number is "system
13342 time", time spent executing operating system routines on behalf of
13343 the program. Both numbers are in seconds.
13344
13345 With the specification of an output file, the output is appended to
13346 the named file, and it looks like this:
13347
13348 0.12 0.01 cc1 <options>
13349 0.00 0.01 as <options>
13350
13351 The "user time" and the "system time" are moved before the program
13352 name, and the options passed to the program are displayed, so that
13353 one can later tell what file was being compiled, and with which
13354 options.
13355
13356 -fdump-final-insns[=file]
13357 Dump the final internal representation (RTL) to file. If the
13358 optional argument is omitted (or if file is "."), the name of the
13359 dump file is determined by appending ".gkd" to the compilation
13360 output file name.
13361
13362 -fcompare-debug[=opts]
13363 If no error occurs during compilation, run the compiler a second
13364 time, adding opts and -fcompare-debug-second to the arguments
13365 passed to the second compilation. Dump the final internal
13366 representation in both compilations, and print an error if they
13367 differ.
13368
13369 If the equal sign is omitted, the default -gtoggle is used.
13370
13371 The environment variable GCC_COMPARE_DEBUG, if defined, non-empty
13372 and nonzero, implicitly enables -fcompare-debug. If
13373 GCC_COMPARE_DEBUG is defined to a string starting with a dash, then
13374 it is used for opts, otherwise the default -gtoggle is used.
13375
13376 -fcompare-debug=, with the equal sign but without opts, is
13377 equivalent to -fno-compare-debug, which disables the dumping of the
13378 final representation and the second compilation, preventing even
13379 GCC_COMPARE_DEBUG from taking effect.
13380
13381 To verify full coverage during -fcompare-debug testing, set
13382 GCC_COMPARE_DEBUG to say -fcompare-debug-not-overridden, which GCC
13383 rejects as an invalid option in any actual compilation (rather than
13384 preprocessing, assembly or linking). To get just a warning,
13385 setting GCC_COMPARE_DEBUG to -w%n-fcompare-debug not overridden
13386 will do.
13387
13388 -fcompare-debug-second
13389 This option is implicitly passed to the compiler for the second
13390 compilation requested by -fcompare-debug, along with options to
13391 silence warnings, and omitting other options that would cause the
13392 compiler to produce output to files or to standard output as a side
13393 effect. Dump files and preserved temporary files are renamed so as
13394 to contain the ".gk" additional extension during the second
13395 compilation, to avoid overwriting those generated by the first.
13396
13397 When this option is passed to the compiler driver, it causes the
13398 first compilation to be skipped, which makes it useful for little
13399 other than debugging the compiler proper.
13400
13401 -gtoggle
13402 Turn off generation of debug info, if leaving out this option
13403 generates it, or turn it on at level 2 otherwise. The position of
13404 this argument in the command line does not matter; it takes effect
13405 after all other options are processed, and it does so only once, no
13406 matter how many times it is given. This is mainly intended to be
13407 used with -fcompare-debug.
13408
13409 -fvar-tracking-assignments-toggle
13410 Toggle -fvar-tracking-assignments, in the same way that -gtoggle
13411 toggles -g.
13412
13413 -Q Makes the compiler print out each function name as it is compiled,
13414 and print some statistics about each pass when it finishes.
13415
13416 -ftime-report
13417 Makes the compiler print some statistics about the time consumed by
13418 each pass when it finishes.
13419
13420 -ftime-report-details
13421 Record the time consumed by infrastructure parts separately for
13422 each pass.
13423
13424 -fira-verbose=n
13425 Control the verbosity of the dump file for the integrated register
13426 allocator. The default value is 5. If the value n is greater or
13427 equal to 10, the dump output is sent to stderr using the same
13428 format as n minus 10.
13429
13430 -flto-report
13431 Prints a report with internal details on the workings of the link-
13432 time optimizer. The contents of this report vary from version to
13433 version. It is meant to be useful to GCC developers when
13434 processing object files in LTO mode (via -flto).
13435
13436 Disabled by default.
13437
13438 -flto-report-wpa
13439 Like -flto-report, but only print for the WPA phase of Link Time
13440 Optimization.
13441
13442 -fmem-report
13443 Makes the compiler print some statistics about permanent memory
13444 allocation when it finishes.
13445
13446 -fmem-report-wpa
13447 Makes the compiler print some statistics about permanent memory
13448 allocation for the WPA phase only.
13449
13450 -fpre-ipa-mem-report
13451 -fpost-ipa-mem-report
13452 Makes the compiler print some statistics about permanent memory
13453 allocation before or after interprocedural optimization.
13454
13455 -fprofile-report
13456 Makes the compiler print some statistics about consistency of the
13457 (estimated) profile and effect of individual passes.
13458
13459 -fstack-usage
13460 Makes the compiler output stack usage information for the program,
13461 on a per-function basis. The filename for the dump is made by
13462 appending .su to the auxname. auxname is generated from the name
13463 of the output file, if explicitly specified and it is not an
13464 executable, otherwise it is the basename of the source file. An
13465 entry is made up of three fields:
13466
13467 * The name of the function.
13468
13469 * A number of bytes.
13470
13471 * One or more qualifiers: "static", "dynamic", "bounded".
13472
13473 The qualifier "static" means that the function manipulates the
13474 stack statically: a fixed number of bytes are allocated for the
13475 frame on function entry and released on function exit; no stack
13476 adjustments are otherwise made in the function. The second field
13477 is this fixed number of bytes.
13478
13479 The qualifier "dynamic" means that the function manipulates the
13480 stack dynamically: in addition to the static allocation described
13481 above, stack adjustments are made in the body of the function, for
13482 example to push/pop arguments around function calls. If the
13483 qualifier "bounded" is also present, the amount of these
13484 adjustments is bounded at compile time and the second field is an
13485 upper bound of the total amount of stack used by the function. If
13486 it is not present, the amount of these adjustments is not bounded
13487 at compile time and the second field only represents the bounded
13488 part.
13489
13490 -fstats
13491 Emit statistics about front-end processing at the end of the
13492 compilation. This option is supported only by the C++ front end,
13493 and the information is generally only useful to the G++ development
13494 team.
13495
13496 -fdbg-cnt-list
13497 Print the name and the counter upper bound for all debug counters.
13498
13499 -fdbg-cnt=counter-value-list
13500 Set the internal debug counter lower and upper bound. counter-
13501 value-list is a comma-separated list of
13502 name:lower_bound:upper_bound tuples which sets the lower and the
13503 upper bound of each debug counter name. The lower_bound is
13504 optional and is zero initialized if not set. All debug counters
13505 have the initial upper bound of "UINT_MAX"; thus "dbg_cnt" returns
13506 true always unless the upper bound is set by this option. For
13507 example, with -fdbg-cnt=dce:2:4,tail_call:10, "dbg_cnt(dce)"
13508 returns true only for third and fourth invocation. For
13509 "dbg_cnt(tail_call)" true is returned for first 10 invocations.
13510
13511 -print-file-name=library
13512 Print the full absolute name of the library file library that would
13513 be used when linking---and don't do anything else. With this
13514 option, GCC does not compile or link anything; it just prints the
13515 file name.
13516
13517 -print-multi-directory
13518 Print the directory name corresponding to the multilib selected by
13519 any other switches present in the command line. This directory is
13520 supposed to exist in GCC_EXEC_PREFIX.
13521
13522 -print-multi-lib
13523 Print the mapping from multilib directory names to compiler
13524 switches that enable them. The directory name is separated from
13525 the switches by ;, and each switch starts with an @ instead of the
13526 -, without spaces between multiple switches. This is supposed to
13527 ease shell processing.
13528
13529 -print-multi-os-directory
13530 Print the path to OS libraries for the selected multilib, relative
13531 to some lib subdirectory. If OS libraries are present in the lib
13532 subdirectory and no multilibs are used, this is usually just ., if
13533 OS libraries are present in libsuffix sibling directories this
13534 prints e.g. ../lib64, ../lib or ../lib32, or if OS libraries are
13535 present in lib/subdir subdirectories it prints e.g. amd64, sparcv9
13536 or ev6.
13537
13538 -print-multiarch
13539 Print the path to OS libraries for the selected multiarch, relative
13540 to some lib subdirectory.
13541
13542 -print-prog-name=program
13543 Like -print-file-name, but searches for a program such as cpp.
13544
13545 -print-libgcc-file-name
13546 Same as -print-file-name=libgcc.a.
13547
13548 This is useful when you use -nostdlib or -nodefaultlibs but you do
13549 want to link with libgcc.a. You can do:
13550
13551 gcc -nostdlib <files>... `gcc -print-libgcc-file-name`
13552
13553 -print-search-dirs
13554 Print the name of the configured installation directory and a list
13555 of program and library directories gcc searches---and don't do
13556 anything else.
13557
13558 This is useful when gcc prints the error message installation
13559 problem, cannot exec cpp0: No such file or directory. To resolve
13560 this you either need to put cpp0 and the other compiler components
13561 where gcc expects to find them, or you can set the environment
13562 variable GCC_EXEC_PREFIX to the directory where you installed them.
13563 Don't forget the trailing /.
13564
13565 -print-sysroot
13566 Print the target sysroot directory that is used during compilation.
13567 This is the target sysroot specified either at configure time or
13568 using the --sysroot option, possibly with an extra suffix that
13569 depends on compilation options. If no target sysroot is specified,
13570 the option prints nothing.
13571
13572 -print-sysroot-headers-suffix
13573 Print the suffix added to the target sysroot when searching for
13574 headers, or give an error if the compiler is not configured with
13575 such a suffix---and don't do anything else.
13576
13577 -dumpmachine
13578 Print the compiler's target machine (for example,
13579 i686-pc-linux-gnu)---and don't do anything else.
13580
13581 -dumpversion
13582 Print the compiler version (for example, 3.0, 6.3.0 or 7)---and
13583 don't do anything else. This is the compiler version used in
13584 filesystem paths and specs. Depending on how the compiler has been
13585 configured it can be just a single number (major version), two
13586 numbers separated by a dot (major and minor version) or three
13587 numbers separated by dots (major, minor and patchlevel version).
13588
13589 -dumpfullversion
13590 Print the full compiler version---and don't do anything else. The
13591 output is always three numbers separated by dots, major, minor and
13592 patchlevel version.
13593
13594 -dumpspecs
13595 Print the compiler's built-in specs---and don't do anything else.
13596 (This is used when GCC itself is being built.)
13597
13598 Machine-Dependent Options
13599 Each target machine supported by GCC can have its own options---for
13600 example, to allow you to compile for a particular processor variant or
13601 ABI, or to control optimizations specific to that machine. By
13602 convention, the names of machine-specific options start with -m.
13603
13604 Some configurations of the compiler also support additional target-
13605 specific options, usually for compatibility with other compilers on the
13606 same platform.
13607
13608 AArch64 Options
13609 These options are defined for AArch64 implementations:
13610
13611 -mabi=name
13612 Generate code for the specified data model. Permissible values are
13613 ilp32 for SysV-like data model where int, long int and pointers are
13614 32 bits, and lp64 for SysV-like data model where int is 32 bits,
13615 but long int and pointers are 64 bits.
13616
13617 The default depends on the specific target configuration. Note
13618 that the LP64 and ILP32 ABIs are not link-compatible; you must
13619 compile your entire program with the same ABI, and link with a
13620 compatible set of libraries.
13621
13622 -mbig-endian
13623 Generate big-endian code. This is the default when GCC is
13624 configured for an aarch64_be-*-* target.
13625
13626 -mgeneral-regs-only
13627 Generate code which uses only the general-purpose registers. This
13628 will prevent the compiler from using floating-point and Advanced
13629 SIMD registers but will not impose any restrictions on the
13630 assembler.
13631
13632 -mlittle-endian
13633 Generate little-endian code. This is the default when GCC is
13634 configured for an aarch64-*-* but not an aarch64_be-*-* target.
13635
13636 -mcmodel=tiny
13637 Generate code for the tiny code model. The program and its
13638 statically defined symbols must be within 1MB of each other.
13639 Programs can be statically or dynamically linked.
13640
13641 -mcmodel=small
13642 Generate code for the small code model. The program and its
13643 statically defined symbols must be within 4GB of each other.
13644 Programs can be statically or dynamically linked. This is the
13645 default code model.
13646
13647 -mcmodel=large
13648 Generate code for the large code model. This makes no assumptions
13649 about addresses and sizes of sections. Programs can be statically
13650 linked only.
13651
13652 -mstrict-align
13653 -mno-strict-align
13654 Avoid or allow generating memory accesses that may not be aligned
13655 on a natural object boundary as described in the architecture
13656 specification.
13657
13658 -momit-leaf-frame-pointer
13659 -mno-omit-leaf-frame-pointer
13660 Omit or keep the frame pointer in leaf functions. The former
13661 behavior is the default.
13662
13663 -mstack-protector-guard=guard
13664 -mstack-protector-guard-reg=reg
13665 -mstack-protector-guard-offset=offset
13666 Generate stack protection code using canary at guard. Supported
13667 locations are global for a global canary or sysreg for a canary in
13668 an appropriate system register.
13669
13670 With the latter choice the options -mstack-protector-guard-reg=reg
13671 and -mstack-protector-guard-offset=offset furthermore specify which
13672 system register to use as base register for reading the canary, and
13673 from what offset from that base register. There is no default
13674 register or offset as this is entirely for use within the Linux
13675 kernel.
13676
13677 -mstack-protector-guard=guard
13678 -mstack-protector-guard-reg=reg
13679 -mstack-protector-guard-offset=offset
13680 Generate stack protection code using canary at guard. Supported
13681 locations are global for a global canary or sysreg for a canary in
13682 an appropriate system register.
13683
13684 With the latter choice the options -mstack-protector-guard-reg=reg
13685 and -mstack-protector-guard-offset=offset furthermore specify which
13686 system register to use as base register for reading the canary, and
13687 from what offset from that base register. There is no default
13688 register or offset as this is entirely for use within the Linux
13689 kernel.
13690
13691 -mtls-dialect=desc
13692 Use TLS descriptors as the thread-local storage mechanism for
13693 dynamic accesses of TLS variables. This is the default.
13694
13695 -mtls-dialect=traditional
13696 Use traditional TLS as the thread-local storage mechanism for
13697 dynamic accesses of TLS variables.
13698
13699 -mtls-size=size
13700 Specify bit size of immediate TLS offsets. Valid values are 12,
13701 24, 32, 48. This option requires binutils 2.26 or newer.
13702
13703 -mfix-cortex-a53-835769
13704 -mno-fix-cortex-a53-835769
13705 Enable or disable the workaround for the ARM Cortex-A53 erratum
13706 number 835769. This involves inserting a NOP instruction between
13707 memory instructions and 64-bit integer multiply-accumulate
13708 instructions.
13709
13710 -mfix-cortex-a53-843419
13711 -mno-fix-cortex-a53-843419
13712 Enable or disable the workaround for the ARM Cortex-A53 erratum
13713 number 843419. This erratum workaround is made at link time and
13714 this will only pass the corresponding flag to the linker.
13715
13716 -mlow-precision-recip-sqrt
13717 -mno-low-precision-recip-sqrt
13718 Enable or disable the reciprocal square root approximation. This
13719 option only has an effect if -ffast-math or
13720 -funsafe-math-optimizations is used as well. Enabling this reduces
13721 precision of reciprocal square root results to about 16 bits for
13722 single precision and to 32 bits for double precision.
13723
13724 -mlow-precision-sqrt
13725 -mno-low-precision-sqrt
13726 Enable or disable the square root approximation. This option only
13727 has an effect if -ffast-math or -funsafe-math-optimizations is used
13728 as well. Enabling this reduces precision of square root results to
13729 about 16 bits for single precision and to 32 bits for double
13730 precision. If enabled, it implies -mlow-precision-recip-sqrt.
13731
13732 -mlow-precision-div
13733 -mno-low-precision-div
13734 Enable or disable the division approximation. This option only has
13735 an effect if -ffast-math or -funsafe-math-optimizations is used as
13736 well. Enabling this reduces precision of division results to about
13737 16 bits for single precision and to 32 bits for double precision.
13738
13739 -mtrack-speculation
13740 -mno-track-speculation
13741 Enable or disable generation of additional code to track
13742 speculative execution through conditional branches. The tracking
13743 state can then be used by the compiler when expanding calls to
13744 "__builtin_speculation_safe_copy" to permit a more efficient code
13745 sequence to be generated.
13746
13747 -march=name
13748 Specify the name of the target architecture and, optionally, one or
13749 more feature modifiers. This option has the form
13750 -march=arch{+[no]feature}*.
13751
13752 The permissible values for arch are armv8-a, armv8.1-a, armv8.2-a,
13753 armv8.3-a, armv8.4-a, armv8.5-a or native.
13754
13755 The value armv8.5-a implies armv8.4-a and enables compiler support
13756 for the ARMv8.5-A architecture extensions.
13757
13758 The value armv8.4-a implies armv8.3-a and enables compiler support
13759 for the ARMv8.4-A architecture extensions.
13760
13761 The value armv8.3-a implies armv8.2-a and enables compiler support
13762 for the ARMv8.3-A architecture extensions.
13763
13764 The value armv8.2-a implies armv8.1-a and enables compiler support
13765 for the ARMv8.2-A architecture extensions.
13766
13767 The value armv8.1-a implies armv8-a and enables compiler support
13768 for the ARMv8.1-A architecture extension. In particular, it
13769 enables the +crc, +lse, and +rdma features.
13770
13771 The value native is available on native AArch64 GNU/Linux and
13772 causes the compiler to pick the architecture of the host system.
13773 This option has no effect if the compiler is unable to recognize
13774 the architecture of the host system,
13775
13776 The permissible values for feature are listed in the sub-section on
13777 aarch64-feature-modifiers,,-march and -mcpu Feature Modifiers.
13778 Where conflicting feature modifiers are specified, the right-most
13779 feature is used.
13780
13781 GCC uses name to determine what kind of instructions it can emit
13782 when generating assembly code. If -march is specified without
13783 either of -mtune or -mcpu also being specified, the code is tuned
13784 to perform well across a range of target processors implementing
13785 the target architecture.
13786
13787 -mtune=name
13788 Specify the name of the target processor for which GCC should tune
13789 the performance of the code. Permissible values for this option
13790 are: generic, cortex-a35, cortex-a53, cortex-a55, cortex-a57,
13791 cortex-a72, cortex-a73, cortex-a75, cortex-a76, ares, exynos-m1,
13792 emag, falkor, neoverse-e1,neoverse-n1,qdf24xx, saphira, phecda,
13793 xgene1, vulcan, octeontx, octeontx81, octeontx83, thunderx,
13794 thunderxt88, thunderxt88p1, thunderxt81, tsv110, thunderxt83,
13795 thunderx2t99, cortex-a57.cortex-a53, cortex-a72.cortex-a53,
13796 cortex-a73.cortex-a35, cortex-a73.cortex-a53,
13797 cortex-a75.cortex-a55, cortex-a76.cortex-a55 native.
13798
13799 The values cortex-a57.cortex-a53, cortex-a72.cortex-a53,
13800 cortex-a73.cortex-a35, cortex-a73.cortex-a53,
13801 cortex-a75.cortex-a55, cortex-a76.cortex-a55 specify that GCC
13802 should tune for a big.LITTLE system.
13803
13804 Additionally on native AArch64 GNU/Linux systems the value native
13805 tunes performance to the host system. This option has no effect if
13806 the compiler is unable to recognize the processor of the host
13807 system.
13808
13809 Where none of -mtune=, -mcpu= or -march= are specified, the code is
13810 tuned to perform well across a range of target processors.
13811
13812 This option cannot be suffixed by feature modifiers.
13813
13814 -mcpu=name
13815 Specify the name of the target processor, optionally suffixed by
13816 one or more feature modifiers. This option has the form
13817 -mcpu=cpu{+[no]feature}*, where the permissible values for cpu are
13818 the same as those available for -mtune. The permissible values for
13819 feature are documented in the sub-section on
13820 aarch64-feature-modifiers,,-march and -mcpu Feature Modifiers.
13821 Where conflicting feature modifiers are specified, the right-most
13822 feature is used.
13823
13824 GCC uses name to determine what kind of instructions it can emit
13825 when generating assembly code (as if by -march) and to determine
13826 the target processor for which to tune for performance (as if by
13827 -mtune). Where this option is used in conjunction with -march or
13828 -mtune, those options take precedence over the appropriate part of
13829 this option.
13830
13831 -moverride=string
13832 Override tuning decisions made by the back-end in response to a
13833 -mtune= switch. The syntax, semantics, and accepted values for
13834 string in this option are not guaranteed to be consistent across
13835 releases.
13836
13837 This option is only intended to be useful when developing GCC.
13838
13839 -mverbose-cost-dump
13840 Enable verbose cost model dumping in the debug dump files. This
13841 option is provided for use in debugging the compiler.
13842
13843 -mpc-relative-literal-loads
13844 -mno-pc-relative-literal-loads
13845 Enable or disable PC-relative literal loads. With this option
13846 literal pools are accessed using a single instruction and emitted
13847 after each function. This limits the maximum size of functions to
13848 1MB. This is enabled by default for -mcmodel=tiny.
13849
13850 -msign-return-address=scope
13851 Select the function scope on which return address signing will be
13852 applied. Permissible values are none, which disables return
13853 address signing, non-leaf, which enables pointer signing for
13854 functions which are not leaf functions, and all, which enables
13855 pointer signing for all functions. The default value is none. This
13856 option has been deprecated by -mbranch-protection.
13857
13858 -mbranch-protection=none|standard|pac-ret[+leaf]|bti
13859 Select the branch protection features to use. none is the default
13860 and turns off all types of branch protection. standard turns on
13861 all types of branch protection features. If a feature has
13862 additional tuning options, then standard sets it to its standard
13863 level. pac-ret[+leaf] turns on return address signing to its
13864 standard level: signing functions that save the return address to
13865 memory (non-leaf functions will practically always do this) using
13866 the a-key. The optional argument leaf can be used to extend the
13867 signing to include leaf functions. bti turns on branch target
13868 identification mechanism.
13869
13870 -msve-vector-bits=bits
13871 Specify the number of bits in an SVE vector register. This option
13872 only has an effect when SVE is enabled.
13873
13874 GCC supports two forms of SVE code generation: "vector-length
13875 agnostic" output that works with any size of vector register and
13876 "vector-length specific" output that allows GCC to make assumptions
13877 about the vector length when it is useful for optimization reasons.
13878 The possible values of bits are: scalable, 128, 256, 512, 1024 and
13879 2048. Specifying scalable selects vector-length agnostic output.
13880 At present -msve-vector-bits=128 also generates vector-length
13881 agnostic output. All other values generate vector-length specific
13882 code. The behavior of these values may change in future releases
13883 and no value except scalable should be relied on for producing code
13884 that is portable across different hardware SVE vector lengths.
13885
13886 The default is -msve-vector-bits=scalable, which produces vector-
13887 length agnostic code.
13888
13889 -march and -mcpu Feature Modifiers
13890
13891 Feature modifiers used with -march and -mcpu can be any of the
13892 following and their inverses nofeature:
13893
13894 crc Enable CRC extension. This is on by default for -march=armv8.1-a.
13895
13896 crypto
13897 Enable Crypto extension. This also enables Advanced SIMD and
13898 floating-point instructions.
13899
13900 fp Enable floating-point instructions. This is on by default for all
13901 possible values for options -march and -mcpu.
13902
13903 simd
13904 Enable Advanced SIMD instructions. This also enables floating-
13905 point instructions. This is on by default for all possible values
13906 for options -march and -mcpu.
13907
13908 sve Enable Scalable Vector Extension instructions. This also enables
13909 Advanced SIMD and floating-point instructions.
13910
13911 lse Enable Large System Extension instructions. This is on by default
13912 for -march=armv8.1-a.
13913
13914 rdma
13915 Enable Round Double Multiply Accumulate instructions. This is on
13916 by default for -march=armv8.1-a.
13917
13918 fp16
13919 Enable FP16 extension. This also enables floating-point
13920 instructions.
13921
13922 fp16fml
13923 Enable FP16 fmla extension. This also enables FP16 extensions and
13924 floating-point instructions. This option is enabled by default for
13925 -march=armv8.4-a. Use of this option with architectures prior to
13926 Armv8.2-A is not supported.
13927
13928 rcpc
13929 Enable the RcPc extension. This does not change code generation
13930 from GCC, but is passed on to the assembler, enabling inline asm
13931 statements to use instructions from the RcPc extension.
13932
13933 dotprod
13934 Enable the Dot Product extension. This also enables Advanced SIMD
13935 instructions.
13936
13937 aes Enable the Armv8-a aes and pmull crypto extension. This also
13938 enables Advanced SIMD instructions.
13939
13940 sha2
13941 Enable the Armv8-a sha2 crypto extension. This also enables
13942 Advanced SIMD instructions.
13943
13944 sha3
13945 Enable the sha512 and sha3 crypto extension. This also enables
13946 Advanced SIMD instructions. Use of this option with architectures
13947 prior to Armv8.2-A is not supported.
13948
13949 sm4 Enable the sm3 and sm4 crypto extension. This also enables
13950 Advanced SIMD instructions. Use of this option with architectures
13951 prior to Armv8.2-A is not supported.
13952
13953 profile
13954 Enable the Statistical Profiling extension. This option is only to
13955 enable the extension at the assembler level and does not affect
13956 code generation.
13957
13958 rng Enable the Armv8.5-a Random Number instructions. This option is
13959 only to enable the extension at the assembler level and does not
13960 affect code generation.
13961
13962 memtag
13963 Enable the Armv8.5-a Memory Tagging Extensions. This option is
13964 only to enable the extension at the assembler level and does not
13965 affect code generation.
13966
13967 sb Enable the Armv8-a Speculation Barrier instruction. This option is
13968 only to enable the extension at the assembler level and does not
13969 affect code generation. This option is enabled by default for
13970 -march=armv8.5-a.
13971
13972 ssbs
13973 Enable the Armv8-a Speculative Store Bypass Safe instruction. This
13974 option is only to enable the extension at the assembler level and
13975 does not affect code generation. This option is enabled by default
13976 for -march=armv8.5-a.
13977
13978 predres
13979 Enable the Armv8-a Execution and Data Prediction Restriction
13980 instructions. This option is only to enable the extension at the
13981 assembler level and does not affect code generation. This option
13982 is enabled by default for -march=armv8.5-a.
13983
13984 Feature crypto implies aes, sha2, and simd, which implies fp.
13985 Conversely, nofp implies nosimd, which implies nocrypto, noaes and
13986 nosha2.
13987
13988 Adapteva Epiphany Options
13989 These -m options are defined for Adapteva Epiphany:
13990
13991 -mhalf-reg-file
13992 Don't allocate any register in the range "r32"..."r63". That
13993 allows code to run on hardware variants that lack these registers.
13994
13995 -mprefer-short-insn-regs
13996 Preferentially allocate registers that allow short instruction
13997 generation. This can result in increased instruction count, so
13998 this may either reduce or increase overall code size.
13999
14000 -mbranch-cost=num
14001 Set the cost of branches to roughly num "simple" instructions.
14002 This cost is only a heuristic and is not guaranteed to produce
14003 consistent results across releases.
14004
14005 -mcmove
14006 Enable the generation of conditional moves.
14007
14008 -mnops=num
14009 Emit num NOPs before every other generated instruction.
14010
14011 -mno-soft-cmpsf
14012 For single-precision floating-point comparisons, emit an "fsub"
14013 instruction and test the flags. This is faster than a software
14014 comparison, but can get incorrect results in the presence of NaNs,
14015 or when two different small numbers are compared such that their
14016 difference is calculated as zero. The default is -msoft-cmpsf,
14017 which uses slower, but IEEE-compliant, software comparisons.
14018
14019 -mstack-offset=num
14020 Set the offset between the top of the stack and the stack pointer.
14021 E.g., a value of 8 means that the eight bytes in the range
14022 "sp+0...sp+7" can be used by leaf functions without stack
14023 allocation. Values other than 8 or 16 are untested and unlikely to
14024 work. Note also that this option changes the ABI; compiling a
14025 program with a different stack offset than the libraries have been
14026 compiled with generally does not work. This option can be useful
14027 if you want to evaluate if a different stack offset would give you
14028 better code, but to actually use a different stack offset to build
14029 working programs, it is recommended to configure the toolchain with
14030 the appropriate --with-stack-offset=num option.
14031
14032 -mno-round-nearest
14033 Make the scheduler assume that the rounding mode has been set to
14034 truncating. The default is -mround-nearest.
14035
14036 -mlong-calls
14037 If not otherwise specified by an attribute, assume all calls might
14038 be beyond the offset range of the "b" / "bl" instructions, and
14039 therefore load the function address into a register before
14040 performing a (otherwise direct) call. This is the default.
14041
14042 -mshort-calls
14043 If not otherwise specified by an attribute, assume all direct calls
14044 are in the range of the "b" / "bl" instructions, so use these
14045 instructions for direct calls. The default is -mlong-calls.
14046
14047 -msmall16
14048 Assume addresses can be loaded as 16-bit unsigned values. This
14049 does not apply to function addresses for which -mlong-calls
14050 semantics are in effect.
14051
14052 -mfp-mode=mode
14053 Set the prevailing mode of the floating-point unit. This
14054 determines the floating-point mode that is provided and expected at
14055 function call and return time. Making this mode match the mode you
14056 predominantly need at function start can make your programs smaller
14057 and faster by avoiding unnecessary mode switches.
14058
14059 mode can be set to one the following values:
14060
14061 caller
14062 Any mode at function entry is valid, and retained or restored
14063 when the function returns, and when it calls other functions.
14064 This mode is useful for compiling libraries or other
14065 compilation units you might want to incorporate into different
14066 programs with different prevailing FPU modes, and the
14067 convenience of being able to use a single object file outweighs
14068 the size and speed overhead for any extra mode switching that
14069 might be needed, compared with what would be needed with a more
14070 specific choice of prevailing FPU mode.
14071
14072 truncate
14073 This is the mode used for floating-point calculations with
14074 truncating (i.e. round towards zero) rounding mode. That
14075 includes conversion from floating point to integer.
14076
14077 round-nearest
14078 This is the mode used for floating-point calculations with
14079 round-to-nearest-or-even rounding mode.
14080
14081 int This is the mode used to perform integer calculations in the
14082 FPU, e.g. integer multiply, or integer multiply-and-
14083 accumulate.
14084
14085 The default is -mfp-mode=caller
14086
14087 -mno-split-lohi
14088 -mno-postinc
14089 -mno-postmodify
14090 Code generation tweaks that disable, respectively, splitting of
14091 32-bit loads, generation of post-increment addresses, and
14092 generation of post-modify addresses. The defaults are msplit-lohi,
14093 -mpost-inc, and -mpost-modify.
14094
14095 -mnovect-double
14096 Change the preferred SIMD mode to SImode. The default is
14097 -mvect-double, which uses DImode as preferred SIMD mode.
14098
14099 -max-vect-align=num
14100 The maximum alignment for SIMD vector mode types. num may be 4 or
14101 8. The default is 8. Note that this is an ABI change, even though
14102 many library function interfaces are unaffected if they don't use
14103 SIMD vector modes in places that affect size and/or alignment of
14104 relevant types.
14105
14106 -msplit-vecmove-early
14107 Split vector moves into single word moves before reload. In theory
14108 this can give better register allocation, but so far the reverse
14109 seems to be generally the case.
14110
14111 -m1reg-reg
14112 Specify a register to hold the constant -1, which makes loading
14113 small negative constants and certain bitmasks faster. Allowable
14114 values for reg are r43 and r63, which specify use of that register
14115 as a fixed register, and none, which means that no register is used
14116 for this purpose. The default is -m1reg-none.
14117
14118 AMD GCN Options
14119 These options are defined specifically for the AMD GCN port.
14120
14121 -march=gpu
14122 -mtune=gpu
14123 Set architecture type or tuning for gpu. Supported values for gpu
14124 are
14125
14126 fiji
14127 Compile for GCN3 Fiji devices (gfx803).
14128
14129 gfx900
14130 Compile for GCN5 Vega 10 devices (gfx900).
14131
14132 -mstack-size=bytes
14133 Specify how many bytes of stack space will be requested for each
14134 GPU thread (wave-front). Beware that there may be many threads and
14135 limited memory available. The size of the stack allocation may
14136 also have an impact on run-time performance. The default is 32KB
14137 when using OpenACC or OpenMP, and 1MB otherwise.
14138
14139 ARC Options
14140 The following options control the architecture variant for which code
14141 is being compiled:
14142
14143 -mbarrel-shifter
14144 Generate instructions supported by barrel shifter. This is the
14145 default unless -mcpu=ARC601 or -mcpu=ARCEM is in effect.
14146
14147 -mjli-always
14148 Force to call a function using jli_s instruction. This option is
14149 valid only for ARCv2 architecture.
14150
14151 -mcpu=cpu
14152 Set architecture type, register usage, and instruction scheduling
14153 parameters for cpu. There are also shortcut alias options
14154 available for backward compatibility and convenience. Supported
14155 values for cpu are
14156
14157 arc600
14158 Compile for ARC600. Aliases: -mA6, -mARC600.
14159
14160 arc601
14161 Compile for ARC601. Alias: -mARC601.
14162
14163 arc700
14164 Compile for ARC700. Aliases: -mA7, -mARC700. This is the
14165 default when configured with --with-cpu=arc700.
14166
14167 arcem
14168 Compile for ARC EM.
14169
14170 archs
14171 Compile for ARC HS.
14172
14173 em Compile for ARC EM CPU with no hardware extensions.
14174
14175 em4 Compile for ARC EM4 CPU.
14176
14177 em4_dmips
14178 Compile for ARC EM4 DMIPS CPU.
14179
14180 em4_fpus
14181 Compile for ARC EM4 DMIPS CPU with the single-precision
14182 floating-point extension.
14183
14184 em4_fpuda
14185 Compile for ARC EM4 DMIPS CPU with single-precision floating-
14186 point and double assist instructions.
14187
14188 hs Compile for ARC HS CPU with no hardware extensions except the
14189 atomic instructions.
14190
14191 hs34
14192 Compile for ARC HS34 CPU.
14193
14194 hs38
14195 Compile for ARC HS38 CPU.
14196
14197 hs38_linux
14198 Compile for ARC HS38 CPU with all hardware extensions on.
14199
14200 arc600_norm
14201 Compile for ARC 600 CPU with "norm" instructions enabled.
14202
14203 arc600_mul32x16
14204 Compile for ARC 600 CPU with "norm" and 32x16-bit multiply
14205 instructions enabled.
14206
14207 arc600_mul64
14208 Compile for ARC 600 CPU with "norm" and "mul64"-family
14209 instructions enabled.
14210
14211 arc601_norm
14212 Compile for ARC 601 CPU with "norm" instructions enabled.
14213
14214 arc601_mul32x16
14215 Compile for ARC 601 CPU with "norm" and 32x16-bit multiply
14216 instructions enabled.
14217
14218 arc601_mul64
14219 Compile for ARC 601 CPU with "norm" and "mul64"-family
14220 instructions enabled.
14221
14222 nps400
14223 Compile for ARC 700 on NPS400 chip.
14224
14225 em_mini
14226 Compile for ARC EM minimalist configuration featuring reduced
14227 register set.
14228
14229 -mdpfp
14230 -mdpfp-compact
14231 Generate double-precision FPX instructions, tuned for the compact
14232 implementation.
14233
14234 -mdpfp-fast
14235 Generate double-precision FPX instructions, tuned for the fast
14236 implementation.
14237
14238 -mno-dpfp-lrsr
14239 Disable "lr" and "sr" instructions from using FPX extension aux
14240 registers.
14241
14242 -mea
14243 Generate extended arithmetic instructions. Currently only "divaw",
14244 "adds", "subs", and "sat16" are supported. This is always enabled
14245 for -mcpu=ARC700.
14246
14247 -mno-mpy
14248 Do not generate "mpy"-family instructions for ARC700. This option
14249 is deprecated.
14250
14251 -mmul32x16
14252 Generate 32x16-bit multiply and multiply-accumulate instructions.
14253
14254 -mmul64
14255 Generate "mul64" and "mulu64" instructions. Only valid for
14256 -mcpu=ARC600.
14257
14258 -mnorm
14259 Generate "norm" instructions. This is the default if -mcpu=ARC700
14260 is in effect.
14261
14262 -mspfp
14263 -mspfp-compact
14264 Generate single-precision FPX instructions, tuned for the compact
14265 implementation.
14266
14267 -mspfp-fast
14268 Generate single-precision FPX instructions, tuned for the fast
14269 implementation.
14270
14271 -msimd
14272 Enable generation of ARC SIMD instructions via target-specific
14273 builtins. Only valid for -mcpu=ARC700.
14274
14275 -msoft-float
14276 This option ignored; it is provided for compatibility purposes
14277 only. Software floating-point code is emitted by default, and this
14278 default can overridden by FPX options; -mspfp, -mspfp-compact, or
14279 -mspfp-fast for single precision, and -mdpfp, -mdpfp-compact, or
14280 -mdpfp-fast for double precision.
14281
14282 -mswap
14283 Generate "swap" instructions.
14284
14285 -matomic
14286 This enables use of the locked load/store conditional extension to
14287 implement atomic memory built-in functions. Not available for ARC
14288 6xx or ARC EM cores.
14289
14290 -mdiv-rem
14291 Enable "div" and "rem" instructions for ARCv2 cores.
14292
14293 -mcode-density
14294 Enable code density instructions for ARC EM. This option is on by
14295 default for ARC HS.
14296
14297 -mll64
14298 Enable double load/store operations for ARC HS cores.
14299
14300 -mtp-regno=regno
14301 Specify thread pointer register number.
14302
14303 -mmpy-option=multo
14304 Compile ARCv2 code with a multiplier design option. You can
14305 specify the option using either a string or numeric value for
14306 multo. wlh1 is the default value. The recognized values are:
14307
14308 0
14309 none
14310 No multiplier available.
14311
14312 1
14313 w 16x16 multiplier, fully pipelined. The following instructions
14314 are enabled: "mpyw" and "mpyuw".
14315
14316 2
14317 wlh1
14318 32x32 multiplier, fully pipelined (1 stage). The following
14319 instructions are additionally enabled: "mpy", "mpyu", "mpym",
14320 "mpymu", and "mpy_s".
14321
14322 3
14323 wlh2
14324 32x32 multiplier, fully pipelined (2 stages). The following
14325 instructions are additionally enabled: "mpy", "mpyu", "mpym",
14326 "mpymu", and "mpy_s".
14327
14328 4
14329 wlh3
14330 Two 16x16 multipliers, blocking, sequential. The following
14331 instructions are additionally enabled: "mpy", "mpyu", "mpym",
14332 "mpymu", and "mpy_s".
14333
14334 5
14335 wlh4
14336 One 16x16 multiplier, blocking, sequential. The following
14337 instructions are additionally enabled: "mpy", "mpyu", "mpym",
14338 "mpymu", and "mpy_s".
14339
14340 6
14341 wlh5
14342 One 32x4 multiplier, blocking, sequential. The following
14343 instructions are additionally enabled: "mpy", "mpyu", "mpym",
14344 "mpymu", and "mpy_s".
14345
14346 7
14347 plus_dmpy
14348 ARC HS SIMD support.
14349
14350 8
14351 plus_macd
14352 ARC HS SIMD support.
14353
14354 9
14355 plus_qmacw
14356 ARC HS SIMD support.
14357
14358 This option is only available for ARCv2 cores.
14359
14360 -mfpu=fpu
14361 Enables support for specific floating-point hardware extensions for
14362 ARCv2 cores. Supported values for fpu are:
14363
14364 fpus
14365 Enables support for single-precision floating-point hardware
14366 extensions.
14367
14368 fpud
14369 Enables support for double-precision floating-point hardware
14370 extensions. The single-precision floating-point extension is
14371 also enabled. Not available for ARC EM.
14372
14373 fpuda
14374 Enables support for double-precision floating-point hardware
14375 extensions using double-precision assist instructions. The
14376 single-precision floating-point extension is also enabled.
14377 This option is only available for ARC EM.
14378
14379 fpuda_div
14380 Enables support for double-precision floating-point hardware
14381 extensions using double-precision assist instructions. The
14382 single-precision floating-point, square-root, and divide
14383 extensions are also enabled. This option is only available for
14384 ARC EM.
14385
14386 fpuda_fma
14387 Enables support for double-precision floating-point hardware
14388 extensions using double-precision assist instructions. The
14389 single-precision floating-point and fused multiply and add
14390 hardware extensions are also enabled. This option is only
14391 available for ARC EM.
14392
14393 fpuda_all
14394 Enables support for double-precision floating-point hardware
14395 extensions using double-precision assist instructions. All
14396 single-precision floating-point hardware extensions are also
14397 enabled. This option is only available for ARC EM.
14398
14399 fpus_div
14400 Enables support for single-precision floating-point, square-
14401 root and divide hardware extensions.
14402
14403 fpud_div
14404 Enables support for double-precision floating-point, square-
14405 root and divide hardware extensions. This option includes
14406 option fpus_div. Not available for ARC EM.
14407
14408 fpus_fma
14409 Enables support for single-precision floating-point and fused
14410 multiply and add hardware extensions.
14411
14412 fpud_fma
14413 Enables support for double-precision floating-point and fused
14414 multiply and add hardware extensions. This option includes
14415 option fpus_fma. Not available for ARC EM.
14416
14417 fpus_all
14418 Enables support for all single-precision floating-point
14419 hardware extensions.
14420
14421 fpud_all
14422 Enables support for all single- and double-precision floating-
14423 point hardware extensions. Not available for ARC EM.
14424
14425 -mirq-ctrl-saved=register-range, blink, lp_count
14426 Specifies general-purposes registers that the processor
14427 automatically saves/restores on interrupt entry and exit.
14428 register-range is specified as two registers separated by a dash.
14429 The register range always starts with "r0", the upper limit is "fp"
14430 register. blink and lp_count are optional. This option is only
14431 valid for ARC EM and ARC HS cores.
14432
14433 -mrgf-banked-regs=number
14434 Specifies the number of registers replicated in second register
14435 bank on entry to fast interrupt. Fast interrupts are interrupts
14436 with the highest priority level P0. These interrupts save only PC
14437 and STATUS32 registers to avoid memory transactions during
14438 interrupt entry and exit sequences. Use this option when you are
14439 using fast interrupts in an ARC V2 family processor. Permitted
14440 values are 4, 8, 16, and 32.
14441
14442 -mlpc-width=width
14443 Specify the width of the "lp_count" register. Valid values for
14444 width are 8, 16, 20, 24, 28 and 32 bits. The default width is
14445 fixed to 32 bits. If the width is less than 32, the compiler does
14446 not attempt to transform loops in your program to use the zero-
14447 delay loop mechanism unless it is known that the "lp_count"
14448 register can hold the required loop-counter value. Depending on
14449 the width specified, the compiler and run-time library might
14450 continue to use the loop mechanism for various needs. This option
14451 defines macro "__ARC_LPC_WIDTH__" with the value of width.
14452
14453 -mrf16
14454 This option instructs the compiler to generate code for a 16-entry
14455 register file. This option defines the "__ARC_RF16__" preprocessor
14456 macro.
14457
14458 -mbranch-index
14459 Enable use of "bi" or "bih" instructions to implement jump tables.
14460
14461 The following options are passed through to the assembler, and also
14462 define preprocessor macro symbols.
14463
14464 -mdsp-packa
14465 Passed down to the assembler to enable the DSP Pack A extensions.
14466 Also sets the preprocessor symbol "__Xdsp_packa". This option is
14467 deprecated.
14468
14469 -mdvbf
14470 Passed down to the assembler to enable the dual Viterbi butterfly
14471 extension. Also sets the preprocessor symbol "__Xdvbf". This
14472 option is deprecated.
14473
14474 -mlock
14475 Passed down to the assembler to enable the locked load/store
14476 conditional extension. Also sets the preprocessor symbol
14477 "__Xlock".
14478
14479 -mmac-d16
14480 Passed down to the assembler. Also sets the preprocessor symbol
14481 "__Xxmac_d16". This option is deprecated.
14482
14483 -mmac-24
14484 Passed down to the assembler. Also sets the preprocessor symbol
14485 "__Xxmac_24". This option is deprecated.
14486
14487 -mrtsc
14488 Passed down to the assembler to enable the 64-bit time-stamp
14489 counter extension instruction. Also sets the preprocessor symbol
14490 "__Xrtsc". This option is deprecated.
14491
14492 -mswape
14493 Passed down to the assembler to enable the swap byte ordering
14494 extension instruction. Also sets the preprocessor symbol
14495 "__Xswape".
14496
14497 -mtelephony
14498 Passed down to the assembler to enable dual- and single-operand
14499 instructions for telephony. Also sets the preprocessor symbol
14500 "__Xtelephony". This option is deprecated.
14501
14502 -mxy
14503 Passed down to the assembler to enable the XY memory extension.
14504 Also sets the preprocessor symbol "__Xxy".
14505
14506 The following options control how the assembly code is annotated:
14507
14508 -misize
14509 Annotate assembler instructions with estimated addresses.
14510
14511 -mannotate-align
14512 Explain what alignment considerations lead to the decision to make
14513 an instruction short or long.
14514
14515 The following options are passed through to the linker:
14516
14517 -marclinux
14518 Passed through to the linker, to specify use of the "arclinux"
14519 emulation. This option is enabled by default in tool chains built
14520 for "arc-linux-uclibc" and "arceb-linux-uclibc" targets when
14521 profiling is not requested.
14522
14523 -marclinux_prof
14524 Passed through to the linker, to specify use of the "arclinux_prof"
14525 emulation. This option is enabled by default in tool chains built
14526 for "arc-linux-uclibc" and "arceb-linux-uclibc" targets when
14527 profiling is requested.
14528
14529 The following options control the semantics of generated code:
14530
14531 -mlong-calls
14532 Generate calls as register indirect calls, thus providing access to
14533 the full 32-bit address range.
14534
14535 -mmedium-calls
14536 Don't use less than 25-bit addressing range for calls, which is the
14537 offset available for an unconditional branch-and-link instruction.
14538 Conditional execution of function calls is suppressed, to allow use
14539 of the 25-bit range, rather than the 21-bit range with conditional
14540 branch-and-link. This is the default for tool chains built for
14541 "arc-linux-uclibc" and "arceb-linux-uclibc" targets.
14542
14543 -G num
14544 Put definitions of externally-visible data in a small data section
14545 if that data is no bigger than num bytes. The default value of num
14546 is 4 for any ARC configuration, or 8 when we have double load/store
14547 operations.
14548
14549 -mno-sdata
14550 Do not generate sdata references. This is the default for tool
14551 chains built for "arc-linux-uclibc" and "arceb-linux-uclibc"
14552 targets.
14553
14554 -mvolatile-cache
14555 Use ordinarily cached memory accesses for volatile references.
14556 This is the default.
14557
14558 -mno-volatile-cache
14559 Enable cache bypass for volatile references.
14560
14561 The following options fine tune code generation:
14562
14563 -malign-call
14564 Do alignment optimizations for call instructions.
14565
14566 -mauto-modify-reg
14567 Enable the use of pre/post modify with register displacement.
14568
14569 -mbbit-peephole
14570 Enable bbit peephole2.
14571
14572 -mno-brcc
14573 This option disables a target-specific pass in arc_reorg to
14574 generate compare-and-branch ("brcc") instructions. It has no
14575 effect on generation of these instructions driven by the combiner
14576 pass.
14577
14578 -mcase-vector-pcrel
14579 Use PC-relative switch case tables to enable case table shortening.
14580 This is the default for -Os.
14581
14582 -mcompact-casesi
14583 Enable compact "casesi" pattern. This is the default for -Os, and
14584 only available for ARCv1 cores. This option is deprecated.
14585
14586 -mno-cond-exec
14587 Disable the ARCompact-specific pass to generate conditional
14588 execution instructions.
14589
14590 Due to delay slot scheduling and interactions between operand
14591 numbers, literal sizes, instruction lengths, and the support for
14592 conditional execution, the target-independent pass to generate
14593 conditional execution is often lacking, so the ARC port has kept a
14594 special pass around that tries to find more conditional execution
14595 generation opportunities after register allocation, branch
14596 shortening, and delay slot scheduling have been done. This pass
14597 generally, but not always, improves performance and code size, at
14598 the cost of extra compilation time, which is why there is an option
14599 to switch it off. If you have a problem with call instructions
14600 exceeding their allowable offset range because they are
14601 conditionalized, you should consider using -mmedium-calls instead.
14602
14603 -mearly-cbranchsi
14604 Enable pre-reload use of the "cbranchsi" pattern.
14605
14606 -mexpand-adddi
14607 Expand "adddi3" and "subdi3" at RTL generation time into "add.f",
14608 "adc" etc. This option is deprecated.
14609
14610 -mindexed-loads
14611 Enable the use of indexed loads. This can be problematic because
14612 some optimizers then assume that indexed stores exist, which is not
14613 the case.
14614
14615 -mlra
14616 Enable Local Register Allocation. This is still experimental for
14617 ARC, so by default the compiler uses standard reload (i.e.
14618 -mno-lra).
14619
14620 -mlra-priority-none
14621 Don't indicate any priority for target registers.
14622
14623 -mlra-priority-compact
14624 Indicate target register priority for r0..r3 / r12..r15.
14625
14626 -mlra-priority-noncompact
14627 Reduce target register priority for r0..r3 / r12..r15.
14628
14629 -mmillicode
14630 When optimizing for size (using -Os), prologues and epilogues that
14631 have to save or restore a large number of registers are often
14632 shortened by using call to a special function in libgcc; this is
14633 referred to as a millicode call. As these calls can pose
14634 performance issues, and/or cause linking issues when linking in a
14635 nonstandard way, this option is provided to turn on or off
14636 millicode call generation.
14637
14638 -mcode-density-frame
14639 This option enable the compiler to emit "enter" and "leave"
14640 instructions. These instructions are only valid for CPUs with
14641 code-density feature.
14642
14643 -mmixed-code
14644 Tweak register allocation to help 16-bit instruction generation.
14645 This generally has the effect of decreasing the average instruction
14646 size while increasing the instruction count.
14647
14648 -mq-class
14649 Enable q instruction alternatives. This is the default for -Os.
14650
14651 -mRcq
14652 Enable Rcq constraint handling. Most short code generation depends
14653 on this. This is the default.
14654
14655 -mRcw
14656 Enable Rcw constraint handling. Most ccfsm condexec mostly depends
14657 on this. This is the default.
14658
14659 -msize-level=level
14660 Fine-tune size optimization with regards to instruction lengths and
14661 alignment. The recognized values for level are:
14662
14663 0 No size optimization. This level is deprecated and treated
14664 like 1.
14665
14666 1 Short instructions are used opportunistically.
14667
14668 2 In addition, alignment of loops and of code after barriers are
14669 dropped.
14670
14671 3 In addition, optional data alignment is dropped, and the option
14672 Os is enabled.
14673
14674 This defaults to 3 when -Os is in effect. Otherwise, the behavior
14675 when this is not set is equivalent to level 1.
14676
14677 -mtune=cpu
14678 Set instruction scheduling parameters for cpu, overriding any
14679 implied by -mcpu=.
14680
14681 Supported values for cpu are
14682
14683 ARC600
14684 Tune for ARC600 CPU.
14685
14686 ARC601
14687 Tune for ARC601 CPU.
14688
14689 ARC700
14690 Tune for ARC700 CPU with standard multiplier block.
14691
14692 ARC700-xmac
14693 Tune for ARC700 CPU with XMAC block.
14694
14695 ARC725D
14696 Tune for ARC725D CPU.
14697
14698 ARC750D
14699 Tune for ARC750D CPU.
14700
14701 -mmultcost=num
14702 Cost to assume for a multiply instruction, with 4 being equal to a
14703 normal instruction.
14704
14705 -munalign-prob-threshold=probability
14706 Set probability threshold for unaligning branches. When tuning for
14707 ARC700 and optimizing for speed, branches without filled delay slot
14708 are preferably emitted unaligned and long, unless profiling
14709 indicates that the probability for the branch to be taken is below
14710 probability. The default is (REG_BR_PROB_BASE/2), i.e. 5000.
14711
14712 The following options are maintained for backward compatibility, but
14713 are now deprecated and will be removed in a future release:
14714
14715 -margonaut
14716 Obsolete FPX.
14717
14718 -mbig-endian
14719 -EB Compile code for big-endian targets. Use of these options is now
14720 deprecated. Big-endian code is supported by configuring GCC to
14721 build "arceb-elf32" and "arceb-linux-uclibc" targets, for which big
14722 endian is the default.
14723
14724 -mlittle-endian
14725 -EL Compile code for little-endian targets. Use of these options is
14726 now deprecated. Little-endian code is supported by configuring GCC
14727 to build "arc-elf32" and "arc-linux-uclibc" targets, for which
14728 little endian is the default.
14729
14730 -mbarrel_shifter
14731 Replaced by -mbarrel-shifter.
14732
14733 -mdpfp_compact
14734 Replaced by -mdpfp-compact.
14735
14736 -mdpfp_fast
14737 Replaced by -mdpfp-fast.
14738
14739 -mdsp_packa
14740 Replaced by -mdsp-packa.
14741
14742 -mEA
14743 Replaced by -mea.
14744
14745 -mmac_24
14746 Replaced by -mmac-24.
14747
14748 -mmac_d16
14749 Replaced by -mmac-d16.
14750
14751 -mspfp_compact
14752 Replaced by -mspfp-compact.
14753
14754 -mspfp_fast
14755 Replaced by -mspfp-fast.
14756
14757 -mtune=cpu
14758 Values arc600, arc601, arc700 and arc700-xmac for cpu are replaced
14759 by ARC600, ARC601, ARC700 and ARC700-xmac respectively.
14760
14761 -multcost=num
14762 Replaced by -mmultcost.
14763
14764 ARM Options
14765 These -m options are defined for the ARM port:
14766
14767 -mabi=name
14768 Generate code for the specified ABI. Permissible values are: apcs-
14769 gnu, atpcs, aapcs, aapcs-linux and iwmmxt.
14770
14771 -mapcs-frame
14772 Generate a stack frame that is compliant with the ARM Procedure
14773 Call Standard for all functions, even if this is not strictly
14774 necessary for correct execution of the code. Specifying
14775 -fomit-frame-pointer with this option causes the stack frames not
14776 to be generated for leaf functions. The default is
14777 -mno-apcs-frame. This option is deprecated.
14778
14779 -mapcs
14780 This is a synonym for -mapcs-frame and is deprecated.
14781
14782 -mthumb-interwork
14783 Generate code that supports calling between the ARM and Thumb
14784 instruction sets. Without this option, on pre-v5 architectures,
14785 the two instruction sets cannot be reliably used inside one
14786 program. The default is -mno-thumb-interwork, since slightly
14787 larger code is generated when -mthumb-interwork is specified. In
14788 AAPCS configurations this option is meaningless.
14789
14790 -mno-sched-prolog
14791 Prevent the reordering of instructions in the function prologue, or
14792 the merging of those instruction with the instructions in the
14793 function's body. This means that all functions start with a
14794 recognizable set of instructions (or in fact one of a choice from a
14795 small set of different function prologues), and this information
14796 can be used to locate the start of functions inside an executable
14797 piece of code. The default is -msched-prolog.
14798
14799 -mfloat-abi=name
14800 Specifies which floating-point ABI to use. Permissible values are:
14801 soft, softfp and hard.
14802
14803 Specifying soft causes GCC to generate output containing library
14804 calls for floating-point operations. softfp allows the generation
14805 of code using hardware floating-point instructions, but still uses
14806 the soft-float calling conventions. hard allows generation of
14807 floating-point instructions and uses FPU-specific calling
14808 conventions.
14809
14810 The default depends on the specific target configuration. Note
14811 that the hard-float and soft-float ABIs are not link-compatible;
14812 you must compile your entire program with the same ABI, and link
14813 with a compatible set of libraries.
14814
14815 -mgeneral-regs-only
14816 Generate code which uses only the general-purpose registers. This
14817 will prevent the compiler from using floating-point and Advanced
14818 SIMD registers but will not impose any restrictions on the
14819 assembler.
14820
14821 -mlittle-endian
14822 Generate code for a processor running in little-endian mode. This
14823 is the default for all standard configurations.
14824
14825 -mbig-endian
14826 Generate code for a processor running in big-endian mode; the
14827 default is to compile code for a little-endian processor.
14828
14829 -mbe8
14830 -mbe32
14831 When linking a big-endian image select between BE8 and BE32
14832 formats. The option has no effect for little-endian images and is
14833 ignored. The default is dependent on the selected target
14834 architecture. For ARMv6 and later architectures the default is
14835 BE8, for older architectures the default is BE32. BE32 format has
14836 been deprecated by ARM.
14837
14838 -march=name[+extension...]
14839 This specifies the name of the target ARM architecture. GCC uses
14840 this name to determine what kind of instructions it can emit when
14841 generating assembly code. This option can be used in conjunction
14842 with or instead of the -mcpu= option.
14843
14844 Permissible names are: armv4t, armv5t, armv5te, armv6, armv6j,
14845 armv6k, armv6kz, armv6t2, armv6z, armv6zk, armv7, armv7-a, armv7ve,
14846 armv8-a, armv8.1-a, armv8.2-a, armv8.3-a, armv8.4-a, armv8.5-a,
14847 armv7-r, armv8-r, armv6-m, armv6s-m, armv7-m, armv7e-m,
14848 armv8-m.base, armv8-m.main, iwmmxt and iwmmxt2.
14849
14850 Additionally, the following architectures, which lack support for
14851 the Thumb execution state, are recognized but support is
14852 deprecated: armv4.
14853
14854 Many of the architectures support extensions. These can be added
14855 by appending +extension to the architecture name. Extension
14856 options are processed in order and capabilities accumulate. An
14857 extension will also enable any necessary base extensions upon which
14858 it depends. For example, the +crypto extension will always enable
14859 the +simd extension. The exception to the additive construction is
14860 for extensions that are prefixed with +no...: these extensions
14861 disable the specified option and any other extensions that may
14862 depend on the presence of that extension.
14863
14864 For example, -march=armv7-a+simd+nofp+vfpv4 is equivalent to
14865 writing -march=armv7-a+vfpv4 since the +simd option is entirely
14866 disabled by the +nofp option that follows it.
14867
14868 Most extension names are generically named, but have an effect that
14869 is dependent upon the architecture to which it is applied. For
14870 example, the +simd option can be applied to both armv7-a and
14871 armv8-a architectures, but will enable the original ARMv7-A
14872 Advanced SIMD (Neon) extensions for armv7-a and the ARMv8-A variant
14873 for armv8-a.
14874
14875 The table below lists the supported extensions for each
14876 architecture. Architectures not mentioned do not support any
14877 extensions.
14878
14879 armv5te
14880 armv6
14881 armv6j
14882 armv6k
14883 armv6kz
14884 armv6t2
14885 armv6z
14886 armv6zk
14887 +fp The VFPv2 floating-point instructions. The extension
14888 +vfpv2 can be used as an alias for this extension.
14889
14890 +nofp
14891 Disable the floating-point instructions.
14892
14893 armv7
14894 The common subset of the ARMv7-A, ARMv7-R and ARMv7-M
14895 architectures.
14896
14897 +fp The VFPv3 floating-point instructions, with 16 double-
14898 precision registers. The extension +vfpv3-d16 can be used
14899 as an alias for this extension. Note that floating-point
14900 is not supported by the base ARMv7-M architecture, but is
14901 compatible with both the ARMv7-A and ARMv7-R architectures.
14902
14903 +nofp
14904 Disable the floating-point instructions.
14905
14906 armv7-a
14907 +mp The multiprocessing extension.
14908
14909 +sec
14910 The security extension.
14911
14912 +fp The VFPv3 floating-point instructions, with 16 double-
14913 precision registers. The extension +vfpv3-d16 can be used
14914 as an alias for this extension.
14915
14916 +simd
14917 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point
14918 instructions. The extensions +neon and +neon-vfpv3 can be
14919 used as aliases for this extension.
14920
14921 +vfpv3
14922 The VFPv3 floating-point instructions, with 32 double-
14923 precision registers.
14924
14925 +vfpv3-d16-fp16
14926 The VFPv3 floating-point instructions, with 16 double-
14927 precision registers and the half-precision floating-point
14928 conversion operations.
14929
14930 +vfpv3-fp16
14931 The VFPv3 floating-point instructions, with 32 double-
14932 precision registers and the half-precision floating-point
14933 conversion operations.
14934
14935 +vfpv4-d16
14936 The VFPv4 floating-point instructions, with 16 double-
14937 precision registers.
14938
14939 +vfpv4
14940 The VFPv4 floating-point instructions, with 32 double-
14941 precision registers.
14942
14943 +neon-fp16
14944 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point
14945 instructions, with the half-precision floating-point
14946 conversion operations.
14947
14948 +neon-vfpv4
14949 The Advanced SIMD (Neon) v2 and the VFPv4 floating-point
14950 instructions.
14951
14952 +nosimd
14953 Disable the Advanced SIMD instructions (does not disable
14954 floating point).
14955
14956 +nofp
14957 Disable the floating-point and Advanced SIMD instructions.
14958
14959 armv7ve
14960 The extended version of the ARMv7-A architecture with support
14961 for virtualization.
14962
14963 +fp The VFPv4 floating-point instructions, with 16 double-
14964 precision registers. The extension +vfpv4-d16 can be used
14965 as an alias for this extension.
14966
14967 +simd
14968 The Advanced SIMD (Neon) v2 and the VFPv4 floating-point
14969 instructions. The extension +neon-vfpv4 can be used as an
14970 alias for this extension.
14971
14972 +vfpv3-d16
14973 The VFPv3 floating-point instructions, with 16 double-
14974 precision registers.
14975
14976 +vfpv3
14977 The VFPv3 floating-point instructions, with 32 double-
14978 precision registers.
14979
14980 +vfpv3-d16-fp16
14981 The VFPv3 floating-point instructions, with 16 double-
14982 precision registers and the half-precision floating-point
14983 conversion operations.
14984
14985 +vfpv3-fp16
14986 The VFPv3 floating-point instructions, with 32 double-
14987 precision registers and the half-precision floating-point
14988 conversion operations.
14989
14990 +vfpv4-d16
14991 The VFPv4 floating-point instructions, with 16 double-
14992 precision registers.
14993
14994 +vfpv4
14995 The VFPv4 floating-point instructions, with 32 double-
14996 precision registers.
14997
14998 +neon
14999 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point
15000 instructions. The extension +neon-vfpv3 can be used as an
15001 alias for this extension.
15002
15003 +neon-fp16
15004 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point
15005 instructions, with the half-precision floating-point
15006 conversion operations.
15007
15008 +nosimd
15009 Disable the Advanced SIMD instructions (does not disable
15010 floating point).
15011
15012 +nofp
15013 Disable the floating-point and Advanced SIMD instructions.
15014
15015 armv8-a
15016 +crc
15017 The Cyclic Redundancy Check (CRC) instructions.
15018
15019 +simd
15020 The ARMv8-A Advanced SIMD and floating-point instructions.
15021
15022 +crypto
15023 The cryptographic instructions.
15024
15025 +nocrypto
15026 Disable the cryptographic instructions.
15027
15028 +nofp
15029 Disable the floating-point, Advanced SIMD and cryptographic
15030 instructions.
15031
15032 +sb Speculation Barrier Instruction.
15033
15034 +predres
15035 Execution and Data Prediction Restriction Instructions.
15036
15037 armv8.1-a
15038 +simd
15039 The ARMv8.1-A Advanced SIMD and floating-point
15040 instructions.
15041
15042 +crypto
15043 The cryptographic instructions. This also enables the
15044 Advanced SIMD and floating-point instructions.
15045
15046 +nocrypto
15047 Disable the cryptographic instructions.
15048
15049 +nofp
15050 Disable the floating-point, Advanced SIMD and cryptographic
15051 instructions.
15052
15053 +sb Speculation Barrier Instruction.
15054
15055 +predres
15056 Execution and Data Prediction Restriction Instructions.
15057
15058 armv8.2-a
15059 armv8.3-a
15060 +fp16
15061 The half-precision floating-point data processing
15062 instructions. This also enables the Advanced SIMD and
15063 floating-point instructions.
15064
15065 +fp16fml
15066 The half-precision floating-point fmla extension. This
15067 also enables the half-precision floating-point extension
15068 and Advanced SIMD and floating-point instructions.
15069
15070 +simd
15071 The ARMv8.1-A Advanced SIMD and floating-point
15072 instructions.
15073
15074 +crypto
15075 The cryptographic instructions. This also enables the
15076 Advanced SIMD and floating-point instructions.
15077
15078 +dotprod
15079 Enable the Dot Product extension. This also enables
15080 Advanced SIMD instructions.
15081
15082 +nocrypto
15083 Disable the cryptographic extension.
15084
15085 +nofp
15086 Disable the floating-point, Advanced SIMD and cryptographic
15087 instructions.
15088
15089 +sb Speculation Barrier Instruction.
15090
15091 +predres
15092 Execution and Data Prediction Restriction Instructions.
15093
15094 armv8.4-a
15095 +fp16
15096 The half-precision floating-point data processing
15097 instructions. This also enables the Advanced SIMD and
15098 floating-point instructions as well as the Dot Product
15099 extension and the half-precision floating-point fmla
15100 extension.
15101
15102 +simd
15103 The ARMv8.3-A Advanced SIMD and floating-point instructions
15104 as well as the Dot Product extension.
15105
15106 +crypto
15107 The cryptographic instructions. This also enables the
15108 Advanced SIMD and floating-point instructions as well as
15109 the Dot Product extension.
15110
15111 +nocrypto
15112 Disable the cryptographic extension.
15113
15114 +nofp
15115 Disable the floating-point, Advanced SIMD and cryptographic
15116 instructions.
15117
15118 +sb Speculation Barrier Instruction.
15119
15120 +predres
15121 Execution and Data Prediction Restriction Instructions.
15122
15123 armv8.5-a
15124 +fp16
15125 The half-precision floating-point data processing
15126 instructions. This also enables the Advanced SIMD and
15127 floating-point instructions as well as the Dot Product
15128 extension and the half-precision floating-point fmla
15129 extension.
15130
15131 +simd
15132 The ARMv8.3-A Advanced SIMD and floating-point instructions
15133 as well as the Dot Product extension.
15134
15135 +crypto
15136 The cryptographic instructions. This also enables the
15137 Advanced SIMD and floating-point instructions as well as
15138 the Dot Product extension.
15139
15140 +nocrypto
15141 Disable the cryptographic extension.
15142
15143 +nofp
15144 Disable the floating-point, Advanced SIMD and cryptographic
15145 instructions.
15146
15147 armv7-r
15148 +fp.sp
15149 The single-precision VFPv3 floating-point instructions.
15150 The extension +vfpv3xd can be used as an alias for this
15151 extension.
15152
15153 +fp The VFPv3 floating-point instructions with 16 double-
15154 precision registers. The extension +vfpv3-d16 can be used
15155 as an alias for this extension.
15156
15157 +vfpv3xd-d16-fp16
15158 The single-precision VFPv3 floating-point instructions with
15159 16 double-precision registers and the half-precision
15160 floating-point conversion operations.
15161
15162 +vfpv3-d16-fp16
15163 The VFPv3 floating-point instructions with 16 double-
15164 precision registers and the half-precision floating-point
15165 conversion operations.
15166
15167 +nofp
15168 Disable the floating-point extension.
15169
15170 +idiv
15171 The ARM-state integer division instructions.
15172
15173 +noidiv
15174 Disable the ARM-state integer division extension.
15175
15176 armv7e-m
15177 +fp The single-precision VFPv4 floating-point instructions.
15178
15179 +fpv5
15180 The single-precision FPv5 floating-point instructions.
15181
15182 +fp.dp
15183 The single- and double-precision FPv5 floating-point
15184 instructions.
15185
15186 +nofp
15187 Disable the floating-point extensions.
15188
15189 armv8-m.main
15190 +dsp
15191 The DSP instructions.
15192
15193 +nodsp
15194 Disable the DSP extension.
15195
15196 +fp The single-precision floating-point instructions.
15197
15198 +fp.dp
15199 The single- and double-precision floating-point
15200 instructions.
15201
15202 +nofp
15203 Disable the floating-point extension.
15204
15205 armv8-r
15206 +crc
15207 The Cyclic Redundancy Check (CRC) instructions.
15208
15209 +fp.sp
15210 The single-precision FPv5 floating-point instructions.
15211
15212 +simd
15213 The ARMv8-A Advanced SIMD and floating-point instructions.
15214
15215 +crypto
15216 The cryptographic instructions.
15217
15218 +nocrypto
15219 Disable the cryptographic instructions.
15220
15221 +nofp
15222 Disable the floating-point, Advanced SIMD and cryptographic
15223 instructions.
15224
15225 -march=native causes the compiler to auto-detect the architecture
15226 of the build computer. At present, this feature is only supported
15227 on GNU/Linux, and not all architectures are recognized. If the
15228 auto-detect is unsuccessful the option has no effect.
15229
15230 -mtune=name
15231 This option specifies the name of the target ARM processor for
15232 which GCC should tune the performance of the code. For some ARM
15233 implementations better performance can be obtained by using this
15234 option. Permissible names are: arm7tdmi, arm7tdmi-s, arm710t,
15235 arm720t, arm740t, strongarm, strongarm110, strongarm1100,
15236 0strongarm1110, arm8, arm810, arm9, arm9e, arm920, arm920t,
15237 arm922t, arm946e-s, arm966e-s, arm968e-s, arm926ej-s, arm940t,
15238 arm9tdmi, arm10tdmi, arm1020t, arm1026ej-s, arm10e, arm1020e,
15239 arm1022e, arm1136j-s, arm1136jf-s, mpcore, mpcorenovfp,
15240 arm1156t2-s, arm1156t2f-s, arm1176jz-s, arm1176jzf-s,
15241 generic-armv7-a, cortex-a5, cortex-a7, cortex-a8, cortex-a9,
15242 cortex-a12, cortex-a15, cortex-a17, cortex-a32, cortex-a35,
15243 cortex-a53, cortex-a55, cortex-a57, cortex-a72, cortex-a73,
15244 cortex-a75, cortex-a76, ares, cortex-r4, cortex-r4f, cortex-r5,
15245 cortex-r7, cortex-r8, cortex-r52, cortex-m0, cortex-m0plus,
15246 cortex-m1, cortex-m3, cortex-m4, cortex-m7, cortex-m23, cortex-m33,
15247 cortex-m1.small-multiply, cortex-m0.small-multiply,
15248 cortex-m0plus.small-multiply, exynos-m1, marvell-pj4, neoverse-n1,
15249 xscale, iwmmxt, iwmmxt2, ep9312, fa526, fa626, fa606te, fa626te,
15250 fmp626, fa726te, xgene1.
15251
15252 Additionally, this option can specify that GCC should tune the
15253 performance of the code for a big.LITTLE system. Permissible names
15254 are: cortex-a15.cortex-a7, cortex-a17.cortex-a7,
15255 cortex-a57.cortex-a53, cortex-a72.cortex-a53,
15256 cortex-a72.cortex-a35, cortex-a73.cortex-a53,
15257 cortex-a75.cortex-a55, cortex-a76.cortex-a55.
15258
15259 -mtune=generic-arch specifies that GCC should tune the performance
15260 for a blend of processors within architecture arch. The aim is to
15261 generate code that run well on the current most popular processors,
15262 balancing between optimizations that benefit some CPUs in the
15263 range, and avoiding performance pitfalls of other CPUs. The
15264 effects of this option may change in future GCC versions as CPU
15265 models come and go.
15266
15267 -mtune permits the same extension options as -mcpu, but the
15268 extension options do not affect the tuning of the generated code.
15269
15270 -mtune=native causes the compiler to auto-detect the CPU of the
15271 build computer. At present, this feature is only supported on
15272 GNU/Linux, and not all architectures are recognized. If the auto-
15273 detect is unsuccessful the option has no effect.
15274
15275 -mcpu=name[+extension...]
15276 This specifies the name of the target ARM processor. GCC uses this
15277 name to derive the name of the target ARM architecture (as if
15278 specified by -march) and the ARM processor type for which to tune
15279 for performance (as if specified by -mtune). Where this option is
15280 used in conjunction with -march or -mtune, those options take
15281 precedence over the appropriate part of this option.
15282
15283 Many of the supported CPUs implement optional architectural
15284 extensions. Where this is so the architectural extensions are
15285 normally enabled by default. If implementations that lack the
15286 extension exist, then the extension syntax can be used to disable
15287 those extensions that have been omitted. For floating-point and
15288 Advanced SIMD (Neon) instructions, the settings of the options
15289 -mfloat-abi and -mfpu must also be considered: floating-point and
15290 Advanced SIMD instructions will only be used if -mfloat-abi is not
15291 set to soft; and any setting of -mfpu other than auto will override
15292 the available floating-point and SIMD extension instructions.
15293
15294 For example, cortex-a9 can be found in three major configurations:
15295 integer only, with just a floating-point unit or with floating-
15296 point and Advanced SIMD. The default is to enable all the
15297 instructions, but the extensions +nosimd and +nofp can be used to
15298 disable just the SIMD or both the SIMD and floating-point
15299 instructions respectively.
15300
15301 Permissible names for this option are the same as those for -mtune.
15302
15303 The following extension options are common to the listed CPUs:
15304
15305 +nodsp
15306 Disable the DSP instructions on cortex-m33.
15307
15308 +nofp
15309 Disables the floating-point instructions on arm9e, arm946e-s,
15310 arm966e-s, arm968e-s, arm10e, arm1020e, arm1022e, arm926ej-s,
15311 arm1026ej-s, cortex-r5, cortex-r7, cortex-r8, cortex-m4,
15312 cortex-m7 and cortex-m33. Disables the floating-point and SIMD
15313 instructions on generic-armv7-a, cortex-a5, cortex-a7,
15314 cortex-a8, cortex-a9, cortex-a12, cortex-a15, cortex-a17,
15315 cortex-a15.cortex-a7, cortex-a17.cortex-a7, cortex-a32,
15316 cortex-a35, cortex-a53 and cortex-a55.
15317
15318 +nofp.dp
15319 Disables the double-precision component of the floating-point
15320 instructions on cortex-r5, cortex-r7, cortex-r8, cortex-r52 and
15321 cortex-m7.
15322
15323 +nosimd
15324 Disables the SIMD (but not floating-point) instructions on
15325 generic-armv7-a, cortex-a5, cortex-a7 and cortex-a9.
15326
15327 +crypto
15328 Enables the cryptographic instructions on cortex-a32,
15329 cortex-a35, cortex-a53, cortex-a55, cortex-a57, cortex-a72,
15330 cortex-a73, cortex-a75, exynos-m1, xgene1,
15331 cortex-a57.cortex-a53, cortex-a72.cortex-a53,
15332 cortex-a73.cortex-a35, cortex-a73.cortex-a53 and
15333 cortex-a75.cortex-a55.
15334
15335 Additionally the generic-armv7-a pseudo target defaults to VFPv3
15336 with 16 double-precision registers. It supports the following
15337 extension options: mp, sec, vfpv3-d16, vfpv3, vfpv3-d16-fp16,
15338 vfpv3-fp16, vfpv4-d16, vfpv4, neon, neon-vfpv3, neon-fp16,
15339 neon-vfpv4. The meanings are the same as for the extensions to
15340 -march=armv7-a.
15341
15342 -mcpu=generic-arch is also permissible, and is equivalent to
15343 -march=arch -mtune=generic-arch. See -mtune for more information.
15344
15345 -mcpu=native causes the compiler to auto-detect the CPU of the
15346 build computer. At present, this feature is only supported on
15347 GNU/Linux, and not all architectures are recognized. If the auto-
15348 detect is unsuccessful the option has no effect.
15349
15350 -mfpu=name
15351 This specifies what floating-point hardware (or hardware emulation)
15352 is available on the target. Permissible names are: auto, vfpv2,
15353 vfpv3, vfpv3-fp16, vfpv3-d16, vfpv3-d16-fp16, vfpv3xd,
15354 vfpv3xd-fp16, neon-vfpv3, neon-fp16, vfpv4, vfpv4-d16, fpv4-sp-d16,
15355 neon-vfpv4, fpv5-d16, fpv5-sp-d16, fp-armv8, neon-fp-armv8 and
15356 crypto-neon-fp-armv8. Note that neon is an alias for neon-vfpv3
15357 and vfp is an alias for vfpv2.
15358
15359 The setting auto is the default and is special. It causes the
15360 compiler to select the floating-point and Advanced SIMD
15361 instructions based on the settings of -mcpu and -march.
15362
15363 If the selected floating-point hardware includes the NEON extension
15364 (e.g. -mfpu=neon), note that floating-point operations are not
15365 generated by GCC's auto-vectorization pass unless
15366 -funsafe-math-optimizations is also specified. This is because
15367 NEON hardware does not fully implement the IEEE 754 standard for
15368 floating-point arithmetic (in particular denormal values are
15369 treated as zero), so the use of NEON instructions may lead to a
15370 loss of precision.
15371
15372 You can also set the fpu name at function level by using the
15373 "target("fpu=")" function attributes or pragmas.
15374
15375 -mfp16-format=name
15376 Specify the format of the "__fp16" half-precision floating-point
15377 type. Permissible names are none, ieee, and alternative; the
15378 default is none, in which case the "__fp16" type is not defined.
15379
15380 -mstructure-size-boundary=n
15381 The sizes of all structures and unions are rounded up to a multiple
15382 of the number of bits set by this option. Permissible values are
15383 8, 32 and 64. The default value varies for different toolchains.
15384 For the COFF targeted toolchain the default value is 8. A value of
15385 64 is only allowed if the underlying ABI supports it.
15386
15387 Specifying a larger number can produce faster, more efficient code,
15388 but can also increase the size of the program. Different values
15389 are potentially incompatible. Code compiled with one value cannot
15390 necessarily expect to work with code or libraries compiled with
15391 another value, if they exchange information using structures or
15392 unions.
15393
15394 This option is deprecated.
15395
15396 -mabort-on-noreturn
15397 Generate a call to the function "abort" at the end of a "noreturn"
15398 function. It is executed if the function tries to return.
15399
15400 -mlong-calls
15401 -mno-long-calls
15402 Tells the compiler to perform function calls by first loading the
15403 address of the function into a register and then performing a
15404 subroutine call on this register. This switch is needed if the
15405 target function lies outside of the 64-megabyte addressing range of
15406 the offset-based version of subroutine call instruction.
15407
15408 Even if this switch is enabled, not all function calls are turned
15409 into long calls. The heuristic is that static functions, functions
15410 that have the "short_call" attribute, functions that are inside the
15411 scope of a "#pragma no_long_calls" directive, and functions whose
15412 definitions have already been compiled within the current
15413 compilation unit are not turned into long calls. The exceptions to
15414 this rule are that weak function definitions, functions with the
15415 "long_call" attribute or the "section" attribute, and functions
15416 that are within the scope of a "#pragma long_calls" directive are
15417 always turned into long calls.
15418
15419 This feature is not enabled by default. Specifying -mno-long-calls
15420 restores the default behavior, as does placing the function calls
15421 within the scope of a "#pragma long_calls_off" directive. Note
15422 these switches have no effect on how the compiler generates code to
15423 handle function calls via function pointers.
15424
15425 -msingle-pic-base
15426 Treat the register used for PIC addressing as read-only, rather
15427 than loading it in the prologue for each function. The runtime
15428 system is responsible for initializing this register with an
15429 appropriate value before execution begins.
15430
15431 -mpic-register=reg
15432 Specify the register to be used for PIC addressing. For standard
15433 PIC base case, the default is any suitable register determined by
15434 compiler. For single PIC base case, the default is R9 if target is
15435 EABI based or stack-checking is enabled, otherwise the default is
15436 R10.
15437
15438 -mpic-data-is-text-relative
15439 Assume that the displacement between the text and data segments is
15440 fixed at static link time. This permits using PC-relative
15441 addressing operations to access data known to be in the data
15442 segment. For non-VxWorks RTP targets, this option is enabled by
15443 default. When disabled on such targets, it will enable
15444 -msingle-pic-base by default.
15445
15446 -mpoke-function-name
15447 Write the name of each function into the text section, directly
15448 preceding the function prologue. The generated code is similar to
15449 this:
15450
15451 t0
15452 .ascii "arm_poke_function_name", 0
15453 .align
15454 t1
15455 .word 0xff000000 + (t1 - t0)
15456 arm_poke_function_name
15457 mov ip, sp
15458 stmfd sp!, {fp, ip, lr, pc}
15459 sub fp, ip, #4
15460
15461 When performing a stack backtrace, code can inspect the value of
15462 "pc" stored at "fp + 0". If the trace function then looks at
15463 location "pc - 12" and the top 8 bits are set, then we know that
15464 there is a function name embedded immediately preceding this
15465 location and has length "((pc[-3]) & 0xff000000)".
15466
15467 -mthumb
15468 -marm
15469 Select between generating code that executes in ARM and Thumb
15470 states. The default for most configurations is to generate code
15471 that executes in ARM state, but the default can be changed by
15472 configuring GCC with the --with-mode=state configure option.
15473
15474 You can also override the ARM and Thumb mode for each function by
15475 using the "target("thumb")" and "target("arm")" function attributes
15476 or pragmas.
15477
15478 -mflip-thumb
15479 Switch ARM/Thumb modes on alternating functions. This option is
15480 provided for regression testing of mixed Thumb/ARM code generation,
15481 and is not intended for ordinary use in compiling code.
15482
15483 -mtpcs-frame
15484 Generate a stack frame that is compliant with the Thumb Procedure
15485 Call Standard for all non-leaf functions. (A leaf function is one
15486 that does not call any other functions.) The default is
15487 -mno-tpcs-frame.
15488
15489 -mtpcs-leaf-frame
15490 Generate a stack frame that is compliant with the Thumb Procedure
15491 Call Standard for all leaf functions. (A leaf function is one that
15492 does not call any other functions.) The default is
15493 -mno-apcs-leaf-frame.
15494
15495 -mcallee-super-interworking
15496 Gives all externally visible functions in the file being compiled
15497 an ARM instruction set header which switches to Thumb mode before
15498 executing the rest of the function. This allows these functions to
15499 be called from non-interworking code. This option is not valid in
15500 AAPCS configurations because interworking is enabled by default.
15501
15502 -mcaller-super-interworking
15503 Allows calls via function pointers (including virtual functions) to
15504 execute correctly regardless of whether the target code has been
15505 compiled for interworking or not. There is a small overhead in the
15506 cost of executing a function pointer if this option is enabled.
15507 This option is not valid in AAPCS configurations because
15508 interworking is enabled by default.
15509
15510 -mtp=name
15511 Specify the access model for the thread local storage pointer. The
15512 valid models are soft, which generates calls to "__aeabi_read_tp",
15513 cp15, which fetches the thread pointer from "cp15" directly
15514 (supported in the arm6k architecture), and auto, which uses the
15515 best available method for the selected processor. The default
15516 setting is auto.
15517
15518 -mtls-dialect=dialect
15519 Specify the dialect to use for accessing thread local storage. Two
15520 dialects are supported---gnu and gnu2. The gnu dialect selects the
15521 original GNU scheme for supporting local and global dynamic TLS
15522 models. The gnu2 dialect selects the GNU descriptor scheme, which
15523 provides better performance for shared libraries. The GNU
15524 descriptor scheme is compatible with the original scheme, but does
15525 require new assembler, linker and library support. Initial and
15526 local exec TLS models are unaffected by this option and always use
15527 the original scheme.
15528
15529 -mword-relocations
15530 Only generate absolute relocations on word-sized values (i.e.
15531 R_ARM_ABS32). This is enabled by default on targets (uClinux,
15532 SymbianOS) where the runtime loader imposes this restriction, and
15533 when -fpic or -fPIC is specified. This option conflicts with
15534 -mslow-flash-data.
15535
15536 -mfix-cortex-m3-ldrd
15537 Some Cortex-M3 cores can cause data corruption when "ldrd"
15538 instructions with overlapping destination and base registers are
15539 used. This option avoids generating these instructions. This
15540 option is enabled by default when -mcpu=cortex-m3 is specified.
15541
15542 -munaligned-access
15543 -mno-unaligned-access
15544 Enables (or disables) reading and writing of 16- and 32- bit values
15545 from addresses that are not 16- or 32- bit aligned. By default
15546 unaligned access is disabled for all pre-ARMv6, all ARMv6-M and for
15547 ARMv8-M Baseline architectures, and enabled for all other
15548 architectures. If unaligned access is not enabled then words in
15549 packed data structures are accessed a byte at a time.
15550
15551 The ARM attribute "Tag_CPU_unaligned_access" is set in the
15552 generated object file to either true or false, depending upon the
15553 setting of this option. If unaligned access is enabled then the
15554 preprocessor symbol "__ARM_FEATURE_UNALIGNED" is also defined.
15555
15556 -mneon-for-64bits
15557 Enables using Neon to handle scalar 64-bits operations. This is
15558 disabled by default since the cost of moving data from core
15559 registers to Neon is high.
15560
15561 -mslow-flash-data
15562 Assume loading data from flash is slower than fetching instruction.
15563 Therefore literal load is minimized for better performance. This
15564 option is only supported when compiling for ARMv7 M-profile and off
15565 by default. It conflicts with -mword-relocations.
15566
15567 -masm-syntax-unified
15568 Assume inline assembler is using unified asm syntax. The default
15569 is currently off which implies divided syntax. This option has no
15570 impact on Thumb2. However, this may change in future releases of
15571 GCC. Divided syntax should be considered deprecated.
15572
15573 -mrestrict-it
15574 Restricts generation of IT blocks to conform to the rules of
15575 ARMv8-A. IT blocks can only contain a single 16-bit instruction
15576 from a select set of instructions. This option is on by default for
15577 ARMv8-A Thumb mode.
15578
15579 -mprint-tune-info
15580 Print CPU tuning information as comment in assembler file. This is
15581 an option used only for regression testing of the compiler and not
15582 intended for ordinary use in compiling code. This option is
15583 disabled by default.
15584
15585 -mverbose-cost-dump
15586 Enable verbose cost model dumping in the debug dump files. This
15587 option is provided for use in debugging the compiler.
15588
15589 -mpure-code
15590 Do not allow constant data to be placed in code sections.
15591 Additionally, when compiling for ELF object format give all text
15592 sections the ELF processor-specific section attribute
15593 "SHF_ARM_PURECODE". This option is only available when generating
15594 non-pic code for M-profile targets with the MOVT instruction.
15595
15596 -mcmse
15597 Generate secure code as per the "ARMv8-M Security Extensions:
15598 Requirements on Development Tools Engineering Specification", which
15599 can be found on
15600 <http://infocenter.arm.com/help/topic/com.arm.doc.ecm0359818/ECM0359818_armv8m_security_extensions_reqs_on_dev_tools_1_0.pdf>.
15601
15602 AVR Options
15603 These options are defined for AVR implementations:
15604
15605 -mmcu=mcu
15606 Specify Atmel AVR instruction set architectures (ISA) or MCU type.
15607
15608 The default for this option is@tie{}avr2.
15609
15610 GCC supports the following AVR devices and ISAs:
15611
15612 "avr2"
15613 "Classic" devices with up to 8@tie{}KiB of program memory.
15614 mcu@tie{}= "attiny22", "attiny26", "at90c8534", "at90s2313",
15615 "at90s2323", "at90s2333", "at90s2343", "at90s4414",
15616 "at90s4433", "at90s4434", "at90s8515", "at90s8535".
15617
15618 "avr25"
15619 "Classic" devices with up to 8@tie{}KiB of program memory and
15620 with the "MOVW" instruction. mcu@tie{}= "ata5272", "ata6616c",
15621 "attiny13", "attiny13a", "attiny2313", "attiny2313a",
15622 "attiny24", "attiny24a", "attiny25", "attiny261", "attiny261a",
15623 "attiny43u", "attiny4313", "attiny44", "attiny44a",
15624 "attiny441", "attiny45", "attiny461", "attiny461a", "attiny48",
15625 "attiny828", "attiny84", "attiny84a", "attiny841", "attiny85",
15626 "attiny861", "attiny861a", "attiny87", "attiny88", "at86rf401".
15627
15628 "avr3"
15629 "Classic" devices with 16@tie{}KiB up to 64@tie{}KiB of
15630 program memory. mcu@tie{}= "at43usb355", "at76c711".
15631
15632 "avr31"
15633 "Classic" devices with 128@tie{}KiB of program memory.
15634 mcu@tie{}= "atmega103", "at43usb320".
15635
15636 "avr35"
15637 "Classic" devices with 16@tie{}KiB up to 64@tie{}KiB of program
15638 memory and with the "MOVW" instruction. mcu@tie{}= "ata5505",
15639 "ata6617c", "ata664251", "atmega16u2", "atmega32u2",
15640 "atmega8u2", "attiny1634", "attiny167", "at90usb162",
15641 "at90usb82".
15642
15643 "avr4"
15644 "Enhanced" devices with up to 8@tie{}KiB of program memory.
15645 mcu@tie{}= "ata6285", "ata6286", "ata6289", "ata6612c",
15646 "atmega48", "atmega48a", "atmega48p", "atmega48pa",
15647 "atmega48pb", "atmega8", "atmega8a", "atmega8hva",
15648 "atmega8515", "atmega8535", "atmega88", "atmega88a",
15649 "atmega88p", "atmega88pa", "atmega88pb", "at90pwm1",
15650 "at90pwm2", "at90pwm2b", "at90pwm3", "at90pwm3b", "at90pwm81".
15651
15652 "avr5"
15653 "Enhanced" devices with 16@tie{}KiB up to 64@tie{}KiB of
15654 program memory. mcu@tie{}= "ata5702m322", "ata5782",
15655 "ata5790", "ata5790n", "ata5791", "ata5795", "ata5831",
15656 "ata6613c", "ata6614q", "ata8210", "ata8510", "atmega16",
15657 "atmega16a", "atmega16hva", "atmega16hva2", "atmega16hvb",
15658 "atmega16hvbrevb", "atmega16m1", "atmega16u4", "atmega161",
15659 "atmega162", "atmega163", "atmega164a", "atmega164p",
15660 "atmega164pa", "atmega165", "atmega165a", "atmega165p",
15661 "atmega165pa", "atmega168", "atmega168a", "atmega168p",
15662 "atmega168pa", "atmega168pb", "atmega169", "atmega169a",
15663 "atmega169p", "atmega169pa", "atmega32", "atmega32a",
15664 "atmega32c1", "atmega32hvb", "atmega32hvbrevb", "atmega32m1",
15665 "atmega32u4", "atmega32u6", "atmega323", "atmega324a",
15666 "atmega324p", "atmega324pa", "atmega325", "atmega325a",
15667 "atmega325p", "atmega325pa", "atmega3250", "atmega3250a",
15668 "atmega3250p", "atmega3250pa", "atmega328", "atmega328p",
15669 "atmega328pb", "atmega329", "atmega329a", "atmega329p",
15670 "atmega329pa", "atmega3290", "atmega3290a", "atmega3290p",
15671 "atmega3290pa", "atmega406", "atmega64", "atmega64a",
15672 "atmega64c1", "atmega64hve", "atmega64hve2", "atmega64m1",
15673 "atmega64rfr2", "atmega640", "atmega644", "atmega644a",
15674 "atmega644p", "atmega644pa", "atmega644rfr2", "atmega645",
15675 "atmega645a", "atmega645p", "atmega6450", "atmega6450a",
15676 "atmega6450p", "atmega649", "atmega649a", "atmega649p",
15677 "atmega6490", "atmega6490a", "atmega6490p", "at90can32",
15678 "at90can64", "at90pwm161", "at90pwm216", "at90pwm316",
15679 "at90scr100", "at90usb646", "at90usb647", "at94k", "m3000".
15680
15681 "avr51"
15682 "Enhanced" devices with 128@tie{}KiB of program memory.
15683 mcu@tie{}= "atmega128", "atmega128a", "atmega128rfa1",
15684 "atmega128rfr2", "atmega1280", "atmega1281", "atmega1284",
15685 "atmega1284p", "atmega1284rfr2", "at90can128", "at90usb1286",
15686 "at90usb1287".
15687
15688 "avr6"
15689 "Enhanced" devices with 3-byte PC, i.e. with more than
15690 128@tie{}KiB of program memory. mcu@tie{}= "atmega256rfr2",
15691 "atmega2560", "atmega2561", "atmega2564rfr2".
15692
15693 "avrxmega2"
15694 "XMEGA" devices with more than 8@tie{}KiB and up to 64@tie{}KiB
15695 of program memory. mcu@tie{}= "atxmega16a4", "atxmega16a4u",
15696 "atxmega16c4", "atxmega16d4", "atxmega16e5", "atxmega32a4",
15697 "atxmega32a4u", "atxmega32c3", "atxmega32c4", "atxmega32d3",
15698 "atxmega32d4", "atxmega32e5", "atxmega8e5".
15699
15700 "avrxmega3"
15701 "XMEGA" devices with up to 64@tie{}KiB of combined program
15702 memory and RAM, and with program memory visible in the RAM
15703 address space. mcu@tie{}= "attiny1614", "attiny1616",
15704 "attiny1617", "attiny212", "attiny214", "attiny3214",
15705 "attiny3216", "attiny3217", "attiny412", "attiny414",
15706 "attiny416", "attiny417", "attiny814", "attiny816",
15707 "attiny817".
15708
15709 "avrxmega4"
15710 "XMEGA" devices with more than 64@tie{}KiB and up to
15711 128@tie{}KiB of program memory. mcu@tie{}= "atxmega64a3",
15712 "atxmega64a3u", "atxmega64a4u", "atxmega64b1", "atxmega64b3",
15713 "atxmega64c3", "atxmega64d3", "atxmega64d4".
15714
15715 "avrxmega5"
15716 "XMEGA" devices with more than 64@tie{}KiB and up to
15717 128@tie{}KiB of program memory and more than 64@tie{}KiB of
15718 RAM. mcu@tie{}= "atxmega64a1", "atxmega64a1u".
15719
15720 "avrxmega6"
15721 "XMEGA" devices with more than 128@tie{}KiB of program memory.
15722 mcu@tie{}= "atxmega128a3", "atxmega128a3u", "atxmega128b1",
15723 "atxmega128b3", "atxmega128c3", "atxmega128d3", "atxmega128d4",
15724 "atxmega192a3", "atxmega192a3u", "atxmega192c3",
15725 "atxmega192d3", "atxmega256a3", "atxmega256a3b",
15726 "atxmega256a3bu", "atxmega256a3u", "atxmega256c3",
15727 "atxmega256d3", "atxmega384c3", "atxmega384d3".
15728
15729 "avrxmega7"
15730 "XMEGA" devices with more than 128@tie{}KiB of program memory
15731 and more than 64@tie{}KiB of RAM. mcu@tie{}= "atxmega128a1",
15732 "atxmega128a1u", "atxmega128a4u".
15733
15734 "avrtiny"
15735 "TINY" Tiny core devices with 512@tie{}B up to 4@tie{}KiB of
15736 program memory. mcu@tie{}= "attiny10", "attiny20", "attiny4",
15737 "attiny40", "attiny5", "attiny9".
15738
15739 "avr1"
15740 This ISA is implemented by the minimal AVR core and supported
15741 for assembler only. mcu@tie{}= "attiny11", "attiny12",
15742 "attiny15", "attiny28", "at90s1200".
15743
15744 -mabsdata
15745 Assume that all data in static storage can be accessed by LDS / STS
15746 instructions. This option has only an effect on reduced Tiny
15747 devices like ATtiny40. See also the "absdata" AVR Variable
15748 Attributes,variable attribute.
15749
15750 -maccumulate-args
15751 Accumulate outgoing function arguments and acquire/release the
15752 needed stack space for outgoing function arguments once in function
15753 prologue/epilogue. Without this option, outgoing arguments are
15754 pushed before calling a function and popped afterwards.
15755
15756 Popping the arguments after the function call can be expensive on
15757 AVR so that accumulating the stack space might lead to smaller
15758 executables because arguments need not be removed from the stack
15759 after such a function call.
15760
15761 This option can lead to reduced code size for functions that
15762 perform several calls to functions that get their arguments on the
15763 stack like calls to printf-like functions.
15764
15765 -mbranch-cost=cost
15766 Set the branch costs for conditional branch instructions to cost.
15767 Reasonable values for cost are small, non-negative integers. The
15768 default branch cost is 0.
15769
15770 -mcall-prologues
15771 Functions prologues/epilogues are expanded as calls to appropriate
15772 subroutines. Code size is smaller.
15773
15774 -mgas-isr-prologues
15775 Interrupt service routines (ISRs) may use the "__gcc_isr" pseudo
15776 instruction supported by GNU Binutils. If this option is on, the
15777 feature can still be disabled for individual ISRs by means of the
15778 AVR Function Attributes,,"no_gccisr" function attribute. This
15779 feature is activated per default if optimization is on (but not
15780 with -Og, @pxref{Optimize Options}), and if GNU Binutils support
15781 PR21683 ("https://sourceware.org/PR21683").
15782
15783 -mint8
15784 Assume "int" to be 8-bit integer. This affects the sizes of all
15785 types: a "char" is 1 byte, an "int" is 1 byte, a "long" is 2 bytes,
15786 and "long long" is 4 bytes. Please note that this option does not
15787 conform to the C standards, but it results in smaller code size.
15788
15789 -mmain-is-OS_task
15790 Do not save registers in "main". The effect is the same like
15791 attaching attribute AVR Function Attributes,,"OS_task" to "main".
15792 It is activated per default if optimization is on.
15793
15794 -mn-flash=num
15795 Assume that the flash memory has a size of num times 64@tie{}KiB.
15796
15797 -mno-interrupts
15798 Generated code is not compatible with hardware interrupts. Code
15799 size is smaller.
15800
15801 -mrelax
15802 Try to replace "CALL" resp. "JMP" instruction by the shorter
15803 "RCALL" resp. "RJMP" instruction if applicable. Setting -mrelax
15804 just adds the --mlink-relax option to the assembler's command line
15805 and the --relax option to the linker's command line.
15806
15807 Jump relaxing is performed by the linker because jump offsets are
15808 not known before code is located. Therefore, the assembler code
15809 generated by the compiler is the same, but the instructions in the
15810 executable may differ from instructions in the assembler code.
15811
15812 Relaxing must be turned on if linker stubs are needed, see the
15813 section on "EIND" and linker stubs below.
15814
15815 -mrmw
15816 Assume that the device supports the Read-Modify-Write instructions
15817 "XCH", "LAC", "LAS" and "LAT".
15818
15819 -mshort-calls
15820 Assume that "RJMP" and "RCALL" can target the whole program memory.
15821
15822 This option is used internally for multilib selection. It is not
15823 an optimization option, and you don't need to set it by hand.
15824
15825 -msp8
15826 Treat the stack pointer register as an 8-bit register, i.e. assume
15827 the high byte of the stack pointer is zero. In general, you don't
15828 need to set this option by hand.
15829
15830 This option is used internally by the compiler to select and build
15831 multilibs for architectures "avr2" and "avr25". These
15832 architectures mix devices with and without "SPH". For any setting
15833 other than -mmcu=avr2 or -mmcu=avr25 the compiler driver adds or
15834 removes this option from the compiler proper's command line,
15835 because the compiler then knows if the device or architecture has
15836 an 8-bit stack pointer and thus no "SPH" register or not.
15837
15838 -mstrict-X
15839 Use address register "X" in a way proposed by the hardware. This
15840 means that "X" is only used in indirect, post-increment or pre-
15841 decrement addressing.
15842
15843 Without this option, the "X" register may be used in the same way
15844 as "Y" or "Z" which then is emulated by additional instructions.
15845 For example, loading a value with "X+const" addressing with a small
15846 non-negative "const < 64" to a register Rn is performed as
15847
15848 adiw r26, const ; X += const
15849 ld <Rn>, X ; <Rn> = *X
15850 sbiw r26, const ; X -= const
15851
15852 -mtiny-stack
15853 Only change the lower 8@tie{}bits of the stack pointer.
15854
15855 -mfract-convert-truncate
15856 Allow to use truncation instead of rounding towards zero for
15857 fractional fixed-point types.
15858
15859 -nodevicelib
15860 Don't link against AVR-LibC's device specific library "lib<mcu>.a".
15861
15862 -Waddr-space-convert
15863 Warn about conversions between address spaces in the case where the
15864 resulting address space is not contained in the incoming address
15865 space.
15866
15867 -Wmisspelled-isr
15868 Warn if the ISR is misspelled, i.e. without __vector prefix.
15869 Enabled by default.
15870
15871 "EIND" and Devices with More Than 128 Ki Bytes of Flash
15872
15873 Pointers in the implementation are 16@tie{}bits wide. The address of a
15874 function or label is represented as word address so that indirect jumps
15875 and calls can target any code address in the range of 64@tie{}Ki words.
15876
15877 In order to facilitate indirect jump on devices with more than
15878 128@tie{}Ki bytes of program memory space, there is a special function
15879 register called "EIND" that serves as most significant part of the
15880 target address when "EICALL" or "EIJMP" instructions are used.
15881
15882 Indirect jumps and calls on these devices are handled as follows by the
15883 compiler and are subject to some limitations:
15884
15885 * The compiler never sets "EIND".
15886
15887 * The compiler uses "EIND" implicitly in "EICALL"/"EIJMP"
15888 instructions or might read "EIND" directly in order to emulate an
15889 indirect call/jump by means of a "RET" instruction.
15890
15891 * The compiler assumes that "EIND" never changes during the startup
15892 code or during the application. In particular, "EIND" is not
15893 saved/restored in function or interrupt service routine
15894 prologue/epilogue.
15895
15896 * For indirect calls to functions and computed goto, the linker
15897 generates stubs. Stubs are jump pads sometimes also called
15898 trampolines. Thus, the indirect call/jump jumps to such a stub.
15899 The stub contains a direct jump to the desired address.
15900
15901 * Linker relaxation must be turned on so that the linker generates
15902 the stubs correctly in all situations. See the compiler option
15903 -mrelax and the linker option --relax. There are corner cases
15904 where the linker is supposed to generate stubs but aborts without
15905 relaxation and without a helpful error message.
15906
15907 * The default linker script is arranged for code with "EIND = 0". If
15908 code is supposed to work for a setup with "EIND != 0", a custom
15909 linker script has to be used in order to place the sections whose
15910 name start with ".trampolines" into the segment where "EIND" points
15911 to.
15912
15913 * The startup code from libgcc never sets "EIND". Notice that
15914 startup code is a blend of code from libgcc and AVR-LibC. For the
15915 impact of AVR-LibC on "EIND", see the AVR-LibC user manual
15916 ("http://nongnu.org/avr-libc/user-manual/").
15917
15918 * It is legitimate for user-specific startup code to set up "EIND"
15919 early, for example by means of initialization code located in
15920 section ".init3". Such code runs prior to general startup code that
15921 initializes RAM and calls constructors, but after the bit of
15922 startup code from AVR-LibC that sets "EIND" to the segment where
15923 the vector table is located.
15924
15925 #include <avr/io.h>
15926
15927 static void
15928 __attribute__((section(".init3"),naked,used,no_instrument_function))
15929 init3_set_eind (void)
15930 {
15931 __asm volatile ("ldi r24,pm_hh8(__trampolines_start)\n\t"
15932 "out %i0,r24" :: "n" (&EIND) : "r24","memory");
15933 }
15934
15935 The "__trampolines_start" symbol is defined in the linker script.
15936
15937 * Stubs are generated automatically by the linker if the following
15938 two conditions are met:
15939
15940 -<The address of a label is taken by means of the "gs" modifier>
15941 (short for generate stubs) like so:
15942
15943 LDI r24, lo8(gs(<func>))
15944 LDI r25, hi8(gs(<func>))
15945
15946 -<The final location of that label is in a code segment>
15947 outside the segment where the stubs are located.
15948
15949 * The compiler emits such "gs" modifiers for code labels in the
15950 following situations:
15951
15952 -<Taking address of a function or code label.>
15953 -<Computed goto.>
15954 -<If prologue-save function is used, see -mcall-prologues>
15955 command-line option.
15956
15957 -<Switch/case dispatch tables. If you do not want such dispatch>
15958 tables you can specify the -fno-jump-tables command-line
15959 option.
15960
15961 -<C and C++ constructors/destructors called during
15962 startup/shutdown.>
15963 -<If the tools hit a "gs()" modifier explained above.>
15964 * Jumping to non-symbolic addresses like so is not supported:
15965
15966 int main (void)
15967 {
15968 /* Call function at word address 0x2 */
15969 return ((int(*)(void)) 0x2)();
15970 }
15971
15972 Instead, a stub has to be set up, i.e. the function has to be
15973 called through a symbol ("func_4" in the example):
15974
15975 int main (void)
15976 {
15977 extern int func_4 (void);
15978
15979 /* Call function at byte address 0x4 */
15980 return func_4();
15981 }
15982
15983 and the application be linked with -Wl,--defsym,func_4=0x4.
15984 Alternatively, "func_4" can be defined in the linker script.
15985
15986 Handling of the "RAMPD", "RAMPX", "RAMPY" and "RAMPZ" Special Function
15987 Registers
15988
15989 Some AVR devices support memories larger than the 64@tie{}KiB range
15990 that can be accessed with 16-bit pointers. To access memory locations
15991 outside this 64@tie{}KiB range, the content of a "RAMP" register is
15992 used as high part of the address: The "X", "Y", "Z" address register is
15993 concatenated with the "RAMPX", "RAMPY", "RAMPZ" special function
15994 register, respectively, to get a wide address. Similarly, "RAMPD" is
15995 used together with direct addressing.
15996
15997 * The startup code initializes the "RAMP" special function registers
15998 with zero.
15999
16000 * If a AVR Named Address Spaces,named address space other than
16001 generic or "__flash" is used, then "RAMPZ" is set as needed before
16002 the operation.
16003
16004 * If the device supports RAM larger than 64@tie{}KiB and the compiler
16005 needs to change "RAMPZ" to accomplish an operation, "RAMPZ" is
16006 reset to zero after the operation.
16007
16008 * If the device comes with a specific "RAMP" register, the ISR
16009 prologue/epilogue saves/restores that SFR and initializes it with
16010 zero in case the ISR code might (implicitly) use it.
16011
16012 * RAM larger than 64@tie{}KiB is not supported by GCC for AVR
16013 targets. If you use inline assembler to read from locations
16014 outside the 16-bit address range and change one of the "RAMP"
16015 registers, you must reset it to zero after the access.
16016
16017 AVR Built-in Macros
16018
16019 GCC defines several built-in macros so that the user code can test for
16020 the presence or absence of features. Almost any of the following
16021 built-in macros are deduced from device capabilities and thus triggered
16022 by the -mmcu= command-line option.
16023
16024 For even more AVR-specific built-in macros see AVR Named Address Spaces
16025 and AVR Built-in Functions.
16026
16027 "__AVR_ARCH__"
16028 Build-in macro that resolves to a decimal number that identifies
16029 the architecture and depends on the -mmcu=mcu option. Possible
16030 values are:
16031
16032 2, 25, 3, 31, 35, 4, 5, 51, 6
16033
16034 for mcu="avr2", "avr25", "avr3", "avr31", "avr35", "avr4", "avr5",
16035 "avr51", "avr6",
16036
16037 respectively and
16038
16039 100, 102, 103, 104, 105, 106, 107
16040
16041 for mcu="avrtiny", "avrxmega2", "avrxmega3", "avrxmega4",
16042 "avrxmega5", "avrxmega6", "avrxmega7", respectively. If mcu
16043 specifies a device, this built-in macro is set accordingly. For
16044 example, with -mmcu=atmega8 the macro is defined to 4.
16045
16046 "__AVR_Device__"
16047 Setting -mmcu=device defines this built-in macro which reflects the
16048 device's name. For example, -mmcu=atmega8 defines the built-in
16049 macro "__AVR_ATmega8__", -mmcu=attiny261a defines
16050 "__AVR_ATtiny261A__", etc.
16051
16052 The built-in macros' names follow the scheme "__AVR_Device__" where
16053 Device is the device name as from the AVR user manual. The
16054 difference between Device in the built-in macro and device in
16055 -mmcu=device is that the latter is always lowercase.
16056
16057 If device is not a device but only a core architecture like avr51,
16058 this macro is not defined.
16059
16060 "__AVR_DEVICE_NAME__"
16061 Setting -mmcu=device defines this built-in macro to the device's
16062 name. For example, with -mmcu=atmega8 the macro is defined to
16063 "atmega8".
16064
16065 If device is not a device but only a core architecture like avr51,
16066 this macro is not defined.
16067
16068 "__AVR_XMEGA__"
16069 The device / architecture belongs to the XMEGA family of devices.
16070
16071 "__AVR_HAVE_ELPM__"
16072 The device has the "ELPM" instruction.
16073
16074 "__AVR_HAVE_ELPMX__"
16075 The device has the "ELPM Rn,Z" and "ELPM Rn,Z+" instructions.
16076
16077 "__AVR_HAVE_MOVW__"
16078 The device has the "MOVW" instruction to perform 16-bit register-
16079 register moves.
16080
16081 "__AVR_HAVE_LPMX__"
16082 The device has the "LPM Rn,Z" and "LPM Rn,Z+" instructions.
16083
16084 "__AVR_HAVE_MUL__"
16085 The device has a hardware multiplier.
16086
16087 "__AVR_HAVE_JMP_CALL__"
16088 The device has the "JMP" and "CALL" instructions. This is the case
16089 for devices with more than 8@tie{}KiB of program memory.
16090
16091 "__AVR_HAVE_EIJMP_EICALL__"
16092 "__AVR_3_BYTE_PC__"
16093 The device has the "EIJMP" and "EICALL" instructions. This is the
16094 case for devices with more than 128@tie{}KiB of program memory.
16095 This also means that the program counter (PC) is 3@tie{}bytes wide.
16096
16097 "__AVR_2_BYTE_PC__"
16098 The program counter (PC) is 2@tie{}bytes wide. This is the case for
16099 devices with up to 128@tie{}KiB of program memory.
16100
16101 "__AVR_HAVE_8BIT_SP__"
16102 "__AVR_HAVE_16BIT_SP__"
16103 The stack pointer (SP) register is treated as 8-bit respectively
16104 16-bit register by the compiler. The definition of these macros is
16105 affected by -mtiny-stack.
16106
16107 "__AVR_HAVE_SPH__"
16108 "__AVR_SP8__"
16109 The device has the SPH (high part of stack pointer) special
16110 function register or has an 8-bit stack pointer, respectively. The
16111 definition of these macros is affected by -mmcu= and in the cases
16112 of -mmcu=avr2 and -mmcu=avr25 also by -msp8.
16113
16114 "__AVR_HAVE_RAMPD__"
16115 "__AVR_HAVE_RAMPX__"
16116 "__AVR_HAVE_RAMPY__"
16117 "__AVR_HAVE_RAMPZ__"
16118 The device has the "RAMPD", "RAMPX", "RAMPY", "RAMPZ" special
16119 function register, respectively.
16120
16121 "__NO_INTERRUPTS__"
16122 This macro reflects the -mno-interrupts command-line option.
16123
16124 "__AVR_ERRATA_SKIP__"
16125 "__AVR_ERRATA_SKIP_JMP_CALL__"
16126 Some AVR devices (AT90S8515, ATmega103) must not skip 32-bit
16127 instructions because of a hardware erratum. Skip instructions are
16128 "SBRS", "SBRC", "SBIS", "SBIC" and "CPSE". The second macro is
16129 only defined if "__AVR_HAVE_JMP_CALL__" is also set.
16130
16131 "__AVR_ISA_RMW__"
16132 The device has Read-Modify-Write instructions (XCH, LAC, LAS and
16133 LAT).
16134
16135 "__AVR_SFR_OFFSET__=offset"
16136 Instructions that can address I/O special function registers
16137 directly like "IN", "OUT", "SBI", etc. may use a different address
16138 as if addressed by an instruction to access RAM like "LD" or "STS".
16139 This offset depends on the device architecture and has to be
16140 subtracted from the RAM address in order to get the respective
16141 I/O@tie{}address.
16142
16143 "__AVR_SHORT_CALLS__"
16144 The -mshort-calls command line option is set.
16145
16146 "__AVR_PM_BASE_ADDRESS__=addr"
16147 Some devices support reading from flash memory by means of "LD*"
16148 instructions. The flash memory is seen in the data address space
16149 at an offset of "__AVR_PM_BASE_ADDRESS__". If this macro is not
16150 defined, this feature is not available. If defined, the address
16151 space is linear and there is no need to put ".rodata" into RAM.
16152 This is handled by the default linker description file, and is
16153 currently available for "avrtiny" and "avrxmega3". Even more
16154 convenient, there is no need to use address spaces like "__flash"
16155 or features like attribute "progmem" and "pgm_read_*".
16156
16157 "__WITH_AVRLIBC__"
16158 The compiler is configured to be used together with AVR-Libc. See
16159 the --with-avrlibc configure option.
16160
16161 Blackfin Options
16162 -mcpu=cpu[-sirevision]
16163 Specifies the name of the target Blackfin processor. Currently,
16164 cpu can be one of bf512, bf514, bf516, bf518, bf522, bf523, bf524,
16165 bf525, bf526, bf527, bf531, bf532, bf533, bf534, bf536, bf537,
16166 bf538, bf539, bf542, bf544, bf547, bf548, bf549, bf542m, bf544m,
16167 bf547m, bf548m, bf549m, bf561, bf592.
16168
16169 The optional sirevision specifies the silicon revision of the
16170 target Blackfin processor. Any workarounds available for the
16171 targeted silicon revision are enabled. If sirevision is none, no
16172 workarounds are enabled. If sirevision is any, all workarounds for
16173 the targeted processor are enabled. The "__SILICON_REVISION__"
16174 macro is defined to two hexadecimal digits representing the major
16175 and minor numbers in the silicon revision. If sirevision is none,
16176 the "__SILICON_REVISION__" is not defined. If sirevision is any,
16177 the "__SILICON_REVISION__" is defined to be 0xffff. If this
16178 optional sirevision is not used, GCC assumes the latest known
16179 silicon revision of the targeted Blackfin processor.
16180
16181 GCC defines a preprocessor macro for the specified cpu. For the
16182 bfin-elf toolchain, this option causes the hardware BSP provided by
16183 libgloss to be linked in if -msim is not given.
16184
16185 Without this option, bf532 is used as the processor by default.
16186
16187 Note that support for bf561 is incomplete. For bf561, only the
16188 preprocessor macro is defined.
16189
16190 -msim
16191 Specifies that the program will be run on the simulator. This
16192 causes the simulator BSP provided by libgloss to be linked in.
16193 This option has effect only for bfin-elf toolchain. Certain other
16194 options, such as -mid-shared-library and -mfdpic, imply -msim.
16195
16196 -momit-leaf-frame-pointer
16197 Don't keep the frame pointer in a register for leaf functions.
16198 This avoids the instructions to save, set up and restore frame
16199 pointers and makes an extra register available in leaf functions.
16200
16201 -mspecld-anomaly
16202 When enabled, the compiler ensures that the generated code does not
16203 contain speculative loads after jump instructions. If this option
16204 is used, "__WORKAROUND_SPECULATIVE_LOADS" is defined.
16205
16206 -mno-specld-anomaly
16207 Don't generate extra code to prevent speculative loads from
16208 occurring.
16209
16210 -mcsync-anomaly
16211 When enabled, the compiler ensures that the generated code does not
16212 contain CSYNC or SSYNC instructions too soon after conditional
16213 branches. If this option is used, "__WORKAROUND_SPECULATIVE_SYNCS"
16214 is defined.
16215
16216 -mno-csync-anomaly
16217 Don't generate extra code to prevent CSYNC or SSYNC instructions
16218 from occurring too soon after a conditional branch.
16219
16220 -mlow64k
16221 When enabled, the compiler is free to take advantage of the
16222 knowledge that the entire program fits into the low 64k of memory.
16223
16224 -mno-low64k
16225 Assume that the program is arbitrarily large. This is the default.
16226
16227 -mstack-check-l1
16228 Do stack checking using information placed into L1 scratchpad
16229 memory by the uClinux kernel.
16230
16231 -mid-shared-library
16232 Generate code that supports shared libraries via the library ID
16233 method. This allows for execute in place and shared libraries in
16234 an environment without virtual memory management. This option
16235 implies -fPIC. With a bfin-elf target, this option implies -msim.
16236
16237 -mno-id-shared-library
16238 Generate code that doesn't assume ID-based shared libraries are
16239 being used. This is the default.
16240
16241 -mleaf-id-shared-library
16242 Generate code that supports shared libraries via the library ID
16243 method, but assumes that this library or executable won't link
16244 against any other ID shared libraries. That allows the compiler to
16245 use faster code for jumps and calls.
16246
16247 -mno-leaf-id-shared-library
16248 Do not assume that the code being compiled won't link against any
16249 ID shared libraries. Slower code is generated for jump and call
16250 insns.
16251
16252 -mshared-library-id=n
16253 Specifies the identification number of the ID-based shared library
16254 being compiled. Specifying a value of 0 generates more compact
16255 code; specifying other values forces the allocation of that number
16256 to the current library but is no more space- or time-efficient than
16257 omitting this option.
16258
16259 -msep-data
16260 Generate code that allows the data segment to be located in a
16261 different area of memory from the text segment. This allows for
16262 execute in place in an environment without virtual memory
16263 management by eliminating relocations against the text section.
16264
16265 -mno-sep-data
16266 Generate code that assumes that the data segment follows the text
16267 segment. This is the default.
16268
16269 -mlong-calls
16270 -mno-long-calls
16271 Tells the compiler to perform function calls by first loading the
16272 address of the function into a register and then performing a
16273 subroutine call on this register. This switch is needed if the
16274 target function lies outside of the 24-bit addressing range of the
16275 offset-based version of subroutine call instruction.
16276
16277 This feature is not enabled by default. Specifying -mno-long-calls
16278 restores the default behavior. Note these switches have no effect
16279 on how the compiler generates code to handle function calls via
16280 function pointers.
16281
16282 -mfast-fp
16283 Link with the fast floating-point library. This library relaxes
16284 some of the IEEE floating-point standard's rules for checking
16285 inputs against Not-a-Number (NAN), in the interest of performance.
16286
16287 -minline-plt
16288 Enable inlining of PLT entries in function calls to functions that
16289 are not known to bind locally. It has no effect without -mfdpic.
16290
16291 -mmulticore
16292 Build a standalone application for multicore Blackfin processors.
16293 This option causes proper start files and link scripts supporting
16294 multicore to be used, and defines the macro "__BFIN_MULTICORE". It
16295 can only be used with -mcpu=bf561[-sirevision].
16296
16297 This option can be used with -mcorea or -mcoreb, which selects the
16298 one-application-per-core programming model. Without -mcorea or
16299 -mcoreb, the single-application/dual-core programming model is
16300 used. In this model, the main function of Core B should be named as
16301 "coreb_main".
16302
16303 If this option is not used, the single-core application programming
16304 model is used.
16305
16306 -mcorea
16307 Build a standalone application for Core A of BF561 when using the
16308 one-application-per-core programming model. Proper start files and
16309 link scripts are used to support Core A, and the macro
16310 "__BFIN_COREA" is defined. This option can only be used in
16311 conjunction with -mmulticore.
16312
16313 -mcoreb
16314 Build a standalone application for Core B of BF561 when using the
16315 one-application-per-core programming model. Proper start files and
16316 link scripts are used to support Core B, and the macro
16317 "__BFIN_COREB" is defined. When this option is used, "coreb_main"
16318 should be used instead of "main". This option can only be used in
16319 conjunction with -mmulticore.
16320
16321 -msdram
16322 Build a standalone application for SDRAM. Proper start files and
16323 link scripts are used to put the application into SDRAM, and the
16324 macro "__BFIN_SDRAM" is defined. The loader should initialize
16325 SDRAM before loading the application.
16326
16327 -micplb
16328 Assume that ICPLBs are enabled at run time. This has an effect on
16329 certain anomaly workarounds. For Linux targets, the default is to
16330 assume ICPLBs are enabled; for standalone applications the default
16331 is off.
16332
16333 C6X Options
16334 -march=name
16335 This specifies the name of the target architecture. GCC uses this
16336 name to determine what kind of instructions it can emit when
16337 generating assembly code. Permissible names are: c62x, c64x,
16338 c64x+, c67x, c67x+, c674x.
16339
16340 -mbig-endian
16341 Generate code for a big-endian target.
16342
16343 -mlittle-endian
16344 Generate code for a little-endian target. This is the default.
16345
16346 -msim
16347 Choose startup files and linker script suitable for the simulator.
16348
16349 -msdata=default
16350 Put small global and static data in the ".neardata" section, which
16351 is pointed to by register "B14". Put small uninitialized global
16352 and static data in the ".bss" section, which is adjacent to the
16353 ".neardata" section. Put small read-only data into the ".rodata"
16354 section. The corresponding sections used for large pieces of data
16355 are ".fardata", ".far" and ".const".
16356
16357 -msdata=all
16358 Put all data, not just small objects, into the sections reserved
16359 for small data, and use addressing relative to the "B14" register
16360 to access them.
16361
16362 -msdata=none
16363 Make no use of the sections reserved for small data, and use
16364 absolute addresses to access all data. Put all initialized global
16365 and static data in the ".fardata" section, and all uninitialized
16366 data in the ".far" section. Put all constant data into the
16367 ".const" section.
16368
16369 CRIS Options
16370 These options are defined specifically for the CRIS ports.
16371
16372 -march=architecture-type
16373 -mcpu=architecture-type
16374 Generate code for the specified architecture. The choices for
16375 architecture-type are v3, v8 and v10 for respectively ETRAX 4,
16376 ETRAX 100, and ETRAX 100 LX. Default is v0 except for cris-axis-
16377 linux-gnu, where the default is v10.
16378
16379 -mtune=architecture-type
16380 Tune to architecture-type everything applicable about the generated
16381 code, except for the ABI and the set of available instructions.
16382 The choices for architecture-type are the same as for
16383 -march=architecture-type.
16384
16385 -mmax-stack-frame=n
16386 Warn when the stack frame of a function exceeds n bytes.
16387
16388 -metrax4
16389 -metrax100
16390 The options -metrax4 and -metrax100 are synonyms for -march=v3 and
16391 -march=v8 respectively.
16392
16393 -mmul-bug-workaround
16394 -mno-mul-bug-workaround
16395 Work around a bug in the "muls" and "mulu" instructions for CPU
16396 models where it applies. This option is active by default.
16397
16398 -mpdebug
16399 Enable CRIS-specific verbose debug-related information in the
16400 assembly code. This option also has the effect of turning off the
16401 #NO_APP formatted-code indicator to the assembler at the beginning
16402 of the assembly file.
16403
16404 -mcc-init
16405 Do not use condition-code results from previous instruction; always
16406 emit compare and test instructions before use of condition codes.
16407
16408 -mno-side-effects
16409 Do not emit instructions with side effects in addressing modes
16410 other than post-increment.
16411
16412 -mstack-align
16413 -mno-stack-align
16414 -mdata-align
16415 -mno-data-align
16416 -mconst-align
16417 -mno-const-align
16418 These options (no- options) arrange (eliminate arrangements) for
16419 the stack frame, individual data and constants to be aligned for
16420 the maximum single data access size for the chosen CPU model. The
16421 default is to arrange for 32-bit alignment. ABI details such as
16422 structure layout are not affected by these options.
16423
16424 -m32-bit
16425 -m16-bit
16426 -m8-bit
16427 Similar to the stack- data- and const-align options above, these
16428 options arrange for stack frame, writable data and constants to all
16429 be 32-bit, 16-bit or 8-bit aligned. The default is 32-bit
16430 alignment.
16431
16432 -mno-prologue-epilogue
16433 -mprologue-epilogue
16434 With -mno-prologue-epilogue, the normal function prologue and
16435 epilogue which set up the stack frame are omitted and no return
16436 instructions or return sequences are generated in the code. Use
16437 this option only together with visual inspection of the compiled
16438 code: no warnings or errors are generated when call-saved registers
16439 must be saved, or storage for local variables needs to be
16440 allocated.
16441
16442 -mno-gotplt
16443 -mgotplt
16444 With -fpic and -fPIC, don't generate (do generate) instruction
16445 sequences that load addresses for functions from the PLT part of
16446 the GOT rather than (traditional on other architectures) calls to
16447 the PLT. The default is -mgotplt.
16448
16449 -melf
16450 Legacy no-op option only recognized with the cris-axis-elf and
16451 cris-axis-linux-gnu targets.
16452
16453 -mlinux
16454 Legacy no-op option only recognized with the cris-axis-linux-gnu
16455 target.
16456
16457 -sim
16458 This option, recognized for the cris-axis-elf, arranges to link
16459 with input-output functions from a simulator library. Code,
16460 initialized data and zero-initialized data are allocated
16461 consecutively.
16462
16463 -sim2
16464 Like -sim, but pass linker options to locate initialized data at
16465 0x40000000 and zero-initialized data at 0x80000000.
16466
16467 CR16 Options
16468 These options are defined specifically for the CR16 ports.
16469
16470 -mmac
16471 Enable the use of multiply-accumulate instructions. Disabled by
16472 default.
16473
16474 -mcr16cplus
16475 -mcr16c
16476 Generate code for CR16C or CR16C+ architecture. CR16C+ architecture
16477 is default.
16478
16479 -msim
16480 Links the library libsim.a which is in compatible with simulator.
16481 Applicable to ELF compiler only.
16482
16483 -mint32
16484 Choose integer type as 32-bit wide.
16485
16486 -mbit-ops
16487 Generates "sbit"/"cbit" instructions for bit manipulations.
16488
16489 -mdata-model=model
16490 Choose a data model. The choices for model are near, far or medium.
16491 medium is default. However, far is not valid with -mcr16c, as the
16492 CR16C architecture does not support the far data model.
16493
16494 C-SKY Options
16495 GCC supports these options when compiling for C-SKY V2 processors.
16496
16497 -march=arch
16498 Specify the C-SKY target architecture. Valid values for arch are:
16499 ck801, ck802, ck803, ck807, and ck810. The default is ck810.
16500
16501 -mcpu=cpu
16502 Specify the C-SKY target processor. Valid values for cpu are:
16503 ck801, ck801t, ck802, ck802t, ck802j, ck803, ck803h, ck803t,
16504 ck803ht, ck803f, ck803fh, ck803e, ck803eh, ck803et, ck803eht,
16505 ck803ef, ck803efh, ck803ft, ck803eft, ck803efht, ck803r1, ck803hr1,
16506 ck803tr1, ck803htr1, ck803fr1, ck803fhr1, ck803er1, ck803ehr1,
16507 ck803etr1, ck803ehtr1, ck803efr1, ck803efhr1, ck803ftr1,
16508 ck803eftr1, ck803efhtr1, ck803s, ck803st, ck803se, ck803sf,
16509 ck803sef, ck803seft, ck807e, ck807ef, ck807, ck807f, ck810e,
16510 ck810et, ck810ef, ck810eft, ck810, ck810v, ck810f, ck810t, ck810fv,
16511 ck810tv, ck810ft, and ck810ftv.
16512
16513 -mbig-endian
16514 -EB
16515 -mlittle-endian
16516 -EL Select big- or little-endian code. The default is little-endian.
16517
16518 -mhard-float
16519 -msoft-float
16520 Select hardware or software floating-point implementations. The
16521 default is soft float.
16522
16523 -mdouble-float
16524 -mno-double-float
16525 When -mhard-float is in effect, enable generation of double-
16526 precision float instructions. This is the default except when
16527 compiling for CK803.
16528
16529 -mfdivdu
16530 -mno-fdivdu
16531 When -mhard-float is in effect, enable generation of "frecipd",
16532 "fsqrtd", and "fdivd" instructions. This is the default except
16533 when compiling for CK803.
16534
16535 -mfpu=fpu
16536 Select the floating-point processor. This option can only be used
16537 with -mhard-float. Values for fpu are fpv2_sf (equivalent to
16538 -mno-double-float -mno-fdivdu), fpv2 (-mdouble-float -mno-divdu),
16539 and fpv2_divd (-mdouble-float -mdivdu).
16540
16541 -melrw
16542 -mno-elrw
16543 Enable the extended "lrw" instruction. This option defaults to on
16544 for CK801 and off otherwise.
16545
16546 -mistack
16547 -mno-istack
16548 Enable interrupt stack instructions; the default is off.
16549
16550 The -mistack option is required to handle the "interrupt" and "isr"
16551 function attributes.
16552
16553 -mmp
16554 Enable multiprocessor instructions; the default is off.
16555
16556 -mcp
16557 Enable coprocessor instructions; the default is off.
16558
16559 -mcache
16560 Enable coprocessor instructions; the default is off.
16561
16562 -msecurity
16563 Enable C-SKY security instructions; the default is off.
16564
16565 -mtrust
16566 Enable C-SKY trust instructions; the default is off.
16567
16568 -mdsp
16569 -medsp
16570 -mvdsp
16571 Enable C-SKY DSP, Enhanced DSP, or Vector DSP instructions,
16572 respectively. All of these options default to off.
16573
16574 -mdiv
16575 -mno-div
16576 Generate divide instructions. Default is off.
16577
16578 -msmart
16579 -mno-smart
16580 Generate code for Smart Mode, using only registers numbered 0-7 to
16581 allow use of 16-bit instructions. This option is ignored for CK801
16582 where this is the required behavior, and it defaults to on for
16583 CK802. For other targets, the default is off.
16584
16585 -mhigh-registers
16586 -mno-high-registers
16587 Generate code using the high registers numbered 16-31. This option
16588 is not supported on CK801, CK802, or CK803, and is enabled by
16589 default for other processors.
16590
16591 -manchor
16592 -mno-anchor
16593 Generate code using global anchor symbol addresses.
16594
16595 -mpushpop
16596 -mno-pushpop
16597 Generate code using "push" and "pop" instructions. This option
16598 defaults to on.
16599
16600 -mmultiple-stld
16601 -mstm
16602 -mno-multiple-stld
16603 -mno-stm
16604 Generate code using "stm" and "ldm" instructions. This option
16605 isn't supported on CK801 but is enabled by default on other
16606 processors.
16607
16608 -mconstpool
16609 -mno-constpool
16610 Create constant pools in the compiler instead of deferring it to
16611 the assembler. This option is the default and required for correct
16612 code generation on CK801 and CK802, and is optional on other
16613 processors.
16614
16615 -mstack-size
16616 -mno-stack-size
16617 Emit ".stack_size" directives for each function in the assembly
16618 output. This option defaults to off.
16619
16620 -mccrt
16621 -mno-ccrt
16622 Generate code for the C-SKY compiler runtime instead of libgcc.
16623 This option defaults to off.
16624
16625 -mbranch-cost=n
16626 Set the branch costs to roughly "n" instructions. The default is
16627 1.
16628
16629 -msched-prolog
16630 -mno-sched-prolog
16631 Permit scheduling of function prologue and epilogue sequences.
16632 Using this option can result in code that is not compliant with the
16633 C-SKY V2 ABI prologue requirements and that cannot be debugged or
16634 backtraced. It is disabled by default.
16635
16636 Darwin Options
16637 These options are defined for all architectures running the Darwin
16638 operating system.
16639
16640 FSF GCC on Darwin does not create "fat" object files; it creates an
16641 object file for the single architecture that GCC was built to target.
16642 Apple's GCC on Darwin does create "fat" files if multiple -arch options
16643 are used; it does so by running the compiler or linker multiple times
16644 and joining the results together with lipo.
16645
16646 The subtype of the file created (like ppc7400 or ppc970 or i686) is
16647 determined by the flags that specify the ISA that GCC is targeting,
16648 like -mcpu or -march. The -force_cpusubtype_ALL option can be used to
16649 override this.
16650
16651 The Darwin tools vary in their behavior when presented with an ISA
16652 mismatch. The assembler, as, only permits instructions to be used that
16653 are valid for the subtype of the file it is generating, so you cannot
16654 put 64-bit instructions in a ppc750 object file. The linker for shared
16655 libraries, /usr/bin/libtool, fails and prints an error if asked to
16656 create a shared library with a less restrictive subtype than its input
16657 files (for instance, trying to put a ppc970 object file in a ppc7400
16658 library). The linker for executables, ld, quietly gives the executable
16659 the most restrictive subtype of any of its input files.
16660
16661 -Fdir
16662 Add the framework directory dir to the head of the list of
16663 directories to be searched for header files. These directories are
16664 interleaved with those specified by -I options and are scanned in a
16665 left-to-right order.
16666
16667 A framework directory is a directory with frameworks in it. A
16668 framework is a directory with a Headers and/or PrivateHeaders
16669 directory contained directly in it that ends in .framework. The
16670 name of a framework is the name of this directory excluding the
16671 .framework. Headers associated with the framework are found in one
16672 of those two directories, with Headers being searched first. A
16673 subframework is a framework directory that is in a framework's
16674 Frameworks directory. Includes of subframework headers can only
16675 appear in a header of a framework that contains the subframework,
16676 or in a sibling subframework header. Two subframeworks are
16677 siblings if they occur in the same framework. A subframework
16678 should not have the same name as a framework; a warning is issued
16679 if this is violated. Currently a subframework cannot have
16680 subframeworks; in the future, the mechanism may be extended to
16681 support this. The standard frameworks can be found in
16682 /System/Library/Frameworks and /Library/Frameworks. An example
16683 include looks like "#include <Framework/header.h>", where Framework
16684 denotes the name of the framework and header.h is found in the
16685 PrivateHeaders or Headers directory.
16686
16687 -iframeworkdir
16688 Like -F except the directory is a treated as a system directory.
16689 The main difference between this -iframework and -F is that with
16690 -iframework the compiler does not warn about constructs contained
16691 within header files found via dir. This option is valid only for
16692 the C family of languages.
16693
16694 -gused
16695 Emit debugging information for symbols that are used. For stabs
16696 debugging format, this enables -feliminate-unused-debug-symbols.
16697 This is by default ON.
16698
16699 -gfull
16700 Emit debugging information for all symbols and types.
16701
16702 -mmacosx-version-min=version
16703 The earliest version of MacOS X that this executable will run on is
16704 version. Typical values of version include 10.1, 10.2, and 10.3.9.
16705
16706 If the compiler was built to use the system's headers by default,
16707 then the default for this option is the system version on which the
16708 compiler is running, otherwise the default is to make choices that
16709 are compatible with as many systems and code bases as possible.
16710
16711 -mkernel
16712 Enable kernel development mode. The -mkernel option sets -static,
16713 -fno-common, -fno-use-cxa-atexit, -fno-exceptions,
16714 -fno-non-call-exceptions, -fapple-kext, -fno-weak and -fno-rtti
16715 where applicable. This mode also sets -mno-altivec, -msoft-float,
16716 -fno-builtin and -mlong-branch for PowerPC targets.
16717
16718 -mone-byte-bool
16719 Override the defaults for "bool" so that "sizeof(bool)==1". By
16720 default "sizeof(bool)" is 4 when compiling for Darwin/PowerPC and 1
16721 when compiling for Darwin/x86, so this option has no effect on x86.
16722
16723 Warning: The -mone-byte-bool switch causes GCC to generate code
16724 that is not binary compatible with code generated without that
16725 switch. Using this switch may require recompiling all other
16726 modules in a program, including system libraries. Use this switch
16727 to conform to a non-default data model.
16728
16729 -mfix-and-continue
16730 -ffix-and-continue
16731 -findirect-data
16732 Generate code suitable for fast turnaround development, such as to
16733 allow GDB to dynamically load .o files into already-running
16734 programs. -findirect-data and -ffix-and-continue are provided for
16735 backwards compatibility.
16736
16737 -all_load
16738 Loads all members of static archive libraries. See man ld(1) for
16739 more information.
16740
16741 -arch_errors_fatal
16742 Cause the errors having to do with files that have the wrong
16743 architecture to be fatal.
16744
16745 -bind_at_load
16746 Causes the output file to be marked such that the dynamic linker
16747 will bind all undefined references when the file is loaded or
16748 launched.
16749
16750 -bundle
16751 Produce a Mach-o bundle format file. See man ld(1) for more
16752 information.
16753
16754 -bundle_loader executable
16755 This option specifies the executable that will load the build
16756 output file being linked. See man ld(1) for more information.
16757
16758 -dynamiclib
16759 When passed this option, GCC produces a dynamic library instead of
16760 an executable when linking, using the Darwin libtool command.
16761
16762 -force_cpusubtype_ALL
16763 This causes GCC's output file to have the ALL subtype, instead of
16764 one controlled by the -mcpu or -march option.
16765
16766 -allowable_client client_name
16767 -client_name
16768 -compatibility_version
16769 -current_version
16770 -dead_strip
16771 -dependency-file
16772 -dylib_file
16773 -dylinker_install_name
16774 -dynamic
16775 -exported_symbols_list
16776 -filelist
16777 -flat_namespace
16778 -force_flat_namespace
16779 -headerpad_max_install_names
16780 -image_base
16781 -init
16782 -install_name
16783 -keep_private_externs
16784 -multi_module
16785 -multiply_defined
16786 -multiply_defined_unused
16787 -noall_load
16788 -no_dead_strip_inits_and_terms
16789 -nofixprebinding
16790 -nomultidefs
16791 -noprebind
16792 -noseglinkedit
16793 -pagezero_size
16794 -prebind
16795 -prebind_all_twolevel_modules
16796 -private_bundle
16797 -read_only_relocs
16798 -sectalign
16799 -sectobjectsymbols
16800 -whyload
16801 -seg1addr
16802 -sectcreate
16803 -sectobjectsymbols
16804 -sectorder
16805 -segaddr
16806 -segs_read_only_addr
16807 -segs_read_write_addr
16808 -seg_addr_table
16809 -seg_addr_table_filename
16810 -seglinkedit
16811 -segprot
16812 -segs_read_only_addr
16813 -segs_read_write_addr
16814 -single_module
16815 -static
16816 -sub_library
16817 -sub_umbrella
16818 -twolevel_namespace
16819 -umbrella
16820 -undefined
16821 -unexported_symbols_list
16822 -weak_reference_mismatches
16823 -whatsloaded
16824 These options are passed to the Darwin linker. The Darwin linker
16825 man page describes them in detail.
16826
16827 DEC Alpha Options
16828 These -m options are defined for the DEC Alpha implementations:
16829
16830 -mno-soft-float
16831 -msoft-float
16832 Use (do not use) the hardware floating-point instructions for
16833 floating-point operations. When -msoft-float is specified,
16834 functions in libgcc.a are used to perform floating-point
16835 operations. Unless they are replaced by routines that emulate the
16836 floating-point operations, or compiled in such a way as to call
16837 such emulations routines, these routines issue floating-point
16838 operations. If you are compiling for an Alpha without floating-
16839 point operations, you must ensure that the library is built so as
16840 not to call them.
16841
16842 Note that Alpha implementations without floating-point operations
16843 are required to have floating-point registers.
16844
16845 -mfp-reg
16846 -mno-fp-regs
16847 Generate code that uses (does not use) the floating-point register
16848 set. -mno-fp-regs implies -msoft-float. If the floating-point
16849 register set is not used, floating-point operands are passed in
16850 integer registers as if they were integers and floating-point
16851 results are passed in $0 instead of $f0. This is a non-standard
16852 calling sequence, so any function with a floating-point argument or
16853 return value called by code compiled with -mno-fp-regs must also be
16854 compiled with that option.
16855
16856 A typical use of this option is building a kernel that does not
16857 use, and hence need not save and restore, any floating-point
16858 registers.
16859
16860 -mieee
16861 The Alpha architecture implements floating-point hardware optimized
16862 for maximum performance. It is mostly compliant with the IEEE
16863 floating-point standard. However, for full compliance, software
16864 assistance is required. This option generates code fully IEEE-
16865 compliant code except that the inexact-flag is not maintained (see
16866 below). If this option is turned on, the preprocessor macro
16867 "_IEEE_FP" is defined during compilation. The resulting code is
16868 less efficient but is able to correctly support denormalized
16869 numbers and exceptional IEEE values such as not-a-number and
16870 plus/minus infinity. Other Alpha compilers call this option
16871 -ieee_with_no_inexact.
16872
16873 -mieee-with-inexact
16874 This is like -mieee except the generated code also maintains the
16875 IEEE inexact-flag. Turning on this option causes the generated
16876 code to implement fully-compliant IEEE math. In addition to
16877 "_IEEE_FP", "_IEEE_FP_EXACT" is defined as a preprocessor macro.
16878 On some Alpha implementations the resulting code may execute
16879 significantly slower than the code generated by default. Since
16880 there is very little code that depends on the inexact-flag, you
16881 should normally not specify this option. Other Alpha compilers
16882 call this option -ieee_with_inexact.
16883
16884 -mfp-trap-mode=trap-mode
16885 This option controls what floating-point related traps are enabled.
16886 Other Alpha compilers call this option -fptm trap-mode. The trap
16887 mode can be set to one of four values:
16888
16889 n This is the default (normal) setting. The only traps that are
16890 enabled are the ones that cannot be disabled in software (e.g.,
16891 division by zero trap).
16892
16893 u In addition to the traps enabled by n, underflow traps are
16894 enabled as well.
16895
16896 su Like u, but the instructions are marked to be safe for software
16897 completion (see Alpha architecture manual for details).
16898
16899 sui Like su, but inexact traps are enabled as well.
16900
16901 -mfp-rounding-mode=rounding-mode
16902 Selects the IEEE rounding mode. Other Alpha compilers call this
16903 option -fprm rounding-mode. The rounding-mode can be one of:
16904
16905 n Normal IEEE rounding mode. Floating-point numbers are rounded
16906 towards the nearest machine number or towards the even machine
16907 number in case of a tie.
16908
16909 m Round towards minus infinity.
16910
16911 c Chopped rounding mode. Floating-point numbers are rounded
16912 towards zero.
16913
16914 d Dynamic rounding mode. A field in the floating-point control
16915 register (fpcr, see Alpha architecture reference manual)
16916 controls the rounding mode in effect. The C library
16917 initializes this register for rounding towards plus infinity.
16918 Thus, unless your program modifies the fpcr, d corresponds to
16919 round towards plus infinity.
16920
16921 -mtrap-precision=trap-precision
16922 In the Alpha architecture, floating-point traps are imprecise.
16923 This means without software assistance it is impossible to recover
16924 from a floating trap and program execution normally needs to be
16925 terminated. GCC can generate code that can assist operating system
16926 trap handlers in determining the exact location that caused a
16927 floating-point trap. Depending on the requirements of an
16928 application, different levels of precisions can be selected:
16929
16930 p Program precision. This option is the default and means a trap
16931 handler can only identify which program caused a floating-point
16932 exception.
16933
16934 f Function precision. The trap handler can determine the
16935 function that caused a floating-point exception.
16936
16937 i Instruction precision. The trap handler can determine the
16938 exact instruction that caused a floating-point exception.
16939
16940 Other Alpha compilers provide the equivalent options called
16941 -scope_safe and -resumption_safe.
16942
16943 -mieee-conformant
16944 This option marks the generated code as IEEE conformant. You must
16945 not use this option unless you also specify -mtrap-precision=i and
16946 either -mfp-trap-mode=su or -mfp-trap-mode=sui. Its only effect is
16947 to emit the line .eflag 48 in the function prologue of the
16948 generated assembly file.
16949
16950 -mbuild-constants
16951 Normally GCC examines a 32- or 64-bit integer constant to see if it
16952 can construct it from smaller constants in two or three
16953 instructions. If it cannot, it outputs the constant as a literal
16954 and generates code to load it from the data segment at run time.
16955
16956 Use this option to require GCC to construct all integer constants
16957 using code, even if it takes more instructions (the maximum is
16958 six).
16959
16960 You typically use this option to build a shared library dynamic
16961 loader. Itself a shared library, it must relocate itself in memory
16962 before it can find the variables and constants in its own data
16963 segment.
16964
16965 -mbwx
16966 -mno-bwx
16967 -mcix
16968 -mno-cix
16969 -mfix
16970 -mno-fix
16971 -mmax
16972 -mno-max
16973 Indicate whether GCC should generate code to use the optional BWX,
16974 CIX, FIX and MAX instruction sets. The default is to use the
16975 instruction sets supported by the CPU type specified via -mcpu=
16976 option or that of the CPU on which GCC was built if none is
16977 specified.
16978
16979 -mfloat-vax
16980 -mfloat-ieee
16981 Generate code that uses (does not use) VAX F and G floating-point
16982 arithmetic instead of IEEE single and double precision.
16983
16984 -mexplicit-relocs
16985 -mno-explicit-relocs
16986 Older Alpha assemblers provided no way to generate symbol
16987 relocations except via assembler macros. Use of these macros does
16988 not allow optimal instruction scheduling. GNU binutils as of
16989 version 2.12 supports a new syntax that allows the compiler to
16990 explicitly mark which relocations should apply to which
16991 instructions. This option is mostly useful for debugging, as GCC
16992 detects the capabilities of the assembler when it is built and sets
16993 the default accordingly.
16994
16995 -msmall-data
16996 -mlarge-data
16997 When -mexplicit-relocs is in effect, static data is accessed via
16998 gp-relative relocations. When -msmall-data is used, objects 8
16999 bytes long or smaller are placed in a small data area (the ".sdata"
17000 and ".sbss" sections) and are accessed via 16-bit relocations off
17001 of the $gp register. This limits the size of the small data area
17002 to 64KB, but allows the variables to be directly accessed via a
17003 single instruction.
17004
17005 The default is -mlarge-data. With this option the data area is
17006 limited to just below 2GB. Programs that require more than 2GB of
17007 data must use "malloc" or "mmap" to allocate the data in the heap
17008 instead of in the program's data segment.
17009
17010 When generating code for shared libraries, -fpic implies
17011 -msmall-data and -fPIC implies -mlarge-data.
17012
17013 -msmall-text
17014 -mlarge-text
17015 When -msmall-text is used, the compiler assumes that the code of
17016 the entire program (or shared library) fits in 4MB, and is thus
17017 reachable with a branch instruction. When -msmall-data is used,
17018 the compiler can assume that all local symbols share the same $gp
17019 value, and thus reduce the number of instructions required for a
17020 function call from 4 to 1.
17021
17022 The default is -mlarge-text.
17023
17024 -mcpu=cpu_type
17025 Set the instruction set and instruction scheduling parameters for
17026 machine type cpu_type. You can specify either the EV style name or
17027 the corresponding chip number. GCC supports scheduling parameters
17028 for the EV4, EV5 and EV6 family of processors and chooses the
17029 default values for the instruction set from the processor you
17030 specify. If you do not specify a processor type, GCC defaults to
17031 the processor on which the compiler was built.
17032
17033 Supported values for cpu_type are
17034
17035 ev4
17036 ev45
17037 21064
17038 Schedules as an EV4 and has no instruction set extensions.
17039
17040 ev5
17041 21164
17042 Schedules as an EV5 and has no instruction set extensions.
17043
17044 ev56
17045 21164a
17046 Schedules as an EV5 and supports the BWX extension.
17047
17048 pca56
17049 21164pc
17050 21164PC
17051 Schedules as an EV5 and supports the BWX and MAX extensions.
17052
17053 ev6
17054 21264
17055 Schedules as an EV6 and supports the BWX, FIX, and MAX
17056 extensions.
17057
17058 ev67
17059 21264a
17060 Schedules as an EV6 and supports the BWX, CIX, FIX, and MAX
17061 extensions.
17062
17063 Native toolchains also support the value native, which selects the
17064 best architecture option for the host processor. -mcpu=native has
17065 no effect if GCC does not recognize the processor.
17066
17067 -mtune=cpu_type
17068 Set only the instruction scheduling parameters for machine type
17069 cpu_type. The instruction set is not changed.
17070
17071 Native toolchains also support the value native, which selects the
17072 best architecture option for the host processor. -mtune=native has
17073 no effect if GCC does not recognize the processor.
17074
17075 -mmemory-latency=time
17076 Sets the latency the scheduler should assume for typical memory
17077 references as seen by the application. This number is highly
17078 dependent on the memory access patterns used by the application and
17079 the size of the external cache on the machine.
17080
17081 Valid options for time are
17082
17083 number
17084 A decimal number representing clock cycles.
17085
17086 L1
17087 L2
17088 L3
17089 main
17090 The compiler contains estimates of the number of clock cycles
17091 for "typical" EV4 & EV5 hardware for the Level 1, 2 & 3 caches
17092 (also called Dcache, Scache, and Bcache), as well as to main
17093 memory. Note that L3 is only valid for EV5.
17094
17095 FR30 Options
17096 These options are defined specifically for the FR30 port.
17097
17098 -msmall-model
17099 Use the small address space model. This can produce smaller code,
17100 but it does assume that all symbolic values and addresses fit into
17101 a 20-bit range.
17102
17103 -mno-lsim
17104 Assume that runtime support has been provided and so there is no
17105 need to include the simulator library (libsim.a) on the linker
17106 command line.
17107
17108 FT32 Options
17109 These options are defined specifically for the FT32 port.
17110
17111 -msim
17112 Specifies that the program will be run on the simulator. This
17113 causes an alternate runtime startup and library to be linked. You
17114 must not use this option when generating programs that will run on
17115 real hardware; you must provide your own runtime library for
17116 whatever I/O functions are needed.
17117
17118 -mlra
17119 Enable Local Register Allocation. This is still experimental for
17120 FT32, so by default the compiler uses standard reload.
17121
17122 -mnodiv
17123 Do not use div and mod instructions.
17124
17125 -mft32b
17126 Enable use of the extended instructions of the FT32B processor.
17127
17128 -mcompress
17129 Compress all code using the Ft32B code compression scheme.
17130
17131 -mnopm
17132 Do not generate code that reads program memory.
17133
17134 FRV Options
17135 -mgpr-32
17136 Only use the first 32 general-purpose registers.
17137
17138 -mgpr-64
17139 Use all 64 general-purpose registers.
17140
17141 -mfpr-32
17142 Use only the first 32 floating-point registers.
17143
17144 -mfpr-64
17145 Use all 64 floating-point registers.
17146
17147 -mhard-float
17148 Use hardware instructions for floating-point operations.
17149
17150 -msoft-float
17151 Use library routines for floating-point operations.
17152
17153 -malloc-cc
17154 Dynamically allocate condition code registers.
17155
17156 -mfixed-cc
17157 Do not try to dynamically allocate condition code registers, only
17158 use "icc0" and "fcc0".
17159
17160 -mdword
17161 Change ABI to use double word insns.
17162
17163 -mno-dword
17164 Do not use double word instructions.
17165
17166 -mdouble
17167 Use floating-point double instructions.
17168
17169 -mno-double
17170 Do not use floating-point double instructions.
17171
17172 -mmedia
17173 Use media instructions.
17174
17175 -mno-media
17176 Do not use media instructions.
17177
17178 -mmuladd
17179 Use multiply and add/subtract instructions.
17180
17181 -mno-muladd
17182 Do not use multiply and add/subtract instructions.
17183
17184 -mfdpic
17185 Select the FDPIC ABI, which uses function descriptors to represent
17186 pointers to functions. Without any PIC/PIE-related options, it
17187 implies -fPIE. With -fpic or -fpie, it assumes GOT entries and
17188 small data are within a 12-bit range from the GOT base address;
17189 with -fPIC or -fPIE, GOT offsets are computed with 32 bits. With a
17190 bfin-elf target, this option implies -msim.
17191
17192 -minline-plt
17193 Enable inlining of PLT entries in function calls to functions that
17194 are not known to bind locally. It has no effect without -mfdpic.
17195 It's enabled by default if optimizing for speed and compiling for
17196 shared libraries (i.e., -fPIC or -fpic), or when an optimization
17197 option such as -O3 or above is present in the command line.
17198
17199 -mTLS
17200 Assume a large TLS segment when generating thread-local code.
17201
17202 -mtls
17203 Do not assume a large TLS segment when generating thread-local
17204 code.
17205
17206 -mgprel-ro
17207 Enable the use of "GPREL" relocations in the FDPIC ABI for data
17208 that is known to be in read-only sections. It's enabled by
17209 default, except for -fpic or -fpie: even though it may help make
17210 the global offset table smaller, it trades 1 instruction for 4.
17211 With -fPIC or -fPIE, it trades 3 instructions for 4, one of which
17212 may be shared by multiple symbols, and it avoids the need for a GOT
17213 entry for the referenced symbol, so it's more likely to be a win.
17214 If it is not, -mno-gprel-ro can be used to disable it.
17215
17216 -multilib-library-pic
17217 Link with the (library, not FD) pic libraries. It's implied by
17218 -mlibrary-pic, as well as by -fPIC and -fpic without -mfdpic. You
17219 should never have to use it explicitly.
17220
17221 -mlinked-fp
17222 Follow the EABI requirement of always creating a frame pointer
17223 whenever a stack frame is allocated. This option is enabled by
17224 default and can be disabled with -mno-linked-fp.
17225
17226 -mlong-calls
17227 Use indirect addressing to call functions outside the current
17228 compilation unit. This allows the functions to be placed anywhere
17229 within the 32-bit address space.
17230
17231 -malign-labels
17232 Try to align labels to an 8-byte boundary by inserting NOPs into
17233 the previous packet. This option only has an effect when VLIW
17234 packing is enabled. It doesn't create new packets; it merely adds
17235 NOPs to existing ones.
17236
17237 -mlibrary-pic
17238 Generate position-independent EABI code.
17239
17240 -macc-4
17241 Use only the first four media accumulator registers.
17242
17243 -macc-8
17244 Use all eight media accumulator registers.
17245
17246 -mpack
17247 Pack VLIW instructions.
17248
17249 -mno-pack
17250 Do not pack VLIW instructions.
17251
17252 -mno-eflags
17253 Do not mark ABI switches in e_flags.
17254
17255 -mcond-move
17256 Enable the use of conditional-move instructions (default).
17257
17258 This switch is mainly for debugging the compiler and will likely be
17259 removed in a future version.
17260
17261 -mno-cond-move
17262 Disable the use of conditional-move instructions.
17263
17264 This switch is mainly for debugging the compiler and will likely be
17265 removed in a future version.
17266
17267 -mscc
17268 Enable the use of conditional set instructions (default).
17269
17270 This switch is mainly for debugging the compiler and will likely be
17271 removed in a future version.
17272
17273 -mno-scc
17274 Disable the use of conditional set instructions.
17275
17276 This switch is mainly for debugging the compiler and will likely be
17277 removed in a future version.
17278
17279 -mcond-exec
17280 Enable the use of conditional execution (default).
17281
17282 This switch is mainly for debugging the compiler and will likely be
17283 removed in a future version.
17284
17285 -mno-cond-exec
17286 Disable the use of conditional execution.
17287
17288 This switch is mainly for debugging the compiler and will likely be
17289 removed in a future version.
17290
17291 -mvliw-branch
17292 Run a pass to pack branches into VLIW instructions (default).
17293
17294 This switch is mainly for debugging the compiler and will likely be
17295 removed in a future version.
17296
17297 -mno-vliw-branch
17298 Do not run a pass to pack branches into VLIW instructions.
17299
17300 This switch is mainly for debugging the compiler and will likely be
17301 removed in a future version.
17302
17303 -mmulti-cond-exec
17304 Enable optimization of "&&" and "||" in conditional execution
17305 (default).
17306
17307 This switch is mainly for debugging the compiler and will likely be
17308 removed in a future version.
17309
17310 -mno-multi-cond-exec
17311 Disable optimization of "&&" and "||" in conditional execution.
17312
17313 This switch is mainly for debugging the compiler and will likely be
17314 removed in a future version.
17315
17316 -mnested-cond-exec
17317 Enable nested conditional execution optimizations (default).
17318
17319 This switch is mainly for debugging the compiler and will likely be
17320 removed in a future version.
17321
17322 -mno-nested-cond-exec
17323 Disable nested conditional execution optimizations.
17324
17325 This switch is mainly for debugging the compiler and will likely be
17326 removed in a future version.
17327
17328 -moptimize-membar
17329 This switch removes redundant "membar" instructions from the
17330 compiler-generated code. It is enabled by default.
17331
17332 -mno-optimize-membar
17333 This switch disables the automatic removal of redundant "membar"
17334 instructions from the generated code.
17335
17336 -mtomcat-stats
17337 Cause gas to print out tomcat statistics.
17338
17339 -mcpu=cpu
17340 Select the processor type for which to generate code. Possible
17341 values are frv, fr550, tomcat, fr500, fr450, fr405, fr400, fr300
17342 and simple.
17343
17344 GNU/Linux Options
17345 These -m options are defined for GNU/Linux targets:
17346
17347 -mglibc
17348 Use the GNU C library. This is the default except on
17349 *-*-linux-*uclibc*, *-*-linux-*musl* and *-*-linux-*android*
17350 targets.
17351
17352 -muclibc
17353 Use uClibc C library. This is the default on *-*-linux-*uclibc*
17354 targets.
17355
17356 -mmusl
17357 Use the musl C library. This is the default on *-*-linux-*musl*
17358 targets.
17359
17360 -mbionic
17361 Use Bionic C library. This is the default on *-*-linux-*android*
17362 targets.
17363
17364 -mandroid
17365 Compile code compatible with Android platform. This is the default
17366 on *-*-linux-*android* targets.
17367
17368 When compiling, this option enables -mbionic, -fPIC,
17369 -fno-exceptions and -fno-rtti by default. When linking, this
17370 option makes the GCC driver pass Android-specific options to the
17371 linker. Finally, this option causes the preprocessor macro
17372 "__ANDROID__" to be defined.
17373
17374 -tno-android-cc
17375 Disable compilation effects of -mandroid, i.e., do not enable
17376 -mbionic, -fPIC, -fno-exceptions and -fno-rtti by default.
17377
17378 -tno-android-ld
17379 Disable linking effects of -mandroid, i.e., pass standard Linux
17380 linking options to the linker.
17381
17382 H8/300 Options
17383 These -m options are defined for the H8/300 implementations:
17384
17385 -mrelax
17386 Shorten some address references at link time, when possible; uses
17387 the linker option -relax.
17388
17389 -mh Generate code for the H8/300H.
17390
17391 -ms Generate code for the H8S.
17392
17393 -mn Generate code for the H8S and H8/300H in the normal mode. This
17394 switch must be used either with -mh or -ms.
17395
17396 -ms2600
17397 Generate code for the H8S/2600. This switch must be used with -ms.
17398
17399 -mexr
17400 Extended registers are stored on stack before execution of function
17401 with monitor attribute. Default option is -mexr. This option is
17402 valid only for H8S targets.
17403
17404 -mno-exr
17405 Extended registers are not stored on stack before execution of
17406 function with monitor attribute. Default option is -mno-exr. This
17407 option is valid only for H8S targets.
17408
17409 -mint32
17410 Make "int" data 32 bits by default.
17411
17412 -malign-300
17413 On the H8/300H and H8S, use the same alignment rules as for the
17414 H8/300. The default for the H8/300H and H8S is to align longs and
17415 floats on 4-byte boundaries. -malign-300 causes them to be aligned
17416 on 2-byte boundaries. This option has no effect on the H8/300.
17417
17418 HPPA Options
17419 These -m options are defined for the HPPA family of computers:
17420
17421 -march=architecture-type
17422 Generate code for the specified architecture. The choices for
17423 architecture-type are 1.0 for PA 1.0, 1.1 for PA 1.1, and 2.0 for
17424 PA 2.0 processors. Refer to /usr/lib/sched.models on an HP-UX
17425 system to determine the proper architecture option for your
17426 machine. Code compiled for lower numbered architectures runs on
17427 higher numbered architectures, but not the other way around.
17428
17429 -mpa-risc-1-0
17430 -mpa-risc-1-1
17431 -mpa-risc-2-0
17432 Synonyms for -march=1.0, -march=1.1, and -march=2.0 respectively.
17433
17434 -mcaller-copies
17435 The caller copies function arguments passed by hidden reference.
17436 This option should be used with care as it is not compatible with
17437 the default 32-bit runtime. However, only aggregates larger than
17438 eight bytes are passed by hidden reference and the option provides
17439 better compatibility with OpenMP.
17440
17441 -mjump-in-delay
17442 This option is ignored and provided for compatibility purposes
17443 only.
17444
17445 -mdisable-fpregs
17446 Prevent floating-point registers from being used in any manner.
17447 This is necessary for compiling kernels that perform lazy context
17448 switching of floating-point registers. If you use this option and
17449 attempt to perform floating-point operations, the compiler aborts.
17450
17451 -mdisable-indexing
17452 Prevent the compiler from using indexing address modes. This
17453 avoids some rather obscure problems when compiling MIG generated
17454 code under MACH.
17455
17456 -mno-space-regs
17457 Generate code that assumes the target has no space registers. This
17458 allows GCC to generate faster indirect calls and use unscaled index
17459 address modes.
17460
17461 Such code is suitable for level 0 PA systems and kernels.
17462
17463 -mfast-indirect-calls
17464 Generate code that assumes calls never cross space boundaries.
17465 This allows GCC to emit code that performs faster indirect calls.
17466
17467 This option does not work in the presence of shared libraries or
17468 nested functions.
17469
17470 -mfixed-range=register-range
17471 Generate code treating the given register range as fixed registers.
17472 A fixed register is one that the register allocator cannot use.
17473 This is useful when compiling kernel code. A register range is
17474 specified as two registers separated by a dash. Multiple register
17475 ranges can be specified separated by a comma.
17476
17477 -mlong-load-store
17478 Generate 3-instruction load and store sequences as sometimes
17479 required by the HP-UX 10 linker. This is equivalent to the +k
17480 option to the HP compilers.
17481
17482 -mportable-runtime
17483 Use the portable calling conventions proposed by HP for ELF
17484 systems.
17485
17486 -mgas
17487 Enable the use of assembler directives only GAS understands.
17488
17489 -mschedule=cpu-type
17490 Schedule code according to the constraints for the machine type
17491 cpu-type. The choices for cpu-type are 700 7100, 7100LC, 7200,
17492 7300 and 8000. Refer to /usr/lib/sched.models on an HP-UX system
17493 to determine the proper scheduling option for your machine. The
17494 default scheduling is 8000.
17495
17496 -mlinker-opt
17497 Enable the optimization pass in the HP-UX linker. Note this makes
17498 symbolic debugging impossible. It also triggers a bug in the HP-UX
17499 8 and HP-UX 9 linkers in which they give bogus error messages when
17500 linking some programs.
17501
17502 -msoft-float
17503 Generate output containing library calls for floating point.
17504 Warning: the requisite libraries are not available for all HPPA
17505 targets. Normally the facilities of the machine's usual C compiler
17506 are used, but this cannot be done directly in cross-compilation.
17507 You must make your own arrangements to provide suitable library
17508 functions for cross-compilation.
17509
17510 -msoft-float changes the calling convention in the output file;
17511 therefore, it is only useful if you compile all of a program with
17512 this option. In particular, you need to compile libgcc.a, the
17513 library that comes with GCC, with -msoft-float in order for this to
17514 work.
17515
17516 -msio
17517 Generate the predefine, "_SIO", for server IO. The default is
17518 -mwsio. This generates the predefines, "__hp9000s700",
17519 "__hp9000s700__" and "_WSIO", for workstation IO. These options
17520 are available under HP-UX and HI-UX.
17521
17522 -mgnu-ld
17523 Use options specific to GNU ld. This passes -shared to ld when
17524 building a shared library. It is the default when GCC is
17525 configured, explicitly or implicitly, with the GNU linker. This
17526 option does not affect which ld is called; it only changes what
17527 parameters are passed to that ld. The ld that is called is
17528 determined by the --with-ld configure option, GCC's program search
17529 path, and finally by the user's PATH. The linker used by GCC can
17530 be printed using which `gcc -print-prog-name=ld`. This option is
17531 only available on the 64-bit HP-UX GCC, i.e. configured with
17532 hppa*64*-*-hpux*.
17533
17534 -mhp-ld
17535 Use options specific to HP ld. This passes -b to ld when building
17536 a shared library and passes +Accept TypeMismatch to ld on all
17537 links. It is the default when GCC is configured, explicitly or
17538 implicitly, with the HP linker. This option does not affect which
17539 ld is called; it only changes what parameters are passed to that
17540 ld. The ld that is called is determined by the --with-ld configure
17541 option, GCC's program search path, and finally by the user's PATH.
17542 The linker used by GCC can be printed using which `gcc
17543 -print-prog-name=ld`. This option is only available on the 64-bit
17544 HP-UX GCC, i.e. configured with hppa*64*-*-hpux*.
17545
17546 -mlong-calls
17547 Generate code that uses long call sequences. This ensures that a
17548 call is always able to reach linker generated stubs. The default
17549 is to generate long calls only when the distance from the call site
17550 to the beginning of the function or translation unit, as the case
17551 may be, exceeds a predefined limit set by the branch type being
17552 used. The limits for normal calls are 7,600,000 and 240,000 bytes,
17553 respectively for the PA 2.0 and PA 1.X architectures. Sibcalls are
17554 always limited at 240,000 bytes.
17555
17556 Distances are measured from the beginning of functions when using
17557 the -ffunction-sections option, or when using the -mgas and
17558 -mno-portable-runtime options together under HP-UX with the SOM
17559 linker.
17560
17561 It is normally not desirable to use this option as it degrades
17562 performance. However, it may be useful in large applications,
17563 particularly when partial linking is used to build the application.
17564
17565 The types of long calls used depends on the capabilities of the
17566 assembler and linker, and the type of code being generated. The
17567 impact on systems that support long absolute calls, and long pic
17568 symbol-difference or pc-relative calls should be relatively small.
17569 However, an indirect call is used on 32-bit ELF systems in pic code
17570 and it is quite long.
17571
17572 -munix=unix-std
17573 Generate compiler predefines and select a startfile for the
17574 specified UNIX standard. The choices for unix-std are 93, 95 and
17575 98. 93 is supported on all HP-UX versions. 95 is available on HP-
17576 UX 10.10 and later. 98 is available on HP-UX 11.11 and later. The
17577 default values are 93 for HP-UX 10.00, 95 for HP-UX 10.10 though to
17578 11.00, and 98 for HP-UX 11.11 and later.
17579
17580 -munix=93 provides the same predefines as GCC 3.3 and 3.4.
17581 -munix=95 provides additional predefines for "XOPEN_UNIX" and
17582 "_XOPEN_SOURCE_EXTENDED", and the startfile unix95.o. -munix=98
17583 provides additional predefines for "_XOPEN_UNIX",
17584 "_XOPEN_SOURCE_EXTENDED", "_INCLUDE__STDC_A1_SOURCE" and
17585 "_INCLUDE_XOPEN_SOURCE_500", and the startfile unix98.o.
17586
17587 It is important to note that this option changes the interfaces for
17588 various library routines. It also affects the operational behavior
17589 of the C library. Thus, extreme care is needed in using this
17590 option.
17591
17592 Library code that is intended to operate with more than one UNIX
17593 standard must test, set and restore the variable
17594 "__xpg4_extended_mask" as appropriate. Most GNU software doesn't
17595 provide this capability.
17596
17597 -nolibdld
17598 Suppress the generation of link options to search libdld.sl when
17599 the -static option is specified on HP-UX 10 and later.
17600
17601 -static
17602 The HP-UX implementation of setlocale in libc has a dependency on
17603 libdld.sl. There isn't an archive version of libdld.sl. Thus,
17604 when the -static option is specified, special link options are
17605 needed to resolve this dependency.
17606
17607 On HP-UX 10 and later, the GCC driver adds the necessary options to
17608 link with libdld.sl when the -static option is specified. This
17609 causes the resulting binary to be dynamic. On the 64-bit port, the
17610 linkers generate dynamic binaries by default in any case. The
17611 -nolibdld option can be used to prevent the GCC driver from adding
17612 these link options.
17613
17614 -threads
17615 Add support for multithreading with the dce thread library under
17616 HP-UX. This option sets flags for both the preprocessor and
17617 linker.
17618
17619 IA-64 Options
17620 These are the -m options defined for the Intel IA-64 architecture.
17621
17622 -mbig-endian
17623 Generate code for a big-endian target. This is the default for HP-
17624 UX.
17625
17626 -mlittle-endian
17627 Generate code for a little-endian target. This is the default for
17628 AIX5 and GNU/Linux.
17629
17630 -mgnu-as
17631 -mno-gnu-as
17632 Generate (or don't) code for the GNU assembler. This is the
17633 default.
17634
17635 -mgnu-ld
17636 -mno-gnu-ld
17637 Generate (or don't) code for the GNU linker. This is the default.
17638
17639 -mno-pic
17640 Generate code that does not use a global pointer register. The
17641 result is not position independent code, and violates the IA-64
17642 ABI.
17643
17644 -mvolatile-asm-stop
17645 -mno-volatile-asm-stop
17646 Generate (or don't) a stop bit immediately before and after
17647 volatile asm statements.
17648
17649 -mregister-names
17650 -mno-register-names
17651 Generate (or don't) in, loc, and out register names for the stacked
17652 registers. This may make assembler output more readable.
17653
17654 -mno-sdata
17655 -msdata
17656 Disable (or enable) optimizations that use the small data section.
17657 This may be useful for working around optimizer bugs.
17658
17659 -mconstant-gp
17660 Generate code that uses a single constant global pointer value.
17661 This is useful when compiling kernel code.
17662
17663 -mauto-pic
17664 Generate code that is self-relocatable. This implies
17665 -mconstant-gp. This is useful when compiling firmware code.
17666
17667 -minline-float-divide-min-latency
17668 Generate code for inline divides of floating-point values using the
17669 minimum latency algorithm.
17670
17671 -minline-float-divide-max-throughput
17672 Generate code for inline divides of floating-point values using the
17673 maximum throughput algorithm.
17674
17675 -mno-inline-float-divide
17676 Do not generate inline code for divides of floating-point values.
17677
17678 -minline-int-divide-min-latency
17679 Generate code for inline divides of integer values using the
17680 minimum latency algorithm.
17681
17682 -minline-int-divide-max-throughput
17683 Generate code for inline divides of integer values using the
17684 maximum throughput algorithm.
17685
17686 -mno-inline-int-divide
17687 Do not generate inline code for divides of integer values.
17688
17689 -minline-sqrt-min-latency
17690 Generate code for inline square roots using the minimum latency
17691 algorithm.
17692
17693 -minline-sqrt-max-throughput
17694 Generate code for inline square roots using the maximum throughput
17695 algorithm.
17696
17697 -mno-inline-sqrt
17698 Do not generate inline code for "sqrt".
17699
17700 -mfused-madd
17701 -mno-fused-madd
17702 Do (don't) generate code that uses the fused multiply/add or
17703 multiply/subtract instructions. The default is to use these
17704 instructions.
17705
17706 -mno-dwarf2-asm
17707 -mdwarf2-asm
17708 Don't (or do) generate assembler code for the DWARF line number
17709 debugging info. This may be useful when not using the GNU
17710 assembler.
17711
17712 -mearly-stop-bits
17713 -mno-early-stop-bits
17714 Allow stop bits to be placed earlier than immediately preceding the
17715 instruction that triggered the stop bit. This can improve
17716 instruction scheduling, but does not always do so.
17717
17718 -mfixed-range=register-range
17719 Generate code treating the given register range as fixed registers.
17720 A fixed register is one that the register allocator cannot use.
17721 This is useful when compiling kernel code. A register range is
17722 specified as two registers separated by a dash. Multiple register
17723 ranges can be specified separated by a comma.
17724
17725 -mtls-size=tls-size
17726 Specify bit size of immediate TLS offsets. Valid values are 14,
17727 22, and 64.
17728
17729 -mtune=cpu-type
17730 Tune the instruction scheduling for a particular CPU, Valid values
17731 are itanium, itanium1, merced, itanium2, and mckinley.
17732
17733 -milp32
17734 -mlp64
17735 Generate code for a 32-bit or 64-bit environment. The 32-bit
17736 environment sets int, long and pointer to 32 bits. The 64-bit
17737 environment sets int to 32 bits and long and pointer to 64 bits.
17738 These are HP-UX specific flags.
17739
17740 -mno-sched-br-data-spec
17741 -msched-br-data-spec
17742 (Dis/En)able data speculative scheduling before reload. This
17743 results in generation of "ld.a" instructions and the corresponding
17744 check instructions ("ld.c" / "chk.a"). The default setting is
17745 disabled.
17746
17747 -msched-ar-data-spec
17748 -mno-sched-ar-data-spec
17749 (En/Dis)able data speculative scheduling after reload. This
17750 results in generation of "ld.a" instructions and the corresponding
17751 check instructions ("ld.c" / "chk.a"). The default setting is
17752 enabled.
17753
17754 -mno-sched-control-spec
17755 -msched-control-spec
17756 (Dis/En)able control speculative scheduling. This feature is
17757 available only during region scheduling (i.e. before reload). This
17758 results in generation of the "ld.s" instructions and the
17759 corresponding check instructions "chk.s". The default setting is
17760 disabled.
17761
17762 -msched-br-in-data-spec
17763 -mno-sched-br-in-data-spec
17764 (En/Dis)able speculative scheduling of the instructions that are
17765 dependent on the data speculative loads before reload. This is
17766 effective only with -msched-br-data-spec enabled. The default
17767 setting is enabled.
17768
17769 -msched-ar-in-data-spec
17770 -mno-sched-ar-in-data-spec
17771 (En/Dis)able speculative scheduling of the instructions that are
17772 dependent on the data speculative loads after reload. This is
17773 effective only with -msched-ar-data-spec enabled. The default
17774 setting is enabled.
17775
17776 -msched-in-control-spec
17777 -mno-sched-in-control-spec
17778 (En/Dis)able speculative scheduling of the instructions that are
17779 dependent on the control speculative loads. This is effective only
17780 with -msched-control-spec enabled. The default setting is enabled.
17781
17782 -mno-sched-prefer-non-data-spec-insns
17783 -msched-prefer-non-data-spec-insns
17784 If enabled, data-speculative instructions are chosen for schedule
17785 only if there are no other choices at the moment. This makes the
17786 use of the data speculation much more conservative. The default
17787 setting is disabled.
17788
17789 -mno-sched-prefer-non-control-spec-insns
17790 -msched-prefer-non-control-spec-insns
17791 If enabled, control-speculative instructions are chosen for
17792 schedule only if there are no other choices at the moment. This
17793 makes the use of the control speculation much more conservative.
17794 The default setting is disabled.
17795
17796 -mno-sched-count-spec-in-critical-path
17797 -msched-count-spec-in-critical-path
17798 If enabled, speculative dependencies are considered during
17799 computation of the instructions priorities. This makes the use of
17800 the speculation a bit more conservative. The default setting is
17801 disabled.
17802
17803 -msched-spec-ldc
17804 Use a simple data speculation check. This option is on by default.
17805
17806 -msched-control-spec-ldc
17807 Use a simple check for control speculation. This option is on by
17808 default.
17809
17810 -msched-stop-bits-after-every-cycle
17811 Place a stop bit after every cycle when scheduling. This option is
17812 on by default.
17813
17814 -msched-fp-mem-deps-zero-cost
17815 Assume that floating-point stores and loads are not likely to cause
17816 a conflict when placed into the same instruction group. This
17817 option is disabled by default.
17818
17819 -msel-sched-dont-check-control-spec
17820 Generate checks for control speculation in selective scheduling.
17821 This flag is disabled by default.
17822
17823 -msched-max-memory-insns=max-insns
17824 Limit on the number of memory insns per instruction group, giving
17825 lower priority to subsequent memory insns attempting to schedule in
17826 the same instruction group. Frequently useful to prevent cache bank
17827 conflicts. The default value is 1.
17828
17829 -msched-max-memory-insns-hard-limit
17830 Makes the limit specified by msched-max-memory-insns a hard limit,
17831 disallowing more than that number in an instruction group.
17832 Otherwise, the limit is "soft", meaning that non-memory operations
17833 are preferred when the limit is reached, but memory operations may
17834 still be scheduled.
17835
17836 LM32 Options
17837 These -m options are defined for the LatticeMico32 architecture:
17838
17839 -mbarrel-shift-enabled
17840 Enable barrel-shift instructions.
17841
17842 -mdivide-enabled
17843 Enable divide and modulus instructions.
17844
17845 -mmultiply-enabled
17846 Enable multiply instructions.
17847
17848 -msign-extend-enabled
17849 Enable sign extend instructions.
17850
17851 -muser-enabled
17852 Enable user-defined instructions.
17853
17854 M32C Options
17855 -mcpu=name
17856 Select the CPU for which code is generated. name may be one of r8c
17857 for the R8C/Tiny series, m16c for the M16C (up to /60) series,
17858 m32cm for the M16C/80 series, or m32c for the M32C/80 series.
17859
17860 -msim
17861 Specifies that the program will be run on the simulator. This
17862 causes an alternate runtime library to be linked in which supports,
17863 for example, file I/O. You must not use this option when
17864 generating programs that will run on real hardware; you must
17865 provide your own runtime library for whatever I/O functions are
17866 needed.
17867
17868 -memregs=number
17869 Specifies the number of memory-based pseudo-registers GCC uses
17870 during code generation. These pseudo-registers are used like real
17871 registers, so there is a tradeoff between GCC's ability to fit the
17872 code into available registers, and the performance penalty of using
17873 memory instead of registers. Note that all modules in a program
17874 must be compiled with the same value for this option. Because of
17875 that, you must not use this option with GCC's default runtime
17876 libraries.
17877
17878 M32R/D Options
17879 These -m options are defined for Renesas M32R/D architectures:
17880
17881 -m32r2
17882 Generate code for the M32R/2.
17883
17884 -m32rx
17885 Generate code for the M32R/X.
17886
17887 -m32r
17888 Generate code for the M32R. This is the default.
17889
17890 -mmodel=small
17891 Assume all objects live in the lower 16MB of memory (so that their
17892 addresses can be loaded with the "ld24" instruction), and assume
17893 all subroutines are reachable with the "bl" instruction. This is
17894 the default.
17895
17896 The addressability of a particular object can be set with the
17897 "model" attribute.
17898
17899 -mmodel=medium
17900 Assume objects may be anywhere in the 32-bit address space (the
17901 compiler generates "seth/add3" instructions to load their
17902 addresses), and assume all subroutines are reachable with the "bl"
17903 instruction.
17904
17905 -mmodel=large
17906 Assume objects may be anywhere in the 32-bit address space (the
17907 compiler generates "seth/add3" instructions to load their
17908 addresses), and assume subroutines may not be reachable with the
17909 "bl" instruction (the compiler generates the much slower
17910 "seth/add3/jl" instruction sequence).
17911
17912 -msdata=none
17913 Disable use of the small data area. Variables are put into one of
17914 ".data", ".bss", or ".rodata" (unless the "section" attribute has
17915 been specified). This is the default.
17916
17917 The small data area consists of sections ".sdata" and ".sbss".
17918 Objects may be explicitly put in the small data area with the
17919 "section" attribute using one of these sections.
17920
17921 -msdata=sdata
17922 Put small global and static data in the small data area, but do not
17923 generate special code to reference them.
17924
17925 -msdata=use
17926 Put small global and static data in the small data area, and
17927 generate special instructions to reference them.
17928
17929 -G num
17930 Put global and static objects less than or equal to num bytes into
17931 the small data or BSS sections instead of the normal data or BSS
17932 sections. The default value of num is 8. The -msdata option must
17933 be set to one of sdata or use for this option to have any effect.
17934
17935 All modules should be compiled with the same -G num value.
17936 Compiling with different values of num may or may not work; if it
17937 doesn't the linker gives an error message---incorrect code is not
17938 generated.
17939
17940 -mdebug
17941 Makes the M32R-specific code in the compiler display some
17942 statistics that might help in debugging programs.
17943
17944 -malign-loops
17945 Align all loops to a 32-byte boundary.
17946
17947 -mno-align-loops
17948 Do not enforce a 32-byte alignment for loops. This is the default.
17949
17950 -missue-rate=number
17951 Issue number instructions per cycle. number can only be 1 or 2.
17952
17953 -mbranch-cost=number
17954 number can only be 1 or 2. If it is 1 then branches are preferred
17955 over conditional code, if it is 2, then the opposite applies.
17956
17957 -mflush-trap=number
17958 Specifies the trap number to use to flush the cache. The default
17959 is 12. Valid numbers are between 0 and 15 inclusive.
17960
17961 -mno-flush-trap
17962 Specifies that the cache cannot be flushed by using a trap.
17963
17964 -mflush-func=name
17965 Specifies the name of the operating system function to call to
17966 flush the cache. The default is _flush_cache, but a function call
17967 is only used if a trap is not available.
17968
17969 -mno-flush-func
17970 Indicates that there is no OS function for flushing the cache.
17971
17972 M680x0 Options
17973 These are the -m options defined for M680x0 and ColdFire processors.
17974 The default settings depend on which architecture was selected when the
17975 compiler was configured; the defaults for the most common choices are
17976 given below.
17977
17978 -march=arch
17979 Generate code for a specific M680x0 or ColdFire instruction set
17980 architecture. Permissible values of arch for M680x0 architectures
17981 are: 68000, 68010, 68020, 68030, 68040, 68060 and cpu32. ColdFire
17982 architectures are selected according to Freescale's ISA
17983 classification and the permissible values are: isaa, isaaplus, isab
17984 and isac.
17985
17986 GCC defines a macro "__mcfarch__" whenever it is generating code
17987 for a ColdFire target. The arch in this macro is one of the -march
17988 arguments given above.
17989
17990 When used together, -march and -mtune select code that runs on a
17991 family of similar processors but that is optimized for a particular
17992 microarchitecture.
17993
17994 -mcpu=cpu
17995 Generate code for a specific M680x0 or ColdFire processor. The
17996 M680x0 cpus are: 68000, 68010, 68020, 68030, 68040, 68060, 68302,
17997 68332 and cpu32. The ColdFire cpus are given by the table below,
17998 which also classifies the CPUs into families:
17999
18000 Family : -mcpu arguments
18001 51 : 51 51ac 51ag 51cn 51em 51je 51jf 51jg 51jm 51mm 51qe 51qm
18002 5206 : 5202 5204 5206
18003 5206e : 5206e
18004 5208 : 5207 5208
18005 5211a : 5210a 5211a
18006 5213 : 5211 5212 5213
18007 5216 : 5214 5216
18008 52235 : 52230 52231 52232 52233 52234 52235
18009 5225 : 5224 5225
18010 52259 : 52252 52254 52255 52256 52258 52259
18011 5235 : 5232 5233 5234 5235 523x
18012 5249 : 5249
18013 5250 : 5250
18014 5271 : 5270 5271
18015 5272 : 5272
18016 5275 : 5274 5275
18017 5282 : 5280 5281 5282 528x
18018 53017 : 53011 53012 53013 53014 53015 53016 53017
18019 5307 : 5307
18020 5329 : 5327 5328 5329 532x
18021 5373 : 5372 5373 537x
18022 5407 : 5407
18023 5475 : 5470 5471 5472 5473 5474 5475 547x 5480 5481 5482 5483 5484
18024 5485
18025
18026 -mcpu=cpu overrides -march=arch if arch is compatible with cpu.
18027 Other combinations of -mcpu and -march are rejected.
18028
18029 GCC defines the macro "__mcf_cpu_cpu" when ColdFire target cpu is
18030 selected. It also defines "__mcf_family_family", where the value
18031 of family is given by the table above.
18032
18033 -mtune=tune
18034 Tune the code for a particular microarchitecture within the
18035 constraints set by -march and -mcpu. The M680x0 microarchitectures
18036 are: 68000, 68010, 68020, 68030, 68040, 68060 and cpu32. The
18037 ColdFire microarchitectures are: cfv1, cfv2, cfv3, cfv4 and cfv4e.
18038
18039 You can also use -mtune=68020-40 for code that needs to run
18040 relatively well on 68020, 68030 and 68040 targets. -mtune=68020-60
18041 is similar but includes 68060 targets as well. These two options
18042 select the same tuning decisions as -m68020-40 and -m68020-60
18043 respectively.
18044
18045 GCC defines the macros "__mcarch" and "__mcarch__" when tuning for
18046 680x0 architecture arch. It also defines "mcarch" unless either
18047 -ansi or a non-GNU -std option is used. If GCC is tuning for a
18048 range of architectures, as selected by -mtune=68020-40 or
18049 -mtune=68020-60, it defines the macros for every architecture in
18050 the range.
18051
18052 GCC also defines the macro "__muarch__" when tuning for ColdFire
18053 microarchitecture uarch, where uarch is one of the arguments given
18054 above.
18055
18056 -m68000
18057 -mc68000
18058 Generate output for a 68000. This is the default when the compiler
18059 is configured for 68000-based systems. It is equivalent to
18060 -march=68000.
18061
18062 Use this option for microcontrollers with a 68000 or EC000 core,
18063 including the 68008, 68302, 68306, 68307, 68322, 68328 and 68356.
18064
18065 -m68010
18066 Generate output for a 68010. This is the default when the compiler
18067 is configured for 68010-based systems. It is equivalent to
18068 -march=68010.
18069
18070 -m68020
18071 -mc68020
18072 Generate output for a 68020. This is the default when the compiler
18073 is configured for 68020-based systems. It is equivalent to
18074 -march=68020.
18075
18076 -m68030
18077 Generate output for a 68030. This is the default when the compiler
18078 is configured for 68030-based systems. It is equivalent to
18079 -march=68030.
18080
18081 -m68040
18082 Generate output for a 68040. This is the default when the compiler
18083 is configured for 68040-based systems. It is equivalent to
18084 -march=68040.
18085
18086 This option inhibits the use of 68881/68882 instructions that have
18087 to be emulated by software on the 68040. Use this option if your
18088 68040 does not have code to emulate those instructions.
18089
18090 -m68060
18091 Generate output for a 68060. This is the default when the compiler
18092 is configured for 68060-based systems. It is equivalent to
18093 -march=68060.
18094
18095 This option inhibits the use of 68020 and 68881/68882 instructions
18096 that have to be emulated by software on the 68060. Use this option
18097 if your 68060 does not have code to emulate those instructions.
18098
18099 -mcpu32
18100 Generate output for a CPU32. This is the default when the compiler
18101 is configured for CPU32-based systems. It is equivalent to
18102 -march=cpu32.
18103
18104 Use this option for microcontrollers with a CPU32 or CPU32+ core,
18105 including the 68330, 68331, 68332, 68333, 68334, 68336, 68340,
18106 68341, 68349 and 68360.
18107
18108 -m5200
18109 Generate output for a 520X ColdFire CPU. This is the default when
18110 the compiler is configured for 520X-based systems. It is
18111 equivalent to -mcpu=5206, and is now deprecated in favor of that
18112 option.
18113
18114 Use this option for microcontroller with a 5200 core, including the
18115 MCF5202, MCF5203, MCF5204 and MCF5206.
18116
18117 -m5206e
18118 Generate output for a 5206e ColdFire CPU. The option is now
18119 deprecated in favor of the equivalent -mcpu=5206e.
18120
18121 -m528x
18122 Generate output for a member of the ColdFire 528X family. The
18123 option is now deprecated in favor of the equivalent -mcpu=528x.
18124
18125 -m5307
18126 Generate output for a ColdFire 5307 CPU. The option is now
18127 deprecated in favor of the equivalent -mcpu=5307.
18128
18129 -m5407
18130 Generate output for a ColdFire 5407 CPU. The option is now
18131 deprecated in favor of the equivalent -mcpu=5407.
18132
18133 -mcfv4e
18134 Generate output for a ColdFire V4e family CPU (e.g. 547x/548x).
18135 This includes use of hardware floating-point instructions. The
18136 option is equivalent to -mcpu=547x, and is now deprecated in favor
18137 of that option.
18138
18139 -m68020-40
18140 Generate output for a 68040, without using any of the new
18141 instructions. This results in code that can run relatively
18142 efficiently on either a 68020/68881 or a 68030 or a 68040. The
18143 generated code does use the 68881 instructions that are emulated on
18144 the 68040.
18145
18146 The option is equivalent to -march=68020 -mtune=68020-40.
18147
18148 -m68020-60
18149 Generate output for a 68060, without using any of the new
18150 instructions. This results in code that can run relatively
18151 efficiently on either a 68020/68881 or a 68030 or a 68040. The
18152 generated code does use the 68881 instructions that are emulated on
18153 the 68060.
18154
18155 The option is equivalent to -march=68020 -mtune=68020-60.
18156
18157 -mhard-float
18158 -m68881
18159 Generate floating-point instructions. This is the default for
18160 68020 and above, and for ColdFire devices that have an FPU. It
18161 defines the macro "__HAVE_68881__" on M680x0 targets and
18162 "__mcffpu__" on ColdFire targets.
18163
18164 -msoft-float
18165 Do not generate floating-point instructions; use library calls
18166 instead. This is the default for 68000, 68010, and 68832 targets.
18167 It is also the default for ColdFire devices that have no FPU.
18168
18169 -mdiv
18170 -mno-div
18171 Generate (do not generate) ColdFire hardware divide and remainder
18172 instructions. If -march is used without -mcpu, the default is "on"
18173 for ColdFire architectures and "off" for M680x0 architectures.
18174 Otherwise, the default is taken from the target CPU (either the
18175 default CPU, or the one specified by -mcpu). For example, the
18176 default is "off" for -mcpu=5206 and "on" for -mcpu=5206e.
18177
18178 GCC defines the macro "__mcfhwdiv__" when this option is enabled.
18179
18180 -mshort
18181 Consider type "int" to be 16 bits wide, like "short int".
18182 Additionally, parameters passed on the stack are also aligned to a
18183 16-bit boundary even on targets whose API mandates promotion to
18184 32-bit.
18185
18186 -mno-short
18187 Do not consider type "int" to be 16 bits wide. This is the
18188 default.
18189
18190 -mnobitfield
18191 -mno-bitfield
18192 Do not use the bit-field instructions. The -m68000, -mcpu32 and
18193 -m5200 options imply -mnobitfield.
18194
18195 -mbitfield
18196 Do use the bit-field instructions. The -m68020 option implies
18197 -mbitfield. This is the default if you use a configuration
18198 designed for a 68020.
18199
18200 -mrtd
18201 Use a different function-calling convention, in which functions
18202 that take a fixed number of arguments return with the "rtd"
18203 instruction, which pops their arguments while returning. This
18204 saves one instruction in the caller since there is no need to pop
18205 the arguments there.
18206
18207 This calling convention is incompatible with the one normally used
18208 on Unix, so you cannot use it if you need to call libraries
18209 compiled with the Unix compiler.
18210
18211 Also, you must provide function prototypes for all functions that
18212 take variable numbers of arguments (including "printf"); otherwise
18213 incorrect code is generated for calls to those functions.
18214
18215 In addition, seriously incorrect code results if you call a
18216 function with too many arguments. (Normally, extra arguments are
18217 harmlessly ignored.)
18218
18219 The "rtd" instruction is supported by the 68010, 68020, 68030,
18220 68040, 68060 and CPU32 processors, but not by the 68000 or 5200.
18221
18222 The default is -mno-rtd.
18223
18224 -malign-int
18225 -mno-align-int
18226 Control whether GCC aligns "int", "long", "long long", "float",
18227 "double", and "long double" variables on a 32-bit boundary
18228 (-malign-int) or a 16-bit boundary (-mno-align-int). Aligning
18229 variables on 32-bit boundaries produces code that runs somewhat
18230 faster on processors with 32-bit busses at the expense of more
18231 memory.
18232
18233 Warning: if you use the -malign-int switch, GCC aligns structures
18234 containing the above types differently than most published
18235 application binary interface specifications for the m68k.
18236
18237 -mpcrel
18238 Use the pc-relative addressing mode of the 68000 directly, instead
18239 of using a global offset table. At present, this option implies
18240 -fpic, allowing at most a 16-bit offset for pc-relative addressing.
18241 -fPIC is not presently supported with -mpcrel, though this could be
18242 supported for 68020 and higher processors.
18243
18244 -mno-strict-align
18245 -mstrict-align
18246 Do not (do) assume that unaligned memory references are handled by
18247 the system.
18248
18249 -msep-data
18250 Generate code that allows the data segment to be located in a
18251 different area of memory from the text segment. This allows for
18252 execute-in-place in an environment without virtual memory
18253 management. This option implies -fPIC.
18254
18255 -mno-sep-data
18256 Generate code that assumes that the data segment follows the text
18257 segment. This is the default.
18258
18259 -mid-shared-library
18260 Generate code that supports shared libraries via the library ID
18261 method. This allows for execute-in-place and shared libraries in
18262 an environment without virtual memory management. This option
18263 implies -fPIC.
18264
18265 -mno-id-shared-library
18266 Generate code that doesn't assume ID-based shared libraries are
18267 being used. This is the default.
18268
18269 -mshared-library-id=n
18270 Specifies the identification number of the ID-based shared library
18271 being compiled. Specifying a value of 0 generates more compact
18272 code; specifying other values forces the allocation of that number
18273 to the current library, but is no more space- or time-efficient
18274 than omitting this option.
18275
18276 -mxgot
18277 -mno-xgot
18278 When generating position-independent code for ColdFire, generate
18279 code that works if the GOT has more than 8192 entries. This code
18280 is larger and slower than code generated without this option. On
18281 M680x0 processors, this option is not needed; -fPIC suffices.
18282
18283 GCC normally uses a single instruction to load values from the GOT.
18284 While this is relatively efficient, it only works if the GOT is
18285 smaller than about 64k. Anything larger causes the linker to
18286 report an error such as:
18287
18288 relocation truncated to fit: R_68K_GOT16O foobar
18289
18290 If this happens, you should recompile your code with -mxgot. It
18291 should then work with very large GOTs. However, code generated
18292 with -mxgot is less efficient, since it takes 4 instructions to
18293 fetch the value of a global symbol.
18294
18295 Note that some linkers, including newer versions of the GNU linker,
18296 can create multiple GOTs and sort GOT entries. If you have such a
18297 linker, you should only need to use -mxgot when compiling a single
18298 object file that accesses more than 8192 GOT entries. Very few do.
18299
18300 These options have no effect unless GCC is generating position-
18301 independent code.
18302
18303 -mlong-jump-table-offsets
18304 Use 32-bit offsets in "switch" tables. The default is to use
18305 16-bit offsets.
18306
18307 MCore Options
18308 These are the -m options defined for the Motorola M*Core processors.
18309
18310 -mhardlit
18311 -mno-hardlit
18312 Inline constants into the code stream if it can be done in two
18313 instructions or less.
18314
18315 -mdiv
18316 -mno-div
18317 Use the divide instruction. (Enabled by default).
18318
18319 -mrelax-immediate
18320 -mno-relax-immediate
18321 Allow arbitrary-sized immediates in bit operations.
18322
18323 -mwide-bitfields
18324 -mno-wide-bitfields
18325 Always treat bit-fields as "int"-sized.
18326
18327 -m4byte-functions
18328 -mno-4byte-functions
18329 Force all functions to be aligned to a 4-byte boundary.
18330
18331 -mcallgraph-data
18332 -mno-callgraph-data
18333 Emit callgraph information.
18334
18335 -mslow-bytes
18336 -mno-slow-bytes
18337 Prefer word access when reading byte quantities.
18338
18339 -mlittle-endian
18340 -mbig-endian
18341 Generate code for a little-endian target.
18342
18343 -m210
18344 -m340
18345 Generate code for the 210 processor.
18346
18347 -mno-lsim
18348 Assume that runtime support has been provided and so omit the
18349 simulator library (libsim.a) from the linker command line.
18350
18351 -mstack-increment=size
18352 Set the maximum amount for a single stack increment operation.
18353 Large values can increase the speed of programs that contain
18354 functions that need a large amount of stack space, but they can
18355 also trigger a segmentation fault if the stack is extended too
18356 much. The default value is 0x1000.
18357
18358 MeP Options
18359 -mabsdiff
18360 Enables the "abs" instruction, which is the absolute difference
18361 between two registers.
18362
18363 -mall-opts
18364 Enables all the optional instructions---average, multiply, divide,
18365 bit operations, leading zero, absolute difference, min/max, clip,
18366 and saturation.
18367
18368 -maverage
18369 Enables the "ave" instruction, which computes the average of two
18370 registers.
18371
18372 -mbased=n
18373 Variables of size n bytes or smaller are placed in the ".based"
18374 section by default. Based variables use the $tp register as a base
18375 register, and there is a 128-byte limit to the ".based" section.
18376
18377 -mbitops
18378 Enables the bit operation instructions---bit test ("btstm"), set
18379 ("bsetm"), clear ("bclrm"), invert ("bnotm"), and test-and-set
18380 ("tas").
18381
18382 -mc=name
18383 Selects which section constant data is placed in. name may be
18384 tiny, near, or far.
18385
18386 -mclip
18387 Enables the "clip" instruction. Note that -mclip is not useful
18388 unless you also provide -mminmax.
18389
18390 -mconfig=name
18391 Selects one of the built-in core configurations. Each MeP chip has
18392 one or more modules in it; each module has a core CPU and a variety
18393 of coprocessors, optional instructions, and peripherals. The
18394 "MeP-Integrator" tool, not part of GCC, provides these
18395 configurations through this option; using this option is the same
18396 as using all the corresponding command-line options. The default
18397 configuration is default.
18398
18399 -mcop
18400 Enables the coprocessor instructions. By default, this is a 32-bit
18401 coprocessor. Note that the coprocessor is normally enabled via the
18402 -mconfig= option.
18403
18404 -mcop32
18405 Enables the 32-bit coprocessor's instructions.
18406
18407 -mcop64
18408 Enables the 64-bit coprocessor's instructions.
18409
18410 -mivc2
18411 Enables IVC2 scheduling. IVC2 is a 64-bit VLIW coprocessor.
18412
18413 -mdc
18414 Causes constant variables to be placed in the ".near" section.
18415
18416 -mdiv
18417 Enables the "div" and "divu" instructions.
18418
18419 -meb
18420 Generate big-endian code.
18421
18422 -mel
18423 Generate little-endian code.
18424
18425 -mio-volatile
18426 Tells the compiler that any variable marked with the "io" attribute
18427 is to be considered volatile.
18428
18429 -ml Causes variables to be assigned to the ".far" section by default.
18430
18431 -mleadz
18432 Enables the "leadz" (leading zero) instruction.
18433
18434 -mm Causes variables to be assigned to the ".near" section by default.
18435
18436 -mminmax
18437 Enables the "min" and "max" instructions.
18438
18439 -mmult
18440 Enables the multiplication and multiply-accumulate instructions.
18441
18442 -mno-opts
18443 Disables all the optional instructions enabled by -mall-opts.
18444
18445 -mrepeat
18446 Enables the "repeat" and "erepeat" instructions, used for low-
18447 overhead looping.
18448
18449 -ms Causes all variables to default to the ".tiny" section. Note that
18450 there is a 65536-byte limit to this section. Accesses to these
18451 variables use the %gp base register.
18452
18453 -msatur
18454 Enables the saturation instructions. Note that the compiler does
18455 not currently generate these itself, but this option is included
18456 for compatibility with other tools, like "as".
18457
18458 -msdram
18459 Link the SDRAM-based runtime instead of the default ROM-based
18460 runtime.
18461
18462 -msim
18463 Link the simulator run-time libraries.
18464
18465 -msimnovec
18466 Link the simulator runtime libraries, excluding built-in support
18467 for reset and exception vectors and tables.
18468
18469 -mtf
18470 Causes all functions to default to the ".far" section. Without
18471 this option, functions default to the ".near" section.
18472
18473 -mtiny=n
18474 Variables that are n bytes or smaller are allocated to the ".tiny"
18475 section. These variables use the $gp base register. The default
18476 for this option is 4, but note that there's a 65536-byte limit to
18477 the ".tiny" section.
18478
18479 MicroBlaze Options
18480 -msoft-float
18481 Use software emulation for floating point (default).
18482
18483 -mhard-float
18484 Use hardware floating-point instructions.
18485
18486 -mmemcpy
18487 Do not optimize block moves, use "memcpy".
18488
18489 -mno-clearbss
18490 This option is deprecated. Use -fno-zero-initialized-in-bss
18491 instead.
18492
18493 -mcpu=cpu-type
18494 Use features of, and schedule code for, the given CPU. Supported
18495 values are in the format vX.YY.Z, where X is a major version, YY is
18496 the minor version, and Z is compatibility code. Example values are
18497 v3.00.a, v4.00.b, v5.00.a, v5.00.b, v6.00.a.
18498
18499 -mxl-soft-mul
18500 Use software multiply emulation (default).
18501
18502 -mxl-soft-div
18503 Use software emulation for divides (default).
18504
18505 -mxl-barrel-shift
18506 Use the hardware barrel shifter.
18507
18508 -mxl-pattern-compare
18509 Use pattern compare instructions.
18510
18511 -msmall-divides
18512 Use table lookup optimization for small signed integer divisions.
18513
18514 -mxl-stack-check
18515 This option is deprecated. Use -fstack-check instead.
18516
18517 -mxl-gp-opt
18518 Use GP-relative ".sdata"/".sbss" sections.
18519
18520 -mxl-multiply-high
18521 Use multiply high instructions for high part of 32x32 multiply.
18522
18523 -mxl-float-convert
18524 Use hardware floating-point conversion instructions.
18525
18526 -mxl-float-sqrt
18527 Use hardware floating-point square root instruction.
18528
18529 -mbig-endian
18530 Generate code for a big-endian target.
18531
18532 -mlittle-endian
18533 Generate code for a little-endian target.
18534
18535 -mxl-reorder
18536 Use reorder instructions (swap and byte reversed load/store).
18537
18538 -mxl-mode-app-model
18539 Select application model app-model. Valid models are
18540
18541 executable
18542 normal executable (default), uses startup code crt0.o.
18543
18544 -mpic-data-is-text-relative
18545 Assume that the displacement between the text and data segments
18546 is fixed at static link time. This allows data to be
18547 referenced by offset from start of text address instead of GOT
18548 since PC-relative addressing is not supported.
18549
18550 xmdstub
18551 for use with Xilinx Microprocessor Debugger (XMD) based
18552 software intrusive debug agent called xmdstub. This uses
18553 startup file crt1.o and sets the start address of the program
18554 to 0x800.
18555
18556 bootstrap
18557 for applications that are loaded using a bootloader. This
18558 model uses startup file crt2.o which does not contain a
18559 processor reset vector handler. This is suitable for
18560 transferring control on a processor reset to the bootloader
18561 rather than the application.
18562
18563 novectors
18564 for applications that do not require any of the MicroBlaze
18565 vectors. This option may be useful for applications running
18566 within a monitoring application. This model uses crt3.o as a
18567 startup file.
18568
18569 Option -xl-mode-app-model is a deprecated alias for -mxl-mode-app-
18570 model.
18571
18572 MIPS Options
18573 -EB Generate big-endian code.
18574
18575 -EL Generate little-endian code. This is the default for mips*el-*-*
18576 configurations.
18577
18578 -march=arch
18579 Generate code that runs on arch, which can be the name of a generic
18580 MIPS ISA, or the name of a particular processor. The ISA names
18581 are: mips1, mips2, mips3, mips4, mips32, mips32r2, mips32r3,
18582 mips32r5, mips32r6, mips64, mips64r2, mips64r3, mips64r5 and
18583 mips64r6. The processor names are: 4kc, 4km, 4kp, 4ksc, 4kec,
18584 4kem, 4kep, 4ksd, 5kc, 5kf, 20kc, 24kc, 24kf2_1, 24kf1_1, 24kec,
18585 24kef2_1, 24kef1_1, 34kc, 34kf2_1, 34kf1_1, 34kn, 74kc, 74kf2_1,
18586 74kf1_1, 74kf3_2, 1004kc, 1004kf2_1, 1004kf1_1, i6400, i6500,
18587 interaptiv, loongson2e, loongson2f, loongson3a, gs464, gs464e,
18588 gs264e, m4k, m14k, m14kc, m14ke, m14kec, m5100, m5101, octeon,
18589 octeon+, octeon2, octeon3, orion, p5600, p6600, r2000, r3000,
18590 r3900, r4000, r4400, r4600, r4650, r4700, r5900, r6000, r8000,
18591 rm7000, rm9000, r10000, r12000, r14000, r16000, sb1, sr71000,
18592 vr4100, vr4111, vr4120, vr4130, vr4300, vr5000, vr5400, vr5500, xlr
18593 and xlp. The special value from-abi selects the most compatible
18594 architecture for the selected ABI (that is, mips1 for 32-bit ABIs
18595 and mips3 for 64-bit ABIs).
18596
18597 The native Linux/GNU toolchain also supports the value native,
18598 which selects the best architecture option for the host processor.
18599 -march=native has no effect if GCC does not recognize the
18600 processor.
18601
18602 In processor names, a final 000 can be abbreviated as k (for
18603 example, -march=r2k). Prefixes are optional, and vr may be written
18604 r.
18605
18606 Names of the form nf2_1 refer to processors with FPUs clocked at
18607 half the rate of the core, names of the form nf1_1 refer to
18608 processors with FPUs clocked at the same rate as the core, and
18609 names of the form nf3_2 refer to processors with FPUs clocked a
18610 ratio of 3:2 with respect to the core. For compatibility reasons,
18611 nf is accepted as a synonym for nf2_1 while nx and bfx are accepted
18612 as synonyms for nf1_1.
18613
18614 GCC defines two macros based on the value of this option. The
18615 first is "_MIPS_ARCH", which gives the name of target architecture,
18616 as a string. The second has the form "_MIPS_ARCH_foo", where foo
18617 is the capitalized value of "_MIPS_ARCH". For example,
18618 -march=r2000 sets "_MIPS_ARCH" to "r2000" and defines the macro
18619 "_MIPS_ARCH_R2000".
18620
18621 Note that the "_MIPS_ARCH" macro uses the processor names given
18622 above. In other words, it has the full prefix and does not
18623 abbreviate 000 as k. In the case of from-abi, the macro names the
18624 resolved architecture (either "mips1" or "mips3"). It names the
18625 default architecture when no -march option is given.
18626
18627 -mtune=arch
18628 Optimize for arch. Among other things, this option controls the
18629 way instructions are scheduled, and the perceived cost of
18630 arithmetic operations. The list of arch values is the same as for
18631 -march.
18632
18633 When this option is not used, GCC optimizes for the processor
18634 specified by -march. By using -march and -mtune together, it is
18635 possible to generate code that runs on a family of processors, but
18636 optimize the code for one particular member of that family.
18637
18638 -mtune defines the macros "_MIPS_TUNE" and "_MIPS_TUNE_foo", which
18639 work in the same way as the -march ones described above.
18640
18641 -mips1
18642 Equivalent to -march=mips1.
18643
18644 -mips2
18645 Equivalent to -march=mips2.
18646
18647 -mips3
18648 Equivalent to -march=mips3.
18649
18650 -mips4
18651 Equivalent to -march=mips4.
18652
18653 -mips32
18654 Equivalent to -march=mips32.
18655
18656 -mips32r3
18657 Equivalent to -march=mips32r3.
18658
18659 -mips32r5
18660 Equivalent to -march=mips32r5.
18661
18662 -mips32r6
18663 Equivalent to -march=mips32r6.
18664
18665 -mips64
18666 Equivalent to -march=mips64.
18667
18668 -mips64r2
18669 Equivalent to -march=mips64r2.
18670
18671 -mips64r3
18672 Equivalent to -march=mips64r3.
18673
18674 -mips64r5
18675 Equivalent to -march=mips64r5.
18676
18677 -mips64r6
18678 Equivalent to -march=mips64r6.
18679
18680 -mips16
18681 -mno-mips16
18682 Generate (do not generate) MIPS16 code. If GCC is targeting a
18683 MIPS32 or MIPS64 architecture, it makes use of the MIPS16e ASE.
18684
18685 MIPS16 code generation can also be controlled on a per-function
18686 basis by means of "mips16" and "nomips16" attributes.
18687
18688 -mflip-mips16
18689 Generate MIPS16 code on alternating functions. This option is
18690 provided for regression testing of mixed MIPS16/non-MIPS16 code
18691 generation, and is not intended for ordinary use in compiling user
18692 code.
18693
18694 -minterlink-compressed
18695 -mno-interlink-compressed
18696 Require (do not require) that code using the standard
18697 (uncompressed) MIPS ISA be link-compatible with MIPS16 and
18698 microMIPS code, and vice versa.
18699
18700 For example, code using the standard ISA encoding cannot jump
18701 directly to MIPS16 or microMIPS code; it must either use a call or
18702 an indirect jump. -minterlink-compressed therefore disables direct
18703 jumps unless GCC knows that the target of the jump is not
18704 compressed.
18705
18706 -minterlink-mips16
18707 -mno-interlink-mips16
18708 Aliases of -minterlink-compressed and -mno-interlink-compressed.
18709 These options predate the microMIPS ASE and are retained for
18710 backwards compatibility.
18711
18712 -mabi=32
18713 -mabi=o64
18714 -mabi=n32
18715 -mabi=64
18716 -mabi=eabi
18717 Generate code for the given ABI.
18718
18719 Note that the EABI has a 32-bit and a 64-bit variant. GCC normally
18720 generates 64-bit code when you select a 64-bit architecture, but
18721 you can use -mgp32 to get 32-bit code instead.
18722
18723 For information about the O64 ABI, see
18724 <http://gcc.gnu.org/projects/mipso64-abi.html>.
18725
18726 GCC supports a variant of the o32 ABI in which floating-point
18727 registers are 64 rather than 32 bits wide. You can select this
18728 combination with -mabi=32 -mfp64. This ABI relies on the "mthc1"
18729 and "mfhc1" instructions and is therefore only supported for
18730 MIPS32R2, MIPS32R3 and MIPS32R5 processors.
18731
18732 The register assignments for arguments and return values remain the
18733 same, but each scalar value is passed in a single 64-bit register
18734 rather than a pair of 32-bit registers. For example, scalar
18735 floating-point values are returned in $f0 only, not a $f0/$f1 pair.
18736 The set of call-saved registers also remains the same in that the
18737 even-numbered double-precision registers are saved.
18738
18739 Two additional variants of the o32 ABI are supported to enable a
18740 transition from 32-bit to 64-bit registers. These are FPXX
18741 (-mfpxx) and FP64A (-mfp64 -mno-odd-spreg). The FPXX extension
18742 mandates that all code must execute correctly when run using 32-bit
18743 or 64-bit registers. The code can be interlinked with either FP32
18744 or FP64, but not both. The FP64A extension is similar to the FP64
18745 extension but forbids the use of odd-numbered single-precision
18746 registers. This can be used in conjunction with the "FRE" mode of
18747 FPUs in MIPS32R5 processors and allows both FP32 and FP64A code to
18748 interlink and run in the same process without changing FPU modes.
18749
18750 -mabicalls
18751 -mno-abicalls
18752 Generate (do not generate) code that is suitable for SVR4-style
18753 dynamic objects. -mabicalls is the default for SVR4-based systems.
18754
18755 -mshared
18756 -mno-shared
18757 Generate (do not generate) code that is fully position-independent,
18758 and that can therefore be linked into shared libraries. This
18759 option only affects -mabicalls.
18760
18761 All -mabicalls code has traditionally been position-independent,
18762 regardless of options like -fPIC and -fpic. However, as an
18763 extension, the GNU toolchain allows executables to use absolute
18764 accesses for locally-binding symbols. It can also use shorter GP
18765 initialization sequences and generate direct calls to locally-
18766 defined functions. This mode is selected by -mno-shared.
18767
18768 -mno-shared depends on binutils 2.16 or higher and generates
18769 objects that can only be linked by the GNU linker. However, the
18770 option does not affect the ABI of the final executable; it only
18771 affects the ABI of relocatable objects. Using -mno-shared
18772 generally makes executables both smaller and quicker.
18773
18774 -mshared is the default.
18775
18776 -mplt
18777 -mno-plt
18778 Assume (do not assume) that the static and dynamic linkers support
18779 PLTs and copy relocations. This option only affects -mno-shared
18780 -mabicalls. For the n64 ABI, this option has no effect without
18781 -msym32.
18782
18783 You can make -mplt the default by configuring GCC with
18784 --with-mips-plt. The default is -mno-plt otherwise.
18785
18786 -mxgot
18787 -mno-xgot
18788 Lift (do not lift) the usual restrictions on the size of the global
18789 offset table.
18790
18791 GCC normally uses a single instruction to load values from the GOT.
18792 While this is relatively efficient, it only works if the GOT is
18793 smaller than about 64k. Anything larger causes the linker to
18794 report an error such as:
18795
18796 relocation truncated to fit: R_MIPS_GOT16 foobar
18797
18798 If this happens, you should recompile your code with -mxgot. This
18799 works with very large GOTs, although the code is also less
18800 efficient, since it takes three instructions to fetch the value of
18801 a global symbol.
18802
18803 Note that some linkers can create multiple GOTs. If you have such
18804 a linker, you should only need to use -mxgot when a single object
18805 file accesses more than 64k's worth of GOT entries. Very few do.
18806
18807 These options have no effect unless GCC is generating position
18808 independent code.
18809
18810 -mgp32
18811 Assume that general-purpose registers are 32 bits wide.
18812
18813 -mgp64
18814 Assume that general-purpose registers are 64 bits wide.
18815
18816 -mfp32
18817 Assume that floating-point registers are 32 bits wide.
18818
18819 -mfp64
18820 Assume that floating-point registers are 64 bits wide.
18821
18822 -mfpxx
18823 Do not assume the width of floating-point registers.
18824
18825 -mhard-float
18826 Use floating-point coprocessor instructions.
18827
18828 -msoft-float
18829 Do not use floating-point coprocessor instructions. Implement
18830 floating-point calculations using library calls instead.
18831
18832 -mno-float
18833 Equivalent to -msoft-float, but additionally asserts that the
18834 program being compiled does not perform any floating-point
18835 operations. This option is presently supported only by some bare-
18836 metal MIPS configurations, where it may select a special set of
18837 libraries that lack all floating-point support (including, for
18838 example, the floating-point "printf" formats). If code compiled
18839 with -mno-float accidentally contains floating-point operations, it
18840 is likely to suffer a link-time or run-time failure.
18841
18842 -msingle-float
18843 Assume that the floating-point coprocessor only supports single-
18844 precision operations.
18845
18846 -mdouble-float
18847 Assume that the floating-point coprocessor supports double-
18848 precision operations. This is the default.
18849
18850 -modd-spreg
18851 -mno-odd-spreg
18852 Enable the use of odd-numbered single-precision floating-point
18853 registers for the o32 ABI. This is the default for processors that
18854 are known to support these registers. When using the o32 FPXX ABI,
18855 -mno-odd-spreg is set by default.
18856
18857 -mabs=2008
18858 -mabs=legacy
18859 These options control the treatment of the special not-a-number
18860 (NaN) IEEE 754 floating-point data with the "abs.fmt" and "neg.fmt"
18861 machine instructions.
18862
18863 By default or when -mabs=legacy is used the legacy treatment is
18864 selected. In this case these instructions are considered
18865 arithmetic and avoided where correct operation is required and the
18866 input operand might be a NaN. A longer sequence of instructions
18867 that manipulate the sign bit of floating-point datum manually is
18868 used instead unless the -ffinite-math-only option has also been
18869 specified.
18870
18871 The -mabs=2008 option selects the IEEE 754-2008 treatment. In this
18872 case these instructions are considered non-arithmetic and therefore
18873 operating correctly in all cases, including in particular where the
18874 input operand is a NaN. These instructions are therefore always
18875 used for the respective operations.
18876
18877 -mnan=2008
18878 -mnan=legacy
18879 These options control the encoding of the special not-a-number
18880 (NaN) IEEE 754 floating-point data.
18881
18882 The -mnan=legacy option selects the legacy encoding. In this case
18883 quiet NaNs (qNaNs) are denoted by the first bit of their trailing
18884 significand field being 0, whereas signaling NaNs (sNaNs) are
18885 denoted by the first bit of their trailing significand field being
18886 1.
18887
18888 The -mnan=2008 option selects the IEEE 754-2008 encoding. In this
18889 case qNaNs are denoted by the first bit of their trailing
18890 significand field being 1, whereas sNaNs are denoted by the first
18891 bit of their trailing significand field being 0.
18892
18893 The default is -mnan=legacy unless GCC has been configured with
18894 --with-nan=2008.
18895
18896 -mllsc
18897 -mno-llsc
18898 Use (do not use) ll, sc, and sync instructions to implement atomic
18899 memory built-in functions. When neither option is specified, GCC
18900 uses the instructions if the target architecture supports them.
18901
18902 -mllsc is useful if the runtime environment can emulate the
18903 instructions and -mno-llsc can be useful when compiling for
18904 nonstandard ISAs. You can make either option the default by
18905 configuring GCC with --with-llsc and --without-llsc respectively.
18906 --with-llsc is the default for some configurations; see the
18907 installation documentation for details.
18908
18909 -mdsp
18910 -mno-dsp
18911 Use (do not use) revision 1 of the MIPS DSP ASE.
18912 This option defines the preprocessor macro "__mips_dsp". It also
18913 defines "__mips_dsp_rev" to 1.
18914
18915 -mdspr2
18916 -mno-dspr2
18917 Use (do not use) revision 2 of the MIPS DSP ASE.
18918 This option defines the preprocessor macros "__mips_dsp" and
18919 "__mips_dspr2". It also defines "__mips_dsp_rev" to 2.
18920
18921 -msmartmips
18922 -mno-smartmips
18923 Use (do not use) the MIPS SmartMIPS ASE.
18924
18925 -mpaired-single
18926 -mno-paired-single
18927 Use (do not use) paired-single floating-point instructions.
18928 This option requires hardware floating-point support to be
18929 enabled.
18930
18931 -mdmx
18932 -mno-mdmx
18933 Use (do not use) MIPS Digital Media Extension instructions. This
18934 option can only be used when generating 64-bit code and requires
18935 hardware floating-point support to be enabled.
18936
18937 -mips3d
18938 -mno-mips3d
18939 Use (do not use) the MIPS-3D ASE. The option -mips3d implies
18940 -mpaired-single.
18941
18942 -mmicromips
18943 -mno-micromips
18944 Generate (do not generate) microMIPS code.
18945
18946 MicroMIPS code generation can also be controlled on a per-function
18947 basis by means of "micromips" and "nomicromips" attributes.
18948
18949 -mmt
18950 -mno-mt
18951 Use (do not use) MT Multithreading instructions.
18952
18953 -mmcu
18954 -mno-mcu
18955 Use (do not use) the MIPS MCU ASE instructions.
18956
18957 -meva
18958 -mno-eva
18959 Use (do not use) the MIPS Enhanced Virtual Addressing instructions.
18960
18961 -mvirt
18962 -mno-virt
18963 Use (do not use) the MIPS Virtualization (VZ) instructions.
18964
18965 -mxpa
18966 -mno-xpa
18967 Use (do not use) the MIPS eXtended Physical Address (XPA)
18968 instructions.
18969
18970 -mcrc
18971 -mno-crc
18972 Use (do not use) the MIPS Cyclic Redundancy Check (CRC)
18973 instructions.
18974
18975 -mginv
18976 -mno-ginv
18977 Use (do not use) the MIPS Global INValidate (GINV) instructions.
18978
18979 -mloongson-mmi
18980 -mno-loongson-mmi
18981 Use (do not use) the MIPS Loongson MultiMedia extensions
18982 Instructions (MMI).
18983
18984 -mloongson-ext
18985 -mno-loongson-ext
18986 Use (do not use) the MIPS Loongson EXTensions (EXT) instructions.
18987
18988 -mloongson-ext2
18989 -mno-loongson-ext2
18990 Use (do not use) the MIPS Loongson EXTensions r2 (EXT2)
18991 instructions.
18992
18993 -mlong64
18994 Force "long" types to be 64 bits wide. See -mlong32 for an
18995 explanation of the default and the way that the pointer size is
18996 determined.
18997
18998 -mlong32
18999 Force "long", "int", and pointer types to be 32 bits wide.
19000
19001 The default size of "int"s, "long"s and pointers depends on the
19002 ABI. All the supported ABIs use 32-bit "int"s. The n64 ABI uses
19003 64-bit "long"s, as does the 64-bit EABI; the others use 32-bit
19004 "long"s. Pointers are the same size as "long"s, or the same size
19005 as integer registers, whichever is smaller.
19006
19007 -msym32
19008 -mno-sym32
19009 Assume (do not assume) that all symbols have 32-bit values,
19010 regardless of the selected ABI. This option is useful in
19011 combination with -mabi=64 and -mno-abicalls because it allows GCC
19012 to generate shorter and faster references to symbolic addresses.
19013
19014 -G num
19015 Put definitions of externally-visible data in a small data section
19016 if that data is no bigger than num bytes. GCC can then generate
19017 more efficient accesses to the data; see -mgpopt for details.
19018
19019 The default -G option depends on the configuration.
19020
19021 -mlocal-sdata
19022 -mno-local-sdata
19023 Extend (do not extend) the -G behavior to local data too, such as
19024 to static variables in C. -mlocal-sdata is the default for all
19025 configurations.
19026
19027 If the linker complains that an application is using too much small
19028 data, you might want to try rebuilding the less performance-
19029 critical parts with -mno-local-sdata. You might also want to build
19030 large libraries with -mno-local-sdata, so that the libraries leave
19031 more room for the main program.
19032
19033 -mextern-sdata
19034 -mno-extern-sdata
19035 Assume (do not assume) that externally-defined data is in a small
19036 data section if the size of that data is within the -G limit.
19037 -mextern-sdata is the default for all configurations.
19038
19039 If you compile a module Mod with -mextern-sdata -G num -mgpopt, and
19040 Mod references a variable Var that is no bigger than num bytes, you
19041 must make sure that Var is placed in a small data section. If Var
19042 is defined by another module, you must either compile that module
19043 with a high-enough -G setting or attach a "section" attribute to
19044 Var's definition. If Var is common, you must link the application
19045 with a high-enough -G setting.
19046
19047 The easiest way of satisfying these restrictions is to compile and
19048 link every module with the same -G option. However, you may wish
19049 to build a library that supports several different small data
19050 limits. You can do this by compiling the library with the highest
19051 supported -G setting and additionally using -mno-extern-sdata to
19052 stop the library from making assumptions about externally-defined
19053 data.
19054
19055 -mgpopt
19056 -mno-gpopt
19057 Use (do not use) GP-relative accesses for symbols that are known to
19058 be in a small data section; see -G, -mlocal-sdata and
19059 -mextern-sdata. -mgpopt is the default for all configurations.
19060
19061 -mno-gpopt is useful for cases where the $gp register might not
19062 hold the value of "_gp". For example, if the code is part of a
19063 library that might be used in a boot monitor, programs that call
19064 boot monitor routines pass an unknown value in $gp. (In such
19065 situations, the boot monitor itself is usually compiled with -G0.)
19066
19067 -mno-gpopt implies -mno-local-sdata and -mno-extern-sdata.
19068
19069 -membedded-data
19070 -mno-embedded-data
19071 Allocate variables to the read-only data section first if possible,
19072 then next in the small data section if possible, otherwise in data.
19073 This gives slightly slower code than the default, but reduces the
19074 amount of RAM required when executing, and thus may be preferred
19075 for some embedded systems.
19076
19077 -muninit-const-in-rodata
19078 -mno-uninit-const-in-rodata
19079 Put uninitialized "const" variables in the read-only data section.
19080 This option is only meaningful in conjunction with -membedded-data.
19081
19082 -mcode-readable=setting
19083 Specify whether GCC may generate code that reads from executable
19084 sections. There are three possible settings:
19085
19086 -mcode-readable=yes
19087 Instructions may freely access executable sections. This is
19088 the default setting.
19089
19090 -mcode-readable=pcrel
19091 MIPS16 PC-relative load instructions can access executable
19092 sections, but other instructions must not do so. This option
19093 is useful on 4KSc and 4KSd processors when the code TLBs have
19094 the Read Inhibit bit set. It is also useful on processors that
19095 can be configured to have a dual instruction/data SRAM
19096 interface and that, like the M4K, automatically redirect PC-
19097 relative loads to the instruction RAM.
19098
19099 -mcode-readable=no
19100 Instructions must not access executable sections. This option
19101 can be useful on targets that are configured to have a dual
19102 instruction/data SRAM interface but that (unlike the M4K) do
19103 not automatically redirect PC-relative loads to the instruction
19104 RAM.
19105
19106 -msplit-addresses
19107 -mno-split-addresses
19108 Enable (disable) use of the "%hi()" and "%lo()" assembler
19109 relocation operators. This option has been superseded by
19110 -mexplicit-relocs but is retained for backwards compatibility.
19111
19112 -mexplicit-relocs
19113 -mno-explicit-relocs
19114 Use (do not use) assembler relocation operators when dealing with
19115 symbolic addresses. The alternative, selected by
19116 -mno-explicit-relocs, is to use assembler macros instead.
19117
19118 -mexplicit-relocs is the default if GCC was configured to use an
19119 assembler that supports relocation operators.
19120
19121 -mcheck-zero-division
19122 -mno-check-zero-division
19123 Trap (do not trap) on integer division by zero.
19124
19125 The default is -mcheck-zero-division.
19126
19127 -mdivide-traps
19128 -mdivide-breaks
19129 MIPS systems check for division by zero by generating either a
19130 conditional trap or a break instruction. Using traps results in
19131 smaller code, but is only supported on MIPS II and later. Also,
19132 some versions of the Linux kernel have a bug that prevents trap
19133 from generating the proper signal ("SIGFPE"). Use -mdivide-traps
19134 to allow conditional traps on architectures that support them and
19135 -mdivide-breaks to force the use of breaks.
19136
19137 The default is usually -mdivide-traps, but this can be overridden
19138 at configure time using --with-divide=breaks. Divide-by-zero
19139 checks can be completely disabled using -mno-check-zero-division.
19140
19141 -mload-store-pairs
19142 -mno-load-store-pairs
19143 Enable (disable) an optimization that pairs consecutive load or
19144 store instructions to enable load/store bonding. This option is
19145 enabled by default but only takes effect when the selected
19146 architecture is known to support bonding.
19147
19148 -mmemcpy
19149 -mno-memcpy
19150 Force (do not force) the use of "memcpy" for non-trivial block
19151 moves. The default is -mno-memcpy, which allows GCC to inline most
19152 constant-sized copies.
19153
19154 -mlong-calls
19155 -mno-long-calls
19156 Disable (do not disable) use of the "jal" instruction. Calling
19157 functions using "jal" is more efficient but requires the caller and
19158 callee to be in the same 256 megabyte segment.
19159
19160 This option has no effect on abicalls code. The default is
19161 -mno-long-calls.
19162
19163 -mmad
19164 -mno-mad
19165 Enable (disable) use of the "mad", "madu" and "mul" instructions,
19166 as provided by the R4650 ISA.
19167
19168 -mimadd
19169 -mno-imadd
19170 Enable (disable) use of the "madd" and "msub" integer instructions.
19171 The default is -mimadd on architectures that support "madd" and
19172 "msub" except for the 74k architecture where it was found to
19173 generate slower code.
19174
19175 -mfused-madd
19176 -mno-fused-madd
19177 Enable (disable) use of the floating-point multiply-accumulate
19178 instructions, when they are available. The default is
19179 -mfused-madd.
19180
19181 On the R8000 CPU when multiply-accumulate instructions are used,
19182 the intermediate product is calculated to infinite precision and is
19183 not subject to the FCSR Flush to Zero bit. This may be undesirable
19184 in some circumstances. On other processors the result is
19185 numerically identical to the equivalent computation using separate
19186 multiply, add, subtract and negate instructions.
19187
19188 -nocpp
19189 Tell the MIPS assembler to not run its preprocessor over user
19190 assembler files (with a .s suffix) when assembling them.
19191
19192 -mfix-24k
19193 -mno-fix-24k
19194 Work around the 24K E48 (lost data on stores during refill) errata.
19195 The workarounds are implemented by the assembler rather than by
19196 GCC.
19197
19198 -mfix-r4000
19199 -mno-fix-r4000
19200 Work around certain R4000 CPU errata:
19201
19202 - A double-word or a variable shift may give an incorrect result
19203 if executed immediately after starting an integer division.
19204
19205 - A double-word or a variable shift may give an incorrect result
19206 if executed while an integer multiplication is in progress.
19207
19208 - An integer division may give an incorrect result if started in
19209 a delay slot of a taken branch or a jump.
19210
19211 -mfix-r4400
19212 -mno-fix-r4400
19213 Work around certain R4400 CPU errata:
19214
19215 - A double-word or a variable shift may give an incorrect result
19216 if executed immediately after starting an integer division.
19217
19218 -mfix-r10000
19219 -mno-fix-r10000
19220 Work around certain R10000 errata:
19221
19222 - "ll"/"sc" sequences may not behave atomically on revisions
19223 prior to 3.0. They may deadlock on revisions 2.6 and earlier.
19224
19225 This option can only be used if the target architecture supports
19226 branch-likely instructions. -mfix-r10000 is the default when
19227 -march=r10000 is used; -mno-fix-r10000 is the default otherwise.
19228
19229 -mfix-r5900
19230 -mno-fix-r5900
19231 Do not attempt to schedule the preceding instruction into the delay
19232 slot of a branch instruction placed at the end of a short loop of
19233 six instructions or fewer and always schedule a "nop" instruction
19234 there instead. The short loop bug under certain conditions causes
19235 loops to execute only once or twice, due to a hardware bug in the
19236 R5900 chip. The workaround is implemented by the assembler rather
19237 than by GCC.
19238
19239 -mfix-rm7000
19240 -mno-fix-rm7000
19241 Work around the RM7000 "dmult"/"dmultu" errata. The workarounds
19242 are implemented by the assembler rather than by GCC.
19243
19244 -mfix-vr4120
19245 -mno-fix-vr4120
19246 Work around certain VR4120 errata:
19247
19248 - "dmultu" does not always produce the correct result.
19249
19250 - "div" and "ddiv" do not always produce the correct result if
19251 one of the operands is negative.
19252
19253 The workarounds for the division errata rely on special functions
19254 in libgcc.a. At present, these functions are only provided by the
19255 "mips64vr*-elf" configurations.
19256
19257 Other VR4120 errata require a NOP to be inserted between certain
19258 pairs of instructions. These errata are handled by the assembler,
19259 not by GCC itself.
19260
19261 -mfix-vr4130
19262 Work around the VR4130 "mflo"/"mfhi" errata. The workarounds are
19263 implemented by the assembler rather than by GCC, although GCC
19264 avoids using "mflo" and "mfhi" if the VR4130 "macc", "macchi",
19265 "dmacc" and "dmacchi" instructions are available instead.
19266
19267 -mfix-sb1
19268 -mno-fix-sb1
19269 Work around certain SB-1 CPU core errata. (This flag currently
19270 works around the SB-1 revision 2 "F1" and "F2" floating-point
19271 errata.)
19272
19273 -mr10k-cache-barrier=setting
19274 Specify whether GCC should insert cache barriers to avoid the side
19275 effects of speculation on R10K processors.
19276
19277 In common with many processors, the R10K tries to predict the
19278 outcome of a conditional branch and speculatively executes
19279 instructions from the "taken" branch. It later aborts these
19280 instructions if the predicted outcome is wrong. However, on the
19281 R10K, even aborted instructions can have side effects.
19282
19283 This problem only affects kernel stores and, depending on the
19284 system, kernel loads. As an example, a speculatively-executed
19285 store may load the target memory into cache and mark the cache line
19286 as dirty, even if the store itself is later aborted. If a DMA
19287 operation writes to the same area of memory before the "dirty" line
19288 is flushed, the cached data overwrites the DMA-ed data. See the
19289 R10K processor manual for a full description, including other
19290 potential problems.
19291
19292 One workaround is to insert cache barrier instructions before every
19293 memory access that might be speculatively executed and that might
19294 have side effects even if aborted. -mr10k-cache-barrier=setting
19295 controls GCC's implementation of this workaround. It assumes that
19296 aborted accesses to any byte in the following regions does not have
19297 side effects:
19298
19299 1. the memory occupied by the current function's stack frame;
19300
19301 2. the memory occupied by an incoming stack argument;
19302
19303 3. the memory occupied by an object with a link-time-constant
19304 address.
19305
19306 It is the kernel's responsibility to ensure that speculative
19307 accesses to these regions are indeed safe.
19308
19309 If the input program contains a function declaration such as:
19310
19311 void foo (void);
19312
19313 then the implementation of "foo" must allow "j foo" and "jal foo"
19314 to be executed speculatively. GCC honors this restriction for
19315 functions it compiles itself. It expects non-GCC functions (such
19316 as hand-written assembly code) to do the same.
19317
19318 The option has three forms:
19319
19320 -mr10k-cache-barrier=load-store
19321 Insert a cache barrier before a load or store that might be
19322 speculatively executed and that might have side effects even if
19323 aborted.
19324
19325 -mr10k-cache-barrier=store
19326 Insert a cache barrier before a store that might be
19327 speculatively executed and that might have side effects even if
19328 aborted.
19329
19330 -mr10k-cache-barrier=none
19331 Disable the insertion of cache barriers. This is the default
19332 setting.
19333
19334 -mflush-func=func
19335 -mno-flush-func
19336 Specifies the function to call to flush the I and D caches, or to
19337 not call any such function. If called, the function must take the
19338 same arguments as the common "_flush_func", that is, the address of
19339 the memory range for which the cache is being flushed, the size of
19340 the memory range, and the number 3 (to flush both caches). The
19341 default depends on the target GCC was configured for, but commonly
19342 is either "_flush_func" or "__cpu_flush".
19343
19344 mbranch-cost=num
19345 Set the cost of branches to roughly num "simple" instructions.
19346 This cost is only a heuristic and is not guaranteed to produce
19347 consistent results across releases. A zero cost redundantly
19348 selects the default, which is based on the -mtune setting.
19349
19350 -mbranch-likely
19351 -mno-branch-likely
19352 Enable or disable use of Branch Likely instructions, regardless of
19353 the default for the selected architecture. By default, Branch
19354 Likely instructions may be generated if they are supported by the
19355 selected architecture. An exception is for the MIPS32 and MIPS64
19356 architectures and processors that implement those architectures;
19357 for those, Branch Likely instructions are not be generated by
19358 default because the MIPS32 and MIPS64 architectures specifically
19359 deprecate their use.
19360
19361 -mcompact-branches=never
19362 -mcompact-branches=optimal
19363 -mcompact-branches=always
19364 These options control which form of branches will be generated.
19365 The default is -mcompact-branches=optimal.
19366
19367 The -mcompact-branches=never option ensures that compact branch
19368 instructions will never be generated.
19369
19370 The -mcompact-branches=always option ensures that a compact branch
19371 instruction will be generated if available. If a compact branch
19372 instruction is not available, a delay slot form of the branch will
19373 be used instead.
19374
19375 This option is supported from MIPS Release 6 onwards.
19376
19377 The -mcompact-branches=optimal option will cause a delay slot
19378 branch to be used if one is available in the current ISA and the
19379 delay slot is successfully filled. If the delay slot is not
19380 filled, a compact branch will be chosen if one is available.
19381
19382 -mfp-exceptions
19383 -mno-fp-exceptions
19384 Specifies whether FP exceptions are enabled. This affects how FP
19385 instructions are scheduled for some processors. The default is
19386 that FP exceptions are enabled.
19387
19388 For instance, on the SB-1, if FP exceptions are disabled, and we
19389 are emitting 64-bit code, then we can use both FP pipes.
19390 Otherwise, we can only use one FP pipe.
19391
19392 -mvr4130-align
19393 -mno-vr4130-align
19394 The VR4130 pipeline is two-way superscalar, but can only issue two
19395 instructions together if the first one is 8-byte aligned. When
19396 this option is enabled, GCC aligns pairs of instructions that it
19397 thinks should execute in parallel.
19398
19399 This option only has an effect when optimizing for the VR4130. It
19400 normally makes code faster, but at the expense of making it bigger.
19401 It is enabled by default at optimization level -O3.
19402
19403 -msynci
19404 -mno-synci
19405 Enable (disable) generation of "synci" instructions on
19406 architectures that support it. The "synci" instructions (if
19407 enabled) are generated when "__builtin___clear_cache" is compiled.
19408
19409 This option defaults to -mno-synci, but the default can be
19410 overridden by configuring GCC with --with-synci.
19411
19412 When compiling code for single processor systems, it is generally
19413 safe to use "synci". However, on many multi-core (SMP) systems, it
19414 does not invalidate the instruction caches on all cores and may
19415 lead to undefined behavior.
19416
19417 -mrelax-pic-calls
19418 -mno-relax-pic-calls
19419 Try to turn PIC calls that are normally dispatched via register $25
19420 into direct calls. This is only possible if the linker can resolve
19421 the destination at link time and if the destination is within range
19422 for a direct call.
19423
19424 -mrelax-pic-calls is the default if GCC was configured to use an
19425 assembler and a linker that support the ".reloc" assembly directive
19426 and -mexplicit-relocs is in effect. With -mno-explicit-relocs,
19427 this optimization can be performed by the assembler and the linker
19428 alone without help from the compiler.
19429
19430 -mmcount-ra-address
19431 -mno-mcount-ra-address
19432 Emit (do not emit) code that allows "_mcount" to modify the calling
19433 function's return address. When enabled, this option extends the
19434 usual "_mcount" interface with a new ra-address parameter, which
19435 has type "intptr_t *" and is passed in register $12. "_mcount" can
19436 then modify the return address by doing both of the following:
19437
19438 * Returning the new address in register $31.
19439
19440 * Storing the new address in "*ra-address", if ra-address is
19441 nonnull.
19442
19443 The default is -mno-mcount-ra-address.
19444
19445 -mframe-header-opt
19446 -mno-frame-header-opt
19447 Enable (disable) frame header optimization in the o32 ABI. When
19448 using the o32 ABI, calling functions will allocate 16 bytes on the
19449 stack for the called function to write out register arguments.
19450 When enabled, this optimization will suppress the allocation of the
19451 frame header if it can be determined that it is unused.
19452
19453 This optimization is off by default at all optimization levels.
19454
19455 -mlxc1-sxc1
19456 -mno-lxc1-sxc1
19457 When applicable, enable (disable) the generation of "lwxc1",
19458 "swxc1", "ldxc1", "sdxc1" instructions. Enabled by default.
19459
19460 -mmadd4
19461 -mno-madd4
19462 When applicable, enable (disable) the generation of 4-operand
19463 "madd.s", "madd.d" and related instructions. Enabled by default.
19464
19465 MMIX Options
19466 These options are defined for the MMIX:
19467
19468 -mlibfuncs
19469 -mno-libfuncs
19470 Specify that intrinsic library functions are being compiled,
19471 passing all values in registers, no matter the size.
19472
19473 -mepsilon
19474 -mno-epsilon
19475 Generate floating-point comparison instructions that compare with
19476 respect to the "rE" epsilon register.
19477
19478 -mabi=mmixware
19479 -mabi=gnu
19480 Generate code that passes function parameters and return values
19481 that (in the called function) are seen as registers $0 and up, as
19482 opposed to the GNU ABI which uses global registers $231 and up.
19483
19484 -mzero-extend
19485 -mno-zero-extend
19486 When reading data from memory in sizes shorter than 64 bits, use
19487 (do not use) zero-extending load instructions by default, rather
19488 than sign-extending ones.
19489
19490 -mknuthdiv
19491 -mno-knuthdiv
19492 Make the result of a division yielding a remainder have the same
19493 sign as the divisor. With the default, -mno-knuthdiv, the sign of
19494 the remainder follows the sign of the dividend. Both methods are
19495 arithmetically valid, the latter being almost exclusively used.
19496
19497 -mtoplevel-symbols
19498 -mno-toplevel-symbols
19499 Prepend (do not prepend) a : to all global symbols, so the assembly
19500 code can be used with the "PREFIX" assembly directive.
19501
19502 -melf
19503 Generate an executable in the ELF format, rather than the default
19504 mmo format used by the mmix simulator.
19505
19506 -mbranch-predict
19507 -mno-branch-predict
19508 Use (do not use) the probable-branch instructions, when static
19509 branch prediction indicates a probable branch.
19510
19511 -mbase-addresses
19512 -mno-base-addresses
19513 Generate (do not generate) code that uses base addresses. Using a
19514 base address automatically generates a request (handled by the
19515 assembler and the linker) for a constant to be set up in a global
19516 register. The register is used for one or more base address
19517 requests within the range 0 to 255 from the value held in the
19518 register. The generally leads to short and fast code, but the
19519 number of different data items that can be addressed is limited.
19520 This means that a program that uses lots of static data may require
19521 -mno-base-addresses.
19522
19523 -msingle-exit
19524 -mno-single-exit
19525 Force (do not force) generated code to have a single exit point in
19526 each function.
19527
19528 MN10300 Options
19529 These -m options are defined for Matsushita MN10300 architectures:
19530
19531 -mmult-bug
19532 Generate code to avoid bugs in the multiply instructions for the
19533 MN10300 processors. This is the default.
19534
19535 -mno-mult-bug
19536 Do not generate code to avoid bugs in the multiply instructions for
19537 the MN10300 processors.
19538
19539 -mam33
19540 Generate code using features specific to the AM33 processor.
19541
19542 -mno-am33
19543 Do not generate code using features specific to the AM33 processor.
19544 This is the default.
19545
19546 -mam33-2
19547 Generate code using features specific to the AM33/2.0 processor.
19548
19549 -mam34
19550 Generate code using features specific to the AM34 processor.
19551
19552 -mtune=cpu-type
19553 Use the timing characteristics of the indicated CPU type when
19554 scheduling instructions. This does not change the targeted
19555 processor type. The CPU type must be one of mn10300, am33, am33-2
19556 or am34.
19557
19558 -mreturn-pointer-on-d0
19559 When generating a function that returns a pointer, return the
19560 pointer in both "a0" and "d0". Otherwise, the pointer is returned
19561 only in "a0", and attempts to call such functions without a
19562 prototype result in errors. Note that this option is on by
19563 default; use -mno-return-pointer-on-d0 to disable it.
19564
19565 -mno-crt0
19566 Do not link in the C run-time initialization object file.
19567
19568 -mrelax
19569 Indicate to the linker that it should perform a relaxation
19570 optimization pass to shorten branches, calls and absolute memory
19571 addresses. This option only has an effect when used on the command
19572 line for the final link step.
19573
19574 This option makes symbolic debugging impossible.
19575
19576 -mliw
19577 Allow the compiler to generate Long Instruction Word instructions
19578 if the target is the AM33 or later. This is the default. This
19579 option defines the preprocessor macro "__LIW__".
19580
19581 -mno-liw
19582 Do not allow the compiler to generate Long Instruction Word
19583 instructions. This option defines the preprocessor macro
19584 "__NO_LIW__".
19585
19586 -msetlb
19587 Allow the compiler to generate the SETLB and Lcc instructions if
19588 the target is the AM33 or later. This is the default. This option
19589 defines the preprocessor macro "__SETLB__".
19590
19591 -mno-setlb
19592 Do not allow the compiler to generate SETLB or Lcc instructions.
19593 This option defines the preprocessor macro "__NO_SETLB__".
19594
19595 Moxie Options
19596 -meb
19597 Generate big-endian code. This is the default for moxie-*-*
19598 configurations.
19599
19600 -mel
19601 Generate little-endian code.
19602
19603 -mmul.x
19604 Generate mul.x and umul.x instructions. This is the default for
19605 moxiebox-*-* configurations.
19606
19607 -mno-crt0
19608 Do not link in the C run-time initialization object file.
19609
19610 MSP430 Options
19611 These options are defined for the MSP430:
19612
19613 -masm-hex
19614 Force assembly output to always use hex constants. Normally such
19615 constants are signed decimals, but this option is available for
19616 testsuite and/or aesthetic purposes.
19617
19618 -mmcu=
19619 Select the MCU to target. This is used to create a C preprocessor
19620 symbol based upon the MCU name, converted to upper case and pre-
19621 and post-fixed with __. This in turn is used by the msp430.h
19622 header file to select an MCU-specific supplementary header file.
19623
19624 The option also sets the ISA to use. If the MCU name is one that
19625 is known to only support the 430 ISA then that is selected,
19626 otherwise the 430X ISA is selected. A generic MCU name of msp430
19627 can also be used to select the 430 ISA. Similarly the generic
19628 msp430x MCU name selects the 430X ISA.
19629
19630 In addition an MCU-specific linker script is added to the linker
19631 command line. The script's name is the name of the MCU with .ld
19632 appended. Thus specifying -mmcu=xxx on the gcc command line
19633 defines the C preprocessor symbol "__XXX__" and cause the linker to
19634 search for a script called xxx.ld.
19635
19636 This option is also passed on to the assembler.
19637
19638 -mwarn-mcu
19639 -mno-warn-mcu
19640 This option enables or disables warnings about conflicts between
19641 the MCU name specified by the -mmcu option and the ISA set by the
19642 -mcpu option and/or the hardware multiply support set by the
19643 -mhwmult option. It also toggles warnings about unrecognized MCU
19644 names. This option is on by default.
19645
19646 -mcpu=
19647 Specifies the ISA to use. Accepted values are msp430, msp430x and
19648 msp430xv2. This option is deprecated. The -mmcu= option should be
19649 used to select the ISA.
19650
19651 -msim
19652 Link to the simulator runtime libraries and linker script.
19653 Overrides any scripts that would be selected by the -mmcu= option.
19654
19655 -mlarge
19656 Use large-model addressing (20-bit pointers, 32-bit "size_t").
19657
19658 -msmall
19659 Use small-model addressing (16-bit pointers, 16-bit "size_t").
19660
19661 -mrelax
19662 This option is passed to the assembler and linker, and allows the
19663 linker to perform certain optimizations that cannot be done until
19664 the final link.
19665
19666 mhwmult=
19667 Describes the type of hardware multiply supported by the target.
19668 Accepted values are none for no hardware multiply, 16bit for the
19669 original 16-bit-only multiply supported by early MCUs. 32bit for
19670 the 16/32-bit multiply supported by later MCUs and f5series for the
19671 16/32-bit multiply supported by F5-series MCUs. A value of auto
19672 can also be given. This tells GCC to deduce the hardware multiply
19673 support based upon the MCU name provided by the -mmcu option. If
19674 no -mmcu option is specified or if the MCU name is not recognized
19675 then no hardware multiply support is assumed. "auto" is the
19676 default setting.
19677
19678 Hardware multiplies are normally performed by calling a library
19679 routine. This saves space in the generated code. When compiling
19680 at -O3 or higher however the hardware multiplier is invoked inline.
19681 This makes for bigger, but faster code.
19682
19683 The hardware multiply routines disable interrupts whilst running
19684 and restore the previous interrupt state when they finish. This
19685 makes them safe to use inside interrupt handlers as well as in
19686 normal code.
19687
19688 -minrt
19689 Enable the use of a minimum runtime environment - no static
19690 initializers or constructors. This is intended for memory-
19691 constrained devices. The compiler includes special symbols in some
19692 objects that tell the linker and runtime which code fragments are
19693 required.
19694
19695 -mcode-region=
19696 -mdata-region=
19697 These options tell the compiler where to place functions and data
19698 that do not have one of the "lower", "upper", "either" or "section"
19699 attributes. Possible values are "lower", "upper", "either" or
19700 "any". The first three behave like the corresponding attribute.
19701 The fourth possible value - "any" - is the default. It leaves
19702 placement entirely up to the linker script and how it assigns the
19703 standard sections (".text", ".data", etc) to the memory regions.
19704
19705 -msilicon-errata=
19706 This option passes on a request to assembler to enable the fixes
19707 for the named silicon errata.
19708
19709 -msilicon-errata-warn=
19710 This option passes on a request to the assembler to enable warning
19711 messages when a silicon errata might need to be applied.
19712
19713 NDS32 Options
19714 These options are defined for NDS32 implementations:
19715
19716 -mbig-endian
19717 Generate code in big-endian mode.
19718
19719 -mlittle-endian
19720 Generate code in little-endian mode.
19721
19722 -mreduced-regs
19723 Use reduced-set registers for register allocation.
19724
19725 -mfull-regs
19726 Use full-set registers for register allocation.
19727
19728 -mcmov
19729 Generate conditional move instructions.
19730
19731 -mno-cmov
19732 Do not generate conditional move instructions.
19733
19734 -mext-perf
19735 Generate performance extension instructions.
19736
19737 -mno-ext-perf
19738 Do not generate performance extension instructions.
19739
19740 -mext-perf2
19741 Generate performance extension 2 instructions.
19742
19743 -mno-ext-perf2
19744 Do not generate performance extension 2 instructions.
19745
19746 -mext-string
19747 Generate string extension instructions.
19748
19749 -mno-ext-string
19750 Do not generate string extension instructions.
19751
19752 -mv3push
19753 Generate v3 push25/pop25 instructions.
19754
19755 -mno-v3push
19756 Do not generate v3 push25/pop25 instructions.
19757
19758 -m16-bit
19759 Generate 16-bit instructions.
19760
19761 -mno-16-bit
19762 Do not generate 16-bit instructions.
19763
19764 -misr-vector-size=num
19765 Specify the size of each interrupt vector, which must be 4 or 16.
19766
19767 -mcache-block-size=num
19768 Specify the size of each cache block, which must be a power of 2
19769 between 4 and 512.
19770
19771 -march=arch
19772 Specify the name of the target architecture.
19773
19774 -mcmodel=code-model
19775 Set the code model to one of
19776
19777 small
19778 All the data and read-only data segments must be within 512KB
19779 addressing space. The text segment must be within 16MB
19780 addressing space.
19781
19782 medium
19783 The data segment must be within 512KB while the read-only data
19784 segment can be within 4GB addressing space. The text segment
19785 should be still within 16MB addressing space.
19786
19787 large
19788 All the text and data segments can be within 4GB addressing
19789 space.
19790
19791 -mctor-dtor
19792 Enable constructor/destructor feature.
19793
19794 -mrelax
19795 Guide linker to relax instructions.
19796
19797 Nios II Options
19798 These are the options defined for the Altera Nios II processor.
19799
19800 -G num
19801 Put global and static objects less than or equal to num bytes into
19802 the small data or BSS sections instead of the normal data or BSS
19803 sections. The default value of num is 8.
19804
19805 -mgpopt=option
19806 -mgpopt
19807 -mno-gpopt
19808 Generate (do not generate) GP-relative accesses. The following
19809 option names are recognized:
19810
19811 none
19812 Do not generate GP-relative accesses.
19813
19814 local
19815 Generate GP-relative accesses for small data objects that are
19816 not external, weak, or uninitialized common symbols. Also use
19817 GP-relative addressing for objects that have been explicitly
19818 placed in a small data section via a "section" attribute.
19819
19820 global
19821 As for local, but also generate GP-relative accesses for small
19822 data objects that are external, weak, or common. If you use
19823 this option, you must ensure that all parts of your program
19824 (including libraries) are compiled with the same -G setting.
19825
19826 data
19827 Generate GP-relative accesses for all data objects in the
19828 program. If you use this option, the entire data and BSS
19829 segments of your program must fit in 64K of memory and you must
19830 use an appropriate linker script to allocate them within the
19831 addressable range of the global pointer.
19832
19833 all Generate GP-relative addresses for function pointers as well as
19834 data pointers. If you use this option, the entire text, data,
19835 and BSS segments of your program must fit in 64K of memory and
19836 you must use an appropriate linker script to allocate them
19837 within the addressable range of the global pointer.
19838
19839 -mgpopt is equivalent to -mgpopt=local, and -mno-gpopt is
19840 equivalent to -mgpopt=none.
19841
19842 The default is -mgpopt except when -fpic or -fPIC is specified to
19843 generate position-independent code. Note that the Nios II ABI does
19844 not permit GP-relative accesses from shared libraries.
19845
19846 You may need to specify -mno-gpopt explicitly when building
19847 programs that include large amounts of small data, including large
19848 GOT data sections. In this case, the 16-bit offset for GP-relative
19849 addressing may not be large enough to allow access to the entire
19850 small data section.
19851
19852 -mgprel-sec=regexp
19853 This option specifies additional section names that can be accessed
19854 via GP-relative addressing. It is most useful in conjunction with
19855 "section" attributes on variable declarations and a custom linker
19856 script. The regexp is a POSIX Extended Regular Expression.
19857
19858 This option does not affect the behavior of the -G option, and the
19859 specified sections are in addition to the standard ".sdata" and
19860 ".sbss" small-data sections that are recognized by -mgpopt.
19861
19862 -mr0rel-sec=regexp
19863 This option specifies names of sections that can be accessed via a
19864 16-bit offset from "r0"; that is, in the low 32K or high 32K of the
19865 32-bit address space. It is most useful in conjunction with
19866 "section" attributes on variable declarations and a custom linker
19867 script. The regexp is a POSIX Extended Regular Expression.
19868
19869 In contrast to the use of GP-relative addressing for small data,
19870 zero-based addressing is never generated by default and there are
19871 no conventional section names used in standard linker scripts for
19872 sections in the low or high areas of memory.
19873
19874 -mel
19875 -meb
19876 Generate little-endian (default) or big-endian (experimental) code,
19877 respectively.
19878
19879 -march=arch
19880 This specifies the name of the target Nios II architecture. GCC
19881 uses this name to determine what kind of instructions it can emit
19882 when generating assembly code. Permissible names are: r1, r2.
19883
19884 The preprocessor macro "__nios2_arch__" is available to programs,
19885 with value 1 or 2, indicating the targeted ISA level.
19886
19887 -mbypass-cache
19888 -mno-bypass-cache
19889 Force all load and store instructions to always bypass cache by
19890 using I/O variants of the instructions. The default is not to
19891 bypass the cache.
19892
19893 -mno-cache-volatile
19894 -mcache-volatile
19895 Volatile memory access bypass the cache using the I/O variants of
19896 the load and store instructions. The default is not to bypass the
19897 cache.
19898
19899 -mno-fast-sw-div
19900 -mfast-sw-div
19901 Do not use table-based fast divide for small numbers. The default
19902 is to use the fast divide at -O3 and above.
19903
19904 -mno-hw-mul
19905 -mhw-mul
19906 -mno-hw-mulx
19907 -mhw-mulx
19908 -mno-hw-div
19909 -mhw-div
19910 Enable or disable emitting "mul", "mulx" and "div" family of
19911 instructions by the compiler. The default is to emit "mul" and not
19912 emit "div" and "mulx".
19913
19914 -mbmx
19915 -mno-bmx
19916 -mcdx
19917 -mno-cdx
19918 Enable or disable generation of Nios II R2 BMX (bit manipulation)
19919 and CDX (code density) instructions. Enabling these instructions
19920 also requires -march=r2. Since these instructions are optional
19921 extensions to the R2 architecture, the default is not to emit them.
19922
19923 -mcustom-insn=N
19924 -mno-custom-insn
19925 Each -mcustom-insn=N option enables use of a custom instruction
19926 with encoding N when generating code that uses insn. For example,
19927 -mcustom-fadds=253 generates custom instruction 253 for single-
19928 precision floating-point add operations instead of the default
19929 behavior of using a library call.
19930
19931 The following values of insn are supported. Except as otherwise
19932 noted, floating-point operations are expected to be implemented
19933 with normal IEEE 754 semantics and correspond directly to the C
19934 operators or the equivalent GCC built-in functions.
19935
19936 Single-precision floating point:
19937
19938 fadds, fsubs, fdivs, fmuls
19939 Binary arithmetic operations.
19940
19941 fnegs
19942 Unary negation.
19943
19944 fabss
19945 Unary absolute value.
19946
19947 fcmpeqs, fcmpges, fcmpgts, fcmples, fcmplts, fcmpnes
19948 Comparison operations.
19949
19950 fmins, fmaxs
19951 Floating-point minimum and maximum. These instructions are
19952 only generated if -ffinite-math-only is specified.
19953
19954 fsqrts
19955 Unary square root operation.
19956
19957 fcoss, fsins, ftans, fatans, fexps, flogs
19958 Floating-point trigonometric and exponential functions. These
19959 instructions are only generated if -funsafe-math-optimizations
19960 is also specified.
19961
19962 Double-precision floating point:
19963
19964 faddd, fsubd, fdivd, fmuld
19965 Binary arithmetic operations.
19966
19967 fnegd
19968 Unary negation.
19969
19970 fabsd
19971 Unary absolute value.
19972
19973 fcmpeqd, fcmpged, fcmpgtd, fcmpled, fcmpltd, fcmpned
19974 Comparison operations.
19975
19976 fmind, fmaxd
19977 Double-precision minimum and maximum. These instructions are
19978 only generated if -ffinite-math-only is specified.
19979
19980 fsqrtd
19981 Unary square root operation.
19982
19983 fcosd, fsind, ftand, fatand, fexpd, flogd
19984 Double-precision trigonometric and exponential functions.
19985 These instructions are only generated if
19986 -funsafe-math-optimizations is also specified.
19987
19988 Conversions:
19989
19990 fextsd
19991 Conversion from single precision to double precision.
19992
19993 ftruncds
19994 Conversion from double precision to single precision.
19995
19996 fixsi, fixsu, fixdi, fixdu
19997 Conversion from floating point to signed or unsigned integer
19998 types, with truncation towards zero.
19999
20000 round
20001 Conversion from single-precision floating point to signed
20002 integer, rounding to the nearest integer and ties away from
20003 zero. This corresponds to the "__builtin_lroundf" function
20004 when -fno-math-errno is used.
20005
20006 floatis, floatus, floatid, floatud
20007 Conversion from signed or unsigned integer types to floating-
20008 point types.
20009
20010 In addition, all of the following transfer instructions for
20011 internal registers X and Y must be provided to use any of the
20012 double-precision floating-point instructions. Custom instructions
20013 taking two double-precision source operands expect the first
20014 operand in the 64-bit register X. The other operand (or only
20015 operand of a unary operation) is given to the custom arithmetic
20016 instruction with the least significant half in source register src1
20017 and the most significant half in src2. A custom instruction that
20018 returns a double-precision result returns the most significant 32
20019 bits in the destination register and the other half in 32-bit
20020 register Y. GCC automatically generates the necessary code
20021 sequences to write register X and/or read register Y when double-
20022 precision floating-point instructions are used.
20023
20024 fwrx
20025 Write src1 into the least significant half of X and src2 into
20026 the most significant half of X.
20027
20028 fwry
20029 Write src1 into Y.
20030
20031 frdxhi, frdxlo
20032 Read the most or least (respectively) significant half of X and
20033 store it in dest.
20034
20035 frdy
20036 Read the value of Y and store it into dest.
20037
20038 Note that you can gain more local control over generation of Nios
20039 II custom instructions by using the "target("custom-insn=N")" and
20040 "target("no-custom-insn")" function attributes or pragmas.
20041
20042 -mcustom-fpu-cfg=name
20043 This option enables a predefined, named set of custom instruction
20044 encodings (see -mcustom-insn above). Currently, the following sets
20045 are defined:
20046
20047 -mcustom-fpu-cfg=60-1 is equivalent to: -mcustom-fmuls=252
20048 -mcustom-fadds=253 -mcustom-fsubs=254 -fsingle-precision-constant
20049
20050 -mcustom-fpu-cfg=60-2 is equivalent to: -mcustom-fmuls=252
20051 -mcustom-fadds=253 -mcustom-fsubs=254 -mcustom-fdivs=255
20052 -fsingle-precision-constant
20053
20054 -mcustom-fpu-cfg=72-3 is equivalent to: -mcustom-floatus=243
20055 -mcustom-fixsi=244 -mcustom-floatis=245 -mcustom-fcmpgts=246
20056 -mcustom-fcmples=249 -mcustom-fcmpeqs=250 -mcustom-fcmpnes=251
20057 -mcustom-fmuls=252 -mcustom-fadds=253 -mcustom-fsubs=254
20058 -mcustom-fdivs=255 -fsingle-precision-constant
20059
20060 Custom instruction assignments given by individual -mcustom-insn=
20061 options override those given by -mcustom-fpu-cfg=, regardless of
20062 the order of the options on the command line.
20063
20064 Note that you can gain more local control over selection of a FPU
20065 configuration by using the "target("custom-fpu-cfg=name")" function
20066 attribute or pragma.
20067
20068 These additional -m options are available for the Altera Nios II ELF
20069 (bare-metal) target:
20070
20071 -mhal
20072 Link with HAL BSP. This suppresses linking with the GCC-provided C
20073 runtime startup and termination code, and is typically used in
20074 conjunction with -msys-crt0= to specify the location of the
20075 alternate startup code provided by the HAL BSP.
20076
20077 -msmallc
20078 Link with a limited version of the C library, -lsmallc, rather than
20079 Newlib.
20080
20081 -msys-crt0=startfile
20082 startfile is the file name of the startfile (crt0) to use when
20083 linking. This option is only useful in conjunction with -mhal.
20084
20085 -msys-lib=systemlib
20086 systemlib is the library name of the library that provides low-
20087 level system calls required by the C library, e.g. "read" and
20088 "write". This option is typically used to link with a library
20089 provided by a HAL BSP.
20090
20091 Nvidia PTX Options
20092 These options are defined for Nvidia PTX:
20093
20094 -m32
20095 -m64
20096 Generate code for 32-bit or 64-bit ABI.
20097
20098 -misa=ISA-string
20099 Generate code for given the specified PTX ISA (e.g. sm_35). ISA
20100 strings must be lower-case. Valid ISA strings include sm_30 and
20101 sm_35. The default ISA is sm_30.
20102
20103 -mmainkernel
20104 Link in code for a __main kernel. This is for stand-alone instead
20105 of offloading execution.
20106
20107 -moptimize
20108 Apply partitioned execution optimizations. This is the default
20109 when any level of optimization is selected.
20110
20111 -msoft-stack
20112 Generate code that does not use ".local" memory directly for stack
20113 storage. Instead, a per-warp stack pointer is maintained
20114 explicitly. This enables variable-length stack allocation (with
20115 variable-length arrays or "alloca"), and when global memory is used
20116 for underlying storage, makes it possible to access automatic
20117 variables from other threads, or with atomic instructions. This
20118 code generation variant is used for OpenMP offloading, but the
20119 option is exposed on its own for the purpose of testing the
20120 compiler; to generate code suitable for linking into programs using
20121 OpenMP offloading, use option -mgomp.
20122
20123 -muniform-simt
20124 Switch to code generation variant that allows to execute all
20125 threads in each warp, while maintaining memory state and side
20126 effects as if only one thread in each warp was active outside of
20127 OpenMP SIMD regions. All atomic operations and calls to runtime
20128 (malloc, free, vprintf) are conditionally executed (iff current
20129 lane index equals the master lane index), and the register being
20130 assigned is copied via a shuffle instruction from the master lane.
20131 Outside of SIMD regions lane 0 is the master; inside, each thread
20132 sees itself as the master. Shared memory array "int __nvptx_uni[]"
20133 stores all-zeros or all-ones bitmasks for each warp, indicating
20134 current mode (0 outside of SIMD regions). Each thread can bitwise-
20135 and the bitmask at position "tid.y" with current lane index to
20136 compute the master lane index.
20137
20138 -mgomp
20139 Generate code for use in OpenMP offloading: enables -msoft-stack
20140 and -muniform-simt options, and selects corresponding multilib
20141 variant.
20142
20143 OpenRISC Options
20144 These options are defined for OpenRISC:
20145
20146 -mboard=name
20147 Configure a board specific runtime. This will be passed to the
20148 linker for newlib board library linking. The default is "or1ksim".
20149
20150 -mnewlib
20151 For compatibility, it's always newlib for elf now.
20152
20153 -mhard-div
20154 Generate code for hardware which supports divide instructions.
20155 This is the default.
20156
20157 -mhard-mul
20158 Generate code for hardware which supports multiply instructions.
20159 This is the default.
20160
20161 -mcmov
20162 Generate code for hardware which supports the conditional move
20163 ("l.cmov") instruction.
20164
20165 -mror
20166 Generate code for hardware which supports rotate right
20167 instructions.
20168
20169 -msext
20170 Generate code for hardware which supports sign-extension
20171 instructions.
20172
20173 -msfimm
20174 Generate code for hardware which supports set flag immediate
20175 ("l.sf*i") instructions.
20176
20177 -mshftimm
20178 Generate code for hardware which supports shift immediate related
20179 instructions (i.e. "l.srai", "l.srli", "l.slli", "1.rori"). Note,
20180 to enable generation of the "l.rori" instruction the -mror flag
20181 must also be specified.
20182
20183 -msoft-div
20184 Generate code for hardware which requires divide instruction
20185 emulation.
20186
20187 -msoft-mul
20188 Generate code for hardware which requires multiply instruction
20189 emulation.
20190
20191 PDP-11 Options
20192 These options are defined for the PDP-11:
20193
20194 -mfpu
20195 Use hardware FPP floating point. This is the default. (FIS
20196 floating point on the PDP-11/40 is not supported.) Implies -m45.
20197
20198 -msoft-float
20199 Do not use hardware floating point.
20200
20201 -mac0
20202 Return floating-point results in ac0 (fr0 in Unix assembler
20203 syntax).
20204
20205 -mno-ac0
20206 Return floating-point results in memory. This is the default.
20207
20208 -m40
20209 Generate code for a PDP-11/40. Implies -msoft-float -mno-split.
20210
20211 -m45
20212 Generate code for a PDP-11/45. This is the default.
20213
20214 -m10
20215 Generate code for a PDP-11/10. Implies -msoft-float -mno-split.
20216
20217 -mint16
20218 -mno-int32
20219 Use 16-bit "int". This is the default.
20220
20221 -mint32
20222 -mno-int16
20223 Use 32-bit "int".
20224
20225 -msplit
20226 Target has split instruction and data space. Implies -m45.
20227
20228 -munix-asm
20229 Use Unix assembler syntax.
20230
20231 -mdec-asm
20232 Use DEC assembler syntax.
20233
20234 -mgnu-asm
20235 Use GNU assembler syntax. This is the default.
20236
20237 -mlra
20238 Use the new LRA register allocator. By default, the old "reload"
20239 allocator is used.
20240
20241 picoChip Options
20242 These -m options are defined for picoChip implementations:
20243
20244 -mae=ae_type
20245 Set the instruction set, register set, and instruction scheduling
20246 parameters for array element type ae_type. Supported values for
20247 ae_type are ANY, MUL, and MAC.
20248
20249 -mae=ANY selects a completely generic AE type. Code generated with
20250 this option runs on any of the other AE types. The code is not as
20251 efficient as it would be if compiled for a specific AE type, and
20252 some types of operation (e.g., multiplication) do not work properly
20253 on all types of AE.
20254
20255 -mae=MUL selects a MUL AE type. This is the most useful AE type
20256 for compiled code, and is the default.
20257
20258 -mae=MAC selects a DSP-style MAC AE. Code compiled with this
20259 option may suffer from poor performance of byte (char)
20260 manipulation, since the DSP AE does not provide hardware support
20261 for byte load/stores.
20262
20263 -msymbol-as-address
20264 Enable the compiler to directly use a symbol name as an address in
20265 a load/store instruction, without first loading it into a register.
20266 Typically, the use of this option generates larger programs, which
20267 run faster than when the option isn't used. However, the results
20268 vary from program to program, so it is left as a user option,
20269 rather than being permanently enabled.
20270
20271 -mno-inefficient-warnings
20272 Disables warnings about the generation of inefficient code. These
20273 warnings can be generated, for example, when compiling code that
20274 performs byte-level memory operations on the MAC AE type. The MAC
20275 AE has no hardware support for byte-level memory operations, so all
20276 byte load/stores must be synthesized from word load/store
20277 operations. This is inefficient and a warning is generated to
20278 indicate that you should rewrite the code to avoid byte operations,
20279 or to target an AE type that has the necessary hardware support.
20280 This option disables these warnings.
20281
20282 PowerPC Options
20283 These are listed under
20284
20285 RISC-V Options
20286 These command-line options are defined for RISC-V targets:
20287
20288 -mbranch-cost=n
20289 Set the cost of branches to roughly n instructions.
20290
20291 -mplt
20292 -mno-plt
20293 When generating PIC code, do or don't allow the use of PLTs.
20294 Ignored for non-PIC. The default is -mplt.
20295
20296 -mabi=ABI-string
20297 Specify integer and floating-point calling convention. ABI-string
20298 contains two parts: the size of integer types and the registers
20299 used for floating-point types. For example -march=rv64ifd
20300 -mabi=lp64d means that long and pointers are 64-bit (implicitly
20301 defining int to be 32-bit), and that floating-point values up to 64
20302 bits wide are passed in F registers. Contrast this with
20303 -march=rv64ifd -mabi=lp64f, which still allows the compiler to
20304 generate code that uses the F and D extensions but only allows
20305 floating-point values up to 32 bits long to be passed in registers;
20306 or -march=rv64ifd -mabi=lp64, in which no floating-point arguments
20307 will be passed in registers.
20308
20309 The default for this argument is system dependent, users who want a
20310 specific calling convention should specify one explicitly. The
20311 valid calling conventions are: ilp32, ilp32f, ilp32d, lp64, lp64f,
20312 and lp64d. Some calling conventions are impossible to implement on
20313 some ISAs: for example, -march=rv32if -mabi=ilp32d is invalid
20314 because the ABI requires 64-bit values be passed in F registers,
20315 but F registers are only 32 bits wide. There is also the ilp32e
20316 ABI that can only be used with the rv32e architecture. This ABI is
20317 not well specified at present, and is subject to change.
20318
20319 -mfdiv
20320 -mno-fdiv
20321 Do or don't use hardware floating-point divide and square root
20322 instructions. This requires the F or D extensions for floating-
20323 point registers. The default is to use them if the specified
20324 architecture has these instructions.
20325
20326 -mdiv
20327 -mno-div
20328 Do or don't use hardware instructions for integer division. This
20329 requires the M extension. The default is to use them if the
20330 specified architecture has these instructions.
20331
20332 -march=ISA-string
20333 Generate code for given RISC-V ISA (e.g. rv64im). ISA strings must
20334 be lower-case. Examples include rv64i, rv32g, rv32e, and rv32imaf.
20335
20336 -mtune=processor-string
20337 Optimize the output for the given processor, specified by
20338 microarchitecture name. Permissible values for this option are:
20339 rocket, sifive-3-series, sifive-5-series, sifive-7-series, and
20340 size.
20341
20342 When -mtune= is not specified, the default is rocket.
20343
20344 The size choice is not intended for use by end-users. This is used
20345 when -Os is specified. It overrides the instruction cost info
20346 provided by -mtune=, but does not override the pipeline info. This
20347 helps reduce code size while still giving good performance.
20348
20349 -mpreferred-stack-boundary=num
20350 Attempt to keep the stack boundary aligned to a 2 raised to num
20351 byte boundary. If -mpreferred-stack-boundary is not specified, the
20352 default is 4 (16 bytes or 128-bits).
20353
20354 Warning: If you use this switch, then you must build all modules
20355 with the same value, including any libraries. This includes the
20356 system libraries and startup modules.
20357
20358 -msmall-data-limit=n
20359 Put global and static data smaller than n bytes into a special
20360 section (on some targets).
20361
20362 -msave-restore
20363 -mno-save-restore
20364 Do or don't use smaller but slower prologue and epilogue code that
20365 uses library function calls. The default is to use fast inline
20366 prologues and epilogues.
20367
20368 -mstrict-align
20369 -mno-strict-align
20370 Do not or do generate unaligned memory accesses. The default is
20371 set depending on whether the processor we are optimizing for
20372 supports fast unaligned access or not.
20373
20374 -mcmodel=medlow
20375 Generate code for the medium-low code model. The program and its
20376 statically defined symbols must lie within a single 2 GiB address
20377 range and must lie between absolute addresses -2 GiB and +2 GiB.
20378 Programs can be statically or dynamically linked. This is the
20379 default code model.
20380
20381 -mcmodel=medany
20382 Generate code for the medium-any code model. The program and its
20383 statically defined symbols must be within any single 2 GiB address
20384 range. Programs can be statically or dynamically linked.
20385
20386 -mexplicit-relocs
20387 -mno-exlicit-relocs
20388 Use or do not use assembler relocation operators when dealing with
20389 symbolic addresses. The alternative is to use assembler macros
20390 instead, which may limit optimization.
20391
20392 -mrelax
20393 -mno-relax
20394 Take advantage of linker relaxations to reduce the number of
20395 instructions required to materialize symbol addresses. The default
20396 is to take advantage of linker relaxations.
20397
20398 -memit-attribute
20399 -mno-emit-attribute
20400 Emit (do not emit) RISC-V attribute to record extra information
20401 into ELF objects. This feature requires at least binutils 2.32.
20402
20403 RL78 Options
20404 -msim
20405 Links in additional target libraries to support operation within a
20406 simulator.
20407
20408 -mmul=none
20409 -mmul=g10
20410 -mmul=g13
20411 -mmul=g14
20412 -mmul=rl78
20413 Specifies the type of hardware multiplication and division support
20414 to be used. The simplest is "none", which uses software for both
20415 multiplication and division. This is the default. The "g13" value
20416 is for the hardware multiply/divide peripheral found on the
20417 RL78/G13 (S2 core) targets. The "g14" value selects the use of the
20418 multiplication and division instructions supported by the RL78/G14
20419 (S3 core) parts. The value "rl78" is an alias for "g14" and the
20420 value "mg10" is an alias for "none".
20421
20422 In addition a C preprocessor macro is defined, based upon the
20423 setting of this option. Possible values are: "__RL78_MUL_NONE__",
20424 "__RL78_MUL_G13__" or "__RL78_MUL_G14__".
20425
20426 -mcpu=g10
20427 -mcpu=g13
20428 -mcpu=g14
20429 -mcpu=rl78
20430 Specifies the RL78 core to target. The default is the G14 core,
20431 also known as an S3 core or just RL78. The G13 or S2 core does not
20432 have multiply or divide instructions, instead it uses a hardware
20433 peripheral for these operations. The G10 or S1 core does not have
20434 register banks, so it uses a different calling convention.
20435
20436 If this option is set it also selects the type of hardware multiply
20437 support to use, unless this is overridden by an explicit -mmul=none
20438 option on the command line. Thus specifying -mcpu=g13 enables the
20439 use of the G13 hardware multiply peripheral and specifying
20440 -mcpu=g10 disables the use of hardware multiplications altogether.
20441
20442 Note, although the RL78/G14 core is the default target, specifying
20443 -mcpu=g14 or -mcpu=rl78 on the command line does change the
20444 behavior of the toolchain since it also enables G14 hardware
20445 multiply support. If these options are not specified on the
20446 command line then software multiplication routines will be used
20447 even though the code targets the RL78 core. This is for backwards
20448 compatibility with older toolchains which did not have hardware
20449 multiply and divide support.
20450
20451 In addition a C preprocessor macro is defined, based upon the
20452 setting of this option. Possible values are: "__RL78_G10__",
20453 "__RL78_G13__" or "__RL78_G14__".
20454
20455 -mg10
20456 -mg13
20457 -mg14
20458 -mrl78
20459 These are aliases for the corresponding -mcpu= option. They are
20460 provided for backwards compatibility.
20461
20462 -mallregs
20463 Allow the compiler to use all of the available registers. By
20464 default registers "r24..r31" are reserved for use in interrupt
20465 handlers. With this option enabled these registers can be used in
20466 ordinary functions as well.
20467
20468 -m64bit-doubles
20469 -m32bit-doubles
20470 Make the "double" data type be 64 bits (-m64bit-doubles) or 32 bits
20471 (-m32bit-doubles) in size. The default is -m32bit-doubles.
20472
20473 -msave-mduc-in-interrupts
20474 -mno-save-mduc-in-interrupts
20475 Specifies that interrupt handler functions should preserve the MDUC
20476 registers. This is only necessary if normal code might use the
20477 MDUC registers, for example because it performs multiplication and
20478 division operations. The default is to ignore the MDUC registers
20479 as this makes the interrupt handlers faster. The target option
20480 -mg13 needs to be passed for this to work as this feature is only
20481 available on the G13 target (S2 core). The MDUC registers will
20482 only be saved if the interrupt handler performs a multiplication or
20483 division operation or it calls another function.
20484
20485 IBM RS/6000 and PowerPC Options
20486 These -m options are defined for the IBM RS/6000 and PowerPC:
20487
20488 -mpowerpc-gpopt
20489 -mno-powerpc-gpopt
20490 -mpowerpc-gfxopt
20491 -mno-powerpc-gfxopt
20492 -mpowerpc64
20493 -mno-powerpc64
20494 -mmfcrf
20495 -mno-mfcrf
20496 -mpopcntb
20497 -mno-popcntb
20498 -mpopcntd
20499 -mno-popcntd
20500 -mfprnd
20501 -mno-fprnd
20502 -mcmpb
20503 -mno-cmpb
20504 -mmfpgpr
20505 -mno-mfpgpr
20506 -mhard-dfp
20507 -mno-hard-dfp
20508 You use these options to specify which instructions are available
20509 on the processor you are using. The default value of these options
20510 is determined when configuring GCC. Specifying the -mcpu=cpu_type
20511 overrides the specification of these options. We recommend you use
20512 the -mcpu=cpu_type option rather than the options listed above.
20513
20514 Specifying -mpowerpc-gpopt allows GCC to use the optional PowerPC
20515 architecture instructions in the General Purpose group, including
20516 floating-point square root. Specifying -mpowerpc-gfxopt allows GCC
20517 to use the optional PowerPC architecture instructions in the
20518 Graphics group, including floating-point select.
20519
20520 The -mmfcrf option allows GCC to generate the move from condition
20521 register field instruction implemented on the POWER4 processor and
20522 other processors that support the PowerPC V2.01 architecture. The
20523 -mpopcntb option allows GCC to generate the popcount and double-
20524 precision FP reciprocal estimate instruction implemented on the
20525 POWER5 processor and other processors that support the PowerPC
20526 V2.02 architecture. The -mpopcntd option allows GCC to generate
20527 the popcount instruction implemented on the POWER7 processor and
20528 other processors that support the PowerPC V2.06 architecture. The
20529 -mfprnd option allows GCC to generate the FP round to integer
20530 instructions implemented on the POWER5+ processor and other
20531 processors that support the PowerPC V2.03 architecture. The -mcmpb
20532 option allows GCC to generate the compare bytes instruction
20533 implemented on the POWER6 processor and other processors that
20534 support the PowerPC V2.05 architecture. The -mmfpgpr option allows
20535 GCC to generate the FP move to/from general-purpose register
20536 instructions implemented on the POWER6X processor and other
20537 processors that support the extended PowerPC V2.05 architecture.
20538 The -mhard-dfp option allows GCC to generate the decimal floating-
20539 point instructions implemented on some POWER processors.
20540
20541 The -mpowerpc64 option allows GCC to generate the additional 64-bit
20542 instructions that are found in the full PowerPC64 architecture and
20543 to treat GPRs as 64-bit, doubleword quantities. GCC defaults to
20544 -mno-powerpc64.
20545
20546 -mcpu=cpu_type
20547 Set architecture type, register usage, and instruction scheduling
20548 parameters for machine type cpu_type. Supported values for
20549 cpu_type are 401, 403, 405, 405fp, 440, 440fp, 464, 464fp, 476,
20550 476fp, 505, 601, 602, 603, 603e, 604, 604e, 620, 630, 740, 7400,
20551 7450, 750, 801, 821, 823, 860, 970, 8540, a2, e300c2, e300c3,
20552 e500mc, e500mc64, e5500, e6500, ec603e, G3, G4, G5, titan, power3,
20553 power4, power5, power5+, power6, power6x, power7, power8, power9,
20554 powerpc, powerpc64, powerpc64le, rs64, and native.
20555
20556 -mcpu=powerpc, -mcpu=powerpc64, and -mcpu=powerpc64le specify pure
20557 32-bit PowerPC (either endian), 64-bit big endian PowerPC and
20558 64-bit little endian PowerPC architecture machine types, with an
20559 appropriate, generic processor model assumed for scheduling
20560 purposes.
20561
20562 Specifying native as cpu type detects and selects the architecture
20563 option that corresponds to the host processor of the system
20564 performing the compilation. -mcpu=native has no effect if GCC does
20565 not recognize the processor.
20566
20567 The other options specify a specific processor. Code generated
20568 under those options runs best on that processor, and may not run at
20569 all on others.
20570
20571 The -mcpu options automatically enable or disable the following
20572 options:
20573
20574 -maltivec -mfprnd -mhard-float -mmfcrf -mmultiple -mpopcntb
20575 -mpopcntd -mpowerpc64 -mpowerpc-gpopt -mpowerpc-gfxopt -mmulhw
20576 -mdlmzb -mmfpgpr -mvsx -mcrypto -mhtm -mpower8-fusion
20577 -mpower8-vector -mquad-memory -mquad-memory-atomic -mfloat128
20578 -mfloat128-hardware
20579
20580 The particular options set for any particular CPU varies between
20581 compiler versions, depending on what setting seems to produce
20582 optimal code for that CPU; it doesn't necessarily reflect the
20583 actual hardware's capabilities. If you wish to set an individual
20584 option to a particular value, you may specify it after the -mcpu
20585 option, like -mcpu=970 -mno-altivec.
20586
20587 On AIX, the -maltivec and -mpowerpc64 options are not enabled or
20588 disabled by the -mcpu option at present because AIX does not have
20589 full support for these options. You may still enable or disable
20590 them individually if you're sure it'll work in your environment.
20591
20592 -mtune=cpu_type
20593 Set the instruction scheduling parameters for machine type
20594 cpu_type, but do not set the architecture type or register usage,
20595 as -mcpu=cpu_type does. The same values for cpu_type are used for
20596 -mtune as for -mcpu. If both are specified, the code generated
20597 uses the architecture and registers set by -mcpu, but the
20598 scheduling parameters set by -mtune.
20599
20600 -mcmodel=small
20601 Generate PowerPC64 code for the small model: The TOC is limited to
20602 64k.
20603
20604 -mcmodel=medium
20605 Generate PowerPC64 code for the medium model: The TOC and other
20606 static data may be up to a total of 4G in size. This is the
20607 default for 64-bit Linux.
20608
20609 -mcmodel=large
20610 Generate PowerPC64 code for the large model: The TOC may be up to
20611 4G in size. Other data and code is only limited by the 64-bit
20612 address space.
20613
20614 -maltivec
20615 -mno-altivec
20616 Generate code that uses (does not use) AltiVec instructions, and
20617 also enable the use of built-in functions that allow more direct
20618 access to the AltiVec instruction set. You may also need to set
20619 -mabi=altivec to adjust the current ABI with AltiVec ABI
20620 enhancements.
20621
20622 When -maltivec is used, the element order for AltiVec intrinsics
20623 such as "vec_splat", "vec_extract", and "vec_insert" match array
20624 element order corresponding to the endianness of the target. That
20625 is, element zero identifies the leftmost element in a vector
20626 register when targeting a big-endian platform, and identifies the
20627 rightmost element in a vector register when targeting a little-
20628 endian platform.
20629
20630 -mvrsave
20631 -mno-vrsave
20632 Generate VRSAVE instructions when generating AltiVec code.
20633
20634 -msecure-plt
20635 Generate code that allows ld and ld.so to build executables and
20636 shared libraries with non-executable ".plt" and ".got" sections.
20637 This is a PowerPC 32-bit SYSV ABI option.
20638
20639 -mbss-plt
20640 Generate code that uses a BSS ".plt" section that ld.so fills in,
20641 and requires ".plt" and ".got" sections that are both writable and
20642 executable. This is a PowerPC 32-bit SYSV ABI option.
20643
20644 -misel
20645 -mno-isel
20646 This switch enables or disables the generation of ISEL
20647 instructions.
20648
20649 -mvsx
20650 -mno-vsx
20651 Generate code that uses (does not use) vector/scalar (VSX)
20652 instructions, and also enable the use of built-in functions that
20653 allow more direct access to the VSX instruction set.
20654
20655 -mcrypto
20656 -mno-crypto
20657 Enable the use (disable) of the built-in functions that allow
20658 direct access to the cryptographic instructions that were added in
20659 version 2.07 of the PowerPC ISA.
20660
20661 -mhtm
20662 -mno-htm
20663 Enable (disable) the use of the built-in functions that allow
20664 direct access to the Hardware Transactional Memory (HTM)
20665 instructions that were added in version 2.07 of the PowerPC ISA.
20666
20667 -mpower8-fusion
20668 -mno-power8-fusion
20669 Generate code that keeps (does not keeps) some integer operations
20670 adjacent so that the instructions can be fused together on power8
20671 and later processors.
20672
20673 -mpower8-vector
20674 -mno-power8-vector
20675 Generate code that uses (does not use) the vector and scalar
20676 instructions that were added in version 2.07 of the PowerPC ISA.
20677 Also enable the use of built-in functions that allow more direct
20678 access to the vector instructions.
20679
20680 -mquad-memory
20681 -mno-quad-memory
20682 Generate code that uses (does not use) the non-atomic quad word
20683 memory instructions. The -mquad-memory option requires use of
20684 64-bit mode.
20685
20686 -mquad-memory-atomic
20687 -mno-quad-memory-atomic
20688 Generate code that uses (does not use) the atomic quad word memory
20689 instructions. The -mquad-memory-atomic option requires use of
20690 64-bit mode.
20691
20692 -mfloat128
20693 -mno-float128
20694 Enable/disable the __float128 keyword for IEEE 128-bit floating
20695 point and use either software emulation for IEEE 128-bit floating
20696 point or hardware instructions.
20697
20698 The VSX instruction set (-mvsx, -mcpu=power7, -mcpu=power8), or
20699 -mcpu=power9 must be enabled to use the IEEE 128-bit floating point
20700 support. The IEEE 128-bit floating point support only works on
20701 PowerPC Linux systems.
20702
20703 The default for -mfloat128 is enabled on PowerPC Linux systems
20704 using the VSX instruction set, and disabled on other systems.
20705
20706 If you use the ISA 3.0 instruction set (-mpower9-vector or
20707 -mcpu=power9) on a 64-bit system, the IEEE 128-bit floating point
20708 support will also enable the generation of ISA 3.0 IEEE 128-bit
20709 floating point instructions. Otherwise, if you do not specify to
20710 generate ISA 3.0 instructions or you are targeting a 32-bit big
20711 endian system, IEEE 128-bit floating point will be done with
20712 software emulation.
20713
20714 -mfloat128-hardware
20715 -mno-float128-hardware
20716 Enable/disable using ISA 3.0 hardware instructions to support the
20717 __float128 data type.
20718
20719 The default for -mfloat128-hardware is enabled on PowerPC Linux
20720 systems using the ISA 3.0 instruction set, and disabled on other
20721 systems.
20722
20723 -m32
20724 -m64
20725 Generate code for 32-bit or 64-bit environments of Darwin and SVR4
20726 targets (including GNU/Linux). The 32-bit environment sets int,
20727 long and pointer to 32 bits and generates code that runs on any
20728 PowerPC variant. The 64-bit environment sets int to 32 bits and
20729 long and pointer to 64 bits, and generates code for PowerPC64, as
20730 for -mpowerpc64.
20731
20732 -mfull-toc
20733 -mno-fp-in-toc
20734 -mno-sum-in-toc
20735 -mminimal-toc
20736 Modify generation of the TOC (Table Of Contents), which is created
20737 for every executable file. The -mfull-toc option is selected by
20738 default. In that case, GCC allocates at least one TOC entry for
20739 each unique non-automatic variable reference in your program. GCC
20740 also places floating-point constants in the TOC. However, only
20741 16,384 entries are available in the TOC.
20742
20743 If you receive a linker error message that saying you have
20744 overflowed the available TOC space, you can reduce the amount of
20745 TOC space used with the -mno-fp-in-toc and -mno-sum-in-toc options.
20746 -mno-fp-in-toc prevents GCC from putting floating-point constants
20747 in the TOC and -mno-sum-in-toc forces GCC to generate code to
20748 calculate the sum of an address and a constant at run time instead
20749 of putting that sum into the TOC. You may specify one or both of
20750 these options. Each causes GCC to produce very slightly slower and
20751 larger code at the expense of conserving TOC space.
20752
20753 If you still run out of space in the TOC even when you specify both
20754 of these options, specify -mminimal-toc instead. This option
20755 causes GCC to make only one TOC entry for every file. When you
20756 specify this option, GCC produces code that is slower and larger
20757 but which uses extremely little TOC space. You may wish to use
20758 this option only on files that contain less frequently-executed
20759 code.
20760
20761 -maix64
20762 -maix32
20763 Enable 64-bit AIX ABI and calling convention: 64-bit pointers,
20764 64-bit "long" type, and the infrastructure needed to support them.
20765 Specifying -maix64 implies -mpowerpc64, while -maix32 disables the
20766 64-bit ABI and implies -mno-powerpc64. GCC defaults to -maix32.
20767
20768 -mxl-compat
20769 -mno-xl-compat
20770 Produce code that conforms more closely to IBM XL compiler
20771 semantics when using AIX-compatible ABI. Pass floating-point
20772 arguments to prototyped functions beyond the register save area
20773 (RSA) on the stack in addition to argument FPRs. Do not assume
20774 that most significant double in 128-bit long double value is
20775 properly rounded when comparing values and converting to double.
20776 Use XL symbol names for long double support routines.
20777
20778 The AIX calling convention was extended but not initially
20779 documented to handle an obscure K&R C case of calling a function
20780 that takes the address of its arguments with fewer arguments than
20781 declared. IBM XL compilers access floating-point arguments that do
20782 not fit in the RSA from the stack when a subroutine is compiled
20783 without optimization. Because always storing floating-point
20784 arguments on the stack is inefficient and rarely needed, this
20785 option is not enabled by default and only is necessary when calling
20786 subroutines compiled by IBM XL compilers without optimization.
20787
20788 -mpe
20789 Support IBM RS/6000 SP Parallel Environment (PE). Link an
20790 application written to use message passing with special startup
20791 code to enable the application to run. The system must have PE
20792 installed in the standard location (/usr/lpp/ppe.poe/), or the
20793 specs file must be overridden with the -specs= option to specify
20794 the appropriate directory location. The Parallel Environment does
20795 not support threads, so the -mpe option and the -pthread option are
20796 incompatible.
20797
20798 -malign-natural
20799 -malign-power
20800 On AIX, 32-bit Darwin, and 64-bit PowerPC GNU/Linux, the option
20801 -malign-natural overrides the ABI-defined alignment of larger
20802 types, such as floating-point doubles, on their natural size-based
20803 boundary. The option -malign-power instructs GCC to follow the
20804 ABI-specified alignment rules. GCC defaults to the standard
20805 alignment defined in the ABI.
20806
20807 On 64-bit Darwin, natural alignment is the default, and
20808 -malign-power is not supported.
20809
20810 -msoft-float
20811 -mhard-float
20812 Generate code that does not use (uses) the floating-point register
20813 set. Software floating-point emulation is provided if you use the
20814 -msoft-float option, and pass the option to GCC when linking.
20815
20816 -mmultiple
20817 -mno-multiple
20818 Generate code that uses (does not use) the load multiple word
20819 instructions and the store multiple word instructions. These
20820 instructions are generated by default on POWER systems, and not
20821 generated on PowerPC systems. Do not use -mmultiple on little-
20822 endian PowerPC systems, since those instructions do not work when
20823 the processor is in little-endian mode. The exceptions are PPC740
20824 and PPC750 which permit these instructions in little-endian mode.
20825
20826 -mupdate
20827 -mno-update
20828 Generate code that uses (does not use) the load or store
20829 instructions that update the base register to the address of the
20830 calculated memory location. These instructions are generated by
20831 default. If you use -mno-update, there is a small window between
20832 the time that the stack pointer is updated and the address of the
20833 previous frame is stored, which means code that walks the stack
20834 frame across interrupts or signals may get corrupted data.
20835
20836 -mavoid-indexed-addresses
20837 -mno-avoid-indexed-addresses
20838 Generate code that tries to avoid (not avoid) the use of indexed
20839 load or store instructions. These instructions can incur a
20840 performance penalty on Power6 processors in certain situations,
20841 such as when stepping through large arrays that cross a 16M
20842 boundary. This option is enabled by default when targeting Power6
20843 and disabled otherwise.
20844
20845 -mfused-madd
20846 -mno-fused-madd
20847 Generate code that uses (does not use) the floating-point multiply
20848 and accumulate instructions. These instructions are generated by
20849 default if hardware floating point is used. The machine-dependent
20850 -mfused-madd option is now mapped to the machine-independent
20851 -ffp-contract=fast option, and -mno-fused-madd is mapped to
20852 -ffp-contract=off.
20853
20854 -mmulhw
20855 -mno-mulhw
20856 Generate code that uses (does not use) the half-word multiply and
20857 multiply-accumulate instructions on the IBM 405, 440, 464 and 476
20858 processors. These instructions are generated by default when
20859 targeting those processors.
20860
20861 -mdlmzb
20862 -mno-dlmzb
20863 Generate code that uses (does not use) the string-search dlmzb
20864 instruction on the IBM 405, 440, 464 and 476 processors. This
20865 instruction is generated by default when targeting those
20866 processors.
20867
20868 -mno-bit-align
20869 -mbit-align
20870 On System V.4 and embedded PowerPC systems do not (do) force
20871 structures and unions that contain bit-fields to be aligned to the
20872 base type of the bit-field.
20873
20874 For example, by default a structure containing nothing but 8
20875 "unsigned" bit-fields of length 1 is aligned to a 4-byte boundary
20876 and has a size of 4 bytes. By using -mno-bit-align, the structure
20877 is aligned to a 1-byte boundary and is 1 byte in size.
20878
20879 -mno-strict-align
20880 -mstrict-align
20881 On System V.4 and embedded PowerPC systems do not (do) assume that
20882 unaligned memory references are handled by the system.
20883
20884 -mrelocatable
20885 -mno-relocatable
20886 Generate code that allows (does not allow) a static executable to
20887 be relocated to a different address at run time. A simple embedded
20888 PowerPC system loader should relocate the entire contents of
20889 ".got2" and 4-byte locations listed in the ".fixup" section, a
20890 table of 32-bit addresses generated by this option. For this to
20891 work, all objects linked together must be compiled with
20892 -mrelocatable or -mrelocatable-lib. -mrelocatable code aligns the
20893 stack to an 8-byte boundary.
20894
20895 -mrelocatable-lib
20896 -mno-relocatable-lib
20897 Like -mrelocatable, -mrelocatable-lib generates a ".fixup" section
20898 to allow static executables to be relocated at run time, but
20899 -mrelocatable-lib does not use the smaller stack alignment of
20900 -mrelocatable. Objects compiled with -mrelocatable-lib may be
20901 linked with objects compiled with any combination of the
20902 -mrelocatable options.
20903
20904 -mno-toc
20905 -mtoc
20906 On System V.4 and embedded PowerPC systems do not (do) assume that
20907 register 2 contains a pointer to a global area pointing to the
20908 addresses used in the program.
20909
20910 -mlittle
20911 -mlittle-endian
20912 On System V.4 and embedded PowerPC systems compile code for the
20913 processor in little-endian mode. The -mlittle-endian option is the
20914 same as -mlittle.
20915
20916 -mbig
20917 -mbig-endian
20918 On System V.4 and embedded PowerPC systems compile code for the
20919 processor in big-endian mode. The -mbig-endian option is the same
20920 as -mbig.
20921
20922 -mdynamic-no-pic
20923 On Darwin and Mac OS X systems, compile code so that it is not
20924 relocatable, but that its external references are relocatable. The
20925 resulting code is suitable for applications, but not shared
20926 libraries.
20927
20928 -msingle-pic-base
20929 Treat the register used for PIC addressing as read-only, rather
20930 than loading it in the prologue for each function. The runtime
20931 system is responsible for initializing this register with an
20932 appropriate value before execution begins.
20933
20934 -mprioritize-restricted-insns=priority
20935 This option controls the priority that is assigned to dispatch-slot
20936 restricted instructions during the second scheduling pass. The
20937 argument priority takes the value 0, 1, or 2 to assign no, highest,
20938 or second-highest (respectively) priority to dispatch-slot
20939 restricted instructions.
20940
20941 -msched-costly-dep=dependence_type
20942 This option controls which dependences are considered costly by the
20943 target during instruction scheduling. The argument dependence_type
20944 takes one of the following values:
20945
20946 no No dependence is costly.
20947
20948 all All dependences are costly.
20949
20950 true_store_to_load
20951 A true dependence from store to load is costly.
20952
20953 store_to_load
20954 Any dependence from store to load is costly.
20955
20956 number
20957 Any dependence for which the latency is greater than or equal
20958 to number is costly.
20959
20960 -minsert-sched-nops=scheme
20961 This option controls which NOP insertion scheme is used during the
20962 second scheduling pass. The argument scheme takes one of the
20963 following values:
20964
20965 no Don't insert NOPs.
20966
20967 pad Pad with NOPs any dispatch group that has vacant issue slots,
20968 according to the scheduler's grouping.
20969
20970 regroup_exact
20971 Insert NOPs to force costly dependent insns into separate
20972 groups. Insert exactly as many NOPs as needed to force an insn
20973 to a new group, according to the estimated processor grouping.
20974
20975 number
20976 Insert NOPs to force costly dependent insns into separate
20977 groups. Insert number NOPs to force an insn to a new group.
20978
20979 -mcall-sysv
20980 On System V.4 and embedded PowerPC systems compile code using
20981 calling conventions that adhere to the March 1995 draft of the
20982 System V Application Binary Interface, PowerPC processor
20983 supplement. This is the default unless you configured GCC using
20984 powerpc-*-eabiaix.
20985
20986 -mcall-sysv-eabi
20987 -mcall-eabi
20988 Specify both -mcall-sysv and -meabi options.
20989
20990 -mcall-sysv-noeabi
20991 Specify both -mcall-sysv and -mno-eabi options.
20992
20993 -mcall-aixdesc
20994 On System V.4 and embedded PowerPC systems compile code for the AIX
20995 operating system.
20996
20997 -mcall-linux
20998 On System V.4 and embedded PowerPC systems compile code for the
20999 Linux-based GNU system.
21000
21001 -mcall-freebsd
21002 On System V.4 and embedded PowerPC systems compile code for the
21003 FreeBSD operating system.
21004
21005 -mcall-netbsd
21006 On System V.4 and embedded PowerPC systems compile code for the
21007 NetBSD operating system.
21008
21009 -mcall-openbsd
21010 On System V.4 and embedded PowerPC systems compile code for the
21011 OpenBSD operating system.
21012
21013 -mtraceback=traceback_type
21014 Select the type of traceback table. Valid values for traceback_type
21015 are full, part, and no.
21016
21017 -maix-struct-return
21018 Return all structures in memory (as specified by the AIX ABI).
21019
21020 -msvr4-struct-return
21021 Return structures smaller than 8 bytes in registers (as specified
21022 by the SVR4 ABI).
21023
21024 -mabi=abi-type
21025 Extend the current ABI with a particular extension, or remove such
21026 extension. Valid values are altivec, no-altivec, ibmlongdouble,
21027 ieeelongdouble, elfv1, elfv2.
21028
21029 -mabi=ibmlongdouble
21030 Change the current ABI to use IBM extended-precision long double.
21031 This is not likely to work if your system defaults to using IEEE
21032 extended-precision long double. If you change the long double type
21033 from IEEE extended-precision, the compiler will issue a warning
21034 unless you use the -Wno-psabi option. Requires -mlong-double-128
21035 to be enabled.
21036
21037 -mabi=ieeelongdouble
21038 Change the current ABI to use IEEE extended-precision long double.
21039 This is not likely to work if your system defaults to using IBM
21040 extended-precision long double. If you change the long double type
21041 from IBM extended-precision, the compiler will issue a warning
21042 unless you use the -Wno-psabi option. Requires -mlong-double-128
21043 to be enabled.
21044
21045 -mabi=elfv1
21046 Change the current ABI to use the ELFv1 ABI. This is the default
21047 ABI for big-endian PowerPC 64-bit Linux. Overriding the default
21048 ABI requires special system support and is likely to fail in
21049 spectacular ways.
21050
21051 -mabi=elfv2
21052 Change the current ABI to use the ELFv2 ABI. This is the default
21053 ABI for little-endian PowerPC 64-bit Linux. Overriding the default
21054 ABI requires special system support and is likely to fail in
21055 spectacular ways.
21056
21057 -mgnu-attribute
21058 -mno-gnu-attribute
21059 Emit .gnu_attribute assembly directives to set tag/value pairs in a
21060 .gnu.attributes section that specify ABI variations in function
21061 parameters or return values.
21062
21063 -mprototype
21064 -mno-prototype
21065 On System V.4 and embedded PowerPC systems assume that all calls to
21066 variable argument functions are properly prototyped. Otherwise,
21067 the compiler must insert an instruction before every non-prototyped
21068 call to set or clear bit 6 of the condition code register ("CR") to
21069 indicate whether floating-point values are passed in the floating-
21070 point registers in case the function takes variable arguments.
21071 With -mprototype, only calls to prototyped variable argument
21072 functions set or clear the bit.
21073
21074 -msim
21075 On embedded PowerPC systems, assume that the startup module is
21076 called sim-crt0.o and that the standard C libraries are libsim.a
21077 and libc.a. This is the default for powerpc-*-eabisim
21078 configurations.
21079
21080 -mmvme
21081 On embedded PowerPC systems, assume that the startup module is
21082 called crt0.o and the standard C libraries are libmvme.a and
21083 libc.a.
21084
21085 -mads
21086 On embedded PowerPC systems, assume that the startup module is
21087 called crt0.o and the standard C libraries are libads.a and libc.a.
21088
21089 -myellowknife
21090 On embedded PowerPC systems, assume that the startup module is
21091 called crt0.o and the standard C libraries are libyk.a and libc.a.
21092
21093 -mvxworks
21094 On System V.4 and embedded PowerPC systems, specify that you are
21095 compiling for a VxWorks system.
21096
21097 -memb
21098 On embedded PowerPC systems, set the "PPC_EMB" bit in the ELF flags
21099 header to indicate that eabi extended relocations are used.
21100
21101 -meabi
21102 -mno-eabi
21103 On System V.4 and embedded PowerPC systems do (do not) adhere to
21104 the Embedded Applications Binary Interface (EABI), which is a set
21105 of modifications to the System V.4 specifications. Selecting
21106 -meabi means that the stack is aligned to an 8-byte boundary, a
21107 function "__eabi" is called from "main" to set up the EABI
21108 environment, and the -msdata option can use both "r2" and "r13" to
21109 point to two separate small data areas. Selecting -mno-eabi means
21110 that the stack is aligned to a 16-byte boundary, no EABI
21111 initialization function is called from "main", and the -msdata
21112 option only uses "r13" to point to a single small data area. The
21113 -meabi option is on by default if you configured GCC using one of
21114 the powerpc*-*-eabi* options.
21115
21116 -msdata=eabi
21117 On System V.4 and embedded PowerPC systems, put small initialized
21118 "const" global and static data in the ".sdata2" section, which is
21119 pointed to by register "r2". Put small initialized non-"const"
21120 global and static data in the ".sdata" section, which is pointed to
21121 by register "r13". Put small uninitialized global and static data
21122 in the ".sbss" section, which is adjacent to the ".sdata" section.
21123 The -msdata=eabi option is incompatible with the -mrelocatable
21124 option. The -msdata=eabi option also sets the -memb option.
21125
21126 -msdata=sysv
21127 On System V.4 and embedded PowerPC systems, put small global and
21128 static data in the ".sdata" section, which is pointed to by
21129 register "r13". Put small uninitialized global and static data in
21130 the ".sbss" section, which is adjacent to the ".sdata" section.
21131 The -msdata=sysv option is incompatible with the -mrelocatable
21132 option.
21133
21134 -msdata=default
21135 -msdata
21136 On System V.4 and embedded PowerPC systems, if -meabi is used,
21137 compile code the same as -msdata=eabi, otherwise compile code the
21138 same as -msdata=sysv.
21139
21140 -msdata=data
21141 On System V.4 and embedded PowerPC systems, put small global data
21142 in the ".sdata" section. Put small uninitialized global data in
21143 the ".sbss" section. Do not use register "r13" to address small
21144 data however. This is the default behavior unless other -msdata
21145 options are used.
21146
21147 -msdata=none
21148 -mno-sdata
21149 On embedded PowerPC systems, put all initialized global and static
21150 data in the ".data" section, and all uninitialized data in the
21151 ".bss" section.
21152
21153 -mreadonly-in-sdata
21154 Put read-only objects in the ".sdata" section as well. This is the
21155 default.
21156
21157 -mblock-move-inline-limit=num
21158 Inline all block moves (such as calls to "memcpy" or structure
21159 copies) less than or equal to num bytes. The minimum value for num
21160 is 32 bytes on 32-bit targets and 64 bytes on 64-bit targets. The
21161 default value is target-specific.
21162
21163 -mblock-compare-inline-limit=num
21164 Generate non-looping inline code for all block compares (such as
21165 calls to "memcmp" or structure compares) less than or equal to num
21166 bytes. If num is 0, all inline expansion (non-loop and loop) of
21167 block compare is disabled. The default value is target-specific.
21168
21169 -mblock-compare-inline-loop-limit=num
21170 Generate an inline expansion using loop code for all block compares
21171 that are less than or equal to num bytes, but greater than the
21172 limit for non-loop inline block compare expansion. If the block
21173 length is not constant, at most num bytes will be compared before
21174 "memcmp" is called to compare the remainder of the block. The
21175 default value is target-specific.
21176
21177 -mstring-compare-inline-limit=num
21178 Compare at most num string bytes with inline code. If the
21179 difference or end of string is not found at the end of the inline
21180 compare a call to "strcmp" or "strncmp" will take care of the rest
21181 of the comparison. The default is 64 bytes.
21182
21183 -G num
21184 On embedded PowerPC systems, put global and static items less than
21185 or equal to num bytes into the small data or BSS sections instead
21186 of the normal data or BSS section. By default, num is 8. The -G
21187 num switch is also passed to the linker. All modules should be
21188 compiled with the same -G num value.
21189
21190 -mregnames
21191 -mno-regnames
21192 On System V.4 and embedded PowerPC systems do (do not) emit
21193 register names in the assembly language output using symbolic
21194 forms.
21195
21196 -mlongcall
21197 -mno-longcall
21198 By default assume that all calls are far away so that a longer and
21199 more expensive calling sequence is required. This is required for
21200 calls farther than 32 megabytes (33,554,432 bytes) from the current
21201 location. A short call is generated if the compiler knows the call
21202 cannot be that far away. This setting can be overridden by the
21203 "shortcall" function attribute, or by "#pragma longcall(0)".
21204
21205 Some linkers are capable of detecting out-of-range calls and
21206 generating glue code on the fly. On these systems, long calls are
21207 unnecessary and generate slower code. As of this writing, the AIX
21208 linker can do this, as can the GNU linker for PowerPC/64. It is
21209 planned to add this feature to the GNU linker for 32-bit PowerPC
21210 systems as well.
21211
21212 On PowerPC64 ELFv2 and 32-bit PowerPC systems with newer GNU
21213 linkers, GCC can generate long calls using an inline PLT call
21214 sequence (see -mpltseq). PowerPC with -mbss-plt and PowerPC64
21215 ELFv1 (big-endian) do not support inline PLT calls.
21216
21217 On Darwin/PPC systems, "#pragma longcall" generates "jbsr callee,
21218 L42", plus a branch island (glue code). The two target addresses
21219 represent the callee and the branch island. The Darwin/PPC linker
21220 prefers the first address and generates a "bl callee" if the PPC
21221 "bl" instruction reaches the callee directly; otherwise, the linker
21222 generates "bl L42" to call the branch island. The branch island is
21223 appended to the body of the calling function; it computes the full
21224 32-bit address of the callee and jumps to it.
21225
21226 On Mach-O (Darwin) systems, this option directs the compiler emit
21227 to the glue for every direct call, and the Darwin linker decides
21228 whether to use or discard it.
21229
21230 In the future, GCC may ignore all longcall specifications when the
21231 linker is known to generate glue.
21232
21233 -mpltseq
21234 -mno-pltseq
21235 Implement (do not implement) -fno-plt and long calls using an
21236 inline PLT call sequence that supports lazy linking and long calls
21237 to functions in dlopen'd shared libraries. Inline PLT calls are
21238 only supported on PowerPC64 ELFv2 and 32-bit PowerPC systems with
21239 newer GNU linkers, and are enabled by default if the support is
21240 detected when configuring GCC, and, in the case of 32-bit PowerPC,
21241 if GCC is configured with --enable-secureplt. -mpltseq code and
21242 -mbss-plt 32-bit PowerPC relocatable objects may not be linked
21243 together.
21244
21245 -mtls-markers
21246 -mno-tls-markers
21247 Mark (do not mark) calls to "__tls_get_addr" with a relocation
21248 specifying the function argument. The relocation allows the linker
21249 to reliably associate function call with argument setup
21250 instructions for TLS optimization, which in turn allows GCC to
21251 better schedule the sequence.
21252
21253 -mrecip
21254 -mno-recip
21255 This option enables use of the reciprocal estimate and reciprocal
21256 square root estimate instructions with additional Newton-Raphson
21257 steps to increase precision instead of doing a divide or square
21258 root and divide for floating-point arguments. You should use the
21259 -ffast-math option when using -mrecip (or at least
21260 -funsafe-math-optimizations, -ffinite-math-only, -freciprocal-math
21261 and -fno-trapping-math). Note that while the throughput of the
21262 sequence is generally higher than the throughput of the non-
21263 reciprocal instruction, the precision of the sequence can be
21264 decreased by up to 2 ulp (i.e. the inverse of 1.0 equals
21265 0.99999994) for reciprocal square roots.
21266
21267 -mrecip=opt
21268 This option controls which reciprocal estimate instructions may be
21269 used. opt is a comma-separated list of options, which may be
21270 preceded by a "!" to invert the option:
21271
21272 all Enable all estimate instructions.
21273
21274 default
21275 Enable the default instructions, equivalent to -mrecip.
21276
21277 none
21278 Disable all estimate instructions, equivalent to -mno-recip.
21279
21280 div Enable the reciprocal approximation instructions for both
21281 single and double precision.
21282
21283 divf
21284 Enable the single-precision reciprocal approximation
21285 instructions.
21286
21287 divd
21288 Enable the double-precision reciprocal approximation
21289 instructions.
21290
21291 rsqrt
21292 Enable the reciprocal square root approximation instructions
21293 for both single and double precision.
21294
21295 rsqrtf
21296 Enable the single-precision reciprocal square root
21297 approximation instructions.
21298
21299 rsqrtd
21300 Enable the double-precision reciprocal square root
21301 approximation instructions.
21302
21303 So, for example, -mrecip=all,!rsqrtd enables all of the reciprocal
21304 estimate instructions, except for the "FRSQRTE", "XSRSQRTEDP", and
21305 "XVRSQRTEDP" instructions which handle the double-precision
21306 reciprocal square root calculations.
21307
21308 -mrecip-precision
21309 -mno-recip-precision
21310 Assume (do not assume) that the reciprocal estimate instructions
21311 provide higher-precision estimates than is mandated by the PowerPC
21312 ABI. Selecting -mcpu=power6, -mcpu=power7 or -mcpu=power8
21313 automatically selects -mrecip-precision. The double-precision
21314 square root estimate instructions are not generated by default on
21315 low-precision machines, since they do not provide an estimate that
21316 converges after three steps.
21317
21318 -mveclibabi=type
21319 Specifies the ABI type to use for vectorizing intrinsics using an
21320 external library. The only type supported at present is mass,
21321 which specifies to use IBM's Mathematical Acceleration Subsystem
21322 (MASS) libraries for vectorizing intrinsics using external
21323 libraries. GCC currently emits calls to "acosd2", "acosf4",
21324 "acoshd2", "acoshf4", "asind2", "asinf4", "asinhd2", "asinhf4",
21325 "atan2d2", "atan2f4", "atand2", "atanf4", "atanhd2", "atanhf4",
21326 "cbrtd2", "cbrtf4", "cosd2", "cosf4", "coshd2", "coshf4", "erfcd2",
21327 "erfcf4", "erfd2", "erff4", "exp2d2", "exp2f4", "expd2", "expf4",
21328 "expm1d2", "expm1f4", "hypotd2", "hypotf4", "lgammad2", "lgammaf4",
21329 "log10d2", "log10f4", "log1pd2", "log1pf4", "log2d2", "log2f4",
21330 "logd2", "logf4", "powd2", "powf4", "sind2", "sinf4", "sinhd2",
21331 "sinhf4", "sqrtd2", "sqrtf4", "tand2", "tanf4", "tanhd2", and
21332 "tanhf4" when generating code for power7. Both -ftree-vectorize
21333 and -funsafe-math-optimizations must also be enabled. The MASS
21334 libraries must be specified at link time.
21335
21336 -mfriz
21337 -mno-friz
21338 Generate (do not generate) the "friz" instruction when the
21339 -funsafe-math-optimizations option is used to optimize rounding of
21340 floating-point values to 64-bit integer and back to floating point.
21341 The "friz" instruction does not return the same value if the
21342 floating-point number is too large to fit in an integer.
21343
21344 -mpointers-to-nested-functions
21345 -mno-pointers-to-nested-functions
21346 Generate (do not generate) code to load up the static chain
21347 register ("r11") when calling through a pointer on AIX and 64-bit
21348 Linux systems where a function pointer points to a 3-word
21349 descriptor giving the function address, TOC value to be loaded in
21350 register "r2", and static chain value to be loaded in register
21351 "r11". The -mpointers-to-nested-functions is on by default. You
21352 cannot call through pointers to nested functions or pointers to
21353 functions compiled in other languages that use the static chain if
21354 you use -mno-pointers-to-nested-functions.
21355
21356 -msave-toc-indirect
21357 -mno-save-toc-indirect
21358 Generate (do not generate) code to save the TOC value in the
21359 reserved stack location in the function prologue if the function
21360 calls through a pointer on AIX and 64-bit Linux systems. If the
21361 TOC value is not saved in the prologue, it is saved just before the
21362 call through the pointer. The -mno-save-toc-indirect option is the
21363 default.
21364
21365 -mcompat-align-parm
21366 -mno-compat-align-parm
21367 Generate (do not generate) code to pass structure parameters with a
21368 maximum alignment of 64 bits, for compatibility with older versions
21369 of GCC.
21370
21371 Older versions of GCC (prior to 4.9.0) incorrectly did not align a
21372 structure parameter on a 128-bit boundary when that structure
21373 contained a member requiring 128-bit alignment. This is corrected
21374 in more recent versions of GCC. This option may be used to
21375 generate code that is compatible with functions compiled with older
21376 versions of GCC.
21377
21378 The -mno-compat-align-parm option is the default.
21379
21380 -mstack-protector-guard=guard
21381 -mstack-protector-guard-reg=reg
21382 -mstack-protector-guard-offset=offset
21383 -mstack-protector-guard-symbol=symbol
21384 Generate stack protection code using canary at guard. Supported
21385 locations are global for global canary or tls for per-thread canary
21386 in the TLS block (the default with GNU libc version 2.4 or later).
21387
21388 With the latter choice the options -mstack-protector-guard-reg=reg
21389 and -mstack-protector-guard-offset=offset furthermore specify which
21390 register to use as base register for reading the canary, and from
21391 what offset from that base register. The default for those is as
21392 specified in the relevant ABI.
21393 -mstack-protector-guard-symbol=symbol overrides the offset with a
21394 symbol reference to a canary in the TLS block.
21395
21396 RX Options
21397 These command-line options are defined for RX targets:
21398
21399 -m64bit-doubles
21400 -m32bit-doubles
21401 Make the "double" data type be 64 bits (-m64bit-doubles) or 32 bits
21402 (-m32bit-doubles) in size. The default is -m32bit-doubles. Note
21403 RX floating-point hardware only works on 32-bit values, which is
21404 why the default is -m32bit-doubles.
21405
21406 -fpu
21407 -nofpu
21408 Enables (-fpu) or disables (-nofpu) the use of RX floating-point
21409 hardware. The default is enabled for the RX600 series and disabled
21410 for the RX200 series.
21411
21412 Floating-point instructions are only generated for 32-bit floating-
21413 point values, however, so the FPU hardware is not used for doubles
21414 if the -m64bit-doubles option is used.
21415
21416 Note If the -fpu option is enabled then -funsafe-math-optimizations
21417 is also enabled automatically. This is because the RX FPU
21418 instructions are themselves unsafe.
21419
21420 -mcpu=name
21421 Selects the type of RX CPU to be targeted. Currently three types
21422 are supported, the generic RX600 and RX200 series hardware and the
21423 specific RX610 CPU. The default is RX600.
21424
21425 The only difference between RX600 and RX610 is that the RX610 does
21426 not support the "MVTIPL" instruction.
21427
21428 The RX200 series does not have a hardware floating-point unit and
21429 so -nofpu is enabled by default when this type is selected.
21430
21431 -mbig-endian-data
21432 -mlittle-endian-data
21433 Store data (but not code) in the big-endian format. The default is
21434 -mlittle-endian-data, i.e. to store data in the little-endian
21435 format.
21436
21437 -msmall-data-limit=N
21438 Specifies the maximum size in bytes of global and static variables
21439 which can be placed into the small data area. Using the small data
21440 area can lead to smaller and faster code, but the size of area is
21441 limited and it is up to the programmer to ensure that the area does
21442 not overflow. Also when the small data area is used one of the
21443 RX's registers (usually "r13") is reserved for use pointing to this
21444 area, so it is no longer available for use by the compiler. This
21445 could result in slower and/or larger code if variables are pushed
21446 onto the stack instead of being held in this register.
21447
21448 Note, common variables (variables that have not been initialized)
21449 and constants are not placed into the small data area as they are
21450 assigned to other sections in the output executable.
21451
21452 The default value is zero, which disables this feature. Note, this
21453 feature is not enabled by default with higher optimization levels
21454 (-O2 etc) because of the potentially detrimental effects of
21455 reserving a register. It is up to the programmer to experiment and
21456 discover whether this feature is of benefit to their program. See
21457 the description of the -mpid option for a description of how the
21458 actual register to hold the small data area pointer is chosen.
21459
21460 -msim
21461 -mno-sim
21462 Use the simulator runtime. The default is to use the libgloss
21463 board-specific runtime.
21464
21465 -mas100-syntax
21466 -mno-as100-syntax
21467 When generating assembler output use a syntax that is compatible
21468 with Renesas's AS100 assembler. This syntax can also be handled by
21469 the GAS assembler, but it has some restrictions so it is not
21470 generated by default.
21471
21472 -mmax-constant-size=N
21473 Specifies the maximum size, in bytes, of a constant that can be
21474 used as an operand in a RX instruction. Although the RX
21475 instruction set does allow constants of up to 4 bytes in length to
21476 be used in instructions, a longer value equates to a longer
21477 instruction. Thus in some circumstances it can be beneficial to
21478 restrict the size of constants that are used in instructions.
21479 Constants that are too big are instead placed into a constant pool
21480 and referenced via register indirection.
21481
21482 The value N can be between 0 and 4. A value of 0 (the default) or
21483 4 means that constants of any size are allowed.
21484
21485 -mrelax
21486 Enable linker relaxation. Linker relaxation is a process whereby
21487 the linker attempts to reduce the size of a program by finding
21488 shorter versions of various instructions. Disabled by default.
21489
21490 -mint-register=N
21491 Specify the number of registers to reserve for fast interrupt
21492 handler functions. The value N can be between 0 and 4. A value of
21493 1 means that register "r13" is reserved for the exclusive use of
21494 fast interrupt handlers. A value of 2 reserves "r13" and "r12". A
21495 value of 3 reserves "r13", "r12" and "r11", and a value of 4
21496 reserves "r13" through "r10". A value of 0, the default, does not
21497 reserve any registers.
21498
21499 -msave-acc-in-interrupts
21500 Specifies that interrupt handler functions should preserve the
21501 accumulator register. This is only necessary if normal code might
21502 use the accumulator register, for example because it performs
21503 64-bit multiplications. The default is to ignore the accumulator
21504 as this makes the interrupt handlers faster.
21505
21506 -mpid
21507 -mno-pid
21508 Enables the generation of position independent data. When enabled
21509 any access to constant data is done via an offset from a base
21510 address held in a register. This allows the location of constant
21511 data to be determined at run time without requiring the executable
21512 to be relocated, which is a benefit to embedded applications with
21513 tight memory constraints. Data that can be modified is not
21514 affected by this option.
21515
21516 Note, using this feature reserves a register, usually "r13", for
21517 the constant data base address. This can result in slower and/or
21518 larger code, especially in complicated functions.
21519
21520 The actual register chosen to hold the constant data base address
21521 depends upon whether the -msmall-data-limit and/or the
21522 -mint-register command-line options are enabled. Starting with
21523 register "r13" and proceeding downwards, registers are allocated
21524 first to satisfy the requirements of -mint-register, then -mpid and
21525 finally -msmall-data-limit. Thus it is possible for the small data
21526 area register to be "r8" if both -mint-register=4 and -mpid are
21527 specified on the command line.
21528
21529 By default this feature is not enabled. The default can be
21530 restored via the -mno-pid command-line option.
21531
21532 -mno-warn-multiple-fast-interrupts
21533 -mwarn-multiple-fast-interrupts
21534 Prevents GCC from issuing a warning message if it finds more than
21535 one fast interrupt handler when it is compiling a file. The
21536 default is to issue a warning for each extra fast interrupt handler
21537 found, as the RX only supports one such interrupt.
21538
21539 -mallow-string-insns
21540 -mno-allow-string-insns
21541 Enables or disables the use of the string manipulation instructions
21542 "SMOVF", "SCMPU", "SMOVB", "SMOVU", "SUNTIL" "SWHILE" and also the
21543 "RMPA" instruction. These instructions may prefetch data, which is
21544 not safe to do if accessing an I/O register. (See section 12.2.7
21545 of the RX62N Group User's Manual for more information).
21546
21547 The default is to allow these instructions, but it is not possible
21548 for GCC to reliably detect all circumstances where a string
21549 instruction might be used to access an I/O register, so their use
21550 cannot be disabled automatically. Instead it is reliant upon the
21551 programmer to use the -mno-allow-string-insns option if their
21552 program accesses I/O space.
21553
21554 When the instructions are enabled GCC defines the C preprocessor
21555 symbol "__RX_ALLOW_STRING_INSNS__", otherwise it defines the symbol
21556 "__RX_DISALLOW_STRING_INSNS__".
21557
21558 -mjsr
21559 -mno-jsr
21560 Use only (or not only) "JSR" instructions to access functions.
21561 This option can be used when code size exceeds the range of "BSR"
21562 instructions. Note that -mno-jsr does not mean to not use "JSR"
21563 but instead means that any type of branch may be used.
21564
21565 Note: The generic GCC command-line option -ffixed-reg has special
21566 significance to the RX port when used with the "interrupt" function
21567 attribute. This attribute indicates a function intended to process
21568 fast interrupts. GCC ensures that it only uses the registers "r10",
21569 "r11", "r12" and/or "r13" and only provided that the normal use of the
21570 corresponding registers have been restricted via the -ffixed-reg or
21571 -mint-register command-line options.
21572
21573 S/390 and zSeries Options
21574 These are the -m options defined for the S/390 and zSeries
21575 architecture.
21576
21577 -mhard-float
21578 -msoft-float
21579 Use (do not use) the hardware floating-point instructions and
21580 registers for floating-point operations. When -msoft-float is
21581 specified, functions in libgcc.a are used to perform floating-point
21582 operations. When -mhard-float is specified, the compiler generates
21583 IEEE floating-point instructions. This is the default.
21584
21585 -mhard-dfp
21586 -mno-hard-dfp
21587 Use (do not use) the hardware decimal-floating-point instructions
21588 for decimal-floating-point operations. When -mno-hard-dfp is
21589 specified, functions in libgcc.a are used to perform decimal-
21590 floating-point operations. When -mhard-dfp is specified, the
21591 compiler generates decimal-floating-point hardware instructions.
21592 This is the default for -march=z9-ec or higher.
21593
21594 -mlong-double-64
21595 -mlong-double-128
21596 These switches control the size of "long double" type. A size of 64
21597 bits makes the "long double" type equivalent to the "double" type.
21598 This is the default.
21599
21600 -mbackchain
21601 -mno-backchain
21602 Store (do not store) the address of the caller's frame as backchain
21603 pointer into the callee's stack frame. A backchain may be needed
21604 to allow debugging using tools that do not understand DWARF call
21605 frame information. When -mno-packed-stack is in effect, the
21606 backchain pointer is stored at the bottom of the stack frame; when
21607 -mpacked-stack is in effect, the backchain is placed into the
21608 topmost word of the 96/160 byte register save area.
21609
21610 In general, code compiled with -mbackchain is call-compatible with
21611 code compiled with -mmo-backchain; however, use of the backchain
21612 for debugging purposes usually requires that the whole binary is
21613 built with -mbackchain. Note that the combination of -mbackchain,
21614 -mpacked-stack and -mhard-float is not supported. In order to
21615 build a linux kernel use -msoft-float.
21616
21617 The default is to not maintain the backchain.
21618
21619 -mpacked-stack
21620 -mno-packed-stack
21621 Use (do not use) the packed stack layout. When -mno-packed-stack
21622 is specified, the compiler uses the all fields of the 96/160 byte
21623 register save area only for their default purpose; unused fields
21624 still take up stack space. When -mpacked-stack is specified,
21625 register save slots are densely packed at the top of the register
21626 save area; unused space is reused for other purposes, allowing for
21627 more efficient use of the available stack space. However, when
21628 -mbackchain is also in effect, the topmost word of the save area is
21629 always used to store the backchain, and the return address register
21630 is always saved two words below the backchain.
21631
21632 As long as the stack frame backchain is not used, code generated
21633 with -mpacked-stack is call-compatible with code generated with
21634 -mno-packed-stack. Note that some non-FSF releases of GCC 2.95 for
21635 S/390 or zSeries generated code that uses the stack frame backchain
21636 at run time, not just for debugging purposes. Such code is not
21637 call-compatible with code compiled with -mpacked-stack. Also, note
21638 that the combination of -mbackchain, -mpacked-stack and
21639 -mhard-float is not supported. In order to build a linux kernel
21640 use -msoft-float.
21641
21642 The default is to not use the packed stack layout.
21643
21644 -msmall-exec
21645 -mno-small-exec
21646 Generate (or do not generate) code using the "bras" instruction to
21647 do subroutine calls. This only works reliably if the total
21648 executable size does not exceed 64k. The default is to use the
21649 "basr" instruction instead, which does not have this limitation.
21650
21651 -m64
21652 -m31
21653 When -m31 is specified, generate code compliant to the GNU/Linux
21654 for S/390 ABI. When -m64 is specified, generate code compliant to
21655 the GNU/Linux for zSeries ABI. This allows GCC in particular to
21656 generate 64-bit instructions. For the s390 targets, the default is
21657 -m31, while the s390x targets default to -m64.
21658
21659 -mzarch
21660 -mesa
21661 When -mzarch is specified, generate code using the instructions
21662 available on z/Architecture. When -mesa is specified, generate
21663 code using the instructions available on ESA/390. Note that -mesa
21664 is not possible with -m64. When generating code compliant to the
21665 GNU/Linux for S/390 ABI, the default is -mesa. When generating
21666 code compliant to the GNU/Linux for zSeries ABI, the default is
21667 -mzarch.
21668
21669 -mhtm
21670 -mno-htm
21671 The -mhtm option enables a set of builtins making use of
21672 instructions available with the transactional execution facility
21673 introduced with the IBM zEnterprise EC12 machine generation S/390
21674 System z Built-in Functions. -mhtm is enabled by default when
21675 using -march=zEC12.
21676
21677 -mvx
21678 -mno-vx
21679 When -mvx is specified, generate code using the instructions
21680 available with the vector extension facility introduced with the
21681 IBM z13 machine generation. This option changes the ABI for some
21682 vector type values with regard to alignment and calling
21683 conventions. In case vector type values are being used in an ABI-
21684 relevant context a GAS .gnu_attribute command will be added to mark
21685 the resulting binary with the ABI used. -mvx is enabled by default
21686 when using -march=z13.
21687
21688 -mzvector
21689 -mno-zvector
21690 The -mzvector option enables vector language extensions and
21691 builtins using instructions available with the vector extension
21692 facility introduced with the IBM z13 machine generation. This
21693 option adds support for vector to be used as a keyword to define
21694 vector type variables and arguments. vector is only available when
21695 GNU extensions are enabled. It will not be expanded when
21696 requesting strict standard compliance e.g. with -std=c99. In
21697 addition to the GCC low-level builtins -mzvector enables a set of
21698 builtins added for compatibility with AltiVec-style implementations
21699 like Power and Cell. In order to make use of these builtins the
21700 header file vecintrin.h needs to be included. -mzvector is
21701 disabled by default.
21702
21703 -mmvcle
21704 -mno-mvcle
21705 Generate (or do not generate) code using the "mvcle" instruction to
21706 perform block moves. When -mno-mvcle is specified, use a "mvc"
21707 loop instead. This is the default unless optimizing for size.
21708
21709 -mdebug
21710 -mno-debug
21711 Print (or do not print) additional debug information when
21712 compiling. The default is to not print debug information.
21713
21714 -march=cpu-type
21715 Generate code that runs on cpu-type, which is the name of a system
21716 representing a certain processor type. Possible values for cpu-
21717 type are z900/arch5, z990/arch6, z9-109, z9-ec/arch7, z10/arch8,
21718 z196/arch9, zEC12, z13/arch11, z14/arch12, and native.
21719
21720 The default is -march=z900.
21721
21722 Specifying native as cpu type can be used to select the best
21723 architecture option for the host processor. -march=native has no
21724 effect if GCC does not recognize the processor.
21725
21726 -mtune=cpu-type
21727 Tune to cpu-type everything applicable about the generated code,
21728 except for the ABI and the set of available instructions. The list
21729 of cpu-type values is the same as for -march. The default is the
21730 value used for -march.
21731
21732 -mtpf-trace
21733 -mno-tpf-trace
21734 Generate code that adds (does not add) in TPF OS specific branches
21735 to trace routines in the operating system. This option is off by
21736 default, even when compiling for the TPF OS.
21737
21738 -mfused-madd
21739 -mno-fused-madd
21740 Generate code that uses (does not use) the floating-point multiply
21741 and accumulate instructions. These instructions are generated by
21742 default if hardware floating point is used.
21743
21744 -mwarn-framesize=framesize
21745 Emit a warning if the current function exceeds the given frame
21746 size. Because this is a compile-time check it doesn't need to be a
21747 real problem when the program runs. It is intended to identify
21748 functions that most probably cause a stack overflow. It is useful
21749 to be used in an environment with limited stack size e.g. the linux
21750 kernel.
21751
21752 -mwarn-dynamicstack
21753 Emit a warning if the function calls "alloca" or uses dynamically-
21754 sized arrays. This is generally a bad idea with a limited stack
21755 size.
21756
21757 -mstack-guard=stack-guard
21758 -mstack-size=stack-size
21759 If these options are provided the S/390 back end emits additional
21760 instructions in the function prologue that trigger a trap if the
21761 stack size is stack-guard bytes above the stack-size (remember that
21762 the stack on S/390 grows downward). If the stack-guard option is
21763 omitted the smallest power of 2 larger than the frame size of the
21764 compiled function is chosen. These options are intended to be used
21765 to help debugging stack overflow problems. The additionally
21766 emitted code causes only little overhead and hence can also be used
21767 in production-like systems without greater performance degradation.
21768 The given values have to be exact powers of 2 and stack-size has to
21769 be greater than stack-guard without exceeding 64k. In order to be
21770 efficient the extra code makes the assumption that the stack starts
21771 at an address aligned to the value given by stack-size. The stack-
21772 guard option can only be used in conjunction with stack-size.
21773
21774 -mhotpatch=pre-halfwords,post-halfwords
21775 If the hotpatch option is enabled, a "hot-patching" function
21776 prologue is generated for all functions in the compilation unit.
21777 The funtion label is prepended with the given number of two-byte
21778 NOP instructions (pre-halfwords, maximum 1000000). After the
21779 label, 2 * post-halfwords bytes are appended, using the largest NOP
21780 like instructions the architecture allows (maximum 1000000).
21781
21782 If both arguments are zero, hotpatching is disabled.
21783
21784 This option can be overridden for individual functions with the
21785 "hotpatch" attribute.
21786
21787 Score Options
21788 These options are defined for Score implementations:
21789
21790 -meb
21791 Compile code for big-endian mode. This is the default.
21792
21793 -mel
21794 Compile code for little-endian mode.
21795
21796 -mnhwloop
21797 Disable generation of "bcnz" instructions.
21798
21799 -muls
21800 Enable generation of unaligned load and store instructions.
21801
21802 -mmac
21803 Enable the use of multiply-accumulate instructions. Disabled by
21804 default.
21805
21806 -mscore5
21807 Specify the SCORE5 as the target architecture.
21808
21809 -mscore5u
21810 Specify the SCORE5U of the target architecture.
21811
21812 -mscore7
21813 Specify the SCORE7 as the target architecture. This is the default.
21814
21815 -mscore7d
21816 Specify the SCORE7D as the target architecture.
21817
21818 SH Options
21819 These -m options are defined for the SH implementations:
21820
21821 -m1 Generate code for the SH1.
21822
21823 -m2 Generate code for the SH2.
21824
21825 -m2e
21826 Generate code for the SH2e.
21827
21828 -m2a-nofpu
21829 Generate code for the SH2a without FPU, or for a SH2a-FPU in such a
21830 way that the floating-point unit is not used.
21831
21832 -m2a-single-only
21833 Generate code for the SH2a-FPU, in such a way that no double-
21834 precision floating-point operations are used.
21835
21836 -m2a-single
21837 Generate code for the SH2a-FPU assuming the floating-point unit is
21838 in single-precision mode by default.
21839
21840 -m2a
21841 Generate code for the SH2a-FPU assuming the floating-point unit is
21842 in double-precision mode by default.
21843
21844 -m3 Generate code for the SH3.
21845
21846 -m3e
21847 Generate code for the SH3e.
21848
21849 -m4-nofpu
21850 Generate code for the SH4 without a floating-point unit.
21851
21852 -m4-single-only
21853 Generate code for the SH4 with a floating-point unit that only
21854 supports single-precision arithmetic.
21855
21856 -m4-single
21857 Generate code for the SH4 assuming the floating-point unit is in
21858 single-precision mode by default.
21859
21860 -m4 Generate code for the SH4.
21861
21862 -m4-100
21863 Generate code for SH4-100.
21864
21865 -m4-100-nofpu
21866 Generate code for SH4-100 in such a way that the floating-point
21867 unit is not used.
21868
21869 -m4-100-single
21870 Generate code for SH4-100 assuming the floating-point unit is in
21871 single-precision mode by default.
21872
21873 -m4-100-single-only
21874 Generate code for SH4-100 in such a way that no double-precision
21875 floating-point operations are used.
21876
21877 -m4-200
21878 Generate code for SH4-200.
21879
21880 -m4-200-nofpu
21881 Generate code for SH4-200 without in such a way that the floating-
21882 point unit is not used.
21883
21884 -m4-200-single
21885 Generate code for SH4-200 assuming the floating-point unit is in
21886 single-precision mode by default.
21887
21888 -m4-200-single-only
21889 Generate code for SH4-200 in such a way that no double-precision
21890 floating-point operations are used.
21891
21892 -m4-300
21893 Generate code for SH4-300.
21894
21895 -m4-300-nofpu
21896 Generate code for SH4-300 without in such a way that the floating-
21897 point unit is not used.
21898
21899 -m4-300-single
21900 Generate code for SH4-300 in such a way that no double-precision
21901 floating-point operations are used.
21902
21903 -m4-300-single-only
21904 Generate code for SH4-300 in such a way that no double-precision
21905 floating-point operations are used.
21906
21907 -m4-340
21908 Generate code for SH4-340 (no MMU, no FPU).
21909
21910 -m4-500
21911 Generate code for SH4-500 (no FPU). Passes -isa=sh4-nofpu to the
21912 assembler.
21913
21914 -m4a-nofpu
21915 Generate code for the SH4al-dsp, or for a SH4a in such a way that
21916 the floating-point unit is not used.
21917
21918 -m4a-single-only
21919 Generate code for the SH4a, in such a way that no double-precision
21920 floating-point operations are used.
21921
21922 -m4a-single
21923 Generate code for the SH4a assuming the floating-point unit is in
21924 single-precision mode by default.
21925
21926 -m4a
21927 Generate code for the SH4a.
21928
21929 -m4al
21930 Same as -m4a-nofpu, except that it implicitly passes -dsp to the
21931 assembler. GCC doesn't generate any DSP instructions at the
21932 moment.
21933
21934 -mb Compile code for the processor in big-endian mode.
21935
21936 -ml Compile code for the processor in little-endian mode.
21937
21938 -mdalign
21939 Align doubles at 64-bit boundaries. Note that this changes the
21940 calling conventions, and thus some functions from the standard C
21941 library do not work unless you recompile it first with -mdalign.
21942
21943 -mrelax
21944 Shorten some address references at link time, when possible; uses
21945 the linker option -relax.
21946
21947 -mbigtable
21948 Use 32-bit offsets in "switch" tables. The default is to use
21949 16-bit offsets.
21950
21951 -mbitops
21952 Enable the use of bit manipulation instructions on SH2A.
21953
21954 -mfmovd
21955 Enable the use of the instruction "fmovd". Check -mdalign for
21956 alignment constraints.
21957
21958 -mrenesas
21959 Comply with the calling conventions defined by Renesas.
21960
21961 -mno-renesas
21962 Comply with the calling conventions defined for GCC before the
21963 Renesas conventions were available. This option is the default for
21964 all targets of the SH toolchain.
21965
21966 -mnomacsave
21967 Mark the "MAC" register as call-clobbered, even if -mrenesas is
21968 given.
21969
21970 -mieee
21971 -mno-ieee
21972 Control the IEEE compliance of floating-point comparisons, which
21973 affects the handling of cases where the result of a comparison is
21974 unordered. By default -mieee is implicitly enabled. If
21975 -ffinite-math-only is enabled -mno-ieee is implicitly set, which
21976 results in faster floating-point greater-equal and less-equal
21977 comparisons. The implicit settings can be overridden by specifying
21978 either -mieee or -mno-ieee.
21979
21980 -minline-ic_invalidate
21981 Inline code to invalidate instruction cache entries after setting
21982 up nested function trampolines. This option has no effect if
21983 -musermode is in effect and the selected code generation option
21984 (e.g. -m4) does not allow the use of the "icbi" instruction. If
21985 the selected code generation option does not allow the use of the
21986 "icbi" instruction, and -musermode is not in effect, the inlined
21987 code manipulates the instruction cache address array directly with
21988 an associative write. This not only requires privileged mode at
21989 run time, but it also fails if the cache line had been mapped via
21990 the TLB and has become unmapped.
21991
21992 -misize
21993 Dump instruction size and location in the assembly code.
21994
21995 -mpadstruct
21996 This option is deprecated. It pads structures to multiple of 4
21997 bytes, which is incompatible with the SH ABI.
21998
21999 -matomic-model=model
22000 Sets the model of atomic operations and additional parameters as a
22001 comma separated list. For details on the atomic built-in functions
22002 see __atomic Builtins. The following models and parameters are
22003 supported:
22004
22005 none
22006 Disable compiler generated atomic sequences and emit library
22007 calls for atomic operations. This is the default if the target
22008 is not "sh*-*-linux*".
22009
22010 soft-gusa
22011 Generate GNU/Linux compatible gUSA software atomic sequences
22012 for the atomic built-in functions. The generated atomic
22013 sequences require additional support from the
22014 interrupt/exception handling code of the system and are only
22015 suitable for SH3* and SH4* single-core systems. This option is
22016 enabled by default when the target is "sh*-*-linux*" and SH3*
22017 or SH4*. When the target is SH4A, this option also partially
22018 utilizes the hardware atomic instructions "movli.l" and
22019 "movco.l" to create more efficient code, unless strict is
22020 specified.
22021
22022 soft-tcb
22023 Generate software atomic sequences that use a variable in the
22024 thread control block. This is a variation of the gUSA
22025 sequences which can also be used on SH1* and SH2* targets. The
22026 generated atomic sequences require additional support from the
22027 interrupt/exception handling code of the system and are only
22028 suitable for single-core systems. When using this model, the
22029 gbr-offset= parameter has to be specified as well.
22030
22031 soft-imask
22032 Generate software atomic sequences that temporarily disable
22033 interrupts by setting "SR.IMASK = 1111". This model works only
22034 when the program runs in privileged mode and is only suitable
22035 for single-core systems. Additional support from the
22036 interrupt/exception handling code of the system is not
22037 required. This model is enabled by default when the target is
22038 "sh*-*-linux*" and SH1* or SH2*.
22039
22040 hard-llcs
22041 Generate hardware atomic sequences using the "movli.l" and
22042 "movco.l" instructions only. This is only available on SH4A
22043 and is suitable for multi-core systems. Since the hardware
22044 instructions support only 32 bit atomic variables access to 8
22045 or 16 bit variables is emulated with 32 bit accesses. Code
22046 compiled with this option is also compatible with other
22047 software atomic model interrupt/exception handling systems if
22048 executed on an SH4A system. Additional support from the
22049 interrupt/exception handling code of the system is not required
22050 for this model.
22051
22052 gbr-offset=
22053 This parameter specifies the offset in bytes of the variable in
22054 the thread control block structure that should be used by the
22055 generated atomic sequences when the soft-tcb model has been
22056 selected. For other models this parameter is ignored. The
22057 specified value must be an integer multiple of four and in the
22058 range 0-1020.
22059
22060 strict
22061 This parameter prevents mixed usage of multiple atomic models,
22062 even if they are compatible, and makes the compiler generate
22063 atomic sequences of the specified model only.
22064
22065 -mtas
22066 Generate the "tas.b" opcode for "__atomic_test_and_set". Notice
22067 that depending on the particular hardware and software
22068 configuration this can degrade overall performance due to the
22069 operand cache line flushes that are implied by the "tas.b"
22070 instruction. On multi-core SH4A processors the "tas.b" instruction
22071 must be used with caution since it can result in data corruption
22072 for certain cache configurations.
22073
22074 -mprefergot
22075 When generating position-independent code, emit function calls
22076 using the Global Offset Table instead of the Procedure Linkage
22077 Table.
22078
22079 -musermode
22080 -mno-usermode
22081 Don't allow (allow) the compiler generating privileged mode code.
22082 Specifying -musermode also implies -mno-inline-ic_invalidate if the
22083 inlined code would not work in user mode. -musermode is the
22084 default when the target is "sh*-*-linux*". If the target is SH1*
22085 or SH2* -musermode has no effect, since there is no user mode.
22086
22087 -multcost=number
22088 Set the cost to assume for a multiply insn.
22089
22090 -mdiv=strategy
22091 Set the division strategy to be used for integer division
22092 operations. strategy can be one of:
22093
22094 call-div1
22095 Calls a library function that uses the single-step division
22096 instruction "div1" to perform the operation. Division by zero
22097 calculates an unspecified result and does not trap. This is
22098 the default except for SH4, SH2A and SHcompact.
22099
22100 call-fp
22101 Calls a library function that performs the operation in double
22102 precision floating point. Division by zero causes a floating-
22103 point exception. This is the default for SHcompact with FPU.
22104 Specifying this for targets that do not have a double precision
22105 FPU defaults to "call-div1".
22106
22107 call-table
22108 Calls a library function that uses a lookup table for small
22109 divisors and the "div1" instruction with case distinction for
22110 larger divisors. Division by zero calculates an unspecified
22111 result and does not trap. This is the default for SH4.
22112 Specifying this for targets that do not have dynamic shift
22113 instructions defaults to "call-div1".
22114
22115 When a division strategy has not been specified the default
22116 strategy is selected based on the current target. For SH2A the
22117 default strategy is to use the "divs" and "divu" instructions
22118 instead of library function calls.
22119
22120 -maccumulate-outgoing-args
22121 Reserve space once for outgoing arguments in the function prologue
22122 rather than around each call. Generally beneficial for performance
22123 and size. Also needed for unwinding to avoid changing the stack
22124 frame around conditional code.
22125
22126 -mdivsi3_libfunc=name
22127 Set the name of the library function used for 32-bit signed
22128 division to name. This only affects the name used in the call
22129 division strategies, and the compiler still expects the same sets
22130 of input/output/clobbered registers as if this option were not
22131 present.
22132
22133 -mfixed-range=register-range
22134 Generate code treating the given register range as fixed registers.
22135 A fixed register is one that the register allocator cannot use.
22136 This is useful when compiling kernel code. A register range is
22137 specified as two registers separated by a dash. Multiple register
22138 ranges can be specified separated by a comma.
22139
22140 -mbranch-cost=num
22141 Assume num to be the cost for a branch instruction. Higher numbers
22142 make the compiler try to generate more branch-free code if
22143 possible. If not specified the value is selected depending on the
22144 processor type that is being compiled for.
22145
22146 -mzdcbranch
22147 -mno-zdcbranch
22148 Assume (do not assume) that zero displacement conditional branch
22149 instructions "bt" and "bf" are fast. If -mzdcbranch is specified,
22150 the compiler prefers zero displacement branch code sequences. This
22151 is enabled by default when generating code for SH4 and SH4A. It
22152 can be explicitly disabled by specifying -mno-zdcbranch.
22153
22154 -mcbranch-force-delay-slot
22155 Force the usage of delay slots for conditional branches, which
22156 stuffs the delay slot with a "nop" if a suitable instruction cannot
22157 be found. By default this option is disabled. It can be enabled
22158 to work around hardware bugs as found in the original SH7055.
22159
22160 -mfused-madd
22161 -mno-fused-madd
22162 Generate code that uses (does not use) the floating-point multiply
22163 and accumulate instructions. These instructions are generated by
22164 default if hardware floating point is used. The machine-dependent
22165 -mfused-madd option is now mapped to the machine-independent
22166 -ffp-contract=fast option, and -mno-fused-madd is mapped to
22167 -ffp-contract=off.
22168
22169 -mfsca
22170 -mno-fsca
22171 Allow or disallow the compiler to emit the "fsca" instruction for
22172 sine and cosine approximations. The option -mfsca must be used in
22173 combination with -funsafe-math-optimizations. It is enabled by
22174 default when generating code for SH4A. Using -mno-fsca disables
22175 sine and cosine approximations even if -funsafe-math-optimizations
22176 is in effect.
22177
22178 -mfsrra
22179 -mno-fsrra
22180 Allow or disallow the compiler to emit the "fsrra" instruction for
22181 reciprocal square root approximations. The option -mfsrra must be
22182 used in combination with -funsafe-math-optimizations and
22183 -ffinite-math-only. It is enabled by default when generating code
22184 for SH4A. Using -mno-fsrra disables reciprocal square root
22185 approximations even if -funsafe-math-optimizations and
22186 -ffinite-math-only are in effect.
22187
22188 -mpretend-cmove
22189 Prefer zero-displacement conditional branches for conditional move
22190 instruction patterns. This can result in faster code on the SH4
22191 processor.
22192
22193 -mfdpic
22194 Generate code using the FDPIC ABI.
22195
22196 Solaris 2 Options
22197 These -m options are supported on Solaris 2:
22198
22199 -mclear-hwcap
22200 -mclear-hwcap tells the compiler to remove the hardware
22201 capabilities generated by the Solaris assembler. This is only
22202 necessary when object files use ISA extensions not supported by the
22203 current machine, but check at runtime whether or not to use them.
22204
22205 -mimpure-text
22206 -mimpure-text, used in addition to -shared, tells the compiler to
22207 not pass -z text to the linker when linking a shared object. Using
22208 this option, you can link position-dependent code into a shared
22209 object.
22210
22211 -mimpure-text suppresses the "relocations remain against
22212 allocatable but non-writable sections" linker error message.
22213 However, the necessary relocations trigger copy-on-write, and the
22214 shared object is not actually shared across processes. Instead of
22215 using -mimpure-text, you should compile all source code with -fpic
22216 or -fPIC.
22217
22218 These switches are supported in addition to the above on Solaris 2:
22219
22220 -pthreads
22221 This is a synonym for -pthread.
22222
22223 SPARC Options
22224 These -m options are supported on the SPARC:
22225
22226 -mno-app-regs
22227 -mapp-regs
22228 Specify -mapp-regs to generate output using the global registers 2
22229 through 4, which the SPARC SVR4 ABI reserves for applications.
22230 Like the global register 1, each global register 2 through 4 is
22231 then treated as an allocable register that is clobbered by function
22232 calls. This is the default.
22233
22234 To be fully SVR4 ABI-compliant at the cost of some performance
22235 loss, specify -mno-app-regs. You should compile libraries and
22236 system software with this option.
22237
22238 -mflat
22239 -mno-flat
22240 With -mflat, the compiler does not generate save/restore
22241 instructions and uses a "flat" or single register window model.
22242 This model is compatible with the regular register window model.
22243 The local registers and the input registers (0--5) are still
22244 treated as "call-saved" registers and are saved on the stack as
22245 needed.
22246
22247 With -mno-flat (the default), the compiler generates save/restore
22248 instructions (except for leaf functions). This is the normal
22249 operating mode.
22250
22251 -mfpu
22252 -mhard-float
22253 Generate output containing floating-point instructions. This is
22254 the default.
22255
22256 -mno-fpu
22257 -msoft-float
22258 Generate output containing library calls for floating point.
22259 Warning: the requisite libraries are not available for all SPARC
22260 targets. Normally the facilities of the machine's usual C compiler
22261 are used, but this cannot be done directly in cross-compilation.
22262 You must make your own arrangements to provide suitable library
22263 functions for cross-compilation. The embedded targets sparc-*-aout
22264 and sparclite-*-* do provide software floating-point support.
22265
22266 -msoft-float changes the calling convention in the output file;
22267 therefore, it is only useful if you compile all of a program with
22268 this option. In particular, you need to compile libgcc.a, the
22269 library that comes with GCC, with -msoft-float in order for this to
22270 work.
22271
22272 -mhard-quad-float
22273 Generate output containing quad-word (long double) floating-point
22274 instructions.
22275
22276 -msoft-quad-float
22277 Generate output containing library calls for quad-word (long
22278 double) floating-point instructions. The functions called are
22279 those specified in the SPARC ABI. This is the default.
22280
22281 As of this writing, there are no SPARC implementations that have
22282 hardware support for the quad-word floating-point instructions.
22283 They all invoke a trap handler for one of these instructions, and
22284 then the trap handler emulates the effect of the instruction.
22285 Because of the trap handler overhead, this is much slower than
22286 calling the ABI library routines. Thus the -msoft-quad-float
22287 option is the default.
22288
22289 -mno-unaligned-doubles
22290 -munaligned-doubles
22291 Assume that doubles have 8-byte alignment. This is the default.
22292
22293 With -munaligned-doubles, GCC assumes that doubles have 8-byte
22294 alignment only if they are contained in another type, or if they
22295 have an absolute address. Otherwise, it assumes they have 4-byte
22296 alignment. Specifying this option avoids some rare compatibility
22297 problems with code generated by other compilers. It is not the
22298 default because it results in a performance loss, especially for
22299 floating-point code.
22300
22301 -muser-mode
22302 -mno-user-mode
22303 Do not generate code that can only run in supervisor mode. This is
22304 relevant only for the "casa" instruction emitted for the LEON3
22305 processor. This is the default.
22306
22307 -mfaster-structs
22308 -mno-faster-structs
22309 With -mfaster-structs, the compiler assumes that structures should
22310 have 8-byte alignment. This enables the use of pairs of "ldd" and
22311 "std" instructions for copies in structure assignment, in place of
22312 twice as many "ld" and "st" pairs. However, the use of this
22313 changed alignment directly violates the SPARC ABI. Thus, it's
22314 intended only for use on targets where the developer acknowledges
22315 that their resulting code is not directly in line with the rules of
22316 the ABI.
22317
22318 -mstd-struct-return
22319 -mno-std-struct-return
22320 With -mstd-struct-return, the compiler generates checking code in
22321 functions returning structures or unions to detect size mismatches
22322 between the two sides of function calls, as per the 32-bit ABI.
22323
22324 The default is -mno-std-struct-return. This option has no effect
22325 in 64-bit mode.
22326
22327 -mlra
22328 -mno-lra
22329 Enable Local Register Allocation. This is the default for SPARC
22330 since GCC 7 so -mno-lra needs to be passed to get old Reload.
22331
22332 -mcpu=cpu_type
22333 Set the instruction set, register set, and instruction scheduling
22334 parameters for machine type cpu_type. Supported values for
22335 cpu_type are v7, cypress, v8, supersparc, hypersparc, leon, leon3,
22336 leon3v7, sparclite, f930, f934, sparclite86x, sparclet, tsc701, v9,
22337 ultrasparc, ultrasparc3, niagara, niagara2, niagara3, niagara4,
22338 niagara7 and m8.
22339
22340 Native Solaris and GNU/Linux toolchains also support the value
22341 native, which selects the best architecture option for the host
22342 processor. -mcpu=native has no effect if GCC does not recognize
22343 the processor.
22344
22345 Default instruction scheduling parameters are used for values that
22346 select an architecture and not an implementation. These are v7,
22347 v8, sparclite, sparclet, v9.
22348
22349 Here is a list of each supported architecture and their supported
22350 implementations.
22351
22352 v7 cypress, leon3v7
22353
22354 v8 supersparc, hypersparc, leon, leon3
22355
22356 sparclite
22357 f930, f934, sparclite86x
22358
22359 sparclet
22360 tsc701
22361
22362 v9 ultrasparc, ultrasparc3, niagara, niagara2, niagara3, niagara4,
22363 niagara7, m8
22364
22365 By default (unless configured otherwise), GCC generates code for
22366 the V7 variant of the SPARC architecture. With -mcpu=cypress, the
22367 compiler additionally optimizes it for the Cypress CY7C602 chip, as
22368 used in the SPARCStation/SPARCServer 3xx series. This is also
22369 appropriate for the older SPARCStation 1, 2, IPX etc.
22370
22371 With -mcpu=v8, GCC generates code for the V8 variant of the SPARC
22372 architecture. The only difference from V7 code is that the
22373 compiler emits the integer multiply and integer divide instructions
22374 which exist in SPARC-V8 but not in SPARC-V7. With
22375 -mcpu=supersparc, the compiler additionally optimizes it for the
22376 SuperSPARC chip, as used in the SPARCStation 10, 1000 and 2000
22377 series.
22378
22379 With -mcpu=sparclite, GCC generates code for the SPARClite variant
22380 of the SPARC architecture. This adds the integer multiply, integer
22381 divide step and scan ("ffs") instructions which exist in SPARClite
22382 but not in SPARC-V7. With -mcpu=f930, the compiler additionally
22383 optimizes it for the Fujitsu MB86930 chip, which is the original
22384 SPARClite, with no FPU. With -mcpu=f934, the compiler additionally
22385 optimizes it for the Fujitsu MB86934 chip, which is the more recent
22386 SPARClite with FPU.
22387
22388 With -mcpu=sparclet, GCC generates code for the SPARClet variant of
22389 the SPARC architecture. This adds the integer multiply,
22390 multiply/accumulate, integer divide step and scan ("ffs")
22391 instructions which exist in SPARClet but not in SPARC-V7. With
22392 -mcpu=tsc701, the compiler additionally optimizes it for the TEMIC
22393 SPARClet chip.
22394
22395 With -mcpu=v9, GCC generates code for the V9 variant of the SPARC
22396 architecture. This adds 64-bit integer and floating-point move
22397 instructions, 3 additional floating-point condition code registers
22398 and conditional move instructions. With -mcpu=ultrasparc, the
22399 compiler additionally optimizes it for the Sun UltraSPARC I/II/IIi
22400 chips. With -mcpu=ultrasparc3, the compiler additionally optimizes
22401 it for the Sun UltraSPARC III/III+/IIIi/IIIi+/IV/IV+ chips. With
22402 -mcpu=niagara, the compiler additionally optimizes it for Sun
22403 UltraSPARC T1 chips. With -mcpu=niagara2, the compiler
22404 additionally optimizes it for Sun UltraSPARC T2 chips. With
22405 -mcpu=niagara3, the compiler additionally optimizes it for Sun
22406 UltraSPARC T3 chips. With -mcpu=niagara4, the compiler
22407 additionally optimizes it for Sun UltraSPARC T4 chips. With
22408 -mcpu=niagara7, the compiler additionally optimizes it for Oracle
22409 SPARC M7 chips. With -mcpu=m8, the compiler additionally optimizes
22410 it for Oracle M8 chips.
22411
22412 -mtune=cpu_type
22413 Set the instruction scheduling parameters for machine type
22414 cpu_type, but do not set the instruction set or register set that
22415 the option -mcpu=cpu_type does.
22416
22417 The same values for -mcpu=cpu_type can be used for -mtune=cpu_type,
22418 but the only useful values are those that select a particular CPU
22419 implementation. Those are cypress, supersparc, hypersparc, leon,
22420 leon3, leon3v7, f930, f934, sparclite86x, tsc701, ultrasparc,
22421 ultrasparc3, niagara, niagara2, niagara3, niagara4, niagara7 and
22422 m8. With native Solaris and GNU/Linux toolchains, native can also
22423 be used.
22424
22425 -mv8plus
22426 -mno-v8plus
22427 With -mv8plus, GCC generates code for the SPARC-V8+ ABI. The
22428 difference from the V8 ABI is that the global and out registers are
22429 considered 64 bits wide. This is enabled by default on Solaris in
22430 32-bit mode for all SPARC-V9 processors.
22431
22432 -mvis
22433 -mno-vis
22434 With -mvis, GCC generates code that takes advantage of the
22435 UltraSPARC Visual Instruction Set extensions. The default is
22436 -mno-vis.
22437
22438 -mvis2
22439 -mno-vis2
22440 With -mvis2, GCC generates code that takes advantage of version 2.0
22441 of the UltraSPARC Visual Instruction Set extensions. The default
22442 is -mvis2 when targeting a cpu that supports such instructions,
22443 such as UltraSPARC-III and later. Setting -mvis2 also sets -mvis.
22444
22445 -mvis3
22446 -mno-vis3
22447 With -mvis3, GCC generates code that takes advantage of version 3.0
22448 of the UltraSPARC Visual Instruction Set extensions. The default
22449 is -mvis3 when targeting a cpu that supports such instructions,
22450 such as niagara-3 and later. Setting -mvis3 also sets -mvis2 and
22451 -mvis.
22452
22453 -mvis4
22454 -mno-vis4
22455 With -mvis4, GCC generates code that takes advantage of version 4.0
22456 of the UltraSPARC Visual Instruction Set extensions. The default
22457 is -mvis4 when targeting a cpu that supports such instructions,
22458 such as niagara-7 and later. Setting -mvis4 also sets -mvis3,
22459 -mvis2 and -mvis.
22460
22461 -mvis4b
22462 -mno-vis4b
22463 With -mvis4b, GCC generates code that takes advantage of version
22464 4.0 of the UltraSPARC Visual Instruction Set extensions, plus the
22465 additional VIS instructions introduced in the Oracle SPARC
22466 Architecture 2017. The default is -mvis4b when targeting a cpu
22467 that supports such instructions, such as m8 and later. Setting
22468 -mvis4b also sets -mvis4, -mvis3, -mvis2 and -mvis.
22469
22470 -mcbcond
22471 -mno-cbcond
22472 With -mcbcond, GCC generates code that takes advantage of the
22473 UltraSPARC Compare-and-Branch-on-Condition instructions. The
22474 default is -mcbcond when targeting a CPU that supports such
22475 instructions, such as Niagara-4 and later.
22476
22477 -mfmaf
22478 -mno-fmaf
22479 With -mfmaf, GCC generates code that takes advantage of the
22480 UltraSPARC Fused Multiply-Add Floating-point instructions. The
22481 default is -mfmaf when targeting a CPU that supports such
22482 instructions, such as Niagara-3 and later.
22483
22484 -mfsmuld
22485 -mno-fsmuld
22486 With -mfsmuld, GCC generates code that takes advantage of the
22487 Floating-point Multiply Single to Double (FsMULd) instruction. The
22488 default is -mfsmuld when targeting a CPU supporting the
22489 architecture versions V8 or V9 with FPU except -mcpu=leon.
22490
22491 -mpopc
22492 -mno-popc
22493 With -mpopc, GCC generates code that takes advantage of the
22494 UltraSPARC Population Count instruction. The default is -mpopc
22495 when targeting a CPU that supports such an instruction, such as
22496 Niagara-2 and later.
22497
22498 -msubxc
22499 -mno-subxc
22500 With -msubxc, GCC generates code that takes advantage of the
22501 UltraSPARC Subtract-Extended-with-Carry instruction. The default
22502 is -msubxc when targeting a CPU that supports such an instruction,
22503 such as Niagara-7 and later.
22504
22505 -mfix-at697f
22506 Enable the documented workaround for the single erratum of the
22507 Atmel AT697F processor (which corresponds to erratum #13 of the
22508 AT697E processor).
22509
22510 -mfix-ut699
22511 Enable the documented workarounds for the floating-point errata and
22512 the data cache nullify errata of the UT699 processor.
22513
22514 -mfix-ut700
22515 Enable the documented workaround for the back-to-back store errata
22516 of the UT699E/UT700 processor.
22517
22518 -mfix-gr712rc
22519 Enable the documented workaround for the back-to-back store errata
22520 of the GR712RC processor.
22521
22522 These -m options are supported in addition to the above on SPARC-V9
22523 processors in 64-bit environments:
22524
22525 -m32
22526 -m64
22527 Generate code for a 32-bit or 64-bit environment. The 32-bit
22528 environment sets int, long and pointer to 32 bits. The 64-bit
22529 environment sets int to 32 bits and long and pointer to 64 bits.
22530
22531 -mcmodel=which
22532 Set the code model to one of
22533
22534 medlow
22535 The Medium/Low code model: 64-bit addresses, programs must be
22536 linked in the low 32 bits of memory. Programs can be
22537 statically or dynamically linked.
22538
22539 medmid
22540 The Medium/Middle code model: 64-bit addresses, programs must
22541 be linked in the low 44 bits of memory, the text and data
22542 segments must be less than 2GB in size and the data segment
22543 must be located within 2GB of the text segment.
22544
22545 medany
22546 The Medium/Anywhere code model: 64-bit addresses, programs may
22547 be linked anywhere in memory, the text and data segments must
22548 be less than 2GB in size and the data segment must be located
22549 within 2GB of the text segment.
22550
22551 embmedany
22552 The Medium/Anywhere code model for embedded systems: 64-bit
22553 addresses, the text and data segments must be less than 2GB in
22554 size, both starting anywhere in memory (determined at link
22555 time). The global register %g4 points to the base of the data
22556 segment. Programs are statically linked and PIC is not
22557 supported.
22558
22559 -mmemory-model=mem-model
22560 Set the memory model in force on the processor to one of
22561
22562 default
22563 The default memory model for the processor and operating
22564 system.
22565
22566 rmo Relaxed Memory Order
22567
22568 pso Partial Store Order
22569
22570 tso Total Store Order
22571
22572 sc Sequential Consistency
22573
22574 These memory models are formally defined in Appendix D of the
22575 SPARC-V9 architecture manual, as set in the processor's "PSTATE.MM"
22576 field.
22577
22578 -mstack-bias
22579 -mno-stack-bias
22580 With -mstack-bias, GCC assumes that the stack pointer, and frame
22581 pointer if present, are offset by -2047 which must be added back
22582 when making stack frame references. This is the default in 64-bit
22583 mode. Otherwise, assume no such offset is present.
22584
22585 SPU Options
22586 These -m options are supported on the SPU:
22587
22588 -mwarn-reloc
22589 -merror-reloc
22590 The loader for SPU does not handle dynamic relocations. By
22591 default, GCC gives an error when it generates code that requires a
22592 dynamic relocation. -mno-error-reloc disables the error,
22593 -mwarn-reloc generates a warning instead.
22594
22595 -msafe-dma
22596 -munsafe-dma
22597 Instructions that initiate or test completion of DMA must not be
22598 reordered with respect to loads and stores of the memory that is
22599 being accessed. With -munsafe-dma you must use the "volatile"
22600 keyword to protect memory accesses, but that can lead to
22601 inefficient code in places where the memory is known to not change.
22602 Rather than mark the memory as volatile, you can use -msafe-dma to
22603 tell the compiler to treat the DMA instructions as potentially
22604 affecting all memory.
22605
22606 -mbranch-hints
22607 By default, GCC generates a branch hint instruction to avoid
22608 pipeline stalls for always-taken or probably-taken branches. A
22609 hint is not generated closer than 8 instructions away from its
22610 branch. There is little reason to disable them, except for
22611 debugging purposes, or to make an object a little bit smaller.
22612
22613 -msmall-mem
22614 -mlarge-mem
22615 By default, GCC generates code assuming that addresses are never
22616 larger than 18 bits. With -mlarge-mem code is generated that
22617 assumes a full 32-bit address.
22618
22619 -mstdmain
22620 By default, GCC links against startup code that assumes the SPU-
22621 style main function interface (which has an unconventional
22622 parameter list). With -mstdmain, GCC links your program against
22623 startup code that assumes a C99-style interface to "main",
22624 including a local copy of "argv" strings.
22625
22626 -mfixed-range=register-range
22627 Generate code treating the given register range as fixed registers.
22628 A fixed register is one that the register allocator cannot use.
22629 This is useful when compiling kernel code. A register range is
22630 specified as two registers separated by a dash. Multiple register
22631 ranges can be specified separated by a comma.
22632
22633 -mea32
22634 -mea64
22635 Compile code assuming that pointers to the PPU address space
22636 accessed via the "__ea" named address space qualifier are either 32
22637 or 64 bits wide. The default is 32 bits. As this is an ABI-
22638 changing option, all object code in an executable must be compiled
22639 with the same setting.
22640
22641 -maddress-space-conversion
22642 -mno-address-space-conversion
22643 Allow/disallow treating the "__ea" address space as superset of the
22644 generic address space. This enables explicit type casts between
22645 "__ea" and generic pointer as well as implicit conversions of
22646 generic pointers to "__ea" pointers. The default is to allow
22647 address space pointer conversions.
22648
22649 -mcache-size=cache-size
22650 This option controls the version of libgcc that the compiler links
22651 to an executable and selects a software-managed cache for accessing
22652 variables in the "__ea" address space with a particular cache size.
22653 Possible options for cache-size are 8, 16, 32, 64 and 128. The
22654 default cache size is 64KB.
22655
22656 -matomic-updates
22657 -mno-atomic-updates
22658 This option controls the version of libgcc that the compiler links
22659 to an executable and selects whether atomic updates to the
22660 software-managed cache of PPU-side variables are used. If you use
22661 atomic updates, changes to a PPU variable from SPU code using the
22662 "__ea" named address space qualifier do not interfere with changes
22663 to other PPU variables residing in the same cache line from PPU
22664 code. If you do not use atomic updates, such interference may
22665 occur; however, writing back cache lines is more efficient. The
22666 default behavior is to use atomic updates.
22667
22668 -mdual-nops
22669 -mdual-nops=n
22670 By default, GCC inserts NOPs to increase dual issue when it expects
22671 it to increase performance. n can be a value from 0 to 10. A
22672 smaller n inserts fewer NOPs. 10 is the default, 0 is the same as
22673 -mno-dual-nops. Disabled with -Os.
22674
22675 -mhint-max-nops=n
22676 Maximum number of NOPs to insert for a branch hint. A branch hint
22677 must be at least 8 instructions away from the branch it is
22678 affecting. GCC inserts up to n NOPs to enforce this, otherwise it
22679 does not generate the branch hint.
22680
22681 -mhint-max-distance=n
22682 The encoding of the branch hint instruction limits the hint to be
22683 within 256 instructions of the branch it is affecting. By default,
22684 GCC makes sure it is within 125.
22685
22686 -msafe-hints
22687 Work around a hardware bug that causes the SPU to stall
22688 indefinitely. By default, GCC inserts the "hbrp" instruction to
22689 make sure this stall won't happen.
22690
22691 Options for System V
22692 These additional options are available on System V Release 4 for
22693 compatibility with other compilers on those systems:
22694
22695 -G Create a shared object. It is recommended that -symbolic or
22696 -shared be used instead.
22697
22698 -Qy Identify the versions of each tool used by the compiler, in a
22699 ".ident" assembler directive in the output.
22700
22701 -Qn Refrain from adding ".ident" directives to the output file (this is
22702 the default).
22703
22704 -YP,dirs
22705 Search the directories dirs, and no others, for libraries specified
22706 with -l.
22707
22708 -Ym,dir
22709 Look in the directory dir to find the M4 preprocessor. The
22710 assembler uses this option.
22711
22712 TILE-Gx Options
22713 These -m options are supported on the TILE-Gx:
22714
22715 -mcmodel=small
22716 Generate code for the small model. The distance for direct calls
22717 is limited to 500M in either direction. PC-relative addresses are
22718 32 bits. Absolute addresses support the full address range.
22719
22720 -mcmodel=large
22721 Generate code for the large model. There is no limitation on call
22722 distance, pc-relative addresses, or absolute addresses.
22723
22724 -mcpu=name
22725 Selects the type of CPU to be targeted. Currently the only
22726 supported type is tilegx.
22727
22728 -m32
22729 -m64
22730 Generate code for a 32-bit or 64-bit environment. The 32-bit
22731 environment sets int, long, and pointer to 32 bits. The 64-bit
22732 environment sets int to 32 bits and long and pointer to 64 bits.
22733
22734 -mbig-endian
22735 -mlittle-endian
22736 Generate code in big/little endian mode, respectively.
22737
22738 TILEPro Options
22739 These -m options are supported on the TILEPro:
22740
22741 -mcpu=name
22742 Selects the type of CPU to be targeted. Currently the only
22743 supported type is tilepro.
22744
22745 -m32
22746 Generate code for a 32-bit environment, which sets int, long, and
22747 pointer to 32 bits. This is the only supported behavior so the
22748 flag is essentially ignored.
22749
22750 V850 Options
22751 These -m options are defined for V850 implementations:
22752
22753 -mlong-calls
22754 -mno-long-calls
22755 Treat all calls as being far away (near). If calls are assumed to
22756 be far away, the compiler always loads the function's address into
22757 a register, and calls indirect through the pointer.
22758
22759 -mno-ep
22760 -mep
22761 Do not optimize (do optimize) basic blocks that use the same index
22762 pointer 4 or more times to copy pointer into the "ep" register, and
22763 use the shorter "sld" and "sst" instructions. The -mep option is
22764 on by default if you optimize.
22765
22766 -mno-prolog-function
22767 -mprolog-function
22768 Do not use (do use) external functions to save and restore
22769 registers at the prologue and epilogue of a function. The external
22770 functions are slower, but use less code space if more than one
22771 function saves the same number of registers. The -mprolog-function
22772 option is on by default if you optimize.
22773
22774 -mspace
22775 Try to make the code as small as possible. At present, this just
22776 turns on the -mep and -mprolog-function options.
22777
22778 -mtda=n
22779 Put static or global variables whose size is n bytes or less into
22780 the tiny data area that register "ep" points to. The tiny data
22781 area can hold up to 256 bytes in total (128 bytes for byte
22782 references).
22783
22784 -msda=n
22785 Put static or global variables whose size is n bytes or less into
22786 the small data area that register "gp" points to. The small data
22787 area can hold up to 64 kilobytes.
22788
22789 -mzda=n
22790 Put static or global variables whose size is n bytes or less into
22791 the first 32 kilobytes of memory.
22792
22793 -mv850
22794 Specify that the target processor is the V850.
22795
22796 -mv850e3v5
22797 Specify that the target processor is the V850E3V5. The
22798 preprocessor constant "__v850e3v5__" is defined if this option is
22799 used.
22800
22801 -mv850e2v4
22802 Specify that the target processor is the V850E3V5. This is an
22803 alias for the -mv850e3v5 option.
22804
22805 -mv850e2v3
22806 Specify that the target processor is the V850E2V3. The
22807 preprocessor constant "__v850e2v3__" is defined if this option is
22808 used.
22809
22810 -mv850e2
22811 Specify that the target processor is the V850E2. The preprocessor
22812 constant "__v850e2__" is defined if this option is used.
22813
22814 -mv850e1
22815 Specify that the target processor is the V850E1. The preprocessor
22816 constants "__v850e1__" and "__v850e__" are defined if this option
22817 is used.
22818
22819 -mv850es
22820 Specify that the target processor is the V850ES. This is an alias
22821 for the -mv850e1 option.
22822
22823 -mv850e
22824 Specify that the target processor is the V850E. The preprocessor
22825 constant "__v850e__" is defined if this option is used.
22826
22827 If neither -mv850 nor -mv850e nor -mv850e1 nor -mv850e2 nor
22828 -mv850e2v3 nor -mv850e3v5 are defined then a default target
22829 processor is chosen and the relevant __v850*__ preprocessor
22830 constant is defined.
22831
22832 The preprocessor constants "__v850" and "__v851__" are always
22833 defined, regardless of which processor variant is the target.
22834
22835 -mdisable-callt
22836 -mno-disable-callt
22837 This option suppresses generation of the "CALLT" instruction for
22838 the v850e, v850e1, v850e2, v850e2v3 and v850e3v5 flavors of the
22839 v850 architecture.
22840
22841 This option is enabled by default when the RH850 ABI is in use (see
22842 -mrh850-abi), and disabled by default when the GCC ABI is in use.
22843 If "CALLT" instructions are being generated then the C preprocessor
22844 symbol "__V850_CALLT__" is defined.
22845
22846 -mrelax
22847 -mno-relax
22848 Pass on (or do not pass on) the -mrelax command-line option to the
22849 assembler.
22850
22851 -mlong-jumps
22852 -mno-long-jumps
22853 Disable (or re-enable) the generation of PC-relative jump
22854 instructions.
22855
22856 -msoft-float
22857 -mhard-float
22858 Disable (or re-enable) the generation of hardware floating point
22859 instructions. This option is only significant when the target
22860 architecture is V850E2V3 or higher. If hardware floating point
22861 instructions are being generated then the C preprocessor symbol
22862 "__FPU_OK__" is defined, otherwise the symbol "__NO_FPU__" is
22863 defined.
22864
22865 -mloop
22866 Enables the use of the e3v5 LOOP instruction. The use of this
22867 instruction is not enabled by default when the e3v5 architecture is
22868 selected because its use is still experimental.
22869
22870 -mrh850-abi
22871 -mghs
22872 Enables support for the RH850 version of the V850 ABI. This is the
22873 default. With this version of the ABI the following rules apply:
22874
22875 * Integer sized structures and unions are returned via a memory
22876 pointer rather than a register.
22877
22878 * Large structures and unions (more than 8 bytes in size) are
22879 passed by value.
22880
22881 * Functions are aligned to 16-bit boundaries.
22882
22883 * The -m8byte-align command-line option is supported.
22884
22885 * The -mdisable-callt command-line option is enabled by default.
22886 The -mno-disable-callt command-line option is not supported.
22887
22888 When this version of the ABI is enabled the C preprocessor symbol
22889 "__V850_RH850_ABI__" is defined.
22890
22891 -mgcc-abi
22892 Enables support for the old GCC version of the V850 ABI. With this
22893 version of the ABI the following rules apply:
22894
22895 * Integer sized structures and unions are returned in register
22896 "r10".
22897
22898 * Large structures and unions (more than 8 bytes in size) are
22899 passed by reference.
22900
22901 * Functions are aligned to 32-bit boundaries, unless optimizing
22902 for size.
22903
22904 * The -m8byte-align command-line option is not supported.
22905
22906 * The -mdisable-callt command-line option is supported but not
22907 enabled by default.
22908
22909 When this version of the ABI is enabled the C preprocessor symbol
22910 "__V850_GCC_ABI__" is defined.
22911
22912 -m8byte-align
22913 -mno-8byte-align
22914 Enables support for "double" and "long long" types to be aligned on
22915 8-byte boundaries. The default is to restrict the alignment of all
22916 objects to at most 4-bytes. When -m8byte-align is in effect the C
22917 preprocessor symbol "__V850_8BYTE_ALIGN__" is defined.
22918
22919 -mbig-switch
22920 Generate code suitable for big switch tables. Use this option only
22921 if the assembler/linker complain about out of range branches within
22922 a switch table.
22923
22924 -mapp-regs
22925 This option causes r2 and r5 to be used in the code generated by
22926 the compiler. This setting is the default.
22927
22928 -mno-app-regs
22929 This option causes r2 and r5 to be treated as fixed registers.
22930
22931 VAX Options
22932 These -m options are defined for the VAX:
22933
22934 -munix
22935 Do not output certain jump instructions ("aobleq" and so on) that
22936 the Unix assembler for the VAX cannot handle across long ranges.
22937
22938 -mgnu
22939 Do output those jump instructions, on the assumption that the GNU
22940 assembler is being used.
22941
22942 -mg Output code for G-format floating-point numbers instead of
22943 D-format.
22944
22945 Visium Options
22946 -mdebug
22947 A program which performs file I/O and is destined to run on an MCM
22948 target should be linked with this option. It causes the libraries
22949 libc.a and libdebug.a to be linked. The program should be run on
22950 the target under the control of the GDB remote debugging stub.
22951
22952 -msim
22953 A program which performs file I/O and is destined to run on the
22954 simulator should be linked with option. This causes libraries
22955 libc.a and libsim.a to be linked.
22956
22957 -mfpu
22958 -mhard-float
22959 Generate code containing floating-point instructions. This is the
22960 default.
22961
22962 -mno-fpu
22963 -msoft-float
22964 Generate code containing library calls for floating-point.
22965
22966 -msoft-float changes the calling convention in the output file;
22967 therefore, it is only useful if you compile all of a program with
22968 this option. In particular, you need to compile libgcc.a, the
22969 library that comes with GCC, with -msoft-float in order for this to
22970 work.
22971
22972 -mcpu=cpu_type
22973 Set the instruction set, register set, and instruction scheduling
22974 parameters for machine type cpu_type. Supported values for
22975 cpu_type are mcm, gr5 and gr6.
22976
22977 mcm is a synonym of gr5 present for backward compatibility.
22978
22979 By default (unless configured otherwise), GCC generates code for
22980 the GR5 variant of the Visium architecture.
22981
22982 With -mcpu=gr6, GCC generates code for the GR6 variant of the
22983 Visium architecture. The only difference from GR5 code is that the
22984 compiler will generate block move instructions.
22985
22986 -mtune=cpu_type
22987 Set the instruction scheduling parameters for machine type
22988 cpu_type, but do not set the instruction set or register set that
22989 the option -mcpu=cpu_type would.
22990
22991 -msv-mode
22992 Generate code for the supervisor mode, where there are no
22993 restrictions on the access to general registers. This is the
22994 default.
22995
22996 -muser-mode
22997 Generate code for the user mode, where the access to some general
22998 registers is forbidden: on the GR5, registers r24 to r31 cannot be
22999 accessed in this mode; on the GR6, only registers r29 to r31 are
23000 affected.
23001
23002 VMS Options
23003 These -m options are defined for the VMS implementations:
23004
23005 -mvms-return-codes
23006 Return VMS condition codes from "main". The default is to return
23007 POSIX-style condition (e.g. error) codes.
23008
23009 -mdebug-main=prefix
23010 Flag the first routine whose name starts with prefix as the main
23011 routine for the debugger.
23012
23013 -mmalloc64
23014 Default to 64-bit memory allocation routines.
23015
23016 -mpointer-size=size
23017 Set the default size of pointers. Possible options for size are 32
23018 or short for 32 bit pointers, 64 or long for 64 bit pointers, and
23019 no for supporting only 32 bit pointers. The later option disables
23020 "pragma pointer_size".
23021
23022 VxWorks Options
23023 The options in this section are defined for all VxWorks targets.
23024 Options specific to the target hardware are listed with the other
23025 options for that target.
23026
23027 -mrtp
23028 GCC can generate code for both VxWorks kernels and real time
23029 processes (RTPs). This option switches from the former to the
23030 latter. It also defines the preprocessor macro "__RTP__".
23031
23032 -non-static
23033 Link an RTP executable against shared libraries rather than static
23034 libraries. The options -static and -shared can also be used for
23035 RTPs; -static is the default.
23036
23037 -Bstatic
23038 -Bdynamic
23039 These options are passed down to the linker. They are defined for
23040 compatibility with Diab.
23041
23042 -Xbind-lazy
23043 Enable lazy binding of function calls. This option is equivalent
23044 to -Wl,-z,now and is defined for compatibility with Diab.
23045
23046 -Xbind-now
23047 Disable lazy binding of function calls. This option is the default
23048 and is defined for compatibility with Diab.
23049
23050 x86 Options
23051 These -m options are defined for the x86 family of computers.
23052
23053 -march=cpu-type
23054 Generate instructions for the machine type cpu-type. In contrast
23055 to -mtune=cpu-type, which merely tunes the generated code for the
23056 specified cpu-type, -march=cpu-type allows GCC to generate code
23057 that may not run at all on processors other than the one indicated.
23058 Specifying -march=cpu-type implies -mtune=cpu-type.
23059
23060 The choices for cpu-type are:
23061
23062 native
23063 This selects the CPU to generate code for at compilation time
23064 by determining the processor type of the compiling machine.
23065 Using -march=native enables all instruction subsets supported
23066 by the local machine (hence the result might not run on
23067 different machines). Using -mtune=native produces code
23068 optimized for the local machine under the constraints of the
23069 selected instruction set.
23070
23071 x86-64
23072 A generic CPU with 64-bit extensions.
23073
23074 i386
23075 Original Intel i386 CPU.
23076
23077 i486
23078 Intel i486 CPU. (No scheduling is implemented for this chip.)
23079
23080 i586
23081 pentium
23082 Intel Pentium CPU with no MMX support.
23083
23084 lakemont
23085 Intel Lakemont MCU, based on Intel Pentium CPU.
23086
23087 pentium-mmx
23088 Intel Pentium MMX CPU, based on Pentium core with MMX
23089 instruction set support.
23090
23091 pentiumpro
23092 Intel Pentium Pro CPU.
23093
23094 i686
23095 When used with -march, the Pentium Pro instruction set is used,
23096 so the code runs on all i686 family chips. When used with
23097 -mtune, it has the same meaning as generic.
23098
23099 pentium2
23100 Intel Pentium II CPU, based on Pentium Pro core with MMX
23101 instruction set support.
23102
23103 pentium3
23104 pentium3m
23105 Intel Pentium III CPU, based on Pentium Pro core with MMX and
23106 SSE instruction set support.
23107
23108 pentium-m
23109 Intel Pentium M; low-power version of Intel Pentium III CPU
23110 with MMX, SSE and SSE2 instruction set support. Used by
23111 Centrino notebooks.
23112
23113 pentium4
23114 pentium4m
23115 Intel Pentium 4 CPU with MMX, SSE and SSE2 instruction set
23116 support.
23117
23118 prescott
23119 Improved version of Intel Pentium 4 CPU with MMX, SSE, SSE2 and
23120 SSE3 instruction set support.
23121
23122 nocona
23123 Improved version of Intel Pentium 4 CPU with 64-bit extensions,
23124 MMX, SSE, SSE2 and SSE3 instruction set support.
23125
23126 core2
23127 Intel Core 2 CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3
23128 and SSSE3 instruction set support.
23129
23130 nehalem
23131 Intel Nehalem CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3,
23132 SSSE3, SSE4.1, SSE4.2 and POPCNT instruction set support.
23133
23134 westmere
23135 Intel Westmere CPU with 64-bit extensions, MMX, SSE, SSE2,
23136 SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, AES and PCLMUL instruction
23137 set support.
23138
23139 sandybridge
23140 Intel Sandy Bridge CPU with 64-bit extensions, MMX, SSE, SSE2,
23141 SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, AVX, AES and PCLMUL
23142 instruction set support.
23143
23144 ivybridge
23145 Intel Ivy Bridge CPU with 64-bit extensions, MMX, SSE, SSE2,
23146 SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, AVX, AES, PCLMUL,
23147 FSGSBASE, RDRND and F16C instruction set support.
23148
23149 haswell
23150 Intel Haswell CPU with 64-bit extensions, MOVBE, MMX, SSE,
23151 SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES,
23152 PCLMUL, FSGSBASE, RDRND, FMA, BMI, BMI2 and F16C instruction
23153 set support.
23154
23155 broadwell
23156 Intel Broadwell CPU with 64-bit extensions, MOVBE, MMX, SSE,
23157 SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES,
23158 PCLMUL, FSGSBASE, RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX and
23159 PREFETCHW instruction set support.
23160
23161 skylake
23162 Intel Skylake CPU with 64-bit extensions, MOVBE, MMX, SSE,
23163 SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES,
23164 PCLMUL, FSGSBASE, RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX,
23165 PREFETCHW, CLFLUSHOPT, XSAVEC and XSAVES instruction set
23166 support.
23167
23168 bonnell
23169 Intel Bonnell CPU with 64-bit extensions, MOVBE, MMX, SSE,
23170 SSE2, SSE3 and SSSE3 instruction set support.
23171
23172 silvermont
23173 Intel Silvermont CPU with 64-bit extensions, MOVBE, MMX, SSE,
23174 SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, AES, PCLMUL and
23175 RDRND instruction set support.
23176
23177 goldmont
23178 Intel Goldmont CPU with 64-bit extensions, MOVBE, MMX, SSE,
23179 SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, AES, PCLMUL, RDRND,
23180 XSAVE, XSAVEOPT and FSGSBASE instruction set support.
23181
23182 goldmont-plus
23183 Intel Goldmont Plus CPU with 64-bit extensions, MOVBE, MMX,
23184 SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, AES, PCLMUL,
23185 RDRND, XSAVE, XSAVEOPT, FSGSBASE, PTWRITE, RDPID, SGX and UMIP
23186 instruction set support.
23187
23188 tremont
23189 Intel Tremont CPU with 64-bit extensions, MOVBE, MMX, SSE,
23190 SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, AES, PCLMUL, RDRND,
23191 XSAVE, XSAVEOPT, FSGSBASE, PTWRITE, RDPID, SGX, UMIP, GFNI-SSE,
23192 CLWB and ENCLV instruction set support.
23193
23194 knl Intel Knight's Landing CPU with 64-bit extensions, MOVBE, MMX,
23195 SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES,
23196 PCLMUL, FSGSBASE, RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX,
23197 PREFETCHW, AVX512F, AVX512PF, AVX512ER and AVX512CD instruction
23198 set support.
23199
23200 knm Intel Knights Mill CPU with 64-bit extensions, MOVBE, MMX, SSE,
23201 SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES,
23202 PCLMUL, FSGSBASE, RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX,
23203 PREFETCHW, AVX512F, AVX512PF, AVX512ER, AVX512CD, AVX5124VNNIW,
23204 AVX5124FMAPS and AVX512VPOPCNTDQ instruction set support.
23205
23206 skylake-avx512
23207 Intel Skylake Server CPU with 64-bit extensions, MOVBE, MMX,
23208 SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2,
23209 AES, PCLMUL, FSGSBASE, RDRND, FMA, BMI, BMI2, F16C, RDSEED,
23210 ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F, CLWB,
23211 AVX512VL, AVX512BW, AVX512DQ and AVX512CD instruction set
23212 support.
23213
23214 cannonlake
23215 Intel Cannonlake Server CPU with 64-bit extensions, MOVBE, MMX,
23216 SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2,
23217 AES, PCLMUL, FSGSBASE, RDRND, FMA, BMI, BMI2, F16C, RDSEED,
23218 ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F, AVX512VL,
23219 AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI, AVX512IFMA, SHA and
23220 UMIP instruction set support.
23221
23222 icelake-client
23223 Intel Icelake Client CPU with 64-bit extensions, MOVBE, MMX,
23224 SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2,
23225 AES, PCLMUL, FSGSBASE, RDRND, FMA, BMI, BMI2, F16C, RDSEED,
23226 ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F, AVX512VL,
23227 AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI, AVX512IFMA, SHA,
23228 CLWB, UMIP, RDPID, GFNI, AVX512VBMI2, AVX512VPOPCNTDQ,
23229 AVX512BITALG, AVX512VNNI, VPCLMULQDQ, VAES instruction set
23230 support.
23231
23232 icelake-server
23233 Intel Icelake Server CPU with 64-bit extensions, MOVBE, MMX,
23234 SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2,
23235 AES, PCLMUL, FSGSBASE, RDRND, FMA, BMI, BMI2, F16C, RDSEED,
23236 ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F, AVX512VL,
23237 AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI, AVX512IFMA, SHA,
23238 CLWB, UMIP, RDPID, GFNI, AVX512VBMI2, AVX512VPOPCNTDQ,
23239 AVX512BITALG, AVX512VNNI, VPCLMULQDQ, VAES, PCONFIG and
23240 WBNOINVD instruction set support.
23241
23242 cascadelake
23243 Intel Cascadelake CPU with 64-bit extensions, MOVBE, MMX, SSE,
23244 SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES,
23245 PCLMUL, FSGSBASE, RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX,
23246 PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F, CLWB, AVX512VL,
23247 AVX512BW, AVX512DQ, AVX512CD and AVX512VNNI instruction set
23248 support.
23249
23250 k6 AMD K6 CPU with MMX instruction set support.
23251
23252 k6-2
23253 k6-3
23254 Improved versions of AMD K6 CPU with MMX and 3DNow! instruction
23255 set support.
23256
23257 athlon
23258 athlon-tbird
23259 AMD Athlon CPU with MMX, 3dNOW!, enhanced 3DNow! and SSE
23260 prefetch instructions support.
23261
23262 athlon-4
23263 athlon-xp
23264 athlon-mp
23265 Improved AMD Athlon CPU with MMX, 3DNow!, enhanced 3DNow! and
23266 full SSE instruction set support.
23267
23268 k8
23269 opteron
23270 athlon64
23271 athlon-fx
23272 Processors based on the AMD K8 core with x86-64 instruction set
23273 support, including the AMD Opteron, Athlon 64, and Athlon 64 FX
23274 processors. (This supersets MMX, SSE, SSE2, 3DNow!, enhanced
23275 3DNow! and 64-bit instruction set extensions.)
23276
23277 k8-sse3
23278 opteron-sse3
23279 athlon64-sse3
23280 Improved versions of AMD K8 cores with SSE3 instruction set
23281 support.
23282
23283 amdfam10
23284 barcelona
23285 CPUs based on AMD Family 10h cores with x86-64 instruction set
23286 support. (This supersets MMX, SSE, SSE2, SSE3, SSE4A, 3DNow!,
23287 enhanced 3DNow!, ABM and 64-bit instruction set extensions.)
23288
23289 bdver1
23290 CPUs based on AMD Family 15h cores with x86-64 instruction set
23291 support. (This supersets FMA4, AVX, XOP, LWP, AES, PCL_MUL,
23292 CX16, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM
23293 and 64-bit instruction set extensions.)
23294
23295 bdver2
23296 AMD Family 15h core based CPUs with x86-64 instruction set
23297 support. (This supersets BMI, TBM, F16C, FMA, FMA4, AVX, XOP,
23298 LWP, AES, PCL_MUL, CX16, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3,
23299 SSE4.1, SSE4.2, ABM and 64-bit instruction set extensions.)
23300
23301 bdver3
23302 AMD Family 15h core based CPUs with x86-64 instruction set
23303 support. (This supersets BMI, TBM, F16C, FMA, FMA4, FSGSBASE,
23304 AVX, XOP, LWP, AES, PCL_MUL, CX16, MMX, SSE, SSE2, SSE3, SSE4A,
23305 SSSE3, SSE4.1, SSE4.2, ABM and 64-bit instruction set
23306 extensions.
23307
23308 bdver4
23309 AMD Family 15h core based CPUs with x86-64 instruction set
23310 support. (This supersets BMI, BMI2, TBM, F16C, FMA, FMA4,
23311 FSGSBASE, AVX, AVX2, XOP, LWP, AES, PCL_MUL, CX16, MOVBE, MMX,
23312 SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM and 64-bit
23313 instruction set extensions.
23314
23315 znver1
23316 AMD Family 17h core based CPUs with x86-64 instruction set
23317 support. (This supersets BMI, BMI2, F16C, FMA, FSGSBASE, AVX,
23318 AVX2, ADCX, RDSEED, MWAITX, SHA, CLZERO, AES, PCL_MUL, CX16,
23319 MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM,
23320 XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, and 64-bit instruction set
23321 extensions.
23322
23323 znver2
23324 AMD Family 17h core based CPUs with x86-64 instruction set
23325 support. (This supersets BMI, BMI2, ,CLWB, F16C, FMA, FSGSBASE,
23326 AVX, AVX2, ADCX, RDSEED, MWAITX, SHA, CLZERO, AES, PCL_MUL,
23327 CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1,
23328 SSE4.2, ABM, XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, and 64-bit
23329 instruction set extensions.)
23330
23331 btver1
23332 CPUs based on AMD Family 14h cores with x86-64 instruction set
23333 support. (This supersets MMX, SSE, SSE2, SSE3, SSSE3, SSE4A,
23334 CX16, ABM and 64-bit instruction set extensions.)
23335
23336 btver2
23337 CPUs based on AMD Family 16h cores with x86-64 instruction set
23338 support. This includes MOVBE, F16C, BMI, AVX, PCL_MUL, AES,
23339 SSE4.2, SSE4.1, CX16, ABM, SSE4A, SSSE3, SSE3, SSE2, SSE, MMX
23340 and 64-bit instruction set extensions.
23341
23342 winchip-c6
23343 IDT WinChip C6 CPU, dealt in same way as i486 with additional
23344 MMX instruction set support.
23345
23346 winchip2
23347 IDT WinChip 2 CPU, dealt in same way as i486 with additional
23348 MMX and 3DNow! instruction set support.
23349
23350 c3 VIA C3 CPU with MMX and 3DNow! instruction set support. (No
23351 scheduling is implemented for this chip.)
23352
23353 c3-2
23354 VIA C3-2 (Nehemiah/C5XL) CPU with MMX and SSE instruction set
23355 support. (No scheduling is implemented for this chip.)
23356
23357 c7 VIA C7 (Esther) CPU with MMX, SSE, SSE2 and SSE3 instruction
23358 set support. (No scheduling is implemented for this chip.)
23359
23360 samuel-2
23361 VIA Eden Samuel 2 CPU with MMX and 3DNow! instruction set
23362 support. (No scheduling is implemented for this chip.)
23363
23364 nehemiah
23365 VIA Eden Nehemiah CPU with MMX and SSE instruction set support.
23366 (No scheduling is implemented for this chip.)
23367
23368 esther
23369 VIA Eden Esther CPU with MMX, SSE, SSE2 and SSE3 instruction
23370 set support. (No scheduling is implemented for this chip.)
23371
23372 eden-x2
23373 VIA Eden X2 CPU with x86-64, MMX, SSE, SSE2 and SSE3
23374 instruction set support. (No scheduling is implemented for
23375 this chip.)
23376
23377 eden-x4
23378 VIA Eden X4 CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3,
23379 SSE4.1, SSE4.2, AVX and AVX2 instruction set support. (No
23380 scheduling is implemented for this chip.)
23381
23382 nano
23383 Generic VIA Nano CPU with x86-64, MMX, SSE, SSE2, SSE3 and
23384 SSSE3 instruction set support. (No scheduling is implemented
23385 for this chip.)
23386
23387 nano-1000
23388 VIA Nano 1xxx CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
23389 instruction set support. (No scheduling is implemented for
23390 this chip.)
23391
23392 nano-2000
23393 VIA Nano 2xxx CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
23394 instruction set support. (No scheduling is implemented for
23395 this chip.)
23396
23397 nano-3000
23398 VIA Nano 3xxx CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and
23399 SSE4.1 instruction set support. (No scheduling is implemented
23400 for this chip.)
23401
23402 nano-x2
23403 VIA Nano Dual Core CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3
23404 and SSE4.1 instruction set support. (No scheduling is
23405 implemented for this chip.)
23406
23407 nano-x4
23408 VIA Nano Quad Core CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3
23409 and SSE4.1 instruction set support. (No scheduling is
23410 implemented for this chip.)
23411
23412 geode
23413 AMD Geode embedded processor with MMX and 3DNow! instruction
23414 set support.
23415
23416 -mtune=cpu-type
23417 Tune to cpu-type everything applicable about the generated code,
23418 except for the ABI and the set of available instructions. While
23419 picking a specific cpu-type schedules things appropriately for that
23420 particular chip, the compiler does not generate any code that
23421 cannot run on the default machine type unless you use a -march=cpu-
23422 type option. For example, if GCC is configured for
23423 i686-pc-linux-gnu then -mtune=pentium4 generates code that is tuned
23424 for Pentium 4 but still runs on i686 machines.
23425
23426 The choices for cpu-type are the same as for -march. In addition,
23427 -mtune supports 2 extra choices for cpu-type:
23428
23429 generic
23430 Produce code optimized for the most common IA32/AMD64/EM64T
23431 processors. If you know the CPU on which your code will run,
23432 then you should use the corresponding -mtune or -march option
23433 instead of -mtune=generic. But, if you do not know exactly
23434 what CPU users of your application will have, then you should
23435 use this option.
23436
23437 As new processors are deployed in the marketplace, the behavior
23438 of this option will change. Therefore, if you upgrade to a
23439 newer version of GCC, code generation controlled by this option
23440 will change to reflect the processors that are most common at
23441 the time that version of GCC is released.
23442
23443 There is no -march=generic option because -march indicates the
23444 instruction set the compiler can use, and there is no generic
23445 instruction set applicable to all processors. In contrast,
23446 -mtune indicates the processor (or, in this case, collection of
23447 processors) for which the code is optimized.
23448
23449 intel
23450 Produce code optimized for the most current Intel processors,
23451 which are Haswell and Silvermont for this version of GCC. If
23452 you know the CPU on which your code will run, then you should
23453 use the corresponding -mtune or -march option instead of
23454 -mtune=intel. But, if you want your application performs
23455 better on both Haswell and Silvermont, then you should use this
23456 option.
23457
23458 As new Intel processors are deployed in the marketplace, the
23459 behavior of this option will change. Therefore, if you upgrade
23460 to a newer version of GCC, code generation controlled by this
23461 option will change to reflect the most current Intel processors
23462 at the time that version of GCC is released.
23463
23464 There is no -march=intel option because -march indicates the
23465 instruction set the compiler can use, and there is no common
23466 instruction set applicable to all processors. In contrast,
23467 -mtune indicates the processor (or, in this case, collection of
23468 processors) for which the code is optimized.
23469
23470 -mcpu=cpu-type
23471 A deprecated synonym for -mtune.
23472
23473 -mfpmath=unit
23474 Generate floating-point arithmetic for selected unit unit. The
23475 choices for unit are:
23476
23477 387 Use the standard 387 floating-point coprocessor present on the
23478 majority of chips and emulated otherwise. Code compiled with
23479 this option runs almost everywhere. The temporary results are
23480 computed in 80-bit precision instead of the precision specified
23481 by the type, resulting in slightly different results compared
23482 to most of other chips. See -ffloat-store for more detailed
23483 description.
23484
23485 This is the default choice for non-Darwin x86-32 targets.
23486
23487 sse Use scalar floating-point instructions present in the SSE
23488 instruction set. This instruction set is supported by Pentium
23489 III and newer chips, and in the AMD line by Athlon-4, Athlon XP
23490 and Athlon MP chips. The earlier version of the SSE
23491 instruction set supports only single-precision arithmetic, thus
23492 the double and extended-precision arithmetic are still done
23493 using 387. A later version, present only in Pentium 4 and AMD
23494 x86-64 chips, supports double-precision arithmetic too.
23495
23496 For the x86-32 compiler, you must use -march=cpu-type, -msse or
23497 -msse2 switches to enable SSE extensions and make this option
23498 effective. For the x86-64 compiler, these extensions are
23499 enabled by default.
23500
23501 The resulting code should be considerably faster in the
23502 majority of cases and avoid the numerical instability problems
23503 of 387 code, but may break some existing code that expects
23504 temporaries to be 80 bits.
23505
23506 This is the default choice for the x86-64 compiler, Darwin
23507 x86-32 targets, and the default choice for x86-32 targets with
23508 the SSE2 instruction set when -ffast-math is enabled.
23509
23510 sse,387
23511 sse+387
23512 both
23513 Attempt to utilize both instruction sets at once. This
23514 effectively doubles the amount of available registers, and on
23515 chips with separate execution units for 387 and SSE the
23516 execution resources too. Use this option with care, as it is
23517 still experimental, because the GCC register allocator does not
23518 model separate functional units well, resulting in unstable
23519 performance.
23520
23521 -masm=dialect
23522 Output assembly instructions using selected dialect. Also affects
23523 which dialect is used for basic "asm" and extended "asm". Supported
23524 choices (in dialect order) are att or intel. The default is att.
23525 Darwin does not support intel.
23526
23527 -mieee-fp
23528 -mno-ieee-fp
23529 Control whether or not the compiler uses IEEE floating-point
23530 comparisons. These correctly handle the case where the result of a
23531 comparison is unordered.
23532
23533 -m80387
23534 -mhard-float
23535 Generate output containing 80387 instructions for floating point.
23536
23537 -mno-80387
23538 -msoft-float
23539 Generate output containing library calls for floating point.
23540
23541 Warning: the requisite libraries are not part of GCC. Normally the
23542 facilities of the machine's usual C compiler are used, but this
23543 cannot be done directly in cross-compilation. You must make your
23544 own arrangements to provide suitable library functions for cross-
23545 compilation.
23546
23547 On machines where a function returns floating-point results in the
23548 80387 register stack, some floating-point opcodes may be emitted
23549 even if -msoft-float is used.
23550
23551 -mno-fp-ret-in-387
23552 Do not use the FPU registers for return values of functions.
23553
23554 The usual calling convention has functions return values of types
23555 "float" and "double" in an FPU register, even if there is no FPU.
23556 The idea is that the operating system should emulate an FPU.
23557
23558 The option -mno-fp-ret-in-387 causes such values to be returned in
23559 ordinary CPU registers instead.
23560
23561 -mno-fancy-math-387
23562 Some 387 emulators do not support the "sin", "cos" and "sqrt"
23563 instructions for the 387. Specify this option to avoid generating
23564 those instructions. This option is overridden when -march
23565 indicates that the target CPU always has an FPU and so the
23566 instruction does not need emulation. These instructions are not
23567 generated unless you also use the -funsafe-math-optimizations
23568 switch.
23569
23570 -malign-double
23571 -mno-align-double
23572 Control whether GCC aligns "double", "long double", and "long long"
23573 variables on a two-word boundary or a one-word boundary. Aligning
23574 "double" variables on a two-word boundary produces code that runs
23575 somewhat faster on a Pentium at the expense of more memory.
23576
23577 On x86-64, -malign-double is enabled by default.
23578
23579 Warning: if you use the -malign-double switch, structures
23580 containing the above types are aligned differently than the
23581 published application binary interface specifications for the
23582 x86-32 and are not binary compatible with structures in code
23583 compiled without that switch.
23584
23585 -m96bit-long-double
23586 -m128bit-long-double
23587 These switches control the size of "long double" type. The x86-32
23588 application binary interface specifies the size to be 96 bits, so
23589 -m96bit-long-double is the default in 32-bit mode.
23590
23591 Modern architectures (Pentium and newer) prefer "long double" to be
23592 aligned to an 8- or 16-byte boundary. In arrays or structures
23593 conforming to the ABI, this is not possible. So specifying
23594 -m128bit-long-double aligns "long double" to a 16-byte boundary by
23595 padding the "long double" with an additional 32-bit zero.
23596
23597 In the x86-64 compiler, -m128bit-long-double is the default choice
23598 as its ABI specifies that "long double" is aligned on 16-byte
23599 boundary.
23600
23601 Notice that neither of these options enable any extra precision
23602 over the x87 standard of 80 bits for a "long double".
23603
23604 Warning: if you override the default value for your target ABI,
23605 this changes the size of structures and arrays containing "long
23606 double" variables, as well as modifying the function calling
23607 convention for functions taking "long double". Hence they are not
23608 binary-compatible with code compiled without that switch.
23609
23610 -mlong-double-64
23611 -mlong-double-80
23612 -mlong-double-128
23613 These switches control the size of "long double" type. A size of 64
23614 bits makes the "long double" type equivalent to the "double" type.
23615 This is the default for 32-bit Bionic C library. A size of 128
23616 bits makes the "long double" type equivalent to the "__float128"
23617 type. This is the default for 64-bit Bionic C library.
23618
23619 Warning: if you override the default value for your target ABI,
23620 this changes the size of structures and arrays containing "long
23621 double" variables, as well as modifying the function calling
23622 convention for functions taking "long double". Hence they are not
23623 binary-compatible with code compiled without that switch.
23624
23625 -malign-data=type
23626 Control how GCC aligns variables. Supported values for type are
23627 compat uses increased alignment value compatible uses GCC 4.8 and
23628 earlier, abi uses alignment value as specified by the psABI, and
23629 cacheline uses increased alignment value to match the cache line
23630 size. compat is the default.
23631
23632 -mlarge-data-threshold=threshold
23633 When -mcmodel=medium is specified, data objects larger than
23634 threshold are placed in the large data section. This value must be
23635 the same across all objects linked into the binary, and defaults to
23636 65535.
23637
23638 -mrtd
23639 Use a different function-calling convention, in which functions
23640 that take a fixed number of arguments return with the "ret num"
23641 instruction, which pops their arguments while returning. This
23642 saves one instruction in the caller since there is no need to pop
23643 the arguments there.
23644
23645 You can specify that an individual function is called with this
23646 calling sequence with the function attribute "stdcall". You can
23647 also override the -mrtd option by using the function attribute
23648 "cdecl".
23649
23650 Warning: this calling convention is incompatible with the one
23651 normally used on Unix, so you cannot use it if you need to call
23652 libraries compiled with the Unix compiler.
23653
23654 Also, you must provide function prototypes for all functions that
23655 take variable numbers of arguments (including "printf"); otherwise
23656 incorrect code is generated for calls to those functions.
23657
23658 In addition, seriously incorrect code results if you call a
23659 function with too many arguments. (Normally, extra arguments are
23660 harmlessly ignored.)
23661
23662 -mregparm=num
23663 Control how many registers are used to pass integer arguments. By
23664 default, no registers are used to pass arguments, and at most 3
23665 registers can be used. You can control this behavior for a
23666 specific function by using the function attribute "regparm".
23667
23668 Warning: if you use this switch, and num is nonzero, then you must
23669 build all modules with the same value, including any libraries.
23670 This includes the system libraries and startup modules.
23671
23672 -msseregparm
23673 Use SSE register passing conventions for float and double arguments
23674 and return values. You can control this behavior for a specific
23675 function by using the function attribute "sseregparm".
23676
23677 Warning: if you use this switch then you must build all modules
23678 with the same value, including any libraries. This includes the
23679 system libraries and startup modules.
23680
23681 -mvect8-ret-in-mem
23682 Return 8-byte vectors in memory instead of MMX registers. This is
23683 the default on Solaris@tie{}8 and 9 and VxWorks to match the ABI of
23684 the Sun Studio compilers until version 12. Later compiler versions
23685 (starting with Studio 12 Update@tie{}1) follow the ABI used by
23686 other x86 targets, which is the default on Solaris@tie{}10 and
23687 later. Only use this option if you need to remain compatible with
23688 existing code produced by those previous compiler versions or older
23689 versions of GCC.
23690
23691 -mpc32
23692 -mpc64
23693 -mpc80
23694 Set 80387 floating-point precision to 32, 64 or 80 bits. When
23695 -mpc32 is specified, the significands of results of floating-point
23696 operations are rounded to 24 bits (single precision); -mpc64 rounds
23697 the significands of results of floating-point operations to 53 bits
23698 (double precision) and -mpc80 rounds the significands of results of
23699 floating-point operations to 64 bits (extended double precision),
23700 which is the default. When this option is used, floating-point
23701 operations in higher precisions are not available to the programmer
23702 without setting the FPU control word explicitly.
23703
23704 Setting the rounding of floating-point operations to less than the
23705 default 80 bits can speed some programs by 2% or more. Note that
23706 some mathematical libraries assume that extended-precision (80-bit)
23707 floating-point operations are enabled by default; routines in such
23708 libraries could suffer significant loss of accuracy, typically
23709 through so-called "catastrophic cancellation", when this option is
23710 used to set the precision to less than extended precision.
23711
23712 -mstackrealign
23713 Realign the stack at entry. On the x86, the -mstackrealign option
23714 generates an alternate prologue and epilogue that realigns the run-
23715 time stack if necessary. This supports mixing legacy codes that
23716 keep 4-byte stack alignment with modern codes that keep 16-byte
23717 stack alignment for SSE compatibility. See also the attribute
23718 "force_align_arg_pointer", applicable to individual functions.
23719
23720 -mpreferred-stack-boundary=num
23721 Attempt to keep the stack boundary aligned to a 2 raised to num
23722 byte boundary. If -mpreferred-stack-boundary is not specified, the
23723 default is 4 (16 bytes or 128 bits).
23724
23725 Warning: When generating code for the x86-64 architecture with SSE
23726 extensions disabled, -mpreferred-stack-boundary=3 can be used to
23727 keep the stack boundary aligned to 8 byte boundary. Since x86-64
23728 ABI require 16 byte stack alignment, this is ABI incompatible and
23729 intended to be used in controlled environment where stack space is
23730 important limitation. This option leads to wrong code when
23731 functions compiled with 16 byte stack alignment (such as functions
23732 from a standard library) are called with misaligned stack. In this
23733 case, SSE instructions may lead to misaligned memory access traps.
23734 In addition, variable arguments are handled incorrectly for 16 byte
23735 aligned objects (including x87 long double and __int128), leading
23736 to wrong results. You must build all modules with
23737 -mpreferred-stack-boundary=3, including any libraries. This
23738 includes the system libraries and startup modules.
23739
23740 -mincoming-stack-boundary=num
23741 Assume the incoming stack is aligned to a 2 raised to num byte
23742 boundary. If -mincoming-stack-boundary is not specified, the one
23743 specified by -mpreferred-stack-boundary is used.
23744
23745 On Pentium and Pentium Pro, "double" and "long double" values
23746 should be aligned to an 8-byte boundary (see -malign-double) or
23747 suffer significant run time performance penalties. On Pentium III,
23748 the Streaming SIMD Extension (SSE) data type "__m128" may not work
23749 properly if it is not 16-byte aligned.
23750
23751 To ensure proper alignment of this values on the stack, the stack
23752 boundary must be as aligned as that required by any value stored on
23753 the stack. Further, every function must be generated such that it
23754 keeps the stack aligned. Thus calling a function compiled with a
23755 higher preferred stack boundary from a function compiled with a
23756 lower preferred stack boundary most likely misaligns the stack. It
23757 is recommended that libraries that use callbacks always use the
23758 default setting.
23759
23760 This extra alignment does consume extra stack space, and generally
23761 increases code size. Code that is sensitive to stack space usage,
23762 such as embedded systems and operating system kernels, may want to
23763 reduce the preferred alignment to -mpreferred-stack-boundary=2.
23764
23765 -mmmx
23766 -msse
23767 -msse2
23768 -msse3
23769 -mssse3
23770 -msse4
23771 -msse4a
23772 -msse4.1
23773 -msse4.2
23774 -mavx
23775 -mavx2
23776 -mavx512f
23777 -mavx512pf
23778 -mavx512er
23779 -mavx512cd
23780 -mavx512vl
23781 -mavx512bw
23782 -mavx512dq
23783 -mavx512ifma
23784 -mavx512vbmi
23785 -msha
23786 -maes
23787 -mpclmul
23788 -mclflushopt
23789 -mclwb
23790 -mfsgsbase
23791 -mptwrite
23792 -mrdrnd
23793 -mf16c
23794 -mfma
23795 -mpconfig
23796 -mwbnoinvd
23797 -mfma4
23798 -mprfchw
23799 -mrdpid
23800 -mprefetchwt1
23801 -mrdseed
23802 -msgx
23803 -mxop
23804 -mlwp
23805 -m3dnow
23806 -m3dnowa
23807 -mpopcnt
23808 -mabm
23809 -madx
23810 -mbmi
23811 -mbmi2
23812 -mlzcnt
23813 -mfxsr
23814 -mxsave
23815 -mxsaveopt
23816 -mxsavec
23817 -mxsaves
23818 -mrtm
23819 -mhle
23820 -mtbm
23821 -mmwaitx
23822 -mclzero
23823 -mpku
23824 -mavx512vbmi2
23825 -mgfni
23826 -mvaes
23827 -mwaitpkg
23828 -mvpclmulqdq
23829 -mavx512bitalg
23830 -mmovdiri
23831 -mmovdir64b
23832 -mavx512vpopcntdq
23833 -mavx5124fmaps
23834 -mavx512vnni
23835 -mavx5124vnniw
23836 -mcldemote
23837 These switches enable the use of instructions in the MMX, SSE,
23838 SSE2, SSE3, SSSE3, SSE4, SSE4A, SSE4.1, SSE4.2, AVX, AVX2, AVX512F,
23839 AVX512PF, AVX512ER, AVX512CD, AVX512VL, AVX512BW, AVX512DQ,
23840 AVX512IFMA, AVX512VBMI, SHA, AES, PCLMUL, CLFLUSHOPT, CLWB,
23841 FSGSBASE, PTWRITE, RDRND, F16C, FMA, PCONFIG, WBNOINVD, FMA4,
23842 PREFETCHW, RDPID, PREFETCHWT1, RDSEED, SGX, XOP, LWP, 3DNow!,
23843 enhanced 3DNow!, POPCNT, ABM, ADX, BMI, BMI2, LZCNT, FXSR, XSAVE,
23844 XSAVEOPT, XSAVEC, XSAVES, RTM, HLE, TBM, MWAITX, CLZERO, PKU,
23845 AVX512VBMI2, GFNI, VAES, WAITPKG, VPCLMULQDQ, AVX512BITALG,
23846 MOVDIRI, MOVDIR64B, AVX512VPOPCNTDQ, AVX5124FMAPS, AVX512VNNI,
23847 AVX5124VNNIW, or CLDEMOTE extended instruction sets. Each has a
23848 corresponding -mno- option to disable use of these instructions.
23849
23850 These extensions are also available as built-in functions: see x86
23851 Built-in Functions, for details of the functions enabled and
23852 disabled by these switches.
23853
23854 To generate SSE/SSE2 instructions automatically from floating-point
23855 code (as opposed to 387 instructions), see -mfpmath=sse.
23856
23857 GCC depresses SSEx instructions when -mavx is used. Instead, it
23858 generates new AVX instructions or AVX equivalence for all SSEx
23859 instructions when needed.
23860
23861 These options enable GCC to use these extended instructions in
23862 generated code, even without -mfpmath=sse. Applications that
23863 perform run-time CPU detection must compile separate files for each
23864 supported architecture, using the appropriate flags. In
23865 particular, the file containing the CPU detection code should be
23866 compiled without these options.
23867
23868 -mdump-tune-features
23869 This option instructs GCC to dump the names of the x86 performance
23870 tuning features and default settings. The names can be used in
23871 -mtune-ctrl=feature-list.
23872
23873 -mtune-ctrl=feature-list
23874 This option is used to do fine grain control of x86 code generation
23875 features. feature-list is a comma separated list of feature names.
23876 See also -mdump-tune-features. When specified, the feature is
23877 turned on if it is not preceded with ^, otherwise, it is turned
23878 off. -mtune-ctrl=feature-list is intended to be used by GCC
23879 developers. Using it may lead to code paths not covered by testing
23880 and can potentially result in compiler ICEs or runtime errors.
23881
23882 -mno-default
23883 This option instructs GCC to turn off all tunable features. See
23884 also -mtune-ctrl=feature-list and -mdump-tune-features.
23885
23886 -mcld
23887 This option instructs GCC to emit a "cld" instruction in the
23888 prologue of functions that use string instructions. String
23889 instructions depend on the DF flag to select between autoincrement
23890 or autodecrement mode. While the ABI specifies the DF flag to be
23891 cleared on function entry, some operating systems violate this
23892 specification by not clearing the DF flag in their exception
23893 dispatchers. The exception handler can be invoked with the DF flag
23894 set, which leads to wrong direction mode when string instructions
23895 are used. This option can be enabled by default on 32-bit x86
23896 targets by configuring GCC with the --enable-cld configure option.
23897 Generation of "cld" instructions can be suppressed with the
23898 -mno-cld compiler option in this case.
23899
23900 -mvzeroupper
23901 This option instructs GCC to emit a "vzeroupper" instruction before
23902 a transfer of control flow out of the function to minimize the AVX
23903 to SSE transition penalty as well as remove unnecessary "zeroupper"
23904 intrinsics.
23905
23906 -mprefer-avx128
23907 This option instructs GCC to use 128-bit AVX instructions instead
23908 of 256-bit AVX instructions in the auto-vectorizer.
23909
23910 -mprefer-vector-width=opt
23911 This option instructs GCC to use opt-bit vector width in
23912 instructions instead of default on the selected platform.
23913
23914 none
23915 No extra limitations applied to GCC other than defined by the
23916 selected platform.
23917
23918 128 Prefer 128-bit vector width for instructions.
23919
23920 256 Prefer 256-bit vector width for instructions.
23921
23922 512 Prefer 512-bit vector width for instructions.
23923
23924 -mcx16
23925 This option enables GCC to generate "CMPXCHG16B" instructions in
23926 64-bit code to implement compare-and-exchange operations on 16-byte
23927 aligned 128-bit objects. This is useful for atomic updates of data
23928 structures exceeding one machine word in size. The compiler uses
23929 this instruction to implement __sync Builtins. However, for
23930 __atomic Builtins operating on 128-bit integers, a library call is
23931 always used.
23932
23933 -msahf
23934 This option enables generation of "SAHF" instructions in 64-bit
23935 code. Early Intel Pentium 4 CPUs with Intel 64 support, prior to
23936 the introduction of Pentium 4 G1 step in December 2005, lacked the
23937 "LAHF" and "SAHF" instructions which are supported by AMD64. These
23938 are load and store instructions, respectively, for certain status
23939 flags. In 64-bit mode, the "SAHF" instruction is used to optimize
23940 "fmod", "drem", and "remainder" built-in functions; see Other
23941 Builtins for details.
23942
23943 -mmovbe
23944 This option enables use of the "movbe" instruction to implement
23945 "__builtin_bswap32" and "__builtin_bswap64".
23946
23947 -mshstk
23948 The -mshstk option enables shadow stack built-in functions from x86
23949 Control-flow Enforcement Technology (CET).
23950
23951 -mcrc32
23952 This option enables built-in functions "__builtin_ia32_crc32qi",
23953 "__builtin_ia32_crc32hi", "__builtin_ia32_crc32si" and
23954 "__builtin_ia32_crc32di" to generate the "crc32" machine
23955 instruction.
23956
23957 -mrecip
23958 This option enables use of "RCPSS" and "RSQRTSS" instructions (and
23959 their vectorized variants "RCPPS" and "RSQRTPS") with an additional
23960 Newton-Raphson step to increase precision instead of "DIVSS" and
23961 "SQRTSS" (and their vectorized variants) for single-precision
23962 floating-point arguments. These instructions are generated only
23963 when -funsafe-math-optimizations is enabled together with
23964 -ffinite-math-only and -fno-trapping-math. Note that while the
23965 throughput of the sequence is higher than the throughput of the
23966 non-reciprocal instruction, the precision of the sequence can be
23967 decreased by up to 2 ulp (i.e. the inverse of 1.0 equals
23968 0.99999994).
23969
23970 Note that GCC implements "1.0f/sqrtf(x)" in terms of "RSQRTSS" (or
23971 "RSQRTPS") already with -ffast-math (or the above option
23972 combination), and doesn't need -mrecip.
23973
23974 Also note that GCC emits the above sequence with additional Newton-
23975 Raphson step for vectorized single-float division and vectorized
23976 "sqrtf(x)" already with -ffast-math (or the above option
23977 combination), and doesn't need -mrecip.
23978
23979 -mrecip=opt
23980 This option controls which reciprocal estimate instructions may be
23981 used. opt is a comma-separated list of options, which may be
23982 preceded by a ! to invert the option:
23983
23984 all Enable all estimate instructions.
23985
23986 default
23987 Enable the default instructions, equivalent to -mrecip.
23988
23989 none
23990 Disable all estimate instructions, equivalent to -mno-recip.
23991
23992 div Enable the approximation for scalar division.
23993
23994 vec-div
23995 Enable the approximation for vectorized division.
23996
23997 sqrt
23998 Enable the approximation for scalar square root.
23999
24000 vec-sqrt
24001 Enable the approximation for vectorized square root.
24002
24003 So, for example, -mrecip=all,!sqrt enables all of the reciprocal
24004 approximations, except for square root.
24005
24006 -mveclibabi=type
24007 Specifies the ABI type to use for vectorizing intrinsics using an
24008 external library. Supported values for type are svml for the Intel
24009 short vector math library and acml for the AMD math core library.
24010 To use this option, both -ftree-vectorize and
24011 -funsafe-math-optimizations have to be enabled, and an SVML or ACML
24012 ABI-compatible library must be specified at link time.
24013
24014 GCC currently emits calls to "vmldExp2", "vmldLn2", "vmldLog102",
24015 "vmldPow2", "vmldTanh2", "vmldTan2", "vmldAtan2", "vmldAtanh2",
24016 "vmldCbrt2", "vmldSinh2", "vmldSin2", "vmldAsinh2", "vmldAsin2",
24017 "vmldCosh2", "vmldCos2", "vmldAcosh2", "vmldAcos2", "vmlsExp4",
24018 "vmlsLn4", "vmlsLog104", "vmlsPow4", "vmlsTanh4", "vmlsTan4",
24019 "vmlsAtan4", "vmlsAtanh4", "vmlsCbrt4", "vmlsSinh4", "vmlsSin4",
24020 "vmlsAsinh4", "vmlsAsin4", "vmlsCosh4", "vmlsCos4", "vmlsAcosh4"
24021 and "vmlsAcos4" for corresponding function type when
24022 -mveclibabi=svml is used, and "__vrd2_sin", "__vrd2_cos",
24023 "__vrd2_exp", "__vrd2_log", "__vrd2_log2", "__vrd2_log10",
24024 "__vrs4_sinf", "__vrs4_cosf", "__vrs4_expf", "__vrs4_logf",
24025 "__vrs4_log2f", "__vrs4_log10f" and "__vrs4_powf" for the
24026 corresponding function type when -mveclibabi=acml is used.
24027
24028 -mabi=name
24029 Generate code for the specified calling convention. Permissible
24030 values are sysv for the ABI used on GNU/Linux and other systems,
24031 and ms for the Microsoft ABI. The default is to use the Microsoft
24032 ABI when targeting Microsoft Windows and the SysV ABI on all other
24033 systems. You can control this behavior for specific functions by
24034 using the function attributes "ms_abi" and "sysv_abi".
24035
24036 -mforce-indirect-call
24037 Force all calls to functions to be indirect. This is useful when
24038 using Intel Processor Trace where it generates more precise timing
24039 information for function calls.
24040
24041 -mmanual-endbr
24042 Insert ENDBR instruction at function entry only via the "cf_check"
24043 function attribute. This is useful when used with the option
24044 -fcf-protection=branch to control ENDBR insertion at the function
24045 entry.
24046
24047 -mcall-ms2sysv-xlogues
24048 Due to differences in 64-bit ABIs, any Microsoft ABI function that
24049 calls a System V ABI function must consider RSI, RDI and XMM6-15 as
24050 clobbered. By default, the code for saving and restoring these
24051 registers is emitted inline, resulting in fairly lengthy prologues
24052 and epilogues. Using -mcall-ms2sysv-xlogues emits prologues and
24053 epilogues that use stubs in the static portion of libgcc to perform
24054 these saves and restores, thus reducing function size at the cost
24055 of a few extra instructions.
24056
24057 -mtls-dialect=type
24058 Generate code to access thread-local storage using the gnu or gnu2
24059 conventions. gnu is the conservative default; gnu2 is more
24060 efficient, but it may add compile- and run-time requirements that
24061 cannot be satisfied on all systems.
24062
24063 -mpush-args
24064 -mno-push-args
24065 Use PUSH operations to store outgoing parameters. This method is
24066 shorter and usually equally fast as method using SUB/MOV operations
24067 and is enabled by default. In some cases disabling it may improve
24068 performance because of improved scheduling and reduced
24069 dependencies.
24070
24071 -maccumulate-outgoing-args
24072 If enabled, the maximum amount of space required for outgoing
24073 arguments is computed in the function prologue. This is faster on
24074 most modern CPUs because of reduced dependencies, improved
24075 scheduling and reduced stack usage when the preferred stack
24076 boundary is not equal to 2. The drawback is a notable increase in
24077 code size. This switch implies -mno-push-args.
24078
24079 -mthreads
24080 Support thread-safe exception handling on MinGW. Programs that
24081 rely on thread-safe exception handling must compile and link all
24082 code with the -mthreads option. When compiling, -mthreads defines
24083 -D_MT; when linking, it links in a special thread helper library
24084 -lmingwthrd which cleans up per-thread exception-handling data.
24085
24086 -mms-bitfields
24087 -mno-ms-bitfields
24088 Enable/disable bit-field layout compatible with the native
24089 Microsoft Windows compiler.
24090
24091 If "packed" is used on a structure, or if bit-fields are used, it
24092 may be that the Microsoft ABI lays out the structure differently
24093 than the way GCC normally does. Particularly when moving packed
24094 data between functions compiled with GCC and the native Microsoft
24095 compiler (either via function call or as data in a file), it may be
24096 necessary to access either format.
24097
24098 This option is enabled by default for Microsoft Windows targets.
24099 This behavior can also be controlled locally by use of variable or
24100 type attributes. For more information, see x86 Variable Attributes
24101 and x86 Type Attributes.
24102
24103 The Microsoft structure layout algorithm is fairly simple with the
24104 exception of the bit-field packing. The padding and alignment of
24105 members of structures and whether a bit-field can straddle a
24106 storage-unit boundary are determine by these rules:
24107
24108 1. Structure members are stored sequentially in the order in which
24109 they are
24110 declared: the first member has the lowest memory address and
24111 the last member the highest.
24112
24113 2. Every data object has an alignment requirement. The alignment
24114 requirement
24115 for all data except structures, unions, and arrays is either
24116 the size of the object or the current packing size (specified
24117 with either the "aligned" attribute or the "pack" pragma),
24118 whichever is less. For structures, unions, and arrays, the
24119 alignment requirement is the largest alignment requirement of
24120 its members. Every object is allocated an offset so that:
24121
24122 offset % alignment_requirement == 0
24123
24124 3. Adjacent bit-fields are packed into the same 1-, 2-, or 4-byte
24125 allocation
24126 unit if the integral types are the same size and if the next
24127 bit-field fits into the current allocation unit without
24128 crossing the boundary imposed by the common alignment
24129 requirements of the bit-fields.
24130
24131 MSVC interprets zero-length bit-fields in the following ways:
24132
24133 1. If a zero-length bit-field is inserted between two bit-fields
24134 that
24135 are normally coalesced, the bit-fields are not coalesced.
24136
24137 For example:
24138
24139 struct
24140 {
24141 unsigned long bf_1 : 12;
24142 unsigned long : 0;
24143 unsigned long bf_2 : 12;
24144 } t1;
24145
24146 The size of "t1" is 8 bytes with the zero-length bit-field. If
24147 the zero-length bit-field were removed, "t1"'s size would be 4
24148 bytes.
24149
24150 2. If a zero-length bit-field is inserted after a bit-field, "foo",
24151 and the
24152 alignment of the zero-length bit-field is greater than the
24153 member that follows it, "bar", "bar" is aligned as the type of
24154 the zero-length bit-field.
24155
24156 For example:
24157
24158 struct
24159 {
24160 char foo : 4;
24161 short : 0;
24162 char bar;
24163 } t2;
24164
24165 struct
24166 {
24167 char foo : 4;
24168 short : 0;
24169 double bar;
24170 } t3;
24171
24172 For "t2", "bar" is placed at offset 2, rather than offset 1.
24173 Accordingly, the size of "t2" is 4. For "t3", the zero-length
24174 bit-field does not affect the alignment of "bar" or, as a
24175 result, the size of the structure.
24176
24177 Taking this into account, it is important to note the
24178 following:
24179
24180 1. If a zero-length bit-field follows a normal bit-field, the
24181 type of the
24182 zero-length bit-field may affect the alignment of the
24183 structure as whole. For example, "t2" has a size of 4
24184 bytes, since the zero-length bit-field follows a normal
24185 bit-field, and is of type short.
24186
24187 2. Even if a zero-length bit-field is not followed by a normal
24188 bit-field, it may
24189 still affect the alignment of the structure:
24190
24191 struct
24192 {
24193 char foo : 6;
24194 long : 0;
24195 } t4;
24196
24197 Here, "t4" takes up 4 bytes.
24198
24199 3. Zero-length bit-fields following non-bit-field members are
24200 ignored:
24201 struct
24202 {
24203 char foo;
24204 long : 0;
24205 char bar;
24206 } t5;
24207
24208 Here, "t5" takes up 2 bytes.
24209
24210 -mno-align-stringops
24211 Do not align the destination of inlined string operations. This
24212 switch reduces code size and improves performance in case the
24213 destination is already aligned, but GCC doesn't know about it.
24214
24215 -minline-all-stringops
24216 By default GCC inlines string operations only when the destination
24217 is known to be aligned to least a 4-byte boundary. This enables
24218 more inlining and increases code size, but may improve performance
24219 of code that depends on fast "memcpy", "strlen", and "memset" for
24220 short lengths.
24221
24222 -minline-stringops-dynamically
24223 For string operations of unknown size, use run-time checks with
24224 inline code for small blocks and a library call for large blocks.
24225
24226 -mstringop-strategy=alg
24227 Override the internal decision heuristic for the particular
24228 algorithm to use for inlining string operations. The allowed
24229 values for alg are:
24230
24231 rep_byte
24232 rep_4byte
24233 rep_8byte
24234 Expand using i386 "rep" prefix of the specified size.
24235
24236 byte_loop
24237 loop
24238 unrolled_loop
24239 Expand into an inline loop.
24240
24241 libcall
24242 Always use a library call.
24243
24244 -mmemcpy-strategy=strategy
24245 Override the internal decision heuristic to decide if
24246 "__builtin_memcpy" should be inlined and what inline algorithm to
24247 use when the expected size of the copy operation is known. strategy
24248 is a comma-separated list of alg:max_size:dest_align triplets. alg
24249 is specified in -mstringop-strategy, max_size specifies the max
24250 byte size with which inline algorithm alg is allowed. For the last
24251 triplet, the max_size must be "-1". The max_size of the triplets in
24252 the list must be specified in increasing order. The minimal byte
24253 size for alg is 0 for the first triplet and "max_size + 1" of the
24254 preceding range.
24255
24256 -mmemset-strategy=strategy
24257 The option is similar to -mmemcpy-strategy= except that it is to
24258 control "__builtin_memset" expansion.
24259
24260 -momit-leaf-frame-pointer
24261 Don't keep the frame pointer in a register for leaf functions.
24262 This avoids the instructions to save, set up, and restore frame
24263 pointers and makes an extra register available in leaf functions.
24264 The option -fomit-leaf-frame-pointer removes the frame pointer for
24265 leaf functions, which might make debugging harder.
24266
24267 -mtls-direct-seg-refs
24268 -mno-tls-direct-seg-refs
24269 Controls whether TLS variables may be accessed with offsets from
24270 the TLS segment register (%gs for 32-bit, %fs for 64-bit), or
24271 whether the thread base pointer must be added. Whether or not this
24272 is valid depends on the operating system, and whether it maps the
24273 segment to cover the entire TLS area.
24274
24275 For systems that use the GNU C Library, the default is on.
24276
24277 -msse2avx
24278 -mno-sse2avx
24279 Specify that the assembler should encode SSE instructions with VEX
24280 prefix. The option -mavx turns this on by default.
24281
24282 -mfentry
24283 -mno-fentry
24284 If profiling is active (-pg), put the profiling counter call before
24285 the prologue. Note: On x86 architectures the attribute
24286 "ms_hook_prologue" isn't possible at the moment for -mfentry and
24287 -pg.
24288
24289 -mrecord-mcount
24290 -mno-record-mcount
24291 If profiling is active (-pg), generate a __mcount_loc section that
24292 contains pointers to each profiling call. This is useful for
24293 automatically patching and out calls.
24294
24295 -mnop-mcount
24296 -mno-nop-mcount
24297 If profiling is active (-pg), generate the calls to the profiling
24298 functions as NOPs. This is useful when they should be patched in
24299 later dynamically. This is likely only useful together with
24300 -mrecord-mcount.
24301
24302 -minstrument-return=type
24303 Instrument function exit in -pg -mfentry instrumented functions
24304 with call to specified function. This only instruments true returns
24305 ending with ret, but not sibling calls ending with jump. Valid
24306 types are none to not instrument, call to generate a call to
24307 __return__, or nop5 to generate a 5 byte nop.
24308
24309 -mrecord-return
24310 -mno-record-return
24311 Generate a __return_loc section pointing to all return
24312 instrumentation code.
24313
24314 -mfentry-name=name
24315 Set name of __fentry__ symbol called at function entry for -pg
24316 -mfentry functions.
24317
24318 -mfentry-section=name
24319 Set name of section to record -mrecord-mcount calls (default
24320 __mcount_loc).
24321
24322 -mskip-rax-setup
24323 -mno-skip-rax-setup
24324 When generating code for the x86-64 architecture with SSE
24325 extensions disabled, -mskip-rax-setup can be used to skip setting
24326 up RAX register when there are no variable arguments passed in
24327 vector registers.
24328
24329 Warning: Since RAX register is used to avoid unnecessarily saving
24330 vector registers on stack when passing variable arguments, the
24331 impacts of this option are callees may waste some stack space,
24332 misbehave or jump to a random location. GCC 4.4 or newer don't
24333 have those issues, regardless the RAX register value.
24334
24335 -m8bit-idiv
24336 -mno-8bit-idiv
24337 On some processors, like Intel Atom, 8-bit unsigned integer divide
24338 is much faster than 32-bit/64-bit integer divide. This option
24339 generates a run-time check. If both dividend and divisor are
24340 within range of 0 to 255, 8-bit unsigned integer divide is used
24341 instead of 32-bit/64-bit integer divide.
24342
24343 -mavx256-split-unaligned-load
24344 -mavx256-split-unaligned-store
24345 Split 32-byte AVX unaligned load and store.
24346
24347 -mstack-protector-guard=guard
24348 -mstack-protector-guard-reg=reg
24349 -mstack-protector-guard-offset=offset
24350 Generate stack protection code using canary at guard. Supported
24351 locations are global for global canary or tls for per-thread canary
24352 in the TLS block (the default). This option has effect only when
24353 -fstack-protector or -fstack-protector-all is specified.
24354
24355 With the latter choice the options -mstack-protector-guard-reg=reg
24356 and -mstack-protector-guard-offset=offset furthermore specify which
24357 segment register (%fs or %gs) to use as base register for reading
24358 the canary, and from what offset from that base register. The
24359 default for those is as specified in the relevant ABI.
24360
24361 -mgeneral-regs-only
24362 Generate code that uses only the general-purpose registers. This
24363 prevents the compiler from using floating-point, vector, mask and
24364 bound registers.
24365
24366 -mindirect-branch=choice
24367 Convert indirect call and jump with choice. The default is keep,
24368 which keeps indirect call and jump unmodified. thunk converts
24369 indirect call and jump to call and return thunk. thunk-inline
24370 converts indirect call and jump to inlined call and return thunk.
24371 thunk-extern converts indirect call and jump to external call and
24372 return thunk provided in a separate object file. You can control
24373 this behavior for a specific function by using the function
24374 attribute "indirect_branch".
24375
24376 Note that -mcmodel=large is incompatible with
24377 -mindirect-branch=thunk and -mindirect-branch=thunk-extern since
24378 the thunk function may not be reachable in the large code model.
24379
24380 Note that -mindirect-branch=thunk-extern is incompatible with
24381 -fcf-protection=branch since the external thunk cannot be modified
24382 to disable control-flow check.
24383
24384 -mfunction-return=choice
24385 Convert function return with choice. The default is keep, which
24386 keeps function return unmodified. thunk converts function return
24387 to call and return thunk. thunk-inline converts function return to
24388 inlined call and return thunk. thunk-extern converts function
24389 return to external call and return thunk provided in a separate
24390 object file. You can control this behavior for a specific function
24391 by using the function attribute "function_return".
24392
24393 Note that -mcmodel=large is incompatible with
24394 -mfunction-return=thunk and -mfunction-return=thunk-extern since
24395 the thunk function may not be reachable in the large code model.
24396
24397 -mindirect-branch-register
24398 Force indirect call and jump via register.
24399
24400 These -m switches are supported in addition to the above on x86-64
24401 processors in 64-bit environments.
24402
24403 -m32
24404 -m64
24405 -mx32
24406 -m16
24407 -miamcu
24408 Generate code for a 16-bit, 32-bit or 64-bit environment. The -m32
24409 option sets "int", "long", and pointer types to 32 bits, and
24410 generates code that runs on any i386 system.
24411
24412 The -m64 option sets "int" to 32 bits and "long" and pointer types
24413 to 64 bits, and generates code for the x86-64 architecture. For
24414 Darwin only the -m64 option also turns off the -fno-pic and
24415 -mdynamic-no-pic options.
24416
24417 The -mx32 option sets "int", "long", and pointer types to 32 bits,
24418 and generates code for the x86-64 architecture.
24419
24420 The -m16 option is the same as -m32, except for that it outputs the
24421 ".code16gcc" assembly directive at the beginning of the assembly
24422 output so that the binary can run in 16-bit mode.
24423
24424 The -miamcu option generates code which conforms to Intel MCU
24425 psABI. It requires the -m32 option to be turned on.
24426
24427 -mno-red-zone
24428 Do not use a so-called "red zone" for x86-64 code. The red zone is
24429 mandated by the x86-64 ABI; it is a 128-byte area beyond the
24430 location of the stack pointer that is not modified by signal or
24431 interrupt handlers and therefore can be used for temporary data
24432 without adjusting the stack pointer. The flag -mno-red-zone
24433 disables this red zone.
24434
24435 -mcmodel=small
24436 Generate code for the small code model: the program and its symbols
24437 must be linked in the lower 2 GB of the address space. Pointers
24438 are 64 bits. Programs can be statically or dynamically linked.
24439 This is the default code model.
24440
24441 -mcmodel=kernel
24442 Generate code for the kernel code model. The kernel runs in the
24443 negative 2 GB of the address space. This model has to be used for
24444 Linux kernel code.
24445
24446 -mcmodel=medium
24447 Generate code for the medium model: the program is linked in the
24448 lower 2 GB of the address space. Small symbols are also placed
24449 there. Symbols with sizes larger than -mlarge-data-threshold are
24450 put into large data or BSS sections and can be located above 2GB.
24451 Programs can be statically or dynamically linked.
24452
24453 -mcmodel=large
24454 Generate code for the large model. This model makes no assumptions
24455 about addresses and sizes of sections.
24456
24457 -maddress-mode=long
24458 Generate code for long address mode. This is only supported for
24459 64-bit and x32 environments. It is the default address mode for
24460 64-bit environments.
24461
24462 -maddress-mode=short
24463 Generate code for short address mode. This is only supported for
24464 32-bit and x32 environments. It is the default address mode for
24465 32-bit and x32 environments.
24466
24467 x86 Windows Options
24468 These additional options are available for Microsoft Windows targets:
24469
24470 -mconsole
24471 This option specifies that a console application is to be
24472 generated, by instructing the linker to set the PE header subsystem
24473 type required for console applications. This option is available
24474 for Cygwin and MinGW targets and is enabled by default on those
24475 targets.
24476
24477 -mdll
24478 This option is available for Cygwin and MinGW targets. It
24479 specifies that a DLL---a dynamic link library---is to be generated,
24480 enabling the selection of the required runtime startup object and
24481 entry point.
24482
24483 -mnop-fun-dllimport
24484 This option is available for Cygwin and MinGW targets. It
24485 specifies that the "dllimport" attribute should be ignored.
24486
24487 -mthread
24488 This option is available for MinGW targets. It specifies that
24489 MinGW-specific thread support is to be used.
24490
24491 -municode
24492 This option is available for MinGW-w64 targets. It causes the
24493 "UNICODE" preprocessor macro to be predefined, and chooses Unicode-
24494 capable runtime startup code.
24495
24496 -mwin32
24497 This option is available for Cygwin and MinGW targets. It
24498 specifies that the typical Microsoft Windows predefined macros are
24499 to be set in the pre-processor, but does not influence the choice
24500 of runtime library/startup code.
24501
24502 -mwindows
24503 This option is available for Cygwin and MinGW targets. It
24504 specifies that a GUI application is to be generated by instructing
24505 the linker to set the PE header subsystem type appropriately.
24506
24507 -fno-set-stack-executable
24508 This option is available for MinGW targets. It specifies that the
24509 executable flag for the stack used by nested functions isn't set.
24510 This is necessary for binaries running in kernel mode of Microsoft
24511 Windows, as there the User32 API, which is used to set executable
24512 privileges, isn't available.
24513
24514 -fwritable-relocated-rdata
24515 This option is available for MinGW and Cygwin targets. It
24516 specifies that relocated-data in read-only section is put into the
24517 ".data" section. This is a necessary for older runtimes not
24518 supporting modification of ".rdata" sections for pseudo-relocation.
24519
24520 -mpe-aligned-commons
24521 This option is available for Cygwin and MinGW targets. It
24522 specifies that the GNU extension to the PE file format that permits
24523 the correct alignment of COMMON variables should be used when
24524 generating code. It is enabled by default if GCC detects that the
24525 target assembler found during configuration supports the feature.
24526
24527 See also under x86 Options for standard options.
24528
24529 Xstormy16 Options
24530 These options are defined for Xstormy16:
24531
24532 -msim
24533 Choose startup files and linker script suitable for the simulator.
24534
24535 Xtensa Options
24536 These options are supported for Xtensa targets:
24537
24538 -mconst16
24539 -mno-const16
24540 Enable or disable use of "CONST16" instructions for loading
24541 constant values. The "CONST16" instruction is currently not a
24542 standard option from Tensilica. When enabled, "CONST16"
24543 instructions are always used in place of the standard "L32R"
24544 instructions. The use of "CONST16" is enabled by default only if
24545 the "L32R" instruction is not available.
24546
24547 -mfused-madd
24548 -mno-fused-madd
24549 Enable or disable use of fused multiply/add and multiply/subtract
24550 instructions in the floating-point option. This has no effect if
24551 the floating-point option is not also enabled. Disabling fused
24552 multiply/add and multiply/subtract instructions forces the compiler
24553 to use separate instructions for the multiply and add/subtract
24554 operations. This may be desirable in some cases where strict IEEE
24555 754-compliant results are required: the fused multiply add/subtract
24556 instructions do not round the intermediate result, thereby
24557 producing results with more bits of precision than specified by the
24558 IEEE standard. Disabling fused multiply add/subtract instructions
24559 also ensures that the program output is not sensitive to the
24560 compiler's ability to combine multiply and add/subtract operations.
24561
24562 -mserialize-volatile
24563 -mno-serialize-volatile
24564 When this option is enabled, GCC inserts "MEMW" instructions before
24565 "volatile" memory references to guarantee sequential consistency.
24566 The default is -mserialize-volatile. Use -mno-serialize-volatile
24567 to omit the "MEMW" instructions.
24568
24569 -mforce-no-pic
24570 For targets, like GNU/Linux, where all user-mode Xtensa code must
24571 be position-independent code (PIC), this option disables PIC for
24572 compiling kernel code.
24573
24574 -mtext-section-literals
24575 -mno-text-section-literals
24576 These options control the treatment of literal pools. The default
24577 is -mno-text-section-literals, which places literals in a separate
24578 section in the output file. This allows the literal pool to be
24579 placed in a data RAM/ROM, and it also allows the linker to combine
24580 literal pools from separate object files to remove redundant
24581 literals and improve code size. With -mtext-section-literals, the
24582 literals are interspersed in the text section in order to keep them
24583 as close as possible to their references. This may be necessary
24584 for large assembly files. Literals for each function are placed
24585 right before that function.
24586
24587 -mauto-litpools
24588 -mno-auto-litpools
24589 These options control the treatment of literal pools. The default
24590 is -mno-auto-litpools, which places literals in a separate section
24591 in the output file unless -mtext-section-literals is used. With
24592 -mauto-litpools the literals are interspersed in the text section
24593 by the assembler. Compiler does not produce explicit ".literal"
24594 directives and loads literals into registers with "MOVI"
24595 instructions instead of "L32R" to let the assembler do relaxation
24596 and place literals as necessary. This option allows assembler to
24597 create several literal pools per function and assemble very big
24598 functions, which may not be possible with -mtext-section-literals.
24599
24600 -mtarget-align
24601 -mno-target-align
24602 When this option is enabled, GCC instructs the assembler to
24603 automatically align instructions to reduce branch penalties at the
24604 expense of some code density. The assembler attempts to widen
24605 density instructions to align branch targets and the instructions
24606 following call instructions. If there are not enough preceding
24607 safe density instructions to align a target, no widening is
24608 performed. The default is -mtarget-align. These options do not
24609 affect the treatment of auto-aligned instructions like "LOOP",
24610 which the assembler always aligns, either by widening density
24611 instructions or by inserting NOP instructions.
24612
24613 -mlongcalls
24614 -mno-longcalls
24615 When this option is enabled, GCC instructs the assembler to
24616 translate direct calls to indirect calls unless it can determine
24617 that the target of a direct call is in the range allowed by the
24618 call instruction. This translation typically occurs for calls to
24619 functions in other source files. Specifically, the assembler
24620 translates a direct "CALL" instruction into an "L32R" followed by a
24621 "CALLX" instruction. The default is -mno-longcalls. This option
24622 should be used in programs where the call target can potentially be
24623 out of range. This option is implemented in the assembler, not the
24624 compiler, so the assembly code generated by GCC still shows direct
24625 call instructions---look at the disassembled object code to see the
24626 actual instructions. Note that the assembler uses an indirect call
24627 for every cross-file call, not just those that really are out of
24628 range.
24629
24630 zSeries Options
24631 These are listed under
24632
24634 This section describes several environment variables that affect how
24635 GCC operates. Some of them work by specifying directories or prefixes
24636 to use when searching for various kinds of files. Some are used to
24637 specify other aspects of the compilation environment.
24638
24639 Note that you can also specify places to search using options such as
24640 -B, -I and -L. These take precedence over places specified using
24641 environment variables, which in turn take precedence over those
24642 specified by the configuration of GCC.
24643
24644 LANG
24645 LC_CTYPE
24646 LC_MESSAGES
24647 LC_ALL
24648 These environment variables control the way that GCC uses
24649 localization information which allows GCC to work with different
24650 national conventions. GCC inspects the locale categories LC_CTYPE
24651 and LC_MESSAGES if it has been configured to do so. These locale
24652 categories can be set to any value supported by your installation.
24653 A typical value is en_GB.UTF-8 for English in the United Kingdom
24654 encoded in UTF-8.
24655
24656 The LC_CTYPE environment variable specifies character
24657 classification. GCC uses it to determine the character boundaries
24658 in a string; this is needed for some multibyte encodings that
24659 contain quote and escape characters that are otherwise interpreted
24660 as a string end or escape.
24661
24662 The LC_MESSAGES environment variable specifies the language to use
24663 in diagnostic messages.
24664
24665 If the LC_ALL environment variable is set, it overrides the value
24666 of LC_CTYPE and LC_MESSAGES; otherwise, LC_CTYPE and LC_MESSAGES
24667 default to the value of the LANG environment variable. If none of
24668 these variables are set, GCC defaults to traditional C English
24669 behavior.
24670
24671 TMPDIR
24672 If TMPDIR is set, it specifies the directory to use for temporary
24673 files. GCC uses temporary files to hold the output of one stage of
24674 compilation which is to be used as input to the next stage: for
24675 example, the output of the preprocessor, which is the input to the
24676 compiler proper.
24677
24678 GCC_COMPARE_DEBUG
24679 Setting GCC_COMPARE_DEBUG is nearly equivalent to passing
24680 -fcompare-debug to the compiler driver. See the documentation of
24681 this option for more details.
24682
24683 GCC_EXEC_PREFIX
24684 If GCC_EXEC_PREFIX is set, it specifies a prefix to use in the
24685 names of the subprograms executed by the compiler. No slash is
24686 added when this prefix is combined with the name of a subprogram,
24687 but you can specify a prefix that ends with a slash if you wish.
24688
24689 If GCC_EXEC_PREFIX is not set, GCC attempts to figure out an
24690 appropriate prefix to use based on the pathname it is invoked with.
24691
24692 If GCC cannot find the subprogram using the specified prefix, it
24693 tries looking in the usual places for the subprogram.
24694
24695 The default value of GCC_EXEC_PREFIX is prefix/lib/gcc/ where
24696 prefix is the prefix to the installed compiler. In many cases
24697 prefix is the value of "prefix" when you ran the configure script.
24698
24699 Other prefixes specified with -B take precedence over this prefix.
24700
24701 This prefix is also used for finding files such as crt0.o that are
24702 used for linking.
24703
24704 In addition, the prefix is used in an unusual way in finding the
24705 directories to search for header files. For each of the standard
24706 directories whose name normally begins with /usr/local/lib/gcc
24707 (more precisely, with the value of GCC_INCLUDE_DIR), GCC tries
24708 replacing that beginning with the specified prefix to produce an
24709 alternate directory name. Thus, with -Bfoo/, GCC searches foo/bar
24710 just before it searches the standard directory /usr/local/lib/bar.
24711 If a standard directory begins with the configured prefix then the
24712 value of prefix is replaced by GCC_EXEC_PREFIX when looking for
24713 header files.
24714
24715 COMPILER_PATH
24716 The value of COMPILER_PATH is a colon-separated list of
24717 directories, much like PATH. GCC tries the directories thus
24718 specified when searching for subprograms, if it cannot find the
24719 subprograms using GCC_EXEC_PREFIX.
24720
24721 LIBRARY_PATH
24722 The value of LIBRARY_PATH is a colon-separated list of directories,
24723 much like PATH. When configured as a native compiler, GCC tries
24724 the directories thus specified when searching for special linker
24725 files, if it cannot find them using GCC_EXEC_PREFIX. Linking using
24726 GCC also uses these directories when searching for ordinary
24727 libraries for the -l option (but directories specified with -L come
24728 first).
24729
24730 LANG
24731 This variable is used to pass locale information to the compiler.
24732 One way in which this information is used is to determine the
24733 character set to be used when character literals, string literals
24734 and comments are parsed in C and C++. When the compiler is
24735 configured to allow multibyte characters, the following values for
24736 LANG are recognized:
24737
24738 C-JIS
24739 Recognize JIS characters.
24740
24741 C-SJIS
24742 Recognize SJIS characters.
24743
24744 C-EUCJP
24745 Recognize EUCJP characters.
24746
24747 If LANG is not defined, or if it has some other value, then the
24748 compiler uses "mblen" and "mbtowc" as defined by the default locale
24749 to recognize and translate multibyte characters.
24750
24751 Some additional environment variables affect the behavior of the
24752 preprocessor.
24753
24754 CPATH
24755 C_INCLUDE_PATH
24756 CPLUS_INCLUDE_PATH
24757 OBJC_INCLUDE_PATH
24758 Each variable's value is a list of directories separated by a
24759 special character, much like PATH, in which to look for header
24760 files. The special character, "PATH_SEPARATOR", is target-
24761 dependent and determined at GCC build time. For Microsoft Windows-
24762 based targets it is a semicolon, and for almost all other targets
24763 it is a colon.
24764
24765 CPATH specifies a list of directories to be searched as if
24766 specified with -I, but after any paths given with -I options on the
24767 command line. This environment variable is used regardless of
24768 which language is being preprocessed.
24769
24770 The remaining environment variables apply only when preprocessing
24771 the particular language indicated. Each specifies a list of
24772 directories to be searched as if specified with -isystem, but after
24773 any paths given with -isystem options on the command line.
24774
24775 In all these variables, an empty element instructs the compiler to
24776 search its current working directory. Empty elements can appear at
24777 the beginning or end of a path. For instance, if the value of
24778 CPATH is ":/special/include", that has the same effect as
24779 -I. -I/special/include.
24780
24781 DEPENDENCIES_OUTPUT
24782 If this variable is set, its value specifies how to output
24783 dependencies for Make based on the non-system header files
24784 processed by the compiler. System header files are ignored in the
24785 dependency output.
24786
24787 The value of DEPENDENCIES_OUTPUT can be just a file name, in which
24788 case the Make rules are written to that file, guessing the target
24789 name from the source file name. Or the value can have the form
24790 file target, in which case the rules are written to file file using
24791 target as the target name.
24792
24793 In other words, this environment variable is equivalent to
24794 combining the options -MM and -MF, with an optional -MT switch too.
24795
24796 SUNPRO_DEPENDENCIES
24797 This variable is the same as DEPENDENCIES_OUTPUT (see above),
24798 except that system header files are not ignored, so it implies -M
24799 rather than -MM. However, the dependence on the main input file is
24800 omitted.
24801
24802 SOURCE_DATE_EPOCH
24803 If this variable is set, its value specifies a UNIX timestamp to be
24804 used in replacement of the current date and time in the "__DATE__"
24805 and "__TIME__" macros, so that the embedded timestamps become
24806 reproducible.
24807
24808 The value of SOURCE_DATE_EPOCH must be a UNIX timestamp, defined as
24809 the number of seconds (excluding leap seconds) since 01 Jan 1970
24810 00:00:00 represented in ASCII; identical to the output of
24811 @command{date +%s} on GNU/Linux and other systems that support the
24812 %s extension in the "date" command.
24813
24814 The value should be a known timestamp such as the last modification
24815 time of the source or package and it should be set by the build
24816 process.
24817
24819 For instructions on reporting bugs, see
24820 <http://bugzilla.redhat.com/bugzilla>.
24821
24823 1. On some systems, gcc -shared needs to build supplementary stub code
24824 for constructors to work. On multi-libbed systems, gcc -shared
24825 must select the correct support libraries to link against. Failing
24826 to supply the correct flags may lead to subtle defects. Supplying
24827 them in cases where they are not necessary is innocuous.
24828
24830 gpl(7), gfdl(7), fsf-funding(7), cpp(1), gcov(1), as(1), ld(1), gdb(1),
24831 dbx(1) and the Info entries for gcc, cpp, as, ld, binutils and gdb.
24832
24834 See the Info entry for gcc, or
24835 <http://gcc.gnu.org/onlinedocs/gcc/Contributors.html>, for contributors
24836 to GCC.
24837
24839 Copyright (c) 1988-2019 Free Software Foundation, Inc.
24840
24841 Permission is granted to copy, distribute and/or modify this document
24842 under the terms of the GNU Free Documentation License, Version 1.3 or
24843 any later version published by the Free Software Foundation; with the
24844 Invariant Sections being "GNU General Public License" and "Funding Free
24845 Software", the Front-Cover texts being (a) (see below), and with the
24846 Back-Cover Texts being (b) (see below). A copy of the license is
24847 included in the gfdl(7) man page.
24848
24849 (a) The FSF's Front-Cover Text is:
24850
24851 A GNU Manual
24852
24853 (b) The FSF's Back-Cover Text is:
24854
24855 You have freedom to copy and modify this GNU Manual, like GNU
24856 software. Copies published by the Free Software Foundation raise
24857 funds for GNU development.
24858
24859
24860
24861gcc-9 2019-08-27 GCC(1)