[Patch 7/7] Remove *_BY_PIECES_P
[gcc.git] / gcc / doc / invoke.texi
1 @c Copyright (C) 1988-2014 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-2014 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. @samp{g++} accepts mostly the same options as @samp{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
76 Other options are passed on to one stage of processing. Some options
77 control the preprocessor and others the compiler itself. Yet other
78 options control the assembler and linker; most of these are not
79 documented here, since you rarely need to use any of them.
80
81 @cindex C compilation options
82 Most of the command-line options that you can use with GCC are useful
83 for C programs; when an option is only useful with another language
84 (usually C++), the explanation says so explicitly. If the description
85 for a particular option does not mention a source language, you can use
86 that option with all supported languages.
87
88 @cindex C++ compilation options
89 @xref{Invoking G++,,Compiling C++ Programs}, for a summary of special
90 options for compiling C++ programs.
91
92 @cindex grouping options
93 @cindex options, grouping
94 The @command{gcc} program accepts options and file names as operands. Many
95 options have multi-letter names; therefore multiple single-letter options
96 may @emph{not} be grouped: @option{-dv} is very different from @w{@samp{-d
97 -v}}.
98
99 @cindex order of options
100 @cindex options, order
101 You can mix options and other arguments. For the most part, the order
102 you use doesn't matter. Order does matter when you use several
103 options of the same kind; for example, if you specify @option{-L} more
104 than once, the directories are searched in the order specified. Also,
105 the placement of the @option{-l} option is significant.
106
107 Many options have long names starting with @samp{-f} or with
108 @samp{-W}---for example,
109 @option{-fmove-loop-invariants}, @option{-Wformat} and so on. Most of
110 these have both positive and negative forms; the negative form of
111 @option{-ffoo} is @option{-fno-foo}. This manual documents
112 only one of these two forms, whichever one is not the default.
113
114 @c man end
115
116 @xref{Option Index}, for an index to GCC's options.
117
118 @menu
119 * Option Summary:: Brief list of all options, without explanations.
120 * Overall Options:: Controlling the kind of output:
121 an executable, object files, assembler files,
122 or preprocessed source.
123 * Invoking G++:: Compiling C++ programs.
124 * C Dialect Options:: Controlling the variant of C language compiled.
125 * C++ Dialect Options:: Variations on C++.
126 * Objective-C and Objective-C++ Dialect Options:: Variations on Objective-C
127 and Objective-C++.
128 * Language Independent Options:: Controlling how diagnostics should be
129 formatted.
130 * Warning Options:: How picky should the compiler be?
131 * Debugging Options:: Symbol tables, measurements, and debugging dumps.
132 * Optimize Options:: How much optimization?
133 * Preprocessor Options:: Controlling header files and macro definitions.
134 Also, getting dependency information for Make.
135 * Assembler Options:: Passing options to the assembler.
136 * Link Options:: Specifying libraries and so on.
137 * Directory Options:: Where to find header files and libraries.
138 Where to find the compiler executable files.
139 * Spec Files:: How to pass switches to sub-processes.
140 * Target Options:: Running a cross-compiler, or an old version of GCC.
141 * Submodel Options:: Specifying minor hardware or convention variations,
142 such as 68010 vs 68020.
143 * Code Gen Options:: Specifying conventions for function calls, data layout
144 and register usage.
145 * Environment Variables:: Env vars that affect GCC.
146 * Precompiled Headers:: Compiling a header once, and using it many times.
147 @end menu
148
149 @c man begin OPTIONS
150
151 @node Option Summary
152 @section Option Summary
153
154 Here is a summary of all the options, grouped by type. Explanations are
155 in the following sections.
156
157 @table @emph
158 @item Overall Options
159 @xref{Overall Options,,Options Controlling the Kind of Output}.
160 @gccoptlist{-c -S -E -o @var{file} -no-canonical-prefixes @gol
161 -pipe -pass-exit-codes @gol
162 -x @var{language} -v -### --help@r{[}=@var{class}@r{[},@dots{}@r{]]} --target-help @gol
163 --version -wrapper @@@var{file} -fplugin=@var{file} -fplugin-arg-@var{name}=@var{arg} @gol
164 -fdump-ada-spec@r{[}-slim@r{]} -fada-spec-parent=@var{unit} -fdump-go-spec=@var{file}}
165
166 @item C Language Options
167 @xref{C Dialect Options,,Options Controlling C Dialect}.
168 @gccoptlist{-ansi -std=@var{standard} -fgnu89-inline @gol
169 -aux-info @var{filename} -fallow-parameterless-variadic-functions @gol
170 -fno-asm -fno-builtin -fno-builtin-@var{function} @gol
171 -fhosted -ffreestanding -fopenmp -fopenmp-simd -fms-extensions @gol
172 -fplan9-extensions -trigraphs -traditional -traditional-cpp @gol
173 -fallow-single-precision -fcond-mismatch -flax-vector-conversions @gol
174 -fsigned-bitfields -fsigned-char @gol
175 -funsigned-bitfields -funsigned-char}
176
177 @item C++ Language Options
178 @xref{C++ Dialect Options,,Options Controlling C++ Dialect}.
179 @gccoptlist{-fabi-version=@var{n} -fno-access-control -fcheck-new @gol
180 -fconstexpr-depth=@var{n} -ffriend-injection @gol
181 -fno-elide-constructors @gol
182 -fno-enforce-eh-specs @gol
183 -ffor-scope -fno-for-scope -fno-gnu-keywords @gol
184 -fno-implicit-templates @gol
185 -fno-implicit-inline-templates @gol
186 -fno-implement-inlines -fms-extensions @gol
187 -fno-nonansi-builtins -fnothrow-opt -fno-operator-names @gol
188 -fno-optional-diags -fpermissive @gol
189 -fno-pretty-templates @gol
190 -frepo -fno-rtti -fstats -ftemplate-backtrace-limit=@var{n} @gol
191 -ftemplate-depth=@var{n} @gol
192 -fno-threadsafe-statics -fuse-cxa-atexit @gol
193 -fno-weak -nostdinc++ @gol
194 -fvisibility-inlines-hidden @gol
195 -fvtable-verify=@var{std|preinit|none} @gol
196 -fvtv-counts -fvtv-debug @gol
197 -fvisibility-ms-compat @gol
198 -fext-numeric-literals @gol
199 -Wabi=@var{n} -Wconversion-null -Wctor-dtor-privacy @gol
200 -Wdelete-non-virtual-dtor -Wliteral-suffix -Wnarrowing @gol
201 -Wnoexcept -Wnon-virtual-dtor -Wreorder @gol
202 -Weffc++ -Wstrict-null-sentinel @gol
203 -Wno-non-template-friend -Wold-style-cast @gol
204 -Woverloaded-virtual -Wno-pmf-conversions @gol
205 -Wsign-promo}
206
207 @item Objective-C and Objective-C++ Language Options
208 @xref{Objective-C and Objective-C++ Dialect Options,,Options Controlling
209 Objective-C and Objective-C++ Dialects}.
210 @gccoptlist{-fconstant-string-class=@var{class-name} @gol
211 -fgnu-runtime -fnext-runtime @gol
212 -fno-nil-receivers @gol
213 -fobjc-abi-version=@var{n} @gol
214 -fobjc-call-cxx-cdtors @gol
215 -fobjc-direct-dispatch @gol
216 -fobjc-exceptions @gol
217 -fobjc-gc @gol
218 -fobjc-nilcheck @gol
219 -fobjc-std=objc1 @gol
220 -fno-local-ivars @gol
221 -fivar-visibility=@var{public|protected|private|package} @gol
222 -freplace-objc-classes @gol
223 -fzero-link @gol
224 -gen-decls @gol
225 -Wassign-intercept @gol
226 -Wno-protocol -Wselector @gol
227 -Wstrict-selector-match @gol
228 -Wundeclared-selector}
229
230 @item Language Independent Options
231 @xref{Language Independent Options,,Options to Control Diagnostic Messages Formatting}.
232 @gccoptlist{-fmessage-length=@var{n} @gol
233 -fdiagnostics-show-location=@r{[}once@r{|}every-line@r{]} @gol
234 -fdiagnostics-color=@r{[}auto@r{|}never@r{|}always@r{]} @gol
235 -fno-diagnostics-show-option -fno-diagnostics-show-caret}
236
237 @item Warning Options
238 @xref{Warning Options,,Options to Request or Suppress Warnings}.
239 @gccoptlist{-fsyntax-only -fmax-errors=@var{n} -Wpedantic @gol
240 -pedantic-errors @gol
241 -w -Wextra -Wall -Waddress -Waggregate-return @gol
242 -Waggressive-loop-optimizations -Warray-bounds @gol
243 -Wbool-compare @gol
244 -Wno-attributes -Wno-builtin-macro-redefined @gol
245 -Wc90-c99-compat -Wc99-c11-compat @gol
246 -Wc++-compat -Wc++11-compat -Wcast-align -Wcast-qual @gol
247 -Wchar-subscripts -Wclobbered -Wcomment -Wconditionally-supported @gol
248 -Wconversion -Wcoverage-mismatch -Wdate-time -Wdelete-incomplete -Wno-cpp @gol
249 -Wno-deprecated -Wno-deprecated-declarations -Wno-designated-init @gol
250 -Wdisabled-optimization -Wno-discarded-qualifiers @gol
251 -Wno-div-by-zero -Wdouble-promotion -Wempty-body -Wenum-compare @gol
252 -Wno-endif-labels -Werror -Werror=* @gol
253 -Wfatal-errors -Wfloat-equal -Wformat -Wformat=2 @gol
254 -Wno-format-contains-nul -Wno-format-extra-args -Wformat-nonliteral @gol
255 -Wformat-security -Wformat-signedness -Wformat-y2k @gol
256 -Wframe-larger-than=@var{len} -Wno-free-nonheap-object -Wjump-misses-init @gol
257 -Wignored-qualifiers -Wincompatible-pointer-types @gol
258 -Wimplicit -Wimplicit-function-declaration -Wimplicit-int @gol
259 -Winit-self -Winline -Wno-int-conversion @gol
260 -Wno-int-to-pointer-cast -Wno-invalid-offsetof @gol
261 -Winvalid-pch -Wlarger-than=@var{len} -Wunsafe-loop-optimizations @gol
262 -Wlogical-op -Wlogical-not-parentheses -Wlong-long @gol
263 -Wmain -Wmaybe-uninitialized -Wmemset-transposed-args -Wmissing-braces @gol
264 -Wmissing-field-initializers -Wmissing-include-dirs @gol
265 -Wno-multichar -Wnonnull -Wnormalized=@r{[}none@r{|}id@r{|}nfc@r{|}nfkc@r{]} @gol
266 -Wodr -Wno-overflow -Wopenmp-simd @gol
267 -Woverlength-strings -Wpacked -Wpacked-bitfield-compat -Wpadded @gol
268 -Wparentheses -Wpedantic-ms-format -Wno-pedantic-ms-format @gol
269 -Wpointer-arith -Wno-pointer-to-int-cast @gol
270 -Wredundant-decls -Wno-return-local-addr @gol
271 -Wreturn-type -Wsequence-point -Wshadow -Wno-shadow-ivar @gol
272 -Wsign-compare -Wsign-conversion -Wfloat-conversion @gol
273 -Wsizeof-pointer-memaccess -Wsizeof-array-argument @gol
274 -Wstack-protector -Wstack-usage=@var{len} -Wstrict-aliasing @gol
275 -Wstrict-aliasing=n @gol -Wstrict-overflow -Wstrict-overflow=@var{n} @gol
276 -Wsuggest-attribute=@r{[}pure@r{|}const@r{|}noreturn@r{|}format@r{]} @gol
277 -Wsuggest-final-types @gol -Wsuggest-final-methods @gol
278 -Wmissing-format-attribute @gol
279 -Wswitch -Wswitch-default -Wswitch-enum -Wswitch-bool -Wsync-nand @gol
280 -Wsystem-headers -Wtrampolines -Wtrigraphs -Wtype-limits -Wundef @gol
281 -Wuninitialized -Wunknown-pragmas -Wno-pragmas @gol
282 -Wunsuffixed-float-constants -Wunused -Wunused-function @gol
283 -Wunused-label -Wunused-local-typedefs -Wunused-parameter @gol
284 -Wno-unused-result -Wunused-value @gol -Wunused-variable @gol
285 -Wunused-but-set-parameter -Wunused-but-set-variable @gol
286 -Wuseless-cast -Wvariadic-macros -Wvector-operation-performance @gol
287 -Wvla -Wvolatile-register-var -Wwrite-strings -Wzero-as-null-pointer-constant}
288
289 @item C and Objective-C-only Warning Options
290 @gccoptlist{-Wbad-function-cast -Wmissing-declarations @gol
291 -Wmissing-parameter-type -Wmissing-prototypes -Wnested-externs @gol
292 -Wold-style-declaration -Wold-style-definition @gol
293 -Wstrict-prototypes -Wtraditional -Wtraditional-conversion @gol
294 -Wdeclaration-after-statement -Wpointer-sign}
295
296 @item Debugging Options
297 @xref{Debugging Options,,Options for Debugging Your Program or GCC}.
298 @gccoptlist{-d@var{letters} -dumpspecs -dumpmachine -dumpversion @gol
299 -fsanitize=@var{style} -fsanitize-recover -fsanitize-recover=@var{style} @gol
300 -fasan-shadow-offset=@var{number} -fsanitize-undefined-trap-on-error @gol
301 -fdbg-cnt-list -fdbg-cnt=@var{counter-value-list} @gol
302 -fdisable-ipa-@var{pass_name} @gol
303 -fdisable-rtl-@var{pass_name} @gol
304 -fdisable-rtl-@var{pass-name}=@var{range-list} @gol
305 -fdisable-tree-@var{pass_name} @gol
306 -fdisable-tree-@var{pass-name}=@var{range-list} @gol
307 -fdump-noaddr -fdump-unnumbered -fdump-unnumbered-links @gol
308 -fdump-translation-unit@r{[}-@var{n}@r{]} @gol
309 -fdump-class-hierarchy@r{[}-@var{n}@r{]} @gol
310 -fdump-ipa-all -fdump-ipa-cgraph -fdump-ipa-inline @gol
311 -fdump-passes @gol
312 -fdump-statistics @gol
313 -fdump-tree-all @gol
314 -fdump-tree-original@r{[}-@var{n}@r{]} @gol
315 -fdump-tree-optimized@r{[}-@var{n}@r{]} @gol
316 -fdump-tree-cfg -fdump-tree-alias @gol
317 -fdump-tree-ch @gol
318 -fdump-tree-ssa@r{[}-@var{n}@r{]} -fdump-tree-pre@r{[}-@var{n}@r{]} @gol
319 -fdump-tree-ccp@r{[}-@var{n}@r{]} -fdump-tree-dce@r{[}-@var{n}@r{]} @gol
320 -fdump-tree-gimple@r{[}-raw@r{]} @gol
321 -fdump-tree-dom@r{[}-@var{n}@r{]} @gol
322 -fdump-tree-dse@r{[}-@var{n}@r{]} @gol
323 -fdump-tree-phiprop@r{[}-@var{n}@r{]} @gol
324 -fdump-tree-phiopt@r{[}-@var{n}@r{]} @gol
325 -fdump-tree-forwprop@r{[}-@var{n}@r{]} @gol
326 -fdump-tree-copyrename@r{[}-@var{n}@r{]} @gol
327 -fdump-tree-nrv -fdump-tree-vect @gol
328 -fdump-tree-sink @gol
329 -fdump-tree-sra@r{[}-@var{n}@r{]} @gol
330 -fdump-tree-forwprop@r{[}-@var{n}@r{]} @gol
331 -fdump-tree-fre@r{[}-@var{n}@r{]} @gol
332 -fdump-tree-vtable-verify @gol
333 -fdump-tree-vrp@r{[}-@var{n}@r{]} @gol
334 -fdump-tree-storeccp@r{[}-@var{n}@r{]} @gol
335 -fdump-final-insns=@var{file} @gol
336 -fcompare-debug@r{[}=@var{opts}@r{]} -fcompare-debug-second @gol
337 -feliminate-dwarf2-dups -fno-eliminate-unused-debug-types @gol
338 -feliminate-unused-debug-symbols -femit-class-debug-always @gol
339 -fenable-@var{kind}-@var{pass} @gol
340 -fenable-@var{kind}-@var{pass}=@var{range-list} @gol
341 -fdebug-types-section -fmem-report-wpa @gol
342 -fmem-report -fpre-ipa-mem-report -fpost-ipa-mem-report -fprofile-arcs @gol
343 -fopt-info @gol
344 -fopt-info-@var{options}@r{[}=@var{file}@r{]} @gol
345 -frandom-seed=@var{number} -fsched-verbose=@var{n} @gol
346 -fsel-sched-verbose -fsel-sched-dump-cfg -fsel-sched-pipelining-verbose @gol
347 -fstack-usage -ftest-coverage -ftime-report -fvar-tracking @gol
348 -fvar-tracking-assignments -fvar-tracking-assignments-toggle @gol
349 -g -g@var{level} -gtoggle -gcoff -gdwarf-@var{version} @gol
350 -ggdb -grecord-gcc-switches -gno-record-gcc-switches @gol
351 -gstabs -gstabs+ -gstrict-dwarf -gno-strict-dwarf @gol
352 -gvms -gxcoff -gxcoff+ -gz@r{[}=@var{type}@r{]} @gol
353 -fno-merge-debug-strings -fno-dwarf2-cfi-asm @gol
354 -fdebug-prefix-map=@var{old}=@var{new} @gol
355 -femit-struct-debug-baseonly -femit-struct-debug-reduced @gol
356 -femit-struct-debug-detailed@r{[}=@var{spec-list}@r{]} @gol
357 -p -pg -print-file-name=@var{library} -print-libgcc-file-name @gol
358 -print-multi-directory -print-multi-lib -print-multi-os-directory @gol
359 -print-prog-name=@var{program} -print-search-dirs -Q @gol
360 -print-sysroot -print-sysroot-headers-suffix @gol
361 -save-temps -save-temps=cwd -save-temps=obj -time@r{[}=@var{file}@r{]}}
362
363 @item Optimization Options
364 @xref{Optimize Options,,Options that Control Optimization}.
365 @gccoptlist{-faggressive-loop-optimizations -falign-functions[=@var{n}] @gol
366 -falign-jumps[=@var{n}] @gol
367 -falign-labels[=@var{n}] -falign-loops[=@var{n}] @gol
368 -fassociative-math -fauto-profile -fauto-profile[=@var{path}] @gol
369 -fauto-inc-dec -fbranch-probabilities @gol
370 -fbranch-target-load-optimize -fbranch-target-load-optimize2 @gol
371 -fbtr-bb-exclusive -fcaller-saves @gol
372 -fcheck-data-deps -fcombine-stack-adjustments -fconserve-stack @gol
373 -fcompare-elim -fcprop-registers -fcrossjumping @gol
374 -fcse-follow-jumps -fcse-skip-blocks -fcx-fortran-rules @gol
375 -fcx-limited-range @gol
376 -fdata-sections -fdce -fdelayed-branch @gol
377 -fdelete-null-pointer-checks -fdevirtualize -fdevirtualize-speculatively -fdse @gol
378 -fearly-inlining -fipa-sra -fexpensive-optimizations -ffat-lto-objects @gol
379 -ffast-math -ffinite-math-only -ffloat-store -fexcess-precision=@var{style} @gol
380 -fforward-propagate -ffp-contract=@var{style} -ffunction-sections @gol
381 -fgcse -fgcse-after-reload -fgcse-las -fgcse-lm -fgraphite-identity @gol
382 -fgcse-sm -fhoist-adjacent-loads -fif-conversion @gol
383 -fif-conversion2 -findirect-inlining @gol
384 -finline-functions -finline-functions-called-once -finline-limit=@var{n} @gol
385 -finline-small-functions -fipa-cp -fipa-cp-clone @gol
386 -fipa-pta -fipa-profile -fipa-pure-const -fipa-reference -fipa-icf @gol
387 -fira-algorithm=@var{algorithm} @gol
388 -fira-region=@var{region} -fira-hoist-pressure @gol
389 -fira-loop-pressure -fno-ira-share-save-slots @gol
390 -fno-ira-share-spill-slots -fira-verbose=@var{n} @gol
391 -fisolate-erroneous-paths-dereference -fisolate-erroneous-paths-attribute @gol
392 -fivopts -fkeep-inline-functions -fkeep-static-consts -flive-range-shrinkage @gol
393 -floop-block -floop-interchange -floop-strip-mine -floop-nest-optimize @gol
394 -floop-parallelize-all -flto -flto-compression-level @gol
395 -flto-partition=@var{alg} -flto-report -flto-report-wpa -fmerge-all-constants @gol
396 -fmerge-constants -fmodulo-sched -fmodulo-sched-allow-regmoves @gol
397 -fmove-loop-invariants -fno-branch-count-reg @gol
398 -fno-defer-pop -fno-function-cse -fno-guess-branch-probability @gol
399 -fno-inline -fno-math-errno -fno-peephole -fno-peephole2 @gol
400 -fno-sched-interblock -fno-sched-spec -fno-signed-zeros @gol
401 -fno-toplevel-reorder -fno-trapping-math -fno-zero-initialized-in-bss @gol
402 -fomit-frame-pointer -foptimize-sibling-calls @gol
403 -fpartial-inlining -fpeel-loops -fpredictive-commoning @gol
404 -fprefetch-loop-arrays -fprofile-report @gol
405 -fprofile-correction -fprofile-dir=@var{path} -fprofile-generate @gol
406 -fprofile-generate=@var{path} @gol
407 -fprofile-use -fprofile-use=@var{path} -fprofile-values -fprofile-reorder-functions @gol
408 -freciprocal-math -free -frename-registers -freorder-blocks @gol
409 -freorder-blocks-and-partition -freorder-functions @gol
410 -frerun-cse-after-loop -freschedule-modulo-scheduled-loops @gol
411 -frounding-math -fsched2-use-superblocks -fsched-pressure @gol
412 -fsched-spec-load -fsched-spec-load-dangerous @gol
413 -fsched-stalled-insns-dep[=@var{n}] -fsched-stalled-insns[=@var{n}] @gol
414 -fsched-group-heuristic -fsched-critical-path-heuristic @gol
415 -fsched-spec-insn-heuristic -fsched-rank-heuristic @gol
416 -fsched-last-insn-heuristic -fsched-dep-count-heuristic @gol
417 -fschedule-insns -fschedule-insns2 -fsection-anchors @gol
418 -fselective-scheduling -fselective-scheduling2 @gol
419 -fsel-sched-pipelining -fsel-sched-pipelining-outer-loops @gol
420 -fsemantic-interposition @gol
421 -fshrink-wrap -fsignaling-nans -fsingle-precision-constant @gol
422 -fsplit-ivs-in-unroller -fsplit-wide-types -fssa-phiopt -fstack-protector @gol
423 -fstack-protector-all -fstack-protector-strong -fstrict-aliasing @gol
424 -fstrict-overflow -fthread-jumps -ftracer -ftree-bit-ccp @gol
425 -ftree-builtin-call-dce -ftree-ccp -ftree-ch @gol
426 -ftree-coalesce-inline-vars -ftree-coalesce-vars -ftree-copy-prop @gol
427 -ftree-copyrename -ftree-dce -ftree-dominator-opts -ftree-dse @gol
428 -ftree-forwprop -ftree-fre -ftree-loop-if-convert @gol
429 -ftree-loop-if-convert-stores -ftree-loop-im @gol
430 -ftree-phiprop -ftree-loop-distribution -ftree-loop-distribute-patterns @gol
431 -ftree-loop-ivcanon -ftree-loop-linear -ftree-loop-optimize @gol
432 -ftree-loop-vectorize @gol
433 -ftree-parallelize-loops=@var{n} -ftree-pre -ftree-partial-pre -ftree-pta @gol
434 -ftree-reassoc -ftree-sink -ftree-slsr -ftree-sra @gol
435 -ftree-switch-conversion -ftree-tail-merge -ftree-ter @gol
436 -ftree-vectorize -ftree-vrp @gol
437 -funit-at-a-time -funroll-all-loops -funroll-loops @gol
438 -funsafe-loop-optimizations -funsafe-math-optimizations -funswitch-loops @gol
439 -fuse-caller-save -fvariable-expansion-in-unroller -fvect-cost-model -fvpt @gol
440 -fweb -fwhole-program -fwpa -fuse-ld=@var{linker} -fuse-linker-plugin @gol
441 --param @var{name}=@var{value}
442 -O -O0 -O1 -O2 -O3 -Os -Ofast -Og}
443
444 @item Preprocessor Options
445 @xref{Preprocessor Options,,Options Controlling the Preprocessor}.
446 @gccoptlist{-A@var{question}=@var{answer} @gol
447 -A-@var{question}@r{[}=@var{answer}@r{]} @gol
448 -C -dD -dI -dM -dN @gol
449 -D@var{macro}@r{[}=@var{defn}@r{]} -E -H @gol
450 -idirafter @var{dir} @gol
451 -include @var{file} -imacros @var{file} @gol
452 -iprefix @var{file} -iwithprefix @var{dir} @gol
453 -iwithprefixbefore @var{dir} -isystem @var{dir} @gol
454 -imultilib @var{dir} -isysroot @var{dir} @gol
455 -M -MM -MF -MG -MP -MQ -MT -nostdinc @gol
456 -P -fdebug-cpp -ftrack-macro-expansion -fworking-directory @gol
457 -remap -trigraphs -undef -U@var{macro} @gol
458 -Wp,@var{option} -Xpreprocessor @var{option} -no-integrated-cpp}
459
460 @item Assembler Option
461 @xref{Assembler Options,,Passing Options to the Assembler}.
462 @gccoptlist{-Wa,@var{option} -Xassembler @var{option}}
463
464 @item Linker Options
465 @xref{Link Options,,Options for Linking}.
466 @gccoptlist{@var{object-file-name} -l@var{library} @gol
467 -nostartfiles -nodefaultlibs -nostdlib -pie -rdynamic @gol
468 -s -static -static-libgcc -static-libstdc++ @gol
469 -static-libasan -static-libtsan -static-liblsan -static-libubsan @gol
470 -shared -shared-libgcc -symbolic @gol
471 -T @var{script} -Wl,@var{option} -Xlinker @var{option} @gol
472 -u @var{symbol} -z @var{keyword}}
473
474 @item Directory Options
475 @xref{Directory Options,,Options for Directory Search}.
476 @gccoptlist{-B@var{prefix} -I@var{dir} -iplugindir=@var{dir} @gol
477 -iquote@var{dir} -L@var{dir} -specs=@var{file} -I- @gol
478 --sysroot=@var{dir} --no-sysroot-suffix}
479
480 @item Machine Dependent Options
481 @xref{Submodel Options,,Hardware Models and Configurations}.
482 @c This list is ordered alphanumerically by subsection name.
483 @c Try and put the significant identifier (CPU or system) first,
484 @c so users have a clue at guessing where the ones they want will be.
485
486 @emph{AArch64 Options}
487 @gccoptlist{-mabi=@var{name} -mbig-endian -mlittle-endian @gol
488 -mgeneral-regs-only @gol
489 -mcmodel=tiny -mcmodel=small -mcmodel=large @gol
490 -mstrict-align @gol
491 -momit-leaf-frame-pointer -mno-omit-leaf-frame-pointer @gol
492 -mtls-dialect=desc -mtls-dialect=traditional @gol
493 -mfix-cortex-a53-835769 -mno-fix-cortex-a53-835769 @gol
494 -march=@var{name} -mcpu=@var{name} -mtune=@var{name}}
495
496 @emph{Adapteva Epiphany Options}
497 @gccoptlist{-mhalf-reg-file -mprefer-short-insn-regs @gol
498 -mbranch-cost=@var{num} -mcmove -mnops=@var{num} -msoft-cmpsf @gol
499 -msplit-lohi -mpost-inc -mpost-modify -mstack-offset=@var{num} @gol
500 -mround-nearest -mlong-calls -mshort-calls -msmall16 @gol
501 -mfp-mode=@var{mode} -mvect-double -max-vect-align=@var{num} @gol
502 -msplit-vecmove-early -m1reg-@var{reg}}
503
504 @emph{ARC Options}
505 @gccoptlist{-mbarrel-shifter @gol
506 -mcpu=@var{cpu} -mA6 -mARC600 -mA7 -mARC700 @gol
507 -mdpfp -mdpfp-compact -mdpfp-fast -mno-dpfp-lrsr @gol
508 -mea -mno-mpy -mmul32x16 -mmul64 @gol
509 -mnorm -mspfp -mspfp-compact -mspfp-fast -msimd -msoft-float -mswap @gol
510 -mcrc -mdsp-packa -mdvbf -mlock -mmac-d16 -mmac-24 -mrtsc -mswape @gol
511 -mtelephony -mxy -misize -mannotate-align -marclinux -marclinux_prof @gol
512 -mepilogue-cfi -mlong-calls -mmedium-calls -msdata @gol
513 -mucb-mcount -mvolatile-cache @gol
514 -malign-call -mauto-modify-reg -mbbit-peephole -mno-brcc @gol
515 -mcase-vector-pcrel -mcompact-casesi -mno-cond-exec -mearly-cbranchsi @gol
516 -mexpand-adddi -mindexed-loads -mlra -mlra-priority-none @gol
517 -mlra-priority-compact mlra-priority-noncompact -mno-millicode @gol
518 -mmixed-code -mq-class -mRcq -mRcw -msize-level=@var{level} @gol
519 -mtune=@var{cpu} -mmultcost=@var{num} -munalign-prob-threshold=@var{probability}}
520
521 @emph{ARM Options}
522 @gccoptlist{-mapcs-frame -mno-apcs-frame @gol
523 -mabi=@var{name} @gol
524 -mapcs-stack-check -mno-apcs-stack-check @gol
525 -mapcs-float -mno-apcs-float @gol
526 -mapcs-reentrant -mno-apcs-reentrant @gol
527 -msched-prolog -mno-sched-prolog @gol
528 -mlittle-endian -mbig-endian @gol
529 -mfloat-abi=@var{name} @gol
530 -mfp16-format=@var{name}
531 -mthumb-interwork -mno-thumb-interwork @gol
532 -mcpu=@var{name} -march=@var{name} -mfpu=@var{name} @gol
533 -mstructure-size-boundary=@var{n} @gol
534 -mabort-on-noreturn @gol
535 -mlong-calls -mno-long-calls @gol
536 -msingle-pic-base -mno-single-pic-base @gol
537 -mpic-register=@var{reg} @gol
538 -mnop-fun-dllimport @gol
539 -mpoke-function-name @gol
540 -mthumb -marm @gol
541 -mtpcs-frame -mtpcs-leaf-frame @gol
542 -mcaller-super-interworking -mcallee-super-interworking @gol
543 -mtp=@var{name} -mtls-dialect=@var{dialect} @gol
544 -mword-relocations @gol
545 -mfix-cortex-m3-ldrd @gol
546 -munaligned-access @gol
547 -mneon-for-64bits @gol
548 -mslow-flash-data @gol
549 -mrestrict-it}
550
551 @emph{AVR Options}
552 @gccoptlist{-mmcu=@var{mcu} -maccumulate-args -mbranch-cost=@var{cost} @gol
553 -mcall-prologues -mint8 -mno-interrupts -mrelax @gol
554 -mstrict-X -mtiny-stack -Waddr-space-convert}
555
556 @emph{Blackfin Options}
557 @gccoptlist{-mcpu=@var{cpu}@r{[}-@var{sirevision}@r{]} @gol
558 -msim -momit-leaf-frame-pointer -mno-omit-leaf-frame-pointer @gol
559 -mspecld-anomaly -mno-specld-anomaly -mcsync-anomaly -mno-csync-anomaly @gol
560 -mlow-64k -mno-low64k -mstack-check-l1 -mid-shared-library @gol
561 -mno-id-shared-library -mshared-library-id=@var{n} @gol
562 -mleaf-id-shared-library -mno-leaf-id-shared-library @gol
563 -msep-data -mno-sep-data -mlong-calls -mno-long-calls @gol
564 -mfast-fp -minline-plt -mmulticore -mcorea -mcoreb -msdram @gol
565 -micplb}
566
567 @emph{C6X Options}
568 @gccoptlist{-mbig-endian -mlittle-endian -march=@var{cpu} @gol
569 -msim -msdata=@var{sdata-type}}
570
571 @emph{CRIS Options}
572 @gccoptlist{-mcpu=@var{cpu} -march=@var{cpu} -mtune=@var{cpu} @gol
573 -mmax-stack-frame=@var{n} -melinux-stacksize=@var{n} @gol
574 -metrax4 -metrax100 -mpdebug -mcc-init -mno-side-effects @gol
575 -mstack-align -mdata-align -mconst-align @gol
576 -m32-bit -m16-bit -m8-bit -mno-prologue-epilogue -mno-gotplt @gol
577 -melf -maout -melinux -mlinux -sim -sim2 @gol
578 -mmul-bug-workaround -mno-mul-bug-workaround}
579
580 @emph{CR16 Options}
581 @gccoptlist{-mmac @gol
582 -mcr16cplus -mcr16c @gol
583 -msim -mint32 -mbit-ops
584 -mdata-model=@var{model}}
585
586 @emph{Darwin Options}
587 @gccoptlist{-all_load -allowable_client -arch -arch_errors_fatal @gol
588 -arch_only -bind_at_load -bundle -bundle_loader @gol
589 -client_name -compatibility_version -current_version @gol
590 -dead_strip @gol
591 -dependency-file -dylib_file -dylinker_install_name @gol
592 -dynamic -dynamiclib -exported_symbols_list @gol
593 -filelist -flat_namespace -force_cpusubtype_ALL @gol
594 -force_flat_namespace -headerpad_max_install_names @gol
595 -iframework @gol
596 -image_base -init -install_name -keep_private_externs @gol
597 -multi_module -multiply_defined -multiply_defined_unused @gol
598 -noall_load -no_dead_strip_inits_and_terms @gol
599 -nofixprebinding -nomultidefs -noprebind -noseglinkedit @gol
600 -pagezero_size -prebind -prebind_all_twolevel_modules @gol
601 -private_bundle -read_only_relocs -sectalign @gol
602 -sectobjectsymbols -whyload -seg1addr @gol
603 -sectcreate -sectobjectsymbols -sectorder @gol
604 -segaddr -segs_read_only_addr -segs_read_write_addr @gol
605 -seg_addr_table -seg_addr_table_filename -seglinkedit @gol
606 -segprot -segs_read_only_addr -segs_read_write_addr @gol
607 -single_module -static -sub_library -sub_umbrella @gol
608 -twolevel_namespace -umbrella -undefined @gol
609 -unexported_symbols_list -weak_reference_mismatches @gol
610 -whatsloaded -F -gused -gfull -mmacosx-version-min=@var{version} @gol
611 -mkernel -mone-byte-bool}
612
613 @emph{DEC Alpha Options}
614 @gccoptlist{-mno-fp-regs -msoft-float @gol
615 -mieee -mieee-with-inexact -mieee-conformant @gol
616 -mfp-trap-mode=@var{mode} -mfp-rounding-mode=@var{mode} @gol
617 -mtrap-precision=@var{mode} -mbuild-constants @gol
618 -mcpu=@var{cpu-type} -mtune=@var{cpu-type} @gol
619 -mbwx -mmax -mfix -mcix @gol
620 -mfloat-vax -mfloat-ieee @gol
621 -mexplicit-relocs -msmall-data -mlarge-data @gol
622 -msmall-text -mlarge-text @gol
623 -mmemory-latency=@var{time}}
624
625 @emph{FR30 Options}
626 @gccoptlist{-msmall-model -mno-lsim}
627
628 @emph{FRV Options}
629 @gccoptlist{-mgpr-32 -mgpr-64 -mfpr-32 -mfpr-64 @gol
630 -mhard-float -msoft-float @gol
631 -malloc-cc -mfixed-cc -mdword -mno-dword @gol
632 -mdouble -mno-double @gol
633 -mmedia -mno-media -mmuladd -mno-muladd @gol
634 -mfdpic -minline-plt -mgprel-ro -multilib-library-pic @gol
635 -mlinked-fp -mlong-calls -malign-labels @gol
636 -mlibrary-pic -macc-4 -macc-8 @gol
637 -mpack -mno-pack -mno-eflags -mcond-move -mno-cond-move @gol
638 -moptimize-membar -mno-optimize-membar @gol
639 -mscc -mno-scc -mcond-exec -mno-cond-exec @gol
640 -mvliw-branch -mno-vliw-branch @gol
641 -mmulti-cond-exec -mno-multi-cond-exec -mnested-cond-exec @gol
642 -mno-nested-cond-exec -mtomcat-stats @gol
643 -mTLS -mtls @gol
644 -mcpu=@var{cpu}}
645
646 @emph{GNU/Linux Options}
647 @gccoptlist{-mglibc -muclibc -mbionic -mandroid @gol
648 -tno-android-cc -tno-android-ld}
649
650 @emph{H8/300 Options}
651 @gccoptlist{-mrelax -mh -ms -mn -mexr -mno-exr -mint32 -malign-300}
652
653 @emph{HPPA Options}
654 @gccoptlist{-march=@var{architecture-type} @gol
655 -mdisable-fpregs -mdisable-indexing @gol
656 -mfast-indirect-calls -mgas -mgnu-ld -mhp-ld @gol
657 -mfixed-range=@var{register-range} @gol
658 -mjump-in-delay -mlinker-opt -mlong-calls @gol
659 -mlong-load-store -mno-disable-fpregs @gol
660 -mno-disable-indexing -mno-fast-indirect-calls -mno-gas @gol
661 -mno-jump-in-delay -mno-long-load-store @gol
662 -mno-portable-runtime -mno-soft-float @gol
663 -mno-space-regs -msoft-float -mpa-risc-1-0 @gol
664 -mpa-risc-1-1 -mpa-risc-2-0 -mportable-runtime @gol
665 -mschedule=@var{cpu-type} -mspace-regs -msio -mwsio @gol
666 -munix=@var{unix-std} -nolibdld -static -threads}
667
668 @emph{i386 and x86-64 Options}
669 @gccoptlist{-mtune=@var{cpu-type} -march=@var{cpu-type} @gol
670 -mtune-ctrl=@var{feature-list} -mdump-tune-features -mno-default @gol
671 -mfpmath=@var{unit} @gol
672 -masm=@var{dialect} -mno-fancy-math-387 @gol
673 -mno-fp-ret-in-387 -msoft-float @gol
674 -mno-wide-multiply -mrtd -malign-double @gol
675 -mpreferred-stack-boundary=@var{num} @gol
676 -mincoming-stack-boundary=@var{num} @gol
677 -mcld -mcx16 -msahf -mmovbe -mcrc32 @gol
678 -mrecip -mrecip=@var{opt} @gol
679 -mvzeroupper -mprefer-avx128 @gol
680 -mmmx -msse -msse2 -msse3 -mssse3 -msse4.1 -msse4.2 -msse4 -mavx @gol
681 -mavx2 -mavx512f -mavx512pf -mavx512er -mavx512cd -msha @gol
682 -maes -mpclmul -mfsgsbase -mrdrnd -mf16c -mfma -mprefetchwt1 @gol
683 -mclflushopt -mxsavec -mxsaves @gol
684 -msse4a -m3dnow -mpopcnt -mabm -mbmi -mtbm -mfma4 -mxop -mlzcnt @gol
685 -mbmi2 -mfxsr -mxsave -mxsaveopt -mrtm -mlwp -mthreads @gol
686 -mno-align-stringops -minline-all-stringops @gol
687 -minline-stringops-dynamically -mstringop-strategy=@var{alg} @gol
688 -mmemcpy-strategy=@var{strategy} -mmemset-strategy=@var{strategy}
689 -mpush-args -maccumulate-outgoing-args -m128bit-long-double @gol
690 -m96bit-long-double -mlong-double-64 -mlong-double-80 -mlong-double-128 @gol
691 -mregparm=@var{num} -msseregparm @gol
692 -mveclibabi=@var{type} -mvect8-ret-in-mem @gol
693 -mpc32 -mpc64 -mpc80 -mstackrealign @gol
694 -momit-leaf-frame-pointer -mno-red-zone -mno-tls-direct-seg-refs @gol
695 -mcmodel=@var{code-model} -mabi=@var{name} -maddress-mode=@var{mode} @gol
696 -m32 -m64 -mx32 -m16 -mlarge-data-threshold=@var{num} @gol
697 -msse2avx -mfentry -mrecord-mcount -mnop-mcount -m8bit-idiv @gol
698 -mavx256-split-unaligned-load -mavx256-split-unaligned-store @gol
699 -mstack-protector-guard=@var{guard}}
700
701 @emph{i386 and x86-64 Windows Options}
702 @gccoptlist{-mconsole -mcygwin -mno-cygwin -mdll @gol
703 -mnop-fun-dllimport -mthread @gol
704 -municode -mwin32 -mwindows -fno-set-stack-executable}
705
706 @emph{IA-64 Options}
707 @gccoptlist{-mbig-endian -mlittle-endian -mgnu-as -mgnu-ld -mno-pic @gol
708 -mvolatile-asm-stop -mregister-names -msdata -mno-sdata @gol
709 -mconstant-gp -mauto-pic -mfused-madd @gol
710 -minline-float-divide-min-latency @gol
711 -minline-float-divide-max-throughput @gol
712 -mno-inline-float-divide @gol
713 -minline-int-divide-min-latency @gol
714 -minline-int-divide-max-throughput @gol
715 -mno-inline-int-divide @gol
716 -minline-sqrt-min-latency -minline-sqrt-max-throughput @gol
717 -mno-inline-sqrt @gol
718 -mdwarf2-asm -mearly-stop-bits @gol
719 -mfixed-range=@var{register-range} -mtls-size=@var{tls-size} @gol
720 -mtune=@var{cpu-type} -milp32 -mlp64 @gol
721 -msched-br-data-spec -msched-ar-data-spec -msched-control-spec @gol
722 -msched-br-in-data-spec -msched-ar-in-data-spec -msched-in-control-spec @gol
723 -msched-spec-ldc -msched-spec-control-ldc @gol
724 -msched-prefer-non-data-spec-insns -msched-prefer-non-control-spec-insns @gol
725 -msched-stop-bits-after-every-cycle -msched-count-spec-in-critical-path @gol
726 -msel-sched-dont-check-control-spec -msched-fp-mem-deps-zero-cost @gol
727 -msched-max-memory-insns-hard-limit -msched-max-memory-insns=@var{max-insns}}
728
729 @emph{LM32 Options}
730 @gccoptlist{-mbarrel-shift-enabled -mdivide-enabled -mmultiply-enabled @gol
731 -msign-extend-enabled -muser-enabled}
732
733 @emph{M32R/D Options}
734 @gccoptlist{-m32r2 -m32rx -m32r @gol
735 -mdebug @gol
736 -malign-loops -mno-align-loops @gol
737 -missue-rate=@var{number} @gol
738 -mbranch-cost=@var{number} @gol
739 -mmodel=@var{code-size-model-type} @gol
740 -msdata=@var{sdata-type} @gol
741 -mno-flush-func -mflush-func=@var{name} @gol
742 -mno-flush-trap -mflush-trap=@var{number} @gol
743 -G @var{num}}
744
745 @emph{M32C Options}
746 @gccoptlist{-mcpu=@var{cpu} -msim -memregs=@var{number}}
747
748 @emph{M680x0 Options}
749 @gccoptlist{-march=@var{arch} -mcpu=@var{cpu} -mtune=@var{tune}
750 -m68000 -m68020 -m68020-40 -m68020-60 -m68030 -m68040 @gol
751 -m68060 -mcpu32 -m5200 -m5206e -m528x -m5307 -m5407 @gol
752 -mcfv4e -mbitfield -mno-bitfield -mc68000 -mc68020 @gol
753 -mnobitfield -mrtd -mno-rtd -mdiv -mno-div -mshort @gol
754 -mno-short -mhard-float -m68881 -msoft-float -mpcrel @gol
755 -malign-int -mstrict-align -msep-data -mno-sep-data @gol
756 -mshared-library-id=n -mid-shared-library -mno-id-shared-library @gol
757 -mxgot -mno-xgot}
758
759 @emph{MCore Options}
760 @gccoptlist{-mhardlit -mno-hardlit -mdiv -mno-div -mrelax-immediates @gol
761 -mno-relax-immediates -mwide-bitfields -mno-wide-bitfields @gol
762 -m4byte-functions -mno-4byte-functions -mcallgraph-data @gol
763 -mno-callgraph-data -mslow-bytes -mno-slow-bytes -mno-lsim @gol
764 -mlittle-endian -mbig-endian -m210 -m340 -mstack-increment}
765
766 @emph{MeP Options}
767 @gccoptlist{-mabsdiff -mall-opts -maverage -mbased=@var{n} -mbitops @gol
768 -mc=@var{n} -mclip -mconfig=@var{name} -mcop -mcop32 -mcop64 -mivc2 @gol
769 -mdc -mdiv -meb -mel -mio-volatile -ml -mleadz -mm -mminmax @gol
770 -mmult -mno-opts -mrepeat -ms -msatur -msdram -msim -msimnovec -mtf @gol
771 -mtiny=@var{n}}
772
773 @emph{MicroBlaze Options}
774 @gccoptlist{-msoft-float -mhard-float -msmall-divides -mcpu=@var{cpu} @gol
775 -mmemcpy -mxl-soft-mul -mxl-soft-div -mxl-barrel-shift @gol
776 -mxl-pattern-compare -mxl-stack-check -mxl-gp-opt -mno-clearbss @gol
777 -mxl-multiply-high -mxl-float-convert -mxl-float-sqrt @gol
778 -mbig-endian -mlittle-endian -mxl-reorder -mxl-mode-@var{app-model}}
779
780 @emph{MIPS Options}
781 @gccoptlist{-EL -EB -march=@var{arch} -mtune=@var{arch} @gol
782 -mips1 -mips2 -mips3 -mips4 -mips32 -mips32r2 -mips32r3 -mips32r5 @gol
783 -mips64 -mips64r2 -mips64r3 -mips64r5 @gol
784 -mips16 -mno-mips16 -mflip-mips16 @gol
785 -minterlink-compressed -mno-interlink-compressed @gol
786 -minterlink-mips16 -mno-interlink-mips16 @gol
787 -mabi=@var{abi} -mabicalls -mno-abicalls @gol
788 -mshared -mno-shared -mplt -mno-plt -mxgot -mno-xgot @gol
789 -mgp32 -mgp64 -mfp32 -mfp64 -mhard-float -msoft-float @gol
790 -mno-float -msingle-float -mdouble-float @gol
791 -mabs=@var{mode} -mnan=@var{encoding} @gol
792 -mdsp -mno-dsp -mdspr2 -mno-dspr2 @gol
793 -mmcu -mmno-mcu @gol
794 -meva -mno-eva @gol
795 -mvirt -mno-virt @gol
796 -mxpa -mno-xpa @gol
797 -mmicromips -mno-micromips @gol
798 -mfpu=@var{fpu-type} @gol
799 -msmartmips -mno-smartmips @gol
800 -mpaired-single -mno-paired-single -mdmx -mno-mdmx @gol
801 -mips3d -mno-mips3d -mmt -mno-mt -mllsc -mno-llsc @gol
802 -mlong64 -mlong32 -msym32 -mno-sym32 @gol
803 -G@var{num} -mlocal-sdata -mno-local-sdata @gol
804 -mextern-sdata -mno-extern-sdata -mgpopt -mno-gopt @gol
805 -membedded-data -mno-embedded-data @gol
806 -muninit-const-in-rodata -mno-uninit-const-in-rodata @gol
807 -mcode-readable=@var{setting} @gol
808 -msplit-addresses -mno-split-addresses @gol
809 -mexplicit-relocs -mno-explicit-relocs @gol
810 -mcheck-zero-division -mno-check-zero-division @gol
811 -mdivide-traps -mdivide-breaks @gol
812 -mmemcpy -mno-memcpy -mlong-calls -mno-long-calls @gol
813 -mmad -mno-mad -mimadd -mno-imadd -mfused-madd -mno-fused-madd -nocpp @gol
814 -mfix-24k -mno-fix-24k @gol
815 -mfix-r4000 -mno-fix-r4000 -mfix-r4400 -mno-fix-r4400 @gol
816 -mfix-r10000 -mno-fix-r10000 -mfix-rm7000 -mno-fix-rm7000 @gol
817 -mfix-vr4120 -mno-fix-vr4120 @gol
818 -mfix-vr4130 -mno-fix-vr4130 -mfix-sb1 -mno-fix-sb1 @gol
819 -mflush-func=@var{func} -mno-flush-func @gol
820 -mbranch-cost=@var{num} -mbranch-likely -mno-branch-likely @gol
821 -mfp-exceptions -mno-fp-exceptions @gol
822 -mvr4130-align -mno-vr4130-align -msynci -mno-synci @gol
823 -mrelax-pic-calls -mno-relax-pic-calls -mmcount-ra-address}
824
825 @emph{MMIX Options}
826 @gccoptlist{-mlibfuncs -mno-libfuncs -mepsilon -mno-epsilon -mabi=gnu @gol
827 -mabi=mmixware -mzero-extend -mknuthdiv -mtoplevel-symbols @gol
828 -melf -mbranch-predict -mno-branch-predict -mbase-addresses @gol
829 -mno-base-addresses -msingle-exit -mno-single-exit}
830
831 @emph{MN10300 Options}
832 @gccoptlist{-mmult-bug -mno-mult-bug @gol
833 -mno-am33 -mam33 -mam33-2 -mam34 @gol
834 -mtune=@var{cpu-type} @gol
835 -mreturn-pointer-on-d0 @gol
836 -mno-crt0 -mrelax -mliw -msetlb}
837
838 @emph{Moxie Options}
839 @gccoptlist{-meb -mel -mno-crt0}
840
841 @emph{MSP430 Options}
842 @gccoptlist{-msim -masm-hex -mmcu= -mcpu= -mlarge -msmall -mrelax @gol
843 -mhwmult= -minrt}
844
845 @emph{NDS32 Options}
846 @gccoptlist{-mbig-endian -mlittle-endian @gol
847 -mreduced-regs -mfull-regs @gol
848 -mcmov -mno-cmov @gol
849 -mperf-ext -mno-perf-ext @gol
850 -mv3push -mno-v3push @gol
851 -m16bit -mno-16bit @gol
852 -mgp-direct -mno-gp-direct @gol
853 -misr-vector-size=@var{num} @gol
854 -mcache-block-size=@var{num} @gol
855 -march=@var{arch} @gol
856 -mforce-fp-as-gp -mforbid-fp-as-gp @gol
857 -mex9 -mctor-dtor -mrelax}
858
859 @emph{Nios II Options}
860 @gccoptlist{-G @var{num} -mgpopt -mno-gpopt -mel -meb @gol
861 -mno-bypass-cache -mbypass-cache @gol
862 -mno-cache-volatile -mcache-volatile @gol
863 -mno-fast-sw-div -mfast-sw-div @gol
864 -mhw-mul -mno-hw-mul -mhw-mulx -mno-hw-mulx -mno-hw-div -mhw-div @gol
865 -mcustom-@var{insn}=@var{N} -mno-custom-@var{insn} @gol
866 -mcustom-fpu-cfg=@var{name} @gol
867 -mhal -msmallc -msys-crt0=@var{name} -msys-lib=@var{name}}
868
869 @emph{PDP-11 Options}
870 @gccoptlist{-mfpu -msoft-float -mac0 -mno-ac0 -m40 -m45 -m10 @gol
871 -mbcopy -mbcopy-builtin -mint32 -mno-int16 @gol
872 -mint16 -mno-int32 -mfloat32 -mno-float64 @gol
873 -mfloat64 -mno-float32 -mabshi -mno-abshi @gol
874 -mbranch-expensive -mbranch-cheap @gol
875 -munix-asm -mdec-asm}
876
877 @emph{picoChip Options}
878 @gccoptlist{-mae=@var{ae_type} -mvliw-lookahead=@var{N} @gol
879 -msymbol-as-address -mno-inefficient-warnings}
880
881 @emph{PowerPC Options}
882 See RS/6000 and PowerPC Options.
883
884 @emph{RL78 Options}
885 @gccoptlist{-msim -mmul=none -mmul=g13 -mmul=rl78 @gol
886 -m64bit-doubles -m32bit-doubles}
887
888 @emph{RS/6000 and PowerPC Options}
889 @gccoptlist{-mcpu=@var{cpu-type} @gol
890 -mtune=@var{cpu-type} @gol
891 -mcmodel=@var{code-model} @gol
892 -mpowerpc64 @gol
893 -maltivec -mno-altivec @gol
894 -mpowerpc-gpopt -mno-powerpc-gpopt @gol
895 -mpowerpc-gfxopt -mno-powerpc-gfxopt @gol
896 -mmfcrf -mno-mfcrf -mpopcntb -mno-popcntb -mpopcntd -mno-popcntd @gol
897 -mfprnd -mno-fprnd @gol
898 -mcmpb -mno-cmpb -mmfpgpr -mno-mfpgpr -mhard-dfp -mno-hard-dfp @gol
899 -mfull-toc -mminimal-toc -mno-fp-in-toc -mno-sum-in-toc @gol
900 -m64 -m32 -mxl-compat -mno-xl-compat -mpe @gol
901 -malign-power -malign-natural @gol
902 -msoft-float -mhard-float -mmultiple -mno-multiple @gol
903 -msingle-float -mdouble-float -msimple-fpu @gol
904 -mstring -mno-string -mupdate -mno-update @gol
905 -mavoid-indexed-addresses -mno-avoid-indexed-addresses @gol
906 -mfused-madd -mno-fused-madd -mbit-align -mno-bit-align @gol
907 -mstrict-align -mno-strict-align -mrelocatable @gol
908 -mno-relocatable -mrelocatable-lib -mno-relocatable-lib @gol
909 -mtoc -mno-toc -mlittle -mlittle-endian -mbig -mbig-endian @gol
910 -mdynamic-no-pic -maltivec -mswdiv -msingle-pic-base @gol
911 -mprioritize-restricted-insns=@var{priority} @gol
912 -msched-costly-dep=@var{dependence_type} @gol
913 -minsert-sched-nops=@var{scheme} @gol
914 -mcall-sysv -mcall-netbsd @gol
915 -maix-struct-return -msvr4-struct-return @gol
916 -mabi=@var{abi-type} -msecure-plt -mbss-plt @gol
917 -mblock-move-inline-limit=@var{num} @gol
918 -misel -mno-isel @gol
919 -misel=yes -misel=no @gol
920 -mspe -mno-spe @gol
921 -mspe=yes -mspe=no @gol
922 -mpaired @gol
923 -mgen-cell-microcode -mwarn-cell-microcode @gol
924 -mvrsave -mno-vrsave @gol
925 -mmulhw -mno-mulhw @gol
926 -mdlmzb -mno-dlmzb @gol
927 -mfloat-gprs=yes -mfloat-gprs=no -mfloat-gprs=single -mfloat-gprs=double @gol
928 -mprototype -mno-prototype @gol
929 -msim -mmvme -mads -myellowknife -memb -msdata @gol
930 -msdata=@var{opt} -mvxworks -G @var{num} -pthread @gol
931 -mrecip -mrecip=@var{opt} -mno-recip -mrecip-precision @gol
932 -mno-recip-precision @gol
933 -mveclibabi=@var{type} -mfriz -mno-friz @gol
934 -mpointers-to-nested-functions -mno-pointers-to-nested-functions @gol
935 -msave-toc-indirect -mno-save-toc-indirect @gol
936 -mpower8-fusion -mno-mpower8-fusion -mpower8-vector -mno-power8-vector @gol
937 -mcrypto -mno-crypto -mdirect-move -mno-direct-move @gol
938 -mquad-memory -mno-quad-memory @gol
939 -mquad-memory-atomic -mno-quad-memory-atomic @gol
940 -mcompat-align-parm -mno-compat-align-parm}
941
942 @emph{RX Options}
943 @gccoptlist{-m64bit-doubles -m32bit-doubles -fpu -nofpu@gol
944 -mcpu=@gol
945 -mbig-endian-data -mlittle-endian-data @gol
946 -msmall-data @gol
947 -msim -mno-sim@gol
948 -mas100-syntax -mno-as100-syntax@gol
949 -mrelax@gol
950 -mmax-constant-size=@gol
951 -mint-register=@gol
952 -mpid@gol
953 -mno-warn-multiple-fast-interrupts@gol
954 -msave-acc-in-interrupts}
955
956 @emph{S/390 and zSeries Options}
957 @gccoptlist{-mtune=@var{cpu-type} -march=@var{cpu-type} @gol
958 -mhard-float -msoft-float -mhard-dfp -mno-hard-dfp @gol
959 -mlong-double-64 -mlong-double-128 @gol
960 -mbackchain -mno-backchain -mpacked-stack -mno-packed-stack @gol
961 -msmall-exec -mno-small-exec -mmvcle -mno-mvcle @gol
962 -m64 -m31 -mdebug -mno-debug -mesa -mzarch @gol
963 -mtpf-trace -mno-tpf-trace -mfused-madd -mno-fused-madd @gol
964 -mwarn-framesize -mwarn-dynamicstack -mstack-size -mstack-guard @gol
965 -mhotpatch[=@var{halfwords}] -mno-hotpatch}
966
967 @emph{Score Options}
968 @gccoptlist{-meb -mel @gol
969 -mnhwloop @gol
970 -muls @gol
971 -mmac @gol
972 -mscore5 -mscore5u -mscore7 -mscore7d}
973
974 @emph{SH Options}
975 @gccoptlist{-m1 -m2 -m2e @gol
976 -m2a-nofpu -m2a-single-only -m2a-single -m2a @gol
977 -m3 -m3e @gol
978 -m4-nofpu -m4-single-only -m4-single -m4 @gol
979 -m4a-nofpu -m4a-single-only -m4a-single -m4a -m4al @gol
980 -m5-64media -m5-64media-nofpu @gol
981 -m5-32media -m5-32media-nofpu @gol
982 -m5-compact -m5-compact-nofpu @gol
983 -mb -ml -mdalign -mrelax @gol
984 -mbigtable -mfmovd -mhitachi -mrenesas -mno-renesas -mnomacsave @gol
985 -mieee -mno-ieee -mbitops -misize -minline-ic_invalidate -mpadstruct @gol
986 -mspace -mprefergot -musermode -multcost=@var{number} -mdiv=@var{strategy} @gol
987 -mdivsi3_libfunc=@var{name} -mfixed-range=@var{register-range} @gol
988 -mindexed-addressing -mgettrcost=@var{number} -mpt-fixed @gol
989 -maccumulate-outgoing-args -minvalid-symbols @gol
990 -matomic-model=@var{atomic-model} @gol
991 -mbranch-cost=@var{num} -mzdcbranch -mno-zdcbranch @gol
992 -mfused-madd -mno-fused-madd -mfsca -mno-fsca -mfsrra -mno-fsrra @gol
993 -mpretend-cmove -mtas}
994
995 @emph{Solaris 2 Options}
996 @gccoptlist{-mclear-hwcap -mno-clear-hwcap -mimpure-text -mno-impure-text @gol
997 -pthreads -pthread}
998
999 @emph{SPARC Options}
1000 @gccoptlist{-mcpu=@var{cpu-type} @gol
1001 -mtune=@var{cpu-type} @gol
1002 -mcmodel=@var{code-model} @gol
1003 -mmemory-model=@var{mem-model} @gol
1004 -m32 -m64 -mapp-regs -mno-app-regs @gol
1005 -mfaster-structs -mno-faster-structs -mflat -mno-flat @gol
1006 -mfpu -mno-fpu -mhard-float -msoft-float @gol
1007 -mhard-quad-float -msoft-quad-float @gol
1008 -mstack-bias -mno-stack-bias @gol
1009 -munaligned-doubles -mno-unaligned-doubles @gol
1010 -muser-mode -mno-user-mode @gol
1011 -mv8plus -mno-v8plus -mvis -mno-vis @gol
1012 -mvis2 -mno-vis2 -mvis3 -mno-vis3 @gol
1013 -mcbcond -mno-cbcond @gol
1014 -mfmaf -mno-fmaf -mpopc -mno-popc @gol
1015 -mfix-at697f -mfix-ut699}
1016
1017 @emph{SPU Options}
1018 @gccoptlist{-mwarn-reloc -merror-reloc @gol
1019 -msafe-dma -munsafe-dma @gol
1020 -mbranch-hints @gol
1021 -msmall-mem -mlarge-mem -mstdmain @gol
1022 -mfixed-range=@var{register-range} @gol
1023 -mea32 -mea64 @gol
1024 -maddress-space-conversion -mno-address-space-conversion @gol
1025 -mcache-size=@var{cache-size} @gol
1026 -matomic-updates -mno-atomic-updates}
1027
1028 @emph{System V Options}
1029 @gccoptlist{-Qy -Qn -YP,@var{paths} -Ym,@var{dir}}
1030
1031 @emph{TILE-Gx Options}
1032 @gccoptlist{-mcpu=CPU -m32 -m64 -mbig-endian -mlittle-endian @gol
1033 -mcmodel=@var{code-model}}
1034
1035 @emph{TILEPro Options}
1036 @gccoptlist{-mcpu=@var{cpu} -m32}
1037
1038 @emph{V850 Options}
1039 @gccoptlist{-mlong-calls -mno-long-calls -mep -mno-ep @gol
1040 -mprolog-function -mno-prolog-function -mspace @gol
1041 -mtda=@var{n} -msda=@var{n} -mzda=@var{n} @gol
1042 -mapp-regs -mno-app-regs @gol
1043 -mdisable-callt -mno-disable-callt @gol
1044 -mv850e2v3 -mv850e2 -mv850e1 -mv850es @gol
1045 -mv850e -mv850 -mv850e3v5 @gol
1046 -mloop @gol
1047 -mrelax @gol
1048 -mlong-jumps @gol
1049 -msoft-float @gol
1050 -mhard-float @gol
1051 -mgcc-abi @gol
1052 -mrh850-abi @gol
1053 -mbig-switch}
1054
1055 @emph{VAX Options}
1056 @gccoptlist{-mg -mgnu -munix}
1057
1058 @emph{VMS Options}
1059 @gccoptlist{-mvms-return-codes -mdebug-main=@var{prefix} -mmalloc64 @gol
1060 -mpointer-size=@var{size}}
1061
1062 @emph{VxWorks Options}
1063 @gccoptlist{-mrtp -non-static -Bstatic -Bdynamic @gol
1064 -Xbind-lazy -Xbind-now}
1065
1066 @emph{x86-64 Options}
1067 See i386 and x86-64 Options.
1068
1069 @emph{Xstormy16 Options}
1070 @gccoptlist{-msim}
1071
1072 @emph{Xtensa Options}
1073 @gccoptlist{-mconst16 -mno-const16 @gol
1074 -mfused-madd -mno-fused-madd @gol
1075 -mforce-no-pic @gol
1076 -mserialize-volatile -mno-serialize-volatile @gol
1077 -mtext-section-literals -mno-text-section-literals @gol
1078 -mtarget-align -mno-target-align @gol
1079 -mlongcalls -mno-longcalls}
1080
1081 @emph{zSeries Options}
1082 See S/390 and zSeries Options.
1083
1084 @item Code Generation Options
1085 @xref{Code Gen Options,,Options for Code Generation Conventions}.
1086 @gccoptlist{-fcall-saved-@var{reg} -fcall-used-@var{reg} @gol
1087 -ffixed-@var{reg} -fexceptions @gol
1088 -fnon-call-exceptions -fdelete-dead-exceptions -funwind-tables @gol
1089 -fasynchronous-unwind-tables @gol
1090 -fno-gnu-unique @gol
1091 -finhibit-size-directive -finstrument-functions @gol
1092 -finstrument-functions-exclude-function-list=@var{sym},@var{sym},@dots{} @gol
1093 -finstrument-functions-exclude-file-list=@var{file},@var{file},@dots{} @gol
1094 -fno-common -fno-ident @gol
1095 -fpcc-struct-return -fpic -fPIC -fpie -fPIE @gol
1096 -fno-jump-tables @gol
1097 -frecord-gcc-switches @gol
1098 -freg-struct-return -fshort-enums @gol
1099 -fshort-double -fshort-wchar @gol
1100 -fverbose-asm -fpack-struct[=@var{n}] -fstack-check @gol
1101 -fstack-limit-register=@var{reg} -fstack-limit-symbol=@var{sym} @gol
1102 -fno-stack-limit -fsplit-stack @gol
1103 -fleading-underscore -ftls-model=@var{model} @gol
1104 -fstack-reuse=@var{reuse_level} @gol
1105 -ftrapv -fwrapv -fbounds-check @gol
1106 -fvisibility -fstrict-volatile-bitfields -fsync-libcalls}
1107 @end table
1108
1109
1110 @node Overall Options
1111 @section Options Controlling the Kind of Output
1112
1113 Compilation can involve up to four stages: preprocessing, compilation
1114 proper, assembly and linking, always in that order. GCC is capable of
1115 preprocessing and compiling several files either into several
1116 assembler input files, or into one assembler input file; then each
1117 assembler input file produces an object file, and linking combines all
1118 the object files (those newly compiled, and those specified as input)
1119 into an executable file.
1120
1121 @cindex file name suffix
1122 For any given input file, the file name suffix determines what kind of
1123 compilation is done:
1124
1125 @table @gcctabopt
1126 @item @var{file}.c
1127 C source code that must be preprocessed.
1128
1129 @item @var{file}.i
1130 C source code that should not be preprocessed.
1131
1132 @item @var{file}.ii
1133 C++ source code that should not be preprocessed.
1134
1135 @item @var{file}.m
1136 Objective-C source code. Note that you must link with the @file{libobjc}
1137 library to make an Objective-C program work.
1138
1139 @item @var{file}.mi
1140 Objective-C source code that should not be preprocessed.
1141
1142 @item @var{file}.mm
1143 @itemx @var{file}.M
1144 Objective-C++ source code. Note that you must link with the @file{libobjc}
1145 library to make an Objective-C++ program work. Note that @samp{.M} refers
1146 to a literal capital M@.
1147
1148 @item @var{file}.mii
1149 Objective-C++ source code that should not be preprocessed.
1150
1151 @item @var{file}.h
1152 C, C++, Objective-C or Objective-C++ header file to be turned into a
1153 precompiled header (default), or C, C++ header file to be turned into an
1154 Ada spec (via the @option{-fdump-ada-spec} switch).
1155
1156 @item @var{file}.cc
1157 @itemx @var{file}.cp
1158 @itemx @var{file}.cxx
1159 @itemx @var{file}.cpp
1160 @itemx @var{file}.CPP
1161 @itemx @var{file}.c++
1162 @itemx @var{file}.C
1163 C++ source code that must be preprocessed. Note that in @samp{.cxx},
1164 the last two letters must both be literally @samp{x}. Likewise,
1165 @samp{.C} refers to a literal capital C@.
1166
1167 @item @var{file}.mm
1168 @itemx @var{file}.M
1169 Objective-C++ source code that must be preprocessed.
1170
1171 @item @var{file}.mii
1172 Objective-C++ source code that should not be preprocessed.
1173
1174 @item @var{file}.hh
1175 @itemx @var{file}.H
1176 @itemx @var{file}.hp
1177 @itemx @var{file}.hxx
1178 @itemx @var{file}.hpp
1179 @itemx @var{file}.HPP
1180 @itemx @var{file}.h++
1181 @itemx @var{file}.tcc
1182 C++ header file to be turned into a precompiled header or Ada spec.
1183
1184 @item @var{file}.f
1185 @itemx @var{file}.for
1186 @itemx @var{file}.ftn
1187 Fixed form Fortran source code that should not be preprocessed.
1188
1189 @item @var{file}.F
1190 @itemx @var{file}.FOR
1191 @itemx @var{file}.fpp
1192 @itemx @var{file}.FPP
1193 @itemx @var{file}.FTN
1194 Fixed form Fortran source code that must be preprocessed (with the traditional
1195 preprocessor).
1196
1197 @item @var{file}.f90
1198 @itemx @var{file}.f95
1199 @itemx @var{file}.f03
1200 @itemx @var{file}.f08
1201 Free form Fortran source code that should not be preprocessed.
1202
1203 @item @var{file}.F90
1204 @itemx @var{file}.F95
1205 @itemx @var{file}.F03
1206 @itemx @var{file}.F08
1207 Free form Fortran source code that must be preprocessed (with the
1208 traditional preprocessor).
1209
1210 @item @var{file}.go
1211 Go source code.
1212
1213 @c FIXME: Descriptions of Java file types.
1214 @c @var{file}.java
1215 @c @var{file}.class
1216 @c @var{file}.zip
1217 @c @var{file}.jar
1218
1219 @item @var{file}.ads
1220 Ada source code file that contains a library unit declaration (a
1221 declaration of a package, subprogram, or generic, or a generic
1222 instantiation), or a library unit renaming declaration (a package,
1223 generic, or subprogram renaming declaration). Such files are also
1224 called @dfn{specs}.
1225
1226 @item @var{file}.adb
1227 Ada source code file containing a library unit body (a subprogram or
1228 package body). Such files are also called @dfn{bodies}.
1229
1230 @c GCC also knows about some suffixes for languages not yet included:
1231 @c Pascal:
1232 @c @var{file}.p
1233 @c @var{file}.pas
1234 @c Ratfor:
1235 @c @var{file}.r
1236
1237 @item @var{file}.s
1238 Assembler code.
1239
1240 @item @var{file}.S
1241 @itemx @var{file}.sx
1242 Assembler code that must be preprocessed.
1243
1244 @item @var{other}
1245 An object file to be fed straight into linking.
1246 Any file name with no recognized suffix is treated this way.
1247 @end table
1248
1249 @opindex x
1250 You can specify the input language explicitly with the @option{-x} option:
1251
1252 @table @gcctabopt
1253 @item -x @var{language}
1254 Specify explicitly the @var{language} for the following input files
1255 (rather than letting the compiler choose a default based on the file
1256 name suffix). This option applies to all following input files until
1257 the next @option{-x} option. Possible values for @var{language} are:
1258 @smallexample
1259 c c-header cpp-output
1260 c++ c++-header c++-cpp-output
1261 objective-c objective-c-header objective-c-cpp-output
1262 objective-c++ objective-c++-header objective-c++-cpp-output
1263 assembler assembler-with-cpp
1264 ada
1265 f77 f77-cpp-input f95 f95-cpp-input
1266 go
1267 java
1268 @end smallexample
1269
1270 @item -x none
1271 Turn off any specification of a language, so that subsequent files are
1272 handled according to their file name suffixes (as they are if @option{-x}
1273 has not been used at all).
1274
1275 @item -pass-exit-codes
1276 @opindex pass-exit-codes
1277 Normally the @command{gcc} program exits with the code of 1 if any
1278 phase of the compiler returns a non-success return code. If you specify
1279 @option{-pass-exit-codes}, the @command{gcc} program instead returns with
1280 the numerically highest error produced by any phase returning an error
1281 indication. The C, C++, and Fortran front ends return 4 if an internal
1282 compiler error is encountered.
1283 @end table
1284
1285 If you only want some of the stages of compilation, you can use
1286 @option{-x} (or filename suffixes) to tell @command{gcc} where to start, and
1287 one of the options @option{-c}, @option{-S}, or @option{-E} to say where
1288 @command{gcc} is to stop. Note that some combinations (for example,
1289 @samp{-x cpp-output -E}) instruct @command{gcc} to do nothing at all.
1290
1291 @table @gcctabopt
1292 @item -c
1293 @opindex c
1294 Compile or assemble the source files, but do not link. The linking
1295 stage simply is not done. The ultimate output is in the form of an
1296 object file for each source file.
1297
1298 By default, the object file name for a source file is made by replacing
1299 the suffix @samp{.c}, @samp{.i}, @samp{.s}, etc., with @samp{.o}.
1300
1301 Unrecognized input files, not requiring compilation or assembly, are
1302 ignored.
1303
1304 @item -S
1305 @opindex S
1306 Stop after the stage of compilation proper; do not assemble. The output
1307 is in the form of an assembler code file for each non-assembler input
1308 file specified.
1309
1310 By default, the assembler file name for a source file is made by
1311 replacing the suffix @samp{.c}, @samp{.i}, etc., with @samp{.s}.
1312
1313 Input files that don't require compilation are ignored.
1314
1315 @item -E
1316 @opindex E
1317 Stop after the preprocessing stage; do not run the compiler proper. The
1318 output is in the form of preprocessed source code, which is sent to the
1319 standard output.
1320
1321 Input files that don't require preprocessing are ignored.
1322
1323 @cindex output file option
1324 @item -o @var{file}
1325 @opindex o
1326 Place output in file @var{file}. This applies to whatever
1327 sort of output is being produced, whether it be an executable file,
1328 an object file, an assembler file or preprocessed C code.
1329
1330 If @option{-o} is not specified, the default is to put an executable
1331 file in @file{a.out}, the object file for
1332 @file{@var{source}.@var{suffix}} in @file{@var{source}.o}, its
1333 assembler file in @file{@var{source}.s}, a precompiled header file in
1334 @file{@var{source}.@var{suffix}.gch}, and all preprocessed C source on
1335 standard output.
1336
1337 @item -v
1338 @opindex v
1339 Print (on standard error output) the commands executed to run the stages
1340 of compilation. Also print the version number of the compiler driver
1341 program and of the preprocessor and the compiler proper.
1342
1343 @item -###
1344 @opindex ###
1345 Like @option{-v} except the commands are not executed and arguments
1346 are quoted unless they contain only alphanumeric characters or @code{./-_}.
1347 This is useful for shell scripts to capture the driver-generated command lines.
1348
1349 @item -pipe
1350 @opindex pipe
1351 Use pipes rather than temporary files for communication between the
1352 various stages of compilation. This fails to work on some systems where
1353 the assembler is unable to read from a pipe; but the GNU assembler has
1354 no trouble.
1355
1356 @item --help
1357 @opindex help
1358 Print (on the standard output) a description of the command-line options
1359 understood by @command{gcc}. If the @option{-v} option is also specified
1360 then @option{--help} is also passed on to the various processes
1361 invoked by @command{gcc}, so that they can display the command-line options
1362 they accept. If the @option{-Wextra} option has also been specified
1363 (prior to the @option{--help} option), then command-line options that
1364 have no documentation associated with them are also displayed.
1365
1366 @item --target-help
1367 @opindex target-help
1368 Print (on the standard output) a description of target-specific command-line
1369 options for each tool. For some targets extra target-specific
1370 information may also be printed.
1371
1372 @item --help=@{@var{class}@r{|[}^@r{]}@var{qualifier}@}@r{[},@dots{}@r{]}
1373 Print (on the standard output) a description of the command-line
1374 options understood by the compiler that fit into all specified classes
1375 and qualifiers. These are the supported classes:
1376
1377 @table @asis
1378 @item @samp{optimizers}
1379 Display all of the optimization options supported by the
1380 compiler.
1381
1382 @item @samp{warnings}
1383 Display all of the options controlling warning messages
1384 produced by the compiler.
1385
1386 @item @samp{target}
1387 Display target-specific options. Unlike the
1388 @option{--target-help} option however, target-specific options of the
1389 linker and assembler are not displayed. This is because those
1390 tools do not currently support the extended @option{--help=} syntax.
1391
1392 @item @samp{params}
1393 Display the values recognized by the @option{--param}
1394 option.
1395
1396 @item @var{language}
1397 Display the options supported for @var{language}, where
1398 @var{language} is the name of one of the languages supported in this
1399 version of GCC@.
1400
1401 @item @samp{common}
1402 Display the options that are common to all languages.
1403 @end table
1404
1405 These are the supported qualifiers:
1406
1407 @table @asis
1408 @item @samp{undocumented}
1409 Display only those options that are undocumented.
1410
1411 @item @samp{joined}
1412 Display options taking an argument that appears after an equal
1413 sign in the same continuous piece of text, such as:
1414 @samp{--help=target}.
1415
1416 @item @samp{separate}
1417 Display options taking an argument that appears as a separate word
1418 following the original option, such as: @samp{-o output-file}.
1419 @end table
1420
1421 Thus for example to display all the undocumented target-specific
1422 switches supported by the compiler, use:
1423
1424 @smallexample
1425 --help=target,undocumented
1426 @end smallexample
1427
1428 The sense of a qualifier can be inverted by prefixing it with the
1429 @samp{^} character, so for example to display all binary warning
1430 options (i.e., ones that are either on or off and that do not take an
1431 argument) that have a description, use:
1432
1433 @smallexample
1434 --help=warnings,^joined,^undocumented
1435 @end smallexample
1436
1437 The argument to @option{--help=} should not consist solely of inverted
1438 qualifiers.
1439
1440 Combining several classes is possible, although this usually
1441 restricts the output so much that there is nothing to display. One
1442 case where it does work, however, is when one of the classes is
1443 @var{target}. For example, to display all the target-specific
1444 optimization options, use:
1445
1446 @smallexample
1447 --help=target,optimizers
1448 @end smallexample
1449
1450 The @option{--help=} option can be repeated on the command line. Each
1451 successive use displays its requested class of options, skipping
1452 those that have already been displayed.
1453
1454 If the @option{-Q} option appears on the command line before the
1455 @option{--help=} option, then the descriptive text displayed by
1456 @option{--help=} is changed. Instead of describing the displayed
1457 options, an indication is given as to whether the option is enabled,
1458 disabled or set to a specific value (assuming that the compiler
1459 knows this at the point where the @option{--help=} option is used).
1460
1461 Here is a truncated example from the ARM port of @command{gcc}:
1462
1463 @smallexample
1464 % gcc -Q -mabi=2 --help=target -c
1465 The following options are target specific:
1466 -mabi= 2
1467 -mabort-on-noreturn [disabled]
1468 -mapcs [disabled]
1469 @end smallexample
1470
1471 The output is sensitive to the effects of previous command-line
1472 options, so for example it is possible to find out which optimizations
1473 are enabled at @option{-O2} by using:
1474
1475 @smallexample
1476 -Q -O2 --help=optimizers
1477 @end smallexample
1478
1479 Alternatively you can discover which binary optimizations are enabled
1480 by @option{-O3} by using:
1481
1482 @smallexample
1483 gcc -c -Q -O3 --help=optimizers > /tmp/O3-opts
1484 gcc -c -Q -O2 --help=optimizers > /tmp/O2-opts
1485 diff /tmp/O2-opts /tmp/O3-opts | grep enabled
1486 @end smallexample
1487
1488 @item -no-canonical-prefixes
1489 @opindex no-canonical-prefixes
1490 Do not expand any symbolic links, resolve references to @samp{/../}
1491 or @samp{/./}, or make the path absolute when generating a relative
1492 prefix.
1493
1494 @item --version
1495 @opindex version
1496 Display the version number and copyrights of the invoked GCC@.
1497
1498 @item -wrapper
1499 @opindex wrapper
1500 Invoke all subcommands under a wrapper program. The name of the
1501 wrapper program and its parameters are passed as a comma separated
1502 list.
1503
1504 @smallexample
1505 gcc -c t.c -wrapper gdb,--args
1506 @end smallexample
1507
1508 @noindent
1509 This invokes all subprograms of @command{gcc} under
1510 @samp{gdb --args}, thus the invocation of @command{cc1} is
1511 @samp{gdb --args cc1 @dots{}}.
1512
1513 @item -fplugin=@var{name}.so
1514 @opindex fplugin
1515 Load the plugin code in file @var{name}.so, assumed to be a
1516 shared object to be dlopen'd by the compiler. The base name of
1517 the shared object file is used to identify the plugin for the
1518 purposes of argument parsing (See
1519 @option{-fplugin-arg-@var{name}-@var{key}=@var{value}} below).
1520 Each plugin should define the callback functions specified in the
1521 Plugins API.
1522
1523 @item -fplugin-arg-@var{name}-@var{key}=@var{value}
1524 @opindex fplugin-arg
1525 Define an argument called @var{key} with a value of @var{value}
1526 for the plugin called @var{name}.
1527
1528 @item -fdump-ada-spec@r{[}-slim@r{]}
1529 @opindex fdump-ada-spec
1530 For C and C++ source and include files, generate corresponding Ada specs.
1531 @xref{Generating Ada Bindings for C and C++ headers,,, gnat_ugn,
1532 GNAT User's Guide}, which provides detailed documentation on this feature.
1533
1534 @item -fada-spec-parent=@var{unit}
1535 @opindex fada-spec-parent
1536 In conjunction with @option{-fdump-ada-spec@r{[}-slim@r{]}} above, generate
1537 Ada specs as child units of parent @var{unit}.
1538
1539 @item -fdump-go-spec=@var{file}
1540 @opindex fdump-go-spec
1541 For input files in any language, generate corresponding Go
1542 declarations in @var{file}. This generates Go @code{const},
1543 @code{type}, @code{var}, and @code{func} declarations which may be a
1544 useful way to start writing a Go interface to code written in some
1545 other language.
1546
1547 @include @value{srcdir}/../libiberty/at-file.texi
1548 @end table
1549
1550 @node Invoking G++
1551 @section Compiling C++ Programs
1552
1553 @cindex suffixes for C++ source
1554 @cindex C++ source file suffixes
1555 C++ source files conventionally use one of the suffixes @samp{.C},
1556 @samp{.cc}, @samp{.cpp}, @samp{.CPP}, @samp{.c++}, @samp{.cp}, or
1557 @samp{.cxx}; C++ header files often use @samp{.hh}, @samp{.hpp},
1558 @samp{.H}, or (for shared template code) @samp{.tcc}; and
1559 preprocessed C++ files use the suffix @samp{.ii}. GCC recognizes
1560 files with these names and compiles them as C++ programs even if you
1561 call the compiler the same way as for compiling C programs (usually
1562 with the name @command{gcc}).
1563
1564 @findex g++
1565 @findex c++
1566 However, the use of @command{gcc} does not add the C++ library.
1567 @command{g++} is a program that calls GCC and automatically specifies linking
1568 against the C++ library. It treats @samp{.c},
1569 @samp{.h} and @samp{.i} files as C++ source files instead of C source
1570 files unless @option{-x} is used. This program is also useful when
1571 precompiling a C header file with a @samp{.h} extension for use in C++
1572 compilations. On many systems, @command{g++} is also installed with
1573 the name @command{c++}.
1574
1575 @cindex invoking @command{g++}
1576 When you compile C++ programs, you may specify many of the same
1577 command-line options that you use for compiling programs in any
1578 language; or command-line options meaningful for C and related
1579 languages; or options that are meaningful only for C++ programs.
1580 @xref{C Dialect Options,,Options Controlling C Dialect}, for
1581 explanations of options for languages related to C@.
1582 @xref{C++ Dialect Options,,Options Controlling C++ Dialect}, for
1583 explanations of options that are meaningful only for C++ programs.
1584
1585 @node C Dialect Options
1586 @section Options Controlling C Dialect
1587 @cindex dialect options
1588 @cindex language dialect options
1589 @cindex options, dialect
1590
1591 The following options control the dialect of C (or languages derived
1592 from C, such as C++, Objective-C and Objective-C++) that the compiler
1593 accepts:
1594
1595 @table @gcctabopt
1596 @cindex ANSI support
1597 @cindex ISO support
1598 @item -ansi
1599 @opindex ansi
1600 In C mode, this is equivalent to @option{-std=c90}. In C++ mode, it is
1601 equivalent to @option{-std=c++98}.
1602
1603 This turns off certain features of GCC that are incompatible with ISO
1604 C90 (when compiling C code), or of standard C++ (when compiling C++ code),
1605 such as the @code{asm} and @code{typeof} keywords, and
1606 predefined macros such as @code{unix} and @code{vax} that identify the
1607 type of system you are using. It also enables the undesirable and
1608 rarely used ISO trigraph feature. For the C compiler,
1609 it disables recognition of C++ style @samp{//} comments as well as
1610 the @code{inline} keyword.
1611
1612 The alternate keywords @code{__asm__}, @code{__extension__},
1613 @code{__inline__} and @code{__typeof__} continue to work despite
1614 @option{-ansi}. You would not want to use them in an ISO C program, of
1615 course, but it is useful to put them in header files that might be included
1616 in compilations done with @option{-ansi}. Alternate predefined macros
1617 such as @code{__unix__} and @code{__vax__} are also available, with or
1618 without @option{-ansi}.
1619
1620 The @option{-ansi} option does not cause non-ISO programs to be
1621 rejected gratuitously. For that, @option{-Wpedantic} is required in
1622 addition to @option{-ansi}. @xref{Warning Options}.
1623
1624 The macro @code{__STRICT_ANSI__} is predefined when the @option{-ansi}
1625 option is used. Some header files may notice this macro and refrain
1626 from declaring certain functions or defining certain macros that the
1627 ISO standard doesn't call for; this is to avoid interfering with any
1628 programs that might use these names for other things.
1629
1630 Functions that are normally built in but do not have semantics
1631 defined by ISO C (such as @code{alloca} and @code{ffs}) are not built-in
1632 functions when @option{-ansi} is used. @xref{Other Builtins,,Other
1633 built-in functions provided by GCC}, for details of the functions
1634 affected.
1635
1636 @item -std=
1637 @opindex std
1638 Determine the language standard. @xref{Standards,,Language Standards
1639 Supported by GCC}, for details of these standard versions. This option
1640 is currently only supported when compiling C or C++.
1641
1642 The compiler can accept several base standards, such as @samp{c90} or
1643 @samp{c++98}, and GNU dialects of those standards, such as
1644 @samp{gnu90} or @samp{gnu++98}. When a base standard is specified, the
1645 compiler accepts all programs following that standard plus those
1646 using GNU extensions that do not contradict it. For example,
1647 @option{-std=c90} turns off certain features of GCC that are
1648 incompatible with ISO C90, such as the @code{asm} and @code{typeof}
1649 keywords, but not other GNU extensions that do not have a meaning in
1650 ISO C90, such as omitting the middle term of a @code{?:}
1651 expression. On the other hand, when a GNU dialect of a standard is
1652 specified, all features supported by the compiler are enabled, even when
1653 those features change the meaning of the base standard. As a result, some
1654 strict-conforming programs may be rejected. The particular standard
1655 is used by @option{-Wpedantic} to identify which features are GNU
1656 extensions given that version of the standard. For example
1657 @option{-std=gnu90 -Wpedantic} warns about C++ style @samp{//}
1658 comments, while @option{-std=gnu99 -Wpedantic} does not.
1659
1660 A value for this option must be provided; possible values are
1661
1662 @table @samp
1663 @item c90
1664 @itemx c89
1665 @itemx iso9899:1990
1666 Support all ISO C90 programs (certain GNU extensions that conflict
1667 with ISO C90 are disabled). Same as @option{-ansi} for C code.
1668
1669 @item iso9899:199409
1670 ISO C90 as modified in amendment 1.
1671
1672 @item c99
1673 @itemx c9x
1674 @itemx iso9899:1999
1675 @itemx iso9899:199x
1676 ISO C99. This standard is substantially completely supported, modulo
1677 bugs, extended identifiers (supported except for corner cases when
1678 @option{-fextended-identifiers} is used) and floating-point issues
1679 (mainly but not entirely relating to optional C99 features from
1680 Annexes F and G). See
1681 @w{@uref{http://gcc.gnu.org/c99status.html}} for more information. The
1682 names @samp{c9x} and @samp{iso9899:199x} are deprecated.
1683
1684 @item c11
1685 @itemx c1x
1686 @itemx iso9899:2011
1687 ISO C11, the 2011 revision of the ISO C standard. This standard is
1688 substantially completely supported, modulo bugs, extended identifiers
1689 (supported except for corner cases when
1690 @option{-fextended-identifiers} is used), floating-point issues
1691 (mainly but not entirely relating to optional C11 features from
1692 Annexes F and G) and the optional Annexes K (Bounds-checking
1693 interfaces) and L (Analyzability). The name @samp{c1x} is deprecated.
1694
1695 @item gnu90
1696 @itemx gnu89
1697 GNU dialect of ISO C90 (including some C99 features).
1698
1699 @item gnu99
1700 @itemx gnu9x
1701 GNU dialect of ISO C99. The name @samp{gnu9x} is deprecated.
1702
1703 @item gnu11
1704 @itemx gnu1x
1705 GNU dialect of ISO C11. This is the default for C code.
1706 The name @samp{gnu1x} is deprecated.
1707
1708 @item c++98
1709 @itemx c++03
1710 The 1998 ISO C++ standard plus the 2003 technical corrigendum and some
1711 additional defect reports. Same as @option{-ansi} for C++ code.
1712
1713 @item gnu++98
1714 @itemx gnu++03
1715 GNU dialect of @option{-std=c++98}. This is the default for
1716 C++ code.
1717
1718 @item c++11
1719 @itemx c++0x
1720 The 2011 ISO C++ standard plus amendments.
1721 The name @samp{c++0x} is deprecated.
1722
1723 @item gnu++11
1724 @itemx gnu++0x
1725 GNU dialect of @option{-std=c++11}.
1726 The name @samp{gnu++0x} is deprecated.
1727
1728 @item c++14
1729 @itemx c++1y
1730 The 2014 ISO C++ standard plus amendments.
1731 The name @samp{c++1y} is deprecated.
1732
1733 @item gnu++14
1734 @itemx gnu++1y
1735 GNU dialect of @option{-std=c++14}.
1736 The name @samp{gnu++1y} is deprecated.
1737
1738 @item c++1z
1739 The next revision of the ISO C++ standard, tentatively planned for
1740 2017. Support is highly experimental, and will almost certainly
1741 change in incompatible ways in future releases.
1742
1743 @item gnu++1z
1744 GNU dialect of @option{-std=c++1z}. Support is highly experimental,
1745 and will almost certainly change in incompatible ways in future
1746 releases.
1747 @end table
1748
1749 @item -fgnu89-inline
1750 @opindex fgnu89-inline
1751 The option @option{-fgnu89-inline} tells GCC to use the traditional
1752 GNU semantics for @code{inline} functions when in C99 mode.
1753 @xref{Inline,,An Inline Function is As Fast As a Macro}. This option
1754 is accepted and ignored by GCC versions 4.1.3 up to but not including
1755 4.3. In GCC versions 4.3 and later it changes the behavior of GCC in
1756 C99 mode. Using this option is roughly equivalent to adding the
1757 @code{gnu_inline} function attribute to all inline functions
1758 (@pxref{Function Attributes}).
1759
1760 The option @option{-fno-gnu89-inline} explicitly tells GCC to use the
1761 C99 semantics for @code{inline} when in C99 or gnu99 mode (i.e., it
1762 specifies the default behavior). This option was first supported in
1763 GCC 4.3. This option is not supported in @option{-std=c90} or
1764 @option{-std=gnu90} mode.
1765
1766 The preprocessor macros @code{__GNUC_GNU_INLINE__} and
1767 @code{__GNUC_STDC_INLINE__} may be used to check which semantics are
1768 in effect for @code{inline} functions. @xref{Common Predefined
1769 Macros,,,cpp,The C Preprocessor}.
1770
1771 @item -aux-info @var{filename}
1772 @opindex aux-info
1773 Output to the given filename prototyped declarations for all functions
1774 declared and/or defined in a translation unit, including those in header
1775 files. This option is silently ignored in any language other than C@.
1776
1777 Besides declarations, the file indicates, in comments, the origin of
1778 each declaration (source file and line), whether the declaration was
1779 implicit, prototyped or unprototyped (@samp{I}, @samp{N} for new or
1780 @samp{O} for old, respectively, in the first character after the line
1781 number and the colon), and whether it came from a declaration or a
1782 definition (@samp{C} or @samp{F}, respectively, in the following
1783 character). In the case of function definitions, a K&R-style list of
1784 arguments followed by their declarations is also provided, inside
1785 comments, after the declaration.
1786
1787 @item -fallow-parameterless-variadic-functions
1788 @opindex fallow-parameterless-variadic-functions
1789 Accept variadic functions without named parameters.
1790
1791 Although it is possible to define such a function, this is not very
1792 useful as it is not possible to read the arguments. This is only
1793 supported for C as this construct is allowed by C++.
1794
1795 @item -fno-asm
1796 @opindex fno-asm
1797 Do not recognize @code{asm}, @code{inline} or @code{typeof} as a
1798 keyword, so that code can use these words as identifiers. You can use
1799 the keywords @code{__asm__}, @code{__inline__} and @code{__typeof__}
1800 instead. @option{-ansi} implies @option{-fno-asm}.
1801
1802 In C++, this switch only affects the @code{typeof} keyword, since
1803 @code{asm} and @code{inline} are standard keywords. You may want to
1804 use the @option{-fno-gnu-keywords} flag instead, which has the same
1805 effect. In C99 mode (@option{-std=c99} or @option{-std=gnu99}), this
1806 switch only affects the @code{asm} and @code{typeof} keywords, since
1807 @code{inline} is a standard keyword in ISO C99.
1808
1809 @item -fno-builtin
1810 @itemx -fno-builtin-@var{function}
1811 @opindex fno-builtin
1812 @cindex built-in functions
1813 Don't recognize built-in functions that do not begin with
1814 @samp{__builtin_} as prefix. @xref{Other Builtins,,Other built-in
1815 functions provided by GCC}, for details of the functions affected,
1816 including those which are not built-in functions when @option{-ansi} or
1817 @option{-std} options for strict ISO C conformance are used because they
1818 do not have an ISO standard meaning.
1819
1820 GCC normally generates special code to handle certain built-in functions
1821 more efficiently; for instance, calls to @code{alloca} may become single
1822 instructions which adjust the stack directly, and calls to @code{memcpy}
1823 may become inline copy loops. The resulting code is often both smaller
1824 and faster, but since the function calls no longer appear as such, you
1825 cannot set a breakpoint on those calls, nor can you change the behavior
1826 of the functions by linking with a different library. In addition,
1827 when a function is recognized as a built-in function, GCC may use
1828 information about that function to warn about problems with calls to
1829 that function, or to generate more efficient code, even if the
1830 resulting code still contains calls to that function. For example,
1831 warnings are given with @option{-Wformat} for bad calls to
1832 @code{printf} when @code{printf} is built in and @code{strlen} is
1833 known not to modify global memory.
1834
1835 With the @option{-fno-builtin-@var{function}} option
1836 only the built-in function @var{function} is
1837 disabled. @var{function} must not begin with @samp{__builtin_}. If a
1838 function is named that is not built-in in this version of GCC, this
1839 option is ignored. There is no corresponding
1840 @option{-fbuiltin-@var{function}} option; if you wish to enable
1841 built-in functions selectively when using @option{-fno-builtin} or
1842 @option{-ffreestanding}, you may define macros such as:
1843
1844 @smallexample
1845 #define abs(n) __builtin_abs ((n))
1846 #define strcpy(d, s) __builtin_strcpy ((d), (s))
1847 @end smallexample
1848
1849 @item -fhosted
1850 @opindex fhosted
1851 @cindex hosted environment
1852
1853 Assert that compilation targets a hosted environment. This implies
1854 @option{-fbuiltin}. A hosted environment is one in which the
1855 entire standard library is available, and in which @code{main} has a return
1856 type of @code{int}. Examples are nearly everything except a kernel.
1857 This is equivalent to @option{-fno-freestanding}.
1858
1859 @item -ffreestanding
1860 @opindex ffreestanding
1861 @cindex hosted environment
1862
1863 Assert that compilation targets a freestanding environment. This
1864 implies @option{-fno-builtin}. A freestanding environment
1865 is one in which the standard library may not exist, and program startup may
1866 not necessarily be at @code{main}. The most obvious example is an OS kernel.
1867 This is equivalent to @option{-fno-hosted}.
1868
1869 @xref{Standards,,Language Standards Supported by GCC}, for details of
1870 freestanding and hosted environments.
1871
1872 @item -fopenmp
1873 @opindex fopenmp
1874 @cindex OpenMP parallel
1875 Enable handling of OpenMP directives @code{#pragma omp} in C/C++ and
1876 @code{!$omp} in Fortran. When @option{-fopenmp} is specified, the
1877 compiler generates parallel code according to the OpenMP Application
1878 Program Interface v4.0 @w{@uref{http://www.openmp.org/}}. This option
1879 implies @option{-pthread}, and thus is only supported on targets that
1880 have support for @option{-pthread}. @option{-fopenmp} implies
1881 @option{-fopenmp-simd}.
1882
1883 @item -fopenmp-simd
1884 @opindex fopenmp-simd
1885 @cindex OpenMP SIMD
1886 @cindex SIMD
1887 Enable handling of OpenMP's SIMD directives with @code{#pragma omp}
1888 in C/C++ and @code{!$omp} in Fortran. Other OpenMP directives
1889 are ignored.
1890
1891 @item -fcilkplus
1892 @opindex fcilkplus
1893 @cindex Enable Cilk Plus
1894 Enable the usage of Cilk Plus language extension features for C/C++.
1895 When the option @option{-fcilkplus} is specified, enable the usage of
1896 the Cilk Plus Language extension features for C/C++. The present
1897 implementation follows ABI version 1.2. This is an experimental
1898 feature that is only partially complete, and whose interface may
1899 change in future versions of GCC as the official specification
1900 changes. Currently, all features but @code{_Cilk_for} have been
1901 implemented.
1902
1903 @item -fgnu-tm
1904 @opindex fgnu-tm
1905 When the option @option{-fgnu-tm} is specified, the compiler
1906 generates code for the Linux variant of Intel's current Transactional
1907 Memory ABI specification document (Revision 1.1, May 6 2009). This is
1908 an experimental feature whose interface may change in future versions
1909 of GCC, as the official specification changes. Please note that not
1910 all architectures are supported for this feature.
1911
1912 For more information on GCC's support for transactional memory,
1913 @xref{Enabling libitm,,The GNU Transactional Memory Library,libitm,GNU
1914 Transactional Memory Library}.
1915
1916 Note that the transactional memory feature is not supported with
1917 non-call exceptions (@option{-fnon-call-exceptions}).
1918
1919 @item -fms-extensions
1920 @opindex fms-extensions
1921 Accept some non-standard constructs used in Microsoft header files.
1922
1923 In C++ code, this allows member names in structures to be similar
1924 to previous types declarations.
1925
1926 @smallexample
1927 typedef int UOW;
1928 struct ABC @{
1929 UOW UOW;
1930 @};
1931 @end smallexample
1932
1933 Some cases of unnamed fields in structures and unions are only
1934 accepted with this option. @xref{Unnamed Fields,,Unnamed struct/union
1935 fields within structs/unions}, for details.
1936
1937 Note that this option is off for all targets but i?86 and x86_64
1938 targets using ms-abi.
1939 @item -fplan9-extensions
1940 Accept some non-standard constructs used in Plan 9 code.
1941
1942 This enables @option{-fms-extensions}, permits passing pointers to
1943 structures with anonymous fields to functions that expect pointers to
1944 elements of the type of the field, and permits referring to anonymous
1945 fields declared using a typedef. @xref{Unnamed Fields,,Unnamed
1946 struct/union fields within structs/unions}, for details. This is only
1947 supported for C, not C++.
1948
1949 @item -trigraphs
1950 @opindex trigraphs
1951 Support ISO C trigraphs. The @option{-ansi} option (and @option{-std}
1952 options for strict ISO C conformance) implies @option{-trigraphs}.
1953
1954 @cindex traditional C language
1955 @cindex C language, traditional
1956 @item -traditional
1957 @itemx -traditional-cpp
1958 @opindex traditional-cpp
1959 @opindex traditional
1960 Formerly, these options caused GCC to attempt to emulate a pre-standard
1961 C compiler. They are now only supported with the @option{-E} switch.
1962 The preprocessor continues to support a pre-standard mode. See the GNU
1963 CPP manual for details.
1964
1965 @item -fcond-mismatch
1966 @opindex fcond-mismatch
1967 Allow conditional expressions with mismatched types in the second and
1968 third arguments. The value of such an expression is void. This option
1969 is not supported for C++.
1970
1971 @item -flax-vector-conversions
1972 @opindex flax-vector-conversions
1973 Allow implicit conversions between vectors with differing numbers of
1974 elements and/or incompatible element types. This option should not be
1975 used for new code.
1976
1977 @item -funsigned-char
1978 @opindex funsigned-char
1979 Let the type @code{char} be unsigned, like @code{unsigned char}.
1980
1981 Each kind of machine has a default for what @code{char} should
1982 be. It is either like @code{unsigned char} by default or like
1983 @code{signed char} by default.
1984
1985 Ideally, a portable program should always use @code{signed char} or
1986 @code{unsigned char} when it depends on the signedness of an object.
1987 But many programs have been written to use plain @code{char} and
1988 expect it to be signed, or expect it to be unsigned, depending on the
1989 machines they were written for. This option, and its inverse, let you
1990 make such a program work with the opposite default.
1991
1992 The type @code{char} is always a distinct type from each of
1993 @code{signed char} or @code{unsigned char}, even though its behavior
1994 is always just like one of those two.
1995
1996 @item -fsigned-char
1997 @opindex fsigned-char
1998 Let the type @code{char} be signed, like @code{signed char}.
1999
2000 Note that this is equivalent to @option{-fno-unsigned-char}, which is
2001 the negative form of @option{-funsigned-char}. Likewise, the option
2002 @option{-fno-signed-char} is equivalent to @option{-funsigned-char}.
2003
2004 @item -fsigned-bitfields
2005 @itemx -funsigned-bitfields
2006 @itemx -fno-signed-bitfields
2007 @itemx -fno-unsigned-bitfields
2008 @opindex fsigned-bitfields
2009 @opindex funsigned-bitfields
2010 @opindex fno-signed-bitfields
2011 @opindex fno-unsigned-bitfields
2012 These options control whether a bit-field is signed or unsigned, when the
2013 declaration does not use either @code{signed} or @code{unsigned}. By
2014 default, such a bit-field is signed, because this is consistent: the
2015 basic integer types such as @code{int} are signed types.
2016 @end table
2017
2018 @node C++ Dialect Options
2019 @section Options Controlling C++ Dialect
2020
2021 @cindex compiler options, C++
2022 @cindex C++ options, command-line
2023 @cindex options, C++
2024 This section describes the command-line options that are only meaningful
2025 for C++ programs. You can also use most of the GNU compiler options
2026 regardless of what language your program is in. For example, you
2027 might compile a file @code{firstClass.C} like this:
2028
2029 @smallexample
2030 g++ -g -frepo -O -c firstClass.C
2031 @end smallexample
2032
2033 @noindent
2034 In this example, only @option{-frepo} is an option meant
2035 only for C++ programs; you can use the other options with any
2036 language supported by GCC@.
2037
2038 Here is a list of options that are @emph{only} for compiling C++ programs:
2039
2040 @table @gcctabopt
2041
2042 @item -fabi-version=@var{n}
2043 @opindex fabi-version
2044 Use version @var{n} of the C++ ABI@. The default is version 0.
2045
2046 Version 0 refers to the version conforming most closely to
2047 the C++ ABI specification. Therefore, the ABI obtained using version 0
2048 will change in different versions of G++ as ABI bugs are fixed.
2049
2050 Version 1 is the version of the C++ ABI that first appeared in G++ 3.2.
2051
2052 Version 2 is the version of the C++ ABI that first appeared in G++
2053 3.4, and was the default through G++ 4.9.
2054
2055 Version 3 corrects an error in mangling a constant address as a
2056 template argument.
2057
2058 Version 4, which first appeared in G++ 4.5, implements a standard
2059 mangling for vector types.
2060
2061 Version 5, which first appeared in G++ 4.6, corrects the mangling of
2062 attribute const/volatile on function pointer types, decltype of a
2063 plain decl, and use of a function parameter in the declaration of
2064 another parameter.
2065
2066 Version 6, which first appeared in G++ 4.7, corrects the promotion
2067 behavior of C++11 scoped enums and the mangling of template argument
2068 packs, const/static_cast, prefix ++ and --, and a class scope function
2069 used as a template argument.
2070
2071 Version 7, which first appeared in G++ 4.8, that treats nullptr_t as a
2072 builtin type and corrects the mangling of lambdas in default argument
2073 scope.
2074
2075 Version 8, which first appeared in G++ 4.9, corrects the substitution
2076 behavior of function types with function-cv-qualifiers.
2077
2078 See also @option{-Wabi}.
2079
2080 @item -fabi-compat-version=@var{n}
2081 @opindex fabi-compat-version
2082 Starting with GCC 4.5, on targets that support strong aliases, G++
2083 works around mangling changes by creating an alias with the correct
2084 mangled name when defining a symbol with an incorrect mangled name.
2085 This switch specifies which ABI version to use for the alias.
2086
2087 With @option{-fabi-version=0} (the default), this defaults to 2. If
2088 another ABI version is explicitly selected, this defaults to 0.
2089
2090 The compatibility version is also set by @option{-Wabi=@var{n}}.
2091
2092 @item -fno-access-control
2093 @opindex fno-access-control
2094 Turn off all access checking. This switch is mainly useful for working
2095 around bugs in the access control code.
2096
2097 @item -fcheck-new
2098 @opindex fcheck-new
2099 Check that the pointer returned by @code{operator new} is non-null
2100 before attempting to modify the storage allocated. This check is
2101 normally unnecessary because the C++ standard specifies that
2102 @code{operator new} only returns @code{0} if it is declared
2103 @samp{throw()}, in which case the compiler always checks the
2104 return value even without this option. In all other cases, when
2105 @code{operator new} has a non-empty exception specification, memory
2106 exhaustion is signalled by throwing @code{std::bad_alloc}. See also
2107 @samp{new (nothrow)}.
2108
2109 @item -fconstexpr-depth=@var{n}
2110 @opindex fconstexpr-depth
2111 Set the maximum nested evaluation depth for C++11 constexpr functions
2112 to @var{n}. A limit is needed to detect endless recursion during
2113 constant expression evaluation. The minimum specified by the standard
2114 is 512.
2115
2116 @item -fdeduce-init-list
2117 @opindex fdeduce-init-list
2118 Enable deduction of a template type parameter as
2119 @code{std::initializer_list} from a brace-enclosed initializer list, i.e.@:
2120
2121 @smallexample
2122 template <class T> auto forward(T t) -> decltype (realfn (t))
2123 @{
2124 return realfn (t);
2125 @}
2126
2127 void f()
2128 @{
2129 forward(@{1,2@}); // call forward<std::initializer_list<int>>
2130 @}
2131 @end smallexample
2132
2133 This deduction was implemented as a possible extension to the
2134 originally proposed semantics for the C++11 standard, but was not part
2135 of the final standard, so it is disabled by default. This option is
2136 deprecated, and may be removed in a future version of G++.
2137
2138 @item -ffriend-injection
2139 @opindex ffriend-injection
2140 Inject friend functions into the enclosing namespace, so that they are
2141 visible outside the scope of the class in which they are declared.
2142 Friend functions were documented to work this way in the old Annotated
2143 C++ Reference Manual, and versions of G++ before 4.1 always worked
2144 that way. However, in ISO C++ a friend function that is not declared
2145 in an enclosing scope can only be found using argument dependent
2146 lookup. This option causes friends to be injected as they were in
2147 earlier releases.
2148
2149 This option is for compatibility, and may be removed in a future
2150 release of G++.
2151
2152 @item -fno-elide-constructors
2153 @opindex fno-elide-constructors
2154 The C++ standard allows an implementation to omit creating a temporary
2155 that is only used to initialize another object of the same type.
2156 Specifying this option disables that optimization, and forces G++ to
2157 call the copy constructor in all cases.
2158
2159 @item -fno-enforce-eh-specs
2160 @opindex fno-enforce-eh-specs
2161 Don't generate code to check for violation of exception specifications
2162 at run time. This option violates the C++ standard, but may be useful
2163 for reducing code size in production builds, much like defining
2164 @samp{NDEBUG}. This does not give user code permission to throw
2165 exceptions in violation of the exception specifications; the compiler
2166 still optimizes based on the specifications, so throwing an
2167 unexpected exception results in undefined behavior at run time.
2168
2169 @item -fextern-tls-init
2170 @itemx -fno-extern-tls-init
2171 @opindex fextern-tls-init
2172 @opindex fno-extern-tls-init
2173 The C++11 and OpenMP standards allow @samp{thread_local} and
2174 @samp{threadprivate} variables to have dynamic (runtime)
2175 initialization. To support this, any use of such a variable goes
2176 through a wrapper function that performs any necessary initialization.
2177 When the use and definition of the variable are in the same
2178 translation unit, this overhead can be optimized away, but when the
2179 use is in a different translation unit there is significant overhead
2180 even if the variable doesn't actually need dynamic initialization. If
2181 the programmer can be sure that no use of the variable in a
2182 non-defining TU needs to trigger dynamic initialization (either
2183 because the variable is statically initialized, or a use of the
2184 variable in the defining TU will be executed before any uses in
2185 another TU), they can avoid this overhead with the
2186 @option{-fno-extern-tls-init} option.
2187
2188 On targets that support symbol aliases, the default is
2189 @option{-fextern-tls-init}. On targets that do not support symbol
2190 aliases, the default is @option{-fno-extern-tls-init}.
2191
2192 @item -ffor-scope
2193 @itemx -fno-for-scope
2194 @opindex ffor-scope
2195 @opindex fno-for-scope
2196 If @option{-ffor-scope} is specified, the scope of variables declared in
2197 a @i{for-init-statement} is limited to the @samp{for} loop itself,
2198 as specified by the C++ standard.
2199 If @option{-fno-for-scope} is specified, the scope of variables declared in
2200 a @i{for-init-statement} extends to the end of the enclosing scope,
2201 as was the case in old versions of G++, and other (traditional)
2202 implementations of C++.
2203
2204 If neither flag is given, the default is to follow the standard,
2205 but to allow and give a warning for old-style code that would
2206 otherwise be invalid, or have different behavior.
2207
2208 @item -fno-gnu-keywords
2209 @opindex fno-gnu-keywords
2210 Do not recognize @code{typeof} as a keyword, so that code can use this
2211 word as an identifier. You can use the keyword @code{__typeof__} instead.
2212 @option{-ansi} implies @option{-fno-gnu-keywords}.
2213
2214 @item -fno-implicit-templates
2215 @opindex fno-implicit-templates
2216 Never emit code for non-inline templates that are instantiated
2217 implicitly (i.e.@: by use); only emit code for explicit instantiations.
2218 @xref{Template Instantiation}, for more information.
2219
2220 @item -fno-implicit-inline-templates
2221 @opindex fno-implicit-inline-templates
2222 Don't emit code for implicit instantiations of inline templates, either.
2223 The default is to handle inlines differently so that compiles with and
2224 without optimization need the same set of explicit instantiations.
2225
2226 @item -fno-implement-inlines
2227 @opindex fno-implement-inlines
2228 To save space, do not emit out-of-line copies of inline functions
2229 controlled by @samp{#pragma implementation}. This causes linker
2230 errors if these functions are not inlined everywhere they are called.
2231
2232 @item -fms-extensions
2233 @opindex fms-extensions
2234 Disable Wpedantic warnings about constructs used in MFC, such as implicit
2235 int and getting a pointer to member function via non-standard syntax.
2236
2237 @item -fno-nonansi-builtins
2238 @opindex fno-nonansi-builtins
2239 Disable built-in declarations of functions that are not mandated by
2240 ANSI/ISO C@. These include @code{ffs}, @code{alloca}, @code{_exit},
2241 @code{index}, @code{bzero}, @code{conjf}, and other related functions.
2242
2243 @item -fnothrow-opt
2244 @opindex fnothrow-opt
2245 Treat a @code{throw()} exception specification as if it were a
2246 @code{noexcept} specification to reduce or eliminate the text size
2247 overhead relative to a function with no exception specification. If
2248 the function has local variables of types with non-trivial
2249 destructors, the exception specification actually makes the
2250 function smaller because the EH cleanups for those variables can be
2251 optimized away. The semantic effect is that an exception thrown out of
2252 a function with such an exception specification results in a call
2253 to @code{terminate} rather than @code{unexpected}.
2254
2255 @item -fno-operator-names
2256 @opindex fno-operator-names
2257 Do not treat the operator name keywords @code{and}, @code{bitand},
2258 @code{bitor}, @code{compl}, @code{not}, @code{or} and @code{xor} as
2259 synonyms as keywords.
2260
2261 @item -fno-optional-diags
2262 @opindex fno-optional-diags
2263 Disable diagnostics that the standard says a compiler does not need to
2264 issue. Currently, the only such diagnostic issued by G++ is the one for
2265 a name having multiple meanings within a class.
2266
2267 @item -fpermissive
2268 @opindex fpermissive
2269 Downgrade some diagnostics about nonconformant code from errors to
2270 warnings. Thus, using @option{-fpermissive} allows some
2271 nonconforming code to compile.
2272
2273 @item -fno-pretty-templates
2274 @opindex fno-pretty-templates
2275 When an error message refers to a specialization of a function
2276 template, the compiler normally prints the signature of the
2277 template followed by the template arguments and any typedefs or
2278 typenames in the signature (e.g. @code{void f(T) [with T = int]}
2279 rather than @code{void f(int)}) so that it's clear which template is
2280 involved. When an error message refers to a specialization of a class
2281 template, the compiler omits any template arguments that match
2282 the default template arguments for that template. If either of these
2283 behaviors make it harder to understand the error message rather than
2284 easier, you can use @option{-fno-pretty-templates} to disable them.
2285
2286 @item -frepo
2287 @opindex frepo
2288 Enable automatic template instantiation at link time. This option also
2289 implies @option{-fno-implicit-templates}. @xref{Template
2290 Instantiation}, for more information.
2291
2292 @item -fno-rtti
2293 @opindex fno-rtti
2294 Disable generation of information about every class with virtual
2295 functions for use by the C++ run-time type identification features
2296 (@samp{dynamic_cast} and @samp{typeid}). If you don't use those parts
2297 of the language, you can save some space by using this flag. Note that
2298 exception handling uses the same information, but G++ generates it as
2299 needed. The @samp{dynamic_cast} operator can still be used for casts that
2300 do not require run-time type information, i.e.@: casts to @code{void *} or to
2301 unambiguous base classes.
2302
2303 @item -fstats
2304 @opindex fstats
2305 Emit statistics about front-end processing at the end of the compilation.
2306 This information is generally only useful to the G++ development team.
2307
2308 @item -fstrict-enums
2309 @opindex fstrict-enums
2310 Allow the compiler to optimize using the assumption that a value of
2311 enumerated type can only be one of the values of the enumeration (as
2312 defined in the C++ standard; basically, a value that can be
2313 represented in the minimum number of bits needed to represent all the
2314 enumerators). This assumption may not be valid if the program uses a
2315 cast to convert an arbitrary integer value to the enumerated type.
2316
2317 @item -ftemplate-backtrace-limit=@var{n}
2318 @opindex ftemplate-backtrace-limit
2319 Set the maximum number of template instantiation notes for a single
2320 warning or error to @var{n}. The default value is 10.
2321
2322 @item -ftemplate-depth=@var{n}
2323 @opindex ftemplate-depth
2324 Set the maximum instantiation depth for template classes to @var{n}.
2325 A limit on the template instantiation depth is needed to detect
2326 endless recursions during template class instantiation. ANSI/ISO C++
2327 conforming programs must not rely on a maximum depth greater than 17
2328 (changed to 1024 in C++11). The default value is 900, as the compiler
2329 can run out of stack space before hitting 1024 in some situations.
2330
2331 @item -fno-threadsafe-statics
2332 @opindex fno-threadsafe-statics
2333 Do not emit the extra code to use the routines specified in the C++
2334 ABI for thread-safe initialization of local statics. You can use this
2335 option to reduce code size slightly in code that doesn't need to be
2336 thread-safe.
2337
2338 @item -fuse-cxa-atexit
2339 @opindex fuse-cxa-atexit
2340 Register destructors for objects with static storage duration with the
2341 @code{__cxa_atexit} function rather than the @code{atexit} function.
2342 This option is required for fully standards-compliant handling of static
2343 destructors, but only works if your C library supports
2344 @code{__cxa_atexit}.
2345
2346 @item -fno-use-cxa-get-exception-ptr
2347 @opindex fno-use-cxa-get-exception-ptr
2348 Don't use the @code{__cxa_get_exception_ptr} runtime routine. This
2349 causes @code{std::uncaught_exception} to be incorrect, but is necessary
2350 if the runtime routine is not available.
2351
2352 @item -fvisibility-inlines-hidden
2353 @opindex fvisibility-inlines-hidden
2354 This switch declares that the user does not attempt to compare
2355 pointers to inline functions or methods where the addresses of the two functions
2356 are taken in different shared objects.
2357
2358 The effect of this is that GCC may, effectively, mark inline methods with
2359 @code{__attribute__ ((visibility ("hidden")))} so that they do not
2360 appear in the export table of a DSO and do not require a PLT indirection
2361 when used within the DSO@. Enabling this option can have a dramatic effect
2362 on load and link times of a DSO as it massively reduces the size of the
2363 dynamic export table when the library makes heavy use of templates.
2364
2365 The behavior of this switch is not quite the same as marking the
2366 methods as hidden directly, because it does not affect static variables
2367 local to the function or cause the compiler to deduce that
2368 the function is defined in only one shared object.
2369
2370 You may mark a method as having a visibility explicitly to negate the
2371 effect of the switch for that method. For example, if you do want to
2372 compare pointers to a particular inline method, you might mark it as
2373 having default visibility. Marking the enclosing class with explicit
2374 visibility has no effect.
2375
2376 Explicitly instantiated inline methods are unaffected by this option
2377 as their linkage might otherwise cross a shared library boundary.
2378 @xref{Template Instantiation}.
2379
2380 @item -fvisibility-ms-compat
2381 @opindex fvisibility-ms-compat
2382 This flag attempts to use visibility settings to make GCC's C++
2383 linkage model compatible with that of Microsoft Visual Studio.
2384
2385 The flag makes these changes to GCC's linkage model:
2386
2387 @enumerate
2388 @item
2389 It sets the default visibility to @code{hidden}, like
2390 @option{-fvisibility=hidden}.
2391
2392 @item
2393 Types, but not their members, are not hidden by default.
2394
2395 @item
2396 The One Definition Rule is relaxed for types without explicit
2397 visibility specifications that are defined in more than one
2398 shared object: those declarations are permitted if they are
2399 permitted when this option is not used.
2400 @end enumerate
2401
2402 In new code it is better to use @option{-fvisibility=hidden} and
2403 export those classes that are intended to be externally visible.
2404 Unfortunately it is possible for code to rely, perhaps accidentally,
2405 on the Visual Studio behavior.
2406
2407 Among the consequences of these changes are that static data members
2408 of the same type with the same name but defined in different shared
2409 objects are different, so changing one does not change the other;
2410 and that pointers to function members defined in different shared
2411 objects may not compare equal. When this flag is given, it is a
2412 violation of the ODR to define types with the same name differently.
2413
2414 @item -fvtable-verify=@var{std|preinit|none}
2415 @opindex fvtable-verify
2416 Turn on (or off, if using @option{-fvtable-verify=none}) the security
2417 feature that verifies at runtime, for every virtual call that is made, that
2418 the vtable pointer through which the call is made is valid for the type of
2419 the object, and has not been corrupted or overwritten. If an invalid vtable
2420 pointer is detected (at runtime), an error is reported and execution of the
2421 program is immediately halted.
2422
2423 This option causes runtime data structures to be built, at program start up,
2424 for verifying the vtable pointers. The options @code{std} and @code{preinit}
2425 control the timing of when these data structures are built. In both cases the
2426 data structures are built before execution reaches 'main'. The
2427 @option{-fvtable-verify=std} causes these data structure to be built after the
2428 shared libraries have been loaded and initialized.
2429 @option{-fvtable-verify=preinit} causes them to be built before the shared
2430 libraries have been loaded and initialized.
2431
2432 If this option appears multiple times in the compiler line, with different
2433 values specified, 'none' will take highest priority over both 'std' and
2434 'preinit'; 'preinit' will take priority over 'std'.
2435
2436 @item -fvtv-debug
2437 @opindex (fvtv-debug)
2438 Causes debug versions of the runtime functions for the vtable verification
2439 feature to be called. This assumes the @option{-fvtable-verify=std} or
2440 @option{-fvtable-verify=preinit} has been used. This flag will also cause the
2441 compiler to keep track of which vtable pointers it found for each class, and
2442 record that information in the file ``vtv_set_ptr_data.log'', in the dump
2443 file directory on the user's machine.
2444
2445 Note: This feature APPENDS data to the log file. If you want a fresh log
2446 file, be sure to delete any existing one.
2447
2448 @item -fvtv-counts
2449 @opindex fvtv-counts
2450 This is a debugging flag. When used in conjunction with
2451 @option{-fvtable-verify=std} or @option{-fvtable-verify=preinit}, this
2452 causes the compiler to keep track of the total number of virtual calls
2453 it encountered and the number of verifications it inserted. It also
2454 counts the number of calls to certain runtime library functions
2455 that it inserts. This information, for each compilation unit, is written
2456 to a file named ``vtv_count_data.log'', in the dump_file directory on
2457 the user's machine. It also counts the size of the vtable pointer sets
2458 for each class, and writes this information to ``vtv_class_set_sizes.log''
2459 in the same directory.
2460
2461 Note: This feature APPENDS data to the log files. To get a fresh log
2462 files, be sure to delete any existing ones.
2463
2464 @item -fno-weak
2465 @opindex fno-weak
2466 Do not use weak symbol support, even if it is provided by the linker.
2467 By default, G++ uses weak symbols if they are available. This
2468 option exists only for testing, and should not be used by end-users;
2469 it results in inferior code and has no benefits. This option may
2470 be removed in a future release of G++.
2471
2472 @item -nostdinc++
2473 @opindex nostdinc++
2474 Do not search for header files in the standard directories specific to
2475 C++, but do still search the other standard directories. (This option
2476 is used when building the C++ library.)
2477 @end table
2478
2479 In addition, these optimization, warning, and code generation options
2480 have meanings only for C++ programs:
2481
2482 @table @gcctabopt
2483 @item -Wabi @r{(C, Objective-C, C++ and Objective-C++ only)}
2484 @opindex Wabi
2485 @opindex Wno-abi
2486 When an explicit @option{-fabi-version=@var{n}} option is used, causes
2487 G++ to warn when it generates code that is probably not compatible with the
2488 vendor-neutral C++ ABI@. Since G++ now defaults to
2489 @option{-fabi-version=0}, @option{-Wabi} has no effect unless either
2490 an older ABI version is selected (with @option{-fabi-version=@var{n}})
2491 or an older compatibility version is selected (with
2492 @option{-Wabi=@var{n}} or @option{-fabi-compat-version=@var{n}}).
2493
2494 Although an effort has been made to warn about
2495 all such cases, there are probably some cases that are not warned about,
2496 even though G++ is generating incompatible code. There may also be
2497 cases where warnings are emitted even though the code that is generated
2498 is compatible.
2499
2500 You should rewrite your code to avoid these warnings if you are
2501 concerned about the fact that code generated by G++ may not be binary
2502 compatible with code generated by other compilers.
2503
2504 @option{-Wabi} can also be used with an explicit version number to
2505 warn about compatibility with a particular @option{-fabi-version}
2506 level, e.g. @option{-Wabi=2} to warn about changes relative to
2507 @option{-fabi-version=2}. Specifying a version number also sets
2508 @option{-fabi-compat-version=@var{n}}.
2509
2510 The known incompatibilities in @option{-fabi-version=2} (which was the
2511 default from GCC 3.4 to 4.9) include:
2512
2513 @itemize @bullet
2514
2515 @item
2516 A template with a non-type template parameter of reference type was
2517 mangled incorrectly:
2518 @smallexample
2519 extern int N;
2520 template <int &> struct S @{@};
2521 void n (S<N>) @{2@}
2522 @end smallexample
2523
2524 This was fixed in @option{-fabi-version=3}.
2525
2526 @item
2527 SIMD vector types declared using @code{__attribute ((vector_size))} were
2528 mangled in a non-standard way that does not allow for overloading of
2529 functions taking vectors of different sizes.
2530
2531 The mangling was changed in @option{-fabi-version=4}.
2532
2533 @item
2534 @code{__attribute ((const))} and @code{noreturn} were mangled as type
2535 qualifiers, and @code{decltype} of a plain declaration was folded away.
2536
2537 These mangling issues were fixed in @option{-fabi-version=5}.
2538
2539 @item
2540 Scoped enumerators passed as arguments to a variadic function are
2541 promoted like unscoped enumerators, causing @samp{va_arg} to complain.
2542 On most targets this does not actually affect the parameter passing
2543 ABI, as there is no way to pass an argument smaller than @samp{int}.
2544
2545 Also, the ABI changed the mangling of template argument packs,
2546 @code{const_cast}, @code{static_cast}, prefix increment/decrement, and
2547 a class scope function used as a template argument.
2548
2549 These issues were corrected in @option{-fabi-version=6}.
2550
2551 @item
2552 Lambdas in default argument scope were mangled incorrectly, and the
2553 ABI changed the mangling of nullptr_t.
2554
2555 These issues were corrected in @option{-fabi-version=7}.
2556
2557 @item
2558 When mangling a function type with function-cv-qualifiers, the
2559 un-qualified function type was incorrectly treated as a substitution
2560 candidate.
2561
2562 This was fixed in @option{-fabi-version=8}.
2563 @end itemize
2564
2565 It also warns about psABI-related changes. The known psABI changes at this
2566 point include:
2567
2568 @itemize @bullet
2569
2570 @item
2571 For SysV/x86-64, unions with @code{long double} members are
2572 passed in memory as specified in psABI. For example:
2573
2574 @smallexample
2575 union U @{
2576 long double ld;
2577 int i;
2578 @};
2579 @end smallexample
2580
2581 @noindent
2582 @code{union U} is always passed in memory.
2583
2584 @end itemize
2585
2586 @item -Wctor-dtor-privacy @r{(C++ and Objective-C++ only)}
2587 @opindex Wctor-dtor-privacy
2588 @opindex Wno-ctor-dtor-privacy
2589 Warn when a class seems unusable because all the constructors or
2590 destructors in that class are private, and it has neither friends nor
2591 public static member functions. Also warn if there are no non-private
2592 methods, and there's at least one private member function that isn't
2593 a constructor or destructor.
2594
2595 @item -Wdelete-non-virtual-dtor @r{(C++ and Objective-C++ only)}
2596 @opindex Wdelete-non-virtual-dtor
2597 @opindex Wno-delete-non-virtual-dtor
2598 Warn when @samp{delete} is used to destroy an instance of a class that
2599 has virtual functions and non-virtual destructor. It is unsafe to delete
2600 an instance of a derived class through a pointer to a base class if the
2601 base class does not have a virtual destructor. This warning is enabled
2602 by @option{-Wall}.
2603
2604 @item -Wliteral-suffix @r{(C++ and Objective-C++ only)}
2605 @opindex Wliteral-suffix
2606 @opindex Wno-literal-suffix
2607 Warn when a string or character literal is followed by a ud-suffix which does
2608 not begin with an underscore. As a conforming extension, GCC treats such
2609 suffixes as separate preprocessing tokens in order to maintain backwards
2610 compatibility with code that uses formatting macros from @code{<inttypes.h>}.
2611 For example:
2612
2613 @smallexample
2614 #define __STDC_FORMAT_MACROS
2615 #include <inttypes.h>
2616 #include <stdio.h>
2617
2618 int main() @{
2619 int64_t i64 = 123;
2620 printf("My int64: %"PRId64"\n", i64);
2621 @}
2622 @end smallexample
2623
2624 In this case, @code{PRId64} is treated as a separate preprocessing token.
2625
2626 This warning is enabled by default.
2627
2628 @item -Wnarrowing @r{(C++ and Objective-C++ only)}
2629 @opindex Wnarrowing
2630 @opindex Wno-narrowing
2631 Warn when a narrowing conversion prohibited by C++11 occurs within
2632 @samp{@{ @}}, e.g.
2633
2634 @smallexample
2635 int i = @{ 2.2 @}; // error: narrowing from double to int
2636 @end smallexample
2637
2638 This flag is included in @option{-Wall} and @option{-Wc++11-compat}.
2639
2640 With @option{-std=c++11}, @option{-Wno-narrowing} suppresses for
2641 non-constants the diagnostic required by the standard. Note that this
2642 does not affect the meaning of well-formed code; narrowing conversions
2643 are still considered ill-formed in SFINAE context.
2644
2645 @item -Wnoexcept @r{(C++ and Objective-C++ only)}
2646 @opindex Wnoexcept
2647 @opindex Wno-noexcept
2648 Warn when a noexcept-expression evaluates to false because of a call
2649 to a function that does not have a non-throwing exception
2650 specification (i.e. @samp{throw()} or @samp{noexcept}) but is known by
2651 the compiler to never throw an exception.
2652
2653 @item -Wnon-virtual-dtor @r{(C++ and Objective-C++ only)}
2654 @opindex Wnon-virtual-dtor
2655 @opindex Wno-non-virtual-dtor
2656 Warn when a class has virtual functions and an accessible non-virtual
2657 destructor itself or in an accessible polymorphic base class, in which
2658 case it is possible but unsafe to delete an instance of a derived
2659 class through a pointer to the class itself or base class. This
2660 warning is automatically enabled if @option{-Weffc++} is specified.
2661
2662 @item -Wreorder @r{(C++ and Objective-C++ only)}
2663 @opindex Wreorder
2664 @opindex Wno-reorder
2665 @cindex reordering, warning
2666 @cindex warning for reordering of member initializers
2667 Warn when the order of member initializers given in the code does not
2668 match the order in which they must be executed. For instance:
2669
2670 @smallexample
2671 struct A @{
2672 int i;
2673 int j;
2674 A(): j (0), i (1) @{ @}
2675 @};
2676 @end smallexample
2677
2678 @noindent
2679 The compiler rearranges the member initializers for @samp{i}
2680 and @samp{j} to match the declaration order of the members, emitting
2681 a warning to that effect. This warning is enabled by @option{-Wall}.
2682
2683 @item -fext-numeric-literals @r{(C++ and Objective-C++ only)}
2684 @opindex fext-numeric-literals
2685 @opindex fno-ext-numeric-literals
2686 Accept imaginary, fixed-point, or machine-defined
2687 literal number suffixes as GNU extensions.
2688 When this option is turned off these suffixes are treated
2689 as C++11 user-defined literal numeric suffixes.
2690 This is on by default for all pre-C++11 dialects and all GNU dialects:
2691 @option{-std=c++98}, @option{-std=gnu++98}, @option{-std=gnu++11},
2692 @option{-std=gnu++14}.
2693 This option is off by default
2694 for ISO C++11 onwards (@option{-std=c++11}, ...).
2695 @end table
2696
2697 The following @option{-W@dots{}} options are not affected by @option{-Wall}.
2698
2699 @table @gcctabopt
2700 @item -Weffc++ @r{(C++ and Objective-C++ only)}
2701 @opindex Weffc++
2702 @opindex Wno-effc++
2703 Warn about violations of the following style guidelines from Scott Meyers'
2704 @cite{Effective C++} series of books:
2705
2706 @itemize @bullet
2707 @item
2708 Define a copy constructor and an assignment operator for classes
2709 with dynamically-allocated memory.
2710
2711 @item
2712 Prefer initialization to assignment in constructors.
2713
2714 @item
2715 Have @code{operator=} return a reference to @code{*this}.
2716
2717 @item
2718 Don't try to return a reference when you must return an object.
2719
2720 @item
2721 Distinguish between prefix and postfix forms of increment and
2722 decrement operators.
2723
2724 @item
2725 Never overload @code{&&}, @code{||}, or @code{,}.
2726
2727 @end itemize
2728
2729 This option also enables @option{-Wnon-virtual-dtor}, which is also
2730 one of the effective C++ recommendations. However, the check is
2731 extended to warn about the lack of virtual destructor in accessible
2732 non-polymorphic bases classes too.
2733
2734 When selecting this option, be aware that the standard library
2735 headers do not obey all of these guidelines; use @samp{grep -v}
2736 to filter out those warnings.
2737
2738 @item -Wstrict-null-sentinel @r{(C++ and Objective-C++ only)}
2739 @opindex Wstrict-null-sentinel
2740 @opindex Wno-strict-null-sentinel
2741 Warn about the use of an uncasted @code{NULL} as sentinel. When
2742 compiling only with GCC this is a valid sentinel, as @code{NULL} is defined
2743 to @code{__null}. Although it is a null pointer constant rather than a
2744 null pointer, it is guaranteed to be of the same size as a pointer.
2745 But this use is not portable across different compilers.
2746
2747 @item -Wno-non-template-friend @r{(C++ and Objective-C++ only)}
2748 @opindex Wno-non-template-friend
2749 @opindex Wnon-template-friend
2750 Disable warnings when non-templatized friend functions are declared
2751 within a template. Since the advent of explicit template specification
2752 support in G++, if the name of the friend is an unqualified-id (i.e.,
2753 @samp{friend foo(int)}), the C++ language specification demands that the
2754 friend declare or define an ordinary, nontemplate function. (Section
2755 14.5.3). Before G++ implemented explicit specification, unqualified-ids
2756 could be interpreted as a particular specialization of a templatized
2757 function. Because this non-conforming behavior is no longer the default
2758 behavior for G++, @option{-Wnon-template-friend} allows the compiler to
2759 check existing code for potential trouble spots and is on by default.
2760 This new compiler behavior can be turned off with
2761 @option{-Wno-non-template-friend}, which keeps the conformant compiler code
2762 but disables the helpful warning.
2763
2764 @item -Wold-style-cast @r{(C++ and Objective-C++ only)}
2765 @opindex Wold-style-cast
2766 @opindex Wno-old-style-cast
2767 Warn if an old-style (C-style) cast to a non-void type is used within
2768 a C++ program. The new-style casts (@samp{dynamic_cast},
2769 @samp{static_cast}, @samp{reinterpret_cast}, and @samp{const_cast}) are
2770 less vulnerable to unintended effects and much easier to search for.
2771
2772 @item -Woverloaded-virtual @r{(C++ and Objective-C++ only)}
2773 @opindex Woverloaded-virtual
2774 @opindex Wno-overloaded-virtual
2775 @cindex overloaded virtual function, warning
2776 @cindex warning for overloaded virtual function
2777 Warn when a function declaration hides virtual functions from a
2778 base class. For example, in:
2779
2780 @smallexample
2781 struct A @{
2782 virtual void f();
2783 @};
2784
2785 struct B: public A @{
2786 void f(int);
2787 @};
2788 @end smallexample
2789
2790 the @code{A} class version of @code{f} is hidden in @code{B}, and code
2791 like:
2792
2793 @smallexample
2794 B* b;
2795 b->f();
2796 @end smallexample
2797
2798 @noindent
2799 fails to compile.
2800
2801 @item -Wno-pmf-conversions @r{(C++ and Objective-C++ only)}
2802 @opindex Wno-pmf-conversions
2803 @opindex Wpmf-conversions
2804 Disable the diagnostic for converting a bound pointer to member function
2805 to a plain pointer.
2806
2807 @item -Wsign-promo @r{(C++ and Objective-C++ only)}
2808 @opindex Wsign-promo
2809 @opindex Wno-sign-promo
2810 Warn when overload resolution chooses a promotion from unsigned or
2811 enumerated type to a signed type, over a conversion to an unsigned type of
2812 the same size. Previous versions of G++ tried to preserve
2813 unsignedness, but the standard mandates the current behavior.
2814 @end table
2815
2816 @node Objective-C and Objective-C++ Dialect Options
2817 @section Options Controlling Objective-C and Objective-C++ Dialects
2818
2819 @cindex compiler options, Objective-C and Objective-C++
2820 @cindex Objective-C and Objective-C++ options, command-line
2821 @cindex options, Objective-C and Objective-C++
2822 (NOTE: This manual does not describe the Objective-C and Objective-C++
2823 languages themselves. @xref{Standards,,Language Standards
2824 Supported by GCC}, for references.)
2825
2826 This section describes the command-line options that are only meaningful
2827 for Objective-C and Objective-C++ programs. You can also use most of
2828 the language-independent GNU compiler options.
2829 For example, you might compile a file @code{some_class.m} like this:
2830
2831 @smallexample
2832 gcc -g -fgnu-runtime -O -c some_class.m
2833 @end smallexample
2834
2835 @noindent
2836 In this example, @option{-fgnu-runtime} is an option meant only for
2837 Objective-C and Objective-C++ programs; you can use the other options with
2838 any language supported by GCC@.
2839
2840 Note that since Objective-C is an extension of the C language, Objective-C
2841 compilations may also use options specific to the C front-end (e.g.,
2842 @option{-Wtraditional}). Similarly, Objective-C++ compilations may use
2843 C++-specific options (e.g., @option{-Wabi}).
2844
2845 Here is a list of options that are @emph{only} for compiling Objective-C
2846 and Objective-C++ programs:
2847
2848 @table @gcctabopt
2849 @item -fconstant-string-class=@var{class-name}
2850 @opindex fconstant-string-class
2851 Use @var{class-name} as the name of the class to instantiate for each
2852 literal string specified with the syntax @code{@@"@dots{}"}. The default
2853 class name is @code{NXConstantString} if the GNU runtime is being used, and
2854 @code{NSConstantString} if the NeXT runtime is being used (see below). The
2855 @option{-fconstant-cfstrings} option, if also present, overrides the
2856 @option{-fconstant-string-class} setting and cause @code{@@"@dots{}"} literals
2857 to be laid out as constant CoreFoundation strings.
2858
2859 @item -fgnu-runtime
2860 @opindex fgnu-runtime
2861 Generate object code compatible with the standard GNU Objective-C
2862 runtime. This is the default for most types of systems.
2863
2864 @item -fnext-runtime
2865 @opindex fnext-runtime
2866 Generate output compatible with the NeXT runtime. This is the default
2867 for NeXT-based systems, including Darwin and Mac OS X@. The macro
2868 @code{__NEXT_RUNTIME__} is predefined if (and only if) this option is
2869 used.
2870
2871 @item -fno-nil-receivers
2872 @opindex fno-nil-receivers
2873 Assume that all Objective-C message dispatches (@code{[receiver
2874 message:arg]}) in this translation unit ensure that the receiver is
2875 not @code{nil}. This allows for more efficient entry points in the
2876 runtime to be used. This option is only available in conjunction with
2877 the NeXT runtime and ABI version 0 or 1.
2878
2879 @item -fobjc-abi-version=@var{n}
2880 @opindex fobjc-abi-version
2881 Use version @var{n} of the Objective-C ABI for the selected runtime.
2882 This option is currently supported only for the NeXT runtime. In that
2883 case, Version 0 is the traditional (32-bit) ABI without support for
2884 properties and other Objective-C 2.0 additions. Version 1 is the
2885 traditional (32-bit) ABI with support for properties and other
2886 Objective-C 2.0 additions. Version 2 is the modern (64-bit) ABI. If
2887 nothing is specified, the default is Version 0 on 32-bit target
2888 machines, and Version 2 on 64-bit target machines.
2889
2890 @item -fobjc-call-cxx-cdtors
2891 @opindex fobjc-call-cxx-cdtors
2892 For each Objective-C class, check if any of its instance variables is a
2893 C++ object with a non-trivial default constructor. If so, synthesize a
2894 special @code{- (id) .cxx_construct} instance method which runs
2895 non-trivial default constructors on any such instance variables, in order,
2896 and then return @code{self}. Similarly, check if any instance variable
2897 is a C++ object with a non-trivial destructor, and if so, synthesize a
2898 special @code{- (void) .cxx_destruct} method which runs
2899 all such default destructors, in reverse order.
2900
2901 The @code{- (id) .cxx_construct} and @code{- (void) .cxx_destruct}
2902 methods thusly generated only operate on instance variables
2903 declared in the current Objective-C class, and not those inherited
2904 from superclasses. It is the responsibility of the Objective-C
2905 runtime to invoke all such methods in an object's inheritance
2906 hierarchy. The @code{- (id) .cxx_construct} methods are invoked
2907 by the runtime immediately after a new object instance is allocated;
2908 the @code{- (void) .cxx_destruct} methods are invoked immediately
2909 before the runtime deallocates an object instance.
2910
2911 As of this writing, only the NeXT runtime on Mac OS X 10.4 and later has
2912 support for invoking the @code{- (id) .cxx_construct} and
2913 @code{- (void) .cxx_destruct} methods.
2914
2915 @item -fobjc-direct-dispatch
2916 @opindex fobjc-direct-dispatch
2917 Allow fast jumps to the message dispatcher. On Darwin this is
2918 accomplished via the comm page.
2919
2920 @item -fobjc-exceptions
2921 @opindex fobjc-exceptions
2922 Enable syntactic support for structured exception handling in
2923 Objective-C, similar to what is offered by C++ and Java. This option
2924 is required to use the Objective-C keywords @code{@@try},
2925 @code{@@throw}, @code{@@catch}, @code{@@finally} and
2926 @code{@@synchronized}. This option is available with both the GNU
2927 runtime and the NeXT runtime (but not available in conjunction with
2928 the NeXT runtime on Mac OS X 10.2 and earlier).
2929
2930 @item -fobjc-gc
2931 @opindex fobjc-gc
2932 Enable garbage collection (GC) in Objective-C and Objective-C++
2933 programs. This option is only available with the NeXT runtime; the
2934 GNU runtime has a different garbage collection implementation that
2935 does not require special compiler flags.
2936
2937 @item -fobjc-nilcheck
2938 @opindex fobjc-nilcheck
2939 For the NeXT runtime with version 2 of the ABI, check for a nil
2940 receiver in method invocations before doing the actual method call.
2941 This is the default and can be disabled using
2942 @option{-fno-objc-nilcheck}. Class methods and super calls are never
2943 checked for nil in this way no matter what this flag is set to.
2944 Currently this flag does nothing when the GNU runtime, or an older
2945 version of the NeXT runtime ABI, is used.
2946
2947 @item -fobjc-std=objc1
2948 @opindex fobjc-std
2949 Conform to the language syntax of Objective-C 1.0, the language
2950 recognized by GCC 4.0. This only affects the Objective-C additions to
2951 the C/C++ language; it does not affect conformance to C/C++ standards,
2952 which is controlled by the separate C/C++ dialect option flags. When
2953 this option is used with the Objective-C or Objective-C++ compiler,
2954 any Objective-C syntax that is not recognized by GCC 4.0 is rejected.
2955 This is useful if you need to make sure that your Objective-C code can
2956 be compiled with older versions of GCC@.
2957
2958 @item -freplace-objc-classes
2959 @opindex freplace-objc-classes
2960 Emit a special marker instructing @command{ld(1)} not to statically link in
2961 the resulting object file, and allow @command{dyld(1)} to load it in at
2962 run time instead. This is used in conjunction with the Fix-and-Continue
2963 debugging mode, where the object file in question may be recompiled and
2964 dynamically reloaded in the course of program execution, without the need
2965 to restart the program itself. Currently, Fix-and-Continue functionality
2966 is only available in conjunction with the NeXT runtime on Mac OS X 10.3
2967 and later.
2968
2969 @item -fzero-link
2970 @opindex fzero-link
2971 When compiling for the NeXT runtime, the compiler ordinarily replaces calls
2972 to @code{objc_getClass("@dots{}")} (when the name of the class is known at
2973 compile time) with static class references that get initialized at load time,
2974 which improves run-time performance. Specifying the @option{-fzero-link} flag
2975 suppresses this behavior and causes calls to @code{objc_getClass("@dots{}")}
2976 to be retained. This is useful in Zero-Link debugging mode, since it allows
2977 for individual class implementations to be modified during program execution.
2978 The GNU runtime currently always retains calls to @code{objc_get_class("@dots{}")}
2979 regardless of command-line options.
2980
2981 @item -fno-local-ivars
2982 @opindex fno-local-ivars
2983 @opindex flocal-ivars
2984 By default instance variables in Objective-C can be accessed as if
2985 they were local variables from within the methods of the class they're
2986 declared in. This can lead to shadowing between instance variables
2987 and other variables declared either locally inside a class method or
2988 globally with the same name. Specifying the @option{-fno-local-ivars}
2989 flag disables this behavior thus avoiding variable shadowing issues.
2990
2991 @item -fivar-visibility=@var{public|protected|private|package}
2992 @opindex fivar-visibility
2993 Set the default instance variable visibility to the specified option
2994 so that instance variables declared outside the scope of any access
2995 modifier directives default to the specified visibility.
2996
2997 @item -gen-decls
2998 @opindex gen-decls
2999 Dump interface declarations for all classes seen in the source file to a
3000 file named @file{@var{sourcename}.decl}.
3001
3002 @item -Wassign-intercept @r{(Objective-C and Objective-C++ only)}
3003 @opindex Wassign-intercept
3004 @opindex Wno-assign-intercept
3005 Warn whenever an Objective-C assignment is being intercepted by the
3006 garbage collector.
3007
3008 @item -Wno-protocol @r{(Objective-C and Objective-C++ only)}
3009 @opindex Wno-protocol
3010 @opindex Wprotocol
3011 If a class is declared to implement a protocol, a warning is issued for
3012 every method in the protocol that is not implemented by the class. The
3013 default behavior is to issue a warning for every method not explicitly
3014 implemented in the class, even if a method implementation is inherited
3015 from the superclass. If you use the @option{-Wno-protocol} option, then
3016 methods inherited from the superclass are considered to be implemented,
3017 and no warning is issued for them.
3018
3019 @item -Wselector @r{(Objective-C and Objective-C++ only)}
3020 @opindex Wselector
3021 @opindex Wno-selector
3022 Warn if multiple methods of different types for the same selector are
3023 found during compilation. The check is performed on the list of methods
3024 in the final stage of compilation. Additionally, a check is performed
3025 for each selector appearing in a @code{@@selector(@dots{})}
3026 expression, and a corresponding method for that selector has been found
3027 during compilation. Because these checks scan the method table only at
3028 the end of compilation, these warnings are not produced if the final
3029 stage of compilation is not reached, for example because an error is
3030 found during compilation, or because the @option{-fsyntax-only} option is
3031 being used.
3032
3033 @item -Wstrict-selector-match @r{(Objective-C and Objective-C++ only)}
3034 @opindex Wstrict-selector-match
3035 @opindex Wno-strict-selector-match
3036 Warn if multiple methods with differing argument and/or return types are
3037 found for a given selector when attempting to send a message using this
3038 selector to a receiver of type @code{id} or @code{Class}. When this flag
3039 is off (which is the default behavior), the compiler omits such warnings
3040 if any differences found are confined to types that share the same size
3041 and alignment.
3042
3043 @item -Wundeclared-selector @r{(Objective-C and Objective-C++ only)}
3044 @opindex Wundeclared-selector
3045 @opindex Wno-undeclared-selector
3046 Warn if a @code{@@selector(@dots{})} expression referring to an
3047 undeclared selector is found. A selector is considered undeclared if no
3048 method with that name has been declared before the
3049 @code{@@selector(@dots{})} expression, either explicitly in an
3050 @code{@@interface} or @code{@@protocol} declaration, or implicitly in
3051 an @code{@@implementation} section. This option always performs its
3052 checks as soon as a @code{@@selector(@dots{})} expression is found,
3053 while @option{-Wselector} only performs its checks in the final stage of
3054 compilation. This also enforces the coding style convention
3055 that methods and selectors must be declared before being used.
3056
3057 @item -print-objc-runtime-info
3058 @opindex print-objc-runtime-info
3059 Generate C header describing the largest structure that is passed by
3060 value, if any.
3061
3062 @end table
3063
3064 @node Language Independent Options
3065 @section Options to Control Diagnostic Messages Formatting
3066 @cindex options to control diagnostics formatting
3067 @cindex diagnostic messages
3068 @cindex message formatting
3069
3070 Traditionally, diagnostic messages have been formatted irrespective of
3071 the output device's aspect (e.g.@: its width, @dots{}). You can use the
3072 options described below
3073 to control the formatting algorithm for diagnostic messages,
3074 e.g.@: how many characters per line, how often source location
3075 information should be reported. Note that some language front ends may not
3076 honor these options.
3077
3078 @table @gcctabopt
3079 @item -fmessage-length=@var{n}
3080 @opindex fmessage-length
3081 Try to format error messages so that they fit on lines of about
3082 @var{n} characters. If @var{n} is zero, then no line-wrapping will be
3083 done; each error message will appear on a single line. This is the
3084 default for all front ends.
3085
3086 @item -fdiagnostics-show-location=once
3087 @opindex fdiagnostics-show-location
3088 Only meaningful in line-wrapping mode. Instructs the diagnostic messages
3089 reporter to emit source location information @emph{once}; that is, in
3090 case the message is too long to fit on a single physical line and has to
3091 be wrapped, the source location won't be emitted (as prefix) again,
3092 over and over, in subsequent continuation lines. This is the default
3093 behavior.
3094
3095 @item -fdiagnostics-show-location=every-line
3096 Only meaningful in line-wrapping mode. Instructs the diagnostic
3097 messages reporter to emit the same source location information (as
3098 prefix) for physical lines that result from the process of breaking
3099 a message which is too long to fit on a single line.
3100
3101 @item -fdiagnostics-color[=@var{WHEN}]
3102 @itemx -fno-diagnostics-color
3103 @opindex fdiagnostics-color
3104 @cindex highlight, color, colour
3105 @vindex GCC_COLORS @r{environment variable}
3106 Use color in diagnostics. @var{WHEN} is @samp{never}, @samp{always},
3107 or @samp{auto}. The default is @samp{never} if @env{GCC_COLORS} environment
3108 variable isn't present in the environment, and @samp{auto} otherwise.
3109 @samp{auto} means to use color only when the standard error is a terminal.
3110 The forms @option{-fdiagnostics-color} and @option{-fno-diagnostics-color} are
3111 aliases for @option{-fdiagnostics-color=always} and
3112 @option{-fdiagnostics-color=never}, respectively.
3113
3114 The colors are defined by the environment variable @env{GCC_COLORS}.
3115 Its value is a colon-separated list of capabilities and Select Graphic
3116 Rendition (SGR) substrings. SGR commands are interpreted by the
3117 terminal or terminal emulator. (See the section in the documentation
3118 of your text terminal for permitted values and their meanings as
3119 character attributes.) These substring values are integers in decimal
3120 representation and can be concatenated with semicolons.
3121 Common values to concatenate include
3122 @samp{1} for bold,
3123 @samp{4} for underline,
3124 @samp{5} for blink,
3125 @samp{7} for inverse,
3126 @samp{39} for default foreground color,
3127 @samp{30} to @samp{37} for foreground colors,
3128 @samp{90} to @samp{97} for 16-color mode foreground colors,
3129 @samp{38;5;0} to @samp{38;5;255}
3130 for 88-color and 256-color modes foreground colors,
3131 @samp{49} for default background color,
3132 @samp{40} to @samp{47} for background colors,
3133 @samp{100} to @samp{107} for 16-color mode background colors,
3134 and @samp{48;5;0} to @samp{48;5;255}
3135 for 88-color and 256-color modes background colors.
3136
3137 The default @env{GCC_COLORS} is
3138 @samp{error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01}
3139 where @samp{01;31} is bold red, @samp{01;35} is bold magenta,
3140 @samp{01;36} is bold cyan, @samp{01;32} is bold green and
3141 @samp{01} is bold. Setting @env{GCC_COLORS} to the empty
3142 string disables colors.
3143 Supported capabilities are as follows.
3144
3145 @table @code
3146 @item error=
3147 @vindex error GCC_COLORS @r{capability}
3148 SGR substring for error: markers.
3149
3150 @item warning=
3151 @vindex warning GCC_COLORS @r{capability}
3152 SGR substring for warning: markers.
3153
3154 @item note=
3155 @vindex note GCC_COLORS @r{capability}
3156 SGR substring for note: markers.
3157
3158 @item caret=
3159 @vindex caret GCC_COLORS @r{capability}
3160 SGR substring for caret line.
3161
3162 @item locus=
3163 @vindex locus GCC_COLORS @r{capability}
3164 SGR substring for location information, @samp{file:line} or
3165 @samp{file:line:column} etc.
3166
3167 @item quote=
3168 @vindex quote GCC_COLORS @r{capability}
3169 SGR substring for information printed within quotes.
3170 @end table
3171
3172 @item -fno-diagnostics-show-option
3173 @opindex fno-diagnostics-show-option
3174 @opindex fdiagnostics-show-option
3175 By default, each diagnostic emitted includes text indicating the
3176 command-line option that directly controls the diagnostic (if such an
3177 option is known to the diagnostic machinery). Specifying the
3178 @option{-fno-diagnostics-show-option} flag suppresses that behavior.
3179
3180 @item -fno-diagnostics-show-caret
3181 @opindex fno-diagnostics-show-caret
3182 @opindex fdiagnostics-show-caret
3183 By default, each diagnostic emitted includes the original source line
3184 and a caret '^' indicating the column. This option suppresses this
3185 information.
3186
3187 @end table
3188
3189 @node Warning Options
3190 @section Options to Request or Suppress Warnings
3191 @cindex options to control warnings
3192 @cindex warning messages
3193 @cindex messages, warning
3194 @cindex suppressing warnings
3195
3196 Warnings are diagnostic messages that report constructions that
3197 are not inherently erroneous but that are risky or suggest there
3198 may have been an error.
3199
3200 The following language-independent options do not enable specific
3201 warnings but control the kinds of diagnostics produced by GCC@.
3202
3203 @table @gcctabopt
3204 @cindex syntax checking
3205 @item -fsyntax-only
3206 @opindex fsyntax-only
3207 Check the code for syntax errors, but don't do anything beyond that.
3208
3209 @item -fmax-errors=@var{n}
3210 @opindex fmax-errors
3211 Limits the maximum number of error messages to @var{n}, at which point
3212 GCC bails out rather than attempting to continue processing the source
3213 code. If @var{n} is 0 (the default), there is no limit on the number
3214 of error messages produced. If @option{-Wfatal-errors} is also
3215 specified, then @option{-Wfatal-errors} takes precedence over this
3216 option.
3217
3218 @item -w
3219 @opindex w
3220 Inhibit all warning messages.
3221
3222 @item -Werror
3223 @opindex Werror
3224 @opindex Wno-error
3225 Make all warnings into errors.
3226
3227 @item -Werror=
3228 @opindex Werror=
3229 @opindex Wno-error=
3230 Make the specified warning into an error. The specifier for a warning
3231 is appended; for example @option{-Werror=switch} turns the warnings
3232 controlled by @option{-Wswitch} into errors. This switch takes a
3233 negative form, to be used to negate @option{-Werror} for specific
3234 warnings; for example @option{-Wno-error=switch} makes
3235 @option{-Wswitch} warnings not be errors, even when @option{-Werror}
3236 is in effect.
3237
3238 The warning message for each controllable warning includes the
3239 option that controls the warning. That option can then be used with
3240 @option{-Werror=} and @option{-Wno-error=} as described above.
3241 (Printing of the option in the warning message can be disabled using the
3242 @option{-fno-diagnostics-show-option} flag.)
3243
3244 Note that specifying @option{-Werror=}@var{foo} automatically implies
3245 @option{-W}@var{foo}. However, @option{-Wno-error=}@var{foo} does not
3246 imply anything.
3247
3248 @item -Wfatal-errors
3249 @opindex Wfatal-errors
3250 @opindex Wno-fatal-errors
3251 This option causes the compiler to abort compilation on the first error
3252 occurred rather than trying to keep going and printing further error
3253 messages.
3254
3255 @end table
3256
3257 You can request many specific warnings with options beginning with
3258 @samp{-W}, for example @option{-Wimplicit} to request warnings on
3259 implicit declarations. Each of these specific warning options also
3260 has a negative form beginning @samp{-Wno-} to turn off warnings; for
3261 example, @option{-Wno-implicit}. This manual lists only one of the
3262 two forms, whichever is not the default. For further
3263 language-specific options also refer to @ref{C++ Dialect Options} and
3264 @ref{Objective-C and Objective-C++ Dialect Options}.
3265
3266 Some options, such as @option{-Wall} and @option{-Wextra}, turn on other
3267 options, such as @option{-Wunused}, which may turn on further options,
3268 such as @option{-Wunused-value}. The combined effect of positive and
3269 negative forms is that more specific options have priority over less
3270 specific ones, independently of their position in the command-line. For
3271 options of the same specificity, the last one takes effect. Options
3272 enabled or disabled via pragmas (@pxref{Diagnostic Pragmas}) take effect
3273 as if they appeared at the end of the command-line.
3274
3275 When an unrecognized warning option is requested (e.g.,
3276 @option{-Wunknown-warning}), GCC emits a diagnostic stating
3277 that the option is not recognized. However, if the @option{-Wno-} form
3278 is used, the behavior is slightly different: no diagnostic is
3279 produced for @option{-Wno-unknown-warning} unless other diagnostics
3280 are being produced. This allows the use of new @option{-Wno-} options
3281 with old compilers, but if something goes wrong, the compiler
3282 warns that an unrecognized option is present.
3283
3284 @table @gcctabopt
3285 @item -Wpedantic
3286 @itemx -pedantic
3287 @opindex pedantic
3288 @opindex Wpedantic
3289 Issue all the warnings demanded by strict ISO C and ISO C++;
3290 reject all programs that use forbidden extensions, and some other
3291 programs that do not follow ISO C and ISO C++. For ISO C, follows the
3292 version of the ISO C standard specified by any @option{-std} option used.
3293
3294 Valid ISO C and ISO C++ programs should compile properly with or without
3295 this option (though a rare few require @option{-ansi} or a
3296 @option{-std} option specifying the required version of ISO C)@. However,
3297 without this option, certain GNU extensions and traditional C and C++
3298 features are supported as well. With this option, they are rejected.
3299
3300 @option{-Wpedantic} does not cause warning messages for use of the
3301 alternate keywords whose names begin and end with @samp{__}. Pedantic
3302 warnings are also disabled in the expression that follows
3303 @code{__extension__}. However, only system header files should use
3304 these escape routes; application programs should avoid them.
3305 @xref{Alternate Keywords}.
3306
3307 Some users try to use @option{-Wpedantic} to check programs for strict ISO
3308 C conformance. They soon find that it does not do quite what they want:
3309 it finds some non-ISO practices, but not all---only those for which
3310 ISO C @emph{requires} a diagnostic, and some others for which
3311 diagnostics have been added.
3312
3313 A feature to report any failure to conform to ISO C might be useful in
3314 some instances, but would require considerable additional work and would
3315 be quite different from @option{-Wpedantic}. We don't have plans to
3316 support such a feature in the near future.
3317
3318 Where the standard specified with @option{-std} represents a GNU
3319 extended dialect of C, such as @samp{gnu90} or @samp{gnu99}, there is a
3320 corresponding @dfn{base standard}, the version of ISO C on which the GNU
3321 extended dialect is based. Warnings from @option{-Wpedantic} are given
3322 where they are required by the base standard. (It does not make sense
3323 for such warnings to be given only for features not in the specified GNU
3324 C dialect, since by definition the GNU dialects of C include all
3325 features the compiler supports with the given option, and there would be
3326 nothing to warn about.)
3327
3328 @item -pedantic-errors
3329 @opindex pedantic-errors
3330 Give an error whenever the @dfn{base standard} (see @option{-Wpedantic})
3331 requires a diagnostic, in some cases where there is undefined behavior
3332 at compile-time and in some other cases that do not prevent compilation
3333 of programs that are valid according to the standard. This is not
3334 equivalent to @option{-Werror=pedantic}, since there are errors enabled
3335 by this option and not enabled by the latter and vice versa.
3336
3337 @item -Wall
3338 @opindex Wall
3339 @opindex Wno-all
3340 This enables all the warnings about constructions that some users
3341 consider questionable, and that are easy to avoid (or modify to
3342 prevent the warning), even in conjunction with macros. This also
3343 enables some language-specific warnings described in @ref{C++ Dialect
3344 Options} and @ref{Objective-C and Objective-C++ Dialect Options}.
3345
3346 @option{-Wall} turns on the following warning flags:
3347
3348 @gccoptlist{-Waddress @gol
3349 -Warray-bounds @r{(only with} @option{-O2}@r{)} @gol
3350 -Wc++11-compat @gol
3351 -Wchar-subscripts @gol
3352 -Wenum-compare @r{(in C/ObjC; this is on by default in C++)} @gol
3353 -Wimplicit-int @r{(C and Objective-C only)} @gol
3354 -Wimplicit-function-declaration @r{(C and Objective-C only)} @gol
3355 -Wcomment @gol
3356 -Wformat @gol
3357 -Wmain @r{(only for C/ObjC and unless} @option{-ffreestanding}@r{)} @gol
3358 -Wmaybe-uninitialized @gol
3359 -Wmissing-braces @r{(only for C/ObjC)} @gol
3360 -Wnonnull @gol
3361 -Wopenmp-simd @gol
3362 -Wparentheses @gol
3363 -Wpointer-sign @gol
3364 -Wreorder @gol
3365 -Wreturn-type @gol
3366 -Wsequence-point @gol
3367 -Wsign-compare @r{(only in C++)} @gol
3368 -Wstrict-aliasing @gol
3369 -Wstrict-overflow=1 @gol
3370 -Wswitch @gol
3371 -Wtrigraphs @gol
3372 -Wuninitialized @gol
3373 -Wunknown-pragmas @gol
3374 -Wunused-function @gol
3375 -Wunused-label @gol
3376 -Wunused-value @gol
3377 -Wunused-variable @gol
3378 -Wvolatile-register-var @gol
3379 }
3380
3381 Note that some warning flags are not implied by @option{-Wall}. Some of
3382 them warn about constructions that users generally do not consider
3383 questionable, but which occasionally you might wish to check for;
3384 others warn about constructions that are necessary or hard to avoid in
3385 some cases, and there is no simple way to modify the code to suppress
3386 the warning. Some of them are enabled by @option{-Wextra} but many of
3387 them must be enabled individually.
3388
3389 @item -Wextra
3390 @opindex W
3391 @opindex Wextra
3392 @opindex Wno-extra
3393 This enables some extra warning flags that are not enabled by
3394 @option{-Wall}. (This option used to be called @option{-W}. The older
3395 name is still supported, but the newer name is more descriptive.)
3396
3397 @gccoptlist{-Wclobbered @gol
3398 -Wempty-body @gol
3399 -Wignored-qualifiers @gol
3400 -Wmissing-field-initializers @gol
3401 -Wmissing-parameter-type @r{(C only)} @gol
3402 -Wold-style-declaration @r{(C only)} @gol
3403 -Woverride-init @gol
3404 -Wsign-compare @gol
3405 -Wtype-limits @gol
3406 -Wuninitialized @gol
3407 -Wunused-parameter @r{(only with} @option{-Wunused} @r{or} @option{-Wall}@r{)} @gol
3408 -Wunused-but-set-parameter @r{(only with} @option{-Wunused} @r{or} @option{-Wall}@r{)} @gol
3409 }
3410
3411 The option @option{-Wextra} also prints warning messages for the
3412 following cases:
3413
3414 @itemize @bullet
3415
3416 @item
3417 A pointer is compared against integer zero with @samp{<}, @samp{<=},
3418 @samp{>}, or @samp{>=}.
3419
3420 @item
3421 (C++ only) An enumerator and a non-enumerator both appear in a
3422 conditional expression.
3423
3424 @item
3425 (C++ only) Ambiguous virtual bases.
3426
3427 @item
3428 (C++ only) Subscripting an array that has been declared @samp{register}.
3429
3430 @item
3431 (C++ only) Taking the address of a variable that has been declared
3432 @samp{register}.
3433
3434 @item
3435 (C++ only) A base class is not initialized in a derived class's copy
3436 constructor.
3437
3438 @end itemize
3439
3440 @item -Wchar-subscripts
3441 @opindex Wchar-subscripts
3442 @opindex Wno-char-subscripts
3443 Warn if an array subscript has type @code{char}. This is a common cause
3444 of error, as programmers often forget that this type is signed on some
3445 machines.
3446 This warning is enabled by @option{-Wall}.
3447
3448 @item -Wcomment
3449 @opindex Wcomment
3450 @opindex Wno-comment
3451 Warn whenever a comment-start sequence @samp{/*} appears in a @samp{/*}
3452 comment, or whenever a Backslash-Newline appears in a @samp{//} comment.
3453 This warning is enabled by @option{-Wall}.
3454
3455 @item -Wno-coverage-mismatch
3456 @opindex Wno-coverage-mismatch
3457 Warn if feedback profiles do not match when using the
3458 @option{-fprofile-use} option.
3459 If a source file is changed between compiling with @option{-fprofile-gen} and
3460 with @option{-fprofile-use}, the files with the profile feedback can fail
3461 to match the source file and GCC cannot use the profile feedback
3462 information. By default, this warning is enabled and is treated as an
3463 error. @option{-Wno-coverage-mismatch} can be used to disable the
3464 warning or @option{-Wno-error=coverage-mismatch} can be used to
3465 disable the error. Disabling the error for this warning can result in
3466 poorly optimized code and is useful only in the
3467 case of very minor changes such as bug fixes to an existing code-base.
3468 Completely disabling the warning is not recommended.
3469
3470 @item -Wno-cpp
3471 @r{(C, Objective-C, C++, Objective-C++ and Fortran only)}
3472
3473 Suppress warning messages emitted by @code{#warning} directives.
3474
3475 @item -Wdouble-promotion @r{(C, C++, Objective-C and Objective-C++ only)}
3476 @opindex Wdouble-promotion
3477 @opindex Wno-double-promotion
3478 Give a warning when a value of type @code{float} is implicitly
3479 promoted to @code{double}. CPUs with a 32-bit ``single-precision''
3480 floating-point unit implement @code{float} in hardware, but emulate
3481 @code{double} in software. On such a machine, doing computations
3482 using @code{double} values is much more expensive because of the
3483 overhead required for software emulation.
3484
3485 It is easy to accidentally do computations with @code{double} because
3486 floating-point literals are implicitly of type @code{double}. For
3487 example, in:
3488 @smallexample
3489 @group
3490 float area(float radius)
3491 @{
3492 return 3.14159 * radius * radius;
3493 @}
3494 @end group
3495 @end smallexample
3496 the compiler performs the entire computation with @code{double}
3497 because the floating-point literal is a @code{double}.
3498
3499 @item -Wformat
3500 @itemx -Wformat=@var{n}
3501 @opindex Wformat
3502 @opindex Wno-format
3503 @opindex ffreestanding
3504 @opindex fno-builtin
3505 @opindex Wformat=
3506 Check calls to @code{printf} and @code{scanf}, etc., to make sure that
3507 the arguments supplied have types appropriate to the format string
3508 specified, and that the conversions specified in the format string make
3509 sense. This includes standard functions, and others specified by format
3510 attributes (@pxref{Function Attributes}), in the @code{printf},
3511 @code{scanf}, @code{strftime} and @code{strfmon} (an X/Open extension,
3512 not in the C standard) families (or other target-specific families).
3513 Which functions are checked without format attributes having been
3514 specified depends on the standard version selected, and such checks of
3515 functions without the attribute specified are disabled by
3516 @option{-ffreestanding} or @option{-fno-builtin}.
3517
3518 The formats are checked against the format features supported by GNU
3519 libc version 2.2. These include all ISO C90 and C99 features, as well
3520 as features from the Single Unix Specification and some BSD and GNU
3521 extensions. Other library implementations may not support all these
3522 features; GCC does not support warning about features that go beyond a
3523 particular library's limitations. However, if @option{-Wpedantic} is used
3524 with @option{-Wformat}, warnings are given about format features not
3525 in the selected standard version (but not for @code{strfmon} formats,
3526 since those are not in any version of the C standard). @xref{C Dialect
3527 Options,,Options Controlling C Dialect}.
3528
3529 @table @gcctabopt
3530 @item -Wformat=1
3531 @itemx -Wformat
3532 @opindex Wformat
3533 @opindex Wformat=1
3534 Option @option{-Wformat} is equivalent to @option{-Wformat=1}, and
3535 @option{-Wno-format} is equivalent to @option{-Wformat=0}. Since
3536 @option{-Wformat} also checks for null format arguments for several
3537 functions, @option{-Wformat} also implies @option{-Wnonnull}. Some
3538 aspects of this level of format checking can be disabled by the
3539 options: @option{-Wno-format-contains-nul},
3540 @option{-Wno-format-extra-args}, and @option{-Wno-format-zero-length}.
3541 @option{-Wformat} is enabled by @option{-Wall}.
3542
3543 @item -Wno-format-contains-nul
3544 @opindex Wno-format-contains-nul
3545 @opindex Wformat-contains-nul
3546 If @option{-Wformat} is specified, do not warn about format strings that
3547 contain NUL bytes.
3548
3549 @item -Wno-format-extra-args
3550 @opindex Wno-format-extra-args
3551 @opindex Wformat-extra-args
3552 If @option{-Wformat} is specified, do not warn about excess arguments to a
3553 @code{printf} or @code{scanf} format function. The C standard specifies
3554 that such arguments are ignored.
3555
3556 Where the unused arguments lie between used arguments that are
3557 specified with @samp{$} operand number specifications, normally
3558 warnings are still given, since the implementation could not know what
3559 type to pass to @code{va_arg} to skip the unused arguments. However,
3560 in the case of @code{scanf} formats, this option suppresses the
3561 warning if the unused arguments are all pointers, since the Single
3562 Unix Specification says that such unused arguments are allowed.
3563
3564 @item -Wno-format-zero-length
3565 @opindex Wno-format-zero-length
3566 @opindex Wformat-zero-length
3567 If @option{-Wformat} is specified, do not warn about zero-length formats.
3568 The C standard specifies that zero-length formats are allowed.
3569
3570
3571 @item -Wformat=2
3572 @opindex Wformat=2
3573 Enable @option{-Wformat} plus additional format checks. Currently
3574 equivalent to @option{-Wformat -Wformat-nonliteral -Wformat-security
3575 -Wformat-signedness -Wformat-y2k}.
3576
3577 @item -Wformat-nonliteral
3578 @opindex Wformat-nonliteral
3579 @opindex Wno-format-nonliteral
3580 If @option{-Wformat} is specified, also warn if the format string is not a
3581 string literal and so cannot be checked, unless the format function
3582 takes its format arguments as a @code{va_list}.
3583
3584 @item -Wformat-security
3585 @opindex Wformat-security
3586 @opindex Wno-format-security
3587 If @option{-Wformat} is specified, also warn about uses of format
3588 functions that represent possible security problems. At present, this
3589 warns about calls to @code{printf} and @code{scanf} functions where the
3590 format string is not a string literal and there are no format arguments,
3591 as in @code{printf (foo);}. This may be a security hole if the format
3592 string came from untrusted input and contains @samp{%n}. (This is
3593 currently a subset of what @option{-Wformat-nonliteral} warns about, but
3594 in future warnings may be added to @option{-Wformat-security} that are not
3595 included in @option{-Wformat-nonliteral}.)
3596
3597 @item -Wformat-signedness
3598 @opindex Wformat-signedness
3599 @opindex Wno-format-signedness
3600 If @option{-Wformat} is specified, also warn if the format string
3601 requires an unsigned argument and the argument is signed and vice versa.
3602
3603 @item -Wformat-y2k
3604 @opindex Wformat-y2k
3605 @opindex Wno-format-y2k
3606 If @option{-Wformat} is specified, also warn about @code{strftime}
3607 formats that may yield only a two-digit year.
3608 @end table
3609
3610 @item -Wnonnull
3611 @opindex Wnonnull
3612 @opindex Wno-nonnull
3613 Warn about passing a null pointer for arguments marked as
3614 requiring a non-null value by the @code{nonnull} function attribute.
3615
3616 @option{-Wnonnull} is included in @option{-Wall} and @option{-Wformat}. It
3617 can be disabled with the @option{-Wno-nonnull} option.
3618
3619 @item -Winit-self @r{(C, C++, Objective-C and Objective-C++ only)}
3620 @opindex Winit-self
3621 @opindex Wno-init-self
3622 Warn about uninitialized variables that are initialized with themselves.
3623 Note this option can only be used with the @option{-Wuninitialized} option.
3624
3625 For example, GCC warns about @code{i} being uninitialized in the
3626 following snippet only when @option{-Winit-self} has been specified:
3627 @smallexample
3628 @group
3629 int f()
3630 @{
3631 int i = i;
3632 return i;
3633 @}
3634 @end group
3635 @end smallexample
3636
3637 This warning is enabled by @option{-Wall} in C++.
3638
3639 @item -Wimplicit-int @r{(C and Objective-C only)}
3640 @opindex Wimplicit-int
3641 @opindex Wno-implicit-int
3642 Warn when a declaration does not specify a type.
3643 This warning is enabled by @option{-Wall}.
3644
3645 @item -Wimplicit-function-declaration @r{(C and Objective-C only)}
3646 @opindex Wimplicit-function-declaration
3647 @opindex Wno-implicit-function-declaration
3648 Give a warning whenever a function is used before being declared. In
3649 C99 mode (@option{-std=c99} or @option{-std=gnu99}), this warning is
3650 enabled by default and it is made into an error by
3651 @option{-pedantic-errors}. This warning is also enabled by
3652 @option{-Wall}.
3653
3654 @item -Wimplicit @r{(C and Objective-C only)}
3655 @opindex Wimplicit
3656 @opindex Wno-implicit
3657 Same as @option{-Wimplicit-int} and @option{-Wimplicit-function-declaration}.
3658 This warning is enabled by @option{-Wall}.
3659
3660 @item -Wignored-qualifiers @r{(C and C++ only)}
3661 @opindex Wignored-qualifiers
3662 @opindex Wno-ignored-qualifiers
3663 Warn if the return type of a function has a type qualifier
3664 such as @code{const}. For ISO C such a type qualifier has no effect,
3665 since the value returned by a function is not an lvalue.
3666 For C++, the warning is only emitted for scalar types or @code{void}.
3667 ISO C prohibits qualified @code{void} return types on function
3668 definitions, so such return types always receive a warning
3669 even without this option.
3670
3671 This warning is also enabled by @option{-Wextra}.
3672
3673 @item -Wmain
3674 @opindex Wmain
3675 @opindex Wno-main
3676 Warn if the type of @samp{main} is suspicious. @samp{main} should be
3677 a function with external linkage, returning int, taking either zero
3678 arguments, two, or three arguments of appropriate types. This warning
3679 is enabled by default in C++ and is enabled by either @option{-Wall}
3680 or @option{-Wpedantic}.
3681
3682 @item -Wmissing-braces
3683 @opindex Wmissing-braces
3684 @opindex Wno-missing-braces
3685 Warn if an aggregate or union initializer is not fully bracketed. In
3686 the following example, the initializer for @samp{a} is not fully
3687 bracketed, but that for @samp{b} is fully bracketed. This warning is
3688 enabled by @option{-Wall} in C.
3689
3690 @smallexample
3691 int a[2][2] = @{ 0, 1, 2, 3 @};
3692 int b[2][2] = @{ @{ 0, 1 @}, @{ 2, 3 @} @};
3693 @end smallexample
3694
3695 This warning is enabled by @option{-Wall}.
3696
3697 @item -Wmissing-include-dirs @r{(C, C++, Objective-C and Objective-C++ only)}
3698 @opindex Wmissing-include-dirs
3699 @opindex Wno-missing-include-dirs
3700 Warn if a user-supplied include directory does not exist.
3701
3702 @item -Wparentheses
3703 @opindex Wparentheses
3704 @opindex Wno-parentheses
3705 Warn if parentheses are omitted in certain contexts, such
3706 as when there is an assignment in a context where a truth value
3707 is expected, or when operators are nested whose precedence people
3708 often get confused about.
3709
3710 Also warn if a comparison like @samp{x<=y<=z} appears; this is
3711 equivalent to @samp{(x<=y ? 1 : 0) <= z}, which is a different
3712 interpretation from that of ordinary mathematical notation.
3713
3714 Also warn about constructions where there may be confusion to which
3715 @code{if} statement an @code{else} branch belongs. Here is an example of
3716 such a case:
3717
3718 @smallexample
3719 @group
3720 @{
3721 if (a)
3722 if (b)
3723 foo ();
3724 else
3725 bar ();
3726 @}
3727 @end group
3728 @end smallexample
3729
3730 In C/C++, every @code{else} branch belongs to the innermost possible
3731 @code{if} statement, which in this example is @code{if (b)}. This is
3732 often not what the programmer expected, as illustrated in the above
3733 example by indentation the programmer chose. When there is the
3734 potential for this confusion, GCC issues a warning when this flag
3735 is specified. To eliminate the warning, add explicit braces around
3736 the innermost @code{if} statement so there is no way the @code{else}
3737 can belong to the enclosing @code{if}. The resulting code
3738 looks like this:
3739
3740 @smallexample
3741 @group
3742 @{
3743 if (a)
3744 @{
3745 if (b)
3746 foo ();
3747 else
3748 bar ();
3749 @}
3750 @}
3751 @end group
3752 @end smallexample
3753
3754 Also warn for dangerous uses of the GNU extension to
3755 @code{?:} with omitted middle operand. When the condition
3756 in the @code{?}: operator is a boolean expression, the omitted value is
3757 always 1. Often programmers expect it to be a value computed
3758 inside the conditional expression instead.
3759
3760 This warning is enabled by @option{-Wall}.
3761
3762 @item -Wsequence-point
3763 @opindex Wsequence-point
3764 @opindex Wno-sequence-point
3765 Warn about code that may have undefined semantics because of violations
3766 of sequence point rules in the C and C++ standards.
3767
3768 The C and C++ standards define the order in which expressions in a C/C++
3769 program are evaluated in terms of @dfn{sequence points}, which represent
3770 a partial ordering between the execution of parts of the program: those
3771 executed before the sequence point, and those executed after it. These
3772 occur after the evaluation of a full expression (one which is not part
3773 of a larger expression), after the evaluation of the first operand of a
3774 @code{&&}, @code{||}, @code{? :} or @code{,} (comma) operator, before a
3775 function is called (but after the evaluation of its arguments and the
3776 expression denoting the called function), and in certain other places.
3777 Other than as expressed by the sequence point rules, the order of
3778 evaluation of subexpressions of an expression is not specified. All
3779 these rules describe only a partial order rather than a total order,
3780 since, for example, if two functions are called within one expression
3781 with no sequence point between them, the order in which the functions
3782 are called is not specified. However, the standards committee have
3783 ruled that function calls do not overlap.
3784
3785 It is not specified when between sequence points modifications to the
3786 values of objects take effect. Programs whose behavior depends on this
3787 have undefined behavior; the C and C++ standards specify that ``Between
3788 the previous and next sequence point an object shall have its stored
3789 value modified at most once by the evaluation of an expression.
3790 Furthermore, the prior value shall be read only to determine the value
3791 to be stored.''. If a program breaks these rules, the results on any
3792 particular implementation are entirely unpredictable.
3793
3794 Examples of code with undefined behavior are @code{a = a++;}, @code{a[n]
3795 = b[n++]} and @code{a[i++] = i;}. Some more complicated cases are not
3796 diagnosed by this option, and it may give an occasional false positive
3797 result, but in general it has been found fairly effective at detecting
3798 this sort of problem in programs.
3799
3800 The standard is worded confusingly, therefore there is some debate
3801 over the precise meaning of the sequence point rules in subtle cases.
3802 Links to discussions of the problem, including proposed formal
3803 definitions, may be found on the GCC readings page, at
3804 @uref{http://gcc.gnu.org/@/readings.html}.
3805
3806 This warning is enabled by @option{-Wall} for C and C++.
3807
3808 @item -Wno-return-local-addr
3809 @opindex Wno-return-local-addr
3810 @opindex Wreturn-local-addr
3811 Do not warn about returning a pointer (or in C++, a reference) to a
3812 variable that goes out of scope after the function returns.
3813
3814 @item -Wreturn-type
3815 @opindex Wreturn-type
3816 @opindex Wno-return-type
3817 Warn whenever a function is defined with a return type that defaults
3818 to @code{int}. Also warn about any @code{return} statement with no
3819 return value in a function whose return type is not @code{void}
3820 (falling off the end of the function body is considered returning
3821 without a value), and about a @code{return} statement with an
3822 expression in a function whose return type is @code{void}.
3823
3824 For C++, a function without return type always produces a diagnostic
3825 message, even when @option{-Wno-return-type} is specified. The only
3826 exceptions are @samp{main} and functions defined in system headers.
3827
3828 This warning is enabled by @option{-Wall}.
3829
3830 @item -Wswitch
3831 @opindex Wswitch
3832 @opindex Wno-switch
3833 Warn whenever a @code{switch} statement has an index of enumerated type
3834 and lacks a @code{case} for one or more of the named codes of that
3835 enumeration. (The presence of a @code{default} label prevents this
3836 warning.) @code{case} labels outside the enumeration range also
3837 provoke warnings when this option is used (even if there is a
3838 @code{default} label).
3839 This warning is enabled by @option{-Wall}.
3840
3841 @item -Wswitch-default
3842 @opindex Wswitch-default
3843 @opindex Wno-switch-default
3844 Warn whenever a @code{switch} statement does not have a @code{default}
3845 case.
3846
3847 @item -Wswitch-enum
3848 @opindex Wswitch-enum
3849 @opindex Wno-switch-enum
3850 Warn whenever a @code{switch} statement has an index of enumerated type
3851 and lacks a @code{case} for one or more of the named codes of that
3852 enumeration. @code{case} labels outside the enumeration range also
3853 provoke warnings when this option is used. The only difference
3854 between @option{-Wswitch} and this option is that this option gives a
3855 warning about an omitted enumeration code even if there is a
3856 @code{default} label.
3857
3858 @item -Wswitch-bool
3859 @opindex Wswitch-bool
3860 @opindex Wno-switch-bool
3861 Warn whenever a @code{switch} statement has an index of boolean type.
3862 It is possible to suppress this warning by casting the controlling
3863 expression to a type other than @code{bool}. For example:
3864 @smallexample
3865 @group
3866 switch ((int) (a == 4))
3867 @{
3868 @dots{}
3869 @}
3870 @end group
3871 @end smallexample
3872 This warning is enabled by default for C and C++ programs.
3873
3874 @item -Wsync-nand @r{(C and C++ only)}
3875 @opindex Wsync-nand
3876 @opindex Wno-sync-nand
3877 Warn when @code{__sync_fetch_and_nand} and @code{__sync_nand_and_fetch}
3878 built-in functions are used. These functions changed semantics in GCC 4.4.
3879
3880 @item -Wtrigraphs
3881 @opindex Wtrigraphs
3882 @opindex Wno-trigraphs
3883 Warn if any trigraphs are encountered that might change the meaning of
3884 the program (trigraphs within comments are not warned about).
3885 This warning is enabled by @option{-Wall}.
3886
3887 @item -Wunused-but-set-parameter
3888 @opindex Wunused-but-set-parameter
3889 @opindex Wno-unused-but-set-parameter
3890 Warn whenever a function parameter is assigned to, but otherwise unused
3891 (aside from its declaration).
3892
3893 To suppress this warning use the @samp{unused} attribute
3894 (@pxref{Variable Attributes}).
3895
3896 This warning is also enabled by @option{-Wunused} together with
3897 @option{-Wextra}.
3898
3899 @item -Wunused-but-set-variable
3900 @opindex Wunused-but-set-variable
3901 @opindex Wno-unused-but-set-variable
3902 Warn whenever a local variable is assigned to, but otherwise unused
3903 (aside from its declaration).
3904 This warning is enabled by @option{-Wall}.
3905
3906 To suppress this warning use the @samp{unused} attribute
3907 (@pxref{Variable Attributes}).
3908
3909 This warning is also enabled by @option{-Wunused}, which is enabled
3910 by @option{-Wall}.
3911
3912 @item -Wunused-function
3913 @opindex Wunused-function
3914 @opindex Wno-unused-function
3915 Warn whenever a static function is declared but not defined or a
3916 non-inline static function is unused.
3917 This warning is enabled by @option{-Wall}.
3918
3919 @item -Wunused-label
3920 @opindex Wunused-label
3921 @opindex Wno-unused-label
3922 Warn whenever a label is declared but not used.
3923 This warning is enabled by @option{-Wall}.
3924
3925 To suppress this warning use the @samp{unused} attribute
3926 (@pxref{Variable Attributes}).
3927
3928 @item -Wunused-local-typedefs @r{(C, Objective-C, C++ and Objective-C++ only)}
3929 @opindex Wunused-local-typedefs
3930 Warn when a typedef locally defined in a function is not used.
3931 This warning is enabled by @option{-Wall}.
3932
3933 @item -Wunused-parameter
3934 @opindex Wunused-parameter
3935 @opindex Wno-unused-parameter
3936 Warn whenever a function parameter is unused aside from its declaration.
3937
3938 To suppress this warning use the @samp{unused} attribute
3939 (@pxref{Variable Attributes}).
3940
3941 @item -Wno-unused-result
3942 @opindex Wunused-result
3943 @opindex Wno-unused-result
3944 Do not warn if a caller of a function marked with attribute
3945 @code{warn_unused_result} (@pxref{Function Attributes}) does not use
3946 its return value. The default is @option{-Wunused-result}.
3947
3948 @item -Wunused-variable
3949 @opindex Wunused-variable
3950 @opindex Wno-unused-variable
3951 Warn whenever a local variable or non-constant static variable is unused
3952 aside from its declaration.
3953 This warning is enabled by @option{-Wall}.
3954
3955 To suppress this warning use the @samp{unused} attribute
3956 (@pxref{Variable Attributes}).
3957
3958 @item -Wunused-value
3959 @opindex Wunused-value
3960 @opindex Wno-unused-value
3961 Warn whenever a statement computes a result that is explicitly not
3962 used. To suppress this warning cast the unused expression to
3963 @samp{void}. This includes an expression-statement or the left-hand
3964 side of a comma expression that contains no side effects. For example,
3965 an expression such as @samp{x[i,j]} causes a warning, while
3966 @samp{x[(void)i,j]} does not.
3967
3968 This warning is enabled by @option{-Wall}.
3969
3970 @item -Wunused
3971 @opindex Wunused
3972 @opindex Wno-unused
3973 All the above @option{-Wunused} options combined.
3974
3975 In order to get a warning about an unused function parameter, you must
3976 either specify @option{-Wextra -Wunused} (note that @option{-Wall} implies
3977 @option{-Wunused}), or separately specify @option{-Wunused-parameter}.
3978
3979 @item -Wuninitialized
3980 @opindex Wuninitialized
3981 @opindex Wno-uninitialized
3982 Warn if an automatic variable is used without first being initialized
3983 or if a variable may be clobbered by a @code{setjmp} call. In C++,
3984 warn if a non-static reference or non-static @samp{const} member
3985 appears in a class without constructors.
3986
3987 If you want to warn about code that uses the uninitialized value of the
3988 variable in its own initializer, use the @option{-Winit-self} option.
3989
3990 These warnings occur for individual uninitialized or clobbered
3991 elements of structure, union or array variables as well as for
3992 variables that are uninitialized or clobbered as a whole. They do
3993 not occur for variables or elements declared @code{volatile}. Because
3994 these warnings depend on optimization, the exact variables or elements
3995 for which there are warnings depends on the precise optimization
3996 options and version of GCC used.
3997
3998 Note that there may be no warning about a variable that is used only
3999 to compute a value that itself is never used, because such
4000 computations may be deleted by data flow analysis before the warnings
4001 are printed.
4002
4003 @item -Wmaybe-uninitialized
4004 @opindex Wmaybe-uninitialized
4005 @opindex Wno-maybe-uninitialized
4006 For an automatic variable, if there exists a path from the function
4007 entry to a use of the variable that is initialized, but there exist
4008 some other paths for which the variable is not initialized, the compiler
4009 emits a warning if it cannot prove the uninitialized paths are not
4010 executed at run time. These warnings are made optional because GCC is
4011 not smart enough to see all the reasons why the code might be correct
4012 in spite of appearing to have an error. Here is one example of how
4013 this can happen:
4014
4015 @smallexample
4016 @group
4017 @{
4018 int x;
4019 switch (y)
4020 @{
4021 case 1: x = 1;
4022 break;
4023 case 2: x = 4;
4024 break;
4025 case 3: x = 5;
4026 @}
4027 foo (x);
4028 @}
4029 @end group
4030 @end smallexample
4031
4032 @noindent
4033 If the value of @code{y} is always 1, 2 or 3, then @code{x} is
4034 always initialized, but GCC doesn't know this. To suppress the
4035 warning, you need to provide a default case with assert(0) or
4036 similar code.
4037
4038 @cindex @code{longjmp} warnings
4039 This option also warns when a non-volatile automatic variable might be
4040 changed by a call to @code{longjmp}. These warnings as well are possible
4041 only in optimizing compilation.
4042
4043 The compiler sees only the calls to @code{setjmp}. It cannot know
4044 where @code{longjmp} will be called; in fact, a signal handler could
4045 call it at any point in the code. As a result, you may get a warning
4046 even when there is in fact no problem because @code{longjmp} cannot
4047 in fact be called at the place that would cause a problem.
4048
4049 Some spurious warnings can be avoided if you declare all the functions
4050 you use that never return as @code{noreturn}. @xref{Function
4051 Attributes}.
4052
4053 This warning is enabled by @option{-Wall} or @option{-Wextra}.
4054
4055 @item -Wunknown-pragmas
4056 @opindex Wunknown-pragmas
4057 @opindex Wno-unknown-pragmas
4058 @cindex warning for unknown pragmas
4059 @cindex unknown pragmas, warning
4060 @cindex pragmas, warning of unknown
4061 Warn when a @code{#pragma} directive is encountered that is not understood by
4062 GCC@. If this command-line option is used, warnings are even issued
4063 for unknown pragmas in system header files. This is not the case if
4064 the warnings are only enabled by the @option{-Wall} command-line option.
4065
4066 @item -Wno-pragmas
4067 @opindex Wno-pragmas
4068 @opindex Wpragmas
4069 Do not warn about misuses of pragmas, such as incorrect parameters,
4070 invalid syntax, or conflicts between pragmas. See also
4071 @option{-Wunknown-pragmas}.
4072
4073 @item -Wstrict-aliasing
4074 @opindex Wstrict-aliasing
4075 @opindex Wno-strict-aliasing
4076 This option is only active when @option{-fstrict-aliasing} is active.
4077 It warns about code that might break the strict aliasing rules that the
4078 compiler is using for optimization. The warning does not catch all
4079 cases, but does attempt to catch the more common pitfalls. It is
4080 included in @option{-Wall}.
4081 It is equivalent to @option{-Wstrict-aliasing=3}
4082
4083 @item -Wstrict-aliasing=n
4084 @opindex Wstrict-aliasing=n
4085 This option is only active when @option{-fstrict-aliasing} is active.
4086 It warns about code that might break the strict aliasing rules that the
4087 compiler is using for optimization.
4088 Higher levels correspond to higher accuracy (fewer false positives).
4089 Higher levels also correspond to more effort, similar to the way @option{-O}
4090 works.
4091 @option{-Wstrict-aliasing} is equivalent to @option{-Wstrict-aliasing=3}.
4092
4093 Level 1: Most aggressive, quick, least accurate.
4094 Possibly useful when higher levels
4095 do not warn but @option{-fstrict-aliasing} still breaks the code, as it has very few
4096 false negatives. However, it has many false positives.
4097 Warns for all pointer conversions between possibly incompatible types,
4098 even if never dereferenced. Runs in the front end only.
4099
4100 Level 2: Aggressive, quick, not too precise.
4101 May still have many false positives (not as many as level 1 though),
4102 and few false negatives (but possibly more than level 1).
4103 Unlike level 1, it only warns when an address is taken. Warns about
4104 incomplete types. Runs in the front end only.
4105
4106 Level 3 (default for @option{-Wstrict-aliasing}):
4107 Should have very few false positives and few false
4108 negatives. Slightly slower than levels 1 or 2 when optimization is enabled.
4109 Takes care of the common pun+dereference pattern in the front end:
4110 @code{*(int*)&some_float}.
4111 If optimization is enabled, it also runs in the back end, where it deals
4112 with multiple statement cases using flow-sensitive points-to information.
4113 Only warns when the converted pointer is dereferenced.
4114 Does not warn about incomplete types.
4115
4116 @item -Wstrict-overflow
4117 @itemx -Wstrict-overflow=@var{n}
4118 @opindex Wstrict-overflow
4119 @opindex Wno-strict-overflow
4120 This option is only active when @option{-fstrict-overflow} is active.
4121 It warns about cases where the compiler optimizes based on the
4122 assumption that signed overflow does not occur. Note that it does not
4123 warn about all cases where the code might overflow: it only warns
4124 about cases where the compiler implements some optimization. Thus
4125 this warning depends on the optimization level.
4126
4127 An optimization that assumes that signed overflow does not occur is
4128 perfectly safe if the values of the variables involved are such that
4129 overflow never does, in fact, occur. Therefore this warning can
4130 easily give a false positive: a warning about code that is not
4131 actually a problem. To help focus on important issues, several
4132 warning levels are defined. No warnings are issued for the use of
4133 undefined signed overflow when estimating how many iterations a loop
4134 requires, in particular when determining whether a loop will be
4135 executed at all.
4136
4137 @table @gcctabopt
4138 @item -Wstrict-overflow=1
4139 Warn about cases that are both questionable and easy to avoid. For
4140 example, with @option{-fstrict-overflow}, the compiler simplifies
4141 @code{x + 1 > x} to @code{1}. This level of
4142 @option{-Wstrict-overflow} is enabled by @option{-Wall}; higher levels
4143 are not, and must be explicitly requested.
4144
4145 @item -Wstrict-overflow=2
4146 Also warn about other cases where a comparison is simplified to a
4147 constant. For example: @code{abs (x) >= 0}. This can only be
4148 simplified when @option{-fstrict-overflow} is in effect, because
4149 @code{abs (INT_MIN)} overflows to @code{INT_MIN}, which is less than
4150 zero. @option{-Wstrict-overflow} (with no level) is the same as
4151 @option{-Wstrict-overflow=2}.
4152
4153 @item -Wstrict-overflow=3
4154 Also warn about other cases where a comparison is simplified. For
4155 example: @code{x + 1 > 1} is simplified to @code{x > 0}.
4156
4157 @item -Wstrict-overflow=4
4158 Also warn about other simplifications not covered by the above cases.
4159 For example: @code{(x * 10) / 5} is simplified to @code{x * 2}.
4160
4161 @item -Wstrict-overflow=5
4162 Also warn about cases where the compiler reduces the magnitude of a
4163 constant involved in a comparison. For example: @code{x + 2 > y} is
4164 simplified to @code{x + 1 >= y}. This is reported only at the
4165 highest warning level because this simplification applies to many
4166 comparisons, so this warning level gives a very large number of
4167 false positives.
4168 @end table
4169
4170 @item -Wsuggest-attribute=@r{[}pure@r{|}const@r{|}noreturn@r{|}format@r{]}
4171 @opindex Wsuggest-attribute=
4172 @opindex Wno-suggest-attribute=
4173 Warn for cases where adding an attribute may be beneficial. The
4174 attributes currently supported are listed below.
4175
4176 @table @gcctabopt
4177 @item -Wsuggest-attribute=pure
4178 @itemx -Wsuggest-attribute=const
4179 @itemx -Wsuggest-attribute=noreturn
4180 @opindex Wsuggest-attribute=pure
4181 @opindex Wno-suggest-attribute=pure
4182 @opindex Wsuggest-attribute=const
4183 @opindex Wno-suggest-attribute=const
4184 @opindex Wsuggest-attribute=noreturn
4185 @opindex Wno-suggest-attribute=noreturn
4186
4187 Warn about functions that might be candidates for attributes
4188 @code{pure}, @code{const} or @code{noreturn}. The compiler only warns for
4189 functions visible in other compilation units or (in the case of @code{pure} and
4190 @code{const}) if it cannot prove that the function returns normally. A function
4191 returns normally if it doesn't contain an infinite loop or return abnormally
4192 by throwing, calling @code{abort()} or trapping. This analysis requires option
4193 @option{-fipa-pure-const}, which is enabled by default at @option{-O} and
4194 higher. Higher optimization levels improve the accuracy of the analysis.
4195
4196 @item -Wsuggest-attribute=format
4197 @itemx -Wmissing-format-attribute
4198 @opindex Wsuggest-attribute=format
4199 @opindex Wmissing-format-attribute
4200 @opindex Wno-suggest-attribute=format
4201 @opindex Wno-missing-format-attribute
4202 @opindex Wformat
4203 @opindex Wno-format
4204
4205 Warn about function pointers that might be candidates for @code{format}
4206 attributes. Note these are only possible candidates, not absolute ones.
4207 GCC guesses that function pointers with @code{format} attributes that
4208 are used in assignment, initialization, parameter passing or return
4209 statements should have a corresponding @code{format} attribute in the
4210 resulting type. I.e.@: the left-hand side of the assignment or
4211 initialization, the type of the parameter variable, or the return type
4212 of the containing function respectively should also have a @code{format}
4213 attribute to avoid the warning.
4214
4215 GCC also warns about function definitions that might be
4216 candidates for @code{format} attributes. Again, these are only
4217 possible candidates. GCC guesses that @code{format} attributes
4218 might be appropriate for any function that calls a function like
4219 @code{vprintf} or @code{vscanf}, but this might not always be the
4220 case, and some functions for which @code{format} attributes are
4221 appropriate may not be detected.
4222 @end table
4223
4224 @item -Wsuggest-final-types
4225 @opindex Wno-suggest-final-types
4226 @opindex Wsuggest-final-types
4227 Warn about types with virtual methods where code quality would be improved
4228 if the type was declared with C++11 final specifier, or, if possible,
4229 declared in anonymous namespace. This allows GCC to devritualize more aggressively
4230 the polymorphic calls. This warning is more effective with link time optimization,
4231 where the information about the class hiearchy graph is more complete.
4232
4233 @item -Wsuggest-final-methods
4234 @opindex Wno-suggest-final-methods
4235 @opindex Wsuggest-final-methods
4236 Warn about virtual methods where code quality would be improved if the method
4237 was declared with C++11 final specifier, or, if possible, its type was declared
4238 in the anonymous namespace or with final specifier. This warning is more
4239 effective with link time optimization, where the information about the class
4240 hiearchy graph is more complete. It is recommended to first consider suggestins
4241 of @option{-Wsuggest-final-types} and then rebuild with new annotations.
4242
4243 @item -Warray-bounds
4244 @opindex Wno-array-bounds
4245 @opindex Warray-bounds
4246 This option is only active when @option{-ftree-vrp} is active
4247 (default for @option{-O2} and above). It warns about subscripts to arrays
4248 that are always out of bounds. This warning is enabled by @option{-Wall}.
4249
4250 @item -Wbool-compare
4251 @opindex Wno-bool-compare
4252 @opindex Wbool-compare
4253 Warn about boolean expression compared with an integer value different from
4254 @code{true}/@code{false}. For instance, the following comparison is
4255 always false:
4256 @smallexample
4257 int n = 5;
4258 @dots{}
4259 if ((n > 1) == 2) @{ @dots{} @}
4260 @end smallexample
4261 This warning is enabled by @option{-Wall}.
4262
4263 @item -Wno-discarded-qualifiers @r{(C and Objective-C only)}
4264 @opindex Wno-discarded-qualifiers
4265 @opindex Wdiscarded-qualifiers
4266 Do not warn if type qualifiers on pointers are being discarded.
4267 Typically, the compiler will warn if a @code{const char *} variable is
4268 passed to a function that takes @code{char *} parameter. This option
4269 can be used to suppress such a warning.
4270
4271 @item -Wno-incompatible-pointer-types @r{(C and Objective-C only)}
4272 @opindex Wno-incompatible-pointer-types
4273 @opindex Wincompatible-pointer-types
4274 Do not warn when there is a conversion between pointers that have incompatible
4275 types. This warning is for cases not covered by @option{-Wno-pointer-sign},
4276 which warns for pointer argument passing or assignment with different signedness
4277
4278 @item -Wno-int-conversion @r{(C and Objective-C only)}
4279 @opindex Wno-int-conversion
4280 @opindex Wint-conversion
4281 Do not warn about incompatible integer to pointer and pointer to integer
4282 conversions. This warning is about implicit conversions; for explicit
4283 conversions the warnings @option{-Wno-int-to-pointer-cast} and
4284 @option{-Wno-pointer-to-int-cast} may be used.
4285
4286 @item -Wno-div-by-zero
4287 @opindex Wno-div-by-zero
4288 @opindex Wdiv-by-zero
4289 Do not warn about compile-time integer division by zero. Floating-point
4290 division by zero is not warned about, as it can be a legitimate way of
4291 obtaining infinities and NaNs.
4292
4293 @item -Wsystem-headers
4294 @opindex Wsystem-headers
4295 @opindex Wno-system-headers
4296 @cindex warnings from system headers
4297 @cindex system headers, warnings from
4298 Print warning messages for constructs found in system header files.
4299 Warnings from system headers are normally suppressed, on the assumption
4300 that they usually do not indicate real problems and would only make the
4301 compiler output harder to read. Using this command-line option tells
4302 GCC to emit warnings from system headers as if they occurred in user
4303 code. However, note that using @option{-Wall} in conjunction with this
4304 option does @emph{not} warn about unknown pragmas in system
4305 headers---for that, @option{-Wunknown-pragmas} must also be used.
4306
4307 @item -Wtrampolines
4308 @opindex Wtrampolines
4309 @opindex Wno-trampolines
4310 Warn about trampolines generated for pointers to nested functions.
4311 A trampoline is a small piece of data or code that is created at run
4312 time on the stack when the address of a nested function is taken, and is
4313 used to call the nested function indirectly. For some targets, it is
4314 made up of data only and thus requires no special treatment. But, for
4315 most targets, it is made up of code and thus requires the stack to be
4316 made executable in order for the program to work properly.
4317
4318 @item -Wfloat-equal
4319 @opindex Wfloat-equal
4320 @opindex Wno-float-equal
4321 Warn if floating-point values are used in equality comparisons.
4322
4323 The idea behind this is that sometimes it is convenient (for the
4324 programmer) to consider floating-point values as approximations to
4325 infinitely precise real numbers. If you are doing this, then you need
4326 to compute (by analyzing the code, or in some other way) the maximum or
4327 likely maximum error that the computation introduces, and allow for it
4328 when performing comparisons (and when producing output, but that's a
4329 different problem). In particular, instead of testing for equality, you
4330 should check to see whether the two values have ranges that overlap; and
4331 this is done with the relational operators, so equality comparisons are
4332 probably mistaken.
4333
4334 @item -Wtraditional @r{(C and Objective-C only)}
4335 @opindex Wtraditional
4336 @opindex Wno-traditional
4337 Warn about certain constructs that behave differently in traditional and
4338 ISO C@. Also warn about ISO C constructs that have no traditional C
4339 equivalent, and/or problematic constructs that should be avoided.
4340
4341 @itemize @bullet
4342 @item
4343 Macro parameters that appear within string literals in the macro body.
4344 In traditional C macro replacement takes place within string literals,
4345 but in ISO C it does not.
4346
4347 @item
4348 In traditional C, some preprocessor directives did not exist.
4349 Traditional preprocessors only considered a line to be a directive
4350 if the @samp{#} appeared in column 1 on the line. Therefore
4351 @option{-Wtraditional} warns about directives that traditional C
4352 understands but ignores because the @samp{#} does not appear as the
4353 first character on the line. It also suggests you hide directives like
4354 @samp{#pragma} not understood by traditional C by indenting them. Some
4355 traditional implementations do not recognize @samp{#elif}, so this option
4356 suggests avoiding it altogether.
4357
4358 @item
4359 A function-like macro that appears without arguments.
4360
4361 @item
4362 The unary plus operator.
4363
4364 @item
4365 The @samp{U} integer constant suffix, or the @samp{F} or @samp{L} floating-point
4366 constant suffixes. (Traditional C does support the @samp{L} suffix on integer
4367 constants.) Note, these suffixes appear in macros defined in the system
4368 headers of most modern systems, e.g.@: the @samp{_MIN}/@samp{_MAX} macros in @code{<limits.h>}.
4369 Use of these macros in user code might normally lead to spurious
4370 warnings, however GCC's integrated preprocessor has enough context to
4371 avoid warning in these cases.
4372
4373 @item
4374 A function declared external in one block and then used after the end of
4375 the block.
4376
4377 @item
4378 A @code{switch} statement has an operand of type @code{long}.
4379
4380 @item
4381 A non-@code{static} function declaration follows a @code{static} one.
4382 This construct is not accepted by some traditional C compilers.
4383
4384 @item
4385 The ISO type of an integer constant has a different width or
4386 signedness from its traditional type. This warning is only issued if
4387 the base of the constant is ten. I.e.@: hexadecimal or octal values, which
4388 typically represent bit patterns, are not warned about.
4389
4390 @item
4391 Usage of ISO string concatenation is detected.
4392
4393 @item
4394 Initialization of automatic aggregates.
4395
4396 @item
4397 Identifier conflicts with labels. Traditional C lacks a separate
4398 namespace for labels.
4399
4400 @item
4401 Initialization of unions. If the initializer is zero, the warning is
4402 omitted. This is done under the assumption that the zero initializer in
4403 user code appears conditioned on e.g.@: @code{__STDC__} to avoid missing
4404 initializer warnings and relies on default initialization to zero in the
4405 traditional C case.
4406
4407 @item
4408 Conversions by prototypes between fixed/floating-point values and vice
4409 versa. The absence of these prototypes when compiling with traditional
4410 C causes serious problems. This is a subset of the possible
4411 conversion warnings; for the full set use @option{-Wtraditional-conversion}.
4412
4413 @item
4414 Use of ISO C style function definitions. This warning intentionally is
4415 @emph{not} issued for prototype declarations or variadic functions
4416 because these ISO C features appear in your code when using
4417 libiberty's traditional C compatibility macros, @code{PARAMS} and
4418 @code{VPARAMS}. This warning is also bypassed for nested functions
4419 because that feature is already a GCC extension and thus not relevant to
4420 traditional C compatibility.
4421 @end itemize
4422
4423 @item -Wtraditional-conversion @r{(C and Objective-C only)}
4424 @opindex Wtraditional-conversion
4425 @opindex Wno-traditional-conversion
4426 Warn if a prototype causes a type conversion that is different from what
4427 would happen to the same argument in the absence of a prototype. This
4428 includes conversions of fixed point to floating and vice versa, and
4429 conversions changing the width or signedness of a fixed-point argument
4430 except when the same as the default promotion.
4431
4432 @item -Wdeclaration-after-statement @r{(C and Objective-C only)}
4433 @opindex Wdeclaration-after-statement
4434 @opindex Wno-declaration-after-statement
4435 Warn when a declaration is found after a statement in a block. This
4436 construct, known from C++, was introduced with ISO C99 and is by default
4437 allowed in GCC@. It is not supported by ISO C90 and was not supported by
4438 GCC versions before GCC 3.0. @xref{Mixed Declarations}.
4439
4440 @item -Wundef
4441 @opindex Wundef
4442 @opindex Wno-undef
4443 Warn if an undefined identifier is evaluated in an @samp{#if} directive.
4444
4445 @item -Wno-endif-labels
4446 @opindex Wno-endif-labels
4447 @opindex Wendif-labels
4448 Do not warn whenever an @samp{#else} or an @samp{#endif} are followed by text.
4449
4450 @item -Wshadow
4451 @opindex Wshadow
4452 @opindex Wno-shadow
4453 Warn whenever a local variable or type declaration shadows another
4454 variable, parameter, type, class member (in C++), or instance variable
4455 (in Objective-C) or whenever a built-in function is shadowed. Note
4456 that in C++, the compiler warns if a local variable shadows an
4457 explicit typedef, but not if it shadows a struct/class/enum.
4458
4459 @item -Wno-shadow-ivar @r{(Objective-C only)}
4460 @opindex Wno-shadow-ivar
4461 @opindex Wshadow-ivar
4462 Do not warn whenever a local variable shadows an instance variable in an
4463 Objective-C method.
4464
4465 @item -Wlarger-than=@var{len}
4466 @opindex Wlarger-than=@var{len}
4467 @opindex Wlarger-than-@var{len}
4468 Warn whenever an object of larger than @var{len} bytes is defined.
4469
4470 @item -Wframe-larger-than=@var{len}
4471 @opindex Wframe-larger-than
4472 Warn if the size of a function frame is larger than @var{len} bytes.
4473 The computation done to determine the stack frame size is approximate
4474 and not conservative.
4475 The actual requirements may be somewhat greater than @var{len}
4476 even if you do not get a warning. In addition, any space allocated
4477 via @code{alloca}, variable-length arrays, or related constructs
4478 is not included by the compiler when determining
4479 whether or not to issue a warning.
4480
4481 @item -Wno-free-nonheap-object
4482 @opindex Wno-free-nonheap-object
4483 @opindex Wfree-nonheap-object
4484 Do not warn when attempting to free an object that was not allocated
4485 on the heap.
4486
4487 @item -Wstack-usage=@var{len}
4488 @opindex Wstack-usage
4489 Warn if the stack usage of a function might be larger than @var{len} bytes.
4490 The computation done to determine the stack usage is conservative.
4491 Any space allocated via @code{alloca}, variable-length arrays, or related
4492 constructs is included by the compiler when determining whether or not to
4493 issue a warning.
4494
4495 The message is in keeping with the output of @option{-fstack-usage}.
4496
4497 @itemize
4498 @item
4499 If the stack usage is fully static but exceeds the specified amount, it's:
4500
4501 @smallexample
4502 warning: stack usage is 1120 bytes
4503 @end smallexample
4504 @item
4505 If the stack usage is (partly) dynamic but bounded, it's:
4506
4507 @smallexample
4508 warning: stack usage might be 1648 bytes
4509 @end smallexample
4510 @item
4511 If the stack usage is (partly) dynamic and not bounded, it's:
4512
4513 @smallexample
4514 warning: stack usage might be unbounded
4515 @end smallexample
4516 @end itemize
4517
4518 @item -Wunsafe-loop-optimizations
4519 @opindex Wunsafe-loop-optimizations
4520 @opindex Wno-unsafe-loop-optimizations
4521 Warn if the loop cannot be optimized because the compiler cannot
4522 assume anything on the bounds of the loop indices. With
4523 @option{-funsafe-loop-optimizations} warn if the compiler makes
4524 such assumptions.
4525
4526 @item -Wno-pedantic-ms-format @r{(MinGW targets only)}
4527 @opindex Wno-pedantic-ms-format
4528 @opindex Wpedantic-ms-format
4529 When used in combination with @option{-Wformat}
4530 and @option{-pedantic} without GNU extensions, this option
4531 disables the warnings about non-ISO @code{printf} / @code{scanf} format
4532 width specifiers @code{I32}, @code{I64}, and @code{I} used on Windows targets,
4533 which depend on the MS runtime.
4534
4535 @item -Wpointer-arith
4536 @opindex Wpointer-arith
4537 @opindex Wno-pointer-arith
4538 Warn about anything that depends on the ``size of'' a function type or
4539 of @code{void}. GNU C assigns these types a size of 1, for
4540 convenience in calculations with @code{void *} pointers and pointers
4541 to functions. In C++, warn also when an arithmetic operation involves
4542 @code{NULL}. This warning is also enabled by @option{-Wpedantic}.
4543
4544 @item -Wtype-limits
4545 @opindex Wtype-limits
4546 @opindex Wno-type-limits
4547 Warn if a comparison is always true or always false due to the limited
4548 range of the data type, but do not warn for constant expressions. For
4549 example, warn if an unsigned variable is compared against zero with
4550 @samp{<} or @samp{>=}. This warning is also enabled by
4551 @option{-Wextra}.
4552
4553 @item -Wbad-function-cast @r{(C and Objective-C only)}
4554 @opindex Wbad-function-cast
4555 @opindex Wno-bad-function-cast
4556 Warn whenever a function call is cast to a non-matching type.
4557 For example, warn if @code{int malloc()} is cast to @code{anything *}.
4558
4559 @item -Wc90-c99-compat @r{(C and Objective-C only)}
4560 @opindex Wc90-c99-compat
4561 @opindex Wno-c90-c99-compat
4562 Warn about features not present in ISO C90, but present in ISO C99.
4563 For instance, warn about use of variable length arrays, @code{long long}
4564 type, @code{bool} type, compound literals, designated initializers, and so
4565 on. This option is independent of the standards mode. Warnings are disabled
4566 in the expression that follows @code{__extension__}.
4567
4568 @item -Wc99-c11-compat @r{(C and Objective-C only)}
4569 @opindex Wc99-c11-compat
4570 @opindex Wno-c99-c11-compat
4571 Warn about features not present in ISO C99, but present in ISO C11.
4572 For instance, warn about use of anonymous structures and unions,
4573 @code{_Atomic} type qualifier, @code{_Thread_local} storage-class specifier,
4574 @code{_Alignas} specifier, @code{Alignof} operator, @code{_Generic} keyword,
4575 and so on. This option is independent of the standards mode. Warnings are
4576 disabled in the expression that follows @code{__extension__}.
4577
4578 @item -Wc++-compat @r{(C and Objective-C only)}
4579 Warn about ISO C constructs that are outside of the common subset of
4580 ISO C and ISO C++, e.g.@: request for implicit conversion from
4581 @code{void *} to a pointer to non-@code{void} type.
4582
4583 @item -Wc++11-compat @r{(C++ and Objective-C++ only)}
4584 Warn about C++ constructs whose meaning differs between ISO C++ 1998
4585 and ISO C++ 2011, e.g., identifiers in ISO C++ 1998 that are keywords
4586 in ISO C++ 2011. This warning turns on @option{-Wnarrowing} and is
4587 enabled by @option{-Wall}.
4588
4589 @item -Wcast-qual
4590 @opindex Wcast-qual
4591 @opindex Wno-cast-qual
4592 Warn whenever a pointer is cast so as to remove a type qualifier from
4593 the target type. For example, warn if a @code{const char *} is cast
4594 to an ordinary @code{char *}.
4595
4596 Also warn when making a cast that introduces a type qualifier in an
4597 unsafe way. For example, casting @code{char **} to @code{const char **}
4598 is unsafe, as in this example:
4599
4600 @smallexample
4601 /* p is char ** value. */
4602 const char **q = (const char **) p;
4603 /* Assignment of readonly string to const char * is OK. */
4604 *q = "string";
4605 /* Now char** pointer points to read-only memory. */
4606 **p = 'b';
4607 @end smallexample
4608
4609 @item -Wcast-align
4610 @opindex Wcast-align
4611 @opindex Wno-cast-align
4612 Warn whenever a pointer is cast such that the required alignment of the
4613 target is increased. For example, warn if a @code{char *} is cast to
4614 an @code{int *} on machines where integers can only be accessed at
4615 two- or four-byte boundaries.
4616
4617 @item -Wwrite-strings
4618 @opindex Wwrite-strings
4619 @opindex Wno-write-strings
4620 When compiling C, give string constants the type @code{const
4621 char[@var{length}]} so that copying the address of one into a
4622 non-@code{const} @code{char *} pointer produces a warning. These
4623 warnings help you find at compile time code that can try to write
4624 into a string constant, but only if you have been very careful about
4625 using @code{const} in declarations and prototypes. Otherwise, it is
4626 just a nuisance. This is why we did not make @option{-Wall} request
4627 these warnings.
4628
4629 When compiling C++, warn about the deprecated conversion from string
4630 literals to @code{char *}. This warning is enabled by default for C++
4631 programs.
4632
4633 @item -Wclobbered
4634 @opindex Wclobbered
4635 @opindex Wno-clobbered
4636 Warn for variables that might be changed by @samp{longjmp} or
4637 @samp{vfork}. This warning is also enabled by @option{-Wextra}.
4638
4639 @item -Wconditionally-supported @r{(C++ and Objective-C++ only)}
4640 @opindex Wconditionally-supported
4641 @opindex Wno-conditionally-supported
4642 Warn for conditionally-supported (C++11 [intro.defs]) constructs.
4643
4644 @item -Wconversion
4645 @opindex Wconversion
4646 @opindex Wno-conversion
4647 Warn for implicit conversions that may alter a value. This includes
4648 conversions between real and integer, like @code{abs (x)} when
4649 @code{x} is @code{double}; conversions between signed and unsigned,
4650 like @code{unsigned ui = -1}; and conversions to smaller types, like
4651 @code{sqrtf (M_PI)}. Do not warn for explicit casts like @code{abs
4652 ((int) x)} and @code{ui = (unsigned) -1}, or if the value is not
4653 changed by the conversion like in @code{abs (2.0)}. Warnings about
4654 conversions between signed and unsigned integers can be disabled by
4655 using @option{-Wno-sign-conversion}.
4656
4657 For C++, also warn for confusing overload resolution for user-defined
4658 conversions; and conversions that never use a type conversion
4659 operator: conversions to @code{void}, the same type, a base class or a
4660 reference to them. Warnings about conversions between signed and
4661 unsigned integers are disabled by default in C++ unless
4662 @option{-Wsign-conversion} is explicitly enabled.
4663
4664 @item -Wno-conversion-null @r{(C++ and Objective-C++ only)}
4665 @opindex Wconversion-null
4666 @opindex Wno-conversion-null
4667 Do not warn for conversions between @code{NULL} and non-pointer
4668 types. @option{-Wconversion-null} is enabled by default.
4669
4670 @item -Wzero-as-null-pointer-constant @r{(C++ and Objective-C++ only)}
4671 @opindex Wzero-as-null-pointer-constant
4672 @opindex Wno-zero-as-null-pointer-constant
4673 Warn when a literal '0' is used as null pointer constant. This can
4674 be useful to facilitate the conversion to @code{nullptr} in C++11.
4675
4676 @item -Wdate-time
4677 @opindex Wdate-time
4678 @opindex Wno-date-time
4679 Warn when macros @code{__TIME__}, @code{__DATE__} or @code{__TIMESTAMP__}
4680 are encountered as they might prevent bit-wise-identical reproducible
4681 compilations.
4682
4683 @item -Wdelete-incomplete @r{(C++ and Objective-C++ only)}
4684 @opindex Wdelete-incomplete
4685 @opindex Wno-delete-incomplete
4686 Warn when deleting a pointer to incomplete type, which may cause
4687 undefined behavior at runtime. This warning is enabled by default.
4688
4689 @item -Wuseless-cast @r{(C++ and Objective-C++ only)}
4690 @opindex Wuseless-cast
4691 @opindex Wno-useless-cast
4692 Warn when an expression is casted to its own type.
4693
4694 @item -Wempty-body
4695 @opindex Wempty-body
4696 @opindex Wno-empty-body
4697 Warn if an empty body occurs in an @samp{if}, @samp{else} or @samp{do
4698 while} statement. This warning is also enabled by @option{-Wextra}.
4699
4700 @item -Wenum-compare
4701 @opindex Wenum-compare
4702 @opindex Wno-enum-compare
4703 Warn about a comparison between values of different enumerated types.
4704 In C++ enumeral mismatches in conditional expressions are also
4705 diagnosed and the warning is enabled by default. In C this warning is
4706 enabled by @option{-Wall}.
4707
4708 @item -Wjump-misses-init @r{(C, Objective-C only)}
4709 @opindex Wjump-misses-init
4710 @opindex Wno-jump-misses-init
4711 Warn if a @code{goto} statement or a @code{switch} statement jumps
4712 forward across the initialization of a variable, or jumps backward to a
4713 label after the variable has been initialized. This only warns about
4714 variables that are initialized when they are declared. This warning is
4715 only supported for C and Objective-C; in C++ this sort of branch is an
4716 error in any case.
4717
4718 @option{-Wjump-misses-init} is included in @option{-Wc++-compat}. It
4719 can be disabled with the @option{-Wno-jump-misses-init} option.
4720
4721 @item -Wsign-compare
4722 @opindex Wsign-compare
4723 @opindex Wno-sign-compare
4724 @cindex warning for comparison of signed and unsigned values
4725 @cindex comparison of signed and unsigned values, warning
4726 @cindex signed and unsigned values, comparison warning
4727 Warn when a comparison between signed and unsigned values could produce
4728 an incorrect result when the signed value is converted to unsigned.
4729 This warning is also enabled by @option{-Wextra}; to get the other warnings
4730 of @option{-Wextra} without this warning, use @option{-Wextra -Wno-sign-compare}.
4731
4732 @item -Wsign-conversion
4733 @opindex Wsign-conversion
4734 @opindex Wno-sign-conversion
4735 Warn for implicit conversions that may change the sign of an integer
4736 value, like assigning a signed integer expression to an unsigned
4737 integer variable. An explicit cast silences the warning. In C, this
4738 option is enabled also by @option{-Wconversion}.
4739
4740 @item -Wfloat-conversion
4741 @opindex Wfloat-conversion
4742 @opindex Wno-float-conversion
4743 Warn for implicit conversions that reduce the precision of a real value.
4744 This includes conversions from real to integer, and from higher precision
4745 real to lower precision real values. This option is also enabled by
4746 @option{-Wconversion}.
4747
4748 @item -Wsizeof-pointer-memaccess
4749 @opindex Wsizeof-pointer-memaccess
4750 @opindex Wno-sizeof-pointer-memaccess
4751 Warn for suspicious length parameters to certain string and memory built-in
4752 functions if the argument uses @code{sizeof}. This warning warns e.g.@:
4753 about @code{memset (ptr, 0, sizeof (ptr));} if @code{ptr} is not an array,
4754 but a pointer, and suggests a possible fix, or about
4755 @code{memcpy (&foo, ptr, sizeof (&foo));}. This warning is enabled by
4756 @option{-Wall}.
4757
4758 @item -Wsizeof-array-argument
4759 @opindex Wsizeof-array-argument
4760 @opindex Wno-sizeof-array-argument
4761 Warn when the @code{sizeof} operator is applied to a parameter that is
4762 declared as an array in a function definition. This warning is enabled by
4763 default for C and C++ programs.
4764
4765 @item -Wmemset-transposed-args
4766 @opindex Wmemset-transposed-args
4767 @opindex Wno-memset-transposed-args
4768 Warn for suspicious calls to the @code{memset} built-in function, if the
4769 second argument is not zero and the third argument is zero. This warns e.g.@
4770 about @code{memset (buf, sizeof buf, 0)} where most probably
4771 @code{memset (buf, 0, sizeof buf)} was meant instead. The diagnostics
4772 is only emitted if the third argument is literal zero, if it is some expression
4773 that is folded to zero, or e.g. a cast of zero to some type etc., it
4774 is far less likely that user has mistakenly exchanged the arguments and
4775 no warning is emitted. This warning is enabled by @option{-Wall}.
4776
4777 @item -Waddress
4778 @opindex Waddress
4779 @opindex Wno-address
4780 Warn about suspicious uses of memory addresses. These include using
4781 the address of a function in a conditional expression, such as
4782 @code{void func(void); if (func)}, and comparisons against the memory
4783 address of a string literal, such as @code{if (x == "abc")}. Such
4784 uses typically indicate a programmer error: the address of a function
4785 always evaluates to true, so their use in a conditional usually
4786 indicate that the programmer forgot the parentheses in a function
4787 call; and comparisons against string literals result in unspecified
4788 behavior and are not portable in C, so they usually indicate that the
4789 programmer intended to use @code{strcmp}. This warning is enabled by
4790 @option{-Wall}.
4791
4792 @item -Wlogical-op
4793 @opindex Wlogical-op
4794 @opindex Wno-logical-op
4795 Warn about suspicious uses of logical operators in expressions.
4796 This includes using logical operators in contexts where a
4797 bit-wise operator is likely to be expected.
4798
4799 @item -Wlogical-not-parentheses
4800 @opindex Wlogical-not-parentheses
4801 @opindex Wno-logical-not-parentheses
4802 Warn about logical not used on the left hand side operand of a comparison.
4803 This option does not warn if the RHS operand is of a boolean type. Its
4804 purpose is to detect suspicious code like the following:
4805 @smallexample
4806 int a;
4807 @dots{}
4808 if (!a > 1) @{ @dots{} @}
4809 @end smallexample
4810
4811 It is possible to suppress the warning by wrapping the LHS into
4812 parentheses:
4813 @smallexample
4814 if ((!a) > 1) @{ @dots{} @}
4815 @end smallexample
4816
4817 This warning is enabled by @option{-Wall}.
4818
4819 @item -Waggregate-return
4820 @opindex Waggregate-return
4821 @opindex Wno-aggregate-return
4822 Warn if any functions that return structures or unions are defined or
4823 called. (In languages where you can return an array, this also elicits
4824 a warning.)
4825
4826 @item -Wno-aggressive-loop-optimizations
4827 @opindex Wno-aggressive-loop-optimizations
4828 @opindex Waggressive-loop-optimizations
4829 Warn if in a loop with constant number of iterations the compiler detects
4830 undefined behavior in some statement during one or more of the iterations.
4831
4832 @item -Wno-attributes
4833 @opindex Wno-attributes
4834 @opindex Wattributes
4835 Do not warn if an unexpected @code{__attribute__} is used, such as
4836 unrecognized attributes, function attributes applied to variables,
4837 etc. This does not stop errors for incorrect use of supported
4838 attributes.
4839
4840 @item -Wno-builtin-macro-redefined
4841 @opindex Wno-builtin-macro-redefined
4842 @opindex Wbuiltin-macro-redefined
4843 Do not warn if certain built-in macros are redefined. This suppresses
4844 warnings for redefinition of @code{__TIMESTAMP__}, @code{__TIME__},
4845 @code{__DATE__}, @code{__FILE__}, and @code{__BASE_FILE__}.
4846
4847 @item -Wstrict-prototypes @r{(C and Objective-C only)}
4848 @opindex Wstrict-prototypes
4849 @opindex Wno-strict-prototypes
4850 Warn if a function is declared or defined without specifying the
4851 argument types. (An old-style function definition is permitted without
4852 a warning if preceded by a declaration that specifies the argument
4853 types.)
4854
4855 @item -Wold-style-declaration @r{(C and Objective-C only)}
4856 @opindex Wold-style-declaration
4857 @opindex Wno-old-style-declaration
4858 Warn for obsolescent usages, according to the C Standard, in a
4859 declaration. For example, warn if storage-class specifiers like
4860 @code{static} are not the first things in a declaration. This warning
4861 is also enabled by @option{-Wextra}.
4862
4863 @item -Wold-style-definition @r{(C and Objective-C only)}
4864 @opindex Wold-style-definition
4865 @opindex Wno-old-style-definition
4866 Warn if an old-style function definition is used. A warning is given
4867 even if there is a previous prototype.
4868
4869 @item -Wmissing-parameter-type @r{(C and Objective-C only)}
4870 @opindex Wmissing-parameter-type
4871 @opindex Wno-missing-parameter-type
4872 A function parameter is declared without a type specifier in K&R-style
4873 functions:
4874
4875 @smallexample
4876 void foo(bar) @{ @}
4877 @end smallexample
4878
4879 This warning is also enabled by @option{-Wextra}.
4880
4881 @item -Wmissing-prototypes @r{(C and Objective-C only)}
4882 @opindex Wmissing-prototypes
4883 @opindex Wno-missing-prototypes
4884 Warn if a global function is defined without a previous prototype
4885 declaration. This warning is issued even if the definition itself
4886 provides a prototype. Use this option to detect global functions
4887 that do not have a matching prototype declaration in a header file.
4888 This option is not valid for C++ because all function declarations
4889 provide prototypes and a non-matching declaration will declare an
4890 overload rather than conflict with an earlier declaration.
4891 Use @option{-Wmissing-declarations} to detect missing declarations in C++.
4892
4893 @item -Wmissing-declarations
4894 @opindex Wmissing-declarations
4895 @opindex Wno-missing-declarations
4896 Warn if a global function is defined without a previous declaration.
4897 Do so even if the definition itself provides a prototype.
4898 Use this option to detect global functions that are not declared in
4899 header files. In C, no warnings are issued for functions with previous
4900 non-prototype declarations; use @option{-Wmissing-prototypes} to detect
4901 missing prototypes. In C++, no warnings are issued for function templates,
4902 or for inline functions, or for functions in anonymous namespaces.
4903
4904 @item -Wmissing-field-initializers
4905 @opindex Wmissing-field-initializers
4906 @opindex Wno-missing-field-initializers
4907 @opindex W
4908 @opindex Wextra
4909 @opindex Wno-extra
4910 Warn if a structure's initializer has some fields missing. For
4911 example, the following code causes such a warning, because
4912 @code{x.h} is implicitly zero:
4913
4914 @smallexample
4915 struct s @{ int f, g, h; @};
4916 struct s x = @{ 3, 4 @};
4917 @end smallexample
4918
4919 This option does not warn about designated initializers, so the following
4920 modification does not trigger a warning:
4921
4922 @smallexample
4923 struct s @{ int f, g, h; @};
4924 struct s x = @{ .f = 3, .g = 4 @};
4925 @end smallexample
4926
4927 In C++ this option does not warn either about the empty @{ @}
4928 initializer, for example:
4929
4930 @smallexample
4931 struct s @{ int f, g, h; @};
4932 s x = @{ @};
4933 @end smallexample
4934
4935 This warning is included in @option{-Wextra}. To get other @option{-Wextra}
4936 warnings without this one, use @option{-Wextra -Wno-missing-field-initializers}.
4937
4938 @item -Wno-multichar
4939 @opindex Wno-multichar
4940 @opindex Wmultichar
4941 Do not warn if a multicharacter constant (@samp{'FOOF'}) is used.
4942 Usually they indicate a typo in the user's code, as they have
4943 implementation-defined values, and should not be used in portable code.
4944
4945 @item -Wnormalized@r{[}=@r{<}none@r{|}id@r{|}nfc@r{|}nfkc@r{>]}
4946 @opindex Wnormalized=
4947 @opindex Wnormalized
4948 @opindex Wno-normalized
4949 @cindex NFC
4950 @cindex NFKC
4951 @cindex character set, input normalization
4952 In ISO C and ISO C++, two identifiers are different if they are
4953 different sequences of characters. However, sometimes when characters
4954 outside the basic ASCII character set are used, you can have two
4955 different character sequences that look the same. To avoid confusion,
4956 the ISO 10646 standard sets out some @dfn{normalization rules} which
4957 when applied ensure that two sequences that look the same are turned into
4958 the same sequence. GCC can warn you if you are using identifiers that
4959 have not been normalized; this option controls that warning.
4960
4961 There are four levels of warning supported by GCC@. The default is
4962 @option{-Wnormalized=nfc}, which warns about any identifier that is
4963 not in the ISO 10646 ``C'' normalized form, @dfn{NFC}. NFC is the
4964 recommended form for most uses. It is equivalent to
4965 @option{-Wnormalized}.
4966
4967 Unfortunately, there are some characters allowed in identifiers by
4968 ISO C and ISO C++ that, when turned into NFC, are not allowed in
4969 identifiers. That is, there's no way to use these symbols in portable
4970 ISO C or C++ and have all your identifiers in NFC@.
4971 @option{-Wnormalized=id} suppresses the warning for these characters.
4972 It is hoped that future versions of the standards involved will correct
4973 this, which is why this option is not the default.
4974
4975 You can switch the warning off for all characters by writing
4976 @option{-Wnormalized=none} or @option{-Wno-normalized}. You should
4977 only do this if you are using some other normalization scheme (like
4978 ``D''), because otherwise you can easily create bugs that are
4979 literally impossible to see.
4980
4981 Some characters in ISO 10646 have distinct meanings but look identical
4982 in some fonts or display methodologies, especially once formatting has
4983 been applied. For instance @code{\u207F}, ``SUPERSCRIPT LATIN SMALL
4984 LETTER N'', displays just like a regular @code{n} that has been
4985 placed in a superscript. ISO 10646 defines the @dfn{NFKC}
4986 normalization scheme to convert all these into a standard form as
4987 well, and GCC warns if your code is not in NFKC if you use
4988 @option{-Wnormalized=nfkc}. This warning is comparable to warning
4989 about every identifier that contains the letter O because it might be
4990 confused with the digit 0, and so is not the default, but may be
4991 useful as a local coding convention if the programming environment
4992 cannot be fixed to display these characters distinctly.
4993
4994 @item -Wno-deprecated
4995 @opindex Wno-deprecated
4996 @opindex Wdeprecated
4997 Do not warn about usage of deprecated features. @xref{Deprecated Features}.
4998
4999 @item -Wno-deprecated-declarations
5000 @opindex Wno-deprecated-declarations
5001 @opindex Wdeprecated-declarations
5002 Do not warn about uses of functions (@pxref{Function Attributes}),
5003 variables (@pxref{Variable Attributes}), and types (@pxref{Type
5004 Attributes}) marked as deprecated by using the @code{deprecated}
5005 attribute.
5006
5007 @item -Wno-overflow
5008 @opindex Wno-overflow
5009 @opindex Woverflow
5010 Do not warn about compile-time overflow in constant expressions.
5011
5012 @item -Wno-odr
5013 @opindex Wno-odr
5014 @opindex Wodr
5015 Warn about One Definition Rule violations during link-time optimization.
5016 Requires @option{-flto-odr-type-merging} to be enabled. Enabled by default.
5017
5018 @item -Wopenmp-simd
5019 @opindex Wopenm-simd
5020 Warn if the vectorizer cost model overrides the OpenMP or the Cilk Plus
5021 simd directive set by user. The @option{-fsimd-cost-model=unlimited} can
5022 be used to relax the cost model.
5023
5024 @item -Woverride-init @r{(C and Objective-C only)}
5025 @opindex Woverride-init
5026 @opindex Wno-override-init
5027 @opindex W
5028 @opindex Wextra
5029 @opindex Wno-extra
5030 Warn if an initialized field without side effects is overridden when
5031 using designated initializers (@pxref{Designated Inits, , Designated
5032 Initializers}).
5033
5034 This warning is included in @option{-Wextra}. To get other
5035 @option{-Wextra} warnings without this one, use @option{-Wextra
5036 -Wno-override-init}.
5037
5038 @item -Wpacked
5039 @opindex Wpacked
5040 @opindex Wno-packed
5041 Warn if a structure is given the packed attribute, but the packed
5042 attribute has no effect on the layout or size of the structure.
5043 Such structures may be mis-aligned for little benefit. For
5044 instance, in this code, the variable @code{f.x} in @code{struct bar}
5045 is misaligned even though @code{struct bar} does not itself
5046 have the packed attribute:
5047
5048 @smallexample
5049 @group
5050 struct foo @{
5051 int x;
5052 char a, b, c, d;
5053 @} __attribute__((packed));
5054 struct bar @{
5055 char z;
5056 struct foo f;
5057 @};
5058 @end group
5059 @end smallexample
5060
5061 @item -Wpacked-bitfield-compat
5062 @opindex Wpacked-bitfield-compat
5063 @opindex Wno-packed-bitfield-compat
5064 The 4.1, 4.2 and 4.3 series of GCC ignore the @code{packed} attribute
5065 on bit-fields of type @code{char}. This has been fixed in GCC 4.4 but
5066 the change can lead to differences in the structure layout. GCC
5067 informs you when the offset of such a field has changed in GCC 4.4.
5068 For example there is no longer a 4-bit padding between field @code{a}
5069 and @code{b} in this structure:
5070
5071 @smallexample
5072 struct foo
5073 @{
5074 char a:4;
5075 char b:8;
5076 @} __attribute__ ((packed));
5077 @end smallexample
5078
5079 This warning is enabled by default. Use
5080 @option{-Wno-packed-bitfield-compat} to disable this warning.
5081
5082 @item -Wpadded
5083 @opindex Wpadded
5084 @opindex Wno-padded
5085 Warn if padding is included in a structure, either to align an element
5086 of the structure or to align the whole structure. Sometimes when this
5087 happens it is possible to rearrange the fields of the structure to
5088 reduce the padding and so make the structure smaller.
5089
5090 @item -Wredundant-decls
5091 @opindex Wredundant-decls
5092 @opindex Wno-redundant-decls
5093 Warn if anything is declared more than once in the same scope, even in
5094 cases where multiple declaration is valid and changes nothing.
5095
5096 @item -Wnested-externs @r{(C and Objective-C only)}
5097 @opindex Wnested-externs
5098 @opindex Wno-nested-externs
5099 Warn if an @code{extern} declaration is encountered within a function.
5100
5101 @item -Wno-inherited-variadic-ctor
5102 @opindex Winherited-variadic-ctor
5103 @opindex Wno-inherited-variadic-ctor
5104 Suppress warnings about use of C++11 inheriting constructors when the
5105 base class inherited from has a C variadic constructor; the warning is
5106 on by default because the ellipsis is not inherited.
5107
5108 @item -Winline
5109 @opindex Winline
5110 @opindex Wno-inline
5111 Warn if a function that is declared as inline cannot be inlined.
5112 Even with this option, the compiler does not warn about failures to
5113 inline functions declared in system headers.
5114
5115 The compiler uses a variety of heuristics to determine whether or not
5116 to inline a function. For example, the compiler takes into account
5117 the size of the function being inlined and the amount of inlining
5118 that has already been done in the current function. Therefore,
5119 seemingly insignificant changes in the source program can cause the
5120 warnings produced by @option{-Winline} to appear or disappear.
5121
5122 @item -Wno-invalid-offsetof @r{(C++ and Objective-C++ only)}
5123 @opindex Wno-invalid-offsetof
5124 @opindex Winvalid-offsetof
5125 Suppress warnings from applying the @samp{offsetof} macro to a non-POD
5126 type. According to the 2014 ISO C++ standard, applying @samp{offsetof}
5127 to a non-standard-layout type is undefined. In existing C++ implementations,
5128 however, @samp{offsetof} typically gives meaningful results.
5129 This flag is for users who are aware that they are
5130 writing nonportable code and who have deliberately chosen to ignore the
5131 warning about it.
5132
5133 The restrictions on @samp{offsetof} may be relaxed in a future version
5134 of the C++ standard.
5135
5136 @item -Wno-int-to-pointer-cast
5137 @opindex Wno-int-to-pointer-cast
5138 @opindex Wint-to-pointer-cast
5139 Suppress warnings from casts to pointer type of an integer of a
5140 different size. In C++, casting to a pointer type of smaller size is
5141 an error. @option{Wint-to-pointer-cast} is enabled by default.
5142
5143
5144 @item -Wno-pointer-to-int-cast @r{(C and Objective-C only)}
5145 @opindex Wno-pointer-to-int-cast
5146 @opindex Wpointer-to-int-cast
5147 Suppress warnings from casts from a pointer to an integer type of a
5148 different size.
5149
5150 @item -Winvalid-pch
5151 @opindex Winvalid-pch
5152 @opindex Wno-invalid-pch
5153 Warn if a precompiled header (@pxref{Precompiled Headers}) is found in
5154 the search path but can't be used.
5155
5156 @item -Wlong-long
5157 @opindex Wlong-long
5158 @opindex Wno-long-long
5159 Warn if @samp{long long} type is used. This is enabled by either
5160 @option{-Wpedantic} or @option{-Wtraditional} in ISO C90 and C++98
5161 modes. To inhibit the warning messages, use @option{-Wno-long-long}.
5162
5163 @item -Wvariadic-macros
5164 @opindex Wvariadic-macros
5165 @opindex Wno-variadic-macros
5166 Warn if variadic macros are used in ISO C90 mode, or if the GNU
5167 alternate syntax is used in ISO C99 mode. This is enabled by either
5168 @option{-Wpedantic} or @option{-Wtraditional}. To inhibit the warning
5169 messages, use @option{-Wno-variadic-macros}.
5170
5171 @item -Wvarargs
5172 @opindex Wvarargs
5173 @opindex Wno-varargs
5174 Warn upon questionable usage of the macros used to handle variable
5175 arguments like @samp{va_start}. This is default. To inhibit the
5176 warning messages, use @option{-Wno-varargs}.
5177
5178 @item -Wvector-operation-performance
5179 @opindex Wvector-operation-performance
5180 @opindex Wno-vector-operation-performance
5181 Warn if vector operation is not implemented via SIMD capabilities of the
5182 architecture. Mainly useful for the performance tuning.
5183 Vector operation can be implemented @code{piecewise}, which means that the
5184 scalar operation is performed on every vector element;
5185 @code{in parallel}, which means that the vector operation is implemented
5186 using scalars of wider type, which normally is more performance efficient;
5187 and @code{as a single scalar}, which means that vector fits into a
5188 scalar type.
5189
5190 @item -Wno-virtual-move-assign
5191 @opindex Wvirtual-move-assign
5192 @opindex Wno-virtual-move-assign
5193 Suppress warnings about inheriting from a virtual base with a
5194 non-trivial C++11 move assignment operator. This is dangerous because
5195 if the virtual base is reachable along more than one path, it will be
5196 moved multiple times, which can mean both objects end up in the
5197 moved-from state. If the move assignment operator is written to avoid
5198 moving from a moved-from object, this warning can be disabled.
5199
5200 @item -Wvla
5201 @opindex Wvla
5202 @opindex Wno-vla
5203 Warn if variable length array is used in the code.
5204 @option{-Wno-vla} prevents the @option{-Wpedantic} warning of
5205 the variable length array.
5206
5207 @item -Wvolatile-register-var
5208 @opindex Wvolatile-register-var
5209 @opindex Wno-volatile-register-var
5210 Warn if a register variable is declared volatile. The volatile
5211 modifier does not inhibit all optimizations that may eliminate reads
5212 and/or writes to register variables. This warning is enabled by
5213 @option{-Wall}.
5214
5215 @item -Wdisabled-optimization
5216 @opindex Wdisabled-optimization
5217 @opindex Wno-disabled-optimization
5218 Warn if a requested optimization pass is disabled. This warning does
5219 not generally indicate that there is anything wrong with your code; it
5220 merely indicates that GCC's optimizers are unable to handle the code
5221 effectively. Often, the problem is that your code is too big or too
5222 complex; GCC refuses to optimize programs when the optimization
5223 itself is likely to take inordinate amounts of time.
5224
5225 @item -Wpointer-sign @r{(C and Objective-C only)}
5226 @opindex Wpointer-sign
5227 @opindex Wno-pointer-sign
5228 Warn for pointer argument passing or assignment with different signedness.
5229 This option is only supported for C and Objective-C@. It is implied by
5230 @option{-Wall} and by @option{-Wpedantic}, which can be disabled with
5231 @option{-Wno-pointer-sign}.
5232
5233 @item -Wstack-protector
5234 @opindex Wstack-protector
5235 @opindex Wno-stack-protector
5236 This option is only active when @option{-fstack-protector} is active. It
5237 warns about functions that are not protected against stack smashing.
5238
5239 @item -Woverlength-strings
5240 @opindex Woverlength-strings
5241 @opindex Wno-overlength-strings
5242 Warn about string constants that are longer than the ``minimum
5243 maximum'' length specified in the C standard. Modern compilers
5244 generally allow string constants that are much longer than the
5245 standard's minimum limit, but very portable programs should avoid
5246 using longer strings.
5247
5248 The limit applies @emph{after} string constant concatenation, and does
5249 not count the trailing NUL@. In C90, the limit was 509 characters; in
5250 C99, it was raised to 4095. C++98 does not specify a normative
5251 minimum maximum, so we do not diagnose overlength strings in C++@.
5252
5253 This option is implied by @option{-Wpedantic}, and can be disabled with
5254 @option{-Wno-overlength-strings}.
5255
5256 @item -Wunsuffixed-float-constants @r{(C and Objective-C only)}
5257 @opindex Wunsuffixed-float-constants
5258
5259 Issue a warning for any floating constant that does not have
5260 a suffix. When used together with @option{-Wsystem-headers} it
5261 warns about such constants in system header files. This can be useful
5262 when preparing code to use with the @code{FLOAT_CONST_DECIMAL64} pragma
5263 from the decimal floating-point extension to C99.
5264
5265 @item -Wno-designated-init @r{(C and Objective-C only)}
5266 Suppress warnings when a positional initializer is used to initialize
5267 a structure that has been marked with the @code{designated_init}
5268 attribute.
5269
5270 @end table
5271
5272 @node Debugging Options
5273 @section Options for Debugging Your Program or GCC
5274 @cindex options, debugging
5275 @cindex debugging information options
5276
5277 GCC has various special options that are used for debugging
5278 either your program or GCC:
5279
5280 @table @gcctabopt
5281 @item -g
5282 @opindex g
5283 Produce debugging information in the operating system's native format
5284 (stabs, COFF, XCOFF, or DWARF 2)@. GDB can work with this debugging
5285 information.
5286
5287 On most systems that use stabs format, @option{-g} enables use of extra
5288 debugging information that only GDB can use; this extra information
5289 makes debugging work better in GDB but probably makes other debuggers
5290 crash or
5291 refuse to read the program. If you want to control for certain whether
5292 to generate the extra information, use @option{-gstabs+}, @option{-gstabs},
5293 @option{-gxcoff+}, @option{-gxcoff}, or @option{-gvms} (see below).
5294
5295 GCC allows you to use @option{-g} with
5296 @option{-O}. The shortcuts taken by optimized code may occasionally
5297 produce surprising results: some variables you declared may not exist
5298 at all; flow of control may briefly move where you did not expect it;
5299 some statements may not be executed because they compute constant
5300 results or their values are already at hand; some statements may
5301 execute in different places because they have been moved out of loops.
5302
5303 Nevertheless it proves possible to debug optimized output. This makes
5304 it reasonable to use the optimizer for programs that might have bugs.
5305
5306 The following options are useful when GCC is generated with the
5307 capability for more than one debugging format.
5308
5309 @item -gsplit-dwarf
5310 @opindex gsplit-dwarf
5311 Separate as much dwarf debugging information as possible into a
5312 separate output file with the extension .dwo. This option allows
5313 the build system to avoid linking files with debug information. To
5314 be useful, this option requires a debugger capable of reading .dwo
5315 files.
5316
5317 @item -ggdb
5318 @opindex ggdb
5319 Produce debugging information for use by GDB@. This means to use the
5320 most expressive format available (DWARF 2, stabs, or the native format
5321 if neither of those are supported), including GDB extensions if at all
5322 possible.
5323
5324 @item -gpubnames
5325 @opindex gpubnames
5326 Generate dwarf .debug_pubnames and .debug_pubtypes sections.
5327
5328 @item -ggnu-pubnames
5329 @opindex ggnu-pubnames
5330 Generate .debug_pubnames and .debug_pubtypes sections in a format
5331 suitable for conversion into a GDB@ index. This option is only useful
5332 with a linker that can produce GDB@ index version 7.
5333
5334 @item -gstabs
5335 @opindex gstabs
5336 Produce debugging information in stabs format (if that is supported),
5337 without GDB extensions. This is the format used by DBX on most BSD
5338 systems. On MIPS, Alpha and System V Release 4 systems this option
5339 produces stabs debugging output that is not understood by DBX or SDB@.
5340 On System V Release 4 systems this option requires the GNU assembler.
5341
5342 @item -feliminate-unused-debug-symbols
5343 @opindex feliminate-unused-debug-symbols
5344 Produce debugging information in stabs format (if that is supported),
5345 for only symbols that are actually used.
5346
5347 @item -femit-class-debug-always
5348 Instead of emitting debugging information for a C++ class in only one
5349 object file, emit it in all object files using the class. This option
5350 should be used only with debuggers that are unable to handle the way GCC
5351 normally emits debugging information for classes because using this
5352 option increases the size of debugging information by as much as a
5353 factor of two.
5354
5355 @item -fdebug-types-section
5356 @opindex fdebug-types-section
5357 @opindex fno-debug-types-section
5358 When using DWARF Version 4 or higher, type DIEs can be put into
5359 their own @code{.debug_types} section instead of making them part of the
5360 @code{.debug_info} section. It is more efficient to put them in a separate
5361 comdat sections since the linker can then remove duplicates.
5362 But not all DWARF consumers support @code{.debug_types} sections yet
5363 and on some objects @code{.debug_types} produces larger instead of smaller
5364 debugging information.
5365
5366 @item -gstabs+
5367 @opindex gstabs+
5368 Produce debugging information in stabs format (if that is supported),
5369 using GNU extensions understood only by the GNU debugger (GDB)@. The
5370 use of these extensions is likely to make other debuggers crash or
5371 refuse to read the program.
5372
5373 @item -gcoff
5374 @opindex gcoff
5375 Produce debugging information in COFF format (if that is supported).
5376 This is the format used by SDB on most System V systems prior to
5377 System V Release 4.
5378
5379 @item -gxcoff
5380 @opindex gxcoff
5381 Produce debugging information in XCOFF format (if that is supported).
5382 This is the format used by the DBX debugger on IBM RS/6000 systems.
5383
5384 @item -gxcoff+
5385 @opindex gxcoff+
5386 Produce debugging information in XCOFF format (if that is supported),
5387 using GNU extensions understood only by the GNU debugger (GDB)@. The
5388 use of these extensions is likely to make other debuggers crash or
5389 refuse to read the program, and may cause assemblers other than the GNU
5390 assembler (GAS) to fail with an error.
5391
5392 @item -gdwarf-@var{version}
5393 @opindex gdwarf-@var{version}
5394 Produce debugging information in DWARF format (if that is supported).
5395 The value of @var{version} may be either 2, 3 or 4; the default version
5396 for most targets is 4.
5397
5398 Note that with DWARF Version 2, some ports require and always
5399 use some non-conflicting DWARF 3 extensions in the unwind tables.
5400
5401 Version 4 may require GDB 7.0 and @option{-fvar-tracking-assignments}
5402 for maximum benefit.
5403
5404 @item -grecord-gcc-switches
5405 @opindex grecord-gcc-switches
5406 This switch causes the command-line options used to invoke the
5407 compiler that may affect code generation to be appended to the
5408 DW_AT_producer attribute in DWARF debugging information. The options
5409 are concatenated with spaces separating them from each other and from
5410 the compiler version. See also @option{-frecord-gcc-switches} for another
5411 way of storing compiler options into the object file. This is the default.
5412
5413 @item -gno-record-gcc-switches
5414 @opindex gno-record-gcc-switches
5415 Disallow appending command-line options to the DW_AT_producer attribute
5416 in DWARF debugging information.
5417
5418 @item -gstrict-dwarf
5419 @opindex gstrict-dwarf
5420 Disallow using extensions of later DWARF standard version than selected
5421 with @option{-gdwarf-@var{version}}. On most targets using non-conflicting
5422 DWARF extensions from later standard versions is allowed.
5423
5424 @item -gno-strict-dwarf
5425 @opindex gno-strict-dwarf
5426 Allow using extensions of later DWARF standard version than selected with
5427 @option{-gdwarf-@var{version}}.
5428
5429 @item -gz@r{[}=@var{type}@r{]}
5430 @opindex gz
5431 Produce compressed debug sections in DWARF format, if that is supported.
5432 If @var{type} is not given, the default type depends on the capabilities
5433 of the assembler and linker used. @var{type} may be one of
5434 @option{none} (don't compress debug sections), @option{zlib} (use zlib
5435 compression in ELF gABI format), or @option{zlib-gnu} (use zlib
5436 compression in traditional GNU format). If the linker doesn't support
5437 writing compressed debug sections, the option is rejected. Otherwise,
5438 if the assembler does not support them, @option{-gz} is silently ignored
5439 when producing object files.
5440
5441 @item -gvms
5442 @opindex gvms
5443 Produce debugging information in Alpha/VMS debug format (if that is
5444 supported). This is the format used by DEBUG on Alpha/VMS systems.
5445
5446 @item -g@var{level}
5447 @itemx -ggdb@var{level}
5448 @itemx -gstabs@var{level}
5449 @itemx -gcoff@var{level}
5450 @itemx -gxcoff@var{level}
5451 @itemx -gvms@var{level}
5452 Request debugging information and also use @var{level} to specify how
5453 much information. The default level is 2.
5454
5455 Level 0 produces no debug information at all. Thus, @option{-g0} negates
5456 @option{-g}.
5457
5458 Level 1 produces minimal information, enough for making backtraces in
5459 parts of the program that you don't plan to debug. This includes
5460 descriptions of functions and external variables, and line number
5461 tables, but no information about local variables.
5462
5463 Level 3 includes extra information, such as all the macro definitions
5464 present in the program. Some debuggers support macro expansion when
5465 you use @option{-g3}.
5466
5467 @option{-gdwarf-2} does not accept a concatenated debug level, because
5468 GCC used to support an option @option{-gdwarf} that meant to generate
5469 debug information in version 1 of the DWARF format (which is very
5470 different from version 2), and it would have been too confusing. That
5471 debug format is long obsolete, but the option cannot be changed now.
5472 Instead use an additional @option{-g@var{level}} option to change the
5473 debug level for DWARF.
5474
5475 @item -gtoggle
5476 @opindex gtoggle
5477 Turn off generation of debug info, if leaving out this option
5478 generates it, or turn it on at level 2 otherwise. The position of this
5479 argument in the command line does not matter; it takes effect after all
5480 other options are processed, and it does so only once, no matter how
5481 many times it is given. This is mainly intended to be used with
5482 @option{-fcompare-debug}.
5483
5484 @item -fsanitize=address
5485 @opindex fsanitize=address
5486 Enable AddressSanitizer, a fast memory error detector.
5487 Memory access instructions will be instrumented to detect
5488 out-of-bounds and use-after-free bugs.
5489 See @uref{http://code.google.com/p/address-sanitizer/} for
5490 more details. The run-time behavior can be influenced using the
5491 @env{ASAN_OPTIONS} environment variable; see
5492 @url{https://code.google.com/p/address-sanitizer/wiki/Flags#Run-time_flags} for
5493 a list of supported options.
5494
5495 @item -fsanitize=kernel-address
5496 @opindex fsanitize=kernel-address
5497 Enable AddressSanitizer for Linux kernel.
5498 See @uref{http://code.google.com/p/address-sanitizer/wiki/AddressSanitizerForKernel} for more details.
5499
5500 @item -fsanitize=thread
5501 @opindex fsanitize=thread
5502 Enable ThreadSanitizer, a fast data race detector.
5503 Memory access instructions will be instrumented to detect
5504 data race bugs. See @uref{http://code.google.com/p/thread-sanitizer/} for more
5505 details. The run-time behavior can be influenced using the @env{TSAN_OPTIONS}
5506 environment variable; see
5507 @url{https://code.google.com/p/thread-sanitizer/wiki/Flags} for a list of
5508 supported options.
5509
5510 @item -fsanitize=leak
5511 @opindex fsanitize=leak
5512 Enable LeakSanitizer, a memory leak detector.
5513 This option only matters for linking of executables and if neither
5514 @option{-fsanitize=address} nor @option{-fsanitize=thread} is used. In that
5515 case it will link the executable against a library that overrides @code{malloc}
5516 and other allocator functions. See
5517 @uref{https://code.google.com/p/address-sanitizer/wiki/LeakSanitizer} for more
5518 details. The run-time behavior can be influenced using the
5519 @env{LSAN_OPTIONS} environment variable.
5520
5521 @item -fsanitize=undefined
5522 @opindex fsanitize=undefined
5523 Enable UndefinedBehaviorSanitizer, a fast undefined behavior detector.
5524 Various computations will be instrumented to detect undefined behavior
5525 at runtime. Current suboptions are:
5526
5527 @table @gcctabopt
5528
5529 @item -fsanitize=shift
5530 @opindex fsanitize=shift
5531 This option enables checking that the result of a shift operation is
5532 not undefined. Note that what exactly is considered undefined differs
5533 slightly between C and C++, as well as between ISO C90 and C99, etc.
5534
5535 @item -fsanitize=integer-divide-by-zero
5536 @opindex fsanitize=integer-divide-by-zero
5537 Detect integer division by zero as well as @code{INT_MIN / -1} division.
5538
5539 @item -fsanitize=unreachable
5540 @opindex fsanitize=unreachable
5541 With this option, the compiler will turn the @code{__builtin_unreachable}
5542 call into a diagnostics message call instead. When reaching the
5543 @code{__builtin_unreachable} call, the behavior is undefined.
5544
5545 @item -fsanitize=vla-bound
5546 @opindex fsanitize=vla-bound
5547 This option instructs the compiler to check that the size of a variable
5548 length array is positive. This option does not have any effect in
5549 @option{-std=c++14} mode, as the standard requires the exception be thrown
5550 instead.
5551
5552 @item -fsanitize=null
5553 @opindex fsanitize=null
5554 This option enables pointer checking. Particularly, the application
5555 built with this option turned on will issue an error message when it
5556 tries to dereference a NULL pointer, or if a reference (possibly an
5557 rvalue reference) is bound to a NULL pointer, or if a method is invoked
5558 on an object pointed by a NULL pointer.
5559
5560 @item -fsanitize=return
5561 @opindex fsanitize=return
5562 This option enables return statement checking. Programs
5563 built with this option turned on will issue an error message
5564 when the end of a non-void function is reached without actually
5565 returning a value. This option works in C++ only.
5566
5567 @item -fsanitize=signed-integer-overflow
5568 @opindex fsanitize=signed-integer-overflow
5569 This option enables signed integer overflow checking. We check that
5570 the result of @code{+}, @code{*}, and both unary and binary @code{-}
5571 does not overflow in the signed arithmetics. Note, integer promotion
5572 rules must be taken into account. That is, the following is not an
5573 overflow:
5574 @smallexample
5575 signed char a = SCHAR_MAX;
5576 a++;
5577 @end smallexample
5578
5579 @item -fsanitize=bounds
5580 @opindex fsanitize=bounds
5581 This option enables instrumentation of array bounds. Various out of bounds
5582 accesses are detected. Flexible array members and initializers of variables
5583 with static storage are not instrumented.
5584
5585 @item -fsanitize=alignment
5586 @opindex fsanitize=alignment
5587
5588 This option enables checking of alignment of pointers when they are
5589 dereferenced, or when a reference is bound to insufficiently aligned target,
5590 or when a method or constructor is invoked on insufficiently aligned object.
5591
5592 @item -fsanitize=object-size
5593 @opindex fsanitize=object-size
5594 This option enables instrumentation of memory references using the
5595 @code{__builtin_object_size} function. Various out of bounds pointer
5596 accesses are detected.
5597
5598 @item -fsanitize=float-divide-by-zero
5599 @opindex fsanitize=float-divide-by-zero
5600 Detect floating-point division by zero. Unlike other similar options,
5601 @option{-fsanitize=float-divide-by-zero} is not enabled by
5602 @option{-fsanitize=undefined}, since floating-point division by zero can
5603 be a legitimate way of obtaining infinities and NaNs.
5604
5605 @item -fsanitize=float-cast-overflow
5606 @opindex fsanitize=float-cast-overflow
5607 This option enables floating-point type to integer conversion checking.
5608 We check that the result of the conversion does not overflow.
5609 This option does not work well with @code{FE_INVALID} exceptions enabled.
5610
5611 @item -fsanitize=nonnull-attribute
5612 @opindex fsanitize=nonnull-attribute
5613
5614 This option enables instrumentation of calls, checking whether null values
5615 are not passed to arguments marked as requiring a non-null value by the
5616 @code{nonnull} function attribute.
5617
5618 @item -fsanitize=returns-nonnull-attribute
5619 @opindex fsanitize=returns-nonnull-attribute
5620
5621 This option enables instrumentation of return statements in functions
5622 marked with @code{returns_nonnull} function attribute, to detect returning
5623 of null values from such functions.
5624
5625 @item -fsanitize=bool
5626 @opindex fsanitize=bool
5627
5628 This option enables instrumentation of loads from bool. If a value other
5629 than 0/1 is loaded, a run-time error is issued.
5630
5631 @item -fsanitize=enum
5632 @opindex fsanitize=enum
5633
5634 This option enables instrumentation of loads from an enum type. If
5635 a value outside the range of values for the enum type is loaded,
5636 a run-time error is issued.
5637
5638 @end table
5639
5640 While @option{-ftrapv} causes traps for signed overflows to be emitted,
5641 @option{-fsanitize=undefined} gives a diagnostic message.
5642 This currently works only for the C family of languages.
5643
5644 @item -fasan-shadow-offset=@var{number}
5645 @opindex fasan-shadow-offset
5646 This option forces GCC to use custom shadow offset in AddressSanitizer checks.
5647 It is useful for experimenting with different shadow memory layouts in
5648 Kernel AddressSanitizer.
5649
5650 @item -fsanitize-recover@r{[}=@var{opts}@r{]}
5651 @opindex fsanitize-recover
5652 @opindex fno-sanitize-recover
5653 @option{-fsanitize-recover=} controls error recovery mode for sanitizers
5654 mentioned in comma-separated list of @var{opts}. Enabling this option
5655 for a sanitizer component would cause it to attempt to continue
5656 running the program as if no error happened. This means multiple
5657 runtime errors can be reported in a single program run, and the exit
5658 code of the program may indicate success even when errors
5659 have been reported. The @option{-fno-sanitize-recover=} can be used to alter
5660 this behavior, only the first detected error will be reported
5661 and program will exit after that with non-zero exit code.
5662
5663 Currently this feature only works for @option{-fsanitize=undefined} (and its suboptions
5664 except for @option{-fsanitize=unreachable} and @option{-fsanitize=return}),
5665 @option{-fsanitize=float-cast-overflow}, @option{-fsanitize=float-divide-by-zero} and
5666 @option{-fsanitize=kernel-address}. For these sanitizers error recovery is turned on by default.
5667
5668 Syntax without explicit @var{opts} parameter is deprecated. It is equivalent to
5669 @option{-fsanitize-recover=undefined,float-cast-overflow,float-divide-by-zero,kernel-address}.
5670 Similarly @option{-fno-sanitize-recover} is equivalent to
5671 @option{-fno-sanitize-recover=undefined,float-cast-overflow,float-divide-by-zero,kernel-address}.
5672
5673 @item -fsanitize-undefined-trap-on-error
5674 @opindex fsanitize-undefined-trap-on-error
5675 The @option{-fsanitize-undefined-trap-on-error} instructs the compiler to
5676 report undefined behavior using @code{__builtin_trap ()} rather than
5677 a @code{libubsan} library routine. The advantage of this is that the
5678 @code{libubsan} library is not needed and will not be linked in, so this
5679 is usable even for use in freestanding environments.
5680
5681 @item -fdump-final-insns@r{[}=@var{file}@r{]}
5682 @opindex fdump-final-insns
5683 Dump the final internal representation (RTL) to @var{file}. If the
5684 optional argument is omitted (or if @var{file} is @code{.}), the name
5685 of the dump file is determined by appending @code{.gkd} to the
5686 compilation output file name.
5687
5688 @item -fcompare-debug@r{[}=@var{opts}@r{]}
5689 @opindex fcompare-debug
5690 @opindex fno-compare-debug
5691 If no error occurs during compilation, run the compiler a second time,
5692 adding @var{opts} and @option{-fcompare-debug-second} to the arguments
5693 passed to the second compilation. Dump the final internal
5694 representation in both compilations, and print an error if they differ.
5695
5696 If the equal sign is omitted, the default @option{-gtoggle} is used.
5697
5698 The environment variable @env{GCC_COMPARE_DEBUG}, if defined, non-empty
5699 and nonzero, implicitly enables @option{-fcompare-debug}. If
5700 @env{GCC_COMPARE_DEBUG} is defined to a string starting with a dash,
5701 then it is used for @var{opts}, otherwise the default @option{-gtoggle}
5702 is used.
5703
5704 @option{-fcompare-debug=}, with the equal sign but without @var{opts},
5705 is equivalent to @option{-fno-compare-debug}, which disables the dumping
5706 of the final representation and the second compilation, preventing even
5707 @env{GCC_COMPARE_DEBUG} from taking effect.
5708
5709 To verify full coverage during @option{-fcompare-debug} testing, set
5710 @env{GCC_COMPARE_DEBUG} to say @samp{-fcompare-debug-not-overridden},
5711 which GCC rejects as an invalid option in any actual compilation
5712 (rather than preprocessing, assembly or linking). To get just a
5713 warning, setting @env{GCC_COMPARE_DEBUG} to @samp{-w%n-fcompare-debug
5714 not overridden} will do.
5715
5716 @item -fcompare-debug-second
5717 @opindex fcompare-debug-second
5718 This option is implicitly passed to the compiler for the second
5719 compilation requested by @option{-fcompare-debug}, along with options to
5720 silence warnings, and omitting other options that would cause
5721 side-effect compiler outputs to files or to the standard output. Dump
5722 files and preserved temporary files are renamed so as to contain the
5723 @code{.gk} additional extension during the second compilation, to avoid
5724 overwriting those generated by the first.
5725
5726 When this option is passed to the compiler driver, it causes the
5727 @emph{first} compilation to be skipped, which makes it useful for little
5728 other than debugging the compiler proper.
5729
5730 @item -feliminate-dwarf2-dups
5731 @opindex feliminate-dwarf2-dups
5732 Compress DWARF 2 debugging information by eliminating duplicated
5733 information about each symbol. This option only makes sense when
5734 generating DWARF 2 debugging information with @option{-gdwarf-2}.
5735
5736 @item -femit-struct-debug-baseonly
5737 @opindex femit-struct-debug-baseonly
5738 Emit debug information for struct-like types
5739 only when the base name of the compilation source file
5740 matches the base name of file in which the struct is defined.
5741
5742 This option substantially reduces the size of debugging information,
5743 but at significant potential loss in type information to the debugger.
5744 See @option{-femit-struct-debug-reduced} for a less aggressive option.
5745 See @option{-femit-struct-debug-detailed} for more detailed control.
5746
5747 This option works only with DWARF 2.
5748
5749 @item -femit-struct-debug-reduced
5750 @opindex femit-struct-debug-reduced
5751 Emit debug information for struct-like types
5752 only when the base name of the compilation source file
5753 matches the base name of file in which the type is defined,
5754 unless the struct is a template or defined in a system header.
5755
5756 This option significantly reduces the size of debugging information,
5757 with some potential loss in type information to the debugger.
5758 See @option{-femit-struct-debug-baseonly} for a more aggressive option.
5759 See @option{-femit-struct-debug-detailed} for more detailed control.
5760
5761 This option works only with DWARF 2.
5762
5763 @item -femit-struct-debug-detailed@r{[}=@var{spec-list}@r{]}
5764 Specify the struct-like types
5765 for which the compiler generates debug information.
5766 The intent is to reduce duplicate struct debug information
5767 between different object files within the same program.
5768
5769 This option is a detailed version of
5770 @option{-femit-struct-debug-reduced} and @option{-femit-struct-debug-baseonly},
5771 which serves for most needs.
5772
5773 A specification has the syntax@*
5774 [@samp{dir:}|@samp{ind:}][@samp{ord:}|@samp{gen:}](@samp{any}|@samp{sys}|@samp{base}|@samp{none})
5775
5776 The optional first word limits the specification to
5777 structs that are used directly (@samp{dir:}) or used indirectly (@samp{ind:}).
5778 A struct type is used directly when it is the type of a variable, member.
5779 Indirect uses arise through pointers to structs.
5780 That is, when use of an incomplete struct is valid, the use is indirect.
5781 An example is
5782 @samp{struct one direct; struct two * indirect;}.
5783
5784 The optional second word limits the specification to
5785 ordinary structs (@samp{ord:}) or generic structs (@samp{gen:}).
5786 Generic structs are a bit complicated to explain.
5787 For C++, these are non-explicit specializations of template classes,
5788 or non-template classes within the above.
5789 Other programming languages have generics,
5790 but @option{-femit-struct-debug-detailed} does not yet implement them.
5791
5792 The third word specifies the source files for those
5793 structs for which the compiler should emit debug information.
5794 The values @samp{none} and @samp{any} have the normal meaning.
5795 The value @samp{base} means that
5796 the base of name of the file in which the type declaration appears
5797 must match the base of the name of the main compilation file.
5798 In practice, this means that when compiling @file{foo.c}, debug information
5799 is generated for types declared in that file and @file{foo.h},
5800 but not other header files.
5801 The value @samp{sys} means those types satisfying @samp{base}
5802 or declared in system or compiler headers.
5803
5804 You may need to experiment to determine the best settings for your application.
5805
5806 The default is @option{-femit-struct-debug-detailed=all}.
5807
5808 This option works only with DWARF 2.
5809
5810 @item -fno-merge-debug-strings
5811 @opindex fmerge-debug-strings
5812 @opindex fno-merge-debug-strings
5813 Direct the linker to not merge together strings in the debugging
5814 information that are identical in different object files. Merging is
5815 not supported by all assemblers or linkers. Merging decreases the size
5816 of the debug information in the output file at the cost of increasing
5817 link processing time. Merging is enabled by default.
5818
5819 @item -fdebug-prefix-map=@var{old}=@var{new}
5820 @opindex fdebug-prefix-map
5821 When compiling files in directory @file{@var{old}}, record debugging
5822 information describing them as in @file{@var{new}} instead.
5823
5824 @item -fno-dwarf2-cfi-asm
5825 @opindex fdwarf2-cfi-asm
5826 @opindex fno-dwarf2-cfi-asm
5827 Emit DWARF 2 unwind info as compiler generated @code{.eh_frame} section
5828 instead of using GAS @code{.cfi_*} directives.
5829
5830 @cindex @command{prof}
5831 @item -p
5832 @opindex p
5833 Generate extra code to write profile information suitable for the
5834 analysis program @command{prof}. You must use this option when compiling
5835 the source files you want data about, and you must also use it when
5836 linking.
5837
5838 @cindex @command{gprof}
5839 @item -pg
5840 @opindex pg
5841 Generate extra code to write profile information suitable for the
5842 analysis program @command{gprof}. You must use this option when compiling
5843 the source files you want data about, and you must also use it when
5844 linking.
5845
5846 @item -Q
5847 @opindex Q
5848 Makes the compiler print out each function name as it is compiled, and
5849 print some statistics about each pass when it finishes.
5850
5851 @item -ftime-report
5852 @opindex ftime-report
5853 Makes the compiler print some statistics about the time consumed by each
5854 pass when it finishes.
5855
5856 @item -fmem-report
5857 @opindex fmem-report
5858 Makes the compiler print some statistics about permanent memory
5859 allocation when it finishes.
5860
5861 @item -fmem-report-wpa
5862 @opindex fmem-report-wpa
5863 Makes the compiler print some statistics about permanent memory
5864 allocation for the WPA phase only.
5865
5866 @item -fpre-ipa-mem-report
5867 @opindex fpre-ipa-mem-report
5868 @item -fpost-ipa-mem-report
5869 @opindex fpost-ipa-mem-report
5870 Makes the compiler print some statistics about permanent memory
5871 allocation before or after interprocedural optimization.
5872
5873 @item -fprofile-report
5874 @opindex fprofile-report
5875 Makes the compiler print some statistics about consistency of the
5876 (estimated) profile and effect of individual passes.
5877
5878 @item -fstack-usage
5879 @opindex fstack-usage
5880 Makes the compiler output stack usage information for the program, on a
5881 per-function basis. The filename for the dump is made by appending
5882 @file{.su} to the @var{auxname}. @var{auxname} is generated from the name of
5883 the output file, if explicitly specified and it is not an executable,
5884 otherwise it is the basename of the source file. An entry is made up
5885 of three fields:
5886
5887 @itemize
5888 @item
5889 The name of the function.
5890 @item
5891 A number of bytes.
5892 @item
5893 One or more qualifiers: @code{static}, @code{dynamic}, @code{bounded}.
5894 @end itemize
5895
5896 The qualifier @code{static} means that the function manipulates the stack
5897 statically: a fixed number of bytes are allocated for the frame on function
5898 entry and released on function exit; no stack adjustments are otherwise made
5899 in the function. The second field is this fixed number of bytes.
5900
5901 The qualifier @code{dynamic} means that the function manipulates the stack
5902 dynamically: in addition to the static allocation described above, stack
5903 adjustments are made in the body of the function, for example to push/pop
5904 arguments around function calls. If the qualifier @code{bounded} is also
5905 present, the amount of these adjustments is bounded at compile time and
5906 the second field is an upper bound of the total amount of stack used by
5907 the function. If it is not present, the amount of these adjustments is
5908 not bounded at compile time and the second field only represents the
5909 bounded part.
5910
5911 @item -fprofile-arcs
5912 @opindex fprofile-arcs
5913 Add code so that program flow @dfn{arcs} are instrumented. During
5914 execution the program records how many times each branch and call is
5915 executed and how many times it is taken or returns. When the compiled
5916 program exits it saves this data to a file called
5917 @file{@var{auxname}.gcda} for each source file. The data may be used for
5918 profile-directed optimizations (@option{-fbranch-probabilities}), or for
5919 test coverage analysis (@option{-ftest-coverage}). Each object file's
5920 @var{auxname} is generated from the name of the output file, if
5921 explicitly specified and it is not the final executable, otherwise it is
5922 the basename of the source file. In both cases any suffix is removed
5923 (e.g.@: @file{foo.gcda} for input file @file{dir/foo.c}, or
5924 @file{dir/foo.gcda} for output file specified as @option{-o dir/foo.o}).
5925 @xref{Cross-profiling}.
5926
5927 @cindex @command{gcov}
5928 @item --coverage
5929 @opindex coverage
5930
5931 This option is used to compile and link code instrumented for coverage
5932 analysis. The option is a synonym for @option{-fprofile-arcs}
5933 @option{-ftest-coverage} (when compiling) and @option{-lgcov} (when
5934 linking). See the documentation for those options for more details.
5935
5936 @itemize
5937
5938 @item
5939 Compile the source files with @option{-fprofile-arcs} plus optimization
5940 and code generation options. For test coverage analysis, use the
5941 additional @option{-ftest-coverage} option. You do not need to profile
5942 every source file in a program.
5943
5944 @item
5945 Link your object files with @option{-lgcov} or @option{-fprofile-arcs}
5946 (the latter implies the former).
5947
5948 @item
5949 Run the program on a representative workload to generate the arc profile
5950 information. This may be repeated any number of times. You can run
5951 concurrent instances of your program, and provided that the file system
5952 supports locking, the data files will be correctly updated. Also
5953 @code{fork} calls are detected and correctly handled (double counting
5954 will not happen).
5955
5956 @item
5957 For profile-directed optimizations, compile the source files again with
5958 the same optimization and code generation options plus
5959 @option{-fbranch-probabilities} (@pxref{Optimize Options,,Options that
5960 Control Optimization}).
5961
5962 @item
5963 For test coverage analysis, use @command{gcov} to produce human readable
5964 information from the @file{.gcno} and @file{.gcda} files. Refer to the
5965 @command{gcov} documentation for further information.
5966
5967 @end itemize
5968
5969 With @option{-fprofile-arcs}, for each function of your program GCC
5970 creates a program flow graph, then finds a spanning tree for the graph.
5971 Only arcs that are not on the spanning tree have to be instrumented: the
5972 compiler adds code to count the number of times that these arcs are
5973 executed. When an arc is the only exit or only entrance to a block, the
5974 instrumentation code can be added to the block; otherwise, a new basic
5975 block must be created to hold the instrumentation code.
5976
5977 @need 2000
5978 @item -ftest-coverage
5979 @opindex ftest-coverage
5980 Produce a notes file that the @command{gcov} code-coverage utility
5981 (@pxref{Gcov,, @command{gcov}---a Test Coverage Program}) can use to
5982 show program coverage. Each source file's note file is called
5983 @file{@var{auxname}.gcno}. Refer to the @option{-fprofile-arcs} option
5984 above for a description of @var{auxname} and instructions on how to
5985 generate test coverage data. Coverage data matches the source files
5986 more closely if you do not optimize.
5987
5988 @item -fdbg-cnt-list
5989 @opindex fdbg-cnt-list
5990 Print the name and the counter upper bound for all debug counters.
5991
5992
5993 @item -fdbg-cnt=@var{counter-value-list}
5994 @opindex fdbg-cnt
5995 Set the internal debug counter upper bound. @var{counter-value-list}
5996 is a comma-separated list of @var{name}:@var{value} pairs
5997 which sets the upper bound of each debug counter @var{name} to @var{value}.
5998 All debug counters have the initial upper bound of @code{UINT_MAX};
5999 thus @code{dbg_cnt()} returns true always unless the upper bound
6000 is set by this option.
6001 For example, with @option{-fdbg-cnt=dce:10,tail_call:0},
6002 @code{dbg_cnt(dce)} returns true only for first 10 invocations.
6003
6004 @item -fenable-@var{kind}-@var{pass}
6005 @itemx -fdisable-@var{kind}-@var{pass}=@var{range-list}
6006 @opindex fdisable-
6007 @opindex fenable-
6008
6009 This is a set of options that are used to explicitly disable/enable
6010 optimization passes. These options are intended for use for debugging GCC.
6011 Compiler users should use regular options for enabling/disabling
6012 passes instead.
6013
6014 @table @gcctabopt
6015
6016 @item -fdisable-ipa-@var{pass}
6017 Disable IPA pass @var{pass}. @var{pass} is the pass name. If the same pass is
6018 statically invoked in the compiler multiple times, the pass name should be
6019 appended with a sequential number starting from 1.
6020
6021 @item -fdisable-rtl-@var{pass}
6022 @itemx -fdisable-rtl-@var{pass}=@var{range-list}
6023 Disable RTL pass @var{pass}. @var{pass} is the pass name. If the same pass is
6024 statically invoked in the compiler multiple times, the pass name should be
6025 appended with a sequential number starting from 1. @var{range-list} is a
6026 comma-separated list of function ranges or assembler names. Each range is a number
6027 pair separated by a colon. The range is inclusive in both ends. If the range
6028 is trivial, the number pair can be simplified as a single number. If the
6029 function's call graph node's @var{uid} falls within one of the specified ranges,
6030 the @var{pass} is disabled for that function. The @var{uid} is shown in the
6031 function header of a dump file, and the pass names can be dumped by using
6032 option @option{-fdump-passes}.
6033
6034 @item -fdisable-tree-@var{pass}
6035 @itemx -fdisable-tree-@var{pass}=@var{range-list}
6036 Disable tree pass @var{pass}. See @option{-fdisable-rtl} for the description of
6037 option arguments.
6038
6039 @item -fenable-ipa-@var{pass}
6040 Enable IPA pass @var{pass}. @var{pass} is the pass name. If the same pass is
6041 statically invoked in the compiler multiple times, the pass name should be
6042 appended with a sequential number starting from 1.
6043
6044 @item -fenable-rtl-@var{pass}
6045 @itemx -fenable-rtl-@var{pass}=@var{range-list}
6046 Enable RTL pass @var{pass}. See @option{-fdisable-rtl} for option argument
6047 description and examples.
6048
6049 @item -fenable-tree-@var{pass}
6050 @itemx -fenable-tree-@var{pass}=@var{range-list}
6051 Enable tree pass @var{pass}. See @option{-fdisable-rtl} for the description
6052 of option arguments.
6053
6054 @end table
6055
6056 Here are some examples showing uses of these options.
6057
6058 @smallexample
6059
6060 # disable ccp1 for all functions
6061 -fdisable-tree-ccp1
6062 # disable complete unroll for function whose cgraph node uid is 1
6063 -fenable-tree-cunroll=1
6064 # disable gcse2 for functions at the following ranges [1,1],
6065 # [300,400], and [400,1000]
6066 # disable gcse2 for functions foo and foo2
6067 -fdisable-rtl-gcse2=foo,foo2
6068 # disable early inlining
6069 -fdisable-tree-einline
6070 # disable ipa inlining
6071 -fdisable-ipa-inline
6072 # enable tree full unroll
6073 -fenable-tree-unroll
6074
6075 @end smallexample
6076
6077 @item -d@var{letters}
6078 @itemx -fdump-rtl-@var{pass}
6079 @itemx -fdump-rtl-@var{pass}=@var{filename}
6080 @opindex d
6081 @opindex fdump-rtl-@var{pass}
6082 Says to make debugging dumps during compilation at times specified by
6083 @var{letters}. This is used for debugging the RTL-based passes of the
6084 compiler. The file names for most of the dumps are made by appending
6085 a pass number and a word to the @var{dumpname}, and the files are
6086 created in the directory of the output file. In case of
6087 @option{=@var{filename}} option, the dump is output on the given file
6088 instead of the pass numbered dump files. Note that the pass number is
6089 computed statically as passes get registered into the pass manager.
6090 Thus the numbering is not related to the dynamic order of execution of
6091 passes. In particular, a pass installed by a plugin could have a
6092 number over 200 even if it executed quite early. @var{dumpname} is
6093 generated from the name of the output file, if explicitly specified
6094 and it is not an executable, otherwise it is the basename of the
6095 source file. These switches may have different effects when
6096 @option{-E} is used for preprocessing.
6097
6098 Debug dumps can be enabled with a @option{-fdump-rtl} switch or some
6099 @option{-d} option @var{letters}. Here are the possible
6100 letters for use in @var{pass} and @var{letters}, and their meanings:
6101
6102 @table @gcctabopt
6103
6104 @item -fdump-rtl-alignments
6105 @opindex fdump-rtl-alignments
6106 Dump after branch alignments have been computed.
6107
6108 @item -fdump-rtl-asmcons
6109 @opindex fdump-rtl-asmcons
6110 Dump after fixing rtl statements that have unsatisfied in/out constraints.
6111
6112 @item -fdump-rtl-auto_inc_dec
6113 @opindex fdump-rtl-auto_inc_dec
6114 Dump after auto-inc-dec discovery. This pass is only run on
6115 architectures that have auto inc or auto dec instructions.
6116
6117 @item -fdump-rtl-barriers
6118 @opindex fdump-rtl-barriers
6119 Dump after cleaning up the barrier instructions.
6120
6121 @item -fdump-rtl-bbpart
6122 @opindex fdump-rtl-bbpart
6123 Dump after partitioning hot and cold basic blocks.
6124
6125 @item -fdump-rtl-bbro
6126 @opindex fdump-rtl-bbro
6127 Dump after block reordering.
6128
6129 @item -fdump-rtl-btl1
6130 @itemx -fdump-rtl-btl2
6131 @opindex fdump-rtl-btl2
6132 @opindex fdump-rtl-btl2
6133 @option{-fdump-rtl-btl1} and @option{-fdump-rtl-btl2} enable dumping
6134 after the two branch
6135 target load optimization passes.
6136
6137 @item -fdump-rtl-bypass
6138 @opindex fdump-rtl-bypass
6139 Dump after jump bypassing and control flow optimizations.
6140
6141 @item -fdump-rtl-combine
6142 @opindex fdump-rtl-combine
6143 Dump after the RTL instruction combination pass.
6144
6145 @item -fdump-rtl-compgotos
6146 @opindex fdump-rtl-compgotos
6147 Dump after duplicating the computed gotos.
6148
6149 @item -fdump-rtl-ce1
6150 @itemx -fdump-rtl-ce2
6151 @itemx -fdump-rtl-ce3
6152 @opindex fdump-rtl-ce1
6153 @opindex fdump-rtl-ce2
6154 @opindex fdump-rtl-ce3
6155 @option{-fdump-rtl-ce1}, @option{-fdump-rtl-ce2}, and
6156 @option{-fdump-rtl-ce3} enable dumping after the three
6157 if conversion passes.
6158
6159 @item -fdump-rtl-cprop_hardreg
6160 @opindex fdump-rtl-cprop_hardreg
6161 Dump after hard register copy propagation.
6162
6163 @item -fdump-rtl-csa
6164 @opindex fdump-rtl-csa
6165 Dump after combining stack adjustments.
6166
6167 @item -fdump-rtl-cse1
6168 @itemx -fdump-rtl-cse2
6169 @opindex fdump-rtl-cse1
6170 @opindex fdump-rtl-cse2
6171 @option{-fdump-rtl-cse1} and @option{-fdump-rtl-cse2} enable dumping after
6172 the two common subexpression elimination passes.
6173
6174 @item -fdump-rtl-dce
6175 @opindex fdump-rtl-dce
6176 Dump after the standalone dead code elimination passes.
6177
6178 @item -fdump-rtl-dbr
6179 @opindex fdump-rtl-dbr
6180 Dump after delayed branch scheduling.
6181
6182 @item -fdump-rtl-dce1
6183 @itemx -fdump-rtl-dce2
6184 @opindex fdump-rtl-dce1
6185 @opindex fdump-rtl-dce2
6186 @option{-fdump-rtl-dce1} and @option{-fdump-rtl-dce2} enable dumping after
6187 the two dead store elimination passes.
6188
6189 @item -fdump-rtl-eh
6190 @opindex fdump-rtl-eh
6191 Dump after finalization of EH handling code.
6192
6193 @item -fdump-rtl-eh_ranges
6194 @opindex fdump-rtl-eh_ranges
6195 Dump after conversion of EH handling range regions.
6196
6197 @item -fdump-rtl-expand
6198 @opindex fdump-rtl-expand
6199 Dump after RTL generation.
6200
6201 @item -fdump-rtl-fwprop1
6202 @itemx -fdump-rtl-fwprop2
6203 @opindex fdump-rtl-fwprop1
6204 @opindex fdump-rtl-fwprop2
6205 @option{-fdump-rtl-fwprop1} and @option{-fdump-rtl-fwprop2} enable
6206 dumping after the two forward propagation passes.
6207
6208 @item -fdump-rtl-gcse1
6209 @itemx -fdump-rtl-gcse2
6210 @opindex fdump-rtl-gcse1
6211 @opindex fdump-rtl-gcse2
6212 @option{-fdump-rtl-gcse1} and @option{-fdump-rtl-gcse2} enable dumping
6213 after global common subexpression elimination.
6214
6215 @item -fdump-rtl-init-regs
6216 @opindex fdump-rtl-init-regs
6217 Dump after the initialization of the registers.
6218
6219 @item -fdump-rtl-initvals
6220 @opindex fdump-rtl-initvals
6221 Dump after the computation of the initial value sets.
6222
6223 @item -fdump-rtl-into_cfglayout
6224 @opindex fdump-rtl-into_cfglayout
6225 Dump after converting to cfglayout mode.
6226
6227 @item -fdump-rtl-ira
6228 @opindex fdump-rtl-ira
6229 Dump after iterated register allocation.
6230
6231 @item -fdump-rtl-jump
6232 @opindex fdump-rtl-jump
6233 Dump after the second jump optimization.
6234
6235 @item -fdump-rtl-loop2
6236 @opindex fdump-rtl-loop2
6237 @option{-fdump-rtl-loop2} enables dumping after the rtl
6238 loop optimization passes.
6239
6240 @item -fdump-rtl-mach
6241 @opindex fdump-rtl-mach
6242 Dump after performing the machine dependent reorganization pass, if that
6243 pass exists.
6244
6245 @item -fdump-rtl-mode_sw
6246 @opindex fdump-rtl-mode_sw
6247 Dump after removing redundant mode switches.
6248
6249 @item -fdump-rtl-rnreg
6250 @opindex fdump-rtl-rnreg
6251 Dump after register renumbering.
6252
6253 @item -fdump-rtl-outof_cfglayout
6254 @opindex fdump-rtl-outof_cfglayout
6255 Dump after converting from cfglayout mode.
6256
6257 @item -fdump-rtl-peephole2
6258 @opindex fdump-rtl-peephole2
6259 Dump after the peephole pass.
6260
6261 @item -fdump-rtl-postreload
6262 @opindex fdump-rtl-postreload
6263 Dump after post-reload optimizations.
6264
6265 @item -fdump-rtl-pro_and_epilogue
6266 @opindex fdump-rtl-pro_and_epilogue
6267 Dump after generating the function prologues and epilogues.
6268
6269 @item -fdump-rtl-sched1
6270 @itemx -fdump-rtl-sched2
6271 @opindex fdump-rtl-sched1
6272 @opindex fdump-rtl-sched2
6273 @option{-fdump-rtl-sched1} and @option{-fdump-rtl-sched2} enable dumping
6274 after the basic block scheduling passes.
6275
6276 @item -fdump-rtl-ree
6277 @opindex fdump-rtl-ree
6278 Dump after sign/zero extension elimination.
6279
6280 @item -fdump-rtl-seqabstr
6281 @opindex fdump-rtl-seqabstr
6282 Dump after common sequence discovery.
6283
6284 @item -fdump-rtl-shorten
6285 @opindex fdump-rtl-shorten
6286 Dump after shortening branches.
6287
6288 @item -fdump-rtl-sibling
6289 @opindex fdump-rtl-sibling
6290 Dump after sibling call optimizations.
6291
6292 @item -fdump-rtl-split1
6293 @itemx -fdump-rtl-split2
6294 @itemx -fdump-rtl-split3
6295 @itemx -fdump-rtl-split4
6296 @itemx -fdump-rtl-split5
6297 @opindex fdump-rtl-split1
6298 @opindex fdump-rtl-split2
6299 @opindex fdump-rtl-split3
6300 @opindex fdump-rtl-split4
6301 @opindex fdump-rtl-split5
6302 @option{-fdump-rtl-split1}, @option{-fdump-rtl-split2},
6303 @option{-fdump-rtl-split3}, @option{-fdump-rtl-split4} and
6304 @option{-fdump-rtl-split5} enable dumping after five rounds of
6305 instruction splitting.
6306
6307 @item -fdump-rtl-sms
6308 @opindex fdump-rtl-sms
6309 Dump after modulo scheduling. This pass is only run on some
6310 architectures.
6311
6312 @item -fdump-rtl-stack
6313 @opindex fdump-rtl-stack
6314 Dump after conversion from GCC's ``flat register file'' registers to the
6315 x87's stack-like registers. This pass is only run on x86 variants.
6316
6317 @item -fdump-rtl-subreg1
6318 @itemx -fdump-rtl-subreg2
6319 @opindex fdump-rtl-subreg1
6320 @opindex fdump-rtl-subreg2
6321 @option{-fdump-rtl-subreg1} and @option{-fdump-rtl-subreg2} enable dumping after
6322 the two subreg expansion passes.
6323
6324 @item -fdump-rtl-unshare
6325 @opindex fdump-rtl-unshare
6326 Dump after all rtl has been unshared.
6327
6328 @item -fdump-rtl-vartrack
6329 @opindex fdump-rtl-vartrack
6330 Dump after variable tracking.
6331
6332 @item -fdump-rtl-vregs
6333 @opindex fdump-rtl-vregs
6334 Dump after converting virtual registers to hard registers.
6335
6336 @item -fdump-rtl-web
6337 @opindex fdump-rtl-web
6338 Dump after live range splitting.
6339
6340 @item -fdump-rtl-regclass
6341 @itemx -fdump-rtl-subregs_of_mode_init
6342 @itemx -fdump-rtl-subregs_of_mode_finish
6343 @itemx -fdump-rtl-dfinit
6344 @itemx -fdump-rtl-dfinish
6345 @opindex fdump-rtl-regclass
6346 @opindex fdump-rtl-subregs_of_mode_init
6347 @opindex fdump-rtl-subregs_of_mode_finish
6348 @opindex fdump-rtl-dfinit
6349 @opindex fdump-rtl-dfinish
6350 These dumps are defined but always produce empty files.
6351
6352 @item -da
6353 @itemx -fdump-rtl-all
6354 @opindex da
6355 @opindex fdump-rtl-all
6356 Produce all the dumps listed above.
6357
6358 @item -dA
6359 @opindex dA
6360 Annotate the assembler output with miscellaneous debugging information.
6361
6362 @item -dD
6363 @opindex dD
6364 Dump all macro definitions, at the end of preprocessing, in addition to
6365 normal output.
6366
6367 @item -dH
6368 @opindex dH
6369 Produce a core dump whenever an error occurs.
6370
6371 @item -dp
6372 @opindex dp
6373 Annotate the assembler output with a comment indicating which
6374 pattern and alternative is used. The length of each instruction is
6375 also printed.
6376
6377 @item -dP
6378 @opindex dP
6379 Dump the RTL in the assembler output as a comment before each instruction.
6380 Also turns on @option{-dp} annotation.
6381
6382 @item -dx
6383 @opindex dx
6384 Just generate RTL for a function instead of compiling it. Usually used
6385 with @option{-fdump-rtl-expand}.
6386 @end table
6387
6388 @item -fdump-noaddr
6389 @opindex fdump-noaddr
6390 When doing debugging dumps, suppress address output. This makes it more
6391 feasible to use diff on debugging dumps for compiler invocations with
6392 different compiler binaries and/or different
6393 text / bss / data / heap / stack / dso start locations.
6394
6395 @item -freport-bug
6396 @opindex freport-bug
6397 Collect and dump debug information into temporary file if ICE in C/C++
6398 compiler occured.
6399
6400 @item -fdump-unnumbered
6401 @opindex fdump-unnumbered
6402 When doing debugging dumps, suppress instruction numbers and address output.
6403 This makes it more feasible to use diff on debugging dumps for compiler
6404 invocations with different options, in particular with and without
6405 @option{-g}.
6406
6407 @item -fdump-unnumbered-links
6408 @opindex fdump-unnumbered-links
6409 When doing debugging dumps (see @option{-d} option above), suppress
6410 instruction numbers for the links to the previous and next instructions
6411 in a sequence.
6412
6413 @item -fdump-translation-unit @r{(C++ only)}
6414 @itemx -fdump-translation-unit-@var{options} @r{(C++ only)}
6415 @opindex fdump-translation-unit
6416 Dump a representation of the tree structure for the entire translation
6417 unit to a file. The file name is made by appending @file{.tu} to the
6418 source file name, and the file is created in the same directory as the
6419 output file. If the @samp{-@var{options}} form is used, @var{options}
6420 controls the details of the dump as described for the
6421 @option{-fdump-tree} options.
6422
6423 @item -fdump-class-hierarchy @r{(C++ only)}
6424 @itemx -fdump-class-hierarchy-@var{options} @r{(C++ only)}
6425 @opindex fdump-class-hierarchy
6426 Dump a representation of each class's hierarchy and virtual function
6427 table layout to a file. The file name is made by appending
6428 @file{.class} to the source file name, and the file is created in the
6429 same directory as the output file. If the @samp{-@var{options}} form
6430 is used, @var{options} controls the details of the dump as described
6431 for the @option{-fdump-tree} options.
6432
6433 @item -fdump-ipa-@var{switch}
6434 @opindex fdump-ipa
6435 Control the dumping at various stages of inter-procedural analysis
6436 language tree to a file. The file name is generated by appending a
6437 switch specific suffix to the source file name, and the file is created
6438 in the same directory as the output file. The following dumps are
6439 possible:
6440
6441 @table @samp
6442 @item all
6443 Enables all inter-procedural analysis dumps.
6444
6445 @item cgraph
6446 Dumps information about call-graph optimization, unused function removal,
6447 and inlining decisions.
6448
6449 @item inline
6450 Dump after function inlining.
6451
6452 @end table
6453
6454 @item -fdump-passes
6455 @opindex fdump-passes
6456 Dump the list of optimization passes that are turned on and off by
6457 the current command-line options.
6458
6459 @item -fdump-statistics-@var{option}
6460 @opindex fdump-statistics
6461 Enable and control dumping of pass statistics in a separate file. The
6462 file name is generated by appending a suffix ending in
6463 @samp{.statistics} to the source file name, and the file is created in
6464 the same directory as the output file. If the @samp{-@var{option}}
6465 form is used, @samp{-stats} causes counters to be summed over the
6466 whole compilation unit while @samp{-details} dumps every event as
6467 the passes generate them. The default with no option is to sum
6468 counters for each function compiled.
6469
6470 @item -fdump-tree-@var{switch}
6471 @itemx -fdump-tree-@var{switch}-@var{options}
6472 @itemx -fdump-tree-@var{switch}-@var{options}=@var{filename}
6473 @opindex fdump-tree
6474 Control the dumping at various stages of processing the intermediate
6475 language tree to a file. The file name is generated by appending a
6476 switch-specific suffix to the source file name, and the file is
6477 created in the same directory as the output file. In case of
6478 @option{=@var{filename}} option, the dump is output on the given file
6479 instead of the auto named dump files. If the @samp{-@var{options}}
6480 form is used, @var{options} is a list of @samp{-} separated options
6481 which control the details of the dump. Not all options are applicable
6482 to all dumps; those that are not meaningful are ignored. The
6483 following options are available
6484
6485 @table @samp
6486 @item address
6487 Print the address of each node. Usually this is not meaningful as it
6488 changes according to the environment and source file. Its primary use
6489 is for tying up a dump file with a debug environment.
6490 @item asmname
6491 If @code{DECL_ASSEMBLER_NAME} has been set for a given decl, use that
6492 in the dump instead of @code{DECL_NAME}. Its primary use is ease of
6493 use working backward from mangled names in the assembly file.
6494 @item slim
6495 When dumping front-end intermediate representations, inhibit dumping
6496 of members of a scope or body of a function merely because that scope
6497 has been reached. Only dump such items when they are directly reachable
6498 by some other path.
6499
6500 When dumping pretty-printed trees, this option inhibits dumping the
6501 bodies of control structures.
6502
6503 When dumping RTL, print the RTL in slim (condensed) form instead of
6504 the default LISP-like representation.
6505 @item raw
6506 Print a raw representation of the tree. By default, trees are
6507 pretty-printed into a C-like representation.
6508 @item details
6509 Enable more detailed dumps (not honored by every dump option). Also
6510 include information from the optimization passes.
6511 @item stats
6512 Enable dumping various statistics about the pass (not honored by every dump
6513 option).
6514 @item blocks
6515 Enable showing basic block boundaries (disabled in raw dumps).
6516 @item graph
6517 For each of the other indicated dump files (@option{-fdump-rtl-@var{pass}}),
6518 dump a representation of the control flow graph suitable for viewing with
6519 GraphViz to @file{@var{file}.@var{passid}.@var{pass}.dot}. Each function in
6520 the file is pretty-printed as a subgraph, so that GraphViz can render them
6521 all in a single plot.
6522
6523 This option currently only works for RTL dumps, and the RTL is always
6524 dumped in slim form.
6525 @item vops
6526 Enable showing virtual operands for every statement.
6527 @item lineno
6528 Enable showing line numbers for statements.
6529 @item uid
6530 Enable showing the unique ID (@code{DECL_UID}) for each variable.
6531 @item verbose
6532 Enable showing the tree dump for each statement.
6533 @item eh
6534 Enable showing the EH region number holding each statement.
6535 @item scev
6536 Enable showing scalar evolution analysis details.
6537 @item optimized
6538 Enable showing optimization information (only available in certain
6539 passes).
6540 @item missed
6541 Enable showing missed optimization information (only available in certain
6542 passes).
6543 @item note
6544 Enable other detailed optimization information (only available in
6545 certain passes).
6546 @item =@var{filename}
6547 Instead of an auto named dump file, output into the given file
6548 name. The file names @file{stdout} and @file{stderr} are treated
6549 specially and are considered already open standard streams. For
6550 example,
6551
6552 @smallexample
6553 gcc -O2 -ftree-vectorize -fdump-tree-vect-blocks=foo.dump
6554 -fdump-tree-pre=stderr file.c
6555 @end smallexample
6556
6557 outputs vectorizer dump into @file{foo.dump}, while the PRE dump is
6558 output on to @file{stderr}. If two conflicting dump filenames are
6559 given for the same pass, then the latter option overrides the earlier
6560 one.
6561
6562 @item all
6563 Turn on all options, except @option{raw}, @option{slim}, @option{verbose}
6564 and @option{lineno}.
6565
6566 @item optall
6567 Turn on all optimization options, i.e., @option{optimized},
6568 @option{missed}, and @option{note}.
6569 @end table
6570
6571 The following tree dumps are possible:
6572 @table @samp
6573
6574 @item original
6575 @opindex fdump-tree-original
6576 Dump before any tree based optimization, to @file{@var{file}.original}.
6577
6578 @item optimized
6579 @opindex fdump-tree-optimized
6580 Dump after all tree based optimization, to @file{@var{file}.optimized}.
6581
6582 @item gimple
6583 @opindex fdump-tree-gimple
6584 Dump each function before and after the gimplification pass to a file. The
6585 file name is made by appending @file{.gimple} to the source file name.
6586
6587 @item cfg
6588 @opindex fdump-tree-cfg
6589 Dump the control flow graph of each function to a file. The file name is
6590 made by appending @file{.cfg} to the source file name.
6591
6592 @item ch
6593 @opindex fdump-tree-ch
6594 Dump each function after copying loop headers. The file name is made by
6595 appending @file{.ch} to the source file name.
6596
6597 @item ssa
6598 @opindex fdump-tree-ssa
6599 Dump SSA related information to a file. The file name is made by appending
6600 @file{.ssa} to the source file name.
6601
6602 @item alias
6603 @opindex fdump-tree-alias
6604 Dump aliasing information for each function. The file name is made by
6605 appending @file{.alias} to the source file name.
6606
6607 @item ccp
6608 @opindex fdump-tree-ccp
6609 Dump each function after CCP@. The file name is made by appending
6610 @file{.ccp} to the source file name.
6611
6612 @item storeccp
6613 @opindex fdump-tree-storeccp
6614 Dump each function after STORE-CCP@. The file name is made by appending
6615 @file{.storeccp} to the source file name.
6616
6617 @item pre
6618 @opindex fdump-tree-pre
6619 Dump trees after partial redundancy elimination. The file name is made
6620 by appending @file{.pre} to the source file name.
6621
6622 @item fre
6623 @opindex fdump-tree-fre
6624 Dump trees after full redundancy elimination. The file name is made
6625 by appending @file{.fre} to the source file name.
6626
6627 @item copyprop
6628 @opindex fdump-tree-copyprop
6629 Dump trees after copy propagation. The file name is made
6630 by appending @file{.copyprop} to the source file name.
6631
6632 @item store_copyprop
6633 @opindex fdump-tree-store_copyprop
6634 Dump trees after store copy-propagation. The file name is made
6635 by appending @file{.store_copyprop} to the source file name.
6636
6637 @item dce
6638 @opindex fdump-tree-dce
6639 Dump each function after dead code elimination. The file name is made by
6640 appending @file{.dce} to the source file name.
6641
6642 @item sra
6643 @opindex fdump-tree-sra
6644 Dump each function after performing scalar replacement of aggregates. The
6645 file name is made by appending @file{.sra} to the source file name.
6646
6647 @item sink
6648 @opindex fdump-tree-sink
6649 Dump each function after performing code sinking. The file name is made
6650 by appending @file{.sink} to the source file name.
6651
6652 @item dom
6653 @opindex fdump-tree-dom
6654 Dump each function after applying dominator tree optimizations. The file
6655 name is made by appending @file{.dom} to the source file name.
6656
6657 @item dse
6658 @opindex fdump-tree-dse
6659 Dump each function after applying dead store elimination. The file
6660 name is made by appending @file{.dse} to the source file name.
6661
6662 @item phiopt
6663 @opindex fdump-tree-phiopt
6664 Dump each function after optimizing PHI nodes into straightline code. The file
6665 name is made by appending @file{.phiopt} to the source file name.
6666
6667 @item forwprop
6668 @opindex fdump-tree-forwprop
6669 Dump each function after forward propagating single use variables. The file
6670 name is made by appending @file{.forwprop} to the source file name.
6671
6672 @item copyrename
6673 @opindex fdump-tree-copyrename
6674 Dump each function after applying the copy rename optimization. The file
6675 name is made by appending @file{.copyrename} to the source file name.
6676
6677 @item nrv
6678 @opindex fdump-tree-nrv
6679 Dump each function after applying the named return value optimization on
6680 generic trees. The file name is made by appending @file{.nrv} to the source
6681 file name.
6682
6683 @item vect
6684 @opindex fdump-tree-vect
6685 Dump each function after applying vectorization of loops. The file name is
6686 made by appending @file{.vect} to the source file name.
6687
6688 @item slp
6689 @opindex fdump-tree-slp
6690 Dump each function after applying vectorization of basic blocks. The file name
6691 is made by appending @file{.slp} to the source file name.
6692
6693 @item vrp
6694 @opindex fdump-tree-vrp
6695 Dump each function after Value Range Propagation (VRP). The file name
6696 is made by appending @file{.vrp} to the source file name.
6697
6698 @item all
6699 @opindex fdump-tree-all
6700 Enable all the available tree dumps with the flags provided in this option.
6701 @end table
6702
6703 @item -fopt-info
6704 @itemx -fopt-info-@var{options}
6705 @itemx -fopt-info-@var{options}=@var{filename}
6706 @opindex fopt-info
6707 Controls optimization dumps from various optimization passes. If the
6708 @samp{-@var{options}} form is used, @var{options} is a list of
6709 @samp{-} separated options to select the dump details and
6710 optimizations. If @var{options} is not specified, it defaults to
6711 @option{optimized} for details and @option{optall} for optimization
6712 groups. If the @var{filename} is not specified, it defaults to
6713 @file{stderr}. Note that the output @var{filename} will be overwritten
6714 in case of multiple translation units. If a combined output from
6715 multiple translation units is desired, @file{stderr} should be used
6716 instead.
6717
6718 The options can be divided into two groups, 1) options describing the
6719 verbosity of the dump, and 2) options describing which optimizations
6720 should be included. The options from both the groups can be freely
6721 mixed as they are non-overlapping. However, in case of any conflicts,
6722 the latter options override the earlier options on the command
6723 line. Though multiple -fopt-info options are accepted, only one of
6724 them can have @option{=filename}. If other filenames are provided then
6725 all but the first one are ignored.
6726
6727 The dump verbosity has the following options
6728
6729 @table @samp
6730 @item optimized
6731 Print information when an optimization is successfully applied. It is
6732 up to a pass to decide which information is relevant. For example, the
6733 vectorizer passes print the source location of loops which got
6734 successfully vectorized.
6735 @item missed
6736 Print information about missed optimizations. Individual passes
6737 control which information to include in the output. For example,
6738
6739 @smallexample
6740 gcc -O2 -ftree-vectorize -fopt-info-vec-missed
6741 @end smallexample
6742
6743 will print information about missed optimization opportunities from
6744 vectorization passes on stderr.
6745 @item note
6746 Print verbose information about optimizations, such as certain
6747 transformations, more detailed messages about decisions etc.
6748 @item all
6749 Print detailed optimization information. This includes
6750 @var{optimized}, @var{missed}, and @var{note}.
6751 @end table
6752
6753 The second set of options describes a group of optimizations and may
6754 include one or more of the following.
6755
6756 @table @samp
6757 @item ipa
6758 Enable dumps from all interprocedural optimizations.
6759 @item loop
6760 Enable dumps from all loop optimizations.
6761 @item inline
6762 Enable dumps from all inlining optimizations.
6763 @item vec
6764 Enable dumps from all vectorization optimizations.
6765 @item optall
6766 Enable dumps from all optimizations. This is a superset of
6767 the optimization groups listed above.
6768 @end table
6769
6770 For example,
6771 @smallexample
6772 gcc -O3 -fopt-info-missed=missed.all
6773 @end smallexample
6774
6775 outputs missed optimization report from all the passes into
6776 @file{missed.all}.
6777
6778 As another example,
6779 @smallexample
6780 gcc -O3 -fopt-info-inline-optimized-missed=inline.txt
6781 @end smallexample
6782
6783 will output information about missed optimizations as well as
6784 optimized locations from all the inlining passes into
6785 @file{inline.txt}.
6786
6787 If the @var{filename} is provided, then the dumps from all the
6788 applicable optimizations are concatenated into the @file{filename}.
6789 Otherwise the dump is output onto @file{stderr}. If @var{options} is
6790 omitted, it defaults to @option{all-optall}, which means dump all
6791 available optimization info from all the passes. In the following
6792 example, all optimization info is output on to @file{stderr}.
6793
6794 @smallexample
6795 gcc -O3 -fopt-info
6796 @end smallexample
6797
6798 Note that @option{-fopt-info-vec-missed} behaves the same as
6799 @option{-fopt-info-missed-vec}.
6800
6801 As another example, consider
6802
6803 @smallexample
6804 gcc -fopt-info-vec-missed=vec.miss -fopt-info-loop-optimized=loop.opt
6805 @end smallexample
6806
6807 Here the two output filenames @file{vec.miss} and @file{loop.opt} are
6808 in conflict since only one output file is allowed. In this case, only
6809 the first option takes effect and the subsequent options are
6810 ignored. Thus only the @file{vec.miss} is produced which contains
6811 dumps from the vectorizer about missed opportunities.
6812
6813 @item -frandom-seed=@var{number}
6814 @opindex frandom-seed
6815 This option provides a seed that GCC uses in place of
6816 random numbers in generating certain symbol names
6817 that have to be different in every compiled file. It is also used to
6818 place unique stamps in coverage data files and the object files that
6819 produce them. You can use the @option{-frandom-seed} option to produce
6820 reproducibly identical object files.
6821
6822 The @var{number} should be different for every file you compile.
6823
6824 @item -fsched-verbose=@var{n}
6825 @opindex fsched-verbose
6826 On targets that use instruction scheduling, this option controls the
6827 amount of debugging output the scheduler prints. This information is
6828 written to standard error, unless @option{-fdump-rtl-sched1} or
6829 @option{-fdump-rtl-sched2} is specified, in which case it is output
6830 to the usual dump listing file, @file{.sched1} or @file{.sched2}
6831 respectively. However for @var{n} greater than nine, the output is
6832 always printed to standard error.
6833
6834 For @var{n} greater than zero, @option{-fsched-verbose} outputs the
6835 same information as @option{-fdump-rtl-sched1} and @option{-fdump-rtl-sched2}.
6836 For @var{n} greater than one, it also output basic block probabilities,
6837 detailed ready list information and unit/insn info. For @var{n} greater
6838 than two, it includes RTL at abort point, control-flow and regions info.
6839 And for @var{n} over four, @option{-fsched-verbose} also includes
6840 dependence info.
6841
6842 @item -save-temps
6843 @itemx -save-temps=cwd
6844 @opindex save-temps
6845 Store the usual ``temporary'' intermediate files permanently; place them
6846 in the current directory and name them based on the source file. Thus,
6847 compiling @file{foo.c} with @option{-c -save-temps} produces files
6848 @file{foo.i} and @file{foo.s}, as well as @file{foo.o}. This creates a
6849 preprocessed @file{foo.i} output file even though the compiler now
6850 normally uses an integrated preprocessor.
6851
6852 When used in combination with the @option{-x} command-line option,
6853 @option{-save-temps} is sensible enough to avoid over writing an
6854 input source file with the same extension as an intermediate file.
6855 The corresponding intermediate file may be obtained by renaming the
6856 source file before using @option{-save-temps}.
6857
6858 If you invoke GCC in parallel, compiling several different source
6859 files that share a common base name in different subdirectories or the
6860 same source file compiled for multiple output destinations, it is
6861 likely that the different parallel compilers will interfere with each
6862 other, and overwrite the temporary files. For instance:
6863
6864 @smallexample
6865 gcc -save-temps -o outdir1/foo.o indir1/foo.c&
6866 gcc -save-temps -o outdir2/foo.o indir2/foo.c&
6867 @end smallexample
6868
6869 may result in @file{foo.i} and @file{foo.o} being written to
6870 simultaneously by both compilers.
6871
6872 @item -save-temps=obj
6873 @opindex save-temps=obj
6874 Store the usual ``temporary'' intermediate files permanently. If the
6875 @option{-o} option is used, the temporary files are based on the
6876 object file. If the @option{-o} option is not used, the
6877 @option{-save-temps=obj} switch behaves like @option{-save-temps}.
6878
6879 For example:
6880
6881 @smallexample
6882 gcc -save-temps=obj -c foo.c
6883 gcc -save-temps=obj -c bar.c -o dir/xbar.o
6884 gcc -save-temps=obj foobar.c -o dir2/yfoobar
6885 @end smallexample
6886
6887 @noindent
6888 creates @file{foo.i}, @file{foo.s}, @file{dir/xbar.i},
6889 @file{dir/xbar.s}, @file{dir2/yfoobar.i}, @file{dir2/yfoobar.s}, and
6890 @file{dir2/yfoobar.o}.
6891
6892 @item -time@r{[}=@var{file}@r{]}
6893 @opindex time
6894 Report the CPU time taken by each subprocess in the compilation
6895 sequence. For C source files, this is the compiler proper and assembler
6896 (plus the linker if linking is done).
6897
6898 Without the specification of an output file, the output looks like this:
6899
6900 @smallexample
6901 # cc1 0.12 0.01
6902 # as 0.00 0.01
6903 @end smallexample
6904
6905 The first number on each line is the ``user time'', that is time spent
6906 executing the program itself. The second number is ``system time'',
6907 time spent executing operating system routines on behalf of the program.
6908 Both numbers are in seconds.
6909
6910 With the specification of an output file, the output is appended to the
6911 named file, and it looks like this:
6912
6913 @smallexample
6914 0.12 0.01 cc1 @var{options}
6915 0.00 0.01 as @var{options}
6916 @end smallexample
6917
6918 The ``user time'' and the ``system time'' are moved before the program
6919 name, and the options passed to the program are displayed, so that one
6920 can later tell what file was being compiled, and with which options.
6921
6922 @item -fvar-tracking
6923 @opindex fvar-tracking
6924 Run variable tracking pass. It computes where variables are stored at each
6925 position in code. Better debugging information is then generated
6926 (if the debugging information format supports this information).
6927
6928 It is enabled by default when compiling with optimization (@option{-Os},
6929 @option{-O}, @option{-O2}, @dots{}), debugging information (@option{-g}) and
6930 the debug info format supports it.
6931
6932 @item -fvar-tracking-assignments
6933 @opindex fvar-tracking-assignments
6934 @opindex fno-var-tracking-assignments
6935 Annotate assignments to user variables early in the compilation and
6936 attempt to carry the annotations over throughout the compilation all the
6937 way to the end, in an attempt to improve debug information while
6938 optimizing. Use of @option{-gdwarf-4} is recommended along with it.
6939
6940 It can be enabled even if var-tracking is disabled, in which case
6941 annotations are created and maintained, but discarded at the end.
6942
6943 @item -fvar-tracking-assignments-toggle
6944 @opindex fvar-tracking-assignments-toggle
6945 @opindex fno-var-tracking-assignments-toggle
6946 Toggle @option{-fvar-tracking-assignments}, in the same way that
6947 @option{-gtoggle} toggles @option{-g}.
6948
6949 @item -print-file-name=@var{library}
6950 @opindex print-file-name
6951 Print the full absolute name of the library file @var{library} that
6952 would be used when linking---and don't do anything else. With this
6953 option, GCC does not compile or link anything; it just prints the
6954 file name.
6955
6956 @item -print-multi-directory
6957 @opindex print-multi-directory
6958 Print the directory name corresponding to the multilib selected by any
6959 other switches present in the command line. This directory is supposed
6960 to exist in @env{GCC_EXEC_PREFIX}.
6961
6962 @item -print-multi-lib
6963 @opindex print-multi-lib
6964 Print the mapping from multilib directory names to compiler switches
6965 that enable them. The directory name is separated from the switches by
6966 @samp{;}, and each switch starts with an @samp{@@} instead of the
6967 @samp{-}, without spaces between multiple switches. This is supposed to
6968 ease shell processing.
6969
6970 @item -print-multi-os-directory
6971 @opindex print-multi-os-directory
6972 Print the path to OS libraries for the selected
6973 multilib, relative to some @file{lib} subdirectory. If OS libraries are
6974 present in the @file{lib} subdirectory and no multilibs are used, this is
6975 usually just @file{.}, if OS libraries are present in @file{lib@var{suffix}}
6976 sibling directories this prints e.g.@: @file{../lib64}, @file{../lib} or
6977 @file{../lib32}, or if OS libraries are present in @file{lib/@var{subdir}}
6978 subdirectories it prints e.g.@: @file{amd64}, @file{sparcv9} or @file{ev6}.
6979
6980 @item -print-multiarch
6981 @opindex print-multiarch
6982 Print the path to OS libraries for the selected multiarch,
6983 relative to some @file{lib} subdirectory.
6984
6985 @item -print-prog-name=@var{program}
6986 @opindex print-prog-name
6987 Like @option{-print-file-name}, but searches for a program such as @samp{cpp}.
6988
6989 @item -print-libgcc-file-name
6990 @opindex print-libgcc-file-name
6991 Same as @option{-print-file-name=libgcc.a}.
6992
6993 This is useful when you use @option{-nostdlib} or @option{-nodefaultlibs}
6994 but you do want to link with @file{libgcc.a}. You can do:
6995
6996 @smallexample
6997 gcc -nostdlib @var{files}@dots{} `gcc -print-libgcc-file-name`
6998 @end smallexample
6999
7000 @item -print-search-dirs
7001 @opindex print-search-dirs
7002 Print the name of the configured installation directory and a list of
7003 program and library directories @command{gcc} searches---and don't do anything else.
7004
7005 This is useful when @command{gcc} prints the error message
7006 @samp{installation problem, cannot exec cpp0: No such file or directory}.
7007 To resolve this you either need to put @file{cpp0} and the other compiler
7008 components where @command{gcc} expects to find them, or you can set the environment
7009 variable @env{GCC_EXEC_PREFIX} to the directory where you installed them.
7010 Don't forget the trailing @samp{/}.
7011 @xref{Environment Variables}.
7012
7013 @item -print-sysroot
7014 @opindex print-sysroot
7015 Print the target sysroot directory that is used during
7016 compilation. This is the target sysroot specified either at configure
7017 time or using the @option{--sysroot} option, possibly with an extra
7018 suffix that depends on compilation options. If no target sysroot is
7019 specified, the option prints nothing.
7020
7021 @item -print-sysroot-headers-suffix
7022 @opindex print-sysroot-headers-suffix
7023 Print the suffix added to the target sysroot when searching for
7024 headers, or give an error if the compiler is not configured with such
7025 a suffix---and don't do anything else.
7026
7027 @item -dumpmachine
7028 @opindex dumpmachine
7029 Print the compiler's target machine (for example,
7030 @samp{i686-pc-linux-gnu})---and don't do anything else.
7031
7032 @item -dumpversion
7033 @opindex dumpversion
7034 Print the compiler version (for example, @samp{3.0})---and don't do
7035 anything else.
7036
7037 @item -dumpspecs
7038 @opindex dumpspecs
7039 Print the compiler's built-in specs---and don't do anything else. (This
7040 is used when GCC itself is being built.) @xref{Spec Files}.
7041
7042 @item -fno-eliminate-unused-debug-types
7043 @opindex feliminate-unused-debug-types
7044 @opindex fno-eliminate-unused-debug-types
7045 Normally, when producing DWARF 2 output, GCC avoids producing debug symbol
7046 output for types that are nowhere used in the source file being compiled.
7047 Sometimes it is useful to have GCC emit debugging
7048 information for all types declared in a compilation
7049 unit, regardless of whether or not they are actually used
7050 in that compilation unit, for example
7051 if, in the debugger, you want to cast a value to a type that is
7052 not actually used in your program (but is declared). More often,
7053 however, this results in a significant amount of wasted space.
7054 @end table
7055
7056 @node Optimize Options
7057 @section Options That Control Optimization
7058 @cindex optimize options
7059 @cindex options, optimization
7060
7061 These options control various sorts of optimizations.
7062
7063 Without any optimization option, the compiler's goal is to reduce the
7064 cost of compilation and to make debugging produce the expected
7065 results. Statements are independent: if you stop the program with a
7066 breakpoint between statements, you can then assign a new value to any
7067 variable or change the program counter to any other statement in the
7068 function and get exactly the results you expect from the source
7069 code.
7070
7071 Turning on optimization flags makes the compiler attempt to improve
7072 the performance and/or code size at the expense of compilation time
7073 and possibly the ability to debug the program.
7074
7075 The compiler performs optimization based on the knowledge it has of the
7076 program. Compiling multiple files at once to a single output file mode allows
7077 the compiler to use information gained from all of the files when compiling
7078 each of them.
7079
7080 Not all optimizations are controlled directly by a flag. Only
7081 optimizations that have a flag are listed in this section.
7082
7083 Most optimizations are only enabled if an @option{-O} level is set on
7084 the command line. Otherwise they are disabled, even if individual
7085 optimization flags are specified.
7086
7087 Depending on the target and how GCC was configured, a slightly different
7088 set of optimizations may be enabled at each @option{-O} level than
7089 those listed here. You can invoke GCC with @option{-Q --help=optimizers}
7090 to find out the exact set of optimizations that are enabled at each level.
7091 @xref{Overall Options}, for examples.
7092
7093 @table @gcctabopt
7094 @item -O
7095 @itemx -O1
7096 @opindex O
7097 @opindex O1
7098 Optimize. Optimizing compilation takes somewhat more time, and a lot
7099 more memory for a large function.
7100
7101 With @option{-O}, the compiler tries to reduce code size and execution
7102 time, without performing any optimizations that take a great deal of
7103 compilation time.
7104
7105 @option{-O} turns on the following optimization flags:
7106 @gccoptlist{
7107 -fauto-inc-dec @gol
7108 -fbranch-count-reg @gol
7109 -fcombine-stack-adjustments @gol
7110 -fcompare-elim @gol
7111 -fcprop-registers @gol
7112 -fdce @gol
7113 -fdefer-pop @gol
7114 -fdelayed-branch @gol
7115 -fdse @gol
7116 -fforward-propagate @gol
7117 -fguess-branch-probability @gol
7118 -fif-conversion2 @gol
7119 -fif-conversion @gol
7120 -finline-functions-called-once @gol
7121 -fipa-pure-const @gol
7122 -fipa-profile @gol
7123 -fipa-reference @gol
7124 -fmerge-constants @gol
7125 -fmove-loop-invariants @gol
7126 -fshrink-wrap @gol
7127 -fsplit-wide-types @gol
7128 -ftree-bit-ccp @gol
7129 -ftree-ccp @gol
7130 -fssa-phiopt @gol
7131 -ftree-ch @gol
7132 -ftree-copy-prop @gol
7133 -ftree-copyrename @gol
7134 -ftree-dce @gol
7135 -ftree-dominator-opts @gol
7136 -ftree-dse @gol
7137 -ftree-forwprop @gol
7138 -ftree-fre @gol
7139 -ftree-phiprop @gol
7140 -ftree-sink @gol
7141 -ftree-slsr @gol
7142 -ftree-sra @gol
7143 -ftree-pta @gol
7144 -ftree-ter @gol
7145 -funit-at-a-time}
7146
7147 @option{-O} also turns on @option{-fomit-frame-pointer} on machines
7148 where doing so does not interfere with debugging.
7149
7150 @item -O2
7151 @opindex O2
7152 Optimize even more. GCC performs nearly all supported optimizations
7153 that do not involve a space-speed tradeoff.
7154 As compared to @option{-O}, this option increases both compilation time
7155 and the performance of the generated code.
7156
7157 @option{-O2} turns on all optimization flags specified by @option{-O}. It
7158 also turns on the following optimization flags:
7159 @gccoptlist{-fthread-jumps @gol
7160 -falign-functions -falign-jumps @gol
7161 -falign-loops -falign-labels @gol
7162 -fcaller-saves @gol
7163 -fcrossjumping @gol
7164 -fcse-follow-jumps -fcse-skip-blocks @gol
7165 -fdelete-null-pointer-checks @gol
7166 -fdevirtualize -fdevirtualize-speculatively @gol
7167 -fexpensive-optimizations @gol
7168 -fgcse -fgcse-lm @gol
7169 -fhoist-adjacent-loads @gol
7170 -finline-small-functions @gol
7171 -findirect-inlining @gol
7172 -fipa-cp @gol
7173 -fipa-sra @gol
7174 -fipa-icf @gol
7175 -fisolate-erroneous-paths-dereference @gol
7176 -foptimize-sibling-calls @gol
7177 -foptimize-strlen @gol
7178 -fpartial-inlining @gol
7179 -fpeephole2 @gol
7180 -freorder-blocks -freorder-blocks-and-partition -freorder-functions @gol
7181 -frerun-cse-after-loop @gol
7182 -fsched-interblock -fsched-spec @gol
7183 -fschedule-insns -fschedule-insns2 @gol
7184 -fstrict-aliasing -fstrict-overflow @gol
7185 -ftree-builtin-call-dce @gol
7186 -ftree-switch-conversion -ftree-tail-merge @gol
7187 -ftree-pre @gol
7188 -ftree-vrp @gol
7189 -fuse-caller-save}
7190
7191 Please note the warning under @option{-fgcse} about
7192 invoking @option{-O2} on programs that use computed gotos.
7193
7194 @item -O3
7195 @opindex O3
7196 Optimize yet more. @option{-O3} turns on all optimizations specified
7197 by @option{-O2} and also turns on the @option{-finline-functions},
7198 @option{-funswitch-loops}, @option{-fpredictive-commoning},
7199 @option{-fgcse-after-reload}, @option{-ftree-loop-vectorize},
7200 @option{-ftree-loop-distribute-patterns},
7201 @option{-ftree-slp-vectorize}, @option{-fvect-cost-model},
7202 @option{-ftree-partial-pre} and @option{-fipa-cp-clone} options.
7203
7204 @item -O0
7205 @opindex O0
7206 Reduce compilation time and make debugging produce the expected
7207 results. This is the default.
7208
7209 @item -Os
7210 @opindex Os
7211 Optimize for size. @option{-Os} enables all @option{-O2} optimizations that
7212 do not typically increase code size. It also performs further
7213 optimizations designed to reduce code size.
7214
7215 @option{-Os} disables the following optimization flags:
7216 @gccoptlist{-falign-functions -falign-jumps -falign-loops @gol
7217 -falign-labels -freorder-blocks -freorder-blocks-and-partition @gol
7218 -fprefetch-loop-arrays}
7219
7220 @item -Ofast
7221 @opindex Ofast
7222 Disregard strict standards compliance. @option{-Ofast} enables all
7223 @option{-O3} optimizations. It also enables optimizations that are not
7224 valid for all standard-compliant programs.
7225 It turns on @option{-ffast-math} and the Fortran-specific
7226 @option{-fno-protect-parens} and @option{-fstack-arrays}.
7227
7228 @item -Og
7229 @opindex Og
7230 Optimize debugging experience. @option{-Og} enables optimizations
7231 that do not interfere with debugging. It should be the optimization
7232 level of choice for the standard edit-compile-debug cycle, offering
7233 a reasonable level of optimization while maintaining fast compilation
7234 and a good debugging experience.
7235
7236 If you use multiple @option{-O} options, with or without level numbers,
7237 the last such option is the one that is effective.
7238 @end table
7239
7240 Options of the form @option{-f@var{flag}} specify machine-independent
7241 flags. Most flags have both positive and negative forms; the negative
7242 form of @option{-ffoo} is @option{-fno-foo}. In the table
7243 below, only one of the forms is listed---the one you typically
7244 use. You can figure out the other form by either removing @samp{no-}
7245 or adding it.
7246
7247 The following options control specific optimizations. They are either
7248 activated by @option{-O} options or are related to ones that are. You
7249 can use the following flags in the rare cases when ``fine-tuning'' of
7250 optimizations to be performed is desired.
7251
7252 @table @gcctabopt
7253 @item -fno-defer-pop
7254 @opindex fno-defer-pop
7255 Always pop the arguments to each function call as soon as that function
7256 returns. For machines that must pop arguments after a function call,
7257 the compiler normally lets arguments accumulate on the stack for several
7258 function calls and pops them all at once.
7259
7260 Disabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
7261
7262 @item -fforward-propagate
7263 @opindex fforward-propagate
7264 Perform a forward propagation pass on RTL@. The pass tries to combine two
7265 instructions and checks if the result can be simplified. If loop unrolling
7266 is active, two passes are performed and the second is scheduled after
7267 loop unrolling.
7268
7269 This option is enabled by default at optimization levels @option{-O},
7270 @option{-O2}, @option{-O3}, @option{-Os}.
7271
7272 @item -ffp-contract=@var{style}
7273 @opindex ffp-contract
7274 @option{-ffp-contract=off} disables floating-point expression contraction.
7275 @option{-ffp-contract=fast} enables floating-point expression contraction
7276 such as forming of fused multiply-add operations if the target has
7277 native support for them.
7278 @option{-ffp-contract=on} enables floating-point expression contraction
7279 if allowed by the language standard. This is currently not implemented
7280 and treated equal to @option{-ffp-contract=off}.
7281
7282 The default is @option{-ffp-contract=fast}.
7283
7284 @item -fomit-frame-pointer
7285 @opindex fomit-frame-pointer
7286 Don't keep the frame pointer in a register for functions that
7287 don't need one. This avoids the instructions to save, set up and
7288 restore frame pointers; it also makes an extra register available
7289 in many functions. @strong{It also makes debugging impossible on
7290 some machines.}
7291
7292 On some machines, such as the VAX, this flag has no effect, because
7293 the standard calling sequence automatically handles the frame pointer
7294 and nothing is saved by pretending it doesn't exist. The
7295 machine-description macro @code{FRAME_POINTER_REQUIRED} controls
7296 whether a target machine supports this flag. @xref{Registers,,Register
7297 Usage, gccint, GNU Compiler Collection (GCC) Internals}.
7298
7299 Starting with GCC version 4.6, the default setting (when not optimizing for
7300 size) for 32-bit GNU/Linux x86 and 32-bit Darwin x86 targets has been changed to
7301 @option{-fomit-frame-pointer}. The default can be reverted to
7302 @option{-fno-omit-frame-pointer} by configuring GCC with the
7303 @option{--enable-frame-pointer} configure option.
7304
7305 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
7306
7307 @item -foptimize-sibling-calls
7308 @opindex foptimize-sibling-calls
7309 Optimize sibling and tail recursive calls.
7310
7311 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
7312
7313 @item -foptimize-strlen
7314 @opindex foptimize-strlen
7315 Optimize various standard C string functions (e.g. @code{strlen},
7316 @code{strchr} or @code{strcpy}) and
7317 their @code{_FORTIFY_SOURCE} counterparts into faster alternatives.
7318
7319 Enabled at levels @option{-O2}, @option{-O3}.
7320
7321 @item -fno-inline
7322 @opindex fno-inline
7323 Do not expand any functions inline apart from those marked with
7324 the @code{always_inline} attribute. This is the default when not
7325 optimizing.
7326
7327 Single functions can be exempted from inlining by marking them
7328 with the @code{noinline} attribute.
7329
7330 @item -finline-small-functions
7331 @opindex finline-small-functions
7332 Integrate functions into their callers when their body is smaller than expected
7333 function call code (so overall size of program gets smaller). The compiler
7334 heuristically decides which functions are simple enough to be worth integrating
7335 in this way. This inlining applies to all functions, even those not declared
7336 inline.
7337
7338 Enabled at level @option{-O2}.
7339
7340 @item -findirect-inlining
7341 @opindex findirect-inlining
7342 Inline also indirect calls that are discovered to be known at compile
7343 time thanks to previous inlining. This option has any effect only
7344 when inlining itself is turned on by the @option{-finline-functions}
7345 or @option{-finline-small-functions} options.
7346
7347 Enabled at level @option{-O2}.
7348
7349 @item -finline-functions
7350 @opindex finline-functions
7351 Consider all functions for inlining, even if they are not declared inline.
7352 The compiler heuristically decides which functions are worth integrating
7353 in this way.
7354
7355 If all calls to a given function are integrated, and the function is
7356 declared @code{static}, then the function is normally not output as
7357 assembler code in its own right.
7358
7359 Enabled at level @option{-O3}.
7360
7361 @item -finline-functions-called-once
7362 @opindex finline-functions-called-once
7363 Consider all @code{static} functions called once for inlining into their
7364 caller even if they are not marked @code{inline}. If a call to a given
7365 function is integrated, then the function is not output as assembler code
7366 in its own right.
7367
7368 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3} and @option{-Os}.
7369
7370 @item -fearly-inlining
7371 @opindex fearly-inlining
7372 Inline functions marked by @code{always_inline} and functions whose body seems
7373 smaller than the function call overhead early before doing
7374 @option{-fprofile-generate} instrumentation and real inlining pass. Doing so
7375 makes profiling significantly cheaper and usually inlining faster on programs
7376 having large chains of nested wrapper functions.
7377
7378 Enabled by default.
7379
7380 @item -fipa-sra
7381 @opindex fipa-sra
7382 Perform interprocedural scalar replacement of aggregates, removal of
7383 unused parameters and replacement of parameters passed by reference
7384 by parameters passed by value.
7385
7386 Enabled at levels @option{-O2}, @option{-O3} and @option{-Os}.
7387
7388 @item -finline-limit=@var{n}
7389 @opindex finline-limit
7390 By default, GCC limits the size of functions that can be inlined. This flag
7391 allows coarse control of this limit. @var{n} is the size of functions that
7392 can be inlined in number of pseudo instructions.
7393
7394 Inlining is actually controlled by a number of parameters, which may be
7395 specified individually by using @option{--param @var{name}=@var{value}}.
7396 The @option{-finline-limit=@var{n}} option sets some of these parameters
7397 as follows:
7398
7399 @table @gcctabopt
7400 @item max-inline-insns-single
7401 is set to @var{n}/2.
7402 @item max-inline-insns-auto
7403 is set to @var{n}/2.
7404 @end table
7405
7406 See below for a documentation of the individual
7407 parameters controlling inlining and for the defaults of these parameters.
7408
7409 @emph{Note:} there may be no value to @option{-finline-limit} that results
7410 in default behavior.
7411
7412 @emph{Note:} pseudo instruction represents, in this particular context, an
7413 abstract measurement of function's size. In no way does it represent a count
7414 of assembly instructions and as such its exact meaning might change from one
7415 release to an another.
7416
7417 @item -fno-keep-inline-dllexport
7418 @opindex -fno-keep-inline-dllexport
7419 This is a more fine-grained version of @option{-fkeep-inline-functions},
7420 which applies only to functions that are declared using the @code{dllexport}
7421 attribute or declspec (@xref{Function Attributes,,Declaring Attributes of
7422 Functions}.)
7423
7424 @item -fkeep-inline-functions
7425 @opindex fkeep-inline-functions
7426 In C, emit @code{static} functions that are declared @code{inline}
7427 into the object file, even if the function has been inlined into all
7428 of its callers. This switch does not affect functions using the
7429 @code{extern inline} extension in GNU C90@. In C++, emit any and all
7430 inline functions into the object file.
7431
7432 @item -fkeep-static-consts
7433 @opindex fkeep-static-consts
7434 Emit variables declared @code{static const} when optimization isn't turned
7435 on, even if the variables aren't referenced.
7436
7437 GCC enables this option by default. If you want to force the compiler to
7438 check if a variable is referenced, regardless of whether or not
7439 optimization is turned on, use the @option{-fno-keep-static-consts} option.
7440
7441 @item -fmerge-constants
7442 @opindex fmerge-constants
7443 Attempt to merge identical constants (string constants and floating-point
7444 constants) across compilation units.
7445
7446 This option is the default for optimized compilation if the assembler and
7447 linker support it. Use @option{-fno-merge-constants} to inhibit this
7448 behavior.
7449
7450 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
7451
7452 @item -fmerge-all-constants
7453 @opindex fmerge-all-constants
7454 Attempt to merge identical constants and identical variables.
7455
7456 This option implies @option{-fmerge-constants}. In addition to
7457 @option{-fmerge-constants} this considers e.g.@: even constant initialized
7458 arrays or initialized constant variables with integral or floating-point
7459 types. Languages like C or C++ require each variable, including multiple
7460 instances of the same variable in recursive calls, to have distinct locations,
7461 so using this option results in non-conforming
7462 behavior.
7463
7464 @item -fmodulo-sched
7465 @opindex fmodulo-sched
7466 Perform swing modulo scheduling immediately before the first scheduling
7467 pass. This pass looks at innermost loops and reorders their
7468 instructions by overlapping different iterations.
7469
7470 @item -fmodulo-sched-allow-regmoves
7471 @opindex fmodulo-sched-allow-regmoves
7472 Perform more aggressive SMS-based modulo scheduling with register moves
7473 allowed. By setting this flag certain anti-dependences edges are
7474 deleted, which triggers the generation of reg-moves based on the
7475 life-range analysis. This option is effective only with
7476 @option{-fmodulo-sched} enabled.
7477
7478 @item -fno-branch-count-reg
7479 @opindex fno-branch-count-reg
7480 Do not use ``decrement and branch'' instructions on a count register,
7481 but instead generate a sequence of instructions that decrement a
7482 register, compare it against zero, then branch based upon the result.
7483 This option is only meaningful on architectures that support such
7484 instructions, which include x86, PowerPC, IA-64 and S/390.
7485
7486 Enabled by default at @option{-O1} and higher.
7487
7488 The default is @option{-fbranch-count-reg}.
7489
7490 @item -fno-function-cse
7491 @opindex fno-function-cse
7492 Do not put function addresses in registers; make each instruction that
7493 calls a constant function contain the function's address explicitly.
7494
7495 This option results in less efficient code, but some strange hacks
7496 that alter the assembler output may be confused by the optimizations
7497 performed when this option is not used.
7498
7499 The default is @option{-ffunction-cse}
7500
7501 @item -fno-zero-initialized-in-bss
7502 @opindex fno-zero-initialized-in-bss
7503 If the target supports a BSS section, GCC by default puts variables that
7504 are initialized to zero into BSS@. This can save space in the resulting
7505 code.
7506
7507 This option turns off this behavior because some programs explicitly
7508 rely on variables going to the data section---e.g., so that the
7509 resulting executable can find the beginning of that section and/or make
7510 assumptions based on that.
7511
7512 The default is @option{-fzero-initialized-in-bss}.
7513
7514 @item -fthread-jumps
7515 @opindex fthread-jumps
7516 Perform optimizations that check to see if a jump branches to a
7517 location where another comparison subsumed by the first is found. If
7518 so, the first branch is redirected to either the destination of the
7519 second branch or a point immediately following it, depending on whether
7520 the condition is known to be true or false.
7521
7522 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
7523
7524 @item -fsplit-wide-types
7525 @opindex fsplit-wide-types
7526 When using a type that occupies multiple registers, such as @code{long
7527 long} on a 32-bit system, split the registers apart and allocate them
7528 independently. This normally generates better code for those types,
7529 but may make debugging more difficult.
7530
7531 Enabled at levels @option{-O}, @option{-O2}, @option{-O3},
7532 @option{-Os}.
7533
7534 @item -fcse-follow-jumps
7535 @opindex fcse-follow-jumps
7536 In common subexpression elimination (CSE), scan through jump instructions
7537 when the target of the jump is not reached by any other path. For
7538 example, when CSE encounters an @code{if} statement with an
7539 @code{else} clause, CSE follows the jump when the condition
7540 tested is false.
7541
7542 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
7543
7544 @item -fcse-skip-blocks
7545 @opindex fcse-skip-blocks
7546 This is similar to @option{-fcse-follow-jumps}, but causes CSE to
7547 follow jumps that conditionally skip over blocks. When CSE
7548 encounters a simple @code{if} statement with no else clause,
7549 @option{-fcse-skip-blocks} causes CSE to follow the jump around the
7550 body of the @code{if}.
7551
7552 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
7553
7554 @item -frerun-cse-after-loop
7555 @opindex frerun-cse-after-loop
7556 Re-run common subexpression elimination after loop optimizations are
7557 performed.
7558
7559 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
7560
7561 @item -fgcse
7562 @opindex fgcse
7563 Perform a global common subexpression elimination pass.
7564 This pass also performs global constant and copy propagation.
7565
7566 @emph{Note:} When compiling a program using computed gotos, a GCC
7567 extension, you may get better run-time performance if you disable
7568 the global common subexpression elimination pass by adding
7569 @option{-fno-gcse} to the command line.
7570
7571 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
7572
7573 @item -fgcse-lm
7574 @opindex fgcse-lm
7575 When @option{-fgcse-lm} is enabled, global common subexpression elimination
7576 attempts to move loads that are only killed by stores into themselves. This
7577 allows a loop containing a load/store sequence to be changed to a load outside
7578 the loop, and a copy/store within the loop.
7579
7580 Enabled by default when @option{-fgcse} is enabled.
7581
7582 @item -fgcse-sm
7583 @opindex fgcse-sm
7584 When @option{-fgcse-sm} is enabled, a store motion pass is run after
7585 global common subexpression elimination. This pass attempts to move
7586 stores out of loops. When used in conjunction with @option{-fgcse-lm},
7587 loops containing a load/store sequence can be changed to a load before
7588 the loop and a store after the loop.
7589
7590 Not enabled at any optimization level.
7591
7592 @item -fgcse-las
7593 @opindex fgcse-las
7594 When @option{-fgcse-las} is enabled, the global common subexpression
7595 elimination pass eliminates redundant loads that come after stores to the
7596 same memory location (both partial and full redundancies).
7597
7598 Not enabled at any optimization level.
7599
7600 @item -fgcse-after-reload
7601 @opindex fgcse-after-reload
7602 When @option{-fgcse-after-reload} is enabled, a redundant load elimination
7603 pass is performed after reload. The purpose of this pass is to clean up
7604 redundant spilling.
7605
7606 @item -faggressive-loop-optimizations
7607 @opindex faggressive-loop-optimizations
7608 This option tells the loop optimizer to use language constraints to
7609 derive bounds for the number of iterations of a loop. This assumes that
7610 loop code does not invoke undefined behavior by for example causing signed
7611 integer overflows or out-of-bound array accesses. The bounds for the
7612 number of iterations of a loop are used to guide loop unrolling and peeling
7613 and loop exit test optimizations.
7614 This option is enabled by default.
7615
7616 @item -funsafe-loop-optimizations
7617 @opindex funsafe-loop-optimizations
7618 This option tells the loop optimizer to assume that loop indices do not
7619 overflow, and that loops with nontrivial exit condition are not
7620 infinite. This enables a wider range of loop optimizations even if
7621 the loop optimizer itself cannot prove that these assumptions are valid.
7622 If you use @option{-Wunsafe-loop-optimizations}, the compiler warns you
7623 if it finds this kind of loop.
7624
7625 @item -fcrossjumping
7626 @opindex fcrossjumping
7627 Perform cross-jumping transformation.
7628 This transformation unifies equivalent code and saves code size. The
7629 resulting code may or may not perform better than without cross-jumping.
7630
7631 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
7632
7633 @item -fauto-inc-dec
7634 @opindex fauto-inc-dec
7635 Combine increments or decrements of addresses with memory accesses.
7636 This pass is always skipped on architectures that do not have
7637 instructions to support this. Enabled by default at @option{-O} and
7638 higher on architectures that support this.
7639
7640 @item -fdce
7641 @opindex fdce
7642 Perform dead code elimination (DCE) on RTL@.
7643 Enabled by default at @option{-O} and higher.
7644
7645 @item -fdse
7646 @opindex fdse
7647 Perform dead store elimination (DSE) on RTL@.
7648 Enabled by default at @option{-O} and higher.
7649
7650 @item -fif-conversion
7651 @opindex fif-conversion
7652 Attempt to transform conditional jumps into branch-less equivalents. This
7653 includes use of conditional moves, min, max, set flags and abs instructions, and
7654 some tricks doable by standard arithmetics. The use of conditional execution
7655 on chips where it is available is controlled by @code{if-conversion2}.
7656
7657 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
7658
7659 @item -fif-conversion2
7660 @opindex fif-conversion2
7661 Use conditional execution (where available) to transform conditional jumps into
7662 branch-less equivalents.
7663
7664 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
7665
7666 @item -fdeclone-ctor-dtor
7667 @opindex fdeclone-ctor-dtor
7668 The C++ ABI requires multiple entry points for constructors and
7669 destructors: one for a base subobject, one for a complete object, and
7670 one for a virtual destructor that calls operator delete afterwards.
7671 For a hierarchy with virtual bases, the base and complete variants are
7672 clones, which means two copies of the function. With this option, the
7673 base and complete variants are changed to be thunks that call a common
7674 implementation.
7675
7676 Enabled by @option{-Os}.
7677
7678 @item -fdelete-null-pointer-checks
7679 @opindex fdelete-null-pointer-checks
7680 Assume that programs cannot safely dereference null pointers, and that
7681 no code or data element resides there. This enables simple constant
7682 folding optimizations at all optimization levels. In addition, other
7683 optimization passes in GCC use this flag to control global dataflow
7684 analyses that eliminate useless checks for null pointers; these assume
7685 that if a pointer is checked after it has already been dereferenced,
7686 it cannot be null.
7687
7688 Note however that in some environments this assumption is not true.
7689 Use @option{-fno-delete-null-pointer-checks} to disable this optimization
7690 for programs that depend on that behavior.
7691
7692 Some targets, especially embedded ones, disable this option at all levels.
7693 Otherwise it is enabled at all levels: @option{-O0}, @option{-O1},
7694 @option{-O2}, @option{-O3}, @option{-Os}. Passes that use the information
7695 are enabled independently at different optimization levels.
7696
7697 @item -fdevirtualize
7698 @opindex fdevirtualize
7699 Attempt to convert calls to virtual functions to direct calls. This
7700 is done both within a procedure and interprocedurally as part of
7701 indirect inlining (@code{-findirect-inlining}) and interprocedural constant
7702 propagation (@option{-fipa-cp}).
7703 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
7704
7705 @item -fdevirtualize-speculatively
7706 @opindex fdevirtualize-speculatively
7707 Attempt to convert calls to virtual functions to speculative direct calls.
7708 Based on the analysis of the type inheritance graph, determine for a given call
7709 the set of likely targets. If the set is small, preferably of size 1, change
7710 the call into an conditional deciding on direct and indirect call. The
7711 speculative calls enable more optimizations, such as inlining. When they seem
7712 useless after further optimization, they are converted back into original form.
7713
7714 @item -fexpensive-optimizations
7715 @opindex fexpensive-optimizations
7716 Perform a number of minor optimizations that are relatively expensive.
7717
7718 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
7719
7720 @item -free
7721 @opindex free
7722 Attempt to remove redundant extension instructions. This is especially
7723 helpful for the x86-64 architecture, which implicitly zero-extends in 64-bit
7724 registers after writing to their lower 32-bit half.
7725
7726 Enabled for Alpha, AArch64 and x86 at levels @option{-O2},
7727 @option{-O3}, @option{-Os}.
7728
7729 @item -flive-range-shrinkage
7730 @opindex flive-range-shrinkage
7731 Attempt to decrease register pressure through register live range
7732 shrinkage. This is helpful for fast processors with small or moderate
7733 size register sets.
7734
7735 @item -fira-algorithm=@var{algorithm}
7736 Use the specified coloring algorithm for the integrated register
7737 allocator. The @var{algorithm} argument can be @samp{priority}, which
7738 specifies Chow's priority coloring, or @samp{CB}, which specifies
7739 Chaitin-Briggs coloring. Chaitin-Briggs coloring is not implemented
7740 for all architectures, but for those targets that do support it, it is
7741 the default because it generates better code.
7742
7743 @item -fira-region=@var{region}
7744 Use specified regions for the integrated register allocator. The
7745 @var{region} argument should be one of the following:
7746
7747 @table @samp
7748
7749 @item all
7750 Use all loops as register allocation regions.
7751 This can give the best results for machines with a small and/or
7752 irregular register set.
7753
7754 @item mixed
7755 Use all loops except for loops with small register pressure
7756 as the regions. This value usually gives
7757 the best results in most cases and for most architectures,
7758 and is enabled by default when compiling with optimization for speed
7759 (@option{-O}, @option{-O2}, @dots{}).
7760
7761 @item one
7762 Use all functions as a single region.
7763 This typically results in the smallest code size, and is enabled by default for
7764 @option{-Os} or @option{-O0}.
7765
7766 @end table
7767
7768 @item -fira-hoist-pressure
7769 @opindex fira-hoist-pressure
7770 Use IRA to evaluate register pressure in the code hoisting pass for
7771 decisions to hoist expressions. This option usually results in smaller
7772 code, but it can slow the compiler down.
7773
7774 This option is enabled at level @option{-Os} for all targets.
7775
7776 @item -fira-loop-pressure
7777 @opindex fira-loop-pressure
7778 Use IRA to evaluate register pressure in loops for decisions to move
7779 loop invariants. This option usually results in generation
7780 of faster and smaller code on machines with large register files (>= 32
7781 registers), but it can slow the compiler down.
7782
7783 This option is enabled at level @option{-O3} for some targets.
7784
7785 @item -fno-ira-share-save-slots
7786 @opindex fno-ira-share-save-slots
7787 Disable sharing of stack slots used for saving call-used hard
7788 registers living through a call. Each hard register gets a
7789 separate stack slot, and as a result function stack frames are
7790 larger.
7791
7792 @item -fno-ira-share-spill-slots
7793 @opindex fno-ira-share-spill-slots
7794 Disable sharing of stack slots allocated for pseudo-registers. Each
7795 pseudo-register that does not get a hard register gets a separate
7796 stack slot, and as a result function stack frames are larger.
7797
7798 @item -fira-verbose=@var{n}
7799 @opindex fira-verbose
7800 Control the verbosity of the dump file for the integrated register allocator.
7801 The default value is 5. If the value @var{n} is greater or equal to 10,
7802 the dump output is sent to stderr using the same format as @var{n} minus 10.
7803
7804 @item -fdelayed-branch
7805 @opindex fdelayed-branch
7806 If supported for the target machine, attempt to reorder instructions
7807 to exploit instruction slots available after delayed branch
7808 instructions.
7809
7810 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
7811
7812 @item -fschedule-insns
7813 @opindex fschedule-insns
7814 If supported for the target machine, attempt to reorder instructions to
7815 eliminate execution stalls due to required data being unavailable. This
7816 helps machines that have slow floating point or memory load instructions
7817 by allowing other instructions to be issued until the result of the load
7818 or floating-point instruction is required.
7819
7820 Enabled at levels @option{-O2}, @option{-O3}.
7821
7822 @item -fschedule-insns2
7823 @opindex fschedule-insns2
7824 Similar to @option{-fschedule-insns}, but requests an additional pass of
7825 instruction scheduling after register allocation has been done. This is
7826 especially useful on machines with a relatively small number of
7827 registers and where memory load instructions take more than one cycle.
7828
7829 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
7830
7831 @item -fno-sched-interblock
7832 @opindex fno-sched-interblock
7833 Don't schedule instructions across basic blocks. This is normally
7834 enabled by default when scheduling before register allocation, i.e.@:
7835 with @option{-fschedule-insns} or at @option{-O2} or higher.
7836
7837 @item -fno-sched-spec
7838 @opindex fno-sched-spec
7839 Don't allow speculative motion of non-load instructions. This is normally
7840 enabled by default when scheduling before register allocation, i.e.@:
7841 with @option{-fschedule-insns} or at @option{-O2} or higher.
7842
7843 @item -fsched-pressure
7844 @opindex fsched-pressure
7845 Enable register pressure sensitive insn scheduling before register
7846 allocation. This only makes sense when scheduling before register
7847 allocation is enabled, i.e.@: with @option{-fschedule-insns} or at
7848 @option{-O2} or higher. Usage of this option can improve the
7849 generated code and decrease its size by preventing register pressure
7850 increase above the number of available hard registers and subsequent
7851 spills in register allocation.
7852
7853 @item -fsched-spec-load
7854 @opindex fsched-spec-load
7855 Allow speculative motion of some load instructions. This only makes
7856 sense when scheduling before register allocation, i.e.@: with
7857 @option{-fschedule-insns} or at @option{-O2} or higher.
7858
7859 @item -fsched-spec-load-dangerous
7860 @opindex fsched-spec-load-dangerous
7861 Allow speculative motion of more load instructions. This only makes
7862 sense when scheduling before register allocation, i.e.@: with
7863 @option{-fschedule-insns} or at @option{-O2} or higher.
7864
7865 @item -fsched-stalled-insns
7866 @itemx -fsched-stalled-insns=@var{n}
7867 @opindex fsched-stalled-insns
7868 Define how many insns (if any) can be moved prematurely from the queue
7869 of stalled insns into the ready list during the second scheduling pass.
7870 @option{-fno-sched-stalled-insns} means that no insns are moved
7871 prematurely, @option{-fsched-stalled-insns=0} means there is no limit
7872 on how many queued insns can be moved prematurely.
7873 @option{-fsched-stalled-insns} without a value is equivalent to
7874 @option{-fsched-stalled-insns=1}.
7875
7876 @item -fsched-stalled-insns-dep
7877 @itemx -fsched-stalled-insns-dep=@var{n}
7878 @opindex fsched-stalled-insns-dep
7879 Define how many insn groups (cycles) are examined for a dependency
7880 on a stalled insn that is a candidate for premature removal from the queue
7881 of stalled insns. This has an effect only during the second scheduling pass,
7882 and only if @option{-fsched-stalled-insns} is used.
7883 @option{-fno-sched-stalled-insns-dep} is equivalent to
7884 @option{-fsched-stalled-insns-dep=0}.
7885 @option{-fsched-stalled-insns-dep} without a value is equivalent to
7886 @option{-fsched-stalled-insns-dep=1}.
7887
7888 @item -fsched2-use-superblocks
7889 @opindex fsched2-use-superblocks
7890 When scheduling after register allocation, use superblock scheduling.
7891 This allows motion across basic block boundaries,
7892 resulting in faster schedules. This option is experimental, as not all machine
7893 descriptions used by GCC model the CPU closely enough to avoid unreliable
7894 results from the algorithm.
7895
7896 This only makes sense when scheduling after register allocation, i.e.@: with
7897 @option{-fschedule-insns2} or at @option{-O2} or higher.
7898
7899 @item -fsched-group-heuristic
7900 @opindex fsched-group-heuristic
7901 Enable the group heuristic in the scheduler. This heuristic favors
7902 the instruction that belongs to a schedule group. This is enabled
7903 by default when scheduling is enabled, i.e.@: with @option{-fschedule-insns}
7904 or @option{-fschedule-insns2} or at @option{-O2} or higher.
7905
7906 @item -fsched-critical-path-heuristic
7907 @opindex fsched-critical-path-heuristic
7908 Enable the critical-path heuristic in the scheduler. This heuristic favors
7909 instructions on the critical path. This is enabled by default when
7910 scheduling is enabled, i.e.@: with @option{-fschedule-insns}
7911 or @option{-fschedule-insns2} or at @option{-O2} or higher.
7912
7913 @item -fsched-spec-insn-heuristic
7914 @opindex fsched-spec-insn-heuristic
7915 Enable the speculative instruction heuristic in the scheduler. This
7916 heuristic favors speculative instructions with greater dependency weakness.
7917 This is enabled by default when scheduling is enabled, i.e.@:
7918 with @option{-fschedule-insns} or @option{-fschedule-insns2}
7919 or at @option{-O2} or higher.
7920
7921 @item -fsched-rank-heuristic
7922 @opindex fsched-rank-heuristic
7923 Enable the rank heuristic in the scheduler. This heuristic favors
7924 the instruction belonging to a basic block with greater size or frequency.
7925 This is enabled by default when scheduling is enabled, i.e.@:
7926 with @option{-fschedule-insns} or @option{-fschedule-insns2} or
7927 at @option{-O2} or higher.
7928
7929 @item -fsched-last-insn-heuristic
7930 @opindex fsched-last-insn-heuristic
7931 Enable the last-instruction heuristic in the scheduler. This heuristic
7932 favors the instruction that is less dependent on the last instruction
7933 scheduled. This is enabled by default when scheduling is enabled,
7934 i.e.@: with @option{-fschedule-insns} or @option{-fschedule-insns2} or
7935 at @option{-O2} or higher.
7936
7937 @item -fsched-dep-count-heuristic
7938 @opindex fsched-dep-count-heuristic
7939 Enable the dependent-count heuristic in the scheduler. This heuristic
7940 favors the instruction that has more instructions depending on it.
7941 This is enabled by default when scheduling is enabled, i.e.@:
7942 with @option{-fschedule-insns} or @option{-fschedule-insns2} or
7943 at @option{-O2} or higher.
7944
7945 @item -freschedule-modulo-scheduled-loops
7946 @opindex freschedule-modulo-scheduled-loops
7947 Modulo scheduling is performed before traditional scheduling. If a loop
7948 is modulo scheduled, later scheduling passes may change its schedule.
7949 Use this option to control that behavior.
7950
7951 @item -fselective-scheduling
7952 @opindex fselective-scheduling
7953 Schedule instructions using selective scheduling algorithm. Selective
7954 scheduling runs instead of the first scheduler pass.
7955
7956 @item -fselective-scheduling2
7957 @opindex fselective-scheduling2
7958 Schedule instructions using selective scheduling algorithm. Selective
7959 scheduling runs instead of the second scheduler pass.
7960
7961 @item -fsel-sched-pipelining
7962 @opindex fsel-sched-pipelining
7963 Enable software pipelining of innermost loops during selective scheduling.
7964 This option has no effect unless one of @option{-fselective-scheduling} or
7965 @option{-fselective-scheduling2} is turned on.
7966
7967 @item -fsel-sched-pipelining-outer-loops
7968 @opindex fsel-sched-pipelining-outer-loops
7969 When pipelining loops during selective scheduling, also pipeline outer loops.
7970 This option has no effect unless @option{-fsel-sched-pipelining} is turned on.
7971
7972 @item -fsemantic-interposition
7973 @opindex fsemantic-interposition
7974 Some object formats, like ELF, allow interposing of symbols by dynamic linker.
7975 This means that for symbols exported from the DSO compiler can not perform
7976 inter-procedural propagation, inlining and other optimizations in anticipation
7977 that the function or variable in question may change. While this feature is
7978 useful, for example, to rewrite memory allocation functions by a debugging
7979 implementation, it is expensive in the terms of code quality.
7980 With @option{-fno-semantic-inteposition} compiler assumest that if interposition
7981 happens for functions the overwritting function will have
7982 precisely same semantics (and side effects). Similarly if interposition happens
7983 for variables, the constructor of the variable will be the same. The flag
7984 has no effect for functions explicitly declared inline, where
7985 interposition changing semantic is never allowed and for symbols explicitly
7986 declared weak.
7987
7988 @item -fshrink-wrap
7989 @opindex fshrink-wrap
7990 Emit function prologues only before parts of the function that need it,
7991 rather than at the top of the function. This flag is enabled by default at
7992 @option{-O} and higher.
7993
7994 @item -fcaller-saves
7995 @opindex fcaller-saves
7996 Enable allocation of values to registers that are clobbered by
7997 function calls, by emitting extra instructions to save and restore the
7998 registers around such calls. Such allocation is done only when it
7999 seems to result in better code.
8000
8001 This option is always enabled by default on certain machines, usually
8002 those which have no call-preserved registers to use instead.
8003
8004 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8005
8006 @item -fcombine-stack-adjustments
8007 @opindex fcombine-stack-adjustments
8008 Tracks stack adjustments (pushes and pops) and stack memory references
8009 and then tries to find ways to combine them.
8010
8011 Enabled by default at @option{-O1} and higher.
8012
8013 @item -fuse-caller-save
8014 Use caller save registers for allocation if those registers are not used by
8015 any called function. In that case it is not necessary to save and restore
8016 them around calls. This is only possible if called functions are part of
8017 same compilation unit as current function and they are compiled before it.
8018
8019 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8020
8021 @item -fconserve-stack
8022 @opindex fconserve-stack
8023 Attempt to minimize stack usage. The compiler attempts to use less
8024 stack space, even if that makes the program slower. This option
8025 implies setting the @option{large-stack-frame} parameter to 100
8026 and the @option{large-stack-frame-growth} parameter to 400.
8027
8028 @item -ftree-reassoc
8029 @opindex ftree-reassoc
8030 Perform reassociation on trees. This flag is enabled by default
8031 at @option{-O} and higher.
8032
8033 @item -ftree-pre
8034 @opindex ftree-pre
8035 Perform partial redundancy elimination (PRE) on trees. This flag is
8036 enabled by default at @option{-O2} and @option{-O3}.
8037
8038 @item -ftree-partial-pre
8039 @opindex ftree-partial-pre
8040 Make partial redundancy elimination (PRE) more aggressive. This flag is
8041 enabled by default at @option{-O3}.
8042
8043 @item -ftree-forwprop
8044 @opindex ftree-forwprop
8045 Perform forward propagation on trees. This flag is enabled by default
8046 at @option{-O} and higher.
8047
8048 @item -ftree-fre
8049 @opindex ftree-fre
8050 Perform full redundancy elimination (FRE) on trees. The difference
8051 between FRE and PRE is that FRE only considers expressions
8052 that are computed on all paths leading to the redundant computation.
8053 This analysis is faster than PRE, though it exposes fewer redundancies.
8054 This flag is enabled by default at @option{-O} and higher.
8055
8056 @item -ftree-phiprop
8057 @opindex ftree-phiprop
8058 Perform hoisting of loads from conditional pointers on trees. This
8059 pass is enabled by default at @option{-O} and higher.
8060
8061 @item -fhoist-adjacent-loads
8062 @opindex hoist-adjacent-loads
8063 Speculatively hoist loads from both branches of an if-then-else if the
8064 loads are from adjacent locations in the same structure and the target
8065 architecture has a conditional move instruction. This flag is enabled
8066 by default at @option{-O2} and higher.
8067
8068 @item -ftree-copy-prop
8069 @opindex ftree-copy-prop
8070 Perform copy propagation on trees. This pass eliminates unnecessary
8071 copy operations. This flag is enabled by default at @option{-O} and
8072 higher.
8073
8074 @item -fipa-pure-const
8075 @opindex fipa-pure-const
8076 Discover which functions are pure or constant.
8077 Enabled by default at @option{-O} and higher.
8078
8079 @item -fipa-reference
8080 @opindex fipa-reference
8081 Discover which static variables do not escape the
8082 compilation unit.
8083 Enabled by default at @option{-O} and higher.
8084
8085 @item -fipa-pta
8086 @opindex fipa-pta
8087 Perform interprocedural pointer analysis and interprocedural modification
8088 and reference analysis. This option can cause excessive memory and
8089 compile-time usage on large compilation units. It is not enabled by
8090 default at any optimization level.
8091
8092 @item -fipa-profile
8093 @opindex fipa-profile
8094 Perform interprocedural profile propagation. The functions called only from
8095 cold functions are marked as cold. Also functions executed once (such as
8096 @code{cold}, @code{noreturn}, static constructors or destructors) are identified. Cold
8097 functions and loop less parts of functions executed once are then optimized for
8098 size.
8099 Enabled by default at @option{-O} and higher.
8100
8101 @item -fipa-cp
8102 @opindex fipa-cp
8103 Perform interprocedural constant propagation.
8104 This optimization analyzes the program to determine when values passed
8105 to functions are constants and then optimizes accordingly.
8106 This optimization can substantially increase performance
8107 if the application has constants passed to functions.
8108 This flag is enabled by default at @option{-O2}, @option{-Os} and @option{-O3}.
8109
8110 @item -fipa-cp-clone
8111 @opindex fipa-cp-clone
8112 Perform function cloning to make interprocedural constant propagation stronger.
8113 When enabled, interprocedural constant propagation performs function cloning
8114 when externally visible function can be called with constant arguments.
8115 Because this optimization can create multiple copies of functions,
8116 it may significantly increase code size
8117 (see @option{--param ipcp-unit-growth=@var{value}}).
8118 This flag is enabled by default at @option{-O3}.
8119
8120 @item -fipa-icf
8121 @opindex fipa-icf
8122 Perform Identical Code Folding for functions and read-only variables.
8123 The optimization reduces code size and may disturb unwind stacks by replacing
8124 a function by equivalent one with a different name. The optimization works
8125 more effectively with link time optimization enabled.
8126
8127 Nevertheless the behavior is similar to Gold Linker ICF optimization, GCC ICF
8128 works on different levels and thus the optimizations are not same - there are
8129 equivalences that are found only by GCC and equivalences found only by Gold.
8130
8131 This flag is enabled by default at @option{-O2} and @option{-Os}.
8132
8133 @item -fisolate-erroneous-paths-dereference
8134 Detect paths which trigger erroneous or undefined behaviour due to
8135 dereferencing a NULL pointer. Isolate those paths from the main control
8136 flow and turn the statement with erroneous or undefined behaviour into a trap.
8137
8138 @item -fisolate-erroneous-paths-attribute
8139 Detect paths which trigger erroneous or undefined behaviour due a NULL value
8140 being used in a way which is forbidden by a @code{returns_nonnull} or @code{nonnull}
8141 attribute. Isolate those paths from the main control flow and turn the
8142 statement with erroneous or undefined behaviour into a trap. This is not
8143 currently enabled, but may be enabled by @code{-O2} in the future.
8144
8145 @item -ftree-sink
8146 @opindex ftree-sink
8147 Perform forward store motion on trees. This flag is
8148 enabled by default at @option{-O} and higher.
8149
8150 @item -ftree-bit-ccp
8151 @opindex ftree-bit-ccp
8152 Perform sparse conditional bit constant propagation on trees and propagate
8153 pointer alignment information.
8154 This pass only operates on local scalar variables and is enabled by default
8155 at @option{-O} and higher. It requires that @option{-ftree-ccp} is enabled.
8156
8157 @item -ftree-ccp
8158 @opindex ftree-ccp
8159 Perform sparse conditional constant propagation (CCP) on trees. This
8160 pass only operates on local scalar variables and is enabled by default
8161 at @option{-O} and higher.
8162
8163 @item -fssa-phiopt
8164 @opindex fssa-phiopt
8165 Perform pattern matching on SSA PHI nodes to optimize conditional
8166 code. This pass is enabled by default at @option{-O} and higher.
8167
8168 @item -ftree-switch-conversion
8169 Perform conversion of simple initializations in a switch to
8170 initializations from a scalar array. This flag is enabled by default
8171 at @option{-O2} and higher.
8172
8173 @item -ftree-tail-merge
8174 Look for identical code sequences. When found, replace one with a jump to the
8175 other. This optimization is known as tail merging or cross jumping. This flag
8176 is enabled by default at @option{-O2} and higher. The compilation time
8177 in this pass can
8178 be limited using @option{max-tail-merge-comparisons} parameter and
8179 @option{max-tail-merge-iterations} parameter.
8180
8181 @item -ftree-dce
8182 @opindex ftree-dce
8183 Perform dead code elimination (DCE) on trees. This flag is enabled by
8184 default at @option{-O} and higher.
8185
8186 @item -ftree-builtin-call-dce
8187 @opindex ftree-builtin-call-dce
8188 Perform conditional dead code elimination (DCE) for calls to built-in functions
8189 that may set @code{errno} but are otherwise side-effect free. This flag is
8190 enabled by default at @option{-O2} and higher if @option{-Os} is not also
8191 specified.
8192
8193 @item -ftree-dominator-opts
8194 @opindex ftree-dominator-opts
8195 Perform a variety of simple scalar cleanups (constant/copy
8196 propagation, redundancy elimination, range propagation and expression
8197 simplification) based on a dominator tree traversal. This also
8198 performs jump threading (to reduce jumps to jumps). This flag is
8199 enabled by default at @option{-O} and higher.
8200
8201 @item -ftree-dse
8202 @opindex ftree-dse
8203 Perform dead store elimination (DSE) on trees. A dead store is a store into
8204 a memory location that is later overwritten by another store without
8205 any intervening loads. In this case the earlier store can be deleted. This
8206 flag is enabled by default at @option{-O} and higher.
8207
8208 @item -ftree-ch
8209 @opindex ftree-ch
8210 Perform loop header copying on trees. This is beneficial since it increases
8211 effectiveness of code motion optimizations. It also saves one jump. This flag
8212 is enabled by default at @option{-O} and higher. It is not enabled
8213 for @option{-Os}, since it usually increases code size.
8214
8215 @item -ftree-loop-optimize
8216 @opindex ftree-loop-optimize
8217 Perform loop optimizations on trees. This flag is enabled by default
8218 at @option{-O} and higher.
8219
8220 @item -ftree-loop-linear
8221 @opindex ftree-loop-linear
8222 Perform loop interchange transformations on tree. Same as
8223 @option{-floop-interchange}. To use this code transformation, GCC has
8224 to be configured with @option{--with-ppl} and @option{--with-cloog} to
8225 enable the Graphite loop transformation infrastructure.
8226
8227 @item -floop-interchange
8228 @opindex floop-interchange
8229 Perform loop interchange transformations on loops. Interchanging two
8230 nested loops switches the inner and outer loops. For example, given a
8231 loop like:
8232 @smallexample
8233 DO J = 1, M
8234 DO I = 1, N
8235 A(J, I) = A(J, I) * C
8236 ENDDO
8237 ENDDO
8238 @end smallexample
8239 loop interchange transforms the loop as if it were written:
8240 @smallexample
8241 DO I = 1, N
8242 DO J = 1, M
8243 A(J, I) = A(J, I) * C
8244 ENDDO
8245 ENDDO
8246 @end smallexample
8247 which can be beneficial when @code{N} is larger than the caches,
8248 because in Fortran, the elements of an array are stored in memory
8249 contiguously by column, and the original loop iterates over rows,
8250 potentially creating at each access a cache miss. This optimization
8251 applies to all the languages supported by GCC and is not limited to
8252 Fortran. To use this code transformation, GCC has to be configured
8253 with @option{--with-ppl} and @option{--with-cloog} to enable the
8254 Graphite loop transformation infrastructure.
8255
8256 @item -floop-strip-mine
8257 @opindex floop-strip-mine
8258 Perform loop strip mining transformations on loops. Strip mining
8259 splits a loop into two nested loops. The outer loop has strides
8260 equal to the strip size and the inner loop has strides of the
8261 original loop within a strip. The strip length can be changed
8262 using the @option{loop-block-tile-size} parameter. For example,
8263 given a loop like:
8264 @smallexample
8265 DO I = 1, N
8266 A(I) = A(I) + C
8267 ENDDO
8268 @end smallexample
8269 loop strip mining transforms the loop as if it were written:
8270 @smallexample
8271 DO II = 1, N, 51
8272 DO I = II, min (II + 50, N)
8273 A(I) = A(I) + C
8274 ENDDO
8275 ENDDO
8276 @end smallexample
8277 This optimization applies to all the languages supported by GCC and is
8278 not limited to Fortran. To use this code transformation, GCC has to
8279 be configured with @option{--with-ppl} and @option{--with-cloog} to
8280 enable the Graphite loop transformation infrastructure.
8281
8282 @item -floop-block
8283 @opindex floop-block
8284 Perform loop blocking transformations on loops. Blocking strip mines
8285 each loop in the loop nest such that the memory accesses of the
8286 element loops fit inside caches. The strip length can be changed
8287 using the @option{loop-block-tile-size} parameter. For example, given
8288 a loop like:
8289 @smallexample
8290 DO I = 1, N
8291 DO J = 1, M
8292 A(J, I) = B(I) + C(J)
8293 ENDDO
8294 ENDDO
8295 @end smallexample
8296 loop blocking transforms the loop as if it were written:
8297 @smallexample
8298 DO II = 1, N, 51
8299 DO JJ = 1, M, 51
8300 DO I = II, min (II + 50, N)
8301 DO J = JJ, min (JJ + 50, M)
8302 A(J, I) = B(I) + C(J)
8303 ENDDO
8304 ENDDO
8305 ENDDO
8306 ENDDO
8307 @end smallexample
8308 which can be beneficial when @code{M} is larger than the caches,
8309 because the innermost loop iterates over a smaller amount of data
8310 which can be kept in the caches. This optimization applies to all the
8311 languages supported by GCC and is not limited to Fortran. To use this
8312 code transformation, GCC has to be configured with @option{--with-ppl}
8313 and @option{--with-cloog} to enable the Graphite loop transformation
8314 infrastructure.
8315
8316 @item -fgraphite-identity
8317 @opindex fgraphite-identity
8318 Enable the identity transformation for graphite. For every SCoP we generate
8319 the polyhedral representation and transform it back to gimple. Using
8320 @option{-fgraphite-identity} we can check the costs or benefits of the
8321 GIMPLE -> GRAPHITE -> GIMPLE transformation. Some minimal optimizations
8322 are also performed by the code generator CLooG, like index splitting and
8323 dead code elimination in loops.
8324
8325 @item -floop-nest-optimize
8326 @opindex floop-nest-optimize
8327 Enable the ISL based loop nest optimizer. This is a generic loop nest
8328 optimizer based on the Pluto optimization algorithms. It calculates a loop
8329 structure optimized for data-locality and parallelism. This option
8330 is experimental.
8331
8332 @item -floop-parallelize-all
8333 @opindex floop-parallelize-all
8334 Use the Graphite data dependence analysis to identify loops that can
8335 be parallelized. Parallelize all the loops that can be analyzed to
8336 not contain loop carried dependences without checking that it is
8337 profitable to parallelize the loops.
8338
8339 @item -fcheck-data-deps
8340 @opindex fcheck-data-deps
8341 Compare the results of several data dependence analyzers. This option
8342 is used for debugging the data dependence analyzers.
8343
8344 @item -ftree-loop-if-convert
8345 Attempt to transform conditional jumps in the innermost loops to
8346 branch-less equivalents. The intent is to remove control-flow from
8347 the innermost loops in order to improve the ability of the
8348 vectorization pass to handle these loops. This is enabled by default
8349 if vectorization is enabled.
8350
8351 @item -ftree-loop-if-convert-stores
8352 Attempt to also if-convert conditional jumps containing memory writes.
8353 This transformation can be unsafe for multi-threaded programs as it
8354 transforms conditional memory writes into unconditional memory writes.
8355 For example,
8356 @smallexample
8357 for (i = 0; i < N; i++)
8358 if (cond)
8359 A[i] = expr;
8360 @end smallexample
8361 is transformed to
8362 @smallexample
8363 for (i = 0; i < N; i++)
8364 A[i] = cond ? expr : A[i];
8365 @end smallexample
8366 potentially producing data races.
8367
8368 @item -ftree-loop-distribution
8369 Perform loop distribution. This flag can improve cache performance on
8370 big loop bodies and allow further loop optimizations, like
8371 parallelization or vectorization, to take place. For example, the loop
8372 @smallexample
8373 DO I = 1, N
8374 A(I) = B(I) + C
8375 D(I) = E(I) * F
8376 ENDDO
8377 @end smallexample
8378 is transformed to
8379 @smallexample
8380 DO I = 1, N
8381 A(I) = B(I) + C
8382 ENDDO
8383 DO I = 1, N
8384 D(I) = E(I) * F
8385 ENDDO
8386 @end smallexample
8387
8388 @item -ftree-loop-distribute-patterns
8389 Perform loop distribution of patterns that can be code generated with
8390 calls to a library. This flag is enabled by default at @option{-O3}.
8391
8392 This pass distributes the initialization loops and generates a call to
8393 memset zero. For example, the loop
8394 @smallexample
8395 DO I = 1, N
8396 A(I) = 0
8397 B(I) = A(I) + I
8398 ENDDO
8399 @end smallexample
8400 is transformed to
8401 @smallexample
8402 DO I = 1, N
8403 A(I) = 0
8404 ENDDO
8405 DO I = 1, N
8406 B(I) = A(I) + I
8407 ENDDO
8408 @end smallexample
8409 and the initialization loop is transformed into a call to memset zero.
8410
8411 @item -ftree-loop-im
8412 @opindex ftree-loop-im
8413 Perform loop invariant motion on trees. This pass moves only invariants that
8414 are hard to handle at RTL level (function calls, operations that expand to
8415 nontrivial sequences of insns). With @option{-funswitch-loops} it also moves
8416 operands of conditions that are invariant out of the loop, so that we can use
8417 just trivial invariantness analysis in loop unswitching. The pass also includes
8418 store motion.
8419
8420 @item -ftree-loop-ivcanon
8421 @opindex ftree-loop-ivcanon
8422 Create a canonical counter for number of iterations in loops for which
8423 determining number of iterations requires complicated analysis. Later
8424 optimizations then may determine the number easily. Useful especially
8425 in connection with unrolling.
8426
8427 @item -fivopts
8428 @opindex fivopts
8429 Perform induction variable optimizations (strength reduction, induction
8430 variable merging and induction variable elimination) on trees.
8431
8432 @item -ftree-parallelize-loops=n
8433 @opindex ftree-parallelize-loops
8434 Parallelize loops, i.e., split their iteration space to run in n threads.
8435 This is only possible for loops whose iterations are independent
8436 and can be arbitrarily reordered. The optimization is only
8437 profitable on multiprocessor machines, for loops that are CPU-intensive,
8438 rather than constrained e.g.@: by memory bandwidth. This option
8439 implies @option{-pthread}, and thus is only supported on targets
8440 that have support for @option{-pthread}.
8441
8442 @item -ftree-pta
8443 @opindex ftree-pta
8444 Perform function-local points-to analysis on trees. This flag is
8445 enabled by default at @option{-O} and higher.
8446
8447 @item -ftree-sra
8448 @opindex ftree-sra
8449 Perform scalar replacement of aggregates. This pass replaces structure
8450 references with scalars to prevent committing structures to memory too
8451 early. This flag is enabled by default at @option{-O} and higher.
8452
8453 @item -ftree-copyrename
8454 @opindex ftree-copyrename
8455 Perform copy renaming on trees. This pass attempts to rename compiler
8456 temporaries to other variables at copy locations, usually resulting in
8457 variable names which more closely resemble the original variables. This flag
8458 is enabled by default at @option{-O} and higher.
8459
8460 @item -ftree-coalesce-inlined-vars
8461 @opindex ftree-coalesce-inlined-vars
8462 Tell the copyrename pass (see @option{-ftree-copyrename}) to attempt to
8463 combine small user-defined variables too, but only if they were inlined
8464 from other functions. It is a more limited form of
8465 @option{-ftree-coalesce-vars}. This may harm debug information of such
8466 inlined variables, but it will keep variables of the inlined-into
8467 function apart from each other, such that they are more likely to
8468 contain the expected values in a debugging session. This was the
8469 default in GCC versions older than 4.7.
8470
8471 @item -ftree-coalesce-vars
8472 @opindex ftree-coalesce-vars
8473 Tell the copyrename pass (see @option{-ftree-copyrename}) to attempt to
8474 combine small user-defined variables too, instead of just compiler
8475 temporaries. This may severely limit the ability to debug an optimized
8476 program compiled with @option{-fno-var-tracking-assignments}. In the
8477 negated form, this flag prevents SSA coalescing of user variables,
8478 including inlined ones. This option is enabled by default.
8479
8480 @item -ftree-ter
8481 @opindex ftree-ter
8482 Perform temporary expression replacement during the SSA->normal phase. Single
8483 use/single def temporaries are replaced at their use location with their
8484 defining expression. This results in non-GIMPLE code, but gives the expanders
8485 much more complex trees to work on resulting in better RTL generation. This is
8486 enabled by default at @option{-O} and higher.
8487
8488 @item -ftree-slsr
8489 @opindex ftree-slsr
8490 Perform straight-line strength reduction on trees. This recognizes related
8491 expressions involving multiplications and replaces them by less expensive
8492 calculations when possible. This is enabled by default at @option{-O} and
8493 higher.
8494
8495 @item -ftree-vectorize
8496 @opindex ftree-vectorize
8497 Perform vectorization on trees. This flag enables @option{-ftree-loop-vectorize}
8498 and @option{-ftree-slp-vectorize} if not explicitly specified.
8499
8500 @item -ftree-loop-vectorize
8501 @opindex ftree-loop-vectorize
8502 Perform loop vectorization on trees. This flag is enabled by default at
8503 @option{-O3} and when @option{-ftree-vectorize} is enabled.
8504
8505 @item -ftree-slp-vectorize
8506 @opindex ftree-slp-vectorize
8507 Perform basic block vectorization on trees. This flag is enabled by default at
8508 @option{-O3} and when @option{-ftree-vectorize} is enabled.
8509
8510 @item -fvect-cost-model=@var{model}
8511 @opindex fvect-cost-model
8512 Alter the cost model used for vectorization. The @var{model} argument
8513 should be one of @code{unlimited}, @code{dynamic} or @code{cheap}.
8514 With the @code{unlimited} model the vectorized code-path is assumed
8515 to be profitable while with the @code{dynamic} model a runtime check
8516 will guard the vectorized code-path to enable it only for iteration
8517 counts that will likely execute faster than when executing the original
8518 scalar loop. The @code{cheap} model will disable vectorization of
8519 loops where doing so would be cost prohibitive for example due to
8520 required runtime checks for data dependence or alignment but otherwise
8521 is equal to the @code{dynamic} model.
8522 The default cost model depends on other optimization flags and is
8523 either @code{dynamic} or @code{cheap}.
8524
8525 @item -fsimd-cost-model=@var{model}
8526 @opindex fsimd-cost-model
8527 Alter the cost model used for vectorization of loops marked with the OpenMP
8528 or Cilk Plus simd directive. The @var{model} argument should be one of
8529 @code{unlimited}, @code{dynamic}, @code{cheap}. All values of @var{model}
8530 have the same meaning as described in @option{-fvect-cost-model} and by
8531 default a cost model defined with @option{-fvect-cost-model} is used.
8532
8533 @item -ftree-vrp
8534 @opindex ftree-vrp
8535 Perform Value Range Propagation on trees. This is similar to the
8536 constant propagation pass, but instead of values, ranges of values are
8537 propagated. This allows the optimizers to remove unnecessary range
8538 checks like array bound checks and null pointer checks. This is
8539 enabled by default at @option{-O2} and higher. Null pointer check
8540 elimination is only done if @option{-fdelete-null-pointer-checks} is
8541 enabled.
8542
8543 @item -ftracer
8544 @opindex ftracer
8545 Perform tail duplication to enlarge superblock size. This transformation
8546 simplifies the control flow of the function allowing other optimizations to do
8547 a better job.
8548
8549 @item -funroll-loops
8550 @opindex funroll-loops
8551 Unroll loops whose number of iterations can be determined at compile
8552 time or upon entry to the loop. @option{-funroll-loops} implies
8553 @option{-frerun-cse-after-loop}. This option makes code larger,
8554 and may or may not make it run faster.
8555
8556 @item -funroll-all-loops
8557 @opindex funroll-all-loops
8558 Unroll all loops, even if their number of iterations is uncertain when
8559 the loop is entered. This usually makes programs run more slowly.
8560 @option{-funroll-all-loops} implies the same options as
8561 @option{-funroll-loops},
8562
8563 @item -fsplit-ivs-in-unroller
8564 @opindex fsplit-ivs-in-unroller
8565 Enables expression of values of induction variables in later iterations
8566 of the unrolled loop using the value in the first iteration. This breaks
8567 long dependency chains, thus improving efficiency of the scheduling passes.
8568
8569 A combination of @option{-fweb} and CSE is often sufficient to obtain the
8570 same effect. However, that is not reliable in cases where the loop body
8571 is more complicated than a single basic block. It also does not work at all
8572 on some architectures due to restrictions in the CSE pass.
8573
8574 This optimization is enabled by default.
8575
8576 @item -fvariable-expansion-in-unroller
8577 @opindex fvariable-expansion-in-unroller
8578 With this option, the compiler creates multiple copies of some
8579 local variables when unrolling a loop, which can result in superior code.
8580
8581 @item -fpartial-inlining
8582 @opindex fpartial-inlining
8583 Inline parts of functions. This option has any effect only
8584 when inlining itself is turned on by the @option{-finline-functions}
8585 or @option{-finline-small-functions} options.
8586
8587 Enabled at level @option{-O2}.
8588
8589 @item -fpredictive-commoning
8590 @opindex fpredictive-commoning
8591 Perform predictive commoning optimization, i.e., reusing computations
8592 (especially memory loads and stores) performed in previous
8593 iterations of loops.
8594
8595 This option is enabled at level @option{-O3}.
8596
8597 @item -fprefetch-loop-arrays
8598 @opindex fprefetch-loop-arrays
8599 If supported by the target machine, generate instructions to prefetch
8600 memory to improve the performance of loops that access large arrays.
8601
8602 This option may generate better or worse code; results are highly
8603 dependent on the structure of loops within the source code.
8604
8605 Disabled at level @option{-Os}.
8606
8607 @item -fno-peephole
8608 @itemx -fno-peephole2
8609 @opindex fno-peephole
8610 @opindex fno-peephole2
8611 Disable any machine-specific peephole optimizations. The difference
8612 between @option{-fno-peephole} and @option{-fno-peephole2} is in how they
8613 are implemented in the compiler; some targets use one, some use the
8614 other, a few use both.
8615
8616 @option{-fpeephole} is enabled by default.
8617 @option{-fpeephole2} enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8618
8619 @item -fno-guess-branch-probability
8620 @opindex fno-guess-branch-probability
8621 Do not guess branch probabilities using heuristics.
8622
8623 GCC uses heuristics to guess branch probabilities if they are
8624 not provided by profiling feedback (@option{-fprofile-arcs}). These
8625 heuristics are based on the control flow graph. If some branch probabilities
8626 are specified by @samp{__builtin_expect}, then the heuristics are
8627 used to guess branch probabilities for the rest of the control flow graph,
8628 taking the @samp{__builtin_expect} info into account. The interactions
8629 between the heuristics and @samp{__builtin_expect} can be complex, and in
8630 some cases, it may be useful to disable the heuristics so that the effects
8631 of @samp{__builtin_expect} are easier to understand.
8632
8633 The default is @option{-fguess-branch-probability} at levels
8634 @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
8635
8636 @item -freorder-blocks
8637 @opindex freorder-blocks
8638 Reorder basic blocks in the compiled function in order to reduce number of
8639 taken branches and improve code locality.
8640
8641 Enabled at levels @option{-O2}, @option{-O3}.
8642
8643 @item -freorder-blocks-and-partition
8644 @opindex freorder-blocks-and-partition
8645 In addition to reordering basic blocks in the compiled function, in order
8646 to reduce number of taken branches, partitions hot and cold basic blocks
8647 into separate sections of the assembly and .o files, to improve
8648 paging and cache locality performance.
8649
8650 This optimization is automatically turned off in the presence of
8651 exception handling, for linkonce sections, for functions with a user-defined
8652 section attribute and on any architecture that does not support named
8653 sections.
8654
8655 Enabled for x86 at levels @option{-O2}, @option{-O3}.
8656
8657 @item -freorder-functions
8658 @opindex freorder-functions
8659 Reorder functions in the object file in order to
8660 improve code locality. This is implemented by using special
8661 subsections @code{.text.hot} for most frequently executed functions and
8662 @code{.text.unlikely} for unlikely executed functions. Reordering is done by
8663 the linker so object file format must support named sections and linker must
8664 place them in a reasonable way.
8665
8666 Also profile feedback must be available to make this option effective. See
8667 @option{-fprofile-arcs} for details.
8668
8669 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8670
8671 @item -fstrict-aliasing
8672 @opindex fstrict-aliasing
8673 Allow the compiler to assume the strictest aliasing rules applicable to
8674 the language being compiled. For C (and C++), this activates
8675 optimizations based on the type of expressions. In particular, an
8676 object of one type is assumed never to reside at the same address as an
8677 object of a different type, unless the types are almost the same. For
8678 example, an @code{unsigned int} can alias an @code{int}, but not a
8679 @code{void*} or a @code{double}. A character type may alias any other
8680 type.
8681
8682 @anchor{Type-punning}Pay special attention to code like this:
8683 @smallexample
8684 union a_union @{
8685 int i;
8686 double d;
8687 @};
8688
8689 int f() @{
8690 union a_union t;
8691 t.d = 3.0;
8692 return t.i;
8693 @}
8694 @end smallexample
8695 The practice of reading from a different union member than the one most
8696 recently written to (called ``type-punning'') is common. Even with
8697 @option{-fstrict-aliasing}, type-punning is allowed, provided the memory
8698 is accessed through the union type. So, the code above works as
8699 expected. @xref{Structures unions enumerations and bit-fields
8700 implementation}. However, this code might not:
8701 @smallexample
8702 int f() @{
8703 union a_union t;
8704 int* ip;
8705 t.d = 3.0;
8706 ip = &t.i;
8707 return *ip;
8708 @}
8709 @end smallexample
8710
8711 Similarly, access by taking the address, casting the resulting pointer
8712 and dereferencing the result has undefined behavior, even if the cast
8713 uses a union type, e.g.:
8714 @smallexample
8715 int f() @{
8716 double d = 3.0;
8717 return ((union a_union *) &d)->i;
8718 @}
8719 @end smallexample
8720
8721 The @option{-fstrict-aliasing} option is enabled at levels
8722 @option{-O2}, @option{-O3}, @option{-Os}.
8723
8724 @item -fstrict-overflow
8725 @opindex fstrict-overflow
8726 Allow the compiler to assume strict signed overflow rules, depending
8727 on the language being compiled. For C (and C++) this means that
8728 overflow when doing arithmetic with signed numbers is undefined, which
8729 means that the compiler may assume that it does not happen. This
8730 permits various optimizations. For example, the compiler assumes
8731 that an expression like @code{i + 10 > i} is always true for
8732 signed @code{i}. This assumption is only valid if signed overflow is
8733 undefined, as the expression is false if @code{i + 10} overflows when
8734 using twos complement arithmetic. When this option is in effect any
8735 attempt to determine whether an operation on signed numbers
8736 overflows must be written carefully to not actually involve overflow.
8737
8738 This option also allows the compiler to assume strict pointer
8739 semantics: given a pointer to an object, if adding an offset to that
8740 pointer does not produce a pointer to the same object, the addition is
8741 undefined. This permits the compiler to conclude that @code{p + u >
8742 p} is always true for a pointer @code{p} and unsigned integer
8743 @code{u}. This assumption is only valid because pointer wraparound is
8744 undefined, as the expression is false if @code{p + u} overflows using
8745 twos complement arithmetic.
8746
8747 See also the @option{-fwrapv} option. Using @option{-fwrapv} means
8748 that integer signed overflow is fully defined: it wraps. When
8749 @option{-fwrapv} is used, there is no difference between
8750 @option{-fstrict-overflow} and @option{-fno-strict-overflow} for
8751 integers. With @option{-fwrapv} certain types of overflow are
8752 permitted. For example, if the compiler gets an overflow when doing
8753 arithmetic on constants, the overflowed value can still be used with
8754 @option{-fwrapv}, but not otherwise.
8755
8756 The @option{-fstrict-overflow} option is enabled at levels
8757 @option{-O2}, @option{-O3}, @option{-Os}.
8758
8759 @item -falign-functions
8760 @itemx -falign-functions=@var{n}
8761 @opindex falign-functions
8762 Align the start of functions to the next power-of-two greater than
8763 @var{n}, skipping up to @var{n} bytes. For instance,
8764 @option{-falign-functions=32} aligns functions to the next 32-byte
8765 boundary, but @option{-falign-functions=24} aligns to the next
8766 32-byte boundary only if this can be done by skipping 23 bytes or less.
8767
8768 @option{-fno-align-functions} and @option{-falign-functions=1} are
8769 equivalent and mean that functions are not aligned.
8770
8771 Some assemblers only support this flag when @var{n} is a power of two;
8772 in that case, it is rounded up.
8773
8774 If @var{n} is not specified or is zero, use a machine-dependent default.
8775
8776 Enabled at levels @option{-O2}, @option{-O3}.
8777
8778 @item -falign-labels
8779 @itemx -falign-labels=@var{n}
8780 @opindex falign-labels
8781 Align all branch targets to a power-of-two boundary, skipping up to
8782 @var{n} bytes like @option{-falign-functions}. This option can easily
8783 make code slower, because it must insert dummy operations for when the
8784 branch target is reached in the usual flow of the code.
8785
8786 @option{-fno-align-labels} and @option{-falign-labels=1} are
8787 equivalent and mean that labels are not aligned.
8788
8789 If @option{-falign-loops} or @option{-falign-jumps} are applicable and
8790 are greater than this value, then their values are used instead.
8791
8792 If @var{n} is not specified or is zero, use a machine-dependent default
8793 which is very likely to be @samp{1}, meaning no alignment.
8794
8795 Enabled at levels @option{-O2}, @option{-O3}.
8796
8797 @item -falign-loops
8798 @itemx -falign-loops=@var{n}
8799 @opindex falign-loops
8800 Align loops to a power-of-two boundary, skipping up to @var{n} bytes
8801 like @option{-falign-functions}. If the loops are
8802 executed many times, this makes up for any execution of the dummy
8803 operations.
8804
8805 @option{-fno-align-loops} and @option{-falign-loops=1} are
8806 equivalent and mean that loops are not aligned.
8807
8808 If @var{n} is not specified or is zero, use a machine-dependent default.
8809
8810 Enabled at levels @option{-O2}, @option{-O3}.
8811
8812 @item -falign-jumps
8813 @itemx -falign-jumps=@var{n}
8814 @opindex falign-jumps
8815 Align branch targets to a power-of-two boundary, for branch targets
8816 where the targets can only be reached by jumping, skipping up to @var{n}
8817 bytes like @option{-falign-functions}. In this case, no dummy operations
8818 need be executed.
8819
8820 @option{-fno-align-jumps} and @option{-falign-jumps=1} are
8821 equivalent and mean that loops are not aligned.
8822
8823 If @var{n} is not specified or is zero, use a machine-dependent default.
8824
8825 Enabled at levels @option{-O2}, @option{-O3}.
8826
8827 @item -funit-at-a-time
8828 @opindex funit-at-a-time
8829 This option is left for compatibility reasons. @option{-funit-at-a-time}
8830 has no effect, while @option{-fno-unit-at-a-time} implies
8831 @option{-fno-toplevel-reorder} and @option{-fno-section-anchors}.
8832
8833 Enabled by default.
8834
8835 @item -fno-toplevel-reorder
8836 @opindex fno-toplevel-reorder
8837 Do not reorder top-level functions, variables, and @code{asm}
8838 statements. Output them in the same order that they appear in the
8839 input file. When this option is used, unreferenced static variables
8840 are not removed. This option is intended to support existing code
8841 that relies on a particular ordering. For new code, it is better to
8842 use attributes when possible.
8843
8844 Enabled at level @option{-O0}. When disabled explicitly, it also implies
8845 @option{-fno-section-anchors}, which is otherwise enabled at @option{-O0} on some
8846 targets.
8847
8848 @item -fweb
8849 @opindex fweb
8850 Constructs webs as commonly used for register allocation purposes and assign
8851 each web individual pseudo register. This allows the register allocation pass
8852 to operate on pseudos directly, but also strengthens several other optimization
8853 passes, such as CSE, loop optimizer and trivial dead code remover. It can,
8854 however, make debugging impossible, since variables no longer stay in a
8855 ``home register''.
8856
8857 Enabled by default with @option{-funroll-loops}.
8858
8859 @item -fwhole-program
8860 @opindex fwhole-program
8861 Assume that the current compilation unit represents the whole program being
8862 compiled. All public functions and variables with the exception of @code{main}
8863 and those merged by attribute @code{externally_visible} become static functions
8864 and in effect are optimized more aggressively by interprocedural optimizers.
8865
8866 This option should not be used in combination with @code{-flto}.
8867 Instead relying on a linker plugin should provide safer and more precise
8868 information.
8869
8870 @item -flto[=@var{n}]
8871 @opindex flto
8872 This option runs the standard link-time optimizer. When invoked
8873 with source code, it generates GIMPLE (one of GCC's internal
8874 representations) and writes it to special ELF sections in the object
8875 file. When the object files are linked together, all the function
8876 bodies are read from these ELF sections and instantiated as if they
8877 had been part of the same translation unit.
8878
8879 To use the link-time optimizer, @option{-flto} and optimization
8880 options should be specified at compile time and during the final link.
8881 For example:
8882
8883 @smallexample
8884 gcc -c -O2 -flto foo.c
8885 gcc -c -O2 -flto bar.c
8886 gcc -o myprog -flto -O2 foo.o bar.o
8887 @end smallexample
8888
8889 The first two invocations to GCC save a bytecode representation
8890 of GIMPLE into special ELF sections inside @file{foo.o} and
8891 @file{bar.o}. The final invocation reads the GIMPLE bytecode from
8892 @file{foo.o} and @file{bar.o}, merges the two files into a single
8893 internal image, and compiles the result as usual. Since both
8894 @file{foo.o} and @file{bar.o} are merged into a single image, this
8895 causes all the interprocedural analyses and optimizations in GCC to
8896 work across the two files as if they were a single one. This means,
8897 for example, that the inliner is able to inline functions in
8898 @file{bar.o} into functions in @file{foo.o} and vice-versa.
8899
8900 Another (simpler) way to enable link-time optimization is:
8901
8902 @smallexample
8903 gcc -o myprog -flto -O2 foo.c bar.c
8904 @end smallexample
8905
8906 The above generates bytecode for @file{foo.c} and @file{bar.c},
8907 merges them together into a single GIMPLE representation and optimizes
8908 them as usual to produce @file{myprog}.
8909
8910 The only important thing to keep in mind is that to enable link-time
8911 optimizations you need to use the GCC driver to perform the link-step.
8912 GCC then automatically performs link-time optimization if any of the
8913 objects involved were compiled with the @option{-flto}. You generally
8914 should specify the optimization options to be used for link-time
8915 optimization though GCC will try to be clever at guessing an
8916 optimization level to use from the options used at compile-time
8917 if you fail to specify one at link-time. You can always override
8918 the automatic decision to do link-time optimization at link-time
8919 by passing @option{-fno-lto} to the link command.
8920
8921 To make whole program optimization effective, it is necessary to make
8922 certain whole program assumptions. The compiler needs to know
8923 what functions and variables can be accessed by libraries and runtime
8924 outside of the link-time optimized unit. When supported by the linker,
8925 the linker plugin (see @option{-fuse-linker-plugin}) passes information
8926 to the compiler about used and externally visible symbols. When
8927 the linker plugin is not available, @option{-fwhole-program} should be
8928 used to allow the compiler to make these assumptions, which leads
8929 to more aggressive optimization decisions.
8930
8931 When @option{-fuse-linker-plugin} is not enabled then, when a file is
8932 compiled with @option{-flto}, the generated object file is larger than
8933 a regular object file because it contains GIMPLE bytecodes and the usual
8934 final code (see @option{-ffat-lto-objects}. This means that
8935 object files with LTO information can be linked as normal object
8936 files; if @option{-fno-lto} is passed to the linker, no
8937 interprocedural optimizations are applied. Note that when
8938 @option{-fno-fat-lto-objects} is enabled the compile-stage is faster
8939 but you cannot perform a regular, non-LTO link on them.
8940
8941 Additionally, the optimization flags used to compile individual files
8942 are not necessarily related to those used at link time. For instance,
8943
8944 @smallexample
8945 gcc -c -O0 -ffat-lto-objects -flto foo.c
8946 gcc -c -O0 -ffat-lto-objects -flto bar.c
8947 gcc -o myprog -O3 foo.o bar.o
8948 @end smallexample
8949
8950 This produces individual object files with unoptimized assembler
8951 code, but the resulting binary @file{myprog} is optimized at
8952 @option{-O3}. If, instead, the final binary is generated with
8953 @option{-fno-lto}, then @file{myprog} is not optimized.
8954
8955 When producing the final binary, GCC only
8956 applies link-time optimizations to those files that contain bytecode.
8957 Therefore, you can mix and match object files and libraries with
8958 GIMPLE bytecodes and final object code. GCC automatically selects
8959 which files to optimize in LTO mode and which files to link without
8960 further processing.
8961
8962 There are some code generation flags preserved by GCC when
8963 generating bytecodes, as they need to be used during the final link
8964 stage. Generally options specified at link-time override those
8965 specified at compile-time.
8966
8967 If you do not specify an optimization level option @option{-O} at
8968 link-time then GCC will compute one based on the optimization levels
8969 used when compiling the object files. The highest optimization
8970 level will win here.
8971
8972 Currently, the following options and their setting are take from
8973 the first object file that explicitely specified it:
8974 @option{-fPIC}, @option{-fpic}, @option{-fpie}, @option{-fcommon},
8975 @option{-fexceptions}, @option{-fnon-call-exceptions}, @option{-fgnu-tm}
8976 and all the @option{-m} target flags.
8977
8978 Certain ABI changing flags are required to match in all compilation-units
8979 and trying to override this at link-time with a conflicting value
8980 is ignored. This includes options such as @option{-freg-struct-return}
8981 and @option{-fpcc-struct-return}.
8982
8983 Other options such as @option{-ffp-contract}, @option{-fno-strict-overflow},
8984 @option{-fwrapv}, @option{-fno-trapv} or @option{-fno-strict-aliasing}
8985 are passed through to the link stage and merged conservatively for
8986 conflicting translation units. Specifically
8987 @option{-fno-strict-overflow}, @option{-fwrapv} and @option{-fno-trapv} take
8988 precedence and for example @option{-ffp-contract=off} takes precedence
8989 over @option{-ffp-contract=fast}. You can override them at linke-time.
8990
8991 It is recommended that you compile all the files participating in the
8992 same link with the same options and also specify those options at
8993 link time.
8994
8995 If LTO encounters objects with C linkage declared with incompatible
8996 types in separate translation units to be linked together (undefined
8997 behavior according to ISO C99 6.2.7), a non-fatal diagnostic may be
8998 issued. The behavior is still undefined at run time. Similar
8999 diagnostics may be raised for other languages.
9000
9001 Another feature of LTO is that it is possible to apply interprocedural
9002 optimizations on files written in different languages:
9003
9004 @smallexample
9005 gcc -c -flto foo.c
9006 g++ -c -flto bar.cc
9007 gfortran -c -flto baz.f90
9008 g++ -o myprog -flto -O3 foo.o bar.o baz.o -lgfortran
9009 @end smallexample
9010
9011 Notice that the final link is done with @command{g++} to get the C++
9012 runtime libraries and @option{-lgfortran} is added to get the Fortran
9013 runtime libraries. In general, when mixing languages in LTO mode, you
9014 should use the same link command options as when mixing languages in a
9015 regular (non-LTO) compilation.
9016
9017 If object files containing GIMPLE bytecode are stored in a library archive, say
9018 @file{libfoo.a}, it is possible to extract and use them in an LTO link if you
9019 are using a linker with plugin support. To create static libraries suitable
9020 for LTO, use @command{gcc-ar} and @command{gcc-ranlib} instead of @command{ar}
9021 and @code{ranlib}; to show the symbols of object files with GIMPLE bytecode, use
9022 @command{gcc-nm}. Those commands require that @command{ar}, @command{ranlib}
9023 and @command{nm} have been compiled with plugin support. At link time, use the the
9024 flag @option{-fuse-linker-plugin} to ensure that the library participates in
9025 the LTO optimization process:
9026
9027 @smallexample
9028 gcc -o myprog -O2 -flto -fuse-linker-plugin a.o b.o -lfoo
9029 @end smallexample
9030
9031 With the linker plugin enabled, the linker extracts the needed
9032 GIMPLE files from @file{libfoo.a} and passes them on to the running GCC
9033 to make them part of the aggregated GIMPLE image to be optimized.
9034
9035 If you are not using a linker with plugin support and/or do not
9036 enable the linker plugin, then the objects inside @file{libfoo.a}
9037 are extracted and linked as usual, but they do not participate
9038 in the LTO optimization process. In order to make a static library suitable
9039 for both LTO optimization and usual linkage, compile its object files with
9040 @option{-flto} @code{-ffat-lto-objects}.
9041
9042 Link-time optimizations do not require the presence of the whole program to
9043 operate. If the program does not require any symbols to be exported, it is
9044 possible to combine @option{-flto} and @option{-fwhole-program} to allow
9045 the interprocedural optimizers to use more aggressive assumptions which may
9046 lead to improved optimization opportunities.
9047 Use of @option{-fwhole-program} is not needed when linker plugin is
9048 active (see @option{-fuse-linker-plugin}).
9049
9050 The current implementation of LTO makes no
9051 attempt to generate bytecode that is portable between different
9052 types of hosts. The bytecode files are versioned and there is a
9053 strict version check, so bytecode files generated in one version of
9054 GCC will not work with an older or newer version of GCC.
9055
9056 Link-time optimization does not work well with generation of debugging
9057 information. Combining @option{-flto} with
9058 @option{-g} is currently experimental and expected to produce unexpected
9059 results.
9060
9061 If you specify the optional @var{n}, the optimization and code
9062 generation done at link time is executed in parallel using @var{n}
9063 parallel jobs by utilizing an installed @command{make} program. The
9064 environment variable @env{MAKE} may be used to override the program
9065 used. The default value for @var{n} is 1.
9066
9067 You can also specify @option{-flto=jobserver} to use GNU make's
9068 job server mode to determine the number of parallel jobs. This
9069 is useful when the Makefile calling GCC is already executing in parallel.
9070 You must prepend a @samp{+} to the command recipe in the parent Makefile
9071 for this to work. This option likely only works if @env{MAKE} is
9072 GNU make.
9073
9074 @item -flto-partition=@var{alg}
9075 @opindex flto-partition
9076 Specify the partitioning algorithm used by the link-time optimizer.
9077 The value is either @code{1to1} to specify a partitioning mirroring
9078 the original source files or @code{balanced} to specify partitioning
9079 into equally sized chunks (whenever possible) or @code{max} to create
9080 new partition for every symbol where possible. Specifying @code{none}
9081 as an algorithm disables partitioning and streaming completely.
9082 The default value is @code{balanced}. While @code{1to1} can be used
9083 as an workaround for various code ordering issues, the @code{max}
9084 partitioning is intended for internal testing only.
9085 The value @code{one} specifies that exactly one partition should be
9086 used while the value @code{none} bypasses partitioning and executes
9087 the link-time optimization step directly from the WPA phase.
9088
9089 @item -flto-odr-type-merging
9090 @opindex flto-odr-type-merging
9091 Enable streaming of mangled types names of C++ types and their unification
9092 at linktime. This increases size of LTO object files, but enable
9093 diagnostics about One Definition Rule violations.
9094
9095 @item -flto-compression-level=@var{n}
9096 This option specifies the level of compression used for intermediate
9097 language written to LTO object files, and is only meaningful in
9098 conjunction with LTO mode (@option{-flto}). Valid
9099 values are 0 (no compression) to 9 (maximum compression). Values
9100 outside this range are clamped to either 0 or 9. If the option is not
9101 given, a default balanced compression setting is used.
9102
9103 @item -flto-report
9104 Prints a report with internal details on the workings of the link-time
9105 optimizer. The contents of this report vary from version to version.
9106 It is meant to be useful to GCC developers when processing object
9107 files in LTO mode (via @option{-flto}).
9108
9109 Disabled by default.
9110
9111 @item -flto-report-wpa
9112 Like @option{-flto-report}, but only print for the WPA phase of Link
9113 Time Optimization.
9114
9115 @item -fuse-linker-plugin
9116 Enables the use of a linker plugin during link-time optimization. This
9117 option relies on plugin support in the linker, which is available in gold
9118 or in GNU ld 2.21 or newer.
9119
9120 This option enables the extraction of object files with GIMPLE bytecode out
9121 of library archives. This improves the quality of optimization by exposing
9122 more code to the link-time optimizer. This information specifies what
9123 symbols can be accessed externally (by non-LTO object or during dynamic
9124 linking). Resulting code quality improvements on binaries (and shared
9125 libraries that use hidden visibility) are similar to @code{-fwhole-program}.
9126 See @option{-flto} for a description of the effect of this flag and how to
9127 use it.
9128
9129 This option is enabled by default when LTO support in GCC is enabled
9130 and GCC was configured for use with
9131 a linker supporting plugins (GNU ld 2.21 or newer or gold).
9132
9133 @item -ffat-lto-objects
9134 @opindex ffat-lto-objects
9135 Fat LTO objects are object files that contain both the intermediate language
9136 and the object code. This makes them usable for both LTO linking and normal
9137 linking. This option is effective only when compiling with @option{-flto}
9138 and is ignored at link time.
9139
9140 @option{-fno-fat-lto-objects} improves compilation time over plain LTO, but
9141 requires the complete toolchain to be aware of LTO. It requires a linker with
9142 linker plugin support for basic functionality. Additionally,
9143 @command{nm}, @command{ar} and @command{ranlib}
9144 need to support linker plugins to allow a full-featured build environment
9145 (capable of building static libraries etc). GCC provides the @command{gcc-ar},
9146 @command{gcc-nm}, @command{gcc-ranlib} wrappers to pass the right options
9147 to these tools. With non fat LTO makefiles need to be modified to use them.
9148
9149 The default is @option{-fno-fat-lto-objects} on targets with linker plugin
9150 support.
9151
9152 @item -fcompare-elim
9153 @opindex fcompare-elim
9154 After register allocation and post-register allocation instruction splitting,
9155 identify arithmetic instructions that compute processor flags similar to a
9156 comparison operation based on that arithmetic. If possible, eliminate the
9157 explicit comparison operation.
9158
9159 This pass only applies to certain targets that cannot explicitly represent
9160 the comparison operation before register allocation is complete.
9161
9162 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
9163
9164 @item -fuse-ld=bfd
9165 @opindex fuse-ld=bfd
9166 Use the @command{bfd} linker instead of the default linker.
9167
9168 @item -fuse-ld=gold
9169 @opindex fuse-ld=gold
9170 Use the @command{gold} linker instead of the default linker.
9171
9172 @item -fcprop-registers
9173 @opindex fcprop-registers
9174 After register allocation and post-register allocation instruction splitting,
9175 perform a copy-propagation pass to try to reduce scheduling dependencies
9176 and occasionally eliminate the copy.
9177
9178 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
9179
9180 @item -fprofile-correction
9181 @opindex fprofile-correction
9182 Profiles collected using an instrumented binary for multi-threaded programs may
9183 be inconsistent due to missed counter updates. When this option is specified,
9184 GCC uses heuristics to correct or smooth out such inconsistencies. By
9185 default, GCC emits an error message when an inconsistent profile is detected.
9186
9187 @item -fprofile-dir=@var{path}
9188 @opindex fprofile-dir
9189
9190 Set the directory to search for the profile data files in to @var{path}.
9191 This option affects only the profile data generated by
9192 @option{-fprofile-generate}, @option{-ftest-coverage}, @option{-fprofile-arcs}
9193 and used by @option{-fprofile-use} and @option{-fbranch-probabilities}
9194 and its related options. Both absolute and relative paths can be used.
9195 By default, GCC uses the current directory as @var{path}, thus the
9196 profile data file appears in the same directory as the object file.
9197
9198 @item -fprofile-generate
9199 @itemx -fprofile-generate=@var{path}
9200 @opindex fprofile-generate
9201
9202 Enable options usually used for instrumenting application to produce
9203 profile useful for later recompilation with profile feedback based
9204 optimization. You must use @option{-fprofile-generate} both when
9205 compiling and when linking your program.
9206
9207 The following options are enabled: @code{-fprofile-arcs}, @code{-fprofile-values}, @code{-fvpt}.
9208
9209 If @var{path} is specified, GCC looks at the @var{path} to find
9210 the profile feedback data files. See @option{-fprofile-dir}.
9211
9212 @item -fprofile-use
9213 @itemx -fprofile-use=@var{path}
9214 @opindex fprofile-use
9215 Enable profile feedback directed optimizations, and optimizations
9216 generally profitable only with profile feedback available.
9217
9218 The following options are enabled: @code{-fbranch-probabilities}, @code{-fvpt},
9219 @code{-funroll-loops}, @code{-fpeel-loops}, @code{-ftracer}, @code{-ftree-vectorize},
9220 @code{ftree-loop-distribute-patterns}
9221
9222 By default, GCC emits an error message if the feedback profiles do not
9223 match the source code. This error can be turned into a warning by using
9224 @option{-Wcoverage-mismatch}. Note this may result in poorly optimized
9225 code.
9226
9227 If @var{path} is specified, GCC looks at the @var{path} to find
9228 the profile feedback data files. See @option{-fprofile-dir}.
9229
9230 @item -fauto-profile
9231 @itemx -fauto-profile=@var{path}
9232 @opindex fauto-profile
9233 Enable sampling based feedback directed optimizations, and optimizations
9234 generally profitable only with profile feedback available.
9235
9236 The following options are enabled: @code{-fbranch-probabilities}, @code{-fvpt},
9237 @code{-funroll-loops}, @code{-fpeel-loops}, @code{-ftracer}, @code{-ftree-vectorize},
9238 @code{-finline-functions}, @code{-fipa-cp}, @code{-fipa-cp-clone},
9239 @code{-fpredictive-commoning}, @code{-funswitch-loops},
9240 @code{-fgcse-after-reload}, @code{-ftree-loop-distribute-patterns},
9241
9242 If @var{path} is specified, GCC looks at the @var{path} to find
9243 the profile feedback data files.
9244
9245 In order to collect AutoFDO profile, you need to have:
9246
9247 1. A linux system with linux perf support
9248 2. (optional) An Intel processor with last branch record (LBR) support. This is
9249 to guarantee accurate instruction level profile, which is important for
9250 AutoFDO performance.
9251
9252 To collect the profile, first use linux perf to collect raw profile
9253 (see @uref{https://perf.wiki.kernel.org/}).
9254
9255 E.g.
9256 @code{perf record -e br_inst_retired:near_taken -b -o perf.data -- your_program}
9257
9258 Then use create_gcov tool, which takes raw profile and unstripped binary to
9259 generate AutoFDO profile that can be used by GCC.
9260 (see @uref{https://github.com/google/autofdo}).
9261
9262 E.g.
9263 @code{create_gcov --binary=your_program.unstripped --profile=perf.data --gcov=profile.afdo}
9264 @end table
9265
9266 The following options control compiler behavior regarding floating-point
9267 arithmetic. These options trade off between speed and
9268 correctness. All must be specifically enabled.
9269
9270 @table @gcctabopt
9271 @item -ffloat-store
9272 @opindex ffloat-store
9273 Do not store floating-point variables in registers, and inhibit other
9274 options that might change whether a floating-point value is taken from a
9275 register or memory.
9276
9277 @cindex floating-point precision
9278 This option prevents undesirable excess precision on machines such as
9279 the 68000 where the floating registers (of the 68881) keep more
9280 precision than a @code{double} is supposed to have. Similarly for the
9281 x86 architecture. For most programs, the excess precision does only
9282 good, but a few programs rely on the precise definition of IEEE floating
9283 point. Use @option{-ffloat-store} for such programs, after modifying
9284 them to store all pertinent intermediate computations into variables.
9285
9286 @item -fexcess-precision=@var{style}
9287 @opindex fexcess-precision
9288 This option allows further control over excess precision on machines
9289 where floating-point registers have more precision than the IEEE
9290 @code{float} and @code{double} types and the processor does not
9291 support operations rounding to those types. By default,
9292 @option{-fexcess-precision=fast} is in effect; this means that
9293 operations are carried out in the precision of the registers and that
9294 it is unpredictable when rounding to the types specified in the source
9295 code takes place. When compiling C, if
9296 @option{-fexcess-precision=standard} is specified then excess
9297 precision follows the rules specified in ISO C99; in particular,
9298 both casts and assignments cause values to be rounded to their
9299 semantic types (whereas @option{-ffloat-store} only affects
9300 assignments). This option is enabled by default for C if a strict
9301 conformance option such as @option{-std=c99} is used.
9302
9303 @opindex mfpmath
9304 @option{-fexcess-precision=standard} is not implemented for languages
9305 other than C, and has no effect if
9306 @option{-funsafe-math-optimizations} or @option{-ffast-math} is
9307 specified. On the x86, it also has no effect if @option{-mfpmath=sse}
9308 or @option{-mfpmath=sse+387} is specified; in the former case, IEEE
9309 semantics apply without excess precision, and in the latter, rounding
9310 is unpredictable.
9311
9312 @item -ffast-math
9313 @opindex ffast-math
9314 Sets @option{-fno-math-errno}, @option{-funsafe-math-optimizations},
9315 @option{-ffinite-math-only}, @option{-fno-rounding-math},
9316 @option{-fno-signaling-nans} and @option{-fcx-limited-range}.
9317
9318 This option causes the preprocessor macro @code{__FAST_MATH__} to be defined.
9319
9320 This option is not turned on by any @option{-O} option besides
9321 @option{-Ofast} since it can result in incorrect output for programs
9322 that depend on an exact implementation of IEEE or ISO rules/specifications
9323 for math functions. It may, however, yield faster code for programs
9324 that do not require the guarantees of these specifications.
9325
9326 @item -fno-math-errno
9327 @opindex fno-math-errno
9328 Do not set @code{errno} after calling math functions that are executed
9329 with a single instruction, e.g., @code{sqrt}. A program that relies on
9330 IEEE exceptions for math error handling may want to use this flag
9331 for speed while maintaining IEEE arithmetic compatibility.
9332
9333 This option is not turned on by any @option{-O} option since
9334 it can result in incorrect output for programs that depend on
9335 an exact implementation of IEEE or ISO rules/specifications for
9336 math functions. It may, however, yield faster code for programs
9337 that do not require the guarantees of these specifications.
9338
9339 The default is @option{-fmath-errno}.
9340
9341 On Darwin systems, the math library never sets @code{errno}. There is
9342 therefore no reason for the compiler to consider the possibility that
9343 it might, and @option{-fno-math-errno} is the default.
9344
9345 @item -funsafe-math-optimizations
9346 @opindex funsafe-math-optimizations
9347
9348 Allow optimizations for floating-point arithmetic that (a) assume
9349 that arguments and results are valid and (b) may violate IEEE or
9350 ANSI standards. When used at link-time, it may include libraries
9351 or startup files that change the default FPU control word or other
9352 similar optimizations.
9353
9354 This option is not turned on by any @option{-O} option since
9355 it can result in incorrect output for programs that depend on
9356 an exact implementation of IEEE or ISO rules/specifications for
9357 math functions. It may, however, yield faster code for programs
9358 that do not require the guarantees of these specifications.
9359 Enables @option{-fno-signed-zeros}, @option{-fno-trapping-math},
9360 @option{-fassociative-math} and @option{-freciprocal-math}.
9361
9362 The default is @option{-fno-unsafe-math-optimizations}.
9363
9364 @item -fassociative-math
9365 @opindex fassociative-math
9366
9367 Allow re-association of operands in series of floating-point operations.
9368 This violates the ISO C and C++ language standard by possibly changing
9369 computation result. NOTE: re-ordering may change the sign of zero as
9370 well as ignore NaNs and inhibit or create underflow or overflow (and
9371 thus cannot be used on code that relies on rounding behavior like
9372 @code{(x + 2**52) - 2**52}. May also reorder floating-point comparisons
9373 and thus may not be used when ordered comparisons are required.
9374 This option requires that both @option{-fno-signed-zeros} and
9375 @option{-fno-trapping-math} be in effect. Moreover, it doesn't make
9376 much sense with @option{-frounding-math}. For Fortran the option
9377 is automatically enabled when both @option{-fno-signed-zeros} and
9378 @option{-fno-trapping-math} are in effect.
9379
9380 The default is @option{-fno-associative-math}.
9381
9382 @item -freciprocal-math
9383 @opindex freciprocal-math
9384
9385 Allow the reciprocal of a value to be used instead of dividing by
9386 the value if this enables optimizations. For example @code{x / y}
9387 can be replaced with @code{x * (1/y)}, which is useful if @code{(1/y)}
9388 is subject to common subexpression elimination. Note that this loses
9389 precision and increases the number of flops operating on the value.
9390
9391 The default is @option{-fno-reciprocal-math}.
9392
9393 @item -ffinite-math-only
9394 @opindex ffinite-math-only
9395 Allow optimizations for floating-point arithmetic that assume
9396 that arguments and results are not NaNs or +-Infs.
9397
9398 This option is not turned on by any @option{-O} option since
9399 it can result in incorrect output for programs that depend on
9400 an exact implementation of IEEE or ISO rules/specifications for
9401 math functions. It may, however, yield faster code for programs
9402 that do not require the guarantees of these specifications.
9403
9404 The default is @option{-fno-finite-math-only}.
9405
9406 @item -fno-signed-zeros
9407 @opindex fno-signed-zeros
9408 Allow optimizations for floating-point arithmetic that ignore the
9409 signedness of zero. IEEE arithmetic specifies the behavior of
9410 distinct +0.0 and @minus{}0.0 values, which then prohibits simplification
9411 of expressions such as x+0.0 or 0.0*x (even with @option{-ffinite-math-only}).
9412 This option implies that the sign of a zero result isn't significant.
9413
9414 The default is @option{-fsigned-zeros}.
9415
9416 @item -fno-trapping-math
9417 @opindex fno-trapping-math
9418 Compile code assuming that floating-point operations cannot generate
9419 user-visible traps. These traps include division by zero, overflow,
9420 underflow, inexact result and invalid operation. This option requires
9421 that @option{-fno-signaling-nans} be in effect. Setting this option may
9422 allow faster code if one relies on ``non-stop'' IEEE arithmetic, for example.
9423
9424 This option should never be turned on by any @option{-O} option since
9425 it can result in incorrect output for programs that depend on
9426 an exact implementation of IEEE or ISO rules/specifications for
9427 math functions.
9428
9429 The default is @option{-ftrapping-math}.
9430
9431 @item -frounding-math
9432 @opindex frounding-math
9433 Disable transformations and optimizations that assume default floating-point
9434 rounding behavior. This is round-to-zero for all floating point
9435 to integer conversions, and round-to-nearest for all other arithmetic
9436 truncations. This option should be specified for programs that change
9437 the FP rounding mode dynamically, or that may be executed with a
9438 non-default rounding mode. This option disables constant folding of
9439 floating-point expressions at compile time (which may be affected by
9440 rounding mode) and arithmetic transformations that are unsafe in the
9441 presence of sign-dependent rounding modes.
9442
9443 The default is @option{-fno-rounding-math}.
9444
9445 This option is experimental and does not currently guarantee to
9446 disable all GCC optimizations that are affected by rounding mode.
9447 Future versions of GCC may provide finer control of this setting
9448 using C99's @code{FENV_ACCESS} pragma. This command-line option
9449 will be used to specify the default state for @code{FENV_ACCESS}.
9450
9451 @item -fsignaling-nans
9452 @opindex fsignaling-nans
9453 Compile code assuming that IEEE signaling NaNs may generate user-visible
9454 traps during floating-point operations. Setting this option disables
9455 optimizations that may change the number of exceptions visible with
9456 signaling NaNs. This option implies @option{-ftrapping-math}.
9457
9458 This option causes the preprocessor macro @code{__SUPPORT_SNAN__} to
9459 be defined.
9460
9461 The default is @option{-fno-signaling-nans}.
9462
9463 This option is experimental and does not currently guarantee to
9464 disable all GCC optimizations that affect signaling NaN behavior.
9465
9466 @item -fsingle-precision-constant
9467 @opindex fsingle-precision-constant
9468 Treat floating-point constants as single precision instead of
9469 implicitly converting them to double-precision constants.
9470
9471 @item -fcx-limited-range
9472 @opindex fcx-limited-range
9473 When enabled, this option states that a range reduction step is not
9474 needed when performing complex division. Also, there is no checking
9475 whether the result of a complex multiplication or division is @code{NaN
9476 + I*NaN}, with an attempt to rescue the situation in that case. The
9477 default is @option{-fno-cx-limited-range}, but is enabled by
9478 @option{-ffast-math}.
9479
9480 This option controls the default setting of the ISO C99
9481 @code{CX_LIMITED_RANGE} pragma. Nevertheless, the option applies to
9482 all languages.
9483
9484 @item -fcx-fortran-rules
9485 @opindex fcx-fortran-rules
9486 Complex multiplication and division follow Fortran rules. Range
9487 reduction is done as part of complex division, but there is no checking
9488 whether the result of a complex multiplication or division is @code{NaN
9489 + I*NaN}, with an attempt to rescue the situation in that case.
9490
9491 The default is @option{-fno-cx-fortran-rules}.
9492
9493 @end table
9494
9495 The following options control optimizations that may improve
9496 performance, but are not enabled by any @option{-O} options. This
9497 section includes experimental options that may produce broken code.
9498
9499 @table @gcctabopt
9500 @item -fbranch-probabilities
9501 @opindex fbranch-probabilities
9502 After running a program compiled with @option{-fprofile-arcs}
9503 (@pxref{Debugging Options,, Options for Debugging Your Program or
9504 @command{gcc}}), you can compile it a second time using
9505 @option{-fbranch-probabilities}, to improve optimizations based on
9506 the number of times each branch was taken. When a program
9507 compiled with @option{-fprofile-arcs} exits, it saves arc execution
9508 counts to a file called @file{@var{sourcename}.gcda} for each source
9509 file. The information in this data file is very dependent on the
9510 structure of the generated code, so you must use the same source code
9511 and the same optimization options for both compilations.
9512
9513 With @option{-fbranch-probabilities}, GCC puts a
9514 @samp{REG_BR_PROB} note on each @samp{JUMP_INSN} and @samp{CALL_INSN}.
9515 These can be used to improve optimization. Currently, they are only
9516 used in one place: in @file{reorg.c}, instead of guessing which path a
9517 branch is most likely to take, the @samp{REG_BR_PROB} values are used to
9518 exactly determine which path is taken more often.
9519
9520 @item -fprofile-values
9521 @opindex fprofile-values
9522 If combined with @option{-fprofile-arcs}, it adds code so that some
9523 data about values of expressions in the program is gathered.
9524
9525 With @option{-fbranch-probabilities}, it reads back the data gathered
9526 from profiling values of expressions for usage in optimizations.
9527
9528 Enabled with @option{-fprofile-generate} and @option{-fprofile-use}.
9529
9530 @item -fprofile-reorder-functions
9531 @opindex fprofile-reorder-functions
9532 Function reordering based on profile instrumentation collects
9533 first time of execution of a function and orders these functions
9534 in ascending order.
9535
9536 Enabled with @option{-fprofile-use}.
9537
9538 @item -fvpt
9539 @opindex fvpt
9540 If combined with @option{-fprofile-arcs}, this option instructs the compiler
9541 to add code to gather information about values of expressions.
9542
9543 With @option{-fbranch-probabilities}, it reads back the data gathered
9544 and actually performs the optimizations based on them.
9545 Currently the optimizations include specialization of division operations
9546 using the knowledge about the value of the denominator.
9547
9548 @item -frename-registers
9549 @opindex frename-registers
9550 Attempt to avoid false dependencies in scheduled code by making use
9551 of registers left over after register allocation. This optimization
9552 most benefits processors with lots of registers. Depending on the
9553 debug information format adopted by the target, however, it can
9554 make debugging impossible, since variables no longer stay in
9555 a ``home register''.
9556
9557 Enabled by default with @option{-funroll-loops} and @option{-fpeel-loops}.
9558
9559 @item -ftracer
9560 @opindex ftracer
9561 Perform tail duplication to enlarge superblock size. This transformation
9562 simplifies the control flow of the function allowing other optimizations to do
9563 a better job.
9564
9565 Enabled with @option{-fprofile-use}.
9566
9567 @item -funroll-loops
9568 @opindex funroll-loops
9569 Unroll loops whose number of iterations can be determined at compile time or
9570 upon entry to the loop. @option{-funroll-loops} implies
9571 @option{-frerun-cse-after-loop}, @option{-fweb} and @option{-frename-registers}.
9572 It also turns on complete loop peeling (i.e.@: complete removal of loops with
9573 a small constant number of iterations). This option makes code larger, and may
9574 or may not make it run faster.
9575
9576 Enabled with @option{-fprofile-use}.
9577
9578 @item -funroll-all-loops
9579 @opindex funroll-all-loops
9580 Unroll all loops, even if their number of iterations is uncertain when
9581 the loop is entered. This usually makes programs run more slowly.
9582 @option{-funroll-all-loops} implies the same options as
9583 @option{-funroll-loops}.
9584
9585 @item -fpeel-loops
9586 @opindex fpeel-loops
9587 Peels loops for which there is enough information that they do not
9588 roll much (from profile feedback). It also turns on complete loop peeling
9589 (i.e.@: complete removal of loops with small constant number of iterations).
9590
9591 Enabled with @option{-fprofile-use}.
9592
9593 @item -fmove-loop-invariants
9594 @opindex fmove-loop-invariants
9595 Enables the loop invariant motion pass in the RTL loop optimizer. Enabled
9596 at level @option{-O1}
9597
9598 @item -funswitch-loops
9599 @opindex funswitch-loops
9600 Move branches with loop invariant conditions out of the loop, with duplicates
9601 of the loop on both branches (modified according to result of the condition).
9602
9603 @item -ffunction-sections
9604 @itemx -fdata-sections
9605 @opindex ffunction-sections
9606 @opindex fdata-sections
9607 Place each function or data item into its own section in the output
9608 file if the target supports arbitrary sections. The name of the
9609 function or the name of the data item determines the section's name
9610 in the output file.
9611
9612 Use these options on systems where the linker can perform optimizations
9613 to improve locality of reference in the instruction space. Most systems
9614 using the ELF object format and SPARC processors running Solaris 2 have
9615 linkers with such optimizations. AIX may have these optimizations in
9616 the future.
9617
9618 Only use these options when there are significant benefits from doing
9619 so. When you specify these options, the assembler and linker
9620 create larger object and executable files and are also slower.
9621 You cannot use @code{gprof} on all systems if you
9622 specify this option, and you may have problems with debugging if
9623 you specify both this option and @option{-g}.
9624
9625 @item -fbranch-target-load-optimize
9626 @opindex fbranch-target-load-optimize
9627 Perform branch target register load optimization before prologue / epilogue
9628 threading.
9629 The use of target registers can typically be exposed only during reload,
9630 thus hoisting loads out of loops and doing inter-block scheduling needs
9631 a separate optimization pass.
9632
9633 @item -fbranch-target-load-optimize2
9634 @opindex fbranch-target-load-optimize2
9635 Perform branch target register load optimization after prologue / epilogue
9636 threading.
9637
9638 @item -fbtr-bb-exclusive
9639 @opindex fbtr-bb-exclusive
9640 When performing branch target register load optimization, don't reuse
9641 branch target registers within any basic block.
9642
9643 @item -fstack-protector
9644 @opindex fstack-protector
9645 Emit extra code to check for buffer overflows, such as stack smashing
9646 attacks. This is done by adding a guard variable to functions with
9647 vulnerable objects. This includes functions that call @code{alloca}, and
9648 functions with buffers larger than 8 bytes. The guards are initialized
9649 when a function is entered and then checked when the function exits.
9650 If a guard check fails, an error message is printed and the program exits.
9651
9652 @item -fstack-protector-all
9653 @opindex fstack-protector-all
9654 Like @option{-fstack-protector} except that all functions are protected.
9655
9656 @item -fstack-protector-strong
9657 @opindex fstack-protector-strong
9658 Like @option{-fstack-protector} but includes additional functions to
9659 be protected --- those that have local array definitions, or have
9660 references to local frame addresses.
9661
9662 @item -fsection-anchors
9663 @opindex fsection-anchors
9664 Try to reduce the number of symbolic address calculations by using
9665 shared ``anchor'' symbols to address nearby objects. This transformation
9666 can help to reduce the number of GOT entries and GOT accesses on some
9667 targets.
9668
9669 For example, the implementation of the following function @code{foo}:
9670
9671 @smallexample
9672 static int a, b, c;
9673 int foo (void) @{ return a + b + c; @}
9674 @end smallexample
9675
9676 @noindent
9677 usually calculates the addresses of all three variables, but if you
9678 compile it with @option{-fsection-anchors}, it accesses the variables
9679 from a common anchor point instead. The effect is similar to the
9680 following pseudocode (which isn't valid C):
9681
9682 @smallexample
9683 int foo (void)
9684 @{
9685 register int *xr = &x;
9686 return xr[&a - &x] + xr[&b - &x] + xr[&c - &x];
9687 @}
9688 @end smallexample
9689
9690 Not all targets support this option.
9691
9692 @item --param @var{name}=@var{value}
9693 @opindex param
9694 In some places, GCC uses various constants to control the amount of
9695 optimization that is done. For example, GCC does not inline functions
9696 that contain more than a certain number of instructions. You can
9697 control some of these constants on the command line using the
9698 @option{--param} option.
9699
9700 The names of specific parameters, and the meaning of the values, are
9701 tied to the internals of the compiler, and are subject to change
9702 without notice in future releases.
9703
9704 In each case, the @var{value} is an integer. The allowable choices for
9705 @var{name} are:
9706
9707 @table @gcctabopt
9708 @item predictable-branch-outcome
9709 When branch is predicted to be taken with probability lower than this threshold
9710 (in percent), then it is considered well predictable. The default is 10.
9711
9712 @item max-crossjump-edges
9713 The maximum number of incoming edges to consider for cross-jumping.
9714 The algorithm used by @option{-fcrossjumping} is @math{O(N^2)} in
9715 the number of edges incoming to each block. Increasing values mean
9716 more aggressive optimization, making the compilation time increase with
9717 probably small improvement in executable size.
9718
9719 @item min-crossjump-insns
9720 The minimum number of instructions that must be matched at the end
9721 of two blocks before cross-jumping is performed on them. This
9722 value is ignored in the case where all instructions in the block being
9723 cross-jumped from are matched. The default value is 5.
9724
9725 @item max-grow-copy-bb-insns
9726 The maximum code size expansion factor when copying basic blocks
9727 instead of jumping. The expansion is relative to a jump instruction.
9728 The default value is 8.
9729
9730 @item max-goto-duplication-insns
9731 The maximum number of instructions to duplicate to a block that jumps
9732 to a computed goto. To avoid @math{O(N^2)} behavior in a number of
9733 passes, GCC factors computed gotos early in the compilation process,
9734 and unfactors them as late as possible. Only computed jumps at the
9735 end of a basic blocks with no more than max-goto-duplication-insns are
9736 unfactored. The default value is 8.
9737
9738 @item max-delay-slot-insn-search
9739 The maximum number of instructions to consider when looking for an
9740 instruction to fill a delay slot. If more than this arbitrary number of
9741 instructions are searched, the time savings from filling the delay slot
9742 are minimal, so stop searching. Increasing values mean more
9743 aggressive optimization, making the compilation time increase with probably
9744 small improvement in execution time.
9745
9746 @item max-delay-slot-live-search
9747 When trying to fill delay slots, the maximum number of instructions to
9748 consider when searching for a block with valid live register
9749 information. Increasing this arbitrarily chosen value means more
9750 aggressive optimization, increasing the compilation time. This parameter
9751 should be removed when the delay slot code is rewritten to maintain the
9752 control-flow graph.
9753
9754 @item max-gcse-memory
9755 The approximate maximum amount of memory that can be allocated in
9756 order to perform the global common subexpression elimination
9757 optimization. If more memory than specified is required, the
9758 optimization is not done.
9759
9760 @item max-gcse-insertion-ratio
9761 If the ratio of expression insertions to deletions is larger than this value
9762 for any expression, then RTL PRE inserts or removes the expression and thus
9763 leaves partially redundant computations in the instruction stream. The default value is 20.
9764
9765 @item max-pending-list-length
9766 The maximum number of pending dependencies scheduling allows
9767 before flushing the current state and starting over. Large functions
9768 with few branches or calls can create excessively large lists which
9769 needlessly consume memory and resources.
9770
9771 @item max-modulo-backtrack-attempts
9772 The maximum number of backtrack attempts the scheduler should make
9773 when modulo scheduling a loop. Larger values can exponentially increase
9774 compilation time.
9775
9776 @item max-inline-insns-single
9777 Several parameters control the tree inliner used in GCC@.
9778 This number sets the maximum number of instructions (counted in GCC's
9779 internal representation) in a single function that the tree inliner
9780 considers for inlining. This only affects functions declared
9781 inline and methods implemented in a class declaration (C++).
9782 The default value is 400.
9783
9784 @item max-inline-insns-auto
9785 When you use @option{-finline-functions} (included in @option{-O3}),
9786 a lot of functions that would otherwise not be considered for inlining
9787 by the compiler are investigated. To those functions, a different
9788 (more restrictive) limit compared to functions declared inline can
9789 be applied.
9790 The default value is 40.
9791
9792 @item inline-min-speedup
9793 When estimated performance improvement of caller + callee runtime exceeds this
9794 threshold (in precent), the function can be inlined regardless the limit on
9795 @option{--param max-inline-insns-single} and @option{--param
9796 max-inline-insns-auto}.
9797
9798 @item large-function-insns
9799 The limit specifying really large functions. For functions larger than this
9800 limit after inlining, inlining is constrained by
9801 @option{--param large-function-growth}. This parameter is useful primarily
9802 to avoid extreme compilation time caused by non-linear algorithms used by the
9803 back end.
9804 The default value is 2700.
9805
9806 @item large-function-growth
9807 Specifies maximal growth of large function caused by inlining in percents.
9808 The default value is 100 which limits large function growth to 2.0 times
9809 the original size.
9810
9811 @item large-unit-insns
9812 The limit specifying large translation unit. Growth caused by inlining of
9813 units larger than this limit is limited by @option{--param inline-unit-growth}.
9814 For small units this might be too tight.
9815 For example, consider a unit consisting of function A
9816 that is inline and B that just calls A three times. If B is small relative to
9817 A, the growth of unit is 300\% and yet such inlining is very sane. For very
9818 large units consisting of small inlineable functions, however, the overall unit
9819 growth limit is needed to avoid exponential explosion of code size. Thus for
9820 smaller units, the size is increased to @option{--param large-unit-insns}
9821 before applying @option{--param inline-unit-growth}. The default is 10000.
9822
9823 @item inline-unit-growth
9824 Specifies maximal overall growth of the compilation unit caused by inlining.
9825 The default value is 30 which limits unit growth to 1.3 times the original
9826 size. Cold functions (either marked cold via an attribute or by profile
9827 feedback) are not accounted into the unit size.
9828
9829 @item ipcp-unit-growth
9830 Specifies maximal overall growth of the compilation unit caused by
9831 interprocedural constant propagation. The default value is 10 which limits
9832 unit growth to 1.1 times the original size.
9833
9834 @item large-stack-frame
9835 The limit specifying large stack frames. While inlining the algorithm is trying
9836 to not grow past this limit too much. The default value is 256 bytes.
9837
9838 @item large-stack-frame-growth
9839 Specifies maximal growth of large stack frames caused by inlining in percents.
9840 The default value is 1000 which limits large stack frame growth to 11 times
9841 the original size.
9842
9843 @item max-inline-insns-recursive
9844 @itemx max-inline-insns-recursive-auto
9845 Specifies the maximum number of instructions an out-of-line copy of a
9846 self-recursive inline
9847 function can grow into by performing recursive inlining.
9848
9849 For functions declared inline, @option{--param max-inline-insns-recursive} is
9850 taken into account. For functions not declared inline, recursive inlining
9851 happens only when @option{-finline-functions} (included in @option{-O3}) is
9852 enabled and @option{--param max-inline-insns-recursive-auto} is used. The
9853 default value is 450.
9854
9855 @item max-inline-recursive-depth
9856 @itemx max-inline-recursive-depth-auto
9857 Specifies the maximum recursion depth used for recursive inlining.
9858
9859 For functions declared inline, @option{--param max-inline-recursive-depth} is
9860 taken into account. For functions not declared inline, recursive inlining
9861 happens only when @option{-finline-functions} (included in @option{-O3}) is
9862 enabled and @option{--param max-inline-recursive-depth-auto} is used. The
9863 default value is 8.
9864
9865 @item min-inline-recursive-probability
9866 Recursive inlining is profitable only for function having deep recursion
9867 in average and can hurt for function having little recursion depth by
9868 increasing the prologue size or complexity of function body to other
9869 optimizers.
9870
9871 When profile feedback is available (see @option{-fprofile-generate}) the actual
9872 recursion depth can be guessed from probability that function recurses via a
9873 given call expression. This parameter limits inlining only to call expressions
9874 whose probability exceeds the given threshold (in percents).
9875 The default value is 10.
9876
9877 @item early-inlining-insns
9878 Specify growth that the early inliner can make. In effect it increases
9879 the amount of inlining for code having a large abstraction penalty.
9880 The default value is 10.
9881
9882 @item max-early-inliner-iterations
9883 @itemx max-early-inliner-iterations
9884 Limit of iterations of the early inliner. This basically bounds
9885 the number of nested indirect calls the early inliner can resolve.
9886 Deeper chains are still handled by late inlining.
9887
9888 @item comdat-sharing-probability
9889 @itemx comdat-sharing-probability
9890 Probability (in percent) that C++ inline function with comdat visibility
9891 are shared across multiple compilation units. The default value is 20.
9892
9893 @item profile-func-internal-id
9894 @itemx profile-func-internal-id
9895 A parameter to control whether to use function internal id in profile
9896 database lookup. If the value is 0, the compiler will use id that
9897 is based on function assembler name and filename, which makes old profile
9898 data more tolerant to source changes such as function reordering etc.
9899 The default value is 0.
9900
9901 @item min-vect-loop-bound
9902 The minimum number of iterations under which loops are not vectorized
9903 when @option{-ftree-vectorize} is used. The number of iterations after
9904 vectorization needs to be greater than the value specified by this option
9905 to allow vectorization. The default value is 0.
9906
9907 @item gcse-cost-distance-ratio
9908 Scaling factor in calculation of maximum distance an expression
9909 can be moved by GCSE optimizations. This is currently supported only in the
9910 code hoisting pass. The bigger the ratio, the more aggressive code hoisting
9911 is with simple expressions, i.e., the expressions that have cost
9912 less than @option{gcse-unrestricted-cost}. Specifying 0 disables
9913 hoisting of simple expressions. The default value is 10.
9914
9915 @item gcse-unrestricted-cost
9916 Cost, roughly measured as the cost of a single typical machine
9917 instruction, at which GCSE optimizations do not constrain
9918 the distance an expression can travel. This is currently
9919 supported only in the code hoisting pass. The lesser the cost,
9920 the more aggressive code hoisting is. Specifying 0
9921 allows all expressions to travel unrestricted distances.
9922 The default value is 3.
9923
9924 @item max-hoist-depth
9925 The depth of search in the dominator tree for expressions to hoist.
9926 This is used to avoid quadratic behavior in hoisting algorithm.
9927 The value of 0 does not limit on the search, but may slow down compilation
9928 of huge functions. The default value is 30.
9929
9930 @item max-tail-merge-comparisons
9931 The maximum amount of similar bbs to compare a bb with. This is used to
9932 avoid quadratic behavior in tree tail merging. The default value is 10.
9933
9934 @item max-tail-merge-iterations
9935 The maximum amount of iterations of the pass over the function. This is used to
9936 limit compilation time in tree tail merging. The default value is 2.
9937
9938 @item max-unrolled-insns
9939 The maximum number of instructions that a loop may have to be unrolled.
9940 If a loop is unrolled, this parameter also determines how many times
9941 the loop code is unrolled.
9942
9943 @item max-average-unrolled-insns
9944 The maximum number of instructions biased by probabilities of their execution
9945 that a loop may have to be unrolled. If a loop is unrolled,
9946 this parameter also determines how many times the loop code is unrolled.
9947
9948 @item max-unroll-times
9949 The maximum number of unrollings of a single loop.
9950
9951 @item max-peeled-insns
9952 The maximum number of instructions that a loop may have to be peeled.
9953 If a loop is peeled, this parameter also determines how many times
9954 the loop code is peeled.
9955
9956 @item max-peel-times
9957 The maximum number of peelings of a single loop.
9958
9959 @item max-peel-branches
9960 The maximum number of branches on the hot path through the peeled sequence.
9961
9962 @item max-completely-peeled-insns
9963 The maximum number of insns of a completely peeled loop.
9964
9965 @item max-completely-peel-times
9966 The maximum number of iterations of a loop to be suitable for complete peeling.
9967
9968 @item max-completely-peel-loop-nest-depth
9969 The maximum depth of a loop nest suitable for complete peeling.
9970
9971 @item max-unswitch-insns
9972 The maximum number of insns of an unswitched loop.
9973
9974 @item max-unswitch-level
9975 The maximum number of branches unswitched in a single loop.
9976
9977 @item lim-expensive
9978 The minimum cost of an expensive expression in the loop invariant motion.
9979
9980 @item iv-consider-all-candidates-bound
9981 Bound on number of candidates for induction variables, below which
9982 all candidates are considered for each use in induction variable
9983 optimizations. If there are more candidates than this,
9984 only the most relevant ones are considered to avoid quadratic time complexity.
9985
9986 @item iv-max-considered-uses
9987 The induction variable optimizations give up on loops that contain more
9988 induction variable uses.
9989
9990 @item iv-always-prune-cand-set-bound
9991 If the number of candidates in the set is smaller than this value,
9992 always try to remove unnecessary ivs from the set
9993 when adding a new one.
9994
9995 @item scev-max-expr-size
9996 Bound on size of expressions used in the scalar evolutions analyzer.
9997 Large expressions slow the analyzer.
9998
9999 @item scev-max-expr-complexity
10000 Bound on the complexity of the expressions in the scalar evolutions analyzer.
10001 Complex expressions slow the analyzer.
10002
10003 @item omega-max-vars
10004 The maximum number of variables in an Omega constraint system.
10005 The default value is 128.
10006
10007 @item omega-max-geqs
10008 The maximum number of inequalities in an Omega constraint system.
10009 The default value is 256.
10010
10011 @item omega-max-eqs
10012 The maximum number of equalities in an Omega constraint system.
10013 The default value is 128.
10014
10015 @item omega-max-wild-cards
10016 The maximum number of wildcard variables that the Omega solver is
10017 able to insert. The default value is 18.
10018
10019 @item omega-hash-table-size
10020 The size of the hash table in the Omega solver. The default value is
10021 550.
10022
10023 @item omega-max-keys
10024 The maximal number of keys used by the Omega solver. The default
10025 value is 500.
10026
10027 @item omega-eliminate-redundant-constraints
10028 When set to 1, use expensive methods to eliminate all redundant
10029 constraints. The default value is 0.
10030
10031 @item vect-max-version-for-alignment-checks
10032 The maximum number of run-time checks that can be performed when
10033 doing loop versioning for alignment in the vectorizer.
10034
10035 @item vect-max-version-for-alias-checks
10036 The maximum number of run-time checks that can be performed when
10037 doing loop versioning for alias in the vectorizer.
10038
10039 @item vect-max-peeling-for-alignment
10040 The maximum number of loop peels to enhance access alignment
10041 for vectorizer. Value -1 means 'no limit'.
10042
10043 @item max-iterations-to-track
10044 The maximum number of iterations of a loop the brute-force algorithm
10045 for analysis of the number of iterations of the loop tries to evaluate.
10046
10047 @item hot-bb-count-ws-permille
10048 A basic block profile count is considered hot if it contributes to
10049 the given permillage (i.e. 0...1000) of the entire profiled execution.
10050
10051 @item hot-bb-frequency-fraction
10052 Select fraction of the entry block frequency of executions of basic block in
10053 function given basic block needs to have to be considered hot.
10054
10055 @item max-predicted-iterations
10056 The maximum number of loop iterations we predict statically. This is useful
10057 in cases where a function contains a single loop with known bound and
10058 another loop with unknown bound.
10059 The known number of iterations is predicted correctly, while
10060 the unknown number of iterations average to roughly 10. This means that the
10061 loop without bounds appears artificially cold relative to the other one.
10062
10063 @item builtin-expect-probability
10064 Control the probability of the expression having the specified value. This
10065 parameter takes a percentage (i.e. 0 ... 100) as input.
10066 The default probability of 90 is obtained empirically.
10067
10068 @item align-threshold
10069
10070 Select fraction of the maximal frequency of executions of a basic block in
10071 a function to align the basic block.
10072
10073 @item align-loop-iterations
10074
10075 A loop expected to iterate at least the selected number of iterations is
10076 aligned.
10077
10078 @item tracer-dynamic-coverage
10079 @itemx tracer-dynamic-coverage-feedback
10080
10081 This value is used to limit superblock formation once the given percentage of
10082 executed instructions is covered. This limits unnecessary code size
10083 expansion.
10084
10085 The @option{tracer-dynamic-coverage-feedback} is used only when profile
10086 feedback is available. The real profiles (as opposed to statically estimated
10087 ones) are much less balanced allowing the threshold to be larger value.
10088
10089 @item tracer-max-code-growth
10090 Stop tail duplication once code growth has reached given percentage. This is
10091 a rather artificial limit, as most of the duplicates are eliminated later in
10092 cross jumping, so it may be set to much higher values than is the desired code
10093 growth.
10094
10095 @item tracer-min-branch-ratio
10096
10097 Stop reverse growth when the reverse probability of best edge is less than this
10098 threshold (in percent).
10099
10100 @item tracer-min-branch-ratio
10101 @itemx tracer-min-branch-ratio-feedback
10102
10103 Stop forward growth if the best edge has probability lower than this
10104 threshold.
10105
10106 Similarly to @option{tracer-dynamic-coverage} two values are present, one for
10107 compilation for profile feedback and one for compilation without. The value
10108 for compilation with profile feedback needs to be more conservative (higher) in
10109 order to make tracer effective.
10110
10111 @item max-cse-path-length
10112
10113 The maximum number of basic blocks on path that CSE considers.
10114 The default is 10.
10115
10116 @item max-cse-insns
10117 The maximum number of instructions CSE processes before flushing.
10118 The default is 1000.
10119
10120 @item ggc-min-expand
10121
10122 GCC uses a garbage collector to manage its own memory allocation. This
10123 parameter specifies the minimum percentage by which the garbage
10124 collector's heap should be allowed to expand between collections.
10125 Tuning this may improve compilation speed; it has no effect on code
10126 generation.
10127
10128 The default is 30% + 70% * (RAM/1GB) with an upper bound of 100% when
10129 RAM >= 1GB@. If @code{getrlimit} is available, the notion of ``RAM'' is
10130 the smallest of actual RAM and @code{RLIMIT_DATA} or @code{RLIMIT_AS}. If
10131 GCC is not able to calculate RAM on a particular platform, the lower
10132 bound of 30% is used. Setting this parameter and
10133 @option{ggc-min-heapsize} to zero causes a full collection to occur at
10134 every opportunity. This is extremely slow, but can be useful for
10135 debugging.
10136
10137 @item ggc-min-heapsize
10138
10139 Minimum size of the garbage collector's heap before it begins bothering
10140 to collect garbage. The first collection occurs after the heap expands
10141 by @option{ggc-min-expand}% beyond @option{ggc-min-heapsize}. Again,
10142 tuning this may improve compilation speed, and has no effect on code
10143 generation.
10144
10145 The default is the smaller of RAM/8, RLIMIT_RSS, or a limit that
10146 tries to ensure that RLIMIT_DATA or RLIMIT_AS are not exceeded, but
10147 with a lower bound of 4096 (four megabytes) and an upper bound of
10148 131072 (128 megabytes). If GCC is not able to calculate RAM on a
10149 particular platform, the lower bound is used. Setting this parameter
10150 very large effectively disables garbage collection. Setting this
10151 parameter and @option{ggc-min-expand} to zero causes a full collection
10152 to occur at every opportunity.
10153
10154 @item max-reload-search-insns
10155 The maximum number of instruction reload should look backward for equivalent
10156 register. Increasing values mean more aggressive optimization, making the
10157 compilation time increase with probably slightly better performance.
10158 The default value is 100.
10159
10160 @item max-cselib-memory-locations
10161 The maximum number of memory locations cselib should take into account.
10162 Increasing values mean more aggressive optimization, making the compilation time
10163 increase with probably slightly better performance. The default value is 500.
10164
10165 @item reorder-blocks-duplicate
10166 @itemx reorder-blocks-duplicate-feedback
10167
10168 Used by the basic block reordering pass to decide whether to use unconditional
10169 branch or duplicate the code on its destination. Code is duplicated when its
10170 estimated size is smaller than this value multiplied by the estimated size of
10171 unconditional jump in the hot spots of the program.
10172
10173 The @option{reorder-block-duplicate-feedback} is used only when profile
10174 feedback is available. It may be set to higher values than
10175 @option{reorder-block-duplicate} since information about the hot spots is more
10176 accurate.
10177
10178 @item max-sched-ready-insns
10179 The maximum number of instructions ready to be issued the scheduler should
10180 consider at any given time during the first scheduling pass. Increasing
10181 values mean more thorough searches, making the compilation time increase
10182 with probably little benefit. The default value is 100.
10183
10184 @item max-sched-region-blocks
10185 The maximum number of blocks in a region to be considered for
10186 interblock scheduling. The default value is 10.
10187
10188 @item max-pipeline-region-blocks
10189 The maximum number of blocks in a region to be considered for
10190 pipelining in the selective scheduler. The default value is 15.
10191
10192 @item max-sched-region-insns
10193 The maximum number of insns in a region to be considered for
10194 interblock scheduling. The default value is 100.
10195
10196 @item max-pipeline-region-insns
10197 The maximum number of insns in a region to be considered for
10198 pipelining in the selective scheduler. The default value is 200.
10199
10200 @item min-spec-prob
10201 The minimum probability (in percents) of reaching a source block
10202 for interblock speculative scheduling. The default value is 40.
10203
10204 @item max-sched-extend-regions-iters
10205 The maximum number of iterations through CFG to extend regions.
10206 A value of 0 (the default) disables region extensions.
10207
10208 @item max-sched-insn-conflict-delay
10209 The maximum conflict delay for an insn to be considered for speculative motion.
10210 The default value is 3.
10211
10212 @item sched-spec-prob-cutoff
10213 The minimal probability of speculation success (in percents), so that
10214 speculative insns are scheduled.
10215 The default value is 40.
10216
10217 @item sched-spec-state-edge-prob-cutoff
10218 The minimum probability an edge must have for the scheduler to save its
10219 state across it.
10220 The default value is 10.
10221
10222 @item sched-mem-true-dep-cost
10223 Minimal distance (in CPU cycles) between store and load targeting same
10224 memory locations. The default value is 1.
10225
10226 @item selsched-max-lookahead
10227 The maximum size of the lookahead window of selective scheduling. It is a
10228 depth of search for available instructions.
10229 The default value is 50.
10230
10231 @item selsched-max-sched-times
10232 The maximum number of times that an instruction is scheduled during
10233 selective scheduling. This is the limit on the number of iterations
10234 through which the instruction may be pipelined. The default value is 2.
10235
10236 @item selsched-max-insns-to-rename
10237 The maximum number of best instructions in the ready list that are considered
10238 for renaming in the selective scheduler. The default value is 2.
10239
10240 @item sms-min-sc
10241 The minimum value of stage count that swing modulo scheduler
10242 generates. The default value is 2.
10243
10244 @item max-last-value-rtl
10245 The maximum size measured as number of RTLs that can be recorded in an expression
10246 in combiner for a pseudo register as last known value of that register. The default
10247 is 10000.
10248
10249 @item max-combine-insns
10250 The maximum number of instructions the RTL combiner tries to combine.
10251 The default value is 2 at @option{-Og} and 4 otherwise.
10252
10253 @item integer-share-limit
10254 Small integer constants can use a shared data structure, reducing the
10255 compiler's memory usage and increasing its speed. This sets the maximum
10256 value of a shared integer constant. The default value is 256.
10257
10258 @item ssp-buffer-size
10259 The minimum size of buffers (i.e.@: arrays) that receive stack smashing
10260 protection when @option{-fstack-protection} is used.
10261
10262 @item min-size-for-stack-sharing
10263 The minimum size of variables taking part in stack slot sharing when not
10264 optimizing. The default value is 32.
10265
10266 @item max-jump-thread-duplication-stmts
10267 Maximum number of statements allowed in a block that needs to be
10268 duplicated when threading jumps.
10269
10270 @item max-fields-for-field-sensitive
10271 Maximum number of fields in a structure treated in
10272 a field sensitive manner during pointer analysis. The default is zero
10273 for @option{-O0} and @option{-O1},
10274 and 100 for @option{-Os}, @option{-O2}, and @option{-O3}.
10275
10276 @item prefetch-latency
10277 Estimate on average number of instructions that are executed before
10278 prefetch finishes. The distance prefetched ahead is proportional
10279 to this constant. Increasing this number may also lead to less
10280 streams being prefetched (see @option{simultaneous-prefetches}).
10281
10282 @item simultaneous-prefetches
10283 Maximum number of prefetches that can run at the same time.
10284
10285 @item l1-cache-line-size
10286 The size of cache line in L1 cache, in bytes.
10287
10288 @item l1-cache-size
10289 The size of L1 cache, in kilobytes.
10290
10291 @item l2-cache-size
10292 The size of L2 cache, in kilobytes.
10293
10294 @item min-insn-to-prefetch-ratio
10295 The minimum ratio between the number of instructions and the
10296 number of prefetches to enable prefetching in a loop.
10297
10298 @item prefetch-min-insn-to-mem-ratio
10299 The minimum ratio between the number of instructions and the
10300 number of memory references to enable prefetching in a loop.
10301
10302 @item use-canonical-types
10303 Whether the compiler should use the ``canonical'' type system. By
10304 default, this should always be 1, which uses a more efficient internal
10305 mechanism for comparing types in C++ and Objective-C++. However, if
10306 bugs in the canonical type system are causing compilation failures,
10307 set this value to 0 to disable canonical types.
10308
10309 @item switch-conversion-max-branch-ratio
10310 Switch initialization conversion refuses to create arrays that are
10311 bigger than @option{switch-conversion-max-branch-ratio} times the number of
10312 branches in the switch.
10313
10314 @item max-partial-antic-length
10315 Maximum length of the partial antic set computed during the tree
10316 partial redundancy elimination optimization (@option{-ftree-pre}) when
10317 optimizing at @option{-O3} and above. For some sorts of source code
10318 the enhanced partial redundancy elimination optimization can run away,
10319 consuming all of the memory available on the host machine. This
10320 parameter sets a limit on the length of the sets that are computed,
10321 which prevents the runaway behavior. Setting a value of 0 for
10322 this parameter allows an unlimited set length.
10323
10324 @item sccvn-max-scc-size
10325 Maximum size of a strongly connected component (SCC) during SCCVN
10326 processing. If this limit is hit, SCCVN processing for the whole
10327 function is not done and optimizations depending on it are
10328 disabled. The default maximum SCC size is 10000.
10329
10330 @item sccvn-max-alias-queries-per-access
10331 Maximum number of alias-oracle queries we perform when looking for
10332 redundancies for loads and stores. If this limit is hit the search
10333 is aborted and the load or store is not considered redundant. The
10334 number of queries is algorithmically limited to the number of
10335 stores on all paths from the load to the function entry.
10336 The default maxmimum number of queries is 1000.
10337
10338 @item ira-max-loops-num
10339 IRA uses regional register allocation by default. If a function
10340 contains more loops than the number given by this parameter, only at most
10341 the given number of the most frequently-executed loops form regions
10342 for regional register allocation. The default value of the
10343 parameter is 100.
10344
10345 @item ira-max-conflict-table-size
10346 Although IRA uses a sophisticated algorithm to compress the conflict
10347 table, the table can still require excessive amounts of memory for
10348 huge functions. If the conflict table for a function could be more
10349 than the size in MB given by this parameter, the register allocator
10350 instead uses a faster, simpler, and lower-quality
10351 algorithm that does not require building a pseudo-register conflict table.
10352 The default value of the parameter is 2000.
10353
10354 @item ira-loop-reserved-regs
10355 IRA can be used to evaluate more accurate register pressure in loops
10356 for decisions to move loop invariants (see @option{-O3}). The number
10357 of available registers reserved for some other purposes is given
10358 by this parameter. The default value of the parameter is 2, which is
10359 the minimal number of registers needed by typical instructions.
10360 This value is the best found from numerous experiments.
10361
10362 @item loop-invariant-max-bbs-in-loop
10363 Loop invariant motion can be very expensive, both in compilation time and
10364 in amount of needed compile-time memory, with very large loops. Loops
10365 with more basic blocks than this parameter won't have loop invariant
10366 motion optimization performed on them. The default value of the
10367 parameter is 1000 for @option{-O1} and 10000 for @option{-O2} and above.
10368
10369 @item loop-max-datarefs-for-datadeps
10370 Building data dapendencies is expensive for very large loops. This
10371 parameter limits the number of data references in loops that are
10372 considered for data dependence analysis. These large loops are no
10373 handled by the optimizations using loop data dependencies.
10374 The default value is 1000.
10375
10376 @item max-vartrack-size
10377 Sets a maximum number of hash table slots to use during variable
10378 tracking dataflow analysis of any function. If this limit is exceeded
10379 with variable tracking at assignments enabled, analysis for that
10380 function is retried without it, after removing all debug insns from
10381 the function. If the limit is exceeded even without debug insns, var
10382 tracking analysis is completely disabled for the function. Setting
10383 the parameter to zero makes it unlimited.
10384
10385 @item max-vartrack-expr-depth
10386 Sets a maximum number of recursion levels when attempting to map
10387 variable names or debug temporaries to value expressions. This trades
10388 compilation time for more complete debug information. If this is set too
10389 low, value expressions that are available and could be represented in
10390 debug information may end up not being used; setting this higher may
10391 enable the compiler to find more complex debug expressions, but compile
10392 time and memory use may grow. The default is 12.
10393
10394 @item min-nondebug-insn-uid
10395 Use uids starting at this parameter for nondebug insns. The range below
10396 the parameter is reserved exclusively for debug insns created by
10397 @option{-fvar-tracking-assignments}, but debug insns may get
10398 (non-overlapping) uids above it if the reserved range is exhausted.
10399
10400 @item ipa-sra-ptr-growth-factor
10401 IPA-SRA replaces a pointer to an aggregate with one or more new
10402 parameters only when their cumulative size is less or equal to
10403 @option{ipa-sra-ptr-growth-factor} times the size of the original
10404 pointer parameter.
10405
10406 @item tm-max-aggregate-size
10407 When making copies of thread-local variables in a transaction, this
10408 parameter specifies the size in bytes after which variables are
10409 saved with the logging functions as opposed to save/restore code
10410 sequence pairs. This option only applies when using
10411 @option{-fgnu-tm}.
10412
10413 @item graphite-max-nb-scop-params
10414 To avoid exponential effects in the Graphite loop transforms, the
10415 number of parameters in a Static Control Part (SCoP) is bounded. The
10416 default value is 10 parameters. A variable whose value is unknown at
10417 compilation time and defined outside a SCoP is a parameter of the SCoP.
10418
10419 @item graphite-max-bbs-per-function
10420 To avoid exponential effects in the detection of SCoPs, the size of
10421 the functions analyzed by Graphite is bounded. The default value is
10422 100 basic blocks.
10423
10424 @item loop-block-tile-size
10425 Loop blocking or strip mining transforms, enabled with
10426 @option{-floop-block} or @option{-floop-strip-mine}, strip mine each
10427 loop in the loop nest by a given number of iterations. The strip
10428 length can be changed using the @option{loop-block-tile-size}
10429 parameter. The default value is 51 iterations.
10430
10431 @item ipa-cp-value-list-size
10432 IPA-CP attempts to track all possible values and types passed to a function's
10433 parameter in order to propagate them and perform devirtualization.
10434 @option{ipa-cp-value-list-size} is the maximum number of values and types it
10435 stores per one formal parameter of a function.
10436
10437 @item ipa-cp-eval-threshold
10438 IPA-CP calculates its own score of cloning profitability heuristics
10439 and performs those cloning opportunities with scores that exceed
10440 @option{ipa-cp-eval-threshold}.
10441
10442 @item ipa-max-agg-items
10443 IPA-CP is also capable to propagate a number of scalar values passed
10444 in an aggregate. @option{ipa-max-agg-items} controls the maximum
10445 number of such values per one parameter.
10446
10447 @item ipa-cp-loop-hint-bonus
10448 When IPA-CP determines that a cloning candidate would make the number
10449 of iterations of a loop known, it adds a bonus of
10450 @option{ipa-cp-loop-hint-bonus} to the profitability score of
10451 the candidate.
10452
10453 @item ipa-cp-array-index-hint-bonus
10454 When IPA-CP determines that a cloning candidate would make the index of
10455 an array access known, it adds a bonus of
10456 @option{ipa-cp-array-index-hint-bonus} to the profitability
10457 score of the candidate.
10458
10459 @item ipa-max-aa-steps
10460 During its analysis of function bodies, IPA-CP employs alias analysis
10461 in order to track values pointed to by function parameters. In order
10462 not spend too much time analyzing huge functions, it will give up and
10463 consider all memory clobbered after examining
10464 @option{ipa-max-aa-steps} statements modifying memory.
10465
10466 @item lto-partitions
10467 Specify desired number of partitions produced during WHOPR compilation.
10468 The number of partitions should exceed the number of CPUs used for compilation.
10469 The default value is 32.
10470
10471 @item lto-minpartition
10472 Size of minimal partition for WHOPR (in estimated instructions).
10473 This prevents expenses of splitting very small programs into too many
10474 partitions.
10475
10476 @item cxx-max-namespaces-for-diagnostic-help
10477 The maximum number of namespaces to consult for suggestions when C++
10478 name lookup fails for an identifier. The default is 1000.
10479
10480 @item sink-frequency-threshold
10481 The maximum relative execution frequency (in percents) of the target block
10482 relative to a statement's original block to allow statement sinking of a
10483 statement. Larger numbers result in more aggressive statement sinking.
10484 The default value is 75. A small positive adjustment is applied for
10485 statements with memory operands as those are even more profitable so sink.
10486
10487 @item max-stores-to-sink
10488 The maximum number of conditional stores paires that can be sunk. Set to 0
10489 if either vectorization (@option{-ftree-vectorize}) or if-conversion
10490 (@option{-ftree-loop-if-convert}) is disabled. The default is 2.
10491
10492 @item allow-store-data-races
10493 Allow optimizers to introduce new data races on stores.
10494 Set to 1 to allow, otherwise to 0. This option is enabled by default
10495 at optimization level @option{-Ofast}.
10496
10497 @item case-values-threshold
10498 The smallest number of different values for which it is best to use a
10499 jump-table instead of a tree of conditional branches. If the value is
10500 0, use the default for the machine. The default is 0.
10501
10502 @item tree-reassoc-width
10503 Set the maximum number of instructions executed in parallel in
10504 reassociated tree. This parameter overrides target dependent
10505 heuristics used by default if has non zero value.
10506
10507 @item sched-pressure-algorithm
10508 Choose between the two available implementations of
10509 @option{-fsched-pressure}. Algorithm 1 is the original implementation
10510 and is the more likely to prevent instructions from being reordered.
10511 Algorithm 2 was designed to be a compromise between the relatively
10512 conservative approach taken by algorithm 1 and the rather aggressive
10513 approach taken by the default scheduler. It relies more heavily on
10514 having a regular register file and accurate register pressure classes.
10515 See @file{haifa-sched.c} in the GCC sources for more details.
10516
10517 The default choice depends on the target.
10518
10519 @item max-slsr-cand-scan
10520 Set the maximum number of existing candidates that will be considered when
10521 seeking a basis for a new straight-line strength reduction candidate.
10522
10523 @item asan-globals
10524 Enable buffer overflow detection for global objects. This kind
10525 of protection is enabled by default if you are using
10526 @option{-fsanitize=address} option.
10527 To disable global objects protection use @option{--param asan-globals=0}.
10528
10529 @item asan-stack
10530 Enable buffer overflow detection for stack objects. This kind of
10531 protection is enabled by default when using@option{-fsanitize=address}.
10532 To disable stack protection use @option{--param asan-stack=0} option.
10533
10534 @item asan-instrument-reads
10535 Enable buffer overflow detection for memory reads. This kind of
10536 protection is enabled by default when using @option{-fsanitize=address}.
10537 To disable memory reads protection use
10538 @option{--param asan-instrument-reads=0}.
10539
10540 @item asan-instrument-writes
10541 Enable buffer overflow detection for memory writes. This kind of
10542 protection is enabled by default when using @option{-fsanitize=address}.
10543 To disable memory writes protection use
10544 @option{--param asan-instrument-writes=0} option.
10545
10546 @item asan-memintrin
10547 Enable detection for built-in functions. This kind of protection
10548 is enabled by default when using @option{-fsanitize=address}.
10549 To disable built-in functions protection use
10550 @option{--param asan-memintrin=0}.
10551
10552 @item asan-use-after-return
10553 Enable detection of use-after-return. This kind of protection
10554 is enabled by default when using @option{-fsanitize=address} option.
10555 To disable use-after-return detection use
10556 @option{--param asan-use-after-return=0}.
10557
10558 @item asan-instrumentation-with-call-threshold
10559 If number of memory accesses in function being instrumented
10560 is greater or equal to this number, use callbacks instead of inline checks.
10561 E.g. to disable inline code use
10562 @option{--param asan-instrumentation-with-call-threshold=0}.
10563
10564 @end table
10565 @end table
10566
10567 @node Preprocessor Options
10568 @section Options Controlling the Preprocessor
10569 @cindex preprocessor options
10570 @cindex options, preprocessor
10571
10572 These options control the C preprocessor, which is run on each C source
10573 file before actual compilation.
10574
10575 If you use the @option{-E} option, nothing is done except preprocessing.
10576 Some of these options make sense only together with @option{-E} because
10577 they cause the preprocessor output to be unsuitable for actual
10578 compilation.
10579
10580 @table @gcctabopt
10581 @item -Wp,@var{option}
10582 @opindex Wp
10583 You can use @option{-Wp,@var{option}} to bypass the compiler driver
10584 and pass @var{option} directly through to the preprocessor. If
10585 @var{option} contains commas, it is split into multiple options at the
10586 commas. However, many options are modified, translated or interpreted
10587 by the compiler driver before being passed to the preprocessor, and
10588 @option{-Wp} forcibly bypasses this phase. The preprocessor's direct
10589 interface is undocumented and subject to change, so whenever possible
10590 you should avoid using @option{-Wp} and let the driver handle the
10591 options instead.
10592
10593 @item -Xpreprocessor @var{option}
10594 @opindex Xpreprocessor
10595 Pass @var{option} as an option to the preprocessor. You can use this to
10596 supply system-specific preprocessor options that GCC does not
10597 recognize.
10598
10599 If you want to pass an option that takes an argument, you must use
10600 @option{-Xpreprocessor} twice, once for the option and once for the argument.
10601
10602 @item -no-integrated-cpp
10603 @opindex no-integrated-cpp
10604 Perform preprocessing as a separate pass before compilation.
10605 By default, GCC performs preprocessing as an integrated part of
10606 input tokenization and parsing.
10607 If this option is provided, the appropriate language front end
10608 (@command{cc1}, @command{cc1plus}, or @command{cc1obj} for C, C++,
10609 and Objective-C, respectively) is instead invoked twice,
10610 once for preprocessing only and once for actual compilation
10611 of the preprocessed input.
10612 This option may be useful in conjunction with the @option{-B} or
10613 @option{-wrapper} options to specify an alternate preprocessor or
10614 perform additional processing of the program source between
10615 normal preprocessing and compilation.
10616 @end table
10617
10618 @include cppopts.texi
10619
10620 @node Assembler Options
10621 @section Passing Options to the Assembler
10622
10623 @c prevent bad page break with this line
10624 You can pass options to the assembler.
10625
10626 @table @gcctabopt
10627 @item -Wa,@var{option}
10628 @opindex Wa
10629 Pass @var{option} as an option to the assembler. If @var{option}
10630 contains commas, it is split into multiple options at the commas.
10631
10632 @item -Xassembler @var{option}
10633 @opindex Xassembler
10634 Pass @var{option} as an option to the assembler. You can use this to
10635 supply system-specific assembler options that GCC does not
10636 recognize.
10637
10638 If you want to pass an option that takes an argument, you must use
10639 @option{-Xassembler} twice, once for the option and once for the argument.
10640
10641 @end table
10642
10643 @node Link Options
10644 @section Options for Linking
10645 @cindex link options
10646 @cindex options, linking
10647
10648 These options come into play when the compiler links object files into
10649 an executable output file. They are meaningless if the compiler is
10650 not doing a link step.
10651
10652 @table @gcctabopt
10653 @cindex file names
10654 @item @var{object-file-name}
10655 A file name that does not end in a special recognized suffix is
10656 considered to name an object file or library. (Object files are
10657 distinguished from libraries by the linker according to the file
10658 contents.) If linking is done, these object files are used as input
10659 to the linker.
10660
10661 @item -c
10662 @itemx -S
10663 @itemx -E
10664 @opindex c
10665 @opindex S
10666 @opindex E
10667 If any of these options is used, then the linker is not run, and
10668 object file names should not be used as arguments. @xref{Overall
10669 Options}.
10670
10671 @cindex Libraries
10672 @item -l@var{library}
10673 @itemx -l @var{library}
10674 @opindex l
10675 Search the library named @var{library} when linking. (The second
10676 alternative with the library as a separate argument is only for
10677 POSIX compliance and is not recommended.)
10678
10679 It makes a difference where in the command you write this option; the
10680 linker searches and processes libraries and object files in the order they
10681 are specified. Thus, @samp{foo.o -lz bar.o} searches library @samp{z}
10682 after file @file{foo.o} but before @file{bar.o}. If @file{bar.o} refers
10683 to functions in @samp{z}, those functions may not be loaded.
10684
10685 The linker searches a standard list of directories for the library,
10686 which is actually a file named @file{lib@var{library}.a}. The linker
10687 then uses this file as if it had been specified precisely by name.
10688
10689 The directories searched include several standard system directories
10690 plus any that you specify with @option{-L}.
10691
10692 Normally the files found this way are library files---archive files
10693 whose members are object files. The linker handles an archive file by
10694 scanning through it for members which define symbols that have so far
10695 been referenced but not defined. But if the file that is found is an
10696 ordinary object file, it is linked in the usual fashion. The only
10697 difference between using an @option{-l} option and specifying a file name
10698 is that @option{-l} surrounds @var{library} with @samp{lib} and @samp{.a}
10699 and searches several directories.
10700
10701 @item -lobjc
10702 @opindex lobjc
10703 You need this special case of the @option{-l} option in order to
10704 link an Objective-C or Objective-C++ program.
10705
10706 @item -nostartfiles
10707 @opindex nostartfiles
10708 Do not use the standard system startup files when linking.
10709 The standard system libraries are used normally, unless @option{-nostdlib}
10710 or @option{-nodefaultlibs} is used.
10711
10712 @item -nodefaultlibs
10713 @opindex nodefaultlibs
10714 Do not use the standard system libraries when linking.
10715 Only the libraries you specify are passed to the linker, and options
10716 specifying linkage of the system libraries, such as @code{-static-libgcc}
10717 or @code{-shared-libgcc}, are ignored.
10718 The standard startup files are used normally, unless @option{-nostartfiles}
10719 is used.
10720
10721 The compiler may generate calls to @code{memcmp},
10722 @code{memset}, @code{memcpy} and @code{memmove}.
10723 These entries are usually resolved by entries in
10724 libc. These entry points should be supplied through some other
10725 mechanism when this option is specified.
10726
10727 @item -nostdlib
10728 @opindex nostdlib
10729 Do not use the standard system startup files or libraries when linking.
10730 No startup files and only the libraries you specify are passed to
10731 the linker, and options specifying linkage of the system libraries, such as
10732 @code{-static-libgcc} or @code{-shared-libgcc}, are ignored.
10733
10734 The compiler may generate calls to @code{memcmp}, @code{memset},
10735 @code{memcpy} and @code{memmove}.
10736 These entries are usually resolved by entries in
10737 libc. These entry points should be supplied through some other
10738 mechanism when this option is specified.
10739
10740 @cindex @option{-lgcc}, use with @option{-nostdlib}
10741 @cindex @option{-nostdlib} and unresolved references
10742 @cindex unresolved references and @option{-nostdlib}
10743 @cindex @option{-lgcc}, use with @option{-nodefaultlibs}
10744 @cindex @option{-nodefaultlibs} and unresolved references
10745 @cindex unresolved references and @option{-nodefaultlibs}
10746 One of the standard libraries bypassed by @option{-nostdlib} and
10747 @option{-nodefaultlibs} is @file{libgcc.a}, a library of internal subroutines
10748 which GCC uses to overcome shortcomings of particular machines, or special
10749 needs for some languages.
10750 (@xref{Interface,,Interfacing to GCC Output,gccint,GNU Compiler
10751 Collection (GCC) Internals},
10752 for more discussion of @file{libgcc.a}.)
10753 In most cases, you need @file{libgcc.a} even when you want to avoid
10754 other standard libraries. In other words, when you specify @option{-nostdlib}
10755 or @option{-nodefaultlibs} you should usually specify @option{-lgcc} as well.
10756 This ensures that you have no unresolved references to internal GCC
10757 library subroutines.
10758 (An example of such an internal subroutine is @samp{__main}, used to ensure C++
10759 constructors are called; @pxref{Collect2,,@code{collect2}, gccint,
10760 GNU Compiler Collection (GCC) Internals}.)
10761
10762 @item -pie
10763 @opindex pie
10764 Produce a position independent executable on targets that support it.
10765 For predictable results, you must also specify the same set of options
10766 used for compilation (@option{-fpie}, @option{-fPIE},
10767 or model suboptions) when you specify this linker option.
10768
10769 @item -rdynamic
10770 @opindex rdynamic
10771 Pass the flag @option{-export-dynamic} to the ELF linker, on targets
10772 that support it. This instructs the linker to add all symbols, not
10773 only used ones, to the dynamic symbol table. This option is needed
10774 for some uses of @code{dlopen} or to allow obtaining backtraces
10775 from within a program.
10776
10777 @item -s
10778 @opindex s
10779 Remove all symbol table and relocation information from the executable.
10780
10781 @item -static
10782 @opindex static
10783 On systems that support dynamic linking, this prevents linking with the shared
10784 libraries. On other systems, this option has no effect.
10785
10786 @item -shared
10787 @opindex shared
10788 Produce a shared object which can then be linked with other objects to
10789 form an executable. Not all systems support this option. For predictable
10790 results, you must also specify the same set of options used for compilation
10791 (@option{-fpic}, @option{-fPIC}, or model suboptions) when
10792 you specify this linker option.@footnote{On some systems, @samp{gcc -shared}
10793 needs to build supplementary stub code for constructors to work. On
10794 multi-libbed systems, @samp{gcc -shared} must select the correct support
10795 libraries to link against. Failing to supply the correct flags may lead
10796 to subtle defects. Supplying them in cases where they are not necessary
10797 is innocuous.}
10798
10799 @item -shared-libgcc
10800 @itemx -static-libgcc
10801 @opindex shared-libgcc
10802 @opindex static-libgcc
10803 On systems that provide @file{libgcc} as a shared library, these options
10804 force the use of either the shared or static version, respectively.
10805 If no shared version of @file{libgcc} was built when the compiler was
10806 configured, these options have no effect.
10807
10808 There are several situations in which an application should use the
10809 shared @file{libgcc} instead of the static version. The most common
10810 of these is when the application wishes to throw and catch exceptions
10811 across different shared libraries. In that case, each of the libraries
10812 as well as the application itself should use the shared @file{libgcc}.
10813
10814 Therefore, the G++ and GCJ drivers automatically add
10815 @option{-shared-libgcc} whenever you build a shared library or a main
10816 executable, because C++ and Java programs typically use exceptions, so
10817 this is the right thing to do.
10818
10819 If, instead, you use the GCC driver to create shared libraries, you may
10820 find that they are not always linked with the shared @file{libgcc}.
10821 If GCC finds, at its configuration time, that you have a non-GNU linker
10822 or a GNU linker that does not support option @option{--eh-frame-hdr},
10823 it links the shared version of @file{libgcc} into shared libraries
10824 by default. Otherwise, it takes advantage of the linker and optimizes
10825 away the linking with the shared version of @file{libgcc}, linking with
10826 the static version of libgcc by default. This allows exceptions to
10827 propagate through such shared libraries, without incurring relocation
10828 costs at library load time.
10829
10830 However, if a library or main executable is supposed to throw or catch
10831 exceptions, you must link it using the G++ or GCJ driver, as appropriate
10832 for the languages used in the program, or using the option
10833 @option{-shared-libgcc}, such that it is linked with the shared
10834 @file{libgcc}.
10835
10836 @item -static-libasan
10837 @opindex static-libasan
10838 When the @option{-fsanitize=address} option is used to link a program,
10839 the GCC driver automatically links against @option{libasan}. If
10840 @file{libasan} is available as a shared library, and the @option{-static}
10841 option is not used, then this links against the shared version of
10842 @file{libasan}. The @option{-static-libasan} option directs the GCC
10843 driver to link @file{libasan} statically, without necessarily linking
10844 other libraries statically.
10845
10846 @item -static-libtsan
10847 @opindex static-libtsan
10848 When the @option{-fsanitize=thread} option is used to link a program,
10849 the GCC driver automatically links against @option{libtsan}. If
10850 @file{libtsan} is available as a shared library, and the @option{-static}
10851 option is not used, then this links against the shared version of
10852 @file{libtsan}. The @option{-static-libtsan} option directs the GCC
10853 driver to link @file{libtsan} statically, without necessarily linking
10854 other libraries statically.
10855
10856 @item -static-liblsan
10857 @opindex static-liblsan
10858 When the @option{-fsanitize=leak} option is used to link a program,
10859 the GCC driver automatically links against @option{liblsan}. If
10860 @file{liblsan} is available as a shared library, and the @option{-static}
10861 option is not used, then this links against the shared version of
10862 @file{liblsan}. The @option{-static-liblsan} option directs the GCC
10863 driver to link @file{liblsan} statically, without necessarily linking
10864 other libraries statically.
10865
10866 @item -static-libubsan
10867 @opindex static-libubsan
10868 When the @option{-fsanitize=undefined} option is used to link a program,
10869 the GCC driver automatically links against @option{libubsan}. If
10870 @file{libubsan} is available as a shared library, and the @option{-static}
10871 option is not used, then this links against the shared version of
10872 @file{libubsan}. The @option{-static-libubsan} option directs the GCC
10873 driver to link @file{libubsan} statically, without necessarily linking
10874 other libraries statically.
10875
10876 @item -static-libstdc++
10877 @opindex static-libstdc++
10878 When the @command{g++} program is used to link a C++ program, it
10879 normally automatically links against @option{libstdc++}. If
10880 @file{libstdc++} is available as a shared library, and the
10881 @option{-static} option is not used, then this links against the
10882 shared version of @file{libstdc++}. That is normally fine. However, it
10883 is sometimes useful to freeze the version of @file{libstdc++} used by
10884 the program without going all the way to a fully static link. The
10885 @option{-static-libstdc++} option directs the @command{g++} driver to
10886 link @file{libstdc++} statically, without necessarily linking other
10887 libraries statically.
10888
10889 @item -symbolic
10890 @opindex symbolic
10891 Bind references to global symbols when building a shared object. Warn
10892 about any unresolved references (unless overridden by the link editor
10893 option @option{-Xlinker -z -Xlinker defs}). Only a few systems support
10894 this option.
10895
10896 @item -T @var{script}
10897 @opindex T
10898 @cindex linker script
10899 Use @var{script} as the linker script. This option is supported by most
10900 systems using the GNU linker. On some targets, such as bare-board
10901 targets without an operating system, the @option{-T} option may be required
10902 when linking to avoid references to undefined symbols.
10903
10904 @item -Xlinker @var{option}
10905 @opindex Xlinker
10906 Pass @var{option} as an option to the linker. You can use this to
10907 supply system-specific linker options that GCC does not recognize.
10908
10909 If you want to pass an option that takes a separate argument, you must use
10910 @option{-Xlinker} twice, once for the option and once for the argument.
10911 For example, to pass @option{-assert definitions}, you must write
10912 @option{-Xlinker -assert -Xlinker definitions}. It does not work to write
10913 @option{-Xlinker "-assert definitions"}, because this passes the entire
10914 string as a single argument, which is not what the linker expects.
10915
10916 When using the GNU linker, it is usually more convenient to pass
10917 arguments to linker options using the @option{@var{option}=@var{value}}
10918 syntax than as separate arguments. For example, you can specify
10919 @option{-Xlinker -Map=output.map} rather than
10920 @option{-Xlinker -Map -Xlinker output.map}. Other linkers may not support
10921 this syntax for command-line options.
10922
10923 @item -Wl,@var{option}
10924 @opindex Wl
10925 Pass @var{option} as an option to the linker. If @var{option} contains
10926 commas, it is split into multiple options at the commas. You can use this
10927 syntax to pass an argument to the option.
10928 For example, @option{-Wl,-Map,output.map} passes @option{-Map output.map} to the
10929 linker. When using the GNU linker, you can also get the same effect with
10930 @option{-Wl,-Map=output.map}.
10931
10932 @item -u @var{symbol}
10933 @opindex u
10934 Pretend the symbol @var{symbol} is undefined, to force linking of
10935 library modules to define it. You can use @option{-u} multiple times with
10936 different symbols to force loading of additional library modules.
10937
10938 @item -z @var{keyword}
10939 @opindex z
10940 @option{-z} is passed directly on to the linker along with the keyword
10941 @var{keyword}. See the section in the documentation of your linker for
10942 permitted values and their meanings.
10943 @end table
10944
10945 @node Directory Options
10946 @section Options for Directory Search
10947 @cindex directory options
10948 @cindex options, directory search
10949 @cindex search path
10950
10951 These options specify directories to search for header files, for
10952 libraries and for parts of the compiler:
10953
10954 @table @gcctabopt
10955 @item -I@var{dir}
10956 @opindex I
10957 Add the directory @var{dir} to the head of the list of directories to be
10958 searched for header files. This can be used to override a system header
10959 file, substituting your own version, since these directories are
10960 searched before the system header file directories. However, you should
10961 not use this option to add directories that contain vendor-supplied
10962 system header files (use @option{-isystem} for that). If you use more than
10963 one @option{-I} option, the directories are scanned in left-to-right
10964 order; the standard system directories come after.
10965
10966 If a standard system include directory, or a directory specified with
10967 @option{-isystem}, is also specified with @option{-I}, the @option{-I}
10968 option is ignored. The directory is still searched but as a
10969 system directory at its normal position in the system include chain.
10970 This is to ensure that GCC's procedure to fix buggy system headers and
10971 the ordering for the @code{include_next} directive are not inadvertently changed.
10972 If you really need to change the search order for system directories,
10973 use the @option{-nostdinc} and/or @option{-isystem} options.
10974
10975 @item -iplugindir=@var{dir}
10976 @opindex iplugindir=
10977 Set the directory to search for plugins that are passed
10978 by @option{-fplugin=@var{name}} instead of
10979 @option{-fplugin=@var{path}/@var{name}.so}. This option is not meant
10980 to be used by the user, but only passed by the driver.
10981
10982 @item -iquote@var{dir}
10983 @opindex iquote
10984 Add the directory @var{dir} to the head of the list of directories to
10985 be searched for header files only for the case of @samp{#include
10986 "@var{file}"}; they are not searched for @samp{#include <@var{file}>},
10987 otherwise just like @option{-I}.
10988
10989 @item -L@var{dir}
10990 @opindex L
10991 Add directory @var{dir} to the list of directories to be searched
10992 for @option{-l}.
10993
10994 @item -B@var{prefix}
10995 @opindex B
10996 This option specifies where to find the executables, libraries,
10997 include files, and data files of the compiler itself.
10998
10999 The compiler driver program runs one or more of the subprograms
11000 @command{cpp}, @command{cc1}, @command{as} and @command{ld}. It tries
11001 @var{prefix} as a prefix for each program it tries to run, both with and
11002 without @samp{@var{machine}/@var{version}/} (@pxref{Target Options}).
11003
11004 For each subprogram to be run, the compiler driver first tries the
11005 @option{-B} prefix, if any. If that name is not found, or if @option{-B}
11006 is not specified, the driver tries two standard prefixes,
11007 @file{/usr/lib/gcc/} and @file{/usr/local/lib/gcc/}. If neither of
11008 those results in a file name that is found, the unmodified program
11009 name is searched for using the directories specified in your
11010 @env{PATH} environment variable.
11011
11012 The compiler checks to see if the path provided by the @option{-B}
11013 refers to a directory, and if necessary it adds a directory
11014 separator character at the end of the path.
11015
11016 @option{-B} prefixes that effectively specify directory names also apply
11017 to libraries in the linker, because the compiler translates these
11018 options into @option{-L} options for the linker. They also apply to
11019 include files in the preprocessor, because the compiler translates these
11020 options into @option{-isystem} options for the preprocessor. In this case,
11021 the compiler appends @samp{include} to the prefix.
11022
11023 The runtime support file @file{libgcc.a} can also be searched for using
11024 the @option{-B} prefix, if needed. If it is not found there, the two
11025 standard prefixes above are tried, and that is all. The file is left
11026 out of the link if it is not found by those means.
11027
11028 Another way to specify a prefix much like the @option{-B} prefix is to use
11029 the environment variable @env{GCC_EXEC_PREFIX}. @xref{Environment
11030 Variables}.
11031
11032 As a special kludge, if the path provided by @option{-B} is
11033 @file{[dir/]stage@var{N}/}, where @var{N} is a number in the range 0 to
11034 9, then it is replaced by @file{[dir/]include}. This is to help
11035 with boot-strapping the compiler.
11036
11037 @item -specs=@var{file}
11038 @opindex specs
11039 Process @var{file} after the compiler reads in the standard @file{specs}
11040 file, in order to override the defaults which the @command{gcc} driver
11041 program uses when determining what switches to pass to @command{cc1},
11042 @command{cc1plus}, @command{as}, @command{ld}, etc. More than one
11043 @option{-specs=@var{file}} can be specified on the command line, and they
11044 are processed in order, from left to right.
11045
11046 @item --sysroot=@var{dir}
11047 @opindex sysroot
11048 Use @var{dir} as the logical root directory for headers and libraries.
11049 For example, if the compiler normally searches for headers in
11050 @file{/usr/include} and libraries in @file{/usr/lib}, it instead
11051 searches @file{@var{dir}/usr/include} and @file{@var{dir}/usr/lib}.
11052
11053 If you use both this option and the @option{-isysroot} option, then
11054 the @option{--sysroot} option applies to libraries, but the
11055 @option{-isysroot} option applies to header files.
11056
11057 The GNU linker (beginning with version 2.16) has the necessary support
11058 for this option. If your linker does not support this option, the
11059 header file aspect of @option{--sysroot} still works, but the
11060 library aspect does not.
11061
11062 @item --no-sysroot-suffix
11063 @opindex no-sysroot-suffix
11064 For some targets, a suffix is added to the root directory specified
11065 with @option{--sysroot}, depending on the other options used, so that
11066 headers may for example be found in
11067 @file{@var{dir}/@var{suffix}/usr/include} instead of
11068 @file{@var{dir}/usr/include}. This option disables the addition of
11069 such a suffix.
11070
11071 @item -I-
11072 @opindex I-
11073 This option has been deprecated. Please use @option{-iquote} instead for
11074 @option{-I} directories before the @option{-I-} and remove the @option{-I-}.
11075 Any directories you specify with @option{-I} options before the @option{-I-}
11076 option are searched only for the case of @samp{#include "@var{file}"};
11077 they are not searched for @samp{#include <@var{file}>}.
11078
11079 If additional directories are specified with @option{-I} options after
11080 the @option{-I-}, these directories are searched for all @samp{#include}
11081 directives. (Ordinarily @emph{all} @option{-I} directories are used
11082 this way.)
11083
11084 In addition, the @option{-I-} option inhibits the use of the current
11085 directory (where the current input file came from) as the first search
11086 directory for @samp{#include "@var{file}"}. There is no way to
11087 override this effect of @option{-I-}. With @option{-I.} you can specify
11088 searching the directory that is current when the compiler is
11089 invoked. That is not exactly the same as what the preprocessor does
11090 by default, but it is often satisfactory.
11091
11092 @option{-I-} does not inhibit the use of the standard system directories
11093 for header files. Thus, @option{-I-} and @option{-nostdinc} are
11094 independent.
11095 @end table
11096
11097 @c man end
11098
11099 @node Spec Files
11100 @section Specifying subprocesses and the switches to pass to them
11101 @cindex Spec Files
11102
11103 @command{gcc} is a driver program. It performs its job by invoking a
11104 sequence of other programs to do the work of compiling, assembling and
11105 linking. GCC interprets its command-line parameters and uses these to
11106 deduce which programs it should invoke, and which command-line options
11107 it ought to place on their command lines. This behavior is controlled
11108 by @dfn{spec strings}. In most cases there is one spec string for each
11109 program that GCC can invoke, but a few programs have multiple spec
11110 strings to control their behavior. The spec strings built into GCC can
11111 be overridden by using the @option{-specs=} command-line switch to specify
11112 a spec file.
11113
11114 @dfn{Spec files} are plaintext files that are used to construct spec
11115 strings. They consist of a sequence of directives separated by blank
11116 lines. The type of directive is determined by the first non-whitespace
11117 character on the line, which can be one of the following:
11118
11119 @table @code
11120 @item %@var{command}
11121 Issues a @var{command} to the spec file processor. The commands that can
11122 appear here are:
11123
11124 @table @code
11125 @item %include <@var{file}>
11126 @cindex @code{%include}
11127 Search for @var{file} and insert its text at the current point in the
11128 specs file.
11129
11130 @item %include_noerr <@var{file}>
11131 @cindex @code{%include_noerr}
11132 Just like @samp{%include}, but do not generate an error message if the include
11133 file cannot be found.
11134
11135 @item %rename @var{old_name} @var{new_name}
11136 @cindex @code{%rename}
11137 Rename the spec string @var{old_name} to @var{new_name}.
11138
11139 @end table
11140
11141 @item *[@var{spec_name}]:
11142 This tells the compiler to create, override or delete the named spec
11143 string. All lines after this directive up to the next directive or
11144 blank line are considered to be the text for the spec string. If this
11145 results in an empty string then the spec is deleted. (Or, if the
11146 spec did not exist, then nothing happens.) Otherwise, if the spec
11147 does not currently exist a new spec is created. If the spec does
11148 exist then its contents are overridden by the text of this
11149 directive, unless the first character of that text is the @samp{+}
11150 character, in which case the text is appended to the spec.
11151
11152 @item [@var{suffix}]:
11153 Creates a new @samp{[@var{suffix}] spec} pair. All lines after this directive
11154 and up to the next directive or blank line are considered to make up the
11155 spec string for the indicated suffix. When the compiler encounters an
11156 input file with the named suffix, it processes the spec string in
11157 order to work out how to compile that file. For example:
11158
11159 @smallexample
11160 .ZZ:
11161 z-compile -input %i
11162 @end smallexample
11163
11164 This says that any input file whose name ends in @samp{.ZZ} should be
11165 passed to the program @samp{z-compile}, which should be invoked with the
11166 command-line switch @option{-input} and with the result of performing the
11167 @samp{%i} substitution. (See below.)
11168
11169 As an alternative to providing a spec string, the text following a
11170 suffix directive can be one of the following:
11171
11172 @table @code
11173 @item @@@var{language}
11174 This says that the suffix is an alias for a known @var{language}. This is
11175 similar to using the @option{-x} command-line switch to GCC to specify a
11176 language explicitly. For example:
11177
11178 @smallexample
11179 .ZZ:
11180 @@c++
11181 @end smallexample
11182
11183 Says that .ZZ files are, in fact, C++ source files.
11184
11185 @item #@var{name}
11186 This causes an error messages saying:
11187
11188 @smallexample
11189 @var{name} compiler not installed on this system.
11190 @end smallexample
11191 @end table
11192
11193 GCC already has an extensive list of suffixes built into it.
11194 This directive adds an entry to the end of the list of suffixes, but
11195 since the list is searched from the end backwards, it is effectively
11196 possible to override earlier entries using this technique.
11197
11198 @end table
11199
11200 GCC has the following spec strings built into it. Spec files can
11201 override these strings or create their own. Note that individual
11202 targets can also add their own spec strings to this list.
11203
11204 @smallexample
11205 asm Options to pass to the assembler
11206 asm_final Options to pass to the assembler post-processor
11207 cpp Options to pass to the C preprocessor
11208 cc1 Options to pass to the C compiler
11209 cc1plus Options to pass to the C++ compiler
11210 endfile Object files to include at the end of the link
11211 link Options to pass to the linker
11212 lib Libraries to include on the command line to the linker
11213 libgcc Decides which GCC support library to pass to the linker
11214 linker Sets the name of the linker
11215 predefines Defines to be passed to the C preprocessor
11216 signed_char Defines to pass to CPP to say whether @code{char} is signed
11217 by default
11218 startfile Object files to include at the start of the link
11219 @end smallexample
11220
11221 Here is a small example of a spec file:
11222
11223 @smallexample
11224 %rename lib old_lib
11225
11226 *lib:
11227 --start-group -lgcc -lc -leval1 --end-group %(old_lib)
11228 @end smallexample
11229
11230 This example renames the spec called @samp{lib} to @samp{old_lib} and
11231 then overrides the previous definition of @samp{lib} with a new one.
11232 The new definition adds in some extra command-line options before
11233 including the text of the old definition.
11234
11235 @dfn{Spec strings} are a list of command-line options to be passed to their
11236 corresponding program. In addition, the spec strings can contain
11237 @samp{%}-prefixed sequences to substitute variable text or to
11238 conditionally insert text into the command line. Using these constructs
11239 it is possible to generate quite complex command lines.
11240
11241 Here is a table of all defined @samp{%}-sequences for spec
11242 strings. Note that spaces are not generated automatically around the
11243 results of expanding these sequences. Therefore you can concatenate them
11244 together or combine them with constant text in a single argument.
11245
11246 @table @code
11247 @item %%
11248 Substitute one @samp{%} into the program name or argument.
11249
11250 @item %i
11251 Substitute the name of the input file being processed.
11252
11253 @item %b
11254 Substitute the basename of the input file being processed.
11255 This is the substring up to (and not including) the last period
11256 and not including the directory.
11257
11258 @item %B
11259 This is the same as @samp{%b}, but include the file suffix (text after
11260 the last period).
11261
11262 @item %d
11263 Marks the argument containing or following the @samp{%d} as a
11264 temporary file name, so that that file is deleted if GCC exits
11265 successfully. Unlike @samp{%g}, this contributes no text to the
11266 argument.
11267
11268 @item %g@var{suffix}
11269 Substitute a file name that has suffix @var{suffix} and is chosen
11270 once per compilation, and mark the argument in the same way as
11271 @samp{%d}. To reduce exposure to denial-of-service attacks, the file
11272 name is now chosen in a way that is hard to predict even when previously
11273 chosen file names are known. For example, @samp{%g.s @dots{} %g.o @dots{} %g.s}
11274 might turn into @samp{ccUVUUAU.s ccXYAXZ12.o ccUVUUAU.s}. @var{suffix} matches
11275 the regexp @samp{[.A-Za-z]*} or the special string @samp{%O}, which is
11276 treated exactly as if @samp{%O} had been preprocessed. Previously, @samp{%g}
11277 was simply substituted with a file name chosen once per compilation,
11278 without regard to any appended suffix (which was therefore treated
11279 just like ordinary text), making such attacks more likely to succeed.
11280
11281 @item %u@var{suffix}
11282 Like @samp{%g}, but generates a new temporary file name
11283 each time it appears instead of once per compilation.
11284
11285 @item %U@var{suffix}
11286 Substitutes the last file name generated with @samp{%u@var{suffix}}, generating a
11287 new one if there is no such last file name. In the absence of any
11288 @samp{%u@var{suffix}}, this is just like @samp{%g@var{suffix}}, except they don't share
11289 the same suffix @emph{space}, so @samp{%g.s @dots{} %U.s @dots{} %g.s @dots{} %U.s}
11290 involves the generation of two distinct file names, one
11291 for each @samp{%g.s} and another for each @samp{%U.s}. Previously, @samp{%U} was
11292 simply substituted with a file name chosen for the previous @samp{%u},
11293 without regard to any appended suffix.
11294
11295 @item %j@var{suffix}
11296 Substitutes the name of the @code{HOST_BIT_BUCKET}, if any, and if it is
11297 writable, and if @option{-save-temps} is not used;
11298 otherwise, substitute the name
11299 of a temporary file, just like @samp{%u}. This temporary file is not
11300 meant for communication between processes, but rather as a junk
11301 disposal mechanism.
11302
11303 @item %|@var{suffix}
11304 @itemx %m@var{suffix}
11305 Like @samp{%g}, except if @option{-pipe} is in effect. In that case
11306 @samp{%|} substitutes a single dash and @samp{%m} substitutes nothing at
11307 all. These are the two most common ways to instruct a program that it
11308 should read from standard input or write to standard output. If you
11309 need something more elaborate you can use an @samp{%@{pipe:@code{X}@}}
11310 construct: see for example @file{f/lang-specs.h}.
11311
11312 @item %.@var{SUFFIX}
11313 Substitutes @var{.SUFFIX} for the suffixes of a matched switch's args
11314 when it is subsequently output with @samp{%*}. @var{SUFFIX} is
11315 terminated by the next space or %.
11316
11317 @item %w
11318 Marks the argument containing or following the @samp{%w} as the
11319 designated output file of this compilation. This puts the argument
11320 into the sequence of arguments that @samp{%o} substitutes.
11321
11322 @item %o
11323 Substitutes the names of all the output files, with spaces
11324 automatically placed around them. You should write spaces
11325 around the @samp{%o} as well or the results are undefined.
11326 @samp{%o} is for use in the specs for running the linker.
11327 Input files whose names have no recognized suffix are not compiled
11328 at all, but they are included among the output files, so they are
11329 linked.
11330
11331 @item %O
11332 Substitutes the suffix for object files. Note that this is
11333 handled specially when it immediately follows @samp{%g, %u, or %U},
11334 because of the need for those to form complete file names. The
11335 handling is such that @samp{%O} is treated exactly as if it had already
11336 been substituted, except that @samp{%g, %u, and %U} do not currently
11337 support additional @var{suffix} characters following @samp{%O} as they do
11338 following, for example, @samp{.o}.
11339
11340 @item %p
11341 Substitutes the standard macro predefinitions for the
11342 current target machine. Use this when running @code{cpp}.
11343
11344 @item %P
11345 Like @samp{%p}, but puts @samp{__} before and after the name of each
11346 predefined macro, except for macros that start with @samp{__} or with
11347 @samp{_@var{L}}, where @var{L} is an uppercase letter. This is for ISO
11348 C@.
11349
11350 @item %I
11351 Substitute any of @option{-iprefix} (made from @env{GCC_EXEC_PREFIX}),
11352 @option{-isysroot} (made from @env{TARGET_SYSTEM_ROOT}),
11353 @option{-isystem} (made from @env{COMPILER_PATH} and @option{-B} options)
11354 and @option{-imultilib} as necessary.
11355
11356 @item %s
11357 Current argument is the name of a library or startup file of some sort.
11358 Search for that file in a standard list of directories and substitute
11359 the full name found. The current working directory is included in the
11360 list of directories scanned.
11361
11362 @item %T
11363 Current argument is the name of a linker script. Search for that file
11364 in the current list of directories to scan for libraries. If the file
11365 is located insert a @option{--script} option into the command line
11366 followed by the full path name found. If the file is not found then
11367 generate an error message. Note: the current working directory is not
11368 searched.
11369
11370 @item %e@var{str}
11371 Print @var{str} as an error message. @var{str} is terminated by a newline.
11372 Use this when inconsistent options are detected.
11373
11374 @item %(@var{name})
11375 Substitute the contents of spec string @var{name} at this point.
11376
11377 @item %x@{@var{option}@}
11378 Accumulate an option for @samp{%X}.
11379
11380 @item %X
11381 Output the accumulated linker options specified by @option{-Wl} or a @samp{%x}
11382 spec string.
11383
11384 @item %Y
11385 Output the accumulated assembler options specified by @option{-Wa}.
11386
11387 @item %Z
11388 Output the accumulated preprocessor options specified by @option{-Wp}.
11389
11390 @item %a
11391 Process the @code{asm} spec. This is used to compute the
11392 switches to be passed to the assembler.
11393
11394 @item %A
11395 Process the @code{asm_final} spec. This is a spec string for
11396 passing switches to an assembler post-processor, if such a program is
11397 needed.
11398
11399 @item %l
11400 Process the @code{link} spec. This is the spec for computing the
11401 command line passed to the linker. Typically it makes use of the
11402 @samp{%L %G %S %D and %E} sequences.
11403
11404 @item %D
11405 Dump out a @option{-L} option for each directory that GCC believes might
11406 contain startup files. If the target supports multilibs then the
11407 current multilib directory is prepended to each of these paths.
11408
11409 @item %L
11410 Process the @code{lib} spec. This is a spec string for deciding which
11411 libraries are included on the command line to the linker.
11412
11413 @item %G
11414 Process the @code{libgcc} spec. This is a spec string for deciding
11415 which GCC support library is included on the command line to the linker.
11416
11417 @item %S
11418 Process the @code{startfile} spec. This is a spec for deciding which
11419 object files are the first ones passed to the linker. Typically
11420 this might be a file named @file{crt0.o}.
11421
11422 @item %E
11423 Process the @code{endfile} spec. This is a spec string that specifies
11424 the last object files that are passed to the linker.
11425
11426 @item %C
11427 Process the @code{cpp} spec. This is used to construct the arguments
11428 to be passed to the C preprocessor.
11429
11430 @item %1
11431 Process the @code{cc1} spec. This is used to construct the options to be
11432 passed to the actual C compiler (@samp{cc1}).
11433
11434 @item %2
11435 Process the @code{cc1plus} spec. This is used to construct the options to be
11436 passed to the actual C++ compiler (@samp{cc1plus}).
11437
11438 @item %*
11439 Substitute the variable part of a matched option. See below.
11440 Note that each comma in the substituted string is replaced by
11441 a single space.
11442
11443 @item %<@code{S}
11444 Remove all occurrences of @code{-S} from the command line. Note---this
11445 command is position dependent. @samp{%} commands in the spec string
11446 before this one see @code{-S}, @samp{%} commands in the spec string
11447 after this one do not.
11448
11449 @item %:@var{function}(@var{args})
11450 Call the named function @var{function}, passing it @var{args}.
11451 @var{args} is first processed as a nested spec string, then split
11452 into an argument vector in the usual fashion. The function returns
11453 a string which is processed as if it had appeared literally as part
11454 of the current spec.
11455
11456 The following built-in spec functions are provided:
11457
11458 @table @code
11459 @item @code{getenv}
11460 The @code{getenv} spec function takes two arguments: an environment
11461 variable name and a string. If the environment variable is not
11462 defined, a fatal error is issued. Otherwise, the return value is the
11463 value of the environment variable concatenated with the string. For
11464 example, if @env{TOPDIR} is defined as @file{/path/to/top}, then:
11465
11466 @smallexample
11467 %:getenv(TOPDIR /include)
11468 @end smallexample
11469
11470 expands to @file{/path/to/top/include}.
11471
11472 @item @code{if-exists}
11473 The @code{if-exists} spec function takes one argument, an absolute
11474 pathname to a file. If the file exists, @code{if-exists} returns the
11475 pathname. Here is a small example of its usage:
11476
11477 @smallexample
11478 *startfile:
11479 crt0%O%s %:if-exists(crti%O%s) crtbegin%O%s
11480 @end smallexample
11481
11482 @item @code{if-exists-else}
11483 The @code{if-exists-else} spec function is similar to the @code{if-exists}
11484 spec function, except that it takes two arguments. The first argument is
11485 an absolute pathname to a file. If the file exists, @code{if-exists-else}
11486 returns the pathname. If it does not exist, it returns the second argument.
11487 This way, @code{if-exists-else} can be used to select one file or another,
11488 based on the existence of the first. Here is a small example of its usage:
11489
11490 @smallexample
11491 *startfile:
11492 crt0%O%s %:if-exists(crti%O%s) \
11493 %:if-exists-else(crtbeginT%O%s crtbegin%O%s)
11494 @end smallexample
11495
11496 @item @code{replace-outfile}
11497 The @code{replace-outfile} spec function takes two arguments. It looks for the
11498 first argument in the outfiles array and replaces it with the second argument. Here
11499 is a small example of its usage:
11500
11501 @smallexample
11502 %@{fgnu-runtime:%:replace-outfile(-lobjc -lobjc-gnu)@}
11503 @end smallexample
11504
11505 @item @code{remove-outfile}
11506 The @code{remove-outfile} spec function takes one argument. It looks for the
11507 first argument in the outfiles array and removes it. Here is a small example
11508 its usage:
11509
11510 @smallexample
11511 %:remove-outfile(-lm)
11512 @end smallexample
11513
11514 @item @code{pass-through-libs}
11515 The @code{pass-through-libs} spec function takes any number of arguments. It
11516 finds any @option{-l} options and any non-options ending in @file{.a} (which it
11517 assumes are the names of linker input library archive files) and returns a
11518 result containing all the found arguments each prepended by
11519 @option{-plugin-opt=-pass-through=} and joined by spaces. This list is
11520 intended to be passed to the LTO linker plugin.
11521
11522 @smallexample
11523 %:pass-through-libs(%G %L %G)
11524 @end smallexample
11525
11526 @item @code{print-asm-header}
11527 The @code{print-asm-header} function takes no arguments and simply
11528 prints a banner like:
11529
11530 @smallexample
11531 Assembler options
11532 =================
11533
11534 Use "-Wa,OPTION" to pass "OPTION" to the assembler.
11535 @end smallexample
11536
11537 It is used to separate compiler options from assembler options
11538 in the @option{--target-help} output.
11539 @end table
11540
11541 @item %@{@code{S}@}
11542 Substitutes the @code{-S} switch, if that switch is given to GCC@.
11543 If that switch is not specified, this substitutes nothing. Note that
11544 the leading dash is omitted when specifying this option, and it is
11545 automatically inserted if the substitution is performed. Thus the spec
11546 string @samp{%@{foo@}} matches the command-line option @option{-foo}
11547 and outputs the command-line option @option{-foo}.
11548
11549 @item %W@{@code{S}@}
11550 Like %@{@code{S}@} but mark last argument supplied within as a file to be
11551 deleted on failure.
11552
11553 @item %@{@code{S}*@}
11554 Substitutes all the switches specified to GCC whose names start
11555 with @code{-S}, but which also take an argument. This is used for
11556 switches like @option{-o}, @option{-D}, @option{-I}, etc.
11557 GCC considers @option{-o foo} as being
11558 one switch whose name starts with @samp{o}. %@{o*@} substitutes this
11559 text, including the space. Thus two arguments are generated.
11560
11561 @item %@{@code{S}*&@code{T}*@}
11562 Like %@{@code{S}*@}, but preserve order of @code{S} and @code{T} options
11563 (the order of @code{S} and @code{T} in the spec is not significant).
11564 There can be any number of ampersand-separated variables; for each the
11565 wild card is optional. Useful for CPP as @samp{%@{D*&U*&A*@}}.
11566
11567 @item %@{@code{S}:@code{X}@}
11568 Substitutes @code{X}, if the @option{-S} switch is given to GCC@.
11569
11570 @item %@{!@code{S}:@code{X}@}
11571 Substitutes @code{X}, if the @option{-S} switch is @emph{not} given to GCC@.
11572
11573 @item %@{@code{S}*:@code{X}@}
11574 Substitutes @code{X} if one or more switches whose names start with
11575 @code{-S} are specified to GCC@. Normally @code{X} is substituted only
11576 once, no matter how many such switches appeared. However, if @code{%*}
11577 appears somewhere in @code{X}, then @code{X} is substituted once
11578 for each matching switch, with the @code{%*} replaced by the part of
11579 that switch matching the @code{*}.
11580
11581 If @code{%*} appears as the last part of a spec sequence then a space
11582 will be added after the end of the last substitution. If there is more
11583 text in the sequence however then a space will not be generated. This
11584 allows the @code{%*} substitution to be used as part of a larger
11585 string. For example, a spec string like this:
11586
11587 @smallexample
11588 %@{mcu=*:--script=%*/memory.ld@}
11589 @end smallexample
11590
11591 when matching an option like @code{-mcu=newchip} will produce:
11592
11593 @smallexample
11594 --script=newchip/memory.ld
11595 @end smallexample
11596
11597 @item %@{.@code{S}:@code{X}@}
11598 Substitutes @code{X}, if processing a file with suffix @code{S}.
11599
11600 @item %@{!.@code{S}:@code{X}@}
11601 Substitutes @code{X}, if @emph{not} processing a file with suffix @code{S}.
11602
11603 @item %@{,@code{S}:@code{X}@}
11604 Substitutes @code{X}, if processing a file for language @code{S}.
11605
11606 @item %@{!,@code{S}:@code{X}@}
11607 Substitutes @code{X}, if not processing a file for language @code{S}.
11608
11609 @item %@{@code{S}|@code{P}:@code{X}@}
11610 Substitutes @code{X} if either @code{-S} or @code{-P} is given to
11611 GCC@. This may be combined with @samp{!}, @samp{.}, @samp{,}, and
11612 @code{*} sequences as well, although they have a stronger binding than
11613 the @samp{|}. If @code{%*} appears in @code{X}, all of the
11614 alternatives must be starred, and only the first matching alternative
11615 is substituted.
11616
11617 For example, a spec string like this:
11618
11619 @smallexample
11620 %@{.c:-foo@} %@{!.c:-bar@} %@{.c|d:-baz@} %@{!.c|d:-boggle@}
11621 @end smallexample
11622
11623 @noindent
11624 outputs the following command-line options from the following input
11625 command-line options:
11626
11627 @smallexample
11628 fred.c -foo -baz
11629 jim.d -bar -boggle
11630 -d fred.c -foo -baz -boggle
11631 -d jim.d -bar -baz -boggle
11632 @end smallexample
11633
11634 @item %@{S:X; T:Y; :D@}
11635
11636 If @code{S} is given to GCC, substitutes @code{X}; else if @code{T} is
11637 given to GCC, substitutes @code{Y}; else substitutes @code{D}. There can
11638 be as many clauses as you need. This may be combined with @code{.},
11639 @code{,}, @code{!}, @code{|}, and @code{*} as needed.
11640
11641
11642 @end table
11643
11644 The conditional text @code{X} in a %@{@code{S}:@code{X}@} or similar
11645 construct may contain other nested @samp{%} constructs or spaces, or
11646 even newlines. They are processed as usual, as described above.
11647 Trailing white space in @code{X} is ignored. White space may also
11648 appear anywhere on the left side of the colon in these constructs,
11649 except between @code{.} or @code{*} and the corresponding word.
11650
11651 The @option{-O}, @option{-f}, @option{-m}, and @option{-W} switches are
11652 handled specifically in these constructs. If another value of
11653 @option{-O} or the negated form of a @option{-f}, @option{-m}, or
11654 @option{-W} switch is found later in the command line, the earlier
11655 switch value is ignored, except with @{@code{S}*@} where @code{S} is
11656 just one letter, which passes all matching options.
11657
11658 The character @samp{|} at the beginning of the predicate text is used to
11659 indicate that a command should be piped to the following command, but
11660 only if @option{-pipe} is specified.
11661
11662 It is built into GCC which switches take arguments and which do not.
11663 (You might think it would be useful to generalize this to allow each
11664 compiler's spec to say which switches take arguments. But this cannot
11665 be done in a consistent fashion. GCC cannot even decide which input
11666 files have been specified without knowing which switches take arguments,
11667 and it must know which input files to compile in order to tell which
11668 compilers to run).
11669
11670 GCC also knows implicitly that arguments starting in @option{-l} are to be
11671 treated as compiler output files, and passed to the linker in their
11672 proper position among the other output files.
11673
11674 @c man begin OPTIONS
11675
11676 @node Target Options
11677 @section Specifying Target Machine and Compiler Version
11678 @cindex target options
11679 @cindex cross compiling
11680 @cindex specifying machine version
11681 @cindex specifying compiler version and target machine
11682 @cindex compiler version, specifying
11683 @cindex target machine, specifying
11684
11685 The usual way to run GCC is to run the executable called @command{gcc}, or
11686 @command{@var{machine}-gcc} when cross-compiling, or
11687 @command{@var{machine}-gcc-@var{version}} to run a version other than the
11688 one that was installed last.
11689
11690 @node Submodel Options
11691 @section Hardware Models and Configurations
11692 @cindex submodel options
11693 @cindex specifying hardware config
11694 @cindex hardware models and configurations, specifying
11695 @cindex machine dependent options
11696
11697 Each target machine types can have its own
11698 special options, starting with @samp{-m}, to choose among various
11699 hardware models or configurations---for example, 68010 vs 68020,
11700 floating coprocessor or none. A single installed version of the
11701 compiler can compile for any model or configuration, according to the
11702 options specified.
11703
11704 Some configurations of the compiler also support additional special
11705 options, usually for compatibility with other compilers on the same
11706 platform.
11707
11708 @c This list is ordered alphanumerically by subsection name.
11709 @c It should be the same order and spelling as these options are listed
11710 @c in Machine Dependent Options
11711
11712 @menu
11713 * AArch64 Options::
11714 * Adapteva Epiphany Options::
11715 * ARC Options::
11716 * ARM Options::
11717 * AVR Options::
11718 * Blackfin Options::
11719 * C6X Options::
11720 * CRIS Options::
11721 * CR16 Options::
11722 * Darwin Options::
11723 * DEC Alpha Options::
11724 * FR30 Options::
11725 * FRV Options::
11726 * GNU/Linux Options::
11727 * H8/300 Options::
11728 * HPPA Options::
11729 * i386 and x86-64 Options::
11730 * i386 and x86-64 Windows Options::
11731 * IA-64 Options::
11732 * LM32 Options::
11733 * M32C Options::
11734 * M32R/D Options::
11735 * M680x0 Options::
11736 * MCore Options::
11737 * MeP Options::
11738 * MicroBlaze Options::
11739 * MIPS Options::
11740 * MMIX Options::
11741 * MN10300 Options::
11742 * Moxie Options::
11743 * MSP430 Options::
11744 * NDS32 Options::
11745 * Nios II Options::
11746 * PDP-11 Options::
11747 * picoChip Options::
11748 * PowerPC Options::
11749 * RL78 Options::
11750 * RS/6000 and PowerPC Options::
11751 * RX Options::
11752 * S/390 and zSeries Options::
11753 * Score Options::
11754 * SH Options::
11755 * Solaris 2 Options::
11756 * SPARC Options::
11757 * SPU Options::
11758 * System V Options::
11759 * TILE-Gx Options::
11760 * TILEPro Options::
11761 * V850 Options::
11762 * VAX Options::
11763 * VMS Options::
11764 * VxWorks Options::
11765 * x86-64 Options::
11766 * Xstormy16 Options::
11767 * Xtensa Options::
11768 * zSeries Options::
11769 @end menu
11770
11771 @node AArch64 Options
11772 @subsection AArch64 Options
11773 @cindex AArch64 Options
11774
11775 These options are defined for AArch64 implementations:
11776
11777 @table @gcctabopt
11778
11779 @item -mabi=@var{name}
11780 @opindex mabi
11781 Generate code for the specified data model. Permissible values
11782 are @samp{ilp32} for SysV-like data model where int, long int and pointer
11783 are 32-bit, and @samp{lp64} for SysV-like data model where int is 32-bit,
11784 but long int and pointer are 64-bit.
11785
11786 The default depends on the specific target configuration. Note that
11787 the LP64 and ILP32 ABIs are not link-compatible; you must compile your
11788 entire program with the same ABI, and link with a compatible set of libraries.
11789
11790 @item -mbig-endian
11791 @opindex mbig-endian
11792 Generate big-endian code. This is the default when GCC is configured for an
11793 @samp{aarch64_be-*-*} target.
11794
11795 @item -mgeneral-regs-only
11796 @opindex mgeneral-regs-only
11797 Generate code which uses only the general registers.
11798
11799 @item -mlittle-endian
11800 @opindex mlittle-endian
11801 Generate little-endian code. This is the default when GCC is configured for an
11802 @samp{aarch64-*-*} but not an @samp{aarch64_be-*-*} target.
11803
11804 @item -mcmodel=tiny
11805 @opindex mcmodel=tiny
11806 Generate code for the tiny code model. The program and its statically defined
11807 symbols must be within 1GB of each other. Pointers are 64 bits. Programs can
11808 be statically or dynamically linked. This model is not fully implemented and
11809 mostly treated as @samp{small}.
11810
11811 @item -mcmodel=small
11812 @opindex mcmodel=small
11813 Generate code for the small code model. The program and its statically defined
11814 symbols must be within 4GB of each other. Pointers are 64 bits. Programs can
11815 be statically or dynamically linked. This is the default code model.
11816
11817 @item -mcmodel=large
11818 @opindex mcmodel=large
11819 Generate code for the large code model. This makes no assumptions about
11820 addresses and sizes of sections. Pointers are 64 bits. Programs can be
11821 statically linked only.
11822
11823 @item -mstrict-align
11824 @opindex mstrict-align
11825 Do not assume that unaligned memory references will be handled by the system.
11826
11827 @item -momit-leaf-frame-pointer
11828 @itemx -mno-omit-leaf-frame-pointer
11829 @opindex momit-leaf-frame-pointer
11830 @opindex mno-omit-leaf-frame-pointer
11831 Omit or keep the frame pointer in leaf functions. The former behaviour is the
11832 default.
11833
11834 @item -mtls-dialect=desc
11835 @opindex mtls-dialect=desc
11836 Use TLS descriptors as the thread-local storage mechanism for dynamic accesses
11837 of TLS variables. This is the default.
11838
11839 @item -mtls-dialect=traditional
11840 @opindex mtls-dialect=traditional
11841 Use traditional TLS as the thread-local storage mechanism for dynamic accesses
11842 of TLS variables.
11843
11844 @item -mfix-cortex-a53-835769
11845 @itemx -mno-fix-cortex-a53-835769
11846 @opindex -mfix-cortex-a53-835769
11847 @opindex -mno-fix-cortex-a53-835769
11848 Enable or disable the workaround for the ARM Cortex-A53 erratum number 835769.
11849 This will involve inserting a NOP instruction between memory instructions and
11850 64-bit integer multiply-accumulate instructions.
11851
11852 @item -march=@var{name}
11853 @opindex march
11854 Specify the name of the target architecture, optionally suffixed by one or
11855 more feature modifiers. This option has the form
11856 @option{-march=@var{arch}@r{@{}+@r{[}no@r{]}@var{feature}@r{@}*}}, where the
11857 only permissible value for @var{arch} is @samp{armv8-a}. The permissible
11858 values for @var{feature} are documented in the sub-section below.
11859
11860 Where conflicting feature modifiers are specified, the right-most feature is
11861 used.
11862
11863 GCC uses this name to determine what kind of instructions it can emit when
11864 generating assembly code.
11865
11866 Where @option{-march} is specified without either of @option{-mtune}
11867 or @option{-mcpu} also being specified, the code will be tuned to perform
11868 well across a range of target processors implementing the target
11869 architecture.
11870
11871 @item -mtune=@var{name}
11872 @opindex mtune
11873 Specify the name of the target processor for which GCC should tune the
11874 performance of the code. Permissible values for this option are:
11875 @samp{generic}, @samp{cortex-a53}, @samp{cortex-a57}, @samp{thunderx}.
11876
11877 Additionally, this option can specify that GCC should tune the performance
11878 of the code for a big.LITTLE system. The only permissible value is
11879 @samp{cortex-a57.cortex-a53}.
11880
11881 Where none of @option{-mtune=}, @option{-mcpu=} or @option{-march=}
11882 are specified, the code will be tuned to perform well across a range
11883 of target processors.
11884
11885 This option cannot be suffixed by feature modifiers.
11886
11887 @item -mcpu=@var{name}
11888 @opindex mcpu
11889 Specify the name of the target processor, optionally suffixed by one or more
11890 feature modifiers. This option has the form
11891 @option{-mcpu=@var{cpu}@r{@{}+@r{[}no@r{]}@var{feature}@r{@}*}}, where the
11892 permissible values for @var{cpu} are the same as those available for
11893 @option{-mtune}.
11894
11895 The permissible values for @var{feature} are documented in the sub-section
11896 below.
11897
11898 Where conflicting feature modifiers are specified, the right-most feature is
11899 used.
11900
11901 GCC uses this name to determine what kind of instructions it can emit when
11902 generating assembly code (as if by @option{-march}) and to determine
11903 the target processor for which to tune for performance (as if
11904 by @option{-mtune}). Where this option is used in conjunction
11905 with @option{-march} or @option{-mtune}, those options take precedence
11906 over the appropriate part of this option.
11907 @end table
11908
11909 @subsubsection @option{-march} and @option{-mcpu} feature modifiers
11910 @cindex @option{-march} feature modifiers
11911 @cindex @option{-mcpu} feature modifiers
11912 Feature modifiers used with @option{-march} and @option{-mcpu} can be one
11913 the following:
11914
11915 @table @samp
11916 @item crc
11917 Enable CRC extension.
11918 @item crypto
11919 Enable Crypto extension. This implies Advanced SIMD is enabled.
11920 @item fp
11921 Enable floating-point instructions.
11922 @item simd
11923 Enable Advanced SIMD instructions. This implies floating-point instructions
11924 are enabled. This is the default for all current possible values for options
11925 @option{-march} and @option{-mcpu=}.
11926 @end table
11927
11928 @node Adapteva Epiphany Options
11929 @subsection Adapteva Epiphany Options
11930
11931 These @samp{-m} options are defined for Adapteva Epiphany:
11932
11933 @table @gcctabopt
11934 @item -mhalf-reg-file
11935 @opindex mhalf-reg-file
11936 Don't allocate any register in the range @code{r32}@dots{}@code{r63}.
11937 That allows code to run on hardware variants that lack these registers.
11938
11939 @item -mprefer-short-insn-regs
11940 @opindex mprefer-short-insn-regs
11941 Preferrentially allocate registers that allow short instruction generation.
11942 This can result in increased instruction count, so this may either reduce or
11943 increase overall code size.
11944
11945 @item -mbranch-cost=@var{num}
11946 @opindex mbranch-cost
11947 Set the cost of branches to roughly @var{num} ``simple'' instructions.
11948 This cost is only a heuristic and is not guaranteed to produce
11949 consistent results across releases.
11950
11951 @item -mcmove
11952 @opindex mcmove
11953 Enable the generation of conditional moves.
11954
11955 @item -mnops=@var{num}
11956 @opindex mnops
11957 Emit @var{num} NOPs before every other generated instruction.
11958
11959 @item -mno-soft-cmpsf
11960 @opindex mno-soft-cmpsf
11961 For single-precision floating-point comparisons, emit an @code{fsub} instruction
11962 and test the flags. This is faster than a software comparison, but can
11963 get incorrect results in the presence of NaNs, or when two different small
11964 numbers are compared such that their difference is calculated as zero.
11965 The default is @option{-msoft-cmpsf}, which uses slower, but IEEE-compliant,
11966 software comparisons.
11967
11968 @item -mstack-offset=@var{num}
11969 @opindex mstack-offset
11970 Set the offset between the top of the stack and the stack pointer.
11971 E.g., a value of 8 means that the eight bytes in the range @code{sp+0@dots{}sp+7}
11972 can be used by leaf functions without stack allocation.
11973 Values other than @samp{8} or @samp{16} are untested and unlikely to work.
11974 Note also that this option changes the ABI; compiling a program with a
11975 different stack offset than the libraries have been compiled with
11976 generally does not work.
11977 This option can be useful if you want to evaluate if a different stack
11978 offset would give you better code, but to actually use a different stack
11979 offset to build working programs, it is recommended to configure the
11980 toolchain with the appropriate @option{--with-stack-offset=@var{num}} option.
11981
11982 @item -mno-round-nearest
11983 @opindex mno-round-nearest
11984 Make the scheduler assume that the rounding mode has been set to
11985 truncating. The default is @option{-mround-nearest}.
11986
11987 @item -mlong-calls
11988 @opindex mlong-calls
11989 If not otherwise specified by an attribute, assume all calls might be beyond
11990 the offset range of the @code{b} / @code{bl} instructions, and therefore load the
11991 function address into a register before performing a (otherwise direct) call.
11992 This is the default.
11993
11994 @item -mshort-calls
11995 @opindex short-calls
11996 If not otherwise specified by an attribute, assume all direct calls are
11997 in the range of the @code{b} / @code{bl} instructions, so use these instructions
11998 for direct calls. The default is @option{-mlong-calls}.
11999
12000 @item -msmall16
12001 @opindex msmall16
12002 Assume addresses can be loaded as 16-bit unsigned values. This does not
12003 apply to function addresses for which @option{-mlong-calls} semantics
12004 are in effect.
12005
12006 @item -mfp-mode=@var{mode}
12007 @opindex mfp-mode
12008 Set the prevailing mode of the floating-point unit.
12009 This determines the floating-point mode that is provided and expected
12010 at function call and return time. Making this mode match the mode you
12011 predominantly need at function start can make your programs smaller and
12012 faster by avoiding unnecessary mode switches.
12013
12014 @var{mode} can be set to one the following values:
12015
12016 @table @samp
12017 @item caller
12018 Any mode at function entry is valid, and retained or restored when
12019 the function returns, and when it calls other functions.
12020 This mode is useful for compiling libraries or other compilation units
12021 you might want to incorporate into different programs with different
12022 prevailing FPU modes, and the convenience of being able to use a single
12023 object file outweighs the size and speed overhead for any extra
12024 mode switching that might be needed, compared with what would be needed
12025 with a more specific choice of prevailing FPU mode.
12026
12027 @item truncate
12028 This is the mode used for floating-point calculations with
12029 truncating (i.e.@: round towards zero) rounding mode. That includes
12030 conversion from floating point to integer.
12031
12032 @item round-nearest
12033 This is the mode used for floating-point calculations with
12034 round-to-nearest-or-even rounding mode.
12035
12036 @item int
12037 This is the mode used to perform integer calculations in the FPU, e.g.@:
12038 integer multiply, or integer multiply-and-accumulate.
12039 @end table
12040
12041 The default is @option{-mfp-mode=caller}
12042
12043 @item -mnosplit-lohi
12044 @itemx -mno-postinc
12045 @itemx -mno-postmodify
12046 @opindex mnosplit-lohi
12047 @opindex mno-postinc
12048 @opindex mno-postmodify
12049 Code generation tweaks that disable, respectively, splitting of 32-bit
12050 loads, generation of post-increment addresses, and generation of
12051 post-modify addresses. The defaults are @option{msplit-lohi},
12052 @option{-mpost-inc}, and @option{-mpost-modify}.
12053
12054 @item -mnovect-double
12055 @opindex mno-vect-double
12056 Change the preferred SIMD mode to SImode. The default is
12057 @option{-mvect-double}, which uses DImode as preferred SIMD mode.
12058
12059 @item -max-vect-align=@var{num}
12060 @opindex max-vect-align
12061 The maximum alignment for SIMD vector mode types.
12062 @var{num} may be 4 or 8. The default is 8.
12063 Note that this is an ABI change, even though many library function
12064 interfaces are unaffected if they don't use SIMD vector modes
12065 in places that affect size and/or alignment of relevant types.
12066
12067 @item -msplit-vecmove-early
12068 @opindex msplit-vecmove-early
12069 Split vector moves into single word moves before reload. In theory this
12070 can give better register allocation, but so far the reverse seems to be
12071 generally the case.
12072
12073 @item -m1reg-@var{reg}
12074 @opindex m1reg-
12075 Specify a register to hold the constant @minus{}1, which makes loading small negative
12076 constants and certain bitmasks faster.
12077 Allowable values for @var{reg} are @samp{r43} and @samp{r63},
12078 which specify use of that register as a fixed register,
12079 and @samp{none}, which means that no register is used for this
12080 purpose. The default is @option{-m1reg-none}.
12081
12082 @end table
12083
12084 @node ARC Options
12085 @subsection ARC Options
12086 @cindex ARC options
12087
12088 The following options control the architecture variant for which code
12089 is being compiled:
12090
12091 @c architecture variants
12092 @table @gcctabopt
12093
12094 @item -mbarrel-shifter
12095 @opindex mbarrel-shifter
12096 Generate instructions supported by barrel shifter. This is the default
12097 unless @samp{-mcpu=ARC601} is in effect.
12098
12099 @item -mcpu=@var{cpu}
12100 @opindex mcpu
12101 Set architecture type, register usage, and instruction scheduling
12102 parameters for @var{cpu}. There are also shortcut alias options
12103 available for backward compatibility and convenience. Supported
12104 values for @var{cpu} are
12105
12106 @table @samp
12107 @opindex mA6
12108 @opindex mARC600
12109 @item ARC600
12110 Compile for ARC600. Aliases: @option{-mA6}, @option{-mARC600}.
12111
12112 @item ARC601
12113 @opindex mARC601
12114 Compile for ARC601. Alias: @option{-mARC601}.
12115
12116 @item ARC700
12117 @opindex mA7
12118 @opindex mARC700
12119 Compile for ARC700. Aliases: @option{-mA7}, @option{-mARC700}.
12120 This is the default when configured with @samp{--with-cpu=arc700}@.
12121 @end table
12122
12123 @item -mdpfp
12124 @opindex mdpfp
12125 @itemx -mdpfp-compact
12126 @opindex mdpfp-compact
12127 FPX: Generate Double Precision FPX instructions, tuned for the compact
12128 implementation.
12129
12130 @item -mdpfp-fast
12131 @opindex mdpfp-fast
12132 FPX: Generate Double Precision FPX instructions, tuned for the fast
12133 implementation.
12134
12135 @item -mno-dpfp-lrsr
12136 @opindex mno-dpfp-lrsr
12137 Disable LR and SR instructions from using FPX extension aux registers.
12138
12139 @item -mea
12140 @opindex mea
12141 Generate Extended arithmetic instructions. Currently only
12142 @code{divaw}, @code{adds}, @code{subs}, and @code{sat16} are
12143 supported. This is always enabled for @samp{-mcpu=ARC700}.
12144
12145 @item -mno-mpy
12146 @opindex mno-mpy
12147 Do not generate mpy instructions for ARC700.
12148
12149 @item -mmul32x16
12150 @opindex mmul32x16
12151 Generate 32x16 bit multiply and mac instructions.
12152
12153 @item -mmul64
12154 @opindex mmul64
12155 Generate mul64 and mulu64 instructions. Only valid for @samp{-mcpu=ARC600}.
12156
12157 @item -mnorm
12158 @opindex mnorm
12159 Generate norm instruction. This is the default if @samp{-mcpu=ARC700}
12160 is in effect.
12161
12162 @item -mspfp
12163 @opindex mspfp
12164 @itemx -mspfp-compact
12165 @opindex mspfp-compact
12166 FPX: Generate Single Precision FPX instructions, tuned for the compact
12167 implementation.
12168
12169 @item -mspfp-fast
12170 @opindex mspfp-fast
12171 FPX: Generate Single Precision FPX instructions, tuned for the fast
12172 implementation.
12173
12174 @item -msimd
12175 @opindex msimd
12176 Enable generation of ARC SIMD instructions via target-specific
12177 builtins. Only valid for @samp{-mcpu=ARC700}.
12178
12179 @item -msoft-float
12180 @opindex msoft-float
12181 This option ignored; it is provided for compatibility purposes only.
12182 Software floating point code is emitted by default, and this default
12183 can overridden by FPX options; @samp{mspfp}, @samp{mspfp-compact}, or
12184 @samp{mspfp-fast} for single precision, and @samp{mdpfp},
12185 @samp{mdpfp-compact}, or @samp{mdpfp-fast} for double precision.
12186
12187 @item -mswap
12188 @opindex mswap
12189 Generate swap instructions.
12190
12191 @end table
12192
12193 The following options are passed through to the assembler, and also
12194 define preprocessor macro symbols.
12195
12196 @c Flags used by the assembler, but for which we define preprocessor
12197 @c macro symbols as well.
12198 @table @gcctabopt
12199 @item -mdsp-packa
12200 @opindex mdsp-packa
12201 Passed down to the assembler to enable the DSP Pack A extensions.
12202 Also sets the preprocessor symbol @code{__Xdsp_packa}.
12203
12204 @item -mdvbf
12205 @opindex mdvbf
12206 Passed down to the assembler to enable the dual viterbi butterfly
12207 extension. Also sets the preprocessor symbol @code{__Xdvbf}.
12208
12209 @c ARC700 4.10 extension instruction
12210 @item -mlock
12211 @opindex mlock
12212 Passed down to the assembler to enable the Locked Load/Store
12213 Conditional extension. Also sets the preprocessor symbol
12214 @code{__Xlock}.
12215
12216 @item -mmac-d16
12217 @opindex mmac-d16
12218 Passed down to the assembler. Also sets the preprocessor symbol
12219 @code{__Xxmac_d16}.
12220
12221 @item -mmac-24
12222 @opindex mmac-24
12223 Passed down to the assembler. Also sets the preprocessor symbol
12224 @code{__Xxmac_24}.
12225
12226 @c ARC700 4.10 extension instruction
12227 @item -mrtsc
12228 @opindex mrtsc
12229 Passed down to the assembler to enable the 64-bit Time-Stamp Counter
12230 extension instruction. Also sets the preprocessor symbol
12231 @code{__Xrtsc}.
12232
12233 @c ARC700 4.10 extension instruction
12234 @item -mswape
12235 @opindex mswape
12236 Passed down to the assembler to enable the swap byte ordering
12237 extension instruction. Also sets the preprocessor symbol
12238 @code{__Xswape}.
12239
12240 @item -mtelephony
12241 @opindex mtelephony
12242 Passed down to the assembler to enable dual and single operand
12243 instructions for telephony. Also sets the preprocessor symbol
12244 @code{__Xtelephony}.
12245
12246 @item -mxy
12247 @opindex mxy
12248 Passed down to the assembler to enable the XY Memory extension. Also
12249 sets the preprocessor symbol @code{__Xxy}.
12250
12251 @end table
12252
12253 The following options control how the assembly code is annotated:
12254
12255 @c Assembly annotation options
12256 @table @gcctabopt
12257 @item -misize
12258 @opindex misize
12259 Annotate assembler instructions with estimated addresses.
12260
12261 @item -mannotate-align
12262 @opindex mannotate-align
12263 Explain what alignment considerations lead to the decision to make an
12264 instruction short or long.
12265
12266 @end table
12267
12268 The following options are passed through to the linker:
12269
12270 @c options passed through to the linker
12271 @table @gcctabopt
12272 @item -marclinux
12273 @opindex marclinux
12274 Passed through to the linker, to specify use of the @code{arclinux} emulation.
12275 This option is enabled by default in tool chains built for
12276 @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}} targets
12277 when profiling is not requested.
12278
12279 @item -marclinux_prof
12280 @opindex marclinux_prof
12281 Passed through to the linker, to specify use of the
12282 @code{arclinux_prof} emulation. This option is enabled by default in
12283 tool chains built for @w{@code{arc-linux-uclibc}} and
12284 @w{@code{arceb-linux-uclibc}} targets when profiling is requested.
12285
12286 @end table
12287
12288 The following options control the semantics of generated code:
12289
12290 @c semantically relevant code generation options
12291 @table @gcctabopt
12292 @item -mepilogue-cfi
12293 @opindex mepilogue-cfi
12294 Enable generation of call frame information for epilogues.
12295
12296 @item -mno-epilogue-cfi
12297 @opindex mno-epilogue-cfi
12298 Disable generation of call frame information for epilogues.
12299
12300 @item -mlong-calls
12301 @opindex mlong-calls
12302 Generate call insns as register indirect calls, thus providing access
12303 to the full 32-bit address range.
12304
12305 @item -mmedium-calls
12306 @opindex mmedium-calls
12307 Don't use less than 25 bit addressing range for calls, which is the
12308 offset available for an unconditional branch-and-link
12309 instruction. Conditional execution of function calls is suppressed, to
12310 allow use of the 25-bit range, rather than the 21-bit range with
12311 conditional branch-and-link. This is the default for tool chains built
12312 for @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}} targets.
12313
12314 @item -mno-sdata
12315 @opindex mno-sdata
12316 Do not generate sdata references. This is the default for tool chains
12317 built for @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}}
12318 targets.
12319
12320 @item -mucb-mcount
12321 @opindex mucb-mcount
12322 Instrument with mcount calls as used in UCB code. I.e. do the
12323 counting in the callee, not the caller. By default ARC instrumentation
12324 counts in the caller.
12325
12326 @item -mvolatile-cache
12327 @opindex mvolatile-cache
12328 Use ordinarily cached memory accesses for volatile references. This is the
12329 default.
12330
12331 @item -mno-volatile-cache
12332 @opindex mno-volatile-cache
12333 Enable cache bypass for volatile references.
12334
12335 @end table
12336
12337 The following options fine tune code generation:
12338 @c code generation tuning options
12339 @table @gcctabopt
12340 @item -malign-call
12341 @opindex malign-call
12342 Do alignment optimizations for call instructions.
12343
12344 @item -mauto-modify-reg
12345 @opindex mauto-modify-reg
12346 Enable the use of pre/post modify with register displacement.
12347
12348 @item -mbbit-peephole
12349 @opindex mbbit-peephole
12350 Enable bbit peephole2.
12351
12352 @item -mno-brcc
12353 @opindex mno-brcc
12354 This option disables a target-specific pass in @file{arc_reorg} to
12355 generate @code{BRcc} instructions. It has no effect on @code{BRcc}
12356 generation driven by the combiner pass.
12357
12358 @item -mcase-vector-pcrel
12359 @opindex mcase-vector-pcrel
12360 Use pc-relative switch case tables - this enables case table shortening.
12361 This is the default for @option{-Os}.
12362
12363 @item -mcompact-casesi
12364 @opindex mcompact-casesi
12365 Enable compact casesi pattern.
12366 This is the default for @option{-Os}.
12367
12368 @item -mno-cond-exec
12369 @opindex mno-cond-exec
12370 Disable ARCompact specific pass to generate conditional execution instructions.
12371 Due to delay slot scheduling and interactions between operand numbers,
12372 literal sizes, instruction lengths, and the support for conditional execution,
12373 the target-independent pass to generate conditional execution is often lacking,
12374 so the ARC port has kept a special pass around that tries to find more
12375 conditional execution generating opportunities after register allocation,
12376 branch shortening, and delay slot scheduling have been done. This pass
12377 generally, but not always, improves performance and code size, at the cost of
12378 extra compilation time, which is why there is an option to switch it off.
12379 If you have a problem with call instructions exceeding their allowable
12380 offset range because they are conditionalized, you should consider using
12381 @option{-mmedium-calls} instead.
12382
12383 @item -mearly-cbranchsi
12384 @opindex mearly-cbranchsi
12385 Enable pre-reload use of the cbranchsi pattern.
12386
12387 @item -mexpand-adddi
12388 @opindex mexpand-adddi
12389 Expand @code{adddi3} and @code{subdi3} at rtl generation time into
12390 @code{add.f}, @code{adc} etc.
12391
12392 @item -mindexed-loads
12393 @opindex mindexed-loads
12394 Enable the use of indexed loads. This can be problematic because some
12395 optimizers will then assume the that indexed stores exist, which is not
12396 the case.
12397
12398 @item -mlra
12399 @opindex mlra
12400 Enable Local Register Allocation. This is still experimental for ARC,
12401 so by default the compiler uses standard reload
12402 (i.e. @samp{-mno-lra}).
12403
12404 @item -mlra-priority-none
12405 @opindex mlra-priority-none
12406 Don't indicate any priority for target registers.
12407
12408 @item -mlra-priority-compact
12409 @opindex mlra-priority-compact
12410 Indicate target register priority for r0..r3 / r12..r15.
12411
12412 @item -mlra-priority-noncompact
12413 @opindex mlra-priority-noncompact
12414 Reduce target regsiter priority for r0..r3 / r12..r15.
12415
12416 @item -mno-millicode
12417 @opindex mno-millicode
12418 When optimizing for size (using @option{-Os}), prologues and epilogues
12419 that have to save or restore a large number of registers are often
12420 shortened by using call to a special function in libgcc; this is
12421 referred to as a @emph{millicode} call. As these calls can pose
12422 performance issues, and/or cause linking issues when linking in a
12423 nonstandard way, this option is provided to turn off millicode call
12424 generation.
12425
12426 @item -mmixed-code
12427 @opindex mmixed-code
12428 Tweak register allocation to help 16-bit instruction generation.
12429 This generally has the effect of decreasing the average instruction size
12430 while increasing the instruction count.
12431
12432 @item -mq-class
12433 @opindex mq-class
12434 Enable 'q' instruction alternatives.
12435 This is the default for @option{-Os}.
12436
12437 @item -mRcq
12438 @opindex mRcq
12439 Enable Rcq constraint handling - most short code generation depends on this.
12440 This is the default.
12441
12442 @item -mRcw
12443 @opindex mRcw
12444 Enable Rcw constraint handling - ccfsm condexec mostly depends on this.
12445 This is the default.
12446
12447 @item -msize-level=@var{level}
12448 @opindex msize-level
12449 Fine-tune size optimization with regards to instruction lengths and alignment.
12450 The recognized values for @var{level} are:
12451 @table @samp
12452 @item 0
12453 No size optimization. This level is deprecated and treated like @samp{1}.
12454
12455 @item 1
12456 Short instructions are used opportunistically.
12457
12458 @item 2
12459 In addition, alignment of loops and of code after barriers are dropped.
12460
12461 @item 3
12462 In addition, optional data alignment is dropped, and the option @option{Os} is enabled.
12463
12464 @end table
12465
12466 This defaults to @samp{3} when @option{-Os} is in effect. Otherwise,
12467 the behavior when this is not set is equivalent to level @samp{1}.
12468
12469 @item -mtune=@var{cpu}
12470 @opindex mtune
12471 Set instruction scheduling parameters for @var{cpu}, overriding any implied
12472 by @option{-mcpu=}.
12473
12474 Supported values for @var{cpu} are
12475
12476 @table @samp
12477 @item ARC600
12478 Tune for ARC600 cpu.
12479
12480 @item ARC601
12481 Tune for ARC601 cpu.
12482
12483 @item ARC700
12484 Tune for ARC700 cpu with standard multiplier block.
12485
12486 @item ARC700-xmac
12487 Tune for ARC700 cpu with XMAC block.
12488
12489 @item ARC725D
12490 Tune for ARC725D cpu.
12491
12492 @item ARC750D
12493 Tune for ARC750D cpu.
12494
12495 @end table
12496
12497 @item -mmultcost=@var{num}
12498 @opindex mmultcost
12499 Cost to assume for a multiply instruction, with @samp{4} being equal to a
12500 normal instruction.
12501
12502 @item -munalign-prob-threshold=@var{probability}
12503 @opindex munalign-prob-threshold
12504 Set probability threshold for unaligning branches.
12505 When tuning for @samp{ARC700} and optimizing for speed, branches without
12506 filled delay slot are preferably emitted unaligned and long, unless
12507 profiling indicates that the probability for the branch to be taken
12508 is below @var{probability}. @xref{Cross-profiling}.
12509 The default is (REG_BR_PROB_BASE/2), i.e.@: 5000.
12510
12511 @end table
12512
12513 The following options are maintained for backward compatibility, but
12514 are now deprecated and will be removed in a future release:
12515
12516 @c Deprecated options
12517 @table @gcctabopt
12518
12519 @item -margonaut
12520 @opindex margonaut
12521 Obsolete FPX.
12522
12523 @item -mbig-endian
12524 @opindex mbig-endian
12525 @itemx -EB
12526 @opindex EB
12527 Compile code for big endian targets. Use of these options is now
12528 deprecated. Users wanting big-endian code, should use the
12529 @w{@code{arceb-elf32}} and @w{@code{arceb-linux-uclibc}} targets when
12530 building the tool chain, for which big-endian is the default.
12531
12532 @item -mlittle-endian
12533 @opindex mlittle-endian
12534 @itemx -EL
12535 @opindex EL
12536 Compile code for little endian targets. Use of these options is now
12537 deprecated. Users wanting little-endian code should use the
12538 @w{@code{arc-elf32}} and @w{@code{arc-linux-uclibc}} targets when
12539 building the tool chain, for which little-endian is the default.
12540
12541 @item -mbarrel_shifter
12542 @opindex mbarrel_shifter
12543 Replaced by @samp{-mbarrel-shifter}
12544
12545 @item -mdpfp_compact
12546 @opindex mdpfp_compact
12547 Replaced by @samp{-mdpfp-compact}
12548
12549 @item -mdpfp_fast
12550 @opindex mdpfp_fast
12551 Replaced by @samp{-mdpfp-fast}
12552
12553 @item -mdsp_packa
12554 @opindex mdsp_packa
12555 Replaced by @samp{-mdsp-packa}
12556
12557 @item -mEA
12558 @opindex mEA
12559 Replaced by @samp{-mea}
12560
12561 @item -mmac_24
12562 @opindex mmac_24
12563 Replaced by @samp{-mmac-24}
12564
12565 @item -mmac_d16
12566 @opindex mmac_d16
12567 Replaced by @samp{-mmac-d16}
12568
12569 @item -mspfp_compact
12570 @opindex mspfp_compact
12571 Replaced by @samp{-mspfp-compact}
12572
12573 @item -mspfp_fast
12574 @opindex mspfp_fast
12575 Replaced by @samp{-mspfp-fast}
12576
12577 @item -mtune=@var{cpu}
12578 @opindex mtune
12579 Values @samp{arc600}, @samp{arc601}, @samp{arc700} and
12580 @samp{arc700-xmac} for @var{cpu} are replaced by @samp{ARC600},
12581 @samp{ARC601}, @samp{ARC700} and @samp{ARC700-xmac} respectively
12582
12583 @item -multcost=@var{num}
12584 @opindex multcost
12585 Replaced by @samp{-mmultcost}.
12586
12587 @end table
12588
12589 @node ARM Options
12590 @subsection ARM Options
12591 @cindex ARM options
12592
12593 These @samp{-m} options are defined for Advanced RISC Machines (ARM)
12594 architectures:
12595
12596 @table @gcctabopt
12597 @item -mabi=@var{name}
12598 @opindex mabi
12599 Generate code for the specified ABI@. Permissible values are: @samp{apcs-gnu},
12600 @samp{atpcs}, @samp{aapcs}, @samp{aapcs-linux} and @samp{iwmmxt}.
12601
12602 @item -mapcs-frame
12603 @opindex mapcs-frame
12604 Generate a stack frame that is compliant with the ARM Procedure Call
12605 Standard for all functions, even if this is not strictly necessary for
12606 correct execution of the code. Specifying @option{-fomit-frame-pointer}
12607 with this option causes the stack frames not to be generated for
12608 leaf functions. The default is @option{-mno-apcs-frame}.
12609
12610 @item -mapcs
12611 @opindex mapcs
12612 This is a synonym for @option{-mapcs-frame}.
12613
12614 @ignore
12615 @c not currently implemented
12616 @item -mapcs-stack-check
12617 @opindex mapcs-stack-check
12618 Generate code to check the amount of stack space available upon entry to
12619 every function (that actually uses some stack space). If there is
12620 insufficient space available then either the function
12621 @samp{__rt_stkovf_split_small} or @samp{__rt_stkovf_split_big} is
12622 called, depending upon the amount of stack space required. The runtime
12623 system is required to provide these functions. The default is
12624 @option{-mno-apcs-stack-check}, since this produces smaller code.
12625
12626 @c not currently implemented
12627 @item -mapcs-float
12628 @opindex mapcs-float
12629 Pass floating-point arguments using the floating-point registers. This is
12630 one of the variants of the APCS@. This option is recommended if the
12631 target hardware has a floating-point unit or if a lot of floating-point
12632 arithmetic is going to be performed by the code. The default is
12633 @option{-mno-apcs-float}, since the size of integer-only code is
12634 slightly increased if @option{-mapcs-float} is used.
12635
12636 @c not currently implemented
12637 @item -mapcs-reentrant
12638 @opindex mapcs-reentrant
12639 Generate reentrant, position-independent code. The default is
12640 @option{-mno-apcs-reentrant}.
12641 @end ignore
12642
12643 @item -mthumb-interwork
12644 @opindex mthumb-interwork
12645 Generate code that supports calling between the ARM and Thumb
12646 instruction sets. Without this option, on pre-v5 architectures, the
12647 two instruction sets cannot be reliably used inside one program. The
12648 default is @option{-mno-thumb-interwork}, since slightly larger code
12649 is generated when @option{-mthumb-interwork} is specified. In AAPCS
12650 configurations this option is meaningless.
12651
12652 @item -mno-sched-prolog
12653 @opindex mno-sched-prolog
12654 Prevent the reordering of instructions in the function prologue, or the
12655 merging of those instruction with the instructions in the function's
12656 body. This means that all functions start with a recognizable set
12657 of instructions (or in fact one of a choice from a small set of
12658 different function prologues), and this information can be used to
12659 locate the start of functions inside an executable piece of code. The
12660 default is @option{-msched-prolog}.
12661
12662 @item -mfloat-abi=@var{name}
12663 @opindex mfloat-abi
12664 Specifies which floating-point ABI to use. Permissible values
12665 are: @samp{soft}, @samp{softfp} and @samp{hard}.
12666
12667 Specifying @samp{soft} causes GCC to generate output containing
12668 library calls for floating-point operations.
12669 @samp{softfp} allows the generation of code using hardware floating-point
12670 instructions, but still uses the soft-float calling conventions.
12671 @samp{hard} allows generation of floating-point instructions
12672 and uses FPU-specific calling conventions.
12673
12674 The default depends on the specific target configuration. Note that
12675 the hard-float and soft-float ABIs are not link-compatible; you must
12676 compile your entire program with the same ABI, and link with a
12677 compatible set of libraries.
12678
12679 @item -mlittle-endian
12680 @opindex mlittle-endian
12681 Generate code for a processor running in little-endian mode. This is
12682 the default for all standard configurations.
12683
12684 @item -mbig-endian
12685 @opindex mbig-endian
12686 Generate code for a processor running in big-endian mode; the default is
12687 to compile code for a little-endian processor.
12688
12689 @item -march=@var{name}
12690 @opindex march
12691 This specifies the name of the target ARM architecture. GCC uses this
12692 name to determine what kind of instructions it can emit when generating
12693 assembly code. This option can be used in conjunction with or instead
12694 of the @option{-mcpu=} option. Permissible names are: @samp{armv2},
12695 @samp{armv2a}, @samp{armv3}, @samp{armv3m}, @samp{armv4}, @samp{armv4t},
12696 @samp{armv5}, @samp{armv5t}, @samp{armv5e}, @samp{armv5te},
12697 @samp{armv6}, @samp{armv6j},
12698 @samp{armv6t2}, @samp{armv6z}, @samp{armv6zk}, @samp{armv6-m},
12699 @samp{armv7}, @samp{armv7-a}, @samp{armv7-r}, @samp{armv7-m}, @samp{armv7e-m},
12700 @samp{armv7ve}, @samp{armv8-a}, @samp{armv8-a+crc},
12701 @samp{iwmmxt}, @samp{iwmmxt2}, @samp{ep9312}.
12702
12703 @option{-march=armv7ve} is the armv7-a architecture with virtualization
12704 extensions.
12705
12706 @option{-march=armv8-a+crc} enables code generation for the ARMv8-A
12707 architecture together with the optional CRC32 extensions.
12708
12709 @option{-march=native} causes the compiler to auto-detect the architecture
12710 of the build computer. At present, this feature is only supported on
12711 GNU/Linux, and not all architectures are recognized. If the auto-detect
12712 is unsuccessful the option has no effect.
12713
12714 @item -mtune=@var{name}
12715 @opindex mtune
12716 This option specifies the name of the target ARM processor for
12717 which GCC should tune the performance of the code.
12718 For some ARM implementations better performance can be obtained by using
12719 this option.
12720 Permissible names are: @samp{arm2}, @samp{arm250},
12721 @samp{arm3}, @samp{arm6}, @samp{arm60}, @samp{arm600}, @samp{arm610},
12722 @samp{arm620}, @samp{arm7}, @samp{arm7m}, @samp{arm7d}, @samp{arm7dm},
12723 @samp{arm7di}, @samp{arm7dmi}, @samp{arm70}, @samp{arm700},
12724 @samp{arm700i}, @samp{arm710}, @samp{arm710c}, @samp{arm7100},
12725 @samp{arm720},
12726 @samp{arm7500}, @samp{arm7500fe}, @samp{arm7tdmi}, @samp{arm7tdmi-s},
12727 @samp{arm710t}, @samp{arm720t}, @samp{arm740t},
12728 @samp{strongarm}, @samp{strongarm110}, @samp{strongarm1100},
12729 @samp{strongarm1110},
12730 @samp{arm8}, @samp{arm810}, @samp{arm9}, @samp{arm9e}, @samp{arm920},
12731 @samp{arm920t}, @samp{arm922t}, @samp{arm946e-s}, @samp{arm966e-s},
12732 @samp{arm968e-s}, @samp{arm926ej-s}, @samp{arm940t}, @samp{arm9tdmi},
12733 @samp{arm10tdmi}, @samp{arm1020t}, @samp{arm1026ej-s},
12734 @samp{arm10e}, @samp{arm1020e}, @samp{arm1022e},
12735 @samp{arm1136j-s}, @samp{arm1136jf-s}, @samp{mpcore}, @samp{mpcorenovfp},
12736 @samp{arm1156t2-s}, @samp{arm1156t2f-s}, @samp{arm1176jz-s}, @samp{arm1176jzf-s},
12737 @samp{cortex-a5}, @samp{cortex-a7}, @samp{cortex-a8}, @samp{cortex-a9},
12738 @samp{cortex-a12}, @samp{cortex-a15}, @samp{cortex-a53}, @samp{cortex-a57},
12739 @samp{cortex-r4},
12740 @samp{cortex-r4f}, @samp{cortex-r5}, @samp{cortex-r7}, @samp{cortex-m7},
12741 @samp{cortex-m4},
12742 @samp{cortex-m3},
12743 @samp{cortex-m1},
12744 @samp{cortex-m0},
12745 @samp{cortex-m0plus},
12746 @samp{marvell-pj4},
12747 @samp{xscale}, @samp{iwmmxt}, @samp{iwmmxt2}, @samp{ep9312},
12748 @samp{fa526}, @samp{fa626},
12749 @samp{fa606te}, @samp{fa626te}, @samp{fmp626}, @samp{fa726te}.
12750
12751 Additionally, this option can specify that GCC should tune the performance
12752 of the code for a big.LITTLE system. Permissible names are:
12753 @samp{cortex-a15.cortex-a7}, @samp{cortex-a57.cortex-a53}.
12754
12755 @option{-mtune=generic-@var{arch}} specifies that GCC should tune the
12756 performance for a blend of processors within architecture @var{arch}.
12757 The aim is to generate code that run well on the current most popular
12758 processors, balancing between optimizations that benefit some CPUs in the
12759 range, and avoiding performance pitfalls of other CPUs. The effects of
12760 this option may change in future GCC versions as CPU models come and go.
12761
12762 @option{-mtune=native} causes the compiler to auto-detect the CPU
12763 of the build computer. At present, this feature is only supported on
12764 GNU/Linux, and not all architectures are recognized. If the auto-detect is
12765 unsuccessful the option has no effect.
12766
12767 @item -mcpu=@var{name}
12768 @opindex mcpu
12769 This specifies the name of the target ARM processor. GCC uses this name
12770 to derive the name of the target ARM architecture (as if specified
12771 by @option{-march}) and the ARM processor type for which to tune for
12772 performance (as if specified by @option{-mtune}). Where this option
12773 is used in conjunction with @option{-march} or @option{-mtune},
12774 those options take precedence over the appropriate part of this option.
12775
12776 Permissible names for this option are the same as those for
12777 @option{-mtune}.
12778
12779 @option{-mcpu=generic-@var{arch}} is also permissible, and is
12780 equivalent to @option{-march=@var{arch} -mtune=generic-@var{arch}}.
12781 See @option{-mtune} for more information.
12782
12783 @option{-mcpu=native} causes the compiler to auto-detect the CPU
12784 of the build computer. At present, this feature is only supported on
12785 GNU/Linux, and not all architectures are recognized. If the auto-detect
12786 is unsuccessful the option has no effect.
12787
12788 @item -mfpu=@var{name}
12789 @opindex mfpu
12790 This specifies what floating-point hardware (or hardware emulation) is
12791 available on the target. Permissible names are: @samp{vfp}, @samp{vfpv3},
12792 @samp{vfpv3-fp16}, @samp{vfpv3-d16}, @samp{vfpv3-d16-fp16}, @samp{vfpv3xd},
12793 @samp{vfpv3xd-fp16}, @samp{neon}, @samp{neon-fp16}, @samp{vfpv4},
12794 @samp{vfpv4-d16}, @samp{fpv4-sp-d16}, @samp{neon-vfpv4},
12795 @samp{fpv5-d16}, @samp{fpv5-sp-d16},
12796 @samp{fp-armv8}, @samp{neon-fp-armv8}, and @samp{crypto-neon-fp-armv8}.
12797
12798 If @option{-msoft-float} is specified this specifies the format of
12799 floating-point values.
12800
12801 If the selected floating-point hardware includes the NEON extension
12802 (e.g. @option{-mfpu}=@samp{neon}), note that floating-point
12803 operations are not generated by GCC's auto-vectorization pass unless
12804 @option{-funsafe-math-optimizations} is also specified. This is
12805 because NEON hardware does not fully implement the IEEE 754 standard for
12806 floating-point arithmetic (in particular denormal values are treated as
12807 zero), so the use of NEON instructions may lead to a loss of precision.
12808
12809 @item -mfp16-format=@var{name}
12810 @opindex mfp16-format
12811 Specify the format of the @code{__fp16} half-precision floating-point type.
12812 Permissible names are @samp{none}, @samp{ieee}, and @samp{alternative};
12813 the default is @samp{none}, in which case the @code{__fp16} type is not
12814 defined. @xref{Half-Precision}, for more information.
12815
12816 @item -mstructure-size-boundary=@var{n}
12817 @opindex mstructure-size-boundary
12818 The sizes of all structures and unions are rounded up to a multiple
12819 of the number of bits set by this option. Permissible values are 8, 32
12820 and 64. The default value varies for different toolchains. For the COFF
12821 targeted toolchain the default value is 8. A value of 64 is only allowed
12822 if the underlying ABI supports it.
12823
12824 Specifying a larger number can produce faster, more efficient code, but
12825 can also increase the size of the program. Different values are potentially
12826 incompatible. Code compiled with one value cannot necessarily expect to
12827 work with code or libraries compiled with another value, if they exchange
12828 information using structures or unions.
12829
12830 @item -mabort-on-noreturn
12831 @opindex mabort-on-noreturn
12832 Generate a call to the function @code{abort} at the end of a
12833 @code{noreturn} function. It is executed if the function tries to
12834 return.
12835
12836 @item -mlong-calls
12837 @itemx -mno-long-calls
12838 @opindex mlong-calls
12839 @opindex mno-long-calls
12840 Tells the compiler to perform function calls by first loading the
12841 address of the function into a register and then performing a subroutine
12842 call on this register. This switch is needed if the target function
12843 lies outside of the 64-megabyte addressing range of the offset-based
12844 version of subroutine call instruction.
12845
12846 Even if this switch is enabled, not all function calls are turned
12847 into long calls. The heuristic is that static functions, functions
12848 that have the @samp{short-call} attribute, functions that are inside
12849 the scope of a @samp{#pragma no_long_calls} directive, and functions whose
12850 definitions have already been compiled within the current compilation
12851 unit are not turned into long calls. The exceptions to this rule are
12852 that weak function definitions, functions with the @samp{long-call}
12853 attribute or the @samp{section} attribute, and functions that are within
12854 the scope of a @samp{#pragma long_calls} directive are always
12855 turned into long calls.
12856
12857 This feature is not enabled by default. Specifying
12858 @option{-mno-long-calls} restores the default behavior, as does
12859 placing the function calls within the scope of a @samp{#pragma
12860 long_calls_off} directive. Note these switches have no effect on how
12861 the compiler generates code to handle function calls via function
12862 pointers.
12863
12864 @item -msingle-pic-base
12865 @opindex msingle-pic-base
12866 Treat the register used for PIC addressing as read-only, rather than
12867 loading it in the prologue for each function. The runtime system is
12868 responsible for initializing this register with an appropriate value
12869 before execution begins.
12870
12871 @item -mpic-register=@var{reg}
12872 @opindex mpic-register
12873 Specify the register to be used for PIC addressing.
12874 For standard PIC base case, the default will be any suitable register
12875 determined by compiler. For single PIC base case, the default is
12876 @samp{R9} if target is EABI based or stack-checking is enabled,
12877 otherwise the default is @samp{R10}.
12878
12879 @item -mpic-data-is-text-relative
12880 @opindex mpic-data-is-text-relative
12881 Assume that each data segments are relative to text segment at load time.
12882 Therefore, it permits addressing data using PC-relative operations.
12883 This option is on by default for targets other than VxWorks RTP.
12884
12885 @item -mpoke-function-name
12886 @opindex mpoke-function-name
12887 Write the name of each function into the text section, directly
12888 preceding the function prologue. The generated code is similar to this:
12889
12890 @smallexample
12891 t0
12892 .ascii "arm_poke_function_name", 0
12893 .align
12894 t1
12895 .word 0xff000000 + (t1 - t0)
12896 arm_poke_function_name
12897 mov ip, sp
12898 stmfd sp!, @{fp, ip, lr, pc@}
12899 sub fp, ip, #4
12900 @end smallexample
12901
12902 When performing a stack backtrace, code can inspect the value of
12903 @code{pc} stored at @code{fp + 0}. If the trace function then looks at
12904 location @code{pc - 12} and the top 8 bits are set, then we know that
12905 there is a function name embedded immediately preceding this location
12906 and has length @code{((pc[-3]) & 0xff000000)}.
12907
12908 @item -mthumb
12909 @itemx -marm
12910 @opindex marm
12911 @opindex mthumb
12912
12913 Select between generating code that executes in ARM and Thumb
12914 states. The default for most configurations is to generate code
12915 that executes in ARM state, but the default can be changed by
12916 configuring GCC with the @option{--with-mode=}@var{state}
12917 configure option.
12918
12919 @item -mtpcs-frame
12920 @opindex mtpcs-frame
12921 Generate a stack frame that is compliant with the Thumb Procedure Call
12922 Standard for all non-leaf functions. (A leaf function is one that does
12923 not call any other functions.) The default is @option{-mno-tpcs-frame}.
12924
12925 @item -mtpcs-leaf-frame
12926 @opindex mtpcs-leaf-frame
12927 Generate a stack frame that is compliant with the Thumb Procedure Call
12928 Standard for all leaf functions. (A leaf function is one that does
12929 not call any other functions.) The default is @option{-mno-apcs-leaf-frame}.
12930
12931 @item -mcallee-super-interworking
12932 @opindex mcallee-super-interworking
12933 Gives all externally visible functions in the file being compiled an ARM
12934 instruction set header which switches to Thumb mode before executing the
12935 rest of the function. This allows these functions to be called from
12936 non-interworking code. This option is not valid in AAPCS configurations
12937 because interworking is enabled by default.
12938
12939 @item -mcaller-super-interworking
12940 @opindex mcaller-super-interworking
12941 Allows calls via function pointers (including virtual functions) to
12942 execute correctly regardless of whether the target code has been
12943 compiled for interworking or not. There is a small overhead in the cost
12944 of executing a function pointer if this option is enabled. This option
12945 is not valid in AAPCS configurations because interworking is enabled
12946 by default.
12947
12948 @item -mtp=@var{name}
12949 @opindex mtp
12950 Specify the access model for the thread local storage pointer. The valid
12951 models are @option{soft}, which generates calls to @code{__aeabi_read_tp},
12952 @option{cp15}, which fetches the thread pointer from @code{cp15} directly
12953 (supported in the arm6k architecture), and @option{auto}, which uses the
12954 best available method for the selected processor. The default setting is
12955 @option{auto}.
12956
12957 @item -mtls-dialect=@var{dialect}
12958 @opindex mtls-dialect
12959 Specify the dialect to use for accessing thread local storage. Two
12960 @var{dialect}s are supported---@samp{gnu} and @samp{gnu2}. The
12961 @samp{gnu} dialect selects the original GNU scheme for supporting
12962 local and global dynamic TLS models. The @samp{gnu2} dialect
12963 selects the GNU descriptor scheme, which provides better performance
12964 for shared libraries. The GNU descriptor scheme is compatible with
12965 the original scheme, but does require new assembler, linker and
12966 library support. Initial and local exec TLS models are unaffected by
12967 this option and always use the original scheme.
12968
12969 @item -mword-relocations
12970 @opindex mword-relocations
12971 Only generate absolute relocations on word-sized values (i.e. R_ARM_ABS32).
12972 This is enabled by default on targets (uClinux, SymbianOS) where the runtime
12973 loader imposes this restriction, and when @option{-fpic} or @option{-fPIC}
12974 is specified.
12975
12976 @item -mfix-cortex-m3-ldrd
12977 @opindex mfix-cortex-m3-ldrd
12978 Some Cortex-M3 cores can cause data corruption when @code{ldrd} instructions
12979 with overlapping destination and base registers are used. This option avoids
12980 generating these instructions. This option is enabled by default when
12981 @option{-mcpu=cortex-m3} is specified.
12982
12983 @item -munaligned-access
12984 @itemx -mno-unaligned-access
12985 @opindex munaligned-access
12986 @opindex mno-unaligned-access
12987 Enables (or disables) reading and writing of 16- and 32- bit values
12988 from addresses that are not 16- or 32- bit aligned. By default
12989 unaligned access is disabled for all pre-ARMv6 and all ARMv6-M
12990 architectures, and enabled for all other architectures. If unaligned
12991 access is not enabled then words in packed data structures will be
12992 accessed a byte at a time.
12993
12994 The ARM attribute @code{Tag_CPU_unaligned_access} will be set in the
12995 generated object file to either true or false, depending upon the
12996 setting of this option. If unaligned access is enabled then the
12997 preprocessor symbol @code{__ARM_FEATURE_UNALIGNED} will also be
12998 defined.
12999
13000 @item -mneon-for-64bits
13001 @opindex mneon-for-64bits
13002 Enables using Neon to handle scalar 64-bits operations. This is
13003 disabled by default since the cost of moving data from core registers
13004 to Neon is high.
13005
13006 @item -mslow-flash-data
13007 @opindex mslow-flash-data
13008 Assume loading data from flash is slower than fetching instruction.
13009 Therefore literal load is minimized for better performance.
13010 This option is only supported when compiling for ARMv7 M-profile and
13011 off by default.
13012
13013 @item -mrestrict-it
13014 @opindex mrestrict-it
13015 Restricts generation of IT blocks to conform to the rules of ARMv8.
13016 IT blocks can only contain a single 16-bit instruction from a select
13017 set of instructions. This option is on by default for ARMv8 Thumb mode.
13018 @end table
13019
13020 @node AVR Options
13021 @subsection AVR Options
13022 @cindex AVR Options
13023
13024 These options are defined for AVR implementations:
13025
13026 @table @gcctabopt
13027 @item -mmcu=@var{mcu}
13028 @opindex mmcu
13029 Specify Atmel AVR instruction set architectures (ISA) or MCU type.
13030
13031 The default for this option is@tie{}@code{avr2}.
13032
13033 GCC supports the following AVR devices and ISAs:
13034
13035 @include avr-mmcu.texi
13036
13037 @item -maccumulate-args
13038 @opindex maccumulate-args
13039 Accumulate outgoing function arguments and acquire/release the needed
13040 stack space for outgoing function arguments once in function
13041 prologue/epilogue. Without this option, outgoing arguments are pushed
13042 before calling a function and popped afterwards.
13043
13044 Popping the arguments after the function call can be expensive on
13045 AVR so that accumulating the stack space might lead to smaller
13046 executables because arguments need not to be removed from the
13047 stack after such a function call.
13048
13049 This option can lead to reduced code size for functions that perform
13050 several calls to functions that get their arguments on the stack like
13051 calls to printf-like functions.
13052
13053 @item -mbranch-cost=@var{cost}
13054 @opindex mbranch-cost
13055 Set the branch costs for conditional branch instructions to
13056 @var{cost}. Reasonable values for @var{cost} are small, non-negative
13057 integers. The default branch cost is 0.
13058
13059 @item -mcall-prologues
13060 @opindex mcall-prologues
13061 Functions prologues/epilogues are expanded as calls to appropriate
13062 subroutines. Code size is smaller.
13063
13064 @item -mint8
13065 @opindex mint8
13066 Assume @code{int} to be 8-bit integer. This affects the sizes of all types: a
13067 @code{char} is 1 byte, an @code{int} is 1 byte, a @code{long} is 2 bytes,
13068 and @code{long long} is 4 bytes. Please note that this option does not
13069 conform to the C standards, but it results in smaller code
13070 size.
13071
13072 @item -mno-interrupts
13073 @opindex mno-interrupts
13074 Generated code is not compatible with hardware interrupts.
13075 Code size is smaller.
13076
13077 @item -mrelax
13078 @opindex mrelax
13079 Try to replace @code{CALL} resp.@: @code{JMP} instruction by the shorter
13080 @code{RCALL} resp.@: @code{RJMP} instruction if applicable.
13081 Setting @code{-mrelax} just adds the @code{--relax} option to the
13082 linker command line when the linker is called.
13083
13084 Jump relaxing is performed by the linker because jump offsets are not
13085 known before code is located. Therefore, the assembler code generated by the
13086 compiler is the same, but the instructions in the executable may
13087 differ from instructions in the assembler code.
13088
13089 Relaxing must be turned on if linker stubs are needed, see the
13090 section on @code{EIND} and linker stubs below.
13091
13092 @item -msp8
13093 @opindex msp8
13094 Treat the stack pointer register as an 8-bit register,
13095 i.e.@: assume the high byte of the stack pointer is zero.
13096 In general, you don't need to set this option by hand.
13097
13098 This option is used internally by the compiler to select and
13099 build multilibs for architectures @code{avr2} and @code{avr25}.
13100 These architectures mix devices with and without @code{SPH}.
13101 For any setting other than @code{-mmcu=avr2} or @code{-mmcu=avr25}
13102 the compiler driver will add or remove this option from the compiler
13103 proper's command line, because the compiler then knows if the device
13104 or architecture has an 8-bit stack pointer and thus no @code{SPH}
13105 register or not.
13106
13107 @item -mstrict-X
13108 @opindex mstrict-X
13109 Use address register @code{X} in a way proposed by the hardware. This means
13110 that @code{X} is only used in indirect, post-increment or
13111 pre-decrement addressing.
13112
13113 Without this option, the @code{X} register may be used in the same way
13114 as @code{Y} or @code{Z} which then is emulated by additional
13115 instructions.
13116 For example, loading a value with @code{X+const} addressing with a
13117 small non-negative @code{const < 64} to a register @var{Rn} is
13118 performed as
13119
13120 @example
13121 adiw r26, const ; X += const
13122 ld @var{Rn}, X ; @var{Rn} = *X
13123 sbiw r26, const ; X -= const
13124 @end example
13125
13126 @item -mtiny-stack
13127 @opindex mtiny-stack
13128 Only change the lower 8@tie{}bits of the stack pointer.
13129
13130 @item -Waddr-space-convert
13131 @opindex Waddr-space-convert
13132 Warn about conversions between address spaces in the case where the
13133 resulting address space is not contained in the incoming address space.
13134 @end table
13135
13136 @subsubsection @code{EIND} and Devices with more than 128 Ki Bytes of Flash
13137 @cindex @code{EIND}
13138 Pointers in the implementation are 16@tie{}bits wide.
13139 The address of a function or label is represented as word address so
13140 that indirect jumps and calls can target any code address in the
13141 range of 64@tie{}Ki words.
13142
13143 In order to facilitate indirect jump on devices with more than 128@tie{}Ki
13144 bytes of program memory space, there is a special function register called
13145 @code{EIND} that serves as most significant part of the target address
13146 when @code{EICALL} or @code{EIJMP} instructions are used.
13147
13148 Indirect jumps and calls on these devices are handled as follows by
13149 the compiler and are subject to some limitations:
13150
13151 @itemize @bullet
13152
13153 @item
13154 The compiler never sets @code{EIND}.
13155
13156 @item
13157 The compiler uses @code{EIND} implicitely in @code{EICALL}/@code{EIJMP}
13158 instructions or might read @code{EIND} directly in order to emulate an
13159 indirect call/jump by means of a @code{RET} instruction.
13160
13161 @item
13162 The compiler assumes that @code{EIND} never changes during the startup
13163 code or during the application. In particular, @code{EIND} is not
13164 saved/restored in function or interrupt service routine
13165 prologue/epilogue.
13166
13167 @item
13168 For indirect calls to functions and computed goto, the linker
13169 generates @emph{stubs}. Stubs are jump pads sometimes also called
13170 @emph{trampolines}. Thus, the indirect call/jump jumps to such a stub.
13171 The stub contains a direct jump to the desired address.
13172
13173 @item
13174 Linker relaxation must be turned on so that the linker will generate
13175 the stubs correctly an all situaltion. See the compiler option
13176 @code{-mrelax} and the linler option @code{--relax}.
13177 There are corner cases where the linker is supposed to generate stubs
13178 but aborts without relaxation and without a helpful error message.
13179
13180 @item
13181 The default linker script is arranged for code with @code{EIND = 0}.
13182 If code is supposed to work for a setup with @code{EIND != 0}, a custom
13183 linker script has to be used in order to place the sections whose
13184 name start with @code{.trampolines} into the segment where @code{EIND}
13185 points to.
13186
13187 @item
13188 The startup code from libgcc never sets @code{EIND}.
13189 Notice that startup code is a blend of code from libgcc and AVR-LibC.
13190 For the impact of AVR-LibC on @code{EIND}, see the
13191 @w{@uref{http://nongnu.org/avr-libc/user-manual/,AVR-LibC user manual}}.
13192
13193 @item
13194 It is legitimate for user-specific startup code to set up @code{EIND}
13195 early, for example by means of initialization code located in
13196 section @code{.init3}. Such code runs prior to general startup code
13197 that initializes RAM and calls constructors, but after the bit
13198 of startup code from AVR-LibC that sets @code{EIND} to the segment
13199 where the vector table is located.
13200 @example
13201 #include <avr/io.h>
13202
13203 static void
13204 __attribute__((section(".init3"),naked,used,no_instrument_function))
13205 init3_set_eind (void)
13206 @{
13207 __asm volatile ("ldi r24,pm_hh8(__trampolines_start)\n\t"
13208 "out %i0,r24" :: "n" (&EIND) : "r24","memory");
13209 @}
13210 @end example
13211
13212 @noindent
13213 The @code{__trampolines_start} symbol is defined in the linker script.
13214
13215 @item
13216 Stubs are generated automatically by the linker if
13217 the following two conditions are met:
13218 @itemize @minus
13219
13220 @item The address of a label is taken by means of the @code{gs} modifier
13221 (short for @emph{generate stubs}) like so:
13222 @example
13223 LDI r24, lo8(gs(@var{func}))
13224 LDI r25, hi8(gs(@var{func}))
13225 @end example
13226 @item The final location of that label is in a code segment
13227 @emph{outside} the segment where the stubs are located.
13228 @end itemize
13229
13230 @item
13231 The compiler emits such @code{gs} modifiers for code labels in the
13232 following situations:
13233 @itemize @minus
13234 @item Taking address of a function or code label.
13235 @item Computed goto.
13236 @item If prologue-save function is used, see @option{-mcall-prologues}
13237 command-line option.
13238 @item Switch/case dispatch tables. If you do not want such dispatch
13239 tables you can specify the @option{-fno-jump-tables} command-line option.
13240 @item C and C++ constructors/destructors called during startup/shutdown.
13241 @item If the tools hit a @code{gs()} modifier explained above.
13242 @end itemize
13243
13244 @item
13245 Jumping to non-symbolic addresses like so is @emph{not} supported:
13246
13247 @example
13248 int main (void)
13249 @{
13250 /* Call function at word address 0x2 */
13251 return ((int(*)(void)) 0x2)();
13252 @}
13253 @end example
13254
13255 Instead, a stub has to be set up, i.e.@: the function has to be called
13256 through a symbol (@code{func_4} in the example):
13257
13258 @example
13259 int main (void)
13260 @{
13261 extern int func_4 (void);
13262
13263 /* Call function at byte address 0x4 */
13264 return func_4();
13265 @}
13266 @end example
13267
13268 and the application be linked with @code{-Wl,--defsym,func_4=0x4}.
13269 Alternatively, @code{func_4} can be defined in the linker script.
13270 @end itemize
13271
13272 @subsubsection Handling of the @code{RAMPD}, @code{RAMPX}, @code{RAMPY} and @code{RAMPZ} Special Function Registers
13273 @cindex @code{RAMPD}
13274 @cindex @code{RAMPX}
13275 @cindex @code{RAMPY}
13276 @cindex @code{RAMPZ}
13277 Some AVR devices support memories larger than the 64@tie{}KiB range
13278 that can be accessed with 16-bit pointers. To access memory locations
13279 outside this 64@tie{}KiB range, the contentent of a @code{RAMP}
13280 register is used as high part of the address:
13281 The @code{X}, @code{Y}, @code{Z} address register is concatenated
13282 with the @code{RAMPX}, @code{RAMPY}, @code{RAMPZ} special function
13283 register, respectively, to get a wide address. Similarly,
13284 @code{RAMPD} is used together with direct addressing.
13285
13286 @itemize
13287 @item
13288 The startup code initializes the @code{RAMP} special function
13289 registers with zero.
13290
13291 @item
13292 If a @ref{AVR Named Address Spaces,named address space} other than
13293 generic or @code{__flash} is used, then @code{RAMPZ} is set
13294 as needed before the operation.
13295
13296 @item
13297 If the device supports RAM larger than 64@tie{}KiB and the compiler
13298 needs to change @code{RAMPZ} to accomplish an operation, @code{RAMPZ}
13299 is reset to zero after the operation.
13300
13301 @item
13302 If the device comes with a specific @code{RAMP} register, the ISR
13303 prologue/epilogue saves/restores that SFR and initializes it with
13304 zero in case the ISR code might (implicitly) use it.
13305
13306 @item
13307 RAM larger than 64@tie{}KiB is not supported by GCC for AVR targets.
13308 If you use inline assembler to read from locations outside the
13309 16-bit address range and change one of the @code{RAMP} registers,
13310 you must reset it to zero after the access.
13311
13312 @end itemize
13313
13314 @subsubsection AVR Built-in Macros
13315
13316 GCC defines several built-in macros so that the user code can test
13317 for the presence or absence of features. Almost any of the following
13318 built-in macros are deduced from device capabilities and thus
13319 triggered by the @code{-mmcu=} command-line option.
13320
13321 For even more AVR-specific built-in macros see
13322 @ref{AVR Named Address Spaces} and @ref{AVR Built-in Functions}.
13323
13324 @table @code
13325
13326 @item __AVR_ARCH__
13327 Build-in macro that resolves to a decimal number that identifies the
13328 architecture and depends on the @code{-mmcu=@var{mcu}} option.
13329 Possible values are:
13330
13331 @code{2}, @code{25}, @code{3}, @code{31}, @code{35},
13332 @code{4}, @code{5}, @code{51}, @code{6}, @code{102}, @code{104},
13333 @code{105}, @code{106}, @code{107}
13334
13335 for @var{mcu}=@code{avr2}, @code{avr25}, @code{avr3},
13336 @code{avr31}, @code{avr35}, @code{avr4}, @code{avr5}, @code{avr51},
13337 @code{avr6}, @code{avrxmega2}, @code{avrxmega4}, @code{avrxmega5},
13338 @code{avrxmega6}, @code{avrxmega7}, respectively.
13339 If @var{mcu} specifies a device, this built-in macro is set
13340 accordingly. For example, with @code{-mmcu=atmega8} the macro will be
13341 defined to @code{4}.
13342
13343 @item __AVR_@var{Device}__
13344 Setting @code{-mmcu=@var{device}} defines this built-in macro which reflects
13345 the device's name. For example, @code{-mmcu=atmega8} defines the
13346 built-in macro @code{__AVR_ATmega8__}, @code{-mmcu=attiny261a} defines
13347 @code{__AVR_ATtiny261A__}, etc.
13348
13349 The built-in macros' names follow
13350 the scheme @code{__AVR_@var{Device}__} where @var{Device} is
13351 the device name as from the AVR user manual. The difference between
13352 @var{Device} in the built-in macro and @var{device} in
13353 @code{-mmcu=@var{device}} is that the latter is always lowercase.
13354
13355 If @var{device} is not a device but only a core architecture like
13356 @code{avr51}, this macro will not be defined.
13357
13358 @item __AVR_DEVICE_NAME__
13359 Setting @code{-mmcu=@var{device}} defines this built-in macro to
13360 the device's name. For example, with @code{-mmcu=atmega8} the macro
13361 will be defined to @code{atmega8}.
13362
13363 If @var{device} is not a device but only a core architecture like
13364 @code{avr51}, this macro will not be defined.
13365
13366 @item __AVR_XMEGA__
13367 The device / architecture belongs to the XMEGA family of devices.
13368
13369 @item __AVR_HAVE_ELPM__
13370 The device has the the @code{ELPM} instruction.
13371
13372 @item __AVR_HAVE_ELPMX__
13373 The device has the @code{ELPM R@var{n},Z} and @code{ELPM
13374 R@var{n},Z+} instructions.
13375
13376 @item __AVR_HAVE_MOVW__
13377 The device has the @code{MOVW} instruction to perform 16-bit
13378 register-register moves.
13379
13380 @item __AVR_HAVE_LPMX__
13381 The device has the @code{LPM R@var{n},Z} and
13382 @code{LPM R@var{n},Z+} instructions.
13383
13384 @item __AVR_HAVE_MUL__
13385 The device has a hardware multiplier.
13386
13387 @item __AVR_HAVE_JMP_CALL__
13388 The device has the @code{JMP} and @code{CALL} instructions.
13389 This is the case for devices with at least 16@tie{}KiB of program
13390 memory.
13391
13392 @item __AVR_HAVE_EIJMP_EICALL__
13393 @itemx __AVR_3_BYTE_PC__
13394 The device has the @code{EIJMP} and @code{EICALL} instructions.
13395 This is the case for devices with more than 128@tie{}KiB of program memory.
13396 This also means that the program counter
13397 (PC) is 3@tie{}bytes wide.
13398
13399 @item __AVR_2_BYTE_PC__
13400 The program counter (PC) is 2@tie{}bytes wide. This is the case for devices
13401 with up to 128@tie{}KiB of program memory.
13402
13403 @item __AVR_HAVE_8BIT_SP__
13404 @itemx __AVR_HAVE_16BIT_SP__
13405 The stack pointer (SP) register is treated as 8-bit respectively
13406 16-bit register by the compiler.
13407 The definition of these macros is affected by @code{-mtiny-stack}.
13408
13409 @item __AVR_HAVE_SPH__
13410 @itemx __AVR_SP8__
13411 The device has the SPH (high part of stack pointer) special function
13412 register or has an 8-bit stack pointer, respectively.
13413 The definition of these macros is affected by @code{-mmcu=} and
13414 in the cases of @code{-mmcu=avr2} and @code{-mmcu=avr25} also
13415 by @code{-msp8}.
13416
13417 @item __AVR_HAVE_RAMPD__
13418 @itemx __AVR_HAVE_RAMPX__
13419 @itemx __AVR_HAVE_RAMPY__
13420 @itemx __AVR_HAVE_RAMPZ__
13421 The device has the @code{RAMPD}, @code{RAMPX}, @code{RAMPY},
13422 @code{RAMPZ} special function register, respectively.
13423
13424 @item __NO_INTERRUPTS__
13425 This macro reflects the @code{-mno-interrupts} command line option.
13426
13427 @item __AVR_ERRATA_SKIP__
13428 @itemx __AVR_ERRATA_SKIP_JMP_CALL__
13429 Some AVR devices (AT90S8515, ATmega103) must not skip 32-bit
13430 instructions because of a hardware erratum. Skip instructions are
13431 @code{SBRS}, @code{SBRC}, @code{SBIS}, @code{SBIC} and @code{CPSE}.
13432 The second macro is only defined if @code{__AVR_HAVE_JMP_CALL__} is also
13433 set.
13434
13435 @item __AVR_ISA_RMW__
13436 The device has Read-Modify-Write instructions (XCH, LAC, LAS and LAT).
13437
13438 @item __AVR_SFR_OFFSET__=@var{offset}
13439 Instructions that can address I/O special function registers directly
13440 like @code{IN}, @code{OUT}, @code{SBI}, etc.@: may use a different
13441 address as if addressed by an instruction to access RAM like @code{LD}
13442 or @code{STS}. This offset depends on the device architecture and has
13443 to be subtracted from the RAM address in order to get the
13444 respective I/O@tie{}address.
13445
13446 @item __WITH_AVRLIBC__
13447 The compiler is configured to be used together with AVR-Libc.
13448 See the @code{--with-avrlibc} configure option.
13449
13450 @end table
13451
13452 @node Blackfin Options
13453 @subsection Blackfin Options
13454 @cindex Blackfin Options
13455
13456 @table @gcctabopt
13457 @item -mcpu=@var{cpu}@r{[}-@var{sirevision}@r{]}
13458 @opindex mcpu=
13459 Specifies the name of the target Blackfin processor. Currently, @var{cpu}
13460 can be one of @samp{bf512}, @samp{bf514}, @samp{bf516}, @samp{bf518},
13461 @samp{bf522}, @samp{bf523}, @samp{bf524}, @samp{bf525}, @samp{bf526},
13462 @samp{bf527}, @samp{bf531}, @samp{bf532}, @samp{bf533},
13463 @samp{bf534}, @samp{bf536}, @samp{bf537}, @samp{bf538}, @samp{bf539},
13464 @samp{bf542}, @samp{bf544}, @samp{bf547}, @samp{bf548}, @samp{bf549},
13465 @samp{bf542m}, @samp{bf544m}, @samp{bf547m}, @samp{bf548m}, @samp{bf549m},
13466 @samp{bf561}, @samp{bf592}.
13467
13468 The optional @var{sirevision} specifies the silicon revision of the target
13469 Blackfin processor. Any workarounds available for the targeted silicon revision
13470 are enabled. If @var{sirevision} is @samp{none}, no workarounds are enabled.
13471 If @var{sirevision} is @samp{any}, all workarounds for the targeted processor
13472 are enabled. The @code{__SILICON_REVISION__} macro is defined to two
13473 hexadecimal digits representing the major and minor numbers in the silicon
13474 revision. If @var{sirevision} is @samp{none}, the @code{__SILICON_REVISION__}
13475 is not defined. If @var{sirevision} is @samp{any}, the
13476 @code{__SILICON_REVISION__} is defined to be @code{0xffff}.
13477 If this optional @var{sirevision} is not used, GCC assumes the latest known
13478 silicon revision of the targeted Blackfin processor.
13479
13480 GCC defines a preprocessor macro for the specified @var{cpu}.
13481 For the @samp{bfin-elf} toolchain, this option causes the hardware BSP
13482 provided by libgloss to be linked in if @option{-msim} is not given.
13483
13484 Without this option, @samp{bf532} is used as the processor by default.
13485
13486 Note that support for @samp{bf561} is incomplete. For @samp{bf561},
13487 only the preprocessor macro is defined.
13488
13489 @item -msim
13490 @opindex msim
13491 Specifies that the program will be run on the simulator. This causes
13492 the simulator BSP provided by libgloss to be linked in. This option
13493 has effect only for @samp{bfin-elf} toolchain.
13494 Certain other options, such as @option{-mid-shared-library} and
13495 @option{-mfdpic}, imply @option{-msim}.
13496
13497 @item -momit-leaf-frame-pointer
13498 @opindex momit-leaf-frame-pointer
13499 Don't keep the frame pointer in a register for leaf functions. This
13500 avoids the instructions to save, set up and restore frame pointers and
13501 makes an extra register available in leaf functions. The option
13502 @option{-fomit-frame-pointer} removes the frame pointer for all functions,
13503 which might make debugging harder.
13504
13505 @item -mspecld-anomaly
13506 @opindex mspecld-anomaly
13507 When enabled, the compiler ensures that the generated code does not
13508 contain speculative loads after jump instructions. If this option is used,
13509 @code{__WORKAROUND_SPECULATIVE_LOADS} is defined.
13510
13511 @item -mno-specld-anomaly
13512 @opindex mno-specld-anomaly
13513 Don't generate extra code to prevent speculative loads from occurring.
13514
13515 @item -mcsync-anomaly
13516 @opindex mcsync-anomaly
13517 When enabled, the compiler ensures that the generated code does not
13518 contain CSYNC or SSYNC instructions too soon after conditional branches.
13519 If this option is used, @code{__WORKAROUND_SPECULATIVE_SYNCS} is defined.
13520
13521 @item -mno-csync-anomaly
13522 @opindex mno-csync-anomaly
13523 Don't generate extra code to prevent CSYNC or SSYNC instructions from
13524 occurring too soon after a conditional branch.
13525
13526 @item -mlow-64k
13527 @opindex mlow-64k
13528 When enabled, the compiler is free to take advantage of the knowledge that
13529 the entire program fits into the low 64k of memory.
13530
13531 @item -mno-low-64k
13532 @opindex mno-low-64k
13533 Assume that the program is arbitrarily large. This is the default.
13534
13535 @item -mstack-check-l1
13536 @opindex mstack-check-l1
13537 Do stack checking using information placed into L1 scratchpad memory by the
13538 uClinux kernel.
13539
13540 @item -mid-shared-library
13541 @opindex mid-shared-library
13542 Generate code that supports shared libraries via the library ID method.
13543 This allows for execute in place and shared libraries in an environment
13544 without virtual memory management. This option implies @option{-fPIC}.
13545 With a @samp{bfin-elf} target, this option implies @option{-msim}.
13546
13547 @item -mno-id-shared-library
13548 @opindex mno-id-shared-library
13549 Generate code that doesn't assume ID-based shared libraries are being used.
13550 This is the default.
13551
13552 @item -mleaf-id-shared-library
13553 @opindex mleaf-id-shared-library
13554 Generate code that supports shared libraries via the library ID method,
13555 but assumes that this library or executable won't link against any other
13556 ID shared libraries. That allows the compiler to use faster code for jumps
13557 and calls.
13558
13559 @item -mno-leaf-id-shared-library
13560 @opindex mno-leaf-id-shared-library
13561 Do not assume that the code being compiled won't link against any ID shared
13562 libraries. Slower code is generated for jump and call insns.
13563
13564 @item -mshared-library-id=n
13565 @opindex mshared-library-id
13566 Specifies the identification number of the ID-based shared library being
13567 compiled. Specifying a value of 0 generates more compact code; specifying
13568 other values forces the allocation of that number to the current
13569 library but is no more space- or time-efficient than omitting this option.
13570
13571 @item -msep-data
13572 @opindex msep-data
13573 Generate code that allows the data segment to be located in a different
13574 area of memory from the text segment. This allows for execute in place in
13575 an environment without virtual memory management by eliminating relocations
13576 against the text section.
13577
13578 @item -mno-sep-data
13579 @opindex mno-sep-data
13580 Generate code that assumes that the data segment follows the text segment.
13581 This is the default.
13582
13583 @item -mlong-calls
13584 @itemx -mno-long-calls
13585 @opindex mlong-calls
13586 @opindex mno-long-calls
13587 Tells the compiler to perform function calls by first loading the
13588 address of the function into a register and then performing a subroutine
13589 call on this register. This switch is needed if the target function
13590 lies outside of the 24-bit addressing range of the offset-based
13591 version of subroutine call instruction.
13592
13593 This feature is not enabled by default. Specifying
13594 @option{-mno-long-calls} restores the default behavior. Note these
13595 switches have no effect on how the compiler generates code to handle
13596 function calls via function pointers.
13597
13598 @item -mfast-fp
13599 @opindex mfast-fp
13600 Link with the fast floating-point library. This library relaxes some of
13601 the IEEE floating-point standard's rules for checking inputs against
13602 Not-a-Number (NAN), in the interest of performance.
13603
13604 @item -minline-plt
13605 @opindex minline-plt
13606 Enable inlining of PLT entries in function calls to functions that are
13607 not known to bind locally. It has no effect without @option{-mfdpic}.
13608
13609 @item -mmulticore
13610 @opindex mmulticore
13611 Build a standalone application for multicore Blackfin processors.
13612 This option causes proper start files and link scripts supporting
13613 multicore to be used, and defines the macro @code{__BFIN_MULTICORE}.
13614 It can only be used with @option{-mcpu=bf561@r{[}-@var{sirevision}@r{]}}.
13615
13616 This option can be used with @option{-mcorea} or @option{-mcoreb}, which
13617 selects the one-application-per-core programming model. Without
13618 @option{-mcorea} or @option{-mcoreb}, the single-application/dual-core
13619 programming model is used. In this model, the main function of Core B
13620 should be named as @code{coreb_main}.
13621
13622 If this option is not used, the single-core application programming
13623 model is used.
13624
13625 @item -mcorea
13626 @opindex mcorea
13627 Build a standalone application for Core A of BF561 when using
13628 the one-application-per-core programming model. Proper start files
13629 and link scripts are used to support Core A, and the macro
13630 @code{__BFIN_COREA} is defined.
13631 This option can only be used in conjunction with @option{-mmulticore}.
13632
13633 @item -mcoreb
13634 @opindex mcoreb
13635 Build a standalone application for Core B of BF561 when using
13636 the one-application-per-core programming model. Proper start files
13637 and link scripts are used to support Core B, and the macro
13638 @code{__BFIN_COREB} is defined. When this option is used, @code{coreb_main}
13639 should be used instead of @code{main}.
13640 This option can only be used in conjunction with @option{-mmulticore}.
13641
13642 @item -msdram
13643 @opindex msdram
13644 Build a standalone application for SDRAM. Proper start files and
13645 link scripts are used to put the application into SDRAM, and the macro
13646 @code{__BFIN_SDRAM} is defined.
13647 The loader should initialize SDRAM before loading the application.
13648
13649 @item -micplb
13650 @opindex micplb
13651 Assume that ICPLBs are enabled at run time. This has an effect on certain
13652 anomaly workarounds. For Linux targets, the default is to assume ICPLBs
13653 are enabled; for standalone applications the default is off.
13654 @end table
13655
13656 @node C6X Options
13657 @subsection C6X Options
13658 @cindex C6X Options
13659
13660 @table @gcctabopt
13661 @item -march=@var{name}
13662 @opindex march
13663 This specifies the name of the target architecture. GCC uses this
13664 name to determine what kind of instructions it can emit when generating
13665 assembly code. Permissible names are: @samp{c62x},
13666 @samp{c64x}, @samp{c64x+}, @samp{c67x}, @samp{c67x+}, @samp{c674x}.
13667
13668 @item -mbig-endian
13669 @opindex mbig-endian
13670 Generate code for a big-endian target.
13671
13672 @item -mlittle-endian
13673 @opindex mlittle-endian
13674 Generate code for a little-endian target. This is the default.
13675
13676 @item -msim
13677 @opindex msim
13678 Choose startup files and linker script suitable for the simulator.
13679
13680 @item -msdata=default
13681 @opindex msdata=default
13682 Put small global and static data in the @samp{.neardata} section,
13683 which is pointed to by register @code{B14}. Put small uninitialized
13684 global and static data in the @samp{.bss} section, which is adjacent
13685 to the @samp{.neardata} section. Put small read-only data into the
13686 @samp{.rodata} section. The corresponding sections used for large
13687 pieces of data are @samp{.fardata}, @samp{.far} and @samp{.const}.
13688
13689 @item -msdata=all
13690 @opindex msdata=all
13691 Put all data, not just small objects, into the sections reserved for
13692 small data, and use addressing relative to the @code{B14} register to
13693 access them.
13694
13695 @item -msdata=none
13696 @opindex msdata=none
13697 Make no use of the sections reserved for small data, and use absolute
13698 addresses to access all data. Put all initialized global and static
13699 data in the @samp{.fardata} section, and all uninitialized data in the
13700 @samp{.far} section. Put all constant data into the @samp{.const}
13701 section.
13702 @end table
13703
13704 @node CRIS Options
13705 @subsection CRIS Options
13706 @cindex CRIS Options
13707
13708 These options are defined specifically for the CRIS ports.
13709
13710 @table @gcctabopt
13711 @item -march=@var{architecture-type}
13712 @itemx -mcpu=@var{architecture-type}
13713 @opindex march
13714 @opindex mcpu
13715 Generate code for the specified architecture. The choices for
13716 @var{architecture-type} are @samp{v3}, @samp{v8} and @samp{v10} for
13717 respectively ETRAX@w{ }4, ETRAX@w{ }100, and ETRAX@w{ }100@w{ }LX@.
13718 Default is @samp{v0} except for cris-axis-linux-gnu, where the default is
13719 @samp{v10}.
13720
13721 @item -mtune=@var{architecture-type}
13722 @opindex mtune
13723 Tune to @var{architecture-type} everything applicable about the generated
13724 code, except for the ABI and the set of available instructions. The
13725 choices for @var{architecture-type} are the same as for
13726 @option{-march=@var{architecture-type}}.
13727
13728 @item -mmax-stack-frame=@var{n}
13729 @opindex mmax-stack-frame
13730 Warn when the stack frame of a function exceeds @var{n} bytes.
13731
13732 @item -metrax4
13733 @itemx -metrax100
13734 @opindex metrax4
13735 @opindex metrax100
13736 The options @option{-metrax4} and @option{-metrax100} are synonyms for
13737 @option{-march=v3} and @option{-march=v8} respectively.
13738
13739 @item -mmul-bug-workaround
13740 @itemx -mno-mul-bug-workaround
13741 @opindex mmul-bug-workaround
13742 @opindex mno-mul-bug-workaround
13743 Work around a bug in the @code{muls} and @code{mulu} instructions for CPU
13744 models where it applies. This option is active by default.
13745
13746 @item -mpdebug
13747 @opindex mpdebug
13748 Enable CRIS-specific verbose debug-related information in the assembly
13749 code. This option also has the effect of turning off the @samp{#NO_APP}
13750 formatted-code indicator to the assembler at the beginning of the
13751 assembly file.
13752
13753 @item -mcc-init
13754 @opindex mcc-init
13755 Do not use condition-code results from previous instruction; always emit
13756 compare and test instructions before use of condition codes.
13757
13758 @item -mno-side-effects
13759 @opindex mno-side-effects
13760 Do not emit instructions with side effects in addressing modes other than
13761 post-increment.
13762
13763 @item -mstack-align
13764 @itemx -mno-stack-align
13765 @itemx -mdata-align
13766 @itemx -mno-data-align
13767 @itemx -mconst-align
13768 @itemx -mno-const-align
13769 @opindex mstack-align
13770 @opindex mno-stack-align
13771 @opindex mdata-align
13772 @opindex mno-data-align
13773 @opindex mconst-align
13774 @opindex mno-const-align
13775 These options (@samp{no-} options) arrange (eliminate arrangements) for the
13776 stack frame, individual data and constants to be aligned for the maximum
13777 single data access size for the chosen CPU model. The default is to
13778 arrange for 32-bit alignment. ABI details such as structure layout are
13779 not affected by these options.
13780
13781 @item -m32-bit
13782 @itemx -m16-bit
13783 @itemx -m8-bit
13784 @opindex m32-bit
13785 @opindex m16-bit
13786 @opindex m8-bit
13787 Similar to the stack- data- and const-align options above, these options
13788 arrange for stack frame, writable data and constants to all be 32-bit,
13789 16-bit or 8-bit aligned. The default is 32-bit alignment.
13790
13791 @item -mno-prologue-epilogue
13792 @itemx -mprologue-epilogue
13793 @opindex mno-prologue-epilogue
13794 @opindex mprologue-epilogue
13795 With @option{-mno-prologue-epilogue}, the normal function prologue and
13796 epilogue which set up the stack frame are omitted and no return
13797 instructions or return sequences are generated in the code. Use this
13798 option only together with visual inspection of the compiled code: no
13799 warnings or errors are generated when call-saved registers must be saved,
13800 or storage for local variables needs to be allocated.
13801
13802 @item -mno-gotplt
13803 @itemx -mgotplt
13804 @opindex mno-gotplt
13805 @opindex mgotplt
13806 With @option{-fpic} and @option{-fPIC}, don't generate (do generate)
13807 instruction sequences that load addresses for functions from the PLT part
13808 of the GOT rather than (traditional on other architectures) calls to the
13809 PLT@. The default is @option{-mgotplt}.
13810
13811 @item -melf
13812 @opindex melf
13813 Legacy no-op option only recognized with the cris-axis-elf and
13814 cris-axis-linux-gnu targets.
13815
13816 @item -mlinux
13817 @opindex mlinux
13818 Legacy no-op option only recognized with the cris-axis-linux-gnu target.
13819
13820 @item -sim
13821 @opindex sim
13822 This option, recognized for the cris-axis-elf, arranges
13823 to link with input-output functions from a simulator library. Code,
13824 initialized data and zero-initialized data are allocated consecutively.
13825
13826 @item -sim2
13827 @opindex sim2
13828 Like @option{-sim}, but pass linker options to locate initialized data at
13829 0x40000000 and zero-initialized data at 0x80000000.
13830 @end table
13831
13832 @node CR16 Options
13833 @subsection CR16 Options
13834 @cindex CR16 Options
13835
13836 These options are defined specifically for the CR16 ports.
13837
13838 @table @gcctabopt
13839
13840 @item -mmac
13841 @opindex mmac
13842 Enable the use of multiply-accumulate instructions. Disabled by default.
13843
13844 @item -mcr16cplus
13845 @itemx -mcr16c
13846 @opindex mcr16cplus
13847 @opindex mcr16c
13848 Generate code for CR16C or CR16C+ architecture. CR16C+ architecture
13849 is default.
13850
13851 @item -msim
13852 @opindex msim
13853 Links the library libsim.a which is in compatible with simulator. Applicable
13854 to ELF compiler only.
13855
13856 @item -mint32
13857 @opindex mint32
13858 Choose integer type as 32-bit wide.
13859
13860 @item -mbit-ops
13861 @opindex mbit-ops
13862 Generates @code{sbit}/@code{cbit} instructions for bit manipulations.
13863
13864 @item -mdata-model=@var{model}
13865 @opindex mdata-model
13866 Choose a data model. The choices for @var{model} are @samp{near},
13867 @samp{far} or @samp{medium}. @samp{medium} is default.
13868 However, @samp{far} is not valid with @option{-mcr16c}, as the
13869 CR16C architecture does not support the far data model.
13870 @end table
13871
13872 @node Darwin Options
13873 @subsection Darwin Options
13874 @cindex Darwin options
13875
13876 These options are defined for all architectures running the Darwin operating
13877 system.
13878
13879 FSF GCC on Darwin does not create ``fat'' object files; it creates
13880 an object file for the single architecture that GCC was built to
13881 target. Apple's GCC on Darwin does create ``fat'' files if multiple
13882 @option{-arch} options are used; it does so by running the compiler or
13883 linker multiple times and joining the results together with
13884 @file{lipo}.
13885
13886 The subtype of the file created (like @samp{ppc7400} or @samp{ppc970} or
13887 @samp{i686}) is determined by the flags that specify the ISA
13888 that GCC is targeting, like @option{-mcpu} or @option{-march}. The
13889 @option{-force_cpusubtype_ALL} option can be used to override this.
13890
13891 The Darwin tools vary in their behavior when presented with an ISA
13892 mismatch. The assembler, @file{as}, only permits instructions to
13893 be used that are valid for the subtype of the file it is generating,
13894 so you cannot put 64-bit instructions in a @samp{ppc750} object file.
13895 The linker for shared libraries, @file{/usr/bin/libtool}, fails
13896 and prints an error if asked to create a shared library with a less
13897 restrictive subtype than its input files (for instance, trying to put
13898 a @samp{ppc970} object file in a @samp{ppc7400} library). The linker
13899 for executables, @command{ld}, quietly gives the executable the most
13900 restrictive subtype of any of its input files.
13901
13902 @table @gcctabopt
13903 @item -F@var{dir}
13904 @opindex F
13905 Add the framework directory @var{dir} to the head of the list of
13906 directories to be searched for header files. These directories are
13907 interleaved with those specified by @option{-I} options and are
13908 scanned in a left-to-right order.
13909
13910 A framework directory is a directory with frameworks in it. A
13911 framework is a directory with a @file{Headers} and/or
13912 @file{PrivateHeaders} directory contained directly in it that ends
13913 in @file{.framework}. The name of a framework is the name of this
13914 directory excluding the @file{.framework}. Headers associated with
13915 the framework are found in one of those two directories, with
13916 @file{Headers} being searched first. A subframework is a framework
13917 directory that is in a framework's @file{Frameworks} directory.
13918 Includes of subframework headers can only appear in a header of a
13919 framework that contains the subframework, or in a sibling subframework
13920 header. Two subframeworks are siblings if they occur in the same
13921 framework. A subframework should not have the same name as a
13922 framework; a warning is issued if this is violated. Currently a
13923 subframework cannot have subframeworks; in the future, the mechanism
13924 may be extended to support this. The standard frameworks can be found
13925 in @file{/System/Library/Frameworks} and
13926 @file{/Library/Frameworks}. An example include looks like
13927 @code{#include <Framework/header.h>}, where @file{Framework} denotes
13928 the name of the framework and @file{header.h} is found in the
13929 @file{PrivateHeaders} or @file{Headers} directory.
13930
13931 @item -iframework@var{dir}
13932 @opindex iframework
13933 Like @option{-F} except the directory is a treated as a system
13934 directory. The main difference between this @option{-iframework} and
13935 @option{-F} is that with @option{-iframework} the compiler does not
13936 warn about constructs contained within header files found via
13937 @var{dir}. This option is valid only for the C family of languages.
13938
13939 @item -gused
13940 @opindex gused
13941 Emit debugging information for symbols that are used. For stabs
13942 debugging format, this enables @option{-feliminate-unused-debug-symbols}.
13943 This is by default ON@.
13944
13945 @item -gfull
13946 @opindex gfull
13947 Emit debugging information for all symbols and types.
13948
13949 @item -mmacosx-version-min=@var{version}
13950 The earliest version of MacOS X that this executable will run on
13951 is @var{version}. Typical values of @var{version} include @code{10.1},
13952 @code{10.2}, and @code{10.3.9}.
13953
13954 If the compiler was built to use the system's headers by default,
13955 then the default for this option is the system version on which the
13956 compiler is running, otherwise the default is to make choices that
13957 are compatible with as many systems and code bases as possible.
13958
13959 @item -mkernel
13960 @opindex mkernel
13961 Enable kernel development mode. The @option{-mkernel} option sets
13962 @option{-static}, @option{-fno-common}, @option{-fno-use-cxa-atexit},
13963 @option{-fno-exceptions}, @option{-fno-non-call-exceptions},
13964 @option{-fapple-kext}, @option{-fno-weak} and @option{-fno-rtti} where
13965 applicable. This mode also sets @option{-mno-altivec},
13966 @option{-msoft-float}, @option{-fno-builtin} and
13967 @option{-mlong-branch} for PowerPC targets.
13968
13969 @item -mone-byte-bool
13970 @opindex mone-byte-bool
13971 Override the defaults for @samp{bool} so that @samp{sizeof(bool)==1}.
13972 By default @samp{sizeof(bool)} is @samp{4} when compiling for
13973 Darwin/PowerPC and @samp{1} when compiling for Darwin/x86, so this
13974 option has no effect on x86.
13975
13976 @strong{Warning:} The @option{-mone-byte-bool} switch causes GCC
13977 to generate code that is not binary compatible with code generated
13978 without that switch. Using this switch may require recompiling all
13979 other modules in a program, including system libraries. Use this
13980 switch to conform to a non-default data model.
13981
13982 @item -mfix-and-continue
13983 @itemx -ffix-and-continue
13984 @itemx -findirect-data
13985 @opindex mfix-and-continue
13986 @opindex ffix-and-continue
13987 @opindex findirect-data
13988 Generate code suitable for fast turnaround development, such as to
13989 allow GDB to dynamically load @code{.o} files into already-running
13990 programs. @option{-findirect-data} and @option{-ffix-and-continue}
13991 are provided for backwards compatibility.
13992
13993 @item -all_load
13994 @opindex all_load
13995 Loads all members of static archive libraries.
13996 See man ld(1) for more information.
13997
13998 @item -arch_errors_fatal
13999 @opindex arch_errors_fatal
14000 Cause the errors having to do with files that have the wrong architecture
14001 to be fatal.
14002
14003 @item -bind_at_load
14004 @opindex bind_at_load
14005 Causes the output file to be marked such that the dynamic linker will
14006 bind all undefined references when the file is loaded or launched.
14007
14008 @item -bundle
14009 @opindex bundle
14010 Produce a Mach-o bundle format file.
14011 See man ld(1) for more information.
14012
14013 @item -bundle_loader @var{executable}
14014 @opindex bundle_loader
14015 This option specifies the @var{executable} that will load the build
14016 output file being linked. See man ld(1) for more information.
14017
14018 @item -dynamiclib
14019 @opindex dynamiclib
14020 When passed this option, GCC produces a dynamic library instead of
14021 an executable when linking, using the Darwin @file{libtool} command.
14022
14023 @item -force_cpusubtype_ALL
14024 @opindex force_cpusubtype_ALL
14025 This causes GCC's output file to have the @var{ALL} subtype, instead of
14026 one controlled by the @option{-mcpu} or @option{-march} option.
14027
14028 @item -allowable_client @var{client_name}
14029 @itemx -client_name
14030 @itemx -compatibility_version
14031 @itemx -current_version
14032 @itemx -dead_strip
14033 @itemx -dependency-file
14034 @itemx -dylib_file
14035 @itemx -dylinker_install_name
14036 @itemx -dynamic
14037 @itemx -exported_symbols_list
14038 @itemx -filelist
14039 @need 800
14040 @itemx -flat_namespace
14041 @itemx -force_flat_namespace
14042 @itemx -headerpad_max_install_names
14043 @itemx -image_base
14044 @itemx -init
14045 @itemx -install_name
14046 @itemx -keep_private_externs
14047 @itemx -multi_module
14048 @itemx -multiply_defined
14049 @itemx -multiply_defined_unused
14050 @need 800
14051 @itemx -noall_load
14052 @itemx -no_dead_strip_inits_and_terms
14053 @itemx -nofixprebinding
14054 @itemx -nomultidefs
14055 @itemx -noprebind
14056 @itemx -noseglinkedit
14057 @itemx -pagezero_size
14058 @itemx -prebind
14059 @itemx -prebind_all_twolevel_modules
14060 @itemx -private_bundle
14061 @need 800
14062 @itemx -read_only_relocs
14063 @itemx -sectalign
14064 @itemx -sectobjectsymbols
14065 @itemx -whyload
14066 @itemx -seg1addr
14067 @itemx -sectcreate
14068 @itemx -sectobjectsymbols
14069 @itemx -sectorder
14070 @itemx -segaddr
14071 @itemx -segs_read_only_addr
14072 @need 800
14073 @itemx -segs_read_write_addr
14074 @itemx -seg_addr_table
14075 @itemx -seg_addr_table_filename
14076 @itemx -seglinkedit
14077 @itemx -segprot
14078 @itemx -segs_read_only_addr
14079 @itemx -segs_read_write_addr
14080 @itemx -single_module
14081 @itemx -static
14082 @itemx -sub_library
14083 @need 800
14084 @itemx -sub_umbrella
14085 @itemx -twolevel_namespace
14086 @itemx -umbrella
14087 @itemx -undefined
14088 @itemx -unexported_symbols_list
14089 @itemx -weak_reference_mismatches
14090 @itemx -whatsloaded
14091 @opindex allowable_client
14092 @opindex client_name
14093 @opindex compatibility_version
14094 @opindex current_version
14095 @opindex dead_strip
14096 @opindex dependency-file
14097 @opindex dylib_file
14098 @opindex dylinker_install_name
14099 @opindex dynamic
14100 @opindex exported_symbols_list
14101 @opindex filelist
14102 @opindex flat_namespace
14103 @opindex force_flat_namespace
14104 @opindex headerpad_max_install_names
14105 @opindex image_base
14106 @opindex init
14107 @opindex install_name
14108 @opindex keep_private_externs
14109 @opindex multi_module
14110 @opindex multiply_defined
14111 @opindex multiply_defined_unused
14112 @opindex noall_load
14113 @opindex no_dead_strip_inits_and_terms
14114 @opindex nofixprebinding
14115 @opindex nomultidefs
14116 @opindex noprebind
14117 @opindex noseglinkedit
14118 @opindex pagezero_size
14119 @opindex prebind
14120 @opindex prebind_all_twolevel_modules
14121 @opindex private_bundle
14122 @opindex read_only_relocs
14123 @opindex sectalign
14124 @opindex sectobjectsymbols
14125 @opindex whyload
14126 @opindex seg1addr
14127 @opindex sectcreate
14128 @opindex sectobjectsymbols
14129 @opindex sectorder
14130 @opindex segaddr
14131 @opindex segs_read_only_addr
14132 @opindex segs_read_write_addr
14133 @opindex seg_addr_table
14134 @opindex seg_addr_table_filename
14135 @opindex seglinkedit
14136 @opindex segprot
14137 @opindex segs_read_only_addr
14138 @opindex segs_read_write_addr
14139 @opindex single_module
14140 @opindex static
14141 @opindex sub_library
14142 @opindex sub_umbrella
14143 @opindex twolevel_namespace
14144 @opindex umbrella
14145 @opindex undefined
14146 @opindex unexported_symbols_list
14147 @opindex weak_reference_mismatches
14148 @opindex whatsloaded
14149 These options are passed to the Darwin linker. The Darwin linker man page
14150 describes them in detail.
14151 @end table
14152
14153 @node DEC Alpha Options
14154 @subsection DEC Alpha Options
14155
14156 These @samp{-m} options are defined for the DEC Alpha implementations:
14157
14158 @table @gcctabopt
14159 @item -mno-soft-float
14160 @itemx -msoft-float
14161 @opindex mno-soft-float
14162 @opindex msoft-float
14163 Use (do not use) the hardware floating-point instructions for
14164 floating-point operations. When @option{-msoft-float} is specified,
14165 functions in @file{libgcc.a} are used to perform floating-point
14166 operations. Unless they are replaced by routines that emulate the
14167 floating-point operations, or compiled in such a way as to call such
14168 emulations routines, these routines issue floating-point
14169 operations. If you are compiling for an Alpha without floating-point
14170 operations, you must ensure that the library is built so as not to call
14171 them.
14172
14173 Note that Alpha implementations without floating-point operations are
14174 required to have floating-point registers.
14175
14176 @item -mfp-reg
14177 @itemx -mno-fp-regs
14178 @opindex mfp-reg
14179 @opindex mno-fp-regs
14180 Generate code that uses (does not use) the floating-point register set.
14181 @option{-mno-fp-regs} implies @option{-msoft-float}. If the floating-point
14182 register set is not used, floating-point operands are passed in integer
14183 registers as if they were integers and floating-point results are passed
14184 in @code{$0} instead of @code{$f0}. This is a non-standard calling sequence,
14185 so any function with a floating-point argument or return value called by code
14186 compiled with @option{-mno-fp-regs} must also be compiled with that
14187 option.
14188
14189 A typical use of this option is building a kernel that does not use,
14190 and hence need not save and restore, any floating-point registers.
14191
14192 @item -mieee
14193 @opindex mieee
14194 The Alpha architecture implements floating-point hardware optimized for
14195 maximum performance. It is mostly compliant with the IEEE floating-point
14196 standard. However, for full compliance, software assistance is
14197 required. This option generates code fully IEEE-compliant code
14198 @emph{except} that the @var{inexact-flag} is not maintained (see below).
14199 If this option is turned on, the preprocessor macro @code{_IEEE_FP} is
14200 defined during compilation. The resulting code is less efficient but is
14201 able to correctly support denormalized numbers and exceptional IEEE
14202 values such as not-a-number and plus/minus infinity. Other Alpha
14203 compilers call this option @option{-ieee_with_no_inexact}.
14204
14205 @item -mieee-with-inexact
14206 @opindex mieee-with-inexact
14207 This is like @option{-mieee} except the generated code also maintains
14208 the IEEE @var{inexact-flag}. Turning on this option causes the
14209 generated code to implement fully-compliant IEEE math. In addition to
14210 @code{_IEEE_FP}, @code{_IEEE_FP_EXACT} is defined as a preprocessor
14211 macro. On some Alpha implementations the resulting code may execute
14212 significantly slower than the code generated by default. Since there is
14213 very little code that depends on the @var{inexact-flag}, you should
14214 normally not specify this option. Other Alpha compilers call this
14215 option @option{-ieee_with_inexact}.
14216
14217 @item -mfp-trap-mode=@var{trap-mode}
14218 @opindex mfp-trap-mode
14219 This option controls what floating-point related traps are enabled.
14220 Other Alpha compilers call this option @option{-fptm @var{trap-mode}}.
14221 The trap mode can be set to one of four values:
14222
14223 @table @samp
14224 @item n
14225 This is the default (normal) setting. The only traps that are enabled
14226 are the ones that cannot be disabled in software (e.g., division by zero
14227 trap).
14228
14229 @item u
14230 In addition to the traps enabled by @samp{n}, underflow traps are enabled
14231 as well.
14232
14233 @item su
14234 Like @samp{u}, but the instructions are marked to be safe for software
14235 completion (see Alpha architecture manual for details).
14236
14237 @item sui
14238 Like @samp{su}, but inexact traps are enabled as well.
14239 @end table
14240
14241 @item -mfp-rounding-mode=@var{rounding-mode}
14242 @opindex mfp-rounding-mode
14243 Selects the IEEE rounding mode. Other Alpha compilers call this option
14244 @option{-fprm @var{rounding-mode}}. The @var{rounding-mode} can be one
14245 of:
14246
14247 @table @samp
14248 @item n
14249 Normal IEEE rounding mode. Floating-point numbers are rounded towards
14250 the nearest machine number or towards the even machine number in case
14251 of a tie.
14252
14253 @item m
14254 Round towards minus infinity.
14255
14256 @item c
14257 Chopped rounding mode. Floating-point numbers are rounded towards zero.
14258
14259 @item d
14260 Dynamic rounding mode. A field in the floating-point control register
14261 (@var{fpcr}, see Alpha architecture reference manual) controls the
14262 rounding mode in effect. The C library initializes this register for
14263 rounding towards plus infinity. Thus, unless your program modifies the
14264 @var{fpcr}, @samp{d} corresponds to round towards plus infinity.
14265 @end table
14266
14267 @item -mtrap-precision=@var{trap-precision}
14268 @opindex mtrap-precision
14269 In the Alpha architecture, floating-point traps are imprecise. This
14270 means without software assistance it is impossible to recover from a
14271 floating trap and program execution normally needs to be terminated.
14272 GCC can generate code that can assist operating system trap handlers
14273 in determining the exact location that caused a floating-point trap.
14274 Depending on the requirements of an application, different levels of
14275 precisions can be selected:
14276
14277 @table @samp
14278 @item p
14279 Program precision. This option is the default and means a trap handler
14280 can only identify which program caused a floating-point exception.
14281
14282 @item f
14283 Function precision. The trap handler can determine the function that
14284 caused a floating-point exception.
14285
14286 @item i
14287 Instruction precision. The trap handler can determine the exact
14288 instruction that caused a floating-point exception.
14289 @end table
14290
14291 Other Alpha compilers provide the equivalent options called
14292 @option{-scope_safe} and @option{-resumption_safe}.
14293
14294 @item -mieee-conformant
14295 @opindex mieee-conformant
14296 This option marks the generated code as IEEE conformant. You must not
14297 use this option unless you also specify @option{-mtrap-precision=i} and either
14298 @option{-mfp-trap-mode=su} or @option{-mfp-trap-mode=sui}. Its only effect
14299 is to emit the line @samp{.eflag 48} in the function prologue of the
14300 generated assembly file.
14301
14302 @item -mbuild-constants
14303 @opindex mbuild-constants
14304 Normally GCC examines a 32- or 64-bit integer constant to
14305 see if it can construct it from smaller constants in two or three
14306 instructions. If it cannot, it outputs the constant as a literal and
14307 generates code to load it from the data segment at run time.
14308
14309 Use this option to require GCC to construct @emph{all} integer constants
14310 using code, even if it takes more instructions (the maximum is six).
14311
14312 You typically use this option to build a shared library dynamic
14313 loader. Itself a shared library, it must relocate itself in memory
14314 before it can find the variables and constants in its own data segment.
14315
14316 @item -mbwx
14317 @itemx -mno-bwx
14318 @itemx -mcix
14319 @itemx -mno-cix
14320 @itemx -mfix
14321 @itemx -mno-fix
14322 @itemx -mmax
14323 @itemx -mno-max
14324 @opindex mbwx
14325 @opindex mno-bwx
14326 @opindex mcix
14327 @opindex mno-cix
14328 @opindex mfix
14329 @opindex mno-fix
14330 @opindex mmax
14331 @opindex mno-max
14332 Indicate whether GCC should generate code to use the optional BWX,
14333 CIX, FIX and MAX instruction sets. The default is to use the instruction
14334 sets supported by the CPU type specified via @option{-mcpu=} option or that
14335 of the CPU on which GCC was built if none is specified.
14336
14337 @item -mfloat-vax
14338 @itemx -mfloat-ieee
14339 @opindex mfloat-vax
14340 @opindex mfloat-ieee
14341 Generate code that uses (does not use) VAX F and G floating-point
14342 arithmetic instead of IEEE single and double precision.
14343
14344 @item -mexplicit-relocs
14345 @itemx -mno-explicit-relocs
14346 @opindex mexplicit-relocs
14347 @opindex mno-explicit-relocs
14348 Older Alpha assemblers provided no way to generate symbol relocations
14349 except via assembler macros. Use of these macros does not allow
14350 optimal instruction scheduling. GNU binutils as of version 2.12
14351 supports a new syntax that allows the compiler to explicitly mark
14352 which relocations should apply to which instructions. This option
14353 is mostly useful for debugging, as GCC detects the capabilities of
14354 the assembler when it is built and sets the default accordingly.
14355
14356 @item -msmall-data
14357 @itemx -mlarge-data
14358 @opindex msmall-data
14359 @opindex mlarge-data
14360 When @option{-mexplicit-relocs} is in effect, static data is
14361 accessed via @dfn{gp-relative} relocations. When @option{-msmall-data}
14362 is used, objects 8 bytes long or smaller are placed in a @dfn{small data area}
14363 (the @code{.sdata} and @code{.sbss} sections) and are accessed via
14364 16-bit relocations off of the @code{$gp} register. This limits the
14365 size of the small data area to 64KB, but allows the variables to be
14366 directly accessed via a single instruction.
14367
14368 The default is @option{-mlarge-data}. With this option the data area
14369 is limited to just below 2GB@. Programs that require more than 2GB of
14370 data must use @code{malloc} or @code{mmap} to allocate the data in the
14371 heap instead of in the program's data segment.
14372
14373 When generating code for shared libraries, @option{-fpic} implies
14374 @option{-msmall-data} and @option{-fPIC} implies @option{-mlarge-data}.
14375
14376 @item -msmall-text
14377 @itemx -mlarge-text
14378 @opindex msmall-text
14379 @opindex mlarge-text
14380 When @option{-msmall-text} is used, the compiler assumes that the
14381 code of the entire program (or shared library) fits in 4MB, and is
14382 thus reachable with a branch instruction. When @option{-msmall-data}
14383 is used, the compiler can assume that all local symbols share the
14384 same @code{$gp} value, and thus reduce the number of instructions
14385 required for a function call from 4 to 1.
14386
14387 The default is @option{-mlarge-text}.
14388
14389 @item -mcpu=@var{cpu_type}
14390 @opindex mcpu
14391 Set the instruction set and instruction scheduling parameters for
14392 machine type @var{cpu_type}. You can specify either the @samp{EV}
14393 style name or the corresponding chip number. GCC supports scheduling
14394 parameters for the EV4, EV5 and EV6 family of processors and
14395 chooses the default values for the instruction set from the processor
14396 you specify. If you do not specify a processor type, GCC defaults
14397 to the processor on which the compiler was built.
14398
14399 Supported values for @var{cpu_type} are
14400
14401 @table @samp
14402 @item ev4
14403 @itemx ev45
14404 @itemx 21064
14405 Schedules as an EV4 and has no instruction set extensions.
14406
14407 @item ev5
14408 @itemx 21164
14409 Schedules as an EV5 and has no instruction set extensions.
14410
14411 @item ev56
14412 @itemx 21164a
14413 Schedules as an EV5 and supports the BWX extension.
14414
14415 @item pca56
14416 @itemx 21164pc
14417 @itemx 21164PC
14418 Schedules as an EV5 and supports the BWX and MAX extensions.
14419
14420 @item ev6
14421 @itemx 21264
14422 Schedules as an EV6 and supports the BWX, FIX, and MAX extensions.
14423
14424 @item ev67
14425 @itemx 21264a
14426 Schedules as an EV6 and supports the BWX, CIX, FIX, and MAX extensions.
14427 @end table
14428
14429 Native toolchains also support the value @samp{native},
14430 which selects the best architecture option for the host processor.
14431 @option{-mcpu=native} has no effect if GCC does not recognize
14432 the processor.
14433
14434 @item -mtune=@var{cpu_type}
14435 @opindex mtune
14436 Set only the instruction scheduling parameters for machine type
14437 @var{cpu_type}. The instruction set is not changed.
14438
14439 Native toolchains also support the value @samp{native},
14440 which selects the best architecture option for the host processor.
14441 @option{-mtune=native} has no effect if GCC does not recognize
14442 the processor.
14443
14444 @item -mmemory-latency=@var{time}
14445 @opindex mmemory-latency
14446 Sets the latency the scheduler should assume for typical memory
14447 references as seen by the application. This number is highly
14448 dependent on the memory access patterns used by the application
14449 and the size of the external cache on the machine.
14450
14451 Valid options for @var{time} are
14452
14453 @table @samp
14454 @item @var{number}
14455 A decimal number representing clock cycles.
14456
14457 @item L1
14458 @itemx L2
14459 @itemx L3
14460 @itemx main
14461 The compiler contains estimates of the number of clock cycles for
14462 ``typical'' EV4 & EV5 hardware for the Level 1, 2 & 3 caches
14463 (also called Dcache, Scache, and Bcache), as well as to main memory.
14464 Note that L3 is only valid for EV5.
14465
14466 @end table
14467 @end table
14468
14469 @node FR30 Options
14470 @subsection FR30 Options
14471 @cindex FR30 Options
14472
14473 These options are defined specifically for the FR30 port.
14474
14475 @table @gcctabopt
14476
14477 @item -msmall-model
14478 @opindex msmall-model
14479 Use the small address space model. This can produce smaller code, but
14480 it does assume that all symbolic values and addresses fit into a
14481 20-bit range.
14482
14483 @item -mno-lsim
14484 @opindex mno-lsim
14485 Assume that runtime support has been provided and so there is no need
14486 to include the simulator library (@file{libsim.a}) on the linker
14487 command line.
14488
14489 @end table
14490
14491 @node FRV Options
14492 @subsection FRV Options
14493 @cindex FRV Options
14494
14495 @table @gcctabopt
14496 @item -mgpr-32
14497 @opindex mgpr-32
14498
14499 Only use the first 32 general-purpose registers.
14500
14501 @item -mgpr-64
14502 @opindex mgpr-64
14503
14504 Use all 64 general-purpose registers.
14505
14506 @item -mfpr-32
14507 @opindex mfpr-32
14508
14509 Use only the first 32 floating-point registers.
14510
14511 @item -mfpr-64
14512 @opindex mfpr-64
14513
14514 Use all 64 floating-point registers.
14515
14516 @item -mhard-float
14517 @opindex mhard-float
14518
14519 Use hardware instructions for floating-point operations.
14520
14521 @item -msoft-float
14522 @opindex msoft-float
14523
14524 Use library routines for floating-point operations.
14525
14526 @item -malloc-cc
14527 @opindex malloc-cc
14528
14529 Dynamically allocate condition code registers.
14530
14531 @item -mfixed-cc
14532 @opindex mfixed-cc
14533
14534 Do not try to dynamically allocate condition code registers, only
14535 use @code{icc0} and @code{fcc0}.
14536
14537 @item -mdword
14538 @opindex mdword
14539
14540 Change ABI to use double word insns.
14541
14542 @item -mno-dword
14543 @opindex mno-dword
14544
14545 Do not use double word instructions.
14546
14547 @item -mdouble
14548 @opindex mdouble
14549
14550 Use floating-point double instructions.
14551
14552 @item -mno-double
14553 @opindex mno-double
14554
14555 Do not use floating-point double instructions.
14556
14557 @item -mmedia
14558 @opindex mmedia
14559
14560 Use media instructions.
14561
14562 @item -mno-media
14563 @opindex mno-media
14564
14565 Do not use media instructions.
14566
14567 @item -mmuladd
14568 @opindex mmuladd
14569
14570 Use multiply and add/subtract instructions.
14571
14572 @item -mno-muladd
14573 @opindex mno-muladd
14574
14575 Do not use multiply and add/subtract instructions.
14576
14577 @item -mfdpic
14578 @opindex mfdpic
14579
14580 Select the FDPIC ABI, which uses function descriptors to represent
14581 pointers to functions. Without any PIC/PIE-related options, it
14582 implies @option{-fPIE}. With @option{-fpic} or @option{-fpie}, it
14583 assumes GOT entries and small data are within a 12-bit range from the
14584 GOT base address; with @option{-fPIC} or @option{-fPIE}, GOT offsets
14585 are computed with 32 bits.
14586 With a @samp{bfin-elf} target, this option implies @option{-msim}.
14587
14588 @item -minline-plt
14589 @opindex minline-plt
14590
14591 Enable inlining of PLT entries in function calls to functions that are
14592 not known to bind locally. It has no effect without @option{-mfdpic}.
14593 It's enabled by default if optimizing for speed and compiling for
14594 shared libraries (i.e., @option{-fPIC} or @option{-fpic}), or when an
14595 optimization option such as @option{-O3} or above is present in the
14596 command line.
14597
14598 @item -mTLS
14599 @opindex mTLS
14600
14601 Assume a large TLS segment when generating thread-local code.
14602
14603 @item -mtls
14604 @opindex mtls
14605
14606 Do not assume a large TLS segment when generating thread-local code.
14607
14608 @item -mgprel-ro
14609 @opindex mgprel-ro
14610
14611 Enable the use of @code{GPREL} relocations in the FDPIC ABI for data
14612 that is known to be in read-only sections. It's enabled by default,
14613 except for @option{-fpic} or @option{-fpie}: even though it may help
14614 make the global offset table smaller, it trades 1 instruction for 4.
14615 With @option{-fPIC} or @option{-fPIE}, it trades 3 instructions for 4,
14616 one of which may be shared by multiple symbols, and it avoids the need
14617 for a GOT entry for the referenced symbol, so it's more likely to be a
14618 win. If it is not, @option{-mno-gprel-ro} can be used to disable it.
14619
14620 @item -multilib-library-pic
14621 @opindex multilib-library-pic
14622
14623 Link with the (library, not FD) pic libraries. It's implied by
14624 @option{-mlibrary-pic}, as well as by @option{-fPIC} and
14625 @option{-fpic} without @option{-mfdpic}. You should never have to use
14626 it explicitly.
14627
14628 @item -mlinked-fp
14629 @opindex mlinked-fp
14630
14631 Follow the EABI requirement of always creating a frame pointer whenever
14632 a stack frame is allocated. This option is enabled by default and can
14633 be disabled with @option{-mno-linked-fp}.
14634
14635 @item -mlong-calls
14636 @opindex mlong-calls
14637
14638 Use indirect addressing to call functions outside the current
14639 compilation unit. This allows the functions to be placed anywhere
14640 within the 32-bit address space.
14641
14642 @item -malign-labels
14643 @opindex malign-labels
14644
14645 Try to align labels to an 8-byte boundary by inserting NOPs into the
14646 previous packet. This option only has an effect when VLIW packing
14647 is enabled. It doesn't create new packets; it merely adds NOPs to
14648 existing ones.
14649
14650 @item -mlibrary-pic
14651 @opindex mlibrary-pic
14652
14653 Generate position-independent EABI code.
14654
14655 @item -macc-4
14656 @opindex macc-4
14657
14658 Use only the first four media accumulator registers.
14659
14660 @item -macc-8
14661 @opindex macc-8
14662
14663 Use all eight media accumulator registers.
14664
14665 @item -mpack
14666 @opindex mpack
14667
14668 Pack VLIW instructions.
14669
14670 @item -mno-pack
14671 @opindex mno-pack
14672
14673 Do not pack VLIW instructions.
14674
14675 @item -mno-eflags
14676 @opindex mno-eflags
14677
14678 Do not mark ABI switches in e_flags.
14679
14680 @item -mcond-move
14681 @opindex mcond-move
14682
14683 Enable the use of conditional-move instructions (default).
14684
14685 This switch is mainly for debugging the compiler and will likely be removed
14686 in a future version.
14687
14688 @item -mno-cond-move
14689 @opindex mno-cond-move
14690
14691 Disable the use of conditional-move instructions.
14692
14693 This switch is mainly for debugging the compiler and will likely be removed
14694 in a future version.
14695
14696 @item -mscc
14697 @opindex mscc
14698
14699 Enable the use of conditional set instructions (default).
14700
14701 This switch is mainly for debugging the compiler and will likely be removed
14702 in a future version.
14703
14704 @item -mno-scc
14705 @opindex mno-scc
14706
14707 Disable the use of conditional set instructions.
14708
14709 This switch is mainly for debugging the compiler and will likely be removed
14710 in a future version.
14711
14712 @item -mcond-exec
14713 @opindex mcond-exec
14714
14715 Enable the use of conditional execution (default).
14716
14717 This switch is mainly for debugging the compiler and will likely be removed
14718 in a future version.
14719
14720 @item -mno-cond-exec
14721 @opindex mno-cond-exec
14722
14723 Disable the use of conditional execution.
14724
14725 This switch is mainly for debugging the compiler and will likely be removed
14726 in a future version.
14727
14728 @item -mvliw-branch
14729 @opindex mvliw-branch
14730
14731 Run a pass to pack branches into VLIW instructions (default).
14732
14733 This switch is mainly for debugging the compiler and will likely be removed
14734 in a future version.
14735
14736 @item -mno-vliw-branch
14737 @opindex mno-vliw-branch
14738
14739 Do not run a pass to pack branches into VLIW instructions.
14740
14741 This switch is mainly for debugging the compiler and will likely be removed
14742 in a future version.
14743
14744 @item -mmulti-cond-exec
14745 @opindex mmulti-cond-exec
14746
14747 Enable optimization of @code{&&} and @code{||} in conditional execution
14748 (default).
14749
14750 This switch is mainly for debugging the compiler and will likely be removed
14751 in a future version.
14752
14753 @item -mno-multi-cond-exec
14754 @opindex mno-multi-cond-exec
14755
14756 Disable optimization of @code{&&} and @code{||} in conditional execution.
14757
14758 This switch is mainly for debugging the compiler and will likely be removed
14759 in a future version.
14760
14761 @item -mnested-cond-exec
14762 @opindex mnested-cond-exec
14763
14764 Enable nested conditional execution optimizations (default).
14765
14766 This switch is mainly for debugging the compiler and will likely be removed
14767 in a future version.
14768
14769 @item -mno-nested-cond-exec
14770 @opindex mno-nested-cond-exec
14771
14772 Disable nested conditional execution optimizations.
14773
14774 This switch is mainly for debugging the compiler and will likely be removed
14775 in a future version.
14776
14777 @item -moptimize-membar
14778 @opindex moptimize-membar
14779
14780 This switch removes redundant @code{membar} instructions from the
14781 compiler-generated code. It is enabled by default.
14782
14783 @item -mno-optimize-membar
14784 @opindex mno-optimize-membar
14785
14786 This switch disables the automatic removal of redundant @code{membar}
14787 instructions from the generated code.
14788
14789 @item -mtomcat-stats
14790 @opindex mtomcat-stats
14791
14792 Cause gas to print out tomcat statistics.
14793
14794 @item -mcpu=@var{cpu}
14795 @opindex mcpu
14796
14797 Select the processor type for which to generate code. Possible values are
14798 @samp{frv}, @samp{fr550}, @samp{tomcat}, @samp{fr500}, @samp{fr450},
14799 @samp{fr405}, @samp{fr400}, @samp{fr300} and @samp{simple}.
14800
14801 @end table
14802
14803 @node GNU/Linux Options
14804 @subsection GNU/Linux Options
14805
14806 These @samp{-m} options are defined for GNU/Linux targets:
14807
14808 @table @gcctabopt
14809 @item -mglibc
14810 @opindex mglibc
14811 Use the GNU C library. This is the default except
14812 on @samp{*-*-linux-*uclibc*} and @samp{*-*-linux-*android*} targets.
14813
14814 @item -muclibc
14815 @opindex muclibc
14816 Use uClibc C library. This is the default on
14817 @samp{*-*-linux-*uclibc*} targets.
14818
14819 @item -mbionic
14820 @opindex mbionic
14821 Use Bionic C library. This is the default on
14822 @samp{*-*-linux-*android*} targets.
14823
14824 @item -mandroid
14825 @opindex mandroid
14826 Compile code compatible with Android platform. This is the default on
14827 @samp{*-*-linux-*android*} targets.
14828
14829 When compiling, this option enables @option{-mbionic}, @option{-fPIC},
14830 @option{-fno-exceptions} and @option{-fno-rtti} by default. When linking,
14831 this option makes the GCC driver pass Android-specific options to the linker.
14832 Finally, this option causes the preprocessor macro @code{__ANDROID__}
14833 to be defined.
14834
14835 @item -tno-android-cc
14836 @opindex tno-android-cc
14837 Disable compilation effects of @option{-mandroid}, i.e., do not enable
14838 @option{-mbionic}, @option{-fPIC}, @option{-fno-exceptions} and
14839 @option{-fno-rtti} by default.
14840
14841 @item -tno-android-ld
14842 @opindex tno-android-ld
14843 Disable linking effects of @option{-mandroid}, i.e., pass standard Linux
14844 linking options to the linker.
14845
14846 @end table
14847
14848 @node H8/300 Options
14849 @subsection H8/300 Options
14850
14851 These @samp{-m} options are defined for the H8/300 implementations:
14852
14853 @table @gcctabopt
14854 @item -mrelax
14855 @opindex mrelax
14856 Shorten some address references at link time, when possible; uses the
14857 linker option @option{-relax}. @xref{H8/300,, @code{ld} and the H8/300,
14858 ld, Using ld}, for a fuller description.
14859
14860 @item -mh
14861 @opindex mh
14862 Generate code for the H8/300H@.
14863
14864 @item -ms
14865 @opindex ms
14866 Generate code for the H8S@.
14867
14868 @item -mn
14869 @opindex mn
14870 Generate code for the H8S and H8/300H in the normal mode. This switch
14871 must be used either with @option{-mh} or @option{-ms}.
14872
14873 @item -ms2600
14874 @opindex ms2600
14875 Generate code for the H8S/2600. This switch must be used with @option{-ms}.
14876
14877 @item -mexr
14878 @opindex mexr
14879 Extended registers are stored on stack before execution of function
14880 with monitor attribute. Default option is @option{-mexr}.
14881 This option is valid only for H8S targets.
14882
14883 @item -mno-exr
14884 @opindex mno-exr
14885 Extended registers are not stored on stack before execution of function
14886 with monitor attribute. Default option is @option{-mno-exr}.
14887 This option is valid only for H8S targets.
14888
14889 @item -mint32
14890 @opindex mint32
14891 Make @code{int} data 32 bits by default.
14892
14893 @item -malign-300
14894 @opindex malign-300
14895 On the H8/300H and H8S, use the same alignment rules as for the H8/300.
14896 The default for the H8/300H and H8S is to align longs and floats on
14897 4-byte boundaries.
14898 @option{-malign-300} causes them to be aligned on 2-byte boundaries.
14899 This option has no effect on the H8/300.
14900 @end table
14901
14902 @node HPPA Options
14903 @subsection HPPA Options
14904 @cindex HPPA Options
14905
14906 These @samp{-m} options are defined for the HPPA family of computers:
14907
14908 @table @gcctabopt
14909 @item -march=@var{architecture-type}
14910 @opindex march
14911 Generate code for the specified architecture. The choices for
14912 @var{architecture-type} are @samp{1.0} for PA 1.0, @samp{1.1} for PA
14913 1.1, and @samp{2.0} for PA 2.0 processors. Refer to
14914 @file{/usr/lib/sched.models} on an HP-UX system to determine the proper
14915 architecture option for your machine. Code compiled for lower numbered
14916 architectures runs on higher numbered architectures, but not the
14917 other way around.
14918
14919 @item -mpa-risc-1-0
14920 @itemx -mpa-risc-1-1
14921 @itemx -mpa-risc-2-0
14922 @opindex mpa-risc-1-0
14923 @opindex mpa-risc-1-1
14924 @opindex mpa-risc-2-0
14925 Synonyms for @option{-march=1.0}, @option{-march=1.1}, and @option{-march=2.0} respectively.
14926
14927 @item -mjump-in-delay
14928 @opindex mjump-in-delay
14929 This option is ignored and provided for compatibility purposes only.
14930
14931 @item -mdisable-fpregs
14932 @opindex mdisable-fpregs
14933 Prevent floating-point registers from being used in any manner. This is
14934 necessary for compiling kernels that perform lazy context switching of
14935 floating-point registers. If you use this option and attempt to perform
14936 floating-point operations, the compiler aborts.
14937
14938 @item -mdisable-indexing
14939 @opindex mdisable-indexing
14940 Prevent the compiler from using indexing address modes. This avoids some
14941 rather obscure problems when compiling MIG generated code under MACH@.
14942
14943 @item -mno-space-regs
14944 @opindex mno-space-regs
14945 Generate code that assumes the target has no space registers. This allows
14946 GCC to generate faster indirect calls and use unscaled index address modes.
14947
14948 Such code is suitable for level 0 PA systems and kernels.
14949
14950 @item -mfast-indirect-calls
14951 @opindex mfast-indirect-calls
14952 Generate code that assumes calls never cross space boundaries. This
14953 allows GCC to emit code that performs faster indirect calls.
14954
14955 This option does not work in the presence of shared libraries or nested
14956 functions.
14957
14958 @item -mfixed-range=@var{register-range}
14959 @opindex mfixed-range
14960 Generate code treating the given register range as fixed registers.
14961 A fixed register is one that the register allocator cannot use. This is
14962 useful when compiling kernel code. A register range is specified as
14963 two registers separated by a dash. Multiple register ranges can be
14964 specified separated by a comma.
14965
14966 @item -mlong-load-store
14967 @opindex mlong-load-store
14968 Generate 3-instruction load and store sequences as sometimes required by
14969 the HP-UX 10 linker. This is equivalent to the @samp{+k} option to
14970 the HP compilers.
14971
14972 @item -mportable-runtime
14973 @opindex mportable-runtime
14974 Use the portable calling conventions proposed by HP for ELF systems.
14975
14976 @item -mgas
14977 @opindex mgas
14978 Enable the use of assembler directives only GAS understands.
14979
14980 @item -mschedule=@var{cpu-type}
14981 @opindex mschedule
14982 Schedule code according to the constraints for the machine type
14983 @var{cpu-type}. The choices for @var{cpu-type} are @samp{700}
14984 @samp{7100}, @samp{7100LC}, @samp{7200}, @samp{7300} and @samp{8000}. Refer
14985 to @file{/usr/lib/sched.models} on an HP-UX system to determine the
14986 proper scheduling option for your machine. The default scheduling is
14987 @samp{8000}.
14988
14989 @item -mlinker-opt
14990 @opindex mlinker-opt
14991 Enable the optimization pass in the HP-UX linker. Note this makes symbolic
14992 debugging impossible. It also triggers a bug in the HP-UX 8 and HP-UX 9
14993 linkers in which they give bogus error messages when linking some programs.
14994
14995 @item -msoft-float
14996 @opindex msoft-float
14997 Generate output containing library calls for floating point.
14998 @strong{Warning:} the requisite libraries are not available for all HPPA
14999 targets. Normally the facilities of the machine's usual C compiler are
15000 used, but this cannot be done directly in cross-compilation. You must make
15001 your own arrangements to provide suitable library functions for
15002 cross-compilation.
15003
15004 @option{-msoft-float} changes the calling convention in the output file;
15005 therefore, it is only useful if you compile @emph{all} of a program with
15006 this option. In particular, you need to compile @file{libgcc.a}, the
15007 library that comes with GCC, with @option{-msoft-float} in order for
15008 this to work.
15009
15010 @item -msio
15011 @opindex msio
15012 Generate the predefine, @code{_SIO}, for server IO@. The default is
15013 @option{-mwsio}. This generates the predefines, @code{__hp9000s700},
15014 @code{__hp9000s700__} and @code{_WSIO}, for workstation IO@. These
15015 options are available under HP-UX and HI-UX@.
15016
15017 @item -mgnu-ld
15018 @opindex mgnu-ld
15019 Use options specific to GNU @command{ld}.
15020 This passes @option{-shared} to @command{ld} when
15021 building a shared library. It is the default when GCC is configured,
15022 explicitly or implicitly, with the GNU linker. This option does not
15023 affect which @command{ld} is called; it only changes what parameters
15024 are passed to that @command{ld}.
15025 The @command{ld} that is called is determined by the
15026 @option{--with-ld} configure option, GCC's program search path, and
15027 finally by the user's @env{PATH}. The linker used by GCC can be printed
15028 using @samp{which `gcc -print-prog-name=ld`}. This option is only available
15029 on the 64-bit HP-UX GCC, i.e.@: configured with @samp{hppa*64*-*-hpux*}.
15030
15031 @item -mhp-ld
15032 @opindex mhp-ld
15033 Use options specific to HP @command{ld}.
15034 This passes @option{-b} to @command{ld} when building
15035 a shared library and passes @option{+Accept TypeMismatch} to @command{ld} on all
15036 links. It is the default when GCC is configured, explicitly or
15037 implicitly, with the HP linker. This option does not affect
15038 which @command{ld} is called; it only changes what parameters are passed to that
15039 @command{ld}.
15040 The @command{ld} that is called is determined by the @option{--with-ld}
15041 configure option, GCC's program search path, and finally by the user's
15042 @env{PATH}. The linker used by GCC can be printed using @samp{which
15043 `gcc -print-prog-name=ld`}. This option is only available on the 64-bit
15044 HP-UX GCC, i.e.@: configured with @samp{hppa*64*-*-hpux*}.
15045
15046 @item -mlong-calls
15047 @opindex mno-long-calls
15048 Generate code that uses long call sequences. This ensures that a call
15049 is always able to reach linker generated stubs. The default is to generate
15050 long calls only when the distance from the call site to the beginning
15051 of the function or translation unit, as the case may be, exceeds a
15052 predefined limit set by the branch type being used. The limits for
15053 normal calls are 7,600,000 and 240,000 bytes, respectively for the
15054 PA 2.0 and PA 1.X architectures. Sibcalls are always limited at
15055 240,000 bytes.
15056
15057 Distances are measured from the beginning of functions when using the
15058 @option{-ffunction-sections} option, or when using the @option{-mgas}
15059 and @option{-mno-portable-runtime} options together under HP-UX with
15060 the SOM linker.
15061
15062 It is normally not desirable to use this option as it degrades
15063 performance. However, it may be useful in large applications,
15064 particularly when partial linking is used to build the application.
15065
15066 The types of long calls used depends on the capabilities of the
15067 assembler and linker, and the type of code being generated. The
15068 impact on systems that support long absolute calls, and long pic
15069 symbol-difference or pc-relative calls should be relatively small.
15070 However, an indirect call is used on 32-bit ELF systems in pic code
15071 and it is quite long.
15072
15073 @item -munix=@var{unix-std}
15074 @opindex march
15075 Generate compiler predefines and select a startfile for the specified
15076 UNIX standard. The choices for @var{unix-std} are @samp{93}, @samp{95}
15077 and @samp{98}. @samp{93} is supported on all HP-UX versions. @samp{95}
15078 is available on HP-UX 10.10 and later. @samp{98} is available on HP-UX
15079 11.11 and later. The default values are @samp{93} for HP-UX 10.00,
15080 @samp{95} for HP-UX 10.10 though to 11.00, and @samp{98} for HP-UX 11.11
15081 and later.
15082
15083 @option{-munix=93} provides the same predefines as GCC 3.3 and 3.4.
15084 @option{-munix=95} provides additional predefines for @code{XOPEN_UNIX}
15085 and @code{_XOPEN_SOURCE_EXTENDED}, and the startfile @file{unix95.o}.
15086 @option{-munix=98} provides additional predefines for @code{_XOPEN_UNIX},
15087 @code{_XOPEN_SOURCE_EXTENDED}, @code{_INCLUDE__STDC_A1_SOURCE} and
15088 @code{_INCLUDE_XOPEN_SOURCE_500}, and the startfile @file{unix98.o}.
15089
15090 It is @emph{important} to note that this option changes the interfaces
15091 for various library routines. It also affects the operational behavior
15092 of the C library. Thus, @emph{extreme} care is needed in using this
15093 option.
15094
15095 Library code that is intended to operate with more than one UNIX
15096 standard must test, set and restore the variable @var{__xpg4_extended_mask}
15097 as appropriate. Most GNU software doesn't provide this capability.
15098
15099 @item -nolibdld
15100 @opindex nolibdld
15101 Suppress the generation of link options to search libdld.sl when the
15102 @option{-static} option is specified on HP-UX 10 and later.
15103
15104 @item -static
15105 @opindex static
15106 The HP-UX implementation of setlocale in libc has a dependency on
15107 libdld.sl. There isn't an archive version of libdld.sl. Thus,
15108 when the @option{-static} option is specified, special link options
15109 are needed to resolve this dependency.
15110
15111 On HP-UX 10 and later, the GCC driver adds the necessary options to
15112 link with libdld.sl when the @option{-static} option is specified.
15113 This causes the resulting binary to be dynamic. On the 64-bit port,
15114 the linkers generate dynamic binaries by default in any case. The
15115 @option{-nolibdld} option can be used to prevent the GCC driver from
15116 adding these link options.
15117
15118 @item -threads
15119 @opindex threads
15120 Add support for multithreading with the @dfn{dce thread} library
15121 under HP-UX@. This option sets flags for both the preprocessor and
15122 linker.
15123 @end table
15124
15125 @node i386 and x86-64 Options
15126 @subsection Intel 386 and AMD x86-64 Options
15127 @cindex i386 Options
15128 @cindex x86-64 Options
15129 @cindex Intel 386 Options
15130 @cindex AMD x86-64 Options
15131
15132 These @samp{-m} options are defined for the i386 and x86-64 family of
15133 computers:
15134
15135 @table @gcctabopt
15136
15137 @item -march=@var{cpu-type}
15138 @opindex march
15139 Generate instructions for the machine type @var{cpu-type}. In contrast to
15140 @option{-mtune=@var{cpu-type}}, which merely tunes the generated code
15141 for the specified @var{cpu-type}, @option{-march=@var{cpu-type}} allows GCC
15142 to generate code that may not run at all on processors other than the one
15143 indicated. Specifying @option{-march=@var{cpu-type}} implies
15144 @option{-mtune=@var{cpu-type}}.
15145
15146 The choices for @var{cpu-type} are:
15147
15148 @table @samp
15149 @item native
15150 This selects the CPU to generate code for at compilation time by determining
15151 the processor type of the compiling machine. Using @option{-march=native}
15152 enables all instruction subsets supported by the local machine (hence
15153 the result might not run on different machines). Using @option{-mtune=native}
15154 produces code optimized for the local machine under the constraints
15155 of the selected instruction set.
15156
15157 @item i386
15158 Original Intel i386 CPU@.
15159
15160 @item i486
15161 Intel i486 CPU@. (No scheduling is implemented for this chip.)
15162
15163 @item i586
15164 @itemx pentium
15165 Intel Pentium CPU with no MMX support.
15166
15167 @item pentium-mmx
15168 Intel Pentium MMX CPU, based on Pentium core with MMX instruction set support.
15169
15170 @item pentiumpro
15171 Intel Pentium Pro CPU@.
15172
15173 @item i686
15174 When used with @option{-march}, the Pentium Pro
15175 instruction set is used, so the code runs on all i686 family chips.
15176 When used with @option{-mtune}, it has the same meaning as @samp{generic}.
15177
15178 @item pentium2
15179 Intel Pentium II CPU, based on Pentium Pro core with MMX instruction set
15180 support.
15181
15182 @item pentium3
15183 @itemx pentium3m
15184 Intel Pentium III CPU, based on Pentium Pro core with MMX and SSE instruction
15185 set support.
15186
15187 @item pentium-m
15188 Intel Pentium M; low-power version of Intel Pentium III CPU
15189 with MMX, SSE and SSE2 instruction set support. Used by Centrino notebooks.
15190
15191 @item pentium4
15192 @itemx pentium4m
15193 Intel Pentium 4 CPU with MMX, SSE and SSE2 instruction set support.
15194
15195 @item prescott
15196 Improved version of Intel Pentium 4 CPU with MMX, SSE, SSE2 and SSE3 instruction
15197 set support.
15198
15199 @item nocona
15200 Improved version of Intel Pentium 4 CPU with 64-bit extensions, MMX, SSE,
15201 SSE2 and SSE3 instruction set support.
15202
15203 @item core2
15204 Intel Core 2 CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3 and SSSE3
15205 instruction set support.
15206
15207 @item nehalem
15208 Intel Nehalem CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
15209 SSE4.1, SSE4.2 and POPCNT instruction set support.
15210
15211 @item westmere
15212 Intel Westmere CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
15213 SSE4.1, SSE4.2, POPCNT, AES and PCLMUL instruction set support.
15214
15215 @item sandybridge
15216 Intel Sandy Bridge CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
15217 SSE4.1, SSE4.2, POPCNT, AVX, AES and PCLMUL instruction set support.
15218
15219 @item ivybridge
15220 Intel Ivy Bridge CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
15221 SSE4.1, SSE4.2, POPCNT, AVX, AES, PCLMUL, FSGSBASE, RDRND and F16C
15222 instruction set support.
15223
15224 @item haswell
15225 Intel Haswell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
15226 SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
15227 BMI, BMI2 and F16C instruction set support.
15228
15229 @item broadwell
15230 Intel Broadwell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
15231 SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
15232 BMI, BMI2, F16C, RDSEED, ADCX and PREFETCHW instruction set support.
15233
15234 @item bonnell
15235 Intel Bonnell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3 and SSSE3
15236 instruction set support.
15237
15238 @item silvermont
15239 Intel Silvermont CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
15240 SSE4.1, SSE4.2, POPCNT, AES, PCLMUL and RDRND instruction set support.
15241
15242 @item k6
15243 AMD K6 CPU with MMX instruction set support.
15244
15245 @item k6-2
15246 @itemx k6-3
15247 Improved versions of AMD K6 CPU with MMX and 3DNow!@: instruction set support.
15248
15249 @item athlon
15250 @itemx athlon-tbird
15251 AMD Athlon CPU with MMX, 3dNOW!, enhanced 3DNow!@: and SSE prefetch instructions
15252 support.
15253
15254 @item athlon-4
15255 @itemx athlon-xp
15256 @itemx athlon-mp
15257 Improved AMD Athlon CPU with MMX, 3DNow!, enhanced 3DNow!@: and full SSE
15258 instruction set support.
15259
15260 @item k8
15261 @itemx opteron
15262 @itemx athlon64
15263 @itemx athlon-fx
15264 Processors based on the AMD K8 core with x86-64 instruction set support,
15265 including the AMD Opteron, Athlon 64, and Athlon 64 FX processors.
15266 (This supersets MMX, SSE, SSE2, 3DNow!, enhanced 3DNow!@: and 64-bit
15267 instruction set extensions.)
15268
15269 @item k8-sse3
15270 @itemx opteron-sse3
15271 @itemx athlon64-sse3
15272 Improved versions of AMD K8 cores with SSE3 instruction set support.
15273
15274 @item amdfam10
15275 @itemx barcelona
15276 CPUs based on AMD Family 10h cores with x86-64 instruction set support. (This
15277 supersets MMX, SSE, SSE2, SSE3, SSE4A, 3DNow!, enhanced 3DNow!, ABM and 64-bit
15278 instruction set extensions.)
15279
15280 @item bdver1
15281 CPUs based on AMD Family 15h cores with x86-64 instruction set support. (This
15282 supersets FMA4, AVX, XOP, LWP, AES, PCL_MUL, CX16, MMX, SSE, SSE2, SSE3, SSE4A,
15283 SSSE3, SSE4.1, SSE4.2, ABM and 64-bit instruction set extensions.)
15284 @item bdver2
15285 AMD Family 15h core based CPUs with x86-64 instruction set support. (This
15286 supersets BMI, TBM, F16C, FMA, FMA4, AVX, XOP, LWP, AES, PCL_MUL, CX16, MMX,
15287 SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM and 64-bit instruction set
15288 extensions.)
15289 @item bdver3
15290 AMD Family 15h core based CPUs with x86-64 instruction set support. (This
15291 supersets BMI, TBM, F16C, FMA, FMA4, FSGSBASE, AVX, XOP, LWP, AES,
15292 PCL_MUL, CX16, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM and
15293 64-bit instruction set extensions.
15294 @item bdver4
15295 AMD Family 15h core based CPUs with x86-64 instruction set support. (This
15296 supersets BMI, BMI2, TBM, F16C, FMA, FMA4, FSGSBASE, AVX, AVX2, XOP, LWP,
15297 AES, PCL_MUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1,
15298 SSE4.2, ABM and 64-bit instruction set extensions.
15299
15300 @item btver1
15301 CPUs based on AMD Family 14h cores with x86-64 instruction set support. (This
15302 supersets MMX, SSE, SSE2, SSE3, SSSE3, SSE4A, CX16, ABM and 64-bit
15303 instruction set extensions.)
15304
15305 @item btver2
15306 CPUs based on AMD Family 16h cores with x86-64 instruction set support. This
15307 includes MOVBE, F16C, BMI, AVX, PCL_MUL, AES, SSE4.2, SSE4.1, CX16, ABM,
15308 SSE4A, SSSE3, SSE3, SSE2, SSE, MMX and 64-bit instruction set extensions.
15309
15310 @item winchip-c6
15311 IDT WinChip C6 CPU, dealt in same way as i486 with additional MMX instruction
15312 set support.
15313
15314 @item winchip2
15315 IDT WinChip 2 CPU, dealt in same way as i486 with additional MMX and 3DNow!@:
15316 instruction set support.
15317
15318 @item c3
15319 VIA C3 CPU with MMX and 3DNow!@: instruction set support. (No scheduling is
15320 implemented for this chip.)
15321
15322 @item c3-2
15323 VIA C3-2 (Nehemiah/C5XL) CPU with MMX and SSE instruction set support.
15324 (No scheduling is
15325 implemented for this chip.)
15326
15327 @item geode
15328 AMD Geode embedded processor with MMX and 3DNow!@: instruction set support.
15329 @end table
15330
15331 @item -mtune=@var{cpu-type}
15332 @opindex mtune
15333 Tune to @var{cpu-type} everything applicable about the generated code, except
15334 for the ABI and the set of available instructions.
15335 While picking a specific @var{cpu-type} schedules things appropriately
15336 for that particular chip, the compiler does not generate any code that
15337 cannot run on the default machine type unless you use a
15338 @option{-march=@var{cpu-type}} option.
15339 For example, if GCC is configured for i686-pc-linux-gnu
15340 then @option{-mtune=pentium4} generates code that is tuned for Pentium 4
15341 but still runs on i686 machines.
15342
15343 The choices for @var{cpu-type} are the same as for @option{-march}.
15344 In addition, @option{-mtune} supports 2 extra choices for @var{cpu-type}:
15345
15346 @table @samp
15347 @item generic
15348 Produce code optimized for the most common IA32/@/AMD64/@/EM64T processors.
15349 If you know the CPU on which your code will run, then you should use
15350 the corresponding @option{-mtune} or @option{-march} option instead of
15351 @option{-mtune=generic}. But, if you do not know exactly what CPU users
15352 of your application will have, then you should use this option.
15353
15354 As new processors are deployed in the marketplace, the behavior of this
15355 option will change. Therefore, if you upgrade to a newer version of
15356 GCC, code generation controlled by this option will change to reflect
15357 the processors
15358 that are most common at the time that version of GCC is released.
15359
15360 There is no @option{-march=generic} option because @option{-march}
15361 indicates the instruction set the compiler can use, and there is no
15362 generic instruction set applicable to all processors. In contrast,
15363 @option{-mtune} indicates the processor (or, in this case, collection of
15364 processors) for which the code is optimized.
15365
15366 @item intel
15367 Produce code optimized for the most current Intel processors, which are
15368 Haswell and Silvermont for this version of GCC. If you know the CPU
15369 on which your code will run, then you should use the corresponding
15370 @option{-mtune} or @option{-march} option instead of @option{-mtune=intel}.
15371 But, if you want your application performs better on both Haswell and
15372 Silvermont, then you should use this option.
15373
15374 As new Intel processors are deployed in the marketplace, the behavior of
15375 this option will change. Therefore, if you upgrade to a newer version of
15376 GCC, code generation controlled by this option will change to reflect
15377 the most current Intel processors at the time that version of GCC is
15378 released.
15379
15380 There is no @option{-march=intel} option because @option{-march} indicates
15381 the instruction set the compiler can use, and there is no common
15382 instruction set applicable to all processors. In contrast,
15383 @option{-mtune} indicates the processor (or, in this case, collection of
15384 processors) for which the code is optimized.
15385 @end table
15386
15387 @item -mcpu=@var{cpu-type}
15388 @opindex mcpu
15389 A deprecated synonym for @option{-mtune}.
15390
15391 @item -mfpmath=@var{unit}
15392 @opindex mfpmath
15393 Generate floating-point arithmetic for selected unit @var{unit}. The choices
15394 for @var{unit} are:
15395
15396 @table @samp
15397 @item 387
15398 Use the standard 387 floating-point coprocessor present on the majority of chips and
15399 emulated otherwise. Code compiled with this option runs almost everywhere.
15400 The temporary results are computed in 80-bit precision instead of the precision
15401 specified by the type, resulting in slightly different results compared to most
15402 of other chips. See @option{-ffloat-store} for more detailed description.
15403
15404 This is the default choice for i386 compiler.
15405
15406 @item sse
15407 Use scalar floating-point instructions present in the SSE instruction set.
15408 This instruction set is supported by Pentium III and newer chips,
15409 and in the AMD line
15410 by Athlon-4, Athlon XP and Athlon MP chips. The earlier version of the SSE
15411 instruction set supports only single-precision arithmetic, thus the double and
15412 extended-precision arithmetic are still done using 387. A later version, present
15413 only in Pentium 4 and AMD x86-64 chips, supports double-precision
15414 arithmetic too.
15415
15416 For the i386 compiler, you must use @option{-march=@var{cpu-type}}, @option{-msse}
15417 or @option{-msse2} switches to enable SSE extensions and make this option
15418 effective. For the x86-64 compiler, these extensions are enabled by default.
15419
15420 The resulting code should be considerably faster in the majority of cases and avoid
15421 the numerical instability problems of 387 code, but may break some existing
15422 code that expects temporaries to be 80 bits.
15423
15424 This is the default choice for the x86-64 compiler.
15425
15426 @item sse,387
15427 @itemx sse+387
15428 @itemx both
15429 Attempt to utilize both instruction sets at once. This effectively doubles the
15430 amount of available registers, and on chips with separate execution units for
15431 387 and SSE the execution resources too. Use this option with care, as it is
15432 still experimental, because the GCC register allocator does not model separate
15433 functional units well, resulting in unstable performance.
15434 @end table
15435
15436 @item -masm=@var{dialect}
15437 @opindex masm=@var{dialect}
15438 Output assembly instructions using selected @var{dialect}. Supported
15439 choices are @samp{intel} or @samp{att} (the default). Darwin does
15440 not support @samp{intel}.
15441
15442 @item -mieee-fp
15443 @itemx -mno-ieee-fp
15444 @opindex mieee-fp
15445 @opindex mno-ieee-fp
15446 Control whether or not the compiler uses IEEE floating-point
15447 comparisons. These correctly handle the case where the result of a
15448 comparison is unordered.
15449
15450 @item -msoft-float
15451 @opindex msoft-float
15452 Generate output containing library calls for floating point.
15453
15454 @strong{Warning:} the requisite libraries are not part of GCC@.
15455 Normally the facilities of the machine's usual C compiler are used, but
15456 this can't be done directly in cross-compilation. You must make your
15457 own arrangements to provide suitable library functions for
15458 cross-compilation.
15459
15460 On machines where a function returns floating-point results in the 80387
15461 register stack, some floating-point opcodes may be emitted even if
15462 @option{-msoft-float} is used.
15463
15464 @item -mno-fp-ret-in-387
15465 @opindex mno-fp-ret-in-387
15466 Do not use the FPU registers for return values of functions.
15467
15468 The usual calling convention has functions return values of types
15469 @code{float} and @code{double} in an FPU register, even if there
15470 is no FPU@. The idea is that the operating system should emulate
15471 an FPU@.
15472
15473 The option @option{-mno-fp-ret-in-387} causes such values to be returned
15474 in ordinary CPU registers instead.
15475
15476 @item -mno-fancy-math-387
15477 @opindex mno-fancy-math-387
15478 Some 387 emulators do not support the @code{sin}, @code{cos} and
15479 @code{sqrt} instructions for the 387. Specify this option to avoid
15480 generating those instructions. This option is the default on FreeBSD,
15481 OpenBSD and NetBSD@. This option is overridden when @option{-march}
15482 indicates that the target CPU always has an FPU and so the
15483 instruction does not need emulation. These
15484 instructions are not generated unless you also use the
15485 @option{-funsafe-math-optimizations} switch.
15486
15487 @item -malign-double
15488 @itemx -mno-align-double
15489 @opindex malign-double
15490 @opindex mno-align-double
15491 Control whether GCC aligns @code{double}, @code{long double}, and
15492 @code{long long} variables on a two-word boundary or a one-word
15493 boundary. Aligning @code{double} variables on a two-word boundary
15494 produces code that runs somewhat faster on a Pentium at the
15495 expense of more memory.
15496
15497 On x86-64, @option{-malign-double} is enabled by default.
15498
15499 @strong{Warning:} if you use the @option{-malign-double} switch,
15500 structures containing the above types are aligned differently than
15501 the published application binary interface specifications for the 386
15502 and are not binary compatible with structures in code compiled
15503 without that switch.
15504
15505 @item -m96bit-long-double
15506 @itemx -m128bit-long-double
15507 @opindex m96bit-long-double
15508 @opindex m128bit-long-double
15509 These switches control the size of @code{long double} type. The i386
15510 application binary interface specifies the size to be 96 bits,
15511 so @option{-m96bit-long-double} is the default in 32-bit mode.
15512
15513 Modern architectures (Pentium and newer) prefer @code{long double}
15514 to be aligned to an 8- or 16-byte boundary. In arrays or structures
15515 conforming to the ABI, this is not possible. So specifying
15516 @option{-m128bit-long-double} aligns @code{long double}
15517 to a 16-byte boundary by padding the @code{long double} with an additional
15518 32-bit zero.
15519
15520 In the x86-64 compiler, @option{-m128bit-long-double} is the default choice as
15521 its ABI specifies that @code{long double} is aligned on 16-byte boundary.
15522
15523 Notice that neither of these options enable any extra precision over the x87
15524 standard of 80 bits for a @code{long double}.
15525
15526 @strong{Warning:} if you override the default value for your target ABI, this
15527 changes the size of
15528 structures and arrays containing @code{long double} variables,
15529 as well as modifying the function calling convention for functions taking
15530 @code{long double}. Hence they are not binary-compatible
15531 with code compiled without that switch.
15532
15533 @item -mlong-double-64
15534 @itemx -mlong-double-80
15535 @itemx -mlong-double-128
15536 @opindex mlong-double-64
15537 @opindex mlong-double-80
15538 @opindex mlong-double-128
15539 These switches control the size of @code{long double} type. A size
15540 of 64 bits makes the @code{long double} type equivalent to the @code{double}
15541 type. This is the default for 32-bit Bionic C library. A size
15542 of 128 bits makes the @code{long double} type equivalent to the
15543 @code{__float128} type. This is the default for 64-bit Bionic C library.
15544
15545 @strong{Warning:} if you override the default value for your target ABI, this
15546 changes the size of
15547 structures and arrays containing @code{long double} variables,
15548 as well as modifying the function calling convention for functions taking
15549 @code{long double}. Hence they are not binary-compatible
15550 with code compiled without that switch.
15551
15552 @item -mlarge-data-threshold=@var{threshold}
15553 @opindex mlarge-data-threshold
15554 When @option{-mcmodel=medium} is specified, data objects larger than
15555 @var{threshold} are placed in the large data section. This value must be the
15556 same across all objects linked into the binary, and defaults to 65535.
15557
15558 @item -mrtd
15559 @opindex mrtd
15560 Use a different function-calling convention, in which functions that
15561 take a fixed number of arguments return with the @code{ret @var{num}}
15562 instruction, which pops their arguments while returning. This saves one
15563 instruction in the caller since there is no need to pop the arguments
15564 there.
15565
15566 You can specify that an individual function is called with this calling
15567 sequence with the function attribute @samp{stdcall}. You can also
15568 override the @option{-mrtd} option by using the function attribute
15569 @samp{cdecl}. @xref{Function Attributes}.
15570
15571 @strong{Warning:} this calling convention is incompatible with the one
15572 normally used on Unix, so you cannot use it if you need to call
15573 libraries compiled with the Unix compiler.
15574
15575 Also, you must provide function prototypes for all functions that
15576 take variable numbers of arguments (including @code{printf});
15577 otherwise incorrect code is generated for calls to those
15578 functions.
15579
15580 In addition, seriously incorrect code results if you call a
15581 function with too many arguments. (Normally, extra arguments are
15582 harmlessly ignored.)
15583
15584 @item -mregparm=@var{num}
15585 @opindex mregparm
15586 Control how many registers are used to pass integer arguments. By
15587 default, no registers are used to pass arguments, and at most 3
15588 registers can be used. You can control this behavior for a specific
15589 function by using the function attribute @samp{regparm}.
15590 @xref{Function Attributes}.
15591
15592 @strong{Warning:} if you use this switch, and
15593 @var{num} is nonzero, then you must build all modules with the same
15594 value, including any libraries. This includes the system libraries and
15595 startup modules.
15596
15597 @item -msseregparm
15598 @opindex msseregparm
15599 Use SSE register passing conventions for float and double arguments
15600 and return values. You can control this behavior for a specific
15601 function by using the function attribute @samp{sseregparm}.
15602 @xref{Function Attributes}.
15603
15604 @strong{Warning:} if you use this switch then you must build all
15605 modules with the same value, including any libraries. This includes
15606 the system libraries and startup modules.
15607
15608 @item -mvect8-ret-in-mem
15609 @opindex mvect8-ret-in-mem
15610 Return 8-byte vectors in memory instead of MMX registers. This is the
15611 default on Solaris@tie{}8 and 9 and VxWorks to match the ABI of the Sun
15612 Studio compilers until version 12. Later compiler versions (starting
15613 with Studio 12 Update@tie{}1) follow the ABI used by other x86 targets, which
15614 is the default on Solaris@tie{}10 and later. @emph{Only} use this option if
15615 you need to remain compatible with existing code produced by those
15616 previous compiler versions or older versions of GCC@.
15617
15618 @item -mpc32
15619 @itemx -mpc64
15620 @itemx -mpc80
15621 @opindex mpc32
15622 @opindex mpc64
15623 @opindex mpc80
15624
15625 Set 80387 floating-point precision to 32, 64 or 80 bits. When @option{-mpc32}
15626 is specified, the significands of results of floating-point operations are
15627 rounded to 24 bits (single precision); @option{-mpc64} rounds the
15628 significands of results of floating-point operations to 53 bits (double
15629 precision) and @option{-mpc80} rounds the significands of results of
15630 floating-point operations to 64 bits (extended double precision), which is
15631 the default. When this option is used, floating-point operations in higher
15632 precisions are not available to the programmer without setting the FPU
15633 control word explicitly.
15634
15635 Setting the rounding of floating-point operations to less than the default
15636 80 bits can speed some programs by 2% or more. Note that some mathematical
15637 libraries assume that extended-precision (80-bit) floating-point operations
15638 are enabled by default; routines in such libraries could suffer significant
15639 loss of accuracy, typically through so-called ``catastrophic cancellation'',
15640 when this option is used to set the precision to less than extended precision.
15641
15642 @item -mstackrealign
15643 @opindex mstackrealign
15644 Realign the stack at entry. On the Intel x86, the @option{-mstackrealign}
15645 option generates an alternate prologue and epilogue that realigns the
15646 run-time stack if necessary. This supports mixing legacy codes that keep
15647 4-byte stack alignment with modern codes that keep 16-byte stack alignment for
15648 SSE compatibility. See also the attribute @code{force_align_arg_pointer},
15649 applicable to individual functions.
15650
15651 @item -mpreferred-stack-boundary=@var{num}
15652 @opindex mpreferred-stack-boundary
15653 Attempt to keep the stack boundary aligned to a 2 raised to @var{num}
15654 byte boundary. If @option{-mpreferred-stack-boundary} is not specified,
15655 the default is 4 (16 bytes or 128 bits).
15656
15657 @strong{Warning:} When generating code for the x86-64 architecture with
15658 SSE extensions disabled, @option{-mpreferred-stack-boundary=3} can be
15659 used to keep the stack boundary aligned to 8 byte boundary. Since
15660 x86-64 ABI require 16 byte stack alignment, this is ABI incompatible and
15661 intended to be used in controlled environment where stack space is
15662 important limitation. This option will lead to wrong code when functions
15663 compiled with 16 byte stack alignment (such as functions from a standard
15664 library) are called with misaligned stack. In this case, SSE
15665 instructions may lead to misaligned memory access traps. In addition,
15666 variable arguments will be handled incorrectly for 16 byte aligned
15667 objects (including x87 long double and __int128), leading to wrong
15668 results. You must build all modules with
15669 @option{-mpreferred-stack-boundary=3}, including any libraries. This
15670 includes the system libraries and startup modules.
15671
15672 @item -mincoming-stack-boundary=@var{num}
15673 @opindex mincoming-stack-boundary
15674 Assume the incoming stack is aligned to a 2 raised to @var{num} byte
15675 boundary. If @option{-mincoming-stack-boundary} is not specified,
15676 the one specified by @option{-mpreferred-stack-boundary} is used.
15677
15678 On Pentium and Pentium Pro, @code{double} and @code{long double} values
15679 should be aligned to an 8-byte boundary (see @option{-malign-double}) or
15680 suffer significant run time performance penalties. On Pentium III, the
15681 Streaming SIMD Extension (SSE) data type @code{__m128} may not work
15682 properly if it is not 16-byte aligned.
15683
15684 To ensure proper alignment of this values on the stack, the stack boundary
15685 must be as aligned as that required by any value stored on the stack.
15686 Further, every function must be generated such that it keeps the stack
15687 aligned. Thus calling a function compiled with a higher preferred
15688 stack boundary from a function compiled with a lower preferred stack
15689 boundary most likely misaligns the stack. It is recommended that
15690 libraries that use callbacks always use the default setting.
15691
15692 This extra alignment does consume extra stack space, and generally
15693 increases code size. Code that is sensitive to stack space usage, such
15694 as embedded systems and operating system kernels, may want to reduce the
15695 preferred alignment to @option{-mpreferred-stack-boundary=2}.
15696
15697 @item -mmmx
15698 @itemx -mno-mmx
15699 @itemx -msse
15700 @itemx -mno-sse
15701 @itemx -msse2
15702 @itemx -mno-sse2
15703 @itemx -msse3
15704 @itemx -mno-sse3
15705 @itemx -mssse3
15706 @itemx -mno-ssse3
15707 @itemx -msse4.1
15708 @need 800
15709 @itemx -mno-sse4.1
15710 @itemx -msse4.2
15711 @itemx -mno-sse4.2
15712 @itemx -msse4
15713 @itemx -mno-sse4
15714 @itemx -mavx
15715 @itemx -mno-avx
15716 @itemx -mavx2
15717 @itemx -mno-avx2
15718 @itemx -mavx512f
15719 @itemx -mno-avx512f
15720 @need 800
15721 @itemx -mavx512pf
15722 @itemx -mno-avx512pf
15723 @itemx -mavx512er
15724 @itemx -mno-avx512er
15725 @itemx -mavx512cd
15726 @itemx -mno-avx512cd
15727 @itemx -msha
15728 @itemx -mno-sha
15729 @itemx -maes
15730 @itemx -mno-aes
15731 @itemx -mpclmul
15732 @itemx -mno-pclmul
15733 @itemx -mclfushopt
15734 @itemx -mno-clflsuhopt
15735 @need 800
15736 @itemx -mfsgsbase
15737 @itemx -mno-fsgsbase
15738 @itemx -mrdrnd
15739 @itemx -mno-rdrnd
15740 @itemx -mf16c
15741 @itemx -mno-f16c
15742 @itemx -mfma
15743 @itemx -mno-fma
15744 @itemx -mprefetchwt1
15745 @itemx -mno-prefetchwt1
15746 @itemx -msse4a
15747 @itemx -mno-sse4a
15748 @itemx -mfma4
15749 @itemx -mno-fma4
15750 @need 800
15751 @itemx -mxop
15752 @itemx -mno-xop
15753 @itemx -mlwp
15754 @itemx -mno-lwp
15755 @itemx -m3dnow
15756 @itemx -mno-3dnow
15757 @itemx -mpopcnt
15758 @itemx -mno-popcnt
15759 @itemx -mabm
15760 @itemx -mno-abm
15761 @itemx -mbmi
15762 @itemx -mbmi2
15763 @itemx -mno-bmi
15764 @itemx -mno-bmi2
15765 @itemx -mlzcnt
15766 @itemx -mno-lzcnt
15767 @itemx -mfxsr
15768 @itemx -mxsave
15769 @itemx -mxsaveopt
15770 @itemx -mrtm
15771 @itemx -mtbm
15772 @itemx -mno-tbm
15773 @itemx -mxsavec
15774 @itemx -mno-xsavec
15775 @itemx -mxsaves
15776 @itemx -mno-xsaves
15777 @opindex mmmx
15778 @opindex mno-mmx
15779 @opindex msse
15780 @opindex mno-sse
15781 @opindex m3dnow
15782 @opindex mno-3dnow
15783 These switches enable or disable the use of instructions in the MMX, SSE,
15784 SSE2, SSE3, SSSE3, SSE4.1, AVX, AVX2, AVX512F, AVX512PF, AVX512ER, AVX512CD,
15785 SHA, AES, PCLMUL, FSGSBASE, RDRND, F16C, FMA, SSE4A, FMA4, XOP, LWP, ABM,
15786 BMI, BMI2, FXSR, XSAVE, XSAVEOPT, LZCNT, RTM, or 3DNow!@:
15787 extended instruction sets.
15788 These extensions are also available as built-in functions: see
15789 @ref{X86 Built-in Functions}, for details of the functions enabled and
15790 disabled by these switches.
15791
15792 To generate SSE/SSE2 instructions automatically from floating-point
15793 code (as opposed to 387 instructions), see @option{-mfpmath=sse}.
15794
15795 GCC depresses SSEx instructions when @option{-mavx} is used. Instead, it
15796 generates new AVX instructions or AVX equivalence for all SSEx instructions
15797 when needed.
15798
15799 These options enable GCC to use these extended instructions in
15800 generated code, even without @option{-mfpmath=sse}. Applications that
15801 perform run-time CPU detection must compile separate files for each
15802 supported architecture, using the appropriate flags. In particular,
15803 the file containing the CPU detection code should be compiled without
15804 these options.
15805
15806 @item -mdump-tune-features
15807 @opindex mdump-tune-features
15808 This option instructs GCC to dump the names of the x86 performance
15809 tuning features and default settings. The names can be used in
15810 @option{-mtune-ctrl=@var{feature-list}}.
15811
15812 @item -mtune-ctrl=@var{feature-list}
15813 @opindex mtune-ctrl=@var{feature-list}
15814 This option is used to do fine grain control of x86 code generation features.
15815 @var{feature-list} is a comma separated list of @var{feature} names. See also
15816 @option{-mdump-tune-features}. When specified, the @var{feature} will be turned
15817 on if it is not preceded with @code{^}, otherwise, it will be turned off.
15818 @option{-mtune-ctrl=@var{feature-list}} is intended to be used by GCC
15819 developers. Using it may lead to code paths not covered by testing and can
15820 potentially result in compiler ICEs or runtime errors.
15821
15822 @item -mno-default
15823 @opindex mno-default
15824 This option instructs GCC to turn off all tunable features. See also
15825 @option{-mtune-ctrl=@var{feature-list}} and @option{-mdump-tune-features}.
15826
15827 @item -mcld
15828 @opindex mcld
15829 This option instructs GCC to emit a @code{cld} instruction in the prologue
15830 of functions that use string instructions. String instructions depend on
15831 the DF flag to select between autoincrement or autodecrement mode. While the
15832 ABI specifies the DF flag to be cleared on function entry, some operating
15833 systems violate this specification by not clearing the DF flag in their
15834 exception dispatchers. The exception handler can be invoked with the DF flag
15835 set, which leads to wrong direction mode when string instructions are used.
15836 This option can be enabled by default on 32-bit x86 targets by configuring
15837 GCC with the @option{--enable-cld} configure option. Generation of @code{cld}
15838 instructions can be suppressed with the @option{-mno-cld} compiler option
15839 in this case.
15840
15841 @item -mvzeroupper
15842 @opindex mvzeroupper
15843 This option instructs GCC to emit a @code{vzeroupper} instruction
15844 before a transfer of control flow out of the function to minimize
15845 the AVX to SSE transition penalty as well as remove unnecessary @code{zeroupper}
15846 intrinsics.
15847
15848 @item -mprefer-avx128
15849 @opindex mprefer-avx128
15850 This option instructs GCC to use 128-bit AVX instructions instead of
15851 256-bit AVX instructions in the auto-vectorizer.
15852
15853 @item -mcx16
15854 @opindex mcx16
15855 This option enables GCC to generate @code{CMPXCHG16B} instructions.
15856 @code{CMPXCHG16B} allows for atomic operations on 128-bit double quadword
15857 (or oword) data types.
15858 This is useful for high-resolution counters that can be updated
15859 by multiple processors (or cores). This instruction is generated as part of
15860 atomic built-in functions: see @ref{__sync Builtins} or
15861 @ref{__atomic Builtins} for details.
15862
15863 @item -msahf
15864 @opindex msahf
15865 This option enables generation of @code{SAHF} instructions in 64-bit code.
15866 Early Intel Pentium 4 CPUs with Intel 64 support,
15867 prior to the introduction of Pentium 4 G1 step in December 2005,
15868 lacked the @code{LAHF} and @code{SAHF} instructions
15869 which were supported by AMD64.
15870 These are load and store instructions, respectively, for certain status flags.
15871 In 64-bit mode, the @code{SAHF} instruction is used to optimize @code{fmod},
15872 @code{drem}, and @code{remainder} built-in functions;
15873 see @ref{Other Builtins} for details.
15874
15875 @item -mmovbe
15876 @opindex mmovbe
15877 This option enables use of the @code{movbe} instruction to implement
15878 @code{__builtin_bswap32} and @code{__builtin_bswap64}.
15879
15880 @item -mcrc32
15881 @opindex mcrc32
15882 This option enables built-in functions @code{__builtin_ia32_crc32qi},
15883 @code{__builtin_ia32_crc32hi}, @code{__builtin_ia32_crc32si} and
15884 @code{__builtin_ia32_crc32di} to generate the @code{crc32} machine instruction.
15885
15886 @item -mrecip
15887 @opindex mrecip
15888 This option enables use of @code{RCPSS} and @code{RSQRTSS} instructions
15889 (and their vectorized variants @code{RCPPS} and @code{RSQRTPS})
15890 with an additional Newton-Raphson step
15891 to increase precision instead of @code{DIVSS} and @code{SQRTSS}
15892 (and their vectorized
15893 variants) for single-precision floating-point arguments. These instructions
15894 are generated only when @option{-funsafe-math-optimizations} is enabled
15895 together with @option{-finite-math-only} and @option{-fno-trapping-math}.
15896 Note that while the throughput of the sequence is higher than the throughput
15897 of the non-reciprocal instruction, the precision of the sequence can be
15898 decreased by up to 2 ulp (i.e. the inverse of 1.0 equals 0.99999994).
15899
15900 Note that GCC implements @code{1.0f/sqrtf(@var{x})} in terms of @code{RSQRTSS}
15901 (or @code{RSQRTPS}) already with @option{-ffast-math} (or the above option
15902 combination), and doesn't need @option{-mrecip}.
15903
15904 Also note that GCC emits the above sequence with additional Newton-Raphson step
15905 for vectorized single-float division and vectorized @code{sqrtf(@var{x})}
15906 already with @option{-ffast-math} (or the above option combination), and
15907 doesn't need @option{-mrecip}.
15908
15909 @item -mrecip=@var{opt}
15910 @opindex mrecip=opt
15911 This option controls which reciprocal estimate instructions
15912 may be used. @var{opt} is a comma-separated list of options, which may
15913 be preceded by a @samp{!} to invert the option:
15914
15915 @table @samp
15916 @item all
15917 Enable all estimate instructions.
15918
15919 @item default
15920 Enable the default instructions, equivalent to @option{-mrecip}.
15921
15922 @item none
15923 Disable all estimate instructions, equivalent to @option{-mno-recip}.
15924
15925 @item div
15926 Enable the approximation for scalar division.
15927
15928 @item vec-div
15929 Enable the approximation for vectorized division.
15930
15931 @item sqrt
15932 Enable the approximation for scalar square root.
15933
15934 @item vec-sqrt
15935 Enable the approximation for vectorized square root.
15936 @end table
15937
15938 So, for example, @option{-mrecip=all,!sqrt} enables
15939 all of the reciprocal approximations, except for square root.
15940
15941 @item -mveclibabi=@var{type}
15942 @opindex mveclibabi
15943 Specifies the ABI type to use for vectorizing intrinsics using an
15944 external library. Supported values for @var{type} are @samp{svml}
15945 for the Intel short
15946 vector math library and @samp{acml} for the AMD math core library.
15947 To use this option, both @option{-ftree-vectorize} and
15948 @option{-funsafe-math-optimizations} have to be enabled, and an SVML or ACML
15949 ABI-compatible library must be specified at link time.
15950
15951 GCC currently emits calls to @code{vmldExp2},
15952 @code{vmldLn2}, @code{vmldLog102}, @code{vmldLog102}, @code{vmldPow2},
15953 @code{vmldTanh2}, @code{vmldTan2}, @code{vmldAtan2}, @code{vmldAtanh2},
15954 @code{vmldCbrt2}, @code{vmldSinh2}, @code{vmldSin2}, @code{vmldAsinh2},
15955 @code{vmldAsin2}, @code{vmldCosh2}, @code{vmldCos2}, @code{vmldAcosh2},
15956 @code{vmldAcos2}, @code{vmlsExp4}, @code{vmlsLn4}, @code{vmlsLog104},
15957 @code{vmlsLog104}, @code{vmlsPow4}, @code{vmlsTanh4}, @code{vmlsTan4},
15958 @code{vmlsAtan4}, @code{vmlsAtanh4}, @code{vmlsCbrt4}, @code{vmlsSinh4},
15959 @code{vmlsSin4}, @code{vmlsAsinh4}, @code{vmlsAsin4}, @code{vmlsCosh4},
15960 @code{vmlsCos4}, @code{vmlsAcosh4} and @code{vmlsAcos4} for corresponding
15961 function type when @option{-mveclibabi=svml} is used, and @code{__vrd2_sin},
15962 @code{__vrd2_cos}, @code{__vrd2_exp}, @code{__vrd2_log}, @code{__vrd2_log2},
15963 @code{__vrd2_log10}, @code{__vrs4_sinf}, @code{__vrs4_cosf},
15964 @code{__vrs4_expf}, @code{__vrs4_logf}, @code{__vrs4_log2f},
15965 @code{__vrs4_log10f} and @code{__vrs4_powf} for the corresponding function type
15966 when @option{-mveclibabi=acml} is used.
15967
15968 @item -mabi=@var{name}
15969 @opindex mabi
15970 Generate code for the specified calling convention. Permissible values
15971 are @samp{sysv} for the ABI used on GNU/Linux and other systems, and
15972 @samp{ms} for the Microsoft ABI. The default is to use the Microsoft
15973 ABI when targeting Microsoft Windows and the SysV ABI on all other systems.
15974 You can control this behavior for a specific function by
15975 using the function attribute @samp{ms_abi}/@samp{sysv_abi}.
15976 @xref{Function Attributes}.
15977
15978 @item -mtls-dialect=@var{type}
15979 @opindex mtls-dialect
15980 Generate code to access thread-local storage using the @samp{gnu} or
15981 @samp{gnu2} conventions. @samp{gnu} is the conservative default;
15982 @samp{gnu2} is more efficient, but it may add compile- and run-time
15983 requirements that cannot be satisfied on all systems.
15984
15985 @item -mpush-args
15986 @itemx -mno-push-args
15987 @opindex mpush-args
15988 @opindex mno-push-args
15989 Use PUSH operations to store outgoing parameters. This method is shorter
15990 and usually equally fast as method using SUB/MOV operations and is enabled
15991 by default. In some cases disabling it may improve performance because of
15992 improved scheduling and reduced dependencies.
15993
15994 @item -maccumulate-outgoing-args
15995 @opindex maccumulate-outgoing-args
15996 If enabled, the maximum amount of space required for outgoing arguments is
15997 computed in the function prologue. This is faster on most modern CPUs
15998 because of reduced dependencies, improved scheduling and reduced stack usage
15999 when the preferred stack boundary is not equal to 2. The drawback is a notable
16000 increase in code size. This switch implies @option{-mno-push-args}.
16001
16002 @item -mthreads
16003 @opindex mthreads
16004 Support thread-safe exception handling on MinGW. Programs that rely
16005 on thread-safe exception handling must compile and link all code with the
16006 @option{-mthreads} option. When compiling, @option{-mthreads} defines
16007 @code{-D_MT}; when linking, it links in a special thread helper library
16008 @option{-lmingwthrd} which cleans up per-thread exception-handling data.
16009
16010 @item -mno-align-stringops
16011 @opindex mno-align-stringops
16012 Do not align the destination of inlined string operations. This switch reduces
16013 code size and improves performance in case the destination is already aligned,
16014 but GCC doesn't know about it.
16015
16016 @item -minline-all-stringops
16017 @opindex minline-all-stringops
16018 By default GCC inlines string operations only when the destination is
16019 known to be aligned to least a 4-byte boundary.
16020 This enables more inlining and increases code
16021 size, but may improve performance of code that depends on fast
16022 @code{memcpy}, @code{strlen},
16023 and @code{memset} for short lengths.
16024
16025 @item -minline-stringops-dynamically
16026 @opindex minline-stringops-dynamically
16027 For string operations of unknown size, use run-time checks with
16028 inline code for small blocks and a library call for large blocks.
16029
16030 @item -mstringop-strategy=@var{alg}
16031 @opindex mstringop-strategy=@var{alg}
16032 Override the internal decision heuristic for the particular algorithm to use
16033 for inlining string operations. The allowed values for @var{alg} are:
16034
16035 @table @samp
16036 @item rep_byte
16037 @itemx rep_4byte
16038 @itemx rep_8byte
16039 Expand using i386 @code{rep} prefix of the specified size.
16040
16041 @item byte_loop
16042 @itemx loop
16043 @itemx unrolled_loop
16044 Expand into an inline loop.
16045
16046 @item libcall
16047 Always use a library call.
16048 @end table
16049
16050 @item -mmemcpy-strategy=@var{strategy}
16051 @opindex mmemcpy-strategy=@var{strategy}
16052 Override the internal decision heuristic to decide if @code{__builtin_memcpy}
16053 should be inlined and what inline algorithm to use when the expected size
16054 of the copy operation is known. @var{strategy}
16055 is a comma-separated list of @var{alg}:@var{max_size}:@var{dest_align} triplets.
16056 @var{alg} is specified in @option{-mstringop-strategy}, @var{max_size} specifies
16057 the max byte size with which inline algorithm @var{alg} is allowed. For the last
16058 triplet, the @var{max_size} must be @code{-1}. The @var{max_size} of the triplets
16059 in the list must be specified in increasing order. The minimal byte size for
16060 @var{alg} is @code{0} for the first triplet and @code{@var{max_size} + 1} of the
16061 preceding range.
16062
16063 @item -mmemset-strategy=@var{strategy}
16064 @opindex mmemset-strategy=@var{strategy}
16065 The option is similar to @option{-mmemcpy-strategy=} except that it is to control
16066 @code{__builtin_memset} expansion.
16067
16068 @item -momit-leaf-frame-pointer
16069 @opindex momit-leaf-frame-pointer
16070 Don't keep the frame pointer in a register for leaf functions. This
16071 avoids the instructions to save, set up, and restore frame pointers and
16072 makes an extra register available in leaf functions. The option
16073 @option{-fomit-leaf-frame-pointer} removes the frame pointer for leaf functions,
16074 which might make debugging harder.
16075
16076 @item -mtls-direct-seg-refs
16077 @itemx -mno-tls-direct-seg-refs
16078 @opindex mtls-direct-seg-refs
16079 Controls whether TLS variables may be accessed with offsets from the
16080 TLS segment register (@code{%gs} for 32-bit, @code{%fs} for 64-bit),
16081 or whether the thread base pointer must be added. Whether or not this
16082 is valid depends on the operating system, and whether it maps the
16083 segment to cover the entire TLS area.
16084
16085 For systems that use the GNU C Library, the default is on.
16086
16087 @item -msse2avx
16088 @itemx -mno-sse2avx
16089 @opindex msse2avx
16090 Specify that the assembler should encode SSE instructions with VEX
16091 prefix. The option @option{-mavx} turns this on by default.
16092
16093 @item -mfentry
16094 @itemx -mno-fentry
16095 @opindex mfentry
16096 If profiling is active (@option{-pg}), put the profiling
16097 counter call before the prologue.
16098 Note: On x86 architectures the attribute @code{ms_hook_prologue}
16099 isn't possible at the moment for @option{-mfentry} and @option{-pg}.
16100
16101 @item -mrecord-mcount
16102 @itemx -mno-record-mcount
16103 @opindex mrecord-mcount
16104 If profiling is active (@option{-pg}), generate a __mcount_loc section
16105 that contains pointers to each profiling call. This is useful for
16106 automatically patching and out calls.
16107
16108 @item -mnop-mcount
16109 @itemx -mno-nop-mcount
16110 @opindex mnop-mcount
16111 If profiling is active (@option{-pg}), generate the calls to
16112 the profiling functions as nops. This is useful when they
16113 should be patched in later dynamically. This is likely only
16114 useful together with @option{-mrecord-mcount}.
16115
16116 @item -m8bit-idiv
16117 @itemx -mno-8bit-idiv
16118 @opindex 8bit-idiv
16119 On some processors, like Intel Atom, 8-bit unsigned integer divide is
16120 much faster than 32-bit/64-bit integer divide. This option generates a
16121 run-time check. If both dividend and divisor are within range of 0
16122 to 255, 8-bit unsigned integer divide is used instead of
16123 32-bit/64-bit integer divide.
16124
16125 @item -mavx256-split-unaligned-load
16126 @itemx -mavx256-split-unaligned-store
16127 @opindex avx256-split-unaligned-load
16128 @opindex avx256-split-unaligned-store
16129 Split 32-byte AVX unaligned load and store.
16130
16131 @item -mstack-protector-guard=@var{guard}
16132 @opindex mstack-protector-guard=@var{guard}
16133 Generate stack protection code using canary at @var{guard}. Supported
16134 locations are @samp{global} for global canary or @samp{tls} for per-thread
16135 canary in the TLS block (the default). This option has effect only when
16136 @option{-fstack-protector} or @option{-fstack-protector-all} is specified.
16137
16138 @end table
16139
16140 These @samp{-m} switches are supported in addition to the above
16141 on x86-64 processors in 64-bit environments.
16142
16143 @table @gcctabopt
16144 @item -m32
16145 @itemx -m64
16146 @itemx -mx32
16147 @itemx -m16
16148 @opindex m32
16149 @opindex m64
16150 @opindex mx32
16151 @opindex m16
16152 Generate code for a 16-bit, 32-bit or 64-bit environment.
16153 The @option{-m32} option sets @code{int}, @code{long}, and pointer types
16154 to 32 bits, and
16155 generates code that runs on any i386 system.
16156
16157 The @option{-m64} option sets @code{int} to 32 bits and @code{long} and pointer
16158 types to 64 bits, and generates code for the x86-64 architecture.
16159 For Darwin only the @option{-m64} option also turns off the @option{-fno-pic}
16160 and @option{-mdynamic-no-pic} options.
16161
16162 The @option{-mx32} option sets @code{int}, @code{long}, and pointer types
16163 to 32 bits, and
16164 generates code for the x86-64 architecture.
16165
16166 The @option{-m16} option is the same as @option{-m32}, except for that
16167 it outputs the @code{.code16gcc} assembly directive at the beginning of
16168 the assembly output so that the binary can run in 16-bit mode.
16169
16170 @item -mno-red-zone
16171 @opindex mno-red-zone
16172 Do not use a so-called ``red zone'' for x86-64 code. The red zone is mandated
16173 by the x86-64 ABI; it is a 128-byte area beyond the location of the
16174 stack pointer that is not modified by signal or interrupt handlers
16175 and therefore can be used for temporary data without adjusting the stack
16176 pointer. The flag @option{-mno-red-zone} disables this red zone.
16177
16178 @item -mcmodel=small
16179 @opindex mcmodel=small
16180 Generate code for the small code model: the program and its symbols must
16181 be linked in the lower 2 GB of the address space. Pointers are 64 bits.
16182 Programs can be statically or dynamically linked. This is the default
16183 code model.
16184
16185 @item -mcmodel=kernel
16186 @opindex mcmodel=kernel
16187 Generate code for the kernel code model. The kernel runs in the
16188 negative 2 GB of the address space.
16189 This model has to be used for Linux kernel code.
16190
16191 @item -mcmodel=medium
16192 @opindex mcmodel=medium
16193 Generate code for the medium model: the program is linked in the lower 2
16194 GB of the address space. Small symbols are also placed there. Symbols
16195 with sizes larger than @option{-mlarge-data-threshold} are put into
16196 large data or BSS sections and can be located above 2GB. Programs can
16197 be statically or dynamically linked.
16198
16199 @item -mcmodel=large
16200 @opindex mcmodel=large
16201 Generate code for the large model. This model makes no assumptions
16202 about addresses and sizes of sections.
16203
16204 @item -maddress-mode=long
16205 @opindex maddress-mode=long
16206 Generate code for long address mode. This is only supported for 64-bit
16207 and x32 environments. It is the default address mode for 64-bit
16208 environments.
16209
16210 @item -maddress-mode=short
16211 @opindex maddress-mode=short
16212 Generate code for short address mode. This is only supported for 32-bit
16213 and x32 environments. It is the default address mode for 32-bit and
16214 x32 environments.
16215 @end table
16216
16217 @node i386 and x86-64 Windows Options
16218 @subsection i386 and x86-64 Windows Options
16219 @cindex i386 and x86-64 Windows Options
16220
16221 These additional options are available for Microsoft Windows targets:
16222
16223 @table @gcctabopt
16224 @item -mconsole
16225 @opindex mconsole
16226 This option
16227 specifies that a console application is to be generated, by
16228 instructing the linker to set the PE header subsystem type
16229 required for console applications.
16230 This option is available for Cygwin and MinGW targets and is
16231 enabled by default on those targets.
16232
16233 @item -mdll
16234 @opindex mdll
16235 This option is available for Cygwin and MinGW targets. It
16236 specifies that a DLL---a dynamic link library---is to be
16237 generated, enabling the selection of the required runtime
16238 startup object and entry point.
16239
16240 @item -mnop-fun-dllimport
16241 @opindex mnop-fun-dllimport
16242 This option is available for Cygwin and MinGW targets. It
16243 specifies that the @code{dllimport} attribute should be ignored.
16244
16245 @item -mthread
16246 @opindex mthread
16247 This option is available for MinGW targets. It specifies
16248 that MinGW-specific thread support is to be used.
16249
16250 @item -municode
16251 @opindex municode
16252 This option is available for MinGW-w64 targets. It causes
16253 the @code{UNICODE} preprocessor macro to be predefined, and
16254 chooses Unicode-capable runtime startup code.
16255
16256 @item -mwin32
16257 @opindex mwin32
16258 This option is available for Cygwin and MinGW targets. It
16259 specifies that the typical Microsoft Windows predefined macros are to
16260 be set in the pre-processor, but does not influence the choice
16261 of runtime library/startup code.
16262
16263 @item -mwindows
16264 @opindex mwindows
16265 This option is available for Cygwin and MinGW targets. It
16266 specifies that a GUI application is to be generated by
16267 instructing the linker to set the PE header subsystem type
16268 appropriately.
16269
16270 @item -fno-set-stack-executable
16271 @opindex fno-set-stack-executable
16272 This option is available for MinGW targets. It specifies that
16273 the executable flag for the stack used by nested functions isn't
16274 set. This is necessary for binaries running in kernel mode of
16275 Microsoft Windows, as there the User32 API, which is used to set executable
16276 privileges, isn't available.
16277
16278 @item -fwritable-relocated-rdata
16279 @opindex fno-writable-relocated-rdata
16280 This option is available for MinGW and Cygwin targets. It specifies
16281 that relocated-data in read-only section is put into .data
16282 section. This is a necessary for older runtimes not supporting
16283 modification of .rdata sections for pseudo-relocation.
16284
16285 @item -mpe-aligned-commons
16286 @opindex mpe-aligned-commons
16287 This option is available for Cygwin and MinGW targets. It
16288 specifies that the GNU extension to the PE file format that
16289 permits the correct alignment of COMMON variables should be
16290 used when generating code. It is enabled by default if
16291 GCC detects that the target assembler found during configuration
16292 supports the feature.
16293 @end table
16294
16295 See also under @ref{i386 and x86-64 Options} for standard options.
16296
16297 @node IA-64 Options
16298 @subsection IA-64 Options
16299 @cindex IA-64 Options
16300
16301 These are the @samp{-m} options defined for the Intel IA-64 architecture.
16302
16303 @table @gcctabopt
16304 @item -mbig-endian
16305 @opindex mbig-endian
16306 Generate code for a big-endian target. This is the default for HP-UX@.
16307
16308 @item -mlittle-endian
16309 @opindex mlittle-endian
16310 Generate code for a little-endian target. This is the default for AIX5
16311 and GNU/Linux.
16312
16313 @item -mgnu-as
16314 @itemx -mno-gnu-as
16315 @opindex mgnu-as
16316 @opindex mno-gnu-as
16317 Generate (or don't) code for the GNU assembler. This is the default.
16318 @c Also, this is the default if the configure option @option{--with-gnu-as}
16319 @c is used.
16320
16321 @item -mgnu-ld
16322 @itemx -mno-gnu-ld
16323 @opindex mgnu-ld
16324 @opindex mno-gnu-ld
16325 Generate (or don't) code for the GNU linker. This is the default.
16326 @c Also, this is the default if the configure option @option{--with-gnu-ld}
16327 @c is used.
16328
16329 @item -mno-pic
16330 @opindex mno-pic
16331 Generate code that does not use a global pointer register. The result
16332 is not position independent code, and violates the IA-64 ABI@.
16333
16334 @item -mvolatile-asm-stop
16335 @itemx -mno-volatile-asm-stop
16336 @opindex mvolatile-asm-stop
16337 @opindex mno-volatile-asm-stop
16338 Generate (or don't) a stop bit immediately before and after volatile asm
16339 statements.
16340
16341 @item -mregister-names
16342 @itemx -mno-register-names
16343 @opindex mregister-names
16344 @opindex mno-register-names
16345 Generate (or don't) @samp{in}, @samp{loc}, and @samp{out} register names for
16346 the stacked registers. This may make assembler output more readable.
16347
16348 @item -mno-sdata
16349 @itemx -msdata
16350 @opindex mno-sdata
16351 @opindex msdata
16352 Disable (or enable) optimizations that use the small data section. This may
16353 be useful for working around optimizer bugs.
16354
16355 @item -mconstant-gp
16356 @opindex mconstant-gp
16357 Generate code that uses a single constant global pointer value. This is
16358 useful when compiling kernel code.
16359
16360 @item -mauto-pic
16361 @opindex mauto-pic
16362 Generate code that is self-relocatable. This implies @option{-mconstant-gp}.
16363 This is useful when compiling firmware code.
16364
16365 @item -minline-float-divide-min-latency
16366 @opindex minline-float-divide-min-latency
16367 Generate code for inline divides of floating-point values
16368 using the minimum latency algorithm.
16369
16370 @item -minline-float-divide-max-throughput
16371 @opindex minline-float-divide-max-throughput
16372 Generate code for inline divides of floating-point values
16373 using the maximum throughput algorithm.
16374
16375 @item -mno-inline-float-divide
16376 @opindex mno-inline-float-divide
16377 Do not generate inline code for divides of floating-point values.
16378
16379 @item -minline-int-divide-min-latency
16380 @opindex minline-int-divide-min-latency
16381 Generate code for inline divides of integer values
16382 using the minimum latency algorithm.
16383
16384 @item -minline-int-divide-max-throughput
16385 @opindex minline-int-divide-max-throughput
16386 Generate code for inline divides of integer values
16387 using the maximum throughput algorithm.
16388
16389 @item -mno-inline-int-divide
16390 @opindex mno-inline-int-divide
16391 Do not generate inline code for divides of integer values.
16392
16393 @item -minline-sqrt-min-latency
16394 @opindex minline-sqrt-min-latency
16395 Generate code for inline square roots
16396 using the minimum latency algorithm.
16397
16398 @item -minline-sqrt-max-throughput
16399 @opindex minline-sqrt-max-throughput
16400 Generate code for inline square roots
16401 using the maximum throughput algorithm.
16402
16403 @item -mno-inline-sqrt
16404 @opindex mno-inline-sqrt
16405 Do not generate inline code for @code{sqrt}.
16406
16407 @item -mfused-madd
16408 @itemx -mno-fused-madd
16409 @opindex mfused-madd
16410 @opindex mno-fused-madd
16411 Do (don't) generate code that uses the fused multiply/add or multiply/subtract
16412 instructions. The default is to use these instructions.
16413
16414 @item -mno-dwarf2-asm
16415 @itemx -mdwarf2-asm
16416 @opindex mno-dwarf2-asm
16417 @opindex mdwarf2-asm
16418 Don't (or do) generate assembler code for the DWARF 2 line number debugging
16419 info. This may be useful when not using the GNU assembler.
16420
16421 @item -mearly-stop-bits
16422 @itemx -mno-early-stop-bits
16423 @opindex mearly-stop-bits
16424 @opindex mno-early-stop-bits
16425 Allow stop bits to be placed earlier than immediately preceding the
16426 instruction that triggered the stop bit. This can improve instruction
16427 scheduling, but does not always do so.
16428
16429 @item -mfixed-range=@var{register-range}
16430 @opindex mfixed-range
16431 Generate code treating the given register range as fixed registers.
16432 A fixed register is one that the register allocator cannot use. This is
16433 useful when compiling kernel code. A register range is specified as
16434 two registers separated by a dash. Multiple register ranges can be
16435 specified separated by a comma.
16436
16437 @item -mtls-size=@var{tls-size}
16438 @opindex mtls-size
16439 Specify bit size of immediate TLS offsets. Valid values are 14, 22, and
16440 64.
16441
16442 @item -mtune=@var{cpu-type}
16443 @opindex mtune
16444 Tune the instruction scheduling for a particular CPU, Valid values are
16445 @samp{itanium}, @samp{itanium1}, @samp{merced}, @samp{itanium2},
16446 and @samp{mckinley}.
16447
16448 @item -milp32
16449 @itemx -mlp64
16450 @opindex milp32
16451 @opindex mlp64
16452 Generate code for a 32-bit or 64-bit environment.
16453 The 32-bit environment sets int, long and pointer to 32 bits.
16454 The 64-bit environment sets int to 32 bits and long and pointer
16455 to 64 bits. These are HP-UX specific flags.
16456
16457 @item -mno-sched-br-data-spec
16458 @itemx -msched-br-data-spec
16459 @opindex mno-sched-br-data-spec
16460 @opindex msched-br-data-spec
16461 (Dis/En)able data speculative scheduling before reload.
16462 This results in generation of @code{ld.a} instructions and
16463 the corresponding check instructions (@code{ld.c} / @code{chk.a}).
16464 The default is 'disable'.
16465
16466 @item -msched-ar-data-spec
16467 @itemx -mno-sched-ar-data-spec
16468 @opindex msched-ar-data-spec
16469 @opindex mno-sched-ar-data-spec
16470 (En/Dis)able data speculative scheduling after reload.
16471 This results in generation of @code{ld.a} instructions and
16472 the corresponding check instructions (@code{ld.c} / @code{chk.a}).
16473 The default is 'enable'.
16474
16475 @item -mno-sched-control-spec
16476 @itemx -msched-control-spec
16477 @opindex mno-sched-control-spec
16478 @opindex msched-control-spec
16479 (Dis/En)able control speculative scheduling. This feature is
16480 available only during region scheduling (i.e.@: before reload).
16481 This results in generation of the @code{ld.s} instructions and
16482 the corresponding check instructions @code{chk.s}.
16483 The default is 'disable'.
16484
16485 @item -msched-br-in-data-spec
16486 @itemx -mno-sched-br-in-data-spec
16487 @opindex msched-br-in-data-spec
16488 @opindex mno-sched-br-in-data-spec
16489 (En/Dis)able speculative scheduling of the instructions that
16490 are dependent on the data speculative loads before reload.
16491 This is effective only with @option{-msched-br-data-spec} enabled.
16492 The default is 'enable'.
16493
16494 @item -msched-ar-in-data-spec
16495 @itemx -mno-sched-ar-in-data-spec
16496 @opindex msched-ar-in-data-spec
16497 @opindex mno-sched-ar-in-data-spec
16498 (En/Dis)able speculative scheduling of the instructions that
16499 are dependent on the data speculative loads after reload.
16500 This is effective only with @option{-msched-ar-data-spec} enabled.
16501 The default is 'enable'.
16502
16503 @item -msched-in-control-spec
16504 @itemx -mno-sched-in-control-spec
16505 @opindex msched-in-control-spec
16506 @opindex mno-sched-in-control-spec
16507 (En/Dis)able speculative scheduling of the instructions that
16508 are dependent on the control speculative loads.
16509 This is effective only with @option{-msched-control-spec} enabled.
16510 The default is 'enable'.
16511
16512 @item -mno-sched-prefer-non-data-spec-insns
16513 @itemx -msched-prefer-non-data-spec-insns
16514 @opindex mno-sched-prefer-non-data-spec-insns
16515 @opindex msched-prefer-non-data-spec-insns
16516 If enabled, data-speculative instructions are chosen for schedule
16517 only if there are no other choices at the moment. This makes
16518 the use of the data speculation much more conservative.
16519 The default is 'disable'.
16520
16521 @item -mno-sched-prefer-non-control-spec-insns
16522 @itemx -msched-prefer-non-control-spec-insns
16523 @opindex mno-sched-prefer-non-control-spec-insns
16524 @opindex msched-prefer-non-control-spec-insns
16525 If enabled, control-speculative instructions are chosen for schedule
16526 only if there are no other choices at the moment. This makes
16527 the use of the control speculation much more conservative.
16528 The default is 'disable'.
16529
16530 @item -mno-sched-count-spec-in-critical-path
16531 @itemx -msched-count-spec-in-critical-path
16532 @opindex mno-sched-count-spec-in-critical-path
16533 @opindex msched-count-spec-in-critical-path
16534 If enabled, speculative dependencies are considered during
16535 computation of the instructions priorities. This makes the use of the
16536 speculation a bit more conservative.
16537 The default is 'disable'.
16538
16539 @item -msched-spec-ldc
16540 @opindex msched-spec-ldc
16541 Use a simple data speculation check. This option is on by default.
16542
16543 @item -msched-control-spec-ldc
16544 @opindex msched-spec-ldc
16545 Use a simple check for control speculation. This option is on by default.
16546
16547 @item -msched-stop-bits-after-every-cycle
16548 @opindex msched-stop-bits-after-every-cycle
16549 Place a stop bit after every cycle when scheduling. This option is on
16550 by default.
16551
16552 @item -msched-fp-mem-deps-zero-cost
16553 @opindex msched-fp-mem-deps-zero-cost
16554 Assume that floating-point stores and loads are not likely to cause a conflict
16555 when placed into the same instruction group. This option is disabled by
16556 default.
16557
16558 @item -msel-sched-dont-check-control-spec
16559 @opindex msel-sched-dont-check-control-spec
16560 Generate checks for control speculation in selective scheduling.
16561 This flag is disabled by default.
16562
16563 @item -msched-max-memory-insns=@var{max-insns}
16564 @opindex msched-max-memory-insns
16565 Limit on the number of memory insns per instruction group, giving lower
16566 priority to subsequent memory insns attempting to schedule in the same
16567 instruction group. Frequently useful to prevent cache bank conflicts.
16568 The default value is 1.
16569
16570 @item -msched-max-memory-insns-hard-limit
16571 @opindex msched-max-memory-insns-hard-limit
16572 Makes the limit specified by @option{msched-max-memory-insns} a hard limit,
16573 disallowing more than that number in an instruction group.
16574 Otherwise, the limit is ``soft'', meaning that non-memory operations
16575 are preferred when the limit is reached, but memory operations may still
16576 be scheduled.
16577
16578 @end table
16579
16580 @node LM32 Options
16581 @subsection LM32 Options
16582 @cindex LM32 options
16583
16584 These @option{-m} options are defined for the LatticeMico32 architecture:
16585
16586 @table @gcctabopt
16587 @item -mbarrel-shift-enabled
16588 @opindex mbarrel-shift-enabled
16589 Enable barrel-shift instructions.
16590
16591 @item -mdivide-enabled
16592 @opindex mdivide-enabled
16593 Enable divide and modulus instructions.
16594
16595 @item -mmultiply-enabled
16596 @opindex multiply-enabled
16597 Enable multiply instructions.
16598
16599 @item -msign-extend-enabled
16600 @opindex msign-extend-enabled
16601 Enable sign extend instructions.
16602
16603 @item -muser-enabled
16604 @opindex muser-enabled
16605 Enable user-defined instructions.
16606
16607 @end table
16608
16609 @node M32C Options
16610 @subsection M32C Options
16611 @cindex M32C options
16612
16613 @table @gcctabopt
16614 @item -mcpu=@var{name}
16615 @opindex mcpu=
16616 Select the CPU for which code is generated. @var{name} may be one of
16617 @samp{r8c} for the R8C/Tiny series, @samp{m16c} for the M16C (up to
16618 /60) series, @samp{m32cm} for the M16C/80 series, or @samp{m32c} for
16619 the M32C/80 series.
16620
16621 @item -msim
16622 @opindex msim
16623 Specifies that the program will be run on the simulator. This causes
16624 an alternate runtime library to be linked in which supports, for
16625 example, file I/O@. You must not use this option when generating
16626 programs that will run on real hardware; you must provide your own
16627 runtime library for whatever I/O functions are needed.
16628
16629 @item -memregs=@var{number}
16630 @opindex memregs=
16631 Specifies the number of memory-based pseudo-registers GCC uses
16632 during code generation. These pseudo-registers are used like real
16633 registers, so there is a tradeoff between GCC's ability to fit the
16634 code into available registers, and the performance penalty of using
16635 memory instead of registers. Note that all modules in a program must
16636 be compiled with the same value for this option. Because of that, you
16637 must not use this option with GCC's default runtime libraries.
16638
16639 @end table
16640
16641 @node M32R/D Options
16642 @subsection M32R/D Options
16643 @cindex M32R/D options
16644
16645 These @option{-m} options are defined for Renesas M32R/D architectures:
16646
16647 @table @gcctabopt
16648 @item -m32r2
16649 @opindex m32r2
16650 Generate code for the M32R/2@.
16651
16652 @item -m32rx
16653 @opindex m32rx
16654 Generate code for the M32R/X@.
16655
16656 @item -m32r
16657 @opindex m32r
16658 Generate code for the M32R@. This is the default.
16659
16660 @item -mmodel=small
16661 @opindex mmodel=small
16662 Assume all objects live in the lower 16MB of memory (so that their addresses
16663 can be loaded with the @code{ld24} instruction), and assume all subroutines
16664 are reachable with the @code{bl} instruction.
16665 This is the default.
16666
16667 The addressability of a particular object can be set with the
16668 @code{model} attribute.
16669
16670 @item -mmodel=medium
16671 @opindex mmodel=medium
16672 Assume objects may be anywhere in the 32-bit address space (the compiler
16673 generates @code{seth/add3} instructions to load their addresses), and
16674 assume all subroutines are reachable with the @code{bl} instruction.
16675
16676 @item -mmodel=large
16677 @opindex mmodel=large
16678 Assume objects may be anywhere in the 32-bit address space (the compiler
16679 generates @code{seth/add3} instructions to load their addresses), and
16680 assume subroutines may not be reachable with the @code{bl} instruction
16681 (the compiler generates the much slower @code{seth/add3/jl}
16682 instruction sequence).
16683
16684 @item -msdata=none
16685 @opindex msdata=none
16686 Disable use of the small data area. Variables are put into
16687 one of @samp{.data}, @samp{.bss}, or @samp{.rodata} (unless the
16688 @code{section} attribute has been specified).
16689 This is the default.
16690
16691 The small data area consists of sections @samp{.sdata} and @samp{.sbss}.
16692 Objects may be explicitly put in the small data area with the
16693 @code{section} attribute using one of these sections.
16694
16695 @item -msdata=sdata
16696 @opindex msdata=sdata
16697 Put small global and static data in the small data area, but do not
16698 generate special code to reference them.
16699
16700 @item -msdata=use
16701 @opindex msdata=use
16702 Put small global and static data in the small data area, and generate
16703 special instructions to reference them.
16704
16705 @item -G @var{num}
16706 @opindex G
16707 @cindex smaller data references
16708 Put global and static objects less than or equal to @var{num} bytes
16709 into the small data or BSS sections instead of the normal data or BSS
16710 sections. The default value of @var{num} is 8.
16711 The @option{-msdata} option must be set to one of @samp{sdata} or @samp{use}
16712 for this option to have any effect.
16713
16714 All modules should be compiled with the same @option{-G @var{num}} value.
16715 Compiling with different values of @var{num} may or may not work; if it
16716 doesn't the linker gives an error message---incorrect code is not
16717 generated.
16718
16719 @item -mdebug
16720 @opindex mdebug
16721 Makes the M32R-specific code in the compiler display some statistics
16722 that might help in debugging programs.
16723
16724 @item -malign-loops
16725 @opindex malign-loops
16726 Align all loops to a 32-byte boundary.
16727
16728 @item -mno-align-loops
16729 @opindex mno-align-loops
16730 Do not enforce a 32-byte alignment for loops. This is the default.
16731
16732 @item -missue-rate=@var{number}
16733 @opindex missue-rate=@var{number}
16734 Issue @var{number} instructions per cycle. @var{number} can only be 1
16735 or 2.
16736
16737 @item -mbranch-cost=@var{number}
16738 @opindex mbranch-cost=@var{number}
16739 @var{number} can only be 1 or 2. If it is 1 then branches are
16740 preferred over conditional code, if it is 2, then the opposite applies.
16741
16742 @item -mflush-trap=@var{number}
16743 @opindex mflush-trap=@var{number}
16744 Specifies the trap number to use to flush the cache. The default is
16745 12. Valid numbers are between 0 and 15 inclusive.
16746
16747 @item -mno-flush-trap
16748 @opindex mno-flush-trap
16749 Specifies that the cache cannot be flushed by using a trap.
16750
16751 @item -mflush-func=@var{name}
16752 @opindex mflush-func=@var{name}
16753 Specifies the name of the operating system function to call to flush
16754 the cache. The default is @emph{_flush_cache}, but a function call
16755 is only used if a trap is not available.
16756
16757 @item -mno-flush-func
16758 @opindex mno-flush-func
16759 Indicates that there is no OS function for flushing the cache.
16760
16761 @end table
16762
16763 @node M680x0 Options
16764 @subsection M680x0 Options
16765 @cindex M680x0 options
16766
16767 These are the @samp{-m} options defined for M680x0 and ColdFire processors.
16768 The default settings depend on which architecture was selected when
16769 the compiler was configured; the defaults for the most common choices
16770 are given below.
16771
16772 @table @gcctabopt
16773 @item -march=@var{arch}
16774 @opindex march
16775 Generate code for a specific M680x0 or ColdFire instruction set
16776 architecture. Permissible values of @var{arch} for M680x0
16777 architectures are: @samp{68000}, @samp{68010}, @samp{68020},
16778 @samp{68030}, @samp{68040}, @samp{68060} and @samp{cpu32}. ColdFire
16779 architectures are selected according to Freescale's ISA classification
16780 and the permissible values are: @samp{isaa}, @samp{isaaplus},
16781 @samp{isab} and @samp{isac}.
16782
16783 GCC defines a macro @samp{__mcf@var{arch}__} whenever it is generating
16784 code for a ColdFire target. The @var{arch} in this macro is one of the
16785 @option{-march} arguments given above.
16786
16787 When used together, @option{-march} and @option{-mtune} select code
16788 that runs on a family of similar processors but that is optimized
16789 for a particular microarchitecture.
16790
16791 @item -mcpu=@var{cpu}
16792 @opindex mcpu
16793 Generate code for a specific M680x0 or ColdFire processor.
16794 The M680x0 @var{cpu}s are: @samp{68000}, @samp{68010}, @samp{68020},
16795 @samp{68030}, @samp{68040}, @samp{68060}, @samp{68302}, @samp{68332}
16796 and @samp{cpu32}. The ColdFire @var{cpu}s are given by the table
16797 below, which also classifies the CPUs into families:
16798
16799 @multitable @columnfractions 0.20 0.80
16800 @item @strong{Family} @tab @strong{@samp{-mcpu} arguments}
16801 @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}
16802 @item @samp{5206} @tab @samp{5202} @samp{5204} @samp{5206}
16803 @item @samp{5206e} @tab @samp{5206e}
16804 @item @samp{5208} @tab @samp{5207} @samp{5208}
16805 @item @samp{5211a} @tab @samp{5210a} @samp{5211a}
16806 @item @samp{5213} @tab @samp{5211} @samp{5212} @samp{5213}
16807 @item @samp{5216} @tab @samp{5214} @samp{5216}
16808 @item @samp{52235} @tab @samp{52230} @samp{52231} @samp{52232} @samp{52233} @samp{52234} @samp{52235}
16809 @item @samp{5225} @tab @samp{5224} @samp{5225}
16810 @item @samp{52259} @tab @samp{52252} @samp{52254} @samp{52255} @samp{52256} @samp{52258} @samp{52259}
16811 @item @samp{5235} @tab @samp{5232} @samp{5233} @samp{5234} @samp{5235} @samp{523x}
16812 @item @samp{5249} @tab @samp{5249}
16813 @item @samp{5250} @tab @samp{5250}
16814 @item @samp{5271} @tab @samp{5270} @samp{5271}
16815 @item @samp{5272} @tab @samp{5272}
16816 @item @samp{5275} @tab @samp{5274} @samp{5275}
16817 @item @samp{5282} @tab @samp{5280} @samp{5281} @samp{5282} @samp{528x}
16818 @item @samp{53017} @tab @samp{53011} @samp{53012} @samp{53013} @samp{53014} @samp{53015} @samp{53016} @samp{53017}
16819 @item @samp{5307} @tab @samp{5307}
16820 @item @samp{5329} @tab @samp{5327} @samp{5328} @samp{5329} @samp{532x}
16821 @item @samp{5373} @tab @samp{5372} @samp{5373} @samp{537x}
16822 @item @samp{5407} @tab @samp{5407}
16823 @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}
16824 @end multitable
16825
16826 @option{-mcpu=@var{cpu}} overrides @option{-march=@var{arch}} if
16827 @var{arch} is compatible with @var{cpu}. Other combinations of
16828 @option{-mcpu} and @option{-march} are rejected.
16829
16830 GCC defines the macro @samp{__mcf_cpu_@var{cpu}} when ColdFire target
16831 @var{cpu} is selected. It also defines @samp{__mcf_family_@var{family}},
16832 where the value of @var{family} is given by the table above.
16833
16834 @item -mtune=@var{tune}
16835 @opindex mtune
16836 Tune the code for a particular microarchitecture within the
16837 constraints set by @option{-march} and @option{-mcpu}.
16838 The M680x0 microarchitectures are: @samp{68000}, @samp{68010},
16839 @samp{68020}, @samp{68030}, @samp{68040}, @samp{68060}
16840 and @samp{cpu32}. The ColdFire microarchitectures
16841 are: @samp{cfv1}, @samp{cfv2}, @samp{cfv3}, @samp{cfv4} and @samp{cfv4e}.
16842
16843 You can also use @option{-mtune=68020-40} for code that needs
16844 to run relatively well on 68020, 68030 and 68040 targets.
16845 @option{-mtune=68020-60} is similar but includes 68060 targets
16846 as well. These two options select the same tuning decisions as
16847 @option{-m68020-40} and @option{-m68020-60} respectively.
16848
16849 GCC defines the macros @samp{__mc@var{arch}} and @samp{__mc@var{arch}__}
16850 when tuning for 680x0 architecture @var{arch}. It also defines
16851 @samp{mc@var{arch}} unless either @option{-ansi} or a non-GNU @option{-std}
16852 option is used. If GCC is tuning for a range of architectures,
16853 as selected by @option{-mtune=68020-40} or @option{-mtune=68020-60},
16854 it defines the macros for every architecture in the range.
16855
16856 GCC also defines the macro @samp{__m@var{uarch}__} when tuning for
16857 ColdFire microarchitecture @var{uarch}, where @var{uarch} is one
16858 of the arguments given above.
16859
16860 @item -m68000
16861 @itemx -mc68000
16862 @opindex m68000
16863 @opindex mc68000
16864 Generate output for a 68000. This is the default
16865 when the compiler is configured for 68000-based systems.
16866 It is equivalent to @option{-march=68000}.
16867
16868 Use this option for microcontrollers with a 68000 or EC000 core,
16869 including the 68008, 68302, 68306, 68307, 68322, 68328 and 68356.
16870
16871 @item -m68010
16872 @opindex m68010
16873 Generate output for a 68010. This is the default
16874 when the compiler is configured for 68010-based systems.
16875 It is equivalent to @option{-march=68010}.
16876
16877 @item -m68020
16878 @itemx -mc68020
16879 @opindex m68020
16880 @opindex mc68020
16881 Generate output for a 68020. This is the default
16882 when the compiler is configured for 68020-based systems.
16883 It is equivalent to @option{-march=68020}.
16884
16885 @item -m68030
16886 @opindex m68030
16887 Generate output for a 68030. This is the default when the compiler is
16888 configured for 68030-based systems. It is equivalent to
16889 @option{-march=68030}.
16890
16891 @item -m68040
16892 @opindex m68040
16893 Generate output for a 68040. This is the default when the compiler is
16894 configured for 68040-based systems. It is equivalent to
16895 @option{-march=68040}.
16896
16897 This option inhibits the use of 68881/68882 instructions that have to be
16898 emulated by software on the 68040. Use this option if your 68040 does not
16899 have code to emulate those instructions.
16900
16901 @item -m68060
16902 @opindex m68060
16903 Generate output for a 68060. This is the default when the compiler is
16904 configured for 68060-based systems. It is equivalent to
16905 @option{-march=68060}.
16906
16907 This option inhibits the use of 68020 and 68881/68882 instructions that
16908 have to be emulated by software on the 68060. Use this option if your 68060
16909 does not have code to emulate those instructions.
16910
16911 @item -mcpu32
16912 @opindex mcpu32
16913 Generate output for a CPU32. This is the default
16914 when the compiler is configured for CPU32-based systems.
16915 It is equivalent to @option{-march=cpu32}.
16916
16917 Use this option for microcontrollers with a
16918 CPU32 or CPU32+ core, including the 68330, 68331, 68332, 68333, 68334,
16919 68336, 68340, 68341, 68349 and 68360.
16920
16921 @item -m5200
16922 @opindex m5200
16923 Generate output for a 520X ColdFire CPU@. This is the default
16924 when the compiler is configured for 520X-based systems.
16925 It is equivalent to @option{-mcpu=5206}, and is now deprecated
16926 in favor of that option.
16927
16928 Use this option for microcontroller with a 5200 core, including
16929 the MCF5202, MCF5203, MCF5204 and MCF5206.
16930
16931 @item -m5206e
16932 @opindex m5206e
16933 Generate output for a 5206e ColdFire CPU@. The option is now
16934 deprecated in favor of the equivalent @option{-mcpu=5206e}.
16935
16936 @item -m528x
16937 @opindex m528x
16938 Generate output for a member of the ColdFire 528X family.
16939 The option is now deprecated in favor of the equivalent
16940 @option{-mcpu=528x}.
16941
16942 @item -m5307
16943 @opindex m5307
16944 Generate output for a ColdFire 5307 CPU@. The option is now deprecated
16945 in favor of the equivalent @option{-mcpu=5307}.
16946
16947 @item -m5407
16948 @opindex m5407
16949 Generate output for a ColdFire 5407 CPU@. The option is now deprecated
16950 in favor of the equivalent @option{-mcpu=5407}.
16951
16952 @item -mcfv4e
16953 @opindex mcfv4e
16954 Generate output for a ColdFire V4e family CPU (e.g.@: 547x/548x).
16955 This includes use of hardware floating-point instructions.
16956 The option is equivalent to @option{-mcpu=547x}, and is now
16957 deprecated in favor of that option.
16958
16959 @item -m68020-40
16960 @opindex m68020-40
16961 Generate output for a 68040, without using any of the new instructions.
16962 This results in code that can run relatively efficiently on either a
16963 68020/68881 or a 68030 or a 68040. The generated code does use the
16964 68881 instructions that are emulated on the 68040.
16965
16966 The option is equivalent to @option{-march=68020} @option{-mtune=68020-40}.
16967
16968 @item -m68020-60
16969 @opindex m68020-60
16970 Generate output for a 68060, without using any of the new instructions.
16971 This results in code that can run relatively efficiently on either a
16972 68020/68881 or a 68030 or a 68040. The generated code does use the
16973 68881 instructions that are emulated on the 68060.
16974
16975 The option is equivalent to @option{-march=68020} @option{-mtune=68020-60}.
16976
16977 @item -mhard-float
16978 @itemx -m68881
16979 @opindex mhard-float
16980 @opindex m68881
16981 Generate floating-point instructions. This is the default for 68020
16982 and above, and for ColdFire devices that have an FPU@. It defines the
16983 macro @samp{__HAVE_68881__} on M680x0 targets and @samp{__mcffpu__}
16984 on ColdFire targets.
16985
16986 @item -msoft-float
16987 @opindex msoft-float
16988 Do not generate floating-point instructions; use library calls instead.
16989 This is the default for 68000, 68010, and 68832 targets. It is also
16990 the default for ColdFire devices that have no FPU.
16991
16992 @item -mdiv
16993 @itemx -mno-div
16994 @opindex mdiv
16995 @opindex mno-div
16996 Generate (do not generate) ColdFire hardware divide and remainder
16997 instructions. If @option{-march} is used without @option{-mcpu},
16998 the default is ``on'' for ColdFire architectures and ``off'' for M680x0
16999 architectures. Otherwise, the default is taken from the target CPU
17000 (either the default CPU, or the one specified by @option{-mcpu}). For
17001 example, the default is ``off'' for @option{-mcpu=5206} and ``on'' for
17002 @option{-mcpu=5206e}.
17003
17004 GCC defines the macro @samp{__mcfhwdiv__} when this option is enabled.
17005
17006 @item -mshort
17007 @opindex mshort
17008 Consider type @code{int} to be 16 bits wide, like @code{short int}.
17009 Additionally, parameters passed on the stack are also aligned to a
17010 16-bit boundary even on targets whose API mandates promotion to 32-bit.
17011
17012 @item -mno-short
17013 @opindex mno-short
17014 Do not consider type @code{int} to be 16 bits wide. This is the default.
17015
17016 @item -mnobitfield
17017 @itemx -mno-bitfield
17018 @opindex mnobitfield
17019 @opindex mno-bitfield
17020 Do not use the bit-field instructions. The @option{-m68000}, @option{-mcpu32}
17021 and @option{-m5200} options imply @w{@option{-mnobitfield}}.
17022
17023 @item -mbitfield
17024 @opindex mbitfield
17025 Do use the bit-field instructions. The @option{-m68020} option implies
17026 @option{-mbitfield}. This is the default if you use a configuration
17027 designed for a 68020.
17028
17029 @item -mrtd
17030 @opindex mrtd
17031 Use a different function-calling convention, in which functions
17032 that take a fixed number of arguments return with the @code{rtd}
17033 instruction, which pops their arguments while returning. This
17034 saves one instruction in the caller since there is no need to pop
17035 the arguments there.
17036
17037 This calling convention is incompatible with the one normally
17038 used on Unix, so you cannot use it if you need to call libraries
17039 compiled with the Unix compiler.
17040
17041 Also, you must provide function prototypes for all functions that
17042 take variable numbers of arguments (including @code{printf});
17043 otherwise incorrect code is generated for calls to those
17044 functions.
17045
17046 In addition, seriously incorrect code results if you call a
17047 function with too many arguments. (Normally, extra arguments are
17048 harmlessly ignored.)
17049
17050 The @code{rtd} instruction is supported by the 68010, 68020, 68030,
17051 68040, 68060 and CPU32 processors, but not by the 68000 or 5200.
17052
17053 @item -mno-rtd
17054 @opindex mno-rtd
17055 Do not use the calling conventions selected by @option{-mrtd}.
17056 This is the default.
17057
17058 @item -malign-int
17059 @itemx -mno-align-int
17060 @opindex malign-int
17061 @opindex mno-align-int
17062 Control whether GCC aligns @code{int}, @code{long}, @code{long long},
17063 @code{float}, @code{double}, and @code{long double} variables on a 32-bit
17064 boundary (@option{-malign-int}) or a 16-bit boundary (@option{-mno-align-int}).
17065 Aligning variables on 32-bit boundaries produces code that runs somewhat
17066 faster on processors with 32-bit busses at the expense of more memory.
17067
17068 @strong{Warning:} if you use the @option{-malign-int} switch, GCC
17069 aligns structures containing the above types differently than
17070 most published application binary interface specifications for the m68k.
17071
17072 @item -mpcrel
17073 @opindex mpcrel
17074 Use the pc-relative addressing mode of the 68000 directly, instead of
17075 using a global offset table. At present, this option implies @option{-fpic},
17076 allowing at most a 16-bit offset for pc-relative addressing. @option{-fPIC} is
17077 not presently supported with @option{-mpcrel}, though this could be supported for
17078 68020 and higher processors.
17079
17080 @item -mno-strict-align
17081 @itemx -mstrict-align
17082 @opindex mno-strict-align
17083 @opindex mstrict-align
17084 Do not (do) assume that unaligned memory references are handled by
17085 the system.
17086
17087 @item -msep-data
17088 Generate code that allows the data segment to be located in a different
17089 area of memory from the text segment. This allows for execute-in-place in
17090 an environment without virtual memory management. This option implies
17091 @option{-fPIC}.
17092
17093 @item -mno-sep-data
17094 Generate code that assumes that the data segment follows the text segment.
17095 This is the default.
17096
17097 @item -mid-shared-library
17098 Generate code that supports shared libraries via the library ID method.
17099 This allows for execute-in-place and shared libraries in an environment
17100 without virtual memory management. This option implies @option{-fPIC}.
17101
17102 @item -mno-id-shared-library
17103 Generate code that doesn't assume ID-based shared libraries are being used.
17104 This is the default.
17105
17106 @item -mshared-library-id=n
17107 Specifies the identification number of the ID-based shared library being
17108 compiled. Specifying a value of 0 generates more compact code; specifying
17109 other values forces the allocation of that number to the current
17110 library, but is no more space- or time-efficient than omitting this option.
17111
17112 @item -mxgot
17113 @itemx -mno-xgot
17114 @opindex mxgot
17115 @opindex mno-xgot
17116 When generating position-independent code for ColdFire, generate code
17117 that works if the GOT has more than 8192 entries. This code is
17118 larger and slower than code generated without this option. On M680x0
17119 processors, this option is not needed; @option{-fPIC} suffices.
17120
17121 GCC normally uses a single instruction to load values from the GOT@.
17122 While this is relatively efficient, it only works if the GOT
17123 is smaller than about 64k. Anything larger causes the linker
17124 to report an error such as:
17125
17126 @cindex relocation truncated to fit (ColdFire)
17127 @smallexample
17128 relocation truncated to fit: R_68K_GOT16O foobar
17129 @end smallexample
17130
17131 If this happens, you should recompile your code with @option{-mxgot}.
17132 It should then work with very large GOTs. However, code generated with
17133 @option{-mxgot} is less efficient, since it takes 4 instructions to fetch
17134 the value of a global symbol.
17135
17136 Note that some linkers, including newer versions of the GNU linker,
17137 can create multiple GOTs and sort GOT entries. If you have such a linker,
17138 you should only need to use @option{-mxgot} when compiling a single
17139 object file that accesses more than 8192 GOT entries. Very few do.
17140
17141 These options have no effect unless GCC is generating
17142 position-independent code.
17143
17144 @end table
17145
17146 @node MCore Options
17147 @subsection MCore Options
17148 @cindex MCore options
17149
17150 These are the @samp{-m} options defined for the Motorola M*Core
17151 processors.
17152
17153 @table @gcctabopt
17154
17155 @item -mhardlit
17156 @itemx -mno-hardlit
17157 @opindex mhardlit
17158 @opindex mno-hardlit
17159 Inline constants into the code stream if it can be done in two
17160 instructions or less.
17161
17162 @item -mdiv
17163 @itemx -mno-div
17164 @opindex mdiv
17165 @opindex mno-div
17166 Use the divide instruction. (Enabled by default).
17167
17168 @item -mrelax-immediate
17169 @itemx -mno-relax-immediate
17170 @opindex mrelax-immediate
17171 @opindex mno-relax-immediate
17172 Allow arbitrary-sized immediates in bit operations.
17173
17174 @item -mwide-bitfields
17175 @itemx -mno-wide-bitfields
17176 @opindex mwide-bitfields
17177 @opindex mno-wide-bitfields
17178 Always treat bit-fields as @code{int}-sized.
17179
17180 @item -m4byte-functions
17181 @itemx -mno-4byte-functions
17182 @opindex m4byte-functions
17183 @opindex mno-4byte-functions
17184 Force all functions to be aligned to a 4-byte boundary.
17185
17186 @item -mcallgraph-data
17187 @itemx -mno-callgraph-data
17188 @opindex mcallgraph-data
17189 @opindex mno-callgraph-data
17190 Emit callgraph information.
17191
17192 @item -mslow-bytes
17193 @itemx -mno-slow-bytes
17194 @opindex mslow-bytes
17195 @opindex mno-slow-bytes
17196 Prefer word access when reading byte quantities.
17197
17198 @item -mlittle-endian
17199 @itemx -mbig-endian
17200 @opindex mlittle-endian
17201 @opindex mbig-endian
17202 Generate code for a little-endian target.
17203
17204 @item -m210
17205 @itemx -m340
17206 @opindex m210
17207 @opindex m340
17208 Generate code for the 210 processor.
17209
17210 @item -mno-lsim
17211 @opindex mno-lsim
17212 Assume that runtime support has been provided and so omit the
17213 simulator library (@file{libsim.a)} from the linker command line.
17214
17215 @item -mstack-increment=@var{size}
17216 @opindex mstack-increment
17217 Set the maximum amount for a single stack increment operation. Large
17218 values can increase the speed of programs that contain functions
17219 that need a large amount of stack space, but they can also trigger a
17220 segmentation fault if the stack is extended too much. The default
17221 value is 0x1000.
17222
17223 @end table
17224
17225 @node MeP Options
17226 @subsection MeP Options
17227 @cindex MeP options
17228
17229 @table @gcctabopt
17230
17231 @item -mabsdiff
17232 @opindex mabsdiff
17233 Enables the @code{abs} instruction, which is the absolute difference
17234 between two registers.
17235
17236 @item -mall-opts
17237 @opindex mall-opts
17238 Enables all the optional instructions---average, multiply, divide, bit
17239 operations, leading zero, absolute difference, min/max, clip, and
17240 saturation.
17241
17242
17243 @item -maverage
17244 @opindex maverage
17245 Enables the @code{ave} instruction, which computes the average of two
17246 registers.
17247
17248 @item -mbased=@var{n}
17249 @opindex mbased=
17250 Variables of size @var{n} bytes or smaller are placed in the
17251 @code{.based} section by default. Based variables use the @code{$tp}
17252 register as a base register, and there is a 128-byte limit to the
17253 @code{.based} section.
17254
17255 @item -mbitops
17256 @opindex mbitops
17257 Enables the bit operation instructions---bit test (@code{btstm}), set
17258 (@code{bsetm}), clear (@code{bclrm}), invert (@code{bnotm}), and
17259 test-and-set (@code{tas}).
17260
17261 @item -mc=@var{name}
17262 @opindex mc=
17263 Selects which section constant data is placed in. @var{name} may
17264 be @code{tiny}, @code{near}, or @code{far}.
17265
17266 @item -mclip
17267 @opindex mclip
17268 Enables the @code{clip} instruction. Note that @code{-mclip} is not
17269 useful unless you also provide @code{-mminmax}.
17270
17271 @item -mconfig=@var{name}
17272 @opindex mconfig=
17273 Selects one of the built-in core configurations. Each MeP chip has
17274 one or more modules in it; each module has a core CPU and a variety of
17275 coprocessors, optional instructions, and peripherals. The
17276 @code{MeP-Integrator} tool, not part of GCC, provides these
17277 configurations through this option; using this option is the same as
17278 using all the corresponding command-line options. The default
17279 configuration is @code{default}.
17280
17281 @item -mcop
17282 @opindex mcop
17283 Enables the coprocessor instructions. By default, this is a 32-bit
17284 coprocessor. Note that the coprocessor is normally enabled via the
17285 @code{-mconfig=} option.
17286
17287 @item -mcop32
17288 @opindex mcop32
17289 Enables the 32-bit coprocessor's instructions.
17290
17291 @item -mcop64
17292 @opindex mcop64
17293 Enables the 64-bit coprocessor's instructions.
17294
17295 @item -mivc2
17296 @opindex mivc2
17297 Enables IVC2 scheduling. IVC2 is a 64-bit VLIW coprocessor.
17298
17299 @item -mdc
17300 @opindex mdc
17301 Causes constant variables to be placed in the @code{.near} section.
17302
17303 @item -mdiv
17304 @opindex mdiv
17305 Enables the @code{div} and @code{divu} instructions.
17306
17307 @item -meb
17308 @opindex meb
17309 Generate big-endian code.
17310
17311 @item -mel
17312 @opindex mel
17313 Generate little-endian code.
17314
17315 @item -mio-volatile
17316 @opindex mio-volatile
17317 Tells the compiler that any variable marked with the @code{io}
17318 attribute is to be considered volatile.
17319
17320 @item -ml
17321 @opindex ml
17322 Causes variables to be assigned to the @code{.far} section by default.
17323
17324 @item -mleadz
17325 @opindex mleadz
17326 Enables the @code{leadz} (leading zero) instruction.
17327
17328 @item -mm
17329 @opindex mm
17330 Causes variables to be assigned to the @code{.near} section by default.
17331
17332 @item -mminmax
17333 @opindex mminmax
17334 Enables the @code{min} and @code{max} instructions.
17335
17336 @item -mmult
17337 @opindex mmult
17338 Enables the multiplication and multiply-accumulate instructions.
17339
17340 @item -mno-opts
17341 @opindex mno-opts
17342 Disables all the optional instructions enabled by @code{-mall-opts}.
17343
17344 @item -mrepeat
17345 @opindex mrepeat
17346 Enables the @code{repeat} and @code{erepeat} instructions, used for
17347 low-overhead looping.
17348
17349 @item -ms
17350 @opindex ms
17351 Causes all variables to default to the @code{.tiny} section. Note
17352 that there is a 65536-byte limit to this section. Accesses to these
17353 variables use the @code{%gp} base register.
17354
17355 @item -msatur
17356 @opindex msatur
17357 Enables the saturation instructions. Note that the compiler does not
17358 currently generate these itself, but this option is included for
17359 compatibility with other tools, like @code{as}.
17360
17361 @item -msdram
17362 @opindex msdram
17363 Link the SDRAM-based runtime instead of the default ROM-based runtime.
17364
17365 @item -msim
17366 @opindex msim
17367 Link the simulator run-time libraries.
17368
17369 @item -msimnovec
17370 @opindex msimnovec
17371 Link the simulator runtime libraries, excluding built-in support
17372 for reset and exception vectors and tables.
17373
17374 @item -mtf
17375 @opindex mtf
17376 Causes all functions to default to the @code{.far} section. Without
17377 this option, functions default to the @code{.near} section.
17378
17379 @item -mtiny=@var{n}
17380 @opindex mtiny=
17381 Variables that are @var{n} bytes or smaller are allocated to the
17382 @code{.tiny} section. These variables use the @code{$gp} base
17383 register. The default for this option is 4, but note that there's a
17384 65536-byte limit to the @code{.tiny} section.
17385
17386 @end table
17387
17388 @node MicroBlaze Options
17389 @subsection MicroBlaze Options
17390 @cindex MicroBlaze Options
17391
17392 @table @gcctabopt
17393
17394 @item -msoft-float
17395 @opindex msoft-float
17396 Use software emulation for floating point (default).
17397
17398 @item -mhard-float
17399 @opindex mhard-float
17400 Use hardware floating-point instructions.
17401
17402 @item -mmemcpy
17403 @opindex mmemcpy
17404 Do not optimize block moves, use @code{memcpy}.
17405
17406 @item -mno-clearbss
17407 @opindex mno-clearbss
17408 This option is deprecated. Use @option{-fno-zero-initialized-in-bss} instead.
17409
17410 @item -mcpu=@var{cpu-type}
17411 @opindex mcpu=
17412 Use features of, and schedule code for, the given CPU.
17413 Supported values are in the format @samp{v@var{X}.@var{YY}.@var{Z}},
17414 where @var{X} is a major version, @var{YY} is the minor version, and
17415 @var{Z} is compatibility code. Example values are @samp{v3.00.a},
17416 @samp{v4.00.b}, @samp{v5.00.a}, @samp{v5.00.b}, @samp{v5.00.b}, @samp{v6.00.a}.
17417
17418 @item -mxl-soft-mul
17419 @opindex mxl-soft-mul
17420 Use software multiply emulation (default).
17421
17422 @item -mxl-soft-div
17423 @opindex mxl-soft-div
17424 Use software emulation for divides (default).
17425
17426 @item -mxl-barrel-shift
17427 @opindex mxl-barrel-shift
17428 Use the hardware barrel shifter.
17429
17430 @item -mxl-pattern-compare
17431 @opindex mxl-pattern-compare
17432 Use pattern compare instructions.
17433
17434 @item -msmall-divides
17435 @opindex msmall-divides
17436 Use table lookup optimization for small signed integer divisions.
17437
17438 @item -mxl-stack-check
17439 @opindex mxl-stack-check
17440 This option is deprecated. Use @option{-fstack-check} instead.
17441
17442 @item -mxl-gp-opt
17443 @opindex mxl-gp-opt
17444 Use GP-relative @code{.sdata}/@code{.sbss} sections.
17445
17446 @item -mxl-multiply-high
17447 @opindex mxl-multiply-high
17448 Use multiply high instructions for high part of 32x32 multiply.
17449
17450 @item -mxl-float-convert
17451 @opindex mxl-float-convert
17452 Use hardware floating-point conversion instructions.
17453
17454 @item -mxl-float-sqrt
17455 @opindex mxl-float-sqrt
17456 Use hardware floating-point square root instruction.
17457
17458 @item -mbig-endian
17459 @opindex mbig-endian
17460 Generate code for a big-endian target.
17461
17462 @item -mlittle-endian
17463 @opindex mlittle-endian
17464 Generate code for a little-endian target.
17465
17466 @item -mxl-reorder
17467 @opindex mxl-reorder
17468 Use reorder instructions (swap and byte reversed load/store).
17469
17470 @item -mxl-mode-@var{app-model}
17471 Select application model @var{app-model}. Valid models are
17472 @table @samp
17473 @item executable
17474 normal executable (default), uses startup code @file{crt0.o}.
17475
17476 @item xmdstub
17477 for use with Xilinx Microprocessor Debugger (XMD) based
17478 software intrusive debug agent called xmdstub. This uses startup file
17479 @file{crt1.o} and sets the start address of the program to 0x800.
17480
17481 @item bootstrap
17482 for applications that are loaded using a bootloader.
17483 This model uses startup file @file{crt2.o} which does not contain a processor
17484 reset vector handler. This is suitable for transferring control on a
17485 processor reset to the bootloader rather than the application.
17486
17487 @item novectors
17488 for applications that do not require any of the
17489 MicroBlaze vectors. This option may be useful for applications running
17490 within a monitoring application. This model uses @file{crt3.o} as a startup file.
17491 @end table
17492
17493 Option @option{-xl-mode-@var{app-model}} is a deprecated alias for
17494 @option{-mxl-mode-@var{app-model}}.
17495
17496 @end table
17497
17498 @node MIPS Options
17499 @subsection MIPS Options
17500 @cindex MIPS options
17501
17502 @table @gcctabopt
17503
17504 @item -EB
17505 @opindex EB
17506 Generate big-endian code.
17507
17508 @item -EL
17509 @opindex EL
17510 Generate little-endian code. This is the default for @samp{mips*el-*-*}
17511 configurations.
17512
17513 @item -march=@var{arch}
17514 @opindex march
17515 Generate code that runs on @var{arch}, which can be the name of a
17516 generic MIPS ISA, or the name of a particular processor.
17517 The ISA names are:
17518 @samp{mips1}, @samp{mips2}, @samp{mips3}, @samp{mips4},
17519 @samp{mips32}, @samp{mips32r2}, @samp{mips32r3}, @samp{mips32r5},
17520 @samp{mips64}, @samp{mips64r2}, @samp{mips64r3} and @samp{mips64r5}.
17521 The processor names are:
17522 @samp{4kc}, @samp{4km}, @samp{4kp}, @samp{4ksc},
17523 @samp{4kec}, @samp{4kem}, @samp{4kep}, @samp{4ksd},
17524 @samp{5kc}, @samp{5kf},
17525 @samp{20kc},
17526 @samp{24kc}, @samp{24kf2_1}, @samp{24kf1_1},
17527 @samp{24kec}, @samp{24kef2_1}, @samp{24kef1_1},
17528 @samp{34kc}, @samp{34kf2_1}, @samp{34kf1_1}, @samp{34kn},
17529 @samp{74kc}, @samp{74kf2_1}, @samp{74kf1_1}, @samp{74kf3_2},
17530 @samp{1004kc}, @samp{1004kf2_1}, @samp{1004kf1_1},
17531 @samp{loongson2e}, @samp{loongson2f}, @samp{loongson3a},
17532 @samp{m4k},
17533 @samp{m14k}, @samp{m14kc}, @samp{m14ke}, @samp{m14kec},
17534 @samp{octeon}, @samp{octeon+}, @samp{octeon2},
17535 @samp{orion},
17536 @samp{p5600},
17537 @samp{r2000}, @samp{r3000}, @samp{r3900}, @samp{r4000}, @samp{r4400},
17538 @samp{r4600}, @samp{r4650}, @samp{r4700}, @samp{r6000}, @samp{r8000},
17539 @samp{rm7000}, @samp{rm9000},
17540 @samp{r10000}, @samp{r12000}, @samp{r14000}, @samp{r16000},
17541 @samp{sb1},
17542 @samp{sr71000},
17543 @samp{vr4100}, @samp{vr4111}, @samp{vr4120}, @samp{vr4130}, @samp{vr4300},
17544 @samp{vr5000}, @samp{vr5400}, @samp{vr5500},
17545 @samp{xlr} and @samp{xlp}.
17546 The special value @samp{from-abi} selects the
17547 most compatible architecture for the selected ABI (that is,
17548 @samp{mips1} for 32-bit ABIs and @samp{mips3} for 64-bit ABIs)@.
17549
17550 The native Linux/GNU toolchain also supports the value @samp{native},
17551 which selects the best architecture option for the host processor.
17552 @option{-march=native} has no effect if GCC does not recognize
17553 the processor.
17554
17555 In processor names, a final @samp{000} can be abbreviated as @samp{k}
17556 (for example, @option{-march=r2k}). Prefixes are optional, and
17557 @samp{vr} may be written @samp{r}.
17558
17559 Names of the form @samp{@var{n}f2_1} refer to processors with
17560 FPUs clocked at half the rate of the core, names of the form
17561 @samp{@var{n}f1_1} refer to processors with FPUs clocked at the same
17562 rate as the core, and names of the form @samp{@var{n}f3_2} refer to
17563 processors with FPUs clocked a ratio of 3:2 with respect to the core.
17564 For compatibility reasons, @samp{@var{n}f} is accepted as a synonym
17565 for @samp{@var{n}f2_1} while @samp{@var{n}x} and @samp{@var{b}fx} are
17566 accepted as synonyms for @samp{@var{n}f1_1}.
17567
17568 GCC defines two macros based on the value of this option. The first
17569 is @samp{_MIPS_ARCH}, which gives the name of target architecture, as
17570 a string. The second has the form @samp{_MIPS_ARCH_@var{foo}},
17571 where @var{foo} is the capitalized value of @samp{_MIPS_ARCH}@.
17572 For example, @option{-march=r2000} sets @samp{_MIPS_ARCH}
17573 to @samp{"r2000"} and defines the macro @samp{_MIPS_ARCH_R2000}.
17574
17575 Note that the @samp{_MIPS_ARCH} macro uses the processor names given
17576 above. In other words, it has the full prefix and does not
17577 abbreviate @samp{000} as @samp{k}. In the case of @samp{from-abi},
17578 the macro names the resolved architecture (either @samp{"mips1"} or
17579 @samp{"mips3"}). It names the default architecture when no
17580 @option{-march} option is given.
17581
17582 @item -mtune=@var{arch}
17583 @opindex mtune
17584 Optimize for @var{arch}. Among other things, this option controls
17585 the way instructions are scheduled, and the perceived cost of arithmetic
17586 operations. The list of @var{arch} values is the same as for
17587 @option{-march}.
17588
17589 When this option is not used, GCC optimizes for the processor
17590 specified by @option{-march}. By using @option{-march} and
17591 @option{-mtune} together, it is possible to generate code that
17592 runs on a family of processors, but optimize the code for one
17593 particular member of that family.
17594
17595 @option{-mtune} defines the macros @samp{_MIPS_TUNE} and
17596 @samp{_MIPS_TUNE_@var{foo}}, which work in the same way as the
17597 @option{-march} ones described above.
17598
17599 @item -mips1
17600 @opindex mips1
17601 Equivalent to @option{-march=mips1}.
17602
17603 @item -mips2
17604 @opindex mips2
17605 Equivalent to @option{-march=mips2}.
17606
17607 @item -mips3
17608 @opindex mips3
17609 Equivalent to @option{-march=mips3}.
17610
17611 @item -mips4
17612 @opindex mips4
17613 Equivalent to @option{-march=mips4}.
17614
17615 @item -mips32
17616 @opindex mips32
17617 Equivalent to @option{-march=mips32}.
17618
17619 @item -mips32r3
17620 @opindex mips32r3
17621 Equivalent to @option{-march=mips32r3}.
17622
17623 @item -mips32r5
17624 @opindex mips32r5
17625 Equivalent to @option{-march=mips32r5}.
17626
17627 @item -mips64
17628 @opindex mips64
17629 Equivalent to @option{-march=mips64}.
17630
17631 @item -mips64r2
17632 @opindex mips64r2
17633 Equivalent to @option{-march=mips64r2}.
17634
17635 @item -mips64r3
17636 @opindex mips64r3
17637 Equivalent to @option{-march=mips64r3}.
17638
17639 @item -mips64r5
17640 @opindex mips64r5
17641 Equivalent to @option{-march=mips64r5}.
17642
17643 @item -mips16
17644 @itemx -mno-mips16
17645 @opindex mips16
17646 @opindex mno-mips16
17647 Generate (do not generate) MIPS16 code. If GCC is targeting a
17648 MIPS32 or MIPS64 architecture, it makes use of the MIPS16e ASE@.
17649
17650 MIPS16 code generation can also be controlled on a per-function basis
17651 by means of @code{mips16} and @code{nomips16} attributes.
17652 @xref{Function Attributes}, for more information.
17653
17654 @item -mflip-mips16
17655 @opindex mflip-mips16
17656 Generate MIPS16 code on alternating functions. This option is provided
17657 for regression testing of mixed MIPS16/non-MIPS16 code generation, and is
17658 not intended for ordinary use in compiling user code.
17659
17660 @item -minterlink-compressed
17661 @item -mno-interlink-compressed
17662 @opindex minterlink-compressed
17663 @opindex mno-interlink-compressed
17664 Require (do not require) that code using the standard (uncompressed) MIPS ISA
17665 be link-compatible with MIPS16 and microMIPS code, and vice versa.
17666
17667 For example, code using the standard ISA encoding cannot jump directly
17668 to MIPS16 or microMIPS code; it must either use a call or an indirect jump.
17669 @option{-minterlink-compressed} therefore disables direct jumps unless GCC
17670 knows that the target of the jump is not compressed.
17671
17672 @item -minterlink-mips16
17673 @itemx -mno-interlink-mips16
17674 @opindex minterlink-mips16
17675 @opindex mno-interlink-mips16
17676 Aliases of @option{-minterlink-compressed} and
17677 @option{-mno-interlink-compressed}. These options predate the microMIPS ASE
17678 and are retained for backwards compatibility.
17679
17680 @item -mabi=32
17681 @itemx -mabi=o64
17682 @itemx -mabi=n32
17683 @itemx -mabi=64
17684 @itemx -mabi=eabi
17685 @opindex mabi=32
17686 @opindex mabi=o64
17687 @opindex mabi=n32
17688 @opindex mabi=64
17689 @opindex mabi=eabi
17690 Generate code for the given ABI@.
17691
17692 Note that the EABI has a 32-bit and a 64-bit variant. GCC normally
17693 generates 64-bit code when you select a 64-bit architecture, but you
17694 can use @option{-mgp32} to get 32-bit code instead.
17695
17696 For information about the O64 ABI, see
17697 @uref{http://gcc.gnu.org/@/projects/@/mipso64-abi.html}.
17698
17699 GCC supports a variant of the o32 ABI in which floating-point registers
17700 are 64 rather than 32 bits wide. You can select this combination with
17701 @option{-mabi=32} @option{-mfp64}. This ABI relies on the @code{mthc1}
17702 and @code{mfhc1} instructions and is therefore only supported for
17703 MIPS32R2, MIPS32R3 and MIPS32R5 processors.
17704
17705 The register assignments for arguments and return values remain the
17706 same, but each scalar value is passed in a single 64-bit register
17707 rather than a pair of 32-bit registers. For example, scalar
17708 floating-point values are returned in @samp{$f0} only, not a
17709 @samp{$f0}/@samp{$f1} pair. The set of call-saved registers also
17710 remains the same, but all 64 bits are saved.
17711
17712 @item -mabicalls
17713 @itemx -mno-abicalls
17714 @opindex mabicalls
17715 @opindex mno-abicalls
17716 Generate (do not generate) code that is suitable for SVR4-style
17717 dynamic objects. @option{-mabicalls} is the default for SVR4-based
17718 systems.
17719
17720 @item -mshared
17721 @itemx -mno-shared
17722 Generate (do not generate) code that is fully position-independent,
17723 and that can therefore be linked into shared libraries. This option
17724 only affects @option{-mabicalls}.
17725
17726 All @option{-mabicalls} code has traditionally been position-independent,
17727 regardless of options like @option{-fPIC} and @option{-fpic}. However,
17728 as an extension, the GNU toolchain allows executables to use absolute
17729 accesses for locally-binding symbols. It can also use shorter GP
17730 initialization sequences and generate direct calls to locally-defined
17731 functions. This mode is selected by @option{-mno-shared}.
17732
17733 @option{-mno-shared} depends on binutils 2.16 or higher and generates
17734 objects that can only be linked by the GNU linker. However, the option
17735 does not affect the ABI of the final executable; it only affects the ABI
17736 of relocatable objects. Using @option{-mno-shared} generally makes
17737 executables both smaller and quicker.
17738
17739 @option{-mshared} is the default.
17740
17741 @item -mplt
17742 @itemx -mno-plt
17743 @opindex mplt
17744 @opindex mno-plt
17745 Assume (do not assume) that the static and dynamic linkers
17746 support PLTs and copy relocations. This option only affects
17747 @option{-mno-shared -mabicalls}. For the n64 ABI, this option
17748 has no effect without @option{-msym32}.
17749
17750 You can make @option{-mplt} the default by configuring
17751 GCC with @option{--with-mips-plt}. The default is
17752 @option{-mno-plt} otherwise.
17753
17754 @item -mxgot
17755 @itemx -mno-xgot
17756 @opindex mxgot
17757 @opindex mno-xgot
17758 Lift (do not lift) the usual restrictions on the size of the global
17759 offset table.
17760
17761 GCC normally uses a single instruction to load values from the GOT@.
17762 While this is relatively efficient, it only works if the GOT
17763 is smaller than about 64k. Anything larger causes the linker
17764 to report an error such as:
17765
17766 @cindex relocation truncated to fit (MIPS)
17767 @smallexample
17768 relocation truncated to fit: R_MIPS_GOT16 foobar
17769 @end smallexample
17770
17771 If this happens, you should recompile your code with @option{-mxgot}.
17772 This works with very large GOTs, although the code is also
17773 less efficient, since it takes three instructions to fetch the
17774 value of a global symbol.
17775
17776 Note that some linkers can create multiple GOTs. If you have such a
17777 linker, you should only need to use @option{-mxgot} when a single object
17778 file accesses more than 64k's worth of GOT entries. Very few do.
17779
17780 These options have no effect unless GCC is generating position
17781 independent code.
17782
17783 @item -mgp32
17784 @opindex mgp32
17785 Assume that general-purpose registers are 32 bits wide.
17786
17787 @item -mgp64
17788 @opindex mgp64
17789 Assume that general-purpose registers are 64 bits wide.
17790
17791 @item -mfp32
17792 @opindex mfp32
17793 Assume that floating-point registers are 32 bits wide.
17794
17795 @item -mfp64
17796 @opindex mfp64
17797 Assume that floating-point registers are 64 bits wide.
17798
17799 @item -mhard-float
17800 @opindex mhard-float
17801 Use floating-point coprocessor instructions.
17802
17803 @item -msoft-float
17804 @opindex msoft-float
17805 Do not use floating-point coprocessor instructions. Implement
17806 floating-point calculations using library calls instead.
17807
17808 @item -mno-float
17809 @opindex mno-float
17810 Equivalent to @option{-msoft-float}, but additionally asserts that the
17811 program being compiled does not perform any floating-point operations.
17812 This option is presently supported only by some bare-metal MIPS
17813 configurations, where it may select a special set of libraries
17814 that lack all floating-point support (including, for example, the
17815 floating-point @code{printf} formats).
17816 If code compiled with @code{-mno-float} accidentally contains
17817 floating-point operations, it is likely to suffer a link-time
17818 or run-time failure.
17819
17820 @item -msingle-float
17821 @opindex msingle-float
17822 Assume that the floating-point coprocessor only supports single-precision
17823 operations.
17824
17825 @item -mdouble-float
17826 @opindex mdouble-float
17827 Assume that the floating-point coprocessor supports double-precision
17828 operations. This is the default.
17829
17830 @item -mabs=2008
17831 @itemx -mabs=legacy
17832 @opindex mabs=2008
17833 @opindex mabs=legacy
17834 These options control the treatment of the special not-a-number (NaN)
17835 IEEE 754 floating-point data with the @code{abs.@i{fmt}} and
17836 @code{neg.@i{fmt}} machine instructions.
17837
17838 By default or when the @option{-mabs=legacy} is used the legacy
17839 treatment is selected. In this case these instructions are considered
17840 arithmetic and avoided where correct operation is required and the
17841 input operand might be a NaN. A longer sequence of instructions that
17842 manipulate the sign bit of floating-point datum manually is used
17843 instead unless the @option{-ffinite-math-only} option has also been
17844 specified.
17845
17846 The @option{-mabs=2008} option selects the IEEE 754-2008 treatment. In
17847 this case these instructions are considered non-arithmetic and therefore
17848 operating correctly in all cases, including in particular where the
17849 input operand is a NaN. These instructions are therefore always used
17850 for the respective operations.
17851
17852 @item -mnan=2008
17853 @itemx -mnan=legacy
17854 @opindex mnan=2008
17855 @opindex mnan=legacy
17856 These options control the encoding of the special not-a-number (NaN)
17857 IEEE 754 floating-point data.
17858
17859 The @option{-mnan=legacy} option selects the legacy encoding. In this
17860 case quiet NaNs (qNaNs) are denoted by the first bit of their trailing
17861 significand field being 0, whereas signalling NaNs (sNaNs) are denoted
17862 by the first bit of their trailing significand field being 1.
17863
17864 The @option{-mnan=2008} option selects the IEEE 754-2008 encoding. In
17865 this case qNaNs are denoted by the first bit of their trailing
17866 significand field being 1, whereas sNaNs are denoted by the first bit of
17867 their trailing significand field being 0.
17868
17869 The default is @option{-mnan=legacy} unless GCC has been configured with
17870 @option{--with-nan=2008}.
17871
17872 @item -mllsc
17873 @itemx -mno-llsc
17874 @opindex mllsc
17875 @opindex mno-llsc
17876 Use (do not use) @samp{ll}, @samp{sc}, and @samp{sync} instructions to
17877 implement atomic memory built-in functions. When neither option is
17878 specified, GCC uses the instructions if the target architecture
17879 supports them.
17880
17881 @option{-mllsc} is useful if the runtime environment can emulate the
17882 instructions and @option{-mno-llsc} can be useful when compiling for
17883 nonstandard ISAs. You can make either option the default by
17884 configuring GCC with @option{--with-llsc} and @option{--without-llsc}
17885 respectively. @option{--with-llsc} is the default for some
17886 configurations; see the installation documentation for details.
17887
17888 @item -mdsp
17889 @itemx -mno-dsp
17890 @opindex mdsp
17891 @opindex mno-dsp
17892 Use (do not use) revision 1 of the MIPS DSP ASE@.
17893 @xref{MIPS DSP Built-in Functions}. This option defines the
17894 preprocessor macro @samp{__mips_dsp}. It also defines
17895 @samp{__mips_dsp_rev} to 1.
17896
17897 @item -mdspr2
17898 @itemx -mno-dspr2
17899 @opindex mdspr2
17900 @opindex mno-dspr2
17901 Use (do not use) revision 2 of the MIPS DSP ASE@.
17902 @xref{MIPS DSP Built-in Functions}. This option defines the
17903 preprocessor macros @samp{__mips_dsp} and @samp{__mips_dspr2}.
17904 It also defines @samp{__mips_dsp_rev} to 2.
17905
17906 @item -msmartmips
17907 @itemx -mno-smartmips
17908 @opindex msmartmips
17909 @opindex mno-smartmips
17910 Use (do not use) the MIPS SmartMIPS ASE.
17911
17912 @item -mpaired-single
17913 @itemx -mno-paired-single
17914 @opindex mpaired-single
17915 @opindex mno-paired-single
17916 Use (do not use) paired-single floating-point instructions.
17917 @xref{MIPS Paired-Single Support}. This option requires
17918 hardware floating-point support to be enabled.
17919
17920 @item -mdmx
17921 @itemx -mno-mdmx
17922 @opindex mdmx
17923 @opindex mno-mdmx
17924 Use (do not use) MIPS Digital Media Extension instructions.
17925 This option can only be used when generating 64-bit code and requires
17926 hardware floating-point support to be enabled.
17927
17928 @item -mips3d
17929 @itemx -mno-mips3d
17930 @opindex mips3d
17931 @opindex mno-mips3d
17932 Use (do not use) the MIPS-3D ASE@. @xref{MIPS-3D Built-in Functions}.
17933 The option @option{-mips3d} implies @option{-mpaired-single}.
17934
17935 @item -mmicromips
17936 @itemx -mno-micromips
17937 @opindex mmicromips
17938 @opindex mno-mmicromips
17939 Generate (do not generate) microMIPS code.
17940
17941 MicroMIPS code generation can also be controlled on a per-function basis
17942 by means of @code{micromips} and @code{nomicromips} attributes.
17943 @xref{Function Attributes}, for more information.
17944
17945 @item -mmt
17946 @itemx -mno-mt
17947 @opindex mmt
17948 @opindex mno-mt
17949 Use (do not use) MT Multithreading instructions.
17950
17951 @item -mmcu
17952 @itemx -mno-mcu
17953 @opindex mmcu
17954 @opindex mno-mcu
17955 Use (do not use) the MIPS MCU ASE instructions.
17956
17957 @item -meva
17958 @itemx -mno-eva
17959 @opindex meva
17960 @opindex mno-eva
17961 Use (do not use) the MIPS Enhanced Virtual Addressing instructions.
17962
17963 @item -mvirt
17964 @itemx -mno-virt
17965 @opindex mvirt
17966 @opindex mno-virt
17967 Use (do not use) the MIPS Virtualization Application Specific instructions.
17968
17969 @item -mxpa
17970 @itemx -mno-xpa
17971 @opindex mxpa
17972 @opindex mno-xpa
17973 Use (do not use) the MIPS eXtended Physical Address (XPA) instructions.
17974
17975 @item -mlong64
17976 @opindex mlong64
17977 Force @code{long} types to be 64 bits wide. See @option{-mlong32} for
17978 an explanation of the default and the way that the pointer size is
17979 determined.
17980
17981 @item -mlong32
17982 @opindex mlong32
17983 Force @code{long}, @code{int}, and pointer types to be 32 bits wide.
17984
17985 The default size of @code{int}s, @code{long}s and pointers depends on
17986 the ABI@. All the supported ABIs use 32-bit @code{int}s. The n64 ABI
17987 uses 64-bit @code{long}s, as does the 64-bit EABI; the others use
17988 32-bit @code{long}s. Pointers are the same size as @code{long}s,
17989 or the same size as integer registers, whichever is smaller.
17990
17991 @item -msym32
17992 @itemx -mno-sym32
17993 @opindex msym32
17994 @opindex mno-sym32
17995 Assume (do not assume) that all symbols have 32-bit values, regardless
17996 of the selected ABI@. This option is useful in combination with
17997 @option{-mabi=64} and @option{-mno-abicalls} because it allows GCC
17998 to generate shorter and faster references to symbolic addresses.
17999
18000 @item -G @var{num}
18001 @opindex G
18002 Put definitions of externally-visible data in a small data section
18003 if that data is no bigger than @var{num} bytes. GCC can then generate
18004 more efficient accesses to the data; see @option{-mgpopt} for details.
18005
18006 The default @option{-G} option depends on the configuration.
18007
18008 @item -mlocal-sdata
18009 @itemx -mno-local-sdata
18010 @opindex mlocal-sdata
18011 @opindex mno-local-sdata
18012 Extend (do not extend) the @option{-G} behavior to local data too,
18013 such as to static variables in C@. @option{-mlocal-sdata} is the
18014 default for all configurations.
18015
18016 If the linker complains that an application is using too much small data,
18017 you might want to try rebuilding the less performance-critical parts with
18018 @option{-mno-local-sdata}. You might also want to build large
18019 libraries with @option{-mno-local-sdata}, so that the libraries leave
18020 more room for the main program.
18021
18022 @item -mextern-sdata
18023 @itemx -mno-extern-sdata
18024 @opindex mextern-sdata
18025 @opindex mno-extern-sdata
18026 Assume (do not assume) that externally-defined data is in
18027 a small data section if the size of that data is within the @option{-G} limit.
18028 @option{-mextern-sdata} is the default for all configurations.
18029
18030 If you compile a module @var{Mod} with @option{-mextern-sdata} @option{-G
18031 @var{num}} @option{-mgpopt}, and @var{Mod} references a variable @var{Var}
18032 that is no bigger than @var{num} bytes, you must make sure that @var{Var}
18033 is placed in a small data section. If @var{Var} is defined by another
18034 module, you must either compile that module with a high-enough
18035 @option{-G} setting or attach a @code{section} attribute to @var{Var}'s
18036 definition. If @var{Var} is common, you must link the application
18037 with a high-enough @option{-G} setting.
18038
18039 The easiest way of satisfying these restrictions is to compile
18040 and link every module with the same @option{-G} option. However,
18041 you may wish to build a library that supports several different
18042 small data limits. You can do this by compiling the library with
18043 the highest supported @option{-G} setting and additionally using
18044 @option{-mno-extern-sdata} to stop the library from making assumptions
18045 about externally-defined data.
18046
18047 @item -mgpopt
18048 @itemx -mno-gpopt
18049 @opindex mgpopt
18050 @opindex mno-gpopt
18051 Use (do not use) GP-relative accesses for symbols that are known to be
18052 in a small data section; see @option{-G}, @option{-mlocal-sdata} and
18053 @option{-mextern-sdata}. @option{-mgpopt} is the default for all
18054 configurations.
18055
18056 @option{-mno-gpopt} is useful for cases where the @code{$gp} register
18057 might not hold the value of @code{_gp}. For example, if the code is
18058 part of a library that might be used in a boot monitor, programs that
18059 call boot monitor routines pass an unknown value in @code{$gp}.
18060 (In such situations, the boot monitor itself is usually compiled
18061 with @option{-G0}.)
18062
18063 @option{-mno-gpopt} implies @option{-mno-local-sdata} and
18064 @option{-mno-extern-sdata}.
18065
18066 @item -membedded-data
18067 @itemx -mno-embedded-data
18068 @opindex membedded-data
18069 @opindex mno-embedded-data
18070 Allocate variables to the read-only data section first if possible, then
18071 next in the small data section if possible, otherwise in data. This gives
18072 slightly slower code than the default, but reduces the amount of RAM required
18073 when executing, and thus may be preferred for some embedded systems.
18074
18075 @item -muninit-const-in-rodata
18076 @itemx -mno-uninit-const-in-rodata
18077 @opindex muninit-const-in-rodata
18078 @opindex mno-uninit-const-in-rodata
18079 Put uninitialized @code{const} variables in the read-only data section.
18080 This option is only meaningful in conjunction with @option{-membedded-data}.
18081
18082 @item -mcode-readable=@var{setting}
18083 @opindex mcode-readable
18084 Specify whether GCC may generate code that reads from executable sections.
18085 There are three possible settings:
18086
18087 @table @gcctabopt
18088 @item -mcode-readable=yes
18089 Instructions may freely access executable sections. This is the
18090 default setting.
18091
18092 @item -mcode-readable=pcrel
18093 MIPS16 PC-relative load instructions can access executable sections,
18094 but other instructions must not do so. This option is useful on 4KSc
18095 and 4KSd processors when the code TLBs have the Read Inhibit bit set.
18096 It is also useful on processors that can be configured to have a dual
18097 instruction/data SRAM interface and that, like the M4K, automatically
18098 redirect PC-relative loads to the instruction RAM.
18099
18100 @item -mcode-readable=no
18101 Instructions must not access executable sections. This option can be
18102 useful on targets that are configured to have a dual instruction/data
18103 SRAM interface but that (unlike the M4K) do not automatically redirect
18104 PC-relative loads to the instruction RAM.
18105 @end table
18106
18107 @item -msplit-addresses
18108 @itemx -mno-split-addresses
18109 @opindex msplit-addresses
18110 @opindex mno-split-addresses
18111 Enable (disable) use of the @code{%hi()} and @code{%lo()} assembler
18112 relocation operators. This option has been superseded by
18113 @option{-mexplicit-relocs} but is retained for backwards compatibility.
18114
18115 @item -mexplicit-relocs
18116 @itemx -mno-explicit-relocs
18117 @opindex mexplicit-relocs
18118 @opindex mno-explicit-relocs
18119 Use (do not use) assembler relocation operators when dealing with symbolic
18120 addresses. The alternative, selected by @option{-mno-explicit-relocs},
18121 is to use assembler macros instead.
18122
18123 @option{-mexplicit-relocs} is the default if GCC was configured
18124 to use an assembler that supports relocation operators.
18125
18126 @item -mcheck-zero-division
18127 @itemx -mno-check-zero-division
18128 @opindex mcheck-zero-division
18129 @opindex mno-check-zero-division
18130 Trap (do not trap) on integer division by zero.
18131
18132 The default is @option{-mcheck-zero-division}.
18133
18134 @item -mdivide-traps
18135 @itemx -mdivide-breaks
18136 @opindex mdivide-traps
18137 @opindex mdivide-breaks
18138 MIPS systems check for division by zero by generating either a
18139 conditional trap or a break instruction. Using traps results in
18140 smaller code, but is only supported on MIPS II and later. Also, some
18141 versions of the Linux kernel have a bug that prevents trap from
18142 generating the proper signal (@code{SIGFPE}). Use @option{-mdivide-traps} to
18143 allow conditional traps on architectures that support them and
18144 @option{-mdivide-breaks} to force the use of breaks.
18145
18146 The default is usually @option{-mdivide-traps}, but this can be
18147 overridden at configure time using @option{--with-divide=breaks}.
18148 Divide-by-zero checks can be completely disabled using
18149 @option{-mno-check-zero-division}.
18150
18151 @item -mmemcpy
18152 @itemx -mno-memcpy
18153 @opindex mmemcpy
18154 @opindex mno-memcpy
18155 Force (do not force) the use of @code{memcpy()} for non-trivial block
18156 moves. The default is @option{-mno-memcpy}, which allows GCC to inline
18157 most constant-sized copies.
18158
18159 @item -mlong-calls
18160 @itemx -mno-long-calls
18161 @opindex mlong-calls
18162 @opindex mno-long-calls
18163 Disable (do not disable) use of the @code{jal} instruction. Calling
18164 functions using @code{jal} is more efficient but requires the caller
18165 and callee to be in the same 256 megabyte segment.
18166
18167 This option has no effect on abicalls code. The default is
18168 @option{-mno-long-calls}.
18169
18170 @item -mmad
18171 @itemx -mno-mad
18172 @opindex mmad
18173 @opindex mno-mad
18174 Enable (disable) use of the @code{mad}, @code{madu} and @code{mul}
18175 instructions, as provided by the R4650 ISA@.
18176
18177 @item -mimadd
18178 @itemx -mno-imadd
18179 @opindex mimadd
18180 @opindex mno-imadd
18181 Enable (disable) use of the @code{madd} and @code{msub} integer
18182 instructions. The default is @option{-mimadd} on architectures
18183 that support @code{madd} and @code{msub} except for the 74k
18184 architecture where it was found to generate slower code.
18185
18186 @item -mfused-madd
18187 @itemx -mno-fused-madd
18188 @opindex mfused-madd
18189 @opindex mno-fused-madd
18190 Enable (disable) use of the floating-point multiply-accumulate
18191 instructions, when they are available. The default is
18192 @option{-mfused-madd}.
18193
18194 On the R8000 CPU when multiply-accumulate instructions are used,
18195 the intermediate product is calculated to infinite precision
18196 and is not subject to the FCSR Flush to Zero bit. This may be
18197 undesirable in some circumstances. On other processors the result
18198 is numerically identical to the equivalent computation using
18199 separate multiply, add, subtract and negate instructions.
18200
18201 @item -nocpp
18202 @opindex nocpp
18203 Tell the MIPS assembler to not run its preprocessor over user
18204 assembler files (with a @samp{.s} suffix) when assembling them.
18205
18206 @item -mfix-24k
18207 @item -mno-fix-24k
18208 @opindex mfix-24k
18209 @opindex mno-fix-24k
18210 Work around the 24K E48 (lost data on stores during refill) errata.
18211 The workarounds are implemented by the assembler rather than by GCC@.
18212
18213 @item -mfix-r4000
18214 @itemx -mno-fix-r4000
18215 @opindex mfix-r4000
18216 @opindex mno-fix-r4000
18217 Work around certain R4000 CPU errata:
18218 @itemize @minus
18219 @item
18220 A double-word or a variable shift may give an incorrect result if executed
18221 immediately after starting an integer division.
18222 @item
18223 A double-word or a variable shift may give an incorrect result if executed
18224 while an integer multiplication is in progress.
18225 @item
18226 An integer division may give an incorrect result if started in a delay slot
18227 of a taken branch or a jump.
18228 @end itemize
18229
18230 @item -mfix-r4400
18231 @itemx -mno-fix-r4400
18232 @opindex mfix-r4400
18233 @opindex mno-fix-r4400
18234 Work around certain R4400 CPU errata:
18235 @itemize @minus
18236 @item
18237 A double-word or a variable shift may give an incorrect result if executed
18238 immediately after starting an integer division.
18239 @end itemize
18240
18241 @item -mfix-r10000
18242 @itemx -mno-fix-r10000
18243 @opindex mfix-r10000
18244 @opindex mno-fix-r10000
18245 Work around certain R10000 errata:
18246 @itemize @minus
18247 @item
18248 @code{ll}/@code{sc} sequences may not behave atomically on revisions
18249 prior to 3.0. They may deadlock on revisions 2.6 and earlier.
18250 @end itemize
18251
18252 This option can only be used if the target architecture supports
18253 branch-likely instructions. @option{-mfix-r10000} is the default when
18254 @option{-march=r10000} is used; @option{-mno-fix-r10000} is the default
18255 otherwise.
18256
18257 @item -mfix-rm7000
18258 @itemx -mno-fix-rm7000
18259 @opindex mfix-rm7000
18260 Work around the RM7000 @code{dmult}/@code{dmultu} errata. The
18261 workarounds are implemented by the assembler rather than by GCC@.
18262
18263 @item -mfix-vr4120
18264 @itemx -mno-fix-vr4120
18265 @opindex mfix-vr4120
18266 Work around certain VR4120 errata:
18267 @itemize @minus
18268 @item
18269 @code{dmultu} does not always produce the correct result.
18270 @item
18271 @code{div} and @code{ddiv} do not always produce the correct result if one
18272 of the operands is negative.
18273 @end itemize
18274 The workarounds for the division errata rely on special functions in
18275 @file{libgcc.a}. At present, these functions are only provided by
18276 the @code{mips64vr*-elf} configurations.
18277
18278 Other VR4120 errata require a NOP to be inserted between certain pairs of
18279 instructions. These errata are handled by the assembler, not by GCC itself.
18280
18281 @item -mfix-vr4130
18282 @opindex mfix-vr4130
18283 Work around the VR4130 @code{mflo}/@code{mfhi} errata. The
18284 workarounds are implemented by the assembler rather than by GCC,
18285 although GCC avoids using @code{mflo} and @code{mfhi} if the
18286 VR4130 @code{macc}, @code{macchi}, @code{dmacc} and @code{dmacchi}
18287 instructions are available instead.
18288
18289 @item -mfix-sb1
18290 @itemx -mno-fix-sb1
18291 @opindex mfix-sb1
18292 Work around certain SB-1 CPU core errata.
18293 (This flag currently works around the SB-1 revision 2
18294 ``F1'' and ``F2'' floating-point errata.)
18295
18296 @item -mr10k-cache-barrier=@var{setting}
18297 @opindex mr10k-cache-barrier
18298 Specify whether GCC should insert cache barriers to avoid the
18299 side-effects of speculation on R10K processors.
18300
18301 In common with many processors, the R10K tries to predict the outcome
18302 of a conditional branch and speculatively executes instructions from
18303 the ``taken'' branch. It later aborts these instructions if the
18304 predicted outcome is wrong. However, on the R10K, even aborted
18305 instructions can have side effects.
18306
18307 This problem only affects kernel stores and, depending on the system,
18308 kernel loads. As an example, a speculatively-executed store may load
18309 the target memory into cache and mark the cache line as dirty, even if
18310 the store itself is later aborted. If a DMA operation writes to the
18311 same area of memory before the ``dirty'' line is flushed, the cached
18312 data overwrites the DMA-ed data. See the R10K processor manual
18313 for a full description, including other potential problems.
18314
18315 One workaround is to insert cache barrier instructions before every memory
18316 access that might be speculatively executed and that might have side
18317 effects even if aborted. @option{-mr10k-cache-barrier=@var{setting}}
18318 controls GCC's implementation of this workaround. It assumes that
18319 aborted accesses to any byte in the following regions does not have
18320 side effects:
18321
18322 @enumerate
18323 @item
18324 the memory occupied by the current function's stack frame;
18325
18326 @item
18327 the memory occupied by an incoming stack argument;
18328
18329 @item
18330 the memory occupied by an object with a link-time-constant address.
18331 @end enumerate
18332
18333 It is the kernel's responsibility to ensure that speculative
18334 accesses to these regions are indeed safe.
18335
18336 If the input program contains a function declaration such as:
18337
18338 @smallexample
18339 void foo (void);
18340 @end smallexample
18341
18342 then the implementation of @code{foo} must allow @code{j foo} and
18343 @code{jal foo} to be executed speculatively. GCC honors this
18344 restriction for functions it compiles itself. It expects non-GCC
18345 functions (such as hand-written assembly code) to do the same.
18346
18347 The option has three forms:
18348
18349 @table @gcctabopt
18350 @item -mr10k-cache-barrier=load-store
18351 Insert a cache barrier before a load or store that might be
18352 speculatively executed and that might have side effects even
18353 if aborted.
18354
18355 @item -mr10k-cache-barrier=store
18356 Insert a cache barrier before a store that might be speculatively
18357 executed and that might have side effects even if aborted.
18358
18359 @item -mr10k-cache-barrier=none
18360 Disable the insertion of cache barriers. This is the default setting.
18361 @end table
18362
18363 @item -mflush-func=@var{func}
18364 @itemx -mno-flush-func
18365 @opindex mflush-func
18366 Specifies the function to call to flush the I and D caches, or to not
18367 call any such function. If called, the function must take the same
18368 arguments as the common @code{_flush_func()}, that is, the address of the
18369 memory range for which the cache is being flushed, the size of the
18370 memory range, and the number 3 (to flush both caches). The default
18371 depends on the target GCC was configured for, but commonly is either
18372 @samp{_flush_func} or @samp{__cpu_flush}.
18373
18374 @item mbranch-cost=@var{num}
18375 @opindex mbranch-cost
18376 Set the cost of branches to roughly @var{num} ``simple'' instructions.
18377 This cost is only a heuristic and is not guaranteed to produce
18378 consistent results across releases. A zero cost redundantly selects
18379 the default, which is based on the @option{-mtune} setting.
18380
18381 @item -mbranch-likely
18382 @itemx -mno-branch-likely
18383 @opindex mbranch-likely
18384 @opindex mno-branch-likely
18385 Enable or disable use of Branch Likely instructions, regardless of the
18386 default for the selected architecture. By default, Branch Likely
18387 instructions may be generated if they are supported by the selected
18388 architecture. An exception is for the MIPS32 and MIPS64 architectures
18389 and processors that implement those architectures; for those, Branch
18390 Likely instructions are not be generated by default because the MIPS32
18391 and MIPS64 architectures specifically deprecate their use.
18392
18393 @item -mfp-exceptions
18394 @itemx -mno-fp-exceptions
18395 @opindex mfp-exceptions
18396 Specifies whether FP exceptions are enabled. This affects how
18397 FP instructions are scheduled for some processors.
18398 The default is that FP exceptions are
18399 enabled.
18400
18401 For instance, on the SB-1, if FP exceptions are disabled, and we are emitting
18402 64-bit code, then we can use both FP pipes. Otherwise, we can only use one
18403 FP pipe.
18404
18405 @item -mvr4130-align
18406 @itemx -mno-vr4130-align
18407 @opindex mvr4130-align
18408 The VR4130 pipeline is two-way superscalar, but can only issue two
18409 instructions together if the first one is 8-byte aligned. When this
18410 option is enabled, GCC aligns pairs of instructions that it
18411 thinks should execute in parallel.
18412
18413 This option only has an effect when optimizing for the VR4130.
18414 It normally makes code faster, but at the expense of making it bigger.
18415 It is enabled by default at optimization level @option{-O3}.
18416
18417 @item -msynci
18418 @itemx -mno-synci
18419 @opindex msynci
18420 Enable (disable) generation of @code{synci} instructions on
18421 architectures that support it. The @code{synci} instructions (if
18422 enabled) are generated when @code{__builtin___clear_cache()} is
18423 compiled.
18424
18425 This option defaults to @code{-mno-synci}, but the default can be
18426 overridden by configuring with @code{--with-synci}.
18427
18428 When compiling code for single processor systems, it is generally safe
18429 to use @code{synci}. However, on many multi-core (SMP) systems, it
18430 does not invalidate the instruction caches on all cores and may lead
18431 to undefined behavior.
18432
18433 @item -mrelax-pic-calls
18434 @itemx -mno-relax-pic-calls
18435 @opindex mrelax-pic-calls
18436 Try to turn PIC calls that are normally dispatched via register
18437 @code{$25} into direct calls. This is only possible if the linker can
18438 resolve the destination at link-time and if the destination is within
18439 range for a direct call.
18440
18441 @option{-mrelax-pic-calls} is the default if GCC was configured to use
18442 an assembler and a linker that support the @code{.reloc} assembly
18443 directive and @code{-mexplicit-relocs} is in effect. With
18444 @code{-mno-explicit-relocs}, this optimization can be performed by the
18445 assembler and the linker alone without help from the compiler.
18446
18447 @item -mmcount-ra-address
18448 @itemx -mno-mcount-ra-address
18449 @opindex mmcount-ra-address
18450 @opindex mno-mcount-ra-address
18451 Emit (do not emit) code that allows @code{_mcount} to modify the
18452 calling function's return address. When enabled, this option extends
18453 the usual @code{_mcount} interface with a new @var{ra-address}
18454 parameter, which has type @code{intptr_t *} and is passed in register
18455 @code{$12}. @code{_mcount} can then modify the return address by
18456 doing both of the following:
18457 @itemize
18458 @item
18459 Returning the new address in register @code{$31}.
18460 @item
18461 Storing the new address in @code{*@var{ra-address}},
18462 if @var{ra-address} is nonnull.
18463 @end itemize
18464
18465 The default is @option{-mno-mcount-ra-address}.
18466
18467 @end table
18468
18469 @node MMIX Options
18470 @subsection MMIX Options
18471 @cindex MMIX Options
18472
18473 These options are defined for the MMIX:
18474
18475 @table @gcctabopt
18476 @item -mlibfuncs
18477 @itemx -mno-libfuncs
18478 @opindex mlibfuncs
18479 @opindex mno-libfuncs
18480 Specify that intrinsic library functions are being compiled, passing all
18481 values in registers, no matter the size.
18482
18483 @item -mepsilon
18484 @itemx -mno-epsilon
18485 @opindex mepsilon
18486 @opindex mno-epsilon
18487 Generate floating-point comparison instructions that compare with respect
18488 to the @code{rE} epsilon register.
18489
18490 @item -mabi=mmixware
18491 @itemx -mabi=gnu
18492 @opindex mabi=mmixware
18493 @opindex mabi=gnu
18494 Generate code that passes function parameters and return values that (in
18495 the called function) are seen as registers @code{$0} and up, as opposed to
18496 the GNU ABI which uses global registers @code{$231} and up.
18497
18498 @item -mzero-extend
18499 @itemx -mno-zero-extend
18500 @opindex mzero-extend
18501 @opindex mno-zero-extend
18502 When reading data from memory in sizes shorter than 64 bits, use (do not
18503 use) zero-extending load instructions by default, rather than
18504 sign-extending ones.
18505
18506 @item -mknuthdiv
18507 @itemx -mno-knuthdiv
18508 @opindex mknuthdiv
18509 @opindex mno-knuthdiv
18510 Make the result of a division yielding a remainder have the same sign as
18511 the divisor. With the default, @option{-mno-knuthdiv}, the sign of the
18512 remainder follows the sign of the dividend. Both methods are
18513 arithmetically valid, the latter being almost exclusively used.
18514
18515 @item -mtoplevel-symbols
18516 @itemx -mno-toplevel-symbols
18517 @opindex mtoplevel-symbols
18518 @opindex mno-toplevel-symbols
18519 Prepend (do not prepend) a @samp{:} to all global symbols, so the assembly
18520 code can be used with the @code{PREFIX} assembly directive.
18521
18522 @item -melf
18523 @opindex melf
18524 Generate an executable in the ELF format, rather than the default
18525 @samp{mmo} format used by the @command{mmix} simulator.
18526
18527 @item -mbranch-predict
18528 @itemx -mno-branch-predict
18529 @opindex mbranch-predict
18530 @opindex mno-branch-predict
18531 Use (do not use) the probable-branch instructions, when static branch
18532 prediction indicates a probable branch.
18533
18534 @item -mbase-addresses
18535 @itemx -mno-base-addresses
18536 @opindex mbase-addresses
18537 @opindex mno-base-addresses
18538 Generate (do not generate) code that uses @emph{base addresses}. Using a
18539 base address automatically generates a request (handled by the assembler
18540 and the linker) for a constant to be set up in a global register. The
18541 register is used for one or more base address requests within the range 0
18542 to 255 from the value held in the register. The generally leads to short
18543 and fast code, but the number of different data items that can be
18544 addressed is limited. This means that a program that uses lots of static
18545 data may require @option{-mno-base-addresses}.
18546
18547 @item -msingle-exit
18548 @itemx -mno-single-exit
18549 @opindex msingle-exit
18550 @opindex mno-single-exit
18551 Force (do not force) generated code to have a single exit point in each
18552 function.
18553 @end table
18554
18555 @node MN10300 Options
18556 @subsection MN10300 Options
18557 @cindex MN10300 options
18558
18559 These @option{-m} options are defined for Matsushita MN10300 architectures:
18560
18561 @table @gcctabopt
18562 @item -mmult-bug
18563 @opindex mmult-bug
18564 Generate code to avoid bugs in the multiply instructions for the MN10300
18565 processors. This is the default.
18566
18567 @item -mno-mult-bug
18568 @opindex mno-mult-bug
18569 Do not generate code to avoid bugs in the multiply instructions for the
18570 MN10300 processors.
18571
18572 @item -mam33
18573 @opindex mam33
18574 Generate code using features specific to the AM33 processor.
18575
18576 @item -mno-am33
18577 @opindex mno-am33
18578 Do not generate code using features specific to the AM33 processor. This
18579 is the default.
18580
18581 @item -mam33-2
18582 @opindex mam33-2
18583 Generate code using features specific to the AM33/2.0 processor.
18584
18585 @item -mam34
18586 @opindex mam34
18587 Generate code using features specific to the AM34 processor.
18588
18589 @item -mtune=@var{cpu-type}
18590 @opindex mtune
18591 Use the timing characteristics of the indicated CPU type when
18592 scheduling instructions. This does not change the targeted processor
18593 type. The CPU type must be one of @samp{mn10300}, @samp{am33},
18594 @samp{am33-2} or @samp{am34}.
18595
18596 @item -mreturn-pointer-on-d0
18597 @opindex mreturn-pointer-on-d0
18598 When generating a function that returns a pointer, return the pointer
18599 in both @code{a0} and @code{d0}. Otherwise, the pointer is returned
18600 only in @code{a0}, and attempts to call such functions without a prototype
18601 result in errors. Note that this option is on by default; use
18602 @option{-mno-return-pointer-on-d0} to disable it.
18603
18604 @item -mno-crt0
18605 @opindex mno-crt0
18606 Do not link in the C run-time initialization object file.
18607
18608 @item -mrelax
18609 @opindex mrelax
18610 Indicate to the linker that it should perform a relaxation optimization pass
18611 to shorten branches, calls and absolute memory addresses. This option only
18612 has an effect when used on the command line for the final link step.
18613
18614 This option makes symbolic debugging impossible.
18615
18616 @item -mliw
18617 @opindex mliw
18618 Allow the compiler to generate @emph{Long Instruction Word}
18619 instructions if the target is the @samp{AM33} or later. This is the
18620 default. This option defines the preprocessor macro @samp{__LIW__}.
18621
18622 @item -mnoliw
18623 @opindex mnoliw
18624 Do not allow the compiler to generate @emph{Long Instruction Word}
18625 instructions. This option defines the preprocessor macro
18626 @samp{__NO_LIW__}.
18627
18628 @item -msetlb
18629 @opindex msetlb
18630 Allow the compiler to generate the @emph{SETLB} and @emph{Lcc}
18631 instructions if the target is the @samp{AM33} or later. This is the
18632 default. This option defines the preprocessor macro @samp{__SETLB__}.
18633
18634 @item -mnosetlb
18635 @opindex mnosetlb
18636 Do not allow the compiler to generate @emph{SETLB} or @emph{Lcc}
18637 instructions. This option defines the preprocessor macro
18638 @samp{__NO_SETLB__}.
18639
18640 @end table
18641
18642 @node Moxie Options
18643 @subsection Moxie Options
18644 @cindex Moxie Options
18645
18646 @table @gcctabopt
18647
18648 @item -meb
18649 @opindex meb
18650 Generate big-endian code. This is the default for @samp{moxie-*-*}
18651 configurations.
18652
18653 @item -mel
18654 @opindex mel
18655 Generate little-endian code.
18656
18657 @item -mno-crt0
18658 @opindex mno-crt0
18659 Do not link in the C run-time initialization object file.
18660
18661 @end table
18662
18663 @node MSP430 Options
18664 @subsection MSP430 Options
18665 @cindex MSP430 Options
18666
18667 These options are defined for the MSP430:
18668
18669 @table @gcctabopt
18670
18671 @item -masm-hex
18672 @opindex masm-hex
18673 Force assembly output to always use hex constants. Normally such
18674 constants are signed decimals, but this option is available for
18675 testsuite and/or aesthetic purposes.
18676
18677 @item -mmcu=
18678 @opindex mmcu=
18679 Select the MCU to target. This is used to create a C preprocessor
18680 symbol based upon the MCU name, converted to upper case and pre- and
18681 post- fixed with @code{__}. This in turn will be used by the
18682 @code{msp430.h} header file to select an MCU specific supplimentary
18683 header file.
18684
18685 The option also sets the ISA to use. If the MCU name is one that is
18686 known to only support the 430 ISA then that is selected, otherwise the
18687 430X ISA is selected. A generic MCU name of @code{msp430} can also be
18688 used to select the 430 ISA. Similarly the generic @code{msp430x} MCU
18689 name will select the 430X ISA.
18690
18691 In addition an MCU specific linker script will be added to the linker
18692 command line. The script's name is the name of the MCU with
18693 @code{.ld} appended. Thus specifying @option{-mmcu=xxx} on the gcc
18694 command line will define the C preprocessor symbol @code{__XXX__} and
18695 cause the linker to search for a script called @file{xxx.ld}.
18696
18697 This option is also passed on to the assembler.
18698
18699 @item -mcpu=
18700 @opindex -mcpu=
18701 Specifies the ISA to use. Accepted values are @code{msp430},
18702 @code{msp430x} and @code{msp430xv2}. This option is deprecated. The
18703 @option{-mmcu=} option should be used to select the ISA.
18704
18705 @item -msim
18706 @opindex msim
18707 Link to the simulator runtime libraries and linker script. Overrides
18708 any scripts that would be selected by the @option{-mmcu=} option.
18709
18710 @item -mlarge
18711 @opindex mlarge
18712 Use large-model addressing (20-bit pointers, 32-bit @code{size_t}).
18713
18714 @item -msmall
18715 @opindex msmall
18716 Use small-model addressing (16-bit pointers, 16-bit @code{size_t}).
18717
18718 @item -mrelax
18719 @opindex mrelax
18720 This option is passed to the assembler and linker, and allows the
18721 linker to perform certain optimizations that cannot be done until
18722 the final link.
18723
18724 @item mhwmult=
18725 @opindex mhwmult=
18726 Describes the type of hardware multiply supported by the target.
18727 Accepted values are @code{none} for no hardware multiply, @code{16bit}
18728 for the original 16-bit-only multiply supported by early MCUs.
18729 @code{32bit} for the 16/32-bit multiply supported by later MCUs and
18730 @code{f5series} for the 16/32-bit multiply supported by F5-series MCUs.
18731 A value of @code{auto} can also be given. This tells GCC to deduce
18732 the hardware multiply support based upon the MCU name provided by the
18733 @option{-mmcu} option. If no @option{-mmcu} option is specified then
18734 @code{32bit} hardware multiply support is assumed. @code{auto} is the
18735 default setting.
18736
18737 Hardware multiplies are normally performed by calling a library
18738 routine. This saves space in the generated code. When compiling at
18739 @code{-O3} or higher however the hardware multiplier is invoked
18740 inline. This makes for bigger, but faster code.
18741
18742 The hardware multiply routines disable interrupts whilst running and
18743 restore the previous interrupt state when they finish. This makes
18744 them safe to use inside interrupt handlers as well as in normal code.
18745
18746 @item -minrt
18747 @opindex minrt
18748 Enable the use of a minimum runtime environment - no static
18749 initializers or constructors. This is intended for memory-constrained
18750 devices. The compiler will include special symbols in some objects
18751 that tell the linker and runtime which code fragments are required.
18752
18753 @end table
18754
18755 @node NDS32 Options
18756 @subsection NDS32 Options
18757 @cindex NDS32 Options
18758
18759 These options are defined for NDS32 implementations:
18760
18761 @table @gcctabopt
18762
18763 @item -mbig-endian
18764 @opindex mbig-endian
18765 Generate code in big-endian mode.
18766
18767 @item -mlittle-endian
18768 @opindex mlittle-endian
18769 Generate code in little-endian mode.
18770
18771 @item -mreduced-regs
18772 @opindex mreduced-regs
18773 Use reduced-set registers for register allocation.
18774
18775 @item -mfull-regs
18776 @opindex mfull-regs
18777 Use full-set registers for register allocation.
18778
18779 @item -mcmov
18780 @opindex mcmov
18781 Generate conditional move instructions.
18782
18783 @item -mno-cmov
18784 @opindex mno-cmov
18785 Do not generate conditional move instructions.
18786
18787 @item -mperf-ext
18788 @opindex mperf-ext
18789 Generate performance extension instructions.
18790
18791 @item -mno-perf-ext
18792 @opindex mno-perf-ext
18793 Do not generate performance extension instructions.
18794
18795 @item -mv3push
18796 @opindex mv3push
18797 Generate v3 push25/pop25 instructions.
18798
18799 @item -mno-v3push
18800 @opindex mno-v3push
18801 Do not generate v3 push25/pop25 instructions.
18802
18803 @item -m16-bit
18804 @opindex m16-bit
18805 Generate 16-bit instructions.
18806
18807 @item -mno-16-bit
18808 @opindex mno-16-bit
18809 Do not generate 16-bit instructions.
18810
18811 @item -mgp-direct
18812 @opindex mgp-direct
18813 Generate GP base instructions directly.
18814
18815 @item -mno-gp-direct
18816 @opindex mno-gp-direct
18817 Do no generate GP base instructions directly.
18818
18819 @item -misr-vector-size=@var{num}
18820 @opindex misr-vector-size
18821 Specify the size of each interrupt vector, which must be 4 or 16.
18822
18823 @item -mcache-block-size=@var{num}
18824 @opindex mcache-block-size
18825 Specify the size of each cache block,
18826 which must be a power of 2 between 4 and 512.
18827
18828 @item -march=@var{arch}
18829 @opindex march
18830 Specify the name of the target architecture.
18831
18832 @item -mforce-fp-as-gp
18833 @opindex mforce-fp-as-gp
18834 Prevent $fp being allocated during register allocation so that compiler
18835 is able to force performing fp-as-gp optimization.
18836
18837 @item -mforbid-fp-as-gp
18838 @opindex mforbid-fp-as-gp
18839 Forbid using $fp to access static and global variables.
18840 This option strictly forbids fp-as-gp optimization
18841 regardless of @option{-mforce-fp-as-gp}.
18842
18843 @item -mex9
18844 @opindex mex9
18845 Use special directives to guide linker doing ex9 optimization.
18846
18847 @item -mctor-dtor
18848 @opindex mctor-dtor
18849 Enable constructor/destructor feature.
18850
18851 @item -mrelax
18852 @opindex mrelax
18853 Guide linker to relax instructions.
18854
18855 @end table
18856
18857 @node Nios II Options
18858 @subsection Nios II Options
18859 @cindex Nios II options
18860 @cindex Altera Nios II options
18861
18862 These are the options defined for the Altera Nios II processor.
18863
18864 @table @gcctabopt
18865
18866 @item -G @var{num}
18867 @opindex G
18868 @cindex smaller data references
18869 Put global and static objects less than or equal to @var{num} bytes
18870 into the small data or BSS sections instead of the normal data or BSS
18871 sections. The default value of @var{num} is 8.
18872
18873 @item -mgpopt
18874 @itemx -mno-gpopt
18875 @opindex mgpopt
18876 @opindex mno-gpopt
18877 Generate (do not generate) GP-relative accesses for objects in the
18878 small data or BSS sections. The default is @option{-mgpopt} except
18879 when @option{-fpic} or @option{-fPIC} is specified to generate
18880 position-independent code. Note that the Nios II ABI does not permit
18881 GP-relative accesses from shared libraries.
18882
18883 You may need to specify @option{-mno-gpopt} explicitly when building
18884 programs that include large amounts of small data, including large
18885 GOT data sections. In this case, the 16-bit offset for GP-relative
18886 addressing may not be large enough to allow access to the entire
18887 small data section.
18888
18889 @item -mel
18890 @itemx -meb
18891 @opindex mel
18892 @opindex meb
18893 Generate little-endian (default) or big-endian (experimental) code,
18894 respectively.
18895
18896 @item -mbypass-cache
18897 @itemx -mno-bypass-cache
18898 @opindex mno-bypass-cache
18899 @opindex mbypass-cache
18900 Force all load and store instructions to always bypass cache by
18901 using I/O variants of the instructions. The default is not to
18902 bypass the cache.
18903
18904 @item -mno-cache-volatile
18905 @itemx -mcache-volatile
18906 @opindex mcache-volatile
18907 @opindex mno-cache-volatile
18908 Volatile memory access bypass the cache using the I/O variants of
18909 the load and store instructions. The default is not to bypass the cache.
18910
18911 @item -mno-fast-sw-div
18912 @itemx -mfast-sw-div
18913 @opindex mno-fast-sw-div
18914 @opindex mfast-sw-div
18915 Do not use table-based fast divide for small numbers. The default
18916 is to use the fast divide at @option{-O3} and above.
18917
18918 @item -mno-hw-mul
18919 @itemx -mhw-mul
18920 @itemx -mno-hw-mulx
18921 @itemx -mhw-mulx
18922 @itemx -mno-hw-div
18923 @itemx -mhw-div
18924 @opindex mno-hw-mul
18925 @opindex mhw-mul
18926 @opindex mno-hw-mulx
18927 @opindex mhw-mulx
18928 @opindex mno-hw-div
18929 @opindex mhw-div
18930 Enable or disable emitting @code{mul}, @code{mulx} and @code{div} family of
18931 instructions by the compiler. The default is to emit @code{mul}
18932 and not emit @code{div} and @code{mulx}.
18933
18934 @item -mcustom-@var{insn}=@var{N}
18935 @itemx -mno-custom-@var{insn}
18936 @opindex mcustom-@var{insn}
18937 @opindex mno-custom-@var{insn}
18938 Each @option{-mcustom-@var{insn}=@var{N}} option enables use of a
18939 custom instruction with encoding @var{N} when generating code that uses
18940 @var{insn}. For example, @code{-mcustom-fadds=253} generates custom
18941 instruction 253 for single-precision floating-point add operations instead
18942 of the default behavior of using a library call.
18943
18944 The following values of @var{insn} are supported. Except as otherwise
18945 noted, floating-point operations are expected to be implemented with
18946 normal IEEE 754 semantics and correspond directly to the C operators or the
18947 equivalent GCC built-in functions (@pxref{Other Builtins}).
18948
18949 Single-precision floating point:
18950 @table @asis
18951
18952 @item @samp{fadds}, @samp{fsubs}, @samp{fdivs}, @samp{fmuls}
18953 Binary arithmetic operations.
18954
18955 @item @samp{fnegs}
18956 Unary negation.
18957
18958 @item @samp{fabss}
18959 Unary absolute value.
18960
18961 @item @samp{fcmpeqs}, @samp{fcmpges}, @samp{fcmpgts}, @samp{fcmples}, @samp{fcmplts}, @samp{fcmpnes}
18962 Comparison operations.
18963
18964 @item @samp{fmins}, @samp{fmaxs}
18965 Floating-point minimum and maximum. These instructions are only
18966 generated if @option{-ffinite-math-only} is specified.
18967
18968 @item @samp{fsqrts}
18969 Unary square root operation.
18970
18971 @item @samp{fcoss}, @samp{fsins}, @samp{ftans}, @samp{fatans}, @samp{fexps}, @samp{flogs}
18972 Floating-point trigonometric and exponential functions. These instructions
18973 are only generated if @option{-funsafe-math-optimizations} is also specified.
18974
18975 @end table
18976
18977 Double-precision floating point:
18978 @table @asis
18979
18980 @item @samp{faddd}, @samp{fsubd}, @samp{fdivd}, @samp{fmuld}
18981 Binary arithmetic operations.
18982
18983 @item @samp{fnegd}
18984 Unary negation.
18985
18986 @item @samp{fabsd}
18987 Unary absolute value.
18988
18989 @item @samp{fcmpeqd}, @samp{fcmpged}, @samp{fcmpgtd}, @samp{fcmpled}, @samp{fcmpltd}, @samp{fcmpned}
18990 Comparison operations.
18991
18992 @item @samp{fmind}, @samp{fmaxd}
18993 Double-precision minimum and maximum. These instructions are only
18994 generated if @option{-ffinite-math-only} is specified.
18995
18996 @item @samp{fsqrtd}
18997 Unary square root operation.
18998
18999 @item @samp{fcosd}, @samp{fsind}, @samp{ftand}, @samp{fatand}, @samp{fexpd}, @samp{flogd}
19000 Double-precision trigonometric and exponential functions. These instructions
19001 are only generated if @option{-funsafe-math-optimizations} is also specified.
19002
19003 @end table
19004
19005 Conversions:
19006 @table @asis
19007 @item @samp{fextsd}
19008 Conversion from single precision to double precision.
19009
19010 @item @samp{ftruncds}
19011 Conversion from double precision to single precision.
19012
19013 @item @samp{fixsi}, @samp{fixsu}, @samp{fixdi}, @samp{fixdu}
19014 Conversion from floating point to signed or unsigned integer types, with
19015 truncation towards zero.
19016
19017 @item @samp{round}
19018 Conversion from single-precision floating point to signed integer,
19019 rounding to the nearest integer and ties away from zero.
19020 This corresponds to the @code{__builtin_lroundf} function when
19021 @option{-fno-math-errno} is used.
19022
19023 @item @samp{floatis}, @samp{floatus}, @samp{floatid}, @samp{floatud}
19024 Conversion from signed or unsigned integer types to floating-point types.
19025
19026 @end table
19027
19028 In addition, all of the following transfer instructions for internal
19029 registers X and Y must be provided to use any of the double-precision
19030 floating-point instructions. Custom instructions taking two
19031 double-precision source operands expect the first operand in the
19032 64-bit register X. The other operand (or only operand of a unary
19033 operation) is given to the custom arithmetic instruction with the
19034 least significant half in source register @var{src1} and the most
19035 significant half in @var{src2}. A custom instruction that returns a
19036 double-precision result returns the most significant 32 bits in the
19037 destination register and the other half in 32-bit register Y.
19038 GCC automatically generates the necessary code sequences to write
19039 register X and/or read register Y when double-precision floating-point
19040 instructions are used.
19041
19042 @table @asis
19043
19044 @item @samp{fwrx}
19045 Write @var{src1} into the least significant half of X and @var{src2} into
19046 the most significant half of X.
19047
19048 @item @samp{fwry}
19049 Write @var{src1} into Y.
19050
19051 @item @samp{frdxhi}, @samp{frdxlo}
19052 Read the most or least (respectively) significant half of X and store it in
19053 @var{dest}.
19054
19055 @item @samp{frdy}
19056 Read the value of Y and store it into @var{dest}.
19057 @end table
19058
19059 Note that you can gain more local control over generation of Nios II custom
19060 instructions by using the @code{target("custom-@var{insn}=@var{N}")}
19061 and @code{target("no-custom-@var{insn}")} function attributes
19062 (@pxref{Function Attributes})
19063 or pragmas (@pxref{Function Specific Option Pragmas}).
19064
19065 @item -mcustom-fpu-cfg=@var{name}
19066 @opindex mcustom-fpu-cfg
19067
19068 This option enables a predefined, named set of custom instruction encodings
19069 (see @option{-mcustom-@var{insn}} above).
19070 Currently, the following sets are defined:
19071
19072 @option{-mcustom-fpu-cfg=60-1} is equivalent to:
19073 @gccoptlist{-mcustom-fmuls=252 @gol
19074 -mcustom-fadds=253 @gol
19075 -mcustom-fsubs=254 @gol
19076 -fsingle-precision-constant}
19077
19078 @option{-mcustom-fpu-cfg=60-2} is equivalent to:
19079 @gccoptlist{-mcustom-fmuls=252 @gol
19080 -mcustom-fadds=253 @gol
19081 -mcustom-fsubs=254 @gol
19082 -mcustom-fdivs=255 @gol
19083 -fsingle-precision-constant}
19084
19085 @option{-mcustom-fpu-cfg=72-3} is equivalent to:
19086 @gccoptlist{-mcustom-floatus=243 @gol
19087 -mcustom-fixsi=244 @gol
19088 -mcustom-floatis=245 @gol
19089 -mcustom-fcmpgts=246 @gol
19090 -mcustom-fcmples=249 @gol
19091 -mcustom-fcmpeqs=250 @gol
19092 -mcustom-fcmpnes=251 @gol
19093 -mcustom-fmuls=252 @gol
19094 -mcustom-fadds=253 @gol
19095 -mcustom-fsubs=254 @gol
19096 -mcustom-fdivs=255 @gol
19097 -fsingle-precision-constant}
19098
19099 Custom instruction assignments given by individual
19100 @option{-mcustom-@var{insn}=} options override those given by
19101 @option{-mcustom-fpu-cfg=}, regardless of the
19102 order of the options on the command line.
19103
19104 Note that you can gain more local control over selection of a FPU
19105 configuration by using the @code{target("custom-fpu-cfg=@var{name}")}
19106 function attribute (@pxref{Function Attributes})
19107 or pragma (@pxref{Function Specific Option Pragmas}).
19108
19109 @end table
19110
19111 These additional @samp{-m} options are available for the Altera Nios II
19112 ELF (bare-metal) target:
19113
19114 @table @gcctabopt
19115
19116 @item -mhal
19117 @opindex mhal
19118 Link with HAL BSP. This suppresses linking with the GCC-provided C runtime
19119 startup and termination code, and is typically used in conjunction with
19120 @option{-msys-crt0=} to specify the location of the alternate startup code
19121 provided by the HAL BSP.
19122
19123 @item -msmallc
19124 @opindex msmallc
19125 Link with a limited version of the C library, @option{-lsmallc}, rather than
19126 Newlib.
19127
19128 @item -msys-crt0=@var{startfile}
19129 @opindex msys-crt0
19130 @var{startfile} is the file name of the startfile (crt0) to use
19131 when linking. This option is only useful in conjunction with @option{-mhal}.
19132
19133 @item -msys-lib=@var{systemlib}
19134 @opindex msys-lib
19135 @var{systemlib} is the library name of the library that provides
19136 low-level system calls required by the C library,
19137 e.g. @code{read} and @code{write}.
19138 This option is typically used to link with a library provided by a HAL BSP.
19139
19140 @end table
19141
19142 @node PDP-11 Options
19143 @subsection PDP-11 Options
19144 @cindex PDP-11 Options
19145
19146 These options are defined for the PDP-11:
19147
19148 @table @gcctabopt
19149 @item -mfpu
19150 @opindex mfpu
19151 Use hardware FPP floating point. This is the default. (FIS floating
19152 point on the PDP-11/40 is not supported.)
19153
19154 @item -msoft-float
19155 @opindex msoft-float
19156 Do not use hardware floating point.
19157
19158 @item -mac0
19159 @opindex mac0
19160 Return floating-point results in ac0 (fr0 in Unix assembler syntax).
19161
19162 @item -mno-ac0
19163 @opindex mno-ac0
19164 Return floating-point results in memory. This is the default.
19165
19166 @item -m40
19167 @opindex m40
19168 Generate code for a PDP-11/40.
19169
19170 @item -m45
19171 @opindex m45
19172 Generate code for a PDP-11/45. This is the default.
19173
19174 @item -m10
19175 @opindex m10
19176 Generate code for a PDP-11/10.
19177
19178 @item -mbcopy-builtin
19179 @opindex mbcopy-builtin
19180 Use inline @code{movmemhi} patterns for copying memory. This is the
19181 default.
19182
19183 @item -mbcopy
19184 @opindex mbcopy
19185 Do not use inline @code{movmemhi} patterns for copying memory.
19186
19187 @item -mint16
19188 @itemx -mno-int32
19189 @opindex mint16
19190 @opindex mno-int32
19191 Use 16-bit @code{int}. This is the default.
19192
19193 @item -mint32
19194 @itemx -mno-int16
19195 @opindex mint32
19196 @opindex mno-int16
19197 Use 32-bit @code{int}.
19198
19199 @item -mfloat64
19200 @itemx -mno-float32
19201 @opindex mfloat64
19202 @opindex mno-float32
19203 Use 64-bit @code{float}. This is the default.
19204
19205 @item -mfloat32
19206 @itemx -mno-float64
19207 @opindex mfloat32
19208 @opindex mno-float64
19209 Use 32-bit @code{float}.
19210
19211 @item -mabshi
19212 @opindex mabshi
19213 Use @code{abshi2} pattern. This is the default.
19214
19215 @item -mno-abshi
19216 @opindex mno-abshi
19217 Do not use @code{abshi2} pattern.
19218
19219 @item -mbranch-expensive
19220 @opindex mbranch-expensive
19221 Pretend that branches are expensive. This is for experimenting with
19222 code generation only.
19223
19224 @item -mbranch-cheap
19225 @opindex mbranch-cheap
19226 Do not pretend that branches are expensive. This is the default.
19227
19228 @item -munix-asm
19229 @opindex munix-asm
19230 Use Unix assembler syntax. This is the default when configured for
19231 @samp{pdp11-*-bsd}.
19232
19233 @item -mdec-asm
19234 @opindex mdec-asm
19235 Use DEC assembler syntax. This is the default when configured for any
19236 PDP-11 target other than @samp{pdp11-*-bsd}.
19237 @end table
19238
19239 @node picoChip Options
19240 @subsection picoChip Options
19241 @cindex picoChip options
19242
19243 These @samp{-m} options are defined for picoChip implementations:
19244
19245 @table @gcctabopt
19246
19247 @item -mae=@var{ae_type}
19248 @opindex mcpu
19249 Set the instruction set, register set, and instruction scheduling
19250 parameters for array element type @var{ae_type}. Supported values
19251 for @var{ae_type} are @samp{ANY}, @samp{MUL}, and @samp{MAC}.
19252
19253 @option{-mae=ANY} selects a completely generic AE type. Code
19254 generated with this option runs on any of the other AE types. The
19255 code is not as efficient as it would be if compiled for a specific
19256 AE type, and some types of operation (e.g., multiplication) do not
19257 work properly on all types of AE.
19258
19259 @option{-mae=MUL} selects a MUL AE type. This is the most useful AE type
19260 for compiled code, and is the default.
19261
19262 @option{-mae=MAC} selects a DSP-style MAC AE. Code compiled with this
19263 option may suffer from poor performance of byte (char) manipulation,
19264 since the DSP AE does not provide hardware support for byte load/stores.
19265
19266 @item -msymbol-as-address
19267 Enable the compiler to directly use a symbol name as an address in a
19268 load/store instruction, without first loading it into a
19269 register. Typically, the use of this option generates larger
19270 programs, which run faster than when the option isn't used. However, the
19271 results vary from program to program, so it is left as a user option,
19272 rather than being permanently enabled.
19273
19274 @item -mno-inefficient-warnings
19275 Disables warnings about the generation of inefficient code. These
19276 warnings can be generated, for example, when compiling code that
19277 performs byte-level memory operations on the MAC AE type. The MAC AE has
19278 no hardware support for byte-level memory operations, so all byte
19279 load/stores must be synthesized from word load/store operations. This is
19280 inefficient and a warning is generated to indicate
19281 that you should rewrite the code to avoid byte operations, or to target
19282 an AE type that has the necessary hardware support. This option disables
19283 these warnings.
19284
19285 @end table
19286
19287 @node PowerPC Options
19288 @subsection PowerPC Options
19289 @cindex PowerPC options
19290
19291 These are listed under @xref{RS/6000 and PowerPC Options}.
19292
19293 @node RL78 Options
19294 @subsection RL78 Options
19295 @cindex RL78 Options
19296
19297 @table @gcctabopt
19298
19299 @item -msim
19300 @opindex msim
19301 Links in additional target libraries to support operation within a
19302 simulator.
19303
19304 @item -mmul=none
19305 @itemx -mmul=g13
19306 @itemx -mmul=rl78
19307 @opindex mmul
19308 Specifies the type of hardware multiplication support to be used. The
19309 default is @code{none}, which uses software multiplication functions.
19310 The @code{g13} option is for the hardware multiply/divide peripheral
19311 only on the RL78/G13 targets. The @code{rl78} option is for the
19312 standard hardware multiplication defined in the RL78 software manual.
19313
19314 @item -m64bit-doubles
19315 @itemx -m32bit-doubles
19316 @opindex m64bit-doubles
19317 @opindex m32bit-doubles
19318 Make the @code{double} data type be 64 bits (@option{-m64bit-doubles})
19319 or 32 bits (@option{-m32bit-doubles}) in size. The default is
19320 @option{-m32bit-doubles}.
19321
19322 @end table
19323
19324 @node RS/6000 and PowerPC Options
19325 @subsection IBM RS/6000 and PowerPC Options
19326 @cindex RS/6000 and PowerPC Options
19327 @cindex IBM RS/6000 and PowerPC Options
19328
19329 These @samp{-m} options are defined for the IBM RS/6000 and PowerPC:
19330 @table @gcctabopt
19331 @item -mpowerpc-gpopt
19332 @itemx -mno-powerpc-gpopt
19333 @itemx -mpowerpc-gfxopt
19334 @itemx -mno-powerpc-gfxopt
19335 @need 800
19336 @itemx -mpowerpc64
19337 @itemx -mno-powerpc64
19338 @itemx -mmfcrf
19339 @itemx -mno-mfcrf
19340 @itemx -mpopcntb
19341 @itemx -mno-popcntb
19342 @itemx -mpopcntd
19343 @itemx -mno-popcntd
19344 @itemx -mfprnd
19345 @itemx -mno-fprnd
19346 @need 800
19347 @itemx -mcmpb
19348 @itemx -mno-cmpb
19349 @itemx -mmfpgpr
19350 @itemx -mno-mfpgpr
19351 @itemx -mhard-dfp
19352 @itemx -mno-hard-dfp
19353 @opindex mpowerpc-gpopt
19354 @opindex mno-powerpc-gpopt
19355 @opindex mpowerpc-gfxopt
19356 @opindex mno-powerpc-gfxopt
19357 @opindex mpowerpc64
19358 @opindex mno-powerpc64
19359 @opindex mmfcrf
19360 @opindex mno-mfcrf
19361 @opindex mpopcntb
19362 @opindex mno-popcntb
19363 @opindex mpopcntd
19364 @opindex mno-popcntd
19365 @opindex mfprnd
19366 @opindex mno-fprnd
19367 @opindex mcmpb
19368 @opindex mno-cmpb
19369 @opindex mmfpgpr
19370 @opindex mno-mfpgpr
19371 @opindex mhard-dfp
19372 @opindex mno-hard-dfp
19373 You use these options to specify which instructions are available on the
19374 processor you are using. The default value of these options is
19375 determined when configuring GCC@. Specifying the
19376 @option{-mcpu=@var{cpu_type}} overrides the specification of these
19377 options. We recommend you use the @option{-mcpu=@var{cpu_type}} option
19378 rather than the options listed above.
19379
19380 Specifying @option{-mpowerpc-gpopt} allows
19381 GCC to use the optional PowerPC architecture instructions in the
19382 General Purpose group, including floating-point square root. Specifying
19383 @option{-mpowerpc-gfxopt} allows GCC to
19384 use the optional PowerPC architecture instructions in the Graphics
19385 group, including floating-point select.
19386
19387 The @option{-mmfcrf} option allows GCC to generate the move from
19388 condition register field instruction implemented on the POWER4
19389 processor and other processors that support the PowerPC V2.01
19390 architecture.
19391 The @option{-mpopcntb} option allows GCC to generate the popcount and
19392 double-precision FP reciprocal estimate instruction implemented on the
19393 POWER5 processor and other processors that support the PowerPC V2.02
19394 architecture.
19395 The @option{-mpopcntd} option allows GCC to generate the popcount
19396 instruction implemented on the POWER7 processor and other processors
19397 that support the PowerPC V2.06 architecture.
19398 The @option{-mfprnd} option allows GCC to generate the FP round to
19399 integer instructions implemented on the POWER5+ processor and other
19400 processors that support the PowerPC V2.03 architecture.
19401 The @option{-mcmpb} option allows GCC to generate the compare bytes
19402 instruction implemented on the POWER6 processor and other processors
19403 that support the PowerPC V2.05 architecture.
19404 The @option{-mmfpgpr} option allows GCC to generate the FP move to/from
19405 general-purpose register instructions implemented on the POWER6X
19406 processor and other processors that support the extended PowerPC V2.05
19407 architecture.
19408 The @option{-mhard-dfp} option allows GCC to generate the decimal
19409 floating-point instructions implemented on some POWER processors.
19410
19411 The @option{-mpowerpc64} option allows GCC to generate the additional
19412 64-bit instructions that are found in the full PowerPC64 architecture
19413 and to treat GPRs as 64-bit, doubleword quantities. GCC defaults to
19414 @option{-mno-powerpc64}.
19415
19416 @item -mcpu=@var{cpu_type}
19417 @opindex mcpu
19418 Set architecture type, register usage, and
19419 instruction scheduling parameters for machine type @var{cpu_type}.
19420 Supported values for @var{cpu_type} are @samp{401}, @samp{403},
19421 @samp{405}, @samp{405fp}, @samp{440}, @samp{440fp}, @samp{464}, @samp{464fp},
19422 @samp{476}, @samp{476fp}, @samp{505}, @samp{601}, @samp{602}, @samp{603},
19423 @samp{603e}, @samp{604}, @samp{604e}, @samp{620}, @samp{630}, @samp{740},
19424 @samp{7400}, @samp{7450}, @samp{750}, @samp{801}, @samp{821}, @samp{823},
19425 @samp{860}, @samp{970}, @samp{8540}, @samp{a2}, @samp{e300c2},
19426 @samp{e300c3}, @samp{e500mc}, @samp{e500mc64}, @samp{e5500},
19427 @samp{e6500}, @samp{ec603e}, @samp{G3}, @samp{G4}, @samp{G5},
19428 @samp{titan}, @samp{power3}, @samp{power4}, @samp{power5}, @samp{power5+},
19429 @samp{power6}, @samp{power6x}, @samp{power7}, @samp{power8}, @samp{powerpc},
19430 @samp{powerpc64}, and @samp{rs64}.
19431
19432 @option{-mcpu=powerpc}, and @option{-mcpu=powerpc64} specify pure 32-bit
19433 PowerPC and 64-bit PowerPC architecture machine
19434 types, with an appropriate, generic processor model assumed for
19435 scheduling purposes.
19436
19437 The other options specify a specific processor. Code generated under
19438 those options runs best on that processor, and may not run at all on
19439 others.
19440
19441 The @option{-mcpu} options automatically enable or disable the
19442 following options:
19443
19444 @gccoptlist{-maltivec -mfprnd -mhard-float -mmfcrf -mmultiple @gol
19445 -mpopcntb -mpopcntd -mpowerpc64 @gol
19446 -mpowerpc-gpopt -mpowerpc-gfxopt -msingle-float -mdouble-float @gol
19447 -msimple-fpu -mstring -mmulhw -mdlmzb -mmfpgpr -mvsx @gol
19448 -mcrypto -mdirect-move -mpower8-fusion -mpower8-vector @gol
19449 -mquad-memory -mquad-memory-atomic}
19450
19451 The particular options set for any particular CPU varies between
19452 compiler versions, depending on what setting seems to produce optimal
19453 code for that CPU; it doesn't necessarily reflect the actual hardware's
19454 capabilities. If you wish to set an individual option to a particular
19455 value, you may specify it after the @option{-mcpu} option, like
19456 @option{-mcpu=970 -mno-altivec}.
19457
19458 On AIX, the @option{-maltivec} and @option{-mpowerpc64} options are
19459 not enabled or disabled by the @option{-mcpu} option at present because
19460 AIX does not have full support for these options. You may still
19461 enable or disable them individually if you're sure it'll work in your
19462 environment.
19463
19464 @item -mtune=@var{cpu_type}
19465 @opindex mtune
19466 Set the instruction scheduling parameters for machine type
19467 @var{cpu_type}, but do not set the architecture type or register usage,
19468 as @option{-mcpu=@var{cpu_type}} does. The same
19469 values for @var{cpu_type} are used for @option{-mtune} as for
19470 @option{-mcpu}. If both are specified, the code generated uses the
19471 architecture and registers set by @option{-mcpu}, but the
19472 scheduling parameters set by @option{-mtune}.
19473
19474 @item -mcmodel=small
19475 @opindex mcmodel=small
19476 Generate PowerPC64 code for the small model: The TOC is limited to
19477 64k.
19478
19479 @item -mcmodel=medium
19480 @opindex mcmodel=medium
19481 Generate PowerPC64 code for the medium model: The TOC and other static
19482 data may be up to a total of 4G in size.
19483
19484 @item -mcmodel=large
19485 @opindex mcmodel=large
19486 Generate PowerPC64 code for the large model: The TOC may be up to 4G
19487 in size. Other data and code is only limited by the 64-bit address
19488 space.
19489
19490 @item -maltivec
19491 @itemx -mno-altivec
19492 @opindex maltivec
19493 @opindex mno-altivec
19494 Generate code that uses (does not use) AltiVec instructions, and also
19495 enable the use of built-in functions that allow more direct access to
19496 the AltiVec instruction set. You may also need to set
19497 @option{-mabi=altivec} to adjust the current ABI with AltiVec ABI
19498 enhancements.
19499
19500 When @option{-maltivec} is used, rather than @option{-maltivec=le} or
19501 @option{-maltivec=be}, the element order for Altivec intrinsics such
19502 as @code{vec_splat}, @code{vec_extract}, and @code{vec_insert} will
19503 match array element order corresponding to the endianness of the
19504 target. That is, element zero identifies the leftmost element in a
19505 vector register when targeting a big-endian platform, and identifies
19506 the rightmost element in a vector register when targeting a
19507 little-endian platform.
19508
19509 @item -maltivec=be
19510 @opindex maltivec=be
19511 Generate Altivec instructions using big-endian element order,
19512 regardless of whether the target is big- or little-endian. This is
19513 the default when targeting a big-endian platform.
19514
19515 The element order is used to interpret element numbers in Altivec
19516 intrinsics such as @code{vec_splat}, @code{vec_extract}, and
19517 @code{vec_insert}. By default, these will match array element order
19518 corresponding to the endianness for the target.
19519
19520 @item -maltivec=le
19521 @opindex maltivec=le
19522 Generate Altivec instructions using little-endian element order,
19523 regardless of whether the target is big- or little-endian. This is
19524 the default when targeting a little-endian platform. This option is
19525 currently ignored when targeting a big-endian platform.
19526
19527 The element order is used to interpret element numbers in Altivec
19528 intrinsics such as @code{vec_splat}, @code{vec_extract}, and
19529 @code{vec_insert}. By default, these will match array element order
19530 corresponding to the endianness for the target.
19531
19532 @item -mvrsave
19533 @itemx -mno-vrsave
19534 @opindex mvrsave
19535 @opindex mno-vrsave
19536 Generate VRSAVE instructions when generating AltiVec code.
19537
19538 @item -mgen-cell-microcode
19539 @opindex mgen-cell-microcode
19540 Generate Cell microcode instructions.
19541
19542 @item -mwarn-cell-microcode
19543 @opindex mwarn-cell-microcode
19544 Warn when a Cell microcode instruction is emitted. An example
19545 of a Cell microcode instruction is a variable shift.
19546
19547 @item -msecure-plt
19548 @opindex msecure-plt
19549 Generate code that allows @command{ld} and @command{ld.so}
19550 to build executables and shared
19551 libraries with non-executable @code{.plt} and @code{.got} sections.
19552 This is a PowerPC
19553 32-bit SYSV ABI option.
19554
19555 @item -mbss-plt
19556 @opindex mbss-plt
19557 Generate code that uses a BSS @code{.plt} section that @command{ld.so}
19558 fills in, and
19559 requires @code{.plt} and @code{.got}
19560 sections that are both writable and executable.
19561 This is a PowerPC 32-bit SYSV ABI option.
19562
19563 @item -misel
19564 @itemx -mno-isel
19565 @opindex misel
19566 @opindex mno-isel
19567 This switch enables or disables the generation of ISEL instructions.
19568
19569 @item -misel=@var{yes/no}
19570 This switch has been deprecated. Use @option{-misel} and
19571 @option{-mno-isel} instead.
19572
19573 @item -mspe
19574 @itemx -mno-spe
19575 @opindex mspe
19576 @opindex mno-spe
19577 This switch enables or disables the generation of SPE simd
19578 instructions.
19579
19580 @item -mpaired
19581 @itemx -mno-paired
19582 @opindex mpaired
19583 @opindex mno-paired
19584 This switch enables or disables the generation of PAIRED simd
19585 instructions.
19586
19587 @item -mspe=@var{yes/no}
19588 This option has been deprecated. Use @option{-mspe} and
19589 @option{-mno-spe} instead.
19590
19591 @item -mvsx
19592 @itemx -mno-vsx
19593 @opindex mvsx
19594 @opindex mno-vsx
19595 Generate code that uses (does not use) vector/scalar (VSX)
19596 instructions, and also enable the use of built-in functions that allow
19597 more direct access to the VSX instruction set.
19598
19599 @item -mcrypto
19600 @itemx -mno-crypto
19601 @opindex mcrypto
19602 @opindex mno-crypto
19603 Enable the use (disable) of the built-in functions that allow direct
19604 access to the cryptographic instructions that were added in version
19605 2.07 of the PowerPC ISA.
19606
19607 @item -mdirect-move
19608 @itemx -mno-direct-move
19609 @opindex mdirect-move
19610 @opindex mno-direct-move
19611 Generate code that uses (does not use) the instructions to move data
19612 between the general purpose registers and the vector/scalar (VSX)
19613 registers that were added in version 2.07 of the PowerPC ISA.
19614
19615 @item -mpower8-fusion
19616 @itemx -mno-power8-fusion
19617 @opindex mpower8-fusion
19618 @opindex mno-power8-fusion
19619 Generate code that keeps (does not keeps) some integer operations
19620 adjacent so that the instructions can be fused together on power8 and
19621 later processors.
19622
19623 @item -mpower8-vector
19624 @itemx -mno-power8-vector
19625 @opindex mpower8-vector
19626 @opindex mno-power8-vector
19627 Generate code that uses (does not use) the vector and scalar
19628 instructions that were added in version 2.07 of the PowerPC ISA. Also
19629 enable the use of built-in functions that allow more direct access to
19630 the vector instructions.
19631
19632 @item -mquad-memory
19633 @itemx -mno-quad-memory
19634 @opindex mquad-memory
19635 @opindex mno-quad-memory
19636 Generate code that uses (does not use) the non-atomic quad word memory
19637 instructions. The @option{-mquad-memory} option requires use of
19638 64-bit mode.
19639
19640 @item -mquad-memory-atomic
19641 @itemx -mno-quad-memory-atomic
19642 @opindex mquad-memory-atomic
19643 @opindex mno-quad-memory-atomic
19644 Generate code that uses (does not use) the atomic quad word memory
19645 instructions. The @option{-mquad-memory-atomic} option requires use of
19646 64-bit mode.
19647
19648 @item -mfloat-gprs=@var{yes/single/double/no}
19649 @itemx -mfloat-gprs
19650 @opindex mfloat-gprs
19651 This switch enables or disables the generation of floating-point
19652 operations on the general-purpose registers for architectures that
19653 support it.
19654
19655 The argument @var{yes} or @var{single} enables the use of
19656 single-precision floating-point operations.
19657
19658 The argument @var{double} enables the use of single and
19659 double-precision floating-point operations.
19660
19661 The argument @var{no} disables floating-point operations on the
19662 general-purpose registers.
19663
19664 This option is currently only available on the MPC854x.
19665
19666 @item -m32
19667 @itemx -m64
19668 @opindex m32
19669 @opindex m64
19670 Generate code for 32-bit or 64-bit environments of Darwin and SVR4
19671 targets (including GNU/Linux). The 32-bit environment sets int, long
19672 and pointer to 32 bits and generates code that runs on any PowerPC
19673 variant. The 64-bit environment sets int to 32 bits and long and
19674 pointer to 64 bits, and generates code for PowerPC64, as for
19675 @option{-mpowerpc64}.
19676
19677 @item -mfull-toc
19678 @itemx -mno-fp-in-toc
19679 @itemx -mno-sum-in-toc
19680 @itemx -mminimal-toc
19681 @opindex mfull-toc
19682 @opindex mno-fp-in-toc
19683 @opindex mno-sum-in-toc
19684 @opindex mminimal-toc
19685 Modify generation of the TOC (Table Of Contents), which is created for
19686 every executable file. The @option{-mfull-toc} option is selected by
19687 default. In that case, GCC allocates at least one TOC entry for
19688 each unique non-automatic variable reference in your program. GCC
19689 also places floating-point constants in the TOC@. However, only
19690 16,384 entries are available in the TOC@.
19691
19692 If you receive a linker error message that saying you have overflowed
19693 the available TOC space, you can reduce the amount of TOC space used
19694 with the @option{-mno-fp-in-toc} and @option{-mno-sum-in-toc} options.
19695 @option{-mno-fp-in-toc} prevents GCC from putting floating-point
19696 constants in the TOC and @option{-mno-sum-in-toc} forces GCC to
19697 generate code to calculate the sum of an address and a constant at
19698 run time instead of putting that sum into the TOC@. You may specify one
19699 or both of these options. Each causes GCC to produce very slightly
19700 slower and larger code at the expense of conserving TOC space.
19701
19702 If you still run out of space in the TOC even when you specify both of
19703 these options, specify @option{-mminimal-toc} instead. This option causes
19704 GCC to make only one TOC entry for every file. When you specify this
19705 option, GCC produces code that is slower and larger but which
19706 uses extremely little TOC space. You may wish to use this option
19707 only on files that contain less frequently-executed code.
19708
19709 @item -maix64
19710 @itemx -maix32
19711 @opindex maix64
19712 @opindex maix32
19713 Enable 64-bit AIX ABI and calling convention: 64-bit pointers, 64-bit
19714 @code{long} type, and the infrastructure needed to support them.
19715 Specifying @option{-maix64} implies @option{-mpowerpc64},
19716 while @option{-maix32} disables the 64-bit ABI and
19717 implies @option{-mno-powerpc64}. GCC defaults to @option{-maix32}.
19718
19719 @item -mxl-compat
19720 @itemx -mno-xl-compat
19721 @opindex mxl-compat
19722 @opindex mno-xl-compat
19723 Produce code that conforms more closely to IBM XL compiler semantics
19724 when using AIX-compatible ABI@. Pass floating-point arguments to
19725 prototyped functions beyond the register save area (RSA) on the stack
19726 in addition to argument FPRs. Do not assume that most significant
19727 double in 128-bit long double value is properly rounded when comparing
19728 values and converting to double. Use XL symbol names for long double
19729 support routines.
19730
19731 The AIX calling convention was extended but not initially documented to
19732 handle an obscure K&R C case of calling a function that takes the
19733 address of its arguments with fewer arguments than declared. IBM XL
19734 compilers access floating-point arguments that do not fit in the
19735 RSA from the stack when a subroutine is compiled without
19736 optimization. Because always storing floating-point arguments on the
19737 stack is inefficient and rarely needed, this option is not enabled by
19738 default and only is necessary when calling subroutines compiled by IBM
19739 XL compilers without optimization.
19740
19741 @item -mpe
19742 @opindex mpe
19743 Support @dfn{IBM RS/6000 SP} @dfn{Parallel Environment} (PE)@. Link an
19744 application written to use message passing with special startup code to
19745 enable the application to run. The system must have PE installed in the
19746 standard location (@file{/usr/lpp/ppe.poe/}), or the @file{specs} file
19747 must be overridden with the @option{-specs=} option to specify the
19748 appropriate directory location. The Parallel Environment does not
19749 support threads, so the @option{-mpe} option and the @option{-pthread}
19750 option are incompatible.
19751
19752 @item -malign-natural
19753 @itemx -malign-power
19754 @opindex malign-natural
19755 @opindex malign-power
19756 On AIX, 32-bit Darwin, and 64-bit PowerPC GNU/Linux, the option
19757 @option{-malign-natural} overrides the ABI-defined alignment of larger
19758 types, such as floating-point doubles, on their natural size-based boundary.
19759 The option @option{-malign-power} instructs GCC to follow the ABI-specified
19760 alignment rules. GCC defaults to the standard alignment defined in the ABI@.
19761
19762 On 64-bit Darwin, natural alignment is the default, and @option{-malign-power}
19763 is not supported.
19764
19765 @item -msoft-float
19766 @itemx -mhard-float
19767 @opindex msoft-float
19768 @opindex mhard-float
19769 Generate code that does not use (uses) the floating-point register set.
19770 Software floating-point emulation is provided if you use the
19771 @option{-msoft-float} option, and pass the option to GCC when linking.
19772
19773 @item -msingle-float
19774 @itemx -mdouble-float
19775 @opindex msingle-float
19776 @opindex mdouble-float
19777 Generate code for single- or double-precision floating-point operations.
19778 @option{-mdouble-float} implies @option{-msingle-float}.
19779
19780 @item -msimple-fpu
19781 @opindex msimple-fpu
19782 Do not generate @code{sqrt} and @code{div} instructions for hardware
19783 floating-point unit.
19784
19785 @item -mfpu=@var{name}
19786 @opindex mfpu
19787 Specify type of floating-point unit. Valid values for @var{name} are
19788 @samp{sp_lite} (equivalent to @option{-msingle-float -msimple-fpu}),
19789 @samp{dp_lite} (equivalent to @option{-mdouble-float -msimple-fpu}),
19790 @samp{sp_full} (equivalent to @option{-msingle-float}),
19791 and @samp{dp_full} (equivalent to @option{-mdouble-float}).
19792
19793 @item -mxilinx-fpu
19794 @opindex mxilinx-fpu
19795 Perform optimizations for the floating-point unit on Xilinx PPC 405/440.
19796
19797 @item -mmultiple
19798 @itemx -mno-multiple
19799 @opindex mmultiple
19800 @opindex mno-multiple
19801 Generate code that uses (does not use) the load multiple word
19802 instructions and the store multiple word instructions. These
19803 instructions are generated by default on POWER systems, and not
19804 generated on PowerPC systems. Do not use @option{-mmultiple} on little-endian
19805 PowerPC systems, since those instructions do not work when the
19806 processor is in little-endian mode. The exceptions are PPC740 and
19807 PPC750 which permit these instructions in little-endian mode.
19808
19809 @item -mstring
19810 @itemx -mno-string
19811 @opindex mstring
19812 @opindex mno-string
19813 Generate code that uses (does not use) the load string instructions
19814 and the store string word instructions to save multiple registers and
19815 do small block moves. These instructions are generated by default on
19816 POWER systems, and not generated on PowerPC systems. Do not use
19817 @option{-mstring} on little-endian PowerPC systems, since those
19818 instructions do not work when the processor is in little-endian mode.
19819 The exceptions are PPC740 and PPC750 which permit these instructions
19820 in little-endian mode.
19821
19822 @item -mupdate
19823 @itemx -mno-update
19824 @opindex mupdate
19825 @opindex mno-update
19826 Generate code that uses (does not use) the load or store instructions
19827 that update the base register to the address of the calculated memory
19828 location. These instructions are generated by default. If you use
19829 @option{-mno-update}, there is a small window between the time that the
19830 stack pointer is updated and the address of the previous frame is
19831 stored, which means code that walks the stack frame across interrupts or
19832 signals may get corrupted data.
19833
19834 @item -mavoid-indexed-addresses
19835 @itemx -mno-avoid-indexed-addresses
19836 @opindex mavoid-indexed-addresses
19837 @opindex mno-avoid-indexed-addresses
19838 Generate code that tries to avoid (not avoid) the use of indexed load
19839 or store instructions. These instructions can incur a performance
19840 penalty on Power6 processors in certain situations, such as when
19841 stepping through large arrays that cross a 16M boundary. This option
19842 is enabled by default when targeting Power6 and disabled otherwise.
19843
19844 @item -mfused-madd
19845 @itemx -mno-fused-madd
19846 @opindex mfused-madd
19847 @opindex mno-fused-madd
19848 Generate code that uses (does not use) the floating-point multiply and
19849 accumulate instructions. These instructions are generated by default
19850 if hardware floating point is used. The machine-dependent
19851 @option{-mfused-madd} option is now mapped to the machine-independent
19852 @option{-ffp-contract=fast} option, and @option{-mno-fused-madd} is
19853 mapped to @option{-ffp-contract=off}.
19854
19855 @item -mmulhw
19856 @itemx -mno-mulhw
19857 @opindex mmulhw
19858 @opindex mno-mulhw
19859 Generate code that uses (does not use) the half-word multiply and
19860 multiply-accumulate instructions on the IBM 405, 440, 464 and 476 processors.
19861 These instructions are generated by default when targeting those
19862 processors.
19863
19864 @item -mdlmzb
19865 @itemx -mno-dlmzb
19866 @opindex mdlmzb
19867 @opindex mno-dlmzb
19868 Generate code that uses (does not use) the string-search @samp{dlmzb}
19869 instruction on the IBM 405, 440, 464 and 476 processors. This instruction is
19870 generated by default when targeting those processors.
19871
19872 @item -mno-bit-align
19873 @itemx -mbit-align
19874 @opindex mno-bit-align
19875 @opindex mbit-align
19876 On System V.4 and embedded PowerPC systems do not (do) force structures
19877 and unions that contain bit-fields to be aligned to the base type of the
19878 bit-field.
19879
19880 For example, by default a structure containing nothing but 8
19881 @code{unsigned} bit-fields of length 1 is aligned to a 4-byte
19882 boundary and has a size of 4 bytes. By using @option{-mno-bit-align},
19883 the structure is aligned to a 1-byte boundary and is 1 byte in
19884 size.
19885
19886 @item -mno-strict-align
19887 @itemx -mstrict-align
19888 @opindex mno-strict-align
19889 @opindex mstrict-align
19890 On System V.4 and embedded PowerPC systems do not (do) assume that
19891 unaligned memory references are handled by the system.
19892
19893 @item -mrelocatable
19894 @itemx -mno-relocatable
19895 @opindex mrelocatable
19896 @opindex mno-relocatable
19897 Generate code that allows (does not allow) a static executable to be
19898 relocated to a different address at run time. A simple embedded
19899 PowerPC system loader should relocate the entire contents of
19900 @code{.got2} and 4-byte locations listed in the @code{.fixup} section,
19901 a table of 32-bit addresses generated by this option. For this to
19902 work, all objects linked together must be compiled with
19903 @option{-mrelocatable} or @option{-mrelocatable-lib}.
19904 @option{-mrelocatable} code aligns the stack to an 8-byte boundary.
19905
19906 @item -mrelocatable-lib
19907 @itemx -mno-relocatable-lib
19908 @opindex mrelocatable-lib
19909 @opindex mno-relocatable-lib
19910 Like @option{-mrelocatable}, @option{-mrelocatable-lib} generates a
19911 @code{.fixup} section to allow static executables to be relocated at
19912 run time, but @option{-mrelocatable-lib} does not use the smaller stack
19913 alignment of @option{-mrelocatable}. Objects compiled with
19914 @option{-mrelocatable-lib} may be linked with objects compiled with
19915 any combination of the @option{-mrelocatable} options.
19916
19917 @item -mno-toc
19918 @itemx -mtoc
19919 @opindex mno-toc
19920 @opindex mtoc
19921 On System V.4 and embedded PowerPC systems do not (do) assume that
19922 register 2 contains a pointer to a global area pointing to the addresses
19923 used in the program.
19924
19925 @item -mlittle
19926 @itemx -mlittle-endian
19927 @opindex mlittle
19928 @opindex mlittle-endian
19929 On System V.4 and embedded PowerPC systems compile code for the
19930 processor in little-endian mode. The @option{-mlittle-endian} option is
19931 the same as @option{-mlittle}.
19932
19933 @item -mbig
19934 @itemx -mbig-endian
19935 @opindex mbig
19936 @opindex mbig-endian
19937 On System V.4 and embedded PowerPC systems compile code for the
19938 processor in big-endian mode. The @option{-mbig-endian} option is
19939 the same as @option{-mbig}.
19940
19941 @item -mdynamic-no-pic
19942 @opindex mdynamic-no-pic
19943 On Darwin and Mac OS X systems, compile code so that it is not
19944 relocatable, but that its external references are relocatable. The
19945 resulting code is suitable for applications, but not shared
19946 libraries.
19947
19948 @item -msingle-pic-base
19949 @opindex msingle-pic-base
19950 Treat the register used for PIC addressing as read-only, rather than
19951 loading it in the prologue for each function. The runtime system is
19952 responsible for initializing this register with an appropriate value
19953 before execution begins.
19954
19955 @item -mprioritize-restricted-insns=@var{priority}
19956 @opindex mprioritize-restricted-insns
19957 This option controls the priority that is assigned to
19958 dispatch-slot restricted instructions during the second scheduling
19959 pass. The argument @var{priority} takes the value @samp{0}, @samp{1},
19960 or @samp{2} to assign no, highest, or second-highest (respectively)
19961 priority to dispatch-slot restricted
19962 instructions.
19963
19964 @item -msched-costly-dep=@var{dependence_type}
19965 @opindex msched-costly-dep
19966 This option controls which dependences are considered costly
19967 by the target during instruction scheduling. The argument
19968 @var{dependence_type} takes one of the following values:
19969
19970 @table @asis
19971 @item @samp{no}
19972 No dependence is costly.
19973
19974 @item @samp{all}
19975 All dependences are costly.
19976
19977 @item @samp{true_store_to_load}
19978 A true dependence from store to load is costly.
19979
19980 @item @samp{store_to_load}
19981 Any dependence from store to load is costly.
19982
19983 @item @var{number}
19984 Any dependence for which the latency is greater than or equal to
19985 @var{number} is costly.
19986 @end table
19987
19988 @item -minsert-sched-nops=@var{scheme}
19989 @opindex minsert-sched-nops
19990 This option controls which NOP insertion scheme is used during
19991 the second scheduling pass. The argument @var{scheme} takes one of the
19992 following values:
19993
19994 @table @asis
19995 @item @samp{no}
19996 Don't insert NOPs.
19997
19998 @item @samp{pad}
19999 Pad with NOPs any dispatch group that has vacant issue slots,
20000 according to the scheduler's grouping.
20001
20002 @item @samp{regroup_exact}
20003 Insert NOPs to force costly dependent insns into
20004 separate groups. Insert exactly as many NOPs as needed to force an insn
20005 to a new group, according to the estimated processor grouping.
20006
20007 @item @var{number}
20008 Insert NOPs to force costly dependent insns into
20009 separate groups. Insert @var{number} NOPs to force an insn to a new group.
20010 @end table
20011
20012 @item -mcall-sysv
20013 @opindex mcall-sysv
20014 On System V.4 and embedded PowerPC systems compile code using calling
20015 conventions that adhere to the March 1995 draft of the System V
20016 Application Binary Interface, PowerPC processor supplement. This is the
20017 default unless you configured GCC using @samp{powerpc-*-eabiaix}.
20018
20019 @item -mcall-sysv-eabi
20020 @itemx -mcall-eabi
20021 @opindex mcall-sysv-eabi
20022 @opindex mcall-eabi
20023 Specify both @option{-mcall-sysv} and @option{-meabi} options.
20024
20025 @item -mcall-sysv-noeabi
20026 @opindex mcall-sysv-noeabi
20027 Specify both @option{-mcall-sysv} and @option{-mno-eabi} options.
20028
20029 @item -mcall-aixdesc
20030 @opindex m
20031 On System V.4 and embedded PowerPC systems compile code for the AIX
20032 operating system.
20033
20034 @item -mcall-linux
20035 @opindex mcall-linux
20036 On System V.4 and embedded PowerPC systems compile code for the
20037 Linux-based GNU system.
20038
20039 @item -mcall-freebsd
20040 @opindex mcall-freebsd
20041 On System V.4 and embedded PowerPC systems compile code for the
20042 FreeBSD operating system.
20043
20044 @item -mcall-netbsd
20045 @opindex mcall-netbsd
20046 On System V.4 and embedded PowerPC systems compile code for the
20047 NetBSD operating system.
20048
20049 @item -mcall-openbsd
20050 @opindex mcall-netbsd
20051 On System V.4 and embedded PowerPC systems compile code for the
20052 OpenBSD operating system.
20053
20054 @item -maix-struct-return
20055 @opindex maix-struct-return
20056 Return all structures in memory (as specified by the AIX ABI)@.
20057
20058 @item -msvr4-struct-return
20059 @opindex msvr4-struct-return
20060 Return structures smaller than 8 bytes in registers (as specified by the
20061 SVR4 ABI)@.
20062
20063 @item -mabi=@var{abi-type}
20064 @opindex mabi
20065 Extend the current ABI with a particular extension, or remove such extension.
20066 Valid values are @var{altivec}, @var{no-altivec}, @var{spe},
20067 @var{no-spe}, @var{ibmlongdouble}, @var{ieeelongdouble},
20068 @var{elfv1}, @var{elfv2}@.
20069
20070 @item -mabi=spe
20071 @opindex mabi=spe
20072 Extend the current ABI with SPE ABI extensions. This does not change
20073 the default ABI, instead it adds the SPE ABI extensions to the current
20074 ABI@.
20075
20076 @item -mabi=no-spe
20077 @opindex mabi=no-spe
20078 Disable Book-E SPE ABI extensions for the current ABI@.
20079
20080 @item -mabi=ibmlongdouble
20081 @opindex mabi=ibmlongdouble
20082 Change the current ABI to use IBM extended-precision long double.
20083 This is a PowerPC 32-bit SYSV ABI option.
20084
20085 @item -mabi=ieeelongdouble
20086 @opindex mabi=ieeelongdouble
20087 Change the current ABI to use IEEE extended-precision long double.
20088 This is a PowerPC 32-bit Linux ABI option.
20089
20090 @item -mabi=elfv1
20091 @opindex mabi=elfv1
20092 Change the current ABI to use the ELFv1 ABI.
20093 This is the default ABI for big-endian PowerPC 64-bit Linux.
20094 Overriding the default ABI requires special system support and is
20095 likely to fail in spectacular ways.
20096
20097 @item -mabi=elfv2
20098 @opindex mabi=elfv2
20099 Change the current ABI to use the ELFv2 ABI.
20100 This is the default ABI for little-endian PowerPC 64-bit Linux.
20101 Overriding the default ABI requires special system support and is
20102 likely to fail in spectacular ways.
20103
20104 @item -mprototype
20105 @itemx -mno-prototype
20106 @opindex mprototype
20107 @opindex mno-prototype
20108 On System V.4 and embedded PowerPC systems assume that all calls to
20109 variable argument functions are properly prototyped. Otherwise, the
20110 compiler must insert an instruction before every non-prototyped call to
20111 set or clear bit 6 of the condition code register (@var{CR}) to
20112 indicate whether floating-point values are passed in the floating-point
20113 registers in case the function takes variable arguments. With
20114 @option{-mprototype}, only calls to prototyped variable argument functions
20115 set or clear the bit.
20116
20117 @item -msim
20118 @opindex msim
20119 On embedded PowerPC systems, assume that the startup module is called
20120 @file{sim-crt0.o} and that the standard C libraries are @file{libsim.a} and
20121 @file{libc.a}. This is the default for @samp{powerpc-*-eabisim}
20122 configurations.
20123
20124 @item -mmvme
20125 @opindex mmvme
20126 On embedded PowerPC systems, assume that the startup module is called
20127 @file{crt0.o} and the standard C libraries are @file{libmvme.a} and
20128 @file{libc.a}.
20129
20130 @item -mads
20131 @opindex mads
20132 On embedded PowerPC systems, assume that the startup module is called
20133 @file{crt0.o} and the standard C libraries are @file{libads.a} and
20134 @file{libc.a}.
20135
20136 @item -myellowknife
20137 @opindex myellowknife
20138 On embedded PowerPC systems, assume that the startup module is called
20139 @file{crt0.o} and the standard C libraries are @file{libyk.a} and
20140 @file{libc.a}.
20141
20142 @item -mvxworks
20143 @opindex mvxworks
20144 On System V.4 and embedded PowerPC systems, specify that you are
20145 compiling for a VxWorks system.
20146
20147 @item -memb
20148 @opindex memb
20149 On embedded PowerPC systems, set the @var{PPC_EMB} bit in the ELF flags
20150 header to indicate that @samp{eabi} extended relocations are used.
20151
20152 @item -meabi
20153 @itemx -mno-eabi
20154 @opindex meabi
20155 @opindex mno-eabi
20156 On System V.4 and embedded PowerPC systems do (do not) adhere to the
20157 Embedded Applications Binary Interface (EABI), which is a set of
20158 modifications to the System V.4 specifications. Selecting @option{-meabi}
20159 means that the stack is aligned to an 8-byte boundary, a function
20160 @code{__eabi} is called from @code{main} to set up the EABI
20161 environment, and the @option{-msdata} option can use both @code{r2} and
20162 @code{r13} to point to two separate small data areas. Selecting
20163 @option{-mno-eabi} means that the stack is aligned to a 16-byte boundary,
20164 no EABI initialization function is called from @code{main}, and the
20165 @option{-msdata} option only uses @code{r13} to point to a single
20166 small data area. The @option{-meabi} option is on by default if you
20167 configured GCC using one of the @samp{powerpc*-*-eabi*} options.
20168
20169 @item -msdata=eabi
20170 @opindex msdata=eabi
20171 On System V.4 and embedded PowerPC systems, put small initialized
20172 @code{const} global and static data in the @samp{.sdata2} section, which
20173 is pointed to by register @code{r2}. Put small initialized
20174 non-@code{const} global and static data in the @samp{.sdata} section,
20175 which is pointed to by register @code{r13}. Put small uninitialized
20176 global and static data in the @samp{.sbss} section, which is adjacent to
20177 the @samp{.sdata} section. The @option{-msdata=eabi} option is
20178 incompatible with the @option{-mrelocatable} option. The
20179 @option{-msdata=eabi} option also sets the @option{-memb} option.
20180
20181 @item -msdata=sysv
20182 @opindex msdata=sysv
20183 On System V.4 and embedded PowerPC systems, put small global and static
20184 data in the @samp{.sdata} section, which is pointed to by register
20185 @code{r13}. Put small uninitialized global and static data in the
20186 @samp{.sbss} section, which is adjacent to the @samp{.sdata} section.
20187 The @option{-msdata=sysv} option is incompatible with the
20188 @option{-mrelocatable} option.
20189
20190 @item -msdata=default
20191 @itemx -msdata
20192 @opindex msdata=default
20193 @opindex msdata
20194 On System V.4 and embedded PowerPC systems, if @option{-meabi} is used,
20195 compile code the same as @option{-msdata=eabi}, otherwise compile code the
20196 same as @option{-msdata=sysv}.
20197
20198 @item -msdata=data
20199 @opindex msdata=data
20200 On System V.4 and embedded PowerPC systems, put small global
20201 data in the @samp{.sdata} section. Put small uninitialized global
20202 data in the @samp{.sbss} section. Do not use register @code{r13}
20203 to address small data however. This is the default behavior unless
20204 other @option{-msdata} options are used.
20205
20206 @item -msdata=none
20207 @itemx -mno-sdata
20208 @opindex msdata=none
20209 @opindex mno-sdata
20210 On embedded PowerPC systems, put all initialized global and static data
20211 in the @samp{.data} section, and all uninitialized data in the
20212 @samp{.bss} section.
20213
20214 @item -mblock-move-inline-limit=@var{num}
20215 @opindex mblock-move-inline-limit
20216 Inline all block moves (such as calls to @code{memcpy} or structure
20217 copies) less than or equal to @var{num} bytes. The minimum value for
20218 @var{num} is 32 bytes on 32-bit targets and 64 bytes on 64-bit
20219 targets. The default value is target-specific.
20220
20221 @item -G @var{num}
20222 @opindex G
20223 @cindex smaller data references (PowerPC)
20224 @cindex .sdata/.sdata2 references (PowerPC)
20225 On embedded PowerPC systems, put global and static items less than or
20226 equal to @var{num} bytes into the small data or BSS sections instead of
20227 the normal data or BSS section. By default, @var{num} is 8. The
20228 @option{-G @var{num}} switch is also passed to the linker.
20229 All modules should be compiled with the same @option{-G @var{num}} value.
20230
20231 @item -mregnames
20232 @itemx -mno-regnames
20233 @opindex mregnames
20234 @opindex mno-regnames
20235 On System V.4 and embedded PowerPC systems do (do not) emit register
20236 names in the assembly language output using symbolic forms.
20237
20238 @item -mlongcall
20239 @itemx -mno-longcall
20240 @opindex mlongcall
20241 @opindex mno-longcall
20242 By default assume that all calls are far away so that a longer and more
20243 expensive calling sequence is required. This is required for calls
20244 farther than 32 megabytes (33,554,432 bytes) from the current location.
20245 A short call is generated if the compiler knows
20246 the call cannot be that far away. This setting can be overridden by
20247 the @code{shortcall} function attribute, or by @code{#pragma
20248 longcall(0)}.
20249
20250 Some linkers are capable of detecting out-of-range calls and generating
20251 glue code on the fly. On these systems, long calls are unnecessary and
20252 generate slower code. As of this writing, the AIX linker can do this,
20253 as can the GNU linker for PowerPC/64. It is planned to add this feature
20254 to the GNU linker for 32-bit PowerPC systems as well.
20255
20256 On Darwin/PPC systems, @code{#pragma longcall} generates @code{jbsr
20257 callee, L42}, plus a @dfn{branch island} (glue code). The two target
20258 addresses represent the callee and the branch island. The
20259 Darwin/PPC linker prefers the first address and generates a @code{bl
20260 callee} if the PPC @code{bl} instruction reaches the callee directly;
20261 otherwise, the linker generates @code{bl L42} to call the branch
20262 island. The branch island is appended to the body of the
20263 calling function; it computes the full 32-bit address of the callee
20264 and jumps to it.
20265
20266 On Mach-O (Darwin) systems, this option directs the compiler emit to
20267 the glue for every direct call, and the Darwin linker decides whether
20268 to use or discard it.
20269
20270 In the future, GCC may ignore all longcall specifications
20271 when the linker is known to generate glue.
20272
20273 @item -mtls-markers
20274 @itemx -mno-tls-markers
20275 @opindex mtls-markers
20276 @opindex mno-tls-markers
20277 Mark (do not mark) calls to @code{__tls_get_addr} with a relocation
20278 specifying the function argument. The relocation allows the linker to
20279 reliably associate function call with argument setup instructions for
20280 TLS optimization, which in turn allows GCC to better schedule the
20281 sequence.
20282
20283 @item -pthread
20284 @opindex pthread
20285 Adds support for multithreading with the @dfn{pthreads} library.
20286 This option sets flags for both the preprocessor and linker.
20287
20288 @item -mrecip
20289 @itemx -mno-recip
20290 @opindex mrecip
20291 This option enables use of the reciprocal estimate and
20292 reciprocal square root estimate instructions with additional
20293 Newton-Raphson steps to increase precision instead of doing a divide or
20294 square root and divide for floating-point arguments. You should use
20295 the @option{-ffast-math} option when using @option{-mrecip} (or at
20296 least @option{-funsafe-math-optimizations},
20297 @option{-finite-math-only}, @option{-freciprocal-math} and
20298 @option{-fno-trapping-math}). Note that while the throughput of the
20299 sequence is generally higher than the throughput of the non-reciprocal
20300 instruction, the precision of the sequence can be decreased by up to 2
20301 ulp (i.e.@: the inverse of 1.0 equals 0.99999994) for reciprocal square
20302 roots.
20303
20304 @item -mrecip=@var{opt}
20305 @opindex mrecip=opt
20306 This option controls which reciprocal estimate instructions
20307 may be used. @var{opt} is a comma-separated list of options, which may
20308 be preceded by a @code{!} to invert the option:
20309 @code{all}: enable all estimate instructions,
20310 @code{default}: enable the default instructions, equivalent to @option{-mrecip},
20311 @code{none}: disable all estimate instructions, equivalent to @option{-mno-recip};
20312 @code{div}: enable the reciprocal approximation instructions for both single and double precision;
20313 @code{divf}: enable the single-precision reciprocal approximation instructions;
20314 @code{divd}: enable the double-precision reciprocal approximation instructions;
20315 @code{rsqrt}: enable the reciprocal square root approximation instructions for both single and double precision;
20316 @code{rsqrtf}: enable the single-precision reciprocal square root approximation instructions;
20317 @code{rsqrtd}: enable the double-precision reciprocal square root approximation instructions;
20318
20319 So, for example, @option{-mrecip=all,!rsqrtd} enables
20320 all of the reciprocal estimate instructions, except for the
20321 @code{FRSQRTE}, @code{XSRSQRTEDP}, and @code{XVRSQRTEDP} instructions
20322 which handle the double-precision reciprocal square root calculations.
20323
20324 @item -mrecip-precision
20325 @itemx -mno-recip-precision
20326 @opindex mrecip-precision
20327 Assume (do not assume) that the reciprocal estimate instructions
20328 provide higher-precision estimates than is mandated by the PowerPC
20329 ABI. Selecting @option{-mcpu=power6}, @option{-mcpu=power7} or
20330 @option{-mcpu=power8} automatically selects @option{-mrecip-precision}.
20331 The double-precision square root estimate instructions are not generated by
20332 default on low-precision machines, since they do not provide an
20333 estimate that converges after three steps.
20334
20335 @item -mveclibabi=@var{type}
20336 @opindex mveclibabi
20337 Specifies the ABI type to use for vectorizing intrinsics using an
20338 external library. The only type supported at present is @code{mass},
20339 which specifies to use IBM's Mathematical Acceleration Subsystem
20340 (MASS) libraries for vectorizing intrinsics using external libraries.
20341 GCC currently emits calls to @code{acosd2}, @code{acosf4},
20342 @code{acoshd2}, @code{acoshf4}, @code{asind2}, @code{asinf4},
20343 @code{asinhd2}, @code{asinhf4}, @code{atan2d2}, @code{atan2f4},
20344 @code{atand2}, @code{atanf4}, @code{atanhd2}, @code{atanhf4},
20345 @code{cbrtd2}, @code{cbrtf4}, @code{cosd2}, @code{cosf4},
20346 @code{coshd2}, @code{coshf4}, @code{erfcd2}, @code{erfcf4},
20347 @code{erfd2}, @code{erff4}, @code{exp2d2}, @code{exp2f4},
20348 @code{expd2}, @code{expf4}, @code{expm1d2}, @code{expm1f4},
20349 @code{hypotd2}, @code{hypotf4}, @code{lgammad2}, @code{lgammaf4},
20350 @code{log10d2}, @code{log10f4}, @code{log1pd2}, @code{log1pf4},
20351 @code{log2d2}, @code{log2f4}, @code{logd2}, @code{logf4},
20352 @code{powd2}, @code{powf4}, @code{sind2}, @code{sinf4}, @code{sinhd2},
20353 @code{sinhf4}, @code{sqrtd2}, @code{sqrtf4}, @code{tand2},
20354 @code{tanf4}, @code{tanhd2}, and @code{tanhf4} when generating code
20355 for power7. Both @option{-ftree-vectorize} and
20356 @option{-funsafe-math-optimizations} must also be enabled. The MASS
20357 libraries must be specified at link time.
20358
20359 @item -mfriz
20360 @itemx -mno-friz
20361 @opindex mfriz
20362 Generate (do not generate) the @code{friz} instruction when the
20363 @option{-funsafe-math-optimizations} option is used to optimize
20364 rounding of floating-point values to 64-bit integer and back to floating
20365 point. The @code{friz} instruction does not return the same value if
20366 the floating-point number is too large to fit in an integer.
20367
20368 @item -mpointers-to-nested-functions
20369 @itemx -mno-pointers-to-nested-functions
20370 @opindex mpointers-to-nested-functions
20371 Generate (do not generate) code to load up the static chain register
20372 (@var{r11}) when calling through a pointer on AIX and 64-bit Linux
20373 systems where a function pointer points to a 3-word descriptor giving
20374 the function address, TOC value to be loaded in register @var{r2}, and
20375 static chain value to be loaded in register @var{r11}. The
20376 @option{-mpointers-to-nested-functions} is on by default. You cannot
20377 call through pointers to nested functions or pointers
20378 to functions compiled in other languages that use the static chain if
20379 you use the @option{-mno-pointers-to-nested-functions}.
20380
20381 @item -msave-toc-indirect
20382 @itemx -mno-save-toc-indirect
20383 @opindex msave-toc-indirect
20384 Generate (do not generate) code to save the TOC value in the reserved
20385 stack location in the function prologue if the function calls through
20386 a pointer on AIX and 64-bit Linux systems. If the TOC value is not
20387 saved in the prologue, it is saved just before the call through the
20388 pointer. The @option{-mno-save-toc-indirect} option is the default.
20389
20390 @item -mcompat-align-parm
20391 @itemx -mno-compat-align-parm
20392 @opindex mcompat-align-parm
20393 Generate (do not generate) code to pass structure parameters with a
20394 maximum alignment of 64 bits, for compatibility with older versions
20395 of GCC.
20396
20397 Older versions of GCC (prior to 4.9.0) incorrectly did not align a
20398 structure parameter on a 128-bit boundary when that structure contained
20399 a member requiring 128-bit alignment. This is corrected in more
20400 recent versions of GCC. This option may be used to generate code
20401 that is compatible with functions compiled with older versions of
20402 GCC.
20403
20404 The @option{-mno-compat-align-parm} option is the default.
20405 @end table
20406
20407 @node RX Options
20408 @subsection RX Options
20409 @cindex RX Options
20410
20411 These command-line options are defined for RX targets:
20412
20413 @table @gcctabopt
20414 @item -m64bit-doubles
20415 @itemx -m32bit-doubles
20416 @opindex m64bit-doubles
20417 @opindex m32bit-doubles
20418 Make the @code{double} data type be 64 bits (@option{-m64bit-doubles})
20419 or 32 bits (@option{-m32bit-doubles}) in size. The default is
20420 @option{-m32bit-doubles}. @emph{Note} RX floating-point hardware only
20421 works on 32-bit values, which is why the default is
20422 @option{-m32bit-doubles}.
20423
20424 @item -fpu
20425 @itemx -nofpu
20426 @opindex fpu
20427 @opindex nofpu
20428 Enables (@option{-fpu}) or disables (@option{-nofpu}) the use of RX
20429 floating-point hardware. The default is enabled for the @var{RX600}
20430 series and disabled for the @var{RX200} series.
20431
20432 Floating-point instructions are only generated for 32-bit floating-point
20433 values, however, so the FPU hardware is not used for doubles if the
20434 @option{-m64bit-doubles} option is used.
20435
20436 @emph{Note} If the @option{-fpu} option is enabled then
20437 @option{-funsafe-math-optimizations} is also enabled automatically.
20438 This is because the RX FPU instructions are themselves unsafe.
20439
20440 @item -mcpu=@var{name}
20441 @opindex -mcpu
20442 Selects the type of RX CPU to be targeted. Currently three types are
20443 supported, the generic @var{RX600} and @var{RX200} series hardware and
20444 the specific @var{RX610} CPU. The default is @var{RX600}.
20445
20446 The only difference between @var{RX600} and @var{RX610} is that the
20447 @var{RX610} does not support the @code{MVTIPL} instruction.
20448
20449 The @var{RX200} series does not have a hardware floating-point unit
20450 and so @option{-nofpu} is enabled by default when this type is
20451 selected.
20452
20453 @item -mbig-endian-data
20454 @itemx -mlittle-endian-data
20455 @opindex mbig-endian-data
20456 @opindex mlittle-endian-data
20457 Store data (but not code) in the big-endian format. The default is
20458 @option{-mlittle-endian-data}, i.e.@: to store data in the little-endian
20459 format.
20460
20461 @item -msmall-data-limit=@var{N}
20462 @opindex msmall-data-limit
20463 Specifies the maximum size in bytes of global and static variables
20464 which can be placed into the small data area. Using the small data
20465 area can lead to smaller and faster code, but the size of area is
20466 limited and it is up to the programmer to ensure that the area does
20467 not overflow. Also when the small data area is used one of the RX's
20468 registers (usually @code{r13}) is reserved for use pointing to this
20469 area, so it is no longer available for use by the compiler. This
20470 could result in slower and/or larger code if variables are pushed onto
20471 the stack instead of being held in this register.
20472
20473 Note, common variables (variables that have not been initialized) and
20474 constants are not placed into the small data area as they are assigned
20475 to other sections in the output executable.
20476
20477 The default value is zero, which disables this feature. Note, this
20478 feature is not enabled by default with higher optimization levels
20479 (@option{-O2} etc) because of the potentially detrimental effects of
20480 reserving a register. It is up to the programmer to experiment and
20481 discover whether this feature is of benefit to their program. See the
20482 description of the @option{-mpid} option for a description of how the
20483 actual register to hold the small data area pointer is chosen.
20484
20485 @item -msim
20486 @itemx -mno-sim
20487 @opindex msim
20488 @opindex mno-sim
20489 Use the simulator runtime. The default is to use the libgloss
20490 board-specific runtime.
20491
20492 @item -mas100-syntax
20493 @itemx -mno-as100-syntax
20494 @opindex mas100-syntax
20495 @opindex mno-as100-syntax
20496 When generating assembler output use a syntax that is compatible with
20497 Renesas's AS100 assembler. This syntax can also be handled by the GAS
20498 assembler, but it has some restrictions so it is not generated by default.
20499
20500 @item -mmax-constant-size=@var{N}
20501 @opindex mmax-constant-size
20502 Specifies the maximum size, in bytes, of a constant that can be used as
20503 an operand in a RX instruction. Although the RX instruction set does
20504 allow constants of up to 4 bytes in length to be used in instructions,
20505 a longer value equates to a longer instruction. Thus in some
20506 circumstances it can be beneficial to restrict the size of constants
20507 that are used in instructions. Constants that are too big are instead
20508 placed into a constant pool and referenced via register indirection.
20509
20510 The value @var{N} can be between 0 and 4. A value of 0 (the default)
20511 or 4 means that constants of any size are allowed.
20512
20513 @item -mrelax
20514 @opindex mrelax
20515 Enable linker relaxation. Linker relaxation is a process whereby the
20516 linker attempts to reduce the size of a program by finding shorter
20517 versions of various instructions. Disabled by default.
20518
20519 @item -mint-register=@var{N}
20520 @opindex mint-register
20521 Specify the number of registers to reserve for fast interrupt handler
20522 functions. The value @var{N} can be between 0 and 4. A value of 1
20523 means that register @code{r13} is reserved for the exclusive use
20524 of fast interrupt handlers. A value of 2 reserves @code{r13} and
20525 @code{r12}. A value of 3 reserves @code{r13}, @code{r12} and
20526 @code{r11}, and a value of 4 reserves @code{r13} through @code{r10}.
20527 A value of 0, the default, does not reserve any registers.
20528
20529 @item -msave-acc-in-interrupts
20530 @opindex msave-acc-in-interrupts
20531 Specifies that interrupt handler functions should preserve the
20532 accumulator register. This is only necessary if normal code might use
20533 the accumulator register, for example because it performs 64-bit
20534 multiplications. The default is to ignore the accumulator as this
20535 makes the interrupt handlers faster.
20536
20537 @item -mpid
20538 @itemx -mno-pid
20539 @opindex mpid
20540 @opindex mno-pid
20541 Enables the generation of position independent data. When enabled any
20542 access to constant data is done via an offset from a base address
20543 held in a register. This allows the location of constant data to be
20544 determined at run time without requiring the executable to be
20545 relocated, which is a benefit to embedded applications with tight
20546 memory constraints. Data that can be modified is not affected by this
20547 option.
20548
20549 Note, using this feature reserves a register, usually @code{r13}, for
20550 the constant data base address. This can result in slower and/or
20551 larger code, especially in complicated functions.
20552
20553 The actual register chosen to hold the constant data base address
20554 depends upon whether the @option{-msmall-data-limit} and/or the
20555 @option{-mint-register} command-line options are enabled. Starting
20556 with register @code{r13} and proceeding downwards, registers are
20557 allocated first to satisfy the requirements of @option{-mint-register},
20558 then @option{-mpid} and finally @option{-msmall-data-limit}. Thus it
20559 is possible for the small data area register to be @code{r8} if both
20560 @option{-mint-register=4} and @option{-mpid} are specified on the
20561 command line.
20562
20563 By default this feature is not enabled. The default can be restored
20564 via the @option{-mno-pid} command-line option.
20565
20566 @item -mno-warn-multiple-fast-interrupts
20567 @itemx -mwarn-multiple-fast-interrupts
20568 @opindex mno-warn-multiple-fast-interrupts
20569 @opindex mwarn-multiple-fast-interrupts
20570 Prevents GCC from issuing a warning message if it finds more than one
20571 fast interrupt handler when it is compiling a file. The default is to
20572 issue a warning for each extra fast interrupt handler found, as the RX
20573 only supports one such interrupt.
20574
20575 @end table
20576
20577 @emph{Note:} The generic GCC command-line option @option{-ffixed-@var{reg}}
20578 has special significance to the RX port when used with the
20579 @code{interrupt} function attribute. This attribute indicates a
20580 function intended to process fast interrupts. GCC ensures
20581 that it only uses the registers @code{r10}, @code{r11}, @code{r12}
20582 and/or @code{r13} and only provided that the normal use of the
20583 corresponding registers have been restricted via the
20584 @option{-ffixed-@var{reg}} or @option{-mint-register} command-line
20585 options.
20586
20587 @node S/390 and zSeries Options
20588 @subsection S/390 and zSeries Options
20589 @cindex S/390 and zSeries Options
20590
20591 These are the @samp{-m} options defined for the S/390 and zSeries architecture.
20592
20593 @table @gcctabopt
20594 @item -mhard-float
20595 @itemx -msoft-float
20596 @opindex mhard-float
20597 @opindex msoft-float
20598 Use (do not use) the hardware floating-point instructions and registers
20599 for floating-point operations. When @option{-msoft-float} is specified,
20600 functions in @file{libgcc.a} are used to perform floating-point
20601 operations. When @option{-mhard-float} is specified, the compiler
20602 generates IEEE floating-point instructions. This is the default.
20603
20604 @item -mhard-dfp
20605 @itemx -mno-hard-dfp
20606 @opindex mhard-dfp
20607 @opindex mno-hard-dfp
20608 Use (do not use) the hardware decimal-floating-point instructions for
20609 decimal-floating-point operations. When @option{-mno-hard-dfp} is
20610 specified, functions in @file{libgcc.a} are used to perform
20611 decimal-floating-point operations. When @option{-mhard-dfp} is
20612 specified, the compiler generates decimal-floating-point hardware
20613 instructions. This is the default for @option{-march=z9-ec} or higher.
20614
20615 @item -mlong-double-64
20616 @itemx -mlong-double-128
20617 @opindex mlong-double-64
20618 @opindex mlong-double-128
20619 These switches control the size of @code{long double} type. A size
20620 of 64 bits makes the @code{long double} type equivalent to the @code{double}
20621 type. This is the default.
20622
20623 @item -mbackchain
20624 @itemx -mno-backchain
20625 @opindex mbackchain
20626 @opindex mno-backchain
20627 Store (do not store) the address of the caller's frame as backchain pointer
20628 into the callee's stack frame.
20629 A backchain may be needed to allow debugging using tools that do not understand
20630 DWARF 2 call frame information.
20631 When @option{-mno-packed-stack} is in effect, the backchain pointer is stored
20632 at the bottom of the stack frame; when @option{-mpacked-stack} is in effect,
20633 the backchain is placed into the topmost word of the 96/160 byte register
20634 save area.
20635
20636 In general, code compiled with @option{-mbackchain} is call-compatible with
20637 code compiled with @option{-mmo-backchain}; however, use of the backchain
20638 for debugging purposes usually requires that the whole binary is built with
20639 @option{-mbackchain}. Note that the combination of @option{-mbackchain},
20640 @option{-mpacked-stack} and @option{-mhard-float} is not supported. In order
20641 to build a linux kernel use @option{-msoft-float}.
20642
20643 The default is to not maintain the backchain.
20644
20645 @item -mpacked-stack
20646 @itemx -mno-packed-stack
20647 @opindex mpacked-stack
20648 @opindex mno-packed-stack
20649 Use (do not use) the packed stack layout. When @option{-mno-packed-stack} is
20650 specified, the compiler uses the all fields of the 96/160 byte register save
20651 area only for their default purpose; unused fields still take up stack space.
20652 When @option{-mpacked-stack} is specified, register save slots are densely
20653 packed at the top of the register save area; unused space is reused for other
20654 purposes, allowing for more efficient use of the available stack space.
20655 However, when @option{-mbackchain} is also in effect, the topmost word of
20656 the save area is always used to store the backchain, and the return address
20657 register is always saved two words below the backchain.
20658
20659 As long as the stack frame backchain is not used, code generated with
20660 @option{-mpacked-stack} is call-compatible with code generated with
20661 @option{-mno-packed-stack}. Note that some non-FSF releases of GCC 2.95 for
20662 S/390 or zSeries generated code that uses the stack frame backchain at run
20663 time, not just for debugging purposes. Such code is not call-compatible
20664 with code compiled with @option{-mpacked-stack}. Also, note that the
20665 combination of @option{-mbackchain},
20666 @option{-mpacked-stack} and @option{-mhard-float} is not supported. In order
20667 to build a linux kernel use @option{-msoft-float}.
20668
20669 The default is to not use the packed stack layout.
20670
20671 @item -msmall-exec
20672 @itemx -mno-small-exec
20673 @opindex msmall-exec
20674 @opindex mno-small-exec
20675 Generate (or do not generate) code using the @code{bras} instruction
20676 to do subroutine calls.
20677 This only works reliably if the total executable size does not
20678 exceed 64k. The default is to use the @code{basr} instruction instead,
20679 which does not have this limitation.
20680
20681 @item -m64
20682 @itemx -m31
20683 @opindex m64
20684 @opindex m31
20685 When @option{-m31} is specified, generate code compliant to the
20686 GNU/Linux for S/390 ABI@. When @option{-m64} is specified, generate
20687 code compliant to the GNU/Linux for zSeries ABI@. This allows GCC in
20688 particular to generate 64-bit instructions. For the @samp{s390}
20689 targets, the default is @option{-m31}, while the @samp{s390x}
20690 targets default to @option{-m64}.
20691
20692 @item -mzarch
20693 @itemx -mesa
20694 @opindex mzarch
20695 @opindex mesa
20696 When @option{-mzarch} is specified, generate code using the
20697 instructions available on z/Architecture.
20698 When @option{-mesa} is specified, generate code using the
20699 instructions available on ESA/390. Note that @option{-mesa} is
20700 not possible with @option{-m64}.
20701 When generating code compliant to the GNU/Linux for S/390 ABI,
20702 the default is @option{-mesa}. When generating code compliant
20703 to the GNU/Linux for zSeries ABI, the default is @option{-mzarch}.
20704
20705 @item -mmvcle
20706 @itemx -mno-mvcle
20707 @opindex mmvcle
20708 @opindex mno-mvcle
20709 Generate (or do not generate) code using the @code{mvcle} instruction
20710 to perform block moves. When @option{-mno-mvcle} is specified,
20711 use a @code{mvc} loop instead. This is the default unless optimizing for
20712 size.
20713
20714 @item -mdebug
20715 @itemx -mno-debug
20716 @opindex mdebug
20717 @opindex mno-debug
20718 Print (or do not print) additional debug information when compiling.
20719 The default is to not print debug information.
20720
20721 @item -march=@var{cpu-type}
20722 @opindex march
20723 Generate code that runs on @var{cpu-type}, which is the name of a system
20724 representing a certain processor type. Possible values for
20725 @var{cpu-type} are @samp{g5}, @samp{g6}, @samp{z900}, @samp{z990},
20726 @samp{z9-109}, @samp{z9-ec} and @samp{z10}.
20727 When generating code using the instructions available on z/Architecture,
20728 the default is @option{-march=z900}. Otherwise, the default is
20729 @option{-march=g5}.
20730
20731 @item -mtune=@var{cpu-type}
20732 @opindex mtune
20733 Tune to @var{cpu-type} everything applicable about the generated code,
20734 except for the ABI and the set of available instructions.
20735 The list of @var{cpu-type} values is the same as for @option{-march}.
20736 The default is the value used for @option{-march}.
20737
20738 @item -mtpf-trace
20739 @itemx -mno-tpf-trace
20740 @opindex mtpf-trace
20741 @opindex mno-tpf-trace
20742 Generate code that adds (does not add) in TPF OS specific branches to trace
20743 routines in the operating system. This option is off by default, even
20744 when compiling for the TPF OS@.
20745
20746 @item -mfused-madd
20747 @itemx -mno-fused-madd
20748 @opindex mfused-madd
20749 @opindex mno-fused-madd
20750 Generate code that uses (does not use) the floating-point multiply and
20751 accumulate instructions. These instructions are generated by default if
20752 hardware floating point is used.
20753
20754 @item -mwarn-framesize=@var{framesize}
20755 @opindex mwarn-framesize
20756 Emit a warning if the current function exceeds the given frame size. Because
20757 this is a compile-time check it doesn't need to be a real problem when the program
20758 runs. It is intended to identify functions that most probably cause
20759 a stack overflow. It is useful to be used in an environment with limited stack
20760 size e.g.@: the linux kernel.
20761
20762 @item -mwarn-dynamicstack
20763 @opindex mwarn-dynamicstack
20764 Emit a warning if the function calls @code{alloca} or uses dynamically-sized
20765 arrays. This is generally a bad idea with a limited stack size.
20766
20767 @item -mstack-guard=@var{stack-guard}
20768 @itemx -mstack-size=@var{stack-size}
20769 @opindex mstack-guard
20770 @opindex mstack-size
20771 If these options are provided the S/390 back end emits additional instructions in
20772 the function prologue that trigger a trap if the stack size is @var{stack-guard}
20773 bytes above the @var{stack-size} (remember that the stack on S/390 grows downward).
20774 If the @var{stack-guard} option is omitted the smallest power of 2 larger than
20775 the frame size of the compiled function is chosen.
20776 These options are intended to be used to help debugging stack overflow problems.
20777 The additionally emitted code causes only little overhead and hence can also be
20778 used in production-like systems without greater performance degradation. The given
20779 values have to be exact powers of 2 and @var{stack-size} has to be greater than
20780 @var{stack-guard} without exceeding 64k.
20781 In order to be efficient the extra code makes the assumption that the stack starts
20782 at an address aligned to the value given by @var{stack-size}.
20783 The @var{stack-guard} option can only be used in conjunction with @var{stack-size}.
20784
20785 @item -mhotpatch[=@var{halfwords}]
20786 @itemx -mno-hotpatch
20787 @opindex mhotpatch
20788 If the hotpatch option is enabled, a ``hot-patching'' function
20789 prologue is generated for all functions in the compilation unit.
20790 The funtion label is prepended with the given number of two-byte
20791 Nop instructions (@var{halfwords}, maximum 1000000) or 12 Nop
20792 instructions if no argument is present. Functions with a
20793 hot-patching prologue are never inlined automatically, and a
20794 hot-patching prologue is never generated for functions
20795 that are explicitly inline.
20796
20797 This option can be overridden for individual functions with the
20798 @code{hotpatch} attribute.
20799 @end table
20800
20801 @node Score Options
20802 @subsection Score Options
20803 @cindex Score Options
20804
20805 These options are defined for Score implementations:
20806
20807 @table @gcctabopt
20808 @item -meb
20809 @opindex meb
20810 Compile code for big-endian mode. This is the default.
20811
20812 @item -mel
20813 @opindex mel
20814 Compile code for little-endian mode.
20815
20816 @item -mnhwloop
20817 @opindex mnhwloop
20818 Disable generation of @code{bcnz} instructions.
20819
20820 @item -muls
20821 @opindex muls
20822 Enable generation of unaligned load and store instructions.
20823
20824 @item -mmac
20825 @opindex mmac
20826 Enable the use of multiply-accumulate instructions. Disabled by default.
20827
20828 @item -mscore5
20829 @opindex mscore5
20830 Specify the SCORE5 as the target architecture.
20831
20832 @item -mscore5u
20833 @opindex mscore5u
20834 Specify the SCORE5U of the target architecture.
20835
20836 @item -mscore7
20837 @opindex mscore7
20838 Specify the SCORE7 as the target architecture. This is the default.
20839
20840 @item -mscore7d
20841 @opindex mscore7d
20842 Specify the SCORE7D as the target architecture.
20843 @end table
20844
20845 @node SH Options
20846 @subsection SH Options
20847
20848 These @samp{-m} options are defined for the SH implementations:
20849
20850 @table @gcctabopt
20851 @item -m1
20852 @opindex m1
20853 Generate code for the SH1.
20854
20855 @item -m2
20856 @opindex m2
20857 Generate code for the SH2.
20858
20859 @item -m2e
20860 Generate code for the SH2e.
20861
20862 @item -m2a-nofpu
20863 @opindex m2a-nofpu
20864 Generate code for the SH2a without FPU, or for a SH2a-FPU in such a way
20865 that the floating-point unit is not used.
20866
20867 @item -m2a-single-only
20868 @opindex m2a-single-only
20869 Generate code for the SH2a-FPU, in such a way that no double-precision
20870 floating-point operations are used.
20871
20872 @item -m2a-single
20873 @opindex m2a-single
20874 Generate code for the SH2a-FPU assuming the floating-point unit is in
20875 single-precision mode by default.
20876
20877 @item -m2a
20878 @opindex m2a
20879 Generate code for the SH2a-FPU assuming the floating-point unit is in
20880 double-precision mode by default.
20881
20882 @item -m3
20883 @opindex m3
20884 Generate code for the SH3.
20885
20886 @item -m3e
20887 @opindex m3e
20888 Generate code for the SH3e.
20889
20890 @item -m4-nofpu
20891 @opindex m4-nofpu
20892 Generate code for the SH4 without a floating-point unit.
20893
20894 @item -m4-single-only
20895 @opindex m4-single-only
20896 Generate code for the SH4 with a floating-point unit that only
20897 supports single-precision arithmetic.
20898
20899 @item -m4-single
20900 @opindex m4-single
20901 Generate code for the SH4 assuming the floating-point unit is in
20902 single-precision mode by default.
20903
20904 @item -m4
20905 @opindex m4
20906 Generate code for the SH4.
20907
20908 @item -m4-100
20909 @opindex m4-100
20910 Generate code for SH4-100.
20911
20912 @item -m4-100-nofpu
20913 @opindex m4-100-nofpu
20914 Generate code for SH4-100 in such a way that the
20915 floating-point unit is not used.
20916
20917 @item -m4-100-single
20918 @opindex m4-100-single
20919 Generate code for SH4-100 assuming the floating-point unit is in
20920 single-precision mode by default.
20921
20922 @item -m4-100-single-only
20923 @opindex m4-100-single-only
20924 Generate code for SH4-100 in such a way that no double-precision
20925 floating-point operations are used.
20926
20927 @item -m4-200
20928 @opindex m4-200
20929 Generate code for SH4-200.
20930
20931 @item -m4-200-nofpu
20932 @opindex m4-200-nofpu
20933 Generate code for SH4-200 without in such a way that the
20934 floating-point unit is not used.
20935
20936 @item -m4-200-single
20937 @opindex m4-200-single
20938 Generate code for SH4-200 assuming the floating-point unit is in
20939 single-precision mode by default.
20940
20941 @item -m4-200-single-only
20942 @opindex m4-200-single-only
20943 Generate code for SH4-200 in such a way that no double-precision
20944 floating-point operations are used.
20945
20946 @item -m4-300
20947 @opindex m4-300
20948 Generate code for SH4-300.
20949
20950 @item -m4-300-nofpu
20951 @opindex m4-300-nofpu
20952 Generate code for SH4-300 without in such a way that the
20953 floating-point unit is not used.
20954
20955 @item -m4-300-single
20956 @opindex m4-300-single
20957 Generate code for SH4-300 in such a way that no double-precision
20958 floating-point operations are used.
20959
20960 @item -m4-300-single-only
20961 @opindex m4-300-single-only
20962 Generate code for SH4-300 in such a way that no double-precision
20963 floating-point operations are used.
20964
20965 @item -m4-340
20966 @opindex m4-340
20967 Generate code for SH4-340 (no MMU, no FPU).
20968
20969 @item -m4-500
20970 @opindex m4-500
20971 Generate code for SH4-500 (no FPU). Passes @option{-isa=sh4-nofpu} to the
20972 assembler.
20973
20974 @item -m4a-nofpu
20975 @opindex m4a-nofpu
20976 Generate code for the SH4al-dsp, or for a SH4a in such a way that the
20977 floating-point unit is not used.
20978
20979 @item -m4a-single-only
20980 @opindex m4a-single-only
20981 Generate code for the SH4a, in such a way that no double-precision
20982 floating-point operations are used.
20983
20984 @item -m4a-single
20985 @opindex m4a-single
20986 Generate code for the SH4a assuming the floating-point unit is in
20987 single-precision mode by default.
20988
20989 @item -m4a
20990 @opindex m4a
20991 Generate code for the SH4a.
20992
20993 @item -m4al
20994 @opindex m4al
20995 Same as @option{-m4a-nofpu}, except that it implicitly passes
20996 @option{-dsp} to the assembler. GCC doesn't generate any DSP
20997 instructions at the moment.
20998
20999 @item -m5-32media
21000 @opindex m5-32media
21001 Generate 32-bit code for SHmedia.
21002
21003 @item -m5-32media-nofpu
21004 @opindex m5-32media-nofpu
21005 Generate 32-bit code for SHmedia in such a way that the
21006 floating-point unit is not used.
21007
21008 @item -m5-64media
21009 @opindex m5-64media
21010 Generate 64-bit code for SHmedia.
21011
21012 @item -m5-64media-nofpu
21013 @opindex m5-64media-nofpu
21014 Generate 64-bit code for SHmedia in such a way that the
21015 floating-point unit is not used.
21016
21017 @item -m5-compact
21018 @opindex m5-compact
21019 Generate code for SHcompact.
21020
21021 @item -m5-compact-nofpu
21022 @opindex m5-compact-nofpu
21023 Generate code for SHcompact in such a way that the
21024 floating-point unit is not used.
21025
21026 @item -mb
21027 @opindex mb
21028 Compile code for the processor in big-endian mode.
21029
21030 @item -ml
21031 @opindex ml
21032 Compile code for the processor in little-endian mode.
21033
21034 @item -mdalign
21035 @opindex mdalign
21036 Align doubles at 64-bit boundaries. Note that this changes the calling
21037 conventions, and thus some functions from the standard C library do
21038 not work unless you recompile it first with @option{-mdalign}.
21039
21040 @item -mrelax
21041 @opindex mrelax
21042 Shorten some address references at link time, when possible; uses the
21043 linker option @option{-relax}.
21044
21045 @item -mbigtable
21046 @opindex mbigtable
21047 Use 32-bit offsets in @code{switch} tables. The default is to use
21048 16-bit offsets.
21049
21050 @item -mbitops
21051 @opindex mbitops
21052 Enable the use of bit manipulation instructions on SH2A.
21053
21054 @item -mfmovd
21055 @opindex mfmovd
21056 Enable the use of the instruction @code{fmovd}. Check @option{-mdalign} for
21057 alignment constraints.
21058
21059 @item -mrenesas
21060 @opindex mrenesas
21061 Comply with the calling conventions defined by Renesas.
21062
21063 @item -mno-renesas
21064 @opindex mno-renesas
21065 Comply with the calling conventions defined for GCC before the Renesas
21066 conventions were available. This option is the default for all
21067 targets of the SH toolchain.
21068
21069 @item -mnomacsave
21070 @opindex mnomacsave
21071 Mark the @code{MAC} register as call-clobbered, even if
21072 @option{-mrenesas} is given.
21073
21074 @item -mieee
21075 @itemx -mno-ieee
21076 @opindex mieee
21077 @opindex mno-ieee
21078 Control the IEEE compliance of floating-point comparisons, which affects the
21079 handling of cases where the result of a comparison is unordered. By default
21080 @option{-mieee} is implicitly enabled. If @option{-ffinite-math-only} is
21081 enabled @option{-mno-ieee} is implicitly set, which results in faster
21082 floating-point greater-equal and less-equal comparisons. The implcit settings
21083 can be overridden by specifying either @option{-mieee} or @option{-mno-ieee}.
21084
21085 @item -minline-ic_invalidate
21086 @opindex minline-ic_invalidate
21087 Inline code to invalidate instruction cache entries after setting up
21088 nested function trampolines.
21089 This option has no effect if @option{-musermode} is in effect and the selected
21090 code generation option (e.g. @option{-m4}) does not allow the use of the @code{icbi}
21091 instruction.
21092 If the selected code generation option does not allow the use of the @code{icbi}
21093 instruction, and @option{-musermode} is not in effect, the inlined code
21094 manipulates the instruction cache address array directly with an associative
21095 write. This not only requires privileged mode at run time, but it also
21096 fails if the cache line had been mapped via the TLB and has become unmapped.
21097
21098 @item -misize
21099 @opindex misize
21100 Dump instruction size and location in the assembly code.
21101
21102 @item -mpadstruct
21103 @opindex mpadstruct
21104 This option is deprecated. It pads structures to multiple of 4 bytes,
21105 which is incompatible with the SH ABI@.
21106
21107 @item -matomic-model=@var{model}
21108 @opindex matomic-model=@var{model}
21109 Sets the model of atomic operations and additional parameters as a comma
21110 separated list. For details on the atomic built-in functions see
21111 @ref{__atomic Builtins}. The following models and parameters are supported:
21112
21113 @table @samp
21114
21115 @item none
21116 Disable compiler generated atomic sequences and emit library calls for atomic
21117 operations. This is the default if the target is not @code{sh*-*-linux*}.
21118
21119 @item soft-gusa
21120 Generate GNU/Linux compatible gUSA software atomic sequences for the atomic
21121 built-in functions. The generated atomic sequences require additional support
21122 from the interrupt/exception handling code of the system and are only suitable
21123 for SH3* and SH4* single-core systems. This option is enabled by default when
21124 the target is @code{sh*-*-linux*} and SH3* or SH4*. When the target is SH4A,
21125 this option will also partially utilize the hardware atomic instructions
21126 @code{movli.l} and @code{movco.l} to create more efficient code, unless
21127 @samp{strict} is specified.
21128
21129 @item soft-tcb
21130 Generate software atomic sequences that use a variable in the thread control
21131 block. This is a variation of the gUSA sequences which can also be used on
21132 SH1* and SH2* targets. The generated atomic sequences require additional
21133 support from the interrupt/exception handling code of the system and are only
21134 suitable for single-core systems. When using this model, the @samp{gbr-offset=}
21135 parameter has to be specified as well.
21136
21137 @item soft-imask
21138 Generate software atomic sequences that temporarily disable interrupts by
21139 setting @code{SR.IMASK = 1111}. This model works only when the program runs
21140 in privileged mode and is only suitable for single-core systems. Additional
21141 support from the interrupt/exception handling code of the system is not
21142 required. This model is enabled by default when the target is
21143 @code{sh*-*-linux*} and SH1* or SH2*.
21144
21145 @item hard-llcs
21146 Generate hardware atomic sequences using the @code{movli.l} and @code{movco.l}
21147 instructions only. This is only available on SH4A and is suitable for
21148 multi-core systems. Since the hardware instructions support only 32 bit atomic
21149 variables access to 8 or 16 bit variables is emulated with 32 bit accesses.
21150 Code compiled with this option will also be compatible with other software
21151 atomic model interrupt/exception handling systems if executed on an SH4A
21152 system. Additional support from the interrupt/exception handling code of the
21153 system is not required for this model.
21154
21155 @item gbr-offset=
21156 This parameter specifies the offset in bytes of the variable in the thread
21157 control block structure that should be used by the generated atomic sequences
21158 when the @samp{soft-tcb} model has been selected. For other models this
21159 parameter is ignored. The specified value must be an integer multiple of four
21160 and in the range 0-1020.
21161
21162 @item strict
21163 This parameter prevents mixed usage of multiple atomic models, even though they
21164 would be compatible, and will make the compiler generate atomic sequences of the
21165 specified model only.
21166
21167 @end table
21168
21169 @item -mtas
21170 @opindex mtas
21171 Generate the @code{tas.b} opcode for @code{__atomic_test_and_set}.
21172 Notice that depending on the particular hardware and software configuration
21173 this can degrade overall performance due to the operand cache line flushes
21174 that are implied by the @code{tas.b} instruction. On multi-core SH4A
21175 processors the @code{tas.b} instruction must be used with caution since it
21176 can result in data corruption for certain cache configurations.
21177
21178 @item -mprefergot
21179 @opindex mprefergot
21180 When generating position-independent code, emit function calls using
21181 the Global Offset Table instead of the Procedure Linkage Table.
21182
21183 @item -musermode
21184 @itemx -mno-usermode
21185 @opindex musermode
21186 @opindex mno-usermode
21187 Don't allow (allow) the compiler generating privileged mode code. Specifying
21188 @option{-musermode} also implies @option{-mno-inline-ic_invalidate} if the
21189 inlined code would not work in user mode. @option{-musermode} is the default
21190 when the target is @code{sh*-*-linux*}. If the target is SH1* or SH2*
21191 @option{-musermode} has no effect, since there is no user mode.
21192
21193 @item -multcost=@var{number}
21194 @opindex multcost=@var{number}
21195 Set the cost to assume for a multiply insn.
21196
21197 @item -mdiv=@var{strategy}
21198 @opindex mdiv=@var{strategy}
21199 Set the division strategy to be used for integer division operations.
21200 For SHmedia @var{strategy} can be one of:
21201
21202 @table @samp
21203
21204 @item fp
21205 Performs the operation in floating point. This has a very high latency,
21206 but needs only a few instructions, so it might be a good choice if
21207 your code has enough easily-exploitable ILP to allow the compiler to
21208 schedule the floating-point instructions together with other instructions.
21209 Division by zero causes a floating-point exception.
21210
21211 @item inv
21212 Uses integer operations to calculate the inverse of the divisor,
21213 and then multiplies the dividend with the inverse. This strategy allows
21214 CSE and hoisting of the inverse calculation. Division by zero calculates
21215 an unspecified result, but does not trap.
21216
21217 @item inv:minlat
21218 A variant of @samp{inv} where, if no CSE or hoisting opportunities
21219 have been found, or if the entire operation has been hoisted to the same
21220 place, the last stages of the inverse calculation are intertwined with the
21221 final multiply to reduce the overall latency, at the expense of using a few
21222 more instructions, and thus offering fewer scheduling opportunities with
21223 other code.
21224
21225 @item call
21226 Calls a library function that usually implements the @samp{inv:minlat}
21227 strategy.
21228 This gives high code density for @code{m5-*media-nofpu} compilations.
21229
21230 @item call2
21231 Uses a different entry point of the same library function, where it
21232 assumes that a pointer to a lookup table has already been set up, which
21233 exposes the pointer load to CSE and code hoisting optimizations.
21234
21235 @item inv:call
21236 @itemx inv:call2
21237 @itemx inv:fp
21238 Use the @samp{inv} algorithm for initial
21239 code generation, but if the code stays unoptimized, revert to the @samp{call},
21240 @samp{call2}, or @samp{fp} strategies, respectively. Note that the
21241 potentially-trapping side effect of division by zero is carried by a
21242 separate instruction, so it is possible that all the integer instructions
21243 are hoisted out, but the marker for the side effect stays where it is.
21244 A recombination to floating-point operations or a call is not possible
21245 in that case.
21246
21247 @item inv20u
21248 @itemx inv20l
21249 Variants of the @samp{inv:minlat} strategy. In the case
21250 that the inverse calculation is not separated from the multiply, they speed
21251 up division where the dividend fits into 20 bits (plus sign where applicable)
21252 by inserting a test to skip a number of operations in this case; this test
21253 slows down the case of larger dividends. @samp{inv20u} assumes the case of a such
21254 a small dividend to be unlikely, and @samp{inv20l} assumes it to be likely.
21255
21256 @end table
21257
21258 For targets other than SHmedia @var{strategy} can be one of:
21259
21260 @table @samp
21261
21262 @item call-div1
21263 Calls a library function that uses the single-step division instruction
21264 @code{div1} to perform the operation. Division by zero calculates an
21265 unspecified result and does not trap. This is the default except for SH4,
21266 SH2A and SHcompact.
21267
21268 @item call-fp
21269 Calls a library function that performs the operation in double precision
21270 floating point. Division by zero causes a floating-point exception. This is
21271 the default for SHcompact with FPU. Specifying this for targets that do not
21272 have a double precision FPU will default to @code{call-div1}.
21273
21274 @item call-table
21275 Calls a library function that uses a lookup table for small divisors and
21276 the @code{div1} instruction with case distinction for larger divisors. Division
21277 by zero calculates an unspecified result and does not trap. This is the default
21278 for SH4. Specifying this for targets that do not have dynamic shift
21279 instructions will default to @code{call-div1}.
21280
21281 @end table
21282
21283 When a division strategy has not been specified the default strategy will be
21284 selected based on the current target. For SH2A the default strategy is to
21285 use the @code{divs} and @code{divu} instructions instead of library function
21286 calls.
21287
21288 @item -maccumulate-outgoing-args
21289 @opindex maccumulate-outgoing-args
21290 Reserve space once for outgoing arguments in the function prologue rather
21291 than around each call. Generally beneficial for performance and size. Also
21292 needed for unwinding to avoid changing the stack frame around conditional code.
21293
21294 @item -mdivsi3_libfunc=@var{name}
21295 @opindex mdivsi3_libfunc=@var{name}
21296 Set the name of the library function used for 32-bit signed division to
21297 @var{name}.
21298 This only affects the name used in the @samp{call} and @samp{inv:call}
21299 division strategies, and the compiler still expects the same
21300 sets of input/output/clobbered registers as if this option were not present.
21301
21302 @item -mfixed-range=@var{register-range}
21303 @opindex mfixed-range
21304 Generate code treating the given register range as fixed registers.
21305 A fixed register is one that the register allocator can not use. This is
21306 useful when compiling kernel code. A register range is specified as
21307 two registers separated by a dash. Multiple register ranges can be
21308 specified separated by a comma.
21309
21310 @item -mindexed-addressing
21311 @opindex mindexed-addressing
21312 Enable the use of the indexed addressing mode for SHmedia32/SHcompact.
21313 This is only safe if the hardware and/or OS implement 32-bit wrap-around
21314 semantics for the indexed addressing mode. The architecture allows the
21315 implementation of processors with 64-bit MMU, which the OS could use to
21316 get 32-bit addressing, but since no current hardware implementation supports
21317 this or any other way to make the indexed addressing mode safe to use in
21318 the 32-bit ABI, the default is @option{-mno-indexed-addressing}.
21319
21320 @item -mgettrcost=@var{number}
21321 @opindex mgettrcost=@var{number}
21322 Set the cost assumed for the @code{gettr} instruction to @var{number}.
21323 The default is 2 if @option{-mpt-fixed} is in effect, 100 otherwise.
21324
21325 @item -mpt-fixed
21326 @opindex mpt-fixed
21327 Assume @code{pt*} instructions won't trap. This generally generates
21328 better-scheduled code, but is unsafe on current hardware.
21329 The current architecture
21330 definition says that @code{ptabs} and @code{ptrel} trap when the target
21331 anded with 3 is 3.
21332 This has the unintentional effect of making it unsafe to schedule these
21333 instructions before a branch, or hoist them out of a loop. For example,
21334 @code{__do_global_ctors}, a part of @file{libgcc}
21335 that runs constructors at program
21336 startup, calls functions in a list which is delimited by @minus{}1. With the
21337 @option{-mpt-fixed} option, the @code{ptabs} is done before testing against @minus{}1.
21338 That means that all the constructors run a bit more quickly, but when
21339 the loop comes to the end of the list, the program crashes because @code{ptabs}
21340 loads @minus{}1 into a target register.
21341
21342 Since this option is unsafe for any
21343 hardware implementing the current architecture specification, the default
21344 is @option{-mno-pt-fixed}. Unless specified explicitly with
21345 @option{-mgettrcost}, @option{-mno-pt-fixed} also implies @option{-mgettrcost=100};
21346 this deters register allocation from using target registers for storing
21347 ordinary integers.
21348
21349 @item -minvalid-symbols
21350 @opindex minvalid-symbols
21351 Assume symbols might be invalid. Ordinary function symbols generated by
21352 the compiler are always valid to load with
21353 @code{movi}/@code{shori}/@code{ptabs} or
21354 @code{movi}/@code{shori}/@code{ptrel},
21355 but with assembler and/or linker tricks it is possible
21356 to generate symbols that cause @code{ptabs} or @code{ptrel} to trap.
21357 This option is only meaningful when @option{-mno-pt-fixed} is in effect.
21358 It prevents cross-basic-block CSE, hoisting and most scheduling
21359 of symbol loads. The default is @option{-mno-invalid-symbols}.
21360
21361 @item -mbranch-cost=@var{num}
21362 @opindex mbranch-cost=@var{num}
21363 Assume @var{num} to be the cost for a branch instruction. Higher numbers
21364 make the compiler try to generate more branch-free code if possible.
21365 If not specified the value is selected depending on the processor type that
21366 is being compiled for.
21367
21368 @item -mzdcbranch
21369 @itemx -mno-zdcbranch
21370 @opindex mzdcbranch
21371 @opindex mno-zdcbranch
21372 Assume (do not assume) that zero displacement conditional branch instructions
21373 @code{bt} and @code{bf} are fast. If @option{-mzdcbranch} is specified, the
21374 compiler will try to prefer zero displacement branch code sequences. This is
21375 enabled by default when generating code for SH4 and SH4A. It can be explicitly
21376 disabled by specifying @option{-mno-zdcbranch}.
21377
21378 @item -mfused-madd
21379 @itemx -mno-fused-madd
21380 @opindex mfused-madd
21381 @opindex mno-fused-madd
21382 Generate code that uses (does not use) the floating-point multiply and
21383 accumulate instructions. These instructions are generated by default
21384 if hardware floating point is used. The machine-dependent
21385 @option{-mfused-madd} option is now mapped to the machine-independent
21386 @option{-ffp-contract=fast} option, and @option{-mno-fused-madd} is
21387 mapped to @option{-ffp-contract=off}.
21388
21389 @item -mfsca
21390 @itemx -mno-fsca
21391 @opindex mfsca
21392 @opindex mno-fsca
21393 Allow or disallow the compiler to emit the @code{fsca} instruction for sine
21394 and cosine approximations. The option @code{-mfsca} must be used in
21395 combination with @code{-funsafe-math-optimizations}. It is enabled by default
21396 when generating code for SH4A. Using @code{-mno-fsca} disables sine and cosine
21397 approximations even if @code{-funsafe-math-optimizations} is in effect.
21398
21399 @item -mfsrra
21400 @itemx -mno-fsrra
21401 @opindex mfsrra
21402 @opindex mno-fsrra
21403 Allow or disallow the compiler to emit the @code{fsrra} instruction for
21404 reciprocal square root approximations. The option @code{-mfsrra} must be used
21405 in combination with @code{-funsafe-math-optimizations} and
21406 @code{-ffinite-math-only}. It is enabled by default when generating code for
21407 SH4A. Using @code{-mno-fsrra} disables reciprocal square root approximations
21408 even if @code{-funsafe-math-optimizations} and @code{-ffinite-math-only} are
21409 in effect.
21410
21411 @item -mpretend-cmove
21412 @opindex mpretend-cmove
21413 Prefer zero-displacement conditional branches for conditional move instruction
21414 patterns. This can result in faster code on the SH4 processor.
21415
21416 @end table
21417
21418 @node Solaris 2 Options
21419 @subsection Solaris 2 Options
21420 @cindex Solaris 2 options
21421
21422 These @samp{-m} options are supported on Solaris 2:
21423
21424 @table @gcctabopt
21425 @item -mclear-hwcap
21426 @opindex mclear-hwcap
21427 @option{-mclear-hwcap} tells the compiler to remove the hardware
21428 capabilities generated by the Solaris assembler. This is only necessary
21429 when object files use ISA extensions not supported by the current
21430 machine, but check at runtime whether or not to use them.
21431
21432 @item -mimpure-text
21433 @opindex mimpure-text
21434 @option{-mimpure-text}, used in addition to @option{-shared}, tells
21435 the compiler to not pass @option{-z text} to the linker when linking a
21436 shared object. Using this option, you can link position-dependent
21437 code into a shared object.
21438
21439 @option{-mimpure-text} suppresses the ``relocations remain against
21440 allocatable but non-writable sections'' linker error message.
21441 However, the necessary relocations trigger copy-on-write, and the
21442 shared object is not actually shared across processes. Instead of
21443 using @option{-mimpure-text}, you should compile all source code with
21444 @option{-fpic} or @option{-fPIC}.
21445
21446 @end table
21447
21448 These switches are supported in addition to the above on Solaris 2:
21449
21450 @table @gcctabopt
21451 @item -pthreads
21452 @opindex pthreads
21453 Add support for multithreading using the POSIX threads library. This
21454 option sets flags for both the preprocessor and linker. This option does
21455 not affect the thread safety of object code produced by the compiler or
21456 that of libraries supplied with it.
21457
21458 @item -pthread
21459 @opindex pthread
21460 This is a synonym for @option{-pthreads}.
21461 @end table
21462
21463 @node SPARC Options
21464 @subsection SPARC Options
21465 @cindex SPARC options
21466
21467 These @samp{-m} options are supported on the SPARC:
21468
21469 @table @gcctabopt
21470 @item -mno-app-regs
21471 @itemx -mapp-regs
21472 @opindex mno-app-regs
21473 @opindex mapp-regs
21474 Specify @option{-mapp-regs} to generate output using the global registers
21475 2 through 4, which the SPARC SVR4 ABI reserves for applications. Like the
21476 global register 1, each global register 2 through 4 is then treated as an
21477 allocable register that is clobbered by function calls. This is the default.
21478
21479 To be fully SVR4 ABI-compliant at the cost of some performance loss,
21480 specify @option{-mno-app-regs}. You should compile libraries and system
21481 software with this option.
21482
21483 @item -mflat
21484 @itemx -mno-flat
21485 @opindex mflat
21486 @opindex mno-flat
21487 With @option{-mflat}, the compiler does not generate save/restore instructions
21488 and uses a ``flat'' or single register window model. This model is compatible
21489 with the regular register window model. The local registers and the input
21490 registers (0--5) are still treated as ``call-saved'' registers and are
21491 saved on the stack as needed.
21492
21493 With @option{-mno-flat} (the default), the compiler generates save/restore
21494 instructions (except for leaf functions). This is the normal operating mode.
21495
21496 @item -mfpu
21497 @itemx -mhard-float
21498 @opindex mfpu
21499 @opindex mhard-float
21500 Generate output containing floating-point instructions. This is the
21501 default.
21502
21503 @item -mno-fpu
21504 @itemx -msoft-float
21505 @opindex mno-fpu
21506 @opindex msoft-float
21507 Generate output containing library calls for floating point.
21508 @strong{Warning:} the requisite libraries are not available for all SPARC
21509 targets. Normally the facilities of the machine's usual C compiler are
21510 used, but this cannot be done directly in cross-compilation. You must make
21511 your own arrangements to provide suitable library functions for
21512 cross-compilation. The embedded targets @samp{sparc-*-aout} and
21513 @samp{sparclite-*-*} do provide software floating-point support.
21514
21515 @option{-msoft-float} changes the calling convention in the output file;
21516 therefore, it is only useful if you compile @emph{all} of a program with
21517 this option. In particular, you need to compile @file{libgcc.a}, the
21518 library that comes with GCC, with @option{-msoft-float} in order for
21519 this to work.
21520
21521 @item -mhard-quad-float
21522 @opindex mhard-quad-float
21523 Generate output containing quad-word (long double) floating-point
21524 instructions.
21525
21526 @item -msoft-quad-float
21527 @opindex msoft-quad-float
21528 Generate output containing library calls for quad-word (long double)
21529 floating-point instructions. The functions called are those specified
21530 in the SPARC ABI@. This is the default.
21531
21532 As of this writing, there are no SPARC implementations that have hardware
21533 support for the quad-word floating-point instructions. They all invoke
21534 a trap handler for one of these instructions, and then the trap handler
21535 emulates the effect of the instruction. Because of the trap handler overhead,
21536 this is much slower than calling the ABI library routines. Thus the
21537 @option{-msoft-quad-float} option is the default.
21538
21539 @item -mno-unaligned-doubles
21540 @itemx -munaligned-doubles
21541 @opindex mno-unaligned-doubles
21542 @opindex munaligned-doubles
21543 Assume that doubles have 8-byte alignment. This is the default.
21544
21545 With @option{-munaligned-doubles}, GCC assumes that doubles have 8-byte
21546 alignment only if they are contained in another type, or if they have an
21547 absolute address. Otherwise, it assumes they have 4-byte alignment.
21548 Specifying this option avoids some rare compatibility problems with code
21549 generated by other compilers. It is not the default because it results
21550 in a performance loss, especially for floating-point code.
21551
21552 @item -muser-mode
21553 @itemx -mno-user-mode
21554 @opindex muser-mode
21555 @opindex mno-user-mode
21556 Do not generate code that can only run in supervisor mode. This is relevant
21557 only for the @code{casa} instruction emitted for the LEON3 processor. The
21558 default is @option{-mno-user-mode}.
21559
21560 @item -mno-faster-structs
21561 @itemx -mfaster-structs
21562 @opindex mno-faster-structs
21563 @opindex mfaster-structs
21564 With @option{-mfaster-structs}, the compiler assumes that structures
21565 should have 8-byte alignment. This enables the use of pairs of
21566 @code{ldd} and @code{std} instructions for copies in structure
21567 assignment, in place of twice as many @code{ld} and @code{st} pairs.
21568 However, the use of this changed alignment directly violates the SPARC
21569 ABI@. Thus, it's intended only for use on targets where the developer
21570 acknowledges that their resulting code is not directly in line with
21571 the rules of the ABI@.
21572
21573 @item -mcpu=@var{cpu_type}
21574 @opindex mcpu
21575 Set the instruction set, register set, and instruction scheduling parameters
21576 for machine type @var{cpu_type}. Supported values for @var{cpu_type} are
21577 @samp{v7}, @samp{cypress}, @samp{v8}, @samp{supersparc}, @samp{hypersparc},
21578 @samp{leon}, @samp{leon3}, @samp{leon3v7}, @samp{sparclite}, @samp{f930},
21579 @samp{f934}, @samp{sparclite86x}, @samp{sparclet}, @samp{tsc701}, @samp{v9},
21580 @samp{ultrasparc}, @samp{ultrasparc3}, @samp{niagara}, @samp{niagara2},
21581 @samp{niagara3} and @samp{niagara4}.
21582
21583 Native Solaris and GNU/Linux toolchains also support the value @samp{native},
21584 which selects the best architecture option for the host processor.
21585 @option{-mcpu=native} has no effect if GCC does not recognize
21586 the processor.
21587
21588 Default instruction scheduling parameters are used for values that select
21589 an architecture and not an implementation. These are @samp{v7}, @samp{v8},
21590 @samp{sparclite}, @samp{sparclet}, @samp{v9}.
21591
21592 Here is a list of each supported architecture and their supported
21593 implementations.
21594
21595 @table @asis
21596 @item v7
21597 cypress, leon3v7
21598
21599 @item v8
21600 supersparc, hypersparc, leon, leon3
21601
21602 @item sparclite
21603 f930, f934, sparclite86x
21604
21605 @item sparclet
21606 tsc701
21607
21608 @item v9
21609 ultrasparc, ultrasparc3, niagara, niagara2, niagara3, niagara4
21610 @end table
21611
21612 By default (unless configured otherwise), GCC generates code for the V7
21613 variant of the SPARC architecture. With @option{-mcpu=cypress}, the compiler
21614 additionally optimizes it for the Cypress CY7C602 chip, as used in the
21615 SPARCStation/SPARCServer 3xx series. This is also appropriate for the older
21616 SPARCStation 1, 2, IPX etc.
21617
21618 With @option{-mcpu=v8}, GCC generates code for the V8 variant of the SPARC
21619 architecture. The only difference from V7 code is that the compiler emits
21620 the integer multiply and integer divide instructions which exist in SPARC-V8
21621 but not in SPARC-V7. With @option{-mcpu=supersparc}, the compiler additionally
21622 optimizes it for the SuperSPARC chip, as used in the SPARCStation 10, 1000 and
21623 2000 series.
21624
21625 With @option{-mcpu=sparclite}, GCC generates code for the SPARClite variant of
21626 the SPARC architecture. This adds the integer multiply, integer divide step
21627 and scan (@code{ffs}) instructions which exist in SPARClite but not in SPARC-V7.
21628 With @option{-mcpu=f930}, the compiler additionally optimizes it for the
21629 Fujitsu MB86930 chip, which is the original SPARClite, with no FPU@. With
21630 @option{-mcpu=f934}, the compiler additionally optimizes it for the Fujitsu
21631 MB86934 chip, which is the more recent SPARClite with FPU@.
21632
21633 With @option{-mcpu=sparclet}, GCC generates code for the SPARClet variant of
21634 the SPARC architecture. This adds the integer multiply, multiply/accumulate,
21635 integer divide step and scan (@code{ffs}) instructions which exist in SPARClet
21636 but not in SPARC-V7. With @option{-mcpu=tsc701}, the compiler additionally
21637 optimizes it for the TEMIC SPARClet chip.
21638
21639 With @option{-mcpu=v9}, GCC generates code for the V9 variant of the SPARC
21640 architecture. This adds 64-bit integer and floating-point move instructions,
21641 3 additional floating-point condition code registers and conditional move
21642 instructions. With @option{-mcpu=ultrasparc}, the compiler additionally
21643 optimizes it for the Sun UltraSPARC I/II/IIi chips. With
21644 @option{-mcpu=ultrasparc3}, the compiler additionally optimizes it for the
21645 Sun UltraSPARC III/III+/IIIi/IIIi+/IV/IV+ chips. With
21646 @option{-mcpu=niagara}, the compiler additionally optimizes it for
21647 Sun UltraSPARC T1 chips. With @option{-mcpu=niagara2}, the compiler
21648 additionally optimizes it for Sun UltraSPARC T2 chips. With
21649 @option{-mcpu=niagara3}, the compiler additionally optimizes it for Sun
21650 UltraSPARC T3 chips. With @option{-mcpu=niagara4}, the compiler
21651 additionally optimizes it for Sun UltraSPARC T4 chips.
21652
21653 @item -mtune=@var{cpu_type}
21654 @opindex mtune
21655 Set the instruction scheduling parameters for machine type
21656 @var{cpu_type}, but do not set the instruction set or register set that the
21657 option @option{-mcpu=@var{cpu_type}} does.
21658
21659 The same values for @option{-mcpu=@var{cpu_type}} can be used for
21660 @option{-mtune=@var{cpu_type}}, but the only useful values are those
21661 that select a particular CPU implementation. Those are @samp{cypress},
21662 @samp{supersparc}, @samp{hypersparc}, @samp{leon}, @samp{leon3},
21663 @samp{leon3v7}, @samp{f930}, @samp{f934}, @samp{sparclite86x}, @samp{tsc701},
21664 @samp{ultrasparc}, @samp{ultrasparc3}, @samp{niagara}, @samp{niagara2},
21665 @samp{niagara3} and @samp{niagara4}. With native Solaris and GNU/Linux
21666 toolchains, @samp{native} can also be used.
21667
21668 @item -mv8plus
21669 @itemx -mno-v8plus
21670 @opindex mv8plus
21671 @opindex mno-v8plus
21672 With @option{-mv8plus}, GCC generates code for the SPARC-V8+ ABI@. The
21673 difference from the V8 ABI is that the global and out registers are
21674 considered 64 bits wide. This is enabled by default on Solaris in 32-bit
21675 mode for all SPARC-V9 processors.
21676
21677 @item -mvis
21678 @itemx -mno-vis
21679 @opindex mvis
21680 @opindex mno-vis
21681 With @option{-mvis}, GCC generates code that takes advantage of the UltraSPARC
21682 Visual Instruction Set extensions. The default is @option{-mno-vis}.
21683
21684 @item -mvis2
21685 @itemx -mno-vis2
21686 @opindex mvis2
21687 @opindex mno-vis2
21688 With @option{-mvis2}, GCC generates code that takes advantage of
21689 version 2.0 of the UltraSPARC Visual Instruction Set extensions. The
21690 default is @option{-mvis2} when targeting a cpu that supports such
21691 instructions, such as UltraSPARC-III and later. Setting @option{-mvis2}
21692 also sets @option{-mvis}.
21693
21694 @item -mvis3
21695 @itemx -mno-vis3
21696 @opindex mvis3
21697 @opindex mno-vis3
21698 With @option{-mvis3}, GCC generates code that takes advantage of
21699 version 3.0 of the UltraSPARC Visual Instruction Set extensions. The
21700 default is @option{-mvis3} when targeting a cpu that supports such
21701 instructions, such as niagara-3 and later. Setting @option{-mvis3}
21702 also sets @option{-mvis2} and @option{-mvis}.
21703
21704 @item -mcbcond
21705 @itemx -mno-cbcond
21706 @opindex mcbcond
21707 @opindex mno-cbcond
21708 With @option{-mcbcond}, GCC generates code that takes advantage of
21709 compare-and-branch instructions, as defined in the Sparc Architecture 2011.
21710 The default is @option{-mcbcond} when targeting a cpu that supports such
21711 instructions, such as niagara-4 and later.
21712
21713 @item -mpopc
21714 @itemx -mno-popc
21715 @opindex mpopc
21716 @opindex mno-popc
21717 With @option{-mpopc}, GCC generates code that takes advantage of the UltraSPARC
21718 population count instruction. The default is @option{-mpopc}
21719 when targeting a cpu that supports such instructions, such as Niagara-2 and
21720 later.
21721
21722 @item -mfmaf
21723 @itemx -mno-fmaf
21724 @opindex mfmaf
21725 @opindex mno-fmaf
21726 With @option{-mfmaf}, GCC generates code that takes advantage of the UltraSPARC
21727 Fused Multiply-Add Floating-point extensions. The default is @option{-mfmaf}
21728 when targeting a cpu that supports such instructions, such as Niagara-3 and
21729 later.
21730
21731 @item -mfix-at697f
21732 @opindex mfix-at697f
21733 Enable the documented workaround for the single erratum of the Atmel AT697F
21734 processor (which corresponds to erratum #13 of the AT697E processor).
21735
21736 @item -mfix-ut699
21737 @opindex mfix-ut699
21738 Enable the documented workarounds for the floating-point errata and the data
21739 cache nullify errata of the UT699 processor.
21740 @end table
21741
21742 These @samp{-m} options are supported in addition to the above
21743 on SPARC-V9 processors in 64-bit environments:
21744
21745 @table @gcctabopt
21746 @item -m32
21747 @itemx -m64
21748 @opindex m32
21749 @opindex m64
21750 Generate code for a 32-bit or 64-bit environment.
21751 The 32-bit environment sets int, long and pointer to 32 bits.
21752 The 64-bit environment sets int to 32 bits and long and pointer
21753 to 64 bits.
21754
21755 @item -mcmodel=@var{which}
21756 @opindex mcmodel
21757 Set the code model to one of
21758
21759 @table @samp
21760 @item medlow
21761 The Medium/Low code model: 64-bit addresses, programs
21762 must be linked in the low 32 bits of memory. Programs can be statically
21763 or dynamically linked.
21764
21765 @item medmid
21766 The Medium/Middle code model: 64-bit addresses, programs
21767 must be linked in the low 44 bits of memory, the text and data segments must
21768 be less than 2GB in size and the data segment must be located within 2GB of
21769 the text segment.
21770
21771 @item medany
21772 The Medium/Anywhere code model: 64-bit addresses, programs
21773 may be linked anywhere in memory, the text and data segments must be less
21774 than 2GB in size and the data segment must be located within 2GB of the
21775 text segment.
21776
21777 @item embmedany
21778 The Medium/Anywhere code model for embedded systems:
21779 64-bit addresses, the text and data segments must be less than 2GB in
21780 size, both starting anywhere in memory (determined at link time). The
21781 global register %g4 points to the base of the data segment. Programs
21782 are statically linked and PIC is not supported.
21783 @end table
21784
21785 @item -mmemory-model=@var{mem-model}
21786 @opindex mmemory-model
21787 Set the memory model in force on the processor to one of
21788
21789 @table @samp
21790 @item default
21791 The default memory model for the processor and operating system.
21792
21793 @item rmo
21794 Relaxed Memory Order
21795
21796 @item pso
21797 Partial Store Order
21798
21799 @item tso
21800 Total Store Order
21801
21802 @item sc
21803 Sequential Consistency
21804 @end table
21805
21806 These memory models are formally defined in Appendix D of the Sparc V9
21807 architecture manual, as set in the processor's @code{PSTATE.MM} field.
21808
21809 @item -mstack-bias
21810 @itemx -mno-stack-bias
21811 @opindex mstack-bias
21812 @opindex mno-stack-bias
21813 With @option{-mstack-bias}, GCC assumes that the stack pointer, and
21814 frame pointer if present, are offset by @minus{}2047 which must be added back
21815 when making stack frame references. This is the default in 64-bit mode.
21816 Otherwise, assume no such offset is present.
21817 @end table
21818
21819 @node SPU Options
21820 @subsection SPU Options
21821 @cindex SPU options
21822
21823 These @samp{-m} options are supported on the SPU:
21824
21825 @table @gcctabopt
21826 @item -mwarn-reloc
21827 @itemx -merror-reloc
21828 @opindex mwarn-reloc
21829 @opindex merror-reloc
21830
21831 The loader for SPU does not handle dynamic relocations. By default, GCC
21832 gives an error when it generates code that requires a dynamic
21833 relocation. @option{-mno-error-reloc} disables the error,
21834 @option{-mwarn-reloc} generates a warning instead.
21835
21836 @item -msafe-dma
21837 @itemx -munsafe-dma
21838 @opindex msafe-dma
21839 @opindex munsafe-dma
21840
21841 Instructions that initiate or test completion of DMA must not be
21842 reordered with respect to loads and stores of the memory that is being
21843 accessed.
21844 With @option{-munsafe-dma} you must use the @code{volatile} keyword to protect
21845 memory accesses, but that can lead to inefficient code in places where the
21846 memory is known to not change. Rather than mark the memory as volatile,
21847 you can use @option{-msafe-dma} to tell the compiler to treat
21848 the DMA instructions as potentially affecting all memory.
21849
21850 @item -mbranch-hints
21851 @opindex mbranch-hints
21852
21853 By default, GCC generates a branch hint instruction to avoid
21854 pipeline stalls for always-taken or probably-taken branches. A hint
21855 is not generated closer than 8 instructions away from its branch.
21856 There is little reason to disable them, except for debugging purposes,
21857 or to make an object a little bit smaller.
21858
21859 @item -msmall-mem
21860 @itemx -mlarge-mem
21861 @opindex msmall-mem
21862 @opindex mlarge-mem
21863
21864 By default, GCC generates code assuming that addresses are never larger
21865 than 18 bits. With @option{-mlarge-mem} code is generated that assumes
21866 a full 32-bit address.
21867
21868 @item -mstdmain
21869 @opindex mstdmain
21870
21871 By default, GCC links against startup code that assumes the SPU-style
21872 main function interface (which has an unconventional parameter list).
21873 With @option{-mstdmain}, GCC links your program against startup
21874 code that assumes a C99-style interface to @code{main}, including a
21875 local copy of @code{argv} strings.
21876
21877 @item -mfixed-range=@var{register-range}
21878 @opindex mfixed-range
21879 Generate code treating the given register range as fixed registers.
21880 A fixed register is one that the register allocator cannot use. This is
21881 useful when compiling kernel code. A register range is specified as
21882 two registers separated by a dash. Multiple register ranges can be
21883 specified separated by a comma.
21884
21885 @item -mea32
21886 @itemx -mea64
21887 @opindex mea32
21888 @opindex mea64
21889 Compile code assuming that pointers to the PPU address space accessed
21890 via the @code{__ea} named address space qualifier are either 32 or 64
21891 bits wide. The default is 32 bits. As this is an ABI-changing option,
21892 all object code in an executable must be compiled with the same setting.
21893
21894 @item -maddress-space-conversion
21895 @itemx -mno-address-space-conversion
21896 @opindex maddress-space-conversion
21897 @opindex mno-address-space-conversion
21898 Allow/disallow treating the @code{__ea} address space as superset
21899 of the generic address space. This enables explicit type casts
21900 between @code{__ea} and generic pointer as well as implicit
21901 conversions of generic pointers to @code{__ea} pointers. The
21902 default is to allow address space pointer conversions.
21903
21904 @item -mcache-size=@var{cache-size}
21905 @opindex mcache-size
21906 This option controls the version of libgcc that the compiler links to an
21907 executable and selects a software-managed cache for accessing variables
21908 in the @code{__ea} address space with a particular cache size. Possible
21909 options for @var{cache-size} are @samp{8}, @samp{16}, @samp{32}, @samp{64}
21910 and @samp{128}. The default cache size is 64KB.
21911
21912 @item -matomic-updates
21913 @itemx -mno-atomic-updates
21914 @opindex matomic-updates
21915 @opindex mno-atomic-updates
21916 This option controls the version of libgcc that the compiler links to an
21917 executable and selects whether atomic updates to the software-managed
21918 cache of PPU-side variables are used. If you use atomic updates, changes
21919 to a PPU variable from SPU code using the @code{__ea} named address space
21920 qualifier do not interfere with changes to other PPU variables residing
21921 in the same cache line from PPU code. If you do not use atomic updates,
21922 such interference may occur; however, writing back cache lines is
21923 more efficient. The default behavior is to use atomic updates.
21924
21925 @item -mdual-nops
21926 @itemx -mdual-nops=@var{n}
21927 @opindex mdual-nops
21928 By default, GCC inserts nops to increase dual issue when it expects
21929 it to increase performance. @var{n} can be a value from 0 to 10. A
21930 smaller @var{n} inserts fewer nops. 10 is the default, 0 is the
21931 same as @option{-mno-dual-nops}. Disabled with @option{-Os}.
21932
21933 @item -mhint-max-nops=@var{n}
21934 @opindex mhint-max-nops
21935 Maximum number of nops to insert for a branch hint. A branch hint must
21936 be at least 8 instructions away from the branch it is affecting. GCC
21937 inserts up to @var{n} nops to enforce this, otherwise it does not
21938 generate the branch hint.
21939
21940 @item -mhint-max-distance=@var{n}
21941 @opindex mhint-max-distance
21942 The encoding of the branch hint instruction limits the hint to be within
21943 256 instructions of the branch it is affecting. By default, GCC makes
21944 sure it is within 125.
21945
21946 @item -msafe-hints
21947 @opindex msafe-hints
21948 Work around a hardware bug that causes the SPU to stall indefinitely.
21949 By default, GCC inserts the @code{hbrp} instruction to make sure
21950 this stall won't happen.
21951
21952 @end table
21953
21954 @node System V Options
21955 @subsection Options for System V
21956
21957 These additional options are available on System V Release 4 for
21958 compatibility with other compilers on those systems:
21959
21960 @table @gcctabopt
21961 @item -G
21962 @opindex G
21963 Create a shared object.
21964 It is recommended that @option{-symbolic} or @option{-shared} be used instead.
21965
21966 @item -Qy
21967 @opindex Qy
21968 Identify the versions of each tool used by the compiler, in a
21969 @code{.ident} assembler directive in the output.
21970
21971 @item -Qn
21972 @opindex Qn
21973 Refrain from adding @code{.ident} directives to the output file (this is
21974 the default).
21975
21976 @item -YP,@var{dirs}
21977 @opindex YP
21978 Search the directories @var{dirs}, and no others, for libraries
21979 specified with @option{-l}.
21980
21981 @item -Ym,@var{dir}
21982 @opindex Ym
21983 Look in the directory @var{dir} to find the M4 preprocessor.
21984 The assembler uses this option.
21985 @c This is supposed to go with a -Yd for predefined M4 macro files, but
21986 @c the generic assembler that comes with Solaris takes just -Ym.
21987 @end table
21988
21989 @node TILE-Gx Options
21990 @subsection TILE-Gx Options
21991 @cindex TILE-Gx options
21992
21993 These @samp{-m} options are supported on the TILE-Gx:
21994
21995 @table @gcctabopt
21996 @item -mcmodel=small
21997 @opindex mcmodel=small
21998 Generate code for the small model. The distance for direct calls is
21999 limited to 500M in either direction. PC-relative addresses are 32
22000 bits. Absolute addresses support the full address range.
22001
22002 @item -mcmodel=large
22003 @opindex mcmodel=large
22004 Generate code for the large model. There is no limitation on call
22005 distance, pc-relative addresses, or absolute addresses.
22006
22007 @item -mcpu=@var{name}
22008 @opindex mcpu
22009 Selects the type of CPU to be targeted. Currently the only supported
22010 type is @samp{tilegx}.
22011
22012 @item -m32
22013 @itemx -m64
22014 @opindex m32
22015 @opindex m64
22016 Generate code for a 32-bit or 64-bit environment. The 32-bit
22017 environment sets int, long, and pointer to 32 bits. The 64-bit
22018 environment sets int to 32 bits and long and pointer to 64 bits.
22019
22020 @item -mbig-endian
22021 @itemx -mlittle-endian
22022 @opindex mbig-endian
22023 @opindex mlittle-endian
22024 Generate code in big/little endian mode, respectively.
22025 @end table
22026
22027 @node TILEPro Options
22028 @subsection TILEPro Options
22029 @cindex TILEPro options
22030
22031 These @samp{-m} options are supported on the TILEPro:
22032
22033 @table @gcctabopt
22034 @item -mcpu=@var{name}
22035 @opindex mcpu
22036 Selects the type of CPU to be targeted. Currently the only supported
22037 type is @samp{tilepro}.
22038
22039 @item -m32
22040 @opindex m32
22041 Generate code for a 32-bit environment, which sets int, long, and
22042 pointer to 32 bits. This is the only supported behavior so the flag
22043 is essentially ignored.
22044 @end table
22045
22046 @node V850 Options
22047 @subsection V850 Options
22048 @cindex V850 Options
22049
22050 These @samp{-m} options are defined for V850 implementations:
22051
22052 @table @gcctabopt
22053 @item -mlong-calls
22054 @itemx -mno-long-calls
22055 @opindex mlong-calls
22056 @opindex mno-long-calls
22057 Treat all calls as being far away (near). If calls are assumed to be
22058 far away, the compiler always loads the function's address into a
22059 register, and calls indirect through the pointer.
22060
22061 @item -mno-ep
22062 @itemx -mep
22063 @opindex mno-ep
22064 @opindex mep
22065 Do not optimize (do optimize) basic blocks that use the same index
22066 pointer 4 or more times to copy pointer into the @code{ep} register, and
22067 use the shorter @code{sld} and @code{sst} instructions. The @option{-mep}
22068 option is on by default if you optimize.
22069
22070 @item -mno-prolog-function
22071 @itemx -mprolog-function
22072 @opindex mno-prolog-function
22073 @opindex mprolog-function
22074 Do not use (do use) external functions to save and restore registers
22075 at the prologue and epilogue of a function. The external functions
22076 are slower, but use less code space if more than one function saves
22077 the same number of registers. The @option{-mprolog-function} option
22078 is on by default if you optimize.
22079
22080 @item -mspace
22081 @opindex mspace
22082 Try to make the code as small as possible. At present, this just turns
22083 on the @option{-mep} and @option{-mprolog-function} options.
22084
22085 @item -mtda=@var{n}
22086 @opindex mtda
22087 Put static or global variables whose size is @var{n} bytes or less into
22088 the tiny data area that register @code{ep} points to. The tiny data
22089 area can hold up to 256 bytes in total (128 bytes for byte references).
22090
22091 @item -msda=@var{n}
22092 @opindex msda
22093 Put static or global variables whose size is @var{n} bytes or less into
22094 the small data area that register @code{gp} points to. The small data
22095 area can hold up to 64 kilobytes.
22096
22097 @item -mzda=@var{n}
22098 @opindex mzda
22099 Put static or global variables whose size is @var{n} bytes or less into
22100 the first 32 kilobytes of memory.
22101
22102 @item -mv850
22103 @opindex mv850
22104 Specify that the target processor is the V850.
22105
22106 @item -mv850e3v5
22107 @opindex mv850e3v5
22108 Specify that the target processor is the V850E3V5. The preprocessor
22109 constant @samp{__v850e3v5__} is defined if this option is used.
22110
22111 @item -mv850e2v4
22112 @opindex mv850e2v4
22113 Specify that the target processor is the V850E3V5. This is an alias for
22114 the @option{-mv850e3v5} option.
22115
22116 @item -mv850e2v3
22117 @opindex mv850e2v3
22118 Specify that the target processor is the V850E2V3. The preprocessor
22119 constant @samp{__v850e2v3__} is defined if this option is used.
22120
22121 @item -mv850e2
22122 @opindex mv850e2
22123 Specify that the target processor is the V850E2. The preprocessor
22124 constant @samp{__v850e2__} is defined if this option is used.
22125
22126 @item -mv850e1
22127 @opindex mv850e1
22128 Specify that the target processor is the V850E1. The preprocessor
22129 constants @samp{__v850e1__} and @samp{__v850e__} are defined if
22130 this option is used.
22131
22132 @item -mv850es
22133 @opindex mv850es
22134 Specify that the target processor is the V850ES. This is an alias for
22135 the @option{-mv850e1} option.
22136
22137 @item -mv850e
22138 @opindex mv850e
22139 Specify that the target processor is the V850E@. The preprocessor
22140 constant @samp{__v850e__} is defined if this option is used.
22141
22142 If neither @option{-mv850} nor @option{-mv850e} nor @option{-mv850e1}
22143 nor @option{-mv850e2} nor @option{-mv850e2v3} nor @option{-mv850e3v5}
22144 are defined then a default target processor is chosen and the
22145 relevant @samp{__v850*__} preprocessor constant is defined.
22146
22147 The preprocessor constants @samp{__v850} and @samp{__v851__} are always
22148 defined, regardless of which processor variant is the target.
22149
22150 @item -mdisable-callt
22151 @itemx -mno-disable-callt
22152 @opindex mdisable-callt
22153 @opindex mno-disable-callt
22154 This option suppresses generation of the @code{CALLT} instruction for the
22155 v850e, v850e1, v850e2, v850e2v3 and v850e3v5 flavors of the v850
22156 architecture.
22157
22158 This option is enabled by default when the RH850 ABI is
22159 in use (see @option{-mrh850-abi}), and disabled by default when the
22160 GCC ABI is in use. If @code{CALLT} instructions are being generated
22161 then the C preprocessor symbol @code{__V850_CALLT__} will be defined.
22162
22163 @item -mrelax
22164 @itemx -mno-relax
22165 @opindex mrelax
22166 @opindex mno-relax
22167 Pass on (or do not pass on) the @option{-mrelax} command line option
22168 to the assembler.
22169
22170 @item -mlong-jumps
22171 @itemx -mno-long-jumps
22172 @opindex mlong-jumps
22173 @opindex mno-long-jumps
22174 Disable (or re-enable) the generation of PC-relative jump instructions.
22175
22176 @item -msoft-float
22177 @itemx -mhard-float
22178 @opindex msoft-float
22179 @opindex mhard-float
22180 Disable (or re-enable) the generation of hardware floating point
22181 instructions. This option is only significant when the target
22182 architecture is @samp{V850E2V3} or higher. If hardware floating point
22183 instructions are being generated then the C preprocessor symbol
22184 @code{__FPU_OK__} will be defined, otherwise the symbol
22185 @code{__NO_FPU__} will be defined.
22186
22187 @item -mloop
22188 @opindex mloop
22189 Enables the use of the e3v5 LOOP instruction. The use of this
22190 instruction is not enabled by default when the e3v5 architecture is
22191 selected because its use is still experimental.
22192
22193 @item -mrh850-abi
22194 @itemx -mghs
22195 @opindex mrh850-abi
22196 @opindex mghs
22197 Enables support for the RH850 version of the V850 ABI. This is the
22198 default. With this version of the ABI the following rules apply:
22199
22200 @itemize
22201 @item
22202 Integer sized structures and unions are returned via a memory pointer
22203 rather than a register.
22204
22205 @item
22206 Large structures and unions (more than 8 bytes in size) are passed by
22207 value.
22208
22209 @item
22210 Functions are aligned to 16-bit boundaries.
22211
22212 @item
22213 The @option{-m8byte-align} command line option is supported.
22214
22215 @item
22216 The @option{-mdisable-callt} command line option is enabled by
22217 default. The @option{-mno-disable-callt} command line option is not
22218 supported.
22219 @end itemize
22220
22221 When this version of the ABI is enabled the C preprocessor symbol
22222 @code{__V850_RH850_ABI__} is defined.
22223
22224 @item -mgcc-abi
22225 @opindex mgcc-abi
22226 Enables support for the old GCC version of the V850 ABI. With this
22227 version of the ABI the following rules apply:
22228
22229 @itemize
22230 @item
22231 Integer sized structures and unions are returned in register @code{r10}.
22232
22233 @item
22234 Large structures and unions (more than 8 bytes in size) are passed by
22235 reference.
22236
22237 @item
22238 Functions are aligned to 32-bit boundaries, unless optimizing for
22239 size.
22240
22241 @item
22242 The @option{-m8byte-align} command line option is not supported.
22243
22244 @item
22245 The @option{-mdisable-callt} command line option is supported but not
22246 enabled by default.
22247 @end itemize
22248
22249 When this version of the ABI is enabled the C preprocessor symbol
22250 @code{__V850_GCC_ABI__} is defined.
22251
22252 @item -m8byte-align
22253 @itemx -mno-8byte-align
22254 @opindex m8byte-align
22255 @opindex mno-8byte-align
22256 Enables support for @code{doubles} and @code{long long} types to be
22257 aligned on 8-byte boundaries. The default is to restrict the
22258 alignment of all objects to at most 4-bytes. When
22259 @option{-m8byte-align} is in effect the C preprocessor symbol
22260 @code{__V850_8BYTE_ALIGN__} will be defined.
22261
22262 @item -mbig-switch
22263 @opindex mbig-switch
22264 Generate code suitable for big switch tables. Use this option only if
22265 the assembler/linker complain about out of range branches within a switch
22266 table.
22267
22268 @item -mapp-regs
22269 @opindex mapp-regs
22270 This option causes r2 and r5 to be used in the code generated by
22271 the compiler. This setting is the default.
22272
22273 @item -mno-app-regs
22274 @opindex mno-app-regs
22275 This option causes r2 and r5 to be treated as fixed registers.
22276
22277 @end table
22278
22279 @node VAX Options
22280 @subsection VAX Options
22281 @cindex VAX options
22282
22283 These @samp{-m} options are defined for the VAX:
22284
22285 @table @gcctabopt
22286 @item -munix
22287 @opindex munix
22288 Do not output certain jump instructions (@code{aobleq} and so on)
22289 that the Unix assembler for the VAX cannot handle across long
22290 ranges.
22291
22292 @item -mgnu
22293 @opindex mgnu
22294 Do output those jump instructions, on the assumption that the
22295 GNU assembler is being used.
22296
22297 @item -mg
22298 @opindex mg
22299 Output code for G-format floating-point numbers instead of D-format.
22300 @end table
22301
22302 @node VMS Options
22303 @subsection VMS Options
22304
22305 These @samp{-m} options are defined for the VMS implementations:
22306
22307 @table @gcctabopt
22308 @item -mvms-return-codes
22309 @opindex mvms-return-codes
22310 Return VMS condition codes from @code{main}. The default is to return POSIX-style
22311 condition (e.g.@ error) codes.
22312
22313 @item -mdebug-main=@var{prefix}
22314 @opindex mdebug-main=@var{prefix}
22315 Flag the first routine whose name starts with @var{prefix} as the main
22316 routine for the debugger.
22317
22318 @item -mmalloc64
22319 @opindex mmalloc64
22320 Default to 64-bit memory allocation routines.
22321
22322 @item -mpointer-size=@var{size}
22323 @opindex -mpointer-size=@var{size}
22324 Set the default size of pointers. Possible options for @var{size} are
22325 @samp{32} or @samp{short} for 32 bit pointers, @samp{64} or @samp{long}
22326 for 64 bit pointers, and @samp{no} for supporting only 32 bit pointers.
22327 The later option disables @code{pragma pointer_size}.
22328 @end table
22329
22330 @node VxWorks Options
22331 @subsection VxWorks Options
22332 @cindex VxWorks Options
22333
22334 The options in this section are defined for all VxWorks targets.
22335 Options specific to the target hardware are listed with the other
22336 options for that target.
22337
22338 @table @gcctabopt
22339 @item -mrtp
22340 @opindex mrtp
22341 GCC can generate code for both VxWorks kernels and real time processes
22342 (RTPs). This option switches from the former to the latter. It also
22343 defines the preprocessor macro @code{__RTP__}.
22344
22345 @item -non-static
22346 @opindex non-static
22347 Link an RTP executable against shared libraries rather than static
22348 libraries. The options @option{-static} and @option{-shared} can
22349 also be used for RTPs (@pxref{Link Options}); @option{-static}
22350 is the default.
22351
22352 @item -Bstatic
22353 @itemx -Bdynamic
22354 @opindex Bstatic
22355 @opindex Bdynamic
22356 These options are passed down to the linker. They are defined for
22357 compatibility with Diab.
22358
22359 @item -Xbind-lazy
22360 @opindex Xbind-lazy
22361 Enable lazy binding of function calls. This option is equivalent to
22362 @option{-Wl,-z,now} and is defined for compatibility with Diab.
22363
22364 @item -Xbind-now
22365 @opindex Xbind-now
22366 Disable lazy binding of function calls. This option is the default and
22367 is defined for compatibility with Diab.
22368 @end table
22369
22370 @node x86-64 Options
22371 @subsection x86-64 Options
22372 @cindex x86-64 options
22373
22374 These are listed under @xref{i386 and x86-64 Options}.
22375
22376 @node Xstormy16 Options
22377 @subsection Xstormy16 Options
22378 @cindex Xstormy16 Options
22379
22380 These options are defined for Xstormy16:
22381
22382 @table @gcctabopt
22383 @item -msim
22384 @opindex msim
22385 Choose startup files and linker script suitable for the simulator.
22386 @end table
22387
22388 @node Xtensa Options
22389 @subsection Xtensa Options
22390 @cindex Xtensa Options
22391
22392 These options are supported for Xtensa targets:
22393
22394 @table @gcctabopt
22395 @item -mconst16
22396 @itemx -mno-const16
22397 @opindex mconst16
22398 @opindex mno-const16
22399 Enable or disable use of @code{CONST16} instructions for loading
22400 constant values. The @code{CONST16} instruction is currently not a
22401 standard option from Tensilica. When enabled, @code{CONST16}
22402 instructions are always used in place of the standard @code{L32R}
22403 instructions. The use of @code{CONST16} is enabled by default only if
22404 the @code{L32R} instruction is not available.
22405
22406 @item -mfused-madd
22407 @itemx -mno-fused-madd
22408 @opindex mfused-madd
22409 @opindex mno-fused-madd
22410 Enable or disable use of fused multiply/add and multiply/subtract
22411 instructions in the floating-point option. This has no effect if the
22412 floating-point option is not also enabled. Disabling fused multiply/add
22413 and multiply/subtract instructions forces the compiler to use separate
22414 instructions for the multiply and add/subtract operations. This may be
22415 desirable in some cases where strict IEEE 754-compliant results are
22416 required: the fused multiply add/subtract instructions do not round the
22417 intermediate result, thereby producing results with @emph{more} bits of
22418 precision than specified by the IEEE standard. Disabling fused multiply
22419 add/subtract instructions also ensures that the program output is not
22420 sensitive to the compiler's ability to combine multiply and add/subtract
22421 operations.
22422
22423 @item -mserialize-volatile
22424 @itemx -mno-serialize-volatile
22425 @opindex mserialize-volatile
22426 @opindex mno-serialize-volatile
22427 When this option is enabled, GCC inserts @code{MEMW} instructions before
22428 @code{volatile} memory references to guarantee sequential consistency.
22429 The default is @option{-mserialize-volatile}. Use
22430 @option{-mno-serialize-volatile} to omit the @code{MEMW} instructions.
22431
22432 @item -mforce-no-pic
22433 @opindex mforce-no-pic
22434 For targets, like GNU/Linux, where all user-mode Xtensa code must be
22435 position-independent code (PIC), this option disables PIC for compiling
22436 kernel code.
22437
22438 @item -mtext-section-literals
22439 @itemx -mno-text-section-literals
22440 @opindex mtext-section-literals
22441 @opindex mno-text-section-literals
22442 Control the treatment of literal pools. The default is
22443 @option{-mno-text-section-literals}, which places literals in a separate
22444 section in the output file. This allows the literal pool to be placed
22445 in a data RAM/ROM, and it also allows the linker to combine literal
22446 pools from separate object files to remove redundant literals and
22447 improve code size. With @option{-mtext-section-literals}, the literals
22448 are interspersed in the text section in order to keep them as close as
22449 possible to their references. This may be necessary for large assembly
22450 files.
22451
22452 @item -mtarget-align
22453 @itemx -mno-target-align
22454 @opindex mtarget-align
22455 @opindex mno-target-align
22456 When this option is enabled, GCC instructs the assembler to
22457 automatically align instructions to reduce branch penalties at the
22458 expense of some code density. The assembler attempts to widen density
22459 instructions to align branch targets and the instructions following call
22460 instructions. If there are not enough preceding safe density
22461 instructions to align a target, no widening is performed. The
22462 default is @option{-mtarget-align}. These options do not affect the
22463 treatment of auto-aligned instructions like @code{LOOP}, which the
22464 assembler always aligns, either by widening density instructions or
22465 by inserting NOP instructions.
22466
22467 @item -mlongcalls
22468 @itemx -mno-longcalls
22469 @opindex mlongcalls
22470 @opindex mno-longcalls
22471 When this option is enabled, GCC instructs the assembler to translate
22472 direct calls to indirect calls unless it can determine that the target
22473 of a direct call is in the range allowed by the call instruction. This
22474 translation typically occurs for calls to functions in other source
22475 files. Specifically, the assembler translates a direct @code{CALL}
22476 instruction into an @code{L32R} followed by a @code{CALLX} instruction.
22477 The default is @option{-mno-longcalls}. This option should be used in
22478 programs where the call target can potentially be out of range. This
22479 option is implemented in the assembler, not the compiler, so the
22480 assembly code generated by GCC still shows direct call
22481 instructions---look at the disassembled object code to see the actual
22482 instructions. Note that the assembler uses an indirect call for
22483 every cross-file call, not just those that really are out of range.
22484 @end table
22485
22486 @node zSeries Options
22487 @subsection zSeries Options
22488 @cindex zSeries options
22489
22490 These are listed under @xref{S/390 and zSeries Options}.
22491
22492 @node Code Gen Options
22493 @section Options for Code Generation Conventions
22494 @cindex code generation conventions
22495 @cindex options, code generation
22496 @cindex run-time options
22497
22498 These machine-independent options control the interface conventions
22499 used in code generation.
22500
22501 Most of them have both positive and negative forms; the negative form
22502 of @option{-ffoo} is @option{-fno-foo}. In the table below, only
22503 one of the forms is listed---the one that is not the default. You
22504 can figure out the other form by either removing @samp{no-} or adding
22505 it.
22506
22507 @table @gcctabopt
22508 @item -fbounds-check
22509 @opindex fbounds-check
22510 For front ends that support it, generate additional code to check that
22511 indices used to access arrays are within the declared range. This is
22512 currently only supported by the Java and Fortran front ends, where
22513 this option defaults to true and false respectively.
22514
22515 @item -fstack-reuse=@var{reuse-level}
22516 @opindex fstack_reuse
22517 This option controls stack space reuse for user declared local/auto variables
22518 and compiler generated temporaries. @var{reuse_level} can be @samp{all},
22519 @samp{named_vars}, or @samp{none}. @samp{all} enables stack reuse for all
22520 local variables and temporaries, @samp{named_vars} enables the reuse only for
22521 user defined local variables with names, and @samp{none} disables stack reuse
22522 completely. The default value is @samp{all}. The option is needed when the
22523 program extends the lifetime of a scoped local variable or a compiler generated
22524 temporary beyond the end point defined by the language. When a lifetime of
22525 a variable ends, and if the variable lives in memory, the optimizing compiler
22526 has the freedom to reuse its stack space with other temporaries or scoped
22527 local variables whose live range does not overlap with it. Legacy code extending
22528 local lifetime will likely to break with the stack reuse optimization.
22529
22530 For example,
22531
22532 @smallexample
22533 int *p;
22534 @{
22535 int local1;
22536
22537 p = &local1;
22538 local1 = 10;
22539 ....
22540 @}
22541 @{
22542 int local2;
22543 local2 = 20;
22544 ...
22545 @}
22546
22547 if (*p == 10) // out of scope use of local1
22548 @{
22549
22550 @}
22551 @end smallexample
22552
22553 Another example:
22554 @smallexample
22555
22556 struct A
22557 @{
22558 A(int k) : i(k), j(k) @{ @}
22559 int i;
22560 int j;
22561 @};
22562
22563 A *ap;
22564
22565 void foo(const A& ar)
22566 @{
22567 ap = &ar;
22568 @}
22569
22570 void bar()
22571 @{
22572 foo(A(10)); // temp object's lifetime ends when foo returns
22573
22574 @{
22575 A a(20);
22576 ....
22577 @}
22578 ap->i+= 10; // ap references out of scope temp whose space
22579 // is reused with a. What is the value of ap->i?
22580 @}
22581
22582 @end smallexample
22583
22584 The lifetime of a compiler generated temporary is well defined by the C++
22585 standard. When a lifetime of a temporary ends, and if the temporary lives
22586 in memory, the optimizing compiler has the freedom to reuse its stack
22587 space with other temporaries or scoped local variables whose live range
22588 does not overlap with it. However some of the legacy code relies on
22589 the behavior of older compilers in which temporaries' stack space is
22590 not reused, the aggressive stack reuse can lead to runtime errors. This
22591 option is used to control the temporary stack reuse optimization.
22592
22593 @item -ftrapv
22594 @opindex ftrapv
22595 This option generates traps for signed overflow on addition, subtraction,
22596 multiplication operations.
22597
22598 @item -fwrapv
22599 @opindex fwrapv
22600 This option instructs the compiler to assume that signed arithmetic
22601 overflow of addition, subtraction and multiplication wraps around
22602 using twos-complement representation. This flag enables some optimizations
22603 and disables others. This option is enabled by default for the Java
22604 front end, as required by the Java language specification.
22605
22606 @item -fexceptions
22607 @opindex fexceptions
22608 Enable exception handling. Generates extra code needed to propagate
22609 exceptions. For some targets, this implies GCC generates frame
22610 unwind information for all functions, which can produce significant data
22611 size overhead, although it does not affect execution. If you do not
22612 specify this option, GCC enables it by default for languages like
22613 C++ that normally require exception handling, and disables it for
22614 languages like C that do not normally require it. However, you may need
22615 to enable this option when compiling C code that needs to interoperate
22616 properly with exception handlers written in C++. You may also wish to
22617 disable this option if you are compiling older C++ programs that don't
22618 use exception handling.
22619
22620 @item -fnon-call-exceptions
22621 @opindex fnon-call-exceptions
22622 Generate code that allows trapping instructions to throw exceptions.
22623 Note that this requires platform-specific runtime support that does
22624 not exist everywhere. Moreover, it only allows @emph{trapping}
22625 instructions to throw exceptions, i.e.@: memory references or floating-point
22626 instructions. It does not allow exceptions to be thrown from
22627 arbitrary signal handlers such as @code{SIGALRM}.
22628
22629 @item -fdelete-dead-exceptions
22630 @opindex fdelete-dead-exceptions
22631 Consider that instructions that may throw exceptions but don't otherwise
22632 contribute to the execution of the program can be optimized away.
22633 This option is enabled by default for the Ada front end, as permitted by
22634 the Ada language specification.
22635 Optimization passes that cause dead exceptions to be removed are enabled independently at different optimization levels.
22636
22637 @item -funwind-tables
22638 @opindex funwind-tables
22639 Similar to @option{-fexceptions}, except that it just generates any needed
22640 static data, but does not affect the generated code in any other way.
22641 You normally do not need to enable this option; instead, a language processor
22642 that needs this handling enables it on your behalf.
22643
22644 @item -fasynchronous-unwind-tables
22645 @opindex fasynchronous-unwind-tables
22646 Generate unwind table in DWARF 2 format, if supported by target machine. The
22647 table is exact at each instruction boundary, so it can be used for stack
22648 unwinding from asynchronous events (such as debugger or garbage collector).
22649
22650 @item -fno-gnu-unique
22651 @opindex fno-gnu-unique
22652 On systems with recent GNU assembler and C library, the C++ compiler
22653 uses the @code{STB_GNU_UNIQUE} binding to make sure that definitions
22654 of template static data members and static local variables in inline
22655 functions are unique even in the presence of @code{RTLD_LOCAL}; this
22656 is necessary to avoid problems with a library used by two different
22657 @code{RTLD_LOCAL} plugins depending on a definition in one of them and
22658 therefore disagreeing with the other one about the binding of the
22659 symbol. But this causes @code{dlclose} to be ignored for affected
22660 DSOs; if your program relies on reinitialization of a DSO via
22661 @code{dlclose} and @code{dlopen}, you can use
22662 @option{-fno-gnu-unique}.
22663
22664 @item -fpcc-struct-return
22665 @opindex fpcc-struct-return
22666 Return ``short'' @code{struct} and @code{union} values in memory like
22667 longer ones, rather than in registers. This convention is less
22668 efficient, but it has the advantage of allowing intercallability between
22669 GCC-compiled files and files compiled with other compilers, particularly
22670 the Portable C Compiler (pcc).
22671
22672 The precise convention for returning structures in memory depends
22673 on the target configuration macros.
22674
22675 Short structures and unions are those whose size and alignment match
22676 that of some integer type.
22677
22678 @strong{Warning:} code compiled with the @option{-fpcc-struct-return}
22679 switch is not binary compatible with code compiled with the
22680 @option{-freg-struct-return} switch.
22681 Use it to conform to a non-default application binary interface.
22682
22683 @item -freg-struct-return
22684 @opindex freg-struct-return
22685 Return @code{struct} and @code{union} values in registers when possible.
22686 This is more efficient for small structures than
22687 @option{-fpcc-struct-return}.
22688
22689 If you specify neither @option{-fpcc-struct-return} nor
22690 @option{-freg-struct-return}, GCC defaults to whichever convention is
22691 standard for the target. If there is no standard convention, GCC
22692 defaults to @option{-fpcc-struct-return}, except on targets where GCC is
22693 the principal compiler. In those cases, we can choose the standard, and
22694 we chose the more efficient register return alternative.
22695
22696 @strong{Warning:} code compiled with the @option{-freg-struct-return}
22697 switch is not binary compatible with code compiled with the
22698 @option{-fpcc-struct-return} switch.
22699 Use it to conform to a non-default application binary interface.
22700
22701 @item -fshort-enums
22702 @opindex fshort-enums
22703 Allocate to an @code{enum} type only as many bytes as it needs for the
22704 declared range of possible values. Specifically, the @code{enum} type
22705 is equivalent to the smallest integer type that has enough room.
22706
22707 @strong{Warning:} the @option{-fshort-enums} switch causes GCC to generate
22708 code that is not binary compatible with code generated without that switch.
22709 Use it to conform to a non-default application binary interface.
22710
22711 @item -fshort-double
22712 @opindex fshort-double
22713 Use the same size for @code{double} as for @code{float}.
22714
22715 @strong{Warning:} the @option{-fshort-double} switch causes GCC to generate
22716 code that is not binary compatible with code generated without that switch.
22717 Use it to conform to a non-default application binary interface.
22718
22719 @item -fshort-wchar
22720 @opindex fshort-wchar
22721 Override the underlying type for @samp{wchar_t} to be @samp{short
22722 unsigned int} instead of the default for the target. This option is
22723 useful for building programs to run under WINE@.
22724
22725 @strong{Warning:} the @option{-fshort-wchar} switch causes GCC to generate
22726 code that is not binary compatible with code generated without that switch.
22727 Use it to conform to a non-default application binary interface.
22728
22729 @item -fno-common
22730 @opindex fno-common
22731 In C code, controls the placement of uninitialized global variables.
22732 Unix C compilers have traditionally permitted multiple definitions of
22733 such variables in different compilation units by placing the variables
22734 in a common block.
22735 This is the behavior specified by @option{-fcommon}, and is the default
22736 for GCC on most targets.
22737 On the other hand, this behavior is not required by ISO C, and on some
22738 targets may carry a speed or code size penalty on variable references.
22739 The @option{-fno-common} option specifies that the compiler should place
22740 uninitialized global variables in the data section of the object file,
22741 rather than generating them as common blocks.
22742 This has the effect that if the same variable is declared
22743 (without @code{extern}) in two different compilations,
22744 you get a multiple-definition error when you link them.
22745 In this case, you must compile with @option{-fcommon} instead.
22746 Compiling with @option{-fno-common} is useful on targets for which
22747 it provides better performance, or if you wish to verify that the
22748 program will work on other systems that always treat uninitialized
22749 variable declarations this way.
22750
22751 @item -fno-ident
22752 @opindex fno-ident
22753 Ignore the @samp{#ident} directive.
22754
22755 @item -finhibit-size-directive
22756 @opindex finhibit-size-directive
22757 Don't output a @code{.size} assembler directive, or anything else that
22758 would cause trouble if the function is split in the middle, and the
22759 two halves are placed at locations far apart in memory. This option is
22760 used when compiling @file{crtstuff.c}; you should not need to use it
22761 for anything else.
22762
22763 @item -fverbose-asm
22764 @opindex fverbose-asm
22765 Put extra commentary information in the generated assembly code to
22766 make it more readable. This option is generally only of use to those
22767 who actually need to read the generated assembly code (perhaps while
22768 debugging the compiler itself).
22769
22770 @option{-fno-verbose-asm}, the default, causes the
22771 extra information to be omitted and is useful when comparing two assembler
22772 files.
22773
22774 @item -frecord-gcc-switches
22775 @opindex frecord-gcc-switches
22776 This switch causes the command line used to invoke the
22777 compiler to be recorded into the object file that is being created.
22778 This switch is only implemented on some targets and the exact format
22779 of the recording is target and binary file format dependent, but it
22780 usually takes the form of a section containing ASCII text. This
22781 switch is related to the @option{-fverbose-asm} switch, but that
22782 switch only records information in the assembler output file as
22783 comments, so it never reaches the object file.
22784 See also @option{-grecord-gcc-switches} for another
22785 way of storing compiler options into the object file.
22786
22787 @item -fpic
22788 @opindex fpic
22789 @cindex global offset table
22790 @cindex PIC
22791 Generate position-independent code (PIC) suitable for use in a shared
22792 library, if supported for the target machine. Such code accesses all
22793 constant addresses through a global offset table (GOT)@. The dynamic
22794 loader resolves the GOT entries when the program starts (the dynamic
22795 loader is not part of GCC; it is part of the operating system). If
22796 the GOT size for the linked executable exceeds a machine-specific
22797 maximum size, you get an error message from the linker indicating that
22798 @option{-fpic} does not work; in that case, recompile with @option{-fPIC}
22799 instead. (These maximums are 8k on the SPARC and 32k
22800 on the m68k and RS/6000. The 386 has no such limit.)
22801
22802 Position-independent code requires special support, and therefore works
22803 only on certain machines. For the 386, GCC supports PIC for System V
22804 but not for the Sun 386i. Code generated for the IBM RS/6000 is always
22805 position-independent.
22806
22807 When this flag is set, the macros @code{__pic__} and @code{__PIC__}
22808 are defined to 1.
22809
22810 @item -fPIC
22811 @opindex fPIC
22812 If supported for the target machine, emit position-independent code,
22813 suitable for dynamic linking and avoiding any limit on the size of the
22814 global offset table. This option makes a difference on the m68k,
22815 PowerPC and SPARC@.
22816
22817 Position-independent code requires special support, and therefore works
22818 only on certain machines.
22819
22820 When this flag is set, the macros @code{__pic__} and @code{__PIC__}
22821 are defined to 2.
22822
22823 @item -fpie
22824 @itemx -fPIE
22825 @opindex fpie
22826 @opindex fPIE
22827 These options are similar to @option{-fpic} and @option{-fPIC}, but
22828 generated position independent code can be only linked into executables.
22829 Usually these options are used when @option{-pie} GCC option is
22830 used during linking.
22831
22832 @option{-fpie} and @option{-fPIE} both define the macros
22833 @code{__pie__} and @code{__PIE__}. The macros have the value 1
22834 for @option{-fpie} and 2 for @option{-fPIE}.
22835
22836 @item -fno-jump-tables
22837 @opindex fno-jump-tables
22838 Do not use jump tables for switch statements even where it would be
22839 more efficient than other code generation strategies. This option is
22840 of use in conjunction with @option{-fpic} or @option{-fPIC} for
22841 building code that forms part of a dynamic linker and cannot
22842 reference the address of a jump table. On some targets, jump tables
22843 do not require a GOT and this option is not needed.
22844
22845 @item -ffixed-@var{reg}
22846 @opindex ffixed
22847 Treat the register named @var{reg} as a fixed register; generated code
22848 should never refer to it (except perhaps as a stack pointer, frame
22849 pointer or in some other fixed role).
22850
22851 @var{reg} must be the name of a register. The register names accepted
22852 are machine-specific and are defined in the @code{REGISTER_NAMES}
22853 macro in the machine description macro file.
22854
22855 This flag does not have a negative form, because it specifies a
22856 three-way choice.
22857
22858 @item -fcall-used-@var{reg}
22859 @opindex fcall-used
22860 Treat the register named @var{reg} as an allocable register that is
22861 clobbered by function calls. It may be allocated for temporaries or
22862 variables that do not live across a call. Functions compiled this way
22863 do not save and restore the register @var{reg}.
22864
22865 It is an error to use this flag with the frame pointer or stack pointer.
22866 Use of this flag for other registers that have fixed pervasive roles in
22867 the machine's execution model produces disastrous results.
22868
22869 This flag does not have a negative form, because it specifies a
22870 three-way choice.
22871
22872 @item -fcall-saved-@var{reg}
22873 @opindex fcall-saved
22874 Treat the register named @var{reg} as an allocable register saved by
22875 functions. It may be allocated even for temporaries or variables that
22876 live across a call. Functions compiled this way save and restore
22877 the register @var{reg} if they use it.
22878
22879 It is an error to use this flag with the frame pointer or stack pointer.
22880 Use of this flag for other registers that have fixed pervasive roles in
22881 the machine's execution model produces disastrous results.
22882
22883 A different sort of disaster results from the use of this flag for
22884 a register in which function values may be returned.
22885
22886 This flag does not have a negative form, because it specifies a
22887 three-way choice.
22888
22889 @item -fpack-struct[=@var{n}]
22890 @opindex fpack-struct
22891 Without a value specified, pack all structure members together without
22892 holes. When a value is specified (which must be a small power of two), pack
22893 structure members according to this value, representing the maximum
22894 alignment (that is, objects with default alignment requirements larger than
22895 this are output potentially unaligned at the next fitting location.
22896
22897 @strong{Warning:} the @option{-fpack-struct} switch causes GCC to generate
22898 code that is not binary compatible with code generated without that switch.
22899 Additionally, it makes the code suboptimal.
22900 Use it to conform to a non-default application binary interface.
22901
22902 @item -finstrument-functions
22903 @opindex finstrument-functions
22904 Generate instrumentation calls for entry and exit to functions. Just
22905 after function entry and just before function exit, the following
22906 profiling functions are called with the address of the current
22907 function and its call site. (On some platforms,
22908 @code{__builtin_return_address} does not work beyond the current
22909 function, so the call site information may not be available to the
22910 profiling functions otherwise.)
22911
22912 @smallexample
22913 void __cyg_profile_func_enter (void *this_fn,
22914 void *call_site);
22915 void __cyg_profile_func_exit (void *this_fn,
22916 void *call_site);
22917 @end smallexample
22918
22919 The first argument is the address of the start of the current function,
22920 which may be looked up exactly in the symbol table.
22921
22922 This instrumentation is also done for functions expanded inline in other
22923 functions. The profiling calls indicate where, conceptually, the
22924 inline function is entered and exited. This means that addressable
22925 versions of such functions must be available. If all your uses of a
22926 function are expanded inline, this may mean an additional expansion of
22927 code size. If you use @samp{extern inline} in your C code, an
22928 addressable version of such functions must be provided. (This is
22929 normally the case anyway, but if you get lucky and the optimizer always
22930 expands the functions inline, you might have gotten away without
22931 providing static copies.)
22932
22933 A function may be given the attribute @code{no_instrument_function}, in
22934 which case this instrumentation is not done. This can be used, for
22935 example, for the profiling functions listed above, high-priority
22936 interrupt routines, and any functions from which the profiling functions
22937 cannot safely be called (perhaps signal handlers, if the profiling
22938 routines generate output or allocate memory).
22939
22940 @item -finstrument-functions-exclude-file-list=@var{file},@var{file},@dots{}
22941 @opindex finstrument-functions-exclude-file-list
22942
22943 Set the list of functions that are excluded from instrumentation (see
22944 the description of @code{-finstrument-functions}). If the file that
22945 contains a function definition matches with one of @var{file}, then
22946 that function is not instrumented. The match is done on substrings:
22947 if the @var{file} parameter is a substring of the file name, it is
22948 considered to be a match.
22949
22950 For example:
22951
22952 @smallexample
22953 -finstrument-functions-exclude-file-list=/bits/stl,include/sys
22954 @end smallexample
22955
22956 @noindent
22957 excludes any inline function defined in files whose pathnames
22958 contain @code{/bits/stl} or @code{include/sys}.
22959
22960 If, for some reason, you want to include letter @code{','} in one of
22961 @var{sym}, write @code{'\,'}. For example,
22962 @code{-finstrument-functions-exclude-file-list='\,\,tmp'}
22963 (note the single quote surrounding the option).
22964
22965 @item -finstrument-functions-exclude-function-list=@var{sym},@var{sym},@dots{}
22966 @opindex finstrument-functions-exclude-function-list
22967
22968 This is similar to @code{-finstrument-functions-exclude-file-list},
22969 but this option sets the list of function names to be excluded from
22970 instrumentation. The function name to be matched is its user-visible
22971 name, such as @code{vector<int> blah(const vector<int> &)}, not the
22972 internal mangled name (e.g., @code{_Z4blahRSt6vectorIiSaIiEE}). The
22973 match is done on substrings: if the @var{sym} parameter is a substring
22974 of the function name, it is considered to be a match. For C99 and C++
22975 extended identifiers, the function name must be given in UTF-8, not
22976 using universal character names.
22977
22978 @item -fstack-check
22979 @opindex fstack-check
22980 Generate code to verify that you do not go beyond the boundary of the
22981 stack. You should specify this flag if you are running in an
22982 environment with multiple threads, but you only rarely need to specify it in
22983 a single-threaded environment since stack overflow is automatically
22984 detected on nearly all systems if there is only one stack.
22985
22986 Note that this switch does not actually cause checking to be done; the
22987 operating system or the language runtime must do that. The switch causes
22988 generation of code to ensure that they see the stack being extended.
22989
22990 You can additionally specify a string parameter: @code{no} means no
22991 checking, @code{generic} means force the use of old-style checking,
22992 @code{specific} means use the best checking method and is equivalent
22993 to bare @option{-fstack-check}.
22994
22995 Old-style checking is a generic mechanism that requires no specific
22996 target support in the compiler but comes with the following drawbacks:
22997
22998 @enumerate
22999 @item
23000 Modified allocation strategy for large objects: they are always
23001 allocated dynamically if their size exceeds a fixed threshold.
23002
23003 @item
23004 Fixed limit on the size of the static frame of functions: when it is
23005 topped by a particular function, stack checking is not reliable and
23006 a warning is issued by the compiler.
23007
23008 @item
23009 Inefficiency: because of both the modified allocation strategy and the
23010 generic implementation, code performance is hampered.
23011 @end enumerate
23012
23013 Note that old-style stack checking is also the fallback method for
23014 @code{specific} if no target support has been added in the compiler.
23015
23016 @item -fstack-limit-register=@var{reg}
23017 @itemx -fstack-limit-symbol=@var{sym}
23018 @itemx -fno-stack-limit
23019 @opindex fstack-limit-register
23020 @opindex fstack-limit-symbol
23021 @opindex fno-stack-limit
23022 Generate code to ensure that the stack does not grow beyond a certain value,
23023 either the value of a register or the address of a symbol. If a larger
23024 stack is required, a signal is raised at run time. For most targets,
23025 the signal is raised before the stack overruns the boundary, so
23026 it is possible to catch the signal without taking special precautions.
23027
23028 For instance, if the stack starts at absolute address @samp{0x80000000}
23029 and grows downwards, you can use the flags
23030 @option{-fstack-limit-symbol=__stack_limit} and
23031 @option{-Wl,--defsym,__stack_limit=0x7ffe0000} to enforce a stack limit
23032 of 128KB@. Note that this may only work with the GNU linker.
23033
23034 @item -fsplit-stack
23035 @opindex fsplit-stack
23036 Generate code to automatically split the stack before it overflows.
23037 The resulting program has a discontiguous stack which can only
23038 overflow if the program is unable to allocate any more memory. This
23039 is most useful when running threaded programs, as it is no longer
23040 necessary to calculate a good stack size to use for each thread. This
23041 is currently only implemented for the i386 and x86_64 back ends running
23042 GNU/Linux.
23043
23044 When code compiled with @option{-fsplit-stack} calls code compiled
23045 without @option{-fsplit-stack}, there may not be much stack space
23046 available for the latter code to run. If compiling all code,
23047 including library code, with @option{-fsplit-stack} is not an option,
23048 then the linker can fix up these calls so that the code compiled
23049 without @option{-fsplit-stack} always has a large stack. Support for
23050 this is implemented in the gold linker in GNU binutils release 2.21
23051 and later.
23052
23053 @item -fleading-underscore
23054 @opindex fleading-underscore
23055 This option and its counterpart, @option{-fno-leading-underscore}, forcibly
23056 change the way C symbols are represented in the object file. One use
23057 is to help link with legacy assembly code.
23058
23059 @strong{Warning:} the @option{-fleading-underscore} switch causes GCC to
23060 generate code that is not binary compatible with code generated without that
23061 switch. Use it to conform to a non-default application binary interface.
23062 Not all targets provide complete support for this switch.
23063
23064 @item -ftls-model=@var{model}
23065 @opindex ftls-model
23066 Alter the thread-local storage model to be used (@pxref{Thread-Local}).
23067 The @var{model} argument should be one of @code{global-dynamic},
23068 @code{local-dynamic}, @code{initial-exec} or @code{local-exec}.
23069 Note that the choice is subject to optimization: the compiler may use
23070 a more efficient model for symbols not visible outside of the translation
23071 unit, or if @option{-fpic} is not given on the command line.
23072
23073 The default without @option{-fpic} is @code{initial-exec}; with
23074 @option{-fpic} the default is @code{global-dynamic}.
23075
23076 @item -fvisibility=@var{default|internal|hidden|protected}
23077 @opindex fvisibility
23078 Set the default ELF image symbol visibility to the specified option---all
23079 symbols are marked with this unless overridden within the code.
23080 Using this feature can very substantially improve linking and
23081 load times of shared object libraries, produce more optimized
23082 code, provide near-perfect API export and prevent symbol clashes.
23083 It is @strong{strongly} recommended that you use this in any shared objects
23084 you distribute.
23085
23086 Despite the nomenclature, @code{default} always means public; i.e.,
23087 available to be linked against from outside the shared object.
23088 @code{protected} and @code{internal} are pretty useless in real-world
23089 usage so the only other commonly used option is @code{hidden}.
23090 The default if @option{-fvisibility} isn't specified is
23091 @code{default}, i.e., make every
23092 symbol public---this causes the same behavior as previous versions of
23093 GCC@.
23094
23095 A good explanation of the benefits offered by ensuring ELF
23096 symbols have the correct visibility is given by ``How To Write
23097 Shared Libraries'' by Ulrich Drepper (which can be found at
23098 @w{@uref{http://people.redhat.com/~drepper/}})---however a superior
23099 solution made possible by this option to marking things hidden when
23100 the default is public is to make the default hidden and mark things
23101 public. This is the norm with DLLs on Windows and with @option{-fvisibility=hidden}
23102 and @code{__attribute__ ((visibility("default")))} instead of
23103 @code{__declspec(dllexport)} you get almost identical semantics with
23104 identical syntax. This is a great boon to those working with
23105 cross-platform projects.
23106
23107 For those adding visibility support to existing code, you may find
23108 @samp{#pragma GCC visibility} of use. This works by you enclosing
23109 the declarations you wish to set visibility for with (for example)
23110 @samp{#pragma GCC visibility push(hidden)} and
23111 @samp{#pragma GCC visibility pop}.
23112 Bear in mind that symbol visibility should be viewed @strong{as
23113 part of the API interface contract} and thus all new code should
23114 always specify visibility when it is not the default; i.e., declarations
23115 only for use within the local DSO should @strong{always} be marked explicitly
23116 as hidden as so to avoid PLT indirection overheads---making this
23117 abundantly clear also aids readability and self-documentation of the code.
23118 Note that due to ISO C++ specification requirements, @code{operator new} and
23119 @code{operator delete} must always be of default visibility.
23120
23121 Be aware that headers from outside your project, in particular system
23122 headers and headers from any other library you use, may not be
23123 expecting to be compiled with visibility other than the default. You
23124 may need to explicitly say @samp{#pragma GCC visibility push(default)}
23125 before including any such headers.
23126
23127 @samp{extern} declarations are not affected by @option{-fvisibility}, so
23128 a lot of code can be recompiled with @option{-fvisibility=hidden} with
23129 no modifications. However, this means that calls to @code{extern}
23130 functions with no explicit visibility use the PLT, so it is more
23131 effective to use @code{__attribute ((visibility))} and/or
23132 @code{#pragma GCC visibility} to tell the compiler which @code{extern}
23133 declarations should be treated as hidden.
23134
23135 Note that @option{-fvisibility} does affect C++ vague linkage
23136 entities. This means that, for instance, an exception class that is
23137 be thrown between DSOs must be explicitly marked with default
23138 visibility so that the @samp{type_info} nodes are unified between
23139 the DSOs.
23140
23141 An overview of these techniques, their benefits and how to use them
23142 is at @uref{http://gcc.gnu.org/@/wiki/@/Visibility}.
23143
23144 @item -fstrict-volatile-bitfields
23145 @opindex fstrict-volatile-bitfields
23146 This option should be used if accesses to volatile bit-fields (or other
23147 structure fields, although the compiler usually honors those types
23148 anyway) should use a single access of the width of the
23149 field's type, aligned to a natural alignment if possible. For
23150 example, targets with memory-mapped peripheral registers might require
23151 all such accesses to be 16 bits wide; with this flag you can
23152 declare all peripheral bit-fields as @code{unsigned short} (assuming short
23153 is 16 bits on these targets) to force GCC to use 16-bit accesses
23154 instead of, perhaps, a more efficient 32-bit access.
23155
23156 If this option is disabled, the compiler uses the most efficient
23157 instruction. In the previous example, that might be a 32-bit load
23158 instruction, even though that accesses bytes that do not contain
23159 any portion of the bit-field, or memory-mapped registers unrelated to
23160 the one being updated.
23161
23162 In some cases, such as when the @code{packed} attribute is applied to a
23163 structure field, it may not be possible to access the field with a single
23164 read or write that is correctly aligned for the target machine. In this
23165 case GCC falls back to generating multiple accesses rather than code that
23166 will fault or truncate the result at run time.
23167
23168 Note: Due to restrictions of the C/C++11 memory model, write accesses are
23169 not allowed to touch non bit-field members. It is therefore recommended
23170 to define all bits of the field's type as bit-field members.
23171
23172 The default value of this option is determined by the application binary
23173 interface for the target processor.
23174
23175 @item -fsync-libcalls
23176 @opindex fsync-libcalls
23177 This option controls whether any out-of-line instance of the @code{__sync}
23178 family of functions may be used to implement the C++11 @code{__atomic}
23179 family of functions.
23180
23181 The default value of this option is enabled, thus the only useful form
23182 of the option is @option{-fno-sync-libcalls}. This option is used in
23183 the implementation of the @file{libatomic} runtime library.
23184
23185 @end table
23186
23187 @c man end
23188
23189 @node Environment Variables
23190 @section Environment Variables Affecting GCC
23191 @cindex environment variables
23192
23193 @c man begin ENVIRONMENT
23194 This section describes several environment variables that affect how GCC
23195 operates. Some of them work by specifying directories or prefixes to use
23196 when searching for various kinds of files. Some are used to specify other
23197 aspects of the compilation environment.
23198
23199 Note that you can also specify places to search using options such as
23200 @option{-B}, @option{-I} and @option{-L} (@pxref{Directory Options}). These
23201 take precedence over places specified using environment variables, which
23202 in turn take precedence over those specified by the configuration of GCC@.
23203 @xref{Driver,, Controlling the Compilation Driver @file{gcc}, gccint,
23204 GNU Compiler Collection (GCC) Internals}.
23205
23206 @table @env
23207 @item LANG
23208 @itemx LC_CTYPE
23209 @c @itemx LC_COLLATE
23210 @itemx LC_MESSAGES
23211 @c @itemx LC_MONETARY
23212 @c @itemx LC_NUMERIC
23213 @c @itemx LC_TIME
23214 @itemx LC_ALL
23215 @findex LANG
23216 @findex LC_CTYPE
23217 @c @findex LC_COLLATE
23218 @findex LC_MESSAGES
23219 @c @findex LC_MONETARY
23220 @c @findex LC_NUMERIC
23221 @c @findex LC_TIME
23222 @findex LC_ALL
23223 @cindex locale
23224 These environment variables control the way that GCC uses
23225 localization information which allows GCC to work with different
23226 national conventions. GCC inspects the locale categories
23227 @env{LC_CTYPE} and @env{LC_MESSAGES} if it has been configured to do
23228 so. These locale categories can be set to any value supported by your
23229 installation. A typical value is @samp{en_GB.UTF-8} for English in the United
23230 Kingdom encoded in UTF-8.
23231
23232 The @env{LC_CTYPE} environment variable specifies character
23233 classification. GCC uses it to determine the character boundaries in
23234 a string; this is needed for some multibyte encodings that contain quote
23235 and escape characters that are otherwise interpreted as a string
23236 end or escape.
23237
23238 The @env{LC_MESSAGES} environment variable specifies the language to
23239 use in diagnostic messages.
23240
23241 If the @env{LC_ALL} environment variable is set, it overrides the value
23242 of @env{LC_CTYPE} and @env{LC_MESSAGES}; otherwise, @env{LC_CTYPE}
23243 and @env{LC_MESSAGES} default to the value of the @env{LANG}
23244 environment variable. If none of these variables are set, GCC
23245 defaults to traditional C English behavior.
23246
23247 @item TMPDIR
23248 @findex TMPDIR
23249 If @env{TMPDIR} is set, it specifies the directory to use for temporary
23250 files. GCC uses temporary files to hold the output of one stage of
23251 compilation which is to be used as input to the next stage: for example,
23252 the output of the preprocessor, which is the input to the compiler
23253 proper.
23254
23255 @item GCC_COMPARE_DEBUG
23256 @findex GCC_COMPARE_DEBUG
23257 Setting @env{GCC_COMPARE_DEBUG} is nearly equivalent to passing
23258 @option{-fcompare-debug} to the compiler driver. See the documentation
23259 of this option for more details.
23260
23261 @item GCC_EXEC_PREFIX
23262 @findex GCC_EXEC_PREFIX
23263 If @env{GCC_EXEC_PREFIX} is set, it specifies a prefix to use in the
23264 names of the subprograms executed by the compiler. No slash is added
23265 when this prefix is combined with the name of a subprogram, but you can
23266 specify a prefix that ends with a slash if you wish.
23267
23268 If @env{GCC_EXEC_PREFIX} is not set, GCC attempts to figure out
23269 an appropriate prefix to use based on the pathname it is invoked with.
23270
23271 If GCC cannot find the subprogram using the specified prefix, it
23272 tries looking in the usual places for the subprogram.
23273
23274 The default value of @env{GCC_EXEC_PREFIX} is
23275 @file{@var{prefix}/lib/gcc/} where @var{prefix} is the prefix to
23276 the installed compiler. In many cases @var{prefix} is the value
23277 of @code{prefix} when you ran the @file{configure} script.
23278
23279 Other prefixes specified with @option{-B} take precedence over this prefix.
23280
23281 This prefix is also used for finding files such as @file{crt0.o} that are
23282 used for linking.
23283
23284 In addition, the prefix is used in an unusual way in finding the
23285 directories to search for header files. For each of the standard
23286 directories whose name normally begins with @samp{/usr/local/lib/gcc}
23287 (more precisely, with the value of @env{GCC_INCLUDE_DIR}), GCC tries
23288 replacing that beginning with the specified prefix to produce an
23289 alternate directory name. Thus, with @option{-Bfoo/}, GCC searches
23290 @file{foo/bar} just before it searches the standard directory
23291 @file{/usr/local/lib/bar}.
23292 If a standard directory begins with the configured
23293 @var{prefix} then the value of @var{prefix} is replaced by
23294 @env{GCC_EXEC_PREFIX} when looking for header files.
23295
23296 @item COMPILER_PATH
23297 @findex COMPILER_PATH
23298 The value of @env{COMPILER_PATH} is a colon-separated list of
23299 directories, much like @env{PATH}. GCC tries the directories thus
23300 specified when searching for subprograms, if it can't find the
23301 subprograms using @env{GCC_EXEC_PREFIX}.
23302
23303 @item LIBRARY_PATH
23304 @findex LIBRARY_PATH
23305 The value of @env{LIBRARY_PATH} is a colon-separated list of
23306 directories, much like @env{PATH}. When configured as a native compiler,
23307 GCC tries the directories thus specified when searching for special
23308 linker files, if it can't find them using @env{GCC_EXEC_PREFIX}. Linking
23309 using GCC also uses these directories when searching for ordinary
23310 libraries for the @option{-l} option (but directories specified with
23311 @option{-L} come first).
23312
23313 @item LANG
23314 @findex LANG
23315 @cindex locale definition
23316 This variable is used to pass locale information to the compiler. One way in
23317 which this information is used is to determine the character set to be used
23318 when character literals, string literals and comments are parsed in C and C++.
23319 When the compiler is configured to allow multibyte characters,
23320 the following values for @env{LANG} are recognized:
23321
23322 @table @samp
23323 @item C-JIS
23324 Recognize JIS characters.
23325 @item C-SJIS
23326 Recognize SJIS characters.
23327 @item C-EUCJP
23328 Recognize EUCJP characters.
23329 @end table
23330
23331 If @env{LANG} is not defined, or if it has some other value, then the
23332 compiler uses @code{mblen} and @code{mbtowc} as defined by the default locale to
23333 recognize and translate multibyte characters.
23334 @end table
23335
23336 @noindent
23337 Some additional environment variables affect the behavior of the
23338 preprocessor.
23339
23340 @include cppenv.texi
23341
23342 @c man end
23343
23344 @node Precompiled Headers
23345 @section Using Precompiled Headers
23346 @cindex precompiled headers
23347 @cindex speed of compilation
23348
23349 Often large projects have many header files that are included in every
23350 source file. The time the compiler takes to process these header files
23351 over and over again can account for nearly all of the time required to
23352 build the project. To make builds faster, GCC allows you to
23353 @dfn{precompile} a header file.
23354
23355 To create a precompiled header file, simply compile it as you would any
23356 other file, if necessary using the @option{-x} option to make the driver
23357 treat it as a C or C++ header file. You may want to use a
23358 tool like @command{make} to keep the precompiled header up-to-date when
23359 the headers it contains change.
23360
23361 A precompiled header file is searched for when @code{#include} is
23362 seen in the compilation. As it searches for the included file
23363 (@pxref{Search Path,,Search Path,cpp,The C Preprocessor}) the
23364 compiler looks for a precompiled header in each directory just before it
23365 looks for the include file in that directory. The name searched for is
23366 the name specified in the @code{#include} with @samp{.gch} appended. If
23367 the precompiled header file can't be used, it is ignored.
23368
23369 For instance, if you have @code{#include "all.h"}, and you have
23370 @file{all.h.gch} in the same directory as @file{all.h}, then the
23371 precompiled header file is used if possible, and the original
23372 header is used otherwise.
23373
23374 Alternatively, you might decide to put the precompiled header file in a
23375 directory and use @option{-I} to ensure that directory is searched
23376 before (or instead of) the directory containing the original header.
23377 Then, if you want to check that the precompiled header file is always
23378 used, you can put a file of the same name as the original header in this
23379 directory containing an @code{#error} command.
23380
23381 This also works with @option{-include}. So yet another way to use
23382 precompiled headers, good for projects not designed with precompiled
23383 header files in mind, is to simply take most of the header files used by
23384 a project, include them from another header file, precompile that header
23385 file, and @option{-include} the precompiled header. If the header files
23386 have guards against multiple inclusion, they are skipped because
23387 they've already been included (in the precompiled header).
23388
23389 If you need to precompile the same header file for different
23390 languages, targets, or compiler options, you can instead make a
23391 @emph{directory} named like @file{all.h.gch}, and put each precompiled
23392 header in the directory, perhaps using @option{-o}. It doesn't matter
23393 what you call the files in the directory; every precompiled header in
23394 the directory is considered. The first precompiled header
23395 encountered in the directory that is valid for this compilation is
23396 used; they're searched in no particular order.
23397
23398 There are many other possibilities, limited only by your imagination,
23399 good sense, and the constraints of your build system.
23400
23401 A precompiled header file can be used only when these conditions apply:
23402
23403 @itemize
23404 @item
23405 Only one precompiled header can be used in a particular compilation.
23406
23407 @item
23408 A precompiled header can't be used once the first C token is seen. You
23409 can have preprocessor directives before a precompiled header; you cannot
23410 include a precompiled header from inside another header.
23411
23412 @item
23413 The precompiled header file must be produced for the same language as
23414 the current compilation. You can't use a C precompiled header for a C++
23415 compilation.
23416
23417 @item
23418 The precompiled header file must have been produced by the same compiler
23419 binary as the current compilation is using.
23420
23421 @item
23422 Any macros defined before the precompiled header is included must
23423 either be defined in the same way as when the precompiled header was
23424 generated, or must not affect the precompiled header, which usually
23425 means that they don't appear in the precompiled header at all.
23426
23427 The @option{-D} option is one way to define a macro before a
23428 precompiled header is included; using a @code{#define} can also do it.
23429 There are also some options that define macros implicitly, like
23430 @option{-O} and @option{-Wdeprecated}; the same rule applies to macros
23431 defined this way.
23432
23433 @item If debugging information is output when using the precompiled
23434 header, using @option{-g} or similar, the same kind of debugging information
23435 must have been output when building the precompiled header. However,
23436 a precompiled header built using @option{-g} can be used in a compilation
23437 when no debugging information is being output.
23438
23439 @item The same @option{-m} options must generally be used when building
23440 and using the precompiled header. @xref{Submodel Options},
23441 for any cases where this rule is relaxed.
23442
23443 @item Each of the following options must be the same when building and using
23444 the precompiled header:
23445
23446 @gccoptlist{-fexceptions}
23447
23448 @item
23449 Some other command-line options starting with @option{-f},
23450 @option{-p}, or @option{-O} must be defined in the same way as when
23451 the precompiled header was generated. At present, it's not clear
23452 which options are safe to change and which are not; the safest choice
23453 is to use exactly the same options when generating and using the
23454 precompiled header. The following are known to be safe:
23455
23456 @gccoptlist{-fmessage-length= -fpreprocessed -fsched-interblock @gol
23457 -fsched-spec -fsched-spec-load -fsched-spec-load-dangerous @gol
23458 -fsched-verbose=@var{number} -fschedule-insns -fvisibility= @gol
23459 -pedantic-errors}
23460
23461 @end itemize
23462
23463 For all of these except the last, the compiler automatically
23464 ignores the precompiled header if the conditions aren't met. If you
23465 find an option combination that doesn't work and doesn't cause the
23466 precompiled header to be ignored, please consider filing a bug report,
23467 see @ref{Bugs}.
23468
23469 If you do use differing options when generating and using the
23470 precompiled header, the actual behavior is a mixture of the
23471 behavior for the options. For instance, if you use @option{-g} to
23472 generate the precompiled header but not when using it, you may or may
23473 not get debugging information for routines in the precompiled header.