36c37e081ee5c067a63d283c35ef000737ef90f9
[gcc.git] / gcc / doc / invoke.texi
1 @c Copyright (C) 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
2 @c 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
3 @c Free Software Foundation, Inc.
4 @c This is part of the GCC manual.
5 @c For copying conditions, see the file gcc.texi.
6
7 @ignore
8 @c man begin INCLUDE
9 @include gcc-vers.texi
10 @c man end
11
12 @c man begin COPYRIGHT
13 Copyright @copyright{} 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
14 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
15 Free Software Foundation, Inc.
16
17 Permission is granted to copy, distribute and/or modify this document
18 under the terms of the GNU Free Documentation License, Version 1.3 or
19 any later version published by the Free Software Foundation; with the
20 Invariant Sections being ``GNU General Public License'' and ``Funding
21 Free Software'', the Front-Cover texts being (a) (see below), and with
22 the Back-Cover Texts being (b) (see below). A copy of the license is
23 included in the gfdl(7) man page.
24
25 (a) The FSF's Front-Cover Text is:
26
27 A GNU Manual
28
29 (b) The FSF's Back-Cover Text is:
30
31 You have freedom to copy and modify this GNU Manual, like GNU
32 software. Copies published by the Free Software Foundation raise
33 funds for GNU development.
34 @c man end
35 @c Set file name and title for the man page.
36 @setfilename gcc
37 @settitle GNU project C and C++ compiler
38 @c man begin SYNOPSIS
39 gcc [@option{-c}|@option{-S}|@option{-E}] [@option{-std=}@var{standard}]
40 [@option{-g}] [@option{-pg}] [@option{-O}@var{level}]
41 [@option{-W}@var{warn}@dots{}] [@option{-pedantic}]
42 [@option{-I}@var{dir}@dots{}] [@option{-L}@var{dir}@dots{}]
43 [@option{-D}@var{macro}[=@var{defn}]@dots{}] [@option{-U}@var{macro}]
44 [@option{-f}@var{option}@dots{}] [@option{-m}@var{machine-option}@dots{}]
45 [@option{-o} @var{outfile}] [@@@var{file}] @var{infile}@dots{}
46
47 Only the most useful options are listed here; see below for the
48 remainder. @samp{g++} accepts mostly the same options as @samp{gcc}.
49 @c man end
50 @c man begin SEEALSO
51 gpl(7), gfdl(7), fsf-funding(7),
52 cpp(1), gcov(1), as(1), ld(1), gdb(1), adb(1), dbx(1), sdb(1)
53 and the Info entries for @file{gcc}, @file{cpp}, @file{as},
54 @file{ld}, @file{binutils} and @file{gdb}.
55 @c man end
56 @c man begin BUGS
57 For instructions on reporting bugs, see
58 @w{@value{BUGURL}}.
59 @c man end
60 @c man begin AUTHOR
61 See the Info entry for @command{gcc}, or
62 @w{@uref{http://gcc.gnu.org/onlinedocs/gcc/Contributors.html}},
63 for contributors to GCC@.
64 @c man end
65 @end ignore
66
67 @node Invoking GCC
68 @chapter GCC Command Options
69 @cindex GCC command options
70 @cindex command options
71 @cindex options, GCC command
72
73 @c man begin DESCRIPTION
74 When you invoke GCC, it normally does preprocessing, compilation,
75 assembly and linking. The ``overall options'' allow you to stop this
76 process at an intermediate stage. For example, the @option{-c} option
77 says not to run the linker. Then the output consists of object files
78 output by the assembler.
79
80 Other options are passed on to one stage of processing. Some options
81 control the preprocessor and others the compiler itself. Yet other
82 options control the assembler and linker; most of these are not
83 documented here, since you rarely need to use any of them.
84
85 @cindex C compilation options
86 Most of the command line options that you can use with GCC are useful
87 for C programs; when an option is only useful with another language
88 (usually C++), the explanation says so explicitly. If the description
89 for a particular option does not mention a source language, you can use
90 that option with all supported languages.
91
92 @cindex C++ compilation options
93 @xref{Invoking G++,,Compiling C++ Programs}, for a summary of special
94 options for compiling C++ programs.
95
96 @cindex grouping options
97 @cindex options, grouping
98 The @command{gcc} program accepts options and file names as operands. Many
99 options have multi-letter names; therefore multiple single-letter options
100 may @emph{not} be grouped: @option{-dv} is very different from @w{@samp{-d
101 -v}}.
102
103 @cindex order of options
104 @cindex options, order
105 You can mix options and other arguments. For the most part, the order
106 you use doesn't matter. Order does matter when you use several
107 options of the same kind; for example, if you specify @option{-L} more
108 than once, the directories are searched in the order specified. Also,
109 the placement of the @option{-l} option is significant.
110
111 Many options have long names starting with @samp{-f} or with
112 @samp{-W}---for example,
113 @option{-fmove-loop-invariants}, @option{-Wformat} and so on. Most of
114 these have both positive and negative forms; the negative form of
115 @option{-ffoo} would be @option{-fno-foo}. This manual documents
116 only one of these two forms, whichever one is not the default.
117
118 @c man end
119
120 @xref{Option Index}, for an index to GCC's options.
121
122 @menu
123 * Option Summary:: Brief list of all options, without explanations.
124 * Overall Options:: Controlling the kind of output:
125 an executable, object files, assembler files,
126 or preprocessed source.
127 * Invoking G++:: Compiling C++ programs.
128 * C Dialect Options:: Controlling the variant of C language compiled.
129 * C++ Dialect Options:: Variations on C++.
130 * Objective-C and Objective-C++ Dialect Options:: Variations on Objective-C
131 and Objective-C++.
132 * Language Independent Options:: Controlling how diagnostics should be
133 formatted.
134 * Warning Options:: How picky should the compiler be?
135 * Debugging Options:: Symbol tables, measurements, and debugging dumps.
136 * Optimize Options:: How much optimization?
137 * Preprocessor Options:: Controlling header files and macro definitions.
138 Also, getting dependency information for Make.
139 * Assembler Options:: Passing options to the assembler.
140 * Link Options:: Specifying libraries and so on.
141 * Directory Options:: Where to find header files and libraries.
142 Where to find the compiler executable files.
143 * Spec Files:: How to pass switches to sub-processes.
144 * Target Options:: Running a cross-compiler, or an old version of GCC.
145 * Submodel Options:: Specifying minor hardware or convention variations,
146 such as 68010 vs 68020.
147 * Code Gen Options:: Specifying conventions for function calls, data layout
148 and register usage.
149 * Environment Variables:: Env vars that affect GCC.
150 * Precompiled Headers:: Compiling a header once, and using it many times.
151 @end menu
152
153 @c man begin OPTIONS
154
155 @node Option Summary
156 @section Option Summary
157
158 Here is a summary of all the options, grouped by type. Explanations are
159 in the following sections.
160
161 @table @emph
162 @item Overall Options
163 @xref{Overall Options,,Options Controlling the Kind of Output}.
164 @gccoptlist{-c -S -E -o @var{file} -no-canonical-prefixes @gol
165 -pipe -pass-exit-codes @gol
166 -x @var{language} -v -### --help@r{[}=@var{class}@r{[},@dots{}@r{]]} --target-help @gol
167 --version -wrapper @@@var{file} -fplugin=@var{file} -fplugin-arg-@var{name}=@var{arg} @gol
168 -fdump-ada-spec@r{[}-slim@r{]} -fdump-go-spec=@var{file}}
169
170 @item C Language Options
171 @xref{C Dialect Options,,Options Controlling C Dialect}.
172 @gccoptlist{-ansi -std=@var{standard} -fgnu89-inline @gol
173 -aux-info @var{filename} -fallow-parameterless-variadic-functions @gol
174 -fno-asm -fno-builtin -fno-builtin-@var{function} @gol
175 -fhosted -ffreestanding -fopenmp -fms-extensions -fplan9-extensions @gol
176 -trigraphs -no-integrated-cpp -traditional -traditional-cpp @gol
177 -fallow-single-precision -fcond-mismatch -flax-vector-conversions @gol
178 -fsigned-bitfields -fsigned-char @gol
179 -funsigned-bitfields -funsigned-char}
180
181 @item C++ Language Options
182 @xref{C++ Dialect Options,,Options Controlling C++ Dialect}.
183 @gccoptlist{-fabi-version=@var{n} -fno-access-control -fcheck-new @gol
184 -fconserve-space -fconstexpr-depth=@var{n} -ffriend-injection @gol
185 -fno-elide-constructors @gol
186 -fno-enforce-eh-specs @gol
187 -ffor-scope -fno-for-scope -fno-gnu-keywords @gol
188 -fno-implicit-templates @gol
189 -fno-implicit-inline-templates @gol
190 -fno-implement-inlines -fms-extensions @gol
191 -fno-nonansi-builtins -fnothrow-opt -fno-operator-names @gol
192 -fno-optional-diags -fpermissive @gol
193 -fno-pretty-templates @gol
194 -frepo -fno-rtti -fstats -ftemplate-depth=@var{n} @gol
195 -fno-threadsafe-statics -fuse-cxa-atexit -fno-weak -nostdinc++ @gol
196 -fno-default-inline -fvisibility-inlines-hidden @gol
197 -fvisibility-ms-compat @gol
198 -Wabi -Wconversion-null -Wctor-dtor-privacy @gol
199 -Wnoexcept -Wnon-virtual-dtor -Wreorder @gol
200 -Weffc++ -Wstrict-null-sentinel @gol
201 -Wno-non-template-friend -Wold-style-cast @gol
202 -Woverloaded-virtual -Wno-pmf-conversions @gol
203 -Wsign-promo -Wzero-as-null-pointer-constant}
204
205 @item Objective-C and Objective-C++ Language Options
206 @xref{Objective-C and Objective-C++ Dialect Options,,Options Controlling
207 Objective-C and Objective-C++ Dialects}.
208 @gccoptlist{-fconstant-string-class=@var{class-name} @gol
209 -fgnu-runtime -fnext-runtime @gol
210 -fno-nil-receivers @gol
211 -fobjc-abi-version=@var{n} @gol
212 -fobjc-call-cxx-cdtors @gol
213 -fobjc-direct-dispatch @gol
214 -fobjc-exceptions @gol
215 -fobjc-gc @gol
216 -fobjc-nilcheck @gol
217 -fobjc-std=objc1 @gol
218 -freplace-objc-classes @gol
219 -fzero-link @gol
220 -gen-decls @gol
221 -Wassign-intercept @gol
222 -Wno-protocol -Wselector @gol
223 -Wstrict-selector-match @gol
224 -Wundeclared-selector}
225
226 @item Language Independent Options
227 @xref{Language Independent Options,,Options to Control Diagnostic Messages Formatting}.
228 @gccoptlist{-fmessage-length=@var{n} @gol
229 -fdiagnostics-show-location=@r{[}once@r{|}every-line@r{]} @gol
230 -fno-diagnostics-show-option}
231
232 @item Warning Options
233 @xref{Warning Options,,Options to Request or Suppress Warnings}.
234 @gccoptlist{-fsyntax-only -fmax-errors=@var{n} -pedantic @gol
235 -pedantic-errors @gol
236 -w -Wextra -Wall -Waddress -Waggregate-return -Warray-bounds @gol
237 -Wno-attributes -Wno-builtin-macro-redefined @gol
238 -Wc++-compat -Wc++11-compat -Wcast-align -Wcast-qual @gol
239 -Wchar-subscripts -Wclobbered -Wcomment @gol
240 -Wconversion -Wcoverage-mismatch -Wno-cpp -Wno-deprecated @gol
241 -Wno-deprecated-declarations -Wdisabled-optimization @gol
242 -Wno-div-by-zero -Wdouble-promotion -Wempty-body -Wenum-compare @gol
243 -Wno-endif-labels -Werror -Werror=* @gol
244 -Wfatal-errors -Wfloat-equal -Wformat -Wformat=2 @gol
245 -Wno-format-contains-nul -Wno-format-extra-args -Wformat-nonliteral @gol
246 -Wformat-security -Wformat-y2k @gol
247 -Wframe-larger-than=@var{len} -Wno-free-nonheap-object -Wjump-misses-init @gol
248 -Wignored-qualifiers @gol
249 -Wimplicit -Wimplicit-function-declaration -Wimplicit-int @gol
250 -Winit-self -Winline -Wmaybe-uninitialized @gol
251 -Wno-int-to-pointer-cast -Wno-invalid-offsetof @gol
252 -Winvalid-pch -Wlarger-than=@var{len} -Wunsafe-loop-optimizations @gol
253 -Wlogical-op -Wlong-long @gol
254 -Wmain -Wmaybe-uninitialized -Wmissing-braces -Wmissing-field-initializers @gol
255 -Wmissing-format-attribute -Wmissing-include-dirs @gol
256 -Wno-mudflap @gol
257 -Wno-multichar -Wnonnull -Wno-overflow @gol
258 -Woverlength-strings -Wpacked -Wpacked-bitfield-compat -Wpadded @gol
259 -Wparentheses -Wpedantic-ms-format -Wno-pedantic-ms-format @gol
260 -Wpointer-arith -Wno-pointer-to-int-cast @gol
261 -Wredundant-decls @gol
262 -Wreturn-type -Wsequence-point -Wshadow @gol
263 -Wsign-compare -Wsign-conversion -Wstack-protector @gol
264 -Wstack-usage=@var{len} -Wstrict-aliasing -Wstrict-aliasing=n @gol
265 -Wstrict-overflow -Wstrict-overflow=@var{n} @gol
266 -Wsuggest-attribute=@r{[}pure@r{|}const@r{|}noreturn@r{]} @gol
267 -Wswitch -Wswitch-default -Wswitch-enum -Wsync-nand @gol
268 -Wsystem-headers -Wtrampolines -Wtrigraphs -Wtype-limits -Wundef @gol
269 -Wuninitialized -Wunknown-pragmas -Wno-pragmas @gol
270 -Wunsuffixed-float-constants -Wunused -Wunused-function @gol
271 -Wunused-label -Wunused-local-typedefs -Wunused-parameter @gol
272 -Wno-unused-result -Wunused-value @gol -Wunused-variable @gol
273 -Wunused-but-set-parameter -Wunused-but-set-variable @gol
274 -Wvariadic-macros -Wvector-operation-performance -Wvla
275 -Wvolatile-register-var -Wwrite-strings}
276
277 @item C and Objective-C-only Warning Options
278 @gccoptlist{-Wbad-function-cast -Wmissing-declarations @gol
279 -Wmissing-parameter-type -Wmissing-prototypes -Wnested-externs @gol
280 -Wold-style-declaration -Wold-style-definition @gol
281 -Wstrict-prototypes -Wtraditional -Wtraditional-conversion @gol
282 -Wdeclaration-after-statement -Wpointer-sign}
283
284 @item Debugging Options
285 @xref{Debugging Options,,Options for Debugging Your Program or GCC}.
286 @gccoptlist{-d@var{letters} -dumpspecs -dumpmachine -dumpversion @gol
287 -fdbg-cnt-list -fdbg-cnt=@var{counter-value-list} @gol
288 -fdisable-ipa-@var{pass_name} @gol
289 -fdisable-rtl-@var{pass_name} @gol
290 -fdisable-rtl-@var{pass-name}=@var{range-list} @gol
291 -fdisable-tree-@var{pass_name} @gol
292 -fdisable-tree-@var{pass-name}=@var{range-list} @gol
293 -fdump-noaddr -fdump-unnumbered -fdump-unnumbered-links @gol
294 -fdump-translation-unit@r{[}-@var{n}@r{]} @gol
295 -fdump-class-hierarchy@r{[}-@var{n}@r{]} @gol
296 -fdump-ipa-all -fdump-ipa-cgraph -fdump-ipa-inline @gol
297 -fdump-passes @gol
298 -fdump-statistics @gol
299 -fdump-tree-all @gol
300 -fdump-tree-original@r{[}-@var{n}@r{]} @gol
301 -fdump-tree-optimized@r{[}-@var{n}@r{]} @gol
302 -fdump-tree-cfg -fdump-tree-vcg -fdump-tree-alias @gol
303 -fdump-tree-ch @gol
304 -fdump-tree-ssa@r{[}-@var{n}@r{]} -fdump-tree-pre@r{[}-@var{n}@r{]} @gol
305 -fdump-tree-ccp@r{[}-@var{n}@r{]} -fdump-tree-dce@r{[}-@var{n}@r{]} @gol
306 -fdump-tree-gimple@r{[}-raw@r{]} -fdump-tree-mudflap@r{[}-@var{n}@r{]} @gol
307 -fdump-tree-dom@r{[}-@var{n}@r{]} @gol
308 -fdump-tree-dse@r{[}-@var{n}@r{]} @gol
309 -fdump-tree-phiprop@r{[}-@var{n}@r{]} @gol
310 -fdump-tree-phiopt@r{[}-@var{n}@r{]} @gol
311 -fdump-tree-forwprop@r{[}-@var{n}@r{]} @gol
312 -fdump-tree-copyrename@r{[}-@var{n}@r{]} @gol
313 -fdump-tree-nrv -fdump-tree-vect @gol
314 -fdump-tree-sink @gol
315 -fdump-tree-sra@r{[}-@var{n}@r{]} @gol
316 -fdump-tree-forwprop@r{[}-@var{n}@r{]} @gol
317 -fdump-tree-fre@r{[}-@var{n}@r{]} @gol
318 -fdump-tree-vrp@r{[}-@var{n}@r{]} @gol
319 -ftree-vectorizer-verbose=@var{n} @gol
320 -fdump-tree-storeccp@r{[}-@var{n}@r{]} @gol
321 -fdump-final-insns=@var{file} @gol
322 -fcompare-debug@r{[}=@var{opts}@r{]} -fcompare-debug-second @gol
323 -feliminate-dwarf2-dups -feliminate-unused-debug-types @gol
324 -feliminate-unused-debug-symbols -femit-class-debug-always @gol
325 -fenable-@var{kind}-@var{pass} @gol
326 -fenable-@var{kind}-@var{pass}=@var{range-list} @gol
327 -fdebug-types-section @gol
328 -fmem-report -fpre-ipa-mem-report -fpost-ipa-mem-report -fprofile-arcs @gol
329 -frandom-seed=@var{string} -fsched-verbose=@var{n} @gol
330 -fsel-sched-verbose -fsel-sched-dump-cfg -fsel-sched-pipelining-verbose @gol
331 -fstack-usage -ftest-coverage -ftime-report -fvar-tracking @gol
332 -fvar-tracking-assignments -fvar-tracking-assignments-toggle @gol
333 -g -g@var{level} -gtoggle -gcoff -gdwarf-@var{version} @gol
334 -ggdb -grecord-gcc-switches -gno-record-gcc-switches @gol
335 -gstabs -gstabs+ -gstrict-dwarf -gno-strict-dwarf @gol
336 -gvms -gxcoff -gxcoff+ @gol
337 -fno-merge-debug-strings -fno-dwarf2-cfi-asm @gol
338 -fdebug-prefix-map=@var{old}=@var{new} @gol
339 -femit-struct-debug-baseonly -femit-struct-debug-reduced @gol
340 -femit-struct-debug-detailed@r{[}=@var{spec-list}@r{]} @gol
341 -p -pg -print-file-name=@var{library} -print-libgcc-file-name @gol
342 -print-multi-directory -print-multi-lib -print-multi-os-directory @gol
343 -print-prog-name=@var{program} -print-search-dirs -Q @gol
344 -print-sysroot -print-sysroot-headers-suffix @gol
345 -save-temps -save-temps=cwd -save-temps=obj -time@r{[}=@var{file}@r{]}}
346
347 @item Optimization Options
348 @xref{Optimize Options,,Options that Control Optimization}.
349 @gccoptlist{-falign-functions[=@var{n}] -falign-jumps[=@var{n}] @gol
350 -falign-labels[=@var{n}] -falign-loops[=@var{n}] -fassociative-math @gol
351 -fauto-inc-dec -fbranch-probabilities -fbranch-target-load-optimize @gol
352 -fbranch-target-load-optimize2 -fbtr-bb-exclusive -fcaller-saves @gol
353 -fcheck-data-deps -fcombine-stack-adjustments -fconserve-stack @gol
354 -fcompare-elim -fcprop-registers -fcrossjumping @gol
355 -fcse-follow-jumps -fcse-skip-blocks -fcx-fortran-rules @gol
356 -fcx-limited-range @gol
357 -fdata-sections -fdce -fdce -fdelayed-branch @gol
358 -fdelete-null-pointer-checks -fdse -fdevirtualize -fdse @gol
359 -fearly-inlining -fipa-sra -fexpensive-optimizations -ffat-lto-objects @gol
360 -ffast-math -ffinite-math-only -ffloat-store -fexcess-precision=@var{style} @gol
361 -fforward-propagate -ffp-contract=@var{style} -ffunction-sections @gol
362 -fgcse -fgcse-after-reload -fgcse-las -fgcse-lm -fgraphite-identity @gol
363 -fgcse-sm -fif-conversion -fif-conversion2 -findirect-inlining @gol
364 -finline-functions -finline-functions-called-once -finline-limit=@var{n} @gol
365 -finline-small-functions -fipa-cp -fipa-cp-clone -fipa-matrix-reorg @gol
366 -fipa-pta -fipa-profile -fipa-pure-const -fipa-reference @gol
367 -fira-algorithm=@var{algorithm} @gol
368 -fira-region=@var{region} @gol
369 -fira-loop-pressure -fno-ira-share-save-slots @gol
370 -fno-ira-share-spill-slots -fira-verbose=@var{n} @gol
371 -fivopts -fkeep-inline-functions -fkeep-static-consts @gol
372 -floop-block -floop-flatten -floop-interchange -floop-strip-mine @gol
373 -floop-parallelize-all -flto -flto-compression-level @gol
374 -flto-partition=@var{alg} -flto-report -fmerge-all-constants @gol
375 -fmerge-constants -fmodulo-sched -fmodulo-sched-allow-regmoves @gol
376 -fmove-loop-invariants fmudflap -fmudflapir -fmudflapth -fno-branch-count-reg @gol
377 -fno-default-inline @gol
378 -fno-defer-pop -fno-function-cse -fno-guess-branch-probability @gol
379 -fno-inline -fno-math-errno -fno-peephole -fno-peephole2 @gol
380 -fno-sched-interblock -fno-sched-spec -fno-signed-zeros @gol
381 -fno-toplevel-reorder -fno-trapping-math -fno-zero-initialized-in-bss @gol
382 -fomit-frame-pointer -foptimize-register-move -foptimize-sibling-calls @gol
383 -fpartial-inlining -fpeel-loops -fpredictive-commoning @gol
384 -fprefetch-loop-arrays @gol
385 -fprofile-correction -fprofile-dir=@var{path} -fprofile-generate @gol
386 -fprofile-generate=@var{path} @gol
387 -fprofile-use -fprofile-use=@var{path} -fprofile-values @gol
388 -freciprocal-math -fregmove -frename-registers -freorder-blocks @gol
389 -freorder-blocks-and-partition -freorder-functions @gol
390 -frerun-cse-after-loop -freschedule-modulo-scheduled-loops @gol
391 -frounding-math -fsched2-use-superblocks -fsched-pressure @gol
392 -fsched-spec-load -fsched-spec-load-dangerous @gol
393 -fsched-stalled-insns-dep[=@var{n}] -fsched-stalled-insns[=@var{n}] @gol
394 -fsched-group-heuristic -fsched-critical-path-heuristic @gol
395 -fsched-spec-insn-heuristic -fsched-rank-heuristic @gol
396 -fsched-last-insn-heuristic -fsched-dep-count-heuristic @gol
397 -fschedule-insns -fschedule-insns2 -fsection-anchors @gol
398 -fselective-scheduling -fselective-scheduling2 @gol
399 -fsel-sched-pipelining -fsel-sched-pipelining-outer-loops @gol
400 -fshrink-wrap -fsignaling-nans -fsingle-precision-constant @gol
401 -fsplit-ivs-in-unroller -fsplit-wide-types -fstack-protector @gol
402 -fstack-protector-all -fstrict-aliasing -fstrict-overflow @gol
403 -fthread-jumps -ftracer -ftree-bit-ccp @gol
404 -ftree-builtin-call-dce -ftree-ccp -ftree-ch -ftree-copy-prop @gol
405 -ftree-copyrename -ftree-dce -ftree-dominator-opts -ftree-dse @gol
406 -ftree-forwprop -ftree-fre -ftree-loop-if-convert @gol
407 -ftree-loop-if-convert-stores -ftree-loop-im @gol
408 -ftree-phiprop -ftree-loop-distribution -ftree-loop-distribute-patterns @gol
409 -ftree-loop-ivcanon -ftree-loop-linear -ftree-loop-optimize @gol
410 -ftree-parallelize-loops=@var{n} -ftree-pre -ftree-pta -ftree-reassoc @gol
411 -ftree-sink -ftree-sra -ftree-switch-conversion -ftree-tail-merge @gol
412 -ftree-ter -ftree-vect-loop-version -ftree-vectorize -ftree-vrp @gol
413 -funit-at-a-time -funroll-all-loops -funroll-loops @gol
414 -funsafe-loop-optimizations -funsafe-math-optimizations -funswitch-loops @gol
415 -fvariable-expansion-in-unroller -fvect-cost-model -fvpt -fweb @gol
416 -fwhole-program -fwpa -fuse-linker-plugin @gol
417 --param @var{name}=@var{value}
418 -O -O0 -O1 -O2 -O3 -Os -Ofast}
419
420 @item Preprocessor Options
421 @xref{Preprocessor Options,,Options Controlling the Preprocessor}.
422 @gccoptlist{-A@var{question}=@var{answer} @gol
423 -A-@var{question}@r{[}=@var{answer}@r{]} @gol
424 -C -dD -dI -dM -dN @gol
425 -D@var{macro}@r{[}=@var{defn}@r{]} -E -H @gol
426 -idirafter @var{dir} @gol
427 -include @var{file} -imacros @var{file} @gol
428 -iprefix @var{file} -iwithprefix @var{dir} @gol
429 -iwithprefixbefore @var{dir} -isystem @var{dir} @gol
430 -imultilib @var{dir} -isysroot @var{dir} @gol
431 -M -MM -MF -MG -MP -MQ -MT -nostdinc @gol
432 -P -fdebug-cpp -ftrack-macro-expansion -fworking-directory @gol
433 -remap -trigraphs -undef -U@var{macro} @gol
434 -Wp,@var{option} -Xpreprocessor @var{option}}
435
436 @item Assembler Option
437 @xref{Assembler Options,,Passing Options to the Assembler}.
438 @gccoptlist{-Wa,@var{option} -Xassembler @var{option}}
439
440 @item Linker Options
441 @xref{Link Options,,Options for Linking}.
442 @gccoptlist{@var{object-file-name} -l@var{library} @gol
443 -nostartfiles -nodefaultlibs -nostdlib -pie -rdynamic @gol
444 -s -static -static-libgcc -static-libstdc++ -shared @gol
445 -shared-libgcc -symbolic @gol
446 -T @var{script} -Wl,@var{option} -Xlinker @var{option} @gol
447 -u @var{symbol}}
448
449 @item Directory Options
450 @xref{Directory Options,,Options for Directory Search}.
451 @gccoptlist{-B@var{prefix} -I@var{dir} -iplugindir=@var{dir} @gol
452 -iquote@var{dir} -L@var{dir} -specs=@var{file} -I- @gol
453 --sysroot=@var{dir}}
454
455 @item Machine Dependent Options
456 @xref{Submodel Options,,Hardware Models and Configurations}.
457 @c This list is ordered alphanumerically by subsection name.
458 @c Try and put the significant identifier (CPU or system) first,
459 @c so users have a clue at guessing where the ones they want will be.
460
461 @emph{Adapteva Epiphany Options}
462 @gccoptlist{-mhalf-reg-file -mprefer-short-insn-regs @gol
463 -mbranch-cost=@var{num} -mcmove -mnops=@var{num} -msoft-cmpsf @gol
464 -msplit-lohi -mpost-inc -mpost-modify -mstack-offset=@var{num} @gol
465 -mround-nearest -mlong-calls -mshort-calls -msmall16 @gol
466 -mfp-mode=@var{mode} -mvect-double -max-vect-align=@var{num} @gol
467 -msplit-vecmove-early -m1reg-@var{reg}}
468
469 @emph{ARM Options}
470 @gccoptlist{-mapcs-frame -mno-apcs-frame @gol
471 -mabi=@var{name} @gol
472 -mapcs-stack-check -mno-apcs-stack-check @gol
473 -mapcs-float -mno-apcs-float @gol
474 -mapcs-reentrant -mno-apcs-reentrant @gol
475 -msched-prolog -mno-sched-prolog @gol
476 -mlittle-endian -mbig-endian -mwords-little-endian @gol
477 -mfloat-abi=@var{name} -mfpe @gol
478 -mfp16-format=@var{name}
479 -mthumb-interwork -mno-thumb-interwork @gol
480 -mcpu=@var{name} -march=@var{name} -mfpu=@var{name} @gol
481 -mstructure-size-boundary=@var{n} @gol
482 -mabort-on-noreturn @gol
483 -mlong-calls -mno-long-calls @gol
484 -msingle-pic-base -mno-single-pic-base @gol
485 -mpic-register=@var{reg} @gol
486 -mnop-fun-dllimport @gol
487 -mcirrus-fix-invalid-insns -mno-cirrus-fix-invalid-insns @gol
488 -mpoke-function-name @gol
489 -mthumb -marm @gol
490 -mtpcs-frame -mtpcs-leaf-frame @gol
491 -mcaller-super-interworking -mcallee-super-interworking @gol
492 -mtp=@var{name} -mtls-dialect=@var{dialect} @gol
493 -mword-relocations @gol
494 -mfix-cortex-m3-ldrd}
495
496 @emph{AVR Options}
497 @gccoptlist{-mmcu=@var{mcu} -mno-interrupts @gol
498 -mcall-prologues -mtiny-stack -mint8 -mstrict-X}
499
500 @emph{Blackfin Options}
501 @gccoptlist{-mcpu=@var{cpu}@r{[}-@var{sirevision}@r{]} @gol
502 -msim -momit-leaf-frame-pointer -mno-omit-leaf-frame-pointer @gol
503 -mspecld-anomaly -mno-specld-anomaly -mcsync-anomaly -mno-csync-anomaly @gol
504 -mlow-64k -mno-low64k -mstack-check-l1 -mid-shared-library @gol
505 -mno-id-shared-library -mshared-library-id=@var{n} @gol
506 -mleaf-id-shared-library -mno-leaf-id-shared-library @gol
507 -msep-data -mno-sep-data -mlong-calls -mno-long-calls @gol
508 -mfast-fp -minline-plt -mmulticore -mcorea -mcoreb -msdram @gol
509 -micplb}
510
511 @emph{C6X Options}
512 @gccoptlist{-mbig-endian -mlittle-endian -march=@var{cpu} @gol
513 -msim -msdata=@var{sdata-type}}
514
515 @emph{CRIS Options}
516 @gccoptlist{-mcpu=@var{cpu} -march=@var{cpu} -mtune=@var{cpu} @gol
517 -mmax-stack-frame=@var{n} -melinux-stacksize=@var{n} @gol
518 -metrax4 -metrax100 -mpdebug -mcc-init -mno-side-effects @gol
519 -mstack-align -mdata-align -mconst-align @gol
520 -m32-bit -m16-bit -m8-bit -mno-prologue-epilogue -mno-gotplt @gol
521 -melf -maout -melinux -mlinux -sim -sim2 @gol
522 -mmul-bug-workaround -mno-mul-bug-workaround}
523
524 @emph{Darwin Options}
525 @gccoptlist{-all_load -allowable_client -arch -arch_errors_fatal @gol
526 -arch_only -bind_at_load -bundle -bundle_loader @gol
527 -client_name -compatibility_version -current_version @gol
528 -dead_strip @gol
529 -dependency-file -dylib_file -dylinker_install_name @gol
530 -dynamic -dynamiclib -exported_symbols_list @gol
531 -filelist -flat_namespace -force_cpusubtype_ALL @gol
532 -force_flat_namespace -headerpad_max_install_names @gol
533 -iframework @gol
534 -image_base -init -install_name -keep_private_externs @gol
535 -multi_module -multiply_defined -multiply_defined_unused @gol
536 -noall_load -no_dead_strip_inits_and_terms @gol
537 -nofixprebinding -nomultidefs -noprebind -noseglinkedit @gol
538 -pagezero_size -prebind -prebind_all_twolevel_modules @gol
539 -private_bundle -read_only_relocs -sectalign @gol
540 -sectobjectsymbols -whyload -seg1addr @gol
541 -sectcreate -sectobjectsymbols -sectorder @gol
542 -segaddr -segs_read_only_addr -segs_read_write_addr @gol
543 -seg_addr_table -seg_addr_table_filename -seglinkedit @gol
544 -segprot -segs_read_only_addr -segs_read_write_addr @gol
545 -single_module -static -sub_library -sub_umbrella @gol
546 -twolevel_namespace -umbrella -undefined @gol
547 -unexported_symbols_list -weak_reference_mismatches @gol
548 -whatsloaded -F -gused -gfull -mmacosx-version-min=@var{version} @gol
549 -mkernel -mone-byte-bool}
550
551 @emph{DEC Alpha Options}
552 @gccoptlist{-mno-fp-regs -msoft-float -malpha-as -mgas @gol
553 -mieee -mieee-with-inexact -mieee-conformant @gol
554 -mfp-trap-mode=@var{mode} -mfp-rounding-mode=@var{mode} @gol
555 -mtrap-precision=@var{mode} -mbuild-constants @gol
556 -mcpu=@var{cpu-type} -mtune=@var{cpu-type} @gol
557 -mbwx -mmax -mfix -mcix @gol
558 -mfloat-vax -mfloat-ieee @gol
559 -mexplicit-relocs -msmall-data -mlarge-data @gol
560 -msmall-text -mlarge-text @gol
561 -mmemory-latency=@var{time}}
562
563 @emph{DEC Alpha/VMS Options}
564 @gccoptlist{-mvms-return-codes -mdebug-main=@var{prefix} -mmalloc64}
565
566 @emph{FR30 Options}
567 @gccoptlist{-msmall-model -mno-lsim}
568
569 @emph{FRV Options}
570 @gccoptlist{-mgpr-32 -mgpr-64 -mfpr-32 -mfpr-64 @gol
571 -mhard-float -msoft-float @gol
572 -malloc-cc -mfixed-cc -mdword -mno-dword @gol
573 -mdouble -mno-double @gol
574 -mmedia -mno-media -mmuladd -mno-muladd @gol
575 -mfdpic -minline-plt -mgprel-ro -multilib-library-pic @gol
576 -mlinked-fp -mlong-calls -malign-labels @gol
577 -mlibrary-pic -macc-4 -macc-8 @gol
578 -mpack -mno-pack -mno-eflags -mcond-move -mno-cond-move @gol
579 -moptimize-membar -mno-optimize-membar @gol
580 -mscc -mno-scc -mcond-exec -mno-cond-exec @gol
581 -mvliw-branch -mno-vliw-branch @gol
582 -mmulti-cond-exec -mno-multi-cond-exec -mnested-cond-exec @gol
583 -mno-nested-cond-exec -mtomcat-stats @gol
584 -mTLS -mtls @gol
585 -mcpu=@var{cpu}}
586
587 @emph{GNU/Linux Options}
588 @gccoptlist{-mglibc -muclibc -mbionic -mandroid @gol
589 -tno-android-cc -tno-android-ld}
590
591 @emph{H8/300 Options}
592 @gccoptlist{-mrelax -mh -ms -mn -mint32 -malign-300}
593
594 @emph{HPPA Options}
595 @gccoptlist{-march=@var{architecture-type} @gol
596 -mbig-switch -mdisable-fpregs -mdisable-indexing @gol
597 -mfast-indirect-calls -mgas -mgnu-ld -mhp-ld @gol
598 -mfixed-range=@var{register-range} @gol
599 -mjump-in-delay -mlinker-opt -mlong-calls @gol
600 -mlong-load-store -mno-big-switch -mno-disable-fpregs @gol
601 -mno-disable-indexing -mno-fast-indirect-calls -mno-gas @gol
602 -mno-jump-in-delay -mno-long-load-store @gol
603 -mno-portable-runtime -mno-soft-float @gol
604 -mno-space-regs -msoft-float -mpa-risc-1-0 @gol
605 -mpa-risc-1-1 -mpa-risc-2-0 -mportable-runtime @gol
606 -mschedule=@var{cpu-type} -mspace-regs -msio -mwsio @gol
607 -munix=@var{unix-std} -nolibdld -static -threads}
608
609 @emph{i386 and x86-64 Options}
610 @gccoptlist{-mtune=@var{cpu-type} -march=@var{cpu-type} @gol
611 -mfpmath=@var{unit} @gol
612 -masm=@var{dialect} -mno-fancy-math-387 @gol
613 -mno-fp-ret-in-387 -msoft-float @gol
614 -mno-wide-multiply -mrtd -malign-double @gol
615 -mpreferred-stack-boundary=@var{num} @gol
616 -mincoming-stack-boundary=@var{num} @gol
617 -mcld -mcx16 -msahf -mmovbe -mcrc32 @gol
618 -mrecip -mrecip=@var{opt} @gol
619 -mvzeroupper @gol
620 -mmmx -msse -msse2 -msse3 -mssse3 -msse4.1 -msse4.2 -msse4 -mavx @gol
621 -mavx2 -maes -mpclmul -mfsgsbase -mrdrnd -mf16c -mfma @gol
622 -msse4a -m3dnow -mpopcnt -mabm -mbmi -mtbm -mfma4 -mxop -mlzcnt @gol
623 -mbmi2 -mlwp -mthreads -mno-align-stringops -minline-all-stringops @gol
624 -minline-stringops-dynamically -mstringop-strategy=@var{alg} @gol
625 -mpush-args -maccumulate-outgoing-args -m128bit-long-double @gol
626 -m96bit-long-double -mregparm=@var{num} -msseregparm @gol
627 -mveclibabi=@var{type} -mvect8-ret-in-mem @gol
628 -mpc32 -mpc64 -mpc80 -mstackrealign @gol
629 -momit-leaf-frame-pointer -mno-red-zone -mno-tls-direct-seg-refs @gol
630 -mcmodel=@var{code-model} -mabi=@var{name} @gol
631 -m32 -m64 -mx32 -mlarge-data-threshold=@var{num} @gol
632 -msse2avx -mfentry -m8bit-idiv @gol
633 -mavx256-split-unaligned-load -mavx256-split-unaligned-store}
634
635 @emph{i386 and x86-64 Windows Options}
636 @gccoptlist{-mconsole -mcygwin -mno-cygwin -mdll @gol
637 -mnop-fun-dllimport -mthread @gol
638 -municode -mwin32 -mwindows -fno-set-stack-executable}
639
640 @emph{IA-64 Options}
641 @gccoptlist{-mbig-endian -mlittle-endian -mgnu-as -mgnu-ld -mno-pic @gol
642 -mvolatile-asm-stop -mregister-names -msdata -mno-sdata @gol
643 -mconstant-gp -mauto-pic -mfused-madd @gol
644 -minline-float-divide-min-latency @gol
645 -minline-float-divide-max-throughput @gol
646 -mno-inline-float-divide @gol
647 -minline-int-divide-min-latency @gol
648 -minline-int-divide-max-throughput @gol
649 -mno-inline-int-divide @gol
650 -minline-sqrt-min-latency -minline-sqrt-max-throughput @gol
651 -mno-inline-sqrt @gol
652 -mdwarf2-asm -mearly-stop-bits @gol
653 -mfixed-range=@var{register-range} -mtls-size=@var{tls-size} @gol
654 -mtune=@var{cpu-type} -milp32 -mlp64 @gol
655 -msched-br-data-spec -msched-ar-data-spec -msched-control-spec @gol
656 -msched-br-in-data-spec -msched-ar-in-data-spec -msched-in-control-spec @gol
657 -msched-spec-ldc -msched-spec-control-ldc @gol
658 -msched-prefer-non-data-spec-insns -msched-prefer-non-control-spec-insns @gol
659 -msched-stop-bits-after-every-cycle -msched-count-spec-in-critical-path @gol
660 -msel-sched-dont-check-control-spec -msched-fp-mem-deps-zero-cost @gol
661 -msched-max-memory-insns-hard-limit -msched-max-memory-insns=@var{max-insns}}
662
663 @emph{IA-64/VMS Options}
664 @gccoptlist{-mvms-return-codes -mdebug-main=@var{prefix} -mmalloc64}
665
666 @emph{LM32 Options}
667 @gccoptlist{-mbarrel-shift-enabled -mdivide-enabled -mmultiply-enabled @gol
668 -msign-extend-enabled -muser-enabled}
669
670 @emph{M32R/D Options}
671 @gccoptlist{-m32r2 -m32rx -m32r @gol
672 -mdebug @gol
673 -malign-loops -mno-align-loops @gol
674 -missue-rate=@var{number} @gol
675 -mbranch-cost=@var{number} @gol
676 -mmodel=@var{code-size-model-type} @gol
677 -msdata=@var{sdata-type} @gol
678 -mno-flush-func -mflush-func=@var{name} @gol
679 -mno-flush-trap -mflush-trap=@var{number} @gol
680 -G @var{num}}
681
682 @emph{M32C Options}
683 @gccoptlist{-mcpu=@var{cpu} -msim -memregs=@var{number}}
684
685 @emph{M680x0 Options}
686 @gccoptlist{-march=@var{arch} -mcpu=@var{cpu} -mtune=@var{tune}
687 -m68000 -m68020 -m68020-40 -m68020-60 -m68030 -m68040 @gol
688 -m68060 -mcpu32 -m5200 -m5206e -m528x -m5307 -m5407 @gol
689 -mcfv4e -mbitfield -mno-bitfield -mc68000 -mc68020 @gol
690 -mnobitfield -mrtd -mno-rtd -mdiv -mno-div -mshort @gol
691 -mno-short -mhard-float -m68881 -msoft-float -mpcrel @gol
692 -malign-int -mstrict-align -msep-data -mno-sep-data @gol
693 -mshared-library-id=n -mid-shared-library -mno-id-shared-library @gol
694 -mxgot -mno-xgot}
695
696 @emph{MCore Options}
697 @gccoptlist{-mhardlit -mno-hardlit -mdiv -mno-div -mrelax-immediates @gol
698 -mno-relax-immediates -mwide-bitfields -mno-wide-bitfields @gol
699 -m4byte-functions -mno-4byte-functions -mcallgraph-data @gol
700 -mno-callgraph-data -mslow-bytes -mno-slow-bytes -mno-lsim @gol
701 -mlittle-endian -mbig-endian -m210 -m340 -mstack-increment}
702
703 @emph{MeP Options}
704 @gccoptlist{-mabsdiff -mall-opts -maverage -mbased=@var{n} -mbitops @gol
705 -mc=@var{n} -mclip -mconfig=@var{name} -mcop -mcop32 -mcop64 -mivc2 @gol
706 -mdc -mdiv -meb -mel -mio-volatile -ml -mleadz -mm -mminmax @gol
707 -mmult -mno-opts -mrepeat -ms -msatur -msdram -msim -msimnovec -mtf @gol
708 -mtiny=@var{n}}
709
710 @emph{MicroBlaze Options}
711 @gccoptlist{-msoft-float -mhard-float -msmall-divides -mcpu=@var{cpu} @gol
712 -mmemcpy -mxl-soft-mul -mxl-soft-div -mxl-barrel-shift @gol
713 -mxl-pattern-compare -mxl-stack-check -mxl-gp-opt -mno-clearbss @gol
714 -mxl-multiply-high -mxl-float-convert -mxl-float-sqrt @gol
715 -mxl-mode-@var{app-model}}
716
717 @emph{MIPS Options}
718 @gccoptlist{-EL -EB -march=@var{arch} -mtune=@var{arch} @gol
719 -mips1 -mips2 -mips3 -mips4 -mips32 -mips32r2 @gol
720 -mips64 -mips64r2 @gol
721 -mips16 -mno-mips16 -mflip-mips16 @gol
722 -minterlink-mips16 -mno-interlink-mips16 @gol
723 -mabi=@var{abi} -mabicalls -mno-abicalls @gol
724 -mshared -mno-shared -mplt -mno-plt -mxgot -mno-xgot @gol
725 -mgp32 -mgp64 -mfp32 -mfp64 -mhard-float -msoft-float @gol
726 -msingle-float -mdouble-float -mdsp -mno-dsp -mdspr2 -mno-dspr2 @gol
727 -mfpu=@var{fpu-type} @gol
728 -msmartmips -mno-smartmips @gol
729 -mpaired-single -mno-paired-single -mdmx -mno-mdmx @gol
730 -mips3d -mno-mips3d -mmt -mno-mt -mllsc -mno-llsc @gol
731 -mlong64 -mlong32 -msym32 -mno-sym32 @gol
732 -G@var{num} -mlocal-sdata -mno-local-sdata @gol
733 -mextern-sdata -mno-extern-sdata -mgpopt -mno-gopt @gol
734 -membedded-data -mno-embedded-data @gol
735 -muninit-const-in-rodata -mno-uninit-const-in-rodata @gol
736 -mcode-readable=@var{setting} @gol
737 -msplit-addresses -mno-split-addresses @gol
738 -mexplicit-relocs -mno-explicit-relocs @gol
739 -mcheck-zero-division -mno-check-zero-division @gol
740 -mdivide-traps -mdivide-breaks @gol
741 -mmemcpy -mno-memcpy -mlong-calls -mno-long-calls @gol
742 -mmad -mno-mad -mfused-madd -mno-fused-madd -nocpp @gol
743 -mfix-24k -mno-fix-24k @gol
744 -mfix-r4000 -mno-fix-r4000 -mfix-r4400 -mno-fix-r4400 @gol
745 -mfix-r10000 -mno-fix-r10000 -mfix-vr4120 -mno-fix-vr4120 @gol
746 -mfix-vr4130 -mno-fix-vr4130 -mfix-sb1 -mno-fix-sb1 @gol
747 -mflush-func=@var{func} -mno-flush-func @gol
748 -mbranch-cost=@var{num} -mbranch-likely -mno-branch-likely @gol
749 -mfp-exceptions -mno-fp-exceptions @gol
750 -mvr4130-align -mno-vr4130-align -msynci -mno-synci @gol
751 -mrelax-pic-calls -mno-relax-pic-calls -mmcount-ra-address}
752
753 @emph{MMIX Options}
754 @gccoptlist{-mlibfuncs -mno-libfuncs -mepsilon -mno-epsilon -mabi=gnu @gol
755 -mabi=mmixware -mzero-extend -mknuthdiv -mtoplevel-symbols @gol
756 -melf -mbranch-predict -mno-branch-predict -mbase-addresses @gol
757 -mno-base-addresses -msingle-exit -mno-single-exit}
758
759 @emph{MN10300 Options}
760 @gccoptlist{-mmult-bug -mno-mult-bug @gol
761 -mno-am33 -mam33 -mam33-2 -mam34 @gol
762 -mtune=@var{cpu-type} @gol
763 -mreturn-pointer-on-d0 @gol
764 -mno-crt0 -mrelax -mliw -msetlb}
765
766 @emph{PDP-11 Options}
767 @gccoptlist{-mfpu -msoft-float -mac0 -mno-ac0 -m40 -m45 -m10 @gol
768 -mbcopy -mbcopy-builtin -mint32 -mno-int16 @gol
769 -mint16 -mno-int32 -mfloat32 -mno-float64 @gol
770 -mfloat64 -mno-float32 -mabshi -mno-abshi @gol
771 -mbranch-expensive -mbranch-cheap @gol
772 -munix-asm -mdec-asm}
773
774 @emph{picoChip Options}
775 @gccoptlist{-mae=@var{ae_type} -mvliw-lookahead=@var{N} @gol
776 -msymbol-as-address -mno-inefficient-warnings}
777
778 @emph{PowerPC Options}
779 See RS/6000 and PowerPC Options.
780
781 @emph{RL78 Options}
782 @gccoptlist{-msim -mmul=none -mmul=g13 -mmul=rl78}
783
784 @emph{RS/6000 and PowerPC Options}
785 @gccoptlist{-mcpu=@var{cpu-type} @gol
786 -mtune=@var{cpu-type} @gol
787 -mcmodel=@var{code-model} @gol
788 -mpower -mno-power -mpower2 -mno-power2 @gol
789 -mpowerpc -mpowerpc64 -mno-powerpc @gol
790 -maltivec -mno-altivec @gol
791 -mpowerpc-gpopt -mno-powerpc-gpopt @gol
792 -mpowerpc-gfxopt -mno-powerpc-gfxopt @gol
793 -mmfcrf -mno-mfcrf -mpopcntb -mno-popcntb -mpopcntd -mno-popcntd @gol
794 -mfprnd -mno-fprnd @gol
795 -mcmpb -mno-cmpb -mmfpgpr -mno-mfpgpr -mhard-dfp -mno-hard-dfp @gol
796 -mnew-mnemonics -mold-mnemonics @gol
797 -mfull-toc -mminimal-toc -mno-fp-in-toc -mno-sum-in-toc @gol
798 -m64 -m32 -mxl-compat -mno-xl-compat -mpe @gol
799 -malign-power -malign-natural @gol
800 -msoft-float -mhard-float -mmultiple -mno-multiple @gol
801 -msingle-float -mdouble-float -msimple-fpu @gol
802 -mstring -mno-string -mupdate -mno-update @gol
803 -mavoid-indexed-addresses -mno-avoid-indexed-addresses @gol
804 -mfused-madd -mno-fused-madd -mbit-align -mno-bit-align @gol
805 -mstrict-align -mno-strict-align -mrelocatable @gol
806 -mno-relocatable -mrelocatable-lib -mno-relocatable-lib @gol
807 -mtoc -mno-toc -mlittle -mlittle-endian -mbig -mbig-endian @gol
808 -mdynamic-no-pic -maltivec -mswdiv -msingle-pic-base @gol
809 -mprioritize-restricted-insns=@var{priority} @gol
810 -msched-costly-dep=@var{dependence_type} @gol
811 -minsert-sched-nops=@var{scheme} @gol
812 -mcall-sysv -mcall-netbsd @gol
813 -maix-struct-return -msvr4-struct-return @gol
814 -mabi=@var{abi-type} -msecure-plt -mbss-plt @gol
815 -mblock-move-inline-limit=@var{num} @gol
816 -misel -mno-isel @gol
817 -misel=yes -misel=no @gol
818 -mspe -mno-spe @gol
819 -mspe=yes -mspe=no @gol
820 -mpaired @gol
821 -mgen-cell-microcode -mwarn-cell-microcode @gol
822 -mvrsave -mno-vrsave @gol
823 -mmulhw -mno-mulhw @gol
824 -mdlmzb -mno-dlmzb @gol
825 -mfloat-gprs=yes -mfloat-gprs=no -mfloat-gprs=single -mfloat-gprs=double @gol
826 -mprototype -mno-prototype @gol
827 -msim -mmvme -mads -myellowknife -memb -msdata @gol
828 -msdata=@var{opt} -mvxworks -G @var{num} -pthread @gol
829 -mrecip -mrecip=@var{opt} -mno-recip -mrecip-precision @gol
830 -mno-recip-precision @gol
831 -mveclibabi=@var{type} -mfriz -mno-friz @gol
832 -mpointers-to-nested-functions -mno-pointers-to-nested-functions @gol
833 -msave-toc-indirect -mno-save-toc-indirect}
834
835 @emph{RX Options}
836 @gccoptlist{-m64bit-doubles -m32bit-doubles -fpu -nofpu@gol
837 -mcpu=@gol
838 -mbig-endian-data -mlittle-endian-data @gol
839 -msmall-data @gol
840 -msim -mno-sim@gol
841 -mas100-syntax -mno-as100-syntax@gol
842 -mrelax@gol
843 -mmax-constant-size=@gol
844 -mint-register=@gol
845 -mpid@gol
846 -msave-acc-in-interrupts}
847
848 @emph{S/390 and zSeries Options}
849 @gccoptlist{-mtune=@var{cpu-type} -march=@var{cpu-type} @gol
850 -mhard-float -msoft-float -mhard-dfp -mno-hard-dfp @gol
851 -mlong-double-64 -mlong-double-128 @gol
852 -mbackchain -mno-backchain -mpacked-stack -mno-packed-stack @gol
853 -msmall-exec -mno-small-exec -mmvcle -mno-mvcle @gol
854 -m64 -m31 -mdebug -mno-debug -mesa -mzarch @gol
855 -mtpf-trace -mno-tpf-trace -mfused-madd -mno-fused-madd @gol
856 -mwarn-framesize -mwarn-dynamicstack -mstack-size -mstack-guard}
857
858 @emph{Score Options}
859 @gccoptlist{-meb -mel @gol
860 -mnhwloop @gol
861 -muls @gol
862 -mmac @gol
863 -mscore5 -mscore5u -mscore7 -mscore7d}
864
865 @emph{SH Options}
866 @gccoptlist{-m1 -m2 -m2e @gol
867 -m2a-nofpu -m2a-single-only -m2a-single -m2a @gol
868 -m3 -m3e @gol
869 -m4-nofpu -m4-single-only -m4-single -m4 @gol
870 -m4a-nofpu -m4a-single-only -m4a-single -m4a -m4al @gol
871 -m5-64media -m5-64media-nofpu @gol
872 -m5-32media -m5-32media-nofpu @gol
873 -m5-compact -m5-compact-nofpu @gol
874 -mb -ml -mdalign -mrelax @gol
875 -mbigtable -mfmovd -mhitachi -mrenesas -mno-renesas -mnomacsave @gol
876 -mieee -mbitops -misize -minline-ic_invalidate -mpadstruct -mspace @gol
877 -mprefergot -musermode -multcost=@var{number} -mdiv=@var{strategy} @gol
878 -mdivsi3_libfunc=@var{name} -mfixed-range=@var{register-range} @gol
879 -madjust-unroll -mindexed-addressing -mgettrcost=@var{number} -mpt-fixed @gol
880 -maccumulate-outgoing-args -minvalid-symbols -msoft-atomic}
881
882 @emph{Solaris 2 Options}
883 @gccoptlist{-mimpure-text -mno-impure-text @gol
884 -pthreads -pthread}
885
886 @emph{SPARC Options}
887 @gccoptlist{-mcpu=@var{cpu-type} @gol
888 -mtune=@var{cpu-type} @gol
889 -mcmodel=@var{code-model} @gol
890 -mmemory-model=@var{mem-model} @gol
891 -m32 -m64 -mapp-regs -mno-app-regs @gol
892 -mfaster-structs -mno-faster-structs -mflat -mno-flat @gol
893 -mfpu -mno-fpu -mhard-float -msoft-float @gol
894 -mhard-quad-float -msoft-quad-float @gol
895 -mlittle-endian @gol
896 -mstack-bias -mno-stack-bias @gol
897 -munaligned-doubles -mno-unaligned-doubles @gol
898 -mv8plus -mno-v8plus -mvis -mno-vis @gol
899 -mvis2 -mno-vis2 -mvis3 -mno-vis3 @gol
900 -mfmaf -mno-fmaf -mpopc -mno-popc @gol
901 -mfix-at697f}
902
903 @emph{SPU Options}
904 @gccoptlist{-mwarn-reloc -merror-reloc @gol
905 -msafe-dma -munsafe-dma @gol
906 -mbranch-hints @gol
907 -msmall-mem -mlarge-mem -mstdmain @gol
908 -mfixed-range=@var{register-range} @gol
909 -mea32 -mea64 @gol
910 -maddress-space-conversion -mno-address-space-conversion @gol
911 -mcache-size=@var{cache-size} @gol
912 -matomic-updates -mno-atomic-updates}
913
914 @emph{System V Options}
915 @gccoptlist{-Qy -Qn -YP,@var{paths} -Ym,@var{dir}}
916
917 @emph{V850 Options}
918 @gccoptlist{-mlong-calls -mno-long-calls -mep -mno-ep @gol
919 -mprolog-function -mno-prolog-function -mspace @gol
920 -mtda=@var{n} -msda=@var{n} -mzda=@var{n} @gol
921 -mapp-regs -mno-app-regs @gol
922 -mdisable-callt -mno-disable-callt @gol
923 -mv850e2v3 @gol
924 -mv850e2 @gol
925 -mv850e1 -mv850es @gol
926 -mv850e @gol
927 -mv850 -mbig-switch}
928
929 @emph{VAX Options}
930 @gccoptlist{-mg -mgnu -munix}
931
932 @emph{VxWorks Options}
933 @gccoptlist{-mrtp -non-static -Bstatic -Bdynamic @gol
934 -Xbind-lazy -Xbind-now}
935
936 @emph{x86-64 Options}
937 See i386 and x86-64 Options.
938
939 @emph{Xstormy16 Options}
940 @gccoptlist{-msim}
941
942 @emph{Xtensa Options}
943 @gccoptlist{-mconst16 -mno-const16 @gol
944 -mfused-madd -mno-fused-madd @gol
945 -mforce-no-pic @gol
946 -mserialize-volatile -mno-serialize-volatile @gol
947 -mtext-section-literals -mno-text-section-literals @gol
948 -mtarget-align -mno-target-align @gol
949 -mlongcalls -mno-longcalls}
950
951 @emph{zSeries Options}
952 See S/390 and zSeries Options.
953
954 @item Code Generation Options
955 @xref{Code Gen Options,,Options for Code Generation Conventions}.
956 @gccoptlist{-fcall-saved-@var{reg} -fcall-used-@var{reg} @gol
957 -ffixed-@var{reg} -fexceptions @gol
958 -fnon-call-exceptions -funwind-tables @gol
959 -fasynchronous-unwind-tables @gol
960 -finhibit-size-directive -finstrument-functions @gol
961 -finstrument-functions-exclude-function-list=@var{sym},@var{sym},@dots{} @gol
962 -finstrument-functions-exclude-file-list=@var{file},@var{file},@dots{} @gol
963 -fno-common -fno-ident @gol
964 -fpcc-struct-return -fpic -fPIC -fpie -fPIE @gol
965 -fno-jump-tables @gol
966 -frecord-gcc-switches @gol
967 -freg-struct-return -fshort-enums @gol
968 -fshort-double -fshort-wchar @gol
969 -fverbose-asm -fpack-struct[=@var{n}] -fstack-check @gol
970 -fstack-limit-register=@var{reg} -fstack-limit-symbol=@var{sym} @gol
971 -fno-stack-limit -fsplit-stack @gol
972 -fleading-underscore -ftls-model=@var{model} @gol
973 -ftrapv -fwrapv -fbounds-check @gol
974 -fvisibility -fstrict-volatile-bitfields}
975 @end table
976
977 @menu
978 * Overall Options:: Controlling the kind of output:
979 an executable, object files, assembler files,
980 or preprocessed source.
981 * C Dialect Options:: Controlling the variant of C language compiled.
982 * C++ Dialect Options:: Variations on C++.
983 * Objective-C and Objective-C++ Dialect Options:: Variations on Objective-C
984 and Objective-C++.
985 * Language Independent Options:: Controlling how diagnostics should be
986 formatted.
987 * Warning Options:: How picky should the compiler be?
988 * Debugging Options:: Symbol tables, measurements, and debugging dumps.
989 * Optimize Options:: How much optimization?
990 * Preprocessor Options:: Controlling header files and macro definitions.
991 Also, getting dependency information for Make.
992 * Assembler Options:: Passing options to the assembler.
993 * Link Options:: Specifying libraries and so on.
994 * Directory Options:: Where to find header files and libraries.
995 Where to find the compiler executable files.
996 * Spec Files:: How to pass switches to sub-processes.
997 * Target Options:: Running a cross-compiler, or an old version of GCC.
998 @end menu
999
1000 @node Overall Options
1001 @section Options Controlling the Kind of Output
1002
1003 Compilation can involve up to four stages: preprocessing, compilation
1004 proper, assembly and linking, always in that order. GCC is capable of
1005 preprocessing and compiling several files either into several
1006 assembler input files, or into one assembler input file; then each
1007 assembler input file produces an object file, and linking combines all
1008 the object files (those newly compiled, and those specified as input)
1009 into an executable file.
1010
1011 @cindex file name suffix
1012 For any given input file, the file name suffix determines what kind of
1013 compilation is done:
1014
1015 @table @gcctabopt
1016 @item @var{file}.c
1017 C source code which must be preprocessed.
1018
1019 @item @var{file}.i
1020 C source code which should not be preprocessed.
1021
1022 @item @var{file}.ii
1023 C++ source code which should not be preprocessed.
1024
1025 @item @var{file}.m
1026 Objective-C source code. Note that you must link with the @file{libobjc}
1027 library to make an Objective-C program work.
1028
1029 @item @var{file}.mi
1030 Objective-C source code which should not be preprocessed.
1031
1032 @item @var{file}.mm
1033 @itemx @var{file}.M
1034 Objective-C++ source code. Note that you must link with the @file{libobjc}
1035 library to make an Objective-C++ program work. Note that @samp{.M} refers
1036 to a literal capital M@.
1037
1038 @item @var{file}.mii
1039 Objective-C++ source code which should not be preprocessed.
1040
1041 @item @var{file}.h
1042 C, C++, Objective-C or Objective-C++ header file to be turned into a
1043 precompiled header (default), or C, C++ header file to be turned into an
1044 Ada spec (via the @option{-fdump-ada-spec} switch).
1045
1046 @item @var{file}.cc
1047 @itemx @var{file}.cp
1048 @itemx @var{file}.cxx
1049 @itemx @var{file}.cpp
1050 @itemx @var{file}.CPP
1051 @itemx @var{file}.c++
1052 @itemx @var{file}.C
1053 C++ source code which must be preprocessed. Note that in @samp{.cxx},
1054 the last two letters must both be literally @samp{x}. Likewise,
1055 @samp{.C} refers to a literal capital C@.
1056
1057 @item @var{file}.mm
1058 @itemx @var{file}.M
1059 Objective-C++ source code which must be preprocessed.
1060
1061 @item @var{file}.mii
1062 Objective-C++ source code which should not be preprocessed.
1063
1064 @item @var{file}.hh
1065 @itemx @var{file}.H
1066 @itemx @var{file}.hp
1067 @itemx @var{file}.hxx
1068 @itemx @var{file}.hpp
1069 @itemx @var{file}.HPP
1070 @itemx @var{file}.h++
1071 @itemx @var{file}.tcc
1072 C++ header file to be turned into a precompiled header or Ada spec.
1073
1074 @item @var{file}.f
1075 @itemx @var{file}.for
1076 @itemx @var{file}.ftn
1077 Fixed form Fortran source code which should not be preprocessed.
1078
1079 @item @var{file}.F
1080 @itemx @var{file}.FOR
1081 @itemx @var{file}.fpp
1082 @itemx @var{file}.FPP
1083 @itemx @var{file}.FTN
1084 Fixed form Fortran source code which must be preprocessed (with the traditional
1085 preprocessor).
1086
1087 @item @var{file}.f90
1088 @itemx @var{file}.f95
1089 @itemx @var{file}.f03
1090 @itemx @var{file}.f08
1091 Free form Fortran source code which should not be preprocessed.
1092
1093 @item @var{file}.F90
1094 @itemx @var{file}.F95
1095 @itemx @var{file}.F03
1096 @itemx @var{file}.F08
1097 Free form Fortran source code which must be preprocessed (with the
1098 traditional preprocessor).
1099
1100 @item @var{file}.go
1101 Go source code.
1102
1103 @c FIXME: Descriptions of Java file types.
1104 @c @var{file}.java
1105 @c @var{file}.class
1106 @c @var{file}.zip
1107 @c @var{file}.jar
1108
1109 @item @var{file}.ads
1110 Ada source code file which contains a library unit declaration (a
1111 declaration of a package, subprogram, or generic, or a generic
1112 instantiation), or a library unit renaming declaration (a package,
1113 generic, or subprogram renaming declaration). Such files are also
1114 called @dfn{specs}.
1115
1116 @item @var{file}.adb
1117 Ada source code file containing a library unit body (a subprogram or
1118 package body). Such files are also called @dfn{bodies}.
1119
1120 @c GCC also knows about some suffixes for languages not yet included:
1121 @c Pascal:
1122 @c @var{file}.p
1123 @c @var{file}.pas
1124 @c Ratfor:
1125 @c @var{file}.r
1126
1127 @item @var{file}.s
1128 Assembler code.
1129
1130 @item @var{file}.S
1131 @itemx @var{file}.sx
1132 Assembler code which must be preprocessed.
1133
1134 @item @var{other}
1135 An object file to be fed straight into linking.
1136 Any file name with no recognized suffix is treated this way.
1137 @end table
1138
1139 @opindex x
1140 You can specify the input language explicitly with the @option{-x} option:
1141
1142 @table @gcctabopt
1143 @item -x @var{language}
1144 Specify explicitly the @var{language} for the following input files
1145 (rather than letting the compiler choose a default based on the file
1146 name suffix). This option applies to all following input files until
1147 the next @option{-x} option. Possible values for @var{language} are:
1148 @smallexample
1149 c c-header cpp-output
1150 c++ c++-header c++-cpp-output
1151 objective-c objective-c-header objective-c-cpp-output
1152 objective-c++ objective-c++-header objective-c++-cpp-output
1153 assembler assembler-with-cpp
1154 ada
1155 f77 f77-cpp-input f95 f95-cpp-input
1156 go
1157 java
1158 @end smallexample
1159
1160 @item -x none
1161 Turn off any specification of a language, so that subsequent files are
1162 handled according to their file name suffixes (as they are if @option{-x}
1163 has not been used at all).
1164
1165 @item -pass-exit-codes
1166 @opindex pass-exit-codes
1167 Normally the @command{gcc} program will exit with the code of 1 if any
1168 phase of the compiler returns a non-success return code. If you specify
1169 @option{-pass-exit-codes}, the @command{gcc} program will instead return with
1170 numerically highest error produced by any phase that returned an error
1171 indication. The C, C++, and Fortran frontends return 4, if an internal
1172 compiler error is encountered.
1173 @end table
1174
1175 If you only want some of the stages of compilation, you can use
1176 @option{-x} (or filename suffixes) to tell @command{gcc} where to start, and
1177 one of the options @option{-c}, @option{-S}, or @option{-E} to say where
1178 @command{gcc} is to stop. Note that some combinations (for example,
1179 @samp{-x cpp-output -E}) instruct @command{gcc} to do nothing at all.
1180
1181 @table @gcctabopt
1182 @item -c
1183 @opindex c
1184 Compile or assemble the source files, but do not link. The linking
1185 stage simply is not done. The ultimate output is in the form of an
1186 object file for each source file.
1187
1188 By default, the object file name for a source file is made by replacing
1189 the suffix @samp{.c}, @samp{.i}, @samp{.s}, etc., with @samp{.o}.
1190
1191 Unrecognized input files, not requiring compilation or assembly, are
1192 ignored.
1193
1194 @item -S
1195 @opindex S
1196 Stop after the stage of compilation proper; do not assemble. The output
1197 is in the form of an assembler code file for each non-assembler input
1198 file specified.
1199
1200 By default, the assembler file name for a source file is made by
1201 replacing the suffix @samp{.c}, @samp{.i}, etc., with @samp{.s}.
1202
1203 Input files that don't require compilation are ignored.
1204
1205 @item -E
1206 @opindex E
1207 Stop after the preprocessing stage; do not run the compiler proper. The
1208 output is in the form of preprocessed source code, which is sent to the
1209 standard output.
1210
1211 Input files which don't require preprocessing are ignored.
1212
1213 @cindex output file option
1214 @item -o @var{file}
1215 @opindex o
1216 Place output in file @var{file}. This applies regardless to whatever
1217 sort of output is being produced, whether it be an executable file,
1218 an object file, an assembler file or preprocessed C code.
1219
1220 If @option{-o} is not specified, the default is to put an executable
1221 file in @file{a.out}, the object file for
1222 @file{@var{source}.@var{suffix}} in @file{@var{source}.o}, its
1223 assembler file in @file{@var{source}.s}, a precompiled header file in
1224 @file{@var{source}.@var{suffix}.gch}, and all preprocessed C source on
1225 standard output.
1226
1227 @item -v
1228 @opindex v
1229 Print (on standard error output) the commands executed to run the stages
1230 of compilation. Also print the version number of the compiler driver
1231 program and of the preprocessor and the compiler proper.
1232
1233 @item -###
1234 @opindex ###
1235 Like @option{-v} except the commands are not executed and arguments
1236 are quoted unless they contain only alphanumeric characters or @code{./-_}.
1237 This is useful for shell scripts to capture the driver-generated command lines.
1238
1239 @item -pipe
1240 @opindex pipe
1241 Use pipes rather than temporary files for communication between the
1242 various stages of compilation. This fails to work on some systems where
1243 the assembler is unable to read from a pipe; but the GNU assembler has
1244 no trouble.
1245
1246 @item --help
1247 @opindex help
1248 Print (on the standard output) a description of the command line options
1249 understood by @command{gcc}. If the @option{-v} option is also specified
1250 then @option{--help} will also be passed on to the various processes
1251 invoked by @command{gcc}, so that they can display the command line options
1252 they accept. If the @option{-Wextra} option has also been specified
1253 (prior to the @option{--help} option), then command line options which
1254 have no documentation associated with them will also be displayed.
1255
1256 @item --target-help
1257 @opindex target-help
1258 Print (on the standard output) a description of target-specific command
1259 line options for each tool. For some targets extra target-specific
1260 information may also be printed.
1261
1262 @item --help=@{@var{class}@r{|[}^@r{]}@var{qualifier}@}@r{[},@dots{}@r{]}
1263 Print (on the standard output) a description of the command line
1264 options understood by the compiler that fit into all specified classes
1265 and qualifiers. These are the supported classes:
1266
1267 @table @asis
1268 @item @samp{optimizers}
1269 This will display all of the optimization options supported by the
1270 compiler.
1271
1272 @item @samp{warnings}
1273 This will display all of the options controlling warning messages
1274 produced by the compiler.
1275
1276 @item @samp{target}
1277 This will display target-specific options. Unlike the
1278 @option{--target-help} option however, target-specific options of the
1279 linker and assembler will not be displayed. This is because those
1280 tools do not currently support the extended @option{--help=} syntax.
1281
1282 @item @samp{params}
1283 This will display the values recognized by the @option{--param}
1284 option.
1285
1286 @item @var{language}
1287 This will display the options supported for @var{language}, where
1288 @var{language} is the name of one of the languages supported in this
1289 version of GCC.
1290
1291 @item @samp{common}
1292 This will display the options that are common to all languages.
1293 @end table
1294
1295 These are the supported qualifiers:
1296
1297 @table @asis
1298 @item @samp{undocumented}
1299 Display only those options which are undocumented.
1300
1301 @item @samp{joined}
1302 Display options which take an argument that appears after an equal
1303 sign in the same continuous piece of text, such as:
1304 @samp{--help=target}.
1305
1306 @item @samp{separate}
1307 Display options which take an argument that appears as a separate word
1308 following the original option, such as: @samp{-o output-file}.
1309 @end table
1310
1311 Thus for example to display all the undocumented target-specific
1312 switches supported by the compiler the following can be used:
1313
1314 @smallexample
1315 --help=target,undocumented
1316 @end smallexample
1317
1318 The sense of a qualifier can be inverted by prefixing it with the
1319 @samp{^} character, so for example to display all binary warning
1320 options (i.e., ones that are either on or off and that do not take an
1321 argument), which have a description the following can be used:
1322
1323 @smallexample
1324 --help=warnings,^joined,^undocumented
1325 @end smallexample
1326
1327 The argument to @option{--help=} should not consist solely of inverted
1328 qualifiers.
1329
1330 Combining several classes is possible, although this usually
1331 restricts the output by so much that there is nothing to display. One
1332 case where it does work however is when one of the classes is
1333 @var{target}. So for example to display all the target-specific
1334 optimization options the following can be used:
1335
1336 @smallexample
1337 --help=target,optimizers
1338 @end smallexample
1339
1340 The @option{--help=} option can be repeated on the command line. Each
1341 successive use will display its requested class of options, skipping
1342 those that have already been displayed.
1343
1344 If the @option{-Q} option appears on the command line before the
1345 @option{--help=} option, then the descriptive text displayed by
1346 @option{--help=} is changed. Instead of describing the displayed
1347 options, an indication is given as to whether the option is enabled,
1348 disabled or set to a specific value (assuming that the compiler
1349 knows this at the point where the @option{--help=} option is used).
1350
1351 Here is a truncated example from the ARM port of @command{gcc}:
1352
1353 @smallexample
1354 % gcc -Q -mabi=2 --help=target -c
1355 The following options are target specific:
1356 -mabi= 2
1357 -mabort-on-noreturn [disabled]
1358 -mapcs [disabled]
1359 @end smallexample
1360
1361 The output is sensitive to the effects of previous command line
1362 options, so for example it is possible to find out which optimizations
1363 are enabled at @option{-O2} by using:
1364
1365 @smallexample
1366 -Q -O2 --help=optimizers
1367 @end smallexample
1368
1369 Alternatively you can discover which binary optimizations are enabled
1370 by @option{-O3} by using:
1371
1372 @smallexample
1373 gcc -c -Q -O3 --help=optimizers > /tmp/O3-opts
1374 gcc -c -Q -O2 --help=optimizers > /tmp/O2-opts
1375 diff /tmp/O2-opts /tmp/O3-opts | grep enabled
1376 @end smallexample
1377
1378 @item -no-canonical-prefixes
1379 @opindex no-canonical-prefixes
1380 Do not expand any symbolic links, resolve references to @samp{/../}
1381 or @samp{/./}, or make the path absolute when generating a relative
1382 prefix.
1383
1384 @item --version
1385 @opindex version
1386 Display the version number and copyrights of the invoked GCC@.
1387
1388 @item -wrapper
1389 @opindex wrapper
1390 Invoke all subcommands under a wrapper program. The name of the
1391 wrapper program and its parameters are passed as a comma separated
1392 list.
1393
1394 @smallexample
1395 gcc -c t.c -wrapper gdb,--args
1396 @end smallexample
1397
1398 This will invoke all subprograms of @command{gcc} under
1399 @samp{gdb --args}, thus the invocation of @command{cc1} will be
1400 @samp{gdb --args cc1 @dots{}}.
1401
1402 @item -fplugin=@var{name}.so
1403 Load the plugin code in file @var{name}.so, assumed to be a
1404 shared object to be dlopen'd by the compiler. The base name of
1405 the shared object file is used to identify the plugin for the
1406 purposes of argument parsing (See
1407 @option{-fplugin-arg-@var{name}-@var{key}=@var{value}} below).
1408 Each plugin should define the callback functions specified in the
1409 Plugins API.
1410
1411 @item -fplugin-arg-@var{name}-@var{key}=@var{value}
1412 Define an argument called @var{key} with a value of @var{value}
1413 for the plugin called @var{name}.
1414
1415 @item -fdump-ada-spec@r{[}-slim@r{]}
1416 For C and C++ source and include files, generate corresponding Ada
1417 specs. @xref{Generating Ada Bindings for C and C++ headers,,, gnat_ugn,
1418 GNAT User's Guide}, which provides detailed documentation on this feature.
1419
1420 @item -fdump-go-spec=@var{file}
1421 For input files in any language, generate corresponding Go
1422 declarations in @var{file}. This generates Go @code{const},
1423 @code{type}, @code{var}, and @code{func} declarations which may be a
1424 useful way to start writing a Go interface to code written in some
1425 other language.
1426
1427 @include @value{srcdir}/../libiberty/at-file.texi
1428 @end table
1429
1430 @node Invoking G++
1431 @section Compiling C++ Programs
1432
1433 @cindex suffixes for C++ source
1434 @cindex C++ source file suffixes
1435 C++ source files conventionally use one of the suffixes @samp{.C},
1436 @samp{.cc}, @samp{.cpp}, @samp{.CPP}, @samp{.c++}, @samp{.cp}, or
1437 @samp{.cxx}; C++ header files often use @samp{.hh}, @samp{.hpp},
1438 @samp{.H}, or (for shared template code) @samp{.tcc}; and
1439 preprocessed C++ files use the suffix @samp{.ii}. GCC recognizes
1440 files with these names and compiles them as C++ programs even if you
1441 call the compiler the same way as for compiling C programs (usually
1442 with the name @command{gcc}).
1443
1444 @findex g++
1445 @findex c++
1446 However, the use of @command{gcc} does not add the C++ library.
1447 @command{g++} is a program that calls GCC and treats @samp{.c},
1448 @samp{.h} and @samp{.i} files as C++ source files instead of C source
1449 files unless @option{-x} is used, and automatically specifies linking
1450 against the C++ library. This program is also useful when
1451 precompiling a C header file with a @samp{.h} extension for use in C++
1452 compilations. On many systems, @command{g++} is also installed with
1453 the name @command{c++}.
1454
1455 @cindex invoking @command{g++}
1456 When you compile C++ programs, you may specify many of the same
1457 command-line options that you use for compiling programs in any
1458 language; or command-line options meaningful for C and related
1459 languages; or options that are meaningful only for C++ programs.
1460 @xref{C Dialect Options,,Options Controlling C Dialect}, for
1461 explanations of options for languages related to C@.
1462 @xref{C++ Dialect Options,,Options Controlling C++ Dialect}, for
1463 explanations of options that are meaningful only for C++ programs.
1464
1465 @node C Dialect Options
1466 @section Options Controlling C Dialect
1467 @cindex dialect options
1468 @cindex language dialect options
1469 @cindex options, dialect
1470
1471 The following options control the dialect of C (or languages derived
1472 from C, such as C++, Objective-C and Objective-C++) that the compiler
1473 accepts:
1474
1475 @table @gcctabopt
1476 @cindex ANSI support
1477 @cindex ISO support
1478 @item -ansi
1479 @opindex ansi
1480 In C mode, this is equivalent to @samp{-std=c90}. In C++ mode, it is
1481 equivalent to @samp{-std=c++98}.
1482
1483 This turns off certain features of GCC that are incompatible with ISO
1484 C90 (when compiling C code), or of standard C++ (when compiling C++ code),
1485 such as the @code{asm} and @code{typeof} keywords, and
1486 predefined macros such as @code{unix} and @code{vax} that identify the
1487 type of system you are using. It also enables the undesirable and
1488 rarely used ISO trigraph feature. For the C compiler,
1489 it disables recognition of C++ style @samp{//} comments as well as
1490 the @code{inline} keyword.
1491
1492 The alternate keywords @code{__asm__}, @code{__extension__},
1493 @code{__inline__} and @code{__typeof__} continue to work despite
1494 @option{-ansi}. You would not want to use them in an ISO C program, of
1495 course, but it is useful to put them in header files that might be included
1496 in compilations done with @option{-ansi}. Alternate predefined macros
1497 such as @code{__unix__} and @code{__vax__} are also available, with or
1498 without @option{-ansi}.
1499
1500 The @option{-ansi} option does not cause non-ISO programs to be
1501 rejected gratuitously. For that, @option{-pedantic} is required in
1502 addition to @option{-ansi}. @xref{Warning Options}.
1503
1504 The macro @code{__STRICT_ANSI__} is predefined when the @option{-ansi}
1505 option is used. Some header files may notice this macro and refrain
1506 from declaring certain functions or defining certain macros that the
1507 ISO standard doesn't call for; this is to avoid interfering with any
1508 programs that might use these names for other things.
1509
1510 Functions that would normally be built in but do not have semantics
1511 defined by ISO C (such as @code{alloca} and @code{ffs}) are not built-in
1512 functions when @option{-ansi} is used. @xref{Other Builtins,,Other
1513 built-in functions provided by GCC}, for details of the functions
1514 affected.
1515
1516 @item -std=
1517 @opindex std
1518 Determine the language standard. @xref{Standards,,Language Standards
1519 Supported by GCC}, for details of these standard versions. This option
1520 is currently only supported when compiling C or C++.
1521
1522 The compiler can accept several base standards, such as @samp{c90} or
1523 @samp{c++98}, and GNU dialects of those standards, such as
1524 @samp{gnu90} or @samp{gnu++98}. By specifying a base standard, the
1525 compiler will accept all programs following that standard and those
1526 using GNU extensions that do not contradict it. For example,
1527 @samp{-std=c90} turns off certain features of GCC that are
1528 incompatible with ISO C90, such as the @code{asm} and @code{typeof}
1529 keywords, but not other GNU extensions that do not have a meaning in
1530 ISO C90, such as omitting the middle term of a @code{?:}
1531 expression. On the other hand, by specifying a GNU dialect of a
1532 standard, all features the compiler support are enabled, even when
1533 those features change the meaning of the base standard and some
1534 strict-conforming programs may be rejected. The particular standard
1535 is used by @option{-pedantic} to identify which features are GNU
1536 extensions given that version of the standard. For example
1537 @samp{-std=gnu90 -pedantic} would warn about C++ style @samp{//}
1538 comments, while @samp{-std=gnu99 -pedantic} would not.
1539
1540 A value for this option must be provided; possible values are
1541
1542 @table @samp
1543 @item c90
1544 @itemx c89
1545 @itemx iso9899:1990
1546 Support all ISO C90 programs (certain GNU extensions that conflict
1547 with ISO C90 are disabled). Same as @option{-ansi} for C code.
1548
1549 @item iso9899:199409
1550 ISO C90 as modified in amendment 1.
1551
1552 @item c99
1553 @itemx c9x
1554 @itemx iso9899:1999
1555 @itemx iso9899:199x
1556 ISO C99. Note that this standard is not yet fully supported; see
1557 @w{@uref{http://gcc.gnu.org/c99status.html}} for more information. The
1558 names @samp{c9x} and @samp{iso9899:199x} are deprecated.
1559
1560 @item c11
1561 @itemx c1x
1562 @itemx iso9899:2011
1563 ISO C11, the 2011 revision of the ISO C standard.
1564 Support is incomplete and experimental. The name @samp{c1x} is
1565 deprecated.
1566
1567 @item gnu90
1568 @itemx gnu89
1569 GNU dialect of ISO C90 (including some C99 features). This
1570 is the default for C code.
1571
1572 @item gnu99
1573 @itemx gnu9x
1574 GNU dialect of ISO C99. When ISO C99 is fully implemented in GCC,
1575 this will become the default. The name @samp{gnu9x} is deprecated.
1576
1577 @item gnu11
1578 @item gnu1x
1579 GNU dialect of ISO C11. Support is incomplete and experimental. The
1580 name @samp{gnu1x} is deprecated.
1581
1582 @item c++98
1583 The 1998 ISO C++ standard plus amendments. Same as @option{-ansi} for
1584 C++ code.
1585
1586 @item gnu++98
1587 GNU dialect of @option{-std=c++98}. This is the default for
1588 C++ code.
1589
1590 @item c++11
1591 The 2011 ISO C++ standard plus amendments. Support for C++11 is still
1592 experimental, and may change in incompatible ways in future releases.
1593
1594 @item gnu++11
1595 GNU dialect of @option{-std=c++11}. Support for C++11 is still
1596 experimental, and may change in incompatible ways in future releases.
1597 @end table
1598
1599 @item -fgnu89-inline
1600 @opindex fgnu89-inline
1601 The option @option{-fgnu89-inline} tells GCC to use the traditional
1602 GNU semantics for @code{inline} functions when in C99 mode.
1603 @xref{Inline,,An Inline Function is As Fast As a Macro}. This option
1604 is accepted and ignored by GCC versions 4.1.3 up to but not including
1605 4.3. In GCC versions 4.3 and later it changes the behavior of GCC in
1606 C99 mode. Using this option is roughly equivalent to adding the
1607 @code{gnu_inline} function attribute to all inline functions
1608 (@pxref{Function Attributes}).
1609
1610 The option @option{-fno-gnu89-inline} explicitly tells GCC to use the
1611 C99 semantics for @code{inline} when in C99 or gnu99 mode (i.e., it
1612 specifies the default behavior). This option was first supported in
1613 GCC 4.3. This option is not supported in @option{-std=c90} or
1614 @option{-std=gnu90} mode.
1615
1616 The preprocessor macros @code{__GNUC_GNU_INLINE__} and
1617 @code{__GNUC_STDC_INLINE__} may be used to check which semantics are
1618 in effect for @code{inline} functions. @xref{Common Predefined
1619 Macros,,,cpp,The C Preprocessor}.
1620
1621 @item -aux-info @var{filename}
1622 @opindex aux-info
1623 Output to the given filename prototyped declarations for all functions
1624 declared and/or defined in a translation unit, including those in header
1625 files. This option is silently ignored in any language other than C@.
1626
1627 Besides declarations, the file indicates, in comments, the origin of
1628 each declaration (source file and line), whether the declaration was
1629 implicit, prototyped or unprototyped (@samp{I}, @samp{N} for new or
1630 @samp{O} for old, respectively, in the first character after the line
1631 number and the colon), and whether it came from a declaration or a
1632 definition (@samp{C} or @samp{F}, respectively, in the following
1633 character). In the case of function definitions, a K&R-style list of
1634 arguments followed by their declarations is also provided, inside
1635 comments, after the declaration.
1636
1637 @item -fallow-parameterless-variadic-functions
1638 Accept variadic functions without named parameters.
1639
1640 Although it is possible to define such a function, this is not very
1641 useful as it is not possible to read the arguments. This is only
1642 supported for C as this construct is allowed by C++.
1643
1644 @item -fno-asm
1645 @opindex fno-asm
1646 Do not recognize @code{asm}, @code{inline} or @code{typeof} as a
1647 keyword, so that code can use these words as identifiers. You can use
1648 the keywords @code{__asm__}, @code{__inline__} and @code{__typeof__}
1649 instead. @option{-ansi} implies @option{-fno-asm}.
1650
1651 In C++, this switch only affects the @code{typeof} keyword, since
1652 @code{asm} and @code{inline} are standard keywords. You may want to
1653 use the @option{-fno-gnu-keywords} flag instead, which has the same
1654 effect. In C99 mode (@option{-std=c99} or @option{-std=gnu99}), this
1655 switch only affects the @code{asm} and @code{typeof} keywords, since
1656 @code{inline} is a standard keyword in ISO C99.
1657
1658 @item -fno-builtin
1659 @itemx -fno-builtin-@var{function}
1660 @opindex fno-builtin
1661 @cindex built-in functions
1662 Don't recognize built-in functions that do not begin with
1663 @samp{__builtin_} as prefix. @xref{Other Builtins,,Other built-in
1664 functions provided by GCC}, for details of the functions affected,
1665 including those which are not built-in functions when @option{-ansi} or
1666 @option{-std} options for strict ISO C conformance are used because they
1667 do not have an ISO standard meaning.
1668
1669 GCC normally generates special code to handle certain built-in functions
1670 more efficiently; for instance, calls to @code{alloca} may become single
1671 instructions that adjust the stack directly, and calls to @code{memcpy}
1672 may become inline copy loops. The resulting code is often both smaller
1673 and faster, but since the function calls no longer appear as such, you
1674 cannot set a breakpoint on those calls, nor can you change the behavior
1675 of the functions by linking with a different library. In addition,
1676 when a function is recognized as a built-in function, GCC may use
1677 information about that function to warn about problems with calls to
1678 that function, or to generate more efficient code, even if the
1679 resulting code still contains calls to that function. For example,
1680 warnings are given with @option{-Wformat} for bad calls to
1681 @code{printf}, when @code{printf} is built in, and @code{strlen} is
1682 known not to modify global memory.
1683
1684 With the @option{-fno-builtin-@var{function}} option
1685 only the built-in function @var{function} is
1686 disabled. @var{function} must not begin with @samp{__builtin_}. If a
1687 function is named that is not built-in in this version of GCC, this
1688 option is ignored. There is no corresponding
1689 @option{-fbuiltin-@var{function}} option; if you wish to enable
1690 built-in functions selectively when using @option{-fno-builtin} or
1691 @option{-ffreestanding}, you may define macros such as:
1692
1693 @smallexample
1694 #define abs(n) __builtin_abs ((n))
1695 #define strcpy(d, s) __builtin_strcpy ((d), (s))
1696 @end smallexample
1697
1698 @item -fhosted
1699 @opindex fhosted
1700 @cindex hosted environment
1701
1702 Assert that compilation takes place in a hosted environment. This implies
1703 @option{-fbuiltin}. A hosted environment is one in which the
1704 entire standard library is available, and in which @code{main} has a return
1705 type of @code{int}. Examples are nearly everything except a kernel.
1706 This is equivalent to @option{-fno-freestanding}.
1707
1708 @item -ffreestanding
1709 @opindex ffreestanding
1710 @cindex hosted environment
1711
1712 Assert that compilation takes place in a freestanding environment. This
1713 implies @option{-fno-builtin}. A freestanding environment
1714 is one in which the standard library may not exist, and program startup may
1715 not necessarily be at @code{main}. The most obvious example is an OS kernel.
1716 This is equivalent to @option{-fno-hosted}.
1717
1718 @xref{Standards,,Language Standards Supported by GCC}, for details of
1719 freestanding and hosted environments.
1720
1721 @item -fopenmp
1722 @opindex fopenmp
1723 @cindex OpenMP parallel
1724 Enable handling of OpenMP directives @code{#pragma omp} in C/C++ and
1725 @code{!$omp} in Fortran. When @option{-fopenmp} is specified, the
1726 compiler generates parallel code according to the OpenMP Application
1727 Program Interface v3.0 @w{@uref{http://www.openmp.org/}}. This option
1728 implies @option{-pthread}, and thus is only supported on targets that
1729 have support for @option{-pthread}.
1730
1731 @item -fgnu-tm
1732 @opindex fgnu-tm
1733 When the option @option{-fgnu-tm} is specified, the compiler will
1734 generate code for the Linux variant of Intel's current Transactional
1735 Memory ABI specification document (Revision 1.1, May 6 2009). This is
1736 an experimental feature whose interface may change in future versions
1737 of GCC, as the official specification changes. Please note that not
1738 all architectures are supported for this feature.
1739
1740 For more information on GCC's support for transactional memory,
1741 @xref{Enabling libitm,,The GNU Transactional Memory Library,libitm,GNU
1742 Transactional Memory Library}.
1743
1744 @item -fms-extensions
1745 @opindex fms-extensions
1746 Accept some non-standard constructs used in Microsoft header files.
1747
1748 In C++ code, this allows member names in structures to be similar
1749 to previous types declarations.
1750
1751 @smallexample
1752 typedef int UOW;
1753 struct ABC @{
1754 UOW UOW;
1755 @};
1756 @end smallexample
1757
1758 Some cases of unnamed fields in structures and unions are only
1759 accepted with this option. @xref{Unnamed Fields,,Unnamed struct/union
1760 fields within structs/unions}, for details.
1761
1762 @item -fplan9-extensions
1763 Accept some non-standard constructs used in Plan 9 code.
1764
1765 This enables @option{-fms-extensions}, permits passing pointers to
1766 structures with anonymous fields to functions which expect pointers to
1767 elements of the type of the field, and permits referring to anonymous
1768 fields declared using a typedef. @xref{Unnamed Fields,,Unnamed
1769 struct/union fields within structs/unions}, for details. This is only
1770 supported for C, not C++.
1771
1772 @item -trigraphs
1773 @opindex trigraphs
1774 Support ISO C trigraphs. The @option{-ansi} option (and @option{-std}
1775 options for strict ISO C conformance) implies @option{-trigraphs}.
1776
1777 @item -no-integrated-cpp
1778 @opindex no-integrated-cpp
1779 Performs a compilation in two passes: preprocessing and compiling. This
1780 option allows a user supplied "cc1", "cc1plus", or "cc1obj" via the
1781 @option{-B} option. The user supplied compilation step can then add in
1782 an additional preprocessing step after normal preprocessing but before
1783 compiling. The default is to use the integrated cpp (internal cpp)
1784
1785 The semantics of this option will change if "cc1", "cc1plus", and
1786 "cc1obj" are merged.
1787
1788 @cindex traditional C language
1789 @cindex C language, traditional
1790 @item -traditional
1791 @itemx -traditional-cpp
1792 @opindex traditional-cpp
1793 @opindex traditional
1794 Formerly, these options caused GCC to attempt to emulate a pre-standard
1795 C compiler. They are now only supported with the @option{-E} switch.
1796 The preprocessor continues to support a pre-standard mode. See the GNU
1797 CPP manual for details.
1798
1799 @item -fcond-mismatch
1800 @opindex fcond-mismatch
1801 Allow conditional expressions with mismatched types in the second and
1802 third arguments. The value of such an expression is void. This option
1803 is not supported for C++.
1804
1805 @item -flax-vector-conversions
1806 @opindex flax-vector-conversions
1807 Allow implicit conversions between vectors with differing numbers of
1808 elements and/or incompatible element types. This option should not be
1809 used for new code.
1810
1811 @item -funsigned-char
1812 @opindex funsigned-char
1813 Let the type @code{char} be unsigned, like @code{unsigned char}.
1814
1815 Each kind of machine has a default for what @code{char} should
1816 be. It is either like @code{unsigned char} by default or like
1817 @code{signed char} by default.
1818
1819 Ideally, a portable program should always use @code{signed char} or
1820 @code{unsigned char} when it depends on the signedness of an object.
1821 But many programs have been written to use plain @code{char} and
1822 expect it to be signed, or expect it to be unsigned, depending on the
1823 machines they were written for. This option, and its inverse, let you
1824 make such a program work with the opposite default.
1825
1826 The type @code{char} is always a distinct type from each of
1827 @code{signed char} or @code{unsigned char}, even though its behavior
1828 is always just like one of those two.
1829
1830 @item -fsigned-char
1831 @opindex fsigned-char
1832 Let the type @code{char} be signed, like @code{signed char}.
1833
1834 Note that this is equivalent to @option{-fno-unsigned-char}, which is
1835 the negative form of @option{-funsigned-char}. Likewise, the option
1836 @option{-fno-signed-char} is equivalent to @option{-funsigned-char}.
1837
1838 @item -fsigned-bitfields
1839 @itemx -funsigned-bitfields
1840 @itemx -fno-signed-bitfields
1841 @itemx -fno-unsigned-bitfields
1842 @opindex fsigned-bitfields
1843 @opindex funsigned-bitfields
1844 @opindex fno-signed-bitfields
1845 @opindex fno-unsigned-bitfields
1846 These options control whether a bit-field is signed or unsigned, when the
1847 declaration does not use either @code{signed} or @code{unsigned}. By
1848 default, such a bit-field is signed, because this is consistent: the
1849 basic integer types such as @code{int} are signed types.
1850 @end table
1851
1852 @node C++ Dialect Options
1853 @section Options Controlling C++ Dialect
1854
1855 @cindex compiler options, C++
1856 @cindex C++ options, command line
1857 @cindex options, C++
1858 This section describes the command-line options that are only meaningful
1859 for C++ programs; but you can also use most of the GNU compiler options
1860 regardless of what language your program is in. For example, you
1861 might compile a file @code{firstClass.C} like this:
1862
1863 @smallexample
1864 g++ -g -frepo -O -c firstClass.C
1865 @end smallexample
1866
1867 @noindent
1868 In this example, only @option{-frepo} is an option meant
1869 only for C++ programs; you can use the other options with any
1870 language supported by GCC@.
1871
1872 Here is a list of options that are @emph{only} for compiling C++ programs:
1873
1874 @table @gcctabopt
1875
1876 @item -fabi-version=@var{n}
1877 @opindex fabi-version
1878 Use version @var{n} of the C++ ABI@. Version 2 is the version of the
1879 C++ ABI that first appeared in G++ 3.4. Version 1 is the version of
1880 the C++ ABI that first appeared in G++ 3.2. Version 0 will always be
1881 the version that conforms most closely to the C++ ABI specification.
1882 Therefore, the ABI obtained using version 0 will change as ABI bugs
1883 are fixed.
1884
1885 The default is version 2.
1886
1887 Version 3 corrects an error in mangling a constant address as a
1888 template argument.
1889
1890 Version 4 implements a standard mangling for vector types.
1891
1892 Version 5 corrects the mangling of attribute const/volatile on
1893 function pointer types, decltype of a plain decl, and use of a
1894 function parameter in the declaration of another parameter.
1895
1896 Version 6 corrects the promotion behavior of C++11 scoped enums.
1897
1898 See also @option{-Wabi}.
1899
1900 @item -fno-access-control
1901 @opindex fno-access-control
1902 Turn off all access checking. This switch is mainly useful for working
1903 around bugs in the access control code.
1904
1905 @item -fcheck-new
1906 @opindex fcheck-new
1907 Check that the pointer returned by @code{operator new} is non-null
1908 before attempting to modify the storage allocated. This check is
1909 normally unnecessary because the C++ standard specifies that
1910 @code{operator new} will only return @code{0} if it is declared
1911 @samp{throw()}, in which case the compiler will always check the
1912 return value even without this option. In all other cases, when
1913 @code{operator new} has a non-empty exception specification, memory
1914 exhaustion is signalled by throwing @code{std::bad_alloc}. See also
1915 @samp{new (nothrow)}.
1916
1917 @item -fconserve-space
1918 @opindex fconserve-space
1919 Put uninitialized or runtime-initialized global variables into the
1920 common segment, as C does. This saves space in the executable at the
1921 cost of not diagnosing duplicate definitions. If you compile with this
1922 flag and your program mysteriously crashes after @code{main()} has
1923 completed, you may have an object that is being destroyed twice because
1924 two definitions were merged.
1925
1926 This option is no longer useful on most targets, now that support has
1927 been added for putting variables into BSS without making them common.
1928
1929 @item -fconstexpr-depth=@var{n}
1930 @opindex fconstexpr-depth
1931 Set the maximum nested evaluation depth for C++11 constexpr functions
1932 to @var{n}. A limit is needed to detect endless recursion during
1933 constant expression evaluation. The minimum specified by the standard
1934 is 512.
1935
1936 @item -fdeduce-init-list
1937 @opindex fdeduce-init-list
1938 Enable deduction of a template type parameter as
1939 std::initializer_list from a brace-enclosed initializer list, i.e.
1940
1941 @smallexample
1942 template <class T> auto forward(T t) -> decltype (realfn (t))
1943 @{
1944 return realfn (t);
1945 @}
1946
1947 void f()
1948 @{
1949 forward(@{1,2@}); // call forward<std::initializer_list<int>>
1950 @}
1951 @end smallexample
1952
1953 This deduction was implemented as a possible extension to the
1954 originally proposed semantics for the C++11 standard, but was not part
1955 of the final standard, so it is disabled by default. This option is
1956 deprecated, and may be removed in a future version of G++.
1957
1958 @item -ffriend-injection
1959 @opindex ffriend-injection
1960 Inject friend functions into the enclosing namespace, so that they are
1961 visible outside the scope of the class in which they are declared.
1962 Friend functions were documented to work this way in the old Annotated
1963 C++ Reference Manual, and versions of G++ before 4.1 always worked
1964 that way. However, in ISO C++ a friend function which is not declared
1965 in an enclosing scope can only be found using argument dependent
1966 lookup. This option causes friends to be injected as they were in
1967 earlier releases.
1968
1969 This option is for compatibility, and may be removed in a future
1970 release of G++.
1971
1972 @item -fno-elide-constructors
1973 @opindex fno-elide-constructors
1974 The C++ standard allows an implementation to omit creating a temporary
1975 which is only used to initialize another object of the same type.
1976 Specifying this option disables that optimization, and forces G++ to
1977 call the copy constructor in all cases.
1978
1979 @item -fno-enforce-eh-specs
1980 @opindex fno-enforce-eh-specs
1981 Don't generate code to check for violation of exception specifications
1982 at runtime. This option violates the C++ standard, but may be useful
1983 for reducing code size in production builds, much like defining
1984 @samp{NDEBUG}. This does not give user code permission to throw
1985 exceptions in violation of the exception specifications; the compiler
1986 will still optimize based on the specifications, so throwing an
1987 unexpected exception will result in undefined behavior.
1988
1989 @item -ffor-scope
1990 @itemx -fno-for-scope
1991 @opindex ffor-scope
1992 @opindex fno-for-scope
1993 If @option{-ffor-scope} is specified, the scope of variables declared in
1994 a @i{for-init-statement} is limited to the @samp{for} loop itself,
1995 as specified by the C++ standard.
1996 If @option{-fno-for-scope} is specified, the scope of variables declared in
1997 a @i{for-init-statement} extends to the end of the enclosing scope,
1998 as was the case in old versions of G++, and other (traditional)
1999 implementations of C++.
2000
2001 The default if neither flag is given to follow the standard,
2002 but to allow and give a warning for old-style code that would
2003 otherwise be invalid, or have different behavior.
2004
2005 @item -fno-gnu-keywords
2006 @opindex fno-gnu-keywords
2007 Do not recognize @code{typeof} as a keyword, so that code can use this
2008 word as an identifier. You can use the keyword @code{__typeof__} instead.
2009 @option{-ansi} implies @option{-fno-gnu-keywords}.
2010
2011 @item -fno-implicit-templates
2012 @opindex fno-implicit-templates
2013 Never emit code for non-inline templates which are instantiated
2014 implicitly (i.e.@: by use); only emit code for explicit instantiations.
2015 @xref{Template Instantiation}, for more information.
2016
2017 @item -fno-implicit-inline-templates
2018 @opindex fno-implicit-inline-templates
2019 Don't emit code for implicit instantiations of inline templates, either.
2020 The default is to handle inlines differently so that compiles with and
2021 without optimization will need the same set of explicit instantiations.
2022
2023 @item -fno-implement-inlines
2024 @opindex fno-implement-inlines
2025 To save space, do not emit out-of-line copies of inline functions
2026 controlled by @samp{#pragma implementation}. This will cause linker
2027 errors if these functions are not inlined everywhere they are called.
2028
2029 @item -fms-extensions
2030 @opindex fms-extensions
2031 Disable pedantic warnings about constructs used in MFC, such as implicit
2032 int and getting a pointer to member function via non-standard syntax.
2033
2034 @item -fno-nonansi-builtins
2035 @opindex fno-nonansi-builtins
2036 Disable built-in declarations of functions that are not mandated by
2037 ANSI/ISO C@. These include @code{ffs}, @code{alloca}, @code{_exit},
2038 @code{index}, @code{bzero}, @code{conjf}, and other related functions.
2039
2040 @item -fnothrow-opt
2041 @opindex fnothrow-opt
2042 Treat a @code{throw()} exception specification as though it were a
2043 @code{noexcept} specification to reduce or eliminate the text size
2044 overhead relative to a function with no exception specification. If
2045 the function has local variables of types with non-trivial
2046 destructors, the exception specification will actually make the
2047 function smaller because the EH cleanups for those variables can be
2048 optimized away. The semantic effect is that an exception thrown out of
2049 a function with such an exception specification will result in a call
2050 to @code{terminate} rather than @code{unexpected}.
2051
2052 @item -fno-operator-names
2053 @opindex fno-operator-names
2054 Do not treat the operator name keywords @code{and}, @code{bitand},
2055 @code{bitor}, @code{compl}, @code{not}, @code{or} and @code{xor} as
2056 synonyms as keywords.
2057
2058 @item -fno-optional-diags
2059 @opindex fno-optional-diags
2060 Disable diagnostics that the standard says a compiler does not need to
2061 issue. Currently, the only such diagnostic issued by G++ is the one for
2062 a name having multiple meanings within a class.
2063
2064 @item -fpermissive
2065 @opindex fpermissive
2066 Downgrade some diagnostics about nonconformant code from errors to
2067 warnings. Thus, using @option{-fpermissive} will allow some
2068 nonconforming code to compile.
2069
2070 @item -fno-pretty-templates
2071 @opindex fno-pretty-templates
2072 When an error message refers to a specialization of a function
2073 template, the compiler will normally print the signature of the
2074 template followed by the template arguments and any typedefs or
2075 typenames in the signature (e.g. @code{void f(T) [with T = int]}
2076 rather than @code{void f(int)}) so that it's clear which template is
2077 involved. When an error message refers to a specialization of a class
2078 template, the compiler will omit any template arguments which match
2079 the default template arguments for that template. If either of these
2080 behaviors make it harder to understand the error message rather than
2081 easier, using @option{-fno-pretty-templates} will disable them.
2082
2083 @item -frepo
2084 @opindex frepo
2085 Enable automatic template instantiation at link time. This option also
2086 implies @option{-fno-implicit-templates}. @xref{Template
2087 Instantiation}, for more information.
2088
2089 @item -fno-rtti
2090 @opindex fno-rtti
2091 Disable generation of information about every class with virtual
2092 functions for use by the C++ runtime type identification features
2093 (@samp{dynamic_cast} and @samp{typeid}). If you don't use those parts
2094 of the language, you can save some space by using this flag. Note that
2095 exception handling uses the same information, but it will generate it as
2096 needed. The @samp{dynamic_cast} operator can still be used for casts that
2097 do not require runtime type information, i.e.@: casts to @code{void *} or to
2098 unambiguous base classes.
2099
2100 @item -fstats
2101 @opindex fstats
2102 Emit statistics about front-end processing at the end of the compilation.
2103 This information is generally only useful to the G++ development team.
2104
2105 @item -fstrict-enums
2106 @opindex fstrict-enums
2107 Allow the compiler to optimize using the assumption that a value of
2108 enumeration type can only be one of the values of the enumeration (as
2109 defined in the C++ standard; basically, a value which can be
2110 represented in the minimum number of bits needed to represent all the
2111 enumerators). This assumption may not be valid if the program uses a
2112 cast to convert an arbitrary integer value to the enumeration type.
2113
2114 @item -ftemplate-depth=@var{n}
2115 @opindex ftemplate-depth
2116 Set the maximum instantiation depth for template classes to @var{n}.
2117 A limit on the template instantiation depth is needed to detect
2118 endless recursions during template class instantiation. ANSI/ISO C++
2119 conforming programs must not rely on a maximum depth greater than 17
2120 (changed to 1024 in C++11). The default value is 900, as the compiler
2121 can run out of stack space before hitting 1024 in some situations.
2122
2123 @item -fno-threadsafe-statics
2124 @opindex fno-threadsafe-statics
2125 Do not emit the extra code to use the routines specified in the C++
2126 ABI for thread-safe initialization of local statics. You can use this
2127 option to reduce code size slightly in code that doesn't need to be
2128 thread-safe.
2129
2130 @item -fuse-cxa-atexit
2131 @opindex fuse-cxa-atexit
2132 Register destructors for objects with static storage duration with the
2133 @code{__cxa_atexit} function rather than the @code{atexit} function.
2134 This option is required for fully standards-compliant handling of static
2135 destructors, but will only work if your C library supports
2136 @code{__cxa_atexit}.
2137
2138 @item -fno-use-cxa-get-exception-ptr
2139 @opindex fno-use-cxa-get-exception-ptr
2140 Don't use the @code{__cxa_get_exception_ptr} runtime routine. This
2141 will cause @code{std::uncaught_exception} to be incorrect, but is necessary
2142 if the runtime routine is not available.
2143
2144 @item -fvisibility-inlines-hidden
2145 @opindex fvisibility-inlines-hidden
2146 This switch declares that the user does not attempt to compare
2147 pointers to inline functions or methods where the addresses of the two functions
2148 were taken in different shared objects.
2149
2150 The effect of this is that GCC may, effectively, mark inline methods with
2151 @code{__attribute__ ((visibility ("hidden")))} so that they do not
2152 appear in the export table of a DSO and do not require a PLT indirection
2153 when used within the DSO@. Enabling this option can have a dramatic effect
2154 on load and link times of a DSO as it massively reduces the size of the
2155 dynamic export table when the library makes heavy use of templates.
2156
2157 The behavior of this switch is not quite the same as marking the
2158 methods as hidden directly, because it does not affect static variables
2159 local to the function or cause the compiler to deduce that
2160 the function is defined in only one shared object.
2161
2162 You may mark a method as having a visibility explicitly to negate the
2163 effect of the switch for that method. For example, if you do want to
2164 compare pointers to a particular inline method, you might mark it as
2165 having default visibility. Marking the enclosing class with explicit
2166 visibility will have no effect.
2167
2168 Explicitly instantiated inline methods are unaffected by this option
2169 as their linkage might otherwise cross a shared library boundary.
2170 @xref{Template Instantiation}.
2171
2172 @item -fvisibility-ms-compat
2173 @opindex fvisibility-ms-compat
2174 This flag attempts to use visibility settings to make GCC's C++
2175 linkage model compatible with that of Microsoft Visual Studio.
2176
2177 The flag makes these changes to GCC's linkage model:
2178
2179 @enumerate
2180 @item
2181 It sets the default visibility to @code{hidden}, like
2182 @option{-fvisibility=hidden}.
2183
2184 @item
2185 Types, but not their members, are not hidden by default.
2186
2187 @item
2188 The One Definition Rule is relaxed for types without explicit
2189 visibility specifications which are defined in more than one different
2190 shared object: those declarations are permitted if they would have
2191 been permitted when this option was not used.
2192 @end enumerate
2193
2194 In new code it is better to use @option{-fvisibility=hidden} and
2195 export those classes which are intended to be externally visible.
2196 Unfortunately it is possible for code to rely, perhaps accidentally,
2197 on the Visual Studio behavior.
2198
2199 Among the consequences of these changes are that static data members
2200 of the same type with the same name but defined in different shared
2201 objects will be different, so changing one will not change the other;
2202 and that pointers to function members defined in different shared
2203 objects may not compare equal. When this flag is given, it is a
2204 violation of the ODR to define types with the same name differently.
2205
2206 @item -fno-weak
2207 @opindex fno-weak
2208 Do not use weak symbol support, even if it is provided by the linker.
2209 By default, G++ will use weak symbols if they are available. This
2210 option exists only for testing, and should not be used by end-users;
2211 it will result in inferior code and has no benefits. This option may
2212 be removed in a future release of G++.
2213
2214 @item -nostdinc++
2215 @opindex nostdinc++
2216 Do not search for header files in the standard directories specific to
2217 C++, but do still search the other standard directories. (This option
2218 is used when building the C++ library.)
2219 @end table
2220
2221 In addition, these optimization, warning, and code generation options
2222 have meanings only for C++ programs:
2223
2224 @table @gcctabopt
2225 @item -fno-default-inline
2226 @opindex fno-default-inline
2227 Do not assume @samp{inline} for functions defined inside a class scope.
2228 @xref{Optimize Options,,Options That Control Optimization}. Note that these
2229 functions will have linkage like inline functions; they just won't be
2230 inlined by default.
2231
2232 @item -Wabi @r{(C, Objective-C, C++ and Objective-C++ only)}
2233 @opindex Wabi
2234 @opindex Wno-abi
2235 Warn when G++ generates code that is probably not compatible with the
2236 vendor-neutral C++ ABI@. Although an effort has been made to warn about
2237 all such cases, there are probably some cases that are not warned about,
2238 even though G++ is generating incompatible code. There may also be
2239 cases where warnings are emitted even though the code that is generated
2240 will be compatible.
2241
2242 You should rewrite your code to avoid these warnings if you are
2243 concerned about the fact that code generated by G++ may not be binary
2244 compatible with code generated by other compilers.
2245
2246 The known incompatibilities in @option{-fabi-version=2} (the default) include:
2247
2248 @itemize @bullet
2249
2250 @item
2251 A template with a non-type template parameter of reference type is
2252 mangled incorrectly:
2253 @smallexample
2254 extern int N;
2255 template <int &> struct S @{@};
2256 void n (S<N>) @{2@}
2257 @end smallexample
2258
2259 This is fixed in @option{-fabi-version=3}.
2260
2261 @item
2262 SIMD vector types declared using @code{__attribute ((vector_size))} are
2263 mangled in a non-standard way that does not allow for overloading of
2264 functions taking vectors of different sizes.
2265
2266 The mangling is changed in @option{-fabi-version=4}.
2267 @end itemize
2268
2269 The known incompatibilities in @option{-fabi-version=1} include:
2270
2271 @itemize @bullet
2272
2273 @item
2274 Incorrect handling of tail-padding for bit-fields. G++ may attempt to
2275 pack data into the same byte as a base class. For example:
2276
2277 @smallexample
2278 struct A @{ virtual void f(); int f1 : 1; @};
2279 struct B : public A @{ int f2 : 1; @};
2280 @end smallexample
2281
2282 @noindent
2283 In this case, G++ will place @code{B::f2} into the same byte
2284 as@code{A::f1}; other compilers will not. You can avoid this problem
2285 by explicitly padding @code{A} so that its size is a multiple of the
2286 byte size on your platform; that will cause G++ and other compilers to
2287 layout @code{B} identically.
2288
2289 @item
2290 Incorrect handling of tail-padding for virtual bases. G++ does not use
2291 tail padding when laying out virtual bases. For example:
2292
2293 @smallexample
2294 struct A @{ virtual void f(); char c1; @};
2295 struct B @{ B(); char c2; @};
2296 struct C : public A, public virtual B @{@};
2297 @end smallexample
2298
2299 @noindent
2300 In this case, G++ will not place @code{B} into the tail-padding for
2301 @code{A}; other compilers will. You can avoid this problem by
2302 explicitly padding @code{A} so that its size is a multiple of its
2303 alignment (ignoring virtual base classes); that will cause G++ and other
2304 compilers to layout @code{C} identically.
2305
2306 @item
2307 Incorrect handling of bit-fields with declared widths greater than that
2308 of their underlying types, when the bit-fields appear in a union. For
2309 example:
2310
2311 @smallexample
2312 union U @{ int i : 4096; @};
2313 @end smallexample
2314
2315 @noindent
2316 Assuming that an @code{int} does not have 4096 bits, G++ will make the
2317 union too small by the number of bits in an @code{int}.
2318
2319 @item
2320 Empty classes can be placed at incorrect offsets. For example:
2321
2322 @smallexample
2323 struct A @{@};
2324
2325 struct B @{
2326 A a;
2327 virtual void f ();
2328 @};
2329
2330 struct C : public B, public A @{@};
2331 @end smallexample
2332
2333 @noindent
2334 G++ will place the @code{A} base class of @code{C} at a nonzero offset;
2335 it should be placed at offset zero. G++ mistakenly believes that the
2336 @code{A} data member of @code{B} is already at offset zero.
2337
2338 @item
2339 Names of template functions whose types involve @code{typename} or
2340 template template parameters can be mangled incorrectly.
2341
2342 @smallexample
2343 template <typename Q>
2344 void f(typename Q::X) @{@}
2345
2346 template <template <typename> class Q>
2347 void f(typename Q<int>::X) @{@}
2348 @end smallexample
2349
2350 @noindent
2351 Instantiations of these templates may be mangled incorrectly.
2352
2353 @end itemize
2354
2355 It also warns psABI related changes. The known psABI changes at this
2356 point include:
2357
2358 @itemize @bullet
2359
2360 @item
2361 For SYSV/x86-64, when passing union with long double, it is changed to
2362 pass in memory as specified in psABI. For example:
2363
2364 @smallexample
2365 union U @{
2366 long double ld;
2367 int i;
2368 @};
2369 @end smallexample
2370
2371 @noindent
2372 @code{union U} will always be passed in memory.
2373
2374 @end itemize
2375
2376 @item -Wctor-dtor-privacy @r{(C++ and Objective-C++ only)}
2377 @opindex Wctor-dtor-privacy
2378 @opindex Wno-ctor-dtor-privacy
2379 Warn when a class seems unusable because all the constructors or
2380 destructors in that class are private, and it has neither friends nor
2381 public static member functions.
2382
2383 @item -Wdelete-non-virtual-dtor @r{(C++ and Objective-C++ only)}
2384 @opindex Wdelete-non-virtual-dtor
2385 @opindex Wno-delete-non-virtual-dtor
2386 Warn when @samp{delete} is used to destroy an instance of a class which
2387 has virtual functions and non-virtual destructor. It is unsafe to delete
2388 an instance of a derived class through a pointer to a base class if the
2389 base class does not have a virtual destructor. This warning is enabled
2390 by @option{-Wall}.
2391
2392 @item -Wnarrowing @r{(C++ and Objective-C++ only)}
2393 @opindex Wnarrowing
2394 @opindex Wno-narrowing
2395 Warn when a narrowing conversion prohibited by C++11 occurs within
2396 @samp{@{ @}}, e.g.
2397
2398 @smallexample
2399 int i = @{ 2.2 @}; // error: narrowing from double to int
2400 @end smallexample
2401
2402 This flag is included in @option{-Wall} and @option{-Wc++11-compat}.
2403
2404 With -std=c++11, @option{-Wno-narrowing} suppresses the diagnostic
2405 required by the standard. Note that this does not affect the meaning
2406 of well-formed code; narrowing conversions are still considered
2407 ill-formed in SFINAE context.
2408
2409 @item -Wnoexcept @r{(C++ and Objective-C++ only)}
2410 @opindex Wnoexcept
2411 @opindex Wno-noexcept
2412 Warn when a noexcept-expression evaluates to false because of a call
2413 to a function that does not have a non-throwing exception
2414 specification (i.e. @samp{throw()} or @samp{noexcept}) but is known by
2415 the compiler to never throw an exception.
2416
2417 @item -Wnon-virtual-dtor @r{(C++ and Objective-C++ only)}
2418 @opindex Wnon-virtual-dtor
2419 @opindex Wno-non-virtual-dtor
2420 Warn when a class has virtual functions and accessible non-virtual
2421 destructor, in which case it would be possible but unsafe to delete
2422 an instance of a derived class through a pointer to the base class.
2423 This warning is also enabled if -Weffc++ is specified.
2424
2425 @item -Wreorder @r{(C++ and Objective-C++ only)}
2426 @opindex Wreorder
2427 @opindex Wno-reorder
2428 @cindex reordering, warning
2429 @cindex warning for reordering of member initializers
2430 Warn when the order of member initializers given in the code does not
2431 match the order in which they must be executed. For instance:
2432
2433 @smallexample
2434 struct A @{
2435 int i;
2436 int j;
2437 A(): j (0), i (1) @{ @}
2438 @};
2439 @end smallexample
2440
2441 The compiler will rearrange the member initializers for @samp{i}
2442 and @samp{j} to match the declaration order of the members, emitting
2443 a warning to that effect. This warning is enabled by @option{-Wall}.
2444 @end table
2445
2446 The following @option{-W@dots{}} options are not affected by @option{-Wall}.
2447
2448 @table @gcctabopt
2449 @item -Weffc++ @r{(C++ and Objective-C++ only)}
2450 @opindex Weffc++
2451 @opindex Wno-effc++
2452 Warn about violations of the following style guidelines from Scott Meyers'
2453 @cite{Effective C++} book:
2454
2455 @itemize @bullet
2456 @item
2457 Item 11: Define a copy constructor and an assignment operator for classes
2458 with dynamically allocated memory.
2459
2460 @item
2461 Item 12: Prefer initialization to assignment in constructors.
2462
2463 @item
2464 Item 14: Make destructors virtual in base classes.
2465
2466 @item
2467 Item 15: Have @code{operator=} return a reference to @code{*this}.
2468
2469 @item
2470 Item 23: Don't try to return a reference when you must return an object.
2471
2472 @end itemize
2473
2474 Also warn about violations of the following style guidelines from
2475 Scott Meyers' @cite{More Effective C++} book:
2476
2477 @itemize @bullet
2478 @item
2479 Item 6: Distinguish between prefix and postfix forms of increment and
2480 decrement operators.
2481
2482 @item
2483 Item 7: Never overload @code{&&}, @code{||}, or @code{,}.
2484
2485 @end itemize
2486
2487 When selecting this option, be aware that the standard library
2488 headers do not obey all of these guidelines; use @samp{grep -v}
2489 to filter out those warnings.
2490
2491 @item -Wstrict-null-sentinel @r{(C++ and Objective-C++ only)}
2492 @opindex Wstrict-null-sentinel
2493 @opindex Wno-strict-null-sentinel
2494 Warn also about the use of an uncasted @code{NULL} as sentinel. When
2495 compiling only with GCC this is a valid sentinel, as @code{NULL} is defined
2496 to @code{__null}. Although it is a null pointer constant not a null pointer,
2497 it is guaranteed to be of the same size as a pointer. But this use is
2498 not portable across different compilers.
2499
2500 @item -Wno-non-template-friend @r{(C++ and Objective-C++ only)}
2501 @opindex Wno-non-template-friend
2502 @opindex Wnon-template-friend
2503 Disable warnings when non-templatized friend functions are declared
2504 within a template. Since the advent of explicit template specification
2505 support in G++, if the name of the friend is an unqualified-id (i.e.,
2506 @samp{friend foo(int)}), the C++ language specification demands that the
2507 friend declare or define an ordinary, nontemplate function. (Section
2508 14.5.3). Before G++ implemented explicit specification, unqualified-ids
2509 could be interpreted as a particular specialization of a templatized
2510 function. Because this non-conforming behavior is no longer the default
2511 behavior for G++, @option{-Wnon-template-friend} allows the compiler to
2512 check existing code for potential trouble spots and is on by default.
2513 This new compiler behavior can be turned off with
2514 @option{-Wno-non-template-friend} which keeps the conformant compiler code
2515 but disables the helpful warning.
2516
2517 @item -Wold-style-cast @r{(C++ and Objective-C++ only)}
2518 @opindex Wold-style-cast
2519 @opindex Wno-old-style-cast
2520 Warn if an old-style (C-style) cast to a non-void type is used within
2521 a C++ program. The new-style casts (@samp{dynamic_cast},
2522 @samp{static_cast}, @samp{reinterpret_cast}, and @samp{const_cast}) are
2523 less vulnerable to unintended effects and much easier to search for.
2524
2525 @item -Woverloaded-virtual @r{(C++ and Objective-C++ only)}
2526 @opindex Woverloaded-virtual
2527 @opindex Wno-overloaded-virtual
2528 @cindex overloaded virtual function, warning
2529 @cindex warning for overloaded virtual function
2530 Warn when a function declaration hides virtual functions from a
2531 base class. For example, in:
2532
2533 @smallexample
2534 struct A @{
2535 virtual void f();
2536 @};
2537
2538 struct B: public A @{
2539 void f(int);
2540 @};
2541 @end smallexample
2542
2543 the @code{A} class version of @code{f} is hidden in @code{B}, and code
2544 like:
2545
2546 @smallexample
2547 B* b;
2548 b->f();
2549 @end smallexample
2550
2551 will fail to compile.
2552
2553 @item -Wno-pmf-conversions @r{(C++ and Objective-C++ only)}
2554 @opindex Wno-pmf-conversions
2555 @opindex Wpmf-conversions
2556 Disable the diagnostic for converting a bound pointer to member function
2557 to a plain pointer.
2558
2559 @item -Wsign-promo @r{(C++ and Objective-C++ only)}
2560 @opindex Wsign-promo
2561 @opindex Wno-sign-promo
2562 Warn when overload resolution chooses a promotion from unsigned or
2563 enumerated type to a signed type, over a conversion to an unsigned type of
2564 the same size. Previous versions of G++ would try to preserve
2565 unsignedness, but the standard mandates the current behavior.
2566
2567 @smallexample
2568 struct A @{
2569 operator int ();
2570 A& operator = (int);
2571 @};
2572
2573 main ()
2574 @{
2575 A a,b;
2576 a = b;
2577 @}
2578 @end smallexample
2579
2580 In this example, G++ will synthesize a default @samp{A& operator =
2581 (const A&);}, while cfront will use the user-defined @samp{operator =}.
2582 @end table
2583
2584 @node Objective-C and Objective-C++ Dialect Options
2585 @section Options Controlling Objective-C and Objective-C++ Dialects
2586
2587 @cindex compiler options, Objective-C and Objective-C++
2588 @cindex Objective-C and Objective-C++ options, command line
2589 @cindex options, Objective-C and Objective-C++
2590 (NOTE: This manual does not describe the Objective-C and Objective-C++
2591 languages themselves. @xref{Standards,,Language Standards
2592 Supported by GCC}, for references.)
2593
2594 This section describes the command-line options that are only meaningful
2595 for Objective-C and Objective-C++ programs, but you can also use most of
2596 the language-independent GNU compiler options.
2597 For example, you might compile a file @code{some_class.m} like this:
2598
2599 @smallexample
2600 gcc -g -fgnu-runtime -O -c some_class.m
2601 @end smallexample
2602
2603 @noindent
2604 In this example, @option{-fgnu-runtime} is an option meant only for
2605 Objective-C and Objective-C++ programs; you can use the other options with
2606 any language supported by GCC@.
2607
2608 Note that since Objective-C is an extension of the C language, Objective-C
2609 compilations may also use options specific to the C front-end (e.g.,
2610 @option{-Wtraditional}). Similarly, Objective-C++ compilations may use
2611 C++-specific options (e.g., @option{-Wabi}).
2612
2613 Here is a list of options that are @emph{only} for compiling Objective-C
2614 and Objective-C++ programs:
2615
2616 @table @gcctabopt
2617 @item -fconstant-string-class=@var{class-name}
2618 @opindex fconstant-string-class
2619 Use @var{class-name} as the name of the class to instantiate for each
2620 literal string specified with the syntax @code{@@"@dots{}"}. The default
2621 class name is @code{NXConstantString} if the GNU runtime is being used, and
2622 @code{NSConstantString} if the NeXT runtime is being used (see below). The
2623 @option{-fconstant-cfstrings} option, if also present, will override the
2624 @option{-fconstant-string-class} setting and cause @code{@@"@dots{}"} literals
2625 to be laid out as constant CoreFoundation strings.
2626
2627 @item -fgnu-runtime
2628 @opindex fgnu-runtime
2629 Generate object code compatible with the standard GNU Objective-C
2630 runtime. This is the default for most types of systems.
2631
2632 @item -fnext-runtime
2633 @opindex fnext-runtime
2634 Generate output compatible with the NeXT runtime. This is the default
2635 for NeXT-based systems, including Darwin and Mac OS X@. The macro
2636 @code{__NEXT_RUNTIME__} is predefined if (and only if) this option is
2637 used.
2638
2639 @item -fno-nil-receivers
2640 @opindex fno-nil-receivers
2641 Assume that all Objective-C message dispatches (@code{[receiver
2642 message:arg]}) in this translation unit ensure that the receiver is
2643 not @code{nil}. This allows for more efficient entry points in the
2644 runtime to be used. This option is only available in conjunction with
2645 the NeXT runtime and ABI version 0 or 1.
2646
2647 @item -fobjc-abi-version=@var{n}
2648 @opindex fobjc-abi-version
2649 Use version @var{n} of the Objective-C ABI for the selected runtime.
2650 This option is currently supported only for the NeXT runtime. In that
2651 case, Version 0 is the traditional (32-bit) ABI without support for
2652 properties and other Objective-C 2.0 additions. Version 1 is the
2653 traditional (32-bit) ABI with support for properties and other
2654 Objective-C 2.0 additions. Version 2 is the modern (64-bit) ABI. If
2655 nothing is specified, the default is Version 0 on 32-bit target
2656 machines, and Version 2 on 64-bit target machines.
2657
2658 @item -fobjc-call-cxx-cdtors
2659 @opindex fobjc-call-cxx-cdtors
2660 For each Objective-C class, check if any of its instance variables is a
2661 C++ object with a non-trivial default constructor. If so, synthesize a
2662 special @code{- (id) .cxx_construct} instance method that will run
2663 non-trivial default constructors on any such instance variables, in order,
2664 and then return @code{self}. Similarly, check if any instance variable
2665 is a C++ object with a non-trivial destructor, and if so, synthesize a
2666 special @code{- (void) .cxx_destruct} method that will run
2667 all such default destructors, in reverse order.
2668
2669 The @code{- (id) .cxx_construct} and @code{- (void) .cxx_destruct}
2670 methods thusly generated will only operate on instance variables
2671 declared in the current Objective-C class, and not those inherited
2672 from superclasses. It is the responsibility of the Objective-C
2673 runtime to invoke all such methods in an object's inheritance
2674 hierarchy. The @code{- (id) .cxx_construct} methods will be invoked
2675 by the runtime immediately after a new object instance is allocated;
2676 the @code{- (void) .cxx_destruct} methods will be invoked immediately
2677 before the runtime deallocates an object instance.
2678
2679 As of this writing, only the NeXT runtime on Mac OS X 10.4 and later has
2680 support for invoking the @code{- (id) .cxx_construct} and
2681 @code{- (void) .cxx_destruct} methods.
2682
2683 @item -fobjc-direct-dispatch
2684 @opindex fobjc-direct-dispatch
2685 Allow fast jumps to the message dispatcher. On Darwin this is
2686 accomplished via the comm page.
2687
2688 @item -fobjc-exceptions
2689 @opindex fobjc-exceptions
2690 Enable syntactic support for structured exception handling in
2691 Objective-C, similar to what is offered by C++ and Java. This option
2692 is required to use the Objective-C keywords @code{@@try},
2693 @code{@@throw}, @code{@@catch}, @code{@@finally} and
2694 @code{@@synchronized}. This option is available with both the GNU
2695 runtime and the NeXT runtime (but not available in conjunction with
2696 the NeXT runtime on Mac OS X 10.2 and earlier).
2697
2698 @item -fobjc-gc
2699 @opindex fobjc-gc
2700 Enable garbage collection (GC) in Objective-C and Objective-C++
2701 programs. This option is only available with the NeXT runtime; the
2702 GNU runtime has a different garbage collection implementation that
2703 does not require special compiler flags.
2704
2705 @item -fobjc-nilcheck
2706 @opindex fobjc-nilcheck
2707 For the NeXT runtime with version 2 of the ABI, check for a nil
2708 receiver in method invocations before doing the actual method call.
2709 This is the default and can be disabled using
2710 @option{-fno-objc-nilcheck}. Class methods and super calls are never
2711 checked for nil in this way no matter what this flag is set to.
2712 Currently this flag does nothing when the GNU runtime, or an older
2713 version of the NeXT runtime ABI, is used.
2714
2715 @item -fobjc-std=objc1
2716 @opindex fobjc-std
2717 Conform to the language syntax of Objective-C 1.0, the language
2718 recognized by GCC 4.0. This only affects the Objective-C additions to
2719 the C/C++ language; it does not affect conformance to C/C++ standards,
2720 which is controlled by the separate C/C++ dialect option flags. When
2721 this option is used with the Objective-C or Objective-C++ compiler,
2722 any Objective-C syntax that is not recognized by GCC 4.0 is rejected.
2723 This is useful if you need to make sure that your Objective-C code can
2724 be compiled with older versions of GCC.
2725
2726 @item -freplace-objc-classes
2727 @opindex freplace-objc-classes
2728 Emit a special marker instructing @command{ld(1)} not to statically link in
2729 the resulting object file, and allow @command{dyld(1)} to load it in at
2730 run time instead. This is used in conjunction with the Fix-and-Continue
2731 debugging mode, where the object file in question may be recompiled and
2732 dynamically reloaded in the course of program execution, without the need
2733 to restart the program itself. Currently, Fix-and-Continue functionality
2734 is only available in conjunction with the NeXT runtime on Mac OS X 10.3
2735 and later.
2736
2737 @item -fzero-link
2738 @opindex fzero-link
2739 When compiling for the NeXT runtime, the compiler ordinarily replaces calls
2740 to @code{objc_getClass("@dots{}")} (when the name of the class is known at
2741 compile time) with static class references that get initialized at load time,
2742 which improves run-time performance. Specifying the @option{-fzero-link} flag
2743 suppresses this behavior and causes calls to @code{objc_getClass("@dots{}")}
2744 to be retained. This is useful in Zero-Link debugging mode, since it allows
2745 for individual class implementations to be modified during program execution.
2746 The GNU runtime currently always retains calls to @code{objc_get_class("@dots{}")}
2747 regardless of command line options.
2748
2749 @item -gen-decls
2750 @opindex gen-decls
2751 Dump interface declarations for all classes seen in the source file to a
2752 file named @file{@var{sourcename}.decl}.
2753
2754 @item -Wassign-intercept @r{(Objective-C and Objective-C++ only)}
2755 @opindex Wassign-intercept
2756 @opindex Wno-assign-intercept
2757 Warn whenever an Objective-C assignment is being intercepted by the
2758 garbage collector.
2759
2760 @item -Wno-protocol @r{(Objective-C and Objective-C++ only)}
2761 @opindex Wno-protocol
2762 @opindex Wprotocol
2763 If a class is declared to implement a protocol, a warning is issued for
2764 every method in the protocol that is not implemented by the class. The
2765 default behavior is to issue a warning for every method not explicitly
2766 implemented in the class, even if a method implementation is inherited
2767 from the superclass. If you use the @option{-Wno-protocol} option, then
2768 methods inherited from the superclass are considered to be implemented,
2769 and no warning is issued for them.
2770
2771 @item -Wselector @r{(Objective-C and Objective-C++ only)}
2772 @opindex Wselector
2773 @opindex Wno-selector
2774 Warn if multiple methods of different types for the same selector are
2775 found during compilation. The check is performed on the list of methods
2776 in the final stage of compilation. Additionally, a check is performed
2777 for each selector appearing in a @code{@@selector(@dots{})}
2778 expression, and a corresponding method for that selector has been found
2779 during compilation. Because these checks scan the method table only at
2780 the end of compilation, these warnings are not produced if the final
2781 stage of compilation is not reached, for example because an error is
2782 found during compilation, or because the @option{-fsyntax-only} option is
2783 being used.
2784
2785 @item -Wstrict-selector-match @r{(Objective-C and Objective-C++ only)}
2786 @opindex Wstrict-selector-match
2787 @opindex Wno-strict-selector-match
2788 Warn if multiple methods with differing argument and/or return types are
2789 found for a given selector when attempting to send a message using this
2790 selector to a receiver of type @code{id} or @code{Class}. When this flag
2791 is off (which is the default behavior), the compiler will omit such warnings
2792 if any differences found are confined to types which share the same size
2793 and alignment.
2794
2795 @item -Wundeclared-selector @r{(Objective-C and Objective-C++ only)}
2796 @opindex Wundeclared-selector
2797 @opindex Wno-undeclared-selector
2798 Warn if a @code{@@selector(@dots{})} expression referring to an
2799 undeclared selector is found. A selector is considered undeclared if no
2800 method with that name has been declared before the
2801 @code{@@selector(@dots{})} expression, either explicitly in an
2802 @code{@@interface} or @code{@@protocol} declaration, or implicitly in
2803 an @code{@@implementation} section. This option always performs its
2804 checks as soon as a @code{@@selector(@dots{})} expression is found,
2805 while @option{-Wselector} only performs its checks in the final stage of
2806 compilation. This also enforces the coding style convention
2807 that methods and selectors must be declared before being used.
2808
2809 @item -print-objc-runtime-info
2810 @opindex print-objc-runtime-info
2811 Generate C header describing the largest structure that is passed by
2812 value, if any.
2813
2814 @end table
2815
2816 @node Language Independent Options
2817 @section Options to Control Diagnostic Messages Formatting
2818 @cindex options to control diagnostics formatting
2819 @cindex diagnostic messages
2820 @cindex message formatting
2821
2822 Traditionally, diagnostic messages have been formatted irrespective of
2823 the output device's aspect (e.g.@: its width, @dots{}). The options described
2824 below can be used to control the diagnostic messages formatting
2825 algorithm, e.g.@: how many characters per line, how often source location
2826 information should be reported. Right now, only the C++ front end can
2827 honor these options. However it is expected, in the near future, that
2828 the remaining front ends would be able to digest them correctly.
2829
2830 @table @gcctabopt
2831 @item -fmessage-length=@var{n}
2832 @opindex fmessage-length
2833 Try to format error messages so that they fit on lines of about @var{n}
2834 characters. The default is 72 characters for @command{g++} and 0 for the rest of
2835 the front ends supported by GCC@. If @var{n} is zero, then no
2836 line-wrapping will be done; each error message will appear on a single
2837 line.
2838
2839 @opindex fdiagnostics-show-location
2840 @item -fdiagnostics-show-location=once
2841 Only meaningful in line-wrapping mode. Instructs the diagnostic messages
2842 reporter to emit @emph{once} source location information; that is, in
2843 case the message is too long to fit on a single physical line and has to
2844 be wrapped, the source location won't be emitted (as prefix) again,
2845 over and over, in subsequent continuation lines. This is the default
2846 behavior.
2847
2848 @item -fdiagnostics-show-location=every-line
2849 Only meaningful in line-wrapping mode. Instructs the diagnostic
2850 messages reporter to emit the same source location information (as
2851 prefix) for physical lines that result from the process of breaking
2852 a message which is too long to fit on a single line.
2853
2854 @item -fno-diagnostics-show-option
2855 @opindex fno-diagnostics-show-option
2856 @opindex fdiagnostics-show-option
2857 By default, each diagnostic emitted includes text which indicates the
2858 command line option that directly controls the diagnostic (if such an
2859 option is known to the diagnostic machinery). Specifying the
2860 @option{-fno-diagnostics-show-option} flag suppresses that behavior.
2861
2862 @item -Wcoverage-mismatch
2863 @opindex Wcoverage-mismatch
2864 Warn if feedback profiles do not match when using the
2865 @option{-fprofile-use} option.
2866 If a source file was changed between @option{-fprofile-gen} and
2867 @option{-fprofile-use}, the files with the profile feedback can fail
2868 to match the source file and GCC can not use the profile feedback
2869 information. By default, this warning is enabled and is treated as an
2870 error. @option{-Wno-coverage-mismatch} can be used to disable the
2871 warning or @option{-Wno-error=coverage-mismatch} can be used to
2872 disable the error. Disable the error for this warning can result in
2873 poorly optimized code, so disabling the error is useful only in the
2874 case of very minor changes such as bug fixes to an existing code-base.
2875 Completely disabling the warning is not recommended.
2876
2877 @end table
2878
2879 @node Warning Options
2880 @section Options to Request or Suppress Warnings
2881 @cindex options to control warnings
2882 @cindex warning messages
2883 @cindex messages, warning
2884 @cindex suppressing warnings
2885
2886 Warnings are diagnostic messages that report constructions which
2887 are not inherently erroneous but which are risky or suggest there
2888 may have been an error.
2889
2890 The following language-independent options do not enable specific
2891 warnings but control the kinds of diagnostics produced by GCC.
2892
2893 @table @gcctabopt
2894 @cindex syntax checking
2895 @item -fsyntax-only
2896 @opindex fsyntax-only
2897 Check the code for syntax errors, but don't do anything beyond that.
2898
2899 @item -fmax-errors=@var{n}
2900 @opindex fmax-errors
2901 Limits the maximum number of error messages to @var{n}, at which point
2902 GCC bails out rather than attempting to continue processing the source
2903 code. If @var{n} is 0 (the default), there is no limit on the number
2904 of error messages produced. If @option{-Wfatal-errors} is also
2905 specified, then @option{-Wfatal-errors} takes precedence over this
2906 option.
2907
2908 @item -w
2909 @opindex w
2910 Inhibit all warning messages.
2911
2912 @item -Werror
2913 @opindex Werror
2914 @opindex Wno-error
2915 Make all warnings into errors.
2916
2917 @item -Werror=
2918 @opindex Werror=
2919 @opindex Wno-error=
2920 Make the specified warning into an error. The specifier for a warning
2921 is appended, for example @option{-Werror=switch} turns the warnings
2922 controlled by @option{-Wswitch} into errors. This switch takes a
2923 negative form, to be used to negate @option{-Werror} for specific
2924 warnings, for example @option{-Wno-error=switch} makes
2925 @option{-Wswitch} warnings not be errors, even when @option{-Werror}
2926 is in effect.
2927
2928 The warning message for each controllable warning includes the
2929 option which controls the warning. That option can then be used with
2930 @option{-Werror=} and @option{-Wno-error=} as described above.
2931 (Printing of the option in the warning message can be disabled using the
2932 @option{-fno-diagnostics-show-option} flag.)
2933
2934 Note that specifying @option{-Werror=}@var{foo} automatically implies
2935 @option{-W}@var{foo}. However, @option{-Wno-error=}@var{foo} does not
2936 imply anything.
2937
2938 @item -Wfatal-errors
2939 @opindex Wfatal-errors
2940 @opindex Wno-fatal-errors
2941 This option causes the compiler to abort compilation on the first error
2942 occurred rather than trying to keep going and printing further error
2943 messages.
2944
2945 @end table
2946
2947 You can request many specific warnings with options beginning
2948 @samp{-W}, for example @option{-Wimplicit} to request warnings on
2949 implicit declarations. Each of these specific warning options also
2950 has a negative form beginning @samp{-Wno-} to turn off warnings; for
2951 example, @option{-Wno-implicit}. This manual lists only one of the
2952 two forms, whichever is not the default. For further,
2953 language-specific options also refer to @ref{C++ Dialect Options} and
2954 @ref{Objective-C and Objective-C++ Dialect Options}.
2955
2956 When an unrecognized warning option is requested (e.g.,
2957 @option{-Wunknown-warning}), GCC will emit a diagnostic stating
2958 that the option is not recognized. However, if the @option{-Wno-} form
2959 is used, the behavior is slightly different: No diagnostic will be
2960 produced for @option{-Wno-unknown-warning} unless other diagnostics
2961 are being produced. This allows the use of new @option{-Wno-} options
2962 with old compilers, but if something goes wrong, the compiler will
2963 warn that an unrecognized option was used.
2964
2965 @table @gcctabopt
2966 @item -pedantic
2967 @opindex pedantic
2968 Issue all the warnings demanded by strict ISO C and ISO C++;
2969 reject all programs that use forbidden extensions, and some other
2970 programs that do not follow ISO C and ISO C++. For ISO C, follows the
2971 version of the ISO C standard specified by any @option{-std} option used.
2972
2973 Valid ISO C and ISO C++ programs should compile properly with or without
2974 this option (though a rare few will require @option{-ansi} or a
2975 @option{-std} option specifying the required version of ISO C)@. However,
2976 without this option, certain GNU extensions and traditional C and C++
2977 features are supported as well. With this option, they are rejected.
2978
2979 @option{-pedantic} does not cause warning messages for use of the
2980 alternate keywords whose names begin and end with @samp{__}. Pedantic
2981 warnings are also disabled in the expression that follows
2982 @code{__extension__}. However, only system header files should use
2983 these escape routes; application programs should avoid them.
2984 @xref{Alternate Keywords}.
2985
2986 Some users try to use @option{-pedantic} to check programs for strict ISO
2987 C conformance. They soon find that it does not do quite what they want:
2988 it finds some non-ISO practices, but not all---only those for which
2989 ISO C @emph{requires} a diagnostic, and some others for which
2990 diagnostics have been added.
2991
2992 A feature to report any failure to conform to ISO C might be useful in
2993 some instances, but would require considerable additional work and would
2994 be quite different from @option{-pedantic}. We don't have plans to
2995 support such a feature in the near future.
2996
2997 Where the standard specified with @option{-std} represents a GNU
2998 extended dialect of C, such as @samp{gnu90} or @samp{gnu99}, there is a
2999 corresponding @dfn{base standard}, the version of ISO C on which the GNU
3000 extended dialect is based. Warnings from @option{-pedantic} are given
3001 where they are required by the base standard. (It would not make sense
3002 for such warnings to be given only for features not in the specified GNU
3003 C dialect, since by definition the GNU dialects of C include all
3004 features the compiler supports with the given option, and there would be
3005 nothing to warn about.)
3006
3007 @item -pedantic-errors
3008 @opindex pedantic-errors
3009 Like @option{-pedantic}, except that errors are produced rather than
3010 warnings.
3011
3012 @item -Wall
3013 @opindex Wall
3014 @opindex Wno-all
3015 This enables all the warnings about constructions that some users
3016 consider questionable, and that are easy to avoid (or modify to
3017 prevent the warning), even in conjunction with macros. This also
3018 enables some language-specific warnings described in @ref{C++ Dialect
3019 Options} and @ref{Objective-C and Objective-C++ Dialect Options}.
3020
3021 @option{-Wall} turns on the following warning flags:
3022
3023 @gccoptlist{-Waddress @gol
3024 -Warray-bounds @r{(only with} @option{-O2}@r{)} @gol
3025 -Wc++11-compat @gol
3026 -Wchar-subscripts @gol
3027 -Wenum-compare @r{(in C/Objc; this is on by default in C++)} @gol
3028 -Wimplicit-int @r{(C and Objective-C only)} @gol
3029 -Wimplicit-function-declaration @r{(C and Objective-C only)} @gol
3030 -Wcomment @gol
3031 -Wformat @gol
3032 -Wmain @r{(only for C/ObjC and unless} @option{-ffreestanding}@r{)} @gol
3033 -Wmaybe-uninitialized @gol
3034 -Wmissing-braces @gol
3035 -Wnonnull @gol
3036 -Wparentheses @gol
3037 -Wpointer-sign @gol
3038 -Wreorder @gol
3039 -Wreturn-type @gol
3040 -Wsequence-point @gol
3041 -Wsign-compare @r{(only in C++)} @gol
3042 -Wstrict-aliasing @gol
3043 -Wstrict-overflow=1 @gol
3044 -Wswitch @gol
3045 -Wtrigraphs @gol
3046 -Wuninitialized @gol
3047 -Wunknown-pragmas @gol
3048 -Wunused-function @gol
3049 -Wunused-label @gol
3050 -Wunused-value @gol
3051 -Wunused-variable @gol
3052 -Wvolatile-register-var @gol
3053 }
3054
3055 Note that some warning flags are not implied by @option{-Wall}. Some of
3056 them warn about constructions that users generally do not consider
3057 questionable, but which occasionally you might wish to check for;
3058 others warn about constructions that are necessary or hard to avoid in
3059 some cases, and there is no simple way to modify the code to suppress
3060 the warning. Some of them are enabled by @option{-Wextra} but many of
3061 them must be enabled individually.
3062
3063 @item -Wextra
3064 @opindex W
3065 @opindex Wextra
3066 @opindex Wno-extra
3067 This enables some extra warning flags that are not enabled by
3068 @option{-Wall}. (This option used to be called @option{-W}. The older
3069 name is still supported, but the newer name is more descriptive.)
3070
3071 @gccoptlist{-Wclobbered @gol
3072 -Wempty-body @gol
3073 -Wignored-qualifiers @gol
3074 -Wmissing-field-initializers @gol
3075 -Wmissing-parameter-type @r{(C only)} @gol
3076 -Wold-style-declaration @r{(C only)} @gol
3077 -Woverride-init @gol
3078 -Wsign-compare @gol
3079 -Wtype-limits @gol
3080 -Wuninitialized @gol
3081 -Wunused-parameter @r{(only with} @option{-Wunused} @r{or} @option{-Wall}@r{)} @gol
3082 -Wunused-but-set-parameter @r{(only with} @option{-Wunused} @r{or} @option{-Wall}@r{)} @gol
3083 }
3084
3085 The option @option{-Wextra} also prints warning messages for the
3086 following cases:
3087
3088 @itemize @bullet
3089
3090 @item
3091 A pointer is compared against integer zero with @samp{<}, @samp{<=},
3092 @samp{>}, or @samp{>=}.
3093
3094 @item
3095 (C++ only) An enumerator and a non-enumerator both appear in a
3096 conditional expression.
3097
3098 @item
3099 (C++ only) Ambiguous virtual bases.
3100
3101 @item
3102 (C++ only) Subscripting an array which has been declared @samp{register}.
3103
3104 @item
3105 (C++ only) Taking the address of a variable which has been declared
3106 @samp{register}.
3107
3108 @item
3109 (C++ only) A base class is not initialized in a derived class' copy
3110 constructor.
3111
3112 @end itemize
3113
3114 @item -Wchar-subscripts
3115 @opindex Wchar-subscripts
3116 @opindex Wno-char-subscripts
3117 Warn if an array subscript has type @code{char}. This is a common cause
3118 of error, as programmers often forget that this type is signed on some
3119 machines.
3120 This warning is enabled by @option{-Wall}.
3121
3122 @item -Wcomment
3123 @opindex Wcomment
3124 @opindex Wno-comment
3125 Warn whenever a comment-start sequence @samp{/*} appears in a @samp{/*}
3126 comment, or whenever a Backslash-Newline appears in a @samp{//} comment.
3127 This warning is enabled by @option{-Wall}.
3128
3129 @item -Wno-cpp
3130 @r{(C, Objective-C, C++, Objective-C++ and Fortran only)}
3131
3132 Suppress warning messages emitted by @code{#warning} directives.
3133
3134 @item -Wdouble-promotion @r{(C, C++, Objective-C and Objective-C++ only)}
3135 @opindex Wdouble-promotion
3136 @opindex Wno-double-promotion
3137 Give a warning when a value of type @code{float} is implicitly
3138 promoted to @code{double}. CPUs with a 32-bit ``single-precision''
3139 floating-point unit implement @code{float} in hardware, but emulate
3140 @code{double} in software. On such a machine, doing computations
3141 using @code{double} values is much more expensive because of the
3142 overhead required for software emulation.
3143
3144 It is easy to accidentally do computations with @code{double} because
3145 floating-point literals are implicitly of type @code{double}. For
3146 example, in:
3147 @smallexample
3148 @group
3149 float area(float radius)
3150 @{
3151 return 3.14159 * radius * radius;
3152 @}
3153 @end group
3154 @end smallexample
3155 the compiler will perform the entire computation with @code{double}
3156 because the floating-point literal is a @code{double}.
3157
3158 @item -Wformat
3159 @opindex Wformat
3160 @opindex Wno-format
3161 @opindex ffreestanding
3162 @opindex fno-builtin
3163 Check calls to @code{printf} and @code{scanf}, etc., to make sure that
3164 the arguments supplied have types appropriate to the format string
3165 specified, and that the conversions specified in the format string make
3166 sense. This includes standard functions, and others specified by format
3167 attributes (@pxref{Function Attributes}), in the @code{printf},
3168 @code{scanf}, @code{strftime} and @code{strfmon} (an X/Open extension,
3169 not in the C standard) families (or other target-specific families).
3170 Which functions are checked without format attributes having been
3171 specified depends on the standard version selected, and such checks of
3172 functions without the attribute specified are disabled by
3173 @option{-ffreestanding} or @option{-fno-builtin}.
3174
3175 The formats are checked against the format features supported by GNU
3176 libc version 2.2. These include all ISO C90 and C99 features, as well
3177 as features from the Single Unix Specification and some BSD and GNU
3178 extensions. Other library implementations may not support all these
3179 features; GCC does not support warning about features that go beyond a
3180 particular library's limitations. However, if @option{-pedantic} is used
3181 with @option{-Wformat}, warnings will be given about format features not
3182 in the selected standard version (but not for @code{strfmon} formats,
3183 since those are not in any version of the C standard). @xref{C Dialect
3184 Options,,Options Controlling C Dialect}.
3185
3186 Since @option{-Wformat} also checks for null format arguments for
3187 several functions, @option{-Wformat} also implies @option{-Wnonnull}.
3188
3189 @option{-Wformat} is included in @option{-Wall}. For more control over some
3190 aspects of format checking, the options @option{-Wformat-y2k},
3191 @option{-Wno-format-extra-args}, @option{-Wno-format-zero-length},
3192 @option{-Wformat-nonliteral}, @option{-Wformat-security}, and
3193 @option{-Wformat=2} are available, but are not included in @option{-Wall}.
3194
3195 @item -Wformat-y2k
3196 @opindex Wformat-y2k
3197 @opindex Wno-format-y2k
3198 If @option{-Wformat} is specified, also warn about @code{strftime}
3199 formats which may yield only a two-digit year.
3200
3201 @item -Wno-format-contains-nul
3202 @opindex Wno-format-contains-nul
3203 @opindex Wformat-contains-nul
3204 If @option{-Wformat} is specified, do not warn about format strings that
3205 contain NUL bytes.
3206
3207 @item -Wno-format-extra-args
3208 @opindex Wno-format-extra-args
3209 @opindex Wformat-extra-args
3210 If @option{-Wformat} is specified, do not warn about excess arguments to a
3211 @code{printf} or @code{scanf} format function. The C standard specifies
3212 that such arguments are ignored.
3213
3214 Where the unused arguments lie between used arguments that are
3215 specified with @samp{$} operand number specifications, normally
3216 warnings are still given, since the implementation could not know what
3217 type to pass to @code{va_arg} to skip the unused arguments. However,
3218 in the case of @code{scanf} formats, this option will suppress the
3219 warning if the unused arguments are all pointers, since the Single
3220 Unix Specification says that such unused arguments are allowed.
3221
3222 @item -Wno-format-zero-length
3223 @opindex Wno-format-zero-length
3224 @opindex Wformat-zero-length
3225 If @option{-Wformat} is specified, do not warn about zero-length formats.
3226 The C standard specifies that zero-length formats are allowed.
3227
3228 @item -Wformat-nonliteral
3229 @opindex Wformat-nonliteral
3230 @opindex Wno-format-nonliteral
3231 If @option{-Wformat} is specified, also warn if the format string is not a
3232 string literal and so cannot be checked, unless the format function
3233 takes its format arguments as a @code{va_list}.
3234
3235 @item -Wformat-security
3236 @opindex Wformat-security
3237 @opindex Wno-format-security
3238 If @option{-Wformat} is specified, also warn about uses of format
3239 functions that represent possible security problems. At present, this
3240 warns about calls to @code{printf} and @code{scanf} functions where the
3241 format string is not a string literal and there are no format arguments,
3242 as in @code{printf (foo);}. This may be a security hole if the format
3243 string came from untrusted input and contains @samp{%n}. (This is
3244 currently a subset of what @option{-Wformat-nonliteral} warns about, but
3245 in future warnings may be added to @option{-Wformat-security} that are not
3246 included in @option{-Wformat-nonliteral}.)
3247
3248 @item -Wformat=2
3249 @opindex Wformat=2
3250 @opindex Wno-format=2
3251 Enable @option{-Wformat} plus format checks not included in
3252 @option{-Wformat}. Currently equivalent to @samp{-Wformat
3253 -Wformat-nonliteral -Wformat-security -Wformat-y2k}.
3254
3255 @item -Wnonnull
3256 @opindex Wnonnull
3257 @opindex Wno-nonnull
3258 Warn about passing a null pointer for arguments marked as
3259 requiring a non-null value by the @code{nonnull} function attribute.
3260
3261 @option{-Wnonnull} is included in @option{-Wall} and @option{-Wformat}. It
3262 can be disabled with the @option{-Wno-nonnull} option.
3263
3264 @item -Winit-self @r{(C, C++, Objective-C and Objective-C++ only)}
3265 @opindex Winit-self
3266 @opindex Wno-init-self
3267 Warn about uninitialized variables which are initialized with themselves.
3268 Note this option can only be used with the @option{-Wuninitialized} option.
3269
3270 For example, GCC will warn about @code{i} being uninitialized in the
3271 following snippet only when @option{-Winit-self} has been specified:
3272 @smallexample
3273 @group
3274 int f()
3275 @{
3276 int i = i;
3277 return i;
3278 @}
3279 @end group
3280 @end smallexample
3281
3282 @item -Wimplicit-int @r{(C and Objective-C only)}
3283 @opindex Wimplicit-int
3284 @opindex Wno-implicit-int
3285 Warn when a declaration does not specify a type.
3286 This warning is enabled by @option{-Wall}.
3287
3288 @item -Wimplicit-function-declaration @r{(C and Objective-C only)}
3289 @opindex Wimplicit-function-declaration
3290 @opindex Wno-implicit-function-declaration
3291 Give a warning whenever a function is used before being declared. In
3292 C99 mode (@option{-std=c99} or @option{-std=gnu99}), this warning is
3293 enabled by default and it is made into an error by
3294 @option{-pedantic-errors}. This warning is also enabled by
3295 @option{-Wall}.
3296
3297 @item -Wimplicit @r{(C and Objective-C only)}
3298 @opindex Wimplicit
3299 @opindex Wno-implicit
3300 Same as @option{-Wimplicit-int} and @option{-Wimplicit-function-declaration}.
3301 This warning is enabled by @option{-Wall}.
3302
3303 @item -Wignored-qualifiers @r{(C and C++ only)}
3304 @opindex Wignored-qualifiers
3305 @opindex Wno-ignored-qualifiers
3306 Warn if the return type of a function has a type qualifier
3307 such as @code{const}. For ISO C such a type qualifier has no effect,
3308 since the value returned by a function is not an lvalue.
3309 For C++, the warning is only emitted for scalar types or @code{void}.
3310 ISO C prohibits qualified @code{void} return types on function
3311 definitions, so such return types always receive a warning
3312 even without this option.
3313
3314 This warning is also enabled by @option{-Wextra}.
3315
3316 @item -Wmain
3317 @opindex Wmain
3318 @opindex Wno-main
3319 Warn if the type of @samp{main} is suspicious. @samp{main} should be
3320 a function with external linkage, returning int, taking either zero
3321 arguments, two, or three arguments of appropriate types. This warning
3322 is enabled by default in C++ and is enabled by either @option{-Wall}
3323 or @option{-pedantic}.
3324
3325 @item -Wmissing-braces
3326 @opindex Wmissing-braces
3327 @opindex Wno-missing-braces
3328 Warn if an aggregate or union initializer is not fully bracketed. In
3329 the following example, the initializer for @samp{a} is not fully
3330 bracketed, but that for @samp{b} is fully bracketed.
3331
3332 @smallexample
3333 int a[2][2] = @{ 0, 1, 2, 3 @};
3334 int b[2][2] = @{ @{ 0, 1 @}, @{ 2, 3 @} @};
3335 @end smallexample
3336
3337 This warning is enabled by @option{-Wall}.
3338
3339 @item -Wmissing-include-dirs @r{(C, C++, Objective-C and Objective-C++ only)}
3340 @opindex Wmissing-include-dirs
3341 @opindex Wno-missing-include-dirs
3342 Warn if a user-supplied include directory does not exist.
3343
3344 @item -Wparentheses
3345 @opindex Wparentheses
3346 @opindex Wno-parentheses
3347 Warn if parentheses are omitted in certain contexts, such
3348 as when there is an assignment in a context where a truth value
3349 is expected, or when operators are nested whose precedence people
3350 often get confused about.
3351
3352 Also warn if a comparison like @samp{x<=y<=z} appears; this is
3353 equivalent to @samp{(x<=y ? 1 : 0) <= z}, which is a different
3354 interpretation from that of ordinary mathematical notation.
3355
3356 Also warn about constructions where there may be confusion to which
3357 @code{if} statement an @code{else} branch belongs. Here is an example of
3358 such a case:
3359
3360 @smallexample
3361 @group
3362 @{
3363 if (a)
3364 if (b)
3365 foo ();
3366 else
3367 bar ();
3368 @}
3369 @end group
3370 @end smallexample
3371
3372 In C/C++, every @code{else} branch belongs to the innermost possible
3373 @code{if} statement, which in this example is @code{if (b)}. This is
3374 often not what the programmer expected, as illustrated in the above
3375 example by indentation the programmer chose. When there is the
3376 potential for this confusion, GCC will issue a warning when this flag
3377 is specified. To eliminate the warning, add explicit braces around
3378 the innermost @code{if} statement so there is no way the @code{else}
3379 could belong to the enclosing @code{if}. The resulting code would
3380 look like this:
3381
3382 @smallexample
3383 @group
3384 @{
3385 if (a)
3386 @{
3387 if (b)
3388 foo ();
3389 else
3390 bar ();
3391 @}
3392 @}
3393 @end group
3394 @end smallexample
3395
3396 Also warn for dangerous uses of the
3397 ?: with omitted middle operand GNU extension. When the condition
3398 in the ?: operator is a boolean expression the omitted value will
3399 be always 1. Often the user expects it to be a value computed
3400 inside the conditional expression instead.
3401
3402 This warning is enabled by @option{-Wall}.
3403
3404 @item -Wsequence-point
3405 @opindex Wsequence-point
3406 @opindex Wno-sequence-point
3407 Warn about code that may have undefined semantics because of violations
3408 of sequence point rules in the C and C++ standards.
3409
3410 The C and C++ standards defines the order in which expressions in a C/C++
3411 program are evaluated in terms of @dfn{sequence points}, which represent
3412 a partial ordering between the execution of parts of the program: those
3413 executed before the sequence point, and those executed after it. These
3414 occur after the evaluation of a full expression (one which is not part
3415 of a larger expression), after the evaluation of the first operand of a
3416 @code{&&}, @code{||}, @code{? :} or @code{,} (comma) operator, before a
3417 function is called (but after the evaluation of its arguments and the
3418 expression denoting the called function), and in certain other places.
3419 Other than as expressed by the sequence point rules, the order of
3420 evaluation of subexpressions of an expression is not specified. All
3421 these rules describe only a partial order rather than a total order,
3422 since, for example, if two functions are called within one expression
3423 with no sequence point between them, the order in which the functions
3424 are called is not specified. However, the standards committee have
3425 ruled that function calls do not overlap.
3426
3427 It is not specified when between sequence points modifications to the
3428 values of objects take effect. Programs whose behavior depends on this
3429 have undefined behavior; the C and C++ standards specify that ``Between
3430 the previous and next sequence point an object shall have its stored
3431 value modified at most once by the evaluation of an expression.
3432 Furthermore, the prior value shall be read only to determine the value
3433 to be stored.''. If a program breaks these rules, the results on any
3434 particular implementation are entirely unpredictable.
3435
3436 Examples of code with undefined behavior are @code{a = a++;}, @code{a[n]
3437 = b[n++]} and @code{a[i++] = i;}. Some more complicated cases are not
3438 diagnosed by this option, and it may give an occasional false positive
3439 result, but in general it has been found fairly effective at detecting
3440 this sort of problem in programs.
3441
3442 The standard is worded confusingly, therefore there is some debate
3443 over the precise meaning of the sequence point rules in subtle cases.
3444 Links to discussions of the problem, including proposed formal
3445 definitions, may be found on the GCC readings page, at
3446 @uref{http://gcc.gnu.org/@/readings.html}.
3447
3448 This warning is enabled by @option{-Wall} for C and C++.
3449
3450 @item -Wreturn-type
3451 @opindex Wreturn-type
3452 @opindex Wno-return-type
3453 Warn whenever a function is defined with a return-type that defaults
3454 to @code{int}. Also warn about any @code{return} statement with no
3455 return-value in a function whose return-type is not @code{void}
3456 (falling off the end of the function body is considered returning
3457 without a value), and about a @code{return} statement with an
3458 expression in a function whose return-type is @code{void}.
3459
3460 For C++, a function without return type always produces a diagnostic
3461 message, even when @option{-Wno-return-type} is specified. The only
3462 exceptions are @samp{main} and functions defined in system headers.
3463
3464 This warning is enabled by @option{-Wall}.
3465
3466 @item -Wswitch
3467 @opindex Wswitch
3468 @opindex Wno-switch
3469 Warn whenever a @code{switch} statement has an index of enumerated type
3470 and lacks a @code{case} for one or more of the named codes of that
3471 enumeration. (The presence of a @code{default} label prevents this
3472 warning.) @code{case} labels outside the enumeration range also
3473 provoke warnings when this option is used (even if there is a
3474 @code{default} label).
3475 This warning is enabled by @option{-Wall}.
3476
3477 @item -Wswitch-default
3478 @opindex Wswitch-default
3479 @opindex Wno-switch-default
3480 Warn whenever a @code{switch} statement does not have a @code{default}
3481 case.
3482
3483 @item -Wswitch-enum
3484 @opindex Wswitch-enum
3485 @opindex Wno-switch-enum
3486 Warn whenever a @code{switch} statement has an index of enumerated type
3487 and lacks a @code{case} for one or more of the named codes of that
3488 enumeration. @code{case} labels outside the enumeration range also
3489 provoke warnings when this option is used. The only difference
3490 between @option{-Wswitch} and this option is that this option gives a
3491 warning about an omitted enumeration code even if there is a
3492 @code{default} label.
3493
3494 @item -Wsync-nand @r{(C and C++ only)}
3495 @opindex Wsync-nand
3496 @opindex Wno-sync-nand
3497 Warn when @code{__sync_fetch_and_nand} and @code{__sync_nand_and_fetch}
3498 built-in functions are used. These functions changed semantics in GCC 4.4.
3499
3500 @item -Wtrigraphs
3501 @opindex Wtrigraphs
3502 @opindex Wno-trigraphs
3503 Warn if any trigraphs are encountered that might change the meaning of
3504 the program (trigraphs within comments are not warned about).
3505 This warning is enabled by @option{-Wall}.
3506
3507 @item -Wunused-but-set-parameter
3508 @opindex Wunused-but-set-parameter
3509 @opindex Wno-unused-but-set-parameter
3510 Warn whenever a function parameter is assigned to, but otherwise unused
3511 (aside from its declaration).
3512
3513 To suppress this warning use the @samp{unused} attribute
3514 (@pxref{Variable Attributes}).
3515
3516 This warning is also enabled by @option{-Wunused} together with
3517 @option{-Wextra}.
3518
3519 @item -Wunused-but-set-variable
3520 @opindex Wunused-but-set-variable
3521 @opindex Wno-unused-but-set-variable
3522 Warn whenever a local variable is assigned to, but otherwise unused
3523 (aside from its declaration).
3524 This warning is enabled by @option{-Wall}.
3525
3526 To suppress this warning use the @samp{unused} attribute
3527 (@pxref{Variable Attributes}).
3528
3529 This warning is also enabled by @option{-Wunused}, which is enabled
3530 by @option{-Wall}.
3531
3532 @item -Wunused-function
3533 @opindex Wunused-function
3534 @opindex Wno-unused-function
3535 Warn whenever a static function is declared but not defined or a
3536 non-inline static function is unused.
3537 This warning is enabled by @option{-Wall}.
3538
3539 @item -Wunused-label
3540 @opindex Wunused-label
3541 @opindex Wno-unused-label
3542 Warn whenever a label is declared but not used.
3543 This warning is enabled by @option{-Wall}.
3544
3545 To suppress this warning use the @samp{unused} attribute
3546 (@pxref{Variable Attributes}).
3547
3548 @item -Wunused-local-typedefs @r{(C, Objective-C, C++ and Objective-C++ only)}
3549 @opindex Wunused-local-typedefs
3550 Warn when a typedef locally defined in a function is not used.
3551
3552 @item -Wunused-parameter
3553 @opindex Wunused-parameter
3554 @opindex Wno-unused-parameter
3555 Warn whenever a function parameter is unused aside from its declaration.
3556
3557 To suppress this warning use the @samp{unused} attribute
3558 (@pxref{Variable Attributes}).
3559
3560 @item -Wno-unused-result
3561 @opindex Wunused-result
3562 @opindex Wno-unused-result
3563 Do not warn if a caller of a function marked with attribute
3564 @code{warn_unused_result} (@pxref{Function Attributes}) does not use
3565 its return value. The default is @option{-Wunused-result}.
3566
3567 @item -Wunused-variable
3568 @opindex Wunused-variable
3569 @opindex Wno-unused-variable
3570 Warn whenever a local variable or non-constant static variable is unused
3571 aside from its declaration.
3572 This warning is enabled by @option{-Wall}.
3573
3574 To suppress this warning use the @samp{unused} attribute
3575 (@pxref{Variable Attributes}).
3576
3577 @item -Wunused-value
3578 @opindex Wunused-value
3579 @opindex Wno-unused-value
3580 Warn whenever a statement computes a result that is explicitly not
3581 used. To suppress this warning cast the unused expression to
3582 @samp{void}. This includes an expression-statement or the left-hand
3583 side of a comma expression that contains no side effects. For example,
3584 an expression such as @samp{x[i,j]} will cause a warning, while
3585 @samp{x[(void)i,j]} will not.
3586
3587 This warning is enabled by @option{-Wall}.
3588
3589 @item -Wunused
3590 @opindex Wunused
3591 @opindex Wno-unused
3592 All the above @option{-Wunused} options combined.
3593
3594 In order to get a warning about an unused function parameter, you must
3595 either specify @samp{-Wextra -Wunused} (note that @samp{-Wall} implies
3596 @samp{-Wunused}), or separately specify @option{-Wunused-parameter}.
3597
3598 @item -Wuninitialized
3599 @opindex Wuninitialized
3600 @opindex Wno-uninitialized
3601 Warn if an automatic variable is used without first being initialized
3602 or if a variable may be clobbered by a @code{setjmp} call. In C++,
3603 warn if a non-static reference or non-static @samp{const} member
3604 appears in a class without constructors.
3605
3606 If you want to warn about code which uses the uninitialized value of the
3607 variable in its own initializer, use the @option{-Winit-self} option.
3608
3609 These warnings occur for individual uninitialized or clobbered
3610 elements of structure, union or array variables as well as for
3611 variables which are uninitialized or clobbered as a whole. They do
3612 not occur for variables or elements declared @code{volatile}. Because
3613 these warnings depend on optimization, the exact variables or elements
3614 for which there are warnings will depend on the precise optimization
3615 options and version of GCC used.
3616
3617 Note that there may be no warning about a variable that is used only
3618 to compute a value that itself is never used, because such
3619 computations may be deleted by data flow analysis before the warnings
3620 are printed.
3621
3622 @item -Wmaybe-uninitialized
3623 @opindex Wmaybe-uninitialized
3624 @opindex Wno-maybe-uninitialized
3625 For an automatic variable, if there exists a path from the function
3626 entry to a use of the variable that is initialized, but there exist
3627 some other paths the variable is not initialized, the compiler will
3628 emit a warning if it can not prove the uninitialized paths do not
3629 happen at runtime. These warnings are made optional because GCC is
3630 not smart enough to see all the reasons why the code might be correct
3631 despite appearing to have an error. Here is one example of how
3632 this can happen:
3633
3634 @smallexample
3635 @group
3636 @{
3637 int x;
3638 switch (y)
3639 @{
3640 case 1: x = 1;
3641 break;
3642 case 2: x = 4;
3643 break;
3644 case 3: x = 5;
3645 @}
3646 foo (x);
3647 @}
3648 @end group
3649 @end smallexample
3650
3651 @noindent
3652 If the value of @code{y} is always 1, 2 or 3, then @code{x} is
3653 always initialized, but GCC doesn't know this. To suppress the
3654 warning, the user needs to provide a default case with assert(0) or
3655 similar code.
3656
3657 @cindex @code{longjmp} warnings
3658 This option also warns when a non-volatile automatic variable might be
3659 changed by a call to @code{longjmp}. These warnings as well are possible
3660 only in optimizing compilation.
3661
3662 The compiler sees only the calls to @code{setjmp}. It cannot know
3663 where @code{longjmp} will be called; in fact, a signal handler could
3664 call it at any point in the code. As a result, you may get a warning
3665 even when there is in fact no problem because @code{longjmp} cannot
3666 in fact be called at the place which would cause a problem.
3667
3668 Some spurious warnings can be avoided if you declare all the functions
3669 you use that never return as @code{noreturn}. @xref{Function
3670 Attributes}.
3671
3672 This warning is enabled by @option{-Wall} or @option{-Wextra}.
3673
3674 @item -Wunknown-pragmas
3675 @opindex Wunknown-pragmas
3676 @opindex Wno-unknown-pragmas
3677 @cindex warning for unknown pragmas
3678 @cindex unknown pragmas, warning
3679 @cindex pragmas, warning of unknown
3680 Warn when a #pragma directive is encountered which is not understood by
3681 GCC@. If this command line option is used, warnings will even be issued
3682 for unknown pragmas in system header files. This is not the case if
3683 the warnings were only enabled by the @option{-Wall} command line option.
3684
3685 @item -Wno-pragmas
3686 @opindex Wno-pragmas
3687 @opindex Wpragmas
3688 Do not warn about misuses of pragmas, such as incorrect parameters,
3689 invalid syntax, or conflicts between pragmas. See also
3690 @samp{-Wunknown-pragmas}.
3691
3692 @item -Wstrict-aliasing
3693 @opindex Wstrict-aliasing
3694 @opindex Wno-strict-aliasing
3695 This option is only active when @option{-fstrict-aliasing} is active.
3696 It warns about code which might break the strict aliasing rules that the
3697 compiler is using for optimization. The warning does not catch all
3698 cases, but does attempt to catch the more common pitfalls. It is
3699 included in @option{-Wall}.
3700 It is equivalent to @option{-Wstrict-aliasing=3}
3701
3702 @item -Wstrict-aliasing=n
3703 @opindex Wstrict-aliasing=n
3704 @opindex Wno-strict-aliasing=n
3705 This option is only active when @option{-fstrict-aliasing} is active.
3706 It warns about code which might break the strict aliasing rules that the
3707 compiler is using for optimization.
3708 Higher levels correspond to higher accuracy (fewer false positives).
3709 Higher levels also correspond to more effort, similar to the way -O works.
3710 @option{-Wstrict-aliasing} is equivalent to @option{-Wstrict-aliasing=n},
3711 with n=3.
3712
3713 Level 1: Most aggressive, quick, least accurate.
3714 Possibly useful when higher levels
3715 do not warn but -fstrict-aliasing still breaks the code, as it has very few
3716 false negatives. However, it has many false positives.
3717 Warns for all pointer conversions between possibly incompatible types,
3718 even if never dereferenced. Runs in the frontend only.
3719
3720 Level 2: Aggressive, quick, not too precise.
3721 May still have many false positives (not as many as level 1 though),
3722 and few false negatives (but possibly more than level 1).
3723 Unlike level 1, it only warns when an address is taken. Warns about
3724 incomplete types. Runs in the frontend only.
3725
3726 Level 3 (default for @option{-Wstrict-aliasing}):
3727 Should have very few false positives and few false
3728 negatives. Slightly slower than levels 1 or 2 when optimization is enabled.
3729 Takes care of the common pun+dereference pattern in the frontend:
3730 @code{*(int*)&some_float}.
3731 If optimization is enabled, it also runs in the backend, where it deals
3732 with multiple statement cases using flow-sensitive points-to information.
3733 Only warns when the converted pointer is dereferenced.
3734 Does not warn about incomplete types.
3735
3736 @item -Wstrict-overflow
3737 @itemx -Wstrict-overflow=@var{n}
3738 @opindex Wstrict-overflow
3739 @opindex Wno-strict-overflow
3740 This option is only active when @option{-fstrict-overflow} is active.
3741 It warns about cases where the compiler optimizes based on the
3742 assumption that signed overflow does not occur. Note that it does not
3743 warn about all cases where the code might overflow: it only warns
3744 about cases where the compiler implements some optimization. Thus
3745 this warning depends on the optimization level.
3746
3747 An optimization which assumes that signed overflow does not occur is
3748 perfectly safe if the values of the variables involved are such that
3749 overflow never does, in fact, occur. Therefore this warning can
3750 easily give a false positive: a warning about code which is not
3751 actually a problem. To help focus on important issues, several
3752 warning levels are defined. No warnings are issued for the use of
3753 undefined signed overflow when estimating how many iterations a loop
3754 will require, in particular when determining whether a loop will be
3755 executed at all.
3756
3757 @table @gcctabopt
3758 @item -Wstrict-overflow=1
3759 Warn about cases which are both questionable and easy to avoid. For
3760 example: @code{x + 1 > x}; with @option{-fstrict-overflow}, the
3761 compiler will simplify this to @code{1}. This level of
3762 @option{-Wstrict-overflow} is enabled by @option{-Wall}; higher levels
3763 are not, and must be explicitly requested.
3764
3765 @item -Wstrict-overflow=2
3766 Also warn about other cases where a comparison is simplified to a
3767 constant. For example: @code{abs (x) >= 0}. This can only be
3768 simplified when @option{-fstrict-overflow} is in effect, because
3769 @code{abs (INT_MIN)} overflows to @code{INT_MIN}, which is less than
3770 zero. @option{-Wstrict-overflow} (with no level) is the same as
3771 @option{-Wstrict-overflow=2}.
3772
3773 @item -Wstrict-overflow=3
3774 Also warn about other cases where a comparison is simplified. For
3775 example: @code{x + 1 > 1} will be simplified to @code{x > 0}.
3776
3777 @item -Wstrict-overflow=4
3778 Also warn about other simplifications not covered by the above cases.
3779 For example: @code{(x * 10) / 5} will be simplified to @code{x * 2}.
3780
3781 @item -Wstrict-overflow=5
3782 Also warn about cases where the compiler reduces the magnitude of a
3783 constant involved in a comparison. For example: @code{x + 2 > y} will
3784 be simplified to @code{x + 1 >= y}. This is reported only at the
3785 highest warning level because this simplification applies to many
3786 comparisons, so this warning level will give a very large number of
3787 false positives.
3788 @end table
3789
3790 @item -Wsuggest-attribute=@r{[}pure@r{|}const@r{|}noreturn@r{]}
3791 @opindex Wsuggest-attribute=
3792 @opindex Wno-suggest-attribute=
3793 Warn for cases where adding an attribute may be beneficial. The
3794 attributes currently supported are listed below.
3795
3796 @table @gcctabopt
3797 @item -Wsuggest-attribute=pure
3798 @itemx -Wsuggest-attribute=const
3799 @itemx -Wsuggest-attribute=noreturn
3800 @opindex Wsuggest-attribute=pure
3801 @opindex Wno-suggest-attribute=pure
3802 @opindex Wsuggest-attribute=const
3803 @opindex Wno-suggest-attribute=const
3804 @opindex Wsuggest-attribute=noreturn
3805 @opindex Wno-suggest-attribute=noreturn
3806
3807 Warn about functions which might be candidates for attributes
3808 @code{pure}, @code{const} or @code{noreturn}. The compiler only warns for
3809 functions visible in other compilation units or (in the case of @code{pure} and
3810 @code{const}) if it cannot prove that the function returns normally. A function
3811 returns normally if it doesn't contain an infinite loop nor returns abnormally
3812 by throwing, calling @code{abort()} or trapping. This analysis requires option
3813 @option{-fipa-pure-const}, which is enabled by default at @option{-O} and
3814 higher. Higher optimization levels improve the accuracy of the analysis.
3815 @end table
3816
3817 @item -Warray-bounds
3818 @opindex Wno-array-bounds
3819 @opindex Warray-bounds
3820 This option is only active when @option{-ftree-vrp} is active
3821 (default for @option{-O2} and above). It warns about subscripts to arrays
3822 that are always out of bounds. This warning is enabled by @option{-Wall}.
3823
3824 @item -Wno-div-by-zero
3825 @opindex Wno-div-by-zero
3826 @opindex Wdiv-by-zero
3827 Do not warn about compile-time integer division by zero. Floating point
3828 division by zero is not warned about, as it can be a legitimate way of
3829 obtaining infinities and NaNs.
3830
3831 @item -Wsystem-headers
3832 @opindex Wsystem-headers
3833 @opindex Wno-system-headers
3834 @cindex warnings from system headers
3835 @cindex system headers, warnings from
3836 Print warning messages for constructs found in system header files.
3837 Warnings from system headers are normally suppressed, on the assumption
3838 that they usually do not indicate real problems and would only make the
3839 compiler output harder to read. Using this command line option tells
3840 GCC to emit warnings from system headers as if they occurred in user
3841 code. However, note that using @option{-Wall} in conjunction with this
3842 option will @emph{not} warn about unknown pragmas in system
3843 headers---for that, @option{-Wunknown-pragmas} must also be used.
3844
3845 @item -Wtrampolines
3846 @opindex Wtrampolines
3847 @opindex Wno-trampolines
3848 Warn about trampolines generated for pointers to nested functions.
3849
3850 A trampoline is a small piece of data or code that is created at run
3851 time on the stack when the address of a nested function is taken, and
3852 is used to call the nested function indirectly. For some targets, it
3853 is made up of data only and thus requires no special treatment. But,
3854 for most targets, it is made up of code and thus requires the stack
3855 to be made executable in order for the program to work properly.
3856
3857 @item -Wfloat-equal
3858 @opindex Wfloat-equal
3859 @opindex Wno-float-equal
3860 Warn if floating point values are used in equality comparisons.
3861
3862 The idea behind this is that sometimes it is convenient (for the
3863 programmer) to consider floating-point values as approximations to
3864 infinitely precise real numbers. If you are doing this, then you need
3865 to compute (by analyzing the code, or in some other way) the maximum or
3866 likely maximum error that the computation introduces, and allow for it
3867 when performing comparisons (and when producing output, but that's a
3868 different problem). In particular, instead of testing for equality, you
3869 would check to see whether the two values have ranges that overlap; and
3870 this is done with the relational operators, so equality comparisons are
3871 probably mistaken.
3872
3873 @item -Wtraditional @r{(C and Objective-C only)}
3874 @opindex Wtraditional
3875 @opindex Wno-traditional
3876 Warn about certain constructs that behave differently in traditional and
3877 ISO C@. Also warn about ISO C constructs that have no traditional C
3878 equivalent, and/or problematic constructs which should be avoided.
3879
3880 @itemize @bullet
3881 @item
3882 Macro parameters that appear within string literals in the macro body.
3883 In traditional C macro replacement takes place within string literals,
3884 but does not in ISO C@.
3885
3886 @item
3887 In traditional C, some preprocessor directives did not exist.
3888 Traditional preprocessors would only consider a line to be a directive
3889 if the @samp{#} appeared in column 1 on the line. Therefore
3890 @option{-Wtraditional} warns about directives that traditional C
3891 understands but would ignore because the @samp{#} does not appear as the
3892 first character on the line. It also suggests you hide directives like
3893 @samp{#pragma} not understood by traditional C by indenting them. Some
3894 traditional implementations would not recognize @samp{#elif}, so it
3895 suggests avoiding it altogether.
3896
3897 @item
3898 A function-like macro that appears without arguments.
3899
3900 @item
3901 The unary plus operator.
3902
3903 @item
3904 The @samp{U} integer constant suffix, or the @samp{F} or @samp{L} floating point
3905 constant suffixes. (Traditional C does support the @samp{L} suffix on integer
3906 constants.) Note, these suffixes appear in macros defined in the system
3907 headers of most modern systems, e.g.@: the @samp{_MIN}/@samp{_MAX} macros in @code{<limits.h>}.
3908 Use of these macros in user code might normally lead to spurious
3909 warnings, however GCC's integrated preprocessor has enough context to
3910 avoid warning in these cases.
3911
3912 @item
3913 A function declared external in one block and then used after the end of
3914 the block.
3915
3916 @item
3917 A @code{switch} statement has an operand of type @code{long}.
3918
3919 @item
3920 A non-@code{static} function declaration follows a @code{static} one.
3921 This construct is not accepted by some traditional C compilers.
3922
3923 @item
3924 The ISO type of an integer constant has a different width or
3925 signedness from its traditional type. This warning is only issued if
3926 the base of the constant is ten. I.e.@: hexadecimal or octal values, which
3927 typically represent bit patterns, are not warned about.
3928
3929 @item
3930 Usage of ISO string concatenation is detected.
3931
3932 @item
3933 Initialization of automatic aggregates.
3934
3935 @item
3936 Identifier conflicts with labels. Traditional C lacks a separate
3937 namespace for labels.
3938
3939 @item
3940 Initialization of unions. If the initializer is zero, the warning is
3941 omitted. This is done under the assumption that the zero initializer in
3942 user code appears conditioned on e.g.@: @code{__STDC__} to avoid missing
3943 initializer warnings and relies on default initialization to zero in the
3944 traditional C case.
3945
3946 @item
3947 Conversions by prototypes between fixed/floating point values and vice
3948 versa. The absence of these prototypes when compiling with traditional
3949 C would cause serious problems. This is a subset of the possible
3950 conversion warnings, for the full set use @option{-Wtraditional-conversion}.
3951
3952 @item
3953 Use of ISO C style function definitions. This warning intentionally is
3954 @emph{not} issued for prototype declarations or variadic functions
3955 because these ISO C features will appear in your code when using
3956 libiberty's traditional C compatibility macros, @code{PARAMS} and
3957 @code{VPARAMS}. This warning is also bypassed for nested functions
3958 because that feature is already a GCC extension and thus not relevant to
3959 traditional C compatibility.
3960 @end itemize
3961
3962 @item -Wtraditional-conversion @r{(C and Objective-C only)}
3963 @opindex Wtraditional-conversion
3964 @opindex Wno-traditional-conversion
3965 Warn if a prototype causes a type conversion that is different from what
3966 would happen to the same argument in the absence of a prototype. This
3967 includes conversions of fixed point to floating and vice versa, and
3968 conversions changing the width or signedness of a fixed point argument
3969 except when the same as the default promotion.
3970
3971 @item -Wdeclaration-after-statement @r{(C and Objective-C only)}
3972 @opindex Wdeclaration-after-statement
3973 @opindex Wno-declaration-after-statement
3974 Warn when a declaration is found after a statement in a block. This
3975 construct, known from C++, was introduced with ISO C99 and is by default
3976 allowed in GCC@. It is not supported by ISO C90 and was not supported by
3977 GCC versions before GCC 3.0. @xref{Mixed Declarations}.
3978
3979 @item -Wundef
3980 @opindex Wundef
3981 @opindex Wno-undef
3982 Warn if an undefined identifier is evaluated in an @samp{#if} directive.
3983
3984 @item -Wno-endif-labels
3985 @opindex Wno-endif-labels
3986 @opindex Wendif-labels
3987 Do not warn whenever an @samp{#else} or an @samp{#endif} are followed by text.
3988
3989 @item -Wshadow
3990 @opindex Wshadow
3991 @opindex Wno-shadow
3992 Warn whenever a local variable or type declaration shadows another variable,
3993 parameter, type, or class member (in C++), or whenever a built-in function
3994 is shadowed. Note that in C++, the compiler will not warn if a local variable
3995 shadows a struct/class/enum, but will warn if it shadows an explicit typedef.
3996
3997 @item -Wlarger-than=@var{len}
3998 @opindex Wlarger-than=@var{len}
3999 @opindex Wlarger-than-@var{len}
4000 Warn whenever an object of larger than @var{len} bytes is defined.
4001
4002 @item -Wframe-larger-than=@var{len}
4003 @opindex Wframe-larger-than
4004 Warn if the size of a function frame is larger than @var{len} bytes.
4005 The computation done to determine the stack frame size is approximate
4006 and not conservative.
4007 The actual requirements may be somewhat greater than @var{len}
4008 even if you do not get a warning. In addition, any space allocated
4009 via @code{alloca}, variable-length arrays, or related constructs
4010 is not included by the compiler when determining
4011 whether or not to issue a warning.
4012
4013 @item -Wno-free-nonheap-object
4014 @opindex Wno-free-nonheap-object
4015 @opindex Wfree-nonheap-object
4016 Do not warn when attempting to free an object which was not allocated
4017 on the heap.
4018
4019 @item -Wstack-usage=@var{len}
4020 @opindex Wstack-usage
4021 Warn if the stack usage of a function might be larger than @var{len} bytes.
4022 The computation done to determine the stack usage is conservative.
4023 Any space allocated via @code{alloca}, variable-length arrays, or related
4024 constructs is included by the compiler when determining whether or not to
4025 issue a warning.
4026
4027 The message is in keeping with the output of @option{-fstack-usage}.
4028
4029 @itemize
4030 @item
4031 If the stack usage is fully static but exceeds the specified amount, it's:
4032
4033 @smallexample
4034 warning: stack usage is 1120 bytes
4035 @end smallexample
4036 @item
4037 If the stack usage is (partly) dynamic but bounded, it's:
4038
4039 @smallexample
4040 warning: stack usage might be 1648 bytes
4041 @end smallexample
4042 @item
4043 If the stack usage is (partly) dynamic and not bounded, it's:
4044
4045 @smallexample
4046 warning: stack usage might be unbounded
4047 @end smallexample
4048 @end itemize
4049
4050 @item -Wunsafe-loop-optimizations
4051 @opindex Wunsafe-loop-optimizations
4052 @opindex Wno-unsafe-loop-optimizations
4053 Warn if the loop cannot be optimized because the compiler could not
4054 assume anything on the bounds of the loop indices. With
4055 @option{-funsafe-loop-optimizations} warn if the compiler made
4056 such assumptions.
4057
4058 @item -Wno-pedantic-ms-format @r{(MinGW targets only)}
4059 @opindex Wno-pedantic-ms-format
4060 @opindex Wpedantic-ms-format
4061 Disables the warnings about non-ISO @code{printf} / @code{scanf} format
4062 width specifiers @code{I32}, @code{I64}, and @code{I} used on Windows targets
4063 depending on the MS runtime, when you are using the options @option{-Wformat}
4064 and @option{-pedantic} without gnu-extensions.
4065
4066 @item -Wpointer-arith
4067 @opindex Wpointer-arith
4068 @opindex Wno-pointer-arith
4069 Warn about anything that depends on the ``size of'' a function type or
4070 of @code{void}. GNU C assigns these types a size of 1, for
4071 convenience in calculations with @code{void *} pointers and pointers
4072 to functions. In C++, warn also when an arithmetic operation involves
4073 @code{NULL}. This warning is also enabled by @option{-pedantic}.
4074
4075 @item -Wtype-limits
4076 @opindex Wtype-limits
4077 @opindex Wno-type-limits
4078 Warn if a comparison is always true or always false due to the limited
4079 range of the data type, but do not warn for constant expressions. For
4080 example, warn if an unsigned variable is compared against zero with
4081 @samp{<} or @samp{>=}. This warning is also enabled by
4082 @option{-Wextra}.
4083
4084 @item -Wbad-function-cast @r{(C and Objective-C only)}
4085 @opindex Wbad-function-cast
4086 @opindex Wno-bad-function-cast
4087 Warn whenever a function call is cast to a non-matching type.
4088 For example, warn if @code{int malloc()} is cast to @code{anything *}.
4089
4090 @item -Wc++-compat @r{(C and Objective-C only)}
4091 Warn about ISO C constructs that are outside of the common subset of
4092 ISO C and ISO C++, e.g.@: request for implicit conversion from
4093 @code{void *} to a pointer to non-@code{void} type.
4094
4095 @item -Wc++11-compat @r{(C++ and Objective-C++ only)}
4096 Warn about C++ constructs whose meaning differs between ISO C++ 1998
4097 and ISO C++ 2011, e.g., identifiers in ISO C++ 1998 that are keywords
4098 in ISO C++ 2011. This warning turns on @option{-Wnarrowing} and is
4099 enabled by @option{-Wall}.
4100
4101 @item -Wcast-qual
4102 @opindex Wcast-qual
4103 @opindex Wno-cast-qual
4104 Warn whenever a pointer is cast so as to remove a type qualifier from
4105 the target type. For example, warn if a @code{const char *} is cast
4106 to an ordinary @code{char *}.
4107
4108 Also warn when making a cast which introduces a type qualifier in an
4109 unsafe way. For example, casting @code{char **} to @code{const char **}
4110 is unsafe, as in this example:
4111
4112 @smallexample
4113 /* p is char ** value. */
4114 const char **q = (const char **) p;
4115 /* Assignment of readonly string to const char * is OK. */
4116 *q = "string";
4117 /* Now char** pointer points to read-only memory. */
4118 **p = 'b';
4119 @end smallexample
4120
4121 @item -Wcast-align
4122 @opindex Wcast-align
4123 @opindex Wno-cast-align
4124 Warn whenever a pointer is cast such that the required alignment of the
4125 target is increased. For example, warn if a @code{char *} is cast to
4126 an @code{int *} on machines where integers can only be accessed at
4127 two- or four-byte boundaries.
4128
4129 @item -Wwrite-strings
4130 @opindex Wwrite-strings
4131 @opindex Wno-write-strings
4132 When compiling C, give string constants the type @code{const
4133 char[@var{length}]} so that copying the address of one into a
4134 non-@code{const} @code{char *} pointer will get a warning. These
4135 warnings will help you find at compile time code that can try to write
4136 into a string constant, but only if you have been very careful about
4137 using @code{const} in declarations and prototypes. Otherwise, it will
4138 just be a nuisance. This is why we did not make @option{-Wall} request
4139 these warnings.
4140
4141 When compiling C++, warn about the deprecated conversion from string
4142 literals to @code{char *}. This warning is enabled by default for C++
4143 programs.
4144
4145 @item -Wclobbered
4146 @opindex Wclobbered
4147 @opindex Wno-clobbered
4148 Warn for variables that might be changed by @samp{longjmp} or
4149 @samp{vfork}. This warning is also enabled by @option{-Wextra}.
4150
4151 @item -Wconversion
4152 @opindex Wconversion
4153 @opindex Wno-conversion
4154 Warn for implicit conversions that may alter a value. This includes
4155 conversions between real and integer, like @code{abs (x)} when
4156 @code{x} is @code{double}; conversions between signed and unsigned,
4157 like @code{unsigned ui = -1}; and conversions to smaller types, like
4158 @code{sqrtf (M_PI)}. Do not warn for explicit casts like @code{abs
4159 ((int) x)} and @code{ui = (unsigned) -1}, or if the value is not
4160 changed by the conversion like in @code{abs (2.0)}. Warnings about
4161 conversions between signed and unsigned integers can be disabled by
4162 using @option{-Wno-sign-conversion}.
4163
4164 For C++, also warn for confusing overload resolution for user-defined
4165 conversions; and conversions that will never use a type conversion
4166 operator: conversions to @code{void}, the same type, a base class or a
4167 reference to them. Warnings about conversions between signed and
4168 unsigned integers are disabled by default in C++ unless
4169 @option{-Wsign-conversion} is explicitly enabled.
4170
4171 @item -Wno-conversion-null @r{(C++ and Objective-C++ only)}
4172 @opindex Wconversion-null
4173 @opindex Wno-conversion-null
4174 Do not warn for conversions between @code{NULL} and non-pointer
4175 types. @option{-Wconversion-null} is enabled by default.
4176
4177 @item -Wzero-as-null-pointer-constant @r{(C++ and Objective-C++ only)}
4178 @opindex Wzero-as-null-pointer-constant
4179 @opindex Wno-zero-as-null-pointer-constant
4180 Warn when a literal '0' is used as null pointer constant. This can
4181 be useful to facilitate the conversion to @code{nullptr} in C++11.
4182
4183 @item -Wempty-body
4184 @opindex Wempty-body
4185 @opindex Wno-empty-body
4186 Warn if an empty body occurs in an @samp{if}, @samp{else} or @samp{do
4187 while} statement. This warning is also enabled by @option{-Wextra}.
4188
4189 @item -Wenum-compare
4190 @opindex Wenum-compare
4191 @opindex Wno-enum-compare
4192 Warn about a comparison between values of different enum types. In C++
4193 this warning is enabled by default. In C this warning is enabled by
4194 @option{-Wall}.
4195
4196 @item -Wjump-misses-init @r{(C, Objective-C only)}
4197 @opindex Wjump-misses-init
4198 @opindex Wno-jump-misses-init
4199 Warn if a @code{goto} statement or a @code{switch} statement jumps
4200 forward across the initialization of a variable, or jumps backward to a
4201 label after the variable has been initialized. This only warns about
4202 variables which are initialized when they are declared. This warning is
4203 only supported for C and Objective C; in C++ this sort of branch is an
4204 error in any case.
4205
4206 @option{-Wjump-misses-init} is included in @option{-Wc++-compat}. It
4207 can be disabled with the @option{-Wno-jump-misses-init} option.
4208
4209 @item -Wsign-compare
4210 @opindex Wsign-compare
4211 @opindex Wno-sign-compare
4212 @cindex warning for comparison of signed and unsigned values
4213 @cindex comparison of signed and unsigned values, warning
4214 @cindex signed and unsigned values, comparison warning
4215 Warn when a comparison between signed and unsigned values could produce
4216 an incorrect result when the signed value is converted to unsigned.
4217 This warning is also enabled by @option{-Wextra}; to get the other warnings
4218 of @option{-Wextra} without this warning, use @samp{-Wextra -Wno-sign-compare}.
4219
4220 @item -Wsign-conversion
4221 @opindex Wsign-conversion
4222 @opindex Wno-sign-conversion
4223 Warn for implicit conversions that may change the sign of an integer
4224 value, like assigning a signed integer expression to an unsigned
4225 integer variable. An explicit cast silences the warning. In C, this
4226 option is enabled also by @option{-Wconversion}.
4227
4228 @item -Waddress
4229 @opindex Waddress
4230 @opindex Wno-address
4231 Warn about suspicious uses of memory addresses. These include using
4232 the address of a function in a conditional expression, such as
4233 @code{void func(void); if (func)}, and comparisons against the memory
4234 address of a string literal, such as @code{if (x == "abc")}. Such
4235 uses typically indicate a programmer error: the address of a function
4236 always evaluates to true, so their use in a conditional usually
4237 indicate that the programmer forgot the parentheses in a function
4238 call; and comparisons against string literals result in unspecified
4239 behavior and are not portable in C, so they usually indicate that the
4240 programmer intended to use @code{strcmp}. This warning is enabled by
4241 @option{-Wall}.
4242
4243 @item -Wlogical-op
4244 @opindex Wlogical-op
4245 @opindex Wno-logical-op
4246 Warn about suspicious uses of logical operators in expressions.
4247 This includes using logical operators in contexts where a
4248 bit-wise operator is likely to be expected.
4249
4250 @item -Waggregate-return
4251 @opindex Waggregate-return
4252 @opindex Wno-aggregate-return
4253 Warn if any functions that return structures or unions are defined or
4254 called. (In languages where you can return an array, this also elicits
4255 a warning.)
4256
4257 @item -Wno-attributes
4258 @opindex Wno-attributes
4259 @opindex Wattributes
4260 Do not warn if an unexpected @code{__attribute__} is used, such as
4261 unrecognized attributes, function attributes applied to variables,
4262 etc. This will not stop errors for incorrect use of supported
4263 attributes.
4264
4265 @item -Wno-builtin-macro-redefined
4266 @opindex Wno-builtin-macro-redefined
4267 @opindex Wbuiltin-macro-redefined
4268 Do not warn if certain built-in macros are redefined. This suppresses
4269 warnings for redefinition of @code{__TIMESTAMP__}, @code{__TIME__},
4270 @code{__DATE__}, @code{__FILE__}, and @code{__BASE_FILE__}.
4271
4272 @item -Wstrict-prototypes @r{(C and Objective-C only)}
4273 @opindex Wstrict-prototypes
4274 @opindex Wno-strict-prototypes
4275 Warn if a function is declared or defined without specifying the
4276 argument types. (An old-style function definition is permitted without
4277 a warning if preceded by a declaration which specifies the argument
4278 types.)
4279
4280 @item -Wold-style-declaration @r{(C and Objective-C only)}
4281 @opindex Wold-style-declaration
4282 @opindex Wno-old-style-declaration
4283 Warn for obsolescent usages, according to the C Standard, in a
4284 declaration. For example, warn if storage-class specifiers like
4285 @code{static} are not the first things in a declaration. This warning
4286 is also enabled by @option{-Wextra}.
4287
4288 @item -Wold-style-definition @r{(C and Objective-C only)}
4289 @opindex Wold-style-definition
4290 @opindex Wno-old-style-definition
4291 Warn if an old-style function definition is used. A warning is given
4292 even if there is a previous prototype.
4293
4294 @item -Wmissing-parameter-type @r{(C and Objective-C only)}
4295 @opindex Wmissing-parameter-type
4296 @opindex Wno-missing-parameter-type
4297 A function parameter is declared without a type specifier in K&R-style
4298 functions:
4299
4300 @smallexample
4301 void foo(bar) @{ @}
4302 @end smallexample
4303
4304 This warning is also enabled by @option{-Wextra}.
4305
4306 @item -Wmissing-prototypes @r{(C and Objective-C only)}
4307 @opindex Wmissing-prototypes
4308 @opindex Wno-missing-prototypes
4309 Warn if a global function is defined without a previous prototype
4310 declaration. This warning is issued even if the definition itself
4311 provides a prototype. The aim is to detect global functions that fail
4312 to be declared in header files.
4313
4314 @item -Wmissing-declarations
4315 @opindex Wmissing-declarations
4316 @opindex Wno-missing-declarations
4317 Warn if a global function is defined without a previous declaration.
4318 Do so even if the definition itself provides a prototype.
4319 Use this option to detect global functions that are not declared in
4320 header files. In C++, no warnings are issued for function templates,
4321 or for inline functions, or for functions in anonymous namespaces.
4322
4323 @item -Wmissing-field-initializers
4324 @opindex Wmissing-field-initializers
4325 @opindex Wno-missing-field-initializers
4326 @opindex W
4327 @opindex Wextra
4328 @opindex Wno-extra
4329 Warn if a structure's initializer has some fields missing. For
4330 example, the following code would cause such a warning, because
4331 @code{x.h} is implicitly zero:
4332
4333 @smallexample
4334 struct s @{ int f, g, h; @};
4335 struct s x = @{ 3, 4 @};
4336 @end smallexample
4337
4338 This option does not warn about designated initializers, so the following
4339 modification would not trigger a warning:
4340
4341 @smallexample
4342 struct s @{ int f, g, h; @};
4343 struct s x = @{ .f = 3, .g = 4 @};
4344 @end smallexample
4345
4346 This warning is included in @option{-Wextra}. To get other @option{-Wextra}
4347 warnings without this one, use @samp{-Wextra -Wno-missing-field-initializers}.
4348
4349 @item -Wmissing-format-attribute
4350 @opindex Wmissing-format-attribute
4351 @opindex Wno-missing-format-attribute
4352 @opindex Wformat
4353 @opindex Wno-format
4354 Warn about function pointers which might be candidates for @code{format}
4355 attributes. Note these are only possible candidates, not absolute ones.
4356 GCC will guess that function pointers with @code{format} attributes that
4357 are used in assignment, initialization, parameter passing or return
4358 statements should have a corresponding @code{format} attribute in the
4359 resulting type. I.e.@: the left-hand side of the assignment or
4360 initialization, the type of the parameter variable, or the return type
4361 of the containing function respectively should also have a @code{format}
4362 attribute to avoid the warning.
4363
4364 GCC will also warn about function definitions which might be
4365 candidates for @code{format} attributes. Again, these are only
4366 possible candidates. GCC will guess that @code{format} attributes
4367 might be appropriate for any function that calls a function like
4368 @code{vprintf} or @code{vscanf}, but this might not always be the
4369 case, and some functions for which @code{format} attributes are
4370 appropriate may not be detected.
4371
4372 @item -Wno-multichar
4373 @opindex Wno-multichar
4374 @opindex Wmultichar
4375 Do not warn if a multicharacter constant (@samp{'FOOF'}) is used.
4376 Usually they indicate a typo in the user's code, as they have
4377 implementation-defined values, and should not be used in portable code.
4378
4379 @item -Wnormalized=<none|id|nfc|nfkc>
4380 @opindex Wnormalized=
4381 @cindex NFC
4382 @cindex NFKC
4383 @cindex character set, input normalization
4384 In ISO C and ISO C++, two identifiers are different if they are
4385 different sequences of characters. However, sometimes when characters
4386 outside the basic ASCII character set are used, you can have two
4387 different character sequences that look the same. To avoid confusion,
4388 the ISO 10646 standard sets out some @dfn{normalization rules} which
4389 when applied ensure that two sequences that look the same are turned into
4390 the same sequence. GCC can warn you if you are using identifiers which
4391 have not been normalized; this option controls that warning.
4392
4393 There are four levels of warning that GCC supports. The default is
4394 @option{-Wnormalized=nfc}, which warns about any identifier which is
4395 not in the ISO 10646 ``C'' normalized form, @dfn{NFC}. NFC is the
4396 recommended form for most uses.
4397
4398 Unfortunately, there are some characters which ISO C and ISO C++ allow
4399 in identifiers that when turned into NFC aren't allowable as
4400 identifiers. That is, there's no way to use these symbols in portable
4401 ISO C or C++ and have all your identifiers in NFC@.
4402 @option{-Wnormalized=id} suppresses the warning for these characters.
4403 It is hoped that future versions of the standards involved will correct
4404 this, which is why this option is not the default.
4405
4406 You can switch the warning off for all characters by writing
4407 @option{-Wnormalized=none}. You would only want to do this if you
4408 were using some other normalization scheme (like ``D''), because
4409 otherwise you can easily create bugs that are literally impossible to see.
4410
4411 Some characters in ISO 10646 have distinct meanings but look identical
4412 in some fonts or display methodologies, especially once formatting has
4413 been applied. For instance @code{\u207F}, ``SUPERSCRIPT LATIN SMALL
4414 LETTER N'', will display just like a regular @code{n} which has been
4415 placed in a superscript. ISO 10646 defines the @dfn{NFKC}
4416 normalization scheme to convert all these into a standard form as
4417 well, and GCC will warn if your code is not in NFKC if you use
4418 @option{-Wnormalized=nfkc}. This warning is comparable to warning
4419 about every identifier that contains the letter O because it might be
4420 confused with the digit 0, and so is not the default, but may be
4421 useful as a local coding convention if the programming environment is
4422 unable to be fixed to display these characters distinctly.
4423
4424 @item -Wno-deprecated
4425 @opindex Wno-deprecated
4426 @opindex Wdeprecated
4427 Do not warn about usage of deprecated features. @xref{Deprecated Features}.
4428
4429 @item -Wno-deprecated-declarations
4430 @opindex Wno-deprecated-declarations
4431 @opindex Wdeprecated-declarations
4432 Do not warn about uses of functions (@pxref{Function Attributes}),
4433 variables (@pxref{Variable Attributes}), and types (@pxref{Type
4434 Attributes}) marked as deprecated by using the @code{deprecated}
4435 attribute.
4436
4437 @item -Wno-overflow
4438 @opindex Wno-overflow
4439 @opindex Woverflow
4440 Do not warn about compile-time overflow in constant expressions.
4441
4442 @item -Woverride-init @r{(C and Objective-C only)}
4443 @opindex Woverride-init
4444 @opindex Wno-override-init
4445 @opindex W
4446 @opindex Wextra
4447 @opindex Wno-extra
4448 Warn if an initialized field without side effects is overridden when
4449 using designated initializers (@pxref{Designated Inits, , Designated
4450 Initializers}).
4451
4452 This warning is included in @option{-Wextra}. To get other
4453 @option{-Wextra} warnings without this one, use @samp{-Wextra
4454 -Wno-override-init}.
4455
4456 @item -Wpacked
4457 @opindex Wpacked
4458 @opindex Wno-packed
4459 Warn if a structure is given the packed attribute, but the packed
4460 attribute has no effect on the layout or size of the structure.
4461 Such structures may be mis-aligned for little benefit. For
4462 instance, in this code, the variable @code{f.x} in @code{struct bar}
4463 will be misaligned even though @code{struct bar} does not itself
4464 have the packed attribute:
4465
4466 @smallexample
4467 @group
4468 struct foo @{
4469 int x;
4470 char a, b, c, d;
4471 @} __attribute__((packed));
4472 struct bar @{
4473 char z;
4474 struct foo f;
4475 @};
4476 @end group
4477 @end smallexample
4478
4479 @item -Wpacked-bitfield-compat
4480 @opindex Wpacked-bitfield-compat
4481 @opindex Wno-packed-bitfield-compat
4482 The 4.1, 4.2 and 4.3 series of GCC ignore the @code{packed} attribute
4483 on bit-fields of type @code{char}. This has been fixed in GCC 4.4 but
4484 the change can lead to differences in the structure layout. GCC
4485 informs you when the offset of such a field has changed in GCC 4.4.
4486 For example there is no longer a 4-bit padding between field @code{a}
4487 and @code{b} in this structure:
4488
4489 @smallexample
4490 struct foo
4491 @{
4492 char a:4;
4493 char b:8;
4494 @} __attribute__ ((packed));
4495 @end smallexample
4496
4497 This warning is enabled by default. Use
4498 @option{-Wno-packed-bitfield-compat} to disable this warning.
4499
4500 @item -Wpadded
4501 @opindex Wpadded
4502 @opindex Wno-padded
4503 Warn if padding is included in a structure, either to align an element
4504 of the structure or to align the whole structure. Sometimes when this
4505 happens it is possible to rearrange the fields of the structure to
4506 reduce the padding and so make the structure smaller.
4507
4508 @item -Wredundant-decls
4509 @opindex Wredundant-decls
4510 @opindex Wno-redundant-decls
4511 Warn if anything is declared more than once in the same scope, even in
4512 cases where multiple declaration is valid and changes nothing.
4513
4514 @item -Wnested-externs @r{(C and Objective-C only)}
4515 @opindex Wnested-externs
4516 @opindex Wno-nested-externs
4517 Warn if an @code{extern} declaration is encountered within a function.
4518
4519 @item -Winline
4520 @opindex Winline
4521 @opindex Wno-inline
4522 Warn if a function can not be inlined and it was declared as inline.
4523 Even with this option, the compiler will not warn about failures to
4524 inline functions declared in system headers.
4525
4526 The compiler uses a variety of heuristics to determine whether or not
4527 to inline a function. For example, the compiler takes into account
4528 the size of the function being inlined and the amount of inlining
4529 that has already been done in the current function. Therefore,
4530 seemingly insignificant changes in the source program can cause the
4531 warnings produced by @option{-Winline} to appear or disappear.
4532
4533 @item -Wno-invalid-offsetof @r{(C++ and Objective-C++ only)}
4534 @opindex Wno-invalid-offsetof
4535 @opindex Winvalid-offsetof
4536 Suppress warnings from applying the @samp{offsetof} macro to a non-POD
4537 type. According to the 1998 ISO C++ standard, applying @samp{offsetof}
4538 to a non-POD type is undefined. In existing C++ implementations,
4539 however, @samp{offsetof} typically gives meaningful results even when
4540 applied to certain kinds of non-POD types. (Such as a simple
4541 @samp{struct} that fails to be a POD type only by virtue of having a
4542 constructor.) This flag is for users who are aware that they are
4543 writing nonportable code and who have deliberately chosen to ignore the
4544 warning about it.
4545
4546 The restrictions on @samp{offsetof} may be relaxed in a future version
4547 of the C++ standard.
4548
4549 @item -Wno-int-to-pointer-cast
4550 @opindex Wno-int-to-pointer-cast
4551 @opindex Wint-to-pointer-cast
4552 Suppress warnings from casts to pointer type of an integer of a
4553 different size. In C++, casting to a pointer type of smaller size is
4554 an error. @option{Wint-to-pointer-cast} is enabled by default.
4555
4556
4557 @item -Wno-pointer-to-int-cast @r{(C and Objective-C only)}
4558 @opindex Wno-pointer-to-int-cast
4559 @opindex Wpointer-to-int-cast
4560 Suppress warnings from casts from a pointer to an integer type of a
4561 different size.
4562
4563 @item -Winvalid-pch
4564 @opindex Winvalid-pch
4565 @opindex Wno-invalid-pch
4566 Warn if a precompiled header (@pxref{Precompiled Headers}) is found in
4567 the search path but can't be used.
4568
4569 @item -Wlong-long
4570 @opindex Wlong-long
4571 @opindex Wno-long-long
4572 Warn if @samp{long long} type is used. This is enabled by either
4573 @option{-pedantic} or @option{-Wtraditional} in ISO C90 and C++98
4574 modes. To inhibit the warning messages, use @option{-Wno-long-long}.
4575
4576 @item -Wvariadic-macros
4577 @opindex Wvariadic-macros
4578 @opindex Wno-variadic-macros
4579 Warn if variadic macros are used in pedantic ISO C90 mode, or the GNU
4580 alternate syntax when in pedantic ISO C99 mode. This is default.
4581 To inhibit the warning messages, use @option{-Wno-variadic-macros}.
4582
4583 @item -Wvector-operation-performance
4584 @opindex Wvector-operation-performance
4585 @opindex Wno-vector-operation-performance
4586 Warn if vector operation is not implemented via SIMD capabilities of the
4587 architecture. Mainly useful for the performance tuning.
4588 Vector operation can be implemented @code{piecewise} which means that the
4589 scalar operation is performed on every vector element;
4590 @code{in parallel} which means that the vector operation is implemented
4591 using scalars of wider type, which normally is more performance efficient;
4592 and @code{as a single scalar} which means that vector fits into a
4593 scalar type.
4594
4595 @item -Wvla
4596 @opindex Wvla
4597 @opindex Wno-vla
4598 Warn if variable length array is used in the code.
4599 @option{-Wno-vla} will prevent the @option{-pedantic} warning of
4600 the variable length array.
4601
4602 @item -Wvolatile-register-var
4603 @opindex Wvolatile-register-var
4604 @opindex Wno-volatile-register-var
4605 Warn if a register variable is declared volatile. The volatile
4606 modifier does not inhibit all optimizations that may eliminate reads
4607 and/or writes to register variables. This warning is enabled by
4608 @option{-Wall}.
4609
4610 @item -Wdisabled-optimization
4611 @opindex Wdisabled-optimization
4612 @opindex Wno-disabled-optimization
4613 Warn if a requested optimization pass is disabled. This warning does
4614 not generally indicate that there is anything wrong with your code; it
4615 merely indicates that GCC's optimizers were unable to handle the code
4616 effectively. Often, the problem is that your code is too big or too
4617 complex; GCC will refuse to optimize programs when the optimization
4618 itself is likely to take inordinate amounts of time.
4619
4620 @item -Wpointer-sign @r{(C and Objective-C only)}
4621 @opindex Wpointer-sign
4622 @opindex Wno-pointer-sign
4623 Warn for pointer argument passing or assignment with different signedness.
4624 This option is only supported for C and Objective-C@. It is implied by
4625 @option{-Wall} and by @option{-pedantic}, which can be disabled with
4626 @option{-Wno-pointer-sign}.
4627
4628 @item -Wstack-protector
4629 @opindex Wstack-protector
4630 @opindex Wno-stack-protector
4631 This option is only active when @option{-fstack-protector} is active. It
4632 warns about functions that will not be protected against stack smashing.
4633
4634 @item -Wno-mudflap
4635 @opindex Wno-mudflap
4636 Suppress warnings about constructs that cannot be instrumented by
4637 @option{-fmudflap}.
4638
4639 @item -Woverlength-strings
4640 @opindex Woverlength-strings
4641 @opindex Wno-overlength-strings
4642 Warn about string constants which are longer than the ``minimum
4643 maximum'' length specified in the C standard. Modern compilers
4644 generally allow string constants which are much longer than the
4645 standard's minimum limit, but very portable programs should avoid
4646 using longer strings.
4647
4648 The limit applies @emph{after} string constant concatenation, and does
4649 not count the trailing NUL@. In C90, the limit was 509 characters; in
4650 C99, it was raised to 4095. C++98 does not specify a normative
4651 minimum maximum, so we do not diagnose overlength strings in C++@.
4652
4653 This option is implied by @option{-pedantic}, and can be disabled with
4654 @option{-Wno-overlength-strings}.
4655
4656 @item -Wunsuffixed-float-constants @r{(C and Objective-C only)}
4657 @opindex Wunsuffixed-float-constants
4658
4659 GCC will issue a warning for any floating constant that does not have
4660 a suffix. When used together with @option{-Wsystem-headers} it will
4661 warn about such constants in system header files. This can be useful
4662 when preparing code to use with the @code{FLOAT_CONST_DECIMAL64} pragma
4663 from the decimal floating-point extension to C99.
4664 @end table
4665
4666 @node Debugging Options
4667 @section Options for Debugging Your Program or GCC
4668 @cindex options, debugging
4669 @cindex debugging information options
4670
4671 GCC has various special options that are used for debugging
4672 either your program or GCC:
4673
4674 @table @gcctabopt
4675 @item -g
4676 @opindex g
4677 Produce debugging information in the operating system's native format
4678 (stabs, COFF, XCOFF, or DWARF 2)@. GDB can work with this debugging
4679 information.
4680
4681 On most systems that use stabs format, @option{-g} enables use of extra
4682 debugging information that only GDB can use; this extra information
4683 makes debugging work better in GDB but will probably make other debuggers
4684 crash or
4685 refuse to read the program. If you want to control for certain whether
4686 to generate the extra information, use @option{-gstabs+}, @option{-gstabs},
4687 @option{-gxcoff+}, @option{-gxcoff}, or @option{-gvms} (see below).
4688
4689 GCC allows you to use @option{-g} with
4690 @option{-O}. The shortcuts taken by optimized code may occasionally
4691 produce surprising results: some variables you declared may not exist
4692 at all; flow of control may briefly move where you did not expect it;
4693 some statements may not be executed because they compute constant
4694 results or their values were already at hand; some statements may
4695 execute in different places because they were moved out of loops.
4696
4697 Nevertheless it proves possible to debug optimized output. This makes
4698 it reasonable to use the optimizer for programs that might have bugs.
4699
4700 The following options are useful when GCC is generated with the
4701 capability for more than one debugging format.
4702
4703 @item -ggdb
4704 @opindex ggdb
4705 Produce debugging information for use by GDB@. This means to use the
4706 most expressive format available (DWARF 2, stabs, or the native format
4707 if neither of those are supported), including GDB extensions if at all
4708 possible.
4709
4710 @item -gstabs
4711 @opindex gstabs
4712 Produce debugging information in stabs format (if that is supported),
4713 without GDB extensions. This is the format used by DBX on most BSD
4714 systems. On MIPS, Alpha and System V Release 4 systems this option
4715 produces stabs debugging output which is not understood by DBX or SDB@.
4716 On System V Release 4 systems this option requires the GNU assembler.
4717
4718 @item -feliminate-unused-debug-symbols
4719 @opindex feliminate-unused-debug-symbols
4720 Produce debugging information in stabs format (if that is supported),
4721 for only symbols that are actually used.
4722
4723 @item -femit-class-debug-always
4724 Instead of emitting debugging information for a C++ class in only one
4725 object file, emit it in all object files using the class. This option
4726 should be used only with debuggers that are unable to handle the way GCC
4727 normally emits debugging information for classes because using this
4728 option will increase the size of debugging information by as much as a
4729 factor of two.
4730
4731 @item -fno-debug-types-section
4732 @opindex fno-debug-types-section
4733 @opindex fdebug-types-section
4734 By default when using DWARF v4 or higher type DIEs will be put into
4735 their own .debug_types section instead of making them part of the
4736 .debug_info section. It is more efficient to put them in a separate
4737 comdat sections since the linker will then be able to remove duplicates.
4738 But not all DWARF consumers support .debug_types sections yet.
4739
4740 @item -gstabs+
4741 @opindex gstabs+
4742 Produce debugging information in stabs format (if that is supported),
4743 using GNU extensions understood only by the GNU debugger (GDB)@. The
4744 use of these extensions is likely to make other debuggers crash or
4745 refuse to read the program.
4746
4747 @item -gcoff
4748 @opindex gcoff
4749 Produce debugging information in COFF format (if that is supported).
4750 This is the format used by SDB on most System V systems prior to
4751 System V Release 4.
4752
4753 @item -gxcoff
4754 @opindex gxcoff
4755 Produce debugging information in XCOFF format (if that is supported).
4756 This is the format used by the DBX debugger on IBM RS/6000 systems.
4757
4758 @item -gxcoff+
4759 @opindex gxcoff+
4760 Produce debugging information in XCOFF format (if that is supported),
4761 using GNU extensions understood only by the GNU debugger (GDB)@. The
4762 use of these extensions is likely to make other debuggers crash or
4763 refuse to read the program, and may cause assemblers other than the GNU
4764 assembler (GAS) to fail with an error.
4765
4766 @item -gdwarf-@var{version}
4767 @opindex gdwarf-@var{version}
4768 Produce debugging information in DWARF format (if that is
4769 supported). This is the format used by DBX on IRIX 6. The value
4770 of @var{version} may be either 2, 3 or 4; the default version is 2.
4771
4772 Note that with DWARF version 2 some ports require, and will always
4773 use, some non-conflicting DWARF 3 extensions in the unwind tables.
4774
4775 Version 4 may require GDB 7.0 and @option{-fvar-tracking-assignments}
4776 for maximum benefit.
4777
4778 @item -grecord-gcc-switches
4779 @opindex grecord-gcc-switches
4780 This switch causes the command line options, that were used to invoke the
4781 compiler and may affect code generation, to be appended to the
4782 DW_AT_producer attribute in DWARF debugging information. The options
4783 are concatenated with spaces separating them from each other and from
4784 the compiler version. See also @option{-frecord-gcc-switches} for another
4785 way of storing compiler options into the object file.
4786
4787 @item -gno-record-gcc-switches
4788 @opindex gno-record-gcc-switches
4789 Disallow appending command line options to the DW_AT_producer attribute
4790 in DWARF debugging information. This is the default.
4791
4792 @item -gstrict-dwarf
4793 @opindex gstrict-dwarf
4794 Disallow using extensions of later DWARF standard version than selected
4795 with @option{-gdwarf-@var{version}}. On most targets using non-conflicting
4796 DWARF extensions from later standard versions is allowed.
4797
4798 @item -gno-strict-dwarf
4799 @opindex gno-strict-dwarf
4800 Allow using extensions of later DWARF standard version than selected with
4801 @option{-gdwarf-@var{version}}.
4802
4803 @item -gvms
4804 @opindex gvms
4805 Produce debugging information in VMS debug format (if that is
4806 supported). This is the format used by DEBUG on VMS systems.
4807
4808 @item -g@var{level}
4809 @itemx -ggdb@var{level}
4810 @itemx -gstabs@var{level}
4811 @itemx -gcoff@var{level}
4812 @itemx -gxcoff@var{level}
4813 @itemx -gvms@var{level}
4814 Request debugging information and also use @var{level} to specify how
4815 much information. The default level is 2.
4816
4817 Level 0 produces no debug information at all. Thus, @option{-g0} negates
4818 @option{-g}.
4819
4820 Level 1 produces minimal information, enough for making backtraces in
4821 parts of the program that you don't plan to debug. This includes
4822 descriptions of functions and external variables, but no information
4823 about local variables and no line numbers.
4824
4825 Level 3 includes extra information, such as all the macro definitions
4826 present in the program. Some debuggers support macro expansion when
4827 you use @option{-g3}.
4828
4829 @option{-gdwarf-2} does not accept a concatenated debug level, because
4830 GCC used to support an option @option{-gdwarf} that meant to generate
4831 debug information in version 1 of the DWARF format (which is very
4832 different from version 2), and it would have been too confusing. That
4833 debug format is long obsolete, but the option cannot be changed now.
4834 Instead use an additional @option{-g@var{level}} option to change the
4835 debug level for DWARF.
4836
4837 @item -gtoggle
4838 @opindex gtoggle
4839 Turn off generation of debug info, if leaving out this option would have
4840 generated it, or turn it on at level 2 otherwise. The position of this
4841 argument in the command line does not matter, it takes effect after all
4842 other options are processed, and it does so only once, no matter how
4843 many times it is given. This is mainly intended to be used with
4844 @option{-fcompare-debug}.
4845
4846 @item -fdump-final-insns@r{[}=@var{file}@r{]}
4847 @opindex fdump-final-insns
4848 Dump the final internal representation (RTL) to @var{file}. If the
4849 optional argument is omitted (or if @var{file} is @code{.}), the name
4850 of the dump file will be determined by appending @code{.gkd} to the
4851 compilation output file name.
4852
4853 @item -fcompare-debug@r{[}=@var{opts}@r{]}
4854 @opindex fcompare-debug
4855 @opindex fno-compare-debug
4856 If no error occurs during compilation, run the compiler a second time,
4857 adding @var{opts} and @option{-fcompare-debug-second} to the arguments
4858 passed to the second compilation. Dump the final internal
4859 representation in both compilations, and print an error if they differ.
4860
4861 If the equal sign is omitted, the default @option{-gtoggle} is used.
4862
4863 The environment variable @env{GCC_COMPARE_DEBUG}, if defined, non-empty
4864 and nonzero, implicitly enables @option{-fcompare-debug}. If
4865 @env{GCC_COMPARE_DEBUG} is defined to a string starting with a dash,
4866 then it is used for @var{opts}, otherwise the default @option{-gtoggle}
4867 is used.
4868
4869 @option{-fcompare-debug=}, with the equal sign but without @var{opts},
4870 is equivalent to @option{-fno-compare-debug}, which disables the dumping
4871 of the final representation and the second compilation, preventing even
4872 @env{GCC_COMPARE_DEBUG} from taking effect.
4873
4874 To verify full coverage during @option{-fcompare-debug} testing, set
4875 @env{GCC_COMPARE_DEBUG} to say @samp{-fcompare-debug-not-overridden},
4876 which GCC will reject as an invalid option in any actual compilation
4877 (rather than preprocessing, assembly or linking). To get just a
4878 warning, setting @env{GCC_COMPARE_DEBUG} to @samp{-w%n-fcompare-debug
4879 not overridden} will do.
4880
4881 @item -fcompare-debug-second
4882 @opindex fcompare-debug-second
4883 This option is implicitly passed to the compiler for the second
4884 compilation requested by @option{-fcompare-debug}, along with options to
4885 silence warnings, and omitting other options that would cause
4886 side-effect compiler outputs to files or to the standard output. Dump
4887 files and preserved temporary files are renamed so as to contain the
4888 @code{.gk} additional extension during the second compilation, to avoid
4889 overwriting those generated by the first.
4890
4891 When this option is passed to the compiler driver, it causes the
4892 @emph{first} compilation to be skipped, which makes it useful for little
4893 other than debugging the compiler proper.
4894
4895 @item -feliminate-dwarf2-dups
4896 @opindex feliminate-dwarf2-dups
4897 Compress DWARF2 debugging information by eliminating duplicated
4898 information about each symbol. This option only makes sense when
4899 generating DWARF2 debugging information with @option{-gdwarf-2}.
4900
4901 @item -femit-struct-debug-baseonly
4902 Emit debug information for struct-like types
4903 only when the base name of the compilation source file
4904 matches the base name of file in which the struct was defined.
4905
4906 This option substantially reduces the size of debugging information,
4907 but at significant potential loss in type information to the debugger.
4908 See @option{-femit-struct-debug-reduced} for a less aggressive option.
4909 See @option{-femit-struct-debug-detailed} for more detailed control.
4910
4911 This option works only with DWARF 2.
4912
4913 @item -femit-struct-debug-reduced
4914 Emit debug information for struct-like types
4915 only when the base name of the compilation source file
4916 matches the base name of file in which the type was defined,
4917 unless the struct is a template or defined in a system header.
4918
4919 This option significantly reduces the size of debugging information,
4920 with some potential loss in type information to the debugger.
4921 See @option{-femit-struct-debug-baseonly} for a more aggressive option.
4922 See @option{-femit-struct-debug-detailed} for more detailed control.
4923
4924 This option works only with DWARF 2.
4925
4926 @item -femit-struct-debug-detailed@r{[}=@var{spec-list}@r{]}
4927 Specify the struct-like types
4928 for which the compiler will generate debug information.
4929 The intent is to reduce duplicate struct debug information
4930 between different object files within the same program.
4931
4932 This option is a detailed version of
4933 @option{-femit-struct-debug-reduced} and @option{-femit-struct-debug-baseonly},
4934 which will serve for most needs.
4935
4936 A specification has the syntax@*
4937 [@samp{dir:}|@samp{ind:}][@samp{ord:}|@samp{gen:}](@samp{any}|@samp{sys}|@samp{base}|@samp{none})
4938
4939 The optional first word limits the specification to
4940 structs that are used directly (@samp{dir:}) or used indirectly (@samp{ind:}).
4941 A struct type is used directly when it is the type of a variable, member.
4942 Indirect uses arise through pointers to structs.
4943 That is, when use of an incomplete struct would be legal, the use is indirect.
4944 An example is
4945 @samp{struct one direct; struct two * indirect;}.
4946
4947 The optional second word limits the specification to
4948 ordinary structs (@samp{ord:}) or generic structs (@samp{gen:}).
4949 Generic structs are a bit complicated to explain.
4950 For C++, these are non-explicit specializations of template classes,
4951 or non-template classes within the above.
4952 Other programming languages have generics,
4953 but @samp{-femit-struct-debug-detailed} does not yet implement them.
4954
4955 The third word specifies the source files for those
4956 structs for which the compiler will emit debug information.
4957 The values @samp{none} and @samp{any} have the normal meaning.
4958 The value @samp{base} means that
4959 the base of name of the file in which the type declaration appears
4960 must match the base of the name of the main compilation file.
4961 In practice, this means that
4962 types declared in @file{foo.c} and @file{foo.h} will have debug information,
4963 but types declared in other header will not.
4964 The value @samp{sys} means those types satisfying @samp{base}
4965 or declared in system or compiler headers.
4966
4967 You may need to experiment to determine the best settings for your application.
4968
4969 The default is @samp{-femit-struct-debug-detailed=all}.
4970
4971 This option works only with DWARF 2.
4972
4973 @item -fno-merge-debug-strings
4974 @opindex fmerge-debug-strings
4975 @opindex fno-merge-debug-strings
4976 Direct the linker to not merge together strings in the debugging
4977 information which are identical in different object files. Merging is
4978 not supported by all assemblers or linkers. Merging decreases the size
4979 of the debug information in the output file at the cost of increasing
4980 link processing time. Merging is enabled by default.
4981
4982 @item -fdebug-prefix-map=@var{old}=@var{new}
4983 @opindex fdebug-prefix-map
4984 When compiling files in directory @file{@var{old}}, record debugging
4985 information describing them as in @file{@var{new}} instead.
4986
4987 @item -fno-dwarf2-cfi-asm
4988 @opindex fdwarf2-cfi-asm
4989 @opindex fno-dwarf2-cfi-asm
4990 Emit DWARF 2 unwind info as compiler generated @code{.eh_frame} section
4991 instead of using GAS @code{.cfi_*} directives.
4992
4993 @cindex @command{prof}
4994 @item -p
4995 @opindex p
4996 Generate extra code to write profile information suitable for the
4997 analysis program @command{prof}. You must use this option when compiling
4998 the source files you want data about, and you must also use it when
4999 linking.
5000
5001 @cindex @command{gprof}
5002 @item -pg
5003 @opindex pg
5004 Generate extra code to write profile information suitable for the
5005 analysis program @command{gprof}. You must use this option when compiling
5006 the source files you want data about, and you must also use it when
5007 linking.
5008
5009 @item -Q
5010 @opindex Q
5011 Makes the compiler print out each function name as it is compiled, and
5012 print some statistics about each pass when it finishes.
5013
5014 @item -ftime-report
5015 @opindex ftime-report
5016 Makes the compiler print some statistics about the time consumed by each
5017 pass when it finishes.
5018
5019 @item -fmem-report
5020 @opindex fmem-report
5021 Makes the compiler print some statistics about permanent memory
5022 allocation when it finishes.
5023
5024 @item -fpre-ipa-mem-report
5025 @opindex fpre-ipa-mem-report
5026 @item -fpost-ipa-mem-report
5027 @opindex fpost-ipa-mem-report
5028 Makes the compiler print some statistics about permanent memory
5029 allocation before or after interprocedural optimization.
5030
5031 @item -fstack-usage
5032 @opindex fstack-usage
5033 Makes the compiler output stack usage information for the program, on a
5034 per-function basis. The filename for the dump is made by appending
5035 @file{.su} to the @var{auxname}. @var{auxname} is generated from the name of
5036 the output file, if explicitly specified and it is not an executable,
5037 otherwise it is the basename of the source file. An entry is made up
5038 of three fields:
5039
5040 @itemize
5041 @item
5042 The name of the function.
5043 @item
5044 A number of bytes.
5045 @item
5046 One or more qualifiers: @code{static}, @code{dynamic}, @code{bounded}.
5047 @end itemize
5048
5049 The qualifier @code{static} means that the function manipulates the stack
5050 statically: a fixed number of bytes are allocated for the frame on function
5051 entry and released on function exit; no stack adjustments are otherwise made
5052 in the function. The second field is this fixed number of bytes.
5053
5054 The qualifier @code{dynamic} means that the function manipulates the stack
5055 dynamically: in addition to the static allocation described above, stack
5056 adjustments are made in the body of the function, for example to push/pop
5057 arguments around function calls. If the qualifier @code{bounded} is also
5058 present, the amount of these adjustments is bounded at compile-time and
5059 the second field is an upper bound of the total amount of stack used by
5060 the function. If it is not present, the amount of these adjustments is
5061 not bounded at compile-time and the second field only represents the
5062 bounded part.
5063
5064 @item -fprofile-arcs
5065 @opindex fprofile-arcs
5066 Add code so that program flow @dfn{arcs} are instrumented. During
5067 execution the program records how many times each branch and call is
5068 executed and how many times it is taken or returns. When the compiled
5069 program exits it saves this data to a file called
5070 @file{@var{auxname}.gcda} for each source file. The data may be used for
5071 profile-directed optimizations (@option{-fbranch-probabilities}), or for
5072 test coverage analysis (@option{-ftest-coverage}). Each object file's
5073 @var{auxname} is generated from the name of the output file, if
5074 explicitly specified and it is not the final executable, otherwise it is
5075 the basename of the source file. In both cases any suffix is removed
5076 (e.g.@: @file{foo.gcda} for input file @file{dir/foo.c}, or
5077 @file{dir/foo.gcda} for output file specified as @option{-o dir/foo.o}).
5078 @xref{Cross-profiling}.
5079
5080 @cindex @command{gcov}
5081 @item --coverage
5082 @opindex coverage
5083
5084 This option is used to compile and link code instrumented for coverage
5085 analysis. The option is a synonym for @option{-fprofile-arcs}
5086 @option{-ftest-coverage} (when compiling) and @option{-lgcov} (when
5087 linking). See the documentation for those options for more details.
5088
5089 @itemize
5090
5091 @item
5092 Compile the source files with @option{-fprofile-arcs} plus optimization
5093 and code generation options. For test coverage analysis, use the
5094 additional @option{-ftest-coverage} option. You do not need to profile
5095 every source file in a program.
5096
5097 @item
5098 Link your object files with @option{-lgcov} or @option{-fprofile-arcs}
5099 (the latter implies the former).
5100
5101 @item
5102 Run the program on a representative workload to generate the arc profile
5103 information. This may be repeated any number of times. You can run
5104 concurrent instances of your program, and provided that the file system
5105 supports locking, the data files will be correctly updated. Also
5106 @code{fork} calls are detected and correctly handled (double counting
5107 will not happen).
5108
5109 @item
5110 For profile-directed optimizations, compile the source files again with
5111 the same optimization and code generation options plus
5112 @option{-fbranch-probabilities} (@pxref{Optimize Options,,Options that
5113 Control Optimization}).
5114
5115 @item
5116 For test coverage analysis, use @command{gcov} to produce human readable
5117 information from the @file{.gcno} and @file{.gcda} files. Refer to the
5118 @command{gcov} documentation for further information.
5119
5120 @end itemize
5121
5122 With @option{-fprofile-arcs}, for each function of your program GCC
5123 creates a program flow graph, then finds a spanning tree for the graph.
5124 Only arcs that are not on the spanning tree have to be instrumented: the
5125 compiler adds code to count the number of times that these arcs are
5126 executed. When an arc is the only exit or only entrance to a block, the
5127 instrumentation code can be added to the block; otherwise, a new basic
5128 block must be created to hold the instrumentation code.
5129
5130 @need 2000
5131 @item -ftest-coverage
5132 @opindex ftest-coverage
5133 Produce a notes file that the @command{gcov} code-coverage utility
5134 (@pxref{Gcov,, @command{gcov}---a Test Coverage Program}) can use to
5135 show program coverage. Each source file's note file is called
5136 @file{@var{auxname}.gcno}. Refer to the @option{-fprofile-arcs} option
5137 above for a description of @var{auxname} and instructions on how to
5138 generate test coverage data. Coverage data will match the source files
5139 more closely, if you do not optimize.
5140
5141 @item -fdbg-cnt-list
5142 @opindex fdbg-cnt-list
5143 Print the name and the counter upper bound for all debug counters.
5144
5145
5146 @item -fdbg-cnt=@var{counter-value-list}
5147 @opindex fdbg-cnt
5148 Set the internal debug counter upper bound. @var{counter-value-list}
5149 is a comma-separated list of @var{name}:@var{value} pairs
5150 which sets the upper bound of each debug counter @var{name} to @var{value}.
5151 All debug counters have the initial upper bound of @var{UINT_MAX},
5152 thus dbg_cnt() returns true always unless the upper bound is set by this option.
5153 e.g. With -fdbg-cnt=dce:10,tail_call:0
5154 dbg_cnt(dce) will return true only for first 10 invocations
5155
5156 @itemx -fenable-@var{kind}-@var{pass}
5157 @itemx -fdisable-@var{kind}-@var{pass}=@var{range-list}
5158 @opindex fdisable-
5159 @opindex fenable-
5160
5161 This is a set of debugging options that are used to explicitly disable/enable
5162 optimization passes. For compiler users, regular options for enabling/disabling
5163 passes should be used instead.
5164
5165 @itemize
5166
5167 @item -fdisable-ipa-@var{pass}
5168 Disable ipa pass @var{pass}. @var{pass} is the pass name. If the same pass is
5169 statically invoked in the compiler multiple times, the pass name should be
5170 appended with a sequential number starting from 1.
5171
5172 @item -fdisable-rtl-@var{pass}
5173 @item -fdisable-rtl-@var{pass}=@var{range-list}
5174 Disable rtl pass @var{pass}. @var{pass} is the pass name. If the same pass is
5175 statically invoked in the compiler multiple times, the pass name should be
5176 appended with a sequential number starting from 1. @var{range-list} is a comma
5177 seperated list of function ranges or assembler names. Each range is a number
5178 pair seperated by a colon. The range is inclusive in both ends. If the range
5179 is trivial, the number pair can be simplified as a single number. If the
5180 function's cgraph node's @var{uid} is falling within one of the specified ranges,
5181 the @var{pass} is disabled for that function. The @var{uid} is shown in the
5182 function header of a dump file, and the pass names can be dumped by using
5183 option @option{-fdump-passes}.
5184
5185 @item -fdisable-tree-@var{pass}
5186 @item -fdisable-tree-@var{pass}=@var{range-list}
5187 Disable tree pass @var{pass}. See @option{-fdisable-rtl} for the description of
5188 option arguments.
5189
5190 @item -fenable-ipa-@var{pass}
5191 Enable ipa pass @var{pass}. @var{pass} is the pass name. If the same pass is
5192 statically invoked in the compiler multiple times, the pass name should be
5193 appended with a sequential number starting from 1.
5194
5195 @item -fenable-rtl-@var{pass}
5196 @item -fenable-rtl-@var{pass}=@var{range-list}
5197 Enable rtl pass @var{pass}. See @option{-fdisable-rtl} for option argument
5198 description and examples.
5199
5200 @item -fenable-tree-@var{pass}
5201 @item -fenable-tree-@var{pass}=@var{range-list}
5202 Enable tree pass @var{pass}. See @option{-fdisable-rtl} for the description
5203 of option arguments.
5204
5205 @smallexample
5206
5207 # disable ccp1 for all functions
5208 -fdisable-tree-ccp1
5209 # disable complete unroll for function whose cgraph node uid is 1
5210 -fenable-tree-cunroll=1
5211 # disable gcse2 for functions at the following ranges [1,1],
5212 # [300,400], and [400,1000]
5213 # disable gcse2 for functions foo and foo2
5214 -fdisable-rtl-gcse2=foo,foo2
5215 # disable early inlining
5216 -fdisable-tree-einline
5217 # disable ipa inlining
5218 -fdisable-ipa-inline
5219 # enable tree full unroll
5220 -fenable-tree-unroll
5221
5222 @end smallexample
5223
5224 @end itemize
5225
5226 @item -d@var{letters}
5227 @itemx -fdump-rtl-@var{pass}
5228 @opindex d
5229 Says to make debugging dumps during compilation at times specified by
5230 @var{letters}. This is used for debugging the RTL-based passes of the
5231 compiler. The file names for most of the dumps are made by appending
5232 a pass number and a word to the @var{dumpname}, and the files are
5233 created in the directory of the output file. Note that the pass
5234 number is computed statically as passes get registered into the pass
5235 manager. Thus the numbering is not related to the dynamic order of
5236 execution of passes. In particular, a pass installed by a plugin
5237 could have a number over 200 even if it executed quite early.
5238 @var{dumpname} is generated from the name of the output file, if
5239 explicitly specified and it is not an executable, otherwise it is the
5240 basename of the source file. These switches may have different effects
5241 when @option{-E} is used for preprocessing.
5242
5243 Debug dumps can be enabled with a @option{-fdump-rtl} switch or some
5244 @option{-d} option @var{letters}. Here are the possible
5245 letters for use in @var{pass} and @var{letters}, and their meanings:
5246
5247 @table @gcctabopt
5248
5249 @item -fdump-rtl-alignments
5250 @opindex fdump-rtl-alignments
5251 Dump after branch alignments have been computed.
5252
5253 @item -fdump-rtl-asmcons
5254 @opindex fdump-rtl-asmcons
5255 Dump after fixing rtl statements that have unsatisfied in/out constraints.
5256
5257 @item -fdump-rtl-auto_inc_dec
5258 @opindex fdump-rtl-auto_inc_dec
5259 Dump after auto-inc-dec discovery. This pass is only run on
5260 architectures that have auto inc or auto dec instructions.
5261
5262 @item -fdump-rtl-barriers
5263 @opindex fdump-rtl-barriers
5264 Dump after cleaning up the barrier instructions.
5265
5266 @item -fdump-rtl-bbpart
5267 @opindex fdump-rtl-bbpart
5268 Dump after partitioning hot and cold basic blocks.
5269
5270 @item -fdump-rtl-bbro
5271 @opindex fdump-rtl-bbro
5272 Dump after block reordering.
5273
5274 @item -fdump-rtl-btl1
5275 @itemx -fdump-rtl-btl2
5276 @opindex fdump-rtl-btl2
5277 @opindex fdump-rtl-btl2
5278 @option{-fdump-rtl-btl1} and @option{-fdump-rtl-btl2} enable dumping
5279 after the two branch
5280 target load optimization passes.
5281
5282 @item -fdump-rtl-bypass
5283 @opindex fdump-rtl-bypass
5284 Dump after jump bypassing and control flow optimizations.
5285
5286 @item -fdump-rtl-combine
5287 @opindex fdump-rtl-combine
5288 Dump after the RTL instruction combination pass.
5289
5290 @item -fdump-rtl-compgotos
5291 @opindex fdump-rtl-compgotos
5292 Dump after duplicating the computed gotos.
5293
5294 @item -fdump-rtl-ce1
5295 @itemx -fdump-rtl-ce2
5296 @itemx -fdump-rtl-ce3
5297 @opindex fdump-rtl-ce1
5298 @opindex fdump-rtl-ce2
5299 @opindex fdump-rtl-ce3
5300 @option{-fdump-rtl-ce1}, @option{-fdump-rtl-ce2}, and
5301 @option{-fdump-rtl-ce3} enable dumping after the three
5302 if conversion passes.
5303
5304 @itemx -fdump-rtl-cprop_hardreg
5305 @opindex fdump-rtl-cprop_hardreg
5306 Dump after hard register copy propagation.
5307
5308 @itemx -fdump-rtl-csa
5309 @opindex fdump-rtl-csa
5310 Dump after combining stack adjustments.
5311
5312 @item -fdump-rtl-cse1
5313 @itemx -fdump-rtl-cse2
5314 @opindex fdump-rtl-cse1
5315 @opindex fdump-rtl-cse2
5316 @option{-fdump-rtl-cse1} and @option{-fdump-rtl-cse2} enable dumping after
5317 the two common sub-expression elimination passes.
5318
5319 @itemx -fdump-rtl-dce
5320 @opindex fdump-rtl-dce
5321 Dump after the standalone dead code elimination passes.
5322
5323 @itemx -fdump-rtl-dbr
5324 @opindex fdump-rtl-dbr
5325 Dump after delayed branch scheduling.
5326
5327 @item -fdump-rtl-dce1
5328 @itemx -fdump-rtl-dce2
5329 @opindex fdump-rtl-dce1
5330 @opindex fdump-rtl-dce2
5331 @option{-fdump-rtl-dce1} and @option{-fdump-rtl-dce2} enable dumping after
5332 the two dead store elimination passes.
5333
5334 @item -fdump-rtl-eh
5335 @opindex fdump-rtl-eh
5336 Dump after finalization of EH handling code.
5337
5338 @item -fdump-rtl-eh_ranges
5339 @opindex fdump-rtl-eh_ranges
5340 Dump after conversion of EH handling range regions.
5341
5342 @item -fdump-rtl-expand
5343 @opindex fdump-rtl-expand
5344 Dump after RTL generation.
5345
5346 @item -fdump-rtl-fwprop1
5347 @itemx -fdump-rtl-fwprop2
5348 @opindex fdump-rtl-fwprop1
5349 @opindex fdump-rtl-fwprop2
5350 @option{-fdump-rtl-fwprop1} and @option{-fdump-rtl-fwprop2} enable
5351 dumping after the two forward propagation passes.
5352
5353 @item -fdump-rtl-gcse1
5354 @itemx -fdump-rtl-gcse2
5355 @opindex fdump-rtl-gcse1
5356 @opindex fdump-rtl-gcse2
5357 @option{-fdump-rtl-gcse1} and @option{-fdump-rtl-gcse2} enable dumping
5358 after global common subexpression elimination.
5359
5360 @item -fdump-rtl-init-regs
5361 @opindex fdump-rtl-init-regs
5362 Dump after the initialization of the registers.
5363
5364 @item -fdump-rtl-initvals
5365 @opindex fdump-rtl-initvals
5366 Dump after the computation of the initial value sets.
5367
5368 @itemx -fdump-rtl-into_cfglayout
5369 @opindex fdump-rtl-into_cfglayout
5370 Dump after converting to cfglayout mode.
5371
5372 @item -fdump-rtl-ira
5373 @opindex fdump-rtl-ira
5374 Dump after iterated register allocation.
5375
5376 @item -fdump-rtl-jump
5377 @opindex fdump-rtl-jump
5378 Dump after the second jump optimization.
5379
5380 @item -fdump-rtl-loop2
5381 @opindex fdump-rtl-loop2
5382 @option{-fdump-rtl-loop2} enables dumping after the rtl
5383 loop optimization passes.
5384
5385 @item -fdump-rtl-mach
5386 @opindex fdump-rtl-mach
5387 Dump after performing the machine dependent reorganization pass, if that
5388 pass exists.
5389
5390 @item -fdump-rtl-mode_sw
5391 @opindex fdump-rtl-mode_sw
5392 Dump after removing redundant mode switches.
5393
5394 @item -fdump-rtl-rnreg
5395 @opindex fdump-rtl-rnreg
5396 Dump after register renumbering.
5397
5398 @itemx -fdump-rtl-outof_cfglayout
5399 @opindex fdump-rtl-outof_cfglayout
5400 Dump after converting from cfglayout mode.
5401
5402 @item -fdump-rtl-peephole2
5403 @opindex fdump-rtl-peephole2
5404 Dump after the peephole pass.
5405
5406 @item -fdump-rtl-postreload
5407 @opindex fdump-rtl-postreload
5408 Dump after post-reload optimizations.
5409
5410 @itemx -fdump-rtl-pro_and_epilogue
5411 @opindex fdump-rtl-pro_and_epilogue
5412 Dump after generating the function pro and epilogues.
5413
5414 @item -fdump-rtl-regmove
5415 @opindex fdump-rtl-regmove
5416 Dump after the register move pass.
5417
5418 @item -fdump-rtl-sched1
5419 @itemx -fdump-rtl-sched2
5420 @opindex fdump-rtl-sched1
5421 @opindex fdump-rtl-sched2
5422 @option{-fdump-rtl-sched1} and @option{-fdump-rtl-sched2} enable dumping
5423 after the basic block scheduling passes.
5424
5425 @item -fdump-rtl-see
5426 @opindex fdump-rtl-see
5427 Dump after sign extension elimination.
5428
5429 @item -fdump-rtl-seqabstr
5430 @opindex fdump-rtl-seqabstr
5431 Dump after common sequence discovery.
5432
5433 @item -fdump-rtl-shorten
5434 @opindex fdump-rtl-shorten
5435 Dump after shortening branches.
5436
5437 @item -fdump-rtl-sibling
5438 @opindex fdump-rtl-sibling
5439 Dump after sibling call optimizations.
5440
5441 @item -fdump-rtl-split1
5442 @itemx -fdump-rtl-split2
5443 @itemx -fdump-rtl-split3
5444 @itemx -fdump-rtl-split4
5445 @itemx -fdump-rtl-split5
5446 @opindex fdump-rtl-split1
5447 @opindex fdump-rtl-split2
5448 @opindex fdump-rtl-split3
5449 @opindex fdump-rtl-split4
5450 @opindex fdump-rtl-split5
5451 @option{-fdump-rtl-split1}, @option{-fdump-rtl-split2},
5452 @option{-fdump-rtl-split3}, @option{-fdump-rtl-split4} and
5453 @option{-fdump-rtl-split5} enable dumping after five rounds of
5454 instruction splitting.
5455
5456 @item -fdump-rtl-sms
5457 @opindex fdump-rtl-sms
5458 Dump after modulo scheduling. This pass is only run on some
5459 architectures.
5460
5461 @item -fdump-rtl-stack
5462 @opindex fdump-rtl-stack
5463 Dump after conversion from GCC's "flat register file" registers to the
5464 x87's stack-like registers. This pass is only run on x86 variants.
5465
5466 @item -fdump-rtl-subreg1
5467 @itemx -fdump-rtl-subreg2
5468 @opindex fdump-rtl-subreg1
5469 @opindex fdump-rtl-subreg2
5470 @option{-fdump-rtl-subreg1} and @option{-fdump-rtl-subreg2} enable dumping after
5471 the two subreg expansion passes.
5472
5473 @item -fdump-rtl-unshare
5474 @opindex fdump-rtl-unshare
5475 Dump after all rtl has been unshared.
5476
5477 @item -fdump-rtl-vartrack
5478 @opindex fdump-rtl-vartrack
5479 Dump after variable tracking.
5480
5481 @item -fdump-rtl-vregs
5482 @opindex fdump-rtl-vregs
5483 Dump after converting virtual registers to hard registers.
5484
5485 @item -fdump-rtl-web
5486 @opindex fdump-rtl-web
5487 Dump after live range splitting.
5488
5489 @item -fdump-rtl-regclass
5490 @itemx -fdump-rtl-subregs_of_mode_init
5491 @itemx -fdump-rtl-subregs_of_mode_finish
5492 @itemx -fdump-rtl-dfinit
5493 @itemx -fdump-rtl-dfinish
5494 @opindex fdump-rtl-regclass
5495 @opindex fdump-rtl-subregs_of_mode_init
5496 @opindex fdump-rtl-subregs_of_mode_finish
5497 @opindex fdump-rtl-dfinit
5498 @opindex fdump-rtl-dfinish
5499 These dumps are defined but always produce empty files.
5500
5501 @item -fdump-rtl-all
5502 @opindex fdump-rtl-all
5503 Produce all the dumps listed above.
5504
5505 @item -dA
5506 @opindex dA
5507 Annotate the assembler output with miscellaneous debugging information.
5508
5509 @item -dD
5510 @opindex dD
5511 Dump all macro definitions, at the end of preprocessing, in addition to
5512 normal output.
5513
5514 @item -dH
5515 @opindex dH
5516 Produce a core dump whenever an error occurs.
5517
5518 @item -dm
5519 @opindex dm
5520 Print statistics on memory usage, at the end of the run, to
5521 standard error.
5522
5523 @item -dp
5524 @opindex dp
5525 Annotate the assembler output with a comment indicating which
5526 pattern and alternative was used. The length of each instruction is
5527 also printed.
5528
5529 @item -dP
5530 @opindex dP
5531 Dump the RTL in the assembler output as a comment before each instruction.
5532 Also turns on @option{-dp} annotation.
5533
5534 @item -dv
5535 @opindex dv
5536 For each of the other indicated dump files (@option{-fdump-rtl-@var{pass}}),
5537 dump a representation of the control flow graph suitable for viewing with VCG
5538 to @file{@var{file}.@var{pass}.vcg}.
5539
5540 @item -dx
5541 @opindex dx
5542 Just generate RTL for a function instead of compiling it. Usually used
5543 with @option{-fdump-rtl-expand}.
5544 @end table
5545
5546 @item -fdump-noaddr
5547 @opindex fdump-noaddr
5548 When doing debugging dumps, suppress address output. This makes it more
5549 feasible to use diff on debugging dumps for compiler invocations with
5550 different compiler binaries and/or different
5551 text / bss / data / heap / stack / dso start locations.
5552
5553 @item -fdump-unnumbered
5554 @opindex fdump-unnumbered
5555 When doing debugging dumps, suppress instruction numbers and address output.
5556 This makes it more feasible to use diff on debugging dumps for compiler
5557 invocations with different options, in particular with and without
5558 @option{-g}.
5559
5560 @item -fdump-unnumbered-links
5561 @opindex fdump-unnumbered-links
5562 When doing debugging dumps (see @option{-d} option above), suppress
5563 instruction numbers for the links to the previous and next instructions
5564 in a sequence.
5565
5566 @item -fdump-translation-unit @r{(C++ only)}
5567 @itemx -fdump-translation-unit-@var{options} @r{(C++ only)}
5568 @opindex fdump-translation-unit
5569 Dump a representation of the tree structure for the entire translation
5570 unit to a file. The file name is made by appending @file{.tu} to the
5571 source file name, and the file is created in the same directory as the
5572 output file. If the @samp{-@var{options}} form is used, @var{options}
5573 controls the details of the dump as described for the
5574 @option{-fdump-tree} options.
5575
5576 @item -fdump-class-hierarchy @r{(C++ only)}
5577 @itemx -fdump-class-hierarchy-@var{options} @r{(C++ only)}
5578 @opindex fdump-class-hierarchy
5579 Dump a representation of each class's hierarchy and virtual function
5580 table layout to a file. The file name is made by appending
5581 @file{.class} to the source file name, and the file is created in the
5582 same directory as the output file. If the @samp{-@var{options}} form
5583 is used, @var{options} controls the details of the dump as described
5584 for the @option{-fdump-tree} options.
5585
5586 @item -fdump-ipa-@var{switch}
5587 @opindex fdump-ipa
5588 Control the dumping at various stages of inter-procedural analysis
5589 language tree to a file. The file name is generated by appending a
5590 switch specific suffix to the source file name, and the file is created
5591 in the same directory as the output file. The following dumps are
5592 possible:
5593
5594 @table @samp
5595 @item all
5596 Enables all inter-procedural analysis dumps.
5597
5598 @item cgraph
5599 Dumps information about call-graph optimization, unused function removal,
5600 and inlining decisions.
5601
5602 @item inline
5603 Dump after function inlining.
5604
5605 @end table
5606
5607 @item -fdump-passes
5608 @opindex fdump-passes
5609 Dump the list of optimization passes that are turned on and off by
5610 the current command line options.
5611
5612 @item -fdump-statistics-@var{option}
5613 @opindex fdump-statistics
5614 Enable and control dumping of pass statistics in a separate file. The
5615 file name is generated by appending a suffix ending in
5616 @samp{.statistics} to the source file name, and the file is created in
5617 the same directory as the output file. If the @samp{-@var{option}}
5618 form is used, @samp{-stats} will cause counters to be summed over the
5619 whole compilation unit while @samp{-details} will dump every event as
5620 the passes generate them. The default with no option is to sum
5621 counters for each function compiled.
5622
5623 @item -fdump-tree-@var{switch}
5624 @itemx -fdump-tree-@var{switch}-@var{options}
5625 @opindex fdump-tree
5626 Control the dumping at various stages of processing the intermediate
5627 language tree to a file. The file name is generated by appending a
5628 switch specific suffix to the source file name, and the file is
5629 created in the same directory as the output file. If the
5630 @samp{-@var{options}} form is used, @var{options} is a list of
5631 @samp{-} separated options that control the details of the dump. Not
5632 all options are applicable to all dumps, those which are not
5633 meaningful will be ignored. The following options are available
5634
5635 @table @samp
5636 @item address
5637 Print the address of each node. Usually this is not meaningful as it
5638 changes according to the environment and source file. Its primary use
5639 is for tying up a dump file with a debug environment.
5640 @item asmname
5641 If @code{DECL_ASSEMBLER_NAME} has been set for a given decl, use that
5642 in the dump instead of @code{DECL_NAME}. Its primary use is ease of
5643 use working backward from mangled names in the assembly file.
5644 @item slim
5645 Inhibit dumping of members of a scope or body of a function merely
5646 because that scope has been reached. Only dump such items when they
5647 are directly reachable by some other path. When dumping pretty-printed
5648 trees, this option inhibits dumping the bodies of control structures.
5649 @item raw
5650 Print a raw representation of the tree. By default, trees are
5651 pretty-printed into a C-like representation.
5652 @item details
5653 Enable more detailed dumps (not honored by every dump option).
5654 @item stats
5655 Enable dumping various statistics about the pass (not honored by every dump
5656 option).
5657 @item blocks
5658 Enable showing basic block boundaries (disabled in raw dumps).
5659 @item vops
5660 Enable showing virtual operands for every statement.
5661 @item lineno
5662 Enable showing line numbers for statements.
5663 @item uid
5664 Enable showing the unique ID (@code{DECL_UID}) for each variable.
5665 @item verbose
5666 Enable showing the tree dump for each statement.
5667 @item eh
5668 Enable showing the EH region number holding each statement.
5669 @item scev
5670 Enable showing scalar evolution analysis details.
5671 @item all
5672 Turn on all options, except @option{raw}, @option{slim}, @option{verbose}
5673 and @option{lineno}.
5674 @end table
5675
5676 The following tree dumps are possible:
5677 @table @samp
5678
5679 @item original
5680 @opindex fdump-tree-original
5681 Dump before any tree based optimization, to @file{@var{file}.original}.
5682
5683 @item optimized
5684 @opindex fdump-tree-optimized
5685 Dump after all tree based optimization, to @file{@var{file}.optimized}.
5686
5687 @item gimple
5688 @opindex fdump-tree-gimple
5689 Dump each function before and after the gimplification pass to a file. The
5690 file name is made by appending @file{.gimple} to the source file name.
5691
5692 @item cfg
5693 @opindex fdump-tree-cfg
5694 Dump the control flow graph of each function to a file. The file name is
5695 made by appending @file{.cfg} to the source file name.
5696
5697 @item vcg
5698 @opindex fdump-tree-vcg
5699 Dump the control flow graph of each function to a file in VCG format. The
5700 file name is made by appending @file{.vcg} to the source file name. Note
5701 that if the file contains more than one function, the generated file cannot
5702 be used directly by VCG@. You will need to cut and paste each function's
5703 graph into its own separate file first.
5704
5705 @item ch
5706 @opindex fdump-tree-ch
5707 Dump each function after copying loop headers. The file name is made by
5708 appending @file{.ch} to the source file name.
5709
5710 @item ssa
5711 @opindex fdump-tree-ssa
5712 Dump SSA related information to a file. The file name is made by appending
5713 @file{.ssa} to the source file name.
5714
5715 @item alias
5716 @opindex fdump-tree-alias
5717 Dump aliasing information for each function. The file name is made by
5718 appending @file{.alias} to the source file name.
5719
5720 @item ccp
5721 @opindex fdump-tree-ccp
5722 Dump each function after CCP@. The file name is made by appending
5723 @file{.ccp} to the source file name.
5724
5725 @item storeccp
5726 @opindex fdump-tree-storeccp
5727 Dump each function after STORE-CCP@. The file name is made by appending
5728 @file{.storeccp} to the source file name.
5729
5730 @item pre
5731 @opindex fdump-tree-pre
5732 Dump trees after partial redundancy elimination. The file name is made
5733 by appending @file{.pre} to the source file name.
5734
5735 @item fre
5736 @opindex fdump-tree-fre
5737 Dump trees after full redundancy elimination. The file name is made
5738 by appending @file{.fre} to the source file name.
5739
5740 @item copyprop
5741 @opindex fdump-tree-copyprop
5742 Dump trees after copy propagation. The file name is made
5743 by appending @file{.copyprop} to the source file name.
5744
5745 @item store_copyprop
5746 @opindex fdump-tree-store_copyprop
5747 Dump trees after store copy-propagation. The file name is made
5748 by appending @file{.store_copyprop} to the source file name.
5749
5750 @item dce
5751 @opindex fdump-tree-dce
5752 Dump each function after dead code elimination. The file name is made by
5753 appending @file{.dce} to the source file name.
5754
5755 @item mudflap
5756 @opindex fdump-tree-mudflap
5757 Dump each function after adding mudflap instrumentation. The file name is
5758 made by appending @file{.mudflap} to the source file name.
5759
5760 @item sra
5761 @opindex fdump-tree-sra
5762 Dump each function after performing scalar replacement of aggregates. The
5763 file name is made by appending @file{.sra} to the source file name.
5764
5765 @item sink
5766 @opindex fdump-tree-sink
5767 Dump each function after performing code sinking. The file name is made
5768 by appending @file{.sink} to the source file name.
5769
5770 @item dom
5771 @opindex fdump-tree-dom
5772 Dump each function after applying dominator tree optimizations. The file
5773 name is made by appending @file{.dom} to the source file name.
5774
5775 @item dse
5776 @opindex fdump-tree-dse
5777 Dump each function after applying dead store elimination. The file
5778 name is made by appending @file{.dse} to the source file name.
5779
5780 @item phiopt
5781 @opindex fdump-tree-phiopt
5782 Dump each function after optimizing PHI nodes into straightline code. The file
5783 name is made by appending @file{.phiopt} to the source file name.
5784
5785 @item forwprop
5786 @opindex fdump-tree-forwprop
5787 Dump each function after forward propagating single use variables. The file
5788 name is made by appending @file{.forwprop} to the source file name.
5789
5790 @item copyrename
5791 @opindex fdump-tree-copyrename
5792 Dump each function after applying the copy rename optimization. The file
5793 name is made by appending @file{.copyrename} to the source file name.
5794
5795 @item nrv
5796 @opindex fdump-tree-nrv
5797 Dump each function after applying the named return value optimization on
5798 generic trees. The file name is made by appending @file{.nrv} to the source
5799 file name.
5800
5801 @item vect
5802 @opindex fdump-tree-vect
5803 Dump each function after applying vectorization of loops. The file name is
5804 made by appending @file{.vect} to the source file name.
5805
5806 @item slp
5807 @opindex fdump-tree-slp
5808 Dump each function after applying vectorization of basic blocks. The file name
5809 is made by appending @file{.slp} to the source file name.
5810
5811 @item vrp
5812 @opindex fdump-tree-vrp
5813 Dump each function after Value Range Propagation (VRP). The file name
5814 is made by appending @file{.vrp} to the source file name.
5815
5816 @item all
5817 @opindex fdump-tree-all
5818 Enable all the available tree dumps with the flags provided in this option.
5819 @end table
5820
5821 @item -ftree-vectorizer-verbose=@var{n}
5822 @opindex ftree-vectorizer-verbose
5823 This option controls the amount of debugging output the vectorizer prints.
5824 This information is written to standard error, unless
5825 @option{-fdump-tree-all} or @option{-fdump-tree-vect} is specified,
5826 in which case it is output to the usual dump listing file, @file{.vect}.
5827 For @var{n}=0 no diagnostic information is reported.
5828 If @var{n}=1 the vectorizer reports each loop that got vectorized,
5829 and the total number of loops that got vectorized.
5830 If @var{n}=2 the vectorizer also reports non-vectorized loops that passed
5831 the first analysis phase (vect_analyze_loop_form) - i.e.@: countable,
5832 inner-most, single-bb, single-entry/exit loops. This is the same verbosity
5833 level that @option{-fdump-tree-vect-stats} uses.
5834 Higher verbosity levels mean either more information dumped for each
5835 reported loop, or same amount of information reported for more loops:
5836 if @var{n}=3, vectorizer cost model information is reported.
5837 If @var{n}=4, alignment related information is added to the reports.
5838 If @var{n}=5, data-references related information (e.g.@: memory dependences,
5839 memory access-patterns) is added to the reports.
5840 If @var{n}=6, the vectorizer reports also non-vectorized inner-most loops
5841 that did not pass the first analysis phase (i.e., may not be countable, or
5842 may have complicated control-flow).
5843 If @var{n}=7, the vectorizer reports also non-vectorized nested loops.
5844 If @var{n}=8, SLP related information is added to the reports.
5845 For @var{n}=9, all the information the vectorizer generates during its
5846 analysis and transformation is reported. This is the same verbosity level
5847 that @option{-fdump-tree-vect-details} uses.
5848
5849 @item -frandom-seed=@var{string}
5850 @opindex frandom-seed
5851 This option provides a seed that GCC uses when it would otherwise use
5852 random numbers. It is used to generate certain symbol names
5853 that have to be different in every compiled file. It is also used to
5854 place unique stamps in coverage data files and the object files that
5855 produce them. You can use the @option{-frandom-seed} option to produce
5856 reproducibly identical object files.
5857
5858 The @var{string} should be different for every file you compile.
5859
5860 @item -fsched-verbose=@var{n}
5861 @opindex fsched-verbose
5862 On targets that use instruction scheduling, this option controls the
5863 amount of debugging output the scheduler prints. This information is
5864 written to standard error, unless @option{-fdump-rtl-sched1} or
5865 @option{-fdump-rtl-sched2} is specified, in which case it is output
5866 to the usual dump listing file, @file{.sched1} or @file{.sched2}
5867 respectively. However for @var{n} greater than nine, the output is
5868 always printed to standard error.
5869
5870 For @var{n} greater than zero, @option{-fsched-verbose} outputs the
5871 same information as @option{-fdump-rtl-sched1} and @option{-fdump-rtl-sched2}.
5872 For @var{n} greater than one, it also output basic block probabilities,
5873 detailed ready list information and unit/insn info. For @var{n} greater
5874 than two, it includes RTL at abort point, control-flow and regions info.
5875 And for @var{n} over four, @option{-fsched-verbose} also includes
5876 dependence info.
5877
5878 @item -save-temps
5879 @itemx -save-temps=cwd
5880 @opindex save-temps
5881 Store the usual ``temporary'' intermediate files permanently; place them
5882 in the current directory and name them based on the source file. Thus,
5883 compiling @file{foo.c} with @samp{-c -save-temps} would produce files
5884 @file{foo.i} and @file{foo.s}, as well as @file{foo.o}. This creates a
5885 preprocessed @file{foo.i} output file even though the compiler now
5886 normally uses an integrated preprocessor.
5887
5888 When used in combination with the @option{-x} command line option,
5889 @option{-save-temps} is sensible enough to avoid over writing an
5890 input source file with the same extension as an intermediate file.
5891 The corresponding intermediate file may be obtained by renaming the
5892 source file before using @option{-save-temps}.
5893
5894 If you invoke GCC in parallel, compiling several different source
5895 files that share a common base name in different subdirectories or the
5896 same source file compiled for multiple output destinations, it is
5897 likely that the different parallel compilers will interfere with each
5898 other, and overwrite the temporary files. For instance:
5899
5900 @smallexample
5901 gcc -save-temps -o outdir1/foo.o indir1/foo.c&
5902 gcc -save-temps -o outdir2/foo.o indir2/foo.c&
5903 @end smallexample
5904
5905 may result in @file{foo.i} and @file{foo.o} being written to
5906 simultaneously by both compilers.
5907
5908 @item -save-temps=obj
5909 @opindex save-temps=obj
5910 Store the usual ``temporary'' intermediate files permanently. If the
5911 @option{-o} option is used, the temporary files are based on the
5912 object file. If the @option{-o} option is not used, the
5913 @option{-save-temps=obj} switch behaves like @option{-save-temps}.
5914
5915 For example:
5916
5917 @smallexample
5918 gcc -save-temps=obj -c foo.c
5919 gcc -save-temps=obj -c bar.c -o dir/xbar.o
5920 gcc -save-temps=obj foobar.c -o dir2/yfoobar
5921 @end smallexample
5922
5923 would create @file{foo.i}, @file{foo.s}, @file{dir/xbar.i},
5924 @file{dir/xbar.s}, @file{dir2/yfoobar.i}, @file{dir2/yfoobar.s}, and
5925 @file{dir2/yfoobar.o}.
5926
5927 @item -time@r{[}=@var{file}@r{]}
5928 @opindex time
5929 Report the CPU time taken by each subprocess in the compilation
5930 sequence. For C source files, this is the compiler proper and assembler
5931 (plus the linker if linking is done).
5932
5933 Without the specification of an output file, the output looks like this:
5934
5935 @smallexample
5936 # cc1 0.12 0.01
5937 # as 0.00 0.01
5938 @end smallexample
5939
5940 The first number on each line is the ``user time'', that is time spent
5941 executing the program itself. The second number is ``system time'',
5942 time spent executing operating system routines on behalf of the program.
5943 Both numbers are in seconds.
5944
5945 With the specification of an output file, the output is appended to the
5946 named file, and it looks like this:
5947
5948 @smallexample
5949 0.12 0.01 cc1 @var{options}
5950 0.00 0.01 as @var{options}
5951 @end smallexample
5952
5953 The ``user time'' and the ``system time'' are moved before the program
5954 name, and the options passed to the program are displayed, so that one
5955 can later tell what file was being compiled, and with which options.
5956
5957 @item -fvar-tracking
5958 @opindex fvar-tracking
5959 Run variable tracking pass. It computes where variables are stored at each
5960 position in code. Better debugging information is then generated
5961 (if the debugging information format supports this information).
5962
5963 It is enabled by default when compiling with optimization (@option{-Os},
5964 @option{-O}, @option{-O2}, @dots{}), debugging information (@option{-g}) and
5965 the debug info format supports it.
5966
5967 @item -fvar-tracking-assignments
5968 @opindex fvar-tracking-assignments
5969 @opindex fno-var-tracking-assignments
5970 Annotate assignments to user variables early in the compilation and
5971 attempt to carry the annotations over throughout the compilation all the
5972 way to the end, in an attempt to improve debug information while
5973 optimizing. Use of @option{-gdwarf-4} is recommended along with it.
5974
5975 It can be enabled even if var-tracking is disabled, in which case
5976 annotations will be created and maintained, but discarded at the end.
5977
5978 @item -fvar-tracking-assignments-toggle
5979 @opindex fvar-tracking-assignments-toggle
5980 @opindex fno-var-tracking-assignments-toggle
5981 Toggle @option{-fvar-tracking-assignments}, in the same way that
5982 @option{-gtoggle} toggles @option{-g}.
5983
5984 @item -print-file-name=@var{library}
5985 @opindex print-file-name
5986 Print the full absolute name of the library file @var{library} that
5987 would be used when linking---and don't do anything else. With this
5988 option, GCC does not compile or link anything; it just prints the
5989 file name.
5990
5991 @item -print-multi-directory
5992 @opindex print-multi-directory
5993 Print the directory name corresponding to the multilib selected by any
5994 other switches present in the command line. This directory is supposed
5995 to exist in @env{GCC_EXEC_PREFIX}.
5996
5997 @item -print-multi-lib
5998 @opindex print-multi-lib
5999 Print the mapping from multilib directory names to compiler switches
6000 that enable them. The directory name is separated from the switches by
6001 @samp{;}, and each switch starts with an @samp{@@} instead of the
6002 @samp{-}, without spaces between multiple switches. This is supposed to
6003 ease shell-processing.
6004
6005 @item -print-multi-os-directory
6006 @opindex print-multi-os-directory
6007 Print the path to OS libraries for the selected
6008 multilib, relative to some @file{lib} subdirectory. If OS libraries are
6009 present in the @file{lib} subdirectory and no multilibs are used, this is
6010 usually just @file{.}, if OS libraries are present in @file{lib@var{suffix}}
6011 sibling directories this prints e.g.@: @file{../lib64}, @file{../lib} or
6012 @file{../lib32}, or if OS libraries are present in @file{lib/@var{subdir}}
6013 subdirectories it prints e.g.@: @file{amd64}, @file{sparcv9} or @file{ev6}.
6014
6015 @item -print-prog-name=@var{program}
6016 @opindex print-prog-name
6017 Like @option{-print-file-name}, but searches for a program such as @samp{cpp}.
6018
6019 @item -print-libgcc-file-name
6020 @opindex print-libgcc-file-name
6021 Same as @option{-print-file-name=libgcc.a}.
6022
6023 This is useful when you use @option{-nostdlib} or @option{-nodefaultlibs}
6024 but you do want to link with @file{libgcc.a}. You can do
6025
6026 @smallexample
6027 gcc -nostdlib @var{files}@dots{} `gcc -print-libgcc-file-name`
6028 @end smallexample
6029
6030 @item -print-search-dirs
6031 @opindex print-search-dirs
6032 Print the name of the configured installation directory and a list of
6033 program and library directories @command{gcc} will search---and don't do anything else.
6034
6035 This is useful when @command{gcc} prints the error message
6036 @samp{installation problem, cannot exec cpp0: No such file or directory}.
6037 To resolve this you either need to put @file{cpp0} and the other compiler
6038 components where @command{gcc} expects to find them, or you can set the environment
6039 variable @env{GCC_EXEC_PREFIX} to the directory where you installed them.
6040 Don't forget the trailing @samp{/}.
6041 @xref{Environment Variables}.
6042
6043 @item -print-sysroot
6044 @opindex print-sysroot
6045 Print the target sysroot directory that will be used during
6046 compilation. This is the target sysroot specified either at configure
6047 time or using the @option{--sysroot} option, possibly with an extra
6048 suffix that depends on compilation options. If no target sysroot is
6049 specified, the option prints nothing.
6050
6051 @item -print-sysroot-headers-suffix
6052 @opindex print-sysroot-headers-suffix
6053 Print the suffix added to the target sysroot when searching for
6054 headers, or give an error if the compiler is not configured with such
6055 a suffix---and don't do anything else.
6056
6057 @item -dumpmachine
6058 @opindex dumpmachine
6059 Print the compiler's target machine (for example,
6060 @samp{i686-pc-linux-gnu})---and don't do anything else.
6061
6062 @item -dumpversion
6063 @opindex dumpversion
6064 Print the compiler version (for example, @samp{3.0})---and don't do
6065 anything else.
6066
6067 @item -dumpspecs
6068 @opindex dumpspecs
6069 Print the compiler's built-in specs---and don't do anything else. (This
6070 is used when GCC itself is being built.) @xref{Spec Files}.
6071
6072 @item -feliminate-unused-debug-types
6073 @opindex feliminate-unused-debug-types
6074 Normally, when producing DWARF2 output, GCC will emit debugging
6075 information for all types declared in a compilation
6076 unit, regardless of whether or not they are actually used
6077 in that compilation unit. Sometimes this is useful, such as
6078 if, in the debugger, you want to cast a value to a type that is
6079 not actually used in your program (but is declared). More often,
6080 however, this results in a significant amount of wasted space.
6081 With this option, GCC will avoid producing debug symbol output
6082 for types that are nowhere used in the source file being compiled.
6083 @end table
6084
6085 @node Optimize Options
6086 @section Options That Control Optimization
6087 @cindex optimize options
6088 @cindex options, optimization
6089
6090 These options control various sorts of optimizations.
6091
6092 Without any optimization option, the compiler's goal is to reduce the
6093 cost of compilation and to make debugging produce the expected
6094 results. Statements are independent: if you stop the program with a
6095 breakpoint between statements, you can then assign a new value to any
6096 variable or change the program counter to any other statement in the
6097 function and get exactly the results you would expect from the source
6098 code.
6099
6100 Turning on optimization flags makes the compiler attempt to improve
6101 the performance and/or code size at the expense of compilation time
6102 and possibly the ability to debug the program.
6103
6104 The compiler performs optimization based on the knowledge it has of the
6105 program. Compiling multiple files at once to a single output file mode allows
6106 the compiler to use information gained from all of the files when compiling
6107 each of them.
6108
6109 Not all optimizations are controlled directly by a flag. Only
6110 optimizations that have a flag are listed in this section.
6111
6112 Most optimizations are only enabled if an @option{-O} level is set on
6113 the command line. Otherwise they are disabled, even if individual
6114 optimization flags are specified.
6115
6116 Depending on the target and how GCC was configured, a slightly different
6117 set of optimizations may be enabled at each @option{-O} level than
6118 those listed here. You can invoke GCC with @samp{-Q --help=optimizers}
6119 to find out the exact set of optimizations that are enabled at each level.
6120 @xref{Overall Options}, for examples.
6121
6122 @table @gcctabopt
6123 @item -O
6124 @itemx -O1
6125 @opindex O
6126 @opindex O1
6127 Optimize. Optimizing compilation takes somewhat more time, and a lot
6128 more memory for a large function.
6129
6130 With @option{-O}, the compiler tries to reduce code size and execution
6131 time, without performing any optimizations that take a great deal of
6132 compilation time.
6133
6134 @option{-O} turns on the following optimization flags:
6135 @gccoptlist{
6136 -fauto-inc-dec @gol
6137 -fcompare-elim @gol
6138 -fcprop-registers @gol
6139 -fdce @gol
6140 -fdefer-pop @gol
6141 -fdelayed-branch @gol
6142 -fdse @gol
6143 -fguess-branch-probability @gol
6144 -fif-conversion2 @gol
6145 -fif-conversion @gol
6146 -fipa-pure-const @gol
6147 -fipa-profile @gol
6148 -fipa-reference @gol
6149 -fmerge-constants
6150 -fsplit-wide-types @gol
6151 -ftree-bit-ccp @gol
6152 -ftree-builtin-call-dce @gol
6153 -ftree-ccp @gol
6154 -ftree-ch @gol
6155 -ftree-copyrename @gol
6156 -ftree-dce @gol
6157 -ftree-dominator-opts @gol
6158 -ftree-dse @gol
6159 -ftree-forwprop @gol
6160 -ftree-fre @gol
6161 -ftree-phiprop @gol
6162 -ftree-sra @gol
6163 -ftree-pta @gol
6164 -ftree-ter @gol
6165 -funit-at-a-time}
6166
6167 @option{-O} also turns on @option{-fomit-frame-pointer} on machines
6168 where doing so does not interfere with debugging.
6169
6170 @item -O2
6171 @opindex O2
6172 Optimize even more. GCC performs nearly all supported optimizations
6173 that do not involve a space-speed tradeoff.
6174 As compared to @option{-O}, this option increases both compilation time
6175 and the performance of the generated code.
6176
6177 @option{-O2} turns on all optimization flags specified by @option{-O}. It
6178 also turns on the following optimization flags:
6179 @gccoptlist{-fthread-jumps @gol
6180 -falign-functions -falign-jumps @gol
6181 -falign-loops -falign-labels @gol
6182 -fcaller-saves @gol
6183 -fcrossjumping @gol
6184 -fcse-follow-jumps -fcse-skip-blocks @gol
6185 -fdelete-null-pointer-checks @gol
6186 -fdevirtualize @gol
6187 -fexpensive-optimizations @gol
6188 -fgcse -fgcse-lm @gol
6189 -finline-small-functions @gol
6190 -findirect-inlining @gol
6191 -fipa-sra @gol
6192 -foptimize-sibling-calls @gol
6193 -fpartial-inlining @gol
6194 -fpeephole2 @gol
6195 -fregmove @gol
6196 -freorder-blocks -freorder-functions @gol
6197 -frerun-cse-after-loop @gol
6198 -fsched-interblock -fsched-spec @gol
6199 -fschedule-insns -fschedule-insns2 @gol
6200 -fstrict-aliasing -fstrict-overflow @gol
6201 -ftree-switch-conversion -ftree-tail-merge @gol
6202 -ftree-pre @gol
6203 -ftree-vrp}
6204
6205 Please note the warning under @option{-fgcse} about
6206 invoking @option{-O2} on programs that use computed gotos.
6207
6208 @item -O3
6209 @opindex O3
6210 Optimize yet more. @option{-O3} turns on all optimizations specified
6211 by @option{-O2} and also turns on the @option{-finline-functions},
6212 @option{-funswitch-loops}, @option{-fpredictive-commoning},
6213 @option{-fgcse-after-reload}, @option{-ftree-vectorize} and
6214 @option{-fipa-cp-clone} options.
6215
6216 @item -O0
6217 @opindex O0
6218 Reduce compilation time and make debugging produce the expected
6219 results. This is the default.
6220
6221 @item -Os
6222 @opindex Os
6223 Optimize for size. @option{-Os} enables all @option{-O2} optimizations that
6224 do not typically increase code size. It also performs further
6225 optimizations designed to reduce code size.
6226
6227 @option{-Os} disables the following optimization flags:
6228 @gccoptlist{-falign-functions -falign-jumps -falign-loops @gol
6229 -falign-labels -freorder-blocks -freorder-blocks-and-partition @gol
6230 -fprefetch-loop-arrays -ftree-vect-loop-version}
6231
6232 @item -Ofast
6233 @opindex Ofast
6234 Disregard strict standards compliance. @option{-Ofast} enables all
6235 @option{-O3} optimizations. It also enables optimizations that are not
6236 valid for all standard compliant programs.
6237 It turns on @option{-ffast-math} and the Fortran-specific
6238 @option{-fno-protect-parens} and @option{-fstack-arrays}.
6239
6240 If you use multiple @option{-O} options, with or without level numbers,
6241 the last such option is the one that is effective.
6242 @end table
6243
6244 Options of the form @option{-f@var{flag}} specify machine-independent
6245 flags. Most flags have both positive and negative forms; the negative
6246 form of @option{-ffoo} would be @option{-fno-foo}. In the table
6247 below, only one of the forms is listed---the one you typically will
6248 use. You can figure out the other form by either removing @samp{no-}
6249 or adding it.
6250
6251 The following options control specific optimizations. They are either
6252 activated by @option{-O} options or are related to ones that are. You
6253 can use the following flags in the rare cases when ``fine-tuning'' of
6254 optimizations to be performed is desired.
6255
6256 @table @gcctabopt
6257 @item -fno-default-inline
6258 @opindex fno-default-inline
6259 Do not make member functions inline by default merely because they are
6260 defined inside the class scope (C++ only). Otherwise, when you specify
6261 @w{@option{-O}}, member functions defined inside class scope are compiled
6262 inline by default; i.e., you don't need to add @samp{inline} in front of
6263 the member function name.
6264
6265 @item -fno-defer-pop
6266 @opindex fno-defer-pop
6267 Always pop the arguments to each function call as soon as that function
6268 returns. For machines which must pop arguments after a function call,
6269 the compiler normally lets arguments accumulate on the stack for several
6270 function calls and pops them all at once.
6271
6272 Disabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
6273
6274 @item -fforward-propagate
6275 @opindex fforward-propagate
6276 Perform a forward propagation pass on RTL@. The pass tries to combine two
6277 instructions and checks if the result can be simplified. If loop unrolling
6278 is active, two passes are performed and the second is scheduled after
6279 loop unrolling.
6280
6281 This option is enabled by default at optimization levels @option{-O},
6282 @option{-O2}, @option{-O3}, @option{-Os}.
6283
6284 @item -ffp-contract=@var{style}
6285 @opindex ffp-contract
6286 @option{-ffp-contract=off} disables floating-point expression contraction.
6287 @option{-ffp-contract=fast} enables floating-point expression contraction
6288 such as forming of fused multiply-add operations if the target has
6289 native support for them.
6290 @option{-ffp-contract=on} enables floating-point expression contraction
6291 if allowed by the language standard. This is currently not implemented
6292 and treated equal to @option{-ffp-contract=off}.
6293
6294 The default is @option{-ffp-contract=fast}.
6295
6296 @item -fomit-frame-pointer
6297 @opindex fomit-frame-pointer
6298 Don't keep the frame pointer in a register for functions that
6299 don't need one. This avoids the instructions to save, set up and
6300 restore frame pointers; it also makes an extra register available
6301 in many functions. @strong{It also makes debugging impossible on
6302 some machines.}
6303
6304 On some machines, such as the VAX, this flag has no effect, because
6305 the standard calling sequence automatically handles the frame pointer
6306 and nothing is saved by pretending it doesn't exist. The
6307 machine-description macro @code{FRAME_POINTER_REQUIRED} controls
6308 whether a target machine supports this flag. @xref{Registers,,Register
6309 Usage, gccint, GNU Compiler Collection (GCC) Internals}.
6310
6311 Starting with GCC version 4.6, the default setting (when not optimizing for
6312 size) for 32-bit Linux x86 and 32-bit Darwin x86 targets has been changed to
6313 @option{-fomit-frame-pointer}. The default can be reverted to
6314 @option{-fno-omit-frame-pointer} by configuring GCC with the
6315 @option{--enable-frame-pointer} configure option.
6316
6317 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
6318
6319 @item -foptimize-sibling-calls
6320 @opindex foptimize-sibling-calls
6321 Optimize sibling and tail recursive calls.
6322
6323 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
6324
6325 @item -fno-inline
6326 @opindex fno-inline
6327 Don't pay attention to the @code{inline} keyword. Normally this option
6328 is used to keep the compiler from expanding any functions inline.
6329 Note that if you are not optimizing, no functions can be expanded inline.
6330
6331 @item -finline-small-functions
6332 @opindex finline-small-functions
6333 Integrate functions into their callers when their body is smaller than expected
6334 function call code (so overall size of program gets smaller). The compiler
6335 heuristically decides which functions are simple enough to be worth integrating
6336 in this way.
6337
6338 Enabled at level @option{-O2}.
6339
6340 @item -findirect-inlining
6341 @opindex findirect-inlining
6342 Inline also indirect calls that are discovered to be known at compile
6343 time thanks to previous inlining. This option has any effect only
6344 when inlining itself is turned on by the @option{-finline-functions}
6345 or @option{-finline-small-functions} options.
6346
6347 Enabled at level @option{-O2}.
6348
6349 @item -finline-functions
6350 @opindex finline-functions
6351 Integrate all simple functions into their callers. The compiler
6352 heuristically decides which functions are simple enough to be worth
6353 integrating in this way.
6354
6355 If all calls to a given function are integrated, and the function is
6356 declared @code{static}, then the function is normally not output as
6357 assembler code in its own right.
6358
6359 Enabled at level @option{-O3}.
6360
6361 @item -finline-functions-called-once
6362 @opindex finline-functions-called-once
6363 Consider all @code{static} functions called once for inlining into their
6364 caller even if they are not marked @code{inline}. If a call to a given
6365 function is integrated, then the function is not output as assembler code
6366 in its own right.
6367
6368 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3} and @option{-Os}.
6369
6370 @item -fearly-inlining
6371 @opindex fearly-inlining
6372 Inline functions marked by @code{always_inline} and functions whose body seems
6373 smaller than the function call overhead early before doing
6374 @option{-fprofile-generate} instrumentation and real inlining pass. Doing so
6375 makes profiling significantly cheaper and usually inlining faster on programs
6376 having large chains of nested wrapper functions.
6377
6378 Enabled by default.
6379
6380 @item -fipa-sra
6381 @opindex fipa-sra
6382 Perform interprocedural scalar replacement of aggregates, removal of
6383 unused parameters and replacement of parameters passed by reference
6384 by parameters passed by value.
6385
6386 Enabled at levels @option{-O2}, @option{-O3} and @option{-Os}.
6387
6388 @item -finline-limit=@var{n}
6389 @opindex finline-limit
6390 By default, GCC limits the size of functions that can be inlined. This flag
6391 allows coarse control of this limit. @var{n} is the size of functions that
6392 can be inlined in number of pseudo instructions.
6393
6394 Inlining is actually controlled by a number of parameters, which may be
6395 specified individually by using @option{--param @var{name}=@var{value}}.
6396 The @option{-finline-limit=@var{n}} option sets some of these parameters
6397 as follows:
6398
6399 @table @gcctabopt
6400 @item max-inline-insns-single
6401 is set to @var{n}/2.
6402 @item max-inline-insns-auto
6403 is set to @var{n}/2.
6404 @end table
6405
6406 See below for a documentation of the individual
6407 parameters controlling inlining and for the defaults of these parameters.
6408
6409 @emph{Note:} there may be no value to @option{-finline-limit} that results
6410 in default behavior.
6411
6412 @emph{Note:} pseudo instruction represents, in this particular context, an
6413 abstract measurement of function's size. In no way does it represent a count
6414 of assembly instructions and as such its exact meaning might change from one
6415 release to an another.
6416
6417 @item -fno-keep-inline-dllexport
6418 @opindex -fno-keep-inline-dllexport
6419 This is a more fine-grained version of @option{-fkeep-inline-functions},
6420 which applies only to functions that are declared using the @code{dllexport}
6421 attribute or declspec (@xref{Function Attributes,,Declaring Attributes of
6422 Functions}.)
6423
6424 @item -fkeep-inline-functions
6425 @opindex fkeep-inline-functions
6426 In C, emit @code{static} functions that are declared @code{inline}
6427 into the object file, even if the function has been inlined into all
6428 of its callers. This switch does not affect functions using the
6429 @code{extern inline} extension in GNU C90@. In C++, emit any and all
6430 inline functions into the object file.
6431
6432 @item -fkeep-static-consts
6433 @opindex fkeep-static-consts
6434 Emit variables declared @code{static const} when optimization isn't turned
6435 on, even if the variables aren't referenced.
6436
6437 GCC enables this option by default. If you want to force the compiler to
6438 check if the variable was referenced, regardless of whether or not
6439 optimization is turned on, use the @option{-fno-keep-static-consts} option.
6440
6441 @item -fmerge-constants
6442 @opindex fmerge-constants
6443 Attempt to merge identical constants (string constants and floating point
6444 constants) across compilation units.
6445
6446 This option is the default for optimized compilation if the assembler and
6447 linker support it. Use @option{-fno-merge-constants} to inhibit this
6448 behavior.
6449
6450 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
6451
6452 @item -fmerge-all-constants
6453 @opindex fmerge-all-constants
6454 Attempt to merge identical constants and identical variables.
6455
6456 This option implies @option{-fmerge-constants}. In addition to
6457 @option{-fmerge-constants} this considers e.g.@: even constant initialized
6458 arrays or initialized constant variables with integral or floating point
6459 types. Languages like C or C++ require each variable, including multiple
6460 instances of the same variable in recursive calls, to have distinct locations,
6461 so using this option will result in non-conforming
6462 behavior.
6463
6464 @item -fmodulo-sched
6465 @opindex fmodulo-sched
6466 Perform swing modulo scheduling immediately before the first scheduling
6467 pass. This pass looks at innermost loops and reorders their
6468 instructions by overlapping different iterations.
6469
6470 @item -fmodulo-sched-allow-regmoves
6471 @opindex fmodulo-sched-allow-regmoves
6472 Perform more aggressive SMS based modulo scheduling with register moves
6473 allowed. By setting this flag certain anti-dependences edges will be
6474 deleted which will trigger the generation of reg-moves based on the
6475 life-range analysis. This option is effective only with
6476 @option{-fmodulo-sched} enabled.
6477
6478 @item -fno-branch-count-reg
6479 @opindex fno-branch-count-reg
6480 Do not use ``decrement and branch'' instructions on a count register,
6481 but instead generate a sequence of instructions that decrement a
6482 register, compare it against zero, then branch based upon the result.
6483 This option is only meaningful on architectures that support such
6484 instructions, which include x86, PowerPC, IA-64 and S/390.
6485
6486 The default is @option{-fbranch-count-reg}.
6487
6488 @item -fno-function-cse
6489 @opindex fno-function-cse
6490 Do not put function addresses in registers; make each instruction that
6491 calls a constant function contain the function's address explicitly.
6492
6493 This option results in less efficient code, but some strange hacks
6494 that alter the assembler output may be confused by the optimizations
6495 performed when this option is not used.
6496
6497 The default is @option{-ffunction-cse}
6498
6499 @item -fno-zero-initialized-in-bss
6500 @opindex fno-zero-initialized-in-bss
6501 If the target supports a BSS section, GCC by default puts variables that
6502 are initialized to zero into BSS@. This can save space in the resulting
6503 code.
6504
6505 This option turns off this behavior because some programs explicitly
6506 rely on variables going to the data section. E.g., so that the
6507 resulting executable can find the beginning of that section and/or make
6508 assumptions based on that.
6509
6510 The default is @option{-fzero-initialized-in-bss}.
6511
6512 @item -fmudflap -fmudflapth -fmudflapir
6513 @opindex fmudflap
6514 @opindex fmudflapth
6515 @opindex fmudflapir
6516 @cindex bounds checking
6517 @cindex mudflap
6518 For front-ends that support it (C and C++), instrument all risky
6519 pointer/array dereferencing operations, some standard library
6520 string/heap functions, and some other associated constructs with
6521 range/validity tests. Modules so instrumented should be immune to
6522 buffer overflows, invalid heap use, and some other classes of C/C++
6523 programming errors. The instrumentation relies on a separate runtime
6524 library (@file{libmudflap}), which will be linked into a program if
6525 @option{-fmudflap} is given at link time. Run-time behavior of the
6526 instrumented program is controlled by the @env{MUDFLAP_OPTIONS}
6527 environment variable. See @code{env MUDFLAP_OPTIONS=-help a.out}
6528 for its options.
6529
6530 Use @option{-fmudflapth} instead of @option{-fmudflap} to compile and to
6531 link if your program is multi-threaded. Use @option{-fmudflapir}, in
6532 addition to @option{-fmudflap} or @option{-fmudflapth}, if
6533 instrumentation should ignore pointer reads. This produces less
6534 instrumentation (and therefore faster execution) and still provides
6535 some protection against outright memory corrupting writes, but allows
6536 erroneously read data to propagate within a program.
6537
6538 @item -fthread-jumps
6539 @opindex fthread-jumps
6540 Perform optimizations where we check to see if a jump branches to a
6541 location where another comparison subsumed by the first is found. If
6542 so, the first branch is redirected to either the destination of the
6543 second branch or a point immediately following it, depending on whether
6544 the condition is known to be true or false.
6545
6546 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
6547
6548 @item -fsplit-wide-types
6549 @opindex fsplit-wide-types
6550 When using a type that occupies multiple registers, such as @code{long
6551 long} on a 32-bit system, split the registers apart and allocate them
6552 independently. This normally generates better code for those types,
6553 but may make debugging more difficult.
6554
6555 Enabled at levels @option{-O}, @option{-O2}, @option{-O3},
6556 @option{-Os}.
6557
6558 @item -fcse-follow-jumps
6559 @opindex fcse-follow-jumps
6560 In common subexpression elimination (CSE), scan through jump instructions
6561 when the target of the jump is not reached by any other path. For
6562 example, when CSE encounters an @code{if} statement with an
6563 @code{else} clause, CSE will follow the jump when the condition
6564 tested is false.
6565
6566 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
6567
6568 @item -fcse-skip-blocks
6569 @opindex fcse-skip-blocks
6570 This is similar to @option{-fcse-follow-jumps}, but causes CSE to
6571 follow jumps which conditionally skip over blocks. When CSE
6572 encounters a simple @code{if} statement with no else clause,
6573 @option{-fcse-skip-blocks} causes CSE to follow the jump around the
6574 body of the @code{if}.
6575
6576 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
6577
6578 @item -frerun-cse-after-loop
6579 @opindex frerun-cse-after-loop
6580 Re-run common subexpression elimination after loop optimizations has been
6581 performed.
6582
6583 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
6584
6585 @item -fgcse
6586 @opindex fgcse
6587 Perform a global common subexpression elimination pass.
6588 This pass also performs global constant and copy propagation.
6589
6590 @emph{Note:} When compiling a program using computed gotos, a GCC
6591 extension, you may get better runtime performance if you disable
6592 the global common subexpression elimination pass by adding
6593 @option{-fno-gcse} to the command line.
6594
6595 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
6596
6597 @item -fgcse-lm
6598 @opindex fgcse-lm
6599 When @option{-fgcse-lm} is enabled, global common subexpression elimination will
6600 attempt to move loads which are only killed by stores into themselves. This
6601 allows a loop containing a load/store sequence to be changed to a load outside
6602 the loop, and a copy/store within the loop.
6603
6604 Enabled by default when gcse is enabled.
6605
6606 @item -fgcse-sm
6607 @opindex fgcse-sm
6608 When @option{-fgcse-sm} is enabled, a store motion pass is run after
6609 global common subexpression elimination. This pass will attempt to move
6610 stores out of loops. When used in conjunction with @option{-fgcse-lm},
6611 loops containing a load/store sequence can be changed to a load before
6612 the loop and a store after the loop.
6613
6614 Not enabled at any optimization level.
6615
6616 @item -fgcse-las
6617 @opindex fgcse-las
6618 When @option{-fgcse-las} is enabled, the global common subexpression
6619 elimination pass eliminates redundant loads that come after stores to the
6620 same memory location (both partial and full redundancies).
6621
6622 Not enabled at any optimization level.
6623
6624 @item -fgcse-after-reload
6625 @opindex fgcse-after-reload
6626 When @option{-fgcse-after-reload} is enabled, a redundant load elimination
6627 pass is performed after reload. The purpose of this pass is to cleanup
6628 redundant spilling.
6629
6630 @item -funsafe-loop-optimizations
6631 @opindex funsafe-loop-optimizations
6632 If given, the loop optimizer will assume that loop indices do not
6633 overflow, and that the loops with nontrivial exit condition are not
6634 infinite. This enables a wider range of loop optimizations even if
6635 the loop optimizer itself cannot prove that these assumptions are valid.
6636 Using @option{-Wunsafe-loop-optimizations}, the compiler will warn you
6637 if it finds this kind of loop.
6638
6639 @item -fcrossjumping
6640 @opindex fcrossjumping
6641 Perform cross-jumping transformation. This transformation unifies equivalent code and save code size. The
6642 resulting code may or may not perform better than without cross-jumping.
6643
6644 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
6645
6646 @item -fauto-inc-dec
6647 @opindex fauto-inc-dec
6648 Combine increments or decrements of addresses with memory accesses.
6649 This pass is always skipped on architectures that do not have
6650 instructions to support this. Enabled by default at @option{-O} and
6651 higher on architectures that support this.
6652
6653 @item -fdce
6654 @opindex fdce
6655 Perform dead code elimination (DCE) on RTL@.
6656 Enabled by default at @option{-O} and higher.
6657
6658 @item -fdse
6659 @opindex fdse
6660 Perform dead store elimination (DSE) on RTL@.
6661 Enabled by default at @option{-O} and higher.
6662
6663 @item -fif-conversion
6664 @opindex fif-conversion
6665 Attempt to transform conditional jumps into branch-less equivalents. This
6666 include use of conditional moves, min, max, set flags and abs instructions, and
6667 some tricks doable by standard arithmetics. The use of conditional execution
6668 on chips where it is available is controlled by @code{if-conversion2}.
6669
6670 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
6671
6672 @item -fif-conversion2
6673 @opindex fif-conversion2
6674 Use conditional execution (where available) to transform conditional jumps into
6675 branch-less equivalents.
6676
6677 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
6678
6679 @item -fdelete-null-pointer-checks
6680 @opindex fdelete-null-pointer-checks
6681 Assume that programs cannot safely dereference null pointers, and that
6682 no code or data element resides there. This enables simple constant
6683 folding optimizations at all optimization levels. In addition, other
6684 optimization passes in GCC use this flag to control global dataflow
6685 analyses that eliminate useless checks for null pointers; these assume
6686 that if a pointer is checked after it has already been dereferenced,
6687 it cannot be null.
6688
6689 Note however that in some environments this assumption is not true.
6690 Use @option{-fno-delete-null-pointer-checks} to disable this optimization
6691 for programs which depend on that behavior.
6692
6693 Some targets, especially embedded ones, disable this option at all levels.
6694 Otherwise it is enabled at all levels: @option{-O0}, @option{-O1},
6695 @option{-O2}, @option{-O3}, @option{-Os}. Passes that use the information
6696 are enabled independently at different optimization levels.
6697
6698 @item -fdevirtualize
6699 @opindex fdevirtualize
6700 Attempt to convert calls to virtual functions to direct calls. This
6701 is done both within a procedure and interprocedurally as part of
6702 indirect inlining (@code{-findirect-inlining}) and interprocedural constant
6703 propagation (@option{-fipa-cp}).
6704 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
6705
6706 @item -fexpensive-optimizations
6707 @opindex fexpensive-optimizations
6708 Perform a number of minor optimizations that are relatively expensive.
6709
6710 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
6711
6712 @item -foptimize-register-move
6713 @itemx -fregmove
6714 @opindex foptimize-register-move
6715 @opindex fregmove
6716 Attempt to reassign register numbers in move instructions and as
6717 operands of other simple instructions in order to maximize the amount of
6718 register tying. This is especially helpful on machines with two-operand
6719 instructions.
6720
6721 Note @option{-fregmove} and @option{-foptimize-register-move} are the same
6722 optimization.
6723
6724 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
6725
6726 @item -fira-algorithm=@var{algorithm}
6727 Use specified coloring algorithm for the integrated register
6728 allocator. The @var{algorithm} argument should be @code{priority} or
6729 @code{CB}. The first algorithm specifies Chow's priority coloring,
6730 the second one specifies Chaitin-Briggs coloring. The second
6731 algorithm can be unimplemented for some architectures. If it is
6732 implemented, it is the default because Chaitin-Briggs coloring as a
6733 rule generates a better code.
6734
6735 @item -fira-region=@var{region}
6736 Use specified regions for the integrated register allocator. The
6737 @var{region} argument should be one of @code{all}, @code{mixed}, or
6738 @code{one}. The first value means using all loops as register
6739 allocation regions, the second value which is enabled by default when
6740 compiling with optimization for speed (@option{-O}, @option{-O2},
6741 @dots{}) means using all loops except for loops with small register
6742 pressure as the regions, and third one which is enabled by default for
6743 @option{-Os} or @option{-O0} means using all function as a single
6744 region. The first value can give best result for machines with small
6745 size and irregular register set, the third one results in faster and
6746 generates decent code and the smallest size code, and the second value
6747 usually give the best results in most cases and for most
6748 architectures.
6749
6750 @item -fira-loop-pressure
6751 @opindex fira-loop-pressure
6752 Use IRA to evaluate register pressure in loops for decision to move
6753 loop invariants. Usage of this option usually results in generation
6754 of faster and smaller code on machines with big register files (>= 32
6755 registers) but it can slow compiler down.
6756
6757 This option is enabled at level @option{-O3} for some targets.
6758
6759 @item -fno-ira-share-save-slots
6760 @opindex fno-ira-share-save-slots
6761 Switch off sharing stack slots used for saving call used hard
6762 registers living through a call. Each hard register will get a
6763 separate stack slot and as a result function stack frame will be
6764 bigger.
6765
6766 @item -fno-ira-share-spill-slots
6767 @opindex fno-ira-share-spill-slots
6768 Switch off sharing stack slots allocated for pseudo-registers. Each
6769 pseudo-register which did not get a hard register will get a separate
6770 stack slot and as a result function stack frame will be bigger.
6771
6772 @item -fira-verbose=@var{n}
6773 @opindex fira-verbose
6774 Set up how verbose dump file for the integrated register allocator
6775 will be. Default value is 5. If the value is greater or equal to 10,
6776 the dump file will be stderr as if the value were @var{n} minus 10.
6777
6778 @item -fdelayed-branch
6779 @opindex fdelayed-branch
6780 If supported for the target machine, attempt to reorder instructions
6781 to exploit instruction slots available after delayed branch
6782 instructions.
6783
6784 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
6785
6786 @item -fschedule-insns
6787 @opindex fschedule-insns
6788 If supported for the target machine, attempt to reorder instructions to
6789 eliminate execution stalls due to required data being unavailable. This
6790 helps machines that have slow floating point or memory load instructions
6791 by allowing other instructions to be issued until the result of the load
6792 or floating point instruction is required.
6793
6794 Enabled at levels @option{-O2}, @option{-O3}.
6795
6796 @item -fschedule-insns2
6797 @opindex fschedule-insns2
6798 Similar to @option{-fschedule-insns}, but requests an additional pass of
6799 instruction scheduling after register allocation has been done. This is
6800 especially useful on machines with a relatively small number of
6801 registers and where memory load instructions take more than one cycle.
6802
6803 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
6804
6805 @item -fno-sched-interblock
6806 @opindex fno-sched-interblock
6807 Don't schedule instructions across basic blocks. This is normally
6808 enabled by default when scheduling before register allocation, i.e.@:
6809 with @option{-fschedule-insns} or at @option{-O2} or higher.
6810
6811 @item -fno-sched-spec
6812 @opindex fno-sched-spec
6813 Don't allow speculative motion of non-load instructions. This is normally
6814 enabled by default when scheduling before register allocation, i.e.@:
6815 with @option{-fschedule-insns} or at @option{-O2} or higher.
6816
6817 @item -fsched-pressure
6818 @opindex fsched-pressure
6819 Enable register pressure sensitive insn scheduling before the register
6820 allocation. This only makes sense when scheduling before register
6821 allocation is enabled, i.e.@: with @option{-fschedule-insns} or at
6822 @option{-O2} or higher. Usage of this option can improve the
6823 generated code and decrease its size by preventing register pressure
6824 increase above the number of available hard registers and as a
6825 consequence register spills in the register allocation.
6826
6827 @item -fsched-spec-load
6828 @opindex fsched-spec-load
6829 Allow speculative motion of some load instructions. This only makes
6830 sense when scheduling before register allocation, i.e.@: with
6831 @option{-fschedule-insns} or at @option{-O2} or higher.
6832
6833 @item -fsched-spec-load-dangerous
6834 @opindex fsched-spec-load-dangerous
6835 Allow speculative motion of more load instructions. This only makes
6836 sense when scheduling before register allocation, i.e.@: with
6837 @option{-fschedule-insns} or at @option{-O2} or higher.
6838
6839 @item -fsched-stalled-insns
6840 @itemx -fsched-stalled-insns=@var{n}
6841 @opindex fsched-stalled-insns
6842 Define how many insns (if any) can be moved prematurely from the queue
6843 of stalled insns into the ready list, during the second scheduling pass.
6844 @option{-fno-sched-stalled-insns} means that no insns will be moved
6845 prematurely, @option{-fsched-stalled-insns=0} means there is no limit
6846 on how many queued insns can be moved prematurely.
6847 @option{-fsched-stalled-insns} without a value is equivalent to
6848 @option{-fsched-stalled-insns=1}.
6849
6850 @item -fsched-stalled-insns-dep
6851 @itemx -fsched-stalled-insns-dep=@var{n}
6852 @opindex fsched-stalled-insns-dep
6853 Define how many insn groups (cycles) will be examined for a dependency
6854 on a stalled insn that is candidate for premature removal from the queue
6855 of stalled insns. This has an effect only during the second scheduling pass,
6856 and only if @option{-fsched-stalled-insns} is used.
6857 @option{-fno-sched-stalled-insns-dep} is equivalent to
6858 @option{-fsched-stalled-insns-dep=0}.
6859 @option{-fsched-stalled-insns-dep} without a value is equivalent to
6860 @option{-fsched-stalled-insns-dep=1}.
6861
6862 @item -fsched2-use-superblocks
6863 @opindex fsched2-use-superblocks
6864 When scheduling after register allocation, do use superblock scheduling
6865 algorithm. Superblock scheduling allows motion across basic block boundaries
6866 resulting on faster schedules. This option is experimental, as not all machine
6867 descriptions used by GCC model the CPU closely enough to avoid unreliable
6868 results from the algorithm.
6869
6870 This only makes sense when scheduling after register allocation, i.e.@: with
6871 @option{-fschedule-insns2} or at @option{-O2} or higher.
6872
6873 @item -fsched-group-heuristic
6874 @opindex fsched-group-heuristic
6875 Enable the group heuristic in the scheduler. This heuristic favors
6876 the instruction that belongs to a schedule group. This is enabled
6877 by default when scheduling is enabled, i.e.@: with @option{-fschedule-insns}
6878 or @option{-fschedule-insns2} or at @option{-O2} or higher.
6879
6880 @item -fsched-critical-path-heuristic
6881 @opindex fsched-critical-path-heuristic
6882 Enable the critical-path heuristic in the scheduler. This heuristic favors
6883 instructions on the critical path. This is enabled by default when
6884 scheduling is enabled, i.e.@: with @option{-fschedule-insns}
6885 or @option{-fschedule-insns2} or at @option{-O2} or higher.
6886
6887 @item -fsched-spec-insn-heuristic
6888 @opindex fsched-spec-insn-heuristic
6889 Enable the speculative instruction heuristic in the scheduler. This
6890 heuristic favors speculative instructions with greater dependency weakness.
6891 This is enabled by default when scheduling is enabled, i.e.@:
6892 with @option{-fschedule-insns} or @option{-fschedule-insns2}
6893 or at @option{-O2} or higher.
6894
6895 @item -fsched-rank-heuristic
6896 @opindex fsched-rank-heuristic
6897 Enable the rank heuristic in the scheduler. This heuristic favors
6898 the instruction belonging to a basic block with greater size or frequency.
6899 This is enabled by default when scheduling is enabled, i.e.@:
6900 with @option{-fschedule-insns} or @option{-fschedule-insns2} or
6901 at @option{-O2} or higher.
6902
6903 @item -fsched-last-insn-heuristic
6904 @opindex fsched-last-insn-heuristic
6905 Enable the last-instruction heuristic in the scheduler. This heuristic
6906 favors the instruction that is less dependent on the last instruction
6907 scheduled. This is enabled by default when scheduling is enabled,
6908 i.e.@: with @option{-fschedule-insns} or @option{-fschedule-insns2} or
6909 at @option{-O2} or higher.
6910
6911 @item -fsched-dep-count-heuristic
6912 @opindex fsched-dep-count-heuristic
6913 Enable the dependent-count heuristic in the scheduler. This heuristic
6914 favors the instruction that has more instructions depending on it.
6915 This is enabled by default when scheduling is enabled, i.e.@:
6916 with @option{-fschedule-insns} or @option{-fschedule-insns2} or
6917 at @option{-O2} or higher.
6918
6919 @item -freschedule-modulo-scheduled-loops
6920 @opindex freschedule-modulo-scheduled-loops
6921 The modulo scheduling comes before the traditional scheduling, if a loop
6922 was modulo scheduled we may want to prevent the later scheduling passes
6923 from changing its schedule, we use this option to control that.
6924
6925 @item -fselective-scheduling
6926 @opindex fselective-scheduling
6927 Schedule instructions using selective scheduling algorithm. Selective
6928 scheduling runs instead of the first scheduler pass.
6929
6930 @item -fselective-scheduling2
6931 @opindex fselective-scheduling2
6932 Schedule instructions using selective scheduling algorithm. Selective
6933 scheduling runs instead of the second scheduler pass.
6934
6935 @item -fsel-sched-pipelining
6936 @opindex fsel-sched-pipelining
6937 Enable software pipelining of innermost loops during selective scheduling.
6938 This option has no effect until one of @option{-fselective-scheduling} or
6939 @option{-fselective-scheduling2} is turned on.
6940
6941 @item -fsel-sched-pipelining-outer-loops
6942 @opindex fsel-sched-pipelining-outer-loops
6943 When pipelining loops during selective scheduling, also pipeline outer loops.
6944 This option has no effect until @option{-fsel-sched-pipelining} is turned on.
6945
6946 @item -fshrink-wrap
6947 @opindex fshrink-wrap
6948 Emit function prologues only before parts of the function that need it,
6949 rather than at the top of the function. This flag is enabled by default at
6950 @option{-O} and higher.
6951
6952 @item -fcaller-saves
6953 @opindex fcaller-saves
6954 Enable values to be allocated in registers that will be clobbered by
6955 function calls, by emitting extra instructions to save and restore the
6956 registers around such calls. Such allocation is done only when it
6957 seems to result in better code than would otherwise be produced.
6958
6959 This option is always enabled by default on certain machines, usually
6960 those which have no call-preserved registers to use instead.
6961
6962 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
6963
6964 @item -fcombine-stack-adjustments
6965 @opindex fcombine-stack-adjustments
6966 Tracks stack adjustments (pushes and pops) and stack memory references
6967 and then tries to find ways to combine them.
6968
6969 Enabled by default at @option{-O1} and higher.
6970
6971 @item -fconserve-stack
6972 @opindex fconserve-stack
6973 Attempt to minimize stack usage. The compiler will attempt to use less
6974 stack space, even if that makes the program slower. This option
6975 implies setting the @option{large-stack-frame} parameter to 100
6976 and the @option{large-stack-frame-growth} parameter to 400.
6977
6978 @item -ftree-reassoc
6979 @opindex ftree-reassoc
6980 Perform reassociation on trees. This flag is enabled by default
6981 at @option{-O} and higher.
6982
6983 @item -ftree-pre
6984 @opindex ftree-pre
6985 Perform partial redundancy elimination (PRE) on trees. This flag is
6986 enabled by default at @option{-O2} and @option{-O3}.
6987
6988 @item -ftree-forwprop
6989 @opindex ftree-forwprop
6990 Perform forward propagation on trees. This flag is enabled by default
6991 at @option{-O} and higher.
6992
6993 @item -ftree-fre
6994 @opindex ftree-fre
6995 Perform full redundancy elimination (FRE) on trees. The difference
6996 between FRE and PRE is that FRE only considers expressions
6997 that are computed on all paths leading to the redundant computation.
6998 This analysis is faster than PRE, though it exposes fewer redundancies.
6999 This flag is enabled by default at @option{-O} and higher.
7000
7001 @item -ftree-phiprop
7002 @opindex ftree-phiprop
7003 Perform hoisting of loads from conditional pointers on trees. This
7004 pass is enabled by default at @option{-O} and higher.
7005
7006 @item -ftree-copy-prop
7007 @opindex ftree-copy-prop
7008 Perform copy propagation on trees. This pass eliminates unnecessary
7009 copy operations. This flag is enabled by default at @option{-O} and
7010 higher.
7011
7012 @item -fipa-pure-const
7013 @opindex fipa-pure-const
7014 Discover which functions are pure or constant.
7015 Enabled by default at @option{-O} and higher.
7016
7017 @item -fipa-reference
7018 @opindex fipa-reference
7019 Discover which static variables do not escape cannot escape the
7020 compilation unit.
7021 Enabled by default at @option{-O} and higher.
7022
7023 @item -fipa-pta
7024 @opindex fipa-pta
7025 Perform interprocedural pointer analysis and interprocedural modification
7026 and reference analysis. This option can cause excessive memory and
7027 compile-time usage on large compilation units. It is not enabled by
7028 default at any optimization level.
7029
7030 @item -fipa-profile
7031 @opindex fipa-profile
7032 Perform interprocedural profile propagation. The functions called only from
7033 cold functions are marked as cold. Also functions executed once (such as
7034 @code{cold}, @code{noreturn}, static constructors or destructors) are identified. Cold
7035 functions and loop less parts of functions executed once are then optimized for
7036 size.
7037 Enabled by default at @option{-O} and higher.
7038
7039 @item -fipa-cp
7040 @opindex fipa-cp
7041 Perform interprocedural constant propagation.
7042 This optimization analyzes the program to determine when values passed
7043 to functions are constants and then optimizes accordingly.
7044 This optimization can substantially increase performance
7045 if the application has constants passed to functions.
7046 This flag is enabled by default at @option{-O2}, @option{-Os} and @option{-O3}.
7047
7048 @item -fipa-cp-clone
7049 @opindex fipa-cp-clone
7050 Perform function cloning to make interprocedural constant propagation stronger.
7051 When enabled, interprocedural constant propagation will perform function cloning
7052 when externally visible function can be called with constant arguments.
7053 Because this optimization can create multiple copies of functions,
7054 it may significantly increase code size
7055 (see @option{--param ipcp-unit-growth=@var{value}}).
7056 This flag is enabled by default at @option{-O3}.
7057
7058 @item -fipa-matrix-reorg
7059 @opindex fipa-matrix-reorg
7060 Perform matrix flattening and transposing.
7061 Matrix flattening tries to replace an @math{m}-dimensional matrix
7062 with its equivalent @math{n}-dimensional matrix, where @math{n < m}.
7063 This reduces the level of indirection needed for accessing the elements
7064 of the matrix. The second optimization is matrix transposing that
7065 attempts to change the order of the matrix's dimensions in order to
7066 improve cache locality.
7067 Both optimizations need the @option{-fwhole-program} flag.
7068 Transposing is enabled only if profiling information is available.
7069
7070 @item -ftree-sink
7071 @opindex ftree-sink
7072 Perform forward store motion on trees. This flag is
7073 enabled by default at @option{-O} and higher.
7074
7075 @item -ftree-bit-ccp
7076 @opindex ftree-bit-ccp
7077 Perform sparse conditional bit constant propagation on trees and propagate
7078 pointer alignment information.
7079 This pass only operates on local scalar variables and is enabled by default
7080 at @option{-O} and higher. It requires that @option{-ftree-ccp} is enabled.
7081
7082 @item -ftree-ccp
7083 @opindex ftree-ccp
7084 Perform sparse conditional constant propagation (CCP) on trees. This
7085 pass only operates on local scalar variables and is enabled by default
7086 at @option{-O} and higher.
7087
7088 @item -ftree-switch-conversion
7089 Perform conversion of simple initializations in a switch to
7090 initializations from a scalar array. This flag is enabled by default
7091 at @option{-O2} and higher.
7092
7093 @item -ftree-tail-merge
7094 Look for identical code sequences. When found, replace one with a jump to the
7095 other. This optimization is known as tail merging or cross jumping. This flag
7096 is enabled by default at @option{-O2} and higher. The run time of this pass can
7097 be limited using @option{max-tail-merge-comparisons} parameter and
7098 @option{max-tail-merge-iterations} parameter.
7099
7100 @item -ftree-dce
7101 @opindex ftree-dce
7102 Perform dead code elimination (DCE) on trees. This flag is enabled by
7103 default at @option{-O} and higher.
7104
7105 @item -ftree-builtin-call-dce
7106 @opindex ftree-builtin-call-dce
7107 Perform conditional dead code elimination (DCE) for calls to builtin functions
7108 that may set @code{errno} but are otherwise side-effect free. This flag is
7109 enabled by default at @option{-O2} and higher if @option{-Os} is not also
7110 specified.
7111
7112 @item -ftree-dominator-opts
7113 @opindex ftree-dominator-opts
7114 Perform a variety of simple scalar cleanups (constant/copy
7115 propagation, redundancy elimination, range propagation and expression
7116 simplification) based on a dominator tree traversal. This also
7117 performs jump threading (to reduce jumps to jumps). This flag is
7118 enabled by default at @option{-O} and higher.
7119
7120 @item -ftree-dse
7121 @opindex ftree-dse
7122 Perform dead store elimination (DSE) on trees. A dead store is a store into
7123 a memory location which will later be overwritten by another store without
7124 any intervening loads. In this case the earlier store can be deleted. This
7125 flag is enabled by default at @option{-O} and higher.
7126
7127 @item -ftree-ch
7128 @opindex ftree-ch
7129 Perform loop header copying on trees. This is beneficial since it increases
7130 effectiveness of code motion optimizations. It also saves one jump. This flag
7131 is enabled by default at @option{-O} and higher. It is not enabled
7132 for @option{-Os}, since it usually increases code size.
7133
7134 @item -ftree-loop-optimize
7135 @opindex ftree-loop-optimize
7136 Perform loop optimizations on trees. This flag is enabled by default
7137 at @option{-O} and higher.
7138
7139 @item -ftree-loop-linear
7140 @opindex ftree-loop-linear
7141 Perform loop interchange transformations on tree. Same as
7142 @option{-floop-interchange}. To use this code transformation, GCC has
7143 to be configured with @option{--with-ppl} and @option{--with-cloog} to
7144 enable the Graphite loop transformation infrastructure.
7145
7146 @item -floop-interchange
7147 @opindex floop-interchange
7148 Perform loop interchange transformations on loops. Interchanging two
7149 nested loops switches the inner and outer loops. For example, given a
7150 loop like:
7151 @smallexample
7152 DO J = 1, M
7153 DO I = 1, N
7154 A(J, I) = A(J, I) * C
7155 ENDDO
7156 ENDDO
7157 @end smallexample
7158 loop interchange will transform the loop as if the user had written:
7159 @smallexample
7160 DO I = 1, N
7161 DO J = 1, M
7162 A(J, I) = A(J, I) * C
7163 ENDDO
7164 ENDDO
7165 @end smallexample
7166 which can be beneficial when @code{N} is larger than the caches,
7167 because in Fortran, the elements of an array are stored in memory
7168 contiguously by column, and the original loop iterates over rows,
7169 potentially creating at each access a cache miss. This optimization
7170 applies to all the languages supported by GCC and is not limited to
7171 Fortran. To use this code transformation, GCC has to be configured
7172 with @option{--with-ppl} and @option{--with-cloog} to enable the
7173 Graphite loop transformation infrastructure.
7174
7175 @item -floop-strip-mine
7176 @opindex floop-strip-mine
7177 Perform loop strip mining transformations on loops. Strip mining
7178 splits a loop into two nested loops. The outer loop has strides
7179 equal to the strip size and the inner loop has strides of the
7180 original loop within a strip. The strip length can be changed
7181 using the @option{loop-block-tile-size} parameter. For example,
7182 given a loop like:
7183 @smallexample
7184 DO I = 1, N
7185 A(I) = A(I) + C
7186 ENDDO
7187 @end smallexample
7188 loop strip mining will transform the loop as if the user had written:
7189 @smallexample
7190 DO II = 1, N, 51
7191 DO I = II, min (II + 50, N)
7192 A(I) = A(I) + C
7193 ENDDO
7194 ENDDO
7195 @end smallexample
7196 This optimization applies to all the languages supported by GCC and is
7197 not limited to Fortran. To use this code transformation, GCC has to
7198 be configured with @option{--with-ppl} and @option{--with-cloog} to
7199 enable the Graphite loop transformation infrastructure.
7200
7201 @item -floop-block
7202 @opindex floop-block
7203 Perform loop blocking transformations on loops. Blocking strip mines
7204 each loop in the loop nest such that the memory accesses of the
7205 element loops fit inside caches. The strip length can be changed
7206 using the @option{loop-block-tile-size} parameter. For example, given
7207 a loop like:
7208 @smallexample
7209 DO I = 1, N
7210 DO J = 1, M
7211 A(J, I) = B(I) + C(J)
7212 ENDDO
7213 ENDDO
7214 @end smallexample
7215 loop blocking will transform the loop as if the user had written:
7216 @smallexample
7217 DO II = 1, N, 51
7218 DO JJ = 1, M, 51
7219 DO I = II, min (II + 50, N)
7220 DO J = JJ, min (JJ + 50, M)
7221 A(J, I) = B(I) + C(J)
7222 ENDDO
7223 ENDDO
7224 ENDDO
7225 ENDDO
7226 @end smallexample
7227 which can be beneficial when @code{M} is larger than the caches,
7228 because the innermost loop will iterate over a smaller amount of data
7229 that can be kept in the caches. This optimization applies to all the
7230 languages supported by GCC and is not limited to Fortran. To use this
7231 code transformation, GCC has to be configured with @option{--with-ppl}
7232 and @option{--with-cloog} to enable the Graphite loop transformation
7233 infrastructure.
7234
7235 @item -fgraphite-identity
7236 @opindex fgraphite-identity
7237 Enable the identity transformation for graphite. For every SCoP we generate
7238 the polyhedral representation and transform it back to gimple. Using
7239 @option{-fgraphite-identity} we can check the costs or benefits of the
7240 GIMPLE -> GRAPHITE -> GIMPLE transformation. Some minimal optimizations
7241 are also performed by the code generator CLooG, like index splitting and
7242 dead code elimination in loops.
7243
7244 @item -floop-flatten
7245 @opindex floop-flatten
7246 Removes the loop nesting structure: transforms the loop nest into a
7247 single loop. This transformation can be useful to vectorize all the
7248 levels of the loop nest.
7249
7250 @item -floop-parallelize-all
7251 @opindex floop-parallelize-all
7252 Use the Graphite data dependence analysis to identify loops that can
7253 be parallelized. Parallelize all the loops that can be analyzed to
7254 not contain loop carried dependences without checking that it is
7255 profitable to parallelize the loops.
7256
7257 @item -fcheck-data-deps
7258 @opindex fcheck-data-deps
7259 Compare the results of several data dependence analyzers. This option
7260 is used for debugging the data dependence analyzers.
7261
7262 @item -ftree-loop-if-convert
7263 Attempt to transform conditional jumps in the innermost loops to
7264 branch-less equivalents. The intent is to remove control-flow from
7265 the innermost loops in order to improve the ability of the
7266 vectorization pass to handle these loops. This is enabled by default
7267 if vectorization is enabled.
7268
7269 @item -ftree-loop-if-convert-stores
7270 Attempt to also if-convert conditional jumps containing memory writes.
7271 This transformation can be unsafe for multi-threaded programs as it
7272 transforms conditional memory writes into unconditional memory writes.
7273 For example,
7274 @smallexample
7275 for (i = 0; i < N; i++)
7276 if (cond)
7277 A[i] = expr;
7278 @end smallexample
7279 would be transformed to
7280 @smallexample
7281 for (i = 0; i < N; i++)
7282 A[i] = cond ? expr : A[i];
7283 @end smallexample
7284 potentially producing data races.
7285
7286 @item -ftree-loop-distribution
7287 Perform loop distribution. This flag can improve cache performance on
7288 big loop bodies and allow further loop optimizations, like
7289 parallelization or vectorization, to take place. For example, the loop
7290 @smallexample
7291 DO I = 1, N
7292 A(I) = B(I) + C
7293 D(I) = E(I) * F
7294 ENDDO
7295 @end smallexample
7296 is transformed to
7297 @smallexample
7298 DO I = 1, N
7299 A(I) = B(I) + C
7300 ENDDO
7301 DO I = 1, N
7302 D(I) = E(I) * F
7303 ENDDO
7304 @end smallexample
7305
7306 @item -ftree-loop-distribute-patterns
7307 Perform loop distribution of patterns that can be code generated with
7308 calls to a library. This flag is enabled by default at @option{-O3}.
7309
7310 This pass distributes the initialization loops and generates a call to
7311 memset zero. For example, the loop
7312 @smallexample
7313 DO I = 1, N
7314 A(I) = 0
7315 B(I) = A(I) + I
7316 ENDDO
7317 @end smallexample
7318 is transformed to
7319 @smallexample
7320 DO I = 1, N
7321 A(I) = 0
7322 ENDDO
7323 DO I = 1, N
7324 B(I) = A(I) + I
7325 ENDDO
7326 @end smallexample
7327 and the initialization loop is transformed into a call to memset zero.
7328
7329 @item -ftree-loop-im
7330 @opindex ftree-loop-im
7331 Perform loop invariant motion on trees. This pass moves only invariants that
7332 would be hard to handle at RTL level (function calls, operations that expand to
7333 nontrivial sequences of insns). With @option{-funswitch-loops} it also moves
7334 operands of conditions that are invariant out of the loop, so that we can use
7335 just trivial invariantness analysis in loop unswitching. The pass also includes
7336 store motion.
7337
7338 @item -ftree-loop-ivcanon
7339 @opindex ftree-loop-ivcanon
7340 Create a canonical counter for number of iterations in the loop for that
7341 determining number of iterations requires complicated analysis. Later
7342 optimizations then may determine the number easily. Useful especially
7343 in connection with unrolling.
7344
7345 @item -fivopts
7346 @opindex fivopts
7347 Perform induction variable optimizations (strength reduction, induction
7348 variable merging and induction variable elimination) on trees.
7349
7350 @item -ftree-parallelize-loops=n
7351 @opindex ftree-parallelize-loops
7352 Parallelize loops, i.e., split their iteration space to run in n threads.
7353 This is only possible for loops whose iterations are independent
7354 and can be arbitrarily reordered. The optimization is only
7355 profitable on multiprocessor machines, for loops that are CPU-intensive,
7356 rather than constrained e.g.@: by memory bandwidth. This option
7357 implies @option{-pthread}, and thus is only supported on targets
7358 that have support for @option{-pthread}.
7359
7360 @item -ftree-pta
7361 @opindex ftree-pta
7362 Perform function-local points-to analysis on trees. This flag is
7363 enabled by default at @option{-O} and higher.
7364
7365 @item -ftree-sra
7366 @opindex ftree-sra
7367 Perform scalar replacement of aggregates. This pass replaces structure
7368 references with scalars to prevent committing structures to memory too
7369 early. This flag is enabled by default at @option{-O} and higher.
7370
7371 @item -ftree-copyrename
7372 @opindex ftree-copyrename
7373 Perform copy renaming on trees. This pass attempts to rename compiler
7374 temporaries to other variables at copy locations, usually resulting in
7375 variable names which more closely resemble the original variables. This flag
7376 is enabled by default at @option{-O} and higher.
7377
7378 @item -ftree-ter
7379 @opindex ftree-ter
7380 Perform temporary expression replacement during the SSA->normal phase. Single
7381 use/single def temporaries are replaced at their use location with their
7382 defining expression. This results in non-GIMPLE code, but gives the expanders
7383 much more complex trees to work on resulting in better RTL generation. This is
7384 enabled by default at @option{-O} and higher.
7385
7386 @item -ftree-vectorize
7387 @opindex ftree-vectorize
7388 Perform loop vectorization on trees. This flag is enabled by default at
7389 @option{-O3}.
7390
7391 @item -ftree-slp-vectorize
7392 @opindex ftree-slp-vectorize
7393 Perform basic block vectorization on trees. This flag is enabled by default at
7394 @option{-O3} and when @option{-ftree-vectorize} is enabled.
7395
7396 @item -ftree-vect-loop-version
7397 @opindex ftree-vect-loop-version
7398 Perform loop versioning when doing loop vectorization on trees. When a loop
7399 appears to be vectorizable except that data alignment or data dependence cannot
7400 be determined at compile time then vectorized and non-vectorized versions of
7401 the loop are generated along with runtime checks for alignment or dependence
7402 to control which version is executed. This option is enabled by default
7403 except at level @option{-Os} where it is disabled.
7404
7405 @item -fvect-cost-model
7406 @opindex fvect-cost-model
7407 Enable cost model for vectorization.
7408
7409 @item -ftree-vrp
7410 @opindex ftree-vrp
7411 Perform Value Range Propagation on trees. This is similar to the
7412 constant propagation pass, but instead of values, ranges of values are
7413 propagated. This allows the optimizers to remove unnecessary range
7414 checks like array bound checks and null pointer checks. This is
7415 enabled by default at @option{-O2} and higher. Null pointer check
7416 elimination is only done if @option{-fdelete-null-pointer-checks} is
7417 enabled.
7418
7419 @item -ftracer
7420 @opindex ftracer
7421 Perform tail duplication to enlarge superblock size. This transformation
7422 simplifies the control flow of the function allowing other optimizations to do
7423 better job.
7424
7425 @item -funroll-loops
7426 @opindex funroll-loops
7427 Unroll loops whose number of iterations can be determined at compile
7428 time or upon entry to the loop. @option{-funroll-loops} implies
7429 @option{-frerun-cse-after-loop}. This option makes code larger,
7430 and may or may not make it run faster.
7431
7432 @item -funroll-all-loops
7433 @opindex funroll-all-loops
7434 Unroll all loops, even if their number of iterations is uncertain when
7435 the loop is entered. This usually makes programs run more slowly.
7436 @option{-funroll-all-loops} implies the same options as
7437 @option{-funroll-loops},
7438
7439 @item -fsplit-ivs-in-unroller
7440 @opindex fsplit-ivs-in-unroller
7441 Enables expressing of values of induction variables in later iterations
7442 of the unrolled loop using the value in the first iteration. This breaks
7443 long dependency chains, thus improving efficiency of the scheduling passes.
7444
7445 Combination of @option{-fweb} and CSE is often sufficient to obtain the
7446 same effect. However in cases the loop body is more complicated than
7447 a single basic block, this is not reliable. It also does not work at all
7448 on some of the architectures due to restrictions in the CSE pass.
7449
7450 This optimization is enabled by default.
7451
7452 @item -fvariable-expansion-in-unroller
7453 @opindex fvariable-expansion-in-unroller
7454 With this option, the compiler will create multiple copies of some
7455 local variables when unrolling a loop which can result in superior code.
7456
7457 @item -fpartial-inlining
7458 @opindex fpartial-inlining
7459 Inline parts of functions. This option has any effect only
7460 when inlining itself is turned on by the @option{-finline-functions}
7461 or @option{-finline-small-functions} options.
7462
7463 Enabled at level @option{-O2}.
7464
7465 @item -fpredictive-commoning
7466 @opindex fpredictive-commoning
7467 Perform predictive commoning optimization, i.e., reusing computations
7468 (especially memory loads and stores) performed in previous
7469 iterations of loops.
7470
7471 This option is enabled at level @option{-O3}.
7472
7473 @item -fprefetch-loop-arrays
7474 @opindex fprefetch-loop-arrays
7475 If supported by the target machine, generate instructions to prefetch
7476 memory to improve the performance of loops that access large arrays.
7477
7478 This option may generate better or worse code; results are highly
7479 dependent on the structure of loops within the source code.
7480
7481 Disabled at level @option{-Os}.
7482
7483 @item -fno-peephole
7484 @itemx -fno-peephole2
7485 @opindex fno-peephole
7486 @opindex fno-peephole2
7487 Disable any machine-specific peephole optimizations. The difference
7488 between @option{-fno-peephole} and @option{-fno-peephole2} is in how they
7489 are implemented in the compiler; some targets use one, some use the
7490 other, a few use both.
7491
7492 @option{-fpeephole} is enabled by default.
7493 @option{-fpeephole2} enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
7494
7495 @item -fno-guess-branch-probability
7496 @opindex fno-guess-branch-probability
7497 Do not guess branch probabilities using heuristics.
7498
7499 GCC will use heuristics to guess branch probabilities if they are
7500 not provided by profiling feedback (@option{-fprofile-arcs}). These
7501 heuristics are based on the control flow graph. If some branch probabilities
7502 are specified by @samp{__builtin_expect}, then the heuristics will be
7503 used to guess branch probabilities for the rest of the control flow graph,
7504 taking the @samp{__builtin_expect} info into account. The interactions
7505 between the heuristics and @samp{__builtin_expect} can be complex, and in
7506 some cases, it may be useful to disable the heuristics so that the effects
7507 of @samp{__builtin_expect} are easier to understand.
7508
7509 The default is @option{-fguess-branch-probability} at levels
7510 @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
7511
7512 @item -freorder-blocks
7513 @opindex freorder-blocks
7514 Reorder basic blocks in the compiled function in order to reduce number of
7515 taken branches and improve code locality.
7516
7517 Enabled at levels @option{-O2}, @option{-O3}.
7518
7519 @item -freorder-blocks-and-partition
7520 @opindex freorder-blocks-and-partition
7521 In addition to reordering basic blocks in the compiled function, in order
7522 to reduce number of taken branches, partitions hot and cold basic blocks
7523 into separate sections of the assembly and .o files, to improve
7524 paging and cache locality performance.
7525
7526 This optimization is automatically turned off in the presence of
7527 exception handling, for linkonce sections, for functions with a user-defined
7528 section attribute and on any architecture that does not support named
7529 sections.
7530
7531 @item -freorder-functions
7532 @opindex freorder-functions
7533 Reorder functions in the object file in order to
7534 improve code locality. This is implemented by using special
7535 subsections @code{.text.hot} for most frequently executed functions and
7536 @code{.text.unlikely} for unlikely executed functions. Reordering is done by
7537 the linker so object file format must support named sections and linker must
7538 place them in a reasonable way.
7539
7540 Also profile feedback must be available in to make this option effective. See
7541 @option{-fprofile-arcs} for details.
7542
7543 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
7544
7545 @item -fstrict-aliasing
7546 @opindex fstrict-aliasing
7547 Allow the compiler to assume the strictest aliasing rules applicable to
7548 the language being compiled. For C (and C++), this activates
7549 optimizations based on the type of expressions. In particular, an
7550 object of one type is assumed never to reside at the same address as an
7551 object of a different type, unless the types are almost the same. For
7552 example, an @code{unsigned int} can alias an @code{int}, but not a
7553 @code{void*} or a @code{double}. A character type may alias any other
7554 type.
7555
7556 @anchor{Type-punning}Pay special attention to code like this:
7557 @smallexample
7558 union a_union @{
7559 int i;
7560 double d;
7561 @};
7562
7563 int f() @{
7564 union a_union t;
7565 t.d = 3.0;
7566 return t.i;
7567 @}
7568 @end smallexample
7569 The practice of reading from a different union member than the one most
7570 recently written to (called ``type-punning'') is common. Even with
7571 @option{-fstrict-aliasing}, type-punning is allowed, provided the memory
7572 is accessed through the union type. So, the code above will work as
7573 expected. @xref{Structures unions enumerations and bit-fields
7574 implementation}. However, this code might not:
7575 @smallexample
7576 int f() @{
7577 union a_union t;
7578 int* ip;
7579 t.d = 3.0;
7580 ip = &t.i;
7581 return *ip;
7582 @}
7583 @end smallexample
7584
7585 Similarly, access by taking the address, casting the resulting pointer
7586 and dereferencing the result has undefined behavior, even if the cast
7587 uses a union type, e.g.:
7588 @smallexample
7589 int f() @{
7590 double d = 3.0;
7591 return ((union a_union *) &d)->i;
7592 @}
7593 @end smallexample
7594
7595 The @option{-fstrict-aliasing} option is enabled at levels
7596 @option{-O2}, @option{-O3}, @option{-Os}.
7597
7598 @item -fstrict-overflow
7599 @opindex fstrict-overflow
7600 Allow the compiler to assume strict signed overflow rules, depending
7601 on the language being compiled. For C (and C++) this means that
7602 overflow when doing arithmetic with signed numbers is undefined, which
7603 means that the compiler may assume that it will not happen. This
7604 permits various optimizations. For example, the compiler will assume
7605 that an expression like @code{i + 10 > i} will always be true for
7606 signed @code{i}. This assumption is only valid if signed overflow is
7607 undefined, as the expression is false if @code{i + 10} overflows when
7608 using twos complement arithmetic. When this option is in effect any
7609 attempt to determine whether an operation on signed numbers will
7610 overflow must be written carefully to not actually involve overflow.
7611
7612 This option also allows the compiler to assume strict pointer
7613 semantics: given a pointer to an object, if adding an offset to that
7614 pointer does not produce a pointer to the same object, the addition is
7615 undefined. This permits the compiler to conclude that @code{p + u >
7616 p} is always true for a pointer @code{p} and unsigned integer
7617 @code{u}. This assumption is only valid because pointer wraparound is
7618 undefined, as the expression is false if @code{p + u} overflows using
7619 twos complement arithmetic.
7620
7621 See also the @option{-fwrapv} option. Using @option{-fwrapv} means
7622 that integer signed overflow is fully defined: it wraps. When
7623 @option{-fwrapv} is used, there is no difference between
7624 @option{-fstrict-overflow} and @option{-fno-strict-overflow} for
7625 integers. With @option{-fwrapv} certain types of overflow are
7626 permitted. For example, if the compiler gets an overflow when doing
7627 arithmetic on constants, the overflowed value can still be used with
7628 @option{-fwrapv}, but not otherwise.
7629
7630 The @option{-fstrict-overflow} option is enabled at levels
7631 @option{-O2}, @option{-O3}, @option{-Os}.
7632
7633 @item -falign-functions
7634 @itemx -falign-functions=@var{n}
7635 @opindex falign-functions
7636 Align the start of functions to the next power-of-two greater than
7637 @var{n}, skipping up to @var{n} bytes. For instance,
7638 @option{-falign-functions=32} aligns functions to the next 32-byte
7639 boundary, but @option{-falign-functions=24} would align to the next
7640 32-byte boundary only if this can be done by skipping 23 bytes or less.
7641
7642 @option{-fno-align-functions} and @option{-falign-functions=1} are
7643 equivalent and mean that functions will not be aligned.
7644
7645 Some assemblers only support this flag when @var{n} is a power of two;
7646 in that case, it is rounded up.
7647
7648 If @var{n} is not specified or is zero, use a machine-dependent default.
7649
7650 Enabled at levels @option{-O2}, @option{-O3}.
7651
7652 @item -falign-labels
7653 @itemx -falign-labels=@var{n}
7654 @opindex falign-labels
7655 Align all branch targets to a power-of-two boundary, skipping up to
7656 @var{n} bytes like @option{-falign-functions}. This option can easily
7657 make code slower, because it must insert dummy operations for when the
7658 branch target is reached in the usual flow of the code.
7659
7660 @option{-fno-align-labels} and @option{-falign-labels=1} are
7661 equivalent and mean that labels will not be aligned.
7662
7663 If @option{-falign-loops} or @option{-falign-jumps} are applicable and
7664 are greater than this value, then their values are used instead.
7665
7666 If @var{n} is not specified or is zero, use a machine-dependent default
7667 which is very likely to be @samp{1}, meaning no alignment.
7668
7669 Enabled at levels @option{-O2}, @option{-O3}.
7670
7671 @item -falign-loops
7672 @itemx -falign-loops=@var{n}
7673 @opindex falign-loops
7674 Align loops to a power-of-two boundary, skipping up to @var{n} bytes
7675 like @option{-falign-functions}. The hope is that the loop will be
7676 executed many times, which will make up for any execution of the dummy
7677 operations.
7678
7679 @option{-fno-align-loops} and @option{-falign-loops=1} are
7680 equivalent and mean that loops will not be aligned.
7681
7682 If @var{n} is not specified or is zero, use a machine-dependent default.
7683
7684 Enabled at levels @option{-O2}, @option{-O3}.
7685
7686 @item -falign-jumps
7687 @itemx -falign-jumps=@var{n}
7688 @opindex falign-jumps
7689 Align branch targets to a power-of-two boundary, for branch targets
7690 where the targets can only be reached by jumping, skipping up to @var{n}
7691 bytes like @option{-falign-functions}. In this case, no dummy operations
7692 need be executed.
7693
7694 @option{-fno-align-jumps} and @option{-falign-jumps=1} are
7695 equivalent and mean that loops will not be aligned.
7696
7697 If @var{n} is not specified or is zero, use a machine-dependent default.
7698
7699 Enabled at levels @option{-O2}, @option{-O3}.
7700
7701 @item -funit-at-a-time
7702 @opindex funit-at-a-time
7703 This option is left for compatibility reasons. @option{-funit-at-a-time}
7704 has no effect, while @option{-fno-unit-at-a-time} implies
7705 @option{-fno-toplevel-reorder} and @option{-fno-section-anchors}.
7706
7707 Enabled by default.
7708
7709 @item -fno-toplevel-reorder
7710 @opindex fno-toplevel-reorder
7711 Do not reorder top-level functions, variables, and @code{asm}
7712 statements. Output them in the same order that they appear in the
7713 input file. When this option is used, unreferenced static variables
7714 will not be removed. This option is intended to support existing code
7715 which relies on a particular ordering. For new code, it is better to
7716 use attributes.
7717
7718 Enabled at level @option{-O0}. When disabled explicitly, it also imply
7719 @option{-fno-section-anchors} that is otherwise enabled at @option{-O0} on some
7720 targets.
7721
7722 @item -fweb
7723 @opindex fweb
7724 Constructs webs as commonly used for register allocation purposes and assign
7725 each web individual pseudo register. This allows the register allocation pass
7726 to operate on pseudos directly, but also strengthens several other optimization
7727 passes, such as CSE, loop optimizer and trivial dead code remover. It can,
7728 however, make debugging impossible, since variables will no longer stay in a
7729 ``home register''.
7730
7731 Enabled by default with @option{-funroll-loops}.
7732
7733 @item -fwhole-program
7734 @opindex fwhole-program
7735 Assume that the current compilation unit represents the whole program being
7736 compiled. All public functions and variables with the exception of @code{main}
7737 and those merged by attribute @code{externally_visible} become static functions
7738 and in effect are optimized more aggressively by interprocedural optimizers. If @command{gold} is used as the linker plugin, @code{externally_visible} attributes are automatically added to functions (not variable yet due to a current @command{gold} issue) that are accessed outside of LTO objects according to resolution file produced by @command{gold}. For other linkers that cannot generate resolution file, explicit @code{externally_visible} attributes are still necessary.
7739 While this option is equivalent to proper use of the @code{static} keyword for
7740 programs consisting of a single file, in combination with option
7741 @option{-flto} this flag can be used to
7742 compile many smaller scale programs since the functions and variables become
7743 local for the whole combined compilation unit, not for the single source file
7744 itself.
7745
7746 This option implies @option{-fwhole-file} for Fortran programs.
7747
7748 @item -flto[=@var{n}]
7749 @opindex flto
7750 This option runs the standard link-time optimizer. When invoked
7751 with source code, it generates GIMPLE (one of GCC's internal
7752 representations) and writes it to special ELF sections in the object
7753 file. When the object files are linked together, all the function
7754 bodies are read from these ELF sections and instantiated as if they
7755 had been part of the same translation unit.
7756
7757 To use the link-timer optimizer, @option{-flto} needs to be specified at
7758 compile time and during the final link. For example,
7759
7760 @smallexample
7761 gcc -c -O2 -flto foo.c
7762 gcc -c -O2 -flto bar.c
7763 gcc -o myprog -flto -O2 foo.o bar.o
7764 @end smallexample
7765
7766 The first two invocations to GCC will save a bytecode representation
7767 of GIMPLE into special ELF sections inside @file{foo.o} and
7768 @file{bar.o}. The final invocation will read the GIMPLE bytecode from
7769 @file{foo.o} and @file{bar.o}, merge the two files into a single
7770 internal image, and compile the result as usual. Since both
7771 @file{foo.o} and @file{bar.o} are merged into a single image, this
7772 causes all the inter-procedural analyses and optimizations in GCC to
7773 work across the two files as if they were a single one. This means,
7774 for example, that the inliner will be able to inline functions in
7775 @file{bar.o} into functions in @file{foo.o} and vice-versa.
7776
7777 Another (simpler) way to enable link-time optimization is,
7778
7779 @smallexample
7780 gcc -o myprog -flto -O2 foo.c bar.c
7781 @end smallexample
7782
7783 The above will generate bytecode for @file{foo.c} and @file{bar.c},
7784 merge them together into a single GIMPLE representation and optimize
7785 them as usual to produce @file{myprog}.
7786
7787 The only important thing to keep in mind is that to enable link-time
7788 optimizations the @option{-flto} flag needs to be passed to both the
7789 compile and the link commands.
7790
7791 To make whole program optimization effective, it is necessary to make
7792 certain whole program assumptions. The compiler needs to know
7793 what functions and variables can be accessed by libraries and runtime
7794 outside of the link time optimized unit. When supported by the linker,
7795 the linker plugin (see @option{-fuse-linker-plugin}) passes to the
7796 compiler information about used and externally visible symbols. When
7797 the linker plugin is not available, @option{-fwhole-program} should be
7798 used to allow the compiler to make these assumptions, which will lead
7799 to more aggressive optimization decisions.
7800
7801 Note that when a file is compiled with @option{-flto}, the generated
7802 object file will be larger than a regular object file because it will
7803 contain GIMPLE bytecodes and the usual final code. This means that
7804 object files with LTO information can be linked as a normal object
7805 file. So, in the previous example, if the final link is done with
7806
7807 @smallexample
7808 gcc -o myprog foo.o bar.o
7809 @end smallexample
7810
7811 The only difference will be that no inter-procedural optimizations
7812 will be applied to produce @file{myprog}. The two object files
7813 @file{foo.o} and @file{bar.o} will be simply sent to the regular
7814 linker.
7815
7816 Additionally, the optimization flags used to compile individual files
7817 are not necessarily related to those used at link-time. For instance,
7818
7819 @smallexample
7820 gcc -c -O0 -flto foo.c
7821 gcc -c -O0 -flto bar.c
7822 gcc -o myprog -flto -O3 foo.o bar.o
7823 @end smallexample
7824
7825 This will produce individual object files with unoptimized assembler
7826 code, but the resulting binary @file{myprog} will be optimized at
7827 @option{-O3}. Now, if the final binary is generated without
7828 @option{-flto}, then @file{myprog} will not be optimized.
7829
7830 When producing the final binary with @option{-flto}, GCC will only
7831 apply link-time optimizations to those files that contain bytecode.
7832 Therefore, you can mix and match object files and libraries with
7833 GIMPLE bytecodes and final object code. GCC will automatically select
7834 which files to optimize in LTO mode and which files to link without
7835 further processing.
7836
7837 There are some code generation flags that GCC will preserve when
7838 generating bytecodes, as they need to be used during the final link
7839 stage. Currently, the following options are saved into the GIMPLE
7840 bytecode files: @option{-fPIC}, @option{-fcommon} and all the
7841 @option{-m} target flags.
7842
7843 At link time, these options are read-in and reapplied. Note that the
7844 current implementation makes no attempt at recognizing conflicting
7845 values for these options. If two or more files have a conflicting
7846 value (e.g., one file is compiled with @option{-fPIC} and another
7847 isn't), the compiler will simply use the last value read from the
7848 bytecode files. It is recommended, then, that all the files
7849 participating in the same link be compiled with the same options.
7850
7851 Another feature of LTO is that it is possible to apply interprocedural
7852 optimizations on files written in different languages. This requires
7853 some support in the language front end. Currently, the C, C++ and
7854 Fortran front ends are capable of emitting GIMPLE bytecodes, so
7855 something like this should work
7856
7857 @smallexample
7858 gcc -c -flto foo.c
7859 g++ -c -flto bar.cc
7860 gfortran -c -flto baz.f90
7861 g++ -o myprog -flto -O3 foo.o bar.o baz.o -lgfortran
7862 @end smallexample
7863
7864 Notice that the final link is done with @command{g++} to get the C++
7865 runtime libraries and @option{-lgfortran} is added to get the Fortran
7866 runtime libraries. In general, when mixing languages in LTO mode, you
7867 should use the same link command used when mixing languages in a
7868 regular (non-LTO) compilation. This means that if your build process
7869 was mixing languages before, all you need to add is @option{-flto} to
7870 all the compile and link commands.
7871
7872 If LTO encounters objects with C linkage declared with incompatible
7873 types in separate translation units to be linked together (undefined
7874 behavior according to ISO C99 6.2.7), a non-fatal diagnostic may be
7875 issued. The behavior is still undefined at runtime.
7876
7877 If object files containing GIMPLE bytecode are stored in a library archive, say
7878 @file{libfoo.a}, it is possible to extract and use them in an LTO link if you
7879 are using a linker with linker plugin support. To enable this feature, use
7880 the flag @option{-fuse-linker-plugin} at link-time:
7881
7882 @smallexample
7883 gcc -o myprog -O2 -flto -fuse-linker-plugin a.o b.o -lfoo
7884 @end smallexample
7885
7886 With the linker plugin enabled, the linker will extract the needed
7887 GIMPLE files from @file{libfoo.a} and pass them on to the running GCC
7888 to make them part of the aggregated GIMPLE image to be optimized.
7889
7890 If you are not using a linker with linker plugin support and/or do not
7891 enable linker plugin then the objects inside @file{libfoo.a}
7892 will be extracted and linked as usual, but they will not participate
7893 in the LTO optimization process.
7894
7895 Link time optimizations do not require the presence of the whole program to
7896 operate. If the program does not require any symbols to be exported, it is
7897 possible to combine @option{-flto} and with @option{-fwhole-program} to allow
7898 the interprocedural optimizers to use more aggressive assumptions which may
7899 lead to improved optimization opportunities.
7900 Use of @option{-fwhole-program} is not needed when linker plugin is
7901 active (see @option{-fuse-linker-plugin}).
7902
7903 Regarding portability: the current implementation of LTO makes no
7904 attempt at generating bytecode that can be ported between different
7905 types of hosts. The bytecode files are versioned and there is a
7906 strict version check, so bytecode files generated in one version of
7907 GCC will not work with an older/newer version of GCC.
7908
7909 Link time optimization does not play well with generating debugging
7910 information. Combining @option{-flto} with
7911 @option{-g} is currently experimental and expected to produce wrong
7912 results.
7913
7914 If you specify the optional @var{n}, the optimization and code
7915 generation done at link time is executed in parallel using @var{n}
7916 parallel jobs by utilizing an installed @command{make} program. The
7917 environment variable @env{MAKE} may be used to override the program
7918 used. The default value for @var{n} is 1.
7919
7920 You can also specify @option{-flto=jobserver} to use GNU make's
7921 job server mode to determine the number of parallel jobs. This
7922 is useful when the Makefile calling GCC is already executing in parallel.
7923 The parent Makefile will need a @samp{+} prepended to the command recipe
7924 for this to work. This will likely only work if @env{MAKE} is
7925 GNU make.
7926
7927 This option is disabled by default.
7928
7929 @item -flto-partition=@var{alg}
7930 @opindex flto-partition
7931 Specify the partitioning algorithm used by the link time optimizer.
7932 The value is either @code{1to1} to specify a partitioning mirroring
7933 the original source files or @code{balanced} to specify partitioning
7934 into equally sized chunks (whenever possible). Specifying @code{none}
7935 as an algorithm disables partitioning and streaming completely. The
7936 default value is @code{balanced}.
7937
7938 @item -flto-compression-level=@var{n}
7939 This option specifies the level of compression used for intermediate
7940 language written to LTO object files, and is only meaningful in
7941 conjunction with LTO mode (@option{-flto}). Valid
7942 values are 0 (no compression) to 9 (maximum compression). Values
7943 outside this range are clamped to either 0 or 9. If the option is not
7944 given, a default balanced compression setting is used.
7945
7946 @item -flto-report
7947 Prints a report with internal details on the workings of the link-time
7948 optimizer. The contents of this report vary from version to version,
7949 it is meant to be useful to GCC developers when processing object
7950 files in LTO mode (via @option{-flto}).
7951
7952 Disabled by default.
7953
7954 @item -fuse-linker-plugin
7955 Enables the use of a linker plugin during link time optimization. This
7956 option relies on plugin support in the linker, which is available in gold
7957 or in GNU ld 2.21 or newer.
7958
7959 This option enables the extraction of object files with GIMPLE bytecode out
7960 of library archives. This improves the quality of optimization by exposing
7961 more code to the link time optimizer. This information specifies what
7962 symbols can be accessed externally (by non-LTO object or during dynamic
7963 linking). Resulting code quality improvements on binaries (and shared
7964 libraries that use hidden visibility) are similar to @code{-fwhole-program}.
7965 See @option{-flto} for a description of the effect of this flag and how to
7966 use it.
7967
7968 Enabled by default when LTO support in GCC is enabled and GCC was compiled
7969 with a linker supporting plugins (GNU ld 2.21 or newer or gold).
7970
7971 @item -ffat-lto-objects
7972 @opindex ffat-lto-objects
7973 Fat LTO objects are object files that contain both the intermediate language
7974 and the object code. This makes them useable for both LTO linking and normal
7975 linking. This option makes effect only with @option{-flto} and is ignored
7976 at linktime.
7977
7978 @option{-fno-fat-lto-objects} improves compilation time over plain LTO, but
7979 requires the complete toolchain to be aware of LTO. It requires a linker with
7980 linker plugin support for basic functionality. Additionally, nm, ar and ranlib
7981 need to support linker plugins to allow a full-featured build environment
7982 (capable of building static libraries etc).
7983
7984 The default is @option{-ffat-lto-objects} but this default is intended to
7985 change in future releases when linker plugin enabled environments become more
7986 common.
7987 @item -fcompare-elim
7988 @opindex fcompare-elim
7989 After register allocation and post-register allocation instruction splitting,
7990 identify arithmetic instructions that compute processor flags similar to a
7991 comparison operation based on that arithmetic. If possible, eliminate the
7992 explicit comparison operation.
7993
7994 This pass only applies to certain targets that cannot explicitly represent
7995 the comparison operation before register allocation is complete.
7996
7997 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
7998
7999 @item -fcprop-registers
8000 @opindex fcprop-registers
8001 After register allocation and post-register allocation instruction splitting,
8002 we perform a copy-propagation pass to try to reduce scheduling dependencies
8003 and occasionally eliminate the copy.
8004
8005 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
8006
8007 @item -fprofile-correction
8008 @opindex fprofile-correction
8009 Profiles collected using an instrumented binary for multi-threaded programs may
8010 be inconsistent due to missed counter updates. When this option is specified,
8011 GCC will use heuristics to correct or smooth out such inconsistencies. By
8012 default, GCC will emit an error message when an inconsistent profile is detected.
8013
8014 @item -fprofile-dir=@var{path}
8015 @opindex fprofile-dir
8016
8017 Set the directory to search for the profile data files in to @var{path}.
8018 This option affects only the profile data generated by
8019 @option{-fprofile-generate}, @option{-ftest-coverage}, @option{-fprofile-arcs}
8020 and used by @option{-fprofile-use} and @option{-fbranch-probabilities}
8021 and its related options. Both absolute and relative paths can be used.
8022 By default, GCC will use the current directory as @var{path}, thus the
8023 profile data file will appear in the same directory as the object file.
8024
8025 @item -fprofile-generate
8026 @itemx -fprofile-generate=@var{path}
8027 @opindex fprofile-generate
8028
8029 Enable options usually used for instrumenting application to produce
8030 profile useful for later recompilation with profile feedback based
8031 optimization. You must use @option{-fprofile-generate} both when
8032 compiling and when linking your program.
8033
8034 The following options are enabled: @code{-fprofile-arcs}, @code{-fprofile-values}, @code{-fvpt}.
8035
8036 If @var{path} is specified, GCC will look at the @var{path} to find
8037 the profile feedback data files. See @option{-fprofile-dir}.
8038
8039 @item -fprofile-use
8040 @itemx -fprofile-use=@var{path}
8041 @opindex fprofile-use
8042 Enable profile feedback directed optimizations, and optimizations
8043 generally profitable only with profile feedback available.
8044
8045 The following options are enabled: @code{-fbranch-probabilities}, @code{-fvpt},
8046 @code{-funroll-loops}, @code{-fpeel-loops}, @code{-ftracer}
8047
8048 By default, GCC emits an error message if the feedback profiles do not
8049 match the source code. This error can be turned into a warning by using
8050 @option{-Wcoverage-mismatch}. Note this may result in poorly optimized
8051 code.
8052
8053 If @var{path} is specified, GCC will look at the @var{path} to find
8054 the profile feedback data files. See @option{-fprofile-dir}.
8055 @end table
8056
8057 The following options control compiler behavior regarding floating
8058 point arithmetic. These options trade off between speed and
8059 correctness. All must be specifically enabled.
8060
8061 @table @gcctabopt
8062 @item -ffloat-store
8063 @opindex ffloat-store
8064 Do not store floating point variables in registers, and inhibit other
8065 options that might change whether a floating point value is taken from a
8066 register or memory.
8067
8068 @cindex floating point precision
8069 This option prevents undesirable excess precision on machines such as
8070 the 68000 where the floating registers (of the 68881) keep more
8071 precision than a @code{double} is supposed to have. Similarly for the
8072 x86 architecture. For most programs, the excess precision does only
8073 good, but a few programs rely on the precise definition of IEEE floating
8074 point. Use @option{-ffloat-store} for such programs, after modifying
8075 them to store all pertinent intermediate computations into variables.
8076
8077 @item -fexcess-precision=@var{style}
8078 @opindex fexcess-precision
8079 This option allows further control over excess precision on machines
8080 where floating-point registers have more precision than the IEEE
8081 @code{float} and @code{double} types and the processor does not
8082 support operations rounding to those types. By default,
8083 @option{-fexcess-precision=fast} is in effect; this means that
8084 operations are carried out in the precision of the registers and that
8085 it is unpredictable when rounding to the types specified in the source
8086 code takes place. When compiling C, if
8087 @option{-fexcess-precision=standard} is specified then excess
8088 precision will follow the rules specified in ISO C99; in particular,
8089 both casts and assignments cause values to be rounded to their
8090 semantic types (whereas @option{-ffloat-store} only affects
8091 assignments). This option is enabled by default for C if a strict
8092 conformance option such as @option{-std=c99} is used.
8093
8094 @opindex mfpmath
8095 @option{-fexcess-precision=standard} is not implemented for languages
8096 other than C, and has no effect if
8097 @option{-funsafe-math-optimizations} or @option{-ffast-math} is
8098 specified. On the x86, it also has no effect if @option{-mfpmath=sse}
8099 or @option{-mfpmath=sse+387} is specified; in the former case, IEEE
8100 semantics apply without excess precision, and in the latter, rounding
8101 is unpredictable.
8102
8103 @item -ffast-math
8104 @opindex ffast-math
8105 Sets @option{-fno-math-errno}, @option{-funsafe-math-optimizations},
8106 @option{-ffinite-math-only}, @option{-fno-rounding-math},
8107 @option{-fno-signaling-nans} and @option{-fcx-limited-range}.
8108
8109 This option causes the preprocessor macro @code{__FAST_MATH__} to be defined.
8110
8111 This option is not turned on by any @option{-O} option besides
8112 @option{-Ofast} since it can result in incorrect output for programs
8113 which depend on an exact implementation of IEEE or ISO rules/specifications
8114 for math functions. It may, however, yield faster code for programs
8115 that do not require the guarantees of these specifications.
8116
8117 @item -fno-math-errno
8118 @opindex fno-math-errno
8119 Do not set ERRNO after calling math functions that are executed
8120 with a single instruction, e.g., sqrt. A program that relies on
8121 IEEE exceptions for math error handling may want to use this flag
8122 for speed while maintaining IEEE arithmetic compatibility.
8123
8124 This option is not turned on by any @option{-O} option since
8125 it can result in incorrect output for programs which depend on
8126 an exact implementation of IEEE or ISO rules/specifications for
8127 math functions. It may, however, yield faster code for programs
8128 that do not require the guarantees of these specifications.
8129
8130 The default is @option{-fmath-errno}.
8131
8132 On Darwin systems, the math library never sets @code{errno}. There is
8133 therefore no reason for the compiler to consider the possibility that
8134 it might, and @option{-fno-math-errno} is the default.
8135
8136 @item -funsafe-math-optimizations
8137 @opindex funsafe-math-optimizations
8138
8139 Allow optimizations for floating-point arithmetic that (a) assume
8140 that arguments and results are valid and (b) may violate IEEE or
8141 ANSI standards. When used at link-time, it may include libraries
8142 or startup files that change the default FPU control word or other
8143 similar optimizations.
8144
8145 This option is not turned on by any @option{-O} option since
8146 it can result in incorrect output for programs which depend on
8147 an exact implementation of IEEE or ISO rules/specifications for
8148 math functions. It may, however, yield faster code for programs
8149 that do not require the guarantees of these specifications.
8150 Enables @option{-fno-signed-zeros}, @option{-fno-trapping-math},
8151 @option{-fassociative-math} and @option{-freciprocal-math}.
8152
8153 The default is @option{-fno-unsafe-math-optimizations}.
8154
8155 @item -fassociative-math
8156 @opindex fassociative-math
8157
8158 Allow re-association of operands in series of floating-point operations.
8159 This violates the ISO C and C++ language standard by possibly changing
8160 computation result. NOTE: re-ordering may change the sign of zero as
8161 well as ignore NaNs and inhibit or create underflow or overflow (and
8162 thus cannot be used on a code which relies on rounding behavior like
8163 @code{(x + 2**52) - 2**52)}. May also reorder floating-point comparisons
8164 and thus may not be used when ordered comparisons are required.
8165 This option requires that both @option{-fno-signed-zeros} and
8166 @option{-fno-trapping-math} be in effect. Moreover, it doesn't make
8167 much sense with @option{-frounding-math}. For Fortran the option
8168 is automatically enabled when both @option{-fno-signed-zeros} and
8169 @option{-fno-trapping-math} are in effect.
8170
8171 The default is @option{-fno-associative-math}.
8172
8173 @item -freciprocal-math
8174 @opindex freciprocal-math
8175
8176 Allow the reciprocal of a value to be used instead of dividing by
8177 the value if this enables optimizations. For example @code{x / y}
8178 can be replaced with @code{x * (1/y)} which is useful if @code{(1/y)}
8179 is subject to common subexpression elimination. Note that this loses
8180 precision and increases the number of flops operating on the value.
8181
8182 The default is @option{-fno-reciprocal-math}.
8183
8184 @item -ffinite-math-only
8185 @opindex ffinite-math-only
8186 Allow optimizations for floating-point arithmetic that assume
8187 that arguments and results are not NaNs or +-Infs.
8188
8189 This option is not turned on by any @option{-O} option since
8190 it can result in incorrect output for programs which depend on
8191 an exact implementation of IEEE or ISO rules/specifications for
8192 math functions. It may, however, yield faster code for programs
8193 that do not require the guarantees of these specifications.
8194
8195 The default is @option{-fno-finite-math-only}.
8196
8197 @item -fno-signed-zeros
8198 @opindex fno-signed-zeros
8199 Allow optimizations for floating point arithmetic that ignore the
8200 signedness of zero. IEEE arithmetic specifies the behavior of
8201 distinct +0.0 and @minus{}0.0 values, which then prohibits simplification
8202 of expressions such as x+0.0 or 0.0*x (even with @option{-ffinite-math-only}).
8203 This option implies that the sign of a zero result isn't significant.
8204
8205 The default is @option{-fsigned-zeros}.
8206
8207 @item -fno-trapping-math
8208 @opindex fno-trapping-math
8209 Compile code assuming that floating-point operations cannot generate
8210 user-visible traps. These traps include division by zero, overflow,
8211 underflow, inexact result and invalid operation. This option requires
8212 that @option{-fno-signaling-nans} be in effect. Setting this option may
8213 allow faster code if one relies on ``non-stop'' IEEE arithmetic, for example.
8214
8215 This option should never be turned on by any @option{-O} option since
8216 it can result in incorrect output for programs which depend on
8217 an exact implementation of IEEE or ISO rules/specifications for
8218 math functions.
8219
8220 The default is @option{-ftrapping-math}.
8221
8222 @item -frounding-math
8223 @opindex frounding-math
8224 Disable transformations and optimizations that assume default floating
8225 point rounding behavior. This is round-to-zero for all floating point
8226 to integer conversions, and round-to-nearest for all other arithmetic
8227 truncations. This option should be specified for programs that change
8228 the FP rounding mode dynamically, or that may be executed with a
8229 non-default rounding mode. This option disables constant folding of
8230 floating point expressions at compile-time (which may be affected by
8231 rounding mode) and arithmetic transformations that are unsafe in the
8232 presence of sign-dependent rounding modes.
8233
8234 The default is @option{-fno-rounding-math}.
8235
8236 This option is experimental and does not currently guarantee to
8237 disable all GCC optimizations that are affected by rounding mode.
8238 Future versions of GCC may provide finer control of this setting
8239 using C99's @code{FENV_ACCESS} pragma. This command line option
8240 will be used to specify the default state for @code{FENV_ACCESS}.
8241
8242 @item -fsignaling-nans
8243 @opindex fsignaling-nans
8244 Compile code assuming that IEEE signaling NaNs may generate user-visible
8245 traps during floating-point operations. Setting this option disables
8246 optimizations that may change the number of exceptions visible with
8247 signaling NaNs. This option implies @option{-ftrapping-math}.
8248
8249 This option causes the preprocessor macro @code{__SUPPORT_SNAN__} to
8250 be defined.
8251
8252 The default is @option{-fno-signaling-nans}.
8253
8254 This option is experimental and does not currently guarantee to
8255 disable all GCC optimizations that affect signaling NaN behavior.
8256
8257 @item -fsingle-precision-constant
8258 @opindex fsingle-precision-constant
8259 Treat floating point constant as single precision constant instead of
8260 implicitly converting it to double precision constant.
8261
8262 @item -fcx-limited-range
8263 @opindex fcx-limited-range
8264 When enabled, this option states that a range reduction step is not
8265 needed when performing complex division. Also, there is no checking
8266 whether the result of a complex multiplication or division is @code{NaN
8267 + I*NaN}, with an attempt to rescue the situation in that case. The
8268 default is @option{-fno-cx-limited-range}, but is enabled by
8269 @option{-ffast-math}.
8270
8271 This option controls the default setting of the ISO C99
8272 @code{CX_LIMITED_RANGE} pragma. Nevertheless, the option applies to
8273 all languages.
8274
8275 @item -fcx-fortran-rules
8276 @opindex fcx-fortran-rules
8277 Complex multiplication and division follow Fortran rules. Range
8278 reduction is done as part of complex division, but there is no checking
8279 whether the result of a complex multiplication or division is @code{NaN
8280 + I*NaN}, with an attempt to rescue the situation in that case.
8281
8282 The default is @option{-fno-cx-fortran-rules}.
8283
8284 @end table
8285
8286 The following options control optimizations that may improve
8287 performance, but are not enabled by any @option{-O} options. This
8288 section includes experimental options that may produce broken code.
8289
8290 @table @gcctabopt
8291 @item -fbranch-probabilities
8292 @opindex fbranch-probabilities
8293 After running a program compiled with @option{-fprofile-arcs}
8294 (@pxref{Debugging Options,, Options for Debugging Your Program or
8295 @command{gcc}}), you can compile it a second time using
8296 @option{-fbranch-probabilities}, to improve optimizations based on
8297 the number of times each branch was taken. When the program
8298 compiled with @option{-fprofile-arcs} exits it saves arc execution
8299 counts to a file called @file{@var{sourcename}.gcda} for each source
8300 file. The information in this data file is very dependent on the
8301 structure of the generated code, so you must use the same source code
8302 and the same optimization options for both compilations.
8303
8304 With @option{-fbranch-probabilities}, GCC puts a
8305 @samp{REG_BR_PROB} note on each @samp{JUMP_INSN} and @samp{CALL_INSN}.
8306 These can be used to improve optimization. Currently, they are only
8307 used in one place: in @file{reorg.c}, instead of guessing which path a
8308 branch is most likely to take, the @samp{REG_BR_PROB} values are used to
8309 exactly determine which path is taken more often.
8310
8311 @item -fprofile-values
8312 @opindex fprofile-values
8313 If combined with @option{-fprofile-arcs}, it adds code so that some
8314 data about values of expressions in the program is gathered.
8315
8316 With @option{-fbranch-probabilities}, it reads back the data gathered
8317 from profiling values of expressions for usage in optimizations.
8318
8319 Enabled with @option{-fprofile-generate} and @option{-fprofile-use}.
8320
8321 @item -fvpt
8322 @opindex fvpt
8323 If combined with @option{-fprofile-arcs}, it instructs the compiler to add
8324 a code to gather information about values of expressions.
8325
8326 With @option{-fbranch-probabilities}, it reads back the data gathered
8327 and actually performs the optimizations based on them.
8328 Currently the optimizations include specialization of division operation
8329 using the knowledge about the value of the denominator.
8330
8331 @item -frename-registers
8332 @opindex frename-registers
8333 Attempt to avoid false dependencies in scheduled code by making use
8334 of registers left over after register allocation. This optimization
8335 will most benefit processors with lots of registers. Depending on the
8336 debug information format adopted by the target, however, it can
8337 make debugging impossible, since variables will no longer stay in
8338 a ``home register''.
8339
8340 Enabled by default with @option{-funroll-loops} and @option{-fpeel-loops}.
8341
8342 @item -ftracer
8343 @opindex ftracer
8344 Perform tail duplication to enlarge superblock size. This transformation
8345 simplifies the control flow of the function allowing other optimizations to do
8346 better job.
8347
8348 Enabled with @option{-fprofile-use}.
8349
8350 @item -funroll-loops
8351 @opindex funroll-loops
8352 Unroll loops whose number of iterations can be determined at compile time or
8353 upon entry to the loop. @option{-funroll-loops} implies
8354 @option{-frerun-cse-after-loop}, @option{-fweb} and @option{-frename-registers}.
8355 It also turns on complete loop peeling (i.e.@: complete removal of loops with
8356 small constant number of iterations). This option makes code larger, and may
8357 or may not make it run faster.
8358
8359 Enabled with @option{-fprofile-use}.
8360
8361 @item -funroll-all-loops
8362 @opindex funroll-all-loops
8363 Unroll all loops, even if their number of iterations is uncertain when
8364 the loop is entered. This usually makes programs run more slowly.
8365 @option{-funroll-all-loops} implies the same options as
8366 @option{-funroll-loops}.
8367
8368 @item -fpeel-loops
8369 @opindex fpeel-loops
8370 Peels the loops for that there is enough information that they do not
8371 roll much (from profile feedback). It also turns on complete loop peeling
8372 (i.e.@: complete removal of loops with small constant number of iterations).
8373
8374 Enabled with @option{-fprofile-use}.
8375
8376 @item -fmove-loop-invariants
8377 @opindex fmove-loop-invariants
8378 Enables the loop invariant motion pass in the RTL loop optimizer. Enabled
8379 at level @option{-O1}
8380
8381 @item -funswitch-loops
8382 @opindex funswitch-loops
8383 Move branches with loop invariant conditions out of the loop, with duplicates
8384 of the loop on both branches (modified according to result of the condition).
8385
8386 @item -ffunction-sections
8387 @itemx -fdata-sections
8388 @opindex ffunction-sections
8389 @opindex fdata-sections
8390 Place each function or data item into its own section in the output
8391 file if the target supports arbitrary sections. The name of the
8392 function or the name of the data item determines the section's name
8393 in the output file.
8394
8395 Use these options on systems where the linker can perform optimizations
8396 to improve locality of reference in the instruction space. Most systems
8397 using the ELF object format and SPARC processors running Solaris 2 have
8398 linkers with such optimizations. AIX may have these optimizations in
8399 the future.
8400
8401 Only use these options when there are significant benefits from doing
8402 so. When you specify these options, the assembler and linker will
8403 create larger object and executable files and will also be slower.
8404 You will not be able to use @code{gprof} on all systems if you
8405 specify this option and you may have problems with debugging if
8406 you specify both this option and @option{-g}.
8407
8408 @item -fbranch-target-load-optimize
8409 @opindex fbranch-target-load-optimize
8410 Perform branch target register load optimization before prologue / epilogue
8411 threading.
8412 The use of target registers can typically be exposed only during reload,
8413 thus hoisting loads out of loops and doing inter-block scheduling needs
8414 a separate optimization pass.
8415
8416 @item -fbranch-target-load-optimize2
8417 @opindex fbranch-target-load-optimize2
8418 Perform branch target register load optimization after prologue / epilogue
8419 threading.
8420
8421 @item -fbtr-bb-exclusive
8422 @opindex fbtr-bb-exclusive
8423 When performing branch target register load optimization, don't reuse
8424 branch target registers in within any basic block.
8425
8426 @item -fstack-protector
8427 @opindex fstack-protector
8428 Emit extra code to check for buffer overflows, such as stack smashing
8429 attacks. This is done by adding a guard variable to functions with
8430 vulnerable objects. This includes functions that call alloca, and
8431 functions with buffers larger than 8 bytes. The guards are initialized
8432 when a function is entered and then checked when the function exits.
8433 If a guard check fails, an error message is printed and the program exits.
8434
8435 @item -fstack-protector-all
8436 @opindex fstack-protector-all
8437 Like @option{-fstack-protector} except that all functions are protected.
8438
8439 @item -fsection-anchors
8440 @opindex fsection-anchors
8441 Try to reduce the number of symbolic address calculations by using
8442 shared ``anchor'' symbols to address nearby objects. This transformation
8443 can help to reduce the number of GOT entries and GOT accesses on some
8444 targets.
8445
8446 For example, the implementation of the following function @code{foo}:
8447
8448 @smallexample
8449 static int a, b, c;
8450 int foo (void) @{ return a + b + c; @}
8451 @end smallexample
8452
8453 would usually calculate the addresses of all three variables, but if you
8454 compile it with @option{-fsection-anchors}, it will access the variables
8455 from a common anchor point instead. The effect is similar to the
8456 following pseudocode (which isn't valid C):
8457
8458 @smallexample
8459 int foo (void)
8460 @{
8461 register int *xr = &x;
8462 return xr[&a - &x] + xr[&b - &x] + xr[&c - &x];
8463 @}
8464 @end smallexample
8465
8466 Not all targets support this option.
8467
8468 @item --param @var{name}=@var{value}
8469 @opindex param
8470 In some places, GCC uses various constants to control the amount of
8471 optimization that is done. For example, GCC will not inline functions
8472 that contain more that a certain number of instructions. You can
8473 control some of these constants on the command-line using the
8474 @option{--param} option.
8475
8476 The names of specific parameters, and the meaning of the values, are
8477 tied to the internals of the compiler, and are subject to change
8478 without notice in future releases.
8479
8480 In each case, the @var{value} is an integer. The allowable choices for
8481 @var{name} are given in the following table:
8482
8483 @table @gcctabopt
8484 @item predictable-branch-outcome
8485 When branch is predicted to be taken with probability lower than this threshold
8486 (in percent), then it is considered well predictable. The default is 10.
8487
8488 @item max-crossjump-edges
8489 The maximum number of incoming edges to consider for crossjumping.
8490 The algorithm used by @option{-fcrossjumping} is @math{O(N^2)} in
8491 the number of edges incoming to each block. Increasing values mean
8492 more aggressive optimization, making the compile time increase with
8493 probably small improvement in executable size.
8494
8495 @item min-crossjump-insns
8496 The minimum number of instructions which must be matched at the end
8497 of two blocks before crossjumping will be performed on them. This
8498 value is ignored in the case where all instructions in the block being
8499 crossjumped from are matched. The default value is 5.
8500
8501 @item max-grow-copy-bb-insns
8502 The maximum code size expansion factor when copying basic blocks
8503 instead of jumping. The expansion is relative to a jump instruction.
8504 The default value is 8.
8505
8506 @item max-goto-duplication-insns
8507 The maximum number of instructions to duplicate to a block that jumps
8508 to a computed goto. To avoid @math{O(N^2)} behavior in a number of
8509 passes, GCC factors computed gotos early in the compilation process,
8510 and unfactors them as late as possible. Only computed jumps at the
8511 end of a basic blocks with no more than max-goto-duplication-insns are
8512 unfactored. The default value is 8.
8513
8514 @item max-delay-slot-insn-search
8515 The maximum number of instructions to consider when looking for an
8516 instruction to fill a delay slot. If more than this arbitrary number of
8517 instructions is searched, the time savings from filling the delay slot
8518 will be minimal so stop searching. Increasing values mean more
8519 aggressive optimization, making the compile time increase with probably
8520 small improvement in executable run time.
8521
8522 @item max-delay-slot-live-search
8523 When trying to fill delay slots, the maximum number of instructions to
8524 consider when searching for a block with valid live register
8525 information. Increasing this arbitrarily chosen value means more
8526 aggressive optimization, increasing the compile time. This parameter
8527 should be removed when the delay slot code is rewritten to maintain the
8528 control-flow graph.
8529
8530 @item max-gcse-memory
8531 The approximate maximum amount of memory that will be allocated in
8532 order to perform the global common subexpression elimination
8533 optimization. If more memory than specified is required, the
8534 optimization will not be done.
8535
8536 @item max-gcse-insertion-ratio
8537 If the ratio of expression insertions to deletions is larger than this value
8538 for any expression, then RTL PRE will insert or remove the expression and thus
8539 leave partially redundant computations in the instruction stream. The default value is 20.
8540
8541 @item max-pending-list-length
8542 The maximum number of pending dependencies scheduling will allow
8543 before flushing the current state and starting over. Large functions
8544 with few branches or calls can create excessively large lists which
8545 needlessly consume memory and resources.
8546
8547 @item max-modulo-backtrack-attempts
8548 The maximum number of backtrack attempts the scheduler should make
8549 when modulo scheduling a loop. Larger values can exponentially increase
8550 compile time.
8551
8552 @item max-inline-insns-single
8553 Several parameters control the tree inliner used in gcc.
8554 This number sets the maximum number of instructions (counted in GCC's
8555 internal representation) in a single function that the tree inliner
8556 will consider for inlining. This only affects functions declared
8557 inline and methods implemented in a class declaration (C++).
8558 The default value is 400.
8559
8560 @item max-inline-insns-auto
8561 When you use @option{-finline-functions} (included in @option{-O3}),
8562 a lot of functions that would otherwise not be considered for inlining
8563 by the compiler will be investigated. To those functions, a different
8564 (more restrictive) limit compared to functions declared inline can
8565 be applied.
8566 The default value is 40.
8567
8568 @item large-function-insns
8569 The limit specifying really large functions. For functions larger than this
8570 limit after inlining, inlining is constrained by
8571 @option{--param large-function-growth}. This parameter is useful primarily
8572 to avoid extreme compilation time caused by non-linear algorithms used by the
8573 backend.
8574 The default value is 2700.
8575
8576 @item large-function-growth
8577 Specifies maximal growth of large function caused by inlining in percents.
8578 The default value is 100 which limits large function growth to 2.0 times
8579 the original size.
8580
8581 @item large-unit-insns
8582 The limit specifying large translation unit. Growth caused by inlining of
8583 units larger than this limit is limited by @option{--param inline-unit-growth}.
8584 For small units this might be too tight (consider unit consisting of function A
8585 that is inline and B that just calls A three time. If B is small relative to
8586 A, the growth of unit is 300\% and yet such inlining is very sane. For very
8587 large units consisting of small inlineable functions however the overall unit
8588 growth limit is needed to avoid exponential explosion of code size. Thus for
8589 smaller units, the size is increased to @option{--param large-unit-insns}
8590 before applying @option{--param inline-unit-growth}. The default is 10000
8591
8592 @item inline-unit-growth
8593 Specifies maximal overall growth of the compilation unit caused by inlining.
8594 The default value is 30 which limits unit growth to 1.3 times the original
8595 size.
8596
8597 @item ipcp-unit-growth
8598 Specifies maximal overall growth of the compilation unit caused by
8599 interprocedural constant propagation. The default value is 10 which limits
8600 unit growth to 1.1 times the original size.
8601
8602 @item large-stack-frame
8603 The limit specifying large stack frames. While inlining the algorithm is trying
8604 to not grow past this limit too much. Default value is 256 bytes.
8605
8606 @item large-stack-frame-growth
8607 Specifies maximal growth of large stack frames caused by inlining in percents.
8608 The default value is 1000 which limits large stack frame growth to 11 times
8609 the original size.
8610
8611 @item max-inline-insns-recursive
8612 @itemx max-inline-insns-recursive-auto
8613 Specifies maximum number of instructions out-of-line copy of self recursive inline
8614 function can grow into by performing recursive inlining.
8615
8616 For functions declared inline @option{--param max-inline-insns-recursive} is
8617 taken into account. For function not declared inline, recursive inlining
8618 happens only when @option{-finline-functions} (included in @option{-O3}) is
8619 enabled and @option{--param max-inline-insns-recursive-auto} is used. The
8620 default value is 450.
8621
8622 @item max-inline-recursive-depth
8623 @itemx max-inline-recursive-depth-auto
8624 Specifies maximum recursion depth used by the recursive inlining.
8625
8626 For functions declared inline @option{--param max-inline-recursive-depth} is
8627 taken into account. For function not declared inline, recursive inlining
8628 happens only when @option{-finline-functions} (included in @option{-O3}) is
8629 enabled and @option{--param max-inline-recursive-depth-auto} is used. The
8630 default value is 8.
8631
8632 @item min-inline-recursive-probability
8633 Recursive inlining is profitable only for function having deep recursion
8634 in average and can hurt for function having little recursion depth by
8635 increasing the prologue size or complexity of function body to other
8636 optimizers.
8637
8638 When profile feedback is available (see @option{-fprofile-generate}) the actual
8639 recursion depth can be guessed from probability that function will recurse via
8640 given call expression. This parameter limits inlining only to call expression
8641 whose probability exceeds given threshold (in percents). The default value is
8642 10.
8643
8644 @item early-inlining-insns
8645 Specify growth that early inliner can make. In effect it increases amount of
8646 inlining for code having large abstraction penalty. The default value is 10.
8647
8648 @item max-early-inliner-iterations
8649 @itemx max-early-inliner-iterations
8650 Limit of iterations of early inliner. This basically bounds number of nested
8651 indirect calls early inliner can resolve. Deeper chains are still handled by
8652 late inlining.
8653
8654 @item comdat-sharing-probability
8655 @itemx comdat-sharing-probability
8656 Probability (in percent) that C++ inline function with comdat visibility
8657 will be shared across multiple compilation units. The default value is 20.
8658
8659 @item min-vect-loop-bound
8660 The minimum number of iterations under which a loop will not get vectorized
8661 when @option{-ftree-vectorize} is used. The number of iterations after
8662 vectorization needs to be greater than the value specified by this option
8663 to allow vectorization. The default value is 0.
8664
8665 @item gcse-cost-distance-ratio
8666 Scaling factor in calculation of maximum distance an expression
8667 can be moved by GCSE optimizations. This is currently supported only in the
8668 code hoisting pass. The bigger the ratio, the more aggressive code hoisting
8669 will be with simple expressions, i.e., the expressions which have cost
8670 less than @option{gcse-unrestricted-cost}. Specifying 0 will disable
8671 hoisting of simple expressions. The default value is 10.
8672
8673 @item gcse-unrestricted-cost
8674 Cost, roughly measured as the cost of a single typical machine
8675 instruction, at which GCSE optimizations will not constrain
8676 the distance an expression can travel. This is currently
8677 supported only in the code hoisting pass. The lesser the cost,
8678 the more aggressive code hoisting will be. Specifying 0 will
8679 allow all expressions to travel unrestricted distances.
8680 The default value is 3.
8681
8682 @item max-hoist-depth
8683 The depth of search in the dominator tree for expressions to hoist.
8684 This is used to avoid quadratic behavior in hoisting algorithm.
8685 The value of 0 will avoid limiting the search, but may slow down compilation
8686 of huge functions. The default value is 30.
8687
8688 @item max-tail-merge-comparisons
8689 The maximum amount of similar bbs to compare a bb with. This is used to
8690 avoid quadratic behaviour in tree tail merging. The default value is 10.
8691
8692 @item max-tail-merge-iterations
8693 The maximum amount of iterations of the pass over the function. This is used to
8694 limit run time in tree tail merging. The default value is 2.
8695
8696 @item max-unrolled-insns
8697 The maximum number of instructions that a loop should have if that loop
8698 is unrolled, and if the loop is unrolled, it determines how many times
8699 the loop code is unrolled.
8700
8701 @item max-average-unrolled-insns
8702 The maximum number of instructions biased by probabilities of their execution
8703 that a loop should have if that loop is unrolled, and if the loop is unrolled,
8704 it determines how many times the loop code is unrolled.
8705
8706 @item max-unroll-times
8707 The maximum number of unrollings of a single loop.
8708
8709 @item max-peeled-insns
8710 The maximum number of instructions that a loop should have if that loop
8711 is peeled, and if the loop is peeled, it determines how many times
8712 the loop code is peeled.
8713
8714 @item max-peel-times
8715 The maximum number of peelings of a single loop.
8716
8717 @item max-completely-peeled-insns
8718 The maximum number of insns of a completely peeled loop.
8719
8720 @item max-completely-peel-times
8721 The maximum number of iterations of a loop to be suitable for complete peeling.
8722
8723 @item max-completely-peel-loop-nest-depth
8724 The maximum depth of a loop nest suitable for complete peeling.
8725
8726 @item max-unswitch-insns
8727 The maximum number of insns of an unswitched loop.
8728
8729 @item max-unswitch-level
8730 The maximum number of branches unswitched in a single loop.
8731
8732 @item lim-expensive
8733 The minimum cost of an expensive expression in the loop invariant motion.
8734
8735 @item iv-consider-all-candidates-bound
8736 Bound on number of candidates for induction variables below that
8737 all candidates are considered for each use in induction variable
8738 optimizations. Only the most relevant candidates are considered
8739 if there are more candidates, to avoid quadratic time complexity.
8740
8741 @item iv-max-considered-uses
8742 The induction variable optimizations give up on loops that contain more
8743 induction variable uses.
8744
8745 @item iv-always-prune-cand-set-bound
8746 If number of candidates in the set is smaller than this value,
8747 we always try to remove unnecessary ivs from the set during its
8748 optimization when a new iv is added to the set.
8749
8750 @item scev-max-expr-size
8751 Bound on size of expressions used in the scalar evolutions analyzer.
8752 Large expressions slow the analyzer.
8753
8754 @item scev-max-expr-complexity
8755 Bound on the complexity of the expressions in the scalar evolutions analyzer.
8756 Complex expressions slow the analyzer.
8757
8758 @item omega-max-vars
8759 The maximum number of variables in an Omega constraint system.
8760 The default value is 128.
8761
8762 @item omega-max-geqs
8763 The maximum number of inequalities in an Omega constraint system.
8764 The default value is 256.
8765
8766 @item omega-max-eqs
8767 The maximum number of equalities in an Omega constraint system.
8768 The default value is 128.
8769
8770 @item omega-max-wild-cards
8771 The maximum number of wildcard variables that the Omega solver will
8772 be able to insert. The default value is 18.
8773
8774 @item omega-hash-table-size
8775 The size of the hash table in the Omega solver. The default value is
8776 550.
8777
8778 @item omega-max-keys
8779 The maximal number of keys used by the Omega solver. The default
8780 value is 500.
8781
8782 @item omega-eliminate-redundant-constraints
8783 When set to 1, use expensive methods to eliminate all redundant
8784 constraints. The default value is 0.
8785
8786 @item vect-max-version-for-alignment-checks
8787 The maximum number of runtime checks that can be performed when
8788 doing loop versioning for alignment in the vectorizer. See option
8789 ftree-vect-loop-version for more information.
8790
8791 @item vect-max-version-for-alias-checks
8792 The maximum number of runtime checks that can be performed when
8793 doing loop versioning for alias in the vectorizer. See option
8794 ftree-vect-loop-version for more information.
8795
8796 @item max-iterations-to-track
8797
8798 The maximum number of iterations of a loop the brute force algorithm
8799 for analysis of # of iterations of the loop tries to evaluate.
8800
8801 @item hot-bb-count-fraction
8802 Select fraction of the maximal count of repetitions of basic block in program
8803 given basic block needs to have to be considered hot.
8804
8805 @item hot-bb-frequency-fraction
8806 Select fraction of the entry block frequency of executions of basic block in
8807 function given basic block needs to have to be considered hot.
8808
8809 @item max-predicted-iterations
8810 The maximum number of loop iterations we predict statically. This is useful
8811 in cases where function contain single loop with known bound and other loop
8812 with unknown. We predict the known number of iterations correctly, while
8813 the unknown number of iterations average to roughly 10. This means that the
8814 loop without bounds would appear artificially cold relative to the other one.
8815
8816 @item align-threshold
8817
8818 Select fraction of the maximal frequency of executions of basic block in
8819 function given basic block will get aligned.
8820
8821 @item align-loop-iterations
8822
8823 A loop expected to iterate at lest the selected number of iterations will get
8824 aligned.
8825
8826 @item tracer-dynamic-coverage
8827 @itemx tracer-dynamic-coverage-feedback
8828
8829 This value is used to limit superblock formation once the given percentage of
8830 executed instructions is covered. This limits unnecessary code size
8831 expansion.
8832
8833 The @option{tracer-dynamic-coverage-feedback} is used only when profile
8834 feedback is available. The real profiles (as opposed to statically estimated
8835 ones) are much less balanced allowing the threshold to be larger value.
8836
8837 @item tracer-max-code-growth
8838 Stop tail duplication once code growth has reached given percentage. This is
8839 rather hokey argument, as most of the duplicates will be eliminated later in
8840 cross jumping, so it may be set to much higher values than is the desired code
8841 growth.
8842
8843 @item tracer-min-branch-ratio
8844
8845 Stop reverse growth when the reverse probability of best edge is less than this
8846 threshold (in percent).
8847
8848 @item tracer-min-branch-ratio
8849 @itemx tracer-min-branch-ratio-feedback
8850
8851 Stop forward growth if the best edge do have probability lower than this
8852 threshold.
8853
8854 Similarly to @option{tracer-dynamic-coverage} two values are present, one for
8855 compilation for profile feedback and one for compilation without. The value
8856 for compilation with profile feedback needs to be more conservative (higher) in
8857 order to make tracer effective.
8858
8859 @item max-cse-path-length
8860
8861 Maximum number of basic blocks on path that cse considers. The default is 10.
8862
8863 @item max-cse-insns
8864 The maximum instructions CSE process before flushing. The default is 1000.
8865
8866 @item ggc-min-expand
8867
8868 GCC uses a garbage collector to manage its own memory allocation. This
8869 parameter specifies the minimum percentage by which the garbage
8870 collector's heap should be allowed to expand between collections.
8871 Tuning this may improve compilation speed; it has no effect on code
8872 generation.
8873
8874 The default is 30% + 70% * (RAM/1GB) with an upper bound of 100% when
8875 RAM >= 1GB@. If @code{getrlimit} is available, the notion of "RAM" is
8876 the smallest of actual RAM and @code{RLIMIT_DATA} or @code{RLIMIT_AS}. If
8877 GCC is not able to calculate RAM on a particular platform, the lower
8878 bound of 30% is used. Setting this parameter and
8879 @option{ggc-min-heapsize} to zero causes a full collection to occur at
8880 every opportunity. This is extremely slow, but can be useful for
8881 debugging.
8882
8883 @item ggc-min-heapsize
8884
8885 Minimum size of the garbage collector's heap before it begins bothering
8886 to collect garbage. The first collection occurs after the heap expands
8887 by @option{ggc-min-expand}% beyond @option{ggc-min-heapsize}. Again,
8888 tuning this may improve compilation speed, and has no effect on code
8889 generation.
8890
8891 The default is the smaller of RAM/8, RLIMIT_RSS, or a limit which
8892 tries to ensure that RLIMIT_DATA or RLIMIT_AS are not exceeded, but
8893 with a lower bound of 4096 (four megabytes) and an upper bound of
8894 131072 (128 megabytes). If GCC is not able to calculate RAM on a
8895 particular platform, the lower bound is used. Setting this parameter
8896 very large effectively disables garbage collection. Setting this
8897 parameter and @option{ggc-min-expand} to zero causes a full collection
8898 to occur at every opportunity.
8899
8900 @item max-reload-search-insns
8901 The maximum number of instruction reload should look backward for equivalent
8902 register. Increasing values mean more aggressive optimization, making the
8903 compile time increase with probably slightly better performance. The default
8904 value is 100.
8905
8906 @item max-cselib-memory-locations
8907 The maximum number of memory locations cselib should take into account.
8908 Increasing values mean more aggressive optimization, making the compile time
8909 increase with probably slightly better performance. The default value is 500.
8910
8911 @item reorder-blocks-duplicate
8912 @itemx reorder-blocks-duplicate-feedback
8913
8914 Used by basic block reordering pass to decide whether to use unconditional
8915 branch or duplicate the code on its destination. Code is duplicated when its
8916 estimated size is smaller than this value multiplied by the estimated size of
8917 unconditional jump in the hot spots of the program.
8918
8919 The @option{reorder-block-duplicate-feedback} is used only when profile
8920 feedback is available and may be set to higher values than
8921 @option{reorder-block-duplicate} since information about the hot spots is more
8922 accurate.
8923
8924 @item max-sched-ready-insns
8925 The maximum number of instructions ready to be issued the scheduler should
8926 consider at any given time during the first scheduling pass. Increasing
8927 values mean more thorough searches, making the compilation time increase
8928 with probably little benefit. The default value is 100.
8929
8930 @item max-sched-region-blocks
8931 The maximum number of blocks in a region to be considered for
8932 interblock scheduling. The default value is 10.
8933
8934 @item max-pipeline-region-blocks
8935 The maximum number of blocks in a region to be considered for
8936 pipelining in the selective scheduler. The default value is 15.
8937
8938 @item max-sched-region-insns
8939 The maximum number of insns in a region to be considered for
8940 interblock scheduling. The default value is 100.
8941
8942 @item max-pipeline-region-insns
8943 The maximum number of insns in a region to be considered for
8944 pipelining in the selective scheduler. The default value is 200.
8945
8946 @item min-spec-prob
8947 The minimum probability (in percents) of reaching a source block
8948 for interblock speculative scheduling. The default value is 40.
8949
8950 @item max-sched-extend-regions-iters
8951 The maximum number of iterations through CFG to extend regions.
8952 0 - disable region extension,
8953 N - do at most N iterations.
8954 The default value is 0.
8955
8956 @item max-sched-insn-conflict-delay
8957 The maximum conflict delay for an insn to be considered for speculative motion.
8958 The default value is 3.
8959
8960 @item sched-spec-prob-cutoff
8961 The minimal probability of speculation success (in percents), so that
8962 speculative insn will be scheduled.
8963 The default value is 40.
8964
8965 @item sched-mem-true-dep-cost
8966 Minimal distance (in CPU cycles) between store and load targeting same
8967 memory locations. The default value is 1.
8968
8969 @item selsched-max-lookahead
8970 The maximum size of the lookahead window of selective scheduling. It is a
8971 depth of search for available instructions.
8972 The default value is 50.
8973
8974 @item selsched-max-sched-times
8975 The maximum number of times that an instruction will be scheduled during
8976 selective scheduling. This is the limit on the number of iterations
8977 through which the instruction may be pipelined. The default value is 2.
8978
8979 @item selsched-max-insns-to-rename
8980 The maximum number of best instructions in the ready list that are considered
8981 for renaming in the selective scheduler. The default value is 2.
8982
8983 @item sms-min-sc
8984 The minimum value of stage count that swing modulo scheduler will
8985 generate. The default value is 2.
8986
8987 @item max-last-value-rtl
8988 The maximum size measured as number of RTLs that can be recorded in an expression
8989 in combiner for a pseudo register as last known value of that register. The default
8990 is 10000.
8991
8992 @item integer-share-limit
8993 Small integer constants can use a shared data structure, reducing the
8994 compiler's memory usage and increasing its speed. This sets the maximum
8995 value of a shared integer constant. The default value is 256.
8996
8997 @item min-virtual-mappings
8998 Specifies the minimum number of virtual mappings in the incremental
8999 SSA updater that should be registered to trigger the virtual mappings
9000 heuristic defined by virtual-mappings-ratio. The default value is
9001 100.
9002
9003 @item virtual-mappings-ratio
9004 If the number of virtual mappings is virtual-mappings-ratio bigger
9005 than the number of virtual symbols to be updated, then the incremental
9006 SSA updater switches to a full update for those symbols. The default
9007 ratio is 3.
9008
9009 @item ssp-buffer-size
9010 The minimum size of buffers (i.e.@: arrays) that will receive stack smashing
9011 protection when @option{-fstack-protection} is used.
9012
9013 @item max-jump-thread-duplication-stmts
9014 Maximum number of statements allowed in a block that needs to be
9015 duplicated when threading jumps.
9016
9017 @item max-fields-for-field-sensitive
9018 Maximum number of fields in a structure we will treat in
9019 a field sensitive manner during pointer analysis. The default is zero
9020 for -O0, and -O1 and 100 for -Os, -O2, and -O3.
9021
9022 @item prefetch-latency
9023 Estimate on average number of instructions that are executed before
9024 prefetch finishes. The distance we prefetch ahead is proportional
9025 to this constant. Increasing this number may also lead to less
9026 streams being prefetched (see @option{simultaneous-prefetches}).
9027
9028 @item simultaneous-prefetches
9029 Maximum number of prefetches that can run at the same time.
9030
9031 @item l1-cache-line-size
9032 The size of cache line in L1 cache, in bytes.
9033
9034 @item l1-cache-size
9035 The size of L1 cache, in kilobytes.
9036
9037 @item l2-cache-size
9038 The size of L2 cache, in kilobytes.
9039
9040 @item min-insn-to-prefetch-ratio
9041 The minimum ratio between the number of instructions and the
9042 number of prefetches to enable prefetching in a loop.
9043
9044 @item prefetch-min-insn-to-mem-ratio
9045 The minimum ratio between the number of instructions and the
9046 number of memory references to enable prefetching in a loop.
9047
9048 @item use-canonical-types
9049 Whether the compiler should use the ``canonical'' type system. By
9050 default, this should always be 1, which uses a more efficient internal
9051 mechanism for comparing types in C++ and Objective-C++. However, if
9052 bugs in the canonical type system are causing compilation failures,
9053 set this value to 0 to disable canonical types.
9054
9055 @item switch-conversion-max-branch-ratio
9056 Switch initialization conversion will refuse to create arrays that are
9057 bigger than @option{switch-conversion-max-branch-ratio} times the number of
9058 branches in the switch.
9059
9060 @item max-partial-antic-length
9061 Maximum length of the partial antic set computed during the tree
9062 partial redundancy elimination optimization (@option{-ftree-pre}) when
9063 optimizing at @option{-O3} and above. For some sorts of source code
9064 the enhanced partial redundancy elimination optimization can run away,
9065 consuming all of the memory available on the host machine. This
9066 parameter sets a limit on the length of the sets that are computed,
9067 which prevents the runaway behavior. Setting a value of 0 for
9068 this parameter will allow an unlimited set length.
9069
9070 @item sccvn-max-scc-size
9071 Maximum size of a strongly connected component (SCC) during SCCVN
9072 processing. If this limit is hit, SCCVN processing for the whole
9073 function will not be done and optimizations depending on it will
9074 be disabled. The default maximum SCC size is 10000.
9075
9076 @item ira-max-loops-num
9077 IRA uses a regional register allocation by default. If a function
9078 contains loops more than number given by the parameter, only at most
9079 given number of the most frequently executed loops will form regions
9080 for the regional register allocation. The default value of the
9081 parameter is 100.
9082
9083 @item ira-max-conflict-table-size
9084 Although IRA uses a sophisticated algorithm of compression conflict
9085 table, the table can be still big for huge functions. If the conflict
9086 table for a function could be more than size in MB given by the
9087 parameter, the conflict table is not built and faster, simpler, and
9088 lower quality register allocation algorithm will be used. The
9089 algorithm do not use pseudo-register conflicts. The default value of
9090 the parameter is 2000.
9091
9092 @item ira-loop-reserved-regs
9093 IRA can be used to evaluate more accurate register pressure in loops
9094 for decision to move loop invariants (see @option{-O3}). The number
9095 of available registers reserved for some other purposes is described
9096 by this parameter. The default value of the parameter is 2 which is
9097 minimal number of registers needed for execution of typical
9098 instruction. This value is the best found from numerous experiments.
9099
9100 @item loop-invariant-max-bbs-in-loop
9101 Loop invariant motion can be very expensive, both in compile time and
9102 in amount of needed compile time memory, with very large loops. Loops
9103 with more basic blocks than this parameter won't have loop invariant
9104 motion optimization performed on them. The default value of the
9105 parameter is 1000 for -O1 and 10000 for -O2 and above.
9106
9107 @item max-vartrack-size
9108 Sets a maximum number of hash table slots to use during variable
9109 tracking dataflow analysis of any function. If this limit is exceeded
9110 with variable tracking at assignments enabled, analysis for that
9111 function is retried without it, after removing all debug insns from
9112 the function. If the limit is exceeded even without debug insns, var
9113 tracking analysis is completely disabled for the function. Setting
9114 the parameter to zero makes it unlimited.
9115
9116 @item max-vartrack-expr-depth
9117 Sets a maximum number of recursion levels when attempting to map
9118 variable names or debug temporaries to value expressions. This trades
9119 compile time for more complete debug information. If this is set too
9120 low, value expressions that are available and could be represented in
9121 debug information may end up not being used; setting this higher may
9122 enable the compiler to find more complex debug expressions, but compile
9123 time and memory use may grow. The default is 12.
9124
9125 @item min-nondebug-insn-uid
9126 Use uids starting at this parameter for nondebug insns. The range below
9127 the parameter is reserved exclusively for debug insns created by
9128 @option{-fvar-tracking-assignments}, but debug insns may get
9129 (non-overlapping) uids above it if the reserved range is exhausted.
9130
9131 @item ipa-sra-ptr-growth-factor
9132 IPA-SRA will replace a pointer to an aggregate with one or more new
9133 parameters only when their cumulative size is less or equal to
9134 @option{ipa-sra-ptr-growth-factor} times the size of the original
9135 pointer parameter.
9136
9137 @item tm-max-aggregate-size
9138 When making copies of thread-local variables in a transaction, this
9139 parameter specifies the size in bytes after which variables will be
9140 saved with the logging functions as opposed to save/restore code
9141 sequence pairs. This option only applies when using
9142 @option{-fgnu-tm}.
9143
9144 @item graphite-max-nb-scop-params
9145 To avoid exponential effects in the Graphite loop transforms, the
9146 number of parameters in a Static Control Part (SCoP) is bounded. The
9147 default value is 10 parameters. A variable whose value is unknown at
9148 compile time and defined outside a SCoP is a parameter of the SCoP.
9149
9150 @item graphite-max-bbs-per-function
9151 To avoid exponential effects in the detection of SCoPs, the size of
9152 the functions analyzed by Graphite is bounded. The default value is
9153 100 basic blocks.
9154
9155 @item loop-block-tile-size
9156 Loop blocking or strip mining transforms, enabled with
9157 @option{-floop-block} or @option{-floop-strip-mine}, strip mine each
9158 loop in the loop nest by a given number of iterations. The strip
9159 length can be changed using the @option{loop-block-tile-size}
9160 parameter. The default value is 51 iterations.
9161
9162 @item ipa-cp-value-list-size
9163 IPA-CP attempts to track all possible values and types passed to a function's
9164 parameter in order to propagate them and perform devirtualization.
9165 @option{ipa-cp-value-list-size} is the maximum number of values and types it
9166 stores per one formal parameter of a function.
9167
9168 @item lto-partitions
9169 Specify desired number of partitions produced during WHOPR compilation.
9170 The number of partitions should exceed the number of CPUs used for compilation.
9171 The default value is 32.
9172
9173 @item lto-minpartition
9174 Size of minimal partition for WHOPR (in estimated instructions).
9175 This prevents expenses of splitting very small programs into too many
9176 partitions.
9177
9178 @item cxx-max-namespaces-for-diagnostic-help
9179 The maximum number of namespaces to consult for suggestions when C++
9180 name lookup fails for an identifier. The default is 1000.
9181
9182 @item sink-frequency-threshold
9183 The maximum relative execution frequency (in percents) of the target block
9184 relative to a statement's original block to allow statement sinking of a
9185 statement. Larger numbers result in more aggressive statement sinking.
9186 The default value is 75. A small positive adjustment is applied for
9187 statements with memory operands as those are even more profitable so sink.
9188
9189 @item max-stores-to-sink
9190 The maximum number of conditional stores paires that can be sunk. Set to 0
9191 if either vectorization (@option{-ftree-vectorize}) or if-conversion
9192 (@option{-ftree-loop-if-convert}) is disabled. The default is 2.
9193
9194 @item allow-load-data-races
9195 Allow optimizers to introduce new data races on loads.
9196 Set to 1 to allow, otherwise to 0. This option is enabled by default
9197 unless implicitly set by the @option{-fmemory-model=} option.
9198
9199 @item allow-store-data-races
9200 Allow optimizers to introduce new data races on stores.
9201 Set to 1 to allow, otherwise to 0. This option is enabled by default
9202 unless implicitly set by the @option{-fmemory-model=} option.
9203
9204 @item allow-packed-load-data-races
9205 Allow optimizers to introduce new data races on packed data loads.
9206 Set to 1 to allow, otherwise to 0. This option is enabled by default
9207 unless implicitly set by the @option{-fmemory-model=} option.
9208
9209 @item allow-packed-store-data-races
9210 Allow optimizers to introduce new data races on packed data stores.
9211 Set to 1 to allow, otherwise to 0. This option is enabled by default
9212 unless implicitly set by the @option{-fmemory-model=} option.
9213
9214 @item case-values-threshold
9215 The smallest number of different values for which it is best to use a
9216 jump-table instead of a tree of conditional branches. If the value is
9217 0, use the default for the machine. The default is 0.
9218
9219 @item tree-reassoc-width
9220 Set the maximum number of instructions executed in parallel in
9221 reassociated tree. This parameter overrides target dependent
9222 heuristics used by default if has non zero value.
9223
9224 @end table
9225 @end table
9226
9227 @node Preprocessor Options
9228 @section Options Controlling the Preprocessor
9229 @cindex preprocessor options
9230 @cindex options, preprocessor
9231
9232 These options control the C preprocessor, which is run on each C source
9233 file before actual compilation.
9234
9235 If you use the @option{-E} option, nothing is done except preprocessing.
9236 Some of these options make sense only together with @option{-E} because
9237 they cause the preprocessor output to be unsuitable for actual
9238 compilation.
9239
9240 @table @gcctabopt
9241 @item -Wp,@var{option}
9242 @opindex Wp
9243 You can use @option{-Wp,@var{option}} to bypass the compiler driver
9244 and pass @var{option} directly through to the preprocessor. If
9245 @var{option} contains commas, it is split into multiple options at the
9246 commas. However, many options are modified, translated or interpreted
9247 by the compiler driver before being passed to the preprocessor, and
9248 @option{-Wp} forcibly bypasses this phase. The preprocessor's direct
9249 interface is undocumented and subject to change, so whenever possible
9250 you should avoid using @option{-Wp} and let the driver handle the
9251 options instead.
9252
9253 @item -Xpreprocessor @var{option}
9254 @opindex Xpreprocessor
9255 Pass @var{option} as an option to the preprocessor. You can use this to
9256 supply system-specific preprocessor options which GCC does not know how to
9257 recognize.
9258
9259 If you want to pass an option that takes an argument, you must use
9260 @option{-Xpreprocessor} twice, once for the option and once for the argument.
9261 @end table
9262
9263 @include cppopts.texi
9264
9265 @node Assembler Options
9266 @section Passing Options to the Assembler
9267
9268 @c prevent bad page break with this line
9269 You can pass options to the assembler.
9270
9271 @table @gcctabopt
9272 @item -Wa,@var{option}
9273 @opindex Wa
9274 Pass @var{option} as an option to the assembler. If @var{option}
9275 contains commas, it is split into multiple options at the commas.
9276
9277 @item -Xassembler @var{option}
9278 @opindex Xassembler
9279 Pass @var{option} as an option to the assembler. You can use this to
9280 supply system-specific assembler options which GCC does not know how to
9281 recognize.
9282
9283 If you want to pass an option that takes an argument, you must use
9284 @option{-Xassembler} twice, once for the option and once for the argument.
9285
9286 @end table
9287
9288 @node Link Options
9289 @section Options for Linking
9290 @cindex link options
9291 @cindex options, linking
9292
9293 These options come into play when the compiler links object files into
9294 an executable output file. They are meaningless if the compiler is
9295 not doing a link step.
9296
9297 @table @gcctabopt
9298 @cindex file names
9299 @item @var{object-file-name}
9300 A file name that does not end in a special recognized suffix is
9301 considered to name an object file or library. (Object files are
9302 distinguished from libraries by the linker according to the file
9303 contents.) If linking is done, these object files are used as input
9304 to the linker.
9305
9306 @item -c
9307 @itemx -S
9308 @itemx -E
9309 @opindex c
9310 @opindex S
9311 @opindex E
9312 If any of these options is used, then the linker is not run, and
9313 object file names should not be used as arguments. @xref{Overall
9314 Options}.
9315
9316 @cindex Libraries
9317 @item -l@var{library}
9318 @itemx -l @var{library}
9319 @opindex l
9320 Search the library named @var{library} when linking. (The second
9321 alternative with the library as a separate argument is only for
9322 POSIX compliance and is not recommended.)
9323
9324 It makes a difference where in the command you write this option; the
9325 linker searches and processes libraries and object files in the order they
9326 are specified. Thus, @samp{foo.o -lz bar.o} searches library @samp{z}
9327 after file @file{foo.o} but before @file{bar.o}. If @file{bar.o} refers
9328 to functions in @samp{z}, those functions may not be loaded.
9329
9330 The linker searches a standard list of directories for the library,
9331 which is actually a file named @file{lib@var{library}.a}. The linker
9332 then uses this file as if it had been specified precisely by name.
9333
9334 The directories searched include several standard system directories
9335 plus any that you specify with @option{-L}.
9336
9337 Normally the files found this way are library files---archive files
9338 whose members are object files. The linker handles an archive file by
9339 scanning through it for members which define symbols that have so far
9340 been referenced but not defined. But if the file that is found is an
9341 ordinary object file, it is linked in the usual fashion. The only
9342 difference between using an @option{-l} option and specifying a file name
9343 is that @option{-l} surrounds @var{library} with @samp{lib} and @samp{.a}
9344 and searches several directories.
9345
9346 @item -lobjc
9347 @opindex lobjc
9348 You need this special case of the @option{-l} option in order to
9349 link an Objective-C or Objective-C++ program.
9350
9351 @item -nostartfiles
9352 @opindex nostartfiles
9353 Do not use the standard system startup files when linking.
9354 The standard system libraries are used normally, unless @option{-nostdlib}
9355 or @option{-nodefaultlibs} is used.
9356
9357 @item -nodefaultlibs
9358 @opindex nodefaultlibs
9359 Do not use the standard system libraries when linking.
9360 Only the libraries you specify will be passed to the linker, options
9361 specifying linkage of the system libraries, such as @code{-static-libgcc}
9362 or @code{-shared-libgcc}, will be ignored.
9363 The standard startup files are used normally, unless @option{-nostartfiles}
9364 is used. The compiler may generate calls to @code{memcmp},
9365 @code{memset}, @code{memcpy} and @code{memmove}.
9366 These entries are usually resolved by entries in
9367 libc. These entry points should be supplied through some other
9368 mechanism when this option is specified.
9369
9370 @item -nostdlib
9371 @opindex nostdlib
9372 Do not use the standard system startup files or libraries when linking.
9373 No startup files and only the libraries you specify will be passed to
9374 the linker, options specifying linkage of the system libraries, such as
9375 @code{-static-libgcc} or @code{-shared-libgcc}, will be ignored.
9376 The compiler may generate calls to @code{memcmp}, @code{memset},
9377 @code{memcpy} and @code{memmove}.
9378 These entries are usually resolved by entries in
9379 libc. These entry points should be supplied through some other
9380 mechanism when this option is specified.
9381
9382 @cindex @option{-lgcc}, use with @option{-nostdlib}
9383 @cindex @option{-nostdlib} and unresolved references
9384 @cindex unresolved references and @option{-nostdlib}
9385 @cindex @option{-lgcc}, use with @option{-nodefaultlibs}
9386 @cindex @option{-nodefaultlibs} and unresolved references
9387 @cindex unresolved references and @option{-nodefaultlibs}
9388 One of the standard libraries bypassed by @option{-nostdlib} and
9389 @option{-nodefaultlibs} is @file{libgcc.a}, a library of internal subroutines
9390 that GCC uses to overcome shortcomings of particular machines, or special
9391 needs for some languages.
9392 (@xref{Interface,,Interfacing to GCC Output,gccint,GNU Compiler
9393 Collection (GCC) Internals},
9394 for more discussion of @file{libgcc.a}.)
9395 In most cases, you need @file{libgcc.a} even when you want to avoid
9396 other standard libraries. In other words, when you specify @option{-nostdlib}
9397 or @option{-nodefaultlibs} you should usually specify @option{-lgcc} as well.
9398 This ensures that you have no unresolved references to internal GCC
9399 library subroutines. (For example, @samp{__main}, used to ensure C++
9400 constructors will be called; @pxref{Collect2,,@code{collect2}, gccint,
9401 GNU Compiler Collection (GCC) Internals}.)
9402
9403 @item -pie
9404 @opindex pie
9405 Produce a position independent executable on targets which support it.
9406 For predictable results, you must also specify the same set of options
9407 that were used to generate code (@option{-fpie}, @option{-fPIE},
9408 or model suboptions) when you specify this option.
9409
9410 @item -rdynamic
9411 @opindex rdynamic
9412 Pass the flag @option{-export-dynamic} to the ELF linker, on targets
9413 that support it. This instructs the linker to add all symbols, not
9414 only used ones, to the dynamic symbol table. This option is needed
9415 for some uses of @code{dlopen} or to allow obtaining backtraces
9416 from within a program.
9417
9418 @item -s
9419 @opindex s
9420 Remove all symbol table and relocation information from the executable.
9421
9422 @item -static
9423 @opindex static
9424 On systems that support dynamic linking, this prevents linking with the shared
9425 libraries. On other systems, this option has no effect.
9426
9427 @item -shared
9428 @opindex shared
9429 Produce a shared object which can then be linked with other objects to
9430 form an executable. Not all systems support this option. For predictable
9431 results, you must also specify the same set of options that were used to
9432 generate code (@option{-fpic}, @option{-fPIC}, or model suboptions)
9433 when you specify this option.@footnote{On some systems, @samp{gcc -shared}
9434 needs to build supplementary stub code for constructors to work. On
9435 multi-libbed systems, @samp{gcc -shared} must select the correct support
9436 libraries to link against. Failing to supply the correct flags may lead
9437 to subtle defects. Supplying them in cases where they are not necessary
9438 is innocuous.}
9439
9440 @item -shared-libgcc
9441 @itemx -static-libgcc
9442 @opindex shared-libgcc
9443 @opindex static-libgcc
9444 On systems that provide @file{libgcc} as a shared library, these options
9445 force the use of either the shared or static version respectively.
9446 If no shared version of @file{libgcc} was built when the compiler was
9447 configured, these options have no effect.
9448
9449 There are several situations in which an application should use the
9450 shared @file{libgcc} instead of the static version. The most common
9451 of these is when the application wishes to throw and catch exceptions
9452 across different shared libraries. In that case, each of the libraries
9453 as well as the application itself should use the shared @file{libgcc}.
9454
9455 Therefore, the G++ and GCJ drivers automatically add
9456 @option{-shared-libgcc} whenever you build a shared library or a main
9457 executable, because C++ and Java programs typically use exceptions, so
9458 this is the right thing to do.
9459
9460 If, instead, you use the GCC driver to create shared libraries, you may
9461 find that they will not always be linked with the shared @file{libgcc}.
9462 If GCC finds, at its configuration time, that you have a non-GNU linker
9463 or a GNU linker that does not support option @option{--eh-frame-hdr},
9464 it will link the shared version of @file{libgcc} into shared libraries
9465 by default. Otherwise, it will take advantage of the linker and optimize
9466 away the linking with the shared version of @file{libgcc}, linking with
9467 the static version of libgcc by default. This allows exceptions to
9468 propagate through such shared libraries, without incurring relocation
9469 costs at library load time.
9470
9471 However, if a library or main executable is supposed to throw or catch
9472 exceptions, you must link it using the G++ or GCJ driver, as appropriate
9473 for the languages used in the program, or using the option
9474 @option{-shared-libgcc}, such that it is linked with the shared
9475 @file{libgcc}.
9476
9477 @item -static-libstdc++
9478 When the @command{g++} program is used to link a C++ program, it will
9479 normally automatically link against @option{libstdc++}. If
9480 @file{libstdc++} is available as a shared library, and the
9481 @option{-static} option is not used, then this will link against the
9482 shared version of @file{libstdc++}. That is normally fine. However, it
9483 is sometimes useful to freeze the version of @file{libstdc++} used by
9484 the program without going all the way to a fully static link. The
9485 @option{-static-libstdc++} option directs the @command{g++} driver to
9486 link @file{libstdc++} statically, without necessarily linking other
9487 libraries statically.
9488
9489 @item -symbolic
9490 @opindex symbolic
9491 Bind references to global symbols when building a shared object. Warn
9492 about any unresolved references (unless overridden by the link editor
9493 option @samp{-Xlinker -z -Xlinker defs}). Only a few systems support
9494 this option.
9495
9496 @item -T @var{script}
9497 @opindex T
9498 @cindex linker script
9499 Use @var{script} as the linker script. This option is supported by most
9500 systems using the GNU linker. On some targets, such as bare-board
9501 targets without an operating system, the @option{-T} option may be required
9502 when linking to avoid references to undefined symbols.
9503
9504 @item -Xlinker @var{option}
9505 @opindex Xlinker
9506 Pass @var{option} as an option to the linker. You can use this to
9507 supply system-specific linker options which GCC does not know how to
9508 recognize.
9509
9510 If you want to pass an option that takes a separate argument, you must use
9511 @option{-Xlinker} twice, once for the option and once for the argument.
9512 For example, to pass @option{-assert definitions}, you must write
9513 @samp{-Xlinker -assert -Xlinker definitions}. It does not work to write
9514 @option{-Xlinker "-assert definitions"}, because this passes the entire
9515 string as a single argument, which is not what the linker expects.
9516
9517 When using the GNU linker, it is usually more convenient to pass
9518 arguments to linker options using the @option{@var{option}=@var{value}}
9519 syntax than as separate arguments. For example, you can specify
9520 @samp{-Xlinker -Map=output.map} rather than
9521 @samp{-Xlinker -Map -Xlinker output.map}. Other linkers may not support
9522 this syntax for command-line options.
9523
9524 @item -Wl,@var{option}
9525 @opindex Wl
9526 Pass @var{option} as an option to the linker. If @var{option} contains
9527 commas, it is split into multiple options at the commas. You can use this
9528 syntax to pass an argument to the option.
9529 For example, @samp{-Wl,-Map,output.map} passes @samp{-Map output.map} to the
9530 linker. When using the GNU linker, you can also get the same effect with
9531 @samp{-Wl,-Map=output.map}.
9532
9533 @item -u @var{symbol}
9534 @opindex u
9535 Pretend the symbol @var{symbol} is undefined, to force linking of
9536 library modules to define it. You can use @option{-u} multiple times with
9537 different symbols to force loading of additional library modules.
9538 @end table
9539
9540 @node Directory Options
9541 @section Options for Directory Search
9542 @cindex directory options
9543 @cindex options, directory search
9544 @cindex search path
9545
9546 These options specify directories to search for header files, for
9547 libraries and for parts of the compiler:
9548
9549 @table @gcctabopt
9550 @item -I@var{dir}
9551 @opindex I
9552 Add the directory @var{dir} to the head of the list of directories to be
9553 searched for header files. This can be used to override a system header
9554 file, substituting your own version, since these directories are
9555 searched before the system header file directories. However, you should
9556 not use this option to add directories that contain vendor-supplied
9557 system header files (use @option{-isystem} for that). If you use more than
9558 one @option{-I} option, the directories are scanned in left-to-right
9559 order; the standard system directories come after.
9560
9561 If a standard system include directory, or a directory specified with
9562 @option{-isystem}, is also specified with @option{-I}, the @option{-I}
9563 option will be ignored. The directory will still be searched but as a
9564 system directory at its normal position in the system include chain.
9565 This is to ensure that GCC's procedure to fix buggy system headers and
9566 the ordering for the include_next directive are not inadvertently changed.
9567 If you really need to change the search order for system directories,
9568 use the @option{-nostdinc} and/or @option{-isystem} options.
9569
9570 @item -iplugindir=@var{dir}
9571 Set the directory to search for plugins which are passed
9572 by @option{-fplugin=@var{name}} instead of
9573 @option{-fplugin=@var{path}/@var{name}.so}. This option is not meant
9574 to be used by the user, but only passed by the driver.
9575
9576 @item -iquote@var{dir}
9577 @opindex iquote
9578 Add the directory @var{dir} to the head of the list of directories to
9579 be searched for header files only for the case of @samp{#include
9580 "@var{file}"}; they are not searched for @samp{#include <@var{file}>},
9581 otherwise just like @option{-I}.
9582
9583 @item -L@var{dir}
9584 @opindex L
9585 Add directory @var{dir} to the list of directories to be searched
9586 for @option{-l}.
9587
9588 @item -B@var{prefix}
9589 @opindex B
9590 This option specifies where to find the executables, libraries,
9591 include files, and data files of the compiler itself.
9592
9593 The compiler driver program runs one or more of the subprograms
9594 @file{cpp}, @file{cc1}, @file{as} and @file{ld}. It tries
9595 @var{prefix} as a prefix for each program it tries to run, both with and
9596 without @samp{@var{machine}/@var{version}/} (@pxref{Target Options}).
9597
9598 For each subprogram to be run, the compiler driver first tries the
9599 @option{-B} prefix, if any. If that name is not found, or if @option{-B}
9600 was not specified, the driver tries two standard prefixes, which are
9601 @file{/usr/lib/gcc/} and @file{/usr/local/lib/gcc/}. If neither of
9602 those results in a file name that is found, the unmodified program
9603 name is searched for using the directories specified in your
9604 @env{PATH} environment variable.
9605
9606 The compiler will check to see if the path provided by the @option{-B}
9607 refers to a directory, and if necessary it will add a directory
9608 separator character at the end of the path.
9609
9610 @option{-B} prefixes that effectively specify directory names also apply
9611 to libraries in the linker, because the compiler translates these
9612 options into @option{-L} options for the linker. They also apply to
9613 includes files in the preprocessor, because the compiler translates these
9614 options into @option{-isystem} options for the preprocessor. In this case,
9615 the compiler appends @samp{include} to the prefix.
9616
9617 The run-time support file @file{libgcc.a} can also be searched for using
9618 the @option{-B} prefix, if needed. If it is not found there, the two
9619 standard prefixes above are tried, and that is all. The file is left
9620 out of the link if it is not found by those means.
9621
9622 Another way to specify a prefix much like the @option{-B} prefix is to use
9623 the environment variable @env{GCC_EXEC_PREFIX}. @xref{Environment
9624 Variables}.
9625
9626 As a special kludge, if the path provided by @option{-B} is
9627 @file{[dir/]stage@var{N}/}, where @var{N} is a number in the range 0 to
9628 9, then it will be replaced by @file{[dir/]include}. This is to help
9629 with boot-strapping the compiler.
9630
9631 @item -specs=@var{file}
9632 @opindex specs
9633 Process @var{file} after the compiler reads in the standard @file{specs}
9634 file, in order to override the defaults that the @file{gcc} driver
9635 program uses when determining what switches to pass to @file{cc1},
9636 @file{cc1plus}, @file{as}, @file{ld}, etc. More than one
9637 @option{-specs=@var{file}} can be specified on the command line, and they
9638 are processed in order, from left to right.
9639
9640 @item --sysroot=@var{dir}
9641 @opindex sysroot
9642 Use @var{dir} as the logical root directory for headers and libraries.
9643 For example, if the compiler would normally search for headers in
9644 @file{/usr/include} and libraries in @file{/usr/lib}, it will instead
9645 search @file{@var{dir}/usr/include} and @file{@var{dir}/usr/lib}.
9646
9647 If you use both this option and the @option{-isysroot} option, then
9648 the @option{--sysroot} option will apply to libraries, but the
9649 @option{-isysroot} option will apply to header files.
9650
9651 The GNU linker (beginning with version 2.16) has the necessary support
9652 for this option. If your linker does not support this option, the
9653 header file aspect of @option{--sysroot} will still work, but the
9654 library aspect will not.
9655
9656 @item -I-
9657 @opindex I-
9658 This option has been deprecated. Please use @option{-iquote} instead for
9659 @option{-I} directories before the @option{-I-} and remove the @option{-I-}.
9660 Any directories you specify with @option{-I} options before the @option{-I-}
9661 option are searched only for the case of @samp{#include "@var{file}"};
9662 they are not searched for @samp{#include <@var{file}>}.
9663
9664 If additional directories are specified with @option{-I} options after
9665 the @option{-I-}, these directories are searched for all @samp{#include}
9666 directives. (Ordinarily @emph{all} @option{-I} directories are used
9667 this way.)
9668
9669 In addition, the @option{-I-} option inhibits the use of the current
9670 directory (where the current input file came from) as the first search
9671 directory for @samp{#include "@var{file}"}. There is no way to
9672 override this effect of @option{-I-}. With @option{-I.} you can specify
9673 searching the directory which was current when the compiler was
9674 invoked. That is not exactly the same as what the preprocessor does
9675 by default, but it is often satisfactory.
9676
9677 @option{-I-} does not inhibit the use of the standard system directories
9678 for header files. Thus, @option{-I-} and @option{-nostdinc} are
9679 independent.
9680 @end table
9681
9682 @c man end
9683
9684 @node Spec Files
9685 @section Specifying subprocesses and the switches to pass to them
9686 @cindex Spec Files
9687
9688 @command{gcc} is a driver program. It performs its job by invoking a
9689 sequence of other programs to do the work of compiling, assembling and
9690 linking. GCC interprets its command-line parameters and uses these to
9691 deduce which programs it should invoke, and which command-line options
9692 it ought to place on their command lines. This behavior is controlled
9693 by @dfn{spec strings}. In most cases there is one spec string for each
9694 program that GCC can invoke, but a few programs have multiple spec
9695 strings to control their behavior. The spec strings built into GCC can
9696 be overridden by using the @option{-specs=} command-line switch to specify
9697 a spec file.
9698
9699 @dfn{Spec files} are plaintext files that are used to construct spec
9700 strings. They consist of a sequence of directives separated by blank
9701 lines. The type of directive is determined by the first non-whitespace
9702 character on the line and it can be one of the following:
9703
9704 @table @code
9705 @item %@var{command}
9706 Issues a @var{command} to the spec file processor. The commands that can
9707 appear here are:
9708
9709 @table @code
9710 @item %include <@var{file}>
9711 @cindex @code{%include}
9712 Search for @var{file} and insert its text at the current point in the
9713 specs file.
9714
9715 @item %include_noerr <@var{file}>
9716 @cindex @code{%include_noerr}
9717 Just like @samp{%include}, but do not generate an error message if the include
9718 file cannot be found.
9719
9720 @item %rename @var{old_name} @var{new_name}
9721 @cindex @code{%rename}
9722 Rename the spec string @var{old_name} to @var{new_name}.
9723
9724 @end table
9725
9726 @item *[@var{spec_name}]:
9727 This tells the compiler to create, override or delete the named spec
9728 string. All lines after this directive up to the next directive or
9729 blank line are considered to be the text for the spec string. If this
9730 results in an empty string then the spec will be deleted. (Or, if the
9731 spec did not exist, then nothing will happen.) Otherwise, if the spec
9732 does not currently exist a new spec will be created. If the spec does
9733 exist then its contents will be overridden by the text of this
9734 directive, unless the first character of that text is the @samp{+}
9735 character, in which case the text will be appended to the spec.
9736
9737 @item [@var{suffix}]:
9738 Creates a new @samp{[@var{suffix}] spec} pair. All lines after this directive
9739 and up to the next directive or blank line are considered to make up the
9740 spec string for the indicated suffix. When the compiler encounters an
9741 input file with the named suffix, it will processes the spec string in
9742 order to work out how to compile that file. For example:
9743
9744 @smallexample
9745 .ZZ:
9746 z-compile -input %i
9747 @end smallexample
9748
9749 This says that any input file whose name ends in @samp{.ZZ} should be
9750 passed to the program @samp{z-compile}, which should be invoked with the
9751 command-line switch @option{-input} and with the result of performing the
9752 @samp{%i} substitution. (See below.)
9753
9754 As an alternative to providing a spec string, the text that follows a
9755 suffix directive can be one of the following:
9756
9757 @table @code
9758 @item @@@var{language}
9759 This says that the suffix is an alias for a known @var{language}. This is
9760 similar to using the @option{-x} command-line switch to GCC to specify a
9761 language explicitly. For example:
9762
9763 @smallexample
9764 .ZZ:
9765 @@c++
9766 @end smallexample
9767
9768 Says that .ZZ files are, in fact, C++ source files.
9769
9770 @item #@var{name}
9771 This causes an error messages saying:
9772
9773 @smallexample
9774 @var{name} compiler not installed on this system.
9775 @end smallexample
9776 @end table
9777
9778 GCC already has an extensive list of suffixes built into it.
9779 This directive will add an entry to the end of the list of suffixes, but
9780 since the list is searched from the end backwards, it is effectively
9781 possible to override earlier entries using this technique.
9782
9783 @end table
9784
9785 GCC has the following spec strings built into it. Spec files can
9786 override these strings or create their own. Note that individual
9787 targets can also add their own spec strings to this list.
9788
9789 @smallexample
9790 asm Options to pass to the assembler
9791 asm_final Options to pass to the assembler post-processor
9792 cpp Options to pass to the C preprocessor
9793 cc1 Options to pass to the C compiler
9794 cc1plus Options to pass to the C++ compiler
9795 endfile Object files to include at the end of the link
9796 link Options to pass to the linker
9797 lib Libraries to include on the command line to the linker
9798 libgcc Decides which GCC support library to pass to the linker
9799 linker Sets the name of the linker
9800 predefines Defines to be passed to the C preprocessor
9801 signed_char Defines to pass to CPP to say whether @code{char} is signed
9802 by default
9803 startfile Object files to include at the start of the link
9804 @end smallexample
9805
9806 Here is a small example of a spec file:
9807
9808 @smallexample
9809 %rename lib old_lib
9810
9811 *lib:
9812 --start-group -lgcc -lc -leval1 --end-group %(old_lib)
9813 @end smallexample
9814
9815 This example renames the spec called @samp{lib} to @samp{old_lib} and
9816 then overrides the previous definition of @samp{lib} with a new one.
9817 The new definition adds in some extra command-line options before
9818 including the text of the old definition.
9819
9820 @dfn{Spec strings} are a list of command-line options to be passed to their
9821 corresponding program. In addition, the spec strings can contain
9822 @samp{%}-prefixed sequences to substitute variable text or to
9823 conditionally insert text into the command line. Using these constructs
9824 it is possible to generate quite complex command lines.
9825
9826 Here is a table of all defined @samp{%}-sequences for spec
9827 strings. Note that spaces are not generated automatically around the
9828 results of expanding these sequences. Therefore you can concatenate them
9829 together or combine them with constant text in a single argument.
9830
9831 @table @code
9832 @item %%
9833 Substitute one @samp{%} into the program name or argument.
9834
9835 @item %i
9836 Substitute the name of the input file being processed.
9837
9838 @item %b
9839 Substitute the basename of the input file being processed.
9840 This is the substring up to (and not including) the last period
9841 and not including the directory.
9842
9843 @item %B
9844 This is the same as @samp{%b}, but include the file suffix (text after
9845 the last period).
9846
9847 @item %d
9848 Marks the argument containing or following the @samp{%d} as a
9849 temporary file name, so that that file will be deleted if GCC exits
9850 successfully. Unlike @samp{%g}, this contributes no text to the
9851 argument.
9852
9853 @item %g@var{suffix}
9854 Substitute a file name that has suffix @var{suffix} and is chosen
9855 once per compilation, and mark the argument in the same way as
9856 @samp{%d}. To reduce exposure to denial-of-service attacks, the file
9857 name is now chosen in a way that is hard to predict even when previously
9858 chosen file names are known. For example, @samp{%g.s @dots{} %g.o @dots{} %g.s}
9859 might turn into @samp{ccUVUUAU.s ccXYAXZ12.o ccUVUUAU.s}. @var{suffix} matches
9860 the regexp @samp{[.A-Za-z]*} or the special string @samp{%O}, which is
9861 treated exactly as if @samp{%O} had been preprocessed. Previously, @samp{%g}
9862 was simply substituted with a file name chosen once per compilation,
9863 without regard to any appended suffix (which was therefore treated
9864 just like ordinary text), making such attacks more likely to succeed.
9865
9866 @item %u@var{suffix}
9867 Like @samp{%g}, but generates a new temporary file name even if
9868 @samp{%u@var{suffix}} was already seen.
9869
9870 @item %U@var{suffix}
9871 Substitutes the last file name generated with @samp{%u@var{suffix}}, generating a
9872 new one if there is no such last file name. In the absence of any
9873 @samp{%u@var{suffix}}, this is just like @samp{%g@var{suffix}}, except they don't share
9874 the same suffix @emph{space}, so @samp{%g.s @dots{} %U.s @dots{} %g.s @dots{} %U.s}
9875 would involve the generation of two distinct file names, one
9876 for each @samp{%g.s} and another for each @samp{%U.s}. Previously, @samp{%U} was
9877 simply substituted with a file name chosen for the previous @samp{%u},
9878 without regard to any appended suffix.
9879
9880 @item %j@var{suffix}
9881 Substitutes the name of the @code{HOST_BIT_BUCKET}, if any, and if it is
9882 writable, and if save-temps is off; otherwise, substitute the name
9883 of a temporary file, just like @samp{%u}. This temporary file is not
9884 meant for communication between processes, but rather as a junk
9885 disposal mechanism.
9886
9887 @item %|@var{suffix}
9888 @itemx %m@var{suffix}
9889 Like @samp{%g}, except if @option{-pipe} is in effect. In that case
9890 @samp{%|} substitutes a single dash and @samp{%m} substitutes nothing at
9891 all. These are the two most common ways to instruct a program that it
9892 should read from standard input or write to standard output. If you
9893 need something more elaborate you can use an @samp{%@{pipe:@code{X}@}}
9894 construct: see for example @file{f/lang-specs.h}.
9895
9896 @item %.@var{SUFFIX}
9897 Substitutes @var{.SUFFIX} for the suffixes of a matched switch's args
9898 when it is subsequently output with @samp{%*}. @var{SUFFIX} is
9899 terminated by the next space or %.
9900
9901 @item %w
9902 Marks the argument containing or following the @samp{%w} as the
9903 designated output file of this compilation. This puts the argument
9904 into the sequence of arguments that @samp{%o} will substitute later.
9905
9906 @item %o
9907 Substitutes the names of all the output files, with spaces
9908 automatically placed around them. You should write spaces
9909 around the @samp{%o} as well or the results are undefined.
9910 @samp{%o} is for use in the specs for running the linker.
9911 Input files whose names have no recognized suffix are not compiled
9912 at all, but they are included among the output files, so they will
9913 be linked.
9914
9915 @item %O
9916 Substitutes the suffix for object files. Note that this is
9917 handled specially when it immediately follows @samp{%g, %u, or %U},
9918 because of the need for those to form complete file names. The
9919 handling is such that @samp{%O} is treated exactly as if it had already
9920 been substituted, except that @samp{%g, %u, and %U} do not currently
9921 support additional @var{suffix} characters following @samp{%O} as they would
9922 following, for example, @samp{.o}.
9923
9924 @item %p
9925 Substitutes the standard macro predefinitions for the
9926 current target machine. Use this when running @code{cpp}.
9927
9928 @item %P
9929 Like @samp{%p}, but puts @samp{__} before and after the name of each
9930 predefined macro, except for macros that start with @samp{__} or with
9931 @samp{_@var{L}}, where @var{L} is an uppercase letter. This is for ISO
9932 C@.
9933
9934 @item %I
9935 Substitute any of @option{-iprefix} (made from @env{GCC_EXEC_PREFIX}),
9936 @option{-isysroot} (made from @env{TARGET_SYSTEM_ROOT}),
9937 @option{-isystem} (made from @env{COMPILER_PATH} and @option{-B} options)
9938 and @option{-imultilib} as necessary.
9939
9940 @item %s
9941 Current argument is the name of a library or startup file of some sort.
9942 Search for that file in a standard list of directories and substitute
9943 the full name found. The current working directory is included in the
9944 list of directories scanned.
9945
9946 @item %T
9947 Current argument is the name of a linker script. Search for that file
9948 in the current list of directories to scan for libraries. If the file
9949 is located insert a @option{--script} option into the command line
9950 followed by the full path name found. If the file is not found then
9951 generate an error message. Note: the current working directory is not
9952 searched.
9953
9954 @item %e@var{str}
9955 Print @var{str} as an error message. @var{str} is terminated by a newline.
9956 Use this when inconsistent options are detected.
9957
9958 @item %(@var{name})
9959 Substitute the contents of spec string @var{name} at this point.
9960
9961 @item %x@{@var{option}@}
9962 Accumulate an option for @samp{%X}.
9963
9964 @item %X
9965 Output the accumulated linker options specified by @option{-Wl} or a @samp{%x}
9966 spec string.
9967
9968 @item %Y
9969 Output the accumulated assembler options specified by @option{-Wa}.
9970
9971 @item %Z
9972 Output the accumulated preprocessor options specified by @option{-Wp}.
9973
9974 @item %a
9975 Process the @code{asm} spec. This is used to compute the
9976 switches to be passed to the assembler.
9977
9978 @item %A
9979 Process the @code{asm_final} spec. This is a spec string for
9980 passing switches to an assembler post-processor, if such a program is
9981 needed.
9982
9983 @item %l
9984 Process the @code{link} spec. This is the spec for computing the
9985 command line passed to the linker. Typically it will make use of the
9986 @samp{%L %G %S %D and %E} sequences.
9987
9988 @item %D
9989 Dump out a @option{-L} option for each directory that GCC believes might
9990 contain startup files. If the target supports multilibs then the
9991 current multilib directory will be prepended to each of these paths.
9992
9993 @item %L
9994 Process the @code{lib} spec. This is a spec string for deciding which
9995 libraries should be included on the command line to the linker.
9996
9997 @item %G
9998 Process the @code{libgcc} spec. This is a spec string for deciding
9999 which GCC support library should be included on the command line to the linker.
10000
10001 @item %S
10002 Process the @code{startfile} spec. This is a spec for deciding which
10003 object files should be the first ones passed to the linker. Typically
10004 this might be a file named @file{crt0.o}.
10005
10006 @item %E
10007 Process the @code{endfile} spec. This is a spec string that specifies
10008 the last object files that will be passed to the linker.
10009
10010 @item %C
10011 Process the @code{cpp} spec. This is used to construct the arguments
10012 to be passed to the C preprocessor.
10013
10014 @item %1
10015 Process the @code{cc1} spec. This is used to construct the options to be
10016 passed to the actual C compiler (@samp{cc1}).
10017
10018 @item %2
10019 Process the @code{cc1plus} spec. This is used to construct the options to be
10020 passed to the actual C++ compiler (@samp{cc1plus}).
10021
10022 @item %*
10023 Substitute the variable part of a matched option. See below.
10024 Note that each comma in the substituted string is replaced by
10025 a single space.
10026
10027 @item %<@code{S}
10028 Remove all occurrences of @code{-S} from the command line. Note---this
10029 command is position dependent. @samp{%} commands in the spec string
10030 before this one will see @code{-S}, @samp{%} commands in the spec string
10031 after this one will not.
10032
10033 @item %:@var{function}(@var{args})
10034 Call the named function @var{function}, passing it @var{args}.
10035 @var{args} is first processed as a nested spec string, then split
10036 into an argument vector in the usual fashion. The function returns
10037 a string which is processed as if it had appeared literally as part
10038 of the current spec.
10039
10040 The following built-in spec functions are provided:
10041
10042 @table @code
10043 @item @code{getenv}
10044 The @code{getenv} spec function takes two arguments: an environment
10045 variable name and a string. If the environment variable is not
10046 defined, a fatal error is issued. Otherwise, the return value is the
10047 value of the environment variable concatenated with the string. For
10048 example, if @env{TOPDIR} is defined as @file{/path/to/top}, then:
10049
10050 @smallexample
10051 %:getenv(TOPDIR /include)
10052 @end smallexample
10053
10054 expands to @file{/path/to/top/include}.
10055
10056 @item @code{if-exists}
10057 The @code{if-exists} spec function takes one argument, an absolute
10058 pathname to a file. If the file exists, @code{if-exists} returns the
10059 pathname. Here is a small example of its usage:
10060
10061 @smallexample
10062 *startfile:
10063 crt0%O%s %:if-exists(crti%O%s) crtbegin%O%s
10064 @end smallexample
10065
10066 @item @code{if-exists-else}
10067 The @code{if-exists-else} spec function is similar to the @code{if-exists}
10068 spec function, except that it takes two arguments. The first argument is
10069 an absolute pathname to a file. If the file exists, @code{if-exists-else}
10070 returns the pathname. If it does not exist, it returns the second argument.
10071 This way, @code{if-exists-else} can be used to select one file or another,
10072 based on the existence of the first. Here is a small example of its usage:
10073
10074 @smallexample
10075 *startfile:
10076 crt0%O%s %:if-exists(crti%O%s) \
10077 %:if-exists-else(crtbeginT%O%s crtbegin%O%s)
10078 @end smallexample
10079
10080 @item @code{replace-outfile}
10081 The @code{replace-outfile} spec function takes two arguments. It looks for the
10082 first argument in the outfiles array and replaces it with the second argument. Here
10083 is a small example of its usage:
10084
10085 @smallexample
10086 %@{fgnu-runtime:%:replace-outfile(-lobjc -lobjc-gnu)@}
10087 @end smallexample
10088
10089 @item @code{remove-outfile}
10090 The @code{remove-outfile} spec function takes one argument. It looks for the
10091 first argument in the outfiles array and removes it. Here is a small example
10092 its usage:
10093
10094 @smallexample
10095 %:remove-outfile(-lm)
10096 @end smallexample
10097
10098 @item @code{pass-through-libs}
10099 The @code{pass-through-libs} spec function takes any number of arguments. It
10100 finds any @option{-l} options and any non-options ending in ".a" (which it
10101 assumes are the names of linker input library archive files) and returns a
10102 result containing all the found arguments each prepended by
10103 @option{-plugin-opt=-pass-through=} and joined by spaces. This list is
10104 intended to be passed to the LTO linker plugin.
10105
10106 @smallexample
10107 %:pass-through-libs(%G %L %G)
10108 @end smallexample
10109
10110 @item @code{print-asm-header}
10111 The @code{print-asm-header} function takes no arguments and simply
10112 prints a banner like:
10113
10114 @smallexample
10115 Assembler options
10116 =================
10117
10118 Use "-Wa,OPTION" to pass "OPTION" to the assembler.
10119 @end smallexample
10120
10121 It is used to separate compiler options from assembler options
10122 in the @option{--target-help} output.
10123 @end table
10124
10125 @item %@{@code{S}@}
10126 Substitutes the @code{-S} switch, if that switch was given to GCC@.
10127 If that switch was not specified, this substitutes nothing. Note that
10128 the leading dash is omitted when specifying this option, and it is
10129 automatically inserted if the substitution is performed. Thus the spec
10130 string @samp{%@{foo@}} would match the command-line option @option{-foo}
10131 and would output the command line option @option{-foo}.
10132
10133 @item %W@{@code{S}@}
10134 Like %@{@code{S}@} but mark last argument supplied within as a file to be
10135 deleted on failure.
10136
10137 @item %@{@code{S}*@}
10138 Substitutes all the switches specified to GCC whose names start
10139 with @code{-S}, but which also take an argument. This is used for
10140 switches like @option{-o}, @option{-D}, @option{-I}, etc.
10141 GCC considers @option{-o foo} as being
10142 one switch whose names starts with @samp{o}. %@{o*@} would substitute this
10143 text, including the space. Thus two arguments would be generated.
10144
10145 @item %@{@code{S}*&@code{T}*@}
10146 Like %@{@code{S}*@}, but preserve order of @code{S} and @code{T} options
10147 (the order of @code{S} and @code{T} in the spec is not significant).
10148 There can be any number of ampersand-separated variables; for each the
10149 wild card is optional. Useful for CPP as @samp{%@{D*&U*&A*@}}.
10150
10151 @item %@{@code{S}:@code{X}@}
10152 Substitutes @code{X}, if the @samp{-S} switch was given to GCC@.
10153
10154 @item %@{!@code{S}:@code{X}@}
10155 Substitutes @code{X}, if the @samp{-S} switch was @emph{not} given to GCC@.
10156
10157 @item %@{@code{S}*:@code{X}@}
10158 Substitutes @code{X} if one or more switches whose names start with
10159 @code{-S} are specified to GCC@. Normally @code{X} is substituted only
10160 once, no matter how many such switches appeared. However, if @code{%*}
10161 appears somewhere in @code{X}, then @code{X} will be substituted once
10162 for each matching switch, with the @code{%*} replaced by the part of
10163 that switch that matched the @code{*}.
10164
10165 @item %@{.@code{S}:@code{X}@}
10166 Substitutes @code{X}, if processing a file with suffix @code{S}.
10167
10168 @item %@{!.@code{S}:@code{X}@}
10169 Substitutes @code{X}, if @emph{not} processing a file with suffix @code{S}.
10170
10171 @item %@{,@code{S}:@code{X}@}
10172 Substitutes @code{X}, if processing a file for language @code{S}.
10173
10174 @item %@{!,@code{S}:@code{X}@}
10175 Substitutes @code{X}, if not processing a file for language @code{S}.
10176
10177 @item %@{@code{S}|@code{P}:@code{X}@}
10178 Substitutes @code{X} if either @code{-S} or @code{-P} was given to
10179 GCC@. This may be combined with @samp{!}, @samp{.}, @samp{,}, and
10180 @code{*} sequences as well, although they have a stronger binding than
10181 the @samp{|}. If @code{%*} appears in @code{X}, all of the
10182 alternatives must be starred, and only the first matching alternative
10183 is substituted.
10184
10185 For example, a spec string like this:
10186
10187 @smallexample
10188 %@{.c:-foo@} %@{!.c:-bar@} %@{.c|d:-baz@} %@{!.c|d:-boggle@}
10189 @end smallexample
10190
10191 will output the following command-line options from the following input
10192 command-line options:
10193
10194 @smallexample
10195 fred.c -foo -baz
10196 jim.d -bar -boggle
10197 -d fred.c -foo -baz -boggle
10198 -d jim.d -bar -baz -boggle
10199 @end smallexample
10200
10201 @item %@{S:X; T:Y; :D@}
10202
10203 If @code{S} was given to GCC, substitutes @code{X}; else if @code{T} was
10204 given to GCC, substitutes @code{Y}; else substitutes @code{D}. There can
10205 be as many clauses as you need. This may be combined with @code{.},
10206 @code{,}, @code{!}, @code{|}, and @code{*} as needed.
10207
10208
10209 @end table
10210
10211 The conditional text @code{X} in a %@{@code{S}:@code{X}@} or similar
10212 construct may contain other nested @samp{%} constructs or spaces, or
10213 even newlines. They are processed as usual, as described above.
10214 Trailing white space in @code{X} is ignored. White space may also
10215 appear anywhere on the left side of the colon in these constructs,
10216 except between @code{.} or @code{*} and the corresponding word.
10217
10218 The @option{-O}, @option{-f}, @option{-m}, and @option{-W} switches are
10219 handled specifically in these constructs. If another value of
10220 @option{-O} or the negated form of a @option{-f}, @option{-m}, or
10221 @option{-W} switch is found later in the command line, the earlier
10222 switch value is ignored, except with @{@code{S}*@} where @code{S} is
10223 just one letter, which passes all matching options.
10224
10225 The character @samp{|} at the beginning of the predicate text is used to
10226 indicate that a command should be piped to the following command, but
10227 only if @option{-pipe} is specified.
10228
10229 It is built into GCC which switches take arguments and which do not.
10230 (You might think it would be useful to generalize this to allow each
10231 compiler's spec to say which switches take arguments. But this cannot
10232 be done in a consistent fashion. GCC cannot even decide which input
10233 files have been specified without knowing which switches take arguments,
10234 and it must know which input files to compile in order to tell which
10235 compilers to run).
10236
10237 GCC also knows implicitly that arguments starting in @option{-l} are to be
10238 treated as compiler output files, and passed to the linker in their
10239 proper position among the other output files.
10240
10241 @c man begin OPTIONS
10242
10243 @node Target Options
10244 @section Specifying Target Machine and Compiler Version
10245 @cindex target options
10246 @cindex cross compiling
10247 @cindex specifying machine version
10248 @cindex specifying compiler version and target machine
10249 @cindex compiler version, specifying
10250 @cindex target machine, specifying
10251
10252 The usual way to run GCC is to run the executable called @command{gcc}, or
10253 @command{@var{machine}-gcc} when cross-compiling, or
10254 @command{@var{machine}-gcc-@var{version}} to run a version other than the
10255 one that was installed last.
10256
10257 @node Submodel Options
10258 @section Hardware Models and Configurations
10259 @cindex submodel options
10260 @cindex specifying hardware config
10261 @cindex hardware models and configurations, specifying
10262 @cindex machine dependent options
10263
10264 Each target machine types can have its own
10265 special options, starting with @samp{-m}, to choose among various
10266 hardware models or configurations---for example, 68010 vs 68020,
10267 floating coprocessor or none. A single installed version of the
10268 compiler can compile for any model or configuration, according to the
10269 options specified.
10270
10271 Some configurations of the compiler also support additional special
10272 options, usually for compatibility with other compilers on the same
10273 platform.
10274
10275 @c This list is ordered alphanumerically by subsection name.
10276 @c It should be the same order and spelling as these options are listed
10277 @c in Machine Dependent Options
10278
10279 @menu
10280 * Adapteva Epiphany Options::
10281 * ARM Options::
10282 * AVR Options::
10283 * Blackfin Options::
10284 * C6X Options::
10285 * CRIS Options::
10286 * Darwin Options::
10287 * DEC Alpha Options::
10288 * DEC Alpha/VMS Options::
10289 * FR30 Options::
10290 * FRV Options::
10291 * GNU/Linux Options::
10292 * H8/300 Options::
10293 * HPPA Options::
10294 * i386 and x86-64 Options::
10295 * i386 and x86-64 Windows Options::
10296 * IA-64 Options::
10297 * IA-64/VMS Options::
10298 * LM32 Options::
10299 * M32C Options::
10300 * M32R/D Options::
10301 * M680x0 Options::
10302 * MCore Options::
10303 * MeP Options::
10304 * MicroBlaze Options::
10305 * MIPS Options::
10306 * MMIX Options::
10307 * MN10300 Options::
10308 * PDP-11 Options::
10309 * picoChip Options::
10310 * PowerPC Options::
10311 * RL78 Options::
10312 * RS/6000 and PowerPC Options::
10313 * RX Options::
10314 * S/390 and zSeries Options::
10315 * Score Options::
10316 * SH Options::
10317 * Solaris 2 Options::
10318 * SPARC Options::
10319 * SPU Options::
10320 * System V Options::
10321 * V850 Options::
10322 * VAX Options::
10323 * VxWorks Options::
10324 * x86-64 Options::
10325 * Xstormy16 Options::
10326 * Xtensa Options::
10327 * zSeries Options::
10328 @end menu
10329
10330 @node Adapteva Epiphany Options
10331 @subsection Adapteva Epiphany Options
10332
10333 These @samp{-m} options are defined for Adapteva Epiphany:
10334
10335 @table @gcctabopt
10336 @item -mhalf-reg-file
10337 @opindex mhalf-reg-file
10338 Don't allocate any register in the range @code{r32}@dots{}@code{r63}.
10339 That allows code to run on hardware variants that lack these registers.
10340
10341 @item -mprefer-short-insn-regs
10342 @opindex mprefer-short-insn-regs
10343 Preferrentially allocate registers that allow short instruction generation.
10344 This can result in increasesd instruction count, so if this reduces or
10345 increases code size might vary from case to case.
10346
10347 @item -mbranch-cost=@var{num}
10348 @opindex mbranch-cost
10349 Set the cost of branches to roughly @var{num} ``simple'' instructions.
10350 This cost is only a heuristic and is not guaranteed to produce
10351 consistent results across releases.
10352
10353 @item -mcmove
10354 @opindex mcmove
10355 Enable the generation of conditional moves.
10356
10357 @item -mnops=@var{num}
10358 @opindex mnops
10359 Emit @var{num} nops before every other generated instruction.
10360
10361 @item -mno-soft-cmpsf
10362 @opindex mno-soft-cmpsf
10363 For single-precision floating point comparisons, emit an fsub instruction
10364 and test the flags. This is faster than a software comparison, but can
10365 get incorrect results in the presence of NaNs, or when two different small
10366 numbers are compared such that their difference is calculated as zero.
10367 The default is @option{-msoft-cmpsf}, which uses slower, but IEEE-compliant,
10368 software comparisons.
10369
10370 @item -mstack-offset=@var{num}
10371 @opindex mstack-offset
10372 Set the offset between the top of the stack and the stack pointer.
10373 E.g., a value of 8 means that the eight bytes in the range sp+0@dots{}sp+7
10374 can be used by leaf functions without stack allocation.
10375 Values other than @samp{8} or @samp{16} are untested and unlikely to work.
10376 Note also that this option changes the ABI, compiling a program with a
10377 different stack offset than the libraries have been compiled with
10378 will generally not work.
10379 This option can be useful if you want to evaluate if a different stack
10380 offset would give you better code, but to actually use a different stack
10381 offset to build working programs, it is recommended to configure the
10382 toolchain with the appropriate @samp{--with-stack-offset=@var{num}} option.
10383
10384 @item -mno-round-nearest
10385 @opindex mno-round-nearest
10386 Make the scheduler assume that the rounding mode has been set to
10387 truncating. The default is @option{-mround-nearest}.
10388
10389 @item -mlong-calls
10390 @opindex mlong-calls
10391 If not otherwise specified by an attribute, assume all calls might be beyond
10392 the offset range of the b / bl instructions, and therefore load the
10393 function address into a register before performing a (otherwise direct) call.
10394 This is the default.
10395
10396 @item -mshort-calls
10397 @opindex short-calls
10398 If not otherwise specified by an attribute, assume all direct calls are
10399 in the range of the b / bl instructions, so use these instructions
10400 for direct calls. The default is @option{-mlong-calls}.
10401
10402 @item -msmall16
10403 @opindex msmall16
10404 Assume addresses can be loaded as 16 bit unsigned values. This does not
10405 apply to function addresses for which @option{-mlong-calls} semantics
10406 are in effect.
10407
10408 @item -mfp-mode=@var{mode}
10409 @opindex mfp-mode
10410 Set the prevailing mode of the floating point unit.
10411 This determines the floating point mode that is provided and expected
10412 at function call and return time. Making this mode match the mode you
10413 predominantly need at function start can make your programs smaller and
10414 faster by avoiding unnecessary mode switches.
10415
10416 @var{mode} can be set to one the following values:
10417
10418 @table @samp
10419 @item caller
10420 Any mode at function entry is valid, and retained or restored when
10421 the function returns, and when it calls other functions.
10422 This mode is useful for compiling libraries or other compilation units
10423 you might want to incorporate into different programs with different
10424 prevailing FPU modes, and the convenience of being able to use a single
10425 object file outweighs the size and speed overhead for any extra
10426 mode switching that might be needed, compared with what would be needed
10427 with a more specific choice of prevailing FPU mode.
10428
10429 @item truncate
10430 This is the mode used for floating point calculations with
10431 truncating (i.e.@: round towards zero) rounding mode. That includes
10432 conversion from floating point to integer.
10433
10434 @item round-nearest
10435 This is the mode used for floating point calculations with
10436 round-to-nearest-or-even rounding mode.
10437
10438 @item int
10439 This is the mode used to perform integer calculations in the FPU, e.g.@:
10440 integer multiply, or integer multiply-and-accumulate.
10441 @end table
10442
10443 The default is @option{-mfp-mode=caller}
10444
10445 @item -mnosplit-lohi
10446 @opindex mnosplit-lohi
10447 @item -mno-postinc
10448 @opindex mno-postinc
10449 @item -mno-postmodify
10450 @opindex mno-postmodify
10451 Code generation tweaks that disable, respectively, splitting of 32
10452 bit loads, generation of post-increment addresses, and generation of
10453 post-modify addresses. The defaults are @option{msplit-lohi},
10454 @option{-mpost-inc}, and @option{-mpost-modify}.
10455
10456 @item -mnovect-double
10457 @opindex mno-vect-double
10458 Change the preferred SIMD mode to SImode. The default is
10459 @option{-mvect-double}, which uses DImode as preferred SIMD mode.
10460
10461 @item -max-vect-align=@var{num}
10462 @opindex max-vect-align
10463 The maximum alignment for SIMD vector mode types.
10464 @var{num} may be 4 or 8. The default is 8.
10465 Note that this is an ABI change, even though many library function
10466 interfaces will be unaffected, if they don't use SIMD vector modes
10467 in places where they affect size and/or alignment of relevant types.
10468
10469 @item -msplit-vecmove-early
10470 @opindex msplit-vecmove-early
10471 Split vector moves into single word moves before reload. In theory this
10472 could give better register allocation, but so far the reverse seems to be
10473 generally the case.
10474
10475 @item -m1reg-@var{reg}
10476 @opindex m1reg-
10477 Specify a register to hold the constant @minus{}1, which makes loading small negative
10478 constants and certain bitmasks faster.
10479 Allowable values for reg are r43 and r63, which specify to use that register
10480 as a fixed register, and none, which means that no register is used for this
10481 purpose. The default is @option{-m1reg-none}.
10482
10483 @end table
10484
10485 @node ARM Options
10486 @subsection ARM Options
10487 @cindex ARM options
10488
10489 These @samp{-m} options are defined for Advanced RISC Machines (ARM)
10490 architectures:
10491
10492 @table @gcctabopt
10493 @item -mabi=@var{name}
10494 @opindex mabi
10495 Generate code for the specified ABI@. Permissible values are: @samp{apcs-gnu},
10496 @samp{atpcs}, @samp{aapcs}, @samp{aapcs-linux} and @samp{iwmmxt}.
10497
10498 @item -mapcs-frame
10499 @opindex mapcs-frame
10500 Generate a stack frame that is compliant with the ARM Procedure Call
10501 Standard for all functions, even if this is not strictly necessary for
10502 correct execution of the code. Specifying @option{-fomit-frame-pointer}
10503 with this option will cause the stack frames not to be generated for
10504 leaf functions. The default is @option{-mno-apcs-frame}.
10505
10506 @item -mapcs
10507 @opindex mapcs
10508 This is a synonym for @option{-mapcs-frame}.
10509
10510 @ignore
10511 @c not currently implemented
10512 @item -mapcs-stack-check
10513 @opindex mapcs-stack-check
10514 Generate code to check the amount of stack space available upon entry to
10515 every function (that actually uses some stack space). If there is
10516 insufficient space available then either the function
10517 @samp{__rt_stkovf_split_small} or @samp{__rt_stkovf_split_big} will be
10518 called, depending upon the amount of stack space required. The run time
10519 system is required to provide these functions. The default is
10520 @option{-mno-apcs-stack-check}, since this produces smaller code.
10521
10522 @c not currently implemented
10523 @item -mapcs-float
10524 @opindex mapcs-float
10525 Pass floating point arguments using the float point registers. This is
10526 one of the variants of the APCS@. This option is recommended if the
10527 target hardware has a floating point unit or if a lot of floating point
10528 arithmetic is going to be performed by the code. The default is
10529 @option{-mno-apcs-float}, since integer only code is slightly increased in
10530 size if @option{-mapcs-float} is used.
10531
10532 @c not currently implemented
10533 @item -mapcs-reentrant
10534 @opindex mapcs-reentrant
10535 Generate reentrant, position independent code. The default is
10536 @option{-mno-apcs-reentrant}.
10537 @end ignore
10538
10539 @item -mthumb-interwork
10540 @opindex mthumb-interwork
10541 Generate code which supports calling between the ARM and Thumb
10542 instruction sets. Without this option, on pre-v5 architectures, the
10543 two instruction sets cannot be reliably used inside one program. The
10544 default is @option{-mno-thumb-interwork}, since slightly larger code
10545 is generated when @option{-mthumb-interwork} is specified. In AAPCS
10546 configurations this option is meaningless.
10547
10548 @item -mno-sched-prolog
10549 @opindex mno-sched-prolog
10550 Prevent the reordering of instructions in the function prolog, or the
10551 merging of those instruction with the instructions in the function's
10552 body. This means that all functions will start with a recognizable set
10553 of instructions (or in fact one of a choice from a small set of
10554 different function prologues), and this information can be used to
10555 locate the start if functions inside an executable piece of code. The
10556 default is @option{-msched-prolog}.
10557
10558 @item -mfloat-abi=@var{name}
10559 @opindex mfloat-abi
10560 Specifies which floating-point ABI to use. Permissible values
10561 are: @samp{soft}, @samp{softfp} and @samp{hard}.
10562
10563 Specifying @samp{soft} causes GCC to generate output containing
10564 library calls for floating-point operations.
10565 @samp{softfp} allows the generation of code using hardware floating-point
10566 instructions, but still uses the soft-float calling conventions.
10567 @samp{hard} allows generation of floating-point instructions
10568 and uses FPU-specific calling conventions.
10569
10570 The default depends on the specific target configuration. Note that
10571 the hard-float and soft-float ABIs are not link-compatible; you must
10572 compile your entire program with the same ABI, and link with a
10573 compatible set of libraries.
10574
10575 @item -mlittle-endian
10576 @opindex mlittle-endian
10577 Generate code for a processor running in little-endian mode. This is
10578 the default for all standard configurations.
10579
10580 @item -mbig-endian
10581 @opindex mbig-endian
10582 Generate code for a processor running in big-endian mode; the default is
10583 to compile code for a little-endian processor.
10584
10585 @item -mwords-little-endian
10586 @opindex mwords-little-endian
10587 This option only applies when generating code for big-endian processors.
10588 Generate code for a little-endian word order but a big-endian byte
10589 order. That is, a byte order of the form @samp{32107654}. Note: this
10590 option should only be used if you require compatibility with code for
10591 big-endian ARM processors generated by versions of the compiler prior to
10592 2.8. This option is now deprecated.
10593
10594 @item -mcpu=@var{name}
10595 @opindex mcpu
10596 This specifies the name of the target ARM processor. GCC uses this name
10597 to determine what kind of instructions it can emit when generating
10598 assembly code. Permissible names are: @samp{arm2}, @samp{arm250},
10599 @samp{arm3}, @samp{arm6}, @samp{arm60}, @samp{arm600}, @samp{arm610},
10600 @samp{arm620}, @samp{arm7}, @samp{arm7m}, @samp{arm7d}, @samp{arm7dm},
10601 @samp{arm7di}, @samp{arm7dmi}, @samp{arm70}, @samp{arm700},
10602 @samp{arm700i}, @samp{arm710}, @samp{arm710c}, @samp{arm7100},
10603 @samp{arm720},
10604 @samp{arm7500}, @samp{arm7500fe}, @samp{arm7tdmi}, @samp{arm7tdmi-s},
10605 @samp{arm710t}, @samp{arm720t}, @samp{arm740t},
10606 @samp{strongarm}, @samp{strongarm110}, @samp{strongarm1100},
10607 @samp{strongarm1110},
10608 @samp{arm8}, @samp{arm810}, @samp{arm9}, @samp{arm9e}, @samp{arm920},
10609 @samp{arm920t}, @samp{arm922t}, @samp{arm946e-s}, @samp{arm966e-s},
10610 @samp{arm968e-s}, @samp{arm926ej-s}, @samp{arm940t}, @samp{arm9tdmi},
10611 @samp{arm10tdmi}, @samp{arm1020t}, @samp{arm1026ej-s},
10612 @samp{arm10e}, @samp{arm1020e}, @samp{arm1022e},
10613 @samp{arm1136j-s}, @samp{arm1136jf-s}, @samp{mpcore}, @samp{mpcorenovfp},
10614 @samp{arm1156t2-s}, @samp{arm1156t2f-s}, @samp{arm1176jz-s}, @samp{arm1176jzf-s},
10615 @samp{cortex-a5}, @samp{cortex-a7}, @samp{cortex-a8}, @samp{cortex-a9},
10616 @samp{cortex-a15}, @samp{cortex-r4}, @samp{cortex-r4f}, @samp{cortex-r5},
10617 @samp{cortex-m4}, @samp{cortex-m3},
10618 @samp{cortex-m1},
10619 @samp{cortex-m0},
10620 @samp{xscale}, @samp{iwmmxt}, @samp{iwmmxt2}, @samp{ep9312},
10621 @samp{fa526}, @samp{fa626},
10622 @samp{fa606te}, @samp{fa626te}, @samp{fmp626}, @samp{fa726te}.
10623
10624
10625 @option{-mcpu=generic-@var{arch}} is also permissible, and is
10626 equivalent to @option{-march=@var{arch} -mtune=generic-@var{arch}}.
10627 See @option{-mtune} for more information.
10628
10629 @option{-mcpu=native} causes the compiler to auto-detect the CPU
10630 of the build computer. At present, this feature is only supported on
10631 Linux, and not all architectures are recognised. If the auto-detect is
10632 unsuccessful the option has no effect.
10633
10634 @item -mtune=@var{name}
10635 @opindex mtune
10636 This option is very similar to the @option{-mcpu=} option, except that
10637 instead of specifying the actual target processor type, and hence
10638 restricting which instructions can be used, it specifies that GCC should
10639 tune the performance of the code as if the target were of the type
10640 specified in this option, but still choosing the instructions that it
10641 will generate based on the CPU specified by a @option{-mcpu=} option.
10642 For some ARM implementations better performance can be obtained by using
10643 this option.
10644
10645 @option{-mtune=generic-@var{arch}} specifies that GCC should tune the
10646 performance for a blend of processors within architecture @var{arch}.
10647 The aim is to generate code that run well on the current most popular
10648 processors, balancing between optimizations that benefit some CPUs in the
10649 range, and avoiding performance pitfalls of other CPUs. The effects of
10650 this option may change in future GCC versions as CPU models come and go.
10651
10652 @option{-mtune=native} causes the compiler to auto-detect the CPU
10653 of the build computer. At present, this feature is only supported on
10654 Linux, and not all architectures are recognised. If the auto-detect is
10655 unsuccessful the option has no effect.
10656
10657 @item -march=@var{name}
10658 @opindex march
10659 This specifies the name of the target ARM architecture. GCC uses this
10660 name to determine what kind of instructions it can emit when generating
10661 assembly code. This option can be used in conjunction with or instead
10662 of the @option{-mcpu=} option. Permissible names are: @samp{armv2},
10663 @samp{armv2a}, @samp{armv3}, @samp{armv3m}, @samp{armv4}, @samp{armv4t},
10664 @samp{armv5}, @samp{armv5t}, @samp{armv5e}, @samp{armv5te},
10665 @samp{armv6}, @samp{armv6j},
10666 @samp{armv6t2}, @samp{armv6z}, @samp{armv6zk}, @samp{armv6-m},
10667 @samp{armv7}, @samp{armv7-a}, @samp{armv7-r}, @samp{armv7-m},
10668 @samp{iwmmxt}, @samp{iwmmxt2}, @samp{ep9312}.
10669
10670 @option{-march=native} causes the compiler to auto-detect the architecture
10671 of the build computer. At present, this feature is only supported on
10672 Linux, and not all architectures are recognised. If the auto-detect is
10673 unsuccessful the option has no effect.
10674
10675 @item -mfpu=@var{name}
10676 @itemx -mfpe=@var{number}
10677 @itemx -mfp=@var{number}
10678 @opindex mfpu
10679 @opindex mfpe
10680 @opindex mfp
10681 This specifies what floating point hardware (or hardware emulation) is
10682 available on the target. Permissible names are: @samp{fpa}, @samp{fpe2},
10683 @samp{fpe3}, @samp{maverick}, @samp{vfp}, @samp{vfpv3}, @samp{vfpv3-fp16},
10684 @samp{vfpv3-d16}, @samp{vfpv3-d16-fp16}, @samp{vfpv3xd}, @samp{vfpv3xd-fp16},
10685 @samp{neon}, @samp{neon-fp16}, @samp{vfpv4}, @samp{vfpv4-d16},
10686 @samp{fpv4-sp-d16} and @samp{neon-vfpv4}.
10687 @option{-mfp} and @option{-mfpe} are synonyms for
10688 @option{-mfpu}=@samp{fpe}@var{number}, for compatibility with older versions
10689 of GCC@.
10690
10691 If @option{-msoft-float} is specified this specifies the format of
10692 floating point values.
10693
10694 If the selected floating-point hardware includes the NEON extension
10695 (e.g. @option{-mfpu}=@samp{neon}), note that floating-point
10696 operations will not be used by GCC's auto-vectorization pass unless
10697 @option{-funsafe-math-optimizations} is also specified. This is
10698 because NEON hardware does not fully implement the IEEE 754 standard for
10699 floating-point arithmetic (in particular denormal values are treated as
10700 zero), so the use of NEON instructions may lead to a loss of precision.
10701
10702 @item -mfp16-format=@var{name}
10703 @opindex mfp16-format
10704 Specify the format of the @code{__fp16} half-precision floating-point type.
10705 Permissible names are @samp{none}, @samp{ieee}, and @samp{alternative};
10706 the default is @samp{none}, in which case the @code{__fp16} type is not
10707 defined. @xref{Half-Precision}, for more information.
10708
10709 @item -mstructure-size-boundary=@var{n}
10710 @opindex mstructure-size-boundary
10711 The size of all structures and unions will be rounded up to a multiple
10712 of the number of bits set by this option. Permissible values are 8, 32
10713 and 64. The default value varies for different toolchains. For the COFF
10714 targeted toolchain the default value is 8. A value of 64 is only allowed
10715 if the underlying ABI supports it.
10716
10717 Specifying the larger number can produce faster, more efficient code, but
10718 can also increase the size of the program. Different values are potentially
10719 incompatible. Code compiled with one value cannot necessarily expect to
10720 work with code or libraries compiled with another value, if they exchange
10721 information using structures or unions.
10722
10723 @item -mabort-on-noreturn
10724 @opindex mabort-on-noreturn
10725 Generate a call to the function @code{abort} at the end of a
10726 @code{noreturn} function. It will be executed if the function tries to
10727 return.
10728
10729 @item -mlong-calls
10730 @itemx -mno-long-calls
10731 @opindex mlong-calls
10732 @opindex mno-long-calls
10733 Tells the compiler to perform function calls by first loading the
10734 address of the function into a register and then performing a subroutine
10735 call on this register. This switch is needed if the target function
10736 will lie outside of the 64 megabyte addressing range of the offset based
10737 version of subroutine call instruction.
10738
10739 Even if this switch is enabled, not all function calls will be turned
10740 into long calls. The heuristic is that static functions, functions
10741 which have the @samp{short-call} attribute, functions that are inside
10742 the scope of a @samp{#pragma no_long_calls} directive and functions whose
10743 definitions have already been compiled within the current compilation
10744 unit, will not be turned into long calls. The exception to this rule is
10745 that weak function definitions, functions with the @samp{long-call}
10746 attribute or the @samp{section} attribute, and functions that are within
10747 the scope of a @samp{#pragma long_calls} directive, will always be
10748 turned into long calls.
10749
10750 This feature is not enabled by default. Specifying
10751 @option{-mno-long-calls} will restore the default behavior, as will
10752 placing the function calls within the scope of a @samp{#pragma
10753 long_calls_off} directive. Note these switches have no effect on how
10754 the compiler generates code to handle function calls via function
10755 pointers.
10756
10757 @item -msingle-pic-base
10758 @opindex msingle-pic-base
10759 Treat the register used for PIC addressing as read-only, rather than
10760 loading it in the prologue for each function. The run-time system is
10761 responsible for initializing this register with an appropriate value
10762 before execution begins.
10763
10764 @item -mpic-register=@var{reg}
10765 @opindex mpic-register
10766 Specify the register to be used for PIC addressing. The default is R10
10767 unless stack-checking is enabled, when R9 is used.
10768
10769 @item -mcirrus-fix-invalid-insns
10770 @opindex mcirrus-fix-invalid-insns
10771 @opindex mno-cirrus-fix-invalid-insns
10772 Insert NOPs into the instruction stream to in order to work around
10773 problems with invalid Maverick instruction combinations. This option
10774 is only valid if the @option{-mcpu=ep9312} option has been used to
10775 enable generation of instructions for the Cirrus Maverick floating
10776 point co-processor. This option is not enabled by default, since the
10777 problem is only present in older Maverick implementations. The default
10778 can be re-enabled by use of the @option{-mno-cirrus-fix-invalid-insns}
10779 switch.
10780
10781 @item -mpoke-function-name
10782 @opindex mpoke-function-name
10783 Write the name of each function into the text section, directly
10784 preceding the function prologue. The generated code is similar to this:
10785
10786 @smallexample
10787 t0
10788 .ascii "arm_poke_function_name", 0
10789 .align
10790 t1
10791 .word 0xff000000 + (t1 - t0)
10792 arm_poke_function_name
10793 mov ip, sp
10794 stmfd sp!, @{fp, ip, lr, pc@}
10795 sub fp, ip, #4
10796 @end smallexample
10797
10798 When performing a stack backtrace, code can inspect the value of
10799 @code{pc} stored at @code{fp + 0}. If the trace function then looks at
10800 location @code{pc - 12} and the top 8 bits are set, then we know that
10801 there is a function name embedded immediately preceding this location
10802 and has length @code{((pc[-3]) & 0xff000000)}.
10803
10804 @item -mthumb
10805 @itemx -marm
10806 @opindex marm
10807 @opindex mthumb
10808
10809 Select between generating code that executes in ARM and Thumb
10810 states. The default for most configurations is to generate code
10811 that executes in ARM state, but the default can be changed by
10812 configuring GCC with the @option{--with-mode=}@var{state}
10813 configure option.
10814
10815 @item -mtpcs-frame
10816 @opindex mtpcs-frame
10817 Generate a stack frame that is compliant with the Thumb Procedure Call
10818 Standard for all non-leaf functions. (A leaf function is one that does
10819 not call any other functions.) The default is @option{-mno-tpcs-frame}.
10820
10821 @item -mtpcs-leaf-frame
10822 @opindex mtpcs-leaf-frame
10823 Generate a stack frame that is compliant with the Thumb Procedure Call
10824 Standard for all leaf functions. (A leaf function is one that does
10825 not call any other functions.) The default is @option{-mno-apcs-leaf-frame}.
10826
10827 @item -mcallee-super-interworking
10828 @opindex mcallee-super-interworking
10829 Gives all externally visible functions in the file being compiled an ARM
10830 instruction set header which switches to Thumb mode before executing the
10831 rest of the function. This allows these functions to be called from
10832 non-interworking code. This option is not valid in AAPCS configurations
10833 because interworking is enabled by default.
10834
10835 @item -mcaller-super-interworking
10836 @opindex mcaller-super-interworking
10837 Allows calls via function pointers (including virtual functions) to
10838 execute correctly regardless of whether the target code has been
10839 compiled for interworking or not. There is a small overhead in the cost
10840 of executing a function pointer if this option is enabled. This option
10841 is not valid in AAPCS configurations because interworking is enabled
10842 by default.
10843
10844 @item -mtp=@var{name}
10845 @opindex mtp
10846 Specify the access model for the thread local storage pointer. The valid
10847 models are @option{soft}, which generates calls to @code{__aeabi_read_tp},
10848 @option{cp15}, which fetches the thread pointer from @code{cp15} directly
10849 (supported in the arm6k architecture), and @option{auto}, which uses the
10850 best available method for the selected processor. The default setting is
10851 @option{auto}.
10852
10853 @item -mtls-dialect=@var{dialect}
10854 @opindex mtls-dialect
10855 Specify the dialect to use for accessing thread local storage. Two
10856 dialects are supported --- @option{gnu} and @option{gnu2}. The
10857 @option{gnu} dialect selects the original GNU scheme for supporting
10858 local and global dynamic TLS models. The @option{gnu2} dialect
10859 selects the GNU descriptor scheme, which provides better performance
10860 for shared libraries. The GNU descriptor scheme is compatible with
10861 the original scheme, but does require new assembler, linker and
10862 library support. Initial and local exec TLS models are unaffected by
10863 this option and always use the original scheme.
10864
10865 @item -mword-relocations
10866 @opindex mword-relocations
10867 Only generate absolute relocations on word sized values (i.e. R_ARM_ABS32).
10868 This is enabled by default on targets (uClinux, SymbianOS) where the runtime
10869 loader imposes this restriction, and when @option{-fpic} or @option{-fPIC}
10870 is specified.
10871
10872 @item -mfix-cortex-m3-ldrd
10873 @opindex mfix-cortex-m3-ldrd
10874 Some Cortex-M3 cores can cause data corruption when @code{ldrd} instructions
10875 with overlapping destination and base registers are used. This option avoids
10876 generating these instructions. This option is enabled by default when
10877 @option{-mcpu=cortex-m3} is specified.
10878
10879 @end table
10880
10881 @node AVR Options
10882 @subsection AVR Options
10883 @cindex AVR Options
10884
10885 These options are defined for AVR implementations:
10886
10887 @table @gcctabopt
10888 @item -mmcu=@var{mcu}
10889 @opindex mmcu
10890 Specify ATMEL AVR instruction set or MCU type.
10891
10892 Instruction set avr1 is for the minimal AVR core, not supported by the C
10893 compiler, only for assembler programs (MCU types: at90s1200, attiny10,
10894 attiny11, attiny12, attiny15, attiny28).
10895
10896 Instruction set avr2 (default) is for the classic AVR core with up to
10897 8K program memory space (MCU types: at90s2313, at90s2323, attiny22,
10898 at90s2333, at90s2343, at90s4414, at90s4433, at90s4434, at90s8515,
10899 at90c8534, at90s8535).
10900
10901 Instruction set avr3 is for the classic AVR core with up to 128K program
10902 memory space (MCU types: atmega103, atmega603, at43usb320, at76c711).
10903
10904 Instruction set avr4 is for the enhanced AVR core with up to 8K program
10905 memory space (MCU types: atmega8, atmega83, atmega85).
10906
10907 Instruction set avr5 is for the enhanced AVR core with up to 128K program
10908 memory space (MCU types: atmega16, atmega161, atmega163, atmega32, atmega323,
10909 atmega64, atmega128, at43usb355, at94k).
10910
10911 @item -mno-interrupts
10912 @opindex mno-interrupts
10913 Generated code is not compatible with hardware interrupts.
10914 Code size will be smaller.
10915
10916 @item -mcall-prologues
10917 @opindex mcall-prologues
10918 Functions prologues/epilogues expanded as call to appropriate
10919 subroutines. Code size will be smaller.
10920
10921 @item -mtiny-stack
10922 @opindex mtiny-stack
10923 Change only the low 8 bits of the stack pointer.
10924
10925 @item -mint8
10926 @opindex mint8
10927 Assume int to be 8 bit integer. This affects the sizes of all types: A
10928 char will be 1 byte, an int will be 1 byte, a long will be 2 bytes
10929 and long long will be 4 bytes. Please note that this option does not
10930 comply to the C standards, but it will provide you with smaller code
10931 size.
10932
10933 @item -mstrict-X
10934 @opindex mstrict-X
10935 Use register @code{X} in a way proposed by the hardware. This means
10936 that @code{X} will only be used in indirect, post-increment or
10937 pre-decrement addressing.
10938
10939 Without this option, the @code{X} register may be used in the same way
10940 as @code{Y} or @code{Z} which then is emulated by additional
10941 instructions.
10942 For example, loading a value with @code{X+const} addressing with a
10943 small @code{const <= 63} to a register @var{Rn} will be printed as
10944 @example
10945 adiw r26, const
10946 ld @var{Rn}, X
10947 sbiw r26, const
10948 @end example
10949 @end table
10950
10951 @subsubsection @code{EIND} and Devices with more than 128k Bytes of Flash
10952
10953 Pointers in the implementation are 16 bits wide.
10954 The address of a function or label is represented as word address so
10955 that indirect jumps and calls can address any code address in the
10956 range of 64k words.
10957
10958 In order to faciliate indirect jump on devices with more than 128k
10959 bytes of program memory space, there is a special function register called
10960 @code{EIND} that serves as most significant part of the target address
10961 when @code{EICALL} or @code{EIJMP} instructions are used.
10962
10963 Indirect jumps and calls on these devices are handled as follows and
10964 are subject to some limitations:
10965
10966 @itemize @bullet
10967
10968 @item
10969 The compiler never sets @code{EIND}.
10970
10971 @item
10972 The startup code from libgcc never sets @code{EIND}.
10973 Notice that startup code is a blend of code from libgcc and avr-libc.
10974 For the impact of avr-libc on @code{EIND}, see the
10975 @w{@uref{http://nongnu.org/avr-libc/user-manual,avr-libc user manual}}.
10976
10977 @item
10978 The compiler uses @code{EIND} implicitely in @code{EICALL}/@code{EIJMP}
10979 instructions or might read @code{EIND} directly.
10980
10981 @item
10982 The compiler assumes that @code{EIND} never changes during the startup
10983 code or run of the application. In particular, @code{EIND} is not
10984 saved/restored in function or interrupt service routine
10985 prologue/epilogue.
10986
10987 @item
10988 It is legitimate for user-specific startup code to set up @code{EIND}
10989 early, for example by means of initialization code located in
10990 section @code{.init3}, and thus prior to general startup code that
10991 initializes RAM and calls constructors.
10992
10993 @item
10994 For indirect calls to functions and computed goto, the linker will
10995 generate @emph{stubs}. Stubs are jump pads sometimes also called
10996 @emph{trampolines}. Thus, the indirect call/jump will jump to such a stub.
10997 The stub contains a direct jump to the desired address.
10998
10999 @item
11000 Stubs will be generated automatically by the linker if
11001 the following two conditions are met:
11002 @itemize @minus
11003
11004 @item The address of a label is taken by means of the @code{gs} modifier
11005 (short for @emph{generate stubs}) like so:
11006 @example
11007 LDI r24, lo8(gs(@var{func}))
11008 LDI r25, hi8(gs(@var{func}))
11009 @end example
11010 @item The final location of that label is in a code segment
11011 @emph{outside} the segment where the stubs are located.
11012 @end itemize
11013
11014 @item
11015 The compiler will emit such @code{gs} modifiers for code labels in the
11016 following situations:
11017 @itemize @minus
11018 @item Taking address of a function or code label.
11019 @item Computed goto.
11020 @item If prologue-save function is used, see @option{-mcall-prologues}
11021 command line option.
11022 @item Switch/case dispatch tables. If you do not want such dispatch
11023 tables you can specify the @option{-fno-jump-tables} command line option.
11024 @item C and C++ constructors/destructors called during startup/shutdown.
11025 @item If the tools hit a @code{gs()} modifier explained above.
11026 @end itemize
11027
11028 @item
11029 The default linker script is arranged for code with @code{EIND = 0}.
11030 If code is supposed to work for a setup with @code{EIND != 0}, a custom
11031 linker script has to be used in order to place the sections whose
11032 name start with @code{.trampolines} into the segment where @code{EIND}
11033 points to.
11034
11035 @item
11036 Jumping to non-symbolic addresses like so is @emph{not} supported:
11037
11038 @example
11039 int main (void)
11040 @{
11041 /* Call function at word address 0x2 */
11042 return ((int(*)(void)) 0x2)();
11043 @}
11044 @end example
11045
11046 Instead, a stub has to be set up:
11047
11048 @example
11049 int main (void)
11050 @{
11051 extern int func_4 (void);
11052
11053 /* Call function at byte address 0x4 */
11054 return func_4();
11055 @}
11056 @end example
11057
11058 and the application be linked with @code{-Wl,--defsym,func_4=0x4}.
11059 Alternatively, @code{func_4} can be defined in the linker script.
11060 @end itemize
11061
11062 @node Blackfin Options
11063 @subsection Blackfin Options
11064 @cindex Blackfin Options
11065
11066 @table @gcctabopt
11067 @item -mcpu=@var{cpu}@r{[}-@var{sirevision}@r{]}
11068 @opindex mcpu=
11069 Specifies the name of the target Blackfin processor. Currently, @var{cpu}
11070 can be one of @samp{bf512}, @samp{bf514}, @samp{bf516}, @samp{bf518},
11071 @samp{bf522}, @samp{bf523}, @samp{bf524}, @samp{bf525}, @samp{bf526},
11072 @samp{bf527}, @samp{bf531}, @samp{bf532}, @samp{bf533},
11073 @samp{bf534}, @samp{bf536}, @samp{bf537}, @samp{bf538}, @samp{bf539},
11074 @samp{bf542}, @samp{bf544}, @samp{bf547}, @samp{bf548}, @samp{bf549},
11075 @samp{bf542m}, @samp{bf544m}, @samp{bf547m}, @samp{bf548m}, @samp{bf549m},
11076 @samp{bf561}, @samp{bf592}.
11077 The optional @var{sirevision} specifies the silicon revision of the target
11078 Blackfin processor. Any workarounds available for the targeted silicon revision
11079 will be enabled. If @var{sirevision} is @samp{none}, no workarounds are enabled.
11080 If @var{sirevision} is @samp{any}, all workarounds for the targeted processor
11081 will be enabled. The @code{__SILICON_REVISION__} macro is defined to two
11082 hexadecimal digits representing the major and minor numbers in the silicon
11083 revision. If @var{sirevision} is @samp{none}, the @code{__SILICON_REVISION__}
11084 is not defined. If @var{sirevision} is @samp{any}, the
11085 @code{__SILICON_REVISION__} is defined to be @code{0xffff}.
11086 If this optional @var{sirevision} is not used, GCC assumes the latest known
11087 silicon revision of the targeted Blackfin processor.
11088
11089 Support for @samp{bf561} is incomplete. For @samp{bf561},
11090 Only the processor macro is defined.
11091 Without this option, @samp{bf532} is used as the processor by default.
11092 The corresponding predefined processor macros for @var{cpu} is to
11093 be defined. And for @samp{bfin-elf} toolchain, this causes the hardware BSP
11094 provided by libgloss to be linked in if @option{-msim} is not given.
11095
11096 @item -msim
11097 @opindex msim
11098 Specifies that the program will be run on the simulator. This causes
11099 the simulator BSP provided by libgloss to be linked in. This option
11100 has effect only for @samp{bfin-elf} toolchain.
11101 Certain other options, such as @option{-mid-shared-library} and
11102 @option{-mfdpic}, imply @option{-msim}.
11103
11104 @item -momit-leaf-frame-pointer
11105 @opindex momit-leaf-frame-pointer
11106 Don't keep the frame pointer in a register for leaf functions. This
11107 avoids the instructions to save, set up and restore frame pointers and
11108 makes an extra register available in leaf functions. The option
11109 @option{-fomit-frame-pointer} removes the frame pointer for all functions
11110 which might make debugging harder.
11111
11112 @item -mspecld-anomaly
11113 @opindex mspecld-anomaly
11114 When enabled, the compiler will ensure that the generated code does not
11115 contain speculative loads after jump instructions. If this option is used,
11116 @code{__WORKAROUND_SPECULATIVE_LOADS} is defined.
11117
11118 @item -mno-specld-anomaly
11119 @opindex mno-specld-anomaly
11120 Don't generate extra code to prevent speculative loads from occurring.
11121
11122 @item -mcsync-anomaly
11123 @opindex mcsync-anomaly
11124 When enabled, the compiler will ensure that the generated code does not
11125 contain CSYNC or SSYNC instructions too soon after conditional branches.
11126 If this option is used, @code{__WORKAROUND_SPECULATIVE_SYNCS} is defined.
11127
11128 @item -mno-csync-anomaly
11129 @opindex mno-csync-anomaly
11130 Don't generate extra code to prevent CSYNC or SSYNC instructions from
11131 occurring too soon after a conditional branch.
11132
11133 @item -mlow-64k
11134 @opindex mlow-64k
11135 When enabled, the compiler is free to take advantage of the knowledge that
11136 the entire program fits into the low 64k of memory.
11137
11138 @item -mno-low-64k
11139 @opindex mno-low-64k
11140 Assume that the program is arbitrarily large. This is the default.
11141
11142 @item -mstack-check-l1
11143 @opindex mstack-check-l1
11144 Do stack checking using information placed into L1 scratchpad memory by the
11145 uClinux kernel.
11146
11147 @item -mid-shared-library
11148 @opindex mid-shared-library
11149 Generate code that supports shared libraries via the library ID method.
11150 This allows for execute in place and shared libraries in an environment
11151 without virtual memory management. This option implies @option{-fPIC}.
11152 With a @samp{bfin-elf} target, this option implies @option{-msim}.
11153
11154 @item -mno-id-shared-library
11155 @opindex mno-id-shared-library
11156 Generate code that doesn't assume ID based shared libraries are being used.
11157 This is the default.
11158
11159 @item -mleaf-id-shared-library
11160 @opindex mleaf-id-shared-library
11161 Generate code that supports shared libraries via the library ID method,
11162 but assumes that this library or executable won't link against any other
11163 ID shared libraries. That allows the compiler to use faster code for jumps
11164 and calls.
11165
11166 @item -mno-leaf-id-shared-library
11167 @opindex mno-leaf-id-shared-library
11168 Do not assume that the code being compiled won't link against any ID shared
11169 libraries. Slower code will be generated for jump and call insns.
11170
11171 @item -mshared-library-id=n
11172 @opindex mshared-library-id
11173 Specified the identification number of the ID based shared library being
11174 compiled. Specifying a value of 0 will generate more compact code, specifying
11175 other values will force the allocation of that number to the current
11176 library but is no more space or time efficient than omitting this option.
11177
11178 @item -msep-data
11179 @opindex msep-data
11180 Generate code that allows the data segment to be located in a different
11181 area of memory from the text segment. This allows for execute in place in
11182 an environment without virtual memory management by eliminating relocations
11183 against the text section.
11184
11185 @item -mno-sep-data
11186 @opindex mno-sep-data
11187 Generate code that assumes that the data segment follows the text segment.
11188 This is the default.
11189
11190 @item -mlong-calls
11191 @itemx -mno-long-calls
11192 @opindex mlong-calls
11193 @opindex mno-long-calls
11194 Tells the compiler to perform function calls by first loading the
11195 address of the function into a register and then performing a subroutine
11196 call on this register. This switch is needed if the target function
11197 will lie outside of the 24 bit addressing range of the offset based
11198 version of subroutine call instruction.
11199
11200 This feature is not enabled by default. Specifying
11201 @option{-mno-long-calls} will restore the default behavior. Note these
11202 switches have no effect on how the compiler generates code to handle
11203 function calls via function pointers.
11204
11205 @item -mfast-fp
11206 @opindex mfast-fp
11207 Link with the fast floating-point library. This library relaxes some of
11208 the IEEE floating-point standard's rules for checking inputs against
11209 Not-a-Number (NAN), in the interest of performance.
11210
11211 @item -minline-plt
11212 @opindex minline-plt
11213 Enable inlining of PLT entries in function calls to functions that are
11214 not known to bind locally. It has no effect without @option{-mfdpic}.
11215
11216 @item -mmulticore
11217 @opindex mmulticore
11218 Build standalone application for multicore Blackfin processor. Proper
11219 start files and link scripts will be used to support multicore.
11220 This option defines @code{__BFIN_MULTICORE}. It can only be used with
11221 @option{-mcpu=bf561@r{[}-@var{sirevision}@r{]}}. It can be used with
11222 @option{-mcorea} or @option{-mcoreb}. If it's used without
11223 @option{-mcorea} or @option{-mcoreb}, single application/dual core
11224 programming model is used. In this model, the main function of Core B
11225 should be named as coreb_main. If it's used with @option{-mcorea} or
11226 @option{-mcoreb}, one application per core programming model is used.
11227 If this option is not used, single core application programming
11228 model is used.
11229
11230 @item -mcorea
11231 @opindex mcorea
11232 Build standalone application for Core A of BF561 when using
11233 one application per core programming model. Proper start files
11234 and link scripts will be used to support Core A. This option
11235 defines @code{__BFIN_COREA}. It must be used with @option{-mmulticore}.
11236
11237 @item -mcoreb
11238 @opindex mcoreb
11239 Build standalone application for Core B of BF561 when using
11240 one application per core programming model. Proper start files
11241 and link scripts will be used to support Core B. This option
11242 defines @code{__BFIN_COREB}. When this option is used, coreb_main
11243 should be used instead of main. It must be used with
11244 @option{-mmulticore}.
11245
11246 @item -msdram
11247 @opindex msdram
11248 Build standalone application for SDRAM. Proper start files and
11249 link scripts will be used to put the application into SDRAM.
11250 Loader should initialize SDRAM before loading the application
11251 into SDRAM. This option defines @code{__BFIN_SDRAM}.
11252
11253 @item -micplb
11254 @opindex micplb
11255 Assume that ICPLBs are enabled at runtime. This has an effect on certain
11256 anomaly workarounds. For Linux targets, the default is to assume ICPLBs
11257 are enabled; for standalone applications the default is off.
11258 @end table
11259
11260 @node C6X Options
11261 @subsection C6X Options
11262 @cindex C6X Options
11263
11264 @table @gcctabopt
11265 @item -march=@var{name}
11266 @opindex march
11267 This specifies the name of the target architecture. GCC uses this
11268 name to determine what kind of instructions it can emit when generating
11269 assembly code. Permissible names are: @samp{c62x},
11270 @samp{c64x}, @samp{c64x+}, @samp{c67x}, @samp{c67x+}, @samp{c674x}.
11271
11272 @item -mbig-endian
11273 @opindex mbig-endian
11274 Generate code for a big endian target.
11275
11276 @item -mlittle-endian
11277 @opindex mlittle-endian
11278 Generate code for a little endian target. This is the default.
11279
11280 @item -msim
11281 @opindex msim
11282 Choose startup files and linker script suitable for the simulator.
11283
11284 @item -msdata=default
11285 @opindex msdata=default
11286 Put small global and static data in the @samp{.neardata} section,
11287 which is pointed to by register @code{B14}. Put small uninitialized
11288 global and static data in the @samp{.bss} section, which is adjacent
11289 to the @samp{.neardata} section. Put small read-only data into the
11290 @samp{.rodata} section. The corresponding sections used for large
11291 pieces of data are @samp{.fardata}, @samp{.far} and @samp{.const}.
11292
11293 @item -msdata=all
11294 @opindex msdata=all
11295 Put all data, not just small objets, into the sections reserved for
11296 small data, and use addressing relative to the @code{B14} register to
11297 access them.
11298
11299 @item -msdata=none
11300 @opindex msdata=none
11301 Make no use of the sections reserved for small data, and use absolute
11302 addresses to access all data. Put all initialized global and static
11303 data in the @samp{.fardata} section, and all uninitialized data in the
11304 @samp{.far} section. Put all constant data into the @samp{.const}
11305 section.
11306 @end table
11307
11308 @node CRIS Options
11309 @subsection CRIS Options
11310 @cindex CRIS Options
11311
11312 These options are defined specifically for the CRIS ports.
11313
11314 @table @gcctabopt
11315 @item -march=@var{architecture-type}
11316 @itemx -mcpu=@var{architecture-type}
11317 @opindex march
11318 @opindex mcpu
11319 Generate code for the specified architecture. The choices for
11320 @var{architecture-type} are @samp{v3}, @samp{v8} and @samp{v10} for
11321 respectively ETRAX@w{ }4, ETRAX@w{ }100, and ETRAX@w{ }100@w{ }LX@.
11322 Default is @samp{v0} except for cris-axis-linux-gnu, where the default is
11323 @samp{v10}.
11324
11325 @item -mtune=@var{architecture-type}
11326 @opindex mtune
11327 Tune to @var{architecture-type} everything applicable about the generated
11328 code, except for the ABI and the set of available instructions. The
11329 choices for @var{architecture-type} are the same as for
11330 @option{-march=@var{architecture-type}}.
11331
11332 @item -mmax-stack-frame=@var{n}
11333 @opindex mmax-stack-frame
11334 Warn when the stack frame of a function exceeds @var{n} bytes.
11335
11336 @item -metrax4
11337 @itemx -metrax100
11338 @opindex metrax4
11339 @opindex metrax100
11340 The options @option{-metrax4} and @option{-metrax100} are synonyms for
11341 @option{-march=v3} and @option{-march=v8} respectively.
11342
11343 @item -mmul-bug-workaround
11344 @itemx -mno-mul-bug-workaround
11345 @opindex mmul-bug-workaround
11346 @opindex mno-mul-bug-workaround
11347 Work around a bug in the @code{muls} and @code{mulu} instructions for CPU
11348 models where it applies. This option is active by default.
11349
11350 @item -mpdebug
11351 @opindex mpdebug
11352 Enable CRIS-specific verbose debug-related information in the assembly
11353 code. This option also has the effect to turn off the @samp{#NO_APP}
11354 formatted-code indicator to the assembler at the beginning of the
11355 assembly file.
11356
11357 @item -mcc-init
11358 @opindex mcc-init
11359 Do not use condition-code results from previous instruction; always emit
11360 compare and test instructions before use of condition codes.
11361
11362 @item -mno-side-effects
11363 @opindex mno-side-effects
11364 Do not emit instructions with side-effects in addressing modes other than
11365 post-increment.
11366
11367 @item -mstack-align
11368 @itemx -mno-stack-align
11369 @itemx -mdata-align
11370 @itemx -mno-data-align
11371 @itemx -mconst-align
11372 @itemx -mno-const-align
11373 @opindex mstack-align
11374 @opindex mno-stack-align
11375 @opindex mdata-align
11376 @opindex mno-data-align
11377 @opindex mconst-align
11378 @opindex mno-const-align
11379 These options (no-options) arranges (eliminate arrangements) for the
11380 stack-frame, individual data and constants to be aligned for the maximum
11381 single data access size for the chosen CPU model. The default is to
11382 arrange for 32-bit alignment. ABI details such as structure layout are
11383 not affected by these options.
11384
11385 @item -m32-bit
11386 @itemx -m16-bit
11387 @itemx -m8-bit
11388 @opindex m32-bit
11389 @opindex m16-bit
11390 @opindex m8-bit
11391 Similar to the stack- data- and const-align options above, these options
11392 arrange for stack-frame, writable data and constants to all be 32-bit,
11393 16-bit or 8-bit aligned. The default is 32-bit alignment.
11394
11395 @item -mno-prologue-epilogue
11396 @itemx -mprologue-epilogue
11397 @opindex mno-prologue-epilogue
11398 @opindex mprologue-epilogue
11399 With @option{-mno-prologue-epilogue}, the normal function prologue and
11400 epilogue that sets up the stack-frame are omitted and no return
11401 instructions or return sequences are generated in the code. Use this
11402 option only together with visual inspection of the compiled code: no
11403 warnings or errors are generated when call-saved registers must be saved,
11404 or storage for local variable needs to be allocated.
11405
11406 @item -mno-gotplt
11407 @itemx -mgotplt
11408 @opindex mno-gotplt
11409 @opindex mgotplt
11410 With @option{-fpic} and @option{-fPIC}, don't generate (do generate)
11411 instruction sequences that load addresses for functions from the PLT part
11412 of the GOT rather than (traditional on other architectures) calls to the
11413 PLT@. The default is @option{-mgotplt}.
11414
11415 @item -melf
11416 @opindex melf
11417 Legacy no-op option only recognized with the cris-axis-elf and
11418 cris-axis-linux-gnu targets.
11419
11420 @item -mlinux
11421 @opindex mlinux
11422 Legacy no-op option only recognized with the cris-axis-linux-gnu target.
11423
11424 @item -sim
11425 @opindex sim
11426 This option, recognized for the cris-axis-elf arranges
11427 to link with input-output functions from a simulator library. Code,
11428 initialized data and zero-initialized data are allocated consecutively.
11429
11430 @item -sim2
11431 @opindex sim2
11432 Like @option{-sim}, but pass linker options to locate initialized data at
11433 0x40000000 and zero-initialized data at 0x80000000.
11434 @end table
11435
11436 @node Darwin Options
11437 @subsection Darwin Options
11438 @cindex Darwin options
11439
11440 These options are defined for all architectures running the Darwin operating
11441 system.
11442
11443 FSF GCC on Darwin does not create ``fat'' object files; it will create
11444 an object file for the single architecture that it was built to
11445 target. Apple's GCC on Darwin does create ``fat'' files if multiple
11446 @option{-arch} options are used; it does so by running the compiler or
11447 linker multiple times and joining the results together with
11448 @file{lipo}.
11449
11450 The subtype of the file created (like @samp{ppc7400} or @samp{ppc970} or
11451 @samp{i686}) is determined by the flags that specify the ISA
11452 that GCC is targetting, like @option{-mcpu} or @option{-march}. The
11453 @option{-force_cpusubtype_ALL} option can be used to override this.
11454
11455 The Darwin tools vary in their behavior when presented with an ISA
11456 mismatch. The assembler, @file{as}, will only permit instructions to
11457 be used that are valid for the subtype of the file it is generating,
11458 so you cannot put 64-bit instructions in a @samp{ppc750} object file.
11459 The linker for shared libraries, @file{/usr/bin/libtool}, will fail
11460 and print an error if asked to create a shared library with a less
11461 restrictive subtype than its input files (for instance, trying to put
11462 a @samp{ppc970} object file in a @samp{ppc7400} library). The linker
11463 for executables, @file{ld}, will quietly give the executable the most
11464 restrictive subtype of any of its input files.
11465
11466 @table @gcctabopt
11467 @item -F@var{dir}
11468 @opindex F
11469 Add the framework directory @var{dir} to the head of the list of
11470 directories to be searched for header files. These directories are
11471 interleaved with those specified by @option{-I} options and are
11472 scanned in a left-to-right order.
11473
11474 A framework directory is a directory with frameworks in it. A
11475 framework is a directory with a @samp{"Headers"} and/or
11476 @samp{"PrivateHeaders"} directory contained directly in it that ends
11477 in @samp{".framework"}. The name of a framework is the name of this
11478 directory excluding the @samp{".framework"}. Headers associated with
11479 the framework are found in one of those two directories, with
11480 @samp{"Headers"} being searched first. A subframework is a framework
11481 directory that is in a framework's @samp{"Frameworks"} directory.
11482 Includes of subframework headers can only appear in a header of a
11483 framework that contains the subframework, or in a sibling subframework
11484 header. Two subframeworks are siblings if they occur in the same
11485 framework. A subframework should not have the same name as a
11486 framework, a warning will be issued if this is violated. Currently a
11487 subframework cannot have subframeworks, in the future, the mechanism
11488 may be extended to support this. The standard frameworks can be found
11489 in @samp{"/System/Library/Frameworks"} and
11490 @samp{"/Library/Frameworks"}. An example include looks like
11491 @code{#include <Framework/header.h>}, where @samp{Framework} denotes
11492 the name of the framework and header.h is found in the
11493 @samp{"PrivateHeaders"} or @samp{"Headers"} directory.
11494
11495 @item -iframework@var{dir}
11496 @opindex iframework
11497 Like @option{-F} except the directory is a treated as a system
11498 directory. The main difference between this @option{-iframework} and
11499 @option{-F} is that with @option{-iframework} the compiler does not
11500 warn about constructs contained within header files found via
11501 @var{dir}. This option is valid only for the C family of languages.
11502
11503 @item -gused
11504 @opindex gused
11505 Emit debugging information for symbols that are used. For STABS
11506 debugging format, this enables @option{-feliminate-unused-debug-symbols}.
11507 This is by default ON@.
11508
11509 @item -gfull
11510 @opindex gfull
11511 Emit debugging information for all symbols and types.
11512
11513 @item -mmacosx-version-min=@var{version}
11514 The earliest version of MacOS X that this executable will run on
11515 is @var{version}. Typical values of @var{version} include @code{10.1},
11516 @code{10.2}, and @code{10.3.9}.
11517
11518 If the compiler was built to use the system's headers by default,
11519 then the default for this option is the system version on which the
11520 compiler is running, otherwise the default is to make choices which
11521 are compatible with as many systems and code bases as possible.
11522
11523 @item -mkernel
11524 @opindex mkernel
11525 Enable kernel development mode. The @option{-mkernel} option sets
11526 @option{-static}, @option{-fno-common}, @option{-fno-cxa-atexit},
11527 @option{-fno-exceptions}, @option{-fno-non-call-exceptions},
11528 @option{-fapple-kext}, @option{-fno-weak} and @option{-fno-rtti} where
11529 applicable. This mode also sets @option{-mno-altivec},
11530 @option{-msoft-float}, @option{-fno-builtin} and
11531 @option{-mlong-branch} for PowerPC targets.
11532
11533 @item -mone-byte-bool
11534 @opindex mone-byte-bool
11535 Override the defaults for @samp{bool} so that @samp{sizeof(bool)==1}.
11536 By default @samp{sizeof(bool)} is @samp{4} when compiling for
11537 Darwin/PowerPC and @samp{1} when compiling for Darwin/x86, so this
11538 option has no effect on x86.
11539
11540 @strong{Warning:} The @option{-mone-byte-bool} switch causes GCC
11541 to generate code that is not binary compatible with code generated
11542 without that switch. Using this switch may require recompiling all
11543 other modules in a program, including system libraries. Use this
11544 switch to conform to a non-default data model.
11545
11546 @item -mfix-and-continue
11547 @itemx -ffix-and-continue
11548 @itemx -findirect-data
11549 @opindex mfix-and-continue
11550 @opindex ffix-and-continue
11551 @opindex findirect-data
11552 Generate code suitable for fast turn around development. Needed to
11553 enable gdb to dynamically load @code{.o} files into already running
11554 programs. @option{-findirect-data} and @option{-ffix-and-continue}
11555 are provided for backwards compatibility.
11556
11557 @item -all_load
11558 @opindex all_load
11559 Loads all members of static archive libraries.
11560 See man ld(1) for more information.
11561
11562 @item -arch_errors_fatal
11563 @opindex arch_errors_fatal
11564 Cause the errors having to do with files that have the wrong architecture
11565 to be fatal.
11566
11567 @item -bind_at_load
11568 @opindex bind_at_load
11569 Causes the output file to be marked such that the dynamic linker will
11570 bind all undefined references when the file is loaded or launched.
11571
11572 @item -bundle
11573 @opindex bundle
11574 Produce a Mach-o bundle format file.
11575 See man ld(1) for more information.
11576
11577 @item -bundle_loader @var{executable}
11578 @opindex bundle_loader
11579 This option specifies the @var{executable} that will be loading the build
11580 output file being linked. See man ld(1) for more information.
11581
11582 @item -dynamiclib
11583 @opindex dynamiclib
11584 When passed this option, GCC will produce a dynamic library instead of
11585 an executable when linking, using the Darwin @file{libtool} command.
11586
11587 @item -force_cpusubtype_ALL
11588 @opindex force_cpusubtype_ALL
11589 This causes GCC's output file to have the @var{ALL} subtype, instead of
11590 one controlled by the @option{-mcpu} or @option{-march} option.
11591
11592 @item -allowable_client @var{client_name}
11593 @itemx -client_name
11594 @itemx -compatibility_version
11595 @itemx -current_version
11596 @itemx -dead_strip
11597 @itemx -dependency-file
11598 @itemx -dylib_file
11599 @itemx -dylinker_install_name
11600 @itemx -dynamic
11601 @itemx -exported_symbols_list
11602 @itemx -filelist
11603 @need 800
11604 @itemx -flat_namespace
11605 @itemx -force_flat_namespace
11606 @itemx -headerpad_max_install_names
11607 @itemx -image_base
11608 @itemx -init
11609 @itemx -install_name
11610 @itemx -keep_private_externs
11611 @itemx -multi_module
11612 @itemx -multiply_defined
11613 @itemx -multiply_defined_unused
11614 @need 800
11615 @itemx -noall_load
11616 @itemx -no_dead_strip_inits_and_terms
11617 @itemx -nofixprebinding
11618 @itemx -nomultidefs
11619 @itemx -noprebind
11620 @itemx -noseglinkedit
11621 @itemx -pagezero_size
11622 @itemx -prebind
11623 @itemx -prebind_all_twolevel_modules
11624 @itemx -private_bundle
11625 @need 800
11626 @itemx -read_only_relocs
11627 @itemx -sectalign
11628 @itemx -sectobjectsymbols
11629 @itemx -whyload
11630 @itemx -seg1addr
11631 @itemx -sectcreate
11632 @itemx -sectobjectsymbols
11633 @itemx -sectorder
11634 @itemx -segaddr
11635 @itemx -segs_read_only_addr
11636 @need 800
11637 @itemx -segs_read_write_addr
11638 @itemx -seg_addr_table
11639 @itemx -seg_addr_table_filename
11640 @itemx -seglinkedit
11641 @itemx -segprot
11642 @itemx -segs_read_only_addr
11643 @itemx -segs_read_write_addr
11644 @itemx -single_module
11645 @itemx -static
11646 @itemx -sub_library
11647 @need 800
11648 @itemx -sub_umbrella
11649 @itemx -twolevel_namespace
11650 @itemx -umbrella
11651 @itemx -undefined
11652 @itemx -unexported_symbols_list
11653 @itemx -weak_reference_mismatches
11654 @itemx -whatsloaded
11655 @opindex allowable_client
11656 @opindex client_name
11657 @opindex compatibility_version
11658 @opindex current_version
11659 @opindex dead_strip
11660 @opindex dependency-file
11661 @opindex dylib_file
11662 @opindex dylinker_install_name
11663 @opindex dynamic
11664 @opindex exported_symbols_list
11665 @opindex filelist
11666 @opindex flat_namespace
11667 @opindex force_flat_namespace
11668 @opindex headerpad_max_install_names
11669 @opindex image_base
11670 @opindex init
11671 @opindex install_name
11672 @opindex keep_private_externs
11673 @opindex multi_module
11674 @opindex multiply_defined
11675 @opindex multiply_defined_unused
11676 @opindex noall_load
11677 @opindex no_dead_strip_inits_and_terms
11678 @opindex nofixprebinding
11679 @opindex nomultidefs
11680 @opindex noprebind
11681 @opindex noseglinkedit
11682 @opindex pagezero_size
11683 @opindex prebind
11684 @opindex prebind_all_twolevel_modules
11685 @opindex private_bundle
11686 @opindex read_only_relocs
11687 @opindex sectalign
11688 @opindex sectobjectsymbols
11689 @opindex whyload
11690 @opindex seg1addr
11691 @opindex sectcreate
11692 @opindex sectobjectsymbols
11693 @opindex sectorder
11694 @opindex segaddr
11695 @opindex segs_read_only_addr
11696 @opindex segs_read_write_addr
11697 @opindex seg_addr_table
11698 @opindex seg_addr_table_filename
11699 @opindex seglinkedit
11700 @opindex segprot
11701 @opindex segs_read_only_addr
11702 @opindex segs_read_write_addr
11703 @opindex single_module
11704 @opindex static
11705 @opindex sub_library
11706 @opindex sub_umbrella
11707 @opindex twolevel_namespace
11708 @opindex umbrella
11709 @opindex undefined
11710 @opindex unexported_symbols_list
11711 @opindex weak_reference_mismatches
11712 @opindex whatsloaded
11713 These options are passed to the Darwin linker. The Darwin linker man page
11714 describes them in detail.
11715 @end table
11716
11717 @node DEC Alpha Options
11718 @subsection DEC Alpha Options
11719
11720 These @samp{-m} options are defined for the DEC Alpha implementations:
11721
11722 @table @gcctabopt
11723 @item -mno-soft-float
11724 @itemx -msoft-float
11725 @opindex mno-soft-float
11726 @opindex msoft-float
11727 Use (do not use) the hardware floating-point instructions for
11728 floating-point operations. When @option{-msoft-float} is specified,
11729 functions in @file{libgcc.a} will be used to perform floating-point
11730 operations. Unless they are replaced by routines that emulate the
11731 floating-point operations, or compiled in such a way as to call such
11732 emulations routines, these routines will issue floating-point
11733 operations. If you are compiling for an Alpha without floating-point
11734 operations, you must ensure that the library is built so as not to call
11735 them.
11736
11737 Note that Alpha implementations without floating-point operations are
11738 required to have floating-point registers.
11739
11740 @item -mfp-reg
11741 @itemx -mno-fp-regs
11742 @opindex mfp-reg
11743 @opindex mno-fp-regs
11744 Generate code that uses (does not use) the floating-point register set.
11745 @option{-mno-fp-regs} implies @option{-msoft-float}. If the floating-point
11746 register set is not used, floating point operands are passed in integer
11747 registers as if they were integers and floating-point results are passed
11748 in @code{$0} instead of @code{$f0}. This is a non-standard calling sequence,
11749 so any function with a floating-point argument or return value called by code
11750 compiled with @option{-mno-fp-regs} must also be compiled with that
11751 option.
11752
11753 A typical use of this option is building a kernel that does not use,
11754 and hence need not save and restore, any floating-point registers.
11755
11756 @item -mieee
11757 @opindex mieee
11758 The Alpha architecture implements floating-point hardware optimized for
11759 maximum performance. It is mostly compliant with the IEEE floating
11760 point standard. However, for full compliance, software assistance is
11761 required. This option generates code fully IEEE compliant code
11762 @emph{except} that the @var{inexact-flag} is not maintained (see below).
11763 If this option is turned on, the preprocessor macro @code{_IEEE_FP} is
11764 defined during compilation. The resulting code is less efficient but is
11765 able to correctly support denormalized numbers and exceptional IEEE
11766 values such as not-a-number and plus/minus infinity. Other Alpha
11767 compilers call this option @option{-ieee_with_no_inexact}.
11768
11769 @item -mieee-with-inexact
11770 @opindex mieee-with-inexact
11771 This is like @option{-mieee} except the generated code also maintains
11772 the IEEE @var{inexact-flag}. Turning on this option causes the
11773 generated code to implement fully-compliant IEEE math. In addition to
11774 @code{_IEEE_FP}, @code{_IEEE_FP_EXACT} is defined as a preprocessor
11775 macro. On some Alpha implementations the resulting code may execute
11776 significantly slower than the code generated by default. Since there is
11777 very little code that depends on the @var{inexact-flag}, you should
11778 normally not specify this option. Other Alpha compilers call this
11779 option @option{-ieee_with_inexact}.
11780
11781 @item -mfp-trap-mode=@var{trap-mode}
11782 @opindex mfp-trap-mode
11783 This option controls what floating-point related traps are enabled.
11784 Other Alpha compilers call this option @option{-fptm @var{trap-mode}}.
11785 The trap mode can be set to one of four values:
11786
11787 @table @samp
11788 @item n
11789 This is the default (normal) setting. The only traps that are enabled
11790 are the ones that cannot be disabled in software (e.g., division by zero
11791 trap).
11792
11793 @item u
11794 In addition to the traps enabled by @samp{n}, underflow traps are enabled
11795 as well.
11796
11797 @item su
11798 Like @samp{u}, but the instructions are marked to be safe for software
11799 completion (see Alpha architecture manual for details).
11800
11801 @item sui
11802 Like @samp{su}, but inexact traps are enabled as well.
11803 @end table
11804
11805 @item -mfp-rounding-mode=@var{rounding-mode}
11806 @opindex mfp-rounding-mode
11807 Selects the IEEE rounding mode. Other Alpha compilers call this option
11808 @option{-fprm @var{rounding-mode}}. The @var{rounding-mode} can be one
11809 of:
11810
11811 @table @samp
11812 @item n
11813 Normal IEEE rounding mode. Floating point numbers are rounded towards
11814 the nearest machine number or towards the even machine number in case
11815 of a tie.
11816
11817 @item m
11818 Round towards minus infinity.
11819
11820 @item c
11821 Chopped rounding mode. Floating point numbers are rounded towards zero.
11822
11823 @item d
11824 Dynamic rounding mode. A field in the floating point control register
11825 (@var{fpcr}, see Alpha architecture reference manual) controls the
11826 rounding mode in effect. The C library initializes this register for
11827 rounding towards plus infinity. Thus, unless your program modifies the
11828 @var{fpcr}, @samp{d} corresponds to round towards plus infinity.
11829 @end table
11830
11831 @item -mtrap-precision=@var{trap-precision}
11832 @opindex mtrap-precision
11833 In the Alpha architecture, floating point traps are imprecise. This
11834 means without software assistance it is impossible to recover from a
11835 floating trap and program execution normally needs to be terminated.
11836 GCC can generate code that can assist operating system trap handlers
11837 in determining the exact location that caused a floating point trap.
11838 Depending on the requirements of an application, different levels of
11839 precisions can be selected:
11840
11841 @table @samp
11842 @item p
11843 Program precision. This option is the default and means a trap handler
11844 can only identify which program caused a floating point exception.
11845
11846 @item f
11847 Function precision. The trap handler can determine the function that
11848 caused a floating point exception.
11849
11850 @item i
11851 Instruction precision. The trap handler can determine the exact
11852 instruction that caused a floating point exception.
11853 @end table
11854
11855 Other Alpha compilers provide the equivalent options called
11856 @option{-scope_safe} and @option{-resumption_safe}.
11857
11858 @item -mieee-conformant
11859 @opindex mieee-conformant
11860 This option marks the generated code as IEEE conformant. You must not
11861 use this option unless you also specify @option{-mtrap-precision=i} and either
11862 @option{-mfp-trap-mode=su} or @option{-mfp-trap-mode=sui}. Its only effect
11863 is to emit the line @samp{.eflag 48} in the function prologue of the
11864 generated assembly file. Under DEC Unix, this has the effect that
11865 IEEE-conformant math library routines will be linked in.
11866
11867 @item -mbuild-constants
11868 @opindex mbuild-constants
11869 Normally GCC examines a 32- or 64-bit integer constant to
11870 see if it can construct it from smaller constants in two or three
11871 instructions. If it cannot, it will output the constant as a literal and
11872 generate code to load it from the data segment at runtime.
11873
11874 Use this option to require GCC to construct @emph{all} integer constants
11875 using code, even if it takes more instructions (the maximum is six).
11876
11877 You would typically use this option to build a shared library dynamic
11878 loader. Itself a shared library, it must relocate itself in memory
11879 before it can find the variables and constants in its own data segment.
11880
11881 @item -malpha-as
11882 @itemx -mgas
11883 @opindex malpha-as
11884 @opindex mgas
11885 Select whether to generate code to be assembled by the vendor-supplied
11886 assembler (@option{-malpha-as}) or by the GNU assembler @option{-mgas}.
11887
11888 @item -mbwx
11889 @itemx -mno-bwx
11890 @itemx -mcix
11891 @itemx -mno-cix
11892 @itemx -mfix
11893 @itemx -mno-fix
11894 @itemx -mmax
11895 @itemx -mno-max
11896 @opindex mbwx
11897 @opindex mno-bwx
11898 @opindex mcix
11899 @opindex mno-cix
11900 @opindex mfix
11901 @opindex mno-fix
11902 @opindex mmax
11903 @opindex mno-max
11904 Indicate whether GCC should generate code to use the optional BWX,
11905 CIX, FIX and MAX instruction sets. The default is to use the instruction
11906 sets supported by the CPU type specified via @option{-mcpu=} option or that
11907 of the CPU on which GCC was built if none was specified.
11908
11909 @item -mfloat-vax
11910 @itemx -mfloat-ieee
11911 @opindex mfloat-vax
11912 @opindex mfloat-ieee
11913 Generate code that uses (does not use) VAX F and G floating point
11914 arithmetic instead of IEEE single and double precision.
11915
11916 @item -mexplicit-relocs
11917 @itemx -mno-explicit-relocs
11918 @opindex mexplicit-relocs
11919 @opindex mno-explicit-relocs
11920 Older Alpha assemblers provided no way to generate symbol relocations
11921 except via assembler macros. Use of these macros does not allow
11922 optimal instruction scheduling. GNU binutils as of version 2.12
11923 supports a new syntax that allows the compiler to explicitly mark
11924 which relocations should apply to which instructions. This option
11925 is mostly useful for debugging, as GCC detects the capabilities of
11926 the assembler when it is built and sets the default accordingly.
11927
11928 @item -msmall-data
11929 @itemx -mlarge-data
11930 @opindex msmall-data
11931 @opindex mlarge-data
11932 When @option{-mexplicit-relocs} is in effect, static data is
11933 accessed via @dfn{gp-relative} relocations. When @option{-msmall-data}
11934 is used, objects 8 bytes long or smaller are placed in a @dfn{small data area}
11935 (the @code{.sdata} and @code{.sbss} sections) and are accessed via
11936 16-bit relocations off of the @code{$gp} register. This limits the
11937 size of the small data area to 64KB, but allows the variables to be
11938 directly accessed via a single instruction.
11939
11940 The default is @option{-mlarge-data}. With this option the data area
11941 is limited to just below 2GB@. Programs that require more than 2GB of
11942 data must use @code{malloc} or @code{mmap} to allocate the data in the
11943 heap instead of in the program's data segment.
11944
11945 When generating code for shared libraries, @option{-fpic} implies
11946 @option{-msmall-data} and @option{-fPIC} implies @option{-mlarge-data}.
11947
11948 @item -msmall-text
11949 @itemx -mlarge-text
11950 @opindex msmall-text
11951 @opindex mlarge-text
11952 When @option{-msmall-text} is used, the compiler assumes that the
11953 code of the entire program (or shared library) fits in 4MB, and is
11954 thus reachable with a branch instruction. When @option{-msmall-data}
11955 is used, the compiler can assume that all local symbols share the
11956 same @code{$gp} value, and thus reduce the number of instructions
11957 required for a function call from 4 to 1.
11958
11959 The default is @option{-mlarge-text}.
11960
11961 @item -mcpu=@var{cpu_type}
11962 @opindex mcpu
11963 Set the instruction set and instruction scheduling parameters for
11964 machine type @var{cpu_type}. You can specify either the @samp{EV}
11965 style name or the corresponding chip number. GCC supports scheduling
11966 parameters for the EV4, EV5 and EV6 family of processors and will
11967 choose the default values for the instruction set from the processor
11968 you specify. If you do not specify a processor type, GCC will default
11969 to the processor on which the compiler was built.
11970
11971 Supported values for @var{cpu_type} are
11972
11973 @table @samp
11974 @item ev4
11975 @itemx ev45
11976 @itemx 21064
11977 Schedules as an EV4 and has no instruction set extensions.
11978
11979 @item ev5
11980 @itemx 21164
11981 Schedules as an EV5 and has no instruction set extensions.
11982
11983 @item ev56
11984 @itemx 21164a
11985 Schedules as an EV5 and supports the BWX extension.
11986
11987 @item pca56
11988 @itemx 21164pc
11989 @itemx 21164PC
11990 Schedules as an EV5 and supports the BWX and MAX extensions.
11991
11992 @item ev6
11993 @itemx 21264
11994 Schedules as an EV6 and supports the BWX, FIX, and MAX extensions.
11995
11996 @item ev67
11997 @itemx 21264a
11998 Schedules as an EV6 and supports the BWX, CIX, FIX, and MAX extensions.
11999 @end table
12000
12001 Native toolchains also support the value @samp{native},
12002 which selects the best architecture option for the host processor.
12003 @option{-mcpu=native} has no effect if GCC does not recognize
12004 the processor.
12005
12006 @item -mtune=@var{cpu_type}
12007 @opindex mtune
12008 Set only the instruction scheduling parameters for machine type
12009 @var{cpu_type}. The instruction set is not changed.
12010
12011 Native toolchains also support the value @samp{native},
12012 which selects the best architecture option for the host processor.
12013 @option{-mtune=native} has no effect if GCC does not recognize
12014 the processor.
12015
12016 @item -mmemory-latency=@var{time}
12017 @opindex mmemory-latency
12018 Sets the latency the scheduler should assume for typical memory
12019 references as seen by the application. This number is highly
12020 dependent on the memory access patterns used by the application
12021 and the size of the external cache on the machine.
12022
12023 Valid options for @var{time} are
12024
12025 @table @samp
12026 @item @var{number}
12027 A decimal number representing clock cycles.
12028
12029 @item L1
12030 @itemx L2
12031 @itemx L3
12032 @itemx main
12033 The compiler contains estimates of the number of clock cycles for
12034 ``typical'' EV4 & EV5 hardware for the Level 1, 2 & 3 caches
12035 (also called Dcache, Scache, and Bcache), as well as to main memory.
12036 Note that L3 is only valid for EV5.
12037
12038 @end table
12039 @end table
12040
12041 @node DEC Alpha/VMS Options
12042 @subsection DEC Alpha/VMS Options
12043
12044 These @samp{-m} options are defined for the DEC Alpha/VMS implementations:
12045
12046 @table @gcctabopt
12047 @item -mvms-return-codes
12048 @opindex mvms-return-codes
12049 Return VMS condition codes from main. The default is to return POSIX
12050 style condition (e.g.@: error) codes.
12051
12052 @item -mdebug-main=@var{prefix}
12053 @opindex mdebug-main=@var{prefix}
12054 Flag the first routine whose name starts with @var{prefix} as the main
12055 routine for the debugger.
12056
12057 @item -mmalloc64
12058 @opindex mmalloc64
12059 Default to 64bit memory allocation routines.
12060 @end table
12061
12062 @node FR30 Options
12063 @subsection FR30 Options
12064 @cindex FR30 Options
12065
12066 These options are defined specifically for the FR30 port.
12067
12068 @table @gcctabopt
12069
12070 @item -msmall-model
12071 @opindex msmall-model
12072 Use the small address space model. This can produce smaller code, but
12073 it does assume that all symbolic values and addresses will fit into a
12074 20-bit range.
12075
12076 @item -mno-lsim
12077 @opindex mno-lsim
12078 Assume that run-time support has been provided and so there is no need
12079 to include the simulator library (@file{libsim.a}) on the linker
12080 command line.
12081
12082 @end table
12083
12084 @node FRV Options
12085 @subsection FRV Options
12086 @cindex FRV Options
12087
12088 @table @gcctabopt
12089 @item -mgpr-32
12090 @opindex mgpr-32
12091
12092 Only use the first 32 general purpose registers.
12093
12094 @item -mgpr-64
12095 @opindex mgpr-64
12096
12097 Use all 64 general purpose registers.
12098
12099 @item -mfpr-32
12100 @opindex mfpr-32
12101
12102 Use only the first 32 floating point registers.
12103
12104 @item -mfpr-64
12105 @opindex mfpr-64
12106
12107 Use all 64 floating point registers
12108
12109 @item -mhard-float
12110 @opindex mhard-float
12111
12112 Use hardware instructions for floating point operations.
12113
12114 @item -msoft-float
12115 @opindex msoft-float
12116
12117 Use library routines for floating point operations.
12118
12119 @item -malloc-cc
12120 @opindex malloc-cc
12121
12122 Dynamically allocate condition code registers.
12123
12124 @item -mfixed-cc
12125 @opindex mfixed-cc
12126
12127 Do not try to dynamically allocate condition code registers, only
12128 use @code{icc0} and @code{fcc0}.
12129
12130 @item -mdword
12131 @opindex mdword
12132
12133 Change ABI to use double word insns.
12134
12135 @item -mno-dword
12136 @opindex mno-dword
12137
12138 Do not use double word instructions.
12139
12140 @item -mdouble
12141 @opindex mdouble
12142
12143 Use floating point double instructions.
12144
12145 @item -mno-double
12146 @opindex mno-double
12147
12148 Do not use floating point double instructions.
12149
12150 @item -mmedia
12151 @opindex mmedia
12152
12153 Use media instructions.
12154
12155 @item -mno-media
12156 @opindex mno-media
12157
12158 Do not use media instructions.
12159
12160 @item -mmuladd
12161 @opindex mmuladd
12162
12163 Use multiply and add/subtract instructions.
12164
12165 @item -mno-muladd
12166 @opindex mno-muladd
12167
12168 Do not use multiply and add/subtract instructions.
12169
12170 @item -mfdpic
12171 @opindex mfdpic
12172
12173 Select the FDPIC ABI, that uses function descriptors to represent
12174 pointers to functions. Without any PIC/PIE-related options, it
12175 implies @option{-fPIE}. With @option{-fpic} or @option{-fpie}, it
12176 assumes GOT entries and small data are within a 12-bit range from the
12177 GOT base address; with @option{-fPIC} or @option{-fPIE}, GOT offsets
12178 are computed with 32 bits.
12179 With a @samp{bfin-elf} target, this option implies @option{-msim}.
12180
12181 @item -minline-plt
12182 @opindex minline-plt
12183
12184 Enable inlining of PLT entries in function calls to functions that are
12185 not known to bind locally. It has no effect without @option{-mfdpic}.
12186 It's enabled by default if optimizing for speed and compiling for
12187 shared libraries (i.e., @option{-fPIC} or @option{-fpic}), or when an
12188 optimization option such as @option{-O3} or above is present in the
12189 command line.
12190
12191 @item -mTLS
12192 @opindex mTLS
12193
12194 Assume a large TLS segment when generating thread-local code.
12195
12196 @item -mtls
12197 @opindex mtls
12198
12199 Do not assume a large TLS segment when generating thread-local code.
12200
12201 @item -mgprel-ro
12202 @opindex mgprel-ro
12203
12204 Enable the use of @code{GPREL} relocations in the FDPIC ABI for data
12205 that is known to be in read-only sections. It's enabled by default,
12206 except for @option{-fpic} or @option{-fpie}: even though it may help
12207 make the global offset table smaller, it trades 1 instruction for 4.
12208 With @option{-fPIC} or @option{-fPIE}, it trades 3 instructions for 4,
12209 one of which may be shared by multiple symbols, and it avoids the need
12210 for a GOT entry for the referenced symbol, so it's more likely to be a
12211 win. If it is not, @option{-mno-gprel-ro} can be used to disable it.
12212
12213 @item -multilib-library-pic
12214 @opindex multilib-library-pic
12215
12216 Link with the (library, not FD) pic libraries. It's implied by
12217 @option{-mlibrary-pic}, as well as by @option{-fPIC} and
12218 @option{-fpic} without @option{-mfdpic}. You should never have to use
12219 it explicitly.
12220
12221 @item -mlinked-fp
12222 @opindex mlinked-fp
12223
12224 Follow the EABI requirement of always creating a frame pointer whenever
12225 a stack frame is allocated. This option is enabled by default and can
12226 be disabled with @option{-mno-linked-fp}.
12227
12228 @item -mlong-calls
12229 @opindex mlong-calls
12230
12231 Use indirect addressing to call functions outside the current
12232 compilation unit. This allows the functions to be placed anywhere
12233 within the 32-bit address space.
12234
12235 @item -malign-labels
12236 @opindex malign-labels
12237
12238 Try to align labels to an 8-byte boundary by inserting nops into the
12239 previous packet. This option only has an effect when VLIW packing
12240 is enabled. It doesn't create new packets; it merely adds nops to
12241 existing ones.
12242
12243 @item -mlibrary-pic
12244 @opindex mlibrary-pic
12245
12246 Generate position-independent EABI code.
12247
12248 @item -macc-4
12249 @opindex macc-4
12250
12251 Use only the first four media accumulator registers.
12252
12253 @item -macc-8
12254 @opindex macc-8
12255
12256 Use all eight media accumulator registers.
12257
12258 @item -mpack
12259 @opindex mpack
12260
12261 Pack VLIW instructions.
12262
12263 @item -mno-pack
12264 @opindex mno-pack
12265
12266 Do not pack VLIW instructions.
12267
12268 @item -mno-eflags
12269 @opindex mno-eflags
12270
12271 Do not mark ABI switches in e_flags.
12272
12273 @item -mcond-move
12274 @opindex mcond-move
12275
12276 Enable the use of conditional-move instructions (default).
12277
12278 This switch is mainly for debugging the compiler and will likely be removed
12279 in a future version.
12280
12281 @item -mno-cond-move
12282 @opindex mno-cond-move
12283
12284 Disable the use of conditional-move instructions.
12285
12286 This switch is mainly for debugging the compiler and will likely be removed
12287 in a future version.
12288
12289 @item -mscc
12290 @opindex mscc
12291
12292 Enable the use of conditional set instructions (default).
12293
12294 This switch is mainly for debugging the compiler and will likely be removed
12295 in a future version.
12296
12297 @item -mno-scc
12298 @opindex mno-scc
12299
12300 Disable the use of conditional set instructions.
12301
12302 This switch is mainly for debugging the compiler and will likely be removed
12303 in a future version.
12304
12305 @item -mcond-exec
12306 @opindex mcond-exec
12307
12308 Enable the use of conditional execution (default).
12309
12310 This switch is mainly for debugging the compiler and will likely be removed
12311 in a future version.
12312
12313 @item -mno-cond-exec
12314 @opindex mno-cond-exec
12315
12316 Disable the use of conditional execution.
12317
12318 This switch is mainly for debugging the compiler and will likely be removed
12319 in a future version.
12320
12321 @item -mvliw-branch
12322 @opindex mvliw-branch
12323
12324 Run a pass to pack branches into VLIW instructions (default).
12325
12326 This switch is mainly for debugging the compiler and will likely be removed
12327 in a future version.
12328
12329 @item -mno-vliw-branch
12330 @opindex mno-vliw-branch
12331
12332 Do not run a pass to pack branches into VLIW instructions.
12333
12334 This switch is mainly for debugging the compiler and will likely be removed
12335 in a future version.
12336
12337 @item -mmulti-cond-exec
12338 @opindex mmulti-cond-exec
12339
12340 Enable optimization of @code{&&} and @code{||} in conditional execution
12341 (default).
12342
12343 This switch is mainly for debugging the compiler and will likely be removed
12344 in a future version.
12345
12346 @item -mno-multi-cond-exec
12347 @opindex mno-multi-cond-exec
12348
12349 Disable optimization of @code{&&} and @code{||} in conditional execution.
12350
12351 This switch is mainly for debugging the compiler and will likely be removed
12352 in a future version.
12353
12354 @item -mnested-cond-exec
12355 @opindex mnested-cond-exec
12356
12357 Enable nested conditional execution optimizations (default).
12358
12359 This switch is mainly for debugging the compiler and will likely be removed
12360 in a future version.
12361
12362 @item -mno-nested-cond-exec
12363 @opindex mno-nested-cond-exec
12364
12365 Disable nested conditional execution optimizations.
12366
12367 This switch is mainly for debugging the compiler and will likely be removed
12368 in a future version.
12369
12370 @item -moptimize-membar
12371 @opindex moptimize-membar
12372
12373 This switch removes redundant @code{membar} instructions from the
12374 compiler generated code. It is enabled by default.
12375
12376 @item -mno-optimize-membar
12377 @opindex mno-optimize-membar
12378
12379 This switch disables the automatic removal of redundant @code{membar}
12380 instructions from the generated code.
12381
12382 @item -mtomcat-stats
12383 @opindex mtomcat-stats
12384
12385 Cause gas to print out tomcat statistics.
12386
12387 @item -mcpu=@var{cpu}
12388 @opindex mcpu
12389
12390 Select the processor type for which to generate code. Possible values are
12391 @samp{frv}, @samp{fr550}, @samp{tomcat}, @samp{fr500}, @samp{fr450},
12392 @samp{fr405}, @samp{fr400}, @samp{fr300} and @samp{simple}.
12393
12394 @end table
12395
12396 @node GNU/Linux Options
12397 @subsection GNU/Linux Options
12398
12399 These @samp{-m} options are defined for GNU/Linux targets:
12400
12401 @table @gcctabopt
12402 @item -mglibc
12403 @opindex mglibc
12404 Use the GNU C library. This is the default except
12405 on @samp{*-*-linux-*uclibc*} and @samp{*-*-linux-*android*} targets.
12406
12407 @item -muclibc
12408 @opindex muclibc
12409 Use uClibc C library. This is the default on
12410 @samp{*-*-linux-*uclibc*} targets.
12411
12412 @item -mbionic
12413 @opindex mbionic
12414 Use Bionic C library. This is the default on
12415 @samp{*-*-linux-*android*} targets.
12416
12417 @item -mandroid
12418 @opindex mandroid
12419 Compile code compatible with Android platform. This is the default on
12420 @samp{*-*-linux-*android*} targets.
12421
12422 When compiling, this option enables @option{-mbionic}, @option{-fPIC},
12423 @option{-fno-exceptions} and @option{-fno-rtti} by default. When linking,
12424 this option makes the GCC driver pass Android-specific options to the linker.
12425 Finally, this option causes the preprocessor macro @code{__ANDROID__}
12426 to be defined.
12427
12428 @item -tno-android-cc
12429 @opindex tno-android-cc
12430 Disable compilation effects of @option{-mandroid}, i.e., do not enable
12431 @option{-mbionic}, @option{-fPIC}, @option{-fno-exceptions} and
12432 @option{-fno-rtti} by default.
12433
12434 @item -tno-android-ld
12435 @opindex tno-android-ld
12436 Disable linking effects of @option{-mandroid}, i.e., pass standard Linux
12437 linking options to the linker.
12438
12439 @end table
12440
12441 @node H8/300 Options
12442 @subsection H8/300 Options
12443
12444 These @samp{-m} options are defined for the H8/300 implementations:
12445
12446 @table @gcctabopt
12447 @item -mrelax
12448 @opindex mrelax
12449 Shorten some address references at link time, when possible; uses the
12450 linker option @option{-relax}. @xref{H8/300,, @code{ld} and the H8/300,
12451 ld, Using ld}, for a fuller description.
12452
12453 @item -mh
12454 @opindex mh
12455 Generate code for the H8/300H@.
12456
12457 @item -ms
12458 @opindex ms
12459 Generate code for the H8S@.
12460
12461 @item -mn
12462 @opindex mn
12463 Generate code for the H8S and H8/300H in the normal mode. This switch
12464 must be used either with @option{-mh} or @option{-ms}.
12465
12466 @item -ms2600
12467 @opindex ms2600
12468 Generate code for the H8S/2600. This switch must be used with @option{-ms}.
12469
12470 @item -mint32
12471 @opindex mint32
12472 Make @code{int} data 32 bits by default.
12473
12474 @item -malign-300
12475 @opindex malign-300
12476 On the H8/300H and H8S, use the same alignment rules as for the H8/300.
12477 The default for the H8/300H and H8S is to align longs and floats on 4
12478 byte boundaries.
12479 @option{-malign-300} causes them to be aligned on 2 byte boundaries.
12480 This option has no effect on the H8/300.
12481 @end table
12482
12483 @node HPPA Options
12484 @subsection HPPA Options
12485 @cindex HPPA Options
12486
12487 These @samp{-m} options are defined for the HPPA family of computers:
12488
12489 @table @gcctabopt
12490 @item -march=@var{architecture-type}
12491 @opindex march
12492 Generate code for the specified architecture. The choices for
12493 @var{architecture-type} are @samp{1.0} for PA 1.0, @samp{1.1} for PA
12494 1.1, and @samp{2.0} for PA 2.0 processors. Refer to
12495 @file{/usr/lib/sched.models} on an HP-UX system to determine the proper
12496 architecture option for your machine. Code compiled for lower numbered
12497 architectures will run on higher numbered architectures, but not the
12498 other way around.
12499
12500 @item -mpa-risc-1-0
12501 @itemx -mpa-risc-1-1
12502 @itemx -mpa-risc-2-0
12503 @opindex mpa-risc-1-0
12504 @opindex mpa-risc-1-1
12505 @opindex mpa-risc-2-0
12506 Synonyms for @option{-march=1.0}, @option{-march=1.1}, and @option{-march=2.0} respectively.
12507
12508 @item -mbig-switch
12509 @opindex mbig-switch
12510 Generate code suitable for big switch tables. Use this option only if
12511 the assembler/linker complain about out of range branches within a switch
12512 table.
12513
12514 @item -mjump-in-delay
12515 @opindex mjump-in-delay
12516 Fill delay slots of function calls with unconditional jump instructions
12517 by modifying the return pointer for the function call to be the target
12518 of the conditional jump.
12519
12520 @item -mdisable-fpregs
12521 @opindex mdisable-fpregs
12522 Prevent floating point registers from being used in any manner. This is
12523 necessary for compiling kernels which perform lazy context switching of
12524 floating point registers. If you use this option and attempt to perform
12525 floating point operations, the compiler will abort.
12526
12527 @item -mdisable-indexing
12528 @opindex mdisable-indexing
12529 Prevent the compiler from using indexing address modes. This avoids some
12530 rather obscure problems when compiling MIG generated code under MACH@.
12531
12532 @item -mno-space-regs
12533 @opindex mno-space-regs
12534 Generate code that assumes the target has no space registers. This allows
12535 GCC to generate faster indirect calls and use unscaled index address modes.
12536
12537 Such code is suitable for level 0 PA systems and kernels.
12538
12539 @item -mfast-indirect-calls
12540 @opindex mfast-indirect-calls
12541 Generate code that assumes calls never cross space boundaries. This
12542 allows GCC to emit code which performs faster indirect calls.
12543
12544 This option will not work in the presence of shared libraries or nested
12545 functions.
12546
12547 @item -mfixed-range=@var{register-range}
12548 @opindex mfixed-range
12549 Generate code treating the given register range as fixed registers.
12550 A fixed register is one that the register allocator can not use. This is
12551 useful when compiling kernel code. A register range is specified as
12552 two registers separated by a dash. Multiple register ranges can be
12553 specified separated by a comma.
12554
12555 @item -mlong-load-store
12556 @opindex mlong-load-store
12557 Generate 3-instruction load and store sequences as sometimes required by
12558 the HP-UX 10 linker. This is equivalent to the @samp{+k} option to
12559 the HP compilers.
12560
12561 @item -mportable-runtime
12562 @opindex mportable-runtime
12563 Use the portable calling conventions proposed by HP for ELF systems.
12564
12565 @item -mgas
12566 @opindex mgas
12567 Enable the use of assembler directives only GAS understands.
12568
12569 @item -mschedule=@var{cpu-type}
12570 @opindex mschedule
12571 Schedule code according to the constraints for the machine type
12572 @var{cpu-type}. The choices for @var{cpu-type} are @samp{700}
12573 @samp{7100}, @samp{7100LC}, @samp{7200}, @samp{7300} and @samp{8000}. Refer
12574 to @file{/usr/lib/sched.models} on an HP-UX system to determine the
12575 proper scheduling option for your machine. The default scheduling is
12576 @samp{8000}.
12577
12578 @item -mlinker-opt
12579 @opindex mlinker-opt
12580 Enable the optimization pass in the HP-UX linker. Note this makes symbolic
12581 debugging impossible. It also triggers a bug in the HP-UX 8 and HP-UX 9
12582 linkers in which they give bogus error messages when linking some programs.
12583
12584 @item -msoft-float
12585 @opindex msoft-float
12586 Generate output containing library calls for floating point.
12587 @strong{Warning:} the requisite libraries are not available for all HPPA
12588 targets. Normally the facilities of the machine's usual C compiler are
12589 used, but this cannot be done directly in cross-compilation. You must make
12590 your own arrangements to provide suitable library functions for
12591 cross-compilation.
12592
12593 @option{-msoft-float} changes the calling convention in the output file;
12594 therefore, it is only useful if you compile @emph{all} of a program with
12595 this option. In particular, you need to compile @file{libgcc.a}, the
12596 library that comes with GCC, with @option{-msoft-float} in order for
12597 this to work.
12598
12599 @item -msio
12600 @opindex msio
12601 Generate the predefine, @code{_SIO}, for server IO@. The default is
12602 @option{-mwsio}. This generates the predefines, @code{__hp9000s700},
12603 @code{__hp9000s700__} and @code{_WSIO}, for workstation IO@. These
12604 options are available under HP-UX and HI-UX@.
12605
12606 @item -mgnu-ld
12607 @opindex mgnu-ld
12608 Use GNU ld specific options. This passes @option{-shared} to ld when
12609 building a shared library. It is the default when GCC is configured,
12610 explicitly or implicitly, with the GNU linker. This option does not
12611 have any affect on which ld is called, it only changes what parameters
12612 are passed to that ld. The ld that is called is determined by the
12613 @option{--with-ld} configure option, GCC's program search path, and
12614 finally by the user's @env{PATH}. The linker used by GCC can be printed
12615 using @samp{which `gcc -print-prog-name=ld`}. This option is only available
12616 on the 64 bit HP-UX GCC, i.e.@: configured with @samp{hppa*64*-*-hpux*}.
12617
12618 @item -mhp-ld
12619 @opindex mhp-ld
12620 Use HP ld specific options. This passes @option{-b} to ld when building
12621 a shared library and passes @option{+Accept TypeMismatch} to ld on all
12622 links. It is the default when GCC is configured, explicitly or
12623 implicitly, with the HP linker. This option does not have any affect on
12624 which ld is called, it only changes what parameters are passed to that
12625 ld. The ld that is called is determined by the @option{--with-ld}
12626 configure option, GCC's program search path, and finally by the user's
12627 @env{PATH}. The linker used by GCC can be printed using @samp{which
12628 `gcc -print-prog-name=ld`}. This option is only available on the 64 bit
12629 HP-UX GCC, i.e.@: configured with @samp{hppa*64*-*-hpux*}.
12630
12631 @item -mlong-calls
12632 @opindex mno-long-calls
12633 Generate code that uses long call sequences. This ensures that a call
12634 is always able to reach linker generated stubs. The default is to generate
12635 long calls only when the distance from the call site to the beginning
12636 of the function or translation unit, as the case may be, exceeds a
12637 predefined limit set by the branch type being used. The limits for
12638 normal calls are 7,600,000 and 240,000 bytes, respectively for the
12639 PA 2.0 and PA 1.X architectures. Sibcalls are always limited at
12640 240,000 bytes.
12641
12642 Distances are measured from the beginning of functions when using the
12643 @option{-ffunction-sections} option, or when using the @option{-mgas}
12644 and @option{-mno-portable-runtime} options together under HP-UX with
12645 the SOM linker.
12646
12647 It is normally not desirable to use this option as it will degrade
12648 performance. However, it may be useful in large applications,
12649 particularly when partial linking is used to build the application.
12650
12651 The types of long calls used depends on the capabilities of the
12652 assembler and linker, and the type of code being generated. The
12653 impact on systems that support long absolute calls, and long pic
12654 symbol-difference or pc-relative calls should be relatively small.
12655 However, an indirect call is used on 32-bit ELF systems in pic code
12656 and it is quite long.
12657
12658 @item -munix=@var{unix-std}
12659 @opindex march
12660 Generate compiler predefines and select a startfile for the specified
12661 UNIX standard. The choices for @var{unix-std} are @samp{93}, @samp{95}
12662 and @samp{98}. @samp{93} is supported on all HP-UX versions. @samp{95}
12663 is available on HP-UX 10.10 and later. @samp{98} is available on HP-UX
12664 11.11 and later. The default values are @samp{93} for HP-UX 10.00,
12665 @samp{95} for HP-UX 10.10 though to 11.00, and @samp{98} for HP-UX 11.11
12666 and later.
12667
12668 @option{-munix=93} provides the same predefines as GCC 3.3 and 3.4.
12669 @option{-munix=95} provides additional predefines for @code{XOPEN_UNIX}
12670 and @code{_XOPEN_SOURCE_EXTENDED}, and the startfile @file{unix95.o}.
12671 @option{-munix=98} provides additional predefines for @code{_XOPEN_UNIX},
12672 @code{_XOPEN_SOURCE_EXTENDED}, @code{_INCLUDE__STDC_A1_SOURCE} and
12673 @code{_INCLUDE_XOPEN_SOURCE_500}, and the startfile @file{unix98.o}.
12674
12675 It is @emph{important} to note that this option changes the interfaces
12676 for various library routines. It also affects the operational behavior
12677 of the C library. Thus, @emph{extreme} care is needed in using this
12678 option.
12679
12680 Library code that is intended to operate with more than one UNIX
12681 standard must test, set and restore the variable @var{__xpg4_extended_mask}
12682 as appropriate. Most GNU software doesn't provide this capability.
12683
12684 @item -nolibdld
12685 @opindex nolibdld
12686 Suppress the generation of link options to search libdld.sl when the
12687 @option{-static} option is specified on HP-UX 10 and later.
12688
12689 @item -static
12690 @opindex static
12691 The HP-UX implementation of setlocale in libc has a dependency on
12692 libdld.sl. There isn't an archive version of libdld.sl. Thus,
12693 when the @option{-static} option is specified, special link options
12694 are needed to resolve this dependency.
12695
12696 On HP-UX 10 and later, the GCC driver adds the necessary options to
12697 link with libdld.sl when the @option{-static} option is specified.
12698 This causes the resulting binary to be dynamic. On the 64-bit port,
12699 the linkers generate dynamic binaries by default in any case. The
12700 @option{-nolibdld} option can be used to prevent the GCC driver from
12701 adding these link options.
12702
12703 @item -threads
12704 @opindex threads
12705 Add support for multithreading with the @dfn{dce thread} library
12706 under HP-UX@. This option sets flags for both the preprocessor and
12707 linker.
12708 @end table
12709
12710 @node i386 and x86-64 Options
12711 @subsection Intel 386 and AMD x86-64 Options
12712 @cindex i386 Options
12713 @cindex x86-64 Options
12714 @cindex Intel 386 Options
12715 @cindex AMD x86-64 Options
12716
12717 These @samp{-m} options are defined for the i386 and x86-64 family of
12718 computers:
12719
12720 @table @gcctabopt
12721 @item -mtune=@var{cpu-type}
12722 @opindex mtune
12723 Tune to @var{cpu-type} everything applicable about the generated code, except
12724 for the ABI and the set of available instructions. The choices for
12725 @var{cpu-type} are:
12726 @table @emph
12727 @item generic
12728 Produce code optimized for the most common IA32/@/AMD64/@/EM64T processors.
12729 If you know the CPU on which your code will run, then you should use
12730 the corresponding @option{-mtune} option instead of
12731 @option{-mtune=generic}. But, if you do not know exactly what CPU users
12732 of your application will have, then you should use this option.
12733
12734 As new processors are deployed in the marketplace, the behavior of this
12735 option will change. Therefore, if you upgrade to a newer version of
12736 GCC, the code generated option will change to reflect the processors
12737 that were most common when that version of GCC was released.
12738
12739 There is no @option{-march=generic} option because @option{-march}
12740 indicates the instruction set the compiler can use, and there is no
12741 generic instruction set applicable to all processors. In contrast,
12742 @option{-mtune} indicates the processor (or, in this case, collection of
12743 processors) for which the code is optimized.
12744 @item native
12745 This selects the CPU to tune for at compilation time by determining
12746 the processor type of the compiling machine. Using @option{-mtune=native}
12747 will produce code optimized for the local machine under the constraints
12748 of the selected instruction set. Using @option{-march=native} will
12749 enable all instruction subsets supported by the local machine (hence
12750 the result might not run on different machines).
12751 @item i386
12752 Original Intel's i386 CPU@.
12753 @item i486
12754 Intel's i486 CPU@. (No scheduling is implemented for this chip.)
12755 @item i586, pentium
12756 Intel Pentium CPU with no MMX support.
12757 @item pentium-mmx
12758 Intel PentiumMMX CPU based on Pentium core with MMX instruction set support.
12759 @item pentiumpro
12760 Intel PentiumPro CPU@.
12761 @item i686
12762 Same as @code{generic}, but when used as @code{march} option, PentiumPro
12763 instruction set will be used, so the code will run on all i686 family chips.
12764 @item pentium2
12765 Intel Pentium2 CPU based on PentiumPro core with MMX instruction set support.
12766 @item pentium3, pentium3m
12767 Intel Pentium3 CPU based on PentiumPro core with MMX and SSE instruction set
12768 support.
12769 @item pentium-m
12770 Low power version of Intel Pentium3 CPU with MMX, SSE and SSE2 instruction set
12771 support. Used by Centrino notebooks.
12772 @item pentium4, pentium4m
12773 Intel Pentium4 CPU with MMX, SSE and SSE2 instruction set support.
12774 @item prescott
12775 Improved version of Intel Pentium4 CPU with MMX, SSE, SSE2 and SSE3 instruction
12776 set support.
12777 @item nocona
12778 Improved version of Intel Pentium4 CPU with 64-bit extensions, MMX, SSE,
12779 SSE2 and SSE3 instruction set support.
12780 @item core2
12781 Intel Core2 CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3 and SSSE3
12782 instruction set support.
12783 @item corei7
12784 Intel Core i7 CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1
12785 and SSE4.2 instruction set support.
12786 @item corei7-avx
12787 Intel Core i7 CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
12788 SSE4.1, SSE4.2, AVX, AES and PCLMUL instruction set support.
12789 @item core-avx-i
12790 Intel Core CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
12791 SSE4.1, SSE4.2, AVX, AES, PCLMUL, FSGSBASE, RDRND and F16C instruction
12792 set support.
12793 @item atom
12794 Intel Atom CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3 and SSSE3
12795 instruction set support.
12796 @item k6
12797 AMD K6 CPU with MMX instruction set support.
12798 @item k6-2, k6-3
12799 Improved versions of AMD K6 CPU with MMX and 3DNow!@: instruction set support.
12800 @item athlon, athlon-tbird
12801 AMD Athlon CPU with MMX, 3dNOW!, enhanced 3DNow!@: and SSE prefetch instructions
12802 support.
12803 @item athlon-4, athlon-xp, athlon-mp
12804 Improved AMD Athlon CPU with MMX, 3DNow!, enhanced 3DNow!@: and full SSE
12805 instruction set support.
12806 @item k8, opteron, athlon64, athlon-fx
12807 AMD K8 core based CPUs with x86-64 instruction set support. (This supersets
12808 MMX, SSE, SSE2, 3DNow!, enhanced 3DNow!@: and 64-bit instruction set extensions.)
12809 @item k8-sse3, opteron-sse3, athlon64-sse3
12810 Improved versions of k8, opteron and athlon64 with SSE3 instruction set support.
12811 @item amdfam10, barcelona
12812 AMD Family 10h core based CPUs with x86-64 instruction set support. (This
12813 supersets MMX, SSE, SSE2, SSE3, SSE4A, 3DNow!, enhanced 3DNow!, ABM and 64-bit
12814 instruction set extensions.)
12815 @item bdver1
12816 AMD Family 15h core based CPUs with x86-64 instruction set support. (This
12817 supersets FMA4, AVX, XOP, LWP, AES, PCL_MUL, CX16, MMX, SSE, SSE2, SSE3, SSE4A,
12818 SSSE3, SSE4.1, SSE4.2, 3DNow!, enhanced 3DNow!, ABM and 64-bit
12819 instruction set extensions.)
12820 @item btver1
12821 AMD Family 14h core based CPUs with x86-64 instruction set support. (This
12822 supersets MMX, SSE, SSE2, SSE3, SSSE3, SSE4A, CX16, ABM and 64-bit
12823 instruction set extensions.)
12824 @item winchip-c6
12825 IDT Winchip C6 CPU, dealt in same way as i486 with additional MMX instruction
12826 set support.
12827 @item winchip2
12828 IDT Winchip2 CPU, dealt in same way as i486 with additional MMX and 3DNow!@:
12829 instruction set support.
12830 @item c3
12831 Via C3 CPU with MMX and 3DNow!@: instruction set support. (No scheduling is
12832 implemented for this chip.)
12833 @item c3-2
12834 Via C3-2 CPU with MMX and SSE instruction set support. (No scheduling is
12835 implemented for this chip.)
12836 @item geode
12837 Embedded AMD CPU with MMX and 3DNow!@: instruction set support.
12838 @end table
12839
12840 While picking a specific @var{cpu-type} will schedule things appropriately
12841 for that particular chip, the compiler will not generate any code that
12842 does not run on the i386 without the @option{-march=@var{cpu-type}} option
12843 being used.
12844
12845 @item -march=@var{cpu-type}
12846 @opindex march
12847 Generate instructions for the machine type @var{cpu-type}. The choices
12848 for @var{cpu-type} are the same as for @option{-mtune}. Moreover,
12849 specifying @option{-march=@var{cpu-type}} implies @option{-mtune=@var{cpu-type}}.
12850
12851 @item -mcpu=@var{cpu-type}
12852 @opindex mcpu
12853 A deprecated synonym for @option{-mtune}.
12854
12855 @item -mfpmath=@var{unit}
12856 @opindex mfpmath
12857 Generate floating point arithmetics for selected unit @var{unit}. The choices
12858 for @var{unit} are:
12859
12860 @table @samp
12861 @item 387
12862 Use the standard 387 floating point coprocessor present majority of chips and
12863 emulated otherwise. Code compiled with this option will run almost everywhere.
12864 The temporary results are computed in 80bit precision instead of precision
12865 specified by the type resulting in slightly different results compared to most
12866 of other chips. See @option{-ffloat-store} for more detailed description.
12867
12868 This is the default choice for i386 compiler.
12869
12870 @item sse
12871 Use scalar floating point instructions present in the SSE instruction set.
12872 This instruction set is supported by Pentium3 and newer chips, in the AMD line
12873 by Athlon-4, Athlon-xp and Athlon-mp chips. The earlier version of SSE
12874 instruction set supports only single precision arithmetics, thus the double and
12875 extended precision arithmetics is still done using 387. Later version, present
12876 only in Pentium4 and the future AMD x86-64 chips supports double precision
12877 arithmetics too.
12878
12879 For the i386 compiler, you need to use @option{-march=@var{cpu-type}}, @option{-msse}
12880 or @option{-msse2} switches to enable SSE extensions and make this option
12881 effective. For the x86-64 compiler, these extensions are enabled by default.
12882
12883 The resulting code should be considerably faster in the majority of cases and avoid
12884 the numerical instability problems of 387 code, but may break some existing
12885 code that expects temporaries to be 80bit.
12886
12887 This is the default choice for the x86-64 compiler.
12888
12889 @item sse,387
12890 @itemx sse+387
12891 @itemx both
12892 Attempt to utilize both instruction sets at once. This effectively double the
12893 amount of available registers and on chips with separate execution units for
12894 387 and SSE the execution resources too. Use this option with care, as it is
12895 still experimental, because the GCC register allocator does not model separate
12896 functional units well resulting in instable performance.
12897 @end table
12898
12899 @item -masm=@var{dialect}
12900 @opindex masm=@var{dialect}
12901 Output asm instructions using selected @var{dialect}. Supported
12902 choices are @samp{intel} or @samp{att} (the default one). Darwin does
12903 not support @samp{intel}.
12904
12905 @item -mieee-fp
12906 @itemx -mno-ieee-fp
12907 @opindex mieee-fp
12908 @opindex mno-ieee-fp
12909 Control whether or not the compiler uses IEEE floating point
12910 comparisons. These handle correctly the case where the result of a
12911 comparison is unordered.
12912
12913 @item -msoft-float
12914 @opindex msoft-float
12915 Generate output containing library calls for floating point.
12916 @strong{Warning:} the requisite libraries are not part of GCC@.
12917 Normally the facilities of the machine's usual C compiler are used, but
12918 this can't be done directly in cross-compilation. You must make your
12919 own arrangements to provide suitable library functions for
12920 cross-compilation.
12921
12922 On machines where a function returns floating point results in the 80387
12923 register stack, some floating point opcodes may be emitted even if
12924 @option{-msoft-float} is used.
12925
12926 @item -mno-fp-ret-in-387
12927 @opindex mno-fp-ret-in-387
12928 Do not use the FPU registers for return values of functions.
12929
12930 The usual calling convention has functions return values of types
12931 @code{float} and @code{double} in an FPU register, even if there
12932 is no FPU@. The idea is that the operating system should emulate
12933 an FPU@.
12934
12935 The option @option{-mno-fp-ret-in-387} causes such values to be returned
12936 in ordinary CPU registers instead.
12937
12938 @item -mno-fancy-math-387
12939 @opindex mno-fancy-math-387
12940 Some 387 emulators do not support the @code{sin}, @code{cos} and
12941 @code{sqrt} instructions for the 387. Specify this option to avoid
12942 generating those instructions. This option is the default on FreeBSD,
12943 OpenBSD and NetBSD@. This option is overridden when @option{-march}
12944 indicates that the target CPU will always have an FPU and so the
12945 instruction will not need emulation. As of revision 2.6.1, these
12946 instructions are not generated unless you also use the
12947 @option{-funsafe-math-optimizations} switch.
12948
12949 @item -malign-double
12950 @itemx -mno-align-double
12951 @opindex malign-double
12952 @opindex mno-align-double
12953 Control whether GCC aligns @code{double}, @code{long double}, and
12954 @code{long long} variables on a two word boundary or a one word
12955 boundary. Aligning @code{double} variables on a two word boundary will
12956 produce code that runs somewhat faster on a @samp{Pentium} at the
12957 expense of more memory.
12958
12959 On x86-64, @option{-malign-double} is enabled by default.
12960
12961 @strong{Warning:} if you use the @option{-malign-double} switch,
12962 structures containing the above types will be aligned differently than
12963 the published application binary interface specifications for the 386
12964 and will not be binary compatible with structures in code compiled
12965 without that switch.
12966
12967 @item -m96bit-long-double
12968 @itemx -m128bit-long-double
12969 @opindex m96bit-long-double
12970 @opindex m128bit-long-double
12971 These switches control the size of @code{long double} type. The i386
12972 application binary interface specifies the size to be 96 bits,
12973 so @option{-m96bit-long-double} is the default in 32 bit mode.
12974
12975 Modern architectures (Pentium and newer) would prefer @code{long double}
12976 to be aligned to an 8 or 16 byte boundary. In arrays or structures
12977 conforming to the ABI, this would not be possible. So specifying a
12978 @option{-m128bit-long-double} will align @code{long double}
12979 to a 16 byte boundary by padding the @code{long double} with an additional
12980 32 bit zero.
12981
12982 In the x86-64 compiler, @option{-m128bit-long-double} is the default choice as
12983 its ABI specifies that @code{long double} is to be aligned on 16 byte boundary.
12984
12985 Notice that neither of these options enable any extra precision over the x87
12986 standard of 80 bits for a @code{long double}.
12987
12988 @strong{Warning:} if you override the default value for your target ABI, the
12989 structures and arrays containing @code{long double} variables will change
12990 their size as well as function calling convention for function taking
12991 @code{long double} will be modified. Hence they will not be binary
12992 compatible with arrays or structures in code compiled without that switch.
12993
12994 @item -mlarge-data-threshold=@var{number}
12995 @opindex mlarge-data-threshold=@var{number}
12996 When @option{-mcmodel=medium} is specified, the data greater than
12997 @var{threshold} are placed in large data section. This value must be the
12998 same across all object linked into the binary and defaults to 65535.
12999
13000 @item -mrtd
13001 @opindex mrtd
13002 Use a different function-calling convention, in which functions that
13003 take a fixed number of arguments return with the @code{ret} @var{num}
13004 instruction, which pops their arguments while returning. This saves one
13005 instruction in the caller since there is no need to pop the arguments
13006 there.
13007
13008 You can specify that an individual function is called with this calling
13009 sequence with the function attribute @samp{stdcall}. You can also
13010 override the @option{-mrtd} option by using the function attribute
13011 @samp{cdecl}. @xref{Function Attributes}.
13012
13013 @strong{Warning:} this calling convention is incompatible with the one
13014 normally used on Unix, so you cannot use it if you need to call
13015 libraries compiled with the Unix compiler.
13016
13017 Also, you must provide function prototypes for all functions that
13018 take variable numbers of arguments (including @code{printf});
13019 otherwise incorrect code will be generated for calls to those
13020 functions.
13021
13022 In addition, seriously incorrect code will result if you call a
13023 function with too many arguments. (Normally, extra arguments are
13024 harmlessly ignored.)
13025
13026 @item -mregparm=@var{num}
13027 @opindex mregparm
13028 Control how many registers are used to pass integer arguments. By
13029 default, no registers are used to pass arguments, and at most 3
13030 registers can be used. You can control this behavior for a specific
13031 function by using the function attribute @samp{regparm}.
13032 @xref{Function Attributes}.
13033
13034 @strong{Warning:} if you use this switch, and
13035 @var{num} is nonzero, then you must build all modules with the same
13036 value, including any libraries. This includes the system libraries and
13037 startup modules.
13038
13039 @item -msseregparm
13040 @opindex msseregparm
13041 Use SSE register passing conventions for float and double arguments
13042 and return values. You can control this behavior for a specific
13043 function by using the function attribute @samp{sseregparm}.
13044 @xref{Function Attributes}.
13045
13046 @strong{Warning:} if you use this switch then you must build all
13047 modules with the same value, including any libraries. This includes
13048 the system libraries and startup modules.
13049
13050 @item -mvect8-ret-in-mem
13051 @opindex mvect8-ret-in-mem
13052 Return 8-byte vectors in memory instead of MMX registers. This is the
13053 default on Solaris@tie{}8 and 9 and VxWorks to match the ABI of the Sun
13054 Studio compilers until version 12. Later compiler versions (starting
13055 with Studio 12 Update@tie{}1) follow the ABI used by other x86 targets, which
13056 is the default on Solaris@tie{}10 and later. @emph{Only} use this option if
13057 you need to remain compatible with existing code produced by those
13058 previous compiler versions or older versions of GCC.
13059
13060 @item -mpc32
13061 @itemx -mpc64
13062 @itemx -mpc80
13063 @opindex mpc32
13064 @opindex mpc64
13065 @opindex mpc80
13066
13067 Set 80387 floating-point precision to 32, 64 or 80 bits. When @option{-mpc32}
13068 is specified, the significands of results of floating-point operations are
13069 rounded to 24 bits (single precision); @option{-mpc64} rounds the
13070 significands of results of floating-point operations to 53 bits (double
13071 precision) and @option{-mpc80} rounds the significands of results of
13072 floating-point operations to 64 bits (extended double precision), which is
13073 the default. When this option is used, floating-point operations in higher
13074 precisions are not available to the programmer without setting the FPU
13075 control word explicitly.
13076
13077 Setting the rounding of floating-point operations to less than the default
13078 80 bits can speed some programs by 2% or more. Note that some mathematical
13079 libraries assume that extended precision (80 bit) floating-point operations
13080 are enabled by default; routines in such libraries could suffer significant
13081 loss of accuracy, typically through so-called "catastrophic cancellation",
13082 when this option is used to set the precision to less than extended precision.
13083
13084 @item -mstackrealign
13085 @opindex mstackrealign
13086 Realign the stack at entry. On the Intel x86, the @option{-mstackrealign}
13087 option will generate an alternate prologue and epilogue that realigns the
13088 runtime stack if necessary. This supports mixing legacy codes that keep
13089 a 4-byte aligned stack with modern codes that keep a 16-byte stack for
13090 SSE compatibility. See also the attribute @code{force_align_arg_pointer},
13091 applicable to individual functions.
13092
13093 @item -mpreferred-stack-boundary=@var{num}
13094 @opindex mpreferred-stack-boundary
13095 Attempt to keep the stack boundary aligned to a 2 raised to @var{num}
13096 byte boundary. If @option{-mpreferred-stack-boundary} is not specified,
13097 the default is 4 (16 bytes or 128 bits).
13098
13099 @item -mincoming-stack-boundary=@var{num}
13100 @opindex mincoming-stack-boundary
13101 Assume the incoming stack is aligned to a 2 raised to @var{num} byte
13102 boundary. If @option{-mincoming-stack-boundary} is not specified,
13103 the one specified by @option{-mpreferred-stack-boundary} will be used.
13104
13105 On Pentium and PentiumPro, @code{double} and @code{long double} values
13106 should be aligned to an 8 byte boundary (see @option{-malign-double}) or
13107 suffer significant run time performance penalties. On Pentium III, the
13108 Streaming SIMD Extension (SSE) data type @code{__m128} may not work
13109 properly if it is not 16 byte aligned.
13110
13111 To ensure proper alignment of this values on the stack, the stack boundary
13112 must be as aligned as that required by any value stored on the stack.
13113 Further, every function must be generated such that it keeps the stack
13114 aligned. Thus calling a function compiled with a higher preferred
13115 stack boundary from a function compiled with a lower preferred stack
13116 boundary will most likely misalign the stack. It is recommended that
13117 libraries that use callbacks always use the default setting.
13118
13119 This extra alignment does consume extra stack space, and generally
13120 increases code size. Code that is sensitive to stack space usage, such
13121 as embedded systems and operating system kernels, may want to reduce the
13122 preferred alignment to @option{-mpreferred-stack-boundary=2}.
13123
13124 @item -mmmx
13125 @itemx -mno-mmx
13126 @itemx -msse
13127 @itemx -mno-sse
13128 @itemx -msse2
13129 @itemx -mno-sse2
13130 @itemx -msse3
13131 @itemx -mno-sse3
13132 @itemx -mssse3
13133 @itemx -mno-ssse3
13134 @itemx -msse4.1
13135 @need 800
13136 @itemx -mno-sse4.1
13137 @itemx -msse4.2
13138 @itemx -mno-sse4.2
13139 @itemx -msse4
13140 @itemx -mno-sse4
13141 @itemx -mavx
13142 @itemx -mno-avx
13143 @itemx -mavx2
13144 @itemx -mno-avx2
13145 @itemx -maes
13146 @itemx -mno-aes
13147 @itemx -mpclmul
13148 @need 800
13149 @itemx -mno-pclmul
13150 @itemx -mfsgsbase
13151 @itemx -mno-fsgsbase
13152 @itemx -mrdrnd
13153 @itemx -mno-rdrnd
13154 @itemx -mf16c
13155 @itemx -mno-f16c
13156 @itemx -mfma
13157 @itemx -mno-fma
13158 @itemx -msse4a
13159 @itemx -mno-sse4a
13160 @itemx -mfma4
13161 @need 800
13162 @itemx -mno-fma4
13163 @itemx -mxop
13164 @itemx -mno-xop
13165 @itemx -mlwp
13166 @itemx -mno-lwp
13167 @itemx -m3dnow
13168 @itemx -mno-3dnow
13169 @itemx -mpopcnt
13170 @itemx -mno-popcnt
13171 @itemx -mabm
13172 @itemx -mno-abm
13173 @itemx -mbmi
13174 @itemx -mbmi2
13175 @itemx -mno-bmi
13176 @itemx -mno-bmi2
13177 @itemx -mlzcnt
13178 @itemx -mno-lzcnt
13179 @itemx -mtbm
13180 @itemx -mno-tbm
13181 @opindex mmmx
13182 @opindex mno-mmx
13183 @opindex msse
13184 @opindex mno-sse
13185 @opindex m3dnow
13186 @opindex mno-3dnow
13187 These switches enable or disable the use of instructions in the MMX, SSE,
13188 SSE2, SSE3, SSSE3, SSE4.1, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, F16C,
13189 FMA, SSE4A, FMA4, XOP, LWP, ABM, BMI, BMI2, LZCNT or 3DNow!
13190 @: extended instruction sets.
13191 These extensions are also available as built-in functions: see
13192 @ref{X86 Built-in Functions}, for details of the functions enabled and
13193 disabled by these switches.
13194
13195 To have SSE/SSE2 instructions generated automatically from floating-point
13196 code (as opposed to 387 instructions), see @option{-mfpmath=sse}.
13197
13198 GCC depresses SSEx instructions when @option{-mavx} is used. Instead, it
13199 generates new AVX instructions or AVX equivalence for all SSEx instructions
13200 when needed.
13201
13202 These options will enable GCC to use these extended instructions in
13203 generated code, even without @option{-mfpmath=sse}. Applications which
13204 perform runtime CPU detection must compile separate files for each
13205 supported architecture, using the appropriate flags. In particular,
13206 the file containing the CPU detection code should be compiled without
13207 these options.
13208
13209 @item -mcld
13210 @opindex mcld
13211 This option instructs GCC to emit a @code{cld} instruction in the prologue
13212 of functions that use string instructions. String instructions depend on
13213 the DF flag to select between autoincrement or autodecrement mode. While the
13214 ABI specifies the DF flag to be cleared on function entry, some operating
13215 systems violate this specification by not clearing the DF flag in their
13216 exception dispatchers. The exception handler can be invoked with the DF flag
13217 set which leads to wrong direction mode, when string instructions are used.
13218 This option can be enabled by default on 32-bit x86 targets by configuring
13219 GCC with the @option{--enable-cld} configure option. Generation of @code{cld}
13220 instructions can be suppressed with the @option{-mno-cld} compiler option
13221 in this case.
13222
13223 @item -mvzeroupper
13224 @opindex mvzeroupper
13225 This option instructs GCC to emit a @code{vzeroupper} instruction
13226 before a transfer of control flow out of the function to minimize
13227 AVX to SSE transition penalty as well as remove unnecessary zeroupper
13228 intrinsics.
13229
13230 @item -mcx16
13231 @opindex mcx16
13232 This option will enable GCC to use CMPXCHG16B instruction in generated code.
13233 CMPXCHG16B allows for atomic operations on 128-bit double quadword (or oword)
13234 data types. This is useful for high resolution counters that could be updated
13235 by multiple processors (or cores). This instruction is generated as part of
13236 atomic built-in functions: see @ref{__sync Builtins} or
13237 @ref{__atomic Builtins} for details.
13238
13239 @item -msahf
13240 @opindex msahf
13241 This option will enable GCC to use SAHF instruction in generated 64-bit code.
13242 Early Intel CPUs with Intel 64 lacked LAHF and SAHF instructions supported
13243 by AMD64 until introduction of Pentium 4 G1 step in December 2005. LAHF and
13244 SAHF are load and store instructions, respectively, for certain status flags.
13245 In 64-bit mode, SAHF instruction is used to optimize @code{fmod}, @code{drem}
13246 or @code{remainder} built-in functions: see @ref{Other Builtins} for details.
13247
13248 @item -mmovbe
13249 @opindex mmovbe
13250 This option will enable GCC to use movbe instruction to implement
13251 @code{__builtin_bswap32} and @code{__builtin_bswap64}.
13252
13253 @item -mcrc32
13254 @opindex mcrc32
13255 This option will enable built-in functions, @code{__builtin_ia32_crc32qi},
13256 @code{__builtin_ia32_crc32hi}. @code{__builtin_ia32_crc32si} and
13257 @code{__builtin_ia32_crc32di} to generate the crc32 machine instruction.
13258
13259 @item -mrecip
13260 @opindex mrecip
13261 This option will enable GCC to use RCPSS and RSQRTSS instructions (and their
13262 vectorized variants RCPPS and RSQRTPS) with an additional Newton-Raphson step
13263 to increase precision instead of DIVSS and SQRTSS (and their vectorized
13264 variants) for single precision floating point arguments. These instructions
13265 are generated only when @option{-funsafe-math-optimizations} is enabled
13266 together with @option{-finite-math-only} and @option{-fno-trapping-math}.
13267 Note that while the throughput of the sequence is higher than the throughput
13268 of the non-reciprocal instruction, the precision of the sequence can be
13269 decreased by up to 2 ulp (i.e. the inverse of 1.0 equals 0.99999994).
13270
13271 Note that GCC implements @code{1.0f/sqrtf(@var{x})} in terms of RSQRTSS
13272 (or RSQRTPS) already with @option{-ffast-math} (or the above option
13273 combination), and doesn't need @option{-mrecip}.
13274
13275 Also note that GCC emits the above sequence with additional Newton-Raphson step
13276 for vectorized single float division and vectorized @code{sqrtf(@var{x})}
13277 already with @option{-ffast-math} (or the above option combination), and
13278 doesn't need @option{-mrecip}.
13279
13280 @item -mrecip=@var{opt}
13281 @opindex mrecip=opt
13282 This option allows to control which reciprocal estimate instructions
13283 may be used. @var{opt} is a comma separated list of options, that may
13284 be preceded by a @code{!} to invert the option:
13285 @code{all}: enable all estimate instructions,
13286 @code{default}: enable the default instructions, equivalent to @option{-mrecip},
13287 @code{none}: disable all estimate instructions, equivalent to @option{-mno-recip},
13288 @code{div}: enable the approximation for scalar division,
13289 @code{vec-div}: enable the approximation for vectorized division,
13290 @code{sqrt}: enable the approximation for scalar square root,
13291 @code{vec-sqrt}: enable the approximation for vectorized square root.
13292
13293 So for example, @option{-mrecip=all,!sqrt} would enable
13294 all of the reciprocal approximations, except for square root.
13295
13296 @item -mveclibabi=@var{type}
13297 @opindex mveclibabi
13298 Specifies the ABI type to use for vectorizing intrinsics using an
13299 external library. Supported types are @code{svml} for the Intel short
13300 vector math library and @code{acml} for the AMD math core library style
13301 of interfacing. GCC will currently emit calls to @code{vmldExp2},
13302 @code{vmldLn2}, @code{vmldLog102}, @code{vmldLog102}, @code{vmldPow2},
13303 @code{vmldTanh2}, @code{vmldTan2}, @code{vmldAtan2}, @code{vmldAtanh2},
13304 @code{vmldCbrt2}, @code{vmldSinh2}, @code{vmldSin2}, @code{vmldAsinh2},
13305 @code{vmldAsin2}, @code{vmldCosh2}, @code{vmldCos2}, @code{vmldAcosh2},
13306 @code{vmldAcos2}, @code{vmlsExp4}, @code{vmlsLn4}, @code{vmlsLog104},
13307 @code{vmlsLog104}, @code{vmlsPow4}, @code{vmlsTanh4}, @code{vmlsTan4},
13308 @code{vmlsAtan4}, @code{vmlsAtanh4}, @code{vmlsCbrt4}, @code{vmlsSinh4},
13309 @code{vmlsSin4}, @code{vmlsAsinh4}, @code{vmlsAsin4}, @code{vmlsCosh4},
13310 @code{vmlsCos4}, @code{vmlsAcosh4} and @code{vmlsAcos4} for corresponding
13311 function type when @option{-mveclibabi=svml} is used and @code{__vrd2_sin},
13312 @code{__vrd2_cos}, @code{__vrd2_exp}, @code{__vrd2_log}, @code{__vrd2_log2},
13313 @code{__vrd2_log10}, @code{__vrs4_sinf}, @code{__vrs4_cosf},
13314 @code{__vrs4_expf}, @code{__vrs4_logf}, @code{__vrs4_log2f},
13315 @code{__vrs4_log10f} and @code{__vrs4_powf} for corresponding function type
13316 when @option{-mveclibabi=acml} is used. Both @option{-ftree-vectorize} and
13317 @option{-funsafe-math-optimizations} have to be enabled. A SVML or ACML ABI
13318 compatible library will have to be specified at link time.
13319
13320 @item -mabi=@var{name}
13321 @opindex mabi
13322 Generate code for the specified calling convention. Permissible values
13323 are: @samp{sysv} for the ABI used on GNU/Linux and other systems and
13324 @samp{ms} for the Microsoft ABI. The default is to use the Microsoft
13325 ABI when targeting Windows. On all other systems, the default is the
13326 SYSV ABI. You can control this behavior for a specific function by
13327 using the function attribute @samp{ms_abi}/@samp{sysv_abi}.
13328 @xref{Function Attributes}.
13329
13330 @item -mtls-dialect=@var{type}
13331 @opindex mtls-dialect
13332 Generate code to access thread-local storage using the @samp{gnu} or
13333 @samp{gnu2} conventions. @samp{gnu} is the conservative default;
13334 @samp{gnu2} is more efficient, but it may add compile- and run-time
13335 requirements that cannot be satisfied on all systems.
13336
13337 @item -mpush-args
13338 @itemx -mno-push-args
13339 @opindex mpush-args
13340 @opindex mno-push-args
13341 Use PUSH operations to store outgoing parameters. This method is shorter
13342 and usually equally fast as method using SUB/MOV operations and is enabled
13343 by default. In some cases disabling it may improve performance because of
13344 improved scheduling and reduced dependencies.
13345
13346 @item -maccumulate-outgoing-args
13347 @opindex maccumulate-outgoing-args
13348 If enabled, the maximum amount of space required for outgoing arguments will be
13349 computed in the function prologue. This is faster on most modern CPUs
13350 because of reduced dependencies, improved scheduling and reduced stack usage
13351 when preferred stack boundary is not equal to 2. The drawback is a notable
13352 increase in code size. This switch implies @option{-mno-push-args}.
13353
13354 @item -mthreads
13355 @opindex mthreads
13356 Support thread-safe exception handling on @samp{Mingw32}. Code that relies
13357 on thread-safe exception handling must compile and link all code with the
13358 @option{-mthreads} option. When compiling, @option{-mthreads} defines
13359 @option{-D_MT}; when linking, it links in a special thread helper library
13360 @option{-lmingwthrd} which cleans up per thread exception handling data.
13361
13362 @item -mno-align-stringops
13363 @opindex mno-align-stringops
13364 Do not align destination of inlined string operations. This switch reduces
13365 code size and improves performance in case the destination is already aligned,
13366 but GCC doesn't know about it.
13367
13368 @item -minline-all-stringops
13369 @opindex minline-all-stringops
13370 By default GCC inlines string operations only when destination is known to be
13371 aligned at least to 4 byte boundary. This enables more inlining, increase code
13372 size, but may improve performance of code that depends on fast memcpy, strlen
13373 and memset for short lengths.
13374
13375 @item -minline-stringops-dynamically
13376 @opindex minline-stringops-dynamically
13377 For string operation of unknown size, inline runtime checks so for small
13378 blocks inline code is used, while for large blocks library call is used.
13379
13380 @item -mstringop-strategy=@var{alg}
13381 @opindex mstringop-strategy=@var{alg}
13382 Overwrite internal decision heuristic about particular algorithm to inline
13383 string operation with. The allowed values are @code{rep_byte},
13384 @code{rep_4byte}, @code{rep_8byte} for expanding using i386 @code{rep} prefix
13385 of specified size, @code{byte_loop}, @code{loop}, @code{unrolled_loop} for
13386 expanding inline loop, @code{libcall} for always expanding library call.
13387
13388 @item -momit-leaf-frame-pointer
13389 @opindex momit-leaf-frame-pointer
13390 Don't keep the frame pointer in a register for leaf functions. This
13391 avoids the instructions to save, set up and restore frame pointers and
13392 makes an extra register available in leaf functions. The option
13393 @option{-fomit-frame-pointer} removes the frame pointer for all functions
13394 which might make debugging harder.
13395
13396 @item -mtls-direct-seg-refs
13397 @itemx -mno-tls-direct-seg-refs
13398 @opindex mtls-direct-seg-refs
13399 Controls whether TLS variables may be accessed with offsets from the
13400 TLS segment register (@code{%gs} for 32-bit, @code{%fs} for 64-bit),
13401 or whether the thread base pointer must be added. Whether or not this
13402 is legal depends on the operating system, and whether it maps the
13403 segment to cover the entire TLS area.
13404
13405 For systems that use GNU libc, the default is on.
13406
13407 @item -msse2avx
13408 @itemx -mno-sse2avx
13409 @opindex msse2avx
13410 Specify that the assembler should encode SSE instructions with VEX
13411 prefix. The option @option{-mavx} turns this on by default.
13412
13413 @item -mfentry
13414 @itemx -mno-fentry
13415 @opindex mfentry
13416 If profiling is active @option{-pg} put the profiling
13417 counter call before prologue.
13418 Note: On x86 architectures the attribute @code{ms_hook_prologue}
13419 isn't possible at the moment for @option{-mfentry} and @option{-pg}.
13420
13421 @item -m8bit-idiv
13422 @itemx -mno-8bit-idiv
13423 @opindex 8bit-idiv
13424 On some processors, like Intel Atom, 8bit unsigned integer divide is
13425 much faster than 32bit/64bit integer divide. This option will generate a
13426 runt-time check. If both dividend and divisor are within range of 0
13427 to 255, 8bit unsigned integer divide will be used instead of
13428 32bit/64bit integer divide.
13429
13430 @item -mavx256-split-unaligned-load
13431 @item -mavx256-split-unaligned-store
13432 @opindex avx256-split-unaligned-load
13433 @opindex avx256-split-unaligned-store
13434 Split 32-byte AVX unaligned load and store.
13435
13436 @end table
13437
13438 These @samp{-m} switches are supported in addition to the above
13439 on AMD x86-64 processors in 64-bit environments.
13440
13441 @table @gcctabopt
13442 @item -m32
13443 @itemx -m64
13444 @itemx -mx32
13445 @opindex m32
13446 @opindex m64
13447 @opindex mx32
13448 Generate code for a 32-bit or 64-bit environment.
13449 The @option{-m32} option sets int, long and pointer to 32 bits and
13450 generates code that runs on any i386 system.
13451 The @option{-m64} option sets int to 32 bits and long and pointer
13452 to 64 bits and generates code for AMD's x86-64 architecture.
13453 The @option{-mx32} option sets int, long and pointer to 32 bits and
13454 generates code for AMD's x86-64 architecture.
13455 For darwin only the @option{-m64} option turns off the @option{-fno-pic}
13456 and @option{-mdynamic-no-pic} options.
13457
13458 @item -mno-red-zone
13459 @opindex mno-red-zone
13460 Do not use a so called red zone for x86-64 code. The red zone is mandated
13461 by the x86-64 ABI, it is a 128-byte area beyond the location of the
13462 stack pointer that will not be modified by signal or interrupt handlers
13463 and therefore can be used for temporary data without adjusting the stack
13464 pointer. The flag @option{-mno-red-zone} disables this red zone.
13465
13466 @item -mcmodel=small
13467 @opindex mcmodel=small
13468 Generate code for the small code model: the program and its symbols must
13469 be linked in the lower 2 GB of the address space. Pointers are 64 bits.
13470 Programs can be statically or dynamically linked. This is the default
13471 code model.
13472
13473 @item -mcmodel=kernel
13474 @opindex mcmodel=kernel
13475 Generate code for the kernel code model. The kernel runs in the
13476 negative 2 GB of the address space.
13477 This model has to be used for Linux kernel code.
13478
13479 @item -mcmodel=medium
13480 @opindex mcmodel=medium
13481 Generate code for the medium model: The program is linked in the lower 2
13482 GB of the address space. Small symbols are also placed there. Symbols
13483 with sizes larger than @option{-mlarge-data-threshold} are put into
13484 large data or bss sections and can be located above 2GB. Programs can
13485 be statically or dynamically linked.
13486
13487 @item -mcmodel=large
13488 @opindex mcmodel=large
13489 Generate code for the large model: This model makes no assumptions
13490 about addresses and sizes of sections.
13491 @end table
13492
13493 @node i386 and x86-64 Windows Options
13494 @subsection i386 and x86-64 Windows Options
13495 @cindex i386 and x86-64 Windows Options
13496
13497 These additional options are available for Windows targets:
13498
13499 @table @gcctabopt
13500 @item -mconsole
13501 @opindex mconsole
13502 This option is available for Cygwin and MinGW targets. It
13503 specifies that a console application is to be generated, by
13504 instructing the linker to set the PE header subsystem type
13505 required for console applications.
13506 This is the default behavior for Cygwin and MinGW targets.
13507
13508 @item -mdll
13509 @opindex mdll
13510 This option is available for Cygwin and MinGW targets. It
13511 specifies that a DLL - a dynamic link library - is to be
13512 generated, enabling the selection of the required runtime
13513 startup object and entry point.
13514
13515 @item -mnop-fun-dllimport
13516 @opindex mnop-fun-dllimport
13517 This option is available for Cygwin and MinGW targets. It
13518 specifies that the dllimport attribute should be ignored.
13519
13520 @item -mthread
13521 @opindex mthread
13522 This option is available for MinGW targets. It specifies
13523 that MinGW-specific thread support is to be used.
13524
13525 @item -municode
13526 @opindex municode
13527 This option is available for mingw-w64 targets. It specifies
13528 that the UNICODE macro is getting pre-defined and that the
13529 unicode capable runtime startup code is chosen.
13530
13531 @item -mwin32
13532 @opindex mwin32
13533 This option is available for Cygwin and MinGW targets. It
13534 specifies that the typical Windows pre-defined macros are to
13535 be set in the pre-processor, but does not influence the choice
13536 of runtime library/startup code.
13537
13538 @item -mwindows
13539 @opindex mwindows
13540 This option is available for Cygwin and MinGW targets. It
13541 specifies that a GUI application is to be generated by
13542 instructing the linker to set the PE header subsystem type
13543 appropriately.
13544
13545 @item -fno-set-stack-executable
13546 @opindex fno-set-stack-executable
13547 This option is available for MinGW targets. It specifies that
13548 the executable flag for stack used by nested functions isn't
13549 set. This is necessary for binaries running in kernel mode of
13550 Windows, as there the user32 API, which is used to set executable
13551 privileges, isn't available.
13552
13553 @item -mpe-aligned-commons
13554 @opindex mpe-aligned-commons
13555 This option is available for Cygwin and MinGW targets. It
13556 specifies that the GNU extension to the PE file format that
13557 permits the correct alignment of COMMON variables should be
13558 used when generating code. It will be enabled by default if
13559 GCC detects that the target assembler found during configuration
13560 supports the feature.
13561 @end table
13562
13563 See also under @ref{i386 and x86-64 Options} for standard options.
13564
13565 @node IA-64 Options
13566 @subsection IA-64 Options
13567 @cindex IA-64 Options
13568
13569 These are the @samp{-m} options defined for the Intel IA-64 architecture.
13570
13571 @table @gcctabopt
13572 @item -mbig-endian
13573 @opindex mbig-endian
13574 Generate code for a big endian target. This is the default for HP-UX@.
13575
13576 @item -mlittle-endian
13577 @opindex mlittle-endian
13578 Generate code for a little endian target. This is the default for AIX5
13579 and GNU/Linux.
13580
13581 @item -mgnu-as
13582 @itemx -mno-gnu-as
13583 @opindex mgnu-as
13584 @opindex mno-gnu-as
13585 Generate (or don't) code for the GNU assembler. This is the default.
13586 @c Also, this is the default if the configure option @option{--with-gnu-as}
13587 @c is used.
13588
13589 @item -mgnu-ld
13590 @itemx -mno-gnu-ld
13591 @opindex mgnu-ld
13592 @opindex mno-gnu-ld
13593 Generate (or don't) code for the GNU linker. This is the default.
13594 @c Also, this is the default if the configure option @option{--with-gnu-ld}
13595 @c is used.
13596
13597 @item -mno-pic
13598 @opindex mno-pic
13599 Generate code that does not use a global pointer register. The result
13600 is not position independent code, and violates the IA-64 ABI@.
13601
13602 @item -mvolatile-asm-stop
13603 @itemx -mno-volatile-asm-stop
13604 @opindex mvolatile-asm-stop
13605 @opindex mno-volatile-asm-stop
13606 Generate (or don't) a stop bit immediately before and after volatile asm
13607 statements.
13608
13609 @item -mregister-names
13610 @itemx -mno-register-names
13611 @opindex mregister-names
13612 @opindex mno-register-names
13613 Generate (or don't) @samp{in}, @samp{loc}, and @samp{out} register names for
13614 the stacked registers. This may make assembler output more readable.
13615
13616 @item -mno-sdata
13617 @itemx -msdata
13618 @opindex mno-sdata
13619 @opindex msdata
13620 Disable (or enable) optimizations that use the small data section. This may
13621 be useful for working around optimizer bugs.
13622
13623 @item -mconstant-gp
13624 @opindex mconstant-gp
13625 Generate code that uses a single constant global pointer value. This is
13626 useful when compiling kernel code.
13627
13628 @item -mauto-pic
13629 @opindex mauto-pic
13630 Generate code that is self-relocatable. This implies @option{-mconstant-gp}.
13631 This is useful when compiling firmware code.
13632
13633 @item -minline-float-divide-min-latency
13634 @opindex minline-float-divide-min-latency
13635 Generate code for inline divides of floating point values
13636 using the minimum latency algorithm.
13637
13638 @item -minline-float-divide-max-throughput
13639 @opindex minline-float-divide-max-throughput
13640 Generate code for inline divides of floating point values
13641 using the maximum throughput algorithm.
13642
13643 @item -mno-inline-float-divide
13644 @opindex mno-inline-float-divide
13645 Do not generate inline code for divides of floating point values.
13646
13647 @item -minline-int-divide-min-latency
13648 @opindex minline-int-divide-min-latency
13649 Generate code for inline divides of integer values
13650 using the minimum latency algorithm.
13651
13652 @item -minline-int-divide-max-throughput
13653 @opindex minline-int-divide-max-throughput
13654 Generate code for inline divides of integer values
13655 using the maximum throughput algorithm.
13656
13657 @item -mno-inline-int-divide
13658 @opindex mno-inline-int-divide
13659 Do not generate inline code for divides of integer values.
13660
13661 @item -minline-sqrt-min-latency
13662 @opindex minline-sqrt-min-latency
13663 Generate code for inline square roots
13664 using the minimum latency algorithm.
13665
13666 @item -minline-sqrt-max-throughput
13667 @opindex minline-sqrt-max-throughput
13668 Generate code for inline square roots
13669 using the maximum throughput algorithm.
13670
13671 @item -mno-inline-sqrt
13672 @opindex mno-inline-sqrt
13673 Do not generate inline code for sqrt.
13674
13675 @item -mfused-madd
13676 @itemx -mno-fused-madd
13677 @opindex mfused-madd
13678 @opindex mno-fused-madd
13679 Do (don't) generate code that uses the fused multiply/add or multiply/subtract
13680 instructions. The default is to use these instructions.
13681
13682 @item -mno-dwarf2-asm
13683 @itemx -mdwarf2-asm
13684 @opindex mno-dwarf2-asm
13685 @opindex mdwarf2-asm
13686 Don't (or do) generate assembler code for the DWARF2 line number debugging
13687 info. This may be useful when not using the GNU assembler.
13688
13689 @item -mearly-stop-bits
13690 @itemx -mno-early-stop-bits
13691 @opindex mearly-stop-bits
13692 @opindex mno-early-stop-bits
13693 Allow stop bits to be placed earlier than immediately preceding the
13694 instruction that triggered the stop bit. This can improve instruction
13695 scheduling, but does not always do so.
13696
13697 @item -mfixed-range=@var{register-range}
13698 @opindex mfixed-range
13699 Generate code treating the given register range as fixed registers.
13700 A fixed register is one that the register allocator can not use. This is
13701 useful when compiling kernel code. A register range is specified as
13702 two registers separated by a dash. Multiple register ranges can be
13703 specified separated by a comma.
13704
13705 @item -mtls-size=@var{tls-size}
13706 @opindex mtls-size
13707 Specify bit size of immediate TLS offsets. Valid values are 14, 22, and
13708 64.
13709
13710 @item -mtune=@var{cpu-type}
13711 @opindex mtune
13712 Tune the instruction scheduling for a particular CPU, Valid values are
13713 itanium, itanium1, merced, itanium2, and mckinley.
13714
13715 @item -milp32
13716 @itemx -mlp64
13717 @opindex milp32
13718 @opindex mlp64
13719 Generate code for a 32-bit or 64-bit environment.
13720 The 32-bit environment sets int, long and pointer to 32 bits.
13721 The 64-bit environment sets int to 32 bits and long and pointer
13722 to 64 bits. These are HP-UX specific flags.
13723
13724 @item -mno-sched-br-data-spec
13725 @itemx -msched-br-data-spec
13726 @opindex mno-sched-br-data-spec
13727 @opindex msched-br-data-spec
13728 (Dis/En)able data speculative scheduling before reload.
13729 This will result in generation of the ld.a instructions and
13730 the corresponding check instructions (ld.c / chk.a).
13731 The default is 'disable'.
13732
13733 @item -msched-ar-data-spec
13734 @itemx -mno-sched-ar-data-spec
13735 @opindex msched-ar-data-spec
13736 @opindex mno-sched-ar-data-spec
13737 (En/Dis)able data speculative scheduling after reload.
13738 This will result in generation of the ld.a instructions and
13739 the corresponding check instructions (ld.c / chk.a).
13740 The default is 'enable'.
13741
13742 @item -mno-sched-control-spec
13743 @itemx -msched-control-spec
13744 @opindex mno-sched-control-spec
13745 @opindex msched-control-spec
13746 (Dis/En)able control speculative scheduling. This feature is
13747 available only during region scheduling (i.e.@: before reload).
13748 This will result in generation of the ld.s instructions and
13749 the corresponding check instructions chk.s .
13750 The default is 'disable'.
13751
13752 @item -msched-br-in-data-spec
13753 @itemx -mno-sched-br-in-data-spec
13754 @opindex msched-br-in-data-spec
13755 @opindex mno-sched-br-in-data-spec
13756 (En/Dis)able speculative scheduling of the instructions that
13757 are dependent on the data speculative loads before reload.
13758 This is effective only with @option{-msched-br-data-spec} enabled.
13759 The default is 'enable'.
13760
13761 @item -msched-ar-in-data-spec
13762 @itemx -mno-sched-ar-in-data-spec
13763 @opindex msched-ar-in-data-spec
13764 @opindex mno-sched-ar-in-data-spec
13765 (En/Dis)able speculative scheduling of the instructions that
13766 are dependent on the data speculative loads after reload.
13767 This is effective only with @option{-msched-ar-data-spec} enabled.
13768 The default is 'enable'.
13769
13770 @item -msched-in-control-spec
13771 @itemx -mno-sched-in-control-spec
13772 @opindex msched-in-control-spec
13773 @opindex mno-sched-in-control-spec
13774 (En/Dis)able speculative scheduling of the instructions that
13775 are dependent on the control speculative loads.
13776 This is effective only with @option{-msched-control-spec} enabled.
13777 The default is 'enable'.
13778
13779 @item -mno-sched-prefer-non-data-spec-insns
13780 @itemx -msched-prefer-non-data-spec-insns
13781 @opindex mno-sched-prefer-non-data-spec-insns
13782 @opindex msched-prefer-non-data-spec-insns
13783 If enabled, data speculative instructions will be chosen for schedule
13784 only if there are no other choices at the moment. This will make
13785 the use of the data speculation much more conservative.
13786 The default is 'disable'.
13787
13788 @item -mno-sched-prefer-non-control-spec-insns
13789 @itemx -msched-prefer-non-control-spec-insns
13790 @opindex mno-sched-prefer-non-control-spec-insns
13791 @opindex msched-prefer-non-control-spec-insns
13792 If enabled, control speculative instructions will be chosen for schedule
13793 only if there are no other choices at the moment. This will make
13794 the use of the control speculation much more conservative.
13795 The default is 'disable'.
13796
13797 @item -mno-sched-count-spec-in-critical-path
13798 @itemx -msched-count-spec-in-critical-path
13799 @opindex mno-sched-count-spec-in-critical-path
13800 @opindex msched-count-spec-in-critical-path
13801 If enabled, speculative dependencies will be considered during
13802 computation of the instructions priorities. This will make the use of the
13803 speculation a bit more conservative.
13804 The default is 'disable'.
13805
13806 @item -msched-spec-ldc
13807 @opindex msched-spec-ldc
13808 Use a simple data speculation check. This option is on by default.
13809
13810 @item -msched-control-spec-ldc
13811 @opindex msched-spec-ldc
13812 Use a simple check for control speculation. This option is on by default.
13813
13814 @item -msched-stop-bits-after-every-cycle
13815 @opindex msched-stop-bits-after-every-cycle
13816 Place a stop bit after every cycle when scheduling. This option is on
13817 by default.
13818
13819 @item -msched-fp-mem-deps-zero-cost
13820 @opindex msched-fp-mem-deps-zero-cost
13821 Assume that floating-point stores and loads are not likely to cause a conflict
13822 when placed into the same instruction group. This option is disabled by
13823 default.
13824
13825 @item -msel-sched-dont-check-control-spec
13826 @opindex msel-sched-dont-check-control-spec
13827 Generate checks for control speculation in selective scheduling.
13828 This flag is disabled by default.
13829
13830 @item -msched-max-memory-insns=@var{max-insns}
13831 @opindex msched-max-memory-insns
13832 Limit on the number of memory insns per instruction group, giving lower
13833 priority to subsequent memory insns attempting to schedule in the same
13834 instruction group. Frequently useful to prevent cache bank conflicts.
13835 The default value is 1.
13836
13837 @item -msched-max-memory-insns-hard-limit
13838 @opindex msched-max-memory-insns-hard-limit
13839 Disallow more than `msched-max-memory-insns' in instruction group.
13840 Otherwise, limit is `soft' meaning that we would prefer non-memory operations
13841 when limit is reached but may still schedule memory operations.
13842
13843 @end table
13844
13845 @node IA-64/VMS Options
13846 @subsection IA-64/VMS Options
13847
13848 These @samp{-m} options are defined for the IA-64/VMS implementations:
13849
13850 @table @gcctabopt
13851 @item -mvms-return-codes
13852 @opindex mvms-return-codes
13853 Return VMS condition codes from main. The default is to return POSIX
13854 style condition (e.g.@ error) codes.
13855
13856 @item -mdebug-main=@var{prefix}
13857 @opindex mdebug-main=@var{prefix}
13858 Flag the first routine whose name starts with @var{prefix} as the main
13859 routine for the debugger.
13860
13861 @item -mmalloc64
13862 @opindex mmalloc64
13863 Default to 64bit memory allocation routines.
13864 @end table
13865
13866 @node LM32 Options
13867 @subsection LM32 Options
13868 @cindex LM32 options
13869
13870 These @option{-m} options are defined for the Lattice Mico32 architecture:
13871
13872 @table @gcctabopt
13873 @item -mbarrel-shift-enabled
13874 @opindex mbarrel-shift-enabled
13875 Enable barrel-shift instructions.
13876
13877 @item -mdivide-enabled
13878 @opindex mdivide-enabled
13879 Enable divide and modulus instructions.
13880
13881 @item -mmultiply-enabled
13882 @opindex multiply-enabled
13883 Enable multiply instructions.
13884
13885 @item -msign-extend-enabled
13886 @opindex msign-extend-enabled
13887 Enable sign extend instructions.
13888
13889 @item -muser-enabled
13890 @opindex muser-enabled
13891 Enable user-defined instructions.
13892
13893 @end table
13894
13895 @node M32C Options
13896 @subsection M32C Options
13897 @cindex M32C options
13898
13899 @table @gcctabopt
13900 @item -mcpu=@var{name}
13901 @opindex mcpu=
13902 Select the CPU for which code is generated. @var{name} may be one of
13903 @samp{r8c} for the R8C/Tiny series, @samp{m16c} for the M16C (up to
13904 /60) series, @samp{m32cm} for the M16C/80 series, or @samp{m32c} for
13905 the M32C/80 series.
13906
13907 @item -msim
13908 @opindex msim
13909 Specifies that the program will be run on the simulator. This causes
13910 an alternate runtime library to be linked in which supports, for
13911 example, file I/O@. You must not use this option when generating
13912 programs that will run on real hardware; you must provide your own
13913 runtime library for whatever I/O functions are needed.
13914
13915 @item -memregs=@var{number}
13916 @opindex memregs=
13917 Specifies the number of memory-based pseudo-registers GCC will use
13918 during code generation. These pseudo-registers will be used like real
13919 registers, so there is a tradeoff between GCC's ability to fit the
13920 code into available registers, and the performance penalty of using
13921 memory instead of registers. Note that all modules in a program must
13922 be compiled with the same value for this option. Because of that, you
13923 must not use this option with the default runtime libraries gcc
13924 builds.
13925
13926 @end table
13927
13928 @node M32R/D Options
13929 @subsection M32R/D Options
13930 @cindex M32R/D options
13931
13932 These @option{-m} options are defined for Renesas M32R/D architectures:
13933
13934 @table @gcctabopt
13935 @item -m32r2
13936 @opindex m32r2
13937 Generate code for the M32R/2@.
13938
13939 @item -m32rx
13940 @opindex m32rx
13941 Generate code for the M32R/X@.
13942
13943 @item -m32r
13944 @opindex m32r
13945 Generate code for the M32R@. This is the default.
13946
13947 @item -mmodel=small
13948 @opindex mmodel=small
13949 Assume all objects live in the lower 16MB of memory (so that their addresses
13950 can be loaded with the @code{ld24} instruction), and assume all subroutines
13951 are reachable with the @code{bl} instruction.
13952 This is the default.
13953
13954 The addressability of a particular object can be set with the
13955 @code{model} attribute.
13956
13957 @item -mmodel=medium
13958 @opindex mmodel=medium
13959 Assume objects may be anywhere in the 32-bit address space (the compiler
13960 will generate @code{seth/add3} instructions to load their addresses), and
13961 assume all subroutines are reachable with the @code{bl} instruction.
13962
13963 @item -mmodel=large
13964 @opindex mmodel=large
13965 Assume objects may be anywhere in the 32-bit address space (the compiler
13966 will generate @code{seth/add3} instructions to load their addresses), and
13967 assume subroutines may not be reachable with the @code{bl} instruction
13968 (the compiler will generate the much slower @code{seth/add3/jl}
13969 instruction sequence).
13970
13971 @item -msdata=none
13972 @opindex msdata=none
13973 Disable use of the small data area. Variables will be put into
13974 one of @samp{.data}, @samp{bss}, or @samp{.rodata} (unless the
13975 @code{section} attribute has been specified).
13976 This is the default.
13977
13978 The small data area consists of sections @samp{.sdata} and @samp{.sbss}.
13979 Objects may be explicitly put in the small data area with the
13980 @code{section} attribute using one of these sections.
13981
13982 @item -msdata=sdata
13983 @opindex msdata=sdata
13984 Put small global and static data in the small data area, but do not
13985 generate special code to reference them.
13986
13987 @item -msdata=use
13988 @opindex msdata=use
13989 Put small global and static data in the small data area, and generate
13990 special instructions to reference them.
13991
13992 @item -G @var{num}
13993 @opindex G
13994 @cindex smaller data references
13995 Put global and static objects less than or equal to @var{num} bytes
13996 into the small data or bss sections instead of the normal data or bss
13997 sections. The default value of @var{num} is 8.
13998 The @option{-msdata} option must be set to one of @samp{sdata} or @samp{use}
13999 for this option to have any effect.
14000
14001 All modules should be compiled with the same @option{-G @var{num}} value.
14002 Compiling with different values of @var{num} may or may not work; if it
14003 doesn't the linker will give an error message---incorrect code will not be
14004 generated.
14005
14006 @item -mdebug
14007 @opindex mdebug
14008 Makes the M32R specific code in the compiler display some statistics
14009 that might help in debugging programs.
14010
14011 @item -malign-loops
14012 @opindex malign-loops
14013 Align all loops to a 32-byte boundary.
14014
14015 @item -mno-align-loops
14016 @opindex mno-align-loops
14017 Do not enforce a 32-byte alignment for loops. This is the default.
14018
14019 @item -missue-rate=@var{number}
14020 @opindex missue-rate=@var{number}
14021 Issue @var{number} instructions per cycle. @var{number} can only be 1
14022 or 2.
14023
14024 @item -mbranch-cost=@var{number}
14025 @opindex mbranch-cost=@var{number}
14026 @var{number} can only be 1 or 2. If it is 1 then branches will be
14027 preferred over conditional code, if it is 2, then the opposite will
14028 apply.
14029
14030 @item -mflush-trap=@var{number}
14031 @opindex mflush-trap=@var{number}
14032 Specifies the trap number to use to flush the cache. The default is
14033 12. Valid numbers are between 0 and 15 inclusive.
14034
14035 @item -mno-flush-trap
14036 @opindex mno-flush-trap
14037 Specifies that the cache cannot be flushed by using a trap.
14038
14039 @item -mflush-func=@var{name}
14040 @opindex mflush-func=@var{name}
14041 Specifies the name of the operating system function to call to flush
14042 the cache. The default is @emph{_flush_cache}, but a function call
14043 will only be used if a trap is not available.
14044
14045 @item -mno-flush-func
14046 @opindex mno-flush-func
14047 Indicates that there is no OS function for flushing the cache.
14048
14049 @end table
14050
14051 @node M680x0 Options
14052 @subsection M680x0 Options
14053 @cindex M680x0 options
14054
14055 These are the @samp{-m} options defined for M680x0 and ColdFire processors.
14056 The default settings depend on which architecture was selected when
14057 the compiler was configured; the defaults for the most common choices
14058 are given below.
14059
14060 @table @gcctabopt
14061 @item -march=@var{arch}
14062 @opindex march
14063 Generate code for a specific M680x0 or ColdFire instruction set
14064 architecture. Permissible values of @var{arch} for M680x0
14065 architectures are: @samp{68000}, @samp{68010}, @samp{68020},
14066 @samp{68030}, @samp{68040}, @samp{68060} and @samp{cpu32}. ColdFire
14067 architectures are selected according to Freescale's ISA classification
14068 and the permissible values are: @samp{isaa}, @samp{isaaplus},
14069 @samp{isab} and @samp{isac}.
14070
14071 gcc defines a macro @samp{__mcf@var{arch}__} whenever it is generating
14072 code for a ColdFire target. The @var{arch} in this macro is one of the
14073 @option{-march} arguments given above.
14074
14075 When used together, @option{-march} and @option{-mtune} select code
14076 that runs on a family of similar processors but that is optimized
14077 for a particular microarchitecture.
14078
14079 @item -mcpu=@var{cpu}
14080 @opindex mcpu
14081 Generate code for a specific M680x0 or ColdFire processor.
14082 The M680x0 @var{cpu}s are: @samp{68000}, @samp{68010}, @samp{68020},
14083 @samp{68030}, @samp{68040}, @samp{68060}, @samp{68302}, @samp{68332}
14084 and @samp{cpu32}. The ColdFire @var{cpu}s are given by the table
14085 below, which also classifies the CPUs into families:
14086
14087 @multitable @columnfractions 0.20 0.80
14088 @item @strong{Family} @tab @strong{@samp{-mcpu} arguments}
14089 @item @samp{51} @tab @samp{51} @samp{51ac} @samp{51cn} @samp{51em} @samp{51qe}
14090 @item @samp{5206} @tab @samp{5202} @samp{5204} @samp{5206}
14091 @item @samp{5206e} @tab @samp{5206e}
14092 @item @samp{5208} @tab @samp{5207} @samp{5208}
14093 @item @samp{5211a} @tab @samp{5210a} @samp{5211a}
14094 @item @samp{5213} @tab @samp{5211} @samp{5212} @samp{5213}
14095 @item @samp{5216} @tab @samp{5214} @samp{5216}
14096 @item @samp{52235} @tab @samp{52230} @samp{52231} @samp{52232} @samp{52233} @samp{52234} @samp{52235}
14097 @item @samp{5225} @tab @samp{5224} @samp{5225}
14098 @item @samp{52259} @tab @samp{52252} @samp{52254} @samp{52255} @samp{52256} @samp{52258} @samp{52259}
14099 @item @samp{5235} @tab @samp{5232} @samp{5233} @samp{5234} @samp{5235} @samp{523x}
14100 @item @samp{5249} @tab @samp{5249}
14101 @item @samp{5250} @tab @samp{5250}
14102 @item @samp{5271} @tab @samp{5270} @samp{5271}
14103 @item @samp{5272} @tab @samp{5272}
14104 @item @samp{5275} @tab @samp{5274} @samp{5275}
14105 @item @samp{5282} @tab @samp{5280} @samp{5281} @samp{5282} @samp{528x}
14106 @item @samp{53017} @tab @samp{53011} @samp{53012} @samp{53013} @samp{53014} @samp{53015} @samp{53016} @samp{53017}
14107 @item @samp{5307} @tab @samp{5307}
14108 @item @samp{5329} @tab @samp{5327} @samp{5328} @samp{5329} @samp{532x}
14109 @item @samp{5373} @tab @samp{5372} @samp{5373} @samp{537x}
14110 @item @samp{5407} @tab @samp{5407}
14111 @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}
14112 @end multitable
14113
14114 @option{-mcpu=@var{cpu}} overrides @option{-march=@var{arch}} if
14115 @var{arch} is compatible with @var{cpu}. Other combinations of
14116 @option{-mcpu} and @option{-march} are rejected.
14117
14118 gcc defines the macro @samp{__mcf_cpu_@var{cpu}} when ColdFire target
14119 @var{cpu} is selected. It also defines @samp{__mcf_family_@var{family}},
14120 where the value of @var{family} is given by the table above.
14121
14122 @item -mtune=@var{tune}
14123 @opindex mtune
14124 Tune the code for a particular microarchitecture, within the
14125 constraints set by @option{-march} and @option{-mcpu}.
14126 The M680x0 microarchitectures are: @samp{68000}, @samp{68010},
14127 @samp{68020}, @samp{68030}, @samp{68040}, @samp{68060}
14128 and @samp{cpu32}. The ColdFire microarchitectures
14129 are: @samp{cfv1}, @samp{cfv2}, @samp{cfv3}, @samp{cfv4} and @samp{cfv4e}.
14130
14131 You can also use @option{-mtune=68020-40} for code that needs
14132 to run relatively well on 68020, 68030 and 68040 targets.
14133 @option{-mtune=68020-60} is similar but includes 68060 targets
14134 as well. These two options select the same tuning decisions as
14135 @option{-m68020-40} and @option{-m68020-60} respectively.
14136
14137 gcc defines the macros @samp{__mc@var{arch}} and @samp{__mc@var{arch}__}
14138 when tuning for 680x0 architecture @var{arch}. It also defines
14139 @samp{mc@var{arch}} unless either @option{-ansi} or a non-GNU @option{-std}
14140 option is used. If gcc is tuning for a range of architectures,
14141 as selected by @option{-mtune=68020-40} or @option{-mtune=68020-60},
14142 it defines the macros for every architecture in the range.
14143
14144 gcc also defines the macro @samp{__m@var{uarch}__} when tuning for
14145 ColdFire microarchitecture @var{uarch}, where @var{uarch} is one
14146 of the arguments given above.
14147
14148 @item -m68000
14149 @itemx -mc68000
14150 @opindex m68000
14151 @opindex mc68000
14152 Generate output for a 68000. This is the default
14153 when the compiler is configured for 68000-based systems.
14154 It is equivalent to @option{-march=68000}.
14155
14156 Use this option for microcontrollers with a 68000 or EC000 core,
14157 including the 68008, 68302, 68306, 68307, 68322, 68328 and 68356.
14158
14159 @item -m68010
14160 @opindex m68010
14161 Generate output for a 68010. This is the default
14162 when the compiler is configured for 68010-based systems.
14163 It is equivalent to @option{-march=68010}.
14164
14165 @item -m68020
14166 @itemx -mc68020
14167 @opindex m68020
14168 @opindex mc68020
14169 Generate output for a 68020. This is the default
14170 when the compiler is configured for 68020-based systems.
14171 It is equivalent to @option{-march=68020}.
14172
14173 @item -m68030
14174 @opindex m68030
14175 Generate output for a 68030. This is the default when the compiler is
14176 configured for 68030-based systems. It is equivalent to
14177 @option{-march=68030}.
14178
14179 @item -m68040
14180 @opindex m68040
14181 Generate output for a 68040. This is the default when the compiler is
14182 configured for 68040-based systems. It is equivalent to
14183 @option{-march=68040}.
14184
14185 This option inhibits the use of 68881/68882 instructions that have to be
14186 emulated by software on the 68040. Use this option if your 68040 does not
14187 have code to emulate those instructions.
14188
14189 @item -m68060
14190 @opindex m68060
14191 Generate output for a 68060. This is the default when the compiler is
14192 configured for 68060-based systems. It is equivalent to
14193 @option{-march=68060}.
14194
14195 This option inhibits the use of 68020 and 68881/68882 instructions that
14196 have to be emulated by software on the 68060. Use this option if your 68060
14197 does not have code to emulate those instructions.
14198
14199 @item -mcpu32
14200 @opindex mcpu32
14201 Generate output for a CPU32. This is the default
14202 when the compiler is configured for CPU32-based systems.
14203 It is equivalent to @option{-march=cpu32}.
14204
14205 Use this option for microcontrollers with a
14206 CPU32 or CPU32+ core, including the 68330, 68331, 68332, 68333, 68334,
14207 68336, 68340, 68341, 68349 and 68360.
14208
14209 @item -m5200
14210 @opindex m5200
14211 Generate output for a 520X ColdFire CPU@. This is the default
14212 when the compiler is configured for 520X-based systems.
14213 It is equivalent to @option{-mcpu=5206}, and is now deprecated
14214 in favor of that option.
14215
14216 Use this option for microcontroller with a 5200 core, including
14217 the MCF5202, MCF5203, MCF5204 and MCF5206.
14218
14219 @item -m5206e
14220 @opindex m5206e
14221 Generate output for a 5206e ColdFire CPU@. The option is now
14222 deprecated in favor of the equivalent @option{-mcpu=5206e}.
14223
14224 @item -m528x
14225 @opindex m528x
14226 Generate output for a member of the ColdFire 528X family.
14227 The option is now deprecated in favor of the equivalent
14228 @option{-mcpu=528x}.
14229
14230 @item -m5307
14231 @opindex m5307
14232 Generate output for a ColdFire 5307 CPU@. The option is now deprecated
14233 in favor of the equivalent @option{-mcpu=5307}.
14234
14235 @item -m5407
14236 @opindex m5407
14237 Generate output for a ColdFire 5407 CPU@. The option is now deprecated
14238 in favor of the equivalent @option{-mcpu=5407}.
14239
14240 @item -mcfv4e
14241 @opindex mcfv4e
14242 Generate output for a ColdFire V4e family CPU (e.g.@: 547x/548x).
14243 This includes use of hardware floating point instructions.
14244 The option is equivalent to @option{-mcpu=547x}, and is now
14245 deprecated in favor of that option.
14246
14247 @item -m68020-40
14248 @opindex m68020-40
14249 Generate output for a 68040, without using any of the new instructions.
14250 This results in code which can run relatively efficiently on either a
14251 68020/68881 or a 68030 or a 68040. The generated code does use the
14252 68881 instructions that are emulated on the 68040.
14253
14254 The option is equivalent to @option{-march=68020} @option{-mtune=68020-40}.
14255
14256 @item -m68020-60
14257 @opindex m68020-60
14258 Generate output for a 68060, without using any of the new instructions.
14259 This results in code which can run relatively efficiently on either a
14260 68020/68881 or a 68030 or a 68040. The generated code does use the
14261 68881 instructions that are emulated on the 68060.
14262
14263 The option is equivalent to @option{-march=68020} @option{-mtune=68020-60}.
14264
14265 @item -mhard-float
14266 @itemx -m68881
14267 @opindex mhard-float
14268 @opindex m68881
14269 Generate floating-point instructions. This is the default for 68020
14270 and above, and for ColdFire devices that have an FPU@. It defines the
14271 macro @samp{__HAVE_68881__} on M680x0 targets and @samp{__mcffpu__}
14272 on ColdFire targets.
14273
14274 @item -msoft-float
14275 @opindex msoft-float
14276 Do not generate floating-point instructions; use library calls instead.
14277 This is the default for 68000, 68010, and 68832 targets. It is also
14278 the default for ColdFire devices that have no FPU.
14279
14280 @item -mdiv
14281 @itemx -mno-div
14282 @opindex mdiv
14283 @opindex mno-div
14284 Generate (do not generate) ColdFire hardware divide and remainder
14285 instructions. If @option{-march} is used without @option{-mcpu},
14286 the default is ``on'' for ColdFire architectures and ``off'' for M680x0
14287 architectures. Otherwise, the default is taken from the target CPU
14288 (either the default CPU, or the one specified by @option{-mcpu}). For
14289 example, the default is ``off'' for @option{-mcpu=5206} and ``on'' for
14290 @option{-mcpu=5206e}.
14291
14292 gcc defines the macro @samp{__mcfhwdiv__} when this option is enabled.
14293
14294 @item -mshort
14295 @opindex mshort
14296 Consider type @code{int} to be 16 bits wide, like @code{short int}.
14297 Additionally, parameters passed on the stack are also aligned to a
14298 16-bit boundary even on targets whose API mandates promotion to 32-bit.
14299
14300 @item -mno-short
14301 @opindex mno-short
14302 Do not consider type @code{int} to be 16 bits wide. This is the default.
14303
14304 @item -mnobitfield
14305 @itemx -mno-bitfield
14306 @opindex mnobitfield
14307 @opindex mno-bitfield
14308 Do not use the bit-field instructions. The @option{-m68000}, @option{-mcpu32}
14309 and @option{-m5200} options imply @w{@option{-mnobitfield}}.
14310
14311 @item -mbitfield
14312 @opindex mbitfield
14313 Do use the bit-field instructions. The @option{-m68020} option implies
14314 @option{-mbitfield}. This is the default if you use a configuration
14315 designed for a 68020.
14316
14317 @item -mrtd
14318 @opindex mrtd
14319 Use a different function-calling convention, in which functions
14320 that take a fixed number of arguments return with the @code{rtd}
14321 instruction, which pops their arguments while returning. This
14322 saves one instruction in the caller since there is no need to pop
14323 the arguments there.
14324
14325 This calling convention is incompatible with the one normally
14326 used on Unix, so you cannot use it if you need to call libraries
14327 compiled with the Unix compiler.
14328
14329 Also, you must provide function prototypes for all functions that
14330 take variable numbers of arguments (including @code{printf});
14331 otherwise incorrect code will be generated for calls to those
14332 functions.
14333
14334 In addition, seriously incorrect code will result if you call a
14335 function with too many arguments. (Normally, extra arguments are
14336 harmlessly ignored.)
14337
14338 The @code{rtd} instruction is supported by the 68010, 68020, 68030,
14339 68040, 68060 and CPU32 processors, but not by the 68000 or 5200.
14340
14341 @item -mno-rtd
14342 @opindex mno-rtd
14343 Do not use the calling conventions selected by @option{-mrtd}.
14344 This is the default.
14345
14346 @item -malign-int
14347 @itemx -mno-align-int
14348 @opindex malign-int
14349 @opindex mno-align-int
14350 Control whether GCC aligns @code{int}, @code{long}, @code{long long},
14351 @code{float}, @code{double}, and @code{long double} variables on a 32-bit
14352 boundary (@option{-malign-int}) or a 16-bit boundary (@option{-mno-align-int}).
14353 Aligning variables on 32-bit boundaries produces code that runs somewhat
14354 faster on processors with 32-bit busses at the expense of more memory.
14355
14356 @strong{Warning:} if you use the @option{-malign-int} switch, GCC will
14357 align structures containing the above types differently than
14358 most published application binary interface specifications for the m68k.
14359
14360 @item -mpcrel
14361 @opindex mpcrel
14362 Use the pc-relative addressing mode of the 68000 directly, instead of
14363 using a global offset table. At present, this option implies @option{-fpic},
14364 allowing at most a 16-bit offset for pc-relative addressing. @option{-fPIC} is
14365 not presently supported with @option{-mpcrel}, though this could be supported for
14366 68020 and higher processors.
14367
14368 @item -mno-strict-align
14369 @itemx -mstrict-align
14370 @opindex mno-strict-align
14371 @opindex mstrict-align
14372 Do not (do) assume that unaligned memory references will be handled by
14373 the system.
14374
14375 @item -msep-data
14376 Generate code that allows the data segment to be located in a different
14377 area of memory from the text segment. This allows for execute in place in
14378 an environment without virtual memory management. This option implies
14379 @option{-fPIC}.
14380
14381 @item -mno-sep-data
14382 Generate code that assumes that the data segment follows the text segment.
14383 This is the default.
14384
14385 @item -mid-shared-library
14386 Generate code that supports shared libraries via the library ID method.
14387 This allows for execute in place and shared libraries in an environment
14388 without virtual memory management. This option implies @option{-fPIC}.
14389
14390 @item -mno-id-shared-library
14391 Generate code that doesn't assume ID based shared libraries are being used.
14392 This is the default.
14393
14394 @item -mshared-library-id=n
14395 Specified the identification number of the ID based shared library being
14396 compiled. Specifying a value of 0 will generate more compact code, specifying
14397 other values will force the allocation of that number to the current
14398 library but is no more space or time efficient than omitting this option.
14399
14400 @item -mxgot
14401 @itemx -mno-xgot
14402 @opindex mxgot
14403 @opindex mno-xgot
14404 When generating position-independent code for ColdFire, generate code
14405 that works if the GOT has more than 8192 entries. This code is
14406 larger and slower than code generated without this option. On M680x0
14407 processors, this option is not needed; @option{-fPIC} suffices.
14408
14409 GCC normally uses a single instruction to load values from the GOT@.
14410 While this is relatively efficient, it only works if the GOT
14411 is smaller than about 64k. Anything larger causes the linker
14412 to report an error such as:
14413
14414 @cindex relocation truncated to fit (ColdFire)
14415 @smallexample
14416 relocation truncated to fit: R_68K_GOT16O foobar
14417 @end smallexample
14418
14419 If this happens, you should recompile your code with @option{-mxgot}.
14420 It should then work with very large GOTs. However, code generated with
14421 @option{-mxgot} is less efficient, since it takes 4 instructions to fetch
14422 the value of a global symbol.
14423
14424 Note that some linkers, including newer versions of the GNU linker,
14425 can create multiple GOTs and sort GOT entries. If you have such a linker,
14426 you should only need to use @option{-mxgot} when compiling a single
14427 object file that accesses more than 8192 GOT entries. Very few do.
14428
14429 These options have no effect unless GCC is generating
14430 position-independent code.
14431
14432 @end table
14433
14434 @node MCore Options
14435 @subsection MCore Options
14436 @cindex MCore options
14437
14438 These are the @samp{-m} options defined for the Motorola M*Core
14439 processors.
14440
14441 @table @gcctabopt
14442
14443 @item -mhardlit
14444 @itemx -mno-hardlit
14445 @opindex mhardlit
14446 @opindex mno-hardlit
14447 Inline constants into the code stream if it can be done in two
14448 instructions or less.
14449
14450 @item -mdiv
14451 @itemx -mno-div
14452 @opindex mdiv
14453 @opindex mno-div
14454 Use the divide instruction. (Enabled by default).
14455
14456 @item -mrelax-immediate
14457 @itemx -mno-relax-immediate
14458 @opindex mrelax-immediate
14459 @opindex mno-relax-immediate
14460 Allow arbitrary sized immediates in bit operations.
14461
14462 @item -mwide-bitfields
14463 @itemx -mno-wide-bitfields
14464 @opindex mwide-bitfields
14465 @opindex mno-wide-bitfields
14466 Always treat bit-fields as int-sized.
14467
14468 @item -m4byte-functions
14469 @itemx -mno-4byte-functions
14470 @opindex m4byte-functions
14471 @opindex mno-4byte-functions
14472 Force all functions to be aligned to a four byte boundary.
14473
14474 @item -mcallgraph-data
14475 @itemx -mno-callgraph-data
14476 @opindex mcallgraph-data
14477 @opindex mno-callgraph-data
14478 Emit callgraph information.
14479
14480 @item -mslow-bytes
14481 @itemx -mno-slow-bytes
14482 @opindex mslow-bytes
14483 @opindex mno-slow-bytes
14484 Prefer word access when reading byte quantities.
14485
14486 @item -mlittle-endian
14487 @itemx -mbig-endian
14488 @opindex mlittle-endian
14489 @opindex mbig-endian
14490 Generate code for a little endian target.
14491
14492 @item -m210
14493 @itemx -m340
14494 @opindex m210
14495 @opindex m340
14496 Generate code for the 210 processor.
14497
14498 @item -mno-lsim
14499 @opindex mno-lsim
14500 Assume that run-time support has been provided and so omit the
14501 simulator library (@file{libsim.a)} from the linker command line.
14502
14503 @item -mstack-increment=@var{size}
14504 @opindex mstack-increment
14505 Set the maximum amount for a single stack increment operation. Large
14506 values can increase the speed of programs which contain functions
14507 that need a large amount of stack space, but they can also trigger a
14508 segmentation fault if the stack is extended too much. The default
14509 value is 0x1000.
14510
14511 @end table
14512
14513 @node MeP Options
14514 @subsection MeP Options
14515 @cindex MeP options
14516
14517 @table @gcctabopt
14518
14519 @item -mabsdiff
14520 @opindex mabsdiff
14521 Enables the @code{abs} instruction, which is the absolute difference
14522 between two registers.
14523
14524 @item -mall-opts
14525 @opindex mall-opts
14526 Enables all the optional instructions - average, multiply, divide, bit
14527 operations, leading zero, absolute difference, min/max, clip, and
14528 saturation.
14529
14530
14531 @item -maverage
14532 @opindex maverage
14533 Enables the @code{ave} instruction, which computes the average of two
14534 registers.
14535
14536 @item -mbased=@var{n}
14537 @opindex mbased=
14538 Variables of size @var{n} bytes or smaller will be placed in the
14539 @code{.based} section by default. Based variables use the @code{$tp}
14540 register as a base register, and there is a 128 byte limit to the
14541 @code{.based} section.
14542
14543 @item -mbitops
14544 @opindex mbitops
14545 Enables the bit operation instructions - bit test (@code{btstm}), set
14546 (@code{bsetm}), clear (@code{bclrm}), invert (@code{bnotm}), and
14547 test-and-set (@code{tas}).
14548
14549 @item -mc=@var{name}
14550 @opindex mc=
14551 Selects which section constant data will be placed in. @var{name} may
14552 be @code{tiny}, @code{near}, or @code{far}.
14553
14554 @item -mclip
14555 @opindex mclip
14556 Enables the @code{clip} instruction. Note that @code{-mclip} is not
14557 useful unless you also provide @code{-mminmax}.
14558
14559 @item -mconfig=@var{name}
14560 @opindex mconfig=
14561 Selects one of the build-in core configurations. Each MeP chip has
14562 one or more modules in it; each module has a core CPU and a variety of
14563 coprocessors, optional instructions, and peripherals. The
14564 @code{MeP-Integrator} tool, not part of GCC, provides these
14565 configurations through this option; using this option is the same as
14566 using all the corresponding command line options. The default
14567 configuration is @code{default}.
14568
14569 @item -mcop
14570 @opindex mcop
14571 Enables the coprocessor instructions. By default, this is a 32-bit
14572 coprocessor. Note that the coprocessor is normally enabled via the
14573 @code{-mconfig=} option.
14574
14575 @item -mcop32
14576 @opindex mcop32
14577 Enables the 32-bit coprocessor's instructions.
14578
14579 @item -mcop64
14580 @opindex mcop64
14581 Enables the 64-bit coprocessor's instructions.
14582
14583 @item -mivc2
14584 @opindex mivc2
14585 Enables IVC2 scheduling. IVC2 is a 64-bit VLIW coprocessor.
14586
14587 @item -mdc
14588 @opindex mdc
14589 Causes constant variables to be placed in the @code{.near} section.
14590
14591 @item -mdiv
14592 @opindex mdiv
14593 Enables the @code{div} and @code{divu} instructions.
14594
14595 @item -meb
14596 @opindex meb
14597 Generate big-endian code.
14598
14599 @item -mel
14600 @opindex mel
14601 Generate little-endian code.
14602
14603 @item -mio-volatile
14604 @opindex mio-volatile
14605 Tells the compiler that any variable marked with the @code{io}
14606 attribute is to be considered volatile.
14607
14608 @item -ml
14609 @opindex ml
14610 Causes variables to be assigned to the @code{.far} section by default.
14611
14612 @item -mleadz
14613 @opindex mleadz
14614 Enables the @code{leadz} (leading zero) instruction.
14615
14616 @item -mm
14617 @opindex mm
14618 Causes variables to be assigned to the @code{.near} section by default.
14619
14620 @item -mminmax
14621 @opindex mminmax
14622 Enables the @code{min} and @code{max} instructions.
14623
14624 @item -mmult
14625 @opindex mmult
14626 Enables the multiplication and multiply-accumulate instructions.
14627
14628 @item -mno-opts
14629 @opindex mno-opts
14630 Disables all the optional instructions enabled by @code{-mall-opts}.
14631
14632 @item -mrepeat
14633 @opindex mrepeat
14634 Enables the @code{repeat} and @code{erepeat} instructions, used for
14635 low-overhead looping.
14636
14637 @item -ms
14638 @opindex ms
14639 Causes all variables to default to the @code{.tiny} section. Note
14640 that there is a 65536 byte limit to this section. Accesses to these
14641 variables use the @code{%gp} base register.
14642
14643 @item -msatur
14644 @opindex msatur
14645 Enables the saturation instructions. Note that the compiler does not
14646 currently generate these itself, but this option is included for
14647 compatibility with other tools, like @code{as}.
14648
14649 @item -msdram
14650 @opindex msdram
14651 Link the SDRAM-based runtime instead of the default ROM-based runtime.
14652
14653 @item -msim
14654 @opindex msim
14655 Link the simulator runtime libraries.
14656
14657 @item -msimnovec
14658 @opindex msimnovec
14659 Link the simulator runtime libraries, excluding built-in support
14660 for reset and exception vectors and tables.
14661
14662 @item -mtf
14663 @opindex mtf
14664 Causes all functions to default to the @code{.far} section. Without
14665 this option, functions default to the @code{.near} section.
14666
14667 @item -mtiny=@var{n}
14668 @opindex mtiny=
14669 Variables that are @var{n} bytes or smaller will be allocated to the
14670 @code{.tiny} section. These variables use the @code{$gp} base
14671 register. The default for this option is 4, but note that there's a
14672 65536 byte limit to the @code{.tiny} section.
14673
14674 @end table
14675
14676 @node MicroBlaze Options
14677 @subsection MicroBlaze Options
14678 @cindex MicroBlaze Options
14679
14680 @table @gcctabopt
14681
14682 @item -msoft-float
14683 @opindex msoft-float
14684 Use software emulation for floating point (default).
14685
14686 @item -mhard-float
14687 @opindex mhard-float
14688 Use hardware floating point instructions.
14689
14690 @item -mmemcpy
14691 @opindex mmemcpy
14692 Do not optimize block moves, use @code{memcpy}.
14693
14694 @item -mno-clearbss
14695 @opindex mno-clearbss
14696 This option is deprecated. Use @option{-fno-zero-initialized-in-bss} instead.
14697
14698 @item -mcpu=@var{cpu-type}
14699 @opindex mcpu=
14700 Use features of and schedule code for given CPU.
14701 Supported values are in the format @samp{v@var{X}.@var{YY}.@var{Z}},
14702 where @var{X} is a major version, @var{YY} is the minor version, and
14703 @var{Z} is compatibility code. Example values are @samp{v3.00.a},
14704 @samp{v4.00.b}, @samp{v5.00.a}, @samp{v5.00.b}, @samp{v5.00.b}, @samp{v6.00.a}.
14705
14706 @item -mxl-soft-mul
14707 @opindex mxl-soft-mul
14708 Use software multiply emulation (default).
14709
14710 @item -mxl-soft-div
14711 @opindex mxl-soft-div
14712 Use software emulation for divides (default).
14713
14714 @item -mxl-barrel-shift
14715 @opindex mxl-barrel-shift
14716 Use the hardware barrel shifter.
14717
14718 @item -mxl-pattern-compare
14719 @opindex mxl-pattern-compare
14720 Use pattern compare instructions.
14721
14722 @item -msmall-divides
14723 @opindex msmall-divides
14724 Use table lookup optimization for small signed integer divisions.
14725
14726 @item -mxl-stack-check
14727 @opindex mxl-stack-check
14728 This option is deprecated. Use -fstack-check instead.
14729
14730 @item -mxl-gp-opt
14731 @opindex mxl-gp-opt
14732 Use GP relative sdata/sbss sections.
14733
14734 @item -mxl-multiply-high
14735 @opindex mxl-multiply-high
14736 Use multiply high instructions for high part of 32x32 multiply.
14737
14738 @item -mxl-float-convert
14739 @opindex mxl-float-convert
14740 Use hardware floating point conversion instructions.
14741
14742 @item -mxl-float-sqrt
14743 @opindex mxl-float-sqrt
14744 Use hardware floating point square root instruction.
14745
14746 @item -mxl-mode-@var{app-model}
14747 Select application model @var{app-model}. Valid models are
14748 @table @samp
14749 @item executable
14750 normal executable (default), uses startup code @file{crt0.o}.
14751
14752 @item xmdstub
14753 for use with Xilinx Microprocessor Debugger (XMD) based
14754 software intrusive debug agent called xmdstub. This uses startup file
14755 @file{crt1.o} and sets the start address of the program to be 0x800.
14756
14757 @item bootstrap
14758 for applications that are loaded using a bootloader.
14759 This model uses startup file @file{crt2.o} which does not contain a processor
14760 reset vector handler. This is suitable for transferring control on a
14761 processor reset to the bootloader rather than the application.
14762
14763 @item novectors
14764 for applications that do not require any of the
14765 MicroBlaze vectors. This option may be useful for applications running
14766 within a monitoring application. This model uses @file{crt3.o} as a startup file.
14767 @end table
14768
14769 Option @option{-xl-mode-@var{app-model}} is a deprecated alias for
14770 @option{-mxl-mode-@var{app-model}}.
14771
14772 @end table
14773
14774 @node MIPS Options
14775 @subsection MIPS Options
14776 @cindex MIPS options
14777
14778 @table @gcctabopt
14779
14780 @item -EB
14781 @opindex EB
14782 Generate big-endian code.
14783
14784 @item -EL
14785 @opindex EL
14786 Generate little-endian code. This is the default for @samp{mips*el-*-*}
14787 configurations.
14788
14789 @item -march=@var{arch}
14790 @opindex march
14791 Generate code that will run on @var{arch}, which can be the name of a
14792 generic MIPS ISA, or the name of a particular processor.
14793 The ISA names are:
14794 @samp{mips1}, @samp{mips2}, @samp{mips3}, @samp{mips4},
14795 @samp{mips32}, @samp{mips32r2}, @samp{mips64} and @samp{mips64r2}.
14796 The processor names are:
14797 @samp{4kc}, @samp{4km}, @samp{4kp}, @samp{4ksc},
14798 @samp{4kec}, @samp{4kem}, @samp{4kep}, @samp{4ksd},
14799 @samp{5kc}, @samp{5kf},
14800 @samp{20kc},
14801 @samp{24kc}, @samp{24kf2_1}, @samp{24kf1_1},
14802 @samp{24kec}, @samp{24kef2_1}, @samp{24kef1_1},
14803 @samp{34kc}, @samp{34kf2_1}, @samp{34kf1_1},
14804 @samp{74kc}, @samp{74kf2_1}, @samp{74kf1_1}, @samp{74kf3_2},
14805 @samp{1004kc}, @samp{1004kf2_1}, @samp{1004kf1_1},
14806 @samp{loongson2e}, @samp{loongson2f}, @samp{loongson3a},
14807 @samp{m4k},
14808 @samp{octeon},
14809 @samp{orion},
14810 @samp{r2000}, @samp{r3000}, @samp{r3900}, @samp{r4000}, @samp{r4400},
14811 @samp{r4600}, @samp{r4650}, @samp{r6000}, @samp{r8000},
14812 @samp{rm7000}, @samp{rm9000},
14813 @samp{r10000}, @samp{r12000}, @samp{r14000}, @samp{r16000},
14814 @samp{sb1},
14815 @samp{sr71000},
14816 @samp{vr4100}, @samp{vr4111}, @samp{vr4120}, @samp{vr4130}, @samp{vr4300},
14817 @samp{vr5000}, @samp{vr5400}, @samp{vr5500}
14818 and @samp{xlr}.
14819 The special value @samp{from-abi} selects the
14820 most compatible architecture for the selected ABI (that is,
14821 @samp{mips1} for 32-bit ABIs and @samp{mips3} for 64-bit ABIs)@.
14822
14823 Native Linux/GNU and IRIX toolchains also support the value @samp{native},
14824 which selects the best architecture option for the host processor.
14825 @option{-march=native} has no effect if GCC does not recognize
14826 the processor.
14827
14828 In processor names, a final @samp{000} can be abbreviated as @samp{k}
14829 (for example, @samp{-march=r2k}). Prefixes are optional, and
14830 @samp{vr} may be written @samp{r}.
14831
14832 Names of the form @samp{@var{n}f2_1} refer to processors with
14833 FPUs clocked at half the rate of the core, names of the form
14834 @samp{@var{n}f1_1} refer to processors with FPUs clocked at the same
14835 rate as the core, and names of the form @samp{@var{n}f3_2} refer to
14836 processors with FPUs clocked a ratio of 3:2 with respect to the core.
14837 For compatibility reasons, @samp{@var{n}f} is accepted as a synonym
14838 for @samp{@var{n}f2_1} while @samp{@var{n}x} and @samp{@var{b}fx} are
14839 accepted as synonyms for @samp{@var{n}f1_1}.
14840
14841 GCC defines two macros based on the value of this option. The first
14842 is @samp{_MIPS_ARCH}, which gives the name of target architecture, as
14843 a string. The second has the form @samp{_MIPS_ARCH_@var{foo}},
14844 where @var{foo} is the capitalized value of @samp{_MIPS_ARCH}@.
14845 For example, @samp{-march=r2000} will set @samp{_MIPS_ARCH}
14846 to @samp{"r2000"} and define the macro @samp{_MIPS_ARCH_R2000}.
14847
14848 Note that the @samp{_MIPS_ARCH} macro uses the processor names given
14849 above. In other words, it will have the full prefix and will not
14850 abbreviate @samp{000} as @samp{k}. In the case of @samp{from-abi},
14851 the macro names the resolved architecture (either @samp{"mips1"} or
14852 @samp{"mips3"}). It names the default architecture when no
14853 @option{-march} option is given.
14854
14855 @item -mtune=@var{arch}
14856 @opindex mtune
14857 Optimize for @var{arch}. Among other things, this option controls
14858 the way instructions are scheduled, and the perceived cost of arithmetic
14859 operations. The list of @var{arch} values is the same as for
14860 @option{-march}.
14861
14862 When this option is not used, GCC will optimize for the processor
14863 specified by @option{-march}. By using @option{-march} and
14864 @option{-mtune} together, it is possible to generate code that will
14865 run on a family of processors, but optimize the code for one
14866 particular member of that family.
14867
14868 @samp{-mtune} defines the macros @samp{_MIPS_TUNE} and
14869 @samp{_MIPS_TUNE_@var{foo}}, which work in the same way as the
14870 @samp{-march} ones described above.
14871
14872 @item -mips1
14873 @opindex mips1
14874 Equivalent to @samp{-march=mips1}.
14875
14876 @item -mips2
14877 @opindex mips2
14878 Equivalent to @samp{-march=mips2}.
14879
14880 @item -mips3
14881 @opindex mips3
14882 Equivalent to @samp{-march=mips3}.
14883
14884 @item -mips4
14885 @opindex mips4
14886 Equivalent to @samp{-march=mips4}.
14887
14888 @item -mips32
14889 @opindex mips32
14890 Equivalent to @samp{-march=mips32}.
14891
14892 @item -mips32r2
14893 @opindex mips32r2
14894 Equivalent to @samp{-march=mips32r2}.
14895
14896 @item -mips64
14897 @opindex mips64
14898 Equivalent to @samp{-march=mips64}.
14899
14900 @item -mips64r2
14901 @opindex mips64r2
14902 Equivalent to @samp{-march=mips64r2}.
14903
14904 @item -mips16
14905 @itemx -mno-mips16
14906 @opindex mips16
14907 @opindex mno-mips16
14908 Generate (do not generate) MIPS16 code. If GCC is targetting a
14909 MIPS32 or MIPS64 architecture, it will make use of the MIPS16e ASE@.
14910
14911 MIPS16 code generation can also be controlled on a per-function basis
14912 by means of @code{mips16} and @code{nomips16} attributes.
14913 @xref{Function Attributes}, for more information.
14914
14915 @item -mflip-mips16
14916 @opindex mflip-mips16
14917 Generate MIPS16 code on alternating functions. This option is provided
14918 for regression testing of mixed MIPS16/non-MIPS16 code generation, and is
14919 not intended for ordinary use in compiling user code.
14920
14921 @item -minterlink-mips16
14922 @itemx -mno-interlink-mips16
14923 @opindex minterlink-mips16
14924 @opindex mno-interlink-mips16
14925 Require (do not require) that non-MIPS16 code be link-compatible with
14926 MIPS16 code.
14927
14928 For example, non-MIPS16 code cannot jump directly to MIPS16 code;
14929 it must either use a call or an indirect jump. @option{-minterlink-mips16}
14930 therefore disables direct jumps unless GCC knows that the target of the
14931 jump is not MIPS16.
14932
14933 @item -mabi=32
14934 @itemx -mabi=o64
14935 @itemx -mabi=n32
14936 @itemx -mabi=64
14937 @itemx -mabi=eabi
14938 @opindex mabi=32
14939 @opindex mabi=o64
14940 @opindex mabi=n32
14941 @opindex mabi=64
14942 @opindex mabi=eabi
14943 Generate code for the given ABI@.
14944
14945 Note that the EABI has a 32-bit and a 64-bit variant. GCC normally
14946 generates 64-bit code when you select a 64-bit architecture, but you
14947 can use @option{-mgp32} to get 32-bit code instead.
14948
14949 For information about the O64 ABI, see
14950 @uref{http://gcc.gnu.org/@/projects/@/mipso64-abi.html}.
14951
14952 GCC supports a variant of the o32 ABI in which floating-point registers
14953 are 64 rather than 32 bits wide. You can select this combination with
14954 @option{-mabi=32} @option{-mfp64}. This ABI relies on the @samp{mthc1}
14955 and @samp{mfhc1} instructions and is therefore only supported for
14956 MIPS32R2 processors.
14957
14958 The register assignments for arguments and return values remain the
14959 same, but each scalar value is passed in a single 64-bit register
14960 rather than a pair of 32-bit registers. For example, scalar
14961 floating-point values are returned in @samp{$f0} only, not a
14962 @samp{$f0}/@samp{$f1} pair. The set of call-saved registers also
14963 remains the same, but all 64 bits are saved.
14964
14965 @item -mabicalls
14966 @itemx -mno-abicalls
14967 @opindex mabicalls
14968 @opindex mno-abicalls
14969 Generate (do not generate) code that is suitable for SVR4-style
14970 dynamic objects. @option{-mabicalls} is the default for SVR4-based
14971 systems.
14972
14973 @item -mshared
14974 @itemx -mno-shared
14975 Generate (do not generate) code that is fully position-independent,
14976 and that can therefore be linked into shared libraries. This option
14977 only affects @option{-mabicalls}.
14978
14979 All @option{-mabicalls} code has traditionally been position-independent,
14980 regardless of options like @option{-fPIC} and @option{-fpic}. However,
14981 as an extension, the GNU toolchain allows executables to use absolute
14982 accesses for locally-binding symbols. It can also use shorter GP
14983 initialization sequences and generate direct calls to locally-defined
14984 functions. This mode is selected by @option{-mno-shared}.
14985
14986 @option{-mno-shared} depends on binutils 2.16 or higher and generates
14987 objects that can only be linked by the GNU linker. However, the option
14988 does not affect the ABI of the final executable; it only affects the ABI
14989 of relocatable objects. Using @option{-mno-shared} will generally make
14990 executables both smaller and quicker.
14991
14992 @option{-mshared} is the default.
14993
14994 @item -mplt
14995 @itemx -mno-plt
14996 @opindex mplt
14997 @opindex mno-plt
14998 Assume (do not assume) that the static and dynamic linkers
14999 support PLTs and copy relocations. This option only affects
15000 @samp{-mno-shared -mabicalls}. For the n64 ABI, this option
15001 has no effect without @samp{-msym32}.
15002
15003 You can make @option{-mplt} the default by configuring
15004 GCC with @option{--with-mips-plt}. The default is
15005 @option{-mno-plt} otherwise.
15006
15007 @item -mxgot
15008 @itemx -mno-xgot
15009 @opindex mxgot
15010 @opindex mno-xgot
15011 Lift (do not lift) the usual restrictions on the size of the global
15012 offset table.
15013
15014 GCC normally uses a single instruction to load values from the GOT@.
15015 While this is relatively efficient, it will only work if the GOT
15016 is smaller than about 64k. Anything larger will cause the linker
15017 to report an error such as:
15018
15019 @cindex relocation truncated to fit (MIPS)
15020 @smallexample
15021 relocation truncated to fit: R_MIPS_GOT16 foobar
15022 @end smallexample
15023
15024 If this happens, you should recompile your code with @option{-mxgot}.
15025 It should then work with very large GOTs, although it will also be
15026 less efficient, since it will take three instructions to fetch the
15027 value of a global symbol.
15028
15029 Note that some linkers can create multiple GOTs. If you have such a
15030 linker, you should only need to use @option{-mxgot} when a single object
15031 file accesses more than 64k's worth of GOT entries. Very few do.
15032
15033 These options have no effect unless GCC is generating position
15034 independent code.
15035
15036 @item -mgp32
15037 @opindex mgp32
15038 Assume that general-purpose registers are 32 bits wide.
15039
15040 @item -mgp64
15041 @opindex mgp64
15042 Assume that general-purpose registers are 64 bits wide.
15043
15044 @item -mfp32
15045 @opindex mfp32
15046 Assume that floating-point registers are 32 bits wide.
15047
15048 @item -mfp64
15049 @opindex mfp64
15050 Assume that floating-point registers are 64 bits wide.
15051
15052 @item -mhard-float
15053 @opindex mhard-float
15054 Use floating-point coprocessor instructions.
15055
15056 @item -msoft-float
15057 @opindex msoft-float
15058 Do not use floating-point coprocessor instructions. Implement
15059 floating-point calculations using library calls instead.
15060
15061 @item -msingle-float
15062 @opindex msingle-float
15063 Assume that the floating-point coprocessor only supports single-precision
15064 operations.
15065
15066 @item -mdouble-float
15067 @opindex mdouble-float
15068 Assume that the floating-point coprocessor supports double-precision
15069 operations. This is the default.
15070
15071 @item -mllsc
15072 @itemx -mno-llsc
15073 @opindex mllsc
15074 @opindex mno-llsc
15075 Use (do not use) @samp{ll}, @samp{sc}, and @samp{sync} instructions to
15076 implement atomic memory built-in functions. When neither option is
15077 specified, GCC will use the instructions if the target architecture
15078 supports them.
15079
15080 @option{-mllsc} is useful if the runtime environment can emulate the
15081 instructions and @option{-mno-llsc} can be useful when compiling for
15082 nonstandard ISAs. You can make either option the default by
15083 configuring GCC with @option{--with-llsc} and @option{--without-llsc}
15084 respectively. @option{--with-llsc} is the default for some
15085 configurations; see the installation documentation for details.
15086
15087 @item -mdsp
15088 @itemx -mno-dsp
15089 @opindex mdsp
15090 @opindex mno-dsp
15091 Use (do not use) revision 1 of the MIPS DSP ASE@.
15092 @xref{MIPS DSP Built-in Functions}. This option defines the
15093 preprocessor macro @samp{__mips_dsp}. It also defines
15094 @samp{__mips_dsp_rev} to 1.
15095
15096 @item -mdspr2
15097 @itemx -mno-dspr2
15098 @opindex mdspr2
15099 @opindex mno-dspr2
15100 Use (do not use) revision 2 of the MIPS DSP ASE@.
15101 @xref{MIPS DSP Built-in Functions}. This option defines the
15102 preprocessor macros @samp{__mips_dsp} and @samp{__mips_dspr2}.
15103 It also defines @samp{__mips_dsp_rev} to 2.
15104
15105 @item -msmartmips
15106 @itemx -mno-smartmips
15107 @opindex msmartmips
15108 @opindex mno-smartmips
15109 Use (do not use) the MIPS SmartMIPS ASE.
15110
15111 @item -mpaired-single
15112 @itemx -mno-paired-single
15113 @opindex mpaired-single
15114 @opindex mno-paired-single
15115 Use (do not use) paired-single floating-point instructions.
15116 @xref{MIPS Paired-Single Support}. This option requires
15117 hardware floating-point support to be enabled.
15118
15119 @item -mdmx
15120 @itemx -mno-mdmx
15121 @opindex mdmx
15122 @opindex mno-mdmx
15123 Use (do not use) MIPS Digital Media Extension instructions.
15124 This option can only be used when generating 64-bit code and requires
15125 hardware floating-point support to be enabled.
15126
15127 @item -mips3d
15128 @itemx -mno-mips3d
15129 @opindex mips3d
15130 @opindex mno-mips3d
15131 Use (do not use) the MIPS-3D ASE@. @xref{MIPS-3D Built-in Functions}.
15132 The option @option{-mips3d} implies @option{-mpaired-single}.
15133
15134 @item -mmt
15135 @itemx -mno-mt
15136 @opindex mmt
15137 @opindex mno-mt
15138 Use (do not use) MT Multithreading instructions.
15139
15140 @item -mlong64
15141 @opindex mlong64
15142 Force @code{long} types to be 64 bits wide. See @option{-mlong32} for
15143 an explanation of the default and the way that the pointer size is
15144 determined.
15145
15146 @item -mlong32
15147 @opindex mlong32
15148 Force @code{long}, @code{int}, and pointer types to be 32 bits wide.
15149
15150 The default size of @code{int}s, @code{long}s and pointers depends on
15151 the ABI@. All the supported ABIs use 32-bit @code{int}s. The n64 ABI
15152 uses 64-bit @code{long}s, as does the 64-bit EABI; the others use
15153 32-bit @code{long}s. Pointers are the same size as @code{long}s,
15154 or the same size as integer registers, whichever is smaller.
15155
15156 @item -msym32
15157 @itemx -mno-sym32
15158 @opindex msym32
15159 @opindex mno-sym32
15160 Assume (do not assume) that all symbols have 32-bit values, regardless
15161 of the selected ABI@. This option is useful in combination with
15162 @option{-mabi=64} and @option{-mno-abicalls} because it allows GCC
15163 to generate shorter and faster references to symbolic addresses.
15164
15165 @item -G @var{num}
15166 @opindex G
15167 Put definitions of externally-visible data in a small data section
15168 if that data is no bigger than @var{num} bytes. GCC can then access
15169 the data more efficiently; see @option{-mgpopt} for details.
15170
15171 The default @option{-G} option depends on the configuration.
15172
15173 @item -mlocal-sdata
15174 @itemx -mno-local-sdata
15175 @opindex mlocal-sdata
15176 @opindex mno-local-sdata
15177 Extend (do not extend) the @option{-G} behavior to local data too,
15178 such as to static variables in C@. @option{-mlocal-sdata} is the
15179 default for all configurations.
15180
15181 If the linker complains that an application is using too much small data,
15182 you might want to try rebuilding the less performance-critical parts with
15183 @option{-mno-local-sdata}. You might also want to build large
15184 libraries with @option{-mno-local-sdata}, so that the libraries leave
15185 more room for the main program.
15186
15187 @item -mextern-sdata
15188 @itemx -mno-extern-sdata
15189 @opindex mextern-sdata
15190 @opindex mno-extern-sdata
15191 Assume (do not assume) that externally-defined data will be in
15192 a small data section if that data is within the @option{-G} limit.
15193 @option{-mextern-sdata} is the default for all configurations.
15194
15195 If you compile a module @var{Mod} with @option{-mextern-sdata} @option{-G
15196 @var{num}} @option{-mgpopt}, and @var{Mod} references a variable @var{Var}
15197 that is no bigger than @var{num} bytes, you must make sure that @var{Var}
15198 is placed in a small data section. If @var{Var} is defined by another
15199 module, you must either compile that module with a high-enough
15200 @option{-G} setting or attach a @code{section} attribute to @var{Var}'s
15201 definition. If @var{Var} is common, you must link the application
15202 with a high-enough @option{-G} setting.
15203
15204 The easiest way of satisfying these restrictions is to compile
15205 and link every module with the same @option{-G} option. However,
15206 you may wish to build a library that supports several different
15207 small data limits. You can do this by compiling the library with
15208 the highest supported @option{-G} setting and additionally using
15209 @option{-mno-extern-sdata} to stop the library from making assumptions
15210 about externally-defined data.
15211
15212 @item -mgpopt
15213 @itemx -mno-gpopt
15214 @opindex mgpopt
15215 @opindex mno-gpopt
15216 Use (do not use) GP-relative accesses for symbols that are known to be
15217 in a small data section; see @option{-G}, @option{-mlocal-sdata} and
15218 @option{-mextern-sdata}. @option{-mgpopt} is the default for all
15219 configurations.
15220
15221 @option{-mno-gpopt} is useful for cases where the @code{$gp} register
15222 might not hold the value of @code{_gp}. For example, if the code is
15223 part of a library that might be used in a boot monitor, programs that
15224 call boot monitor routines will pass an unknown value in @code{$gp}.
15225 (In such situations, the boot monitor itself would usually be compiled
15226 with @option{-G0}.)
15227
15228 @option{-mno-gpopt} implies @option{-mno-local-sdata} and
15229 @option{-mno-extern-sdata}.
15230
15231 @item -membedded-data
15232 @itemx -mno-embedded-data
15233 @opindex membedded-data
15234 @opindex mno-embedded-data
15235 Allocate variables to the read-only data section first if possible, then
15236 next in the small data section if possible, otherwise in data. This gives
15237 slightly slower code than the default, but reduces the amount of RAM required
15238 when executing, and thus may be preferred for some embedded systems.
15239
15240 @item -muninit-const-in-rodata
15241 @itemx -mno-uninit-const-in-rodata
15242 @opindex muninit-const-in-rodata
15243 @opindex mno-uninit-const-in-rodata
15244 Put uninitialized @code{const} variables in the read-only data section.
15245 This option is only meaningful in conjunction with @option{-membedded-data}.
15246
15247 @item -mcode-readable=@var{setting}
15248 @opindex mcode-readable
15249 Specify whether GCC may generate code that reads from executable sections.
15250 There are three possible settings:
15251
15252 @table @gcctabopt
15253 @item -mcode-readable=yes
15254 Instructions may freely access executable sections. This is the
15255 default setting.
15256
15257 @item -mcode-readable=pcrel
15258 MIPS16 PC-relative load instructions can access executable sections,
15259 but other instructions must not do so. This option is useful on 4KSc
15260 and 4KSd processors when the code TLBs have the Read Inhibit bit set.
15261 It is also useful on processors that can be configured to have a dual
15262 instruction/data SRAM interface and that, like the M4K, automatically
15263 redirect PC-relative loads to the instruction RAM.
15264
15265 @item -mcode-readable=no
15266 Instructions must not access executable sections. This option can be
15267 useful on targets that are configured to have a dual instruction/data
15268 SRAM interface but that (unlike the M4K) do not automatically redirect
15269 PC-relative loads to the instruction RAM.
15270 @end table
15271
15272 @item -msplit-addresses
15273 @itemx -mno-split-addresses
15274 @opindex msplit-addresses
15275 @opindex mno-split-addresses
15276 Enable (disable) use of the @code{%hi()} and @code{%lo()} assembler
15277 relocation operators. This option has been superseded by
15278 @option{-mexplicit-relocs} but is retained for backwards compatibility.
15279
15280 @item -mexplicit-relocs
15281 @itemx -mno-explicit-relocs
15282 @opindex mexplicit-relocs
15283 @opindex mno-explicit-relocs
15284 Use (do not use) assembler relocation operators when dealing with symbolic
15285 addresses. The alternative, selected by @option{-mno-explicit-relocs},
15286 is to use assembler macros instead.
15287
15288 @option{-mexplicit-relocs} is the default if GCC was configured
15289 to use an assembler that supports relocation operators.
15290
15291 @item -mcheck-zero-division
15292 @itemx -mno-check-zero-division
15293 @opindex mcheck-zero-division
15294 @opindex mno-check-zero-division
15295 Trap (do not trap) on integer division by zero.
15296
15297 The default is @option{-mcheck-zero-division}.
15298
15299 @item -mdivide-traps
15300 @itemx -mdivide-breaks
15301 @opindex mdivide-traps
15302 @opindex mdivide-breaks
15303 MIPS systems check for division by zero by generating either a
15304 conditional trap or a break instruction. Using traps results in
15305 smaller code, but is only supported on MIPS II and later. Also, some
15306 versions of the Linux kernel have a bug that prevents trap from
15307 generating the proper signal (@code{SIGFPE}). Use @option{-mdivide-traps} to
15308 allow conditional traps on architectures that support them and
15309 @option{-mdivide-breaks} to force the use of breaks.
15310
15311 The default is usually @option{-mdivide-traps}, but this can be
15312 overridden at configure time using @option{--with-divide=breaks}.
15313 Divide-by-zero checks can be completely disabled using
15314 @option{-mno-check-zero-division}.
15315
15316 @item -mmemcpy
15317 @itemx -mno-memcpy
15318 @opindex mmemcpy
15319 @opindex mno-memcpy
15320 Force (do not force) the use of @code{memcpy()} for non-trivial block
15321 moves. The default is @option{-mno-memcpy}, which allows GCC to inline
15322 most constant-sized copies.
15323
15324 @item -mlong-calls
15325 @itemx -mno-long-calls
15326 @opindex mlong-calls
15327 @opindex mno-long-calls
15328 Disable (do not disable) use of the @code{jal} instruction. Calling
15329 functions using @code{jal} is more efficient but requires the caller
15330 and callee to be in the same 256 megabyte segment.
15331
15332 This option has no effect on abicalls code. The default is
15333 @option{-mno-long-calls}.
15334
15335 @item -mmad
15336 @itemx -mno-mad
15337 @opindex mmad
15338 @opindex mno-mad
15339 Enable (disable) use of the @code{mad}, @code{madu} and @code{mul}
15340 instructions, as provided by the R4650 ISA@.
15341
15342 @item -mfused-madd
15343 @itemx -mno-fused-madd
15344 @opindex mfused-madd
15345 @opindex mno-fused-madd
15346 Enable (disable) use of the floating point multiply-accumulate
15347 instructions, when they are available. The default is
15348 @option{-mfused-madd}.
15349
15350 When multiply-accumulate instructions are used, the intermediate
15351 product is calculated to infinite precision and is not subject to
15352 the FCSR Flush to Zero bit. This may be undesirable in some
15353 circumstances.
15354
15355 @item -nocpp
15356 @opindex nocpp
15357 Tell the MIPS assembler to not run its preprocessor over user
15358 assembler files (with a @samp{.s} suffix) when assembling them.
15359
15360 @item -mfix-24k
15361 @item -mno-fix-24k
15362 @opindex mfix-24k
15363 @opindex mno-fix-24k
15364 Work around the 24K E48 (lost data on stores during refill) errata.
15365 The workarounds are implemented by the assembler rather than by GCC.
15366
15367 @item -mfix-r4000
15368 @itemx -mno-fix-r4000
15369 @opindex mfix-r4000
15370 @opindex mno-fix-r4000
15371 Work around certain R4000 CPU errata:
15372 @itemize @minus
15373 @item
15374 A double-word or a variable shift may give an incorrect result if executed
15375 immediately after starting an integer division.
15376 @item
15377 A double-word or a variable shift may give an incorrect result if executed
15378 while an integer multiplication is in progress.
15379 @item
15380 An integer division may give an incorrect result if started in a delay slot
15381 of a taken branch or a jump.
15382 @end itemize
15383
15384 @item -mfix-r4400
15385 @itemx -mno-fix-r4400
15386 @opindex mfix-r4400
15387 @opindex mno-fix-r4400
15388 Work around certain R4400 CPU errata:
15389 @itemize @minus
15390 @item
15391 A double-word or a variable shift may give an incorrect result if executed
15392 immediately after starting an integer division.
15393 @end itemize
15394
15395 @item -mfix-r10000
15396 @itemx -mno-fix-r10000
15397 @opindex mfix-r10000
15398 @opindex mno-fix-r10000
15399 Work around certain R10000 errata:
15400 @itemize @minus
15401 @item
15402 @code{ll}/@code{sc} sequences may not behave atomically on revisions
15403 prior to 3.0. They may deadlock on revisions 2.6 and earlier.
15404 @end itemize
15405
15406 This option can only be used if the target architecture supports
15407 branch-likely instructions. @option{-mfix-r10000} is the default when
15408 @option{-march=r10000} is used; @option{-mno-fix-r10000} is the default
15409 otherwise.
15410
15411 @item -mfix-vr4120
15412 @itemx -mno-fix-vr4120
15413 @opindex mfix-vr4120
15414 Work around certain VR4120 errata:
15415 @itemize @minus
15416 @item
15417 @code{dmultu} does not always produce the correct result.
15418 @item
15419 @code{div} and @code{ddiv} do not always produce the correct result if one
15420 of the operands is negative.
15421 @end itemize
15422 The workarounds for the division errata rely on special functions in
15423 @file{libgcc.a}. At present, these functions are only provided by
15424 the @code{mips64vr*-elf} configurations.
15425
15426 Other VR4120 errata require a nop to be inserted between certain pairs of
15427 instructions. These errata are handled by the assembler, not by GCC itself.
15428
15429 @item -mfix-vr4130
15430 @opindex mfix-vr4130
15431 Work around the VR4130 @code{mflo}/@code{mfhi} errata. The
15432 workarounds are implemented by the assembler rather than by GCC,
15433 although GCC will avoid using @code{mflo} and @code{mfhi} if the
15434 VR4130 @code{macc}, @code{macchi}, @code{dmacc} and @code{dmacchi}
15435 instructions are available instead.
15436
15437 @item -mfix-sb1
15438 @itemx -mno-fix-sb1
15439 @opindex mfix-sb1
15440 Work around certain SB-1 CPU core errata.
15441 (This flag currently works around the SB-1 revision 2
15442 ``F1'' and ``F2'' floating point errata.)
15443
15444 @item -mr10k-cache-barrier=@var{setting}
15445 @opindex mr10k-cache-barrier
15446 Specify whether GCC should insert cache barriers to avoid the
15447 side-effects of speculation on R10K processors.
15448
15449 In common with many processors, the R10K tries to predict the outcome
15450 of a conditional branch and speculatively executes instructions from
15451 the ``taken'' branch. It later aborts these instructions if the
15452 predicted outcome was wrong. However, on the R10K, even aborted
15453 instructions can have side effects.
15454
15455 This problem only affects kernel stores and, depending on the system,
15456 kernel loads. As an example, a speculatively-executed store may load
15457 the target memory into cache and mark the cache line as dirty, even if
15458 the store itself is later aborted. If a DMA operation writes to the
15459 same area of memory before the ``dirty'' line is flushed, the cached
15460 data will overwrite the DMA-ed data. See the R10K processor manual
15461 for a full description, including other potential problems.
15462
15463 One workaround is to insert cache barrier instructions before every memory
15464 access that might be speculatively executed and that might have side
15465 effects even if aborted. @option{-mr10k-cache-barrier=@var{setting}}
15466 controls GCC's implementation of this workaround. It assumes that
15467 aborted accesses to any byte in the following regions will not have
15468 side effects:
15469
15470 @enumerate
15471 @item
15472 the memory occupied by the current function's stack frame;
15473
15474 @item
15475 the memory occupied by an incoming stack argument;
15476
15477 @item
15478 the memory occupied by an object with a link-time-constant address.
15479 @end enumerate
15480
15481 It is the kernel's responsibility to ensure that speculative
15482 accesses to these regions are indeed safe.
15483
15484 If the input program contains a function declaration such as:
15485
15486 @smallexample
15487 void foo (void);
15488 @end smallexample
15489
15490 then the implementation of @code{foo} must allow @code{j foo} and
15491 @code{jal foo} to be executed speculatively. GCC honors this
15492 restriction for functions it compiles itself. It expects non-GCC
15493 functions (such as hand-written assembly code) to do the same.
15494
15495 The option has three forms:
15496
15497 @table @gcctabopt
15498 @item -mr10k-cache-barrier=load-store
15499 Insert a cache barrier before a load or store that might be
15500 speculatively executed and that might have side effects even
15501 if aborted.
15502
15503 @item -mr10k-cache-barrier=store
15504 Insert a cache barrier before a store that might be speculatively
15505 executed and that might have side effects even if aborted.
15506
15507 @item -mr10k-cache-barrier=none
15508 Disable the insertion of cache barriers. This is the default setting.
15509 @end table
15510
15511 @item -mflush-func=@var{func}
15512 @itemx -mno-flush-func
15513 @opindex mflush-func
15514 Specifies the function to call to flush the I and D caches, or to not
15515 call any such function. If called, the function must take the same
15516 arguments as the common @code{_flush_func()}, that is, the address of the
15517 memory range for which the cache is being flushed, the size of the
15518 memory range, and the number 3 (to flush both caches). The default
15519 depends on the target GCC was configured for, but commonly is either
15520 @samp{_flush_func} or @samp{__cpu_flush}.
15521
15522 @item mbranch-cost=@var{num}
15523 @opindex mbranch-cost
15524 Set the cost of branches to roughly @var{num} ``simple'' instructions.
15525 This cost is only a heuristic and is not guaranteed to produce
15526 consistent results across releases. A zero cost redundantly selects
15527 the default, which is based on the @option{-mtune} setting.
15528
15529 @item -mbranch-likely
15530 @itemx -mno-branch-likely
15531 @opindex mbranch-likely
15532 @opindex mno-branch-likely
15533 Enable or disable use of Branch Likely instructions, regardless of the
15534 default for the selected architecture. By default, Branch Likely
15535 instructions may be generated if they are supported by the selected
15536 architecture. An exception is for the MIPS32 and MIPS64 architectures
15537 and processors which implement those architectures; for those, Branch
15538 Likely instructions will not be generated by default because the MIPS32
15539 and MIPS64 architectures specifically deprecate their use.
15540
15541 @item -mfp-exceptions
15542 @itemx -mno-fp-exceptions
15543 @opindex mfp-exceptions
15544 Specifies whether FP exceptions are enabled. This affects how we schedule
15545 FP instructions for some processors. The default is that FP exceptions are
15546 enabled.
15547
15548 For instance, on the SB-1, if FP exceptions are disabled, and we are emitting
15549 64-bit code, then we can use both FP pipes. Otherwise, we can only use one
15550 FP pipe.
15551
15552 @item -mvr4130-align
15553 @itemx -mno-vr4130-align
15554 @opindex mvr4130-align
15555 The VR4130 pipeline is two-way superscalar, but can only issue two
15556 instructions together if the first one is 8-byte aligned. When this
15557 option is enabled, GCC will align pairs of instructions that it
15558 thinks should execute in parallel.
15559
15560 This option only has an effect when optimizing for the VR4130.
15561 It normally makes code faster, but at the expense of making it bigger.
15562 It is enabled by default at optimization level @option{-O3}.
15563
15564 @item -msynci
15565 @itemx -mno-synci
15566 @opindex msynci
15567 Enable (disable) generation of @code{synci} instructions on
15568 architectures that support it. The @code{synci} instructions (if
15569 enabled) will be generated when @code{__builtin___clear_cache()} is
15570 compiled.
15571
15572 This option defaults to @code{-mno-synci}, but the default can be
15573 overridden by configuring with @code{--with-synci}.
15574
15575 When compiling code for single processor systems, it is generally safe
15576 to use @code{synci}. However, on many multi-core (SMP) systems, it
15577 will not invalidate the instruction caches on all cores and may lead
15578 to undefined behavior.
15579
15580 @item -mrelax-pic-calls
15581 @itemx -mno-relax-pic-calls
15582 @opindex mrelax-pic-calls
15583 Try to turn PIC calls that are normally dispatched via register
15584 @code{$25} into direct calls. This is only possible if the linker can
15585 resolve the destination at link-time and if the destination is within
15586 range for a direct call.
15587
15588 @option{-mrelax-pic-calls} is the default if GCC was configured to use
15589 an assembler and a linker that supports the @code{.reloc} assembly
15590 directive and @code{-mexplicit-relocs} is in effect. With
15591 @code{-mno-explicit-relocs}, this optimization can be performed by the
15592 assembler and the linker alone without help from the compiler.
15593
15594 @item -mmcount-ra-address
15595 @itemx -mno-mcount-ra-address
15596 @opindex mmcount-ra-address
15597 @opindex mno-mcount-ra-address
15598 Emit (do not emit) code that allows @code{_mcount} to modify the
15599 calling function's return address. When enabled, this option extends
15600 the usual @code{_mcount} interface with a new @var{ra-address}
15601 parameter, which has type @code{intptr_t *} and is passed in register
15602 @code{$12}. @code{_mcount} can then modify the return address by
15603 doing both of the following:
15604 @itemize
15605 @item
15606 Returning the new address in register @code{$31}.
15607 @item
15608 Storing the new address in @code{*@var{ra-address}},
15609 if @var{ra-address} is nonnull.
15610 @end itemize
15611
15612 The default is @option{-mno-mcount-ra-address}.
15613
15614 @end table
15615
15616 @node MMIX Options
15617 @subsection MMIX Options
15618 @cindex MMIX Options
15619
15620 These options are defined for the MMIX:
15621
15622 @table @gcctabopt
15623 @item -mlibfuncs
15624 @itemx -mno-libfuncs
15625 @opindex mlibfuncs
15626 @opindex mno-libfuncs
15627 Specify that intrinsic library functions are being compiled, passing all
15628 values in registers, no matter the size.
15629
15630 @item -mepsilon
15631 @itemx -mno-epsilon
15632 @opindex mepsilon
15633 @opindex mno-epsilon
15634 Generate floating-point comparison instructions that compare with respect
15635 to the @code{rE} epsilon register.
15636
15637 @item -mabi=mmixware
15638 @itemx -mabi=gnu
15639 @opindex mabi=mmixware
15640 @opindex mabi=gnu
15641 Generate code that passes function parameters and return values that (in
15642 the called function) are seen as registers @code{$0} and up, as opposed to
15643 the GNU ABI which uses global registers @code{$231} and up.
15644
15645 @item -mzero-extend
15646 @itemx -mno-zero-extend
15647 @opindex mzero-extend
15648 @opindex mno-zero-extend
15649 When reading data from memory in sizes shorter than 64 bits, use (do not
15650 use) zero-extending load instructions by default, rather than
15651 sign-extending ones.
15652
15653 @item -mknuthdiv
15654 @itemx -mno-knuthdiv
15655 @opindex mknuthdiv
15656 @opindex mno-knuthdiv
15657 Make the result of a division yielding a remainder have the same sign as
15658 the divisor. With the default, @option{-mno-knuthdiv}, the sign of the
15659 remainder follows the sign of the dividend. Both methods are
15660 arithmetically valid, the latter being almost exclusively used.
15661
15662 @item -mtoplevel-symbols
15663 @itemx -mno-toplevel-symbols
15664 @opindex mtoplevel-symbols
15665 @opindex mno-toplevel-symbols
15666 Prepend (do not prepend) a @samp{:} to all global symbols, so the assembly
15667 code can be used with the @code{PREFIX} assembly directive.
15668
15669 @item -melf
15670 @opindex melf
15671 Generate an executable in the ELF format, rather than the default
15672 @samp{mmo} format used by the @command{mmix} simulator.
15673
15674 @item -mbranch-predict
15675 @itemx -mno-branch-predict
15676 @opindex mbranch-predict
15677 @opindex mno-branch-predict
15678 Use (do not use) the probable-branch instructions, when static branch
15679 prediction indicates a probable branch.
15680
15681 @item -mbase-addresses
15682 @itemx -mno-base-addresses
15683 @opindex mbase-addresses
15684 @opindex mno-base-addresses
15685 Generate (do not generate) code that uses @emph{base addresses}. Using a
15686 base address automatically generates a request (handled by the assembler
15687 and the linker) for a constant to be set up in a global register. The
15688 register is used for one or more base address requests within the range 0
15689 to 255 from the value held in the register. The generally leads to short
15690 and fast code, but the number of different data items that can be
15691 addressed is limited. This means that a program that uses lots of static
15692 data may require @option{-mno-base-addresses}.
15693
15694 @item -msingle-exit
15695 @itemx -mno-single-exit
15696 @opindex msingle-exit
15697 @opindex mno-single-exit
15698 Force (do not force) generated code to have a single exit point in each
15699 function.
15700 @end table
15701
15702 @node MN10300 Options
15703 @subsection MN10300 Options
15704 @cindex MN10300 options
15705
15706 These @option{-m} options are defined for Matsushita MN10300 architectures:
15707
15708 @table @gcctabopt
15709 @item -mmult-bug
15710 @opindex mmult-bug
15711 Generate code to avoid bugs in the multiply instructions for the MN10300
15712 processors. This is the default.
15713
15714 @item -mno-mult-bug
15715 @opindex mno-mult-bug
15716 Do not generate code to avoid bugs in the multiply instructions for the
15717 MN10300 processors.
15718
15719 @item -mam33
15720 @opindex mam33
15721 Generate code which uses features specific to the AM33 processor.
15722
15723 @item -mno-am33
15724 @opindex mno-am33
15725 Do not generate code which uses features specific to the AM33 processor. This
15726 is the default.
15727
15728 @item -mam33-2
15729 @opindex mam33-2
15730 Generate code which uses features specific to the AM33/2.0 processor.
15731
15732 @item -mam34
15733 @opindex mam34
15734 Generate code which uses features specific to the AM34 processor.
15735
15736 @item -mtune=@var{cpu-type}
15737 @opindex mtune
15738 Use the timing characteristics of the indicated CPU type when
15739 scheduling instructions. This does not change the targeted processor
15740 type. The CPU type must be one of @samp{mn10300}, @samp{am33},
15741 @samp{am33-2} or @samp{am34}.
15742
15743 @item -mreturn-pointer-on-d0
15744 @opindex mreturn-pointer-on-d0
15745 When generating a function which returns a pointer, return the pointer
15746 in both @code{a0} and @code{d0}. Otherwise, the pointer is returned
15747 only in a0, and attempts to call such functions without a prototype
15748 would result in errors. Note that this option is on by default; use
15749 @option{-mno-return-pointer-on-d0} to disable it.
15750
15751 @item -mno-crt0
15752 @opindex mno-crt0
15753 Do not link in the C run-time initialization object file.
15754
15755 @item -mrelax
15756 @opindex mrelax
15757 Indicate to the linker that it should perform a relaxation optimization pass
15758 to shorten branches, calls and absolute memory addresses. This option only
15759 has an effect when used on the command line for the final link step.
15760
15761 This option makes symbolic debugging impossible.
15762
15763 @item -mliw
15764 @opindex mliw
15765 Allow the compiler to generate @emph{Long Instruction Word}
15766 instructions if the target is the @samp{AM33} or later. This is the
15767 default. This option defines the preprocessor macro @samp{__LIW__}.
15768
15769 @item -mnoliw
15770 @opindex mnoliw
15771 Do not allow the compiler to generate @emph{Long Instruction Word}
15772 instructions. This option defines the preprocessor macro
15773 @samp{__NO_LIW__}.
15774
15775 @item -msetlb
15776 @opindex msetlb
15777 Allow the compiler to generate the @emph{SETLB} and @emph{Lcc}
15778 instructions if the target is the @samp{AM33} or later. This is the
15779 default. This option defines the preprocessor macro @samp{__SETLB__}.
15780
15781 @item -mnosetlb
15782 @opindex mnosetlb
15783 Do not allow the compiler to generate @emph{SETLB} or @emph{Lcc}
15784 instructions. This option defines the preprocessor macro
15785 @samp{__NO_SETLB__}.
15786
15787 @end table
15788
15789 @node PDP-11 Options
15790 @subsection PDP-11 Options
15791 @cindex PDP-11 Options
15792
15793 These options are defined for the PDP-11:
15794
15795 @table @gcctabopt
15796 @item -mfpu
15797 @opindex mfpu
15798 Use hardware FPP floating point. This is the default. (FIS floating
15799 point on the PDP-11/40 is not supported.)
15800
15801 @item -msoft-float
15802 @opindex msoft-float
15803 Do not use hardware floating point.
15804
15805 @item -mac0
15806 @opindex mac0
15807 Return floating-point results in ac0 (fr0 in Unix assembler syntax).
15808
15809 @item -mno-ac0
15810 @opindex mno-ac0
15811 Return floating-point results in memory. This is the default.
15812
15813 @item -m40
15814 @opindex m40
15815 Generate code for a PDP-11/40.
15816
15817 @item -m45
15818 @opindex m45
15819 Generate code for a PDP-11/45. This is the default.
15820
15821 @item -m10
15822 @opindex m10
15823 Generate code for a PDP-11/10.
15824
15825 @item -mbcopy-builtin
15826 @opindex mbcopy-builtin
15827 Use inline @code{movmemhi} patterns for copying memory. This is the
15828 default.
15829
15830 @item -mbcopy
15831 @opindex mbcopy
15832 Do not use inline @code{movmemhi} patterns for copying memory.
15833
15834 @item -mint16
15835 @itemx -mno-int32
15836 @opindex mint16
15837 @opindex mno-int32
15838 Use 16-bit @code{int}. This is the default.
15839
15840 @item -mint32
15841 @itemx -mno-int16
15842 @opindex mint32
15843 @opindex mno-int16
15844 Use 32-bit @code{int}.
15845
15846 @item -mfloat64
15847 @itemx -mno-float32
15848 @opindex mfloat64
15849 @opindex mno-float32
15850 Use 64-bit @code{float}. This is the default.
15851
15852 @item -mfloat32
15853 @itemx -mno-float64
15854 @opindex mfloat32
15855 @opindex mno-float64
15856 Use 32-bit @code{float}.
15857
15858 @item -mabshi
15859 @opindex mabshi
15860 Use @code{abshi2} pattern. This is the default.
15861
15862 @item -mno-abshi
15863 @opindex mno-abshi
15864 Do not use @code{abshi2} pattern.
15865
15866 @item -mbranch-expensive
15867 @opindex mbranch-expensive
15868 Pretend that branches are expensive. This is for experimenting with
15869 code generation only.
15870
15871 @item -mbranch-cheap
15872 @opindex mbranch-cheap
15873 Do not pretend that branches are expensive. This is the default.
15874
15875 @item -munix-asm
15876 @opindex munix-asm
15877 Use Unix assembler syntax. This is the default when configured for
15878 @samp{pdp11-*-bsd}.
15879
15880 @item -mdec-asm
15881 @opindex mdec-asm
15882 Use DEC assembler syntax. This is the default when configured for any
15883 PDP-11 target other than @samp{pdp11-*-bsd}.
15884 @end table
15885
15886 @node picoChip Options
15887 @subsection picoChip Options
15888 @cindex picoChip options
15889
15890 These @samp{-m} options are defined for picoChip implementations:
15891
15892 @table @gcctabopt
15893
15894 @item -mae=@var{ae_type}
15895 @opindex mcpu
15896 Set the instruction set, register set, and instruction scheduling
15897 parameters for array element type @var{ae_type}. Supported values
15898 for @var{ae_type} are @samp{ANY}, @samp{MUL}, and @samp{MAC}.
15899
15900 @option{-mae=ANY} selects a completely generic AE type. Code
15901 generated with this option will run on any of the other AE types. The
15902 code will not be as efficient as it would be if compiled for a specific
15903 AE type, and some types of operation (e.g., multiplication) will not
15904 work properly on all types of AE.
15905
15906 @option{-mae=MUL} selects a MUL AE type. This is the most useful AE type
15907 for compiled code, and is the default.
15908
15909 @option{-mae=MAC} selects a DSP-style MAC AE. Code compiled with this
15910 option may suffer from poor performance of byte (char) manipulation,
15911 since the DSP AE does not provide hardware support for byte load/stores.
15912
15913 @item -msymbol-as-address
15914 Enable the compiler to directly use a symbol name as an address in a
15915 load/store instruction, without first loading it into a
15916 register. Typically, the use of this option will generate larger
15917 programs, which run faster than when the option isn't used. However, the
15918 results vary from program to program, so it is left as a user option,
15919 rather than being permanently enabled.
15920
15921 @item -mno-inefficient-warnings
15922 Disables warnings about the generation of inefficient code. These
15923 warnings can be generated, for example, when compiling code which
15924 performs byte-level memory operations on the MAC AE type. The MAC AE has
15925 no hardware support for byte-level memory operations, so all byte
15926 load/stores must be synthesized from word load/store operations. This is
15927 inefficient and a warning will be generated indicating to the programmer
15928 that they should rewrite the code to avoid byte operations, or to target
15929 an AE type which has the necessary hardware support. This option enables
15930 the warning to be turned off.
15931
15932 @end table
15933
15934 @node PowerPC Options
15935 @subsection PowerPC Options
15936 @cindex PowerPC options
15937
15938 These are listed under @xref{RS/6000 and PowerPC Options}.
15939
15940 @node RL78 Options
15941 @subsection RL78 Options
15942 @cindex RL78 Options
15943
15944 @table @gcctabopt
15945
15946 @item -msim
15947 @opindex msim
15948 Links in additional target libraries to support operation within a
15949 simulator.
15950
15951 @item -mmul=none
15952 @itemx -mmul=g13
15953 @itemx -mmul=rl78
15954 @opindex mmul
15955 Specifies the type of hardware multiplication support to be used. The
15956 default is @code{none}, which uses software multiplication functions.
15957 The @code{g13} option is for the hardware multiply/divide peripheral
15958 only on the RL78/G13 targets. The @code{rl78} option is for the
15959 standard hardware multiplication defined in the RL78 software manual.
15960
15961 @end table
15962
15963 @node RS/6000 and PowerPC Options
15964 @subsection IBM RS/6000 and PowerPC Options
15965 @cindex RS/6000 and PowerPC Options
15966 @cindex IBM RS/6000 and PowerPC Options
15967
15968 These @samp{-m} options are defined for the IBM RS/6000 and PowerPC:
15969 @table @gcctabopt
15970 @item -mpower
15971 @itemx -mno-power
15972 @itemx -mpower2
15973 @itemx -mno-power2
15974 @itemx -mpowerpc
15975 @itemx -mno-powerpc
15976 @itemx -mpowerpc-gpopt
15977 @itemx -mno-powerpc-gpopt
15978 @itemx -mpowerpc-gfxopt
15979 @itemx -mno-powerpc-gfxopt
15980 @need 800
15981 @itemx -mpowerpc64
15982 @itemx -mno-powerpc64
15983 @itemx -mmfcrf
15984 @itemx -mno-mfcrf
15985 @itemx -mpopcntb
15986 @itemx -mno-popcntb
15987 @itemx -mpopcntd
15988 @itemx -mno-popcntd
15989 @itemx -mfprnd
15990 @itemx -mno-fprnd
15991 @need 800
15992 @itemx -mcmpb
15993 @itemx -mno-cmpb
15994 @itemx -mmfpgpr
15995 @itemx -mno-mfpgpr
15996 @itemx -mhard-dfp
15997 @itemx -mno-hard-dfp
15998 @opindex mpower
15999 @opindex mno-power
16000 @opindex mpower2
16001 @opindex mno-power2
16002 @opindex mpowerpc
16003 @opindex mno-powerpc
16004 @opindex mpowerpc-gpopt
16005 @opindex mno-powerpc-gpopt
16006 @opindex mpowerpc-gfxopt
16007 @opindex mno-powerpc-gfxopt
16008 @opindex mpowerpc64
16009 @opindex mno-powerpc64
16010 @opindex mmfcrf
16011 @opindex mno-mfcrf
16012 @opindex mpopcntb
16013 @opindex mno-popcntb
16014 @opindex mpopcntd
16015 @opindex mno-popcntd
16016 @opindex mfprnd
16017 @opindex mno-fprnd
16018 @opindex mcmpb
16019 @opindex mno-cmpb
16020 @opindex mmfpgpr
16021 @opindex mno-mfpgpr
16022 @opindex mhard-dfp
16023 @opindex mno-hard-dfp
16024 GCC supports two related instruction set architectures for the
16025 RS/6000 and PowerPC@. The @dfn{POWER} instruction set are those
16026 instructions supported by the @samp{rios} chip set used in the original
16027 RS/6000 systems and the @dfn{PowerPC} instruction set is the
16028 architecture of the Freescale MPC5xx, MPC6xx, MPC8xx microprocessors, and
16029 the IBM 4xx, 6xx, and follow-on microprocessors.
16030
16031 Neither architecture is a subset of the other. However there is a
16032 large common subset of instructions supported by both. An MQ
16033 register is included in processors supporting the POWER architecture.
16034
16035 You use these options to specify which instructions are available on the
16036 processor you are using. The default value of these options is
16037 determined when configuring GCC@. Specifying the
16038 @option{-mcpu=@var{cpu_type}} overrides the specification of these
16039 options. We recommend you use the @option{-mcpu=@var{cpu_type}} option
16040 rather than the options listed above.
16041
16042 The @option{-mpower} option allows GCC to generate instructions that
16043 are found only in the POWER architecture and to use the MQ register.
16044 Specifying @option{-mpower2} implies @option{-power} and also allows GCC
16045 to generate instructions that are present in the POWER2 architecture but
16046 not the original POWER architecture.
16047
16048 The @option{-mpowerpc} option allows GCC to generate instructions that
16049 are found only in the 32-bit subset of the PowerPC architecture.
16050 Specifying @option{-mpowerpc-gpopt} implies @option{-mpowerpc} and also allows
16051 GCC to use the optional PowerPC architecture instructions in the
16052 General Purpose group, including floating-point square root. Specifying
16053 @option{-mpowerpc-gfxopt} implies @option{-mpowerpc} and also allows GCC to
16054 use the optional PowerPC architecture instructions in the Graphics
16055 group, including floating-point select.
16056
16057 The @option{-mmfcrf} option allows GCC to generate the move from
16058 condition register field instruction implemented on the POWER4
16059 processor and other processors that support the PowerPC V2.01
16060 architecture.
16061 The @option{-mpopcntb} option allows GCC to generate the popcount and
16062 double precision FP reciprocal estimate instruction implemented on the
16063 POWER5 processor and other processors that support the PowerPC V2.02
16064 architecture.
16065 The @option{-mpopcntd} option allows GCC to generate the popcount
16066 instruction implemented on the POWER7 processor and other processors
16067 that support the PowerPC V2.06 architecture.
16068 The @option{-mfprnd} option allows GCC to generate the FP round to
16069 integer instructions implemented on the POWER5+ processor and other
16070 processors that support the PowerPC V2.03 architecture.
16071 The @option{-mcmpb} option allows GCC to generate the compare bytes
16072 instruction implemented on the POWER6 processor and other processors
16073 that support the PowerPC V2.05 architecture.
16074 The @option{-mmfpgpr} option allows GCC to generate the FP move to/from
16075 general purpose register instructions implemented on the POWER6X
16076 processor and other processors that support the extended PowerPC V2.05
16077 architecture.
16078 The @option{-mhard-dfp} option allows GCC to generate the decimal floating
16079 point instructions implemented on some POWER processors.
16080
16081 The @option{-mpowerpc64} option allows GCC to generate the additional
16082 64-bit instructions that are found in the full PowerPC64 architecture
16083 and to treat GPRs as 64-bit, doubleword quantities. GCC defaults to
16084 @option{-mno-powerpc64}.
16085
16086 If you specify both @option{-mno-power} and @option{-mno-powerpc}, GCC
16087 will use only the instructions in the common subset of both
16088 architectures plus some special AIX common-mode calls, and will not use
16089 the MQ register. Specifying both @option{-mpower} and @option{-mpowerpc}
16090 permits GCC to use any instruction from either architecture and to
16091 allow use of the MQ register; specify this for the Motorola MPC601.
16092
16093 @item -mnew-mnemonics
16094 @itemx -mold-mnemonics
16095 @opindex mnew-mnemonics
16096 @opindex mold-mnemonics
16097 Select which mnemonics to use in the generated assembler code. With
16098 @option{-mnew-mnemonics}, GCC uses the assembler mnemonics defined for
16099 the PowerPC architecture. With @option{-mold-mnemonics} it uses the
16100 assembler mnemonics defined for the POWER architecture. Instructions
16101 defined in only one architecture have only one mnemonic; GCC uses that
16102 mnemonic irrespective of which of these options is specified.
16103
16104 GCC defaults to the mnemonics appropriate for the architecture in
16105 use. Specifying @option{-mcpu=@var{cpu_type}} sometimes overrides the
16106 value of these option. Unless you are building a cross-compiler, you
16107 should normally not specify either @option{-mnew-mnemonics} or
16108 @option{-mold-mnemonics}, but should instead accept the default.
16109
16110 @item -mcpu=@var{cpu_type}
16111 @opindex mcpu
16112 Set architecture type, register usage, choice of mnemonics, and
16113 instruction scheduling parameters for machine type @var{cpu_type}.
16114 Supported values for @var{cpu_type} are @samp{401}, @samp{403},
16115 @samp{405}, @samp{405fp}, @samp{440}, @samp{440fp}, @samp{464}, @samp{464fp},
16116 @samp{476}, @samp{476fp}, @samp{505}, @samp{601}, @samp{602}, @samp{603},
16117 @samp{603e}, @samp{604}, @samp{604e}, @samp{620}, @samp{630}, @samp{740},
16118 @samp{7400}, @samp{7450}, @samp{750}, @samp{801}, @samp{821}, @samp{823},
16119 @samp{860}, @samp{970}, @samp{8540}, @samp{a2}, @samp{e300c2},
16120 @samp{e300c3}, @samp{e500mc}, @samp{e500mc64}, @samp{ec603e}, @samp{G3},
16121 @samp{G4}, @samp{G5}, @samp{titan}, @samp{power}, @samp{power2}, @samp{power3},
16122 @samp{power4}, @samp{power5}, @samp{power5+}, @samp{power6}, @samp{power6x},
16123 @samp{power7}, @samp{common}, @samp{powerpc}, @samp{powerpc64}, @samp{rios},
16124 @samp{rios1}, @samp{rios2}, @samp{rsc}, and @samp{rs64}.
16125
16126 @option{-mcpu=common} selects a completely generic processor. Code
16127 generated under this option will run on any POWER or PowerPC processor.
16128 GCC will use only the instructions in the common subset of both
16129 architectures, and will not use the MQ register. GCC assumes a generic
16130 processor model for scheduling purposes.
16131
16132 @option{-mcpu=power}, @option{-mcpu=power2}, @option{-mcpu=powerpc}, and
16133 @option{-mcpu=powerpc64} specify generic POWER, POWER2, pure 32-bit
16134 PowerPC (i.e., not MPC601), and 64-bit PowerPC architecture machine
16135 types, with an appropriate, generic processor model assumed for
16136 scheduling purposes.
16137
16138 The other options specify a specific processor. Code generated under
16139 those options will run best on that processor, and may not run at all on
16140 others.
16141
16142 The @option{-mcpu} options automatically enable or disable the
16143 following options:
16144
16145 @gccoptlist{-maltivec -mfprnd -mhard-float -mmfcrf -mmultiple @gol
16146 -mnew-mnemonics -mpopcntb -mpopcntd -mpower -mpower2 -mpowerpc64 @gol
16147 -mpowerpc-gpopt -mpowerpc-gfxopt -msingle-float -mdouble-float @gol
16148 -msimple-fpu -mstring -mmulhw -mdlmzb -mmfpgpr -mvsx}
16149
16150 The particular options set for any particular CPU will vary between
16151 compiler versions, depending on what setting seems to produce optimal
16152 code for that CPU; it doesn't necessarily reflect the actual hardware's
16153 capabilities. If you wish to set an individual option to a particular
16154 value, you may specify it after the @option{-mcpu} option, like
16155 @samp{-mcpu=970 -mno-altivec}.
16156
16157 On AIX, the @option{-maltivec} and @option{-mpowerpc64} options are
16158 not enabled or disabled by the @option{-mcpu} option at present because
16159 AIX does not have full support for these options. You may still
16160 enable or disable them individually if you're sure it'll work in your
16161 environment.
16162
16163 @item -mtune=@var{cpu_type}
16164 @opindex mtune
16165 Set the instruction scheduling parameters for machine type
16166 @var{cpu_type}, but do not set the architecture type, register usage, or
16167 choice of mnemonics, as @option{-mcpu=@var{cpu_type}} would. The same
16168 values for @var{cpu_type} are used for @option{-mtune} as for
16169 @option{-mcpu}. If both are specified, the code generated will use the
16170 architecture, registers, and mnemonics set by @option{-mcpu}, but the
16171 scheduling parameters set by @option{-mtune}.
16172
16173 @item -mcmodel=small
16174 @opindex mcmodel=small
16175 Generate PowerPC64 code for the small model: The TOC is limited to
16176 64k.
16177
16178 @item -mcmodel=medium
16179 @opindex mcmodel=medium
16180 Generate PowerPC64 code for the medium model: The TOC and other static
16181 data may be up to a total of 4G in size.
16182
16183 @item -mcmodel=large
16184 @opindex mcmodel=large
16185 Generate PowerPC64 code for the large model: The TOC may be up to 4G
16186 in size. Other data and code is only limited by the 64-bit address
16187 space.
16188
16189 @item -maltivec
16190 @itemx -mno-altivec
16191 @opindex maltivec
16192 @opindex mno-altivec
16193 Generate code that uses (does not use) AltiVec instructions, and also
16194 enable the use of built-in functions that allow more direct access to
16195 the AltiVec instruction set. You may also need to set
16196 @option{-mabi=altivec} to adjust the current ABI with AltiVec ABI
16197 enhancements.
16198
16199 @item -mvrsave
16200 @itemx -mno-vrsave
16201 @opindex mvrsave
16202 @opindex mno-vrsave
16203 Generate VRSAVE instructions when generating AltiVec code.
16204
16205 @item -mgen-cell-microcode
16206 @opindex mgen-cell-microcode
16207 Generate Cell microcode instructions
16208
16209 @item -mwarn-cell-microcode
16210 @opindex mwarn-cell-microcode
16211 Warning when a Cell microcode instruction is going to emitted. An example
16212 of a Cell microcode instruction is a variable shift.
16213
16214 @item -msecure-plt
16215 @opindex msecure-plt
16216 Generate code that allows ld and ld.so to build executables and shared
16217 libraries with non-exec .plt and .got sections. This is a PowerPC
16218 32-bit SYSV ABI option.
16219
16220 @item -mbss-plt
16221 @opindex mbss-plt
16222 Generate code that uses a BSS .plt section that ld.so fills in, and
16223 requires .plt and .got sections that are both writable and executable.
16224 This is a PowerPC 32-bit SYSV ABI option.
16225
16226 @item -misel
16227 @itemx -mno-isel
16228 @opindex misel
16229 @opindex mno-isel
16230 This switch enables or disables the generation of ISEL instructions.
16231
16232 @item -misel=@var{yes/no}
16233 This switch has been deprecated. Use @option{-misel} and
16234 @option{-mno-isel} instead.
16235
16236 @item -mspe
16237 @itemx -mno-spe
16238 @opindex mspe
16239 @opindex mno-spe
16240 This switch enables or disables the generation of SPE simd
16241 instructions.
16242
16243 @item -mpaired
16244 @itemx -mno-paired
16245 @opindex mpaired
16246 @opindex mno-paired
16247 This switch enables or disables the generation of PAIRED simd
16248 instructions.
16249
16250 @item -mspe=@var{yes/no}
16251 This option has been deprecated. Use @option{-mspe} and
16252 @option{-mno-spe} instead.
16253
16254 @item -mvsx
16255 @itemx -mno-vsx
16256 @opindex mvsx
16257 @opindex mno-vsx
16258 Generate code that uses (does not use) vector/scalar (VSX)
16259 instructions, and also enable the use of built-in functions that allow
16260 more direct access to the VSX instruction set.
16261
16262 @item -mfloat-gprs=@var{yes/single/double/no}
16263 @itemx -mfloat-gprs
16264 @opindex mfloat-gprs
16265 This switch enables or disables the generation of floating point
16266 operations on the general purpose registers for architectures that
16267 support it.
16268
16269 The argument @var{yes} or @var{single} enables the use of
16270 single-precision floating point operations.
16271
16272 The argument @var{double} enables the use of single and
16273 double-precision floating point operations.
16274
16275 The argument @var{no} disables floating point operations on the
16276 general purpose registers.
16277
16278 This option is currently only available on the MPC854x.
16279
16280 @item -m32
16281 @itemx -m64
16282 @opindex m32
16283 @opindex m64
16284 Generate code for 32-bit or 64-bit environments of Darwin and SVR4
16285 targets (including GNU/Linux). The 32-bit environment sets int, long
16286 and pointer to 32 bits and generates code that runs on any PowerPC
16287 variant. The 64-bit environment sets int to 32 bits and long and
16288 pointer to 64 bits, and generates code for PowerPC64, as for
16289 @option{-mpowerpc64}.
16290
16291 @item -mfull-toc
16292 @itemx -mno-fp-in-toc
16293 @itemx -mno-sum-in-toc
16294 @itemx -mminimal-toc
16295 @opindex mfull-toc
16296 @opindex mno-fp-in-toc
16297 @opindex mno-sum-in-toc
16298 @opindex mminimal-toc
16299 Modify generation of the TOC (Table Of Contents), which is created for
16300 every executable file. The @option{-mfull-toc} option is selected by
16301 default. In that case, GCC will allocate at least one TOC entry for
16302 each unique non-automatic variable reference in your program. GCC
16303 will also place floating-point constants in the TOC@. However, only
16304 16,384 entries are available in the TOC@.
16305
16306 If you receive a linker error message that saying you have overflowed
16307 the available TOC space, you can reduce the amount of TOC space used
16308 with the @option{-mno-fp-in-toc} and @option{-mno-sum-in-toc} options.
16309 @option{-mno-fp-in-toc} prevents GCC from putting floating-point
16310 constants in the TOC and @option{-mno-sum-in-toc} forces GCC to
16311 generate code to calculate the sum of an address and a constant at
16312 run-time instead of putting that sum into the TOC@. You may specify one
16313 or both of these options. Each causes GCC to produce very slightly
16314 slower and larger code at the expense of conserving TOC space.
16315
16316 If you still run out of space in the TOC even when you specify both of
16317 these options, specify @option{-mminimal-toc} instead. This option causes
16318 GCC to make only one TOC entry for every file. When you specify this
16319 option, GCC will produce code that is slower and larger but which
16320 uses extremely little TOC space. You may wish to use this option
16321 only on files that contain less frequently executed code.
16322
16323 @item -maix64
16324 @itemx -maix32
16325 @opindex maix64
16326 @opindex maix32
16327 Enable 64-bit AIX ABI and calling convention: 64-bit pointers, 64-bit
16328 @code{long} type, and the infrastructure needed to support them.
16329 Specifying @option{-maix64} implies @option{-mpowerpc64} and
16330 @option{-mpowerpc}, while @option{-maix32} disables the 64-bit ABI and
16331 implies @option{-mno-powerpc64}. GCC defaults to @option{-maix32}.
16332
16333 @item -mxl-compat
16334 @itemx -mno-xl-compat
16335 @opindex mxl-compat
16336 @opindex mno-xl-compat
16337 Produce code that conforms more closely to IBM XL compiler semantics
16338 when using AIX-compatible ABI@. Pass floating-point arguments to
16339 prototyped functions beyond the register save area (RSA) on the stack
16340 in addition to argument FPRs. Do not assume that most significant
16341 double in 128-bit long double value is properly rounded when comparing
16342 values and converting to double. Use XL symbol names for long double
16343 support routines.
16344
16345 The AIX calling convention was extended but not initially documented to
16346 handle an obscure K&R C case of calling a function that takes the
16347 address of its arguments with fewer arguments than declared. IBM XL
16348 compilers access floating point arguments which do not fit in the
16349 RSA from the stack when a subroutine is compiled without
16350 optimization. Because always storing floating-point arguments on the
16351 stack is inefficient and rarely needed, this option is not enabled by
16352 default and only is necessary when calling subroutines compiled by IBM
16353 XL compilers without optimization.
16354
16355 @item -mpe
16356 @opindex mpe
16357 Support @dfn{IBM RS/6000 SP} @dfn{Parallel Environment} (PE)@. Link an
16358 application written to use message passing with special startup code to
16359 enable the application to run. The system must have PE installed in the
16360 standard location (@file{/usr/lpp/ppe.poe/}), or the @file{specs} file
16361 must be overridden with the @option{-specs=} option to specify the
16362 appropriate directory location. The Parallel Environment does not
16363 support threads, so the @option{-mpe} option and the @option{-pthread}
16364 option are incompatible.
16365
16366 @item -malign-natural
16367 @itemx -malign-power
16368 @opindex malign-natural
16369 @opindex malign-power
16370 On AIX, 32-bit Darwin, and 64-bit PowerPC GNU/Linux, the option
16371 @option{-malign-natural} overrides the ABI-defined alignment of larger
16372 types, such as floating-point doubles, on their natural size-based boundary.
16373 The option @option{-malign-power} instructs GCC to follow the ABI-specified
16374 alignment rules. GCC defaults to the standard alignment defined in the ABI@.
16375
16376 On 64-bit Darwin, natural alignment is the default, and @option{-malign-power}
16377 is not supported.
16378
16379 @item -msoft-float
16380 @itemx -mhard-float
16381 @opindex msoft-float
16382 @opindex mhard-float
16383 Generate code that does not use (uses) the floating-point register set.
16384 Software floating point emulation is provided if you use the
16385 @option{-msoft-float} option, and pass the option to GCC when linking.
16386
16387 @item -msingle-float
16388 @itemx -mdouble-float
16389 @opindex msingle-float
16390 @opindex mdouble-float
16391 Generate code for single or double-precision floating point operations.
16392 @option{-mdouble-float} implies @option{-msingle-float}.
16393
16394 @item -msimple-fpu
16395 @opindex msimple-fpu
16396 Do not generate sqrt and div instructions for hardware floating point unit.
16397
16398 @item -mfpu
16399 @opindex mfpu
16400 Specify type of floating point unit. Valid values are @var{sp_lite}
16401 (equivalent to -msingle-float -msimple-fpu), @var{dp_lite} (equivalent
16402 to -mdouble-float -msimple-fpu), @var{sp_full} (equivalent to -msingle-float),
16403 and @var{dp_full} (equivalent to -mdouble-float).
16404
16405 @item -mxilinx-fpu
16406 @opindex mxilinx-fpu
16407 Perform optimizations for floating point unit on Xilinx PPC 405/440.
16408
16409 @item -mmultiple
16410 @itemx -mno-multiple
16411 @opindex mmultiple
16412 @opindex mno-multiple
16413 Generate code that uses (does not use) the load multiple word
16414 instructions and the store multiple word instructions. These
16415 instructions are generated by default on POWER systems, and not
16416 generated on PowerPC systems. Do not use @option{-mmultiple} on little
16417 endian PowerPC systems, since those instructions do not work when the
16418 processor is in little endian mode. The exceptions are PPC740 and
16419 PPC750 which permit the instructions usage in little endian mode.
16420
16421 @item -mstring
16422 @itemx -mno-string
16423 @opindex mstring
16424 @opindex mno-string
16425 Generate code that uses (does not use) the load string instructions
16426 and the store string word instructions to save multiple registers and
16427 do small block moves. These instructions are generated by default on
16428 POWER systems, and not generated on PowerPC systems. Do not use
16429 @option{-mstring} on little endian PowerPC systems, since those
16430 instructions do not work when the processor is in little endian mode.
16431 The exceptions are PPC740 and PPC750 which permit the instructions
16432 usage in little endian mode.
16433
16434 @item -mupdate
16435 @itemx -mno-update
16436 @opindex mupdate
16437 @opindex mno-update
16438 Generate code that uses (does not use) the load or store instructions
16439 that update the base register to the address of the calculated memory
16440 location. These instructions are generated by default. If you use
16441 @option{-mno-update}, there is a small window between the time that the
16442 stack pointer is updated and the address of the previous frame is
16443 stored, which means code that walks the stack frame across interrupts or
16444 signals may get corrupted data.
16445
16446 @item -mavoid-indexed-addresses
16447 @itemx -mno-avoid-indexed-addresses
16448 @opindex mavoid-indexed-addresses
16449 @opindex mno-avoid-indexed-addresses
16450 Generate code that tries to avoid (not avoid) the use of indexed load
16451 or store instructions. These instructions can incur a performance
16452 penalty on Power6 processors in certain situations, such as when
16453 stepping through large arrays that cross a 16M boundary. This option
16454 is enabled by default when targetting Power6 and disabled otherwise.
16455
16456 @item -mfused-madd
16457 @itemx -mno-fused-madd
16458 @opindex mfused-madd
16459 @opindex mno-fused-madd
16460 Generate code that uses (does not use) the floating point multiply and
16461 accumulate instructions. These instructions are generated by default
16462 if hardware floating point is used. The machine dependent
16463 @option{-mfused-madd} option is now mapped to the machine independent
16464 @option{-ffp-contract=fast} option, and @option{-mno-fused-madd} is
16465 mapped to @option{-ffp-contract=off}.
16466
16467 @item -mmulhw
16468 @itemx -mno-mulhw
16469 @opindex mmulhw
16470 @opindex mno-mulhw
16471 Generate code that uses (does not use) the half-word multiply and
16472 multiply-accumulate instructions on the IBM 405, 440, 464 and 476 processors.
16473 These instructions are generated by default when targetting those
16474 processors.
16475
16476 @item -mdlmzb
16477 @itemx -mno-dlmzb
16478 @opindex mdlmzb
16479 @opindex mno-dlmzb
16480 Generate code that uses (does not use) the string-search @samp{dlmzb}
16481 instruction on the IBM 405, 440, 464 and 476 processors. This instruction is
16482 generated by default when targetting those processors.
16483
16484 @item -mno-bit-align
16485 @itemx -mbit-align
16486 @opindex mno-bit-align
16487 @opindex mbit-align
16488 On System V.4 and embedded PowerPC systems do not (do) force structures
16489 and unions that contain bit-fields to be aligned to the base type of the
16490 bit-field.
16491
16492 For example, by default a structure containing nothing but 8
16493 @code{unsigned} bit-fields of length 1 would be aligned to a 4 byte
16494 boundary and have a size of 4 bytes. By using @option{-mno-bit-align},
16495 the structure would be aligned to a 1 byte boundary and be one byte in
16496 size.
16497
16498 @item -mno-strict-align
16499 @itemx -mstrict-align
16500 @opindex mno-strict-align
16501 @opindex mstrict-align
16502 On System V.4 and embedded PowerPC systems do not (do) assume that
16503 unaligned memory references will be handled by the system.
16504
16505 @item -mrelocatable
16506 @itemx -mno-relocatable
16507 @opindex mrelocatable
16508 @opindex mno-relocatable
16509 Generate code that allows (does not allow) a static executable to be
16510 relocated to a different address at runtime. A simple embedded
16511 PowerPC system loader should relocate the entire contents of
16512 @code{.got2} and 4-byte locations listed in the @code{.fixup} section,
16513 a table of 32-bit addresses generated by this option. For this to
16514 work, all objects linked together must be compiled with
16515 @option{-mrelocatable} or @option{-mrelocatable-lib}.
16516 @option{-mrelocatable} code aligns the stack to an 8 byte boundary.
16517
16518 @item -mrelocatable-lib
16519 @itemx -mno-relocatable-lib
16520 @opindex mrelocatable-lib
16521 @opindex mno-relocatable-lib
16522 Like @option{-mrelocatable}, @option{-mrelocatable-lib} generates a
16523 @code{.fixup} section to allow static executables to be relocated at
16524 runtime, but @option{-mrelocatable-lib} does not use the smaller stack
16525 alignment of @option{-mrelocatable}. Objects compiled with
16526 @option{-mrelocatable-lib} may be linked with objects compiled with
16527 any combination of the @option{-mrelocatable} options.
16528
16529 @item -mno-toc
16530 @itemx -mtoc
16531 @opindex mno-toc
16532 @opindex mtoc
16533 On System V.4 and embedded PowerPC systems do not (do) assume that
16534 register 2 contains a pointer to a global area pointing to the addresses
16535 used in the program.
16536
16537 @item -mlittle
16538 @itemx -mlittle-endian
16539 @opindex mlittle
16540 @opindex mlittle-endian
16541 On System V.4 and embedded PowerPC systems compile code for the
16542 processor in little endian mode. The @option{-mlittle-endian} option is
16543 the same as @option{-mlittle}.
16544
16545 @item -mbig
16546 @itemx -mbig-endian
16547 @opindex mbig
16548 @opindex mbig-endian
16549 On System V.4 and embedded PowerPC systems compile code for the
16550 processor in big endian mode. The @option{-mbig-endian} option is
16551 the same as @option{-mbig}.
16552
16553 @item -mdynamic-no-pic
16554 @opindex mdynamic-no-pic
16555 On Darwin and Mac OS X systems, compile code so that it is not
16556 relocatable, but that its external references are relocatable. The
16557 resulting code is suitable for applications, but not shared
16558 libraries.
16559
16560 @item -msingle-pic-base
16561 @opindex msingle-pic-base
16562 Treat the register used for PIC addressing as read-only, rather than
16563 loading it in the prologue for each function. The run-time system is
16564 responsible for initializing this register with an appropriate value
16565 before execution begins.
16566
16567 @item -mprioritize-restricted-insns=@var{priority}
16568 @opindex mprioritize-restricted-insns
16569 This option controls the priority that is assigned to
16570 dispatch-slot restricted instructions during the second scheduling
16571 pass. The argument @var{priority} takes the value @var{0/1/2} to assign
16572 @var{no/highest/second-highest} priority to dispatch slot restricted
16573 instructions.
16574
16575 @item -msched-costly-dep=@var{dependence_type}
16576 @opindex msched-costly-dep
16577 This option controls which dependences are considered costly
16578 by the target during instruction scheduling. The argument
16579 @var{dependence_type} takes one of the following values:
16580 @var{no}: no dependence is costly,
16581 @var{all}: all dependences are costly,
16582 @var{true_store_to_load}: a true dependence from store to load is costly,
16583 @var{store_to_load}: any dependence from store to load is costly,
16584 @var{number}: any dependence which latency >= @var{number} is costly.
16585
16586 @item -minsert-sched-nops=@var{scheme}
16587 @opindex minsert-sched-nops
16588 This option controls which nop insertion scheme will be used during
16589 the second scheduling pass. The argument @var{scheme} takes one of the
16590 following values:
16591 @var{no}: Don't insert nops.
16592 @var{pad}: Pad with nops any dispatch group which has vacant issue slots,
16593 according to the scheduler's grouping.
16594 @var{regroup_exact}: Insert nops to force costly dependent insns into
16595 separate groups. Insert exactly as many nops as needed to force an insn
16596 to a new group, according to the estimated processor grouping.
16597 @var{number}: Insert nops to force costly dependent insns into
16598 separate groups. Insert @var{number} nops to force an insn to a new group.
16599
16600 @item -mcall-sysv
16601 @opindex mcall-sysv
16602 On System V.4 and embedded PowerPC systems compile code using calling
16603 conventions that adheres to the March 1995 draft of the System V
16604 Application Binary Interface, PowerPC processor supplement. This is the
16605 default unless you configured GCC using @samp{powerpc-*-eabiaix}.
16606
16607 @item -mcall-sysv-eabi
16608 @itemx -mcall-eabi
16609 @opindex mcall-sysv-eabi
16610 @opindex mcall-eabi
16611 Specify both @option{-mcall-sysv} and @option{-meabi} options.
16612
16613 @item -mcall-sysv-noeabi
16614 @opindex mcall-sysv-noeabi
16615 Specify both @option{-mcall-sysv} and @option{-mno-eabi} options.
16616
16617 @item -mcall-aixdesc
16618 @opindex m
16619 On System V.4 and embedded PowerPC systems compile code for the AIX
16620 operating system.
16621
16622 @item -mcall-linux
16623 @opindex mcall-linux
16624 On System V.4 and embedded PowerPC systems compile code for the
16625 Linux-based GNU system.
16626
16627 @item -mcall-freebsd
16628 @opindex mcall-freebsd
16629 On System V.4 and embedded PowerPC systems compile code for the
16630 FreeBSD operating system.
16631
16632 @item -mcall-netbsd
16633 @opindex mcall-netbsd
16634 On System V.4 and embedded PowerPC systems compile code for the
16635 NetBSD operating system.
16636
16637 @item -mcall-openbsd
16638 @opindex mcall-netbsd
16639 On System V.4 and embedded PowerPC systems compile code for the
16640 OpenBSD operating system.
16641
16642 @item -maix-struct-return
16643 @opindex maix-struct-return
16644 Return all structures in memory (as specified by the AIX ABI)@.
16645
16646 @item -msvr4-struct-return
16647 @opindex msvr4-struct-return
16648 Return structures smaller than 8 bytes in registers (as specified by the
16649 SVR4 ABI)@.
16650
16651 @item -mabi=@var{abi-type}
16652 @opindex mabi
16653 Extend the current ABI with a particular extension, or remove such extension.
16654 Valid values are @var{altivec}, @var{no-altivec}, @var{spe},
16655 @var{no-spe}, @var{ibmlongdouble}, @var{ieeelongdouble}@.
16656
16657 @item -mabi=spe
16658 @opindex mabi=spe
16659 Extend the current ABI with SPE ABI extensions. This does not change
16660 the default ABI, instead it adds the SPE ABI extensions to the current
16661 ABI@.
16662
16663 @item -mabi=no-spe
16664 @opindex mabi=no-spe
16665 Disable Booke SPE ABI extensions for the current ABI@.
16666
16667 @item -mabi=ibmlongdouble
16668 @opindex mabi=ibmlongdouble
16669 Change the current ABI to use IBM extended precision long double.
16670 This is a PowerPC 32-bit SYSV ABI option.
16671
16672 @item -mabi=ieeelongdouble
16673 @opindex mabi=ieeelongdouble
16674 Change the current ABI to use IEEE extended precision long double.
16675 This is a PowerPC 32-bit Linux ABI option.
16676
16677 @item -mprototype
16678 @itemx -mno-prototype
16679 @opindex mprototype
16680 @opindex mno-prototype
16681 On System V.4 and embedded PowerPC systems assume that all calls to
16682 variable argument functions are properly prototyped. Otherwise, the
16683 compiler must insert an instruction before every non prototyped call to
16684 set or clear bit 6 of the condition code register (@var{CR}) to
16685 indicate whether floating point values were passed in the floating point
16686 registers in case the function takes a variable arguments. With
16687 @option{-mprototype}, only calls to prototyped variable argument functions
16688 will set or clear the bit.
16689
16690 @item -msim
16691 @opindex msim
16692 On embedded PowerPC systems, assume that the startup module is called
16693 @file{sim-crt0.o} and that the standard C libraries are @file{libsim.a} and
16694 @file{libc.a}. This is the default for @samp{powerpc-*-eabisim}
16695 configurations.
16696
16697 @item -mmvme
16698 @opindex mmvme
16699 On embedded PowerPC systems, assume that the startup module is called
16700 @file{crt0.o} and the standard C libraries are @file{libmvme.a} and
16701 @file{libc.a}.
16702
16703 @item -mads
16704 @opindex mads
16705 On embedded PowerPC systems, assume that the startup module is called
16706 @file{crt0.o} and the standard C libraries are @file{libads.a} and
16707 @file{libc.a}.
16708
16709 @item -myellowknife
16710 @opindex myellowknife
16711 On embedded PowerPC systems, assume that the startup module is called
16712 @file{crt0.o} and the standard C libraries are @file{libyk.a} and
16713 @file{libc.a}.
16714
16715 @item -mvxworks
16716 @opindex mvxworks
16717 On System V.4 and embedded PowerPC systems, specify that you are
16718 compiling for a VxWorks system.
16719
16720 @item -memb
16721 @opindex memb
16722 On embedded PowerPC systems, set the @var{PPC_EMB} bit in the ELF flags
16723 header to indicate that @samp{eabi} extended relocations are used.
16724
16725 @item -meabi
16726 @itemx -mno-eabi
16727 @opindex meabi
16728 @opindex mno-eabi
16729 On System V.4 and embedded PowerPC systems do (do not) adhere to the
16730 Embedded Applications Binary Interface (eabi) which is a set of
16731 modifications to the System V.4 specifications. Selecting @option{-meabi}
16732 means that the stack is aligned to an 8 byte boundary, a function
16733 @code{__eabi} is called to from @code{main} to set up the eabi
16734 environment, and the @option{-msdata} option can use both @code{r2} and
16735 @code{r13} to point to two separate small data areas. Selecting
16736 @option{-mno-eabi} means that the stack is aligned to a 16 byte boundary,
16737 do not call an initialization function from @code{main}, and the
16738 @option{-msdata} option will only use @code{r13} to point to a single
16739 small data area. The @option{-meabi} option is on by default if you
16740 configured GCC using one of the @samp{powerpc*-*-eabi*} options.
16741
16742 @item -msdata=eabi
16743 @opindex msdata=eabi
16744 On System V.4 and embedded PowerPC systems, put small initialized
16745 @code{const} global and static data in the @samp{.sdata2} section, which
16746 is pointed to by register @code{r2}. Put small initialized
16747 non-@code{const} global and static data in the @samp{.sdata} section,
16748 which is pointed to by register @code{r13}. Put small uninitialized
16749 global and static data in the @samp{.sbss} section, which is adjacent to
16750 the @samp{.sdata} section. The @option{-msdata=eabi} option is
16751 incompatible with the @option{-mrelocatable} option. The
16752 @option{-msdata=eabi} option also sets the @option{-memb} option.
16753
16754 @item -msdata=sysv
16755 @opindex msdata=sysv
16756 On System V.4 and embedded PowerPC systems, put small global and static
16757 data in the @samp{.sdata} section, which is pointed to by register
16758 @code{r13}. Put small uninitialized global and static data in the
16759 @samp{.sbss} section, which is adjacent to the @samp{.sdata} section.
16760 The @option{-msdata=sysv} option is incompatible with the
16761 @option{-mrelocatable} option.
16762
16763 @item -msdata=default
16764 @itemx -msdata
16765 @opindex msdata=default
16766 @opindex msdata
16767 On System V.4 and embedded PowerPC systems, if @option{-meabi} is used,
16768 compile code the same as @option{-msdata=eabi}, otherwise compile code the
16769 same as @option{-msdata=sysv}.
16770
16771 @item -msdata=data
16772 @opindex msdata=data
16773 On System V.4 and embedded PowerPC systems, put small global
16774 data in the @samp{.sdata} section. Put small uninitialized global
16775 data in the @samp{.sbss} section. Do not use register @code{r13}
16776 to address small data however. This is the default behavior unless
16777 other @option{-msdata} options are used.
16778
16779 @item -msdata=none
16780 @itemx -mno-sdata
16781 @opindex msdata=none
16782 @opindex mno-sdata
16783 On embedded PowerPC systems, put all initialized global and static data
16784 in the @samp{.data} section, and all uninitialized data in the
16785 @samp{.bss} section.
16786
16787 @item -mblock-move-inline-limit=@var{num}
16788 @opindex mblock-move-inline-limit
16789 Inline all block moves (such as calls to @code{memcpy} or structure
16790 copies) less than or equal to @var{num} bytes. The minimum value for
16791 @var{num} is 32 bytes on 32-bit targets and 64 bytes on 64-bit
16792 targets. The default value is target-specific.
16793
16794 @item -G @var{num}
16795 @opindex G
16796 @cindex smaller data references (PowerPC)
16797 @cindex .sdata/.sdata2 references (PowerPC)
16798 On embedded PowerPC systems, put global and static items less than or
16799 equal to @var{num} bytes into the small data or bss sections instead of
16800 the normal data or bss section. By default, @var{num} is 8. The
16801 @option{-G @var{num}} switch is also passed to the linker.
16802 All modules should be compiled with the same @option{-G @var{num}} value.
16803
16804 @item -mregnames
16805 @itemx -mno-regnames
16806 @opindex mregnames
16807 @opindex mno-regnames
16808 On System V.4 and embedded PowerPC systems do (do not) emit register
16809 names in the assembly language output using symbolic forms.
16810
16811 @item -mlongcall
16812 @itemx -mno-longcall
16813 @opindex mlongcall
16814 @opindex mno-longcall
16815 By default assume that all calls are far away so that a longer more
16816 expensive calling sequence is required. This is required for calls
16817 further than 32 megabytes (33,554,432 bytes) from the current location.
16818 A short call will be generated if the compiler knows
16819 the call cannot be that far away. This setting can be overridden by
16820 the @code{shortcall} function attribute, or by @code{#pragma
16821 longcall(0)}.
16822
16823 Some linkers are capable of detecting out-of-range calls and generating
16824 glue code on the fly. On these systems, long calls are unnecessary and
16825 generate slower code. As of this writing, the AIX linker can do this,
16826 as can the GNU linker for PowerPC/64. It is planned to add this feature
16827 to the GNU linker for 32-bit PowerPC systems as well.
16828
16829 On Darwin/PPC systems, @code{#pragma longcall} will generate ``jbsr
16830 callee, L42'', plus a ``branch island'' (glue code). The two target
16831 addresses represent the callee and the ``branch island''. The
16832 Darwin/PPC linker will prefer the first address and generate a ``bl
16833 callee'' if the PPC ``bl'' instruction will reach the callee directly;
16834 otherwise, the linker will generate ``bl L42'' to call the ``branch
16835 island''. The ``branch island'' is appended to the body of the
16836 calling function; it computes the full 32-bit address of the callee
16837 and jumps to it.
16838
16839 On Mach-O (Darwin) systems, this option directs the compiler emit to
16840 the glue for every direct call, and the Darwin linker decides whether
16841 to use or discard it.
16842
16843 In the future, we may cause GCC to ignore all longcall specifications
16844 when the linker is known to generate glue.
16845
16846 @item -mtls-markers
16847 @itemx -mno-tls-markers
16848 @opindex mtls-markers
16849 @opindex mno-tls-markers
16850 Mark (do not mark) calls to @code{__tls_get_addr} with a relocation
16851 specifying the function argument. The relocation allows ld to
16852 reliably associate function call with argument setup instructions for
16853 TLS optimization, which in turn allows gcc to better schedule the
16854 sequence.
16855
16856 @item -pthread
16857 @opindex pthread
16858 Adds support for multithreading with the @dfn{pthreads} library.
16859 This option sets flags for both the preprocessor and linker.
16860
16861 @item -mrecip
16862 @itemx -mno-recip
16863 @opindex mrecip
16864 This option will enable GCC to use the reciprocal estimate and
16865 reciprocal square root estimate instructions with additional
16866 Newton-Raphson steps to increase precision instead of doing a divide or
16867 square root and divide for floating point arguments. You should use
16868 the @option{-ffast-math} option when using @option{-mrecip} (or at
16869 least @option{-funsafe-math-optimizations},
16870 @option{-finite-math-only}, @option{-freciprocal-math} and
16871 @option{-fno-trapping-math}). Note that while the throughput of the
16872 sequence is generally higher than the throughput of the non-reciprocal
16873 instruction, the precision of the sequence can be decreased by up to 2
16874 ulp (i.e. the inverse of 1.0 equals 0.99999994) for reciprocal square
16875 roots.
16876
16877 @item -mrecip=@var{opt}
16878 @opindex mrecip=opt
16879 This option allows to control which reciprocal estimate instructions
16880 may be used. @var{opt} is a comma separated list of options, that may
16881 be preceded by a @code{!} to invert the option:
16882 @code{all}: enable all estimate instructions,
16883 @code{default}: enable the default instructions, equivalent to @option{-mrecip},
16884 @code{none}: disable all estimate instructions, equivalent to @option{-mno-recip};
16885 @code{div}: enable the reciprocal approximation instructions for both single and double precision;
16886 @code{divf}: enable the single precision reciprocal approximation instructions;
16887 @code{divd}: enable the double precision reciprocal approximation instructions;
16888 @code{rsqrt}: enable the reciprocal square root approximation instructions for both single and double precision;
16889 @code{rsqrtf}: enable the single precision reciprocal square root approximation instructions;
16890 @code{rsqrtd}: enable the double precision reciprocal square root approximation instructions;
16891
16892 So for example, @option{-mrecip=all,!rsqrtd} would enable the
16893 all of the reciprocal estimate instructions, except for the
16894 @code{FRSQRTE}, @code{XSRSQRTEDP}, and @code{XVRSQRTEDP} instructions
16895 which handle the double precision reciprocal square root calculations.
16896
16897 @item -mrecip-precision
16898 @itemx -mno-recip-precision
16899 @opindex mrecip-precision
16900 Assume (do not assume) that the reciprocal estimate instructions
16901 provide higher precision estimates than is mandated by the powerpc
16902 ABI. Selecting @option{-mcpu=power6} or @option{-mcpu=power7}
16903 automatically selects @option{-mrecip-precision}. The double
16904 precision square root estimate instructions are not generated by
16905 default on low precision machines, since they do not provide an
16906 estimate that converges after three steps.
16907
16908 @item -mveclibabi=@var{type}
16909 @opindex mveclibabi
16910 Specifies the ABI type to use for vectorizing intrinsics using an
16911 external library. The only type supported at present is @code{mass},
16912 which specifies to use IBM's Mathematical Acceleration Subsystem
16913 (MASS) libraries for vectorizing intrinsics using external libraries.
16914 GCC will currently emit calls to @code{acosd2}, @code{acosf4},
16915 @code{acoshd2}, @code{acoshf4}, @code{asind2}, @code{asinf4},
16916 @code{asinhd2}, @code{asinhf4}, @code{atan2d2}, @code{atan2f4},
16917 @code{atand2}, @code{atanf4}, @code{atanhd2}, @code{atanhf4},
16918 @code{cbrtd2}, @code{cbrtf4}, @code{cosd2}, @code{cosf4},
16919 @code{coshd2}, @code{coshf4}, @code{erfcd2}, @code{erfcf4},
16920 @code{erfd2}, @code{erff4}, @code{exp2d2}, @code{exp2f4},
16921 @code{expd2}, @code{expf4}, @code{expm1d2}, @code{expm1f4},
16922 @code{hypotd2}, @code{hypotf4}, @code{lgammad2}, @code{lgammaf4},
16923 @code{log10d2}, @code{log10f4}, @code{log1pd2}, @code{log1pf4},
16924 @code{log2d2}, @code{log2f4}, @code{logd2}, @code{logf4},
16925 @code{powd2}, @code{powf4}, @code{sind2}, @code{sinf4}, @code{sinhd2},
16926 @code{sinhf4}, @code{sqrtd2}, @code{sqrtf4}, @code{tand2},
16927 @code{tanf4}, @code{tanhd2}, and @code{tanhf4} when generating code
16928 for power7. Both @option{-ftree-vectorize} and
16929 @option{-funsafe-math-optimizations} have to be enabled. The MASS
16930 libraries will have to be specified at link time.
16931
16932 @item -mfriz
16933 @itemx -mno-friz
16934 @opindex mfriz
16935 Generate (do not generate) the @code{friz} instruction when the
16936 @option{-funsafe-math-optimizations} option is used to optimize
16937 rounding a floating point value to 64-bit integer and back to floating
16938 point. The @code{friz} instruction does not return the same value if
16939 the floating point number is too large to fit in an integer.
16940
16941 @item -mpointers-to-nested-functions
16942 @itemx -mno-pointers-to-nested-functions
16943 @opindex mpointers-to-nested-functions
16944 Generate (do not generate) code to load up the static chain register
16945 (@var{r11}) when calling through a pointer on AIX and 64-bit Linux
16946 systems where a function pointer points to a 3 word descriptor giving
16947 the function address, TOC value to be loaded in register @var{r2}, and
16948 static chain value to be loaded in register @var{r11}. The
16949 @option{-mpointers-to-nested-functions} is on by default. You will
16950 not be able to call through pointers to nested functions or pointers
16951 to functions compiled in other languages that use the static chain if
16952 you use the @option{-mno-pointers-to-nested-functions}.
16953
16954 @item -msave-toc-indirect
16955 @itemx -mno-save-toc-indirect
16956 @opindex msave-toc-indirect
16957 Generate (do not generate) code to save the TOC value in the reserved
16958 stack location in the function prologue if the function calls through
16959 a pointer on AIX and 64-bit Linux systems. If the TOC value is not
16960 saved in the prologue, it is saved just before the call through the
16961 pointer. The @option{-mno-save-toc-indirect} option is the default.
16962 @end table
16963
16964 @node RX Options
16965 @subsection RX Options
16966 @cindex RX Options
16967
16968 These command line options are defined for RX targets:
16969
16970 @table @gcctabopt
16971 @item -m64bit-doubles
16972 @itemx -m32bit-doubles
16973 @opindex m64bit-doubles
16974 @opindex m32bit-doubles
16975 Make the @code{double} data type be 64-bits (@option{-m64bit-doubles})
16976 or 32-bits (@option{-m32bit-doubles}) in size. The default is
16977 @option{-m32bit-doubles}. @emph{Note} RX floating point hardware only
16978 works on 32-bit values, which is why the default is
16979 @option{-m32bit-doubles}.
16980
16981 @item -fpu
16982 @itemx -nofpu
16983 @opindex fpu
16984 @opindex nofpu
16985 Enables (@option{-fpu}) or disables (@option{-nofpu}) the use of RX
16986 floating point hardware. The default is enabled for the @var{RX600}
16987 series and disabled for the @var{RX200} series.
16988
16989 Floating point instructions will only be generated for 32-bit floating
16990 point values however, so if the @option{-m64bit-doubles} option is in
16991 use then the FPU hardware will not be used for doubles.
16992
16993 @emph{Note} If the @option{-fpu} option is enabled then
16994 @option{-funsafe-math-optimizations} is also enabled automatically.
16995 This is because the RX FPU instructions are themselves unsafe.
16996
16997 @item -mcpu=@var{name}
16998 @opindex -mcpu
16999 Selects the type of RX CPU to be targeted. Currently three types are
17000 supported, the generic @var{RX600} and @var{RX200} series hardware and
17001 the specific @var{RX610} CPU. The default is @var{RX600}.
17002
17003 The only difference between @var{RX600} and @var{RX610} is that the
17004 @var{RX610} does not support the @code{MVTIPL} instruction.
17005
17006 The @var{RX200} series does not have a hardware floating point unit
17007 and so @option{-nofpu} is enabled by default when this type is
17008 selected.
17009
17010 @item -mbig-endian-data
17011 @itemx -mlittle-endian-data
17012 @opindex mbig-endian-data
17013 @opindex mlittle-endian-data
17014 Store data (but not code) in the big-endian format. The default is
17015 @option{-mlittle-endian-data}, i.e.@: to store data in the little endian
17016 format.
17017
17018 @item -msmall-data-limit=@var{N}
17019 @opindex msmall-data-limit
17020 Specifies the maximum size in bytes of global and static variables
17021 which can be placed into the small data area. Using the small data
17022 area can lead to smaller and faster code, but the size of area is
17023 limited and it is up to the programmer to ensure that the area does
17024 not overflow. Also when the small data area is used one of the RX's
17025 registers (usually @code{r13}) is reserved for use pointing to this
17026 area, so it is no longer available for use by the compiler. This
17027 could result in slower and/or larger code if variables which once
17028 could have been held in the reserved register are now pushed onto the
17029 stack.
17030
17031 Note, common variables (variables which have not been initialised) and
17032 constants are not placed into the small data area as they are assigned
17033 to other sections in the output executable.
17034
17035 The default value is zero, which disables this feature. Note, this
17036 feature is not enabled by default with higher optimization levels
17037 (@option{-O2} etc) because of the potentially detrimental effects of
17038 reserving a register. It is up to the programmer to experiment and
17039 discover whether this feature is of benefit to their program. See the
17040 description of the @option{-mpid} option for a description of how the
17041 actual register to hold the small data area pointer is chosen.
17042
17043 @item -msim
17044 @itemx -mno-sim
17045 @opindex msim
17046 @opindex mno-sim
17047 Use the simulator runtime. The default is to use the libgloss board
17048 specific runtime.
17049
17050 @item -mas100-syntax
17051 @itemx -mno-as100-syntax
17052 @opindex mas100-syntax
17053 @opindex mno-as100-syntax
17054 When generating assembler output use a syntax that is compatible with
17055 Renesas's AS100 assembler. This syntax can also be handled by the GAS
17056 assembler but it has some restrictions so generating it is not the
17057 default option.
17058
17059 @item -mmax-constant-size=@var{N}
17060 @opindex mmax-constant-size
17061 Specifies the maximum size, in bytes, of a constant that can be used as
17062 an operand in a RX instruction. Although the RX instruction set does
17063 allow constants of up to 4 bytes in length to be used in instructions,
17064 a longer value equates to a longer instruction. Thus in some
17065 circumstances it can be beneficial to restrict the size of constants
17066 that are used in instructions. Constants that are too big are instead
17067 placed into a constant pool and referenced via register indirection.
17068
17069 The value @var{N} can be between 0 and 4. A value of 0 (the default)
17070 or 4 means that constants of any size are allowed.
17071
17072 @item -mrelax
17073 @opindex mrelax
17074 Enable linker relaxation. Linker relaxation is a process whereby the
17075 linker will attempt to reduce the size of a program by finding shorter
17076 versions of various instructions. Disabled by default.
17077
17078 @item -mint-register=@var{N}
17079 @opindex mint-register
17080 Specify the number of registers to reserve for fast interrupt handler
17081 functions. The value @var{N} can be between 0 and 4. A value of 1
17082 means that register @code{r13} will be reserved for the exclusive use
17083 of fast interrupt handlers. A value of 2 reserves @code{r13} and
17084 @code{r12}. A value of 3 reserves @code{r13}, @code{r12} and
17085 @code{r11}, and a value of 4 reserves @code{r13} through @code{r10}.
17086 A value of 0, the default, does not reserve any registers.
17087
17088 @item -msave-acc-in-interrupts
17089 @opindex msave-acc-in-interrupts
17090 Specifies that interrupt handler functions should preserve the
17091 accumulator register. This is only necessary if normal code might use
17092 the accumulator register, for example because it performs 64-bit
17093 multiplications. The default is to ignore the accumulator as this
17094 makes the interrupt handlers faster.
17095
17096 @item -mpid
17097 @itemx -mno-pid
17098 @opindex mpid
17099 @opindex mno-pid
17100 Enables the generation of position independent data. When enabled any
17101 access to constant data will done via an offset from a base address
17102 held in a register. This allows the location of constant data to be
17103 determined at run-time without requiring the executable to be
17104 relocated, which is a benefit to embedded applications with tight
17105 memory constraints. Data that can be modified is not affected by this
17106 option.
17107
17108 Note, using this feature reserves a register, usually @code{r13}, for
17109 the constant data base address. This can result in slower and/or
17110 larger code, especially in complicated functions.
17111
17112 The actual register chosen to hold the constant data base address
17113 depends upon whether the @option{-msmall-data-limit} and/or the
17114 @option{-mint-register} command line options are enabled. Starting
17115 with register @code{r13} and proceeding downwards, registers are
17116 allocated first to satisfy the requirements of @option{-mint-register},
17117 then @option{-mpid} and finally @option{-msmall-data-limit}. Thus it
17118 is possible for the small data area register to be @code{r8} if both
17119 @option{-mint-register=4} and @option{-mpid} are specified on the
17120 command line.
17121
17122 By default this feature is not enabled. The default can be restored
17123 via the @option{-mno-pid} command line option.
17124
17125 @end table
17126
17127 @emph{Note:} The generic GCC command line @option{-ffixed-@var{reg}}
17128 has special significance to the RX port when used with the
17129 @code{interrupt} function attribute. This attribute indicates a
17130 function intended to process fast interrupts. GCC will will ensure
17131 that it only uses the registers @code{r10}, @code{r11}, @code{r12}
17132 and/or @code{r13} and only provided that the normal use of the
17133 corresponding registers have been restricted via the
17134 @option{-ffixed-@var{reg}} or @option{-mint-register} command line
17135 options.
17136
17137 @node S/390 and zSeries Options
17138 @subsection S/390 and zSeries Options
17139 @cindex S/390 and zSeries Options
17140
17141 These are the @samp{-m} options defined for the S/390 and zSeries architecture.
17142
17143 @table @gcctabopt
17144 @item -mhard-float
17145 @itemx -msoft-float
17146 @opindex mhard-float
17147 @opindex msoft-float
17148 Use (do not use) the hardware floating-point instructions and registers
17149 for floating-point operations. When @option{-msoft-float} is specified,
17150 functions in @file{libgcc.a} will be used to perform floating-point
17151 operations. When @option{-mhard-float} is specified, the compiler
17152 generates IEEE floating-point instructions. This is the default.
17153
17154 @item -mhard-dfp
17155 @itemx -mno-hard-dfp
17156 @opindex mhard-dfp
17157 @opindex mno-hard-dfp
17158 Use (do not use) the hardware decimal-floating-point instructions for
17159 decimal-floating-point operations. When @option{-mno-hard-dfp} is
17160 specified, functions in @file{libgcc.a} will be used to perform
17161 decimal-floating-point operations. When @option{-mhard-dfp} is
17162 specified, the compiler generates decimal-floating-point hardware
17163 instructions. This is the default for @option{-march=z9-ec} or higher.
17164
17165 @item -mlong-double-64
17166 @itemx -mlong-double-128
17167 @opindex mlong-double-64
17168 @opindex mlong-double-128
17169 These switches control the size of @code{long double} type. A size
17170 of 64bit makes the @code{long double} type equivalent to the @code{double}
17171 type. This is the default.
17172
17173 @item -mbackchain
17174 @itemx -mno-backchain
17175 @opindex mbackchain
17176 @opindex mno-backchain
17177 Store (do not store) the address of the caller's frame as backchain pointer
17178 into the callee's stack frame.
17179 A backchain may be needed to allow debugging using tools that do not understand
17180 DWARF-2 call frame information.
17181 When @option{-mno-packed-stack} is in effect, the backchain pointer is stored
17182 at the bottom of the stack frame; when @option{-mpacked-stack} is in effect,
17183 the backchain is placed into the topmost word of the 96/160 byte register
17184 save area.
17185
17186 In general, code compiled with @option{-mbackchain} is call-compatible with
17187 code compiled with @option{-mmo-backchain}; however, use of the backchain
17188 for debugging purposes usually requires that the whole binary is built with
17189 @option{-mbackchain}. Note that the combination of @option{-mbackchain},
17190 @option{-mpacked-stack} and @option{-mhard-float} is not supported. In order
17191 to build a linux kernel use @option{-msoft-float}.
17192
17193 The default is to not maintain the backchain.
17194
17195 @item -mpacked-stack
17196 @itemx -mno-packed-stack
17197 @opindex mpacked-stack
17198 @opindex mno-packed-stack
17199 Use (do not use) the packed stack layout. When @option{-mno-packed-stack} is
17200 specified, the compiler uses the all fields of the 96/160 byte register save
17201 area only for their default purpose; unused fields still take up stack space.
17202 When @option{-mpacked-stack} is specified, register save slots are densely
17203 packed at the top of the register save area; unused space is reused for other
17204 purposes, allowing for more efficient use of the available stack space.
17205 However, when @option{-mbackchain} is also in effect, the topmost word of
17206 the save area is always used to store the backchain, and the return address
17207 register is always saved two words below the backchain.
17208
17209 As long as the stack frame backchain is not used, code generated with
17210 @option{-mpacked-stack} is call-compatible with code generated with
17211 @option{-mno-packed-stack}. Note that some non-FSF releases of GCC 2.95 for
17212 S/390 or zSeries generated code that uses the stack frame backchain at run
17213 time, not just for debugging purposes. Such code is not call-compatible
17214 with code compiled with @option{-mpacked-stack}. Also, note that the
17215 combination of @option{-mbackchain},
17216 @option{-mpacked-stack} and @option{-mhard-float} is not supported. In order
17217 to build a linux kernel use @option{-msoft-float}.
17218
17219 The default is to not use the packed stack layout.
17220
17221 @item -msmall-exec
17222 @itemx -mno-small-exec
17223 @opindex msmall-exec
17224 @opindex mno-small-exec
17225 Generate (or do not generate) code using the @code{bras} instruction
17226 to do subroutine calls.
17227 This only works reliably if the total executable size does not
17228 exceed 64k. The default is to use the @code{basr} instruction instead,
17229 which does not have this limitation.
17230
17231 @item -m64
17232 @itemx -m31
17233 @opindex m64
17234 @opindex m31
17235 When @option{-m31} is specified, generate code compliant to the
17236 GNU/Linux for S/390 ABI@. When @option{-m64} is specified, generate
17237 code compliant to the GNU/Linux for zSeries ABI@. This allows GCC in
17238 particular to generate 64-bit instructions. For the @samp{s390}
17239 targets, the default is @option{-m31}, while the @samp{s390x}
17240 targets default to @option{-m64}.
17241
17242 @item -mzarch
17243 @itemx -mesa
17244 @opindex mzarch
17245 @opindex mesa
17246 When @option{-mzarch} is specified, generate code using the
17247 instructions available on z/Architecture.
17248 When @option{-mesa} is specified, generate code using the
17249 instructions available on ESA/390. Note that @option{-mesa} is
17250 not possible with @option{-m64}.
17251 When generating code compliant to the GNU/Linux for S/390 ABI,
17252 the default is @option{-mesa}. When generating code compliant
17253 to the GNU/Linux for zSeries ABI, the default is @option{-mzarch}.
17254
17255 @item -mmvcle
17256 @itemx -mno-mvcle
17257 @opindex mmvcle
17258 @opindex mno-mvcle
17259 Generate (or do not generate) code using the @code{mvcle} instruction
17260 to perform block moves. When @option{-mno-mvcle} is specified,
17261 use a @code{mvc} loop instead. This is the default unless optimizing for
17262 size.
17263
17264 @item -mdebug
17265 @itemx -mno-debug
17266 @opindex mdebug
17267 @opindex mno-debug
17268 Print (or do not print) additional debug information when compiling.
17269 The default is to not print debug information.
17270
17271 @item -march=@var{cpu-type}
17272 @opindex march
17273 Generate code that will run on @var{cpu-type}, which is the name of a system
17274 representing a certain processor type. Possible values for
17275 @var{cpu-type} are @samp{g5}, @samp{g6}, @samp{z900}, @samp{z990},
17276 @samp{z9-109}, @samp{z9-ec} and @samp{z10}.
17277 When generating code using the instructions available on z/Architecture,
17278 the default is @option{-march=z900}. Otherwise, the default is
17279 @option{-march=g5}.
17280
17281 @item -mtune=@var{cpu-type}
17282 @opindex mtune
17283 Tune to @var{cpu-type} everything applicable about the generated code,
17284 except for the ABI and the set of available instructions.
17285 The list of @var{cpu-type} values is the same as for @option{-march}.
17286 The default is the value used for @option{-march}.
17287
17288 @item -mtpf-trace
17289 @itemx -mno-tpf-trace
17290 @opindex mtpf-trace
17291 @opindex mno-tpf-trace
17292 Generate code that adds (does not add) in TPF OS specific branches to trace
17293 routines in the operating system. This option is off by default, even
17294 when compiling for the TPF OS@.
17295
17296 @item -mfused-madd
17297 @itemx -mno-fused-madd
17298 @opindex mfused-madd
17299 @opindex mno-fused-madd
17300 Generate code that uses (does not use) the floating point multiply and
17301 accumulate instructions. These instructions are generated by default if
17302 hardware floating point is used.
17303
17304 @item -mwarn-framesize=@var{framesize}
17305 @opindex mwarn-framesize
17306 Emit a warning if the current function exceeds the given frame size. Because
17307 this is a compile time check it doesn't need to be a real problem when the program
17308 runs. It is intended to identify functions which most probably cause
17309 a stack overflow. It is useful to be used in an environment with limited stack
17310 size e.g.@: the linux kernel.
17311
17312 @item -mwarn-dynamicstack
17313 @opindex mwarn-dynamicstack
17314 Emit a warning if the function calls alloca or uses dynamically
17315 sized arrays. This is generally a bad idea with a limited stack size.
17316
17317 @item -mstack-guard=@var{stack-guard}
17318 @itemx -mstack-size=@var{stack-size}
17319 @opindex mstack-guard
17320 @opindex mstack-size
17321 If these options are provided the s390 back end emits additional instructions in
17322 the function prologue which trigger a trap if the stack size is @var{stack-guard}
17323 bytes above the @var{stack-size} (remember that the stack on s390 grows downward).
17324 If the @var{stack-guard} option is omitted the smallest power of 2 larger than
17325 the frame size of the compiled function is chosen.
17326 These options are intended to be used to help debugging stack overflow problems.
17327 The additionally emitted code causes only little overhead and hence can also be
17328 used in production like systems without greater performance degradation. The given
17329 values have to be exact powers of 2 and @var{stack-size} has to be greater than
17330 @var{stack-guard} without exceeding 64k.
17331 In order to be efficient the extra code makes the assumption that the stack starts
17332 at an address aligned to the value given by @var{stack-size}.
17333 The @var{stack-guard} option can only be used in conjunction with @var{stack-size}.
17334 @end table
17335
17336 @node Score Options
17337 @subsection Score Options
17338 @cindex Score Options
17339
17340 These options are defined for Score implementations:
17341
17342 @table @gcctabopt
17343 @item -meb
17344 @opindex meb
17345 Compile code for big endian mode. This is the default.
17346
17347 @item -mel
17348 @opindex mel
17349 Compile code for little endian mode.
17350
17351 @item -mnhwloop
17352 @opindex mnhwloop
17353 Disable generate bcnz instruction.
17354
17355 @item -muls
17356 @opindex muls
17357 Enable generate unaligned load and store instruction.
17358
17359 @item -mmac
17360 @opindex mmac
17361 Enable the use of multiply-accumulate instructions. Disabled by default.
17362
17363 @item -mscore5
17364 @opindex mscore5
17365 Specify the SCORE5 as the target architecture.
17366
17367 @item -mscore5u
17368 @opindex mscore5u
17369 Specify the SCORE5U of the target architecture.
17370
17371 @item -mscore7
17372 @opindex mscore7
17373 Specify the SCORE7 as the target architecture. This is the default.
17374
17375 @item -mscore7d
17376 @opindex mscore7d
17377 Specify the SCORE7D as the target architecture.
17378 @end table
17379
17380 @node SH Options
17381 @subsection SH Options
17382
17383 These @samp{-m} options are defined for the SH implementations:
17384
17385 @table @gcctabopt
17386 @item -m1
17387 @opindex m1
17388 Generate code for the SH1.
17389
17390 @item -m2
17391 @opindex m2
17392 Generate code for the SH2.
17393
17394 @item -m2e
17395 Generate code for the SH2e.
17396
17397 @item -m2a-nofpu
17398 @opindex m2a-nofpu
17399 Generate code for the SH2a without FPU, or for a SH2a-FPU in such a way
17400 that the floating-point unit is not used.
17401
17402 @item -m2a-single-only
17403 @opindex m2a-single-only
17404 Generate code for the SH2a-FPU, in such a way that no double-precision
17405 floating point operations are used.
17406
17407 @item -m2a-single
17408 @opindex m2a-single
17409 Generate code for the SH2a-FPU assuming the floating-point unit is in
17410 single-precision mode by default.
17411
17412 @item -m2a
17413 @opindex m2a
17414 Generate code for the SH2a-FPU assuming the floating-point unit is in
17415 double-precision mode by default.
17416
17417 @item -m3
17418 @opindex m3
17419 Generate code for the SH3.
17420
17421 @item -m3e
17422 @opindex m3e
17423 Generate code for the SH3e.
17424
17425 @item -m4-nofpu
17426 @opindex m4-nofpu
17427 Generate code for the SH4 without a floating-point unit.
17428
17429 @item -m4-single-only
17430 @opindex m4-single-only
17431 Generate code for the SH4 with a floating-point unit that only
17432 supports single-precision arithmetic.
17433
17434 @item -m4-single
17435 @opindex m4-single
17436 Generate code for the SH4 assuming the floating-point unit is in
17437 single-precision mode by default.
17438
17439 @item -m4
17440 @opindex m4
17441 Generate code for the SH4.
17442
17443 @item -m4a-nofpu
17444 @opindex m4a-nofpu
17445 Generate code for the SH4al-dsp, or for a SH4a in such a way that the
17446 floating-point unit is not used.
17447
17448 @item -m4a-single-only
17449 @opindex m4a-single-only
17450 Generate code for the SH4a, in such a way that no double-precision
17451 floating point operations are used.
17452
17453 @item -m4a-single
17454 @opindex m4a-single
17455 Generate code for the SH4a assuming the floating-point unit is in
17456 single-precision mode by default.
17457
17458 @item -m4a
17459 @opindex m4a
17460 Generate code for the SH4a.
17461
17462 @item -m4al
17463 @opindex m4al
17464 Same as @option{-m4a-nofpu}, except that it implicitly passes
17465 @option{-dsp} to the assembler. GCC doesn't generate any DSP
17466 instructions at the moment.
17467
17468 @item -mb
17469 @opindex mb
17470 Compile code for the processor in big endian mode.
17471
17472 @item -ml
17473 @opindex ml
17474 Compile code for the processor in little endian mode.
17475
17476 @item -mdalign
17477 @opindex mdalign
17478 Align doubles at 64-bit boundaries. Note that this changes the calling
17479 conventions, and thus some functions from the standard C library will
17480 not work unless you recompile it first with @option{-mdalign}.
17481
17482 @item -mrelax
17483 @opindex mrelax
17484 Shorten some address references at link time, when possible; uses the
17485 linker option @option{-relax}.
17486
17487 @item -mbigtable
17488 @opindex mbigtable
17489 Use 32-bit offsets in @code{switch} tables. The default is to use
17490 16-bit offsets.
17491
17492 @item -mbitops
17493 @opindex mbitops
17494 Enable the use of bit manipulation instructions on SH2A.
17495
17496 @item -mfmovd
17497 @opindex mfmovd
17498 Enable the use of the instruction @code{fmovd}. Check @option{-mdalign} for
17499 alignment constraints.
17500
17501 @item -mhitachi
17502 @opindex mhitachi
17503 Comply with the calling conventions defined by Renesas.
17504
17505 @item -mrenesas
17506 @opindex mhitachi
17507 Comply with the calling conventions defined by Renesas.
17508
17509 @item -mno-renesas
17510 @opindex mhitachi
17511 Comply with the calling conventions defined for GCC before the Renesas
17512 conventions were available. This option is the default for all
17513 targets of the SH toolchain.
17514
17515 @item -mnomacsave
17516 @opindex mnomacsave
17517 Mark the @code{MAC} register as call-clobbered, even if
17518 @option{-mhitachi} is given.
17519
17520 @item -mieee
17521 @opindex mieee
17522 Increase IEEE-compliance of floating-point code.
17523 At the moment, this is equivalent to @option{-fno-finite-math-only}.
17524 When generating 16 bit SH opcodes, getting IEEE-conforming results for
17525 comparisons of NANs / infinities incurs extra overhead in every
17526 floating point comparison, therefore the default is set to
17527 @option{-ffinite-math-only}.
17528
17529 @item -minline-ic_invalidate
17530 @opindex minline-ic_invalidate
17531 Inline code to invalidate instruction cache entries after setting up
17532 nested function trampolines.
17533 This option has no effect if -musermode is in effect and the selected
17534 code generation option (e.g. -m4) does not allow the use of the icbi
17535 instruction.
17536 If the selected code generation option does not allow the use of the icbi
17537 instruction, and -musermode is not in effect, the inlined code will
17538 manipulate the instruction cache address array directly with an associative
17539 write. This not only requires privileged mode, but it will also
17540 fail if the cache line had been mapped via the TLB and has become unmapped.
17541
17542 @item -misize
17543 @opindex misize
17544 Dump instruction size and location in the assembly code.
17545
17546 @item -mpadstruct
17547 @opindex mpadstruct
17548 This option is deprecated. It pads structures to multiple of 4 bytes,
17549 which is incompatible with the SH ABI@.
17550
17551 @item -msoft-atomic
17552 @opindex msoft-atomic
17553 Generate software atomic sequences for the atomic operations.
17554 This is the default when the target is @code{sh-*-linux*}.
17555
17556 @item -mspace
17557 @opindex mspace
17558 Optimize for space instead of speed. Implied by @option{-Os}.
17559
17560 @item -mprefergot
17561 @opindex mprefergot
17562 When generating position-independent code, emit function calls using
17563 the Global Offset Table instead of the Procedure Linkage Table.
17564
17565 @item -musermode
17566 @opindex musermode
17567 Don't generate privileged mode only code; implies -mno-inline-ic_invalidate
17568 if the inlined code would not work in user mode.
17569 This is the default when the target is @code{sh-*-linux*}.
17570
17571 @item -multcost=@var{number}
17572 @opindex multcost=@var{number}
17573 Set the cost to assume for a multiply insn.
17574
17575 @item -mdiv=@var{strategy}
17576 @opindex mdiv=@var{strategy}
17577 Set the division strategy to use for SHmedia code. @var{strategy} must be
17578 one of: call, call2, fp, inv, inv:minlat, inv20u, inv20l, inv:call,
17579 inv:call2, inv:fp .
17580 "fp" performs the operation in floating point. This has a very high latency,
17581 but needs only a few instructions, so it might be a good choice if
17582 your code has enough easily exploitable ILP to allow the compiler to
17583 schedule the floating point instructions together with other instructions.
17584 Division by zero causes a floating point exception.
17585 "inv" uses integer operations to calculate the inverse of the divisor,
17586 and then multiplies the dividend with the inverse. This strategy allows
17587 cse and hoisting of the inverse calculation. Division by zero calculates
17588 an unspecified result, but does not trap.
17589 "inv:minlat" is a variant of "inv" where if no cse / hoisting opportunities
17590 have been found, or if the entire operation has been hoisted to the same
17591 place, the last stages of the inverse calculation are intertwined with the
17592 final multiply to reduce the overall latency, at the expense of using a few
17593 more instructions, and thus offering fewer scheduling opportunities with
17594 other code.
17595 "call" calls a library function that usually implements the inv:minlat
17596 strategy.
17597 This gives high code density for m5-*media-nofpu compilations.
17598 "call2" uses a different entry point of the same library function, where it
17599 assumes that a pointer to a lookup table has already been set up, which
17600 exposes the pointer load to cse / code hoisting optimizations.
17601 "inv:call", "inv:call2" and "inv:fp" all use the "inv" algorithm for initial
17602 code generation, but if the code stays unoptimized, revert to the "call",
17603 "call2", or "fp" strategies, respectively. Note that the
17604 potentially-trapping side effect of division by zero is carried by a
17605 separate instruction, so it is possible that all the integer instructions
17606 are hoisted out, but the marker for the side effect stays where it is.
17607 A recombination to fp operations or a call is not possible in that case.
17608 "inv20u" and "inv20l" are variants of the "inv:minlat" strategy. In the case
17609 that the inverse calculation was nor separated from the multiply, they speed
17610 up division where the dividend fits into 20 bits (plus sign where applicable),
17611 by inserting a test to skip a number of operations in this case; this test
17612 slows down the case of larger dividends. inv20u assumes the case of a such
17613 a small dividend to be unlikely, and inv20l assumes it to be likely.
17614
17615 @item -maccumulate-outgoing-args
17616 @opindex maccumulate-outgoing-args
17617 Reserve space once for outgoing arguments in the function prologue rather
17618 than around each call. Generally beneficial for performance and size. Also
17619 needed for unwinding to avoid changing the stack frame around conditional code.
17620
17621 @item -mdivsi3_libfunc=@var{name}
17622 @opindex mdivsi3_libfunc=@var{name}
17623 Set the name of the library function used for 32 bit signed division to
17624 @var{name}. This only affect the name used in the call and inv:call
17625 division strategies, and the compiler will still expect the same
17626 sets of input/output/clobbered registers as if this option was not present.
17627
17628 @item -mfixed-range=@var{register-range}
17629 @opindex mfixed-range
17630 Generate code treating the given register range as fixed registers.
17631 A fixed register is one that the register allocator can not use. This is
17632 useful when compiling kernel code. A register range is specified as
17633 two registers separated by a dash. Multiple register ranges can be
17634 specified separated by a comma.
17635
17636 @item -madjust-unroll
17637 @opindex madjust-unroll
17638 Throttle unrolling to avoid thrashing target registers.
17639 This option only has an effect if the gcc code base supports the
17640 TARGET_ADJUST_UNROLL_MAX target hook.
17641
17642 @item -mindexed-addressing
17643 @opindex mindexed-addressing
17644 Enable the use of the indexed addressing mode for SHmedia32/SHcompact.
17645 This is only safe if the hardware and/or OS implement 32 bit wrap-around
17646 semantics for the indexed addressing mode. The architecture allows the
17647 implementation of processors with 64 bit MMU, which the OS could use to
17648 get 32 bit addressing, but since no current hardware implementation supports
17649 this or any other way to make the indexed addressing mode safe to use in
17650 the 32 bit ABI, the default is -mno-indexed-addressing.
17651
17652 @item -mgettrcost=@var{number}
17653 @opindex mgettrcost=@var{number}
17654 Set the cost assumed for the gettr instruction to @var{number}.
17655 The default is 2 if @option{-mpt-fixed} is in effect, 100 otherwise.
17656
17657 @item -mpt-fixed
17658 @opindex mpt-fixed
17659 Assume pt* instructions won't trap. This will generally generate better
17660 scheduled code, but is unsafe on current hardware. The current architecture
17661 definition says that ptabs and ptrel trap when the target anded with 3 is 3.
17662 This has the unintentional effect of making it unsafe to schedule ptabs /
17663 ptrel before a branch, or hoist it out of a loop. For example,
17664 __do_global_ctors, a part of libgcc that runs constructors at program
17665 startup, calls functions in a list which is delimited by @minus{}1. With the
17666 -mpt-fixed option, the ptabs will be done before testing against @minus{}1.
17667 That means that all the constructors will be run a bit quicker, but when
17668 the loop comes to the end of the list, the program crashes because ptabs
17669 loads @minus{}1 into a target register. Since this option is unsafe for any
17670 hardware implementing the current architecture specification, the default
17671 is -mno-pt-fixed. Unless the user specifies a specific cost with
17672 @option{-mgettrcost}, -mno-pt-fixed also implies @option{-mgettrcost=100};
17673 this deters register allocation using target registers for storing
17674 ordinary integers.
17675
17676 @item -minvalid-symbols
17677 @opindex minvalid-symbols
17678 Assume symbols might be invalid. Ordinary function symbols generated by
17679 the compiler will always be valid to load with movi/shori/ptabs or
17680 movi/shori/ptrel, but with assembler and/or linker tricks it is possible
17681 to generate symbols that will cause ptabs / ptrel to trap.
17682 This option is only meaningful when @option{-mno-pt-fixed} is in effect.
17683 It will then prevent cross-basic-block cse, hoisting and most scheduling
17684 of symbol loads. The default is @option{-mno-invalid-symbols}.
17685 @end table
17686
17687 @node Solaris 2 Options
17688 @subsection Solaris 2 Options
17689 @cindex Solaris 2 options
17690
17691 These @samp{-m} options are supported on Solaris 2:
17692
17693 @table @gcctabopt
17694 @item -mimpure-text
17695 @opindex mimpure-text
17696 @option{-mimpure-text}, used in addition to @option{-shared}, tells
17697 the compiler to not pass @option{-z text} to the linker when linking a
17698 shared object. Using this option, you can link position-dependent
17699 code into a shared object.
17700
17701 @option{-mimpure-text} suppresses the ``relocations remain against
17702 allocatable but non-writable sections'' linker error message.
17703 However, the necessary relocations will trigger copy-on-write, and the
17704 shared object is not actually shared across processes. Instead of
17705 using @option{-mimpure-text}, you should compile all source code with
17706 @option{-fpic} or @option{-fPIC}.
17707
17708 @end table
17709
17710 These switches are supported in addition to the above on Solaris 2:
17711
17712 @table @gcctabopt
17713 @item -pthreads
17714 @opindex pthreads
17715 Add support for multithreading using the POSIX threads library. This
17716 option sets flags for both the preprocessor and linker. This option does
17717 not affect the thread safety of object code produced by the compiler or
17718 that of libraries supplied with it.
17719
17720 @item -pthread
17721 @opindex pthread
17722 This is a synonym for @option{-pthreads}.
17723 @end table
17724
17725 @node SPARC Options
17726 @subsection SPARC Options
17727 @cindex SPARC options
17728
17729 These @samp{-m} options are supported on the SPARC:
17730
17731 @table @gcctabopt
17732 @item -mno-app-regs
17733 @itemx -mapp-regs
17734 @opindex mno-app-regs
17735 @opindex mapp-regs
17736 Specify @option{-mapp-regs} to generate output using the global registers
17737 2 through 4, which the SPARC SVR4 ABI reserves for applications. This
17738 is the default.
17739
17740 To be fully SVR4 ABI compliant at the cost of some performance loss,
17741 specify @option{-mno-app-regs}. You should compile libraries and system
17742 software with this option.
17743
17744 @item -mflat
17745 @itemx -mno-flat
17746 @opindex mflat
17747 @opindex mno-flat
17748 With @option{-mflat}, the compiler does not generate save/restore instructions
17749 and uses a ``flat'' or single register window model. This model is compatible
17750 with the regular register window model. The local registers and the input
17751 registers (0--5) are still treated as ``call-saved'' registers and will be
17752 saved on the stack as needed.
17753
17754 With @option{-mno-flat} (the default), the compiler generates save/restore
17755 instructions (except for leaf functions). This is the normal operating mode.
17756
17757 @item -mfpu
17758 @itemx -mhard-float
17759 @opindex mfpu
17760 @opindex mhard-float
17761 Generate output containing floating point instructions. This is the
17762 default.
17763
17764 @item -mno-fpu
17765 @itemx -msoft-float
17766 @opindex mno-fpu
17767 @opindex msoft-float
17768 Generate output containing library calls for floating point.
17769 @strong{Warning:} the requisite libraries are not available for all SPARC
17770 targets. Normally the facilities of the machine's usual C compiler are
17771 used, but this cannot be done directly in cross-compilation. You must make
17772 your own arrangements to provide suitable library functions for
17773 cross-compilation. The embedded targets @samp{sparc-*-aout} and
17774 @samp{sparclite-*-*} do provide software floating point support.
17775
17776 @option{-msoft-float} changes the calling convention in the output file;
17777 therefore, it is only useful if you compile @emph{all} of a program with
17778 this option. In particular, you need to compile @file{libgcc.a}, the
17779 library that comes with GCC, with @option{-msoft-float} in order for
17780 this to work.
17781
17782 @item -mhard-quad-float
17783 @opindex mhard-quad-float
17784 Generate output containing quad-word (long double) floating point
17785 instructions.
17786
17787 @item -msoft-quad-float
17788 @opindex msoft-quad-float
17789 Generate output containing library calls for quad-word (long double)
17790 floating point instructions. The functions called are those specified
17791 in the SPARC ABI@. This is the default.
17792
17793 As of this writing, there are no SPARC implementations that have hardware
17794 support for the quad-word floating point instructions. They all invoke
17795 a trap handler for one of these instructions, and then the trap handler
17796 emulates the effect of the instruction. Because of the trap handler overhead,
17797 this is much slower than calling the ABI library routines. Thus the
17798 @option{-msoft-quad-float} option is the default.
17799
17800 @item -mno-unaligned-doubles
17801 @itemx -munaligned-doubles
17802 @opindex mno-unaligned-doubles
17803 @opindex munaligned-doubles
17804 Assume that doubles have 8 byte alignment. This is the default.
17805
17806 With @option{-munaligned-doubles}, GCC assumes that doubles have 8 byte
17807 alignment only if they are contained in another type, or if they have an
17808 absolute address. Otherwise, it assumes they have 4 byte alignment.
17809 Specifying this option avoids some rare compatibility problems with code
17810 generated by other compilers. It is not the default because it results
17811 in a performance loss, especially for floating point code.
17812
17813 @item -mno-faster-structs
17814 @itemx -mfaster-structs
17815 @opindex mno-faster-structs
17816 @opindex mfaster-structs
17817 With @option{-mfaster-structs}, the compiler assumes that structures
17818 should have 8 byte alignment. This enables the use of pairs of
17819 @code{ldd} and @code{std} instructions for copies in structure
17820 assignment, in place of twice as many @code{ld} and @code{st} pairs.
17821 However, the use of this changed alignment directly violates the SPARC
17822 ABI@. Thus, it's intended only for use on targets where the developer
17823 acknowledges that their resulting code will not be directly in line with
17824 the rules of the ABI@.
17825
17826 @item -mcpu=@var{cpu_type}
17827 @opindex mcpu
17828 Set the instruction set, register set, and instruction scheduling parameters
17829 for machine type @var{cpu_type}. Supported values for @var{cpu_type} are
17830 @samp{v7}, @samp{cypress}, @samp{v8}, @samp{supersparc}, @samp{hypersparc},
17831 @samp{leon}, @samp{sparclite}, @samp{f930}, @samp{f934}, @samp{sparclite86x},
17832 @samp{sparclet}, @samp{tsc701}, @samp{v9}, @samp{ultrasparc},
17833 @samp{ultrasparc3}, @samp{niagara}, @samp{niagara2}, @samp{niagara3},
17834 and @samp{niagara4}.
17835
17836 Native Solaris and GNU/Linux toolchains also support the value @samp{native},
17837 which selects the best architecture option for the host processor.
17838 @option{-mcpu=native} has no effect if GCC does not recognize
17839 the processor.
17840
17841 Default instruction scheduling parameters are used for values that select
17842 an architecture and not an implementation. These are @samp{v7}, @samp{v8},
17843 @samp{sparclite}, @samp{sparclet}, @samp{v9}.
17844
17845 Here is a list of each supported architecture and their supported
17846 implementations.
17847
17848 @table @asis
17849 @item v7
17850 cypress
17851
17852 @item v8
17853 supersparc, hypersparc, leon
17854
17855 @item sparclite
17856 f930, f934, sparclite86x
17857
17858 @item sparclet
17859 tsc701
17860
17861 @item v9
17862 ultrasparc, ultrasparc3, niagara, niagara2, niagara3, niagara4
17863 @end table
17864
17865 By default (unless configured otherwise), GCC generates code for the V7
17866 variant of the SPARC architecture. With @option{-mcpu=cypress}, the compiler
17867 additionally optimizes it for the Cypress CY7C602 chip, as used in the
17868 SPARCStation/SPARCServer 3xx series. This is also appropriate for the older
17869 SPARCStation 1, 2, IPX etc.
17870
17871 With @option{-mcpu=v8}, GCC generates code for the V8 variant of the SPARC
17872 architecture. The only difference from V7 code is that the compiler emits
17873 the integer multiply and integer divide instructions which exist in SPARC-V8
17874 but not in SPARC-V7. With @option{-mcpu=supersparc}, the compiler additionally
17875 optimizes it for the SuperSPARC chip, as used in the SPARCStation 10, 1000 and
17876 2000 series.
17877
17878 With @option{-mcpu=sparclite}, GCC generates code for the SPARClite variant of
17879 the SPARC architecture. This adds the integer multiply, integer divide step
17880 and scan (@code{ffs}) instructions which exist in SPARClite but not in SPARC-V7.
17881 With @option{-mcpu=f930}, the compiler additionally optimizes it for the
17882 Fujitsu MB86930 chip, which is the original SPARClite, with no FPU@. With
17883 @option{-mcpu=f934}, the compiler additionally optimizes it for the Fujitsu
17884 MB86934 chip, which is the more recent SPARClite with FPU@.
17885
17886 With @option{-mcpu=sparclet}, GCC generates code for the SPARClet variant of
17887 the SPARC architecture. This adds the integer multiply, multiply/accumulate,
17888 integer divide step and scan (@code{ffs}) instructions which exist in SPARClet
17889 but not in SPARC-V7. With @option{-mcpu=tsc701}, the compiler additionally
17890 optimizes it for the TEMIC SPARClet chip.
17891
17892 With @option{-mcpu=v9}, GCC generates code for the V9 variant of the SPARC
17893 architecture. This adds 64-bit integer and floating-point move instructions,
17894 3 additional floating-point condition code registers and conditional move
17895 instructions. With @option{-mcpu=ultrasparc}, the compiler additionally
17896 optimizes it for the Sun UltraSPARC I/II/IIi chips. With
17897 @option{-mcpu=ultrasparc3}, the compiler additionally optimizes it for the
17898 Sun UltraSPARC III/III+/IIIi/IIIi+/IV/IV+ chips. With
17899 @option{-mcpu=niagara}, the compiler additionally optimizes it for
17900 Sun UltraSPARC T1 chips. With @option{-mcpu=niagara2}, the compiler
17901 additionally optimizes it for Sun UltraSPARC T2 chips. With
17902 @option{-mcpu=niagara3}, the compiler additionally optimizes it for Sun
17903 UltraSPARC T3 chips. With @option{-mcpu=niagara4}, the compiler
17904 additionally optimizes it for Sun UltraSPARC T4 chips.
17905
17906 @item -mtune=@var{cpu_type}
17907 @opindex mtune
17908 Set the instruction scheduling parameters for machine type
17909 @var{cpu_type}, but do not set the instruction set or register set that the
17910 option @option{-mcpu=@var{cpu_type}} would.
17911
17912 The same values for @option{-mcpu=@var{cpu_type}} can be used for
17913 @option{-mtune=@var{cpu_type}}, but the only useful values are those
17914 that select a particular CPU implementation. Those are @samp{cypress},
17915 @samp{supersparc}, @samp{hypersparc}, @samp{leon}, @samp{f930}, @samp{f934},
17916 @samp{sparclite86x}, @samp{tsc701}, @samp{ultrasparc}, @samp{ultrasparc3},
17917 @samp{niagara}, @samp{niagara2}, @samp{niagara3} and @samp{niagara4}. With
17918 native Solaris and GNU/Linux toolchains, @samp{native} can also be used.
17919
17920 @item -mv8plus
17921 @itemx -mno-v8plus
17922 @opindex mv8plus
17923 @opindex mno-v8plus
17924 With @option{-mv8plus}, GCC generates code for the SPARC-V8+ ABI@. The
17925 difference from the V8 ABI is that the global and out registers are
17926 considered 64-bit wide. This is enabled by default on Solaris in 32-bit
17927 mode for all SPARC-V9 processors.
17928
17929 @item -mvis
17930 @itemx -mno-vis
17931 @opindex mvis
17932 @opindex mno-vis
17933 With @option{-mvis}, GCC generates code that takes advantage of the UltraSPARC
17934 Visual Instruction Set extensions. The default is @option{-mno-vis}.
17935
17936 @item -mvis2
17937 @itemx -mno-vis2
17938 @opindex mvis2
17939 @opindex mno-vis2
17940 With @option{-mvis2}, GCC generates code that takes advantage of
17941 version 2.0 of the UltraSPARC Visual Instruction Set extensions. The
17942 default is @option{-mvis2} when targetting a cpu that supports such
17943 instructions, such as UltraSPARC-III and later. Setting @option{-mvis2}
17944 also sets @option{-mvis}.
17945
17946 @item -mvis3
17947 @itemx -mno-vis3
17948 @opindex mvis3
17949 @opindex mno-vis3
17950 With @option{-mvis3}, GCC generates code that takes advantage of
17951 version 3.0 of the UltraSPARC Visual Instruction Set extensions. The
17952 default is @option{-mvis3} when targetting a cpu that supports such
17953 instructions, such as niagara-3 and later. Setting @option{-mvis3}
17954 also sets @option{-mvis2} and @option{-mvis}.
17955
17956 @item -mpopc
17957 @itemx -mno-popc
17958 @opindex mpopc
17959 @opindex mno-popc
17960 With @option{-mpopc}, GCC generates code that takes advantage of the UltraSPARC
17961 population count instruction. The default is @option{-mpopc}
17962 when targetting a cpu that supports such instructions, such as Niagara-2 and
17963 later.
17964
17965 @item -mfmaf
17966 @itemx -mno-fmaf
17967 @opindex mfmaf
17968 @opindex mno-fmaf
17969 With @option{-mfmaf}, GCC generates code that takes advantage of the UltraSPARC
17970 Fused Multiply-Add Floating-point extensions. The default is @option{-mfmaf}
17971 when targetting a cpu that supports such instructions, such as Niagara-3 and
17972 later.
17973
17974 @item -mfix-at697f
17975 @opindex mfix-at697f
17976 Enable the documented workaround for the single erratum of the Atmel AT697F
17977 processor (which corresponds to erratum #13 of the AT697E processor).
17978 @end table
17979
17980 These @samp{-m} options are supported in addition to the above
17981 on SPARC-V9 processors in 64-bit environments:
17982
17983 @table @gcctabopt
17984 @item -mlittle-endian
17985 @opindex mlittle-endian
17986 Generate code for a processor running in little-endian mode. It is only
17987 available for a few configurations and most notably not on Solaris and Linux.
17988
17989 @item -m32
17990 @itemx -m64
17991 @opindex m32
17992 @opindex m64
17993 Generate code for a 32-bit or 64-bit environment.
17994 The 32-bit environment sets int, long and pointer to 32 bits.
17995 The 64-bit environment sets int to 32 bits and long and pointer
17996 to 64 bits.
17997
17998 @item -mcmodel=@var{which}
17999 @opindex mcmodel
18000 Set the code model to one of
18001
18002 @table @samp
18003 @item medlow
18004 The Medium/Low code model: 64-bit addresses, programs
18005 must be linked in the low 32 bits of memory. Programs can be statically
18006 or dynamically linked.
18007
18008 @item medmid
18009 The Medium/Middle code model: 64-bit addresses, programs
18010 must be linked in the low 44 bits of memory, the text and data segments must
18011 be less than 2GB in size and the data segment must be located within 2GB of
18012 the text segment.
18013
18014 @item medany
18015 The Medium/Anywhere code model: 64-bit addresses, programs
18016 may be linked anywhere in memory, the text and data segments must be less
18017 than 2GB in size and the data segment must be located within 2GB of the
18018 text segment.
18019
18020 @item embmedany
18021 The Medium/Anywhere code model for embedded systems:
18022 64-bit addresses, the text and data segments must be less than 2GB in
18023 size, both starting anywhere in memory (determined at link time). The
18024 global register %g4 points to the base of the data segment. Programs
18025 are statically linked and PIC is not supported.
18026 @end table
18027
18028 @item -mmemory-model=@var{mem-model}
18029 @opindex mmemory-model
18030 Set the memory model in force on the processor to one of
18031
18032 @table @samp
18033 @item default
18034 The default memory model for the processor and operating system.
18035
18036 @item rmo
18037 Relaxed Memory Order
18038
18039 @item pso
18040 Partial Store Order
18041
18042 @item tso
18043 Total Store Order
18044
18045 @item sc
18046 Sequential Consistency
18047 @end table
18048
18049 These memory models are formally defined in Appendix D of the Sparc V9
18050 architecture manual, as set in the processor's @code{PSTATE.MM} field.
18051
18052 @item -mstack-bias
18053 @itemx -mno-stack-bias
18054 @opindex mstack-bias
18055 @opindex mno-stack-bias
18056 With @option{-mstack-bias}, GCC assumes that the stack pointer, and
18057 frame pointer if present, are offset by @minus{}2047 which must be added back
18058 when making stack frame references. This is the default in 64-bit mode.
18059 Otherwise, assume no such offset is present.
18060 @end table
18061
18062 @node SPU Options
18063 @subsection SPU Options
18064 @cindex SPU options
18065
18066 These @samp{-m} options are supported on the SPU:
18067
18068 @table @gcctabopt
18069 @item -mwarn-reloc
18070 @itemx -merror-reloc
18071 @opindex mwarn-reloc
18072 @opindex merror-reloc
18073
18074 The loader for SPU does not handle dynamic relocations. By default, GCC
18075 will give an error when it generates code that requires a dynamic
18076 relocation. @option{-mno-error-reloc} disables the error,
18077 @option{-mwarn-reloc} will generate a warning instead.
18078
18079 @item -msafe-dma
18080 @itemx -munsafe-dma
18081 @opindex msafe-dma
18082 @opindex munsafe-dma
18083
18084 Instructions which initiate or test completion of DMA must not be
18085 reordered with respect to loads and stores of the memory which is being
18086 accessed. Users typically address this problem using the volatile
18087 keyword, but that can lead to inefficient code in places where the
18088 memory is known to not change. Rather than mark the memory as volatile
18089 we treat the DMA instructions as potentially effecting all memory. With
18090 @option{-munsafe-dma} users must use the volatile keyword to protect
18091 memory accesses.
18092
18093 @item -mbranch-hints
18094 @opindex mbranch-hints
18095
18096 By default, GCC will generate a branch hint instruction to avoid
18097 pipeline stalls for always taken or probably taken branches. A hint
18098 will not be generated closer than 8 instructions away from its branch.
18099 There is little reason to disable them, except for debugging purposes,
18100 or to make an object a little bit smaller.
18101
18102 @item -msmall-mem
18103 @itemx -mlarge-mem
18104 @opindex msmall-mem
18105 @opindex mlarge-mem
18106
18107 By default, GCC generates code assuming that addresses are never larger
18108 than 18 bits. With @option{-mlarge-mem} code is generated that assumes
18109 a full 32 bit address.
18110
18111 @item -mstdmain
18112 @opindex mstdmain
18113
18114 By default, GCC links against startup code that assumes the SPU-style
18115 main function interface (which has an unconventional parameter list).
18116 With @option{-mstdmain}, GCC will link your program against startup
18117 code that assumes a C99-style interface to @code{main}, including a
18118 local copy of @code{argv} strings.
18119
18120 @item -mfixed-range=@var{register-range}
18121 @opindex mfixed-range
18122 Generate code treating the given register range as fixed registers.
18123 A fixed register is one that the register allocator can not use. This is
18124 useful when compiling kernel code. A register range is specified as
18125 two registers separated by a dash. Multiple register ranges can be
18126 specified separated by a comma.
18127
18128 @item -mea32
18129 @itemx -mea64
18130 @opindex mea32
18131 @opindex mea64
18132 Compile code assuming that pointers to the PPU address space accessed
18133 via the @code{__ea} named address space qualifier are either 32 or 64
18134 bits wide. The default is 32 bits. As this is an ABI changing option,
18135 all object code in an executable must be compiled with the same setting.
18136
18137 @item -maddress-space-conversion
18138 @itemx -mno-address-space-conversion
18139 @opindex maddress-space-conversion
18140 @opindex mno-address-space-conversion
18141 Allow/disallow treating the @code{__ea} address space as superset
18142 of the generic address space. This enables explicit type casts
18143 between @code{__ea} and generic pointer as well as implicit
18144 conversions of generic pointers to @code{__ea} pointers. The
18145 default is to allow address space pointer conversions.
18146
18147 @item -mcache-size=@var{cache-size}
18148 @opindex mcache-size
18149 This option controls the version of libgcc that the compiler links to an
18150 executable and selects a software-managed cache for accessing variables
18151 in the @code{__ea} address space with a particular cache size. Possible
18152 options for @var{cache-size} are @samp{8}, @samp{16}, @samp{32}, @samp{64}
18153 and @samp{128}. The default cache size is 64KB.
18154
18155 @item -matomic-updates
18156 @itemx -mno-atomic-updates
18157 @opindex matomic-updates
18158 @opindex mno-atomic-updates
18159 This option controls the version of libgcc that the compiler links to an
18160 executable and selects whether atomic updates to the software-managed
18161 cache of PPU-side variables are used. If you use atomic updates, changes
18162 to a PPU variable from SPU code using the @code{__ea} named address space
18163 qualifier will not interfere with changes to other PPU variables residing
18164 in the same cache line from PPU code. If you do not use atomic updates,
18165 such interference may occur; however, writing back cache lines will be
18166 more efficient. The default behavior is to use atomic updates.
18167
18168 @item -mdual-nops
18169 @itemx -mdual-nops=@var{n}
18170 @opindex mdual-nops
18171 By default, GCC will insert nops to increase dual issue when it expects
18172 it to increase performance. @var{n} can be a value from 0 to 10. A
18173 smaller @var{n} will insert fewer nops. 10 is the default, 0 is the
18174 same as @option{-mno-dual-nops}. Disabled with @option{-Os}.
18175
18176 @item -mhint-max-nops=@var{n}
18177 @opindex mhint-max-nops
18178 Maximum number of nops to insert for a branch hint. A branch hint must
18179 be at least 8 instructions away from the branch it is effecting. GCC
18180 will insert up to @var{n} nops to enforce this, otherwise it will not
18181 generate the branch hint.
18182
18183 @item -mhint-max-distance=@var{n}
18184 @opindex mhint-max-distance
18185 The encoding of the branch hint instruction limits the hint to be within
18186 256 instructions of the branch it is effecting. By default, GCC makes
18187 sure it is within 125.
18188
18189 @item -msafe-hints
18190 @opindex msafe-hints
18191 Work around a hardware bug which causes the SPU to stall indefinitely.
18192 By default, GCC will insert the @code{hbrp} instruction to make sure
18193 this stall won't happen.
18194
18195 @end table
18196
18197 @node System V Options
18198 @subsection Options for System V
18199
18200 These additional options are available on System V Release 4 for
18201 compatibility with other compilers on those systems:
18202
18203 @table @gcctabopt
18204 @item -G
18205 @opindex G
18206 Create a shared object.
18207 It is recommended that @option{-symbolic} or @option{-shared} be used instead.
18208
18209 @item -Qy
18210 @opindex Qy
18211 Identify the versions of each tool used by the compiler, in a
18212 @code{.ident} assembler directive in the output.
18213
18214 @item -Qn
18215 @opindex Qn
18216 Refrain from adding @code{.ident} directives to the output file (this is
18217 the default).
18218
18219 @item -YP,@var{dirs}
18220 @opindex YP
18221 Search the directories @var{dirs}, and no others, for libraries
18222 specified with @option{-l}.
18223
18224 @item -Ym,@var{dir}
18225 @opindex Ym
18226 Look in the directory @var{dir} to find the M4 preprocessor.
18227 The assembler uses this option.
18228 @c This is supposed to go with a -Yd for predefined M4 macro files, but
18229 @c the generic assembler that comes with Solaris takes just -Ym.
18230 @end table
18231
18232 @node V850 Options
18233 @subsection V850 Options
18234 @cindex V850 Options
18235
18236 These @samp{-m} options are defined for V850 implementations:
18237
18238 @table @gcctabopt
18239 @item -mlong-calls
18240 @itemx -mno-long-calls
18241 @opindex mlong-calls
18242 @opindex mno-long-calls
18243 Treat all calls as being far away (near). If calls are assumed to be
18244 far away, the compiler will always load the functions address up into a
18245 register, and call indirect through the pointer.
18246
18247 @item -mno-ep
18248 @itemx -mep
18249 @opindex mno-ep
18250 @opindex mep
18251 Do not optimize (do optimize) basic blocks that use the same index
18252 pointer 4 or more times to copy pointer into the @code{ep} register, and
18253 use the shorter @code{sld} and @code{sst} instructions. The @option{-mep}
18254 option is on by default if you optimize.
18255
18256 @item -mno-prolog-function
18257 @itemx -mprolog-function
18258 @opindex mno-prolog-function
18259 @opindex mprolog-function
18260 Do not use (do use) external functions to save and restore registers
18261 at the prologue and epilogue of a function. The external functions
18262 are slower, but use less code space if more than one function saves
18263 the same number of registers. The @option{-mprolog-function} option
18264 is on by default if you optimize.
18265
18266 @item -mspace
18267 @opindex mspace
18268 Try to make the code as small as possible. At present, this just turns
18269 on the @option{-mep} and @option{-mprolog-function} options.
18270
18271 @item -mtda=@var{n}
18272 @opindex mtda
18273 Put static or global variables whose size is @var{n} bytes or less into
18274 the tiny data area that register @code{ep} points to. The tiny data
18275 area can hold up to 256 bytes in total (128 bytes for byte references).
18276
18277 @item -msda=@var{n}
18278 @opindex msda
18279 Put static or global variables whose size is @var{n} bytes or less into
18280 the small data area that register @code{gp} points to. The small data
18281 area can hold up to 64 kilobytes.
18282
18283 @item -mzda=@var{n}
18284 @opindex mzda
18285 Put static or global variables whose size is @var{n} bytes or less into
18286 the first 32 kilobytes of memory.
18287
18288 @item -mv850
18289 @opindex mv850
18290 Specify that the target processor is the V850.
18291
18292 @item -mbig-switch
18293 @opindex mbig-switch
18294 Generate code suitable for big switch tables. Use this option only if
18295 the assembler/linker complain about out of range branches within a switch
18296 table.
18297
18298 @item -mapp-regs
18299 @opindex mapp-regs
18300 This option will cause r2 and r5 to be used in the code generated by
18301 the compiler. This setting is the default.
18302
18303 @item -mno-app-regs
18304 @opindex mno-app-regs
18305 This option will cause r2 and r5 to be treated as fixed registers.
18306
18307 @item -mv850e2v3
18308 @opindex mv850e2v3
18309 Specify that the target processor is the V850E2V3. The preprocessor
18310 constants @samp{__v850e2v3__} will be defined if
18311 this option is used.
18312
18313 @item -mv850e2
18314 @opindex mv850e2
18315 Specify that the target processor is the V850E2. The preprocessor
18316 constants @samp{__v850e2__} will be defined if this option is used.
18317
18318 @item -mv850e1
18319 @opindex mv850e1
18320 Specify that the target processor is the V850E1. The preprocessor
18321 constants @samp{__v850e1__} and @samp{__v850e__} will be defined if
18322 this option is used.
18323
18324 @item -mv850es
18325 @opindex mv850es
18326 Specify that the target processor is the V850ES. This is an alias for
18327 the @option{-mv850e1} option.
18328
18329 @item -mv850e
18330 @opindex mv850e
18331 Specify that the target processor is the V850E@. The preprocessor
18332 constant @samp{__v850e__} will be defined if this option is used.
18333
18334 If neither @option{-mv850} nor @option{-mv850e} nor @option{-mv850e1}
18335 nor @option{-mv850e2} nor @option{-mv850e2v3}
18336 are defined then a default target processor will be chosen and the
18337 relevant @samp{__v850*__} preprocessor constant will be defined.
18338
18339 The preprocessor constants @samp{__v850} and @samp{__v851__} are always
18340 defined, regardless of which processor variant is the target.
18341
18342 @item -mdisable-callt
18343 @opindex mdisable-callt
18344 This option will suppress generation of the CALLT instruction for the
18345 v850e, v850e1, v850e2 and v850e2v3 flavors of the v850 architecture. The default is
18346 @option{-mno-disable-callt} which allows the CALLT instruction to be used.
18347
18348 @end table
18349
18350 @node VAX Options
18351 @subsection VAX Options
18352 @cindex VAX options
18353
18354 These @samp{-m} options are defined for the VAX:
18355
18356 @table @gcctabopt
18357 @item -munix
18358 @opindex munix
18359 Do not output certain jump instructions (@code{aobleq} and so on)
18360 that the Unix assembler for the VAX cannot handle across long
18361 ranges.
18362
18363 @item -mgnu
18364 @opindex mgnu
18365 Do output those jump instructions, on the assumption that you
18366 will assemble with the GNU assembler.
18367
18368 @item -mg
18369 @opindex mg
18370 Output code for g-format floating point numbers instead of d-format.
18371 @end table
18372
18373 @node VxWorks Options
18374 @subsection VxWorks Options
18375 @cindex VxWorks Options
18376
18377 The options in this section are defined for all VxWorks targets.
18378 Options specific to the target hardware are listed with the other
18379 options for that target.
18380
18381 @table @gcctabopt
18382 @item -mrtp
18383 @opindex mrtp
18384 GCC can generate code for both VxWorks kernels and real time processes
18385 (RTPs). This option switches from the former to the latter. It also
18386 defines the preprocessor macro @code{__RTP__}.
18387
18388 @item -non-static
18389 @opindex non-static
18390 Link an RTP executable against shared libraries rather than static
18391 libraries. The options @option{-static} and @option{-shared} can
18392 also be used for RTPs (@pxref{Link Options}); @option{-static}
18393 is the default.
18394
18395 @item -Bstatic
18396 @itemx -Bdynamic
18397 @opindex Bstatic
18398 @opindex Bdynamic
18399 These options are passed down to the linker. They are defined for
18400 compatibility with Diab.
18401
18402 @item -Xbind-lazy
18403 @opindex Xbind-lazy
18404 Enable lazy binding of function calls. This option is equivalent to
18405 @option{-Wl,-z,now} and is defined for compatibility with Diab.
18406
18407 @item -Xbind-now
18408 @opindex Xbind-now
18409 Disable lazy binding of function calls. This option is the default and
18410 is defined for compatibility with Diab.
18411 @end table
18412
18413 @node x86-64 Options
18414 @subsection x86-64 Options
18415 @cindex x86-64 options
18416
18417 These are listed under @xref{i386 and x86-64 Options}.
18418
18419 @node Xstormy16 Options
18420 @subsection Xstormy16 Options
18421 @cindex Xstormy16 Options
18422
18423 These options are defined for Xstormy16:
18424
18425 @table @gcctabopt
18426 @item -msim
18427 @opindex msim
18428 Choose startup files and linker script suitable for the simulator.
18429 @end table
18430
18431 @node Xtensa Options
18432 @subsection Xtensa Options
18433 @cindex Xtensa Options
18434
18435 These options are supported for Xtensa targets:
18436
18437 @table @gcctabopt
18438 @item -mconst16
18439 @itemx -mno-const16
18440 @opindex mconst16
18441 @opindex mno-const16
18442 Enable or disable use of @code{CONST16} instructions for loading
18443 constant values. The @code{CONST16} instruction is currently not a
18444 standard option from Tensilica. When enabled, @code{CONST16}
18445 instructions are always used in place of the standard @code{L32R}
18446 instructions. The use of @code{CONST16} is enabled by default only if
18447 the @code{L32R} instruction is not available.
18448
18449 @item -mfused-madd
18450 @itemx -mno-fused-madd
18451 @opindex mfused-madd
18452 @opindex mno-fused-madd
18453 Enable or disable use of fused multiply/add and multiply/subtract
18454 instructions in the floating-point option. This has no effect if the
18455 floating-point option is not also enabled. Disabling fused multiply/add
18456 and multiply/subtract instructions forces the compiler to use separate
18457 instructions for the multiply and add/subtract operations. This may be
18458 desirable in some cases where strict IEEE 754-compliant results are
18459 required: the fused multiply add/subtract instructions do not round the
18460 intermediate result, thereby producing results with @emph{more} bits of
18461 precision than specified by the IEEE standard. Disabling fused multiply
18462 add/subtract instructions also ensures that the program output is not
18463 sensitive to the compiler's ability to combine multiply and add/subtract
18464 operations.
18465
18466 @item -mserialize-volatile
18467 @itemx -mno-serialize-volatile
18468 @opindex mserialize-volatile
18469 @opindex mno-serialize-volatile
18470 When this option is enabled, GCC inserts @code{MEMW} instructions before
18471 @code{volatile} memory references to guarantee sequential consistency.
18472 The default is @option{-mserialize-volatile}. Use
18473 @option{-mno-serialize-volatile} to omit the @code{MEMW} instructions.
18474
18475 @item -mforce-no-pic
18476 @opindex mforce-no-pic
18477 For targets, like GNU/Linux, where all user-mode Xtensa code must be
18478 position-independent code (PIC), this option disables PIC for compiling
18479 kernel code.
18480
18481 @item -mtext-section-literals
18482 @itemx -mno-text-section-literals
18483 @opindex mtext-section-literals
18484 @opindex mno-text-section-literals
18485 Control the treatment of literal pools. The default is
18486 @option{-mno-text-section-literals}, which places literals in a separate
18487 section in the output file. This allows the literal pool to be placed
18488 in a data RAM/ROM, and it also allows the linker to combine literal
18489 pools from separate object files to remove redundant literals and
18490 improve code size. With @option{-mtext-section-literals}, the literals
18491 are interspersed in the text section in order to keep them as close as
18492 possible to their references. This may be necessary for large assembly
18493 files.
18494
18495 @item -mtarget-align
18496 @itemx -mno-target-align
18497 @opindex mtarget-align
18498 @opindex mno-target-align
18499 When this option is enabled, GCC instructs the assembler to
18500 automatically align instructions to reduce branch penalties at the
18501 expense of some code density. The assembler attempts to widen density
18502 instructions to align branch targets and the instructions following call
18503 instructions. If there are not enough preceding safe density
18504 instructions to align a target, no widening will be performed. The
18505 default is @option{-mtarget-align}. These options do not affect the
18506 treatment of auto-aligned instructions like @code{LOOP}, which the
18507 assembler will always align, either by widening density instructions or
18508 by inserting no-op instructions.
18509
18510 @item -mlongcalls
18511 @itemx -mno-longcalls
18512 @opindex mlongcalls
18513 @opindex mno-longcalls
18514 When this option is enabled, GCC instructs the assembler to translate
18515 direct calls to indirect calls unless it can determine that the target
18516 of a direct call is in the range allowed by the call instruction. This
18517 translation typically occurs for calls to functions in other source
18518 files. Specifically, the assembler translates a direct @code{CALL}
18519 instruction into an @code{L32R} followed by a @code{CALLX} instruction.
18520 The default is @option{-mno-longcalls}. This option should be used in
18521 programs where the call target can potentially be out of range. This
18522 option is implemented in the assembler, not the compiler, so the
18523 assembly code generated by GCC will still show direct call
18524 instructions---look at the disassembled object code to see the actual
18525 instructions. Note that the assembler will use an indirect call for
18526 every cross-file call, not just those that really will be out of range.
18527 @end table
18528
18529 @node zSeries Options
18530 @subsection zSeries Options
18531 @cindex zSeries options
18532
18533 These are listed under @xref{S/390 and zSeries Options}.
18534
18535 @node Code Gen Options
18536 @section Options for Code Generation Conventions
18537 @cindex code generation conventions
18538 @cindex options, code generation
18539 @cindex run-time options
18540
18541 These machine-independent options control the interface conventions
18542 used in code generation.
18543
18544 Most of them have both positive and negative forms; the negative form
18545 of @option{-ffoo} would be @option{-fno-foo}. In the table below, only
18546 one of the forms is listed---the one which is not the default. You
18547 can figure out the other form by either removing @samp{no-} or adding
18548 it.
18549
18550 @table @gcctabopt
18551 @item -fbounds-check
18552 @opindex fbounds-check
18553 For front-ends that support it, generate additional code to check that
18554 indices used to access arrays are within the declared range. This is
18555 currently only supported by the Java and Fortran front-ends, where
18556 this option defaults to true and false respectively.
18557
18558 @item -ftrapv
18559 @opindex ftrapv
18560 This option generates traps for signed overflow on addition, subtraction,
18561 multiplication operations.
18562
18563 @item -fwrapv
18564 @opindex fwrapv
18565 This option instructs the compiler to assume that signed arithmetic
18566 overflow of addition, subtraction and multiplication wraps around
18567 using twos-complement representation. This flag enables some optimizations
18568 and disables others. This option is enabled by default for the Java
18569 front-end, as required by the Java language specification.
18570
18571 @item -fexceptions
18572 @opindex fexceptions
18573 Enable exception handling. Generates extra code needed to propagate
18574 exceptions. For some targets, this implies GCC will generate frame
18575 unwind information for all functions, which can produce significant data
18576 size overhead, although it does not affect execution. If you do not
18577 specify this option, GCC will enable it by default for languages like
18578 C++ which normally require exception handling, and disable it for
18579 languages like C that do not normally require it. However, you may need
18580 to enable this option when compiling C code that needs to interoperate
18581 properly with exception handlers written in C++. You may also wish to
18582 disable this option if you are compiling older C++ programs that don't
18583 use exception handling.
18584
18585 @item -fnon-call-exceptions
18586 @opindex fnon-call-exceptions
18587 Generate code that allows trapping instructions to throw exceptions.
18588 Note that this requires platform-specific runtime support that does
18589 not exist everywhere. Moreover, it only allows @emph{trapping}
18590 instructions to throw exceptions, i.e.@: memory references or floating
18591 point instructions. It does not allow exceptions to be thrown from
18592 arbitrary signal handlers such as @code{SIGALRM}.
18593
18594 @item -funwind-tables
18595 @opindex funwind-tables
18596 Similar to @option{-fexceptions}, except that it will just generate any needed
18597 static data, but will not affect the generated code in any other way.
18598 You will normally not enable this option; instead, a language processor
18599 that needs this handling would enable it on your behalf.
18600
18601 @item -fasynchronous-unwind-tables
18602 @opindex fasynchronous-unwind-tables
18603 Generate unwind table in dwarf2 format, if supported by target machine. The
18604 table is exact at each instruction boundary, so it can be used for stack
18605 unwinding from asynchronous events (such as debugger or garbage collector).
18606
18607 @item -fpcc-struct-return
18608 @opindex fpcc-struct-return
18609 Return ``short'' @code{struct} and @code{union} values in memory like
18610 longer ones, rather than in registers. This convention is less
18611 efficient, but it has the advantage of allowing intercallability between
18612 GCC-compiled files and files compiled with other compilers, particularly
18613 the Portable C Compiler (pcc).
18614
18615 The precise convention for returning structures in memory depends
18616 on the target configuration macros.
18617
18618 Short structures and unions are those whose size and alignment match
18619 that of some integer type.
18620
18621 @strong{Warning:} code compiled with the @option{-fpcc-struct-return}
18622 switch is not binary compatible with code compiled with the
18623 @option{-freg-struct-return} switch.
18624 Use it to conform to a non-default application binary interface.
18625
18626 @item -freg-struct-return
18627 @opindex freg-struct-return
18628 Return @code{struct} and @code{union} values in registers when possible.
18629 This is more efficient for small structures than
18630 @option{-fpcc-struct-return}.
18631
18632 If you specify neither @option{-fpcc-struct-return} nor
18633 @option{-freg-struct-return}, GCC defaults to whichever convention is
18634 standard for the target. If there is no standard convention, GCC
18635 defaults to @option{-fpcc-struct-return}, except on targets where GCC is
18636 the principal compiler. In those cases, we can choose the standard, and
18637 we chose the more efficient register return alternative.
18638
18639 @strong{Warning:} code compiled with the @option{-freg-struct-return}
18640 switch is not binary compatible with code compiled with the
18641 @option{-fpcc-struct-return} switch.
18642 Use it to conform to a non-default application binary interface.
18643
18644 @item -fshort-enums
18645 @opindex fshort-enums
18646 Allocate to an @code{enum} type only as many bytes as it needs for the
18647 declared range of possible values. Specifically, the @code{enum} type
18648 will be equivalent to the smallest integer type which has enough room.
18649
18650 @strong{Warning:} the @option{-fshort-enums} switch causes GCC to generate
18651 code that is not binary compatible with code generated without that switch.
18652 Use it to conform to a non-default application binary interface.
18653
18654 @item -fshort-double
18655 @opindex fshort-double
18656 Use the same size for @code{double} as for @code{float}.
18657
18658 @strong{Warning:} the @option{-fshort-double} switch causes GCC to generate
18659 code that is not binary compatible with code generated without that switch.
18660 Use it to conform to a non-default application binary interface.
18661
18662 @item -fshort-wchar
18663 @opindex fshort-wchar
18664 Override the underlying type for @samp{wchar_t} to be @samp{short
18665 unsigned int} instead of the default for the target. This option is
18666 useful for building programs to run under WINE@.
18667
18668 @strong{Warning:} the @option{-fshort-wchar} switch causes GCC to generate
18669 code that is not binary compatible with code generated without that switch.
18670 Use it to conform to a non-default application binary interface.
18671
18672 @item -fno-common
18673 @opindex fno-common
18674 In C code, controls the placement of uninitialized global variables.
18675 Unix C compilers have traditionally permitted multiple definitions of
18676 such variables in different compilation units by placing the variables
18677 in a common block.
18678 This is the behavior specified by @option{-fcommon}, and is the default
18679 for GCC on most targets.
18680 On the other hand, this behavior is not required by ISO C, and on some
18681 targets may carry a speed or code size penalty on variable references.
18682 The @option{-fno-common} option specifies that the compiler should place
18683 uninitialized global variables in the data section of the object file,
18684 rather than generating them as common blocks.
18685 This has the effect that if the same variable is declared
18686 (without @code{extern}) in two different compilations,
18687 you will get a multiple-definition error when you link them.
18688 In this case, you must compile with @option{-fcommon} instead.
18689 Compiling with @option{-fno-common} is useful on targets for which
18690 it provides better performance, or if you wish to verify that the
18691 program will work on other systems which always treat uninitialized
18692 variable declarations this way.
18693
18694 @item -fno-ident
18695 @opindex fno-ident
18696 Ignore the @samp{#ident} directive.
18697
18698 @item -finhibit-size-directive
18699 @opindex finhibit-size-directive
18700 Don't output a @code{.size} assembler directive, or anything else that
18701 would cause trouble if the function is split in the middle, and the
18702 two halves are placed at locations far apart in memory. This option is
18703 used when compiling @file{crtstuff.c}; you should not need to use it
18704 for anything else.
18705
18706 @item -fverbose-asm
18707 @opindex fverbose-asm
18708 Put extra commentary information in the generated assembly code to
18709 make it more readable. This option is generally only of use to those
18710 who actually need to read the generated assembly code (perhaps while
18711 debugging the compiler itself).
18712
18713 @option{-fno-verbose-asm}, the default, causes the
18714 extra information to be omitted and is useful when comparing two assembler
18715 files.
18716
18717 @item -frecord-gcc-switches
18718 @opindex frecord-gcc-switches
18719 This switch causes the command line that was used to invoke the
18720 compiler to be recorded into the object file that is being created.
18721 This switch is only implemented on some targets and the exact format
18722 of the recording is target and binary file format dependent, but it
18723 usually takes the form of a section containing ASCII text. This
18724 switch is related to the @option{-fverbose-asm} switch, but that
18725 switch only records information in the assembler output file as
18726 comments, so it never reaches the object file.
18727 See also @option{-grecord-gcc-switches} for another
18728 way of storing compiler options into the object file.
18729
18730 @item -fpic
18731 @opindex fpic
18732 @cindex global offset table
18733 @cindex PIC
18734 Generate position-independent code (PIC) suitable for use in a shared
18735 library, if supported for the target machine. Such code accesses all
18736 constant addresses through a global offset table (GOT)@. The dynamic
18737 loader resolves the GOT entries when the program starts (the dynamic
18738 loader is not part of GCC; it is part of the operating system). If
18739 the GOT size for the linked executable exceeds a machine-specific
18740 maximum size, you get an error message from the linker indicating that
18741 @option{-fpic} does not work; in that case, recompile with @option{-fPIC}
18742 instead. (These maximums are 8k on the SPARC and 32k
18743 on the m68k and RS/6000. The 386 has no such limit.)
18744
18745 Position-independent code requires special support, and therefore works
18746 only on certain machines. For the 386, GCC supports PIC for System V
18747 but not for the Sun 386i. Code generated for the IBM RS/6000 is always
18748 position-independent.
18749
18750 When this flag is set, the macros @code{__pic__} and @code{__PIC__}
18751 are defined to 1.
18752
18753 @item -fPIC
18754 @opindex fPIC
18755 If supported for the target machine, emit position-independent code,
18756 suitable for dynamic linking and avoiding any limit on the size of the
18757 global offset table. This option makes a difference on the m68k,
18758 PowerPC and SPARC@.
18759
18760 Position-independent code requires special support, and therefore works
18761 only on certain machines.
18762
18763 When this flag is set, the macros @code{__pic__} and @code{__PIC__}
18764 are defined to 2.
18765
18766 @item -fpie
18767 @itemx -fPIE
18768 @opindex fpie
18769 @opindex fPIE
18770 These options are similar to @option{-fpic} and @option{-fPIC}, but
18771 generated position independent code can be only linked into executables.
18772 Usually these options are used when @option{-pie} GCC option will be
18773 used during linking.
18774
18775 @option{-fpie} and @option{-fPIE} both define the macros
18776 @code{__pie__} and @code{__PIE__}. The macros have the value 1
18777 for @option{-fpie} and 2 for @option{-fPIE}.
18778
18779 @item -fno-jump-tables
18780 @opindex fno-jump-tables
18781 Do not use jump tables for switch statements even where it would be
18782 more efficient than other code generation strategies. This option is
18783 of use in conjunction with @option{-fpic} or @option{-fPIC} for
18784 building code which forms part of a dynamic linker and cannot
18785 reference the address of a jump table. On some targets, jump tables
18786 do not require a GOT and this option is not needed.
18787
18788 @item -ffixed-@var{reg}
18789 @opindex ffixed
18790 Treat the register named @var{reg} as a fixed register; generated code
18791 should never refer to it (except perhaps as a stack pointer, frame
18792 pointer or in some other fixed role).
18793
18794 @var{reg} must be the name of a register. The register names accepted
18795 are machine-specific and are defined in the @code{REGISTER_NAMES}
18796 macro in the machine description macro file.
18797
18798 This flag does not have a negative form, because it specifies a
18799 three-way choice.
18800
18801 @item -fcall-used-@var{reg}
18802 @opindex fcall-used
18803 Treat the register named @var{reg} as an allocable register that is
18804 clobbered by function calls. It may be allocated for temporaries or
18805 variables that do not live across a call. Functions compiled this way
18806 will not save and restore the register @var{reg}.
18807
18808 It is an error to used this flag with the frame pointer or stack pointer.
18809 Use of this flag for other registers that have fixed pervasive roles in
18810 the machine's execution model will produce disastrous results.
18811
18812 This flag does not have a negative form, because it specifies a
18813 three-way choice.
18814
18815 @item -fcall-saved-@var{reg}
18816 @opindex fcall-saved
18817 Treat the register named @var{reg} as an allocable register saved by
18818 functions. It may be allocated even for temporaries or variables that
18819 live across a call. Functions compiled this way will save and restore
18820 the register @var{reg} if they use it.
18821
18822 It is an error to used this flag with the frame pointer or stack pointer.
18823 Use of this flag for other registers that have fixed pervasive roles in
18824 the machine's execution model will produce disastrous results.
18825
18826 A different sort of disaster will result from the use of this flag for
18827 a register in which function values may be returned.
18828
18829 This flag does not have a negative form, because it specifies a
18830 three-way choice.
18831
18832 @item -fpack-struct[=@var{n}]
18833 @opindex fpack-struct
18834 Without a value specified, pack all structure members together without
18835 holes. When a value is specified (which must be a small power of two), pack
18836 structure members according to this value, representing the maximum
18837 alignment (that is, objects with default alignment requirements larger than
18838 this will be output potentially unaligned at the next fitting location.
18839
18840 @strong{Warning:} the @option{-fpack-struct} switch causes GCC to generate
18841 code that is not binary compatible with code generated without that switch.
18842 Additionally, it makes the code suboptimal.
18843 Use it to conform to a non-default application binary interface.
18844
18845 @item -finstrument-functions
18846 @opindex finstrument-functions
18847 Generate instrumentation calls for entry and exit to functions. Just
18848 after function entry and just before function exit, the following
18849 profiling functions will be called with the address of the current
18850 function and its call site. (On some platforms,
18851 @code{__builtin_return_address} does not work beyond the current
18852 function, so the call site information may not be available to the
18853 profiling functions otherwise.)
18854
18855 @smallexample
18856 void __cyg_profile_func_enter (void *this_fn,
18857 void *call_site);
18858 void __cyg_profile_func_exit (void *this_fn,
18859 void *call_site);
18860 @end smallexample
18861
18862 The first argument is the address of the start of the current function,
18863 which may be looked up exactly in the symbol table.
18864
18865 This instrumentation is also done for functions expanded inline in other
18866 functions. The profiling calls will indicate where, conceptually, the
18867 inline function is entered and exited. This means that addressable
18868 versions of such functions must be available. If all your uses of a
18869 function are expanded inline, this may mean an additional expansion of
18870 code size. If you use @samp{extern inline} in your C code, an
18871 addressable version of such functions must be provided. (This is
18872 normally the case anyways, but if you get lucky and the optimizer always
18873 expands the functions inline, you might have gotten away without
18874 providing static copies.)
18875
18876 A function may be given the attribute @code{no_instrument_function}, in
18877 which case this instrumentation will not be done. This can be used, for
18878 example, for the profiling functions listed above, high-priority
18879 interrupt routines, and any functions from which the profiling functions
18880 cannot safely be called (perhaps signal handlers, if the profiling
18881 routines generate output or allocate memory).
18882
18883 @item -finstrument-functions-exclude-file-list=@var{file},@var{file},@dots{}
18884 @opindex finstrument-functions-exclude-file-list
18885
18886 Set the list of functions that are excluded from instrumentation (see
18887 the description of @code{-finstrument-functions}). If the file that
18888 contains a function definition matches with one of @var{file}, then
18889 that function is not instrumented. The match is done on substrings:
18890 if the @var{file} parameter is a substring of the file name, it is
18891 considered to be a match.
18892
18893 For example:
18894
18895 @smallexample
18896 -finstrument-functions-exclude-file-list=/bits/stl,include/sys
18897 @end smallexample
18898
18899 @noindent
18900 will exclude any inline function defined in files whose pathnames
18901 contain @code{/bits/stl} or @code{include/sys}.
18902
18903 If, for some reason, you want to include letter @code{','} in one of
18904 @var{sym}, write @code{'\,'}. For example,
18905 @code{-finstrument-functions-exclude-file-list='\,\,tmp'}
18906 (note the single quote surrounding the option).
18907
18908 @item -finstrument-functions-exclude-function-list=@var{sym},@var{sym},@dots{}
18909 @opindex finstrument-functions-exclude-function-list
18910
18911 This is similar to @code{-finstrument-functions-exclude-file-list},
18912 but this option sets the list of function names to be excluded from
18913 instrumentation. The function name to be matched is its user-visible
18914 name, such as @code{vector<int> blah(const vector<int> &)}, not the
18915 internal mangled name (e.g., @code{_Z4blahRSt6vectorIiSaIiEE}). The
18916 match is done on substrings: if the @var{sym} parameter is a substring
18917 of the function name, it is considered to be a match. For C99 and C++
18918 extended identifiers, the function name must be given in UTF-8, not
18919 using universal character names.
18920
18921 @item -fstack-check
18922 @opindex fstack-check
18923 Generate code to verify that you do not go beyond the boundary of the
18924 stack. You should specify this flag if you are running in an
18925 environment with multiple threads, but only rarely need to specify it in
18926 a single-threaded environment since stack overflow is automatically
18927 detected on nearly all systems if there is only one stack.
18928
18929 Note that this switch does not actually cause checking to be done; the
18930 operating system or the language runtime must do that. The switch causes
18931 generation of code to ensure that they see the stack being extended.
18932
18933 You can additionally specify a string parameter: @code{no} means no
18934 checking, @code{generic} means force the use of old-style checking,
18935 @code{specific} means use the best checking method and is equivalent
18936 to bare @option{-fstack-check}.
18937
18938 Old-style checking is a generic mechanism that requires no specific
18939 target support in the compiler but comes with the following drawbacks:
18940
18941 @enumerate
18942 @item
18943 Modified allocation strategy for large objects: they will always be
18944 allocated dynamically if their size exceeds a fixed threshold.
18945
18946 @item
18947 Fixed limit on the size of the static frame of functions: when it is
18948 topped by a particular function, stack checking is not reliable and
18949 a warning is issued by the compiler.
18950
18951 @item
18952 Inefficiency: because of both the modified allocation strategy and the
18953 generic implementation, the performances of the code are hampered.
18954 @end enumerate
18955
18956 Note that old-style stack checking is also the fallback method for
18957 @code{specific} if no target support has been added in the compiler.
18958
18959 @item -fstack-limit-register=@var{reg}
18960 @itemx -fstack-limit-symbol=@var{sym}
18961 @itemx -fno-stack-limit
18962 @opindex fstack-limit-register
18963 @opindex fstack-limit-symbol
18964 @opindex fno-stack-limit
18965 Generate code to ensure that the stack does not grow beyond a certain value,
18966 either the value of a register or the address of a symbol. If the stack
18967 would grow beyond the value, a signal is raised. For most targets,
18968 the signal is raised before the stack overruns the boundary, so
18969 it is possible to catch the signal without taking special precautions.
18970
18971 For instance, if the stack starts at absolute address @samp{0x80000000}
18972 and grows downwards, you can use the flags
18973 @option{-fstack-limit-symbol=__stack_limit} and
18974 @option{-Wl,--defsym,__stack_limit=0x7ffe0000} to enforce a stack limit
18975 of 128KB@. Note that this may only work with the GNU linker.
18976
18977 @item -fsplit-stack
18978 @opindex fsplit-stack
18979 Generate code to automatically split the stack before it overflows.
18980 The resulting program has a discontiguous stack which can only
18981 overflow if the program is unable to allocate any more memory. This
18982 is most useful when running threaded programs, as it is no longer
18983 necessary to calculate a good stack size to use for each thread. This
18984 is currently only implemented for the i386 and x86_64 backends running
18985 GNU/Linux.
18986
18987 When code compiled with @option{-fsplit-stack} calls code compiled
18988 without @option{-fsplit-stack}, there may not be much stack space
18989 available for the latter code to run. If compiling all code,
18990 including library code, with @option{-fsplit-stack} is not an option,
18991 then the linker can fix up these calls so that the code compiled
18992 without @option{-fsplit-stack} always has a large stack. Support for
18993 this is implemented in the gold linker in GNU binutils release 2.21
18994 and later.
18995
18996 @item -fleading-underscore
18997 @opindex fleading-underscore
18998 This option and its counterpart, @option{-fno-leading-underscore}, forcibly
18999 change the way C symbols are represented in the object file. One use
19000 is to help link with legacy assembly code.
19001
19002 @strong{Warning:} the @option{-fleading-underscore} switch causes GCC to
19003 generate code that is not binary compatible with code generated without that
19004 switch. Use it to conform to a non-default application binary interface.
19005 Not all targets provide complete support for this switch.
19006
19007 @item -ftls-model=@var{model}
19008 @opindex ftls-model
19009 Alter the thread-local storage model to be used (@pxref{Thread-Local}).
19010 The @var{model} argument should be one of @code{global-dynamic},
19011 @code{local-dynamic}, @code{initial-exec} or @code{local-exec}.
19012
19013 The default without @option{-fpic} is @code{initial-exec}; with
19014 @option{-fpic} the default is @code{global-dynamic}.
19015
19016 @item -fvisibility=@var{default|internal|hidden|protected}
19017 @opindex fvisibility
19018 Set the default ELF image symbol visibility to the specified option---all
19019 symbols will be marked with this unless overridden within the code.
19020 Using this feature can very substantially improve linking and
19021 load times of shared object libraries, produce more optimized
19022 code, provide near-perfect API export and prevent symbol clashes.
19023 It is @strong{strongly} recommended that you use this in any shared objects
19024 you distribute.
19025
19026 Despite the nomenclature, @code{default} always means public; i.e.,
19027 available to be linked against from outside the shared object.
19028 @code{protected} and @code{internal} are pretty useless in real-world
19029 usage so the only other commonly used option will be @code{hidden}.
19030 The default if @option{-fvisibility} isn't specified is
19031 @code{default}, i.e., make every
19032 symbol public---this causes the same behavior as previous versions of
19033 GCC@.
19034
19035 A good explanation of the benefits offered by ensuring ELF
19036 symbols have the correct visibility is given by ``How To Write
19037 Shared Libraries'' by Ulrich Drepper (which can be found at
19038 @w{@uref{http://people.redhat.com/~drepper/}})---however a superior
19039 solution made possible by this option to marking things hidden when
19040 the default is public is to make the default hidden and mark things
19041 public. This is the norm with DLL's on Windows and with @option{-fvisibility=hidden}
19042 and @code{__attribute__ ((visibility("default")))} instead of
19043 @code{__declspec(dllexport)} you get almost identical semantics with
19044 identical syntax. This is a great boon to those working with
19045 cross-platform projects.
19046
19047 For those adding visibility support to existing code, you may find
19048 @samp{#pragma GCC visibility} of use. This works by you enclosing
19049 the declarations you wish to set visibility for with (for example)
19050 @samp{#pragma GCC visibility push(hidden)} and
19051 @samp{#pragma GCC visibility pop}.
19052 Bear in mind that symbol visibility should be viewed @strong{as
19053 part of the API interface contract} and thus all new code should
19054 always specify visibility when it is not the default; i.e., declarations
19055 only for use within the local DSO should @strong{always} be marked explicitly
19056 as hidden as so to avoid PLT indirection overheads---making this
19057 abundantly clear also aids readability and self-documentation of the code.
19058 Note that due to ISO C++ specification requirements, operator new and
19059 operator delete must always be of default visibility.
19060
19061 Be aware that headers from outside your project, in particular system
19062 headers and headers from any other library you use, may not be
19063 expecting to be compiled with visibility other than the default. You
19064 may need to explicitly say @samp{#pragma GCC visibility push(default)}
19065 before including any such headers.
19066
19067 @samp{extern} declarations are not affected by @samp{-fvisibility}, so
19068 a lot of code can be recompiled with @samp{-fvisibility=hidden} with
19069 no modifications. However, this means that calls to @samp{extern}
19070 functions with no explicit visibility will use the PLT, so it is more
19071 effective to use @samp{__attribute ((visibility))} and/or
19072 @samp{#pragma GCC visibility} to tell the compiler which @samp{extern}
19073 declarations should be treated as hidden.
19074
19075 Note that @samp{-fvisibility} does affect C++ vague linkage
19076 entities. This means that, for instance, an exception class that will
19077 be thrown between DSOs must be explicitly marked with default
19078 visibility so that the @samp{type_info} nodes will be unified between
19079 the DSOs.
19080
19081 An overview of these techniques, their benefits and how to use them
19082 is at @uref{http://gcc.gnu.org/@/wiki/@/Visibility}.
19083
19084 @item -fstrict-volatile-bitfields
19085 @opindex fstrict-volatile-bitfields
19086 This option should be used if accesses to volatile bitfields (or other
19087 structure fields, although the compiler usually honors those types
19088 anyway) should use a single access of the width of the
19089 field's type, aligned to a natural alignment if possible. For
19090 example, targets with memory-mapped peripheral registers might require
19091 all such accesses to be 16 bits wide; with this flag the user could
19092 declare all peripheral bitfields as ``unsigned short'' (assuming short
19093 is 16 bits on these targets) to force GCC to use 16 bit accesses
19094 instead of, perhaps, a more efficient 32 bit access.
19095
19096 If this option is disabled, the compiler will use the most efficient
19097 instruction. In the previous example, that might be a 32-bit load
19098 instruction, even though that will access bytes that do not contain
19099 any portion of the bitfield, or memory-mapped registers unrelated to
19100 the one being updated.
19101
19102 If the target requires strict alignment, and honoring the field
19103 type would require violating this alignment, a warning is issued.
19104 If the field has @code{packed} attribute, the access is done without
19105 honoring the field type. If the field doesn't have @code{packed}
19106 attribute, the access is done honoring the field type. In both cases,
19107 GCC assumes that the user knows something about the target hardware
19108 that it is unaware of.
19109
19110 The default value of this option is determined by the application binary
19111 interface for the target processor.
19112
19113 @end table
19114
19115 @c man end
19116
19117 @node Environment Variables
19118 @section Environment Variables Affecting GCC
19119 @cindex environment variables
19120
19121 @c man begin ENVIRONMENT
19122 This section describes several environment variables that affect how GCC
19123 operates. Some of them work by specifying directories or prefixes to use
19124 when searching for various kinds of files. Some are used to specify other
19125 aspects of the compilation environment.
19126
19127 Note that you can also specify places to search using options such as
19128 @option{-B}, @option{-I} and @option{-L} (@pxref{Directory Options}). These
19129 take precedence over places specified using environment variables, which
19130 in turn take precedence over those specified by the configuration of GCC@.
19131 @xref{Driver,, Controlling the Compilation Driver @file{gcc}, gccint,
19132 GNU Compiler Collection (GCC) Internals}.
19133
19134 @table @env
19135 @item LANG
19136 @itemx LC_CTYPE
19137 @c @itemx LC_COLLATE
19138 @itemx LC_MESSAGES
19139 @c @itemx LC_MONETARY
19140 @c @itemx LC_NUMERIC
19141 @c @itemx LC_TIME
19142 @itemx LC_ALL
19143 @findex LANG
19144 @findex LC_CTYPE
19145 @c @findex LC_COLLATE
19146 @findex LC_MESSAGES
19147 @c @findex LC_MONETARY
19148 @c @findex LC_NUMERIC
19149 @c @findex LC_TIME
19150 @findex LC_ALL
19151 @cindex locale
19152 These environment variables control the way that GCC uses
19153 localization information that allow GCC to work with different
19154 national conventions. GCC inspects the locale categories
19155 @env{LC_CTYPE} and @env{LC_MESSAGES} if it has been configured to do
19156 so. These locale categories can be set to any value supported by your
19157 installation. A typical value is @samp{en_GB.UTF-8} for English in the United
19158 Kingdom encoded in UTF-8.
19159
19160 The @env{LC_CTYPE} environment variable specifies character
19161 classification. GCC uses it to determine the character boundaries in
19162 a string; this is needed for some multibyte encodings that contain quote
19163 and escape characters that would otherwise be interpreted as a string
19164 end or escape.
19165
19166 The @env{LC_MESSAGES} environment variable specifies the language to
19167 use in diagnostic messages.
19168
19169 If the @env{LC_ALL} environment variable is set, it overrides the value
19170 of @env{LC_CTYPE} and @env{LC_MESSAGES}; otherwise, @env{LC_CTYPE}
19171 and @env{LC_MESSAGES} default to the value of the @env{LANG}
19172 environment variable. If none of these variables are set, GCC
19173 defaults to traditional C English behavior.
19174
19175 @item TMPDIR
19176 @findex TMPDIR
19177 If @env{TMPDIR} is set, it specifies the directory to use for temporary
19178 files. GCC uses temporary files to hold the output of one stage of
19179 compilation which is to be used as input to the next stage: for example,
19180 the output of the preprocessor, which is the input to the compiler
19181 proper.
19182
19183 @item GCC_COMPARE_DEBUG
19184 @findex GCC_COMPARE_DEBUG
19185 Setting @env{GCC_COMPARE_DEBUG} is nearly equivalent to passing
19186 @option{-fcompare-debug} to the compiler driver. See the documentation
19187 of this option for more details.
19188
19189 @item GCC_EXEC_PREFIX
19190 @findex GCC_EXEC_PREFIX
19191 If @env{GCC_EXEC_PREFIX} is set, it specifies a prefix to use in the
19192 names of the subprograms executed by the compiler. No slash is added
19193 when this prefix is combined with the name of a subprogram, but you can
19194 specify a prefix that ends with a slash if you wish.
19195
19196 If @env{GCC_EXEC_PREFIX} is not set, GCC will attempt to figure out
19197 an appropriate prefix to use based on the pathname it was invoked with.
19198
19199 If GCC cannot find the subprogram using the specified prefix, it
19200 tries looking in the usual places for the subprogram.
19201
19202 The default value of @env{GCC_EXEC_PREFIX} is
19203 @file{@var{prefix}/lib/gcc/} where @var{prefix} is the prefix to
19204 the installed compiler. In many cases @var{prefix} is the value
19205 of @code{prefix} when you ran the @file{configure} script.
19206
19207 Other prefixes specified with @option{-B} take precedence over this prefix.
19208
19209 This prefix is also used for finding files such as @file{crt0.o} that are
19210 used for linking.
19211
19212 In addition, the prefix is used in an unusual way in finding the
19213 directories to search for header files. For each of the standard
19214 directories whose name normally begins with @samp{/usr/local/lib/gcc}
19215 (more precisely, with the value of @env{GCC_INCLUDE_DIR}), GCC tries
19216 replacing that beginning with the specified prefix to produce an
19217 alternate directory name. Thus, with @option{-Bfoo/}, GCC will search
19218 @file{foo/bar} where it would normally search @file{/usr/local/lib/bar}.
19219 These alternate directories are searched first; the standard directories
19220 come next. If a standard directory begins with the configured
19221 @var{prefix} then the value of @var{prefix} is replaced by
19222 @env{GCC_EXEC_PREFIX} when looking for header files.
19223
19224 @item COMPILER_PATH
19225 @findex COMPILER_PATH
19226 The value of @env{COMPILER_PATH} is a colon-separated list of
19227 directories, much like @env{PATH}. GCC tries the directories thus
19228 specified when searching for subprograms, if it can't find the
19229 subprograms using @env{GCC_EXEC_PREFIX}.
19230
19231 @item LIBRARY_PATH
19232 @findex LIBRARY_PATH
19233 The value of @env{LIBRARY_PATH} is a colon-separated list of
19234 directories, much like @env{PATH}. When configured as a native compiler,
19235 GCC tries the directories thus specified when searching for special
19236 linker files, if it can't find them using @env{GCC_EXEC_PREFIX}. Linking
19237 using GCC also uses these directories when searching for ordinary
19238 libraries for the @option{-l} option (but directories specified with
19239 @option{-L} come first).
19240
19241 @item LANG
19242 @findex LANG
19243 @cindex locale definition
19244 This variable is used to pass locale information to the compiler. One way in
19245 which this information is used is to determine the character set to be used
19246 when character literals, string literals and comments are parsed in C and C++.
19247 When the compiler is configured to allow multibyte characters,
19248 the following values for @env{LANG} are recognized:
19249
19250 @table @samp
19251 @item C-JIS
19252 Recognize JIS characters.
19253 @item C-SJIS
19254 Recognize SJIS characters.
19255 @item C-EUCJP
19256 Recognize EUCJP characters.
19257 @end table
19258
19259 If @env{LANG} is not defined, or if it has some other value, then the
19260 compiler will use mblen and mbtowc as defined by the default locale to
19261 recognize and translate multibyte characters.
19262 @end table
19263
19264 @noindent
19265 Some additional environments variables affect the behavior of the
19266 preprocessor.
19267
19268 @include cppenv.texi
19269
19270 @c man end
19271
19272 @node Precompiled Headers
19273 @section Using Precompiled Headers
19274 @cindex precompiled headers
19275 @cindex speed of compilation
19276
19277 Often large projects have many header files that are included in every
19278 source file. The time the compiler takes to process these header files
19279 over and over again can account for nearly all of the time required to
19280 build the project. To make builds faster, GCC allows users to
19281 `precompile' a header file; then, if builds can use the precompiled
19282 header file they will be much faster.
19283
19284 To create a precompiled header file, simply compile it as you would any
19285 other file, if necessary using the @option{-x} option to make the driver
19286 treat it as a C or C++ header file. You will probably want to use a
19287 tool like @command{make} to keep the precompiled header up-to-date when
19288 the headers it contains change.
19289
19290 A precompiled header file will be searched for when @code{#include} is
19291 seen in the compilation. As it searches for the included file
19292 (@pxref{Search Path,,Search Path,cpp,The C Preprocessor}) the
19293 compiler looks for a precompiled header in each directory just before it
19294 looks for the include file in that directory. The name searched for is
19295 the name specified in the @code{#include} with @samp{.gch} appended. If
19296 the precompiled header file can't be used, it is ignored.
19297
19298 For instance, if you have @code{#include "all.h"}, and you have
19299 @file{all.h.gch} in the same directory as @file{all.h}, then the
19300 precompiled header file will be used if possible, and the original
19301 header will be used otherwise.
19302
19303 Alternatively, you might decide to put the precompiled header file in a
19304 directory and use @option{-I} to ensure that directory is searched
19305 before (or instead of) the directory containing the original header.
19306 Then, if you want to check that the precompiled header file is always
19307 used, you can put a file of the same name as the original header in this
19308 directory containing an @code{#error} command.
19309
19310 This also works with @option{-include}. So yet another way to use
19311 precompiled headers, good for projects not designed with precompiled
19312 header files in mind, is to simply take most of the header files used by
19313 a project, include them from another header file, precompile that header
19314 file, and @option{-include} the precompiled header. If the header files
19315 have guards against multiple inclusion, they will be skipped because
19316 they've already been included (in the precompiled header).
19317
19318 If you need to precompile the same header file for different
19319 languages, targets, or compiler options, you can instead make a
19320 @emph{directory} named like @file{all.h.gch}, and put each precompiled
19321 header in the directory, perhaps using @option{-o}. It doesn't matter
19322 what you call the files in the directory, every precompiled header in
19323 the directory will be considered. The first precompiled header
19324 encountered in the directory that is valid for this compilation will
19325 be used; they're searched in no particular order.
19326
19327 There are many other possibilities, limited only by your imagination,
19328 good sense, and the constraints of your build system.
19329
19330 A precompiled header file can be used only when these conditions apply:
19331
19332 @itemize
19333 @item
19334 Only one precompiled header can be used in a particular compilation.
19335
19336 @item
19337 A precompiled header can't be used once the first C token is seen. You
19338 can have preprocessor directives before a precompiled header; you can
19339 even include a precompiled header from inside another header, so long as
19340 there are no C tokens before the @code{#include}.
19341
19342 @item
19343 The precompiled header file must be produced for the same language as
19344 the current compilation. You can't use a C precompiled header for a C++
19345 compilation.
19346
19347 @item
19348 The precompiled header file must have been produced by the same compiler
19349 binary as the current compilation is using.
19350
19351 @item
19352 Any macros defined before the precompiled header is included must
19353 either be defined in the same way as when the precompiled header was
19354 generated, or must not affect the precompiled header, which usually
19355 means that they don't appear in the precompiled header at all.
19356
19357 The @option{-D} option is one way to define a macro before a
19358 precompiled header is included; using a @code{#define} can also do it.
19359 There are also some options that define macros implicitly, like
19360 @option{-O} and @option{-Wdeprecated}; the same rule applies to macros
19361 defined this way.
19362
19363 @item If debugging information is output when using the precompiled
19364 header, using @option{-g} or similar, the same kind of debugging information
19365 must have been output when building the precompiled header. However,
19366 a precompiled header built using @option{-g} can be used in a compilation
19367 when no debugging information is being output.
19368
19369 @item The same @option{-m} options must generally be used when building
19370 and using the precompiled header. @xref{Submodel Options},
19371 for any cases where this rule is relaxed.
19372
19373 @item Each of the following options must be the same when building and using
19374 the precompiled header:
19375
19376 @gccoptlist{-fexceptions}
19377
19378 @item
19379 Some other command-line options starting with @option{-f},
19380 @option{-p}, or @option{-O} must be defined in the same way as when
19381 the precompiled header was generated. At present, it's not clear
19382 which options are safe to change and which are not; the safest choice
19383 is to use exactly the same options when generating and using the
19384 precompiled header. The following are known to be safe:
19385
19386 @gccoptlist{-fmessage-length= -fpreprocessed -fsched-interblock @gol
19387 -fsched-spec -fsched-spec-load -fsched-spec-load-dangerous @gol
19388 -fsched-verbose=@var{number} -fschedule-insns -fvisibility= @gol
19389 -pedantic-errors}
19390
19391 @end itemize
19392
19393 For all of these except the last, the compiler will automatically
19394 ignore the precompiled header if the conditions aren't met. If you
19395 find an option combination that doesn't work and doesn't cause the
19396 precompiled header to be ignored, please consider filing a bug report,
19397 see @ref{Bugs}.
19398
19399 If you do use differing options when generating and using the
19400 precompiled header, the actual behavior will be a mixture of the
19401 behavior for the options. For instance, if you use @option{-g} to
19402 generate the precompiled header but not when using it, you may or may
19403 not get debugging information for routines in the precompiled header.