]> gcc.gnu.org Git - gcc.git/blob - gcc/doc/invoke.texi
sh.opt (madjust-unroll, [...]): Remove deprecated options.
[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-default -Wswitch-enum -Wswitch-bool -Wsync-nand @gol
301 -Wsystem-headers -Wtautological-compare -Wtrampolines -Wtrigraphs @gol
302 -Wtype-limits -Wundef @gol
303 -Wuninitialized -Wunknown-pragmas -Wunsafe-loop-optimizations @gol
304 -Wunsuffixed-float-constants -Wunused -Wunused-function @gol
305 -Wunused-label -Wunused-local-typedefs -Wunused-parameter @gol
306 -Wno-unused-result -Wunused-value @gol -Wunused-variable @gol
307 -Wunused-const-variable -Wunused-const-variable=@var{n} @gol
308 -Wunused-but-set-parameter -Wunused-but-set-variable @gol
309 -Wuseless-cast -Wvariadic-macros -Wvector-operation-performance @gol
310 -Wvla -Wvolatile-register-var -Wwrite-strings @gol
311 -Wzero-as-null-pointer-constant -Whsa}
312
313 @item C and Objective-C-only Warning Options
314 @gccoptlist{-Wbad-function-cast -Wmissing-declarations @gol
315 -Wmissing-parameter-type -Wmissing-prototypes -Wnested-externs @gol
316 -Wold-style-declaration -Wold-style-definition @gol
317 -Wstrict-prototypes -Wtraditional -Wtraditional-conversion @gol
318 -Wdeclaration-after-statement -Wpointer-sign}
319
320 @item Debugging Options
321 @xref{Debugging Options,,Options for Debugging Your Program}.
322 @gccoptlist{-g -g@var{level} -gcoff -gdwarf -gdwarf-@var{version} @gol
323 -ggdb -grecord-gcc-switches -gno-record-gcc-switches @gol
324 -gstabs -gstabs+ -gstrict-dwarf -gno-strict-dwarf @gol
325 -gvms -gxcoff -gxcoff+ -gz@r{[}=@var{type}@r{]} @gol
326 -fdebug-prefix-map=@var{old}=@var{new} -fdebug-types-section @gol
327 -feliminate-dwarf2-dups -fno-eliminate-unused-debug-types @gol
328 -femit-struct-debug-baseonly -femit-struct-debug-reduced @gol
329 -femit-struct-debug-detailed@r{[}=@var{spec-list}@r{]} @gol
330 -feliminate-unused-debug-symbols -femit-class-debug-always @gol
331 -fno-merge-debug-strings -fno-dwarf2-cfi-asm @gol
332 -fvar-tracking -fvar-tracking-assignments}
333
334 @item Optimization Options
335 @xref{Optimize Options,,Options that Control Optimization}.
336 @gccoptlist{-faggressive-loop-optimizations -falign-functions[=@var{n}] @gol
337 -falign-jumps[=@var{n}] @gol
338 -falign-labels[=@var{n}] -falign-loops[=@var{n}] @gol
339 -fassociative-math -fauto-profile -fauto-profile[=@var{path}] @gol
340 -fauto-inc-dec -fbranch-probabilities @gol
341 -fbranch-target-load-optimize -fbranch-target-load-optimize2 @gol
342 -fbtr-bb-exclusive -fcaller-saves @gol
343 -fcombine-stack-adjustments -fconserve-stack @gol
344 -fcompare-elim -fcprop-registers -fcrossjumping @gol
345 -fcse-follow-jumps -fcse-skip-blocks -fcx-fortran-rules @gol
346 -fcx-limited-range @gol
347 -fdata-sections -fdce -fdelayed-branch @gol
348 -fdelete-null-pointer-checks -fdevirtualize -fdevirtualize-speculatively @gol
349 -fdevirtualize-at-ltrans -fdse @gol
350 -fearly-inlining -fipa-sra -fexpensive-optimizations -ffat-lto-objects @gol
351 -ffast-math -ffinite-math-only -ffloat-store -fexcess-precision=@var{style} @gol
352 -fforward-propagate -ffp-contract=@var{style} -ffunction-sections @gol
353 -fgcse -fgcse-after-reload -fgcse-las -fgcse-lm -fgraphite-identity @gol
354 -fgcse-sm -fhoist-adjacent-loads -fif-conversion @gol
355 -fif-conversion2 -findirect-inlining @gol
356 -finline-functions -finline-functions-called-once -finline-limit=@var{n} @gol
357 -finline-small-functions -fipa-cp -fipa-cp-clone -fipa-cp-alignment @gol
358 -fipa-pta -fipa-profile -fipa-pure-const -fipa-reference -fipa-icf @gol
359 -fira-algorithm=@var{algorithm} @gol
360 -fira-region=@var{region} -fira-hoist-pressure @gol
361 -fira-loop-pressure -fno-ira-share-save-slots @gol
362 -fno-ira-share-spill-slots @gol
363 -fisolate-erroneous-paths-dereference -fisolate-erroneous-paths-attribute @gol
364 -fivopts -fkeep-inline-functions -fkeep-static-functions @gol
365 -fkeep-static-consts -flive-range-shrinkage @gol
366 -floop-block -floop-interchange -floop-strip-mine @gol
367 -floop-unroll-and-jam -floop-nest-optimize @gol
368 -floop-parallelize-all -flra-remat -flto -flto-compression-level @gol
369 -flto-partition=@var{alg} -fmerge-all-constants @gol
370 -fmerge-constants -fmodulo-sched -fmodulo-sched-allow-regmoves @gol
371 -fmove-loop-invariants -fno-branch-count-reg @gol
372 -fno-defer-pop -fno-function-cse -fno-guess-branch-probability @gol
373 -fno-inline -fno-math-errno -fno-peephole -fno-peephole2 @gol
374 -fno-sched-interblock -fno-sched-spec -fno-signed-zeros @gol
375 -fno-toplevel-reorder -fno-trapping-math -fno-zero-initialized-in-bss @gol
376 -fomit-frame-pointer -foptimize-sibling-calls @gol
377 -fpartial-inlining -fpeel-loops -fpredictive-commoning @gol
378 -fprefetch-loop-arrays @gol
379 -fprofile-correction @gol
380 -fprofile-use -fprofile-use=@var{path} -fprofile-values @gol
381 -fprofile-reorder-functions @gol
382 -freciprocal-math -free -frename-registers -freorder-blocks @gol
383 -freorder-blocks-algorithm=@var{algorithm} @gol
384 -freorder-blocks-and-partition -freorder-functions @gol
385 -frerun-cse-after-loop -freschedule-modulo-scheduled-loops @gol
386 -frounding-math -fsched2-use-superblocks -fsched-pressure @gol
387 -fsched-spec-load -fsched-spec-load-dangerous @gol
388 -fsched-stalled-insns-dep[=@var{n}] -fsched-stalled-insns[=@var{n}] @gol
389 -fsched-group-heuristic -fsched-critical-path-heuristic @gol
390 -fsched-spec-insn-heuristic -fsched-rank-heuristic @gol
391 -fsched-last-insn-heuristic -fsched-dep-count-heuristic @gol
392 -fschedule-fusion @gol
393 -fschedule-insns -fschedule-insns2 -fsection-anchors @gol
394 -fselective-scheduling -fselective-scheduling2 @gol
395 -fsel-sched-pipelining -fsel-sched-pipelining-outer-loops @gol
396 -fsemantic-interposition -fshrink-wrap -fsignaling-nans @gol
397 -fsingle-precision-constant -fsplit-ivs-in-unroller @gol
398 -fsplit-paths @gol
399 -fsplit-wide-types -fssa-backprop -fssa-phiopt @gol
400 -fstdarg-opt -fstrict-aliasing @gol
401 -fstrict-overflow -fthread-jumps -ftracer -ftree-bit-ccp @gol
402 -ftree-builtin-call-dce -ftree-ccp -ftree-ch @gol
403 -ftree-coalesce-vars -ftree-copy-prop -ftree-dce -ftree-dominator-opts @gol
404 -ftree-dse -ftree-forwprop -ftree-fre -ftree-loop-if-convert @gol
405 -ftree-loop-if-convert-stores -ftree-loop-im @gol
406 -ftree-phiprop -ftree-loop-distribution -ftree-loop-distribute-patterns @gol
407 -ftree-loop-ivcanon -ftree-loop-linear -ftree-loop-optimize @gol
408 -ftree-loop-vectorize @gol
409 -ftree-parallelize-loops=@var{n} -ftree-pre -ftree-partial-pre -ftree-pta @gol
410 -ftree-reassoc -ftree-sink -ftree-slsr -ftree-sra @gol
411 -ftree-switch-conversion -ftree-tail-merge -ftree-ter @gol
412 -ftree-vectorize -ftree-vrp -funconstrained-commons @gol
413 -funit-at-a-time -funroll-all-loops -funroll-loops @gol
414 -funsafe-loop-optimizations -funsafe-math-optimizations -funswitch-loops @gol
415 -fipa-ra -fvariable-expansion-in-unroller -fvect-cost-model -fvpt @gol
416 -fweb -fwhole-program -fwpa -fuse-linker-plugin @gol
417 --param @var{name}=@var{value}
418 -O -O0 -O1 -O2 -O3 -Os -Ofast -Og}
419
420 @item Program Instrumentation Options
421 @xref{Instrumentation Options,,Program Instrumentation Options}.
422 @gccoptlist{-p -pg -fprofile-arcs --coverage -ftest-coverage @gol
423 -fprofile-dir=@var{path} -fprofile-generate -fprofile-generate=@var{path} @gol
424 -fsanitize=@var{style} -fsanitize-recover -fsanitize-recover=@var{style} @gol
425 -fasan-shadow-offset=@var{number} -fsanitize-sections=@var{s1},@var{s2},... @gol
426 -fsanitize-undefined-trap-on-error -fbounds-check @gol
427 -fcheck-pointer-bounds -fchkp-check-incomplete-type @gol
428 -fchkp-first-field-has-own-bounds -fchkp-narrow-bounds @gol
429 -fchkp-narrow-to-innermost-array -fchkp-optimize @gol
430 -fchkp-use-fast-string-functions -fchkp-use-nochk-string-functions @gol
431 -fchkp-use-static-bounds -fchkp-use-static-const-bounds @gol
432 -fchkp-treat-zero-dynamic-size-as-infinite -fchkp-check-read @gol
433 -fchkp-check-read -fchkp-check-write -fchkp-store-bounds @gol
434 -fchkp-instrument-calls -fchkp-instrument-marked-only @gol
435 -fchkp-use-wrappers @gol
436 -fstack-protector -fstack-protector-all -fstack-protector-strong @gol
437 -fstack-protector-explicit -fstack-check @gol
438 -fstack-limit-register=@var{reg} -fstack-limit-symbol=@var{sym} @gol
439 -fno-stack-limit -fsplit-stack @gol
440 -fvtable-verify=@r{[}std@r{|}preinit@r{|}none@r{]} @gol
441 -fvtv-counts -fvtv-debug @gol
442 -finstrument-functions @gol
443 -finstrument-functions-exclude-function-list=@var{sym},@var{sym},@dots{} @gol
444 -finstrument-functions-exclude-file-list=@var{file},@var{file},@dots{}}
445
446 @item Preprocessor Options
447 @xref{Preprocessor Options,,Options Controlling the Preprocessor}.
448 @gccoptlist{-A@var{question}=@var{answer} @gol
449 -A-@var{question}@r{[}=@var{answer}@r{]} @gol
450 -C -dD -dI -dM -dN @gol
451 -D@var{macro}@r{[}=@var{defn}@r{]} -E -H @gol
452 -idirafter @var{dir} @gol
453 -include @var{file} -imacros @var{file} @gol
454 -iprefix @var{file} -iwithprefix @var{dir} @gol
455 -iwithprefixbefore @var{dir} -isystem @var{dir} @gol
456 -imultilib @var{dir} -isysroot @var{dir} @gol
457 -M -MM -MF -MG -MP -MQ -MT -nostdinc @gol
458 -P -fdebug-cpp -ftrack-macro-expansion -fworking-directory @gol
459 -remap -trigraphs -undef -U@var{macro} @gol
460 -Wp,@var{option} -Xpreprocessor @var{option} -no-integrated-cpp}
461
462 @item Assembler Option
463 @xref{Assembler Options,,Passing Options to the Assembler}.
464 @gccoptlist{-Wa,@var{option} -Xassembler @var{option}}
465
466 @item Linker Options
467 @xref{Link Options,,Options for Linking}.
468 @gccoptlist{@var{object-file-name} -fuse-ld=@var{linker} -l@var{library} @gol
469 -nostartfiles -nodefaultlibs -nostdlib -pie -rdynamic @gol
470 -s -static -static-libgcc -static-libstdc++ @gol
471 -static-libasan -static-libtsan -static-liblsan -static-libubsan @gol
472 -static-libmpx -static-libmpxwrappers @gol
473 -shared -shared-libgcc -symbolic @gol
474 -T @var{script} -Wl,@var{option} -Xlinker @var{option} @gol
475 -u @var{symbol} -z @var{keyword}}
476
477 @item Directory Options
478 @xref{Directory Options,,Options for Directory Search}.
479 @gccoptlist{-B@var{prefix} -I@var{dir} -iplugindir=@var{dir} @gol
480 -iquote@var{dir} -L@var{dir} -no-canonical-prefixes -I- @gol
481 --sysroot=@var{dir} --no-sysroot-suffix}
482
483 @item Code Generation Options
484 @xref{Code Gen Options,,Options for Code Generation Conventions}.
485 @gccoptlist{-fcall-saved-@var{reg} -fcall-used-@var{reg} @gol
486 -ffixed-@var{reg} -fexceptions @gol
487 -fnon-call-exceptions -fdelete-dead-exceptions -funwind-tables @gol
488 -fasynchronous-unwind-tables @gol
489 -fno-gnu-unique @gol
490 -finhibit-size-directive -fno-common -fno-ident @gol
491 -fpcc-struct-return -fpic -fPIC -fpie -fPIE -fno-plt @gol
492 -fno-jump-tables @gol
493 -frecord-gcc-switches @gol
494 -freg-struct-return -fshort-enums -fshort-wchar @gol
495 -fverbose-asm -fpack-struct[=@var{n}] @gol
496 -fleading-underscore -ftls-model=@var{model} @gol
497 -fstack-reuse=@var{reuse_level} @gol
498 -ftrapv -fwrapv @gol
499 -fvisibility=@r{[}default@r{|}internal@r{|}hidden@r{|}protected@r{]} @gol
500 -fstrict-volatile-bitfields -fsync-libcalls}
501
502 @item Developer Options
503 @xref{Developer Options,,GCC Developer Options}.
504 @gccoptlist{-d@var{letters} -dumpspecs -dumpmachine -dumpversion @gol
505 -fchecking -fchecking=@var{n} -fdbg-cnt-list @gol
506 -fdbg-cnt=@var{counter-value-list} @gol
507 -fdisable-ipa-@var{pass_name} @gol
508 -fdisable-rtl-@var{pass_name} @gol
509 -fdisable-rtl-@var{pass-name}=@var{range-list} @gol
510 -fdisable-tree-@var{pass_name} @gol
511 -fdisable-tree-@var{pass-name}=@var{range-list} @gol
512 -fdump-noaddr -fdump-unnumbered -fdump-unnumbered-links @gol
513 -fdump-translation-unit@r{[}-@var{n}@r{]} @gol
514 -fdump-class-hierarchy@r{[}-@var{n}@r{]} @gol
515 -fdump-ipa-all -fdump-ipa-cgraph -fdump-ipa-inline @gol
516 -fdump-passes @gol
517 -fdump-rtl-@var{pass} -fdump-rtl-@var{pass}=@var{filename} @gol
518 -fdump-statistics @gol
519 -fdump-tree-all @gol
520 -fdump-tree-original@r{[}-@var{n}@r{]} @gol
521 -fdump-tree-optimized@r{[}-@var{n}@r{]} @gol
522 -fdump-tree-cfg -fdump-tree-alias @gol
523 -fdump-tree-ch @gol
524 -fdump-tree-ssa@r{[}-@var{n}@r{]} -fdump-tree-pre@r{[}-@var{n}@r{]} @gol
525 -fdump-tree-ccp@r{[}-@var{n}@r{]} -fdump-tree-dce@r{[}-@var{n}@r{]} @gol
526 -fdump-tree-gimple@r{[}-raw@r{]} @gol
527 -fdump-tree-dom@r{[}-@var{n}@r{]} @gol
528 -fdump-tree-dse@r{[}-@var{n}@r{]} @gol
529 -fdump-tree-phiprop@r{[}-@var{n}@r{]} @gol
530 -fdump-tree-phiopt@r{[}-@var{n}@r{]} @gol
531 -fdump-tree-backprop@r{[}-@var{n}@r{]} @gol
532 -fdump-tree-forwprop@r{[}-@var{n}@r{]} @gol
533 -fdump-tree-nrv -fdump-tree-vect @gol
534 -fdump-tree-sink @gol
535 -fdump-tree-sra@r{[}-@var{n}@r{]} @gol
536 -fdump-tree-forwprop@r{[}-@var{n}@r{]} @gol
537 -fdump-tree-fre@r{[}-@var{n}@r{]} @gol
538 -fdump-tree-vtable-verify @gol
539 -fdump-tree-vrp@r{[}-@var{n}@r{]} @gol
540 -fdump-tree-split-paths@r{[}-@var{n}@r{]} @gol
541 -fdump-tree-storeccp@r{[}-@var{n}@r{]} @gol
542 -fdump-final-insns=@var{file} @gol
543 -fcompare-debug@r{[}=@var{opts}@r{]} -fcompare-debug-second @gol
544 -fenable-@var{kind}-@var{pass} @gol
545 -fenable-@var{kind}-@var{pass}=@var{range-list} @gol
546 -fira-verbose=@var{n} @gol
547 -flto-report -flto-report-wpa -fmem-report-wpa @gol
548 -fmem-report -fpre-ipa-mem-report -fpost-ipa-mem-report @gol
549 -fopt-info -fopt-info-@var{options}@r{[}=@var{file}@r{]} @gol
550 -fprofile-report @gol
551 -frandom-seed=@var{string} -fsched-verbose=@var{n} @gol
552 -fsel-sched-verbose -fsel-sched-dump-cfg -fsel-sched-pipelining-verbose @gol
553 -fstats -fstack-usage -ftime-report @gol
554 -fvar-tracking-assignments-toggle -gtoggle @gol
555 -print-file-name=@var{library} -print-libgcc-file-name @gol
556 -print-multi-directory -print-multi-lib -print-multi-os-directory @gol
557 -print-prog-name=@var{program} -print-search-dirs -Q @gol
558 -print-sysroot -print-sysroot-headers-suffix @gol
559 -save-temps -save-temps=cwd -save-temps=obj -time@r{[}=@var{file}@r{]}}
560
561 @item Machine-Dependent Options
562 @xref{Submodel Options,,Machine-Dependent Options}.
563 @c This list is ordered alphanumerically by subsection name.
564 @c Try and put the significant identifier (CPU or system) first,
565 @c so users have a clue at guessing where the ones they want will be.
566
567 @emph{AArch64 Options}
568 @gccoptlist{-mabi=@var{name} -mbig-endian -mlittle-endian @gol
569 -mgeneral-regs-only @gol
570 -mcmodel=tiny -mcmodel=small -mcmodel=large @gol
571 -mstrict-align @gol
572 -momit-leaf-frame-pointer -mno-omit-leaf-frame-pointer @gol
573 -mtls-dialect=desc -mtls-dialect=traditional @gol
574 -mtls-size=@var{size} @gol
575 -mfix-cortex-a53-835769 -mno-fix-cortex-a53-835769 @gol
576 -mfix-cortex-a53-843419 -mno-fix-cortex-a53-843419 @gol
577 -mlow-precision-recip-sqrt -mno-low-precision-recip-sqrt@gol
578 -march=@var{name} -mcpu=@var{name} -mtune=@var{name}}
579
580 @emph{Adapteva Epiphany Options}
581 @gccoptlist{-mhalf-reg-file -mprefer-short-insn-regs @gol
582 -mbranch-cost=@var{num} -mcmove -mnops=@var{num} -msoft-cmpsf @gol
583 -msplit-lohi -mpost-inc -mpost-modify -mstack-offset=@var{num} @gol
584 -mround-nearest -mlong-calls -mshort-calls -msmall16 @gol
585 -mfp-mode=@var{mode} -mvect-double -max-vect-align=@var{num} @gol
586 -msplit-vecmove-early -m1reg-@var{reg}}
587
588 @emph{ARC Options}
589 @gccoptlist{-mbarrel-shifter @gol
590 -mcpu=@var{cpu} -mA6 -mARC600 -mA7 -mARC700 @gol
591 -mdpfp -mdpfp-compact -mdpfp-fast -mno-dpfp-lrsr @gol
592 -mea -mno-mpy -mmul32x16 -mmul64 -matomic @gol
593 -mnorm -mspfp -mspfp-compact -mspfp-fast -msimd -msoft-float -mswap @gol
594 -mcrc -mdsp-packa -mdvbf -mlock -mmac-d16 -mmac-24 -mrtsc -mswape @gol
595 -mtelephony -mxy -misize -mannotate-align -marclinux -marclinux_prof @gol
596 -mlong-calls -mmedium-calls -msdata @gol
597 -mucb-mcount -mvolatile-cache -mtp-regno=@var{regno} @gol
598 -malign-call -mauto-modify-reg -mbbit-peephole -mno-brcc @gol
599 -mcase-vector-pcrel -mcompact-casesi -mno-cond-exec -mearly-cbranchsi @gol
600 -mexpand-adddi -mindexed-loads -mlra -mlra-priority-none @gol
601 -mlra-priority-compact mlra-priority-noncompact -mno-millicode @gol
602 -mmixed-code -mq-class -mRcq -mRcw -msize-level=@var{level} @gol
603 -mtune=@var{cpu} -mmultcost=@var{num} @gol
604 -munalign-prob-threshold=@var{probability} -mmpy-option=@var{multo} @gol
605 -mdiv-rem -mcode-density -mll64 -mfpu=@var{fpu}}
606
607 @emph{ARM Options}
608 @gccoptlist{-mapcs-frame -mno-apcs-frame @gol
609 -mabi=@var{name} @gol
610 -mapcs-stack-check -mno-apcs-stack-check @gol
611 -mapcs-float -mno-apcs-float @gol
612 -mapcs-reentrant -mno-apcs-reentrant @gol
613 -msched-prolog -mno-sched-prolog @gol
614 -mlittle-endian -mbig-endian @gol
615 -mfloat-abi=@var{name} @gol
616 -mfp16-format=@var{name}
617 -mthumb-interwork -mno-thumb-interwork @gol
618 -mcpu=@var{name} -march=@var{name} -mfpu=@var{name} @gol
619 -mtune=@var{name} -mprint-tune-info @gol
620 -mstructure-size-boundary=@var{n} @gol
621 -mabort-on-noreturn @gol
622 -mlong-calls -mno-long-calls @gol
623 -msingle-pic-base -mno-single-pic-base @gol
624 -mpic-register=@var{reg} @gol
625 -mnop-fun-dllimport @gol
626 -mpoke-function-name @gol
627 -mthumb -marm @gol
628 -mtpcs-frame -mtpcs-leaf-frame @gol
629 -mcaller-super-interworking -mcallee-super-interworking @gol
630 -mtp=@var{name} -mtls-dialect=@var{dialect} @gol
631 -mword-relocations @gol
632 -mfix-cortex-m3-ldrd @gol
633 -munaligned-access @gol
634 -mneon-for-64bits @gol
635 -mslow-flash-data @gol
636 -masm-syntax-unified @gol
637 -mrestrict-it}
638
639 @emph{AVR Options}
640 @gccoptlist{-mmcu=@var{mcu} -maccumulate-args -mbranch-cost=@var{cost} @gol
641 -mcall-prologues -mint8 -mn_flash=@var{size} -mno-interrupts @gol
642 -mrelax -mrmw -mstrict-X -mtiny-stack -nodevicelib -Waddr-space-convert}
643
644 @emph{Blackfin Options}
645 @gccoptlist{-mcpu=@var{cpu}@r{[}-@var{sirevision}@r{]} @gol
646 -msim -momit-leaf-frame-pointer -mno-omit-leaf-frame-pointer @gol
647 -mspecld-anomaly -mno-specld-anomaly -mcsync-anomaly -mno-csync-anomaly @gol
648 -mlow-64k -mno-low64k -mstack-check-l1 -mid-shared-library @gol
649 -mno-id-shared-library -mshared-library-id=@var{n} @gol
650 -mleaf-id-shared-library -mno-leaf-id-shared-library @gol
651 -msep-data -mno-sep-data -mlong-calls -mno-long-calls @gol
652 -mfast-fp -minline-plt -mmulticore -mcorea -mcoreb -msdram @gol
653 -micplb}
654
655 @emph{C6X Options}
656 @gccoptlist{-mbig-endian -mlittle-endian -march=@var{cpu} @gol
657 -msim -msdata=@var{sdata-type}}
658
659 @emph{CRIS Options}
660 @gccoptlist{-mcpu=@var{cpu} -march=@var{cpu} -mtune=@var{cpu} @gol
661 -mmax-stack-frame=@var{n} -melinux-stacksize=@var{n} @gol
662 -metrax4 -metrax100 -mpdebug -mcc-init -mno-side-effects @gol
663 -mstack-align -mdata-align -mconst-align @gol
664 -m32-bit -m16-bit -m8-bit -mno-prologue-epilogue -mno-gotplt @gol
665 -melf -maout -melinux -mlinux -sim -sim2 @gol
666 -mmul-bug-workaround -mno-mul-bug-workaround}
667
668 @emph{CR16 Options}
669 @gccoptlist{-mmac @gol
670 -mcr16cplus -mcr16c @gol
671 -msim -mint32 -mbit-ops
672 -mdata-model=@var{model}}
673
674 @emph{Darwin Options}
675 @gccoptlist{-all_load -allowable_client -arch -arch_errors_fatal @gol
676 -arch_only -bind_at_load -bundle -bundle_loader @gol
677 -client_name -compatibility_version -current_version @gol
678 -dead_strip @gol
679 -dependency-file -dylib_file -dylinker_install_name @gol
680 -dynamic -dynamiclib -exported_symbols_list @gol
681 -filelist -flat_namespace -force_cpusubtype_ALL @gol
682 -force_flat_namespace -headerpad_max_install_names @gol
683 -iframework @gol
684 -image_base -init -install_name -keep_private_externs @gol
685 -multi_module -multiply_defined -multiply_defined_unused @gol
686 -noall_load -no_dead_strip_inits_and_terms @gol
687 -nofixprebinding -nomultidefs -noprebind -noseglinkedit @gol
688 -pagezero_size -prebind -prebind_all_twolevel_modules @gol
689 -private_bundle -read_only_relocs -sectalign @gol
690 -sectobjectsymbols -whyload -seg1addr @gol
691 -sectcreate -sectobjectsymbols -sectorder @gol
692 -segaddr -segs_read_only_addr -segs_read_write_addr @gol
693 -seg_addr_table -seg_addr_table_filename -seglinkedit @gol
694 -segprot -segs_read_only_addr -segs_read_write_addr @gol
695 -single_module -static -sub_library -sub_umbrella @gol
696 -twolevel_namespace -umbrella -undefined @gol
697 -unexported_symbols_list -weak_reference_mismatches @gol
698 -whatsloaded -F -gused -gfull -mmacosx-version-min=@var{version} @gol
699 -mkernel -mone-byte-bool}
700
701 @emph{DEC Alpha Options}
702 @gccoptlist{-mno-fp-regs -msoft-float @gol
703 -mieee -mieee-with-inexact -mieee-conformant @gol
704 -mfp-trap-mode=@var{mode} -mfp-rounding-mode=@var{mode} @gol
705 -mtrap-precision=@var{mode} -mbuild-constants @gol
706 -mcpu=@var{cpu-type} -mtune=@var{cpu-type} @gol
707 -mbwx -mmax -mfix -mcix @gol
708 -mfloat-vax -mfloat-ieee @gol
709 -mexplicit-relocs -msmall-data -mlarge-data @gol
710 -msmall-text -mlarge-text @gol
711 -mmemory-latency=@var{time}}
712
713 @emph{FR30 Options}
714 @gccoptlist{-msmall-model -mno-lsim}
715
716 @emph{FT32 Options}
717 @gccoptlist{-msim -mlra -mnodiv}
718
719 @emph{FRV Options}
720 @gccoptlist{-mgpr-32 -mgpr-64 -mfpr-32 -mfpr-64 @gol
721 -mhard-float -msoft-float @gol
722 -malloc-cc -mfixed-cc -mdword -mno-dword @gol
723 -mdouble -mno-double @gol
724 -mmedia -mno-media -mmuladd -mno-muladd @gol
725 -mfdpic -minline-plt -mgprel-ro -multilib-library-pic @gol
726 -mlinked-fp -mlong-calls -malign-labels @gol
727 -mlibrary-pic -macc-4 -macc-8 @gol
728 -mpack -mno-pack -mno-eflags -mcond-move -mno-cond-move @gol
729 -moptimize-membar -mno-optimize-membar @gol
730 -mscc -mno-scc -mcond-exec -mno-cond-exec @gol
731 -mvliw-branch -mno-vliw-branch @gol
732 -mmulti-cond-exec -mno-multi-cond-exec -mnested-cond-exec @gol
733 -mno-nested-cond-exec -mtomcat-stats @gol
734 -mTLS -mtls @gol
735 -mcpu=@var{cpu}}
736
737 @emph{GNU/Linux Options}
738 @gccoptlist{-mglibc -muclibc -mmusl -mbionic -mandroid @gol
739 -tno-android-cc -tno-android-ld}
740
741 @emph{H8/300 Options}
742 @gccoptlist{-mrelax -mh -ms -mn -mexr -mno-exr -mint32 -malign-300}
743
744 @emph{HPPA Options}
745 @gccoptlist{-march=@var{architecture-type} @gol
746 -mdisable-fpregs -mdisable-indexing @gol
747 -mfast-indirect-calls -mgas -mgnu-ld -mhp-ld @gol
748 -mfixed-range=@var{register-range} @gol
749 -mjump-in-delay -mlinker-opt -mlong-calls @gol
750 -mlong-load-store -mno-disable-fpregs @gol
751 -mno-disable-indexing -mno-fast-indirect-calls -mno-gas @gol
752 -mno-jump-in-delay -mno-long-load-store @gol
753 -mno-portable-runtime -mno-soft-float @gol
754 -mno-space-regs -msoft-float -mpa-risc-1-0 @gol
755 -mpa-risc-1-1 -mpa-risc-2-0 -mportable-runtime @gol
756 -mschedule=@var{cpu-type} -mspace-regs -msio -mwsio @gol
757 -munix=@var{unix-std} -nolibdld -static -threads}
758
759 @emph{IA-64 Options}
760 @gccoptlist{-mbig-endian -mlittle-endian -mgnu-as -mgnu-ld -mno-pic @gol
761 -mvolatile-asm-stop -mregister-names -msdata -mno-sdata @gol
762 -mconstant-gp -mauto-pic -mfused-madd @gol
763 -minline-float-divide-min-latency @gol
764 -minline-float-divide-max-throughput @gol
765 -mno-inline-float-divide @gol
766 -minline-int-divide-min-latency @gol
767 -minline-int-divide-max-throughput @gol
768 -mno-inline-int-divide @gol
769 -minline-sqrt-min-latency -minline-sqrt-max-throughput @gol
770 -mno-inline-sqrt @gol
771 -mdwarf2-asm -mearly-stop-bits @gol
772 -mfixed-range=@var{register-range} -mtls-size=@var{tls-size} @gol
773 -mtune=@var{cpu-type} -milp32 -mlp64 @gol
774 -msched-br-data-spec -msched-ar-data-spec -msched-control-spec @gol
775 -msched-br-in-data-spec -msched-ar-in-data-spec -msched-in-control-spec @gol
776 -msched-spec-ldc -msched-spec-control-ldc @gol
777 -msched-prefer-non-data-spec-insns -msched-prefer-non-control-spec-insns @gol
778 -msched-stop-bits-after-every-cycle -msched-count-spec-in-critical-path @gol
779 -msel-sched-dont-check-control-spec -msched-fp-mem-deps-zero-cost @gol
780 -msched-max-memory-insns-hard-limit -msched-max-memory-insns=@var{max-insns}}
781
782 @emph{LM32 Options}
783 @gccoptlist{-mbarrel-shift-enabled -mdivide-enabled -mmultiply-enabled @gol
784 -msign-extend-enabled -muser-enabled}
785
786 @emph{M32R/D Options}
787 @gccoptlist{-m32r2 -m32rx -m32r @gol
788 -mdebug @gol
789 -malign-loops -mno-align-loops @gol
790 -missue-rate=@var{number} @gol
791 -mbranch-cost=@var{number} @gol
792 -mmodel=@var{code-size-model-type} @gol
793 -msdata=@var{sdata-type} @gol
794 -mno-flush-func -mflush-func=@var{name} @gol
795 -mno-flush-trap -mflush-trap=@var{number} @gol
796 -G @var{num}}
797
798 @emph{M32C Options}
799 @gccoptlist{-mcpu=@var{cpu} -msim -memregs=@var{number}}
800
801 @emph{M680x0 Options}
802 @gccoptlist{-march=@var{arch} -mcpu=@var{cpu} -mtune=@var{tune} @gol
803 -m68000 -m68020 -m68020-40 -m68020-60 -m68030 -m68040 @gol
804 -m68060 -mcpu32 -m5200 -m5206e -m528x -m5307 -m5407 @gol
805 -mcfv4e -mbitfield -mno-bitfield -mc68000 -mc68020 @gol
806 -mnobitfield -mrtd -mno-rtd -mdiv -mno-div -mshort @gol
807 -mno-short -mhard-float -m68881 -msoft-float -mpcrel @gol
808 -malign-int -mstrict-align -msep-data -mno-sep-data @gol
809 -mshared-library-id=n -mid-shared-library -mno-id-shared-library @gol
810 -mxgot -mno-xgot}
811
812 @emph{MCore Options}
813 @gccoptlist{-mhardlit -mno-hardlit -mdiv -mno-div -mrelax-immediates @gol
814 -mno-relax-immediates -mwide-bitfields -mno-wide-bitfields @gol
815 -m4byte-functions -mno-4byte-functions -mcallgraph-data @gol
816 -mno-callgraph-data -mslow-bytes -mno-slow-bytes -mno-lsim @gol
817 -mlittle-endian -mbig-endian -m210 -m340 -mstack-increment}
818
819 @emph{MeP Options}
820 @gccoptlist{-mabsdiff -mall-opts -maverage -mbased=@var{n} -mbitops @gol
821 -mc=@var{n} -mclip -mconfig=@var{name} -mcop -mcop32 -mcop64 -mivc2 @gol
822 -mdc -mdiv -meb -mel -mio-volatile -ml -mleadz -mm -mminmax @gol
823 -mmult -mno-opts -mrepeat -ms -msatur -msdram -msim -msimnovec -mtf @gol
824 -mtiny=@var{n}}
825
826 @emph{MicroBlaze Options}
827 @gccoptlist{-msoft-float -mhard-float -msmall-divides -mcpu=@var{cpu} @gol
828 -mmemcpy -mxl-soft-mul -mxl-soft-div -mxl-barrel-shift @gol
829 -mxl-pattern-compare -mxl-stack-check -mxl-gp-opt -mno-clearbss @gol
830 -mxl-multiply-high -mxl-float-convert -mxl-float-sqrt @gol
831 -mbig-endian -mlittle-endian -mxl-reorder -mxl-mode-@var{app-model}}
832
833 @emph{MIPS Options}
834 @gccoptlist{-EL -EB -march=@var{arch} -mtune=@var{arch} @gol
835 -mips1 -mips2 -mips3 -mips4 -mips32 -mips32r2 -mips32r3 -mips32r5 @gol
836 -mips32r6 -mips64 -mips64r2 -mips64r3 -mips64r5 -mips64r6 @gol
837 -mips16 -mno-mips16 -mflip-mips16 @gol
838 -minterlink-compressed -mno-interlink-compressed @gol
839 -minterlink-mips16 -mno-interlink-mips16 @gol
840 -mabi=@var{abi} -mabicalls -mno-abicalls @gol
841 -mshared -mno-shared -mplt -mno-plt -mxgot -mno-xgot @gol
842 -mgp32 -mgp64 -mfp32 -mfpxx -mfp64 -mhard-float -msoft-float @gol
843 -mno-float -msingle-float -mdouble-float @gol
844 -modd-spreg -mno-odd-spreg @gol
845 -mabs=@var{mode} -mnan=@var{encoding} @gol
846 -mdsp -mno-dsp -mdspr2 -mno-dspr2 @gol
847 -mmcu -mmno-mcu @gol
848 -meva -mno-eva @gol
849 -mvirt -mno-virt @gol
850 -mxpa -mno-xpa @gol
851 -mmicromips -mno-micromips @gol
852 -mfpu=@var{fpu-type} @gol
853 -msmartmips -mno-smartmips @gol
854 -mpaired-single -mno-paired-single -mdmx -mno-mdmx @gol
855 -mips3d -mno-mips3d -mmt -mno-mt -mllsc -mno-llsc @gol
856 -mlong64 -mlong32 -msym32 -mno-sym32 @gol
857 -G@var{num} -mlocal-sdata -mno-local-sdata @gol
858 -mextern-sdata -mno-extern-sdata -mgpopt -mno-gopt @gol
859 -membedded-data -mno-embedded-data @gol
860 -muninit-const-in-rodata -mno-uninit-const-in-rodata @gol
861 -mcode-readable=@var{setting} @gol
862 -msplit-addresses -mno-split-addresses @gol
863 -mexplicit-relocs -mno-explicit-relocs @gol
864 -mcheck-zero-division -mno-check-zero-division @gol
865 -mdivide-traps -mdivide-breaks @gol
866 -mmemcpy -mno-memcpy -mlong-calls -mno-long-calls @gol
867 -mmad -mno-mad -mimadd -mno-imadd -mfused-madd -mno-fused-madd -nocpp @gol
868 -mfix-24k -mno-fix-24k @gol
869 -mfix-r4000 -mno-fix-r4000 -mfix-r4400 -mno-fix-r4400 @gol
870 -mfix-r10000 -mno-fix-r10000 -mfix-rm7000 -mno-fix-rm7000 @gol
871 -mfix-vr4120 -mno-fix-vr4120 @gol
872 -mfix-vr4130 -mno-fix-vr4130 -mfix-sb1 -mno-fix-sb1 @gol
873 -mflush-func=@var{func} -mno-flush-func @gol
874 -mbranch-cost=@var{num} -mbranch-likely -mno-branch-likely @gol
875 -mcompact-branches=@var{policy} @gol
876 -mfp-exceptions -mno-fp-exceptions @gol
877 -mvr4130-align -mno-vr4130-align -msynci -mno-synci @gol
878 -mrelax-pic-calls -mno-relax-pic-calls -mmcount-ra-address @gol
879 -mframe-header-opt -mno-frame-header-opt}
880
881 @emph{MMIX Options}
882 @gccoptlist{-mlibfuncs -mno-libfuncs -mepsilon -mno-epsilon -mabi=gnu @gol
883 -mabi=mmixware -mzero-extend -mknuthdiv -mtoplevel-symbols @gol
884 -melf -mbranch-predict -mno-branch-predict -mbase-addresses @gol
885 -mno-base-addresses -msingle-exit -mno-single-exit}
886
887 @emph{MN10300 Options}
888 @gccoptlist{-mmult-bug -mno-mult-bug @gol
889 -mno-am33 -mam33 -mam33-2 -mam34 @gol
890 -mtune=@var{cpu-type} @gol
891 -mreturn-pointer-on-d0 @gol
892 -mno-crt0 -mrelax -mliw -msetlb}
893
894 @emph{Moxie Options}
895 @gccoptlist{-meb -mel -mmul.x -mno-crt0}
896
897 @emph{MSP430 Options}
898 @gccoptlist{-msim -masm-hex -mmcu= -mcpu= -mlarge -msmall -mrelax @gol
899 -mwarn-mcu @gol
900 -mcode-region= -mdata-region= @gol
901 -msilicon-errata= -msilicon-errata-warn= @gol
902 -mhwmult= -minrt}
903
904 @emph{NDS32 Options}
905 @gccoptlist{-mbig-endian -mlittle-endian @gol
906 -mreduced-regs -mfull-regs @gol
907 -mcmov -mno-cmov @gol
908 -mperf-ext -mno-perf-ext @gol
909 -mv3push -mno-v3push @gol
910 -m16bit -mno-16bit @gol
911 -misr-vector-size=@var{num} @gol
912 -mcache-block-size=@var{num} @gol
913 -march=@var{arch} @gol
914 -mcmodel=@var{code-model} @gol
915 -mctor-dtor -mrelax}
916
917 @emph{Nios II Options}
918 @gccoptlist{-G @var{num} -mgpopt=@var{option} -mgpopt -mno-gpopt @gol
919 -mel -meb @gol
920 -mno-bypass-cache -mbypass-cache @gol
921 -mno-cache-volatile -mcache-volatile @gol
922 -mno-fast-sw-div -mfast-sw-div @gol
923 -mhw-mul -mno-hw-mul -mhw-mulx -mno-hw-mulx -mno-hw-div -mhw-div @gol
924 -mcustom-@var{insn}=@var{N} -mno-custom-@var{insn} @gol
925 -mcustom-fpu-cfg=@var{name} @gol
926 -mhal -msmallc -msys-crt0=@var{name} -msys-lib=@var{name} @gol
927 -march=@var{arch} -mbmx -mno-bmx -mcdx -mno-cdx}
928
929 @emph{Nvidia PTX Options}
930 @gccoptlist{-m32 -m64 -mmainkernel -moptimize}
931
932 @emph{PDP-11 Options}
933 @gccoptlist{-mfpu -msoft-float -mac0 -mno-ac0 -m40 -m45 -m10 @gol
934 -mbcopy -mbcopy-builtin -mint32 -mno-int16 @gol
935 -mint16 -mno-int32 -mfloat32 -mno-float64 @gol
936 -mfloat64 -mno-float32 -mabshi -mno-abshi @gol
937 -mbranch-expensive -mbranch-cheap @gol
938 -munix-asm -mdec-asm}
939
940 @emph{picoChip Options}
941 @gccoptlist{-mae=@var{ae_type} -mvliw-lookahead=@var{N} @gol
942 -msymbol-as-address -mno-inefficient-warnings}
943
944 @emph{PowerPC Options}
945 See RS/6000 and PowerPC Options.
946
947 @emph{RL78 Options}
948 @gccoptlist{-msim -mmul=none -mmul=g13 -mmul=g14 -mallregs @gol
949 -mcpu=g10 -mcpu=g13 -mcpu=g14 -mg10 -mg13 -mg14 @gol
950 -m64bit-doubles -m32bit-doubles}
951
952 @emph{RS/6000 and PowerPC Options}
953 @gccoptlist{-mcpu=@var{cpu-type} @gol
954 -mtune=@var{cpu-type} @gol
955 -mcmodel=@var{code-model} @gol
956 -mpowerpc64 @gol
957 -maltivec -mno-altivec @gol
958 -mpowerpc-gpopt -mno-powerpc-gpopt @gol
959 -mpowerpc-gfxopt -mno-powerpc-gfxopt @gol
960 -mmfcrf -mno-mfcrf -mpopcntb -mno-popcntb -mpopcntd -mno-popcntd @gol
961 -mfprnd -mno-fprnd @gol
962 -mcmpb -mno-cmpb -mmfpgpr -mno-mfpgpr -mhard-dfp -mno-hard-dfp @gol
963 -mfull-toc -mminimal-toc -mno-fp-in-toc -mno-sum-in-toc @gol
964 -m64 -m32 -mxl-compat -mno-xl-compat -mpe @gol
965 -malign-power -malign-natural @gol
966 -msoft-float -mhard-float -mmultiple -mno-multiple @gol
967 -msingle-float -mdouble-float -msimple-fpu @gol
968 -mstring -mno-string -mupdate -mno-update @gol
969 -mavoid-indexed-addresses -mno-avoid-indexed-addresses @gol
970 -mfused-madd -mno-fused-madd -mbit-align -mno-bit-align @gol
971 -mstrict-align -mno-strict-align -mrelocatable @gol
972 -mno-relocatable -mrelocatable-lib -mno-relocatable-lib @gol
973 -mtoc -mno-toc -mlittle -mlittle-endian -mbig -mbig-endian @gol
974 -mdynamic-no-pic -maltivec -mswdiv -msingle-pic-base @gol
975 -mprioritize-restricted-insns=@var{priority} @gol
976 -msched-costly-dep=@var{dependence_type} @gol
977 -minsert-sched-nops=@var{scheme} @gol
978 -mcall-sysv -mcall-netbsd @gol
979 -maix-struct-return -msvr4-struct-return @gol
980 -mabi=@var{abi-type} -msecure-plt -mbss-plt @gol
981 -mblock-move-inline-limit=@var{num} @gol
982 -misel -mno-isel @gol
983 -misel=yes -misel=no @gol
984 -mspe -mno-spe @gol
985 -mspe=yes -mspe=no @gol
986 -mpaired @gol
987 -mgen-cell-microcode -mwarn-cell-microcode @gol
988 -mvrsave -mno-vrsave @gol
989 -mmulhw -mno-mulhw @gol
990 -mdlmzb -mno-dlmzb @gol
991 -mfloat-gprs=yes -mfloat-gprs=no -mfloat-gprs=single -mfloat-gprs=double @gol
992 -mprototype -mno-prototype @gol
993 -msim -mmvme -mads -myellowknife -memb -msdata @gol
994 -msdata=@var{opt} -mvxworks -G @var{num} -pthread @gol
995 -mrecip -mrecip=@var{opt} -mno-recip -mrecip-precision @gol
996 -mno-recip-precision @gol
997 -mveclibabi=@var{type} -mfriz -mno-friz @gol
998 -mpointers-to-nested-functions -mno-pointers-to-nested-functions @gol
999 -msave-toc-indirect -mno-save-toc-indirect @gol
1000 -mpower8-fusion -mno-mpower8-fusion -mpower8-vector -mno-power8-vector @gol
1001 -mcrypto -mno-crypto -mdirect-move -mno-direct-move @gol
1002 -mquad-memory -mno-quad-memory @gol
1003 -mquad-memory-atomic -mno-quad-memory-atomic @gol
1004 -mcompat-align-parm -mno-compat-align-parm @gol
1005 -mupper-regs-df -mno-upper-regs-df -mupper-regs-sf -mno-upper-regs-sf @gol
1006 -mupper-regs -mno-upper-regs -mmodulo -mno-modulo @gol
1007 -mfloat128 -mno-float128 -mfloat128-hardware -mno-float128-hardware @gol
1008 -mpower9-fusion -mno-mpower9-fusion -mpower9-vector -mno-power9-vector}
1009
1010 @emph{RX Options}
1011 @gccoptlist{-m64bit-doubles -m32bit-doubles -fpu -nofpu@gol
1012 -mcpu=@gol
1013 -mbig-endian-data -mlittle-endian-data @gol
1014 -msmall-data @gol
1015 -msim -mno-sim@gol
1016 -mas100-syntax -mno-as100-syntax@gol
1017 -mrelax@gol
1018 -mmax-constant-size=@gol
1019 -mint-register=@gol
1020 -mpid@gol
1021 -mallow-string-insns -mno-allow-string-insns@gol
1022 -mjsr@gol
1023 -mno-warn-multiple-fast-interrupts@gol
1024 -msave-acc-in-interrupts}
1025
1026 @emph{S/390 and zSeries Options}
1027 @gccoptlist{-mtune=@var{cpu-type} -march=@var{cpu-type} @gol
1028 -mhard-float -msoft-float -mhard-dfp -mno-hard-dfp @gol
1029 -mlong-double-64 -mlong-double-128 @gol
1030 -mbackchain -mno-backchain -mpacked-stack -mno-packed-stack @gol
1031 -msmall-exec -mno-small-exec -mmvcle -mno-mvcle @gol
1032 -m64 -m31 -mdebug -mno-debug -mesa -mzarch @gol
1033 -mhtm -mvx -mzvector @gol
1034 -mtpf-trace -mno-tpf-trace -mfused-madd -mno-fused-madd @gol
1035 -mwarn-framesize -mwarn-dynamicstack -mstack-size -mstack-guard @gol
1036 -mhotpatch=@var{halfwords},@var{halfwords}}
1037
1038 @emph{Score Options}
1039 @gccoptlist{-meb -mel @gol
1040 -mnhwloop @gol
1041 -muls @gol
1042 -mmac @gol
1043 -mscore5 -mscore5u -mscore7 -mscore7d}
1044
1045 @emph{SH Options}
1046 @gccoptlist{-m1 -m2 -m2e @gol
1047 -m2a-nofpu -m2a-single-only -m2a-single -m2a @gol
1048 -m3 -m3e @gol
1049 -m4-nofpu -m4-single-only -m4-single -m4 @gol
1050 -m4a-nofpu -m4a-single-only -m4a-single -m4a -m4al @gol
1051 -mb -ml -mdalign -mrelax @gol
1052 -mbigtable -mfmovd -mrenesas -mno-renesas -mnomacsave @gol
1053 -mieee -mno-ieee -mbitops -misize -minline-ic_invalidate -mpadstruct @gol
1054 -mprefergot -musermode -multcost=@var{number} -mdiv=@var{strategy} @gol
1055 -mdivsi3_libfunc=@var{name} -mfixed-range=@var{register-range} @gol
1056 -maccumulate-outgoing-args @gol
1057 -matomic-model=@var{atomic-model} @gol
1058 -mbranch-cost=@var{num} -mzdcbranch -mno-zdcbranch @gol
1059 -mcbranch-force-delay-slot @gol
1060 -mfused-madd -mno-fused-madd -mfsca -mno-fsca -mfsrra -mno-fsrra @gol
1061 -mpretend-cmove -mtas}
1062
1063 @emph{Solaris 2 Options}
1064 @gccoptlist{-mclear-hwcap -mno-clear-hwcap -mimpure-text -mno-impure-text @gol
1065 -pthreads -pthread}
1066
1067 @emph{SPARC Options}
1068 @gccoptlist{-mcpu=@var{cpu-type} @gol
1069 -mtune=@var{cpu-type} @gol
1070 -mcmodel=@var{code-model} @gol
1071 -mmemory-model=@var{mem-model} @gol
1072 -m32 -m64 -mapp-regs -mno-app-regs @gol
1073 -mfaster-structs -mno-faster-structs -mflat -mno-flat @gol
1074 -mfpu -mno-fpu -mhard-float -msoft-float @gol
1075 -mhard-quad-float -msoft-quad-float @gol
1076 -mstack-bias -mno-stack-bias @gol
1077 -mstd-struct-return -mno-std-struct-return @gol
1078 -munaligned-doubles -mno-unaligned-doubles @gol
1079 -muser-mode -mno-user-mode @gol
1080 -mv8plus -mno-v8plus -mvis -mno-vis @gol
1081 -mvis2 -mno-vis2 -mvis3 -mno-vis3 @gol
1082 -mcbcond -mno-cbcond @gol
1083 -mfmaf -mno-fmaf -mpopc -mno-popc @gol
1084 -mfix-at697f -mfix-ut699}
1085
1086 @emph{SPU Options}
1087 @gccoptlist{-mwarn-reloc -merror-reloc @gol
1088 -msafe-dma -munsafe-dma @gol
1089 -mbranch-hints @gol
1090 -msmall-mem -mlarge-mem -mstdmain @gol
1091 -mfixed-range=@var{register-range} @gol
1092 -mea32 -mea64 @gol
1093 -maddress-space-conversion -mno-address-space-conversion @gol
1094 -mcache-size=@var{cache-size} @gol
1095 -matomic-updates -mno-atomic-updates}
1096
1097 @emph{System V Options}
1098 @gccoptlist{-Qy -Qn -YP,@var{paths} -Ym,@var{dir}}
1099
1100 @emph{TILE-Gx Options}
1101 @gccoptlist{-mcpu=CPU -m32 -m64 -mbig-endian -mlittle-endian @gol
1102 -mcmodel=@var{code-model}}
1103
1104 @emph{TILEPro Options}
1105 @gccoptlist{-mcpu=@var{cpu} -m32}
1106
1107 @emph{V850 Options}
1108 @gccoptlist{-mlong-calls -mno-long-calls -mep -mno-ep @gol
1109 -mprolog-function -mno-prolog-function -mspace @gol
1110 -mtda=@var{n} -msda=@var{n} -mzda=@var{n} @gol
1111 -mapp-regs -mno-app-regs @gol
1112 -mdisable-callt -mno-disable-callt @gol
1113 -mv850e2v3 -mv850e2 -mv850e1 -mv850es @gol
1114 -mv850e -mv850 -mv850e3v5 @gol
1115 -mloop @gol
1116 -mrelax @gol
1117 -mlong-jumps @gol
1118 -msoft-float @gol
1119 -mhard-float @gol
1120 -mgcc-abi @gol
1121 -mrh850-abi @gol
1122 -mbig-switch}
1123
1124 @emph{VAX Options}
1125 @gccoptlist{-mg -mgnu -munix}
1126
1127 @emph{Visium Options}
1128 @gccoptlist{-mdebug -msim -mfpu -mno-fpu -mhard-float -msoft-float @gol
1129 -mcpu=@var{cpu-type} -mtune=@var{cpu-type} -msv-mode -muser-mode}
1130
1131 @emph{VMS Options}
1132 @gccoptlist{-mvms-return-codes -mdebug-main=@var{prefix} -mmalloc64 @gol
1133 -mpointer-size=@var{size}}
1134
1135 @emph{VxWorks Options}
1136 @gccoptlist{-mrtp -non-static -Bstatic -Bdynamic @gol
1137 -Xbind-lazy -Xbind-now}
1138
1139 @emph{x86 Options}
1140 @gccoptlist{-mtune=@var{cpu-type} -march=@var{cpu-type} @gol
1141 -mtune-ctrl=@var{feature-list} -mdump-tune-features -mno-default @gol
1142 -mfpmath=@var{unit} @gol
1143 -masm=@var{dialect} -mno-fancy-math-387 @gol
1144 -mno-fp-ret-in-387 -msoft-float @gol
1145 -mno-wide-multiply -mrtd -malign-double @gol
1146 -mpreferred-stack-boundary=@var{num} @gol
1147 -mincoming-stack-boundary=@var{num} @gol
1148 -mcld -mcx16 -msahf -mmovbe -mcrc32 @gol
1149 -mrecip -mrecip=@var{opt} @gol
1150 -mvzeroupper -mprefer-avx128 @gol
1151 -mmmx -msse -msse2 -msse3 -mssse3 -msse4.1 -msse4.2 -msse4 -mavx @gol
1152 -mavx2 -mavx512f -mavx512pf -mavx512er -mavx512cd -mavx512vl @gol
1153 -mavx512bw -mavx512dq -mavx512ifma -mavx512vbmi -msha -maes @gol
1154 -mpclmul -mfsgsbase -mrdrnd -mf16c -mfma @gol
1155 -mprefetchwt1 -mclflushopt -mxsavec -mxsaves @gol
1156 -msse4a -m3dnow -mpopcnt -mabm -mbmi -mtbm -mfma4 -mxop -mlzcnt @gol
1157 -mbmi2 -mfxsr -mxsave -mxsaveopt -mrtm -mlwp -mmpx -mmwaitx -mclzero
1158 -mpku -mthreads @gol
1159 -mms-bitfields -mno-align-stringops -minline-all-stringops @gol
1160 -minline-stringops-dynamically -mstringop-strategy=@var{alg} @gol
1161 -mmemcpy-strategy=@var{strategy} -mmemset-strategy=@var{strategy} @gol
1162 -mpush-args -maccumulate-outgoing-args -m128bit-long-double @gol
1163 -m96bit-long-double -mlong-double-64 -mlong-double-80 -mlong-double-128 @gol
1164 -mregparm=@var{num} -msseregparm @gol
1165 -mveclibabi=@var{type} -mvect8-ret-in-mem @gol
1166 -mpc32 -mpc64 -mpc80 -mstackrealign @gol
1167 -momit-leaf-frame-pointer -mno-red-zone -mno-tls-direct-seg-refs @gol
1168 -mcmodel=@var{code-model} -mabi=@var{name} -maddress-mode=@var{mode} @gol
1169 -m32 -m64 -mx32 -m16 -miamcu -mlarge-data-threshold=@var{num} @gol
1170 -msse2avx -mfentry -mrecord-mcount -mnop-mcount -m8bit-idiv @gol
1171 -mavx256-split-unaligned-load -mavx256-split-unaligned-store @gol
1172 -malign-data=@var{type} -mstack-protector-guard=@var{guard} @gol
1173 -mmitigate-rop}
1174
1175 @emph{x86 Windows Options}
1176 @gccoptlist{-mconsole -mcygwin -mno-cygwin -mdll @gol
1177 -mnop-fun-dllimport -mthread @gol
1178 -municode -mwin32 -mwindows -fno-set-stack-executable}
1179
1180 @emph{Xstormy16 Options}
1181 @gccoptlist{-msim}
1182
1183 @emph{Xtensa Options}
1184 @gccoptlist{-mconst16 -mno-const16 @gol
1185 -mfused-madd -mno-fused-madd @gol
1186 -mforce-no-pic @gol
1187 -mserialize-volatile -mno-serialize-volatile @gol
1188 -mtext-section-literals -mno-text-section-literals @gol
1189 -mauto-litpools -mno-auto-litpools @gol
1190 -mtarget-align -mno-target-align @gol
1191 -mlongcalls -mno-longcalls}
1192
1193 @emph{zSeries Options}
1194 See S/390 and zSeries Options.
1195 @end table
1196
1197
1198 @node Overall Options
1199 @section Options Controlling the Kind of Output
1200
1201 Compilation can involve up to four stages: preprocessing, compilation
1202 proper, assembly and linking, always in that order. GCC is capable of
1203 preprocessing and compiling several files either into several
1204 assembler input files, or into one assembler input file; then each
1205 assembler input file produces an object file, and linking combines all
1206 the object files (those newly compiled, and those specified as input)
1207 into an executable file.
1208
1209 @cindex file name suffix
1210 For any given input file, the file name suffix determines what kind of
1211 compilation is done:
1212
1213 @table @gcctabopt
1214 @item @var{file}.c
1215 C source code that must be preprocessed.
1216
1217 @item @var{file}.i
1218 C source code that should not be preprocessed.
1219
1220 @item @var{file}.ii
1221 C++ source code that should not be preprocessed.
1222
1223 @item @var{file}.m
1224 Objective-C source code. Note that you must link with the @file{libobjc}
1225 library to make an Objective-C program work.
1226
1227 @item @var{file}.mi
1228 Objective-C source code that should not be preprocessed.
1229
1230 @item @var{file}.mm
1231 @itemx @var{file}.M
1232 Objective-C++ source code. Note that you must link with the @file{libobjc}
1233 library to make an Objective-C++ program work. Note that @samp{.M} refers
1234 to a literal capital M@.
1235
1236 @item @var{file}.mii
1237 Objective-C++ source code that should not be preprocessed.
1238
1239 @item @var{file}.h
1240 C, C++, Objective-C or Objective-C++ header file to be turned into a
1241 precompiled header (default), or C, C++ header file to be turned into an
1242 Ada spec (via the @option{-fdump-ada-spec} switch).
1243
1244 @item @var{file}.cc
1245 @itemx @var{file}.cp
1246 @itemx @var{file}.cxx
1247 @itemx @var{file}.cpp
1248 @itemx @var{file}.CPP
1249 @itemx @var{file}.c++
1250 @itemx @var{file}.C
1251 C++ source code that must be preprocessed. Note that in @samp{.cxx},
1252 the last two letters must both be literally @samp{x}. Likewise,
1253 @samp{.C} refers to a literal capital C@.
1254
1255 @item @var{file}.mm
1256 @itemx @var{file}.M
1257 Objective-C++ source code that must be preprocessed.
1258
1259 @item @var{file}.mii
1260 Objective-C++ source code that should not be preprocessed.
1261
1262 @item @var{file}.hh
1263 @itemx @var{file}.H
1264 @itemx @var{file}.hp
1265 @itemx @var{file}.hxx
1266 @itemx @var{file}.hpp
1267 @itemx @var{file}.HPP
1268 @itemx @var{file}.h++
1269 @itemx @var{file}.tcc
1270 C++ header file to be turned into a precompiled header or Ada spec.
1271
1272 @item @var{file}.f
1273 @itemx @var{file}.for
1274 @itemx @var{file}.ftn
1275 Fixed form Fortran source code that should not be preprocessed.
1276
1277 @item @var{file}.F
1278 @itemx @var{file}.FOR
1279 @itemx @var{file}.fpp
1280 @itemx @var{file}.FPP
1281 @itemx @var{file}.FTN
1282 Fixed form Fortran source code that must be preprocessed (with the traditional
1283 preprocessor).
1284
1285 @item @var{file}.f90
1286 @itemx @var{file}.f95
1287 @itemx @var{file}.f03
1288 @itemx @var{file}.f08
1289 Free form Fortran source code that should not be preprocessed.
1290
1291 @item @var{file}.F90
1292 @itemx @var{file}.F95
1293 @itemx @var{file}.F03
1294 @itemx @var{file}.F08
1295 Free form Fortran source code that must be preprocessed (with the
1296 traditional preprocessor).
1297
1298 @item @var{file}.go
1299 Go source code.
1300
1301 @c FIXME: Descriptions of Java file types.
1302 @c @var{file}.java
1303 @c @var{file}.class
1304 @c @var{file}.zip
1305 @c @var{file}.jar
1306
1307 @item @var{file}.ads
1308 Ada source code file that contains a library unit declaration (a
1309 declaration of a package, subprogram, or generic, or a generic
1310 instantiation), or a library unit renaming declaration (a package,
1311 generic, or subprogram renaming declaration). Such files are also
1312 called @dfn{specs}.
1313
1314 @item @var{file}.adb
1315 Ada source code file containing a library unit body (a subprogram or
1316 package body). Such files are also called @dfn{bodies}.
1317
1318 @c GCC also knows about some suffixes for languages not yet included:
1319 @c Pascal:
1320 @c @var{file}.p
1321 @c @var{file}.pas
1322 @c Ratfor:
1323 @c @var{file}.r
1324
1325 @item @var{file}.s
1326 Assembler code.
1327
1328 @item @var{file}.S
1329 @itemx @var{file}.sx
1330 Assembler code that must be preprocessed.
1331
1332 @item @var{other}
1333 An object file to be fed straight into linking.
1334 Any file name with no recognized suffix is treated this way.
1335 @end table
1336
1337 @opindex x
1338 You can specify the input language explicitly with the @option{-x} option:
1339
1340 @table @gcctabopt
1341 @item -x @var{language}
1342 Specify explicitly the @var{language} for the following input files
1343 (rather than letting the compiler choose a default based on the file
1344 name suffix). This option applies to all following input files until
1345 the next @option{-x} option. Possible values for @var{language} are:
1346 @smallexample
1347 c c-header cpp-output
1348 c++ c++-header c++-cpp-output
1349 objective-c objective-c-header objective-c-cpp-output
1350 objective-c++ objective-c++-header objective-c++-cpp-output
1351 assembler assembler-with-cpp
1352 ada
1353 f77 f77-cpp-input f95 f95-cpp-input
1354 go
1355 java
1356 @end smallexample
1357
1358 @item -x none
1359 Turn off any specification of a language, so that subsequent files are
1360 handled according to their file name suffixes (as they are if @option{-x}
1361 has not been used at all).
1362 @end table
1363
1364 If you only want some of the stages of compilation, you can use
1365 @option{-x} (or filename suffixes) to tell @command{gcc} where to start, and
1366 one of the options @option{-c}, @option{-S}, or @option{-E} to say where
1367 @command{gcc} is to stop. Note that some combinations (for example,
1368 @samp{-x cpp-output -E}) instruct @command{gcc} to do nothing at all.
1369
1370 @table @gcctabopt
1371 @item -c
1372 @opindex c
1373 Compile or assemble the source files, but do not link. The linking
1374 stage simply is not done. The ultimate output is in the form of an
1375 object file for each source file.
1376
1377 By default, the object file name for a source file is made by replacing
1378 the suffix @samp{.c}, @samp{.i}, @samp{.s}, etc., with @samp{.o}.
1379
1380 Unrecognized input files, not requiring compilation or assembly, are
1381 ignored.
1382
1383 @item -S
1384 @opindex S
1385 Stop after the stage of compilation proper; do not assemble. The output
1386 is in the form of an assembler code file for each non-assembler input
1387 file specified.
1388
1389 By default, the assembler file name for a source file is made by
1390 replacing the suffix @samp{.c}, @samp{.i}, etc., with @samp{.s}.
1391
1392 Input files that don't require compilation are ignored.
1393
1394 @item -E
1395 @opindex E
1396 Stop after the preprocessing stage; do not run the compiler proper. The
1397 output is in the form of preprocessed source code, which is sent to the
1398 standard output.
1399
1400 Input files that don't require preprocessing are ignored.
1401
1402 @cindex output file option
1403 @item -o @var{file}
1404 @opindex o
1405 Place output in file @var{file}. This applies to whatever
1406 sort of output is being produced, whether it be an executable file,
1407 an object file, an assembler file or preprocessed C code.
1408
1409 If @option{-o} is not specified, the default is to put an executable
1410 file in @file{a.out}, the object file for
1411 @file{@var{source}.@var{suffix}} in @file{@var{source}.o}, its
1412 assembler file in @file{@var{source}.s}, a precompiled header file in
1413 @file{@var{source}.@var{suffix}.gch}, and all preprocessed C source on
1414 standard output.
1415
1416 @item -v
1417 @opindex v
1418 Print (on standard error output) the commands executed to run the stages
1419 of compilation. Also print the version number of the compiler driver
1420 program and of the preprocessor and the compiler proper.
1421
1422 @item -###
1423 @opindex ###
1424 Like @option{-v} except the commands are not executed and arguments
1425 are quoted unless they contain only alphanumeric characters or @code{./-_}.
1426 This is useful for shell scripts to capture the driver-generated command lines.
1427
1428 @item --help
1429 @opindex help
1430 Print (on the standard output) a description of the command-line options
1431 understood by @command{gcc}. If the @option{-v} option is also specified
1432 then @option{--help} is also passed on to the various processes
1433 invoked by @command{gcc}, so that they can display the command-line options
1434 they accept. If the @option{-Wextra} option has also been specified
1435 (prior to the @option{--help} option), then command-line options that
1436 have no documentation associated with them are also displayed.
1437
1438 @item --target-help
1439 @opindex target-help
1440 Print (on the standard output) a description of target-specific command-line
1441 options for each tool. For some targets extra target-specific
1442 information may also be printed.
1443
1444 @item --help=@{@var{class}@r{|[}^@r{]}@var{qualifier}@}@r{[},@dots{}@r{]}
1445 Print (on the standard output) a description of the command-line
1446 options understood by the compiler that fit into all specified classes
1447 and qualifiers. These are the supported classes:
1448
1449 @table @asis
1450 @item @samp{optimizers}
1451 Display all of the optimization options supported by the
1452 compiler.
1453
1454 @item @samp{warnings}
1455 Display all of the options controlling warning messages
1456 produced by the compiler.
1457
1458 @item @samp{target}
1459 Display target-specific options. Unlike the
1460 @option{--target-help} option however, target-specific options of the
1461 linker and assembler are not displayed. This is because those
1462 tools do not currently support the extended @option{--help=} syntax.
1463
1464 @item @samp{params}
1465 Display the values recognized by the @option{--param}
1466 option.
1467
1468 @item @var{language}
1469 Display the options supported for @var{language}, where
1470 @var{language} is the name of one of the languages supported in this
1471 version of GCC@.
1472
1473 @item @samp{common}
1474 Display the options that are common to all languages.
1475 @end table
1476
1477 These are the supported qualifiers:
1478
1479 @table @asis
1480 @item @samp{undocumented}
1481 Display only those options that are undocumented.
1482
1483 @item @samp{joined}
1484 Display options taking an argument that appears after an equal
1485 sign in the same continuous piece of text, such as:
1486 @samp{--help=target}.
1487
1488 @item @samp{separate}
1489 Display options taking an argument that appears as a separate word
1490 following the original option, such as: @samp{-o output-file}.
1491 @end table
1492
1493 Thus for example to display all the undocumented target-specific
1494 switches supported by the compiler, use:
1495
1496 @smallexample
1497 --help=target,undocumented
1498 @end smallexample
1499
1500 The sense of a qualifier can be inverted by prefixing it with the
1501 @samp{^} character, so for example to display all binary warning
1502 options (i.e., ones that are either on or off and that do not take an
1503 argument) that have a description, use:
1504
1505 @smallexample
1506 --help=warnings,^joined,^undocumented
1507 @end smallexample
1508
1509 The argument to @option{--help=} should not consist solely of inverted
1510 qualifiers.
1511
1512 Combining several classes is possible, although this usually
1513 restricts the output so much that there is nothing to display. One
1514 case where it does work, however, is when one of the classes is
1515 @var{target}. For example, to display all the target-specific
1516 optimization options, use:
1517
1518 @smallexample
1519 --help=target,optimizers
1520 @end smallexample
1521
1522 The @option{--help=} option can be repeated on the command line. Each
1523 successive use displays its requested class of options, skipping
1524 those that have already been displayed.
1525
1526 If the @option{-Q} option appears on the command line before the
1527 @option{--help=} option, then the descriptive text displayed by
1528 @option{--help=} is changed. Instead of describing the displayed
1529 options, an indication is given as to whether the option is enabled,
1530 disabled or set to a specific value (assuming that the compiler
1531 knows this at the point where the @option{--help=} option is used).
1532
1533 Here is a truncated example from the ARM port of @command{gcc}:
1534
1535 @smallexample
1536 % gcc -Q -mabi=2 --help=target -c
1537 The following options are target specific:
1538 -mabi= 2
1539 -mabort-on-noreturn [disabled]
1540 -mapcs [disabled]
1541 @end smallexample
1542
1543 The output is sensitive to the effects of previous command-line
1544 options, so for example it is possible to find out which optimizations
1545 are enabled at @option{-O2} by using:
1546
1547 @smallexample
1548 -Q -O2 --help=optimizers
1549 @end smallexample
1550
1551 Alternatively you can discover which binary optimizations are enabled
1552 by @option{-O3} by using:
1553
1554 @smallexample
1555 gcc -c -Q -O3 --help=optimizers > /tmp/O3-opts
1556 gcc -c -Q -O2 --help=optimizers > /tmp/O2-opts
1557 diff /tmp/O2-opts /tmp/O3-opts | grep enabled
1558 @end smallexample
1559
1560 @item --version
1561 @opindex version
1562 Display the version number and copyrights of the invoked GCC@.
1563
1564 @item -pass-exit-codes
1565 @opindex pass-exit-codes
1566 Normally the @command{gcc} program exits with the code of 1 if any
1567 phase of the compiler returns a non-success return code. If you specify
1568 @option{-pass-exit-codes}, the @command{gcc} program instead returns with
1569 the numerically highest error produced by any phase returning an error
1570 indication. The C, C++, and Fortran front ends return 4 if an internal
1571 compiler error is encountered.
1572
1573 @item -pipe
1574 @opindex pipe
1575 Use pipes rather than temporary files for communication between the
1576 various stages of compilation. This fails to work on some systems where
1577 the assembler is unable to read from a pipe; but the GNU assembler has
1578 no trouble.
1579
1580 @item -specs=@var{file}
1581 @opindex specs
1582 Process @var{file} after the compiler reads in the standard @file{specs}
1583 file, in order to override the defaults which the @command{gcc} driver
1584 program uses when determining what switches to pass to @command{cc1},
1585 @command{cc1plus}, @command{as}, @command{ld}, etc. More than one
1586 @option{-specs=@var{file}} can be specified on the command line, and they
1587 are processed in order, from left to right. @xref{Spec Files}, for
1588 information about the format of the @var{file}.
1589
1590 @item -wrapper
1591 @opindex wrapper
1592 Invoke all subcommands under a wrapper program. The name of the
1593 wrapper program and its parameters are passed as a comma separated
1594 list.
1595
1596 @smallexample
1597 gcc -c t.c -wrapper gdb,--args
1598 @end smallexample
1599
1600 @noindent
1601 This invokes all subprograms of @command{gcc} under
1602 @samp{gdb --args}, thus the invocation of @command{cc1} is
1603 @samp{gdb --args cc1 @dots{}}.
1604
1605 @item -fplugin=@var{name}.so
1606 @opindex fplugin
1607 Load the plugin code in file @var{name}.so, assumed to be a
1608 shared object to be dlopen'd by the compiler. The base name of
1609 the shared object file is used to identify the plugin for the
1610 purposes of argument parsing (See
1611 @option{-fplugin-arg-@var{name}-@var{key}=@var{value}} below).
1612 Each plugin should define the callback functions specified in the
1613 Plugins API.
1614
1615 @item -fplugin-arg-@var{name}-@var{key}=@var{value}
1616 @opindex fplugin-arg
1617 Define an argument called @var{key} with a value of @var{value}
1618 for the plugin called @var{name}.
1619
1620 @item -fdump-ada-spec@r{[}-slim@r{]}
1621 @opindex fdump-ada-spec
1622 For C and C++ source and include files, generate corresponding Ada specs.
1623 @xref{Generating Ada Bindings for C and C++ headers,,, gnat_ugn,
1624 GNAT User's Guide}, which provides detailed documentation on this feature.
1625
1626 @item -fada-spec-parent=@var{unit}
1627 @opindex fada-spec-parent
1628 In conjunction with @option{-fdump-ada-spec@r{[}-slim@r{]}} above, generate
1629 Ada specs as child units of parent @var{unit}.
1630
1631 @item -fdump-go-spec=@var{file}
1632 @opindex fdump-go-spec
1633 For input files in any language, generate corresponding Go
1634 declarations in @var{file}. This generates Go @code{const},
1635 @code{type}, @code{var}, and @code{func} declarations which may be a
1636 useful way to start writing a Go interface to code written in some
1637 other language.
1638
1639 @include @value{srcdir}/../libiberty/at-file.texi
1640 @end table
1641
1642 @node Invoking G++
1643 @section Compiling C++ Programs
1644
1645 @cindex suffixes for C++ source
1646 @cindex C++ source file suffixes
1647 C++ source files conventionally use one of the suffixes @samp{.C},
1648 @samp{.cc}, @samp{.cpp}, @samp{.CPP}, @samp{.c++}, @samp{.cp}, or
1649 @samp{.cxx}; C++ header files often use @samp{.hh}, @samp{.hpp},
1650 @samp{.H}, or (for shared template code) @samp{.tcc}; and
1651 preprocessed C++ files use the suffix @samp{.ii}. GCC recognizes
1652 files with these names and compiles them as C++ programs even if you
1653 call the compiler the same way as for compiling C programs (usually
1654 with the name @command{gcc}).
1655
1656 @findex g++
1657 @findex c++
1658 However, the use of @command{gcc} does not add the C++ library.
1659 @command{g++} is a program that calls GCC and automatically specifies linking
1660 against the C++ library. It treats @samp{.c},
1661 @samp{.h} and @samp{.i} files as C++ source files instead of C source
1662 files unless @option{-x} is used. This program is also useful when
1663 precompiling a C header file with a @samp{.h} extension for use in C++
1664 compilations. On many systems, @command{g++} is also installed with
1665 the name @command{c++}.
1666
1667 @cindex invoking @command{g++}
1668 When you compile C++ programs, you may specify many of the same
1669 command-line options that you use for compiling programs in any
1670 language; or command-line options meaningful for C and related
1671 languages; or options that are meaningful only for C++ programs.
1672 @xref{C Dialect Options,,Options Controlling C Dialect}, for
1673 explanations of options for languages related to C@.
1674 @xref{C++ Dialect Options,,Options Controlling C++ Dialect}, for
1675 explanations of options that are meaningful only for C++ programs.
1676
1677 @node C Dialect Options
1678 @section Options Controlling C Dialect
1679 @cindex dialect options
1680 @cindex language dialect options
1681 @cindex options, dialect
1682
1683 The following options control the dialect of C (or languages derived
1684 from C, such as C++, Objective-C and Objective-C++) that the compiler
1685 accepts:
1686
1687 @table @gcctabopt
1688 @cindex ANSI support
1689 @cindex ISO support
1690 @item -ansi
1691 @opindex ansi
1692 In C mode, this is equivalent to @option{-std=c90}. In C++ mode, it is
1693 equivalent to @option{-std=c++98}.
1694
1695 This turns off certain features of GCC that are incompatible with ISO
1696 C90 (when compiling C code), or of standard C++ (when compiling C++ code),
1697 such as the @code{asm} and @code{typeof} keywords, and
1698 predefined macros such as @code{unix} and @code{vax} that identify the
1699 type of system you are using. It also enables the undesirable and
1700 rarely used ISO trigraph feature. For the C compiler,
1701 it disables recognition of C++ style @samp{//} comments as well as
1702 the @code{inline} keyword.
1703
1704 The alternate keywords @code{__asm__}, @code{__extension__},
1705 @code{__inline__} and @code{__typeof__} continue to work despite
1706 @option{-ansi}. You would not want to use them in an ISO C program, of
1707 course, but it is useful to put them in header files that might be included
1708 in compilations done with @option{-ansi}. Alternate predefined macros
1709 such as @code{__unix__} and @code{__vax__} are also available, with or
1710 without @option{-ansi}.
1711
1712 The @option{-ansi} option does not cause non-ISO programs to be
1713 rejected gratuitously. For that, @option{-Wpedantic} is required in
1714 addition to @option{-ansi}. @xref{Warning Options}.
1715
1716 The macro @code{__STRICT_ANSI__} is predefined when the @option{-ansi}
1717 option is used. Some header files may notice this macro and refrain
1718 from declaring certain functions or defining certain macros that the
1719 ISO standard doesn't call for; this is to avoid interfering with any
1720 programs that might use these names for other things.
1721
1722 Functions that are normally built in but do not have semantics
1723 defined by ISO C (such as @code{alloca} and @code{ffs}) are not built-in
1724 functions when @option{-ansi} is used. @xref{Other Builtins,,Other
1725 built-in functions provided by GCC}, for details of the functions
1726 affected.
1727
1728 @item -std=
1729 @opindex std
1730 Determine the language standard. @xref{Standards,,Language Standards
1731 Supported by GCC}, for details of these standard versions. This option
1732 is currently only supported when compiling C or C++.
1733
1734 The compiler can accept several base standards, such as @samp{c90} or
1735 @samp{c++98}, and GNU dialects of those standards, such as
1736 @samp{gnu90} or @samp{gnu++98}. When a base standard is specified, the
1737 compiler accepts all programs following that standard plus those
1738 using GNU extensions that do not contradict it. For example,
1739 @option{-std=c90} turns off certain features of GCC that are
1740 incompatible with ISO C90, such as the @code{asm} and @code{typeof}
1741 keywords, but not other GNU extensions that do not have a meaning in
1742 ISO C90, such as omitting the middle term of a @code{?:}
1743 expression. On the other hand, when a GNU dialect of a standard is
1744 specified, all features supported by the compiler are enabled, even when
1745 those features change the meaning of the base standard. As a result, some
1746 strict-conforming programs may be rejected. The particular standard
1747 is used by @option{-Wpedantic} to identify which features are GNU
1748 extensions given that version of the standard. For example
1749 @option{-std=gnu90 -Wpedantic} warns about C++ style @samp{//}
1750 comments, while @option{-std=gnu99 -Wpedantic} does not.
1751
1752 A value for this option must be provided; possible values are
1753
1754 @table @samp
1755 @item c90
1756 @itemx c89
1757 @itemx iso9899:1990
1758 Support all ISO C90 programs (certain GNU extensions that conflict
1759 with ISO C90 are disabled). Same as @option{-ansi} for C code.
1760
1761 @item iso9899:199409
1762 ISO C90 as modified in amendment 1.
1763
1764 @item c99
1765 @itemx c9x
1766 @itemx iso9899:1999
1767 @itemx iso9899:199x
1768 ISO C99. This standard is substantially completely supported, modulo
1769 bugs and floating-point issues
1770 (mainly but not entirely relating to optional C99 features from
1771 Annexes F and G). See
1772 @w{@uref{http://gcc.gnu.org/c99status.html}} for more information. The
1773 names @samp{c9x} and @samp{iso9899:199x} are deprecated.
1774
1775 @item c11
1776 @itemx c1x
1777 @itemx iso9899:2011
1778 ISO C11, the 2011 revision of the ISO C standard. This standard is
1779 substantially completely supported, modulo bugs, floating-point issues
1780 (mainly but not entirely relating to optional C11 features from
1781 Annexes F and G) and the optional Annexes K (Bounds-checking
1782 interfaces) and L (Analyzability). The name @samp{c1x} is deprecated.
1783
1784 @item gnu90
1785 @itemx gnu89
1786 GNU dialect of ISO C90 (including some C99 features).
1787
1788 @item gnu99
1789 @itemx gnu9x
1790 GNU dialect of ISO C99. The name @samp{gnu9x} is deprecated.
1791
1792 @item gnu11
1793 @itemx gnu1x
1794 GNU dialect of ISO C11. This is the default for C code.
1795 The name @samp{gnu1x} is deprecated.
1796
1797 @item c++98
1798 @itemx c++03
1799 The 1998 ISO C++ standard plus the 2003 technical corrigendum and some
1800 additional defect reports. Same as @option{-ansi} for C++ code.
1801
1802 @item gnu++98
1803 @itemx gnu++03
1804 GNU dialect of @option{-std=c++98}.
1805
1806 @item c++11
1807 @itemx c++0x
1808 The 2011 ISO C++ standard plus amendments.
1809 The name @samp{c++0x} is deprecated.
1810
1811 @item gnu++11
1812 @itemx gnu++0x
1813 GNU dialect of @option{-std=c++11}.
1814 The name @samp{gnu++0x} is deprecated.
1815
1816 @item c++14
1817 @itemx c++1y
1818 The 2014 ISO C++ standard plus amendments.
1819 The name @samp{c++1y} is deprecated.
1820
1821 @item gnu++14
1822 @itemx gnu++1y
1823 GNU dialect of @option{-std=c++14}.
1824 This is the default for C++ code.
1825 The name @samp{gnu++1y} is deprecated.
1826
1827 @item c++1z
1828 The next revision of the ISO C++ standard, tentatively planned for
1829 2017. Support is highly experimental, and will almost certainly
1830 change in incompatible ways in future releases.
1831
1832 @item gnu++1z
1833 GNU dialect of @option{-std=c++1z}. Support is highly experimental,
1834 and will almost certainly change in incompatible ways in future
1835 releases.
1836 @end table
1837
1838 @item -fgnu89-inline
1839 @opindex fgnu89-inline
1840 The option @option{-fgnu89-inline} tells GCC to use the traditional
1841 GNU semantics for @code{inline} functions when in C99 mode.
1842 @xref{Inline,,An Inline Function is As Fast As a Macro}.
1843 Using this option is roughly equivalent to adding the
1844 @code{gnu_inline} function attribute to all inline functions
1845 (@pxref{Function Attributes}).
1846
1847 The option @option{-fno-gnu89-inline} explicitly tells GCC to use the
1848 C99 semantics for @code{inline} when in C99 or gnu99 mode (i.e., it
1849 specifies the default behavior).
1850 This option is not supported in @option{-std=c90} or
1851 @option{-std=gnu90} mode.
1852
1853 The preprocessor macros @code{__GNUC_GNU_INLINE__} and
1854 @code{__GNUC_STDC_INLINE__} may be used to check which semantics are
1855 in effect for @code{inline} functions. @xref{Common Predefined
1856 Macros,,,cpp,The C Preprocessor}.
1857
1858 @item -aux-info @var{filename}
1859 @opindex aux-info
1860 Output to the given filename prototyped declarations for all functions
1861 declared and/or defined in a translation unit, including those in header
1862 files. This option is silently ignored in any language other than C@.
1863
1864 Besides declarations, the file indicates, in comments, the origin of
1865 each declaration (source file and line), whether the declaration was
1866 implicit, prototyped or unprototyped (@samp{I}, @samp{N} for new or
1867 @samp{O} for old, respectively, in the first character after the line
1868 number and the colon), and whether it came from a declaration or a
1869 definition (@samp{C} or @samp{F}, respectively, in the following
1870 character). In the case of function definitions, a K&R-style list of
1871 arguments followed by their declarations is also provided, inside
1872 comments, after the declaration.
1873
1874 @item -fallow-parameterless-variadic-functions
1875 @opindex fallow-parameterless-variadic-functions
1876 Accept variadic functions without named parameters.
1877
1878 Although it is possible to define such a function, this is not very
1879 useful as it is not possible to read the arguments. This is only
1880 supported for C as this construct is allowed by C++.
1881
1882 @item -fno-asm
1883 @opindex fno-asm
1884 Do not recognize @code{asm}, @code{inline} or @code{typeof} as a
1885 keyword, so that code can use these words as identifiers. You can use
1886 the keywords @code{__asm__}, @code{__inline__} and @code{__typeof__}
1887 instead. @option{-ansi} implies @option{-fno-asm}.
1888
1889 In C++, this switch only affects the @code{typeof} keyword, since
1890 @code{asm} and @code{inline} are standard keywords. You may want to
1891 use the @option{-fno-gnu-keywords} flag instead, which has the same
1892 effect. In C99 mode (@option{-std=c99} or @option{-std=gnu99}), this
1893 switch only affects the @code{asm} and @code{typeof} keywords, since
1894 @code{inline} is a standard keyword in ISO C99.
1895
1896 @item -fno-builtin
1897 @itemx -fno-builtin-@var{function}
1898 @opindex fno-builtin
1899 @cindex built-in functions
1900 Don't recognize built-in functions that do not begin with
1901 @samp{__builtin_} as prefix. @xref{Other Builtins,,Other built-in
1902 functions provided by GCC}, for details of the functions affected,
1903 including those which are not built-in functions when @option{-ansi} or
1904 @option{-std} options for strict ISO C conformance are used because they
1905 do not have an ISO standard meaning.
1906
1907 GCC normally generates special code to handle certain built-in functions
1908 more efficiently; for instance, calls to @code{alloca} may become single
1909 instructions which adjust the stack directly, and calls to @code{memcpy}
1910 may become inline copy loops. The resulting code is often both smaller
1911 and faster, but since the function calls no longer appear as such, you
1912 cannot set a breakpoint on those calls, nor can you change the behavior
1913 of the functions by linking with a different library. In addition,
1914 when a function is recognized as a built-in function, GCC may use
1915 information about that function to warn about problems with calls to
1916 that function, or to generate more efficient code, even if the
1917 resulting code still contains calls to that function. For example,
1918 warnings are given with @option{-Wformat} for bad calls to
1919 @code{printf} when @code{printf} is built in and @code{strlen} is
1920 known not to modify global memory.
1921
1922 With the @option{-fno-builtin-@var{function}} option
1923 only the built-in function @var{function} is
1924 disabled. @var{function} must not begin with @samp{__builtin_}. If a
1925 function is named that is not built-in in this version of GCC, this
1926 option is ignored. There is no corresponding
1927 @option{-fbuiltin-@var{function}} option; if you wish to enable
1928 built-in functions selectively when using @option{-fno-builtin} or
1929 @option{-ffreestanding}, you may define macros such as:
1930
1931 @smallexample
1932 #define abs(n) __builtin_abs ((n))
1933 #define strcpy(d, s) __builtin_strcpy ((d), (s))
1934 @end smallexample
1935
1936 @item -fhosted
1937 @opindex fhosted
1938 @cindex hosted environment
1939
1940 Assert that compilation targets a hosted environment. This implies
1941 @option{-fbuiltin}. A hosted environment is one in which the
1942 entire standard library is available, and in which @code{main} has a return
1943 type of @code{int}. Examples are nearly everything except a kernel.
1944 This is equivalent to @option{-fno-freestanding}.
1945
1946 @item -ffreestanding
1947 @opindex ffreestanding
1948 @cindex hosted environment
1949
1950 Assert that compilation targets a freestanding environment. This
1951 implies @option{-fno-builtin}. A freestanding environment
1952 is one in which the standard library may not exist, and program startup may
1953 not necessarily be at @code{main}. The most obvious example is an OS kernel.
1954 This is equivalent to @option{-fno-hosted}.
1955
1956 @xref{Standards,,Language Standards Supported by GCC}, for details of
1957 freestanding and hosted environments.
1958
1959 @item -fopenacc
1960 @opindex fopenacc
1961 @cindex OpenACC accelerator programming
1962 Enable handling of OpenACC directives @code{#pragma acc} in C/C++ and
1963 @code{!$acc} in Fortran. When @option{-fopenacc} is specified, the
1964 compiler generates accelerated code according to the OpenACC Application
1965 Programming Interface v2.0 @w{@uref{http://www.openacc.org/}}. This option
1966 implies @option{-pthread}, and thus is only supported on targets that
1967 have support for @option{-pthread}.
1968
1969 @item -fopenacc-dim=@var{geom}
1970 @opindex fopenacc-dim
1971 @cindex OpenACC accelerator programming
1972 Specify default compute dimensions for parallel offload regions that do
1973 not explicitly specify. The @var{geom} value is a triple of
1974 ':'-separated sizes, in order 'gang', 'worker' and, 'vector'. A size
1975 can be omitted, to use a target-specific default value.
1976
1977 @item -fopenmp
1978 @opindex fopenmp
1979 @cindex OpenMP parallel
1980 Enable handling of OpenMP directives @code{#pragma omp} in C/C++ and
1981 @code{!$omp} in Fortran. When @option{-fopenmp} is specified, the
1982 compiler generates parallel code according to the OpenMP Application
1983 Program Interface v4.0 @w{@uref{http://www.openmp.org/}}. This option
1984 implies @option{-pthread}, and thus is only supported on targets that
1985 have support for @option{-pthread}. @option{-fopenmp} implies
1986 @option{-fopenmp-simd}.
1987
1988 @item -fopenmp-simd
1989 @opindex fopenmp-simd
1990 @cindex OpenMP SIMD
1991 @cindex SIMD
1992 Enable handling of OpenMP's SIMD directives with @code{#pragma omp}
1993 in C/C++ and @code{!$omp} in Fortran. Other OpenMP directives
1994 are ignored.
1995
1996 @item -fcilkplus
1997 @opindex fcilkplus
1998 @cindex Enable Cilk Plus
1999 Enable the usage of Cilk Plus language extension features for C/C++.
2000 When the option @option{-fcilkplus} is specified, enable the usage of
2001 the Cilk Plus Language extension features for C/C++. The present
2002 implementation follows ABI version 1.2. This is an experimental
2003 feature that is only partially complete, and whose interface may
2004 change in future versions of GCC as the official specification
2005 changes. Currently, all features but @code{_Cilk_for} have been
2006 implemented.
2007
2008 @item -fgnu-tm
2009 @opindex fgnu-tm
2010 When the option @option{-fgnu-tm} is specified, the compiler
2011 generates code for the Linux variant of Intel's current Transactional
2012 Memory ABI specification document (Revision 1.1, May 6 2009). This is
2013 an experimental feature whose interface may change in future versions
2014 of GCC, as the official specification changes. Please note that not
2015 all architectures are supported for this feature.
2016
2017 For more information on GCC's support for transactional memory,
2018 @xref{Enabling libitm,,The GNU Transactional Memory Library,libitm,GNU
2019 Transactional Memory Library}.
2020
2021 Note that the transactional memory feature is not supported with
2022 non-call exceptions (@option{-fnon-call-exceptions}).
2023
2024 @item -fms-extensions
2025 @opindex fms-extensions
2026 Accept some non-standard constructs used in Microsoft header files.
2027
2028 In C++ code, this allows member names in structures to be similar
2029 to previous types declarations.
2030
2031 @smallexample
2032 typedef int UOW;
2033 struct ABC @{
2034 UOW UOW;
2035 @};
2036 @end smallexample
2037
2038 Some cases of unnamed fields in structures and unions are only
2039 accepted with this option. @xref{Unnamed Fields,,Unnamed struct/union
2040 fields within structs/unions}, for details.
2041
2042 Note that this option is off for all targets but x86
2043 targets using ms-abi.
2044
2045 @item -fplan9-extensions
2046 @opindex fplan9-extensions
2047 Accept some non-standard constructs used in Plan 9 code.
2048
2049 This enables @option{-fms-extensions}, permits passing pointers to
2050 structures with anonymous fields to functions that expect pointers to
2051 elements of the type of the field, and permits referring to anonymous
2052 fields declared using a typedef. @xref{Unnamed Fields,,Unnamed
2053 struct/union fields within structs/unions}, for details. This is only
2054 supported for C, not C++.
2055
2056 @item -trigraphs
2057 @opindex trigraphs
2058 Support ISO C trigraphs. The @option{-ansi} option (and @option{-std}
2059 options for strict ISO C conformance) implies @option{-trigraphs}.
2060
2061 @cindex traditional C language
2062 @cindex C language, traditional
2063 @item -traditional
2064 @itemx -traditional-cpp
2065 @opindex traditional-cpp
2066 @opindex traditional
2067 Formerly, these options caused GCC to attempt to emulate a pre-standard
2068 C compiler. They are now only supported with the @option{-E} switch.
2069 The preprocessor continues to support a pre-standard mode. See the GNU
2070 CPP manual for details.
2071
2072 @item -fcond-mismatch
2073 @opindex fcond-mismatch
2074 Allow conditional expressions with mismatched types in the second and
2075 third arguments. The value of such an expression is void. This option
2076 is not supported for C++.
2077
2078 @item -flax-vector-conversions
2079 @opindex flax-vector-conversions
2080 Allow implicit conversions between vectors with differing numbers of
2081 elements and/or incompatible element types. This option should not be
2082 used for new code.
2083
2084 @item -funsigned-char
2085 @opindex funsigned-char
2086 Let the type @code{char} be unsigned, like @code{unsigned char}.
2087
2088 Each kind of machine has a default for what @code{char} should
2089 be. It is either like @code{unsigned char} by default or like
2090 @code{signed char} by default.
2091
2092 Ideally, a portable program should always use @code{signed char} or
2093 @code{unsigned char} when it depends on the signedness of an object.
2094 But many programs have been written to use plain @code{char} and
2095 expect it to be signed, or expect it to be unsigned, depending on the
2096 machines they were written for. This option, and its inverse, let you
2097 make such a program work with the opposite default.
2098
2099 The type @code{char} is always a distinct type from each of
2100 @code{signed char} or @code{unsigned char}, even though its behavior
2101 is always just like one of those two.
2102
2103 @item -fsigned-char
2104 @opindex fsigned-char
2105 Let the type @code{char} be signed, like @code{signed char}.
2106
2107 Note that this is equivalent to @option{-fno-unsigned-char}, which is
2108 the negative form of @option{-funsigned-char}. Likewise, the option
2109 @option{-fno-signed-char} is equivalent to @option{-funsigned-char}.
2110
2111 @item -fsigned-bitfields
2112 @itemx -funsigned-bitfields
2113 @itemx -fno-signed-bitfields
2114 @itemx -fno-unsigned-bitfields
2115 @opindex fsigned-bitfields
2116 @opindex funsigned-bitfields
2117 @opindex fno-signed-bitfields
2118 @opindex fno-unsigned-bitfields
2119 These options control whether a bit-field is signed or unsigned, when the
2120 declaration does not use either @code{signed} or @code{unsigned}. By
2121 default, such a bit-field is signed, because this is consistent: the
2122 basic integer types such as @code{int} are signed types.
2123
2124 @item -fsso-struct=@var{endianness}
2125 @opindex fsso-struct
2126 Set the default scalar storage order of structures and unions to the
2127 specified endianness. The accepted values are @samp{big-endian} and
2128 @samp{little-endian}. If the option is not passed, the compiler uses
2129 the native endianness of the target. This option is not supported for C++.
2130
2131 @strong{Warning:} the @option{-fsso-struct} switch causes GCC to generate
2132 code that is not binary compatible with code generated without it if the
2133 specified endianness is not the native endianness of the target.
2134 @end table
2135
2136 @node C++ Dialect Options
2137 @section Options Controlling C++ Dialect
2138
2139 @cindex compiler options, C++
2140 @cindex C++ options, command-line
2141 @cindex options, C++
2142 This section describes the command-line options that are only meaningful
2143 for C++ programs. You can also use most of the GNU compiler options
2144 regardless of what language your program is in. For example, you
2145 might compile a file @file{firstClass.C} like this:
2146
2147 @smallexample
2148 g++ -g -fstrict-enums -O -c firstClass.C
2149 @end smallexample
2150
2151 @noindent
2152 In this example, only @option{-fstrict-enums} is an option meant
2153 only for C++ programs; you can use the other options with any
2154 language supported by GCC@.
2155
2156 Some options for compiling C programs, such as @option{-std}, are also
2157 relevant for C++ programs.
2158 @xref{C Dialect Options,,Options Controlling C Dialect}.
2159
2160 Here is a list of options that are @emph{only} for compiling C++ programs:
2161
2162 @table @gcctabopt
2163
2164 @item -fabi-version=@var{n}
2165 @opindex fabi-version
2166 Use version @var{n} of the C++ ABI@. The default is version 0.
2167
2168 Version 0 refers to the version conforming most closely to
2169 the C++ ABI specification. Therefore, the ABI obtained using version 0
2170 will change in different versions of G++ as ABI bugs are fixed.
2171
2172 Version 1 is the version of the C++ ABI that first appeared in G++ 3.2.
2173
2174 Version 2 is the version of the C++ ABI that first appeared in G++
2175 3.4, and was the default through G++ 4.9.
2176
2177 Version 3 corrects an error in mangling a constant address as a
2178 template argument.
2179
2180 Version 4, which first appeared in G++ 4.5, implements a standard
2181 mangling for vector types.
2182
2183 Version 5, which first appeared in G++ 4.6, corrects the mangling of
2184 attribute const/volatile on function pointer types, decltype of a
2185 plain decl, and use of a function parameter in the declaration of
2186 another parameter.
2187
2188 Version 6, which first appeared in G++ 4.7, corrects the promotion
2189 behavior of C++11 scoped enums and the mangling of template argument
2190 packs, const/static_cast, prefix ++ and --, and a class scope function
2191 used as a template argument.
2192
2193 Version 7, which first appeared in G++ 4.8, that treats nullptr_t as a
2194 builtin type and corrects the mangling of lambdas in default argument
2195 scope.
2196
2197 Version 8, which first appeared in G++ 4.9, corrects the substitution
2198 behavior of function types with function-cv-qualifiers.
2199
2200 Version 9, which first appeared in G++ 5.2, corrects the alignment of
2201 @code{nullptr_t}.
2202
2203 Version 10, which first appeared in G++ 6.1, adds mangling of
2204 attributes that affect type identity, such as ia32 calling convention
2205 attributes (e.g. @samp{stdcall}).
2206
2207 See also @option{-Wabi}.
2208
2209 @item -fabi-compat-version=@var{n}
2210 @opindex fabi-compat-version
2211 On targets that support strong aliases, G++
2212 works around mangling changes by creating an alias with the correct
2213 mangled name when defining a symbol with an incorrect mangled name.
2214 This switch specifies which ABI version to use for the alias.
2215
2216 With @option{-fabi-version=0} (the default), this defaults to 8 (GCC 5
2217 compatibility). If another ABI version is explicitly selected, this
2218 defaults to 0. For compatibility with GCC versions 3.2 through 4.9,
2219 use @option{-fabi-compat-version=2}.
2220
2221 If this option is not provided but @option{-Wabi=@var{n}} is, that
2222 version is used for compatibility aliases. If this option is provided
2223 along with @option{-Wabi} (without the version), the version from this
2224 option is used for the warning.
2225
2226 @item -fno-access-control
2227 @opindex fno-access-control
2228 Turn off all access checking. This switch is mainly useful for working
2229 around bugs in the access control code.
2230
2231 @item -fcheck-new
2232 @opindex fcheck-new
2233 Check that the pointer returned by @code{operator new} is non-null
2234 before attempting to modify the storage allocated. This check is
2235 normally unnecessary because the C++ standard specifies that
2236 @code{operator new} only returns @code{0} if it is declared
2237 @code{throw()}, in which case the compiler always checks the
2238 return value even without this option. In all other cases, when
2239 @code{operator new} has a non-empty exception specification, memory
2240 exhaustion is signalled by throwing @code{std::bad_alloc}. See also
2241 @samp{new (nothrow)}.
2242
2243 @item -fconcepts
2244 @opindex fconcepts
2245 Enable support for the C++ Extensions for Concepts Technical
2246 Specification, ISO 19217 (2015), which allows code like
2247
2248 @smallexample
2249 template <class T> concept bool Addable = requires (T t) @{ t + t; @};
2250 template <Addable T> T add (T a, T b) @{ return a + b; @}
2251 @end smallexample
2252
2253 @item -fconstexpr-depth=@var{n}
2254 @opindex fconstexpr-depth
2255 Set the maximum nested evaluation depth for C++11 constexpr functions
2256 to @var{n}. A limit is needed to detect endless recursion during
2257 constant expression evaluation. The minimum specified by the standard
2258 is 512.
2259
2260 @item -fdeduce-init-list
2261 @opindex fdeduce-init-list
2262 Enable deduction of a template type parameter as
2263 @code{std::initializer_list} from a brace-enclosed initializer list, i.e.@:
2264
2265 @smallexample
2266 template <class T> auto forward(T t) -> decltype (realfn (t))
2267 @{
2268 return realfn (t);
2269 @}
2270
2271 void f()
2272 @{
2273 forward(@{1,2@}); // call forward<std::initializer_list<int>>
2274 @}
2275 @end smallexample
2276
2277 This deduction was implemented as a possible extension to the
2278 originally proposed semantics for the C++11 standard, but was not part
2279 of the final standard, so it is disabled by default. This option is
2280 deprecated, and may be removed in a future version of G++.
2281
2282 @item -ffriend-injection
2283 @opindex ffriend-injection
2284 Inject friend functions into the enclosing namespace, so that they are
2285 visible outside the scope of the class in which they are declared.
2286 Friend functions were documented to work this way in the old Annotated
2287 C++ Reference Manual.
2288 However, in ISO C++ a friend function that is not declared
2289 in an enclosing scope can only be found using argument dependent
2290 lookup. GCC defaults to the standard behavior.
2291
2292 This option is for compatibility, and may be removed in a future
2293 release of G++.
2294
2295 @item -fno-elide-constructors
2296 @opindex fno-elide-constructors
2297 The C++ standard allows an implementation to omit creating a temporary
2298 that is only used to initialize another object of the same type.
2299 Specifying this option disables that optimization, and forces G++ to
2300 call the copy constructor in all cases.
2301
2302 @item -fno-enforce-eh-specs
2303 @opindex fno-enforce-eh-specs
2304 Don't generate code to check for violation of exception specifications
2305 at run time. This option violates the C++ standard, but may be useful
2306 for reducing code size in production builds, much like defining
2307 @code{NDEBUG}. This does not give user code permission to throw
2308 exceptions in violation of the exception specifications; the compiler
2309 still optimizes based on the specifications, so throwing an
2310 unexpected exception results in undefined behavior at run time.
2311
2312 @item -fextern-tls-init
2313 @itemx -fno-extern-tls-init
2314 @opindex fextern-tls-init
2315 @opindex fno-extern-tls-init
2316 The C++11 and OpenMP standards allow @code{thread_local} and
2317 @code{threadprivate} variables to have dynamic (runtime)
2318 initialization. To support this, any use of such a variable goes
2319 through a wrapper function that performs any necessary initialization.
2320 When the use and definition of the variable are in the same
2321 translation unit, this overhead can be optimized away, but when the
2322 use is in a different translation unit there is significant overhead
2323 even if the variable doesn't actually need dynamic initialization. If
2324 the programmer can be sure that no use of the variable in a
2325 non-defining TU needs to trigger dynamic initialization (either
2326 because the variable is statically initialized, or a use of the
2327 variable in the defining TU will be executed before any uses in
2328 another TU), they can avoid this overhead with the
2329 @option{-fno-extern-tls-init} option.
2330
2331 On targets that support symbol aliases, the default is
2332 @option{-fextern-tls-init}. On targets that do not support symbol
2333 aliases, the default is @option{-fno-extern-tls-init}.
2334
2335 @item -ffor-scope
2336 @itemx -fno-for-scope
2337 @opindex ffor-scope
2338 @opindex fno-for-scope
2339 If @option{-ffor-scope} is specified, the scope of variables declared in
2340 a @i{for-init-statement} is limited to the @code{for} loop itself,
2341 as specified by the C++ standard.
2342 If @option{-fno-for-scope} is specified, the scope of variables declared in
2343 a @i{for-init-statement} extends to the end of the enclosing scope,
2344 as was the case in old versions of G++, and other (traditional)
2345 implementations of C++.
2346
2347 If neither flag is given, the default is to follow the standard,
2348 but to allow and give a warning for old-style code that would
2349 otherwise be invalid, or have different behavior.
2350
2351 @item -fno-gnu-keywords
2352 @opindex fno-gnu-keywords
2353 Do not recognize @code{typeof} as a keyword, so that code can use this
2354 word as an identifier. You can use the keyword @code{__typeof__} instead.
2355 This option is implied by the strict ISO C++ dialects: @option{-ansi},
2356 @option{-std=c++98}, @option{-std=c++11}, etc.
2357
2358 @item -fno-implicit-templates
2359 @opindex fno-implicit-templates
2360 Never emit code for non-inline templates that are instantiated
2361 implicitly (i.e.@: by use); only emit code for explicit instantiations.
2362 @xref{Template Instantiation}, for more information.
2363
2364 @item -fno-implicit-inline-templates
2365 @opindex fno-implicit-inline-templates
2366 Don't emit code for implicit instantiations of inline templates, either.
2367 The default is to handle inlines differently so that compiles with and
2368 without optimization need the same set of explicit instantiations.
2369
2370 @item -fno-implement-inlines
2371 @opindex fno-implement-inlines
2372 To save space, do not emit out-of-line copies of inline functions
2373 controlled by @code{#pragma implementation}. This causes linker
2374 errors if these functions are not inlined everywhere they are called.
2375
2376 @item -fms-extensions
2377 @opindex fms-extensions
2378 Disable Wpedantic warnings about constructs used in MFC, such as implicit
2379 int and getting a pointer to member function via non-standard syntax.
2380
2381 @item -fno-nonansi-builtins
2382 @opindex fno-nonansi-builtins
2383 Disable built-in declarations of functions that are not mandated by
2384 ANSI/ISO C@. These include @code{ffs}, @code{alloca}, @code{_exit},
2385 @code{index}, @code{bzero}, @code{conjf}, and other related functions.
2386
2387 @item -fnothrow-opt
2388 @opindex fnothrow-opt
2389 Treat a @code{throw()} exception specification as if it were a
2390 @code{noexcept} specification to reduce or eliminate the text size
2391 overhead relative to a function with no exception specification. If
2392 the function has local variables of types with non-trivial
2393 destructors, the exception specification actually makes the
2394 function smaller because the EH cleanups for those variables can be
2395 optimized away. The semantic effect is that an exception thrown out of
2396 a function with such an exception specification results in a call
2397 to @code{terminate} rather than @code{unexpected}.
2398
2399 @item -fno-operator-names
2400 @opindex fno-operator-names
2401 Do not treat the operator name keywords @code{and}, @code{bitand},
2402 @code{bitor}, @code{compl}, @code{not}, @code{or} and @code{xor} as
2403 synonyms as keywords.
2404
2405 @item -fno-optional-diags
2406 @opindex fno-optional-diags
2407 Disable diagnostics that the standard says a compiler does not need to
2408 issue. Currently, the only such diagnostic issued by G++ is the one for
2409 a name having multiple meanings within a class.
2410
2411 @item -fpermissive
2412 @opindex fpermissive
2413 Downgrade some diagnostics about nonconformant code from errors to
2414 warnings. Thus, using @option{-fpermissive} allows some
2415 nonconforming code to compile.
2416
2417 @item -fno-pretty-templates
2418 @opindex fno-pretty-templates
2419 When an error message refers to a specialization of a function
2420 template, the compiler normally prints the signature of the
2421 template followed by the template arguments and any typedefs or
2422 typenames in the signature (e.g. @code{void f(T) [with T = int]}
2423 rather than @code{void f(int)}) so that it's clear which template is
2424 involved. When an error message refers to a specialization of a class
2425 template, the compiler omits any template arguments that match
2426 the default template arguments for that template. If either of these
2427 behaviors make it harder to understand the error message rather than
2428 easier, you can use @option{-fno-pretty-templates} to disable them.
2429
2430 @item -frepo
2431 @opindex frepo
2432 Enable automatic template instantiation at link time. This option also
2433 implies @option{-fno-implicit-templates}. @xref{Template
2434 Instantiation}, for more information.
2435
2436 @item -fno-rtti
2437 @opindex fno-rtti
2438 Disable generation of information about every class with virtual
2439 functions for use by the C++ run-time type identification features
2440 (@code{dynamic_cast} and @code{typeid}). If you don't use those parts
2441 of the language, you can save some space by using this flag. Note that
2442 exception handling uses the same information, but G++ generates it as
2443 needed. The @code{dynamic_cast} operator can still be used for casts that
2444 do not require run-time type information, i.e.@: casts to @code{void *} or to
2445 unambiguous base classes.
2446
2447 @item -fsized-deallocation
2448 @opindex fsized-deallocation
2449 Enable the built-in global declarations
2450 @smallexample
2451 void operator delete (void *, std::size_t) noexcept;
2452 void operator delete[] (void *, std::size_t) noexcept;
2453 @end smallexample
2454 as introduced in C++14. This is useful for user-defined replacement
2455 deallocation functions that, for example, use the size of the object
2456 to make deallocation faster. Enabled by default under
2457 @option{-std=c++14} and above. The flag @option{-Wsized-deallocation}
2458 warns about places that might want to add a definition.
2459
2460 @item -fstrict-enums
2461 @opindex fstrict-enums
2462 Allow the compiler to optimize using the assumption that a value of
2463 enumerated type can only be one of the values of the enumeration (as
2464 defined in the C++ standard; basically, a value that can be
2465 represented in the minimum number of bits needed to represent all the
2466 enumerators). This assumption may not be valid if the program uses a
2467 cast to convert an arbitrary integer value to the enumerated type.
2468
2469 @item -ftemplate-backtrace-limit=@var{n}
2470 @opindex ftemplate-backtrace-limit
2471 Set the maximum number of template instantiation notes for a single
2472 warning or error to @var{n}. The default value is 10.
2473
2474 @item -ftemplate-depth=@var{n}
2475 @opindex ftemplate-depth
2476 Set the maximum instantiation depth for template classes to @var{n}.
2477 A limit on the template instantiation depth is needed to detect
2478 endless recursions during template class instantiation. ANSI/ISO C++
2479 conforming programs must not rely on a maximum depth greater than 17
2480 (changed to 1024 in C++11). The default value is 900, as the compiler
2481 can run out of stack space before hitting 1024 in some situations.
2482
2483 @item -fno-threadsafe-statics
2484 @opindex fno-threadsafe-statics
2485 Do not emit the extra code to use the routines specified in the C++
2486 ABI for thread-safe initialization of local statics. You can use this
2487 option to reduce code size slightly in code that doesn't need to be
2488 thread-safe.
2489
2490 @item -fuse-cxa-atexit
2491 @opindex fuse-cxa-atexit
2492 Register destructors for objects with static storage duration with the
2493 @code{__cxa_atexit} function rather than the @code{atexit} function.
2494 This option is required for fully standards-compliant handling of static
2495 destructors, but only works if your C library supports
2496 @code{__cxa_atexit}.
2497
2498 @item -fno-use-cxa-get-exception-ptr
2499 @opindex fno-use-cxa-get-exception-ptr
2500 Don't use the @code{__cxa_get_exception_ptr} runtime routine. This
2501 causes @code{std::uncaught_exception} to be incorrect, but is necessary
2502 if the runtime routine is not available.
2503
2504 @item -fvisibility-inlines-hidden
2505 @opindex fvisibility-inlines-hidden
2506 This switch declares that the user does not attempt to compare
2507 pointers to inline functions or methods where the addresses of the two functions
2508 are taken in different shared objects.
2509
2510 The effect of this is that GCC may, effectively, mark inline methods with
2511 @code{__attribute__ ((visibility ("hidden")))} so that they do not
2512 appear in the export table of a DSO and do not require a PLT indirection
2513 when used within the DSO@. Enabling this option can have a dramatic effect
2514 on load and link times of a DSO as it massively reduces the size of the
2515 dynamic export table when the library makes heavy use of templates.
2516
2517 The behavior of this switch is not quite the same as marking the
2518 methods as hidden directly, because it does not affect static variables
2519 local to the function or cause the compiler to deduce that
2520 the function is defined in only one shared object.
2521
2522 You may mark a method as having a visibility explicitly to negate the
2523 effect of the switch for that method. For example, if you do want to
2524 compare pointers to a particular inline method, you might mark it as
2525 having default visibility. Marking the enclosing class with explicit
2526 visibility has no effect.
2527
2528 Explicitly instantiated inline methods are unaffected by this option
2529 as their linkage might otherwise cross a shared library boundary.
2530 @xref{Template Instantiation}.
2531
2532 @item -fvisibility-ms-compat
2533 @opindex fvisibility-ms-compat
2534 This flag attempts to use visibility settings to make GCC's C++
2535 linkage model compatible with that of Microsoft Visual Studio.
2536
2537 The flag makes these changes to GCC's linkage model:
2538
2539 @enumerate
2540 @item
2541 It sets the default visibility to @code{hidden}, like
2542 @option{-fvisibility=hidden}.
2543
2544 @item
2545 Types, but not their members, are not hidden by default.
2546
2547 @item
2548 The One Definition Rule is relaxed for types without explicit
2549 visibility specifications that are defined in more than one
2550 shared object: those declarations are permitted if they are
2551 permitted when this option is not used.
2552 @end enumerate
2553
2554 In new code it is better to use @option{-fvisibility=hidden} and
2555 export those classes that are intended to be externally visible.
2556 Unfortunately it is possible for code to rely, perhaps accidentally,
2557 on the Visual Studio behavior.
2558
2559 Among the consequences of these changes are that static data members
2560 of the same type with the same name but defined in different shared
2561 objects are different, so changing one does not change the other;
2562 and that pointers to function members defined in different shared
2563 objects may not compare equal. When this flag is given, it is a
2564 violation of the ODR to define types with the same name differently.
2565
2566 @item -fno-weak
2567 @opindex fno-weak
2568 Do not use weak symbol support, even if it is provided by the linker.
2569 By default, G++ uses weak symbols if they are available. This
2570 option exists only for testing, and should not be used by end-users;
2571 it results in inferior code and has no benefits. This option may
2572 be removed in a future release of G++.
2573
2574 @item -nostdinc++
2575 @opindex nostdinc++
2576 Do not search for header files in the standard directories specific to
2577 C++, but do still search the other standard directories. (This option
2578 is used when building the C++ library.)
2579 @end table
2580
2581 In addition, these optimization, warning, and code generation options
2582 have meanings only for C++ programs:
2583
2584 @table @gcctabopt
2585 @item -Wabi @r{(C, Objective-C, C++ and Objective-C++ only)}
2586 @opindex Wabi
2587 @opindex Wno-abi
2588 Warn when G++ it generates code that is probably not compatible with
2589 the vendor-neutral C++ ABI@. Since G++ now defaults to updating the
2590 ABI with each major release, normally @option{-Wabi} will warn only if
2591 there is a check added later in a release series for an ABI issue
2592 discovered since the initial release. @option{-Wabi} will warn about
2593 more things if an older ABI version is selected (with
2594 @option{-fabi-version=@var{n}}).
2595
2596 @option{-Wabi} can also be used with an explicit version number to
2597 warn about compatibility with a particular @option{-fabi-version}
2598 level, e.g. @option{-Wabi=2} to warn about changes relative to
2599 @option{-fabi-version=2}.
2600
2601 If an explicit version number is provided and
2602 @option{-fabi-compat-version} is not specified, the version number
2603 from this option is used for compatibility aliases. If no explicit
2604 version number is provided with this option, but
2605 @option{-fabi-compat-version} is specified, that version number is
2606 used for ABI warnings.
2607
2608 Although an effort has been made to warn about
2609 all such cases, there are probably some cases that are not warned about,
2610 even though G++ is generating incompatible code. There may also be
2611 cases where warnings are emitted even though the code that is generated
2612 is compatible.
2613
2614 You should rewrite your code to avoid these warnings if you are
2615 concerned about the fact that code generated by G++ may not be binary
2616 compatible with code generated by other compilers.
2617
2618 Known incompatibilities in @option{-fabi-version=2} (which was the
2619 default from GCC 3.4 to 4.9) include:
2620
2621 @itemize @bullet
2622
2623 @item
2624 A template with a non-type template parameter of reference type was
2625 mangled incorrectly:
2626 @smallexample
2627 extern int N;
2628 template <int &> struct S @{@};
2629 void n (S<N>) @{2@}
2630 @end smallexample
2631
2632 This was fixed in @option{-fabi-version=3}.
2633
2634 @item
2635 SIMD vector types declared using @code{__attribute ((vector_size))} were
2636 mangled in a non-standard way that does not allow for overloading of
2637 functions taking vectors of different sizes.
2638
2639 The mangling was changed in @option{-fabi-version=4}.
2640
2641 @item
2642 @code{__attribute ((const))} and @code{noreturn} were mangled as type
2643 qualifiers, and @code{decltype} of a plain declaration was folded away.
2644
2645 These mangling issues were fixed in @option{-fabi-version=5}.
2646
2647 @item
2648 Scoped enumerators passed as arguments to a variadic function are
2649 promoted like unscoped enumerators, causing @code{va_arg} to complain.
2650 On most targets this does not actually affect the parameter passing
2651 ABI, as there is no way to pass an argument smaller than @code{int}.
2652
2653 Also, the ABI changed the mangling of template argument packs,
2654 @code{const_cast}, @code{static_cast}, prefix increment/decrement, and
2655 a class scope function used as a template argument.
2656
2657 These issues were corrected in @option{-fabi-version=6}.
2658
2659 @item
2660 Lambdas in default argument scope were mangled incorrectly, and the
2661 ABI changed the mangling of @code{nullptr_t}.
2662
2663 These issues were corrected in @option{-fabi-version=7}.
2664
2665 @item
2666 When mangling a function type with function-cv-qualifiers, the
2667 un-qualified function type was incorrectly treated as a substitution
2668 candidate.
2669
2670 This was fixed in @option{-fabi-version=8}, the default for GCC 5.1.
2671
2672 @item
2673 @code{decltype(nullptr)} incorrectly had an alignment of 1, leading to
2674 unaligned accesses. Note that this did not affect the ABI of a
2675 function with a @code{nullptr_t} parameter, as parameters have a
2676 minimum alignment.
2677
2678 This was fixed in @option{-fabi-version=9}, the default for GCC 5.2.
2679
2680 @item
2681 Target-specific attributes that affect the identity of a type, such as
2682 ia32 calling conventions on a function type (stdcall, regparm, etc.),
2683 did not affect the mangled name, leading to name collisions when
2684 function pointers were used as template arguments.
2685
2686 This was fixed in @option{-fabi-version=10}, the default for GCC 6.1.
2687
2688 @end itemize
2689
2690 It also warns about psABI-related changes. The known psABI changes at this
2691 point include:
2692
2693 @itemize @bullet
2694
2695 @item
2696 For SysV/x86-64, unions with @code{long double} members are
2697 passed in memory as specified in psABI. For example:
2698
2699 @smallexample
2700 union U @{
2701 long double ld;
2702 int i;
2703 @};
2704 @end smallexample
2705
2706 @noindent
2707 @code{union U} is always passed in memory.
2708
2709 @end itemize
2710
2711 @item -Wabi-tag @r{(C++ and Objective-C++ only)}
2712 @opindex Wabi-tag
2713 @opindex -Wabi-tag
2714 Warn when a type with an ABI tag is used in a context that does not
2715 have that ABI tag. See @ref{C++ Attributes} for more information
2716 about ABI tags.
2717
2718 @item -Wctor-dtor-privacy @r{(C++ and Objective-C++ only)}
2719 @opindex Wctor-dtor-privacy
2720 @opindex Wno-ctor-dtor-privacy
2721 Warn when a class seems unusable because all the constructors or
2722 destructors in that class are private, and it has neither friends nor
2723 public static member functions. Also warn if there are no non-private
2724 methods, and there's at least one private member function that isn't
2725 a constructor or destructor.
2726
2727 @item -Wdelete-non-virtual-dtor @r{(C++ and Objective-C++ only)}
2728 @opindex Wdelete-non-virtual-dtor
2729 @opindex Wno-delete-non-virtual-dtor
2730 Warn when @code{delete} is used to destroy an instance of a class that
2731 has virtual functions and non-virtual destructor. It is unsafe to delete
2732 an instance of a derived class through a pointer to a base class if the
2733 base class does not have a virtual destructor. This warning is enabled
2734 by @option{-Wall}.
2735
2736 @item -Wliteral-suffix @r{(C++ and Objective-C++ only)}
2737 @opindex Wliteral-suffix
2738 @opindex Wno-literal-suffix
2739 Warn when a string or character literal is followed by a ud-suffix which does
2740 not begin with an underscore. As a conforming extension, GCC treats such
2741 suffixes as separate preprocessing tokens in order to maintain backwards
2742 compatibility with code that uses formatting macros from @code{<inttypes.h>}.
2743 For example:
2744
2745 @smallexample
2746 #define __STDC_FORMAT_MACROS
2747 #include <inttypes.h>
2748 #include <stdio.h>
2749
2750 int main() @{
2751 int64_t i64 = 123;
2752 printf("My int64: %" PRId64"\n", i64);
2753 @}
2754 @end smallexample
2755
2756 In this case, @code{PRId64} is treated as a separate preprocessing token.
2757
2758 This warning is enabled by default.
2759
2760 @item -Wlto-type-mismatch
2761 @opindex Wlto-type-mismatch
2762 @opindex Wno-lto-type-mismatch
2763
2764 During the link-time optimization warn about type mismatches in
2765 global declarations from different compilation units.
2766 Requires @option{-flto} to be enabled. Enabled by default.
2767
2768 @item -Wnarrowing @r{(C++ and Objective-C++ only)}
2769 @opindex Wnarrowing
2770 @opindex Wno-narrowing
2771 With @option{-std=gnu++98} or @option{-std=c++98}, warn when a narrowing
2772 conversion prohibited by C++11 occurs within
2773 @samp{@{ @}}, e.g.
2774
2775 @smallexample
2776 int i = @{ 2.2 @}; // error: narrowing from double to int
2777 @end smallexample
2778
2779 This flag is included in @option{-Wall} and @option{-Wc++11-compat}.
2780
2781 When a later standard is in effect, e.g. when using @option{-std=c++11},
2782 narrowing conversions are diagnosed by default, as required by the standard.
2783 A narrowing conversion from a constant produces an error,
2784 and a narrowing conversion from a non-constant produces a warning,
2785 but @option{-Wno-narrowing} suppresses the diagnostic.
2786 Note that this does not affect the meaning of well-formed code;
2787 narrowing conversions are still considered ill-formed in SFINAE contexts.
2788
2789 @item -Wnoexcept @r{(C++ and Objective-C++ only)}
2790 @opindex Wnoexcept
2791 @opindex Wno-noexcept
2792 Warn when a noexcept-expression evaluates to false because of a call
2793 to a function that does not have a non-throwing exception
2794 specification (i.e. @code{throw()} or @code{noexcept}) but is known by
2795 the compiler to never throw an exception.
2796
2797 @item -Wnon-virtual-dtor @r{(C++ and Objective-C++ only)}
2798 @opindex Wnon-virtual-dtor
2799 @opindex Wno-non-virtual-dtor
2800 Warn when a class has virtual functions and an accessible non-virtual
2801 destructor itself or in an accessible polymorphic base class, in which
2802 case it is possible but unsafe to delete an instance of a derived
2803 class through a pointer to the class itself or base class. This
2804 warning is automatically enabled if @option{-Weffc++} is specified.
2805
2806 @item -Wreorder @r{(C++ and Objective-C++ only)}
2807 @opindex Wreorder
2808 @opindex Wno-reorder
2809 @cindex reordering, warning
2810 @cindex warning for reordering of member initializers
2811 Warn when the order of member initializers given in the code does not
2812 match the order in which they must be executed. For instance:
2813
2814 @smallexample
2815 struct A @{
2816 int i;
2817 int j;
2818 A(): j (0), i (1) @{ @}
2819 @};
2820 @end smallexample
2821
2822 @noindent
2823 The compiler rearranges the member initializers for @code{i}
2824 and @code{j} to match the declaration order of the members, emitting
2825 a warning to that effect. This warning is enabled by @option{-Wall}.
2826
2827 @item -fext-numeric-literals @r{(C++ and Objective-C++ only)}
2828 @opindex fext-numeric-literals
2829 @opindex fno-ext-numeric-literals
2830 Accept imaginary, fixed-point, or machine-defined
2831 literal number suffixes as GNU extensions.
2832 When this option is turned off these suffixes are treated
2833 as C++11 user-defined literal numeric suffixes.
2834 This is on by default for all pre-C++11 dialects and all GNU dialects:
2835 @option{-std=c++98}, @option{-std=gnu++98}, @option{-std=gnu++11},
2836 @option{-std=gnu++14}.
2837 This option is off by default
2838 for ISO C++11 onwards (@option{-std=c++11}, ...).
2839 @end table
2840
2841 The following @option{-W@dots{}} options are not affected by @option{-Wall}.
2842
2843 @table @gcctabopt
2844 @item -Weffc++ @r{(C++ and Objective-C++ only)}
2845 @opindex Weffc++
2846 @opindex Wno-effc++
2847 Warn about violations of the following style guidelines from Scott Meyers'
2848 @cite{Effective C++} series of books:
2849
2850 @itemize @bullet
2851 @item
2852 Define a copy constructor and an assignment operator for classes
2853 with dynamically-allocated memory.
2854
2855 @item
2856 Prefer initialization to assignment in constructors.
2857
2858 @item
2859 Have @code{operator=} return a reference to @code{*this}.
2860
2861 @item
2862 Don't try to return a reference when you must return an object.
2863
2864 @item
2865 Distinguish between prefix and postfix forms of increment and
2866 decrement operators.
2867
2868 @item
2869 Never overload @code{&&}, @code{||}, or @code{,}.
2870
2871 @end itemize
2872
2873 This option also enables @option{-Wnon-virtual-dtor}, which is also
2874 one of the effective C++ recommendations. However, the check is
2875 extended to warn about the lack of virtual destructor in accessible
2876 non-polymorphic bases classes too.
2877
2878 When selecting this option, be aware that the standard library
2879 headers do not obey all of these guidelines; use @samp{grep -v}
2880 to filter out those warnings.
2881
2882 @item -Wstrict-null-sentinel @r{(C++ and Objective-C++ only)}
2883 @opindex Wstrict-null-sentinel
2884 @opindex Wno-strict-null-sentinel
2885 Warn about the use of an uncasted @code{NULL} as sentinel. When
2886 compiling only with GCC this is a valid sentinel, as @code{NULL} is defined
2887 to @code{__null}. Although it is a null pointer constant rather than a
2888 null pointer, it is guaranteed to be of the same size as a pointer.
2889 But this use is not portable across different compilers.
2890
2891 @item -Wno-non-template-friend @r{(C++ and Objective-C++ only)}
2892 @opindex Wno-non-template-friend
2893 @opindex Wnon-template-friend
2894 Disable warnings when non-templatized friend functions are declared
2895 within a template. Since the advent of explicit template specification
2896 support in G++, if the name of the friend is an unqualified-id (i.e.,
2897 @samp{friend foo(int)}), the C++ language specification demands that the
2898 friend declare or define an ordinary, nontemplate function. (Section
2899 14.5.3). Before G++ implemented explicit specification, unqualified-ids
2900 could be interpreted as a particular specialization of a templatized
2901 function. Because this non-conforming behavior is no longer the default
2902 behavior for G++, @option{-Wnon-template-friend} allows the compiler to
2903 check existing code for potential trouble spots and is on by default.
2904 This new compiler behavior can be turned off with
2905 @option{-Wno-non-template-friend}, which keeps the conformant compiler code
2906 but disables the helpful warning.
2907
2908 @item -Wold-style-cast @r{(C++ and Objective-C++ only)}
2909 @opindex Wold-style-cast
2910 @opindex Wno-old-style-cast
2911 Warn if an old-style (C-style) cast to a non-void type is used within
2912 a C++ program. The new-style casts (@code{dynamic_cast},
2913 @code{static_cast}, @code{reinterpret_cast}, and @code{const_cast}) are
2914 less vulnerable to unintended effects and much easier to search for.
2915
2916 @item -Woverloaded-virtual @r{(C++ and Objective-C++ only)}
2917 @opindex Woverloaded-virtual
2918 @opindex Wno-overloaded-virtual
2919 @cindex overloaded virtual function, warning
2920 @cindex warning for overloaded virtual function
2921 Warn when a function declaration hides virtual functions from a
2922 base class. For example, in:
2923
2924 @smallexample
2925 struct A @{
2926 virtual void f();
2927 @};
2928
2929 struct B: public A @{
2930 void f(int);
2931 @};
2932 @end smallexample
2933
2934 the @code{A} class version of @code{f} is hidden in @code{B}, and code
2935 like:
2936
2937 @smallexample
2938 B* b;
2939 b->f();
2940 @end smallexample
2941
2942 @noindent
2943 fails to compile.
2944
2945 @item -Wno-pmf-conversions @r{(C++ and Objective-C++ only)}
2946 @opindex Wno-pmf-conversions
2947 @opindex Wpmf-conversions
2948 Disable the diagnostic for converting a bound pointer to member function
2949 to a plain pointer.
2950
2951 @item -Wsign-promo @r{(C++ and Objective-C++ only)}
2952 @opindex Wsign-promo
2953 @opindex Wno-sign-promo
2954 Warn when overload resolution chooses a promotion from unsigned or
2955 enumerated type to a signed type, over a conversion to an unsigned type of
2956 the same size. Previous versions of G++ tried to preserve
2957 unsignedness, but the standard mandates the current behavior.
2958
2959 @item -Wtemplates @r{(C++ and Objective-C++ only)}
2960 @opindex Wtemplates
2961 Warn when a primary template declaration is encountered. Some coding
2962 rules disallow templates, and this may be used to enforce that rule.
2963 The warning is inactive inside a system header file, such as the STL, so
2964 one can still use the STL. One may also instantiate or specialize
2965 templates.
2966
2967 @item -Wmultiple-inheritance @r{(C++ and Objective-C++ only)}
2968 @opindex Wmultiple-inheritance
2969 Warn when a class is defined with multiple direct base classes. Some
2970 coding rules disallow multiple inheritance, and this may be used to
2971 enforce that rule. The warning is inactive inside a system header file,
2972 such as the STL, so one can still use the STL. One may also define
2973 classes that indirectly use multiple inheritance.
2974
2975 @item -Wvirtual-inheritance
2976 @opindex Wvirtual-inheritance
2977 Warn when a class is defined with a virtual direct base classe. Some
2978 coding rules disallow multiple inheritance, and this may be used to
2979 enforce that rule. The warning is inactive inside a system header file,
2980 such as the STL, so one can still use the STL. One may also define
2981 classes that indirectly use virtual inheritance.
2982
2983 @item -Wnamespaces
2984 @opindex Wnamespaces
2985 Warn when a namespace definition is opened. Some coding rules disallow
2986 namespaces, and this may be used to enforce that rule. The warning is
2987 inactive inside a system header file, such as the STL, so one can still
2988 use the STL. One may also use using directives and qualified names.
2989
2990 @item -Wno-terminate @r{(C++ and Objective-C++ only)}
2991 @opindex Wterminate
2992 @opindex Wno-terminate
2993 Disable the warning about a throw-expression that will immediately
2994 result in a call to @code{terminate}.
2995 @end table
2996
2997 @node Objective-C and Objective-C++ Dialect Options
2998 @section Options Controlling Objective-C and Objective-C++ Dialects
2999
3000 @cindex compiler options, Objective-C and Objective-C++
3001 @cindex Objective-C and Objective-C++ options, command-line
3002 @cindex options, Objective-C and Objective-C++
3003 (NOTE: This manual does not describe the Objective-C and Objective-C++
3004 languages themselves. @xref{Standards,,Language Standards
3005 Supported by GCC}, for references.)
3006
3007 This section describes the command-line options that are only meaningful
3008 for Objective-C and Objective-C++ programs. You can also use most of
3009 the language-independent GNU compiler options.
3010 For example, you might compile a file @file{some_class.m} like this:
3011
3012 @smallexample
3013 gcc -g -fgnu-runtime -O -c some_class.m
3014 @end smallexample
3015
3016 @noindent
3017 In this example, @option{-fgnu-runtime} is an option meant only for
3018 Objective-C and Objective-C++ programs; you can use the other options with
3019 any language supported by GCC@.
3020
3021 Note that since Objective-C is an extension of the C language, Objective-C
3022 compilations may also use options specific to the C front-end (e.g.,
3023 @option{-Wtraditional}). Similarly, Objective-C++ compilations may use
3024 C++-specific options (e.g., @option{-Wabi}).
3025
3026 Here is a list of options that are @emph{only} for compiling Objective-C
3027 and Objective-C++ programs:
3028
3029 @table @gcctabopt
3030 @item -fconstant-string-class=@var{class-name}
3031 @opindex fconstant-string-class
3032 Use @var{class-name} as the name of the class to instantiate for each
3033 literal string specified with the syntax @code{@@"@dots{}"}. The default
3034 class name is @code{NXConstantString} if the GNU runtime is being used, and
3035 @code{NSConstantString} if the NeXT runtime is being used (see below). The
3036 @option{-fconstant-cfstrings} option, if also present, overrides the
3037 @option{-fconstant-string-class} setting and cause @code{@@"@dots{}"} literals
3038 to be laid out as constant CoreFoundation strings.
3039
3040 @item -fgnu-runtime
3041 @opindex fgnu-runtime
3042 Generate object code compatible with the standard GNU Objective-C
3043 runtime. This is the default for most types of systems.
3044
3045 @item -fnext-runtime
3046 @opindex fnext-runtime
3047 Generate output compatible with the NeXT runtime. This is the default
3048 for NeXT-based systems, including Darwin and Mac OS X@. The macro
3049 @code{__NEXT_RUNTIME__} is predefined if (and only if) this option is
3050 used.
3051
3052 @item -fno-nil-receivers
3053 @opindex fno-nil-receivers
3054 Assume that all Objective-C message dispatches (@code{[receiver
3055 message:arg]}) in this translation unit ensure that the receiver is
3056 not @code{nil}. This allows for more efficient entry points in the
3057 runtime to be used. This option is only available in conjunction with
3058 the NeXT runtime and ABI version 0 or 1.
3059
3060 @item -fobjc-abi-version=@var{n}
3061 @opindex fobjc-abi-version
3062 Use version @var{n} of the Objective-C ABI for the selected runtime.
3063 This option is currently supported only for the NeXT runtime. In that
3064 case, Version 0 is the traditional (32-bit) ABI without support for
3065 properties and other Objective-C 2.0 additions. Version 1 is the
3066 traditional (32-bit) ABI with support for properties and other
3067 Objective-C 2.0 additions. Version 2 is the modern (64-bit) ABI. If
3068 nothing is specified, the default is Version 0 on 32-bit target
3069 machines, and Version 2 on 64-bit target machines.
3070
3071 @item -fobjc-call-cxx-cdtors
3072 @opindex fobjc-call-cxx-cdtors
3073 For each Objective-C class, check if any of its instance variables is a
3074 C++ object with a non-trivial default constructor. If so, synthesize a
3075 special @code{- (id) .cxx_construct} instance method which runs
3076 non-trivial default constructors on any such instance variables, in order,
3077 and then return @code{self}. Similarly, check if any instance variable
3078 is a C++ object with a non-trivial destructor, and if so, synthesize a
3079 special @code{- (void) .cxx_destruct} method which runs
3080 all such default destructors, in reverse order.
3081
3082 The @code{- (id) .cxx_construct} and @code{- (void) .cxx_destruct}
3083 methods thusly generated only operate on instance variables
3084 declared in the current Objective-C class, and not those inherited
3085 from superclasses. It is the responsibility of the Objective-C
3086 runtime to invoke all such methods in an object's inheritance
3087 hierarchy. The @code{- (id) .cxx_construct} methods are invoked
3088 by the runtime immediately after a new object instance is allocated;
3089 the @code{- (void) .cxx_destruct} methods are invoked immediately
3090 before the runtime deallocates an object instance.
3091
3092 As of this writing, only the NeXT runtime on Mac OS X 10.4 and later has
3093 support for invoking the @code{- (id) .cxx_construct} and
3094 @code{- (void) .cxx_destruct} methods.
3095
3096 @item -fobjc-direct-dispatch
3097 @opindex fobjc-direct-dispatch
3098 Allow fast jumps to the message dispatcher. On Darwin this is
3099 accomplished via the comm page.
3100
3101 @item -fobjc-exceptions
3102 @opindex fobjc-exceptions
3103 Enable syntactic support for structured exception handling in
3104 Objective-C, similar to what is offered by C++ and Java. This option
3105 is required to use the Objective-C keywords @code{@@try},
3106 @code{@@throw}, @code{@@catch}, @code{@@finally} and
3107 @code{@@synchronized}. This option is available with both the GNU
3108 runtime and the NeXT runtime (but not available in conjunction with
3109 the NeXT runtime on Mac OS X 10.2 and earlier).
3110
3111 @item -fobjc-gc
3112 @opindex fobjc-gc
3113 Enable garbage collection (GC) in Objective-C and Objective-C++
3114 programs. This option is only available with the NeXT runtime; the
3115 GNU runtime has a different garbage collection implementation that
3116 does not require special compiler flags.
3117
3118 @item -fobjc-nilcheck
3119 @opindex fobjc-nilcheck
3120 For the NeXT runtime with version 2 of the ABI, check for a nil
3121 receiver in method invocations before doing the actual method call.
3122 This is the default and can be disabled using
3123 @option{-fno-objc-nilcheck}. Class methods and super calls are never
3124 checked for nil in this way no matter what this flag is set to.
3125 Currently this flag does nothing when the GNU runtime, or an older
3126 version of the NeXT runtime ABI, is used.
3127
3128 @item -fobjc-std=objc1
3129 @opindex fobjc-std
3130 Conform to the language syntax of Objective-C 1.0, the language
3131 recognized by GCC 4.0. This only affects the Objective-C additions to
3132 the C/C++ language; it does not affect conformance to C/C++ standards,
3133 which is controlled by the separate C/C++ dialect option flags. When
3134 this option is used with the Objective-C or Objective-C++ compiler,
3135 any Objective-C syntax that is not recognized by GCC 4.0 is rejected.
3136 This is useful if you need to make sure that your Objective-C code can
3137 be compiled with older versions of GCC@.
3138
3139 @item -freplace-objc-classes
3140 @opindex freplace-objc-classes
3141 Emit a special marker instructing @command{ld(1)} not to statically link in
3142 the resulting object file, and allow @command{dyld(1)} to load it in at
3143 run time instead. This is used in conjunction with the Fix-and-Continue
3144 debugging mode, where the object file in question may be recompiled and
3145 dynamically reloaded in the course of program execution, without the need
3146 to restart the program itself. Currently, Fix-and-Continue functionality
3147 is only available in conjunction with the NeXT runtime on Mac OS X 10.3
3148 and later.
3149
3150 @item -fzero-link
3151 @opindex fzero-link
3152 When compiling for the NeXT runtime, the compiler ordinarily replaces calls
3153 to @code{objc_getClass("@dots{}")} (when the name of the class is known at
3154 compile time) with static class references that get initialized at load time,
3155 which improves run-time performance. Specifying the @option{-fzero-link} flag
3156 suppresses this behavior and causes calls to @code{objc_getClass("@dots{}")}
3157 to be retained. This is useful in Zero-Link debugging mode, since it allows
3158 for individual class implementations to be modified during program execution.
3159 The GNU runtime currently always retains calls to @code{objc_get_class("@dots{}")}
3160 regardless of command-line options.
3161
3162 @item -fno-local-ivars
3163 @opindex fno-local-ivars
3164 @opindex flocal-ivars
3165 By default instance variables in Objective-C can be accessed as if
3166 they were local variables from within the methods of the class they're
3167 declared in. This can lead to shadowing between instance variables
3168 and other variables declared either locally inside a class method or
3169 globally with the same name. Specifying the @option{-fno-local-ivars}
3170 flag disables this behavior thus avoiding variable shadowing issues.
3171
3172 @item -fivar-visibility=@r{[}public@r{|}protected@r{|}private@r{|}package@r{]}
3173 @opindex fivar-visibility
3174 Set the default instance variable visibility to the specified option
3175 so that instance variables declared outside the scope of any access
3176 modifier directives default to the specified visibility.
3177
3178 @item -gen-decls
3179 @opindex gen-decls
3180 Dump interface declarations for all classes seen in the source file to a
3181 file named @file{@var{sourcename}.decl}.
3182
3183 @item -Wassign-intercept @r{(Objective-C and Objective-C++ only)}
3184 @opindex Wassign-intercept
3185 @opindex Wno-assign-intercept
3186 Warn whenever an Objective-C assignment is being intercepted by the
3187 garbage collector.
3188
3189 @item -Wno-protocol @r{(Objective-C and Objective-C++ only)}
3190 @opindex Wno-protocol
3191 @opindex Wprotocol
3192 If a class is declared to implement a protocol, a warning is issued for
3193 every method in the protocol that is not implemented by the class. The
3194 default behavior is to issue a warning for every method not explicitly
3195 implemented in the class, even if a method implementation is inherited
3196 from the superclass. If you use the @option{-Wno-protocol} option, then
3197 methods inherited from the superclass are considered to be implemented,
3198 and no warning is issued for them.
3199
3200 @item -Wselector @r{(Objective-C and Objective-C++ only)}
3201 @opindex Wselector
3202 @opindex Wno-selector
3203 Warn if multiple methods of different types for the same selector are
3204 found during compilation. The check is performed on the list of methods
3205 in the final stage of compilation. Additionally, a check is performed
3206 for each selector appearing in a @code{@@selector(@dots{})}
3207 expression, and a corresponding method for that selector has been found
3208 during compilation. Because these checks scan the method table only at
3209 the end of compilation, these warnings are not produced if the final
3210 stage of compilation is not reached, for example because an error is
3211 found during compilation, or because the @option{-fsyntax-only} option is
3212 being used.
3213
3214 @item -Wstrict-selector-match @r{(Objective-C and Objective-C++ only)}
3215 @opindex Wstrict-selector-match
3216 @opindex Wno-strict-selector-match
3217 Warn if multiple methods with differing argument and/or return types are
3218 found for a given selector when attempting to send a message using this
3219 selector to a receiver of type @code{id} or @code{Class}. When this flag
3220 is off (which is the default behavior), the compiler omits such warnings
3221 if any differences found are confined to types that share the same size
3222 and alignment.
3223
3224 @item -Wundeclared-selector @r{(Objective-C and Objective-C++ only)}
3225 @opindex Wundeclared-selector
3226 @opindex Wno-undeclared-selector
3227 Warn if a @code{@@selector(@dots{})} expression referring to an
3228 undeclared selector is found. A selector is considered undeclared if no
3229 method with that name has been declared before the
3230 @code{@@selector(@dots{})} expression, either explicitly in an
3231 @code{@@interface} or @code{@@protocol} declaration, or implicitly in
3232 an @code{@@implementation} section. This option always performs its
3233 checks as soon as a @code{@@selector(@dots{})} expression is found,
3234 while @option{-Wselector} only performs its checks in the final stage of
3235 compilation. This also enforces the coding style convention
3236 that methods and selectors must be declared before being used.
3237
3238 @item -print-objc-runtime-info
3239 @opindex print-objc-runtime-info
3240 Generate C header describing the largest structure that is passed by
3241 value, if any.
3242
3243 @end table
3244
3245 @node Diagnostic Message Formatting Options
3246 @section Options to Control Diagnostic Messages Formatting
3247 @cindex options to control diagnostics formatting
3248 @cindex diagnostic messages
3249 @cindex message formatting
3250
3251 Traditionally, diagnostic messages have been formatted irrespective of
3252 the output device's aspect (e.g.@: its width, @dots{}). You can use the
3253 options described below
3254 to control the formatting algorithm for diagnostic messages,
3255 e.g.@: how many characters per line, how often source location
3256 information should be reported. Note that some language front ends may not
3257 honor these options.
3258
3259 @table @gcctabopt
3260 @item -fmessage-length=@var{n}
3261 @opindex fmessage-length
3262 Try to format error messages so that they fit on lines of about
3263 @var{n} characters. If @var{n} is zero, then no line-wrapping is
3264 done; each error message appears on a single line. This is the
3265 default for all front ends.
3266
3267 @item -fdiagnostics-show-location=once
3268 @opindex fdiagnostics-show-location
3269 Only meaningful in line-wrapping mode. Instructs the diagnostic messages
3270 reporter to emit source location information @emph{once}; that is, in
3271 case the message is too long to fit on a single physical line and has to
3272 be wrapped, the source location won't be emitted (as prefix) again,
3273 over and over, in subsequent continuation lines. This is the default
3274 behavior.
3275
3276 @item -fdiagnostics-show-location=every-line
3277 Only meaningful in line-wrapping mode. Instructs the diagnostic
3278 messages reporter to emit the same source location information (as
3279 prefix) for physical lines that result from the process of breaking
3280 a message which is too long to fit on a single line.
3281
3282 @item -fdiagnostics-color[=@var{WHEN}]
3283 @itemx -fno-diagnostics-color
3284 @opindex fdiagnostics-color
3285 @cindex highlight, color
3286 @vindex GCC_COLORS @r{environment variable}
3287 Use color in diagnostics. @var{WHEN} is @samp{never}, @samp{always},
3288 or @samp{auto}. The default depends on how the compiler has been configured,
3289 it can be any of the above @var{WHEN} options or also @samp{never}
3290 if @env{GCC_COLORS} environment variable isn't present in the environment,
3291 and @samp{auto} otherwise.
3292 @samp{auto} means to use color only when the standard error is a terminal.
3293 The forms @option{-fdiagnostics-color} and @option{-fno-diagnostics-color} are
3294 aliases for @option{-fdiagnostics-color=always} and
3295 @option{-fdiagnostics-color=never}, respectively.
3296
3297 The colors are defined by the environment variable @env{GCC_COLORS}.
3298 Its value is a colon-separated list of capabilities and Select Graphic
3299 Rendition (SGR) substrings. SGR commands are interpreted by the
3300 terminal or terminal emulator. (See the section in the documentation
3301 of your text terminal for permitted values and their meanings as
3302 character attributes.) These substring values are integers in decimal
3303 representation and can be concatenated with semicolons.
3304 Common values to concatenate include
3305 @samp{1} for bold,
3306 @samp{4} for underline,
3307 @samp{5} for blink,
3308 @samp{7} for inverse,
3309 @samp{39} for default foreground color,
3310 @samp{30} to @samp{37} for foreground colors,
3311 @samp{90} to @samp{97} for 16-color mode foreground colors,
3312 @samp{38;5;0} to @samp{38;5;255}
3313 for 88-color and 256-color modes foreground colors,
3314 @samp{49} for default background color,
3315 @samp{40} to @samp{47} for background colors,
3316 @samp{100} to @samp{107} for 16-color mode background colors,
3317 and @samp{48;5;0} to @samp{48;5;255}
3318 for 88-color and 256-color modes background colors.
3319
3320 The default @env{GCC_COLORS} is
3321 @smallexample
3322 error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01
3323 @end smallexample
3324 @noindent
3325 where @samp{01;31} is bold red, @samp{01;35} is bold magenta,
3326 @samp{01;36} is bold cyan, @samp{01;32} is bold green and
3327 @samp{01} is bold. Setting @env{GCC_COLORS} to the empty
3328 string disables colors.
3329 Supported capabilities are as follows.
3330
3331 @table @code
3332 @item error=
3333 @vindex error GCC_COLORS @r{capability}
3334 SGR substring for error: markers.
3335
3336 @item warning=
3337 @vindex warning GCC_COLORS @r{capability}
3338 SGR substring for warning: markers.
3339
3340 @item note=
3341 @vindex note GCC_COLORS @r{capability}
3342 SGR substring for note: markers.
3343
3344 @item caret=
3345 @vindex caret GCC_COLORS @r{capability}
3346 SGR substring for caret line.
3347
3348 @item locus=
3349 @vindex locus GCC_COLORS @r{capability}
3350 SGR substring for location information, @samp{file:line} or
3351 @samp{file:line:column} etc.
3352
3353 @item quote=
3354 @vindex quote GCC_COLORS @r{capability}
3355 SGR substring for information printed within quotes.
3356 @end table
3357
3358 @item -fno-diagnostics-show-option
3359 @opindex fno-diagnostics-show-option
3360 @opindex fdiagnostics-show-option
3361 By default, each diagnostic emitted includes text indicating the
3362 command-line option that directly controls the diagnostic (if such an
3363 option is known to the diagnostic machinery). Specifying the
3364 @option{-fno-diagnostics-show-option} flag suppresses that behavior.
3365
3366 @item -fno-diagnostics-show-caret
3367 @opindex fno-diagnostics-show-caret
3368 @opindex fdiagnostics-show-caret
3369 By default, each diagnostic emitted includes the original source line
3370 and a caret @samp{^} indicating the column. This option suppresses this
3371 information. The source line is truncated to @var{n} characters, if
3372 the @option{-fmessage-length=n} option is given. When the output is done
3373 to the terminal, the width is limited to the width given by the
3374 @env{COLUMNS} environment variable or, if not set, to the terminal width.
3375
3376 @end table
3377
3378 @node Warning Options
3379 @section Options to Request or Suppress Warnings
3380 @cindex options to control warnings
3381 @cindex warning messages
3382 @cindex messages, warning
3383 @cindex suppressing warnings
3384
3385 Warnings are diagnostic messages that report constructions that
3386 are not inherently erroneous but that are risky or suggest there
3387 may have been an error.
3388
3389 The following language-independent options do not enable specific
3390 warnings but control the kinds of diagnostics produced by GCC@.
3391
3392 @table @gcctabopt
3393 @cindex syntax checking
3394 @item -fsyntax-only
3395 @opindex fsyntax-only
3396 Check the code for syntax errors, but don't do anything beyond that.
3397
3398 @item -fmax-errors=@var{n}
3399 @opindex fmax-errors
3400 Limits the maximum number of error messages to @var{n}, at which point
3401 GCC bails out rather than attempting to continue processing the source
3402 code. If @var{n} is 0 (the default), there is no limit on the number
3403 of error messages produced. If @option{-Wfatal-errors} is also
3404 specified, then @option{-Wfatal-errors} takes precedence over this
3405 option.
3406
3407 @item -w
3408 @opindex w
3409 Inhibit all warning messages.
3410
3411 @item -Werror
3412 @opindex Werror
3413 @opindex Wno-error
3414 Make all warnings into errors.
3415
3416 @item -Werror=
3417 @opindex Werror=
3418 @opindex Wno-error=
3419 Make the specified warning into an error. The specifier for a warning
3420 is appended; for example @option{-Werror=switch} turns the warnings
3421 controlled by @option{-Wswitch} into errors. This switch takes a
3422 negative form, to be used to negate @option{-Werror} for specific
3423 warnings; for example @option{-Wno-error=switch} makes
3424 @option{-Wswitch} warnings not be errors, even when @option{-Werror}
3425 is in effect.
3426
3427 The warning message for each controllable warning includes the
3428 option that controls the warning. That option can then be used with
3429 @option{-Werror=} and @option{-Wno-error=} as described above.
3430 (Printing of the option in the warning message can be disabled using the
3431 @option{-fno-diagnostics-show-option} flag.)
3432
3433 Note that specifying @option{-Werror=}@var{foo} automatically implies
3434 @option{-W}@var{foo}. However, @option{-Wno-error=}@var{foo} does not
3435 imply anything.
3436
3437 @item -Wfatal-errors
3438 @opindex Wfatal-errors
3439 @opindex Wno-fatal-errors
3440 This option causes the compiler to abort compilation on the first error
3441 occurred rather than trying to keep going and printing further error
3442 messages.
3443
3444 @end table
3445
3446 You can request many specific warnings with options beginning with
3447 @samp{-W}, for example @option{-Wimplicit} to request warnings on
3448 implicit declarations. Each of these specific warning options also
3449 has a negative form beginning @samp{-Wno-} to turn off warnings; for
3450 example, @option{-Wno-implicit}. This manual lists only one of the
3451 two forms, whichever is not the default. For further
3452 language-specific options also refer to @ref{C++ Dialect Options} and
3453 @ref{Objective-C and Objective-C++ Dialect Options}.
3454
3455 Some options, such as @option{-Wall} and @option{-Wextra}, turn on other
3456 options, such as @option{-Wunused}, which may turn on further options,
3457 such as @option{-Wunused-value}. The combined effect of positive and
3458 negative forms is that more specific options have priority over less
3459 specific ones, independently of their position in the command-line. For
3460 options of the same specificity, the last one takes effect. Options
3461 enabled or disabled via pragmas (@pxref{Diagnostic Pragmas}) take effect
3462 as if they appeared at the end of the command-line.
3463
3464 When an unrecognized warning option is requested (e.g.,
3465 @option{-Wunknown-warning}), GCC emits a diagnostic stating
3466 that the option is not recognized. However, if the @option{-Wno-} form
3467 is used, the behavior is slightly different: no diagnostic is
3468 produced for @option{-Wno-unknown-warning} unless other diagnostics
3469 are being produced. This allows the use of new @option{-Wno-} options
3470 with old compilers, but if something goes wrong, the compiler
3471 warns that an unrecognized option is present.
3472
3473 @table @gcctabopt
3474 @item -Wpedantic
3475 @itemx -pedantic
3476 @opindex pedantic
3477 @opindex Wpedantic
3478 Issue all the warnings demanded by strict ISO C and ISO C++;
3479 reject all programs that use forbidden extensions, and some other
3480 programs that do not follow ISO C and ISO C++. For ISO C, follows the
3481 version of the ISO C standard specified by any @option{-std} option used.
3482
3483 Valid ISO C and ISO C++ programs should compile properly with or without
3484 this option (though a rare few require @option{-ansi} or a
3485 @option{-std} option specifying the required version of ISO C)@. However,
3486 without this option, certain GNU extensions and traditional C and C++
3487 features are supported as well. With this option, they are rejected.
3488
3489 @option{-Wpedantic} does not cause warning messages for use of the
3490 alternate keywords whose names begin and end with @samp{__}. Pedantic
3491 warnings are also disabled in the expression that follows
3492 @code{__extension__}. However, only system header files should use
3493 these escape routes; application programs should avoid them.
3494 @xref{Alternate Keywords}.
3495
3496 Some users try to use @option{-Wpedantic} to check programs for strict ISO
3497 C conformance. They soon find that it does not do quite what they want:
3498 it finds some non-ISO practices, but not all---only those for which
3499 ISO C @emph{requires} a diagnostic, and some others for which
3500 diagnostics have been added.
3501
3502 A feature to report any failure to conform to ISO C might be useful in
3503 some instances, but would require considerable additional work and would
3504 be quite different from @option{-Wpedantic}. We don't have plans to
3505 support such a feature in the near future.
3506
3507 Where the standard specified with @option{-std} represents a GNU
3508 extended dialect of C, such as @samp{gnu90} or @samp{gnu99}, there is a
3509 corresponding @dfn{base standard}, the version of ISO C on which the GNU
3510 extended dialect is based. Warnings from @option{-Wpedantic} are given
3511 where they are required by the base standard. (It does not make sense
3512 for such warnings to be given only for features not in the specified GNU
3513 C dialect, since by definition the GNU dialects of C include all
3514 features the compiler supports with the given option, and there would be
3515 nothing to warn about.)
3516
3517 @item -pedantic-errors
3518 @opindex pedantic-errors
3519 Give an error whenever the @dfn{base standard} (see @option{-Wpedantic})
3520 requires a diagnostic, in some cases where there is undefined behavior
3521 at compile-time and in some other cases that do not prevent compilation
3522 of programs that are valid according to the standard. This is not
3523 equivalent to @option{-Werror=pedantic}, since there are errors enabled
3524 by this option and not enabled by the latter and vice versa.
3525
3526 @item -Wall
3527 @opindex Wall
3528 @opindex Wno-all
3529 This enables all the warnings about constructions that some users
3530 consider questionable, and that are easy to avoid (or modify to
3531 prevent the warning), even in conjunction with macros. This also
3532 enables some language-specific warnings described in @ref{C++ Dialect
3533 Options} and @ref{Objective-C and Objective-C++ Dialect Options}.
3534
3535 @option{-Wall} turns on the following warning flags:
3536
3537 @gccoptlist{-Waddress @gol
3538 -Warray-bounds=1 @r{(only with} @option{-O2}@r{)} @gol
3539 -Wbool-compare @gol
3540 -Wc++11-compat -Wc++14-compat@gol
3541 -Wchar-subscripts @gol
3542 -Wcomment @gol
3543 -Wenum-compare @r{(in C/ObjC; this is on by default in C++)} @gol
3544 -Wformat @gol
3545 -Wimplicit @r{(C and Objective-C only)} @gol
3546 -Wimplicit-int @r{(C and Objective-C only)} @gol
3547 -Wimplicit-function-declaration @r{(C and Objective-C only)} @gol
3548 -Winit-self @r{(only for C++)} @gol
3549 -Wlogical-not-parentheses
3550 -Wmain @r{(only for C/ObjC and unless} @option{-ffreestanding}@r{)} @gol
3551 -Wmaybe-uninitialized @gol
3552 -Wmemset-elt-size @gol
3553 -Wmemset-transposed-args @gol
3554 -Wmisleading-indentation @r{(only for C/C++)} @gol
3555 -Wmissing-braces @r{(only for C/ObjC)} @gol
3556 -Wnarrowing @r{(only for C++)} @gol
3557 -Wnonnull @gol
3558 -Wnonnull-compare @gol
3559 -Wopenmp-simd @gol
3560 -Wparentheses @gol
3561 -Wpointer-sign @gol
3562 -Wreorder @gol
3563 -Wreturn-type @gol
3564 -Wsequence-point @gol
3565 -Wsign-compare @r{(only in C++)} @gol
3566 -Wsizeof-pointer-memaccess @gol
3567 -Wstrict-aliasing @gol
3568 -Wstrict-overflow=1 @gol
3569 -Wswitch @gol
3570 -Wtautological-compare @gol
3571 -Wtrigraphs @gol
3572 -Wuninitialized @gol
3573 -Wunknown-pragmas @gol
3574 -Wunused-function @gol
3575 -Wunused-label @gol
3576 -Wunused-value @gol
3577 -Wunused-variable @gol
3578 -Wvolatile-register-var @gol
3579 }
3580
3581 Note that some warning flags are not implied by @option{-Wall}. Some of
3582 them warn about constructions that users generally do not consider
3583 questionable, but which occasionally you might wish to check for;
3584 others warn about constructions that are necessary or hard to avoid in
3585 some cases, and there is no simple way to modify the code to suppress
3586 the warning. Some of them are enabled by @option{-Wextra} but many of
3587 them must be enabled individually.
3588
3589 @item -Wextra
3590 @opindex W
3591 @opindex Wextra
3592 @opindex Wno-extra
3593 This enables some extra warning flags that are not enabled by
3594 @option{-Wall}. (This option used to be called @option{-W}. The older
3595 name is still supported, but the newer name is more descriptive.)
3596
3597 @gccoptlist{-Wclobbered @gol
3598 -Wempty-body @gol
3599 -Wignored-qualifiers @gol
3600 -Wmissing-field-initializers @gol
3601 -Wmissing-parameter-type @r{(C only)} @gol
3602 -Wold-style-declaration @r{(C only)} @gol
3603 -Woverride-init @gol
3604 -Wsign-compare @r{(C only)} @gol
3605 -Wtype-limits @gol
3606 -Wuninitialized @gol
3607 -Wshift-negative-value @r{(in C++03 and in C99 and newer)} @gol
3608 -Wunused-parameter @r{(only with} @option{-Wunused} @r{or} @option{-Wall}@r{)} @gol
3609 -Wunused-but-set-parameter @r{(only with} @option{-Wunused} @r{or} @option{-Wall}@r{)} @gol
3610 }
3611
3612 The option @option{-Wextra} also prints warning messages for the
3613 following cases:
3614
3615 @itemize @bullet
3616
3617 @item
3618 A pointer is compared against integer zero with @code{<}, @code{<=},
3619 @code{>}, or @code{>=}.
3620
3621 @item
3622 (C++ only) An enumerator and a non-enumerator both appear in a
3623 conditional expression.
3624
3625 @item
3626 (C++ only) Ambiguous virtual bases.
3627
3628 @item
3629 (C++ only) Subscripting an array that has been declared @code{register}.
3630
3631 @item
3632 (C++ only) Taking the address of a variable that has been declared
3633 @code{register}.
3634
3635 @item
3636 (C++ only) A base class is not initialized in a derived class's copy
3637 constructor.
3638
3639 @end itemize
3640
3641 @item -Wchar-subscripts
3642 @opindex Wchar-subscripts
3643 @opindex Wno-char-subscripts
3644 Warn if an array subscript has type @code{char}. This is a common cause
3645 of error, as programmers often forget that this type is signed on some
3646 machines.
3647 This warning is enabled by @option{-Wall}.
3648
3649 @item -Wcomment
3650 @opindex Wcomment
3651 @opindex Wno-comment
3652 Warn whenever a comment-start sequence @samp{/*} appears in a @samp{/*}
3653 comment, or whenever a Backslash-Newline appears in a @samp{//} comment.
3654 This warning is enabled by @option{-Wall}.
3655
3656 @item -Wno-coverage-mismatch
3657 @opindex Wno-coverage-mismatch
3658 Warn if feedback profiles do not match when using the
3659 @option{-fprofile-use} option.
3660 If a source file is changed between compiling with @option{-fprofile-gen} and
3661 with @option{-fprofile-use}, the files with the profile feedback can fail
3662 to match the source file and GCC cannot use the profile feedback
3663 information. By default, this warning is enabled and is treated as an
3664 error. @option{-Wno-coverage-mismatch} can be used to disable the
3665 warning or @option{-Wno-error=coverage-mismatch} can be used to
3666 disable the error. Disabling the error for this warning can result in
3667 poorly optimized code and is useful only in the
3668 case of very minor changes such as bug fixes to an existing code-base.
3669 Completely disabling the warning is not recommended.
3670
3671 @item -Wno-cpp
3672 @r{(C, Objective-C, C++, Objective-C++ and Fortran only)}
3673
3674 Suppress warning messages emitted by @code{#warning} directives.
3675
3676 @item -Wdouble-promotion @r{(C, C++, Objective-C and Objective-C++ only)}
3677 @opindex Wdouble-promotion
3678 @opindex Wno-double-promotion
3679 Give a warning when a value of type @code{float} is implicitly
3680 promoted to @code{double}. CPUs with a 32-bit ``single-precision''
3681 floating-point unit implement @code{float} in hardware, but emulate
3682 @code{double} in software. On such a machine, doing computations
3683 using @code{double} values is much more expensive because of the
3684 overhead required for software emulation.
3685
3686 It is easy to accidentally do computations with @code{double} because
3687 floating-point literals are implicitly of type @code{double}. For
3688 example, in:
3689 @smallexample
3690 @group
3691 float area(float radius)
3692 @{
3693 return 3.14159 * radius * radius;
3694 @}
3695 @end group
3696 @end smallexample
3697 the compiler performs the entire computation with @code{double}
3698 because the floating-point literal is a @code{double}.
3699
3700 @item -Wformat
3701 @itemx -Wformat=@var{n}
3702 @opindex Wformat
3703 @opindex Wno-format
3704 @opindex ffreestanding
3705 @opindex fno-builtin
3706 @opindex Wformat=
3707 Check calls to @code{printf} and @code{scanf}, etc., to make sure that
3708 the arguments supplied have types appropriate to the format string
3709 specified, and that the conversions specified in the format string make
3710 sense. This includes standard functions, and others specified by format
3711 attributes (@pxref{Function Attributes}), in the @code{printf},
3712 @code{scanf}, @code{strftime} and @code{strfmon} (an X/Open extension,
3713 not in the C standard) families (or other target-specific families).
3714 Which functions are checked without format attributes having been
3715 specified depends on the standard version selected, and such checks of
3716 functions without the attribute specified are disabled by
3717 @option{-ffreestanding} or @option{-fno-builtin}.
3718
3719 The formats are checked against the format features supported by GNU
3720 libc version 2.2. These include all ISO C90 and C99 features, as well
3721 as features from the Single Unix Specification and some BSD and GNU
3722 extensions. Other library implementations may not support all these
3723 features; GCC does not support warning about features that go beyond a
3724 particular library's limitations. However, if @option{-Wpedantic} is used
3725 with @option{-Wformat}, warnings are given about format features not
3726 in the selected standard version (but not for @code{strfmon} formats,
3727 since those are not in any version of the C standard). @xref{C Dialect
3728 Options,,Options Controlling C Dialect}.
3729
3730 @table @gcctabopt
3731 @item -Wformat=1
3732 @itemx -Wformat
3733 @opindex Wformat
3734 @opindex Wformat=1
3735 Option @option{-Wformat} is equivalent to @option{-Wformat=1}, and
3736 @option{-Wno-format} is equivalent to @option{-Wformat=0}. Since
3737 @option{-Wformat} also checks for null format arguments for several
3738 functions, @option{-Wformat} also implies @option{-Wnonnull}. Some
3739 aspects of this level of format checking can be disabled by the
3740 options: @option{-Wno-format-contains-nul},
3741 @option{-Wno-format-extra-args}, and @option{-Wno-format-zero-length}.
3742 @option{-Wformat} is enabled by @option{-Wall}.
3743
3744 @item -Wno-format-contains-nul
3745 @opindex Wno-format-contains-nul
3746 @opindex Wformat-contains-nul
3747 If @option{-Wformat} is specified, do not warn about format strings that
3748 contain NUL bytes.
3749
3750 @item -Wno-format-extra-args
3751 @opindex Wno-format-extra-args
3752 @opindex Wformat-extra-args
3753 If @option{-Wformat} is specified, do not warn about excess arguments to a
3754 @code{printf} or @code{scanf} format function. The C standard specifies
3755 that such arguments are ignored.
3756
3757 Where the unused arguments lie between used arguments that are
3758 specified with @samp{$} operand number specifications, normally
3759 warnings are still given, since the implementation could not know what
3760 type to pass to @code{va_arg} to skip the unused arguments. However,
3761 in the case of @code{scanf} formats, this option suppresses the
3762 warning if the unused arguments are all pointers, since the Single
3763 Unix Specification says that such unused arguments are allowed.
3764
3765 @item -Wno-format-zero-length
3766 @opindex Wno-format-zero-length
3767 @opindex Wformat-zero-length
3768 If @option{-Wformat} is specified, do not warn about zero-length formats.
3769 The C standard specifies that zero-length formats are allowed.
3770
3771
3772 @item -Wformat=2
3773 @opindex Wformat=2
3774 Enable @option{-Wformat} plus additional format checks. Currently
3775 equivalent to @option{-Wformat -Wformat-nonliteral -Wformat-security
3776 -Wformat-y2k}.
3777
3778 @item -Wformat-nonliteral
3779 @opindex Wformat-nonliteral
3780 @opindex Wno-format-nonliteral
3781 If @option{-Wformat} is specified, also warn if the format string is not a
3782 string literal and so cannot be checked, unless the format function
3783 takes its format arguments as a @code{va_list}.
3784
3785 @item -Wformat-security
3786 @opindex Wformat-security
3787 @opindex Wno-format-security
3788 If @option{-Wformat} is specified, also warn about uses of format
3789 functions that represent possible security problems. At present, this
3790 warns about calls to @code{printf} and @code{scanf} functions where the
3791 format string is not a string literal and there are no format arguments,
3792 as in @code{printf (foo);}. This may be a security hole if the format
3793 string came from untrusted input and contains @samp{%n}. (This is
3794 currently a subset of what @option{-Wformat-nonliteral} warns about, but
3795 in future warnings may be added to @option{-Wformat-security} that are not
3796 included in @option{-Wformat-nonliteral}.)
3797
3798 @item -Wformat-signedness
3799 @opindex Wformat-signedness
3800 @opindex Wno-format-signedness
3801 If @option{-Wformat} is specified, also warn if the format string
3802 requires an unsigned argument and the argument is signed and vice versa.
3803
3804 @item -Wformat-y2k
3805 @opindex Wformat-y2k
3806 @opindex Wno-format-y2k
3807 If @option{-Wformat} is specified, also warn about @code{strftime}
3808 formats that may yield only a two-digit year.
3809 @end table
3810
3811 @item -Wnonnull
3812 @opindex Wnonnull
3813 @opindex Wno-nonnull
3814 Warn about passing a null pointer for arguments marked as
3815 requiring a non-null value by the @code{nonnull} function attribute.
3816
3817 @option{-Wnonnull} is included in @option{-Wall} and @option{-Wformat}. It
3818 can be disabled with the @option{-Wno-nonnull} option.
3819
3820 @item -Wnonnull-compare
3821 @opindex Wnonnull-compare
3822 @opindex Wno-nonnull-compare
3823 Warn when comparing an argument marked with the @code{nonnull}
3824 function attribute against null inside the function.
3825
3826 @option{-Wnonnull-compare} is included in @option{-Wall}. It
3827 can be disabled with the @option{-Wno-nonnull-compare} option.
3828
3829 @item -Wnull-dereference
3830 @opindex Wnull-dereference
3831 @opindex Wno-null-dereference
3832 Warn if the compiler detects paths that trigger erroneous or
3833 undefined behavior due to dereferencing a null pointer. This option
3834 is only active when @option{-fdelete-null-pointer-checks} is active,
3835 which is enabled by optimizations in most targets. The precision of
3836 the warnings depends on the optimization options used.
3837
3838 @item -Winit-self @r{(C, C++, Objective-C and Objective-C++ only)}
3839 @opindex Winit-self
3840 @opindex Wno-init-self
3841 Warn about uninitialized variables that are initialized with themselves.
3842 Note this option can only be used with the @option{-Wuninitialized} option.
3843
3844 For example, GCC warns about @code{i} being uninitialized in the
3845 following snippet only when @option{-Winit-self} has been specified:
3846 @smallexample
3847 @group
3848 int f()
3849 @{
3850 int i = i;
3851 return i;
3852 @}
3853 @end group
3854 @end smallexample
3855
3856 This warning is enabled by @option{-Wall} in C++.
3857
3858 @item -Wimplicit-int @r{(C and Objective-C only)}
3859 @opindex Wimplicit-int
3860 @opindex Wno-implicit-int
3861 Warn when a declaration does not specify a type.
3862 This warning is enabled by @option{-Wall}.
3863
3864 @item -Wimplicit-function-declaration @r{(C and Objective-C only)}
3865 @opindex Wimplicit-function-declaration
3866 @opindex Wno-implicit-function-declaration
3867 Give a warning whenever a function is used before being declared. In
3868 C99 mode (@option{-std=c99} or @option{-std=gnu99}), this warning is
3869 enabled by default and it is made into an error by
3870 @option{-pedantic-errors}. This warning is also enabled by
3871 @option{-Wall}.
3872
3873 @item -Wimplicit @r{(C and Objective-C only)}
3874 @opindex Wimplicit
3875 @opindex Wno-implicit
3876 Same as @option{-Wimplicit-int} and @option{-Wimplicit-function-declaration}.
3877 This warning is enabled by @option{-Wall}.
3878
3879 @item -Wignored-qualifiers @r{(C and C++ only)}
3880 @opindex Wignored-qualifiers
3881 @opindex Wno-ignored-qualifiers
3882 Warn if the return type of a function has a type qualifier
3883 such as @code{const}. For ISO C such a type qualifier has no effect,
3884 since the value returned by a function is not an lvalue.
3885 For C++, the warning is only emitted for scalar types or @code{void}.
3886 ISO C prohibits qualified @code{void} return types on function
3887 definitions, so such return types always receive a warning
3888 even without this option.
3889
3890 This warning is also enabled by @option{-Wextra}.
3891
3892 @item -Wignored-attributes @r{(C and C++ only)}
3893 @opindex Wignored-attributes
3894 @opindex Wno-ignored-attributes
3895 Warn when an attribute is ignored. This is different from the
3896 @option{-Wattributes} option in that it warns whenever the compiler decides
3897 to drop an attribute, not that the attribute is either unknown, used in a
3898 wrong place, etc. This warning is enabled by default.
3899
3900 @item -Wmain
3901 @opindex Wmain
3902 @opindex Wno-main
3903 Warn if the type of @code{main} is suspicious. @code{main} should be
3904 a function with external linkage, returning int, taking either zero
3905 arguments, two, or three arguments of appropriate types. This warning
3906 is enabled by default in C++ and is enabled by either @option{-Wall}
3907 or @option{-Wpedantic}.
3908
3909 @item -Wmisleading-indentation @r{(C and C++ only)}
3910 @opindex Wmisleading-indentation
3911 @opindex Wno-misleading-indentation
3912 Warn when the indentation of the code does not reflect the block structure.
3913 Specifically, a warning is issued for @code{if}, @code{else}, @code{while}, and
3914 @code{for} clauses with a guarded statement that does not use braces,
3915 followed by an unguarded statement with the same indentation.
3916
3917 In the following example, the call to ``bar'' is misleadingly indented as
3918 if it were guarded by the ``if'' conditional.
3919
3920 @smallexample
3921 if (some_condition ())
3922 foo ();
3923 bar (); /* Gotcha: this is not guarded by the "if". */
3924 @end smallexample
3925
3926 In the case of mixed tabs and spaces, the warning uses the
3927 @option{-ftabstop=} option to determine if the statements line up
3928 (defaulting to 8).
3929
3930 The warning is not issued for code involving multiline preprocessor logic
3931 such as the following example.
3932
3933 @smallexample
3934 if (flagA)
3935 foo (0);
3936 #if SOME_CONDITION_THAT_DOES_NOT_HOLD
3937 if (flagB)
3938 #endif
3939 foo (1);
3940 @end smallexample
3941
3942 The warning is not issued after a @code{#line} directive, since this
3943 typically indicates autogenerated code, and no assumptions can be made
3944 about the layout of the file that the directive references.
3945
3946 This warning is enabled by @option{-Wall} in C and C++.
3947
3948 @item -Wmissing-braces
3949 @opindex Wmissing-braces
3950 @opindex Wno-missing-braces
3951 Warn if an aggregate or union initializer is not fully bracketed. In
3952 the following example, the initializer for @code{a} is not fully
3953 bracketed, but that for @code{b} is fully bracketed. This warning is
3954 enabled by @option{-Wall} in C.
3955
3956 @smallexample
3957 int a[2][2] = @{ 0, 1, 2, 3 @};
3958 int b[2][2] = @{ @{ 0, 1 @}, @{ 2, 3 @} @};
3959 @end smallexample
3960
3961 This warning is enabled by @option{-Wall}.
3962
3963 @item -Wmissing-include-dirs @r{(C, C++, Objective-C and Objective-C++ only)}
3964 @opindex Wmissing-include-dirs
3965 @opindex Wno-missing-include-dirs
3966 Warn if a user-supplied include directory does not exist.
3967
3968 @item -Wparentheses
3969 @opindex Wparentheses
3970 @opindex Wno-parentheses
3971 Warn if parentheses are omitted in certain contexts, such
3972 as when there is an assignment in a context where a truth value
3973 is expected, or when operators are nested whose precedence people
3974 often get confused about.
3975
3976 Also warn if a comparison like @code{x<=y<=z} appears; this is
3977 equivalent to @code{(x<=y ? 1 : 0) <= z}, which is a different
3978 interpretation from that of ordinary mathematical notation.
3979
3980 Also warn for dangerous uses of the GNU extension to
3981 @code{?:} with omitted middle operand. When the condition
3982 in the @code{?}: operator is a boolean expression, the omitted value is
3983 always 1. Often programmers expect it to be a value computed
3984 inside the conditional expression instead.
3985
3986 This warning is enabled by @option{-Wall}.
3987
3988 @item -Wsequence-point
3989 @opindex Wsequence-point
3990 @opindex Wno-sequence-point
3991 Warn about code that may have undefined semantics because of violations
3992 of sequence point rules in the C and C++ standards.
3993
3994 The C and C++ standards define the order in which expressions in a C/C++
3995 program are evaluated in terms of @dfn{sequence points}, which represent
3996 a partial ordering between the execution of parts of the program: those
3997 executed before the sequence point, and those executed after it. These
3998 occur after the evaluation of a full expression (one which is not part
3999 of a larger expression), after the evaluation of the first operand of a
4000 @code{&&}, @code{||}, @code{? :} or @code{,} (comma) operator, before a
4001 function is called (but after the evaluation of its arguments and the
4002 expression denoting the called function), and in certain other places.
4003 Other than as expressed by the sequence point rules, the order of
4004 evaluation of subexpressions of an expression is not specified. All
4005 these rules describe only a partial order rather than a total order,
4006 since, for example, if two functions are called within one expression
4007 with no sequence point between them, the order in which the functions
4008 are called is not specified. However, the standards committee have
4009 ruled that function calls do not overlap.
4010
4011 It is not specified when between sequence points modifications to the
4012 values of objects take effect. Programs whose behavior depends on this
4013 have undefined behavior; the C and C++ standards specify that ``Between
4014 the previous and next sequence point an object shall have its stored
4015 value modified at most once by the evaluation of an expression.
4016 Furthermore, the prior value shall be read only to determine the value
4017 to be stored.''. If a program breaks these rules, the results on any
4018 particular implementation are entirely unpredictable.
4019
4020 Examples of code with undefined behavior are @code{a = a++;}, @code{a[n]
4021 = b[n++]} and @code{a[i++] = i;}. Some more complicated cases are not
4022 diagnosed by this option, and it may give an occasional false positive
4023 result, but in general it has been found fairly effective at detecting
4024 this sort of problem in programs.
4025
4026 The standard is worded confusingly, therefore there is some debate
4027 over the precise meaning of the sequence point rules in subtle cases.
4028 Links to discussions of the problem, including proposed formal
4029 definitions, may be found on the GCC readings page, at
4030 @uref{http://gcc.gnu.org/@/readings.html}.
4031
4032 This warning is enabled by @option{-Wall} for C and C++.
4033
4034 @item -Wno-return-local-addr
4035 @opindex Wno-return-local-addr
4036 @opindex Wreturn-local-addr
4037 Do not warn about returning a pointer (or in C++, a reference) to a
4038 variable that goes out of scope after the function returns.
4039
4040 @item -Wreturn-type
4041 @opindex Wreturn-type
4042 @opindex Wno-return-type
4043 Warn whenever a function is defined with a return type that defaults
4044 to @code{int}. Also warn about any @code{return} statement with no
4045 return value in a function whose return type is not @code{void}
4046 (falling off the end of the function body is considered returning
4047 without a value), and about a @code{return} statement with an
4048 expression in a function whose return type is @code{void}.
4049
4050 For C++, a function without return type always produces a diagnostic
4051 message, even when @option{-Wno-return-type} is specified. The only
4052 exceptions are @code{main} and functions defined in system headers.
4053
4054 This warning is enabled by @option{-Wall}.
4055
4056 @item -Wshift-count-negative
4057 @opindex Wshift-count-negative
4058 @opindex Wno-shift-count-negative
4059 Warn if shift count is negative. This warning is enabled by default.
4060
4061 @item -Wshift-count-overflow
4062 @opindex Wshift-count-overflow
4063 @opindex Wno-shift-count-overflow
4064 Warn if shift count >= width of type. This warning is enabled by default.
4065
4066 @item -Wshift-negative-value
4067 @opindex Wshift-negative-value
4068 @opindex Wno-shift-negative-value
4069 Warn if left shifting a negative value. This warning is enabled by
4070 @option{-Wextra} in C99 and C++11 modes (and newer).
4071
4072 @item -Wshift-overflow
4073 @itemx -Wshift-overflow=@var{n}
4074 @opindex Wshift-overflow
4075 @opindex Wno-shift-overflow
4076 Warn about left shift overflows. This warning is enabled by
4077 default in C99 and C++11 modes (and newer).
4078
4079 @table @gcctabopt
4080 @item -Wshift-overflow=1
4081 This is the warning level of @option{-Wshift-overflow} and is enabled
4082 by default in C99 and C++11 modes (and newer). This warning level does
4083 not warn about left-shifting 1 into the sign bit. (However, in C, such
4084 an overflow is still rejected in contexts where an integer constant expression
4085 is required.)
4086
4087 @item -Wshift-overflow=2
4088 This warning level also warns about left-shifting 1 into the sign bit,
4089 unless C++14 mode is active.
4090 @end table
4091
4092 @item -Wswitch
4093 @opindex Wswitch
4094 @opindex Wno-switch
4095 Warn whenever a @code{switch} statement has an index of enumerated type
4096 and lacks a @code{case} for one or more of the named codes of that
4097 enumeration. (The presence of a @code{default} label prevents this
4098 warning.) @code{case} labels outside the enumeration range also
4099 provoke warnings when this option is used (even if there is a
4100 @code{default} label).
4101 This warning is enabled by @option{-Wall}.
4102
4103 @item -Wswitch-default
4104 @opindex Wswitch-default
4105 @opindex Wno-switch-default
4106 Warn whenever a @code{switch} statement does not have a @code{default}
4107 case.
4108
4109 @item -Wswitch-enum
4110 @opindex Wswitch-enum
4111 @opindex Wno-switch-enum
4112 Warn whenever a @code{switch} statement has an index of enumerated type
4113 and lacks a @code{case} for one or more of the named codes of that
4114 enumeration. @code{case} labels outside the enumeration range also
4115 provoke warnings when this option is used. The only difference
4116 between @option{-Wswitch} and this option is that this option gives a
4117 warning about an omitted enumeration code even if there is a
4118 @code{default} label.
4119
4120 @item -Wswitch-bool
4121 @opindex Wswitch-bool
4122 @opindex Wno-switch-bool
4123 Warn whenever a @code{switch} statement has an index of boolean type
4124 and the case values are outside the range of a boolean type.
4125 It is possible to suppress this warning by casting the controlling
4126 expression to a type other than @code{bool}. For example:
4127 @smallexample
4128 @group
4129 switch ((int) (a == 4))
4130 @{
4131 @dots{}
4132 @}
4133 @end group
4134 @end smallexample
4135 This warning is enabled by default for C and C++ programs.
4136
4137 @item -Wsync-nand @r{(C and C++ only)}
4138 @opindex Wsync-nand
4139 @opindex Wno-sync-nand
4140 Warn when @code{__sync_fetch_and_nand} and @code{__sync_nand_and_fetch}
4141 built-in functions are used. These functions changed semantics in GCC 4.4.
4142
4143 @item -Wtrigraphs
4144 @opindex Wtrigraphs
4145 @opindex Wno-trigraphs
4146 Warn if any trigraphs are encountered that might change the meaning of
4147 the program (trigraphs within comments are not warned about).
4148 This warning is enabled by @option{-Wall}.
4149
4150 @item -Wunused-but-set-parameter
4151 @opindex Wunused-but-set-parameter
4152 @opindex Wno-unused-but-set-parameter
4153 Warn whenever a function parameter is assigned to, but otherwise unused
4154 (aside from its declaration).
4155
4156 To suppress this warning use the @code{unused} attribute
4157 (@pxref{Variable Attributes}).
4158
4159 This warning is also enabled by @option{-Wunused} together with
4160 @option{-Wextra}.
4161
4162 @item -Wunused-but-set-variable
4163 @opindex Wunused-but-set-variable
4164 @opindex Wno-unused-but-set-variable
4165 Warn whenever a local variable is assigned to, but otherwise unused
4166 (aside from its declaration).
4167 This warning is enabled by @option{-Wall}.
4168
4169 To suppress this warning use the @code{unused} attribute
4170 (@pxref{Variable Attributes}).
4171
4172 This warning is also enabled by @option{-Wunused}, which is enabled
4173 by @option{-Wall}.
4174
4175 @item -Wunused-function
4176 @opindex Wunused-function
4177 @opindex Wno-unused-function
4178 Warn whenever a static function is declared but not defined or a
4179 non-inline static function is unused.
4180 This warning is enabled by @option{-Wall}.
4181
4182 @item -Wunused-label
4183 @opindex Wunused-label
4184 @opindex Wno-unused-label
4185 Warn whenever a label is declared but not used.
4186 This warning is enabled by @option{-Wall}.
4187
4188 To suppress this warning use the @code{unused} attribute
4189 (@pxref{Variable Attributes}).
4190
4191 @item -Wunused-local-typedefs @r{(C, Objective-C, C++ and Objective-C++ only)}
4192 @opindex Wunused-local-typedefs
4193 Warn when a typedef locally defined in a function is not used.
4194 This warning is enabled by @option{-Wall}.
4195
4196 @item -Wunused-parameter
4197 @opindex Wunused-parameter
4198 @opindex Wno-unused-parameter
4199 Warn whenever a function parameter is unused aside from its declaration.
4200
4201 To suppress this warning use the @code{unused} attribute
4202 (@pxref{Variable Attributes}).
4203
4204 @item -Wno-unused-result
4205 @opindex Wunused-result
4206 @opindex Wno-unused-result
4207 Do not warn if a caller of a function marked with attribute
4208 @code{warn_unused_result} (@pxref{Function Attributes}) does not use
4209 its return value. The default is @option{-Wunused-result}.
4210
4211 @item -Wunused-variable
4212 @opindex Wunused-variable
4213 @opindex Wno-unused-variable
4214 Warn whenever a local or static variable is unused aside from its
4215 declaration. This option implies @option{-Wunused-const-variable=1} for C,
4216 but not for C++. This warning is enabled by @option{-Wall}.
4217
4218 To suppress this warning use the @code{unused} attribute
4219 (@pxref{Variable Attributes}).
4220
4221 @item -Wunused-const-variable
4222 @itemx -Wunused-const-variable=@var{n}
4223 @opindex Wunused-const-variable
4224 @opindex Wno-unused-const-variable
4225 Warn whenever a constant static variable is unused aside from its declaration.
4226 @option{-Wunused-const-variable=1} is enabled by @option{-Wunused-variable}
4227 for C, but not for C++. In C this declares variable storage, but in C++ this
4228 is not an error since const variables take the place of @code{#define}s.
4229
4230 To suppress this warning use the @code{unused} attribute
4231 (@pxref{Variable Attributes}).
4232
4233 @table @gcctabopt
4234 @item -Wunused-const-variable=1
4235 This is the warning level that is enabled by @option{-Wunused-variable} for
4236 C. It warns only about unused static const variables defined in the main
4237 compilation unit, but not about static const variables declared in any
4238 header included.
4239
4240 @item -Wunused-const-variable=2
4241 This warning level also warns for unused constant static variables in
4242 headers (excluding system headers). This is the warning level of
4243 @option{-Wunused-const-variable} and must be explicitly requested since
4244 in C++ this isn't an error and in C it might be harder to clean up all
4245 headers included.
4246 @end table
4247
4248 @item -Wunused-value
4249 @opindex Wunused-value
4250 @opindex Wno-unused-value
4251 Warn whenever a statement computes a result that is explicitly not
4252 used. To suppress this warning cast the unused expression to
4253 @code{void}. This includes an expression-statement or the left-hand
4254 side of a comma expression that contains no side effects. For example,
4255 an expression such as @code{x[i,j]} causes a warning, while
4256 @code{x[(void)i,j]} does not.
4257
4258 This warning is enabled by @option{-Wall}.
4259
4260 @item -Wunused
4261 @opindex Wunused
4262 @opindex Wno-unused
4263 All the above @option{-Wunused} options combined.
4264
4265 In order to get a warning about an unused function parameter, you must
4266 either specify @option{-Wextra -Wunused} (note that @option{-Wall} implies
4267 @option{-Wunused}), or separately specify @option{-Wunused-parameter}.
4268
4269 @item -Wuninitialized
4270 @opindex Wuninitialized
4271 @opindex Wno-uninitialized
4272 Warn if an automatic variable is used without first being initialized
4273 or if a variable may be clobbered by a @code{setjmp} call. In C++,
4274 warn if a non-static reference or non-static @code{const} member
4275 appears in a class without constructors.
4276
4277 If you want to warn about code that uses the uninitialized value of the
4278 variable in its own initializer, use the @option{-Winit-self} option.
4279
4280 These warnings occur for individual uninitialized or clobbered
4281 elements of structure, union or array variables as well as for
4282 variables that are uninitialized or clobbered as a whole. They do
4283 not occur for variables or elements declared @code{volatile}. Because
4284 these warnings depend on optimization, the exact variables or elements
4285 for which there are warnings depends on the precise optimization
4286 options and version of GCC used.
4287
4288 Note that there may be no warning about a variable that is used only
4289 to compute a value that itself is never used, because such
4290 computations may be deleted by data flow analysis before the warnings
4291 are printed.
4292
4293 @item -Winvalid-memory-model
4294 @opindex Winvalid-memory-model
4295 @opindex Wno-invalid-memory-model
4296 Warn for invocations of @ref{__atomic Builtins}, @ref{__sync Builtins},
4297 and the C11 atomic generic functions with a memory consistency argument
4298 that is either invalid for the operation or outside the range of values
4299 of the @code{memory_order} enumeration. For example, since the
4300 @code{__atomic_store} and @code{__atomic_store_n} built-ins are only
4301 defined for the relaxed, release, and sequentially consistent memory
4302 orders the following code is diagnosed:
4303
4304 @smallexample
4305 void store (int *i)
4306 @{
4307 __atomic_store_n (i, 0, memory_order_consume);
4308 @}
4309 @end smallexample
4310
4311 @option{-Winvalid-memory-model} is enabled by default.
4312
4313 @item -Wmaybe-uninitialized
4314 @opindex Wmaybe-uninitialized
4315 @opindex Wno-maybe-uninitialized
4316 For an automatic variable, if there exists a path from the function
4317 entry to a use of the variable that is initialized, but there exist
4318 some other paths for which the variable is not initialized, the compiler
4319 emits a warning if it cannot prove the uninitialized paths are not
4320 executed at run time. These warnings are made optional because GCC is
4321 not smart enough to see all the reasons why the code might be correct
4322 in spite of appearing to have an error. Here is one example of how
4323 this can happen:
4324
4325 @smallexample
4326 @group
4327 @{
4328 int x;
4329 switch (y)
4330 @{
4331 case 1: x = 1;
4332 break;
4333 case 2: x = 4;
4334 break;
4335 case 3: x = 5;
4336 @}
4337 foo (x);
4338 @}
4339 @end group
4340 @end smallexample
4341
4342 @noindent
4343 If the value of @code{y} is always 1, 2 or 3, then @code{x} is
4344 always initialized, but GCC doesn't know this. To suppress the
4345 warning, you need to provide a default case with assert(0) or
4346 similar code.
4347
4348 @cindex @code{longjmp} warnings
4349 This option also warns when a non-volatile automatic variable might be
4350 changed by a call to @code{longjmp}. These warnings as well are possible
4351 only in optimizing compilation.
4352
4353 The compiler sees only the calls to @code{setjmp}. It cannot know
4354 where @code{longjmp} will be called; in fact, a signal handler could
4355 call it at any point in the code. As a result, you may get a warning
4356 even when there is in fact no problem because @code{longjmp} cannot
4357 in fact be called at the place that would cause a problem.
4358
4359 Some spurious warnings can be avoided if you declare all the functions
4360 you use that never return as @code{noreturn}. @xref{Function
4361 Attributes}.
4362
4363 This warning is enabled by @option{-Wall} or @option{-Wextra}.
4364
4365 @item -Wunknown-pragmas
4366 @opindex Wunknown-pragmas
4367 @opindex Wno-unknown-pragmas
4368 @cindex warning for unknown pragmas
4369 @cindex unknown pragmas, warning
4370 @cindex pragmas, warning of unknown
4371 Warn when a @code{#pragma} directive is encountered that is not understood by
4372 GCC@. If this command-line option is used, warnings are even issued
4373 for unknown pragmas in system header files. This is not the case if
4374 the warnings are only enabled by the @option{-Wall} command-line option.
4375
4376 @item -Wno-pragmas
4377 @opindex Wno-pragmas
4378 @opindex Wpragmas
4379 Do not warn about misuses of pragmas, such as incorrect parameters,
4380 invalid syntax, or conflicts between pragmas. See also
4381 @option{-Wunknown-pragmas}.
4382
4383 @item -Wstrict-aliasing
4384 @opindex Wstrict-aliasing
4385 @opindex Wno-strict-aliasing
4386 This option is only active when @option{-fstrict-aliasing} is active.
4387 It warns about code that might break the strict aliasing rules that the
4388 compiler is using for optimization. The warning does not catch all
4389 cases, but does attempt to catch the more common pitfalls. It is
4390 included in @option{-Wall}.
4391 It is equivalent to @option{-Wstrict-aliasing=3}
4392
4393 @item -Wstrict-aliasing=n
4394 @opindex Wstrict-aliasing=n
4395 This option is only active when @option{-fstrict-aliasing} is active.
4396 It warns about code that might break the strict aliasing rules that the
4397 compiler is using for optimization.
4398 Higher levels correspond to higher accuracy (fewer false positives).
4399 Higher levels also correspond to more effort, similar to the way @option{-O}
4400 works.
4401 @option{-Wstrict-aliasing} is equivalent to @option{-Wstrict-aliasing=3}.
4402
4403 Level 1: Most aggressive, quick, least accurate.
4404 Possibly useful when higher levels
4405 do not warn but @option{-fstrict-aliasing} still breaks the code, as it has very few
4406 false negatives. However, it has many false positives.
4407 Warns for all pointer conversions between possibly incompatible types,
4408 even if never dereferenced. Runs in the front end only.
4409
4410 Level 2: Aggressive, quick, not too precise.
4411 May still have many false positives (not as many as level 1 though),
4412 and few false negatives (but possibly more than level 1).
4413 Unlike level 1, it only warns when an address is taken. Warns about
4414 incomplete types. Runs in the front end only.
4415
4416 Level 3 (default for @option{-Wstrict-aliasing}):
4417 Should have very few false positives and few false
4418 negatives. Slightly slower than levels 1 or 2 when optimization is enabled.
4419 Takes care of the common pun+dereference pattern in the front end:
4420 @code{*(int*)&some_float}.
4421 If optimization is enabled, it also runs in the back end, where it deals
4422 with multiple statement cases using flow-sensitive points-to information.
4423 Only warns when the converted pointer is dereferenced.
4424 Does not warn about incomplete types.
4425
4426 @item -Wstrict-overflow
4427 @itemx -Wstrict-overflow=@var{n}
4428 @opindex Wstrict-overflow
4429 @opindex Wno-strict-overflow
4430 This option is only active when @option{-fstrict-overflow} is active.
4431 It warns about cases where the compiler optimizes based on the
4432 assumption that signed overflow does not occur. Note that it does not
4433 warn about all cases where the code might overflow: it only warns
4434 about cases where the compiler implements some optimization. Thus
4435 this warning depends on the optimization level.
4436
4437 An optimization that assumes that signed overflow does not occur is
4438 perfectly safe if the values of the variables involved are such that
4439 overflow never does, in fact, occur. Therefore this warning can
4440 easily give a false positive: a warning about code that is not
4441 actually a problem. To help focus on important issues, several
4442 warning levels are defined. No warnings are issued for the use of
4443 undefined signed overflow when estimating how many iterations a loop
4444 requires, in particular when determining whether a loop will be
4445 executed at all.
4446
4447 @table @gcctabopt
4448 @item -Wstrict-overflow=1
4449 Warn about cases that are both questionable and easy to avoid. For
4450 example, with @option{-fstrict-overflow}, the compiler simplifies
4451 @code{x + 1 > x} to @code{1}. This level of
4452 @option{-Wstrict-overflow} is enabled by @option{-Wall}; higher levels
4453 are not, and must be explicitly requested.
4454
4455 @item -Wstrict-overflow=2
4456 Also warn about other cases where a comparison is simplified to a
4457 constant. For example: @code{abs (x) >= 0}. This can only be
4458 simplified when @option{-fstrict-overflow} is in effect, because
4459 @code{abs (INT_MIN)} overflows to @code{INT_MIN}, which is less than
4460 zero. @option{-Wstrict-overflow} (with no level) is the same as
4461 @option{-Wstrict-overflow=2}.
4462
4463 @item -Wstrict-overflow=3
4464 Also warn about other cases where a comparison is simplified. For
4465 example: @code{x + 1 > 1} is simplified to @code{x > 0}.
4466
4467 @item -Wstrict-overflow=4
4468 Also warn about other simplifications not covered by the above cases.
4469 For example: @code{(x * 10) / 5} is simplified to @code{x * 2}.
4470
4471 @item -Wstrict-overflow=5
4472 Also warn about cases where the compiler reduces the magnitude of a
4473 constant involved in a comparison. For example: @code{x + 2 > y} is
4474 simplified to @code{x + 1 >= y}. This is reported only at the
4475 highest warning level because this simplification applies to many
4476 comparisons, so this warning level gives a very large number of
4477 false positives.
4478 @end table
4479
4480 @item -Wsuggest-attribute=@r{[}pure@r{|}const@r{|}noreturn@r{|}format@r{]}
4481 @opindex Wsuggest-attribute=
4482 @opindex Wno-suggest-attribute=
4483 Warn for cases where adding an attribute may be beneficial. The
4484 attributes currently supported are listed below.
4485
4486 @table @gcctabopt
4487 @item -Wsuggest-attribute=pure
4488 @itemx -Wsuggest-attribute=const
4489 @itemx -Wsuggest-attribute=noreturn
4490 @opindex Wsuggest-attribute=pure
4491 @opindex Wno-suggest-attribute=pure
4492 @opindex Wsuggest-attribute=const
4493 @opindex Wno-suggest-attribute=const
4494 @opindex Wsuggest-attribute=noreturn
4495 @opindex Wno-suggest-attribute=noreturn
4496
4497 Warn about functions that might be candidates for attributes
4498 @code{pure}, @code{const} or @code{noreturn}. The compiler only warns for
4499 functions visible in other compilation units or (in the case of @code{pure} and
4500 @code{const}) if it cannot prove that the function returns normally. A function
4501 returns normally if it doesn't contain an infinite loop or return abnormally
4502 by throwing, calling @code{abort} or trapping. This analysis requires option
4503 @option{-fipa-pure-const}, which is enabled by default at @option{-O} and
4504 higher. Higher optimization levels improve the accuracy of the analysis.
4505
4506 @item -Wsuggest-attribute=format
4507 @itemx -Wmissing-format-attribute
4508 @opindex Wsuggest-attribute=format
4509 @opindex Wmissing-format-attribute
4510 @opindex Wno-suggest-attribute=format
4511 @opindex Wno-missing-format-attribute
4512 @opindex Wformat
4513 @opindex Wno-format
4514
4515 Warn about function pointers that might be candidates for @code{format}
4516 attributes. Note these are only possible candidates, not absolute ones.
4517 GCC guesses that function pointers with @code{format} attributes that
4518 are used in assignment, initialization, parameter passing or return
4519 statements should have a corresponding @code{format} attribute in the
4520 resulting type. I.e.@: the left-hand side of the assignment or
4521 initialization, the type of the parameter variable, or the return type
4522 of the containing function respectively should also have a @code{format}
4523 attribute to avoid the warning.
4524
4525 GCC also warns about function definitions that might be
4526 candidates for @code{format} attributes. Again, these are only
4527 possible candidates. GCC guesses that @code{format} attributes
4528 might be appropriate for any function that calls a function like
4529 @code{vprintf} or @code{vscanf}, but this might not always be the
4530 case, and some functions for which @code{format} attributes are
4531 appropriate may not be detected.
4532 @end table
4533
4534 @item -Wsuggest-final-types
4535 @opindex Wno-suggest-final-types
4536 @opindex Wsuggest-final-types
4537 Warn about types with virtual methods where code quality would be improved
4538 if the type were declared with the C++11 @code{final} specifier,
4539 or, if possible,
4540 declared in an anonymous namespace. This allows GCC to more aggressively
4541 devirtualize the polymorphic calls. This warning is more effective with link
4542 time optimization, where the information about the class hierarchy graph is
4543 more complete.
4544
4545 @item -Wsuggest-final-methods
4546 @opindex Wno-suggest-final-methods
4547 @opindex Wsuggest-final-methods
4548 Warn about virtual methods where code quality would be improved if the method
4549 were declared with the C++11 @code{final} specifier,
4550 or, if possible, its type were
4551 declared in an anonymous namespace or with the @code{final} specifier.
4552 This warning is
4553 more effective with link time optimization, where the information about the
4554 class hierarchy graph is more complete. It is recommended to first consider
4555 suggestions of @option{-Wsuggest-final-types} and then rebuild with new
4556 annotations.
4557
4558 @item -Wsuggest-override
4559 Warn about overriding virtual functions that are not marked with the override
4560 keyword.
4561
4562 @item -Warray-bounds
4563 @itemx -Warray-bounds=@var{n}
4564 @opindex Wno-array-bounds
4565 @opindex Warray-bounds
4566 This option is only active when @option{-ftree-vrp} is active
4567 (default for @option{-O2} and above). It warns about subscripts to arrays
4568 that are always out of bounds. This warning is enabled by @option{-Wall}.
4569
4570 @table @gcctabopt
4571 @item -Warray-bounds=1
4572 This is the warning level of @option{-Warray-bounds} and is enabled
4573 by @option{-Wall}; higher levels are not, and must be explicitly requested.
4574
4575 @item -Warray-bounds=2
4576 This warning level also warns about out of bounds access for
4577 arrays at the end of a struct and for arrays accessed through
4578 pointers. This warning level may give a larger number of
4579 false positives and is deactivated by default.
4580 @end table
4581
4582 @item -Wbool-compare
4583 @opindex Wno-bool-compare
4584 @opindex Wbool-compare
4585 Warn about boolean expression compared with an integer value different from
4586 @code{true}/@code{false}. For instance, the following comparison is
4587 always false:
4588 @smallexample
4589 int n = 5;
4590 @dots{}
4591 if ((n > 1) == 2) @{ @dots{} @}
4592 @end smallexample
4593 This warning is enabled by @option{-Wall}.
4594
4595 @item -Wduplicated-cond
4596 @opindex Wno-duplicated-cond
4597 @opindex Wduplicated-cond
4598 Warn about duplicated conditions in an if-else-if chain. For instance,
4599 warn for the following code:
4600 @smallexample
4601 if (p->q != NULL) @{ @dots{} @}
4602 else if (p->q != NULL) @{ @dots{} @}
4603 @end smallexample
4604
4605 @item -Wframe-address
4606 @opindex Wno-frame-address
4607 @opindex Wframe-address
4608 Warn when the @samp{__builtin_frame_address} or @samp{__builtin_return_address}
4609 is called with an argument greater than 0. Such calls may return indeterminate
4610 values or crash the program. The warning is included in @option{-Wall}.
4611
4612 @item -Wno-discarded-qualifiers @r{(C and Objective-C only)}
4613 @opindex Wno-discarded-qualifiers
4614 @opindex Wdiscarded-qualifiers
4615 Do not warn if type qualifiers on pointers are being discarded.
4616 Typically, the compiler warns if a @code{const char *} variable is
4617 passed to a function that takes a @code{char *} parameter. This option
4618 can be used to suppress such a warning.
4619
4620 @item -Wno-discarded-array-qualifiers @r{(C and Objective-C only)}
4621 @opindex Wno-discarded-array-qualifiers
4622 @opindex Wdiscarded-array-qualifiers
4623 Do not warn if type qualifiers on arrays which are pointer targets
4624 are being discarded. Typically, the compiler warns if a
4625 @code{const int (*)[]} variable is passed to a function that
4626 takes a @code{int (*)[]} parameter. This option can be used to
4627 suppress such a warning.
4628
4629 @item -Wno-incompatible-pointer-types @r{(C and Objective-C only)}
4630 @opindex Wno-incompatible-pointer-types
4631 @opindex Wincompatible-pointer-types
4632 Do not warn when there is a conversion between pointers that have incompatible
4633 types. This warning is for cases not covered by @option{-Wno-pointer-sign},
4634 which warns for pointer argument passing or assignment with different
4635 signedness.
4636
4637 @item -Wno-int-conversion @r{(C and Objective-C only)}
4638 @opindex Wno-int-conversion
4639 @opindex Wint-conversion
4640 Do not warn about incompatible integer to pointer and pointer to integer
4641 conversions. This warning is about implicit conversions; for explicit
4642 conversions the warnings @option{-Wno-int-to-pointer-cast} and
4643 @option{-Wno-pointer-to-int-cast} may be used.
4644
4645 @item -Wno-div-by-zero
4646 @opindex Wno-div-by-zero
4647 @opindex Wdiv-by-zero
4648 Do not warn about compile-time integer division by zero. Floating-point
4649 division by zero is not warned about, as it can be a legitimate way of
4650 obtaining infinities and NaNs.
4651
4652 @item -Wsystem-headers
4653 @opindex Wsystem-headers
4654 @opindex Wno-system-headers
4655 @cindex warnings from system headers
4656 @cindex system headers, warnings from
4657 Print warning messages for constructs found in system header files.
4658 Warnings from system headers are normally suppressed, on the assumption
4659 that they usually do not indicate real problems and would only make the
4660 compiler output harder to read. Using this command-line option tells
4661 GCC to emit warnings from system headers as if they occurred in user
4662 code. However, note that using @option{-Wall} in conjunction with this
4663 option does @emph{not} warn about unknown pragmas in system
4664 headers---for that, @option{-Wunknown-pragmas} must also be used.
4665
4666 @item -Wtautological-compare
4667 @opindex Wtautological-compare
4668 @opindex Wno-tautological-compare
4669 Warn if a self-comparison always evaluates to true or false. This
4670 warning detects various mistakes such as:
4671 @smallexample
4672 int i = 1;
4673 @dots{}
4674 if (i > i) @{ @dots{} @}
4675 @end smallexample
4676 This warning is enabled by @option{-Wall}.
4677
4678 @item -Wtrampolines
4679 @opindex Wtrampolines
4680 @opindex Wno-trampolines
4681 Warn about trampolines generated for pointers to nested functions.
4682 A trampoline is a small piece of data or code that is created at run
4683 time on the stack when the address of a nested function is taken, and is
4684 used to call the nested function indirectly. For some targets, it is
4685 made up of data only and thus requires no special treatment. But, for
4686 most targets, it is made up of code and thus requires the stack to be
4687 made executable in order for the program to work properly.
4688
4689 @item -Wfloat-equal
4690 @opindex Wfloat-equal
4691 @opindex Wno-float-equal
4692 Warn if floating-point values are used in equality comparisons.
4693
4694 The idea behind this is that sometimes it is convenient (for the
4695 programmer) to consider floating-point values as approximations to
4696 infinitely precise real numbers. If you are doing this, then you need
4697 to compute (by analyzing the code, or in some other way) the maximum or
4698 likely maximum error that the computation introduces, and allow for it
4699 when performing comparisons (and when producing output, but that's a
4700 different problem). In particular, instead of testing for equality, you
4701 should check to see whether the two values have ranges that overlap; and
4702 this is done with the relational operators, so equality comparisons are
4703 probably mistaken.
4704
4705 @item -Wtraditional @r{(C and Objective-C only)}
4706 @opindex Wtraditional
4707 @opindex Wno-traditional
4708 Warn about certain constructs that behave differently in traditional and
4709 ISO C@. Also warn about ISO C constructs that have no traditional C
4710 equivalent, and/or problematic constructs that should be avoided.
4711
4712 @itemize @bullet
4713 @item
4714 Macro parameters that appear within string literals in the macro body.
4715 In traditional C macro replacement takes place within string literals,
4716 but in ISO C it does not.
4717
4718 @item
4719 In traditional C, some preprocessor directives did not exist.
4720 Traditional preprocessors only considered a line to be a directive
4721 if the @samp{#} appeared in column 1 on the line. Therefore
4722 @option{-Wtraditional} warns about directives that traditional C
4723 understands but ignores because the @samp{#} does not appear as the
4724 first character on the line. It also suggests you hide directives like
4725 @code{#pragma} not understood by traditional C by indenting them. Some
4726 traditional implementations do not recognize @code{#elif}, so this option
4727 suggests avoiding it altogether.
4728
4729 @item
4730 A function-like macro that appears without arguments.
4731
4732 @item
4733 The unary plus operator.
4734
4735 @item
4736 The @samp{U} integer constant suffix, or the @samp{F} or @samp{L} floating-point
4737 constant suffixes. (Traditional C does support the @samp{L} suffix on integer
4738 constants.) Note, these suffixes appear in macros defined in the system
4739 headers of most modern systems, e.g.@: the @samp{_MIN}/@samp{_MAX} macros in @code{<limits.h>}.
4740 Use of these macros in user code might normally lead to spurious
4741 warnings, however GCC's integrated preprocessor has enough context to
4742 avoid warning in these cases.
4743
4744 @item
4745 A function declared external in one block and then used after the end of
4746 the block.
4747
4748 @item
4749 A @code{switch} statement has an operand of type @code{long}.
4750
4751 @item
4752 A non-@code{static} function declaration follows a @code{static} one.
4753 This construct is not accepted by some traditional C compilers.
4754
4755 @item
4756 The ISO type of an integer constant has a different width or
4757 signedness from its traditional type. This warning is only issued if
4758 the base of the constant is ten. I.e.@: hexadecimal or octal values, which
4759 typically represent bit patterns, are not warned about.
4760
4761 @item
4762 Usage of ISO string concatenation is detected.
4763
4764 @item
4765 Initialization of automatic aggregates.
4766
4767 @item
4768 Identifier conflicts with labels. Traditional C lacks a separate
4769 namespace for labels.
4770
4771 @item
4772 Initialization of unions. If the initializer is zero, the warning is
4773 omitted. This is done under the assumption that the zero initializer in
4774 user code appears conditioned on e.g.@: @code{__STDC__} to avoid missing
4775 initializer warnings and relies on default initialization to zero in the
4776 traditional C case.
4777
4778 @item
4779 Conversions by prototypes between fixed/floating-point values and vice
4780 versa. The absence of these prototypes when compiling with traditional
4781 C causes serious problems. This is a subset of the possible
4782 conversion warnings; for the full set use @option{-Wtraditional-conversion}.
4783
4784 @item
4785 Use of ISO C style function definitions. This warning intentionally is
4786 @emph{not} issued for prototype declarations or variadic functions
4787 because these ISO C features appear in your code when using
4788 libiberty's traditional C compatibility macros, @code{PARAMS} and
4789 @code{VPARAMS}. This warning is also bypassed for nested functions
4790 because that feature is already a GCC extension and thus not relevant to
4791 traditional C compatibility.
4792 @end itemize
4793
4794 @item -Wtraditional-conversion @r{(C and Objective-C only)}
4795 @opindex Wtraditional-conversion
4796 @opindex Wno-traditional-conversion
4797 Warn if a prototype causes a type conversion that is different from what
4798 would happen to the same argument in the absence of a prototype. This
4799 includes conversions of fixed point to floating and vice versa, and
4800 conversions changing the width or signedness of a fixed-point argument
4801 except when the same as the default promotion.
4802
4803 @item -Wdeclaration-after-statement @r{(C and Objective-C only)}
4804 @opindex Wdeclaration-after-statement
4805 @opindex Wno-declaration-after-statement
4806 Warn when a declaration is found after a statement in a block. This
4807 construct, known from C++, was introduced with ISO C99 and is by default
4808 allowed in GCC@. It is not supported by ISO C90. @xref{Mixed Declarations}.
4809
4810 @item -Wundef
4811 @opindex Wundef
4812 @opindex Wno-undef
4813 Warn if an undefined identifier is evaluated in an @code{#if} directive.
4814
4815 @item -Wno-endif-labels
4816 @opindex Wno-endif-labels
4817 @opindex Wendif-labels
4818 Do not warn whenever an @code{#else} or an @code{#endif} are followed by text.
4819
4820 @item -Wshadow
4821 @opindex Wshadow
4822 @opindex Wno-shadow
4823 Warn whenever a local variable or type declaration shadows another
4824 variable, parameter, type, class member (in C++), or instance variable
4825 (in Objective-C) or whenever a built-in function is shadowed. Note
4826 that in C++, the compiler warns if a local variable shadows an
4827 explicit typedef, but not if it shadows a struct/class/enum.
4828
4829 @item -Wno-shadow-ivar @r{(Objective-C only)}
4830 @opindex Wno-shadow-ivar
4831 @opindex Wshadow-ivar
4832 Do not warn whenever a local variable shadows an instance variable in an
4833 Objective-C method.
4834
4835 @item -Wlarger-than=@var{len}
4836 @opindex Wlarger-than=@var{len}
4837 @opindex Wlarger-than-@var{len}
4838 Warn whenever an object of larger than @var{len} bytes is defined.
4839
4840 @item -Wframe-larger-than=@var{len}
4841 @opindex Wframe-larger-than
4842 Warn if the size of a function frame is larger than @var{len} bytes.
4843 The computation done to determine the stack frame size is approximate
4844 and not conservative.
4845 The actual requirements may be somewhat greater than @var{len}
4846 even if you do not get a warning. In addition, any space allocated
4847 via @code{alloca}, variable-length arrays, or related constructs
4848 is not included by the compiler when determining
4849 whether or not to issue a warning.
4850
4851 @item -Wno-free-nonheap-object
4852 @opindex Wno-free-nonheap-object
4853 @opindex Wfree-nonheap-object
4854 Do not warn when attempting to free an object that was not allocated
4855 on the heap.
4856
4857 @item -Wstack-usage=@var{len}
4858 @opindex Wstack-usage
4859 Warn if the stack usage of a function might be larger than @var{len} bytes.
4860 The computation done to determine the stack usage is conservative.
4861 Any space allocated via @code{alloca}, variable-length arrays, or related
4862 constructs is included by the compiler when determining whether or not to
4863 issue a warning.
4864
4865 The message is in keeping with the output of @option{-fstack-usage}.
4866
4867 @itemize
4868 @item
4869 If the stack usage is fully static but exceeds the specified amount, it's:
4870
4871 @smallexample
4872 warning: stack usage is 1120 bytes
4873 @end smallexample
4874 @item
4875 If the stack usage is (partly) dynamic but bounded, it's:
4876
4877 @smallexample
4878 warning: stack usage might be 1648 bytes
4879 @end smallexample
4880 @item
4881 If the stack usage is (partly) dynamic and not bounded, it's:
4882
4883 @smallexample
4884 warning: stack usage might be unbounded
4885 @end smallexample
4886 @end itemize
4887
4888 @item -Wunsafe-loop-optimizations
4889 @opindex Wunsafe-loop-optimizations
4890 @opindex Wno-unsafe-loop-optimizations
4891 Warn if the loop cannot be optimized because the compiler cannot
4892 assume anything on the bounds of the loop indices. With
4893 @option{-funsafe-loop-optimizations} warn if the compiler makes
4894 such assumptions.
4895
4896 @item -Wno-pedantic-ms-format @r{(MinGW targets only)}
4897 @opindex Wno-pedantic-ms-format
4898 @opindex Wpedantic-ms-format
4899 When used in combination with @option{-Wformat}
4900 and @option{-pedantic} without GNU extensions, this option
4901 disables the warnings about non-ISO @code{printf} / @code{scanf} format
4902 width specifiers @code{I32}, @code{I64}, and @code{I} used on Windows targets,
4903 which depend on the MS runtime.
4904
4905 @item -Wplacement-new
4906 @itemx -Wplacement-new=@var{n}
4907 @opindex Wplacement-new
4908 @opindex Wno-placement-new
4909 Warn about placement new expressions with undefined behavior, such as
4910 constructing an object in a buffer that is smaller than the type of
4911 the object. For example, the placement new expression below is diagnosed
4912 because it attempts to construct an array of 64 integers in a buffer only
4913 64 bytes large.
4914 @smallexample
4915 char buf [64];
4916 new (buf) int[64];
4917 @end smallexample
4918 This warning is enabled by default.
4919
4920 @table @gcctabopt
4921 @item -Wplacement-new=1
4922 This is the default warning level of @option{-Wplacement-new}. At this
4923 level the warning is not issued for some strictly undefined constructs that
4924 GCC allows as extensions for compatibility with legacy code. For example,
4925 the following @code{new} expression is not diagnosed at this level even
4926 though it has undefined behavior according to the C++ standard because
4927 it writes past the end of the one-element array.
4928 @smallexample
4929 struct S @{ int n, a[1]; @};
4930 S *s = (S *)malloc (sizeof *s + 31 * sizeof s->a[0]);
4931 new (s->a)int [32]();
4932 @end smallexample
4933
4934 @item -Wplacement-new=2
4935 At this level, in addition to diagnosing all the same constructs as at level
4936 1, a diagnostic is also issued for placement new expressions that construct
4937 an object in the last member of structure whose type is an array of a single
4938 element and whose size is less than the size of the object being constructed.
4939 While the previous example would be diagnosed, the following construct makes
4940 use of the flexible member array extension to avoid the warning at level 2.
4941 @smallexample
4942 struct S @{ int n, a[]; @};
4943 S *s = (S *)malloc (sizeof *s + 32 * sizeof s->a[0]);
4944 new (s->a)int [32]();
4945 @end smallexample
4946
4947 @end table
4948
4949 @item -Wpointer-arith
4950 @opindex Wpointer-arith
4951 @opindex Wno-pointer-arith
4952 Warn about anything that depends on the ``size of'' a function type or
4953 of @code{void}. GNU C assigns these types a size of 1, for
4954 convenience in calculations with @code{void *} pointers and pointers
4955 to functions. In C++, warn also when an arithmetic operation involves
4956 @code{NULL}. This warning is also enabled by @option{-Wpedantic}.
4957
4958 @item -Wtype-limits
4959 @opindex Wtype-limits
4960 @opindex Wno-type-limits
4961 Warn if a comparison is always true or always false due to the limited
4962 range of the data type, but do not warn for constant expressions. For
4963 example, warn if an unsigned variable is compared against zero with
4964 @code{<} or @code{>=}. This warning is also enabled by
4965 @option{-Wextra}.
4966
4967 @item -Wbad-function-cast @r{(C and Objective-C only)}
4968 @opindex Wbad-function-cast
4969 @opindex Wno-bad-function-cast
4970 Warn when a function call is cast to a non-matching type.
4971 For example, warn if a call to a function returning an integer type
4972 is cast to a pointer type.
4973
4974 @item -Wc90-c99-compat @r{(C and Objective-C only)}
4975 @opindex Wc90-c99-compat
4976 @opindex Wno-c90-c99-compat
4977 Warn about features not present in ISO C90, but present in ISO C99.
4978 For instance, warn about use of variable length arrays, @code{long long}
4979 type, @code{bool} type, compound literals, designated initializers, and so
4980 on. This option is independent of the standards mode. Warnings are disabled
4981 in the expression that follows @code{__extension__}.
4982
4983 @item -Wc99-c11-compat @r{(C and Objective-C only)}
4984 @opindex Wc99-c11-compat
4985 @opindex Wno-c99-c11-compat
4986 Warn about features not present in ISO C99, but present in ISO C11.
4987 For instance, warn about use of anonymous structures and unions,
4988 @code{_Atomic} type qualifier, @code{_Thread_local} storage-class specifier,
4989 @code{_Alignas} specifier, @code{Alignof} operator, @code{_Generic} keyword,
4990 and so on. This option is independent of the standards mode. Warnings are
4991 disabled in the expression that follows @code{__extension__}.
4992
4993 @item -Wc++-compat @r{(C and Objective-C only)}
4994 @opindex Wc++-compat
4995 Warn about ISO C constructs that are outside of the common subset of
4996 ISO C and ISO C++, e.g.@: request for implicit conversion from
4997 @code{void *} to a pointer to non-@code{void} type.
4998
4999 @item -Wc++11-compat @r{(C++ and Objective-C++ only)}
5000 @opindex Wc++11-compat
5001 Warn about C++ constructs whose meaning differs between ISO C++ 1998
5002 and ISO C++ 2011, e.g., identifiers in ISO C++ 1998 that are keywords
5003 in ISO C++ 2011. This warning turns on @option{-Wnarrowing} and is
5004 enabled by @option{-Wall}.
5005
5006 @item -Wc++14-compat @r{(C++ and Objective-C++ only)}
5007 @opindex Wc++14-compat
5008 Warn about C++ constructs whose meaning differs between ISO C++ 2011
5009 and ISO C++ 2014. This warning is enabled by @option{-Wall}.
5010
5011 @item -Wcast-qual
5012 @opindex Wcast-qual
5013 @opindex Wno-cast-qual
5014 Warn whenever a pointer is cast so as to remove a type qualifier from
5015 the target type. For example, warn if a @code{const char *} is cast
5016 to an ordinary @code{char *}.
5017
5018 Also warn when making a cast that introduces a type qualifier in an
5019 unsafe way. For example, casting @code{char **} to @code{const char **}
5020 is unsafe, as in this example:
5021
5022 @smallexample
5023 /* p is char ** value. */
5024 const char **q = (const char **) p;
5025 /* Assignment of readonly string to const char * is OK. */
5026 *q = "string";
5027 /* Now char** pointer points to read-only memory. */
5028 **p = 'b';
5029 @end smallexample
5030
5031 @item -Wcast-align
5032 @opindex Wcast-align
5033 @opindex Wno-cast-align
5034 Warn whenever a pointer is cast such that the required alignment of the
5035 target is increased. For example, warn if a @code{char *} is cast to
5036 an @code{int *} on machines where integers can only be accessed at
5037 two- or four-byte boundaries.
5038
5039 @item -Wwrite-strings
5040 @opindex Wwrite-strings
5041 @opindex Wno-write-strings
5042 When compiling C, give string constants the type @code{const
5043 char[@var{length}]} so that copying the address of one into a
5044 non-@code{const} @code{char *} pointer produces a warning. These
5045 warnings help you find at compile time code that can try to write
5046 into a string constant, but only if you have been very careful about
5047 using @code{const} in declarations and prototypes. Otherwise, it is
5048 just a nuisance. This is why we did not make @option{-Wall} request
5049 these warnings.
5050
5051 When compiling C++, warn about the deprecated conversion from string
5052 literals to @code{char *}. This warning is enabled by default for C++
5053 programs.
5054
5055 @item -Wclobbered
5056 @opindex Wclobbered
5057 @opindex Wno-clobbered
5058 Warn for variables that might be changed by @code{longjmp} or
5059 @code{vfork}. This warning is also enabled by @option{-Wextra}.
5060
5061 @item -Wconditionally-supported @r{(C++ and Objective-C++ only)}
5062 @opindex Wconditionally-supported
5063 @opindex Wno-conditionally-supported
5064 Warn for conditionally-supported (C++11 [intro.defs]) constructs.
5065
5066 @item -Wconversion
5067 @opindex Wconversion
5068 @opindex Wno-conversion
5069 Warn for implicit conversions that may alter a value. This includes
5070 conversions between real and integer, like @code{abs (x)} when
5071 @code{x} is @code{double}; conversions between signed and unsigned,
5072 like @code{unsigned ui = -1}; and conversions to smaller types, like
5073 @code{sqrtf (M_PI)}. Do not warn for explicit casts like @code{abs
5074 ((int) x)} and @code{ui = (unsigned) -1}, or if the value is not
5075 changed by the conversion like in @code{abs (2.0)}. Warnings about
5076 conversions between signed and unsigned integers can be disabled by
5077 using @option{-Wno-sign-conversion}.
5078
5079 For C++, also warn for confusing overload resolution for user-defined
5080 conversions; and conversions that never use a type conversion
5081 operator: conversions to @code{void}, the same type, a base class or a
5082 reference to them. Warnings about conversions between signed and
5083 unsigned integers are disabled by default in C++ unless
5084 @option{-Wsign-conversion} is explicitly enabled.
5085
5086 @item -Wno-conversion-null @r{(C++ and Objective-C++ only)}
5087 @opindex Wconversion-null
5088 @opindex Wno-conversion-null
5089 Do not warn for conversions between @code{NULL} and non-pointer
5090 types. @option{-Wconversion-null} is enabled by default.
5091
5092 @item -Wzero-as-null-pointer-constant @r{(C++ and Objective-C++ only)}
5093 @opindex Wzero-as-null-pointer-constant
5094 @opindex Wno-zero-as-null-pointer-constant
5095 Warn when a literal @samp{0} is used as null pointer constant. This can
5096 be useful to facilitate the conversion to @code{nullptr} in C++11.
5097
5098 @item -Wsubobject-linkage @r{(C++ and Objective-C++ only)}
5099 @opindex Wsubobject-linkage
5100 @opindex Wno-subobject-linkage
5101 Warn if a class type has a base or a field whose type uses the anonymous
5102 namespace or depends on a type with no linkage. If a type A depends on
5103 a type B with no or internal linkage, defining it in multiple
5104 translation units would be an ODR violation because the meaning of B
5105 is different in each translation unit. If A only appears in a single
5106 translation unit, the best way to silence the warning is to give it
5107 internal linkage by putting it in an anonymous namespace as well. The
5108 compiler doesn't give this warning for types defined in the main .C
5109 file, as those are unlikely to have multiple definitions.
5110 @option{-Wsubobject-linkage} is enabled by default.
5111
5112 @item -Wdangling-else
5113 @opindex Wdangling-else
5114 @opindex Wno-dangling-else
5115 Warn about constructions where there may be confusion to which
5116 @code{if} statement an @code{else} branch belongs. Here is an example of
5117 such a case:
5118
5119 @smallexample
5120 @group
5121 @{
5122 if (a)
5123 if (b)
5124 foo ();
5125 else
5126 bar ();
5127 @}
5128 @end group
5129 @end smallexample
5130
5131 In C/C++, every @code{else} branch belongs to the innermost possible
5132 @code{if} statement, which in this example is @code{if (b)}. This is
5133 often not what the programmer expected, as illustrated in the above
5134 example by indentation the programmer chose. When there is the
5135 potential for this confusion, GCC issues a warning when this flag
5136 is specified. To eliminate the warning, add explicit braces around
5137 the innermost @code{if} statement so there is no way the @code{else}
5138 can belong to the enclosing @code{if}. The resulting code
5139 looks like this:
5140
5141 @smallexample
5142 @group
5143 @{
5144 if (a)
5145 @{
5146 if (b)
5147 foo ();
5148 else
5149 bar ();
5150 @}
5151 @}
5152 @end group
5153 @end smallexample
5154
5155 This warning is enabled by @option{-Wparentheses}.
5156
5157 @item -Wdate-time
5158 @opindex Wdate-time
5159 @opindex Wno-date-time
5160 Warn when macros @code{__TIME__}, @code{__DATE__} or @code{__TIMESTAMP__}
5161 are encountered as they might prevent bit-wise-identical reproducible
5162 compilations.
5163
5164 @item -Wdelete-incomplete @r{(C++ and Objective-C++ only)}
5165 @opindex Wdelete-incomplete
5166 @opindex Wno-delete-incomplete
5167 Warn when deleting a pointer to incomplete type, which may cause
5168 undefined behavior at runtime. This warning is enabled by default.
5169
5170 @item -Wuseless-cast @r{(C++ and Objective-C++ only)}
5171 @opindex Wuseless-cast
5172 @opindex Wno-useless-cast
5173 Warn when an expression is casted to its own type.
5174
5175 @item -Wempty-body
5176 @opindex Wempty-body
5177 @opindex Wno-empty-body
5178 Warn if an empty body occurs in an @code{if}, @code{else} or @code{do
5179 while} statement. This warning is also enabled by @option{-Wextra}.
5180
5181 @item -Wenum-compare
5182 @opindex Wenum-compare
5183 @opindex Wno-enum-compare
5184 Warn about a comparison between values of different enumerated types.
5185 In C++ enumeral mismatches in conditional expressions are also
5186 diagnosed and the warning is enabled by default. In C this warning is
5187 enabled by @option{-Wall}.
5188
5189 @item -Wjump-misses-init @r{(C, Objective-C only)}
5190 @opindex Wjump-misses-init
5191 @opindex Wno-jump-misses-init
5192 Warn if a @code{goto} statement or a @code{switch} statement jumps
5193 forward across the initialization of a variable, or jumps backward to a
5194 label after the variable has been initialized. This only warns about
5195 variables that are initialized when they are declared. This warning is
5196 only supported for C and Objective-C; in C++ this sort of branch is an
5197 error in any case.
5198
5199 @option{-Wjump-misses-init} is included in @option{-Wc++-compat}. It
5200 can be disabled with the @option{-Wno-jump-misses-init} option.
5201
5202 @item -Wsign-compare
5203 @opindex Wsign-compare
5204 @opindex Wno-sign-compare
5205 @cindex warning for comparison of signed and unsigned values
5206 @cindex comparison of signed and unsigned values, warning
5207 @cindex signed and unsigned values, comparison warning
5208 Warn when a comparison between signed and unsigned values could produce
5209 an incorrect result when the signed value is converted to unsigned.
5210 In C++, this warning is also enabled by @option{-Wall}. In C, it is
5211 also enabled by @option{-Wextra}.
5212
5213 @item -Wsign-conversion
5214 @opindex Wsign-conversion
5215 @opindex Wno-sign-conversion
5216 Warn for implicit conversions that may change the sign of an integer
5217 value, like assigning a signed integer expression to an unsigned
5218 integer variable. An explicit cast silences the warning. In C, this
5219 option is enabled also by @option{-Wconversion}.
5220
5221 @item -Wfloat-conversion
5222 @opindex Wfloat-conversion
5223 @opindex Wno-float-conversion
5224 Warn for implicit conversions that reduce the precision of a real value.
5225 This includes conversions from real to integer, and from higher precision
5226 real to lower precision real values. This option is also enabled by
5227 @option{-Wconversion}.
5228
5229 @item -Wno-scalar-storage-order
5230 @opindex -Wno-scalar-storage-order
5231 @opindex -Wscalar-storage-order
5232 Do not warn on suspicious constructs involving reverse scalar storage order.
5233
5234 @item -Wsized-deallocation @r{(C++ and Objective-C++ only)}
5235 @opindex Wsized-deallocation
5236 @opindex Wno-sized-deallocation
5237 Warn about a definition of an unsized deallocation function
5238 @smallexample
5239 void operator delete (void *) noexcept;
5240 void operator delete[] (void *) noexcept;
5241 @end smallexample
5242 without a definition of the corresponding sized deallocation function
5243 @smallexample
5244 void operator delete (void *, std::size_t) noexcept;
5245 void operator delete[] (void *, std::size_t) noexcept;
5246 @end smallexample
5247 or vice versa. Enabled by @option{-Wextra} along with
5248 @option{-fsized-deallocation}.
5249
5250 @item -Wsizeof-pointer-memaccess
5251 @opindex Wsizeof-pointer-memaccess
5252 @opindex Wno-sizeof-pointer-memaccess
5253 Warn for suspicious length parameters to certain string and memory built-in
5254 functions if the argument uses @code{sizeof}. This warning warns e.g.@:
5255 about @code{memset (ptr, 0, sizeof (ptr));} if @code{ptr} is not an array,
5256 but a pointer, and suggests a possible fix, or about
5257 @code{memcpy (&foo, ptr, sizeof (&foo));}. This warning is enabled by
5258 @option{-Wall}.
5259
5260 @item -Wsizeof-array-argument
5261 @opindex Wsizeof-array-argument
5262 @opindex Wno-sizeof-array-argument
5263 Warn when the @code{sizeof} operator is applied to a parameter that is
5264 declared as an array in a function definition. This warning is enabled by
5265 default for C and C++ programs.
5266
5267 @item -Wmemset-elt-size
5268 @opindex Wmemset-elt-size
5269 @opindex Wno-memset-elt-size
5270 Warn for suspicious calls to the @code{memset} built-in function, if the
5271 first argument references an array, and the third argument is a number
5272 equal to the number of elements, but not equal to the size of the array
5273 in memory. This indicates that the user has omitted a multiplication by
5274 the element size. This warning is enabled by @option{-Wall}.
5275
5276 @item -Wmemset-transposed-args
5277 @opindex Wmemset-transposed-args
5278 @opindex Wno-memset-transposed-args
5279 Warn for suspicious calls to the @code{memset} built-in function, if the
5280 second argument is not zero and the third argument is zero. This warns e.g.@
5281 about @code{memset (buf, sizeof buf, 0)} where most probably
5282 @code{memset (buf, 0, sizeof buf)} was meant instead. The diagnostics
5283 is only emitted if the third argument is literal zero. If it is some
5284 expression that is folded to zero, a cast of zero to some type, etc.,
5285 it is far less likely that the user has mistakenly exchanged the arguments
5286 and no warning is emitted. This warning is enabled by @option{-Wall}.
5287
5288 @item -Waddress
5289 @opindex Waddress
5290 @opindex Wno-address
5291 Warn about suspicious uses of memory addresses. These include using
5292 the address of a function in a conditional expression, such as
5293 @code{void func(void); if (func)}, and comparisons against the memory
5294 address of a string literal, such as @code{if (x == "abc")}. Such
5295 uses typically indicate a programmer error: the address of a function
5296 always evaluates to true, so their use in a conditional usually
5297 indicate that the programmer forgot the parentheses in a function
5298 call; and comparisons against string literals result in unspecified
5299 behavior and are not portable in C, so they usually indicate that the
5300 programmer intended to use @code{strcmp}. This warning is enabled by
5301 @option{-Wall}.
5302
5303 @item -Wlogical-op
5304 @opindex Wlogical-op
5305 @opindex Wno-logical-op
5306 Warn about suspicious uses of logical operators in expressions.
5307 This includes using logical operators in contexts where a
5308 bit-wise operator is likely to be expected. Also warns when
5309 the operands of a logical operator are the same:
5310 @smallexample
5311 extern int a;
5312 if (a < 0 && a < 0) @{ @dots{} @}
5313 @end smallexample
5314
5315 @item -Wlogical-not-parentheses
5316 @opindex Wlogical-not-parentheses
5317 @opindex Wno-logical-not-parentheses
5318 Warn about logical not used on the left hand side operand of a comparison.
5319 This option does not warn if the RHS operand is of a boolean type. Its
5320 purpose is to detect suspicious code like the following:
5321 @smallexample
5322 int a;
5323 @dots{}
5324 if (!a > 1) @{ @dots{} @}
5325 @end smallexample
5326
5327 It is possible to suppress the warning by wrapping the LHS into
5328 parentheses:
5329 @smallexample
5330 if ((!a) > 1) @{ @dots{} @}
5331 @end smallexample
5332
5333 This warning is enabled by @option{-Wall}.
5334
5335 @item -Waggregate-return
5336 @opindex Waggregate-return
5337 @opindex Wno-aggregate-return
5338 Warn if any functions that return structures or unions are defined or
5339 called. (In languages where you can return an array, this also elicits
5340 a warning.)
5341
5342 @item -Wno-aggressive-loop-optimizations
5343 @opindex Wno-aggressive-loop-optimizations
5344 @opindex Waggressive-loop-optimizations
5345 Warn if in a loop with constant number of iterations the compiler detects
5346 undefined behavior in some statement during one or more of the iterations.
5347
5348 @item -Wno-attributes
5349 @opindex Wno-attributes
5350 @opindex Wattributes
5351 Do not warn if an unexpected @code{__attribute__} is used, such as
5352 unrecognized attributes, function attributes applied to variables,
5353 etc. This does not stop errors for incorrect use of supported
5354 attributes.
5355
5356 @item -Wno-builtin-macro-redefined
5357 @opindex Wno-builtin-macro-redefined
5358 @opindex Wbuiltin-macro-redefined
5359 Do not warn if certain built-in macros are redefined. This suppresses
5360 warnings for redefinition of @code{__TIMESTAMP__}, @code{__TIME__},
5361 @code{__DATE__}, @code{__FILE__}, and @code{__BASE_FILE__}.
5362
5363 @item -Wstrict-prototypes @r{(C and Objective-C only)}
5364 @opindex Wstrict-prototypes
5365 @opindex Wno-strict-prototypes
5366 Warn if a function is declared or defined without specifying the
5367 argument types. (An old-style function definition is permitted without
5368 a warning if preceded by a declaration that specifies the argument
5369 types.)
5370
5371 @item -Wold-style-declaration @r{(C and Objective-C only)}
5372 @opindex Wold-style-declaration
5373 @opindex Wno-old-style-declaration
5374 Warn for obsolescent usages, according to the C Standard, in a
5375 declaration. For example, warn if storage-class specifiers like
5376 @code{static} are not the first things in a declaration. This warning
5377 is also enabled by @option{-Wextra}.
5378
5379 @item -Wold-style-definition @r{(C and Objective-C only)}
5380 @opindex Wold-style-definition
5381 @opindex Wno-old-style-definition
5382 Warn if an old-style function definition is used. A warning is given
5383 even if there is a previous prototype.
5384
5385 @item -Wmissing-parameter-type @r{(C and Objective-C only)}
5386 @opindex Wmissing-parameter-type
5387 @opindex Wno-missing-parameter-type
5388 A function parameter is declared without a type specifier in K&R-style
5389 functions:
5390
5391 @smallexample
5392 void foo(bar) @{ @}
5393 @end smallexample
5394
5395 This warning is also enabled by @option{-Wextra}.
5396
5397 @item -Wmissing-prototypes @r{(C and Objective-C only)}
5398 @opindex Wmissing-prototypes
5399 @opindex Wno-missing-prototypes
5400 Warn if a global function is defined without a previous prototype
5401 declaration. This warning is issued even if the definition itself
5402 provides a prototype. Use this option to detect global functions
5403 that do not have a matching prototype declaration in a header file.
5404 This option is not valid for C++ because all function declarations
5405 provide prototypes and a non-matching declaration declares an
5406 overload rather than conflict with an earlier declaration.
5407 Use @option{-Wmissing-declarations} to detect missing declarations in C++.
5408
5409 @item -Wmissing-declarations
5410 @opindex Wmissing-declarations
5411 @opindex Wno-missing-declarations
5412 Warn if a global function is defined without a previous declaration.
5413 Do so even if the definition itself provides a prototype.
5414 Use this option to detect global functions that are not declared in
5415 header files. In C, no warnings are issued for functions with previous
5416 non-prototype declarations; use @option{-Wmissing-prototypes} to detect
5417 missing prototypes. In C++, no warnings are issued for function templates,
5418 or for inline functions, or for functions in anonymous namespaces.
5419
5420 @item -Wmissing-field-initializers
5421 @opindex Wmissing-field-initializers
5422 @opindex Wno-missing-field-initializers
5423 @opindex W
5424 @opindex Wextra
5425 @opindex Wno-extra
5426 Warn if a structure's initializer has some fields missing. For
5427 example, the following code causes such a warning, because
5428 @code{x.h} is implicitly zero:
5429
5430 @smallexample
5431 struct s @{ int f, g, h; @};
5432 struct s x = @{ 3, 4 @};
5433 @end smallexample
5434
5435 This option does not warn about designated initializers, so the following
5436 modification does not trigger a warning:
5437
5438 @smallexample
5439 struct s @{ int f, g, h; @};
5440 struct s x = @{ .f = 3, .g = 4 @};
5441 @end smallexample
5442
5443 In C++ this option does not warn either about the empty @{ @}
5444 initializer, for example:
5445
5446 @smallexample
5447 struct s @{ int f, g, h; @};
5448 s x = @{ @};
5449 @end smallexample
5450
5451 This warning is included in @option{-Wextra}. To get other @option{-Wextra}
5452 warnings without this one, use @option{-Wextra -Wno-missing-field-initializers}.
5453
5454 @item -Wno-multichar
5455 @opindex Wno-multichar
5456 @opindex Wmultichar
5457 Do not warn if a multicharacter constant (@samp{'FOOF'}) is used.
5458 Usually they indicate a typo in the user's code, as they have
5459 implementation-defined values, and should not be used in portable code.
5460
5461 @item -Wnormalized@r{[}=@r{<}none@r{|}id@r{|}nfc@r{|}nfkc@r{>]}
5462 @opindex Wnormalized=
5463 @opindex Wnormalized
5464 @opindex Wno-normalized
5465 @cindex NFC
5466 @cindex NFKC
5467 @cindex character set, input normalization
5468 In ISO C and ISO C++, two identifiers are different if they are
5469 different sequences of characters. However, sometimes when characters
5470 outside the basic ASCII character set are used, you can have two
5471 different character sequences that look the same. To avoid confusion,
5472 the ISO 10646 standard sets out some @dfn{normalization rules} which
5473 when applied ensure that two sequences that look the same are turned into
5474 the same sequence. GCC can warn you if you are using identifiers that
5475 have not been normalized; this option controls that warning.
5476
5477 There are four levels of warning supported by GCC@. The default is
5478 @option{-Wnormalized=nfc}, which warns about any identifier that is
5479 not in the ISO 10646 ``C'' normalized form, @dfn{NFC}. NFC is the
5480 recommended form for most uses. It is equivalent to
5481 @option{-Wnormalized}.
5482
5483 Unfortunately, there are some characters allowed in identifiers by
5484 ISO C and ISO C++ that, when turned into NFC, are not allowed in
5485 identifiers. That is, there's no way to use these symbols in portable
5486 ISO C or C++ and have all your identifiers in NFC@.
5487 @option{-Wnormalized=id} suppresses the warning for these characters.
5488 It is hoped that future versions of the standards involved will correct
5489 this, which is why this option is not the default.
5490
5491 You can switch the warning off for all characters by writing
5492 @option{-Wnormalized=none} or @option{-Wno-normalized}. You should
5493 only do this if you are using some other normalization scheme (like
5494 ``D''), because otherwise you can easily create bugs that are
5495 literally impossible to see.
5496
5497 Some characters in ISO 10646 have distinct meanings but look identical
5498 in some fonts or display methodologies, especially once formatting has
5499 been applied. For instance @code{\u207F}, ``SUPERSCRIPT LATIN SMALL
5500 LETTER N'', displays just like a regular @code{n} that has been
5501 placed in a superscript. ISO 10646 defines the @dfn{NFKC}
5502 normalization scheme to convert all these into a standard form as
5503 well, and GCC warns if your code is not in NFKC if you use
5504 @option{-Wnormalized=nfkc}. This warning is comparable to warning
5505 about every identifier that contains the letter O because it might be
5506 confused with the digit 0, and so is not the default, but may be
5507 useful as a local coding convention if the programming environment
5508 cannot be fixed to display these characters distinctly.
5509
5510 @item -Wno-deprecated
5511 @opindex Wno-deprecated
5512 @opindex Wdeprecated
5513 Do not warn about usage of deprecated features. @xref{Deprecated Features}.
5514
5515 @item -Wno-deprecated-declarations
5516 @opindex Wno-deprecated-declarations
5517 @opindex Wdeprecated-declarations
5518 Do not warn about uses of functions (@pxref{Function Attributes}),
5519 variables (@pxref{Variable Attributes}), and types (@pxref{Type
5520 Attributes}) marked as deprecated by using the @code{deprecated}
5521 attribute.
5522
5523 @item -Wno-overflow
5524 @opindex Wno-overflow
5525 @opindex Woverflow
5526 Do not warn about compile-time overflow in constant expressions.
5527
5528 @item -Wno-odr
5529 @opindex Wno-odr
5530 @opindex Wodr
5531 Warn about One Definition Rule violations during link-time optimization.
5532 Requires @option{-flto-odr-type-merging} to be enabled. Enabled by default.
5533
5534 @item -Wopenmp-simd
5535 @opindex Wopenm-simd
5536 Warn if the vectorizer cost model overrides the OpenMP or the Cilk Plus
5537 simd directive set by user. The @option{-fsimd-cost-model=unlimited}
5538 option can be used to relax the cost model.
5539
5540 @item -Woverride-init @r{(C and Objective-C only)}
5541 @opindex Woverride-init
5542 @opindex Wno-override-init
5543 @opindex W
5544 @opindex Wextra
5545 @opindex Wno-extra
5546 Warn if an initialized field without side effects is overridden when
5547 using designated initializers (@pxref{Designated Inits, , Designated
5548 Initializers}).
5549
5550 This warning is included in @option{-Wextra}. To get other
5551 @option{-Wextra} warnings without this one, use @option{-Wextra
5552 -Wno-override-init}.
5553
5554 @item -Woverride-init-side-effects @r{(C and Objective-C only)}
5555 @opindex Woverride-init-side-effects
5556 @opindex Wno-override-init-side-effects
5557 Warn if an initialized field with side effects is overridden when
5558 using designated initializers (@pxref{Designated Inits, , Designated
5559 Initializers}). This warning is enabled by default.
5560
5561 @item -Wpacked
5562 @opindex Wpacked
5563 @opindex Wno-packed
5564 Warn if a structure is given the packed attribute, but the packed
5565 attribute has no effect on the layout or size of the structure.
5566 Such structures may be mis-aligned for little benefit. For
5567 instance, in this code, the variable @code{f.x} in @code{struct bar}
5568 is misaligned even though @code{struct bar} does not itself
5569 have the packed attribute:
5570
5571 @smallexample
5572 @group
5573 struct foo @{
5574 int x;
5575 char a, b, c, d;
5576 @} __attribute__((packed));
5577 struct bar @{
5578 char z;
5579 struct foo f;
5580 @};
5581 @end group
5582 @end smallexample
5583
5584 @item -Wpacked-bitfield-compat
5585 @opindex Wpacked-bitfield-compat
5586 @opindex Wno-packed-bitfield-compat
5587 The 4.1, 4.2 and 4.3 series of GCC ignore the @code{packed} attribute
5588 on bit-fields of type @code{char}. This has been fixed in GCC 4.4 but
5589 the change can lead to differences in the structure layout. GCC
5590 informs you when the offset of such a field has changed in GCC 4.4.
5591 For example there is no longer a 4-bit padding between field @code{a}
5592 and @code{b} in this structure:
5593
5594 @smallexample
5595 struct foo
5596 @{
5597 char a:4;
5598 char b:8;
5599 @} __attribute__ ((packed));
5600 @end smallexample
5601
5602 This warning is enabled by default. Use
5603 @option{-Wno-packed-bitfield-compat} to disable this warning.
5604
5605 @item -Wpadded
5606 @opindex Wpadded
5607 @opindex Wno-padded
5608 Warn if padding is included in a structure, either to align an element
5609 of the structure or to align the whole structure. Sometimes when this
5610 happens it is possible to rearrange the fields of the structure to
5611 reduce the padding and so make the structure smaller.
5612
5613 @item -Wredundant-decls
5614 @opindex Wredundant-decls
5615 @opindex Wno-redundant-decls
5616 Warn if anything is declared more than once in the same scope, even in
5617 cases where multiple declaration is valid and changes nothing.
5618
5619 @item -Wnested-externs @r{(C and Objective-C only)}
5620 @opindex Wnested-externs
5621 @opindex Wno-nested-externs
5622 Warn if an @code{extern} declaration is encountered within a function.
5623
5624 @item -Wno-inherited-variadic-ctor
5625 @opindex Winherited-variadic-ctor
5626 @opindex Wno-inherited-variadic-ctor
5627 Suppress warnings about use of C++11 inheriting constructors when the
5628 base class inherited from has a C variadic constructor; the warning is
5629 on by default because the ellipsis is not inherited.
5630
5631 @item -Winline
5632 @opindex Winline
5633 @opindex Wno-inline
5634 Warn if a function that is declared as inline cannot be inlined.
5635 Even with this option, the compiler does not warn about failures to
5636 inline functions declared in system headers.
5637
5638 The compiler uses a variety of heuristics to determine whether or not
5639 to inline a function. For example, the compiler takes into account
5640 the size of the function being inlined and the amount of inlining
5641 that has already been done in the current function. Therefore,
5642 seemingly insignificant changes in the source program can cause the
5643 warnings produced by @option{-Winline} to appear or disappear.
5644
5645 @item -Wno-invalid-offsetof @r{(C++ and Objective-C++ only)}
5646 @opindex Wno-invalid-offsetof
5647 @opindex Winvalid-offsetof
5648 Suppress warnings from applying the @code{offsetof} macro to a non-POD
5649 type. According to the 2014 ISO C++ standard, applying @code{offsetof}
5650 to a non-standard-layout type is undefined. In existing C++ implementations,
5651 however, @code{offsetof} typically gives meaningful results.
5652 This flag is for users who are aware that they are
5653 writing nonportable code and who have deliberately chosen to ignore the
5654 warning about it.
5655
5656 The restrictions on @code{offsetof} may be relaxed in a future version
5657 of the C++ standard.
5658
5659 @item -Wno-int-to-pointer-cast
5660 @opindex Wno-int-to-pointer-cast
5661 @opindex Wint-to-pointer-cast
5662 Suppress warnings from casts to pointer type of an integer of a
5663 different size. In C++, casting to a pointer type of smaller size is
5664 an error. @option{Wint-to-pointer-cast} is enabled by default.
5665
5666
5667 @item -Wno-pointer-to-int-cast @r{(C and Objective-C only)}
5668 @opindex Wno-pointer-to-int-cast
5669 @opindex Wpointer-to-int-cast
5670 Suppress warnings from casts from a pointer to an integer type of a
5671 different size.
5672
5673 @item -Winvalid-pch
5674 @opindex Winvalid-pch
5675 @opindex Wno-invalid-pch
5676 Warn if a precompiled header (@pxref{Precompiled Headers}) is found in
5677 the search path but can't be used.
5678
5679 @item -Wlong-long
5680 @opindex Wlong-long
5681 @opindex Wno-long-long
5682 Warn if @code{long long} type is used. This is enabled by either
5683 @option{-Wpedantic} or @option{-Wtraditional} in ISO C90 and C++98
5684 modes. To inhibit the warning messages, use @option{-Wno-long-long}.
5685
5686 @item -Wvariadic-macros
5687 @opindex Wvariadic-macros
5688 @opindex Wno-variadic-macros
5689 Warn if variadic macros are used in ISO C90 mode, or if the GNU
5690 alternate syntax is used in ISO C99 mode. This is enabled by either
5691 @option{-Wpedantic} or @option{-Wtraditional}. To inhibit the warning
5692 messages, use @option{-Wno-variadic-macros}.
5693
5694 @item -Wvarargs
5695 @opindex Wvarargs
5696 @opindex Wno-varargs
5697 Warn upon questionable usage of the macros used to handle variable
5698 arguments like @code{va_start}. This is default. To inhibit the
5699 warning messages, use @option{-Wno-varargs}.
5700
5701 @item -Wvector-operation-performance
5702 @opindex Wvector-operation-performance
5703 @opindex Wno-vector-operation-performance
5704 Warn if vector operation is not implemented via SIMD capabilities of the
5705 architecture. Mainly useful for the performance tuning.
5706 Vector operation can be implemented @code{piecewise}, which means that the
5707 scalar operation is performed on every vector element;
5708 @code{in parallel}, which means that the vector operation is implemented
5709 using scalars of wider type, which normally is more performance efficient;
5710 and @code{as a single scalar}, which means that vector fits into a
5711 scalar type.
5712
5713 @item -Wno-virtual-move-assign
5714 @opindex Wvirtual-move-assign
5715 @opindex Wno-virtual-move-assign
5716 Suppress warnings about inheriting from a virtual base with a
5717 non-trivial C++11 move assignment operator. This is dangerous because
5718 if the virtual base is reachable along more than one path, it is
5719 moved multiple times, which can mean both objects end up in the
5720 moved-from state. If the move assignment operator is written to avoid
5721 moving from a moved-from object, this warning can be disabled.
5722
5723 @item -Wvla
5724 @opindex Wvla
5725 @opindex Wno-vla
5726 Warn if variable length array is used in the code.
5727 @option{-Wno-vla} prevents the @option{-Wpedantic} warning of
5728 the variable length array.
5729
5730 @item -Wvolatile-register-var
5731 @opindex Wvolatile-register-var
5732 @opindex Wno-volatile-register-var
5733 Warn if a register variable is declared volatile. The volatile
5734 modifier does not inhibit all optimizations that may eliminate reads
5735 and/or writes to register variables. This warning is enabled by
5736 @option{-Wall}.
5737
5738 @item -Wdisabled-optimization
5739 @opindex Wdisabled-optimization
5740 @opindex Wno-disabled-optimization
5741 Warn if a requested optimization pass is disabled. This warning does
5742 not generally indicate that there is anything wrong with your code; it
5743 merely indicates that GCC's optimizers are unable to handle the code
5744 effectively. Often, the problem is that your code is too big or too
5745 complex; GCC refuses to optimize programs when the optimization
5746 itself is likely to take inordinate amounts of time.
5747
5748 @item -Wpointer-sign @r{(C and Objective-C only)}
5749 @opindex Wpointer-sign
5750 @opindex Wno-pointer-sign
5751 Warn for pointer argument passing or assignment with different signedness.
5752 This option is only supported for C and Objective-C@. It is implied by
5753 @option{-Wall} and by @option{-Wpedantic}, which can be disabled with
5754 @option{-Wno-pointer-sign}.
5755
5756 @item -Wstack-protector
5757 @opindex Wstack-protector
5758 @opindex Wno-stack-protector
5759 This option is only active when @option{-fstack-protector} is active. It
5760 warns about functions that are not protected against stack smashing.
5761
5762 @item -Woverlength-strings
5763 @opindex Woverlength-strings
5764 @opindex Wno-overlength-strings
5765 Warn about string constants that are longer than the ``minimum
5766 maximum'' length specified in the C standard. Modern compilers
5767 generally allow string constants that are much longer than the
5768 standard's minimum limit, but very portable programs should avoid
5769 using longer strings.
5770
5771 The limit applies @emph{after} string constant concatenation, and does
5772 not count the trailing NUL@. In C90, the limit was 509 characters; in
5773 C99, it was raised to 4095. C++98 does not specify a normative
5774 minimum maximum, so we do not diagnose overlength strings in C++@.
5775
5776 This option is implied by @option{-Wpedantic}, and can be disabled with
5777 @option{-Wno-overlength-strings}.
5778
5779 @item -Wunsuffixed-float-constants @r{(C and Objective-C only)}
5780 @opindex Wunsuffixed-float-constants
5781
5782 Issue a warning for any floating constant that does not have
5783 a suffix. When used together with @option{-Wsystem-headers} it
5784 warns about such constants in system header files. This can be useful
5785 when preparing code to use with the @code{FLOAT_CONST_DECIMAL64} pragma
5786 from the decimal floating-point extension to C99.
5787
5788 @item -Wno-designated-init @r{(C and Objective-C only)}
5789 Suppress warnings when a positional initializer is used to initialize
5790 a structure that has been marked with the @code{designated_init}
5791 attribute.
5792
5793 @item -Whsa
5794 Issue a warning when HSAIL cannot be emitted for the compiled function or
5795 OpenMP construct.
5796
5797 @end table
5798
5799 @node Debugging Options
5800 @section Options for Debugging Your Program
5801 @cindex options, debugging
5802 @cindex debugging information options
5803
5804 To tell GCC to emit extra information for use by a debugger, in almost
5805 all cases you need only to add @option{-g} to your other options.
5806
5807 GCC allows you to use @option{-g} with
5808 @option{-O}. The shortcuts taken by optimized code may occasionally
5809 be surprising: some variables you declared may not exist
5810 at all; flow of control may briefly move where you did not expect it;
5811 some statements may not be executed because they compute constant
5812 results or their values are already at hand; some statements may
5813 execute in different places because they have been moved out of loops.
5814 Nevertheless it is possible to debug optimized output. This makes
5815 it reasonable to use the optimizer for programs that might have bugs.
5816
5817 If you are not using some other optimization option, consider
5818 using @option{-Og} (@pxref{Optimize Options}) with @option{-g}.
5819 With no @option{-O} option at all, some compiler passes that collect
5820 information useful for debugging do not run at all, so that
5821 @option{-Og} may result in a better debugging experience.
5822
5823 @table @gcctabopt
5824 @item -g
5825 @opindex g
5826 Produce debugging information in the operating system's native format
5827 (stabs, COFF, XCOFF, or DWARF)@. GDB can work with this debugging
5828 information.
5829
5830 On most systems that use stabs format, @option{-g} enables use of extra
5831 debugging information that only GDB can use; this extra information
5832 makes debugging work better in GDB but probably makes other debuggers
5833 crash or
5834 refuse to read the program. If you want to control for certain whether
5835 to generate the extra information, use @option{-gstabs+}, @option{-gstabs},
5836 @option{-gxcoff+}, @option{-gxcoff}, or @option{-gvms} (see below).
5837
5838 @item -ggdb
5839 @opindex ggdb
5840 Produce debugging information for use by GDB@. This means to use the
5841 most expressive format available (DWARF, stabs, or the native format
5842 if neither of those are supported), including GDB extensions if at all
5843 possible.
5844
5845 @item -gdwarf
5846 @itemx -gdwarf-@var{version}
5847 @opindex gdwarf
5848 Produce debugging information in DWARF format (if that is supported).
5849 The value of @var{version} may be either 2, 3, 4 or 5; the default version
5850 for most targets is 4. DWARF Version 5 is only experimental.
5851
5852 Note that with DWARF Version 2, some ports require and always
5853 use some non-conflicting DWARF 3 extensions in the unwind tables.
5854
5855 Version 4 may require GDB 7.0 and @option{-fvar-tracking-assignments}
5856 for maximum benefit.
5857
5858 GCC no longer supports DWARF Version 1, which is substantially
5859 different than Version 2 and later. For historical reasons, some
5860 other DWARF-related options (including @option{-feliminate-dwarf2-dups}
5861 and @option{-fno-dwarf2-cfi-asm}) retain a reference to DWARF Version 2
5862 in their names, but apply to all currently-supported versions of DWARF.
5863
5864 @item -gstabs
5865 @opindex gstabs
5866 Produce debugging information in stabs format (if that is supported),
5867 without GDB extensions. This is the format used by DBX on most BSD
5868 systems. On MIPS, Alpha and System V Release 4 systems this option
5869 produces stabs debugging output that is not understood by DBX or SDB@.
5870 On System V Release 4 systems this option requires the GNU assembler.
5871
5872 @item -gstabs+
5873 @opindex gstabs+
5874 Produce debugging information in stabs format (if that is supported),
5875 using GNU extensions understood only by the GNU debugger (GDB)@. The
5876 use of these extensions is likely to make other debuggers crash or
5877 refuse to read the program.
5878
5879 @item -gcoff
5880 @opindex gcoff
5881 Produce debugging information in COFF format (if that is supported).
5882 This is the format used by SDB on most System V systems prior to
5883 System V Release 4.
5884
5885 @item -gxcoff
5886 @opindex gxcoff
5887 Produce debugging information in XCOFF format (if that is supported).
5888 This is the format used by the DBX debugger on IBM RS/6000 systems.
5889
5890 @item -gxcoff+
5891 @opindex gxcoff+
5892 Produce debugging information in XCOFF format (if that is supported),
5893 using GNU extensions understood only by the GNU debugger (GDB)@. The
5894 use of these extensions is likely to make other debuggers crash or
5895 refuse to read the program, and may cause assemblers other than the GNU
5896 assembler (GAS) to fail with an error.
5897
5898 @item -gvms
5899 @opindex gvms
5900 Produce debugging information in Alpha/VMS debug format (if that is
5901 supported). This is the format used by DEBUG on Alpha/VMS systems.
5902
5903 @item -g@var{level}
5904 @itemx -ggdb@var{level}
5905 @itemx -gstabs@var{level}
5906 @itemx -gcoff@var{level}
5907 @itemx -gxcoff@var{level}
5908 @itemx -gvms@var{level}
5909 Request debugging information and also use @var{level} to specify how
5910 much information. The default level is 2.
5911
5912 Level 0 produces no debug information at all. Thus, @option{-g0} negates
5913 @option{-g}.
5914
5915 Level 1 produces minimal information, enough for making backtraces in
5916 parts of the program that you don't plan to debug. This includes
5917 descriptions of functions and external variables, and line number
5918 tables, but no information about local variables.
5919
5920 Level 3 includes extra information, such as all the macro definitions
5921 present in the program. Some debuggers support macro expansion when
5922 you use @option{-g3}.
5923
5924 @option{-gdwarf} does not accept a concatenated debug level, to avoid
5925 confusion with @option{-gdwarf-@var{level}}.
5926 Instead use an additional @option{-g@var{level}} option to change the
5927 debug level for DWARF.
5928
5929 @item -feliminate-unused-debug-symbols
5930 @opindex feliminate-unused-debug-symbols
5931 Produce debugging information in stabs format (if that is supported),
5932 for only symbols that are actually used.
5933
5934 @item -femit-class-debug-always
5935 @opindex femit-class-debug-always
5936 Instead of emitting debugging information for a C++ class in only one
5937 object file, emit it in all object files using the class. This option
5938 should be used only with debuggers that are unable to handle the way GCC
5939 normally emits debugging information for classes because using this
5940 option increases the size of debugging information by as much as a
5941 factor of two.
5942
5943 @item -fno-merge-debug-strings
5944 @opindex fmerge-debug-strings
5945 @opindex fno-merge-debug-strings
5946 Direct the linker to not merge together strings in the debugging
5947 information that are identical in different object files. Merging is
5948 not supported by all assemblers or linkers. Merging decreases the size
5949 of the debug information in the output file at the cost of increasing
5950 link processing time. Merging is enabled by default.
5951
5952 @item -fdebug-prefix-map=@var{old}=@var{new}
5953 @opindex fdebug-prefix-map
5954 When compiling files in directory @file{@var{old}}, record debugging
5955 information describing them as in @file{@var{new}} instead.
5956
5957 @item -fvar-tracking
5958 @opindex fvar-tracking
5959 Run variable tracking pass. It computes where variables are stored at each
5960 position in code. Better debugging information is then generated
5961 (if the debugging information format supports this information).
5962
5963 It is enabled by default when compiling with optimization (@option{-Os},
5964 @option{-O}, @option{-O2}, @dots{}), debugging information (@option{-g}) and
5965 the debug info format supports it.
5966
5967 @item -fvar-tracking-assignments
5968 @opindex fvar-tracking-assignments
5969 @opindex fno-var-tracking-assignments
5970 Annotate assignments to user variables early in the compilation and
5971 attempt to carry the annotations over throughout the compilation all the
5972 way to the end, in an attempt to improve debug information while
5973 optimizing. Use of @option{-gdwarf-4} is recommended along with it.
5974
5975 It can be enabled even if var-tracking is disabled, in which case
5976 annotations are created and maintained, but discarded at the end.
5977 By default, this flag is enabled together with @option{-fvar-tracking},
5978 except when selective scheduling is enabled.
5979
5980 @item -gsplit-dwarf
5981 @opindex gsplit-dwarf
5982 Separate as much DWARF debugging information as possible into a
5983 separate output file with the extension @file{.dwo}. This option allows
5984 the build system to avoid linking files with debug information. To
5985 be useful, this option requires a debugger capable of reading @file{.dwo}
5986 files.
5987
5988 @item -gpubnames
5989 @opindex gpubnames
5990 Generate DWARF @code{.debug_pubnames} and @code{.debug_pubtypes} sections.
5991
5992 @item -ggnu-pubnames
5993 @opindex ggnu-pubnames
5994 Generate @code{.debug_pubnames} and @code{.debug_pubtypes} sections in a format
5995 suitable for conversion into a GDB@ index. This option is only useful
5996 with a linker that can produce GDB@ index version 7.
5997
5998 @item -fdebug-types-section
5999 @opindex fdebug-types-section
6000 @opindex fno-debug-types-section
6001 When using DWARF Version 4 or higher, type DIEs can be put into
6002 their own @code{.debug_types} section instead of making them part of the
6003 @code{.debug_info} section. It is more efficient to put them in a separate
6004 comdat sections since the linker can then remove duplicates.
6005 But not all DWARF consumers support @code{.debug_types} sections yet
6006 and on some objects @code{.debug_types} produces larger instead of smaller
6007 debugging information.
6008
6009 @item -grecord-gcc-switches
6010 @item -gno-record-gcc-switches
6011 @opindex grecord-gcc-switches
6012 @opindex gno-record-gcc-switches
6013 This switch causes the command-line options used to invoke the
6014 compiler that may affect code generation to be appended to the
6015 DW_AT_producer attribute in DWARF debugging information. The options
6016 are concatenated with spaces separating them from each other and from
6017 the compiler version.
6018 It is enabled by default.
6019 See also @option{-frecord-gcc-switches} for another
6020 way of storing compiler options into the object file.
6021
6022 @item -gstrict-dwarf
6023 @opindex gstrict-dwarf
6024 Disallow using extensions of later DWARF standard version than selected
6025 with @option{-gdwarf-@var{version}}. On most targets using non-conflicting
6026 DWARF extensions from later standard versions is allowed.
6027
6028 @item -gno-strict-dwarf
6029 @opindex gno-strict-dwarf
6030 Allow using extensions of later DWARF standard version than selected with
6031 @option{-gdwarf-@var{version}}.
6032
6033 @item -gz@r{[}=@var{type}@r{]}
6034 @opindex gz
6035 Produce compressed debug sections in DWARF format, if that is supported.
6036 If @var{type} is not given, the default type depends on the capabilities
6037 of the assembler and linker used. @var{type} may be one of
6038 @samp{none} (don't compress debug sections), @samp{zlib} (use zlib
6039 compression in ELF gABI format), or @samp{zlib-gnu} (use zlib
6040 compression in traditional GNU format). If the linker doesn't support
6041 writing compressed debug sections, the option is rejected. Otherwise,
6042 if the assembler does not support them, @option{-gz} is silently ignored
6043 when producing object files.
6044
6045 @item -feliminate-dwarf2-dups
6046 @opindex feliminate-dwarf2-dups
6047 Compress DWARF debugging information by eliminating duplicated
6048 information about each symbol. This option only makes sense when
6049 generating DWARF debugging information.
6050
6051 @item -femit-struct-debug-baseonly
6052 @opindex femit-struct-debug-baseonly
6053 Emit debug information for struct-like types
6054 only when the base name of the compilation source file
6055 matches the base name of file in which the struct is defined.
6056
6057 This option substantially reduces the size of debugging information,
6058 but at significant potential loss in type information to the debugger.
6059 See @option{-femit-struct-debug-reduced} for a less aggressive option.
6060 See @option{-femit-struct-debug-detailed} for more detailed control.
6061
6062 This option works only with DWARF debug output.
6063
6064 @item -femit-struct-debug-reduced
6065 @opindex femit-struct-debug-reduced
6066 Emit debug information for struct-like types
6067 only when the base name of the compilation source file
6068 matches the base name of file in which the type is defined,
6069 unless the struct is a template or defined in a system header.
6070
6071 This option significantly reduces the size of debugging information,
6072 with some potential loss in type information to the debugger.
6073 See @option{-femit-struct-debug-baseonly} for a more aggressive option.
6074 See @option{-femit-struct-debug-detailed} for more detailed control.
6075
6076 This option works only with DWARF debug output.
6077
6078 @item -femit-struct-debug-detailed@r{[}=@var{spec-list}@r{]}
6079 @opindex femit-struct-debug-detailed
6080 Specify the struct-like types
6081 for which the compiler generates debug information.
6082 The intent is to reduce duplicate struct debug information
6083 between different object files within the same program.
6084
6085 This option is a detailed version of
6086 @option{-femit-struct-debug-reduced} and @option{-femit-struct-debug-baseonly},
6087 which serves for most needs.
6088
6089 A specification has the syntax@*
6090 [@samp{dir:}|@samp{ind:}][@samp{ord:}|@samp{gen:}](@samp{any}|@samp{sys}|@samp{base}|@samp{none})
6091
6092 The optional first word limits the specification to
6093 structs that are used directly (@samp{dir:}) or used indirectly (@samp{ind:}).
6094 A struct type is used directly when it is the type of a variable, member.
6095 Indirect uses arise through pointers to structs.
6096 That is, when use of an incomplete struct is valid, the use is indirect.
6097 An example is
6098 @samp{struct one direct; struct two * indirect;}.
6099
6100 The optional second word limits the specification to
6101 ordinary structs (@samp{ord:}) or generic structs (@samp{gen:}).
6102 Generic structs are a bit complicated to explain.
6103 For C++, these are non-explicit specializations of template classes,
6104 or non-template classes within the above.
6105 Other programming languages have generics,
6106 but @option{-femit-struct-debug-detailed} does not yet implement them.
6107
6108 The third word specifies the source files for those
6109 structs for which the compiler should emit debug information.
6110 The values @samp{none} and @samp{any} have the normal meaning.
6111 The value @samp{base} means that
6112 the base of name of the file in which the type declaration appears
6113 must match the base of the name of the main compilation file.
6114 In practice, this means that when compiling @file{foo.c}, debug information
6115 is generated for types declared in that file and @file{foo.h},
6116 but not other header files.
6117 The value @samp{sys} means those types satisfying @samp{base}
6118 or declared in system or compiler headers.
6119
6120 You may need to experiment to determine the best settings for your application.
6121
6122 The default is @option{-femit-struct-debug-detailed=all}.
6123
6124 This option works only with DWARF debug output.
6125
6126 @item -fno-dwarf2-cfi-asm
6127 @opindex fdwarf2-cfi-asm
6128 @opindex fno-dwarf2-cfi-asm
6129 Emit DWARF unwind info as compiler generated @code{.eh_frame} section
6130 instead of using GAS @code{.cfi_*} directives.
6131
6132 @item -fno-eliminate-unused-debug-types
6133 @opindex feliminate-unused-debug-types
6134 @opindex fno-eliminate-unused-debug-types
6135 Normally, when producing DWARF output, GCC avoids producing debug symbol
6136 output for types that are nowhere used in the source file being compiled.
6137 Sometimes it is useful to have GCC emit debugging
6138 information for all types declared in a compilation
6139 unit, regardless of whether or not they are actually used
6140 in that compilation unit, for example
6141 if, in the debugger, you want to cast a value to a type that is
6142 not actually used in your program (but is declared). More often,
6143 however, this results in a significant amount of wasted space.
6144 @end table
6145
6146 @node Optimize Options
6147 @section Options That Control Optimization
6148 @cindex optimize options
6149 @cindex options, optimization
6150
6151 These options control various sorts of optimizations.
6152
6153 Without any optimization option, the compiler's goal is to reduce the
6154 cost of compilation and to make debugging produce the expected
6155 results. Statements are independent: if you stop the program with a
6156 breakpoint between statements, you can then assign a new value to any
6157 variable or change the program counter to any other statement in the
6158 function and get exactly the results you expect from the source
6159 code.
6160
6161 Turning on optimization flags makes the compiler attempt to improve
6162 the performance and/or code size at the expense of compilation time
6163 and possibly the ability to debug the program.
6164
6165 The compiler performs optimization based on the knowledge it has of the
6166 program. Compiling multiple files at once to a single output file mode allows
6167 the compiler to use information gained from all of the files when compiling
6168 each of them.
6169
6170 Not all optimizations are controlled directly by a flag. Only
6171 optimizations that have a flag are listed in this section.
6172
6173 Most optimizations are only enabled if an @option{-O} level is set on
6174 the command line. Otherwise they are disabled, even if individual
6175 optimization flags are specified.
6176
6177 Depending on the target and how GCC was configured, a slightly different
6178 set of optimizations may be enabled at each @option{-O} level than
6179 those listed here. You can invoke GCC with @option{-Q --help=optimizers}
6180 to find out the exact set of optimizations that are enabled at each level.
6181 @xref{Overall Options}, for examples.
6182
6183 @table @gcctabopt
6184 @item -O
6185 @itemx -O1
6186 @opindex O
6187 @opindex O1
6188 Optimize. Optimizing compilation takes somewhat more time, and a lot
6189 more memory for a large function.
6190
6191 With @option{-O}, the compiler tries to reduce code size and execution
6192 time, without performing any optimizations that take a great deal of
6193 compilation time.
6194
6195 @option{-O} turns on the following optimization flags:
6196 @gccoptlist{
6197 -fauto-inc-dec @gol
6198 -fbranch-count-reg @gol
6199 -fcombine-stack-adjustments @gol
6200 -fcompare-elim @gol
6201 -fcprop-registers @gol
6202 -fdce @gol
6203 -fdefer-pop @gol
6204 -fdelayed-branch @gol
6205 -fdse @gol
6206 -fforward-propagate @gol
6207 -fguess-branch-probability @gol
6208 -fif-conversion2 @gol
6209 -fif-conversion @gol
6210 -finline-functions-called-once @gol
6211 -fipa-pure-const @gol
6212 -fipa-profile @gol
6213 -fipa-reference @gol
6214 -fmerge-constants @gol
6215 -fmove-loop-invariants @gol
6216 -freorder-blocks @gol
6217 -fshrink-wrap @gol
6218 -fsplit-wide-types @gol
6219 -fssa-backprop @gol
6220 -fssa-phiopt @gol
6221 -ftree-bit-ccp @gol
6222 -ftree-ccp @gol
6223 -ftree-ch @gol
6224 -ftree-coalesce-vars @gol
6225 -ftree-copy-prop @gol
6226 -ftree-dce @gol
6227 -ftree-dominator-opts @gol
6228 -ftree-dse @gol
6229 -ftree-forwprop @gol
6230 -ftree-fre @gol
6231 -ftree-phiprop @gol
6232 -ftree-sink @gol
6233 -ftree-slsr @gol
6234 -ftree-sra @gol
6235 -ftree-pta @gol
6236 -ftree-ter @gol
6237 -funit-at-a-time}
6238
6239 @option{-O} also turns on @option{-fomit-frame-pointer} on machines
6240 where doing so does not interfere with debugging.
6241
6242 @item -O2
6243 @opindex O2
6244 Optimize even more. GCC performs nearly all supported optimizations
6245 that do not involve a space-speed tradeoff.
6246 As compared to @option{-O}, this option increases both compilation time
6247 and the performance of the generated code.
6248
6249 @option{-O2} turns on all optimization flags specified by @option{-O}. It
6250 also turns on the following optimization flags:
6251 @gccoptlist{-fthread-jumps @gol
6252 -falign-functions -falign-jumps @gol
6253 -falign-loops -falign-labels @gol
6254 -fcaller-saves @gol
6255 -fcrossjumping @gol
6256 -fcse-follow-jumps -fcse-skip-blocks @gol
6257 -fdelete-null-pointer-checks @gol
6258 -fdevirtualize -fdevirtualize-speculatively @gol
6259 -fexpensive-optimizations @gol
6260 -fgcse -fgcse-lm @gol
6261 -fhoist-adjacent-loads @gol
6262 -finline-small-functions @gol
6263 -findirect-inlining @gol
6264 -fipa-cp @gol
6265 -fipa-cp-alignment @gol
6266 -fipa-sra @gol
6267 -fipa-icf @gol
6268 -fisolate-erroneous-paths-dereference @gol
6269 -flra-remat @gol
6270 -foptimize-sibling-calls @gol
6271 -foptimize-strlen @gol
6272 -fpartial-inlining @gol
6273 -fpeephole2 @gol
6274 -freorder-blocks-algorithm=stc @gol
6275 -freorder-blocks-and-partition -freorder-functions @gol
6276 -frerun-cse-after-loop @gol
6277 -fsched-interblock -fsched-spec @gol
6278 -fschedule-insns -fschedule-insns2 @gol
6279 -fstrict-aliasing -fstrict-overflow @gol
6280 -ftree-builtin-call-dce @gol
6281 -ftree-switch-conversion -ftree-tail-merge @gol
6282 -ftree-pre @gol
6283 -ftree-vrp @gol
6284 -fipa-ra}
6285
6286 Please note the warning under @option{-fgcse} about
6287 invoking @option{-O2} on programs that use computed gotos.
6288
6289 @item -O3
6290 @opindex O3
6291 Optimize yet more. @option{-O3} turns on all optimizations specified
6292 by @option{-O2} and also turns on the @option{-finline-functions},
6293 @option{-funswitch-loops}, @option{-fpredictive-commoning},
6294 @option{-fgcse-after-reload}, @option{-ftree-loop-vectorize},
6295 @option{-ftree-loop-distribute-patterns}, @option{-fsplit-paths}
6296 @option{-ftree-slp-vectorize}, @option{-fvect-cost-model},
6297 @option{-ftree-partial-pre} and @option{-fipa-cp-clone} options.
6298
6299 @item -O0
6300 @opindex O0
6301 Reduce compilation time and make debugging produce the expected
6302 results. This is the default.
6303
6304 @item -Os
6305 @opindex Os
6306 Optimize for size. @option{-Os} enables all @option{-O2} optimizations that
6307 do not typically increase code size. It also performs further
6308 optimizations designed to reduce code size.
6309
6310 @option{-Os} disables the following optimization flags:
6311 @gccoptlist{-falign-functions -falign-jumps -falign-loops @gol
6312 -falign-labels -freorder-blocks -freorder-blocks-algorithm=stc @gol
6313 -freorder-blocks-and-partition -fprefetch-loop-arrays}
6314
6315 @item -Ofast
6316 @opindex Ofast
6317 Disregard strict standards compliance. @option{-Ofast} enables all
6318 @option{-O3} optimizations. It also enables optimizations that are not
6319 valid for all standard-compliant programs.
6320 It turns on @option{-ffast-math} and the Fortran-specific
6321 @option{-fno-protect-parens} and @option{-fstack-arrays}.
6322
6323 @item -Og
6324 @opindex Og
6325 Optimize debugging experience. @option{-Og} enables optimizations
6326 that do not interfere with debugging. It should be the optimization
6327 level of choice for the standard edit-compile-debug cycle, offering
6328 a reasonable level of optimization while maintaining fast compilation
6329 and a good debugging experience.
6330 @end table
6331
6332 If you use multiple @option{-O} options, with or without level numbers,
6333 the last such option is the one that is effective.
6334
6335 Options of the form @option{-f@var{flag}} specify machine-independent
6336 flags. Most flags have both positive and negative forms; the negative
6337 form of @option{-ffoo} is @option{-fno-foo}. In the table
6338 below, only one of the forms is listed---the one you typically
6339 use. You can figure out the other form by either removing @samp{no-}
6340 or adding it.
6341
6342 The following options control specific optimizations. They are either
6343 activated by @option{-O} options or are related to ones that are. You
6344 can use the following flags in the rare cases when ``fine-tuning'' of
6345 optimizations to be performed is desired.
6346
6347 @table @gcctabopt
6348 @item -fno-defer-pop
6349 @opindex fno-defer-pop
6350 Always pop the arguments to each function call as soon as that function
6351 returns. For machines that must pop arguments after a function call,
6352 the compiler normally lets arguments accumulate on the stack for several
6353 function calls and pops them all at once.
6354
6355 Disabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
6356
6357 @item -fforward-propagate
6358 @opindex fforward-propagate
6359 Perform a forward propagation pass on RTL@. The pass tries to combine two
6360 instructions and checks if the result can be simplified. If loop unrolling
6361 is active, two passes are performed and the second is scheduled after
6362 loop unrolling.
6363
6364 This option is enabled by default at optimization levels @option{-O},
6365 @option{-O2}, @option{-O3}, @option{-Os}.
6366
6367 @item -ffp-contract=@var{style}
6368 @opindex ffp-contract
6369 @option{-ffp-contract=off} disables floating-point expression contraction.
6370 @option{-ffp-contract=fast} enables floating-point expression contraction
6371 such as forming of fused multiply-add operations if the target has
6372 native support for them.
6373 @option{-ffp-contract=on} enables floating-point expression contraction
6374 if allowed by the language standard. This is currently not implemented
6375 and treated equal to @option{-ffp-contract=off}.
6376
6377 The default is @option{-ffp-contract=fast}.
6378
6379 @item -fomit-frame-pointer
6380 @opindex fomit-frame-pointer
6381 Don't keep the frame pointer in a register for functions that
6382 don't need one. This avoids the instructions to save, set up and
6383 restore frame pointers; it also makes an extra register available
6384 in many functions. @strong{It also makes debugging impossible on
6385 some machines.}
6386
6387 On some machines, such as the VAX, this flag has no effect, because
6388 the standard calling sequence automatically handles the frame pointer
6389 and nothing is saved by pretending it doesn't exist. The
6390 machine-description macro @code{FRAME_POINTER_REQUIRED} controls
6391 whether a target machine supports this flag. @xref{Registers,,Register
6392 Usage, gccint, GNU Compiler Collection (GCC) Internals}.
6393
6394 The default setting (when not optimizing for
6395 size) for 32-bit GNU/Linux x86 and 32-bit Darwin x86 targets is
6396 @option{-fomit-frame-pointer}. You can configure GCC with the
6397 @option{--enable-frame-pointer} configure option to change the default.
6398
6399 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
6400
6401 @item -foptimize-sibling-calls
6402 @opindex foptimize-sibling-calls
6403 Optimize sibling and tail recursive calls.
6404
6405 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
6406
6407 @item -foptimize-strlen
6408 @opindex foptimize-strlen
6409 Optimize various standard C string functions (e.g. @code{strlen},
6410 @code{strchr} or @code{strcpy}) and
6411 their @code{_FORTIFY_SOURCE} counterparts into faster alternatives.
6412
6413 Enabled at levels @option{-O2}, @option{-O3}.
6414
6415 @item -fno-inline
6416 @opindex fno-inline
6417 Do not expand any functions inline apart from those marked with
6418 the @code{always_inline} attribute. This is the default when not
6419 optimizing.
6420
6421 Single functions can be exempted from inlining by marking them
6422 with the @code{noinline} attribute.
6423
6424 @item -finline-small-functions
6425 @opindex finline-small-functions
6426 Integrate functions into their callers when their body is smaller than expected
6427 function call code (so overall size of program gets smaller). The compiler
6428 heuristically decides which functions are simple enough to be worth integrating
6429 in this way. This inlining applies to all functions, even those not declared
6430 inline.
6431
6432 Enabled at level @option{-O2}.
6433
6434 @item -findirect-inlining
6435 @opindex findirect-inlining
6436 Inline also indirect calls that are discovered to be known at compile
6437 time thanks to previous inlining. This option has any effect only
6438 when inlining itself is turned on by the @option{-finline-functions}
6439 or @option{-finline-small-functions} options.
6440
6441 Enabled at level @option{-O2}.
6442
6443 @item -finline-functions
6444 @opindex finline-functions
6445 Consider all functions for inlining, even if they are not declared inline.
6446 The compiler heuristically decides which functions are worth integrating
6447 in this way.
6448
6449 If all calls to a given function are integrated, and the function is
6450 declared @code{static}, then the function is normally not output as
6451 assembler code in its own right.
6452
6453 Enabled at level @option{-O3}.
6454
6455 @item -finline-functions-called-once
6456 @opindex finline-functions-called-once
6457 Consider all @code{static} functions called once for inlining into their
6458 caller even if they are not marked @code{inline}. If a call to a given
6459 function is integrated, then the function is not output as assembler code
6460 in its own right.
6461
6462 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3} and @option{-Os}.
6463
6464 @item -fearly-inlining
6465 @opindex fearly-inlining
6466 Inline functions marked by @code{always_inline} and functions whose body seems
6467 smaller than the function call overhead early before doing
6468 @option{-fprofile-generate} instrumentation and real inlining pass. Doing so
6469 makes profiling significantly cheaper and usually inlining faster on programs
6470 having large chains of nested wrapper functions.
6471
6472 Enabled by default.
6473
6474 @item -fipa-sra
6475 @opindex fipa-sra
6476 Perform interprocedural scalar replacement of aggregates, removal of
6477 unused parameters and replacement of parameters passed by reference
6478 by parameters passed by value.
6479
6480 Enabled at levels @option{-O2}, @option{-O3} and @option{-Os}.
6481
6482 @item -finline-limit=@var{n}
6483 @opindex finline-limit
6484 By default, GCC limits the size of functions that can be inlined. This flag
6485 allows coarse control of this limit. @var{n} is the size of functions that
6486 can be inlined in number of pseudo instructions.
6487
6488 Inlining is actually controlled by a number of parameters, which may be
6489 specified individually by using @option{--param @var{name}=@var{value}}.
6490 The @option{-finline-limit=@var{n}} option sets some of these parameters
6491 as follows:
6492
6493 @table @gcctabopt
6494 @item max-inline-insns-single
6495 is set to @var{n}/2.
6496 @item max-inline-insns-auto
6497 is set to @var{n}/2.
6498 @end table
6499
6500 See below for a documentation of the individual
6501 parameters controlling inlining and for the defaults of these parameters.
6502
6503 @emph{Note:} there may be no value to @option{-finline-limit} that results
6504 in default behavior.
6505
6506 @emph{Note:} pseudo instruction represents, in this particular context, an
6507 abstract measurement of function's size. In no way does it represent a count
6508 of assembly instructions and as such its exact meaning might change from one
6509 release to an another.
6510
6511 @item -fno-keep-inline-dllexport
6512 @opindex fno-keep-inline-dllexport
6513 This is a more fine-grained version of @option{-fkeep-inline-functions},
6514 which applies only to functions that are declared using the @code{dllexport}
6515 attribute or declspec (@xref{Function Attributes,,Declaring Attributes of
6516 Functions}.)
6517
6518 @item -fkeep-inline-functions
6519 @opindex fkeep-inline-functions
6520 In C, emit @code{static} functions that are declared @code{inline}
6521 into the object file, even if the function has been inlined into all
6522 of its callers. This switch does not affect functions using the
6523 @code{extern inline} extension in GNU C90@. In C++, emit any and all
6524 inline functions into the object file.
6525
6526 @item -fkeep-static-functions
6527 @opindex fkeep-static-functions
6528 Emit @code{static} functions into the object file, even if the function
6529 is never used.
6530
6531 @item -fkeep-static-consts
6532 @opindex fkeep-static-consts
6533 Emit variables declared @code{static const} when optimization isn't turned
6534 on, even if the variables aren't referenced.
6535
6536 GCC enables this option by default. If you want to force the compiler to
6537 check if a variable is referenced, regardless of whether or not
6538 optimization is turned on, use the @option{-fno-keep-static-consts} option.
6539
6540 @item -fmerge-constants
6541 @opindex fmerge-constants
6542 Attempt to merge identical constants (string constants and floating-point
6543 constants) across compilation units.
6544
6545 This option is the default for optimized compilation if the assembler and
6546 linker support it. Use @option{-fno-merge-constants} to inhibit this
6547 behavior.
6548
6549 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
6550
6551 @item -fmerge-all-constants
6552 @opindex fmerge-all-constants
6553 Attempt to merge identical constants and identical variables.
6554
6555 This option implies @option{-fmerge-constants}. In addition to
6556 @option{-fmerge-constants} this considers e.g.@: even constant initialized
6557 arrays or initialized constant variables with integral or floating-point
6558 types. Languages like C or C++ require each variable, including multiple
6559 instances of the same variable in recursive calls, to have distinct locations,
6560 so using this option results in non-conforming
6561 behavior.
6562
6563 @item -fmodulo-sched
6564 @opindex fmodulo-sched
6565 Perform swing modulo scheduling immediately before the first scheduling
6566 pass. This pass looks at innermost loops and reorders their
6567 instructions by overlapping different iterations.
6568
6569 @item -fmodulo-sched-allow-regmoves
6570 @opindex fmodulo-sched-allow-regmoves
6571 Perform more aggressive SMS-based modulo scheduling with register moves
6572 allowed. By setting this flag certain anti-dependences edges are
6573 deleted, which triggers the generation of reg-moves based on the
6574 life-range analysis. This option is effective only with
6575 @option{-fmodulo-sched} enabled.
6576
6577 @item -fno-branch-count-reg
6578 @opindex fno-branch-count-reg
6579 Avoid running a pass scanning for opportunities to use ``decrement and
6580 branch'' instructions on a count register instead of generating sequences
6581 of instructions that decrement a register, compare it against zero, and
6582 then branch based upon the result. This option is only meaningful on
6583 architectures that support such instructions, which include x86, PowerPC,
6584 IA-64 and S/390. Note that the @option{-fno-branch-count-reg} option
6585 doesn't remove the decrement and branch instructions from the generated
6586 instruction stream introduced by other optimization passes.
6587
6588 Enabled by default at @option{-O1} and higher.
6589
6590 The default is @option{-fbranch-count-reg}.
6591
6592 @item -fno-function-cse
6593 @opindex fno-function-cse
6594 Do not put function addresses in registers; make each instruction that
6595 calls a constant function contain the function's address explicitly.
6596
6597 This option results in less efficient code, but some strange hacks
6598 that alter the assembler output may be confused by the optimizations
6599 performed when this option is not used.
6600
6601 The default is @option{-ffunction-cse}
6602
6603 @item -fno-zero-initialized-in-bss
6604 @opindex fno-zero-initialized-in-bss
6605 If the target supports a BSS section, GCC by default puts variables that
6606 are initialized to zero into BSS@. This can save space in the resulting
6607 code.
6608
6609 This option turns off this behavior because some programs explicitly
6610 rely on variables going to the data section---e.g., so that the
6611 resulting executable can find the beginning of that section and/or make
6612 assumptions based on that.
6613
6614 The default is @option{-fzero-initialized-in-bss}.
6615
6616 @item -fthread-jumps
6617 @opindex fthread-jumps
6618 Perform optimizations that check to see if a jump branches to a
6619 location where another comparison subsumed by the first is found. If
6620 so, the first branch is redirected to either the destination of the
6621 second branch or a point immediately following it, depending on whether
6622 the condition is known to be true or false.
6623
6624 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
6625
6626 @item -fsplit-wide-types
6627 @opindex fsplit-wide-types
6628 When using a type that occupies multiple registers, such as @code{long
6629 long} on a 32-bit system, split the registers apart and allocate them
6630 independently. This normally generates better code for those types,
6631 but may make debugging more difficult.
6632
6633 Enabled at levels @option{-O}, @option{-O2}, @option{-O3},
6634 @option{-Os}.
6635
6636 @item -fcse-follow-jumps
6637 @opindex fcse-follow-jumps
6638 In common subexpression elimination (CSE), scan through jump instructions
6639 when the target of the jump is not reached by any other path. For
6640 example, when CSE encounters an @code{if} statement with an
6641 @code{else} clause, CSE follows the jump when the condition
6642 tested is false.
6643
6644 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
6645
6646 @item -fcse-skip-blocks
6647 @opindex fcse-skip-blocks
6648 This is similar to @option{-fcse-follow-jumps}, but causes CSE to
6649 follow jumps that conditionally skip over blocks. When CSE
6650 encounters a simple @code{if} statement with no else clause,
6651 @option{-fcse-skip-blocks} causes CSE to follow the jump around the
6652 body of the @code{if}.
6653
6654 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
6655
6656 @item -frerun-cse-after-loop
6657 @opindex frerun-cse-after-loop
6658 Re-run common subexpression elimination after loop optimizations are
6659 performed.
6660
6661 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
6662
6663 @item -fgcse
6664 @opindex fgcse
6665 Perform a global common subexpression elimination pass.
6666 This pass also performs global constant and copy propagation.
6667
6668 @emph{Note:} When compiling a program using computed gotos, a GCC
6669 extension, you may get better run-time performance if you disable
6670 the global common subexpression elimination pass by adding
6671 @option{-fno-gcse} to the command line.
6672
6673 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
6674
6675 @item -fgcse-lm
6676 @opindex fgcse-lm
6677 When @option{-fgcse-lm} is enabled, global common subexpression elimination
6678 attempts to move loads that are only killed by stores into themselves. This
6679 allows a loop containing a load/store sequence to be changed to a load outside
6680 the loop, and a copy/store within the loop.
6681
6682 Enabled by default when @option{-fgcse} is enabled.
6683
6684 @item -fgcse-sm
6685 @opindex fgcse-sm
6686 When @option{-fgcse-sm} is enabled, a store motion pass is run after
6687 global common subexpression elimination. This pass attempts to move
6688 stores out of loops. When used in conjunction with @option{-fgcse-lm},
6689 loops containing a load/store sequence can be changed to a load before
6690 the loop and a store after the loop.
6691
6692 Not enabled at any optimization level.
6693
6694 @item -fgcse-las
6695 @opindex fgcse-las
6696 When @option{-fgcse-las} is enabled, the global common subexpression
6697 elimination pass eliminates redundant loads that come after stores to the
6698 same memory location (both partial and full redundancies).
6699
6700 Not enabled at any optimization level.
6701
6702 @item -fgcse-after-reload
6703 @opindex fgcse-after-reload
6704 When @option{-fgcse-after-reload} is enabled, a redundant load elimination
6705 pass is performed after reload. The purpose of this pass is to clean up
6706 redundant spilling.
6707
6708 @item -faggressive-loop-optimizations
6709 @opindex faggressive-loop-optimizations
6710 This option tells the loop optimizer to use language constraints to
6711 derive bounds for the number of iterations of a loop. This assumes that
6712 loop code does not invoke undefined behavior by for example causing signed
6713 integer overflows or out-of-bound array accesses. The bounds for the
6714 number of iterations of a loop are used to guide loop unrolling and peeling
6715 and loop exit test optimizations.
6716 This option is enabled by default.
6717
6718 @item -funsafe-loop-optimizations
6719 @opindex funsafe-loop-optimizations
6720 This option tells the loop optimizer to assume that loop indices do not
6721 overflow, and that loops with nontrivial exit condition are not
6722 infinite. This enables a wider range of loop optimizations even if
6723 the loop optimizer itself cannot prove that these assumptions are valid.
6724 If you use @option{-Wunsafe-loop-optimizations}, the compiler warns you
6725 if it finds this kind of loop.
6726
6727 @item -funconstrained-commons
6728 @opindex funconstrained-commons
6729 This option tells the compiler that variables declared in common blocks
6730 (e.g. Fortran) may later be overridden with longer trailing arrays. This
6731 prevents certain optimizations that depend on knowing the array bounds.
6732
6733 @item -fcrossjumping
6734 @opindex fcrossjumping
6735 Perform cross-jumping transformation.
6736 This transformation unifies equivalent code and saves code size. The
6737 resulting code may or may not perform better than without cross-jumping.
6738
6739 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
6740
6741 @item -fauto-inc-dec
6742 @opindex fauto-inc-dec
6743 Combine increments or decrements of addresses with memory accesses.
6744 This pass is always skipped on architectures that do not have
6745 instructions to support this. Enabled by default at @option{-O} and
6746 higher on architectures that support this.
6747
6748 @item -fdce
6749 @opindex fdce
6750 Perform dead code elimination (DCE) on RTL@.
6751 Enabled by default at @option{-O} and higher.
6752
6753 @item -fdse
6754 @opindex fdse
6755 Perform dead store elimination (DSE) on RTL@.
6756 Enabled by default at @option{-O} and higher.
6757
6758 @item -fif-conversion
6759 @opindex fif-conversion
6760 Attempt to transform conditional jumps into branch-less equivalents. This
6761 includes use of conditional moves, min, max, set flags and abs instructions, and
6762 some tricks doable by standard arithmetics. The use of conditional execution
6763 on chips where it is available is controlled by @option{-fif-conversion2}.
6764
6765 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
6766
6767 @item -fif-conversion2
6768 @opindex fif-conversion2
6769 Use conditional execution (where available) to transform conditional jumps into
6770 branch-less equivalents.
6771
6772 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
6773
6774 @item -fdeclone-ctor-dtor
6775 @opindex fdeclone-ctor-dtor
6776 The C++ ABI requires multiple entry points for constructors and
6777 destructors: one for a base subobject, one for a complete object, and
6778 one for a virtual destructor that calls operator delete afterwards.
6779 For a hierarchy with virtual bases, the base and complete variants are
6780 clones, which means two copies of the function. With this option, the
6781 base and complete variants are changed to be thunks that call a common
6782 implementation.
6783
6784 Enabled by @option{-Os}.
6785
6786 @item -fdelete-null-pointer-checks
6787 @opindex fdelete-null-pointer-checks
6788 Assume that programs cannot safely dereference null pointers, and that
6789 no code or data element resides at address zero.
6790 This option enables simple constant
6791 folding optimizations at all optimization levels. In addition, other
6792 optimization passes in GCC use this flag to control global dataflow
6793 analyses that eliminate useless checks for null pointers; these assume
6794 that a memory access to address zero always results in a trap, so
6795 that if a pointer is checked after it has already been dereferenced,
6796 it cannot be null.
6797
6798 Note however that in some environments this assumption is not true.
6799 Use @option{-fno-delete-null-pointer-checks} to disable this optimization
6800 for programs that depend on that behavior.
6801
6802 This option is enabled by default on most targets. On Nios II ELF, it
6803 defaults to off. On AVR and CR16, this option is completely disabled.
6804
6805 Passes that use the dataflow information
6806 are enabled independently at different optimization levels.
6807
6808 @item -fdevirtualize
6809 @opindex fdevirtualize
6810 Attempt to convert calls to virtual functions to direct calls. This
6811 is done both within a procedure and interprocedurally as part of
6812 indirect inlining (@option{-findirect-inlining}) and interprocedural constant
6813 propagation (@option{-fipa-cp}).
6814 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
6815
6816 @item -fdevirtualize-speculatively
6817 @opindex fdevirtualize-speculatively
6818 Attempt to convert calls to virtual functions to speculative direct calls.
6819 Based on the analysis of the type inheritance graph, determine for a given call
6820 the set of likely targets. If the set is small, preferably of size 1, change
6821 the call into a conditional deciding between direct and indirect calls. The
6822 speculative calls enable more optimizations, such as inlining. When they seem
6823 useless after further optimization, they are converted back into original form.
6824
6825 @item -fdevirtualize-at-ltrans
6826 @opindex fdevirtualize-at-ltrans
6827 Stream extra information needed for aggressive devirtualization when running
6828 the link-time optimizer in local transformation mode.
6829 This option enables more devirtualization but
6830 significantly increases the size of streamed data. For this reason it is
6831 disabled by default.
6832
6833 @item -fexpensive-optimizations
6834 @opindex fexpensive-optimizations
6835 Perform a number of minor optimizations that are relatively expensive.
6836
6837 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
6838
6839 @item -free
6840 @opindex free
6841 Attempt to remove redundant extension instructions. This is especially
6842 helpful for the x86-64 architecture, which implicitly zero-extends in 64-bit
6843 registers after writing to their lower 32-bit half.
6844
6845 Enabled for Alpha, AArch64 and x86 at levels @option{-O2},
6846 @option{-O3}, @option{-Os}.
6847
6848 @item -fno-lifetime-dse
6849 @opindex fno-lifetime-dse
6850 In C++ the value of an object is only affected by changes within its
6851 lifetime: when the constructor begins, the object has an indeterminate
6852 value, and any changes during the lifetime of the object are dead when
6853 the object is destroyed. Normally dead store elimination will take
6854 advantage of this; if your code relies on the value of the object
6855 storage persisting beyond the lifetime of the object, you can use this
6856 flag to disable this optimization. To preserve stores before the
6857 constructor starts (e.g. because your operator new clears the object
6858 storage) but still treat the object as dead after the destructor you,
6859 can use @option{-flifetime-dse=1}. The default behavior can be
6860 explicitly selected with @option{-flifetime-dse=2}.
6861 @option{-flifetime-dse=0} is equivalent to @option{-fno-lifetime-dse}.
6862
6863 @item -flive-range-shrinkage
6864 @opindex flive-range-shrinkage
6865 Attempt to decrease register pressure through register live range
6866 shrinkage. This is helpful for fast processors with small or moderate
6867 size register sets.
6868
6869 @item -fira-algorithm=@var{algorithm}
6870 @opindex fira-algorithm
6871 Use the specified coloring algorithm for the integrated register
6872 allocator. The @var{algorithm} argument can be @samp{priority}, which
6873 specifies Chow's priority coloring, or @samp{CB}, which specifies
6874 Chaitin-Briggs coloring. Chaitin-Briggs coloring is not implemented
6875 for all architectures, but for those targets that do support it, it is
6876 the default because it generates better code.
6877
6878 @item -fira-region=@var{region}
6879 @opindex fira-region
6880 Use specified regions for the integrated register allocator. The
6881 @var{region} argument should be one of the following:
6882
6883 @table @samp
6884
6885 @item all
6886 Use all loops as register allocation regions.
6887 This can give the best results for machines with a small and/or
6888 irregular register set.
6889
6890 @item mixed
6891 Use all loops except for loops with small register pressure
6892 as the regions. This value usually gives
6893 the best results in most cases and for most architectures,
6894 and is enabled by default when compiling with optimization for speed
6895 (@option{-O}, @option{-O2}, @dots{}).
6896
6897 @item one
6898 Use all functions as a single region.
6899 This typically results in the smallest code size, and is enabled by default for
6900 @option{-Os} or @option{-O0}.
6901
6902 @end table
6903
6904 @item -fira-hoist-pressure
6905 @opindex fira-hoist-pressure
6906 Use IRA to evaluate register pressure in the code hoisting pass for
6907 decisions to hoist expressions. This option usually results in smaller
6908 code, but it can slow the compiler down.
6909
6910 This option is enabled at level @option{-Os} for all targets.
6911
6912 @item -fira-loop-pressure
6913 @opindex fira-loop-pressure
6914 Use IRA to evaluate register pressure in loops for decisions to move
6915 loop invariants. This option usually results in generation
6916 of faster and smaller code on machines with large register files (>= 32
6917 registers), but it can slow the compiler down.
6918
6919 This option is enabled at level @option{-O3} for some targets.
6920
6921 @item -fno-ira-share-save-slots
6922 @opindex fno-ira-share-save-slots
6923 Disable sharing of stack slots used for saving call-used hard
6924 registers living through a call. Each hard register gets a
6925 separate stack slot, and as a result function stack frames are
6926 larger.
6927
6928 @item -fno-ira-share-spill-slots
6929 @opindex fno-ira-share-spill-slots
6930 Disable sharing of stack slots allocated for pseudo-registers. Each
6931 pseudo-register that does not get a hard register gets a separate
6932 stack slot, and as a result function stack frames are larger.
6933
6934 @item -flra-remat
6935 @opindex flra-remat
6936 Enable CFG-sensitive rematerialization in LRA. Instead of loading
6937 values of spilled pseudos, LRA tries to rematerialize (recalculate)
6938 values if it is profitable.
6939
6940 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
6941
6942 @item -fdelayed-branch
6943 @opindex fdelayed-branch
6944 If supported for the target machine, attempt to reorder instructions
6945 to exploit instruction slots available after delayed branch
6946 instructions.
6947
6948 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
6949
6950 @item -fschedule-insns
6951 @opindex fschedule-insns
6952 If supported for the target machine, attempt to reorder instructions to
6953 eliminate execution stalls due to required data being unavailable. This
6954 helps machines that have slow floating point or memory load instructions
6955 by allowing other instructions to be issued until the result of the load
6956 or floating-point instruction is required.
6957
6958 Enabled at levels @option{-O2}, @option{-O3}.
6959
6960 @item -fschedule-insns2
6961 @opindex fschedule-insns2
6962 Similar to @option{-fschedule-insns}, but requests an additional pass of
6963 instruction scheduling after register allocation has been done. This is
6964 especially useful on machines with a relatively small number of
6965 registers and where memory load instructions take more than one cycle.
6966
6967 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
6968
6969 @item -fno-sched-interblock
6970 @opindex fno-sched-interblock
6971 Don't schedule instructions across basic blocks. This is normally
6972 enabled by default when scheduling before register allocation, i.e.@:
6973 with @option{-fschedule-insns} or at @option{-O2} or higher.
6974
6975 @item -fno-sched-spec
6976 @opindex fno-sched-spec
6977 Don't allow speculative motion of non-load instructions. This is normally
6978 enabled by default when scheduling before register allocation, i.e.@:
6979 with @option{-fschedule-insns} or at @option{-O2} or higher.
6980
6981 @item -fsched-pressure
6982 @opindex fsched-pressure
6983 Enable register pressure sensitive insn scheduling before register
6984 allocation. This only makes sense when scheduling before register
6985 allocation is enabled, i.e.@: with @option{-fschedule-insns} or at
6986 @option{-O2} or higher. Usage of this option can improve the
6987 generated code and decrease its size by preventing register pressure
6988 increase above the number of available hard registers and subsequent
6989 spills in register allocation.
6990
6991 @item -fsched-spec-load
6992 @opindex fsched-spec-load
6993 Allow speculative motion of some load instructions. This only makes
6994 sense when scheduling before register allocation, i.e.@: with
6995 @option{-fschedule-insns} or at @option{-O2} or higher.
6996
6997 @item -fsched-spec-load-dangerous
6998 @opindex fsched-spec-load-dangerous
6999 Allow speculative motion of more load instructions. This only makes
7000 sense when scheduling before register allocation, i.e.@: with
7001 @option{-fschedule-insns} or at @option{-O2} or higher.
7002
7003 @item -fsched-stalled-insns
7004 @itemx -fsched-stalled-insns=@var{n}
7005 @opindex fsched-stalled-insns
7006 Define how many insns (if any) can be moved prematurely from the queue
7007 of stalled insns into the ready list during the second scheduling pass.
7008 @option{-fno-sched-stalled-insns} means that no insns are moved
7009 prematurely, @option{-fsched-stalled-insns=0} means there is no limit
7010 on how many queued insns can be moved prematurely.
7011 @option{-fsched-stalled-insns} without a value is equivalent to
7012 @option{-fsched-stalled-insns=1}.
7013
7014 @item -fsched-stalled-insns-dep
7015 @itemx -fsched-stalled-insns-dep=@var{n}
7016 @opindex fsched-stalled-insns-dep
7017 Define how many insn groups (cycles) are examined for a dependency
7018 on a stalled insn that is a candidate for premature removal from the queue
7019 of stalled insns. This has an effect only during the second scheduling pass,
7020 and only if @option{-fsched-stalled-insns} is used.
7021 @option{-fno-sched-stalled-insns-dep} is equivalent to
7022 @option{-fsched-stalled-insns-dep=0}.
7023 @option{-fsched-stalled-insns-dep} without a value is equivalent to
7024 @option{-fsched-stalled-insns-dep=1}.
7025
7026 @item -fsched2-use-superblocks
7027 @opindex fsched2-use-superblocks
7028 When scheduling after register allocation, use superblock scheduling.
7029 This allows motion across basic block boundaries,
7030 resulting in faster schedules. This option is experimental, as not all machine
7031 descriptions used by GCC model the CPU closely enough to avoid unreliable
7032 results from the algorithm.
7033
7034 This only makes sense when scheduling after register allocation, i.e.@: with
7035 @option{-fschedule-insns2} or at @option{-O2} or higher.
7036
7037 @item -fsched-group-heuristic
7038 @opindex fsched-group-heuristic
7039 Enable the group heuristic in the scheduler. This heuristic favors
7040 the instruction that belongs to a schedule group. This is enabled
7041 by default when scheduling is enabled, i.e.@: with @option{-fschedule-insns}
7042 or @option{-fschedule-insns2} or at @option{-O2} or higher.
7043
7044 @item -fsched-critical-path-heuristic
7045 @opindex fsched-critical-path-heuristic
7046 Enable the critical-path heuristic in the scheduler. This heuristic favors
7047 instructions on the critical path. This is enabled by default when
7048 scheduling is enabled, i.e.@: with @option{-fschedule-insns}
7049 or @option{-fschedule-insns2} or at @option{-O2} or higher.
7050
7051 @item -fsched-spec-insn-heuristic
7052 @opindex fsched-spec-insn-heuristic
7053 Enable the speculative instruction heuristic in the scheduler. This
7054 heuristic favors speculative instructions with greater dependency weakness.
7055 This is enabled by default when scheduling is enabled, i.e.@:
7056 with @option{-fschedule-insns} or @option{-fschedule-insns2}
7057 or at @option{-O2} or higher.
7058
7059 @item -fsched-rank-heuristic
7060 @opindex fsched-rank-heuristic
7061 Enable the rank heuristic in the scheduler. This heuristic favors
7062 the instruction belonging to a basic block with greater size or frequency.
7063 This is enabled by default when scheduling is enabled, i.e.@:
7064 with @option{-fschedule-insns} or @option{-fschedule-insns2} or
7065 at @option{-O2} or higher.
7066
7067 @item -fsched-last-insn-heuristic
7068 @opindex fsched-last-insn-heuristic
7069 Enable the last-instruction heuristic in the scheduler. This heuristic
7070 favors the instruction that is less dependent on the last instruction
7071 scheduled. This is enabled by default when scheduling is enabled,
7072 i.e.@: with @option{-fschedule-insns} or @option{-fschedule-insns2} or
7073 at @option{-O2} or higher.
7074
7075 @item -fsched-dep-count-heuristic
7076 @opindex fsched-dep-count-heuristic
7077 Enable the dependent-count heuristic in the scheduler. This heuristic
7078 favors the instruction that has more instructions depending on it.
7079 This is enabled by default when scheduling is enabled, i.e.@:
7080 with @option{-fschedule-insns} or @option{-fschedule-insns2} or
7081 at @option{-O2} or higher.
7082
7083 @item -freschedule-modulo-scheduled-loops
7084 @opindex freschedule-modulo-scheduled-loops
7085 Modulo scheduling is performed before traditional scheduling. If a loop
7086 is modulo scheduled, later scheduling passes may change its schedule.
7087 Use this option to control that behavior.
7088
7089 @item -fselective-scheduling
7090 @opindex fselective-scheduling
7091 Schedule instructions using selective scheduling algorithm. Selective
7092 scheduling runs instead of the first scheduler pass.
7093
7094 @item -fselective-scheduling2
7095 @opindex fselective-scheduling2
7096 Schedule instructions using selective scheduling algorithm. Selective
7097 scheduling runs instead of the second scheduler pass.
7098
7099 @item -fsel-sched-pipelining
7100 @opindex fsel-sched-pipelining
7101 Enable software pipelining of innermost loops during selective scheduling.
7102 This option has no effect unless one of @option{-fselective-scheduling} or
7103 @option{-fselective-scheduling2} is turned on.
7104
7105 @item -fsel-sched-pipelining-outer-loops
7106 @opindex fsel-sched-pipelining-outer-loops
7107 When pipelining loops during selective scheduling, also pipeline outer loops.
7108 This option has no effect unless @option{-fsel-sched-pipelining} is turned on.
7109
7110 @item -fsemantic-interposition
7111 @opindex fsemantic-interposition
7112 Some object formats, like ELF, allow interposing of symbols by the
7113 dynamic linker.
7114 This means that for symbols exported from the DSO, the compiler cannot perform
7115 interprocedural propagation, inlining and other optimizations in anticipation
7116 that the function or variable in question may change. While this feature is
7117 useful, for example, to rewrite memory allocation functions by a debugging
7118 implementation, it is expensive in the terms of code quality.
7119 With @option{-fno-semantic-interposition} the compiler assumes that
7120 if interposition happens for functions the overwriting function will have
7121 precisely the same semantics (and side effects).
7122 Similarly if interposition happens
7123 for variables, the constructor of the variable will be the same. The flag
7124 has no effect for functions explicitly declared inline
7125 (where it is never allowed for interposition to change semantics)
7126 and for symbols explicitly declared weak.
7127
7128 @item -fshrink-wrap
7129 @opindex fshrink-wrap
7130 Emit function prologues only before parts of the function that need it,
7131 rather than at the top of the function. This flag is enabled by default at
7132 @option{-O} and higher.
7133
7134 @item -fcaller-saves
7135 @opindex fcaller-saves
7136 Enable allocation of values to registers that are clobbered by
7137 function calls, by emitting extra instructions to save and restore the
7138 registers around such calls. Such allocation is done only when it
7139 seems to result in better code.
7140
7141 This option is always enabled by default on certain machines, usually
7142 those which have no call-preserved registers to use instead.
7143
7144 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
7145
7146 @item -fcombine-stack-adjustments
7147 @opindex fcombine-stack-adjustments
7148 Tracks stack adjustments (pushes and pops) and stack memory references
7149 and then tries to find ways to combine them.
7150
7151 Enabled by default at @option{-O1} and higher.
7152
7153 @item -fipa-ra
7154 @opindex fipa-ra
7155 Use caller save registers for allocation if those registers are not used by
7156 any called function. In that case it is not necessary to save and restore
7157 them around calls. This is only possible if called functions are part of
7158 same compilation unit as current function and they are compiled before it.
7159
7160 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
7161
7162 @item -fconserve-stack
7163 @opindex fconserve-stack
7164 Attempt to minimize stack usage. The compiler attempts to use less
7165 stack space, even if that makes the program slower. This option
7166 implies setting the @option{large-stack-frame} parameter to 100
7167 and the @option{large-stack-frame-growth} parameter to 400.
7168
7169 @item -ftree-reassoc
7170 @opindex ftree-reassoc
7171 Perform reassociation on trees. This flag is enabled by default
7172 at @option{-O} and higher.
7173
7174 @item -ftree-pre
7175 @opindex ftree-pre
7176 Perform partial redundancy elimination (PRE) on trees. This flag is
7177 enabled by default at @option{-O2} and @option{-O3}.
7178
7179 @item -ftree-partial-pre
7180 @opindex ftree-partial-pre
7181 Make partial redundancy elimination (PRE) more aggressive. This flag is
7182 enabled by default at @option{-O3}.
7183
7184 @item -ftree-forwprop
7185 @opindex ftree-forwprop
7186 Perform forward propagation on trees. This flag is enabled by default
7187 at @option{-O} and higher.
7188
7189 @item -ftree-fre
7190 @opindex ftree-fre
7191 Perform full redundancy elimination (FRE) on trees. The difference
7192 between FRE and PRE is that FRE only considers expressions
7193 that are computed on all paths leading to the redundant computation.
7194 This analysis is faster than PRE, though it exposes fewer redundancies.
7195 This flag is enabled by default at @option{-O} and higher.
7196
7197 @item -ftree-phiprop
7198 @opindex ftree-phiprop
7199 Perform hoisting of loads from conditional pointers on trees. This
7200 pass is enabled by default at @option{-O} and higher.
7201
7202 @item -fhoist-adjacent-loads
7203 @opindex fhoist-adjacent-loads
7204 Speculatively hoist loads from both branches of an if-then-else if the
7205 loads are from adjacent locations in the same structure and the target
7206 architecture has a conditional move instruction. This flag is enabled
7207 by default at @option{-O2} and higher.
7208
7209 @item -ftree-copy-prop
7210 @opindex ftree-copy-prop
7211 Perform copy propagation on trees. This pass eliminates unnecessary
7212 copy operations. This flag is enabled by default at @option{-O} and
7213 higher.
7214
7215 @item -fipa-pure-const
7216 @opindex fipa-pure-const
7217 Discover which functions are pure or constant.
7218 Enabled by default at @option{-O} and higher.
7219
7220 @item -fipa-reference
7221 @opindex fipa-reference
7222 Discover which static variables do not escape the
7223 compilation unit.
7224 Enabled by default at @option{-O} and higher.
7225
7226 @item -fipa-pta
7227 @opindex fipa-pta
7228 Perform interprocedural pointer analysis and interprocedural modification
7229 and reference analysis. This option can cause excessive memory and
7230 compile-time usage on large compilation units. It is not enabled by
7231 default at any optimization level.
7232
7233 @item -fipa-profile
7234 @opindex fipa-profile
7235 Perform interprocedural profile propagation. The functions called only from
7236 cold functions are marked as cold. Also functions executed once (such as
7237 @code{cold}, @code{noreturn}, static constructors or destructors) are identified. Cold
7238 functions and loop less parts of functions executed once are then optimized for
7239 size.
7240 Enabled by default at @option{-O} and higher.
7241
7242 @item -fipa-cp
7243 @opindex fipa-cp
7244 Perform interprocedural constant propagation.
7245 This optimization analyzes the program to determine when values passed
7246 to functions are constants and then optimizes accordingly.
7247 This optimization can substantially increase performance
7248 if the application has constants passed to functions.
7249 This flag is enabled by default at @option{-O2}, @option{-Os} and @option{-O3}.
7250
7251 @item -fipa-cp-clone
7252 @opindex fipa-cp-clone
7253 Perform function cloning to make interprocedural constant propagation stronger.
7254 When enabled, interprocedural constant propagation performs function cloning
7255 when externally visible function can be called with constant arguments.
7256 Because this optimization can create multiple copies of functions,
7257 it may significantly increase code size
7258 (see @option{--param ipcp-unit-growth=@var{value}}).
7259 This flag is enabled by default at @option{-O3}.
7260
7261 @item -fipa-cp-alignment
7262 @opindex -fipa-cp-alignment
7263 When enabled, this optimization propagates alignment of function
7264 parameters to support better vectorization and string operations.
7265
7266 This flag is enabled by default at @option{-O2} and @option{-Os}. It
7267 requires that @option{-fipa-cp} is enabled.
7268
7269 @item -fipa-icf
7270 @opindex fipa-icf
7271 Perform Identical Code Folding for functions and read-only variables.
7272 The optimization reduces code size and may disturb unwind stacks by replacing
7273 a function by equivalent one with a different name. The optimization works
7274 more effectively with link time optimization enabled.
7275
7276 Nevertheless the behavior is similar to Gold Linker ICF optimization, GCC ICF
7277 works on different levels and thus the optimizations are not same - there are
7278 equivalences that are found only by GCC and equivalences found only by Gold.
7279
7280 This flag is enabled by default at @option{-O2} and @option{-Os}.
7281
7282 @item -fisolate-erroneous-paths-dereference
7283 @opindex fisolate-erroneous-paths-dereference
7284 Detect paths that trigger erroneous or undefined behavior due to
7285 dereferencing a null pointer. Isolate those paths from the main control
7286 flow and turn the statement with erroneous or undefined behavior into a trap.
7287 This flag is enabled by default at @option{-O2} and higher and depends on
7288 @option{-fdelete-null-pointer-checks} also being enabled.
7289
7290 @item -fisolate-erroneous-paths-attribute
7291 @opindex fisolate-erroneous-paths-attribute
7292 Detect paths that trigger erroneous or undefined behavior due a null value
7293 being used in a way forbidden by a @code{returns_nonnull} or @code{nonnull}
7294 attribute. Isolate those paths from the main control flow and turn the
7295 statement with erroneous or undefined behavior into a trap. This is not
7296 currently enabled, but may be enabled by @option{-O2} in the future.
7297
7298 @item -ftree-sink
7299 @opindex ftree-sink
7300 Perform forward store motion on trees. This flag is
7301 enabled by default at @option{-O} and higher.
7302
7303 @item -ftree-bit-ccp
7304 @opindex ftree-bit-ccp
7305 Perform sparse conditional bit constant propagation on trees and propagate
7306 pointer alignment information.
7307 This pass only operates on local scalar variables and is enabled by default
7308 at @option{-O} and higher. It requires that @option{-ftree-ccp} is enabled.
7309
7310 @item -ftree-ccp
7311 @opindex ftree-ccp
7312 Perform sparse conditional constant propagation (CCP) on trees. This
7313 pass only operates on local scalar variables and is enabled by default
7314 at @option{-O} and higher.
7315
7316 @item -fssa-backprop
7317 @opindex fssa-backprop
7318 Propagate information about uses of a value up the definition chain
7319 in order to simplify the definitions. For example, this pass strips
7320 sign operations if the sign of a value never matters. The flag is
7321 enabled by default at @option{-O} and higher.
7322
7323 @item -fssa-phiopt
7324 @opindex fssa-phiopt
7325 Perform pattern matching on SSA PHI nodes to optimize conditional
7326 code. This pass is enabled by default at @option{-O} and higher.
7327
7328 @item -ftree-switch-conversion
7329 @opindex ftree-switch-conversion
7330 Perform conversion of simple initializations in a switch to
7331 initializations from a scalar array. This flag is enabled by default
7332 at @option{-O2} and higher.
7333
7334 @item -ftree-tail-merge
7335 @opindex ftree-tail-merge
7336 Look for identical code sequences. When found, replace one with a jump to the
7337 other. This optimization is known as tail merging or cross jumping. This flag
7338 is enabled by default at @option{-O2} and higher. The compilation time
7339 in this pass can
7340 be limited using @option{max-tail-merge-comparisons} parameter and
7341 @option{max-tail-merge-iterations} parameter.
7342
7343 @item -ftree-dce
7344 @opindex ftree-dce
7345 Perform dead code elimination (DCE) on trees. This flag is enabled by
7346 default at @option{-O} and higher.
7347
7348 @item -ftree-builtin-call-dce
7349 @opindex ftree-builtin-call-dce
7350 Perform conditional dead code elimination (DCE) for calls to built-in functions
7351 that may set @code{errno} but are otherwise side-effect free. This flag is
7352 enabled by default at @option{-O2} and higher if @option{-Os} is not also
7353 specified.
7354
7355 @item -ftree-dominator-opts
7356 @opindex ftree-dominator-opts
7357 Perform a variety of simple scalar cleanups (constant/copy
7358 propagation, redundancy elimination, range propagation and expression
7359 simplification) based on a dominator tree traversal. This also
7360 performs jump threading (to reduce jumps to jumps). This flag is
7361 enabled by default at @option{-O} and higher.
7362
7363 @item -ftree-dse
7364 @opindex ftree-dse
7365 Perform dead store elimination (DSE) on trees. A dead store is a store into
7366 a memory location that is later overwritten by another store without
7367 any intervening loads. In this case the earlier store can be deleted. This
7368 flag is enabled by default at @option{-O} and higher.
7369
7370 @item -ftree-ch
7371 @opindex ftree-ch
7372 Perform loop header copying on trees. This is beneficial since it increases
7373 effectiveness of code motion optimizations. It also saves one jump. This flag
7374 is enabled by default at @option{-O} and higher. It is not enabled
7375 for @option{-Os}, since it usually increases code size.
7376
7377 @item -ftree-loop-optimize
7378 @opindex ftree-loop-optimize
7379 Perform loop optimizations on trees. This flag is enabled by default
7380 at @option{-O} and higher.
7381
7382 @item -ftree-loop-linear
7383 @itemx -floop-interchange
7384 @itemx -floop-strip-mine
7385 @itemx -floop-block
7386 @itemx -floop-unroll-and-jam
7387 @opindex ftree-loop-linear
7388 @opindex floop-interchange
7389 @opindex floop-strip-mine
7390 @opindex floop-block
7391 @opindex floop-unroll-and-jam
7392 Perform loop nest optimizations. Same as
7393 @option{-floop-nest-optimize}. To use this code transformation, GCC has
7394 to be configured with @option{--with-isl} to enable the Graphite loop
7395 transformation infrastructure.
7396
7397 @item -fgraphite-identity
7398 @opindex fgraphite-identity
7399 Enable the identity transformation for graphite. For every SCoP we generate
7400 the polyhedral representation and transform it back to gimple. Using
7401 @option{-fgraphite-identity} we can check the costs or benefits of the
7402 GIMPLE -> GRAPHITE -> GIMPLE transformation. Some minimal optimizations
7403 are also performed by the code generator isl, like index splitting and
7404 dead code elimination in loops.
7405
7406 @item -floop-nest-optimize
7407 @opindex floop-nest-optimize
7408 Enable the isl based loop nest optimizer. This is a generic loop nest
7409 optimizer based on the Pluto optimization algorithms. It calculates a loop
7410 structure optimized for data-locality and parallelism. This option
7411 is experimental.
7412
7413 @item -floop-parallelize-all
7414 @opindex floop-parallelize-all
7415 Use the Graphite data dependence analysis to identify loops that can
7416 be parallelized. Parallelize all the loops that can be analyzed to
7417 not contain loop carried dependences without checking that it is
7418 profitable to parallelize the loops.
7419
7420 @item -ftree-coalesce-vars
7421 @opindex ftree-coalesce-vars
7422 While transforming the program out of the SSA representation, attempt to
7423 reduce copying by coalescing versions of different user-defined
7424 variables, instead of just compiler temporaries. This may severely
7425 limit the ability to debug an optimized program compiled with
7426 @option{-fno-var-tracking-assignments}. In the negated form, this flag
7427 prevents SSA coalescing of user variables. This option is enabled by
7428 default if optimization is enabled, and it does very little otherwise.
7429
7430 @item -ftree-loop-if-convert
7431 @opindex ftree-loop-if-convert
7432 Attempt to transform conditional jumps in the innermost loops to
7433 branch-less equivalents. The intent is to remove control-flow from
7434 the innermost loops in order to improve the ability of the
7435 vectorization pass to handle these loops. This is enabled by default
7436 if vectorization is enabled.
7437
7438 @item -ftree-loop-if-convert-stores
7439 @opindex ftree-loop-if-convert-stores
7440 Attempt to also if-convert conditional jumps containing memory writes.
7441 This transformation can be unsafe for multi-threaded programs as it
7442 transforms conditional memory writes into unconditional memory writes.
7443 For example,
7444 @smallexample
7445 for (i = 0; i < N; i++)
7446 if (cond)
7447 A[i] = expr;
7448 @end smallexample
7449 is transformed to
7450 @smallexample
7451 for (i = 0; i < N; i++)
7452 A[i] = cond ? expr : A[i];
7453 @end smallexample
7454 potentially producing data races.
7455
7456 @item -ftree-loop-distribution
7457 @opindex ftree-loop-distribution
7458 Perform loop distribution. This flag can improve cache performance on
7459 big loop bodies and allow further loop optimizations, like
7460 parallelization or vectorization, to take place. For example, the loop
7461 @smallexample
7462 DO I = 1, N
7463 A(I) = B(I) + C
7464 D(I) = E(I) * F
7465 ENDDO
7466 @end smallexample
7467 is transformed to
7468 @smallexample
7469 DO I = 1, N
7470 A(I) = B(I) + C
7471 ENDDO
7472 DO I = 1, N
7473 D(I) = E(I) * F
7474 ENDDO
7475 @end smallexample
7476
7477 @item -ftree-loop-distribute-patterns
7478 @opindex ftree-loop-distribute-patterns
7479 Perform loop distribution of patterns that can be code generated with
7480 calls to a library. This flag is enabled by default at @option{-O3}.
7481
7482 This pass distributes the initialization loops and generates a call to
7483 memset zero. For example, the loop
7484 @smallexample
7485 DO I = 1, N
7486 A(I) = 0
7487 B(I) = A(I) + I
7488 ENDDO
7489 @end smallexample
7490 is transformed to
7491 @smallexample
7492 DO I = 1, N
7493 A(I) = 0
7494 ENDDO
7495 DO I = 1, N
7496 B(I) = A(I) + I
7497 ENDDO
7498 @end smallexample
7499 and the initialization loop is transformed into a call to memset zero.
7500
7501 @item -ftree-loop-im
7502 @opindex ftree-loop-im
7503 Perform loop invariant motion on trees. This pass moves only invariants that
7504 are hard to handle at RTL level (function calls, operations that expand to
7505 nontrivial sequences of insns). With @option{-funswitch-loops} it also moves
7506 operands of conditions that are invariant out of the loop, so that we can use
7507 just trivial invariantness analysis in loop unswitching. The pass also includes
7508 store motion.
7509
7510 @item -ftree-loop-ivcanon
7511 @opindex ftree-loop-ivcanon
7512 Create a canonical counter for number of iterations in loops for which
7513 determining number of iterations requires complicated analysis. Later
7514 optimizations then may determine the number easily. Useful especially
7515 in connection with unrolling.
7516
7517 @item -fivopts
7518 @opindex fivopts
7519 Perform induction variable optimizations (strength reduction, induction
7520 variable merging and induction variable elimination) on trees.
7521
7522 @item -ftree-parallelize-loops=n
7523 @opindex ftree-parallelize-loops
7524 Parallelize loops, i.e., split their iteration space to run in n threads.
7525 This is only possible for loops whose iterations are independent
7526 and can be arbitrarily reordered. The optimization is only
7527 profitable on multiprocessor machines, for loops that are CPU-intensive,
7528 rather than constrained e.g.@: by memory bandwidth. This option
7529 implies @option{-pthread}, and thus is only supported on targets
7530 that have support for @option{-pthread}.
7531
7532 @item -ftree-pta
7533 @opindex ftree-pta
7534 Perform function-local points-to analysis on trees. This flag is
7535 enabled by default at @option{-O} and higher.
7536
7537 @item -ftree-sra
7538 @opindex ftree-sra
7539 Perform scalar replacement of aggregates. This pass replaces structure
7540 references with scalars to prevent committing structures to memory too
7541 early. This flag is enabled by default at @option{-O} and higher.
7542
7543 @item -ftree-ter
7544 @opindex ftree-ter
7545 Perform temporary expression replacement during the SSA->normal phase. Single
7546 use/single def temporaries are replaced at their use location with their
7547 defining expression. This results in non-GIMPLE code, but gives the expanders
7548 much more complex trees to work on resulting in better RTL generation. This is
7549 enabled by default at @option{-O} and higher.
7550
7551 @item -ftree-slsr
7552 @opindex ftree-slsr
7553 Perform straight-line strength reduction on trees. This recognizes related
7554 expressions involving multiplications and replaces them by less expensive
7555 calculations when possible. This is enabled by default at @option{-O} and
7556 higher.
7557
7558 @item -ftree-vectorize
7559 @opindex ftree-vectorize
7560 Perform vectorization on trees. This flag enables @option{-ftree-loop-vectorize}
7561 and @option{-ftree-slp-vectorize} if not explicitly specified.
7562
7563 @item -ftree-loop-vectorize
7564 @opindex ftree-loop-vectorize
7565 Perform loop vectorization on trees. This flag is enabled by default at
7566 @option{-O3} and when @option{-ftree-vectorize} is enabled.
7567
7568 @item -ftree-slp-vectorize
7569 @opindex ftree-slp-vectorize
7570 Perform basic block vectorization on trees. This flag is enabled by default at
7571 @option{-O3} and when @option{-ftree-vectorize} is enabled.
7572
7573 @item -fvect-cost-model=@var{model}
7574 @opindex fvect-cost-model
7575 Alter the cost model used for vectorization. The @var{model} argument
7576 should be one of @samp{unlimited}, @samp{dynamic} or @samp{cheap}.
7577 With the @samp{unlimited} model the vectorized code-path is assumed
7578 to be profitable while with the @samp{dynamic} model a runtime check
7579 guards the vectorized code-path to enable it only for iteration
7580 counts that will likely execute faster than when executing the original
7581 scalar loop. The @samp{cheap} model disables vectorization of
7582 loops where doing so would be cost prohibitive for example due to
7583 required runtime checks for data dependence or alignment but otherwise
7584 is equal to the @samp{dynamic} model.
7585 The default cost model depends on other optimization flags and is
7586 either @samp{dynamic} or @samp{cheap}.
7587
7588 @item -fsimd-cost-model=@var{model}
7589 @opindex fsimd-cost-model
7590 Alter the cost model used for vectorization of loops marked with the OpenMP
7591 or Cilk Plus simd directive. The @var{model} argument should be one of
7592 @samp{unlimited}, @samp{dynamic}, @samp{cheap}. All values of @var{model}
7593 have the same meaning as described in @option{-fvect-cost-model} and by
7594 default a cost model defined with @option{-fvect-cost-model} is used.
7595
7596 @item -ftree-vrp
7597 @opindex ftree-vrp
7598 Perform Value Range Propagation on trees. This is similar to the
7599 constant propagation pass, but instead of values, ranges of values are
7600 propagated. This allows the optimizers to remove unnecessary range
7601 checks like array bound checks and null pointer checks. This is
7602 enabled by default at @option{-O2} and higher. Null pointer check
7603 elimination is only done if @option{-fdelete-null-pointer-checks} is
7604 enabled.
7605
7606 @item -fsplit-paths
7607 @opindex fsplit-paths
7608 Split paths leading to loop backedges. This can improve dead code
7609 elimination and common subexpression elimination. This is enabled by
7610 default at @option{-O2} and above.
7611
7612 @item -fsplit-ivs-in-unroller
7613 @opindex fsplit-ivs-in-unroller
7614 Enables expression of values of induction variables in later iterations
7615 of the unrolled loop using the value in the first iteration. This breaks
7616 long dependency chains, thus improving efficiency of the scheduling passes.
7617
7618 A combination of @option{-fweb} and CSE is often sufficient to obtain the
7619 same effect. However, that is not reliable in cases where the loop body
7620 is more complicated than a single basic block. It also does not work at all
7621 on some architectures due to restrictions in the CSE pass.
7622
7623 This optimization is enabled by default.
7624
7625 @item -fvariable-expansion-in-unroller
7626 @opindex fvariable-expansion-in-unroller
7627 With this option, the compiler creates multiple copies of some
7628 local variables when unrolling a loop, which can result in superior code.
7629
7630 @item -fpartial-inlining
7631 @opindex fpartial-inlining
7632 Inline parts of functions. This option has any effect only
7633 when inlining itself is turned on by the @option{-finline-functions}
7634 or @option{-finline-small-functions} options.
7635
7636 Enabled at level @option{-O2}.
7637
7638 @item -fpredictive-commoning
7639 @opindex fpredictive-commoning
7640 Perform predictive commoning optimization, i.e., reusing computations
7641 (especially memory loads and stores) performed in previous
7642 iterations of loops.
7643
7644 This option is enabled at level @option{-O3}.
7645
7646 @item -fprefetch-loop-arrays
7647 @opindex fprefetch-loop-arrays
7648 If supported by the target machine, generate instructions to prefetch
7649 memory to improve the performance of loops that access large arrays.
7650
7651 This option may generate better or worse code; results are highly
7652 dependent on the structure of loops within the source code.
7653
7654 Disabled at level @option{-Os}.
7655
7656 @item -fno-peephole
7657 @itemx -fno-peephole2
7658 @opindex fno-peephole
7659 @opindex fno-peephole2
7660 Disable any machine-specific peephole optimizations. The difference
7661 between @option{-fno-peephole} and @option{-fno-peephole2} is in how they
7662 are implemented in the compiler; some targets use one, some use the
7663 other, a few use both.
7664
7665 @option{-fpeephole} is enabled by default.
7666 @option{-fpeephole2} enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
7667
7668 @item -fno-guess-branch-probability
7669 @opindex fno-guess-branch-probability
7670 Do not guess branch probabilities using heuristics.
7671
7672 GCC uses heuristics to guess branch probabilities if they are
7673 not provided by profiling feedback (@option{-fprofile-arcs}). These
7674 heuristics are based on the control flow graph. If some branch probabilities
7675 are specified by @code{__builtin_expect}, then the heuristics are
7676 used to guess branch probabilities for the rest of the control flow graph,
7677 taking the @code{__builtin_expect} info into account. The interactions
7678 between the heuristics and @code{__builtin_expect} can be complex, and in
7679 some cases, it may be useful to disable the heuristics so that the effects
7680 of @code{__builtin_expect} are easier to understand.
7681
7682 The default is @option{-fguess-branch-probability} at levels
7683 @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
7684
7685 @item -freorder-blocks
7686 @opindex freorder-blocks
7687 Reorder basic blocks in the compiled function in order to reduce number of
7688 taken branches and improve code locality.
7689
7690 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
7691
7692 @item -freorder-blocks-algorithm=@var{algorithm}
7693 @opindex freorder-blocks-algorithm
7694 Use the specified algorithm for basic block reordering. The
7695 @var{algorithm} argument can be @samp{simple}, which does not increase
7696 code size (except sometimes due to secondary effects like alignment),
7697 or @samp{stc}, the ``software trace cache'' algorithm, which tries to
7698 put all often executed code together, minimizing the number of branches
7699 executed by making extra copies of code.
7700
7701 The default is @samp{simple} at levels @option{-O}, @option{-Os}, and
7702 @samp{stc} at levels @option{-O2}, @option{-O3}.
7703
7704 @item -freorder-blocks-and-partition
7705 @opindex freorder-blocks-and-partition
7706 In addition to reordering basic blocks in the compiled function, in order
7707 to reduce number of taken branches, partitions hot and cold basic blocks
7708 into separate sections of the assembly and @file{.o} files, to improve
7709 paging and cache locality performance.
7710
7711 This optimization is automatically turned off in the presence of
7712 exception handling, for linkonce sections, for functions with a user-defined
7713 section attribute and on any architecture that does not support named
7714 sections.
7715
7716 Enabled for x86 at levels @option{-O2}, @option{-O3}.
7717
7718 @item -freorder-functions
7719 @opindex freorder-functions
7720 Reorder functions in the object file in order to
7721 improve code locality. This is implemented by using special
7722 subsections @code{.text.hot} for most frequently executed functions and
7723 @code{.text.unlikely} for unlikely executed functions. Reordering is done by
7724 the linker so object file format must support named sections and linker must
7725 place them in a reasonable way.
7726
7727 Also profile feedback must be available to make this option effective. See
7728 @option{-fprofile-arcs} for details.
7729
7730 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
7731
7732 @item -fstrict-aliasing
7733 @opindex fstrict-aliasing
7734 Allow the compiler to assume the strictest aliasing rules applicable to
7735 the language being compiled. For C (and C++), this activates
7736 optimizations based on the type of expressions. In particular, an
7737 object of one type is assumed never to reside at the same address as an
7738 object of a different type, unless the types are almost the same. For
7739 example, an @code{unsigned int} can alias an @code{int}, but not a
7740 @code{void*} or a @code{double}. A character type may alias any other
7741 type.
7742
7743 @anchor{Type-punning}Pay special attention to code like this:
7744 @smallexample
7745 union a_union @{
7746 int i;
7747 double d;
7748 @};
7749
7750 int f() @{
7751 union a_union t;
7752 t.d = 3.0;
7753 return t.i;
7754 @}
7755 @end smallexample
7756 The practice of reading from a different union member than the one most
7757 recently written to (called ``type-punning'') is common. Even with
7758 @option{-fstrict-aliasing}, type-punning is allowed, provided the memory
7759 is accessed through the union type. So, the code above works as
7760 expected. @xref{Structures unions enumerations and bit-fields
7761 implementation}. However, this code might not:
7762 @smallexample
7763 int f() @{
7764 union a_union t;
7765 int* ip;
7766 t.d = 3.0;
7767 ip = &t.i;
7768 return *ip;
7769 @}
7770 @end smallexample
7771
7772 Similarly, access by taking the address, casting the resulting pointer
7773 and dereferencing the result has undefined behavior, even if the cast
7774 uses a union type, e.g.:
7775 @smallexample
7776 int f() @{
7777 double d = 3.0;
7778 return ((union a_union *) &d)->i;
7779 @}
7780 @end smallexample
7781
7782 The @option{-fstrict-aliasing} option is enabled at levels
7783 @option{-O2}, @option{-O3}, @option{-Os}.
7784
7785 @item -fstrict-overflow
7786 @opindex fstrict-overflow
7787 Allow the compiler to assume strict signed overflow rules, depending
7788 on the language being compiled. For C (and C++) this means that
7789 overflow when doing arithmetic with signed numbers is undefined, which
7790 means that the compiler may assume that it does not happen. This
7791 permits various optimizations. For example, the compiler assumes
7792 that an expression like @code{i + 10 > i} is always true for
7793 signed @code{i}. This assumption is only valid if signed overflow is
7794 undefined, as the expression is false if @code{i + 10} overflows when
7795 using twos complement arithmetic. When this option is in effect any
7796 attempt to determine whether an operation on signed numbers
7797 overflows must be written carefully to not actually involve overflow.
7798
7799 This option also allows the compiler to assume strict pointer
7800 semantics: given a pointer to an object, if adding an offset to that
7801 pointer does not produce a pointer to the same object, the addition is
7802 undefined. This permits the compiler to conclude that @code{p + u >
7803 p} is always true for a pointer @code{p} and unsigned integer
7804 @code{u}. This assumption is only valid because pointer wraparound is
7805 undefined, as the expression is false if @code{p + u} overflows using
7806 twos complement arithmetic.
7807
7808 See also the @option{-fwrapv} option. Using @option{-fwrapv} means
7809 that integer signed overflow is fully defined: it wraps. When
7810 @option{-fwrapv} is used, there is no difference between
7811 @option{-fstrict-overflow} and @option{-fno-strict-overflow} for
7812 integers. With @option{-fwrapv} certain types of overflow are
7813 permitted. For example, if the compiler gets an overflow when doing
7814 arithmetic on constants, the overflowed value can still be used with
7815 @option{-fwrapv}, but not otherwise.
7816
7817 The @option{-fstrict-overflow} option is enabled at levels
7818 @option{-O2}, @option{-O3}, @option{-Os}.
7819
7820 @item -falign-functions
7821 @itemx -falign-functions=@var{n}
7822 @opindex falign-functions
7823 Align the start of functions to the next power-of-two greater than
7824 @var{n}, skipping up to @var{n} bytes. For instance,
7825 @option{-falign-functions=32} aligns functions to the next 32-byte
7826 boundary, but @option{-falign-functions=24} aligns to the next
7827 32-byte boundary only if this can be done by skipping 23 bytes or less.
7828
7829 @option{-fno-align-functions} and @option{-falign-functions=1} are
7830 equivalent and mean that functions are not aligned.
7831
7832 Some assemblers only support this flag when @var{n} is a power of two;
7833 in that case, it is rounded up.
7834
7835 If @var{n} is not specified or is zero, use a machine-dependent default.
7836
7837 Enabled at levels @option{-O2}, @option{-O3}.
7838
7839 @item -falign-labels
7840 @itemx -falign-labels=@var{n}
7841 @opindex falign-labels
7842 Align all branch targets to a power-of-two boundary, skipping up to
7843 @var{n} bytes like @option{-falign-functions}. This option can easily
7844 make code slower, because it must insert dummy operations for when the
7845 branch target is reached in the usual flow of the code.
7846
7847 @option{-fno-align-labels} and @option{-falign-labels=1} are
7848 equivalent and mean that labels are not aligned.
7849
7850 If @option{-falign-loops} or @option{-falign-jumps} are applicable and
7851 are greater than this value, then their values are used instead.
7852
7853 If @var{n} is not specified or is zero, use a machine-dependent default
7854 which is very likely to be @samp{1}, meaning no alignment.
7855
7856 Enabled at levels @option{-O2}, @option{-O3}.
7857
7858 @item -falign-loops
7859 @itemx -falign-loops=@var{n}
7860 @opindex falign-loops
7861 Align loops to a power-of-two boundary, skipping up to @var{n} bytes
7862 like @option{-falign-functions}. If the loops are
7863 executed many times, this makes up for any execution of the dummy
7864 operations.
7865
7866 @option{-fno-align-loops} and @option{-falign-loops=1} are
7867 equivalent and mean that loops are not aligned.
7868
7869 If @var{n} is not specified or is zero, use a machine-dependent default.
7870
7871 Enabled at levels @option{-O2}, @option{-O3}.
7872
7873 @item -falign-jumps
7874 @itemx -falign-jumps=@var{n}
7875 @opindex falign-jumps
7876 Align branch targets to a power-of-two boundary, for branch targets
7877 where the targets can only be reached by jumping, skipping up to @var{n}
7878 bytes like @option{-falign-functions}. In this case, no dummy operations
7879 need be executed.
7880
7881 @option{-fno-align-jumps} and @option{-falign-jumps=1} are
7882 equivalent and mean that loops are not aligned.
7883
7884 If @var{n} is not specified or is zero, use a machine-dependent default.
7885
7886 Enabled at levels @option{-O2}, @option{-O3}.
7887
7888 @item -funit-at-a-time
7889 @opindex funit-at-a-time
7890 This option is left for compatibility reasons. @option{-funit-at-a-time}
7891 has no effect, while @option{-fno-unit-at-a-time} implies
7892 @option{-fno-toplevel-reorder} and @option{-fno-section-anchors}.
7893
7894 Enabled by default.
7895
7896 @item -fno-toplevel-reorder
7897 @opindex fno-toplevel-reorder
7898 Do not reorder top-level functions, variables, and @code{asm}
7899 statements. Output them in the same order that they appear in the
7900 input file. When this option is used, unreferenced static variables
7901 are not removed. This option is intended to support existing code
7902 that relies on a particular ordering. For new code, it is better to
7903 use attributes when possible.
7904
7905 Enabled at level @option{-O0}. When disabled explicitly, it also implies
7906 @option{-fno-section-anchors}, which is otherwise enabled at @option{-O0} on some
7907 targets.
7908
7909 @item -fweb
7910 @opindex fweb
7911 Constructs webs as commonly used for register allocation purposes and assign
7912 each web individual pseudo register. This allows the register allocation pass
7913 to operate on pseudos directly, but also strengthens several other optimization
7914 passes, such as CSE, loop optimizer and trivial dead code remover. It can,
7915 however, make debugging impossible, since variables no longer stay in a
7916 ``home register''.
7917
7918 Enabled by default with @option{-funroll-loops}.
7919
7920 @item -fwhole-program
7921 @opindex fwhole-program
7922 Assume that the current compilation unit represents the whole program being
7923 compiled. All public functions and variables with the exception of @code{main}
7924 and those merged by attribute @code{externally_visible} become static functions
7925 and in effect are optimized more aggressively by interprocedural optimizers.
7926
7927 This option should not be used in combination with @option{-flto}.
7928 Instead relying on a linker plugin should provide safer and more precise
7929 information.
7930
7931 @item -flto[=@var{n}]
7932 @opindex flto
7933 This option runs the standard link-time optimizer. When invoked
7934 with source code, it generates GIMPLE (one of GCC's internal
7935 representations) and writes it to special ELF sections in the object
7936 file. When the object files are linked together, all the function
7937 bodies are read from these ELF sections and instantiated as if they
7938 had been part of the same translation unit.
7939
7940 To use the link-time optimizer, @option{-flto} and optimization
7941 options should be specified at compile time and during the final link.
7942 It is recommended that you compile all the files participating in the
7943 same link with the same options and also specify those options at
7944 link time.
7945 For example:
7946
7947 @smallexample
7948 gcc -c -O2 -flto foo.c
7949 gcc -c -O2 -flto bar.c
7950 gcc -o myprog -flto -O2 foo.o bar.o
7951 @end smallexample
7952
7953 The first two invocations to GCC save a bytecode representation
7954 of GIMPLE into special ELF sections inside @file{foo.o} and
7955 @file{bar.o}. The final invocation reads the GIMPLE bytecode from
7956 @file{foo.o} and @file{bar.o}, merges the two files into a single
7957 internal image, and compiles the result as usual. Since both
7958 @file{foo.o} and @file{bar.o} are merged into a single image, this
7959 causes all the interprocedural analyses and optimizations in GCC to
7960 work across the two files as if they were a single one. This means,
7961 for example, that the inliner is able to inline functions in
7962 @file{bar.o} into functions in @file{foo.o} and vice-versa.
7963
7964 Another (simpler) way to enable link-time optimization is:
7965
7966 @smallexample
7967 gcc -o myprog -flto -O2 foo.c bar.c
7968 @end smallexample
7969
7970 The above generates bytecode for @file{foo.c} and @file{bar.c},
7971 merges them together into a single GIMPLE representation and optimizes
7972 them as usual to produce @file{myprog}.
7973
7974 The only important thing to keep in mind is that to enable link-time
7975 optimizations you need to use the GCC driver to perform the link step.
7976 GCC then automatically performs link-time optimization if any of the
7977 objects involved were compiled with the @option{-flto} command-line option.
7978 You generally
7979 should specify the optimization options to be used for link-time
7980 optimization though GCC tries to be clever at guessing an
7981 optimization level to use from the options used at compile time
7982 if you fail to specify one at link time. You can always override
7983 the automatic decision to do link-time optimization at link time
7984 by passing @option{-fno-lto} to the link command.
7985
7986 To make whole program optimization effective, it is necessary to make
7987 certain whole program assumptions. The compiler needs to know
7988 what functions and variables can be accessed by libraries and runtime
7989 outside of the link-time optimized unit. When supported by the linker,
7990 the linker plugin (see @option{-fuse-linker-plugin}) passes information
7991 to the compiler about used and externally visible symbols. When
7992 the linker plugin is not available, @option{-fwhole-program} should be
7993 used to allow the compiler to make these assumptions, which leads
7994 to more aggressive optimization decisions.
7995
7996 When @option{-fuse-linker-plugin} is not enabled, when a file is
7997 compiled with @option{-flto}, the generated object file is larger than
7998 a regular object file because it contains GIMPLE bytecodes and the usual
7999 final code (see @option{-ffat-lto-objects}. This means that
8000 object files with LTO information can be linked as normal object
8001 files; if @option{-fno-lto} is passed to the linker, no
8002 interprocedural optimizations are applied. Note that when
8003 @option{-fno-fat-lto-objects} is enabled the compile stage is faster
8004 but you cannot perform a regular, non-LTO link on them.
8005
8006 Additionally, the optimization flags used to compile individual files
8007 are not necessarily related to those used at link time. For instance,
8008
8009 @smallexample
8010 gcc -c -O0 -ffat-lto-objects -flto foo.c
8011 gcc -c -O0 -ffat-lto-objects -flto bar.c
8012 gcc -o myprog -O3 foo.o bar.o
8013 @end smallexample
8014
8015 This produces individual object files with unoptimized assembler
8016 code, but the resulting binary @file{myprog} is optimized at
8017 @option{-O3}. If, instead, the final binary is generated with
8018 @option{-fno-lto}, then @file{myprog} is not optimized.
8019
8020 When producing the final binary, GCC only
8021 applies link-time optimizations to those files that contain bytecode.
8022 Therefore, you can mix and match object files and libraries with
8023 GIMPLE bytecodes and final object code. GCC automatically selects
8024 which files to optimize in LTO mode and which files to link without
8025 further processing.
8026
8027 There are some code generation flags preserved by GCC when
8028 generating bytecodes, as they need to be used during the final link
8029 stage. Generally options specified at link time override those
8030 specified at compile time.
8031
8032 If you do not specify an optimization level option @option{-O} at
8033 link time, then GCC uses the highest optimization level
8034 used when compiling the object files.
8035
8036 Currently, the following options and their settings are taken from
8037 the first object file that explicitly specifies them:
8038 @option{-fPIC}, @option{-fpic}, @option{-fpie}, @option{-fcommon},
8039 @option{-fexceptions}, @option{-fnon-call-exceptions}, @option{-fgnu-tm}
8040 and all the @option{-m} target flags.
8041
8042 Certain ABI-changing flags are required to match in all compilation units,
8043 and trying to override this at link time with a conflicting value
8044 is ignored. This includes options such as @option{-freg-struct-return}
8045 and @option{-fpcc-struct-return}.
8046
8047 Other options such as @option{-ffp-contract}, @option{-fno-strict-overflow},
8048 @option{-fwrapv}, @option{-fno-trapv} or @option{-fno-strict-aliasing}
8049 are passed through to the link stage and merged conservatively for
8050 conflicting translation units. Specifically
8051 @option{-fno-strict-overflow}, @option{-fwrapv} and @option{-fno-trapv} take
8052 precedence; and for example @option{-ffp-contract=off} takes precedence
8053 over @option{-ffp-contract=fast}. You can override them at link time.
8054
8055 If LTO encounters objects with C linkage declared with incompatible
8056 types in separate translation units to be linked together (undefined
8057 behavior according to ISO C99 6.2.7), a non-fatal diagnostic may be
8058 issued. The behavior is still undefined at run time. Similar
8059 diagnostics may be raised for other languages.
8060
8061 Another feature of LTO is that it is possible to apply interprocedural
8062 optimizations on files written in different languages:
8063
8064 @smallexample
8065 gcc -c -flto foo.c
8066 g++ -c -flto bar.cc
8067 gfortran -c -flto baz.f90
8068 g++ -o myprog -flto -O3 foo.o bar.o baz.o -lgfortran
8069 @end smallexample
8070
8071 Notice that the final link is done with @command{g++} to get the C++
8072 runtime libraries and @option{-lgfortran} is added to get the Fortran
8073 runtime libraries. In general, when mixing languages in LTO mode, you
8074 should use the same link command options as when mixing languages in a
8075 regular (non-LTO) compilation.
8076
8077 If object files containing GIMPLE bytecode are stored in a library archive, say
8078 @file{libfoo.a}, it is possible to extract and use them in an LTO link if you
8079 are using a linker with plugin support. To create static libraries suitable
8080 for LTO, use @command{gcc-ar} and @command{gcc-ranlib} instead of @command{ar}
8081 and @command{ranlib};
8082 to show the symbols of object files with GIMPLE bytecode, use
8083 @command{gcc-nm}. Those commands require that @command{ar}, @command{ranlib}
8084 and @command{nm} have been compiled with plugin support. At link time, use the the
8085 flag @option{-fuse-linker-plugin} to ensure that the library participates in
8086 the LTO optimization process:
8087
8088 @smallexample
8089 gcc -o myprog -O2 -flto -fuse-linker-plugin a.o b.o -lfoo
8090 @end smallexample
8091
8092 With the linker plugin enabled, the linker extracts the needed
8093 GIMPLE files from @file{libfoo.a} and passes them on to the running GCC
8094 to make them part of the aggregated GIMPLE image to be optimized.
8095
8096 If you are not using a linker with plugin support and/or do not
8097 enable the linker plugin, then the objects inside @file{libfoo.a}
8098 are extracted and linked as usual, but they do not participate
8099 in the LTO optimization process. In order to make a static library suitable
8100 for both LTO optimization and usual linkage, compile its object files with
8101 @option{-flto} @option{-ffat-lto-objects}.
8102
8103 Link-time optimizations do not require the presence of the whole program to
8104 operate. If the program does not require any symbols to be exported, it is
8105 possible to combine @option{-flto} and @option{-fwhole-program} to allow
8106 the interprocedural optimizers to use more aggressive assumptions which may
8107 lead to improved optimization opportunities.
8108 Use of @option{-fwhole-program} is not needed when linker plugin is
8109 active (see @option{-fuse-linker-plugin}).
8110
8111 The current implementation of LTO makes no
8112 attempt to generate bytecode that is portable between different
8113 types of hosts. The bytecode files are versioned and there is a
8114 strict version check, so bytecode files generated in one version of
8115 GCC do not work with an older or newer version of GCC.
8116
8117 Link-time optimization does not work well with generation of debugging
8118 information. Combining @option{-flto} with
8119 @option{-g} is currently experimental and expected to produce unexpected
8120 results.
8121
8122 If you specify the optional @var{n}, the optimization and code
8123 generation done at link time is executed in parallel using @var{n}
8124 parallel jobs by utilizing an installed @command{make} program. The
8125 environment variable @env{MAKE} may be used to override the program
8126 used. The default value for @var{n} is 1.
8127
8128 You can also specify @option{-flto=jobserver} to use GNU make's
8129 job server mode to determine the number of parallel jobs. This
8130 is useful when the Makefile calling GCC is already executing in parallel.
8131 You must prepend a @samp{+} to the command recipe in the parent Makefile
8132 for this to work. This option likely only works if @env{MAKE} is
8133 GNU make.
8134
8135 @item -flto-partition=@var{alg}
8136 @opindex flto-partition
8137 Specify the partitioning algorithm used by the link-time optimizer.
8138 The value is either @samp{1to1} to specify a partitioning mirroring
8139 the original source files or @samp{balanced} to specify partitioning
8140 into equally sized chunks (whenever possible) or @samp{max} to create
8141 new partition for every symbol where possible. Specifying @samp{none}
8142 as an algorithm disables partitioning and streaming completely.
8143 The default value is @samp{balanced}. While @samp{1to1} can be used
8144 as an workaround for various code ordering issues, the @samp{max}
8145 partitioning is intended for internal testing only.
8146 The value @samp{one} specifies that exactly one partition should be
8147 used while the value @samp{none} bypasses partitioning and executes
8148 the link-time optimization step directly from the WPA phase.
8149
8150 @item -flto-odr-type-merging
8151 @opindex flto-odr-type-merging
8152 Enable streaming of mangled types names of C++ types and their unification
8153 at link time. This increases size of LTO object files, but enables
8154 diagnostics about One Definition Rule violations.
8155
8156 @item -flto-compression-level=@var{n}
8157 @opindex flto-compression-level
8158 This option specifies the level of compression used for intermediate
8159 language written to LTO object files, and is only meaningful in
8160 conjunction with LTO mode (@option{-flto}). Valid
8161 values are 0 (no compression) to 9 (maximum compression). Values
8162 outside this range are clamped to either 0 or 9. If the option is not
8163 given, a default balanced compression setting is used.
8164
8165 @item -fuse-linker-plugin
8166 @opindex fuse-linker-plugin
8167 Enables the use of a linker plugin during link-time optimization. This
8168 option relies on plugin support in the linker, which is available in gold
8169 or in GNU ld 2.21 or newer.
8170
8171 This option enables the extraction of object files with GIMPLE bytecode out
8172 of library archives. This improves the quality of optimization by exposing
8173 more code to the link-time optimizer. This information specifies what
8174 symbols can be accessed externally (by non-LTO object or during dynamic
8175 linking). Resulting code quality improvements on binaries (and shared
8176 libraries that use hidden visibility) are similar to @option{-fwhole-program}.
8177 See @option{-flto} for a description of the effect of this flag and how to
8178 use it.
8179
8180 This option is enabled by default when LTO support in GCC is enabled
8181 and GCC was configured for use with
8182 a linker supporting plugins (GNU ld 2.21 or newer or gold).
8183
8184 @item -ffat-lto-objects
8185 @opindex ffat-lto-objects
8186 Fat LTO objects are object files that contain both the intermediate language
8187 and the object code. This makes them usable for both LTO linking and normal
8188 linking. This option is effective only when compiling with @option{-flto}
8189 and is ignored at link time.
8190
8191 @option{-fno-fat-lto-objects} improves compilation time over plain LTO, but
8192 requires the complete toolchain to be aware of LTO. It requires a linker with
8193 linker plugin support for basic functionality. Additionally,
8194 @command{nm}, @command{ar} and @command{ranlib}
8195 need to support linker plugins to allow a full-featured build environment
8196 (capable of building static libraries etc). GCC provides the @command{gcc-ar},
8197 @command{gcc-nm}, @command{gcc-ranlib} wrappers to pass the right options
8198 to these tools. With non fat LTO makefiles need to be modified to use them.
8199
8200 The default is @option{-fno-fat-lto-objects} on targets with linker plugin
8201 support.
8202
8203 @item -fcompare-elim
8204 @opindex fcompare-elim
8205 After register allocation and post-register allocation instruction splitting,
8206 identify arithmetic instructions that compute processor flags similar to a
8207 comparison operation based on that arithmetic. If possible, eliminate the
8208 explicit comparison operation.
8209
8210 This pass only applies to certain targets that cannot explicitly represent
8211 the comparison operation before register allocation is complete.
8212
8213 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
8214
8215 @item -fcprop-registers
8216 @opindex fcprop-registers
8217 After register allocation and post-register allocation instruction splitting,
8218 perform a copy-propagation pass to try to reduce scheduling dependencies
8219 and occasionally eliminate the copy.
8220
8221 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
8222
8223 @item -fprofile-correction
8224 @opindex fprofile-correction
8225 Profiles collected using an instrumented binary for multi-threaded programs may
8226 be inconsistent due to missed counter updates. When this option is specified,
8227 GCC uses heuristics to correct or smooth out such inconsistencies. By
8228 default, GCC emits an error message when an inconsistent profile is detected.
8229
8230 @item -fprofile-use
8231 @itemx -fprofile-use=@var{path}
8232 @opindex fprofile-use
8233 Enable profile feedback-directed optimizations,
8234 and the following optimizations
8235 which are generally profitable only with profile feedback available:
8236 @option{-fbranch-probabilities}, @option{-fvpt},
8237 @option{-funroll-loops}, @option{-fpeel-loops}, @option{-ftracer},
8238 @option{-ftree-vectorize}, and @option{ftree-loop-distribute-patterns}.
8239
8240 Before you can use this option, you must first generate profiling information.
8241 @xref{Optimize Options}, for information about the @option{-fprofile-generate}
8242 option.
8243
8244 By default, GCC emits an error message if the feedback profiles do not
8245 match the source code. This error can be turned into a warning by using
8246 @option{-Wcoverage-mismatch}. Note this may result in poorly optimized
8247 code.
8248
8249 If @var{path} is specified, GCC looks at the @var{path} to find
8250 the profile feedback data files. See @option{-fprofile-dir}.
8251
8252 @item -fauto-profile
8253 @itemx -fauto-profile=@var{path}
8254 @opindex fauto-profile
8255 Enable sampling-based feedback-directed optimizations,
8256 and the following optimizations
8257 which are generally profitable only with profile feedback available:
8258 @option{-fbranch-probabilities}, @option{-fvpt},
8259 @option{-funroll-loops}, @option{-fpeel-loops}, @option{-ftracer},
8260 @option{-ftree-vectorize},
8261 @option{-finline-functions}, @option{-fipa-cp}, @option{-fipa-cp-clone},
8262 @option{-fpredictive-commoning}, @option{-funswitch-loops},
8263 @option{-fgcse-after-reload}, and @option{-ftree-loop-distribute-patterns}.
8264
8265 @var{path} is the name of a file containing AutoFDO profile information.
8266 If omitted, it defaults to @file{fbdata.afdo} in the current directory.
8267
8268 Producing an AutoFDO profile data file requires running your program
8269 with the @command{perf} utility on a supported GNU/Linux target system.
8270 For more information, see @uref{https://perf.wiki.kernel.org/}.
8271
8272 E.g.
8273 @smallexample
8274 perf record -e br_inst_retired:near_taken -b -o perf.data \
8275 -- your_program
8276 @end smallexample
8277
8278 Then use the @command{create_gcov} tool to convert the raw profile data
8279 to a format that can be used by GCC.@ You must also supply the
8280 unstripped binary for your program to this tool.
8281 See @uref{https://github.com/google/autofdo}.
8282
8283 E.g.
8284 @smallexample
8285 create_gcov --binary=your_program.unstripped --profile=perf.data \
8286 --gcov=profile.afdo
8287 @end smallexample
8288 @end table
8289
8290 The following options control compiler behavior regarding floating-point
8291 arithmetic. These options trade off between speed and
8292 correctness. All must be specifically enabled.
8293
8294 @table @gcctabopt
8295 @item -ffloat-store
8296 @opindex ffloat-store
8297 Do not store floating-point variables in registers, and inhibit other
8298 options that might change whether a floating-point value is taken from a
8299 register or memory.
8300
8301 @cindex floating-point precision
8302 This option prevents undesirable excess precision on machines such as
8303 the 68000 where the floating registers (of the 68881) keep more
8304 precision than a @code{double} is supposed to have. Similarly for the
8305 x86 architecture. For most programs, the excess precision does only
8306 good, but a few programs rely on the precise definition of IEEE floating
8307 point. Use @option{-ffloat-store} for such programs, after modifying
8308 them to store all pertinent intermediate computations into variables.
8309
8310 @item -fexcess-precision=@var{style}
8311 @opindex fexcess-precision
8312 This option allows further control over excess precision on machines
8313 where floating-point registers have more precision than the IEEE
8314 @code{float} and @code{double} types and the processor does not
8315 support operations rounding to those types. By default,
8316 @option{-fexcess-precision=fast} is in effect; this means that
8317 operations are carried out in the precision of the registers and that
8318 it is unpredictable when rounding to the types specified in the source
8319 code takes place. When compiling C, if
8320 @option{-fexcess-precision=standard} is specified then excess
8321 precision follows the rules specified in ISO C99; in particular,
8322 both casts and assignments cause values to be rounded to their
8323 semantic types (whereas @option{-ffloat-store} only affects
8324 assignments). This option is enabled by default for C if a strict
8325 conformance option such as @option{-std=c99} is used.
8326
8327 @opindex mfpmath
8328 @option{-fexcess-precision=standard} is not implemented for languages
8329 other than C, and has no effect if
8330 @option{-funsafe-math-optimizations} or @option{-ffast-math} is
8331 specified. On the x86, it also has no effect if @option{-mfpmath=sse}
8332 or @option{-mfpmath=sse+387} is specified; in the former case, IEEE
8333 semantics apply without excess precision, and in the latter, rounding
8334 is unpredictable.
8335
8336 @item -ffast-math
8337 @opindex ffast-math
8338 Sets the options @option{-fno-math-errno}, @option{-funsafe-math-optimizations},
8339 @option{-ffinite-math-only}, @option{-fno-rounding-math},
8340 @option{-fno-signaling-nans} and @option{-fcx-limited-range}.
8341
8342 This option causes the preprocessor macro @code{__FAST_MATH__} to be defined.
8343
8344 This option is not turned on by any @option{-O} option besides
8345 @option{-Ofast} since it can result in incorrect output for programs
8346 that depend on an exact implementation of IEEE or ISO rules/specifications
8347 for math functions. It may, however, yield faster code for programs
8348 that do not require the guarantees of these specifications.
8349
8350 @item -fno-math-errno
8351 @opindex fno-math-errno
8352 Do not set @code{errno} after calling math functions that are executed
8353 with a single instruction, e.g., @code{sqrt}. A program that relies on
8354 IEEE exceptions for math error handling may want to use this flag
8355 for speed while maintaining IEEE arithmetic compatibility.
8356
8357 This option is not turned on by any @option{-O} option since
8358 it can result in incorrect output for programs that depend on
8359 an exact implementation of IEEE or ISO rules/specifications for
8360 math functions. It may, however, yield faster code for programs
8361 that do not require the guarantees of these specifications.
8362
8363 The default is @option{-fmath-errno}.
8364
8365 On Darwin systems, the math library never sets @code{errno}. There is
8366 therefore no reason for the compiler to consider the possibility that
8367 it might, and @option{-fno-math-errno} is the default.
8368
8369 @item -funsafe-math-optimizations
8370 @opindex funsafe-math-optimizations
8371
8372 Allow optimizations for floating-point arithmetic that (a) assume
8373 that arguments and results are valid and (b) may violate IEEE or
8374 ANSI standards. When used at link time, it may include libraries
8375 or startup files that change the default FPU control word or other
8376 similar optimizations.
8377
8378 This option is not turned on by any @option{-O} option since
8379 it can result in incorrect output for programs that depend on
8380 an exact implementation of IEEE or ISO rules/specifications for
8381 math functions. It may, however, yield faster code for programs
8382 that do not require the guarantees of these specifications.
8383 Enables @option{-fno-signed-zeros}, @option{-fno-trapping-math},
8384 @option{-fassociative-math} and @option{-freciprocal-math}.
8385
8386 The default is @option{-fno-unsafe-math-optimizations}.
8387
8388 @item -fassociative-math
8389 @opindex fassociative-math
8390
8391 Allow re-association of operands in series of floating-point operations.
8392 This violates the ISO C and C++ language standard by possibly changing
8393 computation result. NOTE: re-ordering may change the sign of zero as
8394 well as ignore NaNs and inhibit or create underflow or overflow (and
8395 thus cannot be used on code that relies on rounding behavior like
8396 @code{(x + 2**52) - 2**52}. May also reorder floating-point comparisons
8397 and thus may not be used when ordered comparisons are required.
8398 This option requires that both @option{-fno-signed-zeros} and
8399 @option{-fno-trapping-math} be in effect. Moreover, it doesn't make
8400 much sense with @option{-frounding-math}. For Fortran the option
8401 is automatically enabled when both @option{-fno-signed-zeros} and
8402 @option{-fno-trapping-math} are in effect.
8403
8404 The default is @option{-fno-associative-math}.
8405
8406 @item -freciprocal-math
8407 @opindex freciprocal-math
8408
8409 Allow the reciprocal of a value to be used instead of dividing by
8410 the value if this enables optimizations. For example @code{x / y}
8411 can be replaced with @code{x * (1/y)}, which is useful if @code{(1/y)}
8412 is subject to common subexpression elimination. Note that this loses
8413 precision and increases the number of flops operating on the value.
8414
8415 The default is @option{-fno-reciprocal-math}.
8416
8417 @item -ffinite-math-only
8418 @opindex ffinite-math-only
8419 Allow optimizations for floating-point arithmetic that assume
8420 that arguments and results are not NaNs or +-Infs.
8421
8422 This option is not turned on by any @option{-O} option since
8423 it can result in incorrect output for programs that depend on
8424 an exact implementation of IEEE or ISO rules/specifications for
8425 math functions. It may, however, yield faster code for programs
8426 that do not require the guarantees of these specifications.
8427
8428 The default is @option{-fno-finite-math-only}.
8429
8430 @item -fno-signed-zeros
8431 @opindex fno-signed-zeros
8432 Allow optimizations for floating-point arithmetic that ignore the
8433 signedness of zero. IEEE arithmetic specifies the behavior of
8434 distinct +0.0 and @minus{}0.0 values, which then prohibits simplification
8435 of expressions such as x+0.0 or 0.0*x (even with @option{-ffinite-math-only}).
8436 This option implies that the sign of a zero result isn't significant.
8437
8438 The default is @option{-fsigned-zeros}.
8439
8440 @item -fno-trapping-math
8441 @opindex fno-trapping-math
8442 Compile code assuming that floating-point operations cannot generate
8443 user-visible traps. These traps include division by zero, overflow,
8444 underflow, inexact result and invalid operation. This option requires
8445 that @option{-fno-signaling-nans} be in effect. Setting this option may
8446 allow faster code if one relies on ``non-stop'' IEEE arithmetic, for example.
8447
8448 This option should never be turned on by any @option{-O} option since
8449 it can result in incorrect output for programs that depend on
8450 an exact implementation of IEEE or ISO rules/specifications for
8451 math functions.
8452
8453 The default is @option{-ftrapping-math}.
8454
8455 @item -frounding-math
8456 @opindex frounding-math
8457 Disable transformations and optimizations that assume default floating-point
8458 rounding behavior. This is round-to-zero for all floating point
8459 to integer conversions, and round-to-nearest for all other arithmetic
8460 truncations. This option should be specified for programs that change
8461 the FP rounding mode dynamically, or that may be executed with a
8462 non-default rounding mode. This option disables constant folding of
8463 floating-point expressions at compile time (which may be affected by
8464 rounding mode) and arithmetic transformations that are unsafe in the
8465 presence of sign-dependent rounding modes.
8466
8467 The default is @option{-fno-rounding-math}.
8468
8469 This option is experimental and does not currently guarantee to
8470 disable all GCC optimizations that are affected by rounding mode.
8471 Future versions of GCC may provide finer control of this setting
8472 using C99's @code{FENV_ACCESS} pragma. This command-line option
8473 will be used to specify the default state for @code{FENV_ACCESS}.
8474
8475 @item -fsignaling-nans
8476 @opindex fsignaling-nans
8477 Compile code assuming that IEEE signaling NaNs may generate user-visible
8478 traps during floating-point operations. Setting this option disables
8479 optimizations that may change the number of exceptions visible with
8480 signaling NaNs. This option implies @option{-ftrapping-math}.
8481
8482 This option causes the preprocessor macro @code{__SUPPORT_SNAN__} to
8483 be defined.
8484
8485 The default is @option{-fno-signaling-nans}.
8486
8487 This option is experimental and does not currently guarantee to
8488 disable all GCC optimizations that affect signaling NaN behavior.
8489
8490 @item -fsingle-precision-constant
8491 @opindex fsingle-precision-constant
8492 Treat floating-point constants as single precision instead of
8493 implicitly converting them to double-precision constants.
8494
8495 @item -fcx-limited-range
8496 @opindex fcx-limited-range
8497 When enabled, this option states that a range reduction step is not
8498 needed when performing complex division. Also, there is no checking
8499 whether the result of a complex multiplication or division is @code{NaN
8500 + I*NaN}, with an attempt to rescue the situation in that case. The
8501 default is @option{-fno-cx-limited-range}, but is enabled by
8502 @option{-ffast-math}.
8503
8504 This option controls the default setting of the ISO C99
8505 @code{CX_LIMITED_RANGE} pragma. Nevertheless, the option applies to
8506 all languages.
8507
8508 @item -fcx-fortran-rules
8509 @opindex fcx-fortran-rules
8510 Complex multiplication and division follow Fortran rules. Range
8511 reduction is done as part of complex division, but there is no checking
8512 whether the result of a complex multiplication or division is @code{NaN
8513 + I*NaN}, with an attempt to rescue the situation in that case.
8514
8515 The default is @option{-fno-cx-fortran-rules}.
8516
8517 @end table
8518
8519 The following options control optimizations that may improve
8520 performance, but are not enabled by any @option{-O} options. This
8521 section includes experimental options that may produce broken code.
8522
8523 @table @gcctabopt
8524 @item -fbranch-probabilities
8525 @opindex fbranch-probabilities
8526 After running a program compiled with @option{-fprofile-arcs}
8527 (@pxref{Instrumentation Options}),
8528 you can compile it a second time using
8529 @option{-fbranch-probabilities}, to improve optimizations based on
8530 the number of times each branch was taken. When a program
8531 compiled with @option{-fprofile-arcs} exits, it saves arc execution
8532 counts to a file called @file{@var{sourcename}.gcda} for each source
8533 file. The information in this data file is very dependent on the
8534 structure of the generated code, so you must use the same source code
8535 and the same optimization options for both compilations.
8536
8537 With @option{-fbranch-probabilities}, GCC puts a
8538 @samp{REG_BR_PROB} note on each @samp{JUMP_INSN} and @samp{CALL_INSN}.
8539 These can be used to improve optimization. Currently, they are only
8540 used in one place: in @file{reorg.c}, instead of guessing which path a
8541 branch is most likely to take, the @samp{REG_BR_PROB} values are used to
8542 exactly determine which path is taken more often.
8543
8544 @item -fprofile-values
8545 @opindex fprofile-values
8546 If combined with @option{-fprofile-arcs}, it adds code so that some
8547 data about values of expressions in the program is gathered.
8548
8549 With @option{-fbranch-probabilities}, it reads back the data gathered
8550 from profiling values of expressions for usage in optimizations.
8551
8552 Enabled with @option{-fprofile-generate} and @option{-fprofile-use}.
8553
8554 @item -fprofile-reorder-functions
8555 @opindex fprofile-reorder-functions
8556 Function reordering based on profile instrumentation collects
8557 first time of execution of a function and orders these functions
8558 in ascending order.
8559
8560 Enabled with @option{-fprofile-use}.
8561
8562 @item -fvpt
8563 @opindex fvpt
8564 If combined with @option{-fprofile-arcs}, this option instructs the compiler
8565 to add code to gather information about values of expressions.
8566
8567 With @option{-fbranch-probabilities}, it reads back the data gathered
8568 and actually performs the optimizations based on them.
8569 Currently the optimizations include specialization of division operations
8570 using the knowledge about the value of the denominator.
8571
8572 @item -frename-registers
8573 @opindex frename-registers
8574 Attempt to avoid false dependencies in scheduled code by making use
8575 of registers left over after register allocation. This optimization
8576 most benefits processors with lots of registers. Depending on the
8577 debug information format adopted by the target, however, it can
8578 make debugging impossible, since variables no longer stay in
8579 a ``home register''.
8580
8581 Enabled by default with @option{-funroll-loops} and @option{-fpeel-loops}.
8582
8583 @item -fschedule-fusion
8584 @opindex fschedule-fusion
8585 Performs a target dependent pass over the instruction stream to schedule
8586 instructions of same type together because target machine can execute them
8587 more efficiently if they are adjacent to each other in the instruction flow.
8588
8589 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8590
8591 @item -ftracer
8592 @opindex ftracer
8593 Perform tail duplication to enlarge superblock size. This transformation
8594 simplifies the control flow of the function allowing other optimizations to do
8595 a better job.
8596
8597 Enabled with @option{-fprofile-use}.
8598
8599 @item -funroll-loops
8600 @opindex funroll-loops
8601 Unroll loops whose number of iterations can be determined at compile time or
8602 upon entry to the loop. @option{-funroll-loops} implies
8603 @option{-frerun-cse-after-loop}, @option{-fweb} and @option{-frename-registers}.
8604 It also turns on complete loop peeling (i.e.@: complete removal of loops with
8605 a small constant number of iterations). This option makes code larger, and may
8606 or may not make it run faster.
8607
8608 Enabled with @option{-fprofile-use}.
8609
8610 @item -funroll-all-loops
8611 @opindex funroll-all-loops
8612 Unroll all loops, even if their number of iterations is uncertain when
8613 the loop is entered. This usually makes programs run more slowly.
8614 @option{-funroll-all-loops} implies the same options as
8615 @option{-funroll-loops}.
8616
8617 @item -fpeel-loops
8618 @opindex fpeel-loops
8619 Peels loops for which there is enough information that they do not
8620 roll much (from profile feedback). It also turns on complete loop peeling
8621 (i.e.@: complete removal of loops with small constant number of iterations).
8622
8623 Enabled with @option{-fprofile-use}.
8624
8625 @item -fmove-loop-invariants
8626 @opindex fmove-loop-invariants
8627 Enables the loop invariant motion pass in the RTL loop optimizer. Enabled
8628 at level @option{-O1}
8629
8630 @item -funswitch-loops
8631 @opindex funswitch-loops
8632 Move branches with loop invariant conditions out of the loop, with duplicates
8633 of the loop on both branches (modified according to result of the condition).
8634
8635 @item -ffunction-sections
8636 @itemx -fdata-sections
8637 @opindex ffunction-sections
8638 @opindex fdata-sections
8639 Place each function or data item into its own section in the output
8640 file if the target supports arbitrary sections. The name of the
8641 function or the name of the data item determines the section's name
8642 in the output file.
8643
8644 Use these options on systems where the linker can perform optimizations
8645 to improve locality of reference in the instruction space. Most systems
8646 using the ELF object format and SPARC processors running Solaris 2 have
8647 linkers with such optimizations. AIX may have these optimizations in
8648 the future.
8649
8650 Only use these options when there are significant benefits from doing
8651 so. When you specify these options, the assembler and linker
8652 create larger object and executable files and are also slower.
8653 You cannot use @command{gprof} on all systems if you
8654 specify this option, and you may have problems with debugging if
8655 you specify both this option and @option{-g}.
8656
8657 @item -fbranch-target-load-optimize
8658 @opindex fbranch-target-load-optimize
8659 Perform branch target register load optimization before prologue / epilogue
8660 threading.
8661 The use of target registers can typically be exposed only during reload,
8662 thus hoisting loads out of loops and doing inter-block scheduling needs
8663 a separate optimization pass.
8664
8665 @item -fbranch-target-load-optimize2
8666 @opindex fbranch-target-load-optimize2
8667 Perform branch target register load optimization after prologue / epilogue
8668 threading.
8669
8670 @item -fbtr-bb-exclusive
8671 @opindex fbtr-bb-exclusive
8672 When performing branch target register load optimization, don't reuse
8673 branch target registers within any basic block.
8674
8675 @item -fstdarg-opt
8676 @opindex fstdarg-opt
8677 Optimize the prologue of variadic argument functions with respect to usage of
8678 those arguments.
8679
8680 @item -fsection-anchors
8681 @opindex fsection-anchors
8682 Try to reduce the number of symbolic address calculations by using
8683 shared ``anchor'' symbols to address nearby objects. This transformation
8684 can help to reduce the number of GOT entries and GOT accesses on some
8685 targets.
8686
8687 For example, the implementation of the following function @code{foo}:
8688
8689 @smallexample
8690 static int a, b, c;
8691 int foo (void) @{ return a + b + c; @}
8692 @end smallexample
8693
8694 @noindent
8695 usually calculates the addresses of all three variables, but if you
8696 compile it with @option{-fsection-anchors}, it accesses the variables
8697 from a common anchor point instead. The effect is similar to the
8698 following pseudocode (which isn't valid C):
8699
8700 @smallexample
8701 int foo (void)
8702 @{
8703 register int *xr = &x;
8704 return xr[&a - &x] + xr[&b - &x] + xr[&c - &x];
8705 @}
8706 @end smallexample
8707
8708 Not all targets support this option.
8709
8710 @item --param @var{name}=@var{value}
8711 @opindex param
8712 In some places, GCC uses various constants to control the amount of
8713 optimization that is done. For example, GCC does not inline functions
8714 that contain more than a certain number of instructions. You can
8715 control some of these constants on the command line using the
8716 @option{--param} option.
8717
8718 The names of specific parameters, and the meaning of the values, are
8719 tied to the internals of the compiler, and are subject to change
8720 without notice in future releases.
8721
8722 In each case, the @var{value} is an integer. The allowable choices for
8723 @var{name} are:
8724
8725 @table @gcctabopt
8726 @item predictable-branch-outcome
8727 When branch is predicted to be taken with probability lower than this threshold
8728 (in percent), then it is considered well predictable. The default is 10.
8729
8730 @item max-rtl-if-conversion-insns
8731 RTL if-conversion tries to remove conditional branches around a block and
8732 replace them with conditionally executed instructions. This parameter
8733 gives the maximum number of instructions in a block which should be
8734 considered for if-conversion. The default is 10, though the compiler will
8735 also use other heuristics to decide whether if-conversion is likely to be
8736 profitable.
8737
8738 @item max-crossjump-edges
8739 The maximum number of incoming edges to consider for cross-jumping.
8740 The algorithm used by @option{-fcrossjumping} is @math{O(N^2)} in
8741 the number of edges incoming to each block. Increasing values mean
8742 more aggressive optimization, making the compilation time increase with
8743 probably small improvement in executable size.
8744
8745 @item min-crossjump-insns
8746 The minimum number of instructions that must be matched at the end
8747 of two blocks before cross-jumping is performed on them. This
8748 value is ignored in the case where all instructions in the block being
8749 cross-jumped from are matched. The default value is 5.
8750
8751 @item max-grow-copy-bb-insns
8752 The maximum code size expansion factor when copying basic blocks
8753 instead of jumping. The expansion is relative to a jump instruction.
8754 The default value is 8.
8755
8756 @item max-goto-duplication-insns
8757 The maximum number of instructions to duplicate to a block that jumps
8758 to a computed goto. To avoid @math{O(N^2)} behavior in a number of
8759 passes, GCC factors computed gotos early in the compilation process,
8760 and unfactors them as late as possible. Only computed jumps at the
8761 end of a basic blocks with no more than max-goto-duplication-insns are
8762 unfactored. The default value is 8.
8763
8764 @item max-delay-slot-insn-search
8765 The maximum number of instructions to consider when looking for an
8766 instruction to fill a delay slot. If more than this arbitrary number of
8767 instructions are searched, the time savings from filling the delay slot
8768 are minimal, so stop searching. Increasing values mean more
8769 aggressive optimization, making the compilation time increase with probably
8770 small improvement in execution time.
8771
8772 @item max-delay-slot-live-search
8773 When trying to fill delay slots, the maximum number of instructions to
8774 consider when searching for a block with valid live register
8775 information. Increasing this arbitrarily chosen value means more
8776 aggressive optimization, increasing the compilation time. This parameter
8777 should be removed when the delay slot code is rewritten to maintain the
8778 control-flow graph.
8779
8780 @item max-gcse-memory
8781 The approximate maximum amount of memory that can be allocated in
8782 order to perform the global common subexpression elimination
8783 optimization. If more memory than specified is required, the
8784 optimization is not done.
8785
8786 @item max-gcse-insertion-ratio
8787 If the ratio of expression insertions to deletions is larger than this value
8788 for any expression, then RTL PRE inserts or removes the expression and thus
8789 leaves partially redundant computations in the instruction stream. The default value is 20.
8790
8791 @item max-pending-list-length
8792 The maximum number of pending dependencies scheduling allows
8793 before flushing the current state and starting over. Large functions
8794 with few branches or calls can create excessively large lists which
8795 needlessly consume memory and resources.
8796
8797 @item max-modulo-backtrack-attempts
8798 The maximum number of backtrack attempts the scheduler should make
8799 when modulo scheduling a loop. Larger values can exponentially increase
8800 compilation time.
8801
8802 @item max-inline-insns-single
8803 Several parameters control the tree inliner used in GCC@.
8804 This number sets the maximum number of instructions (counted in GCC's
8805 internal representation) in a single function that the tree inliner
8806 considers for inlining. This only affects functions declared
8807 inline and methods implemented in a class declaration (C++).
8808 The default value is 400.
8809
8810 @item max-inline-insns-auto
8811 When you use @option{-finline-functions} (included in @option{-O3}),
8812 a lot of functions that would otherwise not be considered for inlining
8813 by the compiler are investigated. To those functions, a different
8814 (more restrictive) limit compared to functions declared inline can
8815 be applied.
8816 The default value is 40.
8817
8818 @item inline-min-speedup
8819 When estimated performance improvement of caller + callee runtime exceeds this
8820 threshold (in precent), the function can be inlined regardless the limit on
8821 @option{--param max-inline-insns-single} and @option{--param
8822 max-inline-insns-auto}.
8823
8824 @item large-function-insns
8825 The limit specifying really large functions. For functions larger than this
8826 limit after inlining, inlining is constrained by
8827 @option{--param large-function-growth}. This parameter is useful primarily
8828 to avoid extreme compilation time caused by non-linear algorithms used by the
8829 back end.
8830 The default value is 2700.
8831
8832 @item large-function-growth
8833 Specifies maximal growth of large function caused by inlining in percents.
8834 The default value is 100 which limits large function growth to 2.0 times
8835 the original size.
8836
8837 @item large-unit-insns
8838 The limit specifying large translation unit. Growth caused by inlining of
8839 units larger than this limit is limited by @option{--param inline-unit-growth}.
8840 For small units this might be too tight.
8841 For example, consider a unit consisting of function A
8842 that is inline and B that just calls A three times. If B is small relative to
8843 A, the growth of unit is 300\% and yet such inlining is very sane. For very
8844 large units consisting of small inlineable functions, however, the overall unit
8845 growth limit is needed to avoid exponential explosion of code size. Thus for
8846 smaller units, the size is increased to @option{--param large-unit-insns}
8847 before applying @option{--param inline-unit-growth}. The default is 10000.
8848
8849 @item inline-unit-growth
8850 Specifies maximal overall growth of the compilation unit caused by inlining.
8851 The default value is 20 which limits unit growth to 1.2 times the original
8852 size. Cold functions (either marked cold via an attribute or by profile
8853 feedback) are not accounted into the unit size.
8854
8855 @item ipcp-unit-growth
8856 Specifies maximal overall growth of the compilation unit caused by
8857 interprocedural constant propagation. The default value is 10 which limits
8858 unit growth to 1.1 times the original size.
8859
8860 @item large-stack-frame
8861 The limit specifying large stack frames. While inlining the algorithm is trying
8862 to not grow past this limit too much. The default value is 256 bytes.
8863
8864 @item large-stack-frame-growth
8865 Specifies maximal growth of large stack frames caused by inlining in percents.
8866 The default value is 1000 which limits large stack frame growth to 11 times
8867 the original size.
8868
8869 @item max-inline-insns-recursive
8870 @itemx max-inline-insns-recursive-auto
8871 Specifies the maximum number of instructions an out-of-line copy of a
8872 self-recursive inline
8873 function can grow into by performing recursive inlining.
8874
8875 @option{--param max-inline-insns-recursive} applies to functions
8876 declared inline.
8877 For functions not declared inline, recursive inlining
8878 happens only when @option{-finline-functions} (included in @option{-O3}) is
8879 enabled; @option{--param max-inline-insns-recursive-auto} applies instead. The
8880 default value is 450.
8881
8882 @item max-inline-recursive-depth
8883 @itemx max-inline-recursive-depth-auto
8884 Specifies the maximum recursion depth used for recursive inlining.
8885
8886 @option{--param max-inline-recursive-depth} applies to functions
8887 declared inline. For functions not declared inline, recursive inlining
8888 happens only when @option{-finline-functions} (included in @option{-O3}) is
8889 enabled; @option{--param max-inline-recursive-depth-auto} applies instead. The
8890 default value is 8.
8891
8892 @item min-inline-recursive-probability
8893 Recursive inlining is profitable only for function having deep recursion
8894 in average and can hurt for function having little recursion depth by
8895 increasing the prologue size or complexity of function body to other
8896 optimizers.
8897
8898 When profile feedback is available (see @option{-fprofile-generate}) the actual
8899 recursion depth can be guessed from probability that function recurses via a
8900 given call expression. This parameter limits inlining only to call expressions
8901 whose probability exceeds the given threshold (in percents).
8902 The default value is 10.
8903
8904 @item early-inlining-insns
8905 Specify growth that the early inliner can make. In effect it increases
8906 the amount of inlining for code having a large abstraction penalty.
8907 The default value is 14.
8908
8909 @item max-early-inliner-iterations
8910 Limit of iterations of the early inliner. This basically bounds
8911 the number of nested indirect calls the early inliner can resolve.
8912 Deeper chains are still handled by late inlining.
8913
8914 @item comdat-sharing-probability
8915 Probability (in percent) that C++ inline function with comdat visibility
8916 are shared across multiple compilation units. The default value is 20.
8917
8918 @item profile-func-internal-id
8919 A parameter to control whether to use function internal id in profile
8920 database lookup. If the value is 0, the compiler uses an id that
8921 is based on function assembler name and filename, which makes old profile
8922 data more tolerant to source changes such as function reordering etc.
8923 The default value is 0.
8924
8925 @item min-vect-loop-bound
8926 The minimum number of iterations under which loops are not vectorized
8927 when @option{-ftree-vectorize} is used. The number of iterations after
8928 vectorization needs to be greater than the value specified by this option
8929 to allow vectorization. The default value is 0.
8930
8931 @item gcse-cost-distance-ratio
8932 Scaling factor in calculation of maximum distance an expression
8933 can be moved by GCSE optimizations. This is currently supported only in the
8934 code hoisting pass. The bigger the ratio, the more aggressive code hoisting
8935 is with simple expressions, i.e., the expressions that have cost
8936 less than @option{gcse-unrestricted-cost}. Specifying 0 disables
8937 hoisting of simple expressions. The default value is 10.
8938
8939 @item gcse-unrestricted-cost
8940 Cost, roughly measured as the cost of a single typical machine
8941 instruction, at which GCSE optimizations do not constrain
8942 the distance an expression can travel. This is currently
8943 supported only in the code hoisting pass. The lesser the cost,
8944 the more aggressive code hoisting is. Specifying 0
8945 allows all expressions to travel unrestricted distances.
8946 The default value is 3.
8947
8948 @item max-hoist-depth
8949 The depth of search in the dominator tree for expressions to hoist.
8950 This is used to avoid quadratic behavior in hoisting algorithm.
8951 The value of 0 does not limit on the search, but may slow down compilation
8952 of huge functions. The default value is 30.
8953
8954 @item max-tail-merge-comparisons
8955 The maximum amount of similar bbs to compare a bb with. This is used to
8956 avoid quadratic behavior in tree tail merging. The default value is 10.
8957
8958 @item max-tail-merge-iterations
8959 The maximum amount of iterations of the pass over the function. This is used to
8960 limit compilation time in tree tail merging. The default value is 2.
8961
8962 @item max-unrolled-insns
8963 The maximum number of instructions that a loop may have to be unrolled.
8964 If a loop is unrolled, this parameter also determines how many times
8965 the loop code is unrolled.
8966
8967 @item max-average-unrolled-insns
8968 The maximum number of instructions biased by probabilities of their execution
8969 that a loop may have to be unrolled. If a loop is unrolled,
8970 this parameter also determines how many times the loop code is unrolled.
8971
8972 @item max-unroll-times
8973 The maximum number of unrollings of a single loop.
8974
8975 @item max-peeled-insns
8976 The maximum number of instructions that a loop may have to be peeled.
8977 If a loop is peeled, this parameter also determines how many times
8978 the loop code is peeled.
8979
8980 @item max-peel-times
8981 The maximum number of peelings of a single loop.
8982
8983 @item max-peel-branches
8984 The maximum number of branches on the hot path through the peeled sequence.
8985
8986 @item max-completely-peeled-insns
8987 The maximum number of insns of a completely peeled loop.
8988
8989 @item max-completely-peel-times
8990 The maximum number of iterations of a loop to be suitable for complete peeling.
8991
8992 @item max-completely-peel-loop-nest-depth
8993 The maximum depth of a loop nest suitable for complete peeling.
8994
8995 @item max-unswitch-insns
8996 The maximum number of insns of an unswitched loop.
8997
8998 @item max-unswitch-level
8999 The maximum number of branches unswitched in a single loop.
9000
9001 @item lim-expensive
9002 The minimum cost of an expensive expression in the loop invariant motion.
9003
9004 @item iv-consider-all-candidates-bound
9005 Bound on number of candidates for induction variables, below which
9006 all candidates are considered for each use in induction variable
9007 optimizations. If there are more candidates than this,
9008 only the most relevant ones are considered to avoid quadratic time complexity.
9009
9010 @item iv-max-considered-uses
9011 The induction variable optimizations give up on loops that contain more
9012 induction variable uses.
9013
9014 @item iv-always-prune-cand-set-bound
9015 If the number of candidates in the set is smaller than this value,
9016 always try to remove unnecessary ivs from the set
9017 when adding a new one.
9018
9019 @item scev-max-expr-size
9020 Bound on size of expressions used in the scalar evolutions analyzer.
9021 Large expressions slow the analyzer.
9022
9023 @item scev-max-expr-complexity
9024 Bound on the complexity of the expressions in the scalar evolutions analyzer.
9025 Complex expressions slow the analyzer.
9026
9027 @item max-tree-if-conversion-phi-args
9028 Maximum number of arguments in a PHI supported by TREE if conversion
9029 unless the loop is marked with simd pragma.
9030
9031 @item vect-max-version-for-alignment-checks
9032 The maximum number of run-time checks that can be performed when
9033 doing loop versioning for alignment in the vectorizer.
9034
9035 @item vect-max-version-for-alias-checks
9036 The maximum number of run-time checks that can be performed when
9037 doing loop versioning for alias in the vectorizer.
9038
9039 @item vect-max-peeling-for-alignment
9040 The maximum number of loop peels to enhance access alignment
9041 for vectorizer. Value -1 means no limit.
9042
9043 @item max-iterations-to-track
9044 The maximum number of iterations of a loop the brute-force algorithm
9045 for analysis of the number of iterations of the loop tries to evaluate.
9046
9047 @item hot-bb-count-ws-permille
9048 A basic block profile count is considered hot if it contributes to
9049 the given permillage (i.e. 0...1000) of the entire profiled execution.
9050
9051 @item hot-bb-frequency-fraction
9052 Select fraction of the entry block frequency of executions of basic block in
9053 function given basic block needs to have to be considered hot.
9054
9055 @item max-predicted-iterations
9056 The maximum number of loop iterations we predict statically. This is useful
9057 in cases where a function contains a single loop with known bound and
9058 another loop with unknown bound.
9059 The known number of iterations is predicted correctly, while
9060 the unknown number of iterations average to roughly 10. This means that the
9061 loop without bounds appears artificially cold relative to the other one.
9062
9063 @item builtin-expect-probability
9064 Control the probability of the expression having the specified value. This
9065 parameter takes a percentage (i.e. 0 ... 100) as input.
9066 The default probability of 90 is obtained empirically.
9067
9068 @item align-threshold
9069
9070 Select fraction of the maximal frequency of executions of a basic block in
9071 a function to align the basic block.
9072
9073 @item align-loop-iterations
9074
9075 A loop expected to iterate at least the selected number of iterations is
9076 aligned.
9077
9078 @item tracer-dynamic-coverage
9079 @itemx tracer-dynamic-coverage-feedback
9080
9081 This value is used to limit superblock formation once the given percentage of
9082 executed instructions is covered. This limits unnecessary code size
9083 expansion.
9084
9085 The @option{tracer-dynamic-coverage-feedback} parameter
9086 is used only when profile
9087 feedback is available. The real profiles (as opposed to statically estimated
9088 ones) are much less balanced allowing the threshold to be larger value.
9089
9090 @item tracer-max-code-growth
9091 Stop tail duplication once code growth has reached given percentage. This is
9092 a rather artificial limit, as most of the duplicates are eliminated later in
9093 cross jumping, so it may be set to much higher values than is the desired code
9094 growth.
9095
9096 @item tracer-min-branch-ratio
9097
9098 Stop reverse growth when the reverse probability of best edge is less than this
9099 threshold (in percent).
9100
9101 @item tracer-min-branch-probability
9102 @itemx tracer-min-branch-probability-feedback
9103
9104 Stop forward growth if the best edge has probability lower than this
9105 threshold.
9106
9107 Similarly to @option{tracer-dynamic-coverage} two parameters are
9108 provided. @option{tracer-min-branch-probability-feedback} is used for
9109 compilation with profile feedback and @option{tracer-min-branch-probability}
9110 compilation without. The value for compilation with profile feedback
9111 needs to be more conservative (higher) in order to make tracer
9112 effective.
9113
9114 @item max-cse-path-length
9115
9116 The maximum number of basic blocks on path that CSE considers.
9117 The default is 10.
9118
9119 @item max-cse-insns
9120 The maximum number of instructions CSE processes before flushing.
9121 The default is 1000.
9122
9123 @item ggc-min-expand
9124
9125 GCC uses a garbage collector to manage its own memory allocation. This
9126 parameter specifies the minimum percentage by which the garbage
9127 collector's heap should be allowed to expand between collections.
9128 Tuning this may improve compilation speed; it has no effect on code
9129 generation.
9130
9131 The default is 30% + 70% * (RAM/1GB) with an upper bound of 100% when
9132 RAM >= 1GB@. If @code{getrlimit} is available, the notion of ``RAM'' is
9133 the smallest of actual RAM and @code{RLIMIT_DATA} or @code{RLIMIT_AS}. If
9134 GCC is not able to calculate RAM on a particular platform, the lower
9135 bound of 30% is used. Setting this parameter and
9136 @option{ggc-min-heapsize} to zero causes a full collection to occur at
9137 every opportunity. This is extremely slow, but can be useful for
9138 debugging.
9139
9140 @item ggc-min-heapsize
9141
9142 Minimum size of the garbage collector's heap before it begins bothering
9143 to collect garbage. The first collection occurs after the heap expands
9144 by @option{ggc-min-expand}% beyond @option{ggc-min-heapsize}. Again,
9145 tuning this may improve compilation speed, and has no effect on code
9146 generation.
9147
9148 The default is the smaller of RAM/8, RLIMIT_RSS, or a limit that
9149 tries to ensure that RLIMIT_DATA or RLIMIT_AS are not exceeded, but
9150 with a lower bound of 4096 (four megabytes) and an upper bound of
9151 131072 (128 megabytes). If GCC is not able to calculate RAM on a
9152 particular platform, the lower bound is used. Setting this parameter
9153 very large effectively disables garbage collection. Setting this
9154 parameter and @option{ggc-min-expand} to zero causes a full collection
9155 to occur at every opportunity.
9156
9157 @item max-reload-search-insns
9158 The maximum number of instruction reload should look backward for equivalent
9159 register. Increasing values mean more aggressive optimization, making the
9160 compilation time increase with probably slightly better performance.
9161 The default value is 100.
9162
9163 @item max-cselib-memory-locations
9164 The maximum number of memory locations cselib should take into account.
9165 Increasing values mean more aggressive optimization, making the compilation time
9166 increase with probably slightly better performance. The default value is 500.
9167
9168 @item max-sched-ready-insns
9169 The maximum number of instructions ready to be issued the scheduler should
9170 consider at any given time during the first scheduling pass. Increasing
9171 values mean more thorough searches, making the compilation time increase
9172 with probably little benefit. The default value is 100.
9173
9174 @item max-sched-region-blocks
9175 The maximum number of blocks in a region to be considered for
9176 interblock scheduling. The default value is 10.
9177
9178 @item max-pipeline-region-blocks
9179 The maximum number of blocks in a region to be considered for
9180 pipelining in the selective scheduler. The default value is 15.
9181
9182 @item max-sched-region-insns
9183 The maximum number of insns in a region to be considered for
9184 interblock scheduling. The default value is 100.
9185
9186 @item max-pipeline-region-insns
9187 The maximum number of insns in a region to be considered for
9188 pipelining in the selective scheduler. The default value is 200.
9189
9190 @item min-spec-prob
9191 The minimum probability (in percents) of reaching a source block
9192 for interblock speculative scheduling. The default value is 40.
9193
9194 @item max-sched-extend-regions-iters
9195 The maximum number of iterations through CFG to extend regions.
9196 A value of 0 (the default) disables region extensions.
9197
9198 @item max-sched-insn-conflict-delay
9199 The maximum conflict delay for an insn to be considered for speculative motion.
9200 The default value is 3.
9201
9202 @item sched-spec-prob-cutoff
9203 The minimal probability of speculation success (in percents), so that
9204 speculative insns are scheduled.
9205 The default value is 40.
9206
9207 @item sched-state-edge-prob-cutoff
9208 The minimum probability an edge must have for the scheduler to save its
9209 state across it.
9210 The default value is 10.
9211
9212 @item sched-mem-true-dep-cost
9213 Minimal distance (in CPU cycles) between store and load targeting same
9214 memory locations. The default value is 1.
9215
9216 @item selsched-max-lookahead
9217 The maximum size of the lookahead window of selective scheduling. It is a
9218 depth of search for available instructions.
9219 The default value is 50.
9220
9221 @item selsched-max-sched-times
9222 The maximum number of times that an instruction is scheduled during
9223 selective scheduling. This is the limit on the number of iterations
9224 through which the instruction may be pipelined. The default value is 2.
9225
9226 @item selsched-insns-to-rename
9227 The maximum number of best instructions in the ready list that are considered
9228 for renaming in the selective scheduler. The default value is 2.
9229
9230 @item sms-min-sc
9231 The minimum value of stage count that swing modulo scheduler
9232 generates. The default value is 2.
9233
9234 @item max-last-value-rtl
9235 The maximum size measured as number of RTLs that can be recorded in an expression
9236 in combiner for a pseudo register as last known value of that register. The default
9237 is 10000.
9238
9239 @item max-combine-insns
9240 The maximum number of instructions the RTL combiner tries to combine.
9241 The default value is 2 at @option{-Og} and 4 otherwise.
9242
9243 @item integer-share-limit
9244 Small integer constants can use a shared data structure, reducing the
9245 compiler's memory usage and increasing its speed. This sets the maximum
9246 value of a shared integer constant. The default value is 256.
9247
9248 @item ssp-buffer-size
9249 The minimum size of buffers (i.e.@: arrays) that receive stack smashing
9250 protection when @option{-fstack-protection} is used.
9251
9252 @item min-size-for-stack-sharing
9253 The minimum size of variables taking part in stack slot sharing when not
9254 optimizing. The default value is 32.
9255
9256 @item max-jump-thread-duplication-stmts
9257 Maximum number of statements allowed in a block that needs to be
9258 duplicated when threading jumps.
9259
9260 @item max-fields-for-field-sensitive
9261 Maximum number of fields in a structure treated in
9262 a field sensitive manner during pointer analysis. The default is zero
9263 for @option{-O0} and @option{-O1},
9264 and 100 for @option{-Os}, @option{-O2}, and @option{-O3}.
9265
9266 @item prefetch-latency
9267 Estimate on average number of instructions that are executed before
9268 prefetch finishes. The distance prefetched ahead is proportional
9269 to this constant. Increasing this number may also lead to less
9270 streams being prefetched (see @option{simultaneous-prefetches}).
9271
9272 @item simultaneous-prefetches
9273 Maximum number of prefetches that can run at the same time.
9274
9275 @item l1-cache-line-size
9276 The size of cache line in L1 cache, in bytes.
9277
9278 @item l1-cache-size
9279 The size of L1 cache, in kilobytes.
9280
9281 @item l2-cache-size
9282 The size of L2 cache, in kilobytes.
9283
9284 @item min-insn-to-prefetch-ratio
9285 The minimum ratio between the number of instructions and the
9286 number of prefetches to enable prefetching in a loop.
9287
9288 @item prefetch-min-insn-to-mem-ratio
9289 The minimum ratio between the number of instructions and the
9290 number of memory references to enable prefetching in a loop.
9291
9292 @item use-canonical-types
9293 Whether the compiler should use the ``canonical'' type system. By
9294 default, this should always be 1, which uses a more efficient internal
9295 mechanism for comparing types in C++ and Objective-C++. However, if
9296 bugs in the canonical type system are causing compilation failures,
9297 set this value to 0 to disable canonical types.
9298
9299 @item switch-conversion-max-branch-ratio
9300 Switch initialization conversion refuses to create arrays that are
9301 bigger than @option{switch-conversion-max-branch-ratio} times the number of
9302 branches in the switch.
9303
9304 @item max-partial-antic-length
9305 Maximum length of the partial antic set computed during the tree
9306 partial redundancy elimination optimization (@option{-ftree-pre}) when
9307 optimizing at @option{-O3} and above. For some sorts of source code
9308 the enhanced partial redundancy elimination optimization can run away,
9309 consuming all of the memory available on the host machine. This
9310 parameter sets a limit on the length of the sets that are computed,
9311 which prevents the runaway behavior. Setting a value of 0 for
9312 this parameter allows an unlimited set length.
9313
9314 @item sccvn-max-scc-size
9315 Maximum size of a strongly connected component (SCC) during SCCVN
9316 processing. If this limit is hit, SCCVN processing for the whole
9317 function is not done and optimizations depending on it are
9318 disabled. The default maximum SCC size is 10000.
9319
9320 @item sccvn-max-alias-queries-per-access
9321 Maximum number of alias-oracle queries we perform when looking for
9322 redundancies for loads and stores. If this limit is hit the search
9323 is aborted and the load or store is not considered redundant. The
9324 number of queries is algorithmically limited to the number of
9325 stores on all paths from the load to the function entry.
9326 The default maximum number of queries is 1000.
9327
9328 @item ira-max-loops-num
9329 IRA uses regional register allocation by default. If a function
9330 contains more loops than the number given by this parameter, only at most
9331 the given number of the most frequently-executed loops form regions
9332 for regional register allocation. The default value of the
9333 parameter is 100.
9334
9335 @item ira-max-conflict-table-size
9336 Although IRA uses a sophisticated algorithm to compress the conflict
9337 table, the table can still require excessive amounts of memory for
9338 huge functions. If the conflict table for a function could be more
9339 than the size in MB given by this parameter, the register allocator
9340 instead uses a faster, simpler, and lower-quality
9341 algorithm that does not require building a pseudo-register conflict table.
9342 The default value of the parameter is 2000.
9343
9344 @item ira-loop-reserved-regs
9345 IRA can be used to evaluate more accurate register pressure in loops
9346 for decisions to move loop invariants (see @option{-O3}). The number
9347 of available registers reserved for some other purposes is given
9348 by this parameter. The default value of the parameter is 2, which is
9349 the minimal number of registers needed by typical instructions.
9350 This value is the best found from numerous experiments.
9351
9352 @item lra-inheritance-ebb-probability-cutoff
9353 LRA tries to reuse values reloaded in registers in subsequent insns.
9354 This optimization is called inheritance. EBB is used as a region to
9355 do this optimization. The parameter defines a minimal fall-through
9356 edge probability in percentage used to add BB to inheritance EBB in
9357 LRA. The default value of the parameter is 40. The value was chosen
9358 from numerous runs of SPEC2000 on x86-64.
9359
9360 @item loop-invariant-max-bbs-in-loop
9361 Loop invariant motion can be very expensive, both in compilation time and
9362 in amount of needed compile-time memory, with very large loops. Loops
9363 with more basic blocks than this parameter won't have loop invariant
9364 motion optimization performed on them. The default value of the
9365 parameter is 1000 for @option{-O1} and 10000 for @option{-O2} and above.
9366
9367 @item loop-max-datarefs-for-datadeps
9368 Building data dependencies is expensive for very large loops. This
9369 parameter limits the number of data references in loops that are
9370 considered for data dependence analysis. These large loops are no
9371 handled by the optimizations using loop data dependencies.
9372 The default value is 1000.
9373
9374 @item max-vartrack-size
9375 Sets a maximum number of hash table slots to use during variable
9376 tracking dataflow analysis of any function. If this limit is exceeded
9377 with variable tracking at assignments enabled, analysis for that
9378 function is retried without it, after removing all debug insns from
9379 the function. If the limit is exceeded even without debug insns, var
9380 tracking analysis is completely disabled for the function. Setting
9381 the parameter to zero makes it unlimited.
9382
9383 @item max-vartrack-expr-depth
9384 Sets a maximum number of recursion levels when attempting to map
9385 variable names or debug temporaries to value expressions. This trades
9386 compilation time for more complete debug information. If this is set too
9387 low, value expressions that are available and could be represented in
9388 debug information may end up not being used; setting this higher may
9389 enable the compiler to find more complex debug expressions, but compile
9390 time and memory use may grow. The default is 12.
9391
9392 @item min-nondebug-insn-uid
9393 Use uids starting at this parameter for nondebug insns. The range below
9394 the parameter is reserved exclusively for debug insns created by
9395 @option{-fvar-tracking-assignments}, but debug insns may get
9396 (non-overlapping) uids above it if the reserved range is exhausted.
9397
9398 @item ipa-sra-ptr-growth-factor
9399 IPA-SRA replaces a pointer to an aggregate with one or more new
9400 parameters only when their cumulative size is less or equal to
9401 @option{ipa-sra-ptr-growth-factor} times the size of the original
9402 pointer parameter.
9403
9404 @item sra-max-scalarization-size-Ospeed
9405 @item sra-max-scalarization-size-Osize
9406 The two Scalar Reduction of Aggregates passes (SRA and IPA-SRA) aim to
9407 replace scalar parts of aggregates with uses of independent scalar
9408 variables. These parameters control the maximum size, in storage units,
9409 of aggregate which is considered for replacement when compiling for
9410 speed
9411 (@option{sra-max-scalarization-size-Ospeed}) or size
9412 (@option{sra-max-scalarization-size-Osize}) respectively.
9413
9414 @item tm-max-aggregate-size
9415 When making copies of thread-local variables in a transaction, this
9416 parameter specifies the size in bytes after which variables are
9417 saved with the logging functions as opposed to save/restore code
9418 sequence pairs. This option only applies when using
9419 @option{-fgnu-tm}.
9420
9421 @item graphite-max-nb-scop-params
9422 To avoid exponential effects in the Graphite loop transforms, the
9423 number of parameters in a Static Control Part (SCoP) is bounded. The
9424 default value is 10 parameters. A variable whose value is unknown at
9425 compilation time and defined outside a SCoP is a parameter of the SCoP.
9426
9427 @item graphite-max-bbs-per-function
9428 To avoid exponential effects in the detection of SCoPs, the size of
9429 the functions analyzed by Graphite is bounded. The default value is
9430 100 basic blocks.
9431
9432 @item loop-block-tile-size
9433 Loop blocking or strip mining transforms, enabled with
9434 @option{-floop-block} or @option{-floop-strip-mine}, strip mine each
9435 loop in the loop nest by a given number of iterations. The strip
9436 length can be changed using the @option{loop-block-tile-size}
9437 parameter. The default value is 51 iterations.
9438
9439 @item loop-unroll-jam-size
9440 Specify the unroll factor for the @option{-floop-unroll-and-jam} option. The
9441 default value is 4.
9442
9443 @item loop-unroll-jam-depth
9444 Specify the dimension to be unrolled (counting from the most inner loop)
9445 for the @option{-floop-unroll-and-jam}. The default value is 2.
9446
9447 @item ipa-cp-value-list-size
9448 IPA-CP attempts to track all possible values and types passed to a function's
9449 parameter in order to propagate them and perform devirtualization.
9450 @option{ipa-cp-value-list-size} is the maximum number of values and types it
9451 stores per one formal parameter of a function.
9452
9453 @item ipa-cp-eval-threshold
9454 IPA-CP calculates its own score of cloning profitability heuristics
9455 and performs those cloning opportunities with scores that exceed
9456 @option{ipa-cp-eval-threshold}.
9457
9458 @item ipa-cp-recursion-penalty
9459 Percentage penalty the recursive functions will receive when they
9460 are evaluated for cloning.
9461
9462 @item ipa-cp-single-call-penalty
9463 Percentage penalty functions containg a single call to another
9464 function will receive when they are evaluated for cloning.
9465
9466
9467 @item ipa-max-agg-items
9468 IPA-CP is also capable to propagate a number of scalar values passed
9469 in an aggregate. @option{ipa-max-agg-items} controls the maximum
9470 number of such values per one parameter.
9471
9472 @item ipa-cp-loop-hint-bonus
9473 When IPA-CP determines that a cloning candidate would make the number
9474 of iterations of a loop known, it adds a bonus of
9475 @option{ipa-cp-loop-hint-bonus} to the profitability score of
9476 the candidate.
9477
9478 @item ipa-cp-array-index-hint-bonus
9479 When IPA-CP determines that a cloning candidate would make the index of
9480 an array access known, it adds a bonus of
9481 @option{ipa-cp-array-index-hint-bonus} to the profitability
9482 score of the candidate.
9483
9484 @item ipa-max-aa-steps
9485 During its analysis of function bodies, IPA-CP employs alias analysis
9486 in order to track values pointed to by function parameters. In order
9487 not spend too much time analyzing huge functions, it gives up and
9488 consider all memory clobbered after examining
9489 @option{ipa-max-aa-steps} statements modifying memory.
9490
9491 @item lto-partitions
9492 Specify desired number of partitions produced during WHOPR compilation.
9493 The number of partitions should exceed the number of CPUs used for compilation.
9494 The default value is 32.
9495
9496 @item lto-min-partition
9497 Size of minimal partition for WHOPR (in estimated instructions).
9498 This prevents expenses of splitting very small programs into too many
9499 partitions.
9500
9501 @item lto-max-partition
9502 Size of max partition for WHOPR (in estimated instructions).
9503 to provide an upper bound for individual size of partition.
9504 Meant to be used only with balanced partitioning.
9505
9506 @item cxx-max-namespaces-for-diagnostic-help
9507 The maximum number of namespaces to consult for suggestions when C++
9508 name lookup fails for an identifier. The default is 1000.
9509
9510 @item sink-frequency-threshold
9511 The maximum relative execution frequency (in percents) of the target block
9512 relative to a statement's original block to allow statement sinking of a
9513 statement. Larger numbers result in more aggressive statement sinking.
9514 The default value is 75. A small positive adjustment is applied for
9515 statements with memory operands as those are even more profitable so sink.
9516
9517 @item max-stores-to-sink
9518 The maximum number of conditional store pairs that can be sunk. Set to 0
9519 if either vectorization (@option{-ftree-vectorize}) or if-conversion
9520 (@option{-ftree-loop-if-convert}) is disabled. The default is 2.
9521
9522 @item allow-store-data-races
9523 Allow optimizers to introduce new data races on stores.
9524 Set to 1 to allow, otherwise to 0. This option is enabled by default
9525 at optimization level @option{-Ofast}.
9526
9527 @item case-values-threshold
9528 The smallest number of different values for which it is best to use a
9529 jump-table instead of a tree of conditional branches. If the value is
9530 0, use the default for the machine. The default is 0.
9531
9532 @item tree-reassoc-width
9533 Set the maximum number of instructions executed in parallel in
9534 reassociated tree. This parameter overrides target dependent
9535 heuristics used by default if has non zero value.
9536
9537 @item sched-pressure-algorithm
9538 Choose between the two available implementations of
9539 @option{-fsched-pressure}. Algorithm 1 is the original implementation
9540 and is the more likely to prevent instructions from being reordered.
9541 Algorithm 2 was designed to be a compromise between the relatively
9542 conservative approach taken by algorithm 1 and the rather aggressive
9543 approach taken by the default scheduler. It relies more heavily on
9544 having a regular register file and accurate register pressure classes.
9545 See @file{haifa-sched.c} in the GCC sources for more details.
9546
9547 The default choice depends on the target.
9548
9549 @item max-slsr-cand-scan
9550 Set the maximum number of existing candidates that are considered when
9551 seeking a basis for a new straight-line strength reduction candidate.
9552
9553 @item asan-globals
9554 Enable buffer overflow detection for global objects. This kind
9555 of protection is enabled by default if you are using
9556 @option{-fsanitize=address} option.
9557 To disable global objects protection use @option{--param asan-globals=0}.
9558
9559 @item asan-stack
9560 Enable buffer overflow detection for stack objects. This kind of
9561 protection is enabled by default when using @option{-fsanitize=address}.
9562 To disable stack protection use @option{--param asan-stack=0} option.
9563
9564 @item asan-instrument-reads
9565 Enable buffer overflow detection for memory reads. This kind of
9566 protection is enabled by default when using @option{-fsanitize=address}.
9567 To disable memory reads protection use
9568 @option{--param asan-instrument-reads=0}.
9569
9570 @item asan-instrument-writes
9571 Enable buffer overflow detection for memory writes. This kind of
9572 protection is enabled by default when using @option{-fsanitize=address}.
9573 To disable memory writes protection use
9574 @option{--param asan-instrument-writes=0} option.
9575
9576 @item asan-memintrin
9577 Enable detection for built-in functions. This kind of protection
9578 is enabled by default when using @option{-fsanitize=address}.
9579 To disable built-in functions protection use
9580 @option{--param asan-memintrin=0}.
9581
9582 @item asan-use-after-return
9583 Enable detection of use-after-return. This kind of protection
9584 is enabled by default when using @option{-fsanitize=address} option.
9585 To disable use-after-return detection use
9586 @option{--param asan-use-after-return=0}.
9587
9588 @item asan-instrumentation-with-call-threshold
9589 If number of memory accesses in function being instrumented
9590 is greater or equal to this number, use callbacks instead of inline checks.
9591 E.g. to disable inline code use
9592 @option{--param asan-instrumentation-with-call-threshold=0}.
9593
9594 @item chkp-max-ctor-size
9595 Static constructors generated by Pointer Bounds Checker may become very
9596 large and significantly increase compile time at optimization level
9597 @option{-O1} and higher. This parameter is a maximum nubmer of statements
9598 in a single generated constructor. Default value is 5000.
9599
9600 @item max-fsm-thread-path-insns
9601 Maximum number of instructions to copy when duplicating blocks on a
9602 finite state automaton jump thread path. The default is 100.
9603
9604 @item max-fsm-thread-length
9605 Maximum number of basic blocks on a finite state automaton jump thread
9606 path. The default is 10.
9607
9608 @item max-fsm-thread-paths
9609 Maximum number of new jump thread paths to create for a finite state
9610 automaton. The default is 50.
9611
9612 @item parloops-chunk-size
9613 Chunk size of omp schedule for loops parallelized by parloops. The default
9614 is 0.
9615
9616 @item parloops-schedule
9617 Schedule type of omp schedule for loops parallelized by parloops (static,
9618 dynamic, guided, auto, runtime). The default is static.
9619
9620 @item max-ssa-name-query-depth
9621 Maximum depth of recursion when querying properties of SSA names in things
9622 like fold routines. One level of recursion corresponds to following a
9623 use-def chain.
9624
9625 @item hsa-gen-debug-stores
9626 Enable emission of special debug stores within HSA kernels which are
9627 then read and reported by libgomp plugin. Generation of these stores
9628 is disabled by default, use @option{--param hsa-gen-debug-stores=1} to
9629 enable it.
9630
9631 @item max-speculative-devirt-maydefs
9632 The maximum number of may-defs we analyze when looking for a must-def
9633 specifying the dynamic type of an object that invokes a virtual call
9634 we may be able to devirtualize speculatively.
9635 @end table
9636 @end table
9637
9638 @node Instrumentation Options
9639 @section Program Instrumentation Options
9640 @cindex instrumentation options
9641 @cindex program instrumentation options
9642 @cindex run-time error checking options
9643 @cindex profiling options
9644 @cindex options, program instrumentation
9645 @cindex options, run-time error checking
9646 @cindex options, profiling
9647
9648 GCC supports a number of command-line options that control adding
9649 run-time instrumentation to the code it normally generates.
9650 For example, one purpose of instrumentation is collect profiling
9651 statistics for use in finding program hot spots, code coverage
9652 analysis, or profile-guided optimizations.
9653 Another class of program instrumentation is adding run-time checking
9654 to detect programming errors like invalid pointer
9655 dereferences or out-of-bounds array accesses, as well as deliberately
9656 hostile attacks such as stack smashing or C++ vtable hijacking.
9657 There is also a general hook which can be used to implement other
9658 forms of tracing or function-level instrumentation for debug or
9659 program analysis purposes.
9660
9661 @table @gcctabopt
9662 @cindex @command{prof}
9663 @item -p
9664 @opindex p
9665 Generate extra code to write profile information suitable for the
9666 analysis program @command{prof}. You must use this option when compiling
9667 the source files you want data about, and you must also use it when
9668 linking.
9669
9670 @cindex @command{gprof}
9671 @item -pg
9672 @opindex pg
9673 Generate extra code to write profile information suitable for the
9674 analysis program @command{gprof}. You must use this option when compiling
9675 the source files you want data about, and you must also use it when
9676 linking.
9677
9678 @item -fprofile-arcs
9679 @opindex fprofile-arcs
9680 Add code so that program flow @dfn{arcs} are instrumented. During
9681 execution the program records how many times each branch and call is
9682 executed and how many times it is taken or returns. When the compiled
9683 program exits it saves this data to a file called
9684 @file{@var{auxname}.gcda} for each source file. The data may be used for
9685 profile-directed optimizations (@option{-fbranch-probabilities}), or for
9686 test coverage analysis (@option{-ftest-coverage}). Each object file's
9687 @var{auxname} is generated from the name of the output file, if
9688 explicitly specified and it is not the final executable, otherwise it is
9689 the basename of the source file. In both cases any suffix is removed
9690 (e.g.@: @file{foo.gcda} for input file @file{dir/foo.c}, or
9691 @file{dir/foo.gcda} for output file specified as @option{-o dir/foo.o}).
9692 @xref{Cross-profiling}.
9693
9694 @cindex @command{gcov}
9695 @item --coverage
9696 @opindex coverage
9697
9698 This option is used to compile and link code instrumented for coverage
9699 analysis. The option is a synonym for @option{-fprofile-arcs}
9700 @option{-ftest-coverage} (when compiling) and @option{-lgcov} (when
9701 linking). See the documentation for those options for more details.
9702
9703 @itemize
9704
9705 @item
9706 Compile the source files with @option{-fprofile-arcs} plus optimization
9707 and code generation options. For test coverage analysis, use the
9708 additional @option{-ftest-coverage} option. You do not need to profile
9709 every source file in a program.
9710
9711 @item
9712 Link your object files with @option{-lgcov} or @option{-fprofile-arcs}
9713 (the latter implies the former).
9714
9715 @item
9716 Run the program on a representative workload to generate the arc profile
9717 information. This may be repeated any number of times. You can run
9718 concurrent instances of your program, and provided that the file system
9719 supports locking, the data files will be correctly updated. Also
9720 @code{fork} calls are detected and correctly handled (double counting
9721 will not happen).
9722
9723 @item
9724 For profile-directed optimizations, compile the source files again with
9725 the same optimization and code generation options plus
9726 @option{-fbranch-probabilities} (@pxref{Optimize Options,,Options that
9727 Control Optimization}).
9728
9729 @item
9730 For test coverage analysis, use @command{gcov} to produce human readable
9731 information from the @file{.gcno} and @file{.gcda} files. Refer to the
9732 @command{gcov} documentation for further information.
9733
9734 @end itemize
9735
9736 With @option{-fprofile-arcs}, for each function of your program GCC
9737 creates a program flow graph, then finds a spanning tree for the graph.
9738 Only arcs that are not on the spanning tree have to be instrumented: the
9739 compiler adds code to count the number of times that these arcs are
9740 executed. When an arc is the only exit or only entrance to a block, the
9741 instrumentation code can be added to the block; otherwise, a new basic
9742 block must be created to hold the instrumentation code.
9743
9744 @need 2000
9745 @item -ftest-coverage
9746 @opindex ftest-coverage
9747 Produce a notes file that the @command{gcov} code-coverage utility
9748 (@pxref{Gcov,, @command{gcov}---a Test Coverage Program}) can use to
9749 show program coverage. Each source file's note file is called
9750 @file{@var{auxname}.gcno}. Refer to the @option{-fprofile-arcs} option
9751 above for a description of @var{auxname} and instructions on how to
9752 generate test coverage data. Coverage data matches the source files
9753 more closely if you do not optimize.
9754
9755 @item -fprofile-dir=@var{path}
9756 @opindex fprofile-dir
9757
9758 Set the directory to search for the profile data files in to @var{path}.
9759 This option affects only the profile data generated by
9760 @option{-fprofile-generate}, @option{-ftest-coverage}, @option{-fprofile-arcs}
9761 and used by @option{-fprofile-use} and @option{-fbranch-probabilities}
9762 and its related options. Both absolute and relative paths can be used.
9763 By default, GCC uses the current directory as @var{path}, thus the
9764 profile data file appears in the same directory as the object file.
9765
9766 @item -fprofile-generate
9767 @itemx -fprofile-generate=@var{path}
9768 @opindex fprofile-generate
9769
9770 Enable options usually used for instrumenting application to produce
9771 profile useful for later recompilation with profile feedback based
9772 optimization. You must use @option{-fprofile-generate} both when
9773 compiling and when linking your program.
9774
9775 The following options are enabled: @option{-fprofile-arcs}, @option{-fprofile-values}, @option{-fvpt}.
9776
9777 If @var{path} is specified, GCC looks at the @var{path} to find
9778 the profile feedback data files. See @option{-fprofile-dir}.
9779
9780 To optimize the program based on the collected profile information, use
9781 @option{-fprofile-use}. @xref{Optimize Options}, for more information.
9782
9783 @item -fsanitize=address
9784 @opindex fsanitize=address
9785 Enable AddressSanitizer, a fast memory error detector.
9786 Memory access instructions are instrumented to detect
9787 out-of-bounds and use-after-free bugs.
9788 See @uref{https://github.com/google/sanitizers/wiki/AddressSanitizer} for
9789 more details. The run-time behavior can be influenced using the
9790 @env{ASAN_OPTIONS} environment variable. When set to @code{help=1},
9791 the available options are shown at startup of the instrumented program. See
9792 @url{https://github.com/google/sanitizers/wiki/AddressSanitizerFlags#run-time-flags}
9793 for a list of supported options.
9794
9795 @item -fsanitize=kernel-address
9796 @opindex fsanitize=kernel-address
9797 Enable AddressSanitizer for Linux kernel.
9798 See @uref{https://github.com/google/kasan/wiki} for more details.
9799
9800 @item -fsanitize=thread
9801 @opindex fsanitize=thread
9802 Enable ThreadSanitizer, a fast data race detector.
9803 Memory access instructions are instrumented to detect
9804 data race bugs. See @uref{https://github.com/google/sanitizers/wiki#threadsanitizer} for more
9805 details. The run-time behavior can be influenced using the @env{TSAN_OPTIONS}
9806 environment variable; see
9807 @url{https://github.com/google/sanitizers/wiki/ThreadSanitizerFlags} for a list of
9808 supported options.
9809
9810 @item -fsanitize=leak
9811 @opindex fsanitize=leak
9812 Enable LeakSanitizer, a memory leak detector.
9813 This option only matters for linking of executables and if neither
9814 @option{-fsanitize=address} nor @option{-fsanitize=thread} is used. In that
9815 case the executable is linked against a library that overrides @code{malloc}
9816 and other allocator functions. See
9817 @uref{https://github.com/google/sanitizers/wiki/AddressSanitizerLeakSanitizer} for more
9818 details. The run-time behavior can be influenced using the
9819 @env{LSAN_OPTIONS} environment variable.
9820
9821 @item -fsanitize=undefined
9822 @opindex fsanitize=undefined
9823 Enable UndefinedBehaviorSanitizer, a fast undefined behavior detector.
9824 Various computations are instrumented to detect undefined behavior
9825 at runtime. Current suboptions are:
9826
9827 @table @gcctabopt
9828
9829 @item -fsanitize=shift
9830 @opindex fsanitize=shift
9831 This option enables checking that the result of a shift operation is
9832 not undefined. Note that what exactly is considered undefined differs
9833 slightly between C and C++, as well as between ISO C90 and C99, etc.
9834
9835 @item -fsanitize=integer-divide-by-zero
9836 @opindex fsanitize=integer-divide-by-zero
9837 Detect integer division by zero as well as @code{INT_MIN / -1} division.
9838
9839 @item -fsanitize=unreachable
9840 @opindex fsanitize=unreachable
9841 With this option, the compiler turns the @code{__builtin_unreachable}
9842 call into a diagnostics message call instead. When reaching the
9843 @code{__builtin_unreachable} call, the behavior is undefined.
9844
9845 @item -fsanitize=vla-bound
9846 @opindex fsanitize=vla-bound
9847 This option instructs the compiler to check that the size of a variable
9848 length array is positive.
9849
9850 @item -fsanitize=null
9851 @opindex fsanitize=null
9852 This option enables pointer checking. Particularly, the application
9853 built with this option turned on will issue an error message when it
9854 tries to dereference a NULL pointer, or if a reference (possibly an
9855 rvalue reference) is bound to a NULL pointer, or if a method is invoked
9856 on an object pointed by a NULL pointer.
9857
9858 @item -fsanitize=return
9859 @opindex fsanitize=return
9860 This option enables return statement checking. Programs
9861 built with this option turned on will issue an error message
9862 when the end of a non-void function is reached without actually
9863 returning a value. This option works in C++ only.
9864
9865 @item -fsanitize=signed-integer-overflow
9866 @opindex fsanitize=signed-integer-overflow
9867 This option enables signed integer overflow checking. We check that
9868 the result of @code{+}, @code{*}, and both unary and binary @code{-}
9869 does not overflow in the signed arithmetics. Note, integer promotion
9870 rules must be taken into account. That is, the following is not an
9871 overflow:
9872 @smallexample
9873 signed char a = SCHAR_MAX;
9874 a++;
9875 @end smallexample
9876
9877 @item -fsanitize=bounds
9878 @opindex fsanitize=bounds
9879 This option enables instrumentation of array bounds. Various out of bounds
9880 accesses are detected. Flexible array members, flexible array member-like
9881 arrays, and initializers of variables with static storage are not instrumented.
9882
9883 @item -fsanitize=bounds-strict
9884 @opindex fsanitize=bounds-strict
9885 This option enables strict instrumentation of array bounds. Most out of bounds
9886 accesses are detected, including flexible array members and flexible array
9887 member-like arrays. Initializers of variables with static storage are not
9888 instrumented.
9889
9890 @item -fsanitize=alignment
9891 @opindex fsanitize=alignment
9892
9893 This option enables checking of alignment of pointers when they are
9894 dereferenced, or when a reference is bound to insufficiently aligned target,
9895 or when a method or constructor is invoked on insufficiently aligned object.
9896
9897 @item -fsanitize=object-size
9898 @opindex fsanitize=object-size
9899 This option enables instrumentation of memory references using the
9900 @code{__builtin_object_size} function. Various out of bounds pointer
9901 accesses are detected.
9902
9903 @item -fsanitize=float-divide-by-zero
9904 @opindex fsanitize=float-divide-by-zero
9905 Detect floating-point division by zero. Unlike other similar options,
9906 @option{-fsanitize=float-divide-by-zero} is not enabled by
9907 @option{-fsanitize=undefined}, since floating-point division by zero can
9908 be a legitimate way of obtaining infinities and NaNs.
9909
9910 @item -fsanitize=float-cast-overflow
9911 @opindex fsanitize=float-cast-overflow
9912 This option enables floating-point type to integer conversion checking.
9913 We check that the result of the conversion does not overflow.
9914 Unlike other similar options, @option{-fsanitize=float-cast-overflow} is
9915 not enabled by @option{-fsanitize=undefined}.
9916 This option does not work well with @code{FE_INVALID} exceptions enabled.
9917
9918 @item -fsanitize=nonnull-attribute
9919 @opindex fsanitize=nonnull-attribute
9920
9921 This option enables instrumentation of calls, checking whether null values
9922 are not passed to arguments marked as requiring a non-null value by the
9923 @code{nonnull} function attribute.
9924
9925 @item -fsanitize=returns-nonnull-attribute
9926 @opindex fsanitize=returns-nonnull-attribute
9927
9928 This option enables instrumentation of return statements in functions
9929 marked with @code{returns_nonnull} function attribute, to detect returning
9930 of null values from such functions.
9931
9932 @item -fsanitize=bool
9933 @opindex fsanitize=bool
9934
9935 This option enables instrumentation of loads from bool. If a value other
9936 than 0/1 is loaded, a run-time error is issued.
9937
9938 @item -fsanitize=enum
9939 @opindex fsanitize=enum
9940
9941 This option enables instrumentation of loads from an enum type. If
9942 a value outside the range of values for the enum type is loaded,
9943 a run-time error is issued.
9944
9945 @item -fsanitize=vptr
9946 @opindex fsanitize=vptr
9947
9948 This option enables instrumentation of C++ member function calls, member
9949 accesses and some conversions between pointers to base and derived classes,
9950 to verify the referenced object has the correct dynamic type.
9951
9952 @end table
9953
9954 While @option{-ftrapv} causes traps for signed overflows to be emitted,
9955 @option{-fsanitize=undefined} gives a diagnostic message.
9956 This currently works only for the C family of languages.
9957
9958 @item -fno-sanitize=all
9959 @opindex fno-sanitize=all
9960
9961 This option disables all previously enabled sanitizers.
9962 @option{-fsanitize=all} is not allowed, as some sanitizers cannot be used
9963 together.
9964
9965 @item -fasan-shadow-offset=@var{number}
9966 @opindex fasan-shadow-offset
9967 This option forces GCC to use custom shadow offset in AddressSanitizer checks.
9968 It is useful for experimenting with different shadow memory layouts in
9969 Kernel AddressSanitizer.
9970
9971 @item -fsanitize-sections=@var{s1},@var{s2},...
9972 @opindex fsanitize-sections
9973 Sanitize global variables in selected user-defined sections. @var{si} may
9974 contain wildcards.
9975
9976 @item -fsanitize-recover@r{[}=@var{opts}@r{]}
9977 @opindex fsanitize-recover
9978 @opindex fno-sanitize-recover
9979 @option{-fsanitize-recover=} controls error recovery mode for sanitizers
9980 mentioned in comma-separated list of @var{opts}. Enabling this option
9981 for a sanitizer component causes it to attempt to continue
9982 running the program as if no error happened. This means multiple
9983 runtime errors can be reported in a single program run, and the exit
9984 code of the program may indicate success even when errors
9985 have been reported. The @option{-fno-sanitize-recover=} option
9986 can be used to alter
9987 this behavior: only the first detected error is reported
9988 and program then exits with a non-zero exit code.
9989
9990 Currently this feature only works for @option{-fsanitize=undefined} (and its suboptions
9991 except for @option{-fsanitize=unreachable} and @option{-fsanitize=return}),
9992 @option{-fsanitize=float-cast-overflow}, @option{-fsanitize=float-divide-by-zero},
9993 @option{-fsanitize=kernel-address} and @option{-fsanitize=address}.
9994 For these sanitizers error recovery is turned on by default, except @option{-fsanitize=address},
9995 for which this feature is experimental.
9996 @option{-fsanitize-recover=all} and @option{-fno-sanitize-recover=all} is also
9997 accepted, the former enables recovery for all sanitizers that support it,
9998 the latter disables recovery for all sanitizers that support it.
9999
10000 Syntax without explicit @var{opts} parameter is deprecated. It is equivalent to
10001 @smallexample
10002 -fsanitize-recover=undefined,float-cast-overflow,float-divide-by-zero
10003 @end smallexample
10004 @noindent
10005 Similarly @option{-fno-sanitize-recover} is equivalent to
10006 @smallexample
10007 -fno-sanitize-recover=undefined,float-cast-overflow,float-divide-by-zero
10008 @end smallexample
10009
10010 @item -fsanitize-undefined-trap-on-error
10011 @opindex fsanitize-undefined-trap-on-error
10012 The @option{-fsanitize-undefined-trap-on-error} option instructs the compiler to
10013 report undefined behavior using @code{__builtin_trap} rather than
10014 a @code{libubsan} library routine. The advantage of this is that the
10015 @code{libubsan} library is not needed and is not linked in, so this
10016 is usable even in freestanding environments.
10017
10018 @item -fsanitize-coverage=trace-pc
10019 @opindex fsanitize-coverage=trace-pc
10020 Enable coverage-guided fuzzing code instrumentation.
10021 Inserts a call to @code{__sanitizer_cov_trace_pc} into every basic block.
10022
10023 @item -fbounds-check
10024 @opindex fbounds-check
10025 For front ends that support it, generate additional code to check that
10026 indices used to access arrays are within the declared range. This is
10027 currently only supported by the Java and Fortran front ends, where
10028 this option defaults to true and false respectively.
10029
10030 @item -fcheck-pointer-bounds
10031 @opindex fcheck-pointer-bounds
10032 @opindex fno-check-pointer-bounds
10033 @cindex Pointer Bounds Checker options
10034 Enable Pointer Bounds Checker instrumentation. Each memory reference
10035 is instrumented with checks of the pointer used for memory access against
10036 bounds associated with that pointer.
10037
10038 Currently there
10039 is only an implementation for Intel MPX available, thus x86 GNU/Linux target
10040 and @option{-mmpx} are required to enable this feature.
10041 MPX-based instrumentation requires
10042 a runtime library to enable MPX in hardware and handle bounds
10043 violation signals. By default when @option{-fcheck-pointer-bounds}
10044 and @option{-mmpx} options are used to link a program, the GCC driver
10045 links against the @file{libmpx} and @file{libmpxwrappers} libraries.
10046 Bounds checking on calls to dynamic libraries requires a linker
10047 with @option{-z bndplt} support; if GCC was configured with a linker
10048 without support for this option (including the Gold linker and older
10049 versions of ld), a warning is given if you link with @option{-mmpx}
10050 without also specifying @option{-static}, since the overall effectiveness
10051 of the bounds checking protection is reduced.
10052 See also @option{-static-libmpxwrappers}.
10053
10054 MPX-based instrumentation
10055 may be used for debugging and also may be included in production code
10056 to increase program security. Depending on usage, you may
10057 have different requirements for the runtime library. The current version
10058 of the MPX runtime library is more oriented for use as a debugging
10059 tool. MPX runtime library usage implies @option{-lpthread}. See
10060 also @option{-static-libmpx}. The runtime library behavior can be
10061 influenced using various @env{CHKP_RT_*} environment variables. See
10062 @uref{https://gcc.gnu.org/wiki/Intel%20MPX%20support%20in%20the%20GCC%20compiler}
10063 for more details.
10064
10065 Generated instrumentation may be controlled by various
10066 @option{-fchkp-*} options and by the @code{bnd_variable_size}
10067 structure field attribute (@pxref{Type Attributes}) and
10068 @code{bnd_legacy}, and @code{bnd_instrument} function attributes
10069 (@pxref{Function Attributes}). GCC also provides a number of built-in
10070 functions for controlling the Pointer Bounds Checker. @xref{Pointer
10071 Bounds Checker builtins}, for more information.
10072
10073 @item -fchkp-check-incomplete-type
10074 @opindex fchkp-check-incomplete-type
10075 @opindex fno-chkp-check-incomplete-type
10076 Generate pointer bounds checks for variables with incomplete type.
10077 Enabled by default.
10078
10079 @item -fchkp-narrow-bounds
10080 @opindex fchkp-narrow-bounds
10081 @opindex fno-chkp-narrow-bounds
10082 Controls bounds used by Pointer Bounds Checker for pointers to object
10083 fields. If narrowing is enabled then field bounds are used. Otherwise
10084 object bounds are used. See also @option{-fchkp-narrow-to-innermost-array}
10085 and @option{-fchkp-first-field-has-own-bounds}. Enabled by default.
10086
10087 @item -fchkp-first-field-has-own-bounds
10088 @opindex fchkp-first-field-has-own-bounds
10089 @opindex fno-chkp-first-field-has-own-bounds
10090 Forces Pointer Bounds Checker to use narrowed bounds for the address of the
10091 first field in the structure. By default a pointer to the first field has
10092 the same bounds as a pointer to the whole structure.
10093
10094 @item -fchkp-narrow-to-innermost-array
10095 @opindex fchkp-narrow-to-innermost-array
10096 @opindex fno-chkp-narrow-to-innermost-array
10097 Forces Pointer Bounds Checker to use bounds of the innermost arrays in
10098 case of nested static array access. By default this option is disabled and
10099 bounds of the outermost array are used.
10100
10101 @item -fchkp-optimize
10102 @opindex fchkp-optimize
10103 @opindex fno-chkp-optimize
10104 Enables Pointer Bounds Checker optimizations. Enabled by default at
10105 optimization levels @option{-O}, @option{-O2}, @option{-O3}.
10106
10107 @item -fchkp-use-fast-string-functions
10108 @opindex fchkp-use-fast-string-functions
10109 @opindex fno-chkp-use-fast-string-functions
10110 Enables use of @code{*_nobnd} versions of string functions (not copying bounds)
10111 by Pointer Bounds Checker. Disabled by default.
10112
10113 @item -fchkp-use-nochk-string-functions
10114 @opindex fchkp-use-nochk-string-functions
10115 @opindex fno-chkp-use-nochk-string-functions
10116 Enables use of @code{*_nochk} versions of string functions (not checking bounds)
10117 by Pointer Bounds Checker. Disabled by default.
10118
10119 @item -fchkp-use-static-bounds
10120 @opindex fchkp-use-static-bounds
10121 @opindex fno-chkp-use-static-bounds
10122 Allow Pointer Bounds Checker to generate static bounds holding
10123 bounds of static variables. Enabled by default.
10124
10125 @item -fchkp-use-static-const-bounds
10126 @opindex fchkp-use-static-const-bounds
10127 @opindex fno-chkp-use-static-const-bounds
10128 Use statically-initialized bounds for constant bounds instead of
10129 generating them each time they are required. By default enabled when
10130 @option{-fchkp-use-static-bounds} is enabled.
10131
10132 @item -fchkp-treat-zero-dynamic-size-as-infinite
10133 @opindex fchkp-treat-zero-dynamic-size-as-infinite
10134 @opindex fno-chkp-treat-zero-dynamic-size-as-infinite
10135 With this option, objects with incomplete type whose
10136 dynamically-obtained size is zero are treated as having infinite size
10137 instead by Pointer Bounds
10138 Checker. This option may be helpful if a program is linked with a library
10139 missing size information for some symbols. Disabled by default.
10140
10141 @item -fchkp-check-read
10142 @opindex fchkp-check-read
10143 @opindex fno-chkp-check-read
10144 Instructs Pointer Bounds Checker to generate checks for all read
10145 accesses to memory. Enabled by default.
10146
10147 @item -fchkp-check-write
10148 @opindex fchkp-check-write
10149 @opindex fno-chkp-check-write
10150 Instructs Pointer Bounds Checker to generate checks for all write
10151 accesses to memory. Enabled by default.
10152
10153 @item -fchkp-store-bounds
10154 @opindex fchkp-store-bounds
10155 @opindex fno-chkp-store-bounds
10156 Instructs Pointer Bounds Checker to generate bounds stores for
10157 pointer writes. Enabled by default.
10158
10159 @item -fchkp-instrument-calls
10160 @opindex fchkp-instrument-calls
10161 @opindex fno-chkp-instrument-calls
10162 Instructs Pointer Bounds Checker to pass pointer bounds to calls.
10163 Enabled by default.
10164
10165 @item -fchkp-instrument-marked-only
10166 @opindex fchkp-instrument-marked-only
10167 @opindex fno-chkp-instrument-marked-only
10168 Instructs Pointer Bounds Checker to instrument only functions
10169 marked with the @code{bnd_instrument} attribute
10170 (@pxref{Function Attributes}). Disabled by default.
10171
10172 @item -fchkp-use-wrappers
10173 @opindex fchkp-use-wrappers
10174 @opindex fno-chkp-use-wrappers
10175 Allows Pointer Bounds Checker to replace calls to built-in functions
10176 with calls to wrapper functions. When @option{-fchkp-use-wrappers}
10177 is used to link a program, the GCC driver automatically links
10178 against @file{libmpxwrappers}. See also @option{-static-libmpxwrappers}.
10179 Enabled by default.
10180
10181 @item -fstack-protector
10182 @opindex fstack-protector
10183 Emit extra code to check for buffer overflows, such as stack smashing
10184 attacks. This is done by adding a guard variable to functions with
10185 vulnerable objects. This includes functions that call @code{alloca}, and
10186 functions with buffers larger than 8 bytes. The guards are initialized
10187 when a function is entered and then checked when the function exits.
10188 If a guard check fails, an error message is printed and the program exits.
10189
10190 @item -fstack-protector-all
10191 @opindex fstack-protector-all
10192 Like @option{-fstack-protector} except that all functions are protected.
10193
10194 @item -fstack-protector-strong
10195 @opindex fstack-protector-strong
10196 Like @option{-fstack-protector} but includes additional functions to
10197 be protected --- those that have local array definitions, or have
10198 references to local frame addresses.
10199
10200 @item -fstack-protector-explicit
10201 @opindex fstack-protector-explicit
10202 Like @option{-fstack-protector} but only protects those functions which
10203 have the @code{stack_protect} attribute.
10204
10205 @item -fstack-check
10206 @opindex fstack-check
10207 Generate code to verify that you do not go beyond the boundary of the
10208 stack. You should specify this flag if you are running in an
10209 environment with multiple threads, but you only rarely need to specify it in
10210 a single-threaded environment since stack overflow is automatically
10211 detected on nearly all systems if there is only one stack.
10212
10213 Note that this switch does not actually cause checking to be done; the
10214 operating system or the language runtime must do that. The switch causes
10215 generation of code to ensure that they see the stack being extended.
10216
10217 You can additionally specify a string parameter: @samp{no} means no
10218 checking, @samp{generic} means force the use of old-style checking,
10219 @samp{specific} means use the best checking method and is equivalent
10220 to bare @option{-fstack-check}.
10221
10222 Old-style checking is a generic mechanism that requires no specific
10223 target support in the compiler but comes with the following drawbacks:
10224
10225 @enumerate
10226 @item
10227 Modified allocation strategy for large objects: they are always
10228 allocated dynamically if their size exceeds a fixed threshold.
10229
10230 @item
10231 Fixed limit on the size of the static frame of functions: when it is
10232 topped by a particular function, stack checking is not reliable and
10233 a warning is issued by the compiler.
10234
10235 @item
10236 Inefficiency: because of both the modified allocation strategy and the
10237 generic implementation, code performance is hampered.
10238 @end enumerate
10239
10240 Note that old-style stack checking is also the fallback method for
10241 @samp{specific} if no target support has been added in the compiler.
10242
10243 @item -fstack-limit-register=@var{reg}
10244 @itemx -fstack-limit-symbol=@var{sym}
10245 @itemx -fno-stack-limit
10246 @opindex fstack-limit-register
10247 @opindex fstack-limit-symbol
10248 @opindex fno-stack-limit
10249 Generate code to ensure that the stack does not grow beyond a certain value,
10250 either the value of a register or the address of a symbol. If a larger
10251 stack is required, a signal is raised at run time. For most targets,
10252 the signal is raised before the stack overruns the boundary, so
10253 it is possible to catch the signal without taking special precautions.
10254
10255 For instance, if the stack starts at absolute address @samp{0x80000000}
10256 and grows downwards, you can use the flags
10257 @option{-fstack-limit-symbol=__stack_limit} and
10258 @option{-Wl,--defsym,__stack_limit=0x7ffe0000} to enforce a stack limit
10259 of 128KB@. Note that this may only work with the GNU linker.
10260
10261 You can locally override stack limit checking by using the
10262 @code{no_stack_limit} function attribute (@pxref{Function Attributes}).
10263
10264 @item -fsplit-stack
10265 @opindex fsplit-stack
10266 Generate code to automatically split the stack before it overflows.
10267 The resulting program has a discontiguous stack which can only
10268 overflow if the program is unable to allocate any more memory. This
10269 is most useful when running threaded programs, as it is no longer
10270 necessary to calculate a good stack size to use for each thread. This
10271 is currently only implemented for the x86 targets running
10272 GNU/Linux.
10273
10274 When code compiled with @option{-fsplit-stack} calls code compiled
10275 without @option{-fsplit-stack}, there may not be much stack space
10276 available for the latter code to run. If compiling all code,
10277 including library code, with @option{-fsplit-stack} is not an option,
10278 then the linker can fix up these calls so that the code compiled
10279 without @option{-fsplit-stack} always has a large stack. Support for
10280 this is implemented in the gold linker in GNU binutils release 2.21
10281 and later.
10282
10283 @item -fvtable-verify=@r{[}std@r{|}preinit@r{|}none@r{]}
10284 @opindex fvtable-verify
10285 This option is only available when compiling C++ code.
10286 It turns on (or off, if using @option{-fvtable-verify=none}) the security
10287 feature that verifies at run time, for every virtual call, that
10288 the vtable pointer through which the call is made is valid for the type of
10289 the object, and has not been corrupted or overwritten. If an invalid vtable
10290 pointer is detected at run time, an error is reported and execution of the
10291 program is immediately halted.
10292
10293 This option causes run-time data structures to be built at program startup,
10294 which are used for verifying the vtable pointers.
10295 The options @samp{std} and @samp{preinit}
10296 control the timing of when these data structures are built. In both cases the
10297 data structures are built before execution reaches @code{main}. Using
10298 @option{-fvtable-verify=std} causes the data structures to be built after
10299 shared libraries have been loaded and initialized.
10300 @option{-fvtable-verify=preinit} causes them to be built before shared
10301 libraries have been loaded and initialized.
10302
10303 If this option appears multiple times in the command line with different
10304 values specified, @samp{none} takes highest priority over both @samp{std} and
10305 @samp{preinit}; @samp{preinit} takes priority over @samp{std}.
10306
10307 @item -fvtv-debug
10308 @opindex fvtv-debug
10309 When used in conjunction with @option{-fvtable-verify=std} or
10310 @option{-fvtable-verify=preinit}, causes debug versions of the
10311 runtime functions for the vtable verification feature to be called.
10312 This flag also causes the compiler to log information about which
10313 vtable pointers it finds for each class.
10314 This information is written to a file named @file{vtv_set_ptr_data.log}
10315 in the directory named by the environment variable @env{VTV_LOGS_DIR}
10316 if that is defined or the current working directory otherwise.
10317
10318 Note: This feature @emph{appends} data to the log file. If you want a fresh log
10319 file, be sure to delete any existing one.
10320
10321 @item -fvtv-counts
10322 @opindex fvtv-counts
10323 This is a debugging flag. When used in conjunction with
10324 @option{-fvtable-verify=std} or @option{-fvtable-verify=preinit}, this
10325 causes the compiler to keep track of the total number of virtual calls
10326 it encounters and the number of verifications it inserts. It also
10327 counts the number of calls to certain run-time library functions
10328 that it inserts and logs this information for each compilation unit.
10329 The compiler writes this information to a file named
10330 @file{vtv_count_data.log} in the directory named by the environment
10331 variable @env{VTV_LOGS_DIR} if that is defined or the current working
10332 directory otherwise. It also counts the size of the vtable pointer sets
10333 for each class, and writes this information to @file{vtv_class_set_sizes.log}
10334 in the same directory.
10335
10336 Note: This feature @emph{appends} data to the log files. To get fresh log
10337 files, be sure to delete any existing ones.
10338
10339 @item -finstrument-functions
10340 @opindex finstrument-functions
10341 Generate instrumentation calls for entry and exit to functions. Just
10342 after function entry and just before function exit, the following
10343 profiling functions are called with the address of the current
10344 function and its call site. (On some platforms,
10345 @code{__builtin_return_address} does not work beyond the current
10346 function, so the call site information may not be available to the
10347 profiling functions otherwise.)
10348
10349 @smallexample
10350 void __cyg_profile_func_enter (void *this_fn,
10351 void *call_site);
10352 void __cyg_profile_func_exit (void *this_fn,
10353 void *call_site);
10354 @end smallexample
10355
10356 The first argument is the address of the start of the current function,
10357 which may be looked up exactly in the symbol table.
10358
10359 This instrumentation is also done for functions expanded inline in other
10360 functions. The profiling calls indicate where, conceptually, the
10361 inline function is entered and exited. This means that addressable
10362 versions of such functions must be available. If all your uses of a
10363 function are expanded inline, this may mean an additional expansion of
10364 code size. If you use @code{extern inline} in your C code, an
10365 addressable version of such functions must be provided. (This is
10366 normally the case anyway, but if you get lucky and the optimizer always
10367 expands the functions inline, you might have gotten away without
10368 providing static copies.)
10369
10370 A function may be given the attribute @code{no_instrument_function}, in
10371 which case this instrumentation is not done. This can be used, for
10372 example, for the profiling functions listed above, high-priority
10373 interrupt routines, and any functions from which the profiling functions
10374 cannot safely be called (perhaps signal handlers, if the profiling
10375 routines generate output or allocate memory).
10376
10377 @item -finstrument-functions-exclude-file-list=@var{file},@var{file},@dots{}
10378 @opindex finstrument-functions-exclude-file-list
10379
10380 Set the list of functions that are excluded from instrumentation (see
10381 the description of @option{-finstrument-functions}). If the file that
10382 contains a function definition matches with one of @var{file}, then
10383 that function is not instrumented. The match is done on substrings:
10384 if the @var{file} parameter is a substring of the file name, it is
10385 considered to be a match.
10386
10387 For example:
10388
10389 @smallexample
10390 -finstrument-functions-exclude-file-list=/bits/stl,include/sys
10391 @end smallexample
10392
10393 @noindent
10394 excludes any inline function defined in files whose pathnames
10395 contain @file{/bits/stl} or @file{include/sys}.
10396
10397 If, for some reason, you want to include letter @samp{,} in one of
10398 @var{sym}, write @samp{\,}. For example,
10399 @option{-finstrument-functions-exclude-file-list='\,\,tmp'}
10400 (note the single quote surrounding the option).
10401
10402 @item -finstrument-functions-exclude-function-list=@var{sym},@var{sym},@dots{}
10403 @opindex finstrument-functions-exclude-function-list
10404
10405 This is similar to @option{-finstrument-functions-exclude-file-list},
10406 but this option sets the list of function names to be excluded from
10407 instrumentation. The function name to be matched is its user-visible
10408 name, such as @code{vector<int> blah(const vector<int> &)}, not the
10409 internal mangled name (e.g., @code{_Z4blahRSt6vectorIiSaIiEE}). The
10410 match is done on substrings: if the @var{sym} parameter is a substring
10411 of the function name, it is considered to be a match. For C99 and C++
10412 extended identifiers, the function name must be given in UTF-8, not
10413 using universal character names.
10414
10415 @end table
10416
10417
10418 @node Preprocessor Options
10419 @section Options Controlling the Preprocessor
10420 @cindex preprocessor options
10421 @cindex options, preprocessor
10422
10423 These options control the C preprocessor, which is run on each C source
10424 file before actual compilation.
10425
10426 If you use the @option{-E} option, nothing is done except preprocessing.
10427 Some of these options make sense only together with @option{-E} because
10428 they cause the preprocessor output to be unsuitable for actual
10429 compilation.
10430
10431 @table @gcctabopt
10432 @item -Wp,@var{option}
10433 @opindex Wp
10434 You can use @option{-Wp,@var{option}} to bypass the compiler driver
10435 and pass @var{option} directly through to the preprocessor. If
10436 @var{option} contains commas, it is split into multiple options at the
10437 commas. However, many options are modified, translated or interpreted
10438 by the compiler driver before being passed to the preprocessor, and
10439 @option{-Wp} forcibly bypasses this phase. The preprocessor's direct
10440 interface is undocumented and subject to change, so whenever possible
10441 you should avoid using @option{-Wp} and let the driver handle the
10442 options instead.
10443
10444 @item -Xpreprocessor @var{option}
10445 @opindex Xpreprocessor
10446 Pass @var{option} as an option to the preprocessor. You can use this to
10447 supply system-specific preprocessor options that GCC does not
10448 recognize.
10449
10450 If you want to pass an option that takes an argument, you must use
10451 @option{-Xpreprocessor} twice, once for the option and once for the argument.
10452
10453 @item -no-integrated-cpp
10454 @opindex no-integrated-cpp
10455 Perform preprocessing as a separate pass before compilation.
10456 By default, GCC performs preprocessing as an integrated part of
10457 input tokenization and parsing.
10458 If this option is provided, the appropriate language front end
10459 (@command{cc1}, @command{cc1plus}, or @command{cc1obj} for C, C++,
10460 and Objective-C, respectively) is instead invoked twice,
10461 once for preprocessing only and once for actual compilation
10462 of the preprocessed input.
10463 This option may be useful in conjunction with the @option{-B} or
10464 @option{-wrapper} options to specify an alternate preprocessor or
10465 perform additional processing of the program source between
10466 normal preprocessing and compilation.
10467 @end table
10468
10469 @include cppopts.texi
10470
10471 @node Assembler Options
10472 @section Passing Options to the Assembler
10473
10474 @c prevent bad page break with this line
10475 You can pass options to the assembler.
10476
10477 @table @gcctabopt
10478 @item -Wa,@var{option}
10479 @opindex Wa
10480 Pass @var{option} as an option to the assembler. If @var{option}
10481 contains commas, it is split into multiple options at the commas.
10482
10483 @item -Xassembler @var{option}
10484 @opindex Xassembler
10485 Pass @var{option} as an option to the assembler. You can use this to
10486 supply system-specific assembler options that GCC does not
10487 recognize.
10488
10489 If you want to pass an option that takes an argument, you must use
10490 @option{-Xassembler} twice, once for the option and once for the argument.
10491
10492 @end table
10493
10494 @node Link Options
10495 @section Options for Linking
10496 @cindex link options
10497 @cindex options, linking
10498
10499 These options come into play when the compiler links object files into
10500 an executable output file. They are meaningless if the compiler is
10501 not doing a link step.
10502
10503 @table @gcctabopt
10504 @cindex file names
10505 @item @var{object-file-name}
10506 A file name that does not end in a special recognized suffix is
10507 considered to name an object file or library. (Object files are
10508 distinguished from libraries by the linker according to the file
10509 contents.) If linking is done, these object files are used as input
10510 to the linker.
10511
10512 @item -c
10513 @itemx -S
10514 @itemx -E
10515 @opindex c
10516 @opindex S
10517 @opindex E
10518 If any of these options is used, then the linker is not run, and
10519 object file names should not be used as arguments. @xref{Overall
10520 Options}.
10521
10522 @item -fuse-ld=bfd
10523 @opindex fuse-ld=bfd
10524 Use the @command{bfd} linker instead of the default linker.
10525
10526 @item -fuse-ld=gold
10527 @opindex fuse-ld=gold
10528 Use the @command{gold} linker instead of the default linker.
10529
10530 @cindex Libraries
10531 @item -l@var{library}
10532 @itemx -l @var{library}
10533 @opindex l
10534 Search the library named @var{library} when linking. (The second
10535 alternative with the library as a separate argument is only for
10536 POSIX compliance and is not recommended.)
10537
10538 It makes a difference where in the command you write this option; the
10539 linker searches and processes libraries and object files in the order they
10540 are specified. Thus, @samp{foo.o -lz bar.o} searches library @samp{z}
10541 after file @file{foo.o} but before @file{bar.o}. If @file{bar.o} refers
10542 to functions in @samp{z}, those functions may not be loaded.
10543
10544 The linker searches a standard list of directories for the library,
10545 which is actually a file named @file{lib@var{library}.a}. The linker
10546 then uses this file as if it had been specified precisely by name.
10547
10548 The directories searched include several standard system directories
10549 plus any that you specify with @option{-L}.
10550
10551 Normally the files found this way are library files---archive files
10552 whose members are object files. The linker handles an archive file by
10553 scanning through it for members which define symbols that have so far
10554 been referenced but not defined. But if the file that is found is an
10555 ordinary object file, it is linked in the usual fashion. The only
10556 difference between using an @option{-l} option and specifying a file name
10557 is that @option{-l} surrounds @var{library} with @samp{lib} and @samp{.a}
10558 and searches several directories.
10559
10560 @item -lobjc
10561 @opindex lobjc
10562 You need this special case of the @option{-l} option in order to
10563 link an Objective-C or Objective-C++ program.
10564
10565 @item -nostartfiles
10566 @opindex nostartfiles
10567 Do not use the standard system startup files when linking.
10568 The standard system libraries are used normally, unless @option{-nostdlib}
10569 or @option{-nodefaultlibs} is used.
10570
10571 @item -nodefaultlibs
10572 @opindex nodefaultlibs
10573 Do not use the standard system libraries when linking.
10574 Only the libraries you specify are passed to the linker, and options
10575 specifying linkage of the system libraries, such as @option{-static-libgcc}
10576 or @option{-shared-libgcc}, are ignored.
10577 The standard startup files are used normally, unless @option{-nostartfiles}
10578 is used.
10579
10580 The compiler may generate calls to @code{memcmp},
10581 @code{memset}, @code{memcpy} and @code{memmove}.
10582 These entries are usually resolved by entries in
10583 libc. These entry points should be supplied through some other
10584 mechanism when this option is specified.
10585
10586 @item -nostdlib
10587 @opindex nostdlib
10588 Do not use the standard system startup files or libraries when linking.
10589 No startup files and only the libraries you specify are passed to
10590 the linker, and options specifying linkage of the system libraries, such as
10591 @option{-static-libgcc} or @option{-shared-libgcc}, are ignored.
10592
10593 The compiler may generate calls to @code{memcmp}, @code{memset},
10594 @code{memcpy} and @code{memmove}.
10595 These entries are usually resolved by entries in
10596 libc. These entry points should be supplied through some other
10597 mechanism when this option is specified.
10598
10599 @cindex @option{-lgcc}, use with @option{-nostdlib}
10600 @cindex @option{-nostdlib} and unresolved references
10601 @cindex unresolved references and @option{-nostdlib}
10602 @cindex @option{-lgcc}, use with @option{-nodefaultlibs}
10603 @cindex @option{-nodefaultlibs} and unresolved references
10604 @cindex unresolved references and @option{-nodefaultlibs}
10605 One of the standard libraries bypassed by @option{-nostdlib} and
10606 @option{-nodefaultlibs} is @file{libgcc.a}, a library of internal subroutines
10607 which GCC uses to overcome shortcomings of particular machines, or special
10608 needs for some languages.
10609 (@xref{Interface,,Interfacing to GCC Output,gccint,GNU Compiler
10610 Collection (GCC) Internals},
10611 for more discussion of @file{libgcc.a}.)
10612 In most cases, you need @file{libgcc.a} even when you want to avoid
10613 other standard libraries. In other words, when you specify @option{-nostdlib}
10614 or @option{-nodefaultlibs} you should usually specify @option{-lgcc} as well.
10615 This ensures that you have no unresolved references to internal GCC
10616 library subroutines.
10617 (An example of such an internal subroutine is @code{__main}, used to ensure C++
10618 constructors are called; @pxref{Collect2,,@code{collect2}, gccint,
10619 GNU Compiler Collection (GCC) Internals}.)
10620
10621 @item -pie
10622 @opindex pie
10623 Produce a position independent executable on targets that support it.
10624 For predictable results, you must also specify the same set of options
10625 used for compilation (@option{-fpie}, @option{-fPIE},
10626 or model suboptions) when you specify this linker option.
10627
10628 @item -no-pie
10629 @opindex no-pie
10630 Don't produce a position independent executable.
10631
10632 @item -rdynamic
10633 @opindex rdynamic
10634 Pass the flag @option{-export-dynamic} to the ELF linker, on targets
10635 that support it. This instructs the linker to add all symbols, not
10636 only used ones, to the dynamic symbol table. This option is needed
10637 for some uses of @code{dlopen} or to allow obtaining backtraces
10638 from within a program.
10639
10640 @item -s
10641 @opindex s
10642 Remove all symbol table and relocation information from the executable.
10643
10644 @item -static
10645 @opindex static
10646 On systems that support dynamic linking, this prevents linking with the shared
10647 libraries. On other systems, this option has no effect.
10648
10649 @item -shared
10650 @opindex shared
10651 Produce a shared object which can then be linked with other objects to
10652 form an executable. Not all systems support this option. For predictable
10653 results, you must also specify the same set of options used for compilation
10654 (@option{-fpic}, @option{-fPIC}, or model suboptions) when
10655 you specify this linker option.@footnote{On some systems, @samp{gcc -shared}
10656 needs to build supplementary stub code for constructors to work. On
10657 multi-libbed systems, @samp{gcc -shared} must select the correct support
10658 libraries to link against. Failing to supply the correct flags may lead
10659 to subtle defects. Supplying them in cases where they are not necessary
10660 is innocuous.}
10661
10662 @item -shared-libgcc
10663 @itemx -static-libgcc
10664 @opindex shared-libgcc
10665 @opindex static-libgcc
10666 On systems that provide @file{libgcc} as a shared library, these options
10667 force the use of either the shared or static version, respectively.
10668 If no shared version of @file{libgcc} was built when the compiler was
10669 configured, these options have no effect.
10670
10671 There are several situations in which an application should use the
10672 shared @file{libgcc} instead of the static version. The most common
10673 of these is when the application wishes to throw and catch exceptions
10674 across different shared libraries. In that case, each of the libraries
10675 as well as the application itself should use the shared @file{libgcc}.
10676
10677 Therefore, the G++ and GCJ drivers automatically add
10678 @option{-shared-libgcc} whenever you build a shared library or a main
10679 executable, because C++ and Java programs typically use exceptions, so
10680 this is the right thing to do.
10681
10682 If, instead, you use the GCC driver to create shared libraries, you may
10683 find that they are not always linked with the shared @file{libgcc}.
10684 If GCC finds, at its configuration time, that you have a non-GNU linker
10685 or a GNU linker that does not support option @option{--eh-frame-hdr},
10686 it links the shared version of @file{libgcc} into shared libraries
10687 by default. Otherwise, it takes advantage of the linker and optimizes
10688 away the linking with the shared version of @file{libgcc}, linking with
10689 the static version of libgcc by default. This allows exceptions to
10690 propagate through such shared libraries, without incurring relocation
10691 costs at library load time.
10692
10693 However, if a library or main executable is supposed to throw or catch
10694 exceptions, you must link it using the G++ or GCJ driver, as appropriate
10695 for the languages used in the program, or using the option
10696 @option{-shared-libgcc}, such that it is linked with the shared
10697 @file{libgcc}.
10698
10699 @item -static-libasan
10700 @opindex static-libasan
10701 When the @option{-fsanitize=address} option is used to link a program,
10702 the GCC driver automatically links against @option{libasan}. If
10703 @file{libasan} is available as a shared library, and the @option{-static}
10704 option is not used, then this links against the shared version of
10705 @file{libasan}. The @option{-static-libasan} option directs the GCC
10706 driver to link @file{libasan} statically, without necessarily linking
10707 other libraries statically.
10708
10709 @item -static-libtsan
10710 @opindex static-libtsan
10711 When the @option{-fsanitize=thread} option is used to link a program,
10712 the GCC driver automatically links against @option{libtsan}. If
10713 @file{libtsan} is available as a shared library, and the @option{-static}
10714 option is not used, then this links against the shared version of
10715 @file{libtsan}. The @option{-static-libtsan} option directs the GCC
10716 driver to link @file{libtsan} statically, without necessarily linking
10717 other libraries statically.
10718
10719 @item -static-liblsan
10720 @opindex static-liblsan
10721 When the @option{-fsanitize=leak} option is used to link a program,
10722 the GCC driver automatically links against @option{liblsan}. If
10723 @file{liblsan} is available as a shared library, and the @option{-static}
10724 option is not used, then this links against the shared version of
10725 @file{liblsan}. The @option{-static-liblsan} option directs the GCC
10726 driver to link @file{liblsan} statically, without necessarily linking
10727 other libraries statically.
10728
10729 @item -static-libubsan
10730 @opindex static-libubsan
10731 When the @option{-fsanitize=undefined} option is used to link a program,
10732 the GCC driver automatically links against @option{libubsan}. If
10733 @file{libubsan} is available as a shared library, and the @option{-static}
10734 option is not used, then this links against the shared version of
10735 @file{libubsan}. The @option{-static-libubsan} option directs the GCC
10736 driver to link @file{libubsan} statically, without necessarily linking
10737 other libraries statically.
10738
10739 @item -static-libmpx
10740 @opindex static-libmpx
10741 When the @option{-fcheck-pointer bounds} and @option{-mmpx} options are
10742 used to link a program, the GCC driver automatically links against
10743 @file{libmpx}. If @file{libmpx} is available as a shared library,
10744 and the @option{-static} option is not used, then this links against
10745 the shared version of @file{libmpx}. The @option{-static-libmpx}
10746 option directs the GCC driver to link @file{libmpx} statically,
10747 without necessarily linking other libraries statically.
10748
10749 @item -static-libmpxwrappers
10750 @opindex static-libmpxwrappers
10751 When the @option{-fcheck-pointer bounds} and @option{-mmpx} options are used
10752 to link a program without also using @option{-fno-chkp-use-wrappers}, the
10753 GCC driver automatically links against @file{libmpxwrappers}. If
10754 @file{libmpxwrappers} is available as a shared library, and the
10755 @option{-static} option is not used, then this links against the shared
10756 version of @file{libmpxwrappers}. The @option{-static-libmpxwrappers}
10757 option directs the GCC driver to link @file{libmpxwrappers} statically,
10758 without necessarily linking other libraries statically.
10759
10760 @item -static-libstdc++
10761 @opindex static-libstdc++
10762 When the @command{g++} program is used to link a C++ program, it
10763 normally automatically links against @option{libstdc++}. If
10764 @file{libstdc++} is available as a shared library, and the
10765 @option{-static} option is not used, then this links against the
10766 shared version of @file{libstdc++}. That is normally fine. However, it
10767 is sometimes useful to freeze the version of @file{libstdc++} used by
10768 the program without going all the way to a fully static link. The
10769 @option{-static-libstdc++} option directs the @command{g++} driver to
10770 link @file{libstdc++} statically, without necessarily linking other
10771 libraries statically.
10772
10773 @item -symbolic
10774 @opindex symbolic
10775 Bind references to global symbols when building a shared object. Warn
10776 about any unresolved references (unless overridden by the link editor
10777 option @option{-Xlinker -z -Xlinker defs}). Only a few systems support
10778 this option.
10779
10780 @item -T @var{script}
10781 @opindex T
10782 @cindex linker script
10783 Use @var{script} as the linker script. This option is supported by most
10784 systems using the GNU linker. On some targets, such as bare-board
10785 targets without an operating system, the @option{-T} option may be required
10786 when linking to avoid references to undefined symbols.
10787
10788 @item -Xlinker @var{option}
10789 @opindex Xlinker
10790 Pass @var{option} as an option to the linker. You can use this to
10791 supply system-specific linker options that GCC does not recognize.
10792
10793 If you want to pass an option that takes a separate argument, you must use
10794 @option{-Xlinker} twice, once for the option and once for the argument.
10795 For example, to pass @option{-assert definitions}, you must write
10796 @option{-Xlinker -assert -Xlinker definitions}. It does not work to write
10797 @option{-Xlinker "-assert definitions"}, because this passes the entire
10798 string as a single argument, which is not what the linker expects.
10799
10800 When using the GNU linker, it is usually more convenient to pass
10801 arguments to linker options using the @option{@var{option}=@var{value}}
10802 syntax than as separate arguments. For example, you can specify
10803 @option{-Xlinker -Map=output.map} rather than
10804 @option{-Xlinker -Map -Xlinker output.map}. Other linkers may not support
10805 this syntax for command-line options.
10806
10807 @item -Wl,@var{option}
10808 @opindex Wl
10809 Pass @var{option} as an option to the linker. If @var{option} contains
10810 commas, it is split into multiple options at the commas. You can use this
10811 syntax to pass an argument to the option.
10812 For example, @option{-Wl,-Map,output.map} passes @option{-Map output.map} to the
10813 linker. When using the GNU linker, you can also get the same effect with
10814 @option{-Wl,-Map=output.map}.
10815
10816 @item -u @var{symbol}
10817 @opindex u
10818 Pretend the symbol @var{symbol} is undefined, to force linking of
10819 library modules to define it. You can use @option{-u} multiple times with
10820 different symbols to force loading of additional library modules.
10821
10822 @item -z @var{keyword}
10823 @opindex z
10824 @option{-z} is passed directly on to the linker along with the keyword
10825 @var{keyword}. See the section in the documentation of your linker for
10826 permitted values and their meanings.
10827 @end table
10828
10829 @node Directory Options
10830 @section Options for Directory Search
10831 @cindex directory options
10832 @cindex options, directory search
10833 @cindex search path
10834
10835 These options specify directories to search for header files, for
10836 libraries and for parts of the compiler:
10837
10838 @table @gcctabopt
10839 @item -I@var{dir}
10840 @opindex I
10841 Add the directory @var{dir} to the head of the list of directories to be
10842 searched for header files. This can be used to override a system header
10843 file, substituting your own version, since these directories are
10844 searched before the system header file directories. However, you should
10845 not use this option to add directories that contain vendor-supplied
10846 system header files (use @option{-isystem} for that). If you use more than
10847 one @option{-I} option, the directories are scanned in left-to-right
10848 order; the standard system directories come after.
10849
10850 If a standard system include directory, or a directory specified with
10851 @option{-isystem}, is also specified with @option{-I}, the @option{-I}
10852 option is ignored. The directory is still searched but as a
10853 system directory at its normal position in the system include chain.
10854 This is to ensure that GCC's procedure to fix buggy system headers and
10855 the ordering for the @code{include_next} directive are not inadvertently changed.
10856 If you really need to change the search order for system directories,
10857 use the @option{-nostdinc} and/or @option{-isystem} options.
10858
10859 @item -iplugindir=@var{dir}
10860 @opindex iplugindir=
10861 Set the directory to search for plugins that are passed
10862 by @option{-fplugin=@var{name}} instead of
10863 @option{-fplugin=@var{path}/@var{name}.so}. This option is not meant
10864 to be used by the user, but only passed by the driver.
10865
10866 @item -iquote@var{dir}
10867 @opindex iquote
10868 Add the directory @var{dir} to the head of the list of directories to
10869 be searched for header files only for the case of @code{#include
10870 "@var{file}"}; they are not searched for @code{#include <@var{file}>},
10871 otherwise just like @option{-I}.
10872
10873 @item -L@var{dir}
10874 @opindex L
10875 Add directory @var{dir} to the list of directories to be searched
10876 for @option{-l}.
10877
10878 @item -B@var{prefix}
10879 @opindex B
10880 This option specifies where to find the executables, libraries,
10881 include files, and data files of the compiler itself.
10882
10883 The compiler driver program runs one or more of the subprograms
10884 @command{cpp}, @command{cc1}, @command{as} and @command{ld}. It tries
10885 @var{prefix} as a prefix for each program it tries to run, both with and
10886 without @samp{@var{machine}/@var{version}/} for the corresponding target
10887 machine and compiler version.
10888
10889 For each subprogram to be run, the compiler driver first tries the
10890 @option{-B} prefix, if any. If that name is not found, or if @option{-B}
10891 is not specified, the driver tries two standard prefixes,
10892 @file{/usr/lib/gcc/} and @file{/usr/local/lib/gcc/}. If neither of
10893 those results in a file name that is found, the unmodified program
10894 name is searched for using the directories specified in your
10895 @env{PATH} environment variable.
10896
10897 The compiler checks to see if the path provided by @option{-B}
10898 refers to a directory, and if necessary it adds a directory
10899 separator character at the end of the path.
10900
10901 @option{-B} prefixes that effectively specify directory names also apply
10902 to libraries in the linker, because the compiler translates these
10903 options into @option{-L} options for the linker. They also apply to
10904 include files in the preprocessor, because the compiler translates these
10905 options into @option{-isystem} options for the preprocessor. In this case,
10906 the compiler appends @samp{include} to the prefix.
10907
10908 The runtime support file @file{libgcc.a} can also be searched for using
10909 the @option{-B} prefix, if needed. If it is not found there, the two
10910 standard prefixes above are tried, and that is all. The file is left
10911 out of the link if it is not found by those means.
10912
10913 Another way to specify a prefix much like the @option{-B} prefix is to use
10914 the environment variable @env{GCC_EXEC_PREFIX}. @xref{Environment
10915 Variables}.
10916
10917 As a special kludge, if the path provided by @option{-B} is
10918 @file{[dir/]stage@var{N}/}, where @var{N} is a number in the range 0 to
10919 9, then it is replaced by @file{[dir/]include}. This is to help
10920 with boot-strapping the compiler.
10921
10922 @item -no-canonical-prefixes
10923 @opindex no-canonical-prefixes
10924 Do not expand any symbolic links, resolve references to @samp{/../}
10925 or @samp{/./}, or make the path absolute when generating a relative
10926 prefix.
10927
10928 @item --sysroot=@var{dir}
10929 @opindex sysroot
10930 Use @var{dir} as the logical root directory for headers and libraries.
10931 For example, if the compiler normally searches for headers in
10932 @file{/usr/include} and libraries in @file{/usr/lib}, it instead
10933 searches @file{@var{dir}/usr/include} and @file{@var{dir}/usr/lib}.
10934
10935 If you use both this option and the @option{-isysroot} option, then
10936 the @option{--sysroot} option applies to libraries, but the
10937 @option{-isysroot} option applies to header files.
10938
10939 The GNU linker (beginning with version 2.16) has the necessary support
10940 for this option. If your linker does not support this option, the
10941 header file aspect of @option{--sysroot} still works, but the
10942 library aspect does not.
10943
10944 @item --no-sysroot-suffix
10945 @opindex no-sysroot-suffix
10946 For some targets, a suffix is added to the root directory specified
10947 with @option{--sysroot}, depending on the other options used, so that
10948 headers may for example be found in
10949 @file{@var{dir}/@var{suffix}/usr/include} instead of
10950 @file{@var{dir}/usr/include}. This option disables the addition of
10951 such a suffix.
10952
10953 @item -I-
10954 @opindex I-
10955 This option has been deprecated. Please use @option{-iquote} instead for
10956 @option{-I} directories before the @option{-I-} and remove the @option{-I-}
10957 option.
10958 Any directories you specify with @option{-I} options before the @option{-I-}
10959 option are searched only for the case of @code{#include "@var{file}"};
10960 they are not searched for @code{#include <@var{file}>}.
10961
10962 If additional directories are specified with @option{-I} options after
10963 the @option{-I-} option, these directories are searched for all @code{#include}
10964 directives. (Ordinarily @emph{all} @option{-I} directories are used
10965 this way.)
10966
10967 In addition, the @option{-I-} option inhibits the use of the current
10968 directory (where the current input file came from) as the first search
10969 directory for @code{#include "@var{file}"}. There is no way to
10970 override this effect of @option{-I-}. With @option{-I.} you can specify
10971 searching the directory that is current when the compiler is
10972 invoked. That is not exactly the same as what the preprocessor does
10973 by default, but it is often satisfactory.
10974
10975 @option{-I-} does not inhibit the use of the standard system directories
10976 for header files. Thus, @option{-I-} and @option{-nostdinc} are
10977 independent.
10978 @end table
10979
10980 @node Code Gen Options
10981 @section Options for Code Generation Conventions
10982 @cindex code generation conventions
10983 @cindex options, code generation
10984 @cindex run-time options
10985
10986 These machine-independent options control the interface conventions
10987 used in code generation.
10988
10989 Most of them have both positive and negative forms; the negative form
10990 of @option{-ffoo} is @option{-fno-foo}. In the table below, only
10991 one of the forms is listed---the one that is not the default. You
10992 can figure out the other form by either removing @samp{no-} or adding
10993 it.
10994
10995 @table @gcctabopt
10996 @item -fstack-reuse=@var{reuse-level}
10997 @opindex fstack_reuse
10998 This option controls stack space reuse for user declared local/auto variables
10999 and compiler generated temporaries. @var{reuse_level} can be @samp{all},
11000 @samp{named_vars}, or @samp{none}. @samp{all} enables stack reuse for all
11001 local variables and temporaries, @samp{named_vars} enables the reuse only for
11002 user defined local variables with names, and @samp{none} disables stack reuse
11003 completely. The default value is @samp{all}. The option is needed when the
11004 program extends the lifetime of a scoped local variable or a compiler generated
11005 temporary beyond the end point defined by the language. When a lifetime of
11006 a variable ends, and if the variable lives in memory, the optimizing compiler
11007 has the freedom to reuse its stack space with other temporaries or scoped
11008 local variables whose live range does not overlap with it. Legacy code extending
11009 local lifetime is likely to break with the stack reuse optimization.
11010
11011 For example,
11012
11013 @smallexample
11014 int *p;
11015 @{
11016 int local1;
11017
11018 p = &local1;
11019 local1 = 10;
11020 ....
11021 @}
11022 @{
11023 int local2;
11024 local2 = 20;
11025 ...
11026 @}
11027
11028 if (*p == 10) // out of scope use of local1
11029 @{
11030
11031 @}
11032 @end smallexample
11033
11034 Another example:
11035 @smallexample
11036
11037 struct A
11038 @{
11039 A(int k) : i(k), j(k) @{ @}
11040 int i;
11041 int j;
11042 @};
11043
11044 A *ap;
11045
11046 void foo(const A& ar)
11047 @{
11048 ap = &ar;
11049 @}
11050
11051 void bar()
11052 @{
11053 foo(A(10)); // temp object's lifetime ends when foo returns
11054
11055 @{
11056 A a(20);
11057 ....
11058 @}
11059 ap->i+= 10; // ap references out of scope temp whose space
11060 // is reused with a. What is the value of ap->i?
11061 @}
11062
11063 @end smallexample
11064
11065 The lifetime of a compiler generated temporary is well defined by the C++
11066 standard. When a lifetime of a temporary ends, and if the temporary lives
11067 in memory, the optimizing compiler has the freedom to reuse its stack
11068 space with other temporaries or scoped local variables whose live range
11069 does not overlap with it. However some of the legacy code relies on
11070 the behavior of older compilers in which temporaries' stack space is
11071 not reused, the aggressive stack reuse can lead to runtime errors. This
11072 option is used to control the temporary stack reuse optimization.
11073
11074 @item -ftrapv
11075 @opindex ftrapv
11076 This option generates traps for signed overflow on addition, subtraction,
11077 multiplication operations.
11078 The options @option{-ftrapv} and @option{-fwrapv} override each other, so using
11079 @option{-ftrapv} @option{-fwrapv} on the command-line results in
11080 @option{-fwrapv} being effective. Note that only active options override, so
11081 using @option{-ftrapv} @option{-fwrapv} @option{-fno-wrapv} on the command-line
11082 results in @option{-ftrapv} being effective.
11083
11084 @item -fwrapv
11085 @opindex fwrapv
11086 This option instructs the compiler to assume that signed arithmetic
11087 overflow of addition, subtraction and multiplication wraps around
11088 using twos-complement representation. This flag enables some optimizations
11089 and disables others. This option is enabled by default for the Java
11090 front end, as required by the Java language specification.
11091 The options @option{-ftrapv} and @option{-fwrapv} override each other, so using
11092 @option{-ftrapv} @option{-fwrapv} on the command-line results in
11093 @option{-fwrapv} being effective. Note that only active options override, so
11094 using @option{-ftrapv} @option{-fwrapv} @option{-fno-wrapv} on the command-line
11095 results in @option{-ftrapv} being effective.
11096
11097 @item -fexceptions
11098 @opindex fexceptions
11099 Enable exception handling. Generates extra code needed to propagate
11100 exceptions. For some targets, this implies GCC generates frame
11101 unwind information for all functions, which can produce significant data
11102 size overhead, although it does not affect execution. If you do not
11103 specify this option, GCC enables it by default for languages like
11104 C++ that normally require exception handling, and disables it for
11105 languages like C that do not normally require it. However, you may need
11106 to enable this option when compiling C code that needs to interoperate
11107 properly with exception handlers written in C++. You may also wish to
11108 disable this option if you are compiling older C++ programs that don't
11109 use exception handling.
11110
11111 @item -fnon-call-exceptions
11112 @opindex fnon-call-exceptions
11113 Generate code that allows trapping instructions to throw exceptions.
11114 Note that this requires platform-specific runtime support that does
11115 not exist everywhere. Moreover, it only allows @emph{trapping}
11116 instructions to throw exceptions, i.e.@: memory references or floating-point
11117 instructions. It does not allow exceptions to be thrown from
11118 arbitrary signal handlers such as @code{SIGALRM}.
11119
11120 @item -fdelete-dead-exceptions
11121 @opindex fdelete-dead-exceptions
11122 Consider that instructions that may throw exceptions but don't otherwise
11123 contribute to the execution of the program can be optimized away.
11124 This option is enabled by default for the Ada front end, as permitted by
11125 the Ada language specification.
11126 Optimization passes that cause dead exceptions to be removed are enabled independently at different optimization levels.
11127
11128 @item -funwind-tables
11129 @opindex funwind-tables
11130 Similar to @option{-fexceptions}, except that it just generates any needed
11131 static data, but does not affect the generated code in any other way.
11132 You normally do not need to enable this option; instead, a language processor
11133 that needs this handling enables it on your behalf.
11134
11135 @item -fasynchronous-unwind-tables
11136 @opindex fasynchronous-unwind-tables
11137 Generate unwind table in DWARF format, if supported by target machine. The
11138 table is exact at each instruction boundary, so it can be used for stack
11139 unwinding from asynchronous events (such as debugger or garbage collector).
11140
11141 @item -fno-gnu-unique
11142 @opindex fno-gnu-unique
11143 On systems with recent GNU assembler and C library, the C++ compiler
11144 uses the @code{STB_GNU_UNIQUE} binding to make sure that definitions
11145 of template static data members and static local variables in inline
11146 functions are unique even in the presence of @code{RTLD_LOCAL}; this
11147 is necessary to avoid problems with a library used by two different
11148 @code{RTLD_LOCAL} plugins depending on a definition in one of them and
11149 therefore disagreeing with the other one about the binding of the
11150 symbol. But this causes @code{dlclose} to be ignored for affected
11151 DSOs; if your program relies on reinitialization of a DSO via
11152 @code{dlclose} and @code{dlopen}, you can use
11153 @option{-fno-gnu-unique}.
11154
11155 @item -fpcc-struct-return
11156 @opindex fpcc-struct-return
11157 Return ``short'' @code{struct} and @code{union} values in memory like
11158 longer ones, rather than in registers. This convention is less
11159 efficient, but it has the advantage of allowing intercallability between
11160 GCC-compiled files and files compiled with other compilers, particularly
11161 the Portable C Compiler (pcc).
11162
11163 The precise convention for returning structures in memory depends
11164 on the target configuration macros.
11165
11166 Short structures and unions are those whose size and alignment match
11167 that of some integer type.
11168
11169 @strong{Warning:} code compiled with the @option{-fpcc-struct-return}
11170 switch is not binary compatible with code compiled with the
11171 @option{-freg-struct-return} switch.
11172 Use it to conform to a non-default application binary interface.
11173
11174 @item -freg-struct-return
11175 @opindex freg-struct-return
11176 Return @code{struct} and @code{union} values in registers when possible.
11177 This is more efficient for small structures than
11178 @option{-fpcc-struct-return}.
11179
11180 If you specify neither @option{-fpcc-struct-return} nor
11181 @option{-freg-struct-return}, GCC defaults to whichever convention is
11182 standard for the target. If there is no standard convention, GCC
11183 defaults to @option{-fpcc-struct-return}, except on targets where GCC is
11184 the principal compiler. In those cases, we can choose the standard, and
11185 we chose the more efficient register return alternative.
11186
11187 @strong{Warning:} code compiled with the @option{-freg-struct-return}
11188 switch is not binary compatible with code compiled with the
11189 @option{-fpcc-struct-return} switch.
11190 Use it to conform to a non-default application binary interface.
11191
11192 @item -fshort-enums
11193 @opindex fshort-enums
11194 Allocate to an @code{enum} type only as many bytes as it needs for the
11195 declared range of possible values. Specifically, the @code{enum} type
11196 is equivalent to the smallest integer type that has enough room.
11197
11198 @strong{Warning:} the @option{-fshort-enums} switch causes GCC to generate
11199 code that is not binary compatible with code generated without that switch.
11200 Use it to conform to a non-default application binary interface.
11201
11202 @item -fshort-wchar
11203 @opindex fshort-wchar
11204 Override the underlying type for @code{wchar_t} to be @code{short
11205 unsigned int} instead of the default for the target. This option is
11206 useful for building programs to run under WINE@.
11207
11208 @strong{Warning:} the @option{-fshort-wchar} switch causes GCC to generate
11209 code that is not binary compatible with code generated without that switch.
11210 Use it to conform to a non-default application binary interface.
11211
11212 @item -fno-common
11213 @opindex fno-common
11214 In C code, controls the placement of uninitialized global variables.
11215 Unix C compilers have traditionally permitted multiple definitions of
11216 such variables in different compilation units by placing the variables
11217 in a common block.
11218 This is the behavior specified by @option{-fcommon}, and is the default
11219 for GCC on most targets.
11220 On the other hand, this behavior is not required by ISO C, and on some
11221 targets may carry a speed or code size penalty on variable references.
11222 The @option{-fno-common} option specifies that the compiler should place
11223 uninitialized global variables in the data section of the object file,
11224 rather than generating them as common blocks.
11225 This has the effect that if the same variable is declared
11226 (without @code{extern}) in two different compilations,
11227 you get a multiple-definition error when you link them.
11228 In this case, you must compile with @option{-fcommon} instead.
11229 Compiling with @option{-fno-common} is useful on targets for which
11230 it provides better performance, or if you wish to verify that the
11231 program will work on other systems that always treat uninitialized
11232 variable declarations this way.
11233
11234 @item -fno-ident
11235 @opindex fno-ident
11236 Ignore the @code{#ident} directive.
11237
11238 @item -finhibit-size-directive
11239 @opindex finhibit-size-directive
11240 Don't output a @code{.size} assembler directive, or anything else that
11241 would cause trouble if the function is split in the middle, and the
11242 two halves are placed at locations far apart in memory. This option is
11243 used when compiling @file{crtstuff.c}; you should not need to use it
11244 for anything else.
11245
11246 @item -fverbose-asm
11247 @opindex fverbose-asm
11248 Put extra commentary information in the generated assembly code to
11249 make it more readable. This option is generally only of use to those
11250 who actually need to read the generated assembly code (perhaps while
11251 debugging the compiler itself).
11252
11253 @option{-fno-verbose-asm}, the default, causes the
11254 extra information to be omitted and is useful when comparing two assembler
11255 files.
11256
11257 @item -frecord-gcc-switches
11258 @opindex frecord-gcc-switches
11259 This switch causes the command line used to invoke the
11260 compiler to be recorded into the object file that is being created.
11261 This switch is only implemented on some targets and the exact format
11262 of the recording is target and binary file format dependent, but it
11263 usually takes the form of a section containing ASCII text. This
11264 switch is related to the @option{-fverbose-asm} switch, but that
11265 switch only records information in the assembler output file as
11266 comments, so it never reaches the object file.
11267 See also @option{-grecord-gcc-switches} for another
11268 way of storing compiler options into the object file.
11269
11270 @item -fpic
11271 @opindex fpic
11272 @cindex global offset table
11273 @cindex PIC
11274 Generate position-independent code (PIC) suitable for use in a shared
11275 library, if supported for the target machine. Such code accesses all
11276 constant addresses through a global offset table (GOT)@. The dynamic
11277 loader resolves the GOT entries when the program starts (the dynamic
11278 loader is not part of GCC; it is part of the operating system). If
11279 the GOT size for the linked executable exceeds a machine-specific
11280 maximum size, you get an error message from the linker indicating that
11281 @option{-fpic} does not work; in that case, recompile with @option{-fPIC}
11282 instead. (These maximums are 8k on the SPARC, 28k on AArch64 and 32k
11283 on the m68k and RS/6000. The x86 has no such limit.)
11284
11285 Position-independent code requires special support, and therefore works
11286 only on certain machines. For the x86, GCC supports PIC for System V
11287 but not for the Sun 386i. Code generated for the IBM RS/6000 is always
11288 position-independent.
11289
11290 When this flag is set, the macros @code{__pic__} and @code{__PIC__}
11291 are defined to 1.
11292
11293 @item -fPIC
11294 @opindex fPIC
11295 If supported for the target machine, emit position-independent code,
11296 suitable for dynamic linking and avoiding any limit on the size of the
11297 global offset table. This option makes a difference on AArch64, m68k,
11298 PowerPC and SPARC@.
11299
11300 Position-independent code requires special support, and therefore works
11301 only on certain machines.
11302
11303 When this flag is set, the macros @code{__pic__} and @code{__PIC__}
11304 are defined to 2.
11305
11306 @item -fpie
11307 @itemx -fPIE
11308 @opindex fpie
11309 @opindex fPIE
11310 These options are similar to @option{-fpic} and @option{-fPIC}, but
11311 generated position independent code can be only linked into executables.
11312 Usually these options are used when @option{-pie} GCC option is
11313 used during linking.
11314
11315 @option{-fpie} and @option{-fPIE} both define the macros
11316 @code{__pie__} and @code{__PIE__}. The macros have the value 1
11317 for @option{-fpie} and 2 for @option{-fPIE}.
11318
11319 @item -fno-plt
11320 @opindex fno-plt
11321 Do not use the PLT for external function calls in position-independent code.
11322 Instead, load the callee address at call sites from the GOT and branch to it.
11323 This leads to more efficient code by eliminating PLT stubs and exposing
11324 GOT loads to optimizations. On architectures such as 32-bit x86 where
11325 PLT stubs expect the GOT pointer in a specific register, this gives more
11326 register allocation freedom to the compiler.
11327 Lazy binding requires use of the PLT;
11328 with @option{-fno-plt} all external symbols are resolved at load time.
11329
11330 Alternatively, the function attribute @code{noplt} can be used to avoid calls
11331 through the PLT for specific external functions.
11332
11333 In position-dependent code, a few targets also convert calls to
11334 functions that are marked to not use the PLT to use the GOT instead.
11335
11336 @item -fno-jump-tables
11337 @opindex fno-jump-tables
11338 Do not use jump tables for switch statements even where it would be
11339 more efficient than other code generation strategies. This option is
11340 of use in conjunction with @option{-fpic} or @option{-fPIC} for
11341 building code that forms part of a dynamic linker and cannot
11342 reference the address of a jump table. On some targets, jump tables
11343 do not require a GOT and this option is not needed.
11344
11345 @item -ffixed-@var{reg}
11346 @opindex ffixed
11347 Treat the register named @var{reg} as a fixed register; generated code
11348 should never refer to it (except perhaps as a stack pointer, frame
11349 pointer or in some other fixed role).
11350
11351 @var{reg} must be the name of a register. The register names accepted
11352 are machine-specific and are defined in the @code{REGISTER_NAMES}
11353 macro in the machine description macro file.
11354
11355 This flag does not have a negative form, because it specifies a
11356 three-way choice.
11357
11358 @item -fcall-used-@var{reg}
11359 @opindex fcall-used
11360 Treat the register named @var{reg} as an allocable register that is
11361 clobbered by function calls. It may be allocated for temporaries or
11362 variables that do not live across a call. Functions compiled this way
11363 do not save and restore the register @var{reg}.
11364
11365 It is an error to use this flag with the frame pointer or stack pointer.
11366 Use of this flag for other registers that have fixed pervasive roles in
11367 the machine's execution model produces disastrous results.
11368
11369 This flag does not have a negative form, because it specifies a
11370 three-way choice.
11371
11372 @item -fcall-saved-@var{reg}
11373 @opindex fcall-saved
11374 Treat the register named @var{reg} as an allocable register saved by
11375 functions. It may be allocated even for temporaries or variables that
11376 live across a call. Functions compiled this way save and restore
11377 the register @var{reg} if they use it.
11378
11379 It is an error to use this flag with the frame pointer or stack pointer.
11380 Use of this flag for other registers that have fixed pervasive roles in
11381 the machine's execution model produces disastrous results.
11382
11383 A different sort of disaster results from the use of this flag for
11384 a register in which function values may be returned.
11385
11386 This flag does not have a negative form, because it specifies a
11387 three-way choice.
11388
11389 @item -fpack-struct[=@var{n}]
11390 @opindex fpack-struct
11391 Without a value specified, pack all structure members together without
11392 holes. When a value is specified (which must be a small power of two), pack
11393 structure members according to this value, representing the maximum
11394 alignment (that is, objects with default alignment requirements larger than
11395 this are output potentially unaligned at the next fitting location.
11396
11397 @strong{Warning:} the @option{-fpack-struct} switch causes GCC to generate
11398 code that is not binary compatible with code generated without that switch.
11399 Additionally, it makes the code suboptimal.
11400 Use it to conform to a non-default application binary interface.
11401
11402 @item -fleading-underscore
11403 @opindex fleading-underscore
11404 This option and its counterpart, @option{-fno-leading-underscore}, forcibly
11405 change the way C symbols are represented in the object file. One use
11406 is to help link with legacy assembly code.
11407
11408 @strong{Warning:} the @option{-fleading-underscore} switch causes GCC to
11409 generate code that is not binary compatible with code generated without that
11410 switch. Use it to conform to a non-default application binary interface.
11411 Not all targets provide complete support for this switch.
11412
11413 @item -ftls-model=@var{model}
11414 @opindex ftls-model
11415 Alter the thread-local storage model to be used (@pxref{Thread-Local}).
11416 The @var{model} argument should be one of @samp{global-dynamic},
11417 @samp{local-dynamic}, @samp{initial-exec} or @samp{local-exec}.
11418 Note that the choice is subject to optimization: the compiler may use
11419 a more efficient model for symbols not visible outside of the translation
11420 unit, or if @option{-fpic} is not given on the command line.
11421
11422 The default without @option{-fpic} is @samp{initial-exec}; with
11423 @option{-fpic} the default is @samp{global-dynamic}.
11424
11425 @item -fvisibility=@r{[}default@r{|}internal@r{|}hidden@r{|}protected@r{]}
11426 @opindex fvisibility
11427 Set the default ELF image symbol visibility to the specified option---all
11428 symbols are marked with this unless overridden within the code.
11429 Using this feature can very substantially improve linking and
11430 load times of shared object libraries, produce more optimized
11431 code, provide near-perfect API export and prevent symbol clashes.
11432 It is @strong{strongly} recommended that you use this in any shared objects
11433 you distribute.
11434
11435 Despite the nomenclature, @samp{default} always means public; i.e.,
11436 available to be linked against from outside the shared object.
11437 @samp{protected} and @samp{internal} are pretty useless in real-world
11438 usage so the only other commonly used option is @samp{hidden}.
11439 The default if @option{-fvisibility} isn't specified is
11440 @samp{default}, i.e., make every symbol public.
11441
11442 A good explanation of the benefits offered by ensuring ELF
11443 symbols have the correct visibility is given by ``How To Write
11444 Shared Libraries'' by Ulrich Drepper (which can be found at
11445 @w{@uref{http://www.akkadia.org/drepper/}})---however a superior
11446 solution made possible by this option to marking things hidden when
11447 the default is public is to make the default hidden and mark things
11448 public. This is the norm with DLLs on Windows and with @option{-fvisibility=hidden}
11449 and @code{__attribute__ ((visibility("default")))} instead of
11450 @code{__declspec(dllexport)} you get almost identical semantics with
11451 identical syntax. This is a great boon to those working with
11452 cross-platform projects.
11453
11454 For those adding visibility support to existing code, you may find
11455 @code{#pragma GCC visibility} of use. This works by you enclosing
11456 the declarations you wish to set visibility for with (for example)
11457 @code{#pragma GCC visibility push(hidden)} and
11458 @code{#pragma GCC visibility pop}.
11459 Bear in mind that symbol visibility should be viewed @strong{as
11460 part of the API interface contract} and thus all new code should
11461 always specify visibility when it is not the default; i.e., declarations
11462 only for use within the local DSO should @strong{always} be marked explicitly
11463 as hidden as so to avoid PLT indirection overheads---making this
11464 abundantly clear also aids readability and self-documentation of the code.
11465 Note that due to ISO C++ specification requirements, @code{operator new} and
11466 @code{operator delete} must always be of default visibility.
11467
11468 Be aware that headers from outside your project, in particular system
11469 headers and headers from any other library you use, may not be
11470 expecting to be compiled with visibility other than the default. You
11471 may need to explicitly say @code{#pragma GCC visibility push(default)}
11472 before including any such headers.
11473
11474 @code{extern} declarations are not affected by @option{-fvisibility}, so
11475 a lot of code can be recompiled with @option{-fvisibility=hidden} with
11476 no modifications. However, this means that calls to @code{extern}
11477 functions with no explicit visibility use the PLT, so it is more
11478 effective to use @code{__attribute ((visibility))} and/or
11479 @code{#pragma GCC visibility} to tell the compiler which @code{extern}
11480 declarations should be treated as hidden.
11481
11482 Note that @option{-fvisibility} does affect C++ vague linkage
11483 entities. This means that, for instance, an exception class that is
11484 be thrown between DSOs must be explicitly marked with default
11485 visibility so that the @samp{type_info} nodes are unified between
11486 the DSOs.
11487
11488 An overview of these techniques, their benefits and how to use them
11489 is at @uref{http://gcc.gnu.org/@/wiki/@/Visibility}.
11490
11491 @item -fstrict-volatile-bitfields
11492 @opindex fstrict-volatile-bitfields
11493 This option should be used if accesses to volatile bit-fields (or other
11494 structure fields, although the compiler usually honors those types
11495 anyway) should use a single access of the width of the
11496 field's type, aligned to a natural alignment if possible. For
11497 example, targets with memory-mapped peripheral registers might require
11498 all such accesses to be 16 bits wide; with this flag you can
11499 declare all peripheral bit-fields as @code{unsigned short} (assuming short
11500 is 16 bits on these targets) to force GCC to use 16-bit accesses
11501 instead of, perhaps, a more efficient 32-bit access.
11502
11503 If this option is disabled, the compiler uses the most efficient
11504 instruction. In the previous example, that might be a 32-bit load
11505 instruction, even though that accesses bytes that do not contain
11506 any portion of the bit-field, or memory-mapped registers unrelated to
11507 the one being updated.
11508
11509 In some cases, such as when the @code{packed} attribute is applied to a
11510 structure field, it may not be possible to access the field with a single
11511 read or write that is correctly aligned for the target machine. In this
11512 case GCC falls back to generating multiple accesses rather than code that
11513 will fault or truncate the result at run time.
11514
11515 Note: Due to restrictions of the C/C++11 memory model, write accesses are
11516 not allowed to touch non bit-field members. It is therefore recommended
11517 to define all bits of the field's type as bit-field members.
11518
11519 The default value of this option is determined by the application binary
11520 interface for the target processor.
11521
11522 @item -fsync-libcalls
11523 @opindex fsync-libcalls
11524 This option controls whether any out-of-line instance of the @code{__sync}
11525 family of functions may be used to implement the C++11 @code{__atomic}
11526 family of functions.
11527
11528 The default value of this option is enabled, thus the only useful form
11529 of the option is @option{-fno-sync-libcalls}. This option is used in
11530 the implementation of the @file{libatomic} runtime library.
11531
11532 @end table
11533
11534 @node Developer Options
11535 @section GCC Developer Options
11536 @cindex developer options
11537 @cindex debugging GCC
11538 @cindex debug dump options
11539 @cindex dump options
11540 @cindex compilation statistics
11541
11542 This section describes command-line options that are primarily of
11543 interest to GCC developers, including options to support compiler
11544 testing and investigation of compiler bugs and compile-time
11545 performance problems. This includes options that produce debug dumps
11546 at various points in the compilation; that print statistics such as
11547 memory use and execution time; and that print information about GCC's
11548 configuration, such as where it searches for libraries. You should
11549 rarely need to use any of these options for ordinary compilation and
11550 linking tasks.
11551
11552 @table @gcctabopt
11553
11554 @item -d@var{letters}
11555 @itemx -fdump-rtl-@var{pass}
11556 @itemx -fdump-rtl-@var{pass}=@var{filename}
11557 @opindex d
11558 @opindex fdump-rtl-@var{pass}
11559 Says to make debugging dumps during compilation at times specified by
11560 @var{letters}. This is used for debugging the RTL-based passes of the
11561 compiler. The file names for most of the dumps are made by appending
11562 a pass number and a word to the @var{dumpname}, and the files are
11563 created in the directory of the output file. In case of
11564 @option{=@var{filename}} option, the dump is output on the given file
11565 instead of the pass numbered dump files. Note that the pass number is
11566 assigned as passes are registered into the pass manager. Most passes
11567 are registered in the order that they will execute and for these passes
11568 the number corresponds to the pass execution order. However, passes
11569 registered by plugins, passes specific to compilation targets, or
11570 passes that are otherwise registered after all the other passes are
11571 numbered higher than a pass named "final", even if they are executed
11572 earlier. @var{dumpname} is generated from the name of the output
11573 file if explicitly specified and not an executable, otherwise it is
11574 the basename of the source file. These switches may have different
11575 effects when @option{-E} is used for preprocessing.
11576
11577 Debug dumps can be enabled with a @option{-fdump-rtl} switch or some
11578 @option{-d} option @var{letters}. Here are the possible
11579 letters for use in @var{pass} and @var{letters}, and their meanings:
11580
11581 @table @gcctabopt
11582
11583 @item -fdump-rtl-alignments
11584 @opindex fdump-rtl-alignments
11585 Dump after branch alignments have been computed.
11586
11587 @item -fdump-rtl-asmcons
11588 @opindex fdump-rtl-asmcons
11589 Dump after fixing rtl statements that have unsatisfied in/out constraints.
11590
11591 @item -fdump-rtl-auto_inc_dec
11592 @opindex fdump-rtl-auto_inc_dec
11593 Dump after auto-inc-dec discovery. This pass is only run on
11594 architectures that have auto inc or auto dec instructions.
11595
11596 @item -fdump-rtl-barriers
11597 @opindex fdump-rtl-barriers
11598 Dump after cleaning up the barrier instructions.
11599
11600 @item -fdump-rtl-bbpart
11601 @opindex fdump-rtl-bbpart
11602 Dump after partitioning hot and cold basic blocks.
11603
11604 @item -fdump-rtl-bbro
11605 @opindex fdump-rtl-bbro
11606 Dump after block reordering.
11607
11608 @item -fdump-rtl-btl1
11609 @itemx -fdump-rtl-btl2
11610 @opindex fdump-rtl-btl2
11611 @opindex fdump-rtl-btl2
11612 @option{-fdump-rtl-btl1} and @option{-fdump-rtl-btl2} enable dumping
11613 after the two branch
11614 target load optimization passes.
11615
11616 @item -fdump-rtl-bypass
11617 @opindex fdump-rtl-bypass
11618 Dump after jump bypassing and control flow optimizations.
11619
11620 @item -fdump-rtl-combine
11621 @opindex fdump-rtl-combine
11622 Dump after the RTL instruction combination pass.
11623
11624 @item -fdump-rtl-compgotos
11625 @opindex fdump-rtl-compgotos
11626 Dump after duplicating the computed gotos.
11627
11628 @item -fdump-rtl-ce1
11629 @itemx -fdump-rtl-ce2
11630 @itemx -fdump-rtl-ce3
11631 @opindex fdump-rtl-ce1
11632 @opindex fdump-rtl-ce2
11633 @opindex fdump-rtl-ce3
11634 @option{-fdump-rtl-ce1}, @option{-fdump-rtl-ce2}, and
11635 @option{-fdump-rtl-ce3} enable dumping after the three
11636 if conversion passes.
11637
11638 @item -fdump-rtl-cprop_hardreg
11639 @opindex fdump-rtl-cprop_hardreg
11640 Dump after hard register copy propagation.
11641
11642 @item -fdump-rtl-csa
11643 @opindex fdump-rtl-csa
11644 Dump after combining stack adjustments.
11645
11646 @item -fdump-rtl-cse1
11647 @itemx -fdump-rtl-cse2
11648 @opindex fdump-rtl-cse1
11649 @opindex fdump-rtl-cse2
11650 @option{-fdump-rtl-cse1} and @option{-fdump-rtl-cse2} enable dumping after
11651 the two common subexpression elimination passes.
11652
11653 @item -fdump-rtl-dce
11654 @opindex fdump-rtl-dce
11655 Dump after the standalone dead code elimination passes.
11656
11657 @item -fdump-rtl-dbr
11658 @opindex fdump-rtl-dbr
11659 Dump after delayed branch scheduling.
11660
11661 @item -fdump-rtl-dce1
11662 @itemx -fdump-rtl-dce2
11663 @opindex fdump-rtl-dce1
11664 @opindex fdump-rtl-dce2
11665 @option{-fdump-rtl-dce1} and @option{-fdump-rtl-dce2} enable dumping after
11666 the two dead store elimination passes.
11667
11668 @item -fdump-rtl-eh
11669 @opindex fdump-rtl-eh
11670 Dump after finalization of EH handling code.
11671
11672 @item -fdump-rtl-eh_ranges
11673 @opindex fdump-rtl-eh_ranges
11674 Dump after conversion of EH handling range regions.
11675
11676 @item -fdump-rtl-expand
11677 @opindex fdump-rtl-expand
11678 Dump after RTL generation.
11679
11680 @item -fdump-rtl-fwprop1
11681 @itemx -fdump-rtl-fwprop2
11682 @opindex fdump-rtl-fwprop1
11683 @opindex fdump-rtl-fwprop2
11684 @option{-fdump-rtl-fwprop1} and @option{-fdump-rtl-fwprop2} enable
11685 dumping after the two forward propagation passes.
11686
11687 @item -fdump-rtl-gcse1
11688 @itemx -fdump-rtl-gcse2
11689 @opindex fdump-rtl-gcse1
11690 @opindex fdump-rtl-gcse2
11691 @option{-fdump-rtl-gcse1} and @option{-fdump-rtl-gcse2} enable dumping
11692 after global common subexpression elimination.
11693
11694 @item -fdump-rtl-init-regs
11695 @opindex fdump-rtl-init-regs
11696 Dump after the initialization of the registers.
11697
11698 @item -fdump-rtl-initvals
11699 @opindex fdump-rtl-initvals
11700 Dump after the computation of the initial value sets.
11701
11702 @item -fdump-rtl-into_cfglayout
11703 @opindex fdump-rtl-into_cfglayout
11704 Dump after converting to cfglayout mode.
11705
11706 @item -fdump-rtl-ira
11707 @opindex fdump-rtl-ira
11708 Dump after iterated register allocation.
11709
11710 @item -fdump-rtl-jump
11711 @opindex fdump-rtl-jump
11712 Dump after the second jump optimization.
11713
11714 @item -fdump-rtl-loop2
11715 @opindex fdump-rtl-loop2
11716 @option{-fdump-rtl-loop2} enables dumping after the rtl
11717 loop optimization passes.
11718
11719 @item -fdump-rtl-mach
11720 @opindex fdump-rtl-mach
11721 Dump after performing the machine dependent reorganization pass, if that
11722 pass exists.
11723
11724 @item -fdump-rtl-mode_sw
11725 @opindex fdump-rtl-mode_sw
11726 Dump after removing redundant mode switches.
11727
11728 @item -fdump-rtl-rnreg
11729 @opindex fdump-rtl-rnreg
11730 Dump after register renumbering.
11731
11732 @item -fdump-rtl-outof_cfglayout
11733 @opindex fdump-rtl-outof_cfglayout
11734 Dump after converting from cfglayout mode.
11735
11736 @item -fdump-rtl-peephole2
11737 @opindex fdump-rtl-peephole2
11738 Dump after the peephole pass.
11739
11740 @item -fdump-rtl-postreload
11741 @opindex fdump-rtl-postreload
11742 Dump after post-reload optimizations.
11743
11744 @item -fdump-rtl-pro_and_epilogue
11745 @opindex fdump-rtl-pro_and_epilogue
11746 Dump after generating the function prologues and epilogues.
11747
11748 @item -fdump-rtl-sched1
11749 @itemx -fdump-rtl-sched2
11750 @opindex fdump-rtl-sched1
11751 @opindex fdump-rtl-sched2
11752 @option{-fdump-rtl-sched1} and @option{-fdump-rtl-sched2} enable dumping
11753 after the basic block scheduling passes.
11754
11755 @item -fdump-rtl-ree
11756 @opindex fdump-rtl-ree
11757 Dump after sign/zero extension elimination.
11758
11759 @item -fdump-rtl-seqabstr
11760 @opindex fdump-rtl-seqabstr
11761 Dump after common sequence discovery.
11762
11763 @item -fdump-rtl-shorten
11764 @opindex fdump-rtl-shorten
11765 Dump after shortening branches.
11766
11767 @item -fdump-rtl-sibling
11768 @opindex fdump-rtl-sibling
11769 Dump after sibling call optimizations.
11770
11771 @item -fdump-rtl-split1
11772 @itemx -fdump-rtl-split2
11773 @itemx -fdump-rtl-split3
11774 @itemx -fdump-rtl-split4
11775 @itemx -fdump-rtl-split5
11776 @opindex fdump-rtl-split1
11777 @opindex fdump-rtl-split2
11778 @opindex fdump-rtl-split3
11779 @opindex fdump-rtl-split4
11780 @opindex fdump-rtl-split5
11781 These options enable dumping after five rounds of
11782 instruction splitting.
11783
11784 @item -fdump-rtl-sms
11785 @opindex fdump-rtl-sms
11786 Dump after modulo scheduling. This pass is only run on some
11787 architectures.
11788
11789 @item -fdump-rtl-stack
11790 @opindex fdump-rtl-stack
11791 Dump after conversion from GCC's ``flat register file'' registers to the
11792 x87's stack-like registers. This pass is only run on x86 variants.
11793
11794 @item -fdump-rtl-subreg1
11795 @itemx -fdump-rtl-subreg2
11796 @opindex fdump-rtl-subreg1
11797 @opindex fdump-rtl-subreg2
11798 @option{-fdump-rtl-subreg1} and @option{-fdump-rtl-subreg2} enable dumping after
11799 the two subreg expansion passes.
11800
11801 @item -fdump-rtl-unshare
11802 @opindex fdump-rtl-unshare
11803 Dump after all rtl has been unshared.
11804
11805 @item -fdump-rtl-vartrack
11806 @opindex fdump-rtl-vartrack
11807 Dump after variable tracking.
11808
11809 @item -fdump-rtl-vregs
11810 @opindex fdump-rtl-vregs
11811 Dump after converting virtual registers to hard registers.
11812
11813 @item -fdump-rtl-web
11814 @opindex fdump-rtl-web
11815 Dump after live range splitting.
11816
11817 @item -fdump-rtl-regclass
11818 @itemx -fdump-rtl-subregs_of_mode_init
11819 @itemx -fdump-rtl-subregs_of_mode_finish
11820 @itemx -fdump-rtl-dfinit
11821 @itemx -fdump-rtl-dfinish
11822 @opindex fdump-rtl-regclass
11823 @opindex fdump-rtl-subregs_of_mode_init
11824 @opindex fdump-rtl-subregs_of_mode_finish
11825 @opindex fdump-rtl-dfinit
11826 @opindex fdump-rtl-dfinish
11827 These dumps are defined but always produce empty files.
11828
11829 @item -da
11830 @itemx -fdump-rtl-all
11831 @opindex da
11832 @opindex fdump-rtl-all
11833 Produce all the dumps listed above.
11834
11835 @item -dA
11836 @opindex dA
11837 Annotate the assembler output with miscellaneous debugging information.
11838
11839 @item -dD
11840 @opindex dD
11841 Dump all macro definitions, at the end of preprocessing, in addition to
11842 normal output.
11843
11844 @item -dH
11845 @opindex dH
11846 Produce a core dump whenever an error occurs.
11847
11848 @item -dp
11849 @opindex dp
11850 Annotate the assembler output with a comment indicating which
11851 pattern and alternative is used. The length of each instruction is
11852 also printed.
11853
11854 @item -dP
11855 @opindex dP
11856 Dump the RTL in the assembler output as a comment before each instruction.
11857 Also turns on @option{-dp} annotation.
11858
11859 @item -dx
11860 @opindex dx
11861 Just generate RTL for a function instead of compiling it. Usually used
11862 with @option{-fdump-rtl-expand}.
11863 @end table
11864
11865 @item -fdump-noaddr
11866 @opindex fdump-noaddr
11867 When doing debugging dumps, suppress address output. This makes it more
11868 feasible to use diff on debugging dumps for compiler invocations with
11869 different compiler binaries and/or different
11870 text / bss / data / heap / stack / dso start locations.
11871
11872 @item -freport-bug
11873 @opindex freport-bug
11874 Collect and dump debug information into a temporary file if an
11875 internal compiler error (ICE) occurs.
11876
11877 @item -fdump-unnumbered
11878 @opindex fdump-unnumbered
11879 When doing debugging dumps, suppress instruction numbers and address output.
11880 This makes it more feasible to use diff on debugging dumps for compiler
11881 invocations with different options, in particular with and without
11882 @option{-g}.
11883
11884 @item -fdump-unnumbered-links
11885 @opindex fdump-unnumbered-links
11886 When doing debugging dumps (see @option{-d} option above), suppress
11887 instruction numbers for the links to the previous and next instructions
11888 in a sequence.
11889
11890 @item -fdump-translation-unit @r{(C++ only)}
11891 @itemx -fdump-translation-unit-@var{options} @r{(C++ only)}
11892 @opindex fdump-translation-unit
11893 Dump a representation of the tree structure for the entire translation
11894 unit to a file. The file name is made by appending @file{.tu} to the
11895 source file name, and the file is created in the same directory as the
11896 output file. If the @samp{-@var{options}} form is used, @var{options}
11897 controls the details of the dump as described for the
11898 @option{-fdump-tree} options.
11899
11900 @item -fdump-class-hierarchy @r{(C++ only)}
11901 @itemx -fdump-class-hierarchy-@var{options} @r{(C++ only)}
11902 @opindex fdump-class-hierarchy
11903 Dump a representation of each class's hierarchy and virtual function
11904 table layout to a file. The file name is made by appending
11905 @file{.class} to the source file name, and the file is created in the
11906 same directory as the output file. If the @samp{-@var{options}} form
11907 is used, @var{options} controls the details of the dump as described
11908 for the @option{-fdump-tree} options.
11909
11910 @item -fdump-ipa-@var{switch}
11911 @opindex fdump-ipa
11912 Control the dumping at various stages of inter-procedural analysis
11913 language tree to a file. The file name is generated by appending a
11914 switch specific suffix to the source file name, and the file is created
11915 in the same directory as the output file. The following dumps are
11916 possible:
11917
11918 @table @samp
11919 @item all
11920 Enables all inter-procedural analysis dumps.
11921
11922 @item cgraph
11923 Dumps information about call-graph optimization, unused function removal,
11924 and inlining decisions.
11925
11926 @item inline
11927 Dump after function inlining.
11928
11929 @end table
11930
11931 @item -fdump-passes
11932 @opindex fdump-passes
11933 Dump the list of optimization passes that are turned on and off by
11934 the current command-line options.
11935
11936 @item -fdump-statistics-@var{option}
11937 @opindex fdump-statistics
11938 Enable and control dumping of pass statistics in a separate file. The
11939 file name is generated by appending a suffix ending in
11940 @samp{.statistics} to the source file name, and the file is created in
11941 the same directory as the output file. If the @samp{-@var{option}}
11942 form is used, @samp{-stats} causes counters to be summed over the
11943 whole compilation unit while @samp{-details} dumps every event as
11944 the passes generate them. The default with no option is to sum
11945 counters for each function compiled.
11946
11947 @item -fdump-tree-@var{switch}
11948 @itemx -fdump-tree-@var{switch}-@var{options}
11949 @itemx -fdump-tree-@var{switch}-@var{options}=@var{filename}
11950 @opindex fdump-tree
11951 Control the dumping at various stages of processing the intermediate
11952 language tree to a file. The file name is generated by appending a
11953 switch-specific suffix to the source file name, and the file is
11954 created in the same directory as the output file. In case of
11955 @option{=@var{filename}} option, the dump is output on the given file
11956 instead of the auto named dump files. If the @samp{-@var{options}}
11957 form is used, @var{options} is a list of @samp{-} separated options
11958 which control the details of the dump. Not all options are applicable
11959 to all dumps; those that are not meaningful are ignored. The
11960 following options are available
11961
11962 @table @samp
11963 @item address
11964 Print the address of each node. Usually this is not meaningful as it
11965 changes according to the environment and source file. Its primary use
11966 is for tying up a dump file with a debug environment.
11967 @item asmname
11968 If @code{DECL_ASSEMBLER_NAME} has been set for a given decl, use that
11969 in the dump instead of @code{DECL_NAME}. Its primary use is ease of
11970 use working backward from mangled names in the assembly file.
11971 @item slim
11972 When dumping front-end intermediate representations, inhibit dumping
11973 of members of a scope or body of a function merely because that scope
11974 has been reached. Only dump such items when they are directly reachable
11975 by some other path.
11976
11977 When dumping pretty-printed trees, this option inhibits dumping the
11978 bodies of control structures.
11979
11980 When dumping RTL, print the RTL in slim (condensed) form instead of
11981 the default LISP-like representation.
11982 @item raw
11983 Print a raw representation of the tree. By default, trees are
11984 pretty-printed into a C-like representation.
11985 @item details
11986 Enable more detailed dumps (not honored by every dump option). Also
11987 include information from the optimization passes.
11988 @item stats
11989 Enable dumping various statistics about the pass (not honored by every dump
11990 option).
11991 @item blocks
11992 Enable showing basic block boundaries (disabled in raw dumps).
11993 @item graph
11994 For each of the other indicated dump files (@option{-fdump-rtl-@var{pass}}),
11995 dump a representation of the control flow graph suitable for viewing with
11996 GraphViz to @file{@var{file}.@var{passid}.@var{pass}.dot}. Each function in
11997 the file is pretty-printed as a subgraph, so that GraphViz can render them
11998 all in a single plot.
11999
12000 This option currently only works for RTL dumps, and the RTL is always
12001 dumped in slim form.
12002 @item vops
12003 Enable showing virtual operands for every statement.
12004 @item lineno
12005 Enable showing line numbers for statements.
12006 @item uid
12007 Enable showing the unique ID (@code{DECL_UID}) for each variable.
12008 @item verbose
12009 Enable showing the tree dump for each statement.
12010 @item eh
12011 Enable showing the EH region number holding each statement.
12012 @item scev
12013 Enable showing scalar evolution analysis details.
12014 @item optimized
12015 Enable showing optimization information (only available in certain
12016 passes).
12017 @item missed
12018 Enable showing missed optimization information (only available in certain
12019 passes).
12020 @item note
12021 Enable other detailed optimization information (only available in
12022 certain passes).
12023 @item =@var{filename}
12024 Instead of an auto named dump file, output into the given file
12025 name. The file names @file{stdout} and @file{stderr} are treated
12026 specially and are considered already open standard streams. For
12027 example,
12028
12029 @smallexample
12030 gcc -O2 -ftree-vectorize -fdump-tree-vect-blocks=foo.dump
12031 -fdump-tree-pre=stderr file.c
12032 @end smallexample
12033
12034 outputs vectorizer dump into @file{foo.dump}, while the PRE dump is
12035 output on to @file{stderr}. If two conflicting dump filenames are
12036 given for the same pass, then the latter option overrides the earlier
12037 one.
12038
12039 @item split-paths
12040 @opindex fdump-tree-split-paths
12041 Dump each function after splitting paths to loop backedges. The file
12042 name is made by appending @file{.split-paths} to the source file name.
12043
12044 @item all
12045 Turn on all options, except @option{raw}, @option{slim}, @option{verbose}
12046 and @option{lineno}.
12047
12048 @item optall
12049 Turn on all optimization options, i.e., @option{optimized},
12050 @option{missed}, and @option{note}.
12051 @end table
12052
12053 The following tree dumps are possible:
12054 @table @samp
12055
12056 @item original
12057 @opindex fdump-tree-original
12058 Dump before any tree based optimization, to @file{@var{file}.original}.
12059
12060 @item optimized
12061 @opindex fdump-tree-optimized
12062 Dump after all tree based optimization, to @file{@var{file}.optimized}.
12063
12064 @item gimple
12065 @opindex fdump-tree-gimple
12066 Dump each function before and after the gimplification pass to a file. The
12067 file name is made by appending @file{.gimple} to the source file name.
12068
12069 @item cfg
12070 @opindex fdump-tree-cfg
12071 Dump the control flow graph of each function to a file. The file name is
12072 made by appending @file{.cfg} to the source file name.
12073
12074 @item ch
12075 @opindex fdump-tree-ch
12076 Dump each function after copying loop headers. The file name is made by
12077 appending @file{.ch} to the source file name.
12078
12079 @item ssa
12080 @opindex fdump-tree-ssa
12081 Dump SSA related information to a file. The file name is made by appending
12082 @file{.ssa} to the source file name.
12083
12084 @item alias
12085 @opindex fdump-tree-alias
12086 Dump aliasing information for each function. The file name is made by
12087 appending @file{.alias} to the source file name.
12088
12089 @item ccp
12090 @opindex fdump-tree-ccp
12091 Dump each function after CCP@. The file name is made by appending
12092 @file{.ccp} to the source file name.
12093
12094 @item storeccp
12095 @opindex fdump-tree-storeccp
12096 Dump each function after STORE-CCP@. The file name is made by appending
12097 @file{.storeccp} to the source file name.
12098
12099 @item pre
12100 @opindex fdump-tree-pre
12101 Dump trees after partial redundancy elimination. The file name is made
12102 by appending @file{.pre} to the source file name.
12103
12104 @item fre
12105 @opindex fdump-tree-fre
12106 Dump trees after full redundancy elimination. The file name is made
12107 by appending @file{.fre} to the source file name.
12108
12109 @item copyprop
12110 @opindex fdump-tree-copyprop
12111 Dump trees after copy propagation. The file name is made
12112 by appending @file{.copyprop} to the source file name.
12113
12114 @item store_copyprop
12115 @opindex fdump-tree-store_copyprop
12116 Dump trees after store copy-propagation. The file name is made
12117 by appending @file{.store_copyprop} to the source file name.
12118
12119 @item dce
12120 @opindex fdump-tree-dce
12121 Dump each function after dead code elimination. The file name is made by
12122 appending @file{.dce} to the source file name.
12123
12124 @item sra
12125 @opindex fdump-tree-sra
12126 Dump each function after performing scalar replacement of aggregates. The
12127 file name is made by appending @file{.sra} to the source file name.
12128
12129 @item sink
12130 @opindex fdump-tree-sink
12131 Dump each function after performing code sinking. The file name is made
12132 by appending @file{.sink} to the source file name.
12133
12134 @item dom
12135 @opindex fdump-tree-dom
12136 Dump each function after applying dominator tree optimizations. The file
12137 name is made by appending @file{.dom} to the source file name.
12138
12139 @item dse
12140 @opindex fdump-tree-dse
12141 Dump each function after applying dead store elimination. The file
12142 name is made by appending @file{.dse} to the source file name.
12143
12144 @item phiopt
12145 @opindex fdump-tree-phiopt
12146 Dump each function after optimizing PHI nodes into straightline code. The file
12147 name is made by appending @file{.phiopt} to the source file name.
12148
12149 @item backprop
12150 @opindex fdump-tree-backprop
12151 Dump each function after back-propagating use information up the definition
12152 chain. The file name is made by appending @file{.backprop} to the
12153 source file name.
12154
12155 @item forwprop
12156 @opindex fdump-tree-forwprop
12157 Dump each function after forward propagating single use variables. The file
12158 name is made by appending @file{.forwprop} to the source file name.
12159
12160 @item nrv
12161 @opindex fdump-tree-nrv
12162 Dump each function after applying the named return value optimization on
12163 generic trees. The file name is made by appending @file{.nrv} to the source
12164 file name.
12165
12166 @item vect
12167 @opindex fdump-tree-vect
12168 Dump each function after applying vectorization of loops. The file name is
12169 made by appending @file{.vect} to the source file name.
12170
12171 @item slp
12172 @opindex fdump-tree-slp
12173 Dump each function after applying vectorization of basic blocks. The file name
12174 is made by appending @file{.slp} to the source file name.
12175
12176 @item vrp
12177 @opindex fdump-tree-vrp
12178 Dump each function after Value Range Propagation (VRP). The file name
12179 is made by appending @file{.vrp} to the source file name.
12180
12181 @item oaccdevlow
12182 @opindex fdump-tree-oaccdevlow
12183 Dump each function after applying device-specific OpenACC transformations.
12184 The file name is made by appending @file{.oaccdevlow} to the source file name.
12185
12186 @item all
12187 @opindex fdump-tree-all
12188 Enable all the available tree dumps with the flags provided in this option.
12189 @end table
12190
12191 @item -fopt-info
12192 @itemx -fopt-info-@var{options}
12193 @itemx -fopt-info-@var{options}=@var{filename}
12194 @opindex fopt-info
12195 Controls optimization dumps from various optimization passes. If the
12196 @samp{-@var{options}} form is used, @var{options} is a list of
12197 @samp{-} separated option keywords to select the dump details and
12198 optimizations.
12199
12200 The @var{options} can be divided into two groups: options describing the
12201 verbosity of the dump, and options describing which optimizations
12202 should be included. The options from both the groups can be freely
12203 mixed as they are non-overlapping. However, in case of any conflicts,
12204 the later options override the earlier options on the command
12205 line.
12206
12207 The following options control the dump verbosity:
12208
12209 @table @samp
12210 @item optimized
12211 Print information when an optimization is successfully applied. It is
12212 up to a pass to decide which information is relevant. For example, the
12213 vectorizer passes print the source location of loops which are
12214 successfully vectorized.
12215 @item missed
12216 Print information about missed optimizations. Individual passes
12217 control which information to include in the output.
12218 @item note
12219 Print verbose information about optimizations, such as certain
12220 transformations, more detailed messages about decisions etc.
12221 @item all
12222 Print detailed optimization information. This includes
12223 @samp{optimized}, @samp{missed}, and @samp{note}.
12224 @end table
12225
12226 One or more of the following option keywords can be used to describe a
12227 group of optimizations:
12228
12229 @table @samp
12230 @item ipa
12231 Enable dumps from all interprocedural optimizations.
12232 @item loop
12233 Enable dumps from all loop optimizations.
12234 @item inline
12235 Enable dumps from all inlining optimizations.
12236 @item vec
12237 Enable dumps from all vectorization optimizations.
12238 @item optall
12239 Enable dumps from all optimizations. This is a superset of
12240 the optimization groups listed above.
12241 @end table
12242
12243 If @var{options} is
12244 omitted, it defaults to @samp{optimized-optall}, which means to dump all
12245 info about successful optimizations from all the passes.
12246
12247 If the @var{filename} is provided, then the dumps from all the
12248 applicable optimizations are concatenated into the @var{filename}.
12249 Otherwise the dump is output onto @file{stderr}. Though multiple
12250 @option{-fopt-info} options are accepted, only one of them can include
12251 a @var{filename}. If other filenames are provided then all but the
12252 first such option are ignored.
12253
12254 Note that the output @var{filename} is overwritten
12255 in case of multiple translation units. If a combined output from
12256 multiple translation units is desired, @file{stderr} should be used
12257 instead.
12258
12259 In the following example, the optimization info is output to
12260 @file{stderr}:
12261
12262 @smallexample
12263 gcc -O3 -fopt-info
12264 @end smallexample
12265
12266 This example:
12267 @smallexample
12268 gcc -O3 -fopt-info-missed=missed.all
12269 @end smallexample
12270
12271 @noindent
12272 outputs missed optimization report from all the passes into
12273 @file{missed.all}, and this one:
12274
12275 @smallexample
12276 gcc -O2 -ftree-vectorize -fopt-info-vec-missed
12277 @end smallexample
12278
12279 @noindent
12280 prints information about missed optimization opportunities from
12281 vectorization passes on @file{stderr}.
12282 Note that @option{-fopt-info-vec-missed} is equivalent to
12283 @option{-fopt-info-missed-vec}.
12284
12285 As another example,
12286 @smallexample
12287 gcc -O3 -fopt-info-inline-optimized-missed=inline.txt
12288 @end smallexample
12289
12290 @noindent
12291 outputs information about missed optimizations as well as
12292 optimized locations from all the inlining passes into
12293 @file{inline.txt}.
12294
12295 Finally, consider:
12296
12297 @smallexample
12298 gcc -fopt-info-vec-missed=vec.miss -fopt-info-loop-optimized=loop.opt
12299 @end smallexample
12300
12301 @noindent
12302 Here the two output filenames @file{vec.miss} and @file{loop.opt} are
12303 in conflict since only one output file is allowed. In this case, only
12304 the first option takes effect and the subsequent options are
12305 ignored. Thus only @file{vec.miss} is produced which contains
12306 dumps from the vectorizer about missed opportunities.
12307
12308 @item -fsched-verbose=@var{n}
12309 @opindex fsched-verbose
12310 On targets that use instruction scheduling, this option controls the
12311 amount of debugging output the scheduler prints to the dump files.
12312
12313 For @var{n} greater than zero, @option{-fsched-verbose} outputs the
12314 same information as @option{-fdump-rtl-sched1} and @option{-fdump-rtl-sched2}.
12315 For @var{n} greater than one, it also output basic block probabilities,
12316 detailed ready list information and unit/insn info. For @var{n} greater
12317 than two, it includes RTL at abort point, control-flow and regions info.
12318 And for @var{n} over four, @option{-fsched-verbose} also includes
12319 dependence info.
12320
12321
12322
12323 @item -fenable-@var{kind}-@var{pass}
12324 @itemx -fdisable-@var{kind}-@var{pass}=@var{range-list}
12325 @opindex fdisable-
12326 @opindex fenable-
12327
12328 This is a set of options that are used to explicitly disable/enable
12329 optimization passes. These options are intended for use for debugging GCC.
12330 Compiler users should use regular options for enabling/disabling
12331 passes instead.
12332
12333 @table @gcctabopt
12334
12335 @item -fdisable-ipa-@var{pass}
12336 Disable IPA pass @var{pass}. @var{pass} is the pass name. If the same pass is
12337 statically invoked in the compiler multiple times, the pass name should be
12338 appended with a sequential number starting from 1.
12339
12340 @item -fdisable-rtl-@var{pass}
12341 @itemx -fdisable-rtl-@var{pass}=@var{range-list}
12342 Disable RTL pass @var{pass}. @var{pass} is the pass name. If the same pass is
12343 statically invoked in the compiler multiple times, the pass name should be
12344 appended with a sequential number starting from 1. @var{range-list} is a
12345 comma-separated list of function ranges or assembler names. Each range is a number
12346 pair separated by a colon. The range is inclusive in both ends. If the range
12347 is trivial, the number pair can be simplified as a single number. If the
12348 function's call graph node's @var{uid} falls within one of the specified ranges,
12349 the @var{pass} is disabled for that function. The @var{uid} is shown in the
12350 function header of a dump file, and the pass names can be dumped by using
12351 option @option{-fdump-passes}.
12352
12353 @item -fdisable-tree-@var{pass}
12354 @itemx -fdisable-tree-@var{pass}=@var{range-list}
12355 Disable tree pass @var{pass}. See @option{-fdisable-rtl} for the description of
12356 option arguments.
12357
12358 @item -fenable-ipa-@var{pass}
12359 Enable IPA pass @var{pass}. @var{pass} is the pass name. If the same pass is
12360 statically invoked in the compiler multiple times, the pass name should be
12361 appended with a sequential number starting from 1.
12362
12363 @item -fenable-rtl-@var{pass}
12364 @itemx -fenable-rtl-@var{pass}=@var{range-list}
12365 Enable RTL pass @var{pass}. See @option{-fdisable-rtl} for option argument
12366 description and examples.
12367
12368 @item -fenable-tree-@var{pass}
12369 @itemx -fenable-tree-@var{pass}=@var{range-list}
12370 Enable tree pass @var{pass}. See @option{-fdisable-rtl} for the description
12371 of option arguments.
12372
12373 @end table
12374
12375 Here are some examples showing uses of these options.
12376
12377 @smallexample
12378
12379 # disable ccp1 for all functions
12380 -fdisable-tree-ccp1
12381 # disable complete unroll for function whose cgraph node uid is 1
12382 -fenable-tree-cunroll=1
12383 # disable gcse2 for functions at the following ranges [1,1],
12384 # [300,400], and [400,1000]
12385 # disable gcse2 for functions foo and foo2
12386 -fdisable-rtl-gcse2=foo,foo2
12387 # disable early inlining
12388 -fdisable-tree-einline
12389 # disable ipa inlining
12390 -fdisable-ipa-inline
12391 # enable tree full unroll
12392 -fenable-tree-unroll
12393
12394 @end smallexample
12395
12396 @item -fchecking
12397 @itemx -fchecking=@var{n}
12398 @opindex fchecking
12399 @opindex fno-checking
12400 Enable internal consistency checking. The default depends on
12401 the compiler configuration. @option{-fchecking=2} enables further
12402 internal consistency checking that might affect code generation.
12403
12404 @item -frandom-seed=@var{string}
12405 @opindex frandom-seed
12406 This option provides a seed that GCC uses in place of
12407 random numbers in generating certain symbol names
12408 that have to be different in every compiled file. It is also used to
12409 place unique stamps in coverage data files and the object files that
12410 produce them. You can use the @option{-frandom-seed} option to produce
12411 reproducibly identical object files.
12412
12413 The @var{string} can either be a number (decimal, octal or hex) or an
12414 arbitrary string (in which case it's converted to a number by
12415 computing CRC32).
12416
12417 The @var{string} should be different for every file you compile.
12418
12419 @item -save-temps
12420 @itemx -save-temps=cwd
12421 @opindex save-temps
12422 Store the usual ``temporary'' intermediate files permanently; place them
12423 in the current directory and name them based on the source file. Thus,
12424 compiling @file{foo.c} with @option{-c -save-temps} produces files
12425 @file{foo.i} and @file{foo.s}, as well as @file{foo.o}. This creates a
12426 preprocessed @file{foo.i} output file even though the compiler now
12427 normally uses an integrated preprocessor.
12428
12429 When used in combination with the @option{-x} command-line option,
12430 @option{-save-temps} is sensible enough to avoid over writing an
12431 input source file with the same extension as an intermediate file.
12432 The corresponding intermediate file may be obtained by renaming the
12433 source file before using @option{-save-temps}.
12434
12435 If you invoke GCC in parallel, compiling several different source
12436 files that share a common base name in different subdirectories or the
12437 same source file compiled for multiple output destinations, it is
12438 likely that the different parallel compilers will interfere with each
12439 other, and overwrite the temporary files. For instance:
12440
12441 @smallexample
12442 gcc -save-temps -o outdir1/foo.o indir1/foo.c&
12443 gcc -save-temps -o outdir2/foo.o indir2/foo.c&
12444 @end smallexample
12445
12446 may result in @file{foo.i} and @file{foo.o} being written to
12447 simultaneously by both compilers.
12448
12449 @item -save-temps=obj
12450 @opindex save-temps=obj
12451 Store the usual ``temporary'' intermediate files permanently. If the
12452 @option{-o} option is used, the temporary files are based on the
12453 object file. If the @option{-o} option is not used, the
12454 @option{-save-temps=obj} switch behaves like @option{-save-temps}.
12455
12456 For example:
12457
12458 @smallexample
12459 gcc -save-temps=obj -c foo.c
12460 gcc -save-temps=obj -c bar.c -o dir/xbar.o
12461 gcc -save-temps=obj foobar.c -o dir2/yfoobar
12462 @end smallexample
12463
12464 @noindent
12465 creates @file{foo.i}, @file{foo.s}, @file{dir/xbar.i},
12466 @file{dir/xbar.s}, @file{dir2/yfoobar.i}, @file{dir2/yfoobar.s}, and
12467 @file{dir2/yfoobar.o}.
12468
12469 @item -time@r{[}=@var{file}@r{]}
12470 @opindex time
12471 Report the CPU time taken by each subprocess in the compilation
12472 sequence. For C source files, this is the compiler proper and assembler
12473 (plus the linker if linking is done).
12474
12475 Without the specification of an output file, the output looks like this:
12476
12477 @smallexample
12478 # cc1 0.12 0.01
12479 # as 0.00 0.01
12480 @end smallexample
12481
12482 The first number on each line is the ``user time'', that is time spent
12483 executing the program itself. The second number is ``system time'',
12484 time spent executing operating system routines on behalf of the program.
12485 Both numbers are in seconds.
12486
12487 With the specification of an output file, the output is appended to the
12488 named file, and it looks like this:
12489
12490 @smallexample
12491 0.12 0.01 cc1 @var{options}
12492 0.00 0.01 as @var{options}
12493 @end smallexample
12494
12495 The ``user time'' and the ``system time'' are moved before the program
12496 name, and the options passed to the program are displayed, so that one
12497 can later tell what file was being compiled, and with which options.
12498
12499 @item -fdump-final-insns@r{[}=@var{file}@r{]}
12500 @opindex fdump-final-insns
12501 Dump the final internal representation (RTL) to @var{file}. If the
12502 optional argument is omitted (or if @var{file} is @code{.}), the name
12503 of the dump file is determined by appending @code{.gkd} to the
12504 compilation output file name.
12505
12506 @item -fcompare-debug@r{[}=@var{opts}@r{]}
12507 @opindex fcompare-debug
12508 @opindex fno-compare-debug
12509 If no error occurs during compilation, run the compiler a second time,
12510 adding @var{opts} and @option{-fcompare-debug-second} to the arguments
12511 passed to the second compilation. Dump the final internal
12512 representation in both compilations, and print an error if they differ.
12513
12514 If the equal sign is omitted, the default @option{-gtoggle} is used.
12515
12516 The environment variable @env{GCC_COMPARE_DEBUG}, if defined, non-empty
12517 and nonzero, implicitly enables @option{-fcompare-debug}. If
12518 @env{GCC_COMPARE_DEBUG} is defined to a string starting with a dash,
12519 then it is used for @var{opts}, otherwise the default @option{-gtoggle}
12520 is used.
12521
12522 @option{-fcompare-debug=}, with the equal sign but without @var{opts},
12523 is equivalent to @option{-fno-compare-debug}, which disables the dumping
12524 of the final representation and the second compilation, preventing even
12525 @env{GCC_COMPARE_DEBUG} from taking effect.
12526
12527 To verify full coverage during @option{-fcompare-debug} testing, set
12528 @env{GCC_COMPARE_DEBUG} to say @option{-fcompare-debug-not-overridden},
12529 which GCC rejects as an invalid option in any actual compilation
12530 (rather than preprocessing, assembly or linking). To get just a
12531 warning, setting @env{GCC_COMPARE_DEBUG} to @samp{-w%n-fcompare-debug
12532 not overridden} will do.
12533
12534 @item -fcompare-debug-second
12535 @opindex fcompare-debug-second
12536 This option is implicitly passed to the compiler for the second
12537 compilation requested by @option{-fcompare-debug}, along with options to
12538 silence warnings, and omitting other options that would cause
12539 side-effect compiler outputs to files or to the standard output. Dump
12540 files and preserved temporary files are renamed so as to contain the
12541 @code{.gk} additional extension during the second compilation, to avoid
12542 overwriting those generated by the first.
12543
12544 When this option is passed to the compiler driver, it causes the
12545 @emph{first} compilation to be skipped, which makes it useful for little
12546 other than debugging the compiler proper.
12547
12548 @item -gtoggle
12549 @opindex gtoggle
12550 Turn off generation of debug info, if leaving out this option
12551 generates it, or turn it on at level 2 otherwise. The position of this
12552 argument in the command line does not matter; it takes effect after all
12553 other options are processed, and it does so only once, no matter how
12554 many times it is given. This is mainly intended to be used with
12555 @option{-fcompare-debug}.
12556
12557 @item -fvar-tracking-assignments-toggle
12558 @opindex fvar-tracking-assignments-toggle
12559 @opindex fno-var-tracking-assignments-toggle
12560 Toggle @option{-fvar-tracking-assignments}, in the same way that
12561 @option{-gtoggle} toggles @option{-g}.
12562
12563 @item -Q
12564 @opindex Q
12565 Makes the compiler print out each function name as it is compiled, and
12566 print some statistics about each pass when it finishes.
12567
12568 @item -ftime-report
12569 @opindex ftime-report
12570 Makes the compiler print some statistics about the time consumed by each
12571 pass when it finishes.
12572
12573 @item -fira-verbose=@var{n}
12574 @opindex fira-verbose
12575 Control the verbosity of the dump file for the integrated register allocator.
12576 The default value is 5. If the value @var{n} is greater or equal to 10,
12577 the dump output is sent to stderr using the same format as @var{n} minus 10.
12578
12579 @item -flto-report
12580 @opindex flto-report
12581 Prints a report with internal details on the workings of the link-time
12582 optimizer. The contents of this report vary from version to version.
12583 It is meant to be useful to GCC developers when processing object
12584 files in LTO mode (via @option{-flto}).
12585
12586 Disabled by default.
12587
12588 @item -flto-report-wpa
12589 @opindex flto-report-wpa
12590 Like @option{-flto-report}, but only print for the WPA phase of Link
12591 Time Optimization.
12592
12593 @item -fmem-report
12594 @opindex fmem-report
12595 Makes the compiler print some statistics about permanent memory
12596 allocation when it finishes.
12597
12598 @item -fmem-report-wpa
12599 @opindex fmem-report-wpa
12600 Makes the compiler print some statistics about permanent memory
12601 allocation for the WPA phase only.
12602
12603 @item -fpre-ipa-mem-report
12604 @opindex fpre-ipa-mem-report
12605 @item -fpost-ipa-mem-report
12606 @opindex fpost-ipa-mem-report
12607 Makes the compiler print some statistics about permanent memory
12608 allocation before or after interprocedural optimization.
12609
12610 @item -fprofile-report
12611 @opindex fprofile-report
12612 Makes the compiler print some statistics about consistency of the
12613 (estimated) profile and effect of individual passes.
12614
12615 @item -fstack-usage
12616 @opindex fstack-usage
12617 Makes the compiler output stack usage information for the program, on a
12618 per-function basis. The filename for the dump is made by appending
12619 @file{.su} to the @var{auxname}. @var{auxname} is generated from the name of
12620 the output file, if explicitly specified and it is not an executable,
12621 otherwise it is the basename of the source file. An entry is made up
12622 of three fields:
12623
12624 @itemize
12625 @item
12626 The name of the function.
12627 @item
12628 A number of bytes.
12629 @item
12630 One or more qualifiers: @code{static}, @code{dynamic}, @code{bounded}.
12631 @end itemize
12632
12633 The qualifier @code{static} means that the function manipulates the stack
12634 statically: a fixed number of bytes are allocated for the frame on function
12635 entry and released on function exit; no stack adjustments are otherwise made
12636 in the function. The second field is this fixed number of bytes.
12637
12638 The qualifier @code{dynamic} means that the function manipulates the stack
12639 dynamically: in addition to the static allocation described above, stack
12640 adjustments are made in the body of the function, for example to push/pop
12641 arguments around function calls. If the qualifier @code{bounded} is also
12642 present, the amount of these adjustments is bounded at compile time and
12643 the second field is an upper bound of the total amount of stack used by
12644 the function. If it is not present, the amount of these adjustments is
12645 not bounded at compile time and the second field only represents the
12646 bounded part.
12647
12648 @item -fstats
12649 @opindex fstats
12650 Emit statistics about front-end processing at the end of the compilation.
12651 This option is supported only by the C++ front end, and
12652 the information is generally only useful to the G++ development team.
12653
12654 @item -fdbg-cnt-list
12655 @opindex fdbg-cnt-list
12656 Print the name and the counter upper bound for all debug counters.
12657
12658
12659 @item -fdbg-cnt=@var{counter-value-list}
12660 @opindex fdbg-cnt
12661 Set the internal debug counter upper bound. @var{counter-value-list}
12662 is a comma-separated list of @var{name}:@var{value} pairs
12663 which sets the upper bound of each debug counter @var{name} to @var{value}.
12664 All debug counters have the initial upper bound of @code{UINT_MAX};
12665 thus @code{dbg_cnt} returns true always unless the upper bound
12666 is set by this option.
12667 For example, with @option{-fdbg-cnt=dce:10,tail_call:0},
12668 @code{dbg_cnt(dce)} returns true only for first 10 invocations.
12669
12670 @item -print-file-name=@var{library}
12671 @opindex print-file-name
12672 Print the full absolute name of the library file @var{library} that
12673 would be used when linking---and don't do anything else. With this
12674 option, GCC does not compile or link anything; it just prints the
12675 file name.
12676
12677 @item -print-multi-directory
12678 @opindex print-multi-directory
12679 Print the directory name corresponding to the multilib selected by any
12680 other switches present in the command line. This directory is supposed
12681 to exist in @env{GCC_EXEC_PREFIX}.
12682
12683 @item -print-multi-lib
12684 @opindex print-multi-lib
12685 Print the mapping from multilib directory names to compiler switches
12686 that enable them. The directory name is separated from the switches by
12687 @samp{;}, and each switch starts with an @samp{@@} instead of the
12688 @samp{-}, without spaces between multiple switches. This is supposed to
12689 ease shell processing.
12690
12691 @item -print-multi-os-directory
12692 @opindex print-multi-os-directory
12693 Print the path to OS libraries for the selected
12694 multilib, relative to some @file{lib} subdirectory. If OS libraries are
12695 present in the @file{lib} subdirectory and no multilibs are used, this is
12696 usually just @file{.}, if OS libraries are present in @file{lib@var{suffix}}
12697 sibling directories this prints e.g.@: @file{../lib64}, @file{../lib} or
12698 @file{../lib32}, or if OS libraries are present in @file{lib/@var{subdir}}
12699 subdirectories it prints e.g.@: @file{amd64}, @file{sparcv9} or @file{ev6}.
12700
12701 @item -print-multiarch
12702 @opindex print-multiarch
12703 Print the path to OS libraries for the selected multiarch,
12704 relative to some @file{lib} subdirectory.
12705
12706 @item -print-prog-name=@var{program}
12707 @opindex print-prog-name
12708 Like @option{-print-file-name}, but searches for a program such as @command{cpp}.
12709
12710 @item -print-libgcc-file-name
12711 @opindex print-libgcc-file-name
12712 Same as @option{-print-file-name=libgcc.a}.
12713
12714 This is useful when you use @option{-nostdlib} or @option{-nodefaultlibs}
12715 but you do want to link with @file{libgcc.a}. You can do:
12716
12717 @smallexample
12718 gcc -nostdlib @var{files}@dots{} `gcc -print-libgcc-file-name`
12719 @end smallexample
12720
12721 @item -print-search-dirs
12722 @opindex print-search-dirs
12723 Print the name of the configured installation directory and a list of
12724 program and library directories @command{gcc} searches---and don't do anything else.
12725
12726 This is useful when @command{gcc} prints the error message
12727 @samp{installation problem, cannot exec cpp0: No such file or directory}.
12728 To resolve this you either need to put @file{cpp0} and the other compiler
12729 components where @command{gcc} expects to find them, or you can set the environment
12730 variable @env{GCC_EXEC_PREFIX} to the directory where you installed them.
12731 Don't forget the trailing @samp{/}.
12732 @xref{Environment Variables}.
12733
12734 @item -print-sysroot
12735 @opindex print-sysroot
12736 Print the target sysroot directory that is used during
12737 compilation. This is the target sysroot specified either at configure
12738 time or using the @option{--sysroot} option, possibly with an extra
12739 suffix that depends on compilation options. If no target sysroot is
12740 specified, the option prints nothing.
12741
12742 @item -print-sysroot-headers-suffix
12743 @opindex print-sysroot-headers-suffix
12744 Print the suffix added to the target sysroot when searching for
12745 headers, or give an error if the compiler is not configured with such
12746 a suffix---and don't do anything else.
12747
12748 @item -dumpmachine
12749 @opindex dumpmachine
12750 Print the compiler's target machine (for example,
12751 @samp{i686-pc-linux-gnu})---and don't do anything else.
12752
12753 @item -dumpversion
12754 @opindex dumpversion
12755 Print the compiler version (for example, @code{3.0})---and don't do
12756 anything else.
12757
12758 @item -dumpspecs
12759 @opindex dumpspecs
12760 Print the compiler's built-in specs---and don't do anything else. (This
12761 is used when GCC itself is being built.) @xref{Spec Files}.
12762 @end table
12763
12764 @node Submodel Options
12765 @section Machine-Dependent Options
12766 @cindex submodel options
12767 @cindex specifying hardware config
12768 @cindex hardware models and configurations, specifying
12769 @cindex target-dependent options
12770 @cindex machine-dependent options
12771
12772 Each target machine supported by GCC can have its own options---for
12773 example, to allow you to compile for a particular processor variant or
12774 ABI, or to control optimizations specific to that machine. By
12775 convention, the names of machine-specific options start with
12776 @samp{-m}.
12777
12778 Some configurations of the compiler also support additional target-specific
12779 options, usually for compatibility with other compilers on the same
12780 platform.
12781
12782 @c This list is ordered alphanumerically by subsection name.
12783 @c It should be the same order and spelling as these options are listed
12784 @c in Machine Dependent Options
12785
12786 @menu
12787 * AArch64 Options::
12788 * Adapteva Epiphany Options::
12789 * ARC Options::
12790 * ARM Options::
12791 * AVR Options::
12792 * Blackfin Options::
12793 * C6X Options::
12794 * CRIS Options::
12795 * CR16 Options::
12796 * Darwin Options::
12797 * DEC Alpha Options::
12798 * FR30 Options::
12799 * FT32 Options::
12800 * FRV Options::
12801 * GNU/Linux Options::
12802 * H8/300 Options::
12803 * HPPA Options::
12804 * IA-64 Options::
12805 * LM32 Options::
12806 * M32C Options::
12807 * M32R/D Options::
12808 * M680x0 Options::
12809 * MCore Options::
12810 * MeP Options::
12811 * MicroBlaze Options::
12812 * MIPS Options::
12813 * MMIX Options::
12814 * MN10300 Options::
12815 * Moxie Options::
12816 * MSP430 Options::
12817 * NDS32 Options::
12818 * Nios II Options::
12819 * Nvidia PTX Options::
12820 * PDP-11 Options::
12821 * picoChip Options::
12822 * PowerPC Options::
12823 * RL78 Options::
12824 * RS/6000 and PowerPC Options::
12825 * RX Options::
12826 * S/390 and zSeries Options::
12827 * Score Options::
12828 * SH Options::
12829 * Solaris 2 Options::
12830 * SPARC Options::
12831 * SPU Options::
12832 * System V Options::
12833 * TILE-Gx Options::
12834 * TILEPro Options::
12835 * V850 Options::
12836 * VAX Options::
12837 * Visium Options::
12838 * VMS Options::
12839 * VxWorks Options::
12840 * x86 Options::
12841 * x86 Windows Options::
12842 * Xstormy16 Options::
12843 * Xtensa Options::
12844 * zSeries Options::
12845 @end menu
12846
12847 @node AArch64 Options
12848 @subsection AArch64 Options
12849 @cindex AArch64 Options
12850
12851 These options are defined for AArch64 implementations:
12852
12853 @table @gcctabopt
12854
12855 @item -mabi=@var{name}
12856 @opindex mabi
12857 Generate code for the specified data model. Permissible values
12858 are @samp{ilp32} for SysV-like data model where int, long int and pointer
12859 are 32-bit, and @samp{lp64} for SysV-like data model where int is 32-bit,
12860 but long int and pointer are 64-bit.
12861
12862 The default depends on the specific target configuration. Note that
12863 the LP64 and ILP32 ABIs are not link-compatible; you must compile your
12864 entire program with the same ABI, and link with a compatible set of libraries.
12865
12866 @item -mbig-endian
12867 @opindex mbig-endian
12868 Generate big-endian code. This is the default when GCC is configured for an
12869 @samp{aarch64_be-*-*} target.
12870
12871 @item -mgeneral-regs-only
12872 @opindex mgeneral-regs-only
12873 Generate code which uses only the general-purpose registers. This will prevent
12874 the compiler from using floating-point and Advanced SIMD registers but will not
12875 impose any restrictions on the assembler.
12876
12877 @item -mlittle-endian
12878 @opindex mlittle-endian
12879 Generate little-endian code. This is the default when GCC is configured for an
12880 @samp{aarch64-*-*} but not an @samp{aarch64_be-*-*} target.
12881
12882 @item -mcmodel=tiny
12883 @opindex mcmodel=tiny
12884 Generate code for the tiny code model. The program and its statically defined
12885 symbols must be within 1GB of each other. Pointers are 64 bits. Programs can
12886 be statically or dynamically linked. This model is not fully implemented and
12887 mostly treated as @samp{small}.
12888
12889 @item -mcmodel=small
12890 @opindex mcmodel=small
12891 Generate code for the small code model. The program and its statically defined
12892 symbols must be within 4GB of each other. Pointers are 64 bits. Programs can
12893 be statically or dynamically linked. This is the default code model.
12894
12895 @item -mcmodel=large
12896 @opindex mcmodel=large
12897 Generate code for the large code model. This makes no assumptions about
12898 addresses and sizes of sections. Pointers are 64 bits. Programs can be
12899 statically linked only.
12900
12901 @item -mstrict-align
12902 @opindex mstrict-align
12903 Do not assume that unaligned memory references are handled by the system.
12904
12905 @item -momit-leaf-frame-pointer
12906 @itemx -mno-omit-leaf-frame-pointer
12907 @opindex momit-leaf-frame-pointer
12908 @opindex mno-omit-leaf-frame-pointer
12909 Omit or keep the frame pointer in leaf functions. The former behavior is the
12910 default.
12911
12912 @item -mtls-dialect=desc
12913 @opindex mtls-dialect=desc
12914 Use TLS descriptors as the thread-local storage mechanism for dynamic accesses
12915 of TLS variables. This is the default.
12916
12917 @item -mtls-dialect=traditional
12918 @opindex mtls-dialect=traditional
12919 Use traditional TLS as the thread-local storage mechanism for dynamic accesses
12920 of TLS variables.
12921
12922 @item -mtls-size=@var{size}
12923 @opindex mtls-size
12924 Specify bit size of immediate TLS offsets. Valid values are 12, 24, 32, 48.
12925 This option depends on binutils higher than 2.25.
12926
12927 @item -mfix-cortex-a53-835769
12928 @itemx -mno-fix-cortex-a53-835769
12929 @opindex mfix-cortex-a53-835769
12930 @opindex mno-fix-cortex-a53-835769
12931 Enable or disable the workaround for the ARM Cortex-A53 erratum number 835769.
12932 This involves inserting a NOP instruction between memory instructions and
12933 64-bit integer multiply-accumulate instructions.
12934
12935 @item -mfix-cortex-a53-843419
12936 @itemx -mno-fix-cortex-a53-843419
12937 @opindex mfix-cortex-a53-843419
12938 @opindex mno-fix-cortex-a53-843419
12939 Enable or disable the workaround for the ARM Cortex-A53 erratum number 843419.
12940 This erratum workaround is made at link time and this will only pass the
12941 corresponding flag to the linker.
12942
12943 @item -mlow-precision-recip-sqrt
12944 @item -mno-low-precision-recip-sqrt
12945 @opindex -mlow-precision-recip-sqrt
12946 @opindex -mno-low-precision-recip-sqrt
12947 When calculating the reciprocal square root approximation,
12948 uses one less step than otherwise, thus reducing latency and precision.
12949 This is only relevant if @option{-ffast-math} enables the reciprocal square root
12950 approximation, which in turn depends on the target processor.
12951
12952 @item -march=@var{name}
12953 @opindex march
12954 Specify the name of the target architecture and, optionally, one or
12955 more feature modifiers. This option has the form
12956 @option{-march=@var{arch}@r{@{}+@r{[}no@r{]}@var{feature}@r{@}*}}.
12957
12958 The permissible values for @var{arch} are @samp{armv8-a},
12959 @samp{armv8.1-a} or @var{native}.
12960
12961 The value @samp{armv8.1-a} implies @samp{armv8-a} and enables compiler
12962 support for the ARMv8.1 architecture extension. In particular, it
12963 enables the @samp{+crc} and @samp{+lse} features.
12964
12965 The value @samp{native} is available on native AArch64 GNU/Linux and
12966 causes the compiler to pick the architecture of the host system. This
12967 option has no effect if the compiler is unable to recognize the
12968 architecture of the host system,
12969
12970 The permissible values for @var{feature} are listed in the sub-section
12971 on @ref{aarch64-feature-modifiers,,@option{-march} and @option{-mcpu}
12972 Feature Modifiers}. Where conflicting feature modifiers are
12973 specified, the right-most feature is used.
12974
12975 GCC uses @var{name} to determine what kind of instructions it can emit
12976 when generating assembly code. If @option{-march} is specified
12977 without either of @option{-mtune} or @option{-mcpu} also being
12978 specified, the code is tuned to perform well across a range of target
12979 processors implementing the target architecture.
12980
12981 @item -mtune=@var{name}
12982 @opindex mtune
12983 Specify the name of the target processor for which GCC should tune the
12984 performance of the code. Permissible values for this option are:
12985 @samp{generic}, @samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a57},
12986 @samp{cortex-a72}, @samp{exynos-m1}, @samp{qdf24xx}, @samp{thunderx},
12987 @samp{xgene1}.
12988
12989 Additionally, this option can specify that GCC should tune the performance
12990 of the code for a big.LITTLE system. Permissible values for this
12991 option are: @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53}.
12992
12993 Additionally on native AArch64 GNU/Linux systems the value
12994 @samp{native} is available. This option causes the compiler to pick
12995 the architecture of and tune the performance of the code for the
12996 processor of the host system. This option has no effect if the
12997 compiler is unable to recognize the architecture of the host system.
12998
12999 Where none of @option{-mtune=}, @option{-mcpu=} or @option{-march=}
13000 are specified, the code is tuned to perform well across a range
13001 of target processors.
13002
13003 This option cannot be suffixed by feature modifiers.
13004
13005 @item -mcpu=@var{name}
13006 @opindex mcpu
13007 Specify the name of the target processor, optionally suffixed by one
13008 or more feature modifiers. This option has the form
13009 @option{-mcpu=@var{cpu}@r{@{}+@r{[}no@r{]}@var{feature}@r{@}*}}, where
13010 the permissible values for @var{cpu} are the same as those available
13011 for @option{-mtune}. The permissible values for @var{feature} are
13012 documented in the sub-section on
13013 @ref{aarch64-feature-modifiers,,@option{-march} and @option{-mcpu}
13014 Feature Modifiers}. Where conflicting feature modifiers are
13015 specified, the right-most feature is used.
13016
13017 Additionally on native AArch64 GNU/Linux systems the value
13018 @samp{native} is available. This option causes the compiler to tune
13019 the performance of the code for the processor of the host system.
13020 This option has no effect if the compiler is unable to recognize the
13021 architecture of the host system.
13022
13023 GCC uses @var{name} to determine what kind of instructions it can emit when
13024 generating assembly code (as if by @option{-march}) and to determine
13025 the target processor for which to tune for performance (as if
13026 by @option{-mtune}). Where this option is used in conjunction
13027 with @option{-march} or @option{-mtune}, those options take precedence
13028 over the appropriate part of this option.
13029
13030 @item -moverride=@var{string}
13031 @opindex moverride
13032 Override tuning decisions made by the back-end in response to a
13033 @option{-mtune=} switch. The syntax, semantics, and accepted values
13034 for @var{string} in this option are not guaranteed to be consistent
13035 across releases.
13036
13037 This option is only intended to be useful when developing GCC.
13038
13039 @item -mpc-relative-literal-loads
13040 @opindex mpcrelativeliteralloads
13041 Enable PC relative literal loads. If this option is used, literal
13042 pools are assumed to have a range of up to 1MiB and an appropriate
13043 instruction sequence is used. This option has no impact when used
13044 with @option{-mcmodel=tiny}.
13045
13046 @end table
13047
13048 @subsubsection @option{-march} and @option{-mcpu} Feature Modifiers
13049 @anchor{aarch64-feature-modifiers}
13050 @cindex @option{-march} feature modifiers
13051 @cindex @option{-mcpu} feature modifiers
13052 Feature modifiers used with @option{-march} and @option{-mcpu} can be any of
13053 the following and their inverses @option{no@var{feature}}:
13054
13055 @table @samp
13056 @item crc
13057 Enable CRC extension. This is on by default for
13058 @option{-march=armv8.1-a}.
13059 @item crypto
13060 Enable Crypto extension. This also enables Advanced SIMD and floating-point
13061 instructions.
13062 @item fp
13063 Enable floating-point instructions. This is on by default for all possible
13064 values for options @option{-march} and @option{-mcpu}.
13065 @item simd
13066 Enable Advanced SIMD instructions. This also enables floating-point
13067 instructions. This is on by default for all possible values for options
13068 @option{-march} and @option{-mcpu}.
13069 @item lse
13070 Enable Large System Extension instructions. This is on by default for
13071 @option{-march=armv8.1-a}.
13072
13073 @end table
13074
13075 That is, @option{crypto} implies @option{simd} implies @option{fp}.
13076 Conversely, @option{nofp} (or equivalently, @option{-mgeneral-regs-only})
13077 implies @option{nosimd} implies @option{nocrypto}.
13078
13079 @node Adapteva Epiphany Options
13080 @subsection Adapteva Epiphany Options
13081
13082 These @samp{-m} options are defined for Adapteva Epiphany:
13083
13084 @table @gcctabopt
13085 @item -mhalf-reg-file
13086 @opindex mhalf-reg-file
13087 Don't allocate any register in the range @code{r32}@dots{}@code{r63}.
13088 That allows code to run on hardware variants that lack these registers.
13089
13090 @item -mprefer-short-insn-regs
13091 @opindex mprefer-short-insn-regs
13092 Preferentially allocate registers that allow short instruction generation.
13093 This can result in increased instruction count, so this may either reduce or
13094 increase overall code size.
13095
13096 @item -mbranch-cost=@var{num}
13097 @opindex mbranch-cost
13098 Set the cost of branches to roughly @var{num} ``simple'' instructions.
13099 This cost is only a heuristic and is not guaranteed to produce
13100 consistent results across releases.
13101
13102 @item -mcmove
13103 @opindex mcmove
13104 Enable the generation of conditional moves.
13105
13106 @item -mnops=@var{num}
13107 @opindex mnops
13108 Emit @var{num} NOPs before every other generated instruction.
13109
13110 @item -mno-soft-cmpsf
13111 @opindex mno-soft-cmpsf
13112 For single-precision floating-point comparisons, emit an @code{fsub} instruction
13113 and test the flags. This is faster than a software comparison, but can
13114 get incorrect results in the presence of NaNs, or when two different small
13115 numbers are compared such that their difference is calculated as zero.
13116 The default is @option{-msoft-cmpsf}, which uses slower, but IEEE-compliant,
13117 software comparisons.
13118
13119 @item -mstack-offset=@var{num}
13120 @opindex mstack-offset
13121 Set the offset between the top of the stack and the stack pointer.
13122 E.g., a value of 8 means that the eight bytes in the range @code{sp+0@dots{}sp+7}
13123 can be used by leaf functions without stack allocation.
13124 Values other than @samp{8} or @samp{16} are untested and unlikely to work.
13125 Note also that this option changes the ABI; compiling a program with a
13126 different stack offset than the libraries have been compiled with
13127 generally does not work.
13128 This option can be useful if you want to evaluate if a different stack
13129 offset would give you better code, but to actually use a different stack
13130 offset to build working programs, it is recommended to configure the
13131 toolchain with the appropriate @option{--with-stack-offset=@var{num}} option.
13132
13133 @item -mno-round-nearest
13134 @opindex mno-round-nearest
13135 Make the scheduler assume that the rounding mode has been set to
13136 truncating. The default is @option{-mround-nearest}.
13137
13138 @item -mlong-calls
13139 @opindex mlong-calls
13140 If not otherwise specified by an attribute, assume all calls might be beyond
13141 the offset range of the @code{b} / @code{bl} instructions, and therefore load the
13142 function address into a register before performing a (otherwise direct) call.
13143 This is the default.
13144
13145 @item -mshort-calls
13146 @opindex short-calls
13147 If not otherwise specified by an attribute, assume all direct calls are
13148 in the range of the @code{b} / @code{bl} instructions, so use these instructions
13149 for direct calls. The default is @option{-mlong-calls}.
13150
13151 @item -msmall16
13152 @opindex msmall16
13153 Assume addresses can be loaded as 16-bit unsigned values. This does not
13154 apply to function addresses for which @option{-mlong-calls} semantics
13155 are in effect.
13156
13157 @item -mfp-mode=@var{mode}
13158 @opindex mfp-mode
13159 Set the prevailing mode of the floating-point unit.
13160 This determines the floating-point mode that is provided and expected
13161 at function call and return time. Making this mode match the mode you
13162 predominantly need at function start can make your programs smaller and
13163 faster by avoiding unnecessary mode switches.
13164
13165 @var{mode} can be set to one the following values:
13166
13167 @table @samp
13168 @item caller
13169 Any mode at function entry is valid, and retained or restored when
13170 the function returns, and when it calls other functions.
13171 This mode is useful for compiling libraries or other compilation units
13172 you might want to incorporate into different programs with different
13173 prevailing FPU modes, and the convenience of being able to use a single
13174 object file outweighs the size and speed overhead for any extra
13175 mode switching that might be needed, compared with what would be needed
13176 with a more specific choice of prevailing FPU mode.
13177
13178 @item truncate
13179 This is the mode used for floating-point calculations with
13180 truncating (i.e.@: round towards zero) rounding mode. That includes
13181 conversion from floating point to integer.
13182
13183 @item round-nearest
13184 This is the mode used for floating-point calculations with
13185 round-to-nearest-or-even rounding mode.
13186
13187 @item int
13188 This is the mode used to perform integer calculations in the FPU, e.g.@:
13189 integer multiply, or integer multiply-and-accumulate.
13190 @end table
13191
13192 The default is @option{-mfp-mode=caller}
13193
13194 @item -mnosplit-lohi
13195 @itemx -mno-postinc
13196 @itemx -mno-postmodify
13197 @opindex mnosplit-lohi
13198 @opindex mno-postinc
13199 @opindex mno-postmodify
13200 Code generation tweaks that disable, respectively, splitting of 32-bit
13201 loads, generation of post-increment addresses, and generation of
13202 post-modify addresses. The defaults are @option{msplit-lohi},
13203 @option{-mpost-inc}, and @option{-mpost-modify}.
13204
13205 @item -mnovect-double
13206 @opindex mno-vect-double
13207 Change the preferred SIMD mode to SImode. The default is
13208 @option{-mvect-double}, which uses DImode as preferred SIMD mode.
13209
13210 @item -max-vect-align=@var{num}
13211 @opindex max-vect-align
13212 The maximum alignment for SIMD vector mode types.
13213 @var{num} may be 4 or 8. The default is 8.
13214 Note that this is an ABI change, even though many library function
13215 interfaces are unaffected if they don't use SIMD vector modes
13216 in places that affect size and/or alignment of relevant types.
13217
13218 @item -msplit-vecmove-early
13219 @opindex msplit-vecmove-early
13220 Split vector moves into single word moves before reload. In theory this
13221 can give better register allocation, but so far the reverse seems to be
13222 generally the case.
13223
13224 @item -m1reg-@var{reg}
13225 @opindex m1reg-
13226 Specify a register to hold the constant @minus{}1, which makes loading small negative
13227 constants and certain bitmasks faster.
13228 Allowable values for @var{reg} are @samp{r43} and @samp{r63},
13229 which specify use of that register as a fixed register,
13230 and @samp{none}, which means that no register is used for this
13231 purpose. The default is @option{-m1reg-none}.
13232
13233 @end table
13234
13235 @node ARC Options
13236 @subsection ARC Options
13237 @cindex ARC options
13238
13239 The following options control the architecture variant for which code
13240 is being compiled:
13241
13242 @c architecture variants
13243 @table @gcctabopt
13244
13245 @item -mbarrel-shifter
13246 @opindex mbarrel-shifter
13247 Generate instructions supported by barrel shifter. This is the default
13248 unless @option{-mcpu=ARC601} or @samp{-mcpu=ARCEM} is in effect.
13249
13250 @item -mcpu=@var{cpu}
13251 @opindex mcpu
13252 Set architecture type, register usage, and instruction scheduling
13253 parameters for @var{cpu}. There are also shortcut alias options
13254 available for backward compatibility and convenience. Supported
13255 values for @var{cpu} are
13256
13257 @table @samp
13258 @opindex mA6
13259 @opindex mARC600
13260 @item ARC600
13261 @item arc600
13262 Compile for ARC600. Aliases: @option{-mA6}, @option{-mARC600}.
13263
13264 @item ARC601
13265 @item arc601
13266 @opindex mARC601
13267 Compile for ARC601. Alias: @option{-mARC601}.
13268
13269 @item ARC700
13270 @item arc700
13271 @opindex mA7
13272 @opindex mARC700
13273 Compile for ARC700. Aliases: @option{-mA7}, @option{-mARC700}.
13274 This is the default when configured with @option{--with-cpu=arc700}@.
13275
13276 @item ARCEM
13277 @item arcem
13278 Compile for ARC EM.
13279
13280 @item ARCHS
13281 @item archs
13282 Compile for ARC HS.
13283 @end table
13284
13285 @item -mdpfp
13286 @opindex mdpfp
13287 @itemx -mdpfp-compact
13288 @opindex mdpfp-compact
13289 FPX: Generate Double Precision FPX instructions, tuned for the compact
13290 implementation.
13291
13292 @item -mdpfp-fast
13293 @opindex mdpfp-fast
13294 FPX: Generate Double Precision FPX instructions, tuned for the fast
13295 implementation.
13296
13297 @item -mno-dpfp-lrsr
13298 @opindex mno-dpfp-lrsr
13299 Disable LR and SR instructions from using FPX extension aux registers.
13300
13301 @item -mea
13302 @opindex mea
13303 Generate Extended arithmetic instructions. Currently only
13304 @code{divaw}, @code{adds}, @code{subs}, and @code{sat16} are
13305 supported. This is always enabled for @option{-mcpu=ARC700}.
13306
13307 @item -mno-mpy
13308 @opindex mno-mpy
13309 Do not generate mpy instructions for ARC700.
13310
13311 @item -mmul32x16
13312 @opindex mmul32x16
13313 Generate 32x16 bit multiply and mac instructions.
13314
13315 @item -mmul64
13316 @opindex mmul64
13317 Generate mul64 and mulu64 instructions. Only valid for @option{-mcpu=ARC600}.
13318
13319 @item -mnorm
13320 @opindex mnorm
13321 Generate norm instruction. This is the default if @option{-mcpu=ARC700}
13322 is in effect.
13323
13324 @item -mspfp
13325 @opindex mspfp
13326 @itemx -mspfp-compact
13327 @opindex mspfp-compact
13328 FPX: Generate Single Precision FPX instructions, tuned for the compact
13329 implementation.
13330
13331 @item -mspfp-fast
13332 @opindex mspfp-fast
13333 FPX: Generate Single Precision FPX instructions, tuned for the fast
13334 implementation.
13335
13336 @item -msimd
13337 @opindex msimd
13338 Enable generation of ARC SIMD instructions via target-specific
13339 builtins. Only valid for @option{-mcpu=ARC700}.
13340
13341 @item -msoft-float
13342 @opindex msoft-float
13343 This option ignored; it is provided for compatibility purposes only.
13344 Software floating point code is emitted by default, and this default
13345 can overridden by FPX options; @samp{mspfp}, @samp{mspfp-compact}, or
13346 @samp{mspfp-fast} for single precision, and @samp{mdpfp},
13347 @samp{mdpfp-compact}, or @samp{mdpfp-fast} for double precision.
13348
13349 @item -mswap
13350 @opindex mswap
13351 Generate swap instructions.
13352
13353 @item -matomic
13354 @opindex matomic
13355 This enables Locked Load/Store Conditional extension to implement
13356 atomic memopry built-in functions. Not available for ARC 6xx or ARC
13357 EM cores.
13358
13359 @item -mdiv-rem
13360 @opindex mdiv-rem
13361 Enable DIV/REM instructions for ARCv2 cores.
13362
13363 @item -mcode-density
13364 @opindex mcode-density
13365 Enable code density instructions for ARC EM, default on for ARC HS.
13366
13367 @item -mll64
13368 @opindex mll64
13369 Enable double load/store operations for ARC HS cores.
13370
13371 @item -mtp-regno=@var{regno}
13372 @opindex mtp-regno
13373 Specify thread pointer register number.
13374
13375 @item -mmpy-option=@var{multo}
13376 @opindex mmpy-option
13377 Compile ARCv2 code with a multiplier design option. @samp{wlh1} is
13378 the default value. The recognized values for @var{multo} are:
13379
13380 @table @samp
13381 @item 0
13382 No multiplier available.
13383
13384 @item 1
13385 @opindex w
13386 The multiply option is set to w: 16x16 multiplier, fully pipelined.
13387 The following instructions are enabled: MPYW, and MPYUW.
13388
13389 @item 2
13390 @opindex wlh1
13391 The multiply option is set to wlh1: 32x32 multiplier, fully
13392 pipelined (1 stage). The following instructions are additionally
13393 enabled: MPY, MPYU, MPYM, MPYMU, and MPY_S.
13394
13395 @item 3
13396 @opindex wlh2
13397 The multiply option is set to wlh2: 32x32 multiplier, fully pipelined
13398 (2 stages). The following instructions are additionally enabled: MPY,
13399 MPYU, MPYM, MPYMU, and MPY_S.
13400
13401 @item 4
13402 @opindex wlh3
13403 The multiply option is set to wlh3: Two 16x16 multiplier, blocking,
13404 sequential. The following instructions are additionally enabled: MPY,
13405 MPYU, MPYM, MPYMU, and MPY_S.
13406
13407 @item 5
13408 @opindex wlh4
13409 The multiply option is set to wlh4: One 16x16 multiplier, blocking,
13410 sequential. The following instructions are additionally enabled: MPY,
13411 MPYU, MPYM, MPYMU, and MPY_S.
13412
13413 @item 6
13414 @opindex wlh5
13415 The multiply option is set to wlh5: One 32x4 multiplier, blocking,
13416 sequential. The following instructions are additionally enabled: MPY,
13417 MPYU, MPYM, MPYMU, and MPY_S.
13418
13419 @end table
13420
13421 This option is only available for ARCv2 cores@.
13422
13423 @item -mfpu=@var{fpu}
13424 @opindex mfpu
13425 Enables specific floating-point hardware extension for ARCv2
13426 core. Supported values for @var{fpu} are:
13427
13428 @table @samp
13429
13430 @item fpus
13431 @opindex fpus
13432 Enables support for single precision floating point hardware
13433 extensions@.
13434
13435 @item fpud
13436 @opindex fpud
13437 Enables support for double precision floating point hardware
13438 extensions. The single precision floating point extension is also
13439 enabled. Not available for ARC EM@.
13440
13441 @item fpuda
13442 @opindex fpuda
13443 Enables support for double precision floating point hardware
13444 extensions using double precision assist instructions. The single
13445 precision floating point extension is also enabled. This option is
13446 only available for ARC EM@.
13447
13448 @item fpuda_div
13449 @opindex fpuda_div
13450 Enables support for double precision floating point hardware
13451 extensions using double precision assist instructions, and simple
13452 precision square-root and divide hardware extensions. The single
13453 precision floating point extension is also enabled. This option is
13454 only available for ARC EM@.
13455
13456 @item fpuda_fma
13457 @opindex fpuda_fma
13458 Enables support for double precision floating point hardware
13459 extensions using double precision assist instructions, and simple
13460 precision fused multiple and add hardware extension. The single
13461 precision floating point extension is also enabled. This option is
13462 only available for ARC EM@.
13463
13464 @item fpuda_all
13465 @opindex fpuda_all
13466 Enables support for double precision floating point hardware
13467 extensions using double precision assist instructions, and all simple
13468 precision hardware extensions. The single precision floating point
13469 extension is also enabled. This option is only available for ARC EM@.
13470
13471 @item fpus_div
13472 @opindex fpus_div
13473 Enables support for single precision floating point, and single
13474 precision square-root and divide hardware extensions@.
13475
13476 @item fpud_div
13477 @opindex fpud_div
13478 Enables support for double precision floating point, and double
13479 precision square-root and divide hardware extensions. This option
13480 includes option @samp{fpus_div}. Not available for ARC EM@.
13481
13482 @item fpus_fma
13483 @opindex fpus_fma
13484 Enables support for single precision floating point, and single
13485 precision fused multiple and add hardware extensions@.
13486
13487 @item fpud_fma
13488 @opindex fpud_fma
13489 Enables support for double precision floating point, and double
13490 precision fused multiple and add hardware extensions. This option
13491 includes option @samp{fpus_fma}. Not available for ARC EM@.
13492
13493 @item fpus_all
13494 @opindex fpus_all
13495 Enables support for all single precision floating point hardware
13496 extensions@.
13497
13498 @item fpud_all
13499 @opindex fpud_all
13500 Enables support for all single and double precision floating point
13501 hardware extensions. Not available for ARC EM@.
13502
13503 @end table
13504
13505 @end table
13506
13507 The following options are passed through to the assembler, and also
13508 define preprocessor macro symbols.
13509
13510 @c Flags used by the assembler, but for which we define preprocessor
13511 @c macro symbols as well.
13512 @table @gcctabopt
13513 @item -mdsp-packa
13514 @opindex mdsp-packa
13515 Passed down to the assembler to enable the DSP Pack A extensions.
13516 Also sets the preprocessor symbol @code{__Xdsp_packa}.
13517
13518 @item -mdvbf
13519 @opindex mdvbf
13520 Passed down to the assembler to enable the dual viterbi butterfly
13521 extension. Also sets the preprocessor symbol @code{__Xdvbf}.
13522
13523 @c ARC700 4.10 extension instruction
13524 @item -mlock
13525 @opindex mlock
13526 Passed down to the assembler to enable the Locked Load/Store
13527 Conditional extension. Also sets the preprocessor symbol
13528 @code{__Xlock}.
13529
13530 @item -mmac-d16
13531 @opindex mmac-d16
13532 Passed down to the assembler. Also sets the preprocessor symbol
13533 @code{__Xxmac_d16}.
13534
13535 @item -mmac-24
13536 @opindex mmac-24
13537 Passed down to the assembler. Also sets the preprocessor symbol
13538 @code{__Xxmac_24}.
13539
13540 @c ARC700 4.10 extension instruction
13541 @item -mrtsc
13542 @opindex mrtsc
13543 Passed down to the assembler to enable the 64-bit Time-Stamp Counter
13544 extension instruction. Also sets the preprocessor symbol
13545 @code{__Xrtsc}.
13546
13547 @c ARC700 4.10 extension instruction
13548 @item -mswape
13549 @opindex mswape
13550 Passed down to the assembler to enable the swap byte ordering
13551 extension instruction. Also sets the preprocessor symbol
13552 @code{__Xswape}.
13553
13554 @item -mtelephony
13555 @opindex mtelephony
13556 Passed down to the assembler to enable dual and single operand
13557 instructions for telephony. Also sets the preprocessor symbol
13558 @code{__Xtelephony}.
13559
13560 @item -mxy
13561 @opindex mxy
13562 Passed down to the assembler to enable the XY Memory extension. Also
13563 sets the preprocessor symbol @code{__Xxy}.
13564
13565 @end table
13566
13567 The following options control how the assembly code is annotated:
13568
13569 @c Assembly annotation options
13570 @table @gcctabopt
13571 @item -misize
13572 @opindex misize
13573 Annotate assembler instructions with estimated addresses.
13574
13575 @item -mannotate-align
13576 @opindex mannotate-align
13577 Explain what alignment considerations lead to the decision to make an
13578 instruction short or long.
13579
13580 @end table
13581
13582 The following options are passed through to the linker:
13583
13584 @c options passed through to the linker
13585 @table @gcctabopt
13586 @item -marclinux
13587 @opindex marclinux
13588 Passed through to the linker, to specify use of the @code{arclinux} emulation.
13589 This option is enabled by default in tool chains built for
13590 @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}} targets
13591 when profiling is not requested.
13592
13593 @item -marclinux_prof
13594 @opindex marclinux_prof
13595 Passed through to the linker, to specify use of the
13596 @code{arclinux_prof} emulation. This option is enabled by default in
13597 tool chains built for @w{@code{arc-linux-uclibc}} and
13598 @w{@code{arceb-linux-uclibc}} targets when profiling is requested.
13599
13600 @end table
13601
13602 The following options control the semantics of generated code:
13603
13604 @c semantically relevant code generation options
13605 @table @gcctabopt
13606 @item -mlong-calls
13607 @opindex mlong-calls
13608 Generate call insns as register indirect calls, thus providing access
13609 to the full 32-bit address range.
13610
13611 @item -mmedium-calls
13612 @opindex mmedium-calls
13613 Don't use less than 25 bit addressing range for calls, which is the
13614 offset available for an unconditional branch-and-link
13615 instruction. Conditional execution of function calls is suppressed, to
13616 allow use of the 25-bit range, rather than the 21-bit range with
13617 conditional branch-and-link. This is the default for tool chains built
13618 for @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}} targets.
13619
13620 @item -mno-sdata
13621 @opindex mno-sdata
13622 Do not generate sdata references. This is the default for tool chains
13623 built for @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}}
13624 targets.
13625
13626 @item -mucb-mcount
13627 @opindex mucb-mcount
13628 Instrument with mcount calls as used in UCB code. I.e. do the
13629 counting in the callee, not the caller. By default ARC instrumentation
13630 counts in the caller.
13631
13632 @item -mvolatile-cache
13633 @opindex mvolatile-cache
13634 Use ordinarily cached memory accesses for volatile references. This is the
13635 default.
13636
13637 @item -mno-volatile-cache
13638 @opindex mno-volatile-cache
13639 Enable cache bypass for volatile references.
13640
13641 @end table
13642
13643 The following options fine tune code generation:
13644 @c code generation tuning options
13645 @table @gcctabopt
13646 @item -malign-call
13647 @opindex malign-call
13648 Do alignment optimizations for call instructions.
13649
13650 @item -mauto-modify-reg
13651 @opindex mauto-modify-reg
13652 Enable the use of pre/post modify with register displacement.
13653
13654 @item -mbbit-peephole
13655 @opindex mbbit-peephole
13656 Enable bbit peephole2.
13657
13658 @item -mno-brcc
13659 @opindex mno-brcc
13660 This option disables a target-specific pass in @file{arc_reorg} to
13661 generate @code{BRcc} instructions. It has no effect on @code{BRcc}
13662 generation driven by the combiner pass.
13663
13664 @item -mcase-vector-pcrel
13665 @opindex mcase-vector-pcrel
13666 Use pc-relative switch case tables - this enables case table shortening.
13667 This is the default for @option{-Os}.
13668
13669 @item -mcompact-casesi
13670 @opindex mcompact-casesi
13671 Enable compact casesi pattern.
13672 This is the default for @option{-Os}.
13673
13674 @item -mno-cond-exec
13675 @opindex mno-cond-exec
13676 Disable ARCompact specific pass to generate conditional execution instructions.
13677 Due to delay slot scheduling and interactions between operand numbers,
13678 literal sizes, instruction lengths, and the support for conditional execution,
13679 the target-independent pass to generate conditional execution is often lacking,
13680 so the ARC port has kept a special pass around that tries to find more
13681 conditional execution generating opportunities after register allocation,
13682 branch shortening, and delay slot scheduling have been done. This pass
13683 generally, but not always, improves performance and code size, at the cost of
13684 extra compilation time, which is why there is an option to switch it off.
13685 If you have a problem with call instructions exceeding their allowable
13686 offset range because they are conditionalized, you should consider using
13687 @option{-mmedium-calls} instead.
13688
13689 @item -mearly-cbranchsi
13690 @opindex mearly-cbranchsi
13691 Enable pre-reload use of the cbranchsi pattern.
13692
13693 @item -mexpand-adddi
13694 @opindex mexpand-adddi
13695 Expand @code{adddi3} and @code{subdi3} at rtl generation time into
13696 @code{add.f}, @code{adc} etc.
13697
13698 @item -mindexed-loads
13699 @opindex mindexed-loads
13700 Enable the use of indexed loads. This can be problematic because some
13701 optimizers then assume that indexed stores exist, which is not
13702 the case.
13703
13704 @item -mlra
13705 @opindex mlra
13706 Enable Local Register Allocation. This is still experimental for ARC,
13707 so by default the compiler uses standard reload
13708 (i.e. @option{-mno-lra}).
13709
13710 @item -mlra-priority-none
13711 @opindex mlra-priority-none
13712 Don't indicate any priority for target registers.
13713
13714 @item -mlra-priority-compact
13715 @opindex mlra-priority-compact
13716 Indicate target register priority for r0..r3 / r12..r15.
13717
13718 @item -mlra-priority-noncompact
13719 @opindex mlra-priority-noncompact
13720 Reduce target register priority for r0..r3 / r12..r15.
13721
13722 @item -mno-millicode
13723 @opindex mno-millicode
13724 When optimizing for size (using @option{-Os}), prologues and epilogues
13725 that have to save or restore a large number of registers are often
13726 shortened by using call to a special function in libgcc; this is
13727 referred to as a @emph{millicode} call. As these calls can pose
13728 performance issues, and/or cause linking issues when linking in a
13729 nonstandard way, this option is provided to turn off millicode call
13730 generation.
13731
13732 @item -mmixed-code
13733 @opindex mmixed-code
13734 Tweak register allocation to help 16-bit instruction generation.
13735 This generally has the effect of decreasing the average instruction size
13736 while increasing the instruction count.
13737
13738 @item -mq-class
13739 @opindex mq-class
13740 Enable 'q' instruction alternatives.
13741 This is the default for @option{-Os}.
13742
13743 @item -mRcq
13744 @opindex mRcq
13745 Enable Rcq constraint handling - most short code generation depends on this.
13746 This is the default.
13747
13748 @item -mRcw
13749 @opindex mRcw
13750 Enable Rcw constraint handling - ccfsm condexec mostly depends on this.
13751 This is the default.
13752
13753 @item -msize-level=@var{level}
13754 @opindex msize-level
13755 Fine-tune size optimization with regards to instruction lengths and alignment.
13756 The recognized values for @var{level} are:
13757 @table @samp
13758 @item 0
13759 No size optimization. This level is deprecated and treated like @samp{1}.
13760
13761 @item 1
13762 Short instructions are used opportunistically.
13763
13764 @item 2
13765 In addition, alignment of loops and of code after barriers are dropped.
13766
13767 @item 3
13768 In addition, optional data alignment is dropped, and the option @option{Os} is enabled.
13769
13770 @end table
13771
13772 This defaults to @samp{3} when @option{-Os} is in effect. Otherwise,
13773 the behavior when this is not set is equivalent to level @samp{1}.
13774
13775 @item -mtune=@var{cpu}
13776 @opindex mtune
13777 Set instruction scheduling parameters for @var{cpu}, overriding any implied
13778 by @option{-mcpu=}.
13779
13780 Supported values for @var{cpu} are
13781
13782 @table @samp
13783 @item ARC600
13784 Tune for ARC600 cpu.
13785
13786 @item ARC601
13787 Tune for ARC601 cpu.
13788
13789 @item ARC700
13790 Tune for ARC700 cpu with standard multiplier block.
13791
13792 @item ARC700-xmac
13793 Tune for ARC700 cpu with XMAC block.
13794
13795 @item ARC725D
13796 Tune for ARC725D cpu.
13797
13798 @item ARC750D
13799 Tune for ARC750D cpu.
13800
13801 @end table
13802
13803 @item -mmultcost=@var{num}
13804 @opindex mmultcost
13805 Cost to assume for a multiply instruction, with @samp{4} being equal to a
13806 normal instruction.
13807
13808 @item -munalign-prob-threshold=@var{probability}
13809 @opindex munalign-prob-threshold
13810 Set probability threshold for unaligning branches.
13811 When tuning for @samp{ARC700} and optimizing for speed, branches without
13812 filled delay slot are preferably emitted unaligned and long, unless
13813 profiling indicates that the probability for the branch to be taken
13814 is below @var{probability}. @xref{Cross-profiling}.
13815 The default is (REG_BR_PROB_BASE/2), i.e.@: 5000.
13816
13817 @end table
13818
13819 The following options are maintained for backward compatibility, but
13820 are now deprecated and will be removed in a future release:
13821
13822 @c Deprecated options
13823 @table @gcctabopt
13824
13825 @item -margonaut
13826 @opindex margonaut
13827 Obsolete FPX.
13828
13829 @item -mbig-endian
13830 @opindex mbig-endian
13831 @itemx -EB
13832 @opindex EB
13833 Compile code for big endian targets. Use of these options is now
13834 deprecated. Users wanting big-endian code, should use the
13835 @w{@code{arceb-elf32}} and @w{@code{arceb-linux-uclibc}} targets when
13836 building the tool chain, for which big-endian is the default.
13837
13838 @item -mlittle-endian
13839 @opindex mlittle-endian
13840 @itemx -EL
13841 @opindex EL
13842 Compile code for little endian targets. Use of these options is now
13843 deprecated. Users wanting little-endian code should use the
13844 @w{@code{arc-elf32}} and @w{@code{arc-linux-uclibc}} targets when
13845 building the tool chain, for which little-endian is the default.
13846
13847 @item -mbarrel_shifter
13848 @opindex mbarrel_shifter
13849 Replaced by @option{-mbarrel-shifter}.
13850
13851 @item -mdpfp_compact
13852 @opindex mdpfp_compact
13853 Replaced by @option{-mdpfp-compact}.
13854
13855 @item -mdpfp_fast
13856 @opindex mdpfp_fast
13857 Replaced by @option{-mdpfp-fast}.
13858
13859 @item -mdsp_packa
13860 @opindex mdsp_packa
13861 Replaced by @option{-mdsp-packa}.
13862
13863 @item -mEA
13864 @opindex mEA
13865 Replaced by @option{-mea}.
13866
13867 @item -mmac_24
13868 @opindex mmac_24
13869 Replaced by @option{-mmac-24}.
13870
13871 @item -mmac_d16
13872 @opindex mmac_d16
13873 Replaced by @option{-mmac-d16}.
13874
13875 @item -mspfp_compact
13876 @opindex mspfp_compact
13877 Replaced by @option{-mspfp-compact}.
13878
13879 @item -mspfp_fast
13880 @opindex mspfp_fast
13881 Replaced by @option{-mspfp-fast}.
13882
13883 @item -mtune=@var{cpu}
13884 @opindex mtune
13885 Values @samp{arc600}, @samp{arc601}, @samp{arc700} and
13886 @samp{arc700-xmac} for @var{cpu} are replaced by @samp{ARC600},
13887 @samp{ARC601}, @samp{ARC700} and @samp{ARC700-xmac} respectively
13888
13889 @item -multcost=@var{num}
13890 @opindex multcost
13891 Replaced by @option{-mmultcost}.
13892
13893 @end table
13894
13895 @node ARM Options
13896 @subsection ARM Options
13897 @cindex ARM options
13898
13899 These @samp{-m} options are defined for the ARM port:
13900
13901 @table @gcctabopt
13902 @item -mabi=@var{name}
13903 @opindex mabi
13904 Generate code for the specified ABI@. Permissible values are: @samp{apcs-gnu},
13905 @samp{atpcs}, @samp{aapcs}, @samp{aapcs-linux} and @samp{iwmmxt}.
13906
13907 @item -mapcs-frame
13908 @opindex mapcs-frame
13909 Generate a stack frame that is compliant with the ARM Procedure Call
13910 Standard for all functions, even if this is not strictly necessary for
13911 correct execution of the code. Specifying @option{-fomit-frame-pointer}
13912 with this option causes the stack frames not to be generated for
13913 leaf functions. The default is @option{-mno-apcs-frame}.
13914 This option is deprecated.
13915
13916 @item -mapcs
13917 @opindex mapcs
13918 This is a synonym for @option{-mapcs-frame} and is deprecated.
13919
13920 @ignore
13921 @c not currently implemented
13922 @item -mapcs-stack-check
13923 @opindex mapcs-stack-check
13924 Generate code to check the amount of stack space available upon entry to
13925 every function (that actually uses some stack space). If there is
13926 insufficient space available then either the function
13927 @code{__rt_stkovf_split_small} or @code{__rt_stkovf_split_big} is
13928 called, depending upon the amount of stack space required. The runtime
13929 system is required to provide these functions. The default is
13930 @option{-mno-apcs-stack-check}, since this produces smaller code.
13931
13932 @c not currently implemented
13933 @item -mapcs-float
13934 @opindex mapcs-float
13935 Pass floating-point arguments using the floating-point registers. This is
13936 one of the variants of the APCS@. This option is recommended if the
13937 target hardware has a floating-point unit or if a lot of floating-point
13938 arithmetic is going to be performed by the code. The default is
13939 @option{-mno-apcs-float}, since the size of integer-only code is
13940 slightly increased if @option{-mapcs-float} is used.
13941
13942 @c not currently implemented
13943 @item -mapcs-reentrant
13944 @opindex mapcs-reentrant
13945 Generate reentrant, position-independent code. The default is
13946 @option{-mno-apcs-reentrant}.
13947 @end ignore
13948
13949 @item -mthumb-interwork
13950 @opindex mthumb-interwork
13951 Generate code that supports calling between the ARM and Thumb
13952 instruction sets. Without this option, on pre-v5 architectures, the
13953 two instruction sets cannot be reliably used inside one program. The
13954 default is @option{-mno-thumb-interwork}, since slightly larger code
13955 is generated when @option{-mthumb-interwork} is specified. In AAPCS
13956 configurations this option is meaningless.
13957
13958 @item -mno-sched-prolog
13959 @opindex mno-sched-prolog
13960 Prevent the reordering of instructions in the function prologue, or the
13961 merging of those instruction with the instructions in the function's
13962 body. This means that all functions start with a recognizable set
13963 of instructions (or in fact one of a choice from a small set of
13964 different function prologues), and this information can be used to
13965 locate the start of functions inside an executable piece of code. The
13966 default is @option{-msched-prolog}.
13967
13968 @item -mfloat-abi=@var{name}
13969 @opindex mfloat-abi
13970 Specifies which floating-point ABI to use. Permissible values
13971 are: @samp{soft}, @samp{softfp} and @samp{hard}.
13972
13973 Specifying @samp{soft} causes GCC to generate output containing
13974 library calls for floating-point operations.
13975 @samp{softfp} allows the generation of code using hardware floating-point
13976 instructions, but still uses the soft-float calling conventions.
13977 @samp{hard} allows generation of floating-point instructions
13978 and uses FPU-specific calling conventions.
13979
13980 The default depends on the specific target configuration. Note that
13981 the hard-float and soft-float ABIs are not link-compatible; you must
13982 compile your entire program with the same ABI, and link with a
13983 compatible set of libraries.
13984
13985 @item -mlittle-endian
13986 @opindex mlittle-endian
13987 Generate code for a processor running in little-endian mode. This is
13988 the default for all standard configurations.
13989
13990 @item -mbig-endian
13991 @opindex mbig-endian
13992 Generate code for a processor running in big-endian mode; the default is
13993 to compile code for a little-endian processor.
13994
13995 @item -march=@var{name}
13996 @opindex march
13997 This specifies the name of the target ARM architecture. GCC uses this
13998 name to determine what kind of instructions it can emit when generating
13999 assembly code. This option can be used in conjunction with or instead
14000 of the @option{-mcpu=} option. Permissible names are: @samp{armv2},
14001 @samp{armv2a}, @samp{armv3}, @samp{armv3m}, @samp{armv4}, @samp{armv4t},
14002 @samp{armv5}, @samp{armv5t}, @samp{armv5e}, @samp{armv5te},
14003 @samp{armv6}, @samp{armv6j},
14004 @samp{armv6t2}, @samp{armv6z}, @samp{armv6kz}, @samp{armv6-m},
14005 @samp{armv7}, @samp{armv7-a}, @samp{armv7-r}, @samp{armv7-m}, @samp{armv7e-m},
14006 @samp{armv7ve}, @samp{armv8-a}, @samp{armv8-a+crc}, @samp{armv8.1-a},
14007 @samp{armv8.1-a+crc}, @samp{iwmmxt}, @samp{iwmmxt2}, @samp{ep9312}.
14008
14009 Architecture revisions older than @option{armv4t} are deprecated.
14010
14011 @option{-march=armv7ve} is the armv7-a architecture with virtualization
14012 extensions.
14013
14014 @option{-march=armv8-a+crc} enables code generation for the ARMv8-A
14015 architecture together with the optional CRC32 extensions.
14016
14017 @option{-march=native} causes the compiler to auto-detect the architecture
14018 of the build computer. At present, this feature is only supported on
14019 GNU/Linux, and not all architectures are recognized. If the auto-detect
14020 is unsuccessful the option has no effect.
14021
14022 @item -mtune=@var{name}
14023 @opindex mtune
14024 This option specifies the name of the target ARM processor for
14025 which GCC should tune the performance of the code.
14026 For some ARM implementations better performance can be obtained by using
14027 this option.
14028 Permissible names are: @samp{arm2}, @samp{arm250},
14029 @samp{arm3}, @samp{arm6}, @samp{arm60}, @samp{arm600}, @samp{arm610},
14030 @samp{arm620}, @samp{arm7}, @samp{arm7m}, @samp{arm7d}, @samp{arm7dm},
14031 @samp{arm7di}, @samp{arm7dmi}, @samp{arm70}, @samp{arm700},
14032 @samp{arm700i}, @samp{arm710}, @samp{arm710c}, @samp{arm7100},
14033 @samp{arm720},
14034 @samp{arm7500}, @samp{arm7500fe}, @samp{arm7tdmi}, @samp{arm7tdmi-s},
14035 @samp{arm710t}, @samp{arm720t}, @samp{arm740t},
14036 @samp{strongarm}, @samp{strongarm110}, @samp{strongarm1100},
14037 @samp{strongarm1110},
14038 @samp{arm8}, @samp{arm810}, @samp{arm9}, @samp{arm9e}, @samp{arm920},
14039 @samp{arm920t}, @samp{arm922t}, @samp{arm946e-s}, @samp{arm966e-s},
14040 @samp{arm968e-s}, @samp{arm926ej-s}, @samp{arm940t}, @samp{arm9tdmi},
14041 @samp{arm10tdmi}, @samp{arm1020t}, @samp{arm1026ej-s},
14042 @samp{arm10e}, @samp{arm1020e}, @samp{arm1022e},
14043 @samp{arm1136j-s}, @samp{arm1136jf-s}, @samp{mpcore}, @samp{mpcorenovfp},
14044 @samp{arm1156t2-s}, @samp{arm1156t2f-s}, @samp{arm1176jz-s}, @samp{arm1176jzf-s},
14045 @samp{generic-armv7-a}, @samp{cortex-a5}, @samp{cortex-a7}, @samp{cortex-a8},
14046 @samp{cortex-a9}, @samp{cortex-a12}, @samp{cortex-a15}, @samp{cortex-a17},
14047 @samp{cortex-a32}, @samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a57},
14048 @samp{cortex-a72}, @samp{cortex-r4},
14049 @samp{cortex-r4f}, @samp{cortex-r5}, @samp{cortex-r7}, @samp{cortex-r8},
14050 @samp{cortex-m7},
14051 @samp{cortex-m4},
14052 @samp{cortex-m3},
14053 @samp{cortex-m1},
14054 @samp{cortex-m0},
14055 @samp{cortex-m0plus},
14056 @samp{cortex-m1.small-multiply},
14057 @samp{cortex-m0.small-multiply},
14058 @samp{cortex-m0plus.small-multiply},
14059 @samp{exynos-m1},
14060 @samp{qdf24xx},
14061 @samp{marvell-pj4},
14062 @samp{xscale}, @samp{iwmmxt}, @samp{iwmmxt2}, @samp{ep9312},
14063 @samp{fa526}, @samp{fa626},
14064 @samp{fa606te}, @samp{fa626te}, @samp{fmp626}, @samp{fa726te},
14065 @samp{xgene1}.
14066
14067 Additionally, this option can specify that GCC should tune the performance
14068 of the code for a big.LITTLE system. Permissible names are:
14069 @samp{cortex-a15.cortex-a7}, @samp{cortex-a17.cortex-a7},
14070 @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53}.
14071
14072 @option{-mtune=generic-@var{arch}} specifies that GCC should tune the
14073 performance for a blend of processors within architecture @var{arch}.
14074 The aim is to generate code that run well on the current most popular
14075 processors, balancing between optimizations that benefit some CPUs in the
14076 range, and avoiding performance pitfalls of other CPUs. The effects of
14077 this option may change in future GCC versions as CPU models come and go.
14078
14079 @option{-mtune=native} causes the compiler to auto-detect the CPU
14080 of the build computer. At present, this feature is only supported on
14081 GNU/Linux, and not all architectures are recognized. If the auto-detect is
14082 unsuccessful the option has no effect.
14083
14084 @item -mcpu=@var{name}
14085 @opindex mcpu
14086 This specifies the name of the target ARM processor. GCC uses this name
14087 to derive the name of the target ARM architecture (as if specified
14088 by @option{-march}) and the ARM processor type for which to tune for
14089 performance (as if specified by @option{-mtune}). Where this option
14090 is used in conjunction with @option{-march} or @option{-mtune},
14091 those options take precedence over the appropriate part of this option.
14092
14093 Permissible names for this option are the same as those for
14094 @option{-mtune}.
14095
14096 @option{-mcpu=generic-@var{arch}} is also permissible, and is
14097 equivalent to @option{-march=@var{arch} -mtune=generic-@var{arch}}.
14098 See @option{-mtune} for more information.
14099
14100 @option{-mcpu=native} causes the compiler to auto-detect the CPU
14101 of the build computer. At present, this feature is only supported on
14102 GNU/Linux, and not all architectures are recognized. If the auto-detect
14103 is unsuccessful the option has no effect.
14104
14105 @item -mfpu=@var{name}
14106 @opindex mfpu
14107 This specifies what floating-point hardware (or hardware emulation) is
14108 available on the target. Permissible names are: @samp{vfp}, @samp{vfpv3},
14109 @samp{vfpv3-fp16}, @samp{vfpv3-d16}, @samp{vfpv3-d16-fp16}, @samp{vfpv3xd},
14110 @samp{vfpv3xd-fp16}, @samp{neon}, @samp{neon-fp16}, @samp{vfpv4},
14111 @samp{vfpv4-d16}, @samp{fpv4-sp-d16}, @samp{neon-vfpv4},
14112 @samp{fpv5-d16}, @samp{fpv5-sp-d16},
14113 @samp{fp-armv8}, @samp{neon-fp-armv8} and @samp{crypto-neon-fp-armv8}.
14114
14115 If @option{-msoft-float} is specified this specifies the format of
14116 floating-point values.
14117
14118 If the selected floating-point hardware includes the NEON extension
14119 (e.g. @option{-mfpu}=@samp{neon}), note that floating-point
14120 operations are not generated by GCC's auto-vectorization pass unless
14121 @option{-funsafe-math-optimizations} is also specified. This is
14122 because NEON hardware does not fully implement the IEEE 754 standard for
14123 floating-point arithmetic (in particular denormal values are treated as
14124 zero), so the use of NEON instructions may lead to a loss of precision.
14125
14126 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}).
14127
14128 @item -mfp16-format=@var{name}
14129 @opindex mfp16-format
14130 Specify the format of the @code{__fp16} half-precision floating-point type.
14131 Permissible names are @samp{none}, @samp{ieee}, and @samp{alternative};
14132 the default is @samp{none}, in which case the @code{__fp16} type is not
14133 defined. @xref{Half-Precision}, for more information.
14134
14135 @item -mstructure-size-boundary=@var{n}
14136 @opindex mstructure-size-boundary
14137 The sizes of all structures and unions are rounded up to a multiple
14138 of the number of bits set by this option. Permissible values are 8, 32
14139 and 64. The default value varies for different toolchains. For the COFF
14140 targeted toolchain the default value is 8. A value of 64 is only allowed
14141 if the underlying ABI supports it.
14142
14143 Specifying a larger number can produce faster, more efficient code, but
14144 can also increase the size of the program. Different values are potentially
14145 incompatible. Code compiled with one value cannot necessarily expect to
14146 work with code or libraries compiled with another value, if they exchange
14147 information using structures or unions.
14148
14149 @item -mabort-on-noreturn
14150 @opindex mabort-on-noreturn
14151 Generate a call to the function @code{abort} at the end of a
14152 @code{noreturn} function. It is executed if the function tries to
14153 return.
14154
14155 @item -mlong-calls
14156 @itemx -mno-long-calls
14157 @opindex mlong-calls
14158 @opindex mno-long-calls
14159 Tells the compiler to perform function calls by first loading the
14160 address of the function into a register and then performing a subroutine
14161 call on this register. This switch is needed if the target function
14162 lies outside of the 64-megabyte addressing range of the offset-based
14163 version of subroutine call instruction.
14164
14165 Even if this switch is enabled, not all function calls are turned
14166 into long calls. The heuristic is that static functions, functions
14167 that have the @code{short_call} attribute, functions that are inside
14168 the scope of a @code{#pragma no_long_calls} directive, and functions whose
14169 definitions have already been compiled within the current compilation
14170 unit are not turned into long calls. The exceptions to this rule are
14171 that weak function definitions, functions with the @code{long_call}
14172 attribute or the @code{section} attribute, and functions that are within
14173 the scope of a @code{#pragma long_calls} directive are always
14174 turned into long calls.
14175
14176 This feature is not enabled by default. Specifying
14177 @option{-mno-long-calls} restores the default behavior, as does
14178 placing the function calls within the scope of a @code{#pragma
14179 long_calls_off} directive. Note these switches have no effect on how
14180 the compiler generates code to handle function calls via function
14181 pointers.
14182
14183 @item -msingle-pic-base
14184 @opindex msingle-pic-base
14185 Treat the register used for PIC addressing as read-only, rather than
14186 loading it in the prologue for each function. The runtime system is
14187 responsible for initializing this register with an appropriate value
14188 before execution begins.
14189
14190 @item -mpic-register=@var{reg}
14191 @opindex mpic-register
14192 Specify the register to be used for PIC addressing.
14193 For standard PIC base case, the default is any suitable register
14194 determined by compiler. For single PIC base case, the default is
14195 @samp{R9} if target is EABI based or stack-checking is enabled,
14196 otherwise the default is @samp{R10}.
14197
14198 @item -mpic-data-is-text-relative
14199 @opindex mpic-data-is-text-relative
14200 Assume that each data segments are relative to text segment at load time.
14201 Therefore, it permits addressing data using PC-relative operations.
14202 This option is on by default for targets other than VxWorks RTP.
14203
14204 @item -mpoke-function-name
14205 @opindex mpoke-function-name
14206 Write the name of each function into the text section, directly
14207 preceding the function prologue. The generated code is similar to this:
14208
14209 @smallexample
14210 t0
14211 .ascii "arm_poke_function_name", 0
14212 .align
14213 t1
14214 .word 0xff000000 + (t1 - t0)
14215 arm_poke_function_name
14216 mov ip, sp
14217 stmfd sp!, @{fp, ip, lr, pc@}
14218 sub fp, ip, #4
14219 @end smallexample
14220
14221 When performing a stack backtrace, code can inspect the value of
14222 @code{pc} stored at @code{fp + 0}. If the trace function then looks at
14223 location @code{pc - 12} and the top 8 bits are set, then we know that
14224 there is a function name embedded immediately preceding this location
14225 and has length @code{((pc[-3]) & 0xff000000)}.
14226
14227 @item -mthumb
14228 @itemx -marm
14229 @opindex marm
14230 @opindex mthumb
14231
14232 Select between generating code that executes in ARM and Thumb
14233 states. The default for most configurations is to generate code
14234 that executes in ARM state, but the default can be changed by
14235 configuring GCC with the @option{--with-mode=}@var{state}
14236 configure option.
14237
14238 You can also override the ARM and Thumb mode for each function
14239 by using the @code{target("thumb")} and @code{target("arm")} function attributes
14240 (@pxref{ARM Function Attributes}) or pragmas (@pxref{Function Specific Option Pragmas}).
14241
14242 @item -mtpcs-frame
14243 @opindex mtpcs-frame
14244 Generate a stack frame that is compliant with the Thumb Procedure Call
14245 Standard for all non-leaf functions. (A leaf function is one that does
14246 not call any other functions.) The default is @option{-mno-tpcs-frame}.
14247
14248 @item -mtpcs-leaf-frame
14249 @opindex mtpcs-leaf-frame
14250 Generate a stack frame that is compliant with the Thumb Procedure Call
14251 Standard for all leaf functions. (A leaf function is one that does
14252 not call any other functions.) The default is @option{-mno-apcs-leaf-frame}.
14253
14254 @item -mcallee-super-interworking
14255 @opindex mcallee-super-interworking
14256 Gives all externally visible functions in the file being compiled an ARM
14257 instruction set header which switches to Thumb mode before executing the
14258 rest of the function. This allows these functions to be called from
14259 non-interworking code. This option is not valid in AAPCS configurations
14260 because interworking is enabled by default.
14261
14262 @item -mcaller-super-interworking
14263 @opindex mcaller-super-interworking
14264 Allows calls via function pointers (including virtual functions) to
14265 execute correctly regardless of whether the target code has been
14266 compiled for interworking or not. There is a small overhead in the cost
14267 of executing a function pointer if this option is enabled. This option
14268 is not valid in AAPCS configurations because interworking is enabled
14269 by default.
14270
14271 @item -mtp=@var{name}
14272 @opindex mtp
14273 Specify the access model for the thread local storage pointer. The valid
14274 models are @samp{soft}, which generates calls to @code{__aeabi_read_tp},
14275 @samp{cp15}, which fetches the thread pointer from @code{cp15} directly
14276 (supported in the arm6k architecture), and @samp{auto}, which uses the
14277 best available method for the selected processor. The default setting is
14278 @samp{auto}.
14279
14280 @item -mtls-dialect=@var{dialect}
14281 @opindex mtls-dialect
14282 Specify the dialect to use for accessing thread local storage. Two
14283 @var{dialect}s are supported---@samp{gnu} and @samp{gnu2}. The
14284 @samp{gnu} dialect selects the original GNU scheme for supporting
14285 local and global dynamic TLS models. The @samp{gnu2} dialect
14286 selects the GNU descriptor scheme, which provides better performance
14287 for shared libraries. The GNU descriptor scheme is compatible with
14288 the original scheme, but does require new assembler, linker and
14289 library support. Initial and local exec TLS models are unaffected by
14290 this option and always use the original scheme.
14291
14292 @item -mword-relocations
14293 @opindex mword-relocations
14294 Only generate absolute relocations on word-sized values (i.e. R_ARM_ABS32).
14295 This is enabled by default on targets (uClinux, SymbianOS) where the runtime
14296 loader imposes this restriction, and when @option{-fpic} or @option{-fPIC}
14297 is specified.
14298
14299 @item -mfix-cortex-m3-ldrd
14300 @opindex mfix-cortex-m3-ldrd
14301 Some Cortex-M3 cores can cause data corruption when @code{ldrd} instructions
14302 with overlapping destination and base registers are used. This option avoids
14303 generating these instructions. This option is enabled by default when
14304 @option{-mcpu=cortex-m3} is specified.
14305
14306 @item -munaligned-access
14307 @itemx -mno-unaligned-access
14308 @opindex munaligned-access
14309 @opindex mno-unaligned-access
14310 Enables (or disables) reading and writing of 16- and 32- bit values
14311 from addresses that are not 16- or 32- bit aligned. By default
14312 unaligned access is disabled for all pre-ARMv6 and all ARMv6-M
14313 architectures, and enabled for all other architectures. If unaligned
14314 access is not enabled then words in packed data structures are
14315 accessed a byte at a time.
14316
14317 The ARM attribute @code{Tag_CPU_unaligned_access} is set in the
14318 generated object file to either true or false, depending upon the
14319 setting of this option. If unaligned access is enabled then the
14320 preprocessor symbol @code{__ARM_FEATURE_UNALIGNED} is also
14321 defined.
14322
14323 @item -mneon-for-64bits
14324 @opindex mneon-for-64bits
14325 Enables using Neon to handle scalar 64-bits operations. This is
14326 disabled by default since the cost of moving data from core registers
14327 to Neon is high.
14328
14329 @item -mslow-flash-data
14330 @opindex mslow-flash-data
14331 Assume loading data from flash is slower than fetching instruction.
14332 Therefore literal load is minimized for better performance.
14333 This option is only supported when compiling for ARMv7 M-profile and
14334 off by default.
14335
14336 @item -masm-syntax-unified
14337 @opindex masm-syntax-unified
14338 Assume inline assembler is using unified asm syntax. The default is
14339 currently off which implies divided syntax. This option has no impact
14340 on Thumb2. However, this may change in future releases of GCC.
14341 Divided syntax should be considered deprecated.
14342
14343 @item -mrestrict-it
14344 @opindex mrestrict-it
14345 Restricts generation of IT blocks to conform to the rules of ARMv8.
14346 IT blocks can only contain a single 16-bit instruction from a select
14347 set of instructions. This option is on by default for ARMv8 Thumb mode.
14348
14349 @item -mprint-tune-info
14350 @opindex mprint-tune-info
14351 Print CPU tuning information as comment in assembler file. This is
14352 an option used only for regression testing of the compiler and not
14353 intended for ordinary use in compiling code. This option is disabled
14354 by default.
14355 @end table
14356
14357 @node AVR Options
14358 @subsection AVR Options
14359 @cindex AVR Options
14360
14361 These options are defined for AVR implementations:
14362
14363 @table @gcctabopt
14364 @item -mmcu=@var{mcu}
14365 @opindex mmcu
14366 Specify Atmel AVR instruction set architectures (ISA) or MCU type.
14367
14368 The default for this option is@tie{}@samp{avr2}.
14369
14370 GCC supports the following AVR devices and ISAs:
14371
14372 @include avr-mmcu.texi
14373
14374 @item -maccumulate-args
14375 @opindex maccumulate-args
14376 Accumulate outgoing function arguments and acquire/release the needed
14377 stack space for outgoing function arguments once in function
14378 prologue/epilogue. Without this option, outgoing arguments are pushed
14379 before calling a function and popped afterwards.
14380
14381 Popping the arguments after the function call can be expensive on
14382 AVR so that accumulating the stack space might lead to smaller
14383 executables because arguments need not to be removed from the
14384 stack after such a function call.
14385
14386 This option can lead to reduced code size for functions that perform
14387 several calls to functions that get their arguments on the stack like
14388 calls to printf-like functions.
14389
14390 @item -mbranch-cost=@var{cost}
14391 @opindex mbranch-cost
14392 Set the branch costs for conditional branch instructions to
14393 @var{cost}. Reasonable values for @var{cost} are small, non-negative
14394 integers. The default branch cost is 0.
14395
14396 @item -mcall-prologues
14397 @opindex mcall-prologues
14398 Functions prologues/epilogues are expanded as calls to appropriate
14399 subroutines. Code size is smaller.
14400
14401 @item -mint8
14402 @opindex mint8
14403 Assume @code{int} to be 8-bit integer. This affects the sizes of all types: a
14404 @code{char} is 1 byte, an @code{int} is 1 byte, a @code{long} is 2 bytes,
14405 and @code{long long} is 4 bytes. Please note that this option does not
14406 conform to the C standards, but it results in smaller code
14407 size.
14408
14409 @item -mn-flash=@var{num}
14410 @opindex mn-flash
14411 Assume that the flash memory has a size of
14412 @var{num} times 64@tie{}KiB.
14413
14414 @item -mno-interrupts
14415 @opindex mno-interrupts
14416 Generated code is not compatible with hardware interrupts.
14417 Code size is smaller.
14418
14419 @item -mrelax
14420 @opindex mrelax
14421 Try to replace @code{CALL} resp.@: @code{JMP} instruction by the shorter
14422 @code{RCALL} resp.@: @code{RJMP} instruction if applicable.
14423 Setting @option{-mrelax} just adds the @option{--mlink-relax} option to
14424 the assembler's command line and the @option{--relax} option to the
14425 linker's command line.
14426
14427 Jump relaxing is performed by the linker because jump offsets are not
14428 known before code is located. Therefore, the assembler code generated by the
14429 compiler is the same, but the instructions in the executable may
14430 differ from instructions in the assembler code.
14431
14432 Relaxing must be turned on if linker stubs are needed, see the
14433 section on @code{EIND} and linker stubs below.
14434
14435 @item -mrmw
14436 @opindex mrmw
14437 Assume that the device supports the Read-Modify-Write
14438 instructions @code{XCH}, @code{LAC}, @code{LAS} and @code{LAT}.
14439
14440 @item -msp8
14441 @opindex msp8
14442 Treat the stack pointer register as an 8-bit register,
14443 i.e.@: assume the high byte of the stack pointer is zero.
14444 In general, you don't need to set this option by hand.
14445
14446 This option is used internally by the compiler to select and
14447 build multilibs for architectures @code{avr2} and @code{avr25}.
14448 These architectures mix devices with and without @code{SPH}.
14449 For any setting other than @option{-mmcu=avr2} or @option{-mmcu=avr25}
14450 the compiler driver adds or removes this option from the compiler
14451 proper's command line, because the compiler then knows if the device
14452 or architecture has an 8-bit stack pointer and thus no @code{SPH}
14453 register or not.
14454
14455 @item -mstrict-X
14456 @opindex mstrict-X
14457 Use address register @code{X} in a way proposed by the hardware. This means
14458 that @code{X} is only used in indirect, post-increment or
14459 pre-decrement addressing.
14460
14461 Without this option, the @code{X} register may be used in the same way
14462 as @code{Y} or @code{Z} which then is emulated by additional
14463 instructions.
14464 For example, loading a value with @code{X+const} addressing with a
14465 small non-negative @code{const < 64} to a register @var{Rn} is
14466 performed as
14467
14468 @example
14469 adiw r26, const ; X += const
14470 ld @var{Rn}, X ; @var{Rn} = *X
14471 sbiw r26, const ; X -= const
14472 @end example
14473
14474 @item -mtiny-stack
14475 @opindex mtiny-stack
14476 Only change the lower 8@tie{}bits of the stack pointer.
14477
14478 @item -nodevicelib
14479 @opindex nodevicelib
14480 Don't link against AVR-LibC's device specific library @code{libdev.a}.
14481
14482 @item -Waddr-space-convert
14483 @opindex Waddr-space-convert
14484 Warn about conversions between address spaces in the case where the
14485 resulting address space is not contained in the incoming address space.
14486 @end table
14487
14488 @subsubsection @code{EIND} and Devices with More Than 128 Ki Bytes of Flash
14489 @cindex @code{EIND}
14490 Pointers in the implementation are 16@tie{}bits wide.
14491 The address of a function or label is represented as word address so
14492 that indirect jumps and calls can target any code address in the
14493 range of 64@tie{}Ki words.
14494
14495 In order to facilitate indirect jump on devices with more than 128@tie{}Ki
14496 bytes of program memory space, there is a special function register called
14497 @code{EIND} that serves as most significant part of the target address
14498 when @code{EICALL} or @code{EIJMP} instructions are used.
14499
14500 Indirect jumps and calls on these devices are handled as follows by
14501 the compiler and are subject to some limitations:
14502
14503 @itemize @bullet
14504
14505 @item
14506 The compiler never sets @code{EIND}.
14507
14508 @item
14509 The compiler uses @code{EIND} implicitly in @code{EICALL}/@code{EIJMP}
14510 instructions or might read @code{EIND} directly in order to emulate an
14511 indirect call/jump by means of a @code{RET} instruction.
14512
14513 @item
14514 The compiler assumes that @code{EIND} never changes during the startup
14515 code or during the application. In particular, @code{EIND} is not
14516 saved/restored in function or interrupt service routine
14517 prologue/epilogue.
14518
14519 @item
14520 For indirect calls to functions and computed goto, the linker
14521 generates @emph{stubs}. Stubs are jump pads sometimes also called
14522 @emph{trampolines}. Thus, the indirect call/jump jumps to such a stub.
14523 The stub contains a direct jump to the desired address.
14524
14525 @item
14526 Linker relaxation must be turned on so that the linker generates
14527 the stubs correctly in all situations. See the compiler option
14528 @option{-mrelax} and the linker option @option{--relax}.
14529 There are corner cases where the linker is supposed to generate stubs
14530 but aborts without relaxation and without a helpful error message.
14531
14532 @item
14533 The default linker script is arranged for code with @code{EIND = 0}.
14534 If code is supposed to work for a setup with @code{EIND != 0}, a custom
14535 linker script has to be used in order to place the sections whose
14536 name start with @code{.trampolines} into the segment where @code{EIND}
14537 points to.
14538
14539 @item
14540 The startup code from libgcc never sets @code{EIND}.
14541 Notice that startup code is a blend of code from libgcc and AVR-LibC.
14542 For the impact of AVR-LibC on @code{EIND}, see the
14543 @w{@uref{http://nongnu.org/avr-libc/user-manual/,AVR-LibC user manual}}.
14544
14545 @item
14546 It is legitimate for user-specific startup code to set up @code{EIND}
14547 early, for example by means of initialization code located in
14548 section @code{.init3}. Such code runs prior to general startup code
14549 that initializes RAM and calls constructors, but after the bit
14550 of startup code from AVR-LibC that sets @code{EIND} to the segment
14551 where the vector table is located.
14552 @example
14553 #include <avr/io.h>
14554
14555 static void
14556 __attribute__((section(".init3"),naked,used,no_instrument_function))
14557 init3_set_eind (void)
14558 @{
14559 __asm volatile ("ldi r24,pm_hh8(__trampolines_start)\n\t"
14560 "out %i0,r24" :: "n" (&EIND) : "r24","memory");
14561 @}
14562 @end example
14563
14564 @noindent
14565 The @code{__trampolines_start} symbol is defined in the linker script.
14566
14567 @item
14568 Stubs are generated automatically by the linker if
14569 the following two conditions are met:
14570 @itemize @minus
14571
14572 @item The address of a label is taken by means of the @code{gs} modifier
14573 (short for @emph{generate stubs}) like so:
14574 @example
14575 LDI r24, lo8(gs(@var{func}))
14576 LDI r25, hi8(gs(@var{func}))
14577 @end example
14578 @item The final location of that label is in a code segment
14579 @emph{outside} the segment where the stubs are located.
14580 @end itemize
14581
14582 @item
14583 The compiler emits such @code{gs} modifiers for code labels in the
14584 following situations:
14585 @itemize @minus
14586 @item Taking address of a function or code label.
14587 @item Computed goto.
14588 @item If prologue-save function is used, see @option{-mcall-prologues}
14589 command-line option.
14590 @item Switch/case dispatch tables. If you do not want such dispatch
14591 tables you can specify the @option{-fno-jump-tables} command-line option.
14592 @item C and C++ constructors/destructors called during startup/shutdown.
14593 @item If the tools hit a @code{gs()} modifier explained above.
14594 @end itemize
14595
14596 @item
14597 Jumping to non-symbolic addresses like so is @emph{not} supported:
14598
14599 @example
14600 int main (void)
14601 @{
14602 /* Call function at word address 0x2 */
14603 return ((int(*)(void)) 0x2)();
14604 @}
14605 @end example
14606
14607 Instead, a stub has to be set up, i.e.@: the function has to be called
14608 through a symbol (@code{func_4} in the example):
14609
14610 @example
14611 int main (void)
14612 @{
14613 extern int func_4 (void);
14614
14615 /* Call function at byte address 0x4 */
14616 return func_4();
14617 @}
14618 @end example
14619
14620 and the application be linked with @option{-Wl,--defsym,func_4=0x4}.
14621 Alternatively, @code{func_4} can be defined in the linker script.
14622 @end itemize
14623
14624 @subsubsection Handling of the @code{RAMPD}, @code{RAMPX}, @code{RAMPY} and @code{RAMPZ} Special Function Registers
14625 @cindex @code{RAMPD}
14626 @cindex @code{RAMPX}
14627 @cindex @code{RAMPY}
14628 @cindex @code{RAMPZ}
14629 Some AVR devices support memories larger than the 64@tie{}KiB range
14630 that can be accessed with 16-bit pointers. To access memory locations
14631 outside this 64@tie{}KiB range, the contentent of a @code{RAMP}
14632 register is used as high part of the address:
14633 The @code{X}, @code{Y}, @code{Z} address register is concatenated
14634 with the @code{RAMPX}, @code{RAMPY}, @code{RAMPZ} special function
14635 register, respectively, to get a wide address. Similarly,
14636 @code{RAMPD} is used together with direct addressing.
14637
14638 @itemize
14639 @item
14640 The startup code initializes the @code{RAMP} special function
14641 registers with zero.
14642
14643 @item
14644 If a @ref{AVR Named Address Spaces,named address space} other than
14645 generic or @code{__flash} is used, then @code{RAMPZ} is set
14646 as needed before the operation.
14647
14648 @item
14649 If the device supports RAM larger than 64@tie{}KiB and the compiler
14650 needs to change @code{RAMPZ} to accomplish an operation, @code{RAMPZ}
14651 is reset to zero after the operation.
14652
14653 @item
14654 If the device comes with a specific @code{RAMP} register, the ISR
14655 prologue/epilogue saves/restores that SFR and initializes it with
14656 zero in case the ISR code might (implicitly) use it.
14657
14658 @item
14659 RAM larger than 64@tie{}KiB is not supported by GCC for AVR targets.
14660 If you use inline assembler to read from locations outside the
14661 16-bit address range and change one of the @code{RAMP} registers,
14662 you must reset it to zero after the access.
14663
14664 @end itemize
14665
14666 @subsubsection AVR Built-in Macros
14667
14668 GCC defines several built-in macros so that the user code can test
14669 for the presence or absence of features. Almost any of the following
14670 built-in macros are deduced from device capabilities and thus
14671 triggered by the @option{-mmcu=} command-line option.
14672
14673 For even more AVR-specific built-in macros see
14674 @ref{AVR Named Address Spaces} and @ref{AVR Built-in Functions}.
14675
14676 @table @code
14677
14678 @item __AVR_ARCH__
14679 Build-in macro that resolves to a decimal number that identifies the
14680 architecture and depends on the @option{-mmcu=@var{mcu}} option.
14681 Possible values are:
14682
14683 @code{2}, @code{25}, @code{3}, @code{31}, @code{35},
14684 @code{4}, @code{5}, @code{51}, @code{6}
14685
14686 for @var{mcu}=@code{avr2}, @code{avr25}, @code{avr3}, @code{avr31},
14687 @code{avr35}, @code{avr4}, @code{avr5}, @code{avr51}, @code{avr6},
14688
14689 respectively and
14690
14691 @code{100}, @code{102}, @code{104},
14692 @code{105}, @code{106}, @code{107}
14693
14694 for @var{mcu}=@code{avrtiny}, @code{avrxmega2}, @code{avrxmega4},
14695 @code{avrxmega5}, @code{avrxmega6}, @code{avrxmega7}, respectively.
14696 If @var{mcu} specifies a device, this built-in macro is set
14697 accordingly. For example, with @option{-mmcu=atmega8} the macro is
14698 defined to @code{4}.
14699
14700 @item __AVR_@var{Device}__
14701 Setting @option{-mmcu=@var{device}} defines this built-in macro which reflects
14702 the device's name. For example, @option{-mmcu=atmega8} defines the
14703 built-in macro @code{__AVR_ATmega8__}, @option{-mmcu=attiny261a} defines
14704 @code{__AVR_ATtiny261A__}, etc.
14705
14706 The built-in macros' names follow
14707 the scheme @code{__AVR_@var{Device}__} where @var{Device} is
14708 the device name as from the AVR user manual. The difference between
14709 @var{Device} in the built-in macro and @var{device} in
14710 @option{-mmcu=@var{device}} is that the latter is always lowercase.
14711
14712 If @var{device} is not a device but only a core architecture like
14713 @samp{avr51}, this macro is not defined.
14714
14715 @item __AVR_DEVICE_NAME__
14716 Setting @option{-mmcu=@var{device}} defines this built-in macro to
14717 the device's name. For example, with @option{-mmcu=atmega8} the macro
14718 is defined to @code{atmega8}.
14719
14720 If @var{device} is not a device but only a core architecture like
14721 @samp{avr51}, this macro is not defined.
14722
14723 @item __AVR_XMEGA__
14724 The device / architecture belongs to the XMEGA family of devices.
14725
14726 @item __AVR_HAVE_ELPM__
14727 The device has the @code{ELPM} instruction.
14728
14729 @item __AVR_HAVE_ELPMX__
14730 The device has the @code{ELPM R@var{n},Z} and @code{ELPM
14731 R@var{n},Z+} instructions.
14732
14733 @item __AVR_HAVE_MOVW__
14734 The device has the @code{MOVW} instruction to perform 16-bit
14735 register-register moves.
14736
14737 @item __AVR_HAVE_LPMX__
14738 The device has the @code{LPM R@var{n},Z} and
14739 @code{LPM R@var{n},Z+} instructions.
14740
14741 @item __AVR_HAVE_MUL__
14742 The device has a hardware multiplier.
14743
14744 @item __AVR_HAVE_JMP_CALL__
14745 The device has the @code{JMP} and @code{CALL} instructions.
14746 This is the case for devices with at least 16@tie{}KiB of program
14747 memory.
14748
14749 @item __AVR_HAVE_EIJMP_EICALL__
14750 @itemx __AVR_3_BYTE_PC__
14751 The device has the @code{EIJMP} and @code{EICALL} instructions.
14752 This is the case for devices with more than 128@tie{}KiB of program memory.
14753 This also means that the program counter
14754 (PC) is 3@tie{}bytes wide.
14755
14756 @item __AVR_2_BYTE_PC__
14757 The program counter (PC) is 2@tie{}bytes wide. This is the case for devices
14758 with up to 128@tie{}KiB of program memory.
14759
14760 @item __AVR_HAVE_8BIT_SP__
14761 @itemx __AVR_HAVE_16BIT_SP__
14762 The stack pointer (SP) register is treated as 8-bit respectively
14763 16-bit register by the compiler.
14764 The definition of these macros is affected by @option{-mtiny-stack}.
14765
14766 @item __AVR_HAVE_SPH__
14767 @itemx __AVR_SP8__
14768 The device has the SPH (high part of stack pointer) special function
14769 register or has an 8-bit stack pointer, respectively.
14770 The definition of these macros is affected by @option{-mmcu=} and
14771 in the cases of @option{-mmcu=avr2} and @option{-mmcu=avr25} also
14772 by @option{-msp8}.
14773
14774 @item __AVR_HAVE_RAMPD__
14775 @itemx __AVR_HAVE_RAMPX__
14776 @itemx __AVR_HAVE_RAMPY__
14777 @itemx __AVR_HAVE_RAMPZ__
14778 The device has the @code{RAMPD}, @code{RAMPX}, @code{RAMPY},
14779 @code{RAMPZ} special function register, respectively.
14780
14781 @item __NO_INTERRUPTS__
14782 This macro reflects the @option{-mno-interrupts} command-line option.
14783
14784 @item __AVR_ERRATA_SKIP__
14785 @itemx __AVR_ERRATA_SKIP_JMP_CALL__
14786 Some AVR devices (AT90S8515, ATmega103) must not skip 32-bit
14787 instructions because of a hardware erratum. Skip instructions are
14788 @code{SBRS}, @code{SBRC}, @code{SBIS}, @code{SBIC} and @code{CPSE}.
14789 The second macro is only defined if @code{__AVR_HAVE_JMP_CALL__} is also
14790 set.
14791
14792 @item __AVR_ISA_RMW__
14793 The device has Read-Modify-Write instructions (XCH, LAC, LAS and LAT).
14794
14795 @item __AVR_SFR_OFFSET__=@var{offset}
14796 Instructions that can address I/O special function registers directly
14797 like @code{IN}, @code{OUT}, @code{SBI}, etc.@: may use a different
14798 address as if addressed by an instruction to access RAM like @code{LD}
14799 or @code{STS}. This offset depends on the device architecture and has
14800 to be subtracted from the RAM address in order to get the
14801 respective I/O@tie{}address.
14802
14803 @item __WITH_AVRLIBC__
14804 The compiler is configured to be used together with AVR-Libc.
14805 See the @option{--with-avrlibc} configure option.
14806
14807 @end table
14808
14809 @node Blackfin Options
14810 @subsection Blackfin Options
14811 @cindex Blackfin Options
14812
14813 @table @gcctabopt
14814 @item -mcpu=@var{cpu}@r{[}-@var{sirevision}@r{]}
14815 @opindex mcpu=
14816 Specifies the name of the target Blackfin processor. Currently, @var{cpu}
14817 can be one of @samp{bf512}, @samp{bf514}, @samp{bf516}, @samp{bf518},
14818 @samp{bf522}, @samp{bf523}, @samp{bf524}, @samp{bf525}, @samp{bf526},
14819 @samp{bf527}, @samp{bf531}, @samp{bf532}, @samp{bf533},
14820 @samp{bf534}, @samp{bf536}, @samp{bf537}, @samp{bf538}, @samp{bf539},
14821 @samp{bf542}, @samp{bf544}, @samp{bf547}, @samp{bf548}, @samp{bf549},
14822 @samp{bf542m}, @samp{bf544m}, @samp{bf547m}, @samp{bf548m}, @samp{bf549m},
14823 @samp{bf561}, @samp{bf592}.
14824
14825 The optional @var{sirevision} specifies the silicon revision of the target
14826 Blackfin processor. Any workarounds available for the targeted silicon revision
14827 are enabled. If @var{sirevision} is @samp{none}, no workarounds are enabled.
14828 If @var{sirevision} is @samp{any}, all workarounds for the targeted processor
14829 are enabled. The @code{__SILICON_REVISION__} macro is defined to two
14830 hexadecimal digits representing the major and minor numbers in the silicon
14831 revision. If @var{sirevision} is @samp{none}, the @code{__SILICON_REVISION__}
14832 is not defined. If @var{sirevision} is @samp{any}, the
14833 @code{__SILICON_REVISION__} is defined to be @code{0xffff}.
14834 If this optional @var{sirevision} is not used, GCC assumes the latest known
14835 silicon revision of the targeted Blackfin processor.
14836
14837 GCC defines a preprocessor macro for the specified @var{cpu}.
14838 For the @samp{bfin-elf} toolchain, this option causes the hardware BSP
14839 provided by libgloss to be linked in if @option{-msim} is not given.
14840
14841 Without this option, @samp{bf532} is used as the processor by default.
14842
14843 Note that support for @samp{bf561} is incomplete. For @samp{bf561},
14844 only the preprocessor macro is defined.
14845
14846 @item -msim
14847 @opindex msim
14848 Specifies that the program will be run on the simulator. This causes
14849 the simulator BSP provided by libgloss to be linked in. This option
14850 has effect only for @samp{bfin-elf} toolchain.
14851 Certain other options, such as @option{-mid-shared-library} and
14852 @option{-mfdpic}, imply @option{-msim}.
14853
14854 @item -momit-leaf-frame-pointer
14855 @opindex momit-leaf-frame-pointer
14856 Don't keep the frame pointer in a register for leaf functions. This
14857 avoids the instructions to save, set up and restore frame pointers and
14858 makes an extra register available in leaf functions. The option
14859 @option{-fomit-frame-pointer} removes the frame pointer for all functions,
14860 which might make debugging harder.
14861
14862 @item -mspecld-anomaly
14863 @opindex mspecld-anomaly
14864 When enabled, the compiler ensures that the generated code does not
14865 contain speculative loads after jump instructions. If this option is used,
14866 @code{__WORKAROUND_SPECULATIVE_LOADS} is defined.
14867
14868 @item -mno-specld-anomaly
14869 @opindex mno-specld-anomaly
14870 Don't generate extra code to prevent speculative loads from occurring.
14871
14872 @item -mcsync-anomaly
14873 @opindex mcsync-anomaly
14874 When enabled, the compiler ensures that the generated code does not
14875 contain CSYNC or SSYNC instructions too soon after conditional branches.
14876 If this option is used, @code{__WORKAROUND_SPECULATIVE_SYNCS} is defined.
14877
14878 @item -mno-csync-anomaly
14879 @opindex mno-csync-anomaly
14880 Don't generate extra code to prevent CSYNC or SSYNC instructions from
14881 occurring too soon after a conditional branch.
14882
14883 @item -mlow-64k
14884 @opindex mlow-64k
14885 When enabled, the compiler is free to take advantage of the knowledge that
14886 the entire program fits into the low 64k of memory.
14887
14888 @item -mno-low-64k
14889 @opindex mno-low-64k
14890 Assume that the program is arbitrarily large. This is the default.
14891
14892 @item -mstack-check-l1
14893 @opindex mstack-check-l1
14894 Do stack checking using information placed into L1 scratchpad memory by the
14895 uClinux kernel.
14896
14897 @item -mid-shared-library
14898 @opindex mid-shared-library
14899 Generate code that supports shared libraries via the library ID method.
14900 This allows for execute in place and shared libraries in an environment
14901 without virtual memory management. This option implies @option{-fPIC}.
14902 With a @samp{bfin-elf} target, this option implies @option{-msim}.
14903
14904 @item -mno-id-shared-library
14905 @opindex mno-id-shared-library
14906 Generate code that doesn't assume ID-based shared libraries are being used.
14907 This is the default.
14908
14909 @item -mleaf-id-shared-library
14910 @opindex mleaf-id-shared-library
14911 Generate code that supports shared libraries via the library ID method,
14912 but assumes that this library or executable won't link against any other
14913 ID shared libraries. That allows the compiler to use faster code for jumps
14914 and calls.
14915
14916 @item -mno-leaf-id-shared-library
14917 @opindex mno-leaf-id-shared-library
14918 Do not assume that the code being compiled won't link against any ID shared
14919 libraries. Slower code is generated for jump and call insns.
14920
14921 @item -mshared-library-id=n
14922 @opindex mshared-library-id
14923 Specifies the identification number of the ID-based shared library being
14924 compiled. Specifying a value of 0 generates more compact code; specifying
14925 other values forces the allocation of that number to the current
14926 library but is no more space- or time-efficient than omitting this option.
14927
14928 @item -msep-data
14929 @opindex msep-data
14930 Generate code that allows the data segment to be located in a different
14931 area of memory from the text segment. This allows for execute in place in
14932 an environment without virtual memory management by eliminating relocations
14933 against the text section.
14934
14935 @item -mno-sep-data
14936 @opindex mno-sep-data
14937 Generate code that assumes that the data segment follows the text segment.
14938 This is the default.
14939
14940 @item -mlong-calls
14941 @itemx -mno-long-calls
14942 @opindex mlong-calls
14943 @opindex mno-long-calls
14944 Tells the compiler to perform function calls by first loading the
14945 address of the function into a register and then performing a subroutine
14946 call on this register. This switch is needed if the target function
14947 lies outside of the 24-bit addressing range of the offset-based
14948 version of subroutine call instruction.
14949
14950 This feature is not enabled by default. Specifying
14951 @option{-mno-long-calls} restores the default behavior. Note these
14952 switches have no effect on how the compiler generates code to handle
14953 function calls via function pointers.
14954
14955 @item -mfast-fp
14956 @opindex mfast-fp
14957 Link with the fast floating-point library. This library relaxes some of
14958 the IEEE floating-point standard's rules for checking inputs against
14959 Not-a-Number (NAN), in the interest of performance.
14960
14961 @item -minline-plt
14962 @opindex minline-plt
14963 Enable inlining of PLT entries in function calls to functions that are
14964 not known to bind locally. It has no effect without @option{-mfdpic}.
14965
14966 @item -mmulticore
14967 @opindex mmulticore
14968 Build a standalone application for multicore Blackfin processors.
14969 This option causes proper start files and link scripts supporting
14970 multicore to be used, and defines the macro @code{__BFIN_MULTICORE}.
14971 It can only be used with @option{-mcpu=bf561@r{[}-@var{sirevision}@r{]}}.
14972
14973 This option can be used with @option{-mcorea} or @option{-mcoreb}, which
14974 selects the one-application-per-core programming model. Without
14975 @option{-mcorea} or @option{-mcoreb}, the single-application/dual-core
14976 programming model is used. In this model, the main function of Core B
14977 should be named as @code{coreb_main}.
14978
14979 If this option is not used, the single-core application programming
14980 model is used.
14981
14982 @item -mcorea
14983 @opindex mcorea
14984 Build a standalone application for Core A of BF561 when using
14985 the one-application-per-core programming model. Proper start files
14986 and link scripts are used to support Core A, and the macro
14987 @code{__BFIN_COREA} is defined.
14988 This option can only be used in conjunction with @option{-mmulticore}.
14989
14990 @item -mcoreb
14991 @opindex mcoreb
14992 Build a standalone application for Core B of BF561 when using
14993 the one-application-per-core programming model. Proper start files
14994 and link scripts are used to support Core B, and the macro
14995 @code{__BFIN_COREB} is defined. When this option is used, @code{coreb_main}
14996 should be used instead of @code{main}.
14997 This option can only be used in conjunction with @option{-mmulticore}.
14998
14999 @item -msdram
15000 @opindex msdram
15001 Build a standalone application for SDRAM. Proper start files and
15002 link scripts are used to put the application into SDRAM, and the macro
15003 @code{__BFIN_SDRAM} is defined.
15004 The loader should initialize SDRAM before loading the application.
15005
15006 @item -micplb
15007 @opindex micplb
15008 Assume that ICPLBs are enabled at run time. This has an effect on certain
15009 anomaly workarounds. For Linux targets, the default is to assume ICPLBs
15010 are enabled; for standalone applications the default is off.
15011 @end table
15012
15013 @node C6X Options
15014 @subsection C6X Options
15015 @cindex C6X Options
15016
15017 @table @gcctabopt
15018 @item -march=@var{name}
15019 @opindex march
15020 This specifies the name of the target architecture. GCC uses this
15021 name to determine what kind of instructions it can emit when generating
15022 assembly code. Permissible names are: @samp{c62x},
15023 @samp{c64x}, @samp{c64x+}, @samp{c67x}, @samp{c67x+}, @samp{c674x}.
15024
15025 @item -mbig-endian
15026 @opindex mbig-endian
15027 Generate code for a big-endian target.
15028
15029 @item -mlittle-endian
15030 @opindex mlittle-endian
15031 Generate code for a little-endian target. This is the default.
15032
15033 @item -msim
15034 @opindex msim
15035 Choose startup files and linker script suitable for the simulator.
15036
15037 @item -msdata=default
15038 @opindex msdata=default
15039 Put small global and static data in the @code{.neardata} section,
15040 which is pointed to by register @code{B14}. Put small uninitialized
15041 global and static data in the @code{.bss} section, which is adjacent
15042 to the @code{.neardata} section. Put small read-only data into the
15043 @code{.rodata} section. The corresponding sections used for large
15044 pieces of data are @code{.fardata}, @code{.far} and @code{.const}.
15045
15046 @item -msdata=all
15047 @opindex msdata=all
15048 Put all data, not just small objects, into the sections reserved for
15049 small data, and use addressing relative to the @code{B14} register to
15050 access them.
15051
15052 @item -msdata=none
15053 @opindex msdata=none
15054 Make no use of the sections reserved for small data, and use absolute
15055 addresses to access all data. Put all initialized global and static
15056 data in the @code{.fardata} section, and all uninitialized data in the
15057 @code{.far} section. Put all constant data into the @code{.const}
15058 section.
15059 @end table
15060
15061 @node CRIS Options
15062 @subsection CRIS Options
15063 @cindex CRIS Options
15064
15065 These options are defined specifically for the CRIS ports.
15066
15067 @table @gcctabopt
15068 @item -march=@var{architecture-type}
15069 @itemx -mcpu=@var{architecture-type}
15070 @opindex march
15071 @opindex mcpu
15072 Generate code for the specified architecture. The choices for
15073 @var{architecture-type} are @samp{v3}, @samp{v8} and @samp{v10} for
15074 respectively ETRAX@w{ }4, ETRAX@w{ }100, and ETRAX@w{ }100@w{ }LX@.
15075 Default is @samp{v0} except for cris-axis-linux-gnu, where the default is
15076 @samp{v10}.
15077
15078 @item -mtune=@var{architecture-type}
15079 @opindex mtune
15080 Tune to @var{architecture-type} everything applicable about the generated
15081 code, except for the ABI and the set of available instructions. The
15082 choices for @var{architecture-type} are the same as for
15083 @option{-march=@var{architecture-type}}.
15084
15085 @item -mmax-stack-frame=@var{n}
15086 @opindex mmax-stack-frame
15087 Warn when the stack frame of a function exceeds @var{n} bytes.
15088
15089 @item -metrax4
15090 @itemx -metrax100
15091 @opindex metrax4
15092 @opindex metrax100
15093 The options @option{-metrax4} and @option{-metrax100} are synonyms for
15094 @option{-march=v3} and @option{-march=v8} respectively.
15095
15096 @item -mmul-bug-workaround
15097 @itemx -mno-mul-bug-workaround
15098 @opindex mmul-bug-workaround
15099 @opindex mno-mul-bug-workaround
15100 Work around a bug in the @code{muls} and @code{mulu} instructions for CPU
15101 models where it applies. This option is active by default.
15102
15103 @item -mpdebug
15104 @opindex mpdebug
15105 Enable CRIS-specific verbose debug-related information in the assembly
15106 code. This option also has the effect of turning off the @samp{#NO_APP}
15107 formatted-code indicator to the assembler at the beginning of the
15108 assembly file.
15109
15110 @item -mcc-init
15111 @opindex mcc-init
15112 Do not use condition-code results from previous instruction; always emit
15113 compare and test instructions before use of condition codes.
15114
15115 @item -mno-side-effects
15116 @opindex mno-side-effects
15117 Do not emit instructions with side effects in addressing modes other than
15118 post-increment.
15119
15120 @item -mstack-align
15121 @itemx -mno-stack-align
15122 @itemx -mdata-align
15123 @itemx -mno-data-align
15124 @itemx -mconst-align
15125 @itemx -mno-const-align
15126 @opindex mstack-align
15127 @opindex mno-stack-align
15128 @opindex mdata-align
15129 @opindex mno-data-align
15130 @opindex mconst-align
15131 @opindex mno-const-align
15132 These options (@samp{no-} options) arrange (eliminate arrangements) for the
15133 stack frame, individual data and constants to be aligned for the maximum
15134 single data access size for the chosen CPU model. The default is to
15135 arrange for 32-bit alignment. ABI details such as structure layout are
15136 not affected by these options.
15137
15138 @item -m32-bit
15139 @itemx -m16-bit
15140 @itemx -m8-bit
15141 @opindex m32-bit
15142 @opindex m16-bit
15143 @opindex m8-bit
15144 Similar to the stack- data- and const-align options above, these options
15145 arrange for stack frame, writable data and constants to all be 32-bit,
15146 16-bit or 8-bit aligned. The default is 32-bit alignment.
15147
15148 @item -mno-prologue-epilogue
15149 @itemx -mprologue-epilogue
15150 @opindex mno-prologue-epilogue
15151 @opindex mprologue-epilogue
15152 With @option{-mno-prologue-epilogue}, the normal function prologue and
15153 epilogue which set up the stack frame are omitted and no return
15154 instructions or return sequences are generated in the code. Use this
15155 option only together with visual inspection of the compiled code: no
15156 warnings or errors are generated when call-saved registers must be saved,
15157 or storage for local variables needs to be allocated.
15158
15159 @item -mno-gotplt
15160 @itemx -mgotplt
15161 @opindex mno-gotplt
15162 @opindex mgotplt
15163 With @option{-fpic} and @option{-fPIC}, don't generate (do generate)
15164 instruction sequences that load addresses for functions from the PLT part
15165 of the GOT rather than (traditional on other architectures) calls to the
15166 PLT@. The default is @option{-mgotplt}.
15167
15168 @item -melf
15169 @opindex melf
15170 Legacy no-op option only recognized with the cris-axis-elf and
15171 cris-axis-linux-gnu targets.
15172
15173 @item -mlinux
15174 @opindex mlinux
15175 Legacy no-op option only recognized with the cris-axis-linux-gnu target.
15176
15177 @item -sim
15178 @opindex sim
15179 This option, recognized for the cris-axis-elf, arranges
15180 to link with input-output functions from a simulator library. Code,
15181 initialized data and zero-initialized data are allocated consecutively.
15182
15183 @item -sim2
15184 @opindex sim2
15185 Like @option{-sim}, but pass linker options to locate initialized data at
15186 0x40000000 and zero-initialized data at 0x80000000.
15187 @end table
15188
15189 @node CR16 Options
15190 @subsection CR16 Options
15191 @cindex CR16 Options
15192
15193 These options are defined specifically for the CR16 ports.
15194
15195 @table @gcctabopt
15196
15197 @item -mmac
15198 @opindex mmac
15199 Enable the use of multiply-accumulate instructions. Disabled by default.
15200
15201 @item -mcr16cplus
15202 @itemx -mcr16c
15203 @opindex mcr16cplus
15204 @opindex mcr16c
15205 Generate code for CR16C or CR16C+ architecture. CR16C+ architecture
15206 is default.
15207
15208 @item -msim
15209 @opindex msim
15210 Links the library libsim.a which is in compatible with simulator. Applicable
15211 to ELF compiler only.
15212
15213 @item -mint32
15214 @opindex mint32
15215 Choose integer type as 32-bit wide.
15216
15217 @item -mbit-ops
15218 @opindex mbit-ops
15219 Generates @code{sbit}/@code{cbit} instructions for bit manipulations.
15220
15221 @item -mdata-model=@var{model}
15222 @opindex mdata-model
15223 Choose a data model. The choices for @var{model} are @samp{near},
15224 @samp{far} or @samp{medium}. @samp{medium} is default.
15225 However, @samp{far} is not valid with @option{-mcr16c}, as the
15226 CR16C architecture does not support the far data model.
15227 @end table
15228
15229 @node Darwin Options
15230 @subsection Darwin Options
15231 @cindex Darwin options
15232
15233 These options are defined for all architectures running the Darwin operating
15234 system.
15235
15236 FSF GCC on Darwin does not create ``fat'' object files; it creates
15237 an object file for the single architecture that GCC was built to
15238 target. Apple's GCC on Darwin does create ``fat'' files if multiple
15239 @option{-arch} options are used; it does so by running the compiler or
15240 linker multiple times and joining the results together with
15241 @file{lipo}.
15242
15243 The subtype of the file created (like @samp{ppc7400} or @samp{ppc970} or
15244 @samp{i686}) is determined by the flags that specify the ISA
15245 that GCC is targeting, like @option{-mcpu} or @option{-march}. The
15246 @option{-force_cpusubtype_ALL} option can be used to override this.
15247
15248 The Darwin tools vary in their behavior when presented with an ISA
15249 mismatch. The assembler, @file{as}, only permits instructions to
15250 be used that are valid for the subtype of the file it is generating,
15251 so you cannot put 64-bit instructions in a @samp{ppc750} object file.
15252 The linker for shared libraries, @file{/usr/bin/libtool}, fails
15253 and prints an error if asked to create a shared library with a less
15254 restrictive subtype than its input files (for instance, trying to put
15255 a @samp{ppc970} object file in a @samp{ppc7400} library). The linker
15256 for executables, @command{ld}, quietly gives the executable the most
15257 restrictive subtype of any of its input files.
15258
15259 @table @gcctabopt
15260 @item -F@var{dir}
15261 @opindex F
15262 Add the framework directory @var{dir} to the head of the list of
15263 directories to be searched for header files. These directories are
15264 interleaved with those specified by @option{-I} options and are
15265 scanned in a left-to-right order.
15266
15267 A framework directory is a directory with frameworks in it. A
15268 framework is a directory with a @file{Headers} and/or
15269 @file{PrivateHeaders} directory contained directly in it that ends
15270 in @file{.framework}. The name of a framework is the name of this
15271 directory excluding the @file{.framework}. Headers associated with
15272 the framework are found in one of those two directories, with
15273 @file{Headers} being searched first. A subframework is a framework
15274 directory that is in a framework's @file{Frameworks} directory.
15275 Includes of subframework headers can only appear in a header of a
15276 framework that contains the subframework, or in a sibling subframework
15277 header. Two subframeworks are siblings if they occur in the same
15278 framework. A subframework should not have the same name as a
15279 framework; a warning is issued if this is violated. Currently a
15280 subframework cannot have subframeworks; in the future, the mechanism
15281 may be extended to support this. The standard frameworks can be found
15282 in @file{/System/Library/Frameworks} and
15283 @file{/Library/Frameworks}. An example include looks like
15284 @code{#include <Framework/header.h>}, where @file{Framework} denotes
15285 the name of the framework and @file{header.h} is found in the
15286 @file{PrivateHeaders} or @file{Headers} directory.
15287
15288 @item -iframework@var{dir}
15289 @opindex iframework
15290 Like @option{-F} except the directory is a treated as a system
15291 directory. The main difference between this @option{-iframework} and
15292 @option{-F} is that with @option{-iframework} the compiler does not
15293 warn about constructs contained within header files found via
15294 @var{dir}. This option is valid only for the C family of languages.
15295
15296 @item -gused
15297 @opindex gused
15298 Emit debugging information for symbols that are used. For stabs
15299 debugging format, this enables @option{-feliminate-unused-debug-symbols}.
15300 This is by default ON@.
15301
15302 @item -gfull
15303 @opindex gfull
15304 Emit debugging information for all symbols and types.
15305
15306 @item -mmacosx-version-min=@var{version}
15307 The earliest version of MacOS X that this executable will run on
15308 is @var{version}. Typical values of @var{version} include @code{10.1},
15309 @code{10.2}, and @code{10.3.9}.
15310
15311 If the compiler was built to use the system's headers by default,
15312 then the default for this option is the system version on which the
15313 compiler is running, otherwise the default is to make choices that
15314 are compatible with as many systems and code bases as possible.
15315
15316 @item -mkernel
15317 @opindex mkernel
15318 Enable kernel development mode. The @option{-mkernel} option sets
15319 @option{-static}, @option{-fno-common}, @option{-fno-use-cxa-atexit},
15320 @option{-fno-exceptions}, @option{-fno-non-call-exceptions},
15321 @option{-fapple-kext}, @option{-fno-weak} and @option{-fno-rtti} where
15322 applicable. This mode also sets @option{-mno-altivec},
15323 @option{-msoft-float}, @option{-fno-builtin} and
15324 @option{-mlong-branch} for PowerPC targets.
15325
15326 @item -mone-byte-bool
15327 @opindex mone-byte-bool
15328 Override the defaults for @code{bool} so that @code{sizeof(bool)==1}.
15329 By default @code{sizeof(bool)} is @code{4} when compiling for
15330 Darwin/PowerPC and @code{1} when compiling for Darwin/x86, so this
15331 option has no effect on x86.
15332
15333 @strong{Warning:} The @option{-mone-byte-bool} switch causes GCC
15334 to generate code that is not binary compatible with code generated
15335 without that switch. Using this switch may require recompiling all
15336 other modules in a program, including system libraries. Use this
15337 switch to conform to a non-default data model.
15338
15339 @item -mfix-and-continue
15340 @itemx -ffix-and-continue
15341 @itemx -findirect-data
15342 @opindex mfix-and-continue
15343 @opindex ffix-and-continue
15344 @opindex findirect-data
15345 Generate code suitable for fast turnaround development, such as to
15346 allow GDB to dynamically load @file{.o} files into already-running
15347 programs. @option{-findirect-data} and @option{-ffix-and-continue}
15348 are provided for backwards compatibility.
15349
15350 @item -all_load
15351 @opindex all_load
15352 Loads all members of static archive libraries.
15353 See man ld(1) for more information.
15354
15355 @item -arch_errors_fatal
15356 @opindex arch_errors_fatal
15357 Cause the errors having to do with files that have the wrong architecture
15358 to be fatal.
15359
15360 @item -bind_at_load
15361 @opindex bind_at_load
15362 Causes the output file to be marked such that the dynamic linker will
15363 bind all undefined references when the file is loaded or launched.
15364
15365 @item -bundle
15366 @opindex bundle
15367 Produce a Mach-o bundle format file.
15368 See man ld(1) for more information.
15369
15370 @item -bundle_loader @var{executable}
15371 @opindex bundle_loader
15372 This option specifies the @var{executable} that will load the build
15373 output file being linked. See man ld(1) for more information.
15374
15375 @item -dynamiclib
15376 @opindex dynamiclib
15377 When passed this option, GCC produces a dynamic library instead of
15378 an executable when linking, using the Darwin @file{libtool} command.
15379
15380 @item -force_cpusubtype_ALL
15381 @opindex force_cpusubtype_ALL
15382 This causes GCC's output file to have the @samp{ALL} subtype, instead of
15383 one controlled by the @option{-mcpu} or @option{-march} option.
15384
15385 @item -allowable_client @var{client_name}
15386 @itemx -client_name
15387 @itemx -compatibility_version
15388 @itemx -current_version
15389 @itemx -dead_strip
15390 @itemx -dependency-file
15391 @itemx -dylib_file
15392 @itemx -dylinker_install_name
15393 @itemx -dynamic
15394 @itemx -exported_symbols_list
15395 @itemx -filelist
15396 @need 800
15397 @itemx -flat_namespace
15398 @itemx -force_flat_namespace
15399 @itemx -headerpad_max_install_names
15400 @itemx -image_base
15401 @itemx -init
15402 @itemx -install_name
15403 @itemx -keep_private_externs
15404 @itemx -multi_module
15405 @itemx -multiply_defined
15406 @itemx -multiply_defined_unused
15407 @need 800
15408 @itemx -noall_load
15409 @itemx -no_dead_strip_inits_and_terms
15410 @itemx -nofixprebinding
15411 @itemx -nomultidefs
15412 @itemx -noprebind
15413 @itemx -noseglinkedit
15414 @itemx -pagezero_size
15415 @itemx -prebind
15416 @itemx -prebind_all_twolevel_modules
15417 @itemx -private_bundle
15418 @need 800
15419 @itemx -read_only_relocs
15420 @itemx -sectalign
15421 @itemx -sectobjectsymbols
15422 @itemx -whyload
15423 @itemx -seg1addr
15424 @itemx -sectcreate
15425 @itemx -sectobjectsymbols
15426 @itemx -sectorder
15427 @itemx -segaddr
15428 @itemx -segs_read_only_addr
15429 @need 800
15430 @itemx -segs_read_write_addr
15431 @itemx -seg_addr_table
15432 @itemx -seg_addr_table_filename
15433 @itemx -seglinkedit
15434 @itemx -segprot
15435 @itemx -segs_read_only_addr
15436 @itemx -segs_read_write_addr
15437 @itemx -single_module
15438 @itemx -static
15439 @itemx -sub_library
15440 @need 800
15441 @itemx -sub_umbrella
15442 @itemx -twolevel_namespace
15443 @itemx -umbrella
15444 @itemx -undefined
15445 @itemx -unexported_symbols_list
15446 @itemx -weak_reference_mismatches
15447 @itemx -whatsloaded
15448 @opindex allowable_client
15449 @opindex client_name
15450 @opindex compatibility_version
15451 @opindex current_version
15452 @opindex dead_strip
15453 @opindex dependency-file
15454 @opindex dylib_file
15455 @opindex dylinker_install_name
15456 @opindex dynamic
15457 @opindex exported_symbols_list
15458 @opindex filelist
15459 @opindex flat_namespace
15460 @opindex force_flat_namespace
15461 @opindex headerpad_max_install_names
15462 @opindex image_base
15463 @opindex init
15464 @opindex install_name
15465 @opindex keep_private_externs
15466 @opindex multi_module
15467 @opindex multiply_defined
15468 @opindex multiply_defined_unused
15469 @opindex noall_load
15470 @opindex no_dead_strip_inits_and_terms
15471 @opindex nofixprebinding
15472 @opindex nomultidefs
15473 @opindex noprebind
15474 @opindex noseglinkedit
15475 @opindex pagezero_size
15476 @opindex prebind
15477 @opindex prebind_all_twolevel_modules
15478 @opindex private_bundle
15479 @opindex read_only_relocs
15480 @opindex sectalign
15481 @opindex sectobjectsymbols
15482 @opindex whyload
15483 @opindex seg1addr
15484 @opindex sectcreate
15485 @opindex sectobjectsymbols
15486 @opindex sectorder
15487 @opindex segaddr
15488 @opindex segs_read_only_addr
15489 @opindex segs_read_write_addr
15490 @opindex seg_addr_table
15491 @opindex seg_addr_table_filename
15492 @opindex seglinkedit
15493 @opindex segprot
15494 @opindex segs_read_only_addr
15495 @opindex segs_read_write_addr
15496 @opindex single_module
15497 @opindex static
15498 @opindex sub_library
15499 @opindex sub_umbrella
15500 @opindex twolevel_namespace
15501 @opindex umbrella
15502 @opindex undefined
15503 @opindex unexported_symbols_list
15504 @opindex weak_reference_mismatches
15505 @opindex whatsloaded
15506 These options are passed to the Darwin linker. The Darwin linker man page
15507 describes them in detail.
15508 @end table
15509
15510 @node DEC Alpha Options
15511 @subsection DEC Alpha Options
15512
15513 These @samp{-m} options are defined for the DEC Alpha implementations:
15514
15515 @table @gcctabopt
15516 @item -mno-soft-float
15517 @itemx -msoft-float
15518 @opindex mno-soft-float
15519 @opindex msoft-float
15520 Use (do not use) the hardware floating-point instructions for
15521 floating-point operations. When @option{-msoft-float} is specified,
15522 functions in @file{libgcc.a} are used to perform floating-point
15523 operations. Unless they are replaced by routines that emulate the
15524 floating-point operations, or compiled in such a way as to call such
15525 emulations routines, these routines issue floating-point
15526 operations. If you are compiling for an Alpha without floating-point
15527 operations, you must ensure that the library is built so as not to call
15528 them.
15529
15530 Note that Alpha implementations without floating-point operations are
15531 required to have floating-point registers.
15532
15533 @item -mfp-reg
15534 @itemx -mno-fp-regs
15535 @opindex mfp-reg
15536 @opindex mno-fp-regs
15537 Generate code that uses (does not use) the floating-point register set.
15538 @option{-mno-fp-regs} implies @option{-msoft-float}. If the floating-point
15539 register set is not used, floating-point operands are passed in integer
15540 registers as if they were integers and floating-point results are passed
15541 in @code{$0} instead of @code{$f0}. This is a non-standard calling sequence,
15542 so any function with a floating-point argument or return value called by code
15543 compiled with @option{-mno-fp-regs} must also be compiled with that
15544 option.
15545
15546 A typical use of this option is building a kernel that does not use,
15547 and hence need not save and restore, any floating-point registers.
15548
15549 @item -mieee
15550 @opindex mieee
15551 The Alpha architecture implements floating-point hardware optimized for
15552 maximum performance. It is mostly compliant with the IEEE floating-point
15553 standard. However, for full compliance, software assistance is
15554 required. This option generates code fully IEEE-compliant code
15555 @emph{except} that the @var{inexact-flag} is not maintained (see below).
15556 If this option is turned on, the preprocessor macro @code{_IEEE_FP} is
15557 defined during compilation. The resulting code is less efficient but is
15558 able to correctly support denormalized numbers and exceptional IEEE
15559 values such as not-a-number and plus/minus infinity. Other Alpha
15560 compilers call this option @option{-ieee_with_no_inexact}.
15561
15562 @item -mieee-with-inexact
15563 @opindex mieee-with-inexact
15564 This is like @option{-mieee} except the generated code also maintains
15565 the IEEE @var{inexact-flag}. Turning on this option causes the
15566 generated code to implement fully-compliant IEEE math. In addition to
15567 @code{_IEEE_FP}, @code{_IEEE_FP_EXACT} is defined as a preprocessor
15568 macro. On some Alpha implementations the resulting code may execute
15569 significantly slower than the code generated by default. Since there is
15570 very little code that depends on the @var{inexact-flag}, you should
15571 normally not specify this option. Other Alpha compilers call this
15572 option @option{-ieee_with_inexact}.
15573
15574 @item -mfp-trap-mode=@var{trap-mode}
15575 @opindex mfp-trap-mode
15576 This option controls what floating-point related traps are enabled.
15577 Other Alpha compilers call this option @option{-fptm @var{trap-mode}}.
15578 The trap mode can be set to one of four values:
15579
15580 @table @samp
15581 @item n
15582 This is the default (normal) setting. The only traps that are enabled
15583 are the ones that cannot be disabled in software (e.g., division by zero
15584 trap).
15585
15586 @item u
15587 In addition to the traps enabled by @samp{n}, underflow traps are enabled
15588 as well.
15589
15590 @item su
15591 Like @samp{u}, but the instructions are marked to be safe for software
15592 completion (see Alpha architecture manual for details).
15593
15594 @item sui
15595 Like @samp{su}, but inexact traps are enabled as well.
15596 @end table
15597
15598 @item -mfp-rounding-mode=@var{rounding-mode}
15599 @opindex mfp-rounding-mode
15600 Selects the IEEE rounding mode. Other Alpha compilers call this option
15601 @option{-fprm @var{rounding-mode}}. The @var{rounding-mode} can be one
15602 of:
15603
15604 @table @samp
15605 @item n
15606 Normal IEEE rounding mode. Floating-point numbers are rounded towards
15607 the nearest machine number or towards the even machine number in case
15608 of a tie.
15609
15610 @item m
15611 Round towards minus infinity.
15612
15613 @item c
15614 Chopped rounding mode. Floating-point numbers are rounded towards zero.
15615
15616 @item d
15617 Dynamic rounding mode. A field in the floating-point control register
15618 (@var{fpcr}, see Alpha architecture reference manual) controls the
15619 rounding mode in effect. The C library initializes this register for
15620 rounding towards plus infinity. Thus, unless your program modifies the
15621 @var{fpcr}, @samp{d} corresponds to round towards plus infinity.
15622 @end table
15623
15624 @item -mtrap-precision=@var{trap-precision}
15625 @opindex mtrap-precision
15626 In the Alpha architecture, floating-point traps are imprecise. This
15627 means without software assistance it is impossible to recover from a
15628 floating trap and program execution normally needs to be terminated.
15629 GCC can generate code that can assist operating system trap handlers
15630 in determining the exact location that caused a floating-point trap.
15631 Depending on the requirements of an application, different levels of
15632 precisions can be selected:
15633
15634 @table @samp
15635 @item p
15636 Program precision. This option is the default and means a trap handler
15637 can only identify which program caused a floating-point exception.
15638
15639 @item f
15640 Function precision. The trap handler can determine the function that
15641 caused a floating-point exception.
15642
15643 @item i
15644 Instruction precision. The trap handler can determine the exact
15645 instruction that caused a floating-point exception.
15646 @end table
15647
15648 Other Alpha compilers provide the equivalent options called
15649 @option{-scope_safe} and @option{-resumption_safe}.
15650
15651 @item -mieee-conformant
15652 @opindex mieee-conformant
15653 This option marks the generated code as IEEE conformant. You must not
15654 use this option unless you also specify @option{-mtrap-precision=i} and either
15655 @option{-mfp-trap-mode=su} or @option{-mfp-trap-mode=sui}. Its only effect
15656 is to emit the line @samp{.eflag 48} in the function prologue of the
15657 generated assembly file.
15658
15659 @item -mbuild-constants
15660 @opindex mbuild-constants
15661 Normally GCC examines a 32- or 64-bit integer constant to
15662 see if it can construct it from smaller constants in two or three
15663 instructions. If it cannot, it outputs the constant as a literal and
15664 generates code to load it from the data segment at run time.
15665
15666 Use this option to require GCC to construct @emph{all} integer constants
15667 using code, even if it takes more instructions (the maximum is six).
15668
15669 You typically use this option to build a shared library dynamic
15670 loader. Itself a shared library, it must relocate itself in memory
15671 before it can find the variables and constants in its own data segment.
15672
15673 @item -mbwx
15674 @itemx -mno-bwx
15675 @itemx -mcix
15676 @itemx -mno-cix
15677 @itemx -mfix
15678 @itemx -mno-fix
15679 @itemx -mmax
15680 @itemx -mno-max
15681 @opindex mbwx
15682 @opindex mno-bwx
15683 @opindex mcix
15684 @opindex mno-cix
15685 @opindex mfix
15686 @opindex mno-fix
15687 @opindex mmax
15688 @opindex mno-max
15689 Indicate whether GCC should generate code to use the optional BWX,
15690 CIX, FIX and MAX instruction sets. The default is to use the instruction
15691 sets supported by the CPU type specified via @option{-mcpu=} option or that
15692 of the CPU on which GCC was built if none is specified.
15693
15694 @item -mfloat-vax
15695 @itemx -mfloat-ieee
15696 @opindex mfloat-vax
15697 @opindex mfloat-ieee
15698 Generate code that uses (does not use) VAX F and G floating-point
15699 arithmetic instead of IEEE single and double precision.
15700
15701 @item -mexplicit-relocs
15702 @itemx -mno-explicit-relocs
15703 @opindex mexplicit-relocs
15704 @opindex mno-explicit-relocs
15705 Older Alpha assemblers provided no way to generate symbol relocations
15706 except via assembler macros. Use of these macros does not allow
15707 optimal instruction scheduling. GNU binutils as of version 2.12
15708 supports a new syntax that allows the compiler to explicitly mark
15709 which relocations should apply to which instructions. This option
15710 is mostly useful for debugging, as GCC detects the capabilities of
15711 the assembler when it is built and sets the default accordingly.
15712
15713 @item -msmall-data
15714 @itemx -mlarge-data
15715 @opindex msmall-data
15716 @opindex mlarge-data
15717 When @option{-mexplicit-relocs} is in effect, static data is
15718 accessed via @dfn{gp-relative} relocations. When @option{-msmall-data}
15719 is used, objects 8 bytes long or smaller are placed in a @dfn{small data area}
15720 (the @code{.sdata} and @code{.sbss} sections) and are accessed via
15721 16-bit relocations off of the @code{$gp} register. This limits the
15722 size of the small data area to 64KB, but allows the variables to be
15723 directly accessed via a single instruction.
15724
15725 The default is @option{-mlarge-data}. With this option the data area
15726 is limited to just below 2GB@. Programs that require more than 2GB of
15727 data must use @code{malloc} or @code{mmap} to allocate the data in the
15728 heap instead of in the program's data segment.
15729
15730 When generating code for shared libraries, @option{-fpic} implies
15731 @option{-msmall-data} and @option{-fPIC} implies @option{-mlarge-data}.
15732
15733 @item -msmall-text
15734 @itemx -mlarge-text
15735 @opindex msmall-text
15736 @opindex mlarge-text
15737 When @option{-msmall-text} is used, the compiler assumes that the
15738 code of the entire program (or shared library) fits in 4MB, and is
15739 thus reachable with a branch instruction. When @option{-msmall-data}
15740 is used, the compiler can assume that all local symbols share the
15741 same @code{$gp} value, and thus reduce the number of instructions
15742 required for a function call from 4 to 1.
15743
15744 The default is @option{-mlarge-text}.
15745
15746 @item -mcpu=@var{cpu_type}
15747 @opindex mcpu
15748 Set the instruction set and instruction scheduling parameters for
15749 machine type @var{cpu_type}. You can specify either the @samp{EV}
15750 style name or the corresponding chip number. GCC supports scheduling
15751 parameters for the EV4, EV5 and EV6 family of processors and
15752 chooses the default values for the instruction set from the processor
15753 you specify. If you do not specify a processor type, GCC defaults
15754 to the processor on which the compiler was built.
15755
15756 Supported values for @var{cpu_type} are
15757
15758 @table @samp
15759 @item ev4
15760 @itemx ev45
15761 @itemx 21064
15762 Schedules as an EV4 and has no instruction set extensions.
15763
15764 @item ev5
15765 @itemx 21164
15766 Schedules as an EV5 and has no instruction set extensions.
15767
15768 @item ev56
15769 @itemx 21164a
15770 Schedules as an EV5 and supports the BWX extension.
15771
15772 @item pca56
15773 @itemx 21164pc
15774 @itemx 21164PC
15775 Schedules as an EV5 and supports the BWX and MAX extensions.
15776
15777 @item ev6
15778 @itemx 21264
15779 Schedules as an EV6 and supports the BWX, FIX, and MAX extensions.
15780
15781 @item ev67
15782 @itemx 21264a
15783 Schedules as an EV6 and supports the BWX, CIX, FIX, and MAX extensions.
15784 @end table
15785
15786 Native toolchains also support the value @samp{native},
15787 which selects the best architecture option for the host processor.
15788 @option{-mcpu=native} has no effect if GCC does not recognize
15789 the processor.
15790
15791 @item -mtune=@var{cpu_type}
15792 @opindex mtune
15793 Set only the instruction scheduling parameters for machine type
15794 @var{cpu_type}. The instruction set is not changed.
15795
15796 Native toolchains also support the value @samp{native},
15797 which selects the best architecture option for the host processor.
15798 @option{-mtune=native} has no effect if GCC does not recognize
15799 the processor.
15800
15801 @item -mmemory-latency=@var{time}
15802 @opindex mmemory-latency
15803 Sets the latency the scheduler should assume for typical memory
15804 references as seen by the application. This number is highly
15805 dependent on the memory access patterns used by the application
15806 and the size of the external cache on the machine.
15807
15808 Valid options for @var{time} are
15809
15810 @table @samp
15811 @item @var{number}
15812 A decimal number representing clock cycles.
15813
15814 @item L1
15815 @itemx L2
15816 @itemx L3
15817 @itemx main
15818 The compiler contains estimates of the number of clock cycles for
15819 ``typical'' EV4 & EV5 hardware for the Level 1, 2 & 3 caches
15820 (also called Dcache, Scache, and Bcache), as well as to main memory.
15821 Note that L3 is only valid for EV5.
15822
15823 @end table
15824 @end table
15825
15826 @node FR30 Options
15827 @subsection FR30 Options
15828 @cindex FR30 Options
15829
15830 These options are defined specifically for the FR30 port.
15831
15832 @table @gcctabopt
15833
15834 @item -msmall-model
15835 @opindex msmall-model
15836 Use the small address space model. This can produce smaller code, but
15837 it does assume that all symbolic values and addresses fit into a
15838 20-bit range.
15839
15840 @item -mno-lsim
15841 @opindex mno-lsim
15842 Assume that runtime support has been provided and so there is no need
15843 to include the simulator library (@file{libsim.a}) on the linker
15844 command line.
15845
15846 @end table
15847
15848 @node FT32 Options
15849 @subsection FT32 Options
15850 @cindex FT32 Options
15851
15852 These options are defined specifically for the FT32 port.
15853
15854 @table @gcctabopt
15855
15856 @item -msim
15857 @opindex msim
15858 Specifies that the program will be run on the simulator. This causes
15859 an alternate runtime startup and library to be linked.
15860 You must not use this option when generating programs that will run on
15861 real hardware; you must provide your own runtime library for whatever
15862 I/O functions are needed.
15863
15864 @item -mlra
15865 @opindex mlra
15866 Enable Local Register Allocation. This is still experimental for FT32,
15867 so by default the compiler uses standard reload.
15868
15869 @item -mnodiv
15870 @opindex mnodiv
15871 Do not use div and mod instructions.
15872
15873 @end table
15874
15875 @node FRV Options
15876 @subsection FRV Options
15877 @cindex FRV Options
15878
15879 @table @gcctabopt
15880 @item -mgpr-32
15881 @opindex mgpr-32
15882
15883 Only use the first 32 general-purpose registers.
15884
15885 @item -mgpr-64
15886 @opindex mgpr-64
15887
15888 Use all 64 general-purpose registers.
15889
15890 @item -mfpr-32
15891 @opindex mfpr-32
15892
15893 Use only the first 32 floating-point registers.
15894
15895 @item -mfpr-64
15896 @opindex mfpr-64
15897
15898 Use all 64 floating-point registers.
15899
15900 @item -mhard-float
15901 @opindex mhard-float
15902
15903 Use hardware instructions for floating-point operations.
15904
15905 @item -msoft-float
15906 @opindex msoft-float
15907
15908 Use library routines for floating-point operations.
15909
15910 @item -malloc-cc
15911 @opindex malloc-cc
15912
15913 Dynamically allocate condition code registers.
15914
15915 @item -mfixed-cc
15916 @opindex mfixed-cc
15917
15918 Do not try to dynamically allocate condition code registers, only
15919 use @code{icc0} and @code{fcc0}.
15920
15921 @item -mdword
15922 @opindex mdword
15923
15924 Change ABI to use double word insns.
15925
15926 @item -mno-dword
15927 @opindex mno-dword
15928
15929 Do not use double word instructions.
15930
15931 @item -mdouble
15932 @opindex mdouble
15933
15934 Use floating-point double instructions.
15935
15936 @item -mno-double
15937 @opindex mno-double
15938
15939 Do not use floating-point double instructions.
15940
15941 @item -mmedia
15942 @opindex mmedia
15943
15944 Use media instructions.
15945
15946 @item -mno-media
15947 @opindex mno-media
15948
15949 Do not use media instructions.
15950
15951 @item -mmuladd
15952 @opindex mmuladd
15953
15954 Use multiply and add/subtract instructions.
15955
15956 @item -mno-muladd
15957 @opindex mno-muladd
15958
15959 Do not use multiply and add/subtract instructions.
15960
15961 @item -mfdpic
15962 @opindex mfdpic
15963
15964 Select the FDPIC ABI, which uses function descriptors to represent
15965 pointers to functions. Without any PIC/PIE-related options, it
15966 implies @option{-fPIE}. With @option{-fpic} or @option{-fpie}, it
15967 assumes GOT entries and small data are within a 12-bit range from the
15968 GOT base address; with @option{-fPIC} or @option{-fPIE}, GOT offsets
15969 are computed with 32 bits.
15970 With a @samp{bfin-elf} target, this option implies @option{-msim}.
15971
15972 @item -minline-plt
15973 @opindex minline-plt
15974
15975 Enable inlining of PLT entries in function calls to functions that are
15976 not known to bind locally. It has no effect without @option{-mfdpic}.
15977 It's enabled by default if optimizing for speed and compiling for
15978 shared libraries (i.e., @option{-fPIC} or @option{-fpic}), or when an
15979 optimization option such as @option{-O3} or above is present in the
15980 command line.
15981
15982 @item -mTLS
15983 @opindex mTLS
15984
15985 Assume a large TLS segment when generating thread-local code.
15986
15987 @item -mtls
15988 @opindex mtls
15989
15990 Do not assume a large TLS segment when generating thread-local code.
15991
15992 @item -mgprel-ro
15993 @opindex mgprel-ro
15994
15995 Enable the use of @code{GPREL} relocations in the FDPIC ABI for data
15996 that is known to be in read-only sections. It's enabled by default,
15997 except for @option{-fpic} or @option{-fpie}: even though it may help
15998 make the global offset table smaller, it trades 1 instruction for 4.
15999 With @option{-fPIC} or @option{-fPIE}, it trades 3 instructions for 4,
16000 one of which may be shared by multiple symbols, and it avoids the need
16001 for a GOT entry for the referenced symbol, so it's more likely to be a
16002 win. If it is not, @option{-mno-gprel-ro} can be used to disable it.
16003
16004 @item -multilib-library-pic
16005 @opindex multilib-library-pic
16006
16007 Link with the (library, not FD) pic libraries. It's implied by
16008 @option{-mlibrary-pic}, as well as by @option{-fPIC} and
16009 @option{-fpic} without @option{-mfdpic}. You should never have to use
16010 it explicitly.
16011
16012 @item -mlinked-fp
16013 @opindex mlinked-fp
16014
16015 Follow the EABI requirement of always creating a frame pointer whenever
16016 a stack frame is allocated. This option is enabled by default and can
16017 be disabled with @option{-mno-linked-fp}.
16018
16019 @item -mlong-calls
16020 @opindex mlong-calls
16021
16022 Use indirect addressing to call functions outside the current
16023 compilation unit. This allows the functions to be placed anywhere
16024 within the 32-bit address space.
16025
16026 @item -malign-labels
16027 @opindex malign-labels
16028
16029 Try to align labels to an 8-byte boundary by inserting NOPs into the
16030 previous packet. This option only has an effect when VLIW packing
16031 is enabled. It doesn't create new packets; it merely adds NOPs to
16032 existing ones.
16033
16034 @item -mlibrary-pic
16035 @opindex mlibrary-pic
16036
16037 Generate position-independent EABI code.
16038
16039 @item -macc-4
16040 @opindex macc-4
16041
16042 Use only the first four media accumulator registers.
16043
16044 @item -macc-8
16045 @opindex macc-8
16046
16047 Use all eight media accumulator registers.
16048
16049 @item -mpack
16050 @opindex mpack
16051
16052 Pack VLIW instructions.
16053
16054 @item -mno-pack
16055 @opindex mno-pack
16056
16057 Do not pack VLIW instructions.
16058
16059 @item -mno-eflags
16060 @opindex mno-eflags
16061
16062 Do not mark ABI switches in e_flags.
16063
16064 @item -mcond-move
16065 @opindex mcond-move
16066
16067 Enable the use of conditional-move instructions (default).
16068
16069 This switch is mainly for debugging the compiler and will likely be removed
16070 in a future version.
16071
16072 @item -mno-cond-move
16073 @opindex mno-cond-move
16074
16075 Disable the use of conditional-move instructions.
16076
16077 This switch is mainly for debugging the compiler and will likely be removed
16078 in a future version.
16079
16080 @item -mscc
16081 @opindex mscc
16082
16083 Enable the use of conditional set instructions (default).
16084
16085 This switch is mainly for debugging the compiler and will likely be removed
16086 in a future version.
16087
16088 @item -mno-scc
16089 @opindex mno-scc
16090
16091 Disable the use of conditional set instructions.
16092
16093 This switch is mainly for debugging the compiler and will likely be removed
16094 in a future version.
16095
16096 @item -mcond-exec
16097 @opindex mcond-exec
16098
16099 Enable the use of conditional execution (default).
16100
16101 This switch is mainly for debugging the compiler and will likely be removed
16102 in a future version.
16103
16104 @item -mno-cond-exec
16105 @opindex mno-cond-exec
16106
16107 Disable the use of conditional execution.
16108
16109 This switch is mainly for debugging the compiler and will likely be removed
16110 in a future version.
16111
16112 @item -mvliw-branch
16113 @opindex mvliw-branch
16114
16115 Run a pass to pack branches into VLIW instructions (default).
16116
16117 This switch is mainly for debugging the compiler and will likely be removed
16118 in a future version.
16119
16120 @item -mno-vliw-branch
16121 @opindex mno-vliw-branch
16122
16123 Do not run a pass to pack branches into VLIW instructions.
16124
16125 This switch is mainly for debugging the compiler and will likely be removed
16126 in a future version.
16127
16128 @item -mmulti-cond-exec
16129 @opindex mmulti-cond-exec
16130
16131 Enable optimization of @code{&&} and @code{||} in conditional execution
16132 (default).
16133
16134 This switch is mainly for debugging the compiler and will likely be removed
16135 in a future version.
16136
16137 @item -mno-multi-cond-exec
16138 @opindex mno-multi-cond-exec
16139
16140 Disable optimization of @code{&&} and @code{||} in conditional execution.
16141
16142 This switch is mainly for debugging the compiler and will likely be removed
16143 in a future version.
16144
16145 @item -mnested-cond-exec
16146 @opindex mnested-cond-exec
16147
16148 Enable nested conditional execution optimizations (default).
16149
16150 This switch is mainly for debugging the compiler and will likely be removed
16151 in a future version.
16152
16153 @item -mno-nested-cond-exec
16154 @opindex mno-nested-cond-exec
16155
16156 Disable nested conditional execution optimizations.
16157
16158 This switch is mainly for debugging the compiler and will likely be removed
16159 in a future version.
16160
16161 @item -moptimize-membar
16162 @opindex moptimize-membar
16163
16164 This switch removes redundant @code{membar} instructions from the
16165 compiler-generated code. It is enabled by default.
16166
16167 @item -mno-optimize-membar
16168 @opindex mno-optimize-membar
16169
16170 This switch disables the automatic removal of redundant @code{membar}
16171 instructions from the generated code.
16172
16173 @item -mtomcat-stats
16174 @opindex mtomcat-stats
16175
16176 Cause gas to print out tomcat statistics.
16177
16178 @item -mcpu=@var{cpu}
16179 @opindex mcpu
16180
16181 Select the processor type for which to generate code. Possible values are
16182 @samp{frv}, @samp{fr550}, @samp{tomcat}, @samp{fr500}, @samp{fr450},
16183 @samp{fr405}, @samp{fr400}, @samp{fr300} and @samp{simple}.
16184
16185 @end table
16186
16187 @node GNU/Linux Options
16188 @subsection GNU/Linux Options
16189
16190 These @samp{-m} options are defined for GNU/Linux targets:
16191
16192 @table @gcctabopt
16193 @item -mglibc
16194 @opindex mglibc
16195 Use the GNU C library. This is the default except
16196 on @samp{*-*-linux-*uclibc*}, @samp{*-*-linux-*musl*} and
16197 @samp{*-*-linux-*android*} targets.
16198
16199 @item -muclibc
16200 @opindex muclibc
16201 Use uClibc C library. This is the default on
16202 @samp{*-*-linux-*uclibc*} targets.
16203
16204 @item -mmusl
16205 @opindex mmusl
16206 Use the musl C library. This is the default on
16207 @samp{*-*-linux-*musl*} targets.
16208
16209 @item -mbionic
16210 @opindex mbionic
16211 Use Bionic C library. This is the default on
16212 @samp{*-*-linux-*android*} targets.
16213
16214 @item -mandroid
16215 @opindex mandroid
16216 Compile code compatible with Android platform. This is the default on
16217 @samp{*-*-linux-*android*} targets.
16218
16219 When compiling, this option enables @option{-mbionic}, @option{-fPIC},
16220 @option{-fno-exceptions} and @option{-fno-rtti} by default. When linking,
16221 this option makes the GCC driver pass Android-specific options to the linker.
16222 Finally, this option causes the preprocessor macro @code{__ANDROID__}
16223 to be defined.
16224
16225 @item -tno-android-cc
16226 @opindex tno-android-cc
16227 Disable compilation effects of @option{-mandroid}, i.e., do not enable
16228 @option{-mbionic}, @option{-fPIC}, @option{-fno-exceptions} and
16229 @option{-fno-rtti} by default.
16230
16231 @item -tno-android-ld
16232 @opindex tno-android-ld
16233 Disable linking effects of @option{-mandroid}, i.e., pass standard Linux
16234 linking options to the linker.
16235
16236 @end table
16237
16238 @node H8/300 Options
16239 @subsection H8/300 Options
16240
16241 These @samp{-m} options are defined for the H8/300 implementations:
16242
16243 @table @gcctabopt
16244 @item -mrelax
16245 @opindex mrelax
16246 Shorten some address references at link time, when possible; uses the
16247 linker option @option{-relax}. @xref{H8/300,, @code{ld} and the H8/300,
16248 ld, Using ld}, for a fuller description.
16249
16250 @item -mh
16251 @opindex mh
16252 Generate code for the H8/300H@.
16253
16254 @item -ms
16255 @opindex ms
16256 Generate code for the H8S@.
16257
16258 @item -mn
16259 @opindex mn
16260 Generate code for the H8S and H8/300H in the normal mode. This switch
16261 must be used either with @option{-mh} or @option{-ms}.
16262
16263 @item -ms2600
16264 @opindex ms2600
16265 Generate code for the H8S/2600. This switch must be used with @option{-ms}.
16266
16267 @item -mexr
16268 @opindex mexr
16269 Extended registers are stored on stack before execution of function
16270 with monitor attribute. Default option is @option{-mexr}.
16271 This option is valid only for H8S targets.
16272
16273 @item -mno-exr
16274 @opindex mno-exr
16275 Extended registers are not stored on stack before execution of function
16276 with monitor attribute. Default option is @option{-mno-exr}.
16277 This option is valid only for H8S targets.
16278
16279 @item -mint32
16280 @opindex mint32
16281 Make @code{int} data 32 bits by default.
16282
16283 @item -malign-300
16284 @opindex malign-300
16285 On the H8/300H and H8S, use the same alignment rules as for the H8/300.
16286 The default for the H8/300H and H8S is to align longs and floats on
16287 4-byte boundaries.
16288 @option{-malign-300} causes them to be aligned on 2-byte boundaries.
16289 This option has no effect on the H8/300.
16290 @end table
16291
16292 @node HPPA Options
16293 @subsection HPPA Options
16294 @cindex HPPA Options
16295
16296 These @samp{-m} options are defined for the HPPA family of computers:
16297
16298 @table @gcctabopt
16299 @item -march=@var{architecture-type}
16300 @opindex march
16301 Generate code for the specified architecture. The choices for
16302 @var{architecture-type} are @samp{1.0} for PA 1.0, @samp{1.1} for PA
16303 1.1, and @samp{2.0} for PA 2.0 processors. Refer to
16304 @file{/usr/lib/sched.models} on an HP-UX system to determine the proper
16305 architecture option for your machine. Code compiled for lower numbered
16306 architectures runs on higher numbered architectures, but not the
16307 other way around.
16308
16309 @item -mpa-risc-1-0
16310 @itemx -mpa-risc-1-1
16311 @itemx -mpa-risc-2-0
16312 @opindex mpa-risc-1-0
16313 @opindex mpa-risc-1-1
16314 @opindex mpa-risc-2-0
16315 Synonyms for @option{-march=1.0}, @option{-march=1.1}, and @option{-march=2.0} respectively.
16316
16317 @item -mjump-in-delay
16318 @opindex mjump-in-delay
16319 This option is ignored and provided for compatibility purposes only.
16320
16321 @item -mdisable-fpregs
16322 @opindex mdisable-fpregs
16323 Prevent floating-point registers from being used in any manner. This is
16324 necessary for compiling kernels that perform lazy context switching of
16325 floating-point registers. If you use this option and attempt to perform
16326 floating-point operations, the compiler aborts.
16327
16328 @item -mdisable-indexing
16329 @opindex mdisable-indexing
16330 Prevent the compiler from using indexing address modes. This avoids some
16331 rather obscure problems when compiling MIG generated code under MACH@.
16332
16333 @item -mno-space-regs
16334 @opindex mno-space-regs
16335 Generate code that assumes the target has no space registers. This allows
16336 GCC to generate faster indirect calls and use unscaled index address modes.
16337
16338 Such code is suitable for level 0 PA systems and kernels.
16339
16340 @item -mfast-indirect-calls
16341 @opindex mfast-indirect-calls
16342 Generate code that assumes calls never cross space boundaries. This
16343 allows GCC to emit code that performs faster indirect calls.
16344
16345 This option does not work in the presence of shared libraries or nested
16346 functions.
16347
16348 @item -mfixed-range=@var{register-range}
16349 @opindex mfixed-range
16350 Generate code treating the given register range as fixed registers.
16351 A fixed register is one that the register allocator cannot use. This is
16352 useful when compiling kernel code. A register range is specified as
16353 two registers separated by a dash. Multiple register ranges can be
16354 specified separated by a comma.
16355
16356 @item -mlong-load-store
16357 @opindex mlong-load-store
16358 Generate 3-instruction load and store sequences as sometimes required by
16359 the HP-UX 10 linker. This is equivalent to the @samp{+k} option to
16360 the HP compilers.
16361
16362 @item -mportable-runtime
16363 @opindex mportable-runtime
16364 Use the portable calling conventions proposed by HP for ELF systems.
16365
16366 @item -mgas
16367 @opindex mgas
16368 Enable the use of assembler directives only GAS understands.
16369
16370 @item -mschedule=@var{cpu-type}
16371 @opindex mschedule
16372 Schedule code according to the constraints for the machine type
16373 @var{cpu-type}. The choices for @var{cpu-type} are @samp{700}
16374 @samp{7100}, @samp{7100LC}, @samp{7200}, @samp{7300} and @samp{8000}. Refer
16375 to @file{/usr/lib/sched.models} on an HP-UX system to determine the
16376 proper scheduling option for your machine. The default scheduling is
16377 @samp{8000}.
16378
16379 @item -mlinker-opt
16380 @opindex mlinker-opt
16381 Enable the optimization pass in the HP-UX linker. Note this makes symbolic
16382 debugging impossible. It also triggers a bug in the HP-UX 8 and HP-UX 9
16383 linkers in which they give bogus error messages when linking some programs.
16384
16385 @item -msoft-float
16386 @opindex msoft-float
16387 Generate output containing library calls for floating point.
16388 @strong{Warning:} the requisite libraries are not available for all HPPA
16389 targets. Normally the facilities of the machine's usual C compiler are
16390 used, but this cannot be done directly in cross-compilation. You must make
16391 your own arrangements to provide suitable library functions for
16392 cross-compilation.
16393
16394 @option{-msoft-float} changes the calling convention in the output file;
16395 therefore, it is only useful if you compile @emph{all} of a program with
16396 this option. In particular, you need to compile @file{libgcc.a}, the
16397 library that comes with GCC, with @option{-msoft-float} in order for
16398 this to work.
16399
16400 @item -msio
16401 @opindex msio
16402 Generate the predefine, @code{_SIO}, for server IO@. The default is
16403 @option{-mwsio}. This generates the predefines, @code{__hp9000s700},
16404 @code{__hp9000s700__} and @code{_WSIO}, for workstation IO@. These
16405 options are available under HP-UX and HI-UX@.
16406
16407 @item -mgnu-ld
16408 @opindex mgnu-ld
16409 Use options specific to GNU @command{ld}.
16410 This passes @option{-shared} to @command{ld} when
16411 building a shared library. It is the default when GCC is configured,
16412 explicitly or implicitly, with the GNU linker. This option does not
16413 affect which @command{ld} is called; it only changes what parameters
16414 are passed to that @command{ld}.
16415 The @command{ld} that is called is determined by the
16416 @option{--with-ld} configure option, GCC's program search path, and
16417 finally by the user's @env{PATH}. The linker used by GCC can be printed
16418 using @samp{which `gcc -print-prog-name=ld`}. This option is only available
16419 on the 64-bit HP-UX GCC, i.e.@: configured with @samp{hppa*64*-*-hpux*}.
16420
16421 @item -mhp-ld
16422 @opindex mhp-ld
16423 Use options specific to HP @command{ld}.
16424 This passes @option{-b} to @command{ld} when building
16425 a shared library and passes @option{+Accept TypeMismatch} to @command{ld} on all
16426 links. It is the default when GCC is configured, explicitly or
16427 implicitly, with the HP linker. This option does not affect
16428 which @command{ld} is called; it only changes what parameters are passed to that
16429 @command{ld}.
16430 The @command{ld} that is called is determined by the @option{--with-ld}
16431 configure option, GCC's program search path, and finally by the user's
16432 @env{PATH}. The linker used by GCC can be printed using @samp{which
16433 `gcc -print-prog-name=ld`}. This option is only available on the 64-bit
16434 HP-UX GCC, i.e.@: configured with @samp{hppa*64*-*-hpux*}.
16435
16436 @item -mlong-calls
16437 @opindex mno-long-calls
16438 Generate code that uses long call sequences. This ensures that a call
16439 is always able to reach linker generated stubs. The default is to generate
16440 long calls only when the distance from the call site to the beginning
16441 of the function or translation unit, as the case may be, exceeds a
16442 predefined limit set by the branch type being used. The limits for
16443 normal calls are 7,600,000 and 240,000 bytes, respectively for the
16444 PA 2.0 and PA 1.X architectures. Sibcalls are always limited at
16445 240,000 bytes.
16446
16447 Distances are measured from the beginning of functions when using the
16448 @option{-ffunction-sections} option, or when using the @option{-mgas}
16449 and @option{-mno-portable-runtime} options together under HP-UX with
16450 the SOM linker.
16451
16452 It is normally not desirable to use this option as it degrades
16453 performance. However, it may be useful in large applications,
16454 particularly when partial linking is used to build the application.
16455
16456 The types of long calls used depends on the capabilities of the
16457 assembler and linker, and the type of code being generated. The
16458 impact on systems that support long absolute calls, and long pic
16459 symbol-difference or pc-relative calls should be relatively small.
16460 However, an indirect call is used on 32-bit ELF systems in pic code
16461 and it is quite long.
16462
16463 @item -munix=@var{unix-std}
16464 @opindex march
16465 Generate compiler predefines and select a startfile for the specified
16466 UNIX standard. The choices for @var{unix-std} are @samp{93}, @samp{95}
16467 and @samp{98}. @samp{93} is supported on all HP-UX versions. @samp{95}
16468 is available on HP-UX 10.10 and later. @samp{98} is available on HP-UX
16469 11.11 and later. The default values are @samp{93} for HP-UX 10.00,
16470 @samp{95} for HP-UX 10.10 though to 11.00, and @samp{98} for HP-UX 11.11
16471 and later.
16472
16473 @option{-munix=93} provides the same predefines as GCC 3.3 and 3.4.
16474 @option{-munix=95} provides additional predefines for @code{XOPEN_UNIX}
16475 and @code{_XOPEN_SOURCE_EXTENDED}, and the startfile @file{unix95.o}.
16476 @option{-munix=98} provides additional predefines for @code{_XOPEN_UNIX},
16477 @code{_XOPEN_SOURCE_EXTENDED}, @code{_INCLUDE__STDC_A1_SOURCE} and
16478 @code{_INCLUDE_XOPEN_SOURCE_500}, and the startfile @file{unix98.o}.
16479
16480 It is @emph{important} to note that this option changes the interfaces
16481 for various library routines. It also affects the operational behavior
16482 of the C library. Thus, @emph{extreme} care is needed in using this
16483 option.
16484
16485 Library code that is intended to operate with more than one UNIX
16486 standard must test, set and restore the variable @code{__xpg4_extended_mask}
16487 as appropriate. Most GNU software doesn't provide this capability.
16488
16489 @item -nolibdld
16490 @opindex nolibdld
16491 Suppress the generation of link options to search libdld.sl when the
16492 @option{-static} option is specified on HP-UX 10 and later.
16493
16494 @item -static
16495 @opindex static
16496 The HP-UX implementation of setlocale in libc has a dependency on
16497 libdld.sl. There isn't an archive version of libdld.sl. Thus,
16498 when the @option{-static} option is specified, special link options
16499 are needed to resolve this dependency.
16500
16501 On HP-UX 10 and later, the GCC driver adds the necessary options to
16502 link with libdld.sl when the @option{-static} option is specified.
16503 This causes the resulting binary to be dynamic. On the 64-bit port,
16504 the linkers generate dynamic binaries by default in any case. The
16505 @option{-nolibdld} option can be used to prevent the GCC driver from
16506 adding these link options.
16507
16508 @item -threads
16509 @opindex threads
16510 Add support for multithreading with the @dfn{dce thread} library
16511 under HP-UX@. This option sets flags for both the preprocessor and
16512 linker.
16513 @end table
16514
16515 @node IA-64 Options
16516 @subsection IA-64 Options
16517 @cindex IA-64 Options
16518
16519 These are the @samp{-m} options defined for the Intel IA-64 architecture.
16520
16521 @table @gcctabopt
16522 @item -mbig-endian
16523 @opindex mbig-endian
16524 Generate code for a big-endian target. This is the default for HP-UX@.
16525
16526 @item -mlittle-endian
16527 @opindex mlittle-endian
16528 Generate code for a little-endian target. This is the default for AIX5
16529 and GNU/Linux.
16530
16531 @item -mgnu-as
16532 @itemx -mno-gnu-as
16533 @opindex mgnu-as
16534 @opindex mno-gnu-as
16535 Generate (or don't) code for the GNU assembler. This is the default.
16536 @c Also, this is the default if the configure option @option{--with-gnu-as}
16537 @c is used.
16538
16539 @item -mgnu-ld
16540 @itemx -mno-gnu-ld
16541 @opindex mgnu-ld
16542 @opindex mno-gnu-ld
16543 Generate (or don't) code for the GNU linker. This is the default.
16544 @c Also, this is the default if the configure option @option{--with-gnu-ld}
16545 @c is used.
16546
16547 @item -mno-pic
16548 @opindex mno-pic
16549 Generate code that does not use a global pointer register. The result
16550 is not position independent code, and violates the IA-64 ABI@.
16551
16552 @item -mvolatile-asm-stop
16553 @itemx -mno-volatile-asm-stop
16554 @opindex mvolatile-asm-stop
16555 @opindex mno-volatile-asm-stop
16556 Generate (or don't) a stop bit immediately before and after volatile asm
16557 statements.
16558
16559 @item -mregister-names
16560 @itemx -mno-register-names
16561 @opindex mregister-names
16562 @opindex mno-register-names
16563 Generate (or don't) @samp{in}, @samp{loc}, and @samp{out} register names for
16564 the stacked registers. This may make assembler output more readable.
16565
16566 @item -mno-sdata
16567 @itemx -msdata
16568 @opindex mno-sdata
16569 @opindex msdata
16570 Disable (or enable) optimizations that use the small data section. This may
16571 be useful for working around optimizer bugs.
16572
16573 @item -mconstant-gp
16574 @opindex mconstant-gp
16575 Generate code that uses a single constant global pointer value. This is
16576 useful when compiling kernel code.
16577
16578 @item -mauto-pic
16579 @opindex mauto-pic
16580 Generate code that is self-relocatable. This implies @option{-mconstant-gp}.
16581 This is useful when compiling firmware code.
16582
16583 @item -minline-float-divide-min-latency
16584 @opindex minline-float-divide-min-latency
16585 Generate code for inline divides of floating-point values
16586 using the minimum latency algorithm.
16587
16588 @item -minline-float-divide-max-throughput
16589 @opindex minline-float-divide-max-throughput
16590 Generate code for inline divides of floating-point values
16591 using the maximum throughput algorithm.
16592
16593 @item -mno-inline-float-divide
16594 @opindex mno-inline-float-divide
16595 Do not generate inline code for divides of floating-point values.
16596
16597 @item -minline-int-divide-min-latency
16598 @opindex minline-int-divide-min-latency
16599 Generate code for inline divides of integer values
16600 using the minimum latency algorithm.
16601
16602 @item -minline-int-divide-max-throughput
16603 @opindex minline-int-divide-max-throughput
16604 Generate code for inline divides of integer values
16605 using the maximum throughput algorithm.
16606
16607 @item -mno-inline-int-divide
16608 @opindex mno-inline-int-divide
16609 Do not generate inline code for divides of integer values.
16610
16611 @item -minline-sqrt-min-latency
16612 @opindex minline-sqrt-min-latency
16613 Generate code for inline square roots
16614 using the minimum latency algorithm.
16615
16616 @item -minline-sqrt-max-throughput
16617 @opindex minline-sqrt-max-throughput
16618 Generate code for inline square roots
16619 using the maximum throughput algorithm.
16620
16621 @item -mno-inline-sqrt
16622 @opindex mno-inline-sqrt
16623 Do not generate inline code for @code{sqrt}.
16624
16625 @item -mfused-madd
16626 @itemx -mno-fused-madd
16627 @opindex mfused-madd
16628 @opindex mno-fused-madd
16629 Do (don't) generate code that uses the fused multiply/add or multiply/subtract
16630 instructions. The default is to use these instructions.
16631
16632 @item -mno-dwarf2-asm
16633 @itemx -mdwarf2-asm
16634 @opindex mno-dwarf2-asm
16635 @opindex mdwarf2-asm
16636 Don't (or do) generate assembler code for the DWARF line number debugging
16637 info. This may be useful when not using the GNU assembler.
16638
16639 @item -mearly-stop-bits
16640 @itemx -mno-early-stop-bits
16641 @opindex mearly-stop-bits
16642 @opindex mno-early-stop-bits
16643 Allow stop bits to be placed earlier than immediately preceding the
16644 instruction that triggered the stop bit. This can improve instruction
16645 scheduling, but does not always do so.
16646
16647 @item -mfixed-range=@var{register-range}
16648 @opindex mfixed-range
16649 Generate code treating the given register range as fixed registers.
16650 A fixed register is one that the register allocator cannot use. This is
16651 useful when compiling kernel code. A register range is specified as
16652 two registers separated by a dash. Multiple register ranges can be
16653 specified separated by a comma.
16654
16655 @item -mtls-size=@var{tls-size}
16656 @opindex mtls-size
16657 Specify bit size of immediate TLS offsets. Valid values are 14, 22, and
16658 64.
16659
16660 @item -mtune=@var{cpu-type}
16661 @opindex mtune
16662 Tune the instruction scheduling for a particular CPU, Valid values are
16663 @samp{itanium}, @samp{itanium1}, @samp{merced}, @samp{itanium2},
16664 and @samp{mckinley}.
16665
16666 @item -milp32
16667 @itemx -mlp64
16668 @opindex milp32
16669 @opindex mlp64
16670 Generate code for a 32-bit or 64-bit environment.
16671 The 32-bit environment sets int, long and pointer to 32 bits.
16672 The 64-bit environment sets int to 32 bits and long and pointer
16673 to 64 bits. These are HP-UX specific flags.
16674
16675 @item -mno-sched-br-data-spec
16676 @itemx -msched-br-data-spec
16677 @opindex mno-sched-br-data-spec
16678 @opindex msched-br-data-spec
16679 (Dis/En)able data speculative scheduling before reload.
16680 This results in generation of @code{ld.a} instructions and
16681 the corresponding check instructions (@code{ld.c} / @code{chk.a}).
16682 The default setting is disabled.
16683
16684 @item -msched-ar-data-spec
16685 @itemx -mno-sched-ar-data-spec
16686 @opindex msched-ar-data-spec
16687 @opindex mno-sched-ar-data-spec
16688 (En/Dis)able data speculative scheduling after reload.
16689 This results in generation of @code{ld.a} instructions and
16690 the corresponding check instructions (@code{ld.c} / @code{chk.a}).
16691 The default setting is enabled.
16692
16693 @item -mno-sched-control-spec
16694 @itemx -msched-control-spec
16695 @opindex mno-sched-control-spec
16696 @opindex msched-control-spec
16697 (Dis/En)able control speculative scheduling. This feature is
16698 available only during region scheduling (i.e.@: before reload).
16699 This results in generation of the @code{ld.s} instructions and
16700 the corresponding check instructions @code{chk.s}.
16701 The default setting is disabled.
16702
16703 @item -msched-br-in-data-spec
16704 @itemx -mno-sched-br-in-data-spec
16705 @opindex msched-br-in-data-spec
16706 @opindex mno-sched-br-in-data-spec
16707 (En/Dis)able speculative scheduling of the instructions that
16708 are dependent on the data speculative loads before reload.
16709 This is effective only with @option{-msched-br-data-spec} enabled.
16710 The default setting is enabled.
16711
16712 @item -msched-ar-in-data-spec
16713 @itemx -mno-sched-ar-in-data-spec
16714 @opindex msched-ar-in-data-spec
16715 @opindex mno-sched-ar-in-data-spec
16716 (En/Dis)able speculative scheduling of the instructions that
16717 are dependent on the data speculative loads after reload.
16718 This is effective only with @option{-msched-ar-data-spec} enabled.
16719 The default setting is enabled.
16720
16721 @item -msched-in-control-spec
16722 @itemx -mno-sched-in-control-spec
16723 @opindex msched-in-control-spec
16724 @opindex mno-sched-in-control-spec
16725 (En/Dis)able speculative scheduling of the instructions that
16726 are dependent on the control speculative loads.
16727 This is effective only with @option{-msched-control-spec} enabled.
16728 The default setting is enabled.
16729
16730 @item -mno-sched-prefer-non-data-spec-insns
16731 @itemx -msched-prefer-non-data-spec-insns
16732 @opindex mno-sched-prefer-non-data-spec-insns
16733 @opindex msched-prefer-non-data-spec-insns
16734 If enabled, data-speculative instructions are chosen for schedule
16735 only if there are no other choices at the moment. This makes
16736 the use of the data speculation much more conservative.
16737 The default setting is disabled.
16738
16739 @item -mno-sched-prefer-non-control-spec-insns
16740 @itemx -msched-prefer-non-control-spec-insns
16741 @opindex mno-sched-prefer-non-control-spec-insns
16742 @opindex msched-prefer-non-control-spec-insns
16743 If enabled, control-speculative instructions are chosen for schedule
16744 only if there are no other choices at the moment. This makes
16745 the use of the control speculation much more conservative.
16746 The default setting is disabled.
16747
16748 @item -mno-sched-count-spec-in-critical-path
16749 @itemx -msched-count-spec-in-critical-path
16750 @opindex mno-sched-count-spec-in-critical-path
16751 @opindex msched-count-spec-in-critical-path
16752 If enabled, speculative dependencies are considered during
16753 computation of the instructions priorities. This makes the use of the
16754 speculation a bit more conservative.
16755 The default setting is disabled.
16756
16757 @item -msched-spec-ldc
16758 @opindex msched-spec-ldc
16759 Use a simple data speculation check. This option is on by default.
16760
16761 @item -msched-control-spec-ldc
16762 @opindex msched-spec-ldc
16763 Use a simple check for control speculation. This option is on by default.
16764
16765 @item -msched-stop-bits-after-every-cycle
16766 @opindex msched-stop-bits-after-every-cycle
16767 Place a stop bit after every cycle when scheduling. This option is on
16768 by default.
16769
16770 @item -msched-fp-mem-deps-zero-cost
16771 @opindex msched-fp-mem-deps-zero-cost
16772 Assume that floating-point stores and loads are not likely to cause a conflict
16773 when placed into the same instruction group. This option is disabled by
16774 default.
16775
16776 @item -msel-sched-dont-check-control-spec
16777 @opindex msel-sched-dont-check-control-spec
16778 Generate checks for control speculation in selective scheduling.
16779 This flag is disabled by default.
16780
16781 @item -msched-max-memory-insns=@var{max-insns}
16782 @opindex msched-max-memory-insns
16783 Limit on the number of memory insns per instruction group, giving lower
16784 priority to subsequent memory insns attempting to schedule in the same
16785 instruction group. Frequently useful to prevent cache bank conflicts.
16786 The default value is 1.
16787
16788 @item -msched-max-memory-insns-hard-limit
16789 @opindex msched-max-memory-insns-hard-limit
16790 Makes the limit specified by @option{msched-max-memory-insns} a hard limit,
16791 disallowing more than that number in an instruction group.
16792 Otherwise, the limit is ``soft'', meaning that non-memory operations
16793 are preferred when the limit is reached, but memory operations may still
16794 be scheduled.
16795
16796 @end table
16797
16798 @node LM32 Options
16799 @subsection LM32 Options
16800 @cindex LM32 options
16801
16802 These @option{-m} options are defined for the LatticeMico32 architecture:
16803
16804 @table @gcctabopt
16805 @item -mbarrel-shift-enabled
16806 @opindex mbarrel-shift-enabled
16807 Enable barrel-shift instructions.
16808
16809 @item -mdivide-enabled
16810 @opindex mdivide-enabled
16811 Enable divide and modulus instructions.
16812
16813 @item -mmultiply-enabled
16814 @opindex multiply-enabled
16815 Enable multiply instructions.
16816
16817 @item -msign-extend-enabled
16818 @opindex msign-extend-enabled
16819 Enable sign extend instructions.
16820
16821 @item -muser-enabled
16822 @opindex muser-enabled
16823 Enable user-defined instructions.
16824
16825 @end table
16826
16827 @node M32C Options
16828 @subsection M32C Options
16829 @cindex M32C options
16830
16831 @table @gcctabopt
16832 @item -mcpu=@var{name}
16833 @opindex mcpu=
16834 Select the CPU for which code is generated. @var{name} may be one of
16835 @samp{r8c} for the R8C/Tiny series, @samp{m16c} for the M16C (up to
16836 /60) series, @samp{m32cm} for the M16C/80 series, or @samp{m32c} for
16837 the M32C/80 series.
16838
16839 @item -msim
16840 @opindex msim
16841 Specifies that the program will be run on the simulator. This causes
16842 an alternate runtime library to be linked in which supports, for
16843 example, file I/O@. You must not use this option when generating
16844 programs that will run on real hardware; you must provide your own
16845 runtime library for whatever I/O functions are needed.
16846
16847 @item -memregs=@var{number}
16848 @opindex memregs=
16849 Specifies the number of memory-based pseudo-registers GCC uses
16850 during code generation. These pseudo-registers are used like real
16851 registers, so there is a tradeoff between GCC's ability to fit the
16852 code into available registers, and the performance penalty of using
16853 memory instead of registers. Note that all modules in a program must
16854 be compiled with the same value for this option. Because of that, you
16855 must not use this option with GCC's default runtime libraries.
16856
16857 @end table
16858
16859 @node M32R/D Options
16860 @subsection M32R/D Options
16861 @cindex M32R/D options
16862
16863 These @option{-m} options are defined for Renesas M32R/D architectures:
16864
16865 @table @gcctabopt
16866 @item -m32r2
16867 @opindex m32r2
16868 Generate code for the M32R/2@.
16869
16870 @item -m32rx
16871 @opindex m32rx
16872 Generate code for the M32R/X@.
16873
16874 @item -m32r
16875 @opindex m32r
16876 Generate code for the M32R@. This is the default.
16877
16878 @item -mmodel=small
16879 @opindex mmodel=small
16880 Assume all objects live in the lower 16MB of memory (so that their addresses
16881 can be loaded with the @code{ld24} instruction), and assume all subroutines
16882 are reachable with the @code{bl} instruction.
16883 This is the default.
16884
16885 The addressability of a particular object can be set with the
16886 @code{model} attribute.
16887
16888 @item -mmodel=medium
16889 @opindex mmodel=medium
16890 Assume objects may be anywhere in the 32-bit address space (the compiler
16891 generates @code{seth/add3} instructions to load their addresses), and
16892 assume all subroutines are reachable with the @code{bl} instruction.
16893
16894 @item -mmodel=large
16895 @opindex mmodel=large
16896 Assume objects may be anywhere in the 32-bit address space (the compiler
16897 generates @code{seth/add3} instructions to load their addresses), and
16898 assume subroutines may not be reachable with the @code{bl} instruction
16899 (the compiler generates the much slower @code{seth/add3/jl}
16900 instruction sequence).
16901
16902 @item -msdata=none
16903 @opindex msdata=none
16904 Disable use of the small data area. Variables are put into
16905 one of @code{.data}, @code{.bss}, or @code{.rodata} (unless the
16906 @code{section} attribute has been specified).
16907 This is the default.
16908
16909 The small data area consists of sections @code{.sdata} and @code{.sbss}.
16910 Objects may be explicitly put in the small data area with the
16911 @code{section} attribute using one of these sections.
16912
16913 @item -msdata=sdata
16914 @opindex msdata=sdata
16915 Put small global and static data in the small data area, but do not
16916 generate special code to reference them.
16917
16918 @item -msdata=use
16919 @opindex msdata=use
16920 Put small global and static data in the small data area, and generate
16921 special instructions to reference them.
16922
16923 @item -G @var{num}
16924 @opindex G
16925 @cindex smaller data references
16926 Put global and static objects less than or equal to @var{num} bytes
16927 into the small data or BSS sections instead of the normal data or BSS
16928 sections. The default value of @var{num} is 8.
16929 The @option{-msdata} option must be set to one of @samp{sdata} or @samp{use}
16930 for this option to have any effect.
16931
16932 All modules should be compiled with the same @option{-G @var{num}} value.
16933 Compiling with different values of @var{num} may or may not work; if it
16934 doesn't the linker gives an error message---incorrect code is not
16935 generated.
16936
16937 @item -mdebug
16938 @opindex mdebug
16939 Makes the M32R-specific code in the compiler display some statistics
16940 that might help in debugging programs.
16941
16942 @item -malign-loops
16943 @opindex malign-loops
16944 Align all loops to a 32-byte boundary.
16945
16946 @item -mno-align-loops
16947 @opindex mno-align-loops
16948 Do not enforce a 32-byte alignment for loops. This is the default.
16949
16950 @item -missue-rate=@var{number}
16951 @opindex missue-rate=@var{number}
16952 Issue @var{number} instructions per cycle. @var{number} can only be 1
16953 or 2.
16954
16955 @item -mbranch-cost=@var{number}
16956 @opindex mbranch-cost=@var{number}
16957 @var{number} can only be 1 or 2. If it is 1 then branches are
16958 preferred over conditional code, if it is 2, then the opposite applies.
16959
16960 @item -mflush-trap=@var{number}
16961 @opindex mflush-trap=@var{number}
16962 Specifies the trap number to use to flush the cache. The default is
16963 12. Valid numbers are between 0 and 15 inclusive.
16964
16965 @item -mno-flush-trap
16966 @opindex mno-flush-trap
16967 Specifies that the cache cannot be flushed by using a trap.
16968
16969 @item -mflush-func=@var{name}
16970 @opindex mflush-func=@var{name}
16971 Specifies the name of the operating system function to call to flush
16972 the cache. The default is @samp{_flush_cache}, but a function call
16973 is only used if a trap is not available.
16974
16975 @item -mno-flush-func
16976 @opindex mno-flush-func
16977 Indicates that there is no OS function for flushing the cache.
16978
16979 @end table
16980
16981 @node M680x0 Options
16982 @subsection M680x0 Options
16983 @cindex M680x0 options
16984
16985 These are the @samp{-m} options defined for M680x0 and ColdFire processors.
16986 The default settings depend on which architecture was selected when
16987 the compiler was configured; the defaults for the most common choices
16988 are given below.
16989
16990 @table @gcctabopt
16991 @item -march=@var{arch}
16992 @opindex march
16993 Generate code for a specific M680x0 or ColdFire instruction set
16994 architecture. Permissible values of @var{arch} for M680x0
16995 architectures are: @samp{68000}, @samp{68010}, @samp{68020},
16996 @samp{68030}, @samp{68040}, @samp{68060} and @samp{cpu32}. ColdFire
16997 architectures are selected according to Freescale's ISA classification
16998 and the permissible values are: @samp{isaa}, @samp{isaaplus},
16999 @samp{isab} and @samp{isac}.
17000
17001 GCC defines a macro @code{__mcf@var{arch}__} whenever it is generating
17002 code for a ColdFire target. The @var{arch} in this macro is one of the
17003 @option{-march} arguments given above.
17004
17005 When used together, @option{-march} and @option{-mtune} select code
17006 that runs on a family of similar processors but that is optimized
17007 for a particular microarchitecture.
17008
17009 @item -mcpu=@var{cpu}
17010 @opindex mcpu
17011 Generate code for a specific M680x0 or ColdFire processor.
17012 The M680x0 @var{cpu}s are: @samp{68000}, @samp{68010}, @samp{68020},
17013 @samp{68030}, @samp{68040}, @samp{68060}, @samp{68302}, @samp{68332}
17014 and @samp{cpu32}. The ColdFire @var{cpu}s are given by the table
17015 below, which also classifies the CPUs into families:
17016
17017 @multitable @columnfractions 0.20 0.80
17018 @item @strong{Family} @tab @strong{@samp{-mcpu} arguments}
17019 @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}
17020 @item @samp{5206} @tab @samp{5202} @samp{5204} @samp{5206}
17021 @item @samp{5206e} @tab @samp{5206e}
17022 @item @samp{5208} @tab @samp{5207} @samp{5208}
17023 @item @samp{5211a} @tab @samp{5210a} @samp{5211a}
17024 @item @samp{5213} @tab @samp{5211} @samp{5212} @samp{5213}
17025 @item @samp{5216} @tab @samp{5214} @samp{5216}
17026 @item @samp{52235} @tab @samp{52230} @samp{52231} @samp{52232} @samp{52233} @samp{52234} @samp{52235}
17027 @item @samp{5225} @tab @samp{5224} @samp{5225}
17028 @item @samp{52259} @tab @samp{52252} @samp{52254} @samp{52255} @samp{52256} @samp{52258} @samp{52259}
17029 @item @samp{5235} @tab @samp{5232} @samp{5233} @samp{5234} @samp{5235} @samp{523x}
17030 @item @samp{5249} @tab @samp{5249}
17031 @item @samp{5250} @tab @samp{5250}
17032 @item @samp{5271} @tab @samp{5270} @samp{5271}
17033 @item @samp{5272} @tab @samp{5272}
17034 @item @samp{5275} @tab @samp{5274} @samp{5275}
17035 @item @samp{5282} @tab @samp{5280} @samp{5281} @samp{5282} @samp{528x}
17036 @item @samp{53017} @tab @samp{53011} @samp{53012} @samp{53013} @samp{53014} @samp{53015} @samp{53016} @samp{53017}
17037 @item @samp{5307} @tab @samp{5307}
17038 @item @samp{5329} @tab @samp{5327} @samp{5328} @samp{5329} @samp{532x}
17039 @item @samp{5373} @tab @samp{5372} @samp{5373} @samp{537x}
17040 @item @samp{5407} @tab @samp{5407}
17041 @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}
17042 @end multitable
17043
17044 @option{-mcpu=@var{cpu}} overrides @option{-march=@var{arch}} if
17045 @var{arch} is compatible with @var{cpu}. Other combinations of
17046 @option{-mcpu} and @option{-march} are rejected.
17047
17048 GCC defines the macro @code{__mcf_cpu_@var{cpu}} when ColdFire target
17049 @var{cpu} is selected. It also defines @code{__mcf_family_@var{family}},
17050 where the value of @var{family} is given by the table above.
17051
17052 @item -mtune=@var{tune}
17053 @opindex mtune
17054 Tune the code for a particular microarchitecture within the
17055 constraints set by @option{-march} and @option{-mcpu}.
17056 The M680x0 microarchitectures are: @samp{68000}, @samp{68010},
17057 @samp{68020}, @samp{68030}, @samp{68040}, @samp{68060}
17058 and @samp{cpu32}. The ColdFire microarchitectures
17059 are: @samp{cfv1}, @samp{cfv2}, @samp{cfv3}, @samp{cfv4} and @samp{cfv4e}.
17060
17061 You can also use @option{-mtune=68020-40} for code that needs
17062 to run relatively well on 68020, 68030 and 68040 targets.
17063 @option{-mtune=68020-60} is similar but includes 68060 targets
17064 as well. These two options select the same tuning decisions as
17065 @option{-m68020-40} and @option{-m68020-60} respectively.
17066
17067 GCC defines the macros @code{__mc@var{arch}} and @code{__mc@var{arch}__}
17068 when tuning for 680x0 architecture @var{arch}. It also defines
17069 @code{mc@var{arch}} unless either @option{-ansi} or a non-GNU @option{-std}
17070 option is used. If GCC is tuning for a range of architectures,
17071 as selected by @option{-mtune=68020-40} or @option{-mtune=68020-60},
17072 it defines the macros for every architecture in the range.
17073
17074 GCC also defines the macro @code{__m@var{uarch}__} when tuning for
17075 ColdFire microarchitecture @var{uarch}, where @var{uarch} is one
17076 of the arguments given above.
17077
17078 @item -m68000
17079 @itemx -mc68000
17080 @opindex m68000
17081 @opindex mc68000
17082 Generate output for a 68000. This is the default
17083 when the compiler is configured for 68000-based systems.
17084 It is equivalent to @option{-march=68000}.
17085
17086 Use this option for microcontrollers with a 68000 or EC000 core,
17087 including the 68008, 68302, 68306, 68307, 68322, 68328 and 68356.
17088
17089 @item -m68010
17090 @opindex m68010
17091 Generate output for a 68010. This is the default
17092 when the compiler is configured for 68010-based systems.
17093 It is equivalent to @option{-march=68010}.
17094
17095 @item -m68020
17096 @itemx -mc68020
17097 @opindex m68020
17098 @opindex mc68020
17099 Generate output for a 68020. This is the default
17100 when the compiler is configured for 68020-based systems.
17101 It is equivalent to @option{-march=68020}.
17102
17103 @item -m68030
17104 @opindex m68030
17105 Generate output for a 68030. This is the default when the compiler is
17106 configured for 68030-based systems. It is equivalent to
17107 @option{-march=68030}.
17108
17109 @item -m68040
17110 @opindex m68040
17111 Generate output for a 68040. This is the default when the compiler is
17112 configured for 68040-based systems. It is equivalent to
17113 @option{-march=68040}.
17114
17115 This option inhibits the use of 68881/68882 instructions that have to be
17116 emulated by software on the 68040. Use this option if your 68040 does not
17117 have code to emulate those instructions.
17118
17119 @item -m68060
17120 @opindex m68060
17121 Generate output for a 68060. This is the default when the compiler is
17122 configured for 68060-based systems. It is equivalent to
17123 @option{-march=68060}.
17124
17125 This option inhibits the use of 68020 and 68881/68882 instructions that
17126 have to be emulated by software on the 68060. Use this option if your 68060
17127 does not have code to emulate those instructions.
17128
17129 @item -mcpu32
17130 @opindex mcpu32
17131 Generate output for a CPU32. This is the default
17132 when the compiler is configured for CPU32-based systems.
17133 It is equivalent to @option{-march=cpu32}.
17134
17135 Use this option for microcontrollers with a
17136 CPU32 or CPU32+ core, including the 68330, 68331, 68332, 68333, 68334,
17137 68336, 68340, 68341, 68349 and 68360.
17138
17139 @item -m5200
17140 @opindex m5200
17141 Generate output for a 520X ColdFire CPU@. This is the default
17142 when the compiler is configured for 520X-based systems.
17143 It is equivalent to @option{-mcpu=5206}, and is now deprecated
17144 in favor of that option.
17145
17146 Use this option for microcontroller with a 5200 core, including
17147 the MCF5202, MCF5203, MCF5204 and MCF5206.
17148
17149 @item -m5206e
17150 @opindex m5206e
17151 Generate output for a 5206e ColdFire CPU@. The option is now
17152 deprecated in favor of the equivalent @option{-mcpu=5206e}.
17153
17154 @item -m528x
17155 @opindex m528x
17156 Generate output for a member of the ColdFire 528X family.
17157 The option is now deprecated in favor of the equivalent
17158 @option{-mcpu=528x}.
17159
17160 @item -m5307
17161 @opindex m5307
17162 Generate output for a ColdFire 5307 CPU@. The option is now deprecated
17163 in favor of the equivalent @option{-mcpu=5307}.
17164
17165 @item -m5407
17166 @opindex m5407
17167 Generate output for a ColdFire 5407 CPU@. The option is now deprecated
17168 in favor of the equivalent @option{-mcpu=5407}.
17169
17170 @item -mcfv4e
17171 @opindex mcfv4e
17172 Generate output for a ColdFire V4e family CPU (e.g.@: 547x/548x).
17173 This includes use of hardware floating-point instructions.
17174 The option is equivalent to @option{-mcpu=547x}, and is now
17175 deprecated in favor of that option.
17176
17177 @item -m68020-40
17178 @opindex m68020-40
17179 Generate output for a 68040, without using any of the new instructions.
17180 This results in code that can run relatively efficiently on either a
17181 68020/68881 or a 68030 or a 68040. The generated code does use the
17182 68881 instructions that are emulated on the 68040.
17183
17184 The option is equivalent to @option{-march=68020} @option{-mtune=68020-40}.
17185
17186 @item -m68020-60
17187 @opindex m68020-60
17188 Generate output for a 68060, without using any of the new instructions.
17189 This results in code that can run relatively efficiently on either a
17190 68020/68881 or a 68030 or a 68040. The generated code does use the
17191 68881 instructions that are emulated on the 68060.
17192
17193 The option is equivalent to @option{-march=68020} @option{-mtune=68020-60}.
17194
17195 @item -mhard-float
17196 @itemx -m68881
17197 @opindex mhard-float
17198 @opindex m68881
17199 Generate floating-point instructions. This is the default for 68020
17200 and above, and for ColdFire devices that have an FPU@. It defines the
17201 macro @code{__HAVE_68881__} on M680x0 targets and @code{__mcffpu__}
17202 on ColdFire targets.
17203
17204 @item -msoft-float
17205 @opindex msoft-float
17206 Do not generate floating-point instructions; use library calls instead.
17207 This is the default for 68000, 68010, and 68832 targets. It is also
17208 the default for ColdFire devices that have no FPU.
17209
17210 @item -mdiv
17211 @itemx -mno-div
17212 @opindex mdiv
17213 @opindex mno-div
17214 Generate (do not generate) ColdFire hardware divide and remainder
17215 instructions. If @option{-march} is used without @option{-mcpu},
17216 the default is ``on'' for ColdFire architectures and ``off'' for M680x0
17217 architectures. Otherwise, the default is taken from the target CPU
17218 (either the default CPU, or the one specified by @option{-mcpu}). For
17219 example, the default is ``off'' for @option{-mcpu=5206} and ``on'' for
17220 @option{-mcpu=5206e}.
17221
17222 GCC defines the macro @code{__mcfhwdiv__} when this option is enabled.
17223
17224 @item -mshort
17225 @opindex mshort
17226 Consider type @code{int} to be 16 bits wide, like @code{short int}.
17227 Additionally, parameters passed on the stack are also aligned to a
17228 16-bit boundary even on targets whose API mandates promotion to 32-bit.
17229
17230 @item -mno-short
17231 @opindex mno-short
17232 Do not consider type @code{int} to be 16 bits wide. This is the default.
17233
17234 @item -mnobitfield
17235 @itemx -mno-bitfield
17236 @opindex mnobitfield
17237 @opindex mno-bitfield
17238 Do not use the bit-field instructions. The @option{-m68000}, @option{-mcpu32}
17239 and @option{-m5200} options imply @w{@option{-mnobitfield}}.
17240
17241 @item -mbitfield
17242 @opindex mbitfield
17243 Do use the bit-field instructions. The @option{-m68020} option implies
17244 @option{-mbitfield}. This is the default if you use a configuration
17245 designed for a 68020.
17246
17247 @item -mrtd
17248 @opindex mrtd
17249 Use a different function-calling convention, in which functions
17250 that take a fixed number of arguments return with the @code{rtd}
17251 instruction, which pops their arguments while returning. This
17252 saves one instruction in the caller since there is no need to pop
17253 the arguments there.
17254
17255 This calling convention is incompatible with the one normally
17256 used on Unix, so you cannot use it if you need to call libraries
17257 compiled with the Unix compiler.
17258
17259 Also, you must provide function prototypes for all functions that
17260 take variable numbers of arguments (including @code{printf});
17261 otherwise incorrect code is generated for calls to those
17262 functions.
17263
17264 In addition, seriously incorrect code results if you call a
17265 function with too many arguments. (Normally, extra arguments are
17266 harmlessly ignored.)
17267
17268 The @code{rtd} instruction is supported by the 68010, 68020, 68030,
17269 68040, 68060 and CPU32 processors, but not by the 68000 or 5200.
17270
17271 @item -mno-rtd
17272 @opindex mno-rtd
17273 Do not use the calling conventions selected by @option{-mrtd}.
17274 This is the default.
17275
17276 @item -malign-int
17277 @itemx -mno-align-int
17278 @opindex malign-int
17279 @opindex mno-align-int
17280 Control whether GCC aligns @code{int}, @code{long}, @code{long long},
17281 @code{float}, @code{double}, and @code{long double} variables on a 32-bit
17282 boundary (@option{-malign-int}) or a 16-bit boundary (@option{-mno-align-int}).
17283 Aligning variables on 32-bit boundaries produces code that runs somewhat
17284 faster on processors with 32-bit busses at the expense of more memory.
17285
17286 @strong{Warning:} if you use the @option{-malign-int} switch, GCC
17287 aligns structures containing the above types differently than
17288 most published application binary interface specifications for the m68k.
17289
17290 @item -mpcrel
17291 @opindex mpcrel
17292 Use the pc-relative addressing mode of the 68000 directly, instead of
17293 using a global offset table. At present, this option implies @option{-fpic},
17294 allowing at most a 16-bit offset for pc-relative addressing. @option{-fPIC} is
17295 not presently supported with @option{-mpcrel}, though this could be supported for
17296 68020 and higher processors.
17297
17298 @item -mno-strict-align
17299 @itemx -mstrict-align
17300 @opindex mno-strict-align
17301 @opindex mstrict-align
17302 Do not (do) assume that unaligned memory references are handled by
17303 the system.
17304
17305 @item -msep-data
17306 Generate code that allows the data segment to be located in a different
17307 area of memory from the text segment. This allows for execute-in-place in
17308 an environment without virtual memory management. This option implies
17309 @option{-fPIC}.
17310
17311 @item -mno-sep-data
17312 Generate code that assumes that the data segment follows the text segment.
17313 This is the default.
17314
17315 @item -mid-shared-library
17316 Generate code that supports shared libraries via the library ID method.
17317 This allows for execute-in-place and shared libraries in an environment
17318 without virtual memory management. This option implies @option{-fPIC}.
17319
17320 @item -mno-id-shared-library
17321 Generate code that doesn't assume ID-based shared libraries are being used.
17322 This is the default.
17323
17324 @item -mshared-library-id=n
17325 Specifies the identification number of the ID-based shared library being
17326 compiled. Specifying a value of 0 generates more compact code; specifying
17327 other values forces the allocation of that number to the current
17328 library, but is no more space- or time-efficient than omitting this option.
17329
17330 @item -mxgot
17331 @itemx -mno-xgot
17332 @opindex mxgot
17333 @opindex mno-xgot
17334 When generating position-independent code for ColdFire, generate code
17335 that works if the GOT has more than 8192 entries. This code is
17336 larger and slower than code generated without this option. On M680x0
17337 processors, this option is not needed; @option{-fPIC} suffices.
17338
17339 GCC normally uses a single instruction to load values from the GOT@.
17340 While this is relatively efficient, it only works if the GOT
17341 is smaller than about 64k. Anything larger causes the linker
17342 to report an error such as:
17343
17344 @cindex relocation truncated to fit (ColdFire)
17345 @smallexample
17346 relocation truncated to fit: R_68K_GOT16O foobar
17347 @end smallexample
17348
17349 If this happens, you should recompile your code with @option{-mxgot}.
17350 It should then work with very large GOTs. However, code generated with
17351 @option{-mxgot} is less efficient, since it takes 4 instructions to fetch
17352 the value of a global symbol.
17353
17354 Note that some linkers, including newer versions of the GNU linker,
17355 can create multiple GOTs and sort GOT entries. If you have such a linker,
17356 you should only need to use @option{-mxgot} when compiling a single
17357 object file that accesses more than 8192 GOT entries. Very few do.
17358
17359 These options have no effect unless GCC is generating
17360 position-independent code.
17361
17362 @end table
17363
17364 @node MCore Options
17365 @subsection MCore Options
17366 @cindex MCore options
17367
17368 These are the @samp{-m} options defined for the Motorola M*Core
17369 processors.
17370
17371 @table @gcctabopt
17372
17373 @item -mhardlit
17374 @itemx -mno-hardlit
17375 @opindex mhardlit
17376 @opindex mno-hardlit
17377 Inline constants into the code stream if it can be done in two
17378 instructions or less.
17379
17380 @item -mdiv
17381 @itemx -mno-div
17382 @opindex mdiv
17383 @opindex mno-div
17384 Use the divide instruction. (Enabled by default).
17385
17386 @item -mrelax-immediate
17387 @itemx -mno-relax-immediate
17388 @opindex mrelax-immediate
17389 @opindex mno-relax-immediate
17390 Allow arbitrary-sized immediates in bit operations.
17391
17392 @item -mwide-bitfields
17393 @itemx -mno-wide-bitfields
17394 @opindex mwide-bitfields
17395 @opindex mno-wide-bitfields
17396 Always treat bit-fields as @code{int}-sized.
17397
17398 @item -m4byte-functions
17399 @itemx -mno-4byte-functions
17400 @opindex m4byte-functions
17401 @opindex mno-4byte-functions
17402 Force all functions to be aligned to a 4-byte boundary.
17403
17404 @item -mcallgraph-data
17405 @itemx -mno-callgraph-data
17406 @opindex mcallgraph-data
17407 @opindex mno-callgraph-data
17408 Emit callgraph information.
17409
17410 @item -mslow-bytes
17411 @itemx -mno-slow-bytes
17412 @opindex mslow-bytes
17413 @opindex mno-slow-bytes
17414 Prefer word access when reading byte quantities.
17415
17416 @item -mlittle-endian
17417 @itemx -mbig-endian
17418 @opindex mlittle-endian
17419 @opindex mbig-endian
17420 Generate code for a little-endian target.
17421
17422 @item -m210
17423 @itemx -m340
17424 @opindex m210
17425 @opindex m340
17426 Generate code for the 210 processor.
17427
17428 @item -mno-lsim
17429 @opindex mno-lsim
17430 Assume that runtime support has been provided and so omit the
17431 simulator library (@file{libsim.a)} from the linker command line.
17432
17433 @item -mstack-increment=@var{size}
17434 @opindex mstack-increment
17435 Set the maximum amount for a single stack increment operation. Large
17436 values can increase the speed of programs that contain functions
17437 that need a large amount of stack space, but they can also trigger a
17438 segmentation fault if the stack is extended too much. The default
17439 value is 0x1000.
17440
17441 @end table
17442
17443 @node MeP Options
17444 @subsection MeP Options
17445 @cindex MeP options
17446
17447 @table @gcctabopt
17448
17449 @item -mabsdiff
17450 @opindex mabsdiff
17451 Enables the @code{abs} instruction, which is the absolute difference
17452 between two registers.
17453
17454 @item -mall-opts
17455 @opindex mall-opts
17456 Enables all the optional instructions---average, multiply, divide, bit
17457 operations, leading zero, absolute difference, min/max, clip, and
17458 saturation.
17459
17460
17461 @item -maverage
17462 @opindex maverage
17463 Enables the @code{ave} instruction, which computes the average of two
17464 registers.
17465
17466 @item -mbased=@var{n}
17467 @opindex mbased=
17468 Variables of size @var{n} bytes or smaller are placed in the
17469 @code{.based} section by default. Based variables use the @code{$tp}
17470 register as a base register, and there is a 128-byte limit to the
17471 @code{.based} section.
17472
17473 @item -mbitops
17474 @opindex mbitops
17475 Enables the bit operation instructions---bit test (@code{btstm}), set
17476 (@code{bsetm}), clear (@code{bclrm}), invert (@code{bnotm}), and
17477 test-and-set (@code{tas}).
17478
17479 @item -mc=@var{name}
17480 @opindex mc=
17481 Selects which section constant data is placed in. @var{name} may
17482 be @samp{tiny}, @samp{near}, or @samp{far}.
17483
17484 @item -mclip
17485 @opindex mclip
17486 Enables the @code{clip} instruction. Note that @option{-mclip} is not
17487 useful unless you also provide @option{-mminmax}.
17488
17489 @item -mconfig=@var{name}
17490 @opindex mconfig=
17491 Selects one of the built-in core configurations. Each MeP chip has
17492 one or more modules in it; each module has a core CPU and a variety of
17493 coprocessors, optional instructions, and peripherals. The
17494 @code{MeP-Integrator} tool, not part of GCC, provides these
17495 configurations through this option; using this option is the same as
17496 using all the corresponding command-line options. The default
17497 configuration is @samp{default}.
17498
17499 @item -mcop
17500 @opindex mcop
17501 Enables the coprocessor instructions. By default, this is a 32-bit
17502 coprocessor. Note that the coprocessor is normally enabled via the
17503 @option{-mconfig=} option.
17504
17505 @item -mcop32
17506 @opindex mcop32
17507 Enables the 32-bit coprocessor's instructions.
17508
17509 @item -mcop64
17510 @opindex mcop64
17511 Enables the 64-bit coprocessor's instructions.
17512
17513 @item -mivc2
17514 @opindex mivc2
17515 Enables IVC2 scheduling. IVC2 is a 64-bit VLIW coprocessor.
17516
17517 @item -mdc
17518 @opindex mdc
17519 Causes constant variables to be placed in the @code{.near} section.
17520
17521 @item -mdiv
17522 @opindex mdiv
17523 Enables the @code{div} and @code{divu} instructions.
17524
17525 @item -meb
17526 @opindex meb
17527 Generate big-endian code.
17528
17529 @item -mel
17530 @opindex mel
17531 Generate little-endian code.
17532
17533 @item -mio-volatile
17534 @opindex mio-volatile
17535 Tells the compiler that any variable marked with the @code{io}
17536 attribute is to be considered volatile.
17537
17538 @item -ml
17539 @opindex ml
17540 Causes variables to be assigned to the @code{.far} section by default.
17541
17542 @item -mleadz
17543 @opindex mleadz
17544 Enables the @code{leadz} (leading zero) instruction.
17545
17546 @item -mm
17547 @opindex mm
17548 Causes variables to be assigned to the @code{.near} section by default.
17549
17550 @item -mminmax
17551 @opindex mminmax
17552 Enables the @code{min} and @code{max} instructions.
17553
17554 @item -mmult
17555 @opindex mmult
17556 Enables the multiplication and multiply-accumulate instructions.
17557
17558 @item -mno-opts
17559 @opindex mno-opts
17560 Disables all the optional instructions enabled by @option{-mall-opts}.
17561
17562 @item -mrepeat
17563 @opindex mrepeat
17564 Enables the @code{repeat} and @code{erepeat} instructions, used for
17565 low-overhead looping.
17566
17567 @item -ms
17568 @opindex ms
17569 Causes all variables to default to the @code{.tiny} section. Note
17570 that there is a 65536-byte limit to this section. Accesses to these
17571 variables use the @code{%gp} base register.
17572
17573 @item -msatur
17574 @opindex msatur
17575 Enables the saturation instructions. Note that the compiler does not
17576 currently generate these itself, but this option is included for
17577 compatibility with other tools, like @code{as}.
17578
17579 @item -msdram
17580 @opindex msdram
17581 Link the SDRAM-based runtime instead of the default ROM-based runtime.
17582
17583 @item -msim
17584 @opindex msim
17585 Link the simulator run-time libraries.
17586
17587 @item -msimnovec
17588 @opindex msimnovec
17589 Link the simulator runtime libraries, excluding built-in support
17590 for reset and exception vectors and tables.
17591
17592 @item -mtf
17593 @opindex mtf
17594 Causes all functions to default to the @code{.far} section. Without
17595 this option, functions default to the @code{.near} section.
17596
17597 @item -mtiny=@var{n}
17598 @opindex mtiny=
17599 Variables that are @var{n} bytes or smaller are allocated to the
17600 @code{.tiny} section. These variables use the @code{$gp} base
17601 register. The default for this option is 4, but note that there's a
17602 65536-byte limit to the @code{.tiny} section.
17603
17604 @end table
17605
17606 @node MicroBlaze Options
17607 @subsection MicroBlaze Options
17608 @cindex MicroBlaze Options
17609
17610 @table @gcctabopt
17611
17612 @item -msoft-float
17613 @opindex msoft-float
17614 Use software emulation for floating point (default).
17615
17616 @item -mhard-float
17617 @opindex mhard-float
17618 Use hardware floating-point instructions.
17619
17620 @item -mmemcpy
17621 @opindex mmemcpy
17622 Do not optimize block moves, use @code{memcpy}.
17623
17624 @item -mno-clearbss
17625 @opindex mno-clearbss
17626 This option is deprecated. Use @option{-fno-zero-initialized-in-bss} instead.
17627
17628 @item -mcpu=@var{cpu-type}
17629 @opindex mcpu=
17630 Use features of, and schedule code for, the given CPU.
17631 Supported values are in the format @samp{v@var{X}.@var{YY}.@var{Z}},
17632 where @var{X} is a major version, @var{YY} is the minor version, and
17633 @var{Z} is compatibility code. Example values are @samp{v3.00.a},
17634 @samp{v4.00.b}, @samp{v5.00.a}, @samp{v5.00.b}, @samp{v5.00.b}, @samp{v6.00.a}.
17635
17636 @item -mxl-soft-mul
17637 @opindex mxl-soft-mul
17638 Use software multiply emulation (default).
17639
17640 @item -mxl-soft-div
17641 @opindex mxl-soft-div
17642 Use software emulation for divides (default).
17643
17644 @item -mxl-barrel-shift
17645 @opindex mxl-barrel-shift
17646 Use the hardware barrel shifter.
17647
17648 @item -mxl-pattern-compare
17649 @opindex mxl-pattern-compare
17650 Use pattern compare instructions.
17651
17652 @item -msmall-divides
17653 @opindex msmall-divides
17654 Use table lookup optimization for small signed integer divisions.
17655
17656 @item -mxl-stack-check
17657 @opindex mxl-stack-check
17658 This option is deprecated. Use @option{-fstack-check} instead.
17659
17660 @item -mxl-gp-opt
17661 @opindex mxl-gp-opt
17662 Use GP-relative @code{.sdata}/@code{.sbss} sections.
17663
17664 @item -mxl-multiply-high
17665 @opindex mxl-multiply-high
17666 Use multiply high instructions for high part of 32x32 multiply.
17667
17668 @item -mxl-float-convert
17669 @opindex mxl-float-convert
17670 Use hardware floating-point conversion instructions.
17671
17672 @item -mxl-float-sqrt
17673 @opindex mxl-float-sqrt
17674 Use hardware floating-point square root instruction.
17675
17676 @item -mbig-endian
17677 @opindex mbig-endian
17678 Generate code for a big-endian target.
17679
17680 @item -mlittle-endian
17681 @opindex mlittle-endian
17682 Generate code for a little-endian target.
17683
17684 @item -mxl-reorder
17685 @opindex mxl-reorder
17686 Use reorder instructions (swap and byte reversed load/store).
17687
17688 @item -mxl-mode-@var{app-model}
17689 Select application model @var{app-model}. Valid models are
17690 @table @samp
17691 @item executable
17692 normal executable (default), uses startup code @file{crt0.o}.
17693
17694 @item xmdstub
17695 for use with Xilinx Microprocessor Debugger (XMD) based
17696 software intrusive debug agent called xmdstub. This uses startup file
17697 @file{crt1.o} and sets the start address of the program to 0x800.
17698
17699 @item bootstrap
17700 for applications that are loaded using a bootloader.
17701 This model uses startup file @file{crt2.o} which does not contain a processor
17702 reset vector handler. This is suitable for transferring control on a
17703 processor reset to the bootloader rather than the application.
17704
17705 @item novectors
17706 for applications that do not require any of the
17707 MicroBlaze vectors. This option may be useful for applications running
17708 within a monitoring application. This model uses @file{crt3.o} as a startup file.
17709 @end table
17710
17711 Option @option{-xl-mode-@var{app-model}} is a deprecated alias for
17712 @option{-mxl-mode-@var{app-model}}.
17713
17714 @end table
17715
17716 @node MIPS Options
17717 @subsection MIPS Options
17718 @cindex MIPS options
17719
17720 @table @gcctabopt
17721
17722 @item -EB
17723 @opindex EB
17724 Generate big-endian code.
17725
17726 @item -EL
17727 @opindex EL
17728 Generate little-endian code. This is the default for @samp{mips*el-*-*}
17729 configurations.
17730
17731 @item -march=@var{arch}
17732 @opindex march
17733 Generate code that runs on @var{arch}, which can be the name of a
17734 generic MIPS ISA, or the name of a particular processor.
17735 The ISA names are:
17736 @samp{mips1}, @samp{mips2}, @samp{mips3}, @samp{mips4},
17737 @samp{mips32}, @samp{mips32r2}, @samp{mips32r3}, @samp{mips32r5},
17738 @samp{mips32r6}, @samp{mips64}, @samp{mips64r2}, @samp{mips64r3},
17739 @samp{mips64r5} and @samp{mips64r6}.
17740 The processor names are:
17741 @samp{4kc}, @samp{4km}, @samp{4kp}, @samp{4ksc},
17742 @samp{4kec}, @samp{4kem}, @samp{4kep}, @samp{4ksd},
17743 @samp{5kc}, @samp{5kf},
17744 @samp{20kc},
17745 @samp{24kc}, @samp{24kf2_1}, @samp{24kf1_1},
17746 @samp{24kec}, @samp{24kef2_1}, @samp{24kef1_1},
17747 @samp{34kc}, @samp{34kf2_1}, @samp{34kf1_1}, @samp{34kn},
17748 @samp{74kc}, @samp{74kf2_1}, @samp{74kf1_1}, @samp{74kf3_2},
17749 @samp{1004kc}, @samp{1004kf2_1}, @samp{1004kf1_1},
17750 @samp{i6400},
17751 @samp{interaptiv},
17752 @samp{loongson2e}, @samp{loongson2f}, @samp{loongson3a},
17753 @samp{m4k},
17754 @samp{m14k}, @samp{m14kc}, @samp{m14ke}, @samp{m14kec},
17755 @samp{m5100}, @samp{m5101},
17756 @samp{octeon}, @samp{octeon+}, @samp{octeon2}, @samp{octeon3},
17757 @samp{orion},
17758 @samp{p5600},
17759 @samp{r2000}, @samp{r3000}, @samp{r3900}, @samp{r4000}, @samp{r4400},
17760 @samp{r4600}, @samp{r4650}, @samp{r4700}, @samp{r6000}, @samp{r8000},
17761 @samp{rm7000}, @samp{rm9000},
17762 @samp{r10000}, @samp{r12000}, @samp{r14000}, @samp{r16000},
17763 @samp{sb1},
17764 @samp{sr71000},
17765 @samp{vr4100}, @samp{vr4111}, @samp{vr4120}, @samp{vr4130}, @samp{vr4300},
17766 @samp{vr5000}, @samp{vr5400}, @samp{vr5500},
17767 @samp{xlr} and @samp{xlp}.
17768 The special value @samp{from-abi} selects the
17769 most compatible architecture for the selected ABI (that is,
17770 @samp{mips1} for 32-bit ABIs and @samp{mips3} for 64-bit ABIs)@.
17771
17772 The native Linux/GNU toolchain also supports the value @samp{native},
17773 which selects the best architecture option for the host processor.
17774 @option{-march=native} has no effect if GCC does not recognize
17775 the processor.
17776
17777 In processor names, a final @samp{000} can be abbreviated as @samp{k}
17778 (for example, @option{-march=r2k}). Prefixes are optional, and
17779 @samp{vr} may be written @samp{r}.
17780
17781 Names of the form @samp{@var{n}f2_1} refer to processors with
17782 FPUs clocked at half the rate of the core, names of the form
17783 @samp{@var{n}f1_1} refer to processors with FPUs clocked at the same
17784 rate as the core, and names of the form @samp{@var{n}f3_2} refer to
17785 processors with FPUs clocked a ratio of 3:2 with respect to the core.
17786 For compatibility reasons, @samp{@var{n}f} is accepted as a synonym
17787 for @samp{@var{n}f2_1} while @samp{@var{n}x} and @samp{@var{b}fx} are
17788 accepted as synonyms for @samp{@var{n}f1_1}.
17789
17790 GCC defines two macros based on the value of this option. The first
17791 is @code{_MIPS_ARCH}, which gives the name of target architecture, as
17792 a string. The second has the form @code{_MIPS_ARCH_@var{foo}},
17793 where @var{foo} is the capitalized value of @code{_MIPS_ARCH}@.
17794 For example, @option{-march=r2000} sets @code{_MIPS_ARCH}
17795 to @code{"r2000"} and defines the macro @code{_MIPS_ARCH_R2000}.
17796
17797 Note that the @code{_MIPS_ARCH} macro uses the processor names given
17798 above. In other words, it has the full prefix and does not
17799 abbreviate @samp{000} as @samp{k}. In the case of @samp{from-abi},
17800 the macro names the resolved architecture (either @code{"mips1"} or
17801 @code{"mips3"}). It names the default architecture when no
17802 @option{-march} option is given.
17803
17804 @item -mtune=@var{arch}
17805 @opindex mtune
17806 Optimize for @var{arch}. Among other things, this option controls
17807 the way instructions are scheduled, and the perceived cost of arithmetic
17808 operations. The list of @var{arch} values is the same as for
17809 @option{-march}.
17810
17811 When this option is not used, GCC optimizes for the processor
17812 specified by @option{-march}. By using @option{-march} and
17813 @option{-mtune} together, it is possible to generate code that
17814 runs on a family of processors, but optimize the code for one
17815 particular member of that family.
17816
17817 @option{-mtune} defines the macros @code{_MIPS_TUNE} and
17818 @code{_MIPS_TUNE_@var{foo}}, which work in the same way as the
17819 @option{-march} ones described above.
17820
17821 @item -mips1
17822 @opindex mips1
17823 Equivalent to @option{-march=mips1}.
17824
17825 @item -mips2
17826 @opindex mips2
17827 Equivalent to @option{-march=mips2}.
17828
17829 @item -mips3
17830 @opindex mips3
17831 Equivalent to @option{-march=mips3}.
17832
17833 @item -mips4
17834 @opindex mips4
17835 Equivalent to @option{-march=mips4}.
17836
17837 @item -mips32
17838 @opindex mips32
17839 Equivalent to @option{-march=mips32}.
17840
17841 @item -mips32r3
17842 @opindex mips32r3
17843 Equivalent to @option{-march=mips32r3}.
17844
17845 @item -mips32r5
17846 @opindex mips32r5
17847 Equivalent to @option{-march=mips32r5}.
17848
17849 @item -mips32r6
17850 @opindex mips32r6
17851 Equivalent to @option{-march=mips32r6}.
17852
17853 @item -mips64
17854 @opindex mips64
17855 Equivalent to @option{-march=mips64}.
17856
17857 @item -mips64r2
17858 @opindex mips64r2
17859 Equivalent to @option{-march=mips64r2}.
17860
17861 @item -mips64r3
17862 @opindex mips64r3
17863 Equivalent to @option{-march=mips64r3}.
17864
17865 @item -mips64r5
17866 @opindex mips64r5
17867 Equivalent to @option{-march=mips64r5}.
17868
17869 @item -mips64r6
17870 @opindex mips64r6
17871 Equivalent to @option{-march=mips64r6}.
17872
17873 @item -mips16
17874 @itemx -mno-mips16
17875 @opindex mips16
17876 @opindex mno-mips16
17877 Generate (do not generate) MIPS16 code. If GCC is targeting a
17878 MIPS32 or MIPS64 architecture, it makes use of the MIPS16e ASE@.
17879
17880 MIPS16 code generation can also be controlled on a per-function basis
17881 by means of @code{mips16} and @code{nomips16} attributes.
17882 @xref{Function Attributes}, for more information.
17883
17884 @item -mflip-mips16
17885 @opindex mflip-mips16
17886 Generate MIPS16 code on alternating functions. This option is provided
17887 for regression testing of mixed MIPS16/non-MIPS16 code generation, and is
17888 not intended for ordinary use in compiling user code.
17889
17890 @item -minterlink-compressed
17891 @item -mno-interlink-compressed
17892 @opindex minterlink-compressed
17893 @opindex mno-interlink-compressed
17894 Require (do not require) that code using the standard (uncompressed) MIPS ISA
17895 be link-compatible with MIPS16 and microMIPS code, and vice versa.
17896
17897 For example, code using the standard ISA encoding cannot jump directly
17898 to MIPS16 or microMIPS code; it must either use a call or an indirect jump.
17899 @option{-minterlink-compressed} therefore disables direct jumps unless GCC
17900 knows that the target of the jump is not compressed.
17901
17902 @item -minterlink-mips16
17903 @itemx -mno-interlink-mips16
17904 @opindex minterlink-mips16
17905 @opindex mno-interlink-mips16
17906 Aliases of @option{-minterlink-compressed} and
17907 @option{-mno-interlink-compressed}. These options predate the microMIPS ASE
17908 and are retained for backwards compatibility.
17909
17910 @item -mabi=32
17911 @itemx -mabi=o64
17912 @itemx -mabi=n32
17913 @itemx -mabi=64
17914 @itemx -mabi=eabi
17915 @opindex mabi=32
17916 @opindex mabi=o64
17917 @opindex mabi=n32
17918 @opindex mabi=64
17919 @opindex mabi=eabi
17920 Generate code for the given ABI@.
17921
17922 Note that the EABI has a 32-bit and a 64-bit variant. GCC normally
17923 generates 64-bit code when you select a 64-bit architecture, but you
17924 can use @option{-mgp32} to get 32-bit code instead.
17925
17926 For information about the O64 ABI, see
17927 @uref{http://gcc.gnu.org/@/projects/@/mipso64-abi.html}.
17928
17929 GCC supports a variant of the o32 ABI in which floating-point registers
17930 are 64 rather than 32 bits wide. You can select this combination with
17931 @option{-mabi=32} @option{-mfp64}. This ABI relies on the @code{mthc1}
17932 and @code{mfhc1} instructions and is therefore only supported for
17933 MIPS32R2, MIPS32R3 and MIPS32R5 processors.
17934
17935 The register assignments for arguments and return values remain the
17936 same, but each scalar value is passed in a single 64-bit register
17937 rather than a pair of 32-bit registers. For example, scalar
17938 floating-point values are returned in @samp{$f0} only, not a
17939 @samp{$f0}/@samp{$f1} pair. The set of call-saved registers also
17940 remains the same in that the even-numbered double-precision registers
17941 are saved.
17942
17943 Two additional variants of the o32 ABI are supported to enable
17944 a transition from 32-bit to 64-bit registers. These are FPXX
17945 (@option{-mfpxx}) and FP64A (@option{-mfp64} @option{-mno-odd-spreg}).
17946 The FPXX extension mandates that all code must execute correctly
17947 when run using 32-bit or 64-bit registers. The code can be interlinked
17948 with either FP32 or FP64, but not both.
17949 The FP64A extension is similar to the FP64 extension but forbids the
17950 use of odd-numbered single-precision registers. This can be used
17951 in conjunction with the @code{FRE} mode of FPUs in MIPS32R5
17952 processors and allows both FP32 and FP64A code to interlink and
17953 run in the same process without changing FPU modes.
17954
17955 @item -mabicalls
17956 @itemx -mno-abicalls
17957 @opindex mabicalls
17958 @opindex mno-abicalls
17959 Generate (do not generate) code that is suitable for SVR4-style
17960 dynamic objects. @option{-mabicalls} is the default for SVR4-based
17961 systems.
17962
17963 @item -mshared
17964 @itemx -mno-shared
17965 Generate (do not generate) code that is fully position-independent,
17966 and that can therefore be linked into shared libraries. This option
17967 only affects @option{-mabicalls}.
17968
17969 All @option{-mabicalls} code has traditionally been position-independent,
17970 regardless of options like @option{-fPIC} and @option{-fpic}. However,
17971 as an extension, the GNU toolchain allows executables to use absolute
17972 accesses for locally-binding symbols. It can also use shorter GP
17973 initialization sequences and generate direct calls to locally-defined
17974 functions. This mode is selected by @option{-mno-shared}.
17975
17976 @option{-mno-shared} depends on binutils 2.16 or higher and generates
17977 objects that can only be linked by the GNU linker. However, the option
17978 does not affect the ABI of the final executable; it only affects the ABI
17979 of relocatable objects. Using @option{-mno-shared} generally makes
17980 executables both smaller and quicker.
17981
17982 @option{-mshared} is the default.
17983
17984 @item -mplt
17985 @itemx -mno-plt
17986 @opindex mplt
17987 @opindex mno-plt
17988 Assume (do not assume) that the static and dynamic linkers
17989 support PLTs and copy relocations. This option only affects
17990 @option{-mno-shared -mabicalls}. For the n64 ABI, this option
17991 has no effect without @option{-msym32}.
17992
17993 You can make @option{-mplt} the default by configuring
17994 GCC with @option{--with-mips-plt}. The default is
17995 @option{-mno-plt} otherwise.
17996
17997 @item -mxgot
17998 @itemx -mno-xgot
17999 @opindex mxgot
18000 @opindex mno-xgot
18001 Lift (do not lift) the usual restrictions on the size of the global
18002 offset table.
18003
18004 GCC normally uses a single instruction to load values from the GOT@.
18005 While this is relatively efficient, it only works if the GOT
18006 is smaller than about 64k. Anything larger causes the linker
18007 to report an error such as:
18008
18009 @cindex relocation truncated to fit (MIPS)
18010 @smallexample
18011 relocation truncated to fit: R_MIPS_GOT16 foobar
18012 @end smallexample
18013
18014 If this happens, you should recompile your code with @option{-mxgot}.
18015 This works with very large GOTs, although the code is also
18016 less efficient, since it takes three instructions to fetch the
18017 value of a global symbol.
18018
18019 Note that some linkers can create multiple GOTs. If you have such a
18020 linker, you should only need to use @option{-mxgot} when a single object
18021 file accesses more than 64k's worth of GOT entries. Very few do.
18022
18023 These options have no effect unless GCC is generating position
18024 independent code.
18025
18026 @item -mgp32
18027 @opindex mgp32
18028 Assume that general-purpose registers are 32 bits wide.
18029
18030 @item -mgp64
18031 @opindex mgp64
18032 Assume that general-purpose registers are 64 bits wide.
18033
18034 @item -mfp32
18035 @opindex mfp32
18036 Assume that floating-point registers are 32 bits wide.
18037
18038 @item -mfp64
18039 @opindex mfp64
18040 Assume that floating-point registers are 64 bits wide.
18041
18042 @item -mfpxx
18043 @opindex mfpxx
18044 Do not assume the width of floating-point registers.
18045
18046 @item -mhard-float
18047 @opindex mhard-float
18048 Use floating-point coprocessor instructions.
18049
18050 @item -msoft-float
18051 @opindex msoft-float
18052 Do not use floating-point coprocessor instructions. Implement
18053 floating-point calculations using library calls instead.
18054
18055 @item -mno-float
18056 @opindex mno-float
18057 Equivalent to @option{-msoft-float}, but additionally asserts that the
18058 program being compiled does not perform any floating-point operations.
18059 This option is presently supported only by some bare-metal MIPS
18060 configurations, where it may select a special set of libraries
18061 that lack all floating-point support (including, for example, the
18062 floating-point @code{printf} formats).
18063 If code compiled with @option{-mno-float} accidentally contains
18064 floating-point operations, it is likely to suffer a link-time
18065 or run-time failure.
18066
18067 @item -msingle-float
18068 @opindex msingle-float
18069 Assume that the floating-point coprocessor only supports single-precision
18070 operations.
18071
18072 @item -mdouble-float
18073 @opindex mdouble-float
18074 Assume that the floating-point coprocessor supports double-precision
18075 operations. This is the default.
18076
18077 @item -modd-spreg
18078 @itemx -mno-odd-spreg
18079 @opindex modd-spreg
18080 @opindex mno-odd-spreg
18081 Enable the use of odd-numbered single-precision floating-point registers
18082 for the o32 ABI. This is the default for processors that are known to
18083 support these registers. When using the o32 FPXX ABI, @option{-mno-odd-spreg}
18084 is set by default.
18085
18086 @item -mabs=2008
18087 @itemx -mabs=legacy
18088 @opindex mabs=2008
18089 @opindex mabs=legacy
18090 These options control the treatment of the special not-a-number (NaN)
18091 IEEE 754 floating-point data with the @code{abs.@i{fmt}} and
18092 @code{neg.@i{fmt}} machine instructions.
18093
18094 By default or when @option{-mabs=legacy} is used the legacy
18095 treatment is selected. In this case these instructions are considered
18096 arithmetic and avoided where correct operation is required and the
18097 input operand might be a NaN. A longer sequence of instructions that
18098 manipulate the sign bit of floating-point datum manually is used
18099 instead unless the @option{-ffinite-math-only} option has also been
18100 specified.
18101
18102 The @option{-mabs=2008} option selects the IEEE 754-2008 treatment. In
18103 this case these instructions are considered non-arithmetic and therefore
18104 operating correctly in all cases, including in particular where the
18105 input operand is a NaN. These instructions are therefore always used
18106 for the respective operations.
18107
18108 @item -mnan=2008
18109 @itemx -mnan=legacy
18110 @opindex mnan=2008
18111 @opindex mnan=legacy
18112 These options control the encoding of the special not-a-number (NaN)
18113 IEEE 754 floating-point data.
18114
18115 The @option{-mnan=legacy} option selects the legacy encoding. In this
18116 case quiet NaNs (qNaNs) are denoted by the first bit of their trailing
18117 significand field being 0, whereas signalling NaNs (sNaNs) are denoted
18118 by the first bit of their trailing significand field being 1.
18119
18120 The @option{-mnan=2008} option selects the IEEE 754-2008 encoding. In
18121 this case qNaNs are denoted by the first bit of their trailing
18122 significand field being 1, whereas sNaNs are denoted by the first bit of
18123 their trailing significand field being 0.
18124
18125 The default is @option{-mnan=legacy} unless GCC has been configured with
18126 @option{--with-nan=2008}.
18127
18128 @item -mllsc
18129 @itemx -mno-llsc
18130 @opindex mllsc
18131 @opindex mno-llsc
18132 Use (do not use) @samp{ll}, @samp{sc}, and @samp{sync} instructions to
18133 implement atomic memory built-in functions. When neither option is
18134 specified, GCC uses the instructions if the target architecture
18135 supports them.
18136
18137 @option{-mllsc} is useful if the runtime environment can emulate the
18138 instructions and @option{-mno-llsc} can be useful when compiling for
18139 nonstandard ISAs. You can make either option the default by
18140 configuring GCC with @option{--with-llsc} and @option{--without-llsc}
18141 respectively. @option{--with-llsc} is the default for some
18142 configurations; see the installation documentation for details.
18143
18144 @item -mdsp
18145 @itemx -mno-dsp
18146 @opindex mdsp
18147 @opindex mno-dsp
18148 Use (do not use) revision 1 of the MIPS DSP ASE@.
18149 @xref{MIPS DSP Built-in Functions}. This option defines the
18150 preprocessor macro @code{__mips_dsp}. It also defines
18151 @code{__mips_dsp_rev} to 1.
18152
18153 @item -mdspr2
18154 @itemx -mno-dspr2
18155 @opindex mdspr2
18156 @opindex mno-dspr2
18157 Use (do not use) revision 2 of the MIPS DSP ASE@.
18158 @xref{MIPS DSP Built-in Functions}. This option defines the
18159 preprocessor macros @code{__mips_dsp} and @code{__mips_dspr2}.
18160 It also defines @code{__mips_dsp_rev} to 2.
18161
18162 @item -msmartmips
18163 @itemx -mno-smartmips
18164 @opindex msmartmips
18165 @opindex mno-smartmips
18166 Use (do not use) the MIPS SmartMIPS ASE.
18167
18168 @item -mpaired-single
18169 @itemx -mno-paired-single
18170 @opindex mpaired-single
18171 @opindex mno-paired-single
18172 Use (do not use) paired-single floating-point instructions.
18173 @xref{MIPS Paired-Single Support}. This option requires
18174 hardware floating-point support to be enabled.
18175
18176 @item -mdmx
18177 @itemx -mno-mdmx
18178 @opindex mdmx
18179 @opindex mno-mdmx
18180 Use (do not use) MIPS Digital Media Extension instructions.
18181 This option can only be used when generating 64-bit code and requires
18182 hardware floating-point support to be enabled.
18183
18184 @item -mips3d
18185 @itemx -mno-mips3d
18186 @opindex mips3d
18187 @opindex mno-mips3d
18188 Use (do not use) the MIPS-3D ASE@. @xref{MIPS-3D Built-in Functions}.
18189 The option @option{-mips3d} implies @option{-mpaired-single}.
18190
18191 @item -mmicromips
18192 @itemx -mno-micromips
18193 @opindex mmicromips
18194 @opindex mno-mmicromips
18195 Generate (do not generate) microMIPS code.
18196
18197 MicroMIPS code generation can also be controlled on a per-function basis
18198 by means of @code{micromips} and @code{nomicromips} attributes.
18199 @xref{Function Attributes}, for more information.
18200
18201 @item -mmt
18202 @itemx -mno-mt
18203 @opindex mmt
18204 @opindex mno-mt
18205 Use (do not use) MT Multithreading instructions.
18206
18207 @item -mmcu
18208 @itemx -mno-mcu
18209 @opindex mmcu
18210 @opindex mno-mcu
18211 Use (do not use) the MIPS MCU ASE instructions.
18212
18213 @item -meva
18214 @itemx -mno-eva
18215 @opindex meva
18216 @opindex mno-eva
18217 Use (do not use) the MIPS Enhanced Virtual Addressing instructions.
18218
18219 @item -mvirt
18220 @itemx -mno-virt
18221 @opindex mvirt
18222 @opindex mno-virt
18223 Use (do not use) the MIPS Virtualization Application Specific instructions.
18224
18225 @item -mxpa
18226 @itemx -mno-xpa
18227 @opindex mxpa
18228 @opindex mno-xpa
18229 Use (do not use) the MIPS eXtended Physical Address (XPA) instructions.
18230
18231 @item -mlong64
18232 @opindex mlong64
18233 Force @code{long} types to be 64 bits wide. See @option{-mlong32} for
18234 an explanation of the default and the way that the pointer size is
18235 determined.
18236
18237 @item -mlong32
18238 @opindex mlong32
18239 Force @code{long}, @code{int}, and pointer types to be 32 bits wide.
18240
18241 The default size of @code{int}s, @code{long}s and pointers depends on
18242 the ABI@. All the supported ABIs use 32-bit @code{int}s. The n64 ABI
18243 uses 64-bit @code{long}s, as does the 64-bit EABI; the others use
18244 32-bit @code{long}s. Pointers are the same size as @code{long}s,
18245 or the same size as integer registers, whichever is smaller.
18246
18247 @item -msym32
18248 @itemx -mno-sym32
18249 @opindex msym32
18250 @opindex mno-sym32
18251 Assume (do not assume) that all symbols have 32-bit values, regardless
18252 of the selected ABI@. This option is useful in combination with
18253 @option{-mabi=64} and @option{-mno-abicalls} because it allows GCC
18254 to generate shorter and faster references to symbolic addresses.
18255
18256 @item -G @var{num}
18257 @opindex G
18258 Put definitions of externally-visible data in a small data section
18259 if that data is no bigger than @var{num} bytes. GCC can then generate
18260 more efficient accesses to the data; see @option{-mgpopt} for details.
18261
18262 The default @option{-G} option depends on the configuration.
18263
18264 @item -mlocal-sdata
18265 @itemx -mno-local-sdata
18266 @opindex mlocal-sdata
18267 @opindex mno-local-sdata
18268 Extend (do not extend) the @option{-G} behavior to local data too,
18269 such as to static variables in C@. @option{-mlocal-sdata} is the
18270 default for all configurations.
18271
18272 If the linker complains that an application is using too much small data,
18273 you might want to try rebuilding the less performance-critical parts with
18274 @option{-mno-local-sdata}. You might also want to build large
18275 libraries with @option{-mno-local-sdata}, so that the libraries leave
18276 more room for the main program.
18277
18278 @item -mextern-sdata
18279 @itemx -mno-extern-sdata
18280 @opindex mextern-sdata
18281 @opindex mno-extern-sdata
18282 Assume (do not assume) that externally-defined data is in
18283 a small data section if the size of that data is within the @option{-G} limit.
18284 @option{-mextern-sdata} is the default for all configurations.
18285
18286 If you compile a module @var{Mod} with @option{-mextern-sdata} @option{-G
18287 @var{num}} @option{-mgpopt}, and @var{Mod} references a variable @var{Var}
18288 that is no bigger than @var{num} bytes, you must make sure that @var{Var}
18289 is placed in a small data section. If @var{Var} is defined by another
18290 module, you must either compile that module with a high-enough
18291 @option{-G} setting or attach a @code{section} attribute to @var{Var}'s
18292 definition. If @var{Var} is common, you must link the application
18293 with a high-enough @option{-G} setting.
18294
18295 The easiest way of satisfying these restrictions is to compile
18296 and link every module with the same @option{-G} option. However,
18297 you may wish to build a library that supports several different
18298 small data limits. You can do this by compiling the library with
18299 the highest supported @option{-G} setting and additionally using
18300 @option{-mno-extern-sdata} to stop the library from making assumptions
18301 about externally-defined data.
18302
18303 @item -mgpopt
18304 @itemx -mno-gpopt
18305 @opindex mgpopt
18306 @opindex mno-gpopt
18307 Use (do not use) GP-relative accesses for symbols that are known to be
18308 in a small data section; see @option{-G}, @option{-mlocal-sdata} and
18309 @option{-mextern-sdata}. @option{-mgpopt} is the default for all
18310 configurations.
18311
18312 @option{-mno-gpopt} is useful for cases where the @code{$gp} register
18313 might not hold the value of @code{_gp}. For example, if the code is
18314 part of a library that might be used in a boot monitor, programs that
18315 call boot monitor routines pass an unknown value in @code{$gp}.
18316 (In such situations, the boot monitor itself is usually compiled
18317 with @option{-G0}.)
18318
18319 @option{-mno-gpopt} implies @option{-mno-local-sdata} and
18320 @option{-mno-extern-sdata}.
18321
18322 @item -membedded-data
18323 @itemx -mno-embedded-data
18324 @opindex membedded-data
18325 @opindex mno-embedded-data
18326 Allocate variables to the read-only data section first if possible, then
18327 next in the small data section if possible, otherwise in data. This gives
18328 slightly slower code than the default, but reduces the amount of RAM required
18329 when executing, and thus may be preferred for some embedded systems.
18330
18331 @item -muninit-const-in-rodata
18332 @itemx -mno-uninit-const-in-rodata
18333 @opindex muninit-const-in-rodata
18334 @opindex mno-uninit-const-in-rodata
18335 Put uninitialized @code{const} variables in the read-only data section.
18336 This option is only meaningful in conjunction with @option{-membedded-data}.
18337
18338 @item -mcode-readable=@var{setting}
18339 @opindex mcode-readable
18340 Specify whether GCC may generate code that reads from executable sections.
18341 There are three possible settings:
18342
18343 @table @gcctabopt
18344 @item -mcode-readable=yes
18345 Instructions may freely access executable sections. This is the
18346 default setting.
18347
18348 @item -mcode-readable=pcrel
18349 MIPS16 PC-relative load instructions can access executable sections,
18350 but other instructions must not do so. This option is useful on 4KSc
18351 and 4KSd processors when the code TLBs have the Read Inhibit bit set.
18352 It is also useful on processors that can be configured to have a dual
18353 instruction/data SRAM interface and that, like the M4K, automatically
18354 redirect PC-relative loads to the instruction RAM.
18355
18356 @item -mcode-readable=no
18357 Instructions must not access executable sections. This option can be
18358 useful on targets that are configured to have a dual instruction/data
18359 SRAM interface but that (unlike the M4K) do not automatically redirect
18360 PC-relative loads to the instruction RAM.
18361 @end table
18362
18363 @item -msplit-addresses
18364 @itemx -mno-split-addresses
18365 @opindex msplit-addresses
18366 @opindex mno-split-addresses
18367 Enable (disable) use of the @code{%hi()} and @code{%lo()} assembler
18368 relocation operators. This option has been superseded by
18369 @option{-mexplicit-relocs} but is retained for backwards compatibility.
18370
18371 @item -mexplicit-relocs
18372 @itemx -mno-explicit-relocs
18373 @opindex mexplicit-relocs
18374 @opindex mno-explicit-relocs
18375 Use (do not use) assembler relocation operators when dealing with symbolic
18376 addresses. The alternative, selected by @option{-mno-explicit-relocs},
18377 is to use assembler macros instead.
18378
18379 @option{-mexplicit-relocs} is the default if GCC was configured
18380 to use an assembler that supports relocation operators.
18381
18382 @item -mcheck-zero-division
18383 @itemx -mno-check-zero-division
18384 @opindex mcheck-zero-division
18385 @opindex mno-check-zero-division
18386 Trap (do not trap) on integer division by zero.
18387
18388 The default is @option{-mcheck-zero-division}.
18389
18390 @item -mdivide-traps
18391 @itemx -mdivide-breaks
18392 @opindex mdivide-traps
18393 @opindex mdivide-breaks
18394 MIPS systems check for division by zero by generating either a
18395 conditional trap or a break instruction. Using traps results in
18396 smaller code, but is only supported on MIPS II and later. Also, some
18397 versions of the Linux kernel have a bug that prevents trap from
18398 generating the proper signal (@code{SIGFPE}). Use @option{-mdivide-traps} to
18399 allow conditional traps on architectures that support them and
18400 @option{-mdivide-breaks} to force the use of breaks.
18401
18402 The default is usually @option{-mdivide-traps}, but this can be
18403 overridden at configure time using @option{--with-divide=breaks}.
18404 Divide-by-zero checks can be completely disabled using
18405 @option{-mno-check-zero-division}.
18406
18407 @item -mmemcpy
18408 @itemx -mno-memcpy
18409 @opindex mmemcpy
18410 @opindex mno-memcpy
18411 Force (do not force) the use of @code{memcpy} for non-trivial block
18412 moves. The default is @option{-mno-memcpy}, which allows GCC to inline
18413 most constant-sized copies.
18414
18415 @item -mlong-calls
18416 @itemx -mno-long-calls
18417 @opindex mlong-calls
18418 @opindex mno-long-calls
18419 Disable (do not disable) use of the @code{jal} instruction. Calling
18420 functions using @code{jal} is more efficient but requires the caller
18421 and callee to be in the same 256 megabyte segment.
18422
18423 This option has no effect on abicalls code. The default is
18424 @option{-mno-long-calls}.
18425
18426 @item -mmad
18427 @itemx -mno-mad
18428 @opindex mmad
18429 @opindex mno-mad
18430 Enable (disable) use of the @code{mad}, @code{madu} and @code{mul}
18431 instructions, as provided by the R4650 ISA@.
18432
18433 @item -mimadd
18434 @itemx -mno-imadd
18435 @opindex mimadd
18436 @opindex mno-imadd
18437 Enable (disable) use of the @code{madd} and @code{msub} integer
18438 instructions. The default is @option{-mimadd} on architectures
18439 that support @code{madd} and @code{msub} except for the 74k
18440 architecture where it was found to generate slower code.
18441
18442 @item -mfused-madd
18443 @itemx -mno-fused-madd
18444 @opindex mfused-madd
18445 @opindex mno-fused-madd
18446 Enable (disable) use of the floating-point multiply-accumulate
18447 instructions, when they are available. The default is
18448 @option{-mfused-madd}.
18449
18450 On the R8000 CPU when multiply-accumulate instructions are used,
18451 the intermediate product is calculated to infinite precision
18452 and is not subject to the FCSR Flush to Zero bit. This may be
18453 undesirable in some circumstances. On other processors the result
18454 is numerically identical to the equivalent computation using
18455 separate multiply, add, subtract and negate instructions.
18456
18457 @item -nocpp
18458 @opindex nocpp
18459 Tell the MIPS assembler to not run its preprocessor over user
18460 assembler files (with a @samp{.s} suffix) when assembling them.
18461
18462 @item -mfix-24k
18463 @item -mno-fix-24k
18464 @opindex mfix-24k
18465 @opindex mno-fix-24k
18466 Work around the 24K E48 (lost data on stores during refill) errata.
18467 The workarounds are implemented by the assembler rather than by GCC@.
18468
18469 @item -mfix-r4000
18470 @itemx -mno-fix-r4000
18471 @opindex mfix-r4000
18472 @opindex mno-fix-r4000
18473 Work around certain R4000 CPU errata:
18474 @itemize @minus
18475 @item
18476 A double-word or a variable shift may give an incorrect result if executed
18477 immediately after starting an integer division.
18478 @item
18479 A double-word or a variable shift may give an incorrect result if executed
18480 while an integer multiplication is in progress.
18481 @item
18482 An integer division may give an incorrect result if started in a delay slot
18483 of a taken branch or a jump.
18484 @end itemize
18485
18486 @item -mfix-r4400
18487 @itemx -mno-fix-r4400
18488 @opindex mfix-r4400
18489 @opindex mno-fix-r4400
18490 Work around certain R4400 CPU errata:
18491 @itemize @minus
18492 @item
18493 A double-word or a variable shift may give an incorrect result if executed
18494 immediately after starting an integer division.
18495 @end itemize
18496
18497 @item -mfix-r10000
18498 @itemx -mno-fix-r10000
18499 @opindex mfix-r10000
18500 @opindex mno-fix-r10000
18501 Work around certain R10000 errata:
18502 @itemize @minus
18503 @item
18504 @code{ll}/@code{sc} sequences may not behave atomically on revisions
18505 prior to 3.0. They may deadlock on revisions 2.6 and earlier.
18506 @end itemize
18507
18508 This option can only be used if the target architecture supports
18509 branch-likely instructions. @option{-mfix-r10000} is the default when
18510 @option{-march=r10000} is used; @option{-mno-fix-r10000} is the default
18511 otherwise.
18512
18513 @item -mfix-rm7000
18514 @itemx -mno-fix-rm7000
18515 @opindex mfix-rm7000
18516 Work around the RM7000 @code{dmult}/@code{dmultu} errata. The
18517 workarounds are implemented by the assembler rather than by GCC@.
18518
18519 @item -mfix-vr4120
18520 @itemx -mno-fix-vr4120
18521 @opindex mfix-vr4120
18522 Work around certain VR4120 errata:
18523 @itemize @minus
18524 @item
18525 @code{dmultu} does not always produce the correct result.
18526 @item
18527 @code{div} and @code{ddiv} do not always produce the correct result if one
18528 of the operands is negative.
18529 @end itemize
18530 The workarounds for the division errata rely on special functions in
18531 @file{libgcc.a}. At present, these functions are only provided by
18532 the @code{mips64vr*-elf} configurations.
18533
18534 Other VR4120 errata require a NOP to be inserted between certain pairs of
18535 instructions. These errata are handled by the assembler, not by GCC itself.
18536
18537 @item -mfix-vr4130
18538 @opindex mfix-vr4130
18539 Work around the VR4130 @code{mflo}/@code{mfhi} errata. The
18540 workarounds are implemented by the assembler rather than by GCC,
18541 although GCC avoids using @code{mflo} and @code{mfhi} if the
18542 VR4130 @code{macc}, @code{macchi}, @code{dmacc} and @code{dmacchi}
18543 instructions are available instead.
18544
18545 @item -mfix-sb1
18546 @itemx -mno-fix-sb1
18547 @opindex mfix-sb1
18548 Work around certain SB-1 CPU core errata.
18549 (This flag currently works around the SB-1 revision 2
18550 ``F1'' and ``F2'' floating-point errata.)
18551
18552 @item -mr10k-cache-barrier=@var{setting}
18553 @opindex mr10k-cache-barrier
18554 Specify whether GCC should insert cache barriers to avoid the
18555 side-effects of speculation on R10K processors.
18556
18557 In common with many processors, the R10K tries to predict the outcome
18558 of a conditional branch and speculatively executes instructions from
18559 the ``taken'' branch. It later aborts these instructions if the
18560 predicted outcome is wrong. However, on the R10K, even aborted
18561 instructions can have side effects.
18562
18563 This problem only affects kernel stores and, depending on the system,
18564 kernel loads. As an example, a speculatively-executed store may load
18565 the target memory into cache and mark the cache line as dirty, even if
18566 the store itself is later aborted. If a DMA operation writes to the
18567 same area of memory before the ``dirty'' line is flushed, the cached
18568 data overwrites the DMA-ed data. See the R10K processor manual
18569 for a full description, including other potential problems.
18570
18571 One workaround is to insert cache barrier instructions before every memory
18572 access that might be speculatively executed and that might have side
18573 effects even if aborted. @option{-mr10k-cache-barrier=@var{setting}}
18574 controls GCC's implementation of this workaround. It assumes that
18575 aborted accesses to any byte in the following regions does not have
18576 side effects:
18577
18578 @enumerate
18579 @item
18580 the memory occupied by the current function's stack frame;
18581
18582 @item
18583 the memory occupied by an incoming stack argument;
18584
18585 @item
18586 the memory occupied by an object with a link-time-constant address.
18587 @end enumerate
18588
18589 It is the kernel's responsibility to ensure that speculative
18590 accesses to these regions are indeed safe.
18591
18592 If the input program contains a function declaration such as:
18593
18594 @smallexample
18595 void foo (void);
18596 @end smallexample
18597
18598 then the implementation of @code{foo} must allow @code{j foo} and
18599 @code{jal foo} to be executed speculatively. GCC honors this
18600 restriction for functions it compiles itself. It expects non-GCC
18601 functions (such as hand-written assembly code) to do the same.
18602
18603 The option has three forms:
18604
18605 @table @gcctabopt
18606 @item -mr10k-cache-barrier=load-store
18607 Insert a cache barrier before a load or store that might be
18608 speculatively executed and that might have side effects even
18609 if aborted.
18610
18611 @item -mr10k-cache-barrier=store
18612 Insert a cache barrier before a store that might be speculatively
18613 executed and that might have side effects even if aborted.
18614
18615 @item -mr10k-cache-barrier=none
18616 Disable the insertion of cache barriers. This is the default setting.
18617 @end table
18618
18619 @item -mflush-func=@var{func}
18620 @itemx -mno-flush-func
18621 @opindex mflush-func
18622 Specifies the function to call to flush the I and D caches, or to not
18623 call any such function. If called, the function must take the same
18624 arguments as the common @code{_flush_func}, that is, the address of the
18625 memory range for which the cache is being flushed, the size of the
18626 memory range, and the number 3 (to flush both caches). The default
18627 depends on the target GCC was configured for, but commonly is either
18628 @code{_flush_func} or @code{__cpu_flush}.
18629
18630 @item mbranch-cost=@var{num}
18631 @opindex mbranch-cost
18632 Set the cost of branches to roughly @var{num} ``simple'' instructions.
18633 This cost is only a heuristic and is not guaranteed to produce
18634 consistent results across releases. A zero cost redundantly selects
18635 the default, which is based on the @option{-mtune} setting.
18636
18637 @item -mbranch-likely
18638 @itemx -mno-branch-likely
18639 @opindex mbranch-likely
18640 @opindex mno-branch-likely
18641 Enable or disable use of Branch Likely instructions, regardless of the
18642 default for the selected architecture. By default, Branch Likely
18643 instructions may be generated if they are supported by the selected
18644 architecture. An exception is for the MIPS32 and MIPS64 architectures
18645 and processors that implement those architectures; for those, Branch
18646 Likely instructions are not be generated by default because the MIPS32
18647 and MIPS64 architectures specifically deprecate their use.
18648
18649 @item -mcompact-branches=never
18650 @itemx -mcompact-branches=optimal
18651 @itemx -mcompact-branches=always
18652 @opindex mcompact-branches=never
18653 @opindex mcompact-branches=optimal
18654 @opindex mcompact-branches=always
18655 These options control which form of branches will be generated. The
18656 default is @option{-mcompact-branches=optimal}.
18657
18658 The @option{-mcompact-branches=never} option ensures that compact branch
18659 instructions will never be generated.
18660
18661 The @option{-mcompact-branches=always} option ensures that a compact
18662 branch instruction will be generated if available. If a compact branch
18663 instruction is not available, a delay slot form of the branch will be
18664 used instead.
18665
18666 This option is supported from MIPS Release 6 onwards.
18667
18668 The @option{-mcompact-branches=optimal} option will cause a delay slot
18669 branch to be used if one is available in the current ISA and the delay
18670 slot is successfully filled. If the delay slot is not filled, a compact
18671 branch will be chosen if one is available.
18672
18673 @item -mfp-exceptions
18674 @itemx -mno-fp-exceptions
18675 @opindex mfp-exceptions
18676 Specifies whether FP exceptions are enabled. This affects how
18677 FP instructions are scheduled for some processors.
18678 The default is that FP exceptions are
18679 enabled.
18680
18681 For instance, on the SB-1, if FP exceptions are disabled, and we are emitting
18682 64-bit code, then we can use both FP pipes. Otherwise, we can only use one
18683 FP pipe.
18684
18685 @item -mvr4130-align
18686 @itemx -mno-vr4130-align
18687 @opindex mvr4130-align
18688 The VR4130 pipeline is two-way superscalar, but can only issue two
18689 instructions together if the first one is 8-byte aligned. When this
18690 option is enabled, GCC aligns pairs of instructions that it
18691 thinks should execute in parallel.
18692
18693 This option only has an effect when optimizing for the VR4130.
18694 It normally makes code faster, but at the expense of making it bigger.
18695 It is enabled by default at optimization level @option{-O3}.
18696
18697 @item -msynci
18698 @itemx -mno-synci
18699 @opindex msynci
18700 Enable (disable) generation of @code{synci} instructions on
18701 architectures that support it. The @code{synci} instructions (if
18702 enabled) are generated when @code{__builtin___clear_cache} is
18703 compiled.
18704
18705 This option defaults to @option{-mno-synci}, but the default can be
18706 overridden by configuring GCC with @option{--with-synci}.
18707
18708 When compiling code for single processor systems, it is generally safe
18709 to use @code{synci}. However, on many multi-core (SMP) systems, it
18710 does not invalidate the instruction caches on all cores and may lead
18711 to undefined behavior.
18712
18713 @item -mrelax-pic-calls
18714 @itemx -mno-relax-pic-calls
18715 @opindex mrelax-pic-calls
18716 Try to turn PIC calls that are normally dispatched via register
18717 @code{$25} into direct calls. This is only possible if the linker can
18718 resolve the destination at link time and if the destination is within
18719 range for a direct call.
18720
18721 @option{-mrelax-pic-calls} is the default if GCC was configured to use
18722 an assembler and a linker that support the @code{.reloc} assembly
18723 directive and @option{-mexplicit-relocs} is in effect. With
18724 @option{-mno-explicit-relocs}, this optimization can be performed by the
18725 assembler and the linker alone without help from the compiler.
18726
18727 @item -mmcount-ra-address
18728 @itemx -mno-mcount-ra-address
18729 @opindex mmcount-ra-address
18730 @opindex mno-mcount-ra-address
18731 Emit (do not emit) code that allows @code{_mcount} to modify the
18732 calling function's return address. When enabled, this option extends
18733 the usual @code{_mcount} interface with a new @var{ra-address}
18734 parameter, which has type @code{intptr_t *} and is passed in register
18735 @code{$12}. @code{_mcount} can then modify the return address by
18736 doing both of the following:
18737 @itemize
18738 @item
18739 Returning the new address in register @code{$31}.
18740 @item
18741 Storing the new address in @code{*@var{ra-address}},
18742 if @var{ra-address} is nonnull.
18743 @end itemize
18744
18745 The default is @option{-mno-mcount-ra-address}.
18746
18747 @item -mframe-header-opt
18748 @itemx -mno-frame-header-opt
18749 @opindex mframe-header-opt
18750 Enable (disable) frame header optimization in the o32 ABI. When using the
18751 o32 ABI, calling functions will allocate 16 bytes on the stack for the called
18752 function to write out register arguments. When enabled, this optimization
18753 will suppress the allocation of the frame header if it can be determined that
18754 it is unused.
18755
18756 This optimization is off by default at all optimization levels.
18757
18758 @end table
18759
18760 @node MMIX Options
18761 @subsection MMIX Options
18762 @cindex MMIX Options
18763
18764 These options are defined for the MMIX:
18765
18766 @table @gcctabopt
18767 @item -mlibfuncs
18768 @itemx -mno-libfuncs
18769 @opindex mlibfuncs
18770 @opindex mno-libfuncs
18771 Specify that intrinsic library functions are being compiled, passing all
18772 values in registers, no matter the size.
18773
18774 @item -mepsilon
18775 @itemx -mno-epsilon
18776 @opindex mepsilon
18777 @opindex mno-epsilon
18778 Generate floating-point comparison instructions that compare with respect
18779 to the @code{rE} epsilon register.
18780
18781 @item -mabi=mmixware
18782 @itemx -mabi=gnu
18783 @opindex mabi=mmixware
18784 @opindex mabi=gnu
18785 Generate code that passes function parameters and return values that (in
18786 the called function) are seen as registers @code{$0} and up, as opposed to
18787 the GNU ABI which uses global registers @code{$231} and up.
18788
18789 @item -mzero-extend
18790 @itemx -mno-zero-extend
18791 @opindex mzero-extend
18792 @opindex mno-zero-extend
18793 When reading data from memory in sizes shorter than 64 bits, use (do not
18794 use) zero-extending load instructions by default, rather than
18795 sign-extending ones.
18796
18797 @item -mknuthdiv
18798 @itemx -mno-knuthdiv
18799 @opindex mknuthdiv
18800 @opindex mno-knuthdiv
18801 Make the result of a division yielding a remainder have the same sign as
18802 the divisor. With the default, @option{-mno-knuthdiv}, the sign of the
18803 remainder follows the sign of the dividend. Both methods are
18804 arithmetically valid, the latter being almost exclusively used.
18805
18806 @item -mtoplevel-symbols
18807 @itemx -mno-toplevel-symbols
18808 @opindex mtoplevel-symbols
18809 @opindex mno-toplevel-symbols
18810 Prepend (do not prepend) a @samp{:} to all global symbols, so the assembly
18811 code can be used with the @code{PREFIX} assembly directive.
18812
18813 @item -melf
18814 @opindex melf
18815 Generate an executable in the ELF format, rather than the default
18816 @samp{mmo} format used by the @command{mmix} simulator.
18817
18818 @item -mbranch-predict
18819 @itemx -mno-branch-predict
18820 @opindex mbranch-predict
18821 @opindex mno-branch-predict
18822 Use (do not use) the probable-branch instructions, when static branch
18823 prediction indicates a probable branch.
18824
18825 @item -mbase-addresses
18826 @itemx -mno-base-addresses
18827 @opindex mbase-addresses
18828 @opindex mno-base-addresses
18829 Generate (do not generate) code that uses @emph{base addresses}. Using a
18830 base address automatically generates a request (handled by the assembler
18831 and the linker) for a constant to be set up in a global register. The
18832 register is used for one or more base address requests within the range 0
18833 to 255 from the value held in the register. The generally leads to short
18834 and fast code, but the number of different data items that can be
18835 addressed is limited. This means that a program that uses lots of static
18836 data may require @option{-mno-base-addresses}.
18837
18838 @item -msingle-exit
18839 @itemx -mno-single-exit
18840 @opindex msingle-exit
18841 @opindex mno-single-exit
18842 Force (do not force) generated code to have a single exit point in each
18843 function.
18844 @end table
18845
18846 @node MN10300 Options
18847 @subsection MN10300 Options
18848 @cindex MN10300 options
18849
18850 These @option{-m} options are defined for Matsushita MN10300 architectures:
18851
18852 @table @gcctabopt
18853 @item -mmult-bug
18854 @opindex mmult-bug
18855 Generate code to avoid bugs in the multiply instructions for the MN10300
18856 processors. This is the default.
18857
18858 @item -mno-mult-bug
18859 @opindex mno-mult-bug
18860 Do not generate code to avoid bugs in the multiply instructions for the
18861 MN10300 processors.
18862
18863 @item -mam33
18864 @opindex mam33
18865 Generate code using features specific to the AM33 processor.
18866
18867 @item -mno-am33
18868 @opindex mno-am33
18869 Do not generate code using features specific to the AM33 processor. This
18870 is the default.
18871
18872 @item -mam33-2
18873 @opindex mam33-2
18874 Generate code using features specific to the AM33/2.0 processor.
18875
18876 @item -mam34
18877 @opindex mam34
18878 Generate code using features specific to the AM34 processor.
18879
18880 @item -mtune=@var{cpu-type}
18881 @opindex mtune
18882 Use the timing characteristics of the indicated CPU type when
18883 scheduling instructions. This does not change the targeted processor
18884 type. The CPU type must be one of @samp{mn10300}, @samp{am33},
18885 @samp{am33-2} or @samp{am34}.
18886
18887 @item -mreturn-pointer-on-d0
18888 @opindex mreturn-pointer-on-d0
18889 When generating a function that returns a pointer, return the pointer
18890 in both @code{a0} and @code{d0}. Otherwise, the pointer is returned
18891 only in @code{a0}, and attempts to call such functions without a prototype
18892 result in errors. Note that this option is on by default; use
18893 @option{-mno-return-pointer-on-d0} to disable it.
18894
18895 @item -mno-crt0
18896 @opindex mno-crt0
18897 Do not link in the C run-time initialization object file.
18898
18899 @item -mrelax
18900 @opindex mrelax
18901 Indicate to the linker that it should perform a relaxation optimization pass
18902 to shorten branches, calls and absolute memory addresses. This option only
18903 has an effect when used on the command line for the final link step.
18904
18905 This option makes symbolic debugging impossible.
18906
18907 @item -mliw
18908 @opindex mliw
18909 Allow the compiler to generate @emph{Long Instruction Word}
18910 instructions if the target is the @samp{AM33} or later. This is the
18911 default. This option defines the preprocessor macro @code{__LIW__}.
18912
18913 @item -mnoliw
18914 @opindex mnoliw
18915 Do not allow the compiler to generate @emph{Long Instruction Word}
18916 instructions. This option defines the preprocessor macro
18917 @code{__NO_LIW__}.
18918
18919 @item -msetlb
18920 @opindex msetlb
18921 Allow the compiler to generate the @emph{SETLB} and @emph{Lcc}
18922 instructions if the target is the @samp{AM33} or later. This is the
18923 default. This option defines the preprocessor macro @code{__SETLB__}.
18924
18925 @item -mnosetlb
18926 @opindex mnosetlb
18927 Do not allow the compiler to generate @emph{SETLB} or @emph{Lcc}
18928 instructions. This option defines the preprocessor macro
18929 @code{__NO_SETLB__}.
18930
18931 @end table
18932
18933 @node Moxie Options
18934 @subsection Moxie Options
18935 @cindex Moxie Options
18936
18937 @table @gcctabopt
18938
18939 @item -meb
18940 @opindex meb
18941 Generate big-endian code. This is the default for @samp{moxie-*-*}
18942 configurations.
18943
18944 @item -mel
18945 @opindex mel
18946 Generate little-endian code.
18947
18948 @item -mmul.x
18949 @opindex mmul.x
18950 Generate mul.x and umul.x instructions. This is the default for
18951 @samp{moxiebox-*-*} configurations.
18952
18953 @item -mno-crt0
18954 @opindex mno-crt0
18955 Do not link in the C run-time initialization object file.
18956
18957 @end table
18958
18959 @node MSP430 Options
18960 @subsection MSP430 Options
18961 @cindex MSP430 Options
18962
18963 These options are defined for the MSP430:
18964
18965 @table @gcctabopt
18966
18967 @item -masm-hex
18968 @opindex masm-hex
18969 Force assembly output to always use hex constants. Normally such
18970 constants are signed decimals, but this option is available for
18971 testsuite and/or aesthetic purposes.
18972
18973 @item -mmcu=
18974 @opindex mmcu=
18975 Select the MCU to target. This is used to create a C preprocessor
18976 symbol based upon the MCU name, converted to upper case and pre- and
18977 post-fixed with @samp{__}. This in turn is used by the
18978 @file{msp430.h} header file to select an MCU-specific supplementary
18979 header file.
18980
18981 The option also sets the ISA to use. If the MCU name is one that is
18982 known to only support the 430 ISA then that is selected, otherwise the
18983 430X ISA is selected. A generic MCU name of @samp{msp430} can also be
18984 used to select the 430 ISA. Similarly the generic @samp{msp430x} MCU
18985 name selects the 430X ISA.
18986
18987 In addition an MCU-specific linker script is added to the linker
18988 command line. The script's name is the name of the MCU with
18989 @file{.ld} appended. Thus specifying @option{-mmcu=xxx} on the @command{gcc}
18990 command line defines the C preprocessor symbol @code{__XXX__} and
18991 cause the linker to search for a script called @file{xxx.ld}.
18992
18993 This option is also passed on to the assembler.
18994
18995 @item -mwarn-mcu
18996 @itemx -mno-warn-mcu
18997 @opindex mwarn-mcu
18998 @opindex mno-warn-mcu
18999 This option enables or disables warnings about conflicts between the
19000 MCU name specified by the @option{-mmcu} option and the ISA set by the
19001 @option{-mcpu} option and/or the hardware multiply support set by the
19002 @option{-mhwmult} option. It also toggles warnings about unrecognized
19003 MCU names. This option is on by default.
19004
19005 @item -mcpu=
19006 @opindex mcpu=
19007 Specifies the ISA to use. Accepted values are @samp{msp430},
19008 @samp{msp430x} and @samp{msp430xv2}. This option is deprecated. The
19009 @option{-mmcu=} option should be used to select the ISA.
19010
19011 @item -msim
19012 @opindex msim
19013 Link to the simulator runtime libraries and linker script. Overrides
19014 any scripts that would be selected by the @option{-mmcu=} option.
19015
19016 @item -mlarge
19017 @opindex mlarge
19018 Use large-model addressing (20-bit pointers, 32-bit @code{size_t}).
19019
19020 @item -msmall
19021 @opindex msmall
19022 Use small-model addressing (16-bit pointers, 16-bit @code{size_t}).
19023
19024 @item -mrelax
19025 @opindex mrelax
19026 This option is passed to the assembler and linker, and allows the
19027 linker to perform certain optimizations that cannot be done until
19028 the final link.
19029
19030 @item mhwmult=
19031 @opindex mhwmult=
19032 Describes the type of hardware multiply supported by the target.
19033 Accepted values are @samp{none} for no hardware multiply, @samp{16bit}
19034 for the original 16-bit-only multiply supported by early MCUs.
19035 @samp{32bit} for the 16/32-bit multiply supported by later MCUs and
19036 @samp{f5series} for the 16/32-bit multiply supported by F5-series MCUs.
19037 A value of @samp{auto} can also be given. This tells GCC to deduce
19038 the hardware multiply support based upon the MCU name provided by the
19039 @option{-mmcu} option. If no @option{-mmcu} option is specified or if
19040 the MCU name is not recognized then no hardware multiply support is
19041 assumed. @code{auto} is the default setting.
19042
19043 Hardware multiplies are normally performed by calling a library
19044 routine. This saves space in the generated code. When compiling at
19045 @option{-O3} or higher however the hardware multiplier is invoked
19046 inline. This makes for bigger, but faster code.
19047
19048 The hardware multiply routines disable interrupts whilst running and
19049 restore the previous interrupt state when they finish. This makes
19050 them safe to use inside interrupt handlers as well as in normal code.
19051
19052 @item -minrt
19053 @opindex minrt
19054 Enable the use of a minimum runtime environment - no static
19055 initializers or constructors. This is intended for memory-constrained
19056 devices. The compiler includes special symbols in some objects
19057 that tell the linker and runtime which code fragments are required.
19058
19059 @item -mcode-region=
19060 @itemx -mdata-region=
19061 @opindex mcode-region
19062 @opindex mdata-region
19063 These options tell the compiler where to place functions and data that
19064 do not have one of the @code{lower}, @code{upper}, @code{either} or
19065 @code{section} attributes. Possible values are @code{lower},
19066 @code{upper}, @code{either} or @code{any}. The first three behave
19067 like the corresponding attribute. The fourth possible value -
19068 @code{any} - is the default. It leaves placement entirely up to the
19069 linker script and how it assigns the standard sections
19070 (@code{.text}, @code{.data}, etc) to the memory regions.
19071
19072 @item -msilicon-errata=
19073 @opindex msilicon-errata
19074 This option passes on a request to assembler to enable the fixes for
19075 the named silicon errata.
19076
19077 @item -msilicon-errata-warn=
19078 @opindex msilicon-errata-warn
19079 This option passes on a request to the assembler to enable warning
19080 messages when a silicon errata might need to be applied.
19081
19082 @end table
19083
19084 @node NDS32 Options
19085 @subsection NDS32 Options
19086 @cindex NDS32 Options
19087
19088 These options are defined for NDS32 implementations:
19089
19090 @table @gcctabopt
19091
19092 @item -mbig-endian
19093 @opindex mbig-endian
19094 Generate code in big-endian mode.
19095
19096 @item -mlittle-endian
19097 @opindex mlittle-endian
19098 Generate code in little-endian mode.
19099
19100 @item -mreduced-regs
19101 @opindex mreduced-regs
19102 Use reduced-set registers for register allocation.
19103
19104 @item -mfull-regs
19105 @opindex mfull-regs
19106 Use full-set registers for register allocation.
19107
19108 @item -mcmov
19109 @opindex mcmov
19110 Generate conditional move instructions.
19111
19112 @item -mno-cmov
19113 @opindex mno-cmov
19114 Do not generate conditional move instructions.
19115
19116 @item -mperf-ext
19117 @opindex mperf-ext
19118 Generate performance extension instructions.
19119
19120 @item -mno-perf-ext
19121 @opindex mno-perf-ext
19122 Do not generate performance extension instructions.
19123
19124 @item -mv3push
19125 @opindex mv3push
19126 Generate v3 push25/pop25 instructions.
19127
19128 @item -mno-v3push
19129 @opindex mno-v3push
19130 Do not generate v3 push25/pop25 instructions.
19131
19132 @item -m16-bit
19133 @opindex m16-bit
19134 Generate 16-bit instructions.
19135
19136 @item -mno-16-bit
19137 @opindex mno-16-bit
19138 Do not generate 16-bit instructions.
19139
19140 @item -misr-vector-size=@var{num}
19141 @opindex misr-vector-size
19142 Specify the size of each interrupt vector, which must be 4 or 16.
19143
19144 @item -mcache-block-size=@var{num}
19145 @opindex mcache-block-size
19146 Specify the size of each cache block,
19147 which must be a power of 2 between 4 and 512.
19148
19149 @item -march=@var{arch}
19150 @opindex march
19151 Specify the name of the target architecture.
19152
19153 @item -mcmodel=@var{code-model}
19154 @opindex mcmodel
19155 Set the code model to one of
19156 @table @asis
19157 @item @samp{small}
19158 All the data and read-only data segments must be within 512KB addressing space.
19159 The text segment must be within 16MB addressing space.
19160 @item @samp{medium}
19161 The data segment must be within 512KB while the read-only data segment can be
19162 within 4GB addressing space. The text segment should be still within 16MB
19163 addressing space.
19164 @item @samp{large}
19165 All the text and data segments can be within 4GB addressing space.
19166 @end table
19167
19168 @item -mctor-dtor
19169 @opindex mctor-dtor
19170 Enable constructor/destructor feature.
19171
19172 @item -mrelax
19173 @opindex mrelax
19174 Guide linker to relax instructions.
19175
19176 @end table
19177
19178 @node Nios II Options
19179 @subsection Nios II Options
19180 @cindex Nios II options
19181 @cindex Altera Nios II options
19182
19183 These are the options defined for the Altera Nios II processor.
19184
19185 @table @gcctabopt
19186
19187 @item -G @var{num}
19188 @opindex G
19189 @cindex smaller data references
19190 Put global and static objects less than or equal to @var{num} bytes
19191 into the small data or BSS sections instead of the normal data or BSS
19192 sections. The default value of @var{num} is 8.
19193
19194 @item -mgpopt=@var{option}
19195 @item -mgpopt
19196 @itemx -mno-gpopt
19197 @opindex mgpopt
19198 @opindex mno-gpopt
19199 Generate (do not generate) GP-relative accesses. The following
19200 @var{option} names are recognized:
19201
19202 @table @samp
19203
19204 @item none
19205 Do not generate GP-relative accesses.
19206
19207 @item local
19208 Generate GP-relative accesses for small data objects that are not
19209 external, weak, or uninitialized common symbols.
19210 Also use GP-relative addressing for objects that
19211 have been explicitly placed in a small data section via a @code{section}
19212 attribute.
19213
19214 @item global
19215 As for @samp{local}, but also generate GP-relative accesses for
19216 small data objects that are external, weak, or common. If you use this option,
19217 you must ensure that all parts of your program (including libraries) are
19218 compiled with the same @option{-G} setting.
19219
19220 @item data
19221 Generate GP-relative accesses for all data objects in the program. If you
19222 use this option, the entire data and BSS segments
19223 of your program must fit in 64K of memory and you must use an appropriate
19224 linker script to allocate them within the addressable range of the
19225 global pointer.
19226
19227 @item all
19228 Generate GP-relative addresses for function pointers as well as data
19229 pointers. If you use this option, the entire text, data, and BSS segments
19230 of your program must fit in 64K of memory and you must use an appropriate
19231 linker script to allocate them within the addressable range of the
19232 global pointer.
19233
19234 @end table
19235
19236 @option{-mgpopt} is equivalent to @option{-mgpopt=local}, and
19237 @option{-mno-gpopt} is equivalent to @option{-mgpopt=none}.
19238
19239 The default is @option{-mgpopt} except when @option{-fpic} or
19240 @option{-fPIC} is specified to generate position-independent code.
19241 Note that the Nios II ABI does not permit GP-relative accesses from
19242 shared libraries.
19243
19244 You may need to specify @option{-mno-gpopt} explicitly when building
19245 programs that include large amounts of small data, including large
19246 GOT data sections. In this case, the 16-bit offset for GP-relative
19247 addressing may not be large enough to allow access to the entire
19248 small data section.
19249
19250 @item -mel
19251 @itemx -meb
19252 @opindex mel
19253 @opindex meb
19254 Generate little-endian (default) or big-endian (experimental) code,
19255 respectively.
19256
19257 @item -march=@var{arch}
19258 @opindex march
19259 This specifies the name of the target Nios II architecture. GCC uses this
19260 name to determine what kind of instructions it can emit when generating
19261 assembly code. Permissible names are: @samp{r1}, @samp{r2}.
19262
19263 The preprocessor macro @code{__nios2_arch__} is available to programs,
19264 with value 1 or 2, indicating the targeted ISA level.
19265
19266 @item -mbypass-cache
19267 @itemx -mno-bypass-cache
19268 @opindex mno-bypass-cache
19269 @opindex mbypass-cache
19270 Force all load and store instructions to always bypass cache by
19271 using I/O variants of the instructions. The default is not to
19272 bypass the cache.
19273
19274 @item -mno-cache-volatile
19275 @itemx -mcache-volatile
19276 @opindex mcache-volatile
19277 @opindex mno-cache-volatile
19278 Volatile memory access bypass the cache using the I/O variants of
19279 the load and store instructions. The default is not to bypass the cache.
19280
19281 @item -mno-fast-sw-div
19282 @itemx -mfast-sw-div
19283 @opindex mno-fast-sw-div
19284 @opindex mfast-sw-div
19285 Do not use table-based fast divide for small numbers. The default
19286 is to use the fast divide at @option{-O3} and above.
19287
19288 @item -mno-hw-mul
19289 @itemx -mhw-mul
19290 @itemx -mno-hw-mulx
19291 @itemx -mhw-mulx
19292 @itemx -mno-hw-div
19293 @itemx -mhw-div
19294 @opindex mno-hw-mul
19295 @opindex mhw-mul
19296 @opindex mno-hw-mulx
19297 @opindex mhw-mulx
19298 @opindex mno-hw-div
19299 @opindex mhw-div
19300 Enable or disable emitting @code{mul}, @code{mulx} and @code{div} family of
19301 instructions by the compiler. The default is to emit @code{mul}
19302 and not emit @code{div} and @code{mulx}.
19303
19304 @item -mbmx
19305 @itemx -mno-bmx
19306 @itemx -mcdx
19307 @itemx -mno-cdx
19308 Enable or disable generation of Nios II R2 BMX (bit manipulation) and
19309 CDX (code density) instructions. Enabling these instructions also
19310 requires @option{-march=r2}. Since these instructions are optional
19311 extensions to the R2 architecture, the default is not to emit them.
19312
19313 @item -mcustom-@var{insn}=@var{N}
19314 @itemx -mno-custom-@var{insn}
19315 @opindex mcustom-@var{insn}
19316 @opindex mno-custom-@var{insn}
19317 Each @option{-mcustom-@var{insn}=@var{N}} option enables use of a
19318 custom instruction with encoding @var{N} when generating code that uses
19319 @var{insn}. For example, @option{-mcustom-fadds=253} generates custom
19320 instruction 253 for single-precision floating-point add operations instead
19321 of the default behavior of using a library call.
19322
19323 The following values of @var{insn} are supported. Except as otherwise
19324 noted, floating-point operations are expected to be implemented with
19325 normal IEEE 754 semantics and correspond directly to the C operators or the
19326 equivalent GCC built-in functions (@pxref{Other Builtins}).
19327
19328 Single-precision floating point:
19329 @table @asis
19330
19331 @item @samp{fadds}, @samp{fsubs}, @samp{fdivs}, @samp{fmuls}
19332 Binary arithmetic operations.
19333
19334 @item @samp{fnegs}
19335 Unary negation.
19336
19337 @item @samp{fabss}
19338 Unary absolute value.
19339
19340 @item @samp{fcmpeqs}, @samp{fcmpges}, @samp{fcmpgts}, @samp{fcmples}, @samp{fcmplts}, @samp{fcmpnes}
19341 Comparison operations.
19342
19343 @item @samp{fmins}, @samp{fmaxs}
19344 Floating-point minimum and maximum. These instructions are only
19345 generated if @option{-ffinite-math-only} is specified.
19346
19347 @item @samp{fsqrts}
19348 Unary square root operation.
19349
19350 @item @samp{fcoss}, @samp{fsins}, @samp{ftans}, @samp{fatans}, @samp{fexps}, @samp{flogs}
19351 Floating-point trigonometric and exponential functions. These instructions
19352 are only generated if @option{-funsafe-math-optimizations} is also specified.
19353
19354 @end table
19355
19356 Double-precision floating point:
19357 @table @asis
19358
19359 @item @samp{faddd}, @samp{fsubd}, @samp{fdivd}, @samp{fmuld}
19360 Binary arithmetic operations.
19361
19362 @item @samp{fnegd}
19363 Unary negation.
19364
19365 @item @samp{fabsd}
19366 Unary absolute value.
19367
19368 @item @samp{fcmpeqd}, @samp{fcmpged}, @samp{fcmpgtd}, @samp{fcmpled}, @samp{fcmpltd}, @samp{fcmpned}
19369 Comparison operations.
19370
19371 @item @samp{fmind}, @samp{fmaxd}
19372 Double-precision minimum and maximum. These instructions are only
19373 generated if @option{-ffinite-math-only} is specified.
19374
19375 @item @samp{fsqrtd}
19376 Unary square root operation.
19377
19378 @item @samp{fcosd}, @samp{fsind}, @samp{ftand}, @samp{fatand}, @samp{fexpd}, @samp{flogd}
19379 Double-precision trigonometric and exponential functions. These instructions
19380 are only generated if @option{-funsafe-math-optimizations} is also specified.
19381
19382 @end table
19383
19384 Conversions:
19385 @table @asis
19386 @item @samp{fextsd}
19387 Conversion from single precision to double precision.
19388
19389 @item @samp{ftruncds}
19390 Conversion from double precision to single precision.
19391
19392 @item @samp{fixsi}, @samp{fixsu}, @samp{fixdi}, @samp{fixdu}
19393 Conversion from floating point to signed or unsigned integer types, with
19394 truncation towards zero.
19395
19396 @item @samp{round}
19397 Conversion from single-precision floating point to signed integer,
19398 rounding to the nearest integer and ties away from zero.
19399 This corresponds to the @code{__builtin_lroundf} function when
19400 @option{-fno-math-errno} is used.
19401
19402 @item @samp{floatis}, @samp{floatus}, @samp{floatid}, @samp{floatud}
19403 Conversion from signed or unsigned integer types to floating-point types.
19404
19405 @end table
19406
19407 In addition, all of the following transfer instructions for internal
19408 registers X and Y must be provided to use any of the double-precision
19409 floating-point instructions. Custom instructions taking two
19410 double-precision source operands expect the first operand in the
19411 64-bit register X. The other operand (or only operand of a unary
19412 operation) is given to the custom arithmetic instruction with the
19413 least significant half in source register @var{src1} and the most
19414 significant half in @var{src2}. A custom instruction that returns a
19415 double-precision result returns the most significant 32 bits in the
19416 destination register and the other half in 32-bit register Y.
19417 GCC automatically generates the necessary code sequences to write
19418 register X and/or read register Y when double-precision floating-point
19419 instructions are used.
19420
19421 @table @asis
19422
19423 @item @samp{fwrx}
19424 Write @var{src1} into the least significant half of X and @var{src2} into
19425 the most significant half of X.
19426
19427 @item @samp{fwry}
19428 Write @var{src1} into Y.
19429
19430 @item @samp{frdxhi}, @samp{frdxlo}
19431 Read the most or least (respectively) significant half of X and store it in
19432 @var{dest}.
19433
19434 @item @samp{frdy}
19435 Read the value of Y and store it into @var{dest}.
19436 @end table
19437
19438 Note that you can gain more local control over generation of Nios II custom
19439 instructions by using the @code{target("custom-@var{insn}=@var{N}")}
19440 and @code{target("no-custom-@var{insn}")} function attributes
19441 (@pxref{Function Attributes})
19442 or pragmas (@pxref{Function Specific Option Pragmas}).
19443
19444 @item -mcustom-fpu-cfg=@var{name}
19445 @opindex mcustom-fpu-cfg
19446
19447 This option enables a predefined, named set of custom instruction encodings
19448 (see @option{-mcustom-@var{insn}} above).
19449 Currently, the following sets are defined:
19450
19451 @option{-mcustom-fpu-cfg=60-1} is equivalent to:
19452 @gccoptlist{-mcustom-fmuls=252 @gol
19453 -mcustom-fadds=253 @gol
19454 -mcustom-fsubs=254 @gol
19455 -fsingle-precision-constant}
19456
19457 @option{-mcustom-fpu-cfg=60-2} is equivalent to:
19458 @gccoptlist{-mcustom-fmuls=252 @gol
19459 -mcustom-fadds=253 @gol
19460 -mcustom-fsubs=254 @gol
19461 -mcustom-fdivs=255 @gol
19462 -fsingle-precision-constant}
19463
19464 @option{-mcustom-fpu-cfg=72-3} is equivalent to:
19465 @gccoptlist{-mcustom-floatus=243 @gol
19466 -mcustom-fixsi=244 @gol
19467 -mcustom-floatis=245 @gol
19468 -mcustom-fcmpgts=246 @gol
19469 -mcustom-fcmples=249 @gol
19470 -mcustom-fcmpeqs=250 @gol
19471 -mcustom-fcmpnes=251 @gol
19472 -mcustom-fmuls=252 @gol
19473 -mcustom-fadds=253 @gol
19474 -mcustom-fsubs=254 @gol
19475 -mcustom-fdivs=255 @gol
19476 -fsingle-precision-constant}
19477
19478 Custom instruction assignments given by individual
19479 @option{-mcustom-@var{insn}=} options override those given by
19480 @option{-mcustom-fpu-cfg=}, regardless of the
19481 order of the options on the command line.
19482
19483 Note that you can gain more local control over selection of a FPU
19484 configuration by using the @code{target("custom-fpu-cfg=@var{name}")}
19485 function attribute (@pxref{Function Attributes})
19486 or pragma (@pxref{Function Specific Option Pragmas}).
19487
19488 @end table
19489
19490 These additional @samp{-m} options are available for the Altera Nios II
19491 ELF (bare-metal) target:
19492
19493 @table @gcctabopt
19494
19495 @item -mhal
19496 @opindex mhal
19497 Link with HAL BSP. This suppresses linking with the GCC-provided C runtime
19498 startup and termination code, and is typically used in conjunction with
19499 @option{-msys-crt0=} to specify the location of the alternate startup code
19500 provided by the HAL BSP.
19501
19502 @item -msmallc
19503 @opindex msmallc
19504 Link with a limited version of the C library, @option{-lsmallc}, rather than
19505 Newlib.
19506
19507 @item -msys-crt0=@var{startfile}
19508 @opindex msys-crt0
19509 @var{startfile} is the file name of the startfile (crt0) to use
19510 when linking. This option is only useful in conjunction with @option{-mhal}.
19511
19512 @item -msys-lib=@var{systemlib}
19513 @opindex msys-lib
19514 @var{systemlib} is the library name of the library that provides
19515 low-level system calls required by the C library,
19516 e.g. @code{read} and @code{write}.
19517 This option is typically used to link with a library provided by a HAL BSP.
19518
19519 @end table
19520
19521 @node Nvidia PTX Options
19522 @subsection Nvidia PTX Options
19523 @cindex Nvidia PTX options
19524 @cindex nvptx options
19525
19526 These options are defined for Nvidia PTX:
19527
19528 @table @gcctabopt
19529
19530 @item -m32
19531 @itemx -m64
19532 @opindex m32
19533 @opindex m64
19534 Generate code for 32-bit or 64-bit ABI.
19535
19536 @item -mmainkernel
19537 @opindex mmainkernel
19538 Link in code for a __main kernel. This is for stand-alone instead of
19539 offloading execution.
19540
19541 @item -moptimize
19542 @opindex moptimize
19543 Apply partitioned execution optimizations. This is the default when any
19544 level of optimization is selected.
19545
19546 @end table
19547
19548 @node PDP-11 Options
19549 @subsection PDP-11 Options
19550 @cindex PDP-11 Options
19551
19552 These options are defined for the PDP-11:
19553
19554 @table @gcctabopt
19555 @item -mfpu
19556 @opindex mfpu
19557 Use hardware FPP floating point. This is the default. (FIS floating
19558 point on the PDP-11/40 is not supported.)
19559
19560 @item -msoft-float
19561 @opindex msoft-float
19562 Do not use hardware floating point.
19563
19564 @item -mac0
19565 @opindex mac0
19566 Return floating-point results in ac0 (fr0 in Unix assembler syntax).
19567
19568 @item -mno-ac0
19569 @opindex mno-ac0
19570 Return floating-point results in memory. This is the default.
19571
19572 @item -m40
19573 @opindex m40
19574 Generate code for a PDP-11/40.
19575
19576 @item -m45
19577 @opindex m45
19578 Generate code for a PDP-11/45. This is the default.
19579
19580 @item -m10
19581 @opindex m10
19582 Generate code for a PDP-11/10.
19583
19584 @item -mbcopy-builtin
19585 @opindex mbcopy-builtin
19586 Use inline @code{movmemhi} patterns for copying memory. This is the
19587 default.
19588
19589 @item -mbcopy
19590 @opindex mbcopy
19591 Do not use inline @code{movmemhi} patterns for copying memory.
19592
19593 @item -mint16
19594 @itemx -mno-int32
19595 @opindex mint16
19596 @opindex mno-int32
19597 Use 16-bit @code{int}. This is the default.
19598
19599 @item -mint32
19600 @itemx -mno-int16
19601 @opindex mint32
19602 @opindex mno-int16
19603 Use 32-bit @code{int}.
19604
19605 @item -mfloat64
19606 @itemx -mno-float32
19607 @opindex mfloat64
19608 @opindex mno-float32
19609 Use 64-bit @code{float}. This is the default.
19610
19611 @item -mfloat32
19612 @itemx -mno-float64
19613 @opindex mfloat32
19614 @opindex mno-float64
19615 Use 32-bit @code{float}.
19616
19617 @item -mabshi
19618 @opindex mabshi
19619 Use @code{abshi2} pattern. This is the default.
19620
19621 @item -mno-abshi
19622 @opindex mno-abshi
19623 Do not use @code{abshi2} pattern.
19624
19625 @item -mbranch-expensive
19626 @opindex mbranch-expensive
19627 Pretend that branches are expensive. This is for experimenting with
19628 code generation only.
19629
19630 @item -mbranch-cheap
19631 @opindex mbranch-cheap
19632 Do not pretend that branches are expensive. This is the default.
19633
19634 @item -munix-asm
19635 @opindex munix-asm
19636 Use Unix assembler syntax. This is the default when configured for
19637 @samp{pdp11-*-bsd}.
19638
19639 @item -mdec-asm
19640 @opindex mdec-asm
19641 Use DEC assembler syntax. This is the default when configured for any
19642 PDP-11 target other than @samp{pdp11-*-bsd}.
19643 @end table
19644
19645 @node picoChip Options
19646 @subsection picoChip Options
19647 @cindex picoChip options
19648
19649 These @samp{-m} options are defined for picoChip implementations:
19650
19651 @table @gcctabopt
19652
19653 @item -mae=@var{ae_type}
19654 @opindex mcpu
19655 Set the instruction set, register set, and instruction scheduling
19656 parameters for array element type @var{ae_type}. Supported values
19657 for @var{ae_type} are @samp{ANY}, @samp{MUL}, and @samp{MAC}.
19658
19659 @option{-mae=ANY} selects a completely generic AE type. Code
19660 generated with this option runs on any of the other AE types. The
19661 code is not as efficient as it would be if compiled for a specific
19662 AE type, and some types of operation (e.g., multiplication) do not
19663 work properly on all types of AE.
19664
19665 @option{-mae=MUL} selects a MUL AE type. This is the most useful AE type
19666 for compiled code, and is the default.
19667
19668 @option{-mae=MAC} selects a DSP-style MAC AE. Code compiled with this
19669 option may suffer from poor performance of byte (char) manipulation,
19670 since the DSP AE does not provide hardware support for byte load/stores.
19671
19672 @item -msymbol-as-address
19673 Enable the compiler to directly use a symbol name as an address in a
19674 load/store instruction, without first loading it into a
19675 register. Typically, the use of this option generates larger
19676 programs, which run faster than when the option isn't used. However, the
19677 results vary from program to program, so it is left as a user option,
19678 rather than being permanently enabled.
19679
19680 @item -mno-inefficient-warnings
19681 Disables warnings about the generation of inefficient code. These
19682 warnings can be generated, for example, when compiling code that
19683 performs byte-level memory operations on the MAC AE type. The MAC AE has
19684 no hardware support for byte-level memory operations, so all byte
19685 load/stores must be synthesized from word load/store operations. This is
19686 inefficient and a warning is generated to indicate
19687 that you should rewrite the code to avoid byte operations, or to target
19688 an AE type that has the necessary hardware support. This option disables
19689 these warnings.
19690
19691 @end table
19692
19693 @node PowerPC Options
19694 @subsection PowerPC Options
19695 @cindex PowerPC options
19696
19697 These are listed under @xref{RS/6000 and PowerPC Options}.
19698
19699 @node RL78 Options
19700 @subsection RL78 Options
19701 @cindex RL78 Options
19702
19703 @table @gcctabopt
19704
19705 @item -msim
19706 @opindex msim
19707 Links in additional target libraries to support operation within a
19708 simulator.
19709
19710 @item -mmul=none
19711 @itemx -mmul=g10
19712 @itemx -mmul=g13
19713 @itemx -mmul=g14
19714 @itemx -mmul=rl78
19715 @opindex mmul
19716 Specifies the type of hardware multiplication and division support to
19717 be used. The simplest is @code{none}, which uses software for both
19718 multiplication and division. This is the default. The @code{g13}
19719 value is for the hardware multiply/divide peripheral found on the
19720 RL78/G13 (S2 core) targets. The @code{g14} value selects the use of
19721 the multiplication and division instructions supported by the RL78/G14
19722 (S3 core) parts. The value @code{rl78} is an alias for @code{g14} and
19723 the value @code{mg10} is an alias for @code{none}.
19724
19725 In addition a C preprocessor macro is defined, based upon the setting
19726 of this option. Possible values are: @code{__RL78_MUL_NONE__},
19727 @code{__RL78_MUL_G13__} or @code{__RL78_MUL_G14__}.
19728
19729 @item -mcpu=g10
19730 @itemx -mcpu=g13
19731 @itemx -mcpu=g14
19732 @itemx -mcpu=rl78
19733 @opindex mcpu
19734 Specifies the RL78 core to target. The default is the G14 core, also
19735 known as an S3 core or just RL78. The G13 or S2 core does not have
19736 multiply or divide instructions, instead it uses a hardware peripheral
19737 for these operations. The G10 or S1 core does not have register
19738 banks, so it uses a different calling convention.
19739
19740 If this option is set it also selects the type of hardware multiply
19741 support to use, unless this is overridden by an explicit
19742 @option{-mmul=none} option on the command line. Thus specifying
19743 @option{-mcpu=g13} enables the use of the G13 hardware multiply
19744 peripheral and specifying @option{-mcpu=g10} disables the use of
19745 hardware multiplications altogether.
19746
19747 Note, although the RL78/G14 core is the default target, specifying
19748 @option{-mcpu=g14} or @option{-mcpu=rl78} on the command line does
19749 change the behavior of the toolchain since it also enables G14
19750 hardware multiply support. If these options are not specified on the
19751 command line then software multiplication routines will be used even
19752 though the code targets the RL78 core. This is for backwards
19753 compatibility with older toolchains which did not have hardware
19754 multiply and divide support.
19755
19756 In addition a C preprocessor macro is defined, based upon the setting
19757 of this option. Possible values are: @code{__RL78_G10__},
19758 @code{__RL78_G13__} or @code{__RL78_G14__}.
19759
19760 @item -mg10
19761 @itemx -mg13
19762 @itemx -mg14
19763 @itemx -mrl78
19764 @opindex mg10
19765 @opindex mg13
19766 @opindex mg14
19767 @opindex mrl78
19768 These are aliases for the corresponding @option{-mcpu=} option. They
19769 are provided for backwards compatibility.
19770
19771 @item -mallregs
19772 @opindex mallregs
19773 Allow the compiler to use all of the available registers. By default
19774 registers @code{r24..r31} are reserved for use in interrupt handlers.
19775 With this option enabled these registers can be used in ordinary
19776 functions as well.
19777
19778 @item -m64bit-doubles
19779 @itemx -m32bit-doubles
19780 @opindex m64bit-doubles
19781 @opindex m32bit-doubles
19782 Make the @code{double} data type be 64 bits (@option{-m64bit-doubles})
19783 or 32 bits (@option{-m32bit-doubles}) in size. The default is
19784 @option{-m32bit-doubles}.
19785
19786 @end table
19787
19788 @node RS/6000 and PowerPC Options
19789 @subsection IBM RS/6000 and PowerPC Options
19790 @cindex RS/6000 and PowerPC Options
19791 @cindex IBM RS/6000 and PowerPC Options
19792
19793 These @samp{-m} options are defined for the IBM RS/6000 and PowerPC:
19794 @table @gcctabopt
19795 @item -mpowerpc-gpopt
19796 @itemx -mno-powerpc-gpopt
19797 @itemx -mpowerpc-gfxopt
19798 @itemx -mno-powerpc-gfxopt
19799 @need 800
19800 @itemx -mpowerpc64
19801 @itemx -mno-powerpc64
19802 @itemx -mmfcrf
19803 @itemx -mno-mfcrf
19804 @itemx -mpopcntb
19805 @itemx -mno-popcntb
19806 @itemx -mpopcntd
19807 @itemx -mno-popcntd
19808 @itemx -mfprnd
19809 @itemx -mno-fprnd
19810 @need 800
19811 @itemx -mcmpb
19812 @itemx -mno-cmpb
19813 @itemx -mmfpgpr
19814 @itemx -mno-mfpgpr
19815 @itemx -mhard-dfp
19816 @itemx -mno-hard-dfp
19817 @opindex mpowerpc-gpopt
19818 @opindex mno-powerpc-gpopt
19819 @opindex mpowerpc-gfxopt
19820 @opindex mno-powerpc-gfxopt
19821 @opindex mpowerpc64
19822 @opindex mno-powerpc64
19823 @opindex mmfcrf
19824 @opindex mno-mfcrf
19825 @opindex mpopcntb
19826 @opindex mno-popcntb
19827 @opindex mpopcntd
19828 @opindex mno-popcntd
19829 @opindex mfprnd
19830 @opindex mno-fprnd
19831 @opindex mcmpb
19832 @opindex mno-cmpb
19833 @opindex mmfpgpr
19834 @opindex mno-mfpgpr
19835 @opindex mhard-dfp
19836 @opindex mno-hard-dfp
19837 You use these options to specify which instructions are available on the
19838 processor you are using. The default value of these options is
19839 determined when configuring GCC@. Specifying the
19840 @option{-mcpu=@var{cpu_type}} overrides the specification of these
19841 options. We recommend you use the @option{-mcpu=@var{cpu_type}} option
19842 rather than the options listed above.
19843
19844 Specifying @option{-mpowerpc-gpopt} allows
19845 GCC to use the optional PowerPC architecture instructions in the
19846 General Purpose group, including floating-point square root. Specifying
19847 @option{-mpowerpc-gfxopt} allows GCC to
19848 use the optional PowerPC architecture instructions in the Graphics
19849 group, including floating-point select.
19850
19851 The @option{-mmfcrf} option allows GCC to generate the move from
19852 condition register field instruction implemented on the POWER4
19853 processor and other processors that support the PowerPC V2.01
19854 architecture.
19855 The @option{-mpopcntb} option allows GCC to generate the popcount and
19856 double-precision FP reciprocal estimate instruction implemented on the
19857 POWER5 processor and other processors that support the PowerPC V2.02
19858 architecture.
19859 The @option{-mpopcntd} option allows GCC to generate the popcount
19860 instruction implemented on the POWER7 processor and other processors
19861 that support the PowerPC V2.06 architecture.
19862 The @option{-mfprnd} option allows GCC to generate the FP round to
19863 integer instructions implemented on the POWER5+ processor and other
19864 processors that support the PowerPC V2.03 architecture.
19865 The @option{-mcmpb} option allows GCC to generate the compare bytes
19866 instruction implemented on the POWER6 processor and other processors
19867 that support the PowerPC V2.05 architecture.
19868 The @option{-mmfpgpr} option allows GCC to generate the FP move to/from
19869 general-purpose register instructions implemented on the POWER6X
19870 processor and other processors that support the extended PowerPC V2.05
19871 architecture.
19872 The @option{-mhard-dfp} option allows GCC to generate the decimal
19873 floating-point instructions implemented on some POWER processors.
19874
19875 The @option{-mpowerpc64} option allows GCC to generate the additional
19876 64-bit instructions that are found in the full PowerPC64 architecture
19877 and to treat GPRs as 64-bit, doubleword quantities. GCC defaults to
19878 @option{-mno-powerpc64}.
19879
19880 @item -mcpu=@var{cpu_type}
19881 @opindex mcpu
19882 Set architecture type, register usage, and
19883 instruction scheduling parameters for machine type @var{cpu_type}.
19884 Supported values for @var{cpu_type} are @samp{401}, @samp{403},
19885 @samp{405}, @samp{405fp}, @samp{440}, @samp{440fp}, @samp{464}, @samp{464fp},
19886 @samp{476}, @samp{476fp}, @samp{505}, @samp{601}, @samp{602}, @samp{603},
19887 @samp{603e}, @samp{604}, @samp{604e}, @samp{620}, @samp{630}, @samp{740},
19888 @samp{7400}, @samp{7450}, @samp{750}, @samp{801}, @samp{821}, @samp{823},
19889 @samp{860}, @samp{970}, @samp{8540}, @samp{a2}, @samp{e300c2},
19890 @samp{e300c3}, @samp{e500mc}, @samp{e500mc64}, @samp{e5500},
19891 @samp{e6500}, @samp{ec603e}, @samp{G3}, @samp{G4}, @samp{G5},
19892 @samp{titan}, @samp{power3}, @samp{power4}, @samp{power5}, @samp{power5+},
19893 @samp{power6}, @samp{power6x}, @samp{power7}, @samp{power8},
19894 @samp{power9}, @samp{powerpc}, @samp{powerpc64}, @samp{powerpc64le},
19895 and @samp{rs64}.
19896
19897 @option{-mcpu=powerpc}, @option{-mcpu=powerpc64}, and
19898 @option{-mcpu=powerpc64le} specify pure 32-bit PowerPC (either
19899 endian), 64-bit big endian PowerPC and 64-bit little endian PowerPC
19900 architecture machine types, with an appropriate, generic processor
19901 model assumed for scheduling purposes.
19902
19903 The other options specify a specific processor. Code generated under
19904 those options runs best on that processor, and may not run at all on
19905 others.
19906
19907 The @option{-mcpu} options automatically enable or disable the
19908 following options:
19909
19910 @gccoptlist{-maltivec -mfprnd -mhard-float -mmfcrf -mmultiple @gol
19911 -mpopcntb -mpopcntd -mpowerpc64 @gol
19912 -mpowerpc-gpopt -mpowerpc-gfxopt -msingle-float -mdouble-float @gol
19913 -msimple-fpu -mstring -mmulhw -mdlmzb -mmfpgpr -mvsx @gol
19914 -mcrypto -mdirect-move -mpower8-fusion -mpower8-vector @gol
19915 -mquad-memory -mquad-memory-atomic -mmodulo -mfloat128 -mfloat128-hardware @gol
19916 -mpower9-fusion -mpower9-vector}
19917
19918 The particular options set for any particular CPU varies between
19919 compiler versions, depending on what setting seems to produce optimal
19920 code for that CPU; it doesn't necessarily reflect the actual hardware's
19921 capabilities. If you wish to set an individual option to a particular
19922 value, you may specify it after the @option{-mcpu} option, like
19923 @option{-mcpu=970 -mno-altivec}.
19924
19925 On AIX, the @option{-maltivec} and @option{-mpowerpc64} options are
19926 not enabled or disabled by the @option{-mcpu} option at present because
19927 AIX does not have full support for these options. You may still
19928 enable or disable them individually if you're sure it'll work in your
19929 environment.
19930
19931 @item -mtune=@var{cpu_type}
19932 @opindex mtune
19933 Set the instruction scheduling parameters for machine type
19934 @var{cpu_type}, but do not set the architecture type or register usage,
19935 as @option{-mcpu=@var{cpu_type}} does. The same
19936 values for @var{cpu_type} are used for @option{-mtune} as for
19937 @option{-mcpu}. If both are specified, the code generated uses the
19938 architecture and registers set by @option{-mcpu}, but the
19939 scheduling parameters set by @option{-mtune}.
19940
19941 @item -mcmodel=small
19942 @opindex mcmodel=small
19943 Generate PowerPC64 code for the small model: The TOC is limited to
19944 64k.
19945
19946 @item -mcmodel=medium
19947 @opindex mcmodel=medium
19948 Generate PowerPC64 code for the medium model: The TOC and other static
19949 data may be up to a total of 4G in size.
19950
19951 @item -mcmodel=large
19952 @opindex mcmodel=large
19953 Generate PowerPC64 code for the large model: The TOC may be up to 4G
19954 in size. Other data and code is only limited by the 64-bit address
19955 space.
19956
19957 @item -maltivec
19958 @itemx -mno-altivec
19959 @opindex maltivec
19960 @opindex mno-altivec
19961 Generate code that uses (does not use) AltiVec instructions, and also
19962 enable the use of built-in functions that allow more direct access to
19963 the AltiVec instruction set. You may also need to set
19964 @option{-mabi=altivec} to adjust the current ABI with AltiVec ABI
19965 enhancements.
19966
19967 When @option{-maltivec} is used, rather than @option{-maltivec=le} or
19968 @option{-maltivec=be}, the element order for AltiVec intrinsics such
19969 as @code{vec_splat}, @code{vec_extract}, and @code{vec_insert}
19970 match array element order corresponding to the endianness of the
19971 target. That is, element zero identifies the leftmost element in a
19972 vector register when targeting a big-endian platform, and identifies
19973 the rightmost element in a vector register when targeting a
19974 little-endian platform.
19975
19976 @item -maltivec=be
19977 @opindex maltivec=be
19978 Generate AltiVec instructions using big-endian element order,
19979 regardless of whether the target is big- or little-endian. This is
19980 the default when targeting a big-endian platform.
19981
19982 The element order is used to interpret element numbers in AltiVec
19983 intrinsics such as @code{vec_splat}, @code{vec_extract}, and
19984 @code{vec_insert}. By default, these match array element order
19985 corresponding to the endianness for the target.
19986
19987 @item -maltivec=le
19988 @opindex maltivec=le
19989 Generate AltiVec instructions using little-endian element order,
19990 regardless of whether the target is big- or little-endian. This is
19991 the default when targeting a little-endian platform. This option is
19992 currently ignored when targeting a big-endian platform.
19993
19994 The element order is used to interpret element numbers in AltiVec
19995 intrinsics such as @code{vec_splat}, @code{vec_extract}, and
19996 @code{vec_insert}. By default, these match array element order
19997 corresponding to the endianness for the target.
19998
19999 @item -mvrsave
20000 @itemx -mno-vrsave
20001 @opindex mvrsave
20002 @opindex mno-vrsave
20003 Generate VRSAVE instructions when generating AltiVec code.
20004
20005 @item -mgen-cell-microcode
20006 @opindex mgen-cell-microcode
20007 Generate Cell microcode instructions.
20008
20009 @item -mwarn-cell-microcode
20010 @opindex mwarn-cell-microcode
20011 Warn when a Cell microcode instruction is emitted. An example
20012 of a Cell microcode instruction is a variable shift.
20013
20014 @item -msecure-plt
20015 @opindex msecure-plt
20016 Generate code that allows @command{ld} and @command{ld.so}
20017 to build executables and shared
20018 libraries with non-executable @code{.plt} and @code{.got} sections.
20019 This is a PowerPC
20020 32-bit SYSV ABI option.
20021
20022 @item -mbss-plt
20023 @opindex mbss-plt
20024 Generate code that uses a BSS @code{.plt} section that @command{ld.so}
20025 fills in, and
20026 requires @code{.plt} and @code{.got}
20027 sections that are both writable and executable.
20028 This is a PowerPC 32-bit SYSV ABI option.
20029
20030 @item -misel
20031 @itemx -mno-isel
20032 @opindex misel
20033 @opindex mno-isel
20034 This switch enables or disables the generation of ISEL instructions.
20035
20036 @item -misel=@var{yes/no}
20037 This switch has been deprecated. Use @option{-misel} and
20038 @option{-mno-isel} instead.
20039
20040 @item -mspe
20041 @itemx -mno-spe
20042 @opindex mspe
20043 @opindex mno-spe
20044 This switch enables or disables the generation of SPE simd
20045 instructions.
20046
20047 @item -mpaired
20048 @itemx -mno-paired
20049 @opindex mpaired
20050 @opindex mno-paired
20051 This switch enables or disables the generation of PAIRED simd
20052 instructions.
20053
20054 @item -mspe=@var{yes/no}
20055 This option has been deprecated. Use @option{-mspe} and
20056 @option{-mno-spe} instead.
20057
20058 @item -mvsx
20059 @itemx -mno-vsx
20060 @opindex mvsx
20061 @opindex mno-vsx
20062 Generate code that uses (does not use) vector/scalar (VSX)
20063 instructions, and also enable the use of built-in functions that allow
20064 more direct access to the VSX instruction set.
20065
20066 @item -mcrypto
20067 @itemx -mno-crypto
20068 @opindex mcrypto
20069 @opindex mno-crypto
20070 Enable the use (disable) of the built-in functions that allow direct
20071 access to the cryptographic instructions that were added in version
20072 2.07 of the PowerPC ISA.
20073
20074 @item -mdirect-move
20075 @itemx -mno-direct-move
20076 @opindex mdirect-move
20077 @opindex mno-direct-move
20078 Generate code that uses (does not use) the instructions to move data
20079 between the general purpose registers and the vector/scalar (VSX)
20080 registers that were added in version 2.07 of the PowerPC ISA.
20081
20082 @item -mpower8-fusion
20083 @itemx -mno-power8-fusion
20084 @opindex mpower8-fusion
20085 @opindex mno-power8-fusion
20086 Generate code that keeps (does not keeps) some integer operations
20087 adjacent so that the instructions can be fused together on power8 and
20088 later processors.
20089
20090 @item -mpower8-vector
20091 @itemx -mno-power8-vector
20092 @opindex mpower8-vector
20093 @opindex mno-power8-vector
20094 Generate code that uses (does not use) the vector and scalar
20095 instructions that were added in version 2.07 of the PowerPC ISA. Also
20096 enable the use of built-in functions that allow more direct access to
20097 the vector instructions.
20098
20099 @item -mquad-memory
20100 @itemx -mno-quad-memory
20101 @opindex mquad-memory
20102 @opindex mno-quad-memory
20103 Generate code that uses (does not use) the non-atomic quad word memory
20104 instructions. The @option{-mquad-memory} option requires use of
20105 64-bit mode.
20106
20107 @item -mquad-memory-atomic
20108 @itemx -mno-quad-memory-atomic
20109 @opindex mquad-memory-atomic
20110 @opindex mno-quad-memory-atomic
20111 Generate code that uses (does not use) the atomic quad word memory
20112 instructions. The @option{-mquad-memory-atomic} option requires use of
20113 64-bit mode.
20114
20115 @item -mupper-regs-df
20116 @itemx -mno-upper-regs-df
20117 @opindex mupper-regs-df
20118 @opindex mno-upper-regs-df
20119 Generate code that uses (does not use) the scalar double precision
20120 instructions that target all 64 registers in the vector/scalar
20121 floating point register set that were added in version 2.06 of the
20122 PowerPC ISA. @option{-mupper-regs-df} is turned on by default if you
20123 use any of the @option{-mcpu=power7}, @option{-mcpu=power8}, or
20124 @option{-mvsx} options.
20125
20126 @item -mupper-regs-sf
20127 @itemx -mno-upper-regs-sf
20128 @opindex mupper-regs-sf
20129 @opindex mno-upper-regs-sf
20130 Generate code that uses (does not use) the scalar single precision
20131 instructions that target all 64 registers in the vector/scalar
20132 floating point register set that were added in version 2.07 of the
20133 PowerPC ISA. @option{-mupper-regs-sf} is turned on by default if you
20134 use either of the @option{-mcpu=power8} or @option{-mpower8-vector}
20135 options.
20136
20137 @item -mupper-regs
20138 @itemx -mno-upper-regs
20139 @opindex mupper-regs
20140 @opindex mno-upper-regs
20141 Generate code that uses (does not use) the scalar
20142 instructions that target all 64 registers in the vector/scalar
20143 floating point register set, depending on the model of the machine.
20144
20145 If the @option{-mno-upper-regs} option is used, it turns off both
20146 @option{-mupper-regs-sf} and @option{-mupper-regs-df} options.
20147
20148 @item -mfloat128
20149 @itemx -mno-float128
20150 @opindex mfloat128
20151 @opindex mno-float128
20152 Enable/disable the @var{__float128} keyword for IEEE 128-bit floating point
20153 and use either software emulation for IEEE 128-bit floating point or
20154 hardware instructions.
20155
20156 The VSX instruction set (@option{-mvsx}, @option{-mcpu=power7}, or
20157 @option{-mcpu=power8}) must be enabled to use the @option{-mfloat128}
20158 option. The @code{-mfloat128} option only works on PowerPC 64-bit
20159 Linux systems.
20160
20161 @item -mfloat128-hardware
20162 @itemx -mno-float128-hardware
20163 @opindex mfloat128-hardware
20164 @opindex mno-float128-hardware
20165 Enable/disable using ISA 3.0 hardware instructions to support the
20166 @var{__float128} data type.
20167
20168 @item -mmodulo
20169 @itemx -mno-modulo
20170 @opindex mmodulo
20171 @opindex mno-module
20172 Generate code that uses (does not use) the ISA 3.0 integer modulo
20173 instructions. The @option{-mmodulo} option is enabled by default
20174 with the @option{-mcpu=power9} option.
20175
20176 @item -mpower9-fusion
20177 @itemx -mno-power9-fusion
20178 @opindex mpower9-fusion
20179 @opindex mno-power9-fusion
20180 Generate code that keeps (does not keeps) some operations adjacent so
20181 that the instructions can be fused together on power9 and later
20182 processors.
20183
20184 @item -mpower9-vector
20185 @itemx -mno-power9-vector
20186 @opindex mpower9-vector
20187 @opindex mno-power9-vector
20188 Generate code that uses (does not use) the vector and scalar
20189 instructions that were added in version 2.07 of the PowerPC ISA. Also
20190 enable the use of built-in functions that allow more direct access to
20191 the vector instructions.
20192
20193 @item -mfloat-gprs=@var{yes/single/double/no}
20194 @itemx -mfloat-gprs
20195 @opindex mfloat-gprs
20196 This switch enables or disables the generation of floating-point
20197 operations on the general-purpose registers for architectures that
20198 support it.
20199
20200 The argument @samp{yes} or @samp{single} enables the use of
20201 single-precision floating-point operations.
20202
20203 The argument @samp{double} enables the use of single and
20204 double-precision floating-point operations.
20205
20206 The argument @samp{no} disables floating-point operations on the
20207 general-purpose registers.
20208
20209 This option is currently only available on the MPC854x.
20210
20211 @item -m32
20212 @itemx -m64
20213 @opindex m32
20214 @opindex m64
20215 Generate code for 32-bit or 64-bit environments of Darwin and SVR4
20216 targets (including GNU/Linux). The 32-bit environment sets int, long
20217 and pointer to 32 bits and generates code that runs on any PowerPC
20218 variant. The 64-bit environment sets int to 32 bits and long and
20219 pointer to 64 bits, and generates code for PowerPC64, as for
20220 @option{-mpowerpc64}.
20221
20222 @item -mfull-toc
20223 @itemx -mno-fp-in-toc
20224 @itemx -mno-sum-in-toc
20225 @itemx -mminimal-toc
20226 @opindex mfull-toc
20227 @opindex mno-fp-in-toc
20228 @opindex mno-sum-in-toc
20229 @opindex mminimal-toc
20230 Modify generation of the TOC (Table Of Contents), which is created for
20231 every executable file. The @option{-mfull-toc} option is selected by
20232 default. In that case, GCC allocates at least one TOC entry for
20233 each unique non-automatic variable reference in your program. GCC
20234 also places floating-point constants in the TOC@. However, only
20235 16,384 entries are available in the TOC@.
20236
20237 If you receive a linker error message that saying you have overflowed
20238 the available TOC space, you can reduce the amount of TOC space used
20239 with the @option{-mno-fp-in-toc} and @option{-mno-sum-in-toc} options.
20240 @option{-mno-fp-in-toc} prevents GCC from putting floating-point
20241 constants in the TOC and @option{-mno-sum-in-toc} forces GCC to
20242 generate code to calculate the sum of an address and a constant at
20243 run time instead of putting that sum into the TOC@. You may specify one
20244 or both of these options. Each causes GCC to produce very slightly
20245 slower and larger code at the expense of conserving TOC space.
20246
20247 If you still run out of space in the TOC even when you specify both of
20248 these options, specify @option{-mminimal-toc} instead. This option causes
20249 GCC to make only one TOC entry for every file. When you specify this
20250 option, GCC produces code that is slower and larger but which
20251 uses extremely little TOC space. You may wish to use this option
20252 only on files that contain less frequently-executed code.
20253
20254 @item -maix64
20255 @itemx -maix32
20256 @opindex maix64
20257 @opindex maix32
20258 Enable 64-bit AIX ABI and calling convention: 64-bit pointers, 64-bit
20259 @code{long} type, and the infrastructure needed to support them.
20260 Specifying @option{-maix64} implies @option{-mpowerpc64},
20261 while @option{-maix32} disables the 64-bit ABI and
20262 implies @option{-mno-powerpc64}. GCC defaults to @option{-maix32}.
20263
20264 @item -mxl-compat
20265 @itemx -mno-xl-compat
20266 @opindex mxl-compat
20267 @opindex mno-xl-compat
20268 Produce code that conforms more closely to IBM XL compiler semantics
20269 when using AIX-compatible ABI@. Pass floating-point arguments to
20270 prototyped functions beyond the register save area (RSA) on the stack
20271 in addition to argument FPRs. Do not assume that most significant
20272 double in 128-bit long double value is properly rounded when comparing
20273 values and converting to double. Use XL symbol names for long double
20274 support routines.
20275
20276 The AIX calling convention was extended but not initially documented to
20277 handle an obscure K&R C case of calling a function that takes the
20278 address of its arguments with fewer arguments than declared. IBM XL
20279 compilers access floating-point arguments that do not fit in the
20280 RSA from the stack when a subroutine is compiled without
20281 optimization. Because always storing floating-point arguments on the
20282 stack is inefficient and rarely needed, this option is not enabled by
20283 default and only is necessary when calling subroutines compiled by IBM
20284 XL compilers without optimization.
20285
20286 @item -mpe
20287 @opindex mpe
20288 Support @dfn{IBM RS/6000 SP} @dfn{Parallel Environment} (PE)@. Link an
20289 application written to use message passing with special startup code to
20290 enable the application to run. The system must have PE installed in the
20291 standard location (@file{/usr/lpp/ppe.poe/}), or the @file{specs} file
20292 must be overridden with the @option{-specs=} option to specify the
20293 appropriate directory location. The Parallel Environment does not
20294 support threads, so the @option{-mpe} option and the @option{-pthread}
20295 option are incompatible.
20296
20297 @item -malign-natural
20298 @itemx -malign-power
20299 @opindex malign-natural
20300 @opindex malign-power
20301 On AIX, 32-bit Darwin, and 64-bit PowerPC GNU/Linux, the option
20302 @option{-malign-natural} overrides the ABI-defined alignment of larger
20303 types, such as floating-point doubles, on their natural size-based boundary.
20304 The option @option{-malign-power} instructs GCC to follow the ABI-specified
20305 alignment rules. GCC defaults to the standard alignment defined in the ABI@.
20306
20307 On 64-bit Darwin, natural alignment is the default, and @option{-malign-power}
20308 is not supported.
20309
20310 @item -msoft-float
20311 @itemx -mhard-float
20312 @opindex msoft-float
20313 @opindex mhard-float
20314 Generate code that does not use (uses) the floating-point register set.
20315 Software floating-point emulation is provided if you use the
20316 @option{-msoft-float} option, and pass the option to GCC when linking.
20317
20318 @item -msingle-float
20319 @itemx -mdouble-float
20320 @opindex msingle-float
20321 @opindex mdouble-float
20322 Generate code for single- or double-precision floating-point operations.
20323 @option{-mdouble-float} implies @option{-msingle-float}.
20324
20325 @item -msimple-fpu
20326 @opindex msimple-fpu
20327 Do not generate @code{sqrt} and @code{div} instructions for hardware
20328 floating-point unit.
20329
20330 @item -mfpu=@var{name}
20331 @opindex mfpu
20332 Specify type of floating-point unit. Valid values for @var{name} are
20333 @samp{sp_lite} (equivalent to @option{-msingle-float -msimple-fpu}),
20334 @samp{dp_lite} (equivalent to @option{-mdouble-float -msimple-fpu}),
20335 @samp{sp_full} (equivalent to @option{-msingle-float}),
20336 and @samp{dp_full} (equivalent to @option{-mdouble-float}).
20337
20338 @item -mxilinx-fpu
20339 @opindex mxilinx-fpu
20340 Perform optimizations for the floating-point unit on Xilinx PPC 405/440.
20341
20342 @item -mmultiple
20343 @itemx -mno-multiple
20344 @opindex mmultiple
20345 @opindex mno-multiple
20346 Generate code that uses (does not use) the load multiple word
20347 instructions and the store multiple word instructions. These
20348 instructions are generated by default on POWER systems, and not
20349 generated on PowerPC systems. Do not use @option{-mmultiple} on little-endian
20350 PowerPC systems, since those instructions do not work when the
20351 processor is in little-endian mode. The exceptions are PPC740 and
20352 PPC750 which permit these instructions in little-endian mode.
20353
20354 @item -mstring
20355 @itemx -mno-string
20356 @opindex mstring
20357 @opindex mno-string
20358 Generate code that uses (does not use) the load string instructions
20359 and the store string word instructions to save multiple registers and
20360 do small block moves. These instructions are generated by default on
20361 POWER systems, and not generated on PowerPC systems. Do not use
20362 @option{-mstring} on little-endian PowerPC systems, since those
20363 instructions do not work when the processor is in little-endian mode.
20364 The exceptions are PPC740 and PPC750 which permit these instructions
20365 in little-endian mode.
20366
20367 @item -mupdate
20368 @itemx -mno-update
20369 @opindex mupdate
20370 @opindex mno-update
20371 Generate code that uses (does not use) the load or store instructions
20372 that update the base register to the address of the calculated memory
20373 location. These instructions are generated by default. If you use
20374 @option{-mno-update}, there is a small window between the time that the
20375 stack pointer is updated and the address of the previous frame is
20376 stored, which means code that walks the stack frame across interrupts or
20377 signals may get corrupted data.
20378
20379 @item -mavoid-indexed-addresses
20380 @itemx -mno-avoid-indexed-addresses
20381 @opindex mavoid-indexed-addresses
20382 @opindex mno-avoid-indexed-addresses
20383 Generate code that tries to avoid (not avoid) the use of indexed load
20384 or store instructions. These instructions can incur a performance
20385 penalty on Power6 processors in certain situations, such as when
20386 stepping through large arrays that cross a 16M boundary. This option
20387 is enabled by default when targeting Power6 and disabled otherwise.
20388
20389 @item -mfused-madd
20390 @itemx -mno-fused-madd
20391 @opindex mfused-madd
20392 @opindex mno-fused-madd
20393 Generate code that uses (does not use) the floating-point multiply and
20394 accumulate instructions. These instructions are generated by default
20395 if hardware floating point is used. The machine-dependent
20396 @option{-mfused-madd} option is now mapped to the machine-independent
20397 @option{-ffp-contract=fast} option, and @option{-mno-fused-madd} is
20398 mapped to @option{-ffp-contract=off}.
20399
20400 @item -mmulhw
20401 @itemx -mno-mulhw
20402 @opindex mmulhw
20403 @opindex mno-mulhw
20404 Generate code that uses (does not use) the half-word multiply and
20405 multiply-accumulate instructions on the IBM 405, 440, 464 and 476 processors.
20406 These instructions are generated by default when targeting those
20407 processors.
20408
20409 @item -mdlmzb
20410 @itemx -mno-dlmzb
20411 @opindex mdlmzb
20412 @opindex mno-dlmzb
20413 Generate code that uses (does not use) the string-search @samp{dlmzb}
20414 instruction on the IBM 405, 440, 464 and 476 processors. This instruction is
20415 generated by default when targeting those processors.
20416
20417 @item -mno-bit-align
20418 @itemx -mbit-align
20419 @opindex mno-bit-align
20420 @opindex mbit-align
20421 On System V.4 and embedded PowerPC systems do not (do) force structures
20422 and unions that contain bit-fields to be aligned to the base type of the
20423 bit-field.
20424
20425 For example, by default a structure containing nothing but 8
20426 @code{unsigned} bit-fields of length 1 is aligned to a 4-byte
20427 boundary and has a size of 4 bytes. By using @option{-mno-bit-align},
20428 the structure is aligned to a 1-byte boundary and is 1 byte in
20429 size.
20430
20431 @item -mno-strict-align
20432 @itemx -mstrict-align
20433 @opindex mno-strict-align
20434 @opindex mstrict-align
20435 On System V.4 and embedded PowerPC systems do not (do) assume that
20436 unaligned memory references are handled by the system.
20437
20438 @item -mrelocatable
20439 @itemx -mno-relocatable
20440 @opindex mrelocatable
20441 @opindex mno-relocatable
20442 Generate code that allows (does not allow) a static executable to be
20443 relocated to a different address at run time. A simple embedded
20444 PowerPC system loader should relocate the entire contents of
20445 @code{.got2} and 4-byte locations listed in the @code{.fixup} section,
20446 a table of 32-bit addresses generated by this option. For this to
20447 work, all objects linked together must be compiled with
20448 @option{-mrelocatable} or @option{-mrelocatable-lib}.
20449 @option{-mrelocatable} code aligns the stack to an 8-byte boundary.
20450
20451 @item -mrelocatable-lib
20452 @itemx -mno-relocatable-lib
20453 @opindex mrelocatable-lib
20454 @opindex mno-relocatable-lib
20455 Like @option{-mrelocatable}, @option{-mrelocatable-lib} generates a
20456 @code{.fixup} section to allow static executables to be relocated at
20457 run time, but @option{-mrelocatable-lib} does not use the smaller stack
20458 alignment of @option{-mrelocatable}. Objects compiled with
20459 @option{-mrelocatable-lib} may be linked with objects compiled with
20460 any combination of the @option{-mrelocatable} options.
20461
20462 @item -mno-toc
20463 @itemx -mtoc
20464 @opindex mno-toc
20465 @opindex mtoc
20466 On System V.4 and embedded PowerPC systems do not (do) assume that
20467 register 2 contains a pointer to a global area pointing to the addresses
20468 used in the program.
20469
20470 @item -mlittle
20471 @itemx -mlittle-endian
20472 @opindex mlittle
20473 @opindex mlittle-endian
20474 On System V.4 and embedded PowerPC systems compile code for the
20475 processor in little-endian mode. The @option{-mlittle-endian} option is
20476 the same as @option{-mlittle}.
20477
20478 @item -mbig
20479 @itemx -mbig-endian
20480 @opindex mbig
20481 @opindex mbig-endian
20482 On System V.4 and embedded PowerPC systems compile code for the
20483 processor in big-endian mode. The @option{-mbig-endian} option is
20484 the same as @option{-mbig}.
20485
20486 @item -mdynamic-no-pic
20487 @opindex mdynamic-no-pic
20488 On Darwin and Mac OS X systems, compile code so that it is not
20489 relocatable, but that its external references are relocatable. The
20490 resulting code is suitable for applications, but not shared
20491 libraries.
20492
20493 @item -msingle-pic-base
20494 @opindex msingle-pic-base
20495 Treat the register used for PIC addressing as read-only, rather than
20496 loading it in the prologue for each function. The runtime system is
20497 responsible for initializing this register with an appropriate value
20498 before execution begins.
20499
20500 @item -mprioritize-restricted-insns=@var{priority}
20501 @opindex mprioritize-restricted-insns
20502 This option controls the priority that is assigned to
20503 dispatch-slot restricted instructions during the second scheduling
20504 pass. The argument @var{priority} takes the value @samp{0}, @samp{1},
20505 or @samp{2} to assign no, highest, or second-highest (respectively)
20506 priority to dispatch-slot restricted
20507 instructions.
20508
20509 @item -msched-costly-dep=@var{dependence_type}
20510 @opindex msched-costly-dep
20511 This option controls which dependences are considered costly
20512 by the target during instruction scheduling. The argument
20513 @var{dependence_type} takes one of the following values:
20514
20515 @table @asis
20516 @item @samp{no}
20517 No dependence is costly.
20518
20519 @item @samp{all}
20520 All dependences are costly.
20521
20522 @item @samp{true_store_to_load}
20523 A true dependence from store to load is costly.
20524
20525 @item @samp{store_to_load}
20526 Any dependence from store to load is costly.
20527
20528 @item @var{number}
20529 Any dependence for which the latency is greater than or equal to
20530 @var{number} is costly.
20531 @end table
20532
20533 @item -minsert-sched-nops=@var{scheme}
20534 @opindex minsert-sched-nops
20535 This option controls which NOP insertion scheme is used during
20536 the second scheduling pass. The argument @var{scheme} takes one of the
20537 following values:
20538
20539 @table @asis
20540 @item @samp{no}
20541 Don't insert NOPs.
20542
20543 @item @samp{pad}
20544 Pad with NOPs any dispatch group that has vacant issue slots,
20545 according to the scheduler's grouping.
20546
20547 @item @samp{regroup_exact}
20548 Insert NOPs to force costly dependent insns into
20549 separate groups. Insert exactly as many NOPs as needed to force an insn
20550 to a new group, according to the estimated processor grouping.
20551
20552 @item @var{number}
20553 Insert NOPs to force costly dependent insns into
20554 separate groups. Insert @var{number} NOPs to force an insn to a new group.
20555 @end table
20556
20557 @item -mcall-sysv
20558 @opindex mcall-sysv
20559 On System V.4 and embedded PowerPC systems compile code using calling
20560 conventions that adhere to the March 1995 draft of the System V
20561 Application Binary Interface, PowerPC processor supplement. This is the
20562 default unless you configured GCC using @samp{powerpc-*-eabiaix}.
20563
20564 @item -mcall-sysv-eabi
20565 @itemx -mcall-eabi
20566 @opindex mcall-sysv-eabi
20567 @opindex mcall-eabi
20568 Specify both @option{-mcall-sysv} and @option{-meabi} options.
20569
20570 @item -mcall-sysv-noeabi
20571 @opindex mcall-sysv-noeabi
20572 Specify both @option{-mcall-sysv} and @option{-mno-eabi} options.
20573
20574 @item -mcall-aixdesc
20575 @opindex m
20576 On System V.4 and embedded PowerPC systems compile code for the AIX
20577 operating system.
20578
20579 @item -mcall-linux
20580 @opindex mcall-linux
20581 On System V.4 and embedded PowerPC systems compile code for the
20582 Linux-based GNU system.
20583
20584 @item -mcall-freebsd
20585 @opindex mcall-freebsd
20586 On System V.4 and embedded PowerPC systems compile code for the
20587 FreeBSD operating system.
20588
20589 @item -mcall-netbsd
20590 @opindex mcall-netbsd
20591 On System V.4 and embedded PowerPC systems compile code for the
20592 NetBSD operating system.
20593
20594 @item -mcall-openbsd
20595 @opindex mcall-netbsd
20596 On System V.4 and embedded PowerPC systems compile code for the
20597 OpenBSD operating system.
20598
20599 @item -maix-struct-return
20600 @opindex maix-struct-return
20601 Return all structures in memory (as specified by the AIX ABI)@.
20602
20603 @item -msvr4-struct-return
20604 @opindex msvr4-struct-return
20605 Return structures smaller than 8 bytes in registers (as specified by the
20606 SVR4 ABI)@.
20607
20608 @item -mabi=@var{abi-type}
20609 @opindex mabi
20610 Extend the current ABI with a particular extension, or remove such extension.
20611 Valid values are @samp{altivec}, @samp{no-altivec}, @samp{spe},
20612 @samp{no-spe}, @samp{ibmlongdouble}, @samp{ieeelongdouble},
20613 @samp{elfv1}, @samp{elfv2}@.
20614
20615 @item -mabi=spe
20616 @opindex mabi=spe
20617 Extend the current ABI with SPE ABI extensions. This does not change
20618 the default ABI, instead it adds the SPE ABI extensions to the current
20619 ABI@.
20620
20621 @item -mabi=no-spe
20622 @opindex mabi=no-spe
20623 Disable Book-E SPE ABI extensions for the current ABI@.
20624
20625 @item -mabi=ibmlongdouble
20626 @opindex mabi=ibmlongdouble
20627 Change the current ABI to use IBM extended-precision long double.
20628 This is a PowerPC 32-bit SYSV ABI option.
20629
20630 @item -mabi=ieeelongdouble
20631 @opindex mabi=ieeelongdouble
20632 Change the current ABI to use IEEE extended-precision long double.
20633 This is a PowerPC 32-bit Linux ABI option.
20634
20635 @item -mabi=elfv1
20636 @opindex mabi=elfv1
20637 Change the current ABI to use the ELFv1 ABI.
20638 This is the default ABI for big-endian PowerPC 64-bit Linux.
20639 Overriding the default ABI requires special system support and is
20640 likely to fail in spectacular ways.
20641
20642 @item -mabi=elfv2
20643 @opindex mabi=elfv2
20644 Change the current ABI to use the ELFv2 ABI.
20645 This is the default ABI for little-endian PowerPC 64-bit Linux.
20646 Overriding the default ABI requires special system support and is
20647 likely to fail in spectacular ways.
20648
20649 @item -mprototype
20650 @itemx -mno-prototype
20651 @opindex mprototype
20652 @opindex mno-prototype
20653 On System V.4 and embedded PowerPC systems assume that all calls to
20654 variable argument functions are properly prototyped. Otherwise, the
20655 compiler must insert an instruction before every non-prototyped call to
20656 set or clear bit 6 of the condition code register (@code{CR}) to
20657 indicate whether floating-point values are passed in the floating-point
20658 registers in case the function takes variable arguments. With
20659 @option{-mprototype}, only calls to prototyped variable argument functions
20660 set or clear the bit.
20661
20662 @item -msim
20663 @opindex msim
20664 On embedded PowerPC systems, assume that the startup module is called
20665 @file{sim-crt0.o} and that the standard C libraries are @file{libsim.a} and
20666 @file{libc.a}. This is the default for @samp{powerpc-*-eabisim}
20667 configurations.
20668
20669 @item -mmvme
20670 @opindex mmvme
20671 On embedded PowerPC systems, assume that the startup module is called
20672 @file{crt0.o} and the standard C libraries are @file{libmvme.a} and
20673 @file{libc.a}.
20674
20675 @item -mads
20676 @opindex mads
20677 On embedded PowerPC systems, assume that the startup module is called
20678 @file{crt0.o} and the standard C libraries are @file{libads.a} and
20679 @file{libc.a}.
20680
20681 @item -myellowknife
20682 @opindex myellowknife
20683 On embedded PowerPC systems, assume that the startup module is called
20684 @file{crt0.o} and the standard C libraries are @file{libyk.a} and
20685 @file{libc.a}.
20686
20687 @item -mvxworks
20688 @opindex mvxworks
20689 On System V.4 and embedded PowerPC systems, specify that you are
20690 compiling for a VxWorks system.
20691
20692 @item -memb
20693 @opindex memb
20694 On embedded PowerPC systems, set the @code{PPC_EMB} bit in the ELF flags
20695 header to indicate that @samp{eabi} extended relocations are used.
20696
20697 @item -meabi
20698 @itemx -mno-eabi
20699 @opindex meabi
20700 @opindex mno-eabi
20701 On System V.4 and embedded PowerPC systems do (do not) adhere to the
20702 Embedded Applications Binary Interface (EABI), which is a set of
20703 modifications to the System V.4 specifications. Selecting @option{-meabi}
20704 means that the stack is aligned to an 8-byte boundary, a function
20705 @code{__eabi} is called from @code{main} to set up the EABI
20706 environment, and the @option{-msdata} option can use both @code{r2} and
20707 @code{r13} to point to two separate small data areas. Selecting
20708 @option{-mno-eabi} means that the stack is aligned to a 16-byte boundary,
20709 no EABI initialization function is called from @code{main}, and the
20710 @option{-msdata} option only uses @code{r13} to point to a single
20711 small data area. The @option{-meabi} option is on by default if you
20712 configured GCC using one of the @samp{powerpc*-*-eabi*} options.
20713
20714 @item -msdata=eabi
20715 @opindex msdata=eabi
20716 On System V.4 and embedded PowerPC systems, put small initialized
20717 @code{const} global and static data in the @code{.sdata2} section, which
20718 is pointed to by register @code{r2}. Put small initialized
20719 non-@code{const} global and static data in the @code{.sdata} section,
20720 which is pointed to by register @code{r13}. Put small uninitialized
20721 global and static data in the @code{.sbss} section, which is adjacent to
20722 the @code{.sdata} section. The @option{-msdata=eabi} option is
20723 incompatible with the @option{-mrelocatable} option. The
20724 @option{-msdata=eabi} option also sets the @option{-memb} option.
20725
20726 @item -msdata=sysv
20727 @opindex msdata=sysv
20728 On System V.4 and embedded PowerPC systems, put small global and static
20729 data in the @code{.sdata} section, which is pointed to by register
20730 @code{r13}. Put small uninitialized global and static data in the
20731 @code{.sbss} section, which is adjacent to the @code{.sdata} section.
20732 The @option{-msdata=sysv} option is incompatible with the
20733 @option{-mrelocatable} option.
20734
20735 @item -msdata=default
20736 @itemx -msdata
20737 @opindex msdata=default
20738 @opindex msdata
20739 On System V.4 and embedded PowerPC systems, if @option{-meabi} is used,
20740 compile code the same as @option{-msdata=eabi}, otherwise compile code the
20741 same as @option{-msdata=sysv}.
20742
20743 @item -msdata=data
20744 @opindex msdata=data
20745 On System V.4 and embedded PowerPC systems, put small global
20746 data in the @code{.sdata} section. Put small uninitialized global
20747 data in the @code{.sbss} section. Do not use register @code{r13}
20748 to address small data however. This is the default behavior unless
20749 other @option{-msdata} options are used.
20750
20751 @item -msdata=none
20752 @itemx -mno-sdata
20753 @opindex msdata=none
20754 @opindex mno-sdata
20755 On embedded PowerPC systems, put all initialized global and static data
20756 in the @code{.data} section, and all uninitialized data in the
20757 @code{.bss} section.
20758
20759 @item -mblock-move-inline-limit=@var{num}
20760 @opindex mblock-move-inline-limit
20761 Inline all block moves (such as calls to @code{memcpy} or structure
20762 copies) less than or equal to @var{num} bytes. The minimum value for
20763 @var{num} is 32 bytes on 32-bit targets and 64 bytes on 64-bit
20764 targets. The default value is target-specific.
20765
20766 @item -G @var{num}
20767 @opindex G
20768 @cindex smaller data references (PowerPC)
20769 @cindex .sdata/.sdata2 references (PowerPC)
20770 On embedded PowerPC systems, put global and static items less than or
20771 equal to @var{num} bytes into the small data or BSS sections instead of
20772 the normal data or BSS section. By default, @var{num} is 8. The
20773 @option{-G @var{num}} switch is also passed to the linker.
20774 All modules should be compiled with the same @option{-G @var{num}} value.
20775
20776 @item -mregnames
20777 @itemx -mno-regnames
20778 @opindex mregnames
20779 @opindex mno-regnames
20780 On System V.4 and embedded PowerPC systems do (do not) emit register
20781 names in the assembly language output using symbolic forms.
20782
20783 @item -mlongcall
20784 @itemx -mno-longcall
20785 @opindex mlongcall
20786 @opindex mno-longcall
20787 By default assume that all calls are far away so that a longer and more
20788 expensive calling sequence is required. This is required for calls
20789 farther than 32 megabytes (33,554,432 bytes) from the current location.
20790 A short call is generated if the compiler knows
20791 the call cannot be that far away. This setting can be overridden by
20792 the @code{shortcall} function attribute, or by @code{#pragma
20793 longcall(0)}.
20794
20795 Some linkers are capable of detecting out-of-range calls and generating
20796 glue code on the fly. On these systems, long calls are unnecessary and
20797 generate slower code. As of this writing, the AIX linker can do this,
20798 as can the GNU linker for PowerPC/64. It is planned to add this feature
20799 to the GNU linker for 32-bit PowerPC systems as well.
20800
20801 On Darwin/PPC systems, @code{#pragma longcall} generates @code{jbsr
20802 callee, L42}, plus a @dfn{branch island} (glue code). The two target
20803 addresses represent the callee and the branch island. The
20804 Darwin/PPC linker prefers the first address and generates a @code{bl
20805 callee} if the PPC @code{bl} instruction reaches the callee directly;
20806 otherwise, the linker generates @code{bl L42} to call the branch
20807 island. The branch island is appended to the body of the
20808 calling function; it computes the full 32-bit address of the callee
20809 and jumps to it.
20810
20811 On Mach-O (Darwin) systems, this option directs the compiler emit to
20812 the glue for every direct call, and the Darwin linker decides whether
20813 to use or discard it.
20814
20815 In the future, GCC may ignore all longcall specifications
20816 when the linker is known to generate glue.
20817
20818 @item -mtls-markers
20819 @itemx -mno-tls-markers
20820 @opindex mtls-markers
20821 @opindex mno-tls-markers
20822 Mark (do not mark) calls to @code{__tls_get_addr} with a relocation
20823 specifying the function argument. The relocation allows the linker to
20824 reliably associate function call with argument setup instructions for
20825 TLS optimization, which in turn allows GCC to better schedule the
20826 sequence.
20827
20828 @item -pthread
20829 @opindex pthread
20830 Adds support for multithreading with the @dfn{pthreads} library.
20831 This option sets flags for both the preprocessor and linker.
20832
20833 @item -mrecip
20834 @itemx -mno-recip
20835 @opindex mrecip
20836 This option enables use of the reciprocal estimate and
20837 reciprocal square root estimate instructions with additional
20838 Newton-Raphson steps to increase precision instead of doing a divide or
20839 square root and divide for floating-point arguments. You should use
20840 the @option{-ffast-math} option when using @option{-mrecip} (or at
20841 least @option{-funsafe-math-optimizations},
20842 @option{-ffinite-math-only}, @option{-freciprocal-math} and
20843 @option{-fno-trapping-math}). Note that while the throughput of the
20844 sequence is generally higher than the throughput of the non-reciprocal
20845 instruction, the precision of the sequence can be decreased by up to 2
20846 ulp (i.e.@: the inverse of 1.0 equals 0.99999994) for reciprocal square
20847 roots.
20848
20849 @item -mrecip=@var{opt}
20850 @opindex mrecip=opt
20851 This option controls which reciprocal estimate instructions
20852 may be used. @var{opt} is a comma-separated list of options, which may
20853 be preceded by a @code{!} to invert the option:
20854
20855 @table @samp
20856
20857 @item all
20858 Enable all estimate instructions.
20859
20860 @item default
20861 Enable the default instructions, equivalent to @option{-mrecip}.
20862
20863 @item none
20864 Disable all estimate instructions, equivalent to @option{-mno-recip}.
20865
20866 @item div
20867 Enable the reciprocal approximation instructions for both
20868 single and double precision.
20869
20870 @item divf
20871 Enable the single-precision reciprocal approximation instructions.
20872
20873 @item divd
20874 Enable the double-precision reciprocal approximation instructions.
20875
20876 @item rsqrt
20877 Enable the reciprocal square root approximation instructions for both
20878 single and double precision.
20879
20880 @item rsqrtf
20881 Enable the single-precision reciprocal square root approximation instructions.
20882
20883 @item rsqrtd
20884 Enable the double-precision reciprocal square root approximation instructions.
20885
20886 @end table
20887
20888 So, for example, @option{-mrecip=all,!rsqrtd} enables
20889 all of the reciprocal estimate instructions, except for the
20890 @code{FRSQRTE}, @code{XSRSQRTEDP}, and @code{XVRSQRTEDP} instructions
20891 which handle the double-precision reciprocal square root calculations.
20892
20893 @item -mrecip-precision
20894 @itemx -mno-recip-precision
20895 @opindex mrecip-precision
20896 Assume (do not assume) that the reciprocal estimate instructions
20897 provide higher-precision estimates than is mandated by the PowerPC
20898 ABI. Selecting @option{-mcpu=power6}, @option{-mcpu=power7} or
20899 @option{-mcpu=power8} automatically selects @option{-mrecip-precision}.
20900 The double-precision square root estimate instructions are not generated by
20901 default on low-precision machines, since they do not provide an
20902 estimate that converges after three steps.
20903
20904 @item -mveclibabi=@var{type}
20905 @opindex mveclibabi
20906 Specifies the ABI type to use for vectorizing intrinsics using an
20907 external library. The only type supported at present is @samp{mass},
20908 which specifies to use IBM's Mathematical Acceleration Subsystem
20909 (MASS) libraries for vectorizing intrinsics using external libraries.
20910 GCC currently emits calls to @code{acosd2}, @code{acosf4},
20911 @code{acoshd2}, @code{acoshf4}, @code{asind2}, @code{asinf4},
20912 @code{asinhd2}, @code{asinhf4}, @code{atan2d2}, @code{atan2f4},
20913 @code{atand2}, @code{atanf4}, @code{atanhd2}, @code{atanhf4},
20914 @code{cbrtd2}, @code{cbrtf4}, @code{cosd2}, @code{cosf4},
20915 @code{coshd2}, @code{coshf4}, @code{erfcd2}, @code{erfcf4},
20916 @code{erfd2}, @code{erff4}, @code{exp2d2}, @code{exp2f4},
20917 @code{expd2}, @code{expf4}, @code{expm1d2}, @code{expm1f4},
20918 @code{hypotd2}, @code{hypotf4}, @code{lgammad2}, @code{lgammaf4},
20919 @code{log10d2}, @code{log10f4}, @code{log1pd2}, @code{log1pf4},
20920 @code{log2d2}, @code{log2f4}, @code{logd2}, @code{logf4},
20921 @code{powd2}, @code{powf4}, @code{sind2}, @code{sinf4}, @code{sinhd2},
20922 @code{sinhf4}, @code{sqrtd2}, @code{sqrtf4}, @code{tand2},
20923 @code{tanf4}, @code{tanhd2}, and @code{tanhf4} when generating code
20924 for power7. Both @option{-ftree-vectorize} and
20925 @option{-funsafe-math-optimizations} must also be enabled. The MASS
20926 libraries must be specified at link time.
20927
20928 @item -mfriz
20929 @itemx -mno-friz
20930 @opindex mfriz
20931 Generate (do not generate) the @code{friz} instruction when the
20932 @option{-funsafe-math-optimizations} option is used to optimize
20933 rounding of floating-point values to 64-bit integer and back to floating
20934 point. The @code{friz} instruction does not return the same value if
20935 the floating-point number is too large to fit in an integer.
20936
20937 @item -mpointers-to-nested-functions
20938 @itemx -mno-pointers-to-nested-functions
20939 @opindex mpointers-to-nested-functions
20940 Generate (do not generate) code to load up the static chain register
20941 (@code{r11}) when calling through a pointer on AIX and 64-bit Linux
20942 systems where a function pointer points to a 3-word descriptor giving
20943 the function address, TOC value to be loaded in register @code{r2}, and
20944 static chain value to be loaded in register @code{r11}. The
20945 @option{-mpointers-to-nested-functions} is on by default. You cannot
20946 call through pointers to nested functions or pointers
20947 to functions compiled in other languages that use the static chain if
20948 you use @option{-mno-pointers-to-nested-functions}.
20949
20950 @item -msave-toc-indirect
20951 @itemx -mno-save-toc-indirect
20952 @opindex msave-toc-indirect
20953 Generate (do not generate) code to save the TOC value in the reserved
20954 stack location in the function prologue if the function calls through
20955 a pointer on AIX and 64-bit Linux systems. If the TOC value is not
20956 saved in the prologue, it is saved just before the call through the
20957 pointer. The @option{-mno-save-toc-indirect} option is the default.
20958
20959 @item -mcompat-align-parm
20960 @itemx -mno-compat-align-parm
20961 @opindex mcompat-align-parm
20962 Generate (do not generate) code to pass structure parameters with a
20963 maximum alignment of 64 bits, for compatibility with older versions
20964 of GCC.
20965
20966 Older versions of GCC (prior to 4.9.0) incorrectly did not align a
20967 structure parameter on a 128-bit boundary when that structure contained
20968 a member requiring 128-bit alignment. This is corrected in more
20969 recent versions of GCC. This option may be used to generate code
20970 that is compatible with functions compiled with older versions of
20971 GCC.
20972
20973 The @option{-mno-compat-align-parm} option is the default.
20974 @end table
20975
20976 @node RX Options
20977 @subsection RX Options
20978 @cindex RX Options
20979
20980 These command-line options are defined for RX targets:
20981
20982 @table @gcctabopt
20983 @item -m64bit-doubles
20984 @itemx -m32bit-doubles
20985 @opindex m64bit-doubles
20986 @opindex m32bit-doubles
20987 Make the @code{double} data type be 64 bits (@option{-m64bit-doubles})
20988 or 32 bits (@option{-m32bit-doubles}) in size. The default is
20989 @option{-m32bit-doubles}. @emph{Note} RX floating-point hardware only
20990 works on 32-bit values, which is why the default is
20991 @option{-m32bit-doubles}.
20992
20993 @item -fpu
20994 @itemx -nofpu
20995 @opindex fpu
20996 @opindex nofpu
20997 Enables (@option{-fpu}) or disables (@option{-nofpu}) the use of RX
20998 floating-point hardware. The default is enabled for the RX600
20999 series and disabled for the RX200 series.
21000
21001 Floating-point instructions are only generated for 32-bit floating-point
21002 values, however, so the FPU hardware is not used for doubles if the
21003 @option{-m64bit-doubles} option is used.
21004
21005 @emph{Note} If the @option{-fpu} option is enabled then
21006 @option{-funsafe-math-optimizations} is also enabled automatically.
21007 This is because the RX FPU instructions are themselves unsafe.
21008
21009 @item -mcpu=@var{name}
21010 @opindex mcpu
21011 Selects the type of RX CPU to be targeted. Currently three types are
21012 supported, the generic @samp{RX600} and @samp{RX200} series hardware and
21013 the specific @samp{RX610} CPU. The default is @samp{RX600}.
21014
21015 The only difference between @samp{RX600} and @samp{RX610} is that the
21016 @samp{RX610} does not support the @code{MVTIPL} instruction.
21017
21018 The @samp{RX200} series does not have a hardware floating-point unit
21019 and so @option{-nofpu} is enabled by default when this type is
21020 selected.
21021
21022 @item -mbig-endian-data
21023 @itemx -mlittle-endian-data
21024 @opindex mbig-endian-data
21025 @opindex mlittle-endian-data
21026 Store data (but not code) in the big-endian format. The default is
21027 @option{-mlittle-endian-data}, i.e.@: to store data in the little-endian
21028 format.
21029
21030 @item -msmall-data-limit=@var{N}
21031 @opindex msmall-data-limit
21032 Specifies the maximum size in bytes of global and static variables
21033 which can be placed into the small data area. Using the small data
21034 area can lead to smaller and faster code, but the size of area is
21035 limited and it is up to the programmer to ensure that the area does
21036 not overflow. Also when the small data area is used one of the RX's
21037 registers (usually @code{r13}) is reserved for use pointing to this
21038 area, so it is no longer available for use by the compiler. This
21039 could result in slower and/or larger code if variables are pushed onto
21040 the stack instead of being held in this register.
21041
21042 Note, common variables (variables that have not been initialized) and
21043 constants are not placed into the small data area as they are assigned
21044 to other sections in the output executable.
21045
21046 The default value is zero, which disables this feature. Note, this
21047 feature is not enabled by default with higher optimization levels
21048 (@option{-O2} etc) because of the potentially detrimental effects of
21049 reserving a register. It is up to the programmer to experiment and
21050 discover whether this feature is of benefit to their program. See the
21051 description of the @option{-mpid} option for a description of how the
21052 actual register to hold the small data area pointer is chosen.
21053
21054 @item -msim
21055 @itemx -mno-sim
21056 @opindex msim
21057 @opindex mno-sim
21058 Use the simulator runtime. The default is to use the libgloss
21059 board-specific runtime.
21060
21061 @item -mas100-syntax
21062 @itemx -mno-as100-syntax
21063 @opindex mas100-syntax
21064 @opindex mno-as100-syntax
21065 When generating assembler output use a syntax that is compatible with
21066 Renesas's AS100 assembler. This syntax can also be handled by the GAS
21067 assembler, but it has some restrictions so it is not generated by default.
21068
21069 @item -mmax-constant-size=@var{N}
21070 @opindex mmax-constant-size
21071 Specifies the maximum size, in bytes, of a constant that can be used as
21072 an operand in a RX instruction. Although the RX instruction set does
21073 allow constants of up to 4 bytes in length to be used in instructions,
21074 a longer value equates to a longer instruction. Thus in some
21075 circumstances it can be beneficial to restrict the size of constants
21076 that are used in instructions. Constants that are too big are instead
21077 placed into a constant pool and referenced via register indirection.
21078
21079 The value @var{N} can be between 0 and 4. A value of 0 (the default)
21080 or 4 means that constants of any size are allowed.
21081
21082 @item -mrelax
21083 @opindex mrelax
21084 Enable linker relaxation. Linker relaxation is a process whereby the
21085 linker attempts to reduce the size of a program by finding shorter
21086 versions of various instructions. Disabled by default.
21087
21088 @item -mint-register=@var{N}
21089 @opindex mint-register
21090 Specify the number of registers to reserve for fast interrupt handler
21091 functions. The value @var{N} can be between 0 and 4. A value of 1
21092 means that register @code{r13} is reserved for the exclusive use
21093 of fast interrupt handlers. A value of 2 reserves @code{r13} and
21094 @code{r12}. A value of 3 reserves @code{r13}, @code{r12} and
21095 @code{r11}, and a value of 4 reserves @code{r13} through @code{r10}.
21096 A value of 0, the default, does not reserve any registers.
21097
21098 @item -msave-acc-in-interrupts
21099 @opindex msave-acc-in-interrupts
21100 Specifies that interrupt handler functions should preserve the
21101 accumulator register. This is only necessary if normal code might use
21102 the accumulator register, for example because it performs 64-bit
21103 multiplications. The default is to ignore the accumulator as this
21104 makes the interrupt handlers faster.
21105
21106 @item -mpid
21107 @itemx -mno-pid
21108 @opindex mpid
21109 @opindex mno-pid
21110 Enables the generation of position independent data. When enabled any
21111 access to constant data is done via an offset from a base address
21112 held in a register. This allows the location of constant data to be
21113 determined at run time without requiring the executable to be
21114 relocated, which is a benefit to embedded applications with tight
21115 memory constraints. Data that can be modified is not affected by this
21116 option.
21117
21118 Note, using this feature reserves a register, usually @code{r13}, for
21119 the constant data base address. This can result in slower and/or
21120 larger code, especially in complicated functions.
21121
21122 The actual register chosen to hold the constant data base address
21123 depends upon whether the @option{-msmall-data-limit} and/or the
21124 @option{-mint-register} command-line options are enabled. Starting
21125 with register @code{r13} and proceeding downwards, registers are
21126 allocated first to satisfy the requirements of @option{-mint-register},
21127 then @option{-mpid} and finally @option{-msmall-data-limit}. Thus it
21128 is possible for the small data area register to be @code{r8} if both
21129 @option{-mint-register=4} and @option{-mpid} are specified on the
21130 command line.
21131
21132 By default this feature is not enabled. The default can be restored
21133 via the @option{-mno-pid} command-line option.
21134
21135 @item -mno-warn-multiple-fast-interrupts
21136 @itemx -mwarn-multiple-fast-interrupts
21137 @opindex mno-warn-multiple-fast-interrupts
21138 @opindex mwarn-multiple-fast-interrupts
21139 Prevents GCC from issuing a warning message if it finds more than one
21140 fast interrupt handler when it is compiling a file. The default is to
21141 issue a warning for each extra fast interrupt handler found, as the RX
21142 only supports one such interrupt.
21143
21144 @item -mallow-string-insns
21145 @itemx -mno-allow-string-insns
21146 @opindex mallow-string-insns
21147 @opindex mno-allow-string-insns
21148 Enables or disables the use of the string manipulation instructions
21149 @code{SMOVF}, @code{SCMPU}, @code{SMOVB}, @code{SMOVU}, @code{SUNTIL}
21150 @code{SWHILE} and also the @code{RMPA} instruction. These
21151 instructions may prefetch data, which is not safe to do if accessing
21152 an I/O register. (See section 12.2.7 of the RX62N Group User's Manual
21153 for more information).
21154
21155 The default is to allow these instructions, but it is not possible for
21156 GCC to reliably detect all circumstances where a string instruction
21157 might be used to access an I/O register, so their use cannot be
21158 disabled automatically. Instead it is reliant upon the programmer to
21159 use the @option{-mno-allow-string-insns} option if their program
21160 accesses I/O space.
21161
21162 When the instructions are enabled GCC defines the C preprocessor
21163 symbol @code{__RX_ALLOW_STRING_INSNS__}, otherwise it defines the
21164 symbol @code{__RX_DISALLOW_STRING_INSNS__}.
21165
21166 @item -mjsr
21167 @itemx -mno-jsr
21168 @opindex mjsr
21169 @opindex mno-jsr
21170 Use only (or not only) @code{JSR} instructions to access functions.
21171 This option can be used when code size exceeds the range of @code{BSR}
21172 instructions. Note that @option{-mno-jsr} does not mean to not use
21173 @code{JSR} but instead means that any type of branch may be used.
21174 @end table
21175
21176 @emph{Note:} The generic GCC command-line option @option{-ffixed-@var{reg}}
21177 has special significance to the RX port when used with the
21178 @code{interrupt} function attribute. This attribute indicates a
21179 function intended to process fast interrupts. GCC ensures
21180 that it only uses the registers @code{r10}, @code{r11}, @code{r12}
21181 and/or @code{r13} and only provided that the normal use of the
21182 corresponding registers have been restricted via the
21183 @option{-ffixed-@var{reg}} or @option{-mint-register} command-line
21184 options.
21185
21186 @node S/390 and zSeries Options
21187 @subsection S/390 and zSeries Options
21188 @cindex S/390 and zSeries Options
21189
21190 These are the @samp{-m} options defined for the S/390 and zSeries architecture.
21191
21192 @table @gcctabopt
21193 @item -mhard-float
21194 @itemx -msoft-float
21195 @opindex mhard-float
21196 @opindex msoft-float
21197 Use (do not use) the hardware floating-point instructions and registers
21198 for floating-point operations. When @option{-msoft-float} is specified,
21199 functions in @file{libgcc.a} are used to perform floating-point
21200 operations. When @option{-mhard-float} is specified, the compiler
21201 generates IEEE floating-point instructions. This is the default.
21202
21203 @item -mhard-dfp
21204 @itemx -mno-hard-dfp
21205 @opindex mhard-dfp
21206 @opindex mno-hard-dfp
21207 Use (do not use) the hardware decimal-floating-point instructions for
21208 decimal-floating-point operations. When @option{-mno-hard-dfp} is
21209 specified, functions in @file{libgcc.a} are used to perform
21210 decimal-floating-point operations. When @option{-mhard-dfp} is
21211 specified, the compiler generates decimal-floating-point hardware
21212 instructions. This is the default for @option{-march=z9-ec} or higher.
21213
21214 @item -mlong-double-64
21215 @itemx -mlong-double-128
21216 @opindex mlong-double-64
21217 @opindex mlong-double-128
21218 These switches control the size of @code{long double} type. A size
21219 of 64 bits makes the @code{long double} type equivalent to the @code{double}
21220 type. This is the default.
21221
21222 @item -mbackchain
21223 @itemx -mno-backchain
21224 @opindex mbackchain
21225 @opindex mno-backchain
21226 Store (do not store) the address of the caller's frame as backchain pointer
21227 into the callee's stack frame.
21228 A backchain may be needed to allow debugging using tools that do not understand
21229 DWARF call frame information.
21230 When @option{-mno-packed-stack} is in effect, the backchain pointer is stored
21231 at the bottom of the stack frame; when @option{-mpacked-stack} is in effect,
21232 the backchain is placed into the topmost word of the 96/160 byte register
21233 save area.
21234
21235 In general, code compiled with @option{-mbackchain} is call-compatible with
21236 code compiled with @option{-mmo-backchain}; however, use of the backchain
21237 for debugging purposes usually requires that the whole binary is built with
21238 @option{-mbackchain}. Note that the combination of @option{-mbackchain},
21239 @option{-mpacked-stack} and @option{-mhard-float} is not supported. In order
21240 to build a linux kernel use @option{-msoft-float}.
21241
21242 The default is to not maintain the backchain.
21243
21244 @item -mpacked-stack
21245 @itemx -mno-packed-stack
21246 @opindex mpacked-stack
21247 @opindex mno-packed-stack
21248 Use (do not use) the packed stack layout. When @option{-mno-packed-stack} is
21249 specified, the compiler uses the all fields of the 96/160 byte register save
21250 area only for their default purpose; unused fields still take up stack space.
21251 When @option{-mpacked-stack} is specified, register save slots are densely
21252 packed at the top of the register save area; unused space is reused for other
21253 purposes, allowing for more efficient use of the available stack space.
21254 However, when @option{-mbackchain} is also in effect, the topmost word of
21255 the save area is always used to store the backchain, and the return address
21256 register is always saved two words below the backchain.
21257
21258 As long as the stack frame backchain is not used, code generated with
21259 @option{-mpacked-stack} is call-compatible with code generated with
21260 @option{-mno-packed-stack}. Note that some non-FSF releases of GCC 2.95 for
21261 S/390 or zSeries generated code that uses the stack frame backchain at run
21262 time, not just for debugging purposes. Such code is not call-compatible
21263 with code compiled with @option{-mpacked-stack}. Also, note that the
21264 combination of @option{-mbackchain},
21265 @option{-mpacked-stack} and @option{-mhard-float} is not supported. In order
21266 to build a linux kernel use @option{-msoft-float}.
21267
21268 The default is to not use the packed stack layout.
21269
21270 @item -msmall-exec
21271 @itemx -mno-small-exec
21272 @opindex msmall-exec
21273 @opindex mno-small-exec
21274 Generate (or do not generate) code using the @code{bras} instruction
21275 to do subroutine calls.
21276 This only works reliably if the total executable size does not
21277 exceed 64k. The default is to use the @code{basr} instruction instead,
21278 which does not have this limitation.
21279
21280 @item -m64
21281 @itemx -m31
21282 @opindex m64
21283 @opindex m31
21284 When @option{-m31} is specified, generate code compliant to the
21285 GNU/Linux for S/390 ABI@. When @option{-m64} is specified, generate
21286 code compliant to the GNU/Linux for zSeries ABI@. This allows GCC in
21287 particular to generate 64-bit instructions. For the @samp{s390}
21288 targets, the default is @option{-m31}, while the @samp{s390x}
21289 targets default to @option{-m64}.
21290
21291 @item -mzarch
21292 @itemx -mesa
21293 @opindex mzarch
21294 @opindex mesa
21295 When @option{-mzarch} is specified, generate code using the
21296 instructions available on z/Architecture.
21297 When @option{-mesa} is specified, generate code using the
21298 instructions available on ESA/390. Note that @option{-mesa} is
21299 not possible with @option{-m64}.
21300 When generating code compliant to the GNU/Linux for S/390 ABI,
21301 the default is @option{-mesa}. When generating code compliant
21302 to the GNU/Linux for zSeries ABI, the default is @option{-mzarch}.
21303
21304 @item -mhtm
21305 @itemx -mno-htm
21306 @opindex mhtm
21307 @opindex mno-htm
21308 The @option{-mhtm} option enables a set of builtins making use of
21309 instructions available with the transactional execution facility
21310 introduced with the IBM zEnterprise EC12 machine generation
21311 @ref{S/390 System z Built-in Functions}.
21312 @option{-mhtm} is enabled by default when using @option{-march=zEC12}.
21313
21314 @item -mvx
21315 @itemx -mno-vx
21316 @opindex mvx
21317 @opindex mno-vx
21318 When @option{-mvx} is specified, generate code using the instructions
21319 available with the vector extension facility introduced with the IBM
21320 z13 machine generation.
21321 This option changes the ABI for some vector type values with regard to
21322 alignment and calling conventions. In case vector type values are
21323 being used in an ABI-relevant context a GAS @samp{.gnu_attribute}
21324 command will be added to mark the resulting binary with the ABI used.
21325 @option{-mvx} is enabled by default when using @option{-march=z13}.
21326
21327 @item -mzvector
21328 @itemx -mno-zvector
21329 @opindex mzvector
21330 @opindex mno-zvector
21331 The @option{-mzvector} option enables vector language extensions and
21332 builtins using instructions available with the vector extension
21333 facility introduced with the IBM z13 machine generation.
21334 This option adds support for @samp{vector} to be used as a keyword to
21335 define vector type variables and arguments. @samp{vector} is only
21336 available when GNU extensions are enabled. It will not be expanded
21337 when requesting strict standard compliance e.g. with @option{-std=c99}.
21338 In addition to the GCC low-level builtins @option{-mzvector} enables
21339 a set of builtins added for compatibility with AltiVec-style
21340 implementations like Power and Cell. In order to make use of these
21341 builtins the header file @file{vecintrin.h} needs to be included.
21342 @option{-mzvector} is disabled by default.
21343
21344 @item -mmvcle
21345 @itemx -mno-mvcle
21346 @opindex mmvcle
21347 @opindex mno-mvcle
21348 Generate (or do not generate) code using the @code{mvcle} instruction
21349 to perform block moves. When @option{-mno-mvcle} is specified,
21350 use a @code{mvc} loop instead. This is the default unless optimizing for
21351 size.
21352
21353 @item -mdebug
21354 @itemx -mno-debug
21355 @opindex mdebug
21356 @opindex mno-debug
21357 Print (or do not print) additional debug information when compiling.
21358 The default is to not print debug information.
21359
21360 @item -march=@var{cpu-type}
21361 @opindex march
21362 Generate code that runs on @var{cpu-type}, which is the name of a
21363 system representing a certain processor type. Possible values for
21364 @var{cpu-type} are @samp{z900}, @samp{z990}, @samp{z9-109},
21365 @samp{z9-ec}, @samp{z10}, @samp{z196}, @samp{zEC12}, and @samp{z13}.
21366 The default is @option{-march=z900}. @samp{g5} and @samp{g6} are
21367 deprecated and will be removed with future releases.
21368
21369 @item -mtune=@var{cpu-type}
21370 @opindex mtune
21371 Tune to @var{cpu-type} everything applicable about the generated code,
21372 except for the ABI and the set of available instructions.
21373 The list of @var{cpu-type} values is the same as for @option{-march}.
21374 The default is the value used for @option{-march}.
21375
21376 @item -mtpf-trace
21377 @itemx -mno-tpf-trace
21378 @opindex mtpf-trace
21379 @opindex mno-tpf-trace
21380 Generate code that adds (does not add) in TPF OS specific branches to trace
21381 routines in the operating system. This option is off by default, even
21382 when compiling for the TPF OS@.
21383
21384 @item -mfused-madd
21385 @itemx -mno-fused-madd
21386 @opindex mfused-madd
21387 @opindex mno-fused-madd
21388 Generate code that uses (does not use) the floating-point multiply and
21389 accumulate instructions. These instructions are generated by default if
21390 hardware floating point is used.
21391
21392 @item -mwarn-framesize=@var{framesize}
21393 @opindex mwarn-framesize
21394 Emit a warning if the current function exceeds the given frame size. Because
21395 this is a compile-time check it doesn't need to be a real problem when the program
21396 runs. It is intended to identify functions that most probably cause
21397 a stack overflow. It is useful to be used in an environment with limited stack
21398 size e.g.@: the linux kernel.
21399
21400 @item -mwarn-dynamicstack
21401 @opindex mwarn-dynamicstack
21402 Emit a warning if the function calls @code{alloca} or uses dynamically-sized
21403 arrays. This is generally a bad idea with a limited stack size.
21404
21405 @item -mstack-guard=@var{stack-guard}
21406 @itemx -mstack-size=@var{stack-size}
21407 @opindex mstack-guard
21408 @opindex mstack-size
21409 If these options are provided the S/390 back end emits additional instructions in
21410 the function prologue that trigger a trap if the stack size is @var{stack-guard}
21411 bytes above the @var{stack-size} (remember that the stack on S/390 grows downward).
21412 If the @var{stack-guard} option is omitted the smallest power of 2 larger than
21413 the frame size of the compiled function is chosen.
21414 These options are intended to be used to help debugging stack overflow problems.
21415 The additionally emitted code causes only little overhead and hence can also be
21416 used in production-like systems without greater performance degradation. The given
21417 values have to be exact powers of 2 and @var{stack-size} has to be greater than
21418 @var{stack-guard} without exceeding 64k.
21419 In order to be efficient the extra code makes the assumption that the stack starts
21420 at an address aligned to the value given by @var{stack-size}.
21421 The @var{stack-guard} option can only be used in conjunction with @var{stack-size}.
21422
21423 @item -mhotpatch=@var{pre-halfwords},@var{post-halfwords}
21424 @opindex mhotpatch
21425 If the hotpatch option is enabled, a ``hot-patching'' function
21426 prologue is generated for all functions in the compilation unit.
21427 The funtion label is prepended with the given number of two-byte
21428 NOP instructions (@var{pre-halfwords}, maximum 1000000). After
21429 the label, 2 * @var{post-halfwords} bytes are appended, using the
21430 largest NOP like instructions the architecture allows (maximum
21431 1000000).
21432
21433 If both arguments are zero, hotpatching is disabled.
21434
21435 This option can be overridden for individual functions with the
21436 @code{hotpatch} attribute.
21437 @end table
21438
21439 @node Score Options
21440 @subsection Score Options
21441 @cindex Score Options
21442
21443 These options are defined for Score implementations:
21444
21445 @table @gcctabopt
21446 @item -meb
21447 @opindex meb
21448 Compile code for big-endian mode. This is the default.
21449
21450 @item -mel
21451 @opindex mel
21452 Compile code for little-endian mode.
21453
21454 @item -mnhwloop
21455 @opindex mnhwloop
21456 Disable generation of @code{bcnz} instructions.
21457
21458 @item -muls
21459 @opindex muls
21460 Enable generation of unaligned load and store instructions.
21461
21462 @item -mmac
21463 @opindex mmac
21464 Enable the use of multiply-accumulate instructions. Disabled by default.
21465
21466 @item -mscore5
21467 @opindex mscore5
21468 Specify the SCORE5 as the target architecture.
21469
21470 @item -mscore5u
21471 @opindex mscore5u
21472 Specify the SCORE5U of the target architecture.
21473
21474 @item -mscore7
21475 @opindex mscore7
21476 Specify the SCORE7 as the target architecture. This is the default.
21477
21478 @item -mscore7d
21479 @opindex mscore7d
21480 Specify the SCORE7D as the target architecture.
21481 @end table
21482
21483 @node SH Options
21484 @subsection SH Options
21485
21486 These @samp{-m} options are defined for the SH implementations:
21487
21488 @table @gcctabopt
21489 @item -m1
21490 @opindex m1
21491 Generate code for the SH1.
21492
21493 @item -m2
21494 @opindex m2
21495 Generate code for the SH2.
21496
21497 @item -m2e
21498 Generate code for the SH2e.
21499
21500 @item -m2a-nofpu
21501 @opindex m2a-nofpu
21502 Generate code for the SH2a without FPU, or for a SH2a-FPU in such a way
21503 that the floating-point unit is not used.
21504
21505 @item -m2a-single-only
21506 @opindex m2a-single-only
21507 Generate code for the SH2a-FPU, in such a way that no double-precision
21508 floating-point operations are used.
21509
21510 @item -m2a-single
21511 @opindex m2a-single
21512 Generate code for the SH2a-FPU assuming the floating-point unit is in
21513 single-precision mode by default.
21514
21515 @item -m2a
21516 @opindex m2a
21517 Generate code for the SH2a-FPU assuming the floating-point unit is in
21518 double-precision mode by default.
21519
21520 @item -m3
21521 @opindex m3
21522 Generate code for the SH3.
21523
21524 @item -m3e
21525 @opindex m3e
21526 Generate code for the SH3e.
21527
21528 @item -m4-nofpu
21529 @opindex m4-nofpu
21530 Generate code for the SH4 without a floating-point unit.
21531
21532 @item -m4-single-only
21533 @opindex m4-single-only
21534 Generate code for the SH4 with a floating-point unit that only
21535 supports single-precision arithmetic.
21536
21537 @item -m4-single
21538 @opindex m4-single
21539 Generate code for the SH4 assuming the floating-point unit is in
21540 single-precision mode by default.
21541
21542 @item -m4
21543 @opindex m4
21544 Generate code for the SH4.
21545
21546 @item -m4-100
21547 @opindex m4-100
21548 Generate code for SH4-100.
21549
21550 @item -m4-100-nofpu
21551 @opindex m4-100-nofpu
21552 Generate code for SH4-100 in such a way that the
21553 floating-point unit is not used.
21554
21555 @item -m4-100-single
21556 @opindex m4-100-single
21557 Generate code for SH4-100 assuming the floating-point unit is in
21558 single-precision mode by default.
21559
21560 @item -m4-100-single-only
21561 @opindex m4-100-single-only
21562 Generate code for SH4-100 in such a way that no double-precision
21563 floating-point operations are used.
21564
21565 @item -m4-200
21566 @opindex m4-200
21567 Generate code for SH4-200.
21568
21569 @item -m4-200-nofpu
21570 @opindex m4-200-nofpu
21571 Generate code for SH4-200 without in such a way that the
21572 floating-point unit is not used.
21573
21574 @item -m4-200-single
21575 @opindex m4-200-single
21576 Generate code for SH4-200 assuming the floating-point unit is in
21577 single-precision mode by default.
21578
21579 @item -m4-200-single-only
21580 @opindex m4-200-single-only
21581 Generate code for SH4-200 in such a way that no double-precision
21582 floating-point operations are used.
21583
21584 @item -m4-300
21585 @opindex m4-300
21586 Generate code for SH4-300.
21587
21588 @item -m4-300-nofpu
21589 @opindex m4-300-nofpu
21590 Generate code for SH4-300 without in such a way that the
21591 floating-point unit is not used.
21592
21593 @item -m4-300-single
21594 @opindex m4-300-single
21595 Generate code for SH4-300 in such a way that no double-precision
21596 floating-point operations are used.
21597
21598 @item -m4-300-single-only
21599 @opindex m4-300-single-only
21600 Generate code for SH4-300 in such a way that no double-precision
21601 floating-point operations are used.
21602
21603 @item -m4-340
21604 @opindex m4-340
21605 Generate code for SH4-340 (no MMU, no FPU).
21606
21607 @item -m4-500
21608 @opindex m4-500
21609 Generate code for SH4-500 (no FPU). Passes @option{-isa=sh4-nofpu} to the
21610 assembler.
21611
21612 @item -m4a-nofpu
21613 @opindex m4a-nofpu
21614 Generate code for the SH4al-dsp, or for a SH4a in such a way that the
21615 floating-point unit is not used.
21616
21617 @item -m4a-single-only
21618 @opindex m4a-single-only
21619 Generate code for the SH4a, in such a way that no double-precision
21620 floating-point operations are used.
21621
21622 @item -m4a-single
21623 @opindex m4a-single
21624 Generate code for the SH4a assuming the floating-point unit is in
21625 single-precision mode by default.
21626
21627 @item -m4a
21628 @opindex m4a
21629 Generate code for the SH4a.
21630
21631 @item -m4al
21632 @opindex m4al
21633 Same as @option{-m4a-nofpu}, except that it implicitly passes
21634 @option{-dsp} to the assembler. GCC doesn't generate any DSP
21635 instructions at the moment.
21636
21637 @item -mb
21638 @opindex mb
21639 Compile code for the processor in big-endian mode.
21640
21641 @item -ml
21642 @opindex ml
21643 Compile code for the processor in little-endian mode.
21644
21645 @item -mdalign
21646 @opindex mdalign
21647 Align doubles at 64-bit boundaries. Note that this changes the calling
21648 conventions, and thus some functions from the standard C library do
21649 not work unless you recompile it first with @option{-mdalign}.
21650
21651 @item -mrelax
21652 @opindex mrelax
21653 Shorten some address references at link time, when possible; uses the
21654 linker option @option{-relax}.
21655
21656 @item -mbigtable
21657 @opindex mbigtable
21658 Use 32-bit offsets in @code{switch} tables. The default is to use
21659 16-bit offsets.
21660
21661 @item -mbitops
21662 @opindex mbitops
21663 Enable the use of bit manipulation instructions on SH2A.
21664
21665 @item -mfmovd
21666 @opindex mfmovd
21667 Enable the use of the instruction @code{fmovd}. Check @option{-mdalign} for
21668 alignment constraints.
21669
21670 @item -mrenesas
21671 @opindex mrenesas
21672 Comply with the calling conventions defined by Renesas.
21673
21674 @item -mno-renesas
21675 @opindex mno-renesas
21676 Comply with the calling conventions defined for GCC before the Renesas
21677 conventions were available. This option is the default for all
21678 targets of the SH toolchain.
21679
21680 @item -mnomacsave
21681 @opindex mnomacsave
21682 Mark the @code{MAC} register as call-clobbered, even if
21683 @option{-mrenesas} is given.
21684
21685 @item -mieee
21686 @itemx -mno-ieee
21687 @opindex mieee
21688 @opindex mno-ieee
21689 Control the IEEE compliance of floating-point comparisons, which affects the
21690 handling of cases where the result of a comparison is unordered. By default
21691 @option{-mieee} is implicitly enabled. If @option{-ffinite-math-only} is
21692 enabled @option{-mno-ieee} is implicitly set, which results in faster
21693 floating-point greater-equal and less-equal comparisons. The implicit settings
21694 can be overridden by specifying either @option{-mieee} or @option{-mno-ieee}.
21695
21696 @item -minline-ic_invalidate
21697 @opindex minline-ic_invalidate
21698 Inline code to invalidate instruction cache entries after setting up
21699 nested function trampolines.
21700 This option has no effect if @option{-musermode} is in effect and the selected
21701 code generation option (e.g. @option{-m4}) does not allow the use of the @code{icbi}
21702 instruction.
21703 If the selected code generation option does not allow the use of the @code{icbi}
21704 instruction, and @option{-musermode} is not in effect, the inlined code
21705 manipulates the instruction cache address array directly with an associative
21706 write. This not only requires privileged mode at run time, but it also
21707 fails if the cache line had been mapped via the TLB and has become unmapped.
21708
21709 @item -misize
21710 @opindex misize
21711 Dump instruction size and location in the assembly code.
21712
21713 @item -mpadstruct
21714 @opindex mpadstruct
21715 This option is deprecated. It pads structures to multiple of 4 bytes,
21716 which is incompatible with the SH ABI@.
21717
21718 @item -matomic-model=@var{model}
21719 @opindex matomic-model=@var{model}
21720 Sets the model of atomic operations and additional parameters as a comma
21721 separated list. For details on the atomic built-in functions see
21722 @ref{__atomic Builtins}. The following models and parameters are supported:
21723
21724 @table @samp
21725
21726 @item none
21727 Disable compiler generated atomic sequences and emit library calls for atomic
21728 operations. This is the default if the target is not @code{sh*-*-linux*}.
21729
21730 @item soft-gusa
21731 Generate GNU/Linux compatible gUSA software atomic sequences for the atomic
21732 built-in functions. The generated atomic sequences require additional support
21733 from the interrupt/exception handling code of the system and are only suitable
21734 for SH3* and SH4* single-core systems. This option is enabled by default when
21735 the target is @code{sh*-*-linux*} and SH3* or SH4*. When the target is SH4A,
21736 this option also partially utilizes the hardware atomic instructions
21737 @code{movli.l} and @code{movco.l} to create more efficient code, unless
21738 @samp{strict} is specified.
21739
21740 @item soft-tcb
21741 Generate software atomic sequences that use a variable in the thread control
21742 block. This is a variation of the gUSA sequences which can also be used on
21743 SH1* and SH2* targets. The generated atomic sequences require additional
21744 support from the interrupt/exception handling code of the system and are only
21745 suitable for single-core systems. When using this model, the @samp{gbr-offset=}
21746 parameter has to be specified as well.
21747
21748 @item soft-imask
21749 Generate software atomic sequences that temporarily disable interrupts by
21750 setting @code{SR.IMASK = 1111}. This model works only when the program runs
21751 in privileged mode and is only suitable for single-core systems. Additional
21752 support from the interrupt/exception handling code of the system is not
21753 required. This model is enabled by default when the target is
21754 @code{sh*-*-linux*} and SH1* or SH2*.
21755
21756 @item hard-llcs
21757 Generate hardware atomic sequences using the @code{movli.l} and @code{movco.l}
21758 instructions only. This is only available on SH4A and is suitable for
21759 multi-core systems. Since the hardware instructions support only 32 bit atomic
21760 variables access to 8 or 16 bit variables is emulated with 32 bit accesses.
21761 Code compiled with this option is also compatible with other software
21762 atomic model interrupt/exception handling systems if executed on an SH4A
21763 system. Additional support from the interrupt/exception handling code of the
21764 system is not required for this model.
21765
21766 @item gbr-offset=
21767 This parameter specifies the offset in bytes of the variable in the thread
21768 control block structure that should be used by the generated atomic sequences
21769 when the @samp{soft-tcb} model has been selected. For other models this
21770 parameter is ignored. The specified value must be an integer multiple of four
21771 and in the range 0-1020.
21772
21773 @item strict
21774 This parameter prevents mixed usage of multiple atomic models, even if they
21775 are compatible, and makes the compiler generate atomic sequences of the
21776 specified model only.
21777
21778 @end table
21779
21780 @item -mtas
21781 @opindex mtas
21782 Generate the @code{tas.b} opcode for @code{__atomic_test_and_set}.
21783 Notice that depending on the particular hardware and software configuration
21784 this can degrade overall performance due to the operand cache line flushes
21785 that are implied by the @code{tas.b} instruction. On multi-core SH4A
21786 processors the @code{tas.b} instruction must be used with caution since it
21787 can result in data corruption for certain cache configurations.
21788
21789 @item -mprefergot
21790 @opindex mprefergot
21791 When generating position-independent code, emit function calls using
21792 the Global Offset Table instead of the Procedure Linkage Table.
21793
21794 @item -musermode
21795 @itemx -mno-usermode
21796 @opindex musermode
21797 @opindex mno-usermode
21798 Don't allow (allow) the compiler generating privileged mode code. Specifying
21799 @option{-musermode} also implies @option{-mno-inline-ic_invalidate} if the
21800 inlined code would not work in user mode. @option{-musermode} is the default
21801 when the target is @code{sh*-*-linux*}. If the target is SH1* or SH2*
21802 @option{-musermode} has no effect, since there is no user mode.
21803
21804 @item -multcost=@var{number}
21805 @opindex multcost=@var{number}
21806 Set the cost to assume for a multiply insn.
21807
21808 @item -mdiv=@var{strategy}
21809 @opindex mdiv=@var{strategy}
21810 Set the division strategy to be used for integer division operations.
21811 @var{strategy} can be one of:
21812
21813 @table @samp
21814
21815 @item call-div1
21816 Calls a library function that uses the single-step division instruction
21817 @code{div1} to perform the operation. Division by zero calculates an
21818 unspecified result and does not trap. This is the default except for SH4,
21819 SH2A and SHcompact.
21820
21821 @item call-fp
21822 Calls a library function that performs the operation in double precision
21823 floating point. Division by zero causes a floating-point exception. This is
21824 the default for SHcompact with FPU. Specifying this for targets that do not
21825 have a double precision FPU defaults to @code{call-div1}.
21826
21827 @item call-table
21828 Calls a library function that uses a lookup table for small divisors and
21829 the @code{div1} instruction with case distinction for larger divisors. Division
21830 by zero calculates an unspecified result and does not trap. This is the default
21831 for SH4. Specifying this for targets that do not have dynamic shift
21832 instructions defaults to @code{call-div1}.
21833
21834 @end table
21835
21836 When a division strategy has not been specified the default strategy is
21837 selected based on the current target. For SH2A the default strategy is to
21838 use the @code{divs} and @code{divu} instructions instead of library function
21839 calls.
21840
21841 @item -maccumulate-outgoing-args
21842 @opindex maccumulate-outgoing-args
21843 Reserve space once for outgoing arguments in the function prologue rather
21844 than around each call. Generally beneficial for performance and size. Also
21845 needed for unwinding to avoid changing the stack frame around conditional code.
21846
21847 @item -mdivsi3_libfunc=@var{name}
21848 @opindex mdivsi3_libfunc=@var{name}
21849 Set the name of the library function used for 32-bit signed division to
21850 @var{name}.
21851 This only affects the name used in the @samp{call} division strategies, and
21852 the compiler still expects the same sets of input/output/clobbered registers as
21853 if this option were not present.
21854
21855 @item -mfixed-range=@var{register-range}
21856 @opindex mfixed-range
21857 Generate code treating the given register range as fixed registers.
21858 A fixed register is one that the register allocator can not use. This is
21859 useful when compiling kernel code. A register range is specified as
21860 two registers separated by a dash. Multiple register ranges can be
21861 specified separated by a comma.
21862
21863 @item -mbranch-cost=@var{num}
21864 @opindex mbranch-cost=@var{num}
21865 Assume @var{num} to be the cost for a branch instruction. Higher numbers
21866 make the compiler try to generate more branch-free code if possible.
21867 If not specified the value is selected depending on the processor type that
21868 is being compiled for.
21869
21870 @item -mzdcbranch
21871 @itemx -mno-zdcbranch
21872 @opindex mzdcbranch
21873 @opindex mno-zdcbranch
21874 Assume (do not assume) that zero displacement conditional branch instructions
21875 @code{bt} and @code{bf} are fast. If @option{-mzdcbranch} is specified, the
21876 compiler prefers zero displacement branch code sequences. This is
21877 enabled by default when generating code for SH4 and SH4A. It can be explicitly
21878 disabled by specifying @option{-mno-zdcbranch}.
21879
21880 @item -mcbranch-force-delay-slot
21881 @opindex mcbranch-force-delay-slot
21882 Force the usage of delay slots for conditional branches, which stuffs the delay
21883 slot with a @code{nop} if a suitable instruction can't be found. By default
21884 this option is disabled. It can be enabled to work around hardware bugs as
21885 found in the original SH7055.
21886
21887 @item -mfused-madd
21888 @itemx -mno-fused-madd
21889 @opindex mfused-madd
21890 @opindex mno-fused-madd
21891 Generate code that uses (does not use) the floating-point multiply and
21892 accumulate instructions. These instructions are generated by default
21893 if hardware floating point is used. The machine-dependent
21894 @option{-mfused-madd} option is now mapped to the machine-independent
21895 @option{-ffp-contract=fast} option, and @option{-mno-fused-madd} is
21896 mapped to @option{-ffp-contract=off}.
21897
21898 @item -mfsca
21899 @itemx -mno-fsca
21900 @opindex mfsca
21901 @opindex mno-fsca
21902 Allow or disallow the compiler to emit the @code{fsca} instruction for sine
21903 and cosine approximations. The option @option{-mfsca} must be used in
21904 combination with @option{-funsafe-math-optimizations}. It is enabled by default
21905 when generating code for SH4A. Using @option{-mno-fsca} disables sine and cosine
21906 approximations even if @option{-funsafe-math-optimizations} is in effect.
21907
21908 @item -mfsrra
21909 @itemx -mno-fsrra
21910 @opindex mfsrra
21911 @opindex mno-fsrra
21912 Allow or disallow the compiler to emit the @code{fsrra} instruction for
21913 reciprocal square root approximations. The option @option{-mfsrra} must be used
21914 in combination with @option{-funsafe-math-optimizations} and
21915 @option{-ffinite-math-only}. It is enabled by default when generating code for
21916 SH4A. Using @option{-mno-fsrra} disables reciprocal square root approximations
21917 even if @option{-funsafe-math-optimizations} and @option{-ffinite-math-only} are
21918 in effect.
21919
21920 @item -mpretend-cmove
21921 @opindex mpretend-cmove
21922 Prefer zero-displacement conditional branches for conditional move instruction
21923 patterns. This can result in faster code on the SH4 processor.
21924
21925 @item -mfdpic
21926 @opindex fdpic
21927 Generate code using the FDPIC ABI.
21928
21929 @end table
21930
21931 @node Solaris 2 Options
21932 @subsection Solaris 2 Options
21933 @cindex Solaris 2 options
21934
21935 These @samp{-m} options are supported on Solaris 2:
21936
21937 @table @gcctabopt
21938 @item -mclear-hwcap
21939 @opindex mclear-hwcap
21940 @option{-mclear-hwcap} tells the compiler to remove the hardware
21941 capabilities generated by the Solaris assembler. This is only necessary
21942 when object files use ISA extensions not supported by the current
21943 machine, but check at runtime whether or not to use them.
21944
21945 @item -mimpure-text
21946 @opindex mimpure-text
21947 @option{-mimpure-text}, used in addition to @option{-shared}, tells
21948 the compiler to not pass @option{-z text} to the linker when linking a
21949 shared object. Using this option, you can link position-dependent
21950 code into a shared object.
21951
21952 @option{-mimpure-text} suppresses the ``relocations remain against
21953 allocatable but non-writable sections'' linker error message.
21954 However, the necessary relocations trigger copy-on-write, and the
21955 shared object is not actually shared across processes. Instead of
21956 using @option{-mimpure-text}, you should compile all source code with
21957 @option{-fpic} or @option{-fPIC}.
21958
21959 @end table
21960
21961 These switches are supported in addition to the above on Solaris 2:
21962
21963 @table @gcctabopt
21964 @item -pthreads
21965 @opindex pthreads
21966 Add support for multithreading using the POSIX threads library. This
21967 option sets flags for both the preprocessor and linker. This option does
21968 not affect the thread safety of object code produced by the compiler or
21969 that of libraries supplied with it.
21970
21971 @item -pthread
21972 @opindex pthread
21973 This is a synonym for @option{-pthreads}.
21974 @end table
21975
21976 @node SPARC Options
21977 @subsection SPARC Options
21978 @cindex SPARC options
21979
21980 These @samp{-m} options are supported on the SPARC:
21981
21982 @table @gcctabopt
21983 @item -mno-app-regs
21984 @itemx -mapp-regs
21985 @opindex mno-app-regs
21986 @opindex mapp-regs
21987 Specify @option{-mapp-regs} to generate output using the global registers
21988 2 through 4, which the SPARC SVR4 ABI reserves for applications. Like the
21989 global register 1, each global register 2 through 4 is then treated as an
21990 allocable register that is clobbered by function calls. This is the default.
21991
21992 To be fully SVR4 ABI-compliant at the cost of some performance loss,
21993 specify @option{-mno-app-regs}. You should compile libraries and system
21994 software with this option.
21995
21996 @item -mflat
21997 @itemx -mno-flat
21998 @opindex mflat
21999 @opindex mno-flat
22000 With @option{-mflat}, the compiler does not generate save/restore instructions
22001 and uses a ``flat'' or single register window model. This model is compatible
22002 with the regular register window model. The local registers and the input
22003 registers (0--5) are still treated as ``call-saved'' registers and are
22004 saved on the stack as needed.
22005
22006 With @option{-mno-flat} (the default), the compiler generates save/restore
22007 instructions (except for leaf functions). This is the normal operating mode.
22008
22009 @item -mfpu
22010 @itemx -mhard-float
22011 @opindex mfpu
22012 @opindex mhard-float
22013 Generate output containing floating-point instructions. This is the
22014 default.
22015
22016 @item -mno-fpu
22017 @itemx -msoft-float
22018 @opindex mno-fpu
22019 @opindex msoft-float
22020 Generate output containing library calls for floating point.
22021 @strong{Warning:} the requisite libraries are not available for all SPARC
22022 targets. Normally the facilities of the machine's usual C compiler are
22023 used, but this cannot be done directly in cross-compilation. You must make
22024 your own arrangements to provide suitable library functions for
22025 cross-compilation. The embedded targets @samp{sparc-*-aout} and
22026 @samp{sparclite-*-*} do provide software floating-point support.
22027
22028 @option{-msoft-float} changes the calling convention in the output file;
22029 therefore, it is only useful if you compile @emph{all} of a program with
22030 this option. In particular, you need to compile @file{libgcc.a}, the
22031 library that comes with GCC, with @option{-msoft-float} in order for
22032 this to work.
22033
22034 @item -mhard-quad-float
22035 @opindex mhard-quad-float
22036 Generate output containing quad-word (long double) floating-point
22037 instructions.
22038
22039 @item -msoft-quad-float
22040 @opindex msoft-quad-float
22041 Generate output containing library calls for quad-word (long double)
22042 floating-point instructions. The functions called are those specified
22043 in the SPARC ABI@. This is the default.
22044
22045 As of this writing, there are no SPARC implementations that have hardware
22046 support for the quad-word floating-point instructions. They all invoke
22047 a trap handler for one of these instructions, and then the trap handler
22048 emulates the effect of the instruction. Because of the trap handler overhead,
22049 this is much slower than calling the ABI library routines. Thus the
22050 @option{-msoft-quad-float} option is the default.
22051
22052 @item -mno-unaligned-doubles
22053 @itemx -munaligned-doubles
22054 @opindex mno-unaligned-doubles
22055 @opindex munaligned-doubles
22056 Assume that doubles have 8-byte alignment. This is the default.
22057
22058 With @option{-munaligned-doubles}, GCC assumes that doubles have 8-byte
22059 alignment only if they are contained in another type, or if they have an
22060 absolute address. Otherwise, it assumes they have 4-byte alignment.
22061 Specifying this option avoids some rare compatibility problems with code
22062 generated by other compilers. It is not the default because it results
22063 in a performance loss, especially for floating-point code.
22064
22065 @item -muser-mode
22066 @itemx -mno-user-mode
22067 @opindex muser-mode
22068 @opindex mno-user-mode
22069 Do not generate code that can only run in supervisor mode. This is relevant
22070 only for the @code{casa} instruction emitted for the LEON3 processor. This
22071 is the default.
22072
22073 @item -mfaster-structs
22074 @itemx -mno-faster-structs
22075 @opindex mfaster-structs
22076 @opindex mno-faster-structs
22077 With @option{-mfaster-structs}, the compiler assumes that structures
22078 should have 8-byte alignment. This enables the use of pairs of
22079 @code{ldd} and @code{std} instructions for copies in structure
22080 assignment, in place of twice as many @code{ld} and @code{st} pairs.
22081 However, the use of this changed alignment directly violates the SPARC
22082 ABI@. Thus, it's intended only for use on targets where the developer
22083 acknowledges that their resulting code is not directly in line with
22084 the rules of the ABI@.
22085
22086 @item -mstd-struct-return
22087 @itemx -mno-std-struct-return
22088 @opindex mstd-struct-return
22089 @opindex mno-std-struct-return
22090 With @option{-mstd-struct-return}, the compiler generates checking code
22091 in functions returning structures or unions to detect size mismatches
22092 between the two sides of function calls, as per the 32-bit ABI@.
22093
22094 The default is @option{-mno-std-struct-return}. This option has no effect
22095 in 64-bit mode.
22096
22097 @item -mcpu=@var{cpu_type}
22098 @opindex mcpu
22099 Set the instruction set, register set, and instruction scheduling parameters
22100 for machine type @var{cpu_type}. Supported values for @var{cpu_type} are
22101 @samp{v7}, @samp{cypress}, @samp{v8}, @samp{supersparc}, @samp{hypersparc},
22102 @samp{leon}, @samp{leon3}, @samp{leon3v7}, @samp{sparclite}, @samp{f930},
22103 @samp{f934}, @samp{sparclite86x}, @samp{sparclet}, @samp{tsc701}, @samp{v9},
22104 @samp{ultrasparc}, @samp{ultrasparc3}, @samp{niagara}, @samp{niagara2},
22105 @samp{niagara3} and @samp{niagara4}.
22106
22107 Native Solaris and GNU/Linux toolchains also support the value @samp{native},
22108 which selects the best architecture option for the host processor.
22109 @option{-mcpu=native} has no effect if GCC does not recognize
22110 the processor.
22111
22112 Default instruction scheduling parameters are used for values that select
22113 an architecture and not an implementation. These are @samp{v7}, @samp{v8},
22114 @samp{sparclite}, @samp{sparclet}, @samp{v9}.
22115
22116 Here is a list of each supported architecture and their supported
22117 implementations.
22118
22119 @table @asis
22120 @item v7
22121 cypress, leon3v7
22122
22123 @item v8
22124 supersparc, hypersparc, leon, leon3
22125
22126 @item sparclite
22127 f930, f934, sparclite86x
22128
22129 @item sparclet
22130 tsc701
22131
22132 @item v9
22133 ultrasparc, ultrasparc3, niagara, niagara2, niagara3, niagara4
22134 @end table
22135
22136 By default (unless configured otherwise), GCC generates code for the V7
22137 variant of the SPARC architecture. With @option{-mcpu=cypress}, the compiler
22138 additionally optimizes it for the Cypress CY7C602 chip, as used in the
22139 SPARCStation/SPARCServer 3xx series. This is also appropriate for the older
22140 SPARCStation 1, 2, IPX etc.
22141
22142 With @option{-mcpu=v8}, GCC generates code for the V8 variant of the SPARC
22143 architecture. The only difference from V7 code is that the compiler emits
22144 the integer multiply and integer divide instructions which exist in SPARC-V8
22145 but not in SPARC-V7. With @option{-mcpu=supersparc}, the compiler additionally
22146 optimizes it for the SuperSPARC chip, as used in the SPARCStation 10, 1000 and
22147 2000 series.
22148
22149 With @option{-mcpu=sparclite}, GCC generates code for the SPARClite variant of
22150 the SPARC architecture. This adds the integer multiply, integer divide step
22151 and scan (@code{ffs}) instructions which exist in SPARClite but not in SPARC-V7.
22152 With @option{-mcpu=f930}, the compiler additionally optimizes it for the
22153 Fujitsu MB86930 chip, which is the original SPARClite, with no FPU@. With
22154 @option{-mcpu=f934}, the compiler additionally optimizes it for the Fujitsu
22155 MB86934 chip, which is the more recent SPARClite with FPU@.
22156
22157 With @option{-mcpu=sparclet}, GCC generates code for the SPARClet variant of
22158 the SPARC architecture. This adds the integer multiply, multiply/accumulate,
22159 integer divide step and scan (@code{ffs}) instructions which exist in SPARClet
22160 but not in SPARC-V7. With @option{-mcpu=tsc701}, the compiler additionally
22161 optimizes it for the TEMIC SPARClet chip.
22162
22163 With @option{-mcpu=v9}, GCC generates code for the V9 variant of the SPARC
22164 architecture. This adds 64-bit integer and floating-point move instructions,
22165 3 additional floating-point condition code registers and conditional move
22166 instructions. With @option{-mcpu=ultrasparc}, the compiler additionally
22167 optimizes it for the Sun UltraSPARC I/II/IIi chips. With
22168 @option{-mcpu=ultrasparc3}, the compiler additionally optimizes it for the
22169 Sun UltraSPARC III/III+/IIIi/IIIi+/IV/IV+ chips. With
22170 @option{-mcpu=niagara}, the compiler additionally optimizes it for
22171 Sun UltraSPARC T1 chips. With @option{-mcpu=niagara2}, the compiler
22172 additionally optimizes it for Sun UltraSPARC T2 chips. With
22173 @option{-mcpu=niagara3}, the compiler additionally optimizes it for Sun
22174 UltraSPARC T3 chips. With @option{-mcpu=niagara4}, the compiler
22175 additionally optimizes it for Sun UltraSPARC T4 chips.
22176
22177 @item -mtune=@var{cpu_type}
22178 @opindex mtune
22179 Set the instruction scheduling parameters for machine type
22180 @var{cpu_type}, but do not set the instruction set or register set that the
22181 option @option{-mcpu=@var{cpu_type}} does.
22182
22183 The same values for @option{-mcpu=@var{cpu_type}} can be used for
22184 @option{-mtune=@var{cpu_type}}, but the only useful values are those
22185 that select a particular CPU implementation. Those are @samp{cypress},
22186 @samp{supersparc}, @samp{hypersparc}, @samp{leon}, @samp{leon3},
22187 @samp{leon3v7}, @samp{f930}, @samp{f934}, @samp{sparclite86x}, @samp{tsc701},
22188 @samp{ultrasparc}, @samp{ultrasparc3}, @samp{niagara}, @samp{niagara2},
22189 @samp{niagara3} and @samp{niagara4}. With native Solaris and GNU/Linux
22190 toolchains, @samp{native} can also be used.
22191
22192 @item -mv8plus
22193 @itemx -mno-v8plus
22194 @opindex mv8plus
22195 @opindex mno-v8plus
22196 With @option{-mv8plus}, GCC generates code for the SPARC-V8+ ABI@. The
22197 difference from the V8 ABI is that the global and out registers are
22198 considered 64 bits wide. This is enabled by default on Solaris in 32-bit
22199 mode for all SPARC-V9 processors.
22200
22201 @item -mvis
22202 @itemx -mno-vis
22203 @opindex mvis
22204 @opindex mno-vis
22205 With @option{-mvis}, GCC generates code that takes advantage of the UltraSPARC
22206 Visual Instruction Set extensions. The default is @option{-mno-vis}.
22207
22208 @item -mvis2
22209 @itemx -mno-vis2
22210 @opindex mvis2
22211 @opindex mno-vis2
22212 With @option{-mvis2}, GCC generates code that takes advantage of
22213 version 2.0 of the UltraSPARC Visual Instruction Set extensions. The
22214 default is @option{-mvis2} when targeting a cpu that supports such
22215 instructions, such as UltraSPARC-III and later. Setting @option{-mvis2}
22216 also sets @option{-mvis}.
22217
22218 @item -mvis3
22219 @itemx -mno-vis3
22220 @opindex mvis3
22221 @opindex mno-vis3
22222 With @option{-mvis3}, GCC generates code that takes advantage of
22223 version 3.0 of the UltraSPARC Visual Instruction Set extensions. The
22224 default is @option{-mvis3} when targeting a cpu that supports such
22225 instructions, such as niagara-3 and later. Setting @option{-mvis3}
22226 also sets @option{-mvis2} and @option{-mvis}.
22227
22228 @item -mcbcond
22229 @itemx -mno-cbcond
22230 @opindex mcbcond
22231 @opindex mno-cbcond
22232 With @option{-mcbcond}, GCC generates code that takes advantage of
22233 compare-and-branch instructions, as defined in the Sparc Architecture 2011.
22234 The default is @option{-mcbcond} when targeting a cpu that supports such
22235 instructions, such as niagara-4 and later.
22236
22237 @item -mpopc
22238 @itemx -mno-popc
22239 @opindex mpopc
22240 @opindex mno-popc
22241 With @option{-mpopc}, GCC generates code that takes advantage of the UltraSPARC
22242 population count instruction. The default is @option{-mpopc}
22243 when targeting a cpu that supports such instructions, such as Niagara-2 and
22244 later.
22245
22246 @item -mfmaf
22247 @itemx -mno-fmaf
22248 @opindex mfmaf
22249 @opindex mno-fmaf
22250 With @option{-mfmaf}, GCC generates code that takes advantage of the UltraSPARC
22251 Fused Multiply-Add Floating-point extensions. The default is @option{-mfmaf}
22252 when targeting a cpu that supports such instructions, such as Niagara-3 and
22253 later.
22254
22255 @item -mfix-at697f
22256 @opindex mfix-at697f
22257 Enable the documented workaround for the single erratum of the Atmel AT697F
22258 processor (which corresponds to erratum #13 of the AT697E processor).
22259
22260 @item -mfix-ut699
22261 @opindex mfix-ut699
22262 Enable the documented workarounds for the floating-point errata and the data
22263 cache nullify errata of the UT699 processor.
22264 @end table
22265
22266 These @samp{-m} options are supported in addition to the above
22267 on SPARC-V9 processors in 64-bit environments:
22268
22269 @table @gcctabopt
22270 @item -m32
22271 @itemx -m64
22272 @opindex m32
22273 @opindex m64
22274 Generate code for a 32-bit or 64-bit environment.
22275 The 32-bit environment sets int, long and pointer to 32 bits.
22276 The 64-bit environment sets int to 32 bits and long and pointer
22277 to 64 bits.
22278
22279 @item -mcmodel=@var{which}
22280 @opindex mcmodel
22281 Set the code model to one of
22282
22283 @table @samp
22284 @item medlow
22285 The Medium/Low code model: 64-bit addresses, programs
22286 must be linked in the low 32 bits of memory. Programs can be statically
22287 or dynamically linked.
22288
22289 @item medmid
22290 The Medium/Middle code model: 64-bit addresses, programs
22291 must be linked in the low 44 bits of memory, the text and data segments must
22292 be less than 2GB in size and the data segment must be located within 2GB of
22293 the text segment.
22294
22295 @item medany
22296 The Medium/Anywhere code model: 64-bit addresses, programs
22297 may be linked anywhere in memory, the text and data segments must be less
22298 than 2GB in size and the data segment must be located within 2GB of the
22299 text segment.
22300
22301 @item embmedany
22302 The Medium/Anywhere code model for embedded systems:
22303 64-bit addresses, the text and data segments must be less than 2GB in
22304 size, both starting anywhere in memory (determined at link time). The
22305 global register %g4 points to the base of the data segment. Programs
22306 are statically linked and PIC is not supported.
22307 @end table
22308
22309 @item -mmemory-model=@var{mem-model}
22310 @opindex mmemory-model
22311 Set the memory model in force on the processor to one of
22312
22313 @table @samp
22314 @item default
22315 The default memory model for the processor and operating system.
22316
22317 @item rmo
22318 Relaxed Memory Order
22319
22320 @item pso
22321 Partial Store Order
22322
22323 @item tso
22324 Total Store Order
22325
22326 @item sc
22327 Sequential Consistency
22328 @end table
22329
22330 These memory models are formally defined in Appendix D of the Sparc V9
22331 architecture manual, as set in the processor's @code{PSTATE.MM} field.
22332
22333 @item -mstack-bias
22334 @itemx -mno-stack-bias
22335 @opindex mstack-bias
22336 @opindex mno-stack-bias
22337 With @option{-mstack-bias}, GCC assumes that the stack pointer, and
22338 frame pointer if present, are offset by @minus{}2047 which must be added back
22339 when making stack frame references. This is the default in 64-bit mode.
22340 Otherwise, assume no such offset is present.
22341 @end table
22342
22343 @node SPU Options
22344 @subsection SPU Options
22345 @cindex SPU options
22346
22347 These @samp{-m} options are supported on the SPU:
22348
22349 @table @gcctabopt
22350 @item -mwarn-reloc
22351 @itemx -merror-reloc
22352 @opindex mwarn-reloc
22353 @opindex merror-reloc
22354
22355 The loader for SPU does not handle dynamic relocations. By default, GCC
22356 gives an error when it generates code that requires a dynamic
22357 relocation. @option{-mno-error-reloc} disables the error,
22358 @option{-mwarn-reloc} generates a warning instead.
22359
22360 @item -msafe-dma
22361 @itemx -munsafe-dma
22362 @opindex msafe-dma
22363 @opindex munsafe-dma
22364
22365 Instructions that initiate or test completion of DMA must not be
22366 reordered with respect to loads and stores of the memory that is being
22367 accessed.
22368 With @option{-munsafe-dma} you must use the @code{volatile} keyword to protect
22369 memory accesses, but that can lead to inefficient code in places where the
22370 memory is known to not change. Rather than mark the memory as volatile,
22371 you can use @option{-msafe-dma} to tell the compiler to treat
22372 the DMA instructions as potentially affecting all memory.
22373
22374 @item -mbranch-hints
22375 @opindex mbranch-hints
22376
22377 By default, GCC generates a branch hint instruction to avoid
22378 pipeline stalls for always-taken or probably-taken branches. A hint
22379 is not generated closer than 8 instructions away from its branch.
22380 There is little reason to disable them, except for debugging purposes,
22381 or to make an object a little bit smaller.
22382
22383 @item -msmall-mem
22384 @itemx -mlarge-mem
22385 @opindex msmall-mem
22386 @opindex mlarge-mem
22387
22388 By default, GCC generates code assuming that addresses are never larger
22389 than 18 bits. With @option{-mlarge-mem} code is generated that assumes
22390 a full 32-bit address.
22391
22392 @item -mstdmain
22393 @opindex mstdmain
22394
22395 By default, GCC links against startup code that assumes the SPU-style
22396 main function interface (which has an unconventional parameter list).
22397 With @option{-mstdmain}, GCC links your program against startup
22398 code that assumes a C99-style interface to @code{main}, including a
22399 local copy of @code{argv} strings.
22400
22401 @item -mfixed-range=@var{register-range}
22402 @opindex mfixed-range
22403 Generate code treating the given register range as fixed registers.
22404 A fixed register is one that the register allocator cannot use. This is
22405 useful when compiling kernel code. A register range is specified as
22406 two registers separated by a dash. Multiple register ranges can be
22407 specified separated by a comma.
22408
22409 @item -mea32
22410 @itemx -mea64
22411 @opindex mea32
22412 @opindex mea64
22413 Compile code assuming that pointers to the PPU address space accessed
22414 via the @code{__ea} named address space qualifier are either 32 or 64
22415 bits wide. The default is 32 bits. As this is an ABI-changing option,
22416 all object code in an executable must be compiled with the same setting.
22417
22418 @item -maddress-space-conversion
22419 @itemx -mno-address-space-conversion
22420 @opindex maddress-space-conversion
22421 @opindex mno-address-space-conversion
22422 Allow/disallow treating the @code{__ea} address space as superset
22423 of the generic address space. This enables explicit type casts
22424 between @code{__ea} and generic pointer as well as implicit
22425 conversions of generic pointers to @code{__ea} pointers. The
22426 default is to allow address space pointer conversions.
22427
22428 @item -mcache-size=@var{cache-size}
22429 @opindex mcache-size
22430 This option controls the version of libgcc that the compiler links to an
22431 executable and selects a software-managed cache for accessing variables
22432 in the @code{__ea} address space with a particular cache size. Possible
22433 options for @var{cache-size} are @samp{8}, @samp{16}, @samp{32}, @samp{64}
22434 and @samp{128}. The default cache size is 64KB.
22435
22436 @item -matomic-updates
22437 @itemx -mno-atomic-updates
22438 @opindex matomic-updates
22439 @opindex mno-atomic-updates
22440 This option controls the version of libgcc that the compiler links to an
22441 executable and selects whether atomic updates to the software-managed
22442 cache of PPU-side variables are used. If you use atomic updates, changes
22443 to a PPU variable from SPU code using the @code{__ea} named address space
22444 qualifier do not interfere with changes to other PPU variables residing
22445 in the same cache line from PPU code. If you do not use atomic updates,
22446 such interference may occur; however, writing back cache lines is
22447 more efficient. The default behavior is to use atomic updates.
22448
22449 @item -mdual-nops
22450 @itemx -mdual-nops=@var{n}
22451 @opindex mdual-nops
22452 By default, GCC inserts nops to increase dual issue when it expects
22453 it to increase performance. @var{n} can be a value from 0 to 10. A
22454 smaller @var{n} inserts fewer nops. 10 is the default, 0 is the
22455 same as @option{-mno-dual-nops}. Disabled with @option{-Os}.
22456
22457 @item -mhint-max-nops=@var{n}
22458 @opindex mhint-max-nops
22459 Maximum number of nops to insert for a branch hint. A branch hint must
22460 be at least 8 instructions away from the branch it is affecting. GCC
22461 inserts up to @var{n} nops to enforce this, otherwise it does not
22462 generate the branch hint.
22463
22464 @item -mhint-max-distance=@var{n}
22465 @opindex mhint-max-distance
22466 The encoding of the branch hint instruction limits the hint to be within
22467 256 instructions of the branch it is affecting. By default, GCC makes
22468 sure it is within 125.
22469
22470 @item -msafe-hints
22471 @opindex msafe-hints
22472 Work around a hardware bug that causes the SPU to stall indefinitely.
22473 By default, GCC inserts the @code{hbrp} instruction to make sure
22474 this stall won't happen.
22475
22476 @end table
22477
22478 @node System V Options
22479 @subsection Options for System V
22480
22481 These additional options are available on System V Release 4 for
22482 compatibility with other compilers on those systems:
22483
22484 @table @gcctabopt
22485 @item -G
22486 @opindex G
22487 Create a shared object.
22488 It is recommended that @option{-symbolic} or @option{-shared} be used instead.
22489
22490 @item -Qy
22491 @opindex Qy
22492 Identify the versions of each tool used by the compiler, in a
22493 @code{.ident} assembler directive in the output.
22494
22495 @item -Qn
22496 @opindex Qn
22497 Refrain from adding @code{.ident} directives to the output file (this is
22498 the default).
22499
22500 @item -YP,@var{dirs}
22501 @opindex YP
22502 Search the directories @var{dirs}, and no others, for libraries
22503 specified with @option{-l}.
22504
22505 @item -Ym,@var{dir}
22506 @opindex Ym
22507 Look in the directory @var{dir} to find the M4 preprocessor.
22508 The assembler uses this option.
22509 @c This is supposed to go with a -Yd for predefined M4 macro files, but
22510 @c the generic assembler that comes with Solaris takes just -Ym.
22511 @end table
22512
22513 @node TILE-Gx Options
22514 @subsection TILE-Gx Options
22515 @cindex TILE-Gx options
22516
22517 These @samp{-m} options are supported on the TILE-Gx:
22518
22519 @table @gcctabopt
22520 @item -mcmodel=small
22521 @opindex mcmodel=small
22522 Generate code for the small model. The distance for direct calls is
22523 limited to 500M in either direction. PC-relative addresses are 32
22524 bits. Absolute addresses support the full address range.
22525
22526 @item -mcmodel=large
22527 @opindex mcmodel=large
22528 Generate code for the large model. There is no limitation on call
22529 distance, pc-relative addresses, or absolute addresses.
22530
22531 @item -mcpu=@var{name}
22532 @opindex mcpu
22533 Selects the type of CPU to be targeted. Currently the only supported
22534 type is @samp{tilegx}.
22535
22536 @item -m32
22537 @itemx -m64
22538 @opindex m32
22539 @opindex m64
22540 Generate code for a 32-bit or 64-bit environment. The 32-bit
22541 environment sets int, long, and pointer to 32 bits. The 64-bit
22542 environment sets int to 32 bits and long and pointer to 64 bits.
22543
22544 @item -mbig-endian
22545 @itemx -mlittle-endian
22546 @opindex mbig-endian
22547 @opindex mlittle-endian
22548 Generate code in big/little endian mode, respectively.
22549 @end table
22550
22551 @node TILEPro Options
22552 @subsection TILEPro Options
22553 @cindex TILEPro options
22554
22555 These @samp{-m} options are supported on the TILEPro:
22556
22557 @table @gcctabopt
22558 @item -mcpu=@var{name}
22559 @opindex mcpu
22560 Selects the type of CPU to be targeted. Currently the only supported
22561 type is @samp{tilepro}.
22562
22563 @item -m32
22564 @opindex m32
22565 Generate code for a 32-bit environment, which sets int, long, and
22566 pointer to 32 bits. This is the only supported behavior so the flag
22567 is essentially ignored.
22568 @end table
22569
22570 @node V850 Options
22571 @subsection V850 Options
22572 @cindex V850 Options
22573
22574 These @samp{-m} options are defined for V850 implementations:
22575
22576 @table @gcctabopt
22577 @item -mlong-calls
22578 @itemx -mno-long-calls
22579 @opindex mlong-calls
22580 @opindex mno-long-calls
22581 Treat all calls as being far away (near). If calls are assumed to be
22582 far away, the compiler always loads the function's address into a
22583 register, and calls indirect through the pointer.
22584
22585 @item -mno-ep
22586 @itemx -mep
22587 @opindex mno-ep
22588 @opindex mep
22589 Do not optimize (do optimize) basic blocks that use the same index
22590 pointer 4 or more times to copy pointer into the @code{ep} register, and
22591 use the shorter @code{sld} and @code{sst} instructions. The @option{-mep}
22592 option is on by default if you optimize.
22593
22594 @item -mno-prolog-function
22595 @itemx -mprolog-function
22596 @opindex mno-prolog-function
22597 @opindex mprolog-function
22598 Do not use (do use) external functions to save and restore registers
22599 at the prologue and epilogue of a function. The external functions
22600 are slower, but use less code space if more than one function saves
22601 the same number of registers. The @option{-mprolog-function} option
22602 is on by default if you optimize.
22603
22604 @item -mspace
22605 @opindex mspace
22606 Try to make the code as small as possible. At present, this just turns
22607 on the @option{-mep} and @option{-mprolog-function} options.
22608
22609 @item -mtda=@var{n}
22610 @opindex mtda
22611 Put static or global variables whose size is @var{n} bytes or less into
22612 the tiny data area that register @code{ep} points to. The tiny data
22613 area can hold up to 256 bytes in total (128 bytes for byte references).
22614
22615 @item -msda=@var{n}
22616 @opindex msda
22617 Put static or global variables whose size is @var{n} bytes or less into
22618 the small data area that register @code{gp} points to. The small data
22619 area can hold up to 64 kilobytes.
22620
22621 @item -mzda=@var{n}
22622 @opindex mzda
22623 Put static or global variables whose size is @var{n} bytes or less into
22624 the first 32 kilobytes of memory.
22625
22626 @item -mv850
22627 @opindex mv850
22628 Specify that the target processor is the V850.
22629
22630 @item -mv850e3v5
22631 @opindex mv850e3v5
22632 Specify that the target processor is the V850E3V5. The preprocessor
22633 constant @code{__v850e3v5__} is defined if this option is used.
22634
22635 @item -mv850e2v4
22636 @opindex mv850e2v4
22637 Specify that the target processor is the V850E3V5. This is an alias for
22638 the @option{-mv850e3v5} option.
22639
22640 @item -mv850e2v3
22641 @opindex mv850e2v3
22642 Specify that the target processor is the V850E2V3. The preprocessor
22643 constant @code{__v850e2v3__} is defined if this option is used.
22644
22645 @item -mv850e2
22646 @opindex mv850e2
22647 Specify that the target processor is the V850E2. The preprocessor
22648 constant @code{__v850e2__} is defined if this option is used.
22649
22650 @item -mv850e1
22651 @opindex mv850e1
22652 Specify that the target processor is the V850E1. The preprocessor
22653 constants @code{__v850e1__} and @code{__v850e__} are defined if
22654 this option is used.
22655
22656 @item -mv850es
22657 @opindex mv850es
22658 Specify that the target processor is the V850ES. This is an alias for
22659 the @option{-mv850e1} option.
22660
22661 @item -mv850e
22662 @opindex mv850e
22663 Specify that the target processor is the V850E@. The preprocessor
22664 constant @code{__v850e__} is defined if this option is used.
22665
22666 If neither @option{-mv850} nor @option{-mv850e} nor @option{-mv850e1}
22667 nor @option{-mv850e2} nor @option{-mv850e2v3} nor @option{-mv850e3v5}
22668 are defined then a default target processor is chosen and the
22669 relevant @samp{__v850*__} preprocessor constant is defined.
22670
22671 The preprocessor constants @code{__v850} and @code{__v851__} are always
22672 defined, regardless of which processor variant is the target.
22673
22674 @item -mdisable-callt
22675 @itemx -mno-disable-callt
22676 @opindex mdisable-callt
22677 @opindex mno-disable-callt
22678 This option suppresses generation of the @code{CALLT} instruction for the
22679 v850e, v850e1, v850e2, v850e2v3 and v850e3v5 flavors of the v850
22680 architecture.
22681
22682 This option is enabled by default when the RH850 ABI is
22683 in use (see @option{-mrh850-abi}), and disabled by default when the
22684 GCC ABI is in use. If @code{CALLT} instructions are being generated
22685 then the C preprocessor symbol @code{__V850_CALLT__} is defined.
22686
22687 @item -mrelax
22688 @itemx -mno-relax
22689 @opindex mrelax
22690 @opindex mno-relax
22691 Pass on (or do not pass on) the @option{-mrelax} command-line option
22692 to the assembler.
22693
22694 @item -mlong-jumps
22695 @itemx -mno-long-jumps
22696 @opindex mlong-jumps
22697 @opindex mno-long-jumps
22698 Disable (or re-enable) the generation of PC-relative jump instructions.
22699
22700 @item -msoft-float
22701 @itemx -mhard-float
22702 @opindex msoft-float
22703 @opindex mhard-float
22704 Disable (or re-enable) the generation of hardware floating point
22705 instructions. This option is only significant when the target
22706 architecture is @samp{V850E2V3} or higher. If hardware floating point
22707 instructions are being generated then the C preprocessor symbol
22708 @code{__FPU_OK__} is defined, otherwise the symbol
22709 @code{__NO_FPU__} is defined.
22710
22711 @item -mloop
22712 @opindex mloop
22713 Enables the use of the e3v5 LOOP instruction. The use of this
22714 instruction is not enabled by default when the e3v5 architecture is
22715 selected because its use is still experimental.
22716
22717 @item -mrh850-abi
22718 @itemx -mghs
22719 @opindex mrh850-abi
22720 @opindex mghs
22721 Enables support for the RH850 version of the V850 ABI. This is the
22722 default. With this version of the ABI the following rules apply:
22723
22724 @itemize
22725 @item
22726 Integer sized structures and unions are returned via a memory pointer
22727 rather than a register.
22728
22729 @item
22730 Large structures and unions (more than 8 bytes in size) are passed by
22731 value.
22732
22733 @item
22734 Functions are aligned to 16-bit boundaries.
22735
22736 @item
22737 The @option{-m8byte-align} command-line option is supported.
22738
22739 @item
22740 The @option{-mdisable-callt} command-line option is enabled by
22741 default. The @option{-mno-disable-callt} command-line option is not
22742 supported.
22743 @end itemize
22744
22745 When this version of the ABI is enabled the C preprocessor symbol
22746 @code{__V850_RH850_ABI__} is defined.
22747
22748 @item -mgcc-abi
22749 @opindex mgcc-abi
22750 Enables support for the old GCC version of the V850 ABI. With this
22751 version of the ABI the following rules apply:
22752
22753 @itemize
22754 @item
22755 Integer sized structures and unions are returned in register @code{r10}.
22756
22757 @item
22758 Large structures and unions (more than 8 bytes in size) are passed by
22759 reference.
22760
22761 @item
22762 Functions are aligned to 32-bit boundaries, unless optimizing for
22763 size.
22764
22765 @item
22766 The @option{-m8byte-align} command-line option is not supported.
22767
22768 @item
22769 The @option{-mdisable-callt} command-line option is supported but not
22770 enabled by default.
22771 @end itemize
22772
22773 When this version of the ABI is enabled the C preprocessor symbol
22774 @code{__V850_GCC_ABI__} is defined.
22775
22776 @item -m8byte-align
22777 @itemx -mno-8byte-align
22778 @opindex m8byte-align
22779 @opindex mno-8byte-align
22780 Enables support for @code{double} and @code{long long} types to be
22781 aligned on 8-byte boundaries. The default is to restrict the
22782 alignment of all objects to at most 4-bytes. When
22783 @option{-m8byte-align} is in effect the C preprocessor symbol
22784 @code{__V850_8BYTE_ALIGN__} is defined.
22785
22786 @item -mbig-switch
22787 @opindex mbig-switch
22788 Generate code suitable for big switch tables. Use this option only if
22789 the assembler/linker complain about out of range branches within a switch
22790 table.
22791
22792 @item -mapp-regs
22793 @opindex mapp-regs
22794 This option causes r2 and r5 to be used in the code generated by
22795 the compiler. This setting is the default.
22796
22797 @item -mno-app-regs
22798 @opindex mno-app-regs
22799 This option causes r2 and r5 to be treated as fixed registers.
22800
22801 @end table
22802
22803 @node VAX Options
22804 @subsection VAX Options
22805 @cindex VAX options
22806
22807 These @samp{-m} options are defined for the VAX:
22808
22809 @table @gcctabopt
22810 @item -munix
22811 @opindex munix
22812 Do not output certain jump instructions (@code{aobleq} and so on)
22813 that the Unix assembler for the VAX cannot handle across long
22814 ranges.
22815
22816 @item -mgnu
22817 @opindex mgnu
22818 Do output those jump instructions, on the assumption that the
22819 GNU assembler is being used.
22820
22821 @item -mg
22822 @opindex mg
22823 Output code for G-format floating-point numbers instead of D-format.
22824 @end table
22825
22826 @node Visium Options
22827 @subsection Visium Options
22828 @cindex Visium options
22829
22830 @table @gcctabopt
22831
22832 @item -mdebug
22833 @opindex mdebug
22834 A program which performs file I/O and is destined to run on an MCM target
22835 should be linked with this option. It causes the libraries libc.a and
22836 libdebug.a to be linked. The program should be run on the target under
22837 the control of the GDB remote debugging stub.
22838
22839 @item -msim
22840 @opindex msim
22841 A program which performs file I/O and is destined to run on the simulator
22842 should be linked with option. This causes libraries libc.a and libsim.a to
22843 be linked.
22844
22845 @item -mfpu
22846 @itemx -mhard-float
22847 @opindex mfpu
22848 @opindex mhard-float
22849 Generate code containing floating-point instructions. This is the
22850 default.
22851
22852 @item -mno-fpu
22853 @itemx -msoft-float
22854 @opindex mno-fpu
22855 @opindex msoft-float
22856 Generate code containing library calls for floating-point.
22857
22858 @option{-msoft-float} changes the calling convention in the output file;
22859 therefore, it is only useful if you compile @emph{all} of a program with
22860 this option. In particular, you need to compile @file{libgcc.a}, the
22861 library that comes with GCC, with @option{-msoft-float} in order for
22862 this to work.
22863
22864 @item -mcpu=@var{cpu_type}
22865 @opindex mcpu
22866 Set the instruction set, register set, and instruction scheduling parameters
22867 for machine type @var{cpu_type}. Supported values for @var{cpu_type} are
22868 @samp{mcm}, @samp{gr5} and @samp{gr6}.
22869
22870 @samp{mcm} is a synonym of @samp{gr5} present for backward compatibility.
22871
22872 By default (unless configured otherwise), GCC generates code for the GR5
22873 variant of the Visium architecture.
22874
22875 With @option{-mcpu=gr6}, GCC generates code for the GR6 variant of the Visium
22876 architecture. The only difference from GR5 code is that the compiler will
22877 generate block move instructions.
22878
22879 @item -mtune=@var{cpu_type}
22880 @opindex mtune
22881 Set the instruction scheduling parameters for machine type @var{cpu_type},
22882 but do not set the instruction set or register set that the option
22883 @option{-mcpu=@var{cpu_type}} would.
22884
22885 @item -msv-mode
22886 @opindex msv-mode
22887 Generate code for the supervisor mode, where there are no restrictions on
22888 the access to general registers. This is the default.
22889
22890 @item -muser-mode
22891 @opindex muser-mode
22892 Generate code for the user mode, where the access to some general registers
22893 is forbidden: on the GR5, registers r24 to r31 cannot be accessed in this
22894 mode; on the GR6, only registers r29 to r31 are affected.
22895 @end table
22896
22897 @node VMS Options
22898 @subsection VMS Options
22899
22900 These @samp{-m} options are defined for the VMS implementations:
22901
22902 @table @gcctabopt
22903 @item -mvms-return-codes
22904 @opindex mvms-return-codes
22905 Return VMS condition codes from @code{main}. The default is to return POSIX-style
22906 condition (e.g.@ error) codes.
22907
22908 @item -mdebug-main=@var{prefix}
22909 @opindex mdebug-main=@var{prefix}
22910 Flag the first routine whose name starts with @var{prefix} as the main
22911 routine for the debugger.
22912
22913 @item -mmalloc64
22914 @opindex mmalloc64
22915 Default to 64-bit memory allocation routines.
22916
22917 @item -mpointer-size=@var{size}
22918 @opindex mpointer-size=@var{size}
22919 Set the default size of pointers. Possible options for @var{size} are
22920 @samp{32} or @samp{short} for 32 bit pointers, @samp{64} or @samp{long}
22921 for 64 bit pointers, and @samp{no} for supporting only 32 bit pointers.
22922 The later option disables @code{pragma pointer_size}.
22923 @end table
22924
22925 @node VxWorks Options
22926 @subsection VxWorks Options
22927 @cindex VxWorks Options
22928
22929 The options in this section are defined for all VxWorks targets.
22930 Options specific to the target hardware are listed with the other
22931 options for that target.
22932
22933 @table @gcctabopt
22934 @item -mrtp
22935 @opindex mrtp
22936 GCC can generate code for both VxWorks kernels and real time processes
22937 (RTPs). This option switches from the former to the latter. It also
22938 defines the preprocessor macro @code{__RTP__}.
22939
22940 @item -non-static
22941 @opindex non-static
22942 Link an RTP executable against shared libraries rather than static
22943 libraries. The options @option{-static} and @option{-shared} can
22944 also be used for RTPs (@pxref{Link Options}); @option{-static}
22945 is the default.
22946
22947 @item -Bstatic
22948 @itemx -Bdynamic
22949 @opindex Bstatic
22950 @opindex Bdynamic
22951 These options are passed down to the linker. They are defined for
22952 compatibility with Diab.
22953
22954 @item -Xbind-lazy
22955 @opindex Xbind-lazy
22956 Enable lazy binding of function calls. This option is equivalent to
22957 @option{-Wl,-z,now} and is defined for compatibility with Diab.
22958
22959 @item -Xbind-now
22960 @opindex Xbind-now
22961 Disable lazy binding of function calls. This option is the default and
22962 is defined for compatibility with Diab.
22963 @end table
22964
22965 @node x86 Options
22966 @subsection x86 Options
22967 @cindex x86 Options
22968
22969 These @samp{-m} options are defined for the x86 family of computers.
22970
22971 @table @gcctabopt
22972
22973 @item -march=@var{cpu-type}
22974 @opindex march
22975 Generate instructions for the machine type @var{cpu-type}. In contrast to
22976 @option{-mtune=@var{cpu-type}}, which merely tunes the generated code
22977 for the specified @var{cpu-type}, @option{-march=@var{cpu-type}} allows GCC
22978 to generate code that may not run at all on processors other than the one
22979 indicated. Specifying @option{-march=@var{cpu-type}} implies
22980 @option{-mtune=@var{cpu-type}}.
22981
22982 The choices for @var{cpu-type} are:
22983
22984 @table @samp
22985 @item native
22986 This selects the CPU to generate code for at compilation time by determining
22987 the processor type of the compiling machine. Using @option{-march=native}
22988 enables all instruction subsets supported by the local machine (hence
22989 the result might not run on different machines). Using @option{-mtune=native}
22990 produces code optimized for the local machine under the constraints
22991 of the selected instruction set.
22992
22993 @item i386
22994 Original Intel i386 CPU@.
22995
22996 @item i486
22997 Intel i486 CPU@. (No scheduling is implemented for this chip.)
22998
22999 @item i586
23000 @itemx pentium
23001 Intel Pentium CPU with no MMX support.
23002
23003 @item lakemont
23004 Intel Lakemont MCU, based on Intel Pentium CPU.
23005
23006 @item pentium-mmx
23007 Intel Pentium MMX CPU, based on Pentium core with MMX instruction set support.
23008
23009 @item pentiumpro
23010 Intel Pentium Pro CPU@.
23011
23012 @item i686
23013 When used with @option{-march}, the Pentium Pro
23014 instruction set is used, so the code runs on all i686 family chips.
23015 When used with @option{-mtune}, it has the same meaning as @samp{generic}.
23016
23017 @item pentium2
23018 Intel Pentium II CPU, based on Pentium Pro core with MMX instruction set
23019 support.
23020
23021 @item pentium3
23022 @itemx pentium3m
23023 Intel Pentium III CPU, based on Pentium Pro core with MMX and SSE instruction
23024 set support.
23025
23026 @item pentium-m
23027 Intel Pentium M; low-power version of Intel Pentium III CPU
23028 with MMX, SSE and SSE2 instruction set support. Used by Centrino notebooks.
23029
23030 @item pentium4
23031 @itemx pentium4m
23032 Intel Pentium 4 CPU with MMX, SSE and SSE2 instruction set support.
23033
23034 @item prescott
23035 Improved version of Intel Pentium 4 CPU with MMX, SSE, SSE2 and SSE3 instruction
23036 set support.
23037
23038 @item nocona
23039 Improved version of Intel Pentium 4 CPU with 64-bit extensions, MMX, SSE,
23040 SSE2 and SSE3 instruction set support.
23041
23042 @item core2
23043 Intel Core 2 CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3 and SSSE3
23044 instruction set support.
23045
23046 @item nehalem
23047 Intel Nehalem CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
23048 SSE4.1, SSE4.2 and POPCNT instruction set support.
23049
23050 @item westmere
23051 Intel Westmere CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
23052 SSE4.1, SSE4.2, POPCNT, AES and PCLMUL instruction set support.
23053
23054 @item sandybridge
23055 Intel Sandy Bridge CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
23056 SSE4.1, SSE4.2, POPCNT, AVX, AES and PCLMUL instruction set support.
23057
23058 @item ivybridge
23059 Intel Ivy Bridge CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
23060 SSE4.1, SSE4.2, POPCNT, AVX, AES, PCLMUL, FSGSBASE, RDRND and F16C
23061 instruction set support.
23062
23063 @item haswell
23064 Intel Haswell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
23065 SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
23066 BMI, BMI2 and F16C instruction set support.
23067
23068 @item broadwell
23069 Intel Broadwell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
23070 SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
23071 BMI, BMI2, F16C, RDSEED, ADCX and PREFETCHW instruction set support.
23072
23073 @item skylake
23074 Intel Skylake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
23075 SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
23076 BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC and
23077 XSAVES instruction set support.
23078
23079 @item bonnell
23080 Intel Bonnell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3 and SSSE3
23081 instruction set support.
23082
23083 @item silvermont
23084 Intel Silvermont CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
23085 SSE4.1, SSE4.2, POPCNT, AES, PCLMUL and RDRND instruction set support.
23086
23087 @item knl
23088 Intel Knight's Landing CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
23089 SSSE3, SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
23090 BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, AVX512F, AVX512PF, AVX512ER and
23091 AVX512CD instruction set support.
23092
23093 @item skylake-avx512
23094 Intel Skylake Server CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
23095 SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
23096 BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F,
23097 AVX512VL, AVX512BW, AVX512DQ and AVX512CD instruction set support.
23098
23099 @item k6
23100 AMD K6 CPU with MMX instruction set support.
23101
23102 @item k6-2
23103 @itemx k6-3
23104 Improved versions of AMD K6 CPU with MMX and 3DNow!@: instruction set support.
23105
23106 @item athlon
23107 @itemx athlon-tbird
23108 AMD Athlon CPU with MMX, 3dNOW!, enhanced 3DNow!@: and SSE prefetch instructions
23109 support.
23110
23111 @item athlon-4
23112 @itemx athlon-xp
23113 @itemx athlon-mp
23114 Improved AMD Athlon CPU with MMX, 3DNow!, enhanced 3DNow!@: and full SSE
23115 instruction set support.
23116
23117 @item k8
23118 @itemx opteron
23119 @itemx athlon64
23120 @itemx athlon-fx
23121 Processors based on the AMD K8 core with x86-64 instruction set support,
23122 including the AMD Opteron, Athlon 64, and Athlon 64 FX processors.
23123 (This supersets MMX, SSE, SSE2, 3DNow!, enhanced 3DNow!@: and 64-bit
23124 instruction set extensions.)
23125
23126 @item k8-sse3
23127 @itemx opteron-sse3
23128 @itemx athlon64-sse3
23129 Improved versions of AMD K8 cores with SSE3 instruction set support.
23130
23131 @item amdfam10
23132 @itemx barcelona
23133 CPUs based on AMD Family 10h cores with x86-64 instruction set support. (This
23134 supersets MMX, SSE, SSE2, SSE3, SSE4A, 3DNow!, enhanced 3DNow!, ABM and 64-bit
23135 instruction set extensions.)
23136
23137 @item bdver1
23138 CPUs based on AMD Family 15h cores with x86-64 instruction set support. (This
23139 supersets FMA4, AVX, XOP, LWP, AES, PCL_MUL, CX16, MMX, SSE, SSE2, SSE3, SSE4A,
23140 SSSE3, SSE4.1, SSE4.2, ABM and 64-bit instruction set extensions.)
23141 @item bdver2
23142 AMD Family 15h core based CPUs with x86-64 instruction set support. (This
23143 supersets BMI, TBM, F16C, FMA, FMA4, AVX, XOP, LWP, AES, PCL_MUL, CX16, MMX,
23144 SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM and 64-bit instruction set
23145 extensions.)
23146 @item bdver3
23147 AMD Family 15h core based CPUs with x86-64 instruction set support. (This
23148 supersets BMI, TBM, F16C, FMA, FMA4, FSGSBASE, AVX, XOP, LWP, AES,
23149 PCL_MUL, CX16, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM and
23150 64-bit instruction set extensions.
23151 @item bdver4
23152 AMD Family 15h core based CPUs with x86-64 instruction set support. (This
23153 supersets BMI, BMI2, TBM, F16C, FMA, FMA4, FSGSBASE, AVX, AVX2, XOP, LWP,
23154 AES, PCL_MUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1,
23155 SSE4.2, ABM and 64-bit instruction set extensions.
23156
23157 @item znver1
23158 AMD Family 17h core based CPUs with x86-64 instruction set support. (This
23159 supersets BMI, BMI2, F16C, FMA, FSGSBASE, AVX, AVX2, ADCX, RDSEED, MWAITX,
23160 SHA, CLZERO, AES, PCL_MUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3,
23161 SSE4.1, SSE4.2, ABM, XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, and 64-bit
23162 instruction set extensions.
23163
23164 @item btver1
23165 CPUs based on AMD Family 14h cores with x86-64 instruction set support. (This
23166 supersets MMX, SSE, SSE2, SSE3, SSSE3, SSE4A, CX16, ABM and 64-bit
23167 instruction set extensions.)
23168
23169 @item btver2
23170 CPUs based on AMD Family 16h cores with x86-64 instruction set support. This
23171 includes MOVBE, F16C, BMI, AVX, PCL_MUL, AES, SSE4.2, SSE4.1, CX16, ABM,
23172 SSE4A, SSSE3, SSE3, SSE2, SSE, MMX and 64-bit instruction set extensions.
23173
23174 @item winchip-c6
23175 IDT WinChip C6 CPU, dealt in same way as i486 with additional MMX instruction
23176 set support.
23177
23178 @item winchip2
23179 IDT WinChip 2 CPU, dealt in same way as i486 with additional MMX and 3DNow!@:
23180 instruction set support.
23181
23182 @item c3
23183 VIA C3 CPU with MMX and 3DNow!@: instruction set support. (No scheduling is
23184 implemented for this chip.)
23185
23186 @item c3-2
23187 VIA C3-2 (Nehemiah/C5XL) CPU with MMX and SSE instruction set support.
23188 (No scheduling is
23189 implemented for this chip.)
23190
23191 @item geode
23192 AMD Geode embedded processor with MMX and 3DNow!@: instruction set support.
23193 @end table
23194
23195 @item -mtune=@var{cpu-type}
23196 @opindex mtune
23197 Tune to @var{cpu-type} everything applicable about the generated code, except
23198 for the ABI and the set of available instructions.
23199 While picking a specific @var{cpu-type} schedules things appropriately
23200 for that particular chip, the compiler does not generate any code that
23201 cannot run on the default machine type unless you use a
23202 @option{-march=@var{cpu-type}} option.
23203 For example, if GCC is configured for i686-pc-linux-gnu
23204 then @option{-mtune=pentium4} generates code that is tuned for Pentium 4
23205 but still runs on i686 machines.
23206
23207 The choices for @var{cpu-type} are the same as for @option{-march}.
23208 In addition, @option{-mtune} supports 2 extra choices for @var{cpu-type}:
23209
23210 @table @samp
23211 @item generic
23212 Produce code optimized for the most common IA32/@/AMD64/@/EM64T processors.
23213 If you know the CPU on which your code will run, then you should use
23214 the corresponding @option{-mtune} or @option{-march} option instead of
23215 @option{-mtune=generic}. But, if you do not know exactly what CPU users
23216 of your application will have, then you should use this option.
23217
23218 As new processors are deployed in the marketplace, the behavior of this
23219 option will change. Therefore, if you upgrade to a newer version of
23220 GCC, code generation controlled by this option will change to reflect
23221 the processors
23222 that are most common at the time that version of GCC is released.
23223
23224 There is no @option{-march=generic} option because @option{-march}
23225 indicates the instruction set the compiler can use, and there is no
23226 generic instruction set applicable to all processors. In contrast,
23227 @option{-mtune} indicates the processor (or, in this case, collection of
23228 processors) for which the code is optimized.
23229
23230 @item intel
23231 Produce code optimized for the most current Intel processors, which are
23232 Haswell and Silvermont for this version of GCC. If you know the CPU
23233 on which your code will run, then you should use the corresponding
23234 @option{-mtune} or @option{-march} option instead of @option{-mtune=intel}.
23235 But, if you want your application performs better on both Haswell and
23236 Silvermont, then you should use this option.
23237
23238 As new Intel processors are deployed in the marketplace, the behavior of
23239 this option will change. Therefore, if you upgrade to a newer version of
23240 GCC, code generation controlled by this option will change to reflect
23241 the most current Intel processors at the time that version of GCC is
23242 released.
23243
23244 There is no @option{-march=intel} option because @option{-march} indicates
23245 the instruction set the compiler can use, and there is no common
23246 instruction set applicable to all processors. In contrast,
23247 @option{-mtune} indicates the processor (or, in this case, collection of
23248 processors) for which the code is optimized.
23249 @end table
23250
23251 @item -mcpu=@var{cpu-type}
23252 @opindex mcpu
23253 A deprecated synonym for @option{-mtune}.
23254
23255 @item -mfpmath=@var{unit}
23256 @opindex mfpmath
23257 Generate floating-point arithmetic for selected unit @var{unit}. The choices
23258 for @var{unit} are:
23259
23260 @table @samp
23261 @item 387
23262 Use the standard 387 floating-point coprocessor present on the majority of chips and
23263 emulated otherwise. Code compiled with this option runs almost everywhere.
23264 The temporary results are computed in 80-bit precision instead of the precision
23265 specified by the type, resulting in slightly different results compared to most
23266 of other chips. See @option{-ffloat-store} for more detailed description.
23267
23268 This is the default choice for x86-32 targets.
23269
23270 @item sse
23271 Use scalar floating-point instructions present in the SSE instruction set.
23272 This instruction set is supported by Pentium III and newer chips,
23273 and in the AMD line
23274 by Athlon-4, Athlon XP and Athlon MP chips. The earlier version of the SSE
23275 instruction set supports only single-precision arithmetic, thus the double and
23276 extended-precision arithmetic are still done using 387. A later version, present
23277 only in Pentium 4 and AMD x86-64 chips, supports double-precision
23278 arithmetic too.
23279
23280 For the x86-32 compiler, you must use @option{-march=@var{cpu-type}}, @option{-msse}
23281 or @option{-msse2} switches to enable SSE extensions and make this option
23282 effective. For the x86-64 compiler, these extensions are enabled by default.
23283
23284 The resulting code should be considerably faster in the majority of cases and avoid
23285 the numerical instability problems of 387 code, but may break some existing
23286 code that expects temporaries to be 80 bits.
23287
23288 This is the default choice for the x86-64 compiler.
23289
23290 @item sse,387
23291 @itemx sse+387
23292 @itemx both
23293 Attempt to utilize both instruction sets at once. This effectively doubles the
23294 amount of available registers, and on chips with separate execution units for
23295 387 and SSE the execution resources too. Use this option with care, as it is
23296 still experimental, because the GCC register allocator does not model separate
23297 functional units well, resulting in unstable performance.
23298 @end table
23299
23300 @item -masm=@var{dialect}
23301 @opindex masm=@var{dialect}
23302 Output assembly instructions using selected @var{dialect}. Also affects
23303 which dialect is used for basic @code{asm} (@pxref{Basic Asm}) and
23304 extended @code{asm} (@pxref{Extended Asm}). Supported choices (in dialect
23305 order) are @samp{att} or @samp{intel}. The default is @samp{att}. Darwin does
23306 not support @samp{intel}.
23307
23308 @item -mieee-fp
23309 @itemx -mno-ieee-fp
23310 @opindex mieee-fp
23311 @opindex mno-ieee-fp
23312 Control whether or not the compiler uses IEEE floating-point
23313 comparisons. These correctly handle the case where the result of a
23314 comparison is unordered.
23315
23316 @item -msoft-float
23317 @opindex msoft-float
23318 Generate output containing library calls for floating point.
23319
23320 @strong{Warning:} the requisite libraries are not part of GCC@.
23321 Normally the facilities of the machine's usual C compiler are used, but
23322 this can't be done directly in cross-compilation. You must make your
23323 own arrangements to provide suitable library functions for
23324 cross-compilation.
23325
23326 On machines where a function returns floating-point results in the 80387
23327 register stack, some floating-point opcodes may be emitted even if
23328 @option{-msoft-float} is used.
23329
23330 @item -mno-fp-ret-in-387
23331 @opindex mno-fp-ret-in-387
23332 Do not use the FPU registers for return values of functions.
23333
23334 The usual calling convention has functions return values of types
23335 @code{float} and @code{double} in an FPU register, even if there
23336 is no FPU@. The idea is that the operating system should emulate
23337 an FPU@.
23338
23339 The option @option{-mno-fp-ret-in-387} causes such values to be returned
23340 in ordinary CPU registers instead.
23341
23342 @item -mno-fancy-math-387
23343 @opindex mno-fancy-math-387
23344 Some 387 emulators do not support the @code{sin}, @code{cos} and
23345 @code{sqrt} instructions for the 387. Specify this option to avoid
23346 generating those instructions. This option is the default on
23347 OpenBSD and NetBSD@. This option is overridden when @option{-march}
23348 indicates that the target CPU always has an FPU and so the
23349 instruction does not need emulation. These
23350 instructions are not generated unless you also use the
23351 @option{-funsafe-math-optimizations} switch.
23352
23353 @item -malign-double
23354 @itemx -mno-align-double
23355 @opindex malign-double
23356 @opindex mno-align-double
23357 Control whether GCC aligns @code{double}, @code{long double}, and
23358 @code{long long} variables on a two-word boundary or a one-word
23359 boundary. Aligning @code{double} variables on a two-word boundary
23360 produces code that runs somewhat faster on a Pentium at the
23361 expense of more memory.
23362
23363 On x86-64, @option{-malign-double} is enabled by default.
23364
23365 @strong{Warning:} if you use the @option{-malign-double} switch,
23366 structures containing the above types are aligned differently than
23367 the published application binary interface specifications for the x86-32
23368 and are not binary compatible with structures in code compiled
23369 without that switch.
23370
23371 @item -m96bit-long-double
23372 @itemx -m128bit-long-double
23373 @opindex m96bit-long-double
23374 @opindex m128bit-long-double
23375 These switches control the size of @code{long double} type. The x86-32
23376 application binary interface specifies the size to be 96 bits,
23377 so @option{-m96bit-long-double} is the default in 32-bit mode.
23378
23379 Modern architectures (Pentium and newer) prefer @code{long double}
23380 to be aligned to an 8- or 16-byte boundary. In arrays or structures
23381 conforming to the ABI, this is not possible. So specifying
23382 @option{-m128bit-long-double} aligns @code{long double}
23383 to a 16-byte boundary by padding the @code{long double} with an additional
23384 32-bit zero.
23385
23386 In the x86-64 compiler, @option{-m128bit-long-double} is the default choice as
23387 its ABI specifies that @code{long double} is aligned on 16-byte boundary.
23388
23389 Notice that neither of these options enable any extra precision over the x87
23390 standard of 80 bits for a @code{long double}.
23391
23392 @strong{Warning:} if you override the default value for your target ABI, this
23393 changes the size of
23394 structures and arrays containing @code{long double} variables,
23395 as well as modifying the function calling convention for functions taking
23396 @code{long double}. Hence they are not binary-compatible
23397 with code compiled without that switch.
23398
23399 @item -mlong-double-64
23400 @itemx -mlong-double-80
23401 @itemx -mlong-double-128
23402 @opindex mlong-double-64
23403 @opindex mlong-double-80
23404 @opindex mlong-double-128
23405 These switches control the size of @code{long double} type. A size
23406 of 64 bits makes the @code{long double} type equivalent to the @code{double}
23407 type. This is the default for 32-bit Bionic C library. A size
23408 of 128 bits makes the @code{long double} type equivalent to the
23409 @code{__float128} type. This is the default for 64-bit Bionic C library.
23410
23411 @strong{Warning:} if you override the default value for your target ABI, this
23412 changes the size of
23413 structures and arrays containing @code{long double} variables,
23414 as well as modifying the function calling convention for functions taking
23415 @code{long double}. Hence they are not binary-compatible
23416 with code compiled without that switch.
23417
23418 @item -malign-data=@var{type}
23419 @opindex malign-data
23420 Control how GCC aligns variables. Supported values for @var{type} are
23421 @samp{compat} uses increased alignment value compatible uses GCC 4.8
23422 and earlier, @samp{abi} uses alignment value as specified by the
23423 psABI, and @samp{cacheline} uses increased alignment value to match
23424 the cache line size. @samp{compat} is the default.
23425
23426 @item -mlarge-data-threshold=@var{threshold}
23427 @opindex mlarge-data-threshold
23428 When @option{-mcmodel=medium} is specified, data objects larger than
23429 @var{threshold} are placed in the large data section. This value must be the
23430 same across all objects linked into the binary, and defaults to 65535.
23431
23432 @item -mrtd
23433 @opindex mrtd
23434 Use a different function-calling convention, in which functions that
23435 take a fixed number of arguments return with the @code{ret @var{num}}
23436 instruction, which pops their arguments while returning. This saves one
23437 instruction in the caller since there is no need to pop the arguments
23438 there.
23439
23440 You can specify that an individual function is called with this calling
23441 sequence with the function attribute @code{stdcall}. You can also
23442 override the @option{-mrtd} option by using the function attribute
23443 @code{cdecl}. @xref{Function Attributes}.
23444
23445 @strong{Warning:} this calling convention is incompatible with the one
23446 normally used on Unix, so you cannot use it if you need to call
23447 libraries compiled with the Unix compiler.
23448
23449 Also, you must provide function prototypes for all functions that
23450 take variable numbers of arguments (including @code{printf});
23451 otherwise incorrect code is generated for calls to those
23452 functions.
23453
23454 In addition, seriously incorrect code results if you call a
23455 function with too many arguments. (Normally, extra arguments are
23456 harmlessly ignored.)
23457
23458 @item -mregparm=@var{num}
23459 @opindex mregparm
23460 Control how many registers are used to pass integer arguments. By
23461 default, no registers are used to pass arguments, and at most 3
23462 registers can be used. You can control this behavior for a specific
23463 function by using the function attribute @code{regparm}.
23464 @xref{Function Attributes}.
23465
23466 @strong{Warning:} if you use this switch, and
23467 @var{num} is nonzero, then you must build all modules with the same
23468 value, including any libraries. This includes the system libraries and
23469 startup modules.
23470
23471 @item -msseregparm
23472 @opindex msseregparm
23473 Use SSE register passing conventions for float and double arguments
23474 and return values. You can control this behavior for a specific
23475 function by using the function attribute @code{sseregparm}.
23476 @xref{Function Attributes}.
23477
23478 @strong{Warning:} if you use this switch then you must build all
23479 modules with the same value, including any libraries. This includes
23480 the system libraries and startup modules.
23481
23482 @item -mvect8-ret-in-mem
23483 @opindex mvect8-ret-in-mem
23484 Return 8-byte vectors in memory instead of MMX registers. This is the
23485 default on Solaris@tie{}8 and 9 and VxWorks to match the ABI of the Sun
23486 Studio compilers until version 12. Later compiler versions (starting
23487 with Studio 12 Update@tie{}1) follow the ABI used by other x86 targets, which
23488 is the default on Solaris@tie{}10 and later. @emph{Only} use this option if
23489 you need to remain compatible with existing code produced by those
23490 previous compiler versions or older versions of GCC@.
23491
23492 @item -mpc32
23493 @itemx -mpc64
23494 @itemx -mpc80
23495 @opindex mpc32
23496 @opindex mpc64
23497 @opindex mpc80
23498
23499 Set 80387 floating-point precision to 32, 64 or 80 bits. When @option{-mpc32}
23500 is specified, the significands of results of floating-point operations are
23501 rounded to 24 bits (single precision); @option{-mpc64} rounds the
23502 significands of results of floating-point operations to 53 bits (double
23503 precision) and @option{-mpc80} rounds the significands of results of
23504 floating-point operations to 64 bits (extended double precision), which is
23505 the default. When this option is used, floating-point operations in higher
23506 precisions are not available to the programmer without setting the FPU
23507 control word explicitly.
23508
23509 Setting the rounding of floating-point operations to less than the default
23510 80 bits can speed some programs by 2% or more. Note that some mathematical
23511 libraries assume that extended-precision (80-bit) floating-point operations
23512 are enabled by default; routines in such libraries could suffer significant
23513 loss of accuracy, typically through so-called ``catastrophic cancellation'',
23514 when this option is used to set the precision to less than extended precision.
23515
23516 @item -mstackrealign
23517 @opindex mstackrealign
23518 Realign the stack at entry. On the x86, the @option{-mstackrealign}
23519 option generates an alternate prologue and epilogue that realigns the
23520 run-time stack if necessary. This supports mixing legacy codes that keep
23521 4-byte stack alignment with modern codes that keep 16-byte stack alignment for
23522 SSE compatibility. See also the attribute @code{force_align_arg_pointer},
23523 applicable to individual functions.
23524
23525 @item -mpreferred-stack-boundary=@var{num}
23526 @opindex mpreferred-stack-boundary
23527 Attempt to keep the stack boundary aligned to a 2 raised to @var{num}
23528 byte boundary. If @option{-mpreferred-stack-boundary} is not specified,
23529 the default is 4 (16 bytes or 128 bits).
23530
23531 @strong{Warning:} When generating code for the x86-64 architecture with
23532 SSE extensions disabled, @option{-mpreferred-stack-boundary=3} can be
23533 used to keep the stack boundary aligned to 8 byte boundary. Since
23534 x86-64 ABI require 16 byte stack alignment, this is ABI incompatible and
23535 intended to be used in controlled environment where stack space is
23536 important limitation. This option leads to wrong code when functions
23537 compiled with 16 byte stack alignment (such as functions from a standard
23538 library) are called with misaligned stack. In this case, SSE
23539 instructions may lead to misaligned memory access traps. In addition,
23540 variable arguments are handled incorrectly for 16 byte aligned
23541 objects (including x87 long double and __int128), leading to wrong
23542 results. You must build all modules with
23543 @option{-mpreferred-stack-boundary=3}, including any libraries. This
23544 includes the system libraries and startup modules.
23545
23546 @item -mincoming-stack-boundary=@var{num}
23547 @opindex mincoming-stack-boundary
23548 Assume the incoming stack is aligned to a 2 raised to @var{num} byte
23549 boundary. If @option{-mincoming-stack-boundary} is not specified,
23550 the one specified by @option{-mpreferred-stack-boundary} is used.
23551
23552 On Pentium and Pentium Pro, @code{double} and @code{long double} values
23553 should be aligned to an 8-byte boundary (see @option{-malign-double}) or
23554 suffer significant run time performance penalties. On Pentium III, the
23555 Streaming SIMD Extension (SSE) data type @code{__m128} may not work
23556 properly if it is not 16-byte aligned.
23557
23558 To ensure proper alignment of this values on the stack, the stack boundary
23559 must be as aligned as that required by any value stored on the stack.
23560 Further, every function must be generated such that it keeps the stack
23561 aligned. Thus calling a function compiled with a higher preferred
23562 stack boundary from a function compiled with a lower preferred stack
23563 boundary most likely misaligns the stack. It is recommended that
23564 libraries that use callbacks always use the default setting.
23565
23566 This extra alignment does consume extra stack space, and generally
23567 increases code size. Code that is sensitive to stack space usage, such
23568 as embedded systems and operating system kernels, may want to reduce the
23569 preferred alignment to @option{-mpreferred-stack-boundary=2}.
23570
23571 @need 200
23572 @item -mmmx
23573 @opindex mmmx
23574 @need 200
23575 @itemx -msse
23576 @opindex msse
23577 @need 200
23578 @itemx -msse2
23579 @opindex msse2
23580 @need 200
23581 @itemx -msse3
23582 @opindex msse3
23583 @need 200
23584 @itemx -mssse3
23585 @opindex mssse3
23586 @need 200
23587 @itemx -msse4
23588 @opindex msse4
23589 @need 200
23590 @itemx -msse4a
23591 @opindex msse4a
23592 @need 200
23593 @itemx -msse4.1
23594 @opindex msse4.1
23595 @need 200
23596 @itemx -msse4.2
23597 @opindex msse4.2
23598 @need 200
23599 @itemx -mavx
23600 @opindex mavx
23601 @need 200
23602 @itemx -mavx2
23603 @opindex mavx2
23604 @need 200
23605 @itemx -mavx512f
23606 @opindex mavx512f
23607 @need 200
23608 @itemx -mavx512pf
23609 @opindex mavx512pf
23610 @need 200
23611 @itemx -mavx512er
23612 @opindex mavx512er
23613 @need 200
23614 @itemx -mavx512cd
23615 @opindex mavx512cd
23616 @need 200
23617 @itemx -mavx512vl
23618 @opindex mavx512vl
23619 @need 200
23620 @itemx -mavx512bw
23621 @opindex mavx512bw
23622 @need 200
23623 @itemx -mavx512dq
23624 @opindex mavx512dq
23625 @need 200
23626 @itemx -mavx512ifma
23627 @opindex mavx512ifma
23628 @need 200
23629 @itemx -mavx512vbmi
23630 @opindex mavx512vbmi
23631 @need 200
23632 @itemx -msha
23633 @opindex msha
23634 @need 200
23635 @itemx -maes
23636 @opindex maes
23637 @need 200
23638 @itemx -mpclmul
23639 @opindex mpclmul
23640 @need 200
23641 @itemx -mclfushopt
23642 @opindex mclfushopt
23643 @need 200
23644 @itemx -mfsgsbase
23645 @opindex mfsgsbase
23646 @need 200
23647 @itemx -mrdrnd
23648 @opindex mrdrnd
23649 @need 200
23650 @itemx -mf16c
23651 @opindex mf16c
23652 @need 200
23653 @itemx -mfma
23654 @opindex mfma
23655 @need 200
23656 @itemx -mfma4
23657 @opindex mfma4
23658 @need 200
23659 @itemx -mprefetchwt1
23660 @opindex mprefetchwt1
23661 @need 200
23662 @itemx -mxop
23663 @opindex mxop
23664 @need 200
23665 @itemx -mlwp
23666 @opindex mlwp
23667 @need 200
23668 @itemx -m3dnow
23669 @opindex m3dnow
23670 @need 200
23671 @itemx -mpopcnt
23672 @opindex mpopcnt
23673 @need 200
23674 @itemx -mabm
23675 @opindex mabm
23676 @need 200
23677 @itemx -mbmi
23678 @opindex mbmi
23679 @need 200
23680 @itemx -mbmi2
23681 @need 200
23682 @itemx -mlzcnt
23683 @opindex mlzcnt
23684 @need 200
23685 @itemx -mfxsr
23686 @opindex mfxsr
23687 @need 200
23688 @itemx -mxsave
23689 @opindex mxsave
23690 @need 200
23691 @itemx -mxsaveopt
23692 @opindex mxsaveopt
23693 @need 200
23694 @itemx -mxsavec
23695 @opindex mxsavec
23696 @need 200
23697 @itemx -mxsaves
23698 @opindex mxsaves
23699 @need 200
23700 @itemx -mrtm
23701 @opindex mrtm
23702 @need 200
23703 @itemx -mtbm
23704 @opindex mtbm
23705 @need 200
23706 @itemx -mmpx
23707 @opindex mmpx
23708 @need 200
23709 @itemx -mmwaitx
23710 @opindex mmwaitx
23711 @need 200
23712 @itemx -mclzero
23713 @opindex mclzero
23714 @itemx -mpku
23715 @opindex mpku
23716 These switches enable the use of instructions in the MMX, SSE,
23717 SSE2, SSE3, SSSE3, SSE4.1, AVX, AVX2, AVX512F, AVX512PF, AVX512ER, AVX512CD,
23718 SHA, AES, PCLMUL, FSGSBASE, RDRND, F16C, FMA, SSE4A, FMA4, XOP, LWP, ABM,
23719 AVX512VL, AVX512BW, AVX512DQ, AVX512IFMA AVX512VBMI, BMI, BMI2, FXSR,
23720 XSAVE, XSAVEOPT, LZCNT, RTM, MPX, MWAITX, PKU or 3DNow!@:
23721 extended instruction sets. Each has a corresponding @option{-mno-} option
23722 to disable use of these instructions.
23723
23724 These extensions are also available as built-in functions: see
23725 @ref{x86 Built-in Functions}, for details of the functions enabled and
23726 disabled by these switches.
23727
23728 To generate SSE/SSE2 instructions automatically from floating-point
23729 code (as opposed to 387 instructions), see @option{-mfpmath=sse}.
23730
23731 GCC depresses SSEx instructions when @option{-mavx} is used. Instead, it
23732 generates new AVX instructions or AVX equivalence for all SSEx instructions
23733 when needed.
23734
23735 These options enable GCC to use these extended instructions in
23736 generated code, even without @option{-mfpmath=sse}. Applications that
23737 perform run-time CPU detection must compile separate files for each
23738 supported architecture, using the appropriate flags. In particular,
23739 the file containing the CPU detection code should be compiled without
23740 these options.
23741
23742 @item -mdump-tune-features
23743 @opindex mdump-tune-features
23744 This option instructs GCC to dump the names of the x86 performance
23745 tuning features and default settings. The names can be used in
23746 @option{-mtune-ctrl=@var{feature-list}}.
23747
23748 @item -mtune-ctrl=@var{feature-list}
23749 @opindex mtune-ctrl=@var{feature-list}
23750 This option is used to do fine grain control of x86 code generation features.
23751 @var{feature-list} is a comma separated list of @var{feature} names. See also
23752 @option{-mdump-tune-features}. When specified, the @var{feature} is turned
23753 on if it is not preceded with @samp{^}, otherwise, it is turned off.
23754 @option{-mtune-ctrl=@var{feature-list}} is intended to be used by GCC
23755 developers. Using it may lead to code paths not covered by testing and can
23756 potentially result in compiler ICEs or runtime errors.
23757
23758 @item -mno-default
23759 @opindex mno-default
23760 This option instructs GCC to turn off all tunable features. See also
23761 @option{-mtune-ctrl=@var{feature-list}} and @option{-mdump-tune-features}.
23762
23763 @item -mcld
23764 @opindex mcld
23765 This option instructs GCC to emit a @code{cld} instruction in the prologue
23766 of functions that use string instructions. String instructions depend on
23767 the DF flag to select between autoincrement or autodecrement mode. While the
23768 ABI specifies the DF flag to be cleared on function entry, some operating
23769 systems violate this specification by not clearing the DF flag in their
23770 exception dispatchers. The exception handler can be invoked with the DF flag
23771 set, which leads to wrong direction mode when string instructions are used.
23772 This option can be enabled by default on 32-bit x86 targets by configuring
23773 GCC with the @option{--enable-cld} configure option. Generation of @code{cld}
23774 instructions can be suppressed with the @option{-mno-cld} compiler option
23775 in this case.
23776
23777 @item -mvzeroupper
23778 @opindex mvzeroupper
23779 This option instructs GCC to emit a @code{vzeroupper} instruction
23780 before a transfer of control flow out of the function to minimize
23781 the AVX to SSE transition penalty as well as remove unnecessary @code{zeroupper}
23782 intrinsics.
23783
23784 @item -mprefer-avx128
23785 @opindex mprefer-avx128
23786 This option instructs GCC to use 128-bit AVX instructions instead of
23787 256-bit AVX instructions in the auto-vectorizer.
23788
23789 @item -mcx16
23790 @opindex mcx16
23791 This option enables GCC to generate @code{CMPXCHG16B} instructions.
23792 @code{CMPXCHG16B} allows for atomic operations on 128-bit double quadword
23793 (or oword) data types.
23794 This is useful for high-resolution counters that can be updated
23795 by multiple processors (or cores). This instruction is generated as part of
23796 atomic built-in functions: see @ref{__sync Builtins} or
23797 @ref{__atomic Builtins} for details.
23798
23799 @item -msahf
23800 @opindex msahf
23801 This option enables generation of @code{SAHF} instructions in 64-bit code.
23802 Early Intel Pentium 4 CPUs with Intel 64 support,
23803 prior to the introduction of Pentium 4 G1 step in December 2005,
23804 lacked the @code{LAHF} and @code{SAHF} instructions
23805 which are supported by AMD64.
23806 These are load and store instructions, respectively, for certain status flags.
23807 In 64-bit mode, the @code{SAHF} instruction is used to optimize @code{fmod},
23808 @code{drem}, and @code{remainder} built-in functions;
23809 see @ref{Other Builtins} for details.
23810
23811 @item -mmovbe
23812 @opindex mmovbe
23813 This option enables use of the @code{movbe} instruction to implement
23814 @code{__builtin_bswap32} and @code{__builtin_bswap64}.
23815
23816 @item -mcrc32
23817 @opindex mcrc32
23818 This option enables built-in functions @code{__builtin_ia32_crc32qi},
23819 @code{__builtin_ia32_crc32hi}, @code{__builtin_ia32_crc32si} and
23820 @code{__builtin_ia32_crc32di} to generate the @code{crc32} machine instruction.
23821
23822 @item -mrecip
23823 @opindex mrecip
23824 This option enables use of @code{RCPSS} and @code{RSQRTSS} instructions
23825 (and their vectorized variants @code{RCPPS} and @code{RSQRTPS})
23826 with an additional Newton-Raphson step
23827 to increase precision instead of @code{DIVSS} and @code{SQRTSS}
23828 (and their vectorized
23829 variants) for single-precision floating-point arguments. These instructions
23830 are generated only when @option{-funsafe-math-optimizations} is enabled
23831 together with @option{-ffinite-math-only} and @option{-fno-trapping-math}.
23832 Note that while the throughput of the sequence is higher than the throughput
23833 of the non-reciprocal instruction, the precision of the sequence can be
23834 decreased by up to 2 ulp (i.e. the inverse of 1.0 equals 0.99999994).
23835
23836 Note that GCC implements @code{1.0f/sqrtf(@var{x})} in terms of @code{RSQRTSS}
23837 (or @code{RSQRTPS}) already with @option{-ffast-math} (or the above option
23838 combination), and doesn't need @option{-mrecip}.
23839
23840 Also note that GCC emits the above sequence with additional Newton-Raphson step
23841 for vectorized single-float division and vectorized @code{sqrtf(@var{x})}
23842 already with @option{-ffast-math} (or the above option combination), and
23843 doesn't need @option{-mrecip}.
23844
23845 @item -mrecip=@var{opt}
23846 @opindex mrecip=opt
23847 This option controls which reciprocal estimate instructions
23848 may be used. @var{opt} is a comma-separated list of options, which may
23849 be preceded by a @samp{!} to invert the option:
23850
23851 @table @samp
23852 @item all
23853 Enable all estimate instructions.
23854
23855 @item default
23856 Enable the default instructions, equivalent to @option{-mrecip}.
23857
23858 @item none
23859 Disable all estimate instructions, equivalent to @option{-mno-recip}.
23860
23861 @item div
23862 Enable the approximation for scalar division.
23863
23864 @item vec-div
23865 Enable the approximation for vectorized division.
23866
23867 @item sqrt
23868 Enable the approximation for scalar square root.
23869
23870 @item vec-sqrt
23871 Enable the approximation for vectorized square root.
23872 @end table
23873
23874 So, for example, @option{-mrecip=all,!sqrt} enables
23875 all of the reciprocal approximations, except for square root.
23876
23877 @item -mveclibabi=@var{type}
23878 @opindex mveclibabi
23879 Specifies the ABI type to use for vectorizing intrinsics using an
23880 external library. Supported values for @var{type} are @samp{svml}
23881 for the Intel short
23882 vector math library and @samp{acml} for the AMD math core library.
23883 To use this option, both @option{-ftree-vectorize} and
23884 @option{-funsafe-math-optimizations} have to be enabled, and an SVML or ACML
23885 ABI-compatible library must be specified at link time.
23886
23887 GCC currently emits calls to @code{vmldExp2},
23888 @code{vmldLn2}, @code{vmldLog102}, @code{vmldLog102}, @code{vmldPow2},
23889 @code{vmldTanh2}, @code{vmldTan2}, @code{vmldAtan2}, @code{vmldAtanh2},
23890 @code{vmldCbrt2}, @code{vmldSinh2}, @code{vmldSin2}, @code{vmldAsinh2},
23891 @code{vmldAsin2}, @code{vmldCosh2}, @code{vmldCos2}, @code{vmldAcosh2},
23892 @code{vmldAcos2}, @code{vmlsExp4}, @code{vmlsLn4}, @code{vmlsLog104},
23893 @code{vmlsLog104}, @code{vmlsPow4}, @code{vmlsTanh4}, @code{vmlsTan4},
23894 @code{vmlsAtan4}, @code{vmlsAtanh4}, @code{vmlsCbrt4}, @code{vmlsSinh4},
23895 @code{vmlsSin4}, @code{vmlsAsinh4}, @code{vmlsAsin4}, @code{vmlsCosh4},
23896 @code{vmlsCos4}, @code{vmlsAcosh4} and @code{vmlsAcos4} for corresponding
23897 function type when @option{-mveclibabi=svml} is used, and @code{__vrd2_sin},
23898 @code{__vrd2_cos}, @code{__vrd2_exp}, @code{__vrd2_log}, @code{__vrd2_log2},
23899 @code{__vrd2_log10}, @code{__vrs4_sinf}, @code{__vrs4_cosf},
23900 @code{__vrs4_expf}, @code{__vrs4_logf}, @code{__vrs4_log2f},
23901 @code{__vrs4_log10f} and @code{__vrs4_powf} for the corresponding function type
23902 when @option{-mveclibabi=acml} is used.
23903
23904 @item -mabi=@var{name}
23905 @opindex mabi
23906 Generate code for the specified calling convention. Permissible values
23907 are @samp{sysv} for the ABI used on GNU/Linux and other systems, and
23908 @samp{ms} for the Microsoft ABI. The default is to use the Microsoft
23909 ABI when targeting Microsoft Windows and the SysV ABI on all other systems.
23910 You can control this behavior for specific functions by
23911 using the function attributes @code{ms_abi} and @code{sysv_abi}.
23912 @xref{Function Attributes}.
23913
23914 @item -mtls-dialect=@var{type}
23915 @opindex mtls-dialect
23916 Generate code to access thread-local storage using the @samp{gnu} or
23917 @samp{gnu2} conventions. @samp{gnu} is the conservative default;
23918 @samp{gnu2} is more efficient, but it may add compile- and run-time
23919 requirements that cannot be satisfied on all systems.
23920
23921 @item -mpush-args
23922 @itemx -mno-push-args
23923 @opindex mpush-args
23924 @opindex mno-push-args
23925 Use PUSH operations to store outgoing parameters. This method is shorter
23926 and usually equally fast as method using SUB/MOV operations and is enabled
23927 by default. In some cases disabling it may improve performance because of
23928 improved scheduling and reduced dependencies.
23929
23930 @item -maccumulate-outgoing-args
23931 @opindex maccumulate-outgoing-args
23932 If enabled, the maximum amount of space required for outgoing arguments is
23933 computed in the function prologue. This is faster on most modern CPUs
23934 because of reduced dependencies, improved scheduling and reduced stack usage
23935 when the preferred stack boundary is not equal to 2. The drawback is a notable
23936 increase in code size. This switch implies @option{-mno-push-args}.
23937
23938 @item -mthreads
23939 @opindex mthreads
23940 Support thread-safe exception handling on MinGW. Programs that rely
23941 on thread-safe exception handling must compile and link all code with the
23942 @option{-mthreads} option. When compiling, @option{-mthreads} defines
23943 @option{-D_MT}; when linking, it links in a special thread helper library
23944 @option{-lmingwthrd} which cleans up per-thread exception-handling data.
23945
23946 @item -mms-bitfields
23947 @itemx -mno-ms-bitfields
23948 @opindex mms-bitfields
23949 @opindex mno-ms-bitfields
23950
23951 Enable/disable bit-field layout compatible with the native Microsoft
23952 Windows compiler.
23953
23954 If @code{packed} is used on a structure, or if bit-fields are used,
23955 it may be that the Microsoft ABI lays out the structure differently
23956 than the way GCC normally does. Particularly when moving packed
23957 data between functions compiled with GCC and the native Microsoft compiler
23958 (either via function call or as data in a file), it may be necessary to access
23959 either format.
23960
23961 This option is enabled by default for Microsoft Windows
23962 targets. This behavior can also be controlled locally by use of variable
23963 or type attributes. For more information, see @ref{x86 Variable Attributes}
23964 and @ref{x86 Type Attributes}.
23965
23966 The Microsoft structure layout algorithm is fairly simple with the exception
23967 of the bit-field packing.
23968 The padding and alignment of members of structures and whether a bit-field
23969 can straddle a storage-unit boundary are determine by these rules:
23970
23971 @enumerate
23972 @item Structure members are stored sequentially in the order in which they are
23973 declared: the first member has the lowest memory address and the last member
23974 the highest.
23975
23976 @item Every data object has an alignment requirement. The alignment requirement
23977 for all data except structures, unions, and arrays is either the size of the
23978 object or the current packing size (specified with either the
23979 @code{aligned} attribute or the @code{pack} pragma),
23980 whichever is less. For structures, unions, and arrays,
23981 the alignment requirement is the largest alignment requirement of its members.
23982 Every object is allocated an offset so that:
23983
23984 @smallexample
23985 offset % alignment_requirement == 0
23986 @end smallexample
23987
23988 @item Adjacent bit-fields are packed into the same 1-, 2-, or 4-byte allocation
23989 unit if the integral types are the same size and if the next bit-field fits
23990 into the current allocation unit without crossing the boundary imposed by the
23991 common alignment requirements of the bit-fields.
23992 @end enumerate
23993
23994 MSVC interprets zero-length bit-fields in the following ways:
23995
23996 @enumerate
23997 @item If a zero-length bit-field is inserted between two bit-fields that
23998 are normally coalesced, the bit-fields are not coalesced.
23999
24000 For example:
24001
24002 @smallexample
24003 struct
24004 @{
24005 unsigned long bf_1 : 12;
24006 unsigned long : 0;
24007 unsigned long bf_2 : 12;
24008 @} t1;
24009 @end smallexample
24010
24011 @noindent
24012 The size of @code{t1} is 8 bytes with the zero-length bit-field. If the
24013 zero-length bit-field were removed, @code{t1}'s size would be 4 bytes.
24014
24015 @item If a zero-length bit-field is inserted after a bit-field, @code{foo}, and the
24016 alignment of the zero-length bit-field is greater than the member that follows it,
24017 @code{bar}, @code{bar} is aligned as the type of the zero-length bit-field.
24018
24019 For example:
24020
24021 @smallexample
24022 struct
24023 @{
24024 char foo : 4;
24025 short : 0;
24026 char bar;
24027 @} t2;
24028
24029 struct
24030 @{
24031 char foo : 4;
24032 short : 0;
24033 double bar;
24034 @} t3;
24035 @end smallexample
24036
24037 @noindent
24038 For @code{t2}, @code{bar} is placed at offset 2, rather than offset 1.
24039 Accordingly, the size of @code{t2} is 4. For @code{t3}, the zero-length
24040 bit-field does not affect the alignment of @code{bar} or, as a result, the size
24041 of the structure.
24042
24043 Taking this into account, it is important to note the following:
24044
24045 @enumerate
24046 @item If a zero-length bit-field follows a normal bit-field, the type of the
24047 zero-length bit-field may affect the alignment of the structure as whole. For
24048 example, @code{t2} has a size of 4 bytes, since the zero-length bit-field follows a
24049 normal bit-field, and is of type short.
24050
24051 @item Even if a zero-length bit-field is not followed by a normal bit-field, it may
24052 still affect the alignment of the structure:
24053
24054 @smallexample
24055 struct
24056 @{
24057 char foo : 6;
24058 long : 0;
24059 @} t4;
24060 @end smallexample
24061
24062 @noindent
24063 Here, @code{t4} takes up 4 bytes.
24064 @end enumerate
24065
24066 @item Zero-length bit-fields following non-bit-field members are ignored:
24067
24068 @smallexample
24069 struct
24070 @{
24071 char foo;
24072 long : 0;
24073 char bar;
24074 @} t5;
24075 @end smallexample
24076
24077 @noindent
24078 Here, @code{t5} takes up 2 bytes.
24079 @end enumerate
24080
24081
24082 @item -mno-align-stringops
24083 @opindex mno-align-stringops
24084 Do not align the destination of inlined string operations. This switch reduces
24085 code size and improves performance in case the destination is already aligned,
24086 but GCC doesn't know about it.
24087
24088 @item -minline-all-stringops
24089 @opindex minline-all-stringops
24090 By default GCC inlines string operations only when the destination is
24091 known to be aligned to least a 4-byte boundary.
24092 This enables more inlining and increases code
24093 size, but may improve performance of code that depends on fast
24094 @code{memcpy}, @code{strlen},
24095 and @code{memset} for short lengths.
24096
24097 @item -minline-stringops-dynamically
24098 @opindex minline-stringops-dynamically
24099 For string operations of unknown size, use run-time checks with
24100 inline code for small blocks and a library call for large blocks.
24101
24102 @item -mstringop-strategy=@var{alg}
24103 @opindex mstringop-strategy=@var{alg}
24104 Override the internal decision heuristic for the particular algorithm to use
24105 for inlining string operations. The allowed values for @var{alg} are:
24106
24107 @table @samp
24108 @item rep_byte
24109 @itemx rep_4byte
24110 @itemx rep_8byte
24111 Expand using i386 @code{rep} prefix of the specified size.
24112
24113 @item byte_loop
24114 @itemx loop
24115 @itemx unrolled_loop
24116 Expand into an inline loop.
24117
24118 @item libcall
24119 Always use a library call.
24120 @end table
24121
24122 @item -mmemcpy-strategy=@var{strategy}
24123 @opindex mmemcpy-strategy=@var{strategy}
24124 Override the internal decision heuristic to decide if @code{__builtin_memcpy}
24125 should be inlined and what inline algorithm to use when the expected size
24126 of the copy operation is known. @var{strategy}
24127 is a comma-separated list of @var{alg}:@var{max_size}:@var{dest_align} triplets.
24128 @var{alg} is specified in @option{-mstringop-strategy}, @var{max_size} specifies
24129 the max byte size with which inline algorithm @var{alg} is allowed. For the last
24130 triplet, the @var{max_size} must be @code{-1}. The @var{max_size} of the triplets
24131 in the list must be specified in increasing order. The minimal byte size for
24132 @var{alg} is @code{0} for the first triplet and @code{@var{max_size} + 1} of the
24133 preceding range.
24134
24135 @item -mmemset-strategy=@var{strategy}
24136 @opindex mmemset-strategy=@var{strategy}
24137 The option is similar to @option{-mmemcpy-strategy=} except that it is to control
24138 @code{__builtin_memset} expansion.
24139
24140 @item -momit-leaf-frame-pointer
24141 @opindex momit-leaf-frame-pointer
24142 Don't keep the frame pointer in a register for leaf functions. This
24143 avoids the instructions to save, set up, and restore frame pointers and
24144 makes an extra register available in leaf functions. The option
24145 @option{-fomit-leaf-frame-pointer} removes the frame pointer for leaf functions,
24146 which might make debugging harder.
24147
24148 @item -mtls-direct-seg-refs
24149 @itemx -mno-tls-direct-seg-refs
24150 @opindex mtls-direct-seg-refs
24151 Controls whether TLS variables may be accessed with offsets from the
24152 TLS segment register (@code{%gs} for 32-bit, @code{%fs} for 64-bit),
24153 or whether the thread base pointer must be added. Whether or not this
24154 is valid depends on the operating system, and whether it maps the
24155 segment to cover the entire TLS area.
24156
24157 For systems that use the GNU C Library, the default is on.
24158
24159 @item -msse2avx
24160 @itemx -mno-sse2avx
24161 @opindex msse2avx
24162 Specify that the assembler should encode SSE instructions with VEX
24163 prefix. The option @option{-mavx} turns this on by default.
24164
24165 @item -mfentry
24166 @itemx -mno-fentry
24167 @opindex mfentry
24168 If profiling is active (@option{-pg}), put the profiling
24169 counter call before the prologue.
24170 Note: On x86 architectures the attribute @code{ms_hook_prologue}
24171 isn't possible at the moment for @option{-mfentry} and @option{-pg}.
24172
24173 @item -mrecord-mcount
24174 @itemx -mno-record-mcount
24175 @opindex mrecord-mcount
24176 If profiling is active (@option{-pg}), generate a __mcount_loc section
24177 that contains pointers to each profiling call. This is useful for
24178 automatically patching and out calls.
24179
24180 @item -mnop-mcount
24181 @itemx -mno-nop-mcount
24182 @opindex mnop-mcount
24183 If profiling is active (@option{-pg}), generate the calls to
24184 the profiling functions as nops. This is useful when they
24185 should be patched in later dynamically. This is likely only
24186 useful together with @option{-mrecord-mcount}.
24187
24188 @item -mskip-rax-setup
24189 @itemx -mno-skip-rax-setup
24190 @opindex mskip-rax-setup
24191 When generating code for the x86-64 architecture with SSE extensions
24192 disabled, @option{-mskip-rax-setup} can be used to skip setting up RAX
24193 register when there are no variable arguments passed in vector registers.
24194
24195 @strong{Warning:} Since RAX register is used to avoid unnecessarily
24196 saving vector registers on stack when passing variable arguments, the
24197 impacts of this option are callees may waste some stack space,
24198 misbehave or jump to a random location. GCC 4.4 or newer don't have
24199 those issues, regardless the RAX register value.
24200
24201 @item -m8bit-idiv
24202 @itemx -mno-8bit-idiv
24203 @opindex m8bit-idiv
24204 On some processors, like Intel Atom, 8-bit unsigned integer divide is
24205 much faster than 32-bit/64-bit integer divide. This option generates a
24206 run-time check. If both dividend and divisor are within range of 0
24207 to 255, 8-bit unsigned integer divide is used instead of
24208 32-bit/64-bit integer divide.
24209
24210 @item -mavx256-split-unaligned-load
24211 @itemx -mavx256-split-unaligned-store
24212 @opindex mavx256-split-unaligned-load
24213 @opindex mavx256-split-unaligned-store
24214 Split 32-byte AVX unaligned load and store.
24215
24216 @item -mstack-protector-guard=@var{guard}
24217 @opindex mstack-protector-guard=@var{guard}
24218 Generate stack protection code using canary at @var{guard}. Supported
24219 locations are @samp{global} for global canary or @samp{tls} for per-thread
24220 canary in the TLS block (the default). This option has effect only when
24221 @option{-fstack-protector} or @option{-fstack-protector-all} is specified.
24222
24223 @item -mmitigate-rop
24224 @opindex mmitigate-rop
24225 Try to avoid generating code sequences that contain unintended return
24226 opcodes, to mitigate against certain forms of attack. At the moment,
24227 this option is limited in what it can do and should not be relied
24228 on to provide serious protection.
24229
24230 @end table
24231
24232 These @samp{-m} switches are supported in addition to the above
24233 on x86-64 processors in 64-bit environments.
24234
24235 @table @gcctabopt
24236 @item -m32
24237 @itemx -m64
24238 @itemx -mx32
24239 @itemx -m16
24240 @itemx -miamcu
24241 @opindex m32
24242 @opindex m64
24243 @opindex mx32
24244 @opindex m16
24245 @opindex miamcu
24246 Generate code for a 16-bit, 32-bit or 64-bit environment.
24247 The @option{-m32} option sets @code{int}, @code{long}, and pointer types
24248 to 32 bits, and
24249 generates code that runs on any i386 system.
24250
24251 The @option{-m64} option sets @code{int} to 32 bits and @code{long} and pointer
24252 types to 64 bits, and generates code for the x86-64 architecture.
24253 For Darwin only the @option{-m64} option also turns off the @option{-fno-pic}
24254 and @option{-mdynamic-no-pic} options.
24255
24256 The @option{-mx32} option sets @code{int}, @code{long}, and pointer types
24257 to 32 bits, and
24258 generates code for the x86-64 architecture.
24259
24260 The @option{-m16} option is the same as @option{-m32}, except for that
24261 it outputs the @code{.code16gcc} assembly directive at the beginning of
24262 the assembly output so that the binary can run in 16-bit mode.
24263
24264 The @option{-miamcu} option generates code which conforms to Intel MCU
24265 psABI. It requires the @option{-m32} option to be turned on.
24266
24267 @item -mno-red-zone
24268 @opindex mno-red-zone
24269 Do not use a so-called ``red zone'' for x86-64 code. The red zone is mandated
24270 by the x86-64 ABI; it is a 128-byte area beyond the location of the
24271 stack pointer that is not modified by signal or interrupt handlers
24272 and therefore can be used for temporary data without adjusting the stack
24273 pointer. The flag @option{-mno-red-zone} disables this red zone.
24274
24275 @item -mcmodel=small
24276 @opindex mcmodel=small
24277 Generate code for the small code model: the program and its symbols must
24278 be linked in the lower 2 GB of the address space. Pointers are 64 bits.
24279 Programs can be statically or dynamically linked. This is the default
24280 code model.
24281
24282 @item -mcmodel=kernel
24283 @opindex mcmodel=kernel
24284 Generate code for the kernel code model. The kernel runs in the
24285 negative 2 GB of the address space.
24286 This model has to be used for Linux kernel code.
24287
24288 @item -mcmodel=medium
24289 @opindex mcmodel=medium
24290 Generate code for the medium model: the program is linked in the lower 2
24291 GB of the address space. Small symbols are also placed there. Symbols
24292 with sizes larger than @option{-mlarge-data-threshold} are put into
24293 large data or BSS sections and can be located above 2GB. Programs can
24294 be statically or dynamically linked.
24295
24296 @item -mcmodel=large
24297 @opindex mcmodel=large
24298 Generate code for the large model. This model makes no assumptions
24299 about addresses and sizes of sections.
24300
24301 @item -maddress-mode=long
24302 @opindex maddress-mode=long
24303 Generate code for long address mode. This is only supported for 64-bit
24304 and x32 environments. It is the default address mode for 64-bit
24305 environments.
24306
24307 @item -maddress-mode=short
24308 @opindex maddress-mode=short
24309 Generate code for short address mode. This is only supported for 32-bit
24310 and x32 environments. It is the default address mode for 32-bit and
24311 x32 environments.
24312 @end table
24313
24314 @node x86 Windows Options
24315 @subsection x86 Windows Options
24316 @cindex x86 Windows Options
24317 @cindex Windows Options for x86
24318
24319 These additional options are available for Microsoft Windows targets:
24320
24321 @table @gcctabopt
24322 @item -mconsole
24323 @opindex mconsole
24324 This option
24325 specifies that a console application is to be generated, by
24326 instructing the linker to set the PE header subsystem type
24327 required for console applications.
24328 This option is available for Cygwin and MinGW targets and is
24329 enabled by default on those targets.
24330
24331 @item -mdll
24332 @opindex mdll
24333 This option is available for Cygwin and MinGW targets. It
24334 specifies that a DLL---a dynamic link library---is to be
24335 generated, enabling the selection of the required runtime
24336 startup object and entry point.
24337
24338 @item -mnop-fun-dllimport
24339 @opindex mnop-fun-dllimport
24340 This option is available for Cygwin and MinGW targets. It
24341 specifies that the @code{dllimport} attribute should be ignored.
24342
24343 @item -mthread
24344 @opindex mthread
24345 This option is available for MinGW targets. It specifies
24346 that MinGW-specific thread support is to be used.
24347
24348 @item -municode
24349 @opindex municode
24350 This option is available for MinGW-w64 targets. It causes
24351 the @code{UNICODE} preprocessor macro to be predefined, and
24352 chooses Unicode-capable runtime startup code.
24353
24354 @item -mwin32
24355 @opindex mwin32
24356 This option is available for Cygwin and MinGW targets. It
24357 specifies that the typical Microsoft Windows predefined macros are to
24358 be set in the pre-processor, but does not influence the choice
24359 of runtime library/startup code.
24360
24361 @item -mwindows
24362 @opindex mwindows
24363 This option is available for Cygwin and MinGW targets. It
24364 specifies that a GUI application is to be generated by
24365 instructing the linker to set the PE header subsystem type
24366 appropriately.
24367
24368 @item -fno-set-stack-executable
24369 @opindex fno-set-stack-executable
24370 This option is available for MinGW targets. It specifies that
24371 the executable flag for the stack used by nested functions isn't
24372 set. This is necessary for binaries running in kernel mode of
24373 Microsoft Windows, as there the User32 API, which is used to set executable
24374 privileges, isn't available.
24375
24376 @item -fwritable-relocated-rdata
24377 @opindex fno-writable-relocated-rdata
24378 This option is available for MinGW and Cygwin targets. It specifies
24379 that relocated-data in read-only section is put into the @code{.data}
24380 section. This is a necessary for older runtimes not supporting
24381 modification of @code{.rdata} sections for pseudo-relocation.
24382
24383 @item -mpe-aligned-commons
24384 @opindex mpe-aligned-commons
24385 This option is available for Cygwin and MinGW targets. It
24386 specifies that the GNU extension to the PE file format that
24387 permits the correct alignment of COMMON variables should be
24388 used when generating code. It is enabled by default if
24389 GCC detects that the target assembler found during configuration
24390 supports the feature.
24391 @end table
24392
24393 See also under @ref{x86 Options} for standard options.
24394
24395 @node Xstormy16 Options
24396 @subsection Xstormy16 Options
24397 @cindex Xstormy16 Options
24398
24399 These options are defined for Xstormy16:
24400
24401 @table @gcctabopt
24402 @item -msim
24403 @opindex msim
24404 Choose startup files and linker script suitable for the simulator.
24405 @end table
24406
24407 @node Xtensa Options
24408 @subsection Xtensa Options
24409 @cindex Xtensa Options
24410
24411 These options are supported for Xtensa targets:
24412
24413 @table @gcctabopt
24414 @item -mconst16
24415 @itemx -mno-const16
24416 @opindex mconst16
24417 @opindex mno-const16
24418 Enable or disable use of @code{CONST16} instructions for loading
24419 constant values. The @code{CONST16} instruction is currently not a
24420 standard option from Tensilica. When enabled, @code{CONST16}
24421 instructions are always used in place of the standard @code{L32R}
24422 instructions. The use of @code{CONST16} is enabled by default only if
24423 the @code{L32R} instruction is not available.
24424
24425 @item -mfused-madd
24426 @itemx -mno-fused-madd
24427 @opindex mfused-madd
24428 @opindex mno-fused-madd
24429 Enable or disable use of fused multiply/add and multiply/subtract
24430 instructions in the floating-point option. This has no effect if the
24431 floating-point option is not also enabled. Disabling fused multiply/add
24432 and multiply/subtract instructions forces the compiler to use separate
24433 instructions for the multiply and add/subtract operations. This may be
24434 desirable in some cases where strict IEEE 754-compliant results are
24435 required: the fused multiply add/subtract instructions do not round the
24436 intermediate result, thereby producing results with @emph{more} bits of
24437 precision than specified by the IEEE standard. Disabling fused multiply
24438 add/subtract instructions also ensures that the program output is not
24439 sensitive to the compiler's ability to combine multiply and add/subtract
24440 operations.
24441
24442 @item -mserialize-volatile
24443 @itemx -mno-serialize-volatile
24444 @opindex mserialize-volatile
24445 @opindex mno-serialize-volatile
24446 When this option is enabled, GCC inserts @code{MEMW} instructions before
24447 @code{volatile} memory references to guarantee sequential consistency.
24448 The default is @option{-mserialize-volatile}. Use
24449 @option{-mno-serialize-volatile} to omit the @code{MEMW} instructions.
24450
24451 @item -mforce-no-pic
24452 @opindex mforce-no-pic
24453 For targets, like GNU/Linux, where all user-mode Xtensa code must be
24454 position-independent code (PIC), this option disables PIC for compiling
24455 kernel code.
24456
24457 @item -mtext-section-literals
24458 @itemx -mno-text-section-literals
24459 @opindex mtext-section-literals
24460 @opindex mno-text-section-literals
24461 These options control the treatment of literal pools. The default is
24462 @option{-mno-text-section-literals}, which places literals in a separate
24463 section in the output file. This allows the literal pool to be placed
24464 in a data RAM/ROM, and it also allows the linker to combine literal
24465 pools from separate object files to remove redundant literals and
24466 improve code size. With @option{-mtext-section-literals}, the literals
24467 are interspersed in the text section in order to keep them as close as
24468 possible to their references. This may be necessary for large assembly
24469 files. Literals for each function are placed right before that function.
24470
24471 @item -mauto-litpools
24472 @itemx -mno-auto-litpools
24473 @opindex mauto-litpools
24474 @opindex mno-auto-litpools
24475 These options control the treatment of literal pools. The default is
24476 @option{-mno-auto-litpools}, which places literals in a separate
24477 section in the output file unless @option{-mtext-section-literals} is
24478 used. With @option{-mauto-litpools} the literals are interspersed in
24479 the text section by the assembler. Compiler does not produce explicit
24480 @code{.literal} directives and loads literals into registers with
24481 @code{MOVI} instructions instead of @code{L32R} to let the assembler
24482 do relaxation and place literals as necessary. This option allows
24483 assembler to create several literal pools per function and assemble
24484 very big functions, which may not be possible with
24485 @option{-mtext-section-literals}.
24486
24487 @item -mtarget-align
24488 @itemx -mno-target-align
24489 @opindex mtarget-align
24490 @opindex mno-target-align
24491 When this option is enabled, GCC instructs the assembler to
24492 automatically align instructions to reduce branch penalties at the
24493 expense of some code density. The assembler attempts to widen density
24494 instructions to align branch targets and the instructions following call
24495 instructions. If there are not enough preceding safe density
24496 instructions to align a target, no widening is performed. The
24497 default is @option{-mtarget-align}. These options do not affect the
24498 treatment of auto-aligned instructions like @code{LOOP}, which the
24499 assembler always aligns, either by widening density instructions or
24500 by inserting NOP instructions.
24501
24502 @item -mlongcalls
24503 @itemx -mno-longcalls
24504 @opindex mlongcalls
24505 @opindex mno-longcalls
24506 When this option is enabled, GCC instructs the assembler to translate
24507 direct calls to indirect calls unless it can determine that the target
24508 of a direct call is in the range allowed by the call instruction. This
24509 translation typically occurs for calls to functions in other source
24510 files. Specifically, the assembler translates a direct @code{CALL}
24511 instruction into an @code{L32R} followed by a @code{CALLX} instruction.
24512 The default is @option{-mno-longcalls}. This option should be used in
24513 programs where the call target can potentially be out of range. This
24514 option is implemented in the assembler, not the compiler, so the
24515 assembly code generated by GCC still shows direct call
24516 instructions---look at the disassembled object code to see the actual
24517 instructions. Note that the assembler uses an indirect call for
24518 every cross-file call, not just those that really are out of range.
24519 @end table
24520
24521 @node zSeries Options
24522 @subsection zSeries Options
24523 @cindex zSeries options
24524
24525 These are listed under @xref{S/390 and zSeries Options}.
24526
24527
24528 @c man end
24529
24530 @node Spec Files
24531 @section Specifying Subprocesses and the Switches to Pass to Them
24532 @cindex Spec Files
24533
24534 @command{gcc} is a driver program. It performs its job by invoking a
24535 sequence of other programs to do the work of compiling, assembling and
24536 linking. GCC interprets its command-line parameters and uses these to
24537 deduce which programs it should invoke, and which command-line options
24538 it ought to place on their command lines. This behavior is controlled
24539 by @dfn{spec strings}. In most cases there is one spec string for each
24540 program that GCC can invoke, but a few programs have multiple spec
24541 strings to control their behavior. The spec strings built into GCC can
24542 be overridden by using the @option{-specs=} command-line switch to specify
24543 a spec file.
24544
24545 @dfn{Spec files} are plain-text files that are used to construct spec
24546 strings. They consist of a sequence of directives separated by blank
24547 lines. The type of directive is determined by the first non-whitespace
24548 character on the line, which can be one of the following:
24549
24550 @table @code
24551 @item %@var{command}
24552 Issues a @var{command} to the spec file processor. The commands that can
24553 appear here are:
24554
24555 @table @code
24556 @item %include <@var{file}>
24557 @cindex @code{%include}
24558 Search for @var{file} and insert its text at the current point in the
24559 specs file.
24560
24561 @item %include_noerr <@var{file}>
24562 @cindex @code{%include_noerr}
24563 Just like @samp{%include}, but do not generate an error message if the include
24564 file cannot be found.
24565
24566 @item %rename @var{old_name} @var{new_name}
24567 @cindex @code{%rename}
24568 Rename the spec string @var{old_name} to @var{new_name}.
24569
24570 @end table
24571
24572 @item *[@var{spec_name}]:
24573 This tells the compiler to create, override or delete the named spec
24574 string. All lines after this directive up to the next directive or
24575 blank line are considered to be the text for the spec string. If this
24576 results in an empty string then the spec is deleted. (Or, if the
24577 spec did not exist, then nothing happens.) Otherwise, if the spec
24578 does not currently exist a new spec is created. If the spec does
24579 exist then its contents are overridden by the text of this
24580 directive, unless the first character of that text is the @samp{+}
24581 character, in which case the text is appended to the spec.
24582
24583 @item [@var{suffix}]:
24584 Creates a new @samp{[@var{suffix}] spec} pair. All lines after this directive
24585 and up to the next directive or blank line are considered to make up the
24586 spec string for the indicated suffix. When the compiler encounters an
24587 input file with the named suffix, it processes the spec string in
24588 order to work out how to compile that file. For example:
24589
24590 @smallexample
24591 .ZZ:
24592 z-compile -input %i
24593 @end smallexample
24594
24595 This says that any input file whose name ends in @samp{.ZZ} should be
24596 passed to the program @samp{z-compile}, which should be invoked with the
24597 command-line switch @option{-input} and with the result of performing the
24598 @samp{%i} substitution. (See below.)
24599
24600 As an alternative to providing a spec string, the text following a
24601 suffix directive can be one of the following:
24602
24603 @table @code
24604 @item @@@var{language}
24605 This says that the suffix is an alias for a known @var{language}. This is
24606 similar to using the @option{-x} command-line switch to GCC to specify a
24607 language explicitly. For example:
24608
24609 @smallexample
24610 .ZZ:
24611 @@c++
24612 @end smallexample
24613
24614 Says that .ZZ files are, in fact, C++ source files.
24615
24616 @item #@var{name}
24617 This causes an error messages saying:
24618
24619 @smallexample
24620 @var{name} compiler not installed on this system.
24621 @end smallexample
24622 @end table
24623
24624 GCC already has an extensive list of suffixes built into it.
24625 This directive adds an entry to the end of the list of suffixes, but
24626 since the list is searched from the end backwards, it is effectively
24627 possible to override earlier entries using this technique.
24628
24629 @end table
24630
24631 GCC has the following spec strings built into it. Spec files can
24632 override these strings or create their own. Note that individual
24633 targets can also add their own spec strings to this list.
24634
24635 @smallexample
24636 asm Options to pass to the assembler
24637 asm_final Options to pass to the assembler post-processor
24638 cpp Options to pass to the C preprocessor
24639 cc1 Options to pass to the C compiler
24640 cc1plus Options to pass to the C++ compiler
24641 endfile Object files to include at the end of the link
24642 link Options to pass to the linker
24643 lib Libraries to include on the command line to the linker
24644 libgcc Decides which GCC support library to pass to the linker
24645 linker Sets the name of the linker
24646 predefines Defines to be passed to the C preprocessor
24647 signed_char Defines to pass to CPP to say whether @code{char} is signed
24648 by default
24649 startfile Object files to include at the start of the link
24650 @end smallexample
24651
24652 Here is a small example of a spec file:
24653
24654 @smallexample
24655 %rename lib old_lib
24656
24657 *lib:
24658 --start-group -lgcc -lc -leval1 --end-group %(old_lib)
24659 @end smallexample
24660
24661 This example renames the spec called @samp{lib} to @samp{old_lib} and
24662 then overrides the previous definition of @samp{lib} with a new one.
24663 The new definition adds in some extra command-line options before
24664 including the text of the old definition.
24665
24666 @dfn{Spec strings} are a list of command-line options to be passed to their
24667 corresponding program. In addition, the spec strings can contain
24668 @samp{%}-prefixed sequences to substitute variable text or to
24669 conditionally insert text into the command line. Using these constructs
24670 it is possible to generate quite complex command lines.
24671
24672 Here is a table of all defined @samp{%}-sequences for spec
24673 strings. Note that spaces are not generated automatically around the
24674 results of expanding these sequences. Therefore you can concatenate them
24675 together or combine them with constant text in a single argument.
24676
24677 @table @code
24678 @item %%
24679 Substitute one @samp{%} into the program name or argument.
24680
24681 @item %i
24682 Substitute the name of the input file being processed.
24683
24684 @item %b
24685 Substitute the basename of the input file being processed.
24686 This is the substring up to (and not including) the last period
24687 and not including the directory.
24688
24689 @item %B
24690 This is the same as @samp{%b}, but include the file suffix (text after
24691 the last period).
24692
24693 @item %d
24694 Marks the argument containing or following the @samp{%d} as a
24695 temporary file name, so that that file is deleted if GCC exits
24696 successfully. Unlike @samp{%g}, this contributes no text to the
24697 argument.
24698
24699 @item %g@var{suffix}
24700 Substitute a file name that has suffix @var{suffix} and is chosen
24701 once per compilation, and mark the argument in the same way as
24702 @samp{%d}. To reduce exposure to denial-of-service attacks, the file
24703 name is now chosen in a way that is hard to predict even when previously
24704 chosen file names are known. For example, @samp{%g.s @dots{} %g.o @dots{} %g.s}
24705 might turn into @samp{ccUVUUAU.s ccXYAXZ12.o ccUVUUAU.s}. @var{suffix} matches
24706 the regexp @samp{[.A-Za-z]*} or the special string @samp{%O}, which is
24707 treated exactly as if @samp{%O} had been preprocessed. Previously, @samp{%g}
24708 was simply substituted with a file name chosen once per compilation,
24709 without regard to any appended suffix (which was therefore treated
24710 just like ordinary text), making such attacks more likely to succeed.
24711
24712 @item %u@var{suffix}
24713 Like @samp{%g}, but generates a new temporary file name
24714 each time it appears instead of once per compilation.
24715
24716 @item %U@var{suffix}
24717 Substitutes the last file name generated with @samp{%u@var{suffix}}, generating a
24718 new one if there is no such last file name. In the absence of any
24719 @samp{%u@var{suffix}}, this is just like @samp{%g@var{suffix}}, except they don't share
24720 the same suffix @emph{space}, so @samp{%g.s @dots{} %U.s @dots{} %g.s @dots{} %U.s}
24721 involves the generation of two distinct file names, one
24722 for each @samp{%g.s} and another for each @samp{%U.s}. Previously, @samp{%U} was
24723 simply substituted with a file name chosen for the previous @samp{%u},
24724 without regard to any appended suffix.
24725
24726 @item %j@var{suffix}
24727 Substitutes the name of the @code{HOST_BIT_BUCKET}, if any, and if it is
24728 writable, and if @option{-save-temps} is not used;
24729 otherwise, substitute the name
24730 of a temporary file, just like @samp{%u}. This temporary file is not
24731 meant for communication between processes, but rather as a junk
24732 disposal mechanism.
24733
24734 @item %|@var{suffix}
24735 @itemx %m@var{suffix}
24736 Like @samp{%g}, except if @option{-pipe} is in effect. In that case
24737 @samp{%|} substitutes a single dash and @samp{%m} substitutes nothing at
24738 all. These are the two most common ways to instruct a program that it
24739 should read from standard input or write to standard output. If you
24740 need something more elaborate you can use an @samp{%@{pipe:@code{X}@}}
24741 construct: see for example @file{f/lang-specs.h}.
24742
24743 @item %.@var{SUFFIX}
24744 Substitutes @var{.SUFFIX} for the suffixes of a matched switch's args
24745 when it is subsequently output with @samp{%*}. @var{SUFFIX} is
24746 terminated by the next space or %.
24747
24748 @item %w
24749 Marks the argument containing or following the @samp{%w} as the
24750 designated output file of this compilation. This puts the argument
24751 into the sequence of arguments that @samp{%o} substitutes.
24752
24753 @item %o
24754 Substitutes the names of all the output files, with spaces
24755 automatically placed around them. You should write spaces
24756 around the @samp{%o} as well or the results are undefined.
24757 @samp{%o} is for use in the specs for running the linker.
24758 Input files whose names have no recognized suffix are not compiled
24759 at all, but they are included among the output files, so they are
24760 linked.
24761
24762 @item %O
24763 Substitutes the suffix for object files. Note that this is
24764 handled specially when it immediately follows @samp{%g, %u, or %U},
24765 because of the need for those to form complete file names. The
24766 handling is such that @samp{%O} is treated exactly as if it had already
24767 been substituted, except that @samp{%g, %u, and %U} do not currently
24768 support additional @var{suffix} characters following @samp{%O} as they do
24769 following, for example, @samp{.o}.
24770
24771 @item %p
24772 Substitutes the standard macro predefinitions for the
24773 current target machine. Use this when running @command{cpp}.
24774
24775 @item %P
24776 Like @samp{%p}, but puts @samp{__} before and after the name of each
24777 predefined macro, except for macros that start with @samp{__} or with
24778 @samp{_@var{L}}, where @var{L} is an uppercase letter. This is for ISO
24779 C@.
24780
24781 @item %I
24782 Substitute any of @option{-iprefix} (made from @env{GCC_EXEC_PREFIX}),
24783 @option{-isysroot} (made from @env{TARGET_SYSTEM_ROOT}),
24784 @option{-isystem} (made from @env{COMPILER_PATH} and @option{-B} options)
24785 and @option{-imultilib} as necessary.
24786
24787 @item %s
24788 Current argument is the name of a library or startup file of some sort.
24789 Search for that file in a standard list of directories and substitute
24790 the full name found. The current working directory is included in the
24791 list of directories scanned.
24792
24793 @item %T
24794 Current argument is the name of a linker script. Search for that file
24795 in the current list of directories to scan for libraries. If the file
24796 is located insert a @option{--script} option into the command line
24797 followed by the full path name found. If the file is not found then
24798 generate an error message. Note: the current working directory is not
24799 searched.
24800
24801 @item %e@var{str}
24802 Print @var{str} as an error message. @var{str} is terminated by a newline.
24803 Use this when inconsistent options are detected.
24804
24805 @item %(@var{name})
24806 Substitute the contents of spec string @var{name} at this point.
24807
24808 @item %x@{@var{option}@}
24809 Accumulate an option for @samp{%X}.
24810
24811 @item %X
24812 Output the accumulated linker options specified by @option{-Wl} or a @samp{%x}
24813 spec string.
24814
24815 @item %Y
24816 Output the accumulated assembler options specified by @option{-Wa}.
24817
24818 @item %Z
24819 Output the accumulated preprocessor options specified by @option{-Wp}.
24820
24821 @item %a
24822 Process the @code{asm} spec. This is used to compute the
24823 switches to be passed to the assembler.
24824
24825 @item %A
24826 Process the @code{asm_final} spec. This is a spec string for
24827 passing switches to an assembler post-processor, if such a program is
24828 needed.
24829
24830 @item %l
24831 Process the @code{link} spec. This is the spec for computing the
24832 command line passed to the linker. Typically it makes use of the
24833 @samp{%L %G %S %D and %E} sequences.
24834
24835 @item %D
24836 Dump out a @option{-L} option for each directory that GCC believes might
24837 contain startup files. If the target supports multilibs then the
24838 current multilib directory is prepended to each of these paths.
24839
24840 @item %L
24841 Process the @code{lib} spec. This is a spec string for deciding which
24842 libraries are included on the command line to the linker.
24843
24844 @item %G
24845 Process the @code{libgcc} spec. This is a spec string for deciding
24846 which GCC support library is included on the command line to the linker.
24847
24848 @item %S
24849 Process the @code{startfile} spec. This is a spec for deciding which
24850 object files are the first ones passed to the linker. Typically
24851 this might be a file named @file{crt0.o}.
24852
24853 @item %E
24854 Process the @code{endfile} spec. This is a spec string that specifies
24855 the last object files that are passed to the linker.
24856
24857 @item %C
24858 Process the @code{cpp} spec. This is used to construct the arguments
24859 to be passed to the C preprocessor.
24860
24861 @item %1
24862 Process the @code{cc1} spec. This is used to construct the options to be
24863 passed to the actual C compiler (@command{cc1}).
24864
24865 @item %2
24866 Process the @code{cc1plus} spec. This is used to construct the options to be
24867 passed to the actual C++ compiler (@command{cc1plus}).
24868
24869 @item %*
24870 Substitute the variable part of a matched option. See below.
24871 Note that each comma in the substituted string is replaced by
24872 a single space.
24873
24874 @item %<@code{S}
24875 Remove all occurrences of @code{-S} from the command line. Note---this
24876 command is position dependent. @samp{%} commands in the spec string
24877 before this one see @code{-S}, @samp{%} commands in the spec string
24878 after this one do not.
24879
24880 @item %:@var{function}(@var{args})
24881 Call the named function @var{function}, passing it @var{args}.
24882 @var{args} is first processed as a nested spec string, then split
24883 into an argument vector in the usual fashion. The function returns
24884 a string which is processed as if it had appeared literally as part
24885 of the current spec.
24886
24887 The following built-in spec functions are provided:
24888
24889 @table @code
24890 @item @code{getenv}
24891 The @code{getenv} spec function takes two arguments: an environment
24892 variable name and a string. If the environment variable is not
24893 defined, a fatal error is issued. Otherwise, the return value is the
24894 value of the environment variable concatenated with the string. For
24895 example, if @env{TOPDIR} is defined as @file{/path/to/top}, then:
24896
24897 @smallexample
24898 %:getenv(TOPDIR /include)
24899 @end smallexample
24900
24901 expands to @file{/path/to/top/include}.
24902
24903 @item @code{if-exists}
24904 The @code{if-exists} spec function takes one argument, an absolute
24905 pathname to a file. If the file exists, @code{if-exists} returns the
24906 pathname. Here is a small example of its usage:
24907
24908 @smallexample
24909 *startfile:
24910 crt0%O%s %:if-exists(crti%O%s) crtbegin%O%s
24911 @end smallexample
24912
24913 @item @code{if-exists-else}
24914 The @code{if-exists-else} spec function is similar to the @code{if-exists}
24915 spec function, except that it takes two arguments. The first argument is
24916 an absolute pathname to a file. If the file exists, @code{if-exists-else}
24917 returns the pathname. If it does not exist, it returns the second argument.
24918 This way, @code{if-exists-else} can be used to select one file or another,
24919 based on the existence of the first. Here is a small example of its usage:
24920
24921 @smallexample
24922 *startfile:
24923 crt0%O%s %:if-exists(crti%O%s) \
24924 %:if-exists-else(crtbeginT%O%s crtbegin%O%s)
24925 @end smallexample
24926
24927 @item @code{replace-outfile}
24928 The @code{replace-outfile} spec function takes two arguments. It looks for the
24929 first argument in the outfiles array and replaces it with the second argument. Here
24930 is a small example of its usage:
24931
24932 @smallexample
24933 %@{fgnu-runtime:%:replace-outfile(-lobjc -lobjc-gnu)@}
24934 @end smallexample
24935
24936 @item @code{remove-outfile}
24937 The @code{remove-outfile} spec function takes one argument. It looks for the
24938 first argument in the outfiles array and removes it. Here is a small example
24939 its usage:
24940
24941 @smallexample
24942 %:remove-outfile(-lm)
24943 @end smallexample
24944
24945 @item @code{pass-through-libs}
24946 The @code{pass-through-libs} spec function takes any number of arguments. It
24947 finds any @option{-l} options and any non-options ending in @file{.a} (which it
24948 assumes are the names of linker input library archive files) and returns a
24949 result containing all the found arguments each prepended by
24950 @option{-plugin-opt=-pass-through=} and joined by spaces. This list is
24951 intended to be passed to the LTO linker plugin.
24952
24953 @smallexample
24954 %:pass-through-libs(%G %L %G)
24955 @end smallexample
24956
24957 @item @code{print-asm-header}
24958 The @code{print-asm-header} function takes no arguments and simply
24959 prints a banner like:
24960
24961 @smallexample
24962 Assembler options
24963 =================
24964
24965 Use "-Wa,OPTION" to pass "OPTION" to the assembler.
24966 @end smallexample
24967
24968 It is used to separate compiler options from assembler options
24969 in the @option{--target-help} output.
24970 @end table
24971
24972 @item %@{@code{S}@}
24973 Substitutes the @code{-S} switch, if that switch is given to GCC@.
24974 If that switch is not specified, this substitutes nothing. Note that
24975 the leading dash is omitted when specifying this option, and it is
24976 automatically inserted if the substitution is performed. Thus the spec
24977 string @samp{%@{foo@}} matches the command-line option @option{-foo}
24978 and outputs the command-line option @option{-foo}.
24979
24980 @item %W@{@code{S}@}
24981 Like %@{@code{S}@} but mark last argument supplied within as a file to be
24982 deleted on failure.
24983
24984 @item %@{@code{S}*@}
24985 Substitutes all the switches specified to GCC whose names start
24986 with @code{-S}, but which also take an argument. This is used for
24987 switches like @option{-o}, @option{-D}, @option{-I}, etc.
24988 GCC considers @option{-o foo} as being
24989 one switch whose name starts with @samp{o}. %@{o*@} substitutes this
24990 text, including the space. Thus two arguments are generated.
24991
24992 @item %@{@code{S}*&@code{T}*@}
24993 Like %@{@code{S}*@}, but preserve order of @code{S} and @code{T} options
24994 (the order of @code{S} and @code{T} in the spec is not significant).
24995 There can be any number of ampersand-separated variables; for each the
24996 wild card is optional. Useful for CPP as @samp{%@{D*&U*&A*@}}.
24997
24998 @item %@{@code{S}:@code{X}@}
24999 Substitutes @code{X}, if the @option{-S} switch is given to GCC@.
25000
25001 @item %@{!@code{S}:@code{X}@}
25002 Substitutes @code{X}, if the @option{-S} switch is @emph{not} given to GCC@.
25003
25004 @item %@{@code{S}*:@code{X}@}
25005 Substitutes @code{X} if one or more switches whose names start with
25006 @code{-S} are specified to GCC@. Normally @code{X} is substituted only
25007 once, no matter how many such switches appeared. However, if @code{%*}
25008 appears somewhere in @code{X}, then @code{X} is substituted once
25009 for each matching switch, with the @code{%*} replaced by the part of
25010 that switch matching the @code{*}.
25011
25012 If @code{%*} appears as the last part of a spec sequence then a space
25013 is added after the end of the last substitution. If there is more
25014 text in the sequence, however, then a space is not generated. This
25015 allows the @code{%*} substitution to be used as part of a larger
25016 string. For example, a spec string like this:
25017
25018 @smallexample
25019 %@{mcu=*:--script=%*/memory.ld@}
25020 @end smallexample
25021
25022 @noindent
25023 when matching an option like @option{-mcu=newchip} produces:
25024
25025 @smallexample
25026 --script=newchip/memory.ld
25027 @end smallexample
25028
25029 @item %@{.@code{S}:@code{X}@}
25030 Substitutes @code{X}, if processing a file with suffix @code{S}.
25031
25032 @item %@{!.@code{S}:@code{X}@}
25033 Substitutes @code{X}, if @emph{not} processing a file with suffix @code{S}.
25034
25035 @item %@{,@code{S}:@code{X}@}
25036 Substitutes @code{X}, if processing a file for language @code{S}.
25037
25038 @item %@{!,@code{S}:@code{X}@}
25039 Substitutes @code{X}, if not processing a file for language @code{S}.
25040
25041 @item %@{@code{S}|@code{P}:@code{X}@}
25042 Substitutes @code{X} if either @code{-S} or @code{-P} is given to
25043 GCC@. This may be combined with @samp{!}, @samp{.}, @samp{,}, and
25044 @code{*} sequences as well, although they have a stronger binding than
25045 the @samp{|}. If @code{%*} appears in @code{X}, all of the
25046 alternatives must be starred, and only the first matching alternative
25047 is substituted.
25048
25049 For example, a spec string like this:
25050
25051 @smallexample
25052 %@{.c:-foo@} %@{!.c:-bar@} %@{.c|d:-baz@} %@{!.c|d:-boggle@}
25053 @end smallexample
25054
25055 @noindent
25056 outputs the following command-line options from the following input
25057 command-line options:
25058
25059 @smallexample
25060 fred.c -foo -baz
25061 jim.d -bar -boggle
25062 -d fred.c -foo -baz -boggle
25063 -d jim.d -bar -baz -boggle
25064 @end smallexample
25065
25066 @item %@{S:X; T:Y; :D@}
25067
25068 If @code{S} is given to GCC, substitutes @code{X}; else if @code{T} is
25069 given to GCC, substitutes @code{Y}; else substitutes @code{D}. There can
25070 be as many clauses as you need. This may be combined with @code{.},
25071 @code{,}, @code{!}, @code{|}, and @code{*} as needed.
25072
25073
25074 @end table
25075
25076 The conditional text @code{X} in a %@{@code{S}:@code{X}@} or similar
25077 construct may contain other nested @samp{%} constructs or spaces, or
25078 even newlines. They are processed as usual, as described above.
25079 Trailing white space in @code{X} is ignored. White space may also
25080 appear anywhere on the left side of the colon in these constructs,
25081 except between @code{.} or @code{*} and the corresponding word.
25082
25083 The @option{-O}, @option{-f}, @option{-m}, and @option{-W} switches are
25084 handled specifically in these constructs. If another value of
25085 @option{-O} or the negated form of a @option{-f}, @option{-m}, or
25086 @option{-W} switch is found later in the command line, the earlier
25087 switch value is ignored, except with @{@code{S}*@} where @code{S} is
25088 just one letter, which passes all matching options.
25089
25090 The character @samp{|} at the beginning of the predicate text is used to
25091 indicate that a command should be piped to the following command, but
25092 only if @option{-pipe} is specified.
25093
25094 It is built into GCC which switches take arguments and which do not.
25095 (You might think it would be useful to generalize this to allow each
25096 compiler's spec to say which switches take arguments. But this cannot
25097 be done in a consistent fashion. GCC cannot even decide which input
25098 files have been specified without knowing which switches take arguments,
25099 and it must know which input files to compile in order to tell which
25100 compilers to run).
25101
25102 GCC also knows implicitly that arguments starting in @option{-l} are to be
25103 treated as compiler output files, and passed to the linker in their
25104 proper position among the other output files.
25105
25106 @node Environment Variables
25107 @section Environment Variables Affecting GCC
25108 @cindex environment variables
25109
25110 @c man begin ENVIRONMENT
25111 This section describes several environment variables that affect how GCC
25112 operates. Some of them work by specifying directories or prefixes to use
25113 when searching for various kinds of files. Some are used to specify other
25114 aspects of the compilation environment.
25115
25116 Note that you can also specify places to search using options such as
25117 @option{-B}, @option{-I} and @option{-L} (@pxref{Directory Options}). These
25118 take precedence over places specified using environment variables, which
25119 in turn take precedence over those specified by the configuration of GCC@.
25120 @xref{Driver,, Controlling the Compilation Driver @file{gcc}, gccint,
25121 GNU Compiler Collection (GCC) Internals}.
25122
25123 @table @env
25124 @item LANG
25125 @itemx LC_CTYPE
25126 @c @itemx LC_COLLATE
25127 @itemx LC_MESSAGES
25128 @c @itemx LC_MONETARY
25129 @c @itemx LC_NUMERIC
25130 @c @itemx LC_TIME
25131 @itemx LC_ALL
25132 @findex LANG
25133 @findex LC_CTYPE
25134 @c @findex LC_COLLATE
25135 @findex LC_MESSAGES
25136 @c @findex LC_MONETARY
25137 @c @findex LC_NUMERIC
25138 @c @findex LC_TIME
25139 @findex LC_ALL
25140 @cindex locale
25141 These environment variables control the way that GCC uses
25142 localization information which allows GCC to work with different
25143 national conventions. GCC inspects the locale categories
25144 @env{LC_CTYPE} and @env{LC_MESSAGES} if it has been configured to do
25145 so. These locale categories can be set to any value supported by your
25146 installation. A typical value is @samp{en_GB.UTF-8} for English in the United
25147 Kingdom encoded in UTF-8.
25148
25149 The @env{LC_CTYPE} environment variable specifies character
25150 classification. GCC uses it to determine the character boundaries in
25151 a string; this is needed for some multibyte encodings that contain quote
25152 and escape characters that are otherwise interpreted as a string
25153 end or escape.
25154
25155 The @env{LC_MESSAGES} environment variable specifies the language to
25156 use in diagnostic messages.
25157
25158 If the @env{LC_ALL} environment variable is set, it overrides the value
25159 of @env{LC_CTYPE} and @env{LC_MESSAGES}; otherwise, @env{LC_CTYPE}
25160 and @env{LC_MESSAGES} default to the value of the @env{LANG}
25161 environment variable. If none of these variables are set, GCC
25162 defaults to traditional C English behavior.
25163
25164 @item TMPDIR
25165 @findex TMPDIR
25166 If @env{TMPDIR} is set, it specifies the directory to use for temporary
25167 files. GCC uses temporary files to hold the output of one stage of
25168 compilation which is to be used as input to the next stage: for example,
25169 the output of the preprocessor, which is the input to the compiler
25170 proper.
25171
25172 @item GCC_COMPARE_DEBUG
25173 @findex GCC_COMPARE_DEBUG
25174 Setting @env{GCC_COMPARE_DEBUG} is nearly equivalent to passing
25175 @option{-fcompare-debug} to the compiler driver. See the documentation
25176 of this option for more details.
25177
25178 @item GCC_EXEC_PREFIX
25179 @findex GCC_EXEC_PREFIX
25180 If @env{GCC_EXEC_PREFIX} is set, it specifies a prefix to use in the
25181 names of the subprograms executed by the compiler. No slash is added
25182 when this prefix is combined with the name of a subprogram, but you can
25183 specify a prefix that ends with a slash if you wish.
25184
25185 If @env{GCC_EXEC_PREFIX} is not set, GCC attempts to figure out
25186 an appropriate prefix to use based on the pathname it is invoked with.
25187
25188 If GCC cannot find the subprogram using the specified prefix, it
25189 tries looking in the usual places for the subprogram.
25190
25191 The default value of @env{GCC_EXEC_PREFIX} is
25192 @file{@var{prefix}/lib/gcc/} where @var{prefix} is the prefix to
25193 the installed compiler. In many cases @var{prefix} is the value
25194 of @code{prefix} when you ran the @file{configure} script.
25195
25196 Other prefixes specified with @option{-B} take precedence over this prefix.
25197
25198 This prefix is also used for finding files such as @file{crt0.o} that are
25199 used for linking.
25200
25201 In addition, the prefix is used in an unusual way in finding the
25202 directories to search for header files. For each of the standard
25203 directories whose name normally begins with @samp{/usr/local/lib/gcc}
25204 (more precisely, with the value of @env{GCC_INCLUDE_DIR}), GCC tries
25205 replacing that beginning with the specified prefix to produce an
25206 alternate directory name. Thus, with @option{-Bfoo/}, GCC searches
25207 @file{foo/bar} just before it searches the standard directory
25208 @file{/usr/local/lib/bar}.
25209 If a standard directory begins with the configured
25210 @var{prefix} then the value of @var{prefix} is replaced by
25211 @env{GCC_EXEC_PREFIX} when looking for header files.
25212
25213 @item COMPILER_PATH
25214 @findex COMPILER_PATH
25215 The value of @env{COMPILER_PATH} is a colon-separated list of
25216 directories, much like @env{PATH}. GCC tries the directories thus
25217 specified when searching for subprograms, if it can't find the
25218 subprograms using @env{GCC_EXEC_PREFIX}.
25219
25220 @item LIBRARY_PATH
25221 @findex LIBRARY_PATH
25222 The value of @env{LIBRARY_PATH} is a colon-separated list of
25223 directories, much like @env{PATH}. When configured as a native compiler,
25224 GCC tries the directories thus specified when searching for special
25225 linker files, if it can't find them using @env{GCC_EXEC_PREFIX}. Linking
25226 using GCC also uses these directories when searching for ordinary
25227 libraries for the @option{-l} option (but directories specified with
25228 @option{-L} come first).
25229
25230 @item LANG
25231 @findex LANG
25232 @cindex locale definition
25233 This variable is used to pass locale information to the compiler. One way in
25234 which this information is used is to determine the character set to be used
25235 when character literals, string literals and comments are parsed in C and C++.
25236 When the compiler is configured to allow multibyte characters,
25237 the following values for @env{LANG} are recognized:
25238
25239 @table @samp
25240 @item C-JIS
25241 Recognize JIS characters.
25242 @item C-SJIS
25243 Recognize SJIS characters.
25244 @item C-EUCJP
25245 Recognize EUCJP characters.
25246 @end table
25247
25248 If @env{LANG} is not defined, or if it has some other value, then the
25249 compiler uses @code{mblen} and @code{mbtowc} as defined by the default locale to
25250 recognize and translate multibyte characters.
25251 @end table
25252
25253 @noindent
25254 Some additional environment variables affect the behavior of the
25255 preprocessor.
25256
25257 @include cppenv.texi
25258
25259 @c man end
25260
25261 @node Precompiled Headers
25262 @section Using Precompiled Headers
25263 @cindex precompiled headers
25264 @cindex speed of compilation
25265
25266 Often large projects have many header files that are included in every
25267 source file. The time the compiler takes to process these header files
25268 over and over again can account for nearly all of the time required to
25269 build the project. To make builds faster, GCC allows you to
25270 @dfn{precompile} a header file.
25271
25272 To create a precompiled header file, simply compile it as you would any
25273 other file, if necessary using the @option{-x} option to make the driver
25274 treat it as a C or C++ header file. You may want to use a
25275 tool like @command{make} to keep the precompiled header up-to-date when
25276 the headers it contains change.
25277
25278 A precompiled header file is searched for when @code{#include} is
25279 seen in the compilation. As it searches for the included file
25280 (@pxref{Search Path,,Search Path,cpp,The C Preprocessor}) the
25281 compiler looks for a precompiled header in each directory just before it
25282 looks for the include file in that directory. The name searched for is
25283 the name specified in the @code{#include} with @samp{.gch} appended. If
25284 the precompiled header file can't be used, it is ignored.
25285
25286 For instance, if you have @code{#include "all.h"}, and you have
25287 @file{all.h.gch} in the same directory as @file{all.h}, then the
25288 precompiled header file is used if possible, and the original
25289 header is used otherwise.
25290
25291 Alternatively, you might decide to put the precompiled header file in a
25292 directory and use @option{-I} to ensure that directory is searched
25293 before (or instead of) the directory containing the original header.
25294 Then, if you want to check that the precompiled header file is always
25295 used, you can put a file of the same name as the original header in this
25296 directory containing an @code{#error} command.
25297
25298 This also works with @option{-include}. So yet another way to use
25299 precompiled headers, good for projects not designed with precompiled
25300 header files in mind, is to simply take most of the header files used by
25301 a project, include them from another header file, precompile that header
25302 file, and @option{-include} the precompiled header. If the header files
25303 have guards against multiple inclusion, they are skipped because
25304 they've already been included (in the precompiled header).
25305
25306 If you need to precompile the same header file for different
25307 languages, targets, or compiler options, you can instead make a
25308 @emph{directory} named like @file{all.h.gch}, and put each precompiled
25309 header in the directory, perhaps using @option{-o}. It doesn't matter
25310 what you call the files in the directory; every precompiled header in
25311 the directory is considered. The first precompiled header
25312 encountered in the directory that is valid for this compilation is
25313 used; they're searched in no particular order.
25314
25315 There are many other possibilities, limited only by your imagination,
25316 good sense, and the constraints of your build system.
25317
25318 A precompiled header file can be used only when these conditions apply:
25319
25320 @itemize
25321 @item
25322 Only one precompiled header can be used in a particular compilation.
25323
25324 @item
25325 A precompiled header can't be used once the first C token is seen. You
25326 can have preprocessor directives before a precompiled header; you cannot
25327 include a precompiled header from inside another header.
25328
25329 @item
25330 The precompiled header file must be produced for the same language as
25331 the current compilation. You can't use a C precompiled header for a C++
25332 compilation.
25333
25334 @item
25335 The precompiled header file must have been produced by the same compiler
25336 binary as the current compilation is using.
25337
25338 @item
25339 Any macros defined before the precompiled header is included must
25340 either be defined in the same way as when the precompiled header was
25341 generated, or must not affect the precompiled header, which usually
25342 means that they don't appear in the precompiled header at all.
25343
25344 The @option{-D} option is one way to define a macro before a
25345 precompiled header is included; using a @code{#define} can also do it.
25346 There are also some options that define macros implicitly, like
25347 @option{-O} and @option{-Wdeprecated}; the same rule applies to macros
25348 defined this way.
25349
25350 @item If debugging information is output when using the precompiled
25351 header, using @option{-g} or similar, the same kind of debugging information
25352 must have been output when building the precompiled header. However,
25353 a precompiled header built using @option{-g} can be used in a compilation
25354 when no debugging information is being output.
25355
25356 @item The same @option{-m} options must generally be used when building
25357 and using the precompiled header. @xref{Submodel Options},
25358 for any cases where this rule is relaxed.
25359
25360 @item Each of the following options must be the same when building and using
25361 the precompiled header:
25362
25363 @gccoptlist{-fexceptions}
25364
25365 @item
25366 Some other command-line options starting with @option{-f},
25367 @option{-p}, or @option{-O} must be defined in the same way as when
25368 the precompiled header was generated. At present, it's not clear
25369 which options are safe to change and which are not; the safest choice
25370 is to use exactly the same options when generating and using the
25371 precompiled header. The following are known to be safe:
25372
25373 @gccoptlist{-fmessage-length= -fpreprocessed -fsched-interblock @gol
25374 -fsched-spec -fsched-spec-load -fsched-spec-load-dangerous @gol
25375 -fsched-verbose=@var{number} -fschedule-insns -fvisibility= @gol
25376 -pedantic-errors}
25377
25378 @end itemize
25379
25380 For all of these except the last, the compiler automatically
25381 ignores the precompiled header if the conditions aren't met. If you
25382 find an option combination that doesn't work and doesn't cause the
25383 precompiled header to be ignored, please consider filing a bug report,
25384 see @ref{Bugs}.
25385
25386 If you do use differing options when generating and using the
25387 precompiled header, the actual behavior is a mixture of the
25388 behavior for the options. For instance, if you use @option{-g} to
25389 generate the precompiled header but not when using it, you may or may
25390 not get debugging information for routines in the precompiled header.
This page took 1.02927 seconds and 6 git commands to generate.