]> gcc.gnu.org Git - gcc.git/blob - gcc/doc/invoke.texi
invoke.texi (-fpeel-loops,-O3): Update documentation.
[gcc.git] / gcc / doc / invoke.texi
1 @c Copyright (C) 1988-2016 Free Software Foundation, Inc.
2 @c This is part of the GCC manual.
3 @c For copying conditions, see the file gcc.texi.
4
5 @ignore
6 @c man begin INCLUDE
7 @include gcc-vers.texi
8 @c man end
9
10 @c man begin COPYRIGHT
11 Copyright @copyright{} 1988-2016 Free Software Foundation, Inc.
12
13 Permission is granted to copy, distribute and/or modify this document
14 under the terms of the GNU Free Documentation License, Version 1.3 or
15 any later version published by the Free Software Foundation; with the
16 Invariant Sections being ``GNU General Public License'' and ``Funding
17 Free Software'', the Front-Cover texts being (a) (see below), and with
18 the Back-Cover Texts being (b) (see below). A copy of the license is
19 included in the gfdl(7) man page.
20
21 (a) The FSF's Front-Cover Text is:
22
23 A GNU Manual
24
25 (b) The FSF's Back-Cover Text is:
26
27 You have freedom to copy and modify this GNU Manual, like GNU
28 software. Copies published by the Free Software Foundation raise
29 funds for GNU development.
30 @c man end
31 @c Set file name and title for the man page.
32 @setfilename gcc
33 @settitle GNU project C and C++ compiler
34 @c man begin SYNOPSIS
35 gcc [@option{-c}|@option{-S}|@option{-E}] [@option{-std=}@var{standard}]
36 [@option{-g}] [@option{-pg}] [@option{-O}@var{level}]
37 [@option{-W}@var{warn}@dots{}] [@option{-Wpedantic}]
38 [@option{-I}@var{dir}@dots{}] [@option{-L}@var{dir}@dots{}]
39 [@option{-D}@var{macro}[=@var{defn}]@dots{}] [@option{-U}@var{macro}]
40 [@option{-f}@var{option}@dots{}] [@option{-m}@var{machine-option}@dots{}]
41 [@option{-o} @var{outfile}] [@@@var{file}] @var{infile}@dots{}
42
43 Only the most useful options are listed here; see below for the
44 remainder. @command{g++} accepts mostly the same options as @command{gcc}.
45 @c man end
46 @c man begin SEEALSO
47 gpl(7), gfdl(7), fsf-funding(7),
48 cpp(1), gcov(1), as(1), ld(1), gdb(1), adb(1), dbx(1), sdb(1)
49 and the Info entries for @file{gcc}, @file{cpp}, @file{as},
50 @file{ld}, @file{binutils} and @file{gdb}.
51 @c man end
52 @c man begin BUGS
53 For instructions on reporting bugs, see
54 @w{@value{BUGURL}}.
55 @c man end
56 @c man begin AUTHOR
57 See the Info entry for @command{gcc}, or
58 @w{@uref{http://gcc.gnu.org/onlinedocs/gcc/Contributors.html}},
59 for contributors to GCC@.
60 @c man end
61 @end ignore
62
63 @node Invoking GCC
64 @chapter GCC Command Options
65 @cindex GCC command options
66 @cindex command options
67 @cindex options, GCC command
68
69 @c man begin DESCRIPTION
70 When you invoke GCC, it normally does preprocessing, compilation,
71 assembly and linking. The ``overall options'' allow you to stop this
72 process at an intermediate stage. For example, the @option{-c} option
73 says not to run the linker. Then the output consists of object files
74 output by the assembler.
75 @xref{Overall Options,,Options Controlling the Kind of Output}.
76
77 Other options are passed on to one or more stages of processing. Some options
78 control the preprocessor and others the compiler itself. Yet other
79 options control the assembler and linker; most of these are not
80 documented here, since you rarely need to use any of them.
81
82 @cindex C compilation options
83 Most of the command-line options that you can use with GCC are useful
84 for C programs; when an option is only useful with another language
85 (usually C++), the explanation says so explicitly. If the description
86 for a particular option does not mention a source language, you can use
87 that option with all supported languages.
88
89 @cindex cross compiling
90 @cindex specifying machine version
91 @cindex specifying compiler version and target machine
92 @cindex compiler version, specifying
93 @cindex target machine, specifying
94 The usual way to run GCC is to run the executable called @command{gcc}, or
95 @command{@var{machine}-gcc} when cross-compiling, or
96 @command{@var{machine}-gcc-@var{version}} to run a specific version of GCC.
97 When you compile C++ programs, you should invoke GCC as @command{g++}
98 instead. @xref{Invoking G++,,Compiling C++ Programs},
99 for information about the differences in behavior between @command{gcc}
100 and @code{g++} when compiling C++ programs.
101
102 @cindex grouping options
103 @cindex options, grouping
104 The @command{gcc} program accepts options and file names as operands. Many
105 options have multi-letter names; therefore multiple single-letter options
106 may @emph{not} be grouped: @option{-dv} is very different from @w{@samp{-d
107 -v}}.
108
109 @cindex order of options
110 @cindex options, order
111 You can mix options and other arguments. For the most part, the order
112 you use doesn't matter. Order does matter when you use several
113 options of the same kind; for example, if you specify @option{-L} more
114 than once, the directories are searched in the order specified. Also,
115 the placement of the @option{-l} option is significant.
116
117 Many options have long names starting with @samp{-f} or with
118 @samp{-W}---for example,
119 @option{-fmove-loop-invariants}, @option{-Wformat} and so on. Most of
120 these have both positive and negative forms; the negative form of
121 @option{-ffoo} is @option{-fno-foo}. This manual documents
122 only one of these two forms, whichever one is not the default.
123
124 @c man end
125
126 @xref{Option Index}, for an index to GCC's options.
127
128 @menu
129 * Option Summary:: Brief list of all options, without explanations.
130 * Overall Options:: Controlling the kind of output:
131 an executable, object files, assembler files,
132 or preprocessed source.
133 * Invoking G++:: Compiling C++ programs.
134 * C Dialect Options:: Controlling the variant of C language compiled.
135 * C++ Dialect Options:: Variations on C++.
136 * Objective-C and Objective-C++ Dialect Options:: Variations on Objective-C
137 and Objective-C++.
138 * Diagnostic Message Formatting Options:: Controlling how diagnostics should
139 be formatted.
140 * Warning Options:: How picky should the compiler be?
141 * Debugging Options:: Producing debuggable code.
142 * Optimize Options:: How much optimization?
143 * Instrumentation Options:: Enabling profiling and extra run-time error checking.
144 * Preprocessor Options:: Controlling header files and macro definitions.
145 Also, getting dependency information for Make.
146 * Assembler Options:: Passing options to the assembler.
147 * Link Options:: Specifying libraries and so on.
148 * Directory Options:: Where to find header files and libraries.
149 Where to find the compiler executable files.
150 * Code Gen Options:: Specifying conventions for function calls, data layout
151 and register usage.
152 * Developer Options:: Printing GCC configuration info, statistics, and
153 debugging dumps.
154 * Submodel Options:: Target-specific options, such as compiling for a
155 specific processor variant.
156 * Spec Files:: How to pass switches to sub-processes.
157 * Environment Variables:: Env vars that affect GCC.
158 * Precompiled Headers:: Compiling a header once, and using it many times.
159 @end menu
160
161 @c man begin OPTIONS
162
163 @node Option Summary
164 @section Option Summary
165
166 Here is a summary of all the options, grouped by type. Explanations are
167 in the following sections.
168
169 @table @emph
170 @item Overall Options
171 @xref{Overall Options,,Options Controlling the Kind of Output}.
172 @gccoptlist{-c -S -E -o @var{file} -x @var{language} @gol
173 -v -### --help@r{[}=@var{class}@r{[},@dots{}@r{]]} --target-help --version @gol
174 -pass-exit-codes -pipe -specs=@var{file} -wrapper @gol
175 @@@var{file} -fplugin=@var{file} -fplugin-arg-@var{name}=@var{arg} @gol
176 -fdump-ada-spec@r{[}-slim@r{]} -fada-spec-parent=@var{unit} -fdump-go-spec=@var{file}}
177
178 @item C Language Options
179 @xref{C Dialect Options,,Options Controlling C Dialect}.
180 @gccoptlist{-ansi -std=@var{standard} -fgnu89-inline @gol
181 -aux-info @var{filename} -fallow-parameterless-variadic-functions @gol
182 -fno-asm -fno-builtin -fno-builtin-@var{function} @gol
183 -fhosted -ffreestanding -fopenacc -fopenmp -fopenmp-simd @gol
184 -fms-extensions -fplan9-extensions -fsso-struct=@var{endianness}
185 -fallow-single-precision -fcond-mismatch -flax-vector-conversions @gol
186 -fsigned-bitfields -fsigned-char @gol
187 -funsigned-bitfields -funsigned-char @gol
188 -trigraphs -traditional -traditional-cpp}
189
190 @item C++ Language Options
191 @xref{C++ Dialect Options,,Options Controlling C++ Dialect}.
192 @gccoptlist{-fabi-version=@var{n} -fno-access-control -fcheck-new @gol
193 -fconstexpr-depth=@var{n} -ffriend-injection @gol
194 -fno-elide-constructors @gol
195 -fno-enforce-eh-specs @gol
196 -ffor-scope -fno-for-scope -fno-gnu-keywords @gol
197 -fno-implicit-templates @gol
198 -fno-implicit-inline-templates @gol
199 -fno-implement-inlines -fms-extensions @gol
200 -fno-nonansi-builtins -fnothrow-opt -fno-operator-names @gol
201 -fno-optional-diags -fpermissive @gol
202 -fno-pretty-templates @gol
203 -frepo -fno-rtti -fsized-deallocation @gol
204 -ftemplate-backtrace-limit=@var{n} @gol
205 -ftemplate-depth=@var{n} @gol
206 -fno-threadsafe-statics -fuse-cxa-atexit @gol
207 -fno-weak -nostdinc++ @gol
208 -fvisibility-inlines-hidden @gol
209 -fvisibility-ms-compat @gol
210 -fext-numeric-literals @gol
211 -Wabi=@var{n} -Wabi-tag -Wconversion-null -Wctor-dtor-privacy @gol
212 -Wdelete-non-virtual-dtor -Wliteral-suffix -Wmultiple-inheritance @gol
213 -Wnamespaces -Wnarrowing @gol
214 -Wnoexcept -Wnon-virtual-dtor -Wreorder @gol
215 -Weffc++ -Wstrict-null-sentinel -Wtemplates @gol
216 -Wno-non-template-friend -Wold-style-cast @gol
217 -Woverloaded-virtual -Wno-pmf-conversions @gol
218 -Wsign-promo -Wvirtual-inheritance}
219
220 @item Objective-C and Objective-C++ Language Options
221 @xref{Objective-C and Objective-C++ Dialect Options,,Options Controlling
222 Objective-C and Objective-C++ Dialects}.
223 @gccoptlist{-fconstant-string-class=@var{class-name} @gol
224 -fgnu-runtime -fnext-runtime @gol
225 -fno-nil-receivers @gol
226 -fobjc-abi-version=@var{n} @gol
227 -fobjc-call-cxx-cdtors @gol
228 -fobjc-direct-dispatch @gol
229 -fobjc-exceptions @gol
230 -fobjc-gc @gol
231 -fobjc-nilcheck @gol
232 -fobjc-std=objc1 @gol
233 -fno-local-ivars @gol
234 -fivar-visibility=@r{[}public@r{|}protected@r{|}private@r{|}package@r{]} @gol
235 -freplace-objc-classes @gol
236 -fzero-link @gol
237 -gen-decls @gol
238 -Wassign-intercept @gol
239 -Wno-protocol -Wselector @gol
240 -Wstrict-selector-match @gol
241 -Wundeclared-selector}
242
243 @item Diagnostic Message Formatting Options
244 @xref{Diagnostic Message Formatting Options,,Options to Control Diagnostic Messages Formatting}.
245 @gccoptlist{-fmessage-length=@var{n} @gol
246 -fdiagnostics-show-location=@r{[}once@r{|}every-line@r{]} @gol
247 -fdiagnostics-color=@r{[}auto@r{|}never@r{|}always@r{]} @gol
248 -fno-diagnostics-show-option -fno-diagnostics-show-caret}
249
250 @item Warning Options
251 @xref{Warning Options,,Options to Request or Suppress Warnings}.
252 @gccoptlist{-fsyntax-only -fmax-errors=@var{n} -Wpedantic @gol
253 -pedantic-errors @gol
254 -w -Wextra -Wall -Waddress -Waggregate-return @gol
255 -Wno-aggressive-loop-optimizations -Warray-bounds -Warray-bounds=@var{n} @gol
256 -Wno-attributes -Wbool-compare -Wno-builtin-macro-redefined @gol
257 -Wc90-c99-compat -Wc99-c11-compat @gol
258 -Wc++-compat -Wc++11-compat -Wc++14-compat -Wcast-align -Wcast-qual @gol
259 -Wchar-subscripts -Wclobbered -Wcomment -Wconditionally-supported @gol
260 -Wconversion -Wcoverage-mismatch -Wno-cpp -Wdangling-else -Wdate-time @gol
261 -Wdelete-incomplete @gol
262 -Wno-deprecated -Wno-deprecated-declarations -Wno-designated-init @gol
263 -Wdisabled-optimization @gol
264 -Wno-discarded-qualifiers -Wno-discarded-array-qualifiers @gol
265 -Wno-div-by-zero -Wdouble-promotion -Wduplicated-cond @gol
266 -Wempty-body -Wenum-compare -Wno-endif-labels @gol
267 -Werror -Werror=* -Wfatal-errors -Wfloat-equal -Wformat -Wformat=2 @gol
268 -Wno-format-contains-nul -Wno-format-extra-args -Wformat-nonliteral @gol
269 -Wformat-security -Wformat-signedness -Wformat-y2k -Wframe-address @gol
270 -Wframe-larger-than=@var{len} -Wno-free-nonheap-object -Wjump-misses-init @gol
271 -Wignored-qualifiers -Wignored-attributes -Wincompatible-pointer-types @gol
272 -Wimplicit -Wimplicit-function-declaration -Wimplicit-int @gol
273 -Winit-self -Winline -Wno-int-conversion @gol
274 -Wno-int-to-pointer-cast -Winvalid-memory-model -Wno-invalid-offsetof @gol
275 -Winvalid-pch -Wlarger-than=@var{len} @gol
276 -Wlogical-op -Wlogical-not-parentheses -Wlong-long @gol
277 -Wmain -Wmaybe-uninitialized -Wmemset-elt-size -Wmemset-transposed-args @gol
278 -Wmisleading-indentation -Wmissing-braces @gol
279 -Wmissing-field-initializers -Wmissing-include-dirs @gol
280 -Wno-multichar -Wnonnull -Wnonnull-compare @gol
281 -Wnormalized=@r{[}none@r{|}id@r{|}nfc@r{|}nfkc@r{]} @gol
282 -Wnull-dereference -Wodr -Wno-overflow -Wopenmp-simd @gol
283 -Woverride-init-side-effects -Woverlength-strings @gol
284 -Wpacked -Wpacked-bitfield-compat -Wpadded @gol
285 -Wparentheses -Wno-pedantic-ms-format @gol
286 -Wplacement-new -Wplacement-new=@var{n} @gol
287 -Wpointer-arith -Wno-pointer-to-int-cast @gol
288 -Wno-pragmas -Wredundant-decls -Wno-return-local-addr @gol
289 -Wreturn-type -Wsequence-point -Wshadow -Wno-shadow-ivar @gol
290 -Wshift-overflow -Wshift-overflow=@var{n} @gol
291 -Wshift-count-negative -Wshift-count-overflow -Wshift-negative-value @gol
292 -Wsign-compare -Wsign-conversion -Wfloat-conversion @gol
293 -Wno-scalar-storage-order @gol
294 -Wsizeof-pointer-memaccess -Wsizeof-array-argument @gol
295 -Wstack-protector -Wstack-usage=@var{len} -Wstrict-aliasing @gol
296 -Wstrict-aliasing=n -Wstrict-overflow -Wstrict-overflow=@var{n} @gol
297 -Wsuggest-attribute=@r{[}pure@r{|}const@r{|}noreturn@r{|}format@r{]} @gol
298 -Wsuggest-final-types @gol -Wsuggest-final-methods -Wsuggest-override @gol
299 -Wmissing-format-attribute -Wsubobject-linkage @gol
300 -Wswitch -Wswitch-bool -Wswitch-default -Wswitch-enum @gol
301 -Wswitch-unreachable -Wsync-nand @gol
302 -Wsystem-headers -Wtautological-compare -Wtrampolines -Wtrigraphs @gol
303 -Wtype-limits -Wundef @gol
304 -Wuninitialized -Wunknown-pragmas -Wunsafe-loop-optimizations @gol
305 -Wunsuffixed-float-constants -Wunused -Wunused-function @gol
306 -Wunused-label -Wunused-local-typedefs -Wunused-parameter @gol
307 -Wno-unused-result -Wunused-value @gol -Wunused-variable @gol
308 -Wunused-const-variable -Wunused-const-variable=@var{n} @gol
309 -Wunused-but-set-parameter -Wunused-but-set-variable @gol
310 -Wuseless-cast -Wvariadic-macros -Wvector-operation-performance @gol
311 -Wvla -Wvolatile-register-var -Wwrite-strings @gol
312 -Wzero-as-null-pointer-constant -Whsa}
313
314 @item C and Objective-C-only Warning Options
315 @gccoptlist{-Wbad-function-cast -Wmissing-declarations @gol
316 -Wmissing-parameter-type -Wmissing-prototypes -Wnested-externs @gol
317 -Wold-style-declaration -Wold-style-definition @gol
318 -Wstrict-prototypes -Wtraditional -Wtraditional-conversion @gol
319 -Wdeclaration-after-statement -Wpointer-sign}
320
321 @item Debugging Options
322 @xref{Debugging Options,,Options for Debugging Your Program}.
323 @gccoptlist{-g -g@var{level} -gcoff -gdwarf -gdwarf-@var{version} @gol
324 -ggdb -grecord-gcc-switches -gno-record-gcc-switches @gol
325 -gstabs -gstabs+ -gstrict-dwarf -gno-strict-dwarf @gol
326 -gvms -gxcoff -gxcoff+ -gz@r{[}=@var{type}@r{]} @gol
327 -fdebug-prefix-map=@var{old}=@var{new} -fdebug-types-section @gol
328 -feliminate-dwarf2-dups -fno-eliminate-unused-debug-types @gol
329 -femit-struct-debug-baseonly -femit-struct-debug-reduced @gol
330 -femit-struct-debug-detailed@r{[}=@var{spec-list}@r{]} @gol
331 -feliminate-unused-debug-symbols -femit-class-debug-always @gol
332 -fno-merge-debug-strings -fno-dwarf2-cfi-asm @gol
333 -fvar-tracking -fvar-tracking-assignments}
334
335 @item Optimization Options
336 @xref{Optimize Options,,Options that Control Optimization}.
337 @gccoptlist{-faggressive-loop-optimizations -falign-functions[=@var{n}] @gol
338 -falign-jumps[=@var{n}] @gol
339 -falign-labels[=@var{n}] -falign-loops[=@var{n}] @gol
340 -fassociative-math -fauto-profile -fauto-profile[=@var{path}] @gol
341 -fauto-inc-dec -fbranch-probabilities @gol
342 -fbranch-target-load-optimize -fbranch-target-load-optimize2 @gol
343 -fbtr-bb-exclusive -fcaller-saves @gol
344 -fcombine-stack-adjustments -fconserve-stack @gol
345 -fcompare-elim -fcprop-registers -fcrossjumping @gol
346 -fcse-follow-jumps -fcse-skip-blocks -fcx-fortran-rules @gol
347 -fcx-limited-range @gol
348 -fdata-sections -fdce -fdelayed-branch @gol
349 -fdelete-null-pointer-checks -fdevirtualize -fdevirtualize-speculatively @gol
350 -fdevirtualize-at-ltrans -fdse @gol
351 -fearly-inlining -fipa-sra -fexpensive-optimizations -ffat-lto-objects @gol
352 -ffast-math -ffinite-math-only -ffloat-store -fexcess-precision=@var{style} @gol
353 -fforward-propagate -ffp-contract=@var{style} -ffunction-sections @gol
354 -fgcse -fgcse-after-reload -fgcse-las -fgcse-lm -fgraphite-identity @gol
355 -fgcse-sm -fhoist-adjacent-loads -fif-conversion @gol
356 -fif-conversion2 -findirect-inlining @gol
357 -finline-functions -finline-functions-called-once -finline-limit=@var{n} @gol
358 -finline-small-functions -fipa-cp -fipa-cp-clone -fipa-cp-alignment @gol
359 -fipa-pta -fipa-profile -fipa-pure-const -fipa-reference -fipa-icf @gol
360 -fira-algorithm=@var{algorithm} @gol
361 -fira-region=@var{region} -fira-hoist-pressure @gol
362 -fira-loop-pressure -fno-ira-share-save-slots @gol
363 -fno-ira-share-spill-slots @gol
364 -fisolate-erroneous-paths-dereference -fisolate-erroneous-paths-attribute @gol
365 -fivopts -fkeep-inline-functions -fkeep-static-functions @gol
366 -fkeep-static-consts -flive-range-shrinkage @gol
367 -floop-block -floop-interchange -floop-strip-mine @gol
368 -floop-unroll-and-jam -floop-nest-optimize @gol
369 -floop-parallelize-all -flra-remat -flto -flto-compression-level @gol
370 -flto-partition=@var{alg} -fmerge-all-constants @gol
371 -fmerge-constants -fmodulo-sched -fmodulo-sched-allow-regmoves @gol
372 -fmove-loop-invariants -fno-branch-count-reg @gol
373 -fno-defer-pop -fno-function-cse -fno-guess-branch-probability @gol
374 -fno-inline -fno-math-errno -fno-peephole -fno-peephole2 @gol
375 -fno-sched-interblock -fno-sched-spec -fno-signed-zeros @gol
376 -fno-toplevel-reorder -fno-trapping-math -fno-zero-initialized-in-bss @gol
377 -fomit-frame-pointer -foptimize-sibling-calls @gol
378 -fpartial-inlining -fpeel-loops -fpredictive-commoning @gol
379 -fprefetch-loop-arrays @gol
380 -fprofile-correction @gol
381 -fprofile-use -fprofile-use=@var{path} -fprofile-values @gol
382 -fprofile-reorder-functions @gol
383 -freciprocal-math -free -frename-registers -freorder-blocks @gol
384 -freorder-blocks-algorithm=@var{algorithm} @gol
385 -freorder-blocks-and-partition -freorder-functions @gol
386 -frerun-cse-after-loop -freschedule-modulo-scheduled-loops @gol
387 -frounding-math -fsched2-use-superblocks -fsched-pressure @gol
388 -fsched-spec-load -fsched-spec-load-dangerous @gol
389 -fsched-stalled-insns-dep[=@var{n}] -fsched-stalled-insns[=@var{n}] @gol
390 -fsched-group-heuristic -fsched-critical-path-heuristic @gol
391 -fsched-spec-insn-heuristic -fsched-rank-heuristic @gol
392 -fsched-last-insn-heuristic -fsched-dep-count-heuristic @gol
393 -fschedule-fusion @gol
394 -fschedule-insns -fschedule-insns2 -fsection-anchors @gol
395 -fselective-scheduling -fselective-scheduling2 @gol
396 -fsel-sched-pipelining -fsel-sched-pipelining-outer-loops @gol
397 -fsemantic-interposition -fshrink-wrap -fsignaling-nans @gol
398 -fsingle-precision-constant -fsplit-ivs-in-unroller @gol
399 -fsplit-paths @gol
400 -fsplit-wide-types -fssa-backprop -fssa-phiopt @gol
401 -fstdarg-opt -fstrict-aliasing @gol
402 -fstrict-overflow -fthread-jumps -ftracer -ftree-bit-ccp @gol
403 -ftree-builtin-call-dce -ftree-ccp -ftree-ch @gol
404 -ftree-coalesce-vars -ftree-copy-prop -ftree-dce -ftree-dominator-opts @gol
405 -ftree-dse -ftree-forwprop -ftree-fre -ftree-loop-if-convert @gol
406 -ftree-loop-if-convert-stores -ftree-loop-im @gol
407 -ftree-phiprop -ftree-loop-distribution -ftree-loop-distribute-patterns @gol
408 -ftree-loop-ivcanon -ftree-loop-linear -ftree-loop-optimize @gol
409 -ftree-loop-vectorize @gol
410 -ftree-parallelize-loops=@var{n} -ftree-pre -ftree-partial-pre -ftree-pta @gol
411 -ftree-reassoc -ftree-sink -ftree-slsr -ftree-sra @gol
412 -ftree-switch-conversion -ftree-tail-merge -ftree-ter @gol
413 -ftree-vectorize -ftree-vrp -funconstrained-commons @gol
414 -funit-at-a-time -funroll-all-loops -funroll-loops @gol
415 -funsafe-loop-optimizations -funsafe-math-optimizations -funswitch-loops @gol
416 -fipa-ra -fvariable-expansion-in-unroller -fvect-cost-model -fvpt @gol
417 -fweb -fwhole-program -fwpa -fuse-linker-plugin @gol
418 --param @var{name}=@var{value}
419 -O -O0 -O1 -O2 -O3 -Os -Ofast -Og}
420
421 @item Program Instrumentation Options
422 @xref{Instrumentation Options,,Program Instrumentation Options}.
423 @gccoptlist{-p -pg -fprofile-arcs --coverage -ftest-coverage @gol
424 -fprofile-dir=@var{path} -fprofile-generate -fprofile-generate=@var{path} @gol
425 -fsanitize=@var{style} -fsanitize-recover -fsanitize-recover=@var{style} @gol
426 -fasan-shadow-offset=@var{number} -fsanitize-sections=@var{s1},@var{s2},... @gol
427 -fsanitize-undefined-trap-on-error -fbounds-check @gol
428 -fcheck-pointer-bounds -fchkp-check-incomplete-type @gol
429 -fchkp-first-field-has-own-bounds -fchkp-narrow-bounds @gol
430 -fchkp-narrow-to-innermost-array -fchkp-optimize @gol
431 -fchkp-use-fast-string-functions -fchkp-use-nochk-string-functions @gol
432 -fchkp-use-static-bounds -fchkp-use-static-const-bounds @gol
433 -fchkp-treat-zero-dynamic-size-as-infinite -fchkp-check-read @gol
434 -fchkp-check-read -fchkp-check-write -fchkp-store-bounds @gol
435 -fchkp-instrument-calls -fchkp-instrument-marked-only @gol
436 -fchkp-use-wrappers @gol
437 -fstack-protector -fstack-protector-all -fstack-protector-strong @gol
438 -fstack-protector-explicit -fstack-check @gol
439 -fstack-limit-register=@var{reg} -fstack-limit-symbol=@var{sym} @gol
440 -fno-stack-limit -fsplit-stack @gol
441 -fvtable-verify=@r{[}std@r{|}preinit@r{|}none@r{]} @gol
442 -fvtv-counts -fvtv-debug @gol
443 -finstrument-functions @gol
444 -finstrument-functions-exclude-function-list=@var{sym},@var{sym},@dots{} @gol
445 -finstrument-functions-exclude-file-list=@var{file},@var{file},@dots{}}
446
447 @item Preprocessor Options
448 @xref{Preprocessor Options,,Options Controlling the Preprocessor}.
449 @gccoptlist{-A@var{question}=@var{answer} @gol
450 -A-@var{question}@r{[}=@var{answer}@r{]} @gol
451 -C -dD -dI -dM -dN @gol
452 -D@var{macro}@r{[}=@var{defn}@r{]} -E -H @gol
453 -idirafter @var{dir} @gol
454 -include @var{file} -imacros @var{file} @gol
455 -iprefix @var{file} -iwithprefix @var{dir} @gol
456 -iwithprefixbefore @var{dir} -isystem @var{dir} @gol
457 -imultilib @var{dir} -isysroot @var{dir} @gol
458 -M -MM -MF -MG -MP -MQ -MT -nostdinc @gol
459 -P -fdebug-cpp -ftrack-macro-expansion -fworking-directory @gol
460 -remap -trigraphs -undef -U@var{macro} @gol
461 -Wp,@var{option} -Xpreprocessor @var{option} -no-integrated-cpp}
462
463 @item Assembler Option
464 @xref{Assembler Options,,Passing Options to the Assembler}.
465 @gccoptlist{-Wa,@var{option} -Xassembler @var{option}}
466
467 @item Linker Options
468 @xref{Link Options,,Options for Linking}.
469 @gccoptlist{@var{object-file-name} -fuse-ld=@var{linker} -l@var{library} @gol
470 -nostartfiles -nodefaultlibs -nostdlib -pie -rdynamic @gol
471 -s -static -static-libgcc -static-libstdc++ @gol
472 -static-libasan -static-libtsan -static-liblsan -static-libubsan @gol
473 -static-libmpx -static-libmpxwrappers @gol
474 -shared -shared-libgcc -symbolic @gol
475 -T @var{script} -Wl,@var{option} -Xlinker @var{option} @gol
476 -u @var{symbol} -z @var{keyword}}
477
478 @item Directory Options
479 @xref{Directory Options,,Options for Directory Search}.
480 @gccoptlist{-B@var{prefix} -I@var{dir} -iplugindir=@var{dir} @gol
481 -iquote@var{dir} -L@var{dir} -no-canonical-prefixes -I- @gol
482 --sysroot=@var{dir} --no-sysroot-suffix}
483
484 @item Code Generation Options
485 @xref{Code Gen Options,,Options for Code Generation Conventions}.
486 @gccoptlist{-fcall-saved-@var{reg} -fcall-used-@var{reg} @gol
487 -ffixed-@var{reg} -fexceptions @gol
488 -fnon-call-exceptions -fdelete-dead-exceptions -funwind-tables @gol
489 -fasynchronous-unwind-tables @gol
490 -fno-gnu-unique @gol
491 -finhibit-size-directive -fno-common -fno-ident @gol
492 -fpcc-struct-return -fpic -fPIC -fpie -fPIE -fno-plt @gol
493 -fno-jump-tables @gol
494 -frecord-gcc-switches @gol
495 -freg-struct-return -fshort-enums -fshort-wchar @gol
496 -fverbose-asm -fpack-struct[=@var{n}] @gol
497 -fleading-underscore -ftls-model=@var{model} @gol
498 -fstack-reuse=@var{reuse_level} @gol
499 -ftrapv -fwrapv @gol
500 -fvisibility=@r{[}default@r{|}internal@r{|}hidden@r{|}protected@r{]} @gol
501 -fstrict-volatile-bitfields -fsync-libcalls}
502
503 @item Developer Options
504 @xref{Developer Options,,GCC Developer Options}.
505 @gccoptlist{-d@var{letters} -dumpspecs -dumpmachine -dumpversion @gol
506 -fchecking -fchecking=@var{n} -fdbg-cnt-list @gol
507 -fdbg-cnt=@var{counter-value-list} @gol
508 -fdisable-ipa-@var{pass_name} @gol
509 -fdisable-rtl-@var{pass_name} @gol
510 -fdisable-rtl-@var{pass-name}=@var{range-list} @gol
511 -fdisable-tree-@var{pass_name} @gol
512 -fdisable-tree-@var{pass-name}=@var{range-list} @gol
513 -fdump-noaddr -fdump-unnumbered -fdump-unnumbered-links @gol
514 -fdump-translation-unit@r{[}-@var{n}@r{]} @gol
515 -fdump-class-hierarchy@r{[}-@var{n}@r{]} @gol
516 -fdump-ipa-all -fdump-ipa-cgraph -fdump-ipa-inline @gol
517 -fdump-passes @gol
518 -fdump-rtl-@var{pass} -fdump-rtl-@var{pass}=@var{filename} @gol
519 -fdump-statistics @gol
520 -fdump-tree-all @gol
521 -fdump-tree-original@r{[}-@var{n}@r{]} @gol
522 -fdump-tree-optimized@r{[}-@var{n}@r{]} @gol
523 -fdump-tree-cfg -fdump-tree-alias @gol
524 -fdump-tree-ch @gol
525 -fdump-tree-ssa@r{[}-@var{n}@r{]} -fdump-tree-pre@r{[}-@var{n}@r{]} @gol
526 -fdump-tree-ccp@r{[}-@var{n}@r{]} -fdump-tree-dce@r{[}-@var{n}@r{]} @gol
527 -fdump-tree-gimple@r{[}-raw@r{]} @gol
528 -fdump-tree-dom@r{[}-@var{n}@r{]} @gol
529 -fdump-tree-dse@r{[}-@var{n}@r{]} @gol
530 -fdump-tree-phiprop@r{[}-@var{n}@r{]} @gol
531 -fdump-tree-phiopt@r{[}-@var{n}@r{]} @gol
532 -fdump-tree-backprop@r{[}-@var{n}@r{]} @gol
533 -fdump-tree-forwprop@r{[}-@var{n}@r{]} @gol
534 -fdump-tree-nrv -fdump-tree-vect @gol
535 -fdump-tree-sink @gol
536 -fdump-tree-sra@r{[}-@var{n}@r{]} @gol
537 -fdump-tree-forwprop@r{[}-@var{n}@r{]} @gol
538 -fdump-tree-fre@r{[}-@var{n}@r{]} @gol
539 -fdump-tree-vtable-verify @gol
540 -fdump-tree-vrp@r{[}-@var{n}@r{]} @gol
541 -fdump-tree-split-paths@r{[}-@var{n}@r{]} @gol
542 -fdump-tree-storeccp@r{[}-@var{n}@r{]} @gol
543 -fdump-final-insns=@var{file} @gol
544 -fcompare-debug@r{[}=@var{opts}@r{]} -fcompare-debug-second @gol
545 -fenable-@var{kind}-@var{pass} @gol
546 -fenable-@var{kind}-@var{pass}=@var{range-list} @gol
547 -fira-verbose=@var{n} @gol
548 -flto-report -flto-report-wpa -fmem-report-wpa @gol
549 -fmem-report -fpre-ipa-mem-report -fpost-ipa-mem-report @gol
550 -fopt-info -fopt-info-@var{options}@r{[}=@var{file}@r{]} @gol
551 -fprofile-report @gol
552 -frandom-seed=@var{string} -fsched-verbose=@var{n} @gol
553 -fsel-sched-verbose -fsel-sched-dump-cfg -fsel-sched-pipelining-verbose @gol
554 -fstats -fstack-usage -ftime-report @gol
555 -fvar-tracking-assignments-toggle -gtoggle @gol
556 -print-file-name=@var{library} -print-libgcc-file-name @gol
557 -print-multi-directory -print-multi-lib -print-multi-os-directory @gol
558 -print-prog-name=@var{program} -print-search-dirs -Q @gol
559 -print-sysroot -print-sysroot-headers-suffix @gol
560 -save-temps -save-temps=cwd -save-temps=obj -time@r{[}=@var{file}@r{]}}
561
562 @item Machine-Dependent Options
563 @xref{Submodel Options,,Machine-Dependent Options}.
564 @c This list is ordered alphanumerically by subsection name.
565 @c Try and put the significant identifier (CPU or system) first,
566 @c so users have a clue at guessing where the ones they want will be.
567
568 @emph{AArch64 Options}
569 @gccoptlist{-mabi=@var{name} -mbig-endian -mlittle-endian @gol
570 -mgeneral-regs-only @gol
571 -mcmodel=tiny -mcmodel=small -mcmodel=large @gol
572 -mstrict-align @gol
573 -momit-leaf-frame-pointer -mno-omit-leaf-frame-pointer @gol
574 -mtls-dialect=desc -mtls-dialect=traditional @gol
575 -mtls-size=@var{size} @gol
576 -mfix-cortex-a53-835769 -mno-fix-cortex-a53-835769 @gol
577 -mfix-cortex-a53-843419 -mno-fix-cortex-a53-843419 @gol
578 -mlow-precision-recip-sqrt -mno-low-precision-recip-sqrt@gol
579 -march=@var{name} -mcpu=@var{name} -mtune=@var{name}}
580
581 @emph{Adapteva Epiphany Options}
582 @gccoptlist{-mhalf-reg-file -mprefer-short-insn-regs @gol
583 -mbranch-cost=@var{num} -mcmove -mnops=@var{num} -msoft-cmpsf @gol
584 -msplit-lohi -mpost-inc -mpost-modify -mstack-offset=@var{num} @gol
585 -mround-nearest -mlong-calls -mshort-calls -msmall16 @gol
586 -mfp-mode=@var{mode} -mvect-double -max-vect-align=@var{num} @gol
587 -msplit-vecmove-early -m1reg-@var{reg}}
588
589 @emph{ARC Options}
590 @gccoptlist{-mbarrel-shifter @gol
591 -mcpu=@var{cpu} -mA6 -mARC600 -mA7 -mARC700 @gol
592 -mdpfp -mdpfp-compact -mdpfp-fast -mno-dpfp-lrsr @gol
593 -mea -mno-mpy -mmul32x16 -mmul64 -matomic @gol
594 -mnorm -mspfp -mspfp-compact -mspfp-fast -msimd -msoft-float -mswap @gol
595 -mcrc -mdsp-packa -mdvbf -mlock -mmac-d16 -mmac-24 -mrtsc -mswape @gol
596 -mtelephony -mxy -misize -mannotate-align -marclinux -marclinux_prof @gol
597 -mlong-calls -mmedium-calls -msdata @gol
598 -mucb-mcount -mvolatile-cache -mtp-regno=@var{regno} @gol
599 -malign-call -mauto-modify-reg -mbbit-peephole -mno-brcc @gol
600 -mcase-vector-pcrel -mcompact-casesi -mno-cond-exec -mearly-cbranchsi @gol
601 -mexpand-adddi -mindexed-loads -mlra -mlra-priority-none @gol
602 -mlra-priority-compact mlra-priority-noncompact -mno-millicode @gol
603 -mmixed-code -mq-class -mRcq -mRcw -msize-level=@var{level} @gol
604 -mtune=@var{cpu} -mmultcost=@var{num} @gol
605 -munalign-prob-threshold=@var{probability} -mmpy-option=@var{multo} @gol
606 -mdiv-rem -mcode-density -mll64 -mfpu=@var{fpu}}
607
608 @emph{ARM Options}
609 @gccoptlist{-mapcs-frame -mno-apcs-frame @gol
610 -mabi=@var{name} @gol
611 -mapcs-stack-check -mno-apcs-stack-check @gol
612 -mapcs-float -mno-apcs-float @gol
613 -mapcs-reentrant -mno-apcs-reentrant @gol
614 -msched-prolog -mno-sched-prolog @gol
615 -mlittle-endian -mbig-endian @gol
616 -mfloat-abi=@var{name} @gol
617 -mfp16-format=@var{name}
618 -mthumb-interwork -mno-thumb-interwork @gol
619 -mcpu=@var{name} -march=@var{name} -mfpu=@var{name} @gol
620 -mtune=@var{name} -mprint-tune-info @gol
621 -mstructure-size-boundary=@var{n} @gol
622 -mabort-on-noreturn @gol
623 -mlong-calls -mno-long-calls @gol
624 -msingle-pic-base -mno-single-pic-base @gol
625 -mpic-register=@var{reg} @gol
626 -mnop-fun-dllimport @gol
627 -mpoke-function-name @gol
628 -mthumb -marm @gol
629 -mtpcs-frame -mtpcs-leaf-frame @gol
630 -mcaller-super-interworking -mcallee-super-interworking @gol
631 -mtp=@var{name} -mtls-dialect=@var{dialect} @gol
632 -mword-relocations @gol
633 -mfix-cortex-m3-ldrd @gol
634 -munaligned-access @gol
635 -mneon-for-64bits @gol
636 -mslow-flash-data @gol
637 -masm-syntax-unified @gol
638 -mrestrict-it}
639
640 @emph{AVR Options}
641 @gccoptlist{-mmcu=@var{mcu} -maccumulate-args -mbranch-cost=@var{cost} @gol
642 -mcall-prologues -mint8 -mn_flash=@var{size} -mno-interrupts @gol
643 -mrelax -mrmw -mstrict-X -mtiny-stack -nodevicelib -Waddr-space-convert}
644
645 @emph{Blackfin Options}
646 @gccoptlist{-mcpu=@var{cpu}@r{[}-@var{sirevision}@r{]} @gol
647 -msim -momit-leaf-frame-pointer -mno-omit-leaf-frame-pointer @gol
648 -mspecld-anomaly -mno-specld-anomaly -mcsync-anomaly -mno-csync-anomaly @gol
649 -mlow-64k -mno-low64k -mstack-check-l1 -mid-shared-library @gol
650 -mno-id-shared-library -mshared-library-id=@var{n} @gol
651 -mleaf-id-shared-library -mno-leaf-id-shared-library @gol
652 -msep-data -mno-sep-data -mlong-calls -mno-long-calls @gol
653 -mfast-fp -minline-plt -mmulticore -mcorea -mcoreb -msdram @gol
654 -micplb}
655
656 @emph{C6X Options}
657 @gccoptlist{-mbig-endian -mlittle-endian -march=@var{cpu} @gol
658 -msim -msdata=@var{sdata-type}}
659
660 @emph{CRIS Options}
661 @gccoptlist{-mcpu=@var{cpu} -march=@var{cpu} -mtune=@var{cpu} @gol
662 -mmax-stack-frame=@var{n} -melinux-stacksize=@var{n} @gol
663 -metrax4 -metrax100 -mpdebug -mcc-init -mno-side-effects @gol
664 -mstack-align -mdata-align -mconst-align @gol
665 -m32-bit -m16-bit -m8-bit -mno-prologue-epilogue -mno-gotplt @gol
666 -melf -maout -melinux -mlinux -sim -sim2 @gol
667 -mmul-bug-workaround -mno-mul-bug-workaround}
668
669 @emph{CR16 Options}
670 @gccoptlist{-mmac @gol
671 -mcr16cplus -mcr16c @gol
672 -msim -mint32 -mbit-ops
673 -mdata-model=@var{model}}
674
675 @emph{Darwin Options}
676 @gccoptlist{-all_load -allowable_client -arch -arch_errors_fatal @gol
677 -arch_only -bind_at_load -bundle -bundle_loader @gol
678 -client_name -compatibility_version -current_version @gol
679 -dead_strip @gol
680 -dependency-file -dylib_file -dylinker_install_name @gol
681 -dynamic -dynamiclib -exported_symbols_list @gol
682 -filelist -flat_namespace -force_cpusubtype_ALL @gol
683 -force_flat_namespace -headerpad_max_install_names @gol
684 -iframework @gol
685 -image_base -init -install_name -keep_private_externs @gol
686 -multi_module -multiply_defined -multiply_defined_unused @gol
687 -noall_load -no_dead_strip_inits_and_terms @gol
688 -nofixprebinding -nomultidefs -noprebind -noseglinkedit @gol
689 -pagezero_size -prebind -prebind_all_twolevel_modules @gol
690 -private_bundle -read_only_relocs -sectalign @gol
691 -sectobjectsymbols -whyload -seg1addr @gol
692 -sectcreate -sectobjectsymbols -sectorder @gol
693 -segaddr -segs_read_only_addr -segs_read_write_addr @gol
694 -seg_addr_table -seg_addr_table_filename -seglinkedit @gol
695 -segprot -segs_read_only_addr -segs_read_write_addr @gol
696 -single_module -static -sub_library -sub_umbrella @gol
697 -twolevel_namespace -umbrella -undefined @gol
698 -unexported_symbols_list -weak_reference_mismatches @gol
699 -whatsloaded -F -gused -gfull -mmacosx-version-min=@var{version} @gol
700 -mkernel -mone-byte-bool}
701
702 @emph{DEC Alpha Options}
703 @gccoptlist{-mno-fp-regs -msoft-float @gol
704 -mieee -mieee-with-inexact -mieee-conformant @gol
705 -mfp-trap-mode=@var{mode} -mfp-rounding-mode=@var{mode} @gol
706 -mtrap-precision=@var{mode} -mbuild-constants @gol
707 -mcpu=@var{cpu-type} -mtune=@var{cpu-type} @gol
708 -mbwx -mmax -mfix -mcix @gol
709 -mfloat-vax -mfloat-ieee @gol
710 -mexplicit-relocs -msmall-data -mlarge-data @gol
711 -msmall-text -mlarge-text @gol
712 -mmemory-latency=@var{time}}
713
714 @emph{FR30 Options}
715 @gccoptlist{-msmall-model -mno-lsim}
716
717 @emph{FT32 Options}
718 @gccoptlist{-msim -mlra -mnodiv}
719
720 @emph{FRV Options}
721 @gccoptlist{-mgpr-32 -mgpr-64 -mfpr-32 -mfpr-64 @gol
722 -mhard-float -msoft-float @gol
723 -malloc-cc -mfixed-cc -mdword -mno-dword @gol
724 -mdouble -mno-double @gol
725 -mmedia -mno-media -mmuladd -mno-muladd @gol
726 -mfdpic -minline-plt -mgprel-ro -multilib-library-pic @gol
727 -mlinked-fp -mlong-calls -malign-labels @gol
728 -mlibrary-pic -macc-4 -macc-8 @gol
729 -mpack -mno-pack -mno-eflags -mcond-move -mno-cond-move @gol
730 -moptimize-membar -mno-optimize-membar @gol
731 -mscc -mno-scc -mcond-exec -mno-cond-exec @gol
732 -mvliw-branch -mno-vliw-branch @gol
733 -mmulti-cond-exec -mno-multi-cond-exec -mnested-cond-exec @gol
734 -mno-nested-cond-exec -mtomcat-stats @gol
735 -mTLS -mtls @gol
736 -mcpu=@var{cpu}}
737
738 @emph{GNU/Linux Options}
739 @gccoptlist{-mglibc -muclibc -mmusl -mbionic -mandroid @gol
740 -tno-android-cc -tno-android-ld}
741
742 @emph{H8/300 Options}
743 @gccoptlist{-mrelax -mh -ms -mn -mexr -mno-exr -mint32 -malign-300}
744
745 @emph{HPPA Options}
746 @gccoptlist{-march=@var{architecture-type} @gol
747 -mdisable-fpregs -mdisable-indexing @gol
748 -mfast-indirect-calls -mgas -mgnu-ld -mhp-ld @gol
749 -mfixed-range=@var{register-range} @gol
750 -mjump-in-delay -mlinker-opt -mlong-calls @gol
751 -mlong-load-store -mno-disable-fpregs @gol
752 -mno-disable-indexing -mno-fast-indirect-calls -mno-gas @gol
753 -mno-jump-in-delay -mno-long-load-store @gol
754 -mno-portable-runtime -mno-soft-float @gol
755 -mno-space-regs -msoft-float -mpa-risc-1-0 @gol
756 -mpa-risc-1-1 -mpa-risc-2-0 -mportable-runtime @gol
757 -mschedule=@var{cpu-type} -mspace-regs -msio -mwsio @gol
758 -munix=@var{unix-std} -nolibdld -static -threads}
759
760 @emph{IA-64 Options}
761 @gccoptlist{-mbig-endian -mlittle-endian -mgnu-as -mgnu-ld -mno-pic @gol
762 -mvolatile-asm-stop -mregister-names -msdata -mno-sdata @gol
763 -mconstant-gp -mauto-pic -mfused-madd @gol
764 -minline-float-divide-min-latency @gol
765 -minline-float-divide-max-throughput @gol
766 -mno-inline-float-divide @gol
767 -minline-int-divide-min-latency @gol
768 -minline-int-divide-max-throughput @gol
769 -mno-inline-int-divide @gol
770 -minline-sqrt-min-latency -minline-sqrt-max-throughput @gol
771 -mno-inline-sqrt @gol
772 -mdwarf2-asm -mearly-stop-bits @gol
773 -mfixed-range=@var{register-range} -mtls-size=@var{tls-size} @gol
774 -mtune=@var{cpu-type} -milp32 -mlp64 @gol
775 -msched-br-data-spec -msched-ar-data-spec -msched-control-spec @gol
776 -msched-br-in-data-spec -msched-ar-in-data-spec -msched-in-control-spec @gol
777 -msched-spec-ldc -msched-spec-control-ldc @gol
778 -msched-prefer-non-data-spec-insns -msched-prefer-non-control-spec-insns @gol
779 -msched-stop-bits-after-every-cycle -msched-count-spec-in-critical-path @gol
780 -msel-sched-dont-check-control-spec -msched-fp-mem-deps-zero-cost @gol
781 -msched-max-memory-insns-hard-limit -msched-max-memory-insns=@var{max-insns}}
782
783 @emph{LM32 Options}
784 @gccoptlist{-mbarrel-shift-enabled -mdivide-enabled -mmultiply-enabled @gol
785 -msign-extend-enabled -muser-enabled}
786
787 @emph{M32R/D Options}
788 @gccoptlist{-m32r2 -m32rx -m32r @gol
789 -mdebug @gol
790 -malign-loops -mno-align-loops @gol
791 -missue-rate=@var{number} @gol
792 -mbranch-cost=@var{number} @gol
793 -mmodel=@var{code-size-model-type} @gol
794 -msdata=@var{sdata-type} @gol
795 -mno-flush-func -mflush-func=@var{name} @gol
796 -mno-flush-trap -mflush-trap=@var{number} @gol
797 -G @var{num}}
798
799 @emph{M32C Options}
800 @gccoptlist{-mcpu=@var{cpu} -msim -memregs=@var{number}}
801
802 @emph{M680x0 Options}
803 @gccoptlist{-march=@var{arch} -mcpu=@var{cpu} -mtune=@var{tune} @gol
804 -m68000 -m68020 -m68020-40 -m68020-60 -m68030 -m68040 @gol
805 -m68060 -mcpu32 -m5200 -m5206e -m528x -m5307 -m5407 @gol
806 -mcfv4e -mbitfield -mno-bitfield -mc68000 -mc68020 @gol
807 -mnobitfield -mrtd -mno-rtd -mdiv -mno-div -mshort @gol
808 -mno-short -mhard-float -m68881 -msoft-float -mpcrel @gol
809 -malign-int -mstrict-align -msep-data -mno-sep-data @gol
810 -mshared-library-id=n -mid-shared-library -mno-id-shared-library @gol
811 -mxgot -mno-xgot}
812
813 @emph{MCore Options}
814 @gccoptlist{-mhardlit -mno-hardlit -mdiv -mno-div -mrelax-immediates @gol
815 -mno-relax-immediates -mwide-bitfields -mno-wide-bitfields @gol
816 -m4byte-functions -mno-4byte-functions -mcallgraph-data @gol
817 -mno-callgraph-data -mslow-bytes -mno-slow-bytes -mno-lsim @gol
818 -mlittle-endian -mbig-endian -m210 -m340 -mstack-increment}
819
820 @emph{MeP Options}
821 @gccoptlist{-mabsdiff -mall-opts -maverage -mbased=@var{n} -mbitops @gol
822 -mc=@var{n} -mclip -mconfig=@var{name} -mcop -mcop32 -mcop64 -mivc2 @gol
823 -mdc -mdiv -meb -mel -mio-volatile -ml -mleadz -mm -mminmax @gol
824 -mmult -mno-opts -mrepeat -ms -msatur -msdram -msim -msimnovec -mtf @gol
825 -mtiny=@var{n}}
826
827 @emph{MicroBlaze Options}
828 @gccoptlist{-msoft-float -mhard-float -msmall-divides -mcpu=@var{cpu} @gol
829 -mmemcpy -mxl-soft-mul -mxl-soft-div -mxl-barrel-shift @gol
830 -mxl-pattern-compare -mxl-stack-check -mxl-gp-opt -mno-clearbss @gol
831 -mxl-multiply-high -mxl-float-convert -mxl-float-sqrt @gol
832 -mbig-endian -mlittle-endian -mxl-reorder -mxl-mode-@var{app-model}}
833
834 @emph{MIPS Options}
835 @gccoptlist{-EL -EB -march=@var{arch} -mtune=@var{arch} @gol
836 -mips1 -mips2 -mips3 -mips4 -mips32 -mips32r2 -mips32r3 -mips32r5 @gol
837 -mips32r6 -mips64 -mips64r2 -mips64r3 -mips64r5 -mips64r6 @gol
838 -mips16 -mno-mips16 -mflip-mips16 @gol
839 -minterlink-compressed -mno-interlink-compressed @gol
840 -minterlink-mips16 -mno-interlink-mips16 @gol
841 -mabi=@var{abi} -mabicalls -mno-abicalls @gol
842 -mshared -mno-shared -mplt -mno-plt -mxgot -mno-xgot @gol
843 -mgp32 -mgp64 -mfp32 -mfpxx -mfp64 -mhard-float -msoft-float @gol
844 -mno-float -msingle-float -mdouble-float @gol
845 -modd-spreg -mno-odd-spreg @gol
846 -mabs=@var{mode} -mnan=@var{encoding} @gol
847 -mdsp -mno-dsp -mdspr2 -mno-dspr2 @gol
848 -mmcu -mmno-mcu @gol
849 -meva -mno-eva @gol
850 -mvirt -mno-virt @gol
851 -mxpa -mno-xpa @gol
852 -mmicromips -mno-micromips @gol
853 -mmsa -mno-msa @gol
854 -mfpu=@var{fpu-type} @gol
855 -msmartmips -mno-smartmips @gol
856 -mpaired-single -mno-paired-single -mdmx -mno-mdmx @gol
857 -mips3d -mno-mips3d -mmt -mno-mt -mllsc -mno-llsc @gol
858 -mlong64 -mlong32 -msym32 -mno-sym32 @gol
859 -G@var{num} -mlocal-sdata -mno-local-sdata @gol
860 -mextern-sdata -mno-extern-sdata -mgpopt -mno-gopt @gol
861 -membedded-data -mno-embedded-data @gol
862 -muninit-const-in-rodata -mno-uninit-const-in-rodata @gol
863 -mcode-readable=@var{setting} @gol
864 -msplit-addresses -mno-split-addresses @gol
865 -mexplicit-relocs -mno-explicit-relocs @gol
866 -mcheck-zero-division -mno-check-zero-division @gol
867 -mdivide-traps -mdivide-breaks @gol
868 -mmemcpy -mno-memcpy -mlong-calls -mno-long-calls @gol
869 -mmad -mno-mad -mimadd -mno-imadd -mfused-madd -mno-fused-madd -nocpp @gol
870 -mfix-24k -mno-fix-24k @gol
871 -mfix-r4000 -mno-fix-r4000 -mfix-r4400 -mno-fix-r4400 @gol
872 -mfix-r10000 -mno-fix-r10000 -mfix-rm7000 -mno-fix-rm7000 @gol
873 -mfix-vr4120 -mno-fix-vr4120 @gol
874 -mfix-vr4130 -mno-fix-vr4130 -mfix-sb1 -mno-fix-sb1 @gol
875 -mflush-func=@var{func} -mno-flush-func @gol
876 -mbranch-cost=@var{num} -mbranch-likely -mno-branch-likely @gol
877 -mcompact-branches=@var{policy} @gol
878 -mfp-exceptions -mno-fp-exceptions @gol
879 -mvr4130-align -mno-vr4130-align -msynci -mno-synci @gol
880 -mrelax-pic-calls -mno-relax-pic-calls -mmcount-ra-address @gol
881 -mframe-header-opt -mno-frame-header-opt}
882
883 @emph{MMIX Options}
884 @gccoptlist{-mlibfuncs -mno-libfuncs -mepsilon -mno-epsilon -mabi=gnu @gol
885 -mabi=mmixware -mzero-extend -mknuthdiv -mtoplevel-symbols @gol
886 -melf -mbranch-predict -mno-branch-predict -mbase-addresses @gol
887 -mno-base-addresses -msingle-exit -mno-single-exit}
888
889 @emph{MN10300 Options}
890 @gccoptlist{-mmult-bug -mno-mult-bug @gol
891 -mno-am33 -mam33 -mam33-2 -mam34 @gol
892 -mtune=@var{cpu-type} @gol
893 -mreturn-pointer-on-d0 @gol
894 -mno-crt0 -mrelax -mliw -msetlb}
895
896 @emph{Moxie Options}
897 @gccoptlist{-meb -mel -mmul.x -mno-crt0}
898
899 @emph{MSP430 Options}
900 @gccoptlist{-msim -masm-hex -mmcu= -mcpu= -mlarge -msmall -mrelax @gol
901 -mwarn-mcu @gol
902 -mcode-region= -mdata-region= @gol
903 -msilicon-errata= -msilicon-errata-warn= @gol
904 -mhwmult= -minrt}
905
906 @emph{NDS32 Options}
907 @gccoptlist{-mbig-endian -mlittle-endian @gol
908 -mreduced-regs -mfull-regs @gol
909 -mcmov -mno-cmov @gol
910 -mperf-ext -mno-perf-ext @gol
911 -mv3push -mno-v3push @gol
912 -m16bit -mno-16bit @gol
913 -misr-vector-size=@var{num} @gol
914 -mcache-block-size=@var{num} @gol
915 -march=@var{arch} @gol
916 -mcmodel=@var{code-model} @gol
917 -mctor-dtor -mrelax}
918
919 @emph{Nios II Options}
920 @gccoptlist{-G @var{num} -mgpopt=@var{option} -mgpopt -mno-gpopt @gol
921 -mel -meb @gol
922 -mno-bypass-cache -mbypass-cache @gol
923 -mno-cache-volatile -mcache-volatile @gol
924 -mno-fast-sw-div -mfast-sw-div @gol
925 -mhw-mul -mno-hw-mul -mhw-mulx -mno-hw-mulx -mno-hw-div -mhw-div @gol
926 -mcustom-@var{insn}=@var{N} -mno-custom-@var{insn} @gol
927 -mcustom-fpu-cfg=@var{name} @gol
928 -mhal -msmallc -msys-crt0=@var{name} -msys-lib=@var{name} @gol
929 -march=@var{arch} -mbmx -mno-bmx -mcdx -mno-cdx}
930
931 @emph{Nvidia PTX Options}
932 @gccoptlist{-m32 -m64 -mmainkernel -moptimize}
933
934 @emph{PDP-11 Options}
935 @gccoptlist{-mfpu -msoft-float -mac0 -mno-ac0 -m40 -m45 -m10 @gol
936 -mbcopy -mbcopy-builtin -mint32 -mno-int16 @gol
937 -mint16 -mno-int32 -mfloat32 -mno-float64 @gol
938 -mfloat64 -mno-float32 -mabshi -mno-abshi @gol
939 -mbranch-expensive -mbranch-cheap @gol
940 -munix-asm -mdec-asm}
941
942 @emph{picoChip Options}
943 @gccoptlist{-mae=@var{ae_type} -mvliw-lookahead=@var{N} @gol
944 -msymbol-as-address -mno-inefficient-warnings}
945
946 @emph{PowerPC Options}
947 See RS/6000 and PowerPC Options.
948
949 @emph{RL78 Options}
950 @gccoptlist{-msim -mmul=none -mmul=g13 -mmul=g14 -mallregs @gol
951 -mcpu=g10 -mcpu=g13 -mcpu=g14 -mg10 -mg13 -mg14 @gol
952 -m64bit-doubles -m32bit-doubles -msave-mduc-in-interrupts}
953
954 @emph{RS/6000 and PowerPC Options}
955 @gccoptlist{-mcpu=@var{cpu-type} @gol
956 -mtune=@var{cpu-type} @gol
957 -mcmodel=@var{code-model} @gol
958 -mpowerpc64 @gol
959 -maltivec -mno-altivec @gol
960 -mpowerpc-gpopt -mno-powerpc-gpopt @gol
961 -mpowerpc-gfxopt -mno-powerpc-gfxopt @gol
962 -mmfcrf -mno-mfcrf -mpopcntb -mno-popcntb -mpopcntd -mno-popcntd @gol
963 -mfprnd -mno-fprnd @gol
964 -mcmpb -mno-cmpb -mmfpgpr -mno-mfpgpr -mhard-dfp -mno-hard-dfp @gol
965 -mfull-toc -mminimal-toc -mno-fp-in-toc -mno-sum-in-toc @gol
966 -m64 -m32 -mxl-compat -mno-xl-compat -mpe @gol
967 -malign-power -malign-natural @gol
968 -msoft-float -mhard-float -mmultiple -mno-multiple @gol
969 -msingle-float -mdouble-float -msimple-fpu @gol
970 -mstring -mno-string -mupdate -mno-update @gol
971 -mavoid-indexed-addresses -mno-avoid-indexed-addresses @gol
972 -mfused-madd -mno-fused-madd -mbit-align -mno-bit-align @gol
973 -mstrict-align -mno-strict-align -mrelocatable @gol
974 -mno-relocatable -mrelocatable-lib -mno-relocatable-lib @gol
975 -mtoc -mno-toc -mlittle -mlittle-endian -mbig -mbig-endian @gol
976 -mdynamic-no-pic -maltivec -mswdiv -msingle-pic-base @gol
977 -mprioritize-restricted-insns=@var{priority} @gol
978 -msched-costly-dep=@var{dependence_type} @gol
979 -minsert-sched-nops=@var{scheme} @gol
980 -mcall-sysv -mcall-netbsd @gol
981 -maix-struct-return -msvr4-struct-return @gol
982 -mabi=@var{abi-type} -msecure-plt -mbss-plt @gol
983 -mblock-move-inline-limit=@var{num} @gol
984 -misel -mno-isel @gol
985 -misel=yes -misel=no @gol
986 -mspe -mno-spe @gol
987 -mspe=yes -mspe=no @gol
988 -mpaired @gol
989 -mgen-cell-microcode -mwarn-cell-microcode @gol
990 -mvrsave -mno-vrsave @gol
991 -mmulhw -mno-mulhw @gol
992 -mdlmzb -mno-dlmzb @gol
993 -mfloat-gprs=yes -mfloat-gprs=no -mfloat-gprs=single -mfloat-gprs=double @gol
994 -mprototype -mno-prototype @gol
995 -msim -mmvme -mads -myellowknife -memb -msdata @gol
996 -msdata=@var{opt} -mvxworks -G @var{num} -pthread @gol
997 -mrecip -mrecip=@var{opt} -mno-recip -mrecip-precision @gol
998 -mno-recip-precision @gol
999 -mveclibabi=@var{type} -mfriz -mno-friz @gol
1000 -mpointers-to-nested-functions -mno-pointers-to-nested-functions @gol
1001 -msave-toc-indirect -mno-save-toc-indirect @gol
1002 -mpower8-fusion -mno-mpower8-fusion -mpower8-vector -mno-power8-vector @gol
1003 -mcrypto -mno-crypto -mdirect-move -mno-direct-move @gol
1004 -mquad-memory -mno-quad-memory @gol
1005 -mquad-memory-atomic -mno-quad-memory-atomic @gol
1006 -mcompat-align-parm -mno-compat-align-parm @gol
1007 -mupper-regs-df -mno-upper-regs-df -mupper-regs-sf -mno-upper-regs-sf @gol
1008 -mupper-regs -mno-upper-regs -mmodulo -mno-modulo @gol
1009 -mfloat128 -mno-float128 -mfloat128-hardware -mno-float128-hardware @gol
1010 -mpower9-fusion -mno-mpower9-fusion -mpower9-vector -mno-power9-vector @gol
1011 -mpower9-dform -mno-power9-dform -mlra -mno-lra}
1012
1013 @emph{RX Options}
1014 @gccoptlist{-m64bit-doubles -m32bit-doubles -fpu -nofpu@gol
1015 -mcpu=@gol
1016 -mbig-endian-data -mlittle-endian-data @gol
1017 -msmall-data @gol
1018 -msim -mno-sim@gol
1019 -mas100-syntax -mno-as100-syntax@gol
1020 -mrelax@gol
1021 -mmax-constant-size=@gol
1022 -mint-register=@gol
1023 -mpid@gol
1024 -mallow-string-insns -mno-allow-string-insns@gol
1025 -mjsr@gol
1026 -mno-warn-multiple-fast-interrupts@gol
1027 -msave-acc-in-interrupts}
1028
1029 @emph{S/390 and zSeries Options}
1030 @gccoptlist{-mtune=@var{cpu-type} -march=@var{cpu-type} @gol
1031 -mhard-float -msoft-float -mhard-dfp -mno-hard-dfp @gol
1032 -mlong-double-64 -mlong-double-128 @gol
1033 -mbackchain -mno-backchain -mpacked-stack -mno-packed-stack @gol
1034 -msmall-exec -mno-small-exec -mmvcle -mno-mvcle @gol
1035 -m64 -m31 -mdebug -mno-debug -mesa -mzarch @gol
1036 -mhtm -mvx -mzvector @gol
1037 -mtpf-trace -mno-tpf-trace -mfused-madd -mno-fused-madd @gol
1038 -mwarn-framesize -mwarn-dynamicstack -mstack-size -mstack-guard @gol
1039 -mhotpatch=@var{halfwords},@var{halfwords}}
1040
1041 @emph{Score Options}
1042 @gccoptlist{-meb -mel @gol
1043 -mnhwloop @gol
1044 -muls @gol
1045 -mmac @gol
1046 -mscore5 -mscore5u -mscore7 -mscore7d}
1047
1048 @emph{SH Options}
1049 @gccoptlist{-m1 -m2 -m2e @gol
1050 -m2a-nofpu -m2a-single-only -m2a-single -m2a @gol
1051 -m3 -m3e @gol
1052 -m4-nofpu -m4-single-only -m4-single -m4 @gol
1053 -m4a-nofpu -m4a-single-only -m4a-single -m4a -m4al @gol
1054 -mb -ml -mdalign -mrelax @gol
1055 -mbigtable -mfmovd -mrenesas -mno-renesas -mnomacsave @gol
1056 -mieee -mno-ieee -mbitops -misize -minline-ic_invalidate -mpadstruct @gol
1057 -mprefergot -musermode -multcost=@var{number} -mdiv=@var{strategy} @gol
1058 -mdivsi3_libfunc=@var{name} -mfixed-range=@var{register-range} @gol
1059 -maccumulate-outgoing-args @gol
1060 -matomic-model=@var{atomic-model} @gol
1061 -mbranch-cost=@var{num} -mzdcbranch -mno-zdcbranch @gol
1062 -mcbranch-force-delay-slot @gol
1063 -mfused-madd -mno-fused-madd -mfsca -mno-fsca -mfsrra -mno-fsrra @gol
1064 -mpretend-cmove -mtas}
1065
1066 @emph{Solaris 2 Options}
1067 @gccoptlist{-mclear-hwcap -mno-clear-hwcap -mimpure-text -mno-impure-text @gol
1068 -pthreads -pthread}
1069
1070 @emph{SPARC Options}
1071 @gccoptlist{-mcpu=@var{cpu-type} @gol
1072 -mtune=@var{cpu-type} @gol
1073 -mcmodel=@var{code-model} @gol
1074 -mmemory-model=@var{mem-model} @gol
1075 -m32 -m64 -mapp-regs -mno-app-regs @gol
1076 -mfaster-structs -mno-faster-structs -mflat -mno-flat @gol
1077 -mfpu -mno-fpu -mhard-float -msoft-float @gol
1078 -mhard-quad-float -msoft-quad-float @gol
1079 -mstack-bias -mno-stack-bias @gol
1080 -mstd-struct-return -mno-std-struct-return @gol
1081 -munaligned-doubles -mno-unaligned-doubles @gol
1082 -muser-mode -mno-user-mode @gol
1083 -mv8plus -mno-v8plus -mvis -mno-vis @gol
1084 -mvis2 -mno-vis2 -mvis3 -mno-vis3 @gol
1085 -mcbcond -mno-cbcond @gol
1086 -mfmaf -mno-fmaf -mpopc -mno-popc @gol
1087 -mfix-at697f -mfix-ut699}
1088
1089 @emph{SPU Options}
1090 @gccoptlist{-mwarn-reloc -merror-reloc @gol
1091 -msafe-dma -munsafe-dma @gol
1092 -mbranch-hints @gol
1093 -msmall-mem -mlarge-mem -mstdmain @gol
1094 -mfixed-range=@var{register-range} @gol
1095 -mea32 -mea64 @gol
1096 -maddress-space-conversion -mno-address-space-conversion @gol
1097 -mcache-size=@var{cache-size} @gol
1098 -matomic-updates -mno-atomic-updates}
1099
1100 @emph{System V Options}
1101 @gccoptlist{-Qy -Qn -YP,@var{paths} -Ym,@var{dir}}
1102
1103 @emph{TILE-Gx Options}
1104 @gccoptlist{-mcpu=CPU -m32 -m64 -mbig-endian -mlittle-endian @gol
1105 -mcmodel=@var{code-model}}
1106
1107 @emph{TILEPro Options}
1108 @gccoptlist{-mcpu=@var{cpu} -m32}
1109
1110 @emph{V850 Options}
1111 @gccoptlist{-mlong-calls -mno-long-calls -mep -mno-ep @gol
1112 -mprolog-function -mno-prolog-function -mspace @gol
1113 -mtda=@var{n} -msda=@var{n} -mzda=@var{n} @gol
1114 -mapp-regs -mno-app-regs @gol
1115 -mdisable-callt -mno-disable-callt @gol
1116 -mv850e2v3 -mv850e2 -mv850e1 -mv850es @gol
1117 -mv850e -mv850 -mv850e3v5 @gol
1118 -mloop @gol
1119 -mrelax @gol
1120 -mlong-jumps @gol
1121 -msoft-float @gol
1122 -mhard-float @gol
1123 -mgcc-abi @gol
1124 -mrh850-abi @gol
1125 -mbig-switch}
1126
1127 @emph{VAX Options}
1128 @gccoptlist{-mg -mgnu -munix}
1129
1130 @emph{Visium Options}
1131 @gccoptlist{-mdebug -msim -mfpu -mno-fpu -mhard-float -msoft-float @gol
1132 -mcpu=@var{cpu-type} -mtune=@var{cpu-type} -msv-mode -muser-mode}
1133
1134 @emph{VMS Options}
1135 @gccoptlist{-mvms-return-codes -mdebug-main=@var{prefix} -mmalloc64 @gol
1136 -mpointer-size=@var{size}}
1137
1138 @emph{VxWorks Options}
1139 @gccoptlist{-mrtp -non-static -Bstatic -Bdynamic @gol
1140 -Xbind-lazy -Xbind-now}
1141
1142 @emph{x86 Options}
1143 @gccoptlist{-mtune=@var{cpu-type} -march=@var{cpu-type} @gol
1144 -mtune-ctrl=@var{feature-list} -mdump-tune-features -mno-default @gol
1145 -mfpmath=@var{unit} @gol
1146 -masm=@var{dialect} -mno-fancy-math-387 @gol
1147 -mno-fp-ret-in-387 -msoft-float @gol
1148 -mno-wide-multiply -mrtd -malign-double @gol
1149 -mpreferred-stack-boundary=@var{num} @gol
1150 -mincoming-stack-boundary=@var{num} @gol
1151 -mcld -mcx16 -msahf -mmovbe -mcrc32 @gol
1152 -mrecip -mrecip=@var{opt} @gol
1153 -mvzeroupper -mprefer-avx128 @gol
1154 -mmmx -msse -msse2 -msse3 -mssse3 -msse4.1 -msse4.2 -msse4 -mavx @gol
1155 -mavx2 -mavx512f -mavx512pf -mavx512er -mavx512cd -mavx512vl @gol
1156 -mavx512bw -mavx512dq -mavx512ifma -mavx512vbmi -msha -maes @gol
1157 -mpclmul -mfsgsbase -mrdrnd -mf16c -mfma @gol
1158 -mprefetchwt1 -mclflushopt -mxsavec -mxsaves @gol
1159 -msse4a -m3dnow -mpopcnt -mabm -mbmi -mtbm -mfma4 -mxop -mlzcnt @gol
1160 -mbmi2 -mfxsr -mxsave -mxsaveopt -mrtm -mlwp -mmpx -mmwaitx -mclzero
1161 -mpku -mthreads @gol
1162 -mms-bitfields -mno-align-stringops -minline-all-stringops @gol
1163 -minline-stringops-dynamically -mstringop-strategy=@var{alg} @gol
1164 -mmemcpy-strategy=@var{strategy} -mmemset-strategy=@var{strategy} @gol
1165 -mpush-args -maccumulate-outgoing-args -m128bit-long-double @gol
1166 -m96bit-long-double -mlong-double-64 -mlong-double-80 -mlong-double-128 @gol
1167 -mregparm=@var{num} -msseregparm @gol
1168 -mveclibabi=@var{type} -mvect8-ret-in-mem @gol
1169 -mpc32 -mpc64 -mpc80 -mstackrealign @gol
1170 -momit-leaf-frame-pointer -mno-red-zone -mno-tls-direct-seg-refs @gol
1171 -mcmodel=@var{code-model} -mabi=@var{name} -maddress-mode=@var{mode} @gol
1172 -m32 -m64 -mx32 -m16 -miamcu -mlarge-data-threshold=@var{num} @gol
1173 -msse2avx -mfentry -mrecord-mcount -mnop-mcount -m8bit-idiv @gol
1174 -mavx256-split-unaligned-load -mavx256-split-unaligned-store @gol
1175 -malign-data=@var{type} -mstack-protector-guard=@var{guard} @gol
1176 -mmitigate-rop -mgeneral-regs-only}
1177
1178 @emph{x86 Windows Options}
1179 @gccoptlist{-mconsole -mcygwin -mno-cygwin -mdll @gol
1180 -mnop-fun-dllimport -mthread @gol
1181 -municode -mwin32 -mwindows -fno-set-stack-executable}
1182
1183 @emph{Xstormy16 Options}
1184 @gccoptlist{-msim}
1185
1186 @emph{Xtensa Options}
1187 @gccoptlist{-mconst16 -mno-const16 @gol
1188 -mfused-madd -mno-fused-madd @gol
1189 -mforce-no-pic @gol
1190 -mserialize-volatile -mno-serialize-volatile @gol
1191 -mtext-section-literals -mno-text-section-literals @gol
1192 -mauto-litpools -mno-auto-litpools @gol
1193 -mtarget-align -mno-target-align @gol
1194 -mlongcalls -mno-longcalls}
1195
1196 @emph{zSeries Options}
1197 See S/390 and zSeries Options.
1198 @end table
1199
1200
1201 @node Overall Options
1202 @section Options Controlling the Kind of Output
1203
1204 Compilation can involve up to four stages: preprocessing, compilation
1205 proper, assembly and linking, always in that order. GCC is capable of
1206 preprocessing and compiling several files either into several
1207 assembler input files, or into one assembler input file; then each
1208 assembler input file produces an object file, and linking combines all
1209 the object files (those newly compiled, and those specified as input)
1210 into an executable file.
1211
1212 @cindex file name suffix
1213 For any given input file, the file name suffix determines what kind of
1214 compilation is done:
1215
1216 @table @gcctabopt
1217 @item @var{file}.c
1218 C source code that must be preprocessed.
1219
1220 @item @var{file}.i
1221 C source code that should not be preprocessed.
1222
1223 @item @var{file}.ii
1224 C++ source code that should not be preprocessed.
1225
1226 @item @var{file}.m
1227 Objective-C source code. Note that you must link with the @file{libobjc}
1228 library to make an Objective-C program work.
1229
1230 @item @var{file}.mi
1231 Objective-C source code that should not be preprocessed.
1232
1233 @item @var{file}.mm
1234 @itemx @var{file}.M
1235 Objective-C++ source code. Note that you must link with the @file{libobjc}
1236 library to make an Objective-C++ program work. Note that @samp{.M} refers
1237 to a literal capital M@.
1238
1239 @item @var{file}.mii
1240 Objective-C++ source code that should not be preprocessed.
1241
1242 @item @var{file}.h
1243 C, C++, Objective-C or Objective-C++ header file to be turned into a
1244 precompiled header (default), or C, C++ header file to be turned into an
1245 Ada spec (via the @option{-fdump-ada-spec} switch).
1246
1247 @item @var{file}.cc
1248 @itemx @var{file}.cp
1249 @itemx @var{file}.cxx
1250 @itemx @var{file}.cpp
1251 @itemx @var{file}.CPP
1252 @itemx @var{file}.c++
1253 @itemx @var{file}.C
1254 C++ source code that must be preprocessed. Note that in @samp{.cxx},
1255 the last two letters must both be literally @samp{x}. Likewise,
1256 @samp{.C} refers to a literal capital C@.
1257
1258 @item @var{file}.mm
1259 @itemx @var{file}.M
1260 Objective-C++ source code that must be preprocessed.
1261
1262 @item @var{file}.mii
1263 Objective-C++ source code that should not be preprocessed.
1264
1265 @item @var{file}.hh
1266 @itemx @var{file}.H
1267 @itemx @var{file}.hp
1268 @itemx @var{file}.hxx
1269 @itemx @var{file}.hpp
1270 @itemx @var{file}.HPP
1271 @itemx @var{file}.h++
1272 @itemx @var{file}.tcc
1273 C++ header file to be turned into a precompiled header or Ada spec.
1274
1275 @item @var{file}.f
1276 @itemx @var{file}.for
1277 @itemx @var{file}.ftn
1278 Fixed form Fortran source code that should not be preprocessed.
1279
1280 @item @var{file}.F
1281 @itemx @var{file}.FOR
1282 @itemx @var{file}.fpp
1283 @itemx @var{file}.FPP
1284 @itemx @var{file}.FTN
1285 Fixed form Fortran source code that must be preprocessed (with the traditional
1286 preprocessor).
1287
1288 @item @var{file}.f90
1289 @itemx @var{file}.f95
1290 @itemx @var{file}.f03
1291 @itemx @var{file}.f08
1292 Free form Fortran source code that should not be preprocessed.
1293
1294 @item @var{file}.F90
1295 @itemx @var{file}.F95
1296 @itemx @var{file}.F03
1297 @itemx @var{file}.F08
1298 Free form Fortran source code that must be preprocessed (with the
1299 traditional preprocessor).
1300
1301 @item @var{file}.go
1302 Go source code.
1303
1304 @c FIXME: Descriptions of Java file types.
1305 @c @var{file}.java
1306 @c @var{file}.class
1307 @c @var{file}.zip
1308 @c @var{file}.jar
1309
1310 @item @var{file}.ads
1311 Ada source code file that contains a library unit declaration (a
1312 declaration of a package, subprogram, or generic, or a generic
1313 instantiation), or a library unit renaming declaration (a package,
1314 generic, or subprogram renaming declaration). Such files are also
1315 called @dfn{specs}.
1316
1317 @item @var{file}.adb
1318 Ada source code file containing a library unit body (a subprogram or
1319 package body). Such files are also called @dfn{bodies}.
1320
1321 @c GCC also knows about some suffixes for languages not yet included:
1322 @c Pascal:
1323 @c @var{file}.p
1324 @c @var{file}.pas
1325 @c Ratfor:
1326 @c @var{file}.r
1327
1328 @item @var{file}.s
1329 Assembler code.
1330
1331 @item @var{file}.S
1332 @itemx @var{file}.sx
1333 Assembler code that must be preprocessed.
1334
1335 @item @var{other}
1336 An object file to be fed straight into linking.
1337 Any file name with no recognized suffix is treated this way.
1338 @end table
1339
1340 @opindex x
1341 You can specify the input language explicitly with the @option{-x} option:
1342
1343 @table @gcctabopt
1344 @item -x @var{language}
1345 Specify explicitly the @var{language} for the following input files
1346 (rather than letting the compiler choose a default based on the file
1347 name suffix). This option applies to all following input files until
1348 the next @option{-x} option. Possible values for @var{language} are:
1349 @smallexample
1350 c c-header cpp-output
1351 c++ c++-header c++-cpp-output
1352 objective-c objective-c-header objective-c-cpp-output
1353 objective-c++ objective-c++-header objective-c++-cpp-output
1354 assembler assembler-with-cpp
1355 ada
1356 f77 f77-cpp-input f95 f95-cpp-input
1357 go
1358 java
1359 @end smallexample
1360
1361 @item -x none
1362 Turn off any specification of a language, so that subsequent files are
1363 handled according to their file name suffixes (as they are if @option{-x}
1364 has not been used at all).
1365 @end table
1366
1367 If you only want some of the stages of compilation, you can use
1368 @option{-x} (or filename suffixes) to tell @command{gcc} where to start, and
1369 one of the options @option{-c}, @option{-S}, or @option{-E} to say where
1370 @command{gcc} is to stop. Note that some combinations (for example,
1371 @samp{-x cpp-output -E}) instruct @command{gcc} to do nothing at all.
1372
1373 @table @gcctabopt
1374 @item -c
1375 @opindex c
1376 Compile or assemble the source files, but do not link. The linking
1377 stage simply is not done. The ultimate output is in the form of an
1378 object file for each source file.
1379
1380 By default, the object file name for a source file is made by replacing
1381 the suffix @samp{.c}, @samp{.i}, @samp{.s}, etc., with @samp{.o}.
1382
1383 Unrecognized input files, not requiring compilation or assembly, are
1384 ignored.
1385
1386 @item -S
1387 @opindex S
1388 Stop after the stage of compilation proper; do not assemble. The output
1389 is in the form of an assembler code file for each non-assembler input
1390 file specified.
1391
1392 By default, the assembler file name for a source file is made by
1393 replacing the suffix @samp{.c}, @samp{.i}, etc., with @samp{.s}.
1394
1395 Input files that don't require compilation are ignored.
1396
1397 @item -E
1398 @opindex E
1399 Stop after the preprocessing stage; do not run the compiler proper. The
1400 output is in the form of preprocessed source code, which is sent to the
1401 standard output.
1402
1403 Input files that don't require preprocessing are ignored.
1404
1405 @cindex output file option
1406 @item -o @var{file}
1407 @opindex o
1408 Place output in file @var{file}. This applies to whatever
1409 sort of output is being produced, whether it be an executable file,
1410 an object file, an assembler file or preprocessed C code.
1411
1412 If @option{-o} is not specified, the default is to put an executable
1413 file in @file{a.out}, the object file for
1414 @file{@var{source}.@var{suffix}} in @file{@var{source}.o}, its
1415 assembler file in @file{@var{source}.s}, a precompiled header file in
1416 @file{@var{source}.@var{suffix}.gch}, and all preprocessed C source on
1417 standard output.
1418
1419 @item -v
1420 @opindex v
1421 Print (on standard error output) the commands executed to run the stages
1422 of compilation. Also print the version number of the compiler driver
1423 program and of the preprocessor and the compiler proper.
1424
1425 @item -###
1426 @opindex ###
1427 Like @option{-v} except the commands are not executed and arguments
1428 are quoted unless they contain only alphanumeric characters or @code{./-_}.
1429 This is useful for shell scripts to capture the driver-generated command lines.
1430
1431 @item --help
1432 @opindex help
1433 Print (on the standard output) a description of the command-line options
1434 understood by @command{gcc}. If the @option{-v} option is also specified
1435 then @option{--help} is also passed on to the various processes
1436 invoked by @command{gcc}, so that they can display the command-line options
1437 they accept. If the @option{-Wextra} option has also been specified
1438 (prior to the @option{--help} option), then command-line options that
1439 have no documentation associated with them are also displayed.
1440
1441 @item --target-help
1442 @opindex target-help
1443 Print (on the standard output) a description of target-specific command-line
1444 options for each tool. For some targets extra target-specific
1445 information may also be printed.
1446
1447 @item --help=@{@var{class}@r{|[}^@r{]}@var{qualifier}@}@r{[},@dots{}@r{]}
1448 Print (on the standard output) a description of the command-line
1449 options understood by the compiler that fit into all specified classes
1450 and qualifiers. These are the supported classes:
1451
1452 @table @asis
1453 @item @samp{optimizers}
1454 Display all of the optimization options supported by the
1455 compiler.
1456
1457 @item @samp{warnings}
1458 Display all of the options controlling warning messages
1459 produced by the compiler.
1460
1461 @item @samp{target}
1462 Display target-specific options. Unlike the
1463 @option{--target-help} option however, target-specific options of the
1464 linker and assembler are not displayed. This is because those
1465 tools do not currently support the extended @option{--help=} syntax.
1466
1467 @item @samp{params}
1468 Display the values recognized by the @option{--param}
1469 option.
1470
1471 @item @var{language}
1472 Display the options supported for @var{language}, where
1473 @var{language} is the name of one of the languages supported in this
1474 version of GCC@.
1475
1476 @item @samp{common}
1477 Display the options that are common to all languages.
1478 @end table
1479
1480 These are the supported qualifiers:
1481
1482 @table @asis
1483 @item @samp{undocumented}
1484 Display only those options that are undocumented.
1485
1486 @item @samp{joined}
1487 Display options taking an argument that appears after an equal
1488 sign in the same continuous piece of text, such as:
1489 @samp{--help=target}.
1490
1491 @item @samp{separate}
1492 Display options taking an argument that appears as a separate word
1493 following the original option, such as: @samp{-o output-file}.
1494 @end table
1495
1496 Thus for example to display all the undocumented target-specific
1497 switches supported by the compiler, use:
1498
1499 @smallexample
1500 --help=target,undocumented
1501 @end smallexample
1502
1503 The sense of a qualifier can be inverted by prefixing it with the
1504 @samp{^} character, so for example to display all binary warning
1505 options (i.e., ones that are either on or off and that do not take an
1506 argument) that have a description, use:
1507
1508 @smallexample
1509 --help=warnings,^joined,^undocumented
1510 @end smallexample
1511
1512 The argument to @option{--help=} should not consist solely of inverted
1513 qualifiers.
1514
1515 Combining several classes is possible, although this usually
1516 restricts the output so much that there is nothing to display. One
1517 case where it does work, however, is when one of the classes is
1518 @var{target}. For example, to display all the target-specific
1519 optimization options, use:
1520
1521 @smallexample
1522 --help=target,optimizers
1523 @end smallexample
1524
1525 The @option{--help=} option can be repeated on the command line. Each
1526 successive use displays its requested class of options, skipping
1527 those that have already been displayed.
1528
1529 If the @option{-Q} option appears on the command line before the
1530 @option{--help=} option, then the descriptive text displayed by
1531 @option{--help=} is changed. Instead of describing the displayed
1532 options, an indication is given as to whether the option is enabled,
1533 disabled or set to a specific value (assuming that the compiler
1534 knows this at the point where the @option{--help=} option is used).
1535
1536 Here is a truncated example from the ARM port of @command{gcc}:
1537
1538 @smallexample
1539 % gcc -Q -mabi=2 --help=target -c
1540 The following options are target specific:
1541 -mabi= 2
1542 -mabort-on-noreturn [disabled]
1543 -mapcs [disabled]
1544 @end smallexample
1545
1546 The output is sensitive to the effects of previous command-line
1547 options, so for example it is possible to find out which optimizations
1548 are enabled at @option{-O2} by using:
1549
1550 @smallexample
1551 -Q -O2 --help=optimizers
1552 @end smallexample
1553
1554 Alternatively you can discover which binary optimizations are enabled
1555 by @option{-O3} by using:
1556
1557 @smallexample
1558 gcc -c -Q -O3 --help=optimizers > /tmp/O3-opts
1559 gcc -c -Q -O2 --help=optimizers > /tmp/O2-opts
1560 diff /tmp/O2-opts /tmp/O3-opts | grep enabled
1561 @end smallexample
1562
1563 @item --version
1564 @opindex version
1565 Display the version number and copyrights of the invoked GCC@.
1566
1567 @item -pass-exit-codes
1568 @opindex pass-exit-codes
1569 Normally the @command{gcc} program exits with the code of 1 if any
1570 phase of the compiler returns a non-success return code. If you specify
1571 @option{-pass-exit-codes}, the @command{gcc} program instead returns with
1572 the numerically highest error produced by any phase returning an error
1573 indication. The C, C++, and Fortran front ends return 4 if an internal
1574 compiler error is encountered.
1575
1576 @item -pipe
1577 @opindex pipe
1578 Use pipes rather than temporary files for communication between the
1579 various stages of compilation. This fails to work on some systems where
1580 the assembler is unable to read from a pipe; but the GNU assembler has
1581 no trouble.
1582
1583 @item -specs=@var{file}
1584 @opindex specs
1585 Process @var{file} after the compiler reads in the standard @file{specs}
1586 file, in order to override the defaults which the @command{gcc} driver
1587 program uses when determining what switches to pass to @command{cc1},
1588 @command{cc1plus}, @command{as}, @command{ld}, etc. More than one
1589 @option{-specs=@var{file}} can be specified on the command line, and they
1590 are processed in order, from left to right. @xref{Spec Files}, for
1591 information about the format of the @var{file}.
1592
1593 @item -wrapper
1594 @opindex wrapper
1595 Invoke all subcommands under a wrapper program. The name of the
1596 wrapper program and its parameters are passed as a comma separated
1597 list.
1598
1599 @smallexample
1600 gcc -c t.c -wrapper gdb,--args
1601 @end smallexample
1602
1603 @noindent
1604 This invokes all subprograms of @command{gcc} under
1605 @samp{gdb --args}, thus the invocation of @command{cc1} is
1606 @samp{gdb --args cc1 @dots{}}.
1607
1608 @item -fplugin=@var{name}.so
1609 @opindex fplugin
1610 Load the plugin code in file @var{name}.so, assumed to be a
1611 shared object to be dlopen'd by the compiler. The base name of
1612 the shared object file is used to identify the plugin for the
1613 purposes of argument parsing (See
1614 @option{-fplugin-arg-@var{name}-@var{key}=@var{value}} below).
1615 Each plugin should define the callback functions specified in the
1616 Plugins API.
1617
1618 @item -fplugin-arg-@var{name}-@var{key}=@var{value}
1619 @opindex fplugin-arg
1620 Define an argument called @var{key} with a value of @var{value}
1621 for the plugin called @var{name}.
1622
1623 @item -fdump-ada-spec@r{[}-slim@r{]}
1624 @opindex fdump-ada-spec
1625 For C and C++ source and include files, generate corresponding Ada specs.
1626 @xref{Generating Ada Bindings for C and C++ headers,,, gnat_ugn,
1627 GNAT User's Guide}, which provides detailed documentation on this feature.
1628
1629 @item -fada-spec-parent=@var{unit}
1630 @opindex fada-spec-parent
1631 In conjunction with @option{-fdump-ada-spec@r{[}-slim@r{]}} above, generate
1632 Ada specs as child units of parent @var{unit}.
1633
1634 @item -fdump-go-spec=@var{file}
1635 @opindex fdump-go-spec
1636 For input files in any language, generate corresponding Go
1637 declarations in @var{file}. This generates Go @code{const},
1638 @code{type}, @code{var}, and @code{func} declarations which may be a
1639 useful way to start writing a Go interface to code written in some
1640 other language.
1641
1642 @include @value{srcdir}/../libiberty/at-file.texi
1643 @end table
1644
1645 @node Invoking G++
1646 @section Compiling C++ Programs
1647
1648 @cindex suffixes for C++ source
1649 @cindex C++ source file suffixes
1650 C++ source files conventionally use one of the suffixes @samp{.C},
1651 @samp{.cc}, @samp{.cpp}, @samp{.CPP}, @samp{.c++}, @samp{.cp}, or
1652 @samp{.cxx}; C++ header files often use @samp{.hh}, @samp{.hpp},
1653 @samp{.H}, or (for shared template code) @samp{.tcc}; and
1654 preprocessed C++ files use the suffix @samp{.ii}. GCC recognizes
1655 files with these names and compiles them as C++ programs even if you
1656 call the compiler the same way as for compiling C programs (usually
1657 with the name @command{gcc}).
1658
1659 @findex g++
1660 @findex c++
1661 However, the use of @command{gcc} does not add the C++ library.
1662 @command{g++} is a program that calls GCC and automatically specifies linking
1663 against the C++ library. It treats @samp{.c},
1664 @samp{.h} and @samp{.i} files as C++ source files instead of C source
1665 files unless @option{-x} is used. This program is also useful when
1666 precompiling a C header file with a @samp{.h} extension for use in C++
1667 compilations. On many systems, @command{g++} is also installed with
1668 the name @command{c++}.
1669
1670 @cindex invoking @command{g++}
1671 When you compile C++ programs, you may specify many of the same
1672 command-line options that you use for compiling programs in any
1673 language; or command-line options meaningful for C and related
1674 languages; or options that are meaningful only for C++ programs.
1675 @xref{C Dialect Options,,Options Controlling C Dialect}, for
1676 explanations of options for languages related to C@.
1677 @xref{C++ Dialect Options,,Options Controlling C++ Dialect}, for
1678 explanations of options that are meaningful only for C++ programs.
1679
1680 @node C Dialect Options
1681 @section Options Controlling C Dialect
1682 @cindex dialect options
1683 @cindex language dialect options
1684 @cindex options, dialect
1685
1686 The following options control the dialect of C (or languages derived
1687 from C, such as C++, Objective-C and Objective-C++) that the compiler
1688 accepts:
1689
1690 @table @gcctabopt
1691 @cindex ANSI support
1692 @cindex ISO support
1693 @item -ansi
1694 @opindex ansi
1695 In C mode, this is equivalent to @option{-std=c90}. In C++ mode, it is
1696 equivalent to @option{-std=c++98}.
1697
1698 This turns off certain features of GCC that are incompatible with ISO
1699 C90 (when compiling C code), or of standard C++ (when compiling C++ code),
1700 such as the @code{asm} and @code{typeof} keywords, and
1701 predefined macros such as @code{unix} and @code{vax} that identify the
1702 type of system you are using. It also enables the undesirable and
1703 rarely used ISO trigraph feature. For the C compiler,
1704 it disables recognition of C++ style @samp{//} comments as well as
1705 the @code{inline} keyword.
1706
1707 The alternate keywords @code{__asm__}, @code{__extension__},
1708 @code{__inline__} and @code{__typeof__} continue to work despite
1709 @option{-ansi}. You would not want to use them in an ISO C program, of
1710 course, but it is useful to put them in header files that might be included
1711 in compilations done with @option{-ansi}. Alternate predefined macros
1712 such as @code{__unix__} and @code{__vax__} are also available, with or
1713 without @option{-ansi}.
1714
1715 The @option{-ansi} option does not cause non-ISO programs to be
1716 rejected gratuitously. For that, @option{-Wpedantic} is required in
1717 addition to @option{-ansi}. @xref{Warning Options}.
1718
1719 The macro @code{__STRICT_ANSI__} is predefined when the @option{-ansi}
1720 option is used. Some header files may notice this macro and refrain
1721 from declaring certain functions or defining certain macros that the
1722 ISO standard doesn't call for; this is to avoid interfering with any
1723 programs that might use these names for other things.
1724
1725 Functions that are normally built in but do not have semantics
1726 defined by ISO C (such as @code{alloca} and @code{ffs}) are not built-in
1727 functions when @option{-ansi} is used. @xref{Other Builtins,,Other
1728 built-in functions provided by GCC}, for details of the functions
1729 affected.
1730
1731 @item -std=
1732 @opindex std
1733 Determine the language standard. @xref{Standards,,Language Standards
1734 Supported by GCC}, for details of these standard versions. This option
1735 is currently only supported when compiling C or C++.
1736
1737 The compiler can accept several base standards, such as @samp{c90} or
1738 @samp{c++98}, and GNU dialects of those standards, such as
1739 @samp{gnu90} or @samp{gnu++98}. When a base standard is specified, the
1740 compiler accepts all programs following that standard plus those
1741 using GNU extensions that do not contradict it. For example,
1742 @option{-std=c90} turns off certain features of GCC that are
1743 incompatible with ISO C90, such as the @code{asm} and @code{typeof}
1744 keywords, but not other GNU extensions that do not have a meaning in
1745 ISO C90, such as omitting the middle term of a @code{?:}
1746 expression. On the other hand, when a GNU dialect of a standard is
1747 specified, all features supported by the compiler are enabled, even when
1748 those features change the meaning of the base standard. As a result, some
1749 strict-conforming programs may be rejected. The particular standard
1750 is used by @option{-Wpedantic} to identify which features are GNU
1751 extensions given that version of the standard. For example
1752 @option{-std=gnu90 -Wpedantic} warns about C++ style @samp{//}
1753 comments, while @option{-std=gnu99 -Wpedantic} does not.
1754
1755 A value for this option must be provided; possible values are
1756
1757 @table @samp
1758 @item c90
1759 @itemx c89
1760 @itemx iso9899:1990
1761 Support all ISO C90 programs (certain GNU extensions that conflict
1762 with ISO C90 are disabled). Same as @option{-ansi} for C code.
1763
1764 @item iso9899:199409
1765 ISO C90 as modified in amendment 1.
1766
1767 @item c99
1768 @itemx c9x
1769 @itemx iso9899:1999
1770 @itemx iso9899:199x
1771 ISO C99. This standard is substantially completely supported, modulo
1772 bugs and floating-point issues
1773 (mainly but not entirely relating to optional C99 features from
1774 Annexes F and G). See
1775 @w{@uref{http://gcc.gnu.org/c99status.html}} for more information. The
1776 names @samp{c9x} and @samp{iso9899:199x} are deprecated.
1777
1778 @item c11
1779 @itemx c1x
1780 @itemx iso9899:2011
1781 ISO C11, the 2011 revision of the ISO C standard. This standard is
1782 substantially completely supported, modulo bugs, floating-point issues
1783 (mainly but not entirely relating to optional C11 features from
1784 Annexes F and G) and the optional Annexes K (Bounds-checking
1785 interfaces) and L (Analyzability). The name @samp{c1x} is deprecated.
1786
1787 @item gnu90
1788 @itemx gnu89
1789 GNU dialect of ISO C90 (including some C99 features).
1790
1791 @item gnu99
1792 @itemx gnu9x
1793 GNU dialect of ISO C99. The name @samp{gnu9x} is deprecated.
1794
1795 @item gnu11
1796 @itemx gnu1x
1797 GNU dialect of ISO C11. This is the default for C code.
1798 The name @samp{gnu1x} is deprecated.
1799
1800 @item c++98
1801 @itemx c++03
1802 The 1998 ISO C++ standard plus the 2003 technical corrigendum and some
1803 additional defect reports. Same as @option{-ansi} for C++ code.
1804
1805 @item gnu++98
1806 @itemx gnu++03
1807 GNU dialect of @option{-std=c++98}.
1808
1809 @item c++11
1810 @itemx c++0x
1811 The 2011 ISO C++ standard plus amendments.
1812 The name @samp{c++0x} is deprecated.
1813
1814 @item gnu++11
1815 @itemx gnu++0x
1816 GNU dialect of @option{-std=c++11}.
1817 The name @samp{gnu++0x} is deprecated.
1818
1819 @item c++14
1820 @itemx c++1y
1821 The 2014 ISO C++ standard plus amendments.
1822 The name @samp{c++1y} is deprecated.
1823
1824 @item gnu++14
1825 @itemx gnu++1y
1826 GNU dialect of @option{-std=c++14}.
1827 This is the default for C++ code.
1828 The name @samp{gnu++1y} is deprecated.
1829
1830 @item c++1z
1831 The next revision of the ISO C++ standard, tentatively planned for
1832 2017. Support is highly experimental, and will almost certainly
1833 change in incompatible ways in future releases.
1834
1835 @item gnu++1z
1836 GNU dialect of @option{-std=c++1z}. Support is highly experimental,
1837 and will almost certainly change in incompatible ways in future
1838 releases.
1839 @end table
1840
1841 @item -fgnu89-inline
1842 @opindex fgnu89-inline
1843 The option @option{-fgnu89-inline} tells GCC to use the traditional
1844 GNU semantics for @code{inline} functions when in C99 mode.
1845 @xref{Inline,,An Inline Function is As Fast As a Macro}.
1846 Using this option is roughly equivalent to adding the
1847 @code{gnu_inline} function attribute to all inline functions
1848 (@pxref{Function Attributes}).
1849
1850 The option @option{-fno-gnu89-inline} explicitly tells GCC to use the
1851 C99 semantics for @code{inline} when in C99 or gnu99 mode (i.e., it
1852 specifies the default behavior).
1853 This option is not supported in @option{-std=c90} or
1854 @option{-std=gnu90} mode.
1855
1856 The preprocessor macros @code{__GNUC_GNU_INLINE__} and
1857 @code{__GNUC_STDC_INLINE__} may be used to check which semantics are
1858 in effect for @code{inline} functions. @xref{Common Predefined
1859 Macros,,,cpp,The C Preprocessor}.
1860
1861 @item -aux-info @var{filename}
1862 @opindex aux-info
1863 Output to the given filename prototyped declarations for all functions
1864 declared and/or defined in a translation unit, including those in header
1865 files. This option is silently ignored in any language other than C@.
1866
1867 Besides declarations, the file indicates, in comments, the origin of
1868 each declaration (source file and line), whether the declaration was
1869 implicit, prototyped or unprototyped (@samp{I}, @samp{N} for new or
1870 @samp{O} for old, respectively, in the first character after the line
1871 number and the colon), and whether it came from a declaration or a
1872 definition (@samp{C} or @samp{F}, respectively, in the following
1873 character). In the case of function definitions, a K&R-style list of
1874 arguments followed by their declarations is also provided, inside
1875 comments, after the declaration.
1876
1877 @item -fallow-parameterless-variadic-functions
1878 @opindex fallow-parameterless-variadic-functions
1879 Accept variadic functions without named parameters.
1880
1881 Although it is possible to define such a function, this is not very
1882 useful as it is not possible to read the arguments. This is only
1883 supported for C as this construct is allowed by C++.
1884
1885 @item -fno-asm
1886 @opindex fno-asm
1887 Do not recognize @code{asm}, @code{inline} or @code{typeof} as a
1888 keyword, so that code can use these words as identifiers. You can use
1889 the keywords @code{__asm__}, @code{__inline__} and @code{__typeof__}
1890 instead. @option{-ansi} implies @option{-fno-asm}.
1891
1892 In C++, this switch only affects the @code{typeof} keyword, since
1893 @code{asm} and @code{inline} are standard keywords. You may want to
1894 use the @option{-fno-gnu-keywords} flag instead, which has the same
1895 effect. In C99 mode (@option{-std=c99} or @option{-std=gnu99}), this
1896 switch only affects the @code{asm} and @code{typeof} keywords, since
1897 @code{inline} is a standard keyword in ISO C99.
1898
1899 @item -fno-builtin
1900 @itemx -fno-builtin-@var{function}
1901 @opindex fno-builtin
1902 @cindex built-in functions
1903 Don't recognize built-in functions that do not begin with
1904 @samp{__builtin_} as prefix. @xref{Other Builtins,,Other built-in
1905 functions provided by GCC}, for details of the functions affected,
1906 including those which are not built-in functions when @option{-ansi} or
1907 @option{-std} options for strict ISO C conformance are used because they
1908 do not have an ISO standard meaning.
1909
1910 GCC normally generates special code to handle certain built-in functions
1911 more efficiently; for instance, calls to @code{alloca} may become single
1912 instructions which adjust the stack directly, and calls to @code{memcpy}
1913 may become inline copy loops. The resulting code is often both smaller
1914 and faster, but since the function calls no longer appear as such, you
1915 cannot set a breakpoint on those calls, nor can you change the behavior
1916 of the functions by linking with a different library. In addition,
1917 when a function is recognized as a built-in function, GCC may use
1918 information about that function to warn about problems with calls to
1919 that function, or to generate more efficient code, even if the
1920 resulting code still contains calls to that function. For example,
1921 warnings are given with @option{-Wformat} for bad calls to
1922 @code{printf} when @code{printf} is built in and @code{strlen} is
1923 known not to modify global memory.
1924
1925 With the @option{-fno-builtin-@var{function}} option
1926 only the built-in function @var{function} is
1927 disabled. @var{function} must not begin with @samp{__builtin_}. If a
1928 function is named that is not built-in in this version of GCC, this
1929 option is ignored. There is no corresponding
1930 @option{-fbuiltin-@var{function}} option; if you wish to enable
1931 built-in functions selectively when using @option{-fno-builtin} or
1932 @option{-ffreestanding}, you may define macros such as:
1933
1934 @smallexample
1935 #define abs(n) __builtin_abs ((n))
1936 #define strcpy(d, s) __builtin_strcpy ((d), (s))
1937 @end smallexample
1938
1939 @item -fhosted
1940 @opindex fhosted
1941 @cindex hosted environment
1942
1943 Assert that compilation targets a hosted environment. This implies
1944 @option{-fbuiltin}. A hosted environment is one in which the
1945 entire standard library is available, and in which @code{main} has a return
1946 type of @code{int}. Examples are nearly everything except a kernel.
1947 This is equivalent to @option{-fno-freestanding}.
1948
1949 @item -ffreestanding
1950 @opindex ffreestanding
1951 @cindex hosted environment
1952
1953 Assert that compilation targets a freestanding environment. This
1954 implies @option{-fno-builtin}. A freestanding environment
1955 is one in which the standard library may not exist, and program startup may
1956 not necessarily be at @code{main}. The most obvious example is an OS kernel.
1957 This is equivalent to @option{-fno-hosted}.
1958
1959 @xref{Standards,,Language Standards Supported by GCC}, for details of
1960 freestanding and hosted environments.
1961
1962 @item -fopenacc
1963 @opindex fopenacc
1964 @cindex OpenACC accelerator programming
1965 Enable handling of OpenACC directives @code{#pragma acc} in C/C++ and
1966 @code{!$acc} in Fortran. When @option{-fopenacc} is specified, the
1967 compiler generates accelerated code according to the OpenACC Application
1968 Programming Interface v2.0 @w{@uref{http://www.openacc.org/}}. This option
1969 implies @option{-pthread}, and thus is only supported on targets that
1970 have support for @option{-pthread}.
1971
1972 @item -fopenacc-dim=@var{geom}
1973 @opindex fopenacc-dim
1974 @cindex OpenACC accelerator programming
1975 Specify default compute dimensions for parallel offload regions that do
1976 not explicitly specify. The @var{geom} value is a triple of
1977 ':'-separated sizes, in order 'gang', 'worker' and, 'vector'. A size
1978 can be omitted, to use a target-specific default value.
1979
1980 @item -fopenmp
1981 @opindex fopenmp
1982 @cindex OpenMP parallel
1983 Enable handling of OpenMP directives @code{#pragma omp} in C/C++ and
1984 @code{!$omp} in Fortran. When @option{-fopenmp} is specified, the
1985 compiler generates parallel code according to the OpenMP Application
1986 Program Interface v4.0 @w{@uref{http://www.openmp.org/}}. This option
1987 implies @option{-pthread}, and thus is only supported on targets that
1988 have support for @option{-pthread}. @option{-fopenmp} implies
1989 @option{-fopenmp-simd}.
1990
1991 @item -fopenmp-simd
1992 @opindex fopenmp-simd
1993 @cindex OpenMP SIMD
1994 @cindex SIMD
1995 Enable handling of OpenMP's SIMD directives with @code{#pragma omp}
1996 in C/C++ and @code{!$omp} in Fortran. Other OpenMP directives
1997 are ignored.
1998
1999 @item -fcilkplus
2000 @opindex fcilkplus
2001 @cindex Enable Cilk Plus
2002 Enable the usage of Cilk Plus language extension features for C/C++.
2003 When the option @option{-fcilkplus} is specified, enable the usage of
2004 the Cilk Plus Language extension features for C/C++. The present
2005 implementation follows ABI version 1.2. This is an experimental
2006 feature that is only partially complete, and whose interface may
2007 change in future versions of GCC as the official specification
2008 changes. Currently, all features but @code{_Cilk_for} have been
2009 implemented.
2010
2011 @item -fgnu-tm
2012 @opindex fgnu-tm
2013 When the option @option{-fgnu-tm} is specified, the compiler
2014 generates code for the Linux variant of Intel's current Transactional
2015 Memory ABI specification document (Revision 1.1, May 6 2009). This is
2016 an experimental feature whose interface may change in future versions
2017 of GCC, as the official specification changes. Please note that not
2018 all architectures are supported for this feature.
2019
2020 For more information on GCC's support for transactional memory,
2021 @xref{Enabling libitm,,The GNU Transactional Memory Library,libitm,GNU
2022 Transactional Memory Library}.
2023
2024 Note that the transactional memory feature is not supported with
2025 non-call exceptions (@option{-fnon-call-exceptions}).
2026
2027 @item -fms-extensions
2028 @opindex fms-extensions
2029 Accept some non-standard constructs used in Microsoft header files.
2030
2031 In C++ code, this allows member names in structures to be similar
2032 to previous types declarations.
2033
2034 @smallexample
2035 typedef int UOW;
2036 struct ABC @{
2037 UOW UOW;
2038 @};
2039 @end smallexample
2040
2041 Some cases of unnamed fields in structures and unions are only
2042 accepted with this option. @xref{Unnamed Fields,,Unnamed struct/union
2043 fields within structs/unions}, for details.
2044
2045 Note that this option is off for all targets but x86
2046 targets using ms-abi.
2047
2048 @item -fplan9-extensions
2049 @opindex fplan9-extensions
2050 Accept some non-standard constructs used in Plan 9 code.
2051
2052 This enables @option{-fms-extensions}, permits passing pointers to
2053 structures with anonymous fields to functions that expect pointers to
2054 elements of the type of the field, and permits referring to anonymous
2055 fields declared using a typedef. @xref{Unnamed Fields,,Unnamed
2056 struct/union fields within structs/unions}, for details. This is only
2057 supported for C, not C++.
2058
2059 @item -trigraphs
2060 @opindex trigraphs
2061 Support ISO C trigraphs. The @option{-ansi} option (and @option{-std}
2062 options for strict ISO C conformance) implies @option{-trigraphs}.
2063
2064 @cindex traditional C language
2065 @cindex C language, traditional
2066 @item -traditional
2067 @itemx -traditional-cpp
2068 @opindex traditional-cpp
2069 @opindex traditional
2070 Formerly, these options caused GCC to attempt to emulate a pre-standard
2071 C compiler. They are now only supported with the @option{-E} switch.
2072 The preprocessor continues to support a pre-standard mode. See the GNU
2073 CPP manual for details.
2074
2075 @item -fcond-mismatch
2076 @opindex fcond-mismatch
2077 Allow conditional expressions with mismatched types in the second and
2078 third arguments. The value of such an expression is void. This option
2079 is not supported for C++.
2080
2081 @item -flax-vector-conversions
2082 @opindex flax-vector-conversions
2083 Allow implicit conversions between vectors with differing numbers of
2084 elements and/or incompatible element types. This option should not be
2085 used for new code.
2086
2087 @item -funsigned-char
2088 @opindex funsigned-char
2089 Let the type @code{char} be unsigned, like @code{unsigned char}.
2090
2091 Each kind of machine has a default for what @code{char} should
2092 be. It is either like @code{unsigned char} by default or like
2093 @code{signed char} by default.
2094
2095 Ideally, a portable program should always use @code{signed char} or
2096 @code{unsigned char} when it depends on the signedness of an object.
2097 But many programs have been written to use plain @code{char} and
2098 expect it to be signed, or expect it to be unsigned, depending on the
2099 machines they were written for. This option, and its inverse, let you
2100 make such a program work with the opposite default.
2101
2102 The type @code{char} is always a distinct type from each of
2103 @code{signed char} or @code{unsigned char}, even though its behavior
2104 is always just like one of those two.
2105
2106 @item -fsigned-char
2107 @opindex fsigned-char
2108 Let the type @code{char} be signed, like @code{signed char}.
2109
2110 Note that this is equivalent to @option{-fno-unsigned-char}, which is
2111 the negative form of @option{-funsigned-char}. Likewise, the option
2112 @option{-fno-signed-char} is equivalent to @option{-funsigned-char}.
2113
2114 @item -fsigned-bitfields
2115 @itemx -funsigned-bitfields
2116 @itemx -fno-signed-bitfields
2117 @itemx -fno-unsigned-bitfields
2118 @opindex fsigned-bitfields
2119 @opindex funsigned-bitfields
2120 @opindex fno-signed-bitfields
2121 @opindex fno-unsigned-bitfields
2122 These options control whether a bit-field is signed or unsigned, when the
2123 declaration does not use either @code{signed} or @code{unsigned}. By
2124 default, such a bit-field is signed, because this is consistent: the
2125 basic integer types such as @code{int} are signed types.
2126
2127 @item -fsso-struct=@var{endianness}
2128 @opindex fsso-struct
2129 Set the default scalar storage order of structures and unions to the
2130 specified endianness. The accepted values are @samp{big-endian} and
2131 @samp{little-endian}. If the option is not passed, the compiler uses
2132 the native endianness of the target. This option is not supported for C++.
2133
2134 @strong{Warning:} the @option{-fsso-struct} switch causes GCC to generate
2135 code that is not binary compatible with code generated without it if the
2136 specified endianness is not the native endianness of the target.
2137 @end table
2138
2139 @node C++ Dialect Options
2140 @section Options Controlling C++ Dialect
2141
2142 @cindex compiler options, C++
2143 @cindex C++ options, command-line
2144 @cindex options, C++
2145 This section describes the command-line options that are only meaningful
2146 for C++ programs. You can also use most of the GNU compiler options
2147 regardless of what language your program is in. For example, you
2148 might compile a file @file{firstClass.C} like this:
2149
2150 @smallexample
2151 g++ -g -fstrict-enums -O -c firstClass.C
2152 @end smallexample
2153
2154 @noindent
2155 In this example, only @option{-fstrict-enums} is an option meant
2156 only for C++ programs; you can use the other options with any
2157 language supported by GCC@.
2158
2159 Some options for compiling C programs, such as @option{-std}, are also
2160 relevant for C++ programs.
2161 @xref{C Dialect Options,,Options Controlling C Dialect}.
2162
2163 Here is a list of options that are @emph{only} for compiling C++ programs:
2164
2165 @table @gcctabopt
2166
2167 @item -fabi-version=@var{n}
2168 @opindex fabi-version
2169 Use version @var{n} of the C++ ABI@. The default is version 0.
2170
2171 Version 0 refers to the version conforming most closely to
2172 the C++ ABI specification. Therefore, the ABI obtained using version 0
2173 will change in different versions of G++ as ABI bugs are fixed.
2174
2175 Version 1 is the version of the C++ ABI that first appeared in G++ 3.2.
2176
2177 Version 2 is the version of the C++ ABI that first appeared in G++
2178 3.4, and was the default through G++ 4.9.
2179
2180 Version 3 corrects an error in mangling a constant address as a
2181 template argument.
2182
2183 Version 4, which first appeared in G++ 4.5, implements a standard
2184 mangling for vector types.
2185
2186 Version 5, which first appeared in G++ 4.6, corrects the mangling of
2187 attribute const/volatile on function pointer types, decltype of a
2188 plain decl, and use of a function parameter in the declaration of
2189 another parameter.
2190
2191 Version 6, which first appeared in G++ 4.7, corrects the promotion
2192 behavior of C++11 scoped enums and the mangling of template argument
2193 packs, const/static_cast, prefix ++ and --, and a class scope function
2194 used as a template argument.
2195
2196 Version 7, which first appeared in G++ 4.8, that treats nullptr_t as a
2197 builtin type and corrects the mangling of lambdas in default argument
2198 scope.
2199
2200 Version 8, which first appeared in G++ 4.9, corrects the substitution
2201 behavior of function types with function-cv-qualifiers.
2202
2203 Version 9, which first appeared in G++ 5.2, corrects the alignment of
2204 @code{nullptr_t}.
2205
2206 Version 10, which first appeared in G++ 6.1, adds mangling of
2207 attributes that affect type identity, such as ia32 calling convention
2208 attributes (e.g. @samp{stdcall}).
2209
2210 See also @option{-Wabi}.
2211
2212 @item -fabi-compat-version=@var{n}
2213 @opindex fabi-compat-version
2214 On targets that support strong aliases, G++
2215 works around mangling changes by creating an alias with the correct
2216 mangled name when defining a symbol with an incorrect mangled name.
2217 This switch specifies which ABI version to use for the alias.
2218
2219 With @option{-fabi-version=0} (the default), this defaults to 8 (GCC 5
2220 compatibility). If another ABI version is explicitly selected, this
2221 defaults to 0. For compatibility with GCC versions 3.2 through 4.9,
2222 use @option{-fabi-compat-version=2}.
2223
2224 If this option is not provided but @option{-Wabi=@var{n}} is, that
2225 version is used for compatibility aliases. If this option is provided
2226 along with @option{-Wabi} (without the version), the version from this
2227 option is used for the warning.
2228
2229 @item -fno-access-control
2230 @opindex fno-access-control
2231 Turn off all access checking. This switch is mainly useful for working
2232 around bugs in the access control code.
2233
2234 @item -fcheck-new
2235 @opindex fcheck-new
2236 Check that the pointer returned by @code{operator new} is non-null
2237 before attempting to modify the storage allocated. This check is
2238 normally unnecessary because the C++ standard specifies that
2239 @code{operator new} only returns @code{0} if it is declared
2240 @code{throw()}, in which case the compiler always checks the
2241 return value even without this option. In all other cases, when
2242 @code{operator new} has a non-empty exception specification, memory
2243 exhaustion is signalled by throwing @code{std::bad_alloc}. See also
2244 @samp{new (nothrow)}.
2245
2246 @item -fconcepts
2247 @opindex fconcepts
2248 Enable support for the C++ Extensions for Concepts Technical
2249 Specification, ISO 19217 (2015), which allows code like
2250
2251 @smallexample
2252 template <class T> concept bool Addable = requires (T t) @{ t + t; @};
2253 template <Addable T> T add (T a, T b) @{ return a + b; @}
2254 @end smallexample
2255
2256 @item -fconstexpr-depth=@var{n}
2257 @opindex fconstexpr-depth
2258 Set the maximum nested evaluation depth for C++11 constexpr functions
2259 to @var{n}. A limit is needed to detect endless recursion during
2260 constant expression evaluation. The minimum specified by the standard
2261 is 512.
2262
2263 @item -fdeduce-init-list
2264 @opindex fdeduce-init-list
2265 Enable deduction of a template type parameter as
2266 @code{std::initializer_list} from a brace-enclosed initializer list, i.e.@:
2267
2268 @smallexample
2269 template <class T> auto forward(T t) -> decltype (realfn (t))
2270 @{
2271 return realfn (t);
2272 @}
2273
2274 void f()
2275 @{
2276 forward(@{1,2@}); // call forward<std::initializer_list<int>>
2277 @}
2278 @end smallexample
2279
2280 This deduction was implemented as a possible extension to the
2281 originally proposed semantics for the C++11 standard, but was not part
2282 of the final standard, so it is disabled by default. This option is
2283 deprecated, and may be removed in a future version of G++.
2284
2285 @item -ffriend-injection
2286 @opindex ffriend-injection
2287 Inject friend functions into the enclosing namespace, so that they are
2288 visible outside the scope of the class in which they are declared.
2289 Friend functions were documented to work this way in the old Annotated
2290 C++ Reference Manual.
2291 However, in ISO C++ a friend function that is not declared
2292 in an enclosing scope can only be found using argument dependent
2293 lookup. GCC defaults to the standard behavior.
2294
2295 This option is for compatibility, and may be removed in a future
2296 release of G++.
2297
2298 @item -fno-elide-constructors
2299 @opindex fno-elide-constructors
2300 The C++ standard allows an implementation to omit creating a temporary
2301 that is only used to initialize another object of the same type.
2302 Specifying this option disables that optimization, and forces G++ to
2303 call the copy constructor in all cases.
2304
2305 @item -fno-enforce-eh-specs
2306 @opindex fno-enforce-eh-specs
2307 Don't generate code to check for violation of exception specifications
2308 at run time. This option violates the C++ standard, but may be useful
2309 for reducing code size in production builds, much like defining
2310 @code{NDEBUG}. This does not give user code permission to throw
2311 exceptions in violation of the exception specifications; the compiler
2312 still optimizes based on the specifications, so throwing an
2313 unexpected exception results in undefined behavior at run time.
2314
2315 @item -fextern-tls-init
2316 @itemx -fno-extern-tls-init
2317 @opindex fextern-tls-init
2318 @opindex fno-extern-tls-init
2319 The C++11 and OpenMP standards allow @code{thread_local} and
2320 @code{threadprivate} variables to have dynamic (runtime)
2321 initialization. To support this, any use of such a variable goes
2322 through a wrapper function that performs any necessary initialization.
2323 When the use and definition of the variable are in the same
2324 translation unit, this overhead can be optimized away, but when the
2325 use is in a different translation unit there is significant overhead
2326 even if the variable doesn't actually need dynamic initialization. If
2327 the programmer can be sure that no use of the variable in a
2328 non-defining TU needs to trigger dynamic initialization (either
2329 because the variable is statically initialized, or a use of the
2330 variable in the defining TU will be executed before any uses in
2331 another TU), they can avoid this overhead with the
2332 @option{-fno-extern-tls-init} option.
2333
2334 On targets that support symbol aliases, the default is
2335 @option{-fextern-tls-init}. On targets that do not support symbol
2336 aliases, the default is @option{-fno-extern-tls-init}.
2337
2338 @item -ffor-scope
2339 @itemx -fno-for-scope
2340 @opindex ffor-scope
2341 @opindex fno-for-scope
2342 If @option{-ffor-scope} is specified, the scope of variables declared in
2343 a @i{for-init-statement} is limited to the @code{for} loop itself,
2344 as specified by the C++ standard.
2345 If @option{-fno-for-scope} is specified, the scope of variables declared in
2346 a @i{for-init-statement} extends to the end of the enclosing scope,
2347 as was the case in old versions of G++, and other (traditional)
2348 implementations of C++.
2349
2350 If neither flag is given, the default is to follow the standard,
2351 but to allow and give a warning for old-style code that would
2352 otherwise be invalid, or have different behavior.
2353
2354 @item -fno-gnu-keywords
2355 @opindex fno-gnu-keywords
2356 Do not recognize @code{typeof} as a keyword, so that code can use this
2357 word as an identifier. You can use the keyword @code{__typeof__} instead.
2358 This option is implied by the strict ISO C++ dialects: @option{-ansi},
2359 @option{-std=c++98}, @option{-std=c++11}, etc.
2360
2361 @item -fno-implicit-templates
2362 @opindex fno-implicit-templates
2363 Never emit code for non-inline templates that are instantiated
2364 implicitly (i.e.@: by use); only emit code for explicit instantiations.
2365 @xref{Template Instantiation}, for more information.
2366
2367 @item -fno-implicit-inline-templates
2368 @opindex fno-implicit-inline-templates
2369 Don't emit code for implicit instantiations of inline templates, either.
2370 The default is to handle inlines differently so that compiles with and
2371 without optimization need the same set of explicit instantiations.
2372
2373 @item -fno-implement-inlines
2374 @opindex fno-implement-inlines
2375 To save space, do not emit out-of-line copies of inline functions
2376 controlled by @code{#pragma implementation}. This causes linker
2377 errors if these functions are not inlined everywhere they are called.
2378
2379 @item -fms-extensions
2380 @opindex fms-extensions
2381 Disable Wpedantic warnings about constructs used in MFC, such as implicit
2382 int and getting a pointer to member function via non-standard syntax.
2383
2384 @item -fno-nonansi-builtins
2385 @opindex fno-nonansi-builtins
2386 Disable built-in declarations of functions that are not mandated by
2387 ANSI/ISO C@. These include @code{ffs}, @code{alloca}, @code{_exit},
2388 @code{index}, @code{bzero}, @code{conjf}, and other related functions.
2389
2390 @item -fnothrow-opt
2391 @opindex fnothrow-opt
2392 Treat a @code{throw()} exception specification as if it were a
2393 @code{noexcept} specification to reduce or eliminate the text size
2394 overhead relative to a function with no exception specification. If
2395 the function has local variables of types with non-trivial
2396 destructors, the exception specification actually makes the
2397 function smaller because the EH cleanups for those variables can be
2398 optimized away. The semantic effect is that an exception thrown out of
2399 a function with such an exception specification results in a call
2400 to @code{terminate} rather than @code{unexpected}.
2401
2402 @item -fno-operator-names
2403 @opindex fno-operator-names
2404 Do not treat the operator name keywords @code{and}, @code{bitand},
2405 @code{bitor}, @code{compl}, @code{not}, @code{or} and @code{xor} as
2406 synonyms as keywords.
2407
2408 @item -fno-optional-diags
2409 @opindex fno-optional-diags
2410 Disable diagnostics that the standard says a compiler does not need to
2411 issue. Currently, the only such diagnostic issued by G++ is the one for
2412 a name having multiple meanings within a class.
2413
2414 @item -fpermissive
2415 @opindex fpermissive
2416 Downgrade some diagnostics about nonconformant code from errors to
2417 warnings. Thus, using @option{-fpermissive} allows some
2418 nonconforming code to compile.
2419
2420 @item -fno-pretty-templates
2421 @opindex fno-pretty-templates
2422 When an error message refers to a specialization of a function
2423 template, the compiler normally prints the signature of the
2424 template followed by the template arguments and any typedefs or
2425 typenames in the signature (e.g. @code{void f(T) [with T = int]}
2426 rather than @code{void f(int)}) so that it's clear which template is
2427 involved. When an error message refers to a specialization of a class
2428 template, the compiler omits any template arguments that match
2429 the default template arguments for that template. If either of these
2430 behaviors make it harder to understand the error message rather than
2431 easier, you can use @option{-fno-pretty-templates} to disable them.
2432
2433 @item -frepo
2434 @opindex frepo
2435 Enable automatic template instantiation at link time. This option also
2436 implies @option{-fno-implicit-templates}. @xref{Template
2437 Instantiation}, for more information.
2438
2439 @item -fno-rtti
2440 @opindex fno-rtti
2441 Disable generation of information about every class with virtual
2442 functions for use by the C++ run-time type identification features
2443 (@code{dynamic_cast} and @code{typeid}). If you don't use those parts
2444 of the language, you can save some space by using this flag. Note that
2445 exception handling uses the same information, but G++ generates it as
2446 needed. The @code{dynamic_cast} operator can still be used for casts that
2447 do not require run-time type information, i.e.@: casts to @code{void *} or to
2448 unambiguous base classes.
2449
2450 @item -fsized-deallocation
2451 @opindex fsized-deallocation
2452 Enable the built-in global declarations
2453 @smallexample
2454 void operator delete (void *, std::size_t) noexcept;
2455 void operator delete[] (void *, std::size_t) noexcept;
2456 @end smallexample
2457 as introduced in C++14. This is useful for user-defined replacement
2458 deallocation functions that, for example, use the size of the object
2459 to make deallocation faster. Enabled by default under
2460 @option{-std=c++14} and above. The flag @option{-Wsized-deallocation}
2461 warns about places that might want to add a definition.
2462
2463 @item -fstrict-enums
2464 @opindex fstrict-enums
2465 Allow the compiler to optimize using the assumption that a value of
2466 enumerated type can only be one of the values of the enumeration (as
2467 defined in the C++ standard; basically, a value that can be
2468 represented in the minimum number of bits needed to represent all the
2469 enumerators). This assumption may not be valid if the program uses a
2470 cast to convert an arbitrary integer value to the enumerated type.
2471
2472 @item -ftemplate-backtrace-limit=@var{n}
2473 @opindex ftemplate-backtrace-limit
2474 Set the maximum number of template instantiation notes for a single
2475 warning or error to @var{n}. The default value is 10.
2476
2477 @item -ftemplate-depth=@var{n}
2478 @opindex ftemplate-depth
2479 Set the maximum instantiation depth for template classes to @var{n}.
2480 A limit on the template instantiation depth is needed to detect
2481 endless recursions during template class instantiation. ANSI/ISO C++
2482 conforming programs must not rely on a maximum depth greater than 17
2483 (changed to 1024 in C++11). The default value is 900, as the compiler
2484 can run out of stack space before hitting 1024 in some situations.
2485
2486 @item -fno-threadsafe-statics
2487 @opindex fno-threadsafe-statics
2488 Do not emit the extra code to use the routines specified in the C++
2489 ABI for thread-safe initialization of local statics. You can use this
2490 option to reduce code size slightly in code that doesn't need to be
2491 thread-safe.
2492
2493 @item -fuse-cxa-atexit
2494 @opindex fuse-cxa-atexit
2495 Register destructors for objects with static storage duration with the
2496 @code{__cxa_atexit} function rather than the @code{atexit} function.
2497 This option is required for fully standards-compliant handling of static
2498 destructors, but only works if your C library supports
2499 @code{__cxa_atexit}.
2500
2501 @item -fno-use-cxa-get-exception-ptr
2502 @opindex fno-use-cxa-get-exception-ptr
2503 Don't use the @code{__cxa_get_exception_ptr} runtime routine. This
2504 causes @code{std::uncaught_exception} to be incorrect, but is necessary
2505 if the runtime routine is not available.
2506
2507 @item -fvisibility-inlines-hidden
2508 @opindex fvisibility-inlines-hidden
2509 This switch declares that the user does not attempt to compare
2510 pointers to inline functions or methods where the addresses of the two functions
2511 are taken in different shared objects.
2512
2513 The effect of this is that GCC may, effectively, mark inline methods with
2514 @code{__attribute__ ((visibility ("hidden")))} so that they do not
2515 appear in the export table of a DSO and do not require a PLT indirection
2516 when used within the DSO@. Enabling this option can have a dramatic effect
2517 on load and link times of a DSO as it massively reduces the size of the
2518 dynamic export table when the library makes heavy use of templates.
2519
2520 The behavior of this switch is not quite the same as marking the
2521 methods as hidden directly, because it does not affect static variables
2522 local to the function or cause the compiler to deduce that
2523 the function is defined in only one shared object.
2524
2525 You may mark a method as having a visibility explicitly to negate the
2526 effect of the switch for that method. For example, if you do want to
2527 compare pointers to a particular inline method, you might mark it as
2528 having default visibility. Marking the enclosing class with explicit
2529 visibility has no effect.
2530
2531 Explicitly instantiated inline methods are unaffected by this option
2532 as their linkage might otherwise cross a shared library boundary.
2533 @xref{Template Instantiation}.
2534
2535 @item -fvisibility-ms-compat
2536 @opindex fvisibility-ms-compat
2537 This flag attempts to use visibility settings to make GCC's C++
2538 linkage model compatible with that of Microsoft Visual Studio.
2539
2540 The flag makes these changes to GCC's linkage model:
2541
2542 @enumerate
2543 @item
2544 It sets the default visibility to @code{hidden}, like
2545 @option{-fvisibility=hidden}.
2546
2547 @item
2548 Types, but not their members, are not hidden by default.
2549
2550 @item
2551 The One Definition Rule is relaxed for types without explicit
2552 visibility specifications that are defined in more than one
2553 shared object: those declarations are permitted if they are
2554 permitted when this option is not used.
2555 @end enumerate
2556
2557 In new code it is better to use @option{-fvisibility=hidden} and
2558 export those classes that are intended to be externally visible.
2559 Unfortunately it is possible for code to rely, perhaps accidentally,
2560 on the Visual Studio behavior.
2561
2562 Among the consequences of these changes are that static data members
2563 of the same type with the same name but defined in different shared
2564 objects are different, so changing one does not change the other;
2565 and that pointers to function members defined in different shared
2566 objects may not compare equal. When this flag is given, it is a
2567 violation of the ODR to define types with the same name differently.
2568
2569 @item -fno-weak
2570 @opindex fno-weak
2571 Do not use weak symbol support, even if it is provided by the linker.
2572 By default, G++ uses weak symbols if they are available. This
2573 option exists only for testing, and should not be used by end-users;
2574 it results in inferior code and has no benefits. This option may
2575 be removed in a future release of G++.
2576
2577 @item -nostdinc++
2578 @opindex nostdinc++
2579 Do not search for header files in the standard directories specific to
2580 C++, but do still search the other standard directories. (This option
2581 is used when building the C++ library.)
2582 @end table
2583
2584 In addition, these optimization, warning, and code generation options
2585 have meanings only for C++ programs:
2586
2587 @table @gcctabopt
2588 @item -Wabi @r{(C, Objective-C, C++ and Objective-C++ only)}
2589 @opindex Wabi
2590 @opindex Wno-abi
2591 Warn when G++ it generates code that is probably not compatible with
2592 the vendor-neutral C++ ABI@. Since G++ now defaults to updating the
2593 ABI with each major release, normally @option{-Wabi} will warn only if
2594 there is a check added later in a release series for an ABI issue
2595 discovered since the initial release. @option{-Wabi} will warn about
2596 more things if an older ABI version is selected (with
2597 @option{-fabi-version=@var{n}}).
2598
2599 @option{-Wabi} can also be used with an explicit version number to
2600 warn about compatibility with a particular @option{-fabi-version}
2601 level, e.g. @option{-Wabi=2} to warn about changes relative to
2602 @option{-fabi-version=2}.
2603
2604 If an explicit version number is provided and
2605 @option{-fabi-compat-version} is not specified, the version number
2606 from this option is used for compatibility aliases. If no explicit
2607 version number is provided with this option, but
2608 @option{-fabi-compat-version} is specified, that version number is
2609 used for ABI warnings.
2610
2611 Although an effort has been made to warn about
2612 all such cases, there are probably some cases that are not warned about,
2613 even though G++ is generating incompatible code. There may also be
2614 cases where warnings are emitted even though the code that is generated
2615 is compatible.
2616
2617 You should rewrite your code to avoid these warnings if you are
2618 concerned about the fact that code generated by G++ may not be binary
2619 compatible with code generated by other compilers.
2620
2621 Known incompatibilities in @option{-fabi-version=2} (which was the
2622 default from GCC 3.4 to 4.9) include:
2623
2624 @itemize @bullet
2625
2626 @item
2627 A template with a non-type template parameter of reference type was
2628 mangled incorrectly:
2629 @smallexample
2630 extern int N;
2631 template <int &> struct S @{@};
2632 void n (S<N>) @{2@}
2633 @end smallexample
2634
2635 This was fixed in @option{-fabi-version=3}.
2636
2637 @item
2638 SIMD vector types declared using @code{__attribute ((vector_size))} were
2639 mangled in a non-standard way that does not allow for overloading of
2640 functions taking vectors of different sizes.
2641
2642 The mangling was changed in @option{-fabi-version=4}.
2643
2644 @item
2645 @code{__attribute ((const))} and @code{noreturn} were mangled as type
2646 qualifiers, and @code{decltype} of a plain declaration was folded away.
2647
2648 These mangling issues were fixed in @option{-fabi-version=5}.
2649
2650 @item
2651 Scoped enumerators passed as arguments to a variadic function are
2652 promoted like unscoped enumerators, causing @code{va_arg} to complain.
2653 On most targets this does not actually affect the parameter passing
2654 ABI, as there is no way to pass an argument smaller than @code{int}.
2655
2656 Also, the ABI changed the mangling of template argument packs,
2657 @code{const_cast}, @code{static_cast}, prefix increment/decrement, and
2658 a class scope function used as a template argument.
2659
2660 These issues were corrected in @option{-fabi-version=6}.
2661
2662 @item
2663 Lambdas in default argument scope were mangled incorrectly, and the
2664 ABI changed the mangling of @code{nullptr_t}.
2665
2666 These issues were corrected in @option{-fabi-version=7}.
2667
2668 @item
2669 When mangling a function type with function-cv-qualifiers, the
2670 un-qualified function type was incorrectly treated as a substitution
2671 candidate.
2672
2673 This was fixed in @option{-fabi-version=8}, the default for GCC 5.1.
2674
2675 @item
2676 @code{decltype(nullptr)} incorrectly had an alignment of 1, leading to
2677 unaligned accesses. Note that this did not affect the ABI of a
2678 function with a @code{nullptr_t} parameter, as parameters have a
2679 minimum alignment.
2680
2681 This was fixed in @option{-fabi-version=9}, the default for GCC 5.2.
2682
2683 @item
2684 Target-specific attributes that affect the identity of a type, such as
2685 ia32 calling conventions on a function type (stdcall, regparm, etc.),
2686 did not affect the mangled name, leading to name collisions when
2687 function pointers were used as template arguments.
2688
2689 This was fixed in @option{-fabi-version=10}, the default for GCC 6.1.
2690
2691 @end itemize
2692
2693 It also warns about psABI-related changes. The known psABI changes at this
2694 point include:
2695
2696 @itemize @bullet
2697
2698 @item
2699 For SysV/x86-64, unions with @code{long double} members are
2700 passed in memory as specified in psABI. For example:
2701
2702 @smallexample
2703 union U @{
2704 long double ld;
2705 int i;
2706 @};
2707 @end smallexample
2708
2709 @noindent
2710 @code{union U} is always passed in memory.
2711
2712 @end itemize
2713
2714 @item -Wabi-tag @r{(C++ and Objective-C++ only)}
2715 @opindex Wabi-tag
2716 @opindex -Wabi-tag
2717 Warn when a type with an ABI tag is used in a context that does not
2718 have that ABI tag. See @ref{C++ Attributes} for more information
2719 about ABI tags.
2720
2721 @item -Wctor-dtor-privacy @r{(C++ and Objective-C++ only)}
2722 @opindex Wctor-dtor-privacy
2723 @opindex Wno-ctor-dtor-privacy
2724 Warn when a class seems unusable because all the constructors or
2725 destructors in that class are private, and it has neither friends nor
2726 public static member functions. Also warn if there are no non-private
2727 methods, and there's at least one private member function that isn't
2728 a constructor or destructor.
2729
2730 @item -Wdelete-non-virtual-dtor @r{(C++ and Objective-C++ only)}
2731 @opindex Wdelete-non-virtual-dtor
2732 @opindex Wno-delete-non-virtual-dtor
2733 Warn when @code{delete} is used to destroy an instance of a class that
2734 has virtual functions and non-virtual destructor. It is unsafe to delete
2735 an instance of a derived class through a pointer to a base class if the
2736 base class does not have a virtual destructor. This warning is enabled
2737 by @option{-Wall}.
2738
2739 @item -Wliteral-suffix @r{(C++ and Objective-C++ only)}
2740 @opindex Wliteral-suffix
2741 @opindex Wno-literal-suffix
2742 Warn when a string or character literal is followed by a ud-suffix which does
2743 not begin with an underscore. As a conforming extension, GCC treats such
2744 suffixes as separate preprocessing tokens in order to maintain backwards
2745 compatibility with code that uses formatting macros from @code{<inttypes.h>}.
2746 For example:
2747
2748 @smallexample
2749 #define __STDC_FORMAT_MACROS
2750 #include <inttypes.h>
2751 #include <stdio.h>
2752
2753 int main() @{
2754 int64_t i64 = 123;
2755 printf("My int64: %" PRId64"\n", i64);
2756 @}
2757 @end smallexample
2758
2759 In this case, @code{PRId64} is treated as a separate preprocessing token.
2760
2761 This warning is enabled by default.
2762
2763 @item -Wlto-type-mismatch
2764 @opindex Wlto-type-mismatch
2765 @opindex Wno-lto-type-mismatch
2766
2767 During the link-time optimization warn about type mismatches in
2768 global declarations from different compilation units.
2769 Requires @option{-flto} to be enabled. Enabled by default.
2770
2771 @item -Wnarrowing @r{(C++ and Objective-C++ only)}
2772 @opindex Wnarrowing
2773 @opindex Wno-narrowing
2774 With @option{-std=gnu++98} or @option{-std=c++98}, warn when a narrowing
2775 conversion prohibited by C++11 occurs within
2776 @samp{@{ @}}, e.g.
2777
2778 @smallexample
2779 int i = @{ 2.2 @}; // error: narrowing from double to int
2780 @end smallexample
2781
2782 This flag is included in @option{-Wall} and @option{-Wc++11-compat}.
2783
2784 When a later standard is in effect, e.g. when using @option{-std=c++11},
2785 narrowing conversions are diagnosed by default, as required by the standard.
2786 A narrowing conversion from a constant produces an error,
2787 and a narrowing conversion from a non-constant produces a warning,
2788 but @option{-Wno-narrowing} suppresses the diagnostic.
2789 Note that this does not affect the meaning of well-formed code;
2790 narrowing conversions are still considered ill-formed in SFINAE contexts.
2791
2792 @item -Wnoexcept @r{(C++ and Objective-C++ only)}
2793 @opindex Wnoexcept
2794 @opindex Wno-noexcept
2795 Warn when a noexcept-expression evaluates to false because of a call
2796 to a function that does not have a non-throwing exception
2797 specification (i.e. @code{throw()} or @code{noexcept}) but is known by
2798 the compiler to never throw an exception.
2799
2800 @item -Wnon-virtual-dtor @r{(C++ and Objective-C++ only)}
2801 @opindex Wnon-virtual-dtor
2802 @opindex Wno-non-virtual-dtor
2803 Warn when a class has virtual functions and an accessible non-virtual
2804 destructor itself or in an accessible polymorphic base class, in which
2805 case it is possible but unsafe to delete an instance of a derived
2806 class through a pointer to the class itself or base class. This
2807 warning is automatically enabled if @option{-Weffc++} is specified.
2808
2809 @item -Wreorder @r{(C++ and Objective-C++ only)}
2810 @opindex Wreorder
2811 @opindex Wno-reorder
2812 @cindex reordering, warning
2813 @cindex warning for reordering of member initializers
2814 Warn when the order of member initializers given in the code does not
2815 match the order in which they must be executed. For instance:
2816
2817 @smallexample
2818 struct A @{
2819 int i;
2820 int j;
2821 A(): j (0), i (1) @{ @}
2822 @};
2823 @end smallexample
2824
2825 @noindent
2826 The compiler rearranges the member initializers for @code{i}
2827 and @code{j} to match the declaration order of the members, emitting
2828 a warning to that effect. This warning is enabled by @option{-Wall}.
2829
2830 @item -fext-numeric-literals @r{(C++ and Objective-C++ only)}
2831 @opindex fext-numeric-literals
2832 @opindex fno-ext-numeric-literals
2833 Accept imaginary, fixed-point, or machine-defined
2834 literal number suffixes as GNU extensions.
2835 When this option is turned off these suffixes are treated
2836 as C++11 user-defined literal numeric suffixes.
2837 This is on by default for all pre-C++11 dialects and all GNU dialects:
2838 @option{-std=c++98}, @option{-std=gnu++98}, @option{-std=gnu++11},
2839 @option{-std=gnu++14}.
2840 This option is off by default
2841 for ISO C++11 onwards (@option{-std=c++11}, ...).
2842 @end table
2843
2844 The following @option{-W@dots{}} options are not affected by @option{-Wall}.
2845
2846 @table @gcctabopt
2847 @item -Weffc++ @r{(C++ and Objective-C++ only)}
2848 @opindex Weffc++
2849 @opindex Wno-effc++
2850 Warn about violations of the following style guidelines from Scott Meyers'
2851 @cite{Effective C++} series of books:
2852
2853 @itemize @bullet
2854 @item
2855 Define a copy constructor and an assignment operator for classes
2856 with dynamically-allocated memory.
2857
2858 @item
2859 Prefer initialization to assignment in constructors.
2860
2861 @item
2862 Have @code{operator=} return a reference to @code{*this}.
2863
2864 @item
2865 Don't try to return a reference when you must return an object.
2866
2867 @item
2868 Distinguish between prefix and postfix forms of increment and
2869 decrement operators.
2870
2871 @item
2872 Never overload @code{&&}, @code{||}, or @code{,}.
2873
2874 @end itemize
2875
2876 This option also enables @option{-Wnon-virtual-dtor}, which is also
2877 one of the effective C++ recommendations. However, the check is
2878 extended to warn about the lack of virtual destructor in accessible
2879 non-polymorphic bases classes too.
2880
2881 When selecting this option, be aware that the standard library
2882 headers do not obey all of these guidelines; use @samp{grep -v}
2883 to filter out those warnings.
2884
2885 @item -Wstrict-null-sentinel @r{(C++ and Objective-C++ only)}
2886 @opindex Wstrict-null-sentinel
2887 @opindex Wno-strict-null-sentinel
2888 Warn about the use of an uncasted @code{NULL} as sentinel. When
2889 compiling only with GCC this is a valid sentinel, as @code{NULL} is defined
2890 to @code{__null}. Although it is a null pointer constant rather than a
2891 null pointer, it is guaranteed to be of the same size as a pointer.
2892 But this use is not portable across different compilers.
2893
2894 @item -Wno-non-template-friend @r{(C++ and Objective-C++ only)}
2895 @opindex Wno-non-template-friend
2896 @opindex Wnon-template-friend
2897 Disable warnings when non-templatized friend functions are declared
2898 within a template. Since the advent of explicit template specification
2899 support in G++, if the name of the friend is an unqualified-id (i.e.,
2900 @samp{friend foo(int)}), the C++ language specification demands that the
2901 friend declare or define an ordinary, nontemplate function. (Section
2902 14.5.3). Before G++ implemented explicit specification, unqualified-ids
2903 could be interpreted as a particular specialization of a templatized
2904 function. Because this non-conforming behavior is no longer the default
2905 behavior for G++, @option{-Wnon-template-friend} allows the compiler to
2906 check existing code for potential trouble spots and is on by default.
2907 This new compiler behavior can be turned off with
2908 @option{-Wno-non-template-friend}, which keeps the conformant compiler code
2909 but disables the helpful warning.
2910
2911 @item -Wold-style-cast @r{(C++ and Objective-C++ only)}
2912 @opindex Wold-style-cast
2913 @opindex Wno-old-style-cast
2914 Warn if an old-style (C-style) cast to a non-void type is used within
2915 a C++ program. The new-style casts (@code{dynamic_cast},
2916 @code{static_cast}, @code{reinterpret_cast}, and @code{const_cast}) are
2917 less vulnerable to unintended effects and much easier to search for.
2918
2919 @item -Woverloaded-virtual @r{(C++ and Objective-C++ only)}
2920 @opindex Woverloaded-virtual
2921 @opindex Wno-overloaded-virtual
2922 @cindex overloaded virtual function, warning
2923 @cindex warning for overloaded virtual function
2924 Warn when a function declaration hides virtual functions from a
2925 base class. For example, in:
2926
2927 @smallexample
2928 struct A @{
2929 virtual void f();
2930 @};
2931
2932 struct B: public A @{
2933 void f(int);
2934 @};
2935 @end smallexample
2936
2937 the @code{A} class version of @code{f} is hidden in @code{B}, and code
2938 like:
2939
2940 @smallexample
2941 B* b;
2942 b->f();
2943 @end smallexample
2944
2945 @noindent
2946 fails to compile.
2947
2948 @item -Wno-pmf-conversions @r{(C++ and Objective-C++ only)}
2949 @opindex Wno-pmf-conversions
2950 @opindex Wpmf-conversions
2951 Disable the diagnostic for converting a bound pointer to member function
2952 to a plain pointer.
2953
2954 @item -Wsign-promo @r{(C++ and Objective-C++ only)}
2955 @opindex Wsign-promo
2956 @opindex Wno-sign-promo
2957 Warn when overload resolution chooses a promotion from unsigned or
2958 enumerated type to a signed type, over a conversion to an unsigned type of
2959 the same size. Previous versions of G++ tried to preserve
2960 unsignedness, but the standard mandates the current behavior.
2961
2962 @item -Wtemplates @r{(C++ and Objective-C++ only)}
2963 @opindex Wtemplates
2964 Warn when a primary template declaration is encountered. Some coding
2965 rules disallow templates, and this may be used to enforce that rule.
2966 The warning is inactive inside a system header file, such as the STL, so
2967 one can still use the STL. One may also instantiate or specialize
2968 templates.
2969
2970 @item -Wmultiple-inheritance @r{(C++ and Objective-C++ only)}
2971 @opindex Wmultiple-inheritance
2972 Warn when a class is defined with multiple direct base classes. Some
2973 coding rules disallow multiple inheritance, and this may be used to
2974 enforce that rule. The warning is inactive inside a system header file,
2975 such as the STL, so one can still use the STL. One may also define
2976 classes that indirectly use multiple inheritance.
2977
2978 @item -Wvirtual-inheritance
2979 @opindex Wvirtual-inheritance
2980 Warn when a class is defined with a virtual direct base classe. Some
2981 coding rules disallow multiple inheritance, and this may be used to
2982 enforce that rule. The warning is inactive inside a system header file,
2983 such as the STL, so one can still use the STL. One may also define
2984 classes that indirectly use virtual inheritance.
2985
2986 @item -Wnamespaces
2987 @opindex Wnamespaces
2988 Warn when a namespace definition is opened. Some coding rules disallow
2989 namespaces, and this may be used to enforce that rule. The warning is
2990 inactive inside a system header file, such as the STL, so one can still
2991 use the STL. One may also use using directives and qualified names.
2992
2993 @item -Wno-terminate @r{(C++ and Objective-C++ only)}
2994 @opindex Wterminate
2995 @opindex Wno-terminate
2996 Disable the warning about a throw-expression that will immediately
2997 result in a call to @code{terminate}.
2998 @end table
2999
3000 @node Objective-C and Objective-C++ Dialect Options
3001 @section Options Controlling Objective-C and Objective-C++ Dialects
3002
3003 @cindex compiler options, Objective-C and Objective-C++
3004 @cindex Objective-C and Objective-C++ options, command-line
3005 @cindex options, Objective-C and Objective-C++
3006 (NOTE: This manual does not describe the Objective-C and Objective-C++
3007 languages themselves. @xref{Standards,,Language Standards
3008 Supported by GCC}, for references.)
3009
3010 This section describes the command-line options that are only meaningful
3011 for Objective-C and Objective-C++ programs. You can also use most of
3012 the language-independent GNU compiler options.
3013 For example, you might compile a file @file{some_class.m} like this:
3014
3015 @smallexample
3016 gcc -g -fgnu-runtime -O -c some_class.m
3017 @end smallexample
3018
3019 @noindent
3020 In this example, @option{-fgnu-runtime} is an option meant only for
3021 Objective-C and Objective-C++ programs; you can use the other options with
3022 any language supported by GCC@.
3023
3024 Note that since Objective-C is an extension of the C language, Objective-C
3025 compilations may also use options specific to the C front-end (e.g.,
3026 @option{-Wtraditional}). Similarly, Objective-C++ compilations may use
3027 C++-specific options (e.g., @option{-Wabi}).
3028
3029 Here is a list of options that are @emph{only} for compiling Objective-C
3030 and Objective-C++ programs:
3031
3032 @table @gcctabopt
3033 @item -fconstant-string-class=@var{class-name}
3034 @opindex fconstant-string-class
3035 Use @var{class-name} as the name of the class to instantiate for each
3036 literal string specified with the syntax @code{@@"@dots{}"}. The default
3037 class name is @code{NXConstantString} if the GNU runtime is being used, and
3038 @code{NSConstantString} if the NeXT runtime is being used (see below). The
3039 @option{-fconstant-cfstrings} option, if also present, overrides the
3040 @option{-fconstant-string-class} setting and cause @code{@@"@dots{}"} literals
3041 to be laid out as constant CoreFoundation strings.
3042
3043 @item -fgnu-runtime
3044 @opindex fgnu-runtime
3045 Generate object code compatible with the standard GNU Objective-C
3046 runtime. This is the default for most types of systems.
3047
3048 @item -fnext-runtime
3049 @opindex fnext-runtime
3050 Generate output compatible with the NeXT runtime. This is the default
3051 for NeXT-based systems, including Darwin and Mac OS X@. The macro
3052 @code{__NEXT_RUNTIME__} is predefined if (and only if) this option is
3053 used.
3054
3055 @item -fno-nil-receivers
3056 @opindex fno-nil-receivers
3057 Assume that all Objective-C message dispatches (@code{[receiver
3058 message:arg]}) in this translation unit ensure that the receiver is
3059 not @code{nil}. This allows for more efficient entry points in the
3060 runtime to be used. This option is only available in conjunction with
3061 the NeXT runtime and ABI version 0 or 1.
3062
3063 @item -fobjc-abi-version=@var{n}
3064 @opindex fobjc-abi-version
3065 Use version @var{n} of the Objective-C ABI for the selected runtime.
3066 This option is currently supported only for the NeXT runtime. In that
3067 case, Version 0 is the traditional (32-bit) ABI without support for
3068 properties and other Objective-C 2.0 additions. Version 1 is the
3069 traditional (32-bit) ABI with support for properties and other
3070 Objective-C 2.0 additions. Version 2 is the modern (64-bit) ABI. If
3071 nothing is specified, the default is Version 0 on 32-bit target
3072 machines, and Version 2 on 64-bit target machines.
3073
3074 @item -fobjc-call-cxx-cdtors
3075 @opindex fobjc-call-cxx-cdtors
3076 For each Objective-C class, check if any of its instance variables is a
3077 C++ object with a non-trivial default constructor. If so, synthesize a
3078 special @code{- (id) .cxx_construct} instance method which runs
3079 non-trivial default constructors on any such instance variables, in order,
3080 and then return @code{self}. Similarly, check if any instance variable
3081 is a C++ object with a non-trivial destructor, and if so, synthesize a
3082 special @code{- (void) .cxx_destruct} method which runs
3083 all such default destructors, in reverse order.
3084
3085 The @code{- (id) .cxx_construct} and @code{- (void) .cxx_destruct}
3086 methods thusly generated only operate on instance variables
3087 declared in the current Objective-C class, and not those inherited
3088 from superclasses. It is the responsibility of the Objective-C
3089 runtime to invoke all such methods in an object's inheritance
3090 hierarchy. The @code{- (id) .cxx_construct} methods are invoked
3091 by the runtime immediately after a new object instance is allocated;
3092 the @code{- (void) .cxx_destruct} methods are invoked immediately
3093 before the runtime deallocates an object instance.
3094
3095 As of this writing, only the NeXT runtime on Mac OS X 10.4 and later has
3096 support for invoking the @code{- (id) .cxx_construct} and
3097 @code{- (void) .cxx_destruct} methods.
3098
3099 @item -fobjc-direct-dispatch
3100 @opindex fobjc-direct-dispatch
3101 Allow fast jumps to the message dispatcher. On Darwin this is
3102 accomplished via the comm page.
3103
3104 @item -fobjc-exceptions
3105 @opindex fobjc-exceptions
3106 Enable syntactic support for structured exception handling in
3107 Objective-C, similar to what is offered by C++ and Java. This option
3108 is required to use the Objective-C keywords @code{@@try},
3109 @code{@@throw}, @code{@@catch}, @code{@@finally} and
3110 @code{@@synchronized}. This option is available with both the GNU
3111 runtime and the NeXT runtime (but not available in conjunction with
3112 the NeXT runtime on Mac OS X 10.2 and earlier).
3113
3114 @item -fobjc-gc
3115 @opindex fobjc-gc
3116 Enable garbage collection (GC) in Objective-C and Objective-C++
3117 programs. This option is only available with the NeXT runtime; the
3118 GNU runtime has a different garbage collection implementation that
3119 does not require special compiler flags.
3120
3121 @item -fobjc-nilcheck
3122 @opindex fobjc-nilcheck
3123 For the NeXT runtime with version 2 of the ABI, check for a nil
3124 receiver in method invocations before doing the actual method call.
3125 This is the default and can be disabled using
3126 @option{-fno-objc-nilcheck}. Class methods and super calls are never
3127 checked for nil in this way no matter what this flag is set to.
3128 Currently this flag does nothing when the GNU runtime, or an older
3129 version of the NeXT runtime ABI, is used.
3130
3131 @item -fobjc-std=objc1
3132 @opindex fobjc-std
3133 Conform to the language syntax of Objective-C 1.0, the language
3134 recognized by GCC 4.0. This only affects the Objective-C additions to
3135 the C/C++ language; it does not affect conformance to C/C++ standards,
3136 which is controlled by the separate C/C++ dialect option flags. When
3137 this option is used with the Objective-C or Objective-C++ compiler,
3138 any Objective-C syntax that is not recognized by GCC 4.0 is rejected.
3139 This is useful if you need to make sure that your Objective-C code can
3140 be compiled with older versions of GCC@.
3141
3142 @item -freplace-objc-classes
3143 @opindex freplace-objc-classes
3144 Emit a special marker instructing @command{ld(1)} not to statically link in
3145 the resulting object file, and allow @command{dyld(1)} to load it in at
3146 run time instead. This is used in conjunction with the Fix-and-Continue
3147 debugging mode, where the object file in question may be recompiled and
3148 dynamically reloaded in the course of program execution, without the need
3149 to restart the program itself. Currently, Fix-and-Continue functionality
3150 is only available in conjunction with the NeXT runtime on Mac OS X 10.3
3151 and later.
3152
3153 @item -fzero-link
3154 @opindex fzero-link
3155 When compiling for the NeXT runtime, the compiler ordinarily replaces calls
3156 to @code{objc_getClass("@dots{}")} (when the name of the class is known at
3157 compile time) with static class references that get initialized at load time,
3158 which improves run-time performance. Specifying the @option{-fzero-link} flag
3159 suppresses this behavior and causes calls to @code{objc_getClass("@dots{}")}
3160 to be retained. This is useful in Zero-Link debugging mode, since it allows
3161 for individual class implementations to be modified during program execution.
3162 The GNU runtime currently always retains calls to @code{objc_get_class("@dots{}")}
3163 regardless of command-line options.
3164
3165 @item -fno-local-ivars
3166 @opindex fno-local-ivars
3167 @opindex flocal-ivars
3168 By default instance variables in Objective-C can be accessed as if
3169 they were local variables from within the methods of the class they're
3170 declared in. This can lead to shadowing between instance variables
3171 and other variables declared either locally inside a class method or
3172 globally with the same name. Specifying the @option{-fno-local-ivars}
3173 flag disables this behavior thus avoiding variable shadowing issues.
3174
3175 @item -fivar-visibility=@r{[}public@r{|}protected@r{|}private@r{|}package@r{]}
3176 @opindex fivar-visibility
3177 Set the default instance variable visibility to the specified option
3178 so that instance variables declared outside the scope of any access
3179 modifier directives default to the specified visibility.
3180
3181 @item -gen-decls
3182 @opindex gen-decls
3183 Dump interface declarations for all classes seen in the source file to a
3184 file named @file{@var{sourcename}.decl}.
3185
3186 @item -Wassign-intercept @r{(Objective-C and Objective-C++ only)}
3187 @opindex Wassign-intercept
3188 @opindex Wno-assign-intercept
3189 Warn whenever an Objective-C assignment is being intercepted by the
3190 garbage collector.
3191
3192 @item -Wno-protocol @r{(Objective-C and Objective-C++ only)}
3193 @opindex Wno-protocol
3194 @opindex Wprotocol
3195 If a class is declared to implement a protocol, a warning is issued for
3196 every method in the protocol that is not implemented by the class. The
3197 default behavior is to issue a warning for every method not explicitly
3198 implemented in the class, even if a method implementation is inherited
3199 from the superclass. If you use the @option{-Wno-protocol} option, then
3200 methods inherited from the superclass are considered to be implemented,
3201 and no warning is issued for them.
3202
3203 @item -Wselector @r{(Objective-C and Objective-C++ only)}
3204 @opindex Wselector
3205 @opindex Wno-selector
3206 Warn if multiple methods of different types for the same selector are
3207 found during compilation. The check is performed on the list of methods
3208 in the final stage of compilation. Additionally, a check is performed
3209 for each selector appearing in a @code{@@selector(@dots{})}
3210 expression, and a corresponding method for that selector has been found
3211 during compilation. Because these checks scan the method table only at
3212 the end of compilation, these warnings are not produced if the final
3213 stage of compilation is not reached, for example because an error is
3214 found during compilation, or because the @option{-fsyntax-only} option is
3215 being used.
3216
3217 @item -Wstrict-selector-match @r{(Objective-C and Objective-C++ only)}
3218 @opindex Wstrict-selector-match
3219 @opindex Wno-strict-selector-match
3220 Warn if multiple methods with differing argument and/or return types are
3221 found for a given selector when attempting to send a message using this
3222 selector to a receiver of type @code{id} or @code{Class}. When this flag
3223 is off (which is the default behavior), the compiler omits such warnings
3224 if any differences found are confined to types that share the same size
3225 and alignment.
3226
3227 @item -Wundeclared-selector @r{(Objective-C and Objective-C++ only)}
3228 @opindex Wundeclared-selector
3229 @opindex Wno-undeclared-selector
3230 Warn if a @code{@@selector(@dots{})} expression referring to an
3231 undeclared selector is found. A selector is considered undeclared if no
3232 method with that name has been declared before the
3233 @code{@@selector(@dots{})} expression, either explicitly in an
3234 @code{@@interface} or @code{@@protocol} declaration, or implicitly in
3235 an @code{@@implementation} section. This option always performs its
3236 checks as soon as a @code{@@selector(@dots{})} expression is found,
3237 while @option{-Wselector} only performs its checks in the final stage of
3238 compilation. This also enforces the coding style convention
3239 that methods and selectors must be declared before being used.
3240
3241 @item -print-objc-runtime-info
3242 @opindex print-objc-runtime-info
3243 Generate C header describing the largest structure that is passed by
3244 value, if any.
3245
3246 @end table
3247
3248 @node Diagnostic Message Formatting Options
3249 @section Options to Control Diagnostic Messages Formatting
3250 @cindex options to control diagnostics formatting
3251 @cindex diagnostic messages
3252 @cindex message formatting
3253
3254 Traditionally, diagnostic messages have been formatted irrespective of
3255 the output device's aspect (e.g.@: its width, @dots{}). You can use the
3256 options described below
3257 to control the formatting algorithm for diagnostic messages,
3258 e.g.@: how many characters per line, how often source location
3259 information should be reported. Note that some language front ends may not
3260 honor these options.
3261
3262 @table @gcctabopt
3263 @item -fmessage-length=@var{n}
3264 @opindex fmessage-length
3265 Try to format error messages so that they fit on lines of about
3266 @var{n} characters. If @var{n} is zero, then no line-wrapping is
3267 done; each error message appears on a single line. This is the
3268 default for all front ends.
3269
3270 @item -fdiagnostics-show-location=once
3271 @opindex fdiagnostics-show-location
3272 Only meaningful in line-wrapping mode. Instructs the diagnostic messages
3273 reporter to emit source location information @emph{once}; that is, in
3274 case the message is too long to fit on a single physical line and has to
3275 be wrapped, the source location won't be emitted (as prefix) again,
3276 over and over, in subsequent continuation lines. This is the default
3277 behavior.
3278
3279 @item -fdiagnostics-show-location=every-line
3280 Only meaningful in line-wrapping mode. Instructs the diagnostic
3281 messages reporter to emit the same source location information (as
3282 prefix) for physical lines that result from the process of breaking
3283 a message which is too long to fit on a single line.
3284
3285 @item -fdiagnostics-color[=@var{WHEN}]
3286 @itemx -fno-diagnostics-color
3287 @opindex fdiagnostics-color
3288 @cindex highlight, color
3289 @vindex GCC_COLORS @r{environment variable}
3290 Use color in diagnostics. @var{WHEN} is @samp{never}, @samp{always},
3291 or @samp{auto}. The default depends on how the compiler has been configured,
3292 it can be any of the above @var{WHEN} options or also @samp{never}
3293 if @env{GCC_COLORS} environment variable isn't present in the environment,
3294 and @samp{auto} otherwise.
3295 @samp{auto} means to use color only when the standard error is a terminal.
3296 The forms @option{-fdiagnostics-color} and @option{-fno-diagnostics-color} are
3297 aliases for @option{-fdiagnostics-color=always} and
3298 @option{-fdiagnostics-color=never}, respectively.
3299
3300 The colors are defined by the environment variable @env{GCC_COLORS}.
3301 Its value is a colon-separated list of capabilities and Select Graphic
3302 Rendition (SGR) substrings. SGR commands are interpreted by the
3303 terminal or terminal emulator. (See the section in the documentation
3304 of your text terminal for permitted values and their meanings as
3305 character attributes.) These substring values are integers in decimal
3306 representation and can be concatenated with semicolons.
3307 Common values to concatenate include
3308 @samp{1} for bold,
3309 @samp{4} for underline,
3310 @samp{5} for blink,
3311 @samp{7} for inverse,
3312 @samp{39} for default foreground color,
3313 @samp{30} to @samp{37} for foreground colors,
3314 @samp{90} to @samp{97} for 16-color mode foreground colors,
3315 @samp{38;5;0} to @samp{38;5;255}
3316 for 88-color and 256-color modes foreground colors,
3317 @samp{49} for default background color,
3318 @samp{40} to @samp{47} for background colors,
3319 @samp{100} to @samp{107} for 16-color mode background colors,
3320 and @samp{48;5;0} to @samp{48;5;255}
3321 for 88-color and 256-color modes background colors.
3322
3323 The default @env{GCC_COLORS} is
3324 @smallexample
3325 error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01
3326 @end smallexample
3327 @noindent
3328 where @samp{01;31} is bold red, @samp{01;35} is bold magenta,
3329 @samp{01;36} is bold cyan, @samp{01;32} is bold green and
3330 @samp{01} is bold. Setting @env{GCC_COLORS} to the empty
3331 string disables colors.
3332 Supported capabilities are as follows.
3333
3334 @table @code
3335 @item error=
3336 @vindex error GCC_COLORS @r{capability}
3337 SGR substring for error: markers.
3338
3339 @item warning=
3340 @vindex warning GCC_COLORS @r{capability}
3341 SGR substring for warning: markers.
3342
3343 @item note=
3344 @vindex note GCC_COLORS @r{capability}
3345 SGR substring for note: markers.
3346
3347 @item caret=
3348 @vindex caret GCC_COLORS @r{capability}
3349 SGR substring for caret line.
3350
3351 @item locus=
3352 @vindex locus GCC_COLORS @r{capability}
3353 SGR substring for location information, @samp{file:line} or
3354 @samp{file:line:column} etc.
3355
3356 @item quote=
3357 @vindex quote GCC_COLORS @r{capability}
3358 SGR substring for information printed within quotes.
3359 @end table
3360
3361 @item -fno-diagnostics-show-option
3362 @opindex fno-diagnostics-show-option
3363 @opindex fdiagnostics-show-option
3364 By default, each diagnostic emitted includes text indicating the
3365 command-line option that directly controls the diagnostic (if such an
3366 option is known to the diagnostic machinery). Specifying the
3367 @option{-fno-diagnostics-show-option} flag suppresses that behavior.
3368
3369 @item -fno-diagnostics-show-caret
3370 @opindex fno-diagnostics-show-caret
3371 @opindex fdiagnostics-show-caret
3372 By default, each diagnostic emitted includes the original source line
3373 and a caret @samp{^} indicating the column. This option suppresses this
3374 information. The source line is truncated to @var{n} characters, if
3375 the @option{-fmessage-length=n} option is given. When the output is done
3376 to the terminal, the width is limited to the width given by the
3377 @env{COLUMNS} environment variable or, if not set, to the terminal width.
3378
3379 @end table
3380
3381 @node Warning Options
3382 @section Options to Request or Suppress Warnings
3383 @cindex options to control warnings
3384 @cindex warning messages
3385 @cindex messages, warning
3386 @cindex suppressing warnings
3387
3388 Warnings are diagnostic messages that report constructions that
3389 are not inherently erroneous but that are risky or suggest there
3390 may have been an error.
3391
3392 The following language-independent options do not enable specific
3393 warnings but control the kinds of diagnostics produced by GCC@.
3394
3395 @table @gcctabopt
3396 @cindex syntax checking
3397 @item -fsyntax-only
3398 @opindex fsyntax-only
3399 Check the code for syntax errors, but don't do anything beyond that.
3400
3401 @item -fmax-errors=@var{n}
3402 @opindex fmax-errors
3403 Limits the maximum number of error messages to @var{n}, at which point
3404 GCC bails out rather than attempting to continue processing the source
3405 code. If @var{n} is 0 (the default), there is no limit on the number
3406 of error messages produced. If @option{-Wfatal-errors} is also
3407 specified, then @option{-Wfatal-errors} takes precedence over this
3408 option.
3409
3410 @item -w
3411 @opindex w
3412 Inhibit all warning messages.
3413
3414 @item -Werror
3415 @opindex Werror
3416 @opindex Wno-error
3417 Make all warnings into errors.
3418
3419 @item -Werror=
3420 @opindex Werror=
3421 @opindex Wno-error=
3422 Make the specified warning into an error. The specifier for a warning
3423 is appended; for example @option{-Werror=switch} turns the warnings
3424 controlled by @option{-Wswitch} into errors. This switch takes a
3425 negative form, to be used to negate @option{-Werror} for specific
3426 warnings; for example @option{-Wno-error=switch} makes
3427 @option{-Wswitch} warnings not be errors, even when @option{-Werror}
3428 is in effect.
3429
3430 The warning message for each controllable warning includes the
3431 option that controls the warning. That option can then be used with
3432 @option{-Werror=} and @option{-Wno-error=} as described above.
3433 (Printing of the option in the warning message can be disabled using the
3434 @option{-fno-diagnostics-show-option} flag.)
3435
3436 Note that specifying @option{-Werror=}@var{foo} automatically implies
3437 @option{-W}@var{foo}. However, @option{-Wno-error=}@var{foo} does not
3438 imply anything.
3439
3440 @item -Wfatal-errors
3441 @opindex Wfatal-errors
3442 @opindex Wno-fatal-errors
3443 This option causes the compiler to abort compilation on the first error
3444 occurred rather than trying to keep going and printing further error
3445 messages.
3446
3447 @end table
3448
3449 You can request many specific warnings with options beginning with
3450 @samp{-W}, for example @option{-Wimplicit} to request warnings on
3451 implicit declarations. Each of these specific warning options also
3452 has a negative form beginning @samp{-Wno-} to turn off warnings; for
3453 example, @option{-Wno-implicit}. This manual lists only one of the
3454 two forms, whichever is not the default. For further
3455 language-specific options also refer to @ref{C++ Dialect Options} and
3456 @ref{Objective-C and Objective-C++ Dialect Options}.
3457
3458 Some options, such as @option{-Wall} and @option{-Wextra}, turn on other
3459 options, such as @option{-Wunused}, which may turn on further options,
3460 such as @option{-Wunused-value}. The combined effect of positive and
3461 negative forms is that more specific options have priority over less
3462 specific ones, independently of their position in the command-line. For
3463 options of the same specificity, the last one takes effect. Options
3464 enabled or disabled via pragmas (@pxref{Diagnostic Pragmas}) take effect
3465 as if they appeared at the end of the command-line.
3466
3467 When an unrecognized warning option is requested (e.g.,
3468 @option{-Wunknown-warning}), GCC emits a diagnostic stating
3469 that the option is not recognized. However, if the @option{-Wno-} form
3470 is used, the behavior is slightly different: no diagnostic is
3471 produced for @option{-Wno-unknown-warning} unless other diagnostics
3472 are being produced. This allows the use of new @option{-Wno-} options
3473 with old compilers, but if something goes wrong, the compiler
3474 warns that an unrecognized option is present.
3475
3476 @table @gcctabopt
3477 @item -Wpedantic
3478 @itemx -pedantic
3479 @opindex pedantic
3480 @opindex Wpedantic
3481 Issue all the warnings demanded by strict ISO C and ISO C++;
3482 reject all programs that use forbidden extensions, and some other
3483 programs that do not follow ISO C and ISO C++. For ISO C, follows the
3484 version of the ISO C standard specified by any @option{-std} option used.
3485
3486 Valid ISO C and ISO C++ programs should compile properly with or without
3487 this option (though a rare few require @option{-ansi} or a
3488 @option{-std} option specifying the required version of ISO C)@. However,
3489 without this option, certain GNU extensions and traditional C and C++
3490 features are supported as well. With this option, they are rejected.
3491
3492 @option{-Wpedantic} does not cause warning messages for use of the
3493 alternate keywords whose names begin and end with @samp{__}. Pedantic
3494 warnings are also disabled in the expression that follows
3495 @code{__extension__}. However, only system header files should use
3496 these escape routes; application programs should avoid them.
3497 @xref{Alternate Keywords}.
3498
3499 Some users try to use @option{-Wpedantic} to check programs for strict ISO
3500 C conformance. They soon find that it does not do quite what they want:
3501 it finds some non-ISO practices, but not all---only those for which
3502 ISO C @emph{requires} a diagnostic, and some others for which
3503 diagnostics have been added.
3504
3505 A feature to report any failure to conform to ISO C might be useful in
3506 some instances, but would require considerable additional work and would
3507 be quite different from @option{-Wpedantic}. We don't have plans to
3508 support such a feature in the near future.
3509
3510 Where the standard specified with @option{-std} represents a GNU
3511 extended dialect of C, such as @samp{gnu90} or @samp{gnu99}, there is a
3512 corresponding @dfn{base standard}, the version of ISO C on which the GNU
3513 extended dialect is based. Warnings from @option{-Wpedantic} are given
3514 where they are required by the base standard. (It does not make sense
3515 for such warnings to be given only for features not in the specified GNU
3516 C dialect, since by definition the GNU dialects of C include all
3517 features the compiler supports with the given option, and there would be
3518 nothing to warn about.)
3519
3520 @item -pedantic-errors
3521 @opindex pedantic-errors
3522 Give an error whenever the @dfn{base standard} (see @option{-Wpedantic})
3523 requires a diagnostic, in some cases where there is undefined behavior
3524 at compile-time and in some other cases that do not prevent compilation
3525 of programs that are valid according to the standard. This is not
3526 equivalent to @option{-Werror=pedantic}, since there are errors enabled
3527 by this option and not enabled by the latter and vice versa.
3528
3529 @item -Wall
3530 @opindex Wall
3531 @opindex Wno-all
3532 This enables all the warnings about constructions that some users
3533 consider questionable, and that are easy to avoid (or modify to
3534 prevent the warning), even in conjunction with macros. This also
3535 enables some language-specific warnings described in @ref{C++ Dialect
3536 Options} and @ref{Objective-C and Objective-C++ Dialect Options}.
3537
3538 @option{-Wall} turns on the following warning flags:
3539
3540 @gccoptlist{-Waddress @gol
3541 -Warray-bounds=1 @r{(only with} @option{-O2}@r{)} @gol
3542 -Wbool-compare @gol
3543 -Wc++11-compat -Wc++14-compat@gol
3544 -Wchar-subscripts @gol
3545 -Wcomment @gol
3546 -Wduplicate-decl-specifier @r{(C and Objective-C only)} @gol
3547 -Wenum-compare @r{(in C/ObjC; this is on by default in C++)} @gol
3548 -Wformat @gol
3549 -Wimplicit @r{(C and Objective-C only)} @gol
3550 -Wimplicit-int @r{(C and Objective-C only)} @gol
3551 -Wimplicit-function-declaration @r{(C and Objective-C only)} @gol
3552 -Winit-self @r{(only for C++)} @gol
3553 -Wlogical-not-parentheses
3554 -Wmain @r{(only for C/ObjC and unless} @option{-ffreestanding}@r{)} @gol
3555 -Wmaybe-uninitialized @gol
3556 -Wmemset-elt-size @gol
3557 -Wmemset-transposed-args @gol
3558 -Wmisleading-indentation @r{(only for C/C++)} @gol
3559 -Wmissing-braces @r{(only for C/ObjC)} @gol
3560 -Wnarrowing @r{(only for C++)} @gol
3561 -Wnonnull @gol
3562 -Wnonnull-compare @gol
3563 -Wopenmp-simd @gol
3564 -Wparentheses @gol
3565 -Wpointer-sign @gol
3566 -Wreorder @gol
3567 -Wreturn-type @gol
3568 -Wsequence-point @gol
3569 -Wsign-compare @r{(only in C++)} @gol
3570 -Wsizeof-pointer-memaccess @gol
3571 -Wstrict-aliasing @gol
3572 -Wstrict-overflow=1 @gol
3573 -Wswitch @gol
3574 -Wtautological-compare @gol
3575 -Wtrigraphs @gol
3576 -Wuninitialized @gol
3577 -Wunknown-pragmas @gol
3578 -Wunused-function @gol
3579 -Wunused-label @gol
3580 -Wunused-value @gol
3581 -Wunused-variable @gol
3582 -Wvolatile-register-var @gol
3583 }
3584
3585 Note that some warning flags are not implied by @option{-Wall}. Some of
3586 them warn about constructions that users generally do not consider
3587 questionable, but which occasionally you might wish to check for;
3588 others warn about constructions that are necessary or hard to avoid in
3589 some cases, and there is no simple way to modify the code to suppress
3590 the warning. Some of them are enabled by @option{-Wextra} but many of
3591 them must be enabled individually.
3592
3593 @item -Wextra
3594 @opindex W
3595 @opindex Wextra
3596 @opindex Wno-extra
3597 This enables some extra warning flags that are not enabled by
3598 @option{-Wall}. (This option used to be called @option{-W}. The older
3599 name is still supported, but the newer name is more descriptive.)
3600
3601 @gccoptlist{-Wclobbered @gol
3602 -Wempty-body @gol
3603 -Wignored-qualifiers @gol
3604 -Wmissing-field-initializers @gol
3605 -Wmissing-parameter-type @r{(C only)} @gol
3606 -Wold-style-declaration @r{(C only)} @gol
3607 -Woverride-init @gol
3608 -Wsign-compare @r{(C only)} @gol
3609 -Wtype-limits @gol
3610 -Wuninitialized @gol
3611 -Wshift-negative-value @r{(in C++03 and in C99 and newer)} @gol
3612 -Wunused-parameter @r{(only with} @option{-Wunused} @r{or} @option{-Wall}@r{)} @gol
3613 -Wunused-but-set-parameter @r{(only with} @option{-Wunused} @r{or} @option{-Wall}@r{)} @gol
3614 }
3615
3616 The option @option{-Wextra} also prints warning messages for the
3617 following cases:
3618
3619 @itemize @bullet
3620
3621 @item
3622 A pointer is compared against integer zero with @code{<}, @code{<=},
3623 @code{>}, or @code{>=}.
3624
3625 @item
3626 (C++ only) An enumerator and a non-enumerator both appear in a
3627 conditional expression.
3628
3629 @item
3630 (C++ only) Ambiguous virtual bases.
3631
3632 @item
3633 (C++ only) Subscripting an array that has been declared @code{register}.
3634
3635 @item
3636 (C++ only) Taking the address of a variable that has been declared
3637 @code{register}.
3638
3639 @item
3640 (C++ only) A base class is not initialized in a derived class's copy
3641 constructor.
3642
3643 @end itemize
3644
3645 @item -Wchar-subscripts
3646 @opindex Wchar-subscripts
3647 @opindex Wno-char-subscripts
3648 Warn if an array subscript has type @code{char}. This is a common cause
3649 of error, as programmers often forget that this type is signed on some
3650 machines.
3651 This warning is enabled by @option{-Wall}.
3652
3653 @item -Wcomment
3654 @opindex Wcomment
3655 @opindex Wno-comment
3656 Warn whenever a comment-start sequence @samp{/*} appears in a @samp{/*}
3657 comment, or whenever a Backslash-Newline appears in a @samp{//} comment.
3658 This warning is enabled by @option{-Wall}.
3659
3660 @item -Wno-coverage-mismatch
3661 @opindex Wno-coverage-mismatch
3662 Warn if feedback profiles do not match when using the
3663 @option{-fprofile-use} option.
3664 If a source file is changed between compiling with @option{-fprofile-gen} and
3665 with @option{-fprofile-use}, the files with the profile feedback can fail
3666 to match the source file and GCC cannot use the profile feedback
3667 information. By default, this warning is enabled and is treated as an
3668 error. @option{-Wno-coverage-mismatch} can be used to disable the
3669 warning or @option{-Wno-error=coverage-mismatch} can be used to
3670 disable the error. Disabling the error for this warning can result in
3671 poorly optimized code and is useful only in the
3672 case of very minor changes such as bug fixes to an existing code-base.
3673 Completely disabling the warning is not recommended.
3674
3675 @item -Wno-cpp
3676 @r{(C, Objective-C, C++, Objective-C++ and Fortran only)}
3677
3678 Suppress warning messages emitted by @code{#warning} directives.
3679
3680 @item -Wdouble-promotion @r{(C, C++, Objective-C and Objective-C++ only)}
3681 @opindex Wdouble-promotion
3682 @opindex Wno-double-promotion
3683 Give a warning when a value of type @code{float} is implicitly
3684 promoted to @code{double}. CPUs with a 32-bit ``single-precision''
3685 floating-point unit implement @code{float} in hardware, but emulate
3686 @code{double} in software. On such a machine, doing computations
3687 using @code{double} values is much more expensive because of the
3688 overhead required for software emulation.
3689
3690 It is easy to accidentally do computations with @code{double} because
3691 floating-point literals are implicitly of type @code{double}. For
3692 example, in:
3693 @smallexample
3694 @group
3695 float area(float radius)
3696 @{
3697 return 3.14159 * radius * radius;
3698 @}
3699 @end group
3700 @end smallexample
3701 the compiler performs the entire computation with @code{double}
3702 because the floating-point literal is a @code{double}.
3703
3704 @item -Wduplicate-decl-specifier @r{(C and Objective-C only)}
3705 @opindex Wduplicate-decl-specifier
3706 @opindex Wno-duplicate-decl-specifier
3707 Warn if a declaration has duplicate @code{const}, @code{volatile},
3708 @code{restrict} or @code{_Atomic} specifier. This warning is enabled by
3709 @option{-Wall}.
3710
3711 @item -Wformat
3712 @itemx -Wformat=@var{n}
3713 @opindex Wformat
3714 @opindex Wno-format
3715 @opindex ffreestanding
3716 @opindex fno-builtin
3717 @opindex Wformat=
3718 Check calls to @code{printf} and @code{scanf}, etc., to make sure that
3719 the arguments supplied have types appropriate to the format string
3720 specified, and that the conversions specified in the format string make
3721 sense. This includes standard functions, and others specified by format
3722 attributes (@pxref{Function Attributes}), in the @code{printf},
3723 @code{scanf}, @code{strftime} and @code{strfmon} (an X/Open extension,
3724 not in the C standard) families (or other target-specific families).
3725 Which functions are checked without format attributes having been
3726 specified depends on the standard version selected, and such checks of
3727 functions without the attribute specified are disabled by
3728 @option{-ffreestanding} or @option{-fno-builtin}.
3729
3730 The formats are checked against the format features supported by GNU
3731 libc version 2.2. These include all ISO C90 and C99 features, as well
3732 as features from the Single Unix Specification and some BSD and GNU
3733 extensions. Other library implementations may not support all these
3734 features; GCC does not support warning about features that go beyond a
3735 particular library's limitations. However, if @option{-Wpedantic} is used
3736 with @option{-Wformat}, warnings are given about format features not
3737 in the selected standard version (but not for @code{strfmon} formats,
3738 since those are not in any version of the C standard). @xref{C Dialect
3739 Options,,Options Controlling C Dialect}.
3740
3741 @table @gcctabopt
3742 @item -Wformat=1
3743 @itemx -Wformat
3744 @opindex Wformat
3745 @opindex Wformat=1
3746 Option @option{-Wformat} is equivalent to @option{-Wformat=1}, and
3747 @option{-Wno-format} is equivalent to @option{-Wformat=0}. Since
3748 @option{-Wformat} also checks for null format arguments for several
3749 functions, @option{-Wformat} also implies @option{-Wnonnull}. Some
3750 aspects of this level of format checking can be disabled by the
3751 options: @option{-Wno-format-contains-nul},
3752 @option{-Wno-format-extra-args}, and @option{-Wno-format-zero-length}.
3753 @option{-Wformat} is enabled by @option{-Wall}.
3754
3755 @item -Wno-format-contains-nul
3756 @opindex Wno-format-contains-nul
3757 @opindex Wformat-contains-nul
3758 If @option{-Wformat} is specified, do not warn about format strings that
3759 contain NUL bytes.
3760
3761 @item -Wno-format-extra-args
3762 @opindex Wno-format-extra-args
3763 @opindex Wformat-extra-args
3764 If @option{-Wformat} is specified, do not warn about excess arguments to a
3765 @code{printf} or @code{scanf} format function. The C standard specifies
3766 that such arguments are ignored.
3767
3768 Where the unused arguments lie between used arguments that are
3769 specified with @samp{$} operand number specifications, normally
3770 warnings are still given, since the implementation could not know what
3771 type to pass to @code{va_arg} to skip the unused arguments. However,
3772 in the case of @code{scanf} formats, this option suppresses the
3773 warning if the unused arguments are all pointers, since the Single
3774 Unix Specification says that such unused arguments are allowed.
3775
3776 @item -Wno-format-zero-length
3777 @opindex Wno-format-zero-length
3778 @opindex Wformat-zero-length
3779 If @option{-Wformat} is specified, do not warn about zero-length formats.
3780 The C standard specifies that zero-length formats are allowed.
3781
3782
3783 @item -Wformat=2
3784 @opindex Wformat=2
3785 Enable @option{-Wformat} plus additional format checks. Currently
3786 equivalent to @option{-Wformat -Wformat-nonliteral -Wformat-security
3787 -Wformat-y2k}.
3788
3789 @item -Wformat-nonliteral
3790 @opindex Wformat-nonliteral
3791 @opindex Wno-format-nonliteral
3792 If @option{-Wformat} is specified, also warn if the format string is not a
3793 string literal and so cannot be checked, unless the format function
3794 takes its format arguments as a @code{va_list}.
3795
3796 @item -Wformat-security
3797 @opindex Wformat-security
3798 @opindex Wno-format-security
3799 If @option{-Wformat} is specified, also warn about uses of format
3800 functions that represent possible security problems. At present, this
3801 warns about calls to @code{printf} and @code{scanf} functions where the
3802 format string is not a string literal and there are no format arguments,
3803 as in @code{printf (foo);}. This may be a security hole if the format
3804 string came from untrusted input and contains @samp{%n}. (This is
3805 currently a subset of what @option{-Wformat-nonliteral} warns about, but
3806 in future warnings may be added to @option{-Wformat-security} that are not
3807 included in @option{-Wformat-nonliteral}.)
3808
3809 @item -Wformat-signedness
3810 @opindex Wformat-signedness
3811 @opindex Wno-format-signedness
3812 If @option{-Wformat} is specified, also warn if the format string
3813 requires an unsigned argument and the argument is signed and vice versa.
3814
3815 @item -Wformat-y2k
3816 @opindex Wformat-y2k
3817 @opindex Wno-format-y2k
3818 If @option{-Wformat} is specified, also warn about @code{strftime}
3819 formats that may yield only a two-digit year.
3820 @end table
3821
3822 @item -Wnonnull
3823 @opindex Wnonnull
3824 @opindex Wno-nonnull
3825 Warn about passing a null pointer for arguments marked as
3826 requiring a non-null value by the @code{nonnull} function attribute.
3827
3828 @option{-Wnonnull} is included in @option{-Wall} and @option{-Wformat}. It
3829 can be disabled with the @option{-Wno-nonnull} option.
3830
3831 @item -Wnonnull-compare
3832 @opindex Wnonnull-compare
3833 @opindex Wno-nonnull-compare
3834 Warn when comparing an argument marked with the @code{nonnull}
3835 function attribute against null inside the function.
3836
3837 @option{-Wnonnull-compare} is included in @option{-Wall}. It
3838 can be disabled with the @option{-Wno-nonnull-compare} option.
3839
3840 @item -Wnull-dereference
3841 @opindex Wnull-dereference
3842 @opindex Wno-null-dereference
3843 Warn if the compiler detects paths that trigger erroneous or
3844 undefined behavior due to dereferencing a null pointer. This option
3845 is only active when @option{-fdelete-null-pointer-checks} is active,
3846 which is enabled by optimizations in most targets. The precision of
3847 the warnings depends on the optimization options used.
3848
3849 @item -Winit-self @r{(C, C++, Objective-C and Objective-C++ only)}
3850 @opindex Winit-self
3851 @opindex Wno-init-self
3852 Warn about uninitialized variables that are initialized with themselves.
3853 Note this option can only be used with the @option{-Wuninitialized} option.
3854
3855 For example, GCC warns about @code{i} being uninitialized in the
3856 following snippet only when @option{-Winit-self} has been specified:
3857 @smallexample
3858 @group
3859 int f()
3860 @{
3861 int i = i;
3862 return i;
3863 @}
3864 @end group
3865 @end smallexample
3866
3867 This warning is enabled by @option{-Wall} in C++.
3868
3869 @item -Wimplicit-int @r{(C and Objective-C only)}
3870 @opindex Wimplicit-int
3871 @opindex Wno-implicit-int
3872 Warn when a declaration does not specify a type.
3873 This warning is enabled by @option{-Wall}.
3874
3875 @item -Wimplicit-function-declaration @r{(C and Objective-C only)}
3876 @opindex Wimplicit-function-declaration
3877 @opindex Wno-implicit-function-declaration
3878 Give a warning whenever a function is used before being declared. In
3879 C99 mode (@option{-std=c99} or @option{-std=gnu99}), this warning is
3880 enabled by default and it is made into an error by
3881 @option{-pedantic-errors}. This warning is also enabled by
3882 @option{-Wall}.
3883
3884 @item -Wimplicit @r{(C and Objective-C only)}
3885 @opindex Wimplicit
3886 @opindex Wno-implicit
3887 Same as @option{-Wimplicit-int} and @option{-Wimplicit-function-declaration}.
3888 This warning is enabled by @option{-Wall}.
3889
3890 @item -Wignored-qualifiers @r{(C and C++ only)}
3891 @opindex Wignored-qualifiers
3892 @opindex Wno-ignored-qualifiers
3893 Warn if the return type of a function has a type qualifier
3894 such as @code{const}. For ISO C such a type qualifier has no effect,
3895 since the value returned by a function is not an lvalue.
3896 For C++, the warning is only emitted for scalar types or @code{void}.
3897 ISO C prohibits qualified @code{void} return types on function
3898 definitions, so such return types always receive a warning
3899 even without this option.
3900
3901 This warning is also enabled by @option{-Wextra}.
3902
3903 @item -Wignored-attributes @r{(C and C++ only)}
3904 @opindex Wignored-attributes
3905 @opindex Wno-ignored-attributes
3906 Warn when an attribute is ignored. This is different from the
3907 @option{-Wattributes} option in that it warns whenever the compiler decides
3908 to drop an attribute, not that the attribute is either unknown, used in a
3909 wrong place, etc. This warning is enabled by default.
3910
3911 @item -Wmain
3912 @opindex Wmain
3913 @opindex Wno-main
3914 Warn if the type of @code{main} is suspicious. @code{main} should be
3915 a function with external linkage, returning int, taking either zero
3916 arguments, two, or three arguments of appropriate types. This warning
3917 is enabled by default in C++ and is enabled by either @option{-Wall}
3918 or @option{-Wpedantic}.
3919
3920 @item -Wmisleading-indentation @r{(C and C++ only)}
3921 @opindex Wmisleading-indentation
3922 @opindex Wno-misleading-indentation
3923 Warn when the indentation of the code does not reflect the block structure.
3924 Specifically, a warning is issued for @code{if}, @code{else}, @code{while}, and
3925 @code{for} clauses with a guarded statement that does not use braces,
3926 followed by an unguarded statement with the same indentation.
3927
3928 In the following example, the call to ``bar'' is misleadingly indented as
3929 if it were guarded by the ``if'' conditional.
3930
3931 @smallexample
3932 if (some_condition ())
3933 foo ();
3934 bar (); /* Gotcha: this is not guarded by the "if". */
3935 @end smallexample
3936
3937 In the case of mixed tabs and spaces, the warning uses the
3938 @option{-ftabstop=} option to determine if the statements line up
3939 (defaulting to 8).
3940
3941 The warning is not issued for code involving multiline preprocessor logic
3942 such as the following example.
3943
3944 @smallexample
3945 if (flagA)
3946 foo (0);
3947 #if SOME_CONDITION_THAT_DOES_NOT_HOLD
3948 if (flagB)
3949 #endif
3950 foo (1);
3951 @end smallexample
3952
3953 The warning is not issued after a @code{#line} directive, since this
3954 typically indicates autogenerated code, and no assumptions can be made
3955 about the layout of the file that the directive references.
3956
3957 This warning is enabled by @option{-Wall} in C and C++.
3958
3959 @item -Wmissing-braces
3960 @opindex Wmissing-braces
3961 @opindex Wno-missing-braces
3962 Warn if an aggregate or union initializer is not fully bracketed. In
3963 the following example, the initializer for @code{a} is not fully
3964 bracketed, but that for @code{b} is fully bracketed. This warning is
3965 enabled by @option{-Wall} in C.
3966
3967 @smallexample
3968 int a[2][2] = @{ 0, 1, 2, 3 @};
3969 int b[2][2] = @{ @{ 0, 1 @}, @{ 2, 3 @} @};
3970 @end smallexample
3971
3972 This warning is enabled by @option{-Wall}.
3973
3974 @item -Wmissing-include-dirs @r{(C, C++, Objective-C and Objective-C++ only)}
3975 @opindex Wmissing-include-dirs
3976 @opindex Wno-missing-include-dirs
3977 Warn if a user-supplied include directory does not exist.
3978
3979 @item -Wparentheses
3980 @opindex Wparentheses
3981 @opindex Wno-parentheses
3982 Warn if parentheses are omitted in certain contexts, such
3983 as when there is an assignment in a context where a truth value
3984 is expected, or when operators are nested whose precedence people
3985 often get confused about.
3986
3987 Also warn if a comparison like @code{x<=y<=z} appears; this is
3988 equivalent to @code{(x<=y ? 1 : 0) <= z}, which is a different
3989 interpretation from that of ordinary mathematical notation.
3990
3991 Also warn for dangerous uses of the GNU extension to
3992 @code{?:} with omitted middle operand. When the condition
3993 in the @code{?}: operator is a boolean expression, the omitted value is
3994 always 1. Often programmers expect it to be a value computed
3995 inside the conditional expression instead.
3996
3997 This warning is enabled by @option{-Wall}.
3998
3999 @item -Wsequence-point
4000 @opindex Wsequence-point
4001 @opindex Wno-sequence-point
4002 Warn about code that may have undefined semantics because of violations
4003 of sequence point rules in the C and C++ standards.
4004
4005 The C and C++ standards define the order in which expressions in a C/C++
4006 program are evaluated in terms of @dfn{sequence points}, which represent
4007 a partial ordering between the execution of parts of the program: those
4008 executed before the sequence point, and those executed after it. These
4009 occur after the evaluation of a full expression (one which is not part
4010 of a larger expression), after the evaluation of the first operand of a
4011 @code{&&}, @code{||}, @code{? :} or @code{,} (comma) operator, before a
4012 function is called (but after the evaluation of its arguments and the
4013 expression denoting the called function), and in certain other places.
4014 Other than as expressed by the sequence point rules, the order of
4015 evaluation of subexpressions of an expression is not specified. All
4016 these rules describe only a partial order rather than a total order,
4017 since, for example, if two functions are called within one expression
4018 with no sequence point between them, the order in which the functions
4019 are called is not specified. However, the standards committee have
4020 ruled that function calls do not overlap.
4021
4022 It is not specified when between sequence points modifications to the
4023 values of objects take effect. Programs whose behavior depends on this
4024 have undefined behavior; the C and C++ standards specify that ``Between
4025 the previous and next sequence point an object shall have its stored
4026 value modified at most once by the evaluation of an expression.
4027 Furthermore, the prior value shall be read only to determine the value
4028 to be stored.''. If a program breaks these rules, the results on any
4029 particular implementation are entirely unpredictable.
4030
4031 Examples of code with undefined behavior are @code{a = a++;}, @code{a[n]
4032 = b[n++]} and @code{a[i++] = i;}. Some more complicated cases are not
4033 diagnosed by this option, and it may give an occasional false positive
4034 result, but in general it has been found fairly effective at detecting
4035 this sort of problem in programs.
4036
4037 The standard is worded confusingly, therefore there is some debate
4038 over the precise meaning of the sequence point rules in subtle cases.
4039 Links to discussions of the problem, including proposed formal
4040 definitions, may be found on the GCC readings page, at
4041 @uref{http://gcc.gnu.org/@/readings.html}.
4042
4043 This warning is enabled by @option{-Wall} for C and C++.
4044
4045 @item -Wno-return-local-addr
4046 @opindex Wno-return-local-addr
4047 @opindex Wreturn-local-addr
4048 Do not warn about returning a pointer (or in C++, a reference) to a
4049 variable that goes out of scope after the function returns.
4050
4051 @item -Wreturn-type
4052 @opindex Wreturn-type
4053 @opindex Wno-return-type
4054 Warn whenever a function is defined with a return type that defaults
4055 to @code{int}. Also warn about any @code{return} statement with no
4056 return value in a function whose return type is not @code{void}
4057 (falling off the end of the function body is considered returning
4058 without a value), and about a @code{return} statement with an
4059 expression in a function whose return type is @code{void}.
4060
4061 For C++, a function without return type always produces a diagnostic
4062 message, even when @option{-Wno-return-type} is specified. The only
4063 exceptions are @code{main} and functions defined in system headers.
4064
4065 This warning is enabled by @option{-Wall}.
4066
4067 @item -Wshift-count-negative
4068 @opindex Wshift-count-negative
4069 @opindex Wno-shift-count-negative
4070 Warn if shift count is negative. This warning is enabled by default.
4071
4072 @item -Wshift-count-overflow
4073 @opindex Wshift-count-overflow
4074 @opindex Wno-shift-count-overflow
4075 Warn if shift count >= width of type. This warning is enabled by default.
4076
4077 @item -Wshift-negative-value
4078 @opindex Wshift-negative-value
4079 @opindex Wno-shift-negative-value
4080 Warn if left shifting a negative value. This warning is enabled by
4081 @option{-Wextra} in C99 and C++11 modes (and newer).
4082
4083 @item -Wshift-overflow
4084 @itemx -Wshift-overflow=@var{n}
4085 @opindex Wshift-overflow
4086 @opindex Wno-shift-overflow
4087 Warn about left shift overflows. This warning is enabled by
4088 default in C99 and C++11 modes (and newer).
4089
4090 @table @gcctabopt
4091 @item -Wshift-overflow=1
4092 This is the warning level of @option{-Wshift-overflow} and is enabled
4093 by default in C99 and C++11 modes (and newer). This warning level does
4094 not warn about left-shifting 1 into the sign bit. (However, in C, such
4095 an overflow is still rejected in contexts where an integer constant expression
4096 is required.)
4097
4098 @item -Wshift-overflow=2
4099 This warning level also warns about left-shifting 1 into the sign bit,
4100 unless C++14 mode is active.
4101 @end table
4102
4103 @item -Wswitch
4104 @opindex Wswitch
4105 @opindex Wno-switch
4106 Warn whenever a @code{switch} statement has an index of enumerated type
4107 and lacks a @code{case} for one or more of the named codes of that
4108 enumeration. (The presence of a @code{default} label prevents this
4109 warning.) @code{case} labels outside the enumeration range also
4110 provoke warnings when this option is used (even if there is a
4111 @code{default} label).
4112 This warning is enabled by @option{-Wall}.
4113
4114 @item -Wswitch-default
4115 @opindex Wswitch-default
4116 @opindex Wno-switch-default
4117 Warn whenever a @code{switch} statement does not have a @code{default}
4118 case.
4119
4120 @item -Wswitch-enum
4121 @opindex Wswitch-enum
4122 @opindex Wno-switch-enum
4123 Warn whenever a @code{switch} statement has an index of enumerated type
4124 and lacks a @code{case} for one or more of the named codes of that
4125 enumeration. @code{case} labels outside the enumeration range also
4126 provoke warnings when this option is used. The only difference
4127 between @option{-Wswitch} and this option is that this option gives a
4128 warning about an omitted enumeration code even if there is a
4129 @code{default} label.
4130
4131 @item -Wswitch-bool
4132 @opindex Wswitch-bool
4133 @opindex Wno-switch-bool
4134 Warn whenever a @code{switch} statement has an index of boolean type
4135 and the case values are outside the range of a boolean type.
4136 It is possible to suppress this warning by casting the controlling
4137 expression to a type other than @code{bool}. For example:
4138 @smallexample
4139 @group
4140 switch ((int) (a == 4))
4141 @{
4142 @dots{}
4143 @}
4144 @end group
4145 @end smallexample
4146 This warning is enabled by default for C and C++ programs.
4147
4148 @item -Wswitch-unreachable
4149 @opindex Wswitch-unreachable
4150 @opindex Wno-switch-unreachable
4151 Warn whenever a @code{switch} statement contains statements between the
4152 controlling expression and the first case label, which will never be
4153 executed. For example:
4154 @smallexample
4155 @group
4156 switch (cond)
4157 @{
4158 i = 15;
4159 @dots{}
4160 case 5:
4161 @dots{}
4162 @}
4163 @end group
4164 @end smallexample
4165 @option{-Wswitch-unreachable} does not warn if the statement between the
4166 controlling expression and the first case label is just a declaration:
4167 @smallexample
4168 @group
4169 switch (cond)
4170 @{
4171 int i;
4172 @dots{}
4173 case 5:
4174 i = 5;
4175 @dots{}
4176 @}
4177 @end group
4178 @end smallexample
4179 This warning is enabled by default for C and C++ programs.
4180
4181 @item -Wsync-nand @r{(C and C++ only)}
4182 @opindex Wsync-nand
4183 @opindex Wno-sync-nand
4184 Warn when @code{__sync_fetch_and_nand} and @code{__sync_nand_and_fetch}
4185 built-in functions are used. These functions changed semantics in GCC 4.4.
4186
4187 @item -Wtrigraphs
4188 @opindex Wtrigraphs
4189 @opindex Wno-trigraphs
4190 Warn if any trigraphs are encountered that might change the meaning of
4191 the program (trigraphs within comments are not warned about).
4192 This warning is enabled by @option{-Wall}.
4193
4194 @item -Wunused-but-set-parameter
4195 @opindex Wunused-but-set-parameter
4196 @opindex Wno-unused-but-set-parameter
4197 Warn whenever a function parameter is assigned to, but otherwise unused
4198 (aside from its declaration).
4199
4200 To suppress this warning use the @code{unused} attribute
4201 (@pxref{Variable Attributes}).
4202
4203 This warning is also enabled by @option{-Wunused} together with
4204 @option{-Wextra}.
4205
4206 @item -Wunused-but-set-variable
4207 @opindex Wunused-but-set-variable
4208 @opindex Wno-unused-but-set-variable
4209 Warn whenever a local variable is assigned to, but otherwise unused
4210 (aside from its declaration).
4211 This warning is enabled by @option{-Wall}.
4212
4213 To suppress this warning use the @code{unused} attribute
4214 (@pxref{Variable Attributes}).
4215
4216 This warning is also enabled by @option{-Wunused}, which is enabled
4217 by @option{-Wall}.
4218
4219 @item -Wunused-function
4220 @opindex Wunused-function
4221 @opindex Wno-unused-function
4222 Warn whenever a static function is declared but not defined or a
4223 non-inline static function is unused.
4224 This warning is enabled by @option{-Wall}.
4225
4226 @item -Wunused-label
4227 @opindex Wunused-label
4228 @opindex Wno-unused-label
4229 Warn whenever a label is declared but not used.
4230 This warning is enabled by @option{-Wall}.
4231
4232 To suppress this warning use the @code{unused} attribute
4233 (@pxref{Variable Attributes}).
4234
4235 @item -Wunused-local-typedefs @r{(C, Objective-C, C++ and Objective-C++ only)}
4236 @opindex Wunused-local-typedefs
4237 Warn when a typedef locally defined in a function is not used.
4238 This warning is enabled by @option{-Wall}.
4239
4240 @item -Wunused-parameter
4241 @opindex Wunused-parameter
4242 @opindex Wno-unused-parameter
4243 Warn whenever a function parameter is unused aside from its declaration.
4244
4245 To suppress this warning use the @code{unused} attribute
4246 (@pxref{Variable Attributes}).
4247
4248 @item -Wno-unused-result
4249 @opindex Wunused-result
4250 @opindex Wno-unused-result
4251 Do not warn if a caller of a function marked with attribute
4252 @code{warn_unused_result} (@pxref{Function Attributes}) does not use
4253 its return value. The default is @option{-Wunused-result}.
4254
4255 @item -Wunused-variable
4256 @opindex Wunused-variable
4257 @opindex Wno-unused-variable
4258 Warn whenever a local or static variable is unused aside from its
4259 declaration. This option implies @option{-Wunused-const-variable=1} for C,
4260 but not for C++. This warning is enabled by @option{-Wall}.
4261
4262 To suppress this warning use the @code{unused} attribute
4263 (@pxref{Variable Attributes}).
4264
4265 @item -Wunused-const-variable
4266 @itemx -Wunused-const-variable=@var{n}
4267 @opindex Wunused-const-variable
4268 @opindex Wno-unused-const-variable
4269 Warn whenever a constant static variable is unused aside from its declaration.
4270 @option{-Wunused-const-variable=1} is enabled by @option{-Wunused-variable}
4271 for C, but not for C++. In C this declares variable storage, but in C++ this
4272 is not an error since const variables take the place of @code{#define}s.
4273
4274 To suppress this warning use the @code{unused} attribute
4275 (@pxref{Variable Attributes}).
4276
4277 @table @gcctabopt
4278 @item -Wunused-const-variable=1
4279 This is the warning level that is enabled by @option{-Wunused-variable} for
4280 C. It warns only about unused static const variables defined in the main
4281 compilation unit, but not about static const variables declared in any
4282 header included.
4283
4284 @item -Wunused-const-variable=2
4285 This warning level also warns for unused constant static variables in
4286 headers (excluding system headers). This is the warning level of
4287 @option{-Wunused-const-variable} and must be explicitly requested since
4288 in C++ this isn't an error and in C it might be harder to clean up all
4289 headers included.
4290 @end table
4291
4292 @item -Wunused-value
4293 @opindex Wunused-value
4294 @opindex Wno-unused-value
4295 Warn whenever a statement computes a result that is explicitly not
4296 used. To suppress this warning cast the unused expression to
4297 @code{void}. This includes an expression-statement or the left-hand
4298 side of a comma expression that contains no side effects. For example,
4299 an expression such as @code{x[i,j]} causes a warning, while
4300 @code{x[(void)i,j]} does not.
4301
4302 This warning is enabled by @option{-Wall}.
4303
4304 @item -Wunused
4305 @opindex Wunused
4306 @opindex Wno-unused
4307 All the above @option{-Wunused} options combined.
4308
4309 In order to get a warning about an unused function parameter, you must
4310 either specify @option{-Wextra -Wunused} (note that @option{-Wall} implies
4311 @option{-Wunused}), or separately specify @option{-Wunused-parameter}.
4312
4313 @item -Wuninitialized
4314 @opindex Wuninitialized
4315 @opindex Wno-uninitialized
4316 Warn if an automatic variable is used without first being initialized
4317 or if a variable may be clobbered by a @code{setjmp} call. In C++,
4318 warn if a non-static reference or non-static @code{const} member
4319 appears in a class without constructors.
4320
4321 If you want to warn about code that uses the uninitialized value of the
4322 variable in its own initializer, use the @option{-Winit-self} option.
4323
4324 These warnings occur for individual uninitialized or clobbered
4325 elements of structure, union or array variables as well as for
4326 variables that are uninitialized or clobbered as a whole. They do
4327 not occur for variables or elements declared @code{volatile}. Because
4328 these warnings depend on optimization, the exact variables or elements
4329 for which there are warnings depends on the precise optimization
4330 options and version of GCC used.
4331
4332 Note that there may be no warning about a variable that is used only
4333 to compute a value that itself is never used, because such
4334 computations may be deleted by data flow analysis before the warnings
4335 are printed.
4336
4337 @item -Winvalid-memory-model
4338 @opindex Winvalid-memory-model
4339 @opindex Wno-invalid-memory-model
4340 Warn for invocations of @ref{__atomic Builtins}, @ref{__sync Builtins},
4341 and the C11 atomic generic functions with a memory consistency argument
4342 that is either invalid for the operation or outside the range of values
4343 of the @code{memory_order} enumeration. For example, since the
4344 @code{__atomic_store} and @code{__atomic_store_n} built-ins are only
4345 defined for the relaxed, release, and sequentially consistent memory
4346 orders the following code is diagnosed:
4347
4348 @smallexample
4349 void store (int *i)
4350 @{
4351 __atomic_store_n (i, 0, memory_order_consume);
4352 @}
4353 @end smallexample
4354
4355 @option{-Winvalid-memory-model} is enabled by default.
4356
4357 @item -Wmaybe-uninitialized
4358 @opindex Wmaybe-uninitialized
4359 @opindex Wno-maybe-uninitialized
4360 For an automatic variable, if there exists a path from the function
4361 entry to a use of the variable that is initialized, but there exist
4362 some other paths for which the variable is not initialized, the compiler
4363 emits a warning if it cannot prove the uninitialized paths are not
4364 executed at run time. These warnings are made optional because GCC is
4365 not smart enough to see all the reasons why the code might be correct
4366 in spite of appearing to have an error. Here is one example of how
4367 this can happen:
4368
4369 @smallexample
4370 @group
4371 @{
4372 int x;
4373 switch (y)
4374 @{
4375 case 1: x = 1;
4376 break;
4377 case 2: x = 4;
4378 break;
4379 case 3: x = 5;
4380 @}
4381 foo (x);
4382 @}
4383 @end group
4384 @end smallexample
4385
4386 @noindent
4387 If the value of @code{y} is always 1, 2 or 3, then @code{x} is
4388 always initialized, but GCC doesn't know this. To suppress the
4389 warning, you need to provide a default case with assert(0) or
4390 similar code.
4391
4392 @cindex @code{longjmp} warnings
4393 This option also warns when a non-volatile automatic variable might be
4394 changed by a call to @code{longjmp}. These warnings as well are possible
4395 only in optimizing compilation.
4396
4397 The compiler sees only the calls to @code{setjmp}. It cannot know
4398 where @code{longjmp} will be called; in fact, a signal handler could
4399 call it at any point in the code. As a result, you may get a warning
4400 even when there is in fact no problem because @code{longjmp} cannot
4401 in fact be called at the place that would cause a problem.
4402
4403 Some spurious warnings can be avoided if you declare all the functions
4404 you use that never return as @code{noreturn}. @xref{Function
4405 Attributes}.
4406
4407 This warning is enabled by @option{-Wall} or @option{-Wextra}.
4408
4409 @item -Wunknown-pragmas
4410 @opindex Wunknown-pragmas
4411 @opindex Wno-unknown-pragmas
4412 @cindex warning for unknown pragmas
4413 @cindex unknown pragmas, warning
4414 @cindex pragmas, warning of unknown
4415 Warn when a @code{#pragma} directive is encountered that is not understood by
4416 GCC@. If this command-line option is used, warnings are even issued
4417 for unknown pragmas in system header files. This is not the case if
4418 the warnings are only enabled by the @option{-Wall} command-line option.
4419
4420 @item -Wno-pragmas
4421 @opindex Wno-pragmas
4422 @opindex Wpragmas
4423 Do not warn about misuses of pragmas, such as incorrect parameters,
4424 invalid syntax, or conflicts between pragmas. See also
4425 @option{-Wunknown-pragmas}.
4426
4427 @item -Wstrict-aliasing
4428 @opindex Wstrict-aliasing
4429 @opindex Wno-strict-aliasing
4430 This option is only active when @option{-fstrict-aliasing} is active.
4431 It warns about code that might break the strict aliasing rules that the
4432 compiler is using for optimization. The warning does not catch all
4433 cases, but does attempt to catch the more common pitfalls. It is
4434 included in @option{-Wall}.
4435 It is equivalent to @option{-Wstrict-aliasing=3}
4436
4437 @item -Wstrict-aliasing=n
4438 @opindex Wstrict-aliasing=n
4439 This option is only active when @option{-fstrict-aliasing} is active.
4440 It warns about code that might break the strict aliasing rules that the
4441 compiler is using for optimization.
4442 Higher levels correspond to higher accuracy (fewer false positives).
4443 Higher levels also correspond to more effort, similar to the way @option{-O}
4444 works.
4445 @option{-Wstrict-aliasing} is equivalent to @option{-Wstrict-aliasing=3}.
4446
4447 Level 1: Most aggressive, quick, least accurate.
4448 Possibly useful when higher levels
4449 do not warn but @option{-fstrict-aliasing} still breaks the code, as it has very few
4450 false negatives. However, it has many false positives.
4451 Warns for all pointer conversions between possibly incompatible types,
4452 even if never dereferenced. Runs in the front end only.
4453
4454 Level 2: Aggressive, quick, not too precise.
4455 May still have many false positives (not as many as level 1 though),
4456 and few false negatives (but possibly more than level 1).
4457 Unlike level 1, it only warns when an address is taken. Warns about
4458 incomplete types. Runs in the front end only.
4459
4460 Level 3 (default for @option{-Wstrict-aliasing}):
4461 Should have very few false positives and few false
4462 negatives. Slightly slower than levels 1 or 2 when optimization is enabled.
4463 Takes care of the common pun+dereference pattern in the front end:
4464 @code{*(int*)&some_float}.
4465 If optimization is enabled, it also runs in the back end, where it deals
4466 with multiple statement cases using flow-sensitive points-to information.
4467 Only warns when the converted pointer is dereferenced.
4468 Does not warn about incomplete types.
4469
4470 @item -Wstrict-overflow
4471 @itemx -Wstrict-overflow=@var{n}
4472 @opindex Wstrict-overflow
4473 @opindex Wno-strict-overflow
4474 This option is only active when @option{-fstrict-overflow} is active.
4475 It warns about cases where the compiler optimizes based on the
4476 assumption that signed overflow does not occur. Note that it does not
4477 warn about all cases where the code might overflow: it only warns
4478 about cases where the compiler implements some optimization. Thus
4479 this warning depends on the optimization level.
4480
4481 An optimization that assumes that signed overflow does not occur is
4482 perfectly safe if the values of the variables involved are such that
4483 overflow never does, in fact, occur. Therefore this warning can
4484 easily give a false positive: a warning about code that is not
4485 actually a problem. To help focus on important issues, several
4486 warning levels are defined. No warnings are issued for the use of
4487 undefined signed overflow when estimating how many iterations a loop
4488 requires, in particular when determining whether a loop will be
4489 executed at all.
4490
4491 @table @gcctabopt
4492 @item -Wstrict-overflow=1
4493 Warn about cases that are both questionable and easy to avoid. For
4494 example, with @option{-fstrict-overflow}, the compiler simplifies
4495 @code{x + 1 > x} to @code{1}. This level of
4496 @option{-Wstrict-overflow} is enabled by @option{-Wall}; higher levels
4497 are not, and must be explicitly requested.
4498
4499 @item -Wstrict-overflow=2
4500 Also warn about other cases where a comparison is simplified to a
4501 constant. For example: @code{abs (x) >= 0}. This can only be
4502 simplified when @option{-fstrict-overflow} is in effect, because
4503 @code{abs (INT_MIN)} overflows to @code{INT_MIN}, which is less than
4504 zero. @option{-Wstrict-overflow} (with no level) is the same as
4505 @option{-Wstrict-overflow=2}.
4506
4507 @item -Wstrict-overflow=3
4508 Also warn about other cases where a comparison is simplified. For
4509 example: @code{x + 1 > 1} is simplified to @code{x > 0}.
4510
4511 @item -Wstrict-overflow=4
4512 Also warn about other simplifications not covered by the above cases.
4513 For example: @code{(x * 10) / 5} is simplified to @code{x * 2}.
4514
4515 @item -Wstrict-overflow=5
4516 Also warn about cases where the compiler reduces the magnitude of a
4517 constant involved in a comparison. For example: @code{x + 2 > y} is
4518 simplified to @code{x + 1 >= y}. This is reported only at the
4519 highest warning level because this simplification applies to many
4520 comparisons, so this warning level gives a very large number of
4521 false positives.
4522 @end table
4523
4524 @item -Wsuggest-attribute=@r{[}pure@r{|}const@r{|}noreturn@r{|}format@r{]}
4525 @opindex Wsuggest-attribute=
4526 @opindex Wno-suggest-attribute=
4527 Warn for cases where adding an attribute may be beneficial. The
4528 attributes currently supported are listed below.
4529
4530 @table @gcctabopt
4531 @item -Wsuggest-attribute=pure
4532 @itemx -Wsuggest-attribute=const
4533 @itemx -Wsuggest-attribute=noreturn
4534 @opindex Wsuggest-attribute=pure
4535 @opindex Wno-suggest-attribute=pure
4536 @opindex Wsuggest-attribute=const
4537 @opindex Wno-suggest-attribute=const
4538 @opindex Wsuggest-attribute=noreturn
4539 @opindex Wno-suggest-attribute=noreturn
4540
4541 Warn about functions that might be candidates for attributes
4542 @code{pure}, @code{const} or @code{noreturn}. The compiler only warns for
4543 functions visible in other compilation units or (in the case of @code{pure} and
4544 @code{const}) if it cannot prove that the function returns normally. A function
4545 returns normally if it doesn't contain an infinite loop or return abnormally
4546 by throwing, calling @code{abort} or trapping. This analysis requires option
4547 @option{-fipa-pure-const}, which is enabled by default at @option{-O} and
4548 higher. Higher optimization levels improve the accuracy of the analysis.
4549
4550 @item -Wsuggest-attribute=format
4551 @itemx -Wmissing-format-attribute
4552 @opindex Wsuggest-attribute=format
4553 @opindex Wmissing-format-attribute
4554 @opindex Wno-suggest-attribute=format
4555 @opindex Wno-missing-format-attribute
4556 @opindex Wformat
4557 @opindex Wno-format
4558
4559 Warn about function pointers that might be candidates for @code{format}
4560 attributes. Note these are only possible candidates, not absolute ones.
4561 GCC guesses that function pointers with @code{format} attributes that
4562 are used in assignment, initialization, parameter passing or return
4563 statements should have a corresponding @code{format} attribute in the
4564 resulting type. I.e.@: the left-hand side of the assignment or
4565 initialization, the type of the parameter variable, or the return type
4566 of the containing function respectively should also have a @code{format}
4567 attribute to avoid the warning.
4568
4569 GCC also warns about function definitions that might be
4570 candidates for @code{format} attributes. Again, these are only
4571 possible candidates. GCC guesses that @code{format} attributes
4572 might be appropriate for any function that calls a function like
4573 @code{vprintf} or @code{vscanf}, but this might not always be the
4574 case, and some functions for which @code{format} attributes are
4575 appropriate may not be detected.
4576 @end table
4577
4578 @item -Wsuggest-final-types
4579 @opindex Wno-suggest-final-types
4580 @opindex Wsuggest-final-types
4581 Warn about types with virtual methods where code quality would be improved
4582 if the type were declared with the C++11 @code{final} specifier,
4583 or, if possible,
4584 declared in an anonymous namespace. This allows GCC to more aggressively
4585 devirtualize the polymorphic calls. This warning is more effective with link
4586 time optimization, where the information about the class hierarchy graph is
4587 more complete.
4588
4589 @item -Wsuggest-final-methods
4590 @opindex Wno-suggest-final-methods
4591 @opindex Wsuggest-final-methods
4592 Warn about virtual methods where code quality would be improved if the method
4593 were declared with the C++11 @code{final} specifier,
4594 or, if possible, its type were
4595 declared in an anonymous namespace or with the @code{final} specifier.
4596 This warning is
4597 more effective with link time optimization, where the information about the
4598 class hierarchy graph is more complete. It is recommended to first consider
4599 suggestions of @option{-Wsuggest-final-types} and then rebuild with new
4600 annotations.
4601
4602 @item -Wsuggest-override
4603 Warn about overriding virtual functions that are not marked with the override
4604 keyword.
4605
4606 @item -Warray-bounds
4607 @itemx -Warray-bounds=@var{n}
4608 @opindex Wno-array-bounds
4609 @opindex Warray-bounds
4610 This option is only active when @option{-ftree-vrp} is active
4611 (default for @option{-O2} and above). It warns about subscripts to arrays
4612 that are always out of bounds. This warning is enabled by @option{-Wall}.
4613
4614 @table @gcctabopt
4615 @item -Warray-bounds=1
4616 This is the warning level of @option{-Warray-bounds} and is enabled
4617 by @option{-Wall}; higher levels are not, and must be explicitly requested.
4618
4619 @item -Warray-bounds=2
4620 This warning level also warns about out of bounds access for
4621 arrays at the end of a struct and for arrays accessed through
4622 pointers. This warning level may give a larger number of
4623 false positives and is deactivated by default.
4624 @end table
4625
4626 @item -Wbool-compare
4627 @opindex Wno-bool-compare
4628 @opindex Wbool-compare
4629 Warn about boolean expression compared with an integer value different from
4630 @code{true}/@code{false}. For instance, the following comparison is
4631 always false:
4632 @smallexample
4633 int n = 5;
4634 @dots{}
4635 if ((n > 1) == 2) @{ @dots{} @}
4636 @end smallexample
4637 This warning is enabled by @option{-Wall}.
4638
4639 @item -Wduplicated-cond
4640 @opindex Wno-duplicated-cond
4641 @opindex Wduplicated-cond
4642 Warn about duplicated conditions in an if-else-if chain. For instance,
4643 warn for the following code:
4644 @smallexample
4645 if (p->q != NULL) @{ @dots{} @}
4646 else if (p->q != NULL) @{ @dots{} @}
4647 @end smallexample
4648
4649 @item -Wframe-address
4650 @opindex Wno-frame-address
4651 @opindex Wframe-address
4652 Warn when the @samp{__builtin_frame_address} or @samp{__builtin_return_address}
4653 is called with an argument greater than 0. Such calls may return indeterminate
4654 values or crash the program. The warning is included in @option{-Wall}.
4655
4656 @item -Wno-discarded-qualifiers @r{(C and Objective-C only)}
4657 @opindex Wno-discarded-qualifiers
4658 @opindex Wdiscarded-qualifiers
4659 Do not warn if type qualifiers on pointers are being discarded.
4660 Typically, the compiler warns if a @code{const char *} variable is
4661 passed to a function that takes a @code{char *} parameter. This option
4662 can be used to suppress such a warning.
4663
4664 @item -Wno-discarded-array-qualifiers @r{(C and Objective-C only)}
4665 @opindex Wno-discarded-array-qualifiers
4666 @opindex Wdiscarded-array-qualifiers
4667 Do not warn if type qualifiers on arrays which are pointer targets
4668 are being discarded. Typically, the compiler warns if a
4669 @code{const int (*)[]} variable is passed to a function that
4670 takes a @code{int (*)[]} parameter. This option can be used to
4671 suppress such a warning.
4672
4673 @item -Wno-incompatible-pointer-types @r{(C and Objective-C only)}
4674 @opindex Wno-incompatible-pointer-types
4675 @opindex Wincompatible-pointer-types
4676 Do not warn when there is a conversion between pointers that have incompatible
4677 types. This warning is for cases not covered by @option{-Wno-pointer-sign},
4678 which warns for pointer argument passing or assignment with different
4679 signedness.
4680
4681 @item -Wno-int-conversion @r{(C and Objective-C only)}
4682 @opindex Wno-int-conversion
4683 @opindex Wint-conversion
4684 Do not warn about incompatible integer to pointer and pointer to integer
4685 conversions. This warning is about implicit conversions; for explicit
4686 conversions the warnings @option{-Wno-int-to-pointer-cast} and
4687 @option{-Wno-pointer-to-int-cast} may be used.
4688
4689 @item -Wno-div-by-zero
4690 @opindex Wno-div-by-zero
4691 @opindex Wdiv-by-zero
4692 Do not warn about compile-time integer division by zero. Floating-point
4693 division by zero is not warned about, as it can be a legitimate way of
4694 obtaining infinities and NaNs.
4695
4696 @item -Wsystem-headers
4697 @opindex Wsystem-headers
4698 @opindex Wno-system-headers
4699 @cindex warnings from system headers
4700 @cindex system headers, warnings from
4701 Print warning messages for constructs found in system header files.
4702 Warnings from system headers are normally suppressed, on the assumption
4703 that they usually do not indicate real problems and would only make the
4704 compiler output harder to read. Using this command-line option tells
4705 GCC to emit warnings from system headers as if they occurred in user
4706 code. However, note that using @option{-Wall} in conjunction with this
4707 option does @emph{not} warn about unknown pragmas in system
4708 headers---for that, @option{-Wunknown-pragmas} must also be used.
4709
4710 @item -Wtautological-compare
4711 @opindex Wtautological-compare
4712 @opindex Wno-tautological-compare
4713 Warn if a self-comparison always evaluates to true or false. This
4714 warning detects various mistakes such as:
4715 @smallexample
4716 int i = 1;
4717 @dots{}
4718 if (i > i) @{ @dots{} @}
4719 @end smallexample
4720 This warning is enabled by @option{-Wall}.
4721
4722 @item -Wtrampolines
4723 @opindex Wtrampolines
4724 @opindex Wno-trampolines
4725 Warn about trampolines generated for pointers to nested functions.
4726 A trampoline is a small piece of data or code that is created at run
4727 time on the stack when the address of a nested function is taken, and is
4728 used to call the nested function indirectly. For some targets, it is
4729 made up of data only and thus requires no special treatment. But, for
4730 most targets, it is made up of code and thus requires the stack to be
4731 made executable in order for the program to work properly.
4732
4733 @item -Wfloat-equal
4734 @opindex Wfloat-equal
4735 @opindex Wno-float-equal
4736 Warn if floating-point values are used in equality comparisons.
4737
4738 The idea behind this is that sometimes it is convenient (for the
4739 programmer) to consider floating-point values as approximations to
4740 infinitely precise real numbers. If you are doing this, then you need
4741 to compute (by analyzing the code, or in some other way) the maximum or
4742 likely maximum error that the computation introduces, and allow for it
4743 when performing comparisons (and when producing output, but that's a
4744 different problem). In particular, instead of testing for equality, you
4745 should check to see whether the two values have ranges that overlap; and
4746 this is done with the relational operators, so equality comparisons are
4747 probably mistaken.
4748
4749 @item -Wtraditional @r{(C and Objective-C only)}
4750 @opindex Wtraditional
4751 @opindex Wno-traditional
4752 Warn about certain constructs that behave differently in traditional and
4753 ISO C@. Also warn about ISO C constructs that have no traditional C
4754 equivalent, and/or problematic constructs that should be avoided.
4755
4756 @itemize @bullet
4757 @item
4758 Macro parameters that appear within string literals in the macro body.
4759 In traditional C macro replacement takes place within string literals,
4760 but in ISO C it does not.
4761
4762 @item
4763 In traditional C, some preprocessor directives did not exist.
4764 Traditional preprocessors only considered a line to be a directive
4765 if the @samp{#} appeared in column 1 on the line. Therefore
4766 @option{-Wtraditional} warns about directives that traditional C
4767 understands but ignores because the @samp{#} does not appear as the
4768 first character on the line. It also suggests you hide directives like
4769 @code{#pragma} not understood by traditional C by indenting them. Some
4770 traditional implementations do not recognize @code{#elif}, so this option
4771 suggests avoiding it altogether.
4772
4773 @item
4774 A function-like macro that appears without arguments.
4775
4776 @item
4777 The unary plus operator.
4778
4779 @item
4780 The @samp{U} integer constant suffix, or the @samp{F} or @samp{L} floating-point
4781 constant suffixes. (Traditional C does support the @samp{L} suffix on integer
4782 constants.) Note, these suffixes appear in macros defined in the system
4783 headers of most modern systems, e.g.@: the @samp{_MIN}/@samp{_MAX} macros in @code{<limits.h>}.
4784 Use of these macros in user code might normally lead to spurious
4785 warnings, however GCC's integrated preprocessor has enough context to
4786 avoid warning in these cases.
4787
4788 @item
4789 A function declared external in one block and then used after the end of
4790 the block.
4791
4792 @item
4793 A @code{switch} statement has an operand of type @code{long}.
4794
4795 @item
4796 A non-@code{static} function declaration follows a @code{static} one.
4797 This construct is not accepted by some traditional C compilers.
4798
4799 @item
4800 The ISO type of an integer constant has a different width or
4801 signedness from its traditional type. This warning is only issued if
4802 the base of the constant is ten. I.e.@: hexadecimal or octal values, which
4803 typically represent bit patterns, are not warned about.
4804
4805 @item
4806 Usage of ISO string concatenation is detected.
4807
4808 @item
4809 Initialization of automatic aggregates.
4810
4811 @item
4812 Identifier conflicts with labels. Traditional C lacks a separate
4813 namespace for labels.
4814
4815 @item
4816 Initialization of unions. If the initializer is zero, the warning is
4817 omitted. This is done under the assumption that the zero initializer in
4818 user code appears conditioned on e.g.@: @code{__STDC__} to avoid missing
4819 initializer warnings and relies on default initialization to zero in the
4820 traditional C case.
4821
4822 @item
4823 Conversions by prototypes between fixed/floating-point values and vice
4824 versa. The absence of these prototypes when compiling with traditional
4825 C causes serious problems. This is a subset of the possible
4826 conversion warnings; for the full set use @option{-Wtraditional-conversion}.
4827
4828 @item
4829 Use of ISO C style function definitions. This warning intentionally is
4830 @emph{not} issued for prototype declarations or variadic functions
4831 because these ISO C features appear in your code when using
4832 libiberty's traditional C compatibility macros, @code{PARAMS} and
4833 @code{VPARAMS}. This warning is also bypassed for nested functions
4834 because that feature is already a GCC extension and thus not relevant to
4835 traditional C compatibility.
4836 @end itemize
4837
4838 @item -Wtraditional-conversion @r{(C and Objective-C only)}
4839 @opindex Wtraditional-conversion
4840 @opindex Wno-traditional-conversion
4841 Warn if a prototype causes a type conversion that is different from what
4842 would happen to the same argument in the absence of a prototype. This
4843 includes conversions of fixed point to floating and vice versa, and
4844 conversions changing the width or signedness of a fixed-point argument
4845 except when the same as the default promotion.
4846
4847 @item -Wdeclaration-after-statement @r{(C and Objective-C only)}
4848 @opindex Wdeclaration-after-statement
4849 @opindex Wno-declaration-after-statement
4850 Warn when a declaration is found after a statement in a block. This
4851 construct, known from C++, was introduced with ISO C99 and is by default
4852 allowed in GCC@. It is not supported by ISO C90. @xref{Mixed Declarations}.
4853
4854 @item -Wundef
4855 @opindex Wundef
4856 @opindex Wno-undef
4857 Warn if an undefined identifier is evaluated in an @code{#if} directive.
4858
4859 @item -Wno-endif-labels
4860 @opindex Wno-endif-labels
4861 @opindex Wendif-labels
4862 Do not warn whenever an @code{#else} or an @code{#endif} are followed by text.
4863
4864 @item -Wshadow
4865 @opindex Wshadow
4866 @opindex Wno-shadow
4867 Warn whenever a local variable or type declaration shadows another
4868 variable, parameter, type, class member (in C++), or instance variable
4869 (in Objective-C) or whenever a built-in function is shadowed. Note
4870 that in C++, the compiler warns if a local variable shadows an
4871 explicit typedef, but not if it shadows a struct/class/enum.
4872
4873 @item -Wno-shadow-ivar @r{(Objective-C only)}
4874 @opindex Wno-shadow-ivar
4875 @opindex Wshadow-ivar
4876 Do not warn whenever a local variable shadows an instance variable in an
4877 Objective-C method.
4878
4879 @item -Wlarger-than=@var{len}
4880 @opindex Wlarger-than=@var{len}
4881 @opindex Wlarger-than-@var{len}
4882 Warn whenever an object of larger than @var{len} bytes is defined.
4883
4884 @item -Wframe-larger-than=@var{len}
4885 @opindex Wframe-larger-than
4886 Warn if the size of a function frame is larger than @var{len} bytes.
4887 The computation done to determine the stack frame size is approximate
4888 and not conservative.
4889 The actual requirements may be somewhat greater than @var{len}
4890 even if you do not get a warning. In addition, any space allocated
4891 via @code{alloca}, variable-length arrays, or related constructs
4892 is not included by the compiler when determining
4893 whether or not to issue a warning.
4894
4895 @item -Wno-free-nonheap-object
4896 @opindex Wno-free-nonheap-object
4897 @opindex Wfree-nonheap-object
4898 Do not warn when attempting to free an object that was not allocated
4899 on the heap.
4900
4901 @item -Wstack-usage=@var{len}
4902 @opindex Wstack-usage
4903 Warn if the stack usage of a function might be larger than @var{len} bytes.
4904 The computation done to determine the stack usage is conservative.
4905 Any space allocated via @code{alloca}, variable-length arrays, or related
4906 constructs is included by the compiler when determining whether or not to
4907 issue a warning.
4908
4909 The message is in keeping with the output of @option{-fstack-usage}.
4910
4911 @itemize
4912 @item
4913 If the stack usage is fully static but exceeds the specified amount, it's:
4914
4915 @smallexample
4916 warning: stack usage is 1120 bytes
4917 @end smallexample
4918 @item
4919 If the stack usage is (partly) dynamic but bounded, it's:
4920
4921 @smallexample
4922 warning: stack usage might be 1648 bytes
4923 @end smallexample
4924 @item
4925 If the stack usage is (partly) dynamic and not bounded, it's:
4926
4927 @smallexample
4928 warning: stack usage might be unbounded
4929 @end smallexample
4930 @end itemize
4931
4932 @item -Wunsafe-loop-optimizations
4933 @opindex Wunsafe-loop-optimizations
4934 @opindex Wno-unsafe-loop-optimizations
4935 Warn if the loop cannot be optimized because the compiler cannot
4936 assume anything on the bounds of the loop indices. With
4937 @option{-funsafe-loop-optimizations} warn if the compiler makes
4938 such assumptions.
4939
4940 @item -Wno-pedantic-ms-format @r{(MinGW targets only)}
4941 @opindex Wno-pedantic-ms-format
4942 @opindex Wpedantic-ms-format
4943 When used in combination with @option{-Wformat}
4944 and @option{-pedantic} without GNU extensions, this option
4945 disables the warnings about non-ISO @code{printf} / @code{scanf} format
4946 width specifiers @code{I32}, @code{I64}, and @code{I} used on Windows targets,
4947 which depend on the MS runtime.
4948
4949 @item -Wplacement-new
4950 @itemx -Wplacement-new=@var{n}
4951 @opindex Wplacement-new
4952 @opindex Wno-placement-new
4953 Warn about placement new expressions with undefined behavior, such as
4954 constructing an object in a buffer that is smaller than the type of
4955 the object. For example, the placement new expression below is diagnosed
4956 because it attempts to construct an array of 64 integers in a buffer only
4957 64 bytes large.
4958 @smallexample
4959 char buf [64];
4960 new (buf) int[64];
4961 @end smallexample
4962 This warning is enabled by default.
4963
4964 @table @gcctabopt
4965 @item -Wplacement-new=1
4966 This is the default warning level of @option{-Wplacement-new}. At this
4967 level the warning is not issued for some strictly undefined constructs that
4968 GCC allows as extensions for compatibility with legacy code. For example,
4969 the following @code{new} expression is not diagnosed at this level even
4970 though it has undefined behavior according to the C++ standard because
4971 it writes past the end of the one-element array.
4972 @smallexample
4973 struct S @{ int n, a[1]; @};
4974 S *s = (S *)malloc (sizeof *s + 31 * sizeof s->a[0]);
4975 new (s->a)int [32]();
4976 @end smallexample
4977
4978 @item -Wplacement-new=2
4979 At this level, in addition to diagnosing all the same constructs as at level
4980 1, a diagnostic is also issued for placement new expressions that construct
4981 an object in the last member of structure whose type is an array of a single
4982 element and whose size is less than the size of the object being constructed.
4983 While the previous example would be diagnosed, the following construct makes
4984 use of the flexible member array extension to avoid the warning at level 2.
4985 @smallexample
4986 struct S @{ int n, a[]; @};
4987 S *s = (S *)malloc (sizeof *s + 32 * sizeof s->a[0]);
4988 new (s->a)int [32]();
4989 @end smallexample
4990
4991 @end table
4992
4993 @item -Wpointer-arith
4994 @opindex Wpointer-arith
4995 @opindex Wno-pointer-arith
4996 Warn about anything that depends on the ``size of'' a function type or
4997 of @code{void}. GNU C assigns these types a size of 1, for
4998 convenience in calculations with @code{void *} pointers and pointers
4999 to functions. In C++, warn also when an arithmetic operation involves
5000 @code{NULL}. This warning is also enabled by @option{-Wpedantic}.
5001
5002 @item -Wtype-limits
5003 @opindex Wtype-limits
5004 @opindex Wno-type-limits
5005 Warn if a comparison is always true or always false due to the limited
5006 range of the data type, but do not warn for constant expressions. For
5007 example, warn if an unsigned variable is compared against zero with
5008 @code{<} or @code{>=}. This warning is also enabled by
5009 @option{-Wextra}.
5010
5011 @item -Wbad-function-cast @r{(C and Objective-C only)}
5012 @opindex Wbad-function-cast
5013 @opindex Wno-bad-function-cast
5014 Warn when a function call is cast to a non-matching type.
5015 For example, warn if a call to a function returning an integer type
5016 is cast to a pointer type.
5017
5018 @item -Wc90-c99-compat @r{(C and Objective-C only)}
5019 @opindex Wc90-c99-compat
5020 @opindex Wno-c90-c99-compat
5021 Warn about features not present in ISO C90, but present in ISO C99.
5022 For instance, warn about use of variable length arrays, @code{long long}
5023 type, @code{bool} type, compound literals, designated initializers, and so
5024 on. This option is independent of the standards mode. Warnings are disabled
5025 in the expression that follows @code{__extension__}.
5026
5027 @item -Wc99-c11-compat @r{(C and Objective-C only)}
5028 @opindex Wc99-c11-compat
5029 @opindex Wno-c99-c11-compat
5030 Warn about features not present in ISO C99, but present in ISO C11.
5031 For instance, warn about use of anonymous structures and unions,
5032 @code{_Atomic} type qualifier, @code{_Thread_local} storage-class specifier,
5033 @code{_Alignas} specifier, @code{Alignof} operator, @code{_Generic} keyword,
5034 and so on. This option is independent of the standards mode. Warnings are
5035 disabled in the expression that follows @code{__extension__}.
5036
5037 @item -Wc++-compat @r{(C and Objective-C only)}
5038 @opindex Wc++-compat
5039 Warn about ISO C constructs that are outside of the common subset of
5040 ISO C and ISO C++, e.g.@: request for implicit conversion from
5041 @code{void *} to a pointer to non-@code{void} type.
5042
5043 @item -Wc++11-compat @r{(C++ and Objective-C++ only)}
5044 @opindex Wc++11-compat
5045 Warn about C++ constructs whose meaning differs between ISO C++ 1998
5046 and ISO C++ 2011, e.g., identifiers in ISO C++ 1998 that are keywords
5047 in ISO C++ 2011. This warning turns on @option{-Wnarrowing} and is
5048 enabled by @option{-Wall}.
5049
5050 @item -Wc++14-compat @r{(C++ and Objective-C++ only)}
5051 @opindex Wc++14-compat
5052 Warn about C++ constructs whose meaning differs between ISO C++ 2011
5053 and ISO C++ 2014. This warning is enabled by @option{-Wall}.
5054
5055 @item -Wcast-qual
5056 @opindex Wcast-qual
5057 @opindex Wno-cast-qual
5058 Warn whenever a pointer is cast so as to remove a type qualifier from
5059 the target type. For example, warn if a @code{const char *} is cast
5060 to an ordinary @code{char *}.
5061
5062 Also warn when making a cast that introduces a type qualifier in an
5063 unsafe way. For example, casting @code{char **} to @code{const char **}
5064 is unsafe, as in this example:
5065
5066 @smallexample
5067 /* p is char ** value. */
5068 const char **q = (const char **) p;
5069 /* Assignment of readonly string to const char * is OK. */
5070 *q = "string";
5071 /* Now char** pointer points to read-only memory. */
5072 **p = 'b';
5073 @end smallexample
5074
5075 @item -Wcast-align
5076 @opindex Wcast-align
5077 @opindex Wno-cast-align
5078 Warn whenever a pointer is cast such that the required alignment of the
5079 target is increased. For example, warn if a @code{char *} is cast to
5080 an @code{int *} on machines where integers can only be accessed at
5081 two- or four-byte boundaries.
5082
5083 @item -Wwrite-strings
5084 @opindex Wwrite-strings
5085 @opindex Wno-write-strings
5086 When compiling C, give string constants the type @code{const
5087 char[@var{length}]} so that copying the address of one into a
5088 non-@code{const} @code{char *} pointer produces a warning. These
5089 warnings help you find at compile time code that can try to write
5090 into a string constant, but only if you have been very careful about
5091 using @code{const} in declarations and prototypes. Otherwise, it is
5092 just a nuisance. This is why we did not make @option{-Wall} request
5093 these warnings.
5094
5095 When compiling C++, warn about the deprecated conversion from string
5096 literals to @code{char *}. This warning is enabled by default for C++
5097 programs.
5098
5099 @item -Wclobbered
5100 @opindex Wclobbered
5101 @opindex Wno-clobbered
5102 Warn for variables that might be changed by @code{longjmp} or
5103 @code{vfork}. This warning is also enabled by @option{-Wextra}.
5104
5105 @item -Wconditionally-supported @r{(C++ and Objective-C++ only)}
5106 @opindex Wconditionally-supported
5107 @opindex Wno-conditionally-supported
5108 Warn for conditionally-supported (C++11 [intro.defs]) constructs.
5109
5110 @item -Wconversion
5111 @opindex Wconversion
5112 @opindex Wno-conversion
5113 Warn for implicit conversions that may alter a value. This includes
5114 conversions between real and integer, like @code{abs (x)} when
5115 @code{x} is @code{double}; conversions between signed and unsigned,
5116 like @code{unsigned ui = -1}; and conversions to smaller types, like
5117 @code{sqrtf (M_PI)}. Do not warn for explicit casts like @code{abs
5118 ((int) x)} and @code{ui = (unsigned) -1}, or if the value is not
5119 changed by the conversion like in @code{abs (2.0)}. Warnings about
5120 conversions between signed and unsigned integers can be disabled by
5121 using @option{-Wno-sign-conversion}.
5122
5123 For C++, also warn for confusing overload resolution for user-defined
5124 conversions; and conversions that never use a type conversion
5125 operator: conversions to @code{void}, the same type, a base class or a
5126 reference to them. Warnings about conversions between signed and
5127 unsigned integers are disabled by default in C++ unless
5128 @option{-Wsign-conversion} is explicitly enabled.
5129
5130 @item -Wno-conversion-null @r{(C++ and Objective-C++ only)}
5131 @opindex Wconversion-null
5132 @opindex Wno-conversion-null
5133 Do not warn for conversions between @code{NULL} and non-pointer
5134 types. @option{-Wconversion-null} is enabled by default.
5135
5136 @item -Wzero-as-null-pointer-constant @r{(C++ and Objective-C++ only)}
5137 @opindex Wzero-as-null-pointer-constant
5138 @opindex Wno-zero-as-null-pointer-constant
5139 Warn when a literal @samp{0} is used as null pointer constant. This can
5140 be useful to facilitate the conversion to @code{nullptr} in C++11.
5141
5142 @item -Wsubobject-linkage @r{(C++ and Objective-C++ only)}
5143 @opindex Wsubobject-linkage
5144 @opindex Wno-subobject-linkage
5145 Warn if a class type has a base or a field whose type uses the anonymous
5146 namespace or depends on a type with no linkage. If a type A depends on
5147 a type B with no or internal linkage, defining it in multiple
5148 translation units would be an ODR violation because the meaning of B
5149 is different in each translation unit. If A only appears in a single
5150 translation unit, the best way to silence the warning is to give it
5151 internal linkage by putting it in an anonymous namespace as well. The
5152 compiler doesn't give this warning for types defined in the main .C
5153 file, as those are unlikely to have multiple definitions.
5154 @option{-Wsubobject-linkage} is enabled by default.
5155
5156 @item -Wdangling-else
5157 @opindex Wdangling-else
5158 @opindex Wno-dangling-else
5159 Warn about constructions where there may be confusion to which
5160 @code{if} statement an @code{else} branch belongs. Here is an example of
5161 such a case:
5162
5163 @smallexample
5164 @group
5165 @{
5166 if (a)
5167 if (b)
5168 foo ();
5169 else
5170 bar ();
5171 @}
5172 @end group
5173 @end smallexample
5174
5175 In C/C++, every @code{else} branch belongs to the innermost possible
5176 @code{if} statement, which in this example is @code{if (b)}. This is
5177 often not what the programmer expected, as illustrated in the above
5178 example by indentation the programmer chose. When there is the
5179 potential for this confusion, GCC issues a warning when this flag
5180 is specified. To eliminate the warning, add explicit braces around
5181 the innermost @code{if} statement so there is no way the @code{else}
5182 can belong to the enclosing @code{if}. The resulting code
5183 looks like this:
5184
5185 @smallexample
5186 @group
5187 @{
5188 if (a)
5189 @{
5190 if (b)
5191 foo ();
5192 else
5193 bar ();
5194 @}
5195 @}
5196 @end group
5197 @end smallexample
5198
5199 This warning is enabled by @option{-Wparentheses}.
5200
5201 @item -Wdate-time
5202 @opindex Wdate-time
5203 @opindex Wno-date-time
5204 Warn when macros @code{__TIME__}, @code{__DATE__} or @code{__TIMESTAMP__}
5205 are encountered as they might prevent bit-wise-identical reproducible
5206 compilations.
5207
5208 @item -Wdelete-incomplete @r{(C++ and Objective-C++ only)}
5209 @opindex Wdelete-incomplete
5210 @opindex Wno-delete-incomplete
5211 Warn when deleting a pointer to incomplete type, which may cause
5212 undefined behavior at runtime. This warning is enabled by default.
5213
5214 @item -Wuseless-cast @r{(C++ and Objective-C++ only)}
5215 @opindex Wuseless-cast
5216 @opindex Wno-useless-cast
5217 Warn when an expression is casted to its own type.
5218
5219 @item -Wempty-body
5220 @opindex Wempty-body
5221 @opindex Wno-empty-body
5222 Warn if an empty body occurs in an @code{if}, @code{else} or @code{do
5223 while} statement. This warning is also enabled by @option{-Wextra}.
5224
5225 @item -Wenum-compare
5226 @opindex Wenum-compare
5227 @opindex Wno-enum-compare
5228 Warn about a comparison between values of different enumerated types.
5229 In C++ enumeral mismatches in conditional expressions are also
5230 diagnosed and the warning is enabled by default. In C this warning is
5231 enabled by @option{-Wall}.
5232
5233 @item -Wjump-misses-init @r{(C, Objective-C only)}
5234 @opindex Wjump-misses-init
5235 @opindex Wno-jump-misses-init
5236 Warn if a @code{goto} statement or a @code{switch} statement jumps
5237 forward across the initialization of a variable, or jumps backward to a
5238 label after the variable has been initialized. This only warns about
5239 variables that are initialized when they are declared. This warning is
5240 only supported for C and Objective-C; in C++ this sort of branch is an
5241 error in any case.
5242
5243 @option{-Wjump-misses-init} is included in @option{-Wc++-compat}. It
5244 can be disabled with the @option{-Wno-jump-misses-init} option.
5245
5246 @item -Wsign-compare
5247 @opindex Wsign-compare
5248 @opindex Wno-sign-compare
5249 @cindex warning for comparison of signed and unsigned values
5250 @cindex comparison of signed and unsigned values, warning
5251 @cindex signed and unsigned values, comparison warning
5252 Warn when a comparison between signed and unsigned values could produce
5253 an incorrect result when the signed value is converted to unsigned.
5254 In C++, this warning is also enabled by @option{-Wall}. In C, it is
5255 also enabled by @option{-Wextra}.
5256
5257 @item -Wsign-conversion
5258 @opindex Wsign-conversion
5259 @opindex Wno-sign-conversion
5260 Warn for implicit conversions that may change the sign of an integer
5261 value, like assigning a signed integer expression to an unsigned
5262 integer variable. An explicit cast silences the warning. In C, this
5263 option is enabled also by @option{-Wconversion}.
5264
5265 @item -Wfloat-conversion
5266 @opindex Wfloat-conversion
5267 @opindex Wno-float-conversion
5268 Warn for implicit conversions that reduce the precision of a real value.
5269 This includes conversions from real to integer, and from higher precision
5270 real to lower precision real values. This option is also enabled by
5271 @option{-Wconversion}.
5272
5273 @item -Wno-scalar-storage-order
5274 @opindex -Wno-scalar-storage-order
5275 @opindex -Wscalar-storage-order
5276 Do not warn on suspicious constructs involving reverse scalar storage order.
5277
5278 @item -Wsized-deallocation @r{(C++ and Objective-C++ only)}
5279 @opindex Wsized-deallocation
5280 @opindex Wno-sized-deallocation
5281 Warn about a definition of an unsized deallocation function
5282 @smallexample
5283 void operator delete (void *) noexcept;
5284 void operator delete[] (void *) noexcept;
5285 @end smallexample
5286 without a definition of the corresponding sized deallocation function
5287 @smallexample
5288 void operator delete (void *, std::size_t) noexcept;
5289 void operator delete[] (void *, std::size_t) noexcept;
5290 @end smallexample
5291 or vice versa. Enabled by @option{-Wextra} along with
5292 @option{-fsized-deallocation}.
5293
5294 @item -Wsizeof-pointer-memaccess
5295 @opindex Wsizeof-pointer-memaccess
5296 @opindex Wno-sizeof-pointer-memaccess
5297 Warn for suspicious length parameters to certain string and memory built-in
5298 functions if the argument uses @code{sizeof}. This warning warns e.g.@:
5299 about @code{memset (ptr, 0, sizeof (ptr));} if @code{ptr} is not an array,
5300 but a pointer, and suggests a possible fix, or about
5301 @code{memcpy (&foo, ptr, sizeof (&foo));}. This warning is enabled by
5302 @option{-Wall}.
5303
5304 @item -Wsizeof-array-argument
5305 @opindex Wsizeof-array-argument
5306 @opindex Wno-sizeof-array-argument
5307 Warn when the @code{sizeof} operator is applied to a parameter that is
5308 declared as an array in a function definition. This warning is enabled by
5309 default for C and C++ programs.
5310
5311 @item -Wmemset-elt-size
5312 @opindex Wmemset-elt-size
5313 @opindex Wno-memset-elt-size
5314 Warn for suspicious calls to the @code{memset} built-in function, if the
5315 first argument references an array, and the third argument is a number
5316 equal to the number of elements, but not equal to the size of the array
5317 in memory. This indicates that the user has omitted a multiplication by
5318 the element size. This warning is enabled by @option{-Wall}.
5319
5320 @item -Wmemset-transposed-args
5321 @opindex Wmemset-transposed-args
5322 @opindex Wno-memset-transposed-args
5323 Warn for suspicious calls to the @code{memset} built-in function, if the
5324 second argument is not zero and the third argument is zero. This warns e.g.@
5325 about @code{memset (buf, sizeof buf, 0)} where most probably
5326 @code{memset (buf, 0, sizeof buf)} was meant instead. The diagnostics
5327 is only emitted if the third argument is literal zero. If it is some
5328 expression that is folded to zero, a cast of zero to some type, etc.,
5329 it is far less likely that the user has mistakenly exchanged the arguments
5330 and no warning is emitted. This warning is enabled by @option{-Wall}.
5331
5332 @item -Waddress
5333 @opindex Waddress
5334 @opindex Wno-address
5335 Warn about suspicious uses of memory addresses. These include using
5336 the address of a function in a conditional expression, such as
5337 @code{void func(void); if (func)}, and comparisons against the memory
5338 address of a string literal, such as @code{if (x == "abc")}. Such
5339 uses typically indicate a programmer error: the address of a function
5340 always evaluates to true, so their use in a conditional usually
5341 indicate that the programmer forgot the parentheses in a function
5342 call; and comparisons against string literals result in unspecified
5343 behavior and are not portable in C, so they usually indicate that the
5344 programmer intended to use @code{strcmp}. This warning is enabled by
5345 @option{-Wall}.
5346
5347 @item -Wlogical-op
5348 @opindex Wlogical-op
5349 @opindex Wno-logical-op
5350 Warn about suspicious uses of logical operators in expressions.
5351 This includes using logical operators in contexts where a
5352 bit-wise operator is likely to be expected. Also warns when
5353 the operands of a logical operator are the same:
5354 @smallexample
5355 extern int a;
5356 if (a < 0 && a < 0) @{ @dots{} @}
5357 @end smallexample
5358
5359 @item -Wlogical-not-parentheses
5360 @opindex Wlogical-not-parentheses
5361 @opindex Wno-logical-not-parentheses
5362 Warn about logical not used on the left hand side operand of a comparison.
5363 This option does not warn if the RHS operand is of a boolean type. Its
5364 purpose is to detect suspicious code like the following:
5365 @smallexample
5366 int a;
5367 @dots{}
5368 if (!a > 1) @{ @dots{} @}
5369 @end smallexample
5370
5371 It is possible to suppress the warning by wrapping the LHS into
5372 parentheses:
5373 @smallexample
5374 if ((!a) > 1) @{ @dots{} @}
5375 @end smallexample
5376
5377 This warning is enabled by @option{-Wall}.
5378
5379 @item -Waggregate-return
5380 @opindex Waggregate-return
5381 @opindex Wno-aggregate-return
5382 Warn if any functions that return structures or unions are defined or
5383 called. (In languages where you can return an array, this also elicits
5384 a warning.)
5385
5386 @item -Wno-aggressive-loop-optimizations
5387 @opindex Wno-aggressive-loop-optimizations
5388 @opindex Waggressive-loop-optimizations
5389 Warn if in a loop with constant number of iterations the compiler detects
5390 undefined behavior in some statement during one or more of the iterations.
5391
5392 @item -Wno-attributes
5393 @opindex Wno-attributes
5394 @opindex Wattributes
5395 Do not warn if an unexpected @code{__attribute__} is used, such as
5396 unrecognized attributes, function attributes applied to variables,
5397 etc. This does not stop errors for incorrect use of supported
5398 attributes.
5399
5400 @item -Wno-builtin-macro-redefined
5401 @opindex Wno-builtin-macro-redefined
5402 @opindex Wbuiltin-macro-redefined
5403 Do not warn if certain built-in macros are redefined. This suppresses
5404 warnings for redefinition of @code{__TIMESTAMP__}, @code{__TIME__},
5405 @code{__DATE__}, @code{__FILE__}, and @code{__BASE_FILE__}.
5406
5407 @item -Wstrict-prototypes @r{(C and Objective-C only)}
5408 @opindex Wstrict-prototypes
5409 @opindex Wno-strict-prototypes
5410 Warn if a function is declared or defined without specifying the
5411 argument types. (An old-style function definition is permitted without
5412 a warning if preceded by a declaration that specifies the argument
5413 types.)
5414
5415 @item -Wold-style-declaration @r{(C and Objective-C only)}
5416 @opindex Wold-style-declaration
5417 @opindex Wno-old-style-declaration
5418 Warn for obsolescent usages, according to the C Standard, in a
5419 declaration. For example, warn if storage-class specifiers like
5420 @code{static} are not the first things in a declaration. This warning
5421 is also enabled by @option{-Wextra}.
5422
5423 @item -Wold-style-definition @r{(C and Objective-C only)}
5424 @opindex Wold-style-definition
5425 @opindex Wno-old-style-definition
5426 Warn if an old-style function definition is used. A warning is given
5427 even if there is a previous prototype.
5428
5429 @item -Wmissing-parameter-type @r{(C and Objective-C only)}
5430 @opindex Wmissing-parameter-type
5431 @opindex Wno-missing-parameter-type
5432 A function parameter is declared without a type specifier in K&R-style
5433 functions:
5434
5435 @smallexample
5436 void foo(bar) @{ @}
5437 @end smallexample
5438
5439 This warning is also enabled by @option{-Wextra}.
5440
5441 @item -Wmissing-prototypes @r{(C and Objective-C only)}
5442 @opindex Wmissing-prototypes
5443 @opindex Wno-missing-prototypes
5444 Warn if a global function is defined without a previous prototype
5445 declaration. This warning is issued even if the definition itself
5446 provides a prototype. Use this option to detect global functions
5447 that do not have a matching prototype declaration in a header file.
5448 This option is not valid for C++ because all function declarations
5449 provide prototypes and a non-matching declaration declares an
5450 overload rather than conflict with an earlier declaration.
5451 Use @option{-Wmissing-declarations} to detect missing declarations in C++.
5452
5453 @item -Wmissing-declarations
5454 @opindex Wmissing-declarations
5455 @opindex Wno-missing-declarations
5456 Warn if a global function is defined without a previous declaration.
5457 Do so even if the definition itself provides a prototype.
5458 Use this option to detect global functions that are not declared in
5459 header files. In C, no warnings are issued for functions with previous
5460 non-prototype declarations; use @option{-Wmissing-prototypes} to detect
5461 missing prototypes. In C++, no warnings are issued for function templates,
5462 or for inline functions, or for functions in anonymous namespaces.
5463
5464 @item -Wmissing-field-initializers
5465 @opindex Wmissing-field-initializers
5466 @opindex Wno-missing-field-initializers
5467 @opindex W
5468 @opindex Wextra
5469 @opindex Wno-extra
5470 Warn if a structure's initializer has some fields missing. For
5471 example, the following code causes such a warning, because
5472 @code{x.h} is implicitly zero:
5473
5474 @smallexample
5475 struct s @{ int f, g, h; @};
5476 struct s x = @{ 3, 4 @};
5477 @end smallexample
5478
5479 This option does not warn about designated initializers, so the following
5480 modification does not trigger a warning:
5481
5482 @smallexample
5483 struct s @{ int f, g, h; @};
5484 struct s x = @{ .f = 3, .g = 4 @};
5485 @end smallexample
5486
5487 In C++ this option does not warn either about the empty @{ @}
5488 initializer, for example:
5489
5490 @smallexample
5491 struct s @{ int f, g, h; @};
5492 s x = @{ @};
5493 @end smallexample
5494
5495 This warning is included in @option{-Wextra}. To get other @option{-Wextra}
5496 warnings without this one, use @option{-Wextra -Wno-missing-field-initializers}.
5497
5498 @item -Wno-multichar
5499 @opindex Wno-multichar
5500 @opindex Wmultichar
5501 Do not warn if a multicharacter constant (@samp{'FOOF'}) is used.
5502 Usually they indicate a typo in the user's code, as they have
5503 implementation-defined values, and should not be used in portable code.
5504
5505 @item -Wnormalized@r{[}=@r{<}none@r{|}id@r{|}nfc@r{|}nfkc@r{>]}
5506 @opindex Wnormalized=
5507 @opindex Wnormalized
5508 @opindex Wno-normalized
5509 @cindex NFC
5510 @cindex NFKC
5511 @cindex character set, input normalization
5512 In ISO C and ISO C++, two identifiers are different if they are
5513 different sequences of characters. However, sometimes when characters
5514 outside the basic ASCII character set are used, you can have two
5515 different character sequences that look the same. To avoid confusion,
5516 the ISO 10646 standard sets out some @dfn{normalization rules} which
5517 when applied ensure that two sequences that look the same are turned into
5518 the same sequence. GCC can warn you if you are using identifiers that
5519 have not been normalized; this option controls that warning.
5520
5521 There are four levels of warning supported by GCC@. The default is
5522 @option{-Wnormalized=nfc}, which warns about any identifier that is
5523 not in the ISO 10646 ``C'' normalized form, @dfn{NFC}. NFC is the
5524 recommended form for most uses. It is equivalent to
5525 @option{-Wnormalized}.
5526
5527 Unfortunately, there are some characters allowed in identifiers by
5528 ISO C and ISO C++ that, when turned into NFC, are not allowed in
5529 identifiers. That is, there's no way to use these symbols in portable
5530 ISO C or C++ and have all your identifiers in NFC@.
5531 @option{-Wnormalized=id} suppresses the warning for these characters.
5532 It is hoped that future versions of the standards involved will correct
5533 this, which is why this option is not the default.
5534
5535 You can switch the warning off for all characters by writing
5536 @option{-Wnormalized=none} or @option{-Wno-normalized}. You should
5537 only do this if you are using some other normalization scheme (like
5538 ``D''), because otherwise you can easily create bugs that are
5539 literally impossible to see.
5540
5541 Some characters in ISO 10646 have distinct meanings but look identical
5542 in some fonts or display methodologies, especially once formatting has
5543 been applied. For instance @code{\u207F}, ``SUPERSCRIPT LATIN SMALL
5544 LETTER N'', displays just like a regular @code{n} that has been
5545 placed in a superscript. ISO 10646 defines the @dfn{NFKC}
5546 normalization scheme to convert all these into a standard form as
5547 well, and GCC warns if your code is not in NFKC if you use
5548 @option{-Wnormalized=nfkc}. This warning is comparable to warning
5549 about every identifier that contains the letter O because it might be
5550 confused with the digit 0, and so is not the default, but may be
5551 useful as a local coding convention if the programming environment
5552 cannot be fixed to display these characters distinctly.
5553
5554 @item -Wno-deprecated
5555 @opindex Wno-deprecated
5556 @opindex Wdeprecated
5557 Do not warn about usage of deprecated features. @xref{Deprecated Features}.
5558
5559 @item -Wno-deprecated-declarations
5560 @opindex Wno-deprecated-declarations
5561 @opindex Wdeprecated-declarations
5562 Do not warn about uses of functions (@pxref{Function Attributes}),
5563 variables (@pxref{Variable Attributes}), and types (@pxref{Type
5564 Attributes}) marked as deprecated by using the @code{deprecated}
5565 attribute.
5566
5567 @item -Wno-overflow
5568 @opindex Wno-overflow
5569 @opindex Woverflow
5570 Do not warn about compile-time overflow in constant expressions.
5571
5572 @item -Wno-odr
5573 @opindex Wno-odr
5574 @opindex Wodr
5575 Warn about One Definition Rule violations during link-time optimization.
5576 Requires @option{-flto-odr-type-merging} to be enabled. Enabled by default.
5577
5578 @item -Wopenmp-simd
5579 @opindex Wopenm-simd
5580 Warn if the vectorizer cost model overrides the OpenMP or the Cilk Plus
5581 simd directive set by user. The @option{-fsimd-cost-model=unlimited}
5582 option can be used to relax the cost model.
5583
5584 @item -Woverride-init @r{(C and Objective-C only)}
5585 @opindex Woverride-init
5586 @opindex Wno-override-init
5587 @opindex W
5588 @opindex Wextra
5589 @opindex Wno-extra
5590 Warn if an initialized field without side effects is overridden when
5591 using designated initializers (@pxref{Designated Inits, , Designated
5592 Initializers}).
5593
5594 This warning is included in @option{-Wextra}. To get other
5595 @option{-Wextra} warnings without this one, use @option{-Wextra
5596 -Wno-override-init}.
5597
5598 @item -Woverride-init-side-effects @r{(C and Objective-C only)}
5599 @opindex Woverride-init-side-effects
5600 @opindex Wno-override-init-side-effects
5601 Warn if an initialized field with side effects is overridden when
5602 using designated initializers (@pxref{Designated Inits, , Designated
5603 Initializers}). This warning is enabled by default.
5604
5605 @item -Wpacked
5606 @opindex Wpacked
5607 @opindex Wno-packed
5608 Warn if a structure is given the packed attribute, but the packed
5609 attribute has no effect on the layout or size of the structure.
5610 Such structures may be mis-aligned for little benefit. For
5611 instance, in this code, the variable @code{f.x} in @code{struct bar}
5612 is misaligned even though @code{struct bar} does not itself
5613 have the packed attribute:
5614
5615 @smallexample
5616 @group
5617 struct foo @{
5618 int x;
5619 char a, b, c, d;
5620 @} __attribute__((packed));
5621 struct bar @{
5622 char z;
5623 struct foo f;
5624 @};
5625 @end group
5626 @end smallexample
5627
5628 @item -Wpacked-bitfield-compat
5629 @opindex Wpacked-bitfield-compat
5630 @opindex Wno-packed-bitfield-compat
5631 The 4.1, 4.2 and 4.3 series of GCC ignore the @code{packed} attribute
5632 on bit-fields of type @code{char}. This has been fixed in GCC 4.4 but
5633 the change can lead to differences in the structure layout. GCC
5634 informs you when the offset of such a field has changed in GCC 4.4.
5635 For example there is no longer a 4-bit padding between field @code{a}
5636 and @code{b} in this structure:
5637
5638 @smallexample
5639 struct foo
5640 @{
5641 char a:4;
5642 char b:8;
5643 @} __attribute__ ((packed));
5644 @end smallexample
5645
5646 This warning is enabled by default. Use
5647 @option{-Wno-packed-bitfield-compat} to disable this warning.
5648
5649 @item -Wpadded
5650 @opindex Wpadded
5651 @opindex Wno-padded
5652 Warn if padding is included in a structure, either to align an element
5653 of the structure or to align the whole structure. Sometimes when this
5654 happens it is possible to rearrange the fields of the structure to
5655 reduce the padding and so make the structure smaller.
5656
5657 @item -Wredundant-decls
5658 @opindex Wredundant-decls
5659 @opindex Wno-redundant-decls
5660 Warn if anything is declared more than once in the same scope, even in
5661 cases where multiple declaration is valid and changes nothing.
5662
5663 @item -Wnested-externs @r{(C and Objective-C only)}
5664 @opindex Wnested-externs
5665 @opindex Wno-nested-externs
5666 Warn if an @code{extern} declaration is encountered within a function.
5667
5668 @item -Wno-inherited-variadic-ctor
5669 @opindex Winherited-variadic-ctor
5670 @opindex Wno-inherited-variadic-ctor
5671 Suppress warnings about use of C++11 inheriting constructors when the
5672 base class inherited from has a C variadic constructor; the warning is
5673 on by default because the ellipsis is not inherited.
5674
5675 @item -Winline
5676 @opindex Winline
5677 @opindex Wno-inline
5678 Warn if a function that is declared as inline cannot be inlined.
5679 Even with this option, the compiler does not warn about failures to
5680 inline functions declared in system headers.
5681
5682 The compiler uses a variety of heuristics to determine whether or not
5683 to inline a function. For example, the compiler takes into account
5684 the size of the function being inlined and the amount of inlining
5685 that has already been done in the current function. Therefore,
5686 seemingly insignificant changes in the source program can cause the
5687 warnings produced by @option{-Winline} to appear or disappear.
5688
5689 @item -Wno-invalid-offsetof @r{(C++ and Objective-C++ only)}
5690 @opindex Wno-invalid-offsetof
5691 @opindex Winvalid-offsetof
5692 Suppress warnings from applying the @code{offsetof} macro to a non-POD
5693 type. According to the 2014 ISO C++ standard, applying @code{offsetof}
5694 to a non-standard-layout type is undefined. In existing C++ implementations,
5695 however, @code{offsetof} typically gives meaningful results.
5696 This flag is for users who are aware that they are
5697 writing nonportable code and who have deliberately chosen to ignore the
5698 warning about it.
5699
5700 The restrictions on @code{offsetof} may be relaxed in a future version
5701 of the C++ standard.
5702
5703 @item -Wno-int-to-pointer-cast
5704 @opindex Wno-int-to-pointer-cast
5705 @opindex Wint-to-pointer-cast
5706 Suppress warnings from casts to pointer type of an integer of a
5707 different size. In C++, casting to a pointer type of smaller size is
5708 an error. @option{Wint-to-pointer-cast} is enabled by default.
5709
5710
5711 @item -Wno-pointer-to-int-cast @r{(C and Objective-C only)}
5712 @opindex Wno-pointer-to-int-cast
5713 @opindex Wpointer-to-int-cast
5714 Suppress warnings from casts from a pointer to an integer type of a
5715 different size.
5716
5717 @item -Winvalid-pch
5718 @opindex Winvalid-pch
5719 @opindex Wno-invalid-pch
5720 Warn if a precompiled header (@pxref{Precompiled Headers}) is found in
5721 the search path but can't be used.
5722
5723 @item -Wlong-long
5724 @opindex Wlong-long
5725 @opindex Wno-long-long
5726 Warn if @code{long long} type is used. This is enabled by either
5727 @option{-Wpedantic} or @option{-Wtraditional} in ISO C90 and C++98
5728 modes. To inhibit the warning messages, use @option{-Wno-long-long}.
5729
5730 @item -Wvariadic-macros
5731 @opindex Wvariadic-macros
5732 @opindex Wno-variadic-macros
5733 Warn if variadic macros are used in ISO C90 mode, or if the GNU
5734 alternate syntax is used in ISO C99 mode. This is enabled by either
5735 @option{-Wpedantic} or @option{-Wtraditional}. To inhibit the warning
5736 messages, use @option{-Wno-variadic-macros}.
5737
5738 @item -Wvarargs
5739 @opindex Wvarargs
5740 @opindex Wno-varargs
5741 Warn upon questionable usage of the macros used to handle variable
5742 arguments like @code{va_start}. This is default. To inhibit the
5743 warning messages, use @option{-Wno-varargs}.
5744
5745 @item -Wvector-operation-performance
5746 @opindex Wvector-operation-performance
5747 @opindex Wno-vector-operation-performance
5748 Warn if vector operation is not implemented via SIMD capabilities of the
5749 architecture. Mainly useful for the performance tuning.
5750 Vector operation can be implemented @code{piecewise}, which means that the
5751 scalar operation is performed on every vector element;
5752 @code{in parallel}, which means that the vector operation is implemented
5753 using scalars of wider type, which normally is more performance efficient;
5754 and @code{as a single scalar}, which means that vector fits into a
5755 scalar type.
5756
5757 @item -Wno-virtual-move-assign
5758 @opindex Wvirtual-move-assign
5759 @opindex Wno-virtual-move-assign
5760 Suppress warnings about inheriting from a virtual base with a
5761 non-trivial C++11 move assignment operator. This is dangerous because
5762 if the virtual base is reachable along more than one path, it is
5763 moved multiple times, which can mean both objects end up in the
5764 moved-from state. If the move assignment operator is written to avoid
5765 moving from a moved-from object, this warning can be disabled.
5766
5767 @item -Wvla
5768 @opindex Wvla
5769 @opindex Wno-vla
5770 Warn if variable length array is used in the code.
5771 @option{-Wno-vla} prevents the @option{-Wpedantic} warning of
5772 the variable length array.
5773
5774 @item -Wvolatile-register-var
5775 @opindex Wvolatile-register-var
5776 @opindex Wno-volatile-register-var
5777 Warn if a register variable is declared volatile. The volatile
5778 modifier does not inhibit all optimizations that may eliminate reads
5779 and/or writes to register variables. This warning is enabled by
5780 @option{-Wall}.
5781
5782 @item -Wdisabled-optimization
5783 @opindex Wdisabled-optimization
5784 @opindex Wno-disabled-optimization
5785 Warn if a requested optimization pass is disabled. This warning does
5786 not generally indicate that there is anything wrong with your code; it
5787 merely indicates that GCC's optimizers are unable to handle the code
5788 effectively. Often, the problem is that your code is too big or too
5789 complex; GCC refuses to optimize programs when the optimization
5790 itself is likely to take inordinate amounts of time.
5791
5792 @item -Wpointer-sign @r{(C and Objective-C only)}
5793 @opindex Wpointer-sign
5794 @opindex Wno-pointer-sign
5795 Warn for pointer argument passing or assignment with different signedness.
5796 This option is only supported for C and Objective-C@. It is implied by
5797 @option{-Wall} and by @option{-Wpedantic}, which can be disabled with
5798 @option{-Wno-pointer-sign}.
5799
5800 @item -Wstack-protector
5801 @opindex Wstack-protector
5802 @opindex Wno-stack-protector
5803 This option is only active when @option{-fstack-protector} is active. It
5804 warns about functions that are not protected against stack smashing.
5805
5806 @item -Woverlength-strings
5807 @opindex Woverlength-strings
5808 @opindex Wno-overlength-strings
5809 Warn about string constants that are longer than the ``minimum
5810 maximum'' length specified in the C standard. Modern compilers
5811 generally allow string constants that are much longer than the
5812 standard's minimum limit, but very portable programs should avoid
5813 using longer strings.
5814
5815 The limit applies @emph{after} string constant concatenation, and does
5816 not count the trailing NUL@. In C90, the limit was 509 characters; in
5817 C99, it was raised to 4095. C++98 does not specify a normative
5818 minimum maximum, so we do not diagnose overlength strings in C++@.
5819
5820 This option is implied by @option{-Wpedantic}, and can be disabled with
5821 @option{-Wno-overlength-strings}.
5822
5823 @item -Wunsuffixed-float-constants @r{(C and Objective-C only)}
5824 @opindex Wunsuffixed-float-constants
5825
5826 Issue a warning for any floating constant that does not have
5827 a suffix. When used together with @option{-Wsystem-headers} it
5828 warns about such constants in system header files. This can be useful
5829 when preparing code to use with the @code{FLOAT_CONST_DECIMAL64} pragma
5830 from the decimal floating-point extension to C99.
5831
5832 @item -Wno-designated-init @r{(C and Objective-C only)}
5833 Suppress warnings when a positional initializer is used to initialize
5834 a structure that has been marked with the @code{designated_init}
5835 attribute.
5836
5837 @item -Whsa
5838 Issue a warning when HSAIL cannot be emitted for the compiled function or
5839 OpenMP construct.
5840
5841 @end table
5842
5843 @node Debugging Options
5844 @section Options for Debugging Your Program
5845 @cindex options, debugging
5846 @cindex debugging information options
5847
5848 To tell GCC to emit extra information for use by a debugger, in almost
5849 all cases you need only to add @option{-g} to your other options.
5850
5851 GCC allows you to use @option{-g} with
5852 @option{-O}. The shortcuts taken by optimized code may occasionally
5853 be surprising: some variables you declared may not exist
5854 at all; flow of control may briefly move where you did not expect it;
5855 some statements may not be executed because they compute constant
5856 results or their values are already at hand; some statements may
5857 execute in different places because they have been moved out of loops.
5858 Nevertheless it is possible to debug optimized output. This makes
5859 it reasonable to use the optimizer for programs that might have bugs.
5860
5861 If you are not using some other optimization option, consider
5862 using @option{-Og} (@pxref{Optimize Options}) with @option{-g}.
5863 With no @option{-O} option at all, some compiler passes that collect
5864 information useful for debugging do not run at all, so that
5865 @option{-Og} may result in a better debugging experience.
5866
5867 @table @gcctabopt
5868 @item -g
5869 @opindex g
5870 Produce debugging information in the operating system's native format
5871 (stabs, COFF, XCOFF, or DWARF)@. GDB can work with this debugging
5872 information.
5873
5874 On most systems that use stabs format, @option{-g} enables use of extra
5875 debugging information that only GDB can use; this extra information
5876 makes debugging work better in GDB but probably makes other debuggers
5877 crash or
5878 refuse to read the program. If you want to control for certain whether
5879 to generate the extra information, use @option{-gstabs+}, @option{-gstabs},
5880 @option{-gxcoff+}, @option{-gxcoff}, or @option{-gvms} (see below).
5881
5882 @item -ggdb
5883 @opindex ggdb
5884 Produce debugging information for use by GDB@. This means to use the
5885 most expressive format available (DWARF, stabs, or the native format
5886 if neither of those are supported), including GDB extensions if at all
5887 possible.
5888
5889 @item -gdwarf
5890 @itemx -gdwarf-@var{version}
5891 @opindex gdwarf
5892 Produce debugging information in DWARF format (if that is supported).
5893 The value of @var{version} may be either 2, 3, 4 or 5; the default version
5894 for most targets is 4. DWARF Version 5 is only experimental.
5895
5896 Note that with DWARF Version 2, some ports require and always
5897 use some non-conflicting DWARF 3 extensions in the unwind tables.
5898
5899 Version 4 may require GDB 7.0 and @option{-fvar-tracking-assignments}
5900 for maximum benefit.
5901
5902 GCC no longer supports DWARF Version 1, which is substantially
5903 different than Version 2 and later. For historical reasons, some
5904 other DWARF-related options (including @option{-feliminate-dwarf2-dups}
5905 and @option{-fno-dwarf2-cfi-asm}) retain a reference to DWARF Version 2
5906 in their names, but apply to all currently-supported versions of DWARF.
5907
5908 @item -gstabs
5909 @opindex gstabs
5910 Produce debugging information in stabs format (if that is supported),
5911 without GDB extensions. This is the format used by DBX on most BSD
5912 systems. On MIPS, Alpha and System V Release 4 systems this option
5913 produces stabs debugging output that is not understood by DBX or SDB@.
5914 On System V Release 4 systems this option requires the GNU assembler.
5915
5916 @item -gstabs+
5917 @opindex gstabs+
5918 Produce debugging information in stabs format (if that is supported),
5919 using GNU extensions understood only by the GNU debugger (GDB)@. The
5920 use of these extensions is likely to make other debuggers crash or
5921 refuse to read the program.
5922
5923 @item -gcoff
5924 @opindex gcoff
5925 Produce debugging information in COFF format (if that is supported).
5926 This is the format used by SDB on most System V systems prior to
5927 System V Release 4.
5928
5929 @item -gxcoff
5930 @opindex gxcoff
5931 Produce debugging information in XCOFF format (if that is supported).
5932 This is the format used by the DBX debugger on IBM RS/6000 systems.
5933
5934 @item -gxcoff+
5935 @opindex gxcoff+
5936 Produce debugging information in XCOFF format (if that is supported),
5937 using GNU extensions understood only by the GNU debugger (GDB)@. The
5938 use of these extensions is likely to make other debuggers crash or
5939 refuse to read the program, and may cause assemblers other than the GNU
5940 assembler (GAS) to fail with an error.
5941
5942 @item -gvms
5943 @opindex gvms
5944 Produce debugging information in Alpha/VMS debug format (if that is
5945 supported). This is the format used by DEBUG on Alpha/VMS systems.
5946
5947 @item -g@var{level}
5948 @itemx -ggdb@var{level}
5949 @itemx -gstabs@var{level}
5950 @itemx -gcoff@var{level}
5951 @itemx -gxcoff@var{level}
5952 @itemx -gvms@var{level}
5953 Request debugging information and also use @var{level} to specify how
5954 much information. The default level is 2.
5955
5956 Level 0 produces no debug information at all. Thus, @option{-g0} negates
5957 @option{-g}.
5958
5959 Level 1 produces minimal information, enough for making backtraces in
5960 parts of the program that you don't plan to debug. This includes
5961 descriptions of functions and external variables, and line number
5962 tables, but no information about local variables.
5963
5964 Level 3 includes extra information, such as all the macro definitions
5965 present in the program. Some debuggers support macro expansion when
5966 you use @option{-g3}.
5967
5968 @option{-gdwarf} does not accept a concatenated debug level, to avoid
5969 confusion with @option{-gdwarf-@var{level}}.
5970 Instead use an additional @option{-g@var{level}} option to change the
5971 debug level for DWARF.
5972
5973 @item -feliminate-unused-debug-symbols
5974 @opindex feliminate-unused-debug-symbols
5975 Produce debugging information in stabs format (if that is supported),
5976 for only symbols that are actually used.
5977
5978 @item -femit-class-debug-always
5979 @opindex femit-class-debug-always
5980 Instead of emitting debugging information for a C++ class in only one
5981 object file, emit it in all object files using the class. This option
5982 should be used only with debuggers that are unable to handle the way GCC
5983 normally emits debugging information for classes because using this
5984 option increases the size of debugging information by as much as a
5985 factor of two.
5986
5987 @item -fno-merge-debug-strings
5988 @opindex fmerge-debug-strings
5989 @opindex fno-merge-debug-strings
5990 Direct the linker to not merge together strings in the debugging
5991 information that are identical in different object files. Merging is
5992 not supported by all assemblers or linkers. Merging decreases the size
5993 of the debug information in the output file at the cost of increasing
5994 link processing time. Merging is enabled by default.
5995
5996 @item -fdebug-prefix-map=@var{old}=@var{new}
5997 @opindex fdebug-prefix-map
5998 When compiling files in directory @file{@var{old}}, record debugging
5999 information describing them as in @file{@var{new}} instead.
6000
6001 @item -fvar-tracking
6002 @opindex fvar-tracking
6003 Run variable tracking pass. It computes where variables are stored at each
6004 position in code. Better debugging information is then generated
6005 (if the debugging information format supports this information).
6006
6007 It is enabled by default when compiling with optimization (@option{-Os},
6008 @option{-O}, @option{-O2}, @dots{}), debugging information (@option{-g}) and
6009 the debug info format supports it.
6010
6011 @item -fvar-tracking-assignments
6012 @opindex fvar-tracking-assignments
6013 @opindex fno-var-tracking-assignments
6014 Annotate assignments to user variables early in the compilation and
6015 attempt to carry the annotations over throughout the compilation all the
6016 way to the end, in an attempt to improve debug information while
6017 optimizing. Use of @option{-gdwarf-4} is recommended along with it.
6018
6019 It can be enabled even if var-tracking is disabled, in which case
6020 annotations are created and maintained, but discarded at the end.
6021 By default, this flag is enabled together with @option{-fvar-tracking},
6022 except when selective scheduling is enabled.
6023
6024 @item -gsplit-dwarf
6025 @opindex gsplit-dwarf
6026 Separate as much DWARF debugging information as possible into a
6027 separate output file with the extension @file{.dwo}. This option allows
6028 the build system to avoid linking files with debug information. To
6029 be useful, this option requires a debugger capable of reading @file{.dwo}
6030 files.
6031
6032 @item -gpubnames
6033 @opindex gpubnames
6034 Generate DWARF @code{.debug_pubnames} and @code{.debug_pubtypes} sections.
6035
6036 @item -ggnu-pubnames
6037 @opindex ggnu-pubnames
6038 Generate @code{.debug_pubnames} and @code{.debug_pubtypes} sections in a format
6039 suitable for conversion into a GDB@ index. This option is only useful
6040 with a linker that can produce GDB@ index version 7.
6041
6042 @item -fdebug-types-section
6043 @opindex fdebug-types-section
6044 @opindex fno-debug-types-section
6045 When using DWARF Version 4 or higher, type DIEs can be put into
6046 their own @code{.debug_types} section instead of making them part of the
6047 @code{.debug_info} section. It is more efficient to put them in a separate
6048 comdat sections since the linker can then remove duplicates.
6049 But not all DWARF consumers support @code{.debug_types} sections yet
6050 and on some objects @code{.debug_types} produces larger instead of smaller
6051 debugging information.
6052
6053 @item -grecord-gcc-switches
6054 @item -gno-record-gcc-switches
6055 @opindex grecord-gcc-switches
6056 @opindex gno-record-gcc-switches
6057 This switch causes the command-line options used to invoke the
6058 compiler that may affect code generation to be appended to the
6059 DW_AT_producer attribute in DWARF debugging information. The options
6060 are concatenated with spaces separating them from each other and from
6061 the compiler version.
6062 It is enabled by default.
6063 See also @option{-frecord-gcc-switches} for another
6064 way of storing compiler options into the object file.
6065
6066 @item -gstrict-dwarf
6067 @opindex gstrict-dwarf
6068 Disallow using extensions of later DWARF standard version than selected
6069 with @option{-gdwarf-@var{version}}. On most targets using non-conflicting
6070 DWARF extensions from later standard versions is allowed.
6071
6072 @item -gno-strict-dwarf
6073 @opindex gno-strict-dwarf
6074 Allow using extensions of later DWARF standard version than selected with
6075 @option{-gdwarf-@var{version}}.
6076
6077 @item -gz@r{[}=@var{type}@r{]}
6078 @opindex gz
6079 Produce compressed debug sections in DWARF format, if that is supported.
6080 If @var{type} is not given, the default type depends on the capabilities
6081 of the assembler and linker used. @var{type} may be one of
6082 @samp{none} (don't compress debug sections), @samp{zlib} (use zlib
6083 compression in ELF gABI format), or @samp{zlib-gnu} (use zlib
6084 compression in traditional GNU format). If the linker doesn't support
6085 writing compressed debug sections, the option is rejected. Otherwise,
6086 if the assembler does not support them, @option{-gz} is silently ignored
6087 when producing object files.
6088
6089 @item -feliminate-dwarf2-dups
6090 @opindex feliminate-dwarf2-dups
6091 Compress DWARF debugging information by eliminating duplicated
6092 information about each symbol. This option only makes sense when
6093 generating DWARF debugging information.
6094
6095 @item -femit-struct-debug-baseonly
6096 @opindex femit-struct-debug-baseonly
6097 Emit debug information for struct-like types
6098 only when the base name of the compilation source file
6099 matches the base name of file in which the struct is defined.
6100
6101 This option substantially reduces the size of debugging information,
6102 but at significant potential loss in type information to the debugger.
6103 See @option{-femit-struct-debug-reduced} for a less aggressive option.
6104 See @option{-femit-struct-debug-detailed} for more detailed control.
6105
6106 This option works only with DWARF debug output.
6107
6108 @item -femit-struct-debug-reduced
6109 @opindex femit-struct-debug-reduced
6110 Emit debug information for struct-like types
6111 only when the base name of the compilation source file
6112 matches the base name of file in which the type is defined,
6113 unless the struct is a template or defined in a system header.
6114
6115 This option significantly reduces the size of debugging information,
6116 with some potential loss in type information to the debugger.
6117 See @option{-femit-struct-debug-baseonly} for a more aggressive option.
6118 See @option{-femit-struct-debug-detailed} for more detailed control.
6119
6120 This option works only with DWARF debug output.
6121
6122 @item -femit-struct-debug-detailed@r{[}=@var{spec-list}@r{]}
6123 @opindex femit-struct-debug-detailed
6124 Specify the struct-like types
6125 for which the compiler generates debug information.
6126 The intent is to reduce duplicate struct debug information
6127 between different object files within the same program.
6128
6129 This option is a detailed version of
6130 @option{-femit-struct-debug-reduced} and @option{-femit-struct-debug-baseonly},
6131 which serves for most needs.
6132
6133 A specification has the syntax@*
6134 [@samp{dir:}|@samp{ind:}][@samp{ord:}|@samp{gen:}](@samp{any}|@samp{sys}|@samp{base}|@samp{none})
6135
6136 The optional first word limits the specification to
6137 structs that are used directly (@samp{dir:}) or used indirectly (@samp{ind:}).
6138 A struct type is used directly when it is the type of a variable, member.
6139 Indirect uses arise through pointers to structs.
6140 That is, when use of an incomplete struct is valid, the use is indirect.
6141 An example is
6142 @samp{struct one direct; struct two * indirect;}.
6143
6144 The optional second word limits the specification to
6145 ordinary structs (@samp{ord:}) or generic structs (@samp{gen:}).
6146 Generic structs are a bit complicated to explain.
6147 For C++, these are non-explicit specializations of template classes,
6148 or non-template classes within the above.
6149 Other programming languages have generics,
6150 but @option{-femit-struct-debug-detailed} does not yet implement them.
6151
6152 The third word specifies the source files for those
6153 structs for which the compiler should emit debug information.
6154 The values @samp{none} and @samp{any} have the normal meaning.
6155 The value @samp{base} means that
6156 the base of name of the file in which the type declaration appears
6157 must match the base of the name of the main compilation file.
6158 In practice, this means that when compiling @file{foo.c}, debug information
6159 is generated for types declared in that file and @file{foo.h},
6160 but not other header files.
6161 The value @samp{sys} means those types satisfying @samp{base}
6162 or declared in system or compiler headers.
6163
6164 You may need to experiment to determine the best settings for your application.
6165
6166 The default is @option{-femit-struct-debug-detailed=all}.
6167
6168 This option works only with DWARF debug output.
6169
6170 @item -fno-dwarf2-cfi-asm
6171 @opindex fdwarf2-cfi-asm
6172 @opindex fno-dwarf2-cfi-asm
6173 Emit DWARF unwind info as compiler generated @code{.eh_frame} section
6174 instead of using GAS @code{.cfi_*} directives.
6175
6176 @item -fno-eliminate-unused-debug-types
6177 @opindex feliminate-unused-debug-types
6178 @opindex fno-eliminate-unused-debug-types
6179 Normally, when producing DWARF output, GCC avoids producing debug symbol
6180 output for types that are nowhere used in the source file being compiled.
6181 Sometimes it is useful to have GCC emit debugging
6182 information for all types declared in a compilation
6183 unit, regardless of whether or not they are actually used
6184 in that compilation unit, for example
6185 if, in the debugger, you want to cast a value to a type that is
6186 not actually used in your program (but is declared). More often,
6187 however, this results in a significant amount of wasted space.
6188 @end table
6189
6190 @node Optimize Options
6191 @section Options That Control Optimization
6192 @cindex optimize options
6193 @cindex options, optimization
6194
6195 These options control various sorts of optimizations.
6196
6197 Without any optimization option, the compiler's goal is to reduce the
6198 cost of compilation and to make debugging produce the expected
6199 results. Statements are independent: if you stop the program with a
6200 breakpoint between statements, you can then assign a new value to any
6201 variable or change the program counter to any other statement in the
6202 function and get exactly the results you expect from the source
6203 code.
6204
6205 Turning on optimization flags makes the compiler attempt to improve
6206 the performance and/or code size at the expense of compilation time
6207 and possibly the ability to debug the program.
6208
6209 The compiler performs optimization based on the knowledge it has of the
6210 program. Compiling multiple files at once to a single output file mode allows
6211 the compiler to use information gained from all of the files when compiling
6212 each of them.
6213
6214 Not all optimizations are controlled directly by a flag. Only
6215 optimizations that have a flag are listed in this section.
6216
6217 Most optimizations are only enabled if an @option{-O} level is set on
6218 the command line. Otherwise they are disabled, even if individual
6219 optimization flags are specified.
6220
6221 Depending on the target and how GCC was configured, a slightly different
6222 set of optimizations may be enabled at each @option{-O} level than
6223 those listed here. You can invoke GCC with @option{-Q --help=optimizers}
6224 to find out the exact set of optimizations that are enabled at each level.
6225 @xref{Overall Options}, for examples.
6226
6227 @table @gcctabopt
6228 @item -O
6229 @itemx -O1
6230 @opindex O
6231 @opindex O1
6232 Optimize. Optimizing compilation takes somewhat more time, and a lot
6233 more memory for a large function.
6234
6235 With @option{-O}, the compiler tries to reduce code size and execution
6236 time, without performing any optimizations that take a great deal of
6237 compilation time.
6238
6239 @option{-O} turns on the following optimization flags:
6240 @gccoptlist{
6241 -fauto-inc-dec @gol
6242 -fbranch-count-reg @gol
6243 -fcombine-stack-adjustments @gol
6244 -fcompare-elim @gol
6245 -fcprop-registers @gol
6246 -fdce @gol
6247 -fdefer-pop @gol
6248 -fdelayed-branch @gol
6249 -fdse @gol
6250 -fforward-propagate @gol
6251 -fguess-branch-probability @gol
6252 -fif-conversion2 @gol
6253 -fif-conversion @gol
6254 -finline-functions-called-once @gol
6255 -fipa-pure-const @gol
6256 -fipa-profile @gol
6257 -fipa-reference @gol
6258 -fmerge-constants @gol
6259 -fmove-loop-invariants @gol
6260 -freorder-blocks @gol
6261 -fshrink-wrap @gol
6262 -fsplit-wide-types @gol
6263 -fssa-backprop @gol
6264 -fssa-phiopt @gol
6265 -ftree-bit-ccp @gol
6266 -ftree-ccp @gol
6267 -ftree-ch @gol
6268 -ftree-coalesce-vars @gol
6269 -ftree-copy-prop @gol
6270 -ftree-dce @gol
6271 -ftree-dominator-opts @gol
6272 -ftree-dse @gol
6273 -ftree-forwprop @gol
6274 -ftree-fre @gol
6275 -ftree-phiprop @gol
6276 -ftree-sink @gol
6277 -ftree-slsr @gol
6278 -ftree-sra @gol
6279 -ftree-pta @gol
6280 -ftree-ter @gol
6281 -funit-at-a-time}
6282
6283 @option{-O} also turns on @option{-fomit-frame-pointer} on machines
6284 where doing so does not interfere with debugging.
6285
6286 @item -O2
6287 @opindex O2
6288 Optimize even more. GCC performs nearly all supported optimizations
6289 that do not involve a space-speed tradeoff.
6290 As compared to @option{-O}, this option increases both compilation time
6291 and the performance of the generated code.
6292
6293 @option{-O2} turns on all optimization flags specified by @option{-O}. It
6294 also turns on the following optimization flags:
6295 @gccoptlist{-fthread-jumps @gol
6296 -falign-functions -falign-jumps @gol
6297 -falign-loops -falign-labels @gol
6298 -fcaller-saves @gol
6299 -fcrossjumping @gol
6300 -fcse-follow-jumps -fcse-skip-blocks @gol
6301 -fdelete-null-pointer-checks @gol
6302 -fdevirtualize -fdevirtualize-speculatively @gol
6303 -fexpensive-optimizations @gol
6304 -fgcse -fgcse-lm @gol
6305 -fhoist-adjacent-loads @gol
6306 -finline-small-functions @gol
6307 -findirect-inlining @gol
6308 -fipa-cp @gol
6309 -fipa-cp-alignment @gol
6310 -fipa-sra @gol
6311 -fipa-icf @gol
6312 -fisolate-erroneous-paths-dereference @gol
6313 -flra-remat @gol
6314 -foptimize-sibling-calls @gol
6315 -foptimize-strlen @gol
6316 -fpartial-inlining @gol
6317 -fpeephole2 @gol
6318 -freorder-blocks-algorithm=stc @gol
6319 -freorder-blocks-and-partition -freorder-functions @gol
6320 -frerun-cse-after-loop @gol
6321 -fsched-interblock -fsched-spec @gol
6322 -fschedule-insns -fschedule-insns2 @gol
6323 -fstrict-aliasing -fstrict-overflow @gol
6324 -ftree-builtin-call-dce @gol
6325 -ftree-switch-conversion -ftree-tail-merge @gol
6326 -ftree-pre @gol
6327 -ftree-vrp @gol
6328 -fipa-ra}
6329
6330 Please note the warning under @option{-fgcse} about
6331 invoking @option{-O2} on programs that use computed gotos.
6332
6333 @item -O3
6334 @opindex O3
6335 Optimize yet more. @option{-O3} turns on all optimizations specified
6336 by @option{-O2} and also turns on the @option{-finline-functions},
6337 @option{-funswitch-loops}, @option{-fpredictive-commoning},
6338 @option{-fgcse-after-reload}, @option{-ftree-loop-vectorize},
6339 @option{-ftree-loop-distribute-patterns}, @option{-fsplit-paths}
6340 @option{-ftree-slp-vectorize}, @option{-fvect-cost-model},
6341 @option{-ftree-partial-pre}, @option{-fpeel-loops}
6342 and @option{-fipa-cp-clone} options.
6343
6344 @item -O0
6345 @opindex O0
6346 Reduce compilation time and make debugging produce the expected
6347 results. This is the default.
6348
6349 @item -Os
6350 @opindex Os
6351 Optimize for size. @option{-Os} enables all @option{-O2} optimizations that
6352 do not typically increase code size. It also performs further
6353 optimizations designed to reduce code size.
6354
6355 @option{-Os} disables the following optimization flags:
6356 @gccoptlist{-falign-functions -falign-jumps -falign-loops @gol
6357 -falign-labels -freorder-blocks -freorder-blocks-algorithm=stc @gol
6358 -freorder-blocks-and-partition -fprefetch-loop-arrays}
6359
6360 @item -Ofast
6361 @opindex Ofast
6362 Disregard strict standards compliance. @option{-Ofast} enables all
6363 @option{-O3} optimizations. It also enables optimizations that are not
6364 valid for all standard-compliant programs.
6365 It turns on @option{-ffast-math} and the Fortran-specific
6366 @option{-fno-protect-parens} and @option{-fstack-arrays}.
6367
6368 @item -Og
6369 @opindex Og
6370 Optimize debugging experience. @option{-Og} enables optimizations
6371 that do not interfere with debugging. It should be the optimization
6372 level of choice for the standard edit-compile-debug cycle, offering
6373 a reasonable level of optimization while maintaining fast compilation
6374 and a good debugging experience.
6375 @end table
6376
6377 If you use multiple @option{-O} options, with or without level numbers,
6378 the last such option is the one that is effective.
6379
6380 Options of the form @option{-f@var{flag}} specify machine-independent
6381 flags. Most flags have both positive and negative forms; the negative
6382 form of @option{-ffoo} is @option{-fno-foo}. In the table
6383 below, only one of the forms is listed---the one you typically
6384 use. You can figure out the other form by either removing @samp{no-}
6385 or adding it.
6386
6387 The following options control specific optimizations. They are either
6388 activated by @option{-O} options or are related to ones that are. You
6389 can use the following flags in the rare cases when ``fine-tuning'' of
6390 optimizations to be performed is desired.
6391
6392 @table @gcctabopt
6393 @item -fno-defer-pop
6394 @opindex fno-defer-pop
6395 Always pop the arguments to each function call as soon as that function
6396 returns. For machines that must pop arguments after a function call,
6397 the compiler normally lets arguments accumulate on the stack for several
6398 function calls and pops them all at once.
6399
6400 Disabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
6401
6402 @item -fforward-propagate
6403 @opindex fforward-propagate
6404 Perform a forward propagation pass on RTL@. The pass tries to combine two
6405 instructions and checks if the result can be simplified. If loop unrolling
6406 is active, two passes are performed and the second is scheduled after
6407 loop unrolling.
6408
6409 This option is enabled by default at optimization levels @option{-O},
6410 @option{-O2}, @option{-O3}, @option{-Os}.
6411
6412 @item -ffp-contract=@var{style}
6413 @opindex ffp-contract
6414 @option{-ffp-contract=off} disables floating-point expression contraction.
6415 @option{-ffp-contract=fast} enables floating-point expression contraction
6416 such as forming of fused multiply-add operations if the target has
6417 native support for them.
6418 @option{-ffp-contract=on} enables floating-point expression contraction
6419 if allowed by the language standard. This is currently not implemented
6420 and treated equal to @option{-ffp-contract=off}.
6421
6422 The default is @option{-ffp-contract=fast}.
6423
6424 @item -fomit-frame-pointer
6425 @opindex fomit-frame-pointer
6426 Don't keep the frame pointer in a register for functions that
6427 don't need one. This avoids the instructions to save, set up and
6428 restore frame pointers; it also makes an extra register available
6429 in many functions. @strong{It also makes debugging impossible on
6430 some machines.}
6431
6432 On some machines, such as the VAX, this flag has no effect, because
6433 the standard calling sequence automatically handles the frame pointer
6434 and nothing is saved by pretending it doesn't exist. The
6435 machine-description macro @code{FRAME_POINTER_REQUIRED} controls
6436 whether a target machine supports this flag. @xref{Registers,,Register
6437 Usage, gccint, GNU Compiler Collection (GCC) Internals}.
6438
6439 The default setting (when not optimizing for
6440 size) for 32-bit GNU/Linux x86 and 32-bit Darwin x86 targets is
6441 @option{-fomit-frame-pointer}. You can configure GCC with the
6442 @option{--enable-frame-pointer} configure option to change the default.
6443
6444 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
6445
6446 @item -foptimize-sibling-calls
6447 @opindex foptimize-sibling-calls
6448 Optimize sibling and tail recursive calls.
6449
6450 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
6451
6452 @item -foptimize-strlen
6453 @opindex foptimize-strlen
6454 Optimize various standard C string functions (e.g. @code{strlen},
6455 @code{strchr} or @code{strcpy}) and
6456 their @code{_FORTIFY_SOURCE} counterparts into faster alternatives.
6457
6458 Enabled at levels @option{-O2}, @option{-O3}.
6459
6460 @item -fno-inline
6461 @opindex fno-inline
6462 Do not expand any functions inline apart from those marked with
6463 the @code{always_inline} attribute. This is the default when not
6464 optimizing.
6465
6466 Single functions can be exempted from inlining by marking them
6467 with the @code{noinline} attribute.
6468
6469 @item -finline-small-functions
6470 @opindex finline-small-functions
6471 Integrate functions into their callers when their body is smaller than expected
6472 function call code (so overall size of program gets smaller). The compiler
6473 heuristically decides which functions are simple enough to be worth integrating
6474 in this way. This inlining applies to all functions, even those not declared
6475 inline.
6476
6477 Enabled at level @option{-O2}.
6478
6479 @item -findirect-inlining
6480 @opindex findirect-inlining
6481 Inline also indirect calls that are discovered to be known at compile
6482 time thanks to previous inlining. This option has any effect only
6483 when inlining itself is turned on by the @option{-finline-functions}
6484 or @option{-finline-small-functions} options.
6485
6486 Enabled at level @option{-O2}.
6487
6488 @item -finline-functions
6489 @opindex finline-functions
6490 Consider all functions for inlining, even if they are not declared inline.
6491 The compiler heuristically decides which functions are worth integrating
6492 in this way.
6493
6494 If all calls to a given function are integrated, and the function is
6495 declared @code{static}, then the function is normally not output as
6496 assembler code in its own right.
6497
6498 Enabled at level @option{-O3}.
6499
6500 @item -finline-functions-called-once
6501 @opindex finline-functions-called-once
6502 Consider all @code{static} functions called once for inlining into their
6503 caller even if they are not marked @code{inline}. If a call to a given
6504 function is integrated, then the function is not output as assembler code
6505 in its own right.
6506
6507 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3} and @option{-Os}.
6508
6509 @item -fearly-inlining
6510 @opindex fearly-inlining
6511 Inline functions marked by @code{always_inline} and functions whose body seems
6512 smaller than the function call overhead early before doing
6513 @option{-fprofile-generate} instrumentation and real inlining pass. Doing so
6514 makes profiling significantly cheaper and usually inlining faster on programs
6515 having large chains of nested wrapper functions.
6516
6517 Enabled by default.
6518
6519 @item -fipa-sra
6520 @opindex fipa-sra
6521 Perform interprocedural scalar replacement of aggregates, removal of
6522 unused parameters and replacement of parameters passed by reference
6523 by parameters passed by value.
6524
6525 Enabled at levels @option{-O2}, @option{-O3} and @option{-Os}.
6526
6527 @item -finline-limit=@var{n}
6528 @opindex finline-limit
6529 By default, GCC limits the size of functions that can be inlined. This flag
6530 allows coarse control of this limit. @var{n} is the size of functions that
6531 can be inlined in number of pseudo instructions.
6532
6533 Inlining is actually controlled by a number of parameters, which may be
6534 specified individually by using @option{--param @var{name}=@var{value}}.
6535 The @option{-finline-limit=@var{n}} option sets some of these parameters
6536 as follows:
6537
6538 @table @gcctabopt
6539 @item max-inline-insns-single
6540 is set to @var{n}/2.
6541 @item max-inline-insns-auto
6542 is set to @var{n}/2.
6543 @end table
6544
6545 See below for a documentation of the individual
6546 parameters controlling inlining and for the defaults of these parameters.
6547
6548 @emph{Note:} there may be no value to @option{-finline-limit} that results
6549 in default behavior.
6550
6551 @emph{Note:} pseudo instruction represents, in this particular context, an
6552 abstract measurement of function's size. In no way does it represent a count
6553 of assembly instructions and as such its exact meaning might change from one
6554 release to an another.
6555
6556 @item -fno-keep-inline-dllexport
6557 @opindex fno-keep-inline-dllexport
6558 This is a more fine-grained version of @option{-fkeep-inline-functions},
6559 which applies only to functions that are declared using the @code{dllexport}
6560 attribute or declspec (@xref{Function Attributes,,Declaring Attributes of
6561 Functions}.)
6562
6563 @item -fkeep-inline-functions
6564 @opindex fkeep-inline-functions
6565 In C, emit @code{static} functions that are declared @code{inline}
6566 into the object file, even if the function has been inlined into all
6567 of its callers. This switch does not affect functions using the
6568 @code{extern inline} extension in GNU C90@. In C++, emit any and all
6569 inline functions into the object file.
6570
6571 @item -fkeep-static-functions
6572 @opindex fkeep-static-functions
6573 Emit @code{static} functions into the object file, even if the function
6574 is never used.
6575
6576 @item -fkeep-static-consts
6577 @opindex fkeep-static-consts
6578 Emit variables declared @code{static const} when optimization isn't turned
6579 on, even if the variables aren't referenced.
6580
6581 GCC enables this option by default. If you want to force the compiler to
6582 check if a variable is referenced, regardless of whether or not
6583 optimization is turned on, use the @option{-fno-keep-static-consts} option.
6584
6585 @item -fmerge-constants
6586 @opindex fmerge-constants
6587 Attempt to merge identical constants (string constants and floating-point
6588 constants) across compilation units.
6589
6590 This option is the default for optimized compilation if the assembler and
6591 linker support it. Use @option{-fno-merge-constants} to inhibit this
6592 behavior.
6593
6594 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
6595
6596 @item -fmerge-all-constants
6597 @opindex fmerge-all-constants
6598 Attempt to merge identical constants and identical variables.
6599
6600 This option implies @option{-fmerge-constants}. In addition to
6601 @option{-fmerge-constants} this considers e.g.@: even constant initialized
6602 arrays or initialized constant variables with integral or floating-point
6603 types. Languages like C or C++ require each variable, including multiple
6604 instances of the same variable in recursive calls, to have distinct locations,
6605 so using this option results in non-conforming
6606 behavior.
6607
6608 @item -fmodulo-sched
6609 @opindex fmodulo-sched
6610 Perform swing modulo scheduling immediately before the first scheduling
6611 pass. This pass looks at innermost loops and reorders their
6612 instructions by overlapping different iterations.
6613
6614 @item -fmodulo-sched-allow-regmoves
6615 @opindex fmodulo-sched-allow-regmoves
6616 Perform more aggressive SMS-based modulo scheduling with register moves
6617 allowed. By setting this flag certain anti-dependences edges are
6618 deleted, which triggers the generation of reg-moves based on the
6619 life-range analysis. This option is effective only with
6620 @option{-fmodulo-sched} enabled.
6621
6622 @item -fno-branch-count-reg
6623 @opindex fno-branch-count-reg
6624 Avoid running a pass scanning for opportunities to use ``decrement and
6625 branch'' instructions on a count register instead of generating sequences
6626 of instructions that decrement a register, compare it against zero, and
6627 then branch based upon the result. This option is only meaningful on
6628 architectures that support such instructions, which include x86, PowerPC,
6629 IA-64 and S/390. Note that the @option{-fno-branch-count-reg} option
6630 doesn't remove the decrement and branch instructions from the generated
6631 instruction stream introduced by other optimization passes.
6632
6633 Enabled by default at @option{-O1} and higher.
6634
6635 The default is @option{-fbranch-count-reg}.
6636
6637 @item -fno-function-cse
6638 @opindex fno-function-cse
6639 Do not put function addresses in registers; make each instruction that
6640 calls a constant function contain the function's address explicitly.
6641
6642 This option results in less efficient code, but some strange hacks
6643 that alter the assembler output may be confused by the optimizations
6644 performed when this option is not used.
6645
6646 The default is @option{-ffunction-cse}
6647
6648 @item -fno-zero-initialized-in-bss
6649 @opindex fno-zero-initialized-in-bss
6650 If the target supports a BSS section, GCC by default puts variables that
6651 are initialized to zero into BSS@. This can save space in the resulting
6652 code.
6653
6654 This option turns off this behavior because some programs explicitly
6655 rely on variables going to the data section---e.g., so that the
6656 resulting executable can find the beginning of that section and/or make
6657 assumptions based on that.
6658
6659 The default is @option{-fzero-initialized-in-bss}.
6660
6661 @item -fthread-jumps
6662 @opindex fthread-jumps
6663 Perform optimizations that check to see if a jump branches to a
6664 location where another comparison subsumed by the first is found. If
6665 so, the first branch is redirected to either the destination of the
6666 second branch or a point immediately following it, depending on whether
6667 the condition is known to be true or false.
6668
6669 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
6670
6671 @item -fsplit-wide-types
6672 @opindex fsplit-wide-types
6673 When using a type that occupies multiple registers, such as @code{long
6674 long} on a 32-bit system, split the registers apart and allocate them
6675 independently. This normally generates better code for those types,
6676 but may make debugging more difficult.
6677
6678 Enabled at levels @option{-O}, @option{-O2}, @option{-O3},
6679 @option{-Os}.
6680
6681 @item -fcse-follow-jumps
6682 @opindex fcse-follow-jumps
6683 In common subexpression elimination (CSE), scan through jump instructions
6684 when the target of the jump is not reached by any other path. For
6685 example, when CSE encounters an @code{if} statement with an
6686 @code{else} clause, CSE follows the jump when the condition
6687 tested is false.
6688
6689 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
6690
6691 @item -fcse-skip-blocks
6692 @opindex fcse-skip-blocks
6693 This is similar to @option{-fcse-follow-jumps}, but causes CSE to
6694 follow jumps that conditionally skip over blocks. When CSE
6695 encounters a simple @code{if} statement with no else clause,
6696 @option{-fcse-skip-blocks} causes CSE to follow the jump around the
6697 body of the @code{if}.
6698
6699 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
6700
6701 @item -frerun-cse-after-loop
6702 @opindex frerun-cse-after-loop
6703 Re-run common subexpression elimination after loop optimizations are
6704 performed.
6705
6706 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
6707
6708 @item -fgcse
6709 @opindex fgcse
6710 Perform a global common subexpression elimination pass.
6711 This pass also performs global constant and copy propagation.
6712
6713 @emph{Note:} When compiling a program using computed gotos, a GCC
6714 extension, you may get better run-time performance if you disable
6715 the global common subexpression elimination pass by adding
6716 @option{-fno-gcse} to the command line.
6717
6718 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
6719
6720 @item -fgcse-lm
6721 @opindex fgcse-lm
6722 When @option{-fgcse-lm} is enabled, global common subexpression elimination
6723 attempts to move loads that are only killed by stores into themselves. This
6724 allows a loop containing a load/store sequence to be changed to a load outside
6725 the loop, and a copy/store within the loop.
6726
6727 Enabled by default when @option{-fgcse} is enabled.
6728
6729 @item -fgcse-sm
6730 @opindex fgcse-sm
6731 When @option{-fgcse-sm} is enabled, a store motion pass is run after
6732 global common subexpression elimination. This pass attempts to move
6733 stores out of loops. When used in conjunction with @option{-fgcse-lm},
6734 loops containing a load/store sequence can be changed to a load before
6735 the loop and a store after the loop.
6736
6737 Not enabled at any optimization level.
6738
6739 @item -fgcse-las
6740 @opindex fgcse-las
6741 When @option{-fgcse-las} is enabled, the global common subexpression
6742 elimination pass eliminates redundant loads that come after stores to the
6743 same memory location (both partial and full redundancies).
6744
6745 Not enabled at any optimization level.
6746
6747 @item -fgcse-after-reload
6748 @opindex fgcse-after-reload
6749 When @option{-fgcse-after-reload} is enabled, a redundant load elimination
6750 pass is performed after reload. The purpose of this pass is to clean up
6751 redundant spilling.
6752
6753 @item -faggressive-loop-optimizations
6754 @opindex faggressive-loop-optimizations
6755 This option tells the loop optimizer to use language constraints to
6756 derive bounds for the number of iterations of a loop. This assumes that
6757 loop code does not invoke undefined behavior by for example causing signed
6758 integer overflows or out-of-bound array accesses. The bounds for the
6759 number of iterations of a loop are used to guide loop unrolling and peeling
6760 and loop exit test optimizations.
6761 This option is enabled by default.
6762
6763 @item -funsafe-loop-optimizations
6764 @opindex funsafe-loop-optimizations
6765 This option tells the loop optimizer to assume that loop indices do not
6766 overflow, and that loops with nontrivial exit condition are not
6767 infinite. This enables a wider range of loop optimizations even if
6768 the loop optimizer itself cannot prove that these assumptions are valid.
6769 If you use @option{-Wunsafe-loop-optimizations}, the compiler warns you
6770 if it finds this kind of loop.
6771
6772 @item -funconstrained-commons
6773 @opindex funconstrained-commons
6774 This option tells the compiler that variables declared in common blocks
6775 (e.g. Fortran) may later be overridden with longer trailing arrays. This
6776 prevents certain optimizations that depend on knowing the array bounds.
6777
6778 @item -fcrossjumping
6779 @opindex fcrossjumping
6780 Perform cross-jumping transformation.
6781 This transformation unifies equivalent code and saves code size. The
6782 resulting code may or may not perform better than without cross-jumping.
6783
6784 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
6785
6786 @item -fauto-inc-dec
6787 @opindex fauto-inc-dec
6788 Combine increments or decrements of addresses with memory accesses.
6789 This pass is always skipped on architectures that do not have
6790 instructions to support this. Enabled by default at @option{-O} and
6791 higher on architectures that support this.
6792
6793 @item -fdce
6794 @opindex fdce
6795 Perform dead code elimination (DCE) on RTL@.
6796 Enabled by default at @option{-O} and higher.
6797
6798 @item -fdse
6799 @opindex fdse
6800 Perform dead store elimination (DSE) on RTL@.
6801 Enabled by default at @option{-O} and higher.
6802
6803 @item -fif-conversion
6804 @opindex fif-conversion
6805 Attempt to transform conditional jumps into branch-less equivalents. This
6806 includes use of conditional moves, min, max, set flags and abs instructions, and
6807 some tricks doable by standard arithmetics. The use of conditional execution
6808 on chips where it is available is controlled by @option{-fif-conversion2}.
6809
6810 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
6811
6812 @item -fif-conversion2
6813 @opindex fif-conversion2
6814 Use conditional execution (where available) to transform conditional jumps into
6815 branch-less equivalents.
6816
6817 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
6818
6819 @item -fdeclone-ctor-dtor
6820 @opindex fdeclone-ctor-dtor
6821 The C++ ABI requires multiple entry points for constructors and
6822 destructors: one for a base subobject, one for a complete object, and
6823 one for a virtual destructor that calls operator delete afterwards.
6824 For a hierarchy with virtual bases, the base and complete variants are
6825 clones, which means two copies of the function. With this option, the
6826 base and complete variants are changed to be thunks that call a common
6827 implementation.
6828
6829 Enabled by @option{-Os}.
6830
6831 @item -fdelete-null-pointer-checks
6832 @opindex fdelete-null-pointer-checks
6833 Assume that programs cannot safely dereference null pointers, and that
6834 no code or data element resides at address zero.
6835 This option enables simple constant
6836 folding optimizations at all optimization levels. In addition, other
6837 optimization passes in GCC use this flag to control global dataflow
6838 analyses that eliminate useless checks for null pointers; these assume
6839 that a memory access to address zero always results in a trap, so
6840 that if a pointer is checked after it has already been dereferenced,
6841 it cannot be null.
6842
6843 Note however that in some environments this assumption is not true.
6844 Use @option{-fno-delete-null-pointer-checks} to disable this optimization
6845 for programs that depend on that behavior.
6846
6847 This option is enabled by default on most targets. On Nios II ELF, it
6848 defaults to off. On AVR and CR16, this option is completely disabled.
6849
6850 Passes that use the dataflow information
6851 are enabled independently at different optimization levels.
6852
6853 @item -fdevirtualize
6854 @opindex fdevirtualize
6855 Attempt to convert calls to virtual functions to direct calls. This
6856 is done both within a procedure and interprocedurally as part of
6857 indirect inlining (@option{-findirect-inlining}) and interprocedural constant
6858 propagation (@option{-fipa-cp}).
6859 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
6860
6861 @item -fdevirtualize-speculatively
6862 @opindex fdevirtualize-speculatively
6863 Attempt to convert calls to virtual functions to speculative direct calls.
6864 Based on the analysis of the type inheritance graph, determine for a given call
6865 the set of likely targets. If the set is small, preferably of size 1, change
6866 the call into a conditional deciding between direct and indirect calls. The
6867 speculative calls enable more optimizations, such as inlining. When they seem
6868 useless after further optimization, they are converted back into original form.
6869
6870 @item -fdevirtualize-at-ltrans
6871 @opindex fdevirtualize-at-ltrans
6872 Stream extra information needed for aggressive devirtualization when running
6873 the link-time optimizer in local transformation mode.
6874 This option enables more devirtualization but
6875 significantly increases the size of streamed data. For this reason it is
6876 disabled by default.
6877
6878 @item -fexpensive-optimizations
6879 @opindex fexpensive-optimizations
6880 Perform a number of minor optimizations that are relatively expensive.
6881
6882 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
6883
6884 @item -free
6885 @opindex free
6886 Attempt to remove redundant extension instructions. This is especially
6887 helpful for the x86-64 architecture, which implicitly zero-extends in 64-bit
6888 registers after writing to their lower 32-bit half.
6889
6890 Enabled for Alpha, AArch64 and x86 at levels @option{-O2},
6891 @option{-O3}, @option{-Os}.
6892
6893 @item -fno-lifetime-dse
6894 @opindex fno-lifetime-dse
6895 In C++ the value of an object is only affected by changes within its
6896 lifetime: when the constructor begins, the object has an indeterminate
6897 value, and any changes during the lifetime of the object are dead when
6898 the object is destroyed. Normally dead store elimination will take
6899 advantage of this; if your code relies on the value of the object
6900 storage persisting beyond the lifetime of the object, you can use this
6901 flag to disable this optimization. To preserve stores before the
6902 constructor starts (e.g. because your operator new clears the object
6903 storage) but still treat the object as dead after the destructor you,
6904 can use @option{-flifetime-dse=1}. The default behavior can be
6905 explicitly selected with @option{-flifetime-dse=2}.
6906 @option{-flifetime-dse=0} is equivalent to @option{-fno-lifetime-dse}.
6907
6908 @item -flive-range-shrinkage
6909 @opindex flive-range-shrinkage
6910 Attempt to decrease register pressure through register live range
6911 shrinkage. This is helpful for fast processors with small or moderate
6912 size register sets.
6913
6914 @item -fira-algorithm=@var{algorithm}
6915 @opindex fira-algorithm
6916 Use the specified coloring algorithm for the integrated register
6917 allocator. The @var{algorithm} argument can be @samp{priority}, which
6918 specifies Chow's priority coloring, or @samp{CB}, which specifies
6919 Chaitin-Briggs coloring. Chaitin-Briggs coloring is not implemented
6920 for all architectures, but for those targets that do support it, it is
6921 the default because it generates better code.
6922
6923 @item -fira-region=@var{region}
6924 @opindex fira-region
6925 Use specified regions for the integrated register allocator. The
6926 @var{region} argument should be one of the following:
6927
6928 @table @samp
6929
6930 @item all
6931 Use all loops as register allocation regions.
6932 This can give the best results for machines with a small and/or
6933 irregular register set.
6934
6935 @item mixed
6936 Use all loops except for loops with small register pressure
6937 as the regions. This value usually gives
6938 the best results in most cases and for most architectures,
6939 and is enabled by default when compiling with optimization for speed
6940 (@option{-O}, @option{-O2}, @dots{}).
6941
6942 @item one
6943 Use all functions as a single region.
6944 This typically results in the smallest code size, and is enabled by default for
6945 @option{-Os} or @option{-O0}.
6946
6947 @end table
6948
6949 @item -fira-hoist-pressure
6950 @opindex fira-hoist-pressure
6951 Use IRA to evaluate register pressure in the code hoisting pass for
6952 decisions to hoist expressions. This option usually results in smaller
6953 code, but it can slow the compiler down.
6954
6955 This option is enabled at level @option{-Os} for all targets.
6956
6957 @item -fira-loop-pressure
6958 @opindex fira-loop-pressure
6959 Use IRA to evaluate register pressure in loops for decisions to move
6960 loop invariants. This option usually results in generation
6961 of faster and smaller code on machines with large register files (>= 32
6962 registers), but it can slow the compiler down.
6963
6964 This option is enabled at level @option{-O3} for some targets.
6965
6966 @item -fno-ira-share-save-slots
6967 @opindex fno-ira-share-save-slots
6968 Disable sharing of stack slots used for saving call-used hard
6969 registers living through a call. Each hard register gets a
6970 separate stack slot, and as a result function stack frames are
6971 larger.
6972
6973 @item -fno-ira-share-spill-slots
6974 @opindex fno-ira-share-spill-slots
6975 Disable sharing of stack slots allocated for pseudo-registers. Each
6976 pseudo-register that does not get a hard register gets a separate
6977 stack slot, and as a result function stack frames are larger.
6978
6979 @item -flra-remat
6980 @opindex flra-remat
6981 Enable CFG-sensitive rematerialization in LRA. Instead of loading
6982 values of spilled pseudos, LRA tries to rematerialize (recalculate)
6983 values if it is profitable.
6984
6985 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
6986
6987 @item -fdelayed-branch
6988 @opindex fdelayed-branch
6989 If supported for the target machine, attempt to reorder instructions
6990 to exploit instruction slots available after delayed branch
6991 instructions.
6992
6993 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
6994
6995 @item -fschedule-insns
6996 @opindex fschedule-insns
6997 If supported for the target machine, attempt to reorder instructions to
6998 eliminate execution stalls due to required data being unavailable. This
6999 helps machines that have slow floating point or memory load instructions
7000 by allowing other instructions to be issued until the result of the load
7001 or floating-point instruction is required.
7002
7003 Enabled at levels @option{-O2}, @option{-O3}.
7004
7005 @item -fschedule-insns2
7006 @opindex fschedule-insns2
7007 Similar to @option{-fschedule-insns}, but requests an additional pass of
7008 instruction scheduling after register allocation has been done. This is
7009 especially useful on machines with a relatively small number of
7010 registers and where memory load instructions take more than one cycle.
7011
7012 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
7013
7014 @item -fno-sched-interblock
7015 @opindex fno-sched-interblock
7016 Don't schedule instructions across basic blocks. This is normally
7017 enabled by default when scheduling before register allocation, i.e.@:
7018 with @option{-fschedule-insns} or at @option{-O2} or higher.
7019
7020 @item -fno-sched-spec
7021 @opindex fno-sched-spec
7022 Don't allow speculative motion of non-load instructions. This is normally
7023 enabled by default when scheduling before register allocation, i.e.@:
7024 with @option{-fschedule-insns} or at @option{-O2} or higher.
7025
7026 @item -fsched-pressure
7027 @opindex fsched-pressure
7028 Enable register pressure sensitive insn scheduling before register
7029 allocation. This only makes sense when scheduling before register
7030 allocation is enabled, i.e.@: with @option{-fschedule-insns} or at
7031 @option{-O2} or higher. Usage of this option can improve the
7032 generated code and decrease its size by preventing register pressure
7033 increase above the number of available hard registers and subsequent
7034 spills in register allocation.
7035
7036 @item -fsched-spec-load
7037 @opindex fsched-spec-load
7038 Allow speculative motion of some load instructions. This only makes
7039 sense when scheduling before register allocation, i.e.@: with
7040 @option{-fschedule-insns} or at @option{-O2} or higher.
7041
7042 @item -fsched-spec-load-dangerous
7043 @opindex fsched-spec-load-dangerous
7044 Allow speculative motion of more load instructions. This only makes
7045 sense when scheduling before register allocation, i.e.@: with
7046 @option{-fschedule-insns} or at @option{-O2} or higher.
7047
7048 @item -fsched-stalled-insns
7049 @itemx -fsched-stalled-insns=@var{n}
7050 @opindex fsched-stalled-insns
7051 Define how many insns (if any) can be moved prematurely from the queue
7052 of stalled insns into the ready list during the second scheduling pass.
7053 @option{-fno-sched-stalled-insns} means that no insns are moved
7054 prematurely, @option{-fsched-stalled-insns=0} means there is no limit
7055 on how many queued insns can be moved prematurely.
7056 @option{-fsched-stalled-insns} without a value is equivalent to
7057 @option{-fsched-stalled-insns=1}.
7058
7059 @item -fsched-stalled-insns-dep
7060 @itemx -fsched-stalled-insns-dep=@var{n}
7061 @opindex fsched-stalled-insns-dep
7062 Define how many insn groups (cycles) are examined for a dependency
7063 on a stalled insn that is a candidate for premature removal from the queue
7064 of stalled insns. This has an effect only during the second scheduling pass,
7065 and only if @option{-fsched-stalled-insns} is used.
7066 @option{-fno-sched-stalled-insns-dep} is equivalent to
7067 @option{-fsched-stalled-insns-dep=0}.
7068 @option{-fsched-stalled-insns-dep} without a value is equivalent to
7069 @option{-fsched-stalled-insns-dep=1}.
7070
7071 @item -fsched2-use-superblocks
7072 @opindex fsched2-use-superblocks
7073 When scheduling after register allocation, use superblock scheduling.
7074 This allows motion across basic block boundaries,
7075 resulting in faster schedules. This option is experimental, as not all machine
7076 descriptions used by GCC model the CPU closely enough to avoid unreliable
7077 results from the algorithm.
7078
7079 This only makes sense when scheduling after register allocation, i.e.@: with
7080 @option{-fschedule-insns2} or at @option{-O2} or higher.
7081
7082 @item -fsched-group-heuristic
7083 @opindex fsched-group-heuristic
7084 Enable the group heuristic in the scheduler. This heuristic favors
7085 the instruction that belongs to a schedule group. This is enabled
7086 by default when scheduling is enabled, i.e.@: with @option{-fschedule-insns}
7087 or @option{-fschedule-insns2} or at @option{-O2} or higher.
7088
7089 @item -fsched-critical-path-heuristic
7090 @opindex fsched-critical-path-heuristic
7091 Enable the critical-path heuristic in the scheduler. This heuristic favors
7092 instructions on the critical path. This is enabled by default when
7093 scheduling is enabled, i.e.@: with @option{-fschedule-insns}
7094 or @option{-fschedule-insns2} or at @option{-O2} or higher.
7095
7096 @item -fsched-spec-insn-heuristic
7097 @opindex fsched-spec-insn-heuristic
7098 Enable the speculative instruction heuristic in the scheduler. This
7099 heuristic favors speculative instructions with greater dependency weakness.
7100 This is enabled by default when scheduling is enabled, i.e.@:
7101 with @option{-fschedule-insns} or @option{-fschedule-insns2}
7102 or at @option{-O2} or higher.
7103
7104 @item -fsched-rank-heuristic
7105 @opindex fsched-rank-heuristic
7106 Enable the rank heuristic in the scheduler. This heuristic favors
7107 the instruction belonging to a basic block with greater size or frequency.
7108 This is enabled by default when scheduling is enabled, i.e.@:
7109 with @option{-fschedule-insns} or @option{-fschedule-insns2} or
7110 at @option{-O2} or higher.
7111
7112 @item -fsched-last-insn-heuristic
7113 @opindex fsched-last-insn-heuristic
7114 Enable the last-instruction heuristic in the scheduler. This heuristic
7115 favors the instruction that is less dependent on the last instruction
7116 scheduled. This is enabled by default when scheduling is enabled,
7117 i.e.@: with @option{-fschedule-insns} or @option{-fschedule-insns2} or
7118 at @option{-O2} or higher.
7119
7120 @item -fsched-dep-count-heuristic
7121 @opindex fsched-dep-count-heuristic
7122 Enable the dependent-count heuristic in the scheduler. This heuristic
7123 favors the instruction that has more instructions depending on it.
7124 This is enabled by default when scheduling is enabled, i.e.@:
7125 with @option{-fschedule-insns} or @option{-fschedule-insns2} or
7126 at @option{-O2} or higher.
7127
7128 @item -freschedule-modulo-scheduled-loops
7129 @opindex freschedule-modulo-scheduled-loops
7130 Modulo scheduling is performed before traditional scheduling. If a loop
7131 is modulo scheduled, later scheduling passes may change its schedule.
7132 Use this option to control that behavior.
7133
7134 @item -fselective-scheduling
7135 @opindex fselective-scheduling
7136 Schedule instructions using selective scheduling algorithm. Selective
7137 scheduling runs instead of the first scheduler pass.
7138
7139 @item -fselective-scheduling2
7140 @opindex fselective-scheduling2
7141 Schedule instructions using selective scheduling algorithm. Selective
7142 scheduling runs instead of the second scheduler pass.
7143
7144 @item -fsel-sched-pipelining
7145 @opindex fsel-sched-pipelining
7146 Enable software pipelining of innermost loops during selective scheduling.
7147 This option has no effect unless one of @option{-fselective-scheduling} or
7148 @option{-fselective-scheduling2} is turned on.
7149
7150 @item -fsel-sched-pipelining-outer-loops
7151 @opindex fsel-sched-pipelining-outer-loops
7152 When pipelining loops during selective scheduling, also pipeline outer loops.
7153 This option has no effect unless @option{-fsel-sched-pipelining} is turned on.
7154
7155 @item -fsemantic-interposition
7156 @opindex fsemantic-interposition
7157 Some object formats, like ELF, allow interposing of symbols by the
7158 dynamic linker.
7159 This means that for symbols exported from the DSO, the compiler cannot perform
7160 interprocedural propagation, inlining and other optimizations in anticipation
7161 that the function or variable in question may change. While this feature is
7162 useful, for example, to rewrite memory allocation functions by a debugging
7163 implementation, it is expensive in the terms of code quality.
7164 With @option{-fno-semantic-interposition} the compiler assumes that
7165 if interposition happens for functions the overwriting function will have
7166 precisely the same semantics (and side effects).
7167 Similarly if interposition happens
7168 for variables, the constructor of the variable will be the same. The flag
7169 has no effect for functions explicitly declared inline
7170 (where it is never allowed for interposition to change semantics)
7171 and for symbols explicitly declared weak.
7172
7173 @item -fshrink-wrap
7174 @opindex fshrink-wrap
7175 Emit function prologues only before parts of the function that need it,
7176 rather than at the top of the function. This flag is enabled by default at
7177 @option{-O} and higher.
7178
7179 @item -fcaller-saves
7180 @opindex fcaller-saves
7181 Enable allocation of values to registers that are clobbered by
7182 function calls, by emitting extra instructions to save and restore the
7183 registers around such calls. Such allocation is done only when it
7184 seems to result in better code.
7185
7186 This option is always enabled by default on certain machines, usually
7187 those which have no call-preserved registers to use instead.
7188
7189 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
7190
7191 @item -fcombine-stack-adjustments
7192 @opindex fcombine-stack-adjustments
7193 Tracks stack adjustments (pushes and pops) and stack memory references
7194 and then tries to find ways to combine them.
7195
7196 Enabled by default at @option{-O1} and higher.
7197
7198 @item -fipa-ra
7199 @opindex fipa-ra
7200 Use caller save registers for allocation if those registers are not used by
7201 any called function. In that case it is not necessary to save and restore
7202 them around calls. This is only possible if called functions are part of
7203 same compilation unit as current function and they are compiled before it.
7204
7205 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
7206
7207 @item -fconserve-stack
7208 @opindex fconserve-stack
7209 Attempt to minimize stack usage. The compiler attempts to use less
7210 stack space, even if that makes the program slower. This option
7211 implies setting the @option{large-stack-frame} parameter to 100
7212 and the @option{large-stack-frame-growth} parameter to 400.
7213
7214 @item -ftree-reassoc
7215 @opindex ftree-reassoc
7216 Perform reassociation on trees. This flag is enabled by default
7217 at @option{-O} and higher.
7218
7219 @item -ftree-pre
7220 @opindex ftree-pre
7221 Perform partial redundancy elimination (PRE) on trees. This flag is
7222 enabled by default at @option{-O2} and @option{-O3}.
7223
7224 @item -ftree-partial-pre
7225 @opindex ftree-partial-pre
7226 Make partial redundancy elimination (PRE) more aggressive. This flag is
7227 enabled by default at @option{-O3}.
7228
7229 @item -ftree-forwprop
7230 @opindex ftree-forwprop
7231 Perform forward propagation on trees. This flag is enabled by default
7232 at @option{-O} and higher.
7233
7234 @item -ftree-fre
7235 @opindex ftree-fre
7236 Perform full redundancy elimination (FRE) on trees. The difference
7237 between FRE and PRE is that FRE only considers expressions
7238 that are computed on all paths leading to the redundant computation.
7239 This analysis is faster than PRE, though it exposes fewer redundancies.
7240 This flag is enabled by default at @option{-O} and higher.
7241
7242 @item -ftree-phiprop
7243 @opindex ftree-phiprop
7244 Perform hoisting of loads from conditional pointers on trees. This
7245 pass is enabled by default at @option{-O} and higher.
7246
7247 @item -fhoist-adjacent-loads
7248 @opindex fhoist-adjacent-loads
7249 Speculatively hoist loads from both branches of an if-then-else if the
7250 loads are from adjacent locations in the same structure and the target
7251 architecture has a conditional move instruction. This flag is enabled
7252 by default at @option{-O2} and higher.
7253
7254 @item -ftree-copy-prop
7255 @opindex ftree-copy-prop
7256 Perform copy propagation on trees. This pass eliminates unnecessary
7257 copy operations. This flag is enabled by default at @option{-O} and
7258 higher.
7259
7260 @item -fipa-pure-const
7261 @opindex fipa-pure-const
7262 Discover which functions are pure or constant.
7263 Enabled by default at @option{-O} and higher.
7264
7265 @item -fipa-reference
7266 @opindex fipa-reference
7267 Discover which static variables do not escape the
7268 compilation unit.
7269 Enabled by default at @option{-O} and higher.
7270
7271 @item -fipa-pta
7272 @opindex fipa-pta
7273 Perform interprocedural pointer analysis and interprocedural modification
7274 and reference analysis. This option can cause excessive memory and
7275 compile-time usage on large compilation units. It is not enabled by
7276 default at any optimization level.
7277
7278 @item -fipa-profile
7279 @opindex fipa-profile
7280 Perform interprocedural profile propagation. The functions called only from
7281 cold functions are marked as cold. Also functions executed once (such as
7282 @code{cold}, @code{noreturn}, static constructors or destructors) are identified. Cold
7283 functions and loop less parts of functions executed once are then optimized for
7284 size.
7285 Enabled by default at @option{-O} and higher.
7286
7287 @item -fipa-cp
7288 @opindex fipa-cp
7289 Perform interprocedural constant propagation.
7290 This optimization analyzes the program to determine when values passed
7291 to functions are constants and then optimizes accordingly.
7292 This optimization can substantially increase performance
7293 if the application has constants passed to functions.
7294 This flag is enabled by default at @option{-O2}, @option{-Os} and @option{-O3}.
7295
7296 @item -fipa-cp-clone
7297 @opindex fipa-cp-clone
7298 Perform function cloning to make interprocedural constant propagation stronger.
7299 When enabled, interprocedural constant propagation performs function cloning
7300 when externally visible function can be called with constant arguments.
7301 Because this optimization can create multiple copies of functions,
7302 it may significantly increase code size
7303 (see @option{--param ipcp-unit-growth=@var{value}}).
7304 This flag is enabled by default at @option{-O3}.
7305
7306 @item -fipa-cp-alignment
7307 @opindex -fipa-cp-alignment
7308 When enabled, this optimization propagates alignment of function
7309 parameters to support better vectorization and string operations.
7310
7311 This flag is enabled by default at @option{-O2} and @option{-Os}. It
7312 requires that @option{-fipa-cp} is enabled.
7313
7314 @item -fipa-icf
7315 @opindex fipa-icf
7316 Perform Identical Code Folding for functions and read-only variables.
7317 The optimization reduces code size and may disturb unwind stacks by replacing
7318 a function by equivalent one with a different name. The optimization works
7319 more effectively with link time optimization enabled.
7320
7321 Nevertheless the behavior is similar to Gold Linker ICF optimization, GCC ICF
7322 works on different levels and thus the optimizations are not same - there are
7323 equivalences that are found only by GCC and equivalences found only by Gold.
7324
7325 This flag is enabled by default at @option{-O2} and @option{-Os}.
7326
7327 @item -fisolate-erroneous-paths-dereference
7328 @opindex fisolate-erroneous-paths-dereference
7329 Detect paths that trigger erroneous or undefined behavior due to
7330 dereferencing a null pointer. Isolate those paths from the main control
7331 flow and turn the statement with erroneous or undefined behavior into a trap.
7332 This flag is enabled by default at @option{-O2} and higher and depends on
7333 @option{-fdelete-null-pointer-checks} also being enabled.
7334
7335 @item -fisolate-erroneous-paths-attribute
7336 @opindex fisolate-erroneous-paths-attribute
7337 Detect paths that trigger erroneous or undefined behavior due a null value
7338 being used in a way forbidden by a @code{returns_nonnull} or @code{nonnull}
7339 attribute. Isolate those paths from the main control flow and turn the
7340 statement with erroneous or undefined behavior into a trap. This is not
7341 currently enabled, but may be enabled by @option{-O2} in the future.
7342
7343 @item -ftree-sink
7344 @opindex ftree-sink
7345 Perform forward store motion on trees. This flag is
7346 enabled by default at @option{-O} and higher.
7347
7348 @item -ftree-bit-ccp
7349 @opindex ftree-bit-ccp
7350 Perform sparse conditional bit constant propagation on trees and propagate
7351 pointer alignment information.
7352 This pass only operates on local scalar variables and is enabled by default
7353 at @option{-O} and higher. It requires that @option{-ftree-ccp} is enabled.
7354
7355 @item -ftree-ccp
7356 @opindex ftree-ccp
7357 Perform sparse conditional constant propagation (CCP) on trees. This
7358 pass only operates on local scalar variables and is enabled by default
7359 at @option{-O} and higher.
7360
7361 @item -fssa-backprop
7362 @opindex fssa-backprop
7363 Propagate information about uses of a value up the definition chain
7364 in order to simplify the definitions. For example, this pass strips
7365 sign operations if the sign of a value never matters. The flag is
7366 enabled by default at @option{-O} and higher.
7367
7368 @item -fssa-phiopt
7369 @opindex fssa-phiopt
7370 Perform pattern matching on SSA PHI nodes to optimize conditional
7371 code. This pass is enabled by default at @option{-O} and higher.
7372
7373 @item -ftree-switch-conversion
7374 @opindex ftree-switch-conversion
7375 Perform conversion of simple initializations in a switch to
7376 initializations from a scalar array. This flag is enabled by default
7377 at @option{-O2} and higher.
7378
7379 @item -ftree-tail-merge
7380 @opindex ftree-tail-merge
7381 Look for identical code sequences. When found, replace one with a jump to the
7382 other. This optimization is known as tail merging or cross jumping. This flag
7383 is enabled by default at @option{-O2} and higher. The compilation time
7384 in this pass can
7385 be limited using @option{max-tail-merge-comparisons} parameter and
7386 @option{max-tail-merge-iterations} parameter.
7387
7388 @item -ftree-dce
7389 @opindex ftree-dce
7390 Perform dead code elimination (DCE) on trees. This flag is enabled by
7391 default at @option{-O} and higher.
7392
7393 @item -ftree-builtin-call-dce
7394 @opindex ftree-builtin-call-dce
7395 Perform conditional dead code elimination (DCE) for calls to built-in functions
7396 that may set @code{errno} but are otherwise side-effect free. This flag is
7397 enabled by default at @option{-O2} and higher if @option{-Os} is not also
7398 specified.
7399
7400 @item -ftree-dominator-opts
7401 @opindex ftree-dominator-opts
7402 Perform a variety of simple scalar cleanups (constant/copy
7403 propagation, redundancy elimination, range propagation and expression
7404 simplification) based on a dominator tree traversal. This also
7405 performs jump threading (to reduce jumps to jumps). This flag is
7406 enabled by default at @option{-O} and higher.
7407
7408 @item -ftree-dse
7409 @opindex ftree-dse
7410 Perform dead store elimination (DSE) on trees. A dead store is a store into
7411 a memory location that is later overwritten by another store without
7412 any intervening loads. In this case the earlier store can be deleted. This
7413 flag is enabled by default at @option{-O} and higher.
7414
7415 @item -ftree-ch
7416 @opindex ftree-ch
7417 Perform loop header copying on trees. This is beneficial since it increases
7418 effectiveness of code motion optimizations. It also saves one jump. This flag
7419 is enabled by default at @option{-O} and higher. It is not enabled
7420 for @option{-Os}, since it usually increases code size.
7421
7422 @item -ftree-loop-optimize
7423 @opindex ftree-loop-optimize
7424 Perform loop optimizations on trees. This flag is enabled by default
7425 at @option{-O} and higher.
7426
7427 @item -ftree-loop-linear
7428 @itemx -floop-interchange
7429 @itemx -floop-strip-mine
7430 @itemx -floop-block
7431 @itemx -floop-unroll-and-jam
7432 @opindex ftree-loop-linear
7433 @opindex floop-interchange
7434 @opindex floop-strip-mine
7435 @opindex floop-block
7436 @opindex floop-unroll-and-jam
7437 Perform loop nest optimizations. Same as
7438 @option{-floop-nest-optimize}. To use this code transformation, GCC has
7439 to be configured with @option{--with-isl} to enable the Graphite loop
7440 transformation infrastructure.
7441
7442 @item -fgraphite-identity
7443 @opindex fgraphite-identity
7444 Enable the identity transformation for graphite. For every SCoP we generate
7445 the polyhedral representation and transform it back to gimple. Using
7446 @option{-fgraphite-identity} we can check the costs or benefits of the
7447 GIMPLE -> GRAPHITE -> GIMPLE transformation. Some minimal optimizations
7448 are also performed by the code generator isl, like index splitting and
7449 dead code elimination in loops.
7450
7451 @item -floop-nest-optimize
7452 @opindex floop-nest-optimize
7453 Enable the isl based loop nest optimizer. This is a generic loop nest
7454 optimizer based on the Pluto optimization algorithms. It calculates a loop
7455 structure optimized for data-locality and parallelism. This option
7456 is experimental.
7457
7458 @item -floop-parallelize-all
7459 @opindex floop-parallelize-all
7460 Use the Graphite data dependence analysis to identify loops that can
7461 be parallelized. Parallelize all the loops that can be analyzed to
7462 not contain loop carried dependences without checking that it is
7463 profitable to parallelize the loops.
7464
7465 @item -ftree-coalesce-vars
7466 @opindex ftree-coalesce-vars
7467 While transforming the program out of the SSA representation, attempt to
7468 reduce copying by coalescing versions of different user-defined
7469 variables, instead of just compiler temporaries. This may severely
7470 limit the ability to debug an optimized program compiled with
7471 @option{-fno-var-tracking-assignments}. In the negated form, this flag
7472 prevents SSA coalescing of user variables. This option is enabled by
7473 default if optimization is enabled, and it does very little otherwise.
7474
7475 @item -ftree-loop-if-convert
7476 @opindex ftree-loop-if-convert
7477 Attempt to transform conditional jumps in the innermost loops to
7478 branch-less equivalents. The intent is to remove control-flow from
7479 the innermost loops in order to improve the ability of the
7480 vectorization pass to handle these loops. This is enabled by default
7481 if vectorization is enabled.
7482
7483 @item -ftree-loop-if-convert-stores
7484 @opindex ftree-loop-if-convert-stores
7485 Attempt to also if-convert conditional jumps containing memory writes.
7486 This transformation can be unsafe for multi-threaded programs as it
7487 transforms conditional memory writes into unconditional memory writes.
7488 For example,
7489 @smallexample
7490 for (i = 0; i < N; i++)
7491 if (cond)
7492 A[i] = expr;
7493 @end smallexample
7494 is transformed to
7495 @smallexample
7496 for (i = 0; i < N; i++)
7497 A[i] = cond ? expr : A[i];
7498 @end smallexample
7499 potentially producing data races.
7500
7501 @item -ftree-loop-distribution
7502 @opindex ftree-loop-distribution
7503 Perform loop distribution. This flag can improve cache performance on
7504 big loop bodies and allow further loop optimizations, like
7505 parallelization or vectorization, to take place. For example, the loop
7506 @smallexample
7507 DO I = 1, N
7508 A(I) = B(I) + C
7509 D(I) = E(I) * F
7510 ENDDO
7511 @end smallexample
7512 is transformed to
7513 @smallexample
7514 DO I = 1, N
7515 A(I) = B(I) + C
7516 ENDDO
7517 DO I = 1, N
7518 D(I) = E(I) * F
7519 ENDDO
7520 @end smallexample
7521
7522 @item -ftree-loop-distribute-patterns
7523 @opindex ftree-loop-distribute-patterns
7524 Perform loop distribution of patterns that can be code generated with
7525 calls to a library. This flag is enabled by default at @option{-O3}.
7526
7527 This pass distributes the initialization loops and generates a call to
7528 memset zero. For example, the loop
7529 @smallexample
7530 DO I = 1, N
7531 A(I) = 0
7532 B(I) = A(I) + I
7533 ENDDO
7534 @end smallexample
7535 is transformed to
7536 @smallexample
7537 DO I = 1, N
7538 A(I) = 0
7539 ENDDO
7540 DO I = 1, N
7541 B(I) = A(I) + I
7542 ENDDO
7543 @end smallexample
7544 and the initialization loop is transformed into a call to memset zero.
7545
7546 @item -ftree-loop-im
7547 @opindex ftree-loop-im
7548 Perform loop invariant motion on trees. This pass moves only invariants that
7549 are hard to handle at RTL level (function calls, operations that expand to
7550 nontrivial sequences of insns). With @option{-funswitch-loops} it also moves
7551 operands of conditions that are invariant out of the loop, so that we can use
7552 just trivial invariantness analysis in loop unswitching. The pass also includes
7553 store motion.
7554
7555 @item -ftree-loop-ivcanon
7556 @opindex ftree-loop-ivcanon
7557 Create a canonical counter for number of iterations in loops for which
7558 determining number of iterations requires complicated analysis. Later
7559 optimizations then may determine the number easily. Useful especially
7560 in connection with unrolling.
7561
7562 @item -fivopts
7563 @opindex fivopts
7564 Perform induction variable optimizations (strength reduction, induction
7565 variable merging and induction variable elimination) on trees.
7566
7567 @item -ftree-parallelize-loops=n
7568 @opindex ftree-parallelize-loops
7569 Parallelize loops, i.e., split their iteration space to run in n threads.
7570 This is only possible for loops whose iterations are independent
7571 and can be arbitrarily reordered. The optimization is only
7572 profitable on multiprocessor machines, for loops that are CPU-intensive,
7573 rather than constrained e.g.@: by memory bandwidth. This option
7574 implies @option{-pthread}, and thus is only supported on targets
7575 that have support for @option{-pthread}.
7576
7577 @item -ftree-pta
7578 @opindex ftree-pta
7579 Perform function-local points-to analysis on trees. This flag is
7580 enabled by default at @option{-O} and higher.
7581
7582 @item -ftree-sra
7583 @opindex ftree-sra
7584 Perform scalar replacement of aggregates. This pass replaces structure
7585 references with scalars to prevent committing structures to memory too
7586 early. This flag is enabled by default at @option{-O} and higher.
7587
7588 @item -ftree-ter
7589 @opindex ftree-ter
7590 Perform temporary expression replacement during the SSA->normal phase. Single
7591 use/single def temporaries are replaced at their use location with their
7592 defining expression. This results in non-GIMPLE code, but gives the expanders
7593 much more complex trees to work on resulting in better RTL generation. This is
7594 enabled by default at @option{-O} and higher.
7595
7596 @item -ftree-slsr
7597 @opindex ftree-slsr
7598 Perform straight-line strength reduction on trees. This recognizes related
7599 expressions involving multiplications and replaces them by less expensive
7600 calculations when possible. This is enabled by default at @option{-O} and
7601 higher.
7602
7603 @item -ftree-vectorize
7604 @opindex ftree-vectorize
7605 Perform vectorization on trees. This flag enables @option{-ftree-loop-vectorize}
7606 and @option{-ftree-slp-vectorize} if not explicitly specified.
7607
7608 @item -ftree-loop-vectorize
7609 @opindex ftree-loop-vectorize
7610 Perform loop vectorization on trees. This flag is enabled by default at
7611 @option{-O3} and when @option{-ftree-vectorize} is enabled.
7612
7613 @item -ftree-slp-vectorize
7614 @opindex ftree-slp-vectorize
7615 Perform basic block vectorization on trees. This flag is enabled by default at
7616 @option{-O3} and when @option{-ftree-vectorize} is enabled.
7617
7618 @item -fvect-cost-model=@var{model}
7619 @opindex fvect-cost-model
7620 Alter the cost model used for vectorization. The @var{model} argument
7621 should be one of @samp{unlimited}, @samp{dynamic} or @samp{cheap}.
7622 With the @samp{unlimited} model the vectorized code-path is assumed
7623 to be profitable while with the @samp{dynamic} model a runtime check
7624 guards the vectorized code-path to enable it only for iteration
7625 counts that will likely execute faster than when executing the original
7626 scalar loop. The @samp{cheap} model disables vectorization of
7627 loops where doing so would be cost prohibitive for example due to
7628 required runtime checks for data dependence or alignment but otherwise
7629 is equal to the @samp{dynamic} model.
7630 The default cost model depends on other optimization flags and is
7631 either @samp{dynamic} or @samp{cheap}.
7632
7633 @item -fsimd-cost-model=@var{model}
7634 @opindex fsimd-cost-model
7635 Alter the cost model used for vectorization of loops marked with the OpenMP
7636 or Cilk Plus simd directive. The @var{model} argument should be one of
7637 @samp{unlimited}, @samp{dynamic}, @samp{cheap}. All values of @var{model}
7638 have the same meaning as described in @option{-fvect-cost-model} and by
7639 default a cost model defined with @option{-fvect-cost-model} is used.
7640
7641 @item -ftree-vrp
7642 @opindex ftree-vrp
7643 Perform Value Range Propagation on trees. This is similar to the
7644 constant propagation pass, but instead of values, ranges of values are
7645 propagated. This allows the optimizers to remove unnecessary range
7646 checks like array bound checks and null pointer checks. This is
7647 enabled by default at @option{-O2} and higher. Null pointer check
7648 elimination is only done if @option{-fdelete-null-pointer-checks} is
7649 enabled.
7650
7651 @item -fsplit-paths
7652 @opindex fsplit-paths
7653 Split paths leading to loop backedges. This can improve dead code
7654 elimination and common subexpression elimination. This is enabled by
7655 default at @option{-O2} and above.
7656
7657 @item -fsplit-ivs-in-unroller
7658 @opindex fsplit-ivs-in-unroller
7659 Enables expression of values of induction variables in later iterations
7660 of the unrolled loop using the value in the first iteration. This breaks
7661 long dependency chains, thus improving efficiency of the scheduling passes.
7662
7663 A combination of @option{-fweb} and CSE is often sufficient to obtain the
7664 same effect. However, that is not reliable in cases where the loop body
7665 is more complicated than a single basic block. It also does not work at all
7666 on some architectures due to restrictions in the CSE pass.
7667
7668 This optimization is enabled by default.
7669
7670 @item -fvariable-expansion-in-unroller
7671 @opindex fvariable-expansion-in-unroller
7672 With this option, the compiler creates multiple copies of some
7673 local variables when unrolling a loop, which can result in superior code.
7674
7675 @item -fpartial-inlining
7676 @opindex fpartial-inlining
7677 Inline parts of functions. This option has any effect only
7678 when inlining itself is turned on by the @option{-finline-functions}
7679 or @option{-finline-small-functions} options.
7680
7681 Enabled at level @option{-O2}.
7682
7683 @item -fpredictive-commoning
7684 @opindex fpredictive-commoning
7685 Perform predictive commoning optimization, i.e., reusing computations
7686 (especially memory loads and stores) performed in previous
7687 iterations of loops.
7688
7689 This option is enabled at level @option{-O3}.
7690
7691 @item -fprefetch-loop-arrays
7692 @opindex fprefetch-loop-arrays
7693 If supported by the target machine, generate instructions to prefetch
7694 memory to improve the performance of loops that access large arrays.
7695
7696 This option may generate better or worse code; results are highly
7697 dependent on the structure of loops within the source code.
7698
7699 Disabled at level @option{-Os}.
7700
7701 @item -fno-peephole
7702 @itemx -fno-peephole2
7703 @opindex fno-peephole
7704 @opindex fno-peephole2
7705 Disable any machine-specific peephole optimizations. The difference
7706 between @option{-fno-peephole} and @option{-fno-peephole2} is in how they
7707 are implemented in the compiler; some targets use one, some use the
7708 other, a few use both.
7709
7710 @option{-fpeephole} is enabled by default.
7711 @option{-fpeephole2} enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
7712
7713 @item -fno-guess-branch-probability
7714 @opindex fno-guess-branch-probability
7715 Do not guess branch probabilities using heuristics.
7716
7717 GCC uses heuristics to guess branch probabilities if they are
7718 not provided by profiling feedback (@option{-fprofile-arcs}). These
7719 heuristics are based on the control flow graph. If some branch probabilities
7720 are specified by @code{__builtin_expect}, then the heuristics are
7721 used to guess branch probabilities for the rest of the control flow graph,
7722 taking the @code{__builtin_expect} info into account. The interactions
7723 between the heuristics and @code{__builtin_expect} can be complex, and in
7724 some cases, it may be useful to disable the heuristics so that the effects
7725 of @code{__builtin_expect} are easier to understand.
7726
7727 The default is @option{-fguess-branch-probability} at levels
7728 @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
7729
7730 @item -freorder-blocks
7731 @opindex freorder-blocks
7732 Reorder basic blocks in the compiled function in order to reduce number of
7733 taken branches and improve code locality.
7734
7735 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
7736
7737 @item -freorder-blocks-algorithm=@var{algorithm}
7738 @opindex freorder-blocks-algorithm
7739 Use the specified algorithm for basic block reordering. The
7740 @var{algorithm} argument can be @samp{simple}, which does not increase
7741 code size (except sometimes due to secondary effects like alignment),
7742 or @samp{stc}, the ``software trace cache'' algorithm, which tries to
7743 put all often executed code together, minimizing the number of branches
7744 executed by making extra copies of code.
7745
7746 The default is @samp{simple} at levels @option{-O}, @option{-Os}, and
7747 @samp{stc} at levels @option{-O2}, @option{-O3}.
7748
7749 @item -freorder-blocks-and-partition
7750 @opindex freorder-blocks-and-partition
7751 In addition to reordering basic blocks in the compiled function, in order
7752 to reduce number of taken branches, partitions hot and cold basic blocks
7753 into separate sections of the assembly and @file{.o} files, to improve
7754 paging and cache locality performance.
7755
7756 This optimization is automatically turned off in the presence of
7757 exception handling, for linkonce sections, for functions with a user-defined
7758 section attribute and on any architecture that does not support named
7759 sections.
7760
7761 Enabled for x86 at levels @option{-O2}, @option{-O3}.
7762
7763 @item -freorder-functions
7764 @opindex freorder-functions
7765 Reorder functions in the object file in order to
7766 improve code locality. This is implemented by using special
7767 subsections @code{.text.hot} for most frequently executed functions and
7768 @code{.text.unlikely} for unlikely executed functions. Reordering is done by
7769 the linker so object file format must support named sections and linker must
7770 place them in a reasonable way.
7771
7772 Also profile feedback must be available to make this option effective. See
7773 @option{-fprofile-arcs} for details.
7774
7775 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
7776
7777 @item -fstrict-aliasing
7778 @opindex fstrict-aliasing
7779 Allow the compiler to assume the strictest aliasing rules applicable to
7780 the language being compiled. For C (and C++), this activates
7781 optimizations based on the type of expressions. In particular, an
7782 object of one type is assumed never to reside at the same address as an
7783 object of a different type, unless the types are almost the same. For
7784 example, an @code{unsigned int} can alias an @code{int}, but not a
7785 @code{void*} or a @code{double}. A character type may alias any other
7786 type.
7787
7788 @anchor{Type-punning}Pay special attention to code like this:
7789 @smallexample
7790 union a_union @{
7791 int i;
7792 double d;
7793 @};
7794
7795 int f() @{
7796 union a_union t;
7797 t.d = 3.0;
7798 return t.i;
7799 @}
7800 @end smallexample
7801 The practice of reading from a different union member than the one most
7802 recently written to (called ``type-punning'') is common. Even with
7803 @option{-fstrict-aliasing}, type-punning is allowed, provided the memory
7804 is accessed through the union type. So, the code above works as
7805 expected. @xref{Structures unions enumerations and bit-fields
7806 implementation}. However, this code might not:
7807 @smallexample
7808 int f() @{
7809 union a_union t;
7810 int* ip;
7811 t.d = 3.0;
7812 ip = &t.i;
7813 return *ip;
7814 @}
7815 @end smallexample
7816
7817 Similarly, access by taking the address, casting the resulting pointer
7818 and dereferencing the result has undefined behavior, even if the cast
7819 uses a union type, e.g.:
7820 @smallexample
7821 int f() @{
7822 double d = 3.0;
7823 return ((union a_union *) &d)->i;
7824 @}
7825 @end smallexample
7826
7827 The @option{-fstrict-aliasing} option is enabled at levels
7828 @option{-O2}, @option{-O3}, @option{-Os}.
7829
7830 @item -fstrict-overflow
7831 @opindex fstrict-overflow
7832 Allow the compiler to assume strict signed overflow rules, depending
7833 on the language being compiled. For C (and C++) this means that
7834 overflow when doing arithmetic with signed numbers is undefined, which
7835 means that the compiler may assume that it does not happen. This
7836 permits various optimizations. For example, the compiler assumes
7837 that an expression like @code{i + 10 > i} is always true for
7838 signed @code{i}. This assumption is only valid if signed overflow is
7839 undefined, as the expression is false if @code{i + 10} overflows when
7840 using twos complement arithmetic. When this option is in effect any
7841 attempt to determine whether an operation on signed numbers
7842 overflows must be written carefully to not actually involve overflow.
7843
7844 This option also allows the compiler to assume strict pointer
7845 semantics: given a pointer to an object, if adding an offset to that
7846 pointer does not produce a pointer to the same object, the addition is
7847 undefined. This permits the compiler to conclude that @code{p + u >
7848 p} is always true for a pointer @code{p} and unsigned integer
7849 @code{u}. This assumption is only valid because pointer wraparound is
7850 undefined, as the expression is false if @code{p + u} overflows using
7851 twos complement arithmetic.
7852
7853 See also the @option{-fwrapv} option. Using @option{-fwrapv} means
7854 that integer signed overflow is fully defined: it wraps. When
7855 @option{-fwrapv} is used, there is no difference between
7856 @option{-fstrict-overflow} and @option{-fno-strict-overflow} for
7857 integers. With @option{-fwrapv} certain types of overflow are
7858 permitted. For example, if the compiler gets an overflow when doing
7859 arithmetic on constants, the overflowed value can still be used with
7860 @option{-fwrapv}, but not otherwise.
7861
7862 The @option{-fstrict-overflow} option is enabled at levels
7863 @option{-O2}, @option{-O3}, @option{-Os}.
7864
7865 @item -falign-functions
7866 @itemx -falign-functions=@var{n}
7867 @opindex falign-functions
7868 Align the start of functions to the next power-of-two greater than
7869 @var{n}, skipping up to @var{n} bytes. For instance,
7870 @option{-falign-functions=32} aligns functions to the next 32-byte
7871 boundary, but @option{-falign-functions=24} aligns to the next
7872 32-byte boundary only if this can be done by skipping 23 bytes or less.
7873
7874 @option{-fno-align-functions} and @option{-falign-functions=1} are
7875 equivalent and mean that functions are not aligned.
7876
7877 Some assemblers only support this flag when @var{n} is a power of two;
7878 in that case, it is rounded up.
7879
7880 If @var{n} is not specified or is zero, use a machine-dependent default.
7881
7882 Enabled at levels @option{-O2}, @option{-O3}.
7883
7884 @item -falign-labels
7885 @itemx -falign-labels=@var{n}
7886 @opindex falign-labels
7887 Align all branch targets to a power-of-two boundary, skipping up to
7888 @var{n} bytes like @option{-falign-functions}. This option can easily
7889 make code slower, because it must insert dummy operations for when the
7890 branch target is reached in the usual flow of the code.
7891
7892 @option{-fno-align-labels} and @option{-falign-labels=1} are
7893 equivalent and mean that labels are not aligned.
7894
7895 If @option{-falign-loops} or @option{-falign-jumps} are applicable and
7896 are greater than this value, then their values are used instead.
7897
7898 If @var{n} is not specified or is zero, use a machine-dependent default
7899 which is very likely to be @samp{1}, meaning no alignment.
7900
7901 Enabled at levels @option{-O2}, @option{-O3}.
7902
7903 @item -falign-loops
7904 @itemx -falign-loops=@var{n}
7905 @opindex falign-loops
7906 Align loops to a power-of-two boundary, skipping up to @var{n} bytes
7907 like @option{-falign-functions}. If the loops are
7908 executed many times, this makes up for any execution of the dummy
7909 operations.
7910
7911 @option{-fno-align-loops} and @option{-falign-loops=1} are
7912 equivalent and mean that loops are not aligned.
7913
7914 If @var{n} is not specified or is zero, use a machine-dependent default.
7915
7916 Enabled at levels @option{-O2}, @option{-O3}.
7917
7918 @item -falign-jumps
7919 @itemx -falign-jumps=@var{n}
7920 @opindex falign-jumps
7921 Align branch targets to a power-of-two boundary, for branch targets
7922 where the targets can only be reached by jumping, skipping up to @var{n}
7923 bytes like @option{-falign-functions}. In this case, no dummy operations
7924 need be executed.
7925
7926 @option{-fno-align-jumps} and @option{-falign-jumps=1} are
7927 equivalent and mean that loops are not aligned.
7928
7929 If @var{n} is not specified or is zero, use a machine-dependent default.
7930
7931 Enabled at levels @option{-O2}, @option{-O3}.
7932
7933 @item -funit-at-a-time
7934 @opindex funit-at-a-time
7935 This option is left for compatibility reasons. @option{-funit-at-a-time}
7936 has no effect, while @option{-fno-unit-at-a-time} implies
7937 @option{-fno-toplevel-reorder} and @option{-fno-section-anchors}.
7938
7939 Enabled by default.
7940
7941 @item -fno-toplevel-reorder
7942 @opindex fno-toplevel-reorder
7943 Do not reorder top-level functions, variables, and @code{asm}
7944 statements. Output them in the same order that they appear in the
7945 input file. When this option is used, unreferenced static variables
7946 are not removed. This option is intended to support existing code
7947 that relies on a particular ordering. For new code, it is better to
7948 use attributes when possible.
7949
7950 Enabled at level @option{-O0}. When disabled explicitly, it also implies
7951 @option{-fno-section-anchors}, which is otherwise enabled at @option{-O0} on some
7952 targets.
7953
7954 @item -fweb
7955 @opindex fweb
7956 Constructs webs as commonly used for register allocation purposes and assign
7957 each web individual pseudo register. This allows the register allocation pass
7958 to operate on pseudos directly, but also strengthens several other optimization
7959 passes, such as CSE, loop optimizer and trivial dead code remover. It can,
7960 however, make debugging impossible, since variables no longer stay in a
7961 ``home register''.
7962
7963 Enabled by default with @option{-funroll-loops}.
7964
7965 @item -fwhole-program
7966 @opindex fwhole-program
7967 Assume that the current compilation unit represents the whole program being
7968 compiled. All public functions and variables with the exception of @code{main}
7969 and those merged by attribute @code{externally_visible} become static functions
7970 and in effect are optimized more aggressively by interprocedural optimizers.
7971
7972 This option should not be used in combination with @option{-flto}.
7973 Instead relying on a linker plugin should provide safer and more precise
7974 information.
7975
7976 @item -flto[=@var{n}]
7977 @opindex flto
7978 This option runs the standard link-time optimizer. When invoked
7979 with source code, it generates GIMPLE (one of GCC's internal
7980 representations) and writes it to special ELF sections in the object
7981 file. When the object files are linked together, all the function
7982 bodies are read from these ELF sections and instantiated as if they
7983 had been part of the same translation unit.
7984
7985 To use the link-time optimizer, @option{-flto} and optimization
7986 options should be specified at compile time and during the final link.
7987 It is recommended that you compile all the files participating in the
7988 same link with the same options and also specify those options at
7989 link time.
7990 For example:
7991
7992 @smallexample
7993 gcc -c -O2 -flto foo.c
7994 gcc -c -O2 -flto bar.c
7995 gcc -o myprog -flto -O2 foo.o bar.o
7996 @end smallexample
7997
7998 The first two invocations to GCC save a bytecode representation
7999 of GIMPLE into special ELF sections inside @file{foo.o} and
8000 @file{bar.o}. The final invocation reads the GIMPLE bytecode from
8001 @file{foo.o} and @file{bar.o}, merges the two files into a single
8002 internal image, and compiles the result as usual. Since both
8003 @file{foo.o} and @file{bar.o} are merged into a single image, this
8004 causes all the interprocedural analyses and optimizations in GCC to
8005 work across the two files as if they were a single one. This means,
8006 for example, that the inliner is able to inline functions in
8007 @file{bar.o} into functions in @file{foo.o} and vice-versa.
8008
8009 Another (simpler) way to enable link-time optimization is:
8010
8011 @smallexample
8012 gcc -o myprog -flto -O2 foo.c bar.c
8013 @end smallexample
8014
8015 The above generates bytecode for @file{foo.c} and @file{bar.c},
8016 merges them together into a single GIMPLE representation and optimizes
8017 them as usual to produce @file{myprog}.
8018
8019 The only important thing to keep in mind is that to enable link-time
8020 optimizations you need to use the GCC driver to perform the link step.
8021 GCC then automatically performs link-time optimization if any of the
8022 objects involved were compiled with the @option{-flto} command-line option.
8023 You generally
8024 should specify the optimization options to be used for link-time
8025 optimization though GCC tries to be clever at guessing an
8026 optimization level to use from the options used at compile time
8027 if you fail to specify one at link time. You can always override
8028 the automatic decision to do link-time optimization at link time
8029 by passing @option{-fno-lto} to the link command.
8030
8031 To make whole program optimization effective, it is necessary to make
8032 certain whole program assumptions. The compiler needs to know
8033 what functions and variables can be accessed by libraries and runtime
8034 outside of the link-time optimized unit. When supported by the linker,
8035 the linker plugin (see @option{-fuse-linker-plugin}) passes information
8036 to the compiler about used and externally visible symbols. When
8037 the linker plugin is not available, @option{-fwhole-program} should be
8038 used to allow the compiler to make these assumptions, which leads
8039 to more aggressive optimization decisions.
8040
8041 When @option{-fuse-linker-plugin} is not enabled, when a file is
8042 compiled with @option{-flto}, the generated object file is larger than
8043 a regular object file because it contains GIMPLE bytecodes and the usual
8044 final code (see @option{-ffat-lto-objects}. This means that
8045 object files with LTO information can be linked as normal object
8046 files; if @option{-fno-lto} is passed to the linker, no
8047 interprocedural optimizations are applied. Note that when
8048 @option{-fno-fat-lto-objects} is enabled the compile stage is faster
8049 but you cannot perform a regular, non-LTO link on them.
8050
8051 Additionally, the optimization flags used to compile individual files
8052 are not necessarily related to those used at link time. For instance,
8053
8054 @smallexample
8055 gcc -c -O0 -ffat-lto-objects -flto foo.c
8056 gcc -c -O0 -ffat-lto-objects -flto bar.c
8057 gcc -o myprog -O3 foo.o bar.o
8058 @end smallexample
8059
8060 This produces individual object files with unoptimized assembler
8061 code, but the resulting binary @file{myprog} is optimized at
8062 @option{-O3}. If, instead, the final binary is generated with
8063 @option{-fno-lto}, then @file{myprog} is not optimized.
8064
8065 When producing the final binary, GCC only
8066 applies link-time optimizations to those files that contain bytecode.
8067 Therefore, you can mix and match object files and libraries with
8068 GIMPLE bytecodes and final object code. GCC automatically selects
8069 which files to optimize in LTO mode and which files to link without
8070 further processing.
8071
8072 There are some code generation flags preserved by GCC when
8073 generating bytecodes, as they need to be used during the final link
8074 stage. Generally options specified at link time override those
8075 specified at compile time.
8076
8077 If you do not specify an optimization level option @option{-O} at
8078 link time, then GCC uses the highest optimization level
8079 used when compiling the object files.
8080
8081 Currently, the following options and their settings are taken from
8082 the first object file that explicitly specifies them:
8083 @option{-fPIC}, @option{-fpic}, @option{-fpie}, @option{-fcommon},
8084 @option{-fexceptions}, @option{-fnon-call-exceptions}, @option{-fgnu-tm}
8085 and all the @option{-m} target flags.
8086
8087 Certain ABI-changing flags are required to match in all compilation units,
8088 and trying to override this at link time with a conflicting value
8089 is ignored. This includes options such as @option{-freg-struct-return}
8090 and @option{-fpcc-struct-return}.
8091
8092 Other options such as @option{-ffp-contract}, @option{-fno-strict-overflow},
8093 @option{-fwrapv}, @option{-fno-trapv} or @option{-fno-strict-aliasing}
8094 are passed through to the link stage and merged conservatively for
8095 conflicting translation units. Specifically
8096 @option{-fno-strict-overflow}, @option{-fwrapv} and @option{-fno-trapv} take
8097 precedence; and for example @option{-ffp-contract=off} takes precedence
8098 over @option{-ffp-contract=fast}. You can override them at link time.
8099
8100 If LTO encounters objects with C linkage declared with incompatible
8101 types in separate translation units to be linked together (undefined
8102 behavior according to ISO C99 6.2.7), a non-fatal diagnostic may be
8103 issued. The behavior is still undefined at run time. Similar
8104 diagnostics may be raised for other languages.
8105
8106 Another feature of LTO is that it is possible to apply interprocedural
8107 optimizations on files written in different languages:
8108
8109 @smallexample
8110 gcc -c -flto foo.c
8111 g++ -c -flto bar.cc
8112 gfortran -c -flto baz.f90
8113 g++ -o myprog -flto -O3 foo.o bar.o baz.o -lgfortran
8114 @end smallexample
8115
8116 Notice that the final link is done with @command{g++} to get the C++
8117 runtime libraries and @option{-lgfortran} is added to get the Fortran
8118 runtime libraries. In general, when mixing languages in LTO mode, you
8119 should use the same link command options as when mixing languages in a
8120 regular (non-LTO) compilation.
8121
8122 If object files containing GIMPLE bytecode are stored in a library archive, say
8123 @file{libfoo.a}, it is possible to extract and use them in an LTO link if you
8124 are using a linker with plugin support. To create static libraries suitable
8125 for LTO, use @command{gcc-ar} and @command{gcc-ranlib} instead of @command{ar}
8126 and @command{ranlib};
8127 to show the symbols of object files with GIMPLE bytecode, use
8128 @command{gcc-nm}. Those commands require that @command{ar}, @command{ranlib}
8129 and @command{nm} have been compiled with plugin support. At link time, use the the
8130 flag @option{-fuse-linker-plugin} to ensure that the library participates in
8131 the LTO optimization process:
8132
8133 @smallexample
8134 gcc -o myprog -O2 -flto -fuse-linker-plugin a.o b.o -lfoo
8135 @end smallexample
8136
8137 With the linker plugin enabled, the linker extracts the needed
8138 GIMPLE files from @file{libfoo.a} and passes them on to the running GCC
8139 to make them part of the aggregated GIMPLE image to be optimized.
8140
8141 If you are not using a linker with plugin support and/or do not
8142 enable the linker plugin, then the objects inside @file{libfoo.a}
8143 are extracted and linked as usual, but they do not participate
8144 in the LTO optimization process. In order to make a static library suitable
8145 for both LTO optimization and usual linkage, compile its object files with
8146 @option{-flto} @option{-ffat-lto-objects}.
8147
8148 Link-time optimizations do not require the presence of the whole program to
8149 operate. If the program does not require any symbols to be exported, it is
8150 possible to combine @option{-flto} and @option{-fwhole-program} to allow
8151 the interprocedural optimizers to use more aggressive assumptions which may
8152 lead to improved optimization opportunities.
8153 Use of @option{-fwhole-program} is not needed when linker plugin is
8154 active (see @option{-fuse-linker-plugin}).
8155
8156 The current implementation of LTO makes no
8157 attempt to generate bytecode that is portable between different
8158 types of hosts. The bytecode files are versioned and there is a
8159 strict version check, so bytecode files generated in one version of
8160 GCC do not work with an older or newer version of GCC.
8161
8162 Link-time optimization does not work well with generation of debugging
8163 information. Combining @option{-flto} with
8164 @option{-g} is currently experimental and expected to produce unexpected
8165 results.
8166
8167 If you specify the optional @var{n}, the optimization and code
8168 generation done at link time is executed in parallel using @var{n}
8169 parallel jobs by utilizing an installed @command{make} program. The
8170 environment variable @env{MAKE} may be used to override the program
8171 used. The default value for @var{n} is 1.
8172
8173 You can also specify @option{-flto=jobserver} to use GNU make's
8174 job server mode to determine the number of parallel jobs. This
8175 is useful when the Makefile calling GCC is already executing in parallel.
8176 You must prepend a @samp{+} to the command recipe in the parent Makefile
8177 for this to work. This option likely only works if @env{MAKE} is
8178 GNU make.
8179
8180 @item -flto-partition=@var{alg}
8181 @opindex flto-partition
8182 Specify the partitioning algorithm used by the link-time optimizer.
8183 The value is either @samp{1to1} to specify a partitioning mirroring
8184 the original source files or @samp{balanced} to specify partitioning
8185 into equally sized chunks (whenever possible) or @samp{max} to create
8186 new partition for every symbol where possible. Specifying @samp{none}
8187 as an algorithm disables partitioning and streaming completely.
8188 The default value is @samp{balanced}. While @samp{1to1} can be used
8189 as an workaround for various code ordering issues, the @samp{max}
8190 partitioning is intended for internal testing only.
8191 The value @samp{one} specifies that exactly one partition should be
8192 used while the value @samp{none} bypasses partitioning and executes
8193 the link-time optimization step directly from the WPA phase.
8194
8195 @item -flto-odr-type-merging
8196 @opindex flto-odr-type-merging
8197 Enable streaming of mangled types names of C++ types and their unification
8198 at link time. This increases size of LTO object files, but enables
8199 diagnostics about One Definition Rule violations.
8200
8201 @item -flto-compression-level=@var{n}
8202 @opindex flto-compression-level
8203 This option specifies the level of compression used for intermediate
8204 language written to LTO object files, and is only meaningful in
8205 conjunction with LTO mode (@option{-flto}). Valid
8206 values are 0 (no compression) to 9 (maximum compression). Values
8207 outside this range are clamped to either 0 or 9. If the option is not
8208 given, a default balanced compression setting is used.
8209
8210 @item -fuse-linker-plugin
8211 @opindex fuse-linker-plugin
8212 Enables the use of a linker plugin during link-time optimization. This
8213 option relies on plugin support in the linker, which is available in gold
8214 or in GNU ld 2.21 or newer.
8215
8216 This option enables the extraction of object files with GIMPLE bytecode out
8217 of library archives. This improves the quality of optimization by exposing
8218 more code to the link-time optimizer. This information specifies what
8219 symbols can be accessed externally (by non-LTO object or during dynamic
8220 linking). Resulting code quality improvements on binaries (and shared
8221 libraries that use hidden visibility) are similar to @option{-fwhole-program}.
8222 See @option{-flto} for a description of the effect of this flag and how to
8223 use it.
8224
8225 This option is enabled by default when LTO support in GCC is enabled
8226 and GCC was configured for use with
8227 a linker supporting plugins (GNU ld 2.21 or newer or gold).
8228
8229 @item -ffat-lto-objects
8230 @opindex ffat-lto-objects
8231 Fat LTO objects are object files that contain both the intermediate language
8232 and the object code. This makes them usable for both LTO linking and normal
8233 linking. This option is effective only when compiling with @option{-flto}
8234 and is ignored at link time.
8235
8236 @option{-fno-fat-lto-objects} improves compilation time over plain LTO, but
8237 requires the complete toolchain to be aware of LTO. It requires a linker with
8238 linker plugin support for basic functionality. Additionally,
8239 @command{nm}, @command{ar} and @command{ranlib}
8240 need to support linker plugins to allow a full-featured build environment
8241 (capable of building static libraries etc). GCC provides the @command{gcc-ar},
8242 @command{gcc-nm}, @command{gcc-ranlib} wrappers to pass the right options
8243 to these tools. With non fat LTO makefiles need to be modified to use them.
8244
8245 The default is @option{-fno-fat-lto-objects} on targets with linker plugin
8246 support.
8247
8248 @item -fcompare-elim
8249 @opindex fcompare-elim
8250 After register allocation and post-register allocation instruction splitting,
8251 identify arithmetic instructions that compute processor flags similar to a
8252 comparison operation based on that arithmetic. If possible, eliminate the
8253 explicit comparison operation.
8254
8255 This pass only applies to certain targets that cannot explicitly represent
8256 the comparison operation before register allocation is complete.
8257
8258 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
8259
8260 @item -fcprop-registers
8261 @opindex fcprop-registers
8262 After register allocation and post-register allocation instruction splitting,
8263 perform a copy-propagation pass to try to reduce scheduling dependencies
8264 and occasionally eliminate the copy.
8265
8266 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
8267
8268 @item -fprofile-correction
8269 @opindex fprofile-correction
8270 Profiles collected using an instrumented binary for multi-threaded programs may
8271 be inconsistent due to missed counter updates. When this option is specified,
8272 GCC uses heuristics to correct or smooth out such inconsistencies. By
8273 default, GCC emits an error message when an inconsistent profile is detected.
8274
8275 @item -fprofile-use
8276 @itemx -fprofile-use=@var{path}
8277 @opindex fprofile-use
8278 Enable profile feedback-directed optimizations,
8279 and the following optimizations
8280 which are generally profitable only with profile feedback available:
8281 @option{-fbranch-probabilities}, @option{-fvpt},
8282 @option{-funroll-loops}, @option{-fpeel-loops}, @option{-ftracer},
8283 @option{-ftree-vectorize}, and @option{ftree-loop-distribute-patterns}.
8284
8285 Before you can use this option, you must first generate profiling information.
8286 @xref{Optimize Options}, for information about the @option{-fprofile-generate}
8287 option.
8288
8289 By default, GCC emits an error message if the feedback profiles do not
8290 match the source code. This error can be turned into a warning by using
8291 @option{-Wcoverage-mismatch}. Note this may result in poorly optimized
8292 code.
8293
8294 If @var{path} is specified, GCC looks at the @var{path} to find
8295 the profile feedback data files. See @option{-fprofile-dir}.
8296
8297 @item -fauto-profile
8298 @itemx -fauto-profile=@var{path}
8299 @opindex fauto-profile
8300 Enable sampling-based feedback-directed optimizations,
8301 and the following optimizations
8302 which are generally profitable only with profile feedback available:
8303 @option{-fbranch-probabilities}, @option{-fvpt},
8304 @option{-funroll-loops}, @option{-fpeel-loops}, @option{-ftracer},
8305 @option{-ftree-vectorize},
8306 @option{-finline-functions}, @option{-fipa-cp}, @option{-fipa-cp-clone},
8307 @option{-fpredictive-commoning}, @option{-funswitch-loops},
8308 @option{-fgcse-after-reload}, and @option{-ftree-loop-distribute-patterns}.
8309
8310 @var{path} is the name of a file containing AutoFDO profile information.
8311 If omitted, it defaults to @file{fbdata.afdo} in the current directory.
8312
8313 Producing an AutoFDO profile data file requires running your program
8314 with the @command{perf} utility on a supported GNU/Linux target system.
8315 For more information, see @uref{https://perf.wiki.kernel.org/}.
8316
8317 E.g.
8318 @smallexample
8319 perf record -e br_inst_retired:near_taken -b -o perf.data \
8320 -- your_program
8321 @end smallexample
8322
8323 Then use the @command{create_gcov} tool to convert the raw profile data
8324 to a format that can be used by GCC.@ You must also supply the
8325 unstripped binary for your program to this tool.
8326 See @uref{https://github.com/google/autofdo}.
8327
8328 E.g.
8329 @smallexample
8330 create_gcov --binary=your_program.unstripped --profile=perf.data \
8331 --gcov=profile.afdo
8332 @end smallexample
8333 @end table
8334
8335 The following options control compiler behavior regarding floating-point
8336 arithmetic. These options trade off between speed and
8337 correctness. All must be specifically enabled.
8338
8339 @table @gcctabopt
8340 @item -ffloat-store
8341 @opindex ffloat-store
8342 Do not store floating-point variables in registers, and inhibit other
8343 options that might change whether a floating-point value is taken from a
8344 register or memory.
8345
8346 @cindex floating-point precision
8347 This option prevents undesirable excess precision on machines such as
8348 the 68000 where the floating registers (of the 68881) keep more
8349 precision than a @code{double} is supposed to have. Similarly for the
8350 x86 architecture. For most programs, the excess precision does only
8351 good, but a few programs rely on the precise definition of IEEE floating
8352 point. Use @option{-ffloat-store} for such programs, after modifying
8353 them to store all pertinent intermediate computations into variables.
8354
8355 @item -fexcess-precision=@var{style}
8356 @opindex fexcess-precision
8357 This option allows further control over excess precision on machines
8358 where floating-point registers have more precision than the IEEE
8359 @code{float} and @code{double} types and the processor does not
8360 support operations rounding to those types. By default,
8361 @option{-fexcess-precision=fast} is in effect; this means that
8362 operations are carried out in the precision of the registers and that
8363 it is unpredictable when rounding to the types specified in the source
8364 code takes place. When compiling C, if
8365 @option{-fexcess-precision=standard} is specified then excess
8366 precision follows the rules specified in ISO C99; in particular,
8367 both casts and assignments cause values to be rounded to their
8368 semantic types (whereas @option{-ffloat-store} only affects
8369 assignments). This option is enabled by default for C if a strict
8370 conformance option such as @option{-std=c99} is used.
8371
8372 @opindex mfpmath
8373 @option{-fexcess-precision=standard} is not implemented for languages
8374 other than C, and has no effect if
8375 @option{-funsafe-math-optimizations} or @option{-ffast-math} is
8376 specified. On the x86, it also has no effect if @option{-mfpmath=sse}
8377 or @option{-mfpmath=sse+387} is specified; in the former case, IEEE
8378 semantics apply without excess precision, and in the latter, rounding
8379 is unpredictable.
8380
8381 @item -ffast-math
8382 @opindex ffast-math
8383 Sets the options @option{-fno-math-errno}, @option{-funsafe-math-optimizations},
8384 @option{-ffinite-math-only}, @option{-fno-rounding-math},
8385 @option{-fno-signaling-nans} and @option{-fcx-limited-range}.
8386
8387 This option causes the preprocessor macro @code{__FAST_MATH__} to be defined.
8388
8389 This option is not turned on by any @option{-O} option besides
8390 @option{-Ofast} since it can result in incorrect output for programs
8391 that depend on an exact implementation of IEEE or ISO rules/specifications
8392 for math functions. It may, however, yield faster code for programs
8393 that do not require the guarantees of these specifications.
8394
8395 @item -fno-math-errno
8396 @opindex fno-math-errno
8397 Do not set @code{errno} after calling math functions that are executed
8398 with a single instruction, e.g., @code{sqrt}. A program that relies on
8399 IEEE exceptions for math error handling may want to use this flag
8400 for speed while maintaining IEEE arithmetic compatibility.
8401
8402 This option is not turned on by any @option{-O} option since
8403 it can result in incorrect output for programs that depend on
8404 an exact implementation of IEEE or ISO rules/specifications for
8405 math functions. It may, however, yield faster code for programs
8406 that do not require the guarantees of these specifications.
8407
8408 The default is @option{-fmath-errno}.
8409
8410 On Darwin systems, the math library never sets @code{errno}. There is
8411 therefore no reason for the compiler to consider the possibility that
8412 it might, and @option{-fno-math-errno} is the default.
8413
8414 @item -funsafe-math-optimizations
8415 @opindex funsafe-math-optimizations
8416
8417 Allow optimizations for floating-point arithmetic that (a) assume
8418 that arguments and results are valid and (b) may violate IEEE or
8419 ANSI standards. When used at link time, it may include libraries
8420 or startup files that change the default FPU control word or other
8421 similar optimizations.
8422
8423 This option is not turned on by any @option{-O} option since
8424 it can result in incorrect output for programs that depend on
8425 an exact implementation of IEEE or ISO rules/specifications for
8426 math functions. It may, however, yield faster code for programs
8427 that do not require the guarantees of these specifications.
8428 Enables @option{-fno-signed-zeros}, @option{-fno-trapping-math},
8429 @option{-fassociative-math} and @option{-freciprocal-math}.
8430
8431 The default is @option{-fno-unsafe-math-optimizations}.
8432
8433 @item -fassociative-math
8434 @opindex fassociative-math
8435
8436 Allow re-association of operands in series of floating-point operations.
8437 This violates the ISO C and C++ language standard by possibly changing
8438 computation result. NOTE: re-ordering may change the sign of zero as
8439 well as ignore NaNs and inhibit or create underflow or overflow (and
8440 thus cannot be used on code that relies on rounding behavior like
8441 @code{(x + 2**52) - 2**52}. May also reorder floating-point comparisons
8442 and thus may not be used when ordered comparisons are required.
8443 This option requires that both @option{-fno-signed-zeros} and
8444 @option{-fno-trapping-math} be in effect. Moreover, it doesn't make
8445 much sense with @option{-frounding-math}. For Fortran the option
8446 is automatically enabled when both @option{-fno-signed-zeros} and
8447 @option{-fno-trapping-math} are in effect.
8448
8449 The default is @option{-fno-associative-math}.
8450
8451 @item -freciprocal-math
8452 @opindex freciprocal-math
8453
8454 Allow the reciprocal of a value to be used instead of dividing by
8455 the value if this enables optimizations. For example @code{x / y}
8456 can be replaced with @code{x * (1/y)}, which is useful if @code{(1/y)}
8457 is subject to common subexpression elimination. Note that this loses
8458 precision and increases the number of flops operating on the value.
8459
8460 The default is @option{-fno-reciprocal-math}.
8461
8462 @item -ffinite-math-only
8463 @opindex ffinite-math-only
8464 Allow optimizations for floating-point arithmetic that assume
8465 that arguments and results are not NaNs or +-Infs.
8466
8467 This option is not turned on by any @option{-O} option since
8468 it can result in incorrect output for programs that depend on
8469 an exact implementation of IEEE or ISO rules/specifications for
8470 math functions. It may, however, yield faster code for programs
8471 that do not require the guarantees of these specifications.
8472
8473 The default is @option{-fno-finite-math-only}.
8474
8475 @item -fno-signed-zeros
8476 @opindex fno-signed-zeros
8477 Allow optimizations for floating-point arithmetic that ignore the
8478 signedness of zero. IEEE arithmetic specifies the behavior of
8479 distinct +0.0 and @minus{}0.0 values, which then prohibits simplification
8480 of expressions such as x+0.0 or 0.0*x (even with @option{-ffinite-math-only}).
8481 This option implies that the sign of a zero result isn't significant.
8482
8483 The default is @option{-fsigned-zeros}.
8484
8485 @item -fno-trapping-math
8486 @opindex fno-trapping-math
8487 Compile code assuming that floating-point operations cannot generate
8488 user-visible traps. These traps include division by zero, overflow,
8489 underflow, inexact result and invalid operation. This option requires
8490 that @option{-fno-signaling-nans} be in effect. Setting this option may
8491 allow faster code if one relies on ``non-stop'' IEEE arithmetic, for example.
8492
8493 This option should never be turned on by any @option{-O} option since
8494 it can result in incorrect output for programs that depend on
8495 an exact implementation of IEEE or ISO rules/specifications for
8496 math functions.
8497
8498 The default is @option{-ftrapping-math}.
8499
8500 @item -frounding-math
8501 @opindex frounding-math
8502 Disable transformations and optimizations that assume default floating-point
8503 rounding behavior. This is round-to-zero for all floating point
8504 to integer conversions, and round-to-nearest for all other arithmetic
8505 truncations. This option should be specified for programs that change
8506 the FP rounding mode dynamically, or that may be executed with a
8507 non-default rounding mode. This option disables constant folding of
8508 floating-point expressions at compile time (which may be affected by
8509 rounding mode) and arithmetic transformations that are unsafe in the
8510 presence of sign-dependent rounding modes.
8511
8512 The default is @option{-fno-rounding-math}.
8513
8514 This option is experimental and does not currently guarantee to
8515 disable all GCC optimizations that are affected by rounding mode.
8516 Future versions of GCC may provide finer control of this setting
8517 using C99's @code{FENV_ACCESS} pragma. This command-line option
8518 will be used to specify the default state for @code{FENV_ACCESS}.
8519
8520 @item -fsignaling-nans
8521 @opindex fsignaling-nans
8522 Compile code assuming that IEEE signaling NaNs may generate user-visible
8523 traps during floating-point operations. Setting this option disables
8524 optimizations that may change the number of exceptions visible with
8525 signaling NaNs. This option implies @option{-ftrapping-math}.
8526
8527 This option causes the preprocessor macro @code{__SUPPORT_SNAN__} to
8528 be defined.
8529
8530 The default is @option{-fno-signaling-nans}.
8531
8532 This option is experimental and does not currently guarantee to
8533 disable all GCC optimizations that affect signaling NaN behavior.
8534
8535 @item -fsingle-precision-constant
8536 @opindex fsingle-precision-constant
8537 Treat floating-point constants as single precision instead of
8538 implicitly converting them to double-precision constants.
8539
8540 @item -fcx-limited-range
8541 @opindex fcx-limited-range
8542 When enabled, this option states that a range reduction step is not
8543 needed when performing complex division. Also, there is no checking
8544 whether the result of a complex multiplication or division is @code{NaN
8545 + I*NaN}, with an attempt to rescue the situation in that case. The
8546 default is @option{-fno-cx-limited-range}, but is enabled by
8547 @option{-ffast-math}.
8548
8549 This option controls the default setting of the ISO C99
8550 @code{CX_LIMITED_RANGE} pragma. Nevertheless, the option applies to
8551 all languages.
8552
8553 @item -fcx-fortran-rules
8554 @opindex fcx-fortran-rules
8555 Complex multiplication and division follow Fortran rules. Range
8556 reduction is done as part of complex division, but there is no checking
8557 whether the result of a complex multiplication or division is @code{NaN
8558 + I*NaN}, with an attempt to rescue the situation in that case.
8559
8560 The default is @option{-fno-cx-fortran-rules}.
8561
8562 @end table
8563
8564 The following options control optimizations that may improve
8565 performance, but are not enabled by any @option{-O} options. This
8566 section includes experimental options that may produce broken code.
8567
8568 @table @gcctabopt
8569 @item -fbranch-probabilities
8570 @opindex fbranch-probabilities
8571 After running a program compiled with @option{-fprofile-arcs}
8572 (@pxref{Instrumentation Options}),
8573 you can compile it a second time using
8574 @option{-fbranch-probabilities}, to improve optimizations based on
8575 the number of times each branch was taken. When a program
8576 compiled with @option{-fprofile-arcs} exits, it saves arc execution
8577 counts to a file called @file{@var{sourcename}.gcda} for each source
8578 file. The information in this data file is very dependent on the
8579 structure of the generated code, so you must use the same source code
8580 and the same optimization options for both compilations.
8581
8582 With @option{-fbranch-probabilities}, GCC puts a
8583 @samp{REG_BR_PROB} note on each @samp{JUMP_INSN} and @samp{CALL_INSN}.
8584 These can be used to improve optimization. Currently, they are only
8585 used in one place: in @file{reorg.c}, instead of guessing which path a
8586 branch is most likely to take, the @samp{REG_BR_PROB} values are used to
8587 exactly determine which path is taken more often.
8588
8589 @item -fprofile-values
8590 @opindex fprofile-values
8591 If combined with @option{-fprofile-arcs}, it adds code so that some
8592 data about values of expressions in the program is gathered.
8593
8594 With @option{-fbranch-probabilities}, it reads back the data gathered
8595 from profiling values of expressions for usage in optimizations.
8596
8597 Enabled with @option{-fprofile-generate} and @option{-fprofile-use}.
8598
8599 @item -fprofile-reorder-functions
8600 @opindex fprofile-reorder-functions
8601 Function reordering based on profile instrumentation collects
8602 first time of execution of a function and orders these functions
8603 in ascending order.
8604
8605 Enabled with @option{-fprofile-use}.
8606
8607 @item -fvpt
8608 @opindex fvpt
8609 If combined with @option{-fprofile-arcs}, this option instructs the compiler
8610 to add code to gather information about values of expressions.
8611
8612 With @option{-fbranch-probabilities}, it reads back the data gathered
8613 and actually performs the optimizations based on them.
8614 Currently the optimizations include specialization of division operations
8615 using the knowledge about the value of the denominator.
8616
8617 @item -frename-registers
8618 @opindex frename-registers
8619 Attempt to avoid false dependencies in scheduled code by making use
8620 of registers left over after register allocation. This optimization
8621 most benefits processors with lots of registers. Depending on the
8622 debug information format adopted by the target, however, it can
8623 make debugging impossible, since variables no longer stay in
8624 a ``home register''.
8625
8626 Enabled by default with @option{-funroll-loops} and @option{-fpeel-loops}.
8627
8628 @item -fschedule-fusion
8629 @opindex fschedule-fusion
8630 Performs a target dependent pass over the instruction stream to schedule
8631 instructions of same type together because target machine can execute them
8632 more efficiently if they are adjacent to each other in the instruction flow.
8633
8634 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8635
8636 @item -ftracer
8637 @opindex ftracer
8638 Perform tail duplication to enlarge superblock size. This transformation
8639 simplifies the control flow of the function allowing other optimizations to do
8640 a better job.
8641
8642 Enabled with @option{-fprofile-use}.
8643
8644 @item -funroll-loops
8645 @opindex funroll-loops
8646 Unroll loops whose number of iterations can be determined at compile time or
8647 upon entry to the loop. @option{-funroll-loops} implies
8648 @option{-frerun-cse-after-loop}, @option{-fweb} and @option{-frename-registers}.
8649 It also turns on complete loop peeling (i.e.@: complete removal of loops with
8650 a small constant number of iterations). This option makes code larger, and may
8651 or may not make it run faster.
8652
8653 Enabled with @option{-fprofile-use}.
8654
8655 @item -funroll-all-loops
8656 @opindex funroll-all-loops
8657 Unroll all loops, even if their number of iterations is uncertain when
8658 the loop is entered. This usually makes programs run more slowly.
8659 @option{-funroll-all-loops} implies the same options as
8660 @option{-funroll-loops}.
8661
8662 @item -fpeel-loops
8663 @opindex fpeel-loops
8664 Peels loops for which there is enough information that they do not
8665 roll much (from profile feedback or static analysis). It also turns on
8666 complete loop peeling (i.e.@: complete removal of loops with small constant
8667 number of iterations).
8668
8669 Enabled with @option{-O3} and/or @option{-fprofile-use}.
8670
8671 @item -fmove-loop-invariants
8672 @opindex fmove-loop-invariants
8673 Enables the loop invariant motion pass in the RTL loop optimizer. Enabled
8674 at level @option{-O1}
8675
8676 @item -funswitch-loops
8677 @opindex funswitch-loops
8678 Move branches with loop invariant conditions out of the loop, with duplicates
8679 of the loop on both branches (modified according to result of the condition).
8680
8681 @item -ffunction-sections
8682 @itemx -fdata-sections
8683 @opindex ffunction-sections
8684 @opindex fdata-sections
8685 Place each function or data item into its own section in the output
8686 file if the target supports arbitrary sections. The name of the
8687 function or the name of the data item determines the section's name
8688 in the output file.
8689
8690 Use these options on systems where the linker can perform optimizations
8691 to improve locality of reference in the instruction space. Most systems
8692 using the ELF object format and SPARC processors running Solaris 2 have
8693 linkers with such optimizations. AIX may have these optimizations in
8694 the future.
8695
8696 Only use these options when there are significant benefits from doing
8697 so. When you specify these options, the assembler and linker
8698 create larger object and executable files and are also slower.
8699 You cannot use @command{gprof} on all systems if you
8700 specify this option, and you may have problems with debugging if
8701 you specify both this option and @option{-g}.
8702
8703 @item -fbranch-target-load-optimize
8704 @opindex fbranch-target-load-optimize
8705 Perform branch target register load optimization before prologue / epilogue
8706 threading.
8707 The use of target registers can typically be exposed only during reload,
8708 thus hoisting loads out of loops and doing inter-block scheduling needs
8709 a separate optimization pass.
8710
8711 @item -fbranch-target-load-optimize2
8712 @opindex fbranch-target-load-optimize2
8713 Perform branch target register load optimization after prologue / epilogue
8714 threading.
8715
8716 @item -fbtr-bb-exclusive
8717 @opindex fbtr-bb-exclusive
8718 When performing branch target register load optimization, don't reuse
8719 branch target registers within any basic block.
8720
8721 @item -fstdarg-opt
8722 @opindex fstdarg-opt
8723 Optimize the prologue of variadic argument functions with respect to usage of
8724 those arguments.
8725
8726 @item -fsection-anchors
8727 @opindex fsection-anchors
8728 Try to reduce the number of symbolic address calculations by using
8729 shared ``anchor'' symbols to address nearby objects. This transformation
8730 can help to reduce the number of GOT entries and GOT accesses on some
8731 targets.
8732
8733 For example, the implementation of the following function @code{foo}:
8734
8735 @smallexample
8736 static int a, b, c;
8737 int foo (void) @{ return a + b + c; @}
8738 @end smallexample
8739
8740 @noindent
8741 usually calculates the addresses of all three variables, but if you
8742 compile it with @option{-fsection-anchors}, it accesses the variables
8743 from a common anchor point instead. The effect is similar to the
8744 following pseudocode (which isn't valid C):
8745
8746 @smallexample
8747 int foo (void)
8748 @{
8749 register int *xr = &x;
8750 return xr[&a - &x] + xr[&b - &x] + xr[&c - &x];
8751 @}
8752 @end smallexample
8753
8754 Not all targets support this option.
8755
8756 @item --param @var{name}=@var{value}
8757 @opindex param
8758 In some places, GCC uses various constants to control the amount of
8759 optimization that is done. For example, GCC does not inline functions
8760 that contain more than a certain number of instructions. You can
8761 control some of these constants on the command line using the
8762 @option{--param} option.
8763
8764 The names of specific parameters, and the meaning of the values, are
8765 tied to the internals of the compiler, and are subject to change
8766 without notice in future releases.
8767
8768 In each case, the @var{value} is an integer. The allowable choices for
8769 @var{name} are:
8770
8771 @table @gcctabopt
8772 @item predictable-branch-outcome
8773 When branch is predicted to be taken with probability lower than this threshold
8774 (in percent), then it is considered well predictable. The default is 10.
8775
8776 @item max-rtl-if-conversion-insns
8777 RTL if-conversion tries to remove conditional branches around a block and
8778 replace them with conditionally executed instructions. This parameter
8779 gives the maximum number of instructions in a block which should be
8780 considered for if-conversion. The default is 10, though the compiler will
8781 also use other heuristics to decide whether if-conversion is likely to be
8782 profitable.
8783
8784 @item max-crossjump-edges
8785 The maximum number of incoming edges to consider for cross-jumping.
8786 The algorithm used by @option{-fcrossjumping} is @math{O(N^2)} in
8787 the number of edges incoming to each block. Increasing values mean
8788 more aggressive optimization, making the compilation time increase with
8789 probably small improvement in executable size.
8790
8791 @item min-crossjump-insns
8792 The minimum number of instructions that must be matched at the end
8793 of two blocks before cross-jumping is performed on them. This
8794 value is ignored in the case where all instructions in the block being
8795 cross-jumped from are matched. The default value is 5.
8796
8797 @item max-grow-copy-bb-insns
8798 The maximum code size expansion factor when copying basic blocks
8799 instead of jumping. The expansion is relative to a jump instruction.
8800 The default value is 8.
8801
8802 @item max-goto-duplication-insns
8803 The maximum number of instructions to duplicate to a block that jumps
8804 to a computed goto. To avoid @math{O(N^2)} behavior in a number of
8805 passes, GCC factors computed gotos early in the compilation process,
8806 and unfactors them as late as possible. Only computed jumps at the
8807 end of a basic blocks with no more than max-goto-duplication-insns are
8808 unfactored. The default value is 8.
8809
8810 @item max-delay-slot-insn-search
8811 The maximum number of instructions to consider when looking for an
8812 instruction to fill a delay slot. If more than this arbitrary number of
8813 instructions are searched, the time savings from filling the delay slot
8814 are minimal, so stop searching. Increasing values mean more
8815 aggressive optimization, making the compilation time increase with probably
8816 small improvement in execution time.
8817
8818 @item max-delay-slot-live-search
8819 When trying to fill delay slots, the maximum number of instructions to
8820 consider when searching for a block with valid live register
8821 information. Increasing this arbitrarily chosen value means more
8822 aggressive optimization, increasing the compilation time. This parameter
8823 should be removed when the delay slot code is rewritten to maintain the
8824 control-flow graph.
8825
8826 @item max-gcse-memory
8827 The approximate maximum amount of memory that can be allocated in
8828 order to perform the global common subexpression elimination
8829 optimization. If more memory than specified is required, the
8830 optimization is not done.
8831
8832 @item max-gcse-insertion-ratio
8833 If the ratio of expression insertions to deletions is larger than this value
8834 for any expression, then RTL PRE inserts or removes the expression and thus
8835 leaves partially redundant computations in the instruction stream. The default value is 20.
8836
8837 @item max-pending-list-length
8838 The maximum number of pending dependencies scheduling allows
8839 before flushing the current state and starting over. Large functions
8840 with few branches or calls can create excessively large lists which
8841 needlessly consume memory and resources.
8842
8843 @item max-modulo-backtrack-attempts
8844 The maximum number of backtrack attempts the scheduler should make
8845 when modulo scheduling a loop. Larger values can exponentially increase
8846 compilation time.
8847
8848 @item max-inline-insns-single
8849 Several parameters control the tree inliner used in GCC@.
8850 This number sets the maximum number of instructions (counted in GCC's
8851 internal representation) in a single function that the tree inliner
8852 considers for inlining. This only affects functions declared
8853 inline and methods implemented in a class declaration (C++).
8854 The default value is 400.
8855
8856 @item max-inline-insns-auto
8857 When you use @option{-finline-functions} (included in @option{-O3}),
8858 a lot of functions that would otherwise not be considered for inlining
8859 by the compiler are investigated. To those functions, a different
8860 (more restrictive) limit compared to functions declared inline can
8861 be applied.
8862 The default value is 40.
8863
8864 @item inline-min-speedup
8865 When estimated performance improvement of caller + callee runtime exceeds this
8866 threshold (in precent), the function can be inlined regardless the limit on
8867 @option{--param max-inline-insns-single} and @option{--param
8868 max-inline-insns-auto}.
8869
8870 @item large-function-insns
8871 The limit specifying really large functions. For functions larger than this
8872 limit after inlining, inlining is constrained by
8873 @option{--param large-function-growth}. This parameter is useful primarily
8874 to avoid extreme compilation time caused by non-linear algorithms used by the
8875 back end.
8876 The default value is 2700.
8877
8878 @item large-function-growth
8879 Specifies maximal growth of large function caused by inlining in percents.
8880 The default value is 100 which limits large function growth to 2.0 times
8881 the original size.
8882
8883 @item large-unit-insns
8884 The limit specifying large translation unit. Growth caused by inlining of
8885 units larger than this limit is limited by @option{--param inline-unit-growth}.
8886 For small units this might be too tight.
8887 For example, consider a unit consisting of function A
8888 that is inline and B that just calls A three times. If B is small relative to
8889 A, the growth of unit is 300\% and yet such inlining is very sane. For very
8890 large units consisting of small inlineable functions, however, the overall unit
8891 growth limit is needed to avoid exponential explosion of code size. Thus for
8892 smaller units, the size is increased to @option{--param large-unit-insns}
8893 before applying @option{--param inline-unit-growth}. The default is 10000.
8894
8895 @item inline-unit-growth
8896 Specifies maximal overall growth of the compilation unit caused by inlining.
8897 The default value is 20 which limits unit growth to 1.2 times the original
8898 size. Cold functions (either marked cold via an attribute or by profile
8899 feedback) are not accounted into the unit size.
8900
8901 @item ipcp-unit-growth
8902 Specifies maximal overall growth of the compilation unit caused by
8903 interprocedural constant propagation. The default value is 10 which limits
8904 unit growth to 1.1 times the original size.
8905
8906 @item large-stack-frame
8907 The limit specifying large stack frames. While inlining the algorithm is trying
8908 to not grow past this limit too much. The default value is 256 bytes.
8909
8910 @item large-stack-frame-growth
8911 Specifies maximal growth of large stack frames caused by inlining in percents.
8912 The default value is 1000 which limits large stack frame growth to 11 times
8913 the original size.
8914
8915 @item max-inline-insns-recursive
8916 @itemx max-inline-insns-recursive-auto
8917 Specifies the maximum number of instructions an out-of-line copy of a
8918 self-recursive inline
8919 function can grow into by performing recursive inlining.
8920
8921 @option{--param max-inline-insns-recursive} applies to functions
8922 declared inline.
8923 For functions not declared inline, recursive inlining
8924 happens only when @option{-finline-functions} (included in @option{-O3}) is
8925 enabled; @option{--param max-inline-insns-recursive-auto} applies instead. The
8926 default value is 450.
8927
8928 @item max-inline-recursive-depth
8929 @itemx max-inline-recursive-depth-auto
8930 Specifies the maximum recursion depth used for recursive inlining.
8931
8932 @option{--param max-inline-recursive-depth} applies to functions
8933 declared inline. For functions not declared inline, recursive inlining
8934 happens only when @option{-finline-functions} (included in @option{-O3}) is
8935 enabled; @option{--param max-inline-recursive-depth-auto} applies instead. The
8936 default value is 8.
8937
8938 @item min-inline-recursive-probability
8939 Recursive inlining is profitable only for function having deep recursion
8940 in average and can hurt for function having little recursion depth by
8941 increasing the prologue size or complexity of function body to other
8942 optimizers.
8943
8944 When profile feedback is available (see @option{-fprofile-generate}) the actual
8945 recursion depth can be guessed from probability that function recurses via a
8946 given call expression. This parameter limits inlining only to call expressions
8947 whose probability exceeds the given threshold (in percents).
8948 The default value is 10.
8949
8950 @item early-inlining-insns
8951 Specify growth that the early inliner can make. In effect it increases
8952 the amount of inlining for code having a large abstraction penalty.
8953 The default value is 14.
8954
8955 @item max-early-inliner-iterations
8956 Limit of iterations of the early inliner. This basically bounds
8957 the number of nested indirect calls the early inliner can resolve.
8958 Deeper chains are still handled by late inlining.
8959
8960 @item comdat-sharing-probability
8961 Probability (in percent) that C++ inline function with comdat visibility
8962 are shared across multiple compilation units. The default value is 20.
8963
8964 @item profile-func-internal-id
8965 A parameter to control whether to use function internal id in profile
8966 database lookup. If the value is 0, the compiler uses an id that
8967 is based on function assembler name and filename, which makes old profile
8968 data more tolerant to source changes such as function reordering etc.
8969 The default value is 0.
8970
8971 @item min-vect-loop-bound
8972 The minimum number of iterations under which loops are not vectorized
8973 when @option{-ftree-vectorize} is used. The number of iterations after
8974 vectorization needs to be greater than the value specified by this option
8975 to allow vectorization. The default value is 0.
8976
8977 @item gcse-cost-distance-ratio
8978 Scaling factor in calculation of maximum distance an expression
8979 can be moved by GCSE optimizations. This is currently supported only in the
8980 code hoisting pass. The bigger the ratio, the more aggressive code hoisting
8981 is with simple expressions, i.e., the expressions that have cost
8982 less than @option{gcse-unrestricted-cost}. Specifying 0 disables
8983 hoisting of simple expressions. The default value is 10.
8984
8985 @item gcse-unrestricted-cost
8986 Cost, roughly measured as the cost of a single typical machine
8987 instruction, at which GCSE optimizations do not constrain
8988 the distance an expression can travel. This is currently
8989 supported only in the code hoisting pass. The lesser the cost,
8990 the more aggressive code hoisting is. Specifying 0
8991 allows all expressions to travel unrestricted distances.
8992 The default value is 3.
8993
8994 @item max-hoist-depth
8995 The depth of search in the dominator tree for expressions to hoist.
8996 This is used to avoid quadratic behavior in hoisting algorithm.
8997 The value of 0 does not limit on the search, but may slow down compilation
8998 of huge functions. The default value is 30.
8999
9000 @item max-tail-merge-comparisons
9001 The maximum amount of similar bbs to compare a bb with. This is used to
9002 avoid quadratic behavior in tree tail merging. The default value is 10.
9003
9004 @item max-tail-merge-iterations
9005 The maximum amount of iterations of the pass over the function. This is used to
9006 limit compilation time in tree tail merging. The default value is 2.
9007
9008 @item max-unrolled-insns
9009 The maximum number of instructions that a loop may have to be unrolled.
9010 If a loop is unrolled, this parameter also determines how many times
9011 the loop code is unrolled.
9012
9013 @item max-average-unrolled-insns
9014 The maximum number of instructions biased by probabilities of their execution
9015 that a loop may have to be unrolled. If a loop is unrolled,
9016 this parameter also determines how many times the loop code is unrolled.
9017
9018 @item max-unroll-times
9019 The maximum number of unrollings of a single loop.
9020
9021 @item max-peeled-insns
9022 The maximum number of instructions that a loop may have to be peeled.
9023 If a loop is peeled, this parameter also determines how many times
9024 the loop code is peeled.
9025
9026 @item max-peel-times
9027 The maximum number of peelings of a single loop.
9028
9029 @item max-peel-branches
9030 The maximum number of branches on the hot path through the peeled sequence.
9031
9032 @item max-completely-peeled-insns
9033 The maximum number of insns of a completely peeled loop.
9034
9035 @item max-completely-peel-times
9036 The maximum number of iterations of a loop to be suitable for complete peeling.
9037
9038 @item max-completely-peel-loop-nest-depth
9039 The maximum depth of a loop nest suitable for complete peeling.
9040
9041 @item max-unswitch-insns
9042 The maximum number of insns of an unswitched loop.
9043
9044 @item max-unswitch-level
9045 The maximum number of branches unswitched in a single loop.
9046
9047 @item lim-expensive
9048 The minimum cost of an expensive expression in the loop invariant motion.
9049
9050 @item iv-consider-all-candidates-bound
9051 Bound on number of candidates for induction variables, below which
9052 all candidates are considered for each use in induction variable
9053 optimizations. If there are more candidates than this,
9054 only the most relevant ones are considered to avoid quadratic time complexity.
9055
9056 @item iv-max-considered-uses
9057 The induction variable optimizations give up on loops that contain more
9058 induction variable uses.
9059
9060 @item iv-always-prune-cand-set-bound
9061 If the number of candidates in the set is smaller than this value,
9062 always try to remove unnecessary ivs from the set
9063 when adding a new one.
9064
9065 @item scev-max-expr-size
9066 Bound on size of expressions used in the scalar evolutions analyzer.
9067 Large expressions slow the analyzer.
9068
9069 @item scev-max-expr-complexity
9070 Bound on the complexity of the expressions in the scalar evolutions analyzer.
9071 Complex expressions slow the analyzer.
9072
9073 @item max-tree-if-conversion-phi-args
9074 Maximum number of arguments in a PHI supported by TREE if conversion
9075 unless the loop is marked with simd pragma.
9076
9077 @item vect-max-version-for-alignment-checks
9078 The maximum number of run-time checks that can be performed when
9079 doing loop versioning for alignment in the vectorizer.
9080
9081 @item vect-max-version-for-alias-checks
9082 The maximum number of run-time checks that can be performed when
9083 doing loop versioning for alias in the vectorizer.
9084
9085 @item vect-max-peeling-for-alignment
9086 The maximum number of loop peels to enhance access alignment
9087 for vectorizer. Value -1 means no limit.
9088
9089 @item max-iterations-to-track
9090 The maximum number of iterations of a loop the brute-force algorithm
9091 for analysis of the number of iterations of the loop tries to evaluate.
9092
9093 @item hot-bb-count-ws-permille
9094 A basic block profile count is considered hot if it contributes to
9095 the given permillage (i.e. 0...1000) of the entire profiled execution.
9096
9097 @item hot-bb-frequency-fraction
9098 Select fraction of the entry block frequency of executions of basic block in
9099 function given basic block needs to have to be considered hot.
9100
9101 @item max-predicted-iterations
9102 The maximum number of loop iterations we predict statically. This is useful
9103 in cases where a function contains a single loop with known bound and
9104 another loop with unknown bound.
9105 The known number of iterations is predicted correctly, while
9106 the unknown number of iterations average to roughly 10. This means that the
9107 loop without bounds appears artificially cold relative to the other one.
9108
9109 @item builtin-expect-probability
9110 Control the probability of the expression having the specified value. This
9111 parameter takes a percentage (i.e. 0 ... 100) as input.
9112 The default probability of 90 is obtained empirically.
9113
9114 @item align-threshold
9115
9116 Select fraction of the maximal frequency of executions of a basic block in
9117 a function to align the basic block.
9118
9119 @item align-loop-iterations
9120
9121 A loop expected to iterate at least the selected number of iterations is
9122 aligned.
9123
9124 @item tracer-dynamic-coverage
9125 @itemx tracer-dynamic-coverage-feedback
9126
9127 This value is used to limit superblock formation once the given percentage of
9128 executed instructions is covered. This limits unnecessary code size
9129 expansion.
9130
9131 The @option{tracer-dynamic-coverage-feedback} parameter
9132 is used only when profile
9133 feedback is available. The real profiles (as opposed to statically estimated
9134 ones) are much less balanced allowing the threshold to be larger value.
9135
9136 @item tracer-max-code-growth
9137 Stop tail duplication once code growth has reached given percentage. This is
9138 a rather artificial limit, as most of the duplicates are eliminated later in
9139 cross jumping, so it may be set to much higher values than is the desired code
9140 growth.
9141
9142 @item tracer-min-branch-ratio
9143
9144 Stop reverse growth when the reverse probability of best edge is less than this
9145 threshold (in percent).
9146
9147 @item tracer-min-branch-probability
9148 @itemx tracer-min-branch-probability-feedback
9149
9150 Stop forward growth if the best edge has probability lower than this
9151 threshold.
9152
9153 Similarly to @option{tracer-dynamic-coverage} two parameters are
9154 provided. @option{tracer-min-branch-probability-feedback} is used for
9155 compilation with profile feedback and @option{tracer-min-branch-probability}
9156 compilation without. The value for compilation with profile feedback
9157 needs to be more conservative (higher) in order to make tracer
9158 effective.
9159
9160 @item max-cse-path-length
9161
9162 The maximum number of basic blocks on path that CSE considers.
9163 The default is 10.
9164
9165 @item max-cse-insns
9166 The maximum number of instructions CSE processes before flushing.
9167 The default is 1000.
9168
9169 @item ggc-min-expand
9170
9171 GCC uses a garbage collector to manage its own memory allocation. This
9172 parameter specifies the minimum percentage by which the garbage
9173 collector's heap should be allowed to expand between collections.
9174 Tuning this may improve compilation speed; it has no effect on code
9175 generation.
9176
9177 The default is 30% + 70% * (RAM/1GB) with an upper bound of 100% when
9178 RAM >= 1GB@. If @code{getrlimit} is available, the notion of ``RAM'' is
9179 the smallest of actual RAM and @code{RLIMIT_DATA} or @code{RLIMIT_AS}. If
9180 GCC is not able to calculate RAM on a particular platform, the lower
9181 bound of 30% is used. Setting this parameter and
9182 @option{ggc-min-heapsize} to zero causes a full collection to occur at
9183 every opportunity. This is extremely slow, but can be useful for
9184 debugging.
9185
9186 @item ggc-min-heapsize
9187
9188 Minimum size of the garbage collector's heap before it begins bothering
9189 to collect garbage. The first collection occurs after the heap expands
9190 by @option{ggc-min-expand}% beyond @option{ggc-min-heapsize}. Again,
9191 tuning this may improve compilation speed, and has no effect on code
9192 generation.
9193
9194 The default is the smaller of RAM/8, RLIMIT_RSS, or a limit that
9195 tries to ensure that RLIMIT_DATA or RLIMIT_AS are not exceeded, but
9196 with a lower bound of 4096 (four megabytes) and an upper bound of
9197 131072 (128 megabytes). If GCC is not able to calculate RAM on a
9198 particular platform, the lower bound is used. Setting this parameter
9199 very large effectively disables garbage collection. Setting this
9200 parameter and @option{ggc-min-expand} to zero causes a full collection
9201 to occur at every opportunity.
9202
9203 @item max-reload-search-insns
9204 The maximum number of instruction reload should look backward for equivalent
9205 register. Increasing values mean more aggressive optimization, making the
9206 compilation time increase with probably slightly better performance.
9207 The default value is 100.
9208
9209 @item max-cselib-memory-locations
9210 The maximum number of memory locations cselib should take into account.
9211 Increasing values mean more aggressive optimization, making the compilation time
9212 increase with probably slightly better performance. The default value is 500.
9213
9214 @item max-sched-ready-insns
9215 The maximum number of instructions ready to be issued the scheduler should
9216 consider at any given time during the first scheduling pass. Increasing
9217 values mean more thorough searches, making the compilation time increase
9218 with probably little benefit. The default value is 100.
9219
9220 @item max-sched-region-blocks
9221 The maximum number of blocks in a region to be considered for
9222 interblock scheduling. The default value is 10.
9223
9224 @item max-pipeline-region-blocks
9225 The maximum number of blocks in a region to be considered for
9226 pipelining in the selective scheduler. The default value is 15.
9227
9228 @item max-sched-region-insns
9229 The maximum number of insns in a region to be considered for
9230 interblock scheduling. The default value is 100.
9231
9232 @item max-pipeline-region-insns
9233 The maximum number of insns in a region to be considered for
9234 pipelining in the selective scheduler. The default value is 200.
9235
9236 @item min-spec-prob
9237 The minimum probability (in percents) of reaching a source block
9238 for interblock speculative scheduling. The default value is 40.
9239
9240 @item max-sched-extend-regions-iters
9241 The maximum number of iterations through CFG to extend regions.
9242 A value of 0 (the default) disables region extensions.
9243
9244 @item max-sched-insn-conflict-delay
9245 The maximum conflict delay for an insn to be considered for speculative motion.
9246 The default value is 3.
9247
9248 @item sched-spec-prob-cutoff
9249 The minimal probability of speculation success (in percents), so that
9250 speculative insns are scheduled.
9251 The default value is 40.
9252
9253 @item sched-state-edge-prob-cutoff
9254 The minimum probability an edge must have for the scheduler to save its
9255 state across it.
9256 The default value is 10.
9257
9258 @item sched-mem-true-dep-cost
9259 Minimal distance (in CPU cycles) between store and load targeting same
9260 memory locations. The default value is 1.
9261
9262 @item selsched-max-lookahead
9263 The maximum size of the lookahead window of selective scheduling. It is a
9264 depth of search for available instructions.
9265 The default value is 50.
9266
9267 @item selsched-max-sched-times
9268 The maximum number of times that an instruction is scheduled during
9269 selective scheduling. This is the limit on the number of iterations
9270 through which the instruction may be pipelined. The default value is 2.
9271
9272 @item selsched-insns-to-rename
9273 The maximum number of best instructions in the ready list that are considered
9274 for renaming in the selective scheduler. The default value is 2.
9275
9276 @item sms-min-sc
9277 The minimum value of stage count that swing modulo scheduler
9278 generates. The default value is 2.
9279
9280 @item max-last-value-rtl
9281 The maximum size measured as number of RTLs that can be recorded in an expression
9282 in combiner for a pseudo register as last known value of that register. The default
9283 is 10000.
9284
9285 @item max-combine-insns
9286 The maximum number of instructions the RTL combiner tries to combine.
9287 The default value is 2 at @option{-Og} and 4 otherwise.
9288
9289 @item integer-share-limit
9290 Small integer constants can use a shared data structure, reducing the
9291 compiler's memory usage and increasing its speed. This sets the maximum
9292 value of a shared integer constant. The default value is 256.
9293
9294 @item ssp-buffer-size
9295 The minimum size of buffers (i.e.@: arrays) that receive stack smashing
9296 protection when @option{-fstack-protection} is used.
9297
9298 @item min-size-for-stack-sharing
9299 The minimum size of variables taking part in stack slot sharing when not
9300 optimizing. The default value is 32.
9301
9302 @item max-jump-thread-duplication-stmts
9303 Maximum number of statements allowed in a block that needs to be
9304 duplicated when threading jumps.
9305
9306 @item max-fields-for-field-sensitive
9307 Maximum number of fields in a structure treated in
9308 a field sensitive manner during pointer analysis. The default is zero
9309 for @option{-O0} and @option{-O1},
9310 and 100 for @option{-Os}, @option{-O2}, and @option{-O3}.
9311
9312 @item prefetch-latency
9313 Estimate on average number of instructions that are executed before
9314 prefetch finishes. The distance prefetched ahead is proportional
9315 to this constant. Increasing this number may also lead to less
9316 streams being prefetched (see @option{simultaneous-prefetches}).
9317
9318 @item simultaneous-prefetches
9319 Maximum number of prefetches that can run at the same time.
9320
9321 @item l1-cache-line-size
9322 The size of cache line in L1 cache, in bytes.
9323
9324 @item l1-cache-size
9325 The size of L1 cache, in kilobytes.
9326
9327 @item l2-cache-size
9328 The size of L2 cache, in kilobytes.
9329
9330 @item min-insn-to-prefetch-ratio
9331 The minimum ratio between the number of instructions and the
9332 number of prefetches to enable prefetching in a loop.
9333
9334 @item prefetch-min-insn-to-mem-ratio
9335 The minimum ratio between the number of instructions and the
9336 number of memory references to enable prefetching in a loop.
9337
9338 @item use-canonical-types
9339 Whether the compiler should use the ``canonical'' type system. By
9340 default, this should always be 1, which uses a more efficient internal
9341 mechanism for comparing types in C++ and Objective-C++. However, if
9342 bugs in the canonical type system are causing compilation failures,
9343 set this value to 0 to disable canonical types.
9344
9345 @item switch-conversion-max-branch-ratio
9346 Switch initialization conversion refuses to create arrays that are
9347 bigger than @option{switch-conversion-max-branch-ratio} times the number of
9348 branches in the switch.
9349
9350 @item max-partial-antic-length
9351 Maximum length of the partial antic set computed during the tree
9352 partial redundancy elimination optimization (@option{-ftree-pre}) when
9353 optimizing at @option{-O3} and above. For some sorts of source code
9354 the enhanced partial redundancy elimination optimization can run away,
9355 consuming all of the memory available on the host machine. This
9356 parameter sets a limit on the length of the sets that are computed,
9357 which prevents the runaway behavior. Setting a value of 0 for
9358 this parameter allows an unlimited set length.
9359
9360 @item sccvn-max-scc-size
9361 Maximum size of a strongly connected component (SCC) during SCCVN
9362 processing. If this limit is hit, SCCVN processing for the whole
9363 function is not done and optimizations depending on it are
9364 disabled. The default maximum SCC size is 10000.
9365
9366 @item sccvn-max-alias-queries-per-access
9367 Maximum number of alias-oracle queries we perform when looking for
9368 redundancies for loads and stores. If this limit is hit the search
9369 is aborted and the load or store is not considered redundant. The
9370 number of queries is algorithmically limited to the number of
9371 stores on all paths from the load to the function entry.
9372 The default maximum number of queries is 1000.
9373
9374 @item ira-max-loops-num
9375 IRA uses regional register allocation by default. If a function
9376 contains more loops than the number given by this parameter, only at most
9377 the given number of the most frequently-executed loops form regions
9378 for regional register allocation. The default value of the
9379 parameter is 100.
9380
9381 @item ira-max-conflict-table-size
9382 Although IRA uses a sophisticated algorithm to compress the conflict
9383 table, the table can still require excessive amounts of memory for
9384 huge functions. If the conflict table for a function could be more
9385 than the size in MB given by this parameter, the register allocator
9386 instead uses a faster, simpler, and lower-quality
9387 algorithm that does not require building a pseudo-register conflict table.
9388 The default value of the parameter is 2000.
9389
9390 @item ira-loop-reserved-regs
9391 IRA can be used to evaluate more accurate register pressure in loops
9392 for decisions to move loop invariants (see @option{-O3}). The number
9393 of available registers reserved for some other purposes is given
9394 by this parameter. The default value of the parameter is 2, which is
9395 the minimal number of registers needed by typical instructions.
9396 This value is the best found from numerous experiments.
9397
9398 @item lra-inheritance-ebb-probability-cutoff
9399 LRA tries to reuse values reloaded in registers in subsequent insns.
9400 This optimization is called inheritance. EBB is used as a region to
9401 do this optimization. The parameter defines a minimal fall-through
9402 edge probability in percentage used to add BB to inheritance EBB in
9403 LRA. The default value of the parameter is 40. The value was chosen
9404 from numerous runs of SPEC2000 on x86-64.
9405
9406 @item loop-invariant-max-bbs-in-loop
9407 Loop invariant motion can be very expensive, both in compilation time and
9408 in amount of needed compile-time memory, with very large loops. Loops
9409 with more basic blocks than this parameter won't have loop invariant
9410 motion optimization performed on them. The default value of the
9411 parameter is 1000 for @option{-O1} and 10000 for @option{-O2} and above.
9412
9413 @item loop-max-datarefs-for-datadeps
9414 Building data dependencies is expensive for very large loops. This
9415 parameter limits the number of data references in loops that are
9416 considered for data dependence analysis. These large loops are no
9417 handled by the optimizations using loop data dependencies.
9418 The default value is 1000.
9419
9420 @item max-vartrack-size
9421 Sets a maximum number of hash table slots to use during variable
9422 tracking dataflow analysis of any function. If this limit is exceeded
9423 with variable tracking at assignments enabled, analysis for that
9424 function is retried without it, after removing all debug insns from
9425 the function. If the limit is exceeded even without debug insns, var
9426 tracking analysis is completely disabled for the function. Setting
9427 the parameter to zero makes it unlimited.
9428
9429 @item max-vartrack-expr-depth
9430 Sets a maximum number of recursion levels when attempting to map
9431 variable names or debug temporaries to value expressions. This trades
9432 compilation time for more complete debug information. If this is set too
9433 low, value expressions that are available and could be represented in
9434 debug information may end up not being used; setting this higher may
9435 enable the compiler to find more complex debug expressions, but compile
9436 time and memory use may grow. The default is 12.
9437
9438 @item min-nondebug-insn-uid
9439 Use uids starting at this parameter for nondebug insns. The range below
9440 the parameter is reserved exclusively for debug insns created by
9441 @option{-fvar-tracking-assignments}, but debug insns may get
9442 (non-overlapping) uids above it if the reserved range is exhausted.
9443
9444 @item ipa-sra-ptr-growth-factor
9445 IPA-SRA replaces a pointer to an aggregate with one or more new
9446 parameters only when their cumulative size is less or equal to
9447 @option{ipa-sra-ptr-growth-factor} times the size of the original
9448 pointer parameter.
9449
9450 @item sra-max-scalarization-size-Ospeed
9451 @item sra-max-scalarization-size-Osize
9452 The two Scalar Reduction of Aggregates passes (SRA and IPA-SRA) aim to
9453 replace scalar parts of aggregates with uses of independent scalar
9454 variables. These parameters control the maximum size, in storage units,
9455 of aggregate which is considered for replacement when compiling for
9456 speed
9457 (@option{sra-max-scalarization-size-Ospeed}) or size
9458 (@option{sra-max-scalarization-size-Osize}) respectively.
9459
9460 @item tm-max-aggregate-size
9461 When making copies of thread-local variables in a transaction, this
9462 parameter specifies the size in bytes after which variables are
9463 saved with the logging functions as opposed to save/restore code
9464 sequence pairs. This option only applies when using
9465 @option{-fgnu-tm}.
9466
9467 @item graphite-max-nb-scop-params
9468 To avoid exponential effects in the Graphite loop transforms, the
9469 number of parameters in a Static Control Part (SCoP) is bounded. The
9470 default value is 10 parameters. A variable whose value is unknown at
9471 compilation time and defined outside a SCoP is a parameter of the SCoP.
9472
9473 @item graphite-max-bbs-per-function
9474 To avoid exponential effects in the detection of SCoPs, the size of
9475 the functions analyzed by Graphite is bounded. The default value is
9476 100 basic blocks.
9477
9478 @item loop-block-tile-size
9479 Loop blocking or strip mining transforms, enabled with
9480 @option{-floop-block} or @option{-floop-strip-mine}, strip mine each
9481 loop in the loop nest by a given number of iterations. The strip
9482 length can be changed using the @option{loop-block-tile-size}
9483 parameter. The default value is 51 iterations.
9484
9485 @item loop-unroll-jam-size
9486 Specify the unroll factor for the @option{-floop-unroll-and-jam} option. The
9487 default value is 4.
9488
9489 @item loop-unroll-jam-depth
9490 Specify the dimension to be unrolled (counting from the most inner loop)
9491 for the @option{-floop-unroll-and-jam}. The default value is 2.
9492
9493 @item ipa-cp-value-list-size
9494 IPA-CP attempts to track all possible values and types passed to a function's
9495 parameter in order to propagate them and perform devirtualization.
9496 @option{ipa-cp-value-list-size} is the maximum number of values and types it
9497 stores per one formal parameter of a function.
9498
9499 @item ipa-cp-eval-threshold
9500 IPA-CP calculates its own score of cloning profitability heuristics
9501 and performs those cloning opportunities with scores that exceed
9502 @option{ipa-cp-eval-threshold}.
9503
9504 @item ipa-cp-recursion-penalty
9505 Percentage penalty the recursive functions will receive when they
9506 are evaluated for cloning.
9507
9508 @item ipa-cp-single-call-penalty
9509 Percentage penalty functions containg a single call to another
9510 function will receive when they are evaluated for cloning.
9511
9512
9513 @item ipa-max-agg-items
9514 IPA-CP is also capable to propagate a number of scalar values passed
9515 in an aggregate. @option{ipa-max-agg-items} controls the maximum
9516 number of such values per one parameter.
9517
9518 @item ipa-cp-loop-hint-bonus
9519 When IPA-CP determines that a cloning candidate would make the number
9520 of iterations of a loop known, it adds a bonus of
9521 @option{ipa-cp-loop-hint-bonus} to the profitability score of
9522 the candidate.
9523
9524 @item ipa-cp-array-index-hint-bonus
9525 When IPA-CP determines that a cloning candidate would make the index of
9526 an array access known, it adds a bonus of
9527 @option{ipa-cp-array-index-hint-bonus} to the profitability
9528 score of the candidate.
9529
9530 @item ipa-max-aa-steps
9531 During its analysis of function bodies, IPA-CP employs alias analysis
9532 in order to track values pointed to by function parameters. In order
9533 not spend too much time analyzing huge functions, it gives up and
9534 consider all memory clobbered after examining
9535 @option{ipa-max-aa-steps} statements modifying memory.
9536
9537 @item lto-partitions
9538 Specify desired number of partitions produced during WHOPR compilation.
9539 The number of partitions should exceed the number of CPUs used for compilation.
9540 The default value is 32.
9541
9542 @item lto-min-partition
9543 Size of minimal partition for WHOPR (in estimated instructions).
9544 This prevents expenses of splitting very small programs into too many
9545 partitions.
9546
9547 @item lto-max-partition
9548 Size of max partition for WHOPR (in estimated instructions).
9549 to provide an upper bound for individual size of partition.
9550 Meant to be used only with balanced partitioning.
9551
9552 @item cxx-max-namespaces-for-diagnostic-help
9553 The maximum number of namespaces to consult for suggestions when C++
9554 name lookup fails for an identifier. The default is 1000.
9555
9556 @item sink-frequency-threshold
9557 The maximum relative execution frequency (in percents) of the target block
9558 relative to a statement's original block to allow statement sinking of a
9559 statement. Larger numbers result in more aggressive statement sinking.
9560 The default value is 75. A small positive adjustment is applied for
9561 statements with memory operands as those are even more profitable so sink.
9562
9563 @item max-stores-to-sink
9564 The maximum number of conditional store pairs that can be sunk. Set to 0
9565 if either vectorization (@option{-ftree-vectorize}) or if-conversion
9566 (@option{-ftree-loop-if-convert}) is disabled. The default is 2.
9567
9568 @item allow-store-data-races
9569 Allow optimizers to introduce new data races on stores.
9570 Set to 1 to allow, otherwise to 0. This option is enabled by default
9571 at optimization level @option{-Ofast}.
9572
9573 @item case-values-threshold
9574 The smallest number of different values for which it is best to use a
9575 jump-table instead of a tree of conditional branches. If the value is
9576 0, use the default for the machine. The default is 0.
9577
9578 @item tree-reassoc-width
9579 Set the maximum number of instructions executed in parallel in
9580 reassociated tree. This parameter overrides target dependent
9581 heuristics used by default if has non zero value.
9582
9583 @item sched-pressure-algorithm
9584 Choose between the two available implementations of
9585 @option{-fsched-pressure}. Algorithm 1 is the original implementation
9586 and is the more likely to prevent instructions from being reordered.
9587 Algorithm 2 was designed to be a compromise between the relatively
9588 conservative approach taken by algorithm 1 and the rather aggressive
9589 approach taken by the default scheduler. It relies more heavily on
9590 having a regular register file and accurate register pressure classes.
9591 See @file{haifa-sched.c} in the GCC sources for more details.
9592
9593 The default choice depends on the target.
9594
9595 @item max-slsr-cand-scan
9596 Set the maximum number of existing candidates that are considered when
9597 seeking a basis for a new straight-line strength reduction candidate.
9598
9599 @item asan-globals
9600 Enable buffer overflow detection for global objects. This kind
9601 of protection is enabled by default if you are using
9602 @option{-fsanitize=address} option.
9603 To disable global objects protection use @option{--param asan-globals=0}.
9604
9605 @item asan-stack
9606 Enable buffer overflow detection for stack objects. This kind of
9607 protection is enabled by default when using @option{-fsanitize=address}.
9608 To disable stack protection use @option{--param asan-stack=0} option.
9609
9610 @item asan-instrument-reads
9611 Enable buffer overflow detection for memory reads. This kind of
9612 protection is enabled by default when using @option{-fsanitize=address}.
9613 To disable memory reads protection use
9614 @option{--param asan-instrument-reads=0}.
9615
9616 @item asan-instrument-writes
9617 Enable buffer overflow detection for memory writes. This kind of
9618 protection is enabled by default when using @option{-fsanitize=address}.
9619 To disable memory writes protection use
9620 @option{--param asan-instrument-writes=0} option.
9621
9622 @item asan-memintrin
9623 Enable detection for built-in functions. This kind of protection
9624 is enabled by default when using @option{-fsanitize=address}.
9625 To disable built-in functions protection use
9626 @option{--param asan-memintrin=0}.
9627
9628 @item asan-use-after-return
9629 Enable detection of use-after-return. This kind of protection
9630 is enabled by default when using @option{-fsanitize=address} option.
9631 To disable use-after-return detection use
9632 @option{--param asan-use-after-return=0}.
9633
9634 @item asan-instrumentation-with-call-threshold
9635 If number of memory accesses in function being instrumented
9636 is greater or equal to this number, use callbacks instead of inline checks.
9637 E.g. to disable inline code use
9638 @option{--param asan-instrumentation-with-call-threshold=0}.
9639
9640 @item chkp-max-ctor-size
9641 Static constructors generated by Pointer Bounds Checker may become very
9642 large and significantly increase compile time at optimization level
9643 @option{-O1} and higher. This parameter is a maximum nubmer of statements
9644 in a single generated constructor. Default value is 5000.
9645
9646 @item max-fsm-thread-path-insns
9647 Maximum number of instructions to copy when duplicating blocks on a
9648 finite state automaton jump thread path. The default is 100.
9649
9650 @item max-fsm-thread-length
9651 Maximum number of basic blocks on a finite state automaton jump thread
9652 path. The default is 10.
9653
9654 @item max-fsm-thread-paths
9655 Maximum number of new jump thread paths to create for a finite state
9656 automaton. The default is 50.
9657
9658 @item parloops-chunk-size
9659 Chunk size of omp schedule for loops parallelized by parloops. The default
9660 is 0.
9661
9662 @item parloops-schedule
9663 Schedule type of omp schedule for loops parallelized by parloops (static,
9664 dynamic, guided, auto, runtime). The default is static.
9665
9666 @item max-ssa-name-query-depth
9667 Maximum depth of recursion when querying properties of SSA names in things
9668 like fold routines. One level of recursion corresponds to following a
9669 use-def chain.
9670
9671 @item hsa-gen-debug-stores
9672 Enable emission of special debug stores within HSA kernels which are
9673 then read and reported by libgomp plugin. Generation of these stores
9674 is disabled by default, use @option{--param hsa-gen-debug-stores=1} to
9675 enable it.
9676
9677 @item max-speculative-devirt-maydefs
9678 The maximum number of may-defs we analyze when looking for a must-def
9679 specifying the dynamic type of an object that invokes a virtual call
9680 we may be able to devirtualize speculatively.
9681 @end table
9682 @end table
9683
9684 @node Instrumentation Options
9685 @section Program Instrumentation Options
9686 @cindex instrumentation options
9687 @cindex program instrumentation options
9688 @cindex run-time error checking options
9689 @cindex profiling options
9690 @cindex options, program instrumentation
9691 @cindex options, run-time error checking
9692 @cindex options, profiling
9693
9694 GCC supports a number of command-line options that control adding
9695 run-time instrumentation to the code it normally generates.
9696 For example, one purpose of instrumentation is collect profiling
9697 statistics for use in finding program hot spots, code coverage
9698 analysis, or profile-guided optimizations.
9699 Another class of program instrumentation is adding run-time checking
9700 to detect programming errors like invalid pointer
9701 dereferences or out-of-bounds array accesses, as well as deliberately
9702 hostile attacks such as stack smashing or C++ vtable hijacking.
9703 There is also a general hook which can be used to implement other
9704 forms of tracing or function-level instrumentation for debug or
9705 program analysis purposes.
9706
9707 @table @gcctabopt
9708 @cindex @command{prof}
9709 @item -p
9710 @opindex p
9711 Generate extra code to write profile information suitable for the
9712 analysis program @command{prof}. You must use this option when compiling
9713 the source files you want data about, and you must also use it when
9714 linking.
9715
9716 @cindex @command{gprof}
9717 @item -pg
9718 @opindex pg
9719 Generate extra code to write profile information suitable for the
9720 analysis program @command{gprof}. You must use this option when compiling
9721 the source files you want data about, and you must also use it when
9722 linking.
9723
9724 @item -fprofile-arcs
9725 @opindex fprofile-arcs
9726 Add code so that program flow @dfn{arcs} are instrumented. During
9727 execution the program records how many times each branch and call is
9728 executed and how many times it is taken or returns. When the compiled
9729 program exits it saves this data to a file called
9730 @file{@var{auxname}.gcda} for each source file. The data may be used for
9731 profile-directed optimizations (@option{-fbranch-probabilities}), or for
9732 test coverage analysis (@option{-ftest-coverage}). Each object file's
9733 @var{auxname} is generated from the name of the output file, if
9734 explicitly specified and it is not the final executable, otherwise it is
9735 the basename of the source file. In both cases any suffix is removed
9736 (e.g.@: @file{foo.gcda} for input file @file{dir/foo.c}, or
9737 @file{dir/foo.gcda} for output file specified as @option{-o dir/foo.o}).
9738 @xref{Cross-profiling}.
9739
9740 @cindex @command{gcov}
9741 @item --coverage
9742 @opindex coverage
9743
9744 This option is used to compile and link code instrumented for coverage
9745 analysis. The option is a synonym for @option{-fprofile-arcs}
9746 @option{-ftest-coverage} (when compiling) and @option{-lgcov} (when
9747 linking). See the documentation for those options for more details.
9748
9749 @itemize
9750
9751 @item
9752 Compile the source files with @option{-fprofile-arcs} plus optimization
9753 and code generation options. For test coverage analysis, use the
9754 additional @option{-ftest-coverage} option. You do not need to profile
9755 every source file in a program.
9756
9757 @item
9758 Link your object files with @option{-lgcov} or @option{-fprofile-arcs}
9759 (the latter implies the former).
9760
9761 @item
9762 Run the program on a representative workload to generate the arc profile
9763 information. This may be repeated any number of times. You can run
9764 concurrent instances of your program, and provided that the file system
9765 supports locking, the data files will be correctly updated. Also
9766 @code{fork} calls are detected and correctly handled (double counting
9767 will not happen).
9768
9769 @item
9770 For profile-directed optimizations, compile the source files again with
9771 the same optimization and code generation options plus
9772 @option{-fbranch-probabilities} (@pxref{Optimize Options,,Options that
9773 Control Optimization}).
9774
9775 @item
9776 For test coverage analysis, use @command{gcov} to produce human readable
9777 information from the @file{.gcno} and @file{.gcda} files. Refer to the
9778 @command{gcov} documentation for further information.
9779
9780 @end itemize
9781
9782 With @option{-fprofile-arcs}, for each function of your program GCC
9783 creates a program flow graph, then finds a spanning tree for the graph.
9784 Only arcs that are not on the spanning tree have to be instrumented: the
9785 compiler adds code to count the number of times that these arcs are
9786 executed. When an arc is the only exit or only entrance to a block, the
9787 instrumentation code can be added to the block; otherwise, a new basic
9788 block must be created to hold the instrumentation code.
9789
9790 @need 2000
9791 @item -ftest-coverage
9792 @opindex ftest-coverage
9793 Produce a notes file that the @command{gcov} code-coverage utility
9794 (@pxref{Gcov,, @command{gcov}---a Test Coverage Program}) can use to
9795 show program coverage. Each source file's note file is called
9796 @file{@var{auxname}.gcno}. Refer to the @option{-fprofile-arcs} option
9797 above for a description of @var{auxname} and instructions on how to
9798 generate test coverage data. Coverage data matches the source files
9799 more closely if you do not optimize.
9800
9801 @item -fprofile-dir=@var{path}
9802 @opindex fprofile-dir
9803
9804 Set the directory to search for the profile data files in to @var{path}.
9805 This option affects only the profile data generated by
9806 @option{-fprofile-generate}, @option{-ftest-coverage}, @option{-fprofile-arcs}
9807 and used by @option{-fprofile-use} and @option{-fbranch-probabilities}
9808 and its related options. Both absolute and relative paths can be used.
9809 By default, GCC uses the current directory as @var{path}, thus the
9810 profile data file appears in the same directory as the object file.
9811
9812 @item -fprofile-generate
9813 @itemx -fprofile-generate=@var{path}
9814 @opindex fprofile-generate
9815
9816 Enable options usually used for instrumenting application to produce
9817 profile useful for later recompilation with profile feedback based
9818 optimization. You must use @option{-fprofile-generate} both when
9819 compiling and when linking your program.
9820
9821 The following options are enabled: @option{-fprofile-arcs}, @option{-fprofile-values}, @option{-fvpt}.
9822
9823 If @var{path} is specified, GCC looks at the @var{path} to find
9824 the profile feedback data files. See @option{-fprofile-dir}.
9825
9826 To optimize the program based on the collected profile information, use
9827 @option{-fprofile-use}. @xref{Optimize Options}, for more information.
9828
9829 @item -fsanitize=address
9830 @opindex fsanitize=address
9831 Enable AddressSanitizer, a fast memory error detector.
9832 Memory access instructions are instrumented to detect
9833 out-of-bounds and use-after-free bugs.
9834 See @uref{https://github.com/google/sanitizers/wiki/AddressSanitizer} for
9835 more details. The run-time behavior can be influenced using the
9836 @env{ASAN_OPTIONS} environment variable. When set to @code{help=1},
9837 the available options are shown at startup of the instrumented program. See
9838 @url{https://github.com/google/sanitizers/wiki/AddressSanitizerFlags#run-time-flags}
9839 for a list of supported options.
9840
9841 @item -fsanitize=kernel-address
9842 @opindex fsanitize=kernel-address
9843 Enable AddressSanitizer for Linux kernel.
9844 See @uref{https://github.com/google/kasan/wiki} for more details.
9845
9846 @item -fsanitize=thread
9847 @opindex fsanitize=thread
9848 Enable ThreadSanitizer, a fast data race detector.
9849 Memory access instructions are instrumented to detect
9850 data race bugs. See @uref{https://github.com/google/sanitizers/wiki#threadsanitizer} for more
9851 details. The run-time behavior can be influenced using the @env{TSAN_OPTIONS}
9852 environment variable; see
9853 @url{https://github.com/google/sanitizers/wiki/ThreadSanitizerFlags} for a list of
9854 supported options.
9855
9856 @item -fsanitize=leak
9857 @opindex fsanitize=leak
9858 Enable LeakSanitizer, a memory leak detector.
9859 This option only matters for linking of executables and if neither
9860 @option{-fsanitize=address} nor @option{-fsanitize=thread} is used. In that
9861 case the executable is linked against a library that overrides @code{malloc}
9862 and other allocator functions. See
9863 @uref{https://github.com/google/sanitizers/wiki/AddressSanitizerLeakSanitizer} for more
9864 details. The run-time behavior can be influenced using the
9865 @env{LSAN_OPTIONS} environment variable.
9866
9867 @item -fsanitize=undefined
9868 @opindex fsanitize=undefined
9869 Enable UndefinedBehaviorSanitizer, a fast undefined behavior detector.
9870 Various computations are instrumented to detect undefined behavior
9871 at runtime. Current suboptions are:
9872
9873 @table @gcctabopt
9874
9875 @item -fsanitize=shift
9876 @opindex fsanitize=shift
9877 This option enables checking that the result of a shift operation is
9878 not undefined. Note that what exactly is considered undefined differs
9879 slightly between C and C++, as well as between ISO C90 and C99, etc.
9880
9881 @item -fsanitize=integer-divide-by-zero
9882 @opindex fsanitize=integer-divide-by-zero
9883 Detect integer division by zero as well as @code{INT_MIN / -1} division.
9884
9885 @item -fsanitize=unreachable
9886 @opindex fsanitize=unreachable
9887 With this option, the compiler turns the @code{__builtin_unreachable}
9888 call into a diagnostics message call instead. When reaching the
9889 @code{__builtin_unreachable} call, the behavior is undefined.
9890
9891 @item -fsanitize=vla-bound
9892 @opindex fsanitize=vla-bound
9893 This option instructs the compiler to check that the size of a variable
9894 length array is positive.
9895
9896 @item -fsanitize=null
9897 @opindex fsanitize=null
9898 This option enables pointer checking. Particularly, the application
9899 built with this option turned on will issue an error message when it
9900 tries to dereference a NULL pointer, or if a reference (possibly an
9901 rvalue reference) is bound to a NULL pointer, or if a method is invoked
9902 on an object pointed by a NULL pointer.
9903
9904 @item -fsanitize=return
9905 @opindex fsanitize=return
9906 This option enables return statement checking. Programs
9907 built with this option turned on will issue an error message
9908 when the end of a non-void function is reached without actually
9909 returning a value. This option works in C++ only.
9910
9911 @item -fsanitize=signed-integer-overflow
9912 @opindex fsanitize=signed-integer-overflow
9913 This option enables signed integer overflow checking. We check that
9914 the result of @code{+}, @code{*}, and both unary and binary @code{-}
9915 does not overflow in the signed arithmetics. Note, integer promotion
9916 rules must be taken into account. That is, the following is not an
9917 overflow:
9918 @smallexample
9919 signed char a = SCHAR_MAX;
9920 a++;
9921 @end smallexample
9922
9923 @item -fsanitize=bounds
9924 @opindex fsanitize=bounds
9925 This option enables instrumentation of array bounds. Various out of bounds
9926 accesses are detected. Flexible array members, flexible array member-like
9927 arrays, and initializers of variables with static storage are not instrumented.
9928
9929 @item -fsanitize=bounds-strict
9930 @opindex fsanitize=bounds-strict
9931 This option enables strict instrumentation of array bounds. Most out of bounds
9932 accesses are detected, including flexible array members and flexible array
9933 member-like arrays. Initializers of variables with static storage are not
9934 instrumented.
9935
9936 @item -fsanitize=alignment
9937 @opindex fsanitize=alignment
9938
9939 This option enables checking of alignment of pointers when they are
9940 dereferenced, or when a reference is bound to insufficiently aligned target,
9941 or when a method or constructor is invoked on insufficiently aligned object.
9942
9943 @item -fsanitize=object-size
9944 @opindex fsanitize=object-size
9945 This option enables instrumentation of memory references using the
9946 @code{__builtin_object_size} function. Various out of bounds pointer
9947 accesses are detected.
9948
9949 @item -fsanitize=float-divide-by-zero
9950 @opindex fsanitize=float-divide-by-zero
9951 Detect floating-point division by zero. Unlike other similar options,
9952 @option{-fsanitize=float-divide-by-zero} is not enabled by
9953 @option{-fsanitize=undefined}, since floating-point division by zero can
9954 be a legitimate way of obtaining infinities and NaNs.
9955
9956 @item -fsanitize=float-cast-overflow
9957 @opindex fsanitize=float-cast-overflow
9958 This option enables floating-point type to integer conversion checking.
9959 We check that the result of the conversion does not overflow.
9960 Unlike other similar options, @option{-fsanitize=float-cast-overflow} is
9961 not enabled by @option{-fsanitize=undefined}.
9962 This option does not work well with @code{FE_INVALID} exceptions enabled.
9963
9964 @item -fsanitize=nonnull-attribute
9965 @opindex fsanitize=nonnull-attribute
9966
9967 This option enables instrumentation of calls, checking whether null values
9968 are not passed to arguments marked as requiring a non-null value by the
9969 @code{nonnull} function attribute.
9970
9971 @item -fsanitize=returns-nonnull-attribute
9972 @opindex fsanitize=returns-nonnull-attribute
9973
9974 This option enables instrumentation of return statements in functions
9975 marked with @code{returns_nonnull} function attribute, to detect returning
9976 of null values from such functions.
9977
9978 @item -fsanitize=bool
9979 @opindex fsanitize=bool
9980
9981 This option enables instrumentation of loads from bool. If a value other
9982 than 0/1 is loaded, a run-time error is issued.
9983
9984 @item -fsanitize=enum
9985 @opindex fsanitize=enum
9986
9987 This option enables instrumentation of loads from an enum type. If
9988 a value outside the range of values for the enum type is loaded,
9989 a run-time error is issued.
9990
9991 @item -fsanitize=vptr
9992 @opindex fsanitize=vptr
9993
9994 This option enables instrumentation of C++ member function calls, member
9995 accesses and some conversions between pointers to base and derived classes,
9996 to verify the referenced object has the correct dynamic type.
9997
9998 @end table
9999
10000 While @option{-ftrapv} causes traps for signed overflows to be emitted,
10001 @option{-fsanitize=undefined} gives a diagnostic message.
10002 This currently works only for the C family of languages.
10003
10004 @item -fno-sanitize=all
10005 @opindex fno-sanitize=all
10006
10007 This option disables all previously enabled sanitizers.
10008 @option{-fsanitize=all} is not allowed, as some sanitizers cannot be used
10009 together.
10010
10011 @item -fasan-shadow-offset=@var{number}
10012 @opindex fasan-shadow-offset
10013 This option forces GCC to use custom shadow offset in AddressSanitizer checks.
10014 It is useful for experimenting with different shadow memory layouts in
10015 Kernel AddressSanitizer.
10016
10017 @item -fsanitize-sections=@var{s1},@var{s2},...
10018 @opindex fsanitize-sections
10019 Sanitize global variables in selected user-defined sections. @var{si} may
10020 contain wildcards.
10021
10022 @item -fsanitize-recover@r{[}=@var{opts}@r{]}
10023 @opindex fsanitize-recover
10024 @opindex fno-sanitize-recover
10025 @option{-fsanitize-recover=} controls error recovery mode for sanitizers
10026 mentioned in comma-separated list of @var{opts}. Enabling this option
10027 for a sanitizer component causes it to attempt to continue
10028 running the program as if no error happened. This means multiple
10029 runtime errors can be reported in a single program run, and the exit
10030 code of the program may indicate success even when errors
10031 have been reported. The @option{-fno-sanitize-recover=} option
10032 can be used to alter
10033 this behavior: only the first detected error is reported
10034 and program then exits with a non-zero exit code.
10035
10036 Currently this feature only works for @option{-fsanitize=undefined} (and its suboptions
10037 except for @option{-fsanitize=unreachable} and @option{-fsanitize=return}),
10038 @option{-fsanitize=float-cast-overflow}, @option{-fsanitize=float-divide-by-zero},
10039 @option{-fsanitize=kernel-address} and @option{-fsanitize=address}.
10040 For these sanitizers error recovery is turned on by default, except @option{-fsanitize=address},
10041 for which this feature is experimental.
10042 @option{-fsanitize-recover=all} and @option{-fno-sanitize-recover=all} is also
10043 accepted, the former enables recovery for all sanitizers that support it,
10044 the latter disables recovery for all sanitizers that support it.
10045
10046 Even if a recovery mode is turned on the compiler side, it needs to be also
10047 enabled on the runtime library side, otherwise the failures are still fatal.
10048 The runtime library defaults to @code{halt_on_error=0} for
10049 ThreadSanitizer and UndefinedBehaviorSanitizer, while default value for
10050 AddressSanitizer is @code{halt_on_error=1}. This can be overridden through
10051 setting the @code{halt_on_error} flag in the corresponding environment variable.
10052
10053 Syntax without explicit @var{opts} parameter is deprecated. It is equivalent to
10054 @smallexample
10055 -fsanitize-recover=undefined,float-cast-overflow,float-divide-by-zero
10056 @end smallexample
10057 @noindent
10058 Similarly @option{-fno-sanitize-recover} is equivalent to
10059 @smallexample
10060 -fno-sanitize-recover=undefined,float-cast-overflow,float-divide-by-zero
10061 @end smallexample
10062
10063 @item -fsanitize-undefined-trap-on-error
10064 @opindex fsanitize-undefined-trap-on-error
10065 The @option{-fsanitize-undefined-trap-on-error} option instructs the compiler to
10066 report undefined behavior using @code{__builtin_trap} rather than
10067 a @code{libubsan} library routine. The advantage of this is that the
10068 @code{libubsan} library is not needed and is not linked in, so this
10069 is usable even in freestanding environments.
10070
10071 @item -fsanitize-coverage=trace-pc
10072 @opindex fsanitize-coverage=trace-pc
10073 Enable coverage-guided fuzzing code instrumentation.
10074 Inserts a call to @code{__sanitizer_cov_trace_pc} into every basic block.
10075
10076 @item -fbounds-check
10077 @opindex fbounds-check
10078 For front ends that support it, generate additional code to check that
10079 indices used to access arrays are within the declared range. This is
10080 currently only supported by the Java and Fortran front ends, where
10081 this option defaults to true and false respectively.
10082
10083 @item -fcheck-pointer-bounds
10084 @opindex fcheck-pointer-bounds
10085 @opindex fno-check-pointer-bounds
10086 @cindex Pointer Bounds Checker options
10087 Enable Pointer Bounds Checker instrumentation. Each memory reference
10088 is instrumented with checks of the pointer used for memory access against
10089 bounds associated with that pointer.
10090
10091 Currently there
10092 is only an implementation for Intel MPX available, thus x86 GNU/Linux target
10093 and @option{-mmpx} are required to enable this feature.
10094 MPX-based instrumentation requires
10095 a runtime library to enable MPX in hardware and handle bounds
10096 violation signals. By default when @option{-fcheck-pointer-bounds}
10097 and @option{-mmpx} options are used to link a program, the GCC driver
10098 links against the @file{libmpx} and @file{libmpxwrappers} libraries.
10099 Bounds checking on calls to dynamic libraries requires a linker
10100 with @option{-z bndplt} support; if GCC was configured with a linker
10101 without support for this option (including the Gold linker and older
10102 versions of ld), a warning is given if you link with @option{-mmpx}
10103 without also specifying @option{-static}, since the overall effectiveness
10104 of the bounds checking protection is reduced.
10105 See also @option{-static-libmpxwrappers}.
10106
10107 MPX-based instrumentation
10108 may be used for debugging and also may be included in production code
10109 to increase program security. Depending on usage, you may
10110 have different requirements for the runtime library. The current version
10111 of the MPX runtime library is more oriented for use as a debugging
10112 tool. MPX runtime library usage implies @option{-lpthread}. See
10113 also @option{-static-libmpx}. The runtime library behavior can be
10114 influenced using various @env{CHKP_RT_*} environment variables. See
10115 @uref{https://gcc.gnu.org/wiki/Intel%20MPX%20support%20in%20the%20GCC%20compiler}
10116 for more details.
10117
10118 Generated instrumentation may be controlled by various
10119 @option{-fchkp-*} options and by the @code{bnd_variable_size}
10120 structure field attribute (@pxref{Type Attributes}) and
10121 @code{bnd_legacy}, and @code{bnd_instrument} function attributes
10122 (@pxref{Function Attributes}). GCC also provides a number of built-in
10123 functions for controlling the Pointer Bounds Checker. @xref{Pointer
10124 Bounds Checker builtins}, for more information.
10125
10126 @item -fchkp-check-incomplete-type
10127 @opindex fchkp-check-incomplete-type
10128 @opindex fno-chkp-check-incomplete-type
10129 Generate pointer bounds checks for variables with incomplete type.
10130 Enabled by default.
10131
10132 @item -fchkp-narrow-bounds
10133 @opindex fchkp-narrow-bounds
10134 @opindex fno-chkp-narrow-bounds
10135 Controls bounds used by Pointer Bounds Checker for pointers to object
10136 fields. If narrowing is enabled then field bounds are used. Otherwise
10137 object bounds are used. See also @option{-fchkp-narrow-to-innermost-array}
10138 and @option{-fchkp-first-field-has-own-bounds}. Enabled by default.
10139
10140 @item -fchkp-first-field-has-own-bounds
10141 @opindex fchkp-first-field-has-own-bounds
10142 @opindex fno-chkp-first-field-has-own-bounds
10143 Forces Pointer Bounds Checker to use narrowed bounds for the address of the
10144 first field in the structure. By default a pointer to the first field has
10145 the same bounds as a pointer to the whole structure.
10146
10147 @item -fchkp-narrow-to-innermost-array
10148 @opindex fchkp-narrow-to-innermost-array
10149 @opindex fno-chkp-narrow-to-innermost-array
10150 Forces Pointer Bounds Checker to use bounds of the innermost arrays in
10151 case of nested static array access. By default this option is disabled and
10152 bounds of the outermost array are used.
10153
10154 @item -fchkp-optimize
10155 @opindex fchkp-optimize
10156 @opindex fno-chkp-optimize
10157 Enables Pointer Bounds Checker optimizations. Enabled by default at
10158 optimization levels @option{-O}, @option{-O2}, @option{-O3}.
10159
10160 @item -fchkp-use-fast-string-functions
10161 @opindex fchkp-use-fast-string-functions
10162 @opindex fno-chkp-use-fast-string-functions
10163 Enables use of @code{*_nobnd} versions of string functions (not copying bounds)
10164 by Pointer Bounds Checker. Disabled by default.
10165
10166 @item -fchkp-use-nochk-string-functions
10167 @opindex fchkp-use-nochk-string-functions
10168 @opindex fno-chkp-use-nochk-string-functions
10169 Enables use of @code{*_nochk} versions of string functions (not checking bounds)
10170 by Pointer Bounds Checker. Disabled by default.
10171
10172 @item -fchkp-use-static-bounds
10173 @opindex fchkp-use-static-bounds
10174 @opindex fno-chkp-use-static-bounds
10175 Allow Pointer Bounds Checker to generate static bounds holding
10176 bounds of static variables. Enabled by default.
10177
10178 @item -fchkp-use-static-const-bounds
10179 @opindex fchkp-use-static-const-bounds
10180 @opindex fno-chkp-use-static-const-bounds
10181 Use statically-initialized bounds for constant bounds instead of
10182 generating them each time they are required. By default enabled when
10183 @option{-fchkp-use-static-bounds} is enabled.
10184
10185 @item -fchkp-treat-zero-dynamic-size-as-infinite
10186 @opindex fchkp-treat-zero-dynamic-size-as-infinite
10187 @opindex fno-chkp-treat-zero-dynamic-size-as-infinite
10188 With this option, objects with incomplete type whose
10189 dynamically-obtained size is zero are treated as having infinite size
10190 instead by Pointer Bounds
10191 Checker. This option may be helpful if a program is linked with a library
10192 missing size information for some symbols. Disabled by default.
10193
10194 @item -fchkp-check-read
10195 @opindex fchkp-check-read
10196 @opindex fno-chkp-check-read
10197 Instructs Pointer Bounds Checker to generate checks for all read
10198 accesses to memory. Enabled by default.
10199
10200 @item -fchkp-check-write
10201 @opindex fchkp-check-write
10202 @opindex fno-chkp-check-write
10203 Instructs Pointer Bounds Checker to generate checks for all write
10204 accesses to memory. Enabled by default.
10205
10206 @item -fchkp-store-bounds
10207 @opindex fchkp-store-bounds
10208 @opindex fno-chkp-store-bounds
10209 Instructs Pointer Bounds Checker to generate bounds stores for
10210 pointer writes. Enabled by default.
10211
10212 @item -fchkp-instrument-calls
10213 @opindex fchkp-instrument-calls
10214 @opindex fno-chkp-instrument-calls
10215 Instructs Pointer Bounds Checker to pass pointer bounds to calls.
10216 Enabled by default.
10217
10218 @item -fchkp-instrument-marked-only
10219 @opindex fchkp-instrument-marked-only
10220 @opindex fno-chkp-instrument-marked-only
10221 Instructs Pointer Bounds Checker to instrument only functions
10222 marked with the @code{bnd_instrument} attribute
10223 (@pxref{Function Attributes}). Disabled by default.
10224
10225 @item -fchkp-use-wrappers
10226 @opindex fchkp-use-wrappers
10227 @opindex fno-chkp-use-wrappers
10228 Allows Pointer Bounds Checker to replace calls to built-in functions
10229 with calls to wrapper functions. When @option{-fchkp-use-wrappers}
10230 is used to link a program, the GCC driver automatically links
10231 against @file{libmpxwrappers}. See also @option{-static-libmpxwrappers}.
10232 Enabled by default.
10233
10234 @item -fstack-protector
10235 @opindex fstack-protector
10236 Emit extra code to check for buffer overflows, such as stack smashing
10237 attacks. This is done by adding a guard variable to functions with
10238 vulnerable objects. This includes functions that call @code{alloca}, and
10239 functions with buffers larger than 8 bytes. The guards are initialized
10240 when a function is entered and then checked when the function exits.
10241 If a guard check fails, an error message is printed and the program exits.
10242
10243 @item -fstack-protector-all
10244 @opindex fstack-protector-all
10245 Like @option{-fstack-protector} except that all functions are protected.
10246
10247 @item -fstack-protector-strong
10248 @opindex fstack-protector-strong
10249 Like @option{-fstack-protector} but includes additional functions to
10250 be protected --- those that have local array definitions, or have
10251 references to local frame addresses.
10252
10253 @item -fstack-protector-explicit
10254 @opindex fstack-protector-explicit
10255 Like @option{-fstack-protector} but only protects those functions which
10256 have the @code{stack_protect} attribute.
10257
10258 @item -fstack-check
10259 @opindex fstack-check
10260 Generate code to verify that you do not go beyond the boundary of the
10261 stack. You should specify this flag if you are running in an
10262 environment with multiple threads, but you only rarely need to specify it in
10263 a single-threaded environment since stack overflow is automatically
10264 detected on nearly all systems if there is only one stack.
10265
10266 Note that this switch does not actually cause checking to be done; the
10267 operating system or the language runtime must do that. The switch causes
10268 generation of code to ensure that they see the stack being extended.
10269
10270 You can additionally specify a string parameter: @samp{no} means no
10271 checking, @samp{generic} means force the use of old-style checking,
10272 @samp{specific} means use the best checking method and is equivalent
10273 to bare @option{-fstack-check}.
10274
10275 Old-style checking is a generic mechanism that requires no specific
10276 target support in the compiler but comes with the following drawbacks:
10277
10278 @enumerate
10279 @item
10280 Modified allocation strategy for large objects: they are always
10281 allocated dynamically if their size exceeds a fixed threshold.
10282
10283 @item
10284 Fixed limit on the size of the static frame of functions: when it is
10285 topped by a particular function, stack checking is not reliable and
10286 a warning is issued by the compiler.
10287
10288 @item
10289 Inefficiency: because of both the modified allocation strategy and the
10290 generic implementation, code performance is hampered.
10291 @end enumerate
10292
10293 Note that old-style stack checking is also the fallback method for
10294 @samp{specific} if no target support has been added in the compiler.
10295
10296 @item -fstack-limit-register=@var{reg}
10297 @itemx -fstack-limit-symbol=@var{sym}
10298 @itemx -fno-stack-limit
10299 @opindex fstack-limit-register
10300 @opindex fstack-limit-symbol
10301 @opindex fno-stack-limit
10302 Generate code to ensure that the stack does not grow beyond a certain value,
10303 either the value of a register or the address of a symbol. If a larger
10304 stack is required, a signal is raised at run time. For most targets,
10305 the signal is raised before the stack overruns the boundary, so
10306 it is possible to catch the signal without taking special precautions.
10307
10308 For instance, if the stack starts at absolute address @samp{0x80000000}
10309 and grows downwards, you can use the flags
10310 @option{-fstack-limit-symbol=__stack_limit} and
10311 @option{-Wl,--defsym,__stack_limit=0x7ffe0000} to enforce a stack limit
10312 of 128KB@. Note that this may only work with the GNU linker.
10313
10314 You can locally override stack limit checking by using the
10315 @code{no_stack_limit} function attribute (@pxref{Function Attributes}).
10316
10317 @item -fsplit-stack
10318 @opindex fsplit-stack
10319 Generate code to automatically split the stack before it overflows.
10320 The resulting program has a discontiguous stack which can only
10321 overflow if the program is unable to allocate any more memory. This
10322 is most useful when running threaded programs, as it is no longer
10323 necessary to calculate a good stack size to use for each thread. This
10324 is currently only implemented for the x86 targets running
10325 GNU/Linux.
10326
10327 When code compiled with @option{-fsplit-stack} calls code compiled
10328 without @option{-fsplit-stack}, there may not be much stack space
10329 available for the latter code to run. If compiling all code,
10330 including library code, with @option{-fsplit-stack} is not an option,
10331 then the linker can fix up these calls so that the code compiled
10332 without @option{-fsplit-stack} always has a large stack. Support for
10333 this is implemented in the gold linker in GNU binutils release 2.21
10334 and later.
10335
10336 @item -fvtable-verify=@r{[}std@r{|}preinit@r{|}none@r{]}
10337 @opindex fvtable-verify
10338 This option is only available when compiling C++ code.
10339 It turns on (or off, if using @option{-fvtable-verify=none}) the security
10340 feature that verifies at run time, for every virtual call, that
10341 the vtable pointer through which the call is made is valid for the type of
10342 the object, and has not been corrupted or overwritten. If an invalid vtable
10343 pointer is detected at run time, an error is reported and execution of the
10344 program is immediately halted.
10345
10346 This option causes run-time data structures to be built at program startup,
10347 which are used for verifying the vtable pointers.
10348 The options @samp{std} and @samp{preinit}
10349 control the timing of when these data structures are built. In both cases the
10350 data structures are built before execution reaches @code{main}. Using
10351 @option{-fvtable-verify=std} causes the data structures to be built after
10352 shared libraries have been loaded and initialized.
10353 @option{-fvtable-verify=preinit} causes them to be built before shared
10354 libraries have been loaded and initialized.
10355
10356 If this option appears multiple times in the command line with different
10357 values specified, @samp{none} takes highest priority over both @samp{std} and
10358 @samp{preinit}; @samp{preinit} takes priority over @samp{std}.
10359
10360 @item -fvtv-debug
10361 @opindex fvtv-debug
10362 When used in conjunction with @option{-fvtable-verify=std} or
10363 @option{-fvtable-verify=preinit}, causes debug versions of the
10364 runtime functions for the vtable verification feature to be called.
10365 This flag also causes the compiler to log information about which
10366 vtable pointers it finds for each class.
10367 This information is written to a file named @file{vtv_set_ptr_data.log}
10368 in the directory named by the environment variable @env{VTV_LOGS_DIR}
10369 if that is defined or the current working directory otherwise.
10370
10371 Note: This feature @emph{appends} data to the log file. If you want a fresh log
10372 file, be sure to delete any existing one.
10373
10374 @item -fvtv-counts
10375 @opindex fvtv-counts
10376 This is a debugging flag. When used in conjunction with
10377 @option{-fvtable-verify=std} or @option{-fvtable-verify=preinit}, this
10378 causes the compiler to keep track of the total number of virtual calls
10379 it encounters and the number of verifications it inserts. It also
10380 counts the number of calls to certain run-time library functions
10381 that it inserts and logs this information for each compilation unit.
10382 The compiler writes this information to a file named
10383 @file{vtv_count_data.log} in the directory named by the environment
10384 variable @env{VTV_LOGS_DIR} if that is defined or the current working
10385 directory otherwise. It also counts the size of the vtable pointer sets
10386 for each class, and writes this information to @file{vtv_class_set_sizes.log}
10387 in the same directory.
10388
10389 Note: This feature @emph{appends} data to the log files. To get fresh log
10390 files, be sure to delete any existing ones.
10391
10392 @item -finstrument-functions
10393 @opindex finstrument-functions
10394 Generate instrumentation calls for entry and exit to functions. Just
10395 after function entry and just before function exit, the following
10396 profiling functions are called with the address of the current
10397 function and its call site. (On some platforms,
10398 @code{__builtin_return_address} does not work beyond the current
10399 function, so the call site information may not be available to the
10400 profiling functions otherwise.)
10401
10402 @smallexample
10403 void __cyg_profile_func_enter (void *this_fn,
10404 void *call_site);
10405 void __cyg_profile_func_exit (void *this_fn,
10406 void *call_site);
10407 @end smallexample
10408
10409 The first argument is the address of the start of the current function,
10410 which may be looked up exactly in the symbol table.
10411
10412 This instrumentation is also done for functions expanded inline in other
10413 functions. The profiling calls indicate where, conceptually, the
10414 inline function is entered and exited. This means that addressable
10415 versions of such functions must be available. If all your uses of a
10416 function are expanded inline, this may mean an additional expansion of
10417 code size. If you use @code{extern inline} in your C code, an
10418 addressable version of such functions must be provided. (This is
10419 normally the case anyway, but if you get lucky and the optimizer always
10420 expands the functions inline, you might have gotten away without
10421 providing static copies.)
10422
10423 A function may be given the attribute @code{no_instrument_function}, in
10424 which case this instrumentation is not done. This can be used, for
10425 example, for the profiling functions listed above, high-priority
10426 interrupt routines, and any functions from which the profiling functions
10427 cannot safely be called (perhaps signal handlers, if the profiling
10428 routines generate output or allocate memory).
10429
10430 @item -finstrument-functions-exclude-file-list=@var{file},@var{file},@dots{}
10431 @opindex finstrument-functions-exclude-file-list
10432
10433 Set the list of functions that are excluded from instrumentation (see
10434 the description of @option{-finstrument-functions}). If the file that
10435 contains a function definition matches with one of @var{file}, then
10436 that function is not instrumented. The match is done on substrings:
10437 if the @var{file} parameter is a substring of the file name, it is
10438 considered to be a match.
10439
10440 For example:
10441
10442 @smallexample
10443 -finstrument-functions-exclude-file-list=/bits/stl,include/sys
10444 @end smallexample
10445
10446 @noindent
10447 excludes any inline function defined in files whose pathnames
10448 contain @file{/bits/stl} or @file{include/sys}.
10449
10450 If, for some reason, you want to include letter @samp{,} in one of
10451 @var{sym}, write @samp{\,}. For example,
10452 @option{-finstrument-functions-exclude-file-list='\,\,tmp'}
10453 (note the single quote surrounding the option).
10454
10455 @item -finstrument-functions-exclude-function-list=@var{sym},@var{sym},@dots{}
10456 @opindex finstrument-functions-exclude-function-list
10457
10458 This is similar to @option{-finstrument-functions-exclude-file-list},
10459 but this option sets the list of function names to be excluded from
10460 instrumentation. The function name to be matched is its user-visible
10461 name, such as @code{vector<int> blah(const vector<int> &)}, not the
10462 internal mangled name (e.g., @code{_Z4blahRSt6vectorIiSaIiEE}). The
10463 match is done on substrings: if the @var{sym} parameter is a substring
10464 of the function name, it is considered to be a match. For C99 and C++
10465 extended identifiers, the function name must be given in UTF-8, not
10466 using universal character names.
10467
10468 @end table
10469
10470
10471 @node Preprocessor Options
10472 @section Options Controlling the Preprocessor
10473 @cindex preprocessor options
10474 @cindex options, preprocessor
10475
10476 These options control the C preprocessor, which is run on each C source
10477 file before actual compilation.
10478
10479 If you use the @option{-E} option, nothing is done except preprocessing.
10480 Some of these options make sense only together with @option{-E} because
10481 they cause the preprocessor output to be unsuitable for actual
10482 compilation.
10483
10484 @table @gcctabopt
10485 @item -Wp,@var{option}
10486 @opindex Wp
10487 You can use @option{-Wp,@var{option}} to bypass the compiler driver
10488 and pass @var{option} directly through to the preprocessor. If
10489 @var{option} contains commas, it is split into multiple options at the
10490 commas. However, many options are modified, translated or interpreted
10491 by the compiler driver before being passed to the preprocessor, and
10492 @option{-Wp} forcibly bypasses this phase. The preprocessor's direct
10493 interface is undocumented and subject to change, so whenever possible
10494 you should avoid using @option{-Wp} and let the driver handle the
10495 options instead.
10496
10497 @item -Xpreprocessor @var{option}
10498 @opindex Xpreprocessor
10499 Pass @var{option} as an option to the preprocessor. You can use this to
10500 supply system-specific preprocessor options that GCC does not
10501 recognize.
10502
10503 If you want to pass an option that takes an argument, you must use
10504 @option{-Xpreprocessor} twice, once for the option and once for the argument.
10505
10506 @item -no-integrated-cpp
10507 @opindex no-integrated-cpp
10508 Perform preprocessing as a separate pass before compilation.
10509 By default, GCC performs preprocessing as an integrated part of
10510 input tokenization and parsing.
10511 If this option is provided, the appropriate language front end
10512 (@command{cc1}, @command{cc1plus}, or @command{cc1obj} for C, C++,
10513 and Objective-C, respectively) is instead invoked twice,
10514 once for preprocessing only and once for actual compilation
10515 of the preprocessed input.
10516 This option may be useful in conjunction with the @option{-B} or
10517 @option{-wrapper} options to specify an alternate preprocessor or
10518 perform additional processing of the program source between
10519 normal preprocessing and compilation.
10520 @end table
10521
10522 @include cppopts.texi
10523
10524 @node Assembler Options
10525 @section Passing Options to the Assembler
10526
10527 @c prevent bad page break with this line
10528 You can pass options to the assembler.
10529
10530 @table @gcctabopt
10531 @item -Wa,@var{option}
10532 @opindex Wa
10533 Pass @var{option} as an option to the assembler. If @var{option}
10534 contains commas, it is split into multiple options at the commas.
10535
10536 @item -Xassembler @var{option}
10537 @opindex Xassembler
10538 Pass @var{option} as an option to the assembler. You can use this to
10539 supply system-specific assembler options that GCC does not
10540 recognize.
10541
10542 If you want to pass an option that takes an argument, you must use
10543 @option{-Xassembler} twice, once for the option and once for the argument.
10544
10545 @end table
10546
10547 @node Link Options
10548 @section Options for Linking
10549 @cindex link options
10550 @cindex options, linking
10551
10552 These options come into play when the compiler links object files into
10553 an executable output file. They are meaningless if the compiler is
10554 not doing a link step.
10555
10556 @table @gcctabopt
10557 @cindex file names
10558 @item @var{object-file-name}
10559 A file name that does not end in a special recognized suffix is
10560 considered to name an object file or library. (Object files are
10561 distinguished from libraries by the linker according to the file
10562 contents.) If linking is done, these object files are used as input
10563 to the linker.
10564
10565 @item -c
10566 @itemx -S
10567 @itemx -E
10568 @opindex c
10569 @opindex S
10570 @opindex E
10571 If any of these options is used, then the linker is not run, and
10572 object file names should not be used as arguments. @xref{Overall
10573 Options}.
10574
10575 @item -fuse-ld=bfd
10576 @opindex fuse-ld=bfd
10577 Use the @command{bfd} linker instead of the default linker.
10578
10579 @item -fuse-ld=gold
10580 @opindex fuse-ld=gold
10581 Use the @command{gold} linker instead of the default linker.
10582
10583 @cindex Libraries
10584 @item -l@var{library}
10585 @itemx -l @var{library}
10586 @opindex l
10587 Search the library named @var{library} when linking. (The second
10588 alternative with the library as a separate argument is only for
10589 POSIX compliance and is not recommended.)
10590
10591 It makes a difference where in the command you write this option; the
10592 linker searches and processes libraries and object files in the order they
10593 are specified. Thus, @samp{foo.o -lz bar.o} searches library @samp{z}
10594 after file @file{foo.o} but before @file{bar.o}. If @file{bar.o} refers
10595 to functions in @samp{z}, those functions may not be loaded.
10596
10597 The linker searches a standard list of directories for the library,
10598 which is actually a file named @file{lib@var{library}.a}. The linker
10599 then uses this file as if it had been specified precisely by name.
10600
10601 The directories searched include several standard system directories
10602 plus any that you specify with @option{-L}.
10603
10604 Normally the files found this way are library files---archive files
10605 whose members are object files. The linker handles an archive file by
10606 scanning through it for members which define symbols that have so far
10607 been referenced but not defined. But if the file that is found is an
10608 ordinary object file, it is linked in the usual fashion. The only
10609 difference between using an @option{-l} option and specifying a file name
10610 is that @option{-l} surrounds @var{library} with @samp{lib} and @samp{.a}
10611 and searches several directories.
10612
10613 @item -lobjc
10614 @opindex lobjc
10615 You need this special case of the @option{-l} option in order to
10616 link an Objective-C or Objective-C++ program.
10617
10618 @item -nostartfiles
10619 @opindex nostartfiles
10620 Do not use the standard system startup files when linking.
10621 The standard system libraries are used normally, unless @option{-nostdlib}
10622 or @option{-nodefaultlibs} is used.
10623
10624 @item -nodefaultlibs
10625 @opindex nodefaultlibs
10626 Do not use the standard system libraries when linking.
10627 Only the libraries you specify are passed to the linker, and options
10628 specifying linkage of the system libraries, such as @option{-static-libgcc}
10629 or @option{-shared-libgcc}, are ignored.
10630 The standard startup files are used normally, unless @option{-nostartfiles}
10631 is used.
10632
10633 The compiler may generate calls to @code{memcmp},
10634 @code{memset}, @code{memcpy} and @code{memmove}.
10635 These entries are usually resolved by entries in
10636 libc. These entry points should be supplied through some other
10637 mechanism when this option is specified.
10638
10639 @item -nostdlib
10640 @opindex nostdlib
10641 Do not use the standard system startup files or libraries when linking.
10642 No startup files and only the libraries you specify are passed to
10643 the linker, and options specifying linkage of the system libraries, such as
10644 @option{-static-libgcc} or @option{-shared-libgcc}, are ignored.
10645
10646 The compiler may generate calls to @code{memcmp}, @code{memset},
10647 @code{memcpy} and @code{memmove}.
10648 These entries are usually resolved by entries in
10649 libc. These entry points should be supplied through some other
10650 mechanism when this option is specified.
10651
10652 @cindex @option{-lgcc}, use with @option{-nostdlib}
10653 @cindex @option{-nostdlib} and unresolved references
10654 @cindex unresolved references and @option{-nostdlib}
10655 @cindex @option{-lgcc}, use with @option{-nodefaultlibs}
10656 @cindex @option{-nodefaultlibs} and unresolved references
10657 @cindex unresolved references and @option{-nodefaultlibs}
10658 One of the standard libraries bypassed by @option{-nostdlib} and
10659 @option{-nodefaultlibs} is @file{libgcc.a}, a library of internal subroutines
10660 which GCC uses to overcome shortcomings of particular machines, or special
10661 needs for some languages.
10662 (@xref{Interface,,Interfacing to GCC Output,gccint,GNU Compiler
10663 Collection (GCC) Internals},
10664 for more discussion of @file{libgcc.a}.)
10665 In most cases, you need @file{libgcc.a} even when you want to avoid
10666 other standard libraries. In other words, when you specify @option{-nostdlib}
10667 or @option{-nodefaultlibs} you should usually specify @option{-lgcc} as well.
10668 This ensures that you have no unresolved references to internal GCC
10669 library subroutines.
10670 (An example of such an internal subroutine is @code{__main}, used to ensure C++
10671 constructors are called; @pxref{Collect2,,@code{collect2}, gccint,
10672 GNU Compiler Collection (GCC) Internals}.)
10673
10674 @item -pie
10675 @opindex pie
10676 Produce a position independent executable on targets that support it.
10677 For predictable results, you must also specify the same set of options
10678 used for compilation (@option{-fpie}, @option{-fPIE},
10679 or model suboptions) when you specify this linker option.
10680
10681 @item -no-pie
10682 @opindex no-pie
10683 Don't produce a position independent executable.
10684
10685 @item -rdynamic
10686 @opindex rdynamic
10687 Pass the flag @option{-export-dynamic} to the ELF linker, on targets
10688 that support it. This instructs the linker to add all symbols, not
10689 only used ones, to the dynamic symbol table. This option is needed
10690 for some uses of @code{dlopen} or to allow obtaining backtraces
10691 from within a program.
10692
10693 @item -s
10694 @opindex s
10695 Remove all symbol table and relocation information from the executable.
10696
10697 @item -static
10698 @opindex static
10699 On systems that support dynamic linking, this prevents linking with the shared
10700 libraries. On other systems, this option has no effect.
10701
10702 @item -shared
10703 @opindex shared
10704 Produce a shared object which can then be linked with other objects to
10705 form an executable. Not all systems support this option. For predictable
10706 results, you must also specify the same set of options used for compilation
10707 (@option{-fpic}, @option{-fPIC}, or model suboptions) when
10708 you specify this linker option.@footnote{On some systems, @samp{gcc -shared}
10709 needs to build supplementary stub code for constructors to work. On
10710 multi-libbed systems, @samp{gcc -shared} must select the correct support
10711 libraries to link against. Failing to supply the correct flags may lead
10712 to subtle defects. Supplying them in cases where they are not necessary
10713 is innocuous.}
10714
10715 @item -shared-libgcc
10716 @itemx -static-libgcc
10717 @opindex shared-libgcc
10718 @opindex static-libgcc
10719 On systems that provide @file{libgcc} as a shared library, these options
10720 force the use of either the shared or static version, respectively.
10721 If no shared version of @file{libgcc} was built when the compiler was
10722 configured, these options have no effect.
10723
10724 There are several situations in which an application should use the
10725 shared @file{libgcc} instead of the static version. The most common
10726 of these is when the application wishes to throw and catch exceptions
10727 across different shared libraries. In that case, each of the libraries
10728 as well as the application itself should use the shared @file{libgcc}.
10729
10730 Therefore, the G++ and GCJ drivers automatically add
10731 @option{-shared-libgcc} whenever you build a shared library or a main
10732 executable, because C++ and Java programs typically use exceptions, so
10733 this is the right thing to do.
10734
10735 If, instead, you use the GCC driver to create shared libraries, you may
10736 find that they are not always linked with the shared @file{libgcc}.
10737 If GCC finds, at its configuration time, that you have a non-GNU linker
10738 or a GNU linker that does not support option @option{--eh-frame-hdr},
10739 it links the shared version of @file{libgcc} into shared libraries
10740 by default. Otherwise, it takes advantage of the linker and optimizes
10741 away the linking with the shared version of @file{libgcc}, linking with
10742 the static version of libgcc by default. This allows exceptions to
10743 propagate through such shared libraries, without incurring relocation
10744 costs at library load time.
10745
10746 However, if a library or main executable is supposed to throw or catch
10747 exceptions, you must link it using the G++ or GCJ driver, as appropriate
10748 for the languages used in the program, or using the option
10749 @option{-shared-libgcc}, such that it is linked with the shared
10750 @file{libgcc}.
10751
10752 @item -static-libasan
10753 @opindex static-libasan
10754 When the @option{-fsanitize=address} option is used to link a program,
10755 the GCC driver automatically links against @option{libasan}. If
10756 @file{libasan} is available as a shared library, and the @option{-static}
10757 option is not used, then this links against the shared version of
10758 @file{libasan}. The @option{-static-libasan} option directs the GCC
10759 driver to link @file{libasan} statically, without necessarily linking
10760 other libraries statically.
10761
10762 @item -static-libtsan
10763 @opindex static-libtsan
10764 When the @option{-fsanitize=thread} option is used to link a program,
10765 the GCC driver automatically links against @option{libtsan}. If
10766 @file{libtsan} is available as a shared library, and the @option{-static}
10767 option is not used, then this links against the shared version of
10768 @file{libtsan}. The @option{-static-libtsan} option directs the GCC
10769 driver to link @file{libtsan} statically, without necessarily linking
10770 other libraries statically.
10771
10772 @item -static-liblsan
10773 @opindex static-liblsan
10774 When the @option{-fsanitize=leak} option is used to link a program,
10775 the GCC driver automatically links against @option{liblsan}. If
10776 @file{liblsan} is available as a shared library, and the @option{-static}
10777 option is not used, then this links against the shared version of
10778 @file{liblsan}. The @option{-static-liblsan} option directs the GCC
10779 driver to link @file{liblsan} statically, without necessarily linking
10780 other libraries statically.
10781
10782 @item -static-libubsan
10783 @opindex static-libubsan
10784 When the @option{-fsanitize=undefined} option is used to link a program,
10785 the GCC driver automatically links against @option{libubsan}. If
10786 @file{libubsan} is available as a shared library, and the @option{-static}
10787 option is not used, then this links against the shared version of
10788 @file{libubsan}. The @option{-static-libubsan} option directs the GCC
10789 driver to link @file{libubsan} statically, without necessarily linking
10790 other libraries statically.
10791
10792 @item -static-libmpx
10793 @opindex static-libmpx
10794 When the @option{-fcheck-pointer bounds} and @option{-mmpx} options are
10795 used to link a program, the GCC driver automatically links against
10796 @file{libmpx}. If @file{libmpx} is available as a shared library,
10797 and the @option{-static} option is not used, then this links against
10798 the shared version of @file{libmpx}. The @option{-static-libmpx}
10799 option directs the GCC driver to link @file{libmpx} statically,
10800 without necessarily linking other libraries statically.
10801
10802 @item -static-libmpxwrappers
10803 @opindex static-libmpxwrappers
10804 When the @option{-fcheck-pointer bounds} and @option{-mmpx} options are used
10805 to link a program without also using @option{-fno-chkp-use-wrappers}, the
10806 GCC driver automatically links against @file{libmpxwrappers}. If
10807 @file{libmpxwrappers} is available as a shared library, and the
10808 @option{-static} option is not used, then this links against the shared
10809 version of @file{libmpxwrappers}. The @option{-static-libmpxwrappers}
10810 option directs the GCC driver to link @file{libmpxwrappers} statically,
10811 without necessarily linking other libraries statically.
10812
10813 @item -static-libstdc++
10814 @opindex static-libstdc++
10815 When the @command{g++} program is used to link a C++ program, it
10816 normally automatically links against @option{libstdc++}. If
10817 @file{libstdc++} is available as a shared library, and the
10818 @option{-static} option is not used, then this links against the
10819 shared version of @file{libstdc++}. That is normally fine. However, it
10820 is sometimes useful to freeze the version of @file{libstdc++} used by
10821 the program without going all the way to a fully static link. The
10822 @option{-static-libstdc++} option directs the @command{g++} driver to
10823 link @file{libstdc++} statically, without necessarily linking other
10824 libraries statically.
10825
10826 @item -symbolic
10827 @opindex symbolic
10828 Bind references to global symbols when building a shared object. Warn
10829 about any unresolved references (unless overridden by the link editor
10830 option @option{-Xlinker -z -Xlinker defs}). Only a few systems support
10831 this option.
10832
10833 @item -T @var{script}
10834 @opindex T
10835 @cindex linker script
10836 Use @var{script} as the linker script. This option is supported by most
10837 systems using the GNU linker. On some targets, such as bare-board
10838 targets without an operating system, the @option{-T} option may be required
10839 when linking to avoid references to undefined symbols.
10840
10841 @item -Xlinker @var{option}
10842 @opindex Xlinker
10843 Pass @var{option} as an option to the linker. You can use this to
10844 supply system-specific linker options that GCC does not recognize.
10845
10846 If you want to pass an option that takes a separate argument, you must use
10847 @option{-Xlinker} twice, once for the option and once for the argument.
10848 For example, to pass @option{-assert definitions}, you must write
10849 @option{-Xlinker -assert -Xlinker definitions}. It does not work to write
10850 @option{-Xlinker "-assert definitions"}, because this passes the entire
10851 string as a single argument, which is not what the linker expects.
10852
10853 When using the GNU linker, it is usually more convenient to pass
10854 arguments to linker options using the @option{@var{option}=@var{value}}
10855 syntax than as separate arguments. For example, you can specify
10856 @option{-Xlinker -Map=output.map} rather than
10857 @option{-Xlinker -Map -Xlinker output.map}. Other linkers may not support
10858 this syntax for command-line options.
10859
10860 @item -Wl,@var{option}
10861 @opindex Wl
10862 Pass @var{option} as an option to the linker. If @var{option} contains
10863 commas, it is split into multiple options at the commas. You can use this
10864 syntax to pass an argument to the option.
10865 For example, @option{-Wl,-Map,output.map} passes @option{-Map output.map} to the
10866 linker. When using the GNU linker, you can also get the same effect with
10867 @option{-Wl,-Map=output.map}.
10868
10869 @item -u @var{symbol}
10870 @opindex u
10871 Pretend the symbol @var{symbol} is undefined, to force linking of
10872 library modules to define it. You can use @option{-u} multiple times with
10873 different symbols to force loading of additional library modules.
10874
10875 @item -z @var{keyword}
10876 @opindex z
10877 @option{-z} is passed directly on to the linker along with the keyword
10878 @var{keyword}. See the section in the documentation of your linker for
10879 permitted values and their meanings.
10880 @end table
10881
10882 @node Directory Options
10883 @section Options for Directory Search
10884 @cindex directory options
10885 @cindex options, directory search
10886 @cindex search path
10887
10888 These options specify directories to search for header files, for
10889 libraries and for parts of the compiler:
10890
10891 @table @gcctabopt
10892 @item -I@var{dir}
10893 @opindex I
10894 Add the directory @var{dir} to the head of the list of directories to be
10895 searched for header files. This can be used to override a system header
10896 file, substituting your own version, since these directories are
10897 searched before the system header file directories. However, you should
10898 not use this option to add directories that contain vendor-supplied
10899 system header files (use @option{-isystem} for that). If you use more than
10900 one @option{-I} option, the directories are scanned in left-to-right
10901 order; the standard system directories come after.
10902
10903 If a standard system include directory, or a directory specified with
10904 @option{-isystem}, is also specified with @option{-I}, the @option{-I}
10905 option is ignored. The directory is still searched but as a
10906 system directory at its normal position in the system include chain.
10907 This is to ensure that GCC's procedure to fix buggy system headers and
10908 the ordering for the @code{include_next} directive are not inadvertently changed.
10909 If you really need to change the search order for system directories,
10910 use the @option{-nostdinc} and/or @option{-isystem} options.
10911
10912 @item -iplugindir=@var{dir}
10913 @opindex iplugindir=
10914 Set the directory to search for plugins that are passed
10915 by @option{-fplugin=@var{name}} instead of
10916 @option{-fplugin=@var{path}/@var{name}.so}. This option is not meant
10917 to be used by the user, but only passed by the driver.
10918
10919 @item -iquote@var{dir}
10920 @opindex iquote
10921 Add the directory @var{dir} to the head of the list of directories to
10922 be searched for header files only for the case of @code{#include
10923 "@var{file}"}; they are not searched for @code{#include <@var{file}>},
10924 otherwise just like @option{-I}.
10925
10926 @item -L@var{dir}
10927 @opindex L
10928 Add directory @var{dir} to the list of directories to be searched
10929 for @option{-l}.
10930
10931 @item -B@var{prefix}
10932 @opindex B
10933 This option specifies where to find the executables, libraries,
10934 include files, and data files of the compiler itself.
10935
10936 The compiler driver program runs one or more of the subprograms
10937 @command{cpp}, @command{cc1}, @command{as} and @command{ld}. It tries
10938 @var{prefix} as a prefix for each program it tries to run, both with and
10939 without @samp{@var{machine}/@var{version}/} for the corresponding target
10940 machine and compiler version.
10941
10942 For each subprogram to be run, the compiler driver first tries the
10943 @option{-B} prefix, if any. If that name is not found, or if @option{-B}
10944 is not specified, the driver tries two standard prefixes,
10945 @file{/usr/lib/gcc/} and @file{/usr/local/lib/gcc/}. If neither of
10946 those results in a file name that is found, the unmodified program
10947 name is searched for using the directories specified in your
10948 @env{PATH} environment variable.
10949
10950 The compiler checks to see if the path provided by @option{-B}
10951 refers to a directory, and if necessary it adds a directory
10952 separator character at the end of the path.
10953
10954 @option{-B} prefixes that effectively specify directory names also apply
10955 to libraries in the linker, because the compiler translates these
10956 options into @option{-L} options for the linker. They also apply to
10957 include files in the preprocessor, because the compiler translates these
10958 options into @option{-isystem} options for the preprocessor. In this case,
10959 the compiler appends @samp{include} to the prefix.
10960
10961 The runtime support file @file{libgcc.a} can also be searched for using
10962 the @option{-B} prefix, if needed. If it is not found there, the two
10963 standard prefixes above are tried, and that is all. The file is left
10964 out of the link if it is not found by those means.
10965
10966 Another way to specify a prefix much like the @option{-B} prefix is to use
10967 the environment variable @env{GCC_EXEC_PREFIX}. @xref{Environment
10968 Variables}.
10969
10970 As a special kludge, if the path provided by @option{-B} is
10971 @file{[dir/]stage@var{N}/}, where @var{N} is a number in the range 0 to
10972 9, then it is replaced by @file{[dir/]include}. This is to help
10973 with boot-strapping the compiler.
10974
10975 @item -no-canonical-prefixes
10976 @opindex no-canonical-prefixes
10977 Do not expand any symbolic links, resolve references to @samp{/../}
10978 or @samp{/./}, or make the path absolute when generating a relative
10979 prefix.
10980
10981 @item --sysroot=@var{dir}
10982 @opindex sysroot
10983 Use @var{dir} as the logical root directory for headers and libraries.
10984 For example, if the compiler normally searches for headers in
10985 @file{/usr/include} and libraries in @file{/usr/lib}, it instead
10986 searches @file{@var{dir}/usr/include} and @file{@var{dir}/usr/lib}.
10987
10988 If you use both this option and the @option{-isysroot} option, then
10989 the @option{--sysroot} option applies to libraries, but the
10990 @option{-isysroot} option applies to header files.
10991
10992 The GNU linker (beginning with version 2.16) has the necessary support
10993 for this option. If your linker does not support this option, the
10994 header file aspect of @option{--sysroot} still works, but the
10995 library aspect does not.
10996
10997 @item --no-sysroot-suffix
10998 @opindex no-sysroot-suffix
10999 For some targets, a suffix is added to the root directory specified
11000 with @option{--sysroot}, depending on the other options used, so that
11001 headers may for example be found in
11002 @file{@var{dir}/@var{suffix}/usr/include} instead of
11003 @file{@var{dir}/usr/include}. This option disables the addition of
11004 such a suffix.
11005
11006 @item -I-
11007 @opindex I-
11008 This option has been deprecated. Please use @option{-iquote} instead for
11009 @option{-I} directories before the @option{-I-} and remove the @option{-I-}
11010 option.
11011 Any directories you specify with @option{-I} options before the @option{-I-}
11012 option are searched only for the case of @code{#include "@var{file}"};
11013 they are not searched for @code{#include <@var{file}>}.
11014
11015 If additional directories are specified with @option{-I} options after
11016 the @option{-I-} option, these directories are searched for all @code{#include}
11017 directives. (Ordinarily @emph{all} @option{-I} directories are used
11018 this way.)
11019
11020 In addition, the @option{-I-} option inhibits the use of the current
11021 directory (where the current input file came from) as the first search
11022 directory for @code{#include "@var{file}"}. There is no way to
11023 override this effect of @option{-I-}. With @option{-I.} you can specify
11024 searching the directory that is current when the compiler is
11025 invoked. That is not exactly the same as what the preprocessor does
11026 by default, but it is often satisfactory.
11027
11028 @option{-I-} does not inhibit the use of the standard system directories
11029 for header files. Thus, @option{-I-} and @option{-nostdinc} are
11030 independent.
11031 @end table
11032
11033 @node Code Gen Options
11034 @section Options for Code Generation Conventions
11035 @cindex code generation conventions
11036 @cindex options, code generation
11037 @cindex run-time options
11038
11039 These machine-independent options control the interface conventions
11040 used in code generation.
11041
11042 Most of them have both positive and negative forms; the negative form
11043 of @option{-ffoo} is @option{-fno-foo}. In the table below, only
11044 one of the forms is listed---the one that is not the default. You
11045 can figure out the other form by either removing @samp{no-} or adding
11046 it.
11047
11048 @table @gcctabopt
11049 @item -fstack-reuse=@var{reuse-level}
11050 @opindex fstack_reuse
11051 This option controls stack space reuse for user declared local/auto variables
11052 and compiler generated temporaries. @var{reuse_level} can be @samp{all},
11053 @samp{named_vars}, or @samp{none}. @samp{all} enables stack reuse for all
11054 local variables and temporaries, @samp{named_vars} enables the reuse only for
11055 user defined local variables with names, and @samp{none} disables stack reuse
11056 completely. The default value is @samp{all}. The option is needed when the
11057 program extends the lifetime of a scoped local variable or a compiler generated
11058 temporary beyond the end point defined by the language. When a lifetime of
11059 a variable ends, and if the variable lives in memory, the optimizing compiler
11060 has the freedom to reuse its stack space with other temporaries or scoped
11061 local variables whose live range does not overlap with it. Legacy code extending
11062 local lifetime is likely to break with the stack reuse optimization.
11063
11064 For example,
11065
11066 @smallexample
11067 int *p;
11068 @{
11069 int local1;
11070
11071 p = &local1;
11072 local1 = 10;
11073 ....
11074 @}
11075 @{
11076 int local2;
11077 local2 = 20;
11078 ...
11079 @}
11080
11081 if (*p == 10) // out of scope use of local1
11082 @{
11083
11084 @}
11085 @end smallexample
11086
11087 Another example:
11088 @smallexample
11089
11090 struct A
11091 @{
11092 A(int k) : i(k), j(k) @{ @}
11093 int i;
11094 int j;
11095 @};
11096
11097 A *ap;
11098
11099 void foo(const A& ar)
11100 @{
11101 ap = &ar;
11102 @}
11103
11104 void bar()
11105 @{
11106 foo(A(10)); // temp object's lifetime ends when foo returns
11107
11108 @{
11109 A a(20);
11110 ....
11111 @}
11112 ap->i+= 10; // ap references out of scope temp whose space
11113 // is reused with a. What is the value of ap->i?
11114 @}
11115
11116 @end smallexample
11117
11118 The lifetime of a compiler generated temporary is well defined by the C++
11119 standard. When a lifetime of a temporary ends, and if the temporary lives
11120 in memory, the optimizing compiler has the freedom to reuse its stack
11121 space with other temporaries or scoped local variables whose live range
11122 does not overlap with it. However some of the legacy code relies on
11123 the behavior of older compilers in which temporaries' stack space is
11124 not reused, the aggressive stack reuse can lead to runtime errors. This
11125 option is used to control the temporary stack reuse optimization.
11126
11127 @item -ftrapv
11128 @opindex ftrapv
11129 This option generates traps for signed overflow on addition, subtraction,
11130 multiplication operations.
11131 The options @option{-ftrapv} and @option{-fwrapv} override each other, so using
11132 @option{-ftrapv} @option{-fwrapv} on the command-line results in
11133 @option{-fwrapv} being effective. Note that only active options override, so
11134 using @option{-ftrapv} @option{-fwrapv} @option{-fno-wrapv} on the command-line
11135 results in @option{-ftrapv} being effective.
11136
11137 @item -fwrapv
11138 @opindex fwrapv
11139 This option instructs the compiler to assume that signed arithmetic
11140 overflow of addition, subtraction and multiplication wraps around
11141 using twos-complement representation. This flag enables some optimizations
11142 and disables others. This option is enabled by default for the Java
11143 front end, as required by the Java language specification.
11144 The options @option{-ftrapv} and @option{-fwrapv} override each other, so using
11145 @option{-ftrapv} @option{-fwrapv} on the command-line results in
11146 @option{-fwrapv} being effective. Note that only active options override, so
11147 using @option{-ftrapv} @option{-fwrapv} @option{-fno-wrapv} on the command-line
11148 results in @option{-ftrapv} being effective.
11149
11150 @item -fexceptions
11151 @opindex fexceptions
11152 Enable exception handling. Generates extra code needed to propagate
11153 exceptions. For some targets, this implies GCC generates frame
11154 unwind information for all functions, which can produce significant data
11155 size overhead, although it does not affect execution. If you do not
11156 specify this option, GCC enables it by default for languages like
11157 C++ that normally require exception handling, and disables it for
11158 languages like C that do not normally require it. However, you may need
11159 to enable this option when compiling C code that needs to interoperate
11160 properly with exception handlers written in C++. You may also wish to
11161 disable this option if you are compiling older C++ programs that don't
11162 use exception handling.
11163
11164 @item -fnon-call-exceptions
11165 @opindex fnon-call-exceptions
11166 Generate code that allows trapping instructions to throw exceptions.
11167 Note that this requires platform-specific runtime support that does
11168 not exist everywhere. Moreover, it only allows @emph{trapping}
11169 instructions to throw exceptions, i.e.@: memory references or floating-point
11170 instructions. It does not allow exceptions to be thrown from
11171 arbitrary signal handlers such as @code{SIGALRM}.
11172
11173 @item -fdelete-dead-exceptions
11174 @opindex fdelete-dead-exceptions
11175 Consider that instructions that may throw exceptions but don't otherwise
11176 contribute to the execution of the program can be optimized away.
11177 This option is enabled by default for the Ada front end, as permitted by
11178 the Ada language specification.
11179 Optimization passes that cause dead exceptions to be removed are enabled independently at different optimization levels.
11180
11181 @item -funwind-tables
11182 @opindex funwind-tables
11183 Similar to @option{-fexceptions}, except that it just generates any needed
11184 static data, but does not affect the generated code in any other way.
11185 You normally do not need to enable this option; instead, a language processor
11186 that needs this handling enables it on your behalf.
11187
11188 @item -fasynchronous-unwind-tables
11189 @opindex fasynchronous-unwind-tables
11190 Generate unwind table in DWARF format, if supported by target machine. The
11191 table is exact at each instruction boundary, so it can be used for stack
11192 unwinding from asynchronous events (such as debugger or garbage collector).
11193
11194 @item -fno-gnu-unique
11195 @opindex fno-gnu-unique
11196 On systems with recent GNU assembler and C library, the C++ compiler
11197 uses the @code{STB_GNU_UNIQUE} binding to make sure that definitions
11198 of template static data members and static local variables in inline
11199 functions are unique even in the presence of @code{RTLD_LOCAL}; this
11200 is necessary to avoid problems with a library used by two different
11201 @code{RTLD_LOCAL} plugins depending on a definition in one of them and
11202 therefore disagreeing with the other one about the binding of the
11203 symbol. But this causes @code{dlclose} to be ignored for affected
11204 DSOs; if your program relies on reinitialization of a DSO via
11205 @code{dlclose} and @code{dlopen}, you can use
11206 @option{-fno-gnu-unique}.
11207
11208 @item -fpcc-struct-return
11209 @opindex fpcc-struct-return
11210 Return ``short'' @code{struct} and @code{union} values in memory like
11211 longer ones, rather than in registers. This convention is less
11212 efficient, but it has the advantage of allowing intercallability between
11213 GCC-compiled files and files compiled with other compilers, particularly
11214 the Portable C Compiler (pcc).
11215
11216 The precise convention for returning structures in memory depends
11217 on the target configuration macros.
11218
11219 Short structures and unions are those whose size and alignment match
11220 that of some integer type.
11221
11222 @strong{Warning:} code compiled with the @option{-fpcc-struct-return}
11223 switch is not binary compatible with code compiled with the
11224 @option{-freg-struct-return} switch.
11225 Use it to conform to a non-default application binary interface.
11226
11227 @item -freg-struct-return
11228 @opindex freg-struct-return
11229 Return @code{struct} and @code{union} values in registers when possible.
11230 This is more efficient for small structures than
11231 @option{-fpcc-struct-return}.
11232
11233 If you specify neither @option{-fpcc-struct-return} nor
11234 @option{-freg-struct-return}, GCC defaults to whichever convention is
11235 standard for the target. If there is no standard convention, GCC
11236 defaults to @option{-fpcc-struct-return}, except on targets where GCC is
11237 the principal compiler. In those cases, we can choose the standard, and
11238 we chose the more efficient register return alternative.
11239
11240 @strong{Warning:} code compiled with the @option{-freg-struct-return}
11241 switch is not binary compatible with code compiled with the
11242 @option{-fpcc-struct-return} switch.
11243 Use it to conform to a non-default application binary interface.
11244
11245 @item -fshort-enums
11246 @opindex fshort-enums
11247 Allocate to an @code{enum} type only as many bytes as it needs for the
11248 declared range of possible values. Specifically, the @code{enum} type
11249 is equivalent to the smallest integer type that has enough room.
11250
11251 @strong{Warning:} the @option{-fshort-enums} switch causes GCC to generate
11252 code that is not binary compatible with code generated without that switch.
11253 Use it to conform to a non-default application binary interface.
11254
11255 @item -fshort-wchar
11256 @opindex fshort-wchar
11257 Override the underlying type for @code{wchar_t} to be @code{short
11258 unsigned int} instead of the default for the target. This option is
11259 useful for building programs to run under WINE@.
11260
11261 @strong{Warning:} the @option{-fshort-wchar} switch causes GCC to generate
11262 code that is not binary compatible with code generated without that switch.
11263 Use it to conform to a non-default application binary interface.
11264
11265 @item -fno-common
11266 @opindex fno-common
11267 In C code, controls the placement of uninitialized global variables.
11268 Unix C compilers have traditionally permitted multiple definitions of
11269 such variables in different compilation units by placing the variables
11270 in a common block.
11271 This is the behavior specified by @option{-fcommon}, and is the default
11272 for GCC on most targets.
11273 On the other hand, this behavior is not required by ISO C, and on some
11274 targets may carry a speed or code size penalty on variable references.
11275 The @option{-fno-common} option specifies that the compiler should place
11276 uninitialized global variables in the data section of the object file,
11277 rather than generating them as common blocks.
11278 This has the effect that if the same variable is declared
11279 (without @code{extern}) in two different compilations,
11280 you get a multiple-definition error when you link them.
11281 In this case, you must compile with @option{-fcommon} instead.
11282 Compiling with @option{-fno-common} is useful on targets for which
11283 it provides better performance, or if you wish to verify that the
11284 program will work on other systems that always treat uninitialized
11285 variable declarations this way.
11286
11287 @item -fno-ident
11288 @opindex fno-ident
11289 Ignore the @code{#ident} directive.
11290
11291 @item -finhibit-size-directive
11292 @opindex finhibit-size-directive
11293 Don't output a @code{.size} assembler directive, or anything else that
11294 would cause trouble if the function is split in the middle, and the
11295 two halves are placed at locations far apart in memory. This option is
11296 used when compiling @file{crtstuff.c}; you should not need to use it
11297 for anything else.
11298
11299 @item -fverbose-asm
11300 @opindex fverbose-asm
11301 Put extra commentary information in the generated assembly code to
11302 make it more readable. This option is generally only of use to those
11303 who actually need to read the generated assembly code (perhaps while
11304 debugging the compiler itself).
11305
11306 @option{-fno-verbose-asm}, the default, causes the
11307 extra information to be omitted and is useful when comparing two assembler
11308 files.
11309
11310 @item -frecord-gcc-switches
11311 @opindex frecord-gcc-switches
11312 This switch causes the command line used to invoke the
11313 compiler to be recorded into the object file that is being created.
11314 This switch is only implemented on some targets and the exact format
11315 of the recording is target and binary file format dependent, but it
11316 usually takes the form of a section containing ASCII text. This
11317 switch is related to the @option{-fverbose-asm} switch, but that
11318 switch only records information in the assembler output file as
11319 comments, so it never reaches the object file.
11320 See also @option{-grecord-gcc-switches} for another
11321 way of storing compiler options into the object file.
11322
11323 @item -fpic
11324 @opindex fpic
11325 @cindex global offset table
11326 @cindex PIC
11327 Generate position-independent code (PIC) suitable for use in a shared
11328 library, if supported for the target machine. Such code accesses all
11329 constant addresses through a global offset table (GOT)@. The dynamic
11330 loader resolves the GOT entries when the program starts (the dynamic
11331 loader is not part of GCC; it is part of the operating system). If
11332 the GOT size for the linked executable exceeds a machine-specific
11333 maximum size, you get an error message from the linker indicating that
11334 @option{-fpic} does not work; in that case, recompile with @option{-fPIC}
11335 instead. (These maximums are 8k on the SPARC, 28k on AArch64 and 32k
11336 on the m68k and RS/6000. The x86 has no such limit.)
11337
11338 Position-independent code requires special support, and therefore works
11339 only on certain machines. For the x86, GCC supports PIC for System V
11340 but not for the Sun 386i. Code generated for the IBM RS/6000 is always
11341 position-independent.
11342
11343 When this flag is set, the macros @code{__pic__} and @code{__PIC__}
11344 are defined to 1.
11345
11346 @item -fPIC
11347 @opindex fPIC
11348 If supported for the target machine, emit position-independent code,
11349 suitable for dynamic linking and avoiding any limit on the size of the
11350 global offset table. This option makes a difference on AArch64, m68k,
11351 PowerPC and SPARC@.
11352
11353 Position-independent code requires special support, and therefore works
11354 only on certain machines.
11355
11356 When this flag is set, the macros @code{__pic__} and @code{__PIC__}
11357 are defined to 2.
11358
11359 @item -fpie
11360 @itemx -fPIE
11361 @opindex fpie
11362 @opindex fPIE
11363 These options are similar to @option{-fpic} and @option{-fPIC}, but
11364 generated position independent code can be only linked into executables.
11365 Usually these options are used when @option{-pie} GCC option is
11366 used during linking.
11367
11368 @option{-fpie} and @option{-fPIE} both define the macros
11369 @code{__pie__} and @code{__PIE__}. The macros have the value 1
11370 for @option{-fpie} and 2 for @option{-fPIE}.
11371
11372 @item -fno-plt
11373 @opindex fno-plt
11374 Do not use the PLT for external function calls in position-independent code.
11375 Instead, load the callee address at call sites from the GOT and branch to it.
11376 This leads to more efficient code by eliminating PLT stubs and exposing
11377 GOT loads to optimizations. On architectures such as 32-bit x86 where
11378 PLT stubs expect the GOT pointer in a specific register, this gives more
11379 register allocation freedom to the compiler.
11380 Lazy binding requires use of the PLT;
11381 with @option{-fno-plt} all external symbols are resolved at load time.
11382
11383 Alternatively, the function attribute @code{noplt} can be used to avoid calls
11384 through the PLT for specific external functions.
11385
11386 In position-dependent code, a few targets also convert calls to
11387 functions that are marked to not use the PLT to use the GOT instead.
11388
11389 @item -fno-jump-tables
11390 @opindex fno-jump-tables
11391 Do not use jump tables for switch statements even where it would be
11392 more efficient than other code generation strategies. This option is
11393 of use in conjunction with @option{-fpic} or @option{-fPIC} for
11394 building code that forms part of a dynamic linker and cannot
11395 reference the address of a jump table. On some targets, jump tables
11396 do not require a GOT and this option is not needed.
11397
11398 @item -ffixed-@var{reg}
11399 @opindex ffixed
11400 Treat the register named @var{reg} as a fixed register; generated code
11401 should never refer to it (except perhaps as a stack pointer, frame
11402 pointer or in some other fixed role).
11403
11404 @var{reg} must be the name of a register. The register names accepted
11405 are machine-specific and are defined in the @code{REGISTER_NAMES}
11406 macro in the machine description macro file.
11407
11408 This flag does not have a negative form, because it specifies a
11409 three-way choice.
11410
11411 @item -fcall-used-@var{reg}
11412 @opindex fcall-used
11413 Treat the register named @var{reg} as an allocable register that is
11414 clobbered by function calls. It may be allocated for temporaries or
11415 variables that do not live across a call. Functions compiled this way
11416 do not save and restore the register @var{reg}.
11417
11418 It is an error to use this flag with the frame pointer or stack pointer.
11419 Use of this flag for other registers that have fixed pervasive roles in
11420 the machine's execution model produces disastrous results.
11421
11422 This flag does not have a negative form, because it specifies a
11423 three-way choice.
11424
11425 @item -fcall-saved-@var{reg}
11426 @opindex fcall-saved
11427 Treat the register named @var{reg} as an allocable register saved by
11428 functions. It may be allocated even for temporaries or variables that
11429 live across a call. Functions compiled this way save and restore
11430 the register @var{reg} if they use it.
11431
11432 It is an error to use this flag with the frame pointer or stack pointer.
11433 Use of this flag for other registers that have fixed pervasive roles in
11434 the machine's execution model produces disastrous results.
11435
11436 A different sort of disaster results from the use of this flag for
11437 a register in which function values may be returned.
11438
11439 This flag does not have a negative form, because it specifies a
11440 three-way choice.
11441
11442 @item -fpack-struct[=@var{n}]
11443 @opindex fpack-struct
11444 Without a value specified, pack all structure members together without
11445 holes. When a value is specified (which must be a small power of two), pack
11446 structure members according to this value, representing the maximum
11447 alignment (that is, objects with default alignment requirements larger than
11448 this are output potentially unaligned at the next fitting location.
11449
11450 @strong{Warning:} the @option{-fpack-struct} switch causes GCC to generate
11451 code that is not binary compatible with code generated without that switch.
11452 Additionally, it makes the code suboptimal.
11453 Use it to conform to a non-default application binary interface.
11454
11455 @item -fleading-underscore
11456 @opindex fleading-underscore
11457 This option and its counterpart, @option{-fno-leading-underscore}, forcibly
11458 change the way C symbols are represented in the object file. One use
11459 is to help link with legacy assembly code.
11460
11461 @strong{Warning:} the @option{-fleading-underscore} switch causes GCC to
11462 generate code that is not binary compatible with code generated without that
11463 switch. Use it to conform to a non-default application binary interface.
11464 Not all targets provide complete support for this switch.
11465
11466 @item -ftls-model=@var{model}
11467 @opindex ftls-model
11468 Alter the thread-local storage model to be used (@pxref{Thread-Local}).
11469 The @var{model} argument should be one of @samp{global-dynamic},
11470 @samp{local-dynamic}, @samp{initial-exec} or @samp{local-exec}.
11471 Note that the choice is subject to optimization: the compiler may use
11472 a more efficient model for symbols not visible outside of the translation
11473 unit, or if @option{-fpic} is not given on the command line.
11474
11475 The default without @option{-fpic} is @samp{initial-exec}; with
11476 @option{-fpic} the default is @samp{global-dynamic}.
11477
11478 @item -fvisibility=@r{[}default@r{|}internal@r{|}hidden@r{|}protected@r{]}
11479 @opindex fvisibility
11480 Set the default ELF image symbol visibility to the specified option---all
11481 symbols are marked with this unless overridden within the code.
11482 Using this feature can very substantially improve linking and
11483 load times of shared object libraries, produce more optimized
11484 code, provide near-perfect API export and prevent symbol clashes.
11485 It is @strong{strongly} recommended that you use this in any shared objects
11486 you distribute.
11487
11488 Despite the nomenclature, @samp{default} always means public; i.e.,
11489 available to be linked against from outside the shared object.
11490 @samp{protected} and @samp{internal} are pretty useless in real-world
11491 usage so the only other commonly used option is @samp{hidden}.
11492 The default if @option{-fvisibility} isn't specified is
11493 @samp{default}, i.e., make every symbol public.
11494
11495 A good explanation of the benefits offered by ensuring ELF
11496 symbols have the correct visibility is given by ``How To Write
11497 Shared Libraries'' by Ulrich Drepper (which can be found at
11498 @w{@uref{http://www.akkadia.org/drepper/}})---however a superior
11499 solution made possible by this option to marking things hidden when
11500 the default is public is to make the default hidden and mark things
11501 public. This is the norm with DLLs on Windows and with @option{-fvisibility=hidden}
11502 and @code{__attribute__ ((visibility("default")))} instead of
11503 @code{__declspec(dllexport)} you get almost identical semantics with
11504 identical syntax. This is a great boon to those working with
11505 cross-platform projects.
11506
11507 For those adding visibility support to existing code, you may find
11508 @code{#pragma GCC visibility} of use. This works by you enclosing
11509 the declarations you wish to set visibility for with (for example)
11510 @code{#pragma GCC visibility push(hidden)} and
11511 @code{#pragma GCC visibility pop}.
11512 Bear in mind that symbol visibility should be viewed @strong{as
11513 part of the API interface contract} and thus all new code should
11514 always specify visibility when it is not the default; i.e., declarations
11515 only for use within the local DSO should @strong{always} be marked explicitly
11516 as hidden as so to avoid PLT indirection overheads---making this
11517 abundantly clear also aids readability and self-documentation of the code.
11518 Note that due to ISO C++ specification requirements, @code{operator new} and
11519 @code{operator delete} must always be of default visibility.
11520
11521 Be aware that headers from outside your project, in particular system
11522 headers and headers from any other library you use, may not be
11523 expecting to be compiled with visibility other than the default. You
11524 may need to explicitly say @code{#pragma GCC visibility push(default)}
11525 before including any such headers.
11526
11527 @code{extern} declarations are not affected by @option{-fvisibility}, so
11528 a lot of code can be recompiled with @option{-fvisibility=hidden} with
11529 no modifications. However, this means that calls to @code{extern}
11530 functions with no explicit visibility use the PLT, so it is more
11531 effective to use @code{__attribute ((visibility))} and/or
11532 @code{#pragma GCC visibility} to tell the compiler which @code{extern}
11533 declarations should be treated as hidden.
11534
11535 Note that @option{-fvisibility} does affect C++ vague linkage
11536 entities. This means that, for instance, an exception class that is
11537 be thrown between DSOs must be explicitly marked with default
11538 visibility so that the @samp{type_info} nodes are unified between
11539 the DSOs.
11540
11541 An overview of these techniques, their benefits and how to use them
11542 is at @uref{http://gcc.gnu.org/@/wiki/@/Visibility}.
11543
11544 @item -fstrict-volatile-bitfields
11545 @opindex fstrict-volatile-bitfields
11546 This option should be used if accesses to volatile bit-fields (or other
11547 structure fields, although the compiler usually honors those types
11548 anyway) should use a single access of the width of the
11549 field's type, aligned to a natural alignment if possible. For
11550 example, targets with memory-mapped peripheral registers might require
11551 all such accesses to be 16 bits wide; with this flag you can
11552 declare all peripheral bit-fields as @code{unsigned short} (assuming short
11553 is 16 bits on these targets) to force GCC to use 16-bit accesses
11554 instead of, perhaps, a more efficient 32-bit access.
11555
11556 If this option is disabled, the compiler uses the most efficient
11557 instruction. In the previous example, that might be a 32-bit load
11558 instruction, even though that accesses bytes that do not contain
11559 any portion of the bit-field, or memory-mapped registers unrelated to
11560 the one being updated.
11561
11562 In some cases, such as when the @code{packed} attribute is applied to a
11563 structure field, it may not be possible to access the field with a single
11564 read or write that is correctly aligned for the target machine. In this
11565 case GCC falls back to generating multiple accesses rather than code that
11566 will fault or truncate the result at run time.
11567
11568 Note: Due to restrictions of the C/C++11 memory model, write accesses are
11569 not allowed to touch non bit-field members. It is therefore recommended
11570 to define all bits of the field's type as bit-field members.
11571
11572 The default value of this option is determined by the application binary
11573 interface for the target processor.
11574
11575 @item -fsync-libcalls
11576 @opindex fsync-libcalls
11577 This option controls whether any out-of-line instance of the @code{__sync}
11578 family of functions may be used to implement the C++11 @code{__atomic}
11579 family of functions.
11580
11581 The default value of this option is enabled, thus the only useful form
11582 of the option is @option{-fno-sync-libcalls}. This option is used in
11583 the implementation of the @file{libatomic} runtime library.
11584
11585 @end table
11586
11587 @node Developer Options
11588 @section GCC Developer Options
11589 @cindex developer options
11590 @cindex debugging GCC
11591 @cindex debug dump options
11592 @cindex dump options
11593 @cindex compilation statistics
11594
11595 This section describes command-line options that are primarily of
11596 interest to GCC developers, including options to support compiler
11597 testing and investigation of compiler bugs and compile-time
11598 performance problems. This includes options that produce debug dumps
11599 at various points in the compilation; that print statistics such as
11600 memory use and execution time; and that print information about GCC's
11601 configuration, such as where it searches for libraries. You should
11602 rarely need to use any of these options for ordinary compilation and
11603 linking tasks.
11604
11605 @table @gcctabopt
11606
11607 @item -d@var{letters}
11608 @itemx -fdump-rtl-@var{pass}
11609 @itemx -fdump-rtl-@var{pass}=@var{filename}
11610 @opindex d
11611 @opindex fdump-rtl-@var{pass}
11612 Says to make debugging dumps during compilation at times specified by
11613 @var{letters}. This is used for debugging the RTL-based passes of the
11614 compiler. The file names for most of the dumps are made by appending
11615 a pass number and a word to the @var{dumpname}, and the files are
11616 created in the directory of the output file. In case of
11617 @option{=@var{filename}} option, the dump is output on the given file
11618 instead of the pass numbered dump files. Note that the pass number is
11619 assigned as passes are registered into the pass manager. Most passes
11620 are registered in the order that they will execute and for these passes
11621 the number corresponds to the pass execution order. However, passes
11622 registered by plugins, passes specific to compilation targets, or
11623 passes that are otherwise registered after all the other passes are
11624 numbered higher than a pass named "final", even if they are executed
11625 earlier. @var{dumpname} is generated from the name of the output
11626 file if explicitly specified and not an executable, otherwise it is
11627 the basename of the source file. These switches may have different
11628 effects when @option{-E} is used for preprocessing.
11629
11630 Debug dumps can be enabled with a @option{-fdump-rtl} switch or some
11631 @option{-d} option @var{letters}. Here are the possible
11632 letters for use in @var{pass} and @var{letters}, and their meanings:
11633
11634 @table @gcctabopt
11635
11636 @item -fdump-rtl-alignments
11637 @opindex fdump-rtl-alignments
11638 Dump after branch alignments have been computed.
11639
11640 @item -fdump-rtl-asmcons
11641 @opindex fdump-rtl-asmcons
11642 Dump after fixing rtl statements that have unsatisfied in/out constraints.
11643
11644 @item -fdump-rtl-auto_inc_dec
11645 @opindex fdump-rtl-auto_inc_dec
11646 Dump after auto-inc-dec discovery. This pass is only run on
11647 architectures that have auto inc or auto dec instructions.
11648
11649 @item -fdump-rtl-barriers
11650 @opindex fdump-rtl-barriers
11651 Dump after cleaning up the barrier instructions.
11652
11653 @item -fdump-rtl-bbpart
11654 @opindex fdump-rtl-bbpart
11655 Dump after partitioning hot and cold basic blocks.
11656
11657 @item -fdump-rtl-bbro
11658 @opindex fdump-rtl-bbro
11659 Dump after block reordering.
11660
11661 @item -fdump-rtl-btl1
11662 @itemx -fdump-rtl-btl2
11663 @opindex fdump-rtl-btl2
11664 @opindex fdump-rtl-btl2
11665 @option{-fdump-rtl-btl1} and @option{-fdump-rtl-btl2} enable dumping
11666 after the two branch
11667 target load optimization passes.
11668
11669 @item -fdump-rtl-bypass
11670 @opindex fdump-rtl-bypass
11671 Dump after jump bypassing and control flow optimizations.
11672
11673 @item -fdump-rtl-combine
11674 @opindex fdump-rtl-combine
11675 Dump after the RTL instruction combination pass.
11676
11677 @item -fdump-rtl-compgotos
11678 @opindex fdump-rtl-compgotos
11679 Dump after duplicating the computed gotos.
11680
11681 @item -fdump-rtl-ce1
11682 @itemx -fdump-rtl-ce2
11683 @itemx -fdump-rtl-ce3
11684 @opindex fdump-rtl-ce1
11685 @opindex fdump-rtl-ce2
11686 @opindex fdump-rtl-ce3
11687 @option{-fdump-rtl-ce1}, @option{-fdump-rtl-ce2}, and
11688 @option{-fdump-rtl-ce3} enable dumping after the three
11689 if conversion passes.
11690
11691 @item -fdump-rtl-cprop_hardreg
11692 @opindex fdump-rtl-cprop_hardreg
11693 Dump after hard register copy propagation.
11694
11695 @item -fdump-rtl-csa
11696 @opindex fdump-rtl-csa
11697 Dump after combining stack adjustments.
11698
11699 @item -fdump-rtl-cse1
11700 @itemx -fdump-rtl-cse2
11701 @opindex fdump-rtl-cse1
11702 @opindex fdump-rtl-cse2
11703 @option{-fdump-rtl-cse1} and @option{-fdump-rtl-cse2} enable dumping after
11704 the two common subexpression elimination passes.
11705
11706 @item -fdump-rtl-dce
11707 @opindex fdump-rtl-dce
11708 Dump after the standalone dead code elimination passes.
11709
11710 @item -fdump-rtl-dbr
11711 @opindex fdump-rtl-dbr
11712 Dump after delayed branch scheduling.
11713
11714 @item -fdump-rtl-dce1
11715 @itemx -fdump-rtl-dce2
11716 @opindex fdump-rtl-dce1
11717 @opindex fdump-rtl-dce2
11718 @option{-fdump-rtl-dce1} and @option{-fdump-rtl-dce2} enable dumping after
11719 the two dead store elimination passes.
11720
11721 @item -fdump-rtl-eh
11722 @opindex fdump-rtl-eh
11723 Dump after finalization of EH handling code.
11724
11725 @item -fdump-rtl-eh_ranges
11726 @opindex fdump-rtl-eh_ranges
11727 Dump after conversion of EH handling range regions.
11728
11729 @item -fdump-rtl-expand
11730 @opindex fdump-rtl-expand
11731 Dump after RTL generation.
11732
11733 @item -fdump-rtl-fwprop1
11734 @itemx -fdump-rtl-fwprop2
11735 @opindex fdump-rtl-fwprop1
11736 @opindex fdump-rtl-fwprop2
11737 @option{-fdump-rtl-fwprop1} and @option{-fdump-rtl-fwprop2} enable
11738 dumping after the two forward propagation passes.
11739
11740 @item -fdump-rtl-gcse1
11741 @itemx -fdump-rtl-gcse2
11742 @opindex fdump-rtl-gcse1
11743 @opindex fdump-rtl-gcse2
11744 @option{-fdump-rtl-gcse1} and @option{-fdump-rtl-gcse2} enable dumping
11745 after global common subexpression elimination.
11746
11747 @item -fdump-rtl-init-regs
11748 @opindex fdump-rtl-init-regs
11749 Dump after the initialization of the registers.
11750
11751 @item -fdump-rtl-initvals
11752 @opindex fdump-rtl-initvals
11753 Dump after the computation of the initial value sets.
11754
11755 @item -fdump-rtl-into_cfglayout
11756 @opindex fdump-rtl-into_cfglayout
11757 Dump after converting to cfglayout mode.
11758
11759 @item -fdump-rtl-ira
11760 @opindex fdump-rtl-ira
11761 Dump after iterated register allocation.
11762
11763 @item -fdump-rtl-jump
11764 @opindex fdump-rtl-jump
11765 Dump after the second jump optimization.
11766
11767 @item -fdump-rtl-loop2
11768 @opindex fdump-rtl-loop2
11769 @option{-fdump-rtl-loop2} enables dumping after the rtl
11770 loop optimization passes.
11771
11772 @item -fdump-rtl-mach
11773 @opindex fdump-rtl-mach
11774 Dump after performing the machine dependent reorganization pass, if that
11775 pass exists.
11776
11777 @item -fdump-rtl-mode_sw
11778 @opindex fdump-rtl-mode_sw
11779 Dump after removing redundant mode switches.
11780
11781 @item -fdump-rtl-rnreg
11782 @opindex fdump-rtl-rnreg
11783 Dump after register renumbering.
11784
11785 @item -fdump-rtl-outof_cfglayout
11786 @opindex fdump-rtl-outof_cfglayout
11787 Dump after converting from cfglayout mode.
11788
11789 @item -fdump-rtl-peephole2
11790 @opindex fdump-rtl-peephole2
11791 Dump after the peephole pass.
11792
11793 @item -fdump-rtl-postreload
11794 @opindex fdump-rtl-postreload
11795 Dump after post-reload optimizations.
11796
11797 @item -fdump-rtl-pro_and_epilogue
11798 @opindex fdump-rtl-pro_and_epilogue
11799 Dump after generating the function prologues and epilogues.
11800
11801 @item -fdump-rtl-sched1
11802 @itemx -fdump-rtl-sched2
11803 @opindex fdump-rtl-sched1
11804 @opindex fdump-rtl-sched2
11805 @option{-fdump-rtl-sched1} and @option{-fdump-rtl-sched2} enable dumping
11806 after the basic block scheduling passes.
11807
11808 @item -fdump-rtl-ree
11809 @opindex fdump-rtl-ree
11810 Dump after sign/zero extension elimination.
11811
11812 @item -fdump-rtl-seqabstr
11813 @opindex fdump-rtl-seqabstr
11814 Dump after common sequence discovery.
11815
11816 @item -fdump-rtl-shorten
11817 @opindex fdump-rtl-shorten
11818 Dump after shortening branches.
11819
11820 @item -fdump-rtl-sibling
11821 @opindex fdump-rtl-sibling
11822 Dump after sibling call optimizations.
11823
11824 @item -fdump-rtl-split1
11825 @itemx -fdump-rtl-split2
11826 @itemx -fdump-rtl-split3
11827 @itemx -fdump-rtl-split4
11828 @itemx -fdump-rtl-split5
11829 @opindex fdump-rtl-split1
11830 @opindex fdump-rtl-split2
11831 @opindex fdump-rtl-split3
11832 @opindex fdump-rtl-split4
11833 @opindex fdump-rtl-split5
11834 These options enable dumping after five rounds of
11835 instruction splitting.
11836
11837 @item -fdump-rtl-sms
11838 @opindex fdump-rtl-sms
11839 Dump after modulo scheduling. This pass is only run on some
11840 architectures.
11841
11842 @item -fdump-rtl-stack
11843 @opindex fdump-rtl-stack
11844 Dump after conversion from GCC's ``flat register file'' registers to the
11845 x87's stack-like registers. This pass is only run on x86 variants.
11846
11847 @item -fdump-rtl-subreg1
11848 @itemx -fdump-rtl-subreg2
11849 @opindex fdump-rtl-subreg1
11850 @opindex fdump-rtl-subreg2
11851 @option{-fdump-rtl-subreg1} and @option{-fdump-rtl-subreg2} enable dumping after
11852 the two subreg expansion passes.
11853
11854 @item -fdump-rtl-unshare
11855 @opindex fdump-rtl-unshare
11856 Dump after all rtl has been unshared.
11857
11858 @item -fdump-rtl-vartrack
11859 @opindex fdump-rtl-vartrack
11860 Dump after variable tracking.
11861
11862 @item -fdump-rtl-vregs
11863 @opindex fdump-rtl-vregs
11864 Dump after converting virtual registers to hard registers.
11865
11866 @item -fdump-rtl-web
11867 @opindex fdump-rtl-web
11868 Dump after live range splitting.
11869
11870 @item -fdump-rtl-regclass
11871 @itemx -fdump-rtl-subregs_of_mode_init
11872 @itemx -fdump-rtl-subregs_of_mode_finish
11873 @itemx -fdump-rtl-dfinit
11874 @itemx -fdump-rtl-dfinish
11875 @opindex fdump-rtl-regclass
11876 @opindex fdump-rtl-subregs_of_mode_init
11877 @opindex fdump-rtl-subregs_of_mode_finish
11878 @opindex fdump-rtl-dfinit
11879 @opindex fdump-rtl-dfinish
11880 These dumps are defined but always produce empty files.
11881
11882 @item -da
11883 @itemx -fdump-rtl-all
11884 @opindex da
11885 @opindex fdump-rtl-all
11886 Produce all the dumps listed above.
11887
11888 @item -dA
11889 @opindex dA
11890 Annotate the assembler output with miscellaneous debugging information.
11891
11892 @item -dD
11893 @opindex dD
11894 Dump all macro definitions, at the end of preprocessing, in addition to
11895 normal output.
11896
11897 @item -dH
11898 @opindex dH
11899 Produce a core dump whenever an error occurs.
11900
11901 @item -dp
11902 @opindex dp
11903 Annotate the assembler output with a comment indicating which
11904 pattern and alternative is used. The length of each instruction is
11905 also printed.
11906
11907 @item -dP
11908 @opindex dP
11909 Dump the RTL in the assembler output as a comment before each instruction.
11910 Also turns on @option{-dp} annotation.
11911
11912 @item -dx
11913 @opindex dx
11914 Just generate RTL for a function instead of compiling it. Usually used
11915 with @option{-fdump-rtl-expand}.
11916 @end table
11917
11918 @item -fdump-noaddr
11919 @opindex fdump-noaddr
11920 When doing debugging dumps, suppress address output. This makes it more
11921 feasible to use diff on debugging dumps for compiler invocations with
11922 different compiler binaries and/or different
11923 text / bss / data / heap / stack / dso start locations.
11924
11925 @item -freport-bug
11926 @opindex freport-bug
11927 Collect and dump debug information into a temporary file if an
11928 internal compiler error (ICE) occurs.
11929
11930 @item -fdump-unnumbered
11931 @opindex fdump-unnumbered
11932 When doing debugging dumps, suppress instruction numbers and address output.
11933 This makes it more feasible to use diff on debugging dumps for compiler
11934 invocations with different options, in particular with and without
11935 @option{-g}.
11936
11937 @item -fdump-unnumbered-links
11938 @opindex fdump-unnumbered-links
11939 When doing debugging dumps (see @option{-d} option above), suppress
11940 instruction numbers for the links to the previous and next instructions
11941 in a sequence.
11942
11943 @item -fdump-translation-unit @r{(C++ only)}
11944 @itemx -fdump-translation-unit-@var{options} @r{(C++ only)}
11945 @opindex fdump-translation-unit
11946 Dump a representation of the tree structure for the entire translation
11947 unit to a file. The file name is made by appending @file{.tu} to the
11948 source file name, and the file is created in the same directory as the
11949 output file. If the @samp{-@var{options}} form is used, @var{options}
11950 controls the details of the dump as described for the
11951 @option{-fdump-tree} options.
11952
11953 @item -fdump-class-hierarchy @r{(C++ only)}
11954 @itemx -fdump-class-hierarchy-@var{options} @r{(C++ only)}
11955 @opindex fdump-class-hierarchy
11956 Dump a representation of each class's hierarchy and virtual function
11957 table layout to a file. The file name is made by appending
11958 @file{.class} to the source file name, and the file is created in the
11959 same directory as the output file. If the @samp{-@var{options}} form
11960 is used, @var{options} controls the details of the dump as described
11961 for the @option{-fdump-tree} options.
11962
11963 @item -fdump-ipa-@var{switch}
11964 @opindex fdump-ipa
11965 Control the dumping at various stages of inter-procedural analysis
11966 language tree to a file. The file name is generated by appending a
11967 switch specific suffix to the source file name, and the file is created
11968 in the same directory as the output file. The following dumps are
11969 possible:
11970
11971 @table @samp
11972 @item all
11973 Enables all inter-procedural analysis dumps.
11974
11975 @item cgraph
11976 Dumps information about call-graph optimization, unused function removal,
11977 and inlining decisions.
11978
11979 @item inline
11980 Dump after function inlining.
11981
11982 @end table
11983
11984 @item -fdump-passes
11985 @opindex fdump-passes
11986 Dump the list of optimization passes that are turned on and off by
11987 the current command-line options.
11988
11989 @item -fdump-statistics-@var{option}
11990 @opindex fdump-statistics
11991 Enable and control dumping of pass statistics in a separate file. The
11992 file name is generated by appending a suffix ending in
11993 @samp{.statistics} to the source file name, and the file is created in
11994 the same directory as the output file. If the @samp{-@var{option}}
11995 form is used, @samp{-stats} causes counters to be summed over the
11996 whole compilation unit while @samp{-details} dumps every event as
11997 the passes generate them. The default with no option is to sum
11998 counters for each function compiled.
11999
12000 @item -fdump-tree-@var{switch}
12001 @itemx -fdump-tree-@var{switch}-@var{options}
12002 @itemx -fdump-tree-@var{switch}-@var{options}=@var{filename}
12003 @opindex fdump-tree
12004 Control the dumping at various stages of processing the intermediate
12005 language tree to a file. The file name is generated by appending a
12006 switch-specific suffix to the source file name, and the file is
12007 created in the same directory as the output file. In case of
12008 @option{=@var{filename}} option, the dump is output on the given file
12009 instead of the auto named dump files. If the @samp{-@var{options}}
12010 form is used, @var{options} is a list of @samp{-} separated options
12011 which control the details of the dump. Not all options are applicable
12012 to all dumps; those that are not meaningful are ignored. The
12013 following options are available
12014
12015 @table @samp
12016 @item address
12017 Print the address of each node. Usually this is not meaningful as it
12018 changes according to the environment and source file. Its primary use
12019 is for tying up a dump file with a debug environment.
12020 @item asmname
12021 If @code{DECL_ASSEMBLER_NAME} has been set for a given decl, use that
12022 in the dump instead of @code{DECL_NAME}. Its primary use is ease of
12023 use working backward from mangled names in the assembly file.
12024 @item slim
12025 When dumping front-end intermediate representations, inhibit dumping
12026 of members of a scope or body of a function merely because that scope
12027 has been reached. Only dump such items when they are directly reachable
12028 by some other path.
12029
12030 When dumping pretty-printed trees, this option inhibits dumping the
12031 bodies of control structures.
12032
12033 When dumping RTL, print the RTL in slim (condensed) form instead of
12034 the default LISP-like representation.
12035 @item raw
12036 Print a raw representation of the tree. By default, trees are
12037 pretty-printed into a C-like representation.
12038 @item details
12039 Enable more detailed dumps (not honored by every dump option). Also
12040 include information from the optimization passes.
12041 @item stats
12042 Enable dumping various statistics about the pass (not honored by every dump
12043 option).
12044 @item blocks
12045 Enable showing basic block boundaries (disabled in raw dumps).
12046 @item graph
12047 For each of the other indicated dump files (@option{-fdump-rtl-@var{pass}}),
12048 dump a representation of the control flow graph suitable for viewing with
12049 GraphViz to @file{@var{file}.@var{passid}.@var{pass}.dot}. Each function in
12050 the file is pretty-printed as a subgraph, so that GraphViz can render them
12051 all in a single plot.
12052
12053 This option currently only works for RTL dumps, and the RTL is always
12054 dumped in slim form.
12055 @item vops
12056 Enable showing virtual operands for every statement.
12057 @item lineno
12058 Enable showing line numbers for statements.
12059 @item uid
12060 Enable showing the unique ID (@code{DECL_UID}) for each variable.
12061 @item verbose
12062 Enable showing the tree dump for each statement.
12063 @item eh
12064 Enable showing the EH region number holding each statement.
12065 @item scev
12066 Enable showing scalar evolution analysis details.
12067 @item optimized
12068 Enable showing optimization information (only available in certain
12069 passes).
12070 @item missed
12071 Enable showing missed optimization information (only available in certain
12072 passes).
12073 @item note
12074 Enable other detailed optimization information (only available in
12075 certain passes).
12076 @item =@var{filename}
12077 Instead of an auto named dump file, output into the given file
12078 name. The file names @file{stdout} and @file{stderr} are treated
12079 specially and are considered already open standard streams. For
12080 example,
12081
12082 @smallexample
12083 gcc -O2 -ftree-vectorize -fdump-tree-vect-blocks=foo.dump
12084 -fdump-tree-pre=stderr file.c
12085 @end smallexample
12086
12087 outputs vectorizer dump into @file{foo.dump}, while the PRE dump is
12088 output on to @file{stderr}. If two conflicting dump filenames are
12089 given for the same pass, then the latter option overrides the earlier
12090 one.
12091
12092 @item split-paths
12093 @opindex fdump-tree-split-paths
12094 Dump each function after splitting paths to loop backedges. The file
12095 name is made by appending @file{.split-paths} to the source file name.
12096
12097 @item all
12098 Turn on all options, except @option{raw}, @option{slim}, @option{verbose}
12099 and @option{lineno}.
12100
12101 @item optall
12102 Turn on all optimization options, i.e., @option{optimized},
12103 @option{missed}, and @option{note}.
12104 @end table
12105
12106 The following tree dumps are possible:
12107 @table @samp
12108
12109 @item original
12110 @opindex fdump-tree-original
12111 Dump before any tree based optimization, to @file{@var{file}.original}.
12112
12113 @item optimized
12114 @opindex fdump-tree-optimized
12115 Dump after all tree based optimization, to @file{@var{file}.optimized}.
12116
12117 @item gimple
12118 @opindex fdump-tree-gimple
12119 Dump each function before and after the gimplification pass to a file. The
12120 file name is made by appending @file{.gimple} to the source file name.
12121
12122 @item cfg
12123 @opindex fdump-tree-cfg
12124 Dump the control flow graph of each function to a file. The file name is
12125 made by appending @file{.cfg} to the source file name.
12126
12127 @item ch
12128 @opindex fdump-tree-ch
12129 Dump each function after copying loop headers. The file name is made by
12130 appending @file{.ch} to the source file name.
12131
12132 @item ssa
12133 @opindex fdump-tree-ssa
12134 Dump SSA related information to a file. The file name is made by appending
12135 @file{.ssa} to the source file name.
12136
12137 @item alias
12138 @opindex fdump-tree-alias
12139 Dump aliasing information for each function. The file name is made by
12140 appending @file{.alias} to the source file name.
12141
12142 @item ccp
12143 @opindex fdump-tree-ccp
12144 Dump each function after CCP@. The file name is made by appending
12145 @file{.ccp} to the source file name.
12146
12147 @item storeccp
12148 @opindex fdump-tree-storeccp
12149 Dump each function after STORE-CCP@. The file name is made by appending
12150 @file{.storeccp} to the source file name.
12151
12152 @item pre
12153 @opindex fdump-tree-pre
12154 Dump trees after partial redundancy elimination. The file name is made
12155 by appending @file{.pre} to the source file name.
12156
12157 @item fre
12158 @opindex fdump-tree-fre
12159 Dump trees after full redundancy elimination. The file name is made
12160 by appending @file{.fre} to the source file name.
12161
12162 @item copyprop
12163 @opindex fdump-tree-copyprop
12164 Dump trees after copy propagation. The file name is made
12165 by appending @file{.copyprop} to the source file name.
12166
12167 @item store_copyprop
12168 @opindex fdump-tree-store_copyprop
12169 Dump trees after store copy-propagation. The file name is made
12170 by appending @file{.store_copyprop} to the source file name.
12171
12172 @item dce
12173 @opindex fdump-tree-dce
12174 Dump each function after dead code elimination. The file name is made by
12175 appending @file{.dce} to the source file name.
12176
12177 @item sra
12178 @opindex fdump-tree-sra
12179 Dump each function after performing scalar replacement of aggregates. The
12180 file name is made by appending @file{.sra} to the source file name.
12181
12182 @item sink
12183 @opindex fdump-tree-sink
12184 Dump each function after performing code sinking. The file name is made
12185 by appending @file{.sink} to the source file name.
12186
12187 @item dom
12188 @opindex fdump-tree-dom
12189 Dump each function after applying dominator tree optimizations. The file
12190 name is made by appending @file{.dom} to the source file name.
12191
12192 @item dse
12193 @opindex fdump-tree-dse
12194 Dump each function after applying dead store elimination. The file
12195 name is made by appending @file{.dse} to the source file name.
12196
12197 @item phiopt
12198 @opindex fdump-tree-phiopt
12199 Dump each function after optimizing PHI nodes into straightline code. The file
12200 name is made by appending @file{.phiopt} to the source file name.
12201
12202 @item backprop
12203 @opindex fdump-tree-backprop
12204 Dump each function after back-propagating use information up the definition
12205 chain. The file name is made by appending @file{.backprop} to the
12206 source file name.
12207
12208 @item forwprop
12209 @opindex fdump-tree-forwprop
12210 Dump each function after forward propagating single use variables. The file
12211 name is made by appending @file{.forwprop} to the source file name.
12212
12213 @item nrv
12214 @opindex fdump-tree-nrv
12215 Dump each function after applying the named return value optimization on
12216 generic trees. The file name is made by appending @file{.nrv} to the source
12217 file name.
12218
12219 @item vect
12220 @opindex fdump-tree-vect
12221 Dump each function after applying vectorization of loops. The file name is
12222 made by appending @file{.vect} to the source file name.
12223
12224 @item slp
12225 @opindex fdump-tree-slp
12226 Dump each function after applying vectorization of basic blocks. The file name
12227 is made by appending @file{.slp} to the source file name.
12228
12229 @item vrp
12230 @opindex fdump-tree-vrp
12231 Dump each function after Value Range Propagation (VRP). The file name
12232 is made by appending @file{.vrp} to the source file name.
12233
12234 @item oaccdevlow
12235 @opindex fdump-tree-oaccdevlow
12236 Dump each function after applying device-specific OpenACC transformations.
12237 The file name is made by appending @file{.oaccdevlow} to the source file name.
12238
12239 @item all
12240 @opindex fdump-tree-all
12241 Enable all the available tree dumps with the flags provided in this option.
12242 @end table
12243
12244 @item -fopt-info
12245 @itemx -fopt-info-@var{options}
12246 @itemx -fopt-info-@var{options}=@var{filename}
12247 @opindex fopt-info
12248 Controls optimization dumps from various optimization passes. If the
12249 @samp{-@var{options}} form is used, @var{options} is a list of
12250 @samp{-} separated option keywords to select the dump details and
12251 optimizations.
12252
12253 The @var{options} can be divided into two groups: options describing the
12254 verbosity of the dump, and options describing which optimizations
12255 should be included. The options from both the groups can be freely
12256 mixed as they are non-overlapping. However, in case of any conflicts,
12257 the later options override the earlier options on the command
12258 line.
12259
12260 The following options control the dump verbosity:
12261
12262 @table @samp
12263 @item optimized
12264 Print information when an optimization is successfully applied. It is
12265 up to a pass to decide which information is relevant. For example, the
12266 vectorizer passes print the source location of loops which are
12267 successfully vectorized.
12268 @item missed
12269 Print information about missed optimizations. Individual passes
12270 control which information to include in the output.
12271 @item note
12272 Print verbose information about optimizations, such as certain
12273 transformations, more detailed messages about decisions etc.
12274 @item all
12275 Print detailed optimization information. This includes
12276 @samp{optimized}, @samp{missed}, and @samp{note}.
12277 @end table
12278
12279 One or more of the following option keywords can be used to describe a
12280 group of optimizations:
12281
12282 @table @samp
12283 @item ipa
12284 Enable dumps from all interprocedural optimizations.
12285 @item loop
12286 Enable dumps from all loop optimizations.
12287 @item inline
12288 Enable dumps from all inlining optimizations.
12289 @item vec
12290 Enable dumps from all vectorization optimizations.
12291 @item optall
12292 Enable dumps from all optimizations. This is a superset of
12293 the optimization groups listed above.
12294 @end table
12295
12296 If @var{options} is
12297 omitted, it defaults to @samp{optimized-optall}, which means to dump all
12298 info about successful optimizations from all the passes.
12299
12300 If the @var{filename} is provided, then the dumps from all the
12301 applicable optimizations are concatenated into the @var{filename}.
12302 Otherwise the dump is output onto @file{stderr}. Though multiple
12303 @option{-fopt-info} options are accepted, only one of them can include
12304 a @var{filename}. If other filenames are provided then all but the
12305 first such option are ignored.
12306
12307 Note that the output @var{filename} is overwritten
12308 in case of multiple translation units. If a combined output from
12309 multiple translation units is desired, @file{stderr} should be used
12310 instead.
12311
12312 In the following example, the optimization info is output to
12313 @file{stderr}:
12314
12315 @smallexample
12316 gcc -O3 -fopt-info
12317 @end smallexample
12318
12319 This example:
12320 @smallexample
12321 gcc -O3 -fopt-info-missed=missed.all
12322 @end smallexample
12323
12324 @noindent
12325 outputs missed optimization report from all the passes into
12326 @file{missed.all}, and this one:
12327
12328 @smallexample
12329 gcc -O2 -ftree-vectorize -fopt-info-vec-missed
12330 @end smallexample
12331
12332 @noindent
12333 prints information about missed optimization opportunities from
12334 vectorization passes on @file{stderr}.
12335 Note that @option{-fopt-info-vec-missed} is equivalent to
12336 @option{-fopt-info-missed-vec}.
12337
12338 As another example,
12339 @smallexample
12340 gcc -O3 -fopt-info-inline-optimized-missed=inline.txt
12341 @end smallexample
12342
12343 @noindent
12344 outputs information about missed optimizations as well as
12345 optimized locations from all the inlining passes into
12346 @file{inline.txt}.
12347
12348 Finally, consider:
12349
12350 @smallexample
12351 gcc -fopt-info-vec-missed=vec.miss -fopt-info-loop-optimized=loop.opt
12352 @end smallexample
12353
12354 @noindent
12355 Here the two output filenames @file{vec.miss} and @file{loop.opt} are
12356 in conflict since only one output file is allowed. In this case, only
12357 the first option takes effect and the subsequent options are
12358 ignored. Thus only @file{vec.miss} is produced which contains
12359 dumps from the vectorizer about missed opportunities.
12360
12361 @item -fsched-verbose=@var{n}
12362 @opindex fsched-verbose
12363 On targets that use instruction scheduling, this option controls the
12364 amount of debugging output the scheduler prints to the dump files.
12365
12366 For @var{n} greater than zero, @option{-fsched-verbose} outputs the
12367 same information as @option{-fdump-rtl-sched1} and @option{-fdump-rtl-sched2}.
12368 For @var{n} greater than one, it also output basic block probabilities,
12369 detailed ready list information and unit/insn info. For @var{n} greater
12370 than two, it includes RTL at abort point, control-flow and regions info.
12371 And for @var{n} over four, @option{-fsched-verbose} also includes
12372 dependence info.
12373
12374
12375
12376 @item -fenable-@var{kind}-@var{pass}
12377 @itemx -fdisable-@var{kind}-@var{pass}=@var{range-list}
12378 @opindex fdisable-
12379 @opindex fenable-
12380
12381 This is a set of options that are used to explicitly disable/enable
12382 optimization passes. These options are intended for use for debugging GCC.
12383 Compiler users should use regular options for enabling/disabling
12384 passes instead.
12385
12386 @table @gcctabopt
12387
12388 @item -fdisable-ipa-@var{pass}
12389 Disable IPA pass @var{pass}. @var{pass} is the pass name. If the same pass is
12390 statically invoked in the compiler multiple times, the pass name should be
12391 appended with a sequential number starting from 1.
12392
12393 @item -fdisable-rtl-@var{pass}
12394 @itemx -fdisable-rtl-@var{pass}=@var{range-list}
12395 Disable RTL pass @var{pass}. @var{pass} is the pass name. If the same pass is
12396 statically invoked in the compiler multiple times, the pass name should be
12397 appended with a sequential number starting from 1. @var{range-list} is a
12398 comma-separated list of function ranges or assembler names. Each range is a number
12399 pair separated by a colon. The range is inclusive in both ends. If the range
12400 is trivial, the number pair can be simplified as a single number. If the
12401 function's call graph node's @var{uid} falls within one of the specified ranges,
12402 the @var{pass} is disabled for that function. The @var{uid} is shown in the
12403 function header of a dump file, and the pass names can be dumped by using
12404 option @option{-fdump-passes}.
12405
12406 @item -fdisable-tree-@var{pass}
12407 @itemx -fdisable-tree-@var{pass}=@var{range-list}
12408 Disable tree pass @var{pass}. See @option{-fdisable-rtl} for the description of
12409 option arguments.
12410
12411 @item -fenable-ipa-@var{pass}
12412 Enable IPA pass @var{pass}. @var{pass} is the pass name. If the same pass is
12413 statically invoked in the compiler multiple times, the pass name should be
12414 appended with a sequential number starting from 1.
12415
12416 @item -fenable-rtl-@var{pass}
12417 @itemx -fenable-rtl-@var{pass}=@var{range-list}
12418 Enable RTL pass @var{pass}. See @option{-fdisable-rtl} for option argument
12419 description and examples.
12420
12421 @item -fenable-tree-@var{pass}
12422 @itemx -fenable-tree-@var{pass}=@var{range-list}
12423 Enable tree pass @var{pass}. See @option{-fdisable-rtl} for the description
12424 of option arguments.
12425
12426 @end table
12427
12428 Here are some examples showing uses of these options.
12429
12430 @smallexample
12431
12432 # disable ccp1 for all functions
12433 -fdisable-tree-ccp1
12434 # disable complete unroll for function whose cgraph node uid is 1
12435 -fenable-tree-cunroll=1
12436 # disable gcse2 for functions at the following ranges [1,1],
12437 # [300,400], and [400,1000]
12438 # disable gcse2 for functions foo and foo2
12439 -fdisable-rtl-gcse2=foo,foo2
12440 # disable early inlining
12441 -fdisable-tree-einline
12442 # disable ipa inlining
12443 -fdisable-ipa-inline
12444 # enable tree full unroll
12445 -fenable-tree-unroll
12446
12447 @end smallexample
12448
12449 @item -fchecking
12450 @itemx -fchecking=@var{n}
12451 @opindex fchecking
12452 @opindex fno-checking
12453 Enable internal consistency checking. The default depends on
12454 the compiler configuration. @option{-fchecking=2} enables further
12455 internal consistency checking that might affect code generation.
12456
12457 @item -frandom-seed=@var{string}
12458 @opindex frandom-seed
12459 This option provides a seed that GCC uses in place of
12460 random numbers in generating certain symbol names
12461 that have to be different in every compiled file. It is also used to
12462 place unique stamps in coverage data files and the object files that
12463 produce them. You can use the @option{-frandom-seed} option to produce
12464 reproducibly identical object files.
12465
12466 The @var{string} can either be a number (decimal, octal or hex) or an
12467 arbitrary string (in which case it's converted to a number by
12468 computing CRC32).
12469
12470 The @var{string} should be different for every file you compile.
12471
12472 @item -save-temps
12473 @itemx -save-temps=cwd
12474 @opindex save-temps
12475 Store the usual ``temporary'' intermediate files permanently; place them
12476 in the current directory and name them based on the source file. Thus,
12477 compiling @file{foo.c} with @option{-c -save-temps} produces files
12478 @file{foo.i} and @file{foo.s}, as well as @file{foo.o}. This creates a
12479 preprocessed @file{foo.i} output file even though the compiler now
12480 normally uses an integrated preprocessor.
12481
12482 When used in combination with the @option{-x} command-line option,
12483 @option{-save-temps} is sensible enough to avoid over writing an
12484 input source file with the same extension as an intermediate file.
12485 The corresponding intermediate file may be obtained by renaming the
12486 source file before using @option{-save-temps}.
12487
12488 If you invoke GCC in parallel, compiling several different source
12489 files that share a common base name in different subdirectories or the
12490 same source file compiled for multiple output destinations, it is
12491 likely that the different parallel compilers will interfere with each
12492 other, and overwrite the temporary files. For instance:
12493
12494 @smallexample
12495 gcc -save-temps -o outdir1/foo.o indir1/foo.c&
12496 gcc -save-temps -o outdir2/foo.o indir2/foo.c&
12497 @end smallexample
12498
12499 may result in @file{foo.i} and @file{foo.o} being written to
12500 simultaneously by both compilers.
12501
12502 @item -save-temps=obj
12503 @opindex save-temps=obj
12504 Store the usual ``temporary'' intermediate files permanently. If the
12505 @option{-o} option is used, the temporary files are based on the
12506 object file. If the @option{-o} option is not used, the
12507 @option{-save-temps=obj} switch behaves like @option{-save-temps}.
12508
12509 For example:
12510
12511 @smallexample
12512 gcc -save-temps=obj -c foo.c
12513 gcc -save-temps=obj -c bar.c -o dir/xbar.o
12514 gcc -save-temps=obj foobar.c -o dir2/yfoobar
12515 @end smallexample
12516
12517 @noindent
12518 creates @file{foo.i}, @file{foo.s}, @file{dir/xbar.i},
12519 @file{dir/xbar.s}, @file{dir2/yfoobar.i}, @file{dir2/yfoobar.s}, and
12520 @file{dir2/yfoobar.o}.
12521
12522 @item -time@r{[}=@var{file}@r{]}
12523 @opindex time
12524 Report the CPU time taken by each subprocess in the compilation
12525 sequence. For C source files, this is the compiler proper and assembler
12526 (plus the linker if linking is done).
12527
12528 Without the specification of an output file, the output looks like this:
12529
12530 @smallexample
12531 # cc1 0.12 0.01
12532 # as 0.00 0.01
12533 @end smallexample
12534
12535 The first number on each line is the ``user time'', that is time spent
12536 executing the program itself. The second number is ``system time'',
12537 time spent executing operating system routines on behalf of the program.
12538 Both numbers are in seconds.
12539
12540 With the specification of an output file, the output is appended to the
12541 named file, and it looks like this:
12542
12543 @smallexample
12544 0.12 0.01 cc1 @var{options}
12545 0.00 0.01 as @var{options}
12546 @end smallexample
12547
12548 The ``user time'' and the ``system time'' are moved before the program
12549 name, and the options passed to the program are displayed, so that one
12550 can later tell what file was being compiled, and with which options.
12551
12552 @item -fdump-final-insns@r{[}=@var{file}@r{]}
12553 @opindex fdump-final-insns
12554 Dump the final internal representation (RTL) to @var{file}. If the
12555 optional argument is omitted (or if @var{file} is @code{.}), the name
12556 of the dump file is determined by appending @code{.gkd} to the
12557 compilation output file name.
12558
12559 @item -fcompare-debug@r{[}=@var{opts}@r{]}
12560 @opindex fcompare-debug
12561 @opindex fno-compare-debug
12562 If no error occurs during compilation, run the compiler a second time,
12563 adding @var{opts} and @option{-fcompare-debug-second} to the arguments
12564 passed to the second compilation. Dump the final internal
12565 representation in both compilations, and print an error if they differ.
12566
12567 If the equal sign is omitted, the default @option{-gtoggle} is used.
12568
12569 The environment variable @env{GCC_COMPARE_DEBUG}, if defined, non-empty
12570 and nonzero, implicitly enables @option{-fcompare-debug}. If
12571 @env{GCC_COMPARE_DEBUG} is defined to a string starting with a dash,
12572 then it is used for @var{opts}, otherwise the default @option{-gtoggle}
12573 is used.
12574
12575 @option{-fcompare-debug=}, with the equal sign but without @var{opts},
12576 is equivalent to @option{-fno-compare-debug}, which disables the dumping
12577 of the final representation and the second compilation, preventing even
12578 @env{GCC_COMPARE_DEBUG} from taking effect.
12579
12580 To verify full coverage during @option{-fcompare-debug} testing, set
12581 @env{GCC_COMPARE_DEBUG} to say @option{-fcompare-debug-not-overridden},
12582 which GCC rejects as an invalid option in any actual compilation
12583 (rather than preprocessing, assembly or linking). To get just a
12584 warning, setting @env{GCC_COMPARE_DEBUG} to @samp{-w%n-fcompare-debug
12585 not overridden} will do.
12586
12587 @item -fcompare-debug-second
12588 @opindex fcompare-debug-second
12589 This option is implicitly passed to the compiler for the second
12590 compilation requested by @option{-fcompare-debug}, along with options to
12591 silence warnings, and omitting other options that would cause
12592 side-effect compiler outputs to files or to the standard output. Dump
12593 files and preserved temporary files are renamed so as to contain the
12594 @code{.gk} additional extension during the second compilation, to avoid
12595 overwriting those generated by the first.
12596
12597 When this option is passed to the compiler driver, it causes the
12598 @emph{first} compilation to be skipped, which makes it useful for little
12599 other than debugging the compiler proper.
12600
12601 @item -gtoggle
12602 @opindex gtoggle
12603 Turn off generation of debug info, if leaving out this option
12604 generates it, or turn it on at level 2 otherwise. The position of this
12605 argument in the command line does not matter; it takes effect after all
12606 other options are processed, and it does so only once, no matter how
12607 many times it is given. This is mainly intended to be used with
12608 @option{-fcompare-debug}.
12609
12610 @item -fvar-tracking-assignments-toggle
12611 @opindex fvar-tracking-assignments-toggle
12612 @opindex fno-var-tracking-assignments-toggle
12613 Toggle @option{-fvar-tracking-assignments}, in the same way that
12614 @option{-gtoggle} toggles @option{-g}.
12615
12616 @item -Q
12617 @opindex Q
12618 Makes the compiler print out each function name as it is compiled, and
12619 print some statistics about each pass when it finishes.
12620
12621 @item -ftime-report
12622 @opindex ftime-report
12623 Makes the compiler print some statistics about the time consumed by each
12624 pass when it finishes.
12625
12626 @item -fira-verbose=@var{n}
12627 @opindex fira-verbose
12628 Control the verbosity of the dump file for the integrated register allocator.
12629 The default value is 5. If the value @var{n} is greater or equal to 10,
12630 the dump output is sent to stderr using the same format as @var{n} minus 10.
12631
12632 @item -flto-report
12633 @opindex flto-report
12634 Prints a report with internal details on the workings of the link-time
12635 optimizer. The contents of this report vary from version to version.
12636 It is meant to be useful to GCC developers when processing object
12637 files in LTO mode (via @option{-flto}).
12638
12639 Disabled by default.
12640
12641 @item -flto-report-wpa
12642 @opindex flto-report-wpa
12643 Like @option{-flto-report}, but only print for the WPA phase of Link
12644 Time Optimization.
12645
12646 @item -fmem-report
12647 @opindex fmem-report
12648 Makes the compiler print some statistics about permanent memory
12649 allocation when it finishes.
12650
12651 @item -fmem-report-wpa
12652 @opindex fmem-report-wpa
12653 Makes the compiler print some statistics about permanent memory
12654 allocation for the WPA phase only.
12655
12656 @item -fpre-ipa-mem-report
12657 @opindex fpre-ipa-mem-report
12658 @item -fpost-ipa-mem-report
12659 @opindex fpost-ipa-mem-report
12660 Makes the compiler print some statistics about permanent memory
12661 allocation before or after interprocedural optimization.
12662
12663 @item -fprofile-report
12664 @opindex fprofile-report
12665 Makes the compiler print some statistics about consistency of the
12666 (estimated) profile and effect of individual passes.
12667
12668 @item -fstack-usage
12669 @opindex fstack-usage
12670 Makes the compiler output stack usage information for the program, on a
12671 per-function basis. The filename for the dump is made by appending
12672 @file{.su} to the @var{auxname}. @var{auxname} is generated from the name of
12673 the output file, if explicitly specified and it is not an executable,
12674 otherwise it is the basename of the source file. An entry is made up
12675 of three fields:
12676
12677 @itemize
12678 @item
12679 The name of the function.
12680 @item
12681 A number of bytes.
12682 @item
12683 One or more qualifiers: @code{static}, @code{dynamic}, @code{bounded}.
12684 @end itemize
12685
12686 The qualifier @code{static} means that the function manipulates the stack
12687 statically: a fixed number of bytes are allocated for the frame on function
12688 entry and released on function exit; no stack adjustments are otherwise made
12689 in the function. The second field is this fixed number of bytes.
12690
12691 The qualifier @code{dynamic} means that the function manipulates the stack
12692 dynamically: in addition to the static allocation described above, stack
12693 adjustments are made in the body of the function, for example to push/pop
12694 arguments around function calls. If the qualifier @code{bounded} is also
12695 present, the amount of these adjustments is bounded at compile time and
12696 the second field is an upper bound of the total amount of stack used by
12697 the function. If it is not present, the amount of these adjustments is
12698 not bounded at compile time and the second field only represents the
12699 bounded part.
12700
12701 @item -fstats
12702 @opindex fstats
12703 Emit statistics about front-end processing at the end of the compilation.
12704 This option is supported only by the C++ front end, and
12705 the information is generally only useful to the G++ development team.
12706
12707 @item -fdbg-cnt-list
12708 @opindex fdbg-cnt-list
12709 Print the name and the counter upper bound for all debug counters.
12710
12711
12712 @item -fdbg-cnt=@var{counter-value-list}
12713 @opindex fdbg-cnt
12714 Set the internal debug counter upper bound. @var{counter-value-list}
12715 is a comma-separated list of @var{name}:@var{value} pairs
12716 which sets the upper bound of each debug counter @var{name} to @var{value}.
12717 All debug counters have the initial upper bound of @code{UINT_MAX};
12718 thus @code{dbg_cnt} returns true always unless the upper bound
12719 is set by this option.
12720 For example, with @option{-fdbg-cnt=dce:10,tail_call:0},
12721 @code{dbg_cnt(dce)} returns true only for first 10 invocations.
12722
12723 @item -print-file-name=@var{library}
12724 @opindex print-file-name
12725 Print the full absolute name of the library file @var{library} that
12726 would be used when linking---and don't do anything else. With this
12727 option, GCC does not compile or link anything; it just prints the
12728 file name.
12729
12730 @item -print-multi-directory
12731 @opindex print-multi-directory
12732 Print the directory name corresponding to the multilib selected by any
12733 other switches present in the command line. This directory is supposed
12734 to exist in @env{GCC_EXEC_PREFIX}.
12735
12736 @item -print-multi-lib
12737 @opindex print-multi-lib
12738 Print the mapping from multilib directory names to compiler switches
12739 that enable them. The directory name is separated from the switches by
12740 @samp{;}, and each switch starts with an @samp{@@} instead of the
12741 @samp{-}, without spaces between multiple switches. This is supposed to
12742 ease shell processing.
12743
12744 @item -print-multi-os-directory
12745 @opindex print-multi-os-directory
12746 Print the path to OS libraries for the selected
12747 multilib, relative to some @file{lib} subdirectory. If OS libraries are
12748 present in the @file{lib} subdirectory and no multilibs are used, this is
12749 usually just @file{.}, if OS libraries are present in @file{lib@var{suffix}}
12750 sibling directories this prints e.g.@: @file{../lib64}, @file{../lib} or
12751 @file{../lib32}, or if OS libraries are present in @file{lib/@var{subdir}}
12752 subdirectories it prints e.g.@: @file{amd64}, @file{sparcv9} or @file{ev6}.
12753
12754 @item -print-multiarch
12755 @opindex print-multiarch
12756 Print the path to OS libraries for the selected multiarch,
12757 relative to some @file{lib} subdirectory.
12758
12759 @item -print-prog-name=@var{program}
12760 @opindex print-prog-name
12761 Like @option{-print-file-name}, but searches for a program such as @command{cpp}.
12762
12763 @item -print-libgcc-file-name
12764 @opindex print-libgcc-file-name
12765 Same as @option{-print-file-name=libgcc.a}.
12766
12767 This is useful when you use @option{-nostdlib} or @option{-nodefaultlibs}
12768 but you do want to link with @file{libgcc.a}. You can do:
12769
12770 @smallexample
12771 gcc -nostdlib @var{files}@dots{} `gcc -print-libgcc-file-name`
12772 @end smallexample
12773
12774 @item -print-search-dirs
12775 @opindex print-search-dirs
12776 Print the name of the configured installation directory and a list of
12777 program and library directories @command{gcc} searches---and don't do anything else.
12778
12779 This is useful when @command{gcc} prints the error message
12780 @samp{installation problem, cannot exec cpp0: No such file or directory}.
12781 To resolve this you either need to put @file{cpp0} and the other compiler
12782 components where @command{gcc} expects to find them, or you can set the environment
12783 variable @env{GCC_EXEC_PREFIX} to the directory where you installed them.
12784 Don't forget the trailing @samp{/}.
12785 @xref{Environment Variables}.
12786
12787 @item -print-sysroot
12788 @opindex print-sysroot
12789 Print the target sysroot directory that is used during
12790 compilation. This is the target sysroot specified either at configure
12791 time or using the @option{--sysroot} option, possibly with an extra
12792 suffix that depends on compilation options. If no target sysroot is
12793 specified, the option prints nothing.
12794
12795 @item -print-sysroot-headers-suffix
12796 @opindex print-sysroot-headers-suffix
12797 Print the suffix added to the target sysroot when searching for
12798 headers, or give an error if the compiler is not configured with such
12799 a suffix---and don't do anything else.
12800
12801 @item -dumpmachine
12802 @opindex dumpmachine
12803 Print the compiler's target machine (for example,
12804 @samp{i686-pc-linux-gnu})---and don't do anything else.
12805
12806 @item -dumpversion
12807 @opindex dumpversion
12808 Print the compiler version (for example, @code{3.0})---and don't do
12809 anything else.
12810
12811 @item -dumpspecs
12812 @opindex dumpspecs
12813 Print the compiler's built-in specs---and don't do anything else. (This
12814 is used when GCC itself is being built.) @xref{Spec Files}.
12815 @end table
12816
12817 @node Submodel Options
12818 @section Machine-Dependent Options
12819 @cindex submodel options
12820 @cindex specifying hardware config
12821 @cindex hardware models and configurations, specifying
12822 @cindex target-dependent options
12823 @cindex machine-dependent options
12824
12825 Each target machine supported by GCC can have its own options---for
12826 example, to allow you to compile for a particular processor variant or
12827 ABI, or to control optimizations specific to that machine. By
12828 convention, the names of machine-specific options start with
12829 @samp{-m}.
12830
12831 Some configurations of the compiler also support additional target-specific
12832 options, usually for compatibility with other compilers on the same
12833 platform.
12834
12835 @c This list is ordered alphanumerically by subsection name.
12836 @c It should be the same order and spelling as these options are listed
12837 @c in Machine Dependent Options
12838
12839 @menu
12840 * AArch64 Options::
12841 * Adapteva Epiphany Options::
12842 * ARC Options::
12843 * ARM Options::
12844 * AVR Options::
12845 * Blackfin Options::
12846 * C6X Options::
12847 * CRIS Options::
12848 * CR16 Options::
12849 * Darwin Options::
12850 * DEC Alpha Options::
12851 * FR30 Options::
12852 * FT32 Options::
12853 * FRV Options::
12854 * GNU/Linux Options::
12855 * H8/300 Options::
12856 * HPPA Options::
12857 * IA-64 Options::
12858 * LM32 Options::
12859 * M32C Options::
12860 * M32R/D Options::
12861 * M680x0 Options::
12862 * MCore Options::
12863 * MeP Options::
12864 * MicroBlaze Options::
12865 * MIPS Options::
12866 * MMIX Options::
12867 * MN10300 Options::
12868 * Moxie Options::
12869 * MSP430 Options::
12870 * NDS32 Options::
12871 * Nios II Options::
12872 * Nvidia PTX Options::
12873 * PDP-11 Options::
12874 * picoChip Options::
12875 * PowerPC Options::
12876 * RL78 Options::
12877 * RS/6000 and PowerPC Options::
12878 * RX Options::
12879 * S/390 and zSeries Options::
12880 * Score Options::
12881 * SH Options::
12882 * Solaris 2 Options::
12883 * SPARC Options::
12884 * SPU Options::
12885 * System V Options::
12886 * TILE-Gx Options::
12887 * TILEPro Options::
12888 * V850 Options::
12889 * VAX Options::
12890 * Visium Options::
12891 * VMS Options::
12892 * VxWorks Options::
12893 * x86 Options::
12894 * x86 Windows Options::
12895 * Xstormy16 Options::
12896 * Xtensa Options::
12897 * zSeries Options::
12898 @end menu
12899
12900 @node AArch64 Options
12901 @subsection AArch64 Options
12902 @cindex AArch64 Options
12903
12904 These options are defined for AArch64 implementations:
12905
12906 @table @gcctabopt
12907
12908 @item -mabi=@var{name}
12909 @opindex mabi
12910 Generate code for the specified data model. Permissible values
12911 are @samp{ilp32} for SysV-like data model where int, long int and pointers
12912 are 32 bits, and @samp{lp64} for SysV-like data model where int is 32 bits,
12913 but long int and pointers are 64 bits.
12914
12915 The default depends on the specific target configuration. Note that
12916 the LP64 and ILP32 ABIs are not link-compatible; you must compile your
12917 entire program with the same ABI, and link with a compatible set of libraries.
12918
12919 @item -mbig-endian
12920 @opindex mbig-endian
12921 Generate big-endian code. This is the default when GCC is configured for an
12922 @samp{aarch64_be-*-*} target.
12923
12924 @item -mgeneral-regs-only
12925 @opindex mgeneral-regs-only
12926 Generate code which uses only the general-purpose registers. This will prevent
12927 the compiler from using floating-point and Advanced SIMD registers but will not
12928 impose any restrictions on the assembler.
12929
12930 @item -mlittle-endian
12931 @opindex mlittle-endian
12932 Generate little-endian code. This is the default when GCC is configured for an
12933 @samp{aarch64-*-*} but not an @samp{aarch64_be-*-*} target.
12934
12935 @item -mcmodel=tiny
12936 @opindex mcmodel=tiny
12937 Generate code for the tiny code model. The program and its statically defined
12938 symbols must be within 1MB of each other. Programs can be statically or
12939 dynamically linked.
12940
12941 @item -mcmodel=small
12942 @opindex mcmodel=small
12943 Generate code for the small code model. The program and its statically defined
12944 symbols must be within 4GB of each other. Programs can be statically or
12945 dynamically linked. This is the default code model.
12946
12947 @item -mcmodel=large
12948 @opindex mcmodel=large
12949 Generate code for the large code model. This makes no assumptions about
12950 addresses and sizes of sections. Programs can be statically linked only.
12951
12952 @item -mstrict-align
12953 @opindex mstrict-align
12954 Avoid generating memory accesses that may not be aligned on a natural object
12955 boundary as described in the architecture specification.
12956
12957 @item -momit-leaf-frame-pointer
12958 @itemx -mno-omit-leaf-frame-pointer
12959 @opindex momit-leaf-frame-pointer
12960 @opindex mno-omit-leaf-frame-pointer
12961 Omit or keep the frame pointer in leaf functions. The former behavior is the
12962 default.
12963
12964 @item -mtls-dialect=desc
12965 @opindex mtls-dialect=desc
12966 Use TLS descriptors as the thread-local storage mechanism for dynamic accesses
12967 of TLS variables. This is the default.
12968
12969 @item -mtls-dialect=traditional
12970 @opindex mtls-dialect=traditional
12971 Use traditional TLS as the thread-local storage mechanism for dynamic accesses
12972 of TLS variables.
12973
12974 @item -mtls-size=@var{size}
12975 @opindex mtls-size
12976 Specify bit size of immediate TLS offsets. Valid values are 12, 24, 32, 48.
12977 This option requires binutils 2.26 or newer.
12978
12979 @item -mfix-cortex-a53-835769
12980 @itemx -mno-fix-cortex-a53-835769
12981 @opindex mfix-cortex-a53-835769
12982 @opindex mno-fix-cortex-a53-835769
12983 Enable or disable the workaround for the ARM Cortex-A53 erratum number 835769.
12984 This involves inserting a NOP instruction between memory instructions and
12985 64-bit integer multiply-accumulate instructions.
12986
12987 @item -mfix-cortex-a53-843419
12988 @itemx -mno-fix-cortex-a53-843419
12989 @opindex mfix-cortex-a53-843419
12990 @opindex mno-fix-cortex-a53-843419
12991 Enable or disable the workaround for the ARM Cortex-A53 erratum number 843419.
12992 This erratum workaround is made at link time and this will only pass the
12993 corresponding flag to the linker.
12994
12995 @item -mlow-precision-recip-sqrt
12996 @item -mno-low-precision-recip-sqrt
12997 @opindex mlow-precision-recip-sqrt
12998 @opindex mno-low-precision-recip-sqrt
12999 Enable or disable reciprocal square root approximation.
13000 This option only has an effect if @option{-ffast-math} or
13001 @option{-funsafe-math-optimizations} is used as well. Enabling this reduces
13002 precision of reciprocal square root results to about 16 bits for
13003 single precision and to 32 bits for double precision.
13004
13005 @item -march=@var{name}
13006 @opindex march
13007 Specify the name of the target architecture and, optionally, one or
13008 more feature modifiers. This option has the form
13009 @option{-march=@var{arch}@r{@{}+@r{[}no@r{]}@var{feature}@r{@}*}}.
13010
13011 The permissible values for @var{arch} are @samp{armv8-a},
13012 @samp{armv8.1-a} or @var{native}.
13013
13014 The value @samp{armv8.1-a} implies @samp{armv8-a} and enables compiler
13015 support for the ARMv8.1 architecture extension. In particular, it
13016 enables the @samp{+crc} and @samp{+lse} features.
13017
13018 The value @samp{native} is available on native AArch64 GNU/Linux and
13019 causes the compiler to pick the architecture of the host system. This
13020 option has no effect if the compiler is unable to recognize the
13021 architecture of the host system,
13022
13023 The permissible values for @var{feature} are listed in the sub-section
13024 on @ref{aarch64-feature-modifiers,,@option{-march} and @option{-mcpu}
13025 Feature Modifiers}. Where conflicting feature modifiers are
13026 specified, the right-most feature is used.
13027
13028 GCC uses @var{name} to determine what kind of instructions it can emit
13029 when generating assembly code. If @option{-march} is specified
13030 without either of @option{-mtune} or @option{-mcpu} also being
13031 specified, the code is tuned to perform well across a range of target
13032 processors implementing the target architecture.
13033
13034 @item -mtune=@var{name}
13035 @opindex mtune
13036 Specify the name of the target processor for which GCC should tune the
13037 performance of the code. Permissible values for this option are:
13038 @samp{generic}, @samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a57},
13039 @samp{cortex-a72}, @samp{exynos-m1}, @samp{qdf24xx}, @samp{thunderx},
13040 @samp{xgene1}, @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
13041 @samp{native}.
13042
13043 The values @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53}
13044 specify that GCC should tune for a big.LITTLE system.
13045
13046 Additionally on native AArch64 GNU/Linux systems the value
13047 @samp{native} tunes performance to the host system. This option has no effect
13048 if the compiler is unable to recognize the processor of the host system.
13049
13050 Where none of @option{-mtune=}, @option{-mcpu=} or @option{-march=}
13051 are specified, the code is tuned to perform well across a range
13052 of target processors.
13053
13054 This option cannot be suffixed by feature modifiers.
13055
13056 @item -mcpu=@var{name}
13057 @opindex mcpu
13058 Specify the name of the target processor, optionally suffixed by one
13059 or more feature modifiers. This option has the form
13060 @option{-mcpu=@var{cpu}@r{@{}+@r{[}no@r{]}@var{feature}@r{@}*}}, where
13061 the permissible values for @var{cpu} are the same as those available
13062 for @option{-mtune}. The permissible values for @var{feature} are
13063 documented in the sub-section on
13064 @ref{aarch64-feature-modifiers,,@option{-march} and @option{-mcpu}
13065 Feature Modifiers}. Where conflicting feature modifiers are
13066 specified, the right-most feature is used.
13067
13068 GCC uses @var{name} to determine what kind of instructions it can emit when
13069 generating assembly code (as if by @option{-march}) and to determine
13070 the target processor for which to tune for performance (as if
13071 by @option{-mtune}). Where this option is used in conjunction
13072 with @option{-march} or @option{-mtune}, those options take precedence
13073 over the appropriate part of this option.
13074
13075 @item -moverride=@var{string}
13076 @opindex moverride
13077 Override tuning decisions made by the back-end in response to a
13078 @option{-mtune=} switch. The syntax, semantics, and accepted values
13079 for @var{string} in this option are not guaranteed to be consistent
13080 across releases.
13081
13082 This option is only intended to be useful when developing GCC.
13083
13084 @item -mpc-relative-literal-loads
13085 @opindex mpc-relative-literal-loads
13086 Enable PC-relative literal loads. With this option literal pools are
13087 accessed using a single instruction and emitted after each function. This
13088 limits the maximum size of functions to 1MB. This is enabled by default for
13089 @option{-mcmodel=tiny}.
13090
13091 @end table
13092
13093 @subsubsection @option{-march} and @option{-mcpu} Feature Modifiers
13094 @anchor{aarch64-feature-modifiers}
13095 @cindex @option{-march} feature modifiers
13096 @cindex @option{-mcpu} feature modifiers
13097 Feature modifiers used with @option{-march} and @option{-mcpu} can be any of
13098 the following and their inverses @option{no@var{feature}}:
13099
13100 @table @samp
13101 @item crc
13102 Enable CRC extension. This is on by default for
13103 @option{-march=armv8.1-a}.
13104 @item crypto
13105 Enable Crypto extension. This also enables Advanced SIMD and floating-point
13106 instructions.
13107 @item fp
13108 Enable floating-point instructions. This is on by default for all possible
13109 values for options @option{-march} and @option{-mcpu}.
13110 @item simd
13111 Enable Advanced SIMD instructions. This also enables floating-point
13112 instructions. This is on by default for all possible values for options
13113 @option{-march} and @option{-mcpu}.
13114 @item lse
13115 Enable Large System Extension instructions. This is on by default for
13116 @option{-march=armv8.1-a}.
13117
13118 @end table
13119
13120 Feature @option{crypto} implies @option{simd}, which implies @option{fp}.
13121 Conversely, @option{nofp} implies @option{nosimd}, which implies
13122 @option{nocrypto}.
13123
13124 @node Adapteva Epiphany Options
13125 @subsection Adapteva Epiphany Options
13126
13127 These @samp{-m} options are defined for Adapteva Epiphany:
13128
13129 @table @gcctabopt
13130 @item -mhalf-reg-file
13131 @opindex mhalf-reg-file
13132 Don't allocate any register in the range @code{r32}@dots{}@code{r63}.
13133 That allows code to run on hardware variants that lack these registers.
13134
13135 @item -mprefer-short-insn-regs
13136 @opindex mprefer-short-insn-regs
13137 Preferentially allocate registers that allow short instruction generation.
13138 This can result in increased instruction count, so this may either reduce or
13139 increase overall code size.
13140
13141 @item -mbranch-cost=@var{num}
13142 @opindex mbranch-cost
13143 Set the cost of branches to roughly @var{num} ``simple'' instructions.
13144 This cost is only a heuristic and is not guaranteed to produce
13145 consistent results across releases.
13146
13147 @item -mcmove
13148 @opindex mcmove
13149 Enable the generation of conditional moves.
13150
13151 @item -mnops=@var{num}
13152 @opindex mnops
13153 Emit @var{num} NOPs before every other generated instruction.
13154
13155 @item -mno-soft-cmpsf
13156 @opindex mno-soft-cmpsf
13157 For single-precision floating-point comparisons, emit an @code{fsub} instruction
13158 and test the flags. This is faster than a software comparison, but can
13159 get incorrect results in the presence of NaNs, or when two different small
13160 numbers are compared such that their difference is calculated as zero.
13161 The default is @option{-msoft-cmpsf}, which uses slower, but IEEE-compliant,
13162 software comparisons.
13163
13164 @item -mstack-offset=@var{num}
13165 @opindex mstack-offset
13166 Set the offset between the top of the stack and the stack pointer.
13167 E.g., a value of 8 means that the eight bytes in the range @code{sp+0@dots{}sp+7}
13168 can be used by leaf functions without stack allocation.
13169 Values other than @samp{8} or @samp{16} are untested and unlikely to work.
13170 Note also that this option changes the ABI; compiling a program with a
13171 different stack offset than the libraries have been compiled with
13172 generally does not work.
13173 This option can be useful if you want to evaluate if a different stack
13174 offset would give you better code, but to actually use a different stack
13175 offset to build working programs, it is recommended to configure the
13176 toolchain with the appropriate @option{--with-stack-offset=@var{num}} option.
13177
13178 @item -mno-round-nearest
13179 @opindex mno-round-nearest
13180 Make the scheduler assume that the rounding mode has been set to
13181 truncating. The default is @option{-mround-nearest}.
13182
13183 @item -mlong-calls
13184 @opindex mlong-calls
13185 If not otherwise specified by an attribute, assume all calls might be beyond
13186 the offset range of the @code{b} / @code{bl} instructions, and therefore load the
13187 function address into a register before performing a (otherwise direct) call.
13188 This is the default.
13189
13190 @item -mshort-calls
13191 @opindex short-calls
13192 If not otherwise specified by an attribute, assume all direct calls are
13193 in the range of the @code{b} / @code{bl} instructions, so use these instructions
13194 for direct calls. The default is @option{-mlong-calls}.
13195
13196 @item -msmall16
13197 @opindex msmall16
13198 Assume addresses can be loaded as 16-bit unsigned values. This does not
13199 apply to function addresses for which @option{-mlong-calls} semantics
13200 are in effect.
13201
13202 @item -mfp-mode=@var{mode}
13203 @opindex mfp-mode
13204 Set the prevailing mode of the floating-point unit.
13205 This determines the floating-point mode that is provided and expected
13206 at function call and return time. Making this mode match the mode you
13207 predominantly need at function start can make your programs smaller and
13208 faster by avoiding unnecessary mode switches.
13209
13210 @var{mode} can be set to one the following values:
13211
13212 @table @samp
13213 @item caller
13214 Any mode at function entry is valid, and retained or restored when
13215 the function returns, and when it calls other functions.
13216 This mode is useful for compiling libraries or other compilation units
13217 you might want to incorporate into different programs with different
13218 prevailing FPU modes, and the convenience of being able to use a single
13219 object file outweighs the size and speed overhead for any extra
13220 mode switching that might be needed, compared with what would be needed
13221 with a more specific choice of prevailing FPU mode.
13222
13223 @item truncate
13224 This is the mode used for floating-point calculations with
13225 truncating (i.e.@: round towards zero) rounding mode. That includes
13226 conversion from floating point to integer.
13227
13228 @item round-nearest
13229 This is the mode used for floating-point calculations with
13230 round-to-nearest-or-even rounding mode.
13231
13232 @item int
13233 This is the mode used to perform integer calculations in the FPU, e.g.@:
13234 integer multiply, or integer multiply-and-accumulate.
13235 @end table
13236
13237 The default is @option{-mfp-mode=caller}
13238
13239 @item -mnosplit-lohi
13240 @itemx -mno-postinc
13241 @itemx -mno-postmodify
13242 @opindex mnosplit-lohi
13243 @opindex mno-postinc
13244 @opindex mno-postmodify
13245 Code generation tweaks that disable, respectively, splitting of 32-bit
13246 loads, generation of post-increment addresses, and generation of
13247 post-modify addresses. The defaults are @option{msplit-lohi},
13248 @option{-mpost-inc}, and @option{-mpost-modify}.
13249
13250 @item -mnovect-double
13251 @opindex mno-vect-double
13252 Change the preferred SIMD mode to SImode. The default is
13253 @option{-mvect-double}, which uses DImode as preferred SIMD mode.
13254
13255 @item -max-vect-align=@var{num}
13256 @opindex max-vect-align
13257 The maximum alignment for SIMD vector mode types.
13258 @var{num} may be 4 or 8. The default is 8.
13259 Note that this is an ABI change, even though many library function
13260 interfaces are unaffected if they don't use SIMD vector modes
13261 in places that affect size and/or alignment of relevant types.
13262
13263 @item -msplit-vecmove-early
13264 @opindex msplit-vecmove-early
13265 Split vector moves into single word moves before reload. In theory this
13266 can give better register allocation, but so far the reverse seems to be
13267 generally the case.
13268
13269 @item -m1reg-@var{reg}
13270 @opindex m1reg-
13271 Specify a register to hold the constant @minus{}1, which makes loading small negative
13272 constants and certain bitmasks faster.
13273 Allowable values for @var{reg} are @samp{r43} and @samp{r63},
13274 which specify use of that register as a fixed register,
13275 and @samp{none}, which means that no register is used for this
13276 purpose. The default is @option{-m1reg-none}.
13277
13278 @end table
13279
13280 @node ARC Options
13281 @subsection ARC Options
13282 @cindex ARC options
13283
13284 The following options control the architecture variant for which code
13285 is being compiled:
13286
13287 @c architecture variants
13288 @table @gcctabopt
13289
13290 @item -mbarrel-shifter
13291 @opindex mbarrel-shifter
13292 Generate instructions supported by barrel shifter. This is the default
13293 unless @option{-mcpu=ARC601} or @samp{-mcpu=ARCEM} is in effect.
13294
13295 @item -mcpu=@var{cpu}
13296 @opindex mcpu
13297 Set architecture type, register usage, and instruction scheduling
13298 parameters for @var{cpu}. There are also shortcut alias options
13299 available for backward compatibility and convenience. Supported
13300 values for @var{cpu} are
13301
13302 @table @samp
13303 @opindex mA6
13304 @opindex mARC600
13305 @item ARC600
13306 @item arc600
13307 Compile for ARC600. Aliases: @option{-mA6}, @option{-mARC600}.
13308
13309 @item ARC601
13310 @item arc601
13311 @opindex mARC601
13312 Compile for ARC601. Alias: @option{-mARC601}.
13313
13314 @item ARC700
13315 @item arc700
13316 @opindex mA7
13317 @opindex mARC700
13318 Compile for ARC700. Aliases: @option{-mA7}, @option{-mARC700}.
13319 This is the default when configured with @option{--with-cpu=arc700}@.
13320
13321 @item ARCEM
13322 @item arcem
13323 Compile for ARC EM.
13324
13325 @item ARCHS
13326 @item archs
13327 Compile for ARC HS.
13328 @end table
13329
13330 @item -mdpfp
13331 @opindex mdpfp
13332 @itemx -mdpfp-compact
13333 @opindex mdpfp-compact
13334 FPX: Generate Double Precision FPX instructions, tuned for the compact
13335 implementation.
13336
13337 @item -mdpfp-fast
13338 @opindex mdpfp-fast
13339 FPX: Generate Double Precision FPX instructions, tuned for the fast
13340 implementation.
13341
13342 @item -mno-dpfp-lrsr
13343 @opindex mno-dpfp-lrsr
13344 Disable LR and SR instructions from using FPX extension aux registers.
13345
13346 @item -mea
13347 @opindex mea
13348 Generate Extended arithmetic instructions. Currently only
13349 @code{divaw}, @code{adds}, @code{subs}, and @code{sat16} are
13350 supported. This is always enabled for @option{-mcpu=ARC700}.
13351
13352 @item -mno-mpy
13353 @opindex mno-mpy
13354 Do not generate mpy instructions for ARC700.
13355
13356 @item -mmul32x16
13357 @opindex mmul32x16
13358 Generate 32x16 bit multiply and mac instructions.
13359
13360 @item -mmul64
13361 @opindex mmul64
13362 Generate mul64 and mulu64 instructions. Only valid for @option{-mcpu=ARC600}.
13363
13364 @item -mnorm
13365 @opindex mnorm
13366 Generate norm instruction. This is the default if @option{-mcpu=ARC700}
13367 is in effect.
13368
13369 @item -mspfp
13370 @opindex mspfp
13371 @itemx -mspfp-compact
13372 @opindex mspfp-compact
13373 FPX: Generate Single Precision FPX instructions, tuned for the compact
13374 implementation.
13375
13376 @item -mspfp-fast
13377 @opindex mspfp-fast
13378 FPX: Generate Single Precision FPX instructions, tuned for the fast
13379 implementation.
13380
13381 @item -msimd
13382 @opindex msimd
13383 Enable generation of ARC SIMD instructions via target-specific
13384 builtins. Only valid for @option{-mcpu=ARC700}.
13385
13386 @item -msoft-float
13387 @opindex msoft-float
13388 This option ignored; it is provided for compatibility purposes only.
13389 Software floating point code is emitted by default, and this default
13390 can overridden by FPX options; @samp{mspfp}, @samp{mspfp-compact}, or
13391 @samp{mspfp-fast} for single precision, and @samp{mdpfp},
13392 @samp{mdpfp-compact}, or @samp{mdpfp-fast} for double precision.
13393
13394 @item -mswap
13395 @opindex mswap
13396 Generate swap instructions.
13397
13398 @item -matomic
13399 @opindex matomic
13400 This enables Locked Load/Store Conditional extension to implement
13401 atomic memopry built-in functions. Not available for ARC 6xx or ARC
13402 EM cores.
13403
13404 @item -mdiv-rem
13405 @opindex mdiv-rem
13406 Enable DIV/REM instructions for ARCv2 cores.
13407
13408 @item -mcode-density
13409 @opindex mcode-density
13410 Enable code density instructions for ARC EM, default on for ARC HS.
13411
13412 @item -mll64
13413 @opindex mll64
13414 Enable double load/store operations for ARC HS cores.
13415
13416 @item -mtp-regno=@var{regno}
13417 @opindex mtp-regno
13418 Specify thread pointer register number.
13419
13420 @item -mmpy-option=@var{multo}
13421 @opindex mmpy-option
13422 Compile ARCv2 code with a multiplier design option. @samp{wlh1} is
13423 the default value. The recognized values for @var{multo} are:
13424
13425 @table @samp
13426 @item 0
13427 No multiplier available.
13428
13429 @item 1
13430 @opindex w
13431 The multiply option is set to w: 16x16 multiplier, fully pipelined.
13432 The following instructions are enabled: MPYW, and MPYUW.
13433
13434 @item 2
13435 @opindex wlh1
13436 The multiply option is set to wlh1: 32x32 multiplier, fully
13437 pipelined (1 stage). The following instructions are additionally
13438 enabled: MPY, MPYU, MPYM, MPYMU, and MPY_S.
13439
13440 @item 3
13441 @opindex wlh2
13442 The multiply option is set to wlh2: 32x32 multiplier, fully pipelined
13443 (2 stages). The following instructions are additionally enabled: MPY,
13444 MPYU, MPYM, MPYMU, and MPY_S.
13445
13446 @item 4
13447 @opindex wlh3
13448 The multiply option is set to wlh3: Two 16x16 multiplier, blocking,
13449 sequential. The following instructions are additionally enabled: MPY,
13450 MPYU, MPYM, MPYMU, and MPY_S.
13451
13452 @item 5
13453 @opindex wlh4
13454 The multiply option is set to wlh4: One 16x16 multiplier, blocking,
13455 sequential. The following instructions are additionally enabled: MPY,
13456 MPYU, MPYM, MPYMU, and MPY_S.
13457
13458 @item 6
13459 @opindex wlh5
13460 The multiply option is set to wlh5: One 32x4 multiplier, blocking,
13461 sequential. The following instructions are additionally enabled: MPY,
13462 MPYU, MPYM, MPYMU, and MPY_S.
13463
13464 @end table
13465
13466 This option is only available for ARCv2 cores@.
13467
13468 @item -mfpu=@var{fpu}
13469 @opindex mfpu
13470 Enables specific floating-point hardware extension for ARCv2
13471 core. Supported values for @var{fpu} are:
13472
13473 @table @samp
13474
13475 @item fpus
13476 @opindex fpus
13477 Enables support for single precision floating point hardware
13478 extensions@.
13479
13480 @item fpud
13481 @opindex fpud
13482 Enables support for double precision floating point hardware
13483 extensions. The single precision floating point extension is also
13484 enabled. Not available for ARC EM@.
13485
13486 @item fpuda
13487 @opindex fpuda
13488 Enables support for double precision floating point hardware
13489 extensions using double precision assist instructions. The single
13490 precision floating point extension is also enabled. This option is
13491 only available for ARC EM@.
13492
13493 @item fpuda_div
13494 @opindex fpuda_div
13495 Enables support for double precision floating point hardware
13496 extensions using double precision assist instructions, and simple
13497 precision square-root and divide hardware extensions. The single
13498 precision floating point extension is also enabled. This option is
13499 only available for ARC EM@.
13500
13501 @item fpuda_fma
13502 @opindex fpuda_fma
13503 Enables support for double precision floating point hardware
13504 extensions using double precision assist instructions, and simple
13505 precision fused multiple and add hardware extension. The single
13506 precision floating point extension is also enabled. This option is
13507 only available for ARC EM@.
13508
13509 @item fpuda_all
13510 @opindex fpuda_all
13511 Enables support for double precision floating point hardware
13512 extensions using double precision assist instructions, and all simple
13513 precision hardware extensions. The single precision floating point
13514 extension is also enabled. This option is only available for ARC EM@.
13515
13516 @item fpus_div
13517 @opindex fpus_div
13518 Enables support for single precision floating point, and single
13519 precision square-root and divide hardware extensions@.
13520
13521 @item fpud_div
13522 @opindex fpud_div
13523 Enables support for double precision floating point, and double
13524 precision square-root and divide hardware extensions. This option
13525 includes option @samp{fpus_div}. Not available for ARC EM@.
13526
13527 @item fpus_fma
13528 @opindex fpus_fma
13529 Enables support for single precision floating point, and single
13530 precision fused multiple and add hardware extensions@.
13531
13532 @item fpud_fma
13533 @opindex fpud_fma
13534 Enables support for double precision floating point, and double
13535 precision fused multiple and add hardware extensions. This option
13536 includes option @samp{fpus_fma}. Not available for ARC EM@.
13537
13538 @item fpus_all
13539 @opindex fpus_all
13540 Enables support for all single precision floating point hardware
13541 extensions@.
13542
13543 @item fpud_all
13544 @opindex fpud_all
13545 Enables support for all single and double precision floating point
13546 hardware extensions. Not available for ARC EM@.
13547
13548 @end table
13549
13550 @end table
13551
13552 The following options are passed through to the assembler, and also
13553 define preprocessor macro symbols.
13554
13555 @c Flags used by the assembler, but for which we define preprocessor
13556 @c macro symbols as well.
13557 @table @gcctabopt
13558 @item -mdsp-packa
13559 @opindex mdsp-packa
13560 Passed down to the assembler to enable the DSP Pack A extensions.
13561 Also sets the preprocessor symbol @code{__Xdsp_packa}.
13562
13563 @item -mdvbf
13564 @opindex mdvbf
13565 Passed down to the assembler to enable the dual viterbi butterfly
13566 extension. Also sets the preprocessor symbol @code{__Xdvbf}.
13567
13568 @c ARC700 4.10 extension instruction
13569 @item -mlock
13570 @opindex mlock
13571 Passed down to the assembler to enable the Locked Load/Store
13572 Conditional extension. Also sets the preprocessor symbol
13573 @code{__Xlock}.
13574
13575 @item -mmac-d16
13576 @opindex mmac-d16
13577 Passed down to the assembler. Also sets the preprocessor symbol
13578 @code{__Xxmac_d16}.
13579
13580 @item -mmac-24
13581 @opindex mmac-24
13582 Passed down to the assembler. Also sets the preprocessor symbol
13583 @code{__Xxmac_24}.
13584
13585 @c ARC700 4.10 extension instruction
13586 @item -mrtsc
13587 @opindex mrtsc
13588 Passed down to the assembler to enable the 64-bit Time-Stamp Counter
13589 extension instruction. Also sets the preprocessor symbol
13590 @code{__Xrtsc}.
13591
13592 @c ARC700 4.10 extension instruction
13593 @item -mswape
13594 @opindex mswape
13595 Passed down to the assembler to enable the swap byte ordering
13596 extension instruction. Also sets the preprocessor symbol
13597 @code{__Xswape}.
13598
13599 @item -mtelephony
13600 @opindex mtelephony
13601 Passed down to the assembler to enable dual and single operand
13602 instructions for telephony. Also sets the preprocessor symbol
13603 @code{__Xtelephony}.
13604
13605 @item -mxy
13606 @opindex mxy
13607 Passed down to the assembler to enable the XY Memory extension. Also
13608 sets the preprocessor symbol @code{__Xxy}.
13609
13610 @end table
13611
13612 The following options control how the assembly code is annotated:
13613
13614 @c Assembly annotation options
13615 @table @gcctabopt
13616 @item -misize
13617 @opindex misize
13618 Annotate assembler instructions with estimated addresses.
13619
13620 @item -mannotate-align
13621 @opindex mannotate-align
13622 Explain what alignment considerations lead to the decision to make an
13623 instruction short or long.
13624
13625 @end table
13626
13627 The following options are passed through to the linker:
13628
13629 @c options passed through to the linker
13630 @table @gcctabopt
13631 @item -marclinux
13632 @opindex marclinux
13633 Passed through to the linker, to specify use of the @code{arclinux} emulation.
13634 This option is enabled by default in tool chains built for
13635 @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}} targets
13636 when profiling is not requested.
13637
13638 @item -marclinux_prof
13639 @opindex marclinux_prof
13640 Passed through to the linker, to specify use of the
13641 @code{arclinux_prof} emulation. This option is enabled by default in
13642 tool chains built for @w{@code{arc-linux-uclibc}} and
13643 @w{@code{arceb-linux-uclibc}} targets when profiling is requested.
13644
13645 @end table
13646
13647 The following options control the semantics of generated code:
13648
13649 @c semantically relevant code generation options
13650 @table @gcctabopt
13651 @item -mlong-calls
13652 @opindex mlong-calls
13653 Generate call insns as register indirect calls, thus providing access
13654 to the full 32-bit address range.
13655
13656 @item -mmedium-calls
13657 @opindex mmedium-calls
13658 Don't use less than 25 bit addressing range for calls, which is the
13659 offset available for an unconditional branch-and-link
13660 instruction. Conditional execution of function calls is suppressed, to
13661 allow use of the 25-bit range, rather than the 21-bit range with
13662 conditional branch-and-link. This is the default for tool chains built
13663 for @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}} targets.
13664
13665 @item -mno-sdata
13666 @opindex mno-sdata
13667 Do not generate sdata references. This is the default for tool chains
13668 built for @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}}
13669 targets.
13670
13671 @item -mucb-mcount
13672 @opindex mucb-mcount
13673 Instrument with mcount calls as used in UCB code. I.e. do the
13674 counting in the callee, not the caller. By default ARC instrumentation
13675 counts in the caller.
13676
13677 @item -mvolatile-cache
13678 @opindex mvolatile-cache
13679 Use ordinarily cached memory accesses for volatile references. This is the
13680 default.
13681
13682 @item -mno-volatile-cache
13683 @opindex mno-volatile-cache
13684 Enable cache bypass for volatile references.
13685
13686 @end table
13687
13688 The following options fine tune code generation:
13689 @c code generation tuning options
13690 @table @gcctabopt
13691 @item -malign-call
13692 @opindex malign-call
13693 Do alignment optimizations for call instructions.
13694
13695 @item -mauto-modify-reg
13696 @opindex mauto-modify-reg
13697 Enable the use of pre/post modify with register displacement.
13698
13699 @item -mbbit-peephole
13700 @opindex mbbit-peephole
13701 Enable bbit peephole2.
13702
13703 @item -mno-brcc
13704 @opindex mno-brcc
13705 This option disables a target-specific pass in @file{arc_reorg} to
13706 generate @code{BRcc} instructions. It has no effect on @code{BRcc}
13707 generation driven by the combiner pass.
13708
13709 @item -mcase-vector-pcrel
13710 @opindex mcase-vector-pcrel
13711 Use pc-relative switch case tables - this enables case table shortening.
13712 This is the default for @option{-Os}.
13713
13714 @item -mcompact-casesi
13715 @opindex mcompact-casesi
13716 Enable compact casesi pattern.
13717 This is the default for @option{-Os}.
13718
13719 @item -mno-cond-exec
13720 @opindex mno-cond-exec
13721 Disable ARCompact specific pass to generate conditional execution instructions.
13722 Due to delay slot scheduling and interactions between operand numbers,
13723 literal sizes, instruction lengths, and the support for conditional execution,
13724 the target-independent pass to generate conditional execution is often lacking,
13725 so the ARC port has kept a special pass around that tries to find more
13726 conditional execution generating opportunities after register allocation,
13727 branch shortening, and delay slot scheduling have been done. This pass
13728 generally, but not always, improves performance and code size, at the cost of
13729 extra compilation time, which is why there is an option to switch it off.
13730 If you have a problem with call instructions exceeding their allowable
13731 offset range because they are conditionalized, you should consider using
13732 @option{-mmedium-calls} instead.
13733
13734 @item -mearly-cbranchsi
13735 @opindex mearly-cbranchsi
13736 Enable pre-reload use of the cbranchsi pattern.
13737
13738 @item -mexpand-adddi
13739 @opindex mexpand-adddi
13740 Expand @code{adddi3} and @code{subdi3} at rtl generation time into
13741 @code{add.f}, @code{adc} etc.
13742
13743 @item -mindexed-loads
13744 @opindex mindexed-loads
13745 Enable the use of indexed loads. This can be problematic because some
13746 optimizers then assume that indexed stores exist, which is not
13747 the case.
13748
13749 @opindex mlra
13750 Enable Local Register Allocation. This is still experimental for ARC,
13751 so by default the compiler uses standard reload
13752 (i.e. @option{-mno-lra}).
13753
13754 @item -mlra-priority-none
13755 @opindex mlra-priority-none
13756 Don't indicate any priority for target registers.
13757
13758 @item -mlra-priority-compact
13759 @opindex mlra-priority-compact
13760 Indicate target register priority for r0..r3 / r12..r15.
13761
13762 @item -mlra-priority-noncompact
13763 @opindex mlra-priority-noncompact
13764 Reduce target register priority for r0..r3 / r12..r15.
13765
13766 @item -mno-millicode
13767 @opindex mno-millicode
13768 When optimizing for size (using @option{-Os}), prologues and epilogues
13769 that have to save or restore a large number of registers are often
13770 shortened by using call to a special function in libgcc; this is
13771 referred to as a @emph{millicode} call. As these calls can pose
13772 performance issues, and/or cause linking issues when linking in a
13773 nonstandard way, this option is provided to turn off millicode call
13774 generation.
13775
13776 @item -mmixed-code
13777 @opindex mmixed-code
13778 Tweak register allocation to help 16-bit instruction generation.
13779 This generally has the effect of decreasing the average instruction size
13780 while increasing the instruction count.
13781
13782 @item -mq-class
13783 @opindex mq-class
13784 Enable 'q' instruction alternatives.
13785 This is the default for @option{-Os}.
13786
13787 @item -mRcq
13788 @opindex mRcq
13789 Enable Rcq constraint handling - most short code generation depends on this.
13790 This is the default.
13791
13792 @item -mRcw
13793 @opindex mRcw
13794 Enable Rcw constraint handling - ccfsm condexec mostly depends on this.
13795 This is the default.
13796
13797 @item -msize-level=@var{level}
13798 @opindex msize-level
13799 Fine-tune size optimization with regards to instruction lengths and alignment.
13800 The recognized values for @var{level} are:
13801 @table @samp
13802 @item 0
13803 No size optimization. This level is deprecated and treated like @samp{1}.
13804
13805 @item 1
13806 Short instructions are used opportunistically.
13807
13808 @item 2
13809 In addition, alignment of loops and of code after barriers are dropped.
13810
13811 @item 3
13812 In addition, optional data alignment is dropped, and the option @option{Os} is enabled.
13813
13814 @end table
13815
13816 This defaults to @samp{3} when @option{-Os} is in effect. Otherwise,
13817 the behavior when this is not set is equivalent to level @samp{1}.
13818
13819 @item -mtune=@var{cpu}
13820 @opindex mtune
13821 Set instruction scheduling parameters for @var{cpu}, overriding any implied
13822 by @option{-mcpu=}.
13823
13824 Supported values for @var{cpu} are
13825
13826 @table @samp
13827 @item ARC600
13828 Tune for ARC600 cpu.
13829
13830 @item ARC601
13831 Tune for ARC601 cpu.
13832
13833 @item ARC700
13834 Tune for ARC700 cpu with standard multiplier block.
13835
13836 @item ARC700-xmac
13837 Tune for ARC700 cpu with XMAC block.
13838
13839 @item ARC725D
13840 Tune for ARC725D cpu.
13841
13842 @item ARC750D
13843 Tune for ARC750D cpu.
13844
13845 @end table
13846
13847 @item -mmultcost=@var{num}
13848 @opindex mmultcost
13849 Cost to assume for a multiply instruction, with @samp{4} being equal to a
13850 normal instruction.
13851
13852 @item -munalign-prob-threshold=@var{probability}
13853 @opindex munalign-prob-threshold
13854 Set probability threshold for unaligning branches.
13855 When tuning for @samp{ARC700} and optimizing for speed, branches without
13856 filled delay slot are preferably emitted unaligned and long, unless
13857 profiling indicates that the probability for the branch to be taken
13858 is below @var{probability}. @xref{Cross-profiling}.
13859 The default is (REG_BR_PROB_BASE/2), i.e.@: 5000.
13860
13861 @end table
13862
13863 The following options are maintained for backward compatibility, but
13864 are now deprecated and will be removed in a future release:
13865
13866 @c Deprecated options
13867 @table @gcctabopt
13868
13869 @item -margonaut
13870 @opindex margonaut
13871 Obsolete FPX.
13872
13873 @item -mbig-endian
13874 @opindex mbig-endian
13875 @itemx -EB
13876 @opindex EB
13877 Compile code for big endian targets. Use of these options is now
13878 deprecated. Users wanting big-endian code, should use the
13879 @w{@code{arceb-elf32}} and @w{@code{arceb-linux-uclibc}} targets when
13880 building the tool chain, for which big-endian is the default.
13881
13882 @item -mlittle-endian
13883 @opindex mlittle-endian
13884 @itemx -EL
13885 @opindex EL
13886 Compile code for little endian targets. Use of these options is now
13887 deprecated. Users wanting little-endian code should use the
13888 @w{@code{arc-elf32}} and @w{@code{arc-linux-uclibc}} targets when
13889 building the tool chain, for which little-endian is the default.
13890
13891 @item -mbarrel_shifter
13892 @opindex mbarrel_shifter
13893 Replaced by @option{-mbarrel-shifter}.
13894
13895 @item -mdpfp_compact
13896 @opindex mdpfp_compact
13897 Replaced by @option{-mdpfp-compact}.
13898
13899 @item -mdpfp_fast
13900 @opindex mdpfp_fast
13901 Replaced by @option{-mdpfp-fast}.
13902
13903 @item -mdsp_packa
13904 @opindex mdsp_packa
13905 Replaced by @option{-mdsp-packa}.
13906
13907 @item -mEA
13908 @opindex mEA
13909 Replaced by @option{-mea}.
13910
13911 @item -mmac_24
13912 @opindex mmac_24
13913 Replaced by @option{-mmac-24}.
13914
13915 @item -mmac_d16
13916 @opindex mmac_d16
13917 Replaced by @option{-mmac-d16}.
13918
13919 @item -mspfp_compact
13920 @opindex mspfp_compact
13921 Replaced by @option{-mspfp-compact}.
13922
13923 @item -mspfp_fast
13924 @opindex mspfp_fast
13925 Replaced by @option{-mspfp-fast}.
13926
13927 @item -mtune=@var{cpu}
13928 @opindex mtune
13929 Values @samp{arc600}, @samp{arc601}, @samp{arc700} and
13930 @samp{arc700-xmac} for @var{cpu} are replaced by @samp{ARC600},
13931 @samp{ARC601}, @samp{ARC700} and @samp{ARC700-xmac} respectively
13932
13933 @item -multcost=@var{num}
13934 @opindex multcost
13935 Replaced by @option{-mmultcost}.
13936
13937 @end table
13938
13939 @node ARM Options
13940 @subsection ARM Options
13941 @cindex ARM options
13942
13943 These @samp{-m} options are defined for the ARM port:
13944
13945 @table @gcctabopt
13946 @item -mabi=@var{name}
13947 @opindex mabi
13948 Generate code for the specified ABI@. Permissible values are: @samp{apcs-gnu},
13949 @samp{atpcs}, @samp{aapcs}, @samp{aapcs-linux} and @samp{iwmmxt}.
13950
13951 @item -mapcs-frame
13952 @opindex mapcs-frame
13953 Generate a stack frame that is compliant with the ARM Procedure Call
13954 Standard for all functions, even if this is not strictly necessary for
13955 correct execution of the code. Specifying @option{-fomit-frame-pointer}
13956 with this option causes the stack frames not to be generated for
13957 leaf functions. The default is @option{-mno-apcs-frame}.
13958 This option is deprecated.
13959
13960 @item -mapcs
13961 @opindex mapcs
13962 This is a synonym for @option{-mapcs-frame} and is deprecated.
13963
13964 @ignore
13965 @c not currently implemented
13966 @item -mapcs-stack-check
13967 @opindex mapcs-stack-check
13968 Generate code to check the amount of stack space available upon entry to
13969 every function (that actually uses some stack space). If there is
13970 insufficient space available then either the function
13971 @code{__rt_stkovf_split_small} or @code{__rt_stkovf_split_big} is
13972 called, depending upon the amount of stack space required. The runtime
13973 system is required to provide these functions. The default is
13974 @option{-mno-apcs-stack-check}, since this produces smaller code.
13975
13976 @c not currently implemented
13977 @item -mapcs-float
13978 @opindex mapcs-float
13979 Pass floating-point arguments using the floating-point registers. This is
13980 one of the variants of the APCS@. This option is recommended if the
13981 target hardware has a floating-point unit or if a lot of floating-point
13982 arithmetic is going to be performed by the code. The default is
13983 @option{-mno-apcs-float}, since the size of integer-only code is
13984 slightly increased if @option{-mapcs-float} is used.
13985
13986 @c not currently implemented
13987 @item -mapcs-reentrant
13988 @opindex mapcs-reentrant
13989 Generate reentrant, position-independent code. The default is
13990 @option{-mno-apcs-reentrant}.
13991 @end ignore
13992
13993 @item -mthumb-interwork
13994 @opindex mthumb-interwork
13995 Generate code that supports calling between the ARM and Thumb
13996 instruction sets. Without this option, on pre-v5 architectures, the
13997 two instruction sets cannot be reliably used inside one program. The
13998 default is @option{-mno-thumb-interwork}, since slightly larger code
13999 is generated when @option{-mthumb-interwork} is specified. In AAPCS
14000 configurations this option is meaningless.
14001
14002 @item -mno-sched-prolog
14003 @opindex mno-sched-prolog
14004 Prevent the reordering of instructions in the function prologue, or the
14005 merging of those instruction with the instructions in the function's
14006 body. This means that all functions start with a recognizable set
14007 of instructions (or in fact one of a choice from a small set of
14008 different function prologues), and this information can be used to
14009 locate the start of functions inside an executable piece of code. The
14010 default is @option{-msched-prolog}.
14011
14012 @item -mfloat-abi=@var{name}
14013 @opindex mfloat-abi
14014 Specifies which floating-point ABI to use. Permissible values
14015 are: @samp{soft}, @samp{softfp} and @samp{hard}.
14016
14017 Specifying @samp{soft} causes GCC to generate output containing
14018 library calls for floating-point operations.
14019 @samp{softfp} allows the generation of code using hardware floating-point
14020 instructions, but still uses the soft-float calling conventions.
14021 @samp{hard} allows generation of floating-point instructions
14022 and uses FPU-specific calling conventions.
14023
14024 The default depends on the specific target configuration. Note that
14025 the hard-float and soft-float ABIs are not link-compatible; you must
14026 compile your entire program with the same ABI, and link with a
14027 compatible set of libraries.
14028
14029 @item -mlittle-endian
14030 @opindex mlittle-endian
14031 Generate code for a processor running in little-endian mode. This is
14032 the default for all standard configurations.
14033
14034 @item -mbig-endian
14035 @opindex mbig-endian
14036 Generate code for a processor running in big-endian mode; the default is
14037 to compile code for a little-endian processor.
14038
14039 @item -march=@var{name}
14040 @opindex march
14041 This specifies the name of the target ARM architecture. GCC uses this
14042 name to determine what kind of instructions it can emit when generating
14043 assembly code. This option can be used in conjunction with or instead
14044 of the @option{-mcpu=} option. Permissible names are: @samp{armv2},
14045 @samp{armv2a}, @samp{armv3}, @samp{armv3m}, @samp{armv4}, @samp{armv4t},
14046 @samp{armv5}, @samp{armv5t}, @samp{armv5e}, @samp{armv5te},
14047 @samp{armv6}, @samp{armv6j},
14048 @samp{armv6t2}, @samp{armv6z}, @samp{armv6kz}, @samp{armv6-m},
14049 @samp{armv7}, @samp{armv7-a}, @samp{armv7-r}, @samp{armv7-m}, @samp{armv7e-m},
14050 @samp{armv7ve}, @samp{armv8-a}, @samp{armv8-a+crc}, @samp{armv8.1-a},
14051 @samp{armv8.1-a+crc}, @samp{iwmmxt}, @samp{iwmmxt2}, @samp{ep9312}.
14052
14053 Architecture revisions older than @option{armv4t} are deprecated.
14054
14055 @option{-march=armv7ve} is the armv7-a architecture with virtualization
14056 extensions.
14057
14058 @option{-march=armv8-a+crc} enables code generation for the ARMv8-A
14059 architecture together with the optional CRC32 extensions.
14060
14061 @option{-march=native} causes the compiler to auto-detect the architecture
14062 of the build computer. At present, this feature is only supported on
14063 GNU/Linux, and not all architectures are recognized. If the auto-detect
14064 is unsuccessful the option has no effect.
14065
14066 @item -mtune=@var{name}
14067 @opindex mtune
14068 This option specifies the name of the target ARM processor for
14069 which GCC should tune the performance of the code.
14070 For some ARM implementations better performance can be obtained by using
14071 this option.
14072 Permissible names are: @samp{arm2}, @samp{arm250},
14073 @samp{arm3}, @samp{arm6}, @samp{arm60}, @samp{arm600}, @samp{arm610},
14074 @samp{arm620}, @samp{arm7}, @samp{arm7m}, @samp{arm7d}, @samp{arm7dm},
14075 @samp{arm7di}, @samp{arm7dmi}, @samp{arm70}, @samp{arm700},
14076 @samp{arm700i}, @samp{arm710}, @samp{arm710c}, @samp{arm7100},
14077 @samp{arm720},
14078 @samp{arm7500}, @samp{arm7500fe}, @samp{arm7tdmi}, @samp{arm7tdmi-s},
14079 @samp{arm710t}, @samp{arm720t}, @samp{arm740t},
14080 @samp{strongarm}, @samp{strongarm110}, @samp{strongarm1100},
14081 @samp{strongarm1110},
14082 @samp{arm8}, @samp{arm810}, @samp{arm9}, @samp{arm9e}, @samp{arm920},
14083 @samp{arm920t}, @samp{arm922t}, @samp{arm946e-s}, @samp{arm966e-s},
14084 @samp{arm968e-s}, @samp{arm926ej-s}, @samp{arm940t}, @samp{arm9tdmi},
14085 @samp{arm10tdmi}, @samp{arm1020t}, @samp{arm1026ej-s},
14086 @samp{arm10e}, @samp{arm1020e}, @samp{arm1022e},
14087 @samp{arm1136j-s}, @samp{arm1136jf-s}, @samp{mpcore}, @samp{mpcorenovfp},
14088 @samp{arm1156t2-s}, @samp{arm1156t2f-s}, @samp{arm1176jz-s}, @samp{arm1176jzf-s},
14089 @samp{generic-armv7-a}, @samp{cortex-a5}, @samp{cortex-a7}, @samp{cortex-a8},
14090 @samp{cortex-a9}, @samp{cortex-a12}, @samp{cortex-a15}, @samp{cortex-a17},
14091 @samp{cortex-a32}, @samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a57},
14092 @samp{cortex-a72}, @samp{cortex-r4},
14093 @samp{cortex-r4f}, @samp{cortex-r5}, @samp{cortex-r7}, @samp{cortex-r8},
14094 @samp{cortex-m7},
14095 @samp{cortex-m4},
14096 @samp{cortex-m3},
14097 @samp{cortex-m1},
14098 @samp{cortex-m0},
14099 @samp{cortex-m0plus},
14100 @samp{cortex-m1.small-multiply},
14101 @samp{cortex-m0.small-multiply},
14102 @samp{cortex-m0plus.small-multiply},
14103 @samp{exynos-m1},
14104 @samp{qdf24xx},
14105 @samp{marvell-pj4},
14106 @samp{xscale}, @samp{iwmmxt}, @samp{iwmmxt2}, @samp{ep9312},
14107 @samp{fa526}, @samp{fa626},
14108 @samp{fa606te}, @samp{fa626te}, @samp{fmp626}, @samp{fa726te},
14109 @samp{xgene1}.
14110
14111 Additionally, this option can specify that GCC should tune the performance
14112 of the code for a big.LITTLE system. Permissible names are:
14113 @samp{cortex-a15.cortex-a7}, @samp{cortex-a17.cortex-a7},
14114 @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53}.
14115
14116 @option{-mtune=generic-@var{arch}} specifies that GCC should tune the
14117 performance for a blend of processors within architecture @var{arch}.
14118 The aim is to generate code that run well on the current most popular
14119 processors, balancing between optimizations that benefit some CPUs in the
14120 range, and avoiding performance pitfalls of other CPUs. The effects of
14121 this option may change in future GCC versions as CPU models come and go.
14122
14123 @option{-mtune=native} causes the compiler to auto-detect the CPU
14124 of the build computer. At present, this feature is only supported on
14125 GNU/Linux, and not all architectures are recognized. If the auto-detect is
14126 unsuccessful the option has no effect.
14127
14128 @item -mcpu=@var{name}
14129 @opindex mcpu
14130 This specifies the name of the target ARM processor. GCC uses this name
14131 to derive the name of the target ARM architecture (as if specified
14132 by @option{-march}) and the ARM processor type for which to tune for
14133 performance (as if specified by @option{-mtune}). Where this option
14134 is used in conjunction with @option{-march} or @option{-mtune},
14135 those options take precedence over the appropriate part of this option.
14136
14137 Permissible names for this option are the same as those for
14138 @option{-mtune}.
14139
14140 @option{-mcpu=generic-@var{arch}} is also permissible, and is
14141 equivalent to @option{-march=@var{arch} -mtune=generic-@var{arch}}.
14142 See @option{-mtune} for more information.
14143
14144 @option{-mcpu=native} causes the compiler to auto-detect the CPU
14145 of the build computer. At present, this feature is only supported on
14146 GNU/Linux, and not all architectures are recognized. If the auto-detect
14147 is unsuccessful the option has no effect.
14148
14149 @item -mfpu=@var{name}
14150 @opindex mfpu
14151 This specifies what floating-point hardware (or hardware emulation) is
14152 available on the target. Permissible names are: @samp{vfp}, @samp{vfpv3},
14153 @samp{vfpv3-fp16}, @samp{vfpv3-d16}, @samp{vfpv3-d16-fp16}, @samp{vfpv3xd},
14154 @samp{vfpv3xd-fp16}, @samp{neon}, @samp{neon-fp16}, @samp{vfpv4},
14155 @samp{vfpv4-d16}, @samp{fpv4-sp-d16}, @samp{neon-vfpv4},
14156 @samp{fpv5-d16}, @samp{fpv5-sp-d16},
14157 @samp{fp-armv8}, @samp{neon-fp-armv8} and @samp{crypto-neon-fp-armv8}.
14158
14159 If @option{-msoft-float} is specified this specifies the format of
14160 floating-point values.
14161
14162 If the selected floating-point hardware includes the NEON extension
14163 (e.g. @option{-mfpu}=@samp{neon}), note that floating-point
14164 operations are not generated by GCC's auto-vectorization pass unless
14165 @option{-funsafe-math-optimizations} is also specified. This is
14166 because NEON hardware does not fully implement the IEEE 754 standard for
14167 floating-point arithmetic (in particular denormal values are treated as
14168 zero), so the use of NEON instructions may lead to a loss of precision.
14169
14170 You can also set the fpu name at function level by using the @code{target("fpu=")} function attributes (@pxref{ARM Function Attributes}) or pragmas (@pxref{Function Specific Option Pragmas}).
14171
14172 @item -mfp16-format=@var{name}
14173 @opindex mfp16-format
14174 Specify the format of the @code{__fp16} half-precision floating-point type.
14175 Permissible names are @samp{none}, @samp{ieee}, and @samp{alternative};
14176 the default is @samp{none}, in which case the @code{__fp16} type is not
14177 defined. @xref{Half-Precision}, for more information.
14178
14179 @item -mstructure-size-boundary=@var{n}
14180 @opindex mstructure-size-boundary
14181 The sizes of all structures and unions are rounded up to a multiple
14182 of the number of bits set by this option. Permissible values are 8, 32
14183 and 64. The default value varies for different toolchains. For the COFF
14184 targeted toolchain the default value is 8. A value of 64 is only allowed
14185 if the underlying ABI supports it.
14186
14187 Specifying a larger number can produce faster, more efficient code, but
14188 can also increase the size of the program. Different values are potentially
14189 incompatible. Code compiled with one value cannot necessarily expect to
14190 work with code or libraries compiled with another value, if they exchange
14191 information using structures or unions.
14192
14193 @item -mabort-on-noreturn
14194 @opindex mabort-on-noreturn
14195 Generate a call to the function @code{abort} at the end of a
14196 @code{noreturn} function. It is executed if the function tries to
14197 return.
14198
14199 @item -mlong-calls
14200 @itemx -mno-long-calls
14201 @opindex mlong-calls
14202 @opindex mno-long-calls
14203 Tells the compiler to perform function calls by first loading the
14204 address of the function into a register and then performing a subroutine
14205 call on this register. This switch is needed if the target function
14206 lies outside of the 64-megabyte addressing range of the offset-based
14207 version of subroutine call instruction.
14208
14209 Even if this switch is enabled, not all function calls are turned
14210 into long calls. The heuristic is that static functions, functions
14211 that have the @code{short_call} attribute, functions that are inside
14212 the scope of a @code{#pragma no_long_calls} directive, and functions whose
14213 definitions have already been compiled within the current compilation
14214 unit are not turned into long calls. The exceptions to this rule are
14215 that weak function definitions, functions with the @code{long_call}
14216 attribute or the @code{section} attribute, and functions that are within
14217 the scope of a @code{#pragma long_calls} directive are always
14218 turned into long calls.
14219
14220 This feature is not enabled by default. Specifying
14221 @option{-mno-long-calls} restores the default behavior, as does
14222 placing the function calls within the scope of a @code{#pragma
14223 long_calls_off} directive. Note these switches have no effect on how
14224 the compiler generates code to handle function calls via function
14225 pointers.
14226
14227 @item -msingle-pic-base
14228 @opindex msingle-pic-base
14229 Treat the register used for PIC addressing as read-only, rather than
14230 loading it in the prologue for each function. The runtime system is
14231 responsible for initializing this register with an appropriate value
14232 before execution begins.
14233
14234 @item -mpic-register=@var{reg}
14235 @opindex mpic-register
14236 Specify the register to be used for PIC addressing.
14237 For standard PIC base case, the default is any suitable register
14238 determined by compiler. For single PIC base case, the default is
14239 @samp{R9} if target is EABI based or stack-checking is enabled,
14240 otherwise the default is @samp{R10}.
14241
14242 @item -mpic-data-is-text-relative
14243 @opindex mpic-data-is-text-relative
14244 Assume that each data segments are relative to text segment at load time.
14245 Therefore, it permits addressing data using PC-relative operations.
14246 This option is on by default for targets other than VxWorks RTP.
14247
14248 @item -mpoke-function-name
14249 @opindex mpoke-function-name
14250 Write the name of each function into the text section, directly
14251 preceding the function prologue. The generated code is similar to this:
14252
14253 @smallexample
14254 t0
14255 .ascii "arm_poke_function_name", 0
14256 .align
14257 t1
14258 .word 0xff000000 + (t1 - t0)
14259 arm_poke_function_name
14260 mov ip, sp
14261 stmfd sp!, @{fp, ip, lr, pc@}
14262 sub fp, ip, #4
14263 @end smallexample
14264
14265 When performing a stack backtrace, code can inspect the value of
14266 @code{pc} stored at @code{fp + 0}. If the trace function then looks at
14267 location @code{pc - 12} and the top 8 bits are set, then we know that
14268 there is a function name embedded immediately preceding this location
14269 and has length @code{((pc[-3]) & 0xff000000)}.
14270
14271 @item -mthumb
14272 @itemx -marm
14273 @opindex marm
14274 @opindex mthumb
14275
14276 Select between generating code that executes in ARM and Thumb
14277 states. The default for most configurations is to generate code
14278 that executes in ARM state, but the default can be changed by
14279 configuring GCC with the @option{--with-mode=}@var{state}
14280 configure option.
14281
14282 You can also override the ARM and Thumb mode for each function
14283 by using the @code{target("thumb")} and @code{target("arm")} function attributes
14284 (@pxref{ARM Function Attributes}) or pragmas (@pxref{Function Specific Option Pragmas}).
14285
14286 @item -mtpcs-frame
14287 @opindex mtpcs-frame
14288 Generate a stack frame that is compliant with the Thumb Procedure Call
14289 Standard for all non-leaf functions. (A leaf function is one that does
14290 not call any other functions.) The default is @option{-mno-tpcs-frame}.
14291
14292 @item -mtpcs-leaf-frame
14293 @opindex mtpcs-leaf-frame
14294 Generate a stack frame that is compliant with the Thumb Procedure Call
14295 Standard for all leaf functions. (A leaf function is one that does
14296 not call any other functions.) The default is @option{-mno-apcs-leaf-frame}.
14297
14298 @item -mcallee-super-interworking
14299 @opindex mcallee-super-interworking
14300 Gives all externally visible functions in the file being compiled an ARM
14301 instruction set header which switches to Thumb mode before executing the
14302 rest of the function. This allows these functions to be called from
14303 non-interworking code. This option is not valid in AAPCS configurations
14304 because interworking is enabled by default.
14305
14306 @item -mcaller-super-interworking
14307 @opindex mcaller-super-interworking
14308 Allows calls via function pointers (including virtual functions) to
14309 execute correctly regardless of whether the target code has been
14310 compiled for interworking or not. There is a small overhead in the cost
14311 of executing a function pointer if this option is enabled. This option
14312 is not valid in AAPCS configurations because interworking is enabled
14313 by default.
14314
14315 @item -mtp=@var{name}
14316 @opindex mtp
14317 Specify the access model for the thread local storage pointer. The valid
14318 models are @samp{soft}, which generates calls to @code{__aeabi_read_tp},
14319 @samp{cp15}, which fetches the thread pointer from @code{cp15} directly
14320 (supported in the arm6k architecture), and @samp{auto}, which uses the
14321 best available method for the selected processor. The default setting is
14322 @samp{auto}.
14323
14324 @item -mtls-dialect=@var{dialect}
14325 @opindex mtls-dialect
14326 Specify the dialect to use for accessing thread local storage. Two
14327 @var{dialect}s are supported---@samp{gnu} and @samp{gnu2}. The
14328 @samp{gnu} dialect selects the original GNU scheme for supporting
14329 local and global dynamic TLS models. The @samp{gnu2} dialect
14330 selects the GNU descriptor scheme, which provides better performance
14331 for shared libraries. The GNU descriptor scheme is compatible with
14332 the original scheme, but does require new assembler, linker and
14333 library support. Initial and local exec TLS models are unaffected by
14334 this option and always use the original scheme.
14335
14336 @item -mword-relocations
14337 @opindex mword-relocations
14338 Only generate absolute relocations on word-sized values (i.e. R_ARM_ABS32).
14339 This is enabled by default on targets (uClinux, SymbianOS) where the runtime
14340 loader imposes this restriction, and when @option{-fpic} or @option{-fPIC}
14341 is specified.
14342
14343 @item -mfix-cortex-m3-ldrd
14344 @opindex mfix-cortex-m3-ldrd
14345 Some Cortex-M3 cores can cause data corruption when @code{ldrd} instructions
14346 with overlapping destination and base registers are used. This option avoids
14347 generating these instructions. This option is enabled by default when
14348 @option{-mcpu=cortex-m3} is specified.
14349
14350 @item -munaligned-access
14351 @itemx -mno-unaligned-access
14352 @opindex munaligned-access
14353 @opindex mno-unaligned-access
14354 Enables (or disables) reading and writing of 16- and 32- bit values
14355 from addresses that are not 16- or 32- bit aligned. By default
14356 unaligned access is disabled for all pre-ARMv6 and all ARMv6-M
14357 architectures, and enabled for all other architectures. If unaligned
14358 access is not enabled then words in packed data structures are
14359 accessed a byte at a time.
14360
14361 The ARM attribute @code{Tag_CPU_unaligned_access} is set in the
14362 generated object file to either true or false, depending upon the
14363 setting of this option. If unaligned access is enabled then the
14364 preprocessor symbol @code{__ARM_FEATURE_UNALIGNED} is also
14365 defined.
14366
14367 @item -mneon-for-64bits
14368 @opindex mneon-for-64bits
14369 Enables using Neon to handle scalar 64-bits operations. This is
14370 disabled by default since the cost of moving data from core registers
14371 to Neon is high.
14372
14373 @item -mslow-flash-data
14374 @opindex mslow-flash-data
14375 Assume loading data from flash is slower than fetching instruction.
14376 Therefore literal load is minimized for better performance.
14377 This option is only supported when compiling for ARMv7 M-profile and
14378 off by default.
14379
14380 @item -masm-syntax-unified
14381 @opindex masm-syntax-unified
14382 Assume inline assembler is using unified asm syntax. The default is
14383 currently off which implies divided syntax. This option has no impact
14384 on Thumb2. However, this may change in future releases of GCC.
14385 Divided syntax should be considered deprecated.
14386
14387 @item -mrestrict-it
14388 @opindex mrestrict-it
14389 Restricts generation of IT blocks to conform to the rules of ARMv8.
14390 IT blocks can only contain a single 16-bit instruction from a select
14391 set of instructions. This option is on by default for ARMv8 Thumb mode.
14392
14393 @item -mprint-tune-info
14394 @opindex mprint-tune-info
14395 Print CPU tuning information as comment in assembler file. This is
14396 an option used only for regression testing of the compiler and not
14397 intended for ordinary use in compiling code. This option is disabled
14398 by default.
14399 @end table
14400
14401 @node AVR Options
14402 @subsection AVR Options
14403 @cindex AVR Options
14404
14405 These options are defined for AVR implementations:
14406
14407 @table @gcctabopt
14408 @item -mmcu=@var{mcu}
14409 @opindex mmcu
14410 Specify Atmel AVR instruction set architectures (ISA) or MCU type.
14411
14412 The default for this option is@tie{}@samp{avr2}.
14413
14414 GCC supports the following AVR devices and ISAs:
14415
14416 @include avr-mmcu.texi
14417
14418 @item -maccumulate-args
14419 @opindex maccumulate-args
14420 Accumulate outgoing function arguments and acquire/release the needed
14421 stack space for outgoing function arguments once in function
14422 prologue/epilogue. Without this option, outgoing arguments are pushed
14423 before calling a function and popped afterwards.
14424
14425 Popping the arguments after the function call can be expensive on
14426 AVR so that accumulating the stack space might lead to smaller
14427 executables because arguments need not to be removed from the
14428 stack after such a function call.
14429
14430 This option can lead to reduced code size for functions that perform
14431 several calls to functions that get their arguments on the stack like
14432 calls to printf-like functions.
14433
14434 @item -mbranch-cost=@var{cost}
14435 @opindex mbranch-cost
14436 Set the branch costs for conditional branch instructions to
14437 @var{cost}. Reasonable values for @var{cost} are small, non-negative
14438 integers. The default branch cost is 0.
14439
14440 @item -mcall-prologues
14441 @opindex mcall-prologues
14442 Functions prologues/epilogues are expanded as calls to appropriate
14443 subroutines. Code size is smaller.
14444
14445 @item -mint8
14446 @opindex mint8
14447 Assume @code{int} to be 8-bit integer. This affects the sizes of all types: a
14448 @code{char} is 1 byte, an @code{int} is 1 byte, a @code{long} is 2 bytes,
14449 and @code{long long} is 4 bytes. Please note that this option does not
14450 conform to the C standards, but it results in smaller code
14451 size.
14452
14453 @item -mn-flash=@var{num}
14454 @opindex mn-flash
14455 Assume that the flash memory has a size of
14456 @var{num} times 64@tie{}KiB.
14457
14458 @item -mno-interrupts
14459 @opindex mno-interrupts
14460 Generated code is not compatible with hardware interrupts.
14461 Code size is smaller.
14462
14463 @item -mrelax
14464 @opindex mrelax
14465 Try to replace @code{CALL} resp.@: @code{JMP} instruction by the shorter
14466 @code{RCALL} resp.@: @code{RJMP} instruction if applicable.
14467 Setting @option{-mrelax} just adds the @option{--mlink-relax} option to
14468 the assembler's command line and the @option{--relax} option to the
14469 linker's command line.
14470
14471 Jump relaxing is performed by the linker because jump offsets are not
14472 known before code is located. Therefore, the assembler code generated by the
14473 compiler is the same, but the instructions in the executable may
14474 differ from instructions in the assembler code.
14475
14476 Relaxing must be turned on if linker stubs are needed, see the
14477 section on @code{EIND} and linker stubs below.
14478
14479 @item -mrmw
14480 @opindex mrmw
14481 Assume that the device supports the Read-Modify-Write
14482 instructions @code{XCH}, @code{LAC}, @code{LAS} and @code{LAT}.
14483
14484 @item -msp8
14485 @opindex msp8
14486 Treat the stack pointer register as an 8-bit register,
14487 i.e.@: assume the high byte of the stack pointer is zero.
14488 In general, you don't need to set this option by hand.
14489
14490 This option is used internally by the compiler to select and
14491 build multilibs for architectures @code{avr2} and @code{avr25}.
14492 These architectures mix devices with and without @code{SPH}.
14493 For any setting other than @option{-mmcu=avr2} or @option{-mmcu=avr25}
14494 the compiler driver adds or removes this option from the compiler
14495 proper's command line, because the compiler then knows if the device
14496 or architecture has an 8-bit stack pointer and thus no @code{SPH}
14497 register or not.
14498
14499 @item -mstrict-X
14500 @opindex mstrict-X
14501 Use address register @code{X} in a way proposed by the hardware. This means
14502 that @code{X} is only used in indirect, post-increment or
14503 pre-decrement addressing.
14504
14505 Without this option, the @code{X} register may be used in the same way
14506 as @code{Y} or @code{Z} which then is emulated by additional
14507 instructions.
14508 For example, loading a value with @code{X+const} addressing with a
14509 small non-negative @code{const < 64} to a register @var{Rn} is
14510 performed as
14511
14512 @example
14513 adiw r26, const ; X += const
14514 ld @var{Rn}, X ; @var{Rn} = *X
14515 sbiw r26, const ; X -= const
14516 @end example
14517
14518 @item -mtiny-stack
14519 @opindex mtiny-stack
14520 Only change the lower 8@tie{}bits of the stack pointer.
14521
14522 @item -nodevicelib
14523 @opindex nodevicelib
14524 Don't link against AVR-LibC's device specific library @code{libdev.a}.
14525
14526 @item -Waddr-space-convert
14527 @opindex Waddr-space-convert
14528 Warn about conversions between address spaces in the case where the
14529 resulting address space is not contained in the incoming address space.
14530 @end table
14531
14532 @subsubsection @code{EIND} and Devices with More Than 128 Ki Bytes of Flash
14533 @cindex @code{EIND}
14534 Pointers in the implementation are 16@tie{}bits wide.
14535 The address of a function or label is represented as word address so
14536 that indirect jumps and calls can target any code address in the
14537 range of 64@tie{}Ki words.
14538
14539 In order to facilitate indirect jump on devices with more than 128@tie{}Ki
14540 bytes of program memory space, there is a special function register called
14541 @code{EIND} that serves as most significant part of the target address
14542 when @code{EICALL} or @code{EIJMP} instructions are used.
14543
14544 Indirect jumps and calls on these devices are handled as follows by
14545 the compiler and are subject to some limitations:
14546
14547 @itemize @bullet
14548
14549 @item
14550 The compiler never sets @code{EIND}.
14551
14552 @item
14553 The compiler uses @code{EIND} implicitly in @code{EICALL}/@code{EIJMP}
14554 instructions or might read @code{EIND} directly in order to emulate an
14555 indirect call/jump by means of a @code{RET} instruction.
14556
14557 @item
14558 The compiler assumes that @code{EIND} never changes during the startup
14559 code or during the application. In particular, @code{EIND} is not
14560 saved/restored in function or interrupt service routine
14561 prologue/epilogue.
14562
14563 @item
14564 For indirect calls to functions and computed goto, the linker
14565 generates @emph{stubs}. Stubs are jump pads sometimes also called
14566 @emph{trampolines}. Thus, the indirect call/jump jumps to such a stub.
14567 The stub contains a direct jump to the desired address.
14568
14569 @item
14570 Linker relaxation must be turned on so that the linker generates
14571 the stubs correctly in all situations. See the compiler option
14572 @option{-mrelax} and the linker option @option{--relax}.
14573 There are corner cases where the linker is supposed to generate stubs
14574 but aborts without relaxation and without a helpful error message.
14575
14576 @item
14577 The default linker script is arranged for code with @code{EIND = 0}.
14578 If code is supposed to work for a setup with @code{EIND != 0}, a custom
14579 linker script has to be used in order to place the sections whose
14580 name start with @code{.trampolines} into the segment where @code{EIND}
14581 points to.
14582
14583 @item
14584 The startup code from libgcc never sets @code{EIND}.
14585 Notice that startup code is a blend of code from libgcc and AVR-LibC.
14586 For the impact of AVR-LibC on @code{EIND}, see the
14587 @w{@uref{http://nongnu.org/avr-libc/user-manual/,AVR-LibC user manual}}.
14588
14589 @item
14590 It is legitimate for user-specific startup code to set up @code{EIND}
14591 early, for example by means of initialization code located in
14592 section @code{.init3}. Such code runs prior to general startup code
14593 that initializes RAM and calls constructors, but after the bit
14594 of startup code from AVR-LibC that sets @code{EIND} to the segment
14595 where the vector table is located.
14596 @example
14597 #include <avr/io.h>
14598
14599 static void
14600 __attribute__((section(".init3"),naked,used,no_instrument_function))
14601 init3_set_eind (void)
14602 @{
14603 __asm volatile ("ldi r24,pm_hh8(__trampolines_start)\n\t"
14604 "out %i0,r24" :: "n" (&EIND) : "r24","memory");
14605 @}
14606 @end example
14607
14608 @noindent
14609 The @code{__trampolines_start} symbol is defined in the linker script.
14610
14611 @item
14612 Stubs are generated automatically by the linker if
14613 the following two conditions are met:
14614 @itemize @minus
14615
14616 @item The address of a label is taken by means of the @code{gs} modifier
14617 (short for @emph{generate stubs}) like so:
14618 @example
14619 LDI r24, lo8(gs(@var{func}))
14620 LDI r25, hi8(gs(@var{func}))
14621 @end example
14622 @item The final location of that label is in a code segment
14623 @emph{outside} the segment where the stubs are located.
14624 @end itemize
14625
14626 @item
14627 The compiler emits such @code{gs} modifiers for code labels in the
14628 following situations:
14629 @itemize @minus
14630 @item Taking address of a function or code label.
14631 @item Computed goto.
14632 @item If prologue-save function is used, see @option{-mcall-prologues}
14633 command-line option.
14634 @item Switch/case dispatch tables. If you do not want such dispatch
14635 tables you can specify the @option{-fno-jump-tables} command-line option.
14636 @item C and C++ constructors/destructors called during startup/shutdown.
14637 @item If the tools hit a @code{gs()} modifier explained above.
14638 @end itemize
14639
14640 @item
14641 Jumping to non-symbolic addresses like so is @emph{not} supported:
14642
14643 @example
14644 int main (void)
14645 @{
14646 /* Call function at word address 0x2 */
14647 return ((int(*)(void)) 0x2)();
14648 @}
14649 @end example
14650
14651 Instead, a stub has to be set up, i.e.@: the function has to be called
14652 through a symbol (@code{func_4} in the example):
14653
14654 @example
14655 int main (void)
14656 @{
14657 extern int func_4 (void);
14658
14659 /* Call function at byte address 0x4 */
14660 return func_4();
14661 @}
14662 @end example
14663
14664 and the application be linked with @option{-Wl,--defsym,func_4=0x4}.
14665 Alternatively, @code{func_4} can be defined in the linker script.
14666 @end itemize
14667
14668 @subsubsection Handling of the @code{RAMPD}, @code{RAMPX}, @code{RAMPY} and @code{RAMPZ} Special Function Registers
14669 @cindex @code{RAMPD}
14670 @cindex @code{RAMPX}
14671 @cindex @code{RAMPY}
14672 @cindex @code{RAMPZ}
14673 Some AVR devices support memories larger than the 64@tie{}KiB range
14674 that can be accessed with 16-bit pointers. To access memory locations
14675 outside this 64@tie{}KiB range, the contentent of a @code{RAMP}
14676 register is used as high part of the address:
14677 The @code{X}, @code{Y}, @code{Z} address register is concatenated
14678 with the @code{RAMPX}, @code{RAMPY}, @code{RAMPZ} special function
14679 register, respectively, to get a wide address. Similarly,
14680 @code{RAMPD} is used together with direct addressing.
14681
14682 @itemize
14683 @item
14684 The startup code initializes the @code{RAMP} special function
14685 registers with zero.
14686
14687 @item
14688 If a @ref{AVR Named Address Spaces,named address space} other than
14689 generic or @code{__flash} is used, then @code{RAMPZ} is set
14690 as needed before the operation.
14691
14692 @item
14693 If the device supports RAM larger than 64@tie{}KiB and the compiler
14694 needs to change @code{RAMPZ} to accomplish an operation, @code{RAMPZ}
14695 is reset to zero after the operation.
14696
14697 @item
14698 If the device comes with a specific @code{RAMP} register, the ISR
14699 prologue/epilogue saves/restores that SFR and initializes it with
14700 zero in case the ISR code might (implicitly) use it.
14701
14702 @item
14703 RAM larger than 64@tie{}KiB is not supported by GCC for AVR targets.
14704 If you use inline assembler to read from locations outside the
14705 16-bit address range and change one of the @code{RAMP} registers,
14706 you must reset it to zero after the access.
14707
14708 @end itemize
14709
14710 @subsubsection AVR Built-in Macros
14711
14712 GCC defines several built-in macros so that the user code can test
14713 for the presence or absence of features. Almost any of the following
14714 built-in macros are deduced from device capabilities and thus
14715 triggered by the @option{-mmcu=} command-line option.
14716
14717 For even more AVR-specific built-in macros see
14718 @ref{AVR Named Address Spaces} and @ref{AVR Built-in Functions}.
14719
14720 @table @code
14721
14722 @item __AVR_ARCH__
14723 Build-in macro that resolves to a decimal number that identifies the
14724 architecture and depends on the @option{-mmcu=@var{mcu}} option.
14725 Possible values are:
14726
14727 @code{2}, @code{25}, @code{3}, @code{31}, @code{35},
14728 @code{4}, @code{5}, @code{51}, @code{6}
14729
14730 for @var{mcu}=@code{avr2}, @code{avr25}, @code{avr3}, @code{avr31},
14731 @code{avr35}, @code{avr4}, @code{avr5}, @code{avr51}, @code{avr6},
14732
14733 respectively and
14734
14735 @code{100}, @code{102}, @code{104},
14736 @code{105}, @code{106}, @code{107}
14737
14738 for @var{mcu}=@code{avrtiny}, @code{avrxmega2}, @code{avrxmega4},
14739 @code{avrxmega5}, @code{avrxmega6}, @code{avrxmega7}, respectively.
14740 If @var{mcu} specifies a device, this built-in macro is set
14741 accordingly. For example, with @option{-mmcu=atmega8} the macro is
14742 defined to @code{4}.
14743
14744 @item __AVR_@var{Device}__
14745 Setting @option{-mmcu=@var{device}} defines this built-in macro which reflects
14746 the device's name. For example, @option{-mmcu=atmega8} defines the
14747 built-in macro @code{__AVR_ATmega8__}, @option{-mmcu=attiny261a} defines
14748 @code{__AVR_ATtiny261A__}, etc.
14749
14750 The built-in macros' names follow
14751 the scheme @code{__AVR_@var{Device}__} where @var{Device} is
14752 the device name as from the AVR user manual. The difference between
14753 @var{Device} in the built-in macro and @var{device} in
14754 @option{-mmcu=@var{device}} is that the latter is always lowercase.
14755
14756 If @var{device} is not a device but only a core architecture like
14757 @samp{avr51}, this macro is not defined.
14758
14759 @item __AVR_DEVICE_NAME__
14760 Setting @option{-mmcu=@var{device}} defines this built-in macro to
14761 the device's name. For example, with @option{-mmcu=atmega8} the macro
14762 is defined to @code{atmega8}.
14763
14764 If @var{device} is not a device but only a core architecture like
14765 @samp{avr51}, this macro is not defined.
14766
14767 @item __AVR_XMEGA__
14768 The device / architecture belongs to the XMEGA family of devices.
14769
14770 @item __AVR_HAVE_ELPM__
14771 The device has the @code{ELPM} instruction.
14772
14773 @item __AVR_HAVE_ELPMX__
14774 The device has the @code{ELPM R@var{n},Z} and @code{ELPM
14775 R@var{n},Z+} instructions.
14776
14777 @item __AVR_HAVE_MOVW__
14778 The device has the @code{MOVW} instruction to perform 16-bit
14779 register-register moves.
14780
14781 @item __AVR_HAVE_LPMX__
14782 The device has the @code{LPM R@var{n},Z} and
14783 @code{LPM R@var{n},Z+} instructions.
14784
14785 @item __AVR_HAVE_MUL__
14786 The device has a hardware multiplier.
14787
14788 @item __AVR_HAVE_JMP_CALL__
14789 The device has the @code{JMP} and @code{CALL} instructions.
14790 This is the case for devices with at least 16@tie{}KiB of program
14791 memory.
14792
14793 @item __AVR_HAVE_EIJMP_EICALL__
14794 @itemx __AVR_3_BYTE_PC__
14795 The device has the @code{EIJMP} and @code{EICALL} instructions.
14796 This is the case for devices with more than 128@tie{}KiB of program memory.
14797 This also means that the program counter
14798 (PC) is 3@tie{}bytes wide.
14799
14800 @item __AVR_2_BYTE_PC__
14801 The program counter (PC) is 2@tie{}bytes wide. This is the case for devices
14802 with up to 128@tie{}KiB of program memory.
14803
14804 @item __AVR_HAVE_8BIT_SP__
14805 @itemx __AVR_HAVE_16BIT_SP__
14806 The stack pointer (SP) register is treated as 8-bit respectively
14807 16-bit register by the compiler.
14808 The definition of these macros is affected by @option{-mtiny-stack}.
14809
14810 @item __AVR_HAVE_SPH__
14811 @itemx __AVR_SP8__
14812 The device has the SPH (high part of stack pointer) special function
14813 register or has an 8-bit stack pointer, respectively.
14814 The definition of these macros is affected by @option{-mmcu=} and
14815 in the cases of @option{-mmcu=avr2} and @option{-mmcu=avr25} also
14816 by @option{-msp8}.
14817
14818 @item __AVR_HAVE_RAMPD__
14819 @itemx __AVR_HAVE_RAMPX__
14820 @itemx __AVR_HAVE_RAMPY__
14821 @itemx __AVR_HAVE_RAMPZ__
14822 The device has the @code{RAMPD}, @code{RAMPX}, @code{RAMPY},
14823 @code{RAMPZ} special function register, respectively.
14824
14825 @item __NO_INTERRUPTS__
14826 This macro reflects the @option{-mno-interrupts} command-line option.
14827
14828 @item __AVR_ERRATA_SKIP__
14829 @itemx __AVR_ERRATA_SKIP_JMP_CALL__
14830 Some AVR devices (AT90S8515, ATmega103) must not skip 32-bit
14831 instructions because of a hardware erratum. Skip instructions are
14832 @code{SBRS}, @code{SBRC}, @code{SBIS}, @code{SBIC} and @code{CPSE}.
14833 The second macro is only defined if @code{__AVR_HAVE_JMP_CALL__} is also
14834 set.
14835
14836 @item __AVR_ISA_RMW__
14837 The device has Read-Modify-Write instructions (XCH, LAC, LAS and LAT).
14838
14839 @item __AVR_SFR_OFFSET__=@var{offset}
14840 Instructions that can address I/O special function registers directly
14841 like @code{IN}, @code{OUT}, @code{SBI}, etc.@: may use a different
14842 address as if addressed by an instruction to access RAM like @code{LD}
14843 or @code{STS}. This offset depends on the device architecture and has
14844 to be subtracted from the RAM address in order to get the
14845 respective I/O@tie{}address.
14846
14847 @item __WITH_AVRLIBC__
14848 The compiler is configured to be used together with AVR-Libc.
14849 See the @option{--with-avrlibc} configure option.
14850
14851 @end table
14852
14853 @node Blackfin Options
14854 @subsection Blackfin Options
14855 @cindex Blackfin Options
14856
14857 @table @gcctabopt
14858 @item -mcpu=@var{cpu}@r{[}-@var{sirevision}@r{]}
14859 @opindex mcpu=
14860 Specifies the name of the target Blackfin processor. Currently, @var{cpu}
14861 can be one of @samp{bf512}, @samp{bf514}, @samp{bf516}, @samp{bf518},
14862 @samp{bf522}, @samp{bf523}, @samp{bf524}, @samp{bf525}, @samp{bf526},
14863 @samp{bf527}, @samp{bf531}, @samp{bf532}, @samp{bf533},
14864 @samp{bf534}, @samp{bf536}, @samp{bf537}, @samp{bf538}, @samp{bf539},
14865 @samp{bf542}, @samp{bf544}, @samp{bf547}, @samp{bf548}, @samp{bf549},
14866 @samp{bf542m}, @samp{bf544m}, @samp{bf547m}, @samp{bf548m}, @samp{bf549m},
14867 @samp{bf561}, @samp{bf592}.
14868
14869 The optional @var{sirevision} specifies the silicon revision of the target
14870 Blackfin processor. Any workarounds available for the targeted silicon revision
14871 are enabled. If @var{sirevision} is @samp{none}, no workarounds are enabled.
14872 If @var{sirevision} is @samp{any}, all workarounds for the targeted processor
14873 are enabled. The @code{__SILICON_REVISION__} macro is defined to two
14874 hexadecimal digits representing the major and minor numbers in the silicon
14875 revision. If @var{sirevision} is @samp{none}, the @code{__SILICON_REVISION__}
14876 is not defined. If @var{sirevision} is @samp{any}, the
14877 @code{__SILICON_REVISION__} is defined to be @code{0xffff}.
14878 If this optional @var{sirevision} is not used, GCC assumes the latest known
14879 silicon revision of the targeted Blackfin processor.
14880
14881 GCC defines a preprocessor macro for the specified @var{cpu}.
14882 For the @samp{bfin-elf} toolchain, this option causes the hardware BSP
14883 provided by libgloss to be linked in if @option{-msim} is not given.
14884
14885 Without this option, @samp{bf532} is used as the processor by default.
14886
14887 Note that support for @samp{bf561} is incomplete. For @samp{bf561},
14888 only the preprocessor macro is defined.
14889
14890 @item -msim
14891 @opindex msim
14892 Specifies that the program will be run on the simulator. This causes
14893 the simulator BSP provided by libgloss to be linked in. This option
14894 has effect only for @samp{bfin-elf} toolchain.
14895 Certain other options, such as @option{-mid-shared-library} and
14896 @option{-mfdpic}, imply @option{-msim}.
14897
14898 @item -momit-leaf-frame-pointer
14899 @opindex momit-leaf-frame-pointer
14900 Don't keep the frame pointer in a register for leaf functions. This
14901 avoids the instructions to save, set up and restore frame pointers and
14902 makes an extra register available in leaf functions. The option
14903 @option{-fomit-frame-pointer} removes the frame pointer for all functions,
14904 which might make debugging harder.
14905
14906 @item -mspecld-anomaly
14907 @opindex mspecld-anomaly
14908 When enabled, the compiler ensures that the generated code does not
14909 contain speculative loads after jump instructions. If this option is used,
14910 @code{__WORKAROUND_SPECULATIVE_LOADS} is defined.
14911
14912 @item -mno-specld-anomaly
14913 @opindex mno-specld-anomaly
14914 Don't generate extra code to prevent speculative loads from occurring.
14915
14916 @item -mcsync-anomaly
14917 @opindex mcsync-anomaly
14918 When enabled, the compiler ensures that the generated code does not
14919 contain CSYNC or SSYNC instructions too soon after conditional branches.
14920 If this option is used, @code{__WORKAROUND_SPECULATIVE_SYNCS} is defined.
14921
14922 @item -mno-csync-anomaly
14923 @opindex mno-csync-anomaly
14924 Don't generate extra code to prevent CSYNC or SSYNC instructions from
14925 occurring too soon after a conditional branch.
14926
14927 @item -mlow-64k
14928 @opindex mlow-64k
14929 When enabled, the compiler is free to take advantage of the knowledge that
14930 the entire program fits into the low 64k of memory.
14931
14932 @item -mno-low-64k
14933 @opindex mno-low-64k
14934 Assume that the program is arbitrarily large. This is the default.
14935
14936 @item -mstack-check-l1
14937 @opindex mstack-check-l1
14938 Do stack checking using information placed into L1 scratchpad memory by the
14939 uClinux kernel.
14940
14941 @item -mid-shared-library
14942 @opindex mid-shared-library
14943 Generate code that supports shared libraries via the library ID method.
14944 This allows for execute in place and shared libraries in an environment
14945 without virtual memory management. This option implies @option{-fPIC}.
14946 With a @samp{bfin-elf} target, this option implies @option{-msim}.
14947
14948 @item -mno-id-shared-library
14949 @opindex mno-id-shared-library
14950 Generate code that doesn't assume ID-based shared libraries are being used.
14951 This is the default.
14952
14953 @item -mleaf-id-shared-library
14954 @opindex mleaf-id-shared-library
14955 Generate code that supports shared libraries via the library ID method,
14956 but assumes that this library or executable won't link against any other
14957 ID shared libraries. That allows the compiler to use faster code for jumps
14958 and calls.
14959
14960 @item -mno-leaf-id-shared-library
14961 @opindex mno-leaf-id-shared-library
14962 Do not assume that the code being compiled won't link against any ID shared
14963 libraries. Slower code is generated for jump and call insns.
14964
14965 @item -mshared-library-id=n
14966 @opindex mshared-library-id
14967 Specifies the identification number of the ID-based shared library being
14968 compiled. Specifying a value of 0 generates more compact code; specifying
14969 other values forces the allocation of that number to the current
14970 library but is no more space- or time-efficient than omitting this option.
14971
14972 @item -msep-data
14973 @opindex msep-data
14974 Generate code that allows the data segment to be located in a different
14975 area of memory from the text segment. This allows for execute in place in
14976 an environment without virtual memory management by eliminating relocations
14977 against the text section.
14978
14979 @item -mno-sep-data
14980 @opindex mno-sep-data
14981 Generate code that assumes that the data segment follows the text segment.
14982 This is the default.
14983
14984 @item -mlong-calls
14985 @itemx -mno-long-calls
14986 @opindex mlong-calls
14987 @opindex mno-long-calls
14988 Tells the compiler to perform function calls by first loading the
14989 address of the function into a register and then performing a subroutine
14990 call on this register. This switch is needed if the target function
14991 lies outside of the 24-bit addressing range of the offset-based
14992 version of subroutine call instruction.
14993
14994 This feature is not enabled by default. Specifying
14995 @option{-mno-long-calls} restores the default behavior. Note these
14996 switches have no effect on how the compiler generates code to handle
14997 function calls via function pointers.
14998
14999 @item -mfast-fp
15000 @opindex mfast-fp
15001 Link with the fast floating-point library. This library relaxes some of
15002 the IEEE floating-point standard's rules for checking inputs against
15003 Not-a-Number (NAN), in the interest of performance.
15004
15005 @item -minline-plt
15006 @opindex minline-plt
15007 Enable inlining of PLT entries in function calls to functions that are
15008 not known to bind locally. It has no effect without @option{-mfdpic}.
15009
15010 @item -mmulticore
15011 @opindex mmulticore
15012 Build a standalone application for multicore Blackfin processors.
15013 This option causes proper start files and link scripts supporting
15014 multicore to be used, and defines the macro @code{__BFIN_MULTICORE}.
15015 It can only be used with @option{-mcpu=bf561@r{[}-@var{sirevision}@r{]}}.
15016
15017 This option can be used with @option{-mcorea} or @option{-mcoreb}, which
15018 selects the one-application-per-core programming model. Without
15019 @option{-mcorea} or @option{-mcoreb}, the single-application/dual-core
15020 programming model is used. In this model, the main function of Core B
15021 should be named as @code{coreb_main}.
15022
15023 If this option is not used, the single-core application programming
15024 model is used.
15025
15026 @item -mcorea
15027 @opindex mcorea
15028 Build a standalone application for Core A of BF561 when using
15029 the one-application-per-core programming model. Proper start files
15030 and link scripts are used to support Core A, and the macro
15031 @code{__BFIN_COREA} is defined.
15032 This option can only be used in conjunction with @option{-mmulticore}.
15033
15034 @item -mcoreb
15035 @opindex mcoreb
15036 Build a standalone application for Core B of BF561 when using
15037 the one-application-per-core programming model. Proper start files
15038 and link scripts are used to support Core B, and the macro
15039 @code{__BFIN_COREB} is defined. When this option is used, @code{coreb_main}
15040 should be used instead of @code{main}.
15041 This option can only be used in conjunction with @option{-mmulticore}.
15042
15043 @item -msdram
15044 @opindex msdram
15045 Build a standalone application for SDRAM. Proper start files and
15046 link scripts are used to put the application into SDRAM, and the macro
15047 @code{__BFIN_SDRAM} is defined.
15048 The loader should initialize SDRAM before loading the application.
15049
15050 @item -micplb
15051 @opindex micplb
15052 Assume that ICPLBs are enabled at run time. This has an effect on certain
15053 anomaly workarounds. For Linux targets, the default is to assume ICPLBs
15054 are enabled; for standalone applications the default is off.
15055 @end table
15056
15057 @node C6X Options
15058 @subsection C6X Options
15059 @cindex C6X Options
15060
15061 @table @gcctabopt
15062 @item -march=@var{name}
15063 @opindex march
15064 This specifies the name of the target architecture. GCC uses this
15065 name to determine what kind of instructions it can emit when generating
15066 assembly code. Permissible names are: @samp{c62x},
15067 @samp{c64x}, @samp{c64x+}, @samp{c67x}, @samp{c67x+}, @samp{c674x}.
15068
15069 @item -mbig-endian
15070 @opindex mbig-endian
15071 Generate code for a big-endian target.
15072
15073 @item -mlittle-endian
15074 @opindex mlittle-endian
15075 Generate code for a little-endian target. This is the default.
15076
15077 @item -msim
15078 @opindex msim
15079 Choose startup files and linker script suitable for the simulator.
15080
15081 @item -msdata=default
15082 @opindex msdata=default
15083 Put small global and static data in the @code{.neardata} section,
15084 which is pointed to by register @code{B14}. Put small uninitialized
15085 global and static data in the @code{.bss} section, which is adjacent
15086 to the @code{.neardata} section. Put small read-only data into the
15087 @code{.rodata} section. The corresponding sections used for large
15088 pieces of data are @code{.fardata}, @code{.far} and @code{.const}.
15089
15090 @item -msdata=all
15091 @opindex msdata=all
15092 Put all data, not just small objects, into the sections reserved for
15093 small data, and use addressing relative to the @code{B14} register to
15094 access them.
15095
15096 @item -msdata=none
15097 @opindex msdata=none
15098 Make no use of the sections reserved for small data, and use absolute
15099 addresses to access all data. Put all initialized global and static
15100 data in the @code{.fardata} section, and all uninitialized data in the
15101 @code{.far} section. Put all constant data into the @code{.const}
15102 section.
15103 @end table
15104
15105 @node CRIS Options
15106 @subsection CRIS Options
15107 @cindex CRIS Options
15108
15109 These options are defined specifically for the CRIS ports.
15110
15111 @table @gcctabopt
15112 @item -march=@var{architecture-type}
15113 @itemx -mcpu=@var{architecture-type}
15114 @opindex march
15115 @opindex mcpu
15116 Generate code for the specified architecture. The choices for
15117 @var{architecture-type} are @samp{v3}, @samp{v8} and @samp{v10} for
15118 respectively ETRAX@w{ }4, ETRAX@w{ }100, and ETRAX@w{ }100@w{ }LX@.
15119 Default is @samp{v0} except for cris-axis-linux-gnu, where the default is
15120 @samp{v10}.
15121
15122 @item -mtune=@var{architecture-type}
15123 @opindex mtune
15124 Tune to @var{architecture-type} everything applicable about the generated
15125 code, except for the ABI and the set of available instructions. The
15126 choices for @var{architecture-type} are the same as for
15127 @option{-march=@var{architecture-type}}.
15128
15129 @item -mmax-stack-frame=@var{n}
15130 @opindex mmax-stack-frame
15131 Warn when the stack frame of a function exceeds @var{n} bytes.
15132
15133 @item -metrax4
15134 @itemx -metrax100
15135 @opindex metrax4
15136 @opindex metrax100
15137 The options @option{-metrax4} and @option{-metrax100} are synonyms for
15138 @option{-march=v3} and @option{-march=v8} respectively.
15139
15140 @item -mmul-bug-workaround
15141 @itemx -mno-mul-bug-workaround
15142 @opindex mmul-bug-workaround
15143 @opindex mno-mul-bug-workaround
15144 Work around a bug in the @code{muls} and @code{mulu} instructions for CPU
15145 models where it applies. This option is active by default.
15146
15147 @item -mpdebug
15148 @opindex mpdebug
15149 Enable CRIS-specific verbose debug-related information in the assembly
15150 code. This option also has the effect of turning off the @samp{#NO_APP}
15151 formatted-code indicator to the assembler at the beginning of the
15152 assembly file.
15153
15154 @item -mcc-init
15155 @opindex mcc-init
15156 Do not use condition-code results from previous instruction; always emit
15157 compare and test instructions before use of condition codes.
15158
15159 @item -mno-side-effects
15160 @opindex mno-side-effects
15161 Do not emit instructions with side effects in addressing modes other than
15162 post-increment.
15163
15164 @item -mstack-align
15165 @itemx -mno-stack-align
15166 @itemx -mdata-align
15167 @itemx -mno-data-align
15168 @itemx -mconst-align
15169 @itemx -mno-const-align
15170 @opindex mstack-align
15171 @opindex mno-stack-align
15172 @opindex mdata-align
15173 @opindex mno-data-align
15174 @opindex mconst-align
15175 @opindex mno-const-align
15176 These options (@samp{no-} options) arrange (eliminate arrangements) for the
15177 stack frame, individual data and constants to be aligned for the maximum
15178 single data access size for the chosen CPU model. The default is to
15179 arrange for 32-bit alignment. ABI details such as structure layout are
15180 not affected by these options.
15181
15182 @item -m32-bit
15183 @itemx -m16-bit
15184 @itemx -m8-bit
15185 @opindex m32-bit
15186 @opindex m16-bit
15187 @opindex m8-bit
15188 Similar to the stack- data- and const-align options above, these options
15189 arrange for stack frame, writable data and constants to all be 32-bit,
15190 16-bit or 8-bit aligned. The default is 32-bit alignment.
15191
15192 @item -mno-prologue-epilogue
15193 @itemx -mprologue-epilogue
15194 @opindex mno-prologue-epilogue
15195 @opindex mprologue-epilogue
15196 With @option{-mno-prologue-epilogue}, the normal function prologue and
15197 epilogue which set up the stack frame are omitted and no return
15198 instructions or return sequences are generated in the code. Use this
15199 option only together with visual inspection of the compiled code: no
15200 warnings or errors are generated when call-saved registers must be saved,
15201 or storage for local variables needs to be allocated.
15202
15203 @item -mno-gotplt
15204 @itemx -mgotplt
15205 @opindex mno-gotplt
15206 @opindex mgotplt
15207 With @option{-fpic} and @option{-fPIC}, don't generate (do generate)
15208 instruction sequences that load addresses for functions from the PLT part
15209 of the GOT rather than (traditional on other architectures) calls to the
15210 PLT@. The default is @option{-mgotplt}.
15211
15212 @item -melf
15213 @opindex melf
15214 Legacy no-op option only recognized with the cris-axis-elf and
15215 cris-axis-linux-gnu targets.
15216
15217 @item -mlinux
15218 @opindex mlinux
15219 Legacy no-op option only recognized with the cris-axis-linux-gnu target.
15220
15221 @item -sim
15222 @opindex sim
15223 This option, recognized for the cris-axis-elf, arranges
15224 to link with input-output functions from a simulator library. Code,
15225 initialized data and zero-initialized data are allocated consecutively.
15226
15227 @item -sim2
15228 @opindex sim2
15229 Like @option{-sim}, but pass linker options to locate initialized data at
15230 0x40000000 and zero-initialized data at 0x80000000.
15231 @end table
15232
15233 @node CR16 Options
15234 @subsection CR16 Options
15235 @cindex CR16 Options
15236
15237 These options are defined specifically for the CR16 ports.
15238
15239 @table @gcctabopt
15240
15241 @item -mmac
15242 @opindex mmac
15243 Enable the use of multiply-accumulate instructions. Disabled by default.
15244
15245 @item -mcr16cplus
15246 @itemx -mcr16c
15247 @opindex mcr16cplus
15248 @opindex mcr16c
15249 Generate code for CR16C or CR16C+ architecture. CR16C+ architecture
15250 is default.
15251
15252 @item -msim
15253 @opindex msim
15254 Links the library libsim.a which is in compatible with simulator. Applicable
15255 to ELF compiler only.
15256
15257 @item -mint32
15258 @opindex mint32
15259 Choose integer type as 32-bit wide.
15260
15261 @item -mbit-ops
15262 @opindex mbit-ops
15263 Generates @code{sbit}/@code{cbit} instructions for bit manipulations.
15264
15265 @item -mdata-model=@var{model}
15266 @opindex mdata-model
15267 Choose a data model. The choices for @var{model} are @samp{near},
15268 @samp{far} or @samp{medium}. @samp{medium} is default.
15269 However, @samp{far} is not valid with @option{-mcr16c}, as the
15270 CR16C architecture does not support the far data model.
15271 @end table
15272
15273 @node Darwin Options
15274 @subsection Darwin Options
15275 @cindex Darwin options
15276
15277 These options are defined for all architectures running the Darwin operating
15278 system.
15279
15280 FSF GCC on Darwin does not create ``fat'' object files; it creates
15281 an object file for the single architecture that GCC was built to
15282 target. Apple's GCC on Darwin does create ``fat'' files if multiple
15283 @option{-arch} options are used; it does so by running the compiler or
15284 linker multiple times and joining the results together with
15285 @file{lipo}.
15286
15287 The subtype of the file created (like @samp{ppc7400} or @samp{ppc970} or
15288 @samp{i686}) is determined by the flags that specify the ISA
15289 that GCC is targeting, like @option{-mcpu} or @option{-march}. The
15290 @option{-force_cpusubtype_ALL} option can be used to override this.
15291
15292 The Darwin tools vary in their behavior when presented with an ISA
15293 mismatch. The assembler, @file{as}, only permits instructions to
15294 be used that are valid for the subtype of the file it is generating,
15295 so you cannot put 64-bit instructions in a @samp{ppc750} object file.
15296 The linker for shared libraries, @file{/usr/bin/libtool}, fails
15297 and prints an error if asked to create a shared library with a less
15298 restrictive subtype than its input files (for instance, trying to put
15299 a @samp{ppc970} object file in a @samp{ppc7400} library). The linker
15300 for executables, @command{ld}, quietly gives the executable the most
15301 restrictive subtype of any of its input files.
15302
15303 @table @gcctabopt
15304 @item -F@var{dir}
15305 @opindex F
15306 Add the framework directory @var{dir} to the head of the list of
15307 directories to be searched for header files. These directories are
15308 interleaved with those specified by @option{-I} options and are
15309 scanned in a left-to-right order.
15310
15311 A framework directory is a directory with frameworks in it. A
15312 framework is a directory with a @file{Headers} and/or
15313 @file{PrivateHeaders} directory contained directly in it that ends
15314 in @file{.framework}. The name of a framework is the name of this
15315 directory excluding the @file{.framework}. Headers associated with
15316 the framework are found in one of those two directories, with
15317 @file{Headers} being searched first. A subframework is a framework
15318 directory that is in a framework's @file{Frameworks} directory.
15319 Includes of subframework headers can only appear in a header of a
15320 framework that contains the subframework, or in a sibling subframework
15321 header. Two subframeworks are siblings if they occur in the same
15322 framework. A subframework should not have the same name as a
15323 framework; a warning is issued if this is violated. Currently a
15324 subframework cannot have subframeworks; in the future, the mechanism
15325 may be extended to support this. The standard frameworks can be found
15326 in @file{/System/Library/Frameworks} and
15327 @file{/Library/Frameworks}. An example include looks like
15328 @code{#include <Framework/header.h>}, where @file{Framework} denotes
15329 the name of the framework and @file{header.h} is found in the
15330 @file{PrivateHeaders} or @file{Headers} directory.
15331
15332 @item -iframework@var{dir}
15333 @opindex iframework
15334 Like @option{-F} except the directory is a treated as a system
15335 directory. The main difference between this @option{-iframework} and
15336 @option{-F} is that with @option{-iframework} the compiler does not
15337 warn about constructs contained within header files found via
15338 @var{dir}. This option is valid only for the C family of languages.
15339
15340 @item -gused
15341 @opindex gused
15342 Emit debugging information for symbols that are used. For stabs
15343 debugging format, this enables @option{-feliminate-unused-debug-symbols}.
15344 This is by default ON@.
15345
15346 @item -gfull
15347 @opindex gfull
15348 Emit debugging information for all symbols and types.
15349
15350 @item -mmacosx-version-min=@var{version}
15351 The earliest version of MacOS X that this executable will run on
15352 is @var{version}. Typical values of @var{version} include @code{10.1},
15353 @code{10.2}, and @code{10.3.9}.
15354
15355 If the compiler was built to use the system's headers by default,
15356 then the default for this option is the system version on which the
15357 compiler is running, otherwise the default is to make choices that
15358 are compatible with as many systems and code bases as possible.
15359
15360 @item -mkernel
15361 @opindex mkernel
15362 Enable kernel development mode. The @option{-mkernel} option sets
15363 @option{-static}, @option{-fno-common}, @option{-fno-use-cxa-atexit},
15364 @option{-fno-exceptions}, @option{-fno-non-call-exceptions},
15365 @option{-fapple-kext}, @option{-fno-weak} and @option{-fno-rtti} where
15366 applicable. This mode also sets @option{-mno-altivec},
15367 @option{-msoft-float}, @option{-fno-builtin} and
15368 @option{-mlong-branch} for PowerPC targets.
15369
15370 @item -mone-byte-bool
15371 @opindex mone-byte-bool
15372 Override the defaults for @code{bool} so that @code{sizeof(bool)==1}.
15373 By default @code{sizeof(bool)} is @code{4} when compiling for
15374 Darwin/PowerPC and @code{1} when compiling for Darwin/x86, so this
15375 option has no effect on x86.
15376
15377 @strong{Warning:} The @option{-mone-byte-bool} switch causes GCC
15378 to generate code that is not binary compatible with code generated
15379 without that switch. Using this switch may require recompiling all
15380 other modules in a program, including system libraries. Use this
15381 switch to conform to a non-default data model.
15382
15383 @item -mfix-and-continue
15384 @itemx -ffix-and-continue
15385 @itemx -findirect-data
15386 @opindex mfix-and-continue
15387 @opindex ffix-and-continue
15388 @opindex findirect-data
15389 Generate code suitable for fast turnaround development, such as to
15390 allow GDB to dynamically load @file{.o} files into already-running
15391 programs. @option{-findirect-data} and @option{-ffix-and-continue}
15392 are provided for backwards compatibility.
15393
15394 @item -all_load
15395 @opindex all_load
15396 Loads all members of static archive libraries.
15397 See man ld(1) for more information.
15398
15399 @item -arch_errors_fatal
15400 @opindex arch_errors_fatal
15401 Cause the errors having to do with files that have the wrong architecture
15402 to be fatal.
15403
15404 @item -bind_at_load
15405 @opindex bind_at_load
15406 Causes the output file to be marked such that the dynamic linker will
15407 bind all undefined references when the file is loaded or launched.
15408
15409 @item -bundle
15410 @opindex bundle
15411 Produce a Mach-o bundle format file.
15412 See man ld(1) for more information.
15413
15414 @item -bundle_loader @var{executable}
15415 @opindex bundle_loader
15416 This option specifies the @var{executable} that will load the build
15417 output file being linked. See man ld(1) for more information.
15418
15419 @item -dynamiclib
15420 @opindex dynamiclib
15421 When passed this option, GCC produces a dynamic library instead of
15422 an executable when linking, using the Darwin @file{libtool} command.
15423
15424 @item -force_cpusubtype_ALL
15425 @opindex force_cpusubtype_ALL
15426 This causes GCC's output file to have the @samp{ALL} subtype, instead of
15427 one controlled by the @option{-mcpu} or @option{-march} option.
15428
15429 @item -allowable_client @var{client_name}
15430 @itemx -client_name
15431 @itemx -compatibility_version
15432 @itemx -current_version
15433 @itemx -dead_strip
15434 @itemx -dependency-file
15435 @itemx -dylib_file
15436 @itemx -dylinker_install_name
15437 @itemx -dynamic
15438 @itemx -exported_symbols_list
15439 @itemx -filelist
15440 @need 800
15441 @itemx -flat_namespace
15442 @itemx -force_flat_namespace
15443 @itemx -headerpad_max_install_names
15444 @itemx -image_base
15445 @itemx -init
15446 @itemx -install_name
15447 @itemx -keep_private_externs
15448 @itemx -multi_module
15449 @itemx -multiply_defined
15450 @itemx -multiply_defined_unused
15451 @need 800
15452 @itemx -noall_load
15453 @itemx -no_dead_strip_inits_and_terms
15454 @itemx -nofixprebinding
15455 @itemx -nomultidefs
15456 @itemx -noprebind
15457 @itemx -noseglinkedit
15458 @itemx -pagezero_size
15459 @itemx -prebind
15460 @itemx -prebind_all_twolevel_modules
15461 @itemx -private_bundle
15462 @need 800
15463 @itemx -read_only_relocs
15464 @itemx -sectalign
15465 @itemx -sectobjectsymbols
15466 @itemx -whyload
15467 @itemx -seg1addr
15468 @itemx -sectcreate
15469 @itemx -sectobjectsymbols
15470 @itemx -sectorder
15471 @itemx -segaddr
15472 @itemx -segs_read_only_addr
15473 @need 800
15474 @itemx -segs_read_write_addr
15475 @itemx -seg_addr_table
15476 @itemx -seg_addr_table_filename
15477 @itemx -seglinkedit
15478 @itemx -segprot
15479 @itemx -segs_read_only_addr
15480 @itemx -segs_read_write_addr
15481 @itemx -single_module
15482 @itemx -static
15483 @itemx -sub_library
15484 @need 800
15485 @itemx -sub_umbrella
15486 @itemx -twolevel_namespace
15487 @itemx -umbrella
15488 @itemx -undefined
15489 @itemx -unexported_symbols_list
15490 @itemx -weak_reference_mismatches
15491 @itemx -whatsloaded
15492 @opindex allowable_client
15493 @opindex client_name
15494 @opindex compatibility_version
15495 @opindex current_version
15496 @opindex dead_strip
15497 @opindex dependency-file
15498 @opindex dylib_file
15499 @opindex dylinker_install_name
15500 @opindex dynamic
15501 @opindex exported_symbols_list
15502 @opindex filelist
15503 @opindex flat_namespace
15504 @opindex force_flat_namespace
15505 @opindex headerpad_max_install_names
15506 @opindex image_base
15507 @opindex init
15508 @opindex install_name
15509 @opindex keep_private_externs
15510 @opindex multi_module
15511 @opindex multiply_defined
15512 @opindex multiply_defined_unused
15513 @opindex noall_load
15514 @opindex no_dead_strip_inits_and_terms
15515 @opindex nofixprebinding
15516 @opindex nomultidefs
15517 @opindex noprebind
15518 @opindex noseglinkedit
15519 @opindex pagezero_size
15520 @opindex prebind
15521 @opindex prebind_all_twolevel_modules
15522 @opindex private_bundle
15523 @opindex read_only_relocs
15524 @opindex sectalign
15525 @opindex sectobjectsymbols
15526 @opindex whyload
15527 @opindex seg1addr
15528 @opindex sectcreate
15529 @opindex sectobjectsymbols
15530 @opindex sectorder
15531 @opindex segaddr
15532 @opindex segs_read_only_addr
15533 @opindex segs_read_write_addr
15534 @opindex seg_addr_table
15535 @opindex seg_addr_table_filename
15536 @opindex seglinkedit
15537 @opindex segprot
15538 @opindex segs_read_only_addr
15539 @opindex segs_read_write_addr
15540 @opindex single_module
15541 @opindex static
15542 @opindex sub_library
15543 @opindex sub_umbrella
15544 @opindex twolevel_namespace
15545 @opindex umbrella
15546 @opindex undefined
15547 @opindex unexported_symbols_list
15548 @opindex weak_reference_mismatches
15549 @opindex whatsloaded
15550 These options are passed to the Darwin linker. The Darwin linker man page
15551 describes them in detail.
15552 @end table
15553
15554 @node DEC Alpha Options
15555 @subsection DEC Alpha Options
15556
15557 These @samp{-m} options are defined for the DEC Alpha implementations:
15558
15559 @table @gcctabopt
15560 @item -mno-soft-float
15561 @itemx -msoft-float
15562 @opindex mno-soft-float
15563 @opindex msoft-float
15564 Use (do not use) the hardware floating-point instructions for
15565 floating-point operations. When @option{-msoft-float} is specified,
15566 functions in @file{libgcc.a} are used to perform floating-point
15567 operations. Unless they are replaced by routines that emulate the
15568 floating-point operations, or compiled in such a way as to call such
15569 emulations routines, these routines issue floating-point
15570 operations. If you are compiling for an Alpha without floating-point
15571 operations, you must ensure that the library is built so as not to call
15572 them.
15573
15574 Note that Alpha implementations without floating-point operations are
15575 required to have floating-point registers.
15576
15577 @item -mfp-reg
15578 @itemx -mno-fp-regs
15579 @opindex mfp-reg
15580 @opindex mno-fp-regs
15581 Generate code that uses (does not use) the floating-point register set.
15582 @option{-mno-fp-regs} implies @option{-msoft-float}. If the floating-point
15583 register set is not used, floating-point operands are passed in integer
15584 registers as if they were integers and floating-point results are passed
15585 in @code{$0} instead of @code{$f0}. This is a non-standard calling sequence,
15586 so any function with a floating-point argument or return value called by code
15587 compiled with @option{-mno-fp-regs} must also be compiled with that
15588 option.
15589
15590 A typical use of this option is building a kernel that does not use,
15591 and hence need not save and restore, any floating-point registers.
15592
15593 @item -mieee
15594 @opindex mieee
15595 The Alpha architecture implements floating-point hardware optimized for
15596 maximum performance. It is mostly compliant with the IEEE floating-point
15597 standard. However, for full compliance, software assistance is
15598 required. This option generates code fully IEEE-compliant code
15599 @emph{except} that the @var{inexact-flag} is not maintained (see below).
15600 If this option is turned on, the preprocessor macro @code{_IEEE_FP} is
15601 defined during compilation. The resulting code is less efficient but is
15602 able to correctly support denormalized numbers and exceptional IEEE
15603 values such as not-a-number and plus/minus infinity. Other Alpha
15604 compilers call this option @option{-ieee_with_no_inexact}.
15605
15606 @item -mieee-with-inexact
15607 @opindex mieee-with-inexact
15608 This is like @option{-mieee} except the generated code also maintains
15609 the IEEE @var{inexact-flag}. Turning on this option causes the
15610 generated code to implement fully-compliant IEEE math. In addition to
15611 @code{_IEEE_FP}, @code{_IEEE_FP_EXACT} is defined as a preprocessor
15612 macro. On some Alpha implementations the resulting code may execute
15613 significantly slower than the code generated by default. Since there is
15614 very little code that depends on the @var{inexact-flag}, you should
15615 normally not specify this option. Other Alpha compilers call this
15616 option @option{-ieee_with_inexact}.
15617
15618 @item -mfp-trap-mode=@var{trap-mode}
15619 @opindex mfp-trap-mode
15620 This option controls what floating-point related traps are enabled.
15621 Other Alpha compilers call this option @option{-fptm @var{trap-mode}}.
15622 The trap mode can be set to one of four values:
15623
15624 @table @samp
15625 @item n
15626 This is the default (normal) setting. The only traps that are enabled
15627 are the ones that cannot be disabled in software (e.g., division by zero
15628 trap).
15629
15630 @item u
15631 In addition to the traps enabled by @samp{n}, underflow traps are enabled
15632 as well.
15633
15634 @item su
15635 Like @samp{u}, but the instructions are marked to be safe for software
15636 completion (see Alpha architecture manual for details).
15637
15638 @item sui
15639 Like @samp{su}, but inexact traps are enabled as well.
15640 @end table
15641
15642 @item -mfp-rounding-mode=@var{rounding-mode}
15643 @opindex mfp-rounding-mode
15644 Selects the IEEE rounding mode. Other Alpha compilers call this option
15645 @option{-fprm @var{rounding-mode}}. The @var{rounding-mode} can be one
15646 of:
15647
15648 @table @samp
15649 @item n
15650 Normal IEEE rounding mode. Floating-point numbers are rounded towards
15651 the nearest machine number or towards the even machine number in case
15652 of a tie.
15653
15654 @item m
15655 Round towards minus infinity.
15656
15657 @item c
15658 Chopped rounding mode. Floating-point numbers are rounded towards zero.
15659
15660 @item d
15661 Dynamic rounding mode. A field in the floating-point control register
15662 (@var{fpcr}, see Alpha architecture reference manual) controls the
15663 rounding mode in effect. The C library initializes this register for
15664 rounding towards plus infinity. Thus, unless your program modifies the
15665 @var{fpcr}, @samp{d} corresponds to round towards plus infinity.
15666 @end table
15667
15668 @item -mtrap-precision=@var{trap-precision}
15669 @opindex mtrap-precision
15670 In the Alpha architecture, floating-point traps are imprecise. This
15671 means without software assistance it is impossible to recover from a
15672 floating trap and program execution normally needs to be terminated.
15673 GCC can generate code that can assist operating system trap handlers
15674 in determining the exact location that caused a floating-point trap.
15675 Depending on the requirements of an application, different levels of
15676 precisions can be selected:
15677
15678 @table @samp
15679 @item p
15680 Program precision. This option is the default and means a trap handler
15681 can only identify which program caused a floating-point exception.
15682
15683 @item f
15684 Function precision. The trap handler can determine the function that
15685 caused a floating-point exception.
15686
15687 @item i
15688 Instruction precision. The trap handler can determine the exact
15689 instruction that caused a floating-point exception.
15690 @end table
15691
15692 Other Alpha compilers provide the equivalent options called
15693 @option{-scope_safe} and @option{-resumption_safe}.
15694
15695 @item -mieee-conformant
15696 @opindex mieee-conformant
15697 This option marks the generated code as IEEE conformant. You must not
15698 use this option unless you also specify @option{-mtrap-precision=i} and either
15699 @option{-mfp-trap-mode=su} or @option{-mfp-trap-mode=sui}. Its only effect
15700 is to emit the line @samp{.eflag 48} in the function prologue of the
15701 generated assembly file.
15702
15703 @item -mbuild-constants
15704 @opindex mbuild-constants
15705 Normally GCC examines a 32- or 64-bit integer constant to
15706 see if it can construct it from smaller constants in two or three
15707 instructions. If it cannot, it outputs the constant as a literal and
15708 generates code to load it from the data segment at run time.
15709
15710 Use this option to require GCC to construct @emph{all} integer constants
15711 using code, even if it takes more instructions (the maximum is six).
15712
15713 You typically use this option to build a shared library dynamic
15714 loader. Itself a shared library, it must relocate itself in memory
15715 before it can find the variables and constants in its own data segment.
15716
15717 @item -mbwx
15718 @itemx -mno-bwx
15719 @itemx -mcix
15720 @itemx -mno-cix
15721 @itemx -mfix
15722 @itemx -mno-fix
15723 @itemx -mmax
15724 @itemx -mno-max
15725 @opindex mbwx
15726 @opindex mno-bwx
15727 @opindex mcix
15728 @opindex mno-cix
15729 @opindex mfix
15730 @opindex mno-fix
15731 @opindex mmax
15732 @opindex mno-max
15733 Indicate whether GCC should generate code to use the optional BWX,
15734 CIX, FIX and MAX instruction sets. The default is to use the instruction
15735 sets supported by the CPU type specified via @option{-mcpu=} option or that
15736 of the CPU on which GCC was built if none is specified.
15737
15738 @item -mfloat-vax
15739 @itemx -mfloat-ieee
15740 @opindex mfloat-vax
15741 @opindex mfloat-ieee
15742 Generate code that uses (does not use) VAX F and G floating-point
15743 arithmetic instead of IEEE single and double precision.
15744
15745 @item -mexplicit-relocs
15746 @itemx -mno-explicit-relocs
15747 @opindex mexplicit-relocs
15748 @opindex mno-explicit-relocs
15749 Older Alpha assemblers provided no way to generate symbol relocations
15750 except via assembler macros. Use of these macros does not allow
15751 optimal instruction scheduling. GNU binutils as of version 2.12
15752 supports a new syntax that allows the compiler to explicitly mark
15753 which relocations should apply to which instructions. This option
15754 is mostly useful for debugging, as GCC detects the capabilities of
15755 the assembler when it is built and sets the default accordingly.
15756
15757 @item -msmall-data
15758 @itemx -mlarge-data
15759 @opindex msmall-data
15760 @opindex mlarge-data
15761 When @option{-mexplicit-relocs} is in effect, static data is
15762 accessed via @dfn{gp-relative} relocations. When @option{-msmall-data}
15763 is used, objects 8 bytes long or smaller are placed in a @dfn{small data area}
15764 (the @code{.sdata} and @code{.sbss} sections) and are accessed via
15765 16-bit relocations off of the @code{$gp} register. This limits the
15766 size of the small data area to 64KB, but allows the variables to be
15767 directly accessed via a single instruction.
15768
15769 The default is @option{-mlarge-data}. With this option the data area
15770 is limited to just below 2GB@. Programs that require more than 2GB of
15771 data must use @code{malloc} or @code{mmap} to allocate the data in the
15772 heap instead of in the program's data segment.
15773
15774 When generating code for shared libraries, @option{-fpic} implies
15775 @option{-msmall-data} and @option{-fPIC} implies @option{-mlarge-data}.
15776
15777 @item -msmall-text
15778 @itemx -mlarge-text
15779 @opindex msmall-text
15780 @opindex mlarge-text
15781 When @option{-msmall-text} is used, the compiler assumes that the
15782 code of the entire program (or shared library) fits in 4MB, and is
15783 thus reachable with a branch instruction. When @option{-msmall-data}
15784 is used, the compiler can assume that all local symbols share the
15785 same @code{$gp} value, and thus reduce the number of instructions
15786 required for a function call from 4 to 1.
15787
15788 The default is @option{-mlarge-text}.
15789
15790 @item -mcpu=@var{cpu_type}
15791 @opindex mcpu
15792 Set the instruction set and instruction scheduling parameters for
15793 machine type @var{cpu_type}. You can specify either the @samp{EV}
15794 style name or the corresponding chip number. GCC supports scheduling
15795 parameters for the EV4, EV5 and EV6 family of processors and
15796 chooses the default values for the instruction set from the processor
15797 you specify. If you do not specify a processor type, GCC defaults
15798 to the processor on which the compiler was built.
15799
15800 Supported values for @var{cpu_type} are
15801
15802 @table @samp
15803 @item ev4
15804 @itemx ev45
15805 @itemx 21064
15806 Schedules as an EV4 and has no instruction set extensions.
15807
15808 @item ev5
15809 @itemx 21164
15810 Schedules as an EV5 and has no instruction set extensions.
15811
15812 @item ev56
15813 @itemx 21164a
15814 Schedules as an EV5 and supports the BWX extension.
15815
15816 @item pca56
15817 @itemx 21164pc
15818 @itemx 21164PC
15819 Schedules as an EV5 and supports the BWX and MAX extensions.
15820
15821 @item ev6
15822 @itemx 21264
15823 Schedules as an EV6 and supports the BWX, FIX, and MAX extensions.
15824
15825 @item ev67
15826 @itemx 21264a
15827 Schedules as an EV6 and supports the BWX, CIX, FIX, and MAX extensions.
15828 @end table
15829
15830 Native toolchains also support the value @samp{native},
15831 which selects the best architecture option for the host processor.
15832 @option{-mcpu=native} has no effect if GCC does not recognize
15833 the processor.
15834
15835 @item -mtune=@var{cpu_type}
15836 @opindex mtune
15837 Set only the instruction scheduling parameters for machine type
15838 @var{cpu_type}. The instruction set is not changed.
15839
15840 Native toolchains also support the value @samp{native},
15841 which selects the best architecture option for the host processor.
15842 @option{-mtune=native} has no effect if GCC does not recognize
15843 the processor.
15844
15845 @item -mmemory-latency=@var{time}
15846 @opindex mmemory-latency
15847 Sets the latency the scheduler should assume for typical memory
15848 references as seen by the application. This number is highly
15849 dependent on the memory access patterns used by the application
15850 and the size of the external cache on the machine.
15851
15852 Valid options for @var{time} are
15853
15854 @table @samp
15855 @item @var{number}
15856 A decimal number representing clock cycles.
15857
15858 @item L1
15859 @itemx L2
15860 @itemx L3
15861 @itemx main
15862 The compiler contains estimates of the number of clock cycles for
15863 ``typical'' EV4 & EV5 hardware for the Level 1, 2 & 3 caches
15864 (also called Dcache, Scache, and Bcache), as well as to main memory.
15865 Note that L3 is only valid for EV5.
15866
15867 @end table
15868 @end table
15869
15870 @node FR30 Options
15871 @subsection FR30 Options
15872 @cindex FR30 Options
15873
15874 These options are defined specifically for the FR30 port.
15875
15876 @table @gcctabopt
15877
15878 @item -msmall-model
15879 @opindex msmall-model
15880 Use the small address space model. This can produce smaller code, but
15881 it does assume that all symbolic values and addresses fit into a
15882 20-bit range.
15883
15884 @item -mno-lsim
15885 @opindex mno-lsim
15886 Assume that runtime support has been provided and so there is no need
15887 to include the simulator library (@file{libsim.a}) on the linker
15888 command line.
15889
15890 @end table
15891
15892 @node FT32 Options
15893 @subsection FT32 Options
15894 @cindex FT32 Options
15895
15896 These options are defined specifically for the FT32 port.
15897
15898 @table @gcctabopt
15899
15900 @item -msim
15901 @opindex msim
15902 Specifies that the program will be run on the simulator. This causes
15903 an alternate runtime startup and library to be linked.
15904 You must not use this option when generating programs that will run on
15905 real hardware; you must provide your own runtime library for whatever
15906 I/O functions are needed.
15907
15908 @item -mlra
15909 @opindex mlra
15910 Enable Local Register Allocation. This is still experimental for FT32,
15911 so by default the compiler uses standard reload.
15912
15913 @item -mnodiv
15914 @opindex mnodiv
15915 Do not use div and mod instructions.
15916
15917 @end table
15918
15919 @node FRV Options
15920 @subsection FRV Options
15921 @cindex FRV Options
15922
15923 @table @gcctabopt
15924 @item -mgpr-32
15925 @opindex mgpr-32
15926
15927 Only use the first 32 general-purpose registers.
15928
15929 @item -mgpr-64
15930 @opindex mgpr-64
15931
15932 Use all 64 general-purpose registers.
15933
15934 @item -mfpr-32
15935 @opindex mfpr-32
15936
15937 Use only the first 32 floating-point registers.
15938
15939 @item -mfpr-64
15940 @opindex mfpr-64
15941
15942 Use all 64 floating-point registers.
15943
15944 @item -mhard-float
15945 @opindex mhard-float
15946
15947 Use hardware instructions for floating-point operations.
15948
15949 @item -msoft-float
15950 @opindex msoft-float
15951
15952 Use library routines for floating-point operations.
15953
15954 @item -malloc-cc
15955 @opindex malloc-cc
15956
15957 Dynamically allocate condition code registers.
15958
15959 @item -mfixed-cc
15960 @opindex mfixed-cc
15961
15962 Do not try to dynamically allocate condition code registers, only
15963 use @code{icc0} and @code{fcc0}.
15964
15965 @item -mdword
15966 @opindex mdword
15967
15968 Change ABI to use double word insns.
15969
15970 @item -mno-dword
15971 @opindex mno-dword
15972
15973 Do not use double word instructions.
15974
15975 @item -mdouble
15976 @opindex mdouble
15977
15978 Use floating-point double instructions.
15979
15980 @item -mno-double
15981 @opindex mno-double
15982
15983 Do not use floating-point double instructions.
15984
15985 @item -mmedia
15986 @opindex mmedia
15987
15988 Use media instructions.
15989
15990 @item -mno-media
15991 @opindex mno-media
15992
15993 Do not use media instructions.
15994
15995 @item -mmuladd
15996 @opindex mmuladd
15997
15998 Use multiply and add/subtract instructions.
15999
16000 @item -mno-muladd
16001 @opindex mno-muladd
16002
16003 Do not use multiply and add/subtract instructions.
16004
16005 @item -mfdpic
16006 @opindex mfdpic
16007
16008 Select the FDPIC ABI, which uses function descriptors to represent
16009 pointers to functions. Without any PIC/PIE-related options, it
16010 implies @option{-fPIE}. With @option{-fpic} or @option{-fpie}, it
16011 assumes GOT entries and small data are within a 12-bit range from the
16012 GOT base address; with @option{-fPIC} or @option{-fPIE}, GOT offsets
16013 are computed with 32 bits.
16014 With a @samp{bfin-elf} target, this option implies @option{-msim}.
16015
16016 @item -minline-plt
16017 @opindex minline-plt
16018
16019 Enable inlining of PLT entries in function calls to functions that are
16020 not known to bind locally. It has no effect without @option{-mfdpic}.
16021 It's enabled by default if optimizing for speed and compiling for
16022 shared libraries (i.e., @option{-fPIC} or @option{-fpic}), or when an
16023 optimization option such as @option{-O3} or above is present in the
16024 command line.
16025
16026 @item -mTLS
16027 @opindex mTLS
16028
16029 Assume a large TLS segment when generating thread-local code.
16030
16031 @item -mtls
16032 @opindex mtls
16033
16034 Do not assume a large TLS segment when generating thread-local code.
16035
16036 @item -mgprel-ro
16037 @opindex mgprel-ro
16038
16039 Enable the use of @code{GPREL} relocations in the FDPIC ABI for data
16040 that is known to be in read-only sections. It's enabled by default,
16041 except for @option{-fpic} or @option{-fpie}: even though it may help
16042 make the global offset table smaller, it trades 1 instruction for 4.
16043 With @option{-fPIC} or @option{-fPIE}, it trades 3 instructions for 4,
16044 one of which may be shared by multiple symbols, and it avoids the need
16045 for a GOT entry for the referenced symbol, so it's more likely to be a
16046 win. If it is not, @option{-mno-gprel-ro} can be used to disable it.
16047
16048 @item -multilib-library-pic
16049 @opindex multilib-library-pic
16050
16051 Link with the (library, not FD) pic libraries. It's implied by
16052 @option{-mlibrary-pic}, as well as by @option{-fPIC} and
16053 @option{-fpic} without @option{-mfdpic}. You should never have to use
16054 it explicitly.
16055
16056 @item -mlinked-fp
16057 @opindex mlinked-fp
16058
16059 Follow the EABI requirement of always creating a frame pointer whenever
16060 a stack frame is allocated. This option is enabled by default and can
16061 be disabled with @option{-mno-linked-fp}.
16062
16063 @item -mlong-calls
16064 @opindex mlong-calls
16065
16066 Use indirect addressing to call functions outside the current
16067 compilation unit. This allows the functions to be placed anywhere
16068 within the 32-bit address space.
16069
16070 @item -malign-labels
16071 @opindex malign-labels
16072
16073 Try to align labels to an 8-byte boundary by inserting NOPs into the
16074 previous packet. This option only has an effect when VLIW packing
16075 is enabled. It doesn't create new packets; it merely adds NOPs to
16076 existing ones.
16077
16078 @item -mlibrary-pic
16079 @opindex mlibrary-pic
16080
16081 Generate position-independent EABI code.
16082
16083 @item -macc-4
16084 @opindex macc-4
16085
16086 Use only the first four media accumulator registers.
16087
16088 @item -macc-8
16089 @opindex macc-8
16090
16091 Use all eight media accumulator registers.
16092
16093 @item -mpack
16094 @opindex mpack
16095
16096 Pack VLIW instructions.
16097
16098 @item -mno-pack
16099 @opindex mno-pack
16100
16101 Do not pack VLIW instructions.
16102
16103 @item -mno-eflags
16104 @opindex mno-eflags
16105
16106 Do not mark ABI switches in e_flags.
16107
16108 @item -mcond-move
16109 @opindex mcond-move
16110
16111 Enable the use of conditional-move instructions (default).
16112
16113 This switch is mainly for debugging the compiler and will likely be removed
16114 in a future version.
16115
16116 @item -mno-cond-move
16117 @opindex mno-cond-move
16118
16119 Disable the use of conditional-move instructions.
16120
16121 This switch is mainly for debugging the compiler and will likely be removed
16122 in a future version.
16123
16124 @item -mscc
16125 @opindex mscc
16126
16127 Enable the use of conditional set instructions (default).
16128
16129 This switch is mainly for debugging the compiler and will likely be removed
16130 in a future version.
16131
16132 @item -mno-scc
16133 @opindex mno-scc
16134
16135 Disable the use of conditional set instructions.
16136
16137 This switch is mainly for debugging the compiler and will likely be removed
16138 in a future version.
16139
16140 @item -mcond-exec
16141 @opindex mcond-exec
16142
16143 Enable the use of conditional execution (default).
16144
16145 This switch is mainly for debugging the compiler and will likely be removed
16146 in a future version.
16147
16148 @item -mno-cond-exec
16149 @opindex mno-cond-exec
16150
16151 Disable the use of conditional execution.
16152
16153 This switch is mainly for debugging the compiler and will likely be removed
16154 in a future version.
16155
16156 @item -mvliw-branch
16157 @opindex mvliw-branch
16158
16159 Run a pass to pack branches into VLIW instructions (default).
16160
16161 This switch is mainly for debugging the compiler and will likely be removed
16162 in a future version.
16163
16164 @item -mno-vliw-branch
16165 @opindex mno-vliw-branch
16166
16167 Do not run a pass to pack branches into VLIW instructions.
16168
16169 This switch is mainly for debugging the compiler and will likely be removed
16170 in a future version.
16171
16172 @item -mmulti-cond-exec
16173 @opindex mmulti-cond-exec
16174
16175 Enable optimization of @code{&&} and @code{||} in conditional execution
16176 (default).
16177
16178 This switch is mainly for debugging the compiler and will likely be removed
16179 in a future version.
16180
16181 @item -mno-multi-cond-exec
16182 @opindex mno-multi-cond-exec
16183
16184 Disable optimization of @code{&&} and @code{||} in conditional execution.
16185
16186 This switch is mainly for debugging the compiler and will likely be removed
16187 in a future version.
16188
16189 @item -mnested-cond-exec
16190 @opindex mnested-cond-exec
16191
16192 Enable nested conditional execution optimizations (default).
16193
16194 This switch is mainly for debugging the compiler and will likely be removed
16195 in a future version.
16196
16197 @item -mno-nested-cond-exec
16198 @opindex mno-nested-cond-exec
16199
16200 Disable nested conditional execution optimizations.
16201
16202 This switch is mainly for debugging the compiler and will likely be removed
16203 in a future version.
16204
16205 @item -moptimize-membar
16206 @opindex moptimize-membar
16207
16208 This switch removes redundant @code{membar} instructions from the
16209 compiler-generated code. It is enabled by default.
16210
16211 @item -mno-optimize-membar
16212 @opindex mno-optimize-membar
16213
16214 This switch disables the automatic removal of redundant @code{membar}
16215 instructions from the generated code.
16216
16217 @item -mtomcat-stats
16218 @opindex mtomcat-stats
16219
16220 Cause gas to print out tomcat statistics.
16221
16222 @item -mcpu=@var{cpu}
16223 @opindex mcpu
16224
16225 Select the processor type for which to generate code. Possible values are
16226 @samp{frv}, @samp{fr550}, @samp{tomcat}, @samp{fr500}, @samp{fr450},
16227 @samp{fr405}, @samp{fr400}, @samp{fr300} and @samp{simple}.
16228
16229 @end table
16230
16231 @node GNU/Linux Options
16232 @subsection GNU/Linux Options
16233
16234 These @samp{-m} options are defined for GNU/Linux targets:
16235
16236 @table @gcctabopt
16237 @item -mglibc
16238 @opindex mglibc
16239 Use the GNU C library. This is the default except
16240 on @samp{*-*-linux-*uclibc*}, @samp{*-*-linux-*musl*} and
16241 @samp{*-*-linux-*android*} targets.
16242
16243 @item -muclibc
16244 @opindex muclibc
16245 Use uClibc C library. This is the default on
16246 @samp{*-*-linux-*uclibc*} targets.
16247
16248 @item -mmusl
16249 @opindex mmusl
16250 Use the musl C library. This is the default on
16251 @samp{*-*-linux-*musl*} targets.
16252
16253 @item -mbionic
16254 @opindex mbionic
16255 Use Bionic C library. This is the default on
16256 @samp{*-*-linux-*android*} targets.
16257
16258 @item -mandroid
16259 @opindex mandroid
16260 Compile code compatible with Android platform. This is the default on
16261 @samp{*-*-linux-*android*} targets.
16262
16263 When compiling, this option enables @option{-mbionic}, @option{-fPIC},
16264 @option{-fno-exceptions} and @option{-fno-rtti} by default. When linking,
16265 this option makes the GCC driver pass Android-specific options to the linker.
16266 Finally, this option causes the preprocessor macro @code{__ANDROID__}
16267 to be defined.
16268
16269 @item -tno-android-cc
16270 @opindex tno-android-cc
16271 Disable compilation effects of @option{-mandroid}, i.e., do not enable
16272 @option{-mbionic}, @option{-fPIC}, @option{-fno-exceptions} and
16273 @option{-fno-rtti} by default.
16274
16275 @item -tno-android-ld
16276 @opindex tno-android-ld
16277 Disable linking effects of @option{-mandroid}, i.e., pass standard Linux
16278 linking options to the linker.
16279
16280 @end table
16281
16282 @node H8/300 Options
16283 @subsection H8/300 Options
16284
16285 These @samp{-m} options are defined for the H8/300 implementations:
16286
16287 @table @gcctabopt
16288 @item -mrelax
16289 @opindex mrelax
16290 Shorten some address references at link time, when possible; uses the
16291 linker option @option{-relax}. @xref{H8/300,, @code{ld} and the H8/300,
16292 ld, Using ld}, for a fuller description.
16293
16294 @item -mh
16295 @opindex mh
16296 Generate code for the H8/300H@.
16297
16298 @item -ms
16299 @opindex ms
16300 Generate code for the H8S@.
16301
16302 @item -mn
16303 @opindex mn
16304 Generate code for the H8S and H8/300H in the normal mode. This switch
16305 must be used either with @option{-mh} or @option{-ms}.
16306
16307 @item -ms2600
16308 @opindex ms2600
16309 Generate code for the H8S/2600. This switch must be used with @option{-ms}.
16310
16311 @item -mexr
16312 @opindex mexr
16313 Extended registers are stored on stack before execution of function
16314 with monitor attribute. Default option is @option{-mexr}.
16315 This option is valid only for H8S targets.
16316
16317 @item -mno-exr
16318 @opindex mno-exr
16319 Extended registers are not stored on stack before execution of function
16320 with monitor attribute. Default option is @option{-mno-exr}.
16321 This option is valid only for H8S targets.
16322
16323 @item -mint32
16324 @opindex mint32
16325 Make @code{int} data 32 bits by default.
16326
16327 @item -malign-300
16328 @opindex malign-300
16329 On the H8/300H and H8S, use the same alignment rules as for the H8/300.
16330 The default for the H8/300H and H8S is to align longs and floats on
16331 4-byte boundaries.
16332 @option{-malign-300} causes them to be aligned on 2-byte boundaries.
16333 This option has no effect on the H8/300.
16334 @end table
16335
16336 @node HPPA Options
16337 @subsection HPPA Options
16338 @cindex HPPA Options
16339
16340 These @samp{-m} options are defined for the HPPA family of computers:
16341
16342 @table @gcctabopt
16343 @item -march=@var{architecture-type}
16344 @opindex march
16345 Generate code for the specified architecture. The choices for
16346 @var{architecture-type} are @samp{1.0} for PA 1.0, @samp{1.1} for PA
16347 1.1, and @samp{2.0} for PA 2.0 processors. Refer to
16348 @file{/usr/lib/sched.models} on an HP-UX system to determine the proper
16349 architecture option for your machine. Code compiled for lower numbered
16350 architectures runs on higher numbered architectures, but not the
16351 other way around.
16352
16353 @item -mpa-risc-1-0
16354 @itemx -mpa-risc-1-1
16355 @itemx -mpa-risc-2-0
16356 @opindex mpa-risc-1-0
16357 @opindex mpa-risc-1-1
16358 @opindex mpa-risc-2-0
16359 Synonyms for @option{-march=1.0}, @option{-march=1.1}, and @option{-march=2.0} respectively.
16360
16361 @item -mjump-in-delay
16362 @opindex mjump-in-delay
16363 This option is ignored and provided for compatibility purposes only.
16364
16365 @item -mdisable-fpregs
16366 @opindex mdisable-fpregs
16367 Prevent floating-point registers from being used in any manner. This is
16368 necessary for compiling kernels that perform lazy context switching of
16369 floating-point registers. If you use this option and attempt to perform
16370 floating-point operations, the compiler aborts.
16371
16372 @item -mdisable-indexing
16373 @opindex mdisable-indexing
16374 Prevent the compiler from using indexing address modes. This avoids some
16375 rather obscure problems when compiling MIG generated code under MACH@.
16376
16377 @item -mno-space-regs
16378 @opindex mno-space-regs
16379 Generate code that assumes the target has no space registers. This allows
16380 GCC to generate faster indirect calls and use unscaled index address modes.
16381
16382 Such code is suitable for level 0 PA systems and kernels.
16383
16384 @item -mfast-indirect-calls
16385 @opindex mfast-indirect-calls
16386 Generate code that assumes calls never cross space boundaries. This
16387 allows GCC to emit code that performs faster indirect calls.
16388
16389 This option does not work in the presence of shared libraries or nested
16390 functions.
16391
16392 @item -mfixed-range=@var{register-range}
16393 @opindex mfixed-range
16394 Generate code treating the given register range as fixed registers.
16395 A fixed register is one that the register allocator cannot use. This is
16396 useful when compiling kernel code. A register range is specified as
16397 two registers separated by a dash. Multiple register ranges can be
16398 specified separated by a comma.
16399
16400 @item -mlong-load-store
16401 @opindex mlong-load-store
16402 Generate 3-instruction load and store sequences as sometimes required by
16403 the HP-UX 10 linker. This is equivalent to the @samp{+k} option to
16404 the HP compilers.
16405
16406 @item -mportable-runtime
16407 @opindex mportable-runtime
16408 Use the portable calling conventions proposed by HP for ELF systems.
16409
16410 @item -mgas
16411 @opindex mgas
16412 Enable the use of assembler directives only GAS understands.
16413
16414 @item -mschedule=@var{cpu-type}
16415 @opindex mschedule
16416 Schedule code according to the constraints for the machine type
16417 @var{cpu-type}. The choices for @var{cpu-type} are @samp{700}
16418 @samp{7100}, @samp{7100LC}, @samp{7200}, @samp{7300} and @samp{8000}. Refer
16419 to @file{/usr/lib/sched.models} on an HP-UX system to determine the
16420 proper scheduling option for your machine. The default scheduling is
16421 @samp{8000}.
16422
16423 @item -mlinker-opt
16424 @opindex mlinker-opt
16425 Enable the optimization pass in the HP-UX linker. Note this makes symbolic
16426 debugging impossible. It also triggers a bug in the HP-UX 8 and HP-UX 9
16427 linkers in which they give bogus error messages when linking some programs.
16428
16429 @item -msoft-float
16430 @opindex msoft-float
16431 Generate output containing library calls for floating point.
16432 @strong{Warning:} the requisite libraries are not available for all HPPA
16433 targets. Normally the facilities of the machine's usual C compiler are
16434 used, but this cannot be done directly in cross-compilation. You must make
16435 your own arrangements to provide suitable library functions for
16436 cross-compilation.
16437
16438 @option{-msoft-float} changes the calling convention in the output file;
16439 therefore, it is only useful if you compile @emph{all} of a program with
16440 this option. In particular, you need to compile @file{libgcc.a}, the
16441 library that comes with GCC, with @option{-msoft-float} in order for
16442 this to work.
16443
16444 @item -msio
16445 @opindex msio
16446 Generate the predefine, @code{_SIO}, for server IO@. The default is
16447 @option{-mwsio}. This generates the predefines, @code{__hp9000s700},
16448 @code{__hp9000s700__} and @code{_WSIO}, for workstation IO@. These
16449 options are available under HP-UX and HI-UX@.
16450
16451 @item -mgnu-ld
16452 @opindex mgnu-ld
16453 Use options specific to GNU @command{ld}.
16454 This passes @option{-shared} to @command{ld} when
16455 building a shared library. It is the default when GCC is configured,
16456 explicitly or implicitly, with the GNU linker. This option does not
16457 affect which @command{ld} is called; it only changes what parameters
16458 are passed to that @command{ld}.
16459 The @command{ld} that is called is determined by the
16460 @option{--with-ld} configure option, GCC's program search path, and
16461 finally by the user's @env{PATH}. The linker used by GCC can be printed
16462 using @samp{which `gcc -print-prog-name=ld`}. This option is only available
16463 on the 64-bit HP-UX GCC, i.e.@: configured with @samp{hppa*64*-*-hpux*}.
16464
16465 @item -mhp-ld
16466 @opindex mhp-ld
16467 Use options specific to HP @command{ld}.
16468 This passes @option{-b} to @command{ld} when building
16469 a shared library and passes @option{+Accept TypeMismatch} to @command{ld} on all
16470 links. It is the default when GCC is configured, explicitly or
16471 implicitly, with the HP linker. This option does not affect
16472 which @command{ld} is called; it only changes what parameters are passed to that
16473 @command{ld}.
16474 The @command{ld} that is called is determined by the @option{--with-ld}
16475 configure option, GCC's program search path, and finally by the user's
16476 @env{PATH}. The linker used by GCC can be printed using @samp{which
16477 `gcc -print-prog-name=ld`}. This option is only available on the 64-bit
16478 HP-UX GCC, i.e.@: configured with @samp{hppa*64*-*-hpux*}.
16479
16480 @item -mlong-calls
16481 @opindex mno-long-calls
16482 Generate code that uses long call sequences. This ensures that a call
16483 is always able to reach linker generated stubs. The default is to generate
16484 long calls only when the distance from the call site to the beginning
16485 of the function or translation unit, as the case may be, exceeds a
16486 predefined limit set by the branch type being used. The limits for
16487 normal calls are 7,600,000 and 240,000 bytes, respectively for the
16488 PA 2.0 and PA 1.X architectures. Sibcalls are always limited at
16489 240,000 bytes.
16490
16491 Distances are measured from the beginning of functions when using the
16492 @option{-ffunction-sections} option, or when using the @option{-mgas}
16493 and @option{-mno-portable-runtime} options together under HP-UX with
16494 the SOM linker.
16495
16496 It is normally not desirable to use this option as it degrades
16497 performance. However, it may be useful in large applications,
16498 particularly when partial linking is used to build the application.
16499
16500 The types of long calls used depends on the capabilities of the
16501 assembler and linker, and the type of code being generated. The
16502 impact on systems that support long absolute calls, and long pic
16503 symbol-difference or pc-relative calls should be relatively small.
16504 However, an indirect call is used on 32-bit ELF systems in pic code
16505 and it is quite long.
16506
16507 @item -munix=@var{unix-std}
16508 @opindex march
16509 Generate compiler predefines and select a startfile for the specified
16510 UNIX standard. The choices for @var{unix-std} are @samp{93}, @samp{95}
16511 and @samp{98}. @samp{93} is supported on all HP-UX versions. @samp{95}
16512 is available on HP-UX 10.10 and later. @samp{98} is available on HP-UX
16513 11.11 and later. The default values are @samp{93} for HP-UX 10.00,
16514 @samp{95} for HP-UX 10.10 though to 11.00, and @samp{98} for HP-UX 11.11
16515 and later.
16516
16517 @option{-munix=93} provides the same predefines as GCC 3.3 and 3.4.
16518 @option{-munix=95} provides additional predefines for @code{XOPEN_UNIX}
16519 and @code{_XOPEN_SOURCE_EXTENDED}, and the startfile @file{unix95.o}.
16520 @option{-munix=98} provides additional predefines for @code{_XOPEN_UNIX},
16521 @code{_XOPEN_SOURCE_EXTENDED}, @code{_INCLUDE__STDC_A1_SOURCE} and
16522 @code{_INCLUDE_XOPEN_SOURCE_500}, and the startfile @file{unix98.o}.
16523
16524 It is @emph{important} to note that this option changes the interfaces
16525 for various library routines. It also affects the operational behavior
16526 of the C library. Thus, @emph{extreme} care is needed in using this
16527 option.
16528
16529 Library code that is intended to operate with more than one UNIX
16530 standard must test, set and restore the variable @code{__xpg4_extended_mask}
16531 as appropriate. Most GNU software doesn't provide this capability.
16532
16533 @item -nolibdld
16534 @opindex nolibdld
16535 Suppress the generation of link options to search libdld.sl when the
16536 @option{-static} option is specified on HP-UX 10 and later.
16537
16538 @item -static
16539 @opindex static
16540 The HP-UX implementation of setlocale in libc has a dependency on
16541 libdld.sl. There isn't an archive version of libdld.sl. Thus,
16542 when the @option{-static} option is specified, special link options
16543 are needed to resolve this dependency.
16544
16545 On HP-UX 10 and later, the GCC driver adds the necessary options to
16546 link with libdld.sl when the @option{-static} option is specified.
16547 This causes the resulting binary to be dynamic. On the 64-bit port,
16548 the linkers generate dynamic binaries by default in any case. The
16549 @option{-nolibdld} option can be used to prevent the GCC driver from
16550 adding these link options.
16551
16552 @item -threads
16553 @opindex threads
16554 Add support for multithreading with the @dfn{dce thread} library
16555 under HP-UX@. This option sets flags for both the preprocessor and
16556 linker.
16557 @end table
16558
16559 @node IA-64 Options
16560 @subsection IA-64 Options
16561 @cindex IA-64 Options
16562
16563 These are the @samp{-m} options defined for the Intel IA-64 architecture.
16564
16565 @table @gcctabopt
16566 @item -mbig-endian
16567 @opindex mbig-endian
16568 Generate code for a big-endian target. This is the default for HP-UX@.
16569
16570 @item -mlittle-endian
16571 @opindex mlittle-endian
16572 Generate code for a little-endian target. This is the default for AIX5
16573 and GNU/Linux.
16574
16575 @item -mgnu-as
16576 @itemx -mno-gnu-as
16577 @opindex mgnu-as
16578 @opindex mno-gnu-as
16579 Generate (or don't) code for the GNU assembler. This is the default.
16580 @c Also, this is the default if the configure option @option{--with-gnu-as}
16581 @c is used.
16582
16583 @item -mgnu-ld
16584 @itemx -mno-gnu-ld
16585 @opindex mgnu-ld
16586 @opindex mno-gnu-ld
16587 Generate (or don't) code for the GNU linker. This is the default.
16588 @c Also, this is the default if the configure option @option{--with-gnu-ld}
16589 @c is used.
16590
16591 @item -mno-pic
16592 @opindex mno-pic
16593 Generate code that does not use a global pointer register. The result
16594 is not position independent code, and violates the IA-64 ABI@.
16595
16596 @item -mvolatile-asm-stop
16597 @itemx -mno-volatile-asm-stop
16598 @opindex mvolatile-asm-stop
16599 @opindex mno-volatile-asm-stop
16600 Generate (or don't) a stop bit immediately before and after volatile asm
16601 statements.
16602
16603 @item -mregister-names
16604 @itemx -mno-register-names
16605 @opindex mregister-names
16606 @opindex mno-register-names
16607 Generate (or don't) @samp{in}, @samp{loc}, and @samp{out} register names for
16608 the stacked registers. This may make assembler output more readable.
16609
16610 @item -mno-sdata
16611 @itemx -msdata
16612 @opindex mno-sdata
16613 @opindex msdata
16614 Disable (or enable) optimizations that use the small data section. This may
16615 be useful for working around optimizer bugs.
16616
16617 @item -mconstant-gp
16618 @opindex mconstant-gp
16619 Generate code that uses a single constant global pointer value. This is
16620 useful when compiling kernel code.
16621
16622 @item -mauto-pic
16623 @opindex mauto-pic
16624 Generate code that is self-relocatable. This implies @option{-mconstant-gp}.
16625 This is useful when compiling firmware code.
16626
16627 @item -minline-float-divide-min-latency
16628 @opindex minline-float-divide-min-latency
16629 Generate code for inline divides of floating-point values
16630 using the minimum latency algorithm.
16631
16632 @item -minline-float-divide-max-throughput
16633 @opindex minline-float-divide-max-throughput
16634 Generate code for inline divides of floating-point values
16635 using the maximum throughput algorithm.
16636
16637 @item -mno-inline-float-divide
16638 @opindex mno-inline-float-divide
16639 Do not generate inline code for divides of floating-point values.
16640
16641 @item -minline-int-divide-min-latency
16642 @opindex minline-int-divide-min-latency
16643 Generate code for inline divides of integer values
16644 using the minimum latency algorithm.
16645
16646 @item -minline-int-divide-max-throughput
16647 @opindex minline-int-divide-max-throughput
16648 Generate code for inline divides of integer values
16649 using the maximum throughput algorithm.
16650
16651 @item -mno-inline-int-divide
16652 @opindex mno-inline-int-divide
16653 Do not generate inline code for divides of integer values.
16654
16655 @item -minline-sqrt-min-latency
16656 @opindex minline-sqrt-min-latency
16657 Generate code for inline square roots
16658 using the minimum latency algorithm.
16659
16660 @item -minline-sqrt-max-throughput
16661 @opindex minline-sqrt-max-throughput
16662 Generate code for inline square roots
16663 using the maximum throughput algorithm.
16664
16665 @item -mno-inline-sqrt
16666 @opindex mno-inline-sqrt
16667 Do not generate inline code for @code{sqrt}.
16668
16669 @item -mfused-madd
16670 @itemx -mno-fused-madd
16671 @opindex mfused-madd
16672 @opindex mno-fused-madd
16673 Do (don't) generate code that uses the fused multiply/add or multiply/subtract
16674 instructions. The default is to use these instructions.
16675
16676 @item -mno-dwarf2-asm
16677 @itemx -mdwarf2-asm
16678 @opindex mno-dwarf2-asm
16679 @opindex mdwarf2-asm
16680 Don't (or do) generate assembler code for the DWARF line number debugging
16681 info. This may be useful when not using the GNU assembler.
16682
16683 @item -mearly-stop-bits
16684 @itemx -mno-early-stop-bits
16685 @opindex mearly-stop-bits
16686 @opindex mno-early-stop-bits
16687 Allow stop bits to be placed earlier than immediately preceding the
16688 instruction that triggered the stop bit. This can improve instruction
16689 scheduling, but does not always do so.
16690
16691 @item -mfixed-range=@var{register-range}
16692 @opindex mfixed-range
16693 Generate code treating the given register range as fixed registers.
16694 A fixed register is one that the register allocator cannot use. This is
16695 useful when compiling kernel code. A register range is specified as
16696 two registers separated by a dash. Multiple register ranges can be
16697 specified separated by a comma.
16698
16699 @item -mtls-size=@var{tls-size}
16700 @opindex mtls-size
16701 Specify bit size of immediate TLS offsets. Valid values are 14, 22, and
16702 64.
16703
16704 @item -mtune=@var{cpu-type}
16705 @opindex mtune
16706 Tune the instruction scheduling for a particular CPU, Valid values are
16707 @samp{itanium}, @samp{itanium1}, @samp{merced}, @samp{itanium2},
16708 and @samp{mckinley}.
16709
16710 @item -milp32
16711 @itemx -mlp64
16712 @opindex milp32
16713 @opindex mlp64
16714 Generate code for a 32-bit or 64-bit environment.
16715 The 32-bit environment sets int, long and pointer to 32 bits.
16716 The 64-bit environment sets int to 32 bits and long and pointer
16717 to 64 bits. These are HP-UX specific flags.
16718
16719 @item -mno-sched-br-data-spec
16720 @itemx -msched-br-data-spec
16721 @opindex mno-sched-br-data-spec
16722 @opindex msched-br-data-spec
16723 (Dis/En)able data speculative scheduling before reload.
16724 This results in generation of @code{ld.a} instructions and
16725 the corresponding check instructions (@code{ld.c} / @code{chk.a}).
16726 The default setting is disabled.
16727
16728 @item -msched-ar-data-spec
16729 @itemx -mno-sched-ar-data-spec
16730 @opindex msched-ar-data-spec
16731 @opindex mno-sched-ar-data-spec
16732 (En/Dis)able data speculative scheduling after reload.
16733 This results in generation of @code{ld.a} instructions and
16734 the corresponding check instructions (@code{ld.c} / @code{chk.a}).
16735 The default setting is enabled.
16736
16737 @item -mno-sched-control-spec
16738 @itemx -msched-control-spec
16739 @opindex mno-sched-control-spec
16740 @opindex msched-control-spec
16741 (Dis/En)able control speculative scheduling. This feature is
16742 available only during region scheduling (i.e.@: before reload).
16743 This results in generation of the @code{ld.s} instructions and
16744 the corresponding check instructions @code{chk.s}.
16745 The default setting is disabled.
16746
16747 @item -msched-br-in-data-spec
16748 @itemx -mno-sched-br-in-data-spec
16749 @opindex msched-br-in-data-spec
16750 @opindex mno-sched-br-in-data-spec
16751 (En/Dis)able speculative scheduling of the instructions that
16752 are dependent on the data speculative loads before reload.
16753 This is effective only with @option{-msched-br-data-spec} enabled.
16754 The default setting is enabled.
16755
16756 @item -msched-ar-in-data-spec
16757 @itemx -mno-sched-ar-in-data-spec
16758 @opindex msched-ar-in-data-spec
16759 @opindex mno-sched-ar-in-data-spec
16760 (En/Dis)able speculative scheduling of the instructions that
16761 are dependent on the data speculative loads after reload.
16762 This is effective only with @option{-msched-ar-data-spec} enabled.
16763 The default setting is enabled.
16764
16765 @item -msched-in-control-spec
16766 @itemx -mno-sched-in-control-spec
16767 @opindex msched-in-control-spec
16768 @opindex mno-sched-in-control-spec
16769 (En/Dis)able speculative scheduling of the instructions that
16770 are dependent on the control speculative loads.
16771 This is effective only with @option{-msched-control-spec} enabled.
16772 The default setting is enabled.
16773
16774 @item -mno-sched-prefer-non-data-spec-insns
16775 @itemx -msched-prefer-non-data-spec-insns
16776 @opindex mno-sched-prefer-non-data-spec-insns
16777 @opindex msched-prefer-non-data-spec-insns
16778 If enabled, data-speculative instructions are chosen for schedule
16779 only if there are no other choices at the moment. This makes
16780 the use of the data speculation much more conservative.
16781 The default setting is disabled.
16782
16783 @item -mno-sched-prefer-non-control-spec-insns
16784 @itemx -msched-prefer-non-control-spec-insns
16785 @opindex mno-sched-prefer-non-control-spec-insns
16786 @opindex msched-prefer-non-control-spec-insns
16787 If enabled, control-speculative instructions are chosen for schedule
16788 only if there are no other choices at the moment. This makes
16789 the use of the control speculation much more conservative.
16790 The default setting is disabled.
16791
16792 @item -mno-sched-count-spec-in-critical-path
16793 @itemx -msched-count-spec-in-critical-path
16794 @opindex mno-sched-count-spec-in-critical-path
16795 @opindex msched-count-spec-in-critical-path
16796 If enabled, speculative dependencies are considered during
16797 computation of the instructions priorities. This makes the use of the
16798 speculation a bit more conservative.
16799 The default setting is disabled.
16800
16801 @item -msched-spec-ldc
16802 @opindex msched-spec-ldc
16803 Use a simple data speculation check. This option is on by default.
16804
16805 @item -msched-control-spec-ldc
16806 @opindex msched-spec-ldc
16807 Use a simple check for control speculation. This option is on by default.
16808
16809 @item -msched-stop-bits-after-every-cycle
16810 @opindex msched-stop-bits-after-every-cycle
16811 Place a stop bit after every cycle when scheduling. This option is on
16812 by default.
16813
16814 @item -msched-fp-mem-deps-zero-cost
16815 @opindex msched-fp-mem-deps-zero-cost
16816 Assume that floating-point stores and loads are not likely to cause a conflict
16817 when placed into the same instruction group. This option is disabled by
16818 default.
16819
16820 @item -msel-sched-dont-check-control-spec
16821 @opindex msel-sched-dont-check-control-spec
16822 Generate checks for control speculation in selective scheduling.
16823 This flag is disabled by default.
16824
16825 @item -msched-max-memory-insns=@var{max-insns}
16826 @opindex msched-max-memory-insns
16827 Limit on the number of memory insns per instruction group, giving lower
16828 priority to subsequent memory insns attempting to schedule in the same
16829 instruction group. Frequently useful to prevent cache bank conflicts.
16830 The default value is 1.
16831
16832 @item -msched-max-memory-insns-hard-limit
16833 @opindex msched-max-memory-insns-hard-limit
16834 Makes the limit specified by @option{msched-max-memory-insns} a hard limit,
16835 disallowing more than that number in an instruction group.
16836 Otherwise, the limit is ``soft'', meaning that non-memory operations
16837 are preferred when the limit is reached, but memory operations may still
16838 be scheduled.
16839
16840 @end table
16841
16842 @node LM32 Options
16843 @subsection LM32 Options
16844 @cindex LM32 options
16845
16846 These @option{-m} options are defined for the LatticeMico32 architecture:
16847
16848 @table @gcctabopt
16849 @item -mbarrel-shift-enabled
16850 @opindex mbarrel-shift-enabled
16851 Enable barrel-shift instructions.
16852
16853 @item -mdivide-enabled
16854 @opindex mdivide-enabled
16855 Enable divide and modulus instructions.
16856
16857 @item -mmultiply-enabled
16858 @opindex multiply-enabled
16859 Enable multiply instructions.
16860
16861 @item -msign-extend-enabled
16862 @opindex msign-extend-enabled
16863 Enable sign extend instructions.
16864
16865 @item -muser-enabled
16866 @opindex muser-enabled
16867 Enable user-defined instructions.
16868
16869 @end table
16870
16871 @node M32C Options
16872 @subsection M32C Options
16873 @cindex M32C options
16874
16875 @table @gcctabopt
16876 @item -mcpu=@var{name}
16877 @opindex mcpu=
16878 Select the CPU for which code is generated. @var{name} may be one of
16879 @samp{r8c} for the R8C/Tiny series, @samp{m16c} for the M16C (up to
16880 /60) series, @samp{m32cm} for the M16C/80 series, or @samp{m32c} for
16881 the M32C/80 series.
16882
16883 @item -msim
16884 @opindex msim
16885 Specifies that the program will be run on the simulator. This causes
16886 an alternate runtime library to be linked in which supports, for
16887 example, file I/O@. You must not use this option when generating
16888 programs that will run on real hardware; you must provide your own
16889 runtime library for whatever I/O functions are needed.
16890
16891 @item -memregs=@var{number}
16892 @opindex memregs=
16893 Specifies the number of memory-based pseudo-registers GCC uses
16894 during code generation. These pseudo-registers are used like real
16895 registers, so there is a tradeoff between GCC's ability to fit the
16896 code into available registers, and the performance penalty of using
16897 memory instead of registers. Note that all modules in a program must
16898 be compiled with the same value for this option. Because of that, you
16899 must not use this option with GCC's default runtime libraries.
16900
16901 @end table
16902
16903 @node M32R/D Options
16904 @subsection M32R/D Options
16905 @cindex M32R/D options
16906
16907 These @option{-m} options are defined for Renesas M32R/D architectures:
16908
16909 @table @gcctabopt
16910 @item -m32r2
16911 @opindex m32r2
16912 Generate code for the M32R/2@.
16913
16914 @item -m32rx
16915 @opindex m32rx
16916 Generate code for the M32R/X@.
16917
16918 @item -m32r
16919 @opindex m32r
16920 Generate code for the M32R@. This is the default.
16921
16922 @item -mmodel=small
16923 @opindex mmodel=small
16924 Assume all objects live in the lower 16MB of memory (so that their addresses
16925 can be loaded with the @code{ld24} instruction), and assume all subroutines
16926 are reachable with the @code{bl} instruction.
16927 This is the default.
16928
16929 The addressability of a particular object can be set with the
16930 @code{model} attribute.
16931
16932 @item -mmodel=medium
16933 @opindex mmodel=medium
16934 Assume objects may be anywhere in the 32-bit address space (the compiler
16935 generates @code{seth/add3} instructions to load their addresses), and
16936 assume all subroutines are reachable with the @code{bl} instruction.
16937
16938 @item -mmodel=large
16939 @opindex mmodel=large
16940 Assume objects may be anywhere in the 32-bit address space (the compiler
16941 generates @code{seth/add3} instructions to load their addresses), and
16942 assume subroutines may not be reachable with the @code{bl} instruction
16943 (the compiler generates the much slower @code{seth/add3/jl}
16944 instruction sequence).
16945
16946 @item -msdata=none
16947 @opindex msdata=none
16948 Disable use of the small data area. Variables are put into
16949 one of @code{.data}, @code{.bss}, or @code{.rodata} (unless the
16950 @code{section} attribute has been specified).
16951 This is the default.
16952
16953 The small data area consists of sections @code{.sdata} and @code{.sbss}.
16954 Objects may be explicitly put in the small data area with the
16955 @code{section} attribute using one of these sections.
16956
16957 @item -msdata=sdata
16958 @opindex msdata=sdata
16959 Put small global and static data in the small data area, but do not
16960 generate special code to reference them.
16961
16962 @item -msdata=use
16963 @opindex msdata=use
16964 Put small global and static data in the small data area, and generate
16965 special instructions to reference them.
16966
16967 @item -G @var{num}
16968 @opindex G
16969 @cindex smaller data references
16970 Put global and static objects less than or equal to @var{num} bytes
16971 into the small data or BSS sections instead of the normal data or BSS
16972 sections. The default value of @var{num} is 8.
16973 The @option{-msdata} option must be set to one of @samp{sdata} or @samp{use}
16974 for this option to have any effect.
16975
16976 All modules should be compiled with the same @option{-G @var{num}} value.
16977 Compiling with different values of @var{num} may or may not work; if it
16978 doesn't the linker gives an error message---incorrect code is not
16979 generated.
16980
16981 @item -mdebug
16982 @opindex mdebug
16983 Makes the M32R-specific code in the compiler display some statistics
16984 that might help in debugging programs.
16985
16986 @item -malign-loops
16987 @opindex malign-loops
16988 Align all loops to a 32-byte boundary.
16989
16990 @item -mno-align-loops
16991 @opindex mno-align-loops
16992 Do not enforce a 32-byte alignment for loops. This is the default.
16993
16994 @item -missue-rate=@var{number}
16995 @opindex missue-rate=@var{number}
16996 Issue @var{number} instructions per cycle. @var{number} can only be 1
16997 or 2.
16998
16999 @item -mbranch-cost=@var{number}
17000 @opindex mbranch-cost=@var{number}
17001 @var{number} can only be 1 or 2. If it is 1 then branches are
17002 preferred over conditional code, if it is 2, then the opposite applies.
17003
17004 @item -mflush-trap=@var{number}
17005 @opindex mflush-trap=@var{number}
17006 Specifies the trap number to use to flush the cache. The default is
17007 12. Valid numbers are between 0 and 15 inclusive.
17008
17009 @item -mno-flush-trap
17010 @opindex mno-flush-trap
17011 Specifies that the cache cannot be flushed by using a trap.
17012
17013 @item -mflush-func=@var{name}
17014 @opindex mflush-func=@var{name}
17015 Specifies the name of the operating system function to call to flush
17016 the cache. The default is @samp{_flush_cache}, but a function call
17017 is only used if a trap is not available.
17018
17019 @item -mno-flush-func
17020 @opindex mno-flush-func
17021 Indicates that there is no OS function for flushing the cache.
17022
17023 @end table
17024
17025 @node M680x0 Options
17026 @subsection M680x0 Options
17027 @cindex M680x0 options
17028
17029 These are the @samp{-m} options defined for M680x0 and ColdFire processors.
17030 The default settings depend on which architecture was selected when
17031 the compiler was configured; the defaults for the most common choices
17032 are given below.
17033
17034 @table @gcctabopt
17035 @item -march=@var{arch}
17036 @opindex march
17037 Generate code for a specific M680x0 or ColdFire instruction set
17038 architecture. Permissible values of @var{arch} for M680x0
17039 architectures are: @samp{68000}, @samp{68010}, @samp{68020},
17040 @samp{68030}, @samp{68040}, @samp{68060} and @samp{cpu32}. ColdFire
17041 architectures are selected according to Freescale's ISA classification
17042 and the permissible values are: @samp{isaa}, @samp{isaaplus},
17043 @samp{isab} and @samp{isac}.
17044
17045 GCC defines a macro @code{__mcf@var{arch}__} whenever it is generating
17046 code for a ColdFire target. The @var{arch} in this macro is one of the
17047 @option{-march} arguments given above.
17048
17049 When used together, @option{-march} and @option{-mtune} select code
17050 that runs on a family of similar processors but that is optimized
17051 for a particular microarchitecture.
17052
17053 @item -mcpu=@var{cpu}
17054 @opindex mcpu
17055 Generate code for a specific M680x0 or ColdFire processor.
17056 The M680x0 @var{cpu}s are: @samp{68000}, @samp{68010}, @samp{68020},
17057 @samp{68030}, @samp{68040}, @samp{68060}, @samp{68302}, @samp{68332}
17058 and @samp{cpu32}. The ColdFire @var{cpu}s are given by the table
17059 below, which also classifies the CPUs into families:
17060
17061 @multitable @columnfractions 0.20 0.80
17062 @item @strong{Family} @tab @strong{@samp{-mcpu} arguments}
17063 @item @samp{51} @tab @samp{51} @samp{51ac} @samp{51ag} @samp{51cn} @samp{51em} @samp{51je} @samp{51jf} @samp{51jg} @samp{51jm} @samp{51mm} @samp{51qe} @samp{51qm}
17064 @item @samp{5206} @tab @samp{5202} @samp{5204} @samp{5206}
17065 @item @samp{5206e} @tab @samp{5206e}
17066 @item @samp{5208} @tab @samp{5207} @samp{5208}
17067 @item @samp{5211a} @tab @samp{5210a} @samp{5211a}
17068 @item @samp{5213} @tab @samp{5211} @samp{5212} @samp{5213}
17069 @item @samp{5216} @tab @samp{5214} @samp{5216}
17070 @item @samp{52235} @tab @samp{52230} @samp{52231} @samp{52232} @samp{52233} @samp{52234} @samp{52235}
17071 @item @samp{5225} @tab @samp{5224} @samp{5225}
17072 @item @samp{52259} @tab @samp{52252} @samp{52254} @samp{52255} @samp{52256} @samp{52258} @samp{52259}
17073 @item @samp{5235} @tab @samp{5232} @samp{5233} @samp{5234} @samp{5235} @samp{523x}
17074 @item @samp{5249} @tab @samp{5249}
17075 @item @samp{5250} @tab @samp{5250}
17076 @item @samp{5271} @tab @samp{5270} @samp{5271}
17077 @item @samp{5272} @tab @samp{5272}
17078 @item @samp{5275} @tab @samp{5274} @samp{5275}
17079 @item @samp{5282} @tab @samp{5280} @samp{5281} @samp{5282} @samp{528x}
17080 @item @samp{53017} @tab @samp{53011} @samp{53012} @samp{53013} @samp{53014} @samp{53015} @samp{53016} @samp{53017}
17081 @item @samp{5307} @tab @samp{5307}
17082 @item @samp{5329} @tab @samp{5327} @samp{5328} @samp{5329} @samp{532x}
17083 @item @samp{5373} @tab @samp{5372} @samp{5373} @samp{537x}
17084 @item @samp{5407} @tab @samp{5407}
17085 @item @samp{5475} @tab @samp{5470} @samp{5471} @samp{5472} @samp{5473} @samp{5474} @samp{5475} @samp{547x} @samp{5480} @samp{5481} @samp{5482} @samp{5483} @samp{5484} @samp{5485}
17086 @end multitable
17087
17088 @option{-mcpu=@var{cpu}} overrides @option{-march=@var{arch}} if
17089 @var{arch} is compatible with @var{cpu}. Other combinations of
17090 @option{-mcpu} and @option{-march} are rejected.
17091
17092 GCC defines the macro @code{__mcf_cpu_@var{cpu}} when ColdFire target
17093 @var{cpu} is selected. It also defines @code{__mcf_family_@var{family}},
17094 where the value of @var{family} is given by the table above.
17095
17096 @item -mtune=@var{tune}
17097 @opindex mtune
17098 Tune the code for a particular microarchitecture within the
17099 constraints set by @option{-march} and @option{-mcpu}.
17100 The M680x0 microarchitectures are: @samp{68000}, @samp{68010},
17101 @samp{68020}, @samp{68030}, @samp{68040}, @samp{68060}
17102 and @samp{cpu32}. The ColdFire microarchitectures
17103 are: @samp{cfv1}, @samp{cfv2}, @samp{cfv3}, @samp{cfv4} and @samp{cfv4e}.
17104
17105 You can also use @option{-mtune=68020-40} for code that needs
17106 to run relatively well on 68020, 68030 and 68040 targets.
17107 @option{-mtune=68020-60} is similar but includes 68060 targets
17108 as well. These two options select the same tuning decisions as
17109 @option{-m68020-40} and @option{-m68020-60} respectively.
17110
17111 GCC defines the macros @code{__mc@var{arch}} and @code{__mc@var{arch}__}
17112 when tuning for 680x0 architecture @var{arch}. It also defines
17113 @code{mc@var{arch}} unless either @option{-ansi} or a non-GNU @option{-std}
17114 option is used. If GCC is tuning for a range of architectures,
17115 as selected by @option{-mtune=68020-40} or @option{-mtune=68020-60},
17116 it defines the macros for every architecture in the range.
17117
17118 GCC also defines the macro @code{__m@var{uarch}__} when tuning for
17119 ColdFire microarchitecture @var{uarch}, where @var{uarch} is one
17120 of the arguments given above.
17121
17122 @item -m68000
17123 @itemx -mc68000
17124 @opindex m68000
17125 @opindex mc68000
17126 Generate output for a 68000. This is the default
17127 when the compiler is configured for 68000-based systems.
17128 It is equivalent to @option{-march=68000}.
17129
17130 Use this option for microcontrollers with a 68000 or EC000 core,
17131 including the 68008, 68302, 68306, 68307, 68322, 68328 and 68356.
17132
17133 @item -m68010
17134 @opindex m68010
17135 Generate output for a 68010. This is the default
17136 when the compiler is configured for 68010-based systems.
17137 It is equivalent to @option{-march=68010}.
17138
17139 @item -m68020
17140 @itemx -mc68020
17141 @opindex m68020
17142 @opindex mc68020
17143 Generate output for a 68020. This is the default
17144 when the compiler is configured for 68020-based systems.
17145 It is equivalent to @option{-march=68020}.
17146
17147 @item -m68030
17148 @opindex m68030
17149 Generate output for a 68030. This is the default when the compiler is
17150 configured for 68030-based systems. It is equivalent to
17151 @option{-march=68030}.
17152
17153 @item -m68040
17154 @opindex m68040
17155 Generate output for a 68040. This is the default when the compiler is
17156 configured for 68040-based systems. It is equivalent to
17157 @option{-march=68040}.
17158
17159 This option inhibits the use of 68881/68882 instructions that have to be
17160 emulated by software on the 68040. Use this option if your 68040 does not
17161 have code to emulate those instructions.
17162
17163 @item -m68060
17164 @opindex m68060
17165 Generate output for a 68060. This is the default when the compiler is
17166 configured for 68060-based systems. It is equivalent to
17167 @option{-march=68060}.
17168
17169 This option inhibits the use of 68020 and 68881/68882 instructions that
17170 have to be emulated by software on the 68060. Use this option if your 68060
17171 does not have code to emulate those instructions.
17172
17173 @item -mcpu32
17174 @opindex mcpu32
17175 Generate output for a CPU32. This is the default
17176 when the compiler is configured for CPU32-based systems.
17177 It is equivalent to @option{-march=cpu32}.
17178
17179 Use this option for microcontrollers with a
17180 CPU32 or CPU32+ core, including the 68330, 68331, 68332, 68333, 68334,
17181 68336, 68340, 68341, 68349 and 68360.
17182
17183 @item -m5200
17184 @opindex m5200
17185 Generate output for a 520X ColdFire CPU@. This is the default
17186 when the compiler is configured for 520X-based systems.
17187 It is equivalent to @option{-mcpu=5206}, and is now deprecated
17188 in favor of that option.
17189
17190 Use this option for microcontroller with a 5200 core, including
17191 the MCF5202, MCF5203, MCF5204 and MCF5206.
17192
17193 @item -m5206e
17194 @opindex m5206e
17195 Generate output for a 5206e ColdFire CPU@. The option is now
17196 deprecated in favor of the equivalent @option{-mcpu=5206e}.
17197
17198 @item -m528x
17199 @opindex m528x
17200 Generate output for a member of the ColdFire 528X family.
17201 The option is now deprecated in favor of the equivalent
17202 @option{-mcpu=528x}.
17203
17204 @item -m5307
17205 @opindex m5307
17206 Generate output for a ColdFire 5307 CPU@. The option is now deprecated
17207 in favor of the equivalent @option{-mcpu=5307}.
17208
17209 @item -m5407
17210 @opindex m5407
17211 Generate output for a ColdFire 5407 CPU@. The option is now deprecated
17212 in favor of the equivalent @option{-mcpu=5407}.
17213
17214 @item -mcfv4e
17215 @opindex mcfv4e
17216 Generate output for a ColdFire V4e family CPU (e.g.@: 547x/548x).
17217 This includes use of hardware floating-point instructions.
17218 The option is equivalent to @option{-mcpu=547x}, and is now
17219 deprecated in favor of that option.
17220
17221 @item -m68020-40
17222 @opindex m68020-40
17223 Generate output for a 68040, without using any of the new instructions.
17224 This results in code that can run relatively efficiently on either a
17225 68020/68881 or a 68030 or a 68040. The generated code does use the
17226 68881 instructions that are emulated on the 68040.
17227
17228 The option is equivalent to @option{-march=68020} @option{-mtune=68020-40}.
17229
17230 @item -m68020-60
17231 @opindex m68020-60
17232 Generate output for a 68060, without using any of the new instructions.
17233 This results in code that can run relatively efficiently on either a
17234 68020/68881 or a 68030 or a 68040. The generated code does use the
17235 68881 instructions that are emulated on the 68060.
17236
17237 The option is equivalent to @option{-march=68020} @option{-mtune=68020-60}.
17238
17239 @item -mhard-float
17240 @itemx -m68881
17241 @opindex mhard-float
17242 @opindex m68881
17243 Generate floating-point instructions. This is the default for 68020
17244 and above, and for ColdFire devices that have an FPU@. It defines the
17245 macro @code{__HAVE_68881__} on M680x0 targets and @code{__mcffpu__}
17246 on ColdFire targets.
17247
17248 @item -msoft-float
17249 @opindex msoft-float
17250 Do not generate floating-point instructions; use library calls instead.
17251 This is the default for 68000, 68010, and 68832 targets. It is also
17252 the default for ColdFire devices that have no FPU.
17253
17254 @item -mdiv
17255 @itemx -mno-div
17256 @opindex mdiv
17257 @opindex mno-div
17258 Generate (do not generate) ColdFire hardware divide and remainder
17259 instructions. If @option{-march} is used without @option{-mcpu},
17260 the default is ``on'' for ColdFire architectures and ``off'' for M680x0
17261 architectures. Otherwise, the default is taken from the target CPU
17262 (either the default CPU, or the one specified by @option{-mcpu}). For
17263 example, the default is ``off'' for @option{-mcpu=5206} and ``on'' for
17264 @option{-mcpu=5206e}.
17265
17266 GCC defines the macro @code{__mcfhwdiv__} when this option is enabled.
17267
17268 @item -mshort
17269 @opindex mshort
17270 Consider type @code{int} to be 16 bits wide, like @code{short int}.
17271 Additionally, parameters passed on the stack are also aligned to a
17272 16-bit boundary even on targets whose API mandates promotion to 32-bit.
17273
17274 @item -mno-short
17275 @opindex mno-short
17276 Do not consider type @code{int} to be 16 bits wide. This is the default.
17277
17278 @item -mnobitfield
17279 @itemx -mno-bitfield
17280 @opindex mnobitfield
17281 @opindex mno-bitfield
17282 Do not use the bit-field instructions. The @option{-m68000}, @option{-mcpu32}
17283 and @option{-m5200} options imply @w{@option{-mnobitfield}}.
17284
17285 @item -mbitfield
17286 @opindex mbitfield
17287 Do use the bit-field instructions. The @option{-m68020} option implies
17288 @option{-mbitfield}. This is the default if you use a configuration
17289 designed for a 68020.
17290
17291 @item -mrtd
17292 @opindex mrtd
17293 Use a different function-calling convention, in which functions
17294 that take a fixed number of arguments return with the @code{rtd}
17295 instruction, which pops their arguments while returning. This
17296 saves one instruction in the caller since there is no need to pop
17297 the arguments there.
17298
17299 This calling convention is incompatible with the one normally
17300 used on Unix, so you cannot use it if you need to call libraries
17301 compiled with the Unix compiler.
17302
17303 Also, you must provide function prototypes for all functions that
17304 take variable numbers of arguments (including @code{printf});
17305 otherwise incorrect code is generated for calls to those
17306 functions.
17307
17308 In addition, seriously incorrect code results if you call a
17309 function with too many arguments. (Normally, extra arguments are
17310 harmlessly ignored.)
17311
17312 The @code{rtd} instruction is supported by the 68010, 68020, 68030,
17313 68040, 68060 and CPU32 processors, but not by the 68000 or 5200.
17314
17315 @item -mno-rtd
17316 @opindex mno-rtd
17317 Do not use the calling conventions selected by @option{-mrtd}.
17318 This is the default.
17319
17320 @item -malign-int
17321 @itemx -mno-align-int
17322 @opindex malign-int
17323 @opindex mno-align-int
17324 Control whether GCC aligns @code{int}, @code{long}, @code{long long},
17325 @code{float}, @code{double}, and @code{long double} variables on a 32-bit
17326 boundary (@option{-malign-int}) or a 16-bit boundary (@option{-mno-align-int}).
17327 Aligning variables on 32-bit boundaries produces code that runs somewhat
17328 faster on processors with 32-bit busses at the expense of more memory.
17329
17330 @strong{Warning:} if you use the @option{-malign-int} switch, GCC
17331 aligns structures containing the above types differently than
17332 most published application binary interface specifications for the m68k.
17333
17334 @item -mpcrel
17335 @opindex mpcrel
17336 Use the pc-relative addressing mode of the 68000 directly, instead of
17337 using a global offset table. At present, this option implies @option{-fpic},
17338 allowing at most a 16-bit offset for pc-relative addressing. @option{-fPIC} is
17339 not presently supported with @option{-mpcrel}, though this could be supported for
17340 68020 and higher processors.
17341
17342 @item -mno-strict-align
17343 @itemx -mstrict-align
17344 @opindex mno-strict-align
17345 @opindex mstrict-align
17346 Do not (do) assume that unaligned memory references are handled by
17347 the system.
17348
17349 @item -msep-data
17350 Generate code that allows the data segment to be located in a different
17351 area of memory from the text segment. This allows for execute-in-place in
17352 an environment without virtual memory management. This option implies
17353 @option{-fPIC}.
17354
17355 @item -mno-sep-data
17356 Generate code that assumes that the data segment follows the text segment.
17357 This is the default.
17358
17359 @item -mid-shared-library
17360 Generate code that supports shared libraries via the library ID method.
17361 This allows for execute-in-place and shared libraries in an environment
17362 without virtual memory management. This option implies @option{-fPIC}.
17363
17364 @item -mno-id-shared-library
17365 Generate code that doesn't assume ID-based shared libraries are being used.
17366 This is the default.
17367
17368 @item -mshared-library-id=n
17369 Specifies the identification number of the ID-based shared library being
17370 compiled. Specifying a value of 0 generates more compact code; specifying
17371 other values forces the allocation of that number to the current
17372 library, but is no more space- or time-efficient than omitting this option.
17373
17374 @item -mxgot
17375 @itemx -mno-xgot
17376 @opindex mxgot
17377 @opindex mno-xgot
17378 When generating position-independent code for ColdFire, generate code
17379 that works if the GOT has more than 8192 entries. This code is
17380 larger and slower than code generated without this option. On M680x0
17381 processors, this option is not needed; @option{-fPIC} suffices.
17382
17383 GCC normally uses a single instruction to load values from the GOT@.
17384 While this is relatively efficient, it only works if the GOT
17385 is smaller than about 64k. Anything larger causes the linker
17386 to report an error such as:
17387
17388 @cindex relocation truncated to fit (ColdFire)
17389 @smallexample
17390 relocation truncated to fit: R_68K_GOT16O foobar
17391 @end smallexample
17392
17393 If this happens, you should recompile your code with @option{-mxgot}.
17394 It should then work with very large GOTs. However, code generated with
17395 @option{-mxgot} is less efficient, since it takes 4 instructions to fetch
17396 the value of a global symbol.
17397
17398 Note that some linkers, including newer versions of the GNU linker,
17399 can create multiple GOTs and sort GOT entries. If you have such a linker,
17400 you should only need to use @option{-mxgot} when compiling a single
17401 object file that accesses more than 8192 GOT entries. Very few do.
17402
17403 These options have no effect unless GCC is generating
17404 position-independent code.
17405
17406 @end table
17407
17408 @node MCore Options
17409 @subsection MCore Options
17410 @cindex MCore options
17411
17412 These are the @samp{-m} options defined for the Motorola M*Core
17413 processors.
17414
17415 @table @gcctabopt
17416
17417 @item -mhardlit
17418 @itemx -mno-hardlit
17419 @opindex mhardlit
17420 @opindex mno-hardlit
17421 Inline constants into the code stream if it can be done in two
17422 instructions or less.
17423
17424 @item -mdiv
17425 @itemx -mno-div
17426 @opindex mdiv
17427 @opindex mno-div
17428 Use the divide instruction. (Enabled by default).
17429
17430 @item -mrelax-immediate
17431 @itemx -mno-relax-immediate
17432 @opindex mrelax-immediate
17433 @opindex mno-relax-immediate
17434 Allow arbitrary-sized immediates in bit operations.
17435
17436 @item -mwide-bitfields
17437 @itemx -mno-wide-bitfields
17438 @opindex mwide-bitfields
17439 @opindex mno-wide-bitfields
17440 Always treat bit-fields as @code{int}-sized.
17441
17442 @item -m4byte-functions
17443 @itemx -mno-4byte-functions
17444 @opindex m4byte-functions
17445 @opindex mno-4byte-functions
17446 Force all functions to be aligned to a 4-byte boundary.
17447
17448 @item -mcallgraph-data
17449 @itemx -mno-callgraph-data
17450 @opindex mcallgraph-data
17451 @opindex mno-callgraph-data
17452 Emit callgraph information.
17453
17454 @item -mslow-bytes
17455 @itemx -mno-slow-bytes
17456 @opindex mslow-bytes
17457 @opindex mno-slow-bytes
17458 Prefer word access when reading byte quantities.
17459
17460 @item -mlittle-endian
17461 @itemx -mbig-endian
17462 @opindex mlittle-endian
17463 @opindex mbig-endian
17464 Generate code for a little-endian target.
17465
17466 @item -m210
17467 @itemx -m340
17468 @opindex m210
17469 @opindex m340
17470 Generate code for the 210 processor.
17471
17472 @item -mno-lsim
17473 @opindex mno-lsim
17474 Assume that runtime support has been provided and so omit the
17475 simulator library (@file{libsim.a)} from the linker command line.
17476
17477 @item -mstack-increment=@var{size}
17478 @opindex mstack-increment
17479 Set the maximum amount for a single stack increment operation. Large
17480 values can increase the speed of programs that contain functions
17481 that need a large amount of stack space, but they can also trigger a
17482 segmentation fault if the stack is extended too much. The default
17483 value is 0x1000.
17484
17485 @end table
17486
17487 @node MeP Options
17488 @subsection MeP Options
17489 @cindex MeP options
17490
17491 @table @gcctabopt
17492
17493 @item -mabsdiff
17494 @opindex mabsdiff
17495 Enables the @code{abs} instruction, which is the absolute difference
17496 between two registers.
17497
17498 @item -mall-opts
17499 @opindex mall-opts
17500 Enables all the optional instructions---average, multiply, divide, bit
17501 operations, leading zero, absolute difference, min/max, clip, and
17502 saturation.
17503
17504
17505 @item -maverage
17506 @opindex maverage
17507 Enables the @code{ave} instruction, which computes the average of two
17508 registers.
17509
17510 @item -mbased=@var{n}
17511 @opindex mbased=
17512 Variables of size @var{n} bytes or smaller are placed in the
17513 @code{.based} section by default. Based variables use the @code{$tp}
17514 register as a base register, and there is a 128-byte limit to the
17515 @code{.based} section.
17516
17517 @item -mbitops
17518 @opindex mbitops
17519 Enables the bit operation instructions---bit test (@code{btstm}), set
17520 (@code{bsetm}), clear (@code{bclrm}), invert (@code{bnotm}), and
17521 test-and-set (@code{tas}).
17522
17523 @item -mc=@var{name}
17524 @opindex mc=
17525 Selects which section constant data is placed in. @var{name} may
17526 be @samp{tiny}, @samp{near}, or @samp{far}.
17527
17528 @item -mclip
17529 @opindex mclip
17530 Enables the @code{clip} instruction. Note that @option{-mclip} is not
17531 useful unless you also provide @option{-mminmax}.
17532
17533 @item -mconfig=@var{name}
17534 @opindex mconfig=
17535 Selects one of the built-in core configurations. Each MeP chip has
17536 one or more modules in it; each module has a core CPU and a variety of
17537 coprocessors, optional instructions, and peripherals. The
17538 @code{MeP-Integrator} tool, not part of GCC, provides these
17539 configurations through this option; using this option is the same as
17540 using all the corresponding command-line options. The default
17541 configuration is @samp{default}.
17542
17543 @item -mcop
17544 @opindex mcop
17545 Enables the coprocessor instructions. By default, this is a 32-bit
17546 coprocessor. Note that the coprocessor is normally enabled via the
17547 @option{-mconfig=} option.
17548
17549 @item -mcop32
17550 @opindex mcop32
17551 Enables the 32-bit coprocessor's instructions.
17552
17553 @item -mcop64
17554 @opindex mcop64
17555 Enables the 64-bit coprocessor's instructions.
17556
17557 @item -mivc2
17558 @opindex mivc2
17559 Enables IVC2 scheduling. IVC2 is a 64-bit VLIW coprocessor.
17560
17561 @item -mdc
17562 @opindex mdc
17563 Causes constant variables to be placed in the @code{.near} section.
17564
17565 @item -mdiv
17566 @opindex mdiv
17567 Enables the @code{div} and @code{divu} instructions.
17568
17569 @item -meb
17570 @opindex meb
17571 Generate big-endian code.
17572
17573 @item -mel
17574 @opindex mel
17575 Generate little-endian code.
17576
17577 @item -mio-volatile
17578 @opindex mio-volatile
17579 Tells the compiler that any variable marked with the @code{io}
17580 attribute is to be considered volatile.
17581
17582 @item -ml
17583 @opindex ml
17584 Causes variables to be assigned to the @code{.far} section by default.
17585
17586 @item -mleadz
17587 @opindex mleadz
17588 Enables the @code{leadz} (leading zero) instruction.
17589
17590 @item -mm
17591 @opindex mm
17592 Causes variables to be assigned to the @code{.near} section by default.
17593
17594 @item -mminmax
17595 @opindex mminmax
17596 Enables the @code{min} and @code{max} instructions.
17597
17598 @item -mmult
17599 @opindex mmult
17600 Enables the multiplication and multiply-accumulate instructions.
17601
17602 @item -mno-opts
17603 @opindex mno-opts
17604 Disables all the optional instructions enabled by @option{-mall-opts}.
17605
17606 @item -mrepeat
17607 @opindex mrepeat
17608 Enables the @code{repeat} and @code{erepeat} instructions, used for
17609 low-overhead looping.
17610
17611 @item -ms
17612 @opindex ms
17613 Causes all variables to default to the @code{.tiny} section. Note
17614 that there is a 65536-byte limit to this section. Accesses to these
17615 variables use the @code{%gp} base register.
17616
17617 @item -msatur
17618 @opindex msatur
17619 Enables the saturation instructions. Note that the compiler does not
17620 currently generate these itself, but this option is included for
17621 compatibility with other tools, like @code{as}.
17622
17623 @item -msdram
17624 @opindex msdram
17625 Link the SDRAM-based runtime instead of the default ROM-based runtime.
17626
17627 @item -msim
17628 @opindex msim
17629 Link the simulator run-time libraries.
17630
17631 @item -msimnovec
17632 @opindex msimnovec
17633 Link the simulator runtime libraries, excluding built-in support
17634 for reset and exception vectors and tables.
17635
17636 @item -mtf
17637 @opindex mtf
17638 Causes all functions to default to the @code{.far} section. Without
17639 this option, functions default to the @code{.near} section.
17640
17641 @item -mtiny=@var{n}
17642 @opindex mtiny=
17643 Variables that are @var{n} bytes or smaller are allocated to the
17644 @code{.tiny} section. These variables use the @code{$gp} base
17645 register. The default for this option is 4, but note that there's a
17646 65536-byte limit to the @code{.tiny} section.
17647
17648 @end table
17649
17650 @node MicroBlaze Options
17651 @subsection MicroBlaze Options
17652 @cindex MicroBlaze Options
17653
17654 @table @gcctabopt
17655
17656 @item -msoft-float
17657 @opindex msoft-float
17658 Use software emulation for floating point (default).
17659
17660 @item -mhard-float
17661 @opindex mhard-float
17662 Use hardware floating-point instructions.
17663
17664 @item -mmemcpy
17665 @opindex mmemcpy
17666 Do not optimize block moves, use @code{memcpy}.
17667
17668 @item -mno-clearbss
17669 @opindex mno-clearbss
17670 This option is deprecated. Use @option{-fno-zero-initialized-in-bss} instead.
17671
17672 @item -mcpu=@var{cpu-type}
17673 @opindex mcpu=
17674 Use features of, and schedule code for, the given CPU.
17675 Supported values are in the format @samp{v@var{X}.@var{YY}.@var{Z}},
17676 where @var{X} is a major version, @var{YY} is the minor version, and
17677 @var{Z} is compatibility code. Example values are @samp{v3.00.a},
17678 @samp{v4.00.b}, @samp{v5.00.a}, @samp{v5.00.b}, @samp{v5.00.b}, @samp{v6.00.a}.
17679
17680 @item -mxl-soft-mul
17681 @opindex mxl-soft-mul
17682 Use software multiply emulation (default).
17683
17684 @item -mxl-soft-div
17685 @opindex mxl-soft-div
17686 Use software emulation for divides (default).
17687
17688 @item -mxl-barrel-shift
17689 @opindex mxl-barrel-shift
17690 Use the hardware barrel shifter.
17691
17692 @item -mxl-pattern-compare
17693 @opindex mxl-pattern-compare
17694 Use pattern compare instructions.
17695
17696 @item -msmall-divides
17697 @opindex msmall-divides
17698 Use table lookup optimization for small signed integer divisions.
17699
17700 @item -mxl-stack-check
17701 @opindex mxl-stack-check
17702 This option is deprecated. Use @option{-fstack-check} instead.
17703
17704 @item -mxl-gp-opt
17705 @opindex mxl-gp-opt
17706 Use GP-relative @code{.sdata}/@code{.sbss} sections.
17707
17708 @item -mxl-multiply-high
17709 @opindex mxl-multiply-high
17710 Use multiply high instructions for high part of 32x32 multiply.
17711
17712 @item -mxl-float-convert
17713 @opindex mxl-float-convert
17714 Use hardware floating-point conversion instructions.
17715
17716 @item -mxl-float-sqrt
17717 @opindex mxl-float-sqrt
17718 Use hardware floating-point square root instruction.
17719
17720 @item -mbig-endian
17721 @opindex mbig-endian
17722 Generate code for a big-endian target.
17723
17724 @item -mlittle-endian
17725 @opindex mlittle-endian
17726 Generate code for a little-endian target.
17727
17728 @item -mxl-reorder
17729 @opindex mxl-reorder
17730 Use reorder instructions (swap and byte reversed load/store).
17731
17732 @item -mxl-mode-@var{app-model}
17733 Select application model @var{app-model}. Valid models are
17734 @table @samp
17735 @item executable
17736 normal executable (default), uses startup code @file{crt0.o}.
17737
17738 @item xmdstub
17739 for use with Xilinx Microprocessor Debugger (XMD) based
17740 software intrusive debug agent called xmdstub. This uses startup file
17741 @file{crt1.o} and sets the start address of the program to 0x800.
17742
17743 @item bootstrap
17744 for applications that are loaded using a bootloader.
17745 This model uses startup file @file{crt2.o} which does not contain a processor
17746 reset vector handler. This is suitable for transferring control on a
17747 processor reset to the bootloader rather than the application.
17748
17749 @item novectors
17750 for applications that do not require any of the
17751 MicroBlaze vectors. This option may be useful for applications running
17752 within a monitoring application. This model uses @file{crt3.o} as a startup file.
17753 @end table
17754
17755 Option @option{-xl-mode-@var{app-model}} is a deprecated alias for
17756 @option{-mxl-mode-@var{app-model}}.
17757
17758 @end table
17759
17760 @node MIPS Options
17761 @subsection MIPS Options
17762 @cindex MIPS options
17763
17764 @table @gcctabopt
17765
17766 @item -EB
17767 @opindex EB
17768 Generate big-endian code.
17769
17770 @item -EL
17771 @opindex EL
17772 Generate little-endian code. This is the default for @samp{mips*el-*-*}
17773 configurations.
17774
17775 @item -march=@var{arch}
17776 @opindex march
17777 Generate code that runs on @var{arch}, which can be the name of a
17778 generic MIPS ISA, or the name of a particular processor.
17779 The ISA names are:
17780 @samp{mips1}, @samp{mips2}, @samp{mips3}, @samp{mips4},
17781 @samp{mips32}, @samp{mips32r2}, @samp{mips32r3}, @samp{mips32r5},
17782 @samp{mips32r6}, @samp{mips64}, @samp{mips64r2}, @samp{mips64r3},
17783 @samp{mips64r5} and @samp{mips64r6}.
17784 The processor names are:
17785 @samp{4kc}, @samp{4km}, @samp{4kp}, @samp{4ksc},
17786 @samp{4kec}, @samp{4kem}, @samp{4kep}, @samp{4ksd},
17787 @samp{5kc}, @samp{5kf},
17788 @samp{20kc},
17789 @samp{24kc}, @samp{24kf2_1}, @samp{24kf1_1},
17790 @samp{24kec}, @samp{24kef2_1}, @samp{24kef1_1},
17791 @samp{34kc}, @samp{34kf2_1}, @samp{34kf1_1}, @samp{34kn},
17792 @samp{74kc}, @samp{74kf2_1}, @samp{74kf1_1}, @samp{74kf3_2},
17793 @samp{1004kc}, @samp{1004kf2_1}, @samp{1004kf1_1},
17794 @samp{i6400},
17795 @samp{interaptiv},
17796 @samp{loongson2e}, @samp{loongson2f}, @samp{loongson3a},
17797 @samp{m4k},
17798 @samp{m14k}, @samp{m14kc}, @samp{m14ke}, @samp{m14kec},
17799 @samp{m5100}, @samp{m5101},
17800 @samp{octeon}, @samp{octeon+}, @samp{octeon2}, @samp{octeon3},
17801 @samp{orion},
17802 @samp{p5600},
17803 @samp{r2000}, @samp{r3000}, @samp{r3900}, @samp{r4000}, @samp{r4400},
17804 @samp{r4600}, @samp{r4650}, @samp{r4700}, @samp{r6000}, @samp{r8000},
17805 @samp{rm7000}, @samp{rm9000},
17806 @samp{r10000}, @samp{r12000}, @samp{r14000}, @samp{r16000},
17807 @samp{sb1},
17808 @samp{sr71000},
17809 @samp{vr4100}, @samp{vr4111}, @samp{vr4120}, @samp{vr4130}, @samp{vr4300},
17810 @samp{vr5000}, @samp{vr5400}, @samp{vr5500},
17811 @samp{xlr} and @samp{xlp}.
17812 The special value @samp{from-abi} selects the
17813 most compatible architecture for the selected ABI (that is,
17814 @samp{mips1} for 32-bit ABIs and @samp{mips3} for 64-bit ABIs)@.
17815
17816 The native Linux/GNU toolchain also supports the value @samp{native},
17817 which selects the best architecture option for the host processor.
17818 @option{-march=native} has no effect if GCC does not recognize
17819 the processor.
17820
17821 In processor names, a final @samp{000} can be abbreviated as @samp{k}
17822 (for example, @option{-march=r2k}). Prefixes are optional, and
17823 @samp{vr} may be written @samp{r}.
17824
17825 Names of the form @samp{@var{n}f2_1} refer to processors with
17826 FPUs clocked at half the rate of the core, names of the form
17827 @samp{@var{n}f1_1} refer to processors with FPUs clocked at the same
17828 rate as the core, and names of the form @samp{@var{n}f3_2} refer to
17829 processors with FPUs clocked a ratio of 3:2 with respect to the core.
17830 For compatibility reasons, @samp{@var{n}f} is accepted as a synonym
17831 for @samp{@var{n}f2_1} while @samp{@var{n}x} and @samp{@var{b}fx} are
17832 accepted as synonyms for @samp{@var{n}f1_1}.
17833
17834 GCC defines two macros based on the value of this option. The first
17835 is @code{_MIPS_ARCH}, which gives the name of target architecture, as
17836 a string. The second has the form @code{_MIPS_ARCH_@var{foo}},
17837 where @var{foo} is the capitalized value of @code{_MIPS_ARCH}@.
17838 For example, @option{-march=r2000} sets @code{_MIPS_ARCH}
17839 to @code{"r2000"} and defines the macro @code{_MIPS_ARCH_R2000}.
17840
17841 Note that the @code{_MIPS_ARCH} macro uses the processor names given
17842 above. In other words, it has the full prefix and does not
17843 abbreviate @samp{000} as @samp{k}. In the case of @samp{from-abi},
17844 the macro names the resolved architecture (either @code{"mips1"} or
17845 @code{"mips3"}). It names the default architecture when no
17846 @option{-march} option is given.
17847
17848 @item -mtune=@var{arch}
17849 @opindex mtune
17850 Optimize for @var{arch}. Among other things, this option controls
17851 the way instructions are scheduled, and the perceived cost of arithmetic
17852 operations. The list of @var{arch} values is the same as for
17853 @option{-march}.
17854
17855 When this option is not used, GCC optimizes for the processor
17856 specified by @option{-march}. By using @option{-march} and
17857 @option{-mtune} together, it is possible to generate code that
17858 runs on a family of processors, but optimize the code for one
17859 particular member of that family.
17860
17861 @option{-mtune} defines the macros @code{_MIPS_TUNE} and
17862 @code{_MIPS_TUNE_@var{foo}}, which work in the same way as the
17863 @option{-march} ones described above.
17864
17865 @item -mips1
17866 @opindex mips1
17867 Equivalent to @option{-march=mips1}.
17868
17869 @item -mips2
17870 @opindex mips2
17871 Equivalent to @option{-march=mips2}.
17872
17873 @item -mips3
17874 @opindex mips3
17875 Equivalent to @option{-march=mips3}.
17876
17877 @item -mips4
17878 @opindex mips4
17879 Equivalent to @option{-march=mips4}.
17880
17881 @item -mips32
17882 @opindex mips32
17883 Equivalent to @option{-march=mips32}.
17884
17885 @item -mips32r3
17886 @opindex mips32r3
17887 Equivalent to @option{-march=mips32r3}.
17888
17889 @item -mips32r5
17890 @opindex mips32r5
17891 Equivalent to @option{-march=mips32r5}.
17892
17893 @item -mips32r6
17894 @opindex mips32r6
17895 Equivalent to @option{-march=mips32r6}.
17896
17897 @item -mips64
17898 @opindex mips64
17899 Equivalent to @option{-march=mips64}.
17900
17901 @item -mips64r2
17902 @opindex mips64r2
17903 Equivalent to @option{-march=mips64r2}.
17904
17905 @item -mips64r3
17906 @opindex mips64r3
17907 Equivalent to @option{-march=mips64r3}.
17908
17909 @item -mips64r5
17910 @opindex mips64r5
17911 Equivalent to @option{-march=mips64r5}.
17912
17913 @item -mips64r6
17914 @opindex mips64r6
17915 Equivalent to @option{-march=mips64r6}.
17916
17917 @item -mips16
17918 @itemx -mno-mips16
17919 @opindex mips16
17920 @opindex mno-mips16
17921 Generate (do not generate) MIPS16 code. If GCC is targeting a
17922 MIPS32 or MIPS64 architecture, it makes use of the MIPS16e ASE@.
17923
17924 MIPS16 code generation can also be controlled on a per-function basis
17925 by means of @code{mips16} and @code{nomips16} attributes.
17926 @xref{Function Attributes}, for more information.
17927
17928 @item -mflip-mips16
17929 @opindex mflip-mips16
17930 Generate MIPS16 code on alternating functions. This option is provided
17931 for regression testing of mixed MIPS16/non-MIPS16 code generation, and is
17932 not intended for ordinary use in compiling user code.
17933
17934 @item -minterlink-compressed
17935 @item -mno-interlink-compressed
17936 @opindex minterlink-compressed
17937 @opindex mno-interlink-compressed
17938 Require (do not require) that code using the standard (uncompressed) MIPS ISA
17939 be link-compatible with MIPS16 and microMIPS code, and vice versa.
17940
17941 For example, code using the standard ISA encoding cannot jump directly
17942 to MIPS16 or microMIPS code; it must either use a call or an indirect jump.
17943 @option{-minterlink-compressed} therefore disables direct jumps unless GCC
17944 knows that the target of the jump is not compressed.
17945
17946 @item -minterlink-mips16
17947 @itemx -mno-interlink-mips16
17948 @opindex minterlink-mips16
17949 @opindex mno-interlink-mips16
17950 Aliases of @option{-minterlink-compressed} and
17951 @option{-mno-interlink-compressed}. These options predate the microMIPS ASE
17952 and are retained for backwards compatibility.
17953
17954 @item -mabi=32
17955 @itemx -mabi=o64
17956 @itemx -mabi=n32
17957 @itemx -mabi=64
17958 @itemx -mabi=eabi
17959 @opindex mabi=32
17960 @opindex mabi=o64
17961 @opindex mabi=n32
17962 @opindex mabi=64
17963 @opindex mabi=eabi
17964 Generate code for the given ABI@.
17965
17966 Note that the EABI has a 32-bit and a 64-bit variant. GCC normally
17967 generates 64-bit code when you select a 64-bit architecture, but you
17968 can use @option{-mgp32} to get 32-bit code instead.
17969
17970 For information about the O64 ABI, see
17971 @uref{http://gcc.gnu.org/@/projects/@/mipso64-abi.html}.
17972
17973 GCC supports a variant of the o32 ABI in which floating-point registers
17974 are 64 rather than 32 bits wide. You can select this combination with
17975 @option{-mabi=32} @option{-mfp64}. This ABI relies on the @code{mthc1}
17976 and @code{mfhc1} instructions and is therefore only supported for
17977 MIPS32R2, MIPS32R3 and MIPS32R5 processors.
17978
17979 The register assignments for arguments and return values remain the
17980 same, but each scalar value is passed in a single 64-bit register
17981 rather than a pair of 32-bit registers. For example, scalar
17982 floating-point values are returned in @samp{$f0} only, not a
17983 @samp{$f0}/@samp{$f1} pair. The set of call-saved registers also
17984 remains the same in that the even-numbered double-precision registers
17985 are saved.
17986
17987 Two additional variants of the o32 ABI are supported to enable
17988 a transition from 32-bit to 64-bit registers. These are FPXX
17989 (@option{-mfpxx}) and FP64A (@option{-mfp64} @option{-mno-odd-spreg}).
17990 The FPXX extension mandates that all code must execute correctly
17991 when run using 32-bit or 64-bit registers. The code can be interlinked
17992 with either FP32 or FP64, but not both.
17993 The FP64A extension is similar to the FP64 extension but forbids the
17994 use of odd-numbered single-precision registers. This can be used
17995 in conjunction with the @code{FRE} mode of FPUs in MIPS32R5
17996 processors and allows both FP32 and FP64A code to interlink and
17997 run in the same process without changing FPU modes.
17998
17999 @item -mabicalls
18000 @itemx -mno-abicalls
18001 @opindex mabicalls
18002 @opindex mno-abicalls
18003 Generate (do not generate) code that is suitable for SVR4-style
18004 dynamic objects. @option{-mabicalls} is the default for SVR4-based
18005 systems.
18006
18007 @item -mshared
18008 @itemx -mno-shared
18009 Generate (do not generate) code that is fully position-independent,
18010 and that can therefore be linked into shared libraries. This option
18011 only affects @option{-mabicalls}.
18012
18013 All @option{-mabicalls} code has traditionally been position-independent,
18014 regardless of options like @option{-fPIC} and @option{-fpic}. However,
18015 as an extension, the GNU toolchain allows executables to use absolute
18016 accesses for locally-binding symbols. It can also use shorter GP
18017 initialization sequences and generate direct calls to locally-defined
18018 functions. This mode is selected by @option{-mno-shared}.
18019
18020 @option{-mno-shared} depends on binutils 2.16 or higher and generates
18021 objects that can only be linked by the GNU linker. However, the option
18022 does not affect the ABI of the final executable; it only affects the ABI
18023 of relocatable objects. Using @option{-mno-shared} generally makes
18024 executables both smaller and quicker.
18025
18026 @option{-mshared} is the default.
18027
18028 @item -mplt
18029 @itemx -mno-plt
18030 @opindex mplt
18031 @opindex mno-plt
18032 Assume (do not assume) that the static and dynamic linkers
18033 support PLTs and copy relocations. This option only affects
18034 @option{-mno-shared -mabicalls}. For the n64 ABI, this option
18035 has no effect without @option{-msym32}.
18036
18037 You can make @option{-mplt} the default by configuring
18038 GCC with @option{--with-mips-plt}. The default is
18039 @option{-mno-plt} otherwise.
18040
18041 @item -mxgot
18042 @itemx -mno-xgot
18043 @opindex mxgot
18044 @opindex mno-xgot
18045 Lift (do not lift) the usual restrictions on the size of the global
18046 offset table.
18047
18048 GCC normally uses a single instruction to load values from the GOT@.
18049 While this is relatively efficient, it only works if the GOT
18050 is smaller than about 64k. Anything larger causes the linker
18051 to report an error such as:
18052
18053 @cindex relocation truncated to fit (MIPS)
18054 @smallexample
18055 relocation truncated to fit: R_MIPS_GOT16 foobar
18056 @end smallexample
18057
18058 If this happens, you should recompile your code with @option{-mxgot}.
18059 This works with very large GOTs, although the code is also
18060 less efficient, since it takes three instructions to fetch the
18061 value of a global symbol.
18062
18063 Note that some linkers can create multiple GOTs. If you have such a
18064 linker, you should only need to use @option{-mxgot} when a single object
18065 file accesses more than 64k's worth of GOT entries. Very few do.
18066
18067 These options have no effect unless GCC is generating position
18068 independent code.
18069
18070 @item -mgp32
18071 @opindex mgp32
18072 Assume that general-purpose registers are 32 bits wide.
18073
18074 @item -mgp64
18075 @opindex mgp64
18076 Assume that general-purpose registers are 64 bits wide.
18077
18078 @item -mfp32
18079 @opindex mfp32
18080 Assume that floating-point registers are 32 bits wide.
18081
18082 @item -mfp64
18083 @opindex mfp64
18084 Assume that floating-point registers are 64 bits wide.
18085
18086 @item -mfpxx
18087 @opindex mfpxx
18088 Do not assume the width of floating-point registers.
18089
18090 @item -mhard-float
18091 @opindex mhard-float
18092 Use floating-point coprocessor instructions.
18093
18094 @item -msoft-float
18095 @opindex msoft-float
18096 Do not use floating-point coprocessor instructions. Implement
18097 floating-point calculations using library calls instead.
18098
18099 @item -mno-float
18100 @opindex mno-float
18101 Equivalent to @option{-msoft-float}, but additionally asserts that the
18102 program being compiled does not perform any floating-point operations.
18103 This option is presently supported only by some bare-metal MIPS
18104 configurations, where it may select a special set of libraries
18105 that lack all floating-point support (including, for example, the
18106 floating-point @code{printf} formats).
18107 If code compiled with @option{-mno-float} accidentally contains
18108 floating-point operations, it is likely to suffer a link-time
18109 or run-time failure.
18110
18111 @item -msingle-float
18112 @opindex msingle-float
18113 Assume that the floating-point coprocessor only supports single-precision
18114 operations.
18115
18116 @item -mdouble-float
18117 @opindex mdouble-float
18118 Assume that the floating-point coprocessor supports double-precision
18119 operations. This is the default.
18120
18121 @item -modd-spreg
18122 @itemx -mno-odd-spreg
18123 @opindex modd-spreg
18124 @opindex mno-odd-spreg
18125 Enable the use of odd-numbered single-precision floating-point registers
18126 for the o32 ABI. This is the default for processors that are known to
18127 support these registers. When using the o32 FPXX ABI, @option{-mno-odd-spreg}
18128 is set by default.
18129
18130 @item -mabs=2008
18131 @itemx -mabs=legacy
18132 @opindex mabs=2008
18133 @opindex mabs=legacy
18134 These options control the treatment of the special not-a-number (NaN)
18135 IEEE 754 floating-point data with the @code{abs.@i{fmt}} and
18136 @code{neg.@i{fmt}} machine instructions.
18137
18138 By default or when @option{-mabs=legacy} is used the legacy
18139 treatment is selected. In this case these instructions are considered
18140 arithmetic and avoided where correct operation is required and the
18141 input operand might be a NaN. A longer sequence of instructions that
18142 manipulate the sign bit of floating-point datum manually is used
18143 instead unless the @option{-ffinite-math-only} option has also been
18144 specified.
18145
18146 The @option{-mabs=2008} option selects the IEEE 754-2008 treatment. In
18147 this case these instructions are considered non-arithmetic and therefore
18148 operating correctly in all cases, including in particular where the
18149 input operand is a NaN. These instructions are therefore always used
18150 for the respective operations.
18151
18152 @item -mnan=2008
18153 @itemx -mnan=legacy
18154 @opindex mnan=2008
18155 @opindex mnan=legacy
18156 These options control the encoding of the special not-a-number (NaN)
18157 IEEE 754 floating-point data.
18158
18159 The @option{-mnan=legacy} option selects the legacy encoding. In this
18160 case quiet NaNs (qNaNs) are denoted by the first bit of their trailing
18161 significand field being 0, whereas signaling NaNs (sNaNs) are denoted
18162 by the first bit of their trailing significand field being 1.
18163
18164 The @option{-mnan=2008} option selects the IEEE 754-2008 encoding. In
18165 this case qNaNs are denoted by the first bit of their trailing
18166 significand field being 1, whereas sNaNs are denoted by the first bit of
18167 their trailing significand field being 0.
18168
18169 The default is @option{-mnan=legacy} unless GCC has been configured with
18170 @option{--with-nan=2008}.
18171
18172 @item -mllsc
18173 @itemx -mno-llsc
18174 @opindex mllsc
18175 @opindex mno-llsc
18176 Use (do not use) @samp{ll}, @samp{sc}, and @samp{sync} instructions to
18177 implement atomic memory built-in functions. When neither option is
18178 specified, GCC uses the instructions if the target architecture
18179 supports them.
18180
18181 @option{-mllsc} is useful if the runtime environment can emulate the
18182 instructions and @option{-mno-llsc} can be useful when compiling for
18183 nonstandard ISAs. You can make either option the default by
18184 configuring GCC with @option{--with-llsc} and @option{--without-llsc}
18185 respectively. @option{--with-llsc} is the default for some
18186 configurations; see the installation documentation for details.
18187
18188 @item -mdsp
18189 @itemx -mno-dsp
18190 @opindex mdsp
18191 @opindex mno-dsp
18192 Use (do not use) revision 1 of the MIPS DSP ASE@.
18193 @xref{MIPS DSP Built-in Functions}. This option defines the
18194 preprocessor macro @code{__mips_dsp}. It also defines
18195 @code{__mips_dsp_rev} to 1.
18196
18197 @item -mdspr2
18198 @itemx -mno-dspr2
18199 @opindex mdspr2
18200 @opindex mno-dspr2
18201 Use (do not use) revision 2 of the MIPS DSP ASE@.
18202 @xref{MIPS DSP Built-in Functions}. This option defines the
18203 preprocessor macros @code{__mips_dsp} and @code{__mips_dspr2}.
18204 It also defines @code{__mips_dsp_rev} to 2.
18205
18206 @item -msmartmips
18207 @itemx -mno-smartmips
18208 @opindex msmartmips
18209 @opindex mno-smartmips
18210 Use (do not use) the MIPS SmartMIPS ASE.
18211
18212 @item -mpaired-single
18213 @itemx -mno-paired-single
18214 @opindex mpaired-single
18215 @opindex mno-paired-single
18216 Use (do not use) paired-single floating-point instructions.
18217 @xref{MIPS Paired-Single Support}. This option requires
18218 hardware floating-point support to be enabled.
18219
18220 @item -mdmx
18221 @itemx -mno-mdmx
18222 @opindex mdmx
18223 @opindex mno-mdmx
18224 Use (do not use) MIPS Digital Media Extension instructions.
18225 This option can only be used when generating 64-bit code and requires
18226 hardware floating-point support to be enabled.
18227
18228 @item -mips3d
18229 @itemx -mno-mips3d
18230 @opindex mips3d
18231 @opindex mno-mips3d
18232 Use (do not use) the MIPS-3D ASE@. @xref{MIPS-3D Built-in Functions}.
18233 The option @option{-mips3d} implies @option{-mpaired-single}.
18234
18235 @item -mmicromips
18236 @itemx -mno-micromips
18237 @opindex mmicromips
18238 @opindex mno-mmicromips
18239 Generate (do not generate) microMIPS code.
18240
18241 MicroMIPS code generation can also be controlled on a per-function basis
18242 by means of @code{micromips} and @code{nomicromips} attributes.
18243 @xref{Function Attributes}, for more information.
18244
18245 @item -mmt
18246 @itemx -mno-mt
18247 @opindex mmt
18248 @opindex mno-mt
18249 Use (do not use) MT Multithreading instructions.
18250
18251 @item -mmcu
18252 @itemx -mno-mcu
18253 @opindex mmcu
18254 @opindex mno-mcu
18255 Use (do not use) the MIPS MCU ASE instructions.
18256
18257 @item -meva
18258 @itemx -mno-eva
18259 @opindex meva
18260 @opindex mno-eva
18261 Use (do not use) the MIPS Enhanced Virtual Addressing instructions.
18262
18263 @item -mvirt
18264 @itemx -mno-virt
18265 @opindex mvirt
18266 @opindex mno-virt
18267 Use (do not use) the MIPS Virtualization Application Specific instructions.
18268
18269 @item -mxpa
18270 @itemx -mno-xpa
18271 @opindex mxpa
18272 @opindex mno-xpa
18273 Use (do not use) the MIPS eXtended Physical Address (XPA) instructions.
18274
18275 @item -mlong64
18276 @opindex mlong64
18277 Force @code{long} types to be 64 bits wide. See @option{-mlong32} for
18278 an explanation of the default and the way that the pointer size is
18279 determined.
18280
18281 @item -mlong32
18282 @opindex mlong32
18283 Force @code{long}, @code{int}, and pointer types to be 32 bits wide.
18284
18285 The default size of @code{int}s, @code{long}s and pointers depends on
18286 the ABI@. All the supported ABIs use 32-bit @code{int}s. The n64 ABI
18287 uses 64-bit @code{long}s, as does the 64-bit EABI; the others use
18288 32-bit @code{long}s. Pointers are the same size as @code{long}s,
18289 or the same size as integer registers, whichever is smaller.
18290
18291 @item -msym32
18292 @itemx -mno-sym32
18293 @opindex msym32
18294 @opindex mno-sym32
18295 Assume (do not assume) that all symbols have 32-bit values, regardless
18296 of the selected ABI@. This option is useful in combination with
18297 @option{-mabi=64} and @option{-mno-abicalls} because it allows GCC
18298 to generate shorter and faster references to symbolic addresses.
18299
18300 @item -G @var{num}
18301 @opindex G
18302 Put definitions of externally-visible data in a small data section
18303 if that data is no bigger than @var{num} bytes. GCC can then generate
18304 more efficient accesses to the data; see @option{-mgpopt} for details.
18305
18306 The default @option{-G} option depends on the configuration.
18307
18308 @item -mlocal-sdata
18309 @itemx -mno-local-sdata
18310 @opindex mlocal-sdata
18311 @opindex mno-local-sdata
18312 Extend (do not extend) the @option{-G} behavior to local data too,
18313 such as to static variables in C@. @option{-mlocal-sdata} is the
18314 default for all configurations.
18315
18316 If the linker complains that an application is using too much small data,
18317 you might want to try rebuilding the less performance-critical parts with
18318 @option{-mno-local-sdata}. You might also want to build large
18319 libraries with @option{-mno-local-sdata}, so that the libraries leave
18320 more room for the main program.
18321
18322 @item -mextern-sdata
18323 @itemx -mno-extern-sdata
18324 @opindex mextern-sdata
18325 @opindex mno-extern-sdata
18326 Assume (do not assume) that externally-defined data is in
18327 a small data section if the size of that data is within the @option{-G} limit.
18328 @option{-mextern-sdata} is the default for all configurations.
18329
18330 If you compile a module @var{Mod} with @option{-mextern-sdata} @option{-G
18331 @var{num}} @option{-mgpopt}, and @var{Mod} references a variable @var{Var}
18332 that is no bigger than @var{num} bytes, you must make sure that @var{Var}
18333 is placed in a small data section. If @var{Var} is defined by another
18334 module, you must either compile that module with a high-enough
18335 @option{-G} setting or attach a @code{section} attribute to @var{Var}'s
18336 definition. If @var{Var} is common, you must link the application
18337 with a high-enough @option{-G} setting.
18338
18339 The easiest way of satisfying these restrictions is to compile
18340 and link every module with the same @option{-G} option. However,
18341 you may wish to build a library that supports several different
18342 small data limits. You can do this by compiling the library with
18343 the highest supported @option{-G} setting and additionally using
18344 @option{-mno-extern-sdata} to stop the library from making assumptions
18345 about externally-defined data.
18346
18347 @item -mgpopt
18348 @itemx -mno-gpopt
18349 @opindex mgpopt
18350 @opindex mno-gpopt
18351 Use (do not use) GP-relative accesses for symbols that are known to be
18352 in a small data section; see @option{-G}, @option{-mlocal-sdata} and
18353 @option{-mextern-sdata}. @option{-mgpopt} is the default for all
18354 configurations.
18355
18356 @option{-mno-gpopt} is useful for cases where the @code{$gp} register
18357 might not hold the value of @code{_gp}. For example, if the code is
18358 part of a library that might be used in a boot monitor, programs that
18359 call boot monitor routines pass an unknown value in @code{$gp}.
18360 (In such situations, the boot monitor itself is usually compiled
18361 with @option{-G0}.)
18362
18363 @option{-mno-gpopt} implies @option{-mno-local-sdata} and
18364 @option{-mno-extern-sdata}.
18365
18366 @item -membedded-data
18367 @itemx -mno-embedded-data
18368 @opindex membedded-data
18369 @opindex mno-embedded-data
18370 Allocate variables to the read-only data section first if possible, then
18371 next in the small data section if possible, otherwise in data. This gives
18372 slightly slower code than the default, but reduces the amount of RAM required
18373 when executing, and thus may be preferred for some embedded systems.
18374
18375 @item -muninit-const-in-rodata
18376 @itemx -mno-uninit-const-in-rodata
18377 @opindex muninit-const-in-rodata
18378 @opindex mno-uninit-const-in-rodata
18379 Put uninitialized @code{const} variables in the read-only data section.
18380 This option is only meaningful in conjunction with @option{-membedded-data}.
18381
18382 @item -mcode-readable=@var{setting}
18383 @opindex mcode-readable
18384 Specify whether GCC may generate code that reads from executable sections.
18385 There are three possible settings:
18386
18387 @table @gcctabopt
18388 @item -mcode-readable=yes
18389 Instructions may freely access executable sections. This is the
18390 default setting.
18391
18392 @item -mcode-readable=pcrel
18393 MIPS16 PC-relative load instructions can access executable sections,
18394 but other instructions must not do so. This option is useful on 4KSc
18395 and 4KSd processors when the code TLBs have the Read Inhibit bit set.
18396 It is also useful on processors that can be configured to have a dual
18397 instruction/data SRAM interface and that, like the M4K, automatically
18398 redirect PC-relative loads to the instruction RAM.
18399
18400 @item -mcode-readable=no
18401 Instructions must not access executable sections. This option can be
18402 useful on targets that are configured to have a dual instruction/data
18403 SRAM interface but that (unlike the M4K) do not automatically redirect
18404 PC-relative loads to the instruction RAM.
18405 @end table
18406
18407 @item -msplit-addresses
18408 @itemx -mno-split-addresses
18409 @opindex msplit-addresses
18410 @opindex mno-split-addresses
18411 Enable (disable) use of the @code{%hi()} and @code{%lo()} assembler
18412 relocation operators. This option has been superseded by
18413 @option{-mexplicit-relocs} but is retained for backwards compatibility.
18414
18415 @item -mexplicit-relocs
18416 @itemx -mno-explicit-relocs
18417 @opindex mexplicit-relocs
18418 @opindex mno-explicit-relocs
18419 Use (do not use) assembler relocation operators when dealing with symbolic
18420 addresses. The alternative, selected by @option{-mno-explicit-relocs},
18421 is to use assembler macros instead.
18422
18423 @option{-mexplicit-relocs} is the default if GCC was configured
18424 to use an assembler that supports relocation operators.
18425
18426 @item -mcheck-zero-division
18427 @itemx -mno-check-zero-division
18428 @opindex mcheck-zero-division
18429 @opindex mno-check-zero-division
18430 Trap (do not trap) on integer division by zero.
18431
18432 The default is @option{-mcheck-zero-division}.
18433
18434 @item -mdivide-traps
18435 @itemx -mdivide-breaks
18436 @opindex mdivide-traps
18437 @opindex mdivide-breaks
18438 MIPS systems check for division by zero by generating either a
18439 conditional trap or a break instruction. Using traps results in
18440 smaller code, but is only supported on MIPS II and later. Also, some
18441 versions of the Linux kernel have a bug that prevents trap from
18442 generating the proper signal (@code{SIGFPE}). Use @option{-mdivide-traps} to
18443 allow conditional traps on architectures that support them and
18444 @option{-mdivide-breaks} to force the use of breaks.
18445
18446 The default is usually @option{-mdivide-traps}, but this can be
18447 overridden at configure time using @option{--with-divide=breaks}.
18448 Divide-by-zero checks can be completely disabled using
18449 @option{-mno-check-zero-division}.
18450
18451 @item -mmemcpy
18452 @itemx -mno-memcpy
18453 @opindex mmemcpy
18454 @opindex mno-memcpy
18455 Force (do not force) the use of @code{memcpy} for non-trivial block
18456 moves. The default is @option{-mno-memcpy}, which allows GCC to inline
18457 most constant-sized copies.
18458
18459 @item -mlong-calls
18460 @itemx -mno-long-calls
18461 @opindex mlong-calls
18462 @opindex mno-long-calls
18463 Disable (do not disable) use of the @code{jal} instruction. Calling
18464 functions using @code{jal} is more efficient but requires the caller
18465 and callee to be in the same 256 megabyte segment.
18466
18467 This option has no effect on abicalls code. The default is
18468 @option{-mno-long-calls}.
18469
18470 @item -mmad
18471 @itemx -mno-mad
18472 @opindex mmad
18473 @opindex mno-mad
18474 Enable (disable) use of the @code{mad}, @code{madu} and @code{mul}
18475 instructions, as provided by the R4650 ISA@.
18476
18477 @item -mimadd
18478 @itemx -mno-imadd
18479 @opindex mimadd
18480 @opindex mno-imadd
18481 Enable (disable) use of the @code{madd} and @code{msub} integer
18482 instructions. The default is @option{-mimadd} on architectures
18483 that support @code{madd} and @code{msub} except for the 74k
18484 architecture where it was found to generate slower code.
18485
18486 @item -mfused-madd
18487 @itemx -mno-fused-madd
18488 @opindex mfused-madd
18489 @opindex mno-fused-madd
18490 Enable (disable) use of the floating-point multiply-accumulate
18491 instructions, when they are available. The default is
18492 @option{-mfused-madd}.
18493
18494 On the R8000 CPU when multiply-accumulate instructions are used,
18495 the intermediate product is calculated to infinite precision
18496 and is not subject to the FCSR Flush to Zero bit. This may be
18497 undesirable in some circumstances. On other processors the result
18498 is numerically identical to the equivalent computation using
18499 separate multiply, add, subtract and negate instructions.
18500
18501 @item -nocpp
18502 @opindex nocpp
18503 Tell the MIPS assembler to not run its preprocessor over user
18504 assembler files (with a @samp{.s} suffix) when assembling them.
18505
18506 @item -mfix-24k
18507 @item -mno-fix-24k
18508 @opindex mfix-24k
18509 @opindex mno-fix-24k
18510 Work around the 24K E48 (lost data on stores during refill) errata.
18511 The workarounds are implemented by the assembler rather than by GCC@.
18512
18513 @item -mfix-r4000
18514 @itemx -mno-fix-r4000
18515 @opindex mfix-r4000
18516 @opindex mno-fix-r4000
18517 Work around certain R4000 CPU errata:
18518 @itemize @minus
18519 @item
18520 A double-word or a variable shift may give an incorrect result if executed
18521 immediately after starting an integer division.
18522 @item
18523 A double-word or a variable shift may give an incorrect result if executed
18524 while an integer multiplication is in progress.
18525 @item
18526 An integer division may give an incorrect result if started in a delay slot
18527 of a taken branch or a jump.
18528 @end itemize
18529
18530 @item -mfix-r4400
18531 @itemx -mno-fix-r4400
18532 @opindex mfix-r4400
18533 @opindex mno-fix-r4400
18534 Work around certain R4400 CPU errata:
18535 @itemize @minus
18536 @item
18537 A double-word or a variable shift may give an incorrect result if executed
18538 immediately after starting an integer division.
18539 @end itemize
18540
18541 @item -mfix-r10000
18542 @itemx -mno-fix-r10000
18543 @opindex mfix-r10000
18544 @opindex mno-fix-r10000
18545 Work around certain R10000 errata:
18546 @itemize @minus
18547 @item
18548 @code{ll}/@code{sc} sequences may not behave atomically on revisions
18549 prior to 3.0. They may deadlock on revisions 2.6 and earlier.
18550 @end itemize
18551
18552 This option can only be used if the target architecture supports
18553 branch-likely instructions. @option{-mfix-r10000} is the default when
18554 @option{-march=r10000} is used; @option{-mno-fix-r10000} is the default
18555 otherwise.
18556
18557 @item -mfix-rm7000
18558 @itemx -mno-fix-rm7000
18559 @opindex mfix-rm7000
18560 Work around the RM7000 @code{dmult}/@code{dmultu} errata. The
18561 workarounds are implemented by the assembler rather than by GCC@.
18562
18563 @item -mfix-vr4120
18564 @itemx -mno-fix-vr4120
18565 @opindex mfix-vr4120
18566 Work around certain VR4120 errata:
18567 @itemize @minus
18568 @item
18569 @code{dmultu} does not always produce the correct result.
18570 @item
18571 @code{div} and @code{ddiv} do not always produce the correct result if one
18572 of the operands is negative.
18573 @end itemize
18574 The workarounds for the division errata rely on special functions in
18575 @file{libgcc.a}. At present, these functions are only provided by
18576 the @code{mips64vr*-elf} configurations.
18577
18578 Other VR4120 errata require a NOP to be inserted between certain pairs of
18579 instructions. These errata are handled by the assembler, not by GCC itself.
18580
18581 @item -mfix-vr4130
18582 @opindex mfix-vr4130
18583 Work around the VR4130 @code{mflo}/@code{mfhi} errata. The
18584 workarounds are implemented by the assembler rather than by GCC,
18585 although GCC avoids using @code{mflo} and @code{mfhi} if the
18586 VR4130 @code{macc}, @code{macchi}, @code{dmacc} and @code{dmacchi}
18587 instructions are available instead.
18588
18589 @item -mfix-sb1
18590 @itemx -mno-fix-sb1
18591 @opindex mfix-sb1
18592 Work around certain SB-1 CPU core errata.
18593 (This flag currently works around the SB-1 revision 2
18594 ``F1'' and ``F2'' floating-point errata.)
18595
18596 @item -mr10k-cache-barrier=@var{setting}
18597 @opindex mr10k-cache-barrier
18598 Specify whether GCC should insert cache barriers to avoid the
18599 side-effects of speculation on R10K processors.
18600
18601 In common with many processors, the R10K tries to predict the outcome
18602 of a conditional branch and speculatively executes instructions from
18603 the ``taken'' branch. It later aborts these instructions if the
18604 predicted outcome is wrong. However, on the R10K, even aborted
18605 instructions can have side effects.
18606
18607 This problem only affects kernel stores and, depending on the system,
18608 kernel loads. As an example, a speculatively-executed store may load
18609 the target memory into cache and mark the cache line as dirty, even if
18610 the store itself is later aborted. If a DMA operation writes to the
18611 same area of memory before the ``dirty'' line is flushed, the cached
18612 data overwrites the DMA-ed data. See the R10K processor manual
18613 for a full description, including other potential problems.
18614
18615 One workaround is to insert cache barrier instructions before every memory
18616 access that might be speculatively executed and that might have side
18617 effects even if aborted. @option{-mr10k-cache-barrier=@var{setting}}
18618 controls GCC's implementation of this workaround. It assumes that
18619 aborted accesses to any byte in the following regions does not have
18620 side effects:
18621
18622 @enumerate
18623 @item
18624 the memory occupied by the current function's stack frame;
18625
18626 @item
18627 the memory occupied by an incoming stack argument;
18628
18629 @item
18630 the memory occupied by an object with a link-time-constant address.
18631 @end enumerate
18632
18633 It is the kernel's responsibility to ensure that speculative
18634 accesses to these regions are indeed safe.
18635
18636 If the input program contains a function declaration such as:
18637
18638 @smallexample
18639 void foo (void);
18640 @end smallexample
18641
18642 then the implementation of @code{foo} must allow @code{j foo} and
18643 @code{jal foo} to be executed speculatively. GCC honors this
18644 restriction for functions it compiles itself. It expects non-GCC
18645 functions (such as hand-written assembly code) to do the same.
18646
18647 The option has three forms:
18648
18649 @table @gcctabopt
18650 @item -mr10k-cache-barrier=load-store
18651 Insert a cache barrier before a load or store that might be
18652 speculatively executed and that might have side effects even
18653 if aborted.
18654
18655 @item -mr10k-cache-barrier=store
18656 Insert a cache barrier before a store that might be speculatively
18657 executed and that might have side effects even if aborted.
18658
18659 @item -mr10k-cache-barrier=none
18660 Disable the insertion of cache barriers. This is the default setting.
18661 @end table
18662
18663 @item -mflush-func=@var{func}
18664 @itemx -mno-flush-func
18665 @opindex mflush-func
18666 Specifies the function to call to flush the I and D caches, or to not
18667 call any such function. If called, the function must take the same
18668 arguments as the common @code{_flush_func}, that is, the address of the
18669 memory range for which the cache is being flushed, the size of the
18670 memory range, and the number 3 (to flush both caches). The default
18671 depends on the target GCC was configured for, but commonly is either
18672 @code{_flush_func} or @code{__cpu_flush}.
18673
18674 @item mbranch-cost=@var{num}
18675 @opindex mbranch-cost
18676 Set the cost of branches to roughly @var{num} ``simple'' instructions.
18677 This cost is only a heuristic and is not guaranteed to produce
18678 consistent results across releases. A zero cost redundantly selects
18679 the default, which is based on the @option{-mtune} setting.
18680
18681 @item -mbranch-likely
18682 @itemx -mno-branch-likely
18683 @opindex mbranch-likely
18684 @opindex mno-branch-likely
18685 Enable or disable use of Branch Likely instructions, regardless of the
18686 default for the selected architecture. By default, Branch Likely
18687 instructions may be generated if they are supported by the selected
18688 architecture. An exception is for the MIPS32 and MIPS64 architectures
18689 and processors that implement those architectures; for those, Branch
18690 Likely instructions are not be generated by default because the MIPS32
18691 and MIPS64 architectures specifically deprecate their use.
18692
18693 @item -mcompact-branches=never
18694 @itemx -mcompact-branches=optimal
18695 @itemx -mcompact-branches=always
18696 @opindex mcompact-branches=never
18697 @opindex mcompact-branches=optimal
18698 @opindex mcompact-branches=always
18699 These options control which form of branches will be generated. The
18700 default is @option{-mcompact-branches=optimal}.
18701
18702 The @option{-mcompact-branches=never} option ensures that compact branch
18703 instructions will never be generated.
18704
18705 The @option{-mcompact-branches=always} option ensures that a compact
18706 branch instruction will be generated if available. If a compact branch
18707 instruction is not available, a delay slot form of the branch will be
18708 used instead.
18709
18710 This option is supported from MIPS Release 6 onwards.
18711
18712 The @option{-mcompact-branches=optimal} option will cause a delay slot
18713 branch to be used if one is available in the current ISA and the delay
18714 slot is successfully filled. If the delay slot is not filled, a compact
18715 branch will be chosen if one is available.
18716
18717 @item -mfp-exceptions
18718 @itemx -mno-fp-exceptions
18719 @opindex mfp-exceptions
18720 Specifies whether FP exceptions are enabled. This affects how
18721 FP instructions are scheduled for some processors.
18722 The default is that FP exceptions are
18723 enabled.
18724
18725 For instance, on the SB-1, if FP exceptions are disabled, and we are emitting
18726 64-bit code, then we can use both FP pipes. Otherwise, we can only use one
18727 FP pipe.
18728
18729 @item -mvr4130-align
18730 @itemx -mno-vr4130-align
18731 @opindex mvr4130-align
18732 The VR4130 pipeline is two-way superscalar, but can only issue two
18733 instructions together if the first one is 8-byte aligned. When this
18734 option is enabled, GCC aligns pairs of instructions that it
18735 thinks should execute in parallel.
18736
18737 This option only has an effect when optimizing for the VR4130.
18738 It normally makes code faster, but at the expense of making it bigger.
18739 It is enabled by default at optimization level @option{-O3}.
18740
18741 @item -msynci
18742 @itemx -mno-synci
18743 @opindex msynci
18744 Enable (disable) generation of @code{synci} instructions on
18745 architectures that support it. The @code{synci} instructions (if
18746 enabled) are generated when @code{__builtin___clear_cache} is
18747 compiled.
18748
18749 This option defaults to @option{-mno-synci}, but the default can be
18750 overridden by configuring GCC with @option{--with-synci}.
18751
18752 When compiling code for single processor systems, it is generally safe
18753 to use @code{synci}. However, on many multi-core (SMP) systems, it
18754 does not invalidate the instruction caches on all cores and may lead
18755 to undefined behavior.
18756
18757 @item -mrelax-pic-calls
18758 @itemx -mno-relax-pic-calls
18759 @opindex mrelax-pic-calls
18760 Try to turn PIC calls that are normally dispatched via register
18761 @code{$25} into direct calls. This is only possible if the linker can
18762 resolve the destination at link time and if the destination is within
18763 range for a direct call.
18764
18765 @option{-mrelax-pic-calls} is the default if GCC was configured to use
18766 an assembler and a linker that support the @code{.reloc} assembly
18767 directive and @option{-mexplicit-relocs} is in effect. With
18768 @option{-mno-explicit-relocs}, this optimization can be performed by the
18769 assembler and the linker alone without help from the compiler.
18770
18771 @item -mmcount-ra-address
18772 @itemx -mno-mcount-ra-address
18773 @opindex mmcount-ra-address
18774 @opindex mno-mcount-ra-address
18775 Emit (do not emit) code that allows @code{_mcount} to modify the
18776 calling function's return address. When enabled, this option extends
18777 the usual @code{_mcount} interface with a new @var{ra-address}
18778 parameter, which has type @code{intptr_t *} and is passed in register
18779 @code{$12}. @code{_mcount} can then modify the return address by
18780 doing both of the following:
18781 @itemize
18782 @item
18783 Returning the new address in register @code{$31}.
18784 @item
18785 Storing the new address in @code{*@var{ra-address}},
18786 if @var{ra-address} is nonnull.
18787 @end itemize
18788
18789 The default is @option{-mno-mcount-ra-address}.
18790
18791 @item -mframe-header-opt
18792 @itemx -mno-frame-header-opt
18793 @opindex mframe-header-opt
18794 Enable (disable) frame header optimization in the o32 ABI. When using the
18795 o32 ABI, calling functions will allocate 16 bytes on the stack for the called
18796 function to write out register arguments. When enabled, this optimization
18797 will suppress the allocation of the frame header if it can be determined that
18798 it is unused.
18799
18800 This optimization is off by default at all optimization levels.
18801
18802 @end table
18803
18804 @node MMIX Options
18805 @subsection MMIX Options
18806 @cindex MMIX Options
18807
18808 These options are defined for the MMIX:
18809
18810 @table @gcctabopt
18811 @item -mlibfuncs
18812 @itemx -mno-libfuncs
18813 @opindex mlibfuncs
18814 @opindex mno-libfuncs
18815 Specify that intrinsic library functions are being compiled, passing all
18816 values in registers, no matter the size.
18817
18818 @item -mepsilon
18819 @itemx -mno-epsilon
18820 @opindex mepsilon
18821 @opindex mno-epsilon
18822 Generate floating-point comparison instructions that compare with respect
18823 to the @code{rE} epsilon register.
18824
18825 @item -mabi=mmixware
18826 @itemx -mabi=gnu
18827 @opindex mabi=mmixware
18828 @opindex mabi=gnu
18829 Generate code that passes function parameters and return values that (in
18830 the called function) are seen as registers @code{$0} and up, as opposed to
18831 the GNU ABI which uses global registers @code{$231} and up.
18832
18833 @item -mzero-extend
18834 @itemx -mno-zero-extend
18835 @opindex mzero-extend
18836 @opindex mno-zero-extend
18837 When reading data from memory in sizes shorter than 64 bits, use (do not
18838 use) zero-extending load instructions by default, rather than
18839 sign-extending ones.
18840
18841 @item -mknuthdiv
18842 @itemx -mno-knuthdiv
18843 @opindex mknuthdiv
18844 @opindex mno-knuthdiv
18845 Make the result of a division yielding a remainder have the same sign as
18846 the divisor. With the default, @option{-mno-knuthdiv}, the sign of the
18847 remainder follows the sign of the dividend. Both methods are
18848 arithmetically valid, the latter being almost exclusively used.
18849
18850 @item -mtoplevel-symbols
18851 @itemx -mno-toplevel-symbols
18852 @opindex mtoplevel-symbols
18853 @opindex mno-toplevel-symbols
18854 Prepend (do not prepend) a @samp{:} to all global symbols, so the assembly
18855 code can be used with the @code{PREFIX} assembly directive.
18856
18857 @item -melf
18858 @opindex melf
18859 Generate an executable in the ELF format, rather than the default
18860 @samp{mmo} format used by the @command{mmix} simulator.
18861
18862 @item -mbranch-predict
18863 @itemx -mno-branch-predict
18864 @opindex mbranch-predict
18865 @opindex mno-branch-predict
18866 Use (do not use) the probable-branch instructions, when static branch
18867 prediction indicates a probable branch.
18868
18869 @item -mbase-addresses
18870 @itemx -mno-base-addresses
18871 @opindex mbase-addresses
18872 @opindex mno-base-addresses
18873 Generate (do not generate) code that uses @emph{base addresses}. Using a
18874 base address automatically generates a request (handled by the assembler
18875 and the linker) for a constant to be set up in a global register. The
18876 register is used for one or more base address requests within the range 0
18877 to 255 from the value held in the register. The generally leads to short
18878 and fast code, but the number of different data items that can be
18879 addressed is limited. This means that a program that uses lots of static
18880 data may require @option{-mno-base-addresses}.
18881
18882 @item -msingle-exit
18883 @itemx -mno-single-exit
18884 @opindex msingle-exit
18885 @opindex mno-single-exit
18886 Force (do not force) generated code to have a single exit point in each
18887 function.
18888 @end table
18889
18890 @node MN10300 Options
18891 @subsection MN10300 Options
18892 @cindex MN10300 options
18893
18894 These @option{-m} options are defined for Matsushita MN10300 architectures:
18895
18896 @table @gcctabopt
18897 @item -mmult-bug
18898 @opindex mmult-bug
18899 Generate code to avoid bugs in the multiply instructions for the MN10300
18900 processors. This is the default.
18901
18902 @item -mno-mult-bug
18903 @opindex mno-mult-bug
18904 Do not generate code to avoid bugs in the multiply instructions for the
18905 MN10300 processors.
18906
18907 @item -mam33
18908 @opindex mam33
18909 Generate code using features specific to the AM33 processor.
18910
18911 @item -mno-am33
18912 @opindex mno-am33
18913 Do not generate code using features specific to the AM33 processor. This
18914 is the default.
18915
18916 @item -mam33-2
18917 @opindex mam33-2
18918 Generate code using features specific to the AM33/2.0 processor.
18919
18920 @item -mam34
18921 @opindex mam34
18922 Generate code using features specific to the AM34 processor.
18923
18924 @item -mtune=@var{cpu-type}
18925 @opindex mtune
18926 Use the timing characteristics of the indicated CPU type when
18927 scheduling instructions. This does not change the targeted processor
18928 type. The CPU type must be one of @samp{mn10300}, @samp{am33},
18929 @samp{am33-2} or @samp{am34}.
18930
18931 @item -mreturn-pointer-on-d0
18932 @opindex mreturn-pointer-on-d0
18933 When generating a function that returns a pointer, return the pointer
18934 in both @code{a0} and @code{d0}. Otherwise, the pointer is returned
18935 only in @code{a0}, and attempts to call such functions without a prototype
18936 result in errors. Note that this option is on by default; use
18937 @option{-mno-return-pointer-on-d0} to disable it.
18938
18939 @item -mno-crt0
18940 @opindex mno-crt0
18941 Do not link in the C run-time initialization object file.
18942
18943 @item -mrelax
18944 @opindex mrelax
18945 Indicate to the linker that it should perform a relaxation optimization pass
18946 to shorten branches, calls and absolute memory addresses. This option only
18947 has an effect when used on the command line for the final link step.
18948
18949 This option makes symbolic debugging impossible.
18950
18951 @item -mliw
18952 @opindex mliw
18953 Allow the compiler to generate @emph{Long Instruction Word}
18954 instructions if the target is the @samp{AM33} or later. This is the
18955 default. This option defines the preprocessor macro @code{__LIW__}.
18956
18957 @item -mnoliw
18958 @opindex mnoliw
18959 Do not allow the compiler to generate @emph{Long Instruction Word}
18960 instructions. This option defines the preprocessor macro
18961 @code{__NO_LIW__}.
18962
18963 @item -msetlb
18964 @opindex msetlb
18965 Allow the compiler to generate the @emph{SETLB} and @emph{Lcc}
18966 instructions if the target is the @samp{AM33} or later. This is the
18967 default. This option defines the preprocessor macro @code{__SETLB__}.
18968
18969 @item -mnosetlb
18970 @opindex mnosetlb
18971 Do not allow the compiler to generate @emph{SETLB} or @emph{Lcc}
18972 instructions. This option defines the preprocessor macro
18973 @code{__NO_SETLB__}.
18974
18975 @end table
18976
18977 @node Moxie Options
18978 @subsection Moxie Options
18979 @cindex Moxie Options
18980
18981 @table @gcctabopt
18982
18983 @item -meb
18984 @opindex meb
18985 Generate big-endian code. This is the default for @samp{moxie-*-*}
18986 configurations.
18987
18988 @item -mel
18989 @opindex mel
18990 Generate little-endian code.
18991
18992 @item -mmul.x
18993 @opindex mmul.x
18994 Generate mul.x and umul.x instructions. This is the default for
18995 @samp{moxiebox-*-*} configurations.
18996
18997 @item -mno-crt0
18998 @opindex mno-crt0
18999 Do not link in the C run-time initialization object file.
19000
19001 @end table
19002
19003 @node MSP430 Options
19004 @subsection MSP430 Options
19005 @cindex MSP430 Options
19006
19007 These options are defined for the MSP430:
19008
19009 @table @gcctabopt
19010
19011 @item -masm-hex
19012 @opindex masm-hex
19013 Force assembly output to always use hex constants. Normally such
19014 constants are signed decimals, but this option is available for
19015 testsuite and/or aesthetic purposes.
19016
19017 @item -mmcu=
19018 @opindex mmcu=
19019 Select the MCU to target. This is used to create a C preprocessor
19020 symbol based upon the MCU name, converted to upper case and pre- and
19021 post-fixed with @samp{__}. This in turn is used by the
19022 @file{msp430.h} header file to select an MCU-specific supplementary
19023 header file.
19024
19025 The option also sets the ISA to use. If the MCU name is one that is
19026 known to only support the 430 ISA then that is selected, otherwise the
19027 430X ISA is selected. A generic MCU name of @samp{msp430} can also be
19028 used to select the 430 ISA. Similarly the generic @samp{msp430x} MCU
19029 name selects the 430X ISA.
19030
19031 In addition an MCU-specific linker script is added to the linker
19032 command line. The script's name is the name of the MCU with
19033 @file{.ld} appended. Thus specifying @option{-mmcu=xxx} on the @command{gcc}
19034 command line defines the C preprocessor symbol @code{__XXX__} and
19035 cause the linker to search for a script called @file{xxx.ld}.
19036
19037 This option is also passed on to the assembler.
19038
19039 @item -mwarn-mcu
19040 @itemx -mno-warn-mcu
19041 @opindex mwarn-mcu
19042 @opindex mno-warn-mcu
19043 This option enables or disables warnings about conflicts between the
19044 MCU name specified by the @option{-mmcu} option and the ISA set by the
19045 @option{-mcpu} option and/or the hardware multiply support set by the
19046 @option{-mhwmult} option. It also toggles warnings about unrecognized
19047 MCU names. This option is on by default.
19048
19049 @item -mcpu=
19050 @opindex mcpu=
19051 Specifies the ISA to use. Accepted values are @samp{msp430},
19052 @samp{msp430x} and @samp{msp430xv2}. This option is deprecated. The
19053 @option{-mmcu=} option should be used to select the ISA.
19054
19055 @item -msim
19056 @opindex msim
19057 Link to the simulator runtime libraries and linker script. Overrides
19058 any scripts that would be selected by the @option{-mmcu=} option.
19059
19060 @item -mlarge
19061 @opindex mlarge
19062 Use large-model addressing (20-bit pointers, 32-bit @code{size_t}).
19063
19064 @item -msmall
19065 @opindex msmall
19066 Use small-model addressing (16-bit pointers, 16-bit @code{size_t}).
19067
19068 @item -mrelax
19069 @opindex mrelax
19070 This option is passed to the assembler and linker, and allows the
19071 linker to perform certain optimizations that cannot be done until
19072 the final link.
19073
19074 @item mhwmult=
19075 @opindex mhwmult=
19076 Describes the type of hardware multiply supported by the target.
19077 Accepted values are @samp{none} for no hardware multiply, @samp{16bit}
19078 for the original 16-bit-only multiply supported by early MCUs.
19079 @samp{32bit} for the 16/32-bit multiply supported by later MCUs and
19080 @samp{f5series} for the 16/32-bit multiply supported by F5-series MCUs.
19081 A value of @samp{auto} can also be given. This tells GCC to deduce
19082 the hardware multiply support based upon the MCU name provided by the
19083 @option{-mmcu} option. If no @option{-mmcu} option is specified or if
19084 the MCU name is not recognized then no hardware multiply support is
19085 assumed. @code{auto} is the default setting.
19086
19087 Hardware multiplies are normally performed by calling a library
19088 routine. This saves space in the generated code. When compiling at
19089 @option{-O3} or higher however the hardware multiplier is invoked
19090 inline. This makes for bigger, but faster code.
19091
19092 The hardware multiply routines disable interrupts whilst running and
19093 restore the previous interrupt state when they finish. This makes
19094 them safe to use inside interrupt handlers as well as in normal code.
19095
19096 @item -minrt
19097 @opindex minrt
19098 Enable the use of a minimum runtime environment - no static
19099 initializers or constructors. This is intended for memory-constrained
19100 devices. The compiler includes special symbols in some objects
19101 that tell the linker and runtime which code fragments are required.
19102
19103 @item -mcode-region=
19104 @itemx -mdata-region=
19105 @opindex mcode-region
19106 @opindex mdata-region
19107 These options tell the compiler where to place functions and data that
19108 do not have one of the @code{lower}, @code{upper}, @code{either} or
19109 @code{section} attributes. Possible values are @code{lower},
19110 @code{upper}, @code{either} or @code{any}. The first three behave
19111 like the corresponding attribute. The fourth possible value -
19112 @code{any} - is the default. It leaves placement entirely up to the
19113 linker script and how it assigns the standard sections
19114 (@code{.text}, @code{.data}, etc) to the memory regions.
19115
19116 @item -msilicon-errata=
19117 @opindex msilicon-errata
19118 This option passes on a request to assembler to enable the fixes for
19119 the named silicon errata.
19120
19121 @item -msilicon-errata-warn=
19122 @opindex msilicon-errata-warn
19123 This option passes on a request to the assembler to enable warning
19124 messages when a silicon errata might need to be applied.
19125
19126 @end table
19127
19128 @node NDS32 Options
19129 @subsection NDS32 Options
19130 @cindex NDS32 Options
19131
19132 These options are defined for NDS32 implementations:
19133
19134 @table @gcctabopt
19135
19136 @item -mbig-endian
19137 @opindex mbig-endian
19138 Generate code in big-endian mode.
19139
19140 @item -mlittle-endian
19141 @opindex mlittle-endian
19142 Generate code in little-endian mode.
19143
19144 @item -mreduced-regs
19145 @opindex mreduced-regs
19146 Use reduced-set registers for register allocation.
19147
19148 @item -mfull-regs
19149 @opindex mfull-regs
19150 Use full-set registers for register allocation.
19151
19152 @item -mcmov
19153 @opindex mcmov
19154 Generate conditional move instructions.
19155
19156 @item -mno-cmov
19157 @opindex mno-cmov
19158 Do not generate conditional move instructions.
19159
19160 @item -mperf-ext
19161 @opindex mperf-ext
19162 Generate performance extension instructions.
19163
19164 @item -mno-perf-ext
19165 @opindex mno-perf-ext
19166 Do not generate performance extension instructions.
19167
19168 @item -mv3push
19169 @opindex mv3push
19170 Generate v3 push25/pop25 instructions.
19171
19172 @item -mno-v3push
19173 @opindex mno-v3push
19174 Do not generate v3 push25/pop25 instructions.
19175
19176 @item -m16-bit
19177 @opindex m16-bit
19178 Generate 16-bit instructions.
19179
19180 @item -mno-16-bit
19181 @opindex mno-16-bit
19182 Do not generate 16-bit instructions.
19183
19184 @item -misr-vector-size=@var{num}
19185 @opindex misr-vector-size
19186 Specify the size of each interrupt vector, which must be 4 or 16.
19187
19188 @item -mcache-block-size=@var{num}
19189 @opindex mcache-block-size
19190 Specify the size of each cache block,
19191 which must be a power of 2 between 4 and 512.
19192
19193 @item -march=@var{arch}
19194 @opindex march
19195 Specify the name of the target architecture.
19196
19197 @item -mcmodel=@var{code-model}
19198 @opindex mcmodel
19199 Set the code model to one of
19200 @table @asis
19201 @item @samp{small}
19202 All the data and read-only data segments must be within 512KB addressing space.
19203 The text segment must be within 16MB addressing space.
19204 @item @samp{medium}
19205 The data segment must be within 512KB while the read-only data segment can be
19206 within 4GB addressing space. The text segment should be still within 16MB
19207 addressing space.
19208 @item @samp{large}
19209 All the text and data segments can be within 4GB addressing space.
19210 @end table
19211
19212 @item -mctor-dtor
19213 @opindex mctor-dtor
19214 Enable constructor/destructor feature.
19215
19216 @item -mrelax
19217 @opindex mrelax
19218 Guide linker to relax instructions.
19219
19220 @end table
19221
19222 @node Nios II Options
19223 @subsection Nios II Options
19224 @cindex Nios II options
19225 @cindex Altera Nios II options
19226
19227 These are the options defined for the Altera Nios II processor.
19228
19229 @table @gcctabopt
19230
19231 @item -G @var{num}
19232 @opindex G
19233 @cindex smaller data references
19234 Put global and static objects less than or equal to @var{num} bytes
19235 into the small data or BSS sections instead of the normal data or BSS
19236 sections. The default value of @var{num} is 8.
19237
19238 @item -mgpopt=@var{option}
19239 @item -mgpopt
19240 @itemx -mno-gpopt
19241 @opindex mgpopt
19242 @opindex mno-gpopt
19243 Generate (do not generate) GP-relative accesses. The following
19244 @var{option} names are recognized:
19245
19246 @table @samp
19247
19248 @item none
19249 Do not generate GP-relative accesses.
19250
19251 @item local
19252 Generate GP-relative accesses for small data objects that are not
19253 external, weak, or uninitialized common symbols.
19254 Also use GP-relative addressing for objects that
19255 have been explicitly placed in a small data section via a @code{section}
19256 attribute.
19257
19258 @item global
19259 As for @samp{local}, but also generate GP-relative accesses for
19260 small data objects that are external, weak, or common. If you use this option,
19261 you must ensure that all parts of your program (including libraries) are
19262 compiled with the same @option{-G} setting.
19263
19264 @item data
19265 Generate GP-relative accesses for all data objects in the program. If you
19266 use this option, the entire data and BSS segments
19267 of your program must fit in 64K of memory and you must use an appropriate
19268 linker script to allocate them within the addressable range of the
19269 global pointer.
19270
19271 @item all
19272 Generate GP-relative addresses for function pointers as well as data
19273 pointers. If you use this option, the entire text, data, and BSS segments
19274 of your program must fit in 64K of memory and you must use an appropriate
19275 linker script to allocate them within the addressable range of the
19276 global pointer.
19277
19278 @end table
19279
19280 @option{-mgpopt} is equivalent to @option{-mgpopt=local}, and
19281 @option{-mno-gpopt} is equivalent to @option{-mgpopt=none}.
19282
19283 The default is @option{-mgpopt} except when @option{-fpic} or
19284 @option{-fPIC} is specified to generate position-independent code.
19285 Note that the Nios II ABI does not permit GP-relative accesses from
19286 shared libraries.
19287
19288 You may need to specify @option{-mno-gpopt} explicitly when building
19289 programs that include large amounts of small data, including large
19290 GOT data sections. In this case, the 16-bit offset for GP-relative
19291 addressing may not be large enough to allow access to the entire
19292 small data section.
19293
19294 @item -mel
19295 @itemx -meb
19296 @opindex mel
19297 @opindex meb
19298 Generate little-endian (default) or big-endian (experimental) code,
19299 respectively.
19300
19301 @item -march=@var{arch}
19302 @opindex march
19303 This specifies the name of the target Nios II architecture. GCC uses this
19304 name to determine what kind of instructions it can emit when generating
19305 assembly code. Permissible names are: @samp{r1}, @samp{r2}.
19306
19307 The preprocessor macro @code{__nios2_arch__} is available to programs,
19308 with value 1 or 2, indicating the targeted ISA level.
19309
19310 @item -mbypass-cache
19311 @itemx -mno-bypass-cache
19312 @opindex mno-bypass-cache
19313 @opindex mbypass-cache
19314 Force all load and store instructions to always bypass cache by
19315 using I/O variants of the instructions. The default is not to
19316 bypass the cache.
19317
19318 @item -mno-cache-volatile
19319 @itemx -mcache-volatile
19320 @opindex mcache-volatile
19321 @opindex mno-cache-volatile
19322 Volatile memory access bypass the cache using the I/O variants of
19323 the load and store instructions. The default is not to bypass the cache.
19324
19325 @item -mno-fast-sw-div
19326 @itemx -mfast-sw-div
19327 @opindex mno-fast-sw-div
19328 @opindex mfast-sw-div
19329 Do not use table-based fast divide for small numbers. The default
19330 is to use the fast divide at @option{-O3} and above.
19331
19332 @item -mno-hw-mul
19333 @itemx -mhw-mul
19334 @itemx -mno-hw-mulx
19335 @itemx -mhw-mulx
19336 @itemx -mno-hw-div
19337 @itemx -mhw-div
19338 @opindex mno-hw-mul
19339 @opindex mhw-mul
19340 @opindex mno-hw-mulx
19341 @opindex mhw-mulx
19342 @opindex mno-hw-div
19343 @opindex mhw-div
19344 Enable or disable emitting @code{mul}, @code{mulx} and @code{div} family of
19345 instructions by the compiler. The default is to emit @code{mul}
19346 and not emit @code{div} and @code{mulx}.
19347
19348 @item -mbmx
19349 @itemx -mno-bmx
19350 @itemx -mcdx
19351 @itemx -mno-cdx
19352 Enable or disable generation of Nios II R2 BMX (bit manipulation) and
19353 CDX (code density) instructions. Enabling these instructions also
19354 requires @option{-march=r2}. Since these instructions are optional
19355 extensions to the R2 architecture, the default is not to emit them.
19356
19357 @item -mcustom-@var{insn}=@var{N}
19358 @itemx -mno-custom-@var{insn}
19359 @opindex mcustom-@var{insn}
19360 @opindex mno-custom-@var{insn}
19361 Each @option{-mcustom-@var{insn}=@var{N}} option enables use of a
19362 custom instruction with encoding @var{N} when generating code that uses
19363 @var{insn}. For example, @option{-mcustom-fadds=253} generates custom
19364 instruction 253 for single-precision floating-point add operations instead
19365 of the default behavior of using a library call.
19366
19367 The following values of @var{insn} are supported. Except as otherwise
19368 noted, floating-point operations are expected to be implemented with
19369 normal IEEE 754 semantics and correspond directly to the C operators or the
19370 equivalent GCC built-in functions (@pxref{Other Builtins}).
19371
19372 Single-precision floating point:
19373 @table @asis
19374
19375 @item @samp{fadds}, @samp{fsubs}, @samp{fdivs}, @samp{fmuls}
19376 Binary arithmetic operations.
19377
19378 @item @samp{fnegs}
19379 Unary negation.
19380
19381 @item @samp{fabss}
19382 Unary absolute value.
19383
19384 @item @samp{fcmpeqs}, @samp{fcmpges}, @samp{fcmpgts}, @samp{fcmples}, @samp{fcmplts}, @samp{fcmpnes}
19385 Comparison operations.
19386
19387 @item @samp{fmins}, @samp{fmaxs}
19388 Floating-point minimum and maximum. These instructions are only
19389 generated if @option{-ffinite-math-only} is specified.
19390
19391 @item @samp{fsqrts}
19392 Unary square root operation.
19393
19394 @item @samp{fcoss}, @samp{fsins}, @samp{ftans}, @samp{fatans}, @samp{fexps}, @samp{flogs}
19395 Floating-point trigonometric and exponential functions. These instructions
19396 are only generated if @option{-funsafe-math-optimizations} is also specified.
19397
19398 @end table
19399
19400 Double-precision floating point:
19401 @table @asis
19402
19403 @item @samp{faddd}, @samp{fsubd}, @samp{fdivd}, @samp{fmuld}
19404 Binary arithmetic operations.
19405
19406 @item @samp{fnegd}
19407 Unary negation.
19408
19409 @item @samp{fabsd}
19410 Unary absolute value.
19411
19412 @item @samp{fcmpeqd}, @samp{fcmpged}, @samp{fcmpgtd}, @samp{fcmpled}, @samp{fcmpltd}, @samp{fcmpned}
19413 Comparison operations.
19414
19415 @item @samp{fmind}, @samp{fmaxd}
19416 Double-precision minimum and maximum. These instructions are only
19417 generated if @option{-ffinite-math-only} is specified.
19418
19419 @item @samp{fsqrtd}
19420 Unary square root operation.
19421
19422 @item @samp{fcosd}, @samp{fsind}, @samp{ftand}, @samp{fatand}, @samp{fexpd}, @samp{flogd}
19423 Double-precision trigonometric and exponential functions. These instructions
19424 are only generated if @option{-funsafe-math-optimizations} is also specified.
19425
19426 @end table
19427
19428 Conversions:
19429 @table @asis
19430 @item @samp{fextsd}
19431 Conversion from single precision to double precision.
19432
19433 @item @samp{ftruncds}
19434 Conversion from double precision to single precision.
19435
19436 @item @samp{fixsi}, @samp{fixsu}, @samp{fixdi}, @samp{fixdu}
19437 Conversion from floating point to signed or unsigned integer types, with
19438 truncation towards zero.
19439
19440 @item @samp{round}
19441 Conversion from single-precision floating point to signed integer,
19442 rounding to the nearest integer and ties away from zero.
19443 This corresponds to the @code{__builtin_lroundf} function when
19444 @option{-fno-math-errno} is used.
19445
19446 @item @samp{floatis}, @samp{floatus}, @samp{floatid}, @samp{floatud}
19447 Conversion from signed or unsigned integer types to floating-point types.
19448
19449 @end table
19450
19451 In addition, all of the following transfer instructions for internal
19452 registers X and Y must be provided to use any of the double-precision
19453 floating-point instructions. Custom instructions taking two
19454 double-precision source operands expect the first operand in the
19455 64-bit register X. The other operand (or only operand of a unary
19456 operation) is given to the custom arithmetic instruction with the
19457 least significant half in source register @var{src1} and the most
19458 significant half in @var{src2}. A custom instruction that returns a
19459 double-precision result returns the most significant 32 bits in the
19460 destination register and the other half in 32-bit register Y.
19461 GCC automatically generates the necessary code sequences to write
19462 register X and/or read register Y when double-precision floating-point
19463 instructions are used.
19464
19465 @table @asis
19466
19467 @item @samp{fwrx}
19468 Write @var{src1} into the least significant half of X and @var{src2} into
19469 the most significant half of X.
19470
19471 @item @samp{fwry}
19472 Write @var{src1} into Y.
19473
19474 @item @samp{frdxhi}, @samp{frdxlo}
19475 Read the most or least (respectively) significant half of X and store it in
19476 @var{dest}.
19477
19478 @item @samp{frdy}
19479 Read the value of Y and store it into @var{dest}.
19480 @end table
19481
19482 Note that you can gain more local control over generation of Nios II custom
19483 instructions by using the @code{target("custom-@var{insn}=@var{N}")}
19484 and @code{target("no-custom-@var{insn}")} function attributes
19485 (@pxref{Function Attributes})
19486 or pragmas (@pxref{Function Specific Option Pragmas}).
19487
19488 @item -mcustom-fpu-cfg=@var{name}
19489 @opindex mcustom-fpu-cfg
19490
19491 This option enables a predefined, named set of custom instruction encodings
19492 (see @option{-mcustom-@var{insn}} above).
19493 Currently, the following sets are defined:
19494
19495 @option{-mcustom-fpu-cfg=60-1} is equivalent to:
19496 @gccoptlist{-mcustom-fmuls=252 @gol
19497 -mcustom-fadds=253 @gol
19498 -mcustom-fsubs=254 @gol
19499 -fsingle-precision-constant}
19500
19501 @option{-mcustom-fpu-cfg=60-2} is equivalent to:
19502 @gccoptlist{-mcustom-fmuls=252 @gol
19503 -mcustom-fadds=253 @gol
19504 -mcustom-fsubs=254 @gol
19505 -mcustom-fdivs=255 @gol
19506 -fsingle-precision-constant}
19507
19508 @option{-mcustom-fpu-cfg=72-3} is equivalent to:
19509 @gccoptlist{-mcustom-floatus=243 @gol
19510 -mcustom-fixsi=244 @gol
19511 -mcustom-floatis=245 @gol
19512 -mcustom-fcmpgts=246 @gol
19513 -mcustom-fcmples=249 @gol
19514 -mcustom-fcmpeqs=250 @gol
19515 -mcustom-fcmpnes=251 @gol
19516 -mcustom-fmuls=252 @gol
19517 -mcustom-fadds=253 @gol
19518 -mcustom-fsubs=254 @gol
19519 -mcustom-fdivs=255 @gol
19520 -fsingle-precision-constant}
19521
19522 Custom instruction assignments given by individual
19523 @option{-mcustom-@var{insn}=} options override those given by
19524 @option{-mcustom-fpu-cfg=}, regardless of the
19525 order of the options on the command line.
19526
19527 Note that you can gain more local control over selection of a FPU
19528 configuration by using the @code{target("custom-fpu-cfg=@var{name}")}
19529 function attribute (@pxref{Function Attributes})
19530 or pragma (@pxref{Function Specific Option Pragmas}).
19531
19532 @end table
19533
19534 These additional @samp{-m} options are available for the Altera Nios II
19535 ELF (bare-metal) target:
19536
19537 @table @gcctabopt
19538
19539 @item -mhal
19540 @opindex mhal
19541 Link with HAL BSP. This suppresses linking with the GCC-provided C runtime
19542 startup and termination code, and is typically used in conjunction with
19543 @option{-msys-crt0=} to specify the location of the alternate startup code
19544 provided by the HAL BSP.
19545
19546 @item -msmallc
19547 @opindex msmallc
19548 Link with a limited version of the C library, @option{-lsmallc}, rather than
19549 Newlib.
19550
19551 @item -msys-crt0=@var{startfile}
19552 @opindex msys-crt0
19553 @var{startfile} is the file name of the startfile (crt0) to use
19554 when linking. This option is only useful in conjunction with @option{-mhal}.
19555
19556 @item -msys-lib=@var{systemlib}
19557 @opindex msys-lib
19558 @var{systemlib} is the library name of the library that provides
19559 low-level system calls required by the C library,
19560 e.g. @code{read} and @code{write}.
19561 This option is typically used to link with a library provided by a HAL BSP.
19562
19563 @end table
19564
19565 @node Nvidia PTX Options
19566 @subsection Nvidia PTX Options
19567 @cindex Nvidia PTX options
19568 @cindex nvptx options
19569
19570 These options are defined for Nvidia PTX:
19571
19572 @table @gcctabopt
19573
19574 @item -m32
19575 @itemx -m64
19576 @opindex m32
19577 @opindex m64
19578 Generate code for 32-bit or 64-bit ABI.
19579
19580 @item -mmainkernel
19581 @opindex mmainkernel
19582 Link in code for a __main kernel. This is for stand-alone instead of
19583 offloading execution.
19584
19585 @item -moptimize
19586 @opindex moptimize
19587 Apply partitioned execution optimizations. This is the default when any
19588 level of optimization is selected.
19589
19590 @end table
19591
19592 @node PDP-11 Options
19593 @subsection PDP-11 Options
19594 @cindex PDP-11 Options
19595
19596 These options are defined for the PDP-11:
19597
19598 @table @gcctabopt
19599 @item -mfpu
19600 @opindex mfpu
19601 Use hardware FPP floating point. This is the default. (FIS floating
19602 point on the PDP-11/40 is not supported.)
19603
19604 @item -msoft-float
19605 @opindex msoft-float
19606 Do not use hardware floating point.
19607
19608 @item -mac0
19609 @opindex mac0
19610 Return floating-point results in ac0 (fr0 in Unix assembler syntax).
19611
19612 @item -mno-ac0
19613 @opindex mno-ac0
19614 Return floating-point results in memory. This is the default.
19615
19616 @item -m40
19617 @opindex m40
19618 Generate code for a PDP-11/40.
19619
19620 @item -m45
19621 @opindex m45
19622 Generate code for a PDP-11/45. This is the default.
19623
19624 @item -m10
19625 @opindex m10
19626 Generate code for a PDP-11/10.
19627
19628 @item -mbcopy-builtin
19629 @opindex mbcopy-builtin
19630 Use inline @code{movmemhi} patterns for copying memory. This is the
19631 default.
19632
19633 @item -mbcopy
19634 @opindex mbcopy
19635 Do not use inline @code{movmemhi} patterns for copying memory.
19636
19637 @item -mint16
19638 @itemx -mno-int32
19639 @opindex mint16
19640 @opindex mno-int32
19641 Use 16-bit @code{int}. This is the default.
19642
19643 @item -mint32
19644 @itemx -mno-int16
19645 @opindex mint32
19646 @opindex mno-int16
19647 Use 32-bit @code{int}.
19648
19649 @item -mfloat64
19650 @itemx -mno-float32
19651 @opindex mfloat64
19652 @opindex mno-float32
19653 Use 64-bit @code{float}. This is the default.
19654
19655 @item -mfloat32
19656 @itemx -mno-float64
19657 @opindex mfloat32
19658 @opindex mno-float64
19659 Use 32-bit @code{float}.
19660
19661 @item -mabshi
19662 @opindex mabshi
19663 Use @code{abshi2} pattern. This is the default.
19664
19665 @item -mno-abshi
19666 @opindex mno-abshi
19667 Do not use @code{abshi2} pattern.
19668
19669 @item -mbranch-expensive
19670 @opindex mbranch-expensive
19671 Pretend that branches are expensive. This is for experimenting with
19672 code generation only.
19673
19674 @item -mbranch-cheap
19675 @opindex mbranch-cheap
19676 Do not pretend that branches are expensive. This is the default.
19677
19678 @item -munix-asm
19679 @opindex munix-asm
19680 Use Unix assembler syntax. This is the default when configured for
19681 @samp{pdp11-*-bsd}.
19682
19683 @item -mdec-asm
19684 @opindex mdec-asm
19685 Use DEC assembler syntax. This is the default when configured for any
19686 PDP-11 target other than @samp{pdp11-*-bsd}.
19687 @end table
19688
19689 @node picoChip Options
19690 @subsection picoChip Options
19691 @cindex picoChip options
19692
19693 These @samp{-m} options are defined for picoChip implementations:
19694
19695 @table @gcctabopt
19696
19697 @item -mae=@var{ae_type}
19698 @opindex mcpu
19699 Set the instruction set, register set, and instruction scheduling
19700 parameters for array element type @var{ae_type}. Supported values
19701 for @var{ae_type} are @samp{ANY}, @samp{MUL}, and @samp{MAC}.
19702
19703 @option{-mae=ANY} selects a completely generic AE type. Code
19704 generated with this option runs on any of the other AE types. The
19705 code is not as efficient as it would be if compiled for a specific
19706 AE type, and some types of operation (e.g., multiplication) do not
19707 work properly on all types of AE.
19708
19709 @option{-mae=MUL} selects a MUL AE type. This is the most useful AE type
19710 for compiled code, and is the default.
19711
19712 @option{-mae=MAC} selects a DSP-style MAC AE. Code compiled with this
19713 option may suffer from poor performance of byte (char) manipulation,
19714 since the DSP AE does not provide hardware support for byte load/stores.
19715
19716 @item -msymbol-as-address
19717 Enable the compiler to directly use a symbol name as an address in a
19718 load/store instruction, without first loading it into a
19719 register. Typically, the use of this option generates larger
19720 programs, which run faster than when the option isn't used. However, the
19721 results vary from program to program, so it is left as a user option,
19722 rather than being permanently enabled.
19723
19724 @item -mno-inefficient-warnings
19725 Disables warnings about the generation of inefficient code. These
19726 warnings can be generated, for example, when compiling code that
19727 performs byte-level memory operations on the MAC AE type. The MAC AE has
19728 no hardware support for byte-level memory operations, so all byte
19729 load/stores must be synthesized from word load/store operations. This is
19730 inefficient and a warning is generated to indicate
19731 that you should rewrite the code to avoid byte operations, or to target
19732 an AE type that has the necessary hardware support. This option disables
19733 these warnings.
19734
19735 @end table
19736
19737 @node PowerPC Options
19738 @subsection PowerPC Options
19739 @cindex PowerPC options
19740
19741 These are listed under @xref{RS/6000 and PowerPC Options}.
19742
19743 @node RL78 Options
19744 @subsection RL78 Options
19745 @cindex RL78 Options
19746
19747 @table @gcctabopt
19748
19749 @item -msim
19750 @opindex msim
19751 Links in additional target libraries to support operation within a
19752 simulator.
19753
19754 @item -mmul=none
19755 @itemx -mmul=g10
19756 @itemx -mmul=g13
19757 @itemx -mmul=g14
19758 @itemx -mmul=rl78
19759 @opindex mmul
19760 Specifies the type of hardware multiplication and division support to
19761 be used. The simplest is @code{none}, which uses software for both
19762 multiplication and division. This is the default. The @code{g13}
19763 value is for the hardware multiply/divide peripheral found on the
19764 RL78/G13 (S2 core) targets. The @code{g14} value selects the use of
19765 the multiplication and division instructions supported by the RL78/G14
19766 (S3 core) parts. The value @code{rl78} is an alias for @code{g14} and
19767 the value @code{mg10} is an alias for @code{none}.
19768
19769 In addition a C preprocessor macro is defined, based upon the setting
19770 of this option. Possible values are: @code{__RL78_MUL_NONE__},
19771 @code{__RL78_MUL_G13__} or @code{__RL78_MUL_G14__}.
19772
19773 @item -mcpu=g10
19774 @itemx -mcpu=g13
19775 @itemx -mcpu=g14
19776 @itemx -mcpu=rl78
19777 @opindex mcpu
19778 Specifies the RL78 core to target. The default is the G14 core, also
19779 known as an S3 core or just RL78. The G13 or S2 core does not have
19780 multiply or divide instructions, instead it uses a hardware peripheral
19781 for these operations. The G10 or S1 core does not have register
19782 banks, so it uses a different calling convention.
19783
19784 If this option is set it also selects the type of hardware multiply
19785 support to use, unless this is overridden by an explicit
19786 @option{-mmul=none} option on the command line. Thus specifying
19787 @option{-mcpu=g13} enables the use of the G13 hardware multiply
19788 peripheral and specifying @option{-mcpu=g10} disables the use of
19789 hardware multiplications altogether.
19790
19791 Note, although the RL78/G14 core is the default target, specifying
19792 @option{-mcpu=g14} or @option{-mcpu=rl78} on the command line does
19793 change the behavior of the toolchain since it also enables G14
19794 hardware multiply support. If these options are not specified on the
19795 command line then software multiplication routines will be used even
19796 though the code targets the RL78 core. This is for backwards
19797 compatibility with older toolchains which did not have hardware
19798 multiply and divide support.
19799
19800 In addition a C preprocessor macro is defined, based upon the setting
19801 of this option. Possible values are: @code{__RL78_G10__},
19802 @code{__RL78_G13__} or @code{__RL78_G14__}.
19803
19804 @item -mg10
19805 @itemx -mg13
19806 @itemx -mg14
19807 @itemx -mrl78
19808 @opindex mg10
19809 @opindex mg13
19810 @opindex mg14
19811 @opindex mrl78
19812 These are aliases for the corresponding @option{-mcpu=} option. They
19813 are provided for backwards compatibility.
19814
19815 @item -mallregs
19816 @opindex mallregs
19817 Allow the compiler to use all of the available registers. By default
19818 registers @code{r24..r31} are reserved for use in interrupt handlers.
19819 With this option enabled these registers can be used in ordinary
19820 functions as well.
19821
19822 @item -m64bit-doubles
19823 @itemx -m32bit-doubles
19824 @opindex m64bit-doubles
19825 @opindex m32bit-doubles
19826 Make the @code{double} data type be 64 bits (@option{-m64bit-doubles})
19827 or 32 bits (@option{-m32bit-doubles}) in size. The default is
19828 @option{-m32bit-doubles}.
19829
19830 @item -msave-mduc-in-interrupts
19831 @item -mno-save-mduc-in-interrupts
19832 @opindex msave-mduc-in-interrupts
19833 @opindex mno-save-mduc-in-interrupts
19834 Specifies that interrupt handler functions should preserve the
19835 MDUC registers. This is only necessary if normal code might use
19836 the MDUC registers, for example because it performs multiplication
19837 and division operations. The default is to ignore the MDUC registers
19838 as this makes the interrupt handlers faster. The target option -mg13
19839 needs to be passed for this to work as this feature is only available
19840 on the G13 target (S2 core). The MDUC registers will only be saved
19841 if the interrupt handler performs a multiplication or division
19842 operation or it calls another function.
19843
19844 @end table
19845
19846 @node RS/6000 and PowerPC Options
19847 @subsection IBM RS/6000 and PowerPC Options
19848 @cindex RS/6000 and PowerPC Options
19849 @cindex IBM RS/6000 and PowerPC Options
19850
19851 These @samp{-m} options are defined for the IBM RS/6000 and PowerPC:
19852 @table @gcctabopt
19853 @item -mpowerpc-gpopt
19854 @itemx -mno-powerpc-gpopt
19855 @itemx -mpowerpc-gfxopt
19856 @itemx -mno-powerpc-gfxopt
19857 @need 800
19858 @itemx -mpowerpc64
19859 @itemx -mno-powerpc64
19860 @itemx -mmfcrf
19861 @itemx -mno-mfcrf
19862 @itemx -mpopcntb
19863 @itemx -mno-popcntb
19864 @itemx -mpopcntd
19865 @itemx -mno-popcntd
19866 @itemx -mfprnd
19867 @itemx -mno-fprnd
19868 @need 800
19869 @itemx -mcmpb
19870 @itemx -mno-cmpb
19871 @itemx -mmfpgpr
19872 @itemx -mno-mfpgpr
19873 @itemx -mhard-dfp
19874 @itemx -mno-hard-dfp
19875 @opindex mpowerpc-gpopt
19876 @opindex mno-powerpc-gpopt
19877 @opindex mpowerpc-gfxopt
19878 @opindex mno-powerpc-gfxopt
19879 @opindex mpowerpc64
19880 @opindex mno-powerpc64
19881 @opindex mmfcrf
19882 @opindex mno-mfcrf
19883 @opindex mpopcntb
19884 @opindex mno-popcntb
19885 @opindex mpopcntd
19886 @opindex mno-popcntd
19887 @opindex mfprnd
19888 @opindex mno-fprnd
19889 @opindex mcmpb
19890 @opindex mno-cmpb
19891 @opindex mmfpgpr
19892 @opindex mno-mfpgpr
19893 @opindex mhard-dfp
19894 @opindex mno-hard-dfp
19895 You use these options to specify which instructions are available on the
19896 processor you are using. The default value of these options is
19897 determined when configuring GCC@. Specifying the
19898 @option{-mcpu=@var{cpu_type}} overrides the specification of these
19899 options. We recommend you use the @option{-mcpu=@var{cpu_type}} option
19900 rather than the options listed above.
19901
19902 Specifying @option{-mpowerpc-gpopt} allows
19903 GCC to use the optional PowerPC architecture instructions in the
19904 General Purpose group, including floating-point square root. Specifying
19905 @option{-mpowerpc-gfxopt} allows GCC to
19906 use the optional PowerPC architecture instructions in the Graphics
19907 group, including floating-point select.
19908
19909 The @option{-mmfcrf} option allows GCC to generate the move from
19910 condition register field instruction implemented on the POWER4
19911 processor and other processors that support the PowerPC V2.01
19912 architecture.
19913 The @option{-mpopcntb} option allows GCC to generate the popcount and
19914 double-precision FP reciprocal estimate instruction implemented on the
19915 POWER5 processor and other processors that support the PowerPC V2.02
19916 architecture.
19917 The @option{-mpopcntd} option allows GCC to generate the popcount
19918 instruction implemented on the POWER7 processor and other processors
19919 that support the PowerPC V2.06 architecture.
19920 The @option{-mfprnd} option allows GCC to generate the FP round to
19921 integer instructions implemented on the POWER5+ processor and other
19922 processors that support the PowerPC V2.03 architecture.
19923 The @option{-mcmpb} option allows GCC to generate the compare bytes
19924 instruction implemented on the POWER6 processor and other processors
19925 that support the PowerPC V2.05 architecture.
19926 The @option{-mmfpgpr} option allows GCC to generate the FP move to/from
19927 general-purpose register instructions implemented on the POWER6X
19928 processor and other processors that support the extended PowerPC V2.05
19929 architecture.
19930 The @option{-mhard-dfp} option allows GCC to generate the decimal
19931 floating-point instructions implemented on some POWER processors.
19932
19933 The @option{-mpowerpc64} option allows GCC to generate the additional
19934 64-bit instructions that are found in the full PowerPC64 architecture
19935 and to treat GPRs as 64-bit, doubleword quantities. GCC defaults to
19936 @option{-mno-powerpc64}.
19937
19938 @item -mcpu=@var{cpu_type}
19939 @opindex mcpu
19940 Set architecture type, register usage, and
19941 instruction scheduling parameters for machine type @var{cpu_type}.
19942 Supported values for @var{cpu_type} are @samp{401}, @samp{403},
19943 @samp{405}, @samp{405fp}, @samp{440}, @samp{440fp}, @samp{464}, @samp{464fp},
19944 @samp{476}, @samp{476fp}, @samp{505}, @samp{601}, @samp{602}, @samp{603},
19945 @samp{603e}, @samp{604}, @samp{604e}, @samp{620}, @samp{630}, @samp{740},
19946 @samp{7400}, @samp{7450}, @samp{750}, @samp{801}, @samp{821}, @samp{823},
19947 @samp{860}, @samp{970}, @samp{8540}, @samp{a2}, @samp{e300c2},
19948 @samp{e300c3}, @samp{e500mc}, @samp{e500mc64}, @samp{e5500},
19949 @samp{e6500}, @samp{ec603e}, @samp{G3}, @samp{G4}, @samp{G5},
19950 @samp{titan}, @samp{power3}, @samp{power4}, @samp{power5}, @samp{power5+},
19951 @samp{power6}, @samp{power6x}, @samp{power7}, @samp{power8},
19952 @samp{power9}, @samp{powerpc}, @samp{powerpc64}, @samp{powerpc64le},
19953 and @samp{rs64}.
19954
19955 @option{-mcpu=powerpc}, @option{-mcpu=powerpc64}, and
19956 @option{-mcpu=powerpc64le} specify pure 32-bit PowerPC (either
19957 endian), 64-bit big endian PowerPC and 64-bit little endian PowerPC
19958 architecture machine types, with an appropriate, generic processor
19959 model assumed for scheduling purposes.
19960
19961 The other options specify a specific processor. Code generated under
19962 those options runs best on that processor, and may not run at all on
19963 others.
19964
19965 The @option{-mcpu} options automatically enable or disable the
19966 following options:
19967
19968 @gccoptlist{-maltivec -mfprnd -mhard-float -mmfcrf -mmultiple @gol
19969 -mpopcntb -mpopcntd -mpowerpc64 @gol
19970 -mpowerpc-gpopt -mpowerpc-gfxopt -msingle-float -mdouble-float @gol
19971 -msimple-fpu -mstring -mmulhw -mdlmzb -mmfpgpr -mvsx @gol
19972 -mcrypto -mdirect-move -mpower8-fusion -mpower8-vector @gol
19973 -mquad-memory -mquad-memory-atomic -mmodulo -mfloat128 -mfloat128-hardware @gol
19974 -mpower9-fusion -mpower9-vector -mpower9-dform}
19975
19976 The particular options set for any particular CPU varies between
19977 compiler versions, depending on what setting seems to produce optimal
19978 code for that CPU; it doesn't necessarily reflect the actual hardware's
19979 capabilities. If you wish to set an individual option to a particular
19980 value, you may specify it after the @option{-mcpu} option, like
19981 @option{-mcpu=970 -mno-altivec}.
19982
19983 On AIX, the @option{-maltivec} and @option{-mpowerpc64} options are
19984 not enabled or disabled by the @option{-mcpu} option at present because
19985 AIX does not have full support for these options. You may still
19986 enable or disable them individually if you're sure it'll work in your
19987 environment.
19988
19989 @item -mtune=@var{cpu_type}
19990 @opindex mtune
19991 Set the instruction scheduling parameters for machine type
19992 @var{cpu_type}, but do not set the architecture type or register usage,
19993 as @option{-mcpu=@var{cpu_type}} does. The same
19994 values for @var{cpu_type} are used for @option{-mtune} as for
19995 @option{-mcpu}. If both are specified, the code generated uses the
19996 architecture and registers set by @option{-mcpu}, but the
19997 scheduling parameters set by @option{-mtune}.
19998
19999 @item -mcmodel=small
20000 @opindex mcmodel=small
20001 Generate PowerPC64 code for the small model: The TOC is limited to
20002 64k.
20003
20004 @item -mcmodel=medium
20005 @opindex mcmodel=medium
20006 Generate PowerPC64 code for the medium model: The TOC and other static
20007 data may be up to a total of 4G in size.
20008
20009 @item -mcmodel=large
20010 @opindex mcmodel=large
20011 Generate PowerPC64 code for the large model: The TOC may be up to 4G
20012 in size. Other data and code is only limited by the 64-bit address
20013 space.
20014
20015 @item -maltivec
20016 @itemx -mno-altivec
20017 @opindex maltivec
20018 @opindex mno-altivec
20019 Generate code that uses (does not use) AltiVec instructions, and also
20020 enable the use of built-in functions that allow more direct access to
20021 the AltiVec instruction set. You may also need to set
20022 @option{-mabi=altivec} to adjust the current ABI with AltiVec ABI
20023 enhancements.
20024
20025 When @option{-maltivec} is used, rather than @option{-maltivec=le} or
20026 @option{-maltivec=be}, the element order for AltiVec intrinsics such
20027 as @code{vec_splat}, @code{vec_extract}, and @code{vec_insert}
20028 match array element order corresponding to the endianness of the
20029 target. That is, element zero identifies the leftmost element in a
20030 vector register when targeting a big-endian platform, and identifies
20031 the rightmost element in a vector register when targeting a
20032 little-endian platform.
20033
20034 @item -maltivec=be
20035 @opindex maltivec=be
20036 Generate AltiVec instructions using big-endian element order,
20037 regardless of whether the target is big- or little-endian. This is
20038 the default when targeting a big-endian platform.
20039
20040 The element order is used to interpret element numbers in AltiVec
20041 intrinsics such as @code{vec_splat}, @code{vec_extract}, and
20042 @code{vec_insert}. By default, these match array element order
20043 corresponding to the endianness for the target.
20044
20045 @item -maltivec=le
20046 @opindex maltivec=le
20047 Generate AltiVec instructions using little-endian element order,
20048 regardless of whether the target is big- or little-endian. This is
20049 the default when targeting a little-endian platform. This option is
20050 currently ignored when targeting a big-endian platform.
20051
20052 The element order is used to interpret element numbers in AltiVec
20053 intrinsics such as @code{vec_splat}, @code{vec_extract}, and
20054 @code{vec_insert}. By default, these match array element order
20055 corresponding to the endianness for the target.
20056
20057 @item -mvrsave
20058 @itemx -mno-vrsave
20059 @opindex mvrsave
20060 @opindex mno-vrsave
20061 Generate VRSAVE instructions when generating AltiVec code.
20062
20063 @item -mgen-cell-microcode
20064 @opindex mgen-cell-microcode
20065 Generate Cell microcode instructions.
20066
20067 @item -mwarn-cell-microcode
20068 @opindex mwarn-cell-microcode
20069 Warn when a Cell microcode instruction is emitted. An example
20070 of a Cell microcode instruction is a variable shift.
20071
20072 @item -msecure-plt
20073 @opindex msecure-plt
20074 Generate code that allows @command{ld} and @command{ld.so}
20075 to build executables and shared
20076 libraries with non-executable @code{.plt} and @code{.got} sections.
20077 This is a PowerPC
20078 32-bit SYSV ABI option.
20079
20080 @item -mbss-plt
20081 @opindex mbss-plt
20082 Generate code that uses a BSS @code{.plt} section that @command{ld.so}
20083 fills in, and
20084 requires @code{.plt} and @code{.got}
20085 sections that are both writable and executable.
20086 This is a PowerPC 32-bit SYSV ABI option.
20087
20088 @item -misel
20089 @itemx -mno-isel
20090 @opindex misel
20091 @opindex mno-isel
20092 This switch enables or disables the generation of ISEL instructions.
20093
20094 @item -misel=@var{yes/no}
20095 This switch has been deprecated. Use @option{-misel} and
20096 @option{-mno-isel} instead.
20097
20098 @item -mlra
20099 @opindex mlra
20100 Enable Local Register Allocation. This is still experimental for PowerPC,
20101 so by default the compiler uses standard reload
20102 (i.e. @option{-mno-lra}).
20103
20104 @item -mspe
20105 @itemx -mno-spe
20106 @opindex mspe
20107 @opindex mno-spe
20108 This switch enables or disables the generation of SPE simd
20109 instructions.
20110
20111 @item -mpaired
20112 @itemx -mno-paired
20113 @opindex mpaired
20114 @opindex mno-paired
20115 This switch enables or disables the generation of PAIRED simd
20116 instructions.
20117
20118 @item -mspe=@var{yes/no}
20119 This option has been deprecated. Use @option{-mspe} and
20120 @option{-mno-spe} instead.
20121
20122 @item -mvsx
20123 @itemx -mno-vsx
20124 @opindex mvsx
20125 @opindex mno-vsx
20126 Generate code that uses (does not use) vector/scalar (VSX)
20127 instructions, and also enable the use of built-in functions that allow
20128 more direct access to the VSX instruction set.
20129
20130 @item -mcrypto
20131 @itemx -mno-crypto
20132 @opindex mcrypto
20133 @opindex mno-crypto
20134 Enable the use (disable) of the built-in functions that allow direct
20135 access to the cryptographic instructions that were added in version
20136 2.07 of the PowerPC ISA.
20137
20138 @item -mdirect-move
20139 @itemx -mno-direct-move
20140 @opindex mdirect-move
20141 @opindex mno-direct-move
20142 Generate code that uses (does not use) the instructions to move data
20143 between the general purpose registers and the vector/scalar (VSX)
20144 registers that were added in version 2.07 of the PowerPC ISA.
20145
20146 @item -mpower8-fusion
20147 @itemx -mno-power8-fusion
20148 @opindex mpower8-fusion
20149 @opindex mno-power8-fusion
20150 Generate code that keeps (does not keeps) some integer operations
20151 adjacent so that the instructions can be fused together on power8 and
20152 later processors.
20153
20154 @item -mpower8-vector
20155 @itemx -mno-power8-vector
20156 @opindex mpower8-vector
20157 @opindex mno-power8-vector
20158 Generate code that uses (does not use) the vector and scalar
20159 instructions that were added in version 2.07 of the PowerPC ISA. Also
20160 enable the use of built-in functions that allow more direct access to
20161 the vector instructions.
20162
20163 @item -mquad-memory
20164 @itemx -mno-quad-memory
20165 @opindex mquad-memory
20166 @opindex mno-quad-memory
20167 Generate code that uses (does not use) the non-atomic quad word memory
20168 instructions. The @option{-mquad-memory} option requires use of
20169 64-bit mode.
20170
20171 @item -mquad-memory-atomic
20172 @itemx -mno-quad-memory-atomic
20173 @opindex mquad-memory-atomic
20174 @opindex mno-quad-memory-atomic
20175 Generate code that uses (does not use) the atomic quad word memory
20176 instructions. The @option{-mquad-memory-atomic} option requires use of
20177 64-bit mode.
20178
20179 @item -mupper-regs-df
20180 @itemx -mno-upper-regs-df
20181 @opindex mupper-regs-df
20182 @opindex mno-upper-regs-df
20183 Generate code that uses (does not use) the scalar double precision
20184 instructions that target all 64 registers in the vector/scalar
20185 floating point register set that were added in version 2.06 of the
20186 PowerPC ISA. @option{-mupper-regs-df} is turned on by default if you
20187 use any of the @option{-mcpu=power7}, @option{-mcpu=power8}, or
20188 @option{-mvsx} options.
20189
20190 @item -mupper-regs-sf
20191 @itemx -mno-upper-regs-sf
20192 @opindex mupper-regs-sf
20193 @opindex mno-upper-regs-sf
20194 Generate code that uses (does not use) the scalar single precision
20195 instructions that target all 64 registers in the vector/scalar
20196 floating point register set that were added in version 2.07 of the
20197 PowerPC ISA. @option{-mupper-regs-sf} is turned on by default if you
20198 use either of the @option{-mcpu=power8} or @option{-mpower8-vector}
20199 options.
20200
20201 @item -mupper-regs
20202 @itemx -mno-upper-regs
20203 @opindex mupper-regs
20204 @opindex mno-upper-regs
20205 Generate code that uses (does not use) the scalar
20206 instructions that target all 64 registers in the vector/scalar
20207 floating point register set, depending on the model of the machine.
20208
20209 If the @option{-mno-upper-regs} option is used, it turns off both
20210 @option{-mupper-regs-sf} and @option{-mupper-regs-df} options.
20211
20212 @item -mfloat128
20213 @itemx -mno-float128
20214 @opindex mfloat128
20215 @opindex mno-float128
20216 Enable/disable the @var{__float128} keyword for IEEE 128-bit floating point
20217 and use either software emulation for IEEE 128-bit floating point or
20218 hardware instructions.
20219
20220 The VSX instruction set (@option{-mvsx}, @option{-mcpu=power7}, or
20221 @option{-mcpu=power8}) must be enabled to use the @option{-mfloat128}
20222 option. The @code{-mfloat128} option only works on PowerPC 64-bit
20223 Linux systems.
20224
20225 @item -mfloat128-hardware
20226 @itemx -mno-float128-hardware
20227 @opindex mfloat128-hardware
20228 @opindex mno-float128-hardware
20229 Enable/disable using ISA 3.0 hardware instructions to support the
20230 @var{__float128} data type.
20231
20232 @item -mmodulo
20233 @itemx -mno-modulo
20234 @opindex mmodulo
20235 @opindex mno-module
20236 Generate code that uses (does not use) the ISA 3.0 integer modulo
20237 instructions. The @option{-mmodulo} option is enabled by default
20238 with the @option{-mcpu=power9} option.
20239
20240 @item -mpower9-fusion
20241 @itemx -mno-power9-fusion
20242 @opindex mpower9-fusion
20243 @opindex mno-power9-fusion
20244 Generate code that keeps (does not keeps) some operations adjacent so
20245 that the instructions can be fused together on power9 and later
20246 processors.
20247
20248 @item -mpower9-vector
20249 @itemx -mno-power9-vector
20250 @opindex mpower9-vector
20251 @opindex mno-power9-vector
20252 Generate code that uses (does not use) the vector and scalar
20253 instructions that were added in version 3.0 of the PowerPC ISA. Also
20254 enable the use of built-in functions that allow more direct access to
20255 the vector instructions.
20256
20257 @item -mpower9-dform
20258 @itemx -mno-power9-dform
20259 @opindex mpower9-dform
20260 @opindex mno-power9-dform
20261 Enable (disable) scalar d-form (register + offset) memory instructions
20262 to load/store traditional Altivec registers. If the @var{LRA} register
20263 allocator is enabled, also enable (disable) vector d-form memory
20264 instructions.
20265
20266 @item -mfloat-gprs=@var{yes/single/double/no}
20267 @itemx -mfloat-gprs
20268 @opindex mfloat-gprs
20269 This switch enables or disables the generation of floating-point
20270 operations on the general-purpose registers for architectures that
20271 support it.
20272
20273 The argument @samp{yes} or @samp{single} enables the use of
20274 single-precision floating-point operations.
20275
20276 The argument @samp{double} enables the use of single and
20277 double-precision floating-point operations.
20278
20279 The argument @samp{no} disables floating-point operations on the
20280 general-purpose registers.
20281
20282 This option is currently only available on the MPC854x.
20283
20284 @item -m32
20285 @itemx -m64
20286 @opindex m32
20287 @opindex m64
20288 Generate code for 32-bit or 64-bit environments of Darwin and SVR4
20289 targets (including GNU/Linux). The 32-bit environment sets int, long
20290 and pointer to 32 bits and generates code that runs on any PowerPC
20291 variant. The 64-bit environment sets int to 32 bits and long and
20292 pointer to 64 bits, and generates code for PowerPC64, as for
20293 @option{-mpowerpc64}.
20294
20295 @item -mfull-toc
20296 @itemx -mno-fp-in-toc
20297 @itemx -mno-sum-in-toc
20298 @itemx -mminimal-toc
20299 @opindex mfull-toc
20300 @opindex mno-fp-in-toc
20301 @opindex mno-sum-in-toc
20302 @opindex mminimal-toc
20303 Modify generation of the TOC (Table Of Contents), which is created for
20304 every executable file. The @option{-mfull-toc} option is selected by
20305 default. In that case, GCC allocates at least one TOC entry for
20306 each unique non-automatic variable reference in your program. GCC
20307 also places floating-point constants in the TOC@. However, only
20308 16,384 entries are available in the TOC@.
20309
20310 If you receive a linker error message that saying you have overflowed
20311 the available TOC space, you can reduce the amount of TOC space used
20312 with the @option{-mno-fp-in-toc} and @option{-mno-sum-in-toc} options.
20313 @option{-mno-fp-in-toc} prevents GCC from putting floating-point
20314 constants in the TOC and @option{-mno-sum-in-toc} forces GCC to
20315 generate code to calculate the sum of an address and a constant at
20316 run time instead of putting that sum into the TOC@. You may specify one
20317 or both of these options. Each causes GCC to produce very slightly
20318 slower and larger code at the expense of conserving TOC space.
20319
20320 If you still run out of space in the TOC even when you specify both of
20321 these options, specify @option{-mminimal-toc} instead. This option causes
20322 GCC to make only one TOC entry for every file. When you specify this
20323 option, GCC produces code that is slower and larger but which
20324 uses extremely little TOC space. You may wish to use this option
20325 only on files that contain less frequently-executed code.
20326
20327 @item -maix64
20328 @itemx -maix32
20329 @opindex maix64
20330 @opindex maix32
20331 Enable 64-bit AIX ABI and calling convention: 64-bit pointers, 64-bit
20332 @code{long} type, and the infrastructure needed to support them.
20333 Specifying @option{-maix64} implies @option{-mpowerpc64},
20334 while @option{-maix32} disables the 64-bit ABI and
20335 implies @option{-mno-powerpc64}. GCC defaults to @option{-maix32}.
20336
20337 @item -mxl-compat
20338 @itemx -mno-xl-compat
20339 @opindex mxl-compat
20340 @opindex mno-xl-compat
20341 Produce code that conforms more closely to IBM XL compiler semantics
20342 when using AIX-compatible ABI@. Pass floating-point arguments to
20343 prototyped functions beyond the register save area (RSA) on the stack
20344 in addition to argument FPRs. Do not assume that most significant
20345 double in 128-bit long double value is properly rounded when comparing
20346 values and converting to double. Use XL symbol names for long double
20347 support routines.
20348
20349 The AIX calling convention was extended but not initially documented to
20350 handle an obscure K&R C case of calling a function that takes the
20351 address of its arguments with fewer arguments than declared. IBM XL
20352 compilers access floating-point arguments that do not fit in the
20353 RSA from the stack when a subroutine is compiled without
20354 optimization. Because always storing floating-point arguments on the
20355 stack is inefficient and rarely needed, this option is not enabled by
20356 default and only is necessary when calling subroutines compiled by IBM
20357 XL compilers without optimization.
20358
20359 @item -mpe
20360 @opindex mpe
20361 Support @dfn{IBM RS/6000 SP} @dfn{Parallel Environment} (PE)@. Link an
20362 application written to use message passing with special startup code to
20363 enable the application to run. The system must have PE installed in the
20364 standard location (@file{/usr/lpp/ppe.poe/}), or the @file{specs} file
20365 must be overridden with the @option{-specs=} option to specify the
20366 appropriate directory location. The Parallel Environment does not
20367 support threads, so the @option{-mpe} option and the @option{-pthread}
20368 option are incompatible.
20369
20370 @item -malign-natural
20371 @itemx -malign-power
20372 @opindex malign-natural
20373 @opindex malign-power
20374 On AIX, 32-bit Darwin, and 64-bit PowerPC GNU/Linux, the option
20375 @option{-malign-natural} overrides the ABI-defined alignment of larger
20376 types, such as floating-point doubles, on their natural size-based boundary.
20377 The option @option{-malign-power} instructs GCC to follow the ABI-specified
20378 alignment rules. GCC defaults to the standard alignment defined in the ABI@.
20379
20380 On 64-bit Darwin, natural alignment is the default, and @option{-malign-power}
20381 is not supported.
20382
20383 @item -msoft-float
20384 @itemx -mhard-float
20385 @opindex msoft-float
20386 @opindex mhard-float
20387 Generate code that does not use (uses) the floating-point register set.
20388 Software floating-point emulation is provided if you use the
20389 @option{-msoft-float} option, and pass the option to GCC when linking.
20390
20391 @item -msingle-float
20392 @itemx -mdouble-float
20393 @opindex msingle-float
20394 @opindex mdouble-float
20395 Generate code for single- or double-precision floating-point operations.
20396 @option{-mdouble-float} implies @option{-msingle-float}.
20397
20398 @item -msimple-fpu
20399 @opindex msimple-fpu
20400 Do not generate @code{sqrt} and @code{div} instructions for hardware
20401 floating-point unit.
20402
20403 @item -mfpu=@var{name}
20404 @opindex mfpu
20405 Specify type of floating-point unit. Valid values for @var{name} are
20406 @samp{sp_lite} (equivalent to @option{-msingle-float -msimple-fpu}),
20407 @samp{dp_lite} (equivalent to @option{-mdouble-float -msimple-fpu}),
20408 @samp{sp_full} (equivalent to @option{-msingle-float}),
20409 and @samp{dp_full} (equivalent to @option{-mdouble-float}).
20410
20411 @item -mxilinx-fpu
20412 @opindex mxilinx-fpu
20413 Perform optimizations for the floating-point unit on Xilinx PPC 405/440.
20414
20415 @item -mmultiple
20416 @itemx -mno-multiple
20417 @opindex mmultiple
20418 @opindex mno-multiple
20419 Generate code that uses (does not use) the load multiple word
20420 instructions and the store multiple word instructions. These
20421 instructions are generated by default on POWER systems, and not
20422 generated on PowerPC systems. Do not use @option{-mmultiple} on little-endian
20423 PowerPC systems, since those instructions do not work when the
20424 processor is in little-endian mode. The exceptions are PPC740 and
20425 PPC750 which permit these instructions in little-endian mode.
20426
20427 @item -mstring
20428 @itemx -mno-string
20429 @opindex mstring
20430 @opindex mno-string
20431 Generate code that uses (does not use) the load string instructions
20432 and the store string word instructions to save multiple registers and
20433 do small block moves. These instructions are generated by default on
20434 POWER systems, and not generated on PowerPC systems. Do not use
20435 @option{-mstring} on little-endian PowerPC systems, since those
20436 instructions do not work when the processor is in little-endian mode.
20437 The exceptions are PPC740 and PPC750 which permit these instructions
20438 in little-endian mode.
20439
20440 @item -mupdate
20441 @itemx -mno-update
20442 @opindex mupdate
20443 @opindex mno-update
20444 Generate code that uses (does not use) the load or store instructions
20445 that update the base register to the address of the calculated memory
20446 location. These instructions are generated by default. If you use
20447 @option{-mno-update}, there is a small window between the time that the
20448 stack pointer is updated and the address of the previous frame is
20449 stored, which means code that walks the stack frame across interrupts or
20450 signals may get corrupted data.
20451
20452 @item -mavoid-indexed-addresses
20453 @itemx -mno-avoid-indexed-addresses
20454 @opindex mavoid-indexed-addresses
20455 @opindex mno-avoid-indexed-addresses
20456 Generate code that tries to avoid (not avoid) the use of indexed load
20457 or store instructions. These instructions can incur a performance
20458 penalty on Power6 processors in certain situations, such as when
20459 stepping through large arrays that cross a 16M boundary. This option
20460 is enabled by default when targeting Power6 and disabled otherwise.
20461
20462 @item -mfused-madd
20463 @itemx -mno-fused-madd
20464 @opindex mfused-madd
20465 @opindex mno-fused-madd
20466 Generate code that uses (does not use) the floating-point multiply and
20467 accumulate instructions. These instructions are generated by default
20468 if hardware floating point is used. The machine-dependent
20469 @option{-mfused-madd} option is now mapped to the machine-independent
20470 @option{-ffp-contract=fast} option, and @option{-mno-fused-madd} is
20471 mapped to @option{-ffp-contract=off}.
20472
20473 @item -mmulhw
20474 @itemx -mno-mulhw
20475 @opindex mmulhw
20476 @opindex mno-mulhw
20477 Generate code that uses (does not use) the half-word multiply and
20478 multiply-accumulate instructions on the IBM 405, 440, 464 and 476 processors.
20479 These instructions are generated by default when targeting those
20480 processors.
20481
20482 @item -mdlmzb
20483 @itemx -mno-dlmzb
20484 @opindex mdlmzb
20485 @opindex mno-dlmzb
20486 Generate code that uses (does not use) the string-search @samp{dlmzb}
20487 instruction on the IBM 405, 440, 464 and 476 processors. This instruction is
20488 generated by default when targeting those processors.
20489
20490 @item -mno-bit-align
20491 @itemx -mbit-align
20492 @opindex mno-bit-align
20493 @opindex mbit-align
20494 On System V.4 and embedded PowerPC systems do not (do) force structures
20495 and unions that contain bit-fields to be aligned to the base type of the
20496 bit-field.
20497
20498 For example, by default a structure containing nothing but 8
20499 @code{unsigned} bit-fields of length 1 is aligned to a 4-byte
20500 boundary and has a size of 4 bytes. By using @option{-mno-bit-align},
20501 the structure is aligned to a 1-byte boundary and is 1 byte in
20502 size.
20503
20504 @item -mno-strict-align
20505 @itemx -mstrict-align
20506 @opindex mno-strict-align
20507 @opindex mstrict-align
20508 On System V.4 and embedded PowerPC systems do not (do) assume that
20509 unaligned memory references are handled by the system.
20510
20511 @item -mrelocatable
20512 @itemx -mno-relocatable
20513 @opindex mrelocatable
20514 @opindex mno-relocatable
20515 Generate code that allows (does not allow) a static executable to be
20516 relocated to a different address at run time. A simple embedded
20517 PowerPC system loader should relocate the entire contents of
20518 @code{.got2} and 4-byte locations listed in the @code{.fixup} section,
20519 a table of 32-bit addresses generated by this option. For this to
20520 work, all objects linked together must be compiled with
20521 @option{-mrelocatable} or @option{-mrelocatable-lib}.
20522 @option{-mrelocatable} code aligns the stack to an 8-byte boundary.
20523
20524 @item -mrelocatable-lib
20525 @itemx -mno-relocatable-lib
20526 @opindex mrelocatable-lib
20527 @opindex mno-relocatable-lib
20528 Like @option{-mrelocatable}, @option{-mrelocatable-lib} generates a
20529 @code{.fixup} section to allow static executables to be relocated at
20530 run time, but @option{-mrelocatable-lib} does not use the smaller stack
20531 alignment of @option{-mrelocatable}. Objects compiled with
20532 @option{-mrelocatable-lib} may be linked with objects compiled with
20533 any combination of the @option{-mrelocatable} options.
20534
20535 @item -mno-toc
20536 @itemx -mtoc
20537 @opindex mno-toc
20538 @opindex mtoc
20539 On System V.4 and embedded PowerPC systems do not (do) assume that
20540 register 2 contains a pointer to a global area pointing to the addresses
20541 used in the program.
20542
20543 @item -mlittle
20544 @itemx -mlittle-endian
20545 @opindex mlittle
20546 @opindex mlittle-endian
20547 On System V.4 and embedded PowerPC systems compile code for the
20548 processor in little-endian mode. The @option{-mlittle-endian} option is
20549 the same as @option{-mlittle}.
20550
20551 @item -mbig
20552 @itemx -mbig-endian
20553 @opindex mbig
20554 @opindex mbig-endian
20555 On System V.4 and embedded PowerPC systems compile code for the
20556 processor in big-endian mode. The @option{-mbig-endian} option is
20557 the same as @option{-mbig}.
20558
20559 @item -mdynamic-no-pic
20560 @opindex mdynamic-no-pic
20561 On Darwin and Mac OS X systems, compile code so that it is not
20562 relocatable, but that its external references are relocatable. The
20563 resulting code is suitable for applications, but not shared
20564 libraries.
20565
20566 @item -msingle-pic-base
20567 @opindex msingle-pic-base
20568 Treat the register used for PIC addressing as read-only, rather than
20569 loading it in the prologue for each function. The runtime system is
20570 responsible for initializing this register with an appropriate value
20571 before execution begins.
20572
20573 @item -mprioritize-restricted-insns=@var{priority}
20574 @opindex mprioritize-restricted-insns
20575 This option controls the priority that is assigned to
20576 dispatch-slot restricted instructions during the second scheduling
20577 pass. The argument @var{priority} takes the value @samp{0}, @samp{1},
20578 or @samp{2} to assign no, highest, or second-highest (respectively)
20579 priority to dispatch-slot restricted
20580 instructions.
20581
20582 @item -msched-costly-dep=@var{dependence_type}
20583 @opindex msched-costly-dep
20584 This option controls which dependences are considered costly
20585 by the target during instruction scheduling. The argument
20586 @var{dependence_type} takes one of the following values:
20587
20588 @table @asis
20589 @item @samp{no}
20590 No dependence is costly.
20591
20592 @item @samp{all}
20593 All dependences are costly.
20594
20595 @item @samp{true_store_to_load}
20596 A true dependence from store to load is costly.
20597
20598 @item @samp{store_to_load}
20599 Any dependence from store to load is costly.
20600
20601 @item @var{number}
20602 Any dependence for which the latency is greater than or equal to
20603 @var{number} is costly.
20604 @end table
20605
20606 @item -minsert-sched-nops=@var{scheme}
20607 @opindex minsert-sched-nops
20608 This option controls which NOP insertion scheme is used during
20609 the second scheduling pass. The argument @var{scheme} takes one of the
20610 following values:
20611
20612 @table @asis
20613 @item @samp{no}
20614 Don't insert NOPs.
20615
20616 @item @samp{pad}
20617 Pad with NOPs any dispatch group that has vacant issue slots,
20618 according to the scheduler's grouping.
20619
20620 @item @samp{regroup_exact}
20621 Insert NOPs to force costly dependent insns into
20622 separate groups. Insert exactly as many NOPs as needed to force an insn
20623 to a new group, according to the estimated processor grouping.
20624
20625 @item @var{number}
20626 Insert NOPs to force costly dependent insns into
20627 separate groups. Insert @var{number} NOPs to force an insn to a new group.
20628 @end table
20629
20630 @item -mcall-sysv
20631 @opindex mcall-sysv
20632 On System V.4 and embedded PowerPC systems compile code using calling
20633 conventions that adhere to the March 1995 draft of the System V
20634 Application Binary Interface, PowerPC processor supplement. This is the
20635 default unless you configured GCC using @samp{powerpc-*-eabiaix}.
20636
20637 @item -mcall-sysv-eabi
20638 @itemx -mcall-eabi
20639 @opindex mcall-sysv-eabi
20640 @opindex mcall-eabi
20641 Specify both @option{-mcall-sysv} and @option{-meabi} options.
20642
20643 @item -mcall-sysv-noeabi
20644 @opindex mcall-sysv-noeabi
20645 Specify both @option{-mcall-sysv} and @option{-mno-eabi} options.
20646
20647 @item -mcall-aixdesc
20648 @opindex m
20649 On System V.4 and embedded PowerPC systems compile code for the AIX
20650 operating system.
20651
20652 @item -mcall-linux
20653 @opindex mcall-linux
20654 On System V.4 and embedded PowerPC systems compile code for the
20655 Linux-based GNU system.
20656
20657 @item -mcall-freebsd
20658 @opindex mcall-freebsd
20659 On System V.4 and embedded PowerPC systems compile code for the
20660 FreeBSD operating system.
20661
20662 @item -mcall-netbsd
20663 @opindex mcall-netbsd
20664 On System V.4 and embedded PowerPC systems compile code for the
20665 NetBSD operating system.
20666
20667 @item -mcall-openbsd
20668 @opindex mcall-netbsd
20669 On System V.4 and embedded PowerPC systems compile code for the
20670 OpenBSD operating system.
20671
20672 @item -maix-struct-return
20673 @opindex maix-struct-return
20674 Return all structures in memory (as specified by the AIX ABI)@.
20675
20676 @item -msvr4-struct-return
20677 @opindex msvr4-struct-return
20678 Return structures smaller than 8 bytes in registers (as specified by the
20679 SVR4 ABI)@.
20680
20681 @item -mabi=@var{abi-type}
20682 @opindex mabi
20683 Extend the current ABI with a particular extension, or remove such extension.
20684 Valid values are @samp{altivec}, @samp{no-altivec}, @samp{spe},
20685 @samp{no-spe}, @samp{ibmlongdouble}, @samp{ieeelongdouble},
20686 @samp{elfv1}, @samp{elfv2}@.
20687
20688 @item -mabi=spe
20689 @opindex mabi=spe
20690 Extend the current ABI with SPE ABI extensions. This does not change
20691 the default ABI, instead it adds the SPE ABI extensions to the current
20692 ABI@.
20693
20694 @item -mabi=no-spe
20695 @opindex mabi=no-spe
20696 Disable Book-E SPE ABI extensions for the current ABI@.
20697
20698 @item -mabi=ibmlongdouble
20699 @opindex mabi=ibmlongdouble
20700 Change the current ABI to use IBM extended-precision long double.
20701 This is a PowerPC 32-bit SYSV ABI option.
20702
20703 @item -mabi=ieeelongdouble
20704 @opindex mabi=ieeelongdouble
20705 Change the current ABI to use IEEE extended-precision long double.
20706 This is a PowerPC 32-bit Linux ABI option.
20707
20708 @item -mabi=elfv1
20709 @opindex mabi=elfv1
20710 Change the current ABI to use the ELFv1 ABI.
20711 This is the default ABI for big-endian PowerPC 64-bit Linux.
20712 Overriding the default ABI requires special system support and is
20713 likely to fail in spectacular ways.
20714
20715 @item -mabi=elfv2
20716 @opindex mabi=elfv2
20717 Change the current ABI to use the ELFv2 ABI.
20718 This is the default ABI for little-endian PowerPC 64-bit Linux.
20719 Overriding the default ABI requires special system support and is
20720 likely to fail in spectacular ways.
20721
20722 @item -mprototype
20723 @itemx -mno-prototype
20724 @opindex mprototype
20725 @opindex mno-prototype
20726 On System V.4 and embedded PowerPC systems assume that all calls to
20727 variable argument functions are properly prototyped. Otherwise, the
20728 compiler must insert an instruction before every non-prototyped call to
20729 set or clear bit 6 of the condition code register (@code{CR}) to
20730 indicate whether floating-point values are passed in the floating-point
20731 registers in case the function takes variable arguments. With
20732 @option{-mprototype}, only calls to prototyped variable argument functions
20733 set or clear the bit.
20734
20735 @item -msim
20736 @opindex msim
20737 On embedded PowerPC systems, assume that the startup module is called
20738 @file{sim-crt0.o} and that the standard C libraries are @file{libsim.a} and
20739 @file{libc.a}. This is the default for @samp{powerpc-*-eabisim}
20740 configurations.
20741
20742 @item -mmvme
20743 @opindex mmvme
20744 On embedded PowerPC systems, assume that the startup module is called
20745 @file{crt0.o} and the standard C libraries are @file{libmvme.a} and
20746 @file{libc.a}.
20747
20748 @item -mads
20749 @opindex mads
20750 On embedded PowerPC systems, assume that the startup module is called
20751 @file{crt0.o} and the standard C libraries are @file{libads.a} and
20752 @file{libc.a}.
20753
20754 @item -myellowknife
20755 @opindex myellowknife
20756 On embedded PowerPC systems, assume that the startup module is called
20757 @file{crt0.o} and the standard C libraries are @file{libyk.a} and
20758 @file{libc.a}.
20759
20760 @item -mvxworks
20761 @opindex mvxworks
20762 On System V.4 and embedded PowerPC systems, specify that you are
20763 compiling for a VxWorks system.
20764
20765 @item -memb
20766 @opindex memb
20767 On embedded PowerPC systems, set the @code{PPC_EMB} bit in the ELF flags
20768 header to indicate that @samp{eabi} extended relocations are used.
20769
20770 @item -meabi
20771 @itemx -mno-eabi
20772 @opindex meabi
20773 @opindex mno-eabi
20774 On System V.4 and embedded PowerPC systems do (do not) adhere to the
20775 Embedded Applications Binary Interface (EABI), which is a set of
20776 modifications to the System V.4 specifications. Selecting @option{-meabi}
20777 means that the stack is aligned to an 8-byte boundary, a function
20778 @code{__eabi} is called from @code{main} to set up the EABI
20779 environment, and the @option{-msdata} option can use both @code{r2} and
20780 @code{r13} to point to two separate small data areas. Selecting
20781 @option{-mno-eabi} means that the stack is aligned to a 16-byte boundary,
20782 no EABI initialization function is called from @code{main}, and the
20783 @option{-msdata} option only uses @code{r13} to point to a single
20784 small data area. The @option{-meabi} option is on by default if you
20785 configured GCC using one of the @samp{powerpc*-*-eabi*} options.
20786
20787 @item -msdata=eabi
20788 @opindex msdata=eabi
20789 On System V.4 and embedded PowerPC systems, put small initialized
20790 @code{const} global and static data in the @code{.sdata2} section, which
20791 is pointed to by register @code{r2}. Put small initialized
20792 non-@code{const} global and static data in the @code{.sdata} section,
20793 which is pointed to by register @code{r13}. Put small uninitialized
20794 global and static data in the @code{.sbss} section, which is adjacent to
20795 the @code{.sdata} section. The @option{-msdata=eabi} option is
20796 incompatible with the @option{-mrelocatable} option. The
20797 @option{-msdata=eabi} option also sets the @option{-memb} option.
20798
20799 @item -msdata=sysv
20800 @opindex msdata=sysv
20801 On System V.4 and embedded PowerPC systems, put small global and static
20802 data in the @code{.sdata} section, which is pointed to by register
20803 @code{r13}. Put small uninitialized global and static data in the
20804 @code{.sbss} section, which is adjacent to the @code{.sdata} section.
20805 The @option{-msdata=sysv} option is incompatible with the
20806 @option{-mrelocatable} option.
20807
20808 @item -msdata=default
20809 @itemx -msdata
20810 @opindex msdata=default
20811 @opindex msdata
20812 On System V.4 and embedded PowerPC systems, if @option{-meabi} is used,
20813 compile code the same as @option{-msdata=eabi}, otherwise compile code the
20814 same as @option{-msdata=sysv}.
20815
20816 @item -msdata=data
20817 @opindex msdata=data
20818 On System V.4 and embedded PowerPC systems, put small global
20819 data in the @code{.sdata} section. Put small uninitialized global
20820 data in the @code{.sbss} section. Do not use register @code{r13}
20821 to address small data however. This is the default behavior unless
20822 other @option{-msdata} options are used.
20823
20824 @item -msdata=none
20825 @itemx -mno-sdata
20826 @opindex msdata=none
20827 @opindex mno-sdata
20828 On embedded PowerPC systems, put all initialized global and static data
20829 in the @code{.data} section, and all uninitialized data in the
20830 @code{.bss} section.
20831
20832 @item -mblock-move-inline-limit=@var{num}
20833 @opindex mblock-move-inline-limit
20834 Inline all block moves (such as calls to @code{memcpy} or structure
20835 copies) less than or equal to @var{num} bytes. The minimum value for
20836 @var{num} is 32 bytes on 32-bit targets and 64 bytes on 64-bit
20837 targets. The default value is target-specific.
20838
20839 @item -G @var{num}
20840 @opindex G
20841 @cindex smaller data references (PowerPC)
20842 @cindex .sdata/.sdata2 references (PowerPC)
20843 On embedded PowerPC systems, put global and static items less than or
20844 equal to @var{num} bytes into the small data or BSS sections instead of
20845 the normal data or BSS section. By default, @var{num} is 8. The
20846 @option{-G @var{num}} switch is also passed to the linker.
20847 All modules should be compiled with the same @option{-G @var{num}} value.
20848
20849 @item -mregnames
20850 @itemx -mno-regnames
20851 @opindex mregnames
20852 @opindex mno-regnames
20853 On System V.4 and embedded PowerPC systems do (do not) emit register
20854 names in the assembly language output using symbolic forms.
20855
20856 @item -mlongcall
20857 @itemx -mno-longcall
20858 @opindex mlongcall
20859 @opindex mno-longcall
20860 By default assume that all calls are far away so that a longer and more
20861 expensive calling sequence is required. This is required for calls
20862 farther than 32 megabytes (33,554,432 bytes) from the current location.
20863 A short call is generated if the compiler knows
20864 the call cannot be that far away. This setting can be overridden by
20865 the @code{shortcall} function attribute, or by @code{#pragma
20866 longcall(0)}.
20867
20868 Some linkers are capable of detecting out-of-range calls and generating
20869 glue code on the fly. On these systems, long calls are unnecessary and
20870 generate slower code. As of this writing, the AIX linker can do this,
20871 as can the GNU linker for PowerPC/64. It is planned to add this feature
20872 to the GNU linker for 32-bit PowerPC systems as well.
20873
20874 On Darwin/PPC systems, @code{#pragma longcall} generates @code{jbsr
20875 callee, L42}, plus a @dfn{branch island} (glue code). The two target
20876 addresses represent the callee and the branch island. The
20877 Darwin/PPC linker prefers the first address and generates a @code{bl
20878 callee} if the PPC @code{bl} instruction reaches the callee directly;
20879 otherwise, the linker generates @code{bl L42} to call the branch
20880 island. The branch island is appended to the body of the
20881 calling function; it computes the full 32-bit address of the callee
20882 and jumps to it.
20883
20884 On Mach-O (Darwin) systems, this option directs the compiler emit to
20885 the glue for every direct call, and the Darwin linker decides whether
20886 to use or discard it.
20887
20888 In the future, GCC may ignore all longcall specifications
20889 when the linker is known to generate glue.
20890
20891 @item -mtls-markers
20892 @itemx -mno-tls-markers
20893 @opindex mtls-markers
20894 @opindex mno-tls-markers
20895 Mark (do not mark) calls to @code{__tls_get_addr} with a relocation
20896 specifying the function argument. The relocation allows the linker to
20897 reliably associate function call with argument setup instructions for
20898 TLS optimization, which in turn allows GCC to better schedule the
20899 sequence.
20900
20901 @item -pthread
20902 @opindex pthread
20903 Adds support for multithreading with the @dfn{pthreads} library.
20904 This option sets flags for both the preprocessor and linker.
20905
20906 @item -mrecip
20907 @itemx -mno-recip
20908 @opindex mrecip
20909 This option enables use of the reciprocal estimate and
20910 reciprocal square root estimate instructions with additional
20911 Newton-Raphson steps to increase precision instead of doing a divide or
20912 square root and divide for floating-point arguments. You should use
20913 the @option{-ffast-math} option when using @option{-mrecip} (or at
20914 least @option{-funsafe-math-optimizations},
20915 @option{-ffinite-math-only}, @option{-freciprocal-math} and
20916 @option{-fno-trapping-math}). Note that while the throughput of the
20917 sequence is generally higher than the throughput of the non-reciprocal
20918 instruction, the precision of the sequence can be decreased by up to 2
20919 ulp (i.e.@: the inverse of 1.0 equals 0.99999994) for reciprocal square
20920 roots.
20921
20922 @item -mrecip=@var{opt}
20923 @opindex mrecip=opt
20924 This option controls which reciprocal estimate instructions
20925 may be used. @var{opt} is a comma-separated list of options, which may
20926 be preceded by a @code{!} to invert the option:
20927
20928 @table @samp
20929
20930 @item all
20931 Enable all estimate instructions.
20932
20933 @item default
20934 Enable the default instructions, equivalent to @option{-mrecip}.
20935
20936 @item none
20937 Disable all estimate instructions, equivalent to @option{-mno-recip}.
20938
20939 @item div
20940 Enable the reciprocal approximation instructions for both
20941 single and double precision.
20942
20943 @item divf
20944 Enable the single-precision reciprocal approximation instructions.
20945
20946 @item divd
20947 Enable the double-precision reciprocal approximation instructions.
20948
20949 @item rsqrt
20950 Enable the reciprocal square root approximation instructions for both
20951 single and double precision.
20952
20953 @item rsqrtf
20954 Enable the single-precision reciprocal square root approximation instructions.
20955
20956 @item rsqrtd
20957 Enable the double-precision reciprocal square root approximation instructions.
20958
20959 @end table
20960
20961 So, for example, @option{-mrecip=all,!rsqrtd} enables
20962 all of the reciprocal estimate instructions, except for the
20963 @code{FRSQRTE}, @code{XSRSQRTEDP}, and @code{XVRSQRTEDP} instructions
20964 which handle the double-precision reciprocal square root calculations.
20965
20966 @item -mrecip-precision
20967 @itemx -mno-recip-precision
20968 @opindex mrecip-precision
20969 Assume (do not assume) that the reciprocal estimate instructions
20970 provide higher-precision estimates than is mandated by the PowerPC
20971 ABI. Selecting @option{-mcpu=power6}, @option{-mcpu=power7} or
20972 @option{-mcpu=power8} automatically selects @option{-mrecip-precision}.
20973 The double-precision square root estimate instructions are not generated by
20974 default on low-precision machines, since they do not provide an
20975 estimate that converges after three steps.
20976
20977 @item -mveclibabi=@var{type}
20978 @opindex mveclibabi
20979 Specifies the ABI type to use for vectorizing intrinsics using an
20980 external library. The only type supported at present is @samp{mass},
20981 which specifies to use IBM's Mathematical Acceleration Subsystem
20982 (MASS) libraries for vectorizing intrinsics using external libraries.
20983 GCC currently emits calls to @code{acosd2}, @code{acosf4},
20984 @code{acoshd2}, @code{acoshf4}, @code{asind2}, @code{asinf4},
20985 @code{asinhd2}, @code{asinhf4}, @code{atan2d2}, @code{atan2f4},
20986 @code{atand2}, @code{atanf4}, @code{atanhd2}, @code{atanhf4},
20987 @code{cbrtd2}, @code{cbrtf4}, @code{cosd2}, @code{cosf4},
20988 @code{coshd2}, @code{coshf4}, @code{erfcd2}, @code{erfcf4},
20989 @code{erfd2}, @code{erff4}, @code{exp2d2}, @code{exp2f4},
20990 @code{expd2}, @code{expf4}, @code{expm1d2}, @code{expm1f4},
20991 @code{hypotd2}, @code{hypotf4}, @code{lgammad2}, @code{lgammaf4},
20992 @code{log10d2}, @code{log10f4}, @code{log1pd2}, @code{log1pf4},
20993 @code{log2d2}, @code{log2f4}, @code{logd2}, @code{logf4},
20994 @code{powd2}, @code{powf4}, @code{sind2}, @code{sinf4}, @code{sinhd2},
20995 @code{sinhf4}, @code{sqrtd2}, @code{sqrtf4}, @code{tand2},
20996 @code{tanf4}, @code{tanhd2}, and @code{tanhf4} when generating code
20997 for power7. Both @option{-ftree-vectorize} and
20998 @option{-funsafe-math-optimizations} must also be enabled. The MASS
20999 libraries must be specified at link time.
21000
21001 @item -mfriz
21002 @itemx -mno-friz
21003 @opindex mfriz
21004 Generate (do not generate) the @code{friz} instruction when the
21005 @option{-funsafe-math-optimizations} option is used to optimize
21006 rounding of floating-point values to 64-bit integer and back to floating
21007 point. The @code{friz} instruction does not return the same value if
21008 the floating-point number is too large to fit in an integer.
21009
21010 @item -mpointers-to-nested-functions
21011 @itemx -mno-pointers-to-nested-functions
21012 @opindex mpointers-to-nested-functions
21013 Generate (do not generate) code to load up the static chain register
21014 (@code{r11}) when calling through a pointer on AIX and 64-bit Linux
21015 systems where a function pointer points to a 3-word descriptor giving
21016 the function address, TOC value to be loaded in register @code{r2}, and
21017 static chain value to be loaded in register @code{r11}. The
21018 @option{-mpointers-to-nested-functions} is on by default. You cannot
21019 call through pointers to nested functions or pointers
21020 to functions compiled in other languages that use the static chain if
21021 you use @option{-mno-pointers-to-nested-functions}.
21022
21023 @item -msave-toc-indirect
21024 @itemx -mno-save-toc-indirect
21025 @opindex msave-toc-indirect
21026 Generate (do not generate) code to save the TOC value in the reserved
21027 stack location in the function prologue if the function calls through
21028 a pointer on AIX and 64-bit Linux systems. If the TOC value is not
21029 saved in the prologue, it is saved just before the call through the
21030 pointer. The @option{-mno-save-toc-indirect} option is the default.
21031
21032 @item -mcompat-align-parm
21033 @itemx -mno-compat-align-parm
21034 @opindex mcompat-align-parm
21035 Generate (do not generate) code to pass structure parameters with a
21036 maximum alignment of 64 bits, for compatibility with older versions
21037 of GCC.
21038
21039 Older versions of GCC (prior to 4.9.0) incorrectly did not align a
21040 structure parameter on a 128-bit boundary when that structure contained
21041 a member requiring 128-bit alignment. This is corrected in more
21042 recent versions of GCC. This option may be used to generate code
21043 that is compatible with functions compiled with older versions of
21044 GCC.
21045
21046 The @option{-mno-compat-align-parm} option is the default.
21047 @end table
21048
21049 @node RX Options
21050 @subsection RX Options
21051 @cindex RX Options
21052
21053 These command-line options are defined for RX targets:
21054
21055 @table @gcctabopt
21056 @item -m64bit-doubles
21057 @itemx -m32bit-doubles
21058 @opindex m64bit-doubles
21059 @opindex m32bit-doubles
21060 Make the @code{double} data type be 64 bits (@option{-m64bit-doubles})
21061 or 32 bits (@option{-m32bit-doubles}) in size. The default is
21062 @option{-m32bit-doubles}. @emph{Note} RX floating-point hardware only
21063 works on 32-bit values, which is why the default is
21064 @option{-m32bit-doubles}.
21065
21066 @item -fpu
21067 @itemx -nofpu
21068 @opindex fpu
21069 @opindex nofpu
21070 Enables (@option{-fpu}) or disables (@option{-nofpu}) the use of RX
21071 floating-point hardware. The default is enabled for the RX600
21072 series and disabled for the RX200 series.
21073
21074 Floating-point instructions are only generated for 32-bit floating-point
21075 values, however, so the FPU hardware is not used for doubles if the
21076 @option{-m64bit-doubles} option is used.
21077
21078 @emph{Note} If the @option{-fpu} option is enabled then
21079 @option{-funsafe-math-optimizations} is also enabled automatically.
21080 This is because the RX FPU instructions are themselves unsafe.
21081
21082 @item -mcpu=@var{name}
21083 @opindex mcpu
21084 Selects the type of RX CPU to be targeted. Currently three types are
21085 supported, the generic @samp{RX600} and @samp{RX200} series hardware and
21086 the specific @samp{RX610} CPU. The default is @samp{RX600}.
21087
21088 The only difference between @samp{RX600} and @samp{RX610} is that the
21089 @samp{RX610} does not support the @code{MVTIPL} instruction.
21090
21091 The @samp{RX200} series does not have a hardware floating-point unit
21092 and so @option{-nofpu} is enabled by default when this type is
21093 selected.
21094
21095 @item -mbig-endian-data
21096 @itemx -mlittle-endian-data
21097 @opindex mbig-endian-data
21098 @opindex mlittle-endian-data
21099 Store data (but not code) in the big-endian format. The default is
21100 @option{-mlittle-endian-data}, i.e.@: to store data in the little-endian
21101 format.
21102
21103 @item -msmall-data-limit=@var{N}
21104 @opindex msmall-data-limit
21105 Specifies the maximum size in bytes of global and static variables
21106 which can be placed into the small data area. Using the small data
21107 area can lead to smaller and faster code, but the size of area is
21108 limited and it is up to the programmer to ensure that the area does
21109 not overflow. Also when the small data area is used one of the RX's
21110 registers (usually @code{r13}) is reserved for use pointing to this
21111 area, so it is no longer available for use by the compiler. This
21112 could result in slower and/or larger code if variables are pushed onto
21113 the stack instead of being held in this register.
21114
21115 Note, common variables (variables that have not been initialized) and
21116 constants are not placed into the small data area as they are assigned
21117 to other sections in the output executable.
21118
21119 The default value is zero, which disables this feature. Note, this
21120 feature is not enabled by default with higher optimization levels
21121 (@option{-O2} etc) because of the potentially detrimental effects of
21122 reserving a register. It is up to the programmer to experiment and
21123 discover whether this feature is of benefit to their program. See the
21124 description of the @option{-mpid} option for a description of how the
21125 actual register to hold the small data area pointer is chosen.
21126
21127 @item -msim
21128 @itemx -mno-sim
21129 @opindex msim
21130 @opindex mno-sim
21131 Use the simulator runtime. The default is to use the libgloss
21132 board-specific runtime.
21133
21134 @item -mas100-syntax
21135 @itemx -mno-as100-syntax
21136 @opindex mas100-syntax
21137 @opindex mno-as100-syntax
21138 When generating assembler output use a syntax that is compatible with
21139 Renesas's AS100 assembler. This syntax can also be handled by the GAS
21140 assembler, but it has some restrictions so it is not generated by default.
21141
21142 @item -mmax-constant-size=@var{N}
21143 @opindex mmax-constant-size
21144 Specifies the maximum size, in bytes, of a constant that can be used as
21145 an operand in a RX instruction. Although the RX instruction set does
21146 allow constants of up to 4 bytes in length to be used in instructions,
21147 a longer value equates to a longer instruction. Thus in some
21148 circumstances it can be beneficial to restrict the size of constants
21149 that are used in instructions. Constants that are too big are instead
21150 placed into a constant pool and referenced via register indirection.
21151
21152 The value @var{N} can be between 0 and 4. A value of 0 (the default)
21153 or 4 means that constants of any size are allowed.
21154
21155 @item -mrelax
21156 @opindex mrelax
21157 Enable linker relaxation. Linker relaxation is a process whereby the
21158 linker attempts to reduce the size of a program by finding shorter
21159 versions of various instructions. Disabled by default.
21160
21161 @item -mint-register=@var{N}
21162 @opindex mint-register
21163 Specify the number of registers to reserve for fast interrupt handler
21164 functions. The value @var{N} can be between 0 and 4. A value of 1
21165 means that register @code{r13} is reserved for the exclusive use
21166 of fast interrupt handlers. A value of 2 reserves @code{r13} and
21167 @code{r12}. A value of 3 reserves @code{r13}, @code{r12} and
21168 @code{r11}, and a value of 4 reserves @code{r13} through @code{r10}.
21169 A value of 0, the default, does not reserve any registers.
21170
21171 @item -msave-acc-in-interrupts
21172 @opindex msave-acc-in-interrupts
21173 Specifies that interrupt handler functions should preserve the
21174 accumulator register. This is only necessary if normal code might use
21175 the accumulator register, for example because it performs 64-bit
21176 multiplications. The default is to ignore the accumulator as this
21177 makes the interrupt handlers faster.
21178
21179 @item -mpid
21180 @itemx -mno-pid
21181 @opindex mpid
21182 @opindex mno-pid
21183 Enables the generation of position independent data. When enabled any
21184 access to constant data is done via an offset from a base address
21185 held in a register. This allows the location of constant data to be
21186 determined at run time without requiring the executable to be
21187 relocated, which is a benefit to embedded applications with tight
21188 memory constraints. Data that can be modified is not affected by this
21189 option.
21190
21191 Note, using this feature reserves a register, usually @code{r13}, for
21192 the constant data base address. This can result in slower and/or
21193 larger code, especially in complicated functions.
21194
21195 The actual register chosen to hold the constant data base address
21196 depends upon whether the @option{-msmall-data-limit} and/or the
21197 @option{-mint-register} command-line options are enabled. Starting
21198 with register @code{r13} and proceeding downwards, registers are
21199 allocated first to satisfy the requirements of @option{-mint-register},
21200 then @option{-mpid} and finally @option{-msmall-data-limit}. Thus it
21201 is possible for the small data area register to be @code{r8} if both
21202 @option{-mint-register=4} and @option{-mpid} are specified on the
21203 command line.
21204
21205 By default this feature is not enabled. The default can be restored
21206 via the @option{-mno-pid} command-line option.
21207
21208 @item -mno-warn-multiple-fast-interrupts
21209 @itemx -mwarn-multiple-fast-interrupts
21210 @opindex mno-warn-multiple-fast-interrupts
21211 @opindex mwarn-multiple-fast-interrupts
21212 Prevents GCC from issuing a warning message if it finds more than one
21213 fast interrupt handler when it is compiling a file. The default is to
21214 issue a warning for each extra fast interrupt handler found, as the RX
21215 only supports one such interrupt.
21216
21217 @item -mallow-string-insns
21218 @itemx -mno-allow-string-insns
21219 @opindex mallow-string-insns
21220 @opindex mno-allow-string-insns
21221 Enables or disables the use of the string manipulation instructions
21222 @code{SMOVF}, @code{SCMPU}, @code{SMOVB}, @code{SMOVU}, @code{SUNTIL}
21223 @code{SWHILE} and also the @code{RMPA} instruction. These
21224 instructions may prefetch data, which is not safe to do if accessing
21225 an I/O register. (See section 12.2.7 of the RX62N Group User's Manual
21226 for more information).
21227
21228 The default is to allow these instructions, but it is not possible for
21229 GCC to reliably detect all circumstances where a string instruction
21230 might be used to access an I/O register, so their use cannot be
21231 disabled automatically. Instead it is reliant upon the programmer to
21232 use the @option{-mno-allow-string-insns} option if their program
21233 accesses I/O space.
21234
21235 When the instructions are enabled GCC defines the C preprocessor
21236 symbol @code{__RX_ALLOW_STRING_INSNS__}, otherwise it defines the
21237 symbol @code{__RX_DISALLOW_STRING_INSNS__}.
21238
21239 @item -mjsr
21240 @itemx -mno-jsr
21241 @opindex mjsr
21242 @opindex mno-jsr
21243 Use only (or not only) @code{JSR} instructions to access functions.
21244 This option can be used when code size exceeds the range of @code{BSR}
21245 instructions. Note that @option{-mno-jsr} does not mean to not use
21246 @code{JSR} but instead means that any type of branch may be used.
21247 @end table
21248
21249 @emph{Note:} The generic GCC command-line option @option{-ffixed-@var{reg}}
21250 has special significance to the RX port when used with the
21251 @code{interrupt} function attribute. This attribute indicates a
21252 function intended to process fast interrupts. GCC ensures
21253 that it only uses the registers @code{r10}, @code{r11}, @code{r12}
21254 and/or @code{r13} and only provided that the normal use of the
21255 corresponding registers have been restricted via the
21256 @option{-ffixed-@var{reg}} or @option{-mint-register} command-line
21257 options.
21258
21259 @node S/390 and zSeries Options
21260 @subsection S/390 and zSeries Options
21261 @cindex S/390 and zSeries Options
21262
21263 These are the @samp{-m} options defined for the S/390 and zSeries architecture.
21264
21265 @table @gcctabopt
21266 @item -mhard-float
21267 @itemx -msoft-float
21268 @opindex mhard-float
21269 @opindex msoft-float
21270 Use (do not use) the hardware floating-point instructions and registers
21271 for floating-point operations. When @option{-msoft-float} is specified,
21272 functions in @file{libgcc.a} are used to perform floating-point
21273 operations. When @option{-mhard-float} is specified, the compiler
21274 generates IEEE floating-point instructions. This is the default.
21275
21276 @item -mhard-dfp
21277 @itemx -mno-hard-dfp
21278 @opindex mhard-dfp
21279 @opindex mno-hard-dfp
21280 Use (do not use) the hardware decimal-floating-point instructions for
21281 decimal-floating-point operations. When @option{-mno-hard-dfp} is
21282 specified, functions in @file{libgcc.a} are used to perform
21283 decimal-floating-point operations. When @option{-mhard-dfp} is
21284 specified, the compiler generates decimal-floating-point hardware
21285 instructions. This is the default for @option{-march=z9-ec} or higher.
21286
21287 @item -mlong-double-64
21288 @itemx -mlong-double-128
21289 @opindex mlong-double-64
21290 @opindex mlong-double-128
21291 These switches control the size of @code{long double} type. A size
21292 of 64 bits makes the @code{long double} type equivalent to the @code{double}
21293 type. This is the default.
21294
21295 @item -mbackchain
21296 @itemx -mno-backchain
21297 @opindex mbackchain
21298 @opindex mno-backchain
21299 Store (do not store) the address of the caller's frame as backchain pointer
21300 into the callee's stack frame.
21301 A backchain may be needed to allow debugging using tools that do not understand
21302 DWARF call frame information.
21303 When @option{-mno-packed-stack} is in effect, the backchain pointer is stored
21304 at the bottom of the stack frame; when @option{-mpacked-stack} is in effect,
21305 the backchain is placed into the topmost word of the 96/160 byte register
21306 save area.
21307
21308 In general, code compiled with @option{-mbackchain} is call-compatible with
21309 code compiled with @option{-mmo-backchain}; however, use of the backchain
21310 for debugging purposes usually requires that the whole binary is built with
21311 @option{-mbackchain}. Note that the combination of @option{-mbackchain},
21312 @option{-mpacked-stack} and @option{-mhard-float} is not supported. In order
21313 to build a linux kernel use @option{-msoft-float}.
21314
21315 The default is to not maintain the backchain.
21316
21317 @item -mpacked-stack
21318 @itemx -mno-packed-stack
21319 @opindex mpacked-stack
21320 @opindex mno-packed-stack
21321 Use (do not use) the packed stack layout. When @option{-mno-packed-stack} is
21322 specified, the compiler uses the all fields of the 96/160 byte register save
21323 area only for their default purpose; unused fields still take up stack space.
21324 When @option{-mpacked-stack} is specified, register save slots are densely
21325 packed at the top of the register save area; unused space is reused for other
21326 purposes, allowing for more efficient use of the available stack space.
21327 However, when @option{-mbackchain} is also in effect, the topmost word of
21328 the save area is always used to store the backchain, and the return address
21329 register is always saved two words below the backchain.
21330
21331 As long as the stack frame backchain is not used, code generated with
21332 @option{-mpacked-stack} is call-compatible with code generated with
21333 @option{-mno-packed-stack}. Note that some non-FSF releases of GCC 2.95 for
21334 S/390 or zSeries generated code that uses the stack frame backchain at run
21335 time, not just for debugging purposes. Such code is not call-compatible
21336 with code compiled with @option{-mpacked-stack}. Also, note that the
21337 combination of @option{-mbackchain},
21338 @option{-mpacked-stack} and @option{-mhard-float} is not supported. In order
21339 to build a linux kernel use @option{-msoft-float}.
21340
21341 The default is to not use the packed stack layout.
21342
21343 @item -msmall-exec
21344 @itemx -mno-small-exec
21345 @opindex msmall-exec
21346 @opindex mno-small-exec
21347 Generate (or do not generate) code using the @code{bras} instruction
21348 to do subroutine calls.
21349 This only works reliably if the total executable size does not
21350 exceed 64k. The default is to use the @code{basr} instruction instead,
21351 which does not have this limitation.
21352
21353 @item -m64
21354 @itemx -m31
21355 @opindex m64
21356 @opindex m31
21357 When @option{-m31} is specified, generate code compliant to the
21358 GNU/Linux for S/390 ABI@. When @option{-m64} is specified, generate
21359 code compliant to the GNU/Linux for zSeries ABI@. This allows GCC in
21360 particular to generate 64-bit instructions. For the @samp{s390}
21361 targets, the default is @option{-m31}, while the @samp{s390x}
21362 targets default to @option{-m64}.
21363
21364 @item -mzarch
21365 @itemx -mesa
21366 @opindex mzarch
21367 @opindex mesa
21368 When @option{-mzarch} is specified, generate code using the
21369 instructions available on z/Architecture.
21370 When @option{-mesa} is specified, generate code using the
21371 instructions available on ESA/390. Note that @option{-mesa} is
21372 not possible with @option{-m64}.
21373 When generating code compliant to the GNU/Linux for S/390 ABI,
21374 the default is @option{-mesa}. When generating code compliant
21375 to the GNU/Linux for zSeries ABI, the default is @option{-mzarch}.
21376
21377 @item -mhtm
21378 @itemx -mno-htm
21379 @opindex mhtm
21380 @opindex mno-htm
21381 The @option{-mhtm} option enables a set of builtins making use of
21382 instructions available with the transactional execution facility
21383 introduced with the IBM zEnterprise EC12 machine generation
21384 @ref{S/390 System z Built-in Functions}.
21385 @option{-mhtm} is enabled by default when using @option{-march=zEC12}.
21386
21387 @item -mvx
21388 @itemx -mno-vx
21389 @opindex mvx
21390 @opindex mno-vx
21391 When @option{-mvx} is specified, generate code using the instructions
21392 available with the vector extension facility introduced with the IBM
21393 z13 machine generation.
21394 This option changes the ABI for some vector type values with regard to
21395 alignment and calling conventions. In case vector type values are
21396 being used in an ABI-relevant context a GAS @samp{.gnu_attribute}
21397 command will be added to mark the resulting binary with the ABI used.
21398 @option{-mvx} is enabled by default when using @option{-march=z13}.
21399
21400 @item -mzvector
21401 @itemx -mno-zvector
21402 @opindex mzvector
21403 @opindex mno-zvector
21404 The @option{-mzvector} option enables vector language extensions and
21405 builtins using instructions available with the vector extension
21406 facility introduced with the IBM z13 machine generation.
21407 This option adds support for @samp{vector} to be used as a keyword to
21408 define vector type variables and arguments. @samp{vector} is only
21409 available when GNU extensions are enabled. It will not be expanded
21410 when requesting strict standard compliance e.g. with @option{-std=c99}.
21411 In addition to the GCC low-level builtins @option{-mzvector} enables
21412 a set of builtins added for compatibility with AltiVec-style
21413 implementations like Power and Cell. In order to make use of these
21414 builtins the header file @file{vecintrin.h} needs to be included.
21415 @option{-mzvector} is disabled by default.
21416
21417 @item -mmvcle
21418 @itemx -mno-mvcle
21419 @opindex mmvcle
21420 @opindex mno-mvcle
21421 Generate (or do not generate) code using the @code{mvcle} instruction
21422 to perform block moves. When @option{-mno-mvcle} is specified,
21423 use a @code{mvc} loop instead. This is the default unless optimizing for
21424 size.
21425
21426 @item -mdebug
21427 @itemx -mno-debug
21428 @opindex mdebug
21429 @opindex mno-debug
21430 Print (or do not print) additional debug information when compiling.
21431 The default is to not print debug information.
21432
21433 @item -march=@var{cpu-type}
21434 @opindex march
21435 Generate code that runs on @var{cpu-type}, which is the name of a
21436 system representing a certain processor type. Possible values for
21437 @var{cpu-type} are @samp{z900}, @samp{z990}, @samp{z9-109},
21438 @samp{z9-ec}, @samp{z10}, @samp{z196}, @samp{zEC12}, and @samp{z13}.
21439 The default is @option{-march=z900}. @samp{g5} and @samp{g6} are
21440 deprecated and will be removed with future releases.
21441
21442 @item -mtune=@var{cpu-type}
21443 @opindex mtune
21444 Tune to @var{cpu-type} everything applicable about the generated code,
21445 except for the ABI and the set of available instructions.
21446 The list of @var{cpu-type} values is the same as for @option{-march}.
21447 The default is the value used for @option{-march}.
21448
21449 @item -mtpf-trace
21450 @itemx -mno-tpf-trace
21451 @opindex mtpf-trace
21452 @opindex mno-tpf-trace
21453 Generate code that adds (does not add) in TPF OS specific branches to trace
21454 routines in the operating system. This option is off by default, even
21455 when compiling for the TPF OS@.
21456
21457 @item -mfused-madd
21458 @itemx -mno-fused-madd
21459 @opindex mfused-madd
21460 @opindex mno-fused-madd
21461 Generate code that uses (does not use) the floating-point multiply and
21462 accumulate instructions. These instructions are generated by default if
21463 hardware floating point is used.
21464
21465 @item -mwarn-framesize=@var{framesize}
21466 @opindex mwarn-framesize
21467 Emit a warning if the current function exceeds the given frame size. Because
21468 this is a compile-time check it doesn't need to be a real problem when the program
21469 runs. It is intended to identify functions that most probably cause
21470 a stack overflow. It is useful to be used in an environment with limited stack
21471 size e.g.@: the linux kernel.
21472
21473 @item -mwarn-dynamicstack
21474 @opindex mwarn-dynamicstack
21475 Emit a warning if the function calls @code{alloca} or uses dynamically-sized
21476 arrays. This is generally a bad idea with a limited stack size.
21477
21478 @item -mstack-guard=@var{stack-guard}
21479 @itemx -mstack-size=@var{stack-size}
21480 @opindex mstack-guard
21481 @opindex mstack-size
21482 If these options are provided the S/390 back end emits additional instructions in
21483 the function prologue that trigger a trap if the stack size is @var{stack-guard}
21484 bytes above the @var{stack-size} (remember that the stack on S/390 grows downward).
21485 If the @var{stack-guard} option is omitted the smallest power of 2 larger than
21486 the frame size of the compiled function is chosen.
21487 These options are intended to be used to help debugging stack overflow problems.
21488 The additionally emitted code causes only little overhead and hence can also be
21489 used in production-like systems without greater performance degradation. The given
21490 values have to be exact powers of 2 and @var{stack-size} has to be greater than
21491 @var{stack-guard} without exceeding 64k.
21492 In order to be efficient the extra code makes the assumption that the stack starts
21493 at an address aligned to the value given by @var{stack-size}.
21494 The @var{stack-guard} option can only be used in conjunction with @var{stack-size}.
21495
21496 @item -mhotpatch=@var{pre-halfwords},@var{post-halfwords}
21497 @opindex mhotpatch
21498 If the hotpatch option is enabled, a ``hot-patching'' function
21499 prologue is generated for all functions in the compilation unit.
21500 The funtion label is prepended with the given number of two-byte
21501 NOP instructions (@var{pre-halfwords}, maximum 1000000). After
21502 the label, 2 * @var{post-halfwords} bytes are appended, using the
21503 largest NOP like instructions the architecture allows (maximum
21504 1000000).
21505
21506 If both arguments are zero, hotpatching is disabled.
21507
21508 This option can be overridden for individual functions with the
21509 @code{hotpatch} attribute.
21510 @end table
21511
21512 @node Score Options
21513 @subsection Score Options
21514 @cindex Score Options
21515
21516 These options are defined for Score implementations:
21517
21518 @table @gcctabopt
21519 @item -meb
21520 @opindex meb
21521 Compile code for big-endian mode. This is the default.
21522
21523 @item -mel
21524 @opindex mel
21525 Compile code for little-endian mode.
21526
21527 @item -mnhwloop
21528 @opindex mnhwloop
21529 Disable generation of @code{bcnz} instructions.
21530
21531 @item -muls
21532 @opindex muls
21533 Enable generation of unaligned load and store instructions.
21534
21535 @item -mmac
21536 @opindex mmac
21537 Enable the use of multiply-accumulate instructions. Disabled by default.
21538
21539 @item -mscore5
21540 @opindex mscore5
21541 Specify the SCORE5 as the target architecture.
21542
21543 @item -mscore5u
21544 @opindex mscore5u
21545 Specify the SCORE5U of the target architecture.
21546
21547 @item -mscore7
21548 @opindex mscore7
21549 Specify the SCORE7 as the target architecture. This is the default.
21550
21551 @item -mscore7d
21552 @opindex mscore7d
21553 Specify the SCORE7D as the target architecture.
21554 @end table
21555
21556 @node SH Options
21557 @subsection SH Options
21558
21559 These @samp{-m} options are defined for the SH implementations:
21560
21561 @table @gcctabopt
21562 @item -m1
21563 @opindex m1
21564 Generate code for the SH1.
21565
21566 @item -m2
21567 @opindex m2
21568 Generate code for the SH2.
21569
21570 @item -m2e
21571 Generate code for the SH2e.
21572
21573 @item -m2a-nofpu
21574 @opindex m2a-nofpu
21575 Generate code for the SH2a without FPU, or for a SH2a-FPU in such a way
21576 that the floating-point unit is not used.
21577
21578 @item -m2a-single-only
21579 @opindex m2a-single-only
21580 Generate code for the SH2a-FPU, in such a way that no double-precision
21581 floating-point operations are used.
21582
21583 @item -m2a-single
21584 @opindex m2a-single
21585 Generate code for the SH2a-FPU assuming the floating-point unit is in
21586 single-precision mode by default.
21587
21588 @item -m2a
21589 @opindex m2a
21590 Generate code for the SH2a-FPU assuming the floating-point unit is in
21591 double-precision mode by default.
21592
21593 @item -m3
21594 @opindex m3
21595 Generate code for the SH3.
21596
21597 @item -m3e
21598 @opindex m3e
21599 Generate code for the SH3e.
21600
21601 @item -m4-nofpu
21602 @opindex m4-nofpu
21603 Generate code for the SH4 without a floating-point unit.
21604
21605 @item -m4-single-only
21606 @opindex m4-single-only
21607 Generate code for the SH4 with a floating-point unit that only
21608 supports single-precision arithmetic.
21609
21610 @item -m4-single
21611 @opindex m4-single
21612 Generate code for the SH4 assuming the floating-point unit is in
21613 single-precision mode by default.
21614
21615 @item -m4
21616 @opindex m4
21617 Generate code for the SH4.
21618
21619 @item -m4-100
21620 @opindex m4-100
21621 Generate code for SH4-100.
21622
21623 @item -m4-100-nofpu
21624 @opindex m4-100-nofpu
21625 Generate code for SH4-100 in such a way that the
21626 floating-point unit is not used.
21627
21628 @item -m4-100-single
21629 @opindex m4-100-single
21630 Generate code for SH4-100 assuming the floating-point unit is in
21631 single-precision mode by default.
21632
21633 @item -m4-100-single-only
21634 @opindex m4-100-single-only
21635 Generate code for SH4-100 in such a way that no double-precision
21636 floating-point operations are used.
21637
21638 @item -m4-200
21639 @opindex m4-200
21640 Generate code for SH4-200.
21641
21642 @item -m4-200-nofpu
21643 @opindex m4-200-nofpu
21644 Generate code for SH4-200 without in such a way that the
21645 floating-point unit is not used.
21646
21647 @item -m4-200-single
21648 @opindex m4-200-single
21649 Generate code for SH4-200 assuming the floating-point unit is in
21650 single-precision mode by default.
21651
21652 @item -m4-200-single-only
21653 @opindex m4-200-single-only
21654 Generate code for SH4-200 in such a way that no double-precision
21655 floating-point operations are used.
21656
21657 @item -m4-300
21658 @opindex m4-300
21659 Generate code for SH4-300.
21660
21661 @item -m4-300-nofpu
21662 @opindex m4-300-nofpu
21663 Generate code for SH4-300 without in such a way that the
21664 floating-point unit is not used.
21665
21666 @item -m4-300-single
21667 @opindex m4-300-single
21668 Generate code for SH4-300 in such a way that no double-precision
21669 floating-point operations are used.
21670
21671 @item -m4-300-single-only
21672 @opindex m4-300-single-only
21673 Generate code for SH4-300 in such a way that no double-precision
21674 floating-point operations are used.
21675
21676 @item -m4-340
21677 @opindex m4-340
21678 Generate code for SH4-340 (no MMU, no FPU).
21679
21680 @item -m4-500
21681 @opindex m4-500
21682 Generate code for SH4-500 (no FPU). Passes @option{-isa=sh4-nofpu} to the
21683 assembler.
21684
21685 @item -m4a-nofpu
21686 @opindex m4a-nofpu
21687 Generate code for the SH4al-dsp, or for a SH4a in such a way that the
21688 floating-point unit is not used.
21689
21690 @item -m4a-single-only
21691 @opindex m4a-single-only
21692 Generate code for the SH4a, in such a way that no double-precision
21693 floating-point operations are used.
21694
21695 @item -m4a-single
21696 @opindex m4a-single
21697 Generate code for the SH4a assuming the floating-point unit is in
21698 single-precision mode by default.
21699
21700 @item -m4a
21701 @opindex m4a
21702 Generate code for the SH4a.
21703
21704 @item -m4al
21705 @opindex m4al
21706 Same as @option{-m4a-nofpu}, except that it implicitly passes
21707 @option{-dsp} to the assembler. GCC doesn't generate any DSP
21708 instructions at the moment.
21709
21710 @item -mb
21711 @opindex mb
21712 Compile code for the processor in big-endian mode.
21713
21714 @item -ml
21715 @opindex ml
21716 Compile code for the processor in little-endian mode.
21717
21718 @item -mdalign
21719 @opindex mdalign
21720 Align doubles at 64-bit boundaries. Note that this changes the calling
21721 conventions, and thus some functions from the standard C library do
21722 not work unless you recompile it first with @option{-mdalign}.
21723
21724 @item -mrelax
21725 @opindex mrelax
21726 Shorten some address references at link time, when possible; uses the
21727 linker option @option{-relax}.
21728
21729 @item -mbigtable
21730 @opindex mbigtable
21731 Use 32-bit offsets in @code{switch} tables. The default is to use
21732 16-bit offsets.
21733
21734 @item -mbitops
21735 @opindex mbitops
21736 Enable the use of bit manipulation instructions on SH2A.
21737
21738 @item -mfmovd
21739 @opindex mfmovd
21740 Enable the use of the instruction @code{fmovd}. Check @option{-mdalign} for
21741 alignment constraints.
21742
21743 @item -mrenesas
21744 @opindex mrenesas
21745 Comply with the calling conventions defined by Renesas.
21746
21747 @item -mno-renesas
21748 @opindex mno-renesas
21749 Comply with the calling conventions defined for GCC before the Renesas
21750 conventions were available. This option is the default for all
21751 targets of the SH toolchain.
21752
21753 @item -mnomacsave
21754 @opindex mnomacsave
21755 Mark the @code{MAC} register as call-clobbered, even if
21756 @option{-mrenesas} is given.
21757
21758 @item -mieee
21759 @itemx -mno-ieee
21760 @opindex mieee
21761 @opindex mno-ieee
21762 Control the IEEE compliance of floating-point comparisons, which affects the
21763 handling of cases where the result of a comparison is unordered. By default
21764 @option{-mieee} is implicitly enabled. If @option{-ffinite-math-only} is
21765 enabled @option{-mno-ieee} is implicitly set, which results in faster
21766 floating-point greater-equal and less-equal comparisons. The implicit settings
21767 can be overridden by specifying either @option{-mieee} or @option{-mno-ieee}.
21768
21769 @item -minline-ic_invalidate
21770 @opindex minline-ic_invalidate
21771 Inline code to invalidate instruction cache entries after setting up
21772 nested function trampolines.
21773 This option has no effect if @option{-musermode} is in effect and the selected
21774 code generation option (e.g. @option{-m4}) does not allow the use of the @code{icbi}
21775 instruction.
21776 If the selected code generation option does not allow the use of the @code{icbi}
21777 instruction, and @option{-musermode} is not in effect, the inlined code
21778 manipulates the instruction cache address array directly with an associative
21779 write. This not only requires privileged mode at run time, but it also
21780 fails if the cache line had been mapped via the TLB and has become unmapped.
21781
21782 @item -misize
21783 @opindex misize
21784 Dump instruction size and location in the assembly code.
21785
21786 @item -mpadstruct
21787 @opindex mpadstruct
21788 This option is deprecated. It pads structures to multiple of 4 bytes,
21789 which is incompatible with the SH ABI@.
21790
21791 @item -matomic-model=@var{model}
21792 @opindex matomic-model=@var{model}
21793 Sets the model of atomic operations and additional parameters as a comma
21794 separated list. For details on the atomic built-in functions see
21795 @ref{__atomic Builtins}. The following models and parameters are supported:
21796
21797 @table @samp
21798
21799 @item none
21800 Disable compiler generated atomic sequences and emit library calls for atomic
21801 operations. This is the default if the target is not @code{sh*-*-linux*}.
21802
21803 @item soft-gusa
21804 Generate GNU/Linux compatible gUSA software atomic sequences for the atomic
21805 built-in functions. The generated atomic sequences require additional support
21806 from the interrupt/exception handling code of the system and are only suitable
21807 for SH3* and SH4* single-core systems. This option is enabled by default when
21808 the target is @code{sh*-*-linux*} and SH3* or SH4*. When the target is SH4A,
21809 this option also partially utilizes the hardware atomic instructions
21810 @code{movli.l} and @code{movco.l} to create more efficient code, unless
21811 @samp{strict} is specified.
21812
21813 @item soft-tcb
21814 Generate software atomic sequences that use a variable in the thread control
21815 block. This is a variation of the gUSA sequences which can also be used on
21816 SH1* and SH2* targets. The generated atomic sequences require additional
21817 support from the interrupt/exception handling code of the system and are only
21818 suitable for single-core systems. When using this model, the @samp{gbr-offset=}
21819 parameter has to be specified as well.
21820
21821 @item soft-imask
21822 Generate software atomic sequences that temporarily disable interrupts by
21823 setting @code{SR.IMASK = 1111}. This model works only when the program runs
21824 in privileged mode and is only suitable for single-core systems. Additional
21825 support from the interrupt/exception handling code of the system is not
21826 required. This model is enabled by default when the target is
21827 @code{sh*-*-linux*} and SH1* or SH2*.
21828
21829 @item hard-llcs
21830 Generate hardware atomic sequences using the @code{movli.l} and @code{movco.l}
21831 instructions only. This is only available on SH4A and is suitable for
21832 multi-core systems. Since the hardware instructions support only 32 bit atomic
21833 variables access to 8 or 16 bit variables is emulated with 32 bit accesses.
21834 Code compiled with this option is also compatible with other software
21835 atomic model interrupt/exception handling systems if executed on an SH4A
21836 system. Additional support from the interrupt/exception handling code of the
21837 system is not required for this model.
21838
21839 @item gbr-offset=
21840 This parameter specifies the offset in bytes of the variable in the thread
21841 control block structure that should be used by the generated atomic sequences
21842 when the @samp{soft-tcb} model has been selected. For other models this
21843 parameter is ignored. The specified value must be an integer multiple of four
21844 and in the range 0-1020.
21845
21846 @item strict
21847 This parameter prevents mixed usage of multiple atomic models, even if they
21848 are compatible, and makes the compiler generate atomic sequences of the
21849 specified model only.
21850
21851 @end table
21852
21853 @item -mtas
21854 @opindex mtas
21855 Generate the @code{tas.b} opcode for @code{__atomic_test_and_set}.
21856 Notice that depending on the particular hardware and software configuration
21857 this can degrade overall performance due to the operand cache line flushes
21858 that are implied by the @code{tas.b} instruction. On multi-core SH4A
21859 processors the @code{tas.b} instruction must be used with caution since it
21860 can result in data corruption for certain cache configurations.
21861
21862 @item -mprefergot
21863 @opindex mprefergot
21864 When generating position-independent code, emit function calls using
21865 the Global Offset Table instead of the Procedure Linkage Table.
21866
21867 @item -musermode
21868 @itemx -mno-usermode
21869 @opindex musermode
21870 @opindex mno-usermode
21871 Don't allow (allow) the compiler generating privileged mode code. Specifying
21872 @option{-musermode} also implies @option{-mno-inline-ic_invalidate} if the
21873 inlined code would not work in user mode. @option{-musermode} is the default
21874 when the target is @code{sh*-*-linux*}. If the target is SH1* or SH2*
21875 @option{-musermode} has no effect, since there is no user mode.
21876
21877 @item -multcost=@var{number}
21878 @opindex multcost=@var{number}
21879 Set the cost to assume for a multiply insn.
21880
21881 @item -mdiv=@var{strategy}
21882 @opindex mdiv=@var{strategy}
21883 Set the division strategy to be used for integer division operations.
21884 @var{strategy} can be one of:
21885
21886 @table @samp
21887
21888 @item call-div1
21889 Calls a library function that uses the single-step division instruction
21890 @code{div1} to perform the operation. Division by zero calculates an
21891 unspecified result and does not trap. This is the default except for SH4,
21892 SH2A and SHcompact.
21893
21894 @item call-fp
21895 Calls a library function that performs the operation in double precision
21896 floating point. Division by zero causes a floating-point exception. This is
21897 the default for SHcompact with FPU. Specifying this for targets that do not
21898 have a double precision FPU defaults to @code{call-div1}.
21899
21900 @item call-table
21901 Calls a library function that uses a lookup table for small divisors and
21902 the @code{div1} instruction with case distinction for larger divisors. Division
21903 by zero calculates an unspecified result and does not trap. This is the default
21904 for SH4. Specifying this for targets that do not have dynamic shift
21905 instructions defaults to @code{call-div1}.
21906
21907 @end table
21908
21909 When a division strategy has not been specified the default strategy is
21910 selected based on the current target. For SH2A the default strategy is to
21911 use the @code{divs} and @code{divu} instructions instead of library function
21912 calls.
21913
21914 @item -maccumulate-outgoing-args
21915 @opindex maccumulate-outgoing-args
21916 Reserve space once for outgoing arguments in the function prologue rather
21917 than around each call. Generally beneficial for performance and size. Also
21918 needed for unwinding to avoid changing the stack frame around conditional code.
21919
21920 @item -mdivsi3_libfunc=@var{name}
21921 @opindex mdivsi3_libfunc=@var{name}
21922 Set the name of the library function used for 32-bit signed division to
21923 @var{name}.
21924 This only affects the name used in the @samp{call} division strategies, and
21925 the compiler still expects the same sets of input/output/clobbered registers as
21926 if this option were not present.
21927
21928 @item -mfixed-range=@var{register-range}
21929 @opindex mfixed-range
21930 Generate code treating the given register range as fixed registers.
21931 A fixed register is one that the register allocator can not use. This is
21932 useful when compiling kernel code. A register range is specified as
21933 two registers separated by a dash. Multiple register ranges can be
21934 specified separated by a comma.
21935
21936 @item -mbranch-cost=@var{num}
21937 @opindex mbranch-cost=@var{num}
21938 Assume @var{num} to be the cost for a branch instruction. Higher numbers
21939 make the compiler try to generate more branch-free code if possible.
21940 If not specified the value is selected depending on the processor type that
21941 is being compiled for.
21942
21943 @item -mzdcbranch
21944 @itemx -mno-zdcbranch
21945 @opindex mzdcbranch
21946 @opindex mno-zdcbranch
21947 Assume (do not assume) that zero displacement conditional branch instructions
21948 @code{bt} and @code{bf} are fast. If @option{-mzdcbranch} is specified, the
21949 compiler prefers zero displacement branch code sequences. This is
21950 enabled by default when generating code for SH4 and SH4A. It can be explicitly
21951 disabled by specifying @option{-mno-zdcbranch}.
21952
21953 @item -mcbranch-force-delay-slot
21954 @opindex mcbranch-force-delay-slot
21955 Force the usage of delay slots for conditional branches, which stuffs the delay
21956 slot with a @code{nop} if a suitable instruction can't be found. By default
21957 this option is disabled. It can be enabled to work around hardware bugs as
21958 found in the original SH7055.
21959
21960 @item -mfused-madd
21961 @itemx -mno-fused-madd
21962 @opindex mfused-madd
21963 @opindex mno-fused-madd
21964 Generate code that uses (does not use) the floating-point multiply and
21965 accumulate instructions. These instructions are generated by default
21966 if hardware floating point is used. The machine-dependent
21967 @option{-mfused-madd} option is now mapped to the machine-independent
21968 @option{-ffp-contract=fast} option, and @option{-mno-fused-madd} is
21969 mapped to @option{-ffp-contract=off}.
21970
21971 @item -mfsca
21972 @itemx -mno-fsca
21973 @opindex mfsca
21974 @opindex mno-fsca
21975 Allow or disallow the compiler to emit the @code{fsca} instruction for sine
21976 and cosine approximations. The option @option{-mfsca} must be used in
21977 combination with @option{-funsafe-math-optimizations}. It is enabled by default
21978 when generating code for SH4A. Using @option{-mno-fsca} disables sine and cosine
21979 approximations even if @option{-funsafe-math-optimizations} is in effect.
21980
21981 @item -mfsrra
21982 @itemx -mno-fsrra
21983 @opindex mfsrra
21984 @opindex mno-fsrra
21985 Allow or disallow the compiler to emit the @code{fsrra} instruction for
21986 reciprocal square root approximations. The option @option{-mfsrra} must be used
21987 in combination with @option{-funsafe-math-optimizations} and
21988 @option{-ffinite-math-only}. It is enabled by default when generating code for
21989 SH4A. Using @option{-mno-fsrra} disables reciprocal square root approximations
21990 even if @option{-funsafe-math-optimizations} and @option{-ffinite-math-only} are
21991 in effect.
21992
21993 @item -mpretend-cmove
21994 @opindex mpretend-cmove
21995 Prefer zero-displacement conditional branches for conditional move instruction
21996 patterns. This can result in faster code on the SH4 processor.
21997
21998 @item -mfdpic
21999 @opindex fdpic
22000 Generate code using the FDPIC ABI.
22001
22002 @end table
22003
22004 @node Solaris 2 Options
22005 @subsection Solaris 2 Options
22006 @cindex Solaris 2 options
22007
22008 These @samp{-m} options are supported on Solaris 2:
22009
22010 @table @gcctabopt
22011 @item -mclear-hwcap
22012 @opindex mclear-hwcap
22013 @option{-mclear-hwcap} tells the compiler to remove the hardware
22014 capabilities generated by the Solaris assembler. This is only necessary
22015 when object files use ISA extensions not supported by the current
22016 machine, but check at runtime whether or not to use them.
22017
22018 @item -mimpure-text
22019 @opindex mimpure-text
22020 @option{-mimpure-text}, used in addition to @option{-shared}, tells
22021 the compiler to not pass @option{-z text} to the linker when linking a
22022 shared object. Using this option, you can link position-dependent
22023 code into a shared object.
22024
22025 @option{-mimpure-text} suppresses the ``relocations remain against
22026 allocatable but non-writable sections'' linker error message.
22027 However, the necessary relocations trigger copy-on-write, and the
22028 shared object is not actually shared across processes. Instead of
22029 using @option{-mimpure-text}, you should compile all source code with
22030 @option{-fpic} or @option{-fPIC}.
22031
22032 @end table
22033
22034 These switches are supported in addition to the above on Solaris 2:
22035
22036 @table @gcctabopt
22037 @item -pthreads
22038 @opindex pthreads
22039 Add support for multithreading using the POSIX threads library. This
22040 option sets flags for both the preprocessor and linker. This option does
22041 not affect the thread safety of object code produced by the compiler or
22042 that of libraries supplied with it.
22043
22044 @item -pthread
22045 @opindex pthread
22046 This is a synonym for @option{-pthreads}.
22047 @end table
22048
22049 @node SPARC Options
22050 @subsection SPARC Options
22051 @cindex SPARC options
22052
22053 These @samp{-m} options are supported on the SPARC:
22054
22055 @table @gcctabopt
22056 @item -mno-app-regs
22057 @itemx -mapp-regs
22058 @opindex mno-app-regs
22059 @opindex mapp-regs
22060 Specify @option{-mapp-regs} to generate output using the global registers
22061 2 through 4, which the SPARC SVR4 ABI reserves for applications. Like the
22062 global register 1, each global register 2 through 4 is then treated as an
22063 allocable register that is clobbered by function calls. This is the default.
22064
22065 To be fully SVR4 ABI-compliant at the cost of some performance loss,
22066 specify @option{-mno-app-regs}. You should compile libraries and system
22067 software with this option.
22068
22069 @item -mflat
22070 @itemx -mno-flat
22071 @opindex mflat
22072 @opindex mno-flat
22073 With @option{-mflat}, the compiler does not generate save/restore instructions
22074 and uses a ``flat'' or single register window model. This model is compatible
22075 with the regular register window model. The local registers and the input
22076 registers (0--5) are still treated as ``call-saved'' registers and are
22077 saved on the stack as needed.
22078
22079 With @option{-mno-flat} (the default), the compiler generates save/restore
22080 instructions (except for leaf functions). This is the normal operating mode.
22081
22082 @item -mfpu
22083 @itemx -mhard-float
22084 @opindex mfpu
22085 @opindex mhard-float
22086 Generate output containing floating-point instructions. This is the
22087 default.
22088
22089 @item -mno-fpu
22090 @itemx -msoft-float
22091 @opindex mno-fpu
22092 @opindex msoft-float
22093 Generate output containing library calls for floating point.
22094 @strong{Warning:} the requisite libraries are not available for all SPARC
22095 targets. Normally the facilities of the machine's usual C compiler are
22096 used, but this cannot be done directly in cross-compilation. You must make
22097 your own arrangements to provide suitable library functions for
22098 cross-compilation. The embedded targets @samp{sparc-*-aout} and
22099 @samp{sparclite-*-*} do provide software floating-point support.
22100
22101 @option{-msoft-float} changes the calling convention in the output file;
22102 therefore, it is only useful if you compile @emph{all} of a program with
22103 this option. In particular, you need to compile @file{libgcc.a}, the
22104 library that comes with GCC, with @option{-msoft-float} in order for
22105 this to work.
22106
22107 @item -mhard-quad-float
22108 @opindex mhard-quad-float
22109 Generate output containing quad-word (long double) floating-point
22110 instructions.
22111
22112 @item -msoft-quad-float
22113 @opindex msoft-quad-float
22114 Generate output containing library calls for quad-word (long double)
22115 floating-point instructions. The functions called are those specified
22116 in the SPARC ABI@. This is the default.
22117
22118 As of this writing, there are no SPARC implementations that have hardware
22119 support for the quad-word floating-point instructions. They all invoke
22120 a trap handler for one of these instructions, and then the trap handler
22121 emulates the effect of the instruction. Because of the trap handler overhead,
22122 this is much slower than calling the ABI library routines. Thus the
22123 @option{-msoft-quad-float} option is the default.
22124
22125 @item -mno-unaligned-doubles
22126 @itemx -munaligned-doubles
22127 @opindex mno-unaligned-doubles
22128 @opindex munaligned-doubles
22129 Assume that doubles have 8-byte alignment. This is the default.
22130
22131 With @option{-munaligned-doubles}, GCC assumes that doubles have 8-byte
22132 alignment only if they are contained in another type, or if they have an
22133 absolute address. Otherwise, it assumes they have 4-byte alignment.
22134 Specifying this option avoids some rare compatibility problems with code
22135 generated by other compilers. It is not the default because it results
22136 in a performance loss, especially for floating-point code.
22137
22138 @item -muser-mode
22139 @itemx -mno-user-mode
22140 @opindex muser-mode
22141 @opindex mno-user-mode
22142 Do not generate code that can only run in supervisor mode. This is relevant
22143 only for the @code{casa} instruction emitted for the LEON3 processor. This
22144 is the default.
22145
22146 @item -mfaster-structs
22147 @itemx -mno-faster-structs
22148 @opindex mfaster-structs
22149 @opindex mno-faster-structs
22150 With @option{-mfaster-structs}, the compiler assumes that structures
22151 should have 8-byte alignment. This enables the use of pairs of
22152 @code{ldd} and @code{std} instructions for copies in structure
22153 assignment, in place of twice as many @code{ld} and @code{st} pairs.
22154 However, the use of this changed alignment directly violates the SPARC
22155 ABI@. Thus, it's intended only for use on targets where the developer
22156 acknowledges that their resulting code is not directly in line with
22157 the rules of the ABI@.
22158
22159 @item -mstd-struct-return
22160 @itemx -mno-std-struct-return
22161 @opindex mstd-struct-return
22162 @opindex mno-std-struct-return
22163 With @option{-mstd-struct-return}, the compiler generates checking code
22164 in functions returning structures or unions to detect size mismatches
22165 between the two sides of function calls, as per the 32-bit ABI@.
22166
22167 The default is @option{-mno-std-struct-return}. This option has no effect
22168 in 64-bit mode.
22169
22170 @item -mcpu=@var{cpu_type}
22171 @opindex mcpu
22172 Set the instruction set, register set, and instruction scheduling parameters
22173 for machine type @var{cpu_type}. Supported values for @var{cpu_type} are
22174 @samp{v7}, @samp{cypress}, @samp{v8}, @samp{supersparc}, @samp{hypersparc},
22175 @samp{leon}, @samp{leon3}, @samp{leon3v7}, @samp{sparclite}, @samp{f930},
22176 @samp{f934}, @samp{sparclite86x}, @samp{sparclet}, @samp{tsc701}, @samp{v9},
22177 @samp{ultrasparc}, @samp{ultrasparc3}, @samp{niagara}, @samp{niagara2},
22178 @samp{niagara3} and @samp{niagara4}.
22179
22180 Native Solaris and GNU/Linux toolchains also support the value @samp{native},
22181 which selects the best architecture option for the host processor.
22182 @option{-mcpu=native} has no effect if GCC does not recognize
22183 the processor.
22184
22185 Default instruction scheduling parameters are used for values that select
22186 an architecture and not an implementation. These are @samp{v7}, @samp{v8},
22187 @samp{sparclite}, @samp{sparclet}, @samp{v9}.
22188
22189 Here is a list of each supported architecture and their supported
22190 implementations.
22191
22192 @table @asis
22193 @item v7
22194 cypress, leon3v7
22195
22196 @item v8
22197 supersparc, hypersparc, leon, leon3
22198
22199 @item sparclite
22200 f930, f934, sparclite86x
22201
22202 @item sparclet
22203 tsc701
22204
22205 @item v9
22206 ultrasparc, ultrasparc3, niagara, niagara2, niagara3, niagara4
22207 @end table
22208
22209 By default (unless configured otherwise), GCC generates code for the V7
22210 variant of the SPARC architecture. With @option{-mcpu=cypress}, the compiler
22211 additionally optimizes it for the Cypress CY7C602 chip, as used in the
22212 SPARCStation/SPARCServer 3xx series. This is also appropriate for the older
22213 SPARCStation 1, 2, IPX etc.
22214
22215 With @option{-mcpu=v8}, GCC generates code for the V8 variant of the SPARC
22216 architecture. The only difference from V7 code is that the compiler emits
22217 the integer multiply and integer divide instructions which exist in SPARC-V8
22218 but not in SPARC-V7. With @option{-mcpu=supersparc}, the compiler additionally
22219 optimizes it for the SuperSPARC chip, as used in the SPARCStation 10, 1000 and
22220 2000 series.
22221
22222 With @option{-mcpu=sparclite}, GCC generates code for the SPARClite variant of
22223 the SPARC architecture. This adds the integer multiply, integer divide step
22224 and scan (@code{ffs}) instructions which exist in SPARClite but not in SPARC-V7.
22225 With @option{-mcpu=f930}, the compiler additionally optimizes it for the
22226 Fujitsu MB86930 chip, which is the original SPARClite, with no FPU@. With
22227 @option{-mcpu=f934}, the compiler additionally optimizes it for the Fujitsu
22228 MB86934 chip, which is the more recent SPARClite with FPU@.
22229
22230 With @option{-mcpu=sparclet}, GCC generates code for the SPARClet variant of
22231 the SPARC architecture. This adds the integer multiply, multiply/accumulate,
22232 integer divide step and scan (@code{ffs}) instructions which exist in SPARClet
22233 but not in SPARC-V7. With @option{-mcpu=tsc701}, the compiler additionally
22234 optimizes it for the TEMIC SPARClet chip.
22235
22236 With @option{-mcpu=v9}, GCC generates code for the V9 variant of the SPARC
22237 architecture. This adds 64-bit integer and floating-point move instructions,
22238 3 additional floating-point condition code registers and conditional move
22239 instructions. With @option{-mcpu=ultrasparc}, the compiler additionally
22240 optimizes it for the Sun UltraSPARC I/II/IIi chips. With
22241 @option{-mcpu=ultrasparc3}, the compiler additionally optimizes it for the
22242 Sun UltraSPARC III/III+/IIIi/IIIi+/IV/IV+ chips. With
22243 @option{-mcpu=niagara}, the compiler additionally optimizes it for
22244 Sun UltraSPARC T1 chips. With @option{-mcpu=niagara2}, the compiler
22245 additionally optimizes it for Sun UltraSPARC T2 chips. With
22246 @option{-mcpu=niagara3}, the compiler additionally optimizes it for Sun
22247 UltraSPARC T3 chips. With @option{-mcpu=niagara4}, the compiler
22248 additionally optimizes it for Sun UltraSPARC T4 chips.
22249
22250 @item -mtune=@var{cpu_type}
22251 @opindex mtune
22252 Set the instruction scheduling parameters for machine type
22253 @var{cpu_type}, but do not set the instruction set or register set that the
22254 option @option{-mcpu=@var{cpu_type}} does.
22255
22256 The same values for @option{-mcpu=@var{cpu_type}} can be used for
22257 @option{-mtune=@var{cpu_type}}, but the only useful values are those
22258 that select a particular CPU implementation. Those are @samp{cypress},
22259 @samp{supersparc}, @samp{hypersparc}, @samp{leon}, @samp{leon3},
22260 @samp{leon3v7}, @samp{f930}, @samp{f934}, @samp{sparclite86x}, @samp{tsc701},
22261 @samp{ultrasparc}, @samp{ultrasparc3}, @samp{niagara}, @samp{niagara2},
22262 @samp{niagara3} and @samp{niagara4}. With native Solaris and GNU/Linux
22263 toolchains, @samp{native} can also be used.
22264
22265 @item -mv8plus
22266 @itemx -mno-v8plus
22267 @opindex mv8plus
22268 @opindex mno-v8plus
22269 With @option{-mv8plus}, GCC generates code for the SPARC-V8+ ABI@. The
22270 difference from the V8 ABI is that the global and out registers are
22271 considered 64 bits wide. This is enabled by default on Solaris in 32-bit
22272 mode for all SPARC-V9 processors.
22273
22274 @item -mvis
22275 @itemx -mno-vis
22276 @opindex mvis
22277 @opindex mno-vis
22278 With @option{-mvis}, GCC generates code that takes advantage of the UltraSPARC
22279 Visual Instruction Set extensions. The default is @option{-mno-vis}.
22280
22281 @item -mvis2
22282 @itemx -mno-vis2
22283 @opindex mvis2
22284 @opindex mno-vis2
22285 With @option{-mvis2}, GCC generates code that takes advantage of
22286 version 2.0 of the UltraSPARC Visual Instruction Set extensions. The
22287 default is @option{-mvis2} when targeting a cpu that supports such
22288 instructions, such as UltraSPARC-III and later. Setting @option{-mvis2}
22289 also sets @option{-mvis}.
22290
22291 @item -mvis3
22292 @itemx -mno-vis3
22293 @opindex mvis3
22294 @opindex mno-vis3
22295 With @option{-mvis3}, GCC generates code that takes advantage of
22296 version 3.0 of the UltraSPARC Visual Instruction Set extensions. The
22297 default is @option{-mvis3} when targeting a cpu that supports such
22298 instructions, such as niagara-3 and later. Setting @option{-mvis3}
22299 also sets @option{-mvis2} and @option{-mvis}.
22300
22301 @item -mcbcond
22302 @itemx -mno-cbcond
22303 @opindex mcbcond
22304 @opindex mno-cbcond
22305 With @option{-mcbcond}, GCC generates code that takes advantage of
22306 compare-and-branch instructions, as defined in the Sparc Architecture 2011.
22307 The default is @option{-mcbcond} when targeting a cpu that supports such
22308 instructions, such as niagara-4 and later.
22309
22310 @item -mpopc
22311 @itemx -mno-popc
22312 @opindex mpopc
22313 @opindex mno-popc
22314 With @option{-mpopc}, GCC generates code that takes advantage of the UltraSPARC
22315 population count instruction. The default is @option{-mpopc}
22316 when targeting a cpu that supports such instructions, such as Niagara-2 and
22317 later.
22318
22319 @item -mfmaf
22320 @itemx -mno-fmaf
22321 @opindex mfmaf
22322 @opindex mno-fmaf
22323 With @option{-mfmaf}, GCC generates code that takes advantage of the UltraSPARC
22324 Fused Multiply-Add Floating-point extensions. The default is @option{-mfmaf}
22325 when targeting a cpu that supports such instructions, such as Niagara-3 and
22326 later.
22327
22328 @item -mfix-at697f
22329 @opindex mfix-at697f
22330 Enable the documented workaround for the single erratum of the Atmel AT697F
22331 processor (which corresponds to erratum #13 of the AT697E processor).
22332
22333 @item -mfix-ut699
22334 @opindex mfix-ut699
22335 Enable the documented workarounds for the floating-point errata and the data
22336 cache nullify errata of the UT699 processor.
22337 @end table
22338
22339 These @samp{-m} options are supported in addition to the above
22340 on SPARC-V9 processors in 64-bit environments:
22341
22342 @table @gcctabopt
22343 @item -m32
22344 @itemx -m64
22345 @opindex m32
22346 @opindex m64
22347 Generate code for a 32-bit or 64-bit environment.
22348 The 32-bit environment sets int, long and pointer to 32 bits.
22349 The 64-bit environment sets int to 32 bits and long and pointer
22350 to 64 bits.
22351
22352 @item -mcmodel=@var{which}
22353 @opindex mcmodel
22354 Set the code model to one of
22355
22356 @table @samp
22357 @item medlow
22358 The Medium/Low code model: 64-bit addresses, programs
22359 must be linked in the low 32 bits of memory. Programs can be statically
22360 or dynamically linked.
22361
22362 @item medmid
22363 The Medium/Middle code model: 64-bit addresses, programs
22364 must be linked in the low 44 bits of memory, the text and data segments must
22365 be less than 2GB in size and the data segment must be located within 2GB of
22366 the text segment.
22367
22368 @item medany
22369 The Medium/Anywhere code model: 64-bit addresses, programs
22370 may be linked anywhere in memory, the text and data segments must be less
22371 than 2GB in size and the data segment must be located within 2GB of the
22372 text segment.
22373
22374 @item embmedany
22375 The Medium/Anywhere code model for embedded systems:
22376 64-bit addresses, the text and data segments must be less than 2GB in
22377 size, both starting anywhere in memory (determined at link time). The
22378 global register %g4 points to the base of the data segment. Programs
22379 are statically linked and PIC is not supported.
22380 @end table
22381
22382 @item -mmemory-model=@var{mem-model}
22383 @opindex mmemory-model
22384 Set the memory model in force on the processor to one of
22385
22386 @table @samp
22387 @item default
22388 The default memory model for the processor and operating system.
22389
22390 @item rmo
22391 Relaxed Memory Order
22392
22393 @item pso
22394 Partial Store Order
22395
22396 @item tso
22397 Total Store Order
22398
22399 @item sc
22400 Sequential Consistency
22401 @end table
22402
22403 These memory models are formally defined in Appendix D of the Sparc V9
22404 architecture manual, as set in the processor's @code{PSTATE.MM} field.
22405
22406 @item -mstack-bias
22407 @itemx -mno-stack-bias
22408 @opindex mstack-bias
22409 @opindex mno-stack-bias
22410 With @option{-mstack-bias}, GCC assumes that the stack pointer, and
22411 frame pointer if present, are offset by @minus{}2047 which must be added back
22412 when making stack frame references. This is the default in 64-bit mode.
22413 Otherwise, assume no such offset is present.
22414 @end table
22415
22416 @node SPU Options
22417 @subsection SPU Options
22418 @cindex SPU options
22419
22420 These @samp{-m} options are supported on the SPU:
22421
22422 @table @gcctabopt
22423 @item -mwarn-reloc
22424 @itemx -merror-reloc
22425 @opindex mwarn-reloc
22426 @opindex merror-reloc
22427
22428 The loader for SPU does not handle dynamic relocations. By default, GCC
22429 gives an error when it generates code that requires a dynamic
22430 relocation. @option{-mno-error-reloc} disables the error,
22431 @option{-mwarn-reloc} generates a warning instead.
22432
22433 @item -msafe-dma
22434 @itemx -munsafe-dma
22435 @opindex msafe-dma
22436 @opindex munsafe-dma
22437
22438 Instructions that initiate or test completion of DMA must not be
22439 reordered with respect to loads and stores of the memory that is being
22440 accessed.
22441 With @option{-munsafe-dma} you must use the @code{volatile} keyword to protect
22442 memory accesses, but that can lead to inefficient code in places where the
22443 memory is known to not change. Rather than mark the memory as volatile,
22444 you can use @option{-msafe-dma} to tell the compiler to treat
22445 the DMA instructions as potentially affecting all memory.
22446
22447 @item -mbranch-hints
22448 @opindex mbranch-hints
22449
22450 By default, GCC generates a branch hint instruction to avoid
22451 pipeline stalls for always-taken or probably-taken branches. A hint
22452 is not generated closer than 8 instructions away from its branch.
22453 There is little reason to disable them, except for debugging purposes,
22454 or to make an object a little bit smaller.
22455
22456 @item -msmall-mem
22457 @itemx -mlarge-mem
22458 @opindex msmall-mem
22459 @opindex mlarge-mem
22460
22461 By default, GCC generates code assuming that addresses are never larger
22462 than 18 bits. With @option{-mlarge-mem} code is generated that assumes
22463 a full 32-bit address.
22464
22465 @item -mstdmain
22466 @opindex mstdmain
22467
22468 By default, GCC links against startup code that assumes the SPU-style
22469 main function interface (which has an unconventional parameter list).
22470 With @option{-mstdmain}, GCC links your program against startup
22471 code that assumes a C99-style interface to @code{main}, including a
22472 local copy of @code{argv} strings.
22473
22474 @item -mfixed-range=@var{register-range}
22475 @opindex mfixed-range
22476 Generate code treating the given register range as fixed registers.
22477 A fixed register is one that the register allocator cannot use. This is
22478 useful when compiling kernel code. A register range is specified as
22479 two registers separated by a dash. Multiple register ranges can be
22480 specified separated by a comma.
22481
22482 @item -mea32
22483 @itemx -mea64
22484 @opindex mea32
22485 @opindex mea64
22486 Compile code assuming that pointers to the PPU address space accessed
22487 via the @code{__ea} named address space qualifier are either 32 or 64
22488 bits wide. The default is 32 bits. As this is an ABI-changing option,
22489 all object code in an executable must be compiled with the same setting.
22490
22491 @item -maddress-space-conversion
22492 @itemx -mno-address-space-conversion
22493 @opindex maddress-space-conversion
22494 @opindex mno-address-space-conversion
22495 Allow/disallow treating the @code{__ea} address space as superset
22496 of the generic address space. This enables explicit type casts
22497 between @code{__ea} and generic pointer as well as implicit
22498 conversions of generic pointers to @code{__ea} pointers. The
22499 default is to allow address space pointer conversions.
22500
22501 @item -mcache-size=@var{cache-size}
22502 @opindex mcache-size
22503 This option controls the version of libgcc that the compiler links to an
22504 executable and selects a software-managed cache for accessing variables
22505 in the @code{__ea} address space with a particular cache size. Possible
22506 options for @var{cache-size} are @samp{8}, @samp{16}, @samp{32}, @samp{64}
22507 and @samp{128}. The default cache size is 64KB.
22508
22509 @item -matomic-updates
22510 @itemx -mno-atomic-updates
22511 @opindex matomic-updates
22512 @opindex mno-atomic-updates
22513 This option controls the version of libgcc that the compiler links to an
22514 executable and selects whether atomic updates to the software-managed
22515 cache of PPU-side variables are used. If you use atomic updates, changes
22516 to a PPU variable from SPU code using the @code{__ea} named address space
22517 qualifier do not interfere with changes to other PPU variables residing
22518 in the same cache line from PPU code. If you do not use atomic updates,
22519 such interference may occur; however, writing back cache lines is
22520 more efficient. The default behavior is to use atomic updates.
22521
22522 @item -mdual-nops
22523 @itemx -mdual-nops=@var{n}
22524 @opindex mdual-nops
22525 By default, GCC inserts nops to increase dual issue when it expects
22526 it to increase performance. @var{n} can be a value from 0 to 10. A
22527 smaller @var{n} inserts fewer nops. 10 is the default, 0 is the
22528 same as @option{-mno-dual-nops}. Disabled with @option{-Os}.
22529
22530 @item -mhint-max-nops=@var{n}
22531 @opindex mhint-max-nops
22532 Maximum number of nops to insert for a branch hint. A branch hint must
22533 be at least 8 instructions away from the branch it is affecting. GCC
22534 inserts up to @var{n} nops to enforce this, otherwise it does not
22535 generate the branch hint.
22536
22537 @item -mhint-max-distance=@var{n}
22538 @opindex mhint-max-distance
22539 The encoding of the branch hint instruction limits the hint to be within
22540 256 instructions of the branch it is affecting. By default, GCC makes
22541 sure it is within 125.
22542
22543 @item -msafe-hints
22544 @opindex msafe-hints
22545 Work around a hardware bug that causes the SPU to stall indefinitely.
22546 By default, GCC inserts the @code{hbrp} instruction to make sure
22547 this stall won't happen.
22548
22549 @end table
22550
22551 @node System V Options
22552 @subsection Options for System V
22553
22554 These additional options are available on System V Release 4 for
22555 compatibility with other compilers on those systems:
22556
22557 @table @gcctabopt
22558 @item -G
22559 @opindex G
22560 Create a shared object.
22561 It is recommended that @option{-symbolic} or @option{-shared} be used instead.
22562
22563 @item -Qy
22564 @opindex Qy
22565 Identify the versions of each tool used by the compiler, in a
22566 @code{.ident} assembler directive in the output.
22567
22568 @item -Qn
22569 @opindex Qn
22570 Refrain from adding @code{.ident} directives to the output file (this is
22571 the default).
22572
22573 @item -YP,@var{dirs}
22574 @opindex YP
22575 Search the directories @var{dirs}, and no others, for libraries
22576 specified with @option{-l}.
22577
22578 @item -Ym,@var{dir}
22579 @opindex Ym
22580 Look in the directory @var{dir} to find the M4 preprocessor.
22581 The assembler uses this option.
22582 @c This is supposed to go with a -Yd for predefined M4 macro files, but
22583 @c the generic assembler that comes with Solaris takes just -Ym.
22584 @end table
22585
22586 @node TILE-Gx Options
22587 @subsection TILE-Gx Options
22588 @cindex TILE-Gx options
22589
22590 These @samp{-m} options are supported on the TILE-Gx:
22591
22592 @table @gcctabopt
22593 @item -mcmodel=small
22594 @opindex mcmodel=small
22595 Generate code for the small model. The distance for direct calls is
22596 limited to 500M in either direction. PC-relative addresses are 32
22597 bits. Absolute addresses support the full address range.
22598
22599 @item -mcmodel=large
22600 @opindex mcmodel=large
22601 Generate code for the large model. There is no limitation on call
22602 distance, pc-relative addresses, or absolute addresses.
22603
22604 @item -mcpu=@var{name}
22605 @opindex mcpu
22606 Selects the type of CPU to be targeted. Currently the only supported
22607 type is @samp{tilegx}.
22608
22609 @item -m32
22610 @itemx -m64
22611 @opindex m32
22612 @opindex m64
22613 Generate code for a 32-bit or 64-bit environment. The 32-bit
22614 environment sets int, long, and pointer to 32 bits. The 64-bit
22615 environment sets int to 32 bits and long and pointer to 64 bits.
22616
22617 @item -mbig-endian
22618 @itemx -mlittle-endian
22619 @opindex mbig-endian
22620 @opindex mlittle-endian
22621 Generate code in big/little endian mode, respectively.
22622 @end table
22623
22624 @node TILEPro Options
22625 @subsection TILEPro Options
22626 @cindex TILEPro options
22627
22628 These @samp{-m} options are supported on the TILEPro:
22629
22630 @table @gcctabopt
22631 @item -mcpu=@var{name}
22632 @opindex mcpu
22633 Selects the type of CPU to be targeted. Currently the only supported
22634 type is @samp{tilepro}.
22635
22636 @item -m32
22637 @opindex m32
22638 Generate code for a 32-bit environment, which sets int, long, and
22639 pointer to 32 bits. This is the only supported behavior so the flag
22640 is essentially ignored.
22641 @end table
22642
22643 @node V850 Options
22644 @subsection V850 Options
22645 @cindex V850 Options
22646
22647 These @samp{-m} options are defined for V850 implementations:
22648
22649 @table @gcctabopt
22650 @item -mlong-calls
22651 @itemx -mno-long-calls
22652 @opindex mlong-calls
22653 @opindex mno-long-calls
22654 Treat all calls as being far away (near). If calls are assumed to be
22655 far away, the compiler always loads the function's address into a
22656 register, and calls indirect through the pointer.
22657
22658 @item -mno-ep
22659 @itemx -mep
22660 @opindex mno-ep
22661 @opindex mep
22662 Do not optimize (do optimize) basic blocks that use the same index
22663 pointer 4 or more times to copy pointer into the @code{ep} register, and
22664 use the shorter @code{sld} and @code{sst} instructions. The @option{-mep}
22665 option is on by default if you optimize.
22666
22667 @item -mno-prolog-function
22668 @itemx -mprolog-function
22669 @opindex mno-prolog-function
22670 @opindex mprolog-function
22671 Do not use (do use) external functions to save and restore registers
22672 at the prologue and epilogue of a function. The external functions
22673 are slower, but use less code space if more than one function saves
22674 the same number of registers. The @option{-mprolog-function} option
22675 is on by default if you optimize.
22676
22677 @item -mspace
22678 @opindex mspace
22679 Try to make the code as small as possible. At present, this just turns
22680 on the @option{-mep} and @option{-mprolog-function} options.
22681
22682 @item -mtda=@var{n}
22683 @opindex mtda
22684 Put static or global variables whose size is @var{n} bytes or less into
22685 the tiny data area that register @code{ep} points to. The tiny data
22686 area can hold up to 256 bytes in total (128 bytes for byte references).
22687
22688 @item -msda=@var{n}
22689 @opindex msda
22690 Put static or global variables whose size is @var{n} bytes or less into
22691 the small data area that register @code{gp} points to. The small data
22692 area can hold up to 64 kilobytes.
22693
22694 @item -mzda=@var{n}
22695 @opindex mzda
22696 Put static or global variables whose size is @var{n} bytes or less into
22697 the first 32 kilobytes of memory.
22698
22699 @item -mv850
22700 @opindex mv850
22701 Specify that the target processor is the V850.
22702
22703 @item -mv850e3v5
22704 @opindex mv850e3v5
22705 Specify that the target processor is the V850E3V5. The preprocessor
22706 constant @code{__v850e3v5__} is defined if this option is used.
22707
22708 @item -mv850e2v4
22709 @opindex mv850e2v4
22710 Specify that the target processor is the V850E3V5. This is an alias for
22711 the @option{-mv850e3v5} option.
22712
22713 @item -mv850e2v3
22714 @opindex mv850e2v3
22715 Specify that the target processor is the V850E2V3. The preprocessor
22716 constant @code{__v850e2v3__} is defined if this option is used.
22717
22718 @item -mv850e2
22719 @opindex mv850e2
22720 Specify that the target processor is the V850E2. The preprocessor
22721 constant @code{__v850e2__} is defined if this option is used.
22722
22723 @item -mv850e1
22724 @opindex mv850e1
22725 Specify that the target processor is the V850E1. The preprocessor
22726 constants @code{__v850e1__} and @code{__v850e__} are defined if
22727 this option is used.
22728
22729 @item -mv850es
22730 @opindex mv850es
22731 Specify that the target processor is the V850ES. This is an alias for
22732 the @option{-mv850e1} option.
22733
22734 @item -mv850e
22735 @opindex mv850e
22736 Specify that the target processor is the V850E@. The preprocessor
22737 constant @code{__v850e__} is defined if this option is used.
22738
22739 If neither @option{-mv850} nor @option{-mv850e} nor @option{-mv850e1}
22740 nor @option{-mv850e2} nor @option{-mv850e2v3} nor @option{-mv850e3v5}
22741 are defined then a default target processor is chosen and the
22742 relevant @samp{__v850*__} preprocessor constant is defined.
22743
22744 The preprocessor constants @code{__v850} and @code{__v851__} are always
22745 defined, regardless of which processor variant is the target.
22746
22747 @item -mdisable-callt
22748 @itemx -mno-disable-callt
22749 @opindex mdisable-callt
22750 @opindex mno-disable-callt
22751 This option suppresses generation of the @code{CALLT} instruction for the
22752 v850e, v850e1, v850e2, v850e2v3 and v850e3v5 flavors of the v850
22753 architecture.
22754
22755 This option is enabled by default when the RH850 ABI is
22756 in use (see @option{-mrh850-abi}), and disabled by default when the
22757 GCC ABI is in use. If @code{CALLT} instructions are being generated
22758 then the C preprocessor symbol @code{__V850_CALLT__} is defined.
22759
22760 @item -mrelax
22761 @itemx -mno-relax
22762 @opindex mrelax
22763 @opindex mno-relax
22764 Pass on (or do not pass on) the @option{-mrelax} command-line option
22765 to the assembler.
22766
22767 @item -mlong-jumps
22768 @itemx -mno-long-jumps
22769 @opindex mlong-jumps
22770 @opindex mno-long-jumps
22771 Disable (or re-enable) the generation of PC-relative jump instructions.
22772
22773 @item -msoft-float
22774 @itemx -mhard-float
22775 @opindex msoft-float
22776 @opindex mhard-float
22777 Disable (or re-enable) the generation of hardware floating point
22778 instructions. This option is only significant when the target
22779 architecture is @samp{V850E2V3} or higher. If hardware floating point
22780 instructions are being generated then the C preprocessor symbol
22781 @code{__FPU_OK__} is defined, otherwise the symbol
22782 @code{__NO_FPU__} is defined.
22783
22784 @item -mloop
22785 @opindex mloop
22786 Enables the use of the e3v5 LOOP instruction. The use of this
22787 instruction is not enabled by default when the e3v5 architecture is
22788 selected because its use is still experimental.
22789
22790 @item -mrh850-abi
22791 @itemx -mghs
22792 @opindex mrh850-abi
22793 @opindex mghs
22794 Enables support for the RH850 version of the V850 ABI. This is the
22795 default. With this version of the ABI the following rules apply:
22796
22797 @itemize
22798 @item
22799 Integer sized structures and unions are returned via a memory pointer
22800 rather than a register.
22801
22802 @item
22803 Large structures and unions (more than 8 bytes in size) are passed by
22804 value.
22805
22806 @item
22807 Functions are aligned to 16-bit boundaries.
22808
22809 @item
22810 The @option{-m8byte-align} command-line option is supported.
22811
22812 @item
22813 The @option{-mdisable-callt} command-line option is enabled by
22814 default. The @option{-mno-disable-callt} command-line option is not
22815 supported.
22816 @end itemize
22817
22818 When this version of the ABI is enabled the C preprocessor symbol
22819 @code{__V850_RH850_ABI__} is defined.
22820
22821 @item -mgcc-abi
22822 @opindex mgcc-abi
22823 Enables support for the old GCC version of the V850 ABI. With this
22824 version of the ABI the following rules apply:
22825
22826 @itemize
22827 @item
22828 Integer sized structures and unions are returned in register @code{r10}.
22829
22830 @item
22831 Large structures and unions (more than 8 bytes in size) are passed by
22832 reference.
22833
22834 @item
22835 Functions are aligned to 32-bit boundaries, unless optimizing for
22836 size.
22837
22838 @item
22839 The @option{-m8byte-align} command-line option is not supported.
22840
22841 @item
22842 The @option{-mdisable-callt} command-line option is supported but not
22843 enabled by default.
22844 @end itemize
22845
22846 When this version of the ABI is enabled the C preprocessor symbol
22847 @code{__V850_GCC_ABI__} is defined.
22848
22849 @item -m8byte-align
22850 @itemx -mno-8byte-align
22851 @opindex m8byte-align
22852 @opindex mno-8byte-align
22853 Enables support for @code{double} and @code{long long} types to be
22854 aligned on 8-byte boundaries. The default is to restrict the
22855 alignment of all objects to at most 4-bytes. When
22856 @option{-m8byte-align} is in effect the C preprocessor symbol
22857 @code{__V850_8BYTE_ALIGN__} is defined.
22858
22859 @item -mbig-switch
22860 @opindex mbig-switch
22861 Generate code suitable for big switch tables. Use this option only if
22862 the assembler/linker complain about out of range branches within a switch
22863 table.
22864
22865 @item -mapp-regs
22866 @opindex mapp-regs
22867 This option causes r2 and r5 to be used in the code generated by
22868 the compiler. This setting is the default.
22869
22870 @item -mno-app-regs
22871 @opindex mno-app-regs
22872 This option causes r2 and r5 to be treated as fixed registers.
22873
22874 @end table
22875
22876 @node VAX Options
22877 @subsection VAX Options
22878 @cindex VAX options
22879
22880 These @samp{-m} options are defined for the VAX:
22881
22882 @table @gcctabopt
22883 @item -munix
22884 @opindex munix
22885 Do not output certain jump instructions (@code{aobleq} and so on)
22886 that the Unix assembler for the VAX cannot handle across long
22887 ranges.
22888
22889 @item -mgnu
22890 @opindex mgnu
22891 Do output those jump instructions, on the assumption that the
22892 GNU assembler is being used.
22893
22894 @item -mg
22895 @opindex mg
22896 Output code for G-format floating-point numbers instead of D-format.
22897 @end table
22898
22899 @node Visium Options
22900 @subsection Visium Options
22901 @cindex Visium options
22902
22903 @table @gcctabopt
22904
22905 @item -mdebug
22906 @opindex mdebug
22907 A program which performs file I/O and is destined to run on an MCM target
22908 should be linked with this option. It causes the libraries libc.a and
22909 libdebug.a to be linked. The program should be run on the target under
22910 the control of the GDB remote debugging stub.
22911
22912 @item -msim
22913 @opindex msim
22914 A program which performs file I/O and is destined to run on the simulator
22915 should be linked with option. This causes libraries libc.a and libsim.a to
22916 be linked.
22917
22918 @item -mfpu
22919 @itemx -mhard-float
22920 @opindex mfpu
22921 @opindex mhard-float
22922 Generate code containing floating-point instructions. This is the
22923 default.
22924
22925 @item -mno-fpu
22926 @itemx -msoft-float
22927 @opindex mno-fpu
22928 @opindex msoft-float
22929 Generate code containing library calls for floating-point.
22930
22931 @option{-msoft-float} changes the calling convention in the output file;
22932 therefore, it is only useful if you compile @emph{all} of a program with
22933 this option. In particular, you need to compile @file{libgcc.a}, the
22934 library that comes with GCC, with @option{-msoft-float} in order for
22935 this to work.
22936
22937 @item -mcpu=@var{cpu_type}
22938 @opindex mcpu
22939 Set the instruction set, register set, and instruction scheduling parameters
22940 for machine type @var{cpu_type}. Supported values for @var{cpu_type} are
22941 @samp{mcm}, @samp{gr5} and @samp{gr6}.
22942
22943 @samp{mcm} is a synonym of @samp{gr5} present for backward compatibility.
22944
22945 By default (unless configured otherwise), GCC generates code for the GR5
22946 variant of the Visium architecture.
22947
22948 With @option{-mcpu=gr6}, GCC generates code for the GR6 variant of the Visium
22949 architecture. The only difference from GR5 code is that the compiler will
22950 generate block move instructions.
22951
22952 @item -mtune=@var{cpu_type}
22953 @opindex mtune
22954 Set the instruction scheduling parameters for machine type @var{cpu_type},
22955 but do not set the instruction set or register set that the option
22956 @option{-mcpu=@var{cpu_type}} would.
22957
22958 @item -msv-mode
22959 @opindex msv-mode
22960 Generate code for the supervisor mode, where there are no restrictions on
22961 the access to general registers. This is the default.
22962
22963 @item -muser-mode
22964 @opindex muser-mode
22965 Generate code for the user mode, where the access to some general registers
22966 is forbidden: on the GR5, registers r24 to r31 cannot be accessed in this
22967 mode; on the GR6, only registers r29 to r31 are affected.
22968 @end table
22969
22970 @node VMS Options
22971 @subsection VMS Options
22972
22973 These @samp{-m} options are defined for the VMS implementations:
22974
22975 @table @gcctabopt
22976 @item -mvms-return-codes
22977 @opindex mvms-return-codes
22978 Return VMS condition codes from @code{main}. The default is to return POSIX-style
22979 condition (e.g.@ error) codes.
22980
22981 @item -mdebug-main=@var{prefix}
22982 @opindex mdebug-main=@var{prefix}
22983 Flag the first routine whose name starts with @var{prefix} as the main
22984 routine for the debugger.
22985
22986 @item -mmalloc64
22987 @opindex mmalloc64
22988 Default to 64-bit memory allocation routines.
22989
22990 @item -mpointer-size=@var{size}
22991 @opindex mpointer-size=@var{size}
22992 Set the default size of pointers. Possible options for @var{size} are
22993 @samp{32} or @samp{short} for 32 bit pointers, @samp{64} or @samp{long}
22994 for 64 bit pointers, and @samp{no} for supporting only 32 bit pointers.
22995 The later option disables @code{pragma pointer_size}.
22996 @end table
22997
22998 @node VxWorks Options
22999 @subsection VxWorks Options
23000 @cindex VxWorks Options
23001
23002 The options in this section are defined for all VxWorks targets.
23003 Options specific to the target hardware are listed with the other
23004 options for that target.
23005
23006 @table @gcctabopt
23007 @item -mrtp
23008 @opindex mrtp
23009 GCC can generate code for both VxWorks kernels and real time processes
23010 (RTPs). This option switches from the former to the latter. It also
23011 defines the preprocessor macro @code{__RTP__}.
23012
23013 @item -non-static
23014 @opindex non-static
23015 Link an RTP executable against shared libraries rather than static
23016 libraries. The options @option{-static} and @option{-shared} can
23017 also be used for RTPs (@pxref{Link Options}); @option{-static}
23018 is the default.
23019
23020 @item -Bstatic
23021 @itemx -Bdynamic
23022 @opindex Bstatic
23023 @opindex Bdynamic
23024 These options are passed down to the linker. They are defined for
23025 compatibility with Diab.
23026
23027 @item -Xbind-lazy
23028 @opindex Xbind-lazy
23029 Enable lazy binding of function calls. This option is equivalent to
23030 @option{-Wl,-z,now} and is defined for compatibility with Diab.
23031
23032 @item -Xbind-now
23033 @opindex Xbind-now
23034 Disable lazy binding of function calls. This option is the default and
23035 is defined for compatibility with Diab.
23036 @end table
23037
23038 @node x86 Options
23039 @subsection x86 Options
23040 @cindex x86 Options
23041
23042 These @samp{-m} options are defined for the x86 family of computers.
23043
23044 @table @gcctabopt
23045
23046 @item -march=@var{cpu-type}
23047 @opindex march
23048 Generate instructions for the machine type @var{cpu-type}. In contrast to
23049 @option{-mtune=@var{cpu-type}}, which merely tunes the generated code
23050 for the specified @var{cpu-type}, @option{-march=@var{cpu-type}} allows GCC
23051 to generate code that may not run at all on processors other than the one
23052 indicated. Specifying @option{-march=@var{cpu-type}} implies
23053 @option{-mtune=@var{cpu-type}}.
23054
23055 The choices for @var{cpu-type} are:
23056
23057 @table @samp
23058 @item native
23059 This selects the CPU to generate code for at compilation time by determining
23060 the processor type of the compiling machine. Using @option{-march=native}
23061 enables all instruction subsets supported by the local machine (hence
23062 the result might not run on different machines). Using @option{-mtune=native}
23063 produces code optimized for the local machine under the constraints
23064 of the selected instruction set.
23065
23066 @item i386
23067 Original Intel i386 CPU@.
23068
23069 @item i486
23070 Intel i486 CPU@. (No scheduling is implemented for this chip.)
23071
23072 @item i586
23073 @itemx pentium
23074 Intel Pentium CPU with no MMX support.
23075
23076 @item lakemont
23077 Intel Lakemont MCU, based on Intel Pentium CPU.
23078
23079 @item pentium-mmx
23080 Intel Pentium MMX CPU, based on Pentium core with MMX instruction set support.
23081
23082 @item pentiumpro
23083 Intel Pentium Pro CPU@.
23084
23085 @item i686
23086 When used with @option{-march}, the Pentium Pro
23087 instruction set is used, so the code runs on all i686 family chips.
23088 When used with @option{-mtune}, it has the same meaning as @samp{generic}.
23089
23090 @item pentium2
23091 Intel Pentium II CPU, based on Pentium Pro core with MMX instruction set
23092 support.
23093
23094 @item pentium3
23095 @itemx pentium3m
23096 Intel Pentium III CPU, based on Pentium Pro core with MMX and SSE instruction
23097 set support.
23098
23099 @item pentium-m
23100 Intel Pentium M; low-power version of Intel Pentium III CPU
23101 with MMX, SSE and SSE2 instruction set support. Used by Centrino notebooks.
23102
23103 @item pentium4
23104 @itemx pentium4m
23105 Intel Pentium 4 CPU with MMX, SSE and SSE2 instruction set support.
23106
23107 @item prescott
23108 Improved version of Intel Pentium 4 CPU with MMX, SSE, SSE2 and SSE3 instruction
23109 set support.
23110
23111 @item nocona
23112 Improved version of Intel Pentium 4 CPU with 64-bit extensions, MMX, SSE,
23113 SSE2 and SSE3 instruction set support.
23114
23115 @item core2
23116 Intel Core 2 CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3 and SSSE3
23117 instruction set support.
23118
23119 @item nehalem
23120 Intel Nehalem CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
23121 SSE4.1, SSE4.2 and POPCNT instruction set support.
23122
23123 @item westmere
23124 Intel Westmere CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
23125 SSE4.1, SSE4.2, POPCNT, AES and PCLMUL instruction set support.
23126
23127 @item sandybridge
23128 Intel Sandy Bridge CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
23129 SSE4.1, SSE4.2, POPCNT, AVX, AES and PCLMUL instruction set support.
23130
23131 @item ivybridge
23132 Intel Ivy Bridge CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
23133 SSE4.1, SSE4.2, POPCNT, AVX, AES, PCLMUL, FSGSBASE, RDRND and F16C
23134 instruction set support.
23135
23136 @item haswell
23137 Intel Haswell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
23138 SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
23139 BMI, BMI2 and F16C instruction set support.
23140
23141 @item broadwell
23142 Intel Broadwell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
23143 SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
23144 BMI, BMI2, F16C, RDSEED, ADCX and PREFETCHW instruction set support.
23145
23146 @item skylake
23147 Intel Skylake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
23148 SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
23149 BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC and
23150 XSAVES instruction set support.
23151
23152 @item bonnell
23153 Intel Bonnell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3 and SSSE3
23154 instruction set support.
23155
23156 @item silvermont
23157 Intel Silvermont CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
23158 SSE4.1, SSE4.2, POPCNT, AES, PCLMUL and RDRND instruction set support.
23159
23160 @item knl
23161 Intel Knight's Landing CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
23162 SSSE3, SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
23163 BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, AVX512F, AVX512PF, AVX512ER and
23164 AVX512CD instruction set support.
23165
23166 @item skylake-avx512
23167 Intel Skylake Server CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
23168 SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
23169 BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F,
23170 AVX512VL, AVX512BW, AVX512DQ and AVX512CD instruction set support.
23171
23172 @item k6
23173 AMD K6 CPU with MMX instruction set support.
23174
23175 @item k6-2
23176 @itemx k6-3
23177 Improved versions of AMD K6 CPU with MMX and 3DNow!@: instruction set support.
23178
23179 @item athlon
23180 @itemx athlon-tbird
23181 AMD Athlon CPU with MMX, 3dNOW!, enhanced 3DNow!@: and SSE prefetch instructions
23182 support.
23183
23184 @item athlon-4
23185 @itemx athlon-xp
23186 @itemx athlon-mp
23187 Improved AMD Athlon CPU with MMX, 3DNow!, enhanced 3DNow!@: and full SSE
23188 instruction set support.
23189
23190 @item k8
23191 @itemx opteron
23192 @itemx athlon64
23193 @itemx athlon-fx
23194 Processors based on the AMD K8 core with x86-64 instruction set support,
23195 including the AMD Opteron, Athlon 64, and Athlon 64 FX processors.
23196 (This supersets MMX, SSE, SSE2, 3DNow!, enhanced 3DNow!@: and 64-bit
23197 instruction set extensions.)
23198
23199 @item k8-sse3
23200 @itemx opteron-sse3
23201 @itemx athlon64-sse3
23202 Improved versions of AMD K8 cores with SSE3 instruction set support.
23203
23204 @item amdfam10
23205 @itemx barcelona
23206 CPUs based on AMD Family 10h cores with x86-64 instruction set support. (This
23207 supersets MMX, SSE, SSE2, SSE3, SSE4A, 3DNow!, enhanced 3DNow!, ABM and 64-bit
23208 instruction set extensions.)
23209
23210 @item bdver1
23211 CPUs based on AMD Family 15h cores with x86-64 instruction set support. (This
23212 supersets FMA4, AVX, XOP, LWP, AES, PCL_MUL, CX16, MMX, SSE, SSE2, SSE3, SSE4A,
23213 SSSE3, SSE4.1, SSE4.2, ABM and 64-bit instruction set extensions.)
23214 @item bdver2
23215 AMD Family 15h core based CPUs with x86-64 instruction set support. (This
23216 supersets BMI, TBM, F16C, FMA, FMA4, AVX, XOP, LWP, AES, PCL_MUL, CX16, MMX,
23217 SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM and 64-bit instruction set
23218 extensions.)
23219 @item bdver3
23220 AMD Family 15h core based CPUs with x86-64 instruction set support. (This
23221 supersets BMI, TBM, F16C, FMA, FMA4, FSGSBASE, AVX, XOP, LWP, AES,
23222 PCL_MUL, CX16, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM and
23223 64-bit instruction set extensions.
23224 @item bdver4
23225 AMD Family 15h core based CPUs with x86-64 instruction set support. (This
23226 supersets BMI, BMI2, TBM, F16C, FMA, FMA4, FSGSBASE, AVX, AVX2, XOP, LWP,
23227 AES, PCL_MUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1,
23228 SSE4.2, ABM and 64-bit instruction set extensions.
23229
23230 @item znver1
23231 AMD Family 17h core based CPUs with x86-64 instruction set support. (This
23232 supersets BMI, BMI2, F16C, FMA, FSGSBASE, AVX, AVX2, ADCX, RDSEED, MWAITX,
23233 SHA, CLZERO, AES, PCL_MUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3,
23234 SSE4.1, SSE4.2, ABM, XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, and 64-bit
23235 instruction set extensions.
23236
23237 @item btver1
23238 CPUs based on AMD Family 14h cores with x86-64 instruction set support. (This
23239 supersets MMX, SSE, SSE2, SSE3, SSSE3, SSE4A, CX16, ABM and 64-bit
23240 instruction set extensions.)
23241
23242 @item btver2
23243 CPUs based on AMD Family 16h cores with x86-64 instruction set support. This
23244 includes MOVBE, F16C, BMI, AVX, PCL_MUL, AES, SSE4.2, SSE4.1, CX16, ABM,
23245 SSE4A, SSSE3, SSE3, SSE2, SSE, MMX and 64-bit instruction set extensions.
23246
23247 @item winchip-c6
23248 IDT WinChip C6 CPU, dealt in same way as i486 with additional MMX instruction
23249 set support.
23250
23251 @item winchip2
23252 IDT WinChip 2 CPU, dealt in same way as i486 with additional MMX and 3DNow!@:
23253 instruction set support.
23254
23255 @item c3
23256 VIA C3 CPU with MMX and 3DNow!@: instruction set support. (No scheduling is
23257 implemented for this chip.)
23258
23259 @item c3-2
23260 VIA C3-2 (Nehemiah/C5XL) CPU with MMX and SSE instruction set support.
23261 (No scheduling is
23262 implemented for this chip.)
23263
23264 @item geode
23265 AMD Geode embedded processor with MMX and 3DNow!@: instruction set support.
23266 @end table
23267
23268 @item -mtune=@var{cpu-type}
23269 @opindex mtune
23270 Tune to @var{cpu-type} everything applicable about the generated code, except
23271 for the ABI and the set of available instructions.
23272 While picking a specific @var{cpu-type} schedules things appropriately
23273 for that particular chip, the compiler does not generate any code that
23274 cannot run on the default machine type unless you use a
23275 @option{-march=@var{cpu-type}} option.
23276 For example, if GCC is configured for i686-pc-linux-gnu
23277 then @option{-mtune=pentium4} generates code that is tuned for Pentium 4
23278 but still runs on i686 machines.
23279
23280 The choices for @var{cpu-type} are the same as for @option{-march}.
23281 In addition, @option{-mtune} supports 2 extra choices for @var{cpu-type}:
23282
23283 @table @samp
23284 @item generic
23285 Produce code optimized for the most common IA32/@/AMD64/@/EM64T processors.
23286 If you know the CPU on which your code will run, then you should use
23287 the corresponding @option{-mtune} or @option{-march} option instead of
23288 @option{-mtune=generic}. But, if you do not know exactly what CPU users
23289 of your application will have, then you should use this option.
23290
23291 As new processors are deployed in the marketplace, the behavior of this
23292 option will change. Therefore, if you upgrade to a newer version of
23293 GCC, code generation controlled by this option will change to reflect
23294 the processors
23295 that are most common at the time that version of GCC is released.
23296
23297 There is no @option{-march=generic} option because @option{-march}
23298 indicates the instruction set the compiler can use, and there is no
23299 generic instruction set applicable to all processors. In contrast,
23300 @option{-mtune} indicates the processor (or, in this case, collection of
23301 processors) for which the code is optimized.
23302
23303 @item intel
23304 Produce code optimized for the most current Intel processors, which are
23305 Haswell and Silvermont for this version of GCC. If you know the CPU
23306 on which your code will run, then you should use the corresponding
23307 @option{-mtune} or @option{-march} option instead of @option{-mtune=intel}.
23308 But, if you want your application performs better on both Haswell and
23309 Silvermont, then you should use this option.
23310
23311 As new Intel processors are deployed in the marketplace, the behavior of
23312 this option will change. Therefore, if you upgrade to a newer version of
23313 GCC, code generation controlled by this option will change to reflect
23314 the most current Intel processors at the time that version of GCC is
23315 released.
23316
23317 There is no @option{-march=intel} option because @option{-march} indicates
23318 the instruction set the compiler can use, and there is no common
23319 instruction set applicable to all processors. In contrast,
23320 @option{-mtune} indicates the processor (or, in this case, collection of
23321 processors) for which the code is optimized.
23322 @end table
23323
23324 @item -mcpu=@var{cpu-type}
23325 @opindex mcpu
23326 A deprecated synonym for @option{-mtune}.
23327
23328 @item -mfpmath=@var{unit}
23329 @opindex mfpmath
23330 Generate floating-point arithmetic for selected unit @var{unit}. The choices
23331 for @var{unit} are:
23332
23333 @table @samp
23334 @item 387
23335 Use the standard 387 floating-point coprocessor present on the majority of chips and
23336 emulated otherwise. Code compiled with this option runs almost everywhere.
23337 The temporary results are computed in 80-bit precision instead of the precision
23338 specified by the type, resulting in slightly different results compared to most
23339 of other chips. See @option{-ffloat-store} for more detailed description.
23340
23341 This is the default choice for x86-32 targets.
23342
23343 @item sse
23344 Use scalar floating-point instructions present in the SSE instruction set.
23345 This instruction set is supported by Pentium III and newer chips,
23346 and in the AMD line
23347 by Athlon-4, Athlon XP and Athlon MP chips. The earlier version of the SSE
23348 instruction set supports only single-precision arithmetic, thus the double and
23349 extended-precision arithmetic are still done using 387. A later version, present
23350 only in Pentium 4 and AMD x86-64 chips, supports double-precision
23351 arithmetic too.
23352
23353 For the x86-32 compiler, you must use @option{-march=@var{cpu-type}}, @option{-msse}
23354 or @option{-msse2} switches to enable SSE extensions and make this option
23355 effective. For the x86-64 compiler, these extensions are enabled by default.
23356
23357 The resulting code should be considerably faster in the majority of cases and avoid
23358 the numerical instability problems of 387 code, but may break some existing
23359 code that expects temporaries to be 80 bits.
23360
23361 This is the default choice for the x86-64 compiler.
23362
23363 @item sse,387
23364 @itemx sse+387
23365 @itemx both
23366 Attempt to utilize both instruction sets at once. This effectively doubles the
23367 amount of available registers, and on chips with separate execution units for
23368 387 and SSE the execution resources too. Use this option with care, as it is
23369 still experimental, because the GCC register allocator does not model separate
23370 functional units well, resulting in unstable performance.
23371 @end table
23372
23373 @item -masm=@var{dialect}
23374 @opindex masm=@var{dialect}
23375 Output assembly instructions using selected @var{dialect}. Also affects
23376 which dialect is used for basic @code{asm} (@pxref{Basic Asm}) and
23377 extended @code{asm} (@pxref{Extended Asm}). Supported choices (in dialect
23378 order) are @samp{att} or @samp{intel}. The default is @samp{att}. Darwin does
23379 not support @samp{intel}.
23380
23381 @item -mieee-fp
23382 @itemx -mno-ieee-fp
23383 @opindex mieee-fp
23384 @opindex mno-ieee-fp
23385 Control whether or not the compiler uses IEEE floating-point
23386 comparisons. These correctly handle the case where the result of a
23387 comparison is unordered.
23388
23389 @item -msoft-float
23390 @opindex msoft-float
23391 Generate output containing library calls for floating point.
23392
23393 @strong{Warning:} the requisite libraries are not part of GCC@.
23394 Normally the facilities of the machine's usual C compiler are used, but
23395 this can't be done directly in cross-compilation. You must make your
23396 own arrangements to provide suitable library functions for
23397 cross-compilation.
23398
23399 On machines where a function returns floating-point results in the 80387
23400 register stack, some floating-point opcodes may be emitted even if
23401 @option{-msoft-float} is used.
23402
23403 @item -mno-fp-ret-in-387
23404 @opindex mno-fp-ret-in-387
23405 Do not use the FPU registers for return values of functions.
23406
23407 The usual calling convention has functions return values of types
23408 @code{float} and @code{double} in an FPU register, even if there
23409 is no FPU@. The idea is that the operating system should emulate
23410 an FPU@.
23411
23412 The option @option{-mno-fp-ret-in-387} causes such values to be returned
23413 in ordinary CPU registers instead.
23414
23415 @item -mno-fancy-math-387
23416 @opindex mno-fancy-math-387
23417 Some 387 emulators do not support the @code{sin}, @code{cos} and
23418 @code{sqrt} instructions for the 387. Specify this option to avoid
23419 generating those instructions. This option is the default on
23420 OpenBSD and NetBSD@. This option is overridden when @option{-march}
23421 indicates that the target CPU always has an FPU and so the
23422 instruction does not need emulation. These
23423 instructions are not generated unless you also use the
23424 @option{-funsafe-math-optimizations} switch.
23425
23426 @item -malign-double
23427 @itemx -mno-align-double
23428 @opindex malign-double
23429 @opindex mno-align-double
23430 Control whether GCC aligns @code{double}, @code{long double}, and
23431 @code{long long} variables on a two-word boundary or a one-word
23432 boundary. Aligning @code{double} variables on a two-word boundary
23433 produces code that runs somewhat faster on a Pentium at the
23434 expense of more memory.
23435
23436 On x86-64, @option{-malign-double} is enabled by default.
23437
23438 @strong{Warning:} if you use the @option{-malign-double} switch,
23439 structures containing the above types are aligned differently than
23440 the published application binary interface specifications for the x86-32
23441 and are not binary compatible with structures in code compiled
23442 without that switch.
23443
23444 @item -m96bit-long-double
23445 @itemx -m128bit-long-double
23446 @opindex m96bit-long-double
23447 @opindex m128bit-long-double
23448 These switches control the size of @code{long double} type. The x86-32
23449 application binary interface specifies the size to be 96 bits,
23450 so @option{-m96bit-long-double} is the default in 32-bit mode.
23451
23452 Modern architectures (Pentium and newer) prefer @code{long double}
23453 to be aligned to an 8- or 16-byte boundary. In arrays or structures
23454 conforming to the ABI, this is not possible. So specifying
23455 @option{-m128bit-long-double} aligns @code{long double}
23456 to a 16-byte boundary by padding the @code{long double} with an additional
23457 32-bit zero.
23458
23459 In the x86-64 compiler, @option{-m128bit-long-double} is the default choice as
23460 its ABI specifies that @code{long double} is aligned on 16-byte boundary.
23461
23462 Notice that neither of these options enable any extra precision over the x87
23463 standard of 80 bits for a @code{long double}.
23464
23465 @strong{Warning:} if you override the default value for your target ABI, this
23466 changes the size of
23467 structures and arrays containing @code{long double} variables,
23468 as well as modifying the function calling convention for functions taking
23469 @code{long double}. Hence they are not binary-compatible
23470 with code compiled without that switch.
23471
23472 @item -mlong-double-64
23473 @itemx -mlong-double-80
23474 @itemx -mlong-double-128
23475 @opindex mlong-double-64
23476 @opindex mlong-double-80
23477 @opindex mlong-double-128
23478 These switches control the size of @code{long double} type. A size
23479 of 64 bits makes the @code{long double} type equivalent to the @code{double}
23480 type. This is the default for 32-bit Bionic C library. A size
23481 of 128 bits makes the @code{long double} type equivalent to the
23482 @code{__float128} type. This is the default for 64-bit Bionic C library.
23483
23484 @strong{Warning:} if you override the default value for your target ABI, this
23485 changes the size of
23486 structures and arrays containing @code{long double} variables,
23487 as well as modifying the function calling convention for functions taking
23488 @code{long double}. Hence they are not binary-compatible
23489 with code compiled without that switch.
23490
23491 @item -malign-data=@var{type}
23492 @opindex malign-data
23493 Control how GCC aligns variables. Supported values for @var{type} are
23494 @samp{compat} uses increased alignment value compatible uses GCC 4.8
23495 and earlier, @samp{abi} uses alignment value as specified by the
23496 psABI, and @samp{cacheline} uses increased alignment value to match
23497 the cache line size. @samp{compat} is the default.
23498
23499 @item -mlarge-data-threshold=@var{threshold}
23500 @opindex mlarge-data-threshold
23501 When @option{-mcmodel=medium} is specified, data objects larger than
23502 @var{threshold} are placed in the large data section. This value must be the
23503 same across all objects linked into the binary, and defaults to 65535.
23504
23505 @item -mrtd
23506 @opindex mrtd
23507 Use a different function-calling convention, in which functions that
23508 take a fixed number of arguments return with the @code{ret @var{num}}
23509 instruction, which pops their arguments while returning. This saves one
23510 instruction in the caller since there is no need to pop the arguments
23511 there.
23512
23513 You can specify that an individual function is called with this calling
23514 sequence with the function attribute @code{stdcall}. You can also
23515 override the @option{-mrtd} option by using the function attribute
23516 @code{cdecl}. @xref{Function Attributes}.
23517
23518 @strong{Warning:} this calling convention is incompatible with the one
23519 normally used on Unix, so you cannot use it if you need to call
23520 libraries compiled with the Unix compiler.
23521
23522 Also, you must provide function prototypes for all functions that
23523 take variable numbers of arguments (including @code{printf});
23524 otherwise incorrect code is generated for calls to those
23525 functions.
23526
23527 In addition, seriously incorrect code results if you call a
23528 function with too many arguments. (Normally, extra arguments are
23529 harmlessly ignored.)
23530
23531 @item -mregparm=@var{num}
23532 @opindex mregparm
23533 Control how many registers are used to pass integer arguments. By
23534 default, no registers are used to pass arguments, and at most 3
23535 registers can be used. You can control this behavior for a specific
23536 function by using the function attribute @code{regparm}.
23537 @xref{Function Attributes}.
23538
23539 @strong{Warning:} if you use this switch, and
23540 @var{num} is nonzero, then you must build all modules with the same
23541 value, including any libraries. This includes the system libraries and
23542 startup modules.
23543
23544 @item -msseregparm
23545 @opindex msseregparm
23546 Use SSE register passing conventions for float and double arguments
23547 and return values. You can control this behavior for a specific
23548 function by using the function attribute @code{sseregparm}.
23549 @xref{Function Attributes}.
23550
23551 @strong{Warning:} if you use this switch then you must build all
23552 modules with the same value, including any libraries. This includes
23553 the system libraries and startup modules.
23554
23555 @item -mvect8-ret-in-mem
23556 @opindex mvect8-ret-in-mem
23557 Return 8-byte vectors in memory instead of MMX registers. This is the
23558 default on Solaris@tie{}8 and 9 and VxWorks to match the ABI of the Sun
23559 Studio compilers until version 12. Later compiler versions (starting
23560 with Studio 12 Update@tie{}1) follow the ABI used by other x86 targets, which
23561 is the default on Solaris@tie{}10 and later. @emph{Only} use this option if
23562 you need to remain compatible with existing code produced by those
23563 previous compiler versions or older versions of GCC@.
23564
23565 @item -mpc32
23566 @itemx -mpc64
23567 @itemx -mpc80
23568 @opindex mpc32
23569 @opindex mpc64
23570 @opindex mpc80
23571
23572 Set 80387 floating-point precision to 32, 64 or 80 bits. When @option{-mpc32}
23573 is specified, the significands of results of floating-point operations are
23574 rounded to 24 bits (single precision); @option{-mpc64} rounds the
23575 significands of results of floating-point operations to 53 bits (double
23576 precision) and @option{-mpc80} rounds the significands of results of
23577 floating-point operations to 64 bits (extended double precision), which is
23578 the default. When this option is used, floating-point operations in higher
23579 precisions are not available to the programmer without setting the FPU
23580 control word explicitly.
23581
23582 Setting the rounding of floating-point operations to less than the default
23583 80 bits can speed some programs by 2% or more. Note that some mathematical
23584 libraries assume that extended-precision (80-bit) floating-point operations
23585 are enabled by default; routines in such libraries could suffer significant
23586 loss of accuracy, typically through so-called ``catastrophic cancellation'',
23587 when this option is used to set the precision to less than extended precision.
23588
23589 @item -mstackrealign
23590 @opindex mstackrealign
23591 Realign the stack at entry. On the x86, the @option{-mstackrealign}
23592 option generates an alternate prologue and epilogue that realigns the
23593 run-time stack if necessary. This supports mixing legacy codes that keep
23594 4-byte stack alignment with modern codes that keep 16-byte stack alignment for
23595 SSE compatibility. See also the attribute @code{force_align_arg_pointer},
23596 applicable to individual functions.
23597
23598 @item -mpreferred-stack-boundary=@var{num}
23599 @opindex mpreferred-stack-boundary
23600 Attempt to keep the stack boundary aligned to a 2 raised to @var{num}
23601 byte boundary. If @option{-mpreferred-stack-boundary} is not specified,
23602 the default is 4 (16 bytes or 128 bits).
23603
23604 @strong{Warning:} When generating code for the x86-64 architecture with
23605 SSE extensions disabled, @option{-mpreferred-stack-boundary=3} can be
23606 used to keep the stack boundary aligned to 8 byte boundary. Since
23607 x86-64 ABI require 16 byte stack alignment, this is ABI incompatible and
23608 intended to be used in controlled environment where stack space is
23609 important limitation. This option leads to wrong code when functions
23610 compiled with 16 byte stack alignment (such as functions from a standard
23611 library) are called with misaligned stack. In this case, SSE
23612 instructions may lead to misaligned memory access traps. In addition,
23613 variable arguments are handled incorrectly for 16 byte aligned
23614 objects (including x87 long double and __int128), leading to wrong
23615 results. You must build all modules with
23616 @option{-mpreferred-stack-boundary=3}, including any libraries. This
23617 includes the system libraries and startup modules.
23618
23619 @item -mincoming-stack-boundary=@var{num}
23620 @opindex mincoming-stack-boundary
23621 Assume the incoming stack is aligned to a 2 raised to @var{num} byte
23622 boundary. If @option{-mincoming-stack-boundary} is not specified,
23623 the one specified by @option{-mpreferred-stack-boundary} is used.
23624
23625 On Pentium and Pentium Pro, @code{double} and @code{long double} values
23626 should be aligned to an 8-byte boundary (see @option{-malign-double}) or
23627 suffer significant run time performance penalties. On Pentium III, the
23628 Streaming SIMD Extension (SSE) data type @code{__m128} may not work
23629 properly if it is not 16-byte aligned.
23630
23631 To ensure proper alignment of this values on the stack, the stack boundary
23632 must be as aligned as that required by any value stored on the stack.
23633 Further, every function must be generated such that it keeps the stack
23634 aligned. Thus calling a function compiled with a higher preferred
23635 stack boundary from a function compiled with a lower preferred stack
23636 boundary most likely misaligns the stack. It is recommended that
23637 libraries that use callbacks always use the default setting.
23638
23639 This extra alignment does consume extra stack space, and generally
23640 increases code size. Code that is sensitive to stack space usage, such
23641 as embedded systems and operating system kernels, may want to reduce the
23642 preferred alignment to @option{-mpreferred-stack-boundary=2}.
23643
23644 @need 200
23645 @item -mmmx
23646 @opindex mmmx
23647 @need 200
23648 @itemx -msse
23649 @opindex msse
23650 @need 200
23651 @itemx -msse2
23652 @opindex msse2
23653 @need 200
23654 @itemx -msse3
23655 @opindex msse3
23656 @need 200
23657 @itemx -mssse3
23658 @opindex mssse3
23659 @need 200
23660 @itemx -msse4
23661 @opindex msse4
23662 @need 200
23663 @itemx -msse4a
23664 @opindex msse4a
23665 @need 200
23666 @itemx -msse4.1
23667 @opindex msse4.1
23668 @need 200
23669 @itemx -msse4.2
23670 @opindex msse4.2
23671 @need 200
23672 @itemx -mavx
23673 @opindex mavx
23674 @need 200
23675 @itemx -mavx2
23676 @opindex mavx2
23677 @need 200
23678 @itemx -mavx512f
23679 @opindex mavx512f
23680 @need 200
23681 @itemx -mavx512pf
23682 @opindex mavx512pf
23683 @need 200
23684 @itemx -mavx512er
23685 @opindex mavx512er
23686 @need 200
23687 @itemx -mavx512cd
23688 @opindex mavx512cd
23689 @need 200
23690 @itemx -mavx512vl
23691 @opindex mavx512vl
23692 @need 200
23693 @itemx -mavx512bw
23694 @opindex mavx512bw
23695 @need 200
23696 @itemx -mavx512dq
23697 @opindex mavx512dq
23698 @need 200
23699 @itemx -mavx512ifma
23700 @opindex mavx512ifma
23701 @need 200
23702 @itemx -mavx512vbmi
23703 @opindex mavx512vbmi
23704 @need 200
23705 @itemx -msha
23706 @opindex msha
23707 @need 200
23708 @itemx -maes
23709 @opindex maes
23710 @need 200
23711 @itemx -mpclmul
23712 @opindex mpclmul
23713 @need 200
23714 @itemx -mclfushopt
23715 @opindex mclfushopt
23716 @need 200
23717 @itemx -mfsgsbase
23718 @opindex mfsgsbase
23719 @need 200
23720 @itemx -mrdrnd
23721 @opindex mrdrnd
23722 @need 200
23723 @itemx -mf16c
23724 @opindex mf16c
23725 @need 200
23726 @itemx -mfma
23727 @opindex mfma
23728 @need 200
23729 @itemx -mfma4
23730 @opindex mfma4
23731 @need 200
23732 @itemx -mprefetchwt1
23733 @opindex mprefetchwt1
23734 @need 200
23735 @itemx -mxop
23736 @opindex mxop
23737 @need 200
23738 @itemx -mlwp
23739 @opindex mlwp
23740 @need 200
23741 @itemx -m3dnow
23742 @opindex m3dnow
23743 @need 200
23744 @itemx -mpopcnt
23745 @opindex mpopcnt
23746 @need 200
23747 @itemx -mabm
23748 @opindex mabm
23749 @need 200
23750 @itemx -mbmi
23751 @opindex mbmi
23752 @need 200
23753 @itemx -mbmi2
23754 @need 200
23755 @itemx -mlzcnt
23756 @opindex mlzcnt
23757 @need 200
23758 @itemx -mfxsr
23759 @opindex mfxsr
23760 @need 200
23761 @itemx -mxsave
23762 @opindex mxsave
23763 @need 200
23764 @itemx -mxsaveopt
23765 @opindex mxsaveopt
23766 @need 200
23767 @itemx -mxsavec
23768 @opindex mxsavec
23769 @need 200
23770 @itemx -mxsaves
23771 @opindex mxsaves
23772 @need 200
23773 @itemx -mrtm
23774 @opindex mrtm
23775 @need 200
23776 @itemx -mtbm
23777 @opindex mtbm
23778 @need 200
23779 @itemx -mmpx
23780 @opindex mmpx
23781 @need 200
23782 @itemx -mmwaitx
23783 @opindex mmwaitx
23784 @need 200
23785 @itemx -mclzero
23786 @opindex mclzero
23787 @itemx -mpku
23788 @opindex mpku
23789 These switches enable the use of instructions in the MMX, SSE,
23790 SSE2, SSE3, SSSE3, SSE4.1, AVX, AVX2, AVX512F, AVX512PF, AVX512ER, AVX512CD,
23791 SHA, AES, PCLMUL, FSGSBASE, RDRND, F16C, FMA, SSE4A, FMA4, XOP, LWP, ABM,
23792 AVX512VL, AVX512BW, AVX512DQ, AVX512IFMA AVX512VBMI, BMI, BMI2, FXSR,
23793 XSAVE, XSAVEOPT, LZCNT, RTM, MPX, MWAITX, PKU or 3DNow!@:
23794 extended instruction sets. Each has a corresponding @option{-mno-} option
23795 to disable use of these instructions.
23796
23797 These extensions are also available as built-in functions: see
23798 @ref{x86 Built-in Functions}, for details of the functions enabled and
23799 disabled by these switches.
23800
23801 To generate SSE/SSE2 instructions automatically from floating-point
23802 code (as opposed to 387 instructions), see @option{-mfpmath=sse}.
23803
23804 GCC depresses SSEx instructions when @option{-mavx} is used. Instead, it
23805 generates new AVX instructions or AVX equivalence for all SSEx instructions
23806 when needed.
23807
23808 These options enable GCC to use these extended instructions in
23809 generated code, even without @option{-mfpmath=sse}. Applications that
23810 perform run-time CPU detection must compile separate files for each
23811 supported architecture, using the appropriate flags. In particular,
23812 the file containing the CPU detection code should be compiled without
23813 these options.
23814
23815 @item -mdump-tune-features
23816 @opindex mdump-tune-features
23817 This option instructs GCC to dump the names of the x86 performance
23818 tuning features and default settings. The names can be used in
23819 @option{-mtune-ctrl=@var{feature-list}}.
23820
23821 @item -mtune-ctrl=@var{feature-list}
23822 @opindex mtune-ctrl=@var{feature-list}
23823 This option is used to do fine grain control of x86 code generation features.
23824 @var{feature-list} is a comma separated list of @var{feature} names. See also
23825 @option{-mdump-tune-features}. When specified, the @var{feature} is turned
23826 on if it is not preceded with @samp{^}, otherwise, it is turned off.
23827 @option{-mtune-ctrl=@var{feature-list}} is intended to be used by GCC
23828 developers. Using it may lead to code paths not covered by testing and can
23829 potentially result in compiler ICEs or runtime errors.
23830
23831 @item -mno-default
23832 @opindex mno-default
23833 This option instructs GCC to turn off all tunable features. See also
23834 @option{-mtune-ctrl=@var{feature-list}} and @option{-mdump-tune-features}.
23835
23836 @item -mcld
23837 @opindex mcld
23838 This option instructs GCC to emit a @code{cld} instruction in the prologue
23839 of functions that use string instructions. String instructions depend on
23840 the DF flag to select between autoincrement or autodecrement mode. While the
23841 ABI specifies the DF flag to be cleared on function entry, some operating
23842 systems violate this specification by not clearing the DF flag in their
23843 exception dispatchers. The exception handler can be invoked with the DF flag
23844 set, which leads to wrong direction mode when string instructions are used.
23845 This option can be enabled by default on 32-bit x86 targets by configuring
23846 GCC with the @option{--enable-cld} configure option. Generation of @code{cld}
23847 instructions can be suppressed with the @option{-mno-cld} compiler option
23848 in this case.
23849
23850 @item -mvzeroupper
23851 @opindex mvzeroupper
23852 This option instructs GCC to emit a @code{vzeroupper} instruction
23853 before a transfer of control flow out of the function to minimize
23854 the AVX to SSE transition penalty as well as remove unnecessary @code{zeroupper}
23855 intrinsics.
23856
23857 @item -mprefer-avx128
23858 @opindex mprefer-avx128
23859 This option instructs GCC to use 128-bit AVX instructions instead of
23860 256-bit AVX instructions in the auto-vectorizer.
23861
23862 @item -mcx16
23863 @opindex mcx16
23864 This option enables GCC to generate @code{CMPXCHG16B} instructions.
23865 @code{CMPXCHG16B} allows for atomic operations on 128-bit double quadword
23866 (or oword) data types.
23867 This is useful for high-resolution counters that can be updated
23868 by multiple processors (or cores). This instruction is generated as part of
23869 atomic built-in functions: see @ref{__sync Builtins} or
23870 @ref{__atomic Builtins} for details.
23871
23872 @item -msahf
23873 @opindex msahf
23874 This option enables generation of @code{SAHF} instructions in 64-bit code.
23875 Early Intel Pentium 4 CPUs with Intel 64 support,
23876 prior to the introduction of Pentium 4 G1 step in December 2005,
23877 lacked the @code{LAHF} and @code{SAHF} instructions
23878 which are supported by AMD64.
23879 These are load and store instructions, respectively, for certain status flags.
23880 In 64-bit mode, the @code{SAHF} instruction is used to optimize @code{fmod},
23881 @code{drem}, and @code{remainder} built-in functions;
23882 see @ref{Other Builtins} for details.
23883
23884 @item -mmovbe
23885 @opindex mmovbe
23886 This option enables use of the @code{movbe} instruction to implement
23887 @code{__builtin_bswap32} and @code{__builtin_bswap64}.
23888
23889 @item -mcrc32
23890 @opindex mcrc32
23891 This option enables built-in functions @code{__builtin_ia32_crc32qi},
23892 @code{__builtin_ia32_crc32hi}, @code{__builtin_ia32_crc32si} and
23893 @code{__builtin_ia32_crc32di} to generate the @code{crc32} machine instruction.
23894
23895 @item -mrecip
23896 @opindex mrecip
23897 This option enables use of @code{RCPSS} and @code{RSQRTSS} instructions
23898 (and their vectorized variants @code{RCPPS} and @code{RSQRTPS})
23899 with an additional Newton-Raphson step
23900 to increase precision instead of @code{DIVSS} and @code{SQRTSS}
23901 (and their vectorized
23902 variants) for single-precision floating-point arguments. These instructions
23903 are generated only when @option{-funsafe-math-optimizations} is enabled
23904 together with @option{-ffinite-math-only} and @option{-fno-trapping-math}.
23905 Note that while the throughput of the sequence is higher than the throughput
23906 of the non-reciprocal instruction, the precision of the sequence can be
23907 decreased by up to 2 ulp (i.e. the inverse of 1.0 equals 0.99999994).
23908
23909 Note that GCC implements @code{1.0f/sqrtf(@var{x})} in terms of @code{RSQRTSS}
23910 (or @code{RSQRTPS}) already with @option{-ffast-math} (or the above option
23911 combination), and doesn't need @option{-mrecip}.
23912
23913 Also note that GCC emits the above sequence with additional Newton-Raphson step
23914 for vectorized single-float division and vectorized @code{sqrtf(@var{x})}
23915 already with @option{-ffast-math} (or the above option combination), and
23916 doesn't need @option{-mrecip}.
23917
23918 @item -mrecip=@var{opt}
23919 @opindex mrecip=opt
23920 This option controls which reciprocal estimate instructions
23921 may be used. @var{opt} is a comma-separated list of options, which may
23922 be preceded by a @samp{!} to invert the option:
23923
23924 @table @samp
23925 @item all
23926 Enable all estimate instructions.
23927
23928 @item default
23929 Enable the default instructions, equivalent to @option{-mrecip}.
23930
23931 @item none
23932 Disable all estimate instructions, equivalent to @option{-mno-recip}.
23933
23934 @item div
23935 Enable the approximation for scalar division.
23936
23937 @item vec-div
23938 Enable the approximation for vectorized division.
23939
23940 @item sqrt
23941 Enable the approximation for scalar square root.
23942
23943 @item vec-sqrt
23944 Enable the approximation for vectorized square root.
23945 @end table
23946
23947 So, for example, @option{-mrecip=all,!sqrt} enables
23948 all of the reciprocal approximations, except for square root.
23949
23950 @item -mveclibabi=@var{type}
23951 @opindex mveclibabi
23952 Specifies the ABI type to use for vectorizing intrinsics using an
23953 external library. Supported values for @var{type} are @samp{svml}
23954 for the Intel short
23955 vector math library and @samp{acml} for the AMD math core library.
23956 To use this option, both @option{-ftree-vectorize} and
23957 @option{-funsafe-math-optimizations} have to be enabled, and an SVML or ACML
23958 ABI-compatible library must be specified at link time.
23959
23960 GCC currently emits calls to @code{vmldExp2},
23961 @code{vmldLn2}, @code{vmldLog102}, @code{vmldLog102}, @code{vmldPow2},
23962 @code{vmldTanh2}, @code{vmldTan2}, @code{vmldAtan2}, @code{vmldAtanh2},
23963 @code{vmldCbrt2}, @code{vmldSinh2}, @code{vmldSin2}, @code{vmldAsinh2},
23964 @code{vmldAsin2}, @code{vmldCosh2}, @code{vmldCos2}, @code{vmldAcosh2},
23965 @code{vmldAcos2}, @code{vmlsExp4}, @code{vmlsLn4}, @code{vmlsLog104},
23966 @code{vmlsLog104}, @code{vmlsPow4}, @code{vmlsTanh4}, @code{vmlsTan4},
23967 @code{vmlsAtan4}, @code{vmlsAtanh4}, @code{vmlsCbrt4}, @code{vmlsSinh4},
23968 @code{vmlsSin4}, @code{vmlsAsinh4}, @code{vmlsAsin4}, @code{vmlsCosh4},
23969 @code{vmlsCos4}, @code{vmlsAcosh4} and @code{vmlsAcos4} for corresponding
23970 function type when @option{-mveclibabi=svml} is used, and @code{__vrd2_sin},
23971 @code{__vrd2_cos}, @code{__vrd2_exp}, @code{__vrd2_log}, @code{__vrd2_log2},
23972 @code{__vrd2_log10}, @code{__vrs4_sinf}, @code{__vrs4_cosf},
23973 @code{__vrs4_expf}, @code{__vrs4_logf}, @code{__vrs4_log2f},
23974 @code{__vrs4_log10f} and @code{__vrs4_powf} for the corresponding function type
23975 when @option{-mveclibabi=acml} is used.
23976
23977 @item -mabi=@var{name}
23978 @opindex mabi
23979 Generate code for the specified calling convention. Permissible values
23980 are @samp{sysv} for the ABI used on GNU/Linux and other systems, and
23981 @samp{ms} for the Microsoft ABI. The default is to use the Microsoft
23982 ABI when targeting Microsoft Windows and the SysV ABI on all other systems.
23983 You can control this behavior for specific functions by
23984 using the function attributes @code{ms_abi} and @code{sysv_abi}.
23985 @xref{Function Attributes}.
23986
23987 @item -mtls-dialect=@var{type}
23988 @opindex mtls-dialect
23989 Generate code to access thread-local storage using the @samp{gnu} or
23990 @samp{gnu2} conventions. @samp{gnu} is the conservative default;
23991 @samp{gnu2} is more efficient, but it may add compile- and run-time
23992 requirements that cannot be satisfied on all systems.
23993
23994 @item -mpush-args
23995 @itemx -mno-push-args
23996 @opindex mpush-args
23997 @opindex mno-push-args
23998 Use PUSH operations to store outgoing parameters. This method is shorter
23999 and usually equally fast as method using SUB/MOV operations and is enabled
24000 by default. In some cases disabling it may improve performance because of
24001 improved scheduling and reduced dependencies.
24002
24003 @item -maccumulate-outgoing-args
24004 @opindex maccumulate-outgoing-args
24005 If enabled, the maximum amount of space required for outgoing arguments is
24006 computed in the function prologue. This is faster on most modern CPUs
24007 because of reduced dependencies, improved scheduling and reduced stack usage
24008 when the preferred stack boundary is not equal to 2. The drawback is a notable
24009 increase in code size. This switch implies @option{-mno-push-args}.
24010
24011 @item -mthreads
24012 @opindex mthreads
24013 Support thread-safe exception handling on MinGW. Programs that rely
24014 on thread-safe exception handling must compile and link all code with the
24015 @option{-mthreads} option. When compiling, @option{-mthreads} defines
24016 @option{-D_MT}; when linking, it links in a special thread helper library
24017 @option{-lmingwthrd} which cleans up per-thread exception-handling data.
24018
24019 @item -mms-bitfields
24020 @itemx -mno-ms-bitfields
24021 @opindex mms-bitfields
24022 @opindex mno-ms-bitfields
24023
24024 Enable/disable bit-field layout compatible with the native Microsoft
24025 Windows compiler.
24026
24027 If @code{packed} is used on a structure, or if bit-fields are used,
24028 it may be that the Microsoft ABI lays out the structure differently
24029 than the way GCC normally does. Particularly when moving packed
24030 data between functions compiled with GCC and the native Microsoft compiler
24031 (either via function call or as data in a file), it may be necessary to access
24032 either format.
24033
24034 This option is enabled by default for Microsoft Windows
24035 targets. This behavior can also be controlled locally by use of variable
24036 or type attributes. For more information, see @ref{x86 Variable Attributes}
24037 and @ref{x86 Type Attributes}.
24038
24039 The Microsoft structure layout algorithm is fairly simple with the exception
24040 of the bit-field packing.
24041 The padding and alignment of members of structures and whether a bit-field
24042 can straddle a storage-unit boundary are determine by these rules:
24043
24044 @enumerate
24045 @item Structure members are stored sequentially in the order in which they are
24046 declared: the first member has the lowest memory address and the last member
24047 the highest.
24048
24049 @item Every data object has an alignment requirement. The alignment requirement
24050 for all data except structures, unions, and arrays is either the size of the
24051 object or the current packing size (specified with either the
24052 @code{aligned} attribute or the @code{pack} pragma),
24053 whichever is less. For structures, unions, and arrays,
24054 the alignment requirement is the largest alignment requirement of its members.
24055 Every object is allocated an offset so that:
24056
24057 @smallexample
24058 offset % alignment_requirement == 0
24059 @end smallexample
24060
24061 @item Adjacent bit-fields are packed into the same 1-, 2-, or 4-byte allocation
24062 unit if the integral types are the same size and if the next bit-field fits
24063 into the current allocation unit without crossing the boundary imposed by the
24064 common alignment requirements of the bit-fields.
24065 @end enumerate
24066
24067 MSVC interprets zero-length bit-fields in the following ways:
24068
24069 @enumerate
24070 @item If a zero-length bit-field is inserted between two bit-fields that
24071 are normally coalesced, the bit-fields are not coalesced.
24072
24073 For example:
24074
24075 @smallexample
24076 struct
24077 @{
24078 unsigned long bf_1 : 12;
24079 unsigned long : 0;
24080 unsigned long bf_2 : 12;
24081 @} t1;
24082 @end smallexample
24083
24084 @noindent
24085 The size of @code{t1} is 8 bytes with the zero-length bit-field. If the
24086 zero-length bit-field were removed, @code{t1}'s size would be 4 bytes.
24087
24088 @item If a zero-length bit-field is inserted after a bit-field, @code{foo}, and the
24089 alignment of the zero-length bit-field is greater than the member that follows it,
24090 @code{bar}, @code{bar} is aligned as the type of the zero-length bit-field.
24091
24092 For example:
24093
24094 @smallexample
24095 struct
24096 @{
24097 char foo : 4;
24098 short : 0;
24099 char bar;
24100 @} t2;
24101
24102 struct
24103 @{
24104 char foo : 4;
24105 short : 0;
24106 double bar;
24107 @} t3;
24108 @end smallexample
24109
24110 @noindent
24111 For @code{t2}, @code{bar} is placed at offset 2, rather than offset 1.
24112 Accordingly, the size of @code{t2} is 4. For @code{t3}, the zero-length
24113 bit-field does not affect the alignment of @code{bar} or, as a result, the size
24114 of the structure.
24115
24116 Taking this into account, it is important to note the following:
24117
24118 @enumerate
24119 @item If a zero-length bit-field follows a normal bit-field, the type of the
24120 zero-length bit-field may affect the alignment of the structure as whole. For
24121 example, @code{t2} has a size of 4 bytes, since the zero-length bit-field follows a
24122 normal bit-field, and is of type short.
24123
24124 @item Even if a zero-length bit-field is not followed by a normal bit-field, it may
24125 still affect the alignment of the structure:
24126
24127 @smallexample
24128 struct
24129 @{
24130 char foo : 6;
24131 long : 0;
24132 @} t4;
24133 @end smallexample
24134
24135 @noindent
24136 Here, @code{t4} takes up 4 bytes.
24137 @end enumerate
24138
24139 @item Zero-length bit-fields following non-bit-field members are ignored:
24140
24141 @smallexample
24142 struct
24143 @{
24144 char foo;
24145 long : 0;
24146 char bar;
24147 @} t5;
24148 @end smallexample
24149
24150 @noindent
24151 Here, @code{t5} takes up 2 bytes.
24152 @end enumerate
24153
24154
24155 @item -mno-align-stringops
24156 @opindex mno-align-stringops
24157 Do not align the destination of inlined string operations. This switch reduces
24158 code size and improves performance in case the destination is already aligned,
24159 but GCC doesn't know about it.
24160
24161 @item -minline-all-stringops
24162 @opindex minline-all-stringops
24163 By default GCC inlines string operations only when the destination is
24164 known to be aligned to least a 4-byte boundary.
24165 This enables more inlining and increases code
24166 size, but may improve performance of code that depends on fast
24167 @code{memcpy}, @code{strlen},
24168 and @code{memset} for short lengths.
24169
24170 @item -minline-stringops-dynamically
24171 @opindex minline-stringops-dynamically
24172 For string operations of unknown size, use run-time checks with
24173 inline code for small blocks and a library call for large blocks.
24174
24175 @item -mstringop-strategy=@var{alg}
24176 @opindex mstringop-strategy=@var{alg}
24177 Override the internal decision heuristic for the particular algorithm to use
24178 for inlining string operations. The allowed values for @var{alg} are:
24179
24180 @table @samp
24181 @item rep_byte
24182 @itemx rep_4byte
24183 @itemx rep_8byte
24184 Expand using i386 @code{rep} prefix of the specified size.
24185
24186 @item byte_loop
24187 @itemx loop
24188 @itemx unrolled_loop
24189 Expand into an inline loop.
24190
24191 @item libcall
24192 Always use a library call.
24193 @end table
24194
24195 @item -mmemcpy-strategy=@var{strategy}
24196 @opindex mmemcpy-strategy=@var{strategy}
24197 Override the internal decision heuristic to decide if @code{__builtin_memcpy}
24198 should be inlined and what inline algorithm to use when the expected size
24199 of the copy operation is known. @var{strategy}
24200 is a comma-separated list of @var{alg}:@var{max_size}:@var{dest_align} triplets.
24201 @var{alg} is specified in @option{-mstringop-strategy}, @var{max_size} specifies
24202 the max byte size with which inline algorithm @var{alg} is allowed. For the last
24203 triplet, the @var{max_size} must be @code{-1}. The @var{max_size} of the triplets
24204 in the list must be specified in increasing order. The minimal byte size for
24205 @var{alg} is @code{0} for the first triplet and @code{@var{max_size} + 1} of the
24206 preceding range.
24207
24208 @item -mmemset-strategy=@var{strategy}
24209 @opindex mmemset-strategy=@var{strategy}
24210 The option is similar to @option{-mmemcpy-strategy=} except that it is to control
24211 @code{__builtin_memset} expansion.
24212
24213 @item -momit-leaf-frame-pointer
24214 @opindex momit-leaf-frame-pointer
24215 Don't keep the frame pointer in a register for leaf functions. This
24216 avoids the instructions to save, set up, and restore frame pointers and
24217 makes an extra register available in leaf functions. The option
24218 @option{-fomit-leaf-frame-pointer} removes the frame pointer for leaf functions,
24219 which might make debugging harder.
24220
24221 @item -mtls-direct-seg-refs
24222 @itemx -mno-tls-direct-seg-refs
24223 @opindex mtls-direct-seg-refs
24224 Controls whether TLS variables may be accessed with offsets from the
24225 TLS segment register (@code{%gs} for 32-bit, @code{%fs} for 64-bit),
24226 or whether the thread base pointer must be added. Whether or not this
24227 is valid depends on the operating system, and whether it maps the
24228 segment to cover the entire TLS area.
24229
24230 For systems that use the GNU C Library, the default is on.
24231
24232 @item -msse2avx
24233 @itemx -mno-sse2avx
24234 @opindex msse2avx
24235 Specify that the assembler should encode SSE instructions with VEX
24236 prefix. The option @option{-mavx} turns this on by default.
24237
24238 @item -mfentry
24239 @itemx -mno-fentry
24240 @opindex mfentry
24241 If profiling is active (@option{-pg}), put the profiling
24242 counter call before the prologue.
24243 Note: On x86 architectures the attribute @code{ms_hook_prologue}
24244 isn't possible at the moment for @option{-mfentry} and @option{-pg}.
24245
24246 @item -mrecord-mcount
24247 @itemx -mno-record-mcount
24248 @opindex mrecord-mcount
24249 If profiling is active (@option{-pg}), generate a __mcount_loc section
24250 that contains pointers to each profiling call. This is useful for
24251 automatically patching and out calls.
24252
24253 @item -mnop-mcount
24254 @itemx -mno-nop-mcount
24255 @opindex mnop-mcount
24256 If profiling is active (@option{-pg}), generate the calls to
24257 the profiling functions as nops. This is useful when they
24258 should be patched in later dynamically. This is likely only
24259 useful together with @option{-mrecord-mcount}.
24260
24261 @item -mskip-rax-setup
24262 @itemx -mno-skip-rax-setup
24263 @opindex mskip-rax-setup
24264 When generating code for the x86-64 architecture with SSE extensions
24265 disabled, @option{-mskip-rax-setup} can be used to skip setting up RAX
24266 register when there are no variable arguments passed in vector registers.
24267
24268 @strong{Warning:} Since RAX register is used to avoid unnecessarily
24269 saving vector registers on stack when passing variable arguments, the
24270 impacts of this option are callees may waste some stack space,
24271 misbehave or jump to a random location. GCC 4.4 or newer don't have
24272 those issues, regardless the RAX register value.
24273
24274 @item -m8bit-idiv
24275 @itemx -mno-8bit-idiv
24276 @opindex m8bit-idiv
24277 On some processors, like Intel Atom, 8-bit unsigned integer divide is
24278 much faster than 32-bit/64-bit integer divide. This option generates a
24279 run-time check. If both dividend and divisor are within range of 0
24280 to 255, 8-bit unsigned integer divide is used instead of
24281 32-bit/64-bit integer divide.
24282
24283 @item -mavx256-split-unaligned-load
24284 @itemx -mavx256-split-unaligned-store
24285 @opindex mavx256-split-unaligned-load
24286 @opindex mavx256-split-unaligned-store
24287 Split 32-byte AVX unaligned load and store.
24288
24289 @item -mstack-protector-guard=@var{guard}
24290 @opindex mstack-protector-guard=@var{guard}
24291 Generate stack protection code using canary at @var{guard}. Supported
24292 locations are @samp{global} for global canary or @samp{tls} for per-thread
24293 canary in the TLS block (the default). This option has effect only when
24294 @option{-fstack-protector} or @option{-fstack-protector-all} is specified.
24295
24296 @item -mmitigate-rop
24297 @opindex mmitigate-rop
24298 Try to avoid generating code sequences that contain unintended return
24299 opcodes, to mitigate against certain forms of attack. At the moment,
24300 this option is limited in what it can do and should not be relied
24301 on to provide serious protection.
24302
24303 @item -mgeneral-regs-only
24304 @opindex mgeneral-regs-only
24305 Generate code that uses only the general-purpose registers. This
24306 prevents the compiler from using floating-point, vector, mask and bound
24307 registers.
24308
24309 @end table
24310
24311 These @samp{-m} switches are supported in addition to the above
24312 on x86-64 processors in 64-bit environments.
24313
24314 @table @gcctabopt
24315 @item -m32
24316 @itemx -m64
24317 @itemx -mx32
24318 @itemx -m16
24319 @itemx -miamcu
24320 @opindex m32
24321 @opindex m64
24322 @opindex mx32
24323 @opindex m16
24324 @opindex miamcu
24325 Generate code for a 16-bit, 32-bit or 64-bit environment.
24326 The @option{-m32} option sets @code{int}, @code{long}, and pointer types
24327 to 32 bits, and
24328 generates code that runs on any i386 system.
24329
24330 The @option{-m64} option sets @code{int} to 32 bits and @code{long} and pointer
24331 types to 64 bits, and generates code for the x86-64 architecture.
24332 For Darwin only the @option{-m64} option also turns off the @option{-fno-pic}
24333 and @option{-mdynamic-no-pic} options.
24334
24335 The @option{-mx32} option sets @code{int}, @code{long}, and pointer types
24336 to 32 bits, and
24337 generates code for the x86-64 architecture.
24338
24339 The @option{-m16} option is the same as @option{-m32}, except for that
24340 it outputs the @code{.code16gcc} assembly directive at the beginning of
24341 the assembly output so that the binary can run in 16-bit mode.
24342
24343 The @option{-miamcu} option generates code which conforms to Intel MCU
24344 psABI. It requires the @option{-m32} option to be turned on.
24345
24346 @item -mno-red-zone
24347 @opindex mno-red-zone
24348 Do not use a so-called ``red zone'' for x86-64 code. The red zone is mandated
24349 by the x86-64 ABI; it is a 128-byte area beyond the location of the
24350 stack pointer that is not modified by signal or interrupt handlers
24351 and therefore can be used for temporary data without adjusting the stack
24352 pointer. The flag @option{-mno-red-zone} disables this red zone.
24353
24354 @item -mcmodel=small
24355 @opindex mcmodel=small
24356 Generate code for the small code model: the program and its symbols must
24357 be linked in the lower 2 GB of the address space. Pointers are 64 bits.
24358 Programs can be statically or dynamically linked. This is the default
24359 code model.
24360
24361 @item -mcmodel=kernel
24362 @opindex mcmodel=kernel
24363 Generate code for the kernel code model. The kernel runs in the
24364 negative 2 GB of the address space.
24365 This model has to be used for Linux kernel code.
24366
24367 @item -mcmodel=medium
24368 @opindex mcmodel=medium
24369 Generate code for the medium model: the program is linked in the lower 2
24370 GB of the address space. Small symbols are also placed there. Symbols
24371 with sizes larger than @option{-mlarge-data-threshold} are put into
24372 large data or BSS sections and can be located above 2GB. Programs can
24373 be statically or dynamically linked.
24374
24375 @item -mcmodel=large
24376 @opindex mcmodel=large
24377 Generate code for the large model. This model makes no assumptions
24378 about addresses and sizes of sections.
24379
24380 @item -maddress-mode=long
24381 @opindex maddress-mode=long
24382 Generate code for long address mode. This is only supported for 64-bit
24383 and x32 environments. It is the default address mode for 64-bit
24384 environments.
24385
24386 @item -maddress-mode=short
24387 @opindex maddress-mode=short
24388 Generate code for short address mode. This is only supported for 32-bit
24389 and x32 environments. It is the default address mode for 32-bit and
24390 x32 environments.
24391 @end table
24392
24393 @node x86 Windows Options
24394 @subsection x86 Windows Options
24395 @cindex x86 Windows Options
24396 @cindex Windows Options for x86
24397
24398 These additional options are available for Microsoft Windows targets:
24399
24400 @table @gcctabopt
24401 @item -mconsole
24402 @opindex mconsole
24403 This option
24404 specifies that a console application is to be generated, by
24405 instructing the linker to set the PE header subsystem type
24406 required for console applications.
24407 This option is available for Cygwin and MinGW targets and is
24408 enabled by default on those targets.
24409
24410 @item -mdll
24411 @opindex mdll
24412 This option is available for Cygwin and MinGW targets. It
24413 specifies that a DLL---a dynamic link library---is to be
24414 generated, enabling the selection of the required runtime
24415 startup object and entry point.
24416
24417 @item -mnop-fun-dllimport
24418 @opindex mnop-fun-dllimport
24419 This option is available for Cygwin and MinGW targets. It
24420 specifies that the @code{dllimport} attribute should be ignored.
24421
24422 @item -mthread
24423 @opindex mthread
24424 This option is available for MinGW targets. It specifies
24425 that MinGW-specific thread support is to be used.
24426
24427 @item -municode
24428 @opindex municode
24429 This option is available for MinGW-w64 targets. It causes
24430 the @code{UNICODE} preprocessor macro to be predefined, and
24431 chooses Unicode-capable runtime startup code.
24432
24433 @item -mwin32
24434 @opindex mwin32
24435 This option is available for Cygwin and MinGW targets. It
24436 specifies that the typical Microsoft Windows predefined macros are to
24437 be set in the pre-processor, but does not influence the choice
24438 of runtime library/startup code.
24439
24440 @item -mwindows
24441 @opindex mwindows
24442 This option is available for Cygwin and MinGW targets. It
24443 specifies that a GUI application is to be generated by
24444 instructing the linker to set the PE header subsystem type
24445 appropriately.
24446
24447 @item -fno-set-stack-executable
24448 @opindex fno-set-stack-executable
24449 This option is available for MinGW targets. It specifies that
24450 the executable flag for the stack used by nested functions isn't
24451 set. This is necessary for binaries running in kernel mode of
24452 Microsoft Windows, as there the User32 API, which is used to set executable
24453 privileges, isn't available.
24454
24455 @item -fwritable-relocated-rdata
24456 @opindex fno-writable-relocated-rdata
24457 This option is available for MinGW and Cygwin targets. It specifies
24458 that relocated-data in read-only section is put into the @code{.data}
24459 section. This is a necessary for older runtimes not supporting
24460 modification of @code{.rdata} sections for pseudo-relocation.
24461
24462 @item -mpe-aligned-commons
24463 @opindex mpe-aligned-commons
24464 This option is available for Cygwin and MinGW targets. It
24465 specifies that the GNU extension to the PE file format that
24466 permits the correct alignment of COMMON variables should be
24467 used when generating code. It is enabled by default if
24468 GCC detects that the target assembler found during configuration
24469 supports the feature.
24470 @end table
24471
24472 See also under @ref{x86 Options} for standard options.
24473
24474 @node Xstormy16 Options
24475 @subsection Xstormy16 Options
24476 @cindex Xstormy16 Options
24477
24478 These options are defined for Xstormy16:
24479
24480 @table @gcctabopt
24481 @item -msim
24482 @opindex msim
24483 Choose startup files and linker script suitable for the simulator.
24484 @end table
24485
24486 @node Xtensa Options
24487 @subsection Xtensa Options
24488 @cindex Xtensa Options
24489
24490 These options are supported for Xtensa targets:
24491
24492 @table @gcctabopt
24493 @item -mconst16
24494 @itemx -mno-const16
24495 @opindex mconst16
24496 @opindex mno-const16
24497 Enable or disable use of @code{CONST16} instructions for loading
24498 constant values. The @code{CONST16} instruction is currently not a
24499 standard option from Tensilica. When enabled, @code{CONST16}
24500 instructions are always used in place of the standard @code{L32R}
24501 instructions. The use of @code{CONST16} is enabled by default only if
24502 the @code{L32R} instruction is not available.
24503
24504 @item -mfused-madd
24505 @itemx -mno-fused-madd
24506 @opindex mfused-madd
24507 @opindex mno-fused-madd
24508 Enable or disable use of fused multiply/add and multiply/subtract
24509 instructions in the floating-point option. This has no effect if the
24510 floating-point option is not also enabled. Disabling fused multiply/add
24511 and multiply/subtract instructions forces the compiler to use separate
24512 instructions for the multiply and add/subtract operations. This may be
24513 desirable in some cases where strict IEEE 754-compliant results are
24514 required: the fused multiply add/subtract instructions do not round the
24515 intermediate result, thereby producing results with @emph{more} bits of
24516 precision than specified by the IEEE standard. Disabling fused multiply
24517 add/subtract instructions also ensures that the program output is not
24518 sensitive to the compiler's ability to combine multiply and add/subtract
24519 operations.
24520
24521 @item -mserialize-volatile
24522 @itemx -mno-serialize-volatile
24523 @opindex mserialize-volatile
24524 @opindex mno-serialize-volatile
24525 When this option is enabled, GCC inserts @code{MEMW} instructions before
24526 @code{volatile} memory references to guarantee sequential consistency.
24527 The default is @option{-mserialize-volatile}. Use
24528 @option{-mno-serialize-volatile} to omit the @code{MEMW} instructions.
24529
24530 @item -mforce-no-pic
24531 @opindex mforce-no-pic
24532 For targets, like GNU/Linux, where all user-mode Xtensa code must be
24533 position-independent code (PIC), this option disables PIC for compiling
24534 kernel code.
24535
24536 @item -mtext-section-literals
24537 @itemx -mno-text-section-literals
24538 @opindex mtext-section-literals
24539 @opindex mno-text-section-literals
24540 These options control the treatment of literal pools. The default is
24541 @option{-mno-text-section-literals}, which places literals in a separate
24542 section in the output file. This allows the literal pool to be placed
24543 in a data RAM/ROM, and it also allows the linker to combine literal
24544 pools from separate object files to remove redundant literals and
24545 improve code size. With @option{-mtext-section-literals}, the literals
24546 are interspersed in the text section in order to keep them as close as
24547 possible to their references. This may be necessary for large assembly
24548 files. Literals for each function are placed right before that function.
24549
24550 @item -mauto-litpools
24551 @itemx -mno-auto-litpools
24552 @opindex mauto-litpools
24553 @opindex mno-auto-litpools
24554 These options control the treatment of literal pools. The default is
24555 @option{-mno-auto-litpools}, which places literals in a separate
24556 section in the output file unless @option{-mtext-section-literals} is
24557 used. With @option{-mauto-litpools} the literals are interspersed in
24558 the text section by the assembler. Compiler does not produce explicit
24559 @code{.literal} directives and loads literals into registers with
24560 @code{MOVI} instructions instead of @code{L32R} to let the assembler
24561 do relaxation and place literals as necessary. This option allows
24562 assembler to create several literal pools per function and assemble
24563 very big functions, which may not be possible with
24564 @option{-mtext-section-literals}.
24565
24566 @item -mtarget-align
24567 @itemx -mno-target-align
24568 @opindex mtarget-align
24569 @opindex mno-target-align
24570 When this option is enabled, GCC instructs the assembler to
24571 automatically align instructions to reduce branch penalties at the
24572 expense of some code density. The assembler attempts to widen density
24573 instructions to align branch targets and the instructions following call
24574 instructions. If there are not enough preceding safe density
24575 instructions to align a target, no widening is performed. The
24576 default is @option{-mtarget-align}. These options do not affect the
24577 treatment of auto-aligned instructions like @code{LOOP}, which the
24578 assembler always aligns, either by widening density instructions or
24579 by inserting NOP instructions.
24580
24581 @item -mlongcalls
24582 @itemx -mno-longcalls
24583 @opindex mlongcalls
24584 @opindex mno-longcalls
24585 When this option is enabled, GCC instructs the assembler to translate
24586 direct calls to indirect calls unless it can determine that the target
24587 of a direct call is in the range allowed by the call instruction. This
24588 translation typically occurs for calls to functions in other source
24589 files. Specifically, the assembler translates a direct @code{CALL}
24590 instruction into an @code{L32R} followed by a @code{CALLX} instruction.
24591 The default is @option{-mno-longcalls}. This option should be used in
24592 programs where the call target can potentially be out of range. This
24593 option is implemented in the assembler, not the compiler, so the
24594 assembly code generated by GCC still shows direct call
24595 instructions---look at the disassembled object code to see the actual
24596 instructions. Note that the assembler uses an indirect call for
24597 every cross-file call, not just those that really are out of range.
24598 @end table
24599
24600 @node zSeries Options
24601 @subsection zSeries Options
24602 @cindex zSeries options
24603
24604 These are listed under @xref{S/390 and zSeries Options}.
24605
24606
24607 @c man end
24608
24609 @node Spec Files
24610 @section Specifying Subprocesses and the Switches to Pass to Them
24611 @cindex Spec Files
24612
24613 @command{gcc} is a driver program. It performs its job by invoking a
24614 sequence of other programs to do the work of compiling, assembling and
24615 linking. GCC interprets its command-line parameters and uses these to
24616 deduce which programs it should invoke, and which command-line options
24617 it ought to place on their command lines. This behavior is controlled
24618 by @dfn{spec strings}. In most cases there is one spec string for each
24619 program that GCC can invoke, but a few programs have multiple spec
24620 strings to control their behavior. The spec strings built into GCC can
24621 be overridden by using the @option{-specs=} command-line switch to specify
24622 a spec file.
24623
24624 @dfn{Spec files} are plain-text files that are used to construct spec
24625 strings. They consist of a sequence of directives separated by blank
24626 lines. The type of directive is determined by the first non-whitespace
24627 character on the line, which can be one of the following:
24628
24629 @table @code
24630 @item %@var{command}
24631 Issues a @var{command} to the spec file processor. The commands that can
24632 appear here are:
24633
24634 @table @code
24635 @item %include <@var{file}>
24636 @cindex @code{%include}
24637 Search for @var{file} and insert its text at the current point in the
24638 specs file.
24639
24640 @item %include_noerr <@var{file}>
24641 @cindex @code{%include_noerr}
24642 Just like @samp{%include}, but do not generate an error message if the include
24643 file cannot be found.
24644
24645 @item %rename @var{old_name} @var{new_name}
24646 @cindex @code{%rename}
24647 Rename the spec string @var{old_name} to @var{new_name}.
24648
24649 @end table
24650
24651 @item *[@var{spec_name}]:
24652 This tells the compiler to create, override or delete the named spec
24653 string. All lines after this directive up to the next directive or
24654 blank line are considered to be the text for the spec string. If this
24655 results in an empty string then the spec is deleted. (Or, if the
24656 spec did not exist, then nothing happens.) Otherwise, if the spec
24657 does not currently exist a new spec is created. If the spec does
24658 exist then its contents are overridden by the text of this
24659 directive, unless the first character of that text is the @samp{+}
24660 character, in which case the text is appended to the spec.
24661
24662 @item [@var{suffix}]:
24663 Creates a new @samp{[@var{suffix}] spec} pair. All lines after this directive
24664 and up to the next directive or blank line are considered to make up the
24665 spec string for the indicated suffix. When the compiler encounters an
24666 input file with the named suffix, it processes the spec string in
24667 order to work out how to compile that file. For example:
24668
24669 @smallexample
24670 .ZZ:
24671 z-compile -input %i
24672 @end smallexample
24673
24674 This says that any input file whose name ends in @samp{.ZZ} should be
24675 passed to the program @samp{z-compile}, which should be invoked with the
24676 command-line switch @option{-input} and with the result of performing the
24677 @samp{%i} substitution. (See below.)
24678
24679 As an alternative to providing a spec string, the text following a
24680 suffix directive can be one of the following:
24681
24682 @table @code
24683 @item @@@var{language}
24684 This says that the suffix is an alias for a known @var{language}. This is
24685 similar to using the @option{-x} command-line switch to GCC to specify a
24686 language explicitly. For example:
24687
24688 @smallexample
24689 .ZZ:
24690 @@c++
24691 @end smallexample
24692
24693 Says that .ZZ files are, in fact, C++ source files.
24694
24695 @item #@var{name}
24696 This causes an error messages saying:
24697
24698 @smallexample
24699 @var{name} compiler not installed on this system.
24700 @end smallexample
24701 @end table
24702
24703 GCC already has an extensive list of suffixes built into it.
24704 This directive adds an entry to the end of the list of suffixes, but
24705 since the list is searched from the end backwards, it is effectively
24706 possible to override earlier entries using this technique.
24707
24708 @end table
24709
24710 GCC has the following spec strings built into it. Spec files can
24711 override these strings or create their own. Note that individual
24712 targets can also add their own spec strings to this list.
24713
24714 @smallexample
24715 asm Options to pass to the assembler
24716 asm_final Options to pass to the assembler post-processor
24717 cpp Options to pass to the C preprocessor
24718 cc1 Options to pass to the C compiler
24719 cc1plus Options to pass to the C++ compiler
24720 endfile Object files to include at the end of the link
24721 link Options to pass to the linker
24722 lib Libraries to include on the command line to the linker
24723 libgcc Decides which GCC support library to pass to the linker
24724 linker Sets the name of the linker
24725 predefines Defines to be passed to the C preprocessor
24726 signed_char Defines to pass to CPP to say whether @code{char} is signed
24727 by default
24728 startfile Object files to include at the start of the link
24729 @end smallexample
24730
24731 Here is a small example of a spec file:
24732
24733 @smallexample
24734 %rename lib old_lib
24735
24736 *lib:
24737 --start-group -lgcc -lc -leval1 --end-group %(old_lib)
24738 @end smallexample
24739
24740 This example renames the spec called @samp{lib} to @samp{old_lib} and
24741 then overrides the previous definition of @samp{lib} with a new one.
24742 The new definition adds in some extra command-line options before
24743 including the text of the old definition.
24744
24745 @dfn{Spec strings} are a list of command-line options to be passed to their
24746 corresponding program. In addition, the spec strings can contain
24747 @samp{%}-prefixed sequences to substitute variable text or to
24748 conditionally insert text into the command line. Using these constructs
24749 it is possible to generate quite complex command lines.
24750
24751 Here is a table of all defined @samp{%}-sequences for spec
24752 strings. Note that spaces are not generated automatically around the
24753 results of expanding these sequences. Therefore you can concatenate them
24754 together or combine them with constant text in a single argument.
24755
24756 @table @code
24757 @item %%
24758 Substitute one @samp{%} into the program name or argument.
24759
24760 @item %i
24761 Substitute the name of the input file being processed.
24762
24763 @item %b
24764 Substitute the basename of the input file being processed.
24765 This is the substring up to (and not including) the last period
24766 and not including the directory.
24767
24768 @item %B
24769 This is the same as @samp{%b}, but include the file suffix (text after
24770 the last period).
24771
24772 @item %d
24773 Marks the argument containing or following the @samp{%d} as a
24774 temporary file name, so that that file is deleted if GCC exits
24775 successfully. Unlike @samp{%g}, this contributes no text to the
24776 argument.
24777
24778 @item %g@var{suffix}
24779 Substitute a file name that has suffix @var{suffix} and is chosen
24780 once per compilation, and mark the argument in the same way as
24781 @samp{%d}. To reduce exposure to denial-of-service attacks, the file
24782 name is now chosen in a way that is hard to predict even when previously
24783 chosen file names are known. For example, @samp{%g.s @dots{} %g.o @dots{} %g.s}
24784 might turn into @samp{ccUVUUAU.s ccXYAXZ12.o ccUVUUAU.s}. @var{suffix} matches
24785 the regexp @samp{[.A-Za-z]*} or the special string @samp{%O}, which is
24786 treated exactly as if @samp{%O} had been preprocessed. Previously, @samp{%g}
24787 was simply substituted with a file name chosen once per compilation,
24788 without regard to any appended suffix (which was therefore treated
24789 just like ordinary text), making such attacks more likely to succeed.
24790
24791 @item %u@var{suffix}
24792 Like @samp{%g}, but generates a new temporary file name
24793 each time it appears instead of once per compilation.
24794
24795 @item %U@var{suffix}
24796 Substitutes the last file name generated with @samp{%u@var{suffix}}, generating a
24797 new one if there is no such last file name. In the absence of any
24798 @samp{%u@var{suffix}}, this is just like @samp{%g@var{suffix}}, except they don't share
24799 the same suffix @emph{space}, so @samp{%g.s @dots{} %U.s @dots{} %g.s @dots{} %U.s}
24800 involves the generation of two distinct file names, one
24801 for each @samp{%g.s} and another for each @samp{%U.s}. Previously, @samp{%U} was
24802 simply substituted with a file name chosen for the previous @samp{%u},
24803 without regard to any appended suffix.
24804
24805 @item %j@var{suffix}
24806 Substitutes the name of the @code{HOST_BIT_BUCKET}, if any, and if it is
24807 writable, and if @option{-save-temps} is not used;
24808 otherwise, substitute the name
24809 of a temporary file, just like @samp{%u}. This temporary file is not
24810 meant for communication between processes, but rather as a junk
24811 disposal mechanism.
24812
24813 @item %|@var{suffix}
24814 @itemx %m@var{suffix}
24815 Like @samp{%g}, except if @option{-pipe} is in effect. In that case
24816 @samp{%|} substitutes a single dash and @samp{%m} substitutes nothing at
24817 all. These are the two most common ways to instruct a program that it
24818 should read from standard input or write to standard output. If you
24819 need something more elaborate you can use an @samp{%@{pipe:@code{X}@}}
24820 construct: see for example @file{f/lang-specs.h}.
24821
24822 @item %.@var{SUFFIX}
24823 Substitutes @var{.SUFFIX} for the suffixes of a matched switch's args
24824 when it is subsequently output with @samp{%*}. @var{SUFFIX} is
24825 terminated by the next space or %.
24826
24827 @item %w
24828 Marks the argument containing or following the @samp{%w} as the
24829 designated output file of this compilation. This puts the argument
24830 into the sequence of arguments that @samp{%o} substitutes.
24831
24832 @item %o
24833 Substitutes the names of all the output files, with spaces
24834 automatically placed around them. You should write spaces
24835 around the @samp{%o} as well or the results are undefined.
24836 @samp{%o} is for use in the specs for running the linker.
24837 Input files whose names have no recognized suffix are not compiled
24838 at all, but they are included among the output files, so they are
24839 linked.
24840
24841 @item %O
24842 Substitutes the suffix for object files. Note that this is
24843 handled specially when it immediately follows @samp{%g, %u, or %U},
24844 because of the need for those to form complete file names. The
24845 handling is such that @samp{%O} is treated exactly as if it had already
24846 been substituted, except that @samp{%g, %u, and %U} do not currently
24847 support additional @var{suffix} characters following @samp{%O} as they do
24848 following, for example, @samp{.o}.
24849
24850 @item %p
24851 Substitutes the standard macro predefinitions for the
24852 current target machine. Use this when running @command{cpp}.
24853
24854 @item %P
24855 Like @samp{%p}, but puts @samp{__} before and after the name of each
24856 predefined macro, except for macros that start with @samp{__} or with
24857 @samp{_@var{L}}, where @var{L} is an uppercase letter. This is for ISO
24858 C@.
24859
24860 @item %I
24861 Substitute any of @option{-iprefix} (made from @env{GCC_EXEC_PREFIX}),
24862 @option{-isysroot} (made from @env{TARGET_SYSTEM_ROOT}),
24863 @option{-isystem} (made from @env{COMPILER_PATH} and @option{-B} options)
24864 and @option{-imultilib} as necessary.
24865
24866 @item %s
24867 Current argument is the name of a library or startup file of some sort.
24868 Search for that file in a standard list of directories and substitute
24869 the full name found. The current working directory is included in the
24870 list of directories scanned.
24871
24872 @item %T
24873 Current argument is the name of a linker script. Search for that file
24874 in the current list of directories to scan for libraries. If the file
24875 is located insert a @option{--script} option into the command line
24876 followed by the full path name found. If the file is not found then
24877 generate an error message. Note: the current working directory is not
24878 searched.
24879
24880 @item %e@var{str}
24881 Print @var{str} as an error message. @var{str} is terminated by a newline.
24882 Use this when inconsistent options are detected.
24883
24884 @item %(@var{name})
24885 Substitute the contents of spec string @var{name} at this point.
24886
24887 @item %x@{@var{option}@}
24888 Accumulate an option for @samp{%X}.
24889
24890 @item %X
24891 Output the accumulated linker options specified by @option{-Wl} or a @samp{%x}
24892 spec string.
24893
24894 @item %Y
24895 Output the accumulated assembler options specified by @option{-Wa}.
24896
24897 @item %Z
24898 Output the accumulated preprocessor options specified by @option{-Wp}.
24899
24900 @item %a
24901 Process the @code{asm} spec. This is used to compute the
24902 switches to be passed to the assembler.
24903
24904 @item %A
24905 Process the @code{asm_final} spec. This is a spec string for
24906 passing switches to an assembler post-processor, if such a program is
24907 needed.
24908
24909 @item %l
24910 Process the @code{link} spec. This is the spec for computing the
24911 command line passed to the linker. Typically it makes use of the
24912 @samp{%L %G %S %D and %E} sequences.
24913
24914 @item %D
24915 Dump out a @option{-L} option for each directory that GCC believes might
24916 contain startup files. If the target supports multilibs then the
24917 current multilib directory is prepended to each of these paths.
24918
24919 @item %L
24920 Process the @code{lib} spec. This is a spec string for deciding which
24921 libraries are included on the command line to the linker.
24922
24923 @item %G
24924 Process the @code{libgcc} spec. This is a spec string for deciding
24925 which GCC support library is included on the command line to the linker.
24926
24927 @item %S
24928 Process the @code{startfile} spec. This is a spec for deciding which
24929 object files are the first ones passed to the linker. Typically
24930 this might be a file named @file{crt0.o}.
24931
24932 @item %E
24933 Process the @code{endfile} spec. This is a spec string that specifies
24934 the last object files that are passed to the linker.
24935
24936 @item %C
24937 Process the @code{cpp} spec. This is used to construct the arguments
24938 to be passed to the C preprocessor.
24939
24940 @item %1
24941 Process the @code{cc1} spec. This is used to construct the options to be
24942 passed to the actual C compiler (@command{cc1}).
24943
24944 @item %2
24945 Process the @code{cc1plus} spec. This is used to construct the options to be
24946 passed to the actual C++ compiler (@command{cc1plus}).
24947
24948 @item %*
24949 Substitute the variable part of a matched option. See below.
24950 Note that each comma in the substituted string is replaced by
24951 a single space.
24952
24953 @item %<@code{S}
24954 Remove all occurrences of @code{-S} from the command line. Note---this
24955 command is position dependent. @samp{%} commands in the spec string
24956 before this one see @code{-S}, @samp{%} commands in the spec string
24957 after this one do not.
24958
24959 @item %:@var{function}(@var{args})
24960 Call the named function @var{function}, passing it @var{args}.
24961 @var{args} is first processed as a nested spec string, then split
24962 into an argument vector in the usual fashion. The function returns
24963 a string which is processed as if it had appeared literally as part
24964 of the current spec.
24965
24966 The following built-in spec functions are provided:
24967
24968 @table @code
24969 @item @code{getenv}
24970 The @code{getenv} spec function takes two arguments: an environment
24971 variable name and a string. If the environment variable is not
24972 defined, a fatal error is issued. Otherwise, the return value is the
24973 value of the environment variable concatenated with the string. For
24974 example, if @env{TOPDIR} is defined as @file{/path/to/top}, then:
24975
24976 @smallexample
24977 %:getenv(TOPDIR /include)
24978 @end smallexample
24979
24980 expands to @file{/path/to/top/include}.
24981
24982 @item @code{if-exists}
24983 The @code{if-exists} spec function takes one argument, an absolute
24984 pathname to a file. If the file exists, @code{if-exists} returns the
24985 pathname. Here is a small example of its usage:
24986
24987 @smallexample
24988 *startfile:
24989 crt0%O%s %:if-exists(crti%O%s) crtbegin%O%s
24990 @end smallexample
24991
24992 @item @code{if-exists-else}
24993 The @code{if-exists-else} spec function is similar to the @code{if-exists}
24994 spec function, except that it takes two arguments. The first argument is
24995 an absolute pathname to a file. If the file exists, @code{if-exists-else}
24996 returns the pathname. If it does not exist, it returns the second argument.
24997 This way, @code{if-exists-else} can be used to select one file or another,
24998 based on the existence of the first. Here is a small example of its usage:
24999
25000 @smallexample
25001 *startfile:
25002 crt0%O%s %:if-exists(crti%O%s) \
25003 %:if-exists-else(crtbeginT%O%s crtbegin%O%s)
25004 @end smallexample
25005
25006 @item @code{replace-outfile}
25007 The @code{replace-outfile} spec function takes two arguments. It looks for the
25008 first argument in the outfiles array and replaces it with the second argument. Here
25009 is a small example of its usage:
25010
25011 @smallexample
25012 %@{fgnu-runtime:%:replace-outfile(-lobjc -lobjc-gnu)@}
25013 @end smallexample
25014
25015 @item @code{remove-outfile}
25016 The @code{remove-outfile} spec function takes one argument. It looks for the
25017 first argument in the outfiles array and removes it. Here is a small example
25018 its usage:
25019
25020 @smallexample
25021 %:remove-outfile(-lm)
25022 @end smallexample
25023
25024 @item @code{pass-through-libs}
25025 The @code{pass-through-libs} spec function takes any number of arguments. It
25026 finds any @option{-l} options and any non-options ending in @file{.a} (which it
25027 assumes are the names of linker input library archive files) and returns a
25028 result containing all the found arguments each prepended by
25029 @option{-plugin-opt=-pass-through=} and joined by spaces. This list is
25030 intended to be passed to the LTO linker plugin.
25031
25032 @smallexample
25033 %:pass-through-libs(%G %L %G)
25034 @end smallexample
25035
25036 @item @code{print-asm-header}
25037 The @code{print-asm-header} function takes no arguments and simply
25038 prints a banner like:
25039
25040 @smallexample
25041 Assembler options
25042 =================
25043
25044 Use "-Wa,OPTION" to pass "OPTION" to the assembler.
25045 @end smallexample
25046
25047 It is used to separate compiler options from assembler options
25048 in the @option{--target-help} output.
25049 @end table
25050
25051 @item %@{@code{S}@}
25052 Substitutes the @code{-S} switch, if that switch is given to GCC@.
25053 If that switch is not specified, this substitutes nothing. Note that
25054 the leading dash is omitted when specifying this option, and it is
25055 automatically inserted if the substitution is performed. Thus the spec
25056 string @samp{%@{foo@}} matches the command-line option @option{-foo}
25057 and outputs the command-line option @option{-foo}.
25058
25059 @item %W@{@code{S}@}
25060 Like %@{@code{S}@} but mark last argument supplied within as a file to be
25061 deleted on failure.
25062
25063 @item %@{@code{S}*@}
25064 Substitutes all the switches specified to GCC whose names start
25065 with @code{-S}, but which also take an argument. This is used for
25066 switches like @option{-o}, @option{-D}, @option{-I}, etc.
25067 GCC considers @option{-o foo} as being
25068 one switch whose name starts with @samp{o}. %@{o*@} substitutes this
25069 text, including the space. Thus two arguments are generated.
25070
25071 @item %@{@code{S}*&@code{T}*@}
25072 Like %@{@code{S}*@}, but preserve order of @code{S} and @code{T} options
25073 (the order of @code{S} and @code{T} in the spec is not significant).
25074 There can be any number of ampersand-separated variables; for each the
25075 wild card is optional. Useful for CPP as @samp{%@{D*&U*&A*@}}.
25076
25077 @item %@{@code{S}:@code{X}@}
25078 Substitutes @code{X}, if the @option{-S} switch is given to GCC@.
25079
25080 @item %@{!@code{S}:@code{X}@}
25081 Substitutes @code{X}, if the @option{-S} switch is @emph{not} given to GCC@.
25082
25083 @item %@{@code{S}*:@code{X}@}
25084 Substitutes @code{X} if one or more switches whose names start with
25085 @code{-S} are specified to GCC@. Normally @code{X} is substituted only
25086 once, no matter how many such switches appeared. However, if @code{%*}
25087 appears somewhere in @code{X}, then @code{X} is substituted once
25088 for each matching switch, with the @code{%*} replaced by the part of
25089 that switch matching the @code{*}.
25090
25091 If @code{%*} appears as the last part of a spec sequence then a space
25092 is added after the end of the last substitution. If there is more
25093 text in the sequence, however, then a space is not generated. This
25094 allows the @code{%*} substitution to be used as part of a larger
25095 string. For example, a spec string like this:
25096
25097 @smallexample
25098 %@{mcu=*:--script=%*/memory.ld@}
25099 @end smallexample
25100
25101 @noindent
25102 when matching an option like @option{-mcu=newchip} produces:
25103
25104 @smallexample
25105 --script=newchip/memory.ld
25106 @end smallexample
25107
25108 @item %@{.@code{S}:@code{X}@}
25109 Substitutes @code{X}, if processing a file with suffix @code{S}.
25110
25111 @item %@{!.@code{S}:@code{X}@}
25112 Substitutes @code{X}, if @emph{not} processing a file with suffix @code{S}.
25113
25114 @item %@{,@code{S}:@code{X}@}
25115 Substitutes @code{X}, if processing a file for language @code{S}.
25116
25117 @item %@{!,@code{S}:@code{X}@}
25118 Substitutes @code{X}, if not processing a file for language @code{S}.
25119
25120 @item %@{@code{S}|@code{P}:@code{X}@}
25121 Substitutes @code{X} if either @code{-S} or @code{-P} is given to
25122 GCC@. This may be combined with @samp{!}, @samp{.}, @samp{,}, and
25123 @code{*} sequences as well, although they have a stronger binding than
25124 the @samp{|}. If @code{%*} appears in @code{X}, all of the
25125 alternatives must be starred, and only the first matching alternative
25126 is substituted.
25127
25128 For example, a spec string like this:
25129
25130 @smallexample
25131 %@{.c:-foo@} %@{!.c:-bar@} %@{.c|d:-baz@} %@{!.c|d:-boggle@}
25132 @end smallexample
25133
25134 @noindent
25135 outputs the following command-line options from the following input
25136 command-line options:
25137
25138 @smallexample
25139 fred.c -foo -baz
25140 jim.d -bar -boggle
25141 -d fred.c -foo -baz -boggle
25142 -d jim.d -bar -baz -boggle
25143 @end smallexample
25144
25145 @item %@{S:X; T:Y; :D@}
25146
25147 If @code{S} is given to GCC, substitutes @code{X}; else if @code{T} is
25148 given to GCC, substitutes @code{Y}; else substitutes @code{D}. There can
25149 be as many clauses as you need. This may be combined with @code{.},
25150 @code{,}, @code{!}, @code{|}, and @code{*} as needed.
25151
25152
25153 @end table
25154
25155 The conditional text @code{X} in a %@{@code{S}:@code{X}@} or similar
25156 construct may contain other nested @samp{%} constructs or spaces, or
25157 even newlines. They are processed as usual, as described above.
25158 Trailing white space in @code{X} is ignored. White space may also
25159 appear anywhere on the left side of the colon in these constructs,
25160 except between @code{.} or @code{*} and the corresponding word.
25161
25162 The @option{-O}, @option{-f}, @option{-m}, and @option{-W} switches are
25163 handled specifically in these constructs. If another value of
25164 @option{-O} or the negated form of a @option{-f}, @option{-m}, or
25165 @option{-W} switch is found later in the command line, the earlier
25166 switch value is ignored, except with @{@code{S}*@} where @code{S} is
25167 just one letter, which passes all matching options.
25168
25169 The character @samp{|} at the beginning of the predicate text is used to
25170 indicate that a command should be piped to the following command, but
25171 only if @option{-pipe} is specified.
25172
25173 It is built into GCC which switches take arguments and which do not.
25174 (You might think it would be useful to generalize this to allow each
25175 compiler's spec to say which switches take arguments. But this cannot
25176 be done in a consistent fashion. GCC cannot even decide which input
25177 files have been specified without knowing which switches take arguments,
25178 and it must know which input files to compile in order to tell which
25179 compilers to run).
25180
25181 GCC also knows implicitly that arguments starting in @option{-l} are to be
25182 treated as compiler output files, and passed to the linker in their
25183 proper position among the other output files.
25184
25185 @node Environment Variables
25186 @section Environment Variables Affecting GCC
25187 @cindex environment variables
25188
25189 @c man begin ENVIRONMENT
25190 This section describes several environment variables that affect how GCC
25191 operates. Some of them work by specifying directories or prefixes to use
25192 when searching for various kinds of files. Some are used to specify other
25193 aspects of the compilation environment.
25194
25195 Note that you can also specify places to search using options such as
25196 @option{-B}, @option{-I} and @option{-L} (@pxref{Directory Options}). These
25197 take precedence over places specified using environment variables, which
25198 in turn take precedence over those specified by the configuration of GCC@.
25199 @xref{Driver,, Controlling the Compilation Driver @file{gcc}, gccint,
25200 GNU Compiler Collection (GCC) Internals}.
25201
25202 @table @env
25203 @item LANG
25204 @itemx LC_CTYPE
25205 @c @itemx LC_COLLATE
25206 @itemx LC_MESSAGES
25207 @c @itemx LC_MONETARY
25208 @c @itemx LC_NUMERIC
25209 @c @itemx LC_TIME
25210 @itemx LC_ALL
25211 @findex LANG
25212 @findex LC_CTYPE
25213 @c @findex LC_COLLATE
25214 @findex LC_MESSAGES
25215 @c @findex LC_MONETARY
25216 @c @findex LC_NUMERIC
25217 @c @findex LC_TIME
25218 @findex LC_ALL
25219 @cindex locale
25220 These environment variables control the way that GCC uses
25221 localization information which allows GCC to work with different
25222 national conventions. GCC inspects the locale categories
25223 @env{LC_CTYPE} and @env{LC_MESSAGES} if it has been configured to do
25224 so. These locale categories can be set to any value supported by your
25225 installation. A typical value is @samp{en_GB.UTF-8} for English in the United
25226 Kingdom encoded in UTF-8.
25227
25228 The @env{LC_CTYPE} environment variable specifies character
25229 classification. GCC uses it to determine the character boundaries in
25230 a string; this is needed for some multibyte encodings that contain quote
25231 and escape characters that are otherwise interpreted as a string
25232 end or escape.
25233
25234 The @env{LC_MESSAGES} environment variable specifies the language to
25235 use in diagnostic messages.
25236
25237 If the @env{LC_ALL} environment variable is set, it overrides the value
25238 of @env{LC_CTYPE} and @env{LC_MESSAGES}; otherwise, @env{LC_CTYPE}
25239 and @env{LC_MESSAGES} default to the value of the @env{LANG}
25240 environment variable. If none of these variables are set, GCC
25241 defaults to traditional C English behavior.
25242
25243 @item TMPDIR
25244 @findex TMPDIR
25245 If @env{TMPDIR} is set, it specifies the directory to use for temporary
25246 files. GCC uses temporary files to hold the output of one stage of
25247 compilation which is to be used as input to the next stage: for example,
25248 the output of the preprocessor, which is the input to the compiler
25249 proper.
25250
25251 @item GCC_COMPARE_DEBUG
25252 @findex GCC_COMPARE_DEBUG
25253 Setting @env{GCC_COMPARE_DEBUG} is nearly equivalent to passing
25254 @option{-fcompare-debug} to the compiler driver. See the documentation
25255 of this option for more details.
25256
25257 @item GCC_EXEC_PREFIX
25258 @findex GCC_EXEC_PREFIX
25259 If @env{GCC_EXEC_PREFIX} is set, it specifies a prefix to use in the
25260 names of the subprograms executed by the compiler. No slash is added
25261 when this prefix is combined with the name of a subprogram, but you can
25262 specify a prefix that ends with a slash if you wish.
25263
25264 If @env{GCC_EXEC_PREFIX} is not set, GCC attempts to figure out
25265 an appropriate prefix to use based on the pathname it is invoked with.
25266
25267 If GCC cannot find the subprogram using the specified prefix, it
25268 tries looking in the usual places for the subprogram.
25269
25270 The default value of @env{GCC_EXEC_PREFIX} is
25271 @file{@var{prefix}/lib/gcc/} where @var{prefix} is the prefix to
25272 the installed compiler. In many cases @var{prefix} is the value
25273 of @code{prefix} when you ran the @file{configure} script.
25274
25275 Other prefixes specified with @option{-B} take precedence over this prefix.
25276
25277 This prefix is also used for finding files such as @file{crt0.o} that are
25278 used for linking.
25279
25280 In addition, the prefix is used in an unusual way in finding the
25281 directories to search for header files. For each of the standard
25282 directories whose name normally begins with @samp{/usr/local/lib/gcc}
25283 (more precisely, with the value of @env{GCC_INCLUDE_DIR}), GCC tries
25284 replacing that beginning with the specified prefix to produce an
25285 alternate directory name. Thus, with @option{-Bfoo/}, GCC searches
25286 @file{foo/bar} just before it searches the standard directory
25287 @file{/usr/local/lib/bar}.
25288 If a standard directory begins with the configured
25289 @var{prefix} then the value of @var{prefix} is replaced by
25290 @env{GCC_EXEC_PREFIX} when looking for header files.
25291
25292 @item COMPILER_PATH
25293 @findex COMPILER_PATH
25294 The value of @env{COMPILER_PATH} is a colon-separated list of
25295 directories, much like @env{PATH}. GCC tries the directories thus
25296 specified when searching for subprograms, if it can't find the
25297 subprograms using @env{GCC_EXEC_PREFIX}.
25298
25299 @item LIBRARY_PATH
25300 @findex LIBRARY_PATH
25301 The value of @env{LIBRARY_PATH} is a colon-separated list of
25302 directories, much like @env{PATH}. When configured as a native compiler,
25303 GCC tries the directories thus specified when searching for special
25304 linker files, if it can't find them using @env{GCC_EXEC_PREFIX}. Linking
25305 using GCC also uses these directories when searching for ordinary
25306 libraries for the @option{-l} option (but directories specified with
25307 @option{-L} come first).
25308
25309 @item LANG
25310 @findex LANG
25311 @cindex locale definition
25312 This variable is used to pass locale information to the compiler. One way in
25313 which this information is used is to determine the character set to be used
25314 when character literals, string literals and comments are parsed in C and C++.
25315 When the compiler is configured to allow multibyte characters,
25316 the following values for @env{LANG} are recognized:
25317
25318 @table @samp
25319 @item C-JIS
25320 Recognize JIS characters.
25321 @item C-SJIS
25322 Recognize SJIS characters.
25323 @item C-EUCJP
25324 Recognize EUCJP characters.
25325 @end table
25326
25327 If @env{LANG} is not defined, or if it has some other value, then the
25328 compiler uses @code{mblen} and @code{mbtowc} as defined by the default locale to
25329 recognize and translate multibyte characters.
25330 @end table
25331
25332 @noindent
25333 Some additional environment variables affect the behavior of the
25334 preprocessor.
25335
25336 @include cppenv.texi
25337
25338 @c man end
25339
25340 @node Precompiled Headers
25341 @section Using Precompiled Headers
25342 @cindex precompiled headers
25343 @cindex speed of compilation
25344
25345 Often large projects have many header files that are included in every
25346 source file. The time the compiler takes to process these header files
25347 over and over again can account for nearly all of the time required to
25348 build the project. To make builds faster, GCC allows you to
25349 @dfn{precompile} a header file.
25350
25351 To create a precompiled header file, simply compile it as you would any
25352 other file, if necessary using the @option{-x} option to make the driver
25353 treat it as a C or C++ header file. You may want to use a
25354 tool like @command{make} to keep the precompiled header up-to-date when
25355 the headers it contains change.
25356
25357 A precompiled header file is searched for when @code{#include} is
25358 seen in the compilation. As it searches for the included file
25359 (@pxref{Search Path,,Search Path,cpp,The C Preprocessor}) the
25360 compiler looks for a precompiled header in each directory just before it
25361 looks for the include file in that directory. The name searched for is
25362 the name specified in the @code{#include} with @samp{.gch} appended. If
25363 the precompiled header file can't be used, it is ignored.
25364
25365 For instance, if you have @code{#include "all.h"}, and you have
25366 @file{all.h.gch} in the same directory as @file{all.h}, then the
25367 precompiled header file is used if possible, and the original
25368 header is used otherwise.
25369
25370 Alternatively, you might decide to put the precompiled header file in a
25371 directory and use @option{-I} to ensure that directory is searched
25372 before (or instead of) the directory containing the original header.
25373 Then, if you want to check that the precompiled header file is always
25374 used, you can put a file of the same name as the original header in this
25375 directory containing an @code{#error} command.
25376
25377 This also works with @option{-include}. So yet another way to use
25378 precompiled headers, good for projects not designed with precompiled
25379 header files in mind, is to simply take most of the header files used by
25380 a project, include them from another header file, precompile that header
25381 file, and @option{-include} the precompiled header. If the header files
25382 have guards against multiple inclusion, they are skipped because
25383 they've already been included (in the precompiled header).
25384
25385 If you need to precompile the same header file for different
25386 languages, targets, or compiler options, you can instead make a
25387 @emph{directory} named like @file{all.h.gch}, and put each precompiled
25388 header in the directory, perhaps using @option{-o}. It doesn't matter
25389 what you call the files in the directory; every precompiled header in
25390 the directory is considered. The first precompiled header
25391 encountered in the directory that is valid for this compilation is
25392 used; they're searched in no particular order.
25393
25394 There are many other possibilities, limited only by your imagination,
25395 good sense, and the constraints of your build system.
25396
25397 A precompiled header file can be used only when these conditions apply:
25398
25399 @itemize
25400 @item
25401 Only one precompiled header can be used in a particular compilation.
25402
25403 @item
25404 A precompiled header can't be used once the first C token is seen. You
25405 can have preprocessor directives before a precompiled header; you cannot
25406 include a precompiled header from inside another header.
25407
25408 @item
25409 The precompiled header file must be produced for the same language as
25410 the current compilation. You can't use a C precompiled header for a C++
25411 compilation.
25412
25413 @item
25414 The precompiled header file must have been produced by the same compiler
25415 binary as the current compilation is using.
25416
25417 @item
25418 Any macros defined before the precompiled header is included must
25419 either be defined in the same way as when the precompiled header was
25420 generated, or must not affect the precompiled header, which usually
25421 means that they don't appear in the precompiled header at all.
25422
25423 The @option{-D} option is one way to define a macro before a
25424 precompiled header is included; using a @code{#define} can also do it.
25425 There are also some options that define macros implicitly, like
25426 @option{-O} and @option{-Wdeprecated}; the same rule applies to macros
25427 defined this way.
25428
25429 @item If debugging information is output when using the precompiled
25430 header, using @option{-g} or similar, the same kind of debugging information
25431 must have been output when building the precompiled header. However,
25432 a precompiled header built using @option{-g} can be used in a compilation
25433 when no debugging information is being output.
25434
25435 @item The same @option{-m} options must generally be used when building
25436 and using the precompiled header. @xref{Submodel Options},
25437 for any cases where this rule is relaxed.
25438
25439 @item Each of the following options must be the same when building and using
25440 the precompiled header:
25441
25442 @gccoptlist{-fexceptions}
25443
25444 @item
25445 Some other command-line options starting with @option{-f},
25446 @option{-p}, or @option{-O} must be defined in the same way as when
25447 the precompiled header was generated. At present, it's not clear
25448 which options are safe to change and which are not; the safest choice
25449 is to use exactly the same options when generating and using the
25450 precompiled header. The following are known to be safe:
25451
25452 @gccoptlist{-fmessage-length= -fpreprocessed -fsched-interblock @gol
25453 -fsched-spec -fsched-spec-load -fsched-spec-load-dangerous @gol
25454 -fsched-verbose=@var{number} -fschedule-insns -fvisibility= @gol
25455 -pedantic-errors}
25456
25457 @end itemize
25458
25459 For all of these except the last, the compiler automatically
25460 ignores the precompiled header if the conditions aren't met. If you
25461 find an option combination that doesn't work and doesn't cause the
25462 precompiled header to be ignored, please consider filing a bug report,
25463 see @ref{Bugs}.
25464
25465 If you do use differing options when generating and using the
25466 precompiled header, the actual behavior is a mixture of the
25467 behavior for the options. For instance, if you use @option{-g} to
25468 generate the precompiled header but not when using it, you may or may
25469 not get debugging information for routines in the precompiled header.
This page took 1.009856 seconds and 6 git commands to generate.