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 Program Instrumentation Options
10236 GCC supports a number of command-line options that control adding run-
10237 time instrumentation to the code it normally generates. For example,
10238 one purpose of instrumentation is collect profiling statistics for use
10239 in finding program hot spots, code coverage analysis, or profile-guided
10240 optimizations. Another class of program instrumentation is adding run-
10241 time checking to detect programming errors like invalid pointer
10242 dereferences or out-of-bounds array accesses, as well as deliberately
10243 hostile attacks such as stack smashing or C++ vtable hijacking. There
10244 is also a general hook which can be used to implement other forms of
10245 tracing or function-level instrumentation for debug or program analysis
10246 purposes.
10247
10248 -p
10249 -pg Generate extra code to write profile information suitable for the
10250 analysis program prof (for -p) or gprof (for -pg). You must use
10251 this option when compiling the source files you want data about,
10252 and you must also use it when linking.
10253
10254 You can use the function attribute "no_instrument_function" to
10255 suppress profiling of individual functions when compiling with
10256 these options.
10257
10258 -fprofile-arcs
10259 Add code so that program flow arcs are instrumented. During
10260 execution the program records how many times each branch and call
10261 is executed and how many times it is taken or returns. On targets
10262 that support constructors with priority support, profiling properly
10263 handles constructors, destructors and C++ constructors (and
10264 destructors) of classes which are used as a type of a global
10265 variable.
10266
10267 When the compiled program exits it saves this data to a file called
10268 auxname.gcda for each source file. The data may be used for
10269 profile-directed optimizations (-fbranch-probabilities), or for
10270 test coverage analysis (-ftest-coverage). Each object file's
10271 auxname is generated from the name of the output file, if
10272 explicitly specified and it is not the final executable, otherwise
10273 it is the basename of the source file. In both cases any suffix is
10274 removed (e.g. foo.gcda for input file dir/foo.c, or dir/foo.gcda
10275 for output file specified as -o dir/foo.o).
10276
10277 --coverage
10278 This option is used to compile and link code instrumented for
10279 coverage analysis. The option is a synonym for -fprofile-arcs
10280 -ftest-coverage (when compiling) and -lgcov (when linking). See
10281 the documentation for those options for more details.
10282
10283 * Compile the source files with -fprofile-arcs plus optimization
10284 and code generation options. For test coverage analysis, use
10285 the additional -ftest-coverage option. You do not need to
10286 profile every source file in a program.
10287
10288 * Compile the source files additionally with -fprofile-abs-path
10289 to create absolute path names in the .gcno files. This allows
10290 gcov to find the correct sources in projects where compilations
10291 occur with different working directories.
10292
10293 * Link your object files with -lgcov or -fprofile-arcs (the
10294 latter implies the former).
10295
10296 * Run the program on a representative workload to generate the
10297 arc profile information. This may be repeated any number of
10298 times. You can run concurrent instances of your program, and
10299 provided that the file system supports locking, the data files
10300 will be correctly updated. Unless a strict ISO C dialect
10301 option is in effect, "fork" calls are detected and correctly
10302 handled without double counting.
10303
10304 * For profile-directed optimizations, compile the source files
10305 again with the same optimization and code generation options
10306 plus -fbranch-probabilities.
10307
10308 * For test coverage analysis, use gcov to produce human readable
10309 information from the .gcno and .gcda files. Refer to the gcov
10310 documentation for further information.
10311
10312 With -fprofile-arcs, for each function of your program GCC creates
10313 a program flow graph, then finds a spanning tree for the graph.
10314 Only arcs that are not on the spanning tree have to be
10315 instrumented: the compiler adds code to count the number of times
10316 that these arcs are executed. When an arc is the only exit or only
10317 entrance to a block, the instrumentation code can be added to the
10318 block; otherwise, a new basic block must be created to hold the
10319 instrumentation code.
10320
10321 -ftest-coverage
10322 Produce a notes file that the gcov code-coverage utility can use to
10323 show program coverage. Each source file's note file is called
10324 auxname.gcno. Refer to the -fprofile-arcs option above for a
10325 description of auxname and instructions on how to generate test
10326 coverage data. Coverage data matches the source files more closely
10327 if you do not optimize.
10328
10329 -fprofile-abs-path
10330 Automatically convert relative source file names to absolute path
10331 names in the .gcno files. This allows gcov to find the correct
10332 sources in projects where compilations occur with different working
10333 directories.
10334
10335 -fprofile-dir=path
10336 Set the directory to search for the profile data files in to path.
10337 This option affects only the profile data generated by
10338 -fprofile-generate, -ftest-coverage, -fprofile-arcs and used by
10339 -fprofile-use and -fbranch-probabilities and its related options.
10340 Both absolute and relative paths can be used. By default, GCC uses
10341 the current directory as path, thus the profile data file appears
10342 in the same directory as the object file. In order to prevent the
10343 file name clashing, if the object file name is not an absolute
10344 path, we mangle the absolute path of the sourcename.gcda file and
10345 use it as the file name of a .gcda file.
10346
10347 When an executable is run in a massive parallel environment, it is
10348 recommended to save profile to different folders. That can be done
10349 with variables in path that are exported during run-time:
10350
10351 %p process ID.
10352
10353 %q{VAR}
10354 value of environment variable VAR
10355
10356 -fprofile-generate
10357 -fprofile-generate=path
10358 Enable options usually used for instrumenting application to
10359 produce profile useful for later recompilation with profile
10360 feedback based optimization. You must use -fprofile-generate both
10361 when compiling and when linking your program.
10362
10363 The following options are enabled: -fprofile-arcs,
10364 -fprofile-values, -finline-functions, and -fipa-bit-cp.
10365
10366 If path is specified, GCC looks at the path to find the profile
10367 feedback data files. See -fprofile-dir.
10368
10369 To optimize the program based on the collected profile information,
10370 use -fprofile-use.
10371
10372 -fprofile-update=method
10373 Alter the update method for an application instrumented for profile
10374 feedback based optimization. The method argument should be one of
10375 single, atomic or prefer-atomic. The first one is useful for
10376 single-threaded applications, while the second one prevents profile
10377 corruption by emitting thread-safe code.
10378
10379 Warning: When an application does not properly join all threads (or
10380 creates an detached thread), a profile file can be still corrupted.
10381
10382 Using prefer-atomic would be transformed either to atomic, when
10383 supported by a target, or to single otherwise. The GCC driver
10384 automatically selects prefer-atomic when -pthread is present in the
10385 command line.
10386
10387 -fprofile-filter-files=regex
10388 Instrument only functions from files where names match any regular
10389 expression (separated by a semi-colon).
10390
10391 For example, -fprofile-filter-files=main.c;module.*.c will
10392 instrument only main.c and all C files starting with 'module'.
10393
10394 -fprofile-exclude-files=regex
10395 Instrument only functions from files where names do not match all
10396 the regular expressions (separated by a semi-colon).
10397
10398 For example, -fprofile-exclude-files=/usr/* will prevent
10399 instrumentation of all files that are located in /usr/ folder.
10400
10401 -fsanitize=address
10402 Enable AddressSanitizer, a fast memory error detector. Memory
10403 access instructions are instrumented to detect out-of-bounds and
10404 use-after-free bugs. The option enables
10405 -fsanitize-address-use-after-scope. See
10406 <https://github.com/google/sanitizers/wiki/AddressSanitizer> for
10407 more details. The run-time behavior can be influenced using the
10408 ASAN_OPTIONS environment variable. When set to "help=1", the
10409 available options are shown at startup of the instrumented program.
10410 See
10411 <https://github.com/google/sanitizers/wiki/AddressSanitizerFlags#run-time-flags>
10412 for a list of supported options. The option cannot be combined
10413 with -fsanitize=thread.
10414
10415 -fsanitize=kernel-address
10416 Enable AddressSanitizer for Linux kernel. See
10417 <https://github.com/google/kasan/wiki> for more details.
10418
10419 -fsanitize=pointer-compare
10420 Instrument comparison operation (<, <=, >, >=) with pointer
10421 operands. The option must be combined with either
10422 -fsanitize=kernel-address or -fsanitize=address The option cannot
10423 be combined with -fsanitize=thread. Note: By default the check is
10424 disabled at run time. To enable it, add
10425 "detect_invalid_pointer_pairs=2" to the environment variable
10426 ASAN_OPTIONS. Using "detect_invalid_pointer_pairs=1" detects
10427 invalid operation only when both pointers are non-null.
10428
10429 -fsanitize=pointer-subtract
10430 Instrument subtraction with pointer operands. The option must be
10431 combined with either -fsanitize=kernel-address or
10432 -fsanitize=address The option cannot be combined with
10433 -fsanitize=thread. Note: By default the check is disabled at run
10434 time. To enable it, add "detect_invalid_pointer_pairs=2" to the
10435 environment variable ASAN_OPTIONS. Using
10436 "detect_invalid_pointer_pairs=1" detects invalid operation only
10437 when both pointers are non-null.
10438
10439 -fsanitize=thread
10440 Enable ThreadSanitizer, a fast data race detector. Memory access
10441 instructions are instrumented to detect data race bugs. See
10442 <https://github.com/google/sanitizers/wiki#threadsanitizer> for
10443 more details. The run-time behavior can be influenced using the
10444 TSAN_OPTIONS environment variable; see
10445 <https://github.com/google/sanitizers/wiki/ThreadSanitizerFlags>
10446 for a list of supported options. The option cannot be combined
10447 with -fsanitize=address, -fsanitize=leak.
10448
10449 Note that sanitized atomic builtins cannot throw exceptions when
10450 operating on invalid memory addresses with non-call exceptions
10451 (-fnon-call-exceptions).
10452
10453 -fsanitize=leak
10454 Enable LeakSanitizer, a memory leak detector. This option only
10455 matters for linking of executables and the executable is linked
10456 against a library that overrides "malloc" and other allocator
10457 functions. See
10458 <https://github.com/google/sanitizers/wiki/AddressSanitizerLeakSanitizer>
10459 for more details. The run-time behavior can be influenced using
10460 the LSAN_OPTIONS environment variable. The option cannot be
10461 combined with -fsanitize=thread.
10462
10463 -fsanitize=undefined
10464 Enable UndefinedBehaviorSanitizer, a fast undefined behavior
10465 detector. Various computations are instrumented to detect
10466 undefined behavior at runtime. Current suboptions are:
10467
10468 -fsanitize=shift
10469 This option enables checking that the result of a shift
10470 operation is not undefined. Note that what exactly is
10471 considered undefined differs slightly between C and C++, as
10472 well as between ISO C90 and C99, etc. This option has two
10473 suboptions, -fsanitize=shift-base and
10474 -fsanitize=shift-exponent.
10475
10476 -fsanitize=shift-exponent
10477 This option enables checking that the second argument of a
10478 shift operation is not negative and is smaller than the
10479 precision of the promoted first argument.
10480
10481 -fsanitize=shift-base
10482 If the second argument of a shift operation is within range,
10483 check that the result of a shift operation is not undefined.
10484 Note that what exactly is considered undefined differs slightly
10485 between C and C++, as well as between ISO C90 and C99, etc.
10486
10487 -fsanitize=integer-divide-by-zero
10488 Detect integer division by zero as well as "INT_MIN / -1"
10489 division.
10490
10491 -fsanitize=unreachable
10492 With this option, the compiler turns the
10493 "__builtin_unreachable" call into a diagnostics message call
10494 instead. When reaching the "__builtin_unreachable" call, the
10495 behavior is undefined.
10496
10497 -fsanitize=vla-bound
10498 This option instructs the compiler to check that the size of a
10499 variable length array is positive.
10500
10501 -fsanitize=null
10502 This option enables pointer checking. Particularly, the
10503 application built with this option turned on will issue an
10504 error message when it tries to dereference a NULL pointer, or
10505 if a reference (possibly an rvalue reference) is bound to a
10506 NULL pointer, or if a method is invoked on an object pointed by
10507 a NULL pointer.
10508
10509 -fsanitize=return
10510 This option enables return statement checking. Programs built
10511 with this option turned on will issue an error message when the
10512 end of a non-void function is reached without actually
10513 returning a value. This option works in C++ only.
10514
10515 -fsanitize=signed-integer-overflow
10516 This option enables signed integer overflow checking. We check
10517 that the result of "+", "*", and both unary and binary "-" does
10518 not overflow in the signed arithmetics. Note, integer
10519 promotion rules must be taken into account. That is, the
10520 following is not an overflow:
10521
10522 signed char a = SCHAR_MAX;
10523 a++;
10524
10525 -fsanitize=bounds
10526 This option enables instrumentation of array bounds. Various
10527 out of bounds accesses are detected. Flexible array members,
10528 flexible array member-like arrays, and initializers of
10529 variables with static storage are not instrumented.
10530
10531 -fsanitize=bounds-strict
10532 This option enables strict instrumentation of array bounds.
10533 Most out of bounds accesses are detected, including flexible
10534 array members and flexible array member-like arrays.
10535 Initializers of variables with static storage are not
10536 instrumented.
10537
10538 -fsanitize=alignment
10539 This option enables checking of alignment of pointers when they
10540 are dereferenced, or when a reference is bound to
10541 insufficiently aligned target, or when a method or constructor
10542 is invoked on insufficiently aligned object.
10543
10544 -fsanitize=object-size
10545 This option enables instrumentation of memory references using
10546 the "__builtin_object_size" function. Various out of bounds
10547 pointer accesses are detected.
10548
10549 -fsanitize=float-divide-by-zero
10550 Detect floating-point division by zero. Unlike other similar
10551 options, -fsanitize=float-divide-by-zero is not enabled by
10552 -fsanitize=undefined, since floating-point division by zero can
10553 be a legitimate way of obtaining infinities and NaNs.
10554
10555 -fsanitize=float-cast-overflow
10556 This option enables floating-point type to integer conversion
10557 checking. We check that the result of the conversion does not
10558 overflow. Unlike other similar options,
10559 -fsanitize=float-cast-overflow is not enabled by
10560 -fsanitize=undefined. This option does not work well with
10561 "FE_INVALID" exceptions enabled.
10562
10563 -fsanitize=nonnull-attribute
10564 This option enables instrumentation of calls, checking whether
10565 null values are not passed to arguments marked as requiring a
10566 non-null value by the "nonnull" function attribute.
10567
10568 -fsanitize=returns-nonnull-attribute
10569 This option enables instrumentation of return statements in
10570 functions marked with "returns_nonnull" function attribute, to
10571 detect returning of null values from such functions.
10572
10573 -fsanitize=bool
10574 This option enables instrumentation of loads from bool. If a
10575 value other than 0/1 is loaded, a run-time error is issued.
10576
10577 -fsanitize=enum
10578 This option enables instrumentation of loads from an enum type.
10579 If a value outside the range of values for the enum type is
10580 loaded, a run-time error is issued.
10581
10582 -fsanitize=vptr
10583 This option enables instrumentation of C++ member function
10584 calls, member accesses and some conversions between pointers to
10585 base and derived classes, to verify the referenced object has
10586 the correct dynamic type.
10587
10588 -fsanitize=pointer-overflow
10589 This option enables instrumentation of pointer arithmetics. If
10590 the pointer arithmetics overflows, a run-time error is issued.
10591
10592 -fsanitize=builtin
10593 This option enables instrumentation of arguments to selected
10594 builtin functions. If an invalid value is passed to such
10595 arguments, a run-time error is issued. E.g. passing 0 as the
10596 argument to "__builtin_ctz" or "__builtin_clz" invokes
10597 undefined behavior and is diagnosed by this option.
10598
10599 While -ftrapv causes traps for signed overflows to be emitted,
10600 -fsanitize=undefined gives a diagnostic message. This currently
10601 works only for the C family of languages.
10602
10603 -fno-sanitize=all
10604 This option disables all previously enabled sanitizers.
10605 -fsanitize=all is not allowed, as some sanitizers cannot be used
10606 together.
10607
10608 -fasan-shadow-offset=number
10609 This option forces GCC to use custom shadow offset in
10610 AddressSanitizer checks. It is useful for experimenting with
10611 different shadow memory layouts in Kernel AddressSanitizer.
10612
10613 -fsanitize-sections=s1,s2,...
10614 Sanitize global variables in selected user-defined sections. si
10615 may contain wildcards.
10616
10617 -fsanitize-recover[=opts]
10618 -fsanitize-recover= controls error recovery mode for sanitizers
10619 mentioned in comma-separated list of opts. Enabling this option
10620 for a sanitizer component causes it to attempt to continue running
10621 the program as if no error happened. This means multiple runtime
10622 errors can be reported in a single program run, and the exit code
10623 of the program may indicate success even when errors have been
10624 reported. The -fno-sanitize-recover= option can be used to alter
10625 this behavior: only the first detected error is reported and
10626 program then exits with a non-zero exit code.
10627
10628 Currently this feature only works for -fsanitize=undefined (and its
10629 suboptions except for -fsanitize=unreachable and
10630 -fsanitize=return), -fsanitize=float-cast-overflow,
10631 -fsanitize=float-divide-by-zero, -fsanitize=bounds-strict,
10632 -fsanitize=kernel-address and -fsanitize=address. For these
10633 sanitizers error recovery is turned on by default, except
10634 -fsanitize=address, for which this feature is experimental.
10635 -fsanitize-recover=all and -fno-sanitize-recover=all is also
10636 accepted, the former enables recovery for all sanitizers that
10637 support it, the latter disables recovery for all sanitizers that
10638 support it.
10639
10640 Even if a recovery mode is turned on the compiler side, it needs to
10641 be also enabled on the runtime library side, otherwise the failures
10642 are still fatal. The runtime library defaults to "halt_on_error=0"
10643 for ThreadSanitizer and UndefinedBehaviorSanitizer, while default
10644 value for AddressSanitizer is "halt_on_error=1". This can be
10645 overridden through setting the "halt_on_error" flag in the
10646 corresponding environment variable.
10647
10648 Syntax without an explicit opts parameter is deprecated. It is
10649 equivalent to specifying an opts list of:
10650
10651 undefined,float-cast-overflow,float-divide-by-zero,bounds-strict
10652
10653 -fsanitize-address-use-after-scope
10654 Enable sanitization of local variables to detect use-after-scope
10655 bugs. The option sets -fstack-reuse to none.
10656
10657 -fsanitize-undefined-trap-on-error
10658 The -fsanitize-undefined-trap-on-error option instructs the
10659 compiler to report undefined behavior using "__builtin_trap" rather
10660 than a "libubsan" library routine. The advantage of this is that
10661 the "libubsan" library is not needed and is not linked in, so this
10662 is usable even in freestanding environments.
10663
10664 -fsanitize-coverage=trace-pc
10665 Enable coverage-guided fuzzing code instrumentation. Inserts a
10666 call to "__sanitizer_cov_trace_pc" into every basic block.
10667
10668 -fsanitize-coverage=trace-cmp
10669 Enable dataflow guided fuzzing code instrumentation. Inserts a
10670 call to "__sanitizer_cov_trace_cmp1", "__sanitizer_cov_trace_cmp2",
10671 "__sanitizer_cov_trace_cmp4" or "__sanitizer_cov_trace_cmp8" for
10672 integral comparison with both operands variable or
10673 "__sanitizer_cov_trace_const_cmp1",
10674 "__sanitizer_cov_trace_const_cmp2",
10675 "__sanitizer_cov_trace_const_cmp4" or
10676 "__sanitizer_cov_trace_const_cmp8" for integral comparison with one
10677 operand constant, "__sanitizer_cov_trace_cmpf" or
10678 "__sanitizer_cov_trace_cmpd" for float or double comparisons and
10679 "__sanitizer_cov_trace_switch" for switch statements.
10680
10681 -fcf-protection=[full|branch|return|none]
10682 Enable code instrumentation of control-flow transfers to increase
10683 program security by checking that target addresses of control-flow
10684 transfer instructions (such as indirect function call, function
10685 return, indirect jump) are valid. This prevents diverting the flow
10686 of control to an unexpected target. This is intended to protect
10687 against such threats as Return-oriented Programming (ROP), and
10688 similarly call/jmp-oriented programming (COP/JOP).
10689
10690 The value "branch" tells the compiler to implement checking of
10691 validity of control-flow transfer at the point of indirect branch
10692 instructions, i.e. call/jmp instructions. The value "return"
10693 implements checking of validity at the point of returning from a
10694 function. The value "full" is an alias for specifying both
10695 "branch" and "return". The value "none" turns off instrumentation.
10696
10697 The macro "__CET__" is defined when -fcf-protection is used. The
10698 first bit of "__CET__" is set to 1 for the value "branch" and the
10699 second bit of "__CET__" is set to 1 for the "return".
10700
10701 You can also use the "nocf_check" attribute to identify which
10702 functions and calls should be skipped from instrumentation.
10703
10704 Currently the x86 GNU/Linux target provides an implementation based
10705 on Intel Control-flow Enforcement Technology (CET).
10706
10707 -fstack-protector
10708 Emit extra code to check for buffer overflows, such as stack
10709 smashing attacks. This is done by adding a guard variable to
10710 functions with vulnerable objects. This includes functions that
10711 call "alloca", and functions with buffers larger than 8 bytes. The
10712 guards are initialized when a function is entered and then checked
10713 when the function exits. If a guard check fails, an error message
10714 is printed and the program exits.
10715
10716 -fstack-protector-all
10717 Like -fstack-protector except that all functions are protected.
10718
10719 -fstack-protector-strong
10720 Like -fstack-protector but includes additional functions to be
10721 protected --- those that have local array definitions, or have
10722 references to local frame addresses.
10723
10724 -fstack-protector-explicit
10725 Like -fstack-protector but only protects those functions which have
10726 the "stack_protect" attribute.
10727
10728 -fstack-check
10729 Generate code to verify that you do not go beyond the boundary of
10730 the stack. You should specify this flag if you are running in an
10731 environment with multiple threads, but you only rarely need to
10732 specify it in a single-threaded environment since stack overflow is
10733 automatically detected on nearly all systems if there is only one
10734 stack.
10735
10736 Note that this switch does not actually cause checking to be done;
10737 the operating system or the language runtime must do that. The
10738 switch causes generation of code to ensure that they see the stack
10739 being extended.
10740
10741 You can additionally specify a string parameter: no means no
10742 checking, generic means force the use of old-style checking,
10743 specific means use the best checking method and is equivalent to
10744 bare -fstack-check.
10745
10746 Old-style checking is a generic mechanism that requires no specific
10747 target support in the compiler but comes with the following
10748 drawbacks:
10749
10750 1. Modified allocation strategy for large objects: they are always
10751 allocated dynamically if their size exceeds a fixed threshold.
10752 Note this may change the semantics of some code.
10753
10754 2. Fixed limit on the size of the static frame of functions: when
10755 it is topped by a particular function, stack checking is not
10756 reliable and a warning is issued by the compiler.
10757
10758 3. Inefficiency: because of both the modified allocation strategy
10759 and the generic implementation, code performance is hampered.
10760
10761 Note that old-style stack checking is also the fallback method for
10762 specific if no target support has been added in the compiler.
10763
10764 -fstack-check= is designed for Ada's needs to detect infinite
10765 recursion and stack overflows. specific is an excellent choice
10766 when compiling Ada code. It is not generally sufficient to protect
10767 against stack-clash attacks. To protect against those you want
10768 -fstack-clash-protection.
10769
10770 -fstack-clash-protection
10771 Generate code to prevent stack clash style attacks. When this
10772 option is enabled, the compiler will only allocate one page of
10773 stack space at a time and each page is accessed immediately after
10774 allocation. Thus, it prevents allocations from jumping over any
10775 stack guard page provided by the operating system.
10776
10777 Most targets do not fully support stack clash protection. However,
10778 on those targets -fstack-clash-protection will protect dynamic
10779 stack allocations. -fstack-clash-protection may also provide
10780 limited protection for static stack allocations if the target
10781 supports -fstack-check=specific.
10782
10783 -fstack-limit-register=reg
10784 -fstack-limit-symbol=sym
10785 -fno-stack-limit
10786 Generate code to ensure that the stack does not grow beyond a
10787 certain value, either the value of a register or the address of a
10788 symbol. If a larger stack is required, a signal is raised at run
10789 time. For most targets, the signal is raised before the stack
10790 overruns the boundary, so it is possible to catch the signal
10791 without taking special precautions.
10792
10793 For instance, if the stack starts at absolute address 0x80000000
10794 and grows downwards, you can use the flags
10795 -fstack-limit-symbol=__stack_limit and
10796 -Wl,--defsym,__stack_limit=0x7ffe0000 to enforce a stack limit of
10797 128KB. Note that this may only work with the GNU linker.
10798
10799 You can locally override stack limit checking by using the
10800 "no_stack_limit" function attribute.
10801
10802 -fsplit-stack
10803 Generate code to automatically split the stack before it overflows.
10804 The resulting program has a discontiguous stack which can only
10805 overflow if the program is unable to allocate any more memory.
10806 This is most useful when running threaded programs, as it is no
10807 longer necessary to calculate a good stack size to use for each
10808 thread. This is currently only implemented for the x86 targets
10809 running GNU/Linux.
10810
10811 When code compiled with -fsplit-stack calls code compiled without
10812 -fsplit-stack, there may not be much stack space available for the
10813 latter code to run. If compiling all code, including library code,
10814 with -fsplit-stack is not an option, then the linker can fix up
10815 these calls so that the code compiled without -fsplit-stack always
10816 has a large stack. Support for this is implemented in the gold
10817 linker in GNU binutils release 2.21 and later.
10818
10819 -fvtable-verify=[std|preinit|none]
10820 This option is only available when compiling C++ code. It turns on
10821 (or off, if using -fvtable-verify=none) the security feature that
10822 verifies at run time, for every virtual call, that the vtable
10823 pointer through which the call is made is valid for the type of the
10824 object, and has not been corrupted or overwritten. If an invalid
10825 vtable pointer is detected at run time, an error is reported and
10826 execution of the program is immediately halted.
10827
10828 This option causes run-time data structures to be built at program
10829 startup, which are used for verifying the vtable pointers. The
10830 options std and preinit control the timing of when these data
10831 structures are built. In both cases the data structures are built
10832 before execution reaches "main". Using -fvtable-verify=std causes
10833 the data structures to be built after shared libraries have been
10834 loaded and initialized. -fvtable-verify=preinit causes them to be
10835 built before shared libraries have been loaded and initialized.
10836
10837 If this option appears multiple times in the command line with
10838 different values specified, none takes highest priority over both
10839 std and preinit; preinit takes priority over std.
10840
10841 -fvtv-debug
10842 When used in conjunction with -fvtable-verify=std or
10843 -fvtable-verify=preinit, causes debug versions of the runtime
10844 functions for the vtable verification feature to be called. This
10845 flag also causes the compiler to log information about which vtable
10846 pointers it finds for each class. This information is written to a
10847 file named vtv_set_ptr_data.log in the directory named by the
10848 environment variable VTV_LOGS_DIR if that is defined or the current
10849 working directory otherwise.
10850
10851 Note: This feature appends data to the log file. If you want a
10852 fresh log file, be sure to delete any existing one.
10853
10854 -fvtv-counts
10855 This is a debugging flag. When used in conjunction with
10856 -fvtable-verify=std or -fvtable-verify=preinit, this causes the
10857 compiler to keep track of the total number of virtual calls it
10858 encounters and the number of verifications it inserts. It also
10859 counts the number of calls to certain run-time library functions
10860 that it inserts and logs this information for each compilation
10861 unit. The compiler writes this information to a file named
10862 vtv_count_data.log in the directory named by the environment
10863 variable VTV_LOGS_DIR if that is defined or the current working
10864 directory otherwise. It also counts the size of the vtable pointer
10865 sets for each class, and writes this information to
10866 vtv_class_set_sizes.log in the same directory.
10867
10868 Note: This feature appends data to the log files. To get fresh
10869 log files, be sure to delete any existing ones.
10870
10871 -finstrument-functions
10872 Generate instrumentation calls for entry and exit to functions.
10873 Just after function entry and just before function exit, the
10874 following profiling functions are called with the address of the
10875 current function and its call site. (On some platforms,
10876 "__builtin_return_address" does not work beyond the current
10877 function, so the call site information may not be available to the
10878 profiling functions otherwise.)
10879
10880 void __cyg_profile_func_enter (void *this_fn,
10881 void *call_site);
10882 void __cyg_profile_func_exit (void *this_fn,
10883 void *call_site);
10884
10885 The first argument is the address of the start of the current
10886 function, which may be looked up exactly in the symbol table.
10887
10888 This instrumentation is also done for functions expanded inline in
10889 other functions. The profiling calls indicate where, conceptually,
10890 the inline function is entered and exited. This means that
10891 addressable versions of such functions must be available. If all
10892 your uses of a function are expanded inline, this may mean an
10893 additional expansion of code size. If you use "extern inline" in
10894 your C code, an addressable version of such functions must be
10895 provided. (This is normally the case anyway, but if you get lucky
10896 and the optimizer always expands the functions inline, you might
10897 have gotten away without providing static copies.)
10898
10899 A function may be given the attribute "no_instrument_function", in
10900 which case this instrumentation is not done. This can be used, for
10901 example, for the profiling functions listed above, high-priority
10902 interrupt routines, and any functions from which the profiling
10903 functions cannot safely be called (perhaps signal handlers, if the
10904 profiling routines generate output or allocate memory).
10905
10906 -finstrument-functions-exclude-file-list=file,file,...
10907 Set the list of functions that are excluded from instrumentation
10908 (see the description of -finstrument-functions). If the file that
10909 contains a function definition matches with one of file, then that
10910 function is not instrumented. The match is done on substrings: if
10911 the file parameter is a substring of the file name, it is
10912 considered to be a match.
10913
10914 For example:
10915
10916 -finstrument-functions-exclude-file-list=/bits/stl,include/sys
10917
10918 excludes any inline function defined in files whose pathnames
10919 contain /bits/stl or include/sys.
10920
10921 If, for some reason, you want to include letter , in one of sym,
10922 write ,. For example,
10923 -finstrument-functions-exclude-file-list=',,tmp' (note the single
10924 quote surrounding the option).
10925
10926 -finstrument-functions-exclude-function-list=sym,sym,...
10927 This is similar to -finstrument-functions-exclude-file-list, but
10928 this option sets the list of function names to be excluded from
10929 instrumentation. The function name to be matched is its user-
10930 visible name, such as "vector<int> blah(const vector<int> &)", not
10931 the internal mangled name (e.g., "_Z4blahRSt6vectorIiSaIiEE"). The
10932 match is done on substrings: if the sym parameter is a substring of
10933 the function name, it is considered to be a match. For C99 and C++
10934 extended identifiers, the function name must be given in UTF-8, not
10935 using universal character names.
10936
10937 -fpatchable-function-entry=N[,M]
10938 Generate N NOPs right at the beginning of each function, with the
10939 function entry point before the Mth NOP. If M is omitted, it
10940 defaults to 0 so the function entry points to the address just at
10941 the first NOP. The NOP instructions reserve extra space which can
10942 be used to patch in any desired instrumentation at run time,
10943 provided that the code segment is writable. The amount of space is
10944 controllable indirectly via the number of NOPs; the NOP instruction
10945 used corresponds to the instruction emitted by the internal GCC
10946 back-end interface "gen_nop". This behavior is target-specific and
10947 may also depend on the architecture variant and/or other
10948 compilation options.
10949
10950 For run-time identification, the starting addresses of these areas,
10951 which correspond to their respective function entries minus M, are
10952 additionally collected in the "__patchable_function_entries"
10953 section of the resulting binary.
10954
10955 Note that the value of "__attribute__ ((patchable_function_entry
10956 (N,M)))" takes precedence over command-line option
10957 -fpatchable-function-entry=N,M. This can be used to increase the
10958 area size or to remove it completely on a single function. If
10959 "N=0", no pad location is recorded.
10960
10961 The NOP instructions are inserted at---and maybe before, depending
10962 on M---the function entry address, even before the prologue.
10963
10964 Options Controlling the Preprocessor
10965 These options control the C preprocessor, which is run on each C source
10966 file before actual compilation.
10967
10968 If you use the -E option, nothing is done except preprocessing. Some
10969 of these options make sense only together with -E because they cause
10970 the preprocessor output to be unsuitable for actual compilation.
10971
10972 In addition to the options listed here, there are a number of options
10973 to control search paths for include files documented in Directory
10974 Options. Options to control preprocessor diagnostics are listed in
10975 Warning Options.
10976
10977 -D name
10978 Predefine name as a macro, with definition 1.
10979
10980 -D name=definition
10981 The contents of definition are tokenized and processed as if they
10982 appeared during translation phase three in a #define directive. In
10983 particular, the definition is truncated by embedded newline
10984 characters.
10985
10986 If you are invoking the preprocessor from a shell or shell-like
10987 program you may need to use the shell's quoting syntax to protect
10988 characters such as spaces that have a meaning in the shell syntax.
10989
10990 If you wish to define a function-like macro on the command line,
10991 write its argument list with surrounding parentheses before the
10992 equals sign (if any). Parentheses are meaningful to most shells,
10993 so you should quote the option. With sh and csh,
10994 -D'name(args...)=definition' works.
10995
10996 -D and -U options are processed in the order they are given on the
10997 command line. All -imacros file and -include file options are
10998 processed after all -D and -U options.
10999
11000 -U name
11001 Cancel any previous definition of name, either built in or provided
11002 with a -D option.
11003
11004 -include file
11005 Process file as if "#include "file"" appeared as the first line of
11006 the primary source file. However, the first directory searched for
11007 file is the preprocessor's working directory instead of the
11008 directory containing the main source file. If not found there, it
11009 is searched for in the remainder of the "#include "..."" search
11010 chain as normal.
11011
11012 If multiple -include options are given, the files are included in
11013 the order they appear on the command line.
11014
11015 -imacros file
11016 Exactly like -include, except that any output produced by scanning
11017 file is thrown away. Macros it defines remain defined. This
11018 allows you to acquire all the macros from a header without also
11019 processing its declarations.
11020
11021 All files specified by -imacros are processed before all files
11022 specified by -include.
11023
11024 -undef
11025 Do not predefine any system-specific or GCC-specific macros. The
11026 standard predefined macros remain defined.
11027
11028 -pthread
11029 Define additional macros required for using the POSIX threads
11030 library. You should use this option consistently for both
11031 compilation and linking. This option is supported on GNU/Linux
11032 targets, most other Unix derivatives, and also on x86 Cygwin and
11033 MinGW targets.
11034
11035 -M Instead of outputting the result of preprocessing, output a rule
11036 suitable for make describing the dependencies of the main source
11037 file. The preprocessor outputs one make rule containing the object
11038 file name for that source file, a colon, and the names of all the
11039 included files, including those coming from -include or -imacros
11040 command-line options.
11041
11042 Unless specified explicitly (with -MT or -MQ), the object file name
11043 consists of the name of the source file with any suffix replaced
11044 with object file suffix and with any leading directory parts
11045 removed. If there are many included files then the rule is split
11046 into several lines using \-newline. The rule has no commands.
11047
11048 This option does not suppress the preprocessor's debug output, such
11049 as -dM. To avoid mixing such debug output with the dependency
11050 rules you should explicitly specify the dependency output file with
11051 -MF, or use an environment variable like DEPENDENCIES_OUTPUT.
11052 Debug output is still sent to the regular output stream as normal.
11053
11054 Passing -M to the driver implies -E, and suppresses warnings with
11055 an implicit -w.
11056
11057 -MM Like -M but do not mention header files that are found in system
11058 header directories, nor header files that are included, directly or
11059 indirectly, from such a header.
11060
11061 This implies that the choice of angle brackets or double quotes in
11062 an #include directive does not in itself determine whether that
11063 header appears in -MM dependency output.
11064
11065 -MF file
11066 When used with -M or -MM, specifies a file to write the
11067 dependencies to. If no -MF switch is given the preprocessor sends
11068 the rules to the same place it would send preprocessed output.
11069
11070 When used with the driver options -MD or -MMD, -MF overrides the
11071 default dependency output file.
11072
11073 If file is -, then the dependencies are written to stdout.
11074
11075 -MG In conjunction with an option such as -M requesting dependency
11076 generation, -MG assumes missing header files are generated files
11077 and adds them to the dependency list without raising an error. The
11078 dependency filename is taken directly from the "#include" directive
11079 without prepending any path. -MG also suppresses preprocessed
11080 output, as a missing header file renders this useless.
11081
11082 This feature is used in automatic updating of makefiles.
11083
11084 -MP This option instructs CPP to add a phony target for each dependency
11085 other than the main file, causing each to depend on nothing. These
11086 dummy rules work around errors make gives if you remove header
11087 files without updating the Makefile to match.
11088
11089 This is typical output:
11090
11091 test.o: test.c test.h
11092
11093 test.h:
11094
11095 -MT target
11096 Change the target of the rule emitted by dependency generation. By
11097 default CPP takes the name of the main input file, deletes any
11098 directory components and any file suffix such as .c, and appends
11099 the platform's usual object suffix. The result is the target.
11100
11101 An -MT option sets the target to be exactly the string you specify.
11102 If you want multiple targets, you can specify them as a single
11103 argument to -MT, or use multiple -MT options.
11104
11105 For example, -MT '$(objpfx)foo.o' might give
11106
11107 $(objpfx)foo.o: foo.c
11108
11109 -MQ target
11110 Same as -MT, but it quotes any characters which are special to
11111 Make. -MQ '$(objpfx)foo.o' gives
11112
11113 $$(objpfx)foo.o: foo.c
11114
11115 The default target is automatically quoted, as if it were given
11116 with -MQ.
11117
11118 -MD -MD is equivalent to -M -MF file, except that -E is not implied.
11119 The driver determines file based on whether an -o option is given.
11120 If it is, the driver uses its argument but with a suffix of .d,
11121 otherwise it takes the name of the input file, removes any
11122 directory components and suffix, and applies a .d suffix.
11123
11124 If -MD is used in conjunction with -E, any -o switch is understood
11125 to specify the dependency output file, but if used without -E, each
11126 -o is understood to specify a target object file.
11127
11128 Since -E is not implied, -MD can be used to generate a dependency
11129 output file as a side effect of the compilation process.
11130
11131 -MMD
11132 Like -MD except mention only user header files, not system header
11133 files.
11134
11135 -fpreprocessed
11136 Indicate to the preprocessor that the input file has already been
11137 preprocessed. This suppresses things like macro expansion,
11138 trigraph conversion, escaped newline splicing, and processing of
11139 most directives. The preprocessor still recognizes and removes
11140 comments, so that you can pass a file preprocessed with -C to the
11141 compiler without problems. In this mode the integrated
11142 preprocessor is little more than a tokenizer for the front ends.
11143
11144 -fpreprocessed is implicit if the input file has one of the
11145 extensions .i, .ii or .mi. These are the extensions that GCC uses
11146 for preprocessed files created by -save-temps.
11147
11148 -fdirectives-only
11149 When preprocessing, handle directives, but do not expand macros.
11150
11151 The option's behavior depends on the -E and -fpreprocessed options.
11152
11153 With -E, preprocessing is limited to the handling of directives
11154 such as "#define", "#ifdef", and "#error". Other preprocessor
11155 operations, such as macro expansion and trigraph conversion are not
11156 performed. In addition, the -dD option is implicitly enabled.
11157
11158 With -fpreprocessed, predefinition of command line and most builtin
11159 macros is disabled. Macros such as "__LINE__", which are
11160 contextually dependent, are handled normally. This enables
11161 compilation of files previously preprocessed with "-E
11162 -fdirectives-only".
11163
11164 With both -E and -fpreprocessed, the rules for -fpreprocessed take
11165 precedence. This enables full preprocessing of files previously
11166 preprocessed with "-E -fdirectives-only".
11167
11168 -fdollars-in-identifiers
11169 Accept $ in identifiers.
11170
11171 -fextended-identifiers
11172 Accept universal character names in identifiers. This option is
11173 enabled by default for C99 (and later C standard versions) and C++.
11174
11175 -fno-canonical-system-headers
11176 When preprocessing, do not shorten system header paths with
11177 canonicalization.
11178
11179 -ftabstop=width
11180 Set the distance between tab stops. This helps the preprocessor
11181 report correct column numbers in warnings or errors, even if tabs
11182 appear on the line. If the value is less than 1 or greater than
11183 100, the option is ignored. The default is 8.
11184
11185 -ftrack-macro-expansion[=level]
11186 Track locations of tokens across macro expansions. This allows the
11187 compiler to emit diagnostic about the current macro expansion stack
11188 when a compilation error occurs in a macro expansion. Using this
11189 option makes the preprocessor and the compiler consume more memory.
11190 The level parameter can be used to choose the level of precision of
11191 token location tracking thus decreasing the memory consumption if
11192 necessary. Value 0 of level de-activates this option. Value 1
11193 tracks tokens locations in a degraded mode for the sake of minimal
11194 memory overhead. In this mode all tokens resulting from the
11195 expansion of an argument of a function-like macro have the same
11196 location. Value 2 tracks tokens locations completely. This value is
11197 the most memory hungry. When this option is given no argument, the
11198 default parameter value is 2.
11199
11200 Note that "-ftrack-macro-expansion=2" is activated by default.
11201
11202 -fmacro-prefix-map=old=new
11203 When preprocessing files residing in directory old, expand the
11204 "__FILE__" and "__BASE_FILE__" macros as if the files resided in
11205 directory new instead. This can be used to change an absolute path
11206 to a relative path by using . for new which can result in more
11207 reproducible builds that are location independent. This option
11208 also affects "__builtin_FILE()" during compilation. See also
11209 -ffile-prefix-map.
11210
11211 -fexec-charset=charset
11212 Set the execution character set, used for string and character
11213 constants. The default is UTF-8. charset can be any encoding
11214 supported by the system's "iconv" library routine.
11215
11216 -fwide-exec-charset=charset
11217 Set the wide execution character set, used for wide string and
11218 character constants. The default is UTF-32 or UTF-16, whichever
11219 corresponds to the width of "wchar_t". As with -fexec-charset,
11220 charset can be any encoding supported by the system's "iconv"
11221 library routine; however, you will have problems with encodings
11222 that do not fit exactly in "wchar_t".
11223
11224 -finput-charset=charset
11225 Set the input character set, used for translation from the
11226 character set of the input file to the source character set used by
11227 GCC. If the locale does not specify, or GCC cannot get this
11228 information from the locale, the default is UTF-8. This can be
11229 overridden by either the locale or this command-line option.
11230 Currently the command-line option takes precedence if there's a
11231 conflict. charset can be any encoding supported by the system's
11232 "iconv" library routine.
11233
11234 -fpch-deps
11235 When using precompiled headers, this flag causes the dependency-
11236 output flags to also list the files from the precompiled header's
11237 dependencies. If not specified, only the precompiled header are
11238 listed and not the files that were used to create it, because those
11239 files are not consulted when a precompiled header is used.
11240
11241 -fpch-preprocess
11242 This option allows use of a precompiled header together with -E.
11243 It inserts a special "#pragma", "#pragma GCC pch_preprocess
11244 "filename"" in the output to mark the place where the precompiled
11245 header was found, and its filename. When -fpreprocessed is in use,
11246 GCC recognizes this "#pragma" and loads the PCH.
11247
11248 This option is off by default, because the resulting preprocessed
11249 output is only really suitable as input to GCC. It is switched on
11250 by -save-temps.
11251
11252 You should not write this "#pragma" in your own code, but it is
11253 safe to edit the filename if the PCH file is available in a
11254 different location. The filename may be absolute or it may be
11255 relative to GCC's current directory.
11256
11257 -fworking-directory
11258 Enable generation of linemarkers in the preprocessor output that
11259 let the compiler know the current working directory at the time of
11260 preprocessing. When this option is enabled, the preprocessor
11261 emits, after the initial linemarker, a second linemarker with the
11262 current working directory followed by two slashes. GCC uses this
11263 directory, when it's present in the preprocessed input, as the
11264 directory emitted as the current working directory in some
11265 debugging information formats. This option is implicitly enabled
11266 if debugging information is enabled, but this can be inhibited with
11267 the negated form -fno-working-directory. If the -P flag is present
11268 in the command line, this option has no effect, since no "#line"
11269 directives are emitted whatsoever.
11270
11271 -A predicate=answer
11272 Make an assertion with the predicate predicate and answer answer.
11273 This form is preferred to the older form -A predicate(answer),
11274 which is still supported, because it does not use shell special
11275 characters.
11276
11277 -A -predicate=answer
11278 Cancel an assertion with the predicate predicate and answer answer.
11279
11280 -C Do not discard comments. All comments are passed through to the
11281 output file, except for comments in processed directives, which are
11282 deleted along with the directive.
11283
11284 You should be prepared for side effects when using -C; it causes
11285 the preprocessor to treat comments as tokens in their own right.
11286 For example, comments appearing at the start of what would be a
11287 directive line have the effect of turning that line into an
11288 ordinary source line, since the first token on the line is no
11289 longer a #.
11290
11291 -CC Do not discard comments, including during macro expansion. This is
11292 like -C, except that comments contained within macros are also
11293 passed through to the output file where the macro is expanded.
11294
11295 In addition to the side effects of the -C option, the -CC option
11296 causes all C++-style comments inside a macro to be converted to
11297 C-style comments. This is to prevent later use of that macro from
11298 inadvertently commenting out the remainder of the source line.
11299
11300 The -CC option is generally used to support lint comments.
11301
11302 -P Inhibit generation of linemarkers in the output from the
11303 preprocessor. This might be useful when running the preprocessor
11304 on something that is not C code, and will be sent to a program
11305 which might be confused by the linemarkers.
11306
11307 -traditional
11308 -traditional-cpp
11309 Try to imitate the behavior of pre-standard C preprocessors, as
11310 opposed to ISO C preprocessors. See the GNU CPP manual for
11311 details.
11312
11313 Note that GCC does not otherwise attempt to emulate a pre-standard
11314 C compiler, and these options are only supported with the -E
11315 switch, or when invoking CPP explicitly.
11316
11317 -trigraphs
11318 Support ISO C trigraphs. These are three-character sequences, all
11319 starting with ??, that are defined by ISO C to stand for single
11320 characters. For example, ??/ stands for \, so '??/n' is a
11321 character constant for a newline.
11322
11323 The nine trigraphs and their replacements are
11324
11325 Trigraph: ??( ??) ??< ??> ??= ??/ ??' ??! ??-
11326 Replacement: [ ] { } # \ ^ | ~
11327
11328 By default, GCC ignores trigraphs, but in standard-conforming modes
11329 it converts them. See the -std and -ansi options.
11330
11331 -remap
11332 Enable special code to work around file systems which only permit
11333 very short file names, such as MS-DOS.
11334
11335 -H Print the name of each header file used, in addition to other
11336 normal activities. Each name is indented to show how deep in the
11337 #include stack it is. Precompiled header files are also printed,
11338 even if they are found to be invalid; an invalid precompiled header
11339 file is printed with ...x and a valid one with ...! .
11340
11341 -dletters
11342 Says to make debugging dumps during compilation as specified by
11343 letters. The flags documented here are those relevant to the
11344 preprocessor. Other letters are interpreted by the compiler
11345 proper, or reserved for future versions of GCC, and so are silently
11346 ignored. If you specify letters whose behavior conflicts, the
11347 result is undefined.
11348
11349 -dM Instead of the normal output, generate a list of #define
11350 directives for all the macros defined during the execution of
11351 the preprocessor, including predefined macros. This gives you
11352 a way of finding out what is predefined in your version of the
11353 preprocessor. Assuming you have no file foo.h, the command
11354
11355 touch foo.h; cpp -dM foo.h
11356
11357 shows all the predefined macros.
11358
11359 If you use -dM without the -E option, -dM is interpreted as a
11360 synonym for -fdump-rtl-mach.
11361
11362 -dD Like -dM except in two respects: it does not include the
11363 predefined macros, and it outputs both the #define directives
11364 and the result of preprocessing. Both kinds of output go to
11365 the standard output file.
11366
11367 -dN Like -dD, but emit only the macro names, not their expansions.
11368
11369 -dI Output #include directives in addition to the result of
11370 preprocessing.
11371
11372 -dU Like -dD except that only macros that are expanded, or whose
11373 definedness is tested in preprocessor directives, are output;
11374 the output is delayed until the use or test of the macro; and
11375 #undef directives are also output for macros tested but
11376 undefined at the time.
11377
11378 -fdebug-cpp
11379 This option is only useful for debugging GCC. When used from CPP
11380 or with -E, it dumps debugging information about location maps.
11381 Every token in the output is preceded by the dump of the map its
11382 location belongs to.
11383
11384 When used from GCC without -E, this option has no effect.
11385
11386 -Wp,option
11387 You can use -Wp,option to bypass the compiler driver and pass
11388 option directly through to the preprocessor. If option contains
11389 commas, it is split into multiple options at the commas. However,
11390 many options are modified, translated or interpreted by the
11391 compiler driver before being passed to the preprocessor, and -Wp
11392 forcibly bypasses this phase. The preprocessor's direct interface
11393 is undocumented and subject to change, so whenever possible you
11394 should avoid using -Wp and let the driver handle the options
11395 instead.
11396
11397 -Xpreprocessor option
11398 Pass option as an option to the preprocessor. You can use this to
11399 supply system-specific preprocessor options that GCC does not
11400 recognize.
11401
11402 If you want to pass an option that takes an argument, you must use
11403 -Xpreprocessor twice, once for the option and once for the
11404 argument.
11405
11406 -no-integrated-cpp
11407 Perform preprocessing as a separate pass before compilation. By
11408 default, GCC performs preprocessing as an integrated part of input
11409 tokenization and parsing. If this option is provided, the
11410 appropriate language front end (cc1, cc1plus, or cc1obj for C, C++,
11411 and Objective-C, respectively) is instead invoked twice, once for
11412 preprocessing only and once for actual compilation of the
11413 preprocessed input. This option may be useful in conjunction with
11414 the -B or -wrapper options to specify an alternate preprocessor or
11415 perform additional processing of the program source between normal
11416 preprocessing and compilation.
11417
11418 Passing Options to the Assembler
11419 You can pass options to the assembler.
11420
11421 -Wa,option
11422 Pass option as an option to the assembler. If option contains
11423 commas, it is split into multiple options at the commas.
11424
11425 -Xassembler option
11426 Pass option as an option to the assembler. You can use this to
11427 supply system-specific assembler options that GCC does not
11428 recognize.
11429
11430 If you want to pass an option that takes an argument, you must use
11431 -Xassembler twice, once for the option and once for the argument.
11432
11433 Options for Linking
11434 These options come into play when the compiler links object files into
11435 an executable output file. They are meaningless if the compiler is not
11436 doing a link step.
11437
11438 object-file-name
11439 A file name that does not end in a special recognized suffix is
11440 considered to name an object file or library. (Object files are
11441 distinguished from libraries by the linker according to the file
11442 contents.) If linking is done, these object files are used as
11443 input to the linker.
11444
11445 -c
11446 -S
11447 -E If any of these options is used, then the linker is not run, and
11448 object file names should not be used as arguments.
11449
11450 -flinker-output=type
11451 This option controls the code generation of the link time
11452 optimizer. By default the linker output is determined by the
11453 linker plugin automatically. For debugging the compiler and in the
11454 case of incremental linking to non-lto object file is desired, it
11455 may be useful to control the type manually.
11456
11457 If type is exec the code generation is configured to produce static
11458 binary. In this case -fpic and -fpie are both disabled.
11459
11460 If type is dyn the code generation is configured to produce shared
11461 library. In this case -fpic or -fPIC is preserved, but not enabled
11462 automatically. This makes it possible to build shared libraries
11463 without position independent code on architectures this is
11464 possible, i.e. on x86.
11465
11466 If type is pie the code generation is configured to produce -fpie
11467 executable. This result in similar optimizations as exec except
11468 that -fpie is not disabled if specified at compilation time.
11469
11470 If type is rel the compiler assumes that incremental linking is
11471 done. The sections containing intermediate code for link-time
11472 optimization are merged, pre-optimized, and output to the resulting
11473 object file. In addition, if -ffat-lto-objects is specified the
11474 binary code is produced for future non-lto linking. The object file
11475 produced by incremental linking will be smaller than a static
11476 library produced from the same object files. At link-time the
11477 result of incremental linking will also load faster to compiler
11478 than a static library assuming that majority of objects in the
11479 library are used.
11480
11481 Finally nolto-rel configure compiler to for incremental linking
11482 where code generation is forced, final binary is produced and the
11483 intermediate code for later link-time optimization is stripped.
11484 When multiple object files are linked together the resulting code
11485 will be optimized better than with link time optimizations disabled
11486 (for example, the cross-module inlining will happen), most of
11487 benefits of whole program optimizations are however lost.
11488
11489 During the incremental link (by -r) the linker plugin will default
11490 to rel. With current interfaces to GNU Binutils it is however not
11491 possible to link incrementally LTO objects and non-LTO objects into
11492 a single mixed object file. In the case any of object files in
11493 incremental link cannot be used for link-time optimization the
11494 linker plugin will output warning and use nolto-rel. To maintain
11495 the whole program optimization it is recommended to link such
11496 objects into static library instead. Alternatively it is possible
11497 to use H.J. Lu's binutils with support for mixed objects.
11498
11499 -fuse-ld=bfd
11500 Use the bfd linker instead of the default linker.
11501
11502 -fuse-ld=gold
11503 Use the gold linker instead of the default linker.
11504
11505 -fuse-ld=lld
11506 Use the LLVM lld linker instead of the default linker.
11507
11508 -llibrary
11509 -l library
11510 Search the library named library when linking. (The second
11511 alternative with the library as a separate argument is only for
11512 POSIX compliance and is not recommended.)
11513
11514 The -l option is passed directly to the linker by GCC. Refer to
11515 your linker documentation for exact details. The general
11516 description below applies to the GNU linker.
11517
11518 The linker searches a standard list of directories for the library.
11519 The directories searched include several standard system
11520 directories plus any that you specify with -L.
11521
11522 Static libraries are archives of object files, and have file names
11523 like liblibrary.a. Some targets also support shared libraries,
11524 which typically have names like liblibrary.so. If both static and
11525 shared libraries are found, the linker gives preference to linking
11526 with the shared library unless the -static option is used.
11527
11528 It makes a difference where in the command you write this option;
11529 the linker searches and processes libraries and object files in the
11530 order they are specified. Thus, foo.o -lz bar.o searches library z
11531 after file foo.o but before bar.o. If bar.o refers to functions in
11532 z, those functions may not be loaded.
11533
11534 -lobjc
11535 You need this special case of the -l option in order to link an
11536 Objective-C or Objective-C++ program.
11537
11538 -nostartfiles
11539 Do not use the standard system startup files when linking. The
11540 standard system libraries are used normally, unless -nostdlib,
11541 -nolibc, or -nodefaultlibs is used.
11542
11543 -nodefaultlibs
11544 Do not use the standard system libraries when linking. Only the
11545 libraries you specify are passed to the linker, and options
11546 specifying linkage of the system libraries, such as -static-libgcc
11547 or -shared-libgcc, are ignored. The standard startup files are
11548 used normally, unless -nostartfiles is used.
11549
11550 The compiler may generate calls to "memcmp", "memset", "memcpy" and
11551 "memmove". These entries are usually resolved by entries in libc.
11552 These entry points should be supplied through some other mechanism
11553 when this option is specified.
11554
11555 -nolibc
11556 Do not use the C library or system libraries tightly coupled with
11557 it when linking. Still link with the startup files, libgcc or
11558 toolchain provided language support libraries such as libgnat,
11559 libgfortran or libstdc++ unless options preventing their inclusion
11560 are used as well. This typically removes -lc from the link command
11561 line, as well as system libraries that normally go with it and
11562 become meaningless when absence of a C library is assumed, for
11563 example -lpthread or -lm in some configurations. This is intended
11564 for bare-board targets when there is indeed no C library available.
11565
11566 -nostdlib
11567 Do not use the standard system startup files or libraries when
11568 linking. No startup files and only the libraries you specify are
11569 passed to the linker, and options specifying linkage of the system
11570 libraries, such as -static-libgcc or -shared-libgcc, are ignored.
11571
11572 The compiler may generate calls to "memcmp", "memset", "memcpy" and
11573 "memmove". These entries are usually resolved by entries in libc.
11574 These entry points should be supplied through some other mechanism
11575 when this option is specified.
11576
11577 One of the standard libraries bypassed by -nostdlib and
11578 -nodefaultlibs is libgcc.a, a library of internal subroutines which
11579 GCC uses to overcome shortcomings of particular machines, or
11580 special needs for some languages.
11581
11582 In most cases, you need libgcc.a even when you want to avoid other
11583 standard libraries. In other words, when you specify -nostdlib or
11584 -nodefaultlibs you should usually specify -lgcc as well. This
11585 ensures that you have no unresolved references to internal GCC
11586 library subroutines. (An example of such an internal subroutine is
11587 "__main", used to ensure C++ constructors are called.)
11588
11589 -e entry
11590 --entry=entry
11591 Specify that the program entry point is entry. The argument is
11592 interpreted by the linker; the GNU linker accepts either a symbol
11593 name or an address.
11594
11595 -pie
11596 Produce a dynamically linked position independent executable on
11597 targets that support it. For predictable results, you must also
11598 specify the same set of options used for compilation (-fpie, -fPIE,
11599 or model suboptions) when you specify this linker option.
11600
11601 -no-pie
11602 Don't produce a dynamically linked position independent executable.
11603
11604 -static-pie
11605 Produce a static position independent executable on targets that
11606 support it. A static position independent executable is similar to
11607 a static executable, but can be loaded at any address without a
11608 dynamic linker. For predictable results, you must also specify the
11609 same set of options used for compilation (-fpie, -fPIE, or model
11610 suboptions) when you specify this linker option.
11611
11612 -pthread
11613 Link with the POSIX threads library. This option is supported on
11614 GNU/Linux targets, most other Unix derivatives, and also on x86
11615 Cygwin and MinGW targets. On some targets this option also sets
11616 flags for the preprocessor, so it should be used consistently for
11617 both compilation and linking.
11618
11619 -r Produce a relocatable object as output. This is also known as
11620 partial linking.
11621
11622 -rdynamic
11623 Pass the flag -export-dynamic to the ELF linker, on targets that
11624 support it. This instructs the linker to add all symbols, not only
11625 used ones, to the dynamic symbol table. This option is needed for
11626 some uses of "dlopen" or to allow obtaining backtraces from within
11627 a program.
11628
11629 -s Remove all symbol table and relocation information from the
11630 executable.
11631
11632 -static
11633 On systems that support dynamic linking, this overrides -pie and
11634 prevents linking with the shared libraries. On other systems, this
11635 option has no effect.
11636
11637 -shared
11638 Produce a shared object which can then be linked with other objects
11639 to form an executable. Not all systems support this option. For
11640 predictable results, you must also specify the same set of options
11641 used for compilation (-fpic, -fPIC, or model suboptions) when you
11642 specify this linker option.[1]
11643
11644 -shared-libgcc
11645 -static-libgcc
11646 On systems that provide libgcc as a shared library, these options
11647 force the use of either the shared or static version, respectively.
11648 If no shared version of libgcc was built when the compiler was
11649 configured, these options have no effect.
11650
11651 There are several situations in which an application should use the
11652 shared libgcc instead of the static version. The most common of
11653 these is when the application wishes to throw and catch exceptions
11654 across different shared libraries. In that case, each of the
11655 libraries as well as the application itself should use the shared
11656 libgcc.
11657
11658 Therefore, the G++ driver automatically adds -shared-libgcc
11659 whenever you build a shared library or a main executable, because
11660 C++ programs typically use exceptions, so this is the right thing
11661 to do.
11662
11663 If, instead, you use the GCC driver to create shared libraries, you
11664 may find that they are not always linked with the shared libgcc.
11665 If GCC finds, at its configuration time, that you have a non-GNU
11666 linker or a GNU linker that does not support option --eh-frame-hdr,
11667 it links the shared version of libgcc into shared libraries by
11668 default. Otherwise, it takes advantage of the linker and optimizes
11669 away the linking with the shared version of libgcc, linking with
11670 the static version of libgcc by default. This allows exceptions to
11671 propagate through such shared libraries, without incurring
11672 relocation costs at library load time.
11673
11674 However, if a library or main executable is supposed to throw or
11675 catch exceptions, you must link it using the G++ driver, or using
11676 the option -shared-libgcc, such that it is linked with the shared
11677 libgcc.
11678
11679 -static-libasan
11680 When the -fsanitize=address option is used to link a program, the
11681 GCC driver automatically links against libasan. If libasan is
11682 available as a shared library, and the -static option is not used,
11683 then this links against the shared version of libasan. The
11684 -static-libasan option directs the GCC driver to link libasan
11685 statically, without necessarily linking other libraries statically.
11686
11687 -static-libtsan
11688 When the -fsanitize=thread option is used to link a program, the
11689 GCC driver automatically links against libtsan. If libtsan is
11690 available as a shared library, and the -static option is not used,
11691 then this links against the shared version of libtsan. The
11692 -static-libtsan option directs the GCC driver to link libtsan
11693 statically, without necessarily linking other libraries statically.
11694
11695 -static-liblsan
11696 When the -fsanitize=leak option is used to link a program, the GCC
11697 driver automatically links against liblsan. If liblsan is
11698 available as a shared library, and the -static option is not used,
11699 then this links against the shared version of liblsan. The
11700 -static-liblsan option directs the GCC driver to link liblsan
11701 statically, without necessarily linking other libraries statically.
11702
11703 -static-libubsan
11704 When the -fsanitize=undefined option is used to link a program, the
11705 GCC driver automatically links against libubsan. If libubsan is
11706 available as a shared library, and the -static option is not used,
11707 then this links against the shared version of libubsan. The
11708 -static-libubsan option directs the GCC driver to link libubsan
11709 statically, without necessarily linking other libraries statically.
11710
11711 -static-libstdc++
11712 When the g++ program is used to link a C++ program, it normally
11713 automatically links against libstdc++. If libstdc++ is available
11714 as a shared library, and the -static option is not used, then this
11715 links against the shared version of libstdc++. That is normally
11716 fine. However, it is sometimes useful to freeze the version of
11717 libstdc++ used by the program without going all the way to a fully
11718 static link. The -static-libstdc++ option directs the g++ driver
11719 to link libstdc++ statically, without necessarily linking other
11720 libraries statically.
11721
11722 -symbolic
11723 Bind references to global symbols when building a shared object.
11724 Warn about any unresolved references (unless overridden by the link
11725 editor option -Xlinker -z -Xlinker defs). Only a few systems
11726 support this option.
11727
11728 -T script
11729 Use script as the linker script. This option is supported by most
11730 systems using the GNU linker. On some targets, such as bare-board
11731 targets without an operating system, the -T option may be required
11732 when linking to avoid references to undefined symbols.
11733
11734 -Xlinker option
11735 Pass option as an option to the linker. You can use this to supply
11736 system-specific linker options that GCC does not recognize.
11737
11738 If you want to pass an option that takes a separate argument, you
11739 must use -Xlinker twice, once for the option and once for the
11740 argument. For example, to pass -assert definitions, you must write
11741 -Xlinker -assert -Xlinker definitions. It does not work to write
11742 -Xlinker "-assert definitions", because this passes the entire
11743 string as a single argument, which is not what the linker expects.
11744
11745 When using the GNU linker, it is usually more convenient to pass
11746 arguments to linker options using the option=value syntax than as
11747 separate arguments. For example, you can specify -Xlinker
11748 -Map=output.map rather than -Xlinker -Map -Xlinker output.map.
11749 Other linkers may not support this syntax for command-line options.
11750
11751 -Wl,option
11752 Pass option as an option to the linker. If option contains commas,
11753 it is split into multiple options at the commas. You can use this
11754 syntax to pass an argument to the option. For example,
11755 -Wl,-Map,output.map passes -Map output.map to the linker. When
11756 using the GNU linker, you can also get the same effect with
11757 -Wl,-Map=output.map.
11758
11759 -u symbol
11760 Pretend the symbol symbol is undefined, to force linking of library
11761 modules to define it. You can use -u multiple times with different
11762 symbols to force loading of additional library modules.
11763
11764 -z keyword
11765 -z is passed directly on to the linker along with the keyword
11766 keyword. See the section in the documentation of your linker for
11767 permitted values and their meanings.
11768
11769 Options for Directory Search
11770 These options specify directories to search for header files, for
11771 libraries and for parts of the compiler:
11772
11773 -I dir
11774 -iquote dir
11775 -isystem dir
11776 -idirafter dir
11777 Add the directory dir to the list of directories to be searched for
11778 header files during preprocessing. If dir begins with = or
11779 $SYSROOT, then the = or $SYSROOT is replaced by the sysroot prefix;
11780 see --sysroot and -isysroot.
11781
11782 Directories specified with -iquote apply only to the quote form of
11783 the directive, "#include "file"". Directories specified with -I,
11784 -isystem, or -idirafter apply to lookup for both the
11785 "#include "file"" and "#include <file>" directives.
11786
11787 You can specify any number or combination of these options on the
11788 command line to search for header files in several directories.
11789 The lookup order is as follows:
11790
11791 1. For the quote form of the include directive, the directory of
11792 the current file is searched first.
11793
11794 2. For the quote form of the include directive, the directories
11795 specified by -iquote options are searched in left-to-right
11796 order, as they appear on the command line.
11797
11798 3. Directories specified with -I options are scanned in left-to-
11799 right order.
11800
11801 4. Directories specified with -isystem options are scanned in
11802 left-to-right order.
11803
11804 5. Standard system directories are scanned.
11805
11806 6. Directories specified with -idirafter options are scanned in
11807 left-to-right order.
11808
11809 You can use -I to override a system header file, substituting your
11810 own version, since these directories are searched before the
11811 standard system header file directories. However, you should not
11812 use this option to add directories that contain vendor-supplied
11813 system header files; use -isystem for that.
11814
11815 The -isystem and -idirafter options also mark the directory as a
11816 system directory, so that it gets the same special treatment that
11817 is applied to the standard system directories.
11818
11819 If a standard system include directory, or a directory specified
11820 with -isystem, is also specified with -I, the -I option is ignored.
11821 The directory is still searched but as a system directory at its
11822 normal position in the system include chain. This is to ensure
11823 that GCC's procedure to fix buggy system headers and the ordering
11824 for the "#include_next" directive are not inadvertently changed.
11825 If you really need to change the search order for system
11826 directories, use the -nostdinc and/or -isystem options.
11827
11828 -I- Split the include path. This option has been deprecated. Please
11829 use -iquote instead for -I directories before the -I- and remove
11830 the -I- option.
11831
11832 Any directories specified with -I options before -I- are searched
11833 only for headers requested with "#include "file""; they are not
11834 searched for "#include <file>". If additional directories are
11835 specified with -I options after the -I-, those directories are
11836 searched for all #include directives.
11837
11838 In addition, -I- inhibits the use of the directory of the current
11839 file directory as the first search directory for "#include "file"".
11840 There is no way to override this effect of -I-.
11841
11842 -iprefix prefix
11843 Specify prefix as the prefix for subsequent -iwithprefix options.
11844 If the prefix represents a directory, you should include the final
11845 /.
11846
11847 -iwithprefix dir
11848 -iwithprefixbefore dir
11849 Append dir to the prefix specified previously with -iprefix, and
11850 add the resulting directory to the include search path.
11851 -iwithprefixbefore puts it in the same place -I would; -iwithprefix
11852 puts it where -idirafter would.
11853
11854 -isysroot dir
11855 This option is like the --sysroot option, but applies only to
11856 header files (except for Darwin targets, where it applies to both
11857 header files and libraries). See the --sysroot option for more
11858 information.
11859
11860 -imultilib dir
11861 Use dir as a subdirectory of the directory containing target-
11862 specific C++ headers.
11863
11864 -nostdinc
11865 Do not search the standard system directories for header files.
11866 Only the directories explicitly specified with -I, -iquote,
11867 -isystem, and/or -idirafter options (and the directory of the
11868 current file, if appropriate) are searched.
11869
11870 -nostdinc++
11871 Do not search for header files in the C++-specific standard
11872 directories, but do still search the other standard directories.
11873 (This option is used when building the C++ library.)
11874
11875 -iplugindir=dir
11876 Set the directory to search for plugins that are passed by
11877 -fplugin=name instead of -fplugin=path/name.so. This option is not
11878 meant to be used by the user, but only passed by the driver.
11879
11880 -Ldir
11881 Add directory dir to the list of directories to be searched for -l.
11882
11883 -Bprefix
11884 This option specifies where to find the executables, libraries,
11885 include files, and data files of the compiler itself.
11886
11887 The compiler driver program runs one or more of the subprograms
11888 cpp, cc1, as and ld. It tries prefix as a prefix for each program
11889 it tries to run, both with and without machine/version/ for the
11890 corresponding target machine and compiler version.
11891
11892 For each subprogram to be run, the compiler driver first tries the
11893 -B prefix, if any. If that name is not found, or if -B is not
11894 specified, the driver tries two standard prefixes, /usr/lib/gcc/
11895 and /usr/local/lib/gcc/. If neither of those results in a file
11896 name that is found, the unmodified program name is searched for
11897 using the directories specified in your PATH environment variable.
11898
11899 The compiler checks to see if the path provided by -B refers to a
11900 directory, and if necessary it adds a directory separator character
11901 at the end of the path.
11902
11903 -B prefixes that effectively specify directory names also apply to
11904 libraries in the linker, because the compiler translates these
11905 options into -L options for the linker. They also apply to include
11906 files in the preprocessor, because the compiler translates these
11907 options into -isystem options for the preprocessor. In this case,
11908 the compiler appends include to the prefix.
11909
11910 The runtime support file libgcc.a can also be searched for using
11911 the -B prefix, if needed. If it is not found there, the two
11912 standard prefixes above are tried, and that is all. The file is
11913 left out of the link if it is not found by those means.
11914
11915 Another way to specify a prefix much like the -B prefix is to use
11916 the environment variable GCC_EXEC_PREFIX.
11917
11918 As a special kludge, if the path provided by -B is [dir/]stageN/,
11919 where N is a number in the range 0 to 9, then it is replaced by
11920 [dir/]include. This is to help with boot-strapping the compiler.
11921
11922 -no-canonical-prefixes
11923 Do not expand any symbolic links, resolve references to /../ or
11924 /./, or make the path absolute when generating a relative prefix.
11925
11926 --sysroot=dir
11927 Use dir as the logical root directory for headers and libraries.
11928 For example, if the compiler normally searches for headers in
11929 /usr/include and libraries in /usr/lib, it instead searches
11930 dir/usr/include and dir/usr/lib.
11931
11932 If you use both this option and the -isysroot option, then the
11933 --sysroot option applies to libraries, but the -isysroot option
11934 applies to header files.
11935
11936 The GNU linker (beginning with version 2.16) has the necessary
11937 support for this option. If your linker does not support this
11938 option, the header file aspect of --sysroot still works, but the
11939 library aspect does not.
11940
11941 --no-sysroot-suffix
11942 For some targets, a suffix is added to the root directory specified
11943 with --sysroot, depending on the other options used, so that
11944 headers may for example be found in dir/suffix/usr/include instead
11945 of dir/usr/include. This option disables the addition of such a
11946 suffix.
11947
11948 Options for Code Generation Conventions
11949 These machine-independent options control the interface conventions
11950 used in code generation.
11951
11952 Most of them have both positive and negative forms; the negative form
11953 of -ffoo is -fno-foo. In the table below, only one of the forms is
11954 listed---the one that is not the default. You can figure out the other
11955 form by either removing no- or adding it.
11956
11957 -fstack-reuse=reuse-level
11958 This option controls stack space reuse for user declared local/auto
11959 variables and compiler generated temporaries. reuse_level can be
11960 all, named_vars, or none. all enables stack reuse for all local
11961 variables and temporaries, named_vars enables the reuse only for
11962 user defined local variables with names, and none disables stack
11963 reuse completely. The default value is all. The option is needed
11964 when the program extends the lifetime of a scoped local variable or
11965 a compiler generated temporary beyond the end point defined by the
11966 language. When a lifetime of a variable ends, and if the variable
11967 lives in memory, the optimizing compiler has the freedom to reuse
11968 its stack space with other temporaries or scoped local variables
11969 whose live range does not overlap with it. Legacy code extending
11970 local lifetime is likely to break with the stack reuse
11971 optimization.
11972
11973 For example,
11974
11975 int *p;
11976 {
11977 int local1;
11978
11979 p = &local1;
11980 local1 = 10;
11981 ....
11982 }
11983 {
11984 int local2;
11985 local2 = 20;
11986 ...
11987 }
11988
11989 if (*p == 10) // out of scope use of local1
11990 {
11991
11992 }
11993
11994 Another example:
11995
11996 struct A
11997 {
11998 A(int k) : i(k), j(k) { }
11999 int i;
12000 int j;
12001 };
12002
12003 A *ap;
12004
12005 void foo(const A& ar)
12006 {
12007 ap = &ar;
12008 }
12009
12010 void bar()
12011 {
12012 foo(A(10)); // temp object's lifetime ends when foo returns
12013
12014 {
12015 A a(20);
12016 ....
12017 }
12018 ap->i+= 10; // ap references out of scope temp whose space
12019 // is reused with a. What is the value of ap->i?
12020 }
12021
12022 The lifetime of a compiler generated temporary is well defined by
12023 the C++ standard. When a lifetime of a temporary ends, and if the
12024 temporary lives in memory, the optimizing compiler has the freedom
12025 to reuse its stack space with other temporaries or scoped local
12026 variables whose live range does not overlap with it. However some
12027 of the legacy code relies on the behavior of older compilers in
12028 which temporaries' stack space is not reused, the aggressive stack
12029 reuse can lead to runtime errors. This option is used to control
12030 the temporary stack reuse optimization.
12031
12032 -ftrapv
12033 This option generates traps for signed overflow on addition,
12034 subtraction, multiplication operations. The options -ftrapv and
12035 -fwrapv override each other, so using -ftrapv -fwrapv on the
12036 command-line results in -fwrapv being effective. Note that only
12037 active options override, so using -ftrapv -fwrapv -fno-wrapv on the
12038 command-line results in -ftrapv being effective.
12039
12040 -fwrapv
12041 This option instructs the compiler to assume that signed arithmetic
12042 overflow of addition, subtraction and multiplication wraps around
12043 using twos-complement representation. This flag enables some
12044 optimizations and disables others. The options -ftrapv and -fwrapv
12045 override each other, so using -ftrapv -fwrapv on the command-line
12046 results in -fwrapv being effective. Note that only active options
12047 override, so using -ftrapv -fwrapv -fno-wrapv on the command-line
12048 results in -ftrapv being effective.
12049
12050 -fwrapv-pointer
12051 This option instructs the compiler to assume that pointer
12052 arithmetic overflow on addition and subtraction wraps around using
12053 twos-complement representation. This flag disables some
12054 optimizations which assume pointer overflow is invalid.
12055
12056 -fstrict-overflow
12057 This option implies -fno-wrapv -fno-wrapv-pointer and when negated
12058 implies -fwrapv -fwrapv-pointer.
12059
12060 -fexceptions
12061 Enable exception handling. Generates extra code needed to
12062 propagate exceptions. For some targets, this implies GCC generates
12063 frame unwind information for all functions, which can produce
12064 significant data size overhead, although it does not affect
12065 execution. If you do not specify this option, GCC enables it by
12066 default for languages like C++ that normally require exception
12067 handling, and disables it for languages like C that do not normally
12068 require it. However, you may need to enable this option when
12069 compiling C code that needs to interoperate properly with exception
12070 handlers written in C++. You may also wish to disable this option
12071 if you are compiling older C++ programs that don't use exception
12072 handling.
12073
12074 -fnon-call-exceptions
12075 Generate code that allows trapping instructions to throw
12076 exceptions. Note that this requires platform-specific runtime
12077 support that does not exist everywhere. Moreover, it only allows
12078 trapping instructions to throw exceptions, i.e. memory references
12079 or floating-point instructions. It does not allow exceptions to be
12080 thrown from arbitrary signal handlers such as "SIGALRM".
12081
12082 -fdelete-dead-exceptions
12083 Consider that instructions that may throw exceptions but don't
12084 otherwise contribute to the execution of the program can be
12085 optimized away. This option is enabled by default for the Ada
12086 front end, as permitted by the Ada language specification.
12087 Optimization passes that cause dead exceptions to be removed are
12088 enabled independently at different optimization levels.
12089
12090 -funwind-tables
12091 Similar to -fexceptions, except that it just generates any needed
12092 static data, but does not affect the generated code in any other
12093 way. You normally do not need to enable this option; instead, a
12094 language processor that needs this handling enables it on your
12095 behalf.
12096
12097 -fasynchronous-unwind-tables
12098 Generate unwind table in DWARF format, if supported by target
12099 machine. The table is exact at each instruction boundary, so it
12100 can be used for stack unwinding from asynchronous events (such as
12101 debugger or garbage collector).
12102
12103 -fno-gnu-unique
12104 On systems with recent GNU assembler and C library, the C++
12105 compiler uses the "STB_GNU_UNIQUE" binding to make sure that
12106 definitions of template static data members and static local
12107 variables in inline functions are unique even in the presence of
12108 "RTLD_LOCAL"; this is necessary to avoid problems with a library
12109 used by two different "RTLD_LOCAL" plugins depending on a
12110 definition in one of them and therefore disagreeing with the other
12111 one about the binding of the symbol. But this causes "dlclose" to
12112 be ignored for affected DSOs; if your program relies on
12113 reinitialization of a DSO via "dlclose" and "dlopen", you can use
12114 -fno-gnu-unique.
12115
12116 -fpcc-struct-return
12117 Return "short" "struct" and "union" values in memory like longer
12118 ones, rather than in registers. This convention is less efficient,
12119 but it has the advantage of allowing intercallability between GCC-
12120 compiled files and files compiled with other compilers,
12121 particularly the Portable C Compiler (pcc).
12122
12123 The precise convention for returning structures in memory depends
12124 on the target configuration macros.
12125
12126 Short structures and unions are those whose size and alignment
12127 match that of some integer type.
12128
12129 Warning: code compiled with the -fpcc-struct-return switch is not
12130 binary compatible with code compiled with the -freg-struct-return
12131 switch. Use it to conform to a non-default application binary
12132 interface.
12133
12134 -freg-struct-return
12135 Return "struct" and "union" values in registers when possible.
12136 This is more efficient for small structures than
12137 -fpcc-struct-return.
12138
12139 If you specify neither -fpcc-struct-return nor -freg-struct-return,
12140 GCC defaults to whichever convention is standard for the target.
12141 If there is no standard convention, GCC defaults to
12142 -fpcc-struct-return, except on targets where GCC is the principal
12143 compiler. In those cases, we can choose the standard, and we chose
12144 the more efficient register return alternative.
12145
12146 Warning: code compiled with the -freg-struct-return switch is not
12147 binary compatible with code compiled with the -fpcc-struct-return
12148 switch. Use it to conform to a non-default application binary
12149 interface.
12150
12151 -fshort-enums
12152 Allocate to an "enum" type only as many bytes as it needs for the
12153 declared range of possible values. Specifically, the "enum" type
12154 is equivalent to the smallest integer type that has enough room.
12155
12156 Warning: the -fshort-enums switch causes GCC to generate code that
12157 is not binary compatible with code generated without that switch.
12158 Use it to conform to a non-default application binary interface.
12159
12160 -fshort-wchar
12161 Override the underlying type for "wchar_t" to be "short unsigned
12162 int" instead of the default for the target. This option is useful
12163 for building programs to run under WINE.
12164
12165 Warning: the -fshort-wchar switch causes GCC to generate code that
12166 is not binary compatible with code generated without that switch.
12167 Use it to conform to a non-default application binary interface.
12168
12169 -fno-common
12170 In C code, this option controls the placement of global variables
12171 defined without an initializer, known as tentative definitions in
12172 the C standard. Tentative definitions are distinct from
12173 declarations of a variable with the "extern" keyword, which do not
12174 allocate storage.
12175
12176 Unix C compilers have traditionally allocated storage for
12177 uninitialized global variables in a common block. This allows the
12178 linker to resolve all tentative definitions of the same variable in
12179 different compilation units to the same object, or to a non-
12180 tentative definition. This is the behavior specified by -fcommon,
12181 and is the default for GCC on most targets. On the other hand,
12182 this behavior is not required by ISO C, and on some targets may
12183 carry a speed or code size penalty on variable references.
12184
12185 The -fno-common option specifies that the compiler should instead
12186 place uninitialized global variables in the BSS section of the
12187 object file. This inhibits the merging of tentative definitions by
12188 the linker so you get a multiple-definition error if the same
12189 variable is defined in more than one compilation unit. Compiling
12190 with -fno-common is useful on targets for which it provides better
12191 performance, or if you wish to verify that the program will work on
12192 other systems that always treat uninitialized variable definitions
12193 this way.
12194
12195 -fno-ident
12196 Ignore the "#ident" directive.
12197
12198 -finhibit-size-directive
12199 Don't output a ".size" assembler directive, or anything else that
12200 would cause trouble if the function is split in the middle, and the
12201 two halves are placed at locations far apart in memory. This
12202 option is used when compiling crtstuff.c; you should not need to
12203 use it for anything else.
12204
12205 -fverbose-asm
12206 Put extra commentary information in the generated assembly code to
12207 make it more readable. This option is generally only of use to
12208 those who actually need to read the generated assembly code
12209 (perhaps while debugging the compiler itself).
12210
12211 -fno-verbose-asm, the default, causes the extra information to be
12212 omitted and is useful when comparing two assembler files.
12213
12214 The added comments include:
12215
12216 * information on the compiler version and command-line options,
12217
12218 * the source code lines associated with the assembly
12219 instructions, in the form FILENAME:LINENUMBER:CONTENT OF LINE,
12220
12221 * hints on which high-level expressions correspond to the various
12222 assembly instruction operands.
12223
12224 For example, given this C source file:
12225
12226 int test (int n)
12227 {
12228 int i;
12229 int total = 0;
12230
12231 for (i = 0; i < n; i++)
12232 total += i * i;
12233
12234 return total;
12235 }
12236
12237 compiling to (x86_64) assembly via -S and emitting the result
12238 direct to stdout via -o -
12239
12240 gcc -S test.c -fverbose-asm -Os -o -
12241
12242 gives output similar to this:
12243
12244 .file "test.c"
12245 # GNU C11 (GCC) version 7.0.0 20160809 (experimental) (x86_64-pc-linux-gnu)
12246 [...snip...]
12247 # options passed:
12248 [...snip...]
12249
12250 .text
12251 .globl test
12252 .type test, @function
12253 test:
12254 .LFB0:
12255 .cfi_startproc
12256 # test.c:4: int total = 0;
12257 xorl %eax, %eax # <retval>
12258 # test.c:6: for (i = 0; i < n; i++)
12259 xorl %edx, %edx # i
12260 .L2:
12261 # test.c:6: for (i = 0; i < n; i++)
12262 cmpl %edi, %edx # n, i
12263 jge .L5 #,
12264 # test.c:7: total += i * i;
12265 movl %edx, %ecx # i, tmp92
12266 imull %edx, %ecx # i, tmp92
12267 # test.c:6: for (i = 0; i < n; i++)
12268 incl %edx # i
12269 # test.c:7: total += i * i;
12270 addl %ecx, %eax # tmp92, <retval>
12271 jmp .L2 #
12272 .L5:
12273 # test.c:10: }
12274 ret
12275 .cfi_endproc
12276 .LFE0:
12277 .size test, .-test
12278 .ident "GCC: (GNU) 7.0.0 20160809 (experimental)"
12279 .section .note.GNU-stack,"",@progbits
12280
12281 The comments are intended for humans rather than machines and hence
12282 the precise format of the comments is subject to change.
12283
12284 -frecord-gcc-switches
12285 This switch causes the command line used to invoke the compiler to
12286 be recorded into the object file that is being created. This
12287 switch is only implemented on some targets and the exact format of
12288 the recording is target and binary file format dependent, but it
12289 usually takes the form of a section containing ASCII text. This
12290 switch is related to the -fverbose-asm switch, but that switch only
12291 records information in the assembler output file as comments, so it
12292 never reaches the object file. See also -grecord-gcc-switches for
12293 another way of storing compiler options into the object file.
12294
12295 -fpic
12296 Generate position-independent code (PIC) suitable for use in a
12297 shared library, if supported for the target machine. Such code
12298 accesses all constant addresses through a global offset table
12299 (GOT). The dynamic loader resolves the GOT entries when the
12300 program starts (the dynamic loader is not part of GCC; it is part
12301 of the operating system). If the GOT size for the linked
12302 executable exceeds a machine-specific maximum size, you get an
12303 error message from the linker indicating that -fpic does not work;
12304 in that case, recompile with -fPIC instead. (These maximums are 8k
12305 on the SPARC, 28k on AArch64 and 32k on the m68k and RS/6000. The
12306 x86 has no such limit.)
12307
12308 Position-independent code requires special support, and therefore
12309 works only on certain machines. For the x86, GCC supports PIC for
12310 System V but not for the Sun 386i. Code generated for the IBM
12311 RS/6000 is always position-independent.
12312
12313 When this flag is set, the macros "__pic__" and "__PIC__" are
12314 defined to 1.
12315
12316 -fPIC
12317 If supported for the target machine, emit position-independent
12318 code, suitable for dynamic linking and avoiding any limit on the
12319 size of the global offset table. This option makes a difference on
12320 AArch64, m68k, PowerPC and SPARC.
12321
12322 Position-independent code requires special support, and therefore
12323 works only on certain machines.
12324
12325 When this flag is set, the macros "__pic__" and "__PIC__" are
12326 defined to 2.
12327
12328 -fpie
12329 -fPIE
12330 These options are similar to -fpic and -fPIC, but the generated
12331 position-independent code can be only linked into executables.
12332 Usually these options are used to compile code that will be linked
12333 using the -pie GCC option.
12334
12335 -fpie and -fPIE both define the macros "__pie__" and "__PIE__".
12336 The macros have the value 1 for -fpie and 2 for -fPIE.
12337
12338 -fno-plt
12339 Do not use the PLT for external function calls in position-
12340 independent code. Instead, load the callee address at call sites
12341 from the GOT and branch to it. This leads to more efficient code
12342 by eliminating PLT stubs and exposing GOT loads to optimizations.
12343 On architectures such as 32-bit x86 where PLT stubs expect the GOT
12344 pointer in a specific register, this gives more register allocation
12345 freedom to the compiler. Lazy binding requires use of the PLT;
12346 with -fno-plt all external symbols are resolved at load time.
12347
12348 Alternatively, the function attribute "noplt" can be used to avoid
12349 calls through the PLT for specific external functions.
12350
12351 In position-dependent code, a few targets also convert calls to
12352 functions that are marked to not use the PLT to use the GOT
12353 instead.
12354
12355 -fno-jump-tables
12356 Do not use jump tables for switch statements even where it would be
12357 more efficient than other code generation strategies. This option
12358 is of use in conjunction with -fpic or -fPIC for building code that
12359 forms part of a dynamic linker and cannot reference the address of
12360 a jump table. On some targets, jump tables do not require a GOT
12361 and this option is not needed.
12362
12363 -ffixed-reg
12364 Treat the register named reg as a fixed register; generated code
12365 should never refer to it (except perhaps as a stack pointer, frame
12366 pointer or in some other fixed role).
12367
12368 reg must be the name of a register. The register names accepted
12369 are machine-specific and are defined in the "REGISTER_NAMES" macro
12370 in the machine description macro file.
12371
12372 This flag does not have a negative form, because it specifies a
12373 three-way choice.
12374
12375 -fcall-used-reg
12376 Treat the register named reg as an allocable register that is
12377 clobbered by function calls. It may be allocated for temporaries
12378 or variables that do not live across a call. Functions compiled
12379 this way do not save and restore the register reg.
12380
12381 It is an error to use this flag with the frame pointer or stack
12382 pointer. Use of this flag for other registers that have fixed
12383 pervasive roles in the machine's execution model produces
12384 disastrous results.
12385
12386 This flag does not have a negative form, because it specifies a
12387 three-way choice.
12388
12389 -fcall-saved-reg
12390 Treat the register named reg as an allocable register saved by
12391 functions. It may be allocated even for temporaries or variables
12392 that live across a call. Functions compiled this way save and
12393 restore the register reg if they use it.
12394
12395 It is an error to use this flag with the frame pointer or stack
12396 pointer. Use of this flag for other registers that have fixed
12397 pervasive roles in the machine's execution model produces
12398 disastrous results.
12399
12400 A different sort of disaster results from the use of this flag for
12401 a register in which function values may be returned.
12402
12403 This flag does not have a negative form, because it specifies a
12404 three-way choice.
12405
12406 -fpack-struct[=n]
12407 Without a value specified, pack all structure members together
12408 without holes. When a value is specified (which must be a small
12409 power of two), pack structure members according to this value,
12410 representing the maximum alignment (that is, objects with default
12411 alignment requirements larger than this are output potentially
12412 unaligned at the next fitting location.
12413
12414 Warning: the -fpack-struct switch causes GCC to generate code that
12415 is not binary compatible with code generated without that switch.
12416 Additionally, it makes the code suboptimal. Use it to conform to a
12417 non-default application binary interface.
12418
12419 -fleading-underscore
12420 This option and its counterpart, -fno-leading-underscore, forcibly
12421 change the way C symbols are represented in the object file. One
12422 use is to help link with legacy assembly code.
12423
12424 Warning: the -fleading-underscore switch causes GCC to generate
12425 code that is not binary compatible with code generated without that
12426 switch. Use it to conform to a non-default application binary
12427 interface. Not all targets provide complete support for this
12428 switch.
12429
12430 -ftls-model=model
12431 Alter the thread-local storage model to be used. The model
12432 argument should be one of global-dynamic, local-dynamic, initial-
12433 exec or local-exec. Note that the choice is subject to
12434 optimization: the compiler may use a more efficient model for
12435 symbols not visible outside of the translation unit, or if -fpic is
12436 not given on the command line.
12437
12438 The default without -fpic is initial-exec; with -fpic the default
12439 is global-dynamic.
12440
12441 -ftrampolines
12442 For targets that normally need trampolines for nested functions,
12443 always generate them instead of using descriptors. Otherwise, for
12444 targets that do not need them, like for example HP-PA or IA-64, do
12445 nothing.
12446
12447 A trampoline is a small piece of code that is created at run time
12448 on the stack when the address of a nested function is taken, and is
12449 used to call the nested function indirectly. Therefore, it
12450 requires the stack to be made executable in order for the program
12451 to work properly.
12452
12453 -fno-trampolines is enabled by default on a language by language
12454 basis to let the compiler avoid generating them, if it computes
12455 that this is safe, and replace them with descriptors. Descriptors
12456 are made up of data only, but the generated code must be prepared
12457 to deal with them. As of this writing, -fno-trampolines is enabled
12458 by default only for Ada.
12459
12460 Moreover, code compiled with -ftrampolines and code compiled with
12461 -fno-trampolines are not binary compatible if nested functions are
12462 present. This option must therefore be used on a program-wide
12463 basis and be manipulated with extreme care.
12464
12465 -fvisibility=[default|internal|hidden|protected]
12466 Set the default ELF image symbol visibility to the specified
12467 option---all symbols are marked with this unless overridden within
12468 the code. Using this feature can very substantially improve
12469 linking and load times of shared object libraries, produce more
12470 optimized code, provide near-perfect API export and prevent symbol
12471 clashes. It is strongly recommended that you use this in any
12472 shared objects you distribute.
12473
12474 Despite the nomenclature, default always means public; i.e.,
12475 available to be linked against from outside the shared object.
12476 protected and internal are pretty useless in real-world usage so
12477 the only other commonly used option is hidden. The default if
12478 -fvisibility isn't specified is default, i.e., make every symbol
12479 public.
12480
12481 A good explanation of the benefits offered by ensuring ELF symbols
12482 have the correct visibility is given by "How To Write Shared
12483 Libraries" by Ulrich Drepper (which can be found at
12484 <https://www.akkadia.org/drepper/>)---however a superior solution
12485 made possible by this option to marking things hidden when the
12486 default is public is to make the default hidden and mark things
12487 public. This is the norm with DLLs on Windows and with
12488 -fvisibility=hidden and "__attribute__ ((visibility("default")))"
12489 instead of "__declspec(dllexport)" you get almost identical
12490 semantics with identical syntax. This is a great boon to those
12491 working with cross-platform projects.
12492
12493 For those adding visibility support to existing code, you may find
12494 "#pragma GCC visibility" of use. This works by you enclosing the
12495 declarations you wish to set visibility for with (for example)
12496 "#pragma GCC visibility push(hidden)" and "#pragma GCC visibility
12497 pop". Bear in mind that symbol visibility should be viewed as part
12498 of the API interface contract and thus all new code should always
12499 specify visibility when it is not the default; i.e., declarations
12500 only for use within the local DSO should always be marked
12501 explicitly as hidden as so to avoid PLT indirection
12502 overheads---making this abundantly clear also aids readability and
12503 self-documentation of the code. Note that due to ISO C++
12504 specification requirements, "operator new" and "operator delete"
12505 must always be of default visibility.
12506
12507 Be aware that headers from outside your project, in particular
12508 system headers and headers from any other library you use, may not
12509 be expecting to be compiled with visibility other than the default.
12510 You may need to explicitly say "#pragma GCC visibility
12511 push(default)" before including any such headers.
12512
12513 "extern" declarations are not affected by -fvisibility, so a lot of
12514 code can be recompiled with -fvisibility=hidden with no
12515 modifications. However, this means that calls to "extern"
12516 functions with no explicit visibility use the PLT, so it is more
12517 effective to use "__attribute ((visibility))" and/or "#pragma GCC
12518 visibility" to tell the compiler which "extern" declarations should
12519 be treated as hidden.
12520
12521 Note that -fvisibility does affect C++ vague linkage entities. This
12522 means that, for instance, an exception class that is be thrown
12523 between DSOs must be explicitly marked with default visibility so
12524 that the type_info nodes are unified between the DSOs.
12525
12526 An overview of these techniques, their benefits and how to use them
12527 is at <http://gcc.gnu.org/wiki/Visibility>.
12528
12529 -fstrict-volatile-bitfields
12530 This option should be used if accesses to volatile bit-fields (or
12531 other structure fields, although the compiler usually honors those
12532 types anyway) should use a single access of the width of the
12533 field's type, aligned to a natural alignment if possible. For
12534 example, targets with memory-mapped peripheral registers might
12535 require all such accesses to be 16 bits wide; with this flag you
12536 can declare all peripheral bit-fields as "unsigned short" (assuming
12537 short is 16 bits on these targets) to force GCC to use 16-bit
12538 accesses instead of, perhaps, a more efficient 32-bit access.
12539
12540 If this option is disabled, the compiler uses the most efficient
12541 instruction. In the previous example, that might be a 32-bit load
12542 instruction, even though that accesses bytes that do not contain
12543 any portion of the bit-field, or memory-mapped registers unrelated
12544 to the one being updated.
12545
12546 In some cases, such as when the "packed" attribute is applied to a
12547 structure field, it may not be possible to access the field with a
12548 single read or write that is correctly aligned for the target
12549 machine. In this case GCC falls back to generating multiple
12550 accesses rather than code that will fault or truncate the result at
12551 run time.
12552
12553 Note: Due to restrictions of the C/C++11 memory model, write
12554 accesses are not allowed to touch non bit-field members. It is
12555 therefore recommended to define all bits of the field's type as
12556 bit-field members.
12557
12558 The default value of this option is determined by the application
12559 binary interface for the target processor.
12560
12561 -fsync-libcalls
12562 This option controls whether any out-of-line instance of the
12563 "__sync" family of functions may be used to implement the C++11
12564 "__atomic" family of functions.
12565
12566 The default value of this option is enabled, thus the only useful
12567 form of the option is -fno-sync-libcalls. This option is used in
12568 the implementation of the libatomic runtime library.
12569
12570 GCC Developer Options
12571 This section describes command-line options that are primarily of
12572 interest to GCC developers, including options to support compiler
12573 testing and investigation of compiler bugs and compile-time performance
12574 problems. This includes options that produce debug dumps at various
12575 points in the compilation; that print statistics such as memory use and
12576 execution time; and that print information about GCC's configuration,
12577 such as where it searches for libraries. You should rarely need to use
12578 any of these options for ordinary compilation and linking tasks.
12579
12580 Many developer options that cause GCC to dump output to a file take an
12581 optional =filename suffix. You can specify stdout or - to dump to
12582 standard output, and stderr for standard error.
12583
12584 If =filename is omitted, a default dump file name is constructed by
12585 concatenating the base dump file name, a pass number, phase letter, and
12586 pass name. The base dump file name is the name of output file produced
12587 by the compiler if explicitly specified and not an executable;
12588 otherwise it is the source file name. The pass number is determined by
12589 the order passes are registered with the compiler's pass manager. This
12590 is generally the same as the order of execution, but passes registered
12591 by plugins, target-specific passes, or passes that are otherwise
12592 registered late are numbered higher than the pass named final, even if
12593 they are executed earlier. The phase letter is one of i (inter-
12594 procedural analysis), l (language-specific), r (RTL), or t (tree). The
12595 files are created in the directory of the output file.
12596
12597 -dletters
12598 -fdump-rtl-pass
12599 -fdump-rtl-pass=filename
12600 Says to make debugging dumps during compilation at times specified
12601 by letters. This is used for debugging the RTL-based passes of the
12602 compiler.
12603
12604 Some -dletters switches have different meaning when -E is used for
12605 preprocessing.
12606
12607 Debug dumps can be enabled with a -fdump-rtl switch or some -d
12608 option letters. Here are the possible letters for use in pass and
12609 letters, and their meanings:
12610
12611 -fdump-rtl-alignments
12612 Dump after branch alignments have been computed.
12613
12614 -fdump-rtl-asmcons
12615 Dump after fixing rtl statements that have unsatisfied in/out
12616 constraints.
12617
12618 -fdump-rtl-auto_inc_dec
12619 Dump after auto-inc-dec discovery. This pass is only run on
12620 architectures that have auto inc or auto dec instructions.
12621
12622 -fdump-rtl-barriers
12623 Dump after cleaning up the barrier instructions.
12624
12625 -fdump-rtl-bbpart
12626 Dump after partitioning hot and cold basic blocks.
12627
12628 -fdump-rtl-bbro
12629 Dump after block reordering.
12630
12631 -fdump-rtl-btl1
12632 -fdump-rtl-btl2
12633 -fdump-rtl-btl1 and -fdump-rtl-btl2 enable dumping after the
12634 two branch target load optimization passes.
12635
12636 -fdump-rtl-bypass
12637 Dump after jump bypassing and control flow optimizations.
12638
12639 -fdump-rtl-combine
12640 Dump after the RTL instruction combination pass.
12641
12642 -fdump-rtl-compgotos
12643 Dump after duplicating the computed gotos.
12644
12645 -fdump-rtl-ce1
12646 -fdump-rtl-ce2
12647 -fdump-rtl-ce3
12648 -fdump-rtl-ce1, -fdump-rtl-ce2, and -fdump-rtl-ce3 enable
12649 dumping after the three if conversion passes.
12650
12651 -fdump-rtl-cprop_hardreg
12652 Dump after hard register copy propagation.
12653
12654 -fdump-rtl-csa
12655 Dump after combining stack adjustments.
12656
12657 -fdump-rtl-cse1
12658 -fdump-rtl-cse2
12659 -fdump-rtl-cse1 and -fdump-rtl-cse2 enable dumping after the
12660 two common subexpression elimination passes.
12661
12662 -fdump-rtl-dce
12663 Dump after the standalone dead code elimination passes.
12664
12665 -fdump-rtl-dbr
12666 Dump after delayed branch scheduling.
12667
12668 -fdump-rtl-dce1
12669 -fdump-rtl-dce2
12670 -fdump-rtl-dce1 and -fdump-rtl-dce2 enable dumping after the
12671 two dead store elimination passes.
12672
12673 -fdump-rtl-eh
12674 Dump after finalization of EH handling code.
12675
12676 -fdump-rtl-eh_ranges
12677 Dump after conversion of EH handling range regions.
12678
12679 -fdump-rtl-expand
12680 Dump after RTL generation.
12681
12682 -fdump-rtl-fwprop1
12683 -fdump-rtl-fwprop2
12684 -fdump-rtl-fwprop1 and -fdump-rtl-fwprop2 enable dumping after
12685 the two forward propagation passes.
12686
12687 -fdump-rtl-gcse1
12688 -fdump-rtl-gcse2
12689 -fdump-rtl-gcse1 and -fdump-rtl-gcse2 enable dumping after
12690 global common subexpression elimination.
12691
12692 -fdump-rtl-init-regs
12693 Dump after the initialization of the registers.
12694
12695 -fdump-rtl-initvals
12696 Dump after the computation of the initial value sets.
12697
12698 -fdump-rtl-into_cfglayout
12699 Dump after converting to cfglayout mode.
12700
12701 -fdump-rtl-ira
12702 Dump after iterated register allocation.
12703
12704 -fdump-rtl-jump
12705 Dump after the second jump optimization.
12706
12707 -fdump-rtl-loop2
12708 -fdump-rtl-loop2 enables dumping after the rtl loop
12709 optimization passes.
12710
12711 -fdump-rtl-mach
12712 Dump after performing the machine dependent reorganization
12713 pass, if that pass exists.
12714
12715 -fdump-rtl-mode_sw
12716 Dump after removing redundant mode switches.
12717
12718 -fdump-rtl-rnreg
12719 Dump after register renumbering.
12720
12721 -fdump-rtl-outof_cfglayout
12722 Dump after converting from cfglayout mode.
12723
12724 -fdump-rtl-peephole2
12725 Dump after the peephole pass.
12726
12727 -fdump-rtl-postreload
12728 Dump after post-reload optimizations.
12729
12730 -fdump-rtl-pro_and_epilogue
12731 Dump after generating the function prologues and epilogues.
12732
12733 -fdump-rtl-sched1
12734 -fdump-rtl-sched2
12735 -fdump-rtl-sched1 and -fdump-rtl-sched2 enable dumping after
12736 the basic block scheduling passes.
12737
12738 -fdump-rtl-ree
12739 Dump after sign/zero extension elimination.
12740
12741 -fdump-rtl-seqabstr
12742 Dump after common sequence discovery.
12743
12744 -fdump-rtl-shorten
12745 Dump after shortening branches.
12746
12747 -fdump-rtl-sibling
12748 Dump after sibling call optimizations.
12749
12750 -fdump-rtl-split1
12751 -fdump-rtl-split2
12752 -fdump-rtl-split3
12753 -fdump-rtl-split4
12754 -fdump-rtl-split5
12755 These options enable dumping after five rounds of instruction
12756 splitting.
12757
12758 -fdump-rtl-sms
12759 Dump after modulo scheduling. This pass is only run on some
12760 architectures.
12761
12762 -fdump-rtl-stack
12763 Dump after conversion from GCC's "flat register file" registers
12764 to the x87's stack-like registers. This pass is only run on
12765 x86 variants.
12766
12767 -fdump-rtl-subreg1
12768 -fdump-rtl-subreg2
12769 -fdump-rtl-subreg1 and -fdump-rtl-subreg2 enable dumping after
12770 the two subreg expansion passes.
12771
12772 -fdump-rtl-unshare
12773 Dump after all rtl has been unshared.
12774
12775 -fdump-rtl-vartrack
12776 Dump after variable tracking.
12777
12778 -fdump-rtl-vregs
12779 Dump after converting virtual registers to hard registers.
12780
12781 -fdump-rtl-web
12782 Dump after live range splitting.
12783
12784 -fdump-rtl-regclass
12785 -fdump-rtl-subregs_of_mode_init
12786 -fdump-rtl-subregs_of_mode_finish
12787 -fdump-rtl-dfinit
12788 -fdump-rtl-dfinish
12789 These dumps are defined but always produce empty files.
12790
12791 -da
12792 -fdump-rtl-all
12793 Produce all the dumps listed above.
12794
12795 -dA Annotate the assembler output with miscellaneous debugging
12796 information.
12797
12798 -dD Dump all macro definitions, at the end of preprocessing, in
12799 addition to normal output.
12800
12801 -dH Produce a core dump whenever an error occurs.
12802
12803 -dp Annotate the assembler output with a comment indicating which
12804 pattern and alternative is used. The length and cost of each
12805 instruction are also printed.
12806
12807 -dP Dump the RTL in the assembler output as a comment before each
12808 instruction. Also turns on -dp annotation.
12809
12810 -dx Just generate RTL for a function instead of compiling it.
12811 Usually used with -fdump-rtl-expand.
12812
12813 -fdump-debug
12814 Dump debugging information generated during the debug generation
12815 phase.
12816
12817 -fdump-earlydebug
12818 Dump debugging information generated during the early debug
12819 generation phase.
12820
12821 -fdump-noaddr
12822 When doing debugging dumps, suppress address output. This makes it
12823 more feasible to use diff on debugging dumps for compiler
12824 invocations with different compiler binaries and/or different text
12825 / bss / data / heap / stack / dso start locations.
12826
12827 -freport-bug
12828 Collect and dump debug information into a temporary file if an
12829 internal compiler error (ICE) occurs.
12830
12831 -fdump-unnumbered
12832 When doing debugging dumps, suppress instruction numbers and
12833 address output. This makes it more feasible to use diff on
12834 debugging dumps for compiler invocations with different options, in
12835 particular with and without -g.
12836
12837 -fdump-unnumbered-links
12838 When doing debugging dumps (see -d option above), suppress
12839 instruction numbers for the links to the previous and next
12840 instructions in a sequence.
12841
12842 -fdump-ipa-switch
12843 -fdump-ipa-switch-options
12844 Control the dumping at various stages of inter-procedural analysis
12845 language tree to a file. The file name is generated by appending a
12846 switch specific suffix to the source file name, and the file is
12847 created in the same directory as the output file. The following
12848 dumps are possible:
12849
12850 all Enables all inter-procedural analysis dumps.
12851
12852 cgraph
12853 Dumps information about call-graph optimization, unused
12854 function removal, and inlining decisions.
12855
12856 inline
12857 Dump after function inlining.
12858
12859 Additionally, the options -optimized, -missed, -note, and -all can
12860 be provided, with the same meaning as for -fopt-info, defaulting to
12861 -optimized.
12862
12863 For example, -fdump-ipa-inline-optimized-missed will emit
12864 information on callsites that were inlined, along with callsites
12865 that were not inlined.
12866
12867 By default, the dump will contain messages about successful
12868 optimizations (equivalent to -optimized) together with low-level
12869 details about the analysis.
12870
12871 -fdump-lang-all
12872 -fdump-lang-switch
12873 -fdump-lang-switch-options
12874 -fdump-lang-switch-options=filename
12875 Control the dumping of language-specific information. The options
12876 and filename portions behave as described in the -fdump-tree
12877 option. The following switch values are accepted:
12878
12879 all Enable all language-specific dumps.
12880
12881 class
12882 Dump class hierarchy information. Virtual table information is
12883 emitted unless 'slim' is specified. This option is applicable
12884 to C++ only.
12885
12886 raw Dump the raw internal tree data. This option is applicable to
12887 C++ only.
12888
12889 -fdump-passes
12890 Print on stderr the list of optimization passes that are turned on
12891 and off by the current command-line options.
12892
12893 -fdump-statistics-option
12894 Enable and control dumping of pass statistics in a separate file.
12895 The file name is generated by appending a suffix ending in
12896 .statistics to the source file name, and the file is created in the
12897 same directory as the output file. If the -option form is used,
12898 -stats causes counters to be summed over the whole compilation unit
12899 while -details dumps every event as the passes generate them. The
12900 default with no option is to sum counters for each function
12901 compiled.
12902
12903 -fdump-tree-all
12904 -fdump-tree-switch
12905 -fdump-tree-switch-options
12906 -fdump-tree-switch-options=filename
12907 Control the dumping at various stages of processing the
12908 intermediate language tree to a file. If the -options form is
12909 used, options is a list of - separated options which control the
12910 details of the dump. Not all options are applicable to all dumps;
12911 those that are not meaningful are ignored. The following options
12912 are available
12913
12914 address
12915 Print the address of each node. Usually this is not meaningful
12916 as it changes according to the environment and source file.
12917 Its primary use is for tying up a dump file with a debug
12918 environment.
12919
12920 asmname
12921 If "DECL_ASSEMBLER_NAME" has been set for a given decl, use
12922 that in the dump instead of "DECL_NAME". Its primary use is
12923 ease of use working backward from mangled names in the assembly
12924 file.
12925
12926 slim
12927 When dumping front-end intermediate representations, inhibit
12928 dumping of members of a scope or body of a function merely
12929 because that scope has been reached. Only dump such items when
12930 they are directly reachable by some other path.
12931
12932 When dumping pretty-printed trees, this option inhibits dumping
12933 the bodies of control structures.
12934
12935 When dumping RTL, print the RTL in slim (condensed) form
12936 instead of the default LISP-like representation.
12937
12938 raw Print a raw representation of the tree. By default, trees are
12939 pretty-printed into a C-like representation.
12940
12941 details
12942 Enable more detailed dumps (not honored by every dump option).
12943 Also include information from the optimization passes.
12944
12945 stats
12946 Enable dumping various statistics about the pass (not honored
12947 by every dump option).
12948
12949 blocks
12950 Enable showing basic block boundaries (disabled in raw dumps).
12951
12952 graph
12953 For each of the other indicated dump files (-fdump-rtl-pass),
12954 dump a representation of the control flow graph suitable for
12955 viewing with GraphViz to file.passid.pass.dot. Each function
12956 in the file is pretty-printed as a subgraph, so that GraphViz
12957 can render them all in a single plot.
12958
12959 This option currently only works for RTL dumps, and the RTL is
12960 always dumped in slim form.
12961
12962 vops
12963 Enable showing virtual operands for every statement.
12964
12965 lineno
12966 Enable showing line numbers for statements.
12967
12968 uid Enable showing the unique ID ("DECL_UID") for each variable.
12969
12970 verbose
12971 Enable showing the tree dump for each statement.
12972
12973 eh Enable showing the EH region number holding each statement.
12974
12975 scev
12976 Enable showing scalar evolution analysis details.
12977
12978 optimized
12979 Enable showing optimization information (only available in
12980 certain passes).
12981
12982 missed
12983 Enable showing missed optimization information (only available
12984 in certain passes).
12985
12986 note
12987 Enable other detailed optimization information (only available
12988 in certain passes).
12989
12990 all Turn on all options, except raw, slim, verbose and lineno.
12991
12992 optall
12993 Turn on all optimization options, i.e., optimized, missed, and
12994 note.
12995
12996 To determine what tree dumps are available or find the dump for a
12997 pass of interest follow the steps below.
12998
12999 1. Invoke GCC with -fdump-passes and in the stderr output look for
13000 a code that corresponds to the pass you are interested in. For
13001 example, the codes "tree-evrp", "tree-vrp1", and "tree-vrp2"
13002 correspond to the three Value Range Propagation passes. The
13003 number at the end distinguishes distinct invocations of the
13004 same pass.
13005
13006 2. To enable the creation of the dump file, append the pass code
13007 to the -fdump- option prefix and invoke GCC with it. For
13008 example, to enable the dump from the Early Value Range
13009 Propagation pass, invoke GCC with the -fdump-tree-evrp option.
13010 Optionally, you may specify the name of the dump file. If you
13011 don't specify one, GCC creates as described below.
13012
13013 3. Find the pass dump in a file whose name is composed of three
13014 components separated by a period: the name of the source file
13015 GCC was invoked to compile, a numeric suffix indicating the
13016 pass number followed by the letter t for tree passes (and the
13017 letter r for RTL passes), and finally the pass code. For
13018 example, the Early VRP pass dump might be in a file named
13019 myfile.c.038t.evrp in the current working directory. Note that
13020 the numeric codes are not stable and may change from one
13021 version of GCC to another.
13022
13023 -fopt-info
13024 -fopt-info-options
13025 -fopt-info-options=filename
13026 Controls optimization dumps from various optimization passes. If
13027 the -options form is used, options is a list of - separated option
13028 keywords to select the dump details and optimizations.
13029
13030 The options can be divided into three groups:
13031
13032 1. options describing what kinds of messages should be emitted,
13033
13034 2. options describing the verbosity of the dump, and
13035
13036 3. options describing which optimizations should be included.
13037
13038 The options from each group can be freely mixed as they are non-
13039 overlapping. However, in case of any conflicts, the later options
13040 override the earlier options on the command line.
13041
13042 The following options control which kinds of messages should be
13043 emitted:
13044
13045 optimized
13046 Print information when an optimization is successfully applied.
13047 It is up to a pass to decide which information is relevant. For
13048 example, the vectorizer passes print the source location of
13049 loops which are successfully vectorized.
13050
13051 missed
13052 Print information about missed optimizations. Individual passes
13053 control which information to include in the output.
13054
13055 note
13056 Print verbose information about optimizations, such as certain
13057 transformations, more detailed messages about decisions etc.
13058
13059 all Print detailed optimization information. This includes
13060 optimized, missed, and note.
13061
13062 The following option controls the dump verbosity:
13063
13064 internals
13065 By default, only "high-level" messages are emitted. This option
13066 enables additional, more detailed, messages, which are likely
13067 to only be of interest to GCC developers.
13068
13069 One or more of the following option keywords can be used to
13070 describe a group of optimizations:
13071
13072 ipa Enable dumps from all interprocedural optimizations.
13073
13074 loop
13075 Enable dumps from all loop optimizations.
13076
13077 inline
13078 Enable dumps from all inlining optimizations.
13079
13080 omp Enable dumps from all OMP (Offloading and Multi Processing)
13081 optimizations.
13082
13083 vec Enable dumps from all vectorization optimizations.
13084
13085 optall
13086 Enable dumps from all optimizations. This is a superset of the
13087 optimization groups listed above.
13088
13089 If options is omitted, it defaults to optimized-optall, which means
13090 to dump messages about successful optimizations from all the
13091 passes, omitting messages that are treated as "internals".
13092
13093 If the filename is provided, then the dumps from all the applicable
13094 optimizations are concatenated into the filename. Otherwise the
13095 dump is output onto stderr. Though multiple -fopt-info options are
13096 accepted, only one of them can include a filename. If other
13097 filenames are provided then all but the first such option are
13098 ignored.
13099
13100 Note that the output filename is overwritten in case of multiple
13101 translation units. If a combined output from multiple translation
13102 units is desired, stderr should be used instead.
13103
13104 In the following example, the optimization info is output to
13105 stderr:
13106
13107 gcc -O3 -fopt-info
13108
13109 This example:
13110
13111 gcc -O3 -fopt-info-missed=missed.all
13112
13113 outputs missed optimization report from all the passes into
13114 missed.all, and this one:
13115
13116 gcc -O2 -ftree-vectorize -fopt-info-vec-missed
13117
13118 prints information about missed optimization opportunities from
13119 vectorization passes on stderr. Note that -fopt-info-vec-missed is
13120 equivalent to -fopt-info-missed-vec. The order of the optimization
13121 group names and message types listed after -fopt-info does not
13122 matter.
13123
13124 As another example,
13125
13126 gcc -O3 -fopt-info-inline-optimized-missed=inline.txt
13127
13128 outputs information about missed optimizations as well as optimized
13129 locations from all the inlining passes into inline.txt.
13130
13131 Finally, consider:
13132
13133 gcc -fopt-info-vec-missed=vec.miss -fopt-info-loop-optimized=loop.opt
13134
13135 Here the two output filenames vec.miss and loop.opt are in conflict
13136 since only one output file is allowed. In this case, only the first
13137 option takes effect and the subsequent options are ignored. Thus
13138 only vec.miss is produced which contains dumps from the vectorizer
13139 about missed opportunities.
13140
13141 -fsave-optimization-record
13142 Write a SRCFILE.opt-record.json.gz file detailing what
13143 optimizations were performed, for those optimizations that support
13144 -fopt-info.
13145
13146 This option is experimental and the format of the data within the
13147 compressed JSON file is subject to change.
13148
13149 It is roughly equivalent to a machine-readable version of
13150 -fopt-info-all, as a collection of messages with source file, line
13151 number and column number, with the following additional data for
13152 each message:
13153
13154 * the execution count of the code being optimized, along with
13155 metadata about whether this was from actual profile data, or
13156 just an estimate, allowing consumers to prioritize messages by
13157 code hotness,
13158
13159 * the function name of the code being optimized, where
13160 applicable,
13161
13162 * the "inlining chain" for the code being optimized, so that when
13163 a function is inlined into several different places (which
13164 might themselves be inlined), the reader can distinguish
13165 between the copies,
13166
13167 * objects identifying those parts of the message that refer to
13168 expressions, statements or symbol-table nodes, which of these
13169 categories they are, and, when available, their source code
13170 location,
13171
13172 * the GCC pass that emitted the message, and
13173
13174 * the location in GCC's own code from which the message was
13175 emitted
13176
13177 Additionally, some messages are logically nested within other
13178 messages, reflecting implementation details of the optimization
13179 passes.
13180
13181 -fsched-verbose=n
13182 On targets that use instruction scheduling, this option controls
13183 the amount of debugging output the scheduler prints to the dump
13184 files.
13185
13186 For n greater than zero, -fsched-verbose outputs the same
13187 information as -fdump-rtl-sched1 and -fdump-rtl-sched2. For n
13188 greater than one, it also output basic block probabilities,
13189 detailed ready list information and unit/insn info. For n greater
13190 than two, it includes RTL at abort point, control-flow and regions
13191 info. And for n over four, -fsched-verbose also includes
13192 dependence info.
13193
13194 -fenable-kind-pass
13195 -fdisable-kind-pass=range-list
13196 This is a set of options that are used to explicitly disable/enable
13197 optimization passes. These options are intended for use for
13198 debugging GCC. Compiler users should use regular options for
13199 enabling/disabling passes instead.
13200
13201 -fdisable-ipa-pass
13202 Disable IPA pass pass. pass is the pass name. If the same pass
13203 is statically invoked in the compiler multiple times, the pass
13204 name should be appended with a sequential number starting from
13205 1.
13206
13207 -fdisable-rtl-pass
13208 -fdisable-rtl-pass=range-list
13209 Disable RTL pass pass. pass is the pass name. If the same
13210 pass is statically invoked in the compiler multiple times, the
13211 pass name should be appended with a sequential number starting
13212 from 1. range-list is a comma-separated list of function
13213 ranges or assembler names. Each range is a number pair
13214 separated by a colon. The range is inclusive in both ends. If
13215 the range is trivial, the number pair can be simplified as a
13216 single number. If the function's call graph node's uid falls
13217 within one of the specified ranges, the pass is disabled for
13218 that function. The uid is shown in the function header of a
13219 dump file, and the pass names can be dumped by using option
13220 -fdump-passes.
13221
13222 -fdisable-tree-pass
13223 -fdisable-tree-pass=range-list
13224 Disable tree pass pass. See -fdisable-rtl for the description
13225 of option arguments.
13226
13227 -fenable-ipa-pass
13228 Enable IPA pass pass. pass is the pass name. If the same pass
13229 is statically invoked in the compiler multiple times, the pass
13230 name should be appended with a sequential number starting from
13231 1.
13232
13233 -fenable-rtl-pass
13234 -fenable-rtl-pass=range-list
13235 Enable RTL pass pass. See -fdisable-rtl for option argument
13236 description and examples.
13237
13238 -fenable-tree-pass
13239 -fenable-tree-pass=range-list
13240 Enable tree pass pass. See -fdisable-rtl for the description
13241 of option arguments.
13242
13243 Here are some examples showing uses of these options.
13244
13245 # disable ccp1 for all functions
13246 -fdisable-tree-ccp1
13247 # disable complete unroll for function whose cgraph node uid is 1
13248 -fenable-tree-cunroll=1
13249 # disable gcse2 for functions at the following ranges [1,1],
13250 # [300,400], and [400,1000]
13251 # disable gcse2 for functions foo and foo2
13252 -fdisable-rtl-gcse2=foo,foo2
13253 # disable early inlining
13254 -fdisable-tree-einline
13255 # disable ipa inlining
13256 -fdisable-ipa-inline
13257 # enable tree full unroll
13258 -fenable-tree-unroll
13259
13260 -fchecking
13261 -fchecking=n
13262 Enable internal consistency checking. The default depends on the
13263 compiler configuration. -fchecking=2 enables further internal
13264 consistency checking that might affect code generation.
13265
13266 -frandom-seed=string
13267 This option provides a seed that GCC uses in place of random
13268 numbers in generating certain symbol names that have to be
13269 different in every compiled file. It is also used to place unique
13270 stamps in coverage data files and the object files that produce
13271 them. You can use the -frandom-seed option to produce reproducibly
13272 identical object files.
13273
13274 The string can either be a number (decimal, octal or hex) or an
13275 arbitrary string (in which case it's converted to a number by
13276 computing CRC32).
13277
13278 The string should be different for every file you compile.
13279
13280 -save-temps
13281 -save-temps=cwd
13282 Store the usual "temporary" intermediate files permanently; place
13283 them in the current directory and name them based on the source
13284 file. Thus, compiling foo.c with -c -save-temps produces files
13285 foo.i and foo.s, as well as foo.o. This creates a preprocessed
13286 foo.i output file even though the compiler now normally uses an
13287 integrated preprocessor.
13288
13289 When used in combination with the -x command-line option,
13290 -save-temps is sensible enough to avoid over writing an input
13291 source file with the same extension as an intermediate file. The
13292 corresponding intermediate file may be obtained by renaming the
13293 source file before using -save-temps.
13294
13295 If you invoke GCC in parallel, compiling several different source
13296 files that share a common base name in different subdirectories or
13297 the same source file compiled for multiple output destinations, it
13298 is likely that the different parallel compilers will interfere with
13299 each other, and overwrite the temporary files. For instance:
13300
13301 gcc -save-temps -o outdir1/foo.o indir1/foo.c&
13302 gcc -save-temps -o outdir2/foo.o indir2/foo.c&
13303
13304 may result in foo.i and foo.o being written to simultaneously by
13305 both compilers.
13306
13307 -save-temps=obj
13308 Store the usual "temporary" intermediate files permanently. If the
13309 -o option is used, the temporary files are based on the object
13310 file. If the -o option is not used, the -save-temps=obj switch
13311 behaves like -save-temps.
13312
13313 For example:
13314
13315 gcc -save-temps=obj -c foo.c
13316 gcc -save-temps=obj -c bar.c -o dir/xbar.o
13317 gcc -save-temps=obj foobar.c -o dir2/yfoobar
13318
13319 creates foo.i, foo.s, dir/xbar.i, dir/xbar.s, dir2/yfoobar.i,
13320 dir2/yfoobar.s, and dir2/yfoobar.o.
13321
13322 -time[=file]
13323 Report the CPU time taken by each subprocess in the compilation
13324 sequence. For C source files, this is the compiler proper and
13325 assembler (plus the linker if linking is done).
13326
13327 Without the specification of an output file, the output looks like
13328 this:
13329
13330 # cc1 0.12 0.01
13331 # as 0.00 0.01
13332
13333 The first number on each line is the "user time", that is time
13334 spent executing the program itself. The second number is "system
13335 time", time spent executing operating system routines on behalf of
13336 the program. Both numbers are in seconds.
13337
13338 With the specification of an output file, the output is appended to
13339 the named file, and it looks like this:
13340
13341 0.12 0.01 cc1 <options>
13342 0.00 0.01 as <options>
13343
13344 The "user time" and the "system time" are moved before the program
13345 name, and the options passed to the program are displayed, so that
13346 one can later tell what file was being compiled, and with which
13347 options.
13348
13349 -fdump-final-insns[=file]
13350 Dump the final internal representation (RTL) to file. If the
13351 optional argument is omitted (or if file is "."), the name of the
13352 dump file is determined by appending ".gkd" to the compilation
13353 output file name.
13354
13355 -fcompare-debug[=opts]
13356 If no error occurs during compilation, run the compiler a second
13357 time, adding opts and -fcompare-debug-second to the arguments
13358 passed to the second compilation. Dump the final internal
13359 representation in both compilations, and print an error if they
13360 differ.
13361
13362 If the equal sign is omitted, the default -gtoggle is used.
13363
13364 The environment variable GCC_COMPARE_DEBUG, if defined, non-empty
13365 and nonzero, implicitly enables -fcompare-debug. If
13366 GCC_COMPARE_DEBUG is defined to a string starting with a dash, then
13367 it is used for opts, otherwise the default -gtoggle is used.
13368
13369 -fcompare-debug=, with the equal sign but without opts, is
13370 equivalent to -fno-compare-debug, which disables the dumping of the
13371 final representation and the second compilation, preventing even
13372 GCC_COMPARE_DEBUG from taking effect.
13373
13374 To verify full coverage during -fcompare-debug testing, set
13375 GCC_COMPARE_DEBUG to say -fcompare-debug-not-overridden, which GCC
13376 rejects as an invalid option in any actual compilation (rather than
13377 preprocessing, assembly or linking). To get just a warning,
13378 setting GCC_COMPARE_DEBUG to -w%n-fcompare-debug not overridden
13379 will do.
13380
13381 -fcompare-debug-second
13382 This option is implicitly passed to the compiler for the second
13383 compilation requested by -fcompare-debug, along with options to
13384 silence warnings, and omitting other options that would cause the
13385 compiler to produce output to files or to standard output as a side
13386 effect. Dump files and preserved temporary files are renamed so as
13387 to contain the ".gk" additional extension during the second
13388 compilation, to avoid overwriting those generated by the first.
13389
13390 When this option is passed to the compiler driver, it causes the
13391 first compilation to be skipped, which makes it useful for little
13392 other than debugging the compiler proper.
13393
13394 -gtoggle
13395 Turn off generation of debug info, if leaving out this option
13396 generates it, or turn it on at level 2 otherwise. The position of
13397 this argument in the command line does not matter; it takes effect
13398 after all other options are processed, and it does so only once, no
13399 matter how many times it is given. This is mainly intended to be
13400 used with -fcompare-debug.
13401
13402 -fvar-tracking-assignments-toggle
13403 Toggle -fvar-tracking-assignments, in the same way that -gtoggle
13404 toggles -g.
13405
13406 -Q Makes the compiler print out each function name as it is compiled,
13407 and print some statistics about each pass when it finishes.
13408
13409 -ftime-report
13410 Makes the compiler print some statistics about the time consumed by
13411 each pass when it finishes.
13412
13413 -ftime-report-details
13414 Record the time consumed by infrastructure parts separately for
13415 each pass.
13416
13417 -fira-verbose=n
13418 Control the verbosity of the dump file for the integrated register
13419 allocator. The default value is 5. If the value n is greater or
13420 equal to 10, the dump output is sent to stderr using the same
13421 format as n minus 10.
13422
13423 -flto-report
13424 Prints a report with internal details on the workings of the link-
13425 time optimizer. The contents of this report vary from version to
13426 version. It is meant to be useful to GCC developers when
13427 processing object files in LTO mode (via -flto).
13428
13429 Disabled by default.
13430
13431 -flto-report-wpa
13432 Like -flto-report, but only print for the WPA phase of Link Time
13433 Optimization.
13434
13435 -fmem-report
13436 Makes the compiler print some statistics about permanent memory
13437 allocation when it finishes.
13438
13439 -fmem-report-wpa
13440 Makes the compiler print some statistics about permanent memory
13441 allocation for the WPA phase only.
13442
13443 -fpre-ipa-mem-report
13444 -fpost-ipa-mem-report
13445 Makes the compiler print some statistics about permanent memory
13446 allocation before or after interprocedural optimization.
13447
13448 -fprofile-report
13449 Makes the compiler print some statistics about consistency of the
13450 (estimated) profile and effect of individual passes.
13451
13452 -fstack-usage
13453 Makes the compiler output stack usage information for the program,
13454 on a per-function basis. The filename for the dump is made by
13455 appending .su to the auxname. auxname is generated from the name
13456 of the output file, if explicitly specified and it is not an
13457 executable, otherwise it is the basename of the source file. An
13458 entry is made up of three fields:
13459
13460 * The name of the function.
13461
13462 * A number of bytes.
13463
13464 * One or more qualifiers: "static", "dynamic", "bounded".
13465
13466 The qualifier "static" means that the function manipulates the
13467 stack statically: a fixed number of bytes are allocated for the
13468 frame on function entry and released on function exit; no stack
13469 adjustments are otherwise made in the function. The second field
13470 is this fixed number of bytes.
13471
13472 The qualifier "dynamic" means that the function manipulates the
13473 stack dynamically: in addition to the static allocation described
13474 above, stack adjustments are made in the body of the function, for
13475 example to push/pop arguments around function calls. If the
13476 qualifier "bounded" is also present, the amount of these
13477 adjustments is bounded at compile time and the second field is an
13478 upper bound of the total amount of stack used by the function. If
13479 it is not present, the amount of these adjustments is not bounded
13480 at compile time and the second field only represents the bounded
13481 part.
13482
13483 -fstats
13484 Emit statistics about front-end processing at the end of the
13485 compilation. This option is supported only by the C++ front end,
13486 and the information is generally only useful to the G++ development
13487 team.
13488
13489 -fdbg-cnt-list
13490 Print the name and the counter upper bound for all debug counters.
13491
13492 -fdbg-cnt=counter-value-list
13493 Set the internal debug counter lower and upper bound. counter-
13494 value-list is a comma-separated list of
13495 name:lower_bound:upper_bound tuples which sets the lower and the
13496 upper bound of each debug counter name. The lower_bound is
13497 optional and is zero initialized if not set. All debug counters
13498 have the initial upper bound of "UINT_MAX"; thus "dbg_cnt" returns
13499 true always unless the upper bound is set by this option. For
13500 example, with -fdbg-cnt=dce:2:4,tail_call:10, "dbg_cnt(dce)"
13501 returns true only for third and fourth invocation. For
13502 "dbg_cnt(tail_call)" true is returned for first 10 invocations.
13503
13504 -print-file-name=library
13505 Print the full absolute name of the library file library that would
13506 be used when linking---and don't do anything else. With this
13507 option, GCC does not compile or link anything; it just prints the
13508 file name.
13509
13510 -print-multi-directory
13511 Print the directory name corresponding to the multilib selected by
13512 any other switches present in the command line. This directory is
13513 supposed to exist in GCC_EXEC_PREFIX.
13514
13515 -print-multi-lib
13516 Print the mapping from multilib directory names to compiler
13517 switches that enable them. The directory name is separated from
13518 the switches by ;, and each switch starts with an @ instead of the
13519 -, without spaces between multiple switches. This is supposed to
13520 ease shell processing.
13521
13522 -print-multi-os-directory
13523 Print the path to OS libraries for the selected multilib, relative
13524 to some lib subdirectory. If OS libraries are present in the lib
13525 subdirectory and no multilibs are used, this is usually just ., if
13526 OS libraries are present in libsuffix sibling directories this
13527 prints e.g. ../lib64, ../lib or ../lib32, or if OS libraries are
13528 present in lib/subdir subdirectories it prints e.g. amd64, sparcv9
13529 or ev6.
13530
13531 -print-multiarch
13532 Print the path to OS libraries for the selected multiarch, relative
13533 to some lib subdirectory.
13534
13535 -print-prog-name=program
13536 Like -print-file-name, but searches for a program such as cpp.
13537
13538 -print-libgcc-file-name
13539 Same as -print-file-name=libgcc.a.
13540
13541 This is useful when you use -nostdlib or -nodefaultlibs but you do
13542 want to link with libgcc.a. You can do:
13543
13544 gcc -nostdlib <files>... `gcc -print-libgcc-file-name`
13545
13546 -print-search-dirs
13547 Print the name of the configured installation directory and a list
13548 of program and library directories gcc searches---and don't do
13549 anything else.
13550
13551 This is useful when gcc prints the error message installation
13552 problem, cannot exec cpp0: No such file or directory. To resolve
13553 this you either need to put cpp0 and the other compiler components
13554 where gcc expects to find them, or you can set the environment
13555 variable GCC_EXEC_PREFIX to the directory where you installed them.
13556 Don't forget the trailing /.
13557
13558 -print-sysroot
13559 Print the target sysroot directory that is used during compilation.
13560 This is the target sysroot specified either at configure time or
13561 using the --sysroot option, possibly with an extra suffix that
13562 depends on compilation options. If no target sysroot is specified,
13563 the option prints nothing.
13564
13565 -print-sysroot-headers-suffix
13566 Print the suffix added to the target sysroot when searching for
13567 headers, or give an error if the compiler is not configured with
13568 such a suffix---and don't do anything else.
13569
13570 -dumpmachine
13571 Print the compiler's target machine (for example,
13572 i686-pc-linux-gnu)---and don't do anything else.
13573
13574 -dumpversion
13575 Print the compiler version (for example, 3.0, 6.3.0 or 7)---and
13576 don't do anything else. This is the compiler version used in
13577 filesystem paths and specs. Depending on how the compiler has been
13578 configured it can be just a single number (major version), two
13579 numbers separated by a dot (major and minor version) or three
13580 numbers separated by dots (major, minor and patchlevel version).
13581
13582 -dumpfullversion
13583 Print the full compiler version---and don't do anything else. The
13584 output is always three numbers separated by dots, major, minor and
13585 patchlevel version.
13586
13587 -dumpspecs
13588 Print the compiler's built-in specs---and don't do anything else.
13589 (This is used when GCC itself is being built.)
13590
13591 Machine-Dependent Options
13592 Each target machine supported by GCC can have its own options---for
13593 example, to allow you to compile for a particular processor variant or
13594 ABI, or to control optimizations specific to that machine. By
13595 convention, the names of machine-specific options start with -m.
13596
13597 Some configurations of the compiler also support additional target-
13598 specific options, usually for compatibility with other compilers on the
13599 same platform.
13600
13601 AArch64 Options
13602
13603 These options are defined for AArch64 implementations:
13604
13605 -mabi=name
13606 Generate code for the specified data model. Permissible values are
13607 ilp32 for SysV-like data model where int, long int and pointers are
13608 32 bits, and lp64 for SysV-like data model where int is 32 bits,
13609 but long int and pointers are 64 bits.
13610
13611 The default depends on the specific target configuration. Note
13612 that the LP64 and ILP32 ABIs are not link-compatible; you must
13613 compile your entire program with the same ABI, and link with a
13614 compatible set of libraries.
13615
13616 -mbig-endian
13617 Generate big-endian code. This is the default when GCC is
13618 configured for an aarch64_be-*-* target.
13619
13620 -mgeneral-regs-only
13621 Generate code which uses only the general-purpose registers. This
13622 will prevent the compiler from using floating-point and Advanced
13623 SIMD registers but will not impose any restrictions on the
13624 assembler.
13625
13626 -mlittle-endian
13627 Generate little-endian code. This is the default when GCC is
13628 configured for an aarch64-*-* but not an aarch64_be-*-* target.
13629
13630 -mcmodel=tiny
13631 Generate code for the tiny code model. The program and its
13632 statically defined symbols must be within 1MB of each other.
13633 Programs can be statically or dynamically linked.
13634
13635 -mcmodel=small
13636 Generate code for the small code model. The program and its
13637 statically defined symbols must be within 4GB of each other.
13638 Programs can be statically or dynamically linked. This is the
13639 default code model.
13640
13641 -mcmodel=large
13642 Generate code for the large code model. This makes no assumptions
13643 about addresses and sizes of sections. Programs can be statically
13644 linked only.
13645
13646 -mstrict-align
13647 -mno-strict-align
13648 Avoid or allow generating memory accesses that may not be aligned
13649 on a natural object boundary as described in the architecture
13650 specification.
13651
13652 -momit-leaf-frame-pointer
13653 -mno-omit-leaf-frame-pointer
13654 Omit or keep the frame pointer in leaf functions. The former
13655 behavior is the default.
13656
13657 -mstack-protector-guard=guard
13658 -mstack-protector-guard-reg=reg
13659 -mstack-protector-guard-offset=offset
13660 Generate stack protection code using canary at guard. Supported
13661 locations are global for a global canary or sysreg for a canary in
13662 an appropriate system register.
13663
13664 With the latter choice the options -mstack-protector-guard-reg=reg
13665 and -mstack-protector-guard-offset=offset furthermore specify which
13666 system register to use as base register for reading the canary, and
13667 from what offset from that base register. There is no default
13668 register or offset as this is entirely for use within the Linux
13669 kernel.
13670
13671 -mstack-protector-guard=guard
13672 -mstack-protector-guard-reg=reg
13673 -mstack-protector-guard-offset=offset
13674 Generate stack protection code using canary at guard. Supported
13675 locations are global for a global canary or sysreg for a canary in
13676 an appropriate system register.
13677
13678 With the latter choice the options -mstack-protector-guard-reg=reg
13679 and -mstack-protector-guard-offset=offset furthermore specify which
13680 system register to use as base register for reading the canary, and
13681 from what offset from that base register. There is no default
13682 register or offset as this is entirely for use within the Linux
13683 kernel.
13684
13685 -mtls-dialect=desc
13686 Use TLS descriptors as the thread-local storage mechanism for
13687 dynamic accesses of TLS variables. This is the default.
13688
13689 -mtls-dialect=traditional
13690 Use traditional TLS as the thread-local storage mechanism for
13691 dynamic accesses of TLS variables.
13692
13693 -mtls-size=size
13694 Specify bit size of immediate TLS offsets. Valid values are 12,
13695 24, 32, 48. This option requires binutils 2.26 or newer.
13696
13697 -mfix-cortex-a53-835769
13698 -mno-fix-cortex-a53-835769
13699 Enable or disable the workaround for the ARM Cortex-A53 erratum
13700 number 835769. This involves inserting a NOP instruction between
13701 memory instructions and 64-bit integer multiply-accumulate
13702 instructions.
13703
13704 -mfix-cortex-a53-843419
13705 -mno-fix-cortex-a53-843419
13706 Enable or disable the workaround for the ARM Cortex-A53 erratum
13707 number 843419. This erratum workaround is made at link time and
13708 this will only pass the corresponding flag to the linker.
13709
13710 -mlow-precision-recip-sqrt
13711 -mno-low-precision-recip-sqrt
13712 Enable or disable the reciprocal square root approximation. This
13713 option only has an effect if -ffast-math or
13714 -funsafe-math-optimizations is used as well. Enabling this reduces
13715 precision of reciprocal square root results to about 16 bits for
13716 single precision and to 32 bits for double precision.
13717
13718 -mlow-precision-sqrt
13719 -mno-low-precision-sqrt
13720 Enable or disable the square root approximation. This option only
13721 has an effect if -ffast-math or -funsafe-math-optimizations is used
13722 as well. Enabling this reduces precision of square root results to
13723 about 16 bits for single precision and to 32 bits for double
13724 precision. If enabled, it implies -mlow-precision-recip-sqrt.
13725
13726 -mlow-precision-div
13727 -mno-low-precision-div
13728 Enable or disable the division approximation. This option only has
13729 an effect if -ffast-math or -funsafe-math-optimizations is used as
13730 well. Enabling this reduces precision of division results to about
13731 16 bits for single precision and to 32 bits for double precision.
13732
13733 -mtrack-speculation
13734 -mno-track-speculation
13735 Enable or disable generation of additional code to track
13736 speculative execution through conditional branches. The tracking
13737 state can then be used by the compiler when expanding calls to
13738 "__builtin_speculation_safe_copy" to permit a more efficient code
13739 sequence to be generated.
13740
13741 -march=name
13742 Specify the name of the target architecture and, optionally, one or
13743 more feature modifiers. This option has the form
13744 -march=arch{+[no]feature}*.
13745
13746 The permissible values for arch are armv8-a, armv8.1-a, armv8.2-a,
13747 armv8.3-a, armv8.4-a, armv8.5-a or native.
13748
13749 The value armv8.5-a implies armv8.4-a and enables compiler support
13750 for the ARMv8.5-A architecture extensions.
13751
13752 The value armv8.4-a implies armv8.3-a and enables compiler support
13753 for the ARMv8.4-A architecture extensions.
13754
13755 The value armv8.3-a implies armv8.2-a and enables compiler support
13756 for the ARMv8.3-A architecture extensions.
13757
13758 The value armv8.2-a implies armv8.1-a and enables compiler support
13759 for the ARMv8.2-A architecture extensions.
13760
13761 The value armv8.1-a implies armv8-a and enables compiler support
13762 for the ARMv8.1-A architecture extension. In particular, it
13763 enables the +crc, +lse, and +rdma features.
13764
13765 The value native is available on native AArch64 GNU/Linux and
13766 causes the compiler to pick the architecture of the host system.
13767 This option has no effect if the compiler is unable to recognize
13768 the architecture of the host system,
13769
13770 The permissible values for feature are listed in the sub-section on
13771 aarch64-feature-modifiers,,-march and -mcpu Feature Modifiers.
13772 Where conflicting feature modifiers are specified, the right-most
13773 feature is used.
13774
13775 GCC uses name to determine what kind of instructions it can emit
13776 when generating assembly code. If -march is specified without
13777 either of -mtune or -mcpu also being specified, the code is tuned
13778 to perform well across a range of target processors implementing
13779 the target architecture.
13780
13781 -mtune=name
13782 Specify the name of the target processor for which GCC should tune
13783 the performance of the code. Permissible values for this option
13784 are: generic, cortex-a35, cortex-a53, cortex-a55, cortex-a57,
13785 cortex-a72, cortex-a73, cortex-a75, cortex-a76, ares, exynos-m1,
13786 emag, falkor, neoverse-e1,neoverse-n1,qdf24xx, saphira, phecda,
13787 xgene1, vulcan, octeontx, octeontx81, octeontx83, thunderx,
13788 thunderxt88, thunderxt88p1, thunderxt81, tsv110, thunderxt83,
13789 thunderx2t99, cortex-a57.cortex-a53, cortex-a72.cortex-a53,
13790 cortex-a73.cortex-a35, cortex-a73.cortex-a53,
13791 cortex-a75.cortex-a55, cortex-a76.cortex-a55 native.
13792
13793 The values cortex-a57.cortex-a53, cortex-a72.cortex-a53,
13794 cortex-a73.cortex-a35, cortex-a73.cortex-a53,
13795 cortex-a75.cortex-a55, cortex-a76.cortex-a55 specify that GCC
13796 should tune for a big.LITTLE system.
13797
13798 Additionally on native AArch64 GNU/Linux systems the value native
13799 tunes performance to the host system. This option has no effect if
13800 the compiler is unable to recognize the processor of the host
13801 system.
13802
13803 Where none of -mtune=, -mcpu= or -march= are specified, the code is
13804 tuned to perform well across a range of target processors.
13805
13806 This option cannot be suffixed by feature modifiers.
13807
13808 -mcpu=name
13809 Specify the name of the target processor, optionally suffixed by
13810 one or more feature modifiers. This option has the form
13811 -mcpu=cpu{+[no]feature}*, where the permissible values for cpu are
13812 the same as those available for -mtune. The permissible values for
13813 feature are documented in the sub-section on
13814 aarch64-feature-modifiers,,-march and -mcpu Feature Modifiers.
13815 Where conflicting feature modifiers are specified, the right-most
13816 feature is used.
13817
13818 GCC uses name to determine what kind of instructions it can emit
13819 when generating assembly code (as if by -march) and to determine
13820 the target processor for which to tune for performance (as if by
13821 -mtune). Where this option is used in conjunction with -march or
13822 -mtune, those options take precedence over the appropriate part of
13823 this option.
13824
13825 -moverride=string
13826 Override tuning decisions made by the back-end in response to a
13827 -mtune= switch. The syntax, semantics, and accepted values for
13828 string in this option are not guaranteed to be consistent across
13829 releases.
13830
13831 This option is only intended to be useful when developing GCC.
13832
13833 -mverbose-cost-dump
13834 Enable verbose cost model dumping in the debug dump files. This
13835 option is provided for use in debugging the compiler.
13836
13837 -mpc-relative-literal-loads
13838 -mno-pc-relative-literal-loads
13839 Enable or disable PC-relative literal loads. With this option
13840 literal pools are accessed using a single instruction and emitted
13841 after each function. This limits the maximum size of functions to
13842 1MB. This is enabled by default for -mcmodel=tiny.
13843
13844 -msign-return-address=scope
13845 Select the function scope on which return address signing will be
13846 applied. Permissible values are none, which disables return
13847 address signing, non-leaf, which enables pointer signing for
13848 functions which are not leaf functions, and all, which enables
13849 pointer signing for all functions. The default value is none. This
13850 option has been deprecated by -mbranch-protection.
13851
13852 -mbranch-protection=none|standard|pac-ret[+leaf]|bti
13853 Select the branch protection features to use. none is the default
13854 and turns off all types of branch protection. standard turns on
13855 all types of branch protection features. If a feature has
13856 additional tuning options, then standard sets it to its standard
13857 level. pac-ret[+leaf] turns on return address signing to its
13858 standard level: signing functions that save the return address to
13859 memory (non-leaf functions will practically always do this) using
13860 the a-key. The optional argument leaf can be used to extend the
13861 signing to include leaf functions. bti turns on branch target
13862 identification mechanism.
13863
13864 -msve-vector-bits=bits
13865 Specify the number of bits in an SVE vector register. This option
13866 only has an effect when SVE is enabled.
13867
13868 GCC supports two forms of SVE code generation: "vector-length
13869 agnostic" output that works with any size of vector register and
13870 "vector-length specific" output that allows GCC to make assumptions
13871 about the vector length when it is useful for optimization reasons.
13872 The possible values of bits are: scalable, 128, 256, 512, 1024 and
13873 2048. Specifying scalable selects vector-length agnostic output.
13874 At present -msve-vector-bits=128 also generates vector-length
13875 agnostic output. All other values generate vector-length specific
13876 code. The behavior of these values may change in future releases
13877 and no value except scalable should be relied on for producing code
13878 that is portable across different hardware SVE vector lengths.
13879
13880 The default is -msve-vector-bits=scalable, which produces vector-
13881 length agnostic code.
13882
13883 -march and -mcpu Feature Modifiers
13884
13885 Feature modifiers used with -march and -mcpu can be any of the
13886 following and their inverses nofeature:
13887
13888 crc Enable CRC extension. This is on by default for -march=armv8.1-a.
13889
13890 crypto
13891 Enable Crypto extension. This also enables Advanced SIMD and
13892 floating-point instructions.
13893
13894 fp Enable floating-point instructions. This is on by default for all
13895 possible values for options -march and -mcpu.
13896
13897 simd
13898 Enable Advanced SIMD instructions. This also enables floating-
13899 point instructions. This is on by default for all possible values
13900 for options -march and -mcpu.
13901
13902 sve Enable Scalable Vector Extension instructions. This also enables
13903 Advanced SIMD and floating-point instructions.
13904
13905 lse Enable Large System Extension instructions. This is on by default
13906 for -march=armv8.1-a.
13907
13908 rdma
13909 Enable Round Double Multiply Accumulate instructions. This is on
13910 by default for -march=armv8.1-a.
13911
13912 fp16
13913 Enable FP16 extension. This also enables floating-point
13914 instructions.
13915
13916 fp16fml
13917 Enable FP16 fmla extension. This also enables FP16 extensions and
13918 floating-point instructions. This option is enabled by default for
13919 -march=armv8.4-a. Use of this option with architectures prior to
13920 Armv8.2-A is not supported.
13921
13922 rcpc
13923 Enable the RcPc extension. This does not change code generation
13924 from GCC, but is passed on to the assembler, enabling inline asm
13925 statements to use instructions from the RcPc extension.
13926
13927 dotprod
13928 Enable the Dot Product extension. This also enables Advanced SIMD
13929 instructions.
13930
13931 aes Enable the Armv8-a aes and pmull crypto extension. This also
13932 enables Advanced SIMD instructions.
13933
13934 sha2
13935 Enable the Armv8-a sha2 crypto extension. This also enables
13936 Advanced SIMD instructions.
13937
13938 sha3
13939 Enable the sha512 and sha3 crypto extension. This also enables
13940 Advanced SIMD instructions. Use of this option with architectures
13941 prior to Armv8.2-A is not supported.
13942
13943 sm4 Enable the sm3 and sm4 crypto extension. This also enables
13944 Advanced SIMD instructions. Use of this option with architectures
13945 prior to Armv8.2-A is not supported.
13946
13947 profile
13948 Enable the Statistical Profiling extension. This option is only to
13949 enable the extension at the assembler level and does not affect
13950 code generation.
13951
13952 rng Enable the Armv8.5-a Random Number instructions. This option is
13953 only to enable the extension at the assembler level and does not
13954 affect code generation.
13955
13956 memtag
13957 Enable the Armv8.5-a Memory Tagging Extensions. This option is
13958 only to enable the extension at the assembler level and does not
13959 affect code generation.
13960
13961 sb Enable the Armv8-a Speculation Barrier instruction. This option is
13962 only to enable the extension at the assembler level and does not
13963 affect code generation. This option is enabled by default for
13964 -march=armv8.5-a.
13965
13966 ssbs
13967 Enable the Armv8-a Speculative Store Bypass Safe instruction. This
13968 option is only to enable the extension at the assembler level and
13969 does not affect code generation. This option is enabled by default
13970 for -march=armv8.5-a.
13971
13972 predres
13973 Enable the Armv8-a Execution and Data Prediction Restriction
13974 instructions. This option is only to enable the extension at the
13975 assembler level and does not affect code generation. This option
13976 is enabled by default for -march=armv8.5-a.
13977
13978 Feature crypto implies aes, sha2, and simd, which implies fp.
13979 Conversely, nofp implies nosimd, which implies nocrypto, noaes and
13980 nosha2.
13981
13982 Adapteva Epiphany Options
13983
13984 These -m options are defined for Adapteva Epiphany:
13985
13986 -mhalf-reg-file
13987 Don't allocate any register in the range "r32"..."r63". That
13988 allows code to run on hardware variants that lack these registers.
13989
13990 -mprefer-short-insn-regs
13991 Preferentially allocate registers that allow short instruction
13992 generation. This can result in increased instruction count, so
13993 this may either reduce or increase overall code size.
13994
13995 -mbranch-cost=num
13996 Set the cost of branches to roughly num "simple" instructions.
13997 This cost is only a heuristic and is not guaranteed to produce
13998 consistent results across releases.
13999
14000 -mcmove
14001 Enable the generation of conditional moves.
14002
14003 -mnops=num
14004 Emit num NOPs before every other generated instruction.
14005
14006 -mno-soft-cmpsf
14007 For single-precision floating-point comparisons, emit an "fsub"
14008 instruction and test the flags. This is faster than a software
14009 comparison, but can get incorrect results in the presence of NaNs,
14010 or when two different small numbers are compared such that their
14011 difference is calculated as zero. The default is -msoft-cmpsf,
14012 which uses slower, but IEEE-compliant, software comparisons.
14013
14014 -mstack-offset=num
14015 Set the offset between the top of the stack and the stack pointer.
14016 E.g., a value of 8 means that the eight bytes in the range
14017 "sp+0...sp+7" can be used by leaf functions without stack
14018 allocation. Values other than 8 or 16 are untested and unlikely to
14019 work. Note also that this option changes the ABI; compiling a
14020 program with a different stack offset than the libraries have been
14021 compiled with generally does not work. This option can be useful
14022 if you want to evaluate if a different stack offset would give you
14023 better code, but to actually use a different stack offset to build
14024 working programs, it is recommended to configure the toolchain with
14025 the appropriate --with-stack-offset=num option.
14026
14027 -mno-round-nearest
14028 Make the scheduler assume that the rounding mode has been set to
14029 truncating. The default is -mround-nearest.
14030
14031 -mlong-calls
14032 If not otherwise specified by an attribute, assume all calls might
14033 be beyond the offset range of the "b" / "bl" instructions, and
14034 therefore load the function address into a register before
14035 performing a (otherwise direct) call. This is the default.
14036
14037 -mshort-calls
14038 If not otherwise specified by an attribute, assume all direct calls
14039 are in the range of the "b" / "bl" instructions, so use these
14040 instructions for direct calls. The default is -mlong-calls.
14041
14042 -msmall16
14043 Assume addresses can be loaded as 16-bit unsigned values. This
14044 does not apply to function addresses for which -mlong-calls
14045 semantics are in effect.
14046
14047 -mfp-mode=mode
14048 Set the prevailing mode of the floating-point unit. This
14049 determines the floating-point mode that is provided and expected at
14050 function call and return time. Making this mode match the mode you
14051 predominantly need at function start can make your programs smaller
14052 and faster by avoiding unnecessary mode switches.
14053
14054 mode can be set to one the following values:
14055
14056 caller
14057 Any mode at function entry is valid, and retained or restored
14058 when the function returns, and when it calls other functions.
14059 This mode is useful for compiling libraries or other
14060 compilation units you might want to incorporate into different
14061 programs with different prevailing FPU modes, and the
14062 convenience of being able to use a single object file outweighs
14063 the size and speed overhead for any extra mode switching that
14064 might be needed, compared with what would be needed with a more
14065 specific choice of prevailing FPU mode.
14066
14067 truncate
14068 This is the mode used for floating-point calculations with
14069 truncating (i.e. round towards zero) rounding mode. That
14070 includes conversion from floating point to integer.
14071
14072 round-nearest
14073 This is the mode used for floating-point calculations with
14074 round-to-nearest-or-even rounding mode.
14075
14076 int This is the mode used to perform integer calculations in the
14077 FPU, e.g. integer multiply, or integer multiply-and-
14078 accumulate.
14079
14080 The default is -mfp-mode=caller
14081
14082 -mno-split-lohi
14083 -mno-postinc
14084 -mno-postmodify
14085 Code generation tweaks that disable, respectively, splitting of
14086 32-bit loads, generation of post-increment addresses, and
14087 generation of post-modify addresses. The defaults are msplit-lohi,
14088 -mpost-inc, and -mpost-modify.
14089
14090 -mnovect-double
14091 Change the preferred SIMD mode to SImode. The default is
14092 -mvect-double, which uses DImode as preferred SIMD mode.
14093
14094 -max-vect-align=num
14095 The maximum alignment for SIMD vector mode types. num may be 4 or
14096 8. The default is 8. Note that this is an ABI change, even though
14097 many library function interfaces are unaffected if they don't use
14098 SIMD vector modes in places that affect size and/or alignment of
14099 relevant types.
14100
14101 -msplit-vecmove-early
14102 Split vector moves into single word moves before reload. In theory
14103 this can give better register allocation, but so far the reverse
14104 seems to be generally the case.
14105
14106 -m1reg-reg
14107 Specify a register to hold the constant -1, which makes loading
14108 small negative constants and certain bitmasks faster. Allowable
14109 values for reg are r43 and r63, which specify use of that register
14110 as a fixed register, and none, which means that no register is used
14111 for this purpose. The default is -m1reg-none.
14112
14113 AMD GCN Options
14114
14115 These options are defined specifically for the AMD GCN port.
14116
14117 -march=gpu
14118 -mtune=gpu
14119 Set architecture type or tuning for gpu. Supported values for gpu
14120 are
14121
14122 fiji
14123 Compile for GCN3 Fiji devices (gfx803).
14124
14125 gfx900
14126 Compile for GCN5 Vega 10 devices (gfx900).
14127
14128 -mstack-size=bytes
14129 Specify how many bytes of stack space will be requested for each
14130 GPU thread (wave-front). Beware that there may be many threads and
14131 limited memory available. The size of the stack allocation may
14132 also have an impact on run-time performance. The default is 32KB
14133 when using OpenACC or OpenMP, and 1MB otherwise.
14134
14135 ARC Options
14136
14137 The following options control the architecture variant for which code
14138 is being compiled:
14139
14140 -mbarrel-shifter
14141 Generate instructions supported by barrel shifter. This is the
14142 default unless -mcpu=ARC601 or -mcpu=ARCEM is in effect.
14143
14144 -mjli-always
14145 Force to call a function using jli_s instruction. This option is
14146 valid only for ARCv2 architecture.
14147
14148 -mcpu=cpu
14149 Set architecture type, register usage, and instruction scheduling
14150 parameters for cpu. There are also shortcut alias options
14151 available for backward compatibility and convenience. Supported
14152 values for cpu are
14153
14154 arc600
14155 Compile for ARC600. Aliases: -mA6, -mARC600.
14156
14157 arc601
14158 Compile for ARC601. Alias: -mARC601.
14159
14160 arc700
14161 Compile for ARC700. Aliases: -mA7, -mARC700. This is the
14162 default when configured with --with-cpu=arc700.
14163
14164 arcem
14165 Compile for ARC EM.
14166
14167 archs
14168 Compile for ARC HS.
14169
14170 em Compile for ARC EM CPU with no hardware extensions.
14171
14172 em4 Compile for ARC EM4 CPU.
14173
14174 em4_dmips
14175 Compile for ARC EM4 DMIPS CPU.
14176
14177 em4_fpus
14178 Compile for ARC EM4 DMIPS CPU with the single-precision
14179 floating-point extension.
14180
14181 em4_fpuda
14182 Compile for ARC EM4 DMIPS CPU with single-precision floating-
14183 point and double assist instructions.
14184
14185 hs Compile for ARC HS CPU with no hardware extensions except the
14186 atomic instructions.
14187
14188 hs34
14189 Compile for ARC HS34 CPU.
14190
14191 hs38
14192 Compile for ARC HS38 CPU.
14193
14194 hs38_linux
14195 Compile for ARC HS38 CPU with all hardware extensions on.
14196
14197 arc600_norm
14198 Compile for ARC 600 CPU with "norm" instructions enabled.
14199
14200 arc600_mul32x16
14201 Compile for ARC 600 CPU with "norm" and 32x16-bit multiply
14202 instructions enabled.
14203
14204 arc600_mul64
14205 Compile for ARC 600 CPU with "norm" and "mul64"-family
14206 instructions enabled.
14207
14208 arc601_norm
14209 Compile for ARC 601 CPU with "norm" instructions enabled.
14210
14211 arc601_mul32x16
14212 Compile for ARC 601 CPU with "norm" and 32x16-bit multiply
14213 instructions enabled.
14214
14215 arc601_mul64
14216 Compile for ARC 601 CPU with "norm" and "mul64"-family
14217 instructions enabled.
14218
14219 nps400
14220 Compile for ARC 700 on NPS400 chip.
14221
14222 em_mini
14223 Compile for ARC EM minimalist configuration featuring reduced
14224 register set.
14225
14226 -mdpfp
14227 -mdpfp-compact
14228 Generate double-precision FPX instructions, tuned for the compact
14229 implementation.
14230
14231 -mdpfp-fast
14232 Generate double-precision FPX instructions, tuned for the fast
14233 implementation.
14234
14235 -mno-dpfp-lrsr
14236 Disable "lr" and "sr" instructions from using FPX extension aux
14237 registers.
14238
14239 -mea
14240 Generate extended arithmetic instructions. Currently only "divaw",
14241 "adds", "subs", and "sat16" are supported. This is always enabled
14242 for -mcpu=ARC700.
14243
14244 -mno-mpy
14245 Do not generate "mpy"-family instructions for ARC700. This option
14246 is deprecated.
14247
14248 -mmul32x16
14249 Generate 32x16-bit multiply and multiply-accumulate instructions.
14250
14251 -mmul64
14252 Generate "mul64" and "mulu64" instructions. Only valid for
14253 -mcpu=ARC600.
14254
14255 -mnorm
14256 Generate "norm" instructions. This is the default if -mcpu=ARC700
14257 is in effect.
14258
14259 -mspfp
14260 -mspfp-compact
14261 Generate single-precision FPX instructions, tuned for the compact
14262 implementation.
14263
14264 -mspfp-fast
14265 Generate single-precision FPX instructions, tuned for the fast
14266 implementation.
14267
14268 -msimd
14269 Enable generation of ARC SIMD instructions via target-specific
14270 builtins. Only valid for -mcpu=ARC700.
14271
14272 -msoft-float
14273 This option ignored; it is provided for compatibility purposes
14274 only. Software floating-point code is emitted by default, and this
14275 default can overridden by FPX options; -mspfp, -mspfp-compact, or
14276 -mspfp-fast for single precision, and -mdpfp, -mdpfp-compact, or
14277 -mdpfp-fast for double precision.
14278
14279 -mswap
14280 Generate "swap" instructions.
14281
14282 -matomic
14283 This enables use of the locked load/store conditional extension to
14284 implement atomic memory built-in functions. Not available for ARC
14285 6xx or ARC EM cores.
14286
14287 -mdiv-rem
14288 Enable "div" and "rem" instructions for ARCv2 cores.
14289
14290 -mcode-density
14291 Enable code density instructions for ARC EM. This option is on by
14292 default for ARC HS.
14293
14294 -mll64
14295 Enable double load/store operations for ARC HS cores.
14296
14297 -mtp-regno=regno
14298 Specify thread pointer register number.
14299
14300 -mmpy-option=multo
14301 Compile ARCv2 code with a multiplier design option. You can
14302 specify the option using either a string or numeric value for
14303 multo. wlh1 is the default value. The recognized values are:
14304
14305 0
14306 none
14307 No multiplier available.
14308
14309 1
14310 w 16x16 multiplier, fully pipelined. The following instructions
14311 are enabled: "mpyw" and "mpyuw".
14312
14313 2
14314 wlh1
14315 32x32 multiplier, fully pipelined (1 stage). The following
14316 instructions are additionally enabled: "mpy", "mpyu", "mpym",
14317 "mpymu", and "mpy_s".
14318
14319 3
14320 wlh2
14321 32x32 multiplier, fully pipelined (2 stages). The following
14322 instructions are additionally enabled: "mpy", "mpyu", "mpym",
14323 "mpymu", and "mpy_s".
14324
14325 4
14326 wlh3
14327 Two 16x16 multipliers, blocking, sequential. The following
14328 instructions are additionally enabled: "mpy", "mpyu", "mpym",
14329 "mpymu", and "mpy_s".
14330
14331 5
14332 wlh4
14333 One 16x16 multiplier, blocking, sequential. The following
14334 instructions are additionally enabled: "mpy", "mpyu", "mpym",
14335 "mpymu", and "mpy_s".
14336
14337 6
14338 wlh5
14339 One 32x4 multiplier, blocking, sequential. The following
14340 instructions are additionally enabled: "mpy", "mpyu", "mpym",
14341 "mpymu", and "mpy_s".
14342
14343 7
14344 plus_dmpy
14345 ARC HS SIMD support.
14346
14347 8
14348 plus_macd
14349 ARC HS SIMD support.
14350
14351 9
14352 plus_qmacw
14353 ARC HS SIMD support.
14354
14355 This option is only available for ARCv2 cores.
14356
14357 -mfpu=fpu
14358 Enables support for specific floating-point hardware extensions for
14359 ARCv2 cores. Supported values for fpu are:
14360
14361 fpus
14362 Enables support for single-precision floating-point hardware
14363 extensions.
14364
14365 fpud
14366 Enables support for double-precision floating-point hardware
14367 extensions. The single-precision floating-point extension is
14368 also enabled. Not available for ARC EM.
14369
14370 fpuda
14371 Enables support for double-precision floating-point hardware
14372 extensions using double-precision assist instructions. The
14373 single-precision floating-point extension is also enabled.
14374 This option is only available for ARC EM.
14375
14376 fpuda_div
14377 Enables support for double-precision floating-point hardware
14378 extensions using double-precision assist instructions. The
14379 single-precision floating-point, square-root, and divide
14380 extensions are also enabled. This option is only available for
14381 ARC EM.
14382
14383 fpuda_fma
14384 Enables support for double-precision floating-point hardware
14385 extensions using double-precision assist instructions. The
14386 single-precision floating-point and fused multiply and add
14387 hardware extensions are also enabled. This option is only
14388 available for ARC EM.
14389
14390 fpuda_all
14391 Enables support for double-precision floating-point hardware
14392 extensions using double-precision assist instructions. All
14393 single-precision floating-point hardware extensions are also
14394 enabled. This option is only available for ARC EM.
14395
14396 fpus_div
14397 Enables support for single-precision floating-point, square-
14398 root and divide hardware extensions.
14399
14400 fpud_div
14401 Enables support for double-precision floating-point, square-
14402 root and divide hardware extensions. This option includes
14403 option fpus_div. Not available for ARC EM.
14404
14405 fpus_fma
14406 Enables support for single-precision floating-point and fused
14407 multiply and add hardware extensions.
14408
14409 fpud_fma
14410 Enables support for double-precision floating-point and fused
14411 multiply and add hardware extensions. This option includes
14412 option fpus_fma. Not available for ARC EM.
14413
14414 fpus_all
14415 Enables support for all single-precision floating-point
14416 hardware extensions.
14417
14418 fpud_all
14419 Enables support for all single- and double-precision floating-
14420 point hardware extensions. Not available for ARC EM.
14421
14422 -mirq-ctrl-saved=register-range, blink, lp_count
14423 Specifies general-purposes registers that the processor
14424 automatically saves/restores on interrupt entry and exit.
14425 register-range is specified as two registers separated by a dash.
14426 The register range always starts with "r0", the upper limit is "fp"
14427 register. blink and lp_count are optional. This option is only
14428 valid for ARC EM and ARC HS cores.
14429
14430 -mrgf-banked-regs=number
14431 Specifies the number of registers replicated in second register
14432 bank on entry to fast interrupt. Fast interrupts are interrupts
14433 with the highest priority level P0. These interrupts save only PC
14434 and STATUS32 registers to avoid memory transactions during
14435 interrupt entry and exit sequences. Use this option when you are
14436 using fast interrupts in an ARC V2 family processor. Permitted
14437 values are 4, 8, 16, and 32.
14438
14439 -mlpc-width=width
14440 Specify the width of the "lp_count" register. Valid values for
14441 width are 8, 16, 20, 24, 28 and 32 bits. The default width is
14442 fixed to 32 bits. If the width is less than 32, the compiler does
14443 not attempt to transform loops in your program to use the zero-
14444 delay loop mechanism unless it is known that the "lp_count"
14445 register can hold the required loop-counter value. Depending on
14446 the width specified, the compiler and run-time library might
14447 continue to use the loop mechanism for various needs. This option
14448 defines macro "__ARC_LPC_WIDTH__" with the value of width.
14449
14450 -mrf16
14451 This option instructs the compiler to generate code for a 16-entry
14452 register file. This option defines the "__ARC_RF16__" preprocessor
14453 macro.
14454
14455 -mbranch-index
14456 Enable use of "bi" or "bih" instructions to implement jump tables.
14457
14458 The following options are passed through to the assembler, and also
14459 define preprocessor macro symbols.
14460
14461 -mdsp-packa
14462 Passed down to the assembler to enable the DSP Pack A extensions.
14463 Also sets the preprocessor symbol "__Xdsp_packa". This option is
14464 deprecated.
14465
14466 -mdvbf
14467 Passed down to the assembler to enable the dual Viterbi butterfly
14468 extension. Also sets the preprocessor symbol "__Xdvbf". This
14469 option is deprecated.
14470
14471 -mlock
14472 Passed down to the assembler to enable the locked load/store
14473 conditional extension. Also sets the preprocessor symbol
14474 "__Xlock".
14475
14476 -mmac-d16
14477 Passed down to the assembler. Also sets the preprocessor symbol
14478 "__Xxmac_d16". This option is deprecated.
14479
14480 -mmac-24
14481 Passed down to the assembler. Also sets the preprocessor symbol
14482 "__Xxmac_24". This option is deprecated.
14483
14484 -mrtsc
14485 Passed down to the assembler to enable the 64-bit time-stamp
14486 counter extension instruction. Also sets the preprocessor symbol
14487 "__Xrtsc". This option is deprecated.
14488
14489 -mswape
14490 Passed down to the assembler to enable the swap byte ordering
14491 extension instruction. Also sets the preprocessor symbol
14492 "__Xswape".
14493
14494 -mtelephony
14495 Passed down to the assembler to enable dual- and single-operand
14496 instructions for telephony. Also sets the preprocessor symbol
14497 "__Xtelephony". This option is deprecated.
14498
14499 -mxy
14500 Passed down to the assembler to enable the XY memory extension.
14501 Also sets the preprocessor symbol "__Xxy".
14502
14503 The following options control how the assembly code is annotated:
14504
14505 -misize
14506 Annotate assembler instructions with estimated addresses.
14507
14508 -mannotate-align
14509 Explain what alignment considerations lead to the decision to make
14510 an instruction short or long.
14511
14512 The following options are passed through to the linker:
14513
14514 -marclinux
14515 Passed through to the linker, to specify use of the "arclinux"
14516 emulation. This option is enabled by default in tool chains built
14517 for "arc-linux-uclibc" and "arceb-linux-uclibc" targets when
14518 profiling is not requested.
14519
14520 -marclinux_prof
14521 Passed through to the linker, to specify use of the "arclinux_prof"
14522 emulation. This option is enabled by default in tool chains built
14523 for "arc-linux-uclibc" and "arceb-linux-uclibc" targets when
14524 profiling is requested.
14525
14526 The following options control the semantics of generated code:
14527
14528 -mlong-calls
14529 Generate calls as register indirect calls, thus providing access to
14530 the full 32-bit address range.
14531
14532 -mmedium-calls
14533 Don't use less than 25-bit addressing range for calls, which is the
14534 offset available for an unconditional branch-and-link instruction.
14535 Conditional execution of function calls is suppressed, to allow use
14536 of the 25-bit range, rather than the 21-bit range with conditional
14537 branch-and-link. This is the default for tool chains built for
14538 "arc-linux-uclibc" and "arceb-linux-uclibc" targets.
14539
14540 -G num
14541 Put definitions of externally-visible data in a small data section
14542 if that data is no bigger than num bytes. The default value of num
14543 is 4 for any ARC configuration, or 8 when we have double load/store
14544 operations.
14545
14546 -mno-sdata
14547 Do not generate sdata references. This is the default for tool
14548 chains built for "arc-linux-uclibc" and "arceb-linux-uclibc"
14549 targets.
14550
14551 -mvolatile-cache
14552 Use ordinarily cached memory accesses for volatile references.
14553 This is the default.
14554
14555 -mno-volatile-cache
14556 Enable cache bypass for volatile references.
14557
14558 The following options fine tune code generation:
14559
14560 -malign-call
14561 Do alignment optimizations for call instructions.
14562
14563 -mauto-modify-reg
14564 Enable the use of pre/post modify with register displacement.
14565
14566 -mbbit-peephole
14567 Enable bbit peephole2.
14568
14569 -mno-brcc
14570 This option disables a target-specific pass in arc_reorg to
14571 generate compare-and-branch ("brcc") instructions. It has no
14572 effect on generation of these instructions driven by the combiner
14573 pass.
14574
14575 -mcase-vector-pcrel
14576 Use PC-relative switch case tables to enable case table shortening.
14577 This is the default for -Os.
14578
14579 -mcompact-casesi
14580 Enable compact "casesi" pattern. This is the default for -Os, and
14581 only available for ARCv1 cores. This option is deprecated.
14582
14583 -mno-cond-exec
14584 Disable the ARCompact-specific pass to generate conditional
14585 execution instructions.
14586
14587 Due to delay slot scheduling and interactions between operand
14588 numbers, literal sizes, instruction lengths, and the support for
14589 conditional execution, the target-independent pass to generate
14590 conditional execution is often lacking, so the ARC port has kept a
14591 special pass around that tries to find more conditional execution
14592 generation opportunities after register allocation, branch
14593 shortening, and delay slot scheduling have been done. This pass
14594 generally, but not always, improves performance and code size, at
14595 the cost of extra compilation time, which is why there is an option
14596 to switch it off. If you have a problem with call instructions
14597 exceeding their allowable offset range because they are
14598 conditionalized, you should consider using -mmedium-calls instead.
14599
14600 -mearly-cbranchsi
14601 Enable pre-reload use of the "cbranchsi" pattern.
14602
14603 -mexpand-adddi
14604 Expand "adddi3" and "subdi3" at RTL generation time into "add.f",
14605 "adc" etc. This option is deprecated.
14606
14607 -mindexed-loads
14608 Enable the use of indexed loads. This can be problematic because
14609 some optimizers then assume that indexed stores exist, which is not
14610 the case.
14611
14612 -mlra
14613 Enable Local Register Allocation. This is still experimental for
14614 ARC, so by default the compiler uses standard reload (i.e.
14615 -mno-lra).
14616
14617 -mlra-priority-none
14618 Don't indicate any priority for target registers.
14619
14620 -mlra-priority-compact
14621 Indicate target register priority for r0..r3 / r12..r15.
14622
14623 -mlra-priority-noncompact
14624 Reduce target register priority for r0..r3 / r12..r15.
14625
14626 -mmillicode
14627 When optimizing for size (using -Os), prologues and epilogues that
14628 have to save or restore a large number of registers are often
14629 shortened by using call to a special function in libgcc; this is
14630 referred to as a millicode call. As these calls can pose
14631 performance issues, and/or cause linking issues when linking in a
14632 nonstandard way, this option is provided to turn on or off
14633 millicode call generation.
14634
14635 -mcode-density-frame
14636 This option enable the compiler to emit "enter" and "leave"
14637 instructions. These instructions are only valid for CPUs with
14638 code-density feature.
14639
14640 -mmixed-code
14641 Tweak register allocation to help 16-bit instruction generation.
14642 This generally has the effect of decreasing the average instruction
14643 size while increasing the instruction count.
14644
14645 -mq-class
14646 Enable q instruction alternatives. This is the default for -Os.
14647
14648 -mRcq
14649 Enable Rcq constraint handling. Most short code generation depends
14650 on this. This is the default.
14651
14652 -mRcw
14653 Enable Rcw constraint handling. Most ccfsm condexec mostly depends
14654 on this. This is the default.
14655
14656 -msize-level=level
14657 Fine-tune size optimization with regards to instruction lengths and
14658 alignment. The recognized values for level are:
14659
14660 0 No size optimization. This level is deprecated and treated
14661 like 1.
14662
14663 1 Short instructions are used opportunistically.
14664
14665 2 In addition, alignment of loops and of code after barriers are
14666 dropped.
14667
14668 3 In addition, optional data alignment is dropped, and the option
14669 Os is enabled.
14670
14671 This defaults to 3 when -Os is in effect. Otherwise, the behavior
14672 when this is not set is equivalent to level 1.
14673
14674 -mtune=cpu
14675 Set instruction scheduling parameters for cpu, overriding any
14676 implied by -mcpu=.
14677
14678 Supported values for cpu are
14679
14680 ARC600
14681 Tune for ARC600 CPU.
14682
14683 ARC601
14684 Tune for ARC601 CPU.
14685
14686 ARC700
14687 Tune for ARC700 CPU with standard multiplier block.
14688
14689 ARC700-xmac
14690 Tune for ARC700 CPU with XMAC block.
14691
14692 ARC725D
14693 Tune for ARC725D CPU.
14694
14695 ARC750D
14696 Tune for ARC750D CPU.
14697
14698 -mmultcost=num
14699 Cost to assume for a multiply instruction, with 4 being equal to a
14700 normal instruction.
14701
14702 -munalign-prob-threshold=probability
14703 Set probability threshold for unaligning branches. When tuning for
14704 ARC700 and optimizing for speed, branches without filled delay slot
14705 are preferably emitted unaligned and long, unless profiling
14706 indicates that the probability for the branch to be taken is below
14707 probability. The default is (REG_BR_PROB_BASE/2), i.e. 5000.
14708
14709 The following options are maintained for backward compatibility, but
14710 are now deprecated and will be removed in a future release:
14711
14712 -margonaut
14713 Obsolete FPX.
14714
14715 -mbig-endian
14716 -EB Compile code for big-endian targets. Use of these options is now
14717 deprecated. Big-endian code is supported by configuring GCC to
14718 build "arceb-elf32" and "arceb-linux-uclibc" targets, for which big
14719 endian is the default.
14720
14721 -mlittle-endian
14722 -EL Compile code for little-endian targets. Use of these options is
14723 now deprecated. Little-endian code is supported by configuring GCC
14724 to build "arc-elf32" and "arc-linux-uclibc" targets, for which
14725 little endian is the default.
14726
14727 -mbarrel_shifter
14728 Replaced by -mbarrel-shifter.
14729
14730 -mdpfp_compact
14731 Replaced by -mdpfp-compact.
14732
14733 -mdpfp_fast
14734 Replaced by -mdpfp-fast.
14735
14736 -mdsp_packa
14737 Replaced by -mdsp-packa.
14738
14739 -mEA
14740 Replaced by -mea.
14741
14742 -mmac_24
14743 Replaced by -mmac-24.
14744
14745 -mmac_d16
14746 Replaced by -mmac-d16.
14747
14748 -mspfp_compact
14749 Replaced by -mspfp-compact.
14750
14751 -mspfp_fast
14752 Replaced by -mspfp-fast.
14753
14754 -mtune=cpu
14755 Values arc600, arc601, arc700 and arc700-xmac for cpu are replaced
14756 by ARC600, ARC601, ARC700 and ARC700-xmac respectively.
14757
14758 -multcost=num
14759 Replaced by -mmultcost.
14760
14761 ARM Options
14762
14763 These -m options are defined for the ARM port:
14764
14765 -mabi=name
14766 Generate code for the specified ABI. Permissible values are: apcs-
14767 gnu, atpcs, aapcs, aapcs-linux and iwmmxt.
14768
14769 -mapcs-frame
14770 Generate a stack frame that is compliant with the ARM Procedure
14771 Call Standard for all functions, even if this is not strictly
14772 necessary for correct execution of the code. Specifying
14773 -fomit-frame-pointer with this option causes the stack frames not
14774 to be generated for leaf functions. The default is
14775 -mno-apcs-frame. This option is deprecated.
14776
14777 -mapcs
14778 This is a synonym for -mapcs-frame and is deprecated.
14779
14780 -mthumb-interwork
14781 Generate code that supports calling between the ARM and Thumb
14782 instruction sets. Without this option, on pre-v5 architectures,
14783 the two instruction sets cannot be reliably used inside one
14784 program. The default is -mno-thumb-interwork, since slightly
14785 larger code is generated when -mthumb-interwork is specified. In
14786 AAPCS configurations this option is meaningless.
14787
14788 -mno-sched-prolog
14789 Prevent the reordering of instructions in the function prologue, or
14790 the merging of those instruction with the instructions in the
14791 function's body. This means that all functions start with a
14792 recognizable set of instructions (or in fact one of a choice from a
14793 small set of different function prologues), and this information
14794 can be used to locate the start of functions inside an executable
14795 piece of code. The default is -msched-prolog.
14796
14797 -mfloat-abi=name
14798 Specifies which floating-point ABI to use. Permissible values are:
14799 soft, softfp and hard.
14800
14801 Specifying soft causes GCC to generate output containing library
14802 calls for floating-point operations. softfp allows the generation
14803 of code using hardware floating-point instructions, but still uses
14804 the soft-float calling conventions. hard allows generation of
14805 floating-point instructions and uses FPU-specific calling
14806 conventions.
14807
14808 The default depends on the specific target configuration. Note
14809 that the hard-float and soft-float ABIs are not link-compatible;
14810 you must compile your entire program with the same ABI, and link
14811 with a compatible set of libraries.
14812
14813 -mgeneral-regs-only
14814 Generate code which uses only the general-purpose registers. This
14815 will prevent the compiler from using floating-point and Advanced
14816 SIMD registers but will not impose any restrictions on the
14817 assembler.
14818
14819 -mlittle-endian
14820 Generate code for a processor running in little-endian mode. This
14821 is the default for all standard configurations.
14822
14823 -mbig-endian
14824 Generate code for a processor running in big-endian mode; the
14825 default is to compile code for a little-endian processor.
14826
14827 -mbe8
14828 -mbe32
14829 When linking a big-endian image select between BE8 and BE32
14830 formats. The option has no effect for little-endian images and is
14831 ignored. The default is dependent on the selected target
14832 architecture. For ARMv6 and later architectures the default is
14833 BE8, for older architectures the default is BE32. BE32 format has
14834 been deprecated by ARM.
14835
14836 -march=name[+extension...]
14837 This specifies the name of the target ARM architecture. GCC uses
14838 this name to determine what kind of instructions it can emit when
14839 generating assembly code. This option can be used in conjunction
14840 with or instead of the -mcpu= option.
14841
14842 Permissible names are: armv4t, armv5t, armv5te, armv6, armv6j,
14843 armv6k, armv6kz, armv6t2, armv6z, armv6zk, armv7, armv7-a, armv7ve,
14844 armv8-a, armv8.1-a, armv8.2-a, armv8.3-a, armv8.4-a, armv8.5-a,
14845 armv7-r, armv8-r, armv6-m, armv6s-m, armv7-m, armv7e-m,
14846 armv8-m.base, armv8-m.main, iwmmxt and iwmmxt2.
14847
14848 Additionally, the following architectures, which lack support for
14849 the Thumb execution state, are recognized but support is
14850 deprecated: armv4.
14851
14852 Many of the architectures support extensions. These can be added
14853 by appending +extension to the architecture name. Extension
14854 options are processed in order and capabilities accumulate. An
14855 extension will also enable any necessary base extensions upon which
14856 it depends. For example, the +crypto extension will always enable
14857 the +simd extension. The exception to the additive construction is
14858 for extensions that are prefixed with +no...: these extensions
14859 disable the specified option and any other extensions that may
14860 depend on the presence of that extension.
14861
14862 For example, -march=armv7-a+simd+nofp+vfpv4 is equivalent to
14863 writing -march=armv7-a+vfpv4 since the +simd option is entirely
14864 disabled by the +nofp option that follows it.
14865
14866 Most extension names are generically named, but have an effect that
14867 is dependent upon the architecture to which it is applied. For
14868 example, the +simd option can be applied to both armv7-a and
14869 armv8-a architectures, but will enable the original ARMv7-A
14870 Advanced SIMD (Neon) extensions for armv7-a and the ARMv8-A variant
14871 for armv8-a.
14872
14873 The table below lists the supported extensions for each
14874 architecture. Architectures not mentioned do not support any
14875 extensions.
14876
14877 armv5te
14878 armv6
14879 armv6j
14880 armv6k
14881 armv6kz
14882 armv6t2
14883 armv6z
14884 armv6zk
14885 +fp The VFPv2 floating-point instructions. The extension
14886 +vfpv2 can be used as an alias for this extension.
14887
14888 +nofp
14889 Disable the floating-point instructions.
14890
14891 armv7
14892 The common subset of the ARMv7-A, ARMv7-R and ARMv7-M
14893 architectures.
14894
14895 +fp The VFPv3 floating-point instructions, with 16 double-
14896 precision registers. The extension +vfpv3-d16 can be used
14897 as an alias for this extension. Note that floating-point
14898 is not supported by the base ARMv7-M architecture, but is
14899 compatible with both the ARMv7-A and ARMv7-R architectures.
14900
14901 +nofp
14902 Disable the floating-point instructions.
14903
14904 armv7-a
14905 +mp The multiprocessing extension.
14906
14907 +sec
14908 The security extension.
14909
14910 +fp The VFPv3 floating-point instructions, with 16 double-
14911 precision registers. The extension +vfpv3-d16 can be used
14912 as an alias for this extension.
14913
14914 +simd
14915 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point
14916 instructions. The extensions +neon and +neon-vfpv3 can be
14917 used as aliases for this extension.
14918
14919 +vfpv3
14920 The VFPv3 floating-point instructions, with 32 double-
14921 precision registers.
14922
14923 +vfpv3-d16-fp16
14924 The VFPv3 floating-point instructions, with 16 double-
14925 precision registers and the half-precision floating-point
14926 conversion operations.
14927
14928 +vfpv3-fp16
14929 The VFPv3 floating-point instructions, with 32 double-
14930 precision registers and the half-precision floating-point
14931 conversion operations.
14932
14933 +vfpv4-d16
14934 The VFPv4 floating-point instructions, with 16 double-
14935 precision registers.
14936
14937 +vfpv4
14938 The VFPv4 floating-point instructions, with 32 double-
14939 precision registers.
14940
14941 +neon-fp16
14942 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point
14943 instructions, with the half-precision floating-point
14944 conversion operations.
14945
14946 +neon-vfpv4
14947 The Advanced SIMD (Neon) v2 and the VFPv4 floating-point
14948 instructions.
14949
14950 +nosimd
14951 Disable the Advanced SIMD instructions (does not disable
14952 floating point).
14953
14954 +nofp
14955 Disable the floating-point and Advanced SIMD instructions.
14956
14957 armv7ve
14958 The extended version of the ARMv7-A architecture with support
14959 for virtualization.
14960
14961 +fp The VFPv4 floating-point instructions, with 16 double-
14962 precision registers. The extension +vfpv4-d16 can be used
14963 as an alias for this extension.
14964
14965 +simd
14966 The Advanced SIMD (Neon) v2 and the VFPv4 floating-point
14967 instructions. The extension +neon-vfpv4 can be used as an
14968 alias for this extension.
14969
14970 +vfpv3-d16
14971 The VFPv3 floating-point instructions, with 16 double-
14972 precision registers.
14973
14974 +vfpv3
14975 The VFPv3 floating-point instructions, with 32 double-
14976 precision registers.
14977
14978 +vfpv3-d16-fp16
14979 The VFPv3 floating-point instructions, with 16 double-
14980 precision registers and the half-precision floating-point
14981 conversion operations.
14982
14983 +vfpv3-fp16
14984 The VFPv3 floating-point instructions, with 32 double-
14985 precision registers and the half-precision floating-point
14986 conversion operations.
14987
14988 +vfpv4-d16
14989 The VFPv4 floating-point instructions, with 16 double-
14990 precision registers.
14991
14992 +vfpv4
14993 The VFPv4 floating-point instructions, with 32 double-
14994 precision registers.
14995
14996 +neon
14997 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point
14998 instructions. The extension +neon-vfpv3 can be used as an
14999 alias for this extension.
15000
15001 +neon-fp16
15002 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point
15003 instructions, with the half-precision floating-point
15004 conversion operations.
15005
15006 +nosimd
15007 Disable the Advanced SIMD instructions (does not disable
15008 floating point).
15009
15010 +nofp
15011 Disable the floating-point and Advanced SIMD instructions.
15012
15013 armv8-a
15014 +crc
15015 The Cyclic Redundancy Check (CRC) instructions.
15016
15017 +simd
15018 The ARMv8-A Advanced SIMD and floating-point instructions.
15019
15020 +crypto
15021 The cryptographic instructions.
15022
15023 +nocrypto
15024 Disable the cryptographic instructions.
15025
15026 +nofp
15027 Disable the floating-point, Advanced SIMD and cryptographic
15028 instructions.
15029
15030 +sb Speculation Barrier Instruction.
15031
15032 +predres
15033 Execution and Data Prediction Restriction Instructions.
15034
15035 armv8.1-a
15036 +simd
15037 The ARMv8.1-A Advanced SIMD and floating-point
15038 instructions.
15039
15040 +crypto
15041 The cryptographic instructions. This also enables the
15042 Advanced SIMD and floating-point instructions.
15043
15044 +nocrypto
15045 Disable the cryptographic instructions.
15046
15047 +nofp
15048 Disable the floating-point, Advanced SIMD and cryptographic
15049 instructions.
15050
15051 +sb Speculation Barrier Instruction.
15052
15053 +predres
15054 Execution and Data Prediction Restriction Instructions.
15055
15056 armv8.2-a
15057 armv8.3-a
15058 +fp16
15059 The half-precision floating-point data processing
15060 instructions. This also enables the Advanced SIMD and
15061 floating-point instructions.
15062
15063 +fp16fml
15064 The half-precision floating-point fmla extension. This
15065 also enables the half-precision floating-point extension
15066 and Advanced SIMD and floating-point instructions.
15067
15068 +simd
15069 The ARMv8.1-A Advanced SIMD and floating-point
15070 instructions.
15071
15072 +crypto
15073 The cryptographic instructions. This also enables the
15074 Advanced SIMD and floating-point instructions.
15075
15076 +dotprod
15077 Enable the Dot Product extension. This also enables
15078 Advanced SIMD instructions.
15079
15080 +nocrypto
15081 Disable the cryptographic extension.
15082
15083 +nofp
15084 Disable the floating-point, Advanced SIMD and cryptographic
15085 instructions.
15086
15087 +sb Speculation Barrier Instruction.
15088
15089 +predres
15090 Execution and Data Prediction Restriction Instructions.
15091
15092 armv8.4-a
15093 +fp16
15094 The half-precision floating-point data processing
15095 instructions. This also enables the Advanced SIMD and
15096 floating-point instructions as well as the Dot Product
15097 extension and the half-precision floating-point fmla
15098 extension.
15099
15100 +simd
15101 The ARMv8.3-A Advanced SIMD and floating-point instructions
15102 as well as the Dot Product extension.
15103
15104 +crypto
15105 The cryptographic instructions. This also enables the
15106 Advanced SIMD and floating-point instructions as well as
15107 the Dot Product extension.
15108
15109 +nocrypto
15110 Disable the cryptographic extension.
15111
15112 +nofp
15113 Disable the floating-point, Advanced SIMD and cryptographic
15114 instructions.
15115
15116 +sb Speculation Barrier Instruction.
15117
15118 +predres
15119 Execution and Data Prediction Restriction Instructions.
15120
15121 armv8.5-a
15122 +fp16
15123 The half-precision floating-point data processing
15124 instructions. This also enables the Advanced SIMD and
15125 floating-point instructions as well as the Dot Product
15126 extension and the half-precision floating-point fmla
15127 extension.
15128
15129 +simd
15130 The ARMv8.3-A Advanced SIMD and floating-point instructions
15131 as well as the Dot Product extension.
15132
15133 +crypto
15134 The cryptographic instructions. This also enables the
15135 Advanced SIMD and floating-point instructions as well as
15136 the Dot Product extension.
15137
15138 +nocrypto
15139 Disable the cryptographic extension.
15140
15141 +nofp
15142 Disable the floating-point, Advanced SIMD and cryptographic
15143 instructions.
15144
15145 armv7-r
15146 +fp.sp
15147 The single-precision VFPv3 floating-point instructions.
15148 The extension +vfpv3xd can be used as an alias for this
15149 extension.
15150
15151 +fp The VFPv3 floating-point instructions with 16 double-
15152 precision registers. The extension +vfpv3-d16 can be used
15153 as an alias for this extension.
15154
15155 +vfpv3xd-d16-fp16
15156 The single-precision VFPv3 floating-point instructions with
15157 16 double-precision registers and the half-precision
15158 floating-point conversion operations.
15159
15160 +vfpv3-d16-fp16
15161 The VFPv3 floating-point instructions with 16 double-
15162 precision registers and the half-precision floating-point
15163 conversion operations.
15164
15165 +nofp
15166 Disable the floating-point extension.
15167
15168 +idiv
15169 The ARM-state integer division instructions.
15170
15171 +noidiv
15172 Disable the ARM-state integer division extension.
15173
15174 armv7e-m
15175 +fp The single-precision VFPv4 floating-point instructions.
15176
15177 +fpv5
15178 The single-precision FPv5 floating-point instructions.
15179
15180 +fp.dp
15181 The single- and double-precision FPv5 floating-point
15182 instructions.
15183
15184 +nofp
15185 Disable the floating-point extensions.
15186
15187 armv8-m.main
15188 +dsp
15189 The DSP instructions.
15190
15191 +nodsp
15192 Disable the DSP extension.
15193
15194 +fp The single-precision floating-point instructions.
15195
15196 +fp.dp
15197 The single- and double-precision floating-point
15198 instructions.
15199
15200 +nofp
15201 Disable the floating-point extension.
15202
15203 armv8-r
15204 +crc
15205 The Cyclic Redundancy Check (CRC) instructions.
15206
15207 +fp.sp
15208 The single-precision FPv5 floating-point instructions.
15209
15210 +simd
15211 The ARMv8-A Advanced SIMD and floating-point instructions.
15212
15213 +crypto
15214 The cryptographic instructions.
15215
15216 +nocrypto
15217 Disable the cryptographic instructions.
15218
15219 +nofp
15220 Disable the floating-point, Advanced SIMD and cryptographic
15221 instructions.
15222
15223 -march=native causes the compiler to auto-detect the architecture
15224 of the build computer. At present, this feature is only supported
15225 on GNU/Linux, and not all architectures are recognized. If the
15226 auto-detect is unsuccessful the option has no effect.
15227
15228 -mtune=name
15229 This option specifies the name of the target ARM processor for
15230 which GCC should tune the performance of the code. For some ARM
15231 implementations better performance can be obtained by using this
15232 option. Permissible names are: arm7tdmi, arm7tdmi-s, arm710t,
15233 arm720t, arm740t, strongarm, strongarm110, strongarm1100,
15234 0strongarm1110, arm8, arm810, arm9, arm9e, arm920, arm920t,
15235 arm922t, arm946e-s, arm966e-s, arm968e-s, arm926ej-s, arm940t,
15236 arm9tdmi, arm10tdmi, arm1020t, arm1026ej-s, arm10e, arm1020e,
15237 arm1022e, arm1136j-s, arm1136jf-s, mpcore, mpcorenovfp,
15238 arm1156t2-s, arm1156t2f-s, arm1176jz-s, arm1176jzf-s,
15239 generic-armv7-a, cortex-a5, cortex-a7, cortex-a8, cortex-a9,
15240 cortex-a12, cortex-a15, cortex-a17, cortex-a32, cortex-a35,
15241 cortex-a53, cortex-a55, cortex-a57, cortex-a72, cortex-a73,
15242 cortex-a75, cortex-a76, ares, cortex-r4, cortex-r4f, cortex-r5,
15243 cortex-r7, cortex-r8, cortex-r52, cortex-m0, cortex-m0plus,
15244 cortex-m1, cortex-m3, cortex-m4, cortex-m7, cortex-m23, cortex-m33,
15245 cortex-m1.small-multiply, cortex-m0.small-multiply,
15246 cortex-m0plus.small-multiply, exynos-m1, marvell-pj4, neoverse-n1,
15247 xscale, iwmmxt, iwmmxt2, ep9312, fa526, fa626, fa606te, fa626te,
15248 fmp626, fa726te, xgene1.
15249
15250 Additionally, this option can specify that GCC should tune the
15251 performance of the code for a big.LITTLE system. Permissible names
15252 are: cortex-a15.cortex-a7, cortex-a17.cortex-a7,
15253 cortex-a57.cortex-a53, cortex-a72.cortex-a53,
15254 cortex-a72.cortex-a35, cortex-a73.cortex-a53,
15255 cortex-a75.cortex-a55, cortex-a76.cortex-a55.
15256
15257 -mtune=generic-arch specifies that GCC should tune the performance
15258 for a blend of processors within architecture arch. The aim is to
15259 generate code that run well on the current most popular processors,
15260 balancing between optimizations that benefit some CPUs in the
15261 range, and avoiding performance pitfalls of other CPUs. The
15262 effects of this option may change in future GCC versions as CPU
15263 models come and go.
15264
15265 -mtune permits the same extension options as -mcpu, but the
15266 extension options do not affect the tuning of the generated code.
15267
15268 -mtune=native causes the compiler to auto-detect the CPU of the
15269 build computer. At present, this feature is only supported on
15270 GNU/Linux, and not all architectures are recognized. If the auto-
15271 detect is unsuccessful the option has no effect.
15272
15273 -mcpu=name[+extension...]
15274 This specifies the name of the target ARM processor. GCC uses this
15275 name to derive the name of the target ARM architecture (as if
15276 specified by -march) and the ARM processor type for which to tune
15277 for performance (as if specified by -mtune). Where this option is
15278 used in conjunction with -march or -mtune, those options take
15279 precedence over the appropriate part of this option.
15280
15281 Many of the supported CPUs implement optional architectural
15282 extensions. Where this is so the architectural extensions are
15283 normally enabled by default. If implementations that lack the
15284 extension exist, then the extension syntax can be used to disable
15285 those extensions that have been omitted. For floating-point and
15286 Advanced SIMD (Neon) instructions, the settings of the options
15287 -mfloat-abi and -mfpu must also be considered: floating-point and
15288 Advanced SIMD instructions will only be used if -mfloat-abi is not
15289 set to soft; and any setting of -mfpu other than auto will override
15290 the available floating-point and SIMD extension instructions.
15291
15292 For example, cortex-a9 can be found in three major configurations:
15293 integer only, with just a floating-point unit or with floating-
15294 point and Advanced SIMD. The default is to enable all the
15295 instructions, but the extensions +nosimd and +nofp can be used to
15296 disable just the SIMD or both the SIMD and floating-point
15297 instructions respectively.
15298
15299 Permissible names for this option are the same as those for -mtune.
15300
15301 The following extension options are common to the listed CPUs:
15302
15303 +nodsp
15304 Disable the DSP instructions on cortex-m33.
15305
15306 +nofp
15307 Disables the floating-point instructions on arm9e, arm946e-s,
15308 arm966e-s, arm968e-s, arm10e, arm1020e, arm1022e, arm926ej-s,
15309 arm1026ej-s, cortex-r5, cortex-r7, cortex-r8, cortex-m4,
15310 cortex-m7 and cortex-m33. Disables the floating-point and SIMD
15311 instructions on generic-armv7-a, cortex-a5, cortex-a7,
15312 cortex-a8, cortex-a9, cortex-a12, cortex-a15, cortex-a17,
15313 cortex-a15.cortex-a7, cortex-a17.cortex-a7, cortex-a32,
15314 cortex-a35, cortex-a53 and cortex-a55.
15315
15316 +nofp.dp
15317 Disables the double-precision component of the floating-point
15318 instructions on cortex-r5, cortex-r7, cortex-r8, cortex-r52 and
15319 cortex-m7.
15320
15321 +nosimd
15322 Disables the SIMD (but not floating-point) instructions on
15323 generic-armv7-a, cortex-a5, cortex-a7 and cortex-a9.
15324
15325 +crypto
15326 Enables the cryptographic instructions on cortex-a32,
15327 cortex-a35, cortex-a53, cortex-a55, cortex-a57, cortex-a72,
15328 cortex-a73, cortex-a75, exynos-m1, xgene1,
15329 cortex-a57.cortex-a53, cortex-a72.cortex-a53,
15330 cortex-a73.cortex-a35, cortex-a73.cortex-a53 and
15331 cortex-a75.cortex-a55.
15332
15333 Additionally the generic-armv7-a pseudo target defaults to VFPv3
15334 with 16 double-precision registers. It supports the following
15335 extension options: mp, sec, vfpv3-d16, vfpv3, vfpv3-d16-fp16,
15336 vfpv3-fp16, vfpv4-d16, vfpv4, neon, neon-vfpv3, neon-fp16,
15337 neon-vfpv4. The meanings are the same as for the extensions to
15338 -march=armv7-a.
15339
15340 -mcpu=generic-arch is also permissible, and is equivalent to
15341 -march=arch -mtune=generic-arch. See -mtune for more information.
15342
15343 -mcpu=native causes the compiler to auto-detect the CPU of the
15344 build computer. At present, this feature is only supported on
15345 GNU/Linux, and not all architectures are recognized. If the auto-
15346 detect is unsuccessful the option has no effect.
15347
15348 -mfpu=name
15349 This specifies what floating-point hardware (or hardware emulation)
15350 is available on the target. Permissible names are: auto, vfpv2,
15351 vfpv3, vfpv3-fp16, vfpv3-d16, vfpv3-d16-fp16, vfpv3xd,
15352 vfpv3xd-fp16, neon-vfpv3, neon-fp16, vfpv4, vfpv4-d16, fpv4-sp-d16,
15353 neon-vfpv4, fpv5-d16, fpv5-sp-d16, fp-armv8, neon-fp-armv8 and
15354 crypto-neon-fp-armv8. Note that neon is an alias for neon-vfpv3
15355 and vfp is an alias for vfpv2.
15356
15357 The setting auto is the default and is special. It causes the
15358 compiler to select the floating-point and Advanced SIMD
15359 instructions based on the settings of -mcpu and -march.
15360
15361 If the selected floating-point hardware includes the NEON extension
15362 (e.g. -mfpu=neon), note that floating-point operations are not
15363 generated by GCC's auto-vectorization pass unless
15364 -funsafe-math-optimizations is also specified. This is because
15365 NEON hardware does not fully implement the IEEE 754 standard for
15366 floating-point arithmetic (in particular denormal values are
15367 treated as zero), so the use of NEON instructions may lead to a
15368 loss of precision.
15369
15370 You can also set the fpu name at function level by using the
15371 "target("fpu=")" function attributes or pragmas.
15372
15373 -mfp16-format=name
15374 Specify the format of the "__fp16" half-precision floating-point
15375 type. Permissible names are none, ieee, and alternative; the
15376 default is none, in which case the "__fp16" type is not defined.
15377
15378 -mstructure-size-boundary=n
15379 The sizes of all structures and unions are rounded up to a multiple
15380 of the number of bits set by this option. Permissible values are
15381 8, 32 and 64. The default value varies for different toolchains.
15382 For the COFF targeted toolchain the default value is 8. A value of
15383 64 is only allowed if the underlying ABI supports it.
15384
15385 Specifying a larger number can produce faster, more efficient code,
15386 but can also increase the size of the program. Different values
15387 are potentially incompatible. Code compiled with one value cannot
15388 necessarily expect to work with code or libraries compiled with
15389 another value, if they exchange information using structures or
15390 unions.
15391
15392 This option is deprecated.
15393
15394 -mabort-on-noreturn
15395 Generate a call to the function "abort" at the end of a "noreturn"
15396 function. It is executed if the function tries to return.
15397
15398 -mlong-calls
15399 -mno-long-calls
15400 Tells the compiler to perform function calls by first loading the
15401 address of the function into a register and then performing a
15402 subroutine call on this register. This switch is needed if the
15403 target function lies outside of the 64-megabyte addressing range of
15404 the offset-based version of subroutine call instruction.
15405
15406 Even if this switch is enabled, not all function calls are turned
15407 into long calls. The heuristic is that static functions, functions
15408 that have the "short_call" attribute, functions that are inside the
15409 scope of a "#pragma no_long_calls" directive, and functions whose
15410 definitions have already been compiled within the current
15411 compilation unit are not turned into long calls. The exceptions to
15412 this rule are that weak function definitions, functions with the
15413 "long_call" attribute or the "section" attribute, and functions
15414 that are within the scope of a "#pragma long_calls" directive are
15415 always turned into long calls.
15416
15417 This feature is not enabled by default. Specifying -mno-long-calls
15418 restores the default behavior, as does placing the function calls
15419 within the scope of a "#pragma long_calls_off" directive. Note
15420 these switches have no effect on how the compiler generates code to
15421 handle function calls via function pointers.
15422
15423 -msingle-pic-base
15424 Treat the register used for PIC addressing as read-only, rather
15425 than loading it in the prologue for each function. The runtime
15426 system is responsible for initializing this register with an
15427 appropriate value before execution begins.
15428
15429 -mpic-register=reg
15430 Specify the register to be used for PIC addressing. For standard
15431 PIC base case, the default is any suitable register determined by
15432 compiler. For single PIC base case, the default is R9 if target is
15433 EABI based or stack-checking is enabled, otherwise the default is
15434 R10.
15435
15436 -mpic-data-is-text-relative
15437 Assume that the displacement between the text and data segments is
15438 fixed at static link time. This permits using PC-relative
15439 addressing operations to access data known to be in the data
15440 segment. For non-VxWorks RTP targets, this option is enabled by
15441 default. When disabled on such targets, it will enable
15442 -msingle-pic-base by default.
15443
15444 -mpoke-function-name
15445 Write the name of each function into the text section, directly
15446 preceding the function prologue. The generated code is similar to
15447 this:
15448
15449 t0
15450 .ascii "arm_poke_function_name", 0
15451 .align
15452 t1
15453 .word 0xff000000 + (t1 - t0)
15454 arm_poke_function_name
15455 mov ip, sp
15456 stmfd sp!, {fp, ip, lr, pc}
15457 sub fp, ip, #4
15458
15459 When performing a stack backtrace, code can inspect the value of
15460 "pc" stored at "fp + 0". If the trace function then looks at
15461 location "pc - 12" and the top 8 bits are set, then we know that
15462 there is a function name embedded immediately preceding this
15463 location and has length "((pc[-3]) & 0xff000000)".
15464
15465 -mthumb
15466 -marm
15467 Select between generating code that executes in ARM and Thumb
15468 states. The default for most configurations is to generate code
15469 that executes in ARM state, but the default can be changed by
15470 configuring GCC with the --with-mode=state configure option.
15471
15472 You can also override the ARM and Thumb mode for each function by
15473 using the "target("thumb")" and "target("arm")" function attributes
15474 or pragmas.
15475
15476 -mflip-thumb
15477 Switch ARM/Thumb modes on alternating functions. This option is
15478 provided for regression testing of mixed Thumb/ARM code generation,
15479 and is not intended for ordinary use in compiling code.
15480
15481 -mtpcs-frame
15482 Generate a stack frame that is compliant with the Thumb Procedure
15483 Call Standard for all non-leaf functions. (A leaf function is one
15484 that does not call any other functions.) The default is
15485 -mno-tpcs-frame.
15486
15487 -mtpcs-leaf-frame
15488 Generate a stack frame that is compliant with the Thumb Procedure
15489 Call Standard for all leaf functions. (A leaf function is one that
15490 does not call any other functions.) The default is
15491 -mno-apcs-leaf-frame.
15492
15493 -mcallee-super-interworking
15494 Gives all externally visible functions in the file being compiled
15495 an ARM instruction set header which switches to Thumb mode before
15496 executing the rest of the function. This allows these functions to
15497 be called from non-interworking code. This option is not valid in
15498 AAPCS configurations because interworking is enabled by default.
15499
15500 -mcaller-super-interworking
15501 Allows calls via function pointers (including virtual functions) to
15502 execute correctly regardless of whether the target code has been
15503 compiled for interworking or not. There is a small overhead in the
15504 cost of executing a function pointer if this option is enabled.
15505 This option is not valid in AAPCS configurations because
15506 interworking is enabled by default.
15507
15508 -mtp=name
15509 Specify the access model for the thread local storage pointer. The
15510 valid models are soft, which generates calls to "__aeabi_read_tp",
15511 cp15, which fetches the thread pointer from "cp15" directly
15512 (supported in the arm6k architecture), and auto, which uses the
15513 best available method for the selected processor. The default
15514 setting is auto.
15515
15516 -mtls-dialect=dialect
15517 Specify the dialect to use for accessing thread local storage. Two
15518 dialects are supported---gnu and gnu2. The gnu dialect selects the
15519 original GNU scheme for supporting local and global dynamic TLS
15520 models. The gnu2 dialect selects the GNU descriptor scheme, which
15521 provides better performance for shared libraries. The GNU
15522 descriptor scheme is compatible with the original scheme, but does
15523 require new assembler, linker and library support. Initial and
15524 local exec TLS models are unaffected by this option and always use
15525 the original scheme.
15526
15527 -mword-relocations
15528 Only generate absolute relocations on word-sized values (i.e.
15529 R_ARM_ABS32). This is enabled by default on targets (uClinux,
15530 SymbianOS) where the runtime loader imposes this restriction, and
15531 when -fpic or -fPIC is specified. This option conflicts with
15532 -mslow-flash-data.
15533
15534 -mfix-cortex-m3-ldrd
15535 Some Cortex-M3 cores can cause data corruption when "ldrd"
15536 instructions with overlapping destination and base registers are
15537 used. This option avoids generating these instructions. This
15538 option is enabled by default when -mcpu=cortex-m3 is specified.
15539
15540 -munaligned-access
15541 -mno-unaligned-access
15542 Enables (or disables) reading and writing of 16- and 32- bit values
15543 from addresses that are not 16- or 32- bit aligned. By default
15544 unaligned access is disabled for all pre-ARMv6, all ARMv6-M and for
15545 ARMv8-M Baseline architectures, and enabled for all other
15546 architectures. If unaligned access is not enabled then words in
15547 packed data structures are accessed a byte at a time.
15548
15549 The ARM attribute "Tag_CPU_unaligned_access" is set in the
15550 generated object file to either true or false, depending upon the
15551 setting of this option. If unaligned access is enabled then the
15552 preprocessor symbol "__ARM_FEATURE_UNALIGNED" is also defined.
15553
15554 -mneon-for-64bits
15555 Enables using Neon to handle scalar 64-bits operations. This is
15556 disabled by default since the cost of moving data from core
15557 registers to Neon is high.
15558
15559 -mslow-flash-data
15560 Assume loading data from flash is slower than fetching instruction.
15561 Therefore literal load is minimized for better performance. This
15562 option is only supported when compiling for ARMv7 M-profile and off
15563 by default. It conflicts with -mword-relocations.
15564
15565 -masm-syntax-unified
15566 Assume inline assembler is using unified asm syntax. The default
15567 is currently off which implies divided syntax. This option has no
15568 impact on Thumb2. However, this may change in future releases of
15569 GCC. Divided syntax should be considered deprecated.
15570
15571 -mrestrict-it
15572 Restricts generation of IT blocks to conform to the rules of
15573 ARMv8-A. IT blocks can only contain a single 16-bit instruction
15574 from a select set of instructions. This option is on by default for
15575 ARMv8-A Thumb mode.
15576
15577 -mprint-tune-info
15578 Print CPU tuning information as comment in assembler file. This is
15579 an option used only for regression testing of the compiler and not
15580 intended for ordinary use in compiling code. This option is
15581 disabled by default.
15582
15583 -mverbose-cost-dump
15584 Enable verbose cost model dumping in the debug dump files. This
15585 option is provided for use in debugging the compiler.
15586
15587 -mpure-code
15588 Do not allow constant data to be placed in code sections.
15589 Additionally, when compiling for ELF object format give all text
15590 sections the ELF processor-specific section attribute
15591 "SHF_ARM_PURECODE". This option is only available when generating
15592 non-pic code for M-profile targets with the MOVT instruction.
15593
15594 -mcmse
15595 Generate secure code as per the "ARMv8-M Security Extensions:
15596 Requirements on Development Tools Engineering Specification", which
15597 can be found on
15598 <http://infocenter.arm.com/help/topic/com.arm.doc.ecm0359818/ECM0359818_armv8m_security_extensions_reqs_on_dev_tools_1_0.pdf>.
15599
15600 AVR Options
15601
15602 These options are defined for AVR implementations:
15603
15604 -mmcu=mcu
15605 Specify Atmel AVR instruction set architectures (ISA) or MCU type.
15606
15607 The default for this option is@tie{}avr2.
15608
15609 GCC supports the following AVR devices and ISAs:
15610
15611 "avr2"
15612 "Classic" devices with up to 8@tie{}KiB of program memory.
15613 mcu@tie{}= "attiny22", "attiny26", "at90c8534", "at90s2313",
15614 "at90s2323", "at90s2333", "at90s2343", "at90s4414",
15615 "at90s4433", "at90s4434", "at90s8515", "at90s8535".
15616
15617 "avr25"
15618 "Classic" devices with up to 8@tie{}KiB of program memory and
15619 with the "MOVW" instruction. mcu@tie{}= "ata5272", "ata6616c",
15620 "attiny13", "attiny13a", "attiny2313", "attiny2313a",
15621 "attiny24", "attiny24a", "attiny25", "attiny261", "attiny261a",
15622 "attiny43u", "attiny4313", "attiny44", "attiny44a",
15623 "attiny441", "attiny45", "attiny461", "attiny461a", "attiny48",
15624 "attiny828", "attiny84", "attiny84a", "attiny841", "attiny85",
15625 "attiny861", "attiny861a", "attiny87", "attiny88", "at86rf401".
15626
15627 "avr3"
15628 "Classic" devices with 16@tie{}KiB up to 64@tie{}KiB of program
15629 memory. mcu@tie{}= "at43usb355", "at76c711".
15630
15631 "avr31"
15632 "Classic" devices with 128@tie{}KiB of program memory.
15633 mcu@tie{}= "atmega103", "at43usb320".
15634
15635 "avr35"
15636 "Classic" devices with 16@tie{}KiB up to 64@tie{}KiB of program
15637 memory and with the "MOVW" instruction. mcu@tie{}= "ata5505",
15638 "ata6617c", "ata664251", "atmega16u2", "atmega32u2",
15639 "atmega8u2", "attiny1634", "attiny167", "at90usb162",
15640 "at90usb82".
15641
15642 "avr4"
15643 "Enhanced" devices with up to 8@tie{}KiB of program memory.
15644 mcu@tie{}= "ata6285", "ata6286", "ata6289", "ata6612c",
15645 "atmega48", "atmega48a", "atmega48p", "atmega48pa",
15646 "atmega48pb", "atmega8", "atmega8a", "atmega8hva",
15647 "atmega8515", "atmega8535", "atmega88", "atmega88a",
15648 "atmega88p", "atmega88pa", "atmega88pb", "at90pwm1",
15649 "at90pwm2", "at90pwm2b", "at90pwm3", "at90pwm3b", "at90pwm81".
15650
15651 "avr5"
15652 "Enhanced" devices with 16@tie{}KiB up to 64@tie{}KiB of
15653 program memory. mcu@tie{}= "ata5702m322", "ata5782",
15654 "ata5790", "ata5790n", "ata5791", "ata5795", "ata5831",
15655 "ata6613c", "ata6614q", "ata8210", "ata8510", "atmega16",
15656 "atmega16a", "atmega16hva", "atmega16hva2", "atmega16hvb",
15657 "atmega16hvbrevb", "atmega16m1", "atmega16u4", "atmega161",
15658 "atmega162", "atmega163", "atmega164a", "atmega164p",
15659 "atmega164pa", "atmega165", "atmega165a", "atmega165p",
15660 "atmega165pa", "atmega168", "atmega168a", "atmega168p",
15661 "atmega168pa", "atmega168pb", "atmega169", "atmega169a",
15662 "atmega169p", "atmega169pa", "atmega32", "atmega32a",
15663 "atmega32c1", "atmega32hvb", "atmega32hvbrevb", "atmega32m1",
15664 "atmega32u4", "atmega32u6", "atmega323", "atmega324a",
15665 "atmega324p", "atmega324pa", "atmega325", "atmega325a",
15666 "atmega325p", "atmega325pa", "atmega3250", "atmega3250a",
15667 "atmega3250p", "atmega3250pa", "atmega328", "atmega328p",
15668 "atmega328pb", "atmega329", "atmega329a", "atmega329p",
15669 "atmega329pa", "atmega3290", "atmega3290a", "atmega3290p",
15670 "atmega3290pa", "atmega406", "atmega64", "atmega64a",
15671 "atmega64c1", "atmega64hve", "atmega64hve2", "atmega64m1",
15672 "atmega64rfr2", "atmega640", "atmega644", "atmega644a",
15673 "atmega644p", "atmega644pa", "atmega644rfr2", "atmega645",
15674 "atmega645a", "atmega645p", "atmega6450", "atmega6450a",
15675 "atmega6450p", "atmega649", "atmega649a", "atmega649p",
15676 "atmega6490", "atmega6490a", "atmega6490p", "at90can32",
15677 "at90can64", "at90pwm161", "at90pwm216", "at90pwm316",
15678 "at90scr100", "at90usb646", "at90usb647", "at94k", "m3000".
15679
15680 "avr51"
15681 "Enhanced" devices with 128@tie{}KiB of program memory.
15682 mcu@tie{}= "atmega128", "atmega128a", "atmega128rfa1",
15683 "atmega128rfr2", "atmega1280", "atmega1281", "atmega1284",
15684 "atmega1284p", "atmega1284rfr2", "at90can128", "at90usb1286",
15685 "at90usb1287".
15686
15687 "avr6"
15688 "Enhanced" devices with 3-byte PC, i.e. with more than
15689 128@tie{}KiB of program memory. mcu@tie{}= "atmega256rfr2",
15690 "atmega2560", "atmega2561", "atmega2564rfr2".
15691
15692 "avrxmega2"
15693 "XMEGA" devices with more than 8@tie{}KiB and up to 64@tie{}KiB
15694 of program memory. mcu@tie{}= "atxmega16a4", "atxmega16a4u",
15695 "atxmega16c4", "atxmega16d4", "atxmega16e5", "atxmega32a4",
15696 "atxmega32a4u", "atxmega32c3", "atxmega32c4", "atxmega32d3",
15697 "atxmega32d4", "atxmega32e5", "atxmega8e5".
15698
15699 "avrxmega3"
15700 "XMEGA" devices with up to 64@tie{}KiB of combined program
15701 memory and RAM, and with program memory visible in the RAM
15702 address space. mcu@tie{}= "attiny1614", "attiny1616",
15703 "attiny1617", "attiny212", "attiny214", "attiny3214",
15704 "attiny3216", "attiny3217", "attiny412", "attiny414",
15705 "attiny416", "attiny417", "attiny814", "attiny816",
15706 "attiny817".
15707
15708 "avrxmega4"
15709 "XMEGA" devices with more than 64@tie{}KiB and up to
15710 128@tie{}KiB of program memory. mcu@tie{}= "atxmega64a3",
15711 "atxmega64a3u", "atxmega64a4u", "atxmega64b1", "atxmega64b3",
15712 "atxmega64c3", "atxmega64d3", "atxmega64d4".
15713
15714 "avrxmega5"
15715 "XMEGA" devices with more than 64@tie{}KiB and up to
15716 128@tie{}KiB of program memory and more than 64@tie{}KiB of
15717 RAM. mcu@tie{}= "atxmega64a1", "atxmega64a1u".
15718
15719 "avrxmega6"
15720 "XMEGA" devices with more than 128@tie{}KiB of program memory.
15721 mcu@tie{}= "atxmega128a3", "atxmega128a3u", "atxmega128b1",
15722 "atxmega128b3", "atxmega128c3", "atxmega128d3", "atxmega128d4",
15723 "atxmega192a3", "atxmega192a3u", "atxmega192c3",
15724 "atxmega192d3", "atxmega256a3", "atxmega256a3b",
15725 "atxmega256a3bu", "atxmega256a3u", "atxmega256c3",
15726 "atxmega256d3", "atxmega384c3", "atxmega384d3".
15727
15728 "avrxmega7"
15729 "XMEGA" devices with more than 128@tie{}KiB of program memory
15730 and more than 64@tie{}KiB of RAM. mcu@tie{}= "atxmega128a1",
15731 "atxmega128a1u", "atxmega128a4u".
15732
15733 "avrtiny"
15734 "TINY" Tiny core devices with 512@tie{}B up to 4@tie{}KiB of
15735 program memory. mcu@tie{}= "attiny10", "attiny20", "attiny4",
15736 "attiny40", "attiny5", "attiny9".
15737
15738 "avr1"
15739 This ISA is implemented by the minimal AVR core and supported
15740 for assembler only. mcu@tie{}= "attiny11", "attiny12",
15741 "attiny15", "attiny28", "at90s1200".
15742
15743 -mabsdata
15744 Assume that all data in static storage can be accessed by LDS / STS
15745 instructions. This option has only an effect on reduced Tiny
15746 devices like ATtiny40. See also the "absdata" AVR Variable
15747 Attributes,variable attribute.
15748
15749 -maccumulate-args
15750 Accumulate outgoing function arguments and acquire/release the
15751 needed stack space for outgoing function arguments once in function
15752 prologue/epilogue. Without this option, outgoing arguments are
15753 pushed before calling a function and popped afterwards.
15754
15755 Popping the arguments after the function call can be expensive on
15756 AVR so that accumulating the stack space might lead to smaller
15757 executables because arguments need not be removed from the stack
15758 after such a function call.
15759
15760 This option can lead to reduced code size for functions that
15761 perform several calls to functions that get their arguments on the
15762 stack like calls to printf-like functions.
15763
15764 -mbranch-cost=cost
15765 Set the branch costs for conditional branch instructions to cost.
15766 Reasonable values for cost are small, non-negative integers. The
15767 default branch cost is 0.
15768
15769 -mcall-prologues
15770 Functions prologues/epilogues are expanded as calls to appropriate
15771 subroutines. Code size is smaller.
15772
15773 -mgas-isr-prologues
15774 Interrupt service routines (ISRs) may use the "__gcc_isr" pseudo
15775 instruction supported by GNU Binutils. If this option is on, the
15776 feature can still be disabled for individual ISRs by means of the
15777 AVR Function Attributes,,"no_gccisr" function attribute. This
15778 feature is activated per default if optimization is on (but not
15779 with -Og, @pxref{Optimize Options}), and if GNU Binutils support
15780 PR21683 ("https://sourceware.org/PR21683").
15781
15782 -mint8
15783 Assume "int" to be 8-bit integer. This affects the sizes of all
15784 types: a "char" is 1 byte, an "int" is 1 byte, a "long" is 2 bytes,
15785 and "long long" is 4 bytes. Please note that this option does not
15786 conform to the C standards, but it results in smaller code size.
15787
15788 -mmain-is-OS_task
15789 Do not save registers in "main". The effect is the same like
15790 attaching attribute AVR Function Attributes,,"OS_task" to "main".
15791 It is activated per default if optimization is on.
15792
15793 -mn-flash=num
15794 Assume that the flash memory has a size of num times 64@tie{}KiB.
15795
15796 -mno-interrupts
15797 Generated code is not compatible with hardware interrupts. Code
15798 size is smaller.
15799
15800 -mrelax
15801 Try to replace "CALL" resp. "JMP" instruction by the shorter
15802 "RCALL" resp. "RJMP" instruction if applicable. Setting -mrelax
15803 just adds the --mlink-relax option to the assembler's command line
15804 and the --relax option to the linker's command line.
15805
15806 Jump relaxing is performed by the linker because jump offsets are
15807 not known before code is located. Therefore, the assembler code
15808 generated by the compiler is the same, but the instructions in the
15809 executable may differ from instructions in the assembler code.
15810
15811 Relaxing must be turned on if linker stubs are needed, see the
15812 section on "EIND" and linker stubs below.
15813
15814 -mrmw
15815 Assume that the device supports the Read-Modify-Write instructions
15816 "XCH", "LAC", "LAS" and "LAT".
15817
15818 -mshort-calls
15819 Assume that "RJMP" and "RCALL" can target the whole program memory.
15820
15821 This option is used internally for multilib selection. It is not
15822 an optimization option, and you don't need to set it by hand.
15823
15824 -msp8
15825 Treat the stack pointer register as an 8-bit register, i.e. assume
15826 the high byte of the stack pointer is zero. In general, you don't
15827 need to set this option by hand.
15828
15829 This option is used internally by the compiler to select and build
15830 multilibs for architectures "avr2" and "avr25". These
15831 architectures mix devices with and without "SPH". For any setting
15832 other than -mmcu=avr2 or -mmcu=avr25 the compiler driver adds or
15833 removes this option from the compiler proper's command line,
15834 because the compiler then knows if the device or architecture has
15835 an 8-bit stack pointer and thus no "SPH" register or not.
15836
15837 -mstrict-X
15838 Use address register "X" in a way proposed by the hardware. This
15839 means that "X" is only used in indirect, post-increment or pre-
15840 decrement addressing.
15841
15842 Without this option, the "X" register may be used in the same way
15843 as "Y" or "Z" which then is emulated by additional instructions.
15844 For example, loading a value with "X+const" addressing with a small
15845 non-negative "const < 64" to a register Rn is performed as
15846
15847 adiw r26, const ; X += const
15848 ld <Rn>, X ; <Rn> = *X
15849 sbiw r26, const ; X -= const
15850
15851 -mtiny-stack
15852 Only change the lower 8@tie{}bits of the stack pointer.
15853
15854 -mfract-convert-truncate
15855 Allow to use truncation instead of rounding towards zero for
15856 fractional fixed-point types.
15857
15858 -nodevicelib
15859 Don't link against AVR-LibC's device specific library "lib<mcu>.a".
15860
15861 -Waddr-space-convert
15862 Warn about conversions between address spaces in the case where the
15863 resulting address space is not contained in the incoming address
15864 space.
15865
15866 -Wmisspelled-isr
15867 Warn if the ISR is misspelled, i.e. without __vector prefix.
15868 Enabled by default.
15869
15870 "EIND" and Devices with More Than 128 Ki Bytes of Flash
15871
15872 Pointers in the implementation are 16@tie{}bits wide. The address of a
15873 function or label is represented as word address so that indirect jumps
15874 and calls can target any code address in the range of 64@tie{}Ki words.
15875
15876 In order to facilitate indirect jump on devices with more than
15877 128@tie{}Ki bytes of program memory space, there is a special function
15878 register called "EIND" that serves as most significant part of the
15879 target address when "EICALL" or "EIJMP" instructions are used.
15880
15881 Indirect jumps and calls on these devices are handled as follows by the
15882 compiler and are subject to some limitations:
15883
15884 * The compiler never sets "EIND".
15885
15886 * The compiler uses "EIND" implicitly in "EICALL"/"EIJMP"
15887 instructions or might read "EIND" directly in order to emulate an
15888 indirect call/jump by means of a "RET" instruction.
15889
15890 * The compiler assumes that "EIND" never changes during the startup
15891 code or during the application. In particular, "EIND" is not
15892 saved/restored in function or interrupt service routine
15893 prologue/epilogue.
15894
15895 * For indirect calls to functions and computed goto, the linker
15896 generates stubs. Stubs are jump pads sometimes also called
15897 trampolines. Thus, the indirect call/jump jumps to such a stub.
15898 The stub contains a direct jump to the desired address.
15899
15900 * Linker relaxation must be turned on so that the linker generates
15901 the stubs correctly in all situations. See the compiler option
15902 -mrelax and the linker option --relax. There are corner cases
15903 where the linker is supposed to generate stubs but aborts without
15904 relaxation and without a helpful error message.
15905
15906 * The default linker script is arranged for code with "EIND = 0". If
15907 code is supposed to work for a setup with "EIND != 0", a custom
15908 linker script has to be used in order to place the sections whose
15909 name start with ".trampolines" into the segment where "EIND" points
15910 to.
15911
15912 * The startup code from libgcc never sets "EIND". Notice that
15913 startup code is a blend of code from libgcc and AVR-LibC. For the
15914 impact of AVR-LibC on "EIND", see the AVR-LibC user manual
15915 ("http://nongnu.org/avr-libc/user-manual/").
15916
15917 * It is legitimate for user-specific startup code to set up "EIND"
15918 early, for example by means of initialization code located in
15919 section ".init3". Such code runs prior to general startup code that
15920 initializes RAM and calls constructors, but after the bit of
15921 startup code from AVR-LibC that sets "EIND" to the segment where
15922 the vector table is located.
15923
15924 #include <avr/io.h>
15925
15926 static void
15927 __attribute__((section(".init3"),naked,used,no_instrument_function))
15928 init3_set_eind (void)
15929 {
15930 __asm volatile ("ldi r24,pm_hh8(__trampolines_start)\n\t"
15931 "out %i0,r24" :: "n" (&EIND) : "r24","memory");
15932 }
15933
15934 The "__trampolines_start" symbol is defined in the linker script.
15935
15936 * Stubs are generated automatically by the linker if the following
15937 two conditions are met:
15938
15939 -<The address of a label is taken by means of the "gs" modifier>
15940 (short for generate stubs) like so:
15941
15942 LDI r24, lo8(gs(<func>))
15943 LDI r25, hi8(gs(<func>))
15944
15945 -<The final location of that label is in a code segment>
15946 outside the segment where the stubs are located.
15947
15948 * The compiler emits such "gs" modifiers for code labels in the
15949 following situations:
15950
15951 -<Taking address of a function or code label.>
15952 -<Computed goto.>
15953 -<If prologue-save function is used, see -mcall-prologues>
15954 command-line option.
15955
15956 -<Switch/case dispatch tables. If you do not want such dispatch>
15957 tables you can specify the -fno-jump-tables command-line
15958 option.
15959
15960 -<C and C++ constructors/destructors called during
15961 startup/shutdown.>
15962 -<If the tools hit a "gs()" modifier explained above.>
15963 * Jumping to non-symbolic addresses like so is not supported:
15964
15965 int main (void)
15966 {
15967 /* Call function at word address 0x2 */
15968 return ((int(*)(void)) 0x2)();
15969 }
15970
15971 Instead, a stub has to be set up, i.e. the function has to be
15972 called through a symbol ("func_4" in the example):
15973
15974 int main (void)
15975 {
15976 extern int func_4 (void);
15977
15978 /* Call function at byte address 0x4 */
15979 return func_4();
15980 }
15981
15982 and the application be linked with -Wl,--defsym,func_4=0x4.
15983 Alternatively, "func_4" can be defined in the linker script.
15984
15985 Handling of the "RAMPD", "RAMPX", "RAMPY" and "RAMPZ" Special Function
15986 Registers
15987
15988 Some AVR devices support memories larger than the 64@tie{}KiB range
15989 that can be accessed with 16-bit pointers. To access memory locations
15990 outside this 64@tie{}KiB range, the content of a "RAMP" register is
15991 used as high part of the address: The "X", "Y", "Z" address register is
15992 concatenated with the "RAMPX", "RAMPY", "RAMPZ" special function
15993 register, respectively, to get a wide address. Similarly, "RAMPD" is
15994 used together with direct addressing.
15995
15996 * The startup code initializes the "RAMP" special function registers
15997 with zero.
15998
15999 * If a AVR Named Address Spaces,named address space other than
16000 generic or "__flash" is used, then "RAMPZ" is set as needed before
16001 the operation.
16002
16003 * If the device supports RAM larger than 64@tie{}KiB and the compiler
16004 needs to change "RAMPZ" to accomplish an operation, "RAMPZ" is
16005 reset to zero after the operation.
16006
16007 * If the device comes with a specific "RAMP" register, the ISR
16008 prologue/epilogue saves/restores that SFR and initializes it with
16009 zero in case the ISR code might (implicitly) use it.
16010
16011 * RAM larger than 64@tie{}KiB is not supported by GCC for AVR
16012 targets. If you use inline assembler to read from locations
16013 outside the 16-bit address range and change one of the "RAMP"
16014 registers, you must reset it to zero after the access.
16015
16016 AVR Built-in Macros
16017
16018 GCC defines several built-in macros so that the user code can test for
16019 the presence or absence of features. Almost any of the following
16020 built-in macros are deduced from device capabilities and thus triggered
16021 by the -mmcu= command-line option.
16022
16023 For even more AVR-specific built-in macros see AVR Named Address Spaces
16024 and AVR Built-in Functions.
16025
16026 "__AVR_ARCH__"
16027 Build-in macro that resolves to a decimal number that identifies
16028 the architecture and depends on the -mmcu=mcu option. Possible
16029 values are:
16030
16031 2, 25, 3, 31, 35, 4, 5, 51, 6
16032
16033 for mcu="avr2", "avr25", "avr3", "avr31", "avr35", "avr4", "avr5",
16034 "avr51", "avr6",
16035
16036 respectively and
16037
16038 100, 102, 103, 104, 105, 106, 107
16039
16040 for mcu="avrtiny", "avrxmega2", "avrxmega3", "avrxmega4",
16041 "avrxmega5", "avrxmega6", "avrxmega7", respectively. If mcu
16042 specifies a device, this built-in macro is set accordingly. For
16043 example, with -mmcu=atmega8 the macro is defined to 4.
16044
16045 "__AVR_Device__"
16046 Setting -mmcu=device defines this built-in macro which reflects the
16047 device's name. For example, -mmcu=atmega8 defines the built-in
16048 macro "__AVR_ATmega8__", -mmcu=attiny261a defines
16049 "__AVR_ATtiny261A__", etc.
16050
16051 The built-in macros' names follow the scheme "__AVR_Device__" where
16052 Device is the device name as from the AVR user manual. The
16053 difference between Device in the built-in macro and device in
16054 -mmcu=device is that the latter is always lowercase.
16055
16056 If device is not a device but only a core architecture like avr51,
16057 this macro is not defined.
16058
16059 "__AVR_DEVICE_NAME__"
16060 Setting -mmcu=device defines this built-in macro to the device's
16061 name. For example, with -mmcu=atmega8 the macro is defined to
16062 "atmega8".
16063
16064 If device is not a device but only a core architecture like avr51,
16065 this macro is not defined.
16066
16067 "__AVR_XMEGA__"
16068 The device / architecture belongs to the XMEGA family of devices.
16069
16070 "__AVR_HAVE_ELPM__"
16071 The device has the "ELPM" instruction.
16072
16073 "__AVR_HAVE_ELPMX__"
16074 The device has the "ELPM Rn,Z" and "ELPM Rn,Z+" instructions.
16075
16076 "__AVR_HAVE_MOVW__"
16077 The device has the "MOVW" instruction to perform 16-bit register-
16078 register moves.
16079
16080 "__AVR_HAVE_LPMX__"
16081 The device has the "LPM Rn,Z" and "LPM Rn,Z+" instructions.
16082
16083 "__AVR_HAVE_MUL__"
16084 The device has a hardware multiplier.
16085
16086 "__AVR_HAVE_JMP_CALL__"
16087 The device has the "JMP" and "CALL" instructions. This is the case
16088 for devices with more than 8@tie{}KiB of program memory.
16089
16090 "__AVR_HAVE_EIJMP_EICALL__"
16091 "__AVR_3_BYTE_PC__"
16092 The device has the "EIJMP" and "EICALL" instructions. This is the
16093 case for devices with more than 128@tie{}KiB of program memory.
16094 This also means that the program counter (PC) is 3@tie{}bytes wide.
16095
16096 "__AVR_2_BYTE_PC__"
16097 The program counter (PC) is 2@tie{}bytes wide. This is the case for
16098 devices with up to 128@tie{}KiB of program memory.
16099
16100 "__AVR_HAVE_8BIT_SP__"
16101 "__AVR_HAVE_16BIT_SP__"
16102 The stack pointer (SP) register is treated as 8-bit respectively
16103 16-bit register by the compiler. The definition of these macros is
16104 affected by -mtiny-stack.
16105
16106 "__AVR_HAVE_SPH__"
16107 "__AVR_SP8__"
16108 The device has the SPH (high part of stack pointer) special
16109 function register or has an 8-bit stack pointer, respectively. The
16110 definition of these macros is affected by -mmcu= and in the cases
16111 of -mmcu=avr2 and -mmcu=avr25 also by -msp8.
16112
16113 "__AVR_HAVE_RAMPD__"
16114 "__AVR_HAVE_RAMPX__"
16115 "__AVR_HAVE_RAMPY__"
16116 "__AVR_HAVE_RAMPZ__"
16117 The device has the "RAMPD", "RAMPX", "RAMPY", "RAMPZ" special
16118 function register, respectively.
16119
16120 "__NO_INTERRUPTS__"
16121 This macro reflects the -mno-interrupts command-line option.
16122
16123 "__AVR_ERRATA_SKIP__"
16124 "__AVR_ERRATA_SKIP_JMP_CALL__"
16125 Some AVR devices (AT90S8515, ATmega103) must not skip 32-bit
16126 instructions because of a hardware erratum. Skip instructions are
16127 "SBRS", "SBRC", "SBIS", "SBIC" and "CPSE". The second macro is
16128 only defined if "__AVR_HAVE_JMP_CALL__" is also set.
16129
16130 "__AVR_ISA_RMW__"
16131 The device has Read-Modify-Write instructions (XCH, LAC, LAS and
16132 LAT).
16133
16134 "__AVR_SFR_OFFSET__=offset"
16135 Instructions that can address I/O special function registers
16136 directly like "IN", "OUT", "SBI", etc. may use a different address
16137 as if addressed by an instruction to access RAM like "LD" or "STS".
16138 This offset depends on the device architecture and has to be
16139 subtracted from the RAM address in order to get the respective
16140 I/O@tie{}address.
16141
16142 "__AVR_SHORT_CALLS__"
16143 The -mshort-calls command line option is set.
16144
16145 "__AVR_PM_BASE_ADDRESS__=addr"
16146 Some devices support reading from flash memory by means of "LD*"
16147 instructions. The flash memory is seen in the data address space
16148 at an offset of "__AVR_PM_BASE_ADDRESS__". If this macro is not
16149 defined, this feature is not available. If defined, the address
16150 space is linear and there is no need to put ".rodata" into RAM.
16151 This is handled by the default linker description file, and is
16152 currently available for "avrtiny" and "avrxmega3". Even more
16153 convenient, there is no need to use address spaces like "__flash"
16154 or features like attribute "progmem" and "pgm_read_*".
16155
16156 "__WITH_AVRLIBC__"
16157 The compiler is configured to be used together with AVR-Libc. See
16158 the --with-avrlibc configure option.
16159
16160 Blackfin Options
16161
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
16335 -march=name
16336 This specifies the name of the target architecture. GCC uses this
16337 name to determine what kind of instructions it can emit when
16338 generating assembly code. Permissible names are: c62x, c64x,
16339 c64x+, c67x, c67x+, c674x.
16340
16341 -mbig-endian
16342 Generate code for a big-endian target.
16343
16344 -mlittle-endian
16345 Generate code for a little-endian target. This is the default.
16346
16347 -msim
16348 Choose startup files and linker script suitable for the simulator.
16349
16350 -msdata=default
16351 Put small global and static data in the ".neardata" section, which
16352 is pointed to by register "B14". Put small uninitialized global
16353 and static data in the ".bss" section, which is adjacent to the
16354 ".neardata" section. Put small read-only data into the ".rodata"
16355 section. The corresponding sections used for large pieces of data
16356 are ".fardata", ".far" and ".const".
16357
16358 -msdata=all
16359 Put all data, not just small objects, into the sections reserved
16360 for small data, and use addressing relative to the "B14" register
16361 to access them.
16362
16363 -msdata=none
16364 Make no use of the sections reserved for small data, and use
16365 absolute addresses to access all data. Put all initialized global
16366 and static data in the ".fardata" section, and all uninitialized
16367 data in the ".far" section. Put all constant data into the
16368 ".const" section.
16369
16370 CRIS Options
16371
16372 These options are defined specifically for the CRIS ports.
16373
16374 -march=architecture-type
16375 -mcpu=architecture-type
16376 Generate code for the specified architecture. The choices for
16377 architecture-type are v3, v8 and v10 for respectively ETRAX 4,
16378 ETRAX 100, and ETRAX 100 LX. Default is v0 except for cris-axis-
16379 linux-gnu, where the default is v10.
16380
16381 -mtune=architecture-type
16382 Tune to architecture-type everything applicable about the generated
16383 code, except for the ABI and the set of available instructions.
16384 The choices for architecture-type are the same as for
16385 -march=architecture-type.
16386
16387 -mmax-stack-frame=n
16388 Warn when the stack frame of a function exceeds n bytes.
16389
16390 -metrax4
16391 -metrax100
16392 The options -metrax4 and -metrax100 are synonyms for -march=v3 and
16393 -march=v8 respectively.
16394
16395 -mmul-bug-workaround
16396 -mno-mul-bug-workaround
16397 Work around a bug in the "muls" and "mulu" instructions for CPU
16398 models where it applies. This option is active by default.
16399
16400 -mpdebug
16401 Enable CRIS-specific verbose debug-related information in the
16402 assembly code. This option also has the effect of turning off the
16403 #NO_APP formatted-code indicator to the assembler at the beginning
16404 of the assembly file.
16405
16406 -mcc-init
16407 Do not use condition-code results from previous instruction; always
16408 emit compare and test instructions before use of condition codes.
16409
16410 -mno-side-effects
16411 Do not emit instructions with side effects in addressing modes
16412 other than post-increment.
16413
16414 -mstack-align
16415 -mno-stack-align
16416 -mdata-align
16417 -mno-data-align
16418 -mconst-align
16419 -mno-const-align
16420 These options (no- options) arrange (eliminate arrangements) for
16421 the stack frame, individual data and constants to be aligned for
16422 the maximum single data access size for the chosen CPU model. The
16423 default is to arrange for 32-bit alignment. ABI details such as
16424 structure layout are not affected by these options.
16425
16426 -m32-bit
16427 -m16-bit
16428 -m8-bit
16429 Similar to the stack- data- and const-align options above, these
16430 options arrange for stack frame, writable data and constants to all
16431 be 32-bit, 16-bit or 8-bit aligned. The default is 32-bit
16432 alignment.
16433
16434 -mno-prologue-epilogue
16435 -mprologue-epilogue
16436 With -mno-prologue-epilogue, the normal function prologue and
16437 epilogue which set up the stack frame are omitted and no return
16438 instructions or return sequences are generated in the code. Use
16439 this option only together with visual inspection of the compiled
16440 code: no warnings or errors are generated when call-saved registers
16441 must be saved, or storage for local variables needs to be
16442 allocated.
16443
16444 -mno-gotplt
16445 -mgotplt
16446 With -fpic and -fPIC, don't generate (do generate) instruction
16447 sequences that load addresses for functions from the PLT part of
16448 the GOT rather than (traditional on other architectures) calls to
16449 the PLT. The default is -mgotplt.
16450
16451 -melf
16452 Legacy no-op option only recognized with the cris-axis-elf and
16453 cris-axis-linux-gnu targets.
16454
16455 -mlinux
16456 Legacy no-op option only recognized with the cris-axis-linux-gnu
16457 target.
16458
16459 -sim
16460 This option, recognized for the cris-axis-elf, arranges to link
16461 with input-output functions from a simulator library. Code,
16462 initialized data and zero-initialized data are allocated
16463 consecutively.
16464
16465 -sim2
16466 Like -sim, but pass linker options to locate initialized data at
16467 0x40000000 and zero-initialized data at 0x80000000.
16468
16469 CR16 Options
16470
16471 These options are defined specifically for the CR16 ports.
16472
16473 -mmac
16474 Enable the use of multiply-accumulate instructions. Disabled by
16475 default.
16476
16477 -mcr16cplus
16478 -mcr16c
16479 Generate code for CR16C or CR16C+ architecture. CR16C+ architecture
16480 is default.
16481
16482 -msim
16483 Links the library libsim.a which is in compatible with simulator.
16484 Applicable to ELF compiler only.
16485
16486 -mint32
16487 Choose integer type as 32-bit wide.
16488
16489 -mbit-ops
16490 Generates "sbit"/"cbit" instructions for bit manipulations.
16491
16492 -mdata-model=model
16493 Choose a data model. The choices for model are near, far or medium.
16494 medium is default. However, far is not valid with -mcr16c, as the
16495 CR16C architecture does not support the far data model.
16496
16497 C-SKY Options
16498
16499 GCC supports these options when compiling for C-SKY V2 processors.
16500
16501 -march=arch
16502 Specify the C-SKY target architecture. Valid values for arch are:
16503 ck801, ck802, ck803, ck807, and ck810. The default is ck810.
16504
16505 -mcpu=cpu
16506 Specify the C-SKY target processor. Valid values for cpu are:
16507 ck801, ck801t, ck802, ck802t, ck802j, ck803, ck803h, ck803t,
16508 ck803ht, ck803f, ck803fh, ck803e, ck803eh, ck803et, ck803eht,
16509 ck803ef, ck803efh, ck803ft, ck803eft, ck803efht, ck803r1, ck803hr1,
16510 ck803tr1, ck803htr1, ck803fr1, ck803fhr1, ck803er1, ck803ehr1,
16511 ck803etr1, ck803ehtr1, ck803efr1, ck803efhr1, ck803ftr1,
16512 ck803eftr1, ck803efhtr1, ck803s, ck803st, ck803se, ck803sf,
16513 ck803sef, ck803seft, ck807e, ck807ef, ck807, ck807f, ck810e,
16514 ck810et, ck810ef, ck810eft, ck810, ck810v, ck810f, ck810t, ck810fv,
16515 ck810tv, ck810ft, and ck810ftv.
16516
16517 -mbig-endian
16518 -EB
16519 -mlittle-endian
16520 -EL Select big- or little-endian code. The default is little-endian.
16521
16522 -mhard-float
16523 -msoft-float
16524 Select hardware or software floating-point implementations. The
16525 default is soft float.
16526
16527 -mdouble-float
16528 -mno-double-float
16529 When -mhard-float is in effect, enable generation of double-
16530 precision float instructions. This is the default except when
16531 compiling for CK803.
16532
16533 -mfdivdu
16534 -mno-fdivdu
16535 When -mhard-float is in effect, enable generation of "frecipd",
16536 "fsqrtd", and "fdivd" instructions. This is the default except
16537 when compiling for CK803.
16538
16539 -mfpu=fpu
16540 Select the floating-point processor. This option can only be used
16541 with -mhard-float. Values for fpu are fpv2_sf (equivalent to
16542 -mno-double-float -mno-fdivdu), fpv2 (-mdouble-float -mno-divdu),
16543 and fpv2_divd (-mdouble-float -mdivdu).
16544
16545 -melrw
16546 -mno-elrw
16547 Enable the extended "lrw" instruction. This option defaults to on
16548 for CK801 and off otherwise.
16549
16550 -mistack
16551 -mno-istack
16552 Enable interrupt stack instructions; the default is off.
16553
16554 The -mistack option is required to handle the "interrupt" and "isr"
16555 function attributes.
16556
16557 -mmp
16558 Enable multiprocessor instructions; the default is off.
16559
16560 -mcp
16561 Enable coprocessor instructions; the default is off.
16562
16563 -mcache
16564 Enable coprocessor instructions; the default is off.
16565
16566 -msecurity
16567 Enable C-SKY security instructions; the default is off.
16568
16569 -mtrust
16570 Enable C-SKY trust instructions; the default is off.
16571
16572 -mdsp
16573 -medsp
16574 -mvdsp
16575 Enable C-SKY DSP, Enhanced DSP, or Vector DSP instructions,
16576 respectively. All of these options default to off.
16577
16578 -mdiv
16579 -mno-div
16580 Generate divide instructions. Default is off.
16581
16582 -msmart
16583 -mno-smart
16584 Generate code for Smart Mode, using only registers numbered 0-7 to
16585 allow use of 16-bit instructions. This option is ignored for CK801
16586 where this is the required behavior, and it defaults to on for
16587 CK802. For other targets, the default is off.
16588
16589 -mhigh-registers
16590 -mno-high-registers
16591 Generate code using the high registers numbered 16-31. This option
16592 is not supported on CK801, CK802, or CK803, and is enabled by
16593 default for other processors.
16594
16595 -manchor
16596 -mno-anchor
16597 Generate code using global anchor symbol addresses.
16598
16599 -mpushpop
16600 -mno-pushpop
16601 Generate code using "push" and "pop" instructions. This option
16602 defaults to on.
16603
16604 -mmultiple-stld
16605 -mstm
16606 -mno-multiple-stld
16607 -mno-stm
16608 Generate code using "stm" and "ldm" instructions. This option
16609 isn't supported on CK801 but is enabled by default on other
16610 processors.
16611
16612 -mconstpool
16613 -mno-constpool
16614 Create constant pools in the compiler instead of deferring it to
16615 the assembler. This option is the default and required for correct
16616 code generation on CK801 and CK802, and is optional on other
16617 processors.
16618
16619 -mstack-size
16620 -mno-stack-size
16621 Emit ".stack_size" directives for each function in the assembly
16622 output. This option defaults to off.
16623
16624 -mccrt
16625 -mno-ccrt
16626 Generate code for the C-SKY compiler runtime instead of libgcc.
16627 This option defaults to off.
16628
16629 -mbranch-cost=n
16630 Set the branch costs to roughly "n" instructions. The default is
16631 1.
16632
16633 -msched-prolog
16634 -mno-sched-prolog
16635 Permit scheduling of function prologue and epilogue sequences.
16636 Using this option can result in code that is not compliant with the
16637 C-SKY V2 ABI prologue requirements and that cannot be debugged or
16638 backtraced. It is disabled by default.
16639
16640 Darwin Options
16641
16642 These options are defined for all architectures running the Darwin
16643 operating system.
16644
16645 FSF GCC on Darwin does not create "fat" object files; it creates an
16646 object file for the single architecture that GCC was built to target.
16647 Apple's GCC on Darwin does create "fat" files if multiple -arch options
16648 are used; it does so by running the compiler or linker multiple times
16649 and joining the results together with lipo.
16650
16651 The subtype of the file created (like ppc7400 or ppc970 or i686) is
16652 determined by the flags that specify the ISA that GCC is targeting,
16653 like -mcpu or -march. The -force_cpusubtype_ALL option can be used to
16654 override this.
16655
16656 The Darwin tools vary in their behavior when presented with an ISA
16657 mismatch. The assembler, as, only permits instructions to be used that
16658 are valid for the subtype of the file it is generating, so you cannot
16659 put 64-bit instructions in a ppc750 object file. The linker for shared
16660 libraries, /usr/bin/libtool, fails and prints an error if asked to
16661 create a shared library with a less restrictive subtype than its input
16662 files (for instance, trying to put a ppc970 object file in a ppc7400
16663 library). The linker for executables, ld, quietly gives the executable
16664 the most restrictive subtype of any of its input files.
16665
16666 -Fdir
16667 Add the framework directory dir to the head of the list of
16668 directories to be searched for header files. These directories are
16669 interleaved with those specified by -I options and are scanned in a
16670 left-to-right order.
16671
16672 A framework directory is a directory with frameworks in it. A
16673 framework is a directory with a Headers and/or PrivateHeaders
16674 directory contained directly in it that ends in .framework. The
16675 name of a framework is the name of this directory excluding the
16676 .framework. Headers associated with the framework are found in one
16677 of those two directories, with Headers being searched first. A
16678 subframework is a framework directory that is in a framework's
16679 Frameworks directory. Includes of subframework headers can only
16680 appear in a header of a framework that contains the subframework,
16681 or in a sibling subframework header. Two subframeworks are
16682 siblings if they occur in the same framework. A subframework
16683 should not have the same name as a framework; a warning is issued
16684 if this is violated. Currently a subframework cannot have
16685 subframeworks; in the future, the mechanism may be extended to
16686 support this. The standard frameworks can be found in
16687 /System/Library/Frameworks and /Library/Frameworks. An example
16688 include looks like "#include <Framework/header.h>", where Framework
16689 denotes the name of the framework and header.h is found in the
16690 PrivateHeaders or Headers directory.
16691
16692 -iframeworkdir
16693 Like -F except the directory is a treated as a system directory.
16694 The main difference between this -iframework and -F is that with
16695 -iframework the compiler does not warn about constructs contained
16696 within header files found via dir. This option is valid only for
16697 the C family of languages.
16698
16699 -gused
16700 Emit debugging information for symbols that are used. For stabs
16701 debugging format, this enables -feliminate-unused-debug-symbols.
16702 This is by default ON.
16703
16704 -gfull
16705 Emit debugging information for all symbols and types.
16706
16707 -mmacosx-version-min=version
16708 The earliest version of MacOS X that this executable will run on is
16709 version. Typical values of version include 10.1, 10.2, and 10.3.9.
16710
16711 If the compiler was built to use the system's headers by default,
16712 then the default for this option is the system version on which the
16713 compiler is running, otherwise the default is to make choices that
16714 are compatible with as many systems and code bases as possible.
16715
16716 -mkernel
16717 Enable kernel development mode. The -mkernel option sets -static,
16718 -fno-common, -fno-use-cxa-atexit, -fno-exceptions,
16719 -fno-non-call-exceptions, -fapple-kext, -fno-weak and -fno-rtti
16720 where applicable. This mode also sets -mno-altivec, -msoft-float,
16721 -fno-builtin and -mlong-branch for PowerPC targets.
16722
16723 -mone-byte-bool
16724 Override the defaults for "bool" so that "sizeof(bool)==1". By
16725 default "sizeof(bool)" is 4 when compiling for Darwin/PowerPC and 1
16726 when compiling for Darwin/x86, so this option has no effect on x86.
16727
16728 Warning: The -mone-byte-bool switch causes GCC to generate code
16729 that is not binary compatible with code generated without that
16730 switch. Using this switch may require recompiling all other
16731 modules in a program, including system libraries. Use this switch
16732 to conform to a non-default data model.
16733
16734 -mfix-and-continue
16735 -ffix-and-continue
16736 -findirect-data
16737 Generate code suitable for fast turnaround development, such as to
16738 allow GDB to dynamically load .o files into already-running
16739 programs. -findirect-data and -ffix-and-continue are provided for
16740 backwards compatibility.
16741
16742 -all_load
16743 Loads all members of static archive libraries. See man ld(1) for
16744 more information.
16745
16746 -arch_errors_fatal
16747 Cause the errors having to do with files that have the wrong
16748 architecture to be fatal.
16749
16750 -bind_at_load
16751 Causes the output file to be marked such that the dynamic linker
16752 will bind all undefined references when the file is loaded or
16753 launched.
16754
16755 -bundle
16756 Produce a Mach-o bundle format file. See man ld(1) for more
16757 information.
16758
16759 -bundle_loader executable
16760 This option specifies the executable that will load the build
16761 output file being linked. See man ld(1) for more information.
16762
16763 -dynamiclib
16764 When passed this option, GCC produces a dynamic library instead of
16765 an executable when linking, using the Darwin libtool command.
16766
16767 -force_cpusubtype_ALL
16768 This causes GCC's output file to have the ALL subtype, instead of
16769 one controlled by the -mcpu or -march option.
16770
16771 -allowable_client client_name
16772 -client_name
16773 -compatibility_version
16774 -current_version
16775 -dead_strip
16776 -dependency-file
16777 -dylib_file
16778 -dylinker_install_name
16779 -dynamic
16780 -exported_symbols_list
16781 -filelist
16782 -flat_namespace
16783 -force_flat_namespace
16784 -headerpad_max_install_names
16785 -image_base
16786 -init
16787 -install_name
16788 -keep_private_externs
16789 -multi_module
16790 -multiply_defined
16791 -multiply_defined_unused
16792 -noall_load
16793 -no_dead_strip_inits_and_terms
16794 -nofixprebinding
16795 -nomultidefs
16796 -noprebind
16797 -noseglinkedit
16798 -pagezero_size
16799 -prebind
16800 -prebind_all_twolevel_modules
16801 -private_bundle
16802 -read_only_relocs
16803 -sectalign
16804 -sectobjectsymbols
16805 -whyload
16806 -seg1addr
16807 -sectcreate
16808 -sectobjectsymbols
16809 -sectorder
16810 -segaddr
16811 -segs_read_only_addr
16812 -segs_read_write_addr
16813 -seg_addr_table
16814 -seg_addr_table_filename
16815 -seglinkedit
16816 -segprot
16817 -segs_read_only_addr
16818 -segs_read_write_addr
16819 -single_module
16820 -static
16821 -sub_library
16822 -sub_umbrella
16823 -twolevel_namespace
16824 -umbrella
16825 -undefined
16826 -unexported_symbols_list
16827 -weak_reference_mismatches
16828 -whatsloaded
16829 These options are passed to the Darwin linker. The Darwin linker
16830 man page describes them in detail.
16831
16832 DEC Alpha Options
16833
16834 These -m options are defined for the DEC Alpha implementations:
16835
16836 -mno-soft-float
16837 -msoft-float
16838 Use (do not use) the hardware floating-point instructions for
16839 floating-point operations. When -msoft-float is specified,
16840 functions in libgcc.a are used to perform floating-point
16841 operations. Unless they are replaced by routines that emulate the
16842 floating-point operations, or compiled in such a way as to call
16843 such emulations routines, these routines issue floating-point
16844 operations. If you are compiling for an Alpha without floating-
16845 point operations, you must ensure that the library is built so as
16846 not to call them.
16847
16848 Note that Alpha implementations without floating-point operations
16849 are required to have floating-point registers.
16850
16851 -mfp-reg
16852 -mno-fp-regs
16853 Generate code that uses (does not use) the floating-point register
16854 set. -mno-fp-regs implies -msoft-float. If the floating-point
16855 register set is not used, floating-point operands are passed in
16856 integer registers as if they were integers and floating-point
16857 results are passed in $0 instead of $f0. This is a non-standard
16858 calling sequence, so any function with a floating-point argument or
16859 return value called by code compiled with -mno-fp-regs must also be
16860 compiled with that option.
16861
16862 A typical use of this option is building a kernel that does not
16863 use, and hence need not save and restore, any floating-point
16864 registers.
16865
16866 -mieee
16867 The Alpha architecture implements floating-point hardware optimized
16868 for maximum performance. It is mostly compliant with the IEEE
16869 floating-point standard. However, for full compliance, software
16870 assistance is required. This option generates code fully IEEE-
16871 compliant code except that the inexact-flag is not maintained (see
16872 below). If this option is turned on, the preprocessor macro
16873 "_IEEE_FP" is defined during compilation. The resulting code is
16874 less efficient but is able to correctly support denormalized
16875 numbers and exceptional IEEE values such as not-a-number and
16876 plus/minus infinity. Other Alpha compilers call this option
16877 -ieee_with_no_inexact.
16878
16879 -mieee-with-inexact
16880 This is like -mieee except the generated code also maintains the
16881 IEEE inexact-flag. Turning on this option causes the generated
16882 code to implement fully-compliant IEEE math. In addition to
16883 "_IEEE_FP", "_IEEE_FP_EXACT" is defined as a preprocessor macro.
16884 On some Alpha implementations the resulting code may execute
16885 significantly slower than the code generated by default. Since
16886 there is very little code that depends on the inexact-flag, you
16887 should normally not specify this option. Other Alpha compilers
16888 call this option -ieee_with_inexact.
16889
16890 -mfp-trap-mode=trap-mode
16891 This option controls what floating-point related traps are enabled.
16892 Other Alpha compilers call this option -fptm trap-mode. The trap
16893 mode can be set to one of four values:
16894
16895 n This is the default (normal) setting. The only traps that are
16896 enabled are the ones that cannot be disabled in software (e.g.,
16897 division by zero trap).
16898
16899 u In addition to the traps enabled by n, underflow traps are
16900 enabled as well.
16901
16902 su Like u, but the instructions are marked to be safe for software
16903 completion (see Alpha architecture manual for details).
16904
16905 sui Like su, but inexact traps are enabled as well.
16906
16907 -mfp-rounding-mode=rounding-mode
16908 Selects the IEEE rounding mode. Other Alpha compilers call this
16909 option -fprm rounding-mode. The rounding-mode can be one of:
16910
16911 n Normal IEEE rounding mode. Floating-point numbers are rounded
16912 towards the nearest machine number or towards the even machine
16913 number in case of a tie.
16914
16915 m Round towards minus infinity.
16916
16917 c Chopped rounding mode. Floating-point numbers are rounded
16918 towards zero.
16919
16920 d Dynamic rounding mode. A field in the floating-point control
16921 register (fpcr, see Alpha architecture reference manual)
16922 controls the rounding mode in effect. The C library
16923 initializes this register for rounding towards plus infinity.
16924 Thus, unless your program modifies the fpcr, d corresponds to
16925 round towards plus infinity.
16926
16927 -mtrap-precision=trap-precision
16928 In the Alpha architecture, floating-point traps are imprecise.
16929 This means without software assistance it is impossible to recover
16930 from a floating trap and program execution normally needs to be
16931 terminated. GCC can generate code that can assist operating system
16932 trap handlers in determining the exact location that caused a
16933 floating-point trap. Depending on the requirements of an
16934 application, different levels of precisions can be selected:
16935
16936 p Program precision. This option is the default and means a trap
16937 handler can only identify which program caused a floating-point
16938 exception.
16939
16940 f Function precision. The trap handler can determine the
16941 function that caused a floating-point exception.
16942
16943 i Instruction precision. The trap handler can determine the
16944 exact instruction that caused a floating-point exception.
16945
16946 Other Alpha compilers provide the equivalent options called
16947 -scope_safe and -resumption_safe.
16948
16949 -mieee-conformant
16950 This option marks the generated code as IEEE conformant. You must
16951 not use this option unless you also specify -mtrap-precision=i and
16952 either -mfp-trap-mode=su or -mfp-trap-mode=sui. Its only effect is
16953 to emit the line .eflag 48 in the function prologue of the
16954 generated assembly file.
16955
16956 -mbuild-constants
16957 Normally GCC examines a 32- or 64-bit integer constant to see if it
16958 can construct it from smaller constants in two or three
16959 instructions. If it cannot, it outputs the constant as a literal
16960 and generates code to load it from the data segment at run time.
16961
16962 Use this option to require GCC to construct all integer constants
16963 using code, even if it takes more instructions (the maximum is
16964 six).
16965
16966 You typically use this option to build a shared library dynamic
16967 loader. Itself a shared library, it must relocate itself in memory
16968 before it can find the variables and constants in its own data
16969 segment.
16970
16971 -mbwx
16972 -mno-bwx
16973 -mcix
16974 -mno-cix
16975 -mfix
16976 -mno-fix
16977 -mmax
16978 -mno-max
16979 Indicate whether GCC should generate code to use the optional BWX,
16980 CIX, FIX and MAX instruction sets. The default is to use the
16981 instruction sets supported by the CPU type specified via -mcpu=
16982 option or that of the CPU on which GCC was built if none is
16983 specified.
16984
16985 -mfloat-vax
16986 -mfloat-ieee
16987 Generate code that uses (does not use) VAX F and G floating-point
16988 arithmetic instead of IEEE single and double precision.
16989
16990 -mexplicit-relocs
16991 -mno-explicit-relocs
16992 Older Alpha assemblers provided no way to generate symbol
16993 relocations except via assembler macros. Use of these macros does
16994 not allow optimal instruction scheduling. GNU binutils as of
16995 version 2.12 supports a new syntax that allows the compiler to
16996 explicitly mark which relocations should apply to which
16997 instructions. This option is mostly useful for debugging, as GCC
16998 detects the capabilities of the assembler when it is built and sets
16999 the default accordingly.
17000
17001 -msmall-data
17002 -mlarge-data
17003 When -mexplicit-relocs is in effect, static data is accessed via
17004 gp-relative relocations. When -msmall-data is used, objects 8
17005 bytes long or smaller are placed in a small data area (the ".sdata"
17006 and ".sbss" sections) and are accessed via 16-bit relocations off
17007 of the $gp register. This limits the size of the small data area
17008 to 64KB, but allows the variables to be directly accessed via a
17009 single instruction.
17010
17011 The default is -mlarge-data. With this option the data area is
17012 limited to just below 2GB. Programs that require more than 2GB of
17013 data must use "malloc" or "mmap" to allocate the data in the heap
17014 instead of in the program's data segment.
17015
17016 When generating code for shared libraries, -fpic implies
17017 -msmall-data and -fPIC implies -mlarge-data.
17018
17019 -msmall-text
17020 -mlarge-text
17021 When -msmall-text is used, the compiler assumes that the code of
17022 the entire program (or shared library) fits in 4MB, and is thus
17023 reachable with a branch instruction. When -msmall-data is used,
17024 the compiler can assume that all local symbols share the same $gp
17025 value, and thus reduce the number of instructions required for a
17026 function call from 4 to 1.
17027
17028 The default is -mlarge-text.
17029
17030 -mcpu=cpu_type
17031 Set the instruction set and instruction scheduling parameters for
17032 machine type cpu_type. You can specify either the EV style name or
17033 the corresponding chip number. GCC supports scheduling parameters
17034 for the EV4, EV5 and EV6 family of processors and chooses the
17035 default values for the instruction set from the processor you
17036 specify. If you do not specify a processor type, GCC defaults to
17037 the processor on which the compiler was built.
17038
17039 Supported values for cpu_type are
17040
17041 ev4
17042 ev45
17043 21064
17044 Schedules as an EV4 and has no instruction set extensions.
17045
17046 ev5
17047 21164
17048 Schedules as an EV5 and has no instruction set extensions.
17049
17050 ev56
17051 21164a
17052 Schedules as an EV5 and supports the BWX extension.
17053
17054 pca56
17055 21164pc
17056 21164PC
17057 Schedules as an EV5 and supports the BWX and MAX extensions.
17058
17059 ev6
17060 21264
17061 Schedules as an EV6 and supports the BWX, FIX, and MAX
17062 extensions.
17063
17064 ev67
17065 21264a
17066 Schedules as an EV6 and supports the BWX, CIX, FIX, and MAX
17067 extensions.
17068
17069 Native toolchains also support the value native, which selects the
17070 best architecture option for the host processor. -mcpu=native has
17071 no effect if GCC does not recognize the processor.
17072
17073 -mtune=cpu_type
17074 Set only the instruction scheduling parameters for machine type
17075 cpu_type. The instruction set is not changed.
17076
17077 Native toolchains also support the value native, which selects the
17078 best architecture option for the host processor. -mtune=native has
17079 no effect if GCC does not recognize the processor.
17080
17081 -mmemory-latency=time
17082 Sets the latency the scheduler should assume for typical memory
17083 references as seen by the application. This number is highly
17084 dependent on the memory access patterns used by the application and
17085 the size of the external cache on the machine.
17086
17087 Valid options for time are
17088
17089 number
17090 A decimal number representing clock cycles.
17091
17092 L1
17093 L2
17094 L3
17095 main
17096 The compiler contains estimates of the number of clock cycles
17097 for "typical" EV4 & EV5 hardware for the Level 1, 2 & 3 caches
17098 (also called Dcache, Scache, and Bcache), as well as to main
17099 memory. Note that L3 is only valid for EV5.
17100
17101 FR30 Options
17102
17103 These options are defined specifically for the FR30 port.
17104
17105 -msmall-model
17106 Use the small address space model. This can produce smaller code,
17107 but it does assume that all symbolic values and addresses fit into
17108 a 20-bit range.
17109
17110 -mno-lsim
17111 Assume that runtime support has been provided and so there is no
17112 need to include the simulator library (libsim.a) on the linker
17113 command line.
17114
17115 FT32 Options
17116
17117 These options are defined specifically for the FT32 port.
17118
17119 -msim
17120 Specifies that the program will be run on the simulator. This
17121 causes an alternate runtime startup and library to be linked. You
17122 must not use this option when generating programs that will run on
17123 real hardware; you must provide your own runtime library for
17124 whatever I/O functions are needed.
17125
17126 -mlra
17127 Enable Local Register Allocation. This is still experimental for
17128 FT32, so by default the compiler uses standard reload.
17129
17130 -mnodiv
17131 Do not use div and mod instructions.
17132
17133 -mft32b
17134 Enable use of the extended instructions of the FT32B processor.
17135
17136 -mcompress
17137 Compress all code using the Ft32B code compression scheme.
17138
17139 -mnopm
17140 Do not generate code that reads program memory.
17141
17142 FRV Options
17143
17144 -mgpr-32
17145 Only use the first 32 general-purpose registers.
17146
17147 -mgpr-64
17148 Use all 64 general-purpose registers.
17149
17150 -mfpr-32
17151 Use only the first 32 floating-point registers.
17152
17153 -mfpr-64
17154 Use all 64 floating-point registers.
17155
17156 -mhard-float
17157 Use hardware instructions for floating-point operations.
17158
17159 -msoft-float
17160 Use library routines for floating-point operations.
17161
17162 -malloc-cc
17163 Dynamically allocate condition code registers.
17164
17165 -mfixed-cc
17166 Do not try to dynamically allocate condition code registers, only
17167 use "icc0" and "fcc0".
17168
17169 -mdword
17170 Change ABI to use double word insns.
17171
17172 -mno-dword
17173 Do not use double word instructions.
17174
17175 -mdouble
17176 Use floating-point double instructions.
17177
17178 -mno-double
17179 Do not use floating-point double instructions.
17180
17181 -mmedia
17182 Use media instructions.
17183
17184 -mno-media
17185 Do not use media instructions.
17186
17187 -mmuladd
17188 Use multiply and add/subtract instructions.
17189
17190 -mno-muladd
17191 Do not use multiply and add/subtract instructions.
17192
17193 -mfdpic
17194 Select the FDPIC ABI, which uses function descriptors to represent
17195 pointers to functions. Without any PIC/PIE-related options, it
17196 implies -fPIE. With -fpic or -fpie, it assumes GOT entries and
17197 small data are within a 12-bit range from the GOT base address;
17198 with -fPIC or -fPIE, GOT offsets are computed with 32 bits. With a
17199 bfin-elf target, this option implies -msim.
17200
17201 -minline-plt
17202 Enable inlining of PLT entries in function calls to functions that
17203 are not known to bind locally. It has no effect without -mfdpic.
17204 It's enabled by default if optimizing for speed and compiling for
17205 shared libraries (i.e., -fPIC or -fpic), or when an optimization
17206 option such as -O3 or above is present in the command line.
17207
17208 -mTLS
17209 Assume a large TLS segment when generating thread-local code.
17210
17211 -mtls
17212 Do not assume a large TLS segment when generating thread-local
17213 code.
17214
17215 -mgprel-ro
17216 Enable the use of "GPREL" relocations in the FDPIC ABI for data
17217 that is known to be in read-only sections. It's enabled by
17218 default, except for -fpic or -fpie: even though it may help make
17219 the global offset table smaller, it trades 1 instruction for 4.
17220 With -fPIC or -fPIE, it trades 3 instructions for 4, one of which
17221 may be shared by multiple symbols, and it avoids the need for a GOT
17222 entry for the referenced symbol, so it's more likely to be a win.
17223 If it is not, -mno-gprel-ro can be used to disable it.
17224
17225 -multilib-library-pic
17226 Link with the (library, not FD) pic libraries. It's implied by
17227 -mlibrary-pic, as well as by -fPIC and -fpic without -mfdpic. You
17228 should never have to use it explicitly.
17229
17230 -mlinked-fp
17231 Follow the EABI requirement of always creating a frame pointer
17232 whenever a stack frame is allocated. This option is enabled by
17233 default and can be disabled with -mno-linked-fp.
17234
17235 -mlong-calls
17236 Use indirect addressing to call functions outside the current
17237 compilation unit. This allows the functions to be placed anywhere
17238 within the 32-bit address space.
17239
17240 -malign-labels
17241 Try to align labels to an 8-byte boundary by inserting NOPs into
17242 the previous packet. This option only has an effect when VLIW
17243 packing is enabled. It doesn't create new packets; it merely adds
17244 NOPs to existing ones.
17245
17246 -mlibrary-pic
17247 Generate position-independent EABI code.
17248
17249 -macc-4
17250 Use only the first four media accumulator registers.
17251
17252 -macc-8
17253 Use all eight media accumulator registers.
17254
17255 -mpack
17256 Pack VLIW instructions.
17257
17258 -mno-pack
17259 Do not pack VLIW instructions.
17260
17261 -mno-eflags
17262 Do not mark ABI switches in e_flags.
17263
17264 -mcond-move
17265 Enable the use of conditional-move instructions (default).
17266
17267 This switch is mainly for debugging the compiler and will likely be
17268 removed in a future version.
17269
17270 -mno-cond-move
17271 Disable the use of conditional-move instructions.
17272
17273 This switch is mainly for debugging the compiler and will likely be
17274 removed in a future version.
17275
17276 -mscc
17277 Enable the use of conditional set instructions (default).
17278
17279 This switch is mainly for debugging the compiler and will likely be
17280 removed in a future version.
17281
17282 -mno-scc
17283 Disable the use of conditional set instructions.
17284
17285 This switch is mainly for debugging the compiler and will likely be
17286 removed in a future version.
17287
17288 -mcond-exec
17289 Enable the use of conditional execution (default).
17290
17291 This switch is mainly for debugging the compiler and will likely be
17292 removed in a future version.
17293
17294 -mno-cond-exec
17295 Disable the use of conditional execution.
17296
17297 This switch is mainly for debugging the compiler and will likely be
17298 removed in a future version.
17299
17300 -mvliw-branch
17301 Run a pass to pack branches into VLIW instructions (default).
17302
17303 This switch is mainly for debugging the compiler and will likely be
17304 removed in a future version.
17305
17306 -mno-vliw-branch
17307 Do not run a pass to pack branches into VLIW instructions.
17308
17309 This switch is mainly for debugging the compiler and will likely be
17310 removed in a future version.
17311
17312 -mmulti-cond-exec
17313 Enable optimization of "&&" and "||" in conditional execution
17314 (default).
17315
17316 This switch is mainly for debugging the compiler and will likely be
17317 removed in a future version.
17318
17319 -mno-multi-cond-exec
17320 Disable optimization of "&&" and "||" in conditional execution.
17321
17322 This switch is mainly for debugging the compiler and will likely be
17323 removed in a future version.
17324
17325 -mnested-cond-exec
17326 Enable nested conditional execution optimizations (default).
17327
17328 This switch is mainly for debugging the compiler and will likely be
17329 removed in a future version.
17330
17331 -mno-nested-cond-exec
17332 Disable nested conditional execution optimizations.
17333
17334 This switch is mainly for debugging the compiler and will likely be
17335 removed in a future version.
17336
17337 -moptimize-membar
17338 This switch removes redundant "membar" instructions from the
17339 compiler-generated code. It is enabled by default.
17340
17341 -mno-optimize-membar
17342 This switch disables the automatic removal of redundant "membar"
17343 instructions from the generated code.
17344
17345 -mtomcat-stats
17346 Cause gas to print out tomcat statistics.
17347
17348 -mcpu=cpu
17349 Select the processor type for which to generate code. Possible
17350 values are frv, fr550, tomcat, fr500, fr450, fr405, fr400, fr300
17351 and simple.
17352
17353 GNU/Linux Options
17354
17355 These -m options are defined for GNU/Linux targets:
17356
17357 -mglibc
17358 Use the GNU C library. This is the default except on
17359 *-*-linux-*uclibc*, *-*-linux-*musl* and *-*-linux-*android*
17360 targets.
17361
17362 -muclibc
17363 Use uClibc C library. This is the default on *-*-linux-*uclibc*
17364 targets.
17365
17366 -mmusl
17367 Use the musl C library. This is the default on *-*-linux-*musl*
17368 targets.
17369
17370 -mbionic
17371 Use Bionic C library. This is the default on *-*-linux-*android*
17372 targets.
17373
17374 -mandroid
17375 Compile code compatible with Android platform. This is the default
17376 on *-*-linux-*android* targets.
17377
17378 When compiling, this option enables -mbionic, -fPIC,
17379 -fno-exceptions and -fno-rtti by default. When linking, this
17380 option makes the GCC driver pass Android-specific options to the
17381 linker. Finally, this option causes the preprocessor macro
17382 "__ANDROID__" to be defined.
17383
17384 -tno-android-cc
17385 Disable compilation effects of -mandroid, i.e., do not enable
17386 -mbionic, -fPIC, -fno-exceptions and -fno-rtti by default.
17387
17388 -tno-android-ld
17389 Disable linking effects of -mandroid, i.e., pass standard Linux
17390 linking options to the linker.
17391
17392 H8/300 Options
17393
17394 These -m options are defined for the H8/300 implementations:
17395
17396 -mrelax
17397 Shorten some address references at link time, when possible; uses
17398 the linker option -relax.
17399
17400 -mh Generate code for the H8/300H.
17401
17402 -ms Generate code for the H8S.
17403
17404 -mn Generate code for the H8S and H8/300H in the normal mode. This
17405 switch must be used either with -mh or -ms.
17406
17407 -ms2600
17408 Generate code for the H8S/2600. This switch must be used with -ms.
17409
17410 -mexr
17411 Extended registers are stored on stack before execution of function
17412 with monitor attribute. Default option is -mexr. This option is
17413 valid only for H8S targets.
17414
17415 -mno-exr
17416 Extended registers are not stored on stack before execution of
17417 function with monitor attribute. Default option is -mno-exr. This
17418 option is valid only for H8S targets.
17419
17420 -mint32
17421 Make "int" data 32 bits by default.
17422
17423 -malign-300
17424 On the H8/300H and H8S, use the same alignment rules as for the
17425 H8/300. The default for the H8/300H and H8S is to align longs and
17426 floats on 4-byte boundaries. -malign-300 causes them to be aligned
17427 on 2-byte boundaries. This option has no effect on the H8/300.
17428
17429 HPPA Options
17430
17431 These -m options are defined for the HPPA family of computers:
17432
17433 -march=architecture-type
17434 Generate code for the specified architecture. The choices for
17435 architecture-type are 1.0 for PA 1.0, 1.1 for PA 1.1, and 2.0 for
17436 PA 2.0 processors. Refer to /usr/lib/sched.models on an HP-UX
17437 system to determine the proper architecture option for your
17438 machine. Code compiled for lower numbered architectures runs on
17439 higher numbered architectures, but not the other way around.
17440
17441 -mpa-risc-1-0
17442 -mpa-risc-1-1
17443 -mpa-risc-2-0
17444 Synonyms for -march=1.0, -march=1.1, and -march=2.0 respectively.
17445
17446 -mcaller-copies
17447 The caller copies function arguments passed by hidden reference.
17448 This option should be used with care as it is not compatible with
17449 the default 32-bit runtime. However, only aggregates larger than
17450 eight bytes are passed by hidden reference and the option provides
17451 better compatibility with OpenMP.
17452
17453 -mjump-in-delay
17454 This option is ignored and provided for compatibility purposes
17455 only.
17456
17457 -mdisable-fpregs
17458 Prevent floating-point registers from being used in any manner.
17459 This is necessary for compiling kernels that perform lazy context
17460 switching of floating-point registers. If you use this option and
17461 attempt to perform floating-point operations, the compiler aborts.
17462
17463 -mdisable-indexing
17464 Prevent the compiler from using indexing address modes. This
17465 avoids some rather obscure problems when compiling MIG generated
17466 code under MACH.
17467
17468 -mno-space-regs
17469 Generate code that assumes the target has no space registers. This
17470 allows GCC to generate faster indirect calls and use unscaled index
17471 address modes.
17472
17473 Such code is suitable for level 0 PA systems and kernels.
17474
17475 -mfast-indirect-calls
17476 Generate code that assumes calls never cross space boundaries.
17477 This allows GCC to emit code that performs faster indirect calls.
17478
17479 This option does not work in the presence of shared libraries or
17480 nested functions.
17481
17482 -mfixed-range=register-range
17483 Generate code treating the given register range as fixed registers.
17484 A fixed register is one that the register allocator cannot use.
17485 This is useful when compiling kernel code. A register range is
17486 specified as two registers separated by a dash. Multiple register
17487 ranges can be specified separated by a comma.
17488
17489 -mlong-load-store
17490 Generate 3-instruction load and store sequences as sometimes
17491 required by the HP-UX 10 linker. This is equivalent to the +k
17492 option to the HP compilers.
17493
17494 -mportable-runtime
17495 Use the portable calling conventions proposed by HP for ELF
17496 systems.
17497
17498 -mgas
17499 Enable the use of assembler directives only GAS understands.
17500
17501 -mschedule=cpu-type
17502 Schedule code according to the constraints for the machine type
17503 cpu-type. The choices for cpu-type are 700 7100, 7100LC, 7200,
17504 7300 and 8000. Refer to /usr/lib/sched.models on an HP-UX system
17505 to determine the proper scheduling option for your machine. The
17506 default scheduling is 8000.
17507
17508 -mlinker-opt
17509 Enable the optimization pass in the HP-UX linker. Note this makes
17510 symbolic debugging impossible. It also triggers a bug in the HP-UX
17511 8 and HP-UX 9 linkers in which they give bogus error messages when
17512 linking some programs.
17513
17514 -msoft-float
17515 Generate output containing library calls for floating point.
17516 Warning: the requisite libraries are not available for all HPPA
17517 targets. Normally the facilities of the machine's usual C compiler
17518 are used, but this cannot be done directly in cross-compilation.
17519 You must make your own arrangements to provide suitable library
17520 functions for cross-compilation.
17521
17522 -msoft-float changes the calling convention in the output file;
17523 therefore, it is only useful if you compile all of a program with
17524 this option. In particular, you need to compile libgcc.a, the
17525 library that comes with GCC, with -msoft-float in order for this to
17526 work.
17527
17528 -msio
17529 Generate the predefine, "_SIO", for server IO. The default is
17530 -mwsio. This generates the predefines, "__hp9000s700",
17531 "__hp9000s700__" and "_WSIO", for workstation IO. These options
17532 are available under HP-UX and HI-UX.
17533
17534 -mgnu-ld
17535 Use options specific to GNU ld. This passes -shared to ld when
17536 building a shared library. It is the default when GCC is
17537 configured, explicitly or implicitly, with the GNU linker. This
17538 option does not affect which ld is called; it only changes what
17539 parameters are passed to that ld. The ld that is called is
17540 determined by the --with-ld configure option, GCC's program search
17541 path, and finally by the user's PATH. The linker used by GCC can
17542 be printed using which `gcc -print-prog-name=ld`. This option is
17543 only available on the 64-bit HP-UX GCC, i.e. configured with
17544 hppa*64*-*-hpux*.
17545
17546 -mhp-ld
17547 Use options specific to HP ld. This passes -b to ld when building
17548 a shared library and passes +Accept TypeMismatch to ld on all
17549 links. It is the default when GCC is configured, explicitly or
17550 implicitly, with the HP linker. This option does not affect which
17551 ld is called; it only changes what parameters are passed to that
17552 ld. The ld that is called is determined by the --with-ld configure
17553 option, GCC's program search path, and finally by the user's PATH.
17554 The linker used by GCC can be printed using which `gcc
17555 -print-prog-name=ld`. This option is only available on the 64-bit
17556 HP-UX GCC, i.e. configured with hppa*64*-*-hpux*.
17557
17558 -mlong-calls
17559 Generate code that uses long call sequences. This ensures that a
17560 call is always able to reach linker generated stubs. The default
17561 is to generate long calls only when the distance from the call site
17562 to the beginning of the function or translation unit, as the case
17563 may be, exceeds a predefined limit set by the branch type being
17564 used. The limits for normal calls are 7,600,000 and 240,000 bytes,
17565 respectively for the PA 2.0 and PA 1.X architectures. Sibcalls are
17566 always limited at 240,000 bytes.
17567
17568 Distances are measured from the beginning of functions when using
17569 the -ffunction-sections option, or when using the -mgas and
17570 -mno-portable-runtime options together under HP-UX with the SOM
17571 linker.
17572
17573 It is normally not desirable to use this option as it degrades
17574 performance. However, it may be useful in large applications,
17575 particularly when partial linking is used to build the application.
17576
17577 The types of long calls used depends on the capabilities of the
17578 assembler and linker, and the type of code being generated. The
17579 impact on systems that support long absolute calls, and long pic
17580 symbol-difference or pc-relative calls should be relatively small.
17581 However, an indirect call is used on 32-bit ELF systems in pic code
17582 and it is quite long.
17583
17584 -munix=unix-std
17585 Generate compiler predefines and select a startfile for the
17586 specified UNIX standard. The choices for unix-std are 93, 95 and
17587 98. 93 is supported on all HP-UX versions. 95 is available on HP-
17588 UX 10.10 and later. 98 is available on HP-UX 11.11 and later. The
17589 default values are 93 for HP-UX 10.00, 95 for HP-UX 10.10 though to
17590 11.00, and 98 for HP-UX 11.11 and later.
17591
17592 -munix=93 provides the same predefines as GCC 3.3 and 3.4.
17593 -munix=95 provides additional predefines for "XOPEN_UNIX" and
17594 "_XOPEN_SOURCE_EXTENDED", and the startfile unix95.o. -munix=98
17595 provides additional predefines for "_XOPEN_UNIX",
17596 "_XOPEN_SOURCE_EXTENDED", "_INCLUDE__STDC_A1_SOURCE" and
17597 "_INCLUDE_XOPEN_SOURCE_500", and the startfile unix98.o.
17598
17599 It is important to note that this option changes the interfaces for
17600 various library routines. It also affects the operational behavior
17601 of the C library. Thus, extreme care is needed in using this
17602 option.
17603
17604 Library code that is intended to operate with more than one UNIX
17605 standard must test, set and restore the variable
17606 "__xpg4_extended_mask" as appropriate. Most GNU software doesn't
17607 provide this capability.
17608
17609 -nolibdld
17610 Suppress the generation of link options to search libdld.sl when
17611 the -static option is specified on HP-UX 10 and later.
17612
17613 -static
17614 The HP-UX implementation of setlocale in libc has a dependency on
17615 libdld.sl. There isn't an archive version of libdld.sl. Thus,
17616 when the -static option is specified, special link options are
17617 needed to resolve this dependency.
17618
17619 On HP-UX 10 and later, the GCC driver adds the necessary options to
17620 link with libdld.sl when the -static option is specified. This
17621 causes the resulting binary to be dynamic. On the 64-bit port, the
17622 linkers generate dynamic binaries by default in any case. The
17623 -nolibdld option can be used to prevent the GCC driver from adding
17624 these link options.
17625
17626 -threads
17627 Add support for multithreading with the dce thread library under
17628 HP-UX. This option sets flags for both the preprocessor and
17629 linker.
17630
17631 IA-64 Options
17632
17633 These are the -m options defined for the Intel IA-64 architecture.
17634
17635 -mbig-endian
17636 Generate code for a big-endian target. This is the default for HP-
17637 UX.
17638
17639 -mlittle-endian
17640 Generate code for a little-endian target. This is the default for
17641 AIX5 and GNU/Linux.
17642
17643 -mgnu-as
17644 -mno-gnu-as
17645 Generate (or don't) code for the GNU assembler. This is the
17646 default.
17647
17648 -mgnu-ld
17649 -mno-gnu-ld
17650 Generate (or don't) code for the GNU linker. This is the default.
17651
17652 -mno-pic
17653 Generate code that does not use a global pointer register. The
17654 result is not position independent code, and violates the IA-64
17655 ABI.
17656
17657 -mvolatile-asm-stop
17658 -mno-volatile-asm-stop
17659 Generate (or don't) a stop bit immediately before and after
17660 volatile asm statements.
17661
17662 -mregister-names
17663 -mno-register-names
17664 Generate (or don't) in, loc, and out register names for the stacked
17665 registers. This may make assembler output more readable.
17666
17667 -mno-sdata
17668 -msdata
17669 Disable (or enable) optimizations that use the small data section.
17670 This may be useful for working around optimizer bugs.
17671
17672 -mconstant-gp
17673 Generate code that uses a single constant global pointer value.
17674 This is useful when compiling kernel code.
17675
17676 -mauto-pic
17677 Generate code that is self-relocatable. This implies
17678 -mconstant-gp. This is useful when compiling firmware code.
17679
17680 -minline-float-divide-min-latency
17681 Generate code for inline divides of floating-point values using the
17682 minimum latency algorithm.
17683
17684 -minline-float-divide-max-throughput
17685 Generate code for inline divides of floating-point values using the
17686 maximum throughput algorithm.
17687
17688 -mno-inline-float-divide
17689 Do not generate inline code for divides of floating-point values.
17690
17691 -minline-int-divide-min-latency
17692 Generate code for inline divides of integer values using the
17693 minimum latency algorithm.
17694
17695 -minline-int-divide-max-throughput
17696 Generate code for inline divides of integer values using the
17697 maximum throughput algorithm.
17698
17699 -mno-inline-int-divide
17700 Do not generate inline code for divides of integer values.
17701
17702 -minline-sqrt-min-latency
17703 Generate code for inline square roots using the minimum latency
17704 algorithm.
17705
17706 -minline-sqrt-max-throughput
17707 Generate code for inline square roots using the maximum throughput
17708 algorithm.
17709
17710 -mno-inline-sqrt
17711 Do not generate inline code for "sqrt".
17712
17713 -mfused-madd
17714 -mno-fused-madd
17715 Do (don't) generate code that uses the fused multiply/add or
17716 multiply/subtract instructions. The default is to use these
17717 instructions.
17718
17719 -mno-dwarf2-asm
17720 -mdwarf2-asm
17721 Don't (or do) generate assembler code for the DWARF line number
17722 debugging info. This may be useful when not using the GNU
17723 assembler.
17724
17725 -mearly-stop-bits
17726 -mno-early-stop-bits
17727 Allow stop bits to be placed earlier than immediately preceding the
17728 instruction that triggered the stop bit. This can improve
17729 instruction scheduling, but does not always do so.
17730
17731 -mfixed-range=register-range
17732 Generate code treating the given register range as fixed registers.
17733 A fixed register is one that the register allocator cannot use.
17734 This is useful when compiling kernel code. A register range is
17735 specified as two registers separated by a dash. Multiple register
17736 ranges can be specified separated by a comma.
17737
17738 -mtls-size=tls-size
17739 Specify bit size of immediate TLS offsets. Valid values are 14,
17740 22, and 64.
17741
17742 -mtune=cpu-type
17743 Tune the instruction scheduling for a particular CPU, Valid values
17744 are itanium, itanium1, merced, itanium2, and mckinley.
17745
17746 -milp32
17747 -mlp64
17748 Generate code for a 32-bit or 64-bit environment. The 32-bit
17749 environment sets int, long and pointer to 32 bits. The 64-bit
17750 environment sets int to 32 bits and long and pointer to 64 bits.
17751 These are HP-UX specific flags.
17752
17753 -mno-sched-br-data-spec
17754 -msched-br-data-spec
17755 (Dis/En)able data speculative scheduling before reload. This
17756 results in generation of "ld.a" instructions and the corresponding
17757 check instructions ("ld.c" / "chk.a"). The default setting is
17758 disabled.
17759
17760 -msched-ar-data-spec
17761 -mno-sched-ar-data-spec
17762 (En/Dis)able data speculative scheduling after reload. This
17763 results in generation of "ld.a" instructions and the corresponding
17764 check instructions ("ld.c" / "chk.a"). The default setting is
17765 enabled.
17766
17767 -mno-sched-control-spec
17768 -msched-control-spec
17769 (Dis/En)able control speculative scheduling. This feature is
17770 available only during region scheduling (i.e. before reload). This
17771 results in generation of the "ld.s" instructions and the
17772 corresponding check instructions "chk.s". The default setting is
17773 disabled.
17774
17775 -msched-br-in-data-spec
17776 -mno-sched-br-in-data-spec
17777 (En/Dis)able speculative scheduling of the instructions that are
17778 dependent on the data speculative loads before reload. This is
17779 effective only with -msched-br-data-spec enabled. The default
17780 setting is enabled.
17781
17782 -msched-ar-in-data-spec
17783 -mno-sched-ar-in-data-spec
17784 (En/Dis)able speculative scheduling of the instructions that are
17785 dependent on the data speculative loads after reload. This is
17786 effective only with -msched-ar-data-spec enabled. The default
17787 setting is enabled.
17788
17789 -msched-in-control-spec
17790 -mno-sched-in-control-spec
17791 (En/Dis)able speculative scheduling of the instructions that are
17792 dependent on the control speculative loads. This is effective only
17793 with -msched-control-spec enabled. The default setting is enabled.
17794
17795 -mno-sched-prefer-non-data-spec-insns
17796 -msched-prefer-non-data-spec-insns
17797 If enabled, data-speculative instructions are chosen for schedule
17798 only if there are no other choices at the moment. This makes the
17799 use of the data speculation much more conservative. The default
17800 setting is disabled.
17801
17802 -mno-sched-prefer-non-control-spec-insns
17803 -msched-prefer-non-control-spec-insns
17804 If enabled, control-speculative instructions are chosen for
17805 schedule only if there are no other choices at the moment. This
17806 makes the use of the control speculation much more conservative.
17807 The default setting is disabled.
17808
17809 -mno-sched-count-spec-in-critical-path
17810 -msched-count-spec-in-critical-path
17811 If enabled, speculative dependencies are considered during
17812 computation of the instructions priorities. This makes the use of
17813 the speculation a bit more conservative. The default setting is
17814 disabled.
17815
17816 -msched-spec-ldc
17817 Use a simple data speculation check. This option is on by default.
17818
17819 -msched-control-spec-ldc
17820 Use a simple check for control speculation. This option is on by
17821 default.
17822
17823 -msched-stop-bits-after-every-cycle
17824 Place a stop bit after every cycle when scheduling. This option is
17825 on by default.
17826
17827 -msched-fp-mem-deps-zero-cost
17828 Assume that floating-point stores and loads are not likely to cause
17829 a conflict when placed into the same instruction group. This
17830 option is disabled by default.
17831
17832 -msel-sched-dont-check-control-spec
17833 Generate checks for control speculation in selective scheduling.
17834 This flag is disabled by default.
17835
17836 -msched-max-memory-insns=max-insns
17837 Limit on the number of memory insns per instruction group, giving
17838 lower priority to subsequent memory insns attempting to schedule in
17839 the same instruction group. Frequently useful to prevent cache bank
17840 conflicts. The default value is 1.
17841
17842 -msched-max-memory-insns-hard-limit
17843 Makes the limit specified by msched-max-memory-insns a hard limit,
17844 disallowing more than that number in an instruction group.
17845 Otherwise, the limit is "soft", meaning that non-memory operations
17846 are preferred when the limit is reached, but memory operations may
17847 still be scheduled.
17848
17849 LM32 Options
17850
17851 These -m options are defined for the LatticeMico32 architecture:
17852
17853 -mbarrel-shift-enabled
17854 Enable barrel-shift instructions.
17855
17856 -mdivide-enabled
17857 Enable divide and modulus instructions.
17858
17859 -mmultiply-enabled
17860 Enable multiply instructions.
17861
17862 -msign-extend-enabled
17863 Enable sign extend instructions.
17864
17865 -muser-enabled
17866 Enable user-defined instructions.
17867
17868 M32C Options
17869
17870 -mcpu=name
17871 Select the CPU for which code is generated. name may be one of r8c
17872 for the R8C/Tiny series, m16c for the M16C (up to /60) series,
17873 m32cm for the M16C/80 series, or m32c for the M32C/80 series.
17874
17875 -msim
17876 Specifies that the program will be run on the simulator. This
17877 causes an alternate runtime library to be linked in which supports,
17878 for example, file I/O. You must not use this option when
17879 generating programs that will run on real hardware; you must
17880 provide your own runtime library for whatever I/O functions are
17881 needed.
17882
17883 -memregs=number
17884 Specifies the number of memory-based pseudo-registers GCC uses
17885 during code generation. These pseudo-registers are used like real
17886 registers, so there is a tradeoff between GCC's ability to fit the
17887 code into available registers, and the performance penalty of using
17888 memory instead of registers. Note that all modules in a program
17889 must be compiled with the same value for this option. Because of
17890 that, you must not use this option with GCC's default runtime
17891 libraries.
17892
17893 M32R/D Options
17894
17895 These -m options are defined for Renesas M32R/D architectures:
17896
17897 -m32r2
17898 Generate code for the M32R/2.
17899
17900 -m32rx
17901 Generate code for the M32R/X.
17902
17903 -m32r
17904 Generate code for the M32R. This is the default.
17905
17906 -mmodel=small
17907 Assume all objects live in the lower 16MB of memory (so that their
17908 addresses can be loaded with the "ld24" instruction), and assume
17909 all subroutines are reachable with the "bl" instruction. This is
17910 the default.
17911
17912 The addressability of a particular object can be set with the
17913 "model" attribute.
17914
17915 -mmodel=medium
17916 Assume objects may be anywhere in the 32-bit address space (the
17917 compiler generates "seth/add3" instructions to load their
17918 addresses), and assume all subroutines are reachable with the "bl"
17919 instruction.
17920
17921 -mmodel=large
17922 Assume objects may be anywhere in the 32-bit address space (the
17923 compiler generates "seth/add3" instructions to load their
17924 addresses), and assume subroutines may not be reachable with the
17925 "bl" instruction (the compiler generates the much slower
17926 "seth/add3/jl" instruction sequence).
17927
17928 -msdata=none
17929 Disable use of the small data area. Variables are put into one of
17930 ".data", ".bss", or ".rodata" (unless the "section" attribute has
17931 been specified). This is the default.
17932
17933 The small data area consists of sections ".sdata" and ".sbss".
17934 Objects may be explicitly put in the small data area with the
17935 "section" attribute using one of these sections.
17936
17937 -msdata=sdata
17938 Put small global and static data in the small data area, but do not
17939 generate special code to reference them.
17940
17941 -msdata=use
17942 Put small global and static data in the small data area, and
17943 generate special instructions to reference them.
17944
17945 -G num
17946 Put global and static objects less than or equal to num bytes into
17947 the small data or BSS sections instead of the normal data or BSS
17948 sections. The default value of num is 8. The -msdata option must
17949 be set to one of sdata or use for this option to have any effect.
17950
17951 All modules should be compiled with the same -G num value.
17952 Compiling with different values of num may or may not work; if it
17953 doesn't the linker gives an error message---incorrect code is not
17954 generated.
17955
17956 -mdebug
17957 Makes the M32R-specific code in the compiler display some
17958 statistics that might help in debugging programs.
17959
17960 -malign-loops
17961 Align all loops to a 32-byte boundary.
17962
17963 -mno-align-loops
17964 Do not enforce a 32-byte alignment for loops. This is the default.
17965
17966 -missue-rate=number
17967 Issue number instructions per cycle. number can only be 1 or 2.
17968
17969 -mbranch-cost=number
17970 number can only be 1 or 2. If it is 1 then branches are preferred
17971 over conditional code, if it is 2, then the opposite applies.
17972
17973 -mflush-trap=number
17974 Specifies the trap number to use to flush the cache. The default
17975 is 12. Valid numbers are between 0 and 15 inclusive.
17976
17977 -mno-flush-trap
17978 Specifies that the cache cannot be flushed by using a trap.
17979
17980 -mflush-func=name
17981 Specifies the name of the operating system function to call to
17982 flush the cache. The default is _flush_cache, but a function call
17983 is only used if a trap is not available.
17984
17985 -mno-flush-func
17986 Indicates that there is no OS function for flushing the cache.
17987
17988 M680x0 Options
17989
17990 These are the -m options defined for M680x0 and ColdFire processors.
17991 The default settings depend on which architecture was selected when the
17992 compiler was configured; the defaults for the most common choices are
17993 given below.
17994
17995 -march=arch
17996 Generate code for a specific M680x0 or ColdFire instruction set
17997 architecture. Permissible values of arch for M680x0 architectures
17998 are: 68000, 68010, 68020, 68030, 68040, 68060 and cpu32. ColdFire
17999 architectures are selected according to Freescale's ISA
18000 classification and the permissible values are: isaa, isaaplus, isab
18001 and isac.
18002
18003 GCC defines a macro "__mcfarch__" whenever it is generating code
18004 for a ColdFire target. The arch in this macro is one of the -march
18005 arguments given above.
18006
18007 When used together, -march and -mtune select code that runs on a
18008 family of similar processors but that is optimized for a particular
18009 microarchitecture.
18010
18011 -mcpu=cpu
18012 Generate code for a specific M680x0 or ColdFire processor. The
18013 M680x0 cpus are: 68000, 68010, 68020, 68030, 68040, 68060, 68302,
18014 68332 and cpu32. The ColdFire cpus are given by the table below,
18015 which also classifies the CPUs into families:
18016
18017 Family : -mcpu arguments
18018 51 : 51 51ac 51ag 51cn 51em 51je 51jf 51jg 51jm 51mm 51qe 51qm
18019 5206 : 5202 5204 5206
18020 5206e : 5206e
18021 5208 : 5207 5208
18022 5211a : 5210a 5211a
18023 5213 : 5211 5212 5213
18024 5216 : 5214 5216
18025 52235 : 52230 52231 52232 52233 52234 52235
18026 5225 : 5224 5225
18027 52259 : 52252 52254 52255 52256 52258 52259
18028 5235 : 5232 5233 5234 5235 523x
18029 5249 : 5249
18030 5250 : 5250
18031 5271 : 5270 5271
18032 5272 : 5272
18033 5275 : 5274 5275
18034 5282 : 5280 5281 5282 528x
18035 53017 : 53011 53012 53013 53014 53015 53016 53017
18036 5307 : 5307
18037 5329 : 5327 5328 5329 532x
18038 5373 : 5372 5373 537x
18039 5407 : 5407
18040 5475 : 5470 5471 5472 5473 5474 5475 547x 5480 5481 5482 5483 5484
18041 5485
18042
18043 -mcpu=cpu overrides -march=arch if arch is compatible with cpu.
18044 Other combinations of -mcpu and -march are rejected.
18045
18046 GCC defines the macro "__mcf_cpu_cpu" when ColdFire target cpu is
18047 selected. It also defines "__mcf_family_family", where the value
18048 of family is given by the table above.
18049
18050 -mtune=tune
18051 Tune the code for a particular microarchitecture within the
18052 constraints set by -march and -mcpu. The M680x0 microarchitectures
18053 are: 68000, 68010, 68020, 68030, 68040, 68060 and cpu32. The
18054 ColdFire microarchitectures are: cfv1, cfv2, cfv3, cfv4 and cfv4e.
18055
18056 You can also use -mtune=68020-40 for code that needs to run
18057 relatively well on 68020, 68030 and 68040 targets. -mtune=68020-60
18058 is similar but includes 68060 targets as well. These two options
18059 select the same tuning decisions as -m68020-40 and -m68020-60
18060 respectively.
18061
18062 GCC defines the macros "__mcarch" and "__mcarch__" when tuning for
18063 680x0 architecture arch. It also defines "mcarch" unless either
18064 -ansi or a non-GNU -std option is used. If GCC is tuning for a
18065 range of architectures, as selected by -mtune=68020-40 or
18066 -mtune=68020-60, it defines the macros for every architecture in
18067 the range.
18068
18069 GCC also defines the macro "__muarch__" when tuning for ColdFire
18070 microarchitecture uarch, where uarch is one of the arguments given
18071 above.
18072
18073 -m68000
18074 -mc68000
18075 Generate output for a 68000. This is the default when the compiler
18076 is configured for 68000-based systems. It is equivalent to
18077 -march=68000.
18078
18079 Use this option for microcontrollers with a 68000 or EC000 core,
18080 including the 68008, 68302, 68306, 68307, 68322, 68328 and 68356.
18081
18082 -m68010
18083 Generate output for a 68010. This is the default when the compiler
18084 is configured for 68010-based systems. It is equivalent to
18085 -march=68010.
18086
18087 -m68020
18088 -mc68020
18089 Generate output for a 68020. This is the default when the compiler
18090 is configured for 68020-based systems. It is equivalent to
18091 -march=68020.
18092
18093 -m68030
18094 Generate output for a 68030. This is the default when the compiler
18095 is configured for 68030-based systems. It is equivalent to
18096 -march=68030.
18097
18098 -m68040
18099 Generate output for a 68040. This is the default when the compiler
18100 is configured for 68040-based systems. It is equivalent to
18101 -march=68040.
18102
18103 This option inhibits the use of 68881/68882 instructions that have
18104 to be emulated by software on the 68040. Use this option if your
18105 68040 does not have code to emulate those instructions.
18106
18107 -m68060
18108 Generate output for a 68060. This is the default when the compiler
18109 is configured for 68060-based systems. It is equivalent to
18110 -march=68060.
18111
18112 This option inhibits the use of 68020 and 68881/68882 instructions
18113 that have to be emulated by software on the 68060. Use this option
18114 if your 68060 does not have code to emulate those instructions.
18115
18116 -mcpu32
18117 Generate output for a CPU32. This is the default when the compiler
18118 is configured for CPU32-based systems. It is equivalent to
18119 -march=cpu32.
18120
18121 Use this option for microcontrollers with a CPU32 or CPU32+ core,
18122 including the 68330, 68331, 68332, 68333, 68334, 68336, 68340,
18123 68341, 68349 and 68360.
18124
18125 -m5200
18126 Generate output for a 520X ColdFire CPU. This is the default when
18127 the compiler is configured for 520X-based systems. It is
18128 equivalent to -mcpu=5206, and is now deprecated in favor of that
18129 option.
18130
18131 Use this option for microcontroller with a 5200 core, including the
18132 MCF5202, MCF5203, MCF5204 and MCF5206.
18133
18134 -m5206e
18135 Generate output for a 5206e ColdFire CPU. The option is now
18136 deprecated in favor of the equivalent -mcpu=5206e.
18137
18138 -m528x
18139 Generate output for a member of the ColdFire 528X family. The
18140 option is now deprecated in favor of the equivalent -mcpu=528x.
18141
18142 -m5307
18143 Generate output for a ColdFire 5307 CPU. The option is now
18144 deprecated in favor of the equivalent -mcpu=5307.
18145
18146 -m5407
18147 Generate output for a ColdFire 5407 CPU. The option is now
18148 deprecated in favor of the equivalent -mcpu=5407.
18149
18150 -mcfv4e
18151 Generate output for a ColdFire V4e family CPU (e.g. 547x/548x).
18152 This includes use of hardware floating-point instructions. The
18153 option is equivalent to -mcpu=547x, and is now deprecated in favor
18154 of that option.
18155
18156 -m68020-40
18157 Generate output for a 68040, without using any of the new
18158 instructions. This results in code that can run relatively
18159 efficiently on either a 68020/68881 or a 68030 or a 68040. The
18160 generated code does use the 68881 instructions that are emulated on
18161 the 68040.
18162
18163 The option is equivalent to -march=68020 -mtune=68020-40.
18164
18165 -m68020-60
18166 Generate output for a 68060, without using any of the new
18167 instructions. This results in code that can run relatively
18168 efficiently on either a 68020/68881 or a 68030 or a 68040. The
18169 generated code does use the 68881 instructions that are emulated on
18170 the 68060.
18171
18172 The option is equivalent to -march=68020 -mtune=68020-60.
18173
18174 -mhard-float
18175 -m68881
18176 Generate floating-point instructions. This is the default for
18177 68020 and above, and for ColdFire devices that have an FPU. It
18178 defines the macro "__HAVE_68881__" on M680x0 targets and
18179 "__mcffpu__" on ColdFire targets.
18180
18181 -msoft-float
18182 Do not generate floating-point instructions; use library calls
18183 instead. This is the default for 68000, 68010, and 68832 targets.
18184 It is also the default for ColdFire devices that have no FPU.
18185
18186 -mdiv
18187 -mno-div
18188 Generate (do not generate) ColdFire hardware divide and remainder
18189 instructions. If -march is used without -mcpu, the default is "on"
18190 for ColdFire architectures and "off" for M680x0 architectures.
18191 Otherwise, the default is taken from the target CPU (either the
18192 default CPU, or the one specified by -mcpu). For example, the
18193 default is "off" for -mcpu=5206 and "on" for -mcpu=5206e.
18194
18195 GCC defines the macro "__mcfhwdiv__" when this option is enabled.
18196
18197 -mshort
18198 Consider type "int" to be 16 bits wide, like "short int".
18199 Additionally, parameters passed on the stack are also aligned to a
18200 16-bit boundary even on targets whose API mandates promotion to
18201 32-bit.
18202
18203 -mno-short
18204 Do not consider type "int" to be 16 bits wide. This is the
18205 default.
18206
18207 -mnobitfield
18208 -mno-bitfield
18209 Do not use the bit-field instructions. The -m68000, -mcpu32 and
18210 -m5200 options imply -mnobitfield.
18211
18212 -mbitfield
18213 Do use the bit-field instructions. The -m68020 option implies
18214 -mbitfield. This is the default if you use a configuration
18215 designed for a 68020.
18216
18217 -mrtd
18218 Use a different function-calling convention, in which functions
18219 that take a fixed number of arguments return with the "rtd"
18220 instruction, which pops their arguments while returning. This
18221 saves one instruction in the caller since there is no need to pop
18222 the arguments there.
18223
18224 This calling convention is incompatible with the one normally used
18225 on Unix, so you cannot use it if you need to call libraries
18226 compiled with the Unix compiler.
18227
18228 Also, you must provide function prototypes for all functions that
18229 take variable numbers of arguments (including "printf"); otherwise
18230 incorrect code is generated for calls to those functions.
18231
18232 In addition, seriously incorrect code results if you call a
18233 function with too many arguments. (Normally, extra arguments are
18234 harmlessly ignored.)
18235
18236 The "rtd" instruction is supported by the 68010, 68020, 68030,
18237 68040, 68060 and CPU32 processors, but not by the 68000 or 5200.
18238
18239 The default is -mno-rtd.
18240
18241 -malign-int
18242 -mno-align-int
18243 Control whether GCC aligns "int", "long", "long long", "float",
18244 "double", and "long double" variables on a 32-bit boundary
18245 (-malign-int) or a 16-bit boundary (-mno-align-int). Aligning
18246 variables on 32-bit boundaries produces code that runs somewhat
18247 faster on processors with 32-bit busses at the expense of more
18248 memory.
18249
18250 Warning: if you use the -malign-int switch, GCC aligns structures
18251 containing the above types differently than most published
18252 application binary interface specifications for the m68k.
18253
18254 -mpcrel
18255 Use the pc-relative addressing mode of the 68000 directly, instead
18256 of using a global offset table. At present, this option implies
18257 -fpic, allowing at most a 16-bit offset for pc-relative addressing.
18258 -fPIC is not presently supported with -mpcrel, though this could be
18259 supported for 68020 and higher processors.
18260
18261 -mno-strict-align
18262 -mstrict-align
18263 Do not (do) assume that unaligned memory references are handled by
18264 the system.
18265
18266 -msep-data
18267 Generate code that allows the data segment to be located in a
18268 different area of memory from the text segment. This allows for
18269 execute-in-place in an environment without virtual memory
18270 management. This option implies -fPIC.
18271
18272 -mno-sep-data
18273 Generate code that assumes that the data segment follows the text
18274 segment. This is the default.
18275
18276 -mid-shared-library
18277 Generate code that supports shared libraries via the library ID
18278 method. This allows for execute-in-place and shared libraries in
18279 an environment without virtual memory management. This option
18280 implies -fPIC.
18281
18282 -mno-id-shared-library
18283 Generate code that doesn't assume ID-based shared libraries are
18284 being used. This is the default.
18285
18286 -mshared-library-id=n
18287 Specifies the identification number of the ID-based shared library
18288 being compiled. Specifying a value of 0 generates more compact
18289 code; specifying other values forces the allocation of that number
18290 to the current library, but is no more space- or time-efficient
18291 than omitting this option.
18292
18293 -mxgot
18294 -mno-xgot
18295 When generating position-independent code for ColdFire, generate
18296 code that works if the GOT has more than 8192 entries. This code
18297 is larger and slower than code generated without this option. On
18298 M680x0 processors, this option is not needed; -fPIC suffices.
18299
18300 GCC normally uses a single instruction to load values from the GOT.
18301 While this is relatively efficient, it only works if the GOT is
18302 smaller than about 64k. Anything larger causes the linker to
18303 report an error such as:
18304
18305 relocation truncated to fit: R_68K_GOT16O foobar
18306
18307 If this happens, you should recompile your code with -mxgot. It
18308 should then work with very large GOTs. However, code generated
18309 with -mxgot is less efficient, since it takes 4 instructions to
18310 fetch the value of a global symbol.
18311
18312 Note that some linkers, including newer versions of the GNU linker,
18313 can create multiple GOTs and sort GOT entries. If you have such a
18314 linker, you should only need to use -mxgot when compiling a single
18315 object file that accesses more than 8192 GOT entries. Very few do.
18316
18317 These options have no effect unless GCC is generating position-
18318 independent code.
18319
18320 -mlong-jump-table-offsets
18321 Use 32-bit offsets in "switch" tables. The default is to use
18322 16-bit offsets.
18323
18324 MCore Options
18325
18326 These are the -m options defined for the Motorola M*Core processors.
18327
18328 -mhardlit
18329 -mno-hardlit
18330 Inline constants into the code stream if it can be done in two
18331 instructions or less.
18332
18333 -mdiv
18334 -mno-div
18335 Use the divide instruction. (Enabled by default).
18336
18337 -mrelax-immediate
18338 -mno-relax-immediate
18339 Allow arbitrary-sized immediates in bit operations.
18340
18341 -mwide-bitfields
18342 -mno-wide-bitfields
18343 Always treat bit-fields as "int"-sized.
18344
18345 -m4byte-functions
18346 -mno-4byte-functions
18347 Force all functions to be aligned to a 4-byte boundary.
18348
18349 -mcallgraph-data
18350 -mno-callgraph-data
18351 Emit callgraph information.
18352
18353 -mslow-bytes
18354 -mno-slow-bytes
18355 Prefer word access when reading byte quantities.
18356
18357 -mlittle-endian
18358 -mbig-endian
18359 Generate code for a little-endian target.
18360
18361 -m210
18362 -m340
18363 Generate code for the 210 processor.
18364
18365 -mno-lsim
18366 Assume that runtime support has been provided and so omit the
18367 simulator library (libsim.a) from the linker command line.
18368
18369 -mstack-increment=size
18370 Set the maximum amount for a single stack increment operation.
18371 Large values can increase the speed of programs that contain
18372 functions that need a large amount of stack space, but they can
18373 also trigger a segmentation fault if the stack is extended too
18374 much. The default value is 0x1000.
18375
18376 MeP Options
18377
18378 -mabsdiff
18379 Enables the "abs" instruction, which is the absolute difference
18380 between two registers.
18381
18382 -mall-opts
18383 Enables all the optional instructions---average, multiply, divide,
18384 bit operations, leading zero, absolute difference, min/max, clip,
18385 and saturation.
18386
18387 -maverage
18388 Enables the "ave" instruction, which computes the average of two
18389 registers.
18390
18391 -mbased=n
18392 Variables of size n bytes or smaller are placed in the ".based"
18393 section by default. Based variables use the $tp register as a base
18394 register, and there is a 128-byte limit to the ".based" section.
18395
18396 -mbitops
18397 Enables the bit operation instructions---bit test ("btstm"), set
18398 ("bsetm"), clear ("bclrm"), invert ("bnotm"), and test-and-set
18399 ("tas").
18400
18401 -mc=name
18402 Selects which section constant data is placed in. name may be
18403 tiny, near, or far.
18404
18405 -mclip
18406 Enables the "clip" instruction. Note that -mclip is not useful
18407 unless you also provide -mminmax.
18408
18409 -mconfig=name
18410 Selects one of the built-in core configurations. Each MeP chip has
18411 one or more modules in it; each module has a core CPU and a variety
18412 of coprocessors, optional instructions, and peripherals. The
18413 "MeP-Integrator" tool, not part of GCC, provides these
18414 configurations through this option; using this option is the same
18415 as using all the corresponding command-line options. The default
18416 configuration is default.
18417
18418 -mcop
18419 Enables the coprocessor instructions. By default, this is a 32-bit
18420 coprocessor. Note that the coprocessor is normally enabled via the
18421 -mconfig= option.
18422
18423 -mcop32
18424 Enables the 32-bit coprocessor's instructions.
18425
18426 -mcop64
18427 Enables the 64-bit coprocessor's instructions.
18428
18429 -mivc2
18430 Enables IVC2 scheduling. IVC2 is a 64-bit VLIW coprocessor.
18431
18432 -mdc
18433 Causes constant variables to be placed in the ".near" section.
18434
18435 -mdiv
18436 Enables the "div" and "divu" instructions.
18437
18438 -meb
18439 Generate big-endian code.
18440
18441 -mel
18442 Generate little-endian code.
18443
18444 -mio-volatile
18445 Tells the compiler that any variable marked with the "io" attribute
18446 is to be considered volatile.
18447
18448 -ml Causes variables to be assigned to the ".far" section by default.
18449
18450 -mleadz
18451 Enables the "leadz" (leading zero) instruction.
18452
18453 -mm Causes variables to be assigned to the ".near" section by default.
18454
18455 -mminmax
18456 Enables the "min" and "max" instructions.
18457
18458 -mmult
18459 Enables the multiplication and multiply-accumulate instructions.
18460
18461 -mno-opts
18462 Disables all the optional instructions enabled by -mall-opts.
18463
18464 -mrepeat
18465 Enables the "repeat" and "erepeat" instructions, used for low-
18466 overhead looping.
18467
18468 -ms Causes all variables to default to the ".tiny" section. Note that
18469 there is a 65536-byte limit to this section. Accesses to these
18470 variables use the %gp base register.
18471
18472 -msatur
18473 Enables the saturation instructions. Note that the compiler does
18474 not currently generate these itself, but this option is included
18475 for compatibility with other tools, like "as".
18476
18477 -msdram
18478 Link the SDRAM-based runtime instead of the default ROM-based
18479 runtime.
18480
18481 -msim
18482 Link the simulator run-time libraries.
18483
18484 -msimnovec
18485 Link the simulator runtime libraries, excluding built-in support
18486 for reset and exception vectors and tables.
18487
18488 -mtf
18489 Causes all functions to default to the ".far" section. Without
18490 this option, functions default to the ".near" section.
18491
18492 -mtiny=n
18493 Variables that are n bytes or smaller are allocated to the ".tiny"
18494 section. These variables use the $gp base register. The default
18495 for this option is 4, but note that there's a 65536-byte limit to
18496 the ".tiny" section.
18497
18498 MicroBlaze Options
18499
18500 -msoft-float
18501 Use software emulation for floating point (default).
18502
18503 -mhard-float
18504 Use hardware floating-point instructions.
18505
18506 -mmemcpy
18507 Do not optimize block moves, use "memcpy".
18508
18509 -mno-clearbss
18510 This option is deprecated. Use -fno-zero-initialized-in-bss
18511 instead.
18512
18513 -mcpu=cpu-type
18514 Use features of, and schedule code for, the given CPU. Supported
18515 values are in the format vX.YY.Z, where X is a major version, YY is
18516 the minor version, and Z is compatibility code. Example values are
18517 v3.00.a, v4.00.b, v5.00.a, v5.00.b, v6.00.a.
18518
18519 -mxl-soft-mul
18520 Use software multiply emulation (default).
18521
18522 -mxl-soft-div
18523 Use software emulation for divides (default).
18524
18525 -mxl-barrel-shift
18526 Use the hardware barrel shifter.
18527
18528 -mxl-pattern-compare
18529 Use pattern compare instructions.
18530
18531 -msmall-divides
18532 Use table lookup optimization for small signed integer divisions.
18533
18534 -mxl-stack-check
18535 This option is deprecated. Use -fstack-check instead.
18536
18537 -mxl-gp-opt
18538 Use GP-relative ".sdata"/".sbss" sections.
18539
18540 -mxl-multiply-high
18541 Use multiply high instructions for high part of 32x32 multiply.
18542
18543 -mxl-float-convert
18544 Use hardware floating-point conversion instructions.
18545
18546 -mxl-float-sqrt
18547 Use hardware floating-point square root instruction.
18548
18549 -mbig-endian
18550 Generate code for a big-endian target.
18551
18552 -mlittle-endian
18553 Generate code for a little-endian target.
18554
18555 -mxl-reorder
18556 Use reorder instructions (swap and byte reversed load/store).
18557
18558 -mxl-mode-app-model
18559 Select application model app-model. Valid models are
18560
18561 executable
18562 normal executable (default), uses startup code crt0.o.
18563
18564 -mpic-data-is-text-relative
18565 Assume that the displacement between the text and data segments
18566 is fixed at static link time. This allows data to be
18567 referenced by offset from start of text address instead of GOT
18568 since PC-relative addressing is not supported.
18569
18570 xmdstub
18571 for use with Xilinx Microprocessor Debugger (XMD) based
18572 software intrusive debug agent called xmdstub. This uses
18573 startup file crt1.o and sets the start address of the program
18574 to 0x800.
18575
18576 bootstrap
18577 for applications that are loaded using a bootloader. This
18578 model uses startup file crt2.o which does not contain a
18579 processor reset vector handler. This is suitable for
18580 transferring control on a processor reset to the bootloader
18581 rather than the application.
18582
18583 novectors
18584 for applications that do not require any of the MicroBlaze
18585 vectors. This option may be useful for applications running
18586 within a monitoring application. This model uses crt3.o as a
18587 startup file.
18588
18589 Option -xl-mode-app-model is a deprecated alias for -mxl-mode-app-
18590 model.
18591
18592 MIPS Options
18593
18594 -EB Generate big-endian code.
18595
18596 -EL Generate little-endian code. This is the default for mips*el-*-*
18597 configurations.
18598
18599 -march=arch
18600 Generate code that runs on arch, which can be the name of a generic
18601 MIPS ISA, or the name of a particular processor. The ISA names
18602 are: mips1, mips2, mips3, mips4, mips32, mips32r2, mips32r3,
18603 mips32r5, mips32r6, mips64, mips64r2, mips64r3, mips64r5 and
18604 mips64r6. The processor names are: 4kc, 4km, 4kp, 4ksc, 4kec,
18605 4kem, 4kep, 4ksd, 5kc, 5kf, 20kc, 24kc, 24kf2_1, 24kf1_1, 24kec,
18606 24kef2_1, 24kef1_1, 34kc, 34kf2_1, 34kf1_1, 34kn, 74kc, 74kf2_1,
18607 74kf1_1, 74kf3_2, 1004kc, 1004kf2_1, 1004kf1_1, i6400, i6500,
18608 interaptiv, loongson2e, loongson2f, loongson3a, gs464, gs464e,
18609 gs264e, m4k, m14k, m14kc, m14ke, m14kec, m5100, m5101, octeon,
18610 octeon+, octeon2, octeon3, orion, p5600, p6600, r2000, r3000,
18611 r3900, r4000, r4400, r4600, r4650, r4700, r5900, r6000, r8000,
18612 rm7000, rm9000, r10000, r12000, r14000, r16000, sb1, sr71000,
18613 vr4100, vr4111, vr4120, vr4130, vr4300, vr5000, vr5400, vr5500, xlr
18614 and xlp. The special value from-abi selects the most compatible
18615 architecture for the selected ABI (that is, mips1 for 32-bit ABIs
18616 and mips3 for 64-bit ABIs).
18617
18618 The native Linux/GNU toolchain also supports the value native,
18619 which selects the best architecture option for the host processor.
18620 -march=native has no effect if GCC does not recognize the
18621 processor.
18622
18623 In processor names, a final 000 can be abbreviated as k (for
18624 example, -march=r2k). Prefixes are optional, and vr may be written
18625 r.
18626
18627 Names of the form nf2_1 refer to processors with FPUs clocked at
18628 half the rate of the core, names of the form nf1_1 refer to
18629 processors with FPUs clocked at the same rate as the core, and
18630 names of the form nf3_2 refer to processors with FPUs clocked a
18631 ratio of 3:2 with respect to the core. For compatibility reasons,
18632 nf is accepted as a synonym for nf2_1 while nx and bfx are accepted
18633 as synonyms for nf1_1.
18634
18635 GCC defines two macros based on the value of this option. The
18636 first is "_MIPS_ARCH", which gives the name of target architecture,
18637 as a string. The second has the form "_MIPS_ARCH_foo", where foo
18638 is the capitalized value of "_MIPS_ARCH". For example,
18639 -march=r2000 sets "_MIPS_ARCH" to "r2000" and defines the macro
18640 "_MIPS_ARCH_R2000".
18641
18642 Note that the "_MIPS_ARCH" macro uses the processor names given
18643 above. In other words, it has the full prefix and does not
18644 abbreviate 000 as k. In the case of from-abi, the macro names the
18645 resolved architecture (either "mips1" or "mips3"). It names the
18646 default architecture when no -march option is given.
18647
18648 -mtune=arch
18649 Optimize for arch. Among other things, this option controls the
18650 way instructions are scheduled, and the perceived cost of
18651 arithmetic operations. The list of arch values is the same as for
18652 -march.
18653
18654 When this option is not used, GCC optimizes for the processor
18655 specified by -march. By using -march and -mtune together, it is
18656 possible to generate code that runs on a family of processors, but
18657 optimize the code for one particular member of that family.
18658
18659 -mtune defines the macros "_MIPS_TUNE" and "_MIPS_TUNE_foo", which
18660 work in the same way as the -march ones described above.
18661
18662 -mips1
18663 Equivalent to -march=mips1.
18664
18665 -mips2
18666 Equivalent to -march=mips2.
18667
18668 -mips3
18669 Equivalent to -march=mips3.
18670
18671 -mips4
18672 Equivalent to -march=mips4.
18673
18674 -mips32
18675 Equivalent to -march=mips32.
18676
18677 -mips32r3
18678 Equivalent to -march=mips32r3.
18679
18680 -mips32r5
18681 Equivalent to -march=mips32r5.
18682
18683 -mips32r6
18684 Equivalent to -march=mips32r6.
18685
18686 -mips64
18687 Equivalent to -march=mips64.
18688
18689 -mips64r2
18690 Equivalent to -march=mips64r2.
18691
18692 -mips64r3
18693 Equivalent to -march=mips64r3.
18694
18695 -mips64r5
18696 Equivalent to -march=mips64r5.
18697
18698 -mips64r6
18699 Equivalent to -march=mips64r6.
18700
18701 -mips16
18702 -mno-mips16
18703 Generate (do not generate) MIPS16 code. If GCC is targeting a
18704 MIPS32 or MIPS64 architecture, it makes use of the MIPS16e ASE.
18705
18706 MIPS16 code generation can also be controlled on a per-function
18707 basis by means of "mips16" and "nomips16" attributes.
18708
18709 -mflip-mips16
18710 Generate MIPS16 code on alternating functions. This option is
18711 provided for regression testing of mixed MIPS16/non-MIPS16 code
18712 generation, and is not intended for ordinary use in compiling user
18713 code.
18714
18715 -minterlink-compressed
18716 -mno-interlink-compressed
18717 Require (do not require) that code using the standard
18718 (uncompressed) MIPS ISA be link-compatible with MIPS16 and
18719 microMIPS code, and vice versa.
18720
18721 For example, code using the standard ISA encoding cannot jump
18722 directly to MIPS16 or microMIPS code; it must either use a call or
18723 an indirect jump. -minterlink-compressed therefore disables direct
18724 jumps unless GCC knows that the target of the jump is not
18725 compressed.
18726
18727 -minterlink-mips16
18728 -mno-interlink-mips16
18729 Aliases of -minterlink-compressed and -mno-interlink-compressed.
18730 These options predate the microMIPS ASE and are retained for
18731 backwards compatibility.
18732
18733 -mabi=32
18734 -mabi=o64
18735 -mabi=n32
18736 -mabi=64
18737 -mabi=eabi
18738 Generate code for the given ABI.
18739
18740 Note that the EABI has a 32-bit and a 64-bit variant. GCC normally
18741 generates 64-bit code when you select a 64-bit architecture, but
18742 you can use -mgp32 to get 32-bit code instead.
18743
18744 For information about the O64 ABI, see
18745 <http://gcc.gnu.org/projects/mipso64-abi.html>.
18746
18747 GCC supports a variant of the o32 ABI in which floating-point
18748 registers are 64 rather than 32 bits wide. You can select this
18749 combination with -mabi=32 -mfp64. This ABI relies on the "mthc1"
18750 and "mfhc1" instructions and is therefore only supported for
18751 MIPS32R2, MIPS32R3 and MIPS32R5 processors.
18752
18753 The register assignments for arguments and return values remain the
18754 same, but each scalar value is passed in a single 64-bit register
18755 rather than a pair of 32-bit registers. For example, scalar
18756 floating-point values are returned in $f0 only, not a $f0/$f1 pair.
18757 The set of call-saved registers also remains the same in that the
18758 even-numbered double-precision registers are saved.
18759
18760 Two additional variants of the o32 ABI are supported to enable a
18761 transition from 32-bit to 64-bit registers. These are FPXX
18762 (-mfpxx) and FP64A (-mfp64 -mno-odd-spreg). The FPXX extension
18763 mandates that all code must execute correctly when run using 32-bit
18764 or 64-bit registers. The code can be interlinked with either FP32
18765 or FP64, but not both. The FP64A extension is similar to the FP64
18766 extension but forbids the use of odd-numbered single-precision
18767 registers. This can be used in conjunction with the "FRE" mode of
18768 FPUs in MIPS32R5 processors and allows both FP32 and FP64A code to
18769 interlink and run in the same process without changing FPU modes.
18770
18771 -mabicalls
18772 -mno-abicalls
18773 Generate (do not generate) code that is suitable for SVR4-style
18774 dynamic objects. -mabicalls is the default for SVR4-based systems.
18775
18776 -mshared
18777 -mno-shared
18778 Generate (do not generate) code that is fully position-independent,
18779 and that can therefore be linked into shared libraries. This
18780 option only affects -mabicalls.
18781
18782 All -mabicalls code has traditionally been position-independent,
18783 regardless of options like -fPIC and -fpic. However, as an
18784 extension, the GNU toolchain allows executables to use absolute
18785 accesses for locally-binding symbols. It can also use shorter GP
18786 initialization sequences and generate direct calls to locally-
18787 defined functions. This mode is selected by -mno-shared.
18788
18789 -mno-shared depends on binutils 2.16 or higher and generates
18790 objects that can only be linked by the GNU linker. However, the
18791 option does not affect the ABI of the final executable; it only
18792 affects the ABI of relocatable objects. Using -mno-shared
18793 generally makes executables both smaller and quicker.
18794
18795 -mshared is the default.
18796
18797 -mplt
18798 -mno-plt
18799 Assume (do not assume) that the static and dynamic linkers support
18800 PLTs and copy relocations. This option only affects -mno-shared
18801 -mabicalls. For the n64 ABI, this option has no effect without
18802 -msym32.
18803
18804 You can make -mplt the default by configuring GCC with
18805 --with-mips-plt. The default is -mno-plt otherwise.
18806
18807 -mxgot
18808 -mno-xgot
18809 Lift (do not lift) the usual restrictions on the size of the global
18810 offset table.
18811
18812 GCC normally uses a single instruction to load values from the GOT.
18813 While this is relatively efficient, it only works if the GOT is
18814 smaller than about 64k. Anything larger causes the linker to
18815 report an error such as:
18816
18817 relocation truncated to fit: R_MIPS_GOT16 foobar
18818
18819 If this happens, you should recompile your code with -mxgot. This
18820 works with very large GOTs, although the code is also less
18821 efficient, since it takes three instructions to fetch the value of
18822 a global symbol.
18823
18824 Note that some linkers can create multiple GOTs. If you have such
18825 a linker, you should only need to use -mxgot when a single object
18826 file accesses more than 64k's worth of GOT entries. Very few do.
18827
18828 These options have no effect unless GCC is generating position
18829 independent code.
18830
18831 -mgp32
18832 Assume that general-purpose registers are 32 bits wide.
18833
18834 -mgp64
18835 Assume that general-purpose registers are 64 bits wide.
18836
18837 -mfp32
18838 Assume that floating-point registers are 32 bits wide.
18839
18840 -mfp64
18841 Assume that floating-point registers are 64 bits wide.
18842
18843 -mfpxx
18844 Do not assume the width of floating-point registers.
18845
18846 -mhard-float
18847 Use floating-point coprocessor instructions.
18848
18849 -msoft-float
18850 Do not use floating-point coprocessor instructions. Implement
18851 floating-point calculations using library calls instead.
18852
18853 -mno-float
18854 Equivalent to -msoft-float, but additionally asserts that the
18855 program being compiled does not perform any floating-point
18856 operations. This option is presently supported only by some bare-
18857 metal MIPS configurations, where it may select a special set of
18858 libraries that lack all floating-point support (including, for
18859 example, the floating-point "printf" formats). If code compiled
18860 with -mno-float accidentally contains floating-point operations, it
18861 is likely to suffer a link-time or run-time failure.
18862
18863 -msingle-float
18864 Assume that the floating-point coprocessor only supports single-
18865 precision operations.
18866
18867 -mdouble-float
18868 Assume that the floating-point coprocessor supports double-
18869 precision operations. This is the default.
18870
18871 -modd-spreg
18872 -mno-odd-spreg
18873 Enable the use of odd-numbered single-precision floating-point
18874 registers for the o32 ABI. This is the default for processors that
18875 are known to support these registers. When using the o32 FPXX ABI,
18876 -mno-odd-spreg is set by default.
18877
18878 -mabs=2008
18879 -mabs=legacy
18880 These options control the treatment of the special not-a-number
18881 (NaN) IEEE 754 floating-point data with the "abs.fmt" and "neg.fmt"
18882 machine instructions.
18883
18884 By default or when -mabs=legacy is used the legacy treatment is
18885 selected. In this case these instructions are considered
18886 arithmetic and avoided where correct operation is required and the
18887 input operand might be a NaN. A longer sequence of instructions
18888 that manipulate the sign bit of floating-point datum manually is
18889 used instead unless the -ffinite-math-only option has also been
18890 specified.
18891
18892 The -mabs=2008 option selects the IEEE 754-2008 treatment. In this
18893 case these instructions are considered non-arithmetic and therefore
18894 operating correctly in all cases, including in particular where the
18895 input operand is a NaN. These instructions are therefore always
18896 used for the respective operations.
18897
18898 -mnan=2008
18899 -mnan=legacy
18900 These options control the encoding of the special not-a-number
18901 (NaN) IEEE 754 floating-point data.
18902
18903 The -mnan=legacy option selects the legacy encoding. In this case
18904 quiet NaNs (qNaNs) are denoted by the first bit of their trailing
18905 significand field being 0, whereas signaling NaNs (sNaNs) are
18906 denoted by the first bit of their trailing significand field being
18907 1.
18908
18909 The -mnan=2008 option selects the IEEE 754-2008 encoding. In this
18910 case qNaNs are denoted by the first bit of their trailing
18911 significand field being 1, whereas sNaNs are denoted by the first
18912 bit of their trailing significand field being 0.
18913
18914 The default is -mnan=legacy unless GCC has been configured with
18915 --with-nan=2008.
18916
18917 -mllsc
18918 -mno-llsc
18919 Use (do not use) ll, sc, and sync instructions to implement atomic
18920 memory built-in functions. When neither option is specified, GCC
18921 uses the instructions if the target architecture supports them.
18922
18923 -mllsc is useful if the runtime environment can emulate the
18924 instructions and -mno-llsc can be useful when compiling for
18925 nonstandard ISAs. You can make either option the default by
18926 configuring GCC with --with-llsc and --without-llsc respectively.
18927 --with-llsc is the default for some configurations; see the
18928 installation documentation for details.
18929
18930 -mdsp
18931 -mno-dsp
18932 Use (do not use) revision 1 of the MIPS DSP ASE.
18933 This option defines the preprocessor macro "__mips_dsp". It also
18934 defines "__mips_dsp_rev" to 1.
18935
18936 -mdspr2
18937 -mno-dspr2
18938 Use (do not use) revision 2 of the MIPS DSP ASE.
18939 This option defines the preprocessor macros "__mips_dsp" and
18940 "__mips_dspr2". It also defines "__mips_dsp_rev" to 2.
18941
18942 -msmartmips
18943 -mno-smartmips
18944 Use (do not use) the MIPS SmartMIPS ASE.
18945
18946 -mpaired-single
18947 -mno-paired-single
18948 Use (do not use) paired-single floating-point instructions.
18949 This option requires hardware floating-point support to be
18950 enabled.
18951
18952 -mdmx
18953 -mno-mdmx
18954 Use (do not use) MIPS Digital Media Extension instructions. This
18955 option can only be used when generating 64-bit code and requires
18956 hardware floating-point support to be enabled.
18957
18958 -mips3d
18959 -mno-mips3d
18960 Use (do not use) the MIPS-3D ASE. The option -mips3d implies
18961 -mpaired-single.
18962
18963 -mmicromips
18964 -mno-micromips
18965 Generate (do not generate) microMIPS code.
18966
18967 MicroMIPS code generation can also be controlled on a per-function
18968 basis by means of "micromips" and "nomicromips" attributes.
18969
18970 -mmt
18971 -mno-mt
18972 Use (do not use) MT Multithreading instructions.
18973
18974 -mmcu
18975 -mno-mcu
18976 Use (do not use) the MIPS MCU ASE instructions.
18977
18978 -meva
18979 -mno-eva
18980 Use (do not use) the MIPS Enhanced Virtual Addressing instructions.
18981
18982 -mvirt
18983 -mno-virt
18984 Use (do not use) the MIPS Virtualization (VZ) instructions.
18985
18986 -mxpa
18987 -mno-xpa
18988 Use (do not use) the MIPS eXtended Physical Address (XPA)
18989 instructions.
18990
18991 -mcrc
18992 -mno-crc
18993 Use (do not use) the MIPS Cyclic Redundancy Check (CRC)
18994 instructions.
18995
18996 -mginv
18997 -mno-ginv
18998 Use (do not use) the MIPS Global INValidate (GINV) instructions.
18999
19000 -mloongson-mmi
19001 -mno-loongson-mmi
19002 Use (do not use) the MIPS Loongson MultiMedia extensions
19003 Instructions (MMI).
19004
19005 -mloongson-ext
19006 -mno-loongson-ext
19007 Use (do not use) the MIPS Loongson EXTensions (EXT) instructions.
19008
19009 -mloongson-ext2
19010 -mno-loongson-ext2
19011 Use (do not use) the MIPS Loongson EXTensions r2 (EXT2)
19012 instructions.
19013
19014 -mlong64
19015 Force "long" types to be 64 bits wide. See -mlong32 for an
19016 explanation of the default and the way that the pointer size is
19017 determined.
19018
19019 -mlong32
19020 Force "long", "int", and pointer types to be 32 bits wide.
19021
19022 The default size of "int"s, "long"s and pointers depends on the
19023 ABI. All the supported ABIs use 32-bit "int"s. The n64 ABI uses
19024 64-bit "long"s, as does the 64-bit EABI; the others use 32-bit
19025 "long"s. Pointers are the same size as "long"s, or the same size
19026 as integer registers, whichever is smaller.
19027
19028 -msym32
19029 -mno-sym32
19030 Assume (do not assume) that all symbols have 32-bit values,
19031 regardless of the selected ABI. This option is useful in
19032 combination with -mabi=64 and -mno-abicalls because it allows GCC
19033 to generate shorter and faster references to symbolic addresses.
19034
19035 -G num
19036 Put definitions of externally-visible data in a small data section
19037 if that data is no bigger than num bytes. GCC can then generate
19038 more efficient accesses to the data; see -mgpopt for details.
19039
19040 The default -G option depends on the configuration.
19041
19042 -mlocal-sdata
19043 -mno-local-sdata
19044 Extend (do not extend) the -G behavior to local data too, such as
19045 to static variables in C. -mlocal-sdata is the default for all
19046 configurations.
19047
19048 If the linker complains that an application is using too much small
19049 data, you might want to try rebuilding the less performance-
19050 critical parts with -mno-local-sdata. You might also want to build
19051 large libraries with -mno-local-sdata, so that the libraries leave
19052 more room for the main program.
19053
19054 -mextern-sdata
19055 -mno-extern-sdata
19056 Assume (do not assume) that externally-defined data is in a small
19057 data section if the size of that data is within the -G limit.
19058 -mextern-sdata is the default for all configurations.
19059
19060 If you compile a module Mod with -mextern-sdata -G num -mgpopt, and
19061 Mod references a variable Var that is no bigger than num bytes, you
19062 must make sure that Var is placed in a small data section. If Var
19063 is defined by another module, you must either compile that module
19064 with a high-enough -G setting or attach a "section" attribute to
19065 Var's definition. If Var is common, you must link the application
19066 with a high-enough -G setting.
19067
19068 The easiest way of satisfying these restrictions is to compile and
19069 link every module with the same -G option. However, you may wish
19070 to build a library that supports several different small data
19071 limits. You can do this by compiling the library with the highest
19072 supported -G setting and additionally using -mno-extern-sdata to
19073 stop the library from making assumptions about externally-defined
19074 data.
19075
19076 -mgpopt
19077 -mno-gpopt
19078 Use (do not use) GP-relative accesses for symbols that are known to
19079 be in a small data section; see -G, -mlocal-sdata and
19080 -mextern-sdata. -mgpopt is the default for all configurations.
19081
19082 -mno-gpopt is useful for cases where the $gp register might not
19083 hold the value of "_gp". For example, if the code is part of a
19084 library that might be used in a boot monitor, programs that call
19085 boot monitor routines pass an unknown value in $gp. (In such
19086 situations, the boot monitor itself is usually compiled with -G0.)
19087
19088 -mno-gpopt implies -mno-local-sdata and -mno-extern-sdata.
19089
19090 -membedded-data
19091 -mno-embedded-data
19092 Allocate variables to the read-only data section first if possible,
19093 then next in the small data section if possible, otherwise in data.
19094 This gives slightly slower code than the default, but reduces the
19095 amount of RAM required when executing, and thus may be preferred
19096 for some embedded systems.
19097
19098 -muninit-const-in-rodata
19099 -mno-uninit-const-in-rodata
19100 Put uninitialized "const" variables in the read-only data section.
19101 This option is only meaningful in conjunction with -membedded-data.
19102
19103 -mcode-readable=setting
19104 Specify whether GCC may generate code that reads from executable
19105 sections. There are three possible settings:
19106
19107 -mcode-readable=yes
19108 Instructions may freely access executable sections. This is
19109 the default setting.
19110
19111 -mcode-readable=pcrel
19112 MIPS16 PC-relative load instructions can access executable
19113 sections, but other instructions must not do so. This option
19114 is useful on 4KSc and 4KSd processors when the code TLBs have
19115 the Read Inhibit bit set. It is also useful on processors that
19116 can be configured to have a dual instruction/data SRAM
19117 interface and that, like the M4K, automatically redirect PC-
19118 relative loads to the instruction RAM.
19119
19120 -mcode-readable=no
19121 Instructions must not access executable sections. This option
19122 can be useful on targets that are configured to have a dual
19123 instruction/data SRAM interface but that (unlike the M4K) do
19124 not automatically redirect PC-relative loads to the instruction
19125 RAM.
19126
19127 -msplit-addresses
19128 -mno-split-addresses
19129 Enable (disable) use of the "%hi()" and "%lo()" assembler
19130 relocation operators. This option has been superseded by
19131 -mexplicit-relocs but is retained for backwards compatibility.
19132
19133 -mexplicit-relocs
19134 -mno-explicit-relocs
19135 Use (do not use) assembler relocation operators when dealing with
19136 symbolic addresses. The alternative, selected by
19137 -mno-explicit-relocs, is to use assembler macros instead.
19138
19139 -mexplicit-relocs is the default if GCC was configured to use an
19140 assembler that supports relocation operators.
19141
19142 -mcheck-zero-division
19143 -mno-check-zero-division
19144 Trap (do not trap) on integer division by zero.
19145
19146 The default is -mcheck-zero-division.
19147
19148 -mdivide-traps
19149 -mdivide-breaks
19150 MIPS systems check for division by zero by generating either a
19151 conditional trap or a break instruction. Using traps results in
19152 smaller code, but is only supported on MIPS II and later. Also,
19153 some versions of the Linux kernel have a bug that prevents trap
19154 from generating the proper signal ("SIGFPE"). Use -mdivide-traps
19155 to allow conditional traps on architectures that support them and
19156 -mdivide-breaks to force the use of breaks.
19157
19158 The default is usually -mdivide-traps, but this can be overridden
19159 at configure time using --with-divide=breaks. Divide-by-zero
19160 checks can be completely disabled using -mno-check-zero-division.
19161
19162 -mload-store-pairs
19163 -mno-load-store-pairs
19164 Enable (disable) an optimization that pairs consecutive load or
19165 store instructions to enable load/store bonding. This option is
19166 enabled by default but only takes effect when the selected
19167 architecture is known to support bonding.
19168
19169 -mmemcpy
19170 -mno-memcpy
19171 Force (do not force) the use of "memcpy" for non-trivial block
19172 moves. The default is -mno-memcpy, which allows GCC to inline most
19173 constant-sized copies.
19174
19175 -mlong-calls
19176 -mno-long-calls
19177 Disable (do not disable) use of the "jal" instruction. Calling
19178 functions using "jal" is more efficient but requires the caller and
19179 callee to be in the same 256 megabyte segment.
19180
19181 This option has no effect on abicalls code. The default is
19182 -mno-long-calls.
19183
19184 -mmad
19185 -mno-mad
19186 Enable (disable) use of the "mad", "madu" and "mul" instructions,
19187 as provided by the R4650 ISA.
19188
19189 -mimadd
19190 -mno-imadd
19191 Enable (disable) use of the "madd" and "msub" integer instructions.
19192 The default is -mimadd on architectures that support "madd" and
19193 "msub" except for the 74k architecture where it was found to
19194 generate slower code.
19195
19196 -mfused-madd
19197 -mno-fused-madd
19198 Enable (disable) use of the floating-point multiply-accumulate
19199 instructions, when they are available. The default is
19200 -mfused-madd.
19201
19202 On the R8000 CPU when multiply-accumulate instructions are used,
19203 the intermediate product is calculated to infinite precision and is
19204 not subject to the FCSR Flush to Zero bit. This may be undesirable
19205 in some circumstances. On other processors the result is
19206 numerically identical to the equivalent computation using separate
19207 multiply, add, subtract and negate instructions.
19208
19209 -nocpp
19210 Tell the MIPS assembler to not run its preprocessor over user
19211 assembler files (with a .s suffix) when assembling them.
19212
19213 -mfix-24k
19214 -mno-fix-24k
19215 Work around the 24K E48 (lost data on stores during refill) errata.
19216 The workarounds are implemented by the assembler rather than by
19217 GCC.
19218
19219 -mfix-r4000
19220 -mno-fix-r4000
19221 Work around certain R4000 CPU errata:
19222
19223 - A double-word or a variable shift may give an incorrect result
19224 if executed immediately after starting an integer division.
19225
19226 - A double-word or a variable shift may give an incorrect result
19227 if executed while an integer multiplication is in progress.
19228
19229 - An integer division may give an incorrect result if started in
19230 a delay slot of a taken branch or a jump.
19231
19232 -mfix-r4400
19233 -mno-fix-r4400
19234 Work around certain R4400 CPU errata:
19235
19236 - A double-word or a variable shift may give an incorrect result
19237 if executed immediately after starting an integer division.
19238
19239 -mfix-r10000
19240 -mno-fix-r10000
19241 Work around certain R10000 errata:
19242
19243 - "ll"/"sc" sequences may not behave atomically on revisions
19244 prior to 3.0. They may deadlock on revisions 2.6 and earlier.
19245
19246 This option can only be used if the target architecture supports
19247 branch-likely instructions. -mfix-r10000 is the default when
19248 -march=r10000 is used; -mno-fix-r10000 is the default otherwise.
19249
19250 -mfix-r5900
19251 -mno-fix-r5900
19252 Do not attempt to schedule the preceding instruction into the delay
19253 slot of a branch instruction placed at the end of a short loop of
19254 six instructions or fewer and always schedule a "nop" instruction
19255 there instead. The short loop bug under certain conditions causes
19256 loops to execute only once or twice, due to a hardware bug in the
19257 R5900 chip. The workaround is implemented by the assembler rather
19258 than by GCC.
19259
19260 -mfix-rm7000
19261 -mno-fix-rm7000
19262 Work around the RM7000 "dmult"/"dmultu" errata. The workarounds
19263 are implemented by the assembler rather than by GCC.
19264
19265 -mfix-vr4120
19266 -mno-fix-vr4120
19267 Work around certain VR4120 errata:
19268
19269 - "dmultu" does not always produce the correct result.
19270
19271 - "div" and "ddiv" do not always produce the correct result if
19272 one of the operands is negative.
19273
19274 The workarounds for the division errata rely on special functions
19275 in libgcc.a. At present, these functions are only provided by the
19276 "mips64vr*-elf" configurations.
19277
19278 Other VR4120 errata require a NOP to be inserted between certain
19279 pairs of instructions. These errata are handled by the assembler,
19280 not by GCC itself.
19281
19282 -mfix-vr4130
19283 Work around the VR4130 "mflo"/"mfhi" errata. The workarounds are
19284 implemented by the assembler rather than by GCC, although GCC
19285 avoids using "mflo" and "mfhi" if the VR4130 "macc", "macchi",
19286 "dmacc" and "dmacchi" instructions are available instead.
19287
19288 -mfix-sb1
19289 -mno-fix-sb1
19290 Work around certain SB-1 CPU core errata. (This flag currently
19291 works around the SB-1 revision 2 "F1" and "F2" floating-point
19292 errata.)
19293
19294 -mr10k-cache-barrier=setting
19295 Specify whether GCC should insert cache barriers to avoid the side
19296 effects of speculation on R10K processors.
19297
19298 In common with many processors, the R10K tries to predict the
19299 outcome of a conditional branch and speculatively executes
19300 instructions from the "taken" branch. It later aborts these
19301 instructions if the predicted outcome is wrong. However, on the
19302 R10K, even aborted instructions can have side effects.
19303
19304 This problem only affects kernel stores and, depending on the
19305 system, kernel loads. As an example, a speculatively-executed
19306 store may load the target memory into cache and mark the cache line
19307 as dirty, even if the store itself is later aborted. If a DMA
19308 operation writes to the same area of memory before the "dirty" line
19309 is flushed, the cached data overwrites the DMA-ed data. See the
19310 R10K processor manual for a full description, including other
19311 potential problems.
19312
19313 One workaround is to insert cache barrier instructions before every
19314 memory access that might be speculatively executed and that might
19315 have side effects even if aborted. -mr10k-cache-barrier=setting
19316 controls GCC's implementation of this workaround. It assumes that
19317 aborted accesses to any byte in the following regions does not have
19318 side effects:
19319
19320 1. the memory occupied by the current function's stack frame;
19321
19322 2. the memory occupied by an incoming stack argument;
19323
19324 3. the memory occupied by an object with a link-time-constant
19325 address.
19326
19327 It is the kernel's responsibility to ensure that speculative
19328 accesses to these regions are indeed safe.
19329
19330 If the input program contains a function declaration such as:
19331
19332 void foo (void);
19333
19334 then the implementation of "foo" must allow "j foo" and "jal foo"
19335 to be executed speculatively. GCC honors this restriction for
19336 functions it compiles itself. It expects non-GCC functions (such
19337 as hand-written assembly code) to do the same.
19338
19339 The option has three forms:
19340
19341 -mr10k-cache-barrier=load-store
19342 Insert a cache barrier before a load or store that might be
19343 speculatively executed and that might have side effects even if
19344 aborted.
19345
19346 -mr10k-cache-barrier=store
19347 Insert a cache barrier before a store that might be
19348 speculatively executed and that might have side effects even if
19349 aborted.
19350
19351 -mr10k-cache-barrier=none
19352 Disable the insertion of cache barriers. This is the default
19353 setting.
19354
19355 -mflush-func=func
19356 -mno-flush-func
19357 Specifies the function to call to flush the I and D caches, or to
19358 not call any such function. If called, the function must take the
19359 same arguments as the common "_flush_func", that is, the address of
19360 the memory range for which the cache is being flushed, the size of
19361 the memory range, and the number 3 (to flush both caches). The
19362 default depends on the target GCC was configured for, but commonly
19363 is either "_flush_func" or "__cpu_flush".
19364
19365 mbranch-cost=num
19366 Set the cost of branches to roughly num "simple" instructions.
19367 This cost is only a heuristic and is not guaranteed to produce
19368 consistent results across releases. A zero cost redundantly
19369 selects the default, which is based on the -mtune setting.
19370
19371 -mbranch-likely
19372 -mno-branch-likely
19373 Enable or disable use of Branch Likely instructions, regardless of
19374 the default for the selected architecture. By default, Branch
19375 Likely instructions may be generated if they are supported by the
19376 selected architecture. An exception is for the MIPS32 and MIPS64
19377 architectures and processors that implement those architectures;
19378 for those, Branch Likely instructions are not be generated by
19379 default because the MIPS32 and MIPS64 architectures specifically
19380 deprecate their use.
19381
19382 -mcompact-branches=never
19383 -mcompact-branches=optimal
19384 -mcompact-branches=always
19385 These options control which form of branches will be generated.
19386 The default is -mcompact-branches=optimal.
19387
19388 The -mcompact-branches=never option ensures that compact branch
19389 instructions will never be generated.
19390
19391 The -mcompact-branches=always option ensures that a compact branch
19392 instruction will be generated if available. If a compact branch
19393 instruction is not available, a delay slot form of the branch will
19394 be used instead.
19395
19396 This option is supported from MIPS Release 6 onwards.
19397
19398 The -mcompact-branches=optimal option will cause a delay slot
19399 branch to be used if one is available in the current ISA and the
19400 delay slot is successfully filled. If the delay slot is not
19401 filled, a compact branch will be chosen if one is available.
19402
19403 -mfp-exceptions
19404 -mno-fp-exceptions
19405 Specifies whether FP exceptions are enabled. This affects how FP
19406 instructions are scheduled for some processors. The default is
19407 that FP exceptions are enabled.
19408
19409 For instance, on the SB-1, if FP exceptions are disabled, and we
19410 are emitting 64-bit code, then we can use both FP pipes.
19411 Otherwise, we can only use one FP pipe.
19412
19413 -mvr4130-align
19414 -mno-vr4130-align
19415 The VR4130 pipeline is two-way superscalar, but can only issue two
19416 instructions together if the first one is 8-byte aligned. When
19417 this option is enabled, GCC aligns pairs of instructions that it
19418 thinks should execute in parallel.
19419
19420 This option only has an effect when optimizing for the VR4130. It
19421 normally makes code faster, but at the expense of making it bigger.
19422 It is enabled by default at optimization level -O3.
19423
19424 -msynci
19425 -mno-synci
19426 Enable (disable) generation of "synci" instructions on
19427 architectures that support it. The "synci" instructions (if
19428 enabled) are generated when "__builtin___clear_cache" is compiled.
19429
19430 This option defaults to -mno-synci, but the default can be
19431 overridden by configuring GCC with --with-synci.
19432
19433 When compiling code for single processor systems, it is generally
19434 safe to use "synci". However, on many multi-core (SMP) systems, it
19435 does not invalidate the instruction caches on all cores and may
19436 lead to undefined behavior.
19437
19438 -mrelax-pic-calls
19439 -mno-relax-pic-calls
19440 Try to turn PIC calls that are normally dispatched via register $25
19441 into direct calls. This is only possible if the linker can resolve
19442 the destination at link time and if the destination is within range
19443 for a direct call.
19444
19445 -mrelax-pic-calls is the default if GCC was configured to use an
19446 assembler and a linker that support the ".reloc" assembly directive
19447 and -mexplicit-relocs is in effect. With -mno-explicit-relocs,
19448 this optimization can be performed by the assembler and the linker
19449 alone without help from the compiler.
19450
19451 -mmcount-ra-address
19452 -mno-mcount-ra-address
19453 Emit (do not emit) code that allows "_mcount" to modify the calling
19454 function's return address. When enabled, this option extends the
19455 usual "_mcount" interface with a new ra-address parameter, which
19456 has type "intptr_t *" and is passed in register $12. "_mcount" can
19457 then modify the return address by doing both of the following:
19458
19459 * Returning the new address in register $31.
19460
19461 * Storing the new address in "*ra-address", if ra-address is
19462 nonnull.
19463
19464 The default is -mno-mcount-ra-address.
19465
19466 -mframe-header-opt
19467 -mno-frame-header-opt
19468 Enable (disable) frame header optimization in the o32 ABI. When
19469 using the o32 ABI, calling functions will allocate 16 bytes on the
19470 stack for the called function to write out register arguments.
19471 When enabled, this optimization will suppress the allocation of the
19472 frame header if it can be determined that it is unused.
19473
19474 This optimization is off by default at all optimization levels.
19475
19476 -mlxc1-sxc1
19477 -mno-lxc1-sxc1
19478 When applicable, enable (disable) the generation of "lwxc1",
19479 "swxc1", "ldxc1", "sdxc1" instructions. Enabled by default.
19480
19481 -mmadd4
19482 -mno-madd4
19483 When applicable, enable (disable) the generation of 4-operand
19484 "madd.s", "madd.d" and related instructions. Enabled by default.
19485
19486 MMIX Options
19487
19488 These options are defined for the MMIX:
19489
19490 -mlibfuncs
19491 -mno-libfuncs
19492 Specify that intrinsic library functions are being compiled,
19493 passing all values in registers, no matter the size.
19494
19495 -mepsilon
19496 -mno-epsilon
19497 Generate floating-point comparison instructions that compare with
19498 respect to the "rE" epsilon register.
19499
19500 -mabi=mmixware
19501 -mabi=gnu
19502 Generate code that passes function parameters and return values
19503 that (in the called function) are seen as registers $0 and up, as
19504 opposed to the GNU ABI which uses global registers $231 and up.
19505
19506 -mzero-extend
19507 -mno-zero-extend
19508 When reading data from memory in sizes shorter than 64 bits, use
19509 (do not use) zero-extending load instructions by default, rather
19510 than sign-extending ones.
19511
19512 -mknuthdiv
19513 -mno-knuthdiv
19514 Make the result of a division yielding a remainder have the same
19515 sign as the divisor. With the default, -mno-knuthdiv, the sign of
19516 the remainder follows the sign of the dividend. Both methods are
19517 arithmetically valid, the latter being almost exclusively used.
19518
19519 -mtoplevel-symbols
19520 -mno-toplevel-symbols
19521 Prepend (do not prepend) a : to all global symbols, so the assembly
19522 code can be used with the "PREFIX" assembly directive.
19523
19524 -melf
19525 Generate an executable in the ELF format, rather than the default
19526 mmo format used by the mmix simulator.
19527
19528 -mbranch-predict
19529 -mno-branch-predict
19530 Use (do not use) the probable-branch instructions, when static
19531 branch prediction indicates a probable branch.
19532
19533 -mbase-addresses
19534 -mno-base-addresses
19535 Generate (do not generate) code that uses base addresses. Using a
19536 base address automatically generates a request (handled by the
19537 assembler and the linker) for a constant to be set up in a global
19538 register. The register is used for one or more base address
19539 requests within the range 0 to 255 from the value held in the
19540 register. The generally leads to short and fast code, but the
19541 number of different data items that can be addressed is limited.
19542 This means that a program that uses lots of static data may require
19543 -mno-base-addresses.
19544
19545 -msingle-exit
19546 -mno-single-exit
19547 Force (do not force) generated code to have a single exit point in
19548 each function.
19549
19550 MN10300 Options
19551
19552 These -m options are defined for Matsushita MN10300 architectures:
19553
19554 -mmult-bug
19555 Generate code to avoid bugs in the multiply instructions for the
19556 MN10300 processors. This is the default.
19557
19558 -mno-mult-bug
19559 Do not generate code to avoid bugs in the multiply instructions for
19560 the MN10300 processors.
19561
19562 -mam33
19563 Generate code using features specific to the AM33 processor.
19564
19565 -mno-am33
19566 Do not generate code using features specific to the AM33 processor.
19567 This is the default.
19568
19569 -mam33-2
19570 Generate code using features specific to the AM33/2.0 processor.
19571
19572 -mam34
19573 Generate code using features specific to the AM34 processor.
19574
19575 -mtune=cpu-type
19576 Use the timing characteristics of the indicated CPU type when
19577 scheduling instructions. This does not change the targeted
19578 processor type. The CPU type must be one of mn10300, am33, am33-2
19579 or am34.
19580
19581 -mreturn-pointer-on-d0
19582 When generating a function that returns a pointer, return the
19583 pointer in both "a0" and "d0". Otherwise, the pointer is returned
19584 only in "a0", and attempts to call such functions without a
19585 prototype result in errors. Note that this option is on by
19586 default; use -mno-return-pointer-on-d0 to disable it.
19587
19588 -mno-crt0
19589 Do not link in the C run-time initialization object file.
19590
19591 -mrelax
19592 Indicate to the linker that it should perform a relaxation
19593 optimization pass to shorten branches, calls and absolute memory
19594 addresses. This option only has an effect when used on the command
19595 line for the final link step.
19596
19597 This option makes symbolic debugging impossible.
19598
19599 -mliw
19600 Allow the compiler to generate Long Instruction Word instructions
19601 if the target is the AM33 or later. This is the default. This
19602 option defines the preprocessor macro "__LIW__".
19603
19604 -mno-liw
19605 Do not allow the compiler to generate Long Instruction Word
19606 instructions. This option defines the preprocessor macro
19607 "__NO_LIW__".
19608
19609 -msetlb
19610 Allow the compiler to generate the SETLB and Lcc instructions if
19611 the target is the AM33 or later. This is the default. This option
19612 defines the preprocessor macro "__SETLB__".
19613
19614 -mno-setlb
19615 Do not allow the compiler to generate SETLB or Lcc instructions.
19616 This option defines the preprocessor macro "__NO_SETLB__".
19617
19618 Moxie Options
19619
19620 -meb
19621 Generate big-endian code. This is the default for moxie-*-*
19622 configurations.
19623
19624 -mel
19625 Generate little-endian code.
19626
19627 -mmul.x
19628 Generate mul.x and umul.x instructions. This is the default for
19629 moxiebox-*-* configurations.
19630
19631 -mno-crt0
19632 Do not link in the C run-time initialization object file.
19633
19634 MSP430 Options
19635
19636 These options are defined for the MSP430:
19637
19638 -masm-hex
19639 Force assembly output to always use hex constants. Normally such
19640 constants are signed decimals, but this option is available for
19641 testsuite and/or aesthetic purposes.
19642
19643 -mmcu=
19644 Select the MCU to target. This is used to create a C preprocessor
19645 symbol based upon the MCU name, converted to upper case and pre-
19646 and post-fixed with __. This in turn is used by the msp430.h
19647 header file to select an MCU-specific supplementary header file.
19648
19649 The option also sets the ISA to use. If the MCU name is one that
19650 is known to only support the 430 ISA then that is selected,
19651 otherwise the 430X ISA is selected. A generic MCU name of msp430
19652 can also be used to select the 430 ISA. Similarly the generic
19653 msp430x MCU name selects the 430X ISA.
19654
19655 In addition an MCU-specific linker script is added to the linker
19656 command line. The script's name is the name of the MCU with .ld
19657 appended. Thus specifying -mmcu=xxx on the gcc command line
19658 defines the C preprocessor symbol "__XXX__" and cause the linker to
19659 search for a script called xxx.ld.
19660
19661 This option is also passed on to the assembler.
19662
19663 -mwarn-mcu
19664 -mno-warn-mcu
19665 This option enables or disables warnings about conflicts between
19666 the MCU name specified by the -mmcu option and the ISA set by the
19667 -mcpu option and/or the hardware multiply support set by the
19668 -mhwmult option. It also toggles warnings about unrecognized MCU
19669 names. This option is on by default.
19670
19671 -mcpu=
19672 Specifies the ISA to use. Accepted values are msp430, msp430x and
19673 msp430xv2. This option is deprecated. The -mmcu= option should be
19674 used to select the ISA.
19675
19676 -msim
19677 Link to the simulator runtime libraries and linker script.
19678 Overrides any scripts that would be selected by the -mmcu= option.
19679
19680 -mlarge
19681 Use large-model addressing (20-bit pointers, 32-bit "size_t").
19682
19683 -msmall
19684 Use small-model addressing (16-bit pointers, 16-bit "size_t").
19685
19686 -mrelax
19687 This option is passed to the assembler and linker, and allows the
19688 linker to perform certain optimizations that cannot be done until
19689 the final link.
19690
19691 mhwmult=
19692 Describes the type of hardware multiply supported by the target.
19693 Accepted values are none for no hardware multiply, 16bit for the
19694 original 16-bit-only multiply supported by early MCUs. 32bit for
19695 the 16/32-bit multiply supported by later MCUs and f5series for the
19696 16/32-bit multiply supported by F5-series MCUs. A value of auto
19697 can also be given. This tells GCC to deduce the hardware multiply
19698 support based upon the MCU name provided by the -mmcu option. If
19699 no -mmcu option is specified or if the MCU name is not recognized
19700 then no hardware multiply support is assumed. "auto" is the
19701 default setting.
19702
19703 Hardware multiplies are normally performed by calling a library
19704 routine. This saves space in the generated code. When compiling
19705 at -O3 or higher however the hardware multiplier is invoked inline.
19706 This makes for bigger, but faster code.
19707
19708 The hardware multiply routines disable interrupts whilst running
19709 and restore the previous interrupt state when they finish. This
19710 makes them safe to use inside interrupt handlers as well as in
19711 normal code.
19712
19713 -minrt
19714 Enable the use of a minimum runtime environment - no static
19715 initializers or constructors. This is intended for memory-
19716 constrained devices. The compiler includes special symbols in some
19717 objects that tell the linker and runtime which code fragments are
19718 required.
19719
19720 -mcode-region=
19721 -mdata-region=
19722 These options tell the compiler where to place functions and data
19723 that do not have one of the "lower", "upper", "either" or "section"
19724 attributes. Possible values are "lower", "upper", "either" or
19725 "any". The first three behave like the corresponding attribute.
19726 The fourth possible value - "any" - is the default. It leaves
19727 placement entirely up to the linker script and how it assigns the
19728 standard sections (".text", ".data", etc) to the memory regions.
19729
19730 -msilicon-errata=
19731 This option passes on a request to assembler to enable the fixes
19732 for the named silicon errata.
19733
19734 -msilicon-errata-warn=
19735 This option passes on a request to the assembler to enable warning
19736 messages when a silicon errata might need to be applied.
19737
19738 NDS32 Options
19739
19740 These options are defined for NDS32 implementations:
19741
19742 -mbig-endian
19743 Generate code in big-endian mode.
19744
19745 -mlittle-endian
19746 Generate code in little-endian mode.
19747
19748 -mreduced-regs
19749 Use reduced-set registers for register allocation.
19750
19751 -mfull-regs
19752 Use full-set registers for register allocation.
19753
19754 -mcmov
19755 Generate conditional move instructions.
19756
19757 -mno-cmov
19758 Do not generate conditional move instructions.
19759
19760 -mext-perf
19761 Generate performance extension instructions.
19762
19763 -mno-ext-perf
19764 Do not generate performance extension instructions.
19765
19766 -mext-perf2
19767 Generate performance extension 2 instructions.
19768
19769 -mno-ext-perf2
19770 Do not generate performance extension 2 instructions.
19771
19772 -mext-string
19773 Generate string extension instructions.
19774
19775 -mno-ext-string
19776 Do not generate string extension instructions.
19777
19778 -mv3push
19779 Generate v3 push25/pop25 instructions.
19780
19781 -mno-v3push
19782 Do not generate v3 push25/pop25 instructions.
19783
19784 -m16-bit
19785 Generate 16-bit instructions.
19786
19787 -mno-16-bit
19788 Do not generate 16-bit instructions.
19789
19790 -misr-vector-size=num
19791 Specify the size of each interrupt vector, which must be 4 or 16.
19792
19793 -mcache-block-size=num
19794 Specify the size of each cache block, which must be a power of 2
19795 between 4 and 512.
19796
19797 -march=arch
19798 Specify the name of the target architecture.
19799
19800 -mcmodel=code-model
19801 Set the code model to one of
19802
19803 small
19804 All the data and read-only data segments must be within 512KB
19805 addressing space. The text segment must be within 16MB
19806 addressing space.
19807
19808 medium
19809 The data segment must be within 512KB while the read-only data
19810 segment can be within 4GB addressing space. The text segment
19811 should be still within 16MB addressing space.
19812
19813 large
19814 All the text and data segments can be within 4GB addressing
19815 space.
19816
19817 -mctor-dtor
19818 Enable constructor/destructor feature.
19819
19820 -mrelax
19821 Guide linker to relax instructions.
19822
19823 Nios II Options
19824
19825 These are the options defined for the Altera Nios II processor.
19826
19827 -G num
19828 Put global and static objects less than or equal to num bytes into
19829 the small data or BSS sections instead of the normal data or BSS
19830 sections. The default value of num is 8.
19831
19832 -mgpopt=option
19833 -mgpopt
19834 -mno-gpopt
19835 Generate (do not generate) GP-relative accesses. The following
19836 option names are recognized:
19837
19838 none
19839 Do not generate GP-relative accesses.
19840
19841 local
19842 Generate GP-relative accesses for small data objects that are
19843 not external, weak, or uninitialized common symbols. Also use
19844 GP-relative addressing for objects that have been explicitly
19845 placed in a small data section via a "section" attribute.
19846
19847 global
19848 As for local, but also generate GP-relative accesses for small
19849 data objects that are external, weak, or common. If you use
19850 this option, you must ensure that all parts of your program
19851 (including libraries) are compiled with the same -G setting.
19852
19853 data
19854 Generate GP-relative accesses for all data objects in the
19855 program. If you use this option, the entire data and BSS
19856 segments of your program must fit in 64K of memory and you must
19857 use an appropriate linker script to allocate them within the
19858 addressable range of the global pointer.
19859
19860 all Generate GP-relative addresses for function pointers as well as
19861 data pointers. If you use this option, the entire text, data,
19862 and BSS segments of your program must fit in 64K of memory and
19863 you must use an appropriate linker script to allocate them
19864 within the addressable range of the global pointer.
19865
19866 -mgpopt is equivalent to -mgpopt=local, and -mno-gpopt is
19867 equivalent to -mgpopt=none.
19868
19869 The default is -mgpopt except when -fpic or -fPIC is specified to
19870 generate position-independent code. Note that the Nios II ABI does
19871 not permit GP-relative accesses from shared libraries.
19872
19873 You may need to specify -mno-gpopt explicitly when building
19874 programs that include large amounts of small data, including large
19875 GOT data sections. In this case, the 16-bit offset for GP-relative
19876 addressing may not be large enough to allow access to the entire
19877 small data section.
19878
19879 -mgprel-sec=regexp
19880 This option specifies additional section names that can be accessed
19881 via GP-relative addressing. It is most useful in conjunction with
19882 "section" attributes on variable declarations and a custom linker
19883 script. The regexp is a POSIX Extended Regular Expression.
19884
19885 This option does not affect the behavior of the -G option, and the
19886 specified sections are in addition to the standard ".sdata" and
19887 ".sbss" small-data sections that are recognized by -mgpopt.
19888
19889 -mr0rel-sec=regexp
19890 This option specifies names of sections that can be accessed via a
19891 16-bit offset from "r0"; that is, in the low 32K or high 32K of the
19892 32-bit address space. It is most useful in conjunction with
19893 "section" attributes on variable declarations and a custom linker
19894 script. The regexp is a POSIX Extended Regular Expression.
19895
19896 In contrast to the use of GP-relative addressing for small data,
19897 zero-based addressing is never generated by default and there are
19898 no conventional section names used in standard linker scripts for
19899 sections in the low or high areas of memory.
19900
19901 -mel
19902 -meb
19903 Generate little-endian (default) or big-endian (experimental) code,
19904 respectively.
19905
19906 -march=arch
19907 This specifies the name of the target Nios II architecture. GCC
19908 uses this name to determine what kind of instructions it can emit
19909 when generating assembly code. Permissible names are: r1, r2.
19910
19911 The preprocessor macro "__nios2_arch__" is available to programs,
19912 with value 1 or 2, indicating the targeted ISA level.
19913
19914 -mbypass-cache
19915 -mno-bypass-cache
19916 Force all load and store instructions to always bypass cache by
19917 using I/O variants of the instructions. The default is not to
19918 bypass the cache.
19919
19920 -mno-cache-volatile
19921 -mcache-volatile
19922 Volatile memory access bypass the cache using the I/O variants of
19923 the load and store instructions. The default is not to bypass the
19924 cache.
19925
19926 -mno-fast-sw-div
19927 -mfast-sw-div
19928 Do not use table-based fast divide for small numbers. The default
19929 is to use the fast divide at -O3 and above.
19930
19931 -mno-hw-mul
19932 -mhw-mul
19933 -mno-hw-mulx
19934 -mhw-mulx
19935 -mno-hw-div
19936 -mhw-div
19937 Enable or disable emitting "mul", "mulx" and "div" family of
19938 instructions by the compiler. The default is to emit "mul" and not
19939 emit "div" and "mulx".
19940
19941 -mbmx
19942 -mno-bmx
19943 -mcdx
19944 -mno-cdx
19945 Enable or disable generation of Nios II R2 BMX (bit manipulation)
19946 and CDX (code density) instructions. Enabling these instructions
19947 also requires -march=r2. Since these instructions are optional
19948 extensions to the R2 architecture, the default is not to emit them.
19949
19950 -mcustom-insn=N
19951 -mno-custom-insn
19952 Each -mcustom-insn=N option enables use of a custom instruction
19953 with encoding N when generating code that uses insn. For example,
19954 -mcustom-fadds=253 generates custom instruction 253 for single-
19955 precision floating-point add operations instead of the default
19956 behavior of using a library call.
19957
19958 The following values of insn are supported. Except as otherwise
19959 noted, floating-point operations are expected to be implemented
19960 with normal IEEE 754 semantics and correspond directly to the C
19961 operators or the equivalent GCC built-in functions.
19962
19963 Single-precision floating point:
19964
19965 fadds, fsubs, fdivs, fmuls
19966 Binary arithmetic operations.
19967
19968 fnegs
19969 Unary negation.
19970
19971 fabss
19972 Unary absolute value.
19973
19974 fcmpeqs, fcmpges, fcmpgts, fcmples, fcmplts, fcmpnes
19975 Comparison operations.
19976
19977 fmins, fmaxs
19978 Floating-point minimum and maximum. These instructions are
19979 only generated if -ffinite-math-only is specified.
19980
19981 fsqrts
19982 Unary square root operation.
19983
19984 fcoss, fsins, ftans, fatans, fexps, flogs
19985 Floating-point trigonometric and exponential functions. These
19986 instructions are only generated if -funsafe-math-optimizations
19987 is also specified.
19988
19989 Double-precision floating point:
19990
19991 faddd, fsubd, fdivd, fmuld
19992 Binary arithmetic operations.
19993
19994 fnegd
19995 Unary negation.
19996
19997 fabsd
19998 Unary absolute value.
19999
20000 fcmpeqd, fcmpged, fcmpgtd, fcmpled, fcmpltd, fcmpned
20001 Comparison operations.
20002
20003 fmind, fmaxd
20004 Double-precision minimum and maximum. These instructions are
20005 only generated if -ffinite-math-only is specified.
20006
20007 fsqrtd
20008 Unary square root operation.
20009
20010 fcosd, fsind, ftand, fatand, fexpd, flogd
20011 Double-precision trigonometric and exponential functions.
20012 These instructions are only generated if
20013 -funsafe-math-optimizations is also specified.
20014
20015 Conversions:
20016
20017 fextsd
20018 Conversion from single precision to double precision.
20019
20020 ftruncds
20021 Conversion from double precision to single precision.
20022
20023 fixsi, fixsu, fixdi, fixdu
20024 Conversion from floating point to signed or unsigned integer
20025 types, with truncation towards zero.
20026
20027 round
20028 Conversion from single-precision floating point to signed
20029 integer, rounding to the nearest integer and ties away from
20030 zero. This corresponds to the "__builtin_lroundf" function
20031 when -fno-math-errno is used.
20032
20033 floatis, floatus, floatid, floatud
20034 Conversion from signed or unsigned integer types to floating-
20035 point types.
20036
20037 In addition, all of the following transfer instructions for
20038 internal registers X and Y must be provided to use any of the
20039 double-precision floating-point instructions. Custom instructions
20040 taking two double-precision source operands expect the first
20041 operand in the 64-bit register X. The other operand (or only
20042 operand of a unary operation) is given to the custom arithmetic
20043 instruction with the least significant half in source register src1
20044 and the most significant half in src2. A custom instruction that
20045 returns a double-precision result returns the most significant 32
20046 bits in the destination register and the other half in 32-bit
20047 register Y. GCC automatically generates the necessary code
20048 sequences to write register X and/or read register Y when double-
20049 precision floating-point instructions are used.
20050
20051 fwrx
20052 Write src1 into the least significant half of X and src2 into
20053 the most significant half of X.
20054
20055 fwry
20056 Write src1 into Y.
20057
20058 frdxhi, frdxlo
20059 Read the most or least (respectively) significant half of X and
20060 store it in dest.
20061
20062 frdy
20063 Read the value of Y and store it into dest.
20064
20065 Note that you can gain more local control over generation of Nios
20066 II custom instructions by using the "target("custom-insn=N")" and
20067 "target("no-custom-insn")" function attributes or pragmas.
20068
20069 -mcustom-fpu-cfg=name
20070 This option enables a predefined, named set of custom instruction
20071 encodings (see -mcustom-insn above). Currently, the following sets
20072 are defined:
20073
20074 -mcustom-fpu-cfg=60-1 is equivalent to: -mcustom-fmuls=252
20075 -mcustom-fadds=253 -mcustom-fsubs=254 -fsingle-precision-constant
20076
20077 -mcustom-fpu-cfg=60-2 is equivalent to: -mcustom-fmuls=252
20078 -mcustom-fadds=253 -mcustom-fsubs=254 -mcustom-fdivs=255
20079 -fsingle-precision-constant
20080
20081 -mcustom-fpu-cfg=72-3 is equivalent to: -mcustom-floatus=243
20082 -mcustom-fixsi=244 -mcustom-floatis=245 -mcustom-fcmpgts=246
20083 -mcustom-fcmples=249 -mcustom-fcmpeqs=250 -mcustom-fcmpnes=251
20084 -mcustom-fmuls=252 -mcustom-fadds=253 -mcustom-fsubs=254
20085 -mcustom-fdivs=255 -fsingle-precision-constant
20086
20087 Custom instruction assignments given by individual -mcustom-insn=
20088 options override those given by -mcustom-fpu-cfg=, regardless of
20089 the order of the options on the command line.
20090
20091 Note that you can gain more local control over selection of a FPU
20092 configuration by using the "target("custom-fpu-cfg=name")" function
20093 attribute or pragma.
20094
20095 These additional -m options are available for the Altera Nios II ELF
20096 (bare-metal) target:
20097
20098 -mhal
20099 Link with HAL BSP. This suppresses linking with the GCC-provided C
20100 runtime startup and termination code, and is typically used in
20101 conjunction with -msys-crt0= to specify the location of the
20102 alternate startup code provided by the HAL BSP.
20103
20104 -msmallc
20105 Link with a limited version of the C library, -lsmallc, rather than
20106 Newlib.
20107
20108 -msys-crt0=startfile
20109 startfile is the file name of the startfile (crt0) to use when
20110 linking. This option is only useful in conjunction with -mhal.
20111
20112 -msys-lib=systemlib
20113 systemlib is the library name of the library that provides low-
20114 level system calls required by the C library, e.g. "read" and
20115 "write". This option is typically used to link with a library
20116 provided by a HAL BSP.
20117
20118 Nvidia PTX Options
20119
20120 These options are defined for Nvidia PTX:
20121
20122 -m32
20123 -m64
20124 Generate code for 32-bit or 64-bit ABI.
20125
20126 -misa=ISA-string
20127 Generate code for given the specified PTX ISA (e.g. sm_35). ISA
20128 strings must be lower-case. Valid ISA strings include sm_30 and
20129 sm_35. The default ISA is sm_30.
20130
20131 -mmainkernel
20132 Link in code for a __main kernel. This is for stand-alone instead
20133 of offloading execution.
20134
20135 -moptimize
20136 Apply partitioned execution optimizations. This is the default
20137 when any level of optimization is selected.
20138
20139 -msoft-stack
20140 Generate code that does not use ".local" memory directly for stack
20141 storage. Instead, a per-warp stack pointer is maintained
20142 explicitly. This enables variable-length stack allocation (with
20143 variable-length arrays or "alloca"), and when global memory is used
20144 for underlying storage, makes it possible to access automatic
20145 variables from other threads, or with atomic instructions. This
20146 code generation variant is used for OpenMP offloading, but the
20147 option is exposed on its own for the purpose of testing the
20148 compiler; to generate code suitable for linking into programs using
20149 OpenMP offloading, use option -mgomp.
20150
20151 -muniform-simt
20152 Switch to code generation variant that allows to execute all
20153 threads in each warp, while maintaining memory state and side
20154 effects as if only one thread in each warp was active outside of
20155 OpenMP SIMD regions. All atomic operations and calls to runtime
20156 (malloc, free, vprintf) are conditionally executed (iff current
20157 lane index equals the master lane index), and the register being
20158 assigned is copied via a shuffle instruction from the master lane.
20159 Outside of SIMD regions lane 0 is the master; inside, each thread
20160 sees itself as the master. Shared memory array "int __nvptx_uni[]"
20161 stores all-zeros or all-ones bitmasks for each warp, indicating
20162 current mode (0 outside of SIMD regions). Each thread can bitwise-
20163 and the bitmask at position "tid.y" with current lane index to
20164 compute the master lane index.
20165
20166 -mgomp
20167 Generate code for use in OpenMP offloading: enables -msoft-stack
20168 and -muniform-simt options, and selects corresponding multilib
20169 variant.
20170
20171 OpenRISC Options
20172
20173 These options are defined for OpenRISC:
20174
20175 -mboard=name
20176 Configure a board specific runtime. This will be passed to the
20177 linker for newlib board library linking. The default is "or1ksim".
20178
20179 -mnewlib
20180 For compatibility, it's always newlib for elf now.
20181
20182 -mhard-div
20183 Generate code for hardware which supports divide instructions.
20184 This is the default.
20185
20186 -mhard-mul
20187 Generate code for hardware which supports multiply instructions.
20188 This is the default.
20189
20190 -mcmov
20191 Generate code for hardware which supports the conditional move
20192 ("l.cmov") instruction.
20193
20194 -mror
20195 Generate code for hardware which supports rotate right
20196 instructions.
20197
20198 -msext
20199 Generate code for hardware which supports sign-extension
20200 instructions.
20201
20202 -msfimm
20203 Generate code for hardware which supports set flag immediate
20204 ("l.sf*i") instructions.
20205
20206 -mshftimm
20207 Generate code for hardware which supports shift immediate related
20208 instructions (i.e. "l.srai", "l.srli", "l.slli", "1.rori"). Note,
20209 to enable generation of the "l.rori" instruction the -mror flag
20210 must also be specified.
20211
20212 -msoft-div
20213 Generate code for hardware which requires divide instruction
20214 emulation.
20215
20216 -msoft-mul
20217 Generate code for hardware which requires multiply instruction
20218 emulation.
20219
20220 PDP-11 Options
20221
20222 These options are defined for the PDP-11:
20223
20224 -mfpu
20225 Use hardware FPP floating point. This is the default. (FIS
20226 floating point on the PDP-11/40 is not supported.) Implies -m45.
20227
20228 -msoft-float
20229 Do not use hardware floating point.
20230
20231 -mac0
20232 Return floating-point results in ac0 (fr0 in Unix assembler
20233 syntax).
20234
20235 -mno-ac0
20236 Return floating-point results in memory. This is the default.
20237
20238 -m40
20239 Generate code for a PDP-11/40. Implies -msoft-float -mno-split.
20240
20241 -m45
20242 Generate code for a PDP-11/45. This is the default.
20243
20244 -m10
20245 Generate code for a PDP-11/10. Implies -msoft-float -mno-split.
20246
20247 -mint16
20248 -mno-int32
20249 Use 16-bit "int". This is the default.
20250
20251 -mint32
20252 -mno-int16
20253 Use 32-bit "int".
20254
20255 -msplit
20256 Target has split instruction and data space. Implies -m45.
20257
20258 -munix-asm
20259 Use Unix assembler syntax.
20260
20261 -mdec-asm
20262 Use DEC assembler syntax.
20263
20264 -mgnu-asm
20265 Use GNU assembler syntax. This is the default.
20266
20267 -mlra
20268 Use the new LRA register allocator. By default, the old "reload"
20269 allocator is used.
20270
20271 picoChip Options
20272
20273 These -m options are defined for picoChip implementations:
20274
20275 -mae=ae_type
20276 Set the instruction set, register set, and instruction scheduling
20277 parameters for array element type ae_type. Supported values for
20278 ae_type are ANY, MUL, and MAC.
20279
20280 -mae=ANY selects a completely generic AE type. Code generated with
20281 this option runs on any of the other AE types. The code is not as
20282 efficient as it would be if compiled for a specific AE type, and
20283 some types of operation (e.g., multiplication) do not work properly
20284 on all types of AE.
20285
20286 -mae=MUL selects a MUL AE type. This is the most useful AE type
20287 for compiled code, and is the default.
20288
20289 -mae=MAC selects a DSP-style MAC AE. Code compiled with this
20290 option may suffer from poor performance of byte (char)
20291 manipulation, since the DSP AE does not provide hardware support
20292 for byte load/stores.
20293
20294 -msymbol-as-address
20295 Enable the compiler to directly use a symbol name as an address in
20296 a load/store instruction, without first loading it into a register.
20297 Typically, the use of this option generates larger programs, which
20298 run faster than when the option isn't used. However, the results
20299 vary from program to program, so it is left as a user option,
20300 rather than being permanently enabled.
20301
20302 -mno-inefficient-warnings
20303 Disables warnings about the generation of inefficient code. These
20304 warnings can be generated, for example, when compiling code that
20305 performs byte-level memory operations on the MAC AE type. The MAC
20306 AE has no hardware support for byte-level memory operations, so all
20307 byte load/stores must be synthesized from word load/store
20308 operations. This is inefficient and a warning is generated to
20309 indicate that you should rewrite the code to avoid byte operations,
20310 or to target an AE type that has the necessary hardware support.
20311 This option disables these warnings.
20312
20313 PowerPC Options
20314
20315 These are listed under
20316
20317 RISC-V Options
20318
20319 These command-line options are defined for RISC-V targets:
20320
20321 -mbranch-cost=n
20322 Set the cost of branches to roughly n instructions.
20323
20324 -mplt
20325 -mno-plt
20326 When generating PIC code, do or don't allow the use of PLTs.
20327 Ignored for non-PIC. The default is -mplt.
20328
20329 -mabi=ABI-string
20330 Specify integer and floating-point calling convention. ABI-string
20331 contains two parts: the size of integer types and the registers
20332 used for floating-point types. For example -march=rv64ifd
20333 -mabi=lp64d means that long and pointers are 64-bit (implicitly
20334 defining int to be 32-bit), and that floating-point values up to 64
20335 bits wide are passed in F registers. Contrast this with
20336 -march=rv64ifd -mabi=lp64f, which still allows the compiler to
20337 generate code that uses the F and D extensions but only allows
20338 floating-point values up to 32 bits long to be passed in registers;
20339 or -march=rv64ifd -mabi=lp64, in which no floating-point arguments
20340 will be passed in registers.
20341
20342 The default for this argument is system dependent, users who want a
20343 specific calling convention should specify one explicitly. The
20344 valid calling conventions are: ilp32, ilp32f, ilp32d, lp64, lp64f,
20345 and lp64d. Some calling conventions are impossible to implement on
20346 some ISAs: for example, -march=rv32if -mabi=ilp32d is invalid
20347 because the ABI requires 64-bit values be passed in F registers,
20348 but F registers are only 32 bits wide. There is also the ilp32e
20349 ABI that can only be used with the rv32e architecture. This ABI is
20350 not well specified at present, and is subject to change.
20351
20352 -mfdiv
20353 -mno-fdiv
20354 Do or don't use hardware floating-point divide and square root
20355 instructions. This requires the F or D extensions for floating-
20356 point registers. The default is to use them if the specified
20357 architecture has these instructions.
20358
20359 -mdiv
20360 -mno-div
20361 Do or don't use hardware instructions for integer division. This
20362 requires the M extension. The default is to use them if the
20363 specified architecture has these instructions.
20364
20365 -march=ISA-string
20366 Generate code for given RISC-V ISA (e.g. rv64im). ISA strings must
20367 be lower-case. Examples include rv64i, rv32g, rv32e, and rv32imaf.
20368
20369 -mtune=processor-string
20370 Optimize the output for the given processor, specified by
20371 microarchitecture name. Permissible values for this option are:
20372 rocket, sifive-3-series, sifive-5-series, sifive-7-series, and
20373 size.
20374
20375 When -mtune= is not specified, the default is rocket.
20376
20377 The size choice is not intended for use by end-users. This is used
20378 when -Os is specified. It overrides the instruction cost info
20379 provided by -mtune=, but does not override the pipeline info. This
20380 helps reduce code size while still giving good performance.
20381
20382 -mpreferred-stack-boundary=num
20383 Attempt to keep the stack boundary aligned to a 2 raised to num
20384 byte boundary. If -mpreferred-stack-boundary is not specified, the
20385 default is 4 (16 bytes or 128-bits).
20386
20387 Warning: If you use this switch, then you must build all modules
20388 with the same value, including any libraries. This includes the
20389 system libraries and startup modules.
20390
20391 -msmall-data-limit=n
20392 Put global and static data smaller than n bytes into a special
20393 section (on some targets).
20394
20395 -msave-restore
20396 -mno-save-restore
20397 Do or don't use smaller but slower prologue and epilogue code that
20398 uses library function calls. The default is to use fast inline
20399 prologues and epilogues.
20400
20401 -mstrict-align
20402 -mno-strict-align
20403 Do not or do generate unaligned memory accesses. The default is
20404 set depending on whether the processor we are optimizing for
20405 supports fast unaligned access or not.
20406
20407 -mcmodel=medlow
20408 Generate code for the medium-low code model. The program and its
20409 statically defined symbols must lie within a single 2 GiB address
20410 range and must lie between absolute addresses -2 GiB and +2 GiB.
20411 Programs can be statically or dynamically linked. This is the
20412 default code model.
20413
20414 -mcmodel=medany
20415 Generate code for the medium-any code model. The program and its
20416 statically defined symbols must be within any single 2 GiB address
20417 range. Programs can be statically or dynamically linked.
20418
20419 -mexplicit-relocs
20420 -mno-exlicit-relocs
20421 Use or do not use assembler relocation operators when dealing with
20422 symbolic addresses. The alternative is to use assembler macros
20423 instead, which may limit optimization.
20424
20425 -mrelax
20426 -mno-relax
20427 Take advantage of linker relaxations to reduce the number of
20428 instructions required to materialize symbol addresses. The default
20429 is to take advantage of linker relaxations.
20430
20431 -memit-attribute
20432 -mno-emit-attribute
20433 Emit (do not emit) RISC-V attribute to record extra information
20434 into ELF objects. This feature requires at least binutils 2.32.
20435
20436 RL78 Options
20437
20438 -msim
20439 Links in additional target libraries to support operation within a
20440 simulator.
20441
20442 -mmul=none
20443 -mmul=g10
20444 -mmul=g13
20445 -mmul=g14
20446 -mmul=rl78
20447 Specifies the type of hardware multiplication and division support
20448 to be used. The simplest is "none", which uses software for both
20449 multiplication and division. This is the default. The "g13" value
20450 is for the hardware multiply/divide peripheral found on the
20451 RL78/G13 (S2 core) targets. The "g14" value selects the use of the
20452 multiplication and division instructions supported by the RL78/G14
20453 (S3 core) parts. The value "rl78" is an alias for "g14" and the
20454 value "mg10" is an alias for "none".
20455
20456 In addition a C preprocessor macro is defined, based upon the
20457 setting of this option. Possible values are: "__RL78_MUL_NONE__",
20458 "__RL78_MUL_G13__" or "__RL78_MUL_G14__".
20459
20460 -mcpu=g10
20461 -mcpu=g13
20462 -mcpu=g14
20463 -mcpu=rl78
20464 Specifies the RL78 core to target. The default is the G14 core,
20465 also known as an S3 core or just RL78. The G13 or S2 core does not
20466 have multiply or divide instructions, instead it uses a hardware
20467 peripheral for these operations. The G10 or S1 core does not have
20468 register banks, so it uses a different calling convention.
20469
20470 If this option is set it also selects the type of hardware multiply
20471 support to use, unless this is overridden by an explicit -mmul=none
20472 option on the command line. Thus specifying -mcpu=g13 enables the
20473 use of the G13 hardware multiply peripheral and specifying
20474 -mcpu=g10 disables the use of hardware multiplications altogether.
20475
20476 Note, although the RL78/G14 core is the default target, specifying
20477 -mcpu=g14 or -mcpu=rl78 on the command line does change the
20478 behavior of the toolchain since it also enables G14 hardware
20479 multiply support. If these options are not specified on the
20480 command line then software multiplication routines will be used
20481 even though the code targets the RL78 core. This is for backwards
20482 compatibility with older toolchains which did not have hardware
20483 multiply and divide support.
20484
20485 In addition a C preprocessor macro is defined, based upon the
20486 setting of this option. Possible values are: "__RL78_G10__",
20487 "__RL78_G13__" or "__RL78_G14__".
20488
20489 -mg10
20490 -mg13
20491 -mg14
20492 -mrl78
20493 These are aliases for the corresponding -mcpu= option. They are
20494 provided for backwards compatibility.
20495
20496 -mallregs
20497 Allow the compiler to use all of the available registers. By
20498 default registers "r24..r31" are reserved for use in interrupt
20499 handlers. With this option enabled these registers can be used in
20500 ordinary functions as well.
20501
20502 -m64bit-doubles
20503 -m32bit-doubles
20504 Make the "double" data type be 64 bits (-m64bit-doubles) or 32 bits
20505 (-m32bit-doubles) in size. The default is -m32bit-doubles.
20506
20507 -msave-mduc-in-interrupts
20508 -mno-save-mduc-in-interrupts
20509 Specifies that interrupt handler functions should preserve the MDUC
20510 registers. This is only necessary if normal code might use the
20511 MDUC registers, for example because it performs multiplication and
20512 division operations. The default is to ignore the MDUC registers
20513 as this makes the interrupt handlers faster. The target option
20514 -mg13 needs to be passed for this to work as this feature is only
20515 available on the G13 target (S2 core). The MDUC registers will
20516 only be saved if the interrupt handler performs a multiplication or
20517 division operation or it calls another function.
20518
20519 IBM RS/6000 and PowerPC Options
20520
20521 These -m options are defined for the IBM RS/6000 and PowerPC:
20522
20523 -mpowerpc-gpopt
20524 -mno-powerpc-gpopt
20525 -mpowerpc-gfxopt
20526 -mno-powerpc-gfxopt
20527 -mpowerpc64
20528 -mno-powerpc64
20529 -mmfcrf
20530 -mno-mfcrf
20531 -mpopcntb
20532 -mno-popcntb
20533 -mpopcntd
20534 -mno-popcntd
20535 -mfprnd
20536 -mno-fprnd
20537 -mcmpb
20538 -mno-cmpb
20539 -mmfpgpr
20540 -mno-mfpgpr
20541 -mhard-dfp
20542 -mno-hard-dfp
20543 You use these options to specify which instructions are available
20544 on the processor you are using. The default value of these options
20545 is determined when configuring GCC. Specifying the -mcpu=cpu_type
20546 overrides the specification of these options. We recommend you use
20547 the -mcpu=cpu_type option rather than the options listed above.
20548
20549 Specifying -mpowerpc-gpopt allows GCC to use the optional PowerPC
20550 architecture instructions in the General Purpose group, including
20551 floating-point square root. Specifying -mpowerpc-gfxopt allows GCC
20552 to use the optional PowerPC architecture instructions in the
20553 Graphics group, including floating-point select.
20554
20555 The -mmfcrf option allows GCC to generate the move from condition
20556 register field instruction implemented on the POWER4 processor and
20557 other processors that support the PowerPC V2.01 architecture. The
20558 -mpopcntb option allows GCC to generate the popcount and double-
20559 precision FP reciprocal estimate instruction implemented on the
20560 POWER5 processor and other processors that support the PowerPC
20561 V2.02 architecture. The -mpopcntd option allows GCC to generate
20562 the popcount instruction implemented on the POWER7 processor and
20563 other processors that support the PowerPC V2.06 architecture. The
20564 -mfprnd option allows GCC to generate the FP round to integer
20565 instructions implemented on the POWER5+ processor and other
20566 processors that support the PowerPC V2.03 architecture. The -mcmpb
20567 option allows GCC to generate the compare bytes instruction
20568 implemented on the POWER6 processor and other processors that
20569 support the PowerPC V2.05 architecture. The -mmfpgpr option allows
20570 GCC to generate the FP move to/from general-purpose register
20571 instructions implemented on the POWER6X processor and other
20572 processors that support the extended PowerPC V2.05 architecture.
20573 The -mhard-dfp option allows GCC to generate the decimal floating-
20574 point instructions implemented on some POWER processors.
20575
20576 The -mpowerpc64 option allows GCC to generate the additional 64-bit
20577 instructions that are found in the full PowerPC64 architecture and
20578 to treat GPRs as 64-bit, doubleword quantities. GCC defaults to
20579 -mno-powerpc64.
20580
20581 -mcpu=cpu_type
20582 Set architecture type, register usage, and instruction scheduling
20583 parameters for machine type cpu_type. Supported values for
20584 cpu_type are 401, 403, 405, 405fp, 440, 440fp, 464, 464fp, 476,
20585 476fp, 505, 601, 602, 603, 603e, 604, 604e, 620, 630, 740, 7400,
20586 7450, 750, 801, 821, 823, 860, 970, 8540, a2, e300c2, e300c3,
20587 e500mc, e500mc64, e5500, e6500, ec603e, G3, G4, G5, titan, power3,
20588 power4, power5, power5+, power6, power6x, power7, power8, power9,
20589 powerpc, powerpc64, powerpc64le, rs64, and native.
20590
20591 -mcpu=powerpc, -mcpu=powerpc64, and -mcpu=powerpc64le specify pure
20592 32-bit PowerPC (either endian), 64-bit big endian PowerPC and
20593 64-bit little endian PowerPC architecture machine types, with an
20594 appropriate, generic processor model assumed for scheduling
20595 purposes.
20596
20597 Specifying native as cpu type detects and selects the architecture
20598 option that corresponds to the host processor of the system
20599 performing the compilation. -mcpu=native has no effect if GCC does
20600 not recognize the processor.
20601
20602 The other options specify a specific processor. Code generated
20603 under those options runs best on that processor, and may not run at
20604 all on others.
20605
20606 The -mcpu options automatically enable or disable the following
20607 options:
20608
20609 -maltivec -mfprnd -mhard-float -mmfcrf -mmultiple -mpopcntb
20610 -mpopcntd -mpowerpc64 -mpowerpc-gpopt -mpowerpc-gfxopt -mmulhw
20611 -mdlmzb -mmfpgpr -mvsx -mcrypto -mhtm -mpower8-fusion
20612 -mpower8-vector -mquad-memory -mquad-memory-atomic -mfloat128
20613 -mfloat128-hardware
20614
20615 The particular options set for any particular CPU varies between
20616 compiler versions, depending on what setting seems to produce
20617 optimal code for that CPU; it doesn't necessarily reflect the
20618 actual hardware's capabilities. If you wish to set an individual
20619 option to a particular value, you may specify it after the -mcpu
20620 option, like -mcpu=970 -mno-altivec.
20621
20622 On AIX, the -maltivec and -mpowerpc64 options are not enabled or
20623 disabled by the -mcpu option at present because AIX does not have
20624 full support for these options. You may still enable or disable
20625 them individually if you're sure it'll work in your environment.
20626
20627 -mtune=cpu_type
20628 Set the instruction scheduling parameters for machine type
20629 cpu_type, but do not set the architecture type or register usage,
20630 as -mcpu=cpu_type does. The same values for cpu_type are used for
20631 -mtune as for -mcpu. If both are specified, the code generated
20632 uses the architecture and registers set by -mcpu, but the
20633 scheduling parameters set by -mtune.
20634
20635 -mcmodel=small
20636 Generate PowerPC64 code for the small model: The TOC is limited to
20637 64k.
20638
20639 -mcmodel=medium
20640 Generate PowerPC64 code for the medium model: The TOC and other
20641 static data may be up to a total of 4G in size. This is the
20642 default for 64-bit Linux.
20643
20644 -mcmodel=large
20645 Generate PowerPC64 code for the large model: The TOC may be up to
20646 4G in size. Other data and code is only limited by the 64-bit
20647 address space.
20648
20649 -maltivec
20650 -mno-altivec
20651 Generate code that uses (does not use) AltiVec instructions, and
20652 also enable the use of built-in functions that allow more direct
20653 access to the AltiVec instruction set. You may also need to set
20654 -mabi=altivec to adjust the current ABI with AltiVec ABI
20655 enhancements.
20656
20657 When -maltivec is used, the element order for AltiVec intrinsics
20658 such as "vec_splat", "vec_extract", and "vec_insert" match array
20659 element order corresponding to the endianness of the target. That
20660 is, element zero identifies the leftmost element in a vector
20661 register when targeting a big-endian platform, and identifies the
20662 rightmost element in a vector register when targeting a little-
20663 endian platform.
20664
20665 -mvrsave
20666 -mno-vrsave
20667 Generate VRSAVE instructions when generating AltiVec code.
20668
20669 -msecure-plt
20670 Generate code that allows ld and ld.so to build executables and
20671 shared libraries with non-executable ".plt" and ".got" sections.
20672 This is a PowerPC 32-bit SYSV ABI option.
20673
20674 -mbss-plt
20675 Generate code that uses a BSS ".plt" section that ld.so fills in,
20676 and requires ".plt" and ".got" sections that are both writable and
20677 executable. This is a PowerPC 32-bit SYSV ABI option.
20678
20679 -misel
20680 -mno-isel
20681 This switch enables or disables the generation of ISEL
20682 instructions.
20683
20684 -mvsx
20685 -mno-vsx
20686 Generate code that uses (does not use) vector/scalar (VSX)
20687 instructions, and also enable the use of built-in functions that
20688 allow more direct access to the VSX instruction set.
20689
20690 -mcrypto
20691 -mno-crypto
20692 Enable the use (disable) of the built-in functions that allow
20693 direct access to the cryptographic instructions that were added in
20694 version 2.07 of the PowerPC ISA.
20695
20696 -mhtm
20697 -mno-htm
20698 Enable (disable) the use of the built-in functions that allow
20699 direct access to the Hardware Transactional Memory (HTM)
20700 instructions that were added in version 2.07 of the PowerPC ISA.
20701
20702 -mpower8-fusion
20703 -mno-power8-fusion
20704 Generate code that keeps (does not keeps) some integer operations
20705 adjacent so that the instructions can be fused together on power8
20706 and later processors.
20707
20708 -mpower8-vector
20709 -mno-power8-vector
20710 Generate code that uses (does not use) the vector and scalar
20711 instructions that were added in version 2.07 of the PowerPC ISA.
20712 Also enable the use of built-in functions that allow more direct
20713 access to the vector instructions.
20714
20715 -mquad-memory
20716 -mno-quad-memory
20717 Generate code that uses (does not use) the non-atomic quad word
20718 memory instructions. The -mquad-memory option requires use of
20719 64-bit mode.
20720
20721 -mquad-memory-atomic
20722 -mno-quad-memory-atomic
20723 Generate code that uses (does not use) the atomic quad word memory
20724 instructions. The -mquad-memory-atomic option requires use of
20725 64-bit mode.
20726
20727 -mfloat128
20728 -mno-float128
20729 Enable/disable the __float128 keyword for IEEE 128-bit floating
20730 point and use either software emulation for IEEE 128-bit floating
20731 point or hardware instructions.
20732
20733 The VSX instruction set (-mvsx, -mcpu=power7, -mcpu=power8), or
20734 -mcpu=power9 must be enabled to use the IEEE 128-bit floating point
20735 support. The IEEE 128-bit floating point support only works on
20736 PowerPC Linux systems.
20737
20738 The default for -mfloat128 is enabled on PowerPC Linux systems
20739 using the VSX instruction set, and disabled on other systems.
20740
20741 If you use the ISA 3.0 instruction set (-mpower9-vector or
20742 -mcpu=power9) on a 64-bit system, the IEEE 128-bit floating point
20743 support will also enable the generation of ISA 3.0 IEEE 128-bit
20744 floating point instructions. Otherwise, if you do not specify to
20745 generate ISA 3.0 instructions or you are targeting a 32-bit big
20746 endian system, IEEE 128-bit floating point will be done with
20747 software emulation.
20748
20749 -mfloat128-hardware
20750 -mno-float128-hardware
20751 Enable/disable using ISA 3.0 hardware instructions to support the
20752 __float128 data type.
20753
20754 The default for -mfloat128-hardware is enabled on PowerPC Linux
20755 systems using the ISA 3.0 instruction set, and disabled on other
20756 systems.
20757
20758 -m32
20759 -m64
20760 Generate code for 32-bit or 64-bit environments of Darwin and SVR4
20761 targets (including GNU/Linux). The 32-bit environment sets int,
20762 long and pointer to 32 bits and generates code that runs on any
20763 PowerPC variant. The 64-bit environment sets int to 32 bits and
20764 long and pointer to 64 bits, and generates code for PowerPC64, as
20765 for -mpowerpc64.
20766
20767 -mfull-toc
20768 -mno-fp-in-toc
20769 -mno-sum-in-toc
20770 -mminimal-toc
20771 Modify generation of the TOC (Table Of Contents), which is created
20772 for every executable file. The -mfull-toc option is selected by
20773 default. In that case, GCC allocates at least one TOC entry for
20774 each unique non-automatic variable reference in your program. GCC
20775 also places floating-point constants in the TOC. However, only
20776 16,384 entries are available in the TOC.
20777
20778 If you receive a linker error message that saying you have
20779 overflowed the available TOC space, you can reduce the amount of
20780 TOC space used with the -mno-fp-in-toc and -mno-sum-in-toc options.
20781 -mno-fp-in-toc prevents GCC from putting floating-point constants
20782 in the TOC and -mno-sum-in-toc forces GCC to generate code to
20783 calculate the sum of an address and a constant at run time instead
20784 of putting that sum into the TOC. You may specify one or both of
20785 these options. Each causes GCC to produce very slightly slower and
20786 larger code at the expense of conserving TOC space.
20787
20788 If you still run out of space in the TOC even when you specify both
20789 of these options, specify -mminimal-toc instead. This option
20790 causes GCC to make only one TOC entry for every file. When you
20791 specify this option, GCC produces code that is slower and larger
20792 but which uses extremely little TOC space. You may wish to use
20793 this option only on files that contain less frequently-executed
20794 code.
20795
20796 -maix64
20797 -maix32
20798 Enable 64-bit AIX ABI and calling convention: 64-bit pointers,
20799 64-bit "long" type, and the infrastructure needed to support them.
20800 Specifying -maix64 implies -mpowerpc64, while -maix32 disables the
20801 64-bit ABI and implies -mno-powerpc64. GCC defaults to -maix32.
20802
20803 -mxl-compat
20804 -mno-xl-compat
20805 Produce code that conforms more closely to IBM XL compiler
20806 semantics when using AIX-compatible ABI. Pass floating-point
20807 arguments to prototyped functions beyond the register save area
20808 (RSA) on the stack in addition to argument FPRs. Do not assume
20809 that most significant double in 128-bit long double value is
20810 properly rounded when comparing values and converting to double.
20811 Use XL symbol names for long double support routines.
20812
20813 The AIX calling convention was extended but not initially
20814 documented to handle an obscure K&R C case of calling a function
20815 that takes the address of its arguments with fewer arguments than
20816 declared. IBM XL compilers access floating-point arguments that do
20817 not fit in the RSA from the stack when a subroutine is compiled
20818 without optimization. Because always storing floating-point
20819 arguments on the stack is inefficient and rarely needed, this
20820 option is not enabled by default and only is necessary when calling
20821 subroutines compiled by IBM XL compilers without optimization.
20822
20823 -mpe
20824 Support IBM RS/6000 SP Parallel Environment (PE). Link an
20825 application written to use message passing with special startup
20826 code to enable the application to run. The system must have PE
20827 installed in the standard location (/usr/lpp/ppe.poe/), or the
20828 specs file must be overridden with the -specs= option to specify
20829 the appropriate directory location. The Parallel Environment does
20830 not support threads, so the -mpe option and the -pthread option are
20831 incompatible.
20832
20833 -malign-natural
20834 -malign-power
20835 On AIX, 32-bit Darwin, and 64-bit PowerPC GNU/Linux, the option
20836 -malign-natural overrides the ABI-defined alignment of larger
20837 types, such as floating-point doubles, on their natural size-based
20838 boundary. The option -malign-power instructs GCC to follow the
20839 ABI-specified alignment rules. GCC defaults to the standard
20840 alignment defined in the ABI.
20841
20842 On 64-bit Darwin, natural alignment is the default, and
20843 -malign-power is not supported.
20844
20845 -msoft-float
20846 -mhard-float
20847 Generate code that does not use (uses) the floating-point register
20848 set. Software floating-point emulation is provided if you use the
20849 -msoft-float option, and pass the option to GCC when linking.
20850
20851 -mmultiple
20852 -mno-multiple
20853 Generate code that uses (does not use) the load multiple word
20854 instructions and the store multiple word instructions. These
20855 instructions are generated by default on POWER systems, and not
20856 generated on PowerPC systems. Do not use -mmultiple on little-
20857 endian PowerPC systems, since those instructions do not work when
20858 the processor is in little-endian mode. The exceptions are PPC740
20859 and PPC750 which permit these instructions in little-endian mode.
20860
20861 -mupdate
20862 -mno-update
20863 Generate code that uses (does not use) the load or store
20864 instructions that update the base register to the address of the
20865 calculated memory location. These instructions are generated by
20866 default. If you use -mno-update, there is a small window between
20867 the time that the stack pointer is updated and the address of the
20868 previous frame is stored, which means code that walks the stack
20869 frame across interrupts or signals may get corrupted data.
20870
20871 -mavoid-indexed-addresses
20872 -mno-avoid-indexed-addresses
20873 Generate code that tries to avoid (not avoid) the use of indexed
20874 load or store instructions. These instructions can incur a
20875 performance penalty on Power6 processors in certain situations,
20876 such as when stepping through large arrays that cross a 16M
20877 boundary. This option is enabled by default when targeting Power6
20878 and disabled otherwise.
20879
20880 -mfused-madd
20881 -mno-fused-madd
20882 Generate code that uses (does not use) the floating-point multiply
20883 and accumulate instructions. These instructions are generated by
20884 default if hardware floating point is used. The machine-dependent
20885 -mfused-madd option is now mapped to the machine-independent
20886 -ffp-contract=fast option, and -mno-fused-madd is mapped to
20887 -ffp-contract=off.
20888
20889 -mmulhw
20890 -mno-mulhw
20891 Generate code that uses (does not use) the half-word multiply and
20892 multiply-accumulate instructions on the IBM 405, 440, 464 and 476
20893 processors. These instructions are generated by default when
20894 targeting those processors.
20895
20896 -mdlmzb
20897 -mno-dlmzb
20898 Generate code that uses (does not use) the string-search dlmzb
20899 instruction on the IBM 405, 440, 464 and 476 processors. This
20900 instruction is generated by default when targeting those
20901 processors.
20902
20903 -mno-bit-align
20904 -mbit-align
20905 On System V.4 and embedded PowerPC systems do not (do) force
20906 structures and unions that contain bit-fields to be aligned to the
20907 base type of the bit-field.
20908
20909 For example, by default a structure containing nothing but 8
20910 "unsigned" bit-fields of length 1 is aligned to a 4-byte boundary
20911 and has a size of 4 bytes. By using -mno-bit-align, the structure
20912 is aligned to a 1-byte boundary and is 1 byte in size.
20913
20914 -mno-strict-align
20915 -mstrict-align
20916 On System V.4 and embedded PowerPC systems do not (do) assume that
20917 unaligned memory references are handled by the system.
20918
20919 -mrelocatable
20920 -mno-relocatable
20921 Generate code that allows (does not allow) a static executable to
20922 be relocated to a different address at run time. A simple embedded
20923 PowerPC system loader should relocate the entire contents of
20924 ".got2" and 4-byte locations listed in the ".fixup" section, a
20925 table of 32-bit addresses generated by this option. For this to
20926 work, all objects linked together must be compiled with
20927 -mrelocatable or -mrelocatable-lib. -mrelocatable code aligns the
20928 stack to an 8-byte boundary.
20929
20930 -mrelocatable-lib
20931 -mno-relocatable-lib
20932 Like -mrelocatable, -mrelocatable-lib generates a ".fixup" section
20933 to allow static executables to be relocated at run time, but
20934 -mrelocatable-lib does not use the smaller stack alignment of
20935 -mrelocatable. Objects compiled with -mrelocatable-lib may be
20936 linked with objects compiled with any combination of the
20937 -mrelocatable options.
20938
20939 -mno-toc
20940 -mtoc
20941 On System V.4 and embedded PowerPC systems do not (do) assume that
20942 register 2 contains a pointer to a global area pointing to the
20943 addresses used in the program.
20944
20945 -mlittle
20946 -mlittle-endian
20947 On System V.4 and embedded PowerPC systems compile code for the
20948 processor in little-endian mode. The -mlittle-endian option is the
20949 same as -mlittle.
20950
20951 -mbig
20952 -mbig-endian
20953 On System V.4 and embedded PowerPC systems compile code for the
20954 processor in big-endian mode. The -mbig-endian option is the same
20955 as -mbig.
20956
20957 -mdynamic-no-pic
20958 On Darwin and Mac OS X systems, compile code so that it is not
20959 relocatable, but that its external references are relocatable. The
20960 resulting code is suitable for applications, but not shared
20961 libraries.
20962
20963 -msingle-pic-base
20964 Treat the register used for PIC addressing as read-only, rather
20965 than loading it in the prologue for each function. The runtime
20966 system is responsible for initializing this register with an
20967 appropriate value before execution begins.
20968
20969 -mprioritize-restricted-insns=priority
20970 This option controls the priority that is assigned to dispatch-slot
20971 restricted instructions during the second scheduling pass. The
20972 argument priority takes the value 0, 1, or 2 to assign no, highest,
20973 or second-highest (respectively) priority to dispatch-slot
20974 restricted instructions.
20975
20976 -msched-costly-dep=dependence_type
20977 This option controls which dependences are considered costly by the
20978 target during instruction scheduling. The argument dependence_type
20979 takes one of the following values:
20980
20981 no No dependence is costly.
20982
20983 all All dependences are costly.
20984
20985 true_store_to_load
20986 A true dependence from store to load is costly.
20987
20988 store_to_load
20989 Any dependence from store to load is costly.
20990
20991 number
20992 Any dependence for which the latency is greater than or equal
20993 to number is costly.
20994
20995 -minsert-sched-nops=scheme
20996 This option controls which NOP insertion scheme is used during the
20997 second scheduling pass. The argument scheme takes one of the
20998 following values:
20999
21000 no Don't insert NOPs.
21001
21002 pad Pad with NOPs any dispatch group that has vacant issue slots,
21003 according to the scheduler's grouping.
21004
21005 regroup_exact
21006 Insert NOPs to force costly dependent insns into separate
21007 groups. Insert exactly as many NOPs as needed to force an insn
21008 to a new group, according to the estimated processor grouping.
21009
21010 number
21011 Insert NOPs to force costly dependent insns into separate
21012 groups. Insert number NOPs to force an insn to a new group.
21013
21014 -mcall-sysv
21015 On System V.4 and embedded PowerPC systems compile code using
21016 calling conventions that adhere to the March 1995 draft of the
21017 System V Application Binary Interface, PowerPC processor
21018 supplement. This is the default unless you configured GCC using
21019 powerpc-*-eabiaix.
21020
21021 -mcall-sysv-eabi
21022 -mcall-eabi
21023 Specify both -mcall-sysv and -meabi options.
21024
21025 -mcall-sysv-noeabi
21026 Specify both -mcall-sysv and -mno-eabi options.
21027
21028 -mcall-aixdesc
21029 On System V.4 and embedded PowerPC systems compile code for the AIX
21030 operating system.
21031
21032 -mcall-linux
21033 On System V.4 and embedded PowerPC systems compile code for the
21034 Linux-based GNU system.
21035
21036 -mcall-freebsd
21037 On System V.4 and embedded PowerPC systems compile code for the
21038 FreeBSD operating system.
21039
21040 -mcall-netbsd
21041 On System V.4 and embedded PowerPC systems compile code for the
21042 NetBSD operating system.
21043
21044 -mcall-openbsd
21045 On System V.4 and embedded PowerPC systems compile code for the
21046 OpenBSD operating system.
21047
21048 -mtraceback=traceback_type
21049 Select the type of traceback table. Valid values for traceback_type
21050 are full, part, and no.
21051
21052 -maix-struct-return
21053 Return all structures in memory (as specified by the AIX ABI).
21054
21055 -msvr4-struct-return
21056 Return structures smaller than 8 bytes in registers (as specified
21057 by the SVR4 ABI).
21058
21059 -mabi=abi-type
21060 Extend the current ABI with a particular extension, or remove such
21061 extension. Valid values are altivec, no-altivec, ibmlongdouble,
21062 ieeelongdouble, elfv1, elfv2.
21063
21064 -mabi=ibmlongdouble
21065 Change the current ABI to use IBM extended-precision long double.
21066 This is not likely to work if your system defaults to using IEEE
21067 extended-precision long double. If you change the long double type
21068 from IEEE extended-precision, the compiler will issue a warning
21069 unless you use the -Wno-psabi option. Requires -mlong-double-128
21070 to be enabled.
21071
21072 -mabi=ieeelongdouble
21073 Change the current ABI to use IEEE extended-precision long double.
21074 This is not likely to work if your system defaults to using IBM
21075 extended-precision long double. If you change the long double type
21076 from IBM extended-precision, the compiler will issue a warning
21077 unless you use the -Wno-psabi option. Requires -mlong-double-128
21078 to be enabled.
21079
21080 -mabi=elfv1
21081 Change the current ABI to use the ELFv1 ABI. This is the default
21082 ABI for big-endian PowerPC 64-bit Linux. Overriding the default
21083 ABI requires special system support and is likely to fail in
21084 spectacular ways.
21085
21086 -mabi=elfv2
21087 Change the current ABI to use the ELFv2 ABI. This is the default
21088 ABI for little-endian PowerPC 64-bit Linux. Overriding the default
21089 ABI requires special system support and is likely to fail in
21090 spectacular ways.
21091
21092 -mgnu-attribute
21093 -mno-gnu-attribute
21094 Emit .gnu_attribute assembly directives to set tag/value pairs in a
21095 .gnu.attributes section that specify ABI variations in function
21096 parameters or return values.
21097
21098 -mprototype
21099 -mno-prototype
21100 On System V.4 and embedded PowerPC systems assume that all calls to
21101 variable argument functions are properly prototyped. Otherwise,
21102 the compiler must insert an instruction before every non-prototyped
21103 call to set or clear bit 6 of the condition code register ("CR") to
21104 indicate whether floating-point values are passed in the floating-
21105 point registers in case the function takes variable arguments.
21106 With -mprototype, only calls to prototyped variable argument
21107 functions set or clear the bit.
21108
21109 -msim
21110 On embedded PowerPC systems, assume that the startup module is
21111 called sim-crt0.o and that the standard C libraries are libsim.a
21112 and libc.a. This is the default for powerpc-*-eabisim
21113 configurations.
21114
21115 -mmvme
21116 On embedded PowerPC systems, assume that the startup module is
21117 called crt0.o and the standard C libraries are libmvme.a and
21118 libc.a.
21119
21120 -mads
21121 On embedded PowerPC systems, assume that the startup module is
21122 called crt0.o and the standard C libraries are libads.a and libc.a.
21123
21124 -myellowknife
21125 On embedded PowerPC systems, assume that the startup module is
21126 called crt0.o and the standard C libraries are libyk.a and libc.a.
21127
21128 -mvxworks
21129 On System V.4 and embedded PowerPC systems, specify that you are
21130 compiling for a VxWorks system.
21131
21132 -memb
21133 On embedded PowerPC systems, set the "PPC_EMB" bit in the ELF flags
21134 header to indicate that eabi extended relocations are used.
21135
21136 -meabi
21137 -mno-eabi
21138 On System V.4 and embedded PowerPC systems do (do not) adhere to
21139 the Embedded Applications Binary Interface (EABI), which is a set
21140 of modifications to the System V.4 specifications. Selecting
21141 -meabi means that the stack is aligned to an 8-byte boundary, a
21142 function "__eabi" is called from "main" to set up the EABI
21143 environment, and the -msdata option can use both "r2" and "r13" to
21144 point to two separate small data areas. Selecting -mno-eabi means
21145 that the stack is aligned to a 16-byte boundary, no EABI
21146 initialization function is called from "main", and the -msdata
21147 option only uses "r13" to point to a single small data area. The
21148 -meabi option is on by default if you configured GCC using one of
21149 the powerpc*-*-eabi* options.
21150
21151 -msdata=eabi
21152 On System V.4 and embedded PowerPC systems, put small initialized
21153 "const" global and static data in the ".sdata2" section, which is
21154 pointed to by register "r2". Put small initialized non-"const"
21155 global and static data in the ".sdata" section, which is pointed to
21156 by register "r13". Put small uninitialized global and static data
21157 in the ".sbss" section, which is adjacent to the ".sdata" section.
21158 The -msdata=eabi option is incompatible with the -mrelocatable
21159 option. The -msdata=eabi option also sets the -memb option.
21160
21161 -msdata=sysv
21162 On System V.4 and embedded PowerPC systems, put small global and
21163 static data in the ".sdata" section, which is pointed to by
21164 register "r13". Put small uninitialized global and static data in
21165 the ".sbss" section, which is adjacent to the ".sdata" section.
21166 The -msdata=sysv option is incompatible with the -mrelocatable
21167 option.
21168
21169 -msdata=default
21170 -msdata
21171 On System V.4 and embedded PowerPC systems, if -meabi is used,
21172 compile code the same as -msdata=eabi, otherwise compile code the
21173 same as -msdata=sysv.
21174
21175 -msdata=data
21176 On System V.4 and embedded PowerPC systems, put small global data
21177 in the ".sdata" section. Put small uninitialized global data in
21178 the ".sbss" section. Do not use register "r13" to address small
21179 data however. This is the default behavior unless other -msdata
21180 options are used.
21181
21182 -msdata=none
21183 -mno-sdata
21184 On embedded PowerPC systems, put all initialized global and static
21185 data in the ".data" section, and all uninitialized data in the
21186 ".bss" section.
21187
21188 -mreadonly-in-sdata
21189 Put read-only objects in the ".sdata" section as well. This is the
21190 default.
21191
21192 -mblock-move-inline-limit=num
21193 Inline all block moves (such as calls to "memcpy" or structure
21194 copies) less than or equal to num bytes. The minimum value for num
21195 is 32 bytes on 32-bit targets and 64 bytes on 64-bit targets. The
21196 default value is target-specific.
21197
21198 -mblock-compare-inline-limit=num
21199 Generate non-looping inline code for all block compares (such as
21200 calls to "memcmp" or structure compares) less than or equal to num
21201 bytes. If num is 0, all inline expansion (non-loop and loop) of
21202 block compare is disabled. The default value is target-specific.
21203
21204 -mblock-compare-inline-loop-limit=num
21205 Generate an inline expansion using loop code for all block compares
21206 that are less than or equal to num bytes, but greater than the
21207 limit for non-loop inline block compare expansion. If the block
21208 length is not constant, at most num bytes will be compared before
21209 "memcmp" is called to compare the remainder of the block. The
21210 default value is target-specific.
21211
21212 -mstring-compare-inline-limit=num
21213 Compare at most num string bytes with inline code. If the
21214 difference or end of string is not found at the end of the inline
21215 compare a call to "strcmp" or "strncmp" will take care of the rest
21216 of the comparison. The default is 64 bytes.
21217
21218 -G num
21219 On embedded PowerPC systems, put global and static items less than
21220 or equal to num bytes into the small data or BSS sections instead
21221 of the normal data or BSS section. By default, num is 8. The -G
21222 num switch is also passed to the linker. All modules should be
21223 compiled with the same -G num value.
21224
21225 -mregnames
21226 -mno-regnames
21227 On System V.4 and embedded PowerPC systems do (do not) emit
21228 register names in the assembly language output using symbolic
21229 forms.
21230
21231 -mlongcall
21232 -mno-longcall
21233 By default assume that all calls are far away so that a longer and
21234 more expensive calling sequence is required. This is required for
21235 calls farther than 32 megabytes (33,554,432 bytes) from the current
21236 location. A short call is generated if the compiler knows the call
21237 cannot be that far away. This setting can be overridden by the
21238 "shortcall" function attribute, or by "#pragma longcall(0)".
21239
21240 Some linkers are capable of detecting out-of-range calls and
21241 generating glue code on the fly. On these systems, long calls are
21242 unnecessary and generate slower code. As of this writing, the AIX
21243 linker can do this, as can the GNU linker for PowerPC/64. It is
21244 planned to add this feature to the GNU linker for 32-bit PowerPC
21245 systems as well.
21246
21247 On PowerPC64 ELFv2 and 32-bit PowerPC systems with newer GNU
21248 linkers, GCC can generate long calls using an inline PLT call
21249 sequence (see -mpltseq). PowerPC with -mbss-plt and PowerPC64
21250 ELFv1 (big-endian) do not support inline PLT calls.
21251
21252 On Darwin/PPC systems, "#pragma longcall" generates "jbsr callee,
21253 L42", plus a branch island (glue code). The two target addresses
21254 represent the callee and the branch island. The Darwin/PPC linker
21255 prefers the first address and generates a "bl callee" if the PPC
21256 "bl" instruction reaches the callee directly; otherwise, the linker
21257 generates "bl L42" to call the branch island. The branch island is
21258 appended to the body of the calling function; it computes the full
21259 32-bit address of the callee and jumps to it.
21260
21261 On Mach-O (Darwin) systems, this option directs the compiler emit
21262 to the glue for every direct call, and the Darwin linker decides
21263 whether to use or discard it.
21264
21265 In the future, GCC may ignore all longcall specifications when the
21266 linker is known to generate glue.
21267
21268 -mpltseq
21269 -mno-pltseq
21270 Implement (do not implement) -fno-plt and long calls using an
21271 inline PLT call sequence that supports lazy linking and long calls
21272 to functions in dlopen'd shared libraries. Inline PLT calls are
21273 only supported on PowerPC64 ELFv2 and 32-bit PowerPC systems with
21274 newer GNU linkers, and are enabled by default if the support is
21275 detected when configuring GCC, and, in the case of 32-bit PowerPC,
21276 if GCC is configured with --enable-secureplt. -mpltseq code and
21277 -mbss-plt 32-bit PowerPC relocatable objects may not be linked
21278 together.
21279
21280 -mtls-markers
21281 -mno-tls-markers
21282 Mark (do not mark) calls to "__tls_get_addr" with a relocation
21283 specifying the function argument. The relocation allows the linker
21284 to reliably associate function call with argument setup
21285 instructions for TLS optimization, which in turn allows GCC to
21286 better schedule the sequence.
21287
21288 -mrecip
21289 -mno-recip
21290 This option enables use of the reciprocal estimate and reciprocal
21291 square root estimate instructions with additional Newton-Raphson
21292 steps to increase precision instead of doing a divide or square
21293 root and divide for floating-point arguments. You should use the
21294 -ffast-math option when using -mrecip (or at least
21295 -funsafe-math-optimizations, -ffinite-math-only, -freciprocal-math
21296 and -fno-trapping-math). Note that while the throughput of the
21297 sequence is generally higher than the throughput of the non-
21298 reciprocal instruction, the precision of the sequence can be
21299 decreased by up to 2 ulp (i.e. the inverse of 1.0 equals
21300 0.99999994) for reciprocal square roots.
21301
21302 -mrecip=opt
21303 This option controls which reciprocal estimate instructions may be
21304 used. opt is a comma-separated list of options, which may be
21305 preceded by a "!" to invert the option:
21306
21307 all Enable all estimate instructions.
21308
21309 default
21310 Enable the default instructions, equivalent to -mrecip.
21311
21312 none
21313 Disable all estimate instructions, equivalent to -mno-recip.
21314
21315 div Enable the reciprocal approximation instructions for both
21316 single and double precision.
21317
21318 divf
21319 Enable the single-precision reciprocal approximation
21320 instructions.
21321
21322 divd
21323 Enable the double-precision reciprocal approximation
21324 instructions.
21325
21326 rsqrt
21327 Enable the reciprocal square root approximation instructions
21328 for both single and double precision.
21329
21330 rsqrtf
21331 Enable the single-precision reciprocal square root
21332 approximation instructions.
21333
21334 rsqrtd
21335 Enable the double-precision reciprocal square root
21336 approximation instructions.
21337
21338 So, for example, -mrecip=all,!rsqrtd enables all of the reciprocal
21339 estimate instructions, except for the "FRSQRTE", "XSRSQRTEDP", and
21340 "XVRSQRTEDP" instructions which handle the double-precision
21341 reciprocal square root calculations.
21342
21343 -mrecip-precision
21344 -mno-recip-precision
21345 Assume (do not assume) that the reciprocal estimate instructions
21346 provide higher-precision estimates than is mandated by the PowerPC
21347 ABI. Selecting -mcpu=power6, -mcpu=power7 or -mcpu=power8
21348 automatically selects -mrecip-precision. The double-precision
21349 square root estimate instructions are not generated by default on
21350 low-precision machines, since they do not provide an estimate that
21351 converges after three steps.
21352
21353 -mveclibabi=type
21354 Specifies the ABI type to use for vectorizing intrinsics using an
21355 external library. The only type supported at present is mass,
21356 which specifies to use IBM's Mathematical Acceleration Subsystem
21357 (MASS) libraries for vectorizing intrinsics using external
21358 libraries. GCC currently emits calls to "acosd2", "acosf4",
21359 "acoshd2", "acoshf4", "asind2", "asinf4", "asinhd2", "asinhf4",
21360 "atan2d2", "atan2f4", "atand2", "atanf4", "atanhd2", "atanhf4",
21361 "cbrtd2", "cbrtf4", "cosd2", "cosf4", "coshd2", "coshf4", "erfcd2",
21362 "erfcf4", "erfd2", "erff4", "exp2d2", "exp2f4", "expd2", "expf4",
21363 "expm1d2", "expm1f4", "hypotd2", "hypotf4", "lgammad2", "lgammaf4",
21364 "log10d2", "log10f4", "log1pd2", "log1pf4", "log2d2", "log2f4",
21365 "logd2", "logf4", "powd2", "powf4", "sind2", "sinf4", "sinhd2",
21366 "sinhf4", "sqrtd2", "sqrtf4", "tand2", "tanf4", "tanhd2", and
21367 "tanhf4" when generating code for power7. Both -ftree-vectorize
21368 and -funsafe-math-optimizations must also be enabled. The MASS
21369 libraries must be specified at link time.
21370
21371 -mfriz
21372 -mno-friz
21373 Generate (do not generate) the "friz" instruction when the
21374 -funsafe-math-optimizations option is used to optimize rounding of
21375 floating-point values to 64-bit integer and back to floating point.
21376 The "friz" instruction does not return the same value if the
21377 floating-point number is too large to fit in an integer.
21378
21379 -mpointers-to-nested-functions
21380 -mno-pointers-to-nested-functions
21381 Generate (do not generate) code to load up the static chain
21382 register ("r11") when calling through a pointer on AIX and 64-bit
21383 Linux systems where a function pointer points to a 3-word
21384 descriptor giving the function address, TOC value to be loaded in
21385 register "r2", and static chain value to be loaded in register
21386 "r11". The -mpointers-to-nested-functions is on by default. You
21387 cannot call through pointers to nested functions or pointers to
21388 functions compiled in other languages that use the static chain if
21389 you use -mno-pointers-to-nested-functions.
21390
21391 -msave-toc-indirect
21392 -mno-save-toc-indirect
21393 Generate (do not generate) code to save the TOC value in the
21394 reserved stack location in the function prologue if the function
21395 calls through a pointer on AIX and 64-bit Linux systems. If the
21396 TOC value is not saved in the prologue, it is saved just before the
21397 call through the pointer. The -mno-save-toc-indirect option is the
21398 default.
21399
21400 -mcompat-align-parm
21401 -mno-compat-align-parm
21402 Generate (do not generate) code to pass structure parameters with a
21403 maximum alignment of 64 bits, for compatibility with older versions
21404 of GCC.
21405
21406 Older versions of GCC (prior to 4.9.0) incorrectly did not align a
21407 structure parameter on a 128-bit boundary when that structure
21408 contained a member requiring 128-bit alignment. This is corrected
21409 in more recent versions of GCC. This option may be used to
21410 generate code that is compatible with functions compiled with older
21411 versions of GCC.
21412
21413 The -mno-compat-align-parm option is the default.
21414
21415 -mstack-protector-guard=guard
21416 -mstack-protector-guard-reg=reg
21417 -mstack-protector-guard-offset=offset
21418 -mstack-protector-guard-symbol=symbol
21419 Generate stack protection code using canary at guard. Supported
21420 locations are global for global canary or tls for per-thread canary
21421 in the TLS block (the default with GNU libc version 2.4 or later).
21422
21423 With the latter choice the options -mstack-protector-guard-reg=reg
21424 and -mstack-protector-guard-offset=offset furthermore specify which
21425 register to use as base register for reading the canary, and from
21426 what offset from that base register. The default for those is as
21427 specified in the relevant ABI.
21428 -mstack-protector-guard-symbol=symbol overrides the offset with a
21429 symbol reference to a canary in the TLS block.
21430
21431 RX Options
21432
21433 These command-line options are defined for RX targets:
21434
21435 -m64bit-doubles
21436 -m32bit-doubles
21437 Make the "double" data type be 64 bits (-m64bit-doubles) or 32 bits
21438 (-m32bit-doubles) in size. The default is -m32bit-doubles. Note
21439 RX floating-point hardware only works on 32-bit values, which is
21440 why the default is -m32bit-doubles.
21441
21442 -fpu
21443 -nofpu
21444 Enables (-fpu) or disables (-nofpu) the use of RX floating-point
21445 hardware. The default is enabled for the RX600 series and disabled
21446 for the RX200 series.
21447
21448 Floating-point instructions are only generated for 32-bit floating-
21449 point values, however, so the FPU hardware is not used for doubles
21450 if the -m64bit-doubles option is used.
21451
21452 Note If the -fpu option is enabled then -funsafe-math-optimizations
21453 is also enabled automatically. This is because the RX FPU
21454 instructions are themselves unsafe.
21455
21456 -mcpu=name
21457 Selects the type of RX CPU to be targeted. Currently three types
21458 are supported, the generic RX600 and RX200 series hardware and the
21459 specific RX610 CPU. The default is RX600.
21460
21461 The only difference between RX600 and RX610 is that the RX610 does
21462 not support the "MVTIPL" instruction.
21463
21464 The RX200 series does not have a hardware floating-point unit and
21465 so -nofpu is enabled by default when this type is selected.
21466
21467 -mbig-endian-data
21468 -mlittle-endian-data
21469 Store data (but not code) in the big-endian format. The default is
21470 -mlittle-endian-data, i.e. to store data in the little-endian
21471 format.
21472
21473 -msmall-data-limit=N
21474 Specifies the maximum size in bytes of global and static variables
21475 which can be placed into the small data area. Using the small data
21476 area can lead to smaller and faster code, but the size of area is
21477 limited and it is up to the programmer to ensure that the area does
21478 not overflow. Also when the small data area is used one of the
21479 RX's registers (usually "r13") is reserved for use pointing to this
21480 area, so it is no longer available for use by the compiler. This
21481 could result in slower and/or larger code if variables are pushed
21482 onto the stack instead of being held in this register.
21483
21484 Note, common variables (variables that have not been initialized)
21485 and constants are not placed into the small data area as they are
21486 assigned to other sections in the output executable.
21487
21488 The default value is zero, which disables this feature. Note, this
21489 feature is not enabled by default with higher optimization levels
21490 (-O2 etc) because of the potentially detrimental effects of
21491 reserving a register. It is up to the programmer to experiment and
21492 discover whether this feature is of benefit to their program. See
21493 the description of the -mpid option for a description of how the
21494 actual register to hold the small data area pointer is chosen.
21495
21496 -msim
21497 -mno-sim
21498 Use the simulator runtime. The default is to use the libgloss
21499 board-specific runtime.
21500
21501 -mas100-syntax
21502 -mno-as100-syntax
21503 When generating assembler output use a syntax that is compatible
21504 with Renesas's AS100 assembler. This syntax can also be handled by
21505 the GAS assembler, but it has some restrictions so it is not
21506 generated by default.
21507
21508 -mmax-constant-size=N
21509 Specifies the maximum size, in bytes, of a constant that can be
21510 used as an operand in a RX instruction. Although the RX
21511 instruction set does allow constants of up to 4 bytes in length to
21512 be used in instructions, a longer value equates to a longer
21513 instruction. Thus in some circumstances it can be beneficial to
21514 restrict the size of constants that are used in instructions.
21515 Constants that are too big are instead placed into a constant pool
21516 and referenced via register indirection.
21517
21518 The value N can be between 0 and 4. A value of 0 (the default) or
21519 4 means that constants of any size are allowed.
21520
21521 -mrelax
21522 Enable linker relaxation. Linker relaxation is a process whereby
21523 the linker attempts to reduce the size of a program by finding
21524 shorter versions of various instructions. Disabled by default.
21525
21526 -mint-register=N
21527 Specify the number of registers to reserve for fast interrupt
21528 handler functions. The value N can be between 0 and 4. A value of
21529 1 means that register "r13" is reserved for the exclusive use of
21530 fast interrupt handlers. A value of 2 reserves "r13" and "r12". A
21531 value of 3 reserves "r13", "r12" and "r11", and a value of 4
21532 reserves "r13" through "r10". A value of 0, the default, does not
21533 reserve any registers.
21534
21535 -msave-acc-in-interrupts
21536 Specifies that interrupt handler functions should preserve the
21537 accumulator register. This is only necessary if normal code might
21538 use the accumulator register, for example because it performs
21539 64-bit multiplications. The default is to ignore the accumulator
21540 as this makes the interrupt handlers faster.
21541
21542 -mpid
21543 -mno-pid
21544 Enables the generation of position independent data. When enabled
21545 any access to constant data is done via an offset from a base
21546 address held in a register. This allows the location of constant
21547 data to be determined at run time without requiring the executable
21548 to be relocated, which is a benefit to embedded applications with
21549 tight memory constraints. Data that can be modified is not
21550 affected by this option.
21551
21552 Note, using this feature reserves a register, usually "r13", for
21553 the constant data base address. This can result in slower and/or
21554 larger code, especially in complicated functions.
21555
21556 The actual register chosen to hold the constant data base address
21557 depends upon whether the -msmall-data-limit and/or the
21558 -mint-register command-line options are enabled. Starting with
21559 register "r13" and proceeding downwards, registers are allocated
21560 first to satisfy the requirements of -mint-register, then -mpid and
21561 finally -msmall-data-limit. Thus it is possible for the small data
21562 area register to be "r8" if both -mint-register=4 and -mpid are
21563 specified on the command line.
21564
21565 By default this feature is not enabled. The default can be
21566 restored via the -mno-pid command-line option.
21567
21568 -mno-warn-multiple-fast-interrupts
21569 -mwarn-multiple-fast-interrupts
21570 Prevents GCC from issuing a warning message if it finds more than
21571 one fast interrupt handler when it is compiling a file. The
21572 default is to issue a warning for each extra fast interrupt handler
21573 found, as the RX only supports one such interrupt.
21574
21575 -mallow-string-insns
21576 -mno-allow-string-insns
21577 Enables or disables the use of the string manipulation instructions
21578 "SMOVF", "SCMPU", "SMOVB", "SMOVU", "SUNTIL" "SWHILE" and also the
21579 "RMPA" instruction. These instructions may prefetch data, which is
21580 not safe to do if accessing an I/O register. (See section 12.2.7
21581 of the RX62N Group User's Manual for more information).
21582
21583 The default is to allow these instructions, but it is not possible
21584 for GCC to reliably detect all circumstances where a string
21585 instruction might be used to access an I/O register, so their use
21586 cannot be disabled automatically. Instead it is reliant upon the
21587 programmer to use the -mno-allow-string-insns option if their
21588 program accesses I/O space.
21589
21590 When the instructions are enabled GCC defines the C preprocessor
21591 symbol "__RX_ALLOW_STRING_INSNS__", otherwise it defines the symbol
21592 "__RX_DISALLOW_STRING_INSNS__".
21593
21594 -mjsr
21595 -mno-jsr
21596 Use only (or not only) "JSR" instructions to access functions.
21597 This option can be used when code size exceeds the range of "BSR"
21598 instructions. Note that -mno-jsr does not mean to not use "JSR"
21599 but instead means that any type of branch may be used.
21600
21601 Note: The generic GCC command-line option -ffixed-reg has special
21602 significance to the RX port when used with the "interrupt" function
21603 attribute. This attribute indicates a function intended to process
21604 fast interrupts. GCC ensures that it only uses the registers "r10",
21605 "r11", "r12" and/or "r13" and only provided that the normal use of the
21606 corresponding registers have been restricted via the -ffixed-reg or
21607 -mint-register command-line options.
21608
21609 S/390 and zSeries Options
21610
21611 These are the -m options defined for the S/390 and zSeries
21612 architecture.
21613
21614 -mhard-float
21615 -msoft-float
21616 Use (do not use) the hardware floating-point instructions and
21617 registers for floating-point operations. When -msoft-float is
21618 specified, functions in libgcc.a are used to perform floating-point
21619 operations. When -mhard-float is specified, the compiler generates
21620 IEEE floating-point instructions. This is the default.
21621
21622 -mhard-dfp
21623 -mno-hard-dfp
21624 Use (do not use) the hardware decimal-floating-point instructions
21625 for decimal-floating-point operations. When -mno-hard-dfp is
21626 specified, functions in libgcc.a are used to perform decimal-
21627 floating-point operations. When -mhard-dfp is specified, the
21628 compiler generates decimal-floating-point hardware instructions.
21629 This is the default for -march=z9-ec or higher.
21630
21631 -mlong-double-64
21632 -mlong-double-128
21633 These switches control the size of "long double" type. A size of 64
21634 bits makes the "long double" type equivalent to the "double" type.
21635 This is the default.
21636
21637 -mbackchain
21638 -mno-backchain
21639 Store (do not store) the address of the caller's frame as backchain
21640 pointer into the callee's stack frame. A backchain may be needed
21641 to allow debugging using tools that do not understand DWARF call
21642 frame information. When -mno-packed-stack is in effect, the
21643 backchain pointer is stored at the bottom of the stack frame; when
21644 -mpacked-stack is in effect, the backchain is placed into the
21645 topmost word of the 96/160 byte register save area.
21646
21647 In general, code compiled with -mbackchain is call-compatible with
21648 code compiled with -mmo-backchain; however, use of the backchain
21649 for debugging purposes usually requires that the whole binary is
21650 built with -mbackchain. Note that the combination of -mbackchain,
21651 -mpacked-stack and -mhard-float is not supported. In order to
21652 build a linux kernel use -msoft-float.
21653
21654 The default is to not maintain the backchain.
21655
21656 -mpacked-stack
21657 -mno-packed-stack
21658 Use (do not use) the packed stack layout. When -mno-packed-stack
21659 is specified, the compiler uses the all fields of the 96/160 byte
21660 register save area only for their default purpose; unused fields
21661 still take up stack space. When -mpacked-stack is specified,
21662 register save slots are densely packed at the top of the register
21663 save area; unused space is reused for other purposes, allowing for
21664 more efficient use of the available stack space. However, when
21665 -mbackchain is also in effect, the topmost word of the save area is
21666 always used to store the backchain, and the return address register
21667 is always saved two words below the backchain.
21668
21669 As long as the stack frame backchain is not used, code generated
21670 with -mpacked-stack is call-compatible with code generated with
21671 -mno-packed-stack. Note that some non-FSF releases of GCC 2.95 for
21672 S/390 or zSeries generated code that uses the stack frame backchain
21673 at run time, not just for debugging purposes. Such code is not
21674 call-compatible with code compiled with -mpacked-stack. Also, note
21675 that the combination of -mbackchain, -mpacked-stack and
21676 -mhard-float is not supported. In order to build a linux kernel
21677 use -msoft-float.
21678
21679 The default is to not use the packed stack layout.
21680
21681 -msmall-exec
21682 -mno-small-exec
21683 Generate (or do not generate) code using the "bras" instruction to
21684 do subroutine calls. This only works reliably if the total
21685 executable size does not exceed 64k. The default is to use the
21686 "basr" instruction instead, which does not have this limitation.
21687
21688 -m64
21689 -m31
21690 When -m31 is specified, generate code compliant to the GNU/Linux
21691 for S/390 ABI. When -m64 is specified, generate code compliant to
21692 the GNU/Linux for zSeries ABI. This allows GCC in particular to
21693 generate 64-bit instructions. For the s390 targets, the default is
21694 -m31, while the s390x targets default to -m64.
21695
21696 -mzarch
21697 -mesa
21698 When -mzarch is specified, generate code using the instructions
21699 available on z/Architecture. When -mesa is specified, generate
21700 code using the instructions available on ESA/390. Note that -mesa
21701 is not possible with -m64. When generating code compliant to the
21702 GNU/Linux for S/390 ABI, the default is -mesa. When generating
21703 code compliant to the GNU/Linux for zSeries ABI, the default is
21704 -mzarch.
21705
21706 -mhtm
21707 -mno-htm
21708 The -mhtm option enables a set of builtins making use of
21709 instructions available with the transactional execution facility
21710 introduced with the IBM zEnterprise EC12 machine generation S/390
21711 System z Built-in Functions. -mhtm is enabled by default when
21712 using -march=zEC12.
21713
21714 -mvx
21715 -mno-vx
21716 When -mvx is specified, generate code using the instructions
21717 available with the vector extension facility introduced with the
21718 IBM z13 machine generation. This option changes the ABI for some
21719 vector type values with regard to alignment and calling
21720 conventions. In case vector type values are being used in an ABI-
21721 relevant context a GAS .gnu_attribute command will be added to mark
21722 the resulting binary with the ABI used. -mvx is enabled by default
21723 when using -march=z13.
21724
21725 -mzvector
21726 -mno-zvector
21727 The -mzvector option enables vector language extensions and
21728 builtins using instructions available with the vector extension
21729 facility introduced with the IBM z13 machine generation. This
21730 option adds support for vector to be used as a keyword to define
21731 vector type variables and arguments. vector is only available when
21732 GNU extensions are enabled. It will not be expanded when
21733 requesting strict standard compliance e.g. with -std=c99. In
21734 addition to the GCC low-level builtins -mzvector enables a set of
21735 builtins added for compatibility with AltiVec-style implementations
21736 like Power and Cell. In order to make use of these builtins the
21737 header file vecintrin.h needs to be included. -mzvector is
21738 disabled by default.
21739
21740 -mmvcle
21741 -mno-mvcle
21742 Generate (or do not generate) code using the "mvcle" instruction to
21743 perform block moves. When -mno-mvcle is specified, use a "mvc"
21744 loop instead. This is the default unless optimizing for size.
21745
21746 -mdebug
21747 -mno-debug
21748 Print (or do not print) additional debug information when
21749 compiling. The default is to not print debug information.
21750
21751 -march=cpu-type
21752 Generate code that runs on cpu-type, which is the name of a system
21753 representing a certain processor type. Possible values for cpu-
21754 type are z900/arch5, z990/arch6, z9-109, z9-ec/arch7, z10/arch8,
21755 z196/arch9, zEC12, z13/arch11, z14/arch12, and native.
21756
21757 The default is -march=z900.
21758
21759 Specifying native as cpu type can be used to select the best
21760 architecture option for the host processor. -march=native has no
21761 effect if GCC does not recognize the processor.
21762
21763 -mtune=cpu-type
21764 Tune to cpu-type everything applicable about the generated code,
21765 except for the ABI and the set of available instructions. The list
21766 of cpu-type values is the same as for -march. The default is the
21767 value used for -march.
21768
21769 -mtpf-trace
21770 -mno-tpf-trace
21771 Generate code that adds (does not add) in TPF OS specific branches
21772 to trace routines in the operating system. This option is off by
21773 default, even when compiling for the TPF OS.
21774
21775 -mfused-madd
21776 -mno-fused-madd
21777 Generate code that uses (does not use) the floating-point multiply
21778 and accumulate instructions. These instructions are generated by
21779 default if hardware floating point is used.
21780
21781 -mwarn-framesize=framesize
21782 Emit a warning if the current function exceeds the given frame
21783 size. Because this is a compile-time check it doesn't need to be a
21784 real problem when the program runs. It is intended to identify
21785 functions that most probably cause a stack overflow. It is useful
21786 to be used in an environment with limited stack size e.g. the linux
21787 kernel.
21788
21789 -mwarn-dynamicstack
21790 Emit a warning if the function calls "alloca" or uses dynamically-
21791 sized arrays. This is generally a bad idea with a limited stack
21792 size.
21793
21794 -mstack-guard=stack-guard
21795 -mstack-size=stack-size
21796 If these options are provided the S/390 back end emits additional
21797 instructions in the function prologue that trigger a trap if the
21798 stack size is stack-guard bytes above the stack-size (remember that
21799 the stack on S/390 grows downward). If the stack-guard option is
21800 omitted the smallest power of 2 larger than the frame size of the
21801 compiled function is chosen. These options are intended to be used
21802 to help debugging stack overflow problems. The additionally
21803 emitted code causes only little overhead and hence can also be used
21804 in production-like systems without greater performance degradation.
21805 The given values have to be exact powers of 2 and stack-size has to
21806 be greater than stack-guard without exceeding 64k. In order to be
21807 efficient the extra code makes the assumption that the stack starts
21808 at an address aligned to the value given by stack-size. The stack-
21809 guard option can only be used in conjunction with stack-size.
21810
21811 -mhotpatch=pre-halfwords,post-halfwords
21812 If the hotpatch option is enabled, a "hot-patching" function
21813 prologue is generated for all functions in the compilation unit.
21814 The funtion label is prepended with the given number of two-byte
21815 NOP instructions (pre-halfwords, maximum 1000000). After the
21816 label, 2 * post-halfwords bytes are appended, using the largest NOP
21817 like instructions the architecture allows (maximum 1000000).
21818
21819 If both arguments are zero, hotpatching is disabled.
21820
21821 This option can be overridden for individual functions with the
21822 "hotpatch" attribute.
21823
21824 Score Options
21825
21826 These options are defined for Score implementations:
21827
21828 -meb
21829 Compile code for big-endian mode. This is the default.
21830
21831 -mel
21832 Compile code for little-endian mode.
21833
21834 -mnhwloop
21835 Disable generation of "bcnz" instructions.
21836
21837 -muls
21838 Enable generation of unaligned load and store instructions.
21839
21840 -mmac
21841 Enable the use of multiply-accumulate instructions. Disabled by
21842 default.
21843
21844 -mscore5
21845 Specify the SCORE5 as the target architecture.
21846
21847 -mscore5u
21848 Specify the SCORE5U of the target architecture.
21849
21850 -mscore7
21851 Specify the SCORE7 as the target architecture. This is the default.
21852
21853 -mscore7d
21854 Specify the SCORE7D as the target architecture.
21855
21856 SH Options
21857
21858 These -m options are defined for the SH implementations:
21859
21860 -m1 Generate code for the SH1.
21861
21862 -m2 Generate code for the SH2.
21863
21864 -m2e
21865 Generate code for the SH2e.
21866
21867 -m2a-nofpu
21868 Generate code for the SH2a without FPU, or for a SH2a-FPU in such a
21869 way that the floating-point unit is not used.
21870
21871 -m2a-single-only
21872 Generate code for the SH2a-FPU, in such a way that no double-
21873 precision floating-point operations are used.
21874
21875 -m2a-single
21876 Generate code for the SH2a-FPU assuming the floating-point unit is
21877 in single-precision mode by default.
21878
21879 -m2a
21880 Generate code for the SH2a-FPU assuming the floating-point unit is
21881 in double-precision mode by default.
21882
21883 -m3 Generate code for the SH3.
21884
21885 -m3e
21886 Generate code for the SH3e.
21887
21888 -m4-nofpu
21889 Generate code for the SH4 without a floating-point unit.
21890
21891 -m4-single-only
21892 Generate code for the SH4 with a floating-point unit that only
21893 supports single-precision arithmetic.
21894
21895 -m4-single
21896 Generate code for the SH4 assuming the floating-point unit is in
21897 single-precision mode by default.
21898
21899 -m4 Generate code for the SH4.
21900
21901 -m4-100
21902 Generate code for SH4-100.
21903
21904 -m4-100-nofpu
21905 Generate code for SH4-100 in such a way that the floating-point
21906 unit is not used.
21907
21908 -m4-100-single
21909 Generate code for SH4-100 assuming the floating-point unit is in
21910 single-precision mode by default.
21911
21912 -m4-100-single-only
21913 Generate code for SH4-100 in such a way that no double-precision
21914 floating-point operations are used.
21915
21916 -m4-200
21917 Generate code for SH4-200.
21918
21919 -m4-200-nofpu
21920 Generate code for SH4-200 without in such a way that the floating-
21921 point unit is not used.
21922
21923 -m4-200-single
21924 Generate code for SH4-200 assuming the floating-point unit is in
21925 single-precision mode by default.
21926
21927 -m4-200-single-only
21928 Generate code for SH4-200 in such a way that no double-precision
21929 floating-point operations are used.
21930
21931 -m4-300
21932 Generate code for SH4-300.
21933
21934 -m4-300-nofpu
21935 Generate code for SH4-300 without in such a way that the floating-
21936 point unit is not used.
21937
21938 -m4-300-single
21939 Generate code for SH4-300 in such a way that no double-precision
21940 floating-point operations are used.
21941
21942 -m4-300-single-only
21943 Generate code for SH4-300 in such a way that no double-precision
21944 floating-point operations are used.
21945
21946 -m4-340
21947 Generate code for SH4-340 (no MMU, no FPU).
21948
21949 -m4-500
21950 Generate code for SH4-500 (no FPU). Passes -isa=sh4-nofpu to the
21951 assembler.
21952
21953 -m4a-nofpu
21954 Generate code for the SH4al-dsp, or for a SH4a in such a way that
21955 the floating-point unit is not used.
21956
21957 -m4a-single-only
21958 Generate code for the SH4a, in such a way that no double-precision
21959 floating-point operations are used.
21960
21961 -m4a-single
21962 Generate code for the SH4a assuming the floating-point unit is in
21963 single-precision mode by default.
21964
21965 -m4a
21966 Generate code for the SH4a.
21967
21968 -m4al
21969 Same as -m4a-nofpu, except that it implicitly passes -dsp to the
21970 assembler. GCC doesn't generate any DSP instructions at the
21971 moment.
21972
21973 -mb Compile code for the processor in big-endian mode.
21974
21975 -ml Compile code for the processor in little-endian mode.
21976
21977 -mdalign
21978 Align doubles at 64-bit boundaries. Note that this changes the
21979 calling conventions, and thus some functions from the standard C
21980 library do not work unless you recompile it first with -mdalign.
21981
21982 -mrelax
21983 Shorten some address references at link time, when possible; uses
21984 the linker option -relax.
21985
21986 -mbigtable
21987 Use 32-bit offsets in "switch" tables. The default is to use
21988 16-bit offsets.
21989
21990 -mbitops
21991 Enable the use of bit manipulation instructions on SH2A.
21992
21993 -mfmovd
21994 Enable the use of the instruction "fmovd". Check -mdalign for
21995 alignment constraints.
21996
21997 -mrenesas
21998 Comply with the calling conventions defined by Renesas.
21999
22000 -mno-renesas
22001 Comply with the calling conventions defined for GCC before the
22002 Renesas conventions were available. This option is the default for
22003 all targets of the SH toolchain.
22004
22005 -mnomacsave
22006 Mark the "MAC" register as call-clobbered, even if -mrenesas is
22007 given.
22008
22009 -mieee
22010 -mno-ieee
22011 Control the IEEE compliance of floating-point comparisons, which
22012 affects the handling of cases where the result of a comparison is
22013 unordered. By default -mieee is implicitly enabled. If
22014 -ffinite-math-only is enabled -mno-ieee is implicitly set, which
22015 results in faster floating-point greater-equal and less-equal
22016 comparisons. The implicit settings can be overridden by specifying
22017 either -mieee or -mno-ieee.
22018
22019 -minline-ic_invalidate
22020 Inline code to invalidate instruction cache entries after setting
22021 up nested function trampolines. This option has no effect if
22022 -musermode is in effect and the selected code generation option
22023 (e.g. -m4) does not allow the use of the "icbi" instruction. If
22024 the selected code generation option does not allow the use of the
22025 "icbi" instruction, and -musermode is not in effect, the inlined
22026 code manipulates the instruction cache address array directly with
22027 an associative write. This not only requires privileged mode at
22028 run time, but it also fails if the cache line had been mapped via
22029 the TLB and has become unmapped.
22030
22031 -misize
22032 Dump instruction size and location in the assembly code.
22033
22034 -mpadstruct
22035 This option is deprecated. It pads structures to multiple of 4
22036 bytes, which is incompatible with the SH ABI.
22037
22038 -matomic-model=model
22039 Sets the model of atomic operations and additional parameters as a
22040 comma separated list. For details on the atomic built-in functions
22041 see __atomic Builtins. The following models and parameters are
22042 supported:
22043
22044 none
22045 Disable compiler generated atomic sequences and emit library
22046 calls for atomic operations. This is the default if the target
22047 is not "sh*-*-linux*".
22048
22049 soft-gusa
22050 Generate GNU/Linux compatible gUSA software atomic sequences
22051 for the atomic built-in functions. The generated atomic
22052 sequences require additional support from the
22053 interrupt/exception handling code of the system and are only
22054 suitable for SH3* and SH4* single-core systems. This option is
22055 enabled by default when the target is "sh*-*-linux*" and SH3*
22056 or SH4*. When the target is SH4A, this option also partially
22057 utilizes the hardware atomic instructions "movli.l" and
22058 "movco.l" to create more efficient code, unless strict is
22059 specified.
22060
22061 soft-tcb
22062 Generate software atomic sequences that use a variable in the
22063 thread control block. This is a variation of the gUSA
22064 sequences which can also be used on SH1* and SH2* targets. The
22065 generated atomic sequences require additional support from the
22066 interrupt/exception handling code of the system and are only
22067 suitable for single-core systems. When using this model, the
22068 gbr-offset= parameter has to be specified as well.
22069
22070 soft-imask
22071 Generate software atomic sequences that temporarily disable
22072 interrupts by setting "SR.IMASK = 1111". This model works only
22073 when the program runs in privileged mode and is only suitable
22074 for single-core systems. Additional support from the
22075 interrupt/exception handling code of the system is not
22076 required. This model is enabled by default when the target is
22077 "sh*-*-linux*" and SH1* or SH2*.
22078
22079 hard-llcs
22080 Generate hardware atomic sequences using the "movli.l" and
22081 "movco.l" instructions only. This is only available on SH4A
22082 and is suitable for multi-core systems. Since the hardware
22083 instructions support only 32 bit atomic variables access to 8
22084 or 16 bit variables is emulated with 32 bit accesses. Code
22085 compiled with this option is also compatible with other
22086 software atomic model interrupt/exception handling systems if
22087 executed on an SH4A system. Additional support from the
22088 interrupt/exception handling code of the system is not required
22089 for this model.
22090
22091 gbr-offset=
22092 This parameter specifies the offset in bytes of the variable in
22093 the thread control block structure that should be used by the
22094 generated atomic sequences when the soft-tcb model has been
22095 selected. For other models this parameter is ignored. The
22096 specified value must be an integer multiple of four and in the
22097 range 0-1020.
22098
22099 strict
22100 This parameter prevents mixed usage of multiple atomic models,
22101 even if they are compatible, and makes the compiler generate
22102 atomic sequences of the specified model only.
22103
22104 -mtas
22105 Generate the "tas.b" opcode for "__atomic_test_and_set". Notice
22106 that depending on the particular hardware and software
22107 configuration this can degrade overall performance due to the
22108 operand cache line flushes that are implied by the "tas.b"
22109 instruction. On multi-core SH4A processors the "tas.b" instruction
22110 must be used with caution since it can result in data corruption
22111 for certain cache configurations.
22112
22113 -mprefergot
22114 When generating position-independent code, emit function calls
22115 using the Global Offset Table instead of the Procedure Linkage
22116 Table.
22117
22118 -musermode
22119 -mno-usermode
22120 Don't allow (allow) the compiler generating privileged mode code.
22121 Specifying -musermode also implies -mno-inline-ic_invalidate if the
22122 inlined code would not work in user mode. -musermode is the
22123 default when the target is "sh*-*-linux*". If the target is SH1*
22124 or SH2* -musermode has no effect, since there is no user mode.
22125
22126 -multcost=number
22127 Set the cost to assume for a multiply insn.
22128
22129 -mdiv=strategy
22130 Set the division strategy to be used for integer division
22131 operations. strategy can be one of:
22132
22133 call-div1
22134 Calls a library function that uses the single-step division
22135 instruction "div1" to perform the operation. Division by zero
22136 calculates an unspecified result and does not trap. This is
22137 the default except for SH4, SH2A and SHcompact.
22138
22139 call-fp
22140 Calls a library function that performs the operation in double
22141 precision floating point. Division by zero causes a floating-
22142 point exception. This is the default for SHcompact with FPU.
22143 Specifying this for targets that do not have a double precision
22144 FPU defaults to "call-div1".
22145
22146 call-table
22147 Calls a library function that uses a lookup table for small
22148 divisors and the "div1" instruction with case distinction for
22149 larger divisors. Division by zero calculates an unspecified
22150 result and does not trap. This is the default for SH4.
22151 Specifying this for targets that do not have dynamic shift
22152 instructions defaults to "call-div1".
22153
22154 When a division strategy has not been specified the default
22155 strategy is selected based on the current target. For SH2A the
22156 default strategy is to use the "divs" and "divu" instructions
22157 instead of library function calls.
22158
22159 -maccumulate-outgoing-args
22160 Reserve space once for outgoing arguments in the function prologue
22161 rather than around each call. Generally beneficial for performance
22162 and size. Also needed for unwinding to avoid changing the stack
22163 frame around conditional code.
22164
22165 -mdivsi3_libfunc=name
22166 Set the name of the library function used for 32-bit signed
22167 division to name. This only affects the name used in the call
22168 division strategies, and the compiler still expects the same sets
22169 of input/output/clobbered registers as if this option were not
22170 present.
22171
22172 -mfixed-range=register-range
22173 Generate code treating the given register range as fixed registers.
22174 A fixed register is one that the register allocator cannot use.
22175 This is useful when compiling kernel code. A register range is
22176 specified as two registers separated by a dash. Multiple register
22177 ranges can be specified separated by a comma.
22178
22179 -mbranch-cost=num
22180 Assume num to be the cost for a branch instruction. Higher numbers
22181 make the compiler try to generate more branch-free code if
22182 possible. If not specified the value is selected depending on the
22183 processor type that is being compiled for.
22184
22185 -mzdcbranch
22186 -mno-zdcbranch
22187 Assume (do not assume) that zero displacement conditional branch
22188 instructions "bt" and "bf" are fast. If -mzdcbranch is specified,
22189 the compiler prefers zero displacement branch code sequences. This
22190 is enabled by default when generating code for SH4 and SH4A. It
22191 can be explicitly disabled by specifying -mno-zdcbranch.
22192
22193 -mcbranch-force-delay-slot
22194 Force the usage of delay slots for conditional branches, which
22195 stuffs the delay slot with a "nop" if a suitable instruction cannot
22196 be found. By default this option is disabled. It can be enabled
22197 to work around hardware bugs as found in the original SH7055.
22198
22199 -mfused-madd
22200 -mno-fused-madd
22201 Generate code that uses (does not use) the floating-point multiply
22202 and accumulate instructions. These instructions are generated by
22203 default if hardware floating point is used. The machine-dependent
22204 -mfused-madd option is now mapped to the machine-independent
22205 -ffp-contract=fast option, and -mno-fused-madd is mapped to
22206 -ffp-contract=off.
22207
22208 -mfsca
22209 -mno-fsca
22210 Allow or disallow the compiler to emit the "fsca" instruction for
22211 sine and cosine approximations. The option -mfsca must be used in
22212 combination with -funsafe-math-optimizations. It is enabled by
22213 default when generating code for SH4A. Using -mno-fsca disables
22214 sine and cosine approximations even if -funsafe-math-optimizations
22215 is in effect.
22216
22217 -mfsrra
22218 -mno-fsrra
22219 Allow or disallow the compiler to emit the "fsrra" instruction for
22220 reciprocal square root approximations. The option -mfsrra must be
22221 used in combination with -funsafe-math-optimizations and
22222 -ffinite-math-only. It is enabled by default when generating code
22223 for SH4A. Using -mno-fsrra disables reciprocal square root
22224 approximations even if -funsafe-math-optimizations and
22225 -ffinite-math-only are in effect.
22226
22227 -mpretend-cmove
22228 Prefer zero-displacement conditional branches for conditional move
22229 instruction patterns. This can result in faster code on the SH4
22230 processor.
22231
22232 -mfdpic
22233 Generate code using the FDPIC ABI.
22234
22235 Solaris 2 Options
22236
22237 These -m options are supported on Solaris 2:
22238
22239 -mclear-hwcap
22240 -mclear-hwcap tells the compiler to remove the hardware
22241 capabilities generated by the Solaris assembler. This is only
22242 necessary when object files use ISA extensions not supported by the
22243 current machine, but check at runtime whether or not to use them.
22244
22245 -mimpure-text
22246 -mimpure-text, used in addition to -shared, tells the compiler to
22247 not pass -z text to the linker when linking a shared object. Using
22248 this option, you can link position-dependent code into a shared
22249 object.
22250
22251 -mimpure-text suppresses the "relocations remain against
22252 allocatable but non-writable sections" linker error message.
22253 However, the necessary relocations trigger copy-on-write, and the
22254 shared object is not actually shared across processes. Instead of
22255 using -mimpure-text, you should compile all source code with -fpic
22256 or -fPIC.
22257
22258 These switches are supported in addition to the above on Solaris 2:
22259
22260 -pthreads
22261 This is a synonym for -pthread.
22262
22263 SPARC Options
22264
22265 These -m options are supported on the SPARC:
22266
22267 -mno-app-regs
22268 -mapp-regs
22269 Specify -mapp-regs to generate output using the global registers 2
22270 through 4, which the SPARC SVR4 ABI reserves for applications.
22271 Like the global register 1, each global register 2 through 4 is
22272 then treated as an allocable register that is clobbered by function
22273 calls. This is the default.
22274
22275 To be fully SVR4 ABI-compliant at the cost of some performance
22276 loss, specify -mno-app-regs. You should compile libraries and
22277 system software with this option.
22278
22279 -mflat
22280 -mno-flat
22281 With -mflat, the compiler does not generate save/restore
22282 instructions and uses a "flat" or single register window model.
22283 This model is compatible with the regular register window model.
22284 The local registers and the input registers (0--5) are still
22285 treated as "call-saved" registers and are saved on the stack as
22286 needed.
22287
22288 With -mno-flat (the default), the compiler generates save/restore
22289 instructions (except for leaf functions). This is the normal
22290 operating mode.
22291
22292 -mfpu
22293 -mhard-float
22294 Generate output containing floating-point instructions. This is
22295 the default.
22296
22297 -mno-fpu
22298 -msoft-float
22299 Generate output containing library calls for floating point.
22300 Warning: the requisite libraries are not available for all SPARC
22301 targets. Normally the facilities of the machine's usual C compiler
22302 are used, but this cannot be done directly in cross-compilation.
22303 You must make your own arrangements to provide suitable library
22304 functions for cross-compilation. The embedded targets sparc-*-aout
22305 and sparclite-*-* do provide software floating-point support.
22306
22307 -msoft-float changes the calling convention in the output file;
22308 therefore, it is only useful if you compile all of a program with
22309 this option. In particular, you need to compile libgcc.a, the
22310 library that comes with GCC, with -msoft-float in order for this to
22311 work.
22312
22313 -mhard-quad-float
22314 Generate output containing quad-word (long double) floating-point
22315 instructions.
22316
22317 -msoft-quad-float
22318 Generate output containing library calls for quad-word (long
22319 double) floating-point instructions. The functions called are
22320 those specified in the SPARC ABI. This is the default.
22321
22322 As of this writing, there are no SPARC implementations that have
22323 hardware support for the quad-word floating-point instructions.
22324 They all invoke a trap handler for one of these instructions, and
22325 then the trap handler emulates the effect of the instruction.
22326 Because of the trap handler overhead, this is much slower than
22327 calling the ABI library routines. Thus the -msoft-quad-float
22328 option is the default.
22329
22330 -mno-unaligned-doubles
22331 -munaligned-doubles
22332 Assume that doubles have 8-byte alignment. This is the default.
22333
22334 With -munaligned-doubles, GCC assumes that doubles have 8-byte
22335 alignment only if they are contained in another type, or if they
22336 have an absolute address. Otherwise, it assumes they have 4-byte
22337 alignment. Specifying this option avoids some rare compatibility
22338 problems with code generated by other compilers. It is not the
22339 default because it results in a performance loss, especially for
22340 floating-point code.
22341
22342 -muser-mode
22343 -mno-user-mode
22344 Do not generate code that can only run in supervisor mode. This is
22345 relevant only for the "casa" instruction emitted for the LEON3
22346 processor. This is the default.
22347
22348 -mfaster-structs
22349 -mno-faster-structs
22350 With -mfaster-structs, the compiler assumes that structures should
22351 have 8-byte alignment. This enables the use of pairs of "ldd" and
22352 "std" instructions for copies in structure assignment, in place of
22353 twice as many "ld" and "st" pairs. However, the use of this
22354 changed alignment directly violates the SPARC ABI. Thus, it's
22355 intended only for use on targets where the developer acknowledges
22356 that their resulting code is not directly in line with the rules of
22357 the ABI.
22358
22359 -mstd-struct-return
22360 -mno-std-struct-return
22361 With -mstd-struct-return, the compiler generates checking code in
22362 functions returning structures or unions to detect size mismatches
22363 between the two sides of function calls, as per the 32-bit ABI.
22364
22365 The default is -mno-std-struct-return. This option has no effect
22366 in 64-bit mode.
22367
22368 -mlra
22369 -mno-lra
22370 Enable Local Register Allocation. This is the default for SPARC
22371 since GCC 7 so -mno-lra needs to be passed to get old Reload.
22372
22373 -mcpu=cpu_type
22374 Set the instruction set, register set, and instruction scheduling
22375 parameters for machine type cpu_type. Supported values for
22376 cpu_type are v7, cypress, v8, supersparc, hypersparc, leon, leon3,
22377 leon3v7, sparclite, f930, f934, sparclite86x, sparclet, tsc701, v9,
22378 ultrasparc, ultrasparc3, niagara, niagara2, niagara3, niagara4,
22379 niagara7 and m8.
22380
22381 Native Solaris and GNU/Linux toolchains also support the value
22382 native, which selects the best architecture option for the host
22383 processor. -mcpu=native has no effect if GCC does not recognize
22384 the processor.
22385
22386 Default instruction scheduling parameters are used for values that
22387 select an architecture and not an implementation. These are v7,
22388 v8, sparclite, sparclet, v9.
22389
22390 Here is a list of each supported architecture and their supported
22391 implementations.
22392
22393 v7 cypress, leon3v7
22394
22395 v8 supersparc, hypersparc, leon, leon3
22396
22397 sparclite
22398 f930, f934, sparclite86x
22399
22400 sparclet
22401 tsc701
22402
22403 v9 ultrasparc, ultrasparc3, niagara, niagara2, niagara3, niagara4,
22404 niagara7, m8
22405
22406 By default (unless configured otherwise), GCC generates code for
22407 the V7 variant of the SPARC architecture. With -mcpu=cypress, the
22408 compiler additionally optimizes it for the Cypress CY7C602 chip, as
22409 used in the SPARCStation/SPARCServer 3xx series. This is also
22410 appropriate for the older SPARCStation 1, 2, IPX etc.
22411
22412 With -mcpu=v8, GCC generates code for the V8 variant of the SPARC
22413 architecture. The only difference from V7 code is that the
22414 compiler emits the integer multiply and integer divide instructions
22415 which exist in SPARC-V8 but not in SPARC-V7. With
22416 -mcpu=supersparc, the compiler additionally optimizes it for the
22417 SuperSPARC chip, as used in the SPARCStation 10, 1000 and 2000
22418 series.
22419
22420 With -mcpu=sparclite, GCC generates code for the SPARClite variant
22421 of the SPARC architecture. This adds the integer multiply, integer
22422 divide step and scan ("ffs") instructions which exist in SPARClite
22423 but not in SPARC-V7. With -mcpu=f930, the compiler additionally
22424 optimizes it for the Fujitsu MB86930 chip, which is the original
22425 SPARClite, with no FPU. With -mcpu=f934, the compiler additionally
22426 optimizes it for the Fujitsu MB86934 chip, which is the more recent
22427 SPARClite with FPU.
22428
22429 With -mcpu=sparclet, GCC generates code for the SPARClet variant of
22430 the SPARC architecture. This adds the integer multiply,
22431 multiply/accumulate, integer divide step and scan ("ffs")
22432 instructions which exist in SPARClet but not in SPARC-V7. With
22433 -mcpu=tsc701, the compiler additionally optimizes it for the TEMIC
22434 SPARClet chip.
22435
22436 With -mcpu=v9, GCC generates code for the V9 variant of the SPARC
22437 architecture. This adds 64-bit integer and floating-point move
22438 instructions, 3 additional floating-point condition code registers
22439 and conditional move instructions. With -mcpu=ultrasparc, the
22440 compiler additionally optimizes it for the Sun UltraSPARC I/II/IIi
22441 chips. With -mcpu=ultrasparc3, the compiler additionally optimizes
22442 it for the Sun UltraSPARC III/III+/IIIi/IIIi+/IV/IV+ chips. With
22443 -mcpu=niagara, the compiler additionally optimizes it for Sun
22444 UltraSPARC T1 chips. With -mcpu=niagara2, the compiler
22445 additionally optimizes it for Sun UltraSPARC T2 chips. With
22446 -mcpu=niagara3, the compiler additionally optimizes it for Sun
22447 UltraSPARC T3 chips. With -mcpu=niagara4, the compiler
22448 additionally optimizes it for Sun UltraSPARC T4 chips. With
22449 -mcpu=niagara7, the compiler additionally optimizes it for Oracle
22450 SPARC M7 chips. With -mcpu=m8, the compiler additionally optimizes
22451 it for Oracle M8 chips.
22452
22453 -mtune=cpu_type
22454 Set the instruction scheduling parameters for machine type
22455 cpu_type, but do not set the instruction set or register set that
22456 the option -mcpu=cpu_type does.
22457
22458 The same values for -mcpu=cpu_type can be used for -mtune=cpu_type,
22459 but the only useful values are those that select a particular CPU
22460 implementation. Those are cypress, supersparc, hypersparc, leon,
22461 leon3, leon3v7, f930, f934, sparclite86x, tsc701, ultrasparc,
22462 ultrasparc3, niagara, niagara2, niagara3, niagara4, niagara7 and
22463 m8. With native Solaris and GNU/Linux toolchains, native can also
22464 be used.
22465
22466 -mv8plus
22467 -mno-v8plus
22468 With -mv8plus, GCC generates code for the SPARC-V8+ ABI. The
22469 difference from the V8 ABI is that the global and out registers are
22470 considered 64 bits wide. This is enabled by default on Solaris in
22471 32-bit mode for all SPARC-V9 processors.
22472
22473 -mvis
22474 -mno-vis
22475 With -mvis, GCC generates code that takes advantage of the
22476 UltraSPARC Visual Instruction Set extensions. The default is
22477 -mno-vis.
22478
22479 -mvis2
22480 -mno-vis2
22481 With -mvis2, GCC generates code that takes advantage of version 2.0
22482 of the UltraSPARC Visual Instruction Set extensions. The default
22483 is -mvis2 when targeting a cpu that supports such instructions,
22484 such as UltraSPARC-III and later. Setting -mvis2 also sets -mvis.
22485
22486 -mvis3
22487 -mno-vis3
22488 With -mvis3, GCC generates code that takes advantage of version 3.0
22489 of the UltraSPARC Visual Instruction Set extensions. The default
22490 is -mvis3 when targeting a cpu that supports such instructions,
22491 such as niagara-3 and later. Setting -mvis3 also sets -mvis2 and
22492 -mvis.
22493
22494 -mvis4
22495 -mno-vis4
22496 With -mvis4, GCC generates code that takes advantage of version 4.0
22497 of the UltraSPARC Visual Instruction Set extensions. The default
22498 is -mvis4 when targeting a cpu that supports such instructions,
22499 such as niagara-7 and later. Setting -mvis4 also sets -mvis3,
22500 -mvis2 and -mvis.
22501
22502 -mvis4b
22503 -mno-vis4b
22504 With -mvis4b, GCC generates code that takes advantage of version
22505 4.0 of the UltraSPARC Visual Instruction Set extensions, plus the
22506 additional VIS instructions introduced in the Oracle SPARC
22507 Architecture 2017. The default is -mvis4b when targeting a cpu
22508 that supports such instructions, such as m8 and later. Setting
22509 -mvis4b also sets -mvis4, -mvis3, -mvis2 and -mvis.
22510
22511 -mcbcond
22512 -mno-cbcond
22513 With -mcbcond, GCC generates code that takes advantage of the
22514 UltraSPARC Compare-and-Branch-on-Condition instructions. The
22515 default is -mcbcond when targeting a CPU that supports such
22516 instructions, such as Niagara-4 and later.
22517
22518 -mfmaf
22519 -mno-fmaf
22520 With -mfmaf, GCC generates code that takes advantage of the
22521 UltraSPARC Fused Multiply-Add Floating-point instructions. The
22522 default is -mfmaf when targeting a CPU that supports such
22523 instructions, such as Niagara-3 and later.
22524
22525 -mfsmuld
22526 -mno-fsmuld
22527 With -mfsmuld, GCC generates code that takes advantage of the
22528 Floating-point Multiply Single to Double (FsMULd) instruction. The
22529 default is -mfsmuld when targeting a CPU supporting the
22530 architecture versions V8 or V9 with FPU except -mcpu=leon.
22531
22532 -mpopc
22533 -mno-popc
22534 With -mpopc, GCC generates code that takes advantage of the
22535 UltraSPARC Population Count instruction. The default is -mpopc
22536 when targeting a CPU that supports such an instruction, such as
22537 Niagara-2 and later.
22538
22539 -msubxc
22540 -mno-subxc
22541 With -msubxc, GCC generates code that takes advantage of the
22542 UltraSPARC Subtract-Extended-with-Carry instruction. The default
22543 is -msubxc when targeting a CPU that supports such an instruction,
22544 such as Niagara-7 and later.
22545
22546 -mfix-at697f
22547 Enable the documented workaround for the single erratum of the
22548 Atmel AT697F processor (which corresponds to erratum #13 of the
22549 AT697E processor).
22550
22551 -mfix-ut699
22552 Enable the documented workarounds for the floating-point errata and
22553 the data cache nullify errata of the UT699 processor.
22554
22555 -mfix-ut700
22556 Enable the documented workaround for the back-to-back store errata
22557 of the UT699E/UT700 processor.
22558
22559 -mfix-gr712rc
22560 Enable the documented workaround for the back-to-back store errata
22561 of the GR712RC processor.
22562
22563 These -m options are supported in addition to the above on SPARC-V9
22564 processors in 64-bit environments:
22565
22566 -m32
22567 -m64
22568 Generate code for a 32-bit or 64-bit environment. The 32-bit
22569 environment sets int, long and pointer to 32 bits. The 64-bit
22570 environment sets int to 32 bits and long and pointer to 64 bits.
22571
22572 -mcmodel=which
22573 Set the code model to one of
22574
22575 medlow
22576 The Medium/Low code model: 64-bit addresses, programs must be
22577 linked in the low 32 bits of memory. Programs can be
22578 statically or dynamically linked.
22579
22580 medmid
22581 The Medium/Middle code model: 64-bit addresses, programs must
22582 be linked in the low 44 bits of memory, the text and data
22583 segments must be less than 2GB in size and the data segment
22584 must be located within 2GB of the text segment.
22585
22586 medany
22587 The Medium/Anywhere code model: 64-bit addresses, programs may
22588 be linked anywhere in memory, the text and data segments must
22589 be less than 2GB in size and the data segment must be located
22590 within 2GB of the text segment.
22591
22592 embmedany
22593 The Medium/Anywhere code model for embedded systems: 64-bit
22594 addresses, the text and data segments must be less than 2GB in
22595 size, both starting anywhere in memory (determined at link
22596 time). The global register %g4 points to the base of the data
22597 segment. Programs are statically linked and PIC is not
22598 supported.
22599
22600 -mmemory-model=mem-model
22601 Set the memory model in force on the processor to one of
22602
22603 default
22604 The default memory model for the processor and operating
22605 system.
22606
22607 rmo Relaxed Memory Order
22608
22609 pso Partial Store Order
22610
22611 tso Total Store Order
22612
22613 sc Sequential Consistency
22614
22615 These memory models are formally defined in Appendix D of the
22616 SPARC-V9 architecture manual, as set in the processor's "PSTATE.MM"
22617 field.
22618
22619 -mstack-bias
22620 -mno-stack-bias
22621 With -mstack-bias, GCC assumes that the stack pointer, and frame
22622 pointer if present, are offset by -2047 which must be added back
22623 when making stack frame references. This is the default in 64-bit
22624 mode. Otherwise, assume no such offset is present.
22625
22626 SPU Options
22627
22628 These -m options are supported on the SPU:
22629
22630 -mwarn-reloc
22631 -merror-reloc
22632 The loader for SPU does not handle dynamic relocations. By
22633 default, GCC gives an error when it generates code that requires a
22634 dynamic relocation. -mno-error-reloc disables the error,
22635 -mwarn-reloc generates a warning instead.
22636
22637 -msafe-dma
22638 -munsafe-dma
22639 Instructions that initiate or test completion of DMA must not be
22640 reordered with respect to loads and stores of the memory that is
22641 being accessed. With -munsafe-dma you must use the "volatile"
22642 keyword to protect memory accesses, but that can lead to
22643 inefficient code in places where the memory is known to not change.
22644 Rather than mark the memory as volatile, you can use -msafe-dma to
22645 tell the compiler to treat the DMA instructions as potentially
22646 affecting all memory.
22647
22648 -mbranch-hints
22649 By default, GCC generates a branch hint instruction to avoid
22650 pipeline stalls for always-taken or probably-taken branches. A
22651 hint is not generated closer than 8 instructions away from its
22652 branch. There is little reason to disable them, except for
22653 debugging purposes, or to make an object a little bit smaller.
22654
22655 -msmall-mem
22656 -mlarge-mem
22657 By default, GCC generates code assuming that addresses are never
22658 larger than 18 bits. With -mlarge-mem code is generated that
22659 assumes a full 32-bit address.
22660
22661 -mstdmain
22662 By default, GCC links against startup code that assumes the SPU-
22663 style main function interface (which has an unconventional
22664 parameter list). With -mstdmain, GCC links your program against
22665 startup code that assumes a C99-style interface to "main",
22666 including a local copy of "argv" strings.
22667
22668 -mfixed-range=register-range
22669 Generate code treating the given register range as fixed registers.
22670 A fixed register is one that the register allocator cannot use.
22671 This is useful when compiling kernel code. A register range is
22672 specified as two registers separated by a dash. Multiple register
22673 ranges can be specified separated by a comma.
22674
22675 -mea32
22676 -mea64
22677 Compile code assuming that pointers to the PPU address space
22678 accessed via the "__ea" named address space qualifier are either 32
22679 or 64 bits wide. The default is 32 bits. As this is an ABI-
22680 changing option, all object code in an executable must be compiled
22681 with the same setting.
22682
22683 -maddress-space-conversion
22684 -mno-address-space-conversion
22685 Allow/disallow treating the "__ea" address space as superset of the
22686 generic address space. This enables explicit type casts between
22687 "__ea" and generic pointer as well as implicit conversions of
22688 generic pointers to "__ea" pointers. The default is to allow
22689 address space pointer conversions.
22690
22691 -mcache-size=cache-size
22692 This option controls the version of libgcc that the compiler links
22693 to an executable and selects a software-managed cache for accessing
22694 variables in the "__ea" address space with a particular cache size.
22695 Possible options for cache-size are 8, 16, 32, 64 and 128. The
22696 default cache size is 64KB.
22697
22698 -matomic-updates
22699 -mno-atomic-updates
22700 This option controls the version of libgcc that the compiler links
22701 to an executable and selects whether atomic updates to the
22702 software-managed cache of PPU-side variables are used. If you use
22703 atomic updates, changes to a PPU variable from SPU code using the
22704 "__ea" named address space qualifier do not interfere with changes
22705 to other PPU variables residing in the same cache line from PPU
22706 code. If you do not use atomic updates, such interference may
22707 occur; however, writing back cache lines is more efficient. The
22708 default behavior is to use atomic updates.
22709
22710 -mdual-nops
22711 -mdual-nops=n
22712 By default, GCC inserts NOPs to increase dual issue when it expects
22713 it to increase performance. n can be a value from 0 to 10. A
22714 smaller n inserts fewer NOPs. 10 is the default, 0 is the same as
22715 -mno-dual-nops. Disabled with -Os.
22716
22717 -mhint-max-nops=n
22718 Maximum number of NOPs to insert for a branch hint. A branch hint
22719 must be at least 8 instructions away from the branch it is
22720 affecting. GCC inserts up to n NOPs to enforce this, otherwise it
22721 does not generate the branch hint.
22722
22723 -mhint-max-distance=n
22724 The encoding of the branch hint instruction limits the hint to be
22725 within 256 instructions of the branch it is affecting. By default,
22726 GCC makes sure it is within 125.
22727
22728 -msafe-hints
22729 Work around a hardware bug that causes the SPU to stall
22730 indefinitely. By default, GCC inserts the "hbrp" instruction to
22731 make sure this stall won't happen.
22732
22733 Options for System V
22734
22735 These additional options are available on System V Release 4 for
22736 compatibility with other compilers on those systems:
22737
22738 -G Create a shared object. It is recommended that -symbolic or
22739 -shared be used instead.
22740
22741 -Qy Identify the versions of each tool used by the compiler, in a
22742 ".ident" assembler directive in the output.
22743
22744 -Qn Refrain from adding ".ident" directives to the output file (this is
22745 the default).
22746
22747 -YP,dirs
22748 Search the directories dirs, and no others, for libraries specified
22749 with -l.
22750
22751 -Ym,dir
22752 Look in the directory dir to find the M4 preprocessor. The
22753 assembler uses this option.
22754
22755 TILE-Gx Options
22756
22757 These -m options are supported on the TILE-Gx:
22758
22759 -mcmodel=small
22760 Generate code for the small model. The distance for direct calls
22761 is limited to 500M in either direction. PC-relative addresses are
22762 32 bits. Absolute addresses support the full address range.
22763
22764 -mcmodel=large
22765 Generate code for the large model. There is no limitation on call
22766 distance, pc-relative addresses, or absolute addresses.
22767
22768 -mcpu=name
22769 Selects the type of CPU to be targeted. Currently the only
22770 supported type is tilegx.
22771
22772 -m32
22773 -m64
22774 Generate code for a 32-bit or 64-bit environment. The 32-bit
22775 environment sets int, long, and pointer to 32 bits. The 64-bit
22776 environment sets int to 32 bits and long and pointer to 64 bits.
22777
22778 -mbig-endian
22779 -mlittle-endian
22780 Generate code in big/little endian mode, respectively.
22781
22782 TILEPro Options
22783
22784 These -m options are supported on the TILEPro:
22785
22786 -mcpu=name
22787 Selects the type of CPU to be targeted. Currently the only
22788 supported type is tilepro.
22789
22790 -m32
22791 Generate code for a 32-bit environment, which sets int, long, and
22792 pointer to 32 bits. This is the only supported behavior so the
22793 flag is essentially ignored.
22794
22795 V850 Options
22796
22797 These -m options are defined for V850 implementations:
22798
22799 -mlong-calls
22800 -mno-long-calls
22801 Treat all calls as being far away (near). If calls are assumed to
22802 be far away, the compiler always loads the function's address into
22803 a register, and calls indirect through the pointer.
22804
22805 -mno-ep
22806 -mep
22807 Do not optimize (do optimize) basic blocks that use the same index
22808 pointer 4 or more times to copy pointer into the "ep" register, and
22809 use the shorter "sld" and "sst" instructions. The -mep option is
22810 on by default if you optimize.
22811
22812 -mno-prolog-function
22813 -mprolog-function
22814 Do not use (do use) external functions to save and restore
22815 registers at the prologue and epilogue of a function. The external
22816 functions are slower, but use less code space if more than one
22817 function saves the same number of registers. The -mprolog-function
22818 option is on by default if you optimize.
22819
22820 -mspace
22821 Try to make the code as small as possible. At present, this just
22822 turns on the -mep and -mprolog-function options.
22823
22824 -mtda=n
22825 Put static or global variables whose size is n bytes or less into
22826 the tiny data area that register "ep" points to. The tiny data
22827 area can hold up to 256 bytes in total (128 bytes for byte
22828 references).
22829
22830 -msda=n
22831 Put static or global variables whose size is n bytes or less into
22832 the small data area that register "gp" points to. The small data
22833 area can hold up to 64 kilobytes.
22834
22835 -mzda=n
22836 Put static or global variables whose size is n bytes or less into
22837 the first 32 kilobytes of memory.
22838
22839 -mv850
22840 Specify that the target processor is the V850.
22841
22842 -mv850e3v5
22843 Specify that the target processor is the V850E3V5. The
22844 preprocessor constant "__v850e3v5__" is defined if this option is
22845 used.
22846
22847 -mv850e2v4
22848 Specify that the target processor is the V850E3V5. This is an
22849 alias for the -mv850e3v5 option.
22850
22851 -mv850e2v3
22852 Specify that the target processor is the V850E2V3. The
22853 preprocessor constant "__v850e2v3__" is defined if this option is
22854 used.
22855
22856 -mv850e2
22857 Specify that the target processor is the V850E2. The preprocessor
22858 constant "__v850e2__" is defined if this option is used.
22859
22860 -mv850e1
22861 Specify that the target processor is the V850E1. The preprocessor
22862 constants "__v850e1__" and "__v850e__" are defined if this option
22863 is used.
22864
22865 -mv850es
22866 Specify that the target processor is the V850ES. This is an alias
22867 for the -mv850e1 option.
22868
22869 -mv850e
22870 Specify that the target processor is the V850E. The preprocessor
22871 constant "__v850e__" is defined if this option is used.
22872
22873 If neither -mv850 nor -mv850e nor -mv850e1 nor -mv850e2 nor
22874 -mv850e2v3 nor -mv850e3v5 are defined then a default target
22875 processor is chosen and the relevant __v850*__ preprocessor
22876 constant is defined.
22877
22878 The preprocessor constants "__v850" and "__v851__" are always
22879 defined, regardless of which processor variant is the target.
22880
22881 -mdisable-callt
22882 -mno-disable-callt
22883 This option suppresses generation of the "CALLT" instruction for
22884 the v850e, v850e1, v850e2, v850e2v3 and v850e3v5 flavors of the
22885 v850 architecture.
22886
22887 This option is enabled by default when the RH850 ABI is in use (see
22888 -mrh850-abi), and disabled by default when the GCC ABI is in use.
22889 If "CALLT" instructions are being generated then the C preprocessor
22890 symbol "__V850_CALLT__" is defined.
22891
22892 -mrelax
22893 -mno-relax
22894 Pass on (or do not pass on) the -mrelax command-line option to the
22895 assembler.
22896
22897 -mlong-jumps
22898 -mno-long-jumps
22899 Disable (or re-enable) the generation of PC-relative jump
22900 instructions.
22901
22902 -msoft-float
22903 -mhard-float
22904 Disable (or re-enable) the generation of hardware floating point
22905 instructions. This option is only significant when the target
22906 architecture is V850E2V3 or higher. If hardware floating point
22907 instructions are being generated then the C preprocessor symbol
22908 "__FPU_OK__" is defined, otherwise the symbol "__NO_FPU__" is
22909 defined.
22910
22911 -mloop
22912 Enables the use of the e3v5 LOOP instruction. The use of this
22913 instruction is not enabled by default when the e3v5 architecture is
22914 selected because its use is still experimental.
22915
22916 -mrh850-abi
22917 -mghs
22918 Enables support for the RH850 version of the V850 ABI. This is the
22919 default. With this version of the ABI the following rules apply:
22920
22921 * Integer sized structures and unions are returned via a memory
22922 pointer rather than a register.
22923
22924 * Large structures and unions (more than 8 bytes in size) are
22925 passed by value.
22926
22927 * Functions are aligned to 16-bit boundaries.
22928
22929 * The -m8byte-align command-line option is supported.
22930
22931 * The -mdisable-callt command-line option is enabled by default.
22932 The -mno-disable-callt command-line option is not supported.
22933
22934 When this version of the ABI is enabled the C preprocessor symbol
22935 "__V850_RH850_ABI__" is defined.
22936
22937 -mgcc-abi
22938 Enables support for the old GCC version of the V850 ABI. With this
22939 version of the ABI the following rules apply:
22940
22941 * Integer sized structures and unions are returned in register
22942 "r10".
22943
22944 * Large structures and unions (more than 8 bytes in size) are
22945 passed by reference.
22946
22947 * Functions are aligned to 32-bit boundaries, unless optimizing
22948 for size.
22949
22950 * The -m8byte-align command-line option is not supported.
22951
22952 * The -mdisable-callt command-line option is supported but not
22953 enabled by default.
22954
22955 When this version of the ABI is enabled the C preprocessor symbol
22956 "__V850_GCC_ABI__" is defined.
22957
22958 -m8byte-align
22959 -mno-8byte-align
22960 Enables support for "double" and "long long" types to be aligned on
22961 8-byte boundaries. The default is to restrict the alignment of all
22962 objects to at most 4-bytes. When -m8byte-align is in effect the C
22963 preprocessor symbol "__V850_8BYTE_ALIGN__" is defined.
22964
22965 -mbig-switch
22966 Generate code suitable for big switch tables. Use this option only
22967 if the assembler/linker complain about out of range branches within
22968 a switch table.
22969
22970 -mapp-regs
22971 This option causes r2 and r5 to be used in the code generated by
22972 the compiler. This setting is the default.
22973
22974 -mno-app-regs
22975 This option causes r2 and r5 to be treated as fixed registers.
22976
22977 VAX Options
22978
22979 These -m options are defined for the VAX:
22980
22981 -munix
22982 Do not output certain jump instructions ("aobleq" and so on) that
22983 the Unix assembler for the VAX cannot handle across long ranges.
22984
22985 -mgnu
22986 Do output those jump instructions, on the assumption that the GNU
22987 assembler is being used.
22988
22989 -mg Output code for G-format floating-point numbers instead of
22990 D-format.
22991
22992 Visium Options
22993
22994 -mdebug
22995 A program which performs file I/O and is destined to run on an MCM
22996 target should be linked with this option. It causes the libraries
22997 libc.a and libdebug.a to be linked. The program should be run on
22998 the target under the control of the GDB remote debugging stub.
22999
23000 -msim
23001 A program which performs file I/O and is destined to run on the
23002 simulator should be linked with option. This causes libraries
23003 libc.a and libsim.a to be linked.
23004
23005 -mfpu
23006 -mhard-float
23007 Generate code containing floating-point instructions. This is the
23008 default.
23009
23010 -mno-fpu
23011 -msoft-float
23012 Generate code containing library calls for floating-point.
23013
23014 -msoft-float changes the calling convention in the output file;
23015 therefore, it is only useful if you compile all of a program with
23016 this option. In particular, you need to compile libgcc.a, the
23017 library that comes with GCC, with -msoft-float in order for this to
23018 work.
23019
23020 -mcpu=cpu_type
23021 Set the instruction set, register set, and instruction scheduling
23022 parameters for machine type cpu_type. Supported values for
23023 cpu_type are mcm, gr5 and gr6.
23024
23025 mcm is a synonym of gr5 present for backward compatibility.
23026
23027 By default (unless configured otherwise), GCC generates code for
23028 the GR5 variant of the Visium architecture.
23029
23030 With -mcpu=gr6, GCC generates code for the GR6 variant of the
23031 Visium architecture. The only difference from GR5 code is that the
23032 compiler will generate block move instructions.
23033
23034 -mtune=cpu_type
23035 Set the instruction scheduling parameters for machine type
23036 cpu_type, but do not set the instruction set or register set that
23037 the option -mcpu=cpu_type would.
23038
23039 -msv-mode
23040 Generate code for the supervisor mode, where there are no
23041 restrictions on the access to general registers. This is the
23042 default.
23043
23044 -muser-mode
23045 Generate code for the user mode, where the access to some general
23046 registers is forbidden: on the GR5, registers r24 to r31 cannot be
23047 accessed in this mode; on the GR6, only registers r29 to r31 are
23048 affected.
23049
23050 VMS Options
23051
23052 These -m options are defined for the VMS implementations:
23053
23054 -mvms-return-codes
23055 Return VMS condition codes from "main". The default is to return
23056 POSIX-style condition (e.g. error) codes.
23057
23058 -mdebug-main=prefix
23059 Flag the first routine whose name starts with prefix as the main
23060 routine for the debugger.
23061
23062 -mmalloc64
23063 Default to 64-bit memory allocation routines.
23064
23065 -mpointer-size=size
23066 Set the default size of pointers. Possible options for size are 32
23067 or short for 32 bit pointers, 64 or long for 64 bit pointers, and
23068 no for supporting only 32 bit pointers. The later option disables
23069 "pragma pointer_size".
23070
23071 VxWorks Options
23072
23073 The options in this section are defined for all VxWorks targets.
23074 Options specific to the target hardware are listed with the other
23075 options for that target.
23076
23077 -mrtp
23078 GCC can generate code for both VxWorks kernels and real time
23079 processes (RTPs). This option switches from the former to the
23080 latter. It also defines the preprocessor macro "__RTP__".
23081
23082 -non-static
23083 Link an RTP executable against shared libraries rather than static
23084 libraries. The options -static and -shared can also be used for
23085 RTPs; -static is the default.
23086
23087 -Bstatic
23088 -Bdynamic
23089 These options are passed down to the linker. They are defined for
23090 compatibility with Diab.
23091
23092 -Xbind-lazy
23093 Enable lazy binding of function calls. This option is equivalent
23094 to -Wl,-z,now and is defined for compatibility with Diab.
23095
23096 -Xbind-now
23097 Disable lazy binding of function calls. This option is the default
23098 and is defined for compatibility with Diab.
23099
23100 x86 Options
23101
23102 These -m options are defined for the x86 family of computers.
23103
23104 -march=cpu-type
23105 Generate instructions for the machine type cpu-type. In contrast
23106 to -mtune=cpu-type, which merely tunes the generated code for the
23107 specified cpu-type, -march=cpu-type allows GCC to generate code
23108 that may not run at all on processors other than the one indicated.
23109 Specifying -march=cpu-type implies -mtune=cpu-type.
23110
23111 The choices for cpu-type are:
23112
23113 native
23114 This selects the CPU to generate code for at compilation time
23115 by determining the processor type of the compiling machine.
23116 Using -march=native enables all instruction subsets supported
23117 by the local machine (hence the result might not run on
23118 different machines). Using -mtune=native produces code
23119 optimized for the local machine under the constraints of the
23120 selected instruction set.
23121
23122 x86-64
23123 A generic CPU with 64-bit extensions.
23124
23125 i386
23126 Original Intel i386 CPU.
23127
23128 i486
23129 Intel i486 CPU. (No scheduling is implemented for this chip.)
23130
23131 i586
23132 pentium
23133 Intel Pentium CPU with no MMX support.
23134
23135 lakemont
23136 Intel Lakemont MCU, based on Intel Pentium CPU.
23137
23138 pentium-mmx
23139 Intel Pentium MMX CPU, based on Pentium core with MMX
23140 instruction set support.
23141
23142 pentiumpro
23143 Intel Pentium Pro CPU.
23144
23145 i686
23146 When used with -march, the Pentium Pro instruction set is used,
23147 so the code runs on all i686 family chips. When used with
23148 -mtune, it has the same meaning as generic.
23149
23150 pentium2
23151 Intel Pentium II CPU, based on Pentium Pro core with MMX
23152 instruction set support.
23153
23154 pentium3
23155 pentium3m
23156 Intel Pentium III CPU, based on Pentium Pro core with MMX and
23157 SSE instruction set support.
23158
23159 pentium-m
23160 Intel Pentium M; low-power version of Intel Pentium III CPU
23161 with MMX, SSE and SSE2 instruction set support. Used by
23162 Centrino notebooks.
23163
23164 pentium4
23165 pentium4m
23166 Intel Pentium 4 CPU with MMX, SSE and SSE2 instruction set
23167 support.
23168
23169 prescott
23170 Improved version of Intel Pentium 4 CPU with MMX, SSE, SSE2 and
23171 SSE3 instruction set support.
23172
23173 nocona
23174 Improved version of Intel Pentium 4 CPU with 64-bit extensions,
23175 MMX, SSE, SSE2 and SSE3 instruction set support.
23176
23177 core2
23178 Intel Core 2 CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3
23179 and SSSE3 instruction set support.
23180
23181 nehalem
23182 Intel Nehalem CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3,
23183 SSSE3, SSE4.1, SSE4.2 and POPCNT instruction set support.
23184
23185 westmere
23186 Intel Westmere CPU with 64-bit extensions, MMX, SSE, SSE2,
23187 SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, AES and PCLMUL instruction
23188 set support.
23189
23190 sandybridge
23191 Intel Sandy Bridge CPU with 64-bit extensions, MMX, SSE, SSE2,
23192 SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, AVX, AES and PCLMUL
23193 instruction set support.
23194
23195 ivybridge
23196 Intel Ivy Bridge CPU with 64-bit extensions, MMX, SSE, SSE2,
23197 SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, AVX, AES, PCLMUL,
23198 FSGSBASE, RDRND and F16C instruction set support.
23199
23200 haswell
23201 Intel Haswell CPU with 64-bit extensions, MOVBE, MMX, SSE,
23202 SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES,
23203 PCLMUL, FSGSBASE, RDRND, FMA, BMI, BMI2 and F16C instruction
23204 set support.
23205
23206 broadwell
23207 Intel Broadwell CPU with 64-bit extensions, MOVBE, MMX, SSE,
23208 SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES,
23209 PCLMUL, FSGSBASE, RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX and
23210 PREFETCHW instruction set support.
23211
23212 skylake
23213 Intel Skylake CPU with 64-bit extensions, MOVBE, MMX, SSE,
23214 SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES,
23215 PCLMUL, FSGSBASE, RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX,
23216 PREFETCHW, CLFLUSHOPT, XSAVEC and XSAVES instruction set
23217 support.
23218
23219 bonnell
23220 Intel Bonnell CPU with 64-bit extensions, MOVBE, MMX, SSE,
23221 SSE2, SSE3 and SSSE3 instruction set support.
23222
23223 silvermont
23224 Intel Silvermont CPU with 64-bit extensions, MOVBE, MMX, SSE,
23225 SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, AES, PCLMUL and
23226 RDRND instruction set support.
23227
23228 goldmont
23229 Intel Goldmont CPU with 64-bit extensions, MOVBE, MMX, SSE,
23230 SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, AES, PCLMUL, RDRND,
23231 XSAVE, XSAVEOPT and FSGSBASE instruction set support.
23232
23233 goldmont-plus
23234 Intel Goldmont Plus CPU with 64-bit extensions, MOVBE, MMX,
23235 SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, AES, PCLMUL,
23236 RDRND, XSAVE, XSAVEOPT, FSGSBASE, PTWRITE, RDPID, SGX and UMIP
23237 instruction set support.
23238
23239 tremont
23240 Intel Tremont CPU with 64-bit extensions, MOVBE, MMX, SSE,
23241 SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, AES, PCLMUL, RDRND,
23242 XSAVE, XSAVEOPT, FSGSBASE, PTWRITE, RDPID, SGX, UMIP, GFNI-SSE,
23243 CLWB and ENCLV instruction set support.
23244
23245 knl Intel Knight's Landing CPU with 64-bit extensions, MOVBE, MMX,
23246 SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES,
23247 PCLMUL, FSGSBASE, RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX,
23248 PREFETCHW, AVX512F, AVX512PF, AVX512ER and AVX512CD instruction
23249 set support.
23250
23251 knm Intel Knights Mill CPU with 64-bit extensions, MOVBE, MMX, SSE,
23252 SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES,
23253 PCLMUL, FSGSBASE, RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX,
23254 PREFETCHW, AVX512F, AVX512PF, AVX512ER, AVX512CD, AVX5124VNNIW,
23255 AVX5124FMAPS and AVX512VPOPCNTDQ instruction set support.
23256
23257 skylake-avx512
23258 Intel Skylake Server CPU with 64-bit extensions, MOVBE, MMX,
23259 SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2,
23260 AES, PCLMUL, FSGSBASE, RDRND, FMA, BMI, BMI2, F16C, RDSEED,
23261 ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F, CLWB,
23262 AVX512VL, AVX512BW, AVX512DQ and AVX512CD instruction set
23263 support.
23264
23265 cannonlake
23266 Intel Cannonlake Server CPU with 64-bit extensions, MOVBE, MMX,
23267 SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2,
23268 AES, PCLMUL, FSGSBASE, RDRND, FMA, BMI, BMI2, F16C, RDSEED,
23269 ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F, AVX512VL,
23270 AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI, AVX512IFMA, SHA and
23271 UMIP instruction set support.
23272
23273 icelake-client
23274 Intel Icelake Client CPU with 64-bit extensions, MOVBE, MMX,
23275 SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2,
23276 AES, PCLMUL, FSGSBASE, RDRND, FMA, BMI, BMI2, F16C, RDSEED,
23277 ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F, AVX512VL,
23278 AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI, AVX512IFMA, SHA,
23279 CLWB, UMIP, RDPID, GFNI, AVX512VBMI2, AVX512VPOPCNTDQ,
23280 AVX512BITALG, AVX512VNNI, VPCLMULQDQ, VAES instruction set
23281 support.
23282
23283 icelake-server
23284 Intel Icelake Server CPU with 64-bit extensions, MOVBE, MMX,
23285 SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2,
23286 AES, PCLMUL, FSGSBASE, RDRND, FMA, BMI, BMI2, F16C, RDSEED,
23287 ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F, AVX512VL,
23288 AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI, AVX512IFMA, SHA,
23289 CLWB, UMIP, RDPID, GFNI, AVX512VBMI2, AVX512VPOPCNTDQ,
23290 AVX512BITALG, AVX512VNNI, VPCLMULQDQ, VAES, PCONFIG and
23291 WBNOINVD instruction set support.
23292
23293 cascadelake
23294 Intel Cascadelake CPU with 64-bit extensions, MOVBE, MMX, SSE,
23295 SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES,
23296 PCLMUL, FSGSBASE, RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX,
23297 PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F, CLWB, AVX512VL,
23298 AVX512BW, AVX512DQ, AVX512CD and AVX512VNNI instruction set
23299 support.
23300
23301 k6 AMD K6 CPU with MMX instruction set support.
23302
23303 k6-2
23304 k6-3
23305 Improved versions of AMD K6 CPU with MMX and 3DNow! instruction
23306 set support.
23307
23308 athlon
23309 athlon-tbird
23310 AMD Athlon CPU with MMX, 3dNOW!, enhanced 3DNow! and SSE
23311 prefetch instructions support.
23312
23313 athlon-4
23314 athlon-xp
23315 athlon-mp
23316 Improved AMD Athlon CPU with MMX, 3DNow!, enhanced 3DNow! and
23317 full SSE instruction set support.
23318
23319 k8
23320 opteron
23321 athlon64
23322 athlon-fx
23323 Processors based on the AMD K8 core with x86-64 instruction set
23324 support, including the AMD Opteron, Athlon 64, and Athlon 64 FX
23325 processors. (This supersets MMX, SSE, SSE2, 3DNow!, enhanced
23326 3DNow! and 64-bit instruction set extensions.)
23327
23328 k8-sse3
23329 opteron-sse3
23330 athlon64-sse3
23331 Improved versions of AMD K8 cores with SSE3 instruction set
23332 support.
23333
23334 amdfam10
23335 barcelona
23336 CPUs based on AMD Family 10h cores with x86-64 instruction set
23337 support. (This supersets MMX, SSE, SSE2, SSE3, SSE4A, 3DNow!,
23338 enhanced 3DNow!, ABM and 64-bit instruction set extensions.)
23339
23340 bdver1
23341 CPUs based on AMD Family 15h cores with x86-64 instruction set
23342 support. (This supersets FMA4, AVX, XOP, LWP, AES, PCL_MUL,
23343 CX16, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM
23344 and 64-bit instruction set extensions.)
23345
23346 bdver2
23347 AMD Family 15h core based CPUs with x86-64 instruction set
23348 support. (This supersets BMI, TBM, F16C, FMA, FMA4, AVX, XOP,
23349 LWP, AES, PCL_MUL, CX16, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3,
23350 SSE4.1, SSE4.2, ABM and 64-bit instruction set extensions.)
23351
23352 bdver3
23353 AMD Family 15h core based CPUs with x86-64 instruction set
23354 support. (This supersets BMI, TBM, F16C, FMA, FMA4, FSGSBASE,
23355 AVX, XOP, LWP, AES, PCL_MUL, CX16, MMX, SSE, SSE2, SSE3, SSE4A,
23356 SSSE3, SSE4.1, SSE4.2, ABM and 64-bit instruction set
23357 extensions.
23358
23359 bdver4
23360 AMD Family 15h core based CPUs with x86-64 instruction set
23361 support. (This supersets BMI, BMI2, TBM, F16C, FMA, FMA4,
23362 FSGSBASE, AVX, AVX2, XOP, LWP, AES, PCL_MUL, CX16, MOVBE, MMX,
23363 SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM and 64-bit
23364 instruction set extensions.
23365
23366 znver1
23367 AMD Family 17h core based CPUs with x86-64 instruction set
23368 support. (This supersets BMI, BMI2, F16C, FMA, FSGSBASE, AVX,
23369 AVX2, ADCX, RDSEED, MWAITX, SHA, CLZERO, AES, PCL_MUL, CX16,
23370 MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM,
23371 XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, and 64-bit instruction set
23372 extensions.
23373
23374 znver2
23375 AMD Family 17h core based CPUs with x86-64 instruction set
23376 support. (This supersets BMI, BMI2, ,CLWB, F16C, FMA, FSGSBASE,
23377 AVX, AVX2, ADCX, RDSEED, MWAITX, SHA, CLZERO, AES, PCL_MUL,
23378 CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1,
23379 SSE4.2, ABM, XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, and 64-bit
23380 instruction set extensions.)
23381
23382 btver1
23383 CPUs based on AMD Family 14h cores with x86-64 instruction set
23384 support. (This supersets MMX, SSE, SSE2, SSE3, SSSE3, SSE4A,
23385 CX16, ABM and 64-bit instruction set extensions.)
23386
23387 btver2
23388 CPUs based on AMD Family 16h cores with x86-64 instruction set
23389 support. This includes MOVBE, F16C, BMI, AVX, PCL_MUL, AES,
23390 SSE4.2, SSE4.1, CX16, ABM, SSE4A, SSSE3, SSE3, SSE2, SSE, MMX
23391 and 64-bit instruction set extensions.
23392
23393 winchip-c6
23394 IDT WinChip C6 CPU, dealt in same way as i486 with additional
23395 MMX instruction set support.
23396
23397 winchip2
23398 IDT WinChip 2 CPU, dealt in same way as i486 with additional
23399 MMX and 3DNow! instruction set support.
23400
23401 c3 VIA C3 CPU with MMX and 3DNow! instruction set support. (No
23402 scheduling is implemented for this chip.)
23403
23404 c3-2
23405 VIA C3-2 (Nehemiah/C5XL) CPU with MMX and SSE instruction set
23406 support. (No scheduling is implemented for this chip.)
23407
23408 c7 VIA C7 (Esther) CPU with MMX, SSE, SSE2 and SSE3 instruction
23409 set support. (No scheduling is implemented for this chip.)
23410
23411 samuel-2
23412 VIA Eden Samuel 2 CPU with MMX and 3DNow! instruction set
23413 support. (No scheduling is implemented for this chip.)
23414
23415 nehemiah
23416 VIA Eden Nehemiah CPU with MMX and SSE instruction set support.
23417 (No scheduling is implemented for this chip.)
23418
23419 esther
23420 VIA Eden Esther CPU with MMX, SSE, SSE2 and SSE3 instruction
23421 set support. (No scheduling is implemented for this chip.)
23422
23423 eden-x2
23424 VIA Eden X2 CPU with x86-64, MMX, SSE, SSE2 and SSE3
23425 instruction set support. (No scheduling is implemented for
23426 this chip.)
23427
23428 eden-x4
23429 VIA Eden X4 CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3,
23430 SSE4.1, SSE4.2, AVX and AVX2 instruction set support. (No
23431 scheduling is implemented for this chip.)
23432
23433 nano
23434 Generic VIA Nano CPU with x86-64, MMX, SSE, SSE2, SSE3 and
23435 SSSE3 instruction set support. (No scheduling is implemented
23436 for this chip.)
23437
23438 nano-1000
23439 VIA Nano 1xxx CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
23440 instruction set support. (No scheduling is implemented for
23441 this chip.)
23442
23443 nano-2000
23444 VIA Nano 2xxx CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
23445 instruction set support. (No scheduling is implemented for
23446 this chip.)
23447
23448 nano-3000
23449 VIA Nano 3xxx CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and
23450 SSE4.1 instruction set support. (No scheduling is implemented
23451 for this chip.)
23452
23453 nano-x2
23454 VIA Nano Dual Core CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3
23455 and SSE4.1 instruction set support. (No scheduling is
23456 implemented for this chip.)
23457
23458 nano-x4
23459 VIA Nano Quad Core CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3
23460 and SSE4.1 instruction set support. (No scheduling is
23461 implemented for this chip.)
23462
23463 geode
23464 AMD Geode embedded processor with MMX and 3DNow! instruction
23465 set support.
23466
23467 -mtune=cpu-type
23468 Tune to cpu-type everything applicable about the generated code,
23469 except for the ABI and the set of available instructions. While
23470 picking a specific cpu-type schedules things appropriately for that
23471 particular chip, the compiler does not generate any code that
23472 cannot run on the default machine type unless you use a -march=cpu-
23473 type option. For example, if GCC is configured for
23474 i686-pc-linux-gnu then -mtune=pentium4 generates code that is tuned
23475 for Pentium 4 but still runs on i686 machines.
23476
23477 The choices for cpu-type are the same as for -march. In addition,
23478 -mtune supports 2 extra choices for cpu-type:
23479
23480 generic
23481 Produce code optimized for the most common IA32/AMD64/EM64T
23482 processors. If you know the CPU on which your code will run,
23483 then you should use the corresponding -mtune or -march option
23484 instead of -mtune=generic. But, if you do not know exactly
23485 what CPU users of your application will have, then you should
23486 use this option.
23487
23488 As new processors are deployed in the marketplace, the behavior
23489 of this option will change. Therefore, if you upgrade to a
23490 newer version of GCC, code generation controlled by this option
23491 will change to reflect the processors that are most common at
23492 the time that version of GCC is released.
23493
23494 There is no -march=generic option because -march indicates the
23495 instruction set the compiler can use, and there is no generic
23496 instruction set applicable to all processors. In contrast,
23497 -mtune indicates the processor (or, in this case, collection of
23498 processors) for which the code is optimized.
23499
23500 intel
23501 Produce code optimized for the most current Intel processors,
23502 which are Haswell and Silvermont for this version of GCC. If
23503 you know the CPU on which your code will run, then you should
23504 use the corresponding -mtune or -march option instead of
23505 -mtune=intel. But, if you want your application performs
23506 better on both Haswell and Silvermont, then you should use this
23507 option.
23508
23509 As new Intel processors are deployed in the marketplace, the
23510 behavior of this option will change. Therefore, if you upgrade
23511 to a newer version of GCC, code generation controlled by this
23512 option will change to reflect the most current Intel processors
23513 at the time that version of GCC is released.
23514
23515 There is no -march=intel option because -march indicates the
23516 instruction set the compiler can use, and there is no common
23517 instruction set applicable to all processors. In contrast,
23518 -mtune indicates the processor (or, in this case, collection of
23519 processors) for which the code is optimized.
23520
23521 -mcpu=cpu-type
23522 A deprecated synonym for -mtune.
23523
23524 -mfpmath=unit
23525 Generate floating-point arithmetic for selected unit unit. The
23526 choices for unit are:
23527
23528 387 Use the standard 387 floating-point coprocessor present on the
23529 majority of chips and emulated otherwise. Code compiled with
23530 this option runs almost everywhere. The temporary results are
23531 computed in 80-bit precision instead of the precision specified
23532 by the type, resulting in slightly different results compared
23533 to most of other chips. See -ffloat-store for more detailed
23534 description.
23535
23536 This is the default choice for non-Darwin x86-32 targets.
23537
23538 sse Use scalar floating-point instructions present in the SSE
23539 instruction set. This instruction set is supported by Pentium
23540 III and newer chips, and in the AMD line by Athlon-4, Athlon XP
23541 and Athlon MP chips. The earlier version of the SSE
23542 instruction set supports only single-precision arithmetic, thus
23543 the double and extended-precision arithmetic are still done
23544 using 387. A later version, present only in Pentium 4 and AMD
23545 x86-64 chips, supports double-precision arithmetic too.
23546
23547 For the x86-32 compiler, you must use -march=cpu-type, -msse or
23548 -msse2 switches to enable SSE extensions and make this option
23549 effective. For the x86-64 compiler, these extensions are
23550 enabled by default.
23551
23552 The resulting code should be considerably faster in the
23553 majority of cases and avoid the numerical instability problems
23554 of 387 code, but may break some existing code that expects
23555 temporaries to be 80 bits.
23556
23557 This is the default choice for the x86-64 compiler, Darwin
23558 x86-32 targets, and the default choice for x86-32 targets with
23559 the SSE2 instruction set when -ffast-math is enabled.
23560
23561 sse,387
23562 sse+387
23563 both
23564 Attempt to utilize both instruction sets at once. This
23565 effectively doubles the amount of available registers, and on
23566 chips with separate execution units for 387 and SSE the
23567 execution resources too. Use this option with care, as it is
23568 still experimental, because the GCC register allocator does not
23569 model separate functional units well, resulting in unstable
23570 performance.
23571
23572 -masm=dialect
23573 Output assembly instructions using selected dialect. Also affects
23574 which dialect is used for basic "asm" and extended "asm". Supported
23575 choices (in dialect order) are att or intel. The default is att.
23576 Darwin does not support intel.
23577
23578 -mieee-fp
23579 -mno-ieee-fp
23580 Control whether or not the compiler uses IEEE floating-point
23581 comparisons. These correctly handle the case where the result of a
23582 comparison is unordered.
23583
23584 -m80387
23585 -mhard-float
23586 Generate output containing 80387 instructions for floating point.
23587
23588 -mno-80387
23589 -msoft-float
23590 Generate output containing library calls for floating point.
23591
23592 Warning: the requisite libraries are not part of GCC. Normally the
23593 facilities of the machine's usual C compiler are used, but this
23594 cannot be done directly in cross-compilation. You must make your
23595 own arrangements to provide suitable library functions for cross-
23596 compilation.
23597
23598 On machines where a function returns floating-point results in the
23599 80387 register stack, some floating-point opcodes may be emitted
23600 even if -msoft-float is used.
23601
23602 -mno-fp-ret-in-387
23603 Do not use the FPU registers for return values of functions.
23604
23605 The usual calling convention has functions return values of types
23606 "float" and "double" in an FPU register, even if there is no FPU.
23607 The idea is that the operating system should emulate an FPU.
23608
23609 The option -mno-fp-ret-in-387 causes such values to be returned in
23610 ordinary CPU registers instead.
23611
23612 -mno-fancy-math-387
23613 Some 387 emulators do not support the "sin", "cos" and "sqrt"
23614 instructions for the 387. Specify this option to avoid generating
23615 those instructions. This option is overridden when -march
23616 indicates that the target CPU always has an FPU and so the
23617 instruction does not need emulation. These instructions are not
23618 generated unless you also use the -funsafe-math-optimizations
23619 switch.
23620
23621 -malign-double
23622 -mno-align-double
23623 Control whether GCC aligns "double", "long double", and "long long"
23624 variables on a two-word boundary or a one-word boundary. Aligning
23625 "double" variables on a two-word boundary produces code that runs
23626 somewhat faster on a Pentium at the expense of more memory.
23627
23628 On x86-64, -malign-double is enabled by default.
23629
23630 Warning: if you use the -malign-double switch, structures
23631 containing the above types are aligned differently than the
23632 published application binary interface specifications for the
23633 x86-32 and are not binary compatible with structures in code
23634 compiled without that switch.
23635
23636 -m96bit-long-double
23637 -m128bit-long-double
23638 These switches control the size of "long double" type. The x86-32
23639 application binary interface specifies the size to be 96 bits, so
23640 -m96bit-long-double is the default in 32-bit mode.
23641
23642 Modern architectures (Pentium and newer) prefer "long double" to be
23643 aligned to an 8- or 16-byte boundary. In arrays or structures
23644 conforming to the ABI, this is not possible. So specifying
23645 -m128bit-long-double aligns "long double" to a 16-byte boundary by
23646 padding the "long double" with an additional 32-bit zero.
23647
23648 In the x86-64 compiler, -m128bit-long-double is the default choice
23649 as its ABI specifies that "long double" is aligned on 16-byte
23650 boundary.
23651
23652 Notice that neither of these options enable any extra precision
23653 over the x87 standard of 80 bits for a "long double".
23654
23655 Warning: if you override the default value for your target ABI,
23656 this changes the size of structures and arrays containing "long
23657 double" variables, as well as modifying the function calling
23658 convention for functions taking "long double". Hence they are not
23659 binary-compatible with code compiled without that switch.
23660
23661 -mlong-double-64
23662 -mlong-double-80
23663 -mlong-double-128
23664 These switches control the size of "long double" type. A size of 64
23665 bits makes the "long double" type equivalent to the "double" type.
23666 This is the default for 32-bit Bionic C library. A size of 128
23667 bits makes the "long double" type equivalent to the "__float128"
23668 type. This is the default for 64-bit Bionic C library.
23669
23670 Warning: if you override the default value for your target ABI,
23671 this changes the size of structures and arrays containing "long
23672 double" variables, as well as modifying the function calling
23673 convention for functions taking "long double". Hence they are not
23674 binary-compatible with code compiled without that switch.
23675
23676 -malign-data=type
23677 Control how GCC aligns variables. Supported values for type are
23678 compat uses increased alignment value compatible uses GCC 4.8 and
23679 earlier, abi uses alignment value as specified by the psABI, and
23680 cacheline uses increased alignment value to match the cache line
23681 size. compat is the default.
23682
23683 -mlarge-data-threshold=threshold
23684 When -mcmodel=medium is specified, data objects larger than
23685 threshold are placed in the large data section. This value must be
23686 the same across all objects linked into the binary, and defaults to
23687 65535.
23688
23689 -mrtd
23690 Use a different function-calling convention, in which functions
23691 that take a fixed number of arguments return with the "ret num"
23692 instruction, which pops their arguments while returning. This
23693 saves one instruction in the caller since there is no need to pop
23694 the arguments there.
23695
23696 You can specify that an individual function is called with this
23697 calling sequence with the function attribute "stdcall". You can
23698 also override the -mrtd option by using the function attribute
23699 "cdecl".
23700
23701 Warning: this calling convention is incompatible with the one
23702 normally used on Unix, so you cannot use it if you need to call
23703 libraries compiled with the Unix compiler.
23704
23705 Also, you must provide function prototypes for all functions that
23706 take variable numbers of arguments (including "printf"); otherwise
23707 incorrect code is generated for calls to those functions.
23708
23709 In addition, seriously incorrect code results if you call a
23710 function with too many arguments. (Normally, extra arguments are
23711 harmlessly ignored.)
23712
23713 -mregparm=num
23714 Control how many registers are used to pass integer arguments. By
23715 default, no registers are used to pass arguments, and at most 3
23716 registers can be used. You can control this behavior for a
23717 specific function by using the function attribute "regparm".
23718
23719 Warning: if you use this switch, and num is nonzero, then you must
23720 build all modules with the same value, including any libraries.
23721 This includes the system libraries and startup modules.
23722
23723 -msseregparm
23724 Use SSE register passing conventions for float and double arguments
23725 and return values. You can control this behavior for a specific
23726 function by using the function attribute "sseregparm".
23727
23728 Warning: if you use this switch then you must build all modules
23729 with the same value, including any libraries. This includes the
23730 system libraries and startup modules.
23731
23732 -mvect8-ret-in-mem
23733 Return 8-byte vectors in memory instead of MMX registers. This is
23734 the default on Solaris@tie{}8 and 9 and VxWorks to match the ABI of
23735 the Sun Studio compilers until version 12. Later compiler versions
23736 (starting with Studio 12 Update@tie{}1) follow the ABI used by
23737 other x86 targets, which is the default on Solaris@tie{}10 and
23738 later. Only use this option if you need to remain compatible with
23739 existing code produced by those previous compiler versions or older
23740 versions of GCC.
23741
23742 -mpc32
23743 -mpc64
23744 -mpc80
23745 Set 80387 floating-point precision to 32, 64 or 80 bits. When
23746 -mpc32 is specified, the significands of results of floating-point
23747 operations are rounded to 24 bits (single precision); -mpc64 rounds
23748 the significands of results of floating-point operations to 53 bits
23749 (double precision) and -mpc80 rounds the significands of results of
23750 floating-point operations to 64 bits (extended double precision),
23751 which is the default. When this option is used, floating-point
23752 operations in higher precisions are not available to the programmer
23753 without setting the FPU control word explicitly.
23754
23755 Setting the rounding of floating-point operations to less than the
23756 default 80 bits can speed some programs by 2% or more. Note that
23757 some mathematical libraries assume that extended-precision (80-bit)
23758 floating-point operations are enabled by default; routines in such
23759 libraries could suffer significant loss of accuracy, typically
23760 through so-called "catastrophic cancellation", when this option is
23761 used to set the precision to less than extended precision.
23762
23763 -mstackrealign
23764 Realign the stack at entry. On the x86, the -mstackrealign option
23765 generates an alternate prologue and epilogue that realigns the run-
23766 time stack if necessary. This supports mixing legacy codes that
23767 keep 4-byte stack alignment with modern codes that keep 16-byte
23768 stack alignment for SSE compatibility. See also the attribute
23769 "force_align_arg_pointer", applicable to individual functions.
23770
23771 -mpreferred-stack-boundary=num
23772 Attempt to keep the stack boundary aligned to a 2 raised to num
23773 byte boundary. If -mpreferred-stack-boundary is not specified, the
23774 default is 4 (16 bytes or 128 bits).
23775
23776 Warning: When generating code for the x86-64 architecture with SSE
23777 extensions disabled, -mpreferred-stack-boundary=3 can be used to
23778 keep the stack boundary aligned to 8 byte boundary. Since x86-64
23779 ABI require 16 byte stack alignment, this is ABI incompatible and
23780 intended to be used in controlled environment where stack space is
23781 important limitation. This option leads to wrong code when
23782 functions compiled with 16 byte stack alignment (such as functions
23783 from a standard library) are called with misaligned stack. In this
23784 case, SSE instructions may lead to misaligned memory access traps.
23785 In addition, variable arguments are handled incorrectly for 16 byte
23786 aligned objects (including x87 long double and __int128), leading
23787 to wrong results. You must build all modules with
23788 -mpreferred-stack-boundary=3, including any libraries. This
23789 includes the system libraries and startup modules.
23790
23791 -mincoming-stack-boundary=num
23792 Assume the incoming stack is aligned to a 2 raised to num byte
23793 boundary. If -mincoming-stack-boundary is not specified, the one
23794 specified by -mpreferred-stack-boundary is used.
23795
23796 On Pentium and Pentium Pro, "double" and "long double" values
23797 should be aligned to an 8-byte boundary (see -malign-double) or
23798 suffer significant run time performance penalties. On Pentium III,
23799 the Streaming SIMD Extension (SSE) data type "__m128" may not work
23800 properly if it is not 16-byte aligned.
23801
23802 To ensure proper alignment of this values on the stack, the stack
23803 boundary must be as aligned as that required by any value stored on
23804 the stack. Further, every function must be generated such that it
23805 keeps the stack aligned. Thus calling a function compiled with a
23806 higher preferred stack boundary from a function compiled with a
23807 lower preferred stack boundary most likely misaligns the stack. It
23808 is recommended that libraries that use callbacks always use the
23809 default setting.
23810
23811 This extra alignment does consume extra stack space, and generally
23812 increases code size. Code that is sensitive to stack space usage,
23813 such as embedded systems and operating system kernels, may want to
23814 reduce the preferred alignment to -mpreferred-stack-boundary=2.
23815
23816 -mmmx
23817 -msse
23818 -msse2
23819 -msse3
23820 -mssse3
23821 -msse4
23822 -msse4a
23823 -msse4.1
23824 -msse4.2
23825 -mavx
23826 -mavx2
23827 -mavx512f
23828 -mavx512pf
23829 -mavx512er
23830 -mavx512cd
23831 -mavx512vl
23832 -mavx512bw
23833 -mavx512dq
23834 -mavx512ifma
23835 -mavx512vbmi
23836 -msha
23837 -maes
23838 -mpclmul
23839 -mclflushopt
23840 -mclwb
23841 -mfsgsbase
23842 -mptwrite
23843 -mrdrnd
23844 -mf16c
23845 -mfma
23846 -mpconfig
23847 -mwbnoinvd
23848 -mfma4
23849 -mprfchw
23850 -mrdpid
23851 -mprefetchwt1
23852 -mrdseed
23853 -msgx
23854 -mxop
23855 -mlwp
23856 -m3dnow
23857 -m3dnowa
23858 -mpopcnt
23859 -mabm
23860 -madx
23861 -mbmi
23862 -mbmi2
23863 -mlzcnt
23864 -mfxsr
23865 -mxsave
23866 -mxsaveopt
23867 -mxsavec
23868 -mxsaves
23869 -mrtm
23870 -mhle
23871 -mtbm
23872 -mmwaitx
23873 -mclzero
23874 -mpku
23875 -mavx512vbmi2
23876 -mgfni
23877 -mvaes
23878 -mwaitpkg
23879 -mvpclmulqdq
23880 -mavx512bitalg
23881 -mmovdiri
23882 -mmovdir64b
23883 -mavx512vpopcntdq
23884 -mavx5124fmaps
23885 -mavx512vnni
23886 -mavx5124vnniw
23887 -mcldemote
23888 These switches enable the use of instructions in the MMX, SSE,
23889 SSE2, SSE3, SSSE3, SSE4, SSE4A, SSE4.1, SSE4.2, AVX, AVX2, AVX512F,
23890 AVX512PF, AVX512ER, AVX512CD, AVX512VL, AVX512BW, AVX512DQ,
23891 AVX512IFMA, AVX512VBMI, SHA, AES, PCLMUL, CLFLUSHOPT, CLWB,
23892 FSGSBASE, PTWRITE, RDRND, F16C, FMA, PCONFIG, WBNOINVD, FMA4,
23893 PREFETCHW, RDPID, PREFETCHWT1, RDSEED, SGX, XOP, LWP, 3DNow!,
23894 enhanced 3DNow!, POPCNT, ABM, ADX, BMI, BMI2, LZCNT, FXSR, XSAVE,
23895 XSAVEOPT, XSAVEC, XSAVES, RTM, HLE, TBM, MWAITX, CLZERO, PKU,
23896 AVX512VBMI2, GFNI, VAES, WAITPKG, VPCLMULQDQ, AVX512BITALG,
23897 MOVDIRI, MOVDIR64B, AVX512VPOPCNTDQ, AVX5124FMAPS, AVX512VNNI,
23898 AVX5124VNNIW, or CLDEMOTE extended instruction sets. Each has a
23899 corresponding -mno- option to disable use of these instructions.
23900
23901 These extensions are also available as built-in functions: see x86
23902 Built-in Functions, for details of the functions enabled and
23903 disabled by these switches.
23904
23905 To generate SSE/SSE2 instructions automatically from floating-point
23906 code (as opposed to 387 instructions), see -mfpmath=sse.
23907
23908 GCC depresses SSEx instructions when -mavx is used. Instead, it
23909 generates new AVX instructions or AVX equivalence for all SSEx
23910 instructions when needed.
23911
23912 These options enable GCC to use these extended instructions in
23913 generated code, even without -mfpmath=sse. Applications that
23914 perform run-time CPU detection must compile separate files for each
23915 supported architecture, using the appropriate flags. In
23916 particular, the file containing the CPU detection code should be
23917 compiled without these options.
23918
23919 -mdump-tune-features
23920 This option instructs GCC to dump the names of the x86 performance
23921 tuning features and default settings. The names can be used in
23922 -mtune-ctrl=feature-list.
23923
23924 -mtune-ctrl=feature-list
23925 This option is used to do fine grain control of x86 code generation
23926 features. feature-list is a comma separated list of feature names.
23927 See also -mdump-tune-features. When specified, the feature is
23928 turned on if it is not preceded with ^, otherwise, it is turned
23929 off. -mtune-ctrl=feature-list is intended to be used by GCC
23930 developers. Using it may lead to code paths not covered by testing
23931 and can potentially result in compiler ICEs or runtime errors.
23932
23933 -mno-default
23934 This option instructs GCC to turn off all tunable features. See
23935 also -mtune-ctrl=feature-list and -mdump-tune-features.
23936
23937 -mcld
23938 This option instructs GCC to emit a "cld" instruction in the
23939 prologue of functions that use string instructions. String
23940 instructions depend on the DF flag to select between autoincrement
23941 or autodecrement mode. While the ABI specifies the DF flag to be
23942 cleared on function entry, some operating systems violate this
23943 specification by not clearing the DF flag in their exception
23944 dispatchers. The exception handler can be invoked with the DF flag
23945 set, which leads to wrong direction mode when string instructions
23946 are used. This option can be enabled by default on 32-bit x86
23947 targets by configuring GCC with the --enable-cld configure option.
23948 Generation of "cld" instructions can be suppressed with the
23949 -mno-cld compiler option in this case.
23950
23951 -mvzeroupper
23952 This option instructs GCC to emit a "vzeroupper" instruction before
23953 a transfer of control flow out of the function to minimize the AVX
23954 to SSE transition penalty as well as remove unnecessary "zeroupper"
23955 intrinsics.
23956
23957 -mprefer-avx128
23958 This option instructs GCC to use 128-bit AVX instructions instead
23959 of 256-bit AVX instructions in the auto-vectorizer.
23960
23961 -mprefer-vector-width=opt
23962 This option instructs GCC to use opt-bit vector width in
23963 instructions instead of default on the selected platform.
23964
23965 none
23966 No extra limitations applied to GCC other than defined by the
23967 selected platform.
23968
23969 128 Prefer 128-bit vector width for instructions.
23970
23971 256 Prefer 256-bit vector width for instructions.
23972
23973 512 Prefer 512-bit vector width for instructions.
23974
23975 -mcx16
23976 This option enables GCC to generate "CMPXCHG16B" instructions in
23977 64-bit code to implement compare-and-exchange operations on 16-byte
23978 aligned 128-bit objects. This is useful for atomic updates of data
23979 structures exceeding one machine word in size. The compiler uses
23980 this instruction to implement __sync Builtins. However, for
23981 __atomic Builtins operating on 128-bit integers, a library call is
23982 always used.
23983
23984 -msahf
23985 This option enables generation of "SAHF" instructions in 64-bit
23986 code. Early Intel Pentium 4 CPUs with Intel 64 support, prior to
23987 the introduction of Pentium 4 G1 step in December 2005, lacked the
23988 "LAHF" and "SAHF" instructions which are supported by AMD64. These
23989 are load and store instructions, respectively, for certain status
23990 flags. In 64-bit mode, the "SAHF" instruction is used to optimize
23991 "fmod", "drem", and "remainder" built-in functions; see Other
23992 Builtins for details.
23993
23994 -mmovbe
23995 This option enables use of the "movbe" instruction to implement
23996 "__builtin_bswap32" and "__builtin_bswap64".
23997
23998 -mshstk
23999 The -mshstk option enables shadow stack built-in functions from x86
24000 Control-flow Enforcement Technology (CET).
24001
24002 -mcrc32
24003 This option enables built-in functions "__builtin_ia32_crc32qi",
24004 "__builtin_ia32_crc32hi", "__builtin_ia32_crc32si" and
24005 "__builtin_ia32_crc32di" to generate the "crc32" machine
24006 instruction.
24007
24008 -mrecip
24009 This option enables use of "RCPSS" and "RSQRTSS" instructions (and
24010 their vectorized variants "RCPPS" and "RSQRTPS") with an additional
24011 Newton-Raphson step to increase precision instead of "DIVSS" and
24012 "SQRTSS" (and their vectorized variants) for single-precision
24013 floating-point arguments. These instructions are generated only
24014 when -funsafe-math-optimizations is enabled together with
24015 -ffinite-math-only and -fno-trapping-math. Note that while the
24016 throughput of the sequence is higher than the throughput of the
24017 non-reciprocal instruction, the precision of the sequence can be
24018 decreased by up to 2 ulp (i.e. the inverse of 1.0 equals
24019 0.99999994).
24020
24021 Note that GCC implements "1.0f/sqrtf(x)" in terms of "RSQRTSS" (or
24022 "RSQRTPS") already with -ffast-math (or the above option
24023 combination), and doesn't need -mrecip.
24024
24025 Also note that GCC emits the above sequence with additional Newton-
24026 Raphson step for vectorized single-float division and vectorized
24027 "sqrtf(x)" already with -ffast-math (or the above option
24028 combination), and doesn't need -mrecip.
24029
24030 -mrecip=opt
24031 This option controls which reciprocal estimate instructions may be
24032 used. opt is a comma-separated list of options, which may be
24033 preceded by a ! to invert the option:
24034
24035 all Enable all estimate instructions.
24036
24037 default
24038 Enable the default instructions, equivalent to -mrecip.
24039
24040 none
24041 Disable all estimate instructions, equivalent to -mno-recip.
24042
24043 div Enable the approximation for scalar division.
24044
24045 vec-div
24046 Enable the approximation for vectorized division.
24047
24048 sqrt
24049 Enable the approximation for scalar square root.
24050
24051 vec-sqrt
24052 Enable the approximation for vectorized square root.
24053
24054 So, for example, -mrecip=all,!sqrt enables all of the reciprocal
24055 approximations, except for square root.
24056
24057 -mveclibabi=type
24058 Specifies the ABI type to use for vectorizing intrinsics using an
24059 external library. Supported values for type are svml for the Intel
24060 short vector math library and acml for the AMD math core library.
24061 To use this option, both -ftree-vectorize and
24062 -funsafe-math-optimizations have to be enabled, and an SVML or ACML
24063 ABI-compatible library must be specified at link time.
24064
24065 GCC currently emits calls to "vmldExp2", "vmldLn2", "vmldLog102",
24066 "vmldPow2", "vmldTanh2", "vmldTan2", "vmldAtan2", "vmldAtanh2",
24067 "vmldCbrt2", "vmldSinh2", "vmldSin2", "vmldAsinh2", "vmldAsin2",
24068 "vmldCosh2", "vmldCos2", "vmldAcosh2", "vmldAcos2", "vmlsExp4",
24069 "vmlsLn4", "vmlsLog104", "vmlsPow4", "vmlsTanh4", "vmlsTan4",
24070 "vmlsAtan4", "vmlsAtanh4", "vmlsCbrt4", "vmlsSinh4", "vmlsSin4",
24071 "vmlsAsinh4", "vmlsAsin4", "vmlsCosh4", "vmlsCos4", "vmlsAcosh4"
24072 and "vmlsAcos4" for corresponding function type when
24073 -mveclibabi=svml is used, and "__vrd2_sin", "__vrd2_cos",
24074 "__vrd2_exp", "__vrd2_log", "__vrd2_log2", "__vrd2_log10",
24075 "__vrs4_sinf", "__vrs4_cosf", "__vrs4_expf", "__vrs4_logf",
24076 "__vrs4_log2f", "__vrs4_log10f" and "__vrs4_powf" for the
24077 corresponding function type when -mveclibabi=acml is used.
24078
24079 -mabi=name
24080 Generate code for the specified calling convention. Permissible
24081 values are sysv for the ABI used on GNU/Linux and other systems,
24082 and ms for the Microsoft ABI. The default is to use the Microsoft
24083 ABI when targeting Microsoft Windows and the SysV ABI on all other
24084 systems. You can control this behavior for specific functions by
24085 using the function attributes "ms_abi" and "sysv_abi".
24086
24087 -mforce-indirect-call
24088 Force all calls to functions to be indirect. This is useful when
24089 using Intel Processor Trace where it generates more precise timing
24090 information for function calls.
24091
24092 -mmanual-endbr
24093 Insert ENDBR instruction at function entry only via the "cf_check"
24094 function attribute. This is useful when used with the option
24095 -fcf-protection=branch to control ENDBR insertion at the function
24096 entry.
24097
24098 -mcall-ms2sysv-xlogues
24099 Due to differences in 64-bit ABIs, any Microsoft ABI function that
24100 calls a System V ABI function must consider RSI, RDI and XMM6-15 as
24101 clobbered. By default, the code for saving and restoring these
24102 registers is emitted inline, resulting in fairly lengthy prologues
24103 and epilogues. Using -mcall-ms2sysv-xlogues emits prologues and
24104 epilogues that use stubs in the static portion of libgcc to perform
24105 these saves and restores, thus reducing function size at the cost
24106 of a few extra instructions.
24107
24108 -mtls-dialect=type
24109 Generate code to access thread-local storage using the gnu or gnu2
24110 conventions. gnu is the conservative default; gnu2 is more
24111 efficient, but it may add compile- and run-time requirements that
24112 cannot be satisfied on all systems.
24113
24114 -mpush-args
24115 -mno-push-args
24116 Use PUSH operations to store outgoing parameters. This method is
24117 shorter and usually equally fast as method using SUB/MOV operations
24118 and is enabled by default. In some cases disabling it may improve
24119 performance because of improved scheduling and reduced
24120 dependencies.
24121
24122 -maccumulate-outgoing-args
24123 If enabled, the maximum amount of space required for outgoing
24124 arguments is computed in the function prologue. This is faster on
24125 most modern CPUs because of reduced dependencies, improved
24126 scheduling and reduced stack usage when the preferred stack
24127 boundary is not equal to 2. The drawback is a notable increase in
24128 code size. This switch implies -mno-push-args.
24129
24130 -mthreads
24131 Support thread-safe exception handling on MinGW. Programs that
24132 rely on thread-safe exception handling must compile and link all
24133 code with the -mthreads option. When compiling, -mthreads defines
24134 -D_MT; when linking, it links in a special thread helper library
24135 -lmingwthrd which cleans up per-thread exception-handling data.
24136
24137 -mms-bitfields
24138 -mno-ms-bitfields
24139 Enable/disable bit-field layout compatible with the native
24140 Microsoft Windows compiler.
24141
24142 If "packed" is used on a structure, or if bit-fields are used, it
24143 may be that the Microsoft ABI lays out the structure differently
24144 than the way GCC normally does. Particularly when moving packed
24145 data between functions compiled with GCC and the native Microsoft
24146 compiler (either via function call or as data in a file), it may be
24147 necessary to access either format.
24148
24149 This option is enabled by default for Microsoft Windows targets.
24150 This behavior can also be controlled locally by use of variable or
24151 type attributes. For more information, see x86 Variable Attributes
24152 and x86 Type Attributes.
24153
24154 The Microsoft structure layout algorithm is fairly simple with the
24155 exception of the bit-field packing. The padding and alignment of
24156 members of structures and whether a bit-field can straddle a
24157 storage-unit boundary are determine by these rules:
24158
24159 1. Structure members are stored sequentially in the order in which
24160 they are
24161 declared: the first member has the lowest memory address and
24162 the last member the highest.
24163
24164 2. Every data object has an alignment requirement. The alignment
24165 requirement
24166 for all data except structures, unions, and arrays is either
24167 the size of the object or the current packing size (specified
24168 with either the "aligned" attribute or the "pack" pragma),
24169 whichever is less. For structures, unions, and arrays, the
24170 alignment requirement is the largest alignment requirement of
24171 its members. Every object is allocated an offset so that:
24172
24173 offset % alignment_requirement == 0
24174
24175 3. Adjacent bit-fields are packed into the same 1-, 2-, or 4-byte
24176 allocation
24177 unit if the integral types are the same size and if the next
24178 bit-field fits into the current allocation unit without
24179 crossing the boundary imposed by the common alignment
24180 requirements of the bit-fields.
24181
24182 MSVC interprets zero-length bit-fields in the following ways:
24183
24184 1. If a zero-length bit-field is inserted between two bit-fields
24185 that
24186 are normally coalesced, the bit-fields are not coalesced.
24187
24188 For example:
24189
24190 struct
24191 {
24192 unsigned long bf_1 : 12;
24193 unsigned long : 0;
24194 unsigned long bf_2 : 12;
24195 } t1;
24196
24197 The size of "t1" is 8 bytes with the zero-length bit-field. If
24198 the zero-length bit-field were removed, "t1"'s size would be 4
24199 bytes.
24200
24201 2. If a zero-length bit-field is inserted after a bit-field, "foo",
24202 and the
24203 alignment of the zero-length bit-field is greater than the
24204 member that follows it, "bar", "bar" is aligned as the type of
24205 the zero-length bit-field.
24206
24207 For example:
24208
24209 struct
24210 {
24211 char foo : 4;
24212 short : 0;
24213 char bar;
24214 } t2;
24215
24216 struct
24217 {
24218 char foo : 4;
24219 short : 0;
24220 double bar;
24221 } t3;
24222
24223 For "t2", "bar" is placed at offset 2, rather than offset 1.
24224 Accordingly, the size of "t2" is 4. For "t3", the zero-length
24225 bit-field does not affect the alignment of "bar" or, as a
24226 result, the size of the structure.
24227
24228 Taking this into account, it is important to note the
24229 following:
24230
24231 1. If a zero-length bit-field follows a normal bit-field, the
24232 type of the
24233 zero-length bit-field may affect the alignment of the
24234 structure as whole. For example, "t2" has a size of 4
24235 bytes, since the zero-length bit-field follows a normal
24236 bit-field, and is of type short.
24237
24238 2. Even if a zero-length bit-field is not followed by a normal
24239 bit-field, it may
24240 still affect the alignment of the structure:
24241
24242 struct
24243 {
24244 char foo : 6;
24245 long : 0;
24246 } t4;
24247
24248 Here, "t4" takes up 4 bytes.
24249
24250 3. Zero-length bit-fields following non-bit-field members are
24251 ignored:
24252 struct
24253 {
24254 char foo;
24255 long : 0;
24256 char bar;
24257 } t5;
24258
24259 Here, "t5" takes up 2 bytes.
24260
24261 -mno-align-stringops
24262 Do not align the destination of inlined string operations. This
24263 switch reduces code size and improves performance in case the
24264 destination is already aligned, but GCC doesn't know about it.
24265
24266 -minline-all-stringops
24267 By default GCC inlines string operations only when the destination
24268 is known to be aligned to least a 4-byte boundary. This enables
24269 more inlining and increases code size, but may improve performance
24270 of code that depends on fast "memcpy", "strlen", and "memset" for
24271 short lengths.
24272
24273 -minline-stringops-dynamically
24274 For string operations of unknown size, use run-time checks with
24275 inline code for small blocks and a library call for large blocks.
24276
24277 -mstringop-strategy=alg
24278 Override the internal decision heuristic for the particular
24279 algorithm to use for inlining string operations. The allowed
24280 values for alg are:
24281
24282 rep_byte
24283 rep_4byte
24284 rep_8byte
24285 Expand using i386 "rep" prefix of the specified size.
24286
24287 byte_loop
24288 loop
24289 unrolled_loop
24290 Expand into an inline loop.
24291
24292 libcall
24293 Always use a library call.
24294
24295 -mmemcpy-strategy=strategy
24296 Override the internal decision heuristic to decide if
24297 "__builtin_memcpy" should be inlined and what inline algorithm to
24298 use when the expected size of the copy operation is known. strategy
24299 is a comma-separated list of alg:max_size:dest_align triplets. alg
24300 is specified in -mstringop-strategy, max_size specifies the max
24301 byte size with which inline algorithm alg is allowed. For the last
24302 triplet, the max_size must be "-1". The max_size of the triplets in
24303 the list must be specified in increasing order. The minimal byte
24304 size for alg is 0 for the first triplet and "max_size + 1" of the
24305 preceding range.
24306
24307 -mmemset-strategy=strategy
24308 The option is similar to -mmemcpy-strategy= except that it is to
24309 control "__builtin_memset" expansion.
24310
24311 -momit-leaf-frame-pointer
24312 Don't keep the frame pointer in a register for leaf functions.
24313 This avoids the instructions to save, set up, and restore frame
24314 pointers and makes an extra register available in leaf functions.
24315 The option -fomit-leaf-frame-pointer removes the frame pointer for
24316 leaf functions, which might make debugging harder.
24317
24318 -mtls-direct-seg-refs
24319 -mno-tls-direct-seg-refs
24320 Controls whether TLS variables may be accessed with offsets from
24321 the TLS segment register (%gs for 32-bit, %fs for 64-bit), or
24322 whether the thread base pointer must be added. Whether or not this
24323 is valid depends on the operating system, and whether it maps the
24324 segment to cover the entire TLS area.
24325
24326 For systems that use the GNU C Library, the default is on.
24327
24328 -msse2avx
24329 -mno-sse2avx
24330 Specify that the assembler should encode SSE instructions with VEX
24331 prefix. The option -mavx turns this on by default.
24332
24333 -mfentry
24334 -mno-fentry
24335 If profiling is active (-pg), put the profiling counter call before
24336 the prologue. Note: On x86 architectures the attribute
24337 "ms_hook_prologue" isn't possible at the moment for -mfentry and
24338 -pg.
24339
24340 -mrecord-mcount
24341 -mno-record-mcount
24342 If profiling is active (-pg), generate a __mcount_loc section that
24343 contains pointers to each profiling call. This is useful for
24344 automatically patching and out calls.
24345
24346 -mnop-mcount
24347 -mno-nop-mcount
24348 If profiling is active (-pg), generate the calls to the profiling
24349 functions as NOPs. This is useful when they should be patched in
24350 later dynamically. This is likely only useful together with
24351 -mrecord-mcount.
24352
24353 -minstrument-return=type
24354 Instrument function exit in -pg -mfentry instrumented functions
24355 with call to specified function. This only instruments true returns
24356 ending with ret, but not sibling calls ending with jump. Valid
24357 types are none to not instrument, call to generate a call to
24358 __return__, or nop5 to generate a 5 byte nop.
24359
24360 -mrecord-return
24361 -mno-record-return
24362 Generate a __return_loc section pointing to all return
24363 instrumentation code.
24364
24365 -mfentry-name=name
24366 Set name of __fentry__ symbol called at function entry for -pg
24367 -mfentry functions.
24368
24369 -mfentry-section=name
24370 Set name of section to record -mrecord-mcount calls (default
24371 __mcount_loc).
24372
24373 -mskip-rax-setup
24374 -mno-skip-rax-setup
24375 When generating code for the x86-64 architecture with SSE
24376 extensions disabled, -mskip-rax-setup can be used to skip setting
24377 up RAX register when there are no variable arguments passed in
24378 vector registers.
24379
24380 Warning: Since RAX register is used to avoid unnecessarily saving
24381 vector registers on stack when passing variable arguments, the
24382 impacts of this option are callees may waste some stack space,
24383 misbehave or jump to a random location. GCC 4.4 or newer don't
24384 have those issues, regardless the RAX register value.
24385
24386 -m8bit-idiv
24387 -mno-8bit-idiv
24388 On some processors, like Intel Atom, 8-bit unsigned integer divide
24389 is much faster than 32-bit/64-bit integer divide. This option
24390 generates a run-time check. If both dividend and divisor are
24391 within range of 0 to 255, 8-bit unsigned integer divide is used
24392 instead of 32-bit/64-bit integer divide.
24393
24394 -mavx256-split-unaligned-load
24395 -mavx256-split-unaligned-store
24396 Split 32-byte AVX unaligned load and store.
24397
24398 -mstack-protector-guard=guard
24399 -mstack-protector-guard-reg=reg
24400 -mstack-protector-guard-offset=offset
24401 Generate stack protection code using canary at guard. Supported
24402 locations are global for global canary or tls for per-thread canary
24403 in the TLS block (the default). This option has effect only when
24404 -fstack-protector or -fstack-protector-all is specified.
24405
24406 With the latter choice the options -mstack-protector-guard-reg=reg
24407 and -mstack-protector-guard-offset=offset furthermore specify which
24408 segment register (%fs or %gs) to use as base register for reading
24409 the canary, and from what offset from that base register. The
24410 default for those is as specified in the relevant ABI.
24411
24412 -mgeneral-regs-only
24413 Generate code that uses only the general-purpose registers. This
24414 prevents the compiler from using floating-point, vector, mask and
24415 bound registers.
24416
24417 -mindirect-branch=choice
24418 Convert indirect call and jump with choice. The default is keep,
24419 which keeps indirect call and jump unmodified. thunk converts
24420 indirect call and jump to call and return thunk. thunk-inline
24421 converts indirect call and jump to inlined call and return thunk.
24422 thunk-extern converts indirect call and jump to external call and
24423 return thunk provided in a separate object file. You can control
24424 this behavior for a specific function by using the function
24425 attribute "indirect_branch".
24426
24427 Note that -mcmodel=large is incompatible with
24428 -mindirect-branch=thunk and -mindirect-branch=thunk-extern since
24429 the thunk function may not be reachable in the large code model.
24430
24431 Note that -mindirect-branch=thunk-extern is incompatible with
24432 -fcf-protection=branch since the external thunk cannot be modified
24433 to disable control-flow check.
24434
24435 -mfunction-return=choice
24436 Convert function return with choice. The default is keep, which
24437 keeps function return unmodified. thunk converts function return
24438 to call and return thunk. thunk-inline converts function return to
24439 inlined call and return thunk. thunk-extern converts function
24440 return to external call and return thunk provided in a separate
24441 object file. You can control this behavior for a specific function
24442 by using the function attribute "function_return".
24443
24444 Note that -mcmodel=large is incompatible with
24445 -mfunction-return=thunk and -mfunction-return=thunk-extern since
24446 the thunk function may not be reachable in the large code model.
24447
24448 -mindirect-branch-register
24449 Force indirect call and jump via register.
24450
24451 These -m switches are supported in addition to the above on x86-64
24452 processors in 64-bit environments.
24453
24454 -m32
24455 -m64
24456 -mx32
24457 -m16
24458 -miamcu
24459 Generate code for a 16-bit, 32-bit or 64-bit environment. The -m32
24460 option sets "int", "long", and pointer types to 32 bits, and
24461 generates code that runs on any i386 system.
24462
24463 The -m64 option sets "int" to 32 bits and "long" and pointer types
24464 to 64 bits, and generates code for the x86-64 architecture. For
24465 Darwin only the -m64 option also turns off the -fno-pic and
24466 -mdynamic-no-pic options.
24467
24468 The -mx32 option sets "int", "long", and pointer types to 32 bits,
24469 and generates code for the x86-64 architecture.
24470
24471 The -m16 option is the same as -m32, except for that it outputs the
24472 ".code16gcc" assembly directive at the beginning of the assembly
24473 output so that the binary can run in 16-bit mode.
24474
24475 The -miamcu option generates code which conforms to Intel MCU
24476 psABI. It requires the -m32 option to be turned on.
24477
24478 -mno-red-zone
24479 Do not use a so-called "red zone" for x86-64 code. The red zone is
24480 mandated by the x86-64 ABI; it is a 128-byte area beyond the
24481 location of the stack pointer that is not modified by signal or
24482 interrupt handlers and therefore can be used for temporary data
24483 without adjusting the stack pointer. The flag -mno-red-zone
24484 disables this red zone.
24485
24486 -mcmodel=small
24487 Generate code for the small code model: the program and its symbols
24488 must be linked in the lower 2 GB of the address space. Pointers
24489 are 64 bits. Programs can be statically or dynamically linked.
24490 This is the default code model.
24491
24492 -mcmodel=kernel
24493 Generate code for the kernel code model. The kernel runs in the
24494 negative 2 GB of the address space. This model has to be used for
24495 Linux kernel code.
24496
24497 -mcmodel=medium
24498 Generate code for the medium model: the program is linked in the
24499 lower 2 GB of the address space. Small symbols are also placed
24500 there. Symbols with sizes larger than -mlarge-data-threshold are
24501 put into large data or BSS sections and can be located above 2GB.
24502 Programs can be statically or dynamically linked.
24503
24504 -mcmodel=large
24505 Generate code for the large model. This model makes no assumptions
24506 about addresses and sizes of sections.
24507
24508 -maddress-mode=long
24509 Generate code for long address mode. This is only supported for
24510 64-bit and x32 environments. It is the default address mode for
24511 64-bit environments.
24512
24513 -maddress-mode=short
24514 Generate code for short address mode. This is only supported for
24515 32-bit and x32 environments. It is the default address mode for
24516 32-bit and x32 environments.
24517
24518 x86 Windows Options
24519
24520 These additional options are available for Microsoft Windows targets:
24521
24522 -mconsole
24523 This option specifies that a console application is to be
24524 generated, by instructing the linker to set the PE header subsystem
24525 type required for console applications. This option is available
24526 for Cygwin and MinGW targets and is enabled by default on those
24527 targets.
24528
24529 -mdll
24530 This option is available for Cygwin and MinGW targets. It
24531 specifies that a DLL---a dynamic link library---is to be generated,
24532 enabling the selection of the required runtime startup object and
24533 entry point.
24534
24535 -mnop-fun-dllimport
24536 This option is available for Cygwin and MinGW targets. It
24537 specifies that the "dllimport" attribute should be ignored.
24538
24539 -mthread
24540 This option is available for MinGW targets. It specifies that
24541 MinGW-specific thread support is to be used.
24542
24543 -municode
24544 This option is available for MinGW-w64 targets. It causes the
24545 "UNICODE" preprocessor macro to be predefined, and chooses Unicode-
24546 capable runtime startup code.
24547
24548 -mwin32
24549 This option is available for Cygwin and MinGW targets. It
24550 specifies that the typical Microsoft Windows predefined macros are
24551 to be set in the pre-processor, but does not influence the choice
24552 of runtime library/startup code.
24553
24554 -mwindows
24555 This option is available for Cygwin and MinGW targets. It
24556 specifies that a GUI application is to be generated by instructing
24557 the linker to set the PE header subsystem type appropriately.
24558
24559 -fno-set-stack-executable
24560 This option is available for MinGW targets. It specifies that the
24561 executable flag for the stack used by nested functions isn't set.
24562 This is necessary for binaries running in kernel mode of Microsoft
24563 Windows, as there the User32 API, which is used to set executable
24564 privileges, isn't available.
24565
24566 -fwritable-relocated-rdata
24567 This option is available for MinGW and Cygwin targets. It
24568 specifies that relocated-data in read-only section is put into the
24569 ".data" section. This is a necessary for older runtimes not
24570 supporting modification of ".rdata" sections for pseudo-relocation.
24571
24572 -mpe-aligned-commons
24573 This option is available for Cygwin and MinGW targets. It
24574 specifies that the GNU extension to the PE file format that permits
24575 the correct alignment of COMMON variables should be used when
24576 generating code. It is enabled by default if GCC detects that the
24577 target assembler found during configuration supports the feature.
24578
24579 See also under x86 Options for standard options.
24580
24581 Xstormy16 Options
24582
24583 These options are defined for Xstormy16:
24584
24585 -msim
24586 Choose startup files and linker script suitable for the simulator.
24587
24588 Xtensa Options
24589
24590 These options are supported for Xtensa targets:
24591
24592 -mconst16
24593 -mno-const16
24594 Enable or disable use of "CONST16" instructions for loading
24595 constant values. The "CONST16" instruction is currently not a
24596 standard option from Tensilica. When enabled, "CONST16"
24597 instructions are always used in place of the standard "L32R"
24598 instructions. The use of "CONST16" is enabled by default only if
24599 the "L32R" instruction is not available.
24600
24601 -mfused-madd
24602 -mno-fused-madd
24603 Enable or disable use of fused multiply/add and multiply/subtract
24604 instructions in the floating-point option. This has no effect if
24605 the floating-point option is not also enabled. Disabling fused
24606 multiply/add and multiply/subtract instructions forces the compiler
24607 to use separate instructions for the multiply and add/subtract
24608 operations. This may be desirable in some cases where strict IEEE
24609 754-compliant results are required: the fused multiply add/subtract
24610 instructions do not round the intermediate result, thereby
24611 producing results with more bits of precision than specified by the
24612 IEEE standard. Disabling fused multiply add/subtract instructions
24613 also ensures that the program output is not sensitive to the
24614 compiler's ability to combine multiply and add/subtract operations.
24615
24616 -mserialize-volatile
24617 -mno-serialize-volatile
24618 When this option is enabled, GCC inserts "MEMW" instructions before
24619 "volatile" memory references to guarantee sequential consistency.
24620 The default is -mserialize-volatile. Use -mno-serialize-volatile
24621 to omit the "MEMW" instructions.
24622
24623 -mforce-no-pic
24624 For targets, like GNU/Linux, where all user-mode Xtensa code must
24625 be position-independent code (PIC), this option disables PIC for
24626 compiling kernel code.
24627
24628 -mtext-section-literals
24629 -mno-text-section-literals
24630 These options control the treatment of literal pools. The default
24631 is -mno-text-section-literals, which places literals in a separate
24632 section in the output file. This allows the literal pool to be
24633 placed in a data RAM/ROM, and it also allows the linker to combine
24634 literal pools from separate object files to remove redundant
24635 literals and improve code size. With -mtext-section-literals, the
24636 literals are interspersed in the text section in order to keep them
24637 as close as possible to their references. This may be necessary
24638 for large assembly files. Literals for each function are placed
24639 right before that function.
24640
24641 -mauto-litpools
24642 -mno-auto-litpools
24643 These options control the treatment of literal pools. The default
24644 is -mno-auto-litpools, which places literals in a separate section
24645 in the output file unless -mtext-section-literals is used. With
24646 -mauto-litpools the literals are interspersed in the text section
24647 by the assembler. Compiler does not produce explicit ".literal"
24648 directives and loads literals into registers with "MOVI"
24649 instructions instead of "L32R" to let the assembler do relaxation
24650 and place literals as necessary. This option allows assembler to
24651 create several literal pools per function and assemble very big
24652 functions, which may not be possible with -mtext-section-literals.
24653
24654 -mtarget-align
24655 -mno-target-align
24656 When this option is enabled, GCC instructs the assembler to
24657 automatically align instructions to reduce branch penalties at the
24658 expense of some code density. The assembler attempts to widen
24659 density instructions to align branch targets and the instructions
24660 following call instructions. If there are not enough preceding
24661 safe density instructions to align a target, no widening is
24662 performed. The default is -mtarget-align. These options do not
24663 affect the treatment of auto-aligned instructions like "LOOP",
24664 which the assembler always aligns, either by widening density
24665 instructions or by inserting NOP instructions.
24666
24667 -mlongcalls
24668 -mno-longcalls
24669 When this option is enabled, GCC instructs the assembler to
24670 translate direct calls to indirect calls unless it can determine
24671 that the target of a direct call is in the range allowed by the
24672 call instruction. This translation typically occurs for calls to
24673 functions in other source files. Specifically, the assembler
24674 translates a direct "CALL" instruction into an "L32R" followed by a
24675 "CALLX" instruction. The default is -mno-longcalls. This option
24676 should be used in programs where the call target can potentially be
24677 out of range. This option is implemented in the assembler, not the
24678 compiler, so the assembly code generated by GCC still shows direct
24679 call instructions---look at the disassembled object code to see the
24680 actual instructions. Note that the assembler uses an indirect call
24681 for every cross-file call, not just those that really are out of
24682 range.
24683
24684 zSeries Options
24685
24686 These are listed under
24687
24689 This section describes several environment variables that affect how
24690 GCC operates. Some of them work by specifying directories or prefixes
24691 to use when searching for various kinds of files. Some are used to
24692 specify other aspects of the compilation environment.
24693
24694 Note that you can also specify places to search using options such as
24695 -B, -I and -L. These take precedence over places specified using
24696 environment variables, which in turn take precedence over those
24697 specified by the configuration of GCC.
24698
24699 LANG
24700 LC_CTYPE
24701 LC_MESSAGES
24702 LC_ALL
24703 These environment variables control the way that GCC uses
24704 localization information which allows GCC to work with different
24705 national conventions. GCC inspects the locale categories LC_CTYPE
24706 and LC_MESSAGES if it has been configured to do so. These locale
24707 categories can be set to any value supported by your installation.
24708 A typical value is en_GB.UTF-8 for English in the United Kingdom
24709 encoded in UTF-8.
24710
24711 The LC_CTYPE environment variable specifies character
24712 classification. GCC uses it to determine the character boundaries
24713 in a string; this is needed for some multibyte encodings that
24714 contain quote and escape characters that are otherwise interpreted
24715 as a string end or escape.
24716
24717 The LC_MESSAGES environment variable specifies the language to use
24718 in diagnostic messages.
24719
24720 If the LC_ALL environment variable is set, it overrides the value
24721 of LC_CTYPE and LC_MESSAGES; otherwise, LC_CTYPE and LC_MESSAGES
24722 default to the value of the LANG environment variable. If none of
24723 these variables are set, GCC defaults to traditional C English
24724 behavior.
24725
24726 TMPDIR
24727 If TMPDIR is set, it specifies the directory to use for temporary
24728 files. GCC uses temporary files to hold the output of one stage of
24729 compilation which is to be used as input to the next stage: for
24730 example, the output of the preprocessor, which is the input to the
24731 compiler proper.
24732
24733 GCC_COMPARE_DEBUG
24734 Setting GCC_COMPARE_DEBUG is nearly equivalent to passing
24735 -fcompare-debug to the compiler driver. See the documentation of
24736 this option for more details.
24737
24738 GCC_EXEC_PREFIX
24739 If GCC_EXEC_PREFIX is set, it specifies a prefix to use in the
24740 names of the subprograms executed by the compiler. No slash is
24741 added when this prefix is combined with the name of a subprogram,
24742 but you can specify a prefix that ends with a slash if you wish.
24743
24744 If GCC_EXEC_PREFIX is not set, GCC attempts to figure out an
24745 appropriate prefix to use based on the pathname it is invoked with.
24746
24747 If GCC cannot find the subprogram using the specified prefix, it
24748 tries looking in the usual places for the subprogram.
24749
24750 The default value of GCC_EXEC_PREFIX is prefix/lib/gcc/ where
24751 prefix is the prefix to the installed compiler. In many cases
24752 prefix is the value of "prefix" when you ran the configure script.
24753
24754 Other prefixes specified with -B take precedence over this prefix.
24755
24756 This prefix is also used for finding files such as crt0.o that are
24757 used for linking.
24758
24759 In addition, the prefix is used in an unusual way in finding the
24760 directories to search for header files. For each of the standard
24761 directories whose name normally begins with /usr/local/lib/gcc
24762 (more precisely, with the value of GCC_INCLUDE_DIR), GCC tries
24763 replacing that beginning with the specified prefix to produce an
24764 alternate directory name. Thus, with -Bfoo/, GCC searches foo/bar
24765 just before it searches the standard directory /usr/local/lib/bar.
24766 If a standard directory begins with the configured prefix then the
24767 value of prefix is replaced by GCC_EXEC_PREFIX when looking for
24768 header files.
24769
24770 COMPILER_PATH
24771 The value of COMPILER_PATH is a colon-separated list of
24772 directories, much like PATH. GCC tries the directories thus
24773 specified when searching for subprograms, if it cannot find the
24774 subprograms using GCC_EXEC_PREFIX.
24775
24776 LIBRARY_PATH
24777 The value of LIBRARY_PATH is a colon-separated list of directories,
24778 much like PATH. When configured as a native compiler, GCC tries
24779 the directories thus specified when searching for special linker
24780 files, if it cannot find them using GCC_EXEC_PREFIX. Linking using
24781 GCC also uses these directories when searching for ordinary
24782 libraries for the -l option (but directories specified with -L come
24783 first).
24784
24785 LANG
24786 This variable is used to pass locale information to the compiler.
24787 One way in which this information is used is to determine the
24788 character set to be used when character literals, string literals
24789 and comments are parsed in C and C++. When the compiler is
24790 configured to allow multibyte characters, the following values for
24791 LANG are recognized:
24792
24793 C-JIS
24794 Recognize JIS characters.
24795
24796 C-SJIS
24797 Recognize SJIS characters.
24798
24799 C-EUCJP
24800 Recognize EUCJP characters.
24801
24802 If LANG is not defined, or if it has some other value, then the
24803 compiler uses "mblen" and "mbtowc" as defined by the default locale
24804 to recognize and translate multibyte characters.
24805
24806 Some additional environment variables affect the behavior of the
24807 preprocessor.
24808
24809 CPATH
24810 C_INCLUDE_PATH
24811 CPLUS_INCLUDE_PATH
24812 OBJC_INCLUDE_PATH
24813 Each variable's value is a list of directories separated by a
24814 special character, much like PATH, in which to look for header
24815 files. The special character, "PATH_SEPARATOR", is target-
24816 dependent and determined at GCC build time. For Microsoft Windows-
24817 based targets it is a semicolon, and for almost all other targets
24818 it is a colon.
24819
24820 CPATH specifies a list of directories to be searched as if
24821 specified with -I, but after any paths given with -I options on the
24822 command line. This environment variable is used regardless of
24823 which language is being preprocessed.
24824
24825 The remaining environment variables apply only when preprocessing
24826 the particular language indicated. Each specifies a list of
24827 directories to be searched as if specified with -isystem, but after
24828 any paths given with -isystem options on the command line.
24829
24830 In all these variables, an empty element instructs the compiler to
24831 search its current working directory. Empty elements can appear at
24832 the beginning or end of a path. For instance, if the value of
24833 CPATH is ":/special/include", that has the same effect as
24834 -I. -I/special/include.
24835
24836 DEPENDENCIES_OUTPUT
24837 If this variable is set, its value specifies how to output
24838 dependencies for Make based on the non-system header files
24839 processed by the compiler. System header files are ignored in the
24840 dependency output.
24841
24842 The value of DEPENDENCIES_OUTPUT can be just a file name, in which
24843 case the Make rules are written to that file, guessing the target
24844 name from the source file name. Or the value can have the form
24845 file target, in which case the rules are written to file file using
24846 target as the target name.
24847
24848 In other words, this environment variable is equivalent to
24849 combining the options -MM and -MF, with an optional -MT switch too.
24850
24851 SUNPRO_DEPENDENCIES
24852 This variable is the same as DEPENDENCIES_OUTPUT (see above),
24853 except that system header files are not ignored, so it implies -M
24854 rather than -MM. However, the dependence on the main input file is
24855 omitted.
24856
24857 SOURCE_DATE_EPOCH
24858 If this variable is set, its value specifies a UNIX timestamp to be
24859 used in replacement of the current date and time in the "__DATE__"
24860 and "__TIME__" macros, so that the embedded timestamps become
24861 reproducible.
24862
24863 The value of SOURCE_DATE_EPOCH must be a UNIX timestamp, defined as
24864 the number of seconds (excluding leap seconds) since 01 Jan 1970
24865 00:00:00 represented in ASCII; identical to the output of
24866 @command{date +%s} on GNU/Linux and other systems that support the
24867 %s extension in the "date" command.
24868
24869 The value should be a known timestamp such as the last modification
24870 time of the source or package and it should be set by the build
24871 process.
24872
24874 For instructions on reporting bugs, see
24875 <http://bugzilla.redhat.com/bugzilla/>.
24876
24878 1. On some systems, gcc -shared needs to build supplementary stub code
24879 for constructors to work. On multi-libbed systems, gcc -shared
24880 must select the correct support libraries to link against. Failing
24881 to supply the correct flags may lead to subtle defects. Supplying
24882 them in cases where they are not necessary is innocuous.
24883
24885 gpl(7), gfdl(7), fsf-funding(7), cpp(1), gcov(1), as(1), ld(1), gdb(1),
24886 dbx(1) and the Info entries for gcc, cpp, as, ld, binutils and gdb.
24887
24889 See the Info entry for gcc, or
24890 <http://gcc.gnu.org/onlinedocs/gcc/Contributors.html>, for contributors
24891 to GCC.
24892
24894 Copyright (c) 1988-2019 Free Software Foundation, Inc.
24895
24896 Permission is granted to copy, distribute and/or modify this document
24897 under the terms of the GNU Free Documentation License, Version 1.3 or
24898 any later version published by the Free Software Foundation; with the
24899 Invariant Sections being "GNU General Public License" and "Funding Free
24900 Software", the Front-Cover texts being (a) (see below), and with the
24901 Back-Cover Texts being (b) (see below). A copy of the license is
24902 included in the gfdl(7) man page.
24903
24904 (a) The FSF's Front-Cover Text is:
24905
24906 A GNU Manual
24907
24908 (b) The FSF's Back-Cover Text is:
24909
24910 You have freedom to copy and modify this GNU Manual, like GNU
24911 software. Copies published by the Free Software Foundation raise
24912 funds for GNU development.
24913
24914
24915
24916gcc-9 2019-05-03 GCC(1)